Skip to content

Commit 58fc927

Browse files
committed
Remove footer with agent status from AgentBlockGrid
1 parent e2fa985 commit 58fc927

File tree

2 files changed

+11
-85
lines changed

2 files changed

+11
-85
lines changed

cli/src/components/__tests__/agent-grid.test.tsx

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe('AgentBlockGrid (via MessageBlock)', () => {
139139
})
140140

141141
describe('multiple agents rendering', () => {
142-
test('renders multiple agents with count header', () => {
142+
test('renders multiple agents without footer label', () => {
143143
const blocks: ContentBlock[] = [
144144
createAgentBlock('agent-1', 'File Picker', 'file-picker'),
145145
createAgentBlock('agent-2', 'Code Searcher', 'code-searcher'),
@@ -153,10 +153,11 @@ describe('AgentBlockGrid (via MessageBlock)', () => {
153153
expect(markup).toContain('File Picker')
154154
expect(markup).toContain('Code Searcher')
155155
expect(markup).toContain('Commander')
156-
expect(markup).toContain('3 agents completed')
156+
// Footer label was removed as redundant
157+
expect(markup).not.toContain('agents completed')
157158
})
158159

159-
test('shows running count when agents are running', () => {
160+
test('renders running agents without footer label', () => {
160161
const blocks: ContentBlock[] = [
161162
createAgentBlock('agent-1', 'File Picker', 'file-picker', 'running'),
162163
createAgentBlock('agent-2', 'Code Searcher', 'code-searcher', 'running'),
@@ -166,37 +167,10 @@ describe('AgentBlockGrid (via MessageBlock)', () => {
166167
<MessageBlock {...baseMessageBlockProps} blocks={blocks} />,
167168
)
168169

169-
expect(markup).toContain('2 agents running')
170-
})
171-
172-
test('shows running when at least one agent is running', () => {
173-
const blocks: ContentBlock[] = [
174-
createAgentBlock('agent-1', 'File Picker', 'file-picker', 'complete'),
175-
createAgentBlock('agent-2', 'Code Searcher', 'code-searcher', 'running'),
176-
]
177-
178-
const markup = renderToStaticMarkup(
179-
<MessageBlock {...baseMessageBlockProps} blocks={blocks} />,
180-
)
181-
182-
expect(markup).toContain('2 agents running')
183-
})
184-
185-
test('shows running when agent is in streamingAgents set', () => {
186-
const blocks: ContentBlock[] = [
187-
createAgentBlock('agent-1', 'File Picker', 'file-picker', 'complete'),
188-
createAgentBlock('agent-2', 'Code Searcher', 'code-searcher', 'complete'),
189-
]
190-
191-
const markup = renderToStaticMarkup(
192-
<MessageBlock
193-
{...baseMessageBlockProps}
194-
blocks={blocks}
195-
streamingAgents={new Set(['agent-1'])}
196-
/>,
197-
)
198-
199-
expect(markup).toContain('2 agents running')
170+
expect(markup).toContain('File Picker')
171+
expect(markup).toContain('Code Searcher')
172+
// Footer label was removed as redundant
173+
expect(markup).not.toContain('agents running')
200174
})
201175
})
202176

@@ -237,7 +211,6 @@ describe('AgentBlockGrid (via MessageBlock)', () => {
237211
expect(markup).toContain('File Picker')
238212
expect(markup).toContain('Code Searcher')
239213
expect(markup).toContain('After agents')
240-
expect(markup).toContain('2 agents completed')
241214
})
242215

243216
test('groups only consecutive non-implementor agents', () => {
@@ -252,9 +225,9 @@ describe('AgentBlockGrid (via MessageBlock)', () => {
252225
<MessageBlock {...baseMessageBlockProps} blocks={blocks} />,
253226
)
254227

255-
// First group of 2 agents
256-
expect(markup).toContain('2 agents completed')
257-
// Single agent after separator shouldn't have header
228+
expect(markup).toContain('File Picker 1')
229+
expect(markup).toContain('File Picker 2')
230+
expect(markup).toContain('Separator')
258231
expect(markup).toContain('Commander')
259232
})
260233
})
@@ -529,7 +502,6 @@ describe('Grid layout width handling', () => {
529502

530503
expect(markup).toContain('Agent 1')
531504
expect(markup).toContain('Agent 2')
532-
expect(markup).toContain('2 agents completed')
533505
})
534506

535507
test('renders with medium width (up to 2 columns)', () => {
@@ -562,6 +534,5 @@ describe('Grid layout width handling', () => {
562534
expect(markup).toContain('Agent 1')
563535
expect(markup).toContain('Agent 2')
564536
expect(markup).toContain('Agent 3')
565-
expect(markup).toContain('3 agents completed')
566537
})
567538
})

cli/src/components/blocks/agent-block-grid.tsx

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import { pluralize } from '@codebuff/common/util/string'
2-
import { TextAttributes } from '@opentui/core'
31
import React, { memo, useCallback } from 'react'
42

53
import { GridLayout } from '../grid-layout'
6-
import { useTheme } from '../../hooks/use-theme'
74
import type { AgentContentBlock } from '../../types/chat'
85

96
export interface AgentBlockGridProps {
@@ -18,41 +15,13 @@ export interface AgentBlockGridProps {
1815
) => React.ReactNode
1916
}
2017

21-
export function getAgentStatusSummary(
22-
agentBlocks: AgentContentBlock[],
23-
streamingAgents: Set<string>,
24-
): string {
25-
const running = agentBlocks.filter(
26-
(agent) => agent.status === 'running' || streamingAgents.has(agent.agentId),
27-
).length
28-
const failed = agentBlocks.filter((agent) => agent.status === 'failed').length
29-
const completed = agentBlocks.filter((agent) => agent.status === 'complete').length
30-
31-
if (running > 0) {
32-
return `${pluralize(agentBlocks.length, 'agent')} running`
33-
}
34-
35-
if (failed > 0 && completed > 0) {
36-
return `${failed} failed, ${completed} completed`
37-
}
38-
39-
if (failed > 0) {
40-
return `${pluralize(failed, 'agent')} failed`
41-
}
42-
43-
return `${pluralize(agentBlocks.length, 'agent')} completed`
44-
}
45-
4618
export const AgentBlockGrid = memo(
4719
({
4820
agentBlocks,
4921
keyPrefix,
5022
availableWidth,
51-
streamingAgents,
5223
renderAgentBranch,
5324
}: AgentBlockGridProps) => {
54-
const theme = useTheme()
55-
5625
const getItemKey = useCallback(
5726
(agentBlock: AgentContentBlock) => agentBlock.agentId,
5827
[],
@@ -66,26 +35,12 @@ export const AgentBlockGrid = memo(
6635

6736
if (agentBlocks.length === 0) return null
6837

69-
const headerText = getAgentStatusSummary(agentBlocks, streamingAgents)
70-
const hasFailed = agentBlocks.some((agent) => agent.status === 'failed')
71-
const showHeader = agentBlocks.length > 1
72-
73-
const footer = showHeader ? (
74-
<text
75-
fg={hasFailed ? theme.error : theme.muted}
76-
attributes={TextAttributes.DIM}
77-
>
78-
{headerText}
79-
</text>
80-
) : undefined
81-
8238
return (
8339
<GridLayout
8440
items={agentBlocks}
8541
availableWidth={availableWidth}
8642
getItemKey={getItemKey}
8743
renderItem={renderItem}
88-
footer={footer}
8944
marginTop={1}
9045
/>
9146
)

0 commit comments

Comments
 (0)