Objective: Provide tools direct control over their visual representation by adding support for "display" properties within the new AgentProtocol / useAgentSession interfaces. Do this without altering existing behavior for useGeminiStream since useAgentSession is experimental and still in active development.
At a high level, we will first refactor the tool execution interface to better support tool-controlled display, then add primitives for tool controlled display to the events in AgentProtocol, then wire up the UI to consume the new tool-controlled display if provided, then finally migrate tools to use the new tool-controlled display ONLY when useAgentSession is enabled.
Implementation Plan
To ensure visual parity with the legacy UI while standardizing the Agent Protocol, we will follow an incremental, commit-per-step approach. Each step MUST be a separate commit with all tests passing.
1. Atomic Signature Refactor: ExecuteOptions
2. Unified Display Data Model
3. Centralized Display Utility Logic
4. Simplified UI Consumption (Dumb Terminal)
5. Incremental Tool Migration
Acceptance Criteria
Objective: Provide tools direct control over their visual representation by adding support for "display" properties within the new AgentProtocol / useAgentSession interfaces. Do this without altering existing behavior for useGeminiStream since useAgentSession is experimental and still in active development.
At a high level, we will first refactor the tool execution interface to better support tool-controlled display, then add primitives for tool controlled display to the events in AgentProtocol, then wire up the UI to consume the new tool-controlled display if provided, then finally migrate tools to use the new tool-controlled display ONLY when useAgentSession is enabled.
Implementation Plan
To ensure visual parity with the legacy UI while standardizing the Agent Protocol, we will follow an incremental, commit-per-step approach. Each step MUST be a separate commit with all tests passing.
1. Atomic Signature Refactor:
ExecuteOptionsExecuteOptionsinpackages/core/src/tools/tools.tsand refactorToolInvocation.execute()to accept this object instead of positional arguments.refactor(core): use ExecuteOptions for tool execution2. Unified Display Data Model
ToolDisplayinterface inpackages/core/src/agent/types.ts:ToolRequest,ToolUpdate, andToolResponseevents to include a nesteddisplay?: ToolDisplayproperty.feat(agent): define unified ToolDisplay protocol property3. Centralized Display Utility Logic
packages/core/src/agent/tool-display-utils.tsto manage the population of thedisplayproperty.event-translator.tsandlegacy-agent-session.tsto use these utilities for populating metadata from tool requests and results.invocation.getDescription()as the default fallback fordisplay.description.feat(core): centralize tool display population logic4. Simplified UI Consumption (Dumb Terminal)
IndividualToolCallDisplayinpackages/cli/src/ui/types.tsto includedisplay?: ToolDisplay.useAgentStream.tsto directly mergeevent.displayinto the state.ToolMessage,ShellToolMessage, andDenseToolMessageto render based on thedisplayobject fields:display.name(Bold name)display.description(Gray text, no arrow)display.resultSummary(Purple text, with →)refactor(cli): consume simplified ToolDisplay property5. Incremental Tool Migration
ReadFile/WriteFile(Identity/Description focus)Shell(Execution state focus)LS/Grep(ResultSummary/Stats focus)feat(tools): migrate [ToolName] to structured visual metadataAcceptance Criteria
useGeminiStream(legacy) rendering remains 100% identical.useAgentStreamrendering matches legacy visual styling exactly (gray filenames, purple arrows for counts).