From 383cb7d795f0061e6ca914150902950998510f2d Mon Sep 17 00:00:00 2001 From: Michael Bleigh Date: Sat, 11 Apr 2026 19:01:57 -0700 Subject: [PATCH] wip: HistoryItemToolGroupDisplay --- .../src/ui/components/HistoryItemDisplay.tsx | 1 + .../components/messages/ToolGroupMessage.tsx | 1 + packages/cli/src/ui/types.ts | 6 +++ packages/core/src/agent/types.ts | 38 ++++++++++++++++++- 4 files changed, 45 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/ui/components/HistoryItemDisplay.tsx b/packages/cli/src/ui/components/HistoryItemDisplay.tsx index 0ceb70f8d7..414b6dcbe4 100644 --- a/packages/cli/src/ui/components/HistoryItemDisplay.tsx +++ b/packages/cli/src/ui/components/HistoryItemDisplay.tsx @@ -208,6 +208,7 @@ export const HistoryItemDisplay: React.FC = ({ isToolGroupBoundary={isToolGroupBoundary} /> )} + {/* TODO: tool_group_display goes here */} {itemForDisplay.type === 'subagent' && ( = ({ isToolGroupBoundary, }) => { const settings = useSettings(); + const isLowErrorVerbosity = settings.merged.ui?.errorVerbosity !== 'full'; const isCompactModeEnabled = settings.merged.ui?.compactToolOutput === true; diff --git a/packages/cli/src/ui/types.ts b/packages/cli/src/ui/types.ts index 1ded2ae643..590b4e4ea8 100644 --- a/packages/cli/src/ui/types.ts +++ b/packages/cli/src/ui/types.ts @@ -260,6 +260,11 @@ export type HistoryItemToolGroup = HistoryItemBase & { borderDimColor?: boolean; }; +export type HistoryItemToolDisplayGroup = HistoryItemBase & { + type: 'tool_display_group'; + tools: ToolDisplay[]; +}; + export type HistoryItemUserShell = HistoryItemBase & { type: 'user_shell'; text: string; @@ -393,6 +398,7 @@ export type HistoryItemWithoutId = | HistoryItemAbout | HistoryItemHelp | HistoryItemToolGroup + | HistoryItemToolDisplayGroup | HistoryItemStats | HistoryItemModelStats | HistoryItemToolStats diff --git a/packages/core/src/agent/types.ts b/packages/core/src/agent/types.ts index 0f7cad8a9b..d383c18c68 100644 --- a/packages/core/src/agent/types.ts +++ b/packages/core/src/agent/types.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import type { AnsiOutput } from 'src/utils/terminalSerializer.js'; import type { Kind } from '../tools/tools.js'; export type WithMeta = { _meta?: Record }; @@ -182,13 +183,48 @@ export type DisplayDiff = { beforeText: string; afterText: string; }; -export type DisplayContent = DisplayText | DisplayDiff; +export type DisplayTerminal = { + type: 'terminal'; + pid?: string; + exitCode?: number; + ansi?: AnsiOutput; +}; +export type DisplayAgent = { + type: 'agent'; + threadId: string; +}; + +export type DisplayContent = + | DisplayText + | DisplayDiff + | DisplayTerminal + | DisplayAgent; + +export type ToolDisplayFormat = + /** + * Displays as compact when user has enabled compact tools, box otherwise. + * This is the default format if none is selected. + **/ + | 'auto' + /** Always display this tool in compact format. */ + | 'compact' + /** Always display this tool in full box format. */ + | 'box' + /** Hide this tool from the event history. */ + | 'hidden' + /** Display this tool as a message-like notice. */ + | 'notice'; export interface ToolDisplay { + /** A display name for the tool. */ name?: string; + /** A short description of what the tool is doing. */ description?: string; + /** A short, one-line summary of the tool's results. */ resultSummary?: string | null; result?: DisplayContent | null; + /** A tool may specify its preferred display format. */ + format?: ToolDisplayFormat; } export interface ToolRequest {