Skip to content

Commit 3529859

Browse files
committed
chore(chat): enforce activity icon catalog coverage
1 parent 2f00f4c commit 3529859

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

apps/sim/app/workspace/[workspaceId]/home/components/message-content/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import type { ToolCallStatus } from '@/app/workspace/[workspaceId]/home/types'
3434

3535
export type IconComponent = ComponentType<SVGProps<SVGSVGElement>>
3636

37-
const TOOL_ICONS: Record<string, IconComponent> = {
37+
export const TOOL_ICONS: Readonly<Record<string, IconComponent>> = {
3838
agent: Brain,
3939
apply_file_edit: File,
4040
auth: Integration,
@@ -87,6 +87,7 @@ const TOOL_ICONS: Record<string, IconComponent> = {
8787
diff_workflows: Layout,
8888
download_file: File,
8989
edit_workflow: Pencil,
90+
extensions: Brain,
9091
extract_doc_assets: File,
9192
ffmpeg: Wrench,
9293
file: File,

apps/sim/lib/copilot/tools/tool-activity.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,26 @@ import { describe, expect, it } from 'vitest'
66
import { TOOL_CATALOG } from '@/lib/copilot/generated/tool-catalog-v1'
77
import { isToolHiddenInUi } from '@/lib/copilot/tools/client/hidden-tools'
88
import { getToolActivityLabel, TOOL_ACTIVITIES } from '@/lib/copilot/tools/tool-activity'
9+
import { TOOL_ICONS } from '@/app/workspace/[workspaceId]/home/components/message-content/utils'
910

1011
const visibleTools = Object.values(TOOL_CATALOG).filter(
1112
(tool) => tool.route !== 'subagent' && !tool.hidden && !isToolHiddenInUi(tool.id)
1213
)
1314

1415
describe('tool activity catalog coverage', () => {
16+
it('covers subagent icons under their dispatch and stream names', () => {
17+
for (const tool of Object.values(TOOL_CATALOG)) {
18+
if (tool.route !== 'subagent') continue
19+
expect(Object.hasOwn(TOOL_ICONS, tool.id), tool.id).toBe(true)
20+
if (tool.subagentId) {
21+
expect(Object.hasOwn(TOOL_ICONS, tool.subagentId), tool.subagentId).toBe(true)
22+
}
23+
}
24+
})
25+
1526
it.each(visibleTools)('explicitly describes $id and every declared operation', (tool) => {
16-
expect(Object.hasOwn(TOOL_ACTIVITIES, tool.id), tool.id).toBe(true)
27+
expect(Object.hasOwn(TOOL_ACTIVITIES, tool.id), `${tool.id} summary`).toBe(true)
28+
expect(Object.hasOwn(TOOL_ICONS, tool.id), `${tool.id} icon`).toBe(true)
1729
const activity = TOOL_ACTIVITIES[tool.id]
1830
const properties = isRecordLike(tool.parameters) ? tool.parameters.properties : undefined
1931
if (!isRecordLike(properties)) return

0 commit comments

Comments
 (0)