Skip to content

Commit fc7b2ea

Browse files
committed
Hide editor-implementors / selectors.
1 parent 15414c4 commit fc7b2ea

File tree

4 files changed

+62
-11
lines changed

4 files changed

+62
-11
lines changed

cli/src/components/message-block.tsx

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { TextAttributes } from '@opentui/core'
22
import { pluralize } from '@codebuff/common/util/string'
33
import React, { memo, useCallback, useMemo, type ReactNode } from 'react'
44

5+
import { shouldRenderAsSimpleText } from '../utils/constants'
56
import { AgentBranchItem } from './agent-branch-item'
67
import { ElapsedTimer } from './elapsed-timer'
78
import { FeedbackIconButton } from './feedback-icon-button'
@@ -28,6 +29,7 @@ import { ContentWithMarkdown } from './blocks/content-with-markdown'
2829
import { ToolBranch } from './blocks/tool-branch'
2930
import { PlanBox } from './renderers/plan-box'
3031
import { AgentListBranch } from './blocks/agent-list-branch'
32+
import { BULLET_CHAR } from '../utils/strings'
3133

3234
interface MessageBlockProps {
3335
messageId: string
@@ -85,7 +87,7 @@ export const MessageBlock = memo((props: MessageBlockProps): ReactNode => {
8587
})
8688

8789
const theme = useTheme()
88-
90+
8991
// Memoize selectors to prevent new function references on every render
9092
const selectIsFeedbackOpenMemo = useMemo(
9193
() => selectIsFeedbackOpenForMessage(messageId),
@@ -99,10 +101,12 @@ export const MessageBlock = memo((props: MessageBlockProps): ReactNode => {
99101
() => selectMessageFeedbackCategory(messageId),
100102
[messageId],
101103
)
102-
104+
103105
const isFeedbackOpen = useFeedbackStore(selectIsFeedbackOpenMemo)
104106
const hasSubmittedFeedback = useFeedbackStore(selectHasSubmittedFeedbackMemo)
105-
const selectedFeedbackCategory = useFeedbackStore(selectMessageFeedbackCategoryMemo)
107+
const selectedFeedbackCategory = useFeedbackStore(
108+
selectMessageFeedbackCategoryMemo,
109+
)
106110

107111
const resolvedTextColor = textColor ?? theme.foreground
108112
const shouldShowLoadingTimer = isAi && isLoading && !isComplete
@@ -578,6 +582,28 @@ const AgentBranchWrapper = memo(
578582
onBuildMax,
579583
}: AgentBranchWrapperProps) => {
580584
const theme = useTheme()
585+
586+
if (shouldRenderAsSimpleText(agentBlock.agentType)) {
587+
return (
588+
<box
589+
key={keyPrefix}
590+
style={{
591+
flexDirection: 'column',
592+
}}
593+
>
594+
<text
595+
style={{
596+
wrapMode: 'word',
597+
fg: theme.muted,
598+
}}
599+
attributes={TextAttributes.ITALIC}
600+
>
601+
{BULLET_CHAR} Selecting the best implementation...
602+
</text>
603+
</box>
604+
)
605+
}
606+
581607
const isCollapsed = agentBlock.isCollapsed ?? false
582608
const isStreaming =
583609
agentBlock.status === 'running' || streamingAgents.has(agentBlock.agentId)
@@ -626,11 +652,11 @@ const AgentBranchWrapper = memo(
626652
const nParameterMessage =
627653
agentBlock.params?.n !== undefined &&
628654
(agentBlock.agentType.includes('editor-best-of-n')
629-
? `Generating ${agentBlock.params.n} implementations...`
655+
? `${BULLET_CHAR} Generating ${agentBlock.params.n} implementations...`
630656
: agentBlock.agentType.includes('thinker-best-of-n')
631-
? `Generating ${agentBlock.params.n} deep thoughts...`
657+
? `${BULLET_CHAR} Generating ${agentBlock.params.n} deep thoughts...`
632658
: agentBlock.agentType.includes('code-reviewer-best-of-n')
633-
? `Generating ${agentBlock.params.n} code reviews...`
659+
? `${BULLET_CHAR} Generating ${agentBlock.params.n} code reviews...`
634660
: undefined)
635661

636662
return (

cli/src/hooks/use-send-message.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,8 +1419,12 @@ export const useSendMessage = ({
14191419
? [...msg.blocks]
14201420
: []
14211421

1422-
const newAgentBlocks: ContentBlock[] = agents.map(
1423-
(agent: any, index: number) => ({
1422+
const newAgentBlocks: ContentBlock[] = agents
1423+
.filter(
1424+
(agent: any) =>
1425+
!shouldHideAgent(agent.agent_type || ''),
1426+
)
1427+
.map((agent: any, index: number) => ({
14241428
type: 'agent',
14251429
agentId: `${toolCallId}-${index}`,
14261430
agentName: agent.agent_type || 'Agent',
@@ -1434,8 +1438,7 @@ export const useSendMessage = ({
14341438
) && {
14351439
isCollapsed: true,
14361440
}),
1437-
}),
1438-
)
1441+
}))
14391442

14401443
return {
14411444
...msg,

cli/src/utils/constants.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
// Agent IDs that should not be rendered in the CLI UI
2-
export const HIDDEN_AGENT_IDS = ['codebuff/context-pruner'] as const
2+
export const HIDDEN_AGENT_IDS = [
3+
'codebuff/context-pruner',
4+
'editor-implementor',
5+
'editor-implementor-gemini',
6+
'editor-implementor-gpt-5',
7+
] as const
38

49
/**
510
* Check if an agent ID should be hidden from rendering
@@ -25,6 +30,21 @@ export const shouldCollapseByDefault = (agentType: string): boolean => {
2530
)
2631
}
2732

33+
// Agent IDs that should render as simple text instead of full agent boxes
34+
export const SIMPLE_TEXT_AGENT_IDS = [
35+
'best-of-n-selector',
36+
'best-of-n-selector-gemini',
37+
] as const
38+
39+
/**
40+
* Check if an agent should render as simple text instead of a full agent box
41+
*/
42+
export const shouldRenderAsSimpleText = (agentType: string): boolean => {
43+
return SIMPLE_TEXT_AGENT_IDS.some((simpleTextId) =>
44+
agentType.includes(simpleTextId),
45+
)
46+
}
47+
2848
/**
2949
* The parent agent ID for all root-level agents
3050
*/

cli/src/utils/strings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ export function getSubsequenceIndices(
2121

2222
return null
2323
}
24+
25+
export const BULLET_CHAR = '• '

0 commit comments

Comments
 (0)