Skip to content

Commit 1a18bff

Browse files
committed
fix(chat): collapse main tool groups into action summaries
1 parent 243dbe6 commit 1a18bff

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/agent-group/agent-group.test.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,26 @@ describe('AgentGroup inline main activity', () => {
195195
expect(Boolean(container.querySelector('[class*="shimmer"]'))).toBe(status === 'executing')
196196
})
197197

198+
it('preserves manual expansion when more main-agent tools arrive', () => {
199+
const items = [tool('success'), tool('executing')]
200+
const render = (nextItems: AgentGroupItem[]) => act(() => {
201+
root.render(createElement(AgentGroup, {
202+
agentName: 'mothership', agentLabel: 'Sim', items: nextItems,
203+
isStreaming: true, isLaneOpen: true,
204+
}))
205+
})
206+
render(items)
207+
const header = () => container.querySelector<HTMLElement>('[role="button"][aria-expanded]')
208+
expect(header()?.getAttribute('aria-expanded')).toBe('false')
209+
act(() => header()?.click())
210+
expect(header()?.getAttribute('aria-expanded')).toBe('true')
211+
render([...items, tool('executing')])
212+
expect(header()?.getAttribute('aria-expanded')).toBe('true')
213+
act(() => header()?.click())
214+
render([...items, tool('executing')])
215+
expect(header()?.getAttribute('aria-expanded')).toBe('false')
216+
})
217+
198218
it('paces the active status in place and expands the full completed history', () => {
199219
vi.useFakeTimers()
200220
const first: AgentGroupItem = {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ export const TOOL_ICONS: Readonly<Record<string, IconComponent>> = {
186186
workflow: Hammer,
187187
}
188188

189-
export function getAgentIcon(name: string): IconComponent {
190-
return Object.hasOwn(TOOL_ICONS, name) ? TOOL_ICONS[name] : Blimp
189+
export function getAgentIcon(name: string, fallback: IconComponent = Blimp): IconComponent {
190+
return Object.hasOwn(TOOL_ICONS, name) ? TOOL_ICONS[name] : fallback
191191
}
192192

193193
export function getToolIcon(name: string): IconComponent {

0 commit comments

Comments
 (0)