Skip to content

Commit 81a4256

Browse files
authored
improvement(tools): delete unreferenced tool response types and the dead generic resource data path (#8596)
* improvement(tools): delete unreferenced tool response types and the dead generic resource data path - delete 168 exported tool *Response types nothing references (mostly umbrella unions) and the 24 local types only they used - add-integration and add-tools templates declare one response type per tool and no umbrella union - drop the never-set genericResourceData chat field; the generic resource panel renders its empty state directly * chore(skills): name InternalToolConfig beside ToolConfig in the response-type guidance
1 parent 35adcf7 commit 81a4256

153 files changed

Lines changed: 12 additions & 3184 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/skills/add-integration/SKILL.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,15 @@ export interface {Service}{Action}Params {
8585
optionalParam?: string
8686
}
8787

88-
export interface {Service}Response extends ToolResponse {
88+
export interface {Service}{Action}Response extends ToolResponse {
8989
output: {
9090
// Define output structure
9191
}
9292
}
9393
```
9494

95+
Declare one response interface per tool, imported by that tool's `ToolConfig<Params, Response>` (or `InternalToolConfig` for in-process work). Never add an umbrella `{Service}Response` union: nothing imports it.
96+
9597
**Tool file pattern:** an external provider API uses `ToolConfig` with `request` (absolute `https://` URL, headers, body, `transformResponse`); same-process Sim work uses `InternalToolConfig` with `operation`. Both full templates, param visibility rules, and output typing live in `.agents/skills/add-tools/SKILL.md` — read it before writing the first tool.
9698

9799
### Critical Rules

‎.agents/skills/add-tools/SKILL.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,8 @@ export interface {Service}{Action}Response extends ToolResponse {
423423
}
424424
```
425425

426+
Each response interface is imported by its tool's config: `ToolConfig<Params, Response>` for an external API, `InternalToolConfig<Params, Response>` for in-process work. Never add an umbrella `{Service}Response` union of them: nothing imports it.
427+
426428
## Index.ts Barrel Export Pattern
427429

428430
```typescript

‎apps/sim/app/workspace/[workspaceId]/home/components/chat-resource-panel.tsx‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export function ChatResourcePanel({
4747
setTableViewContext,
4848
previewSession,
4949
isSending,
50-
genericResourceData,
5150
} = chat
5251
const {
5352
isResourceCollapsed,
@@ -102,7 +101,6 @@ export function ChatResourcePanel({
102101
isCollapsed={isResourceCollapsed}
103102
previewSession={previewSession}
104103
isAgentResponding={isSending}
105-
genericResourceData={genericResourceData ?? undefined}
106104
onSummarize={summarize}
107105
onUserInteraction={handleResourceInteraction}
108106
className={skipResourceTransition ? 'transition-none!' : undefined}
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,8 @@
1-
'use client'
2-
3-
import { useEffect, useRef } from 'react'
4-
import { PillsRing } from '@sim/emcn'
5-
import { getToolStatusDisplayTitle } from '@/lib/mothership/tools/tool-display'
6-
import type { GenericResourceData } from '@/app/workspace/[workspaceId]/home/types'
7-
8-
interface GenericResourceContentProps {
9-
data: GenericResourceData
10-
}
11-
12-
// TODO: Emir — replace with rich UI (status icons, collapsible result cards, copy-to-clipboard, etc.)
13-
export function GenericResourceContent({ data }: GenericResourceContentProps) {
14-
const bottomRef = useRef<HTMLDivElement>(null)
15-
16-
useEffect(() => {
17-
const el = bottomRef.current
18-
const container = el?.parentElement
19-
if (container) {
20-
container.scrollTop = container.scrollHeight
21-
}
22-
}, [data.entries.length])
23-
24-
if (data.entries.length === 0) {
25-
return (
26-
<div className='flex h-full items-center justify-center'>
27-
<p className='text-[var(--text-muted)] text-small'>No results yet</p>
28-
</div>
29-
)
30-
}
31-
1+
/** The panel for a `generic` resource, which carries no content of its own. */
2+
export function GenericResourceContent() {
323
return (
33-
<div className='flex h-full flex-col divide-y divide-[var(--border)] overflow-y-auto [scrollbar-gutter:stable]'>
34-
{data.entries.map((entry) => (
35-
<div key={entry.toolCallId} className='flex flex-col gap-2 px-4 py-3'>
36-
<div className='flex items-center gap-2'>
37-
{entry.status === 'executing' && (
38-
<PillsRing className='size-[14px] shrink-0 text-[var(--text-tertiary)]' animate />
39-
)}
40-
<span className='text-[var(--text-primary)] text-small'>
41-
{getToolStatusDisplayTitle(entry.displayTitle, entry.status, entry.toolName)}
42-
</span>
43-
{entry.status === 'error' && (
44-
<span className='ml-auto text-[var(--text-error)] text-caption'>Error</span>
45-
)}
46-
{entry.status === 'skipped' && (
47-
<span className='ml-auto text-[var(--text-muted)] text-caption'>Skipped</span>
48-
)}
49-
{entry.status === 'rejected' && (
50-
<span className='ml-auto text-[var(--text-muted)] text-caption'>Rejected</span>
51-
)}
52-
</div>
53-
{entry.streamingArgs && (
54-
<pre className='overflow-x-auto whitespace-pre-wrap break-words font-mono text-[var(--text-body)] text-caption'>
55-
{entry.streamingArgs}
56-
</pre>
57-
)}
58-
{!entry.streamingArgs && entry.result?.output != null && (
59-
<pre className='overflow-x-auto whitespace-pre-wrap break-words font-mono text-[var(--text-body)] text-caption'>
60-
{typeof entry.result.output === 'string'
61-
? entry.result.output
62-
: JSON.stringify(entry.result.output, null, 2)}
63-
</pre>
64-
)}
65-
{entry.result?.error && (
66-
<p className='text-[var(--text-error)] text-caption'>{entry.result.error}</p>
67-
)}
68-
</div>
69-
))}
70-
<div ref={bottomRef} />
4+
<div className='flex h-full items-center justify-center'>
5+
<p className='text-[var(--text-muted)] text-small'>No results yet</p>
716
</div>
727
)
738
}

‎apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/resource-content.tsx‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ import { GenericResourceContent } from '@/app/workspace/[workspaceId]/home/compo
4545
import { TerminalSession } from '@/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/components/terminal-session/terminal-session'
4646
import { RESOURCE_TAB_ICON_CLASS } from '@/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-tabs/resource-tab-controls'
4747
import { hasRenderableFilePreviewContent } from '@/app/workspace/[workspaceId]/home/hooks/preview'
48-
import type {
49-
GenericResourceData,
50-
MothershipResource,
51-
} from '@/app/workspace/[workspaceId]/home/types'
48+
import type { MothershipResource } from '@/app/workspace/[workspaceId]/home/types'
5249
import { KnowledgeBase } from '@/app/workspace/[workspaceId]/knowledge/[id]/base'
5350
import { LogDetailsContent } from '@/app/workspace/[workspaceId]/logs/components'
5451
import { useFeatureFlag } from '@/app/workspace/[workspaceId]/providers/feature-flags-provider'
@@ -113,7 +110,6 @@ interface ResourceContentProps {
113110
previewMode?: PreviewMode
114111
previewSession?: FilePreviewSession | null
115112
isAgentResponding?: boolean
116-
genericResourceData?: GenericResourceData
117113
previewContextKey?: string
118114
onNotFound?: (resourceId: string) => void
119115
/**
@@ -187,7 +183,6 @@ export const ResourceContent = memo(function ResourceContent({
187183
previewMode,
188184
previewSession,
189185
isAgentResponding,
190-
genericResourceData,
191186
previewContextKey,
192187
onNotFound,
193188
visible = true,
@@ -351,9 +346,7 @@ export const ResourceContent = memo(function ResourceContent({
351346
)
352347

353348
case 'generic':
354-
return (
355-
<GenericResourceContent key={resource.id} data={genericResourceData ?? { entries: [] }} />
356-
)
349+
return <GenericResourceContent key={resource.id} />
357350

358351
case 'browser':
359352
// One panel serves every browser tab of the chat: the desktop app

‎apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/mothership-view.tsx‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import { TerminalSession } from '@/app/workspace/[workspaceId]/home/components/m
2727
import { ResourceWorkspaceHost } from '@/app/workspace/[workspaceId]/home/components/resource-workspace-host'
2828
import { hasRenderableFilePreviewContent } from '@/app/workspace/[workspaceId]/home/hooks/preview'
2929
import type {
30-
GenericResourceData,
3130
MothershipResource,
3231
MothershipResourceType,
3332
} from '@/app/workspace/[workspaceId]/home/types'
@@ -105,7 +104,6 @@ interface MothershipViewProps {
105104
previewSession?: FilePreviewSession | null
106105
isAgentResponding?: boolean
107106
onSummarize: (message: string, filters: WorkspaceSearchFilters) => void
108-
genericResourceData?: GenericResourceData
109107
/** Claims the current resource selection after direct panel interaction. */
110108
onUserInteraction?: () => void
111109
}
@@ -126,7 +124,6 @@ export const MothershipView = memo(
126124
className,
127125
previewSession,
128126
isAgentResponding,
129-
genericResourceData,
130127
onSummarize,
131128
onUserInteraction,
132129
}: MothershipViewProps,
@@ -316,7 +313,6 @@ export const MothershipView = memo(
316313
previewMode={isActivePreviewable ? previewMode : undefined}
317314
previewSession={previewForActive}
318315
isAgentResponding={isAgentResponding}
319-
genericResourceData={active.type === 'generic' ? genericResourceData : undefined}
320316
previewContextKey={chatId}
321317
onNotFound={(resourceId) => removeResource('log', resourceId, active.workspaceId)}
322318
/>
@@ -348,8 +344,7 @@ function ScopedResourceContent({
348344
if (props.resource.type === 'search')
349345
return <SearchResourceContent resource={props.resource} onSummarize={onSummarize} />
350346
if (!workspaceId) {
351-
if (props.resource.type === 'generic')
352-
return <GenericResourceContent data={props.genericResourceData ?? { entries: [] }} />
347+
if (props.resource.type === 'generic') return <GenericResourceContent />
353348
if (props.resource.type === 'browser')
354349
return (
355350
<BrowserSession

‎apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ import type {
142142
ChatRequestMode,
143143
ContentBlock,
144144
FileAttachmentForApi,
145-
GenericResourceData,
146145
MothershipResource,
147146
MothershipResourceType,
148147
QueuedMessage,
@@ -281,7 +280,6 @@ export interface UseChatReturn {
281280
editingQueuedId: string | null
282281
dispatchingHeadId: string | null
283282
previewSession: FilePreviewSession | null
284-
genericResourceData: GenericResourceData | null
285283
getCurrentRequestId: () => string | undefined
286284
}
287285

@@ -4981,7 +4979,6 @@ export function useChat(
49814979
editingQueuedId,
49824980
dispatchingHeadId,
49834981
previewSession,
4984-
genericResourceData: null,
49854982
getCurrentRequestId,
49864983
}
49874984
}

‎apps/sim/app/workspace/[workspaceId]/home/types.ts‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,6 @@ interface ToolCallResult {
5555
error?: string
5656
}
5757

58-
interface GenericResourceEntry {
59-
toolCallId: string
60-
toolName: string
61-
displayTitle: string
62-
status: ToolCallStatus
63-
params?: Record<string, unknown>
64-
streamingArgs?: string
65-
result?: ToolCallResult
66-
}
67-
68-
export interface GenericResourceData {
69-
entries: GenericResourceEntry[]
70-
}
71-
7258
export interface ToolCallData {
7359
id: string
7460
toolName: string

‎apps/sim/blocks/blocks/airtable.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,6 @@ Return ONLY the valid JSON array of record ID strings - no explanations, no mark
457457
typecast: { type: 'boolean', description: 'Auto-convert string values to field types' },
458458
recordIds: { type: 'json', description: 'Record IDs to delete' }, // Required for delete
459459
},
460-
// Output structure depends on the operation, covered by AirtableResponse union type
461460
outputs: {
462461
bases: { type: 'json', description: 'List of accessible Airtable bases' },
463462
tables: { type: 'json', description: 'Table schemas with fields and views' },

‎apps/sim/tools/ahrefs/types.ts‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -569,28 +569,3 @@ export interface AhrefsPaidPagesResponse extends ToolResponse {
569569
paidPages: AhrefsPaidPage[]
570570
}
571571
}
572-
573-
export type AhrefsResponse =
574-
| AhrefsDomainRatingResponse
575-
| AhrefsBacklinksResponse
576-
| AhrefsBacklinksStatsResponse
577-
| AhrefsReferringDomainsResponse
578-
| AhrefsOrganicKeywordsResponse
579-
| AhrefsTopPagesResponse
580-
| AhrefsKeywordOverviewResponse
581-
| AhrefsBrokenBacklinksResponse
582-
| AhrefsMetricsResponse
583-
| AhrefsOrganicCompetitorsResponse
584-
| AhrefsRankTrackerOverviewResponse
585-
| AhrefsRankTrackerSerpOverviewResponse
586-
| AhrefsRankTrackerCompetitorsOverviewResponse
587-
| AhrefsRankTrackerCompetitorsStatsResponse
588-
| AhrefsBatchAnalysisResponse
589-
| AhrefsSiteAuditPageExplorerResponse
590-
| AhrefsDomainRatingHistoryResponse
591-
| AhrefsMetricsHistoryResponse
592-
| AhrefsRefdomainsHistoryResponse
593-
| AhrefsKeywordsHistoryResponse
594-
| AhrefsRelatedTermsResponse
595-
| AhrefsAnchorsResponse
596-
| AhrefsPaidPagesResponse

0 commit comments

Comments
 (0)