Documentation
¶
Index ¶
- type HintProvider
- type ResultBodyProvider
- type ToolFormatterService
- func (s *ToolFormatterService) FormatToolCall(toolName string, args map[string]any) string
- func (s *ToolFormatterService) FormatToolResultExpanded(result *agentdomain.ToolExecutionResult, terminalWidth int) string
- func (s *ToolFormatterService) FormatToolResultForLLM(result *agentdomain.ToolExecutionResult) string
- func (s *ToolFormatterService) FormatToolResultForUI(result *agentdomain.ToolExecutionResult, terminalWidth int) string
- func (s *ToolFormatterService) RenderToolSummary(icon, toolName string, args map[string]any, trailing string, terminalWidth int) string
- func (s *ToolFormatterService) SetHintFormatter(h HintProvider)
- func (s *ToolFormatterService) SetMaxResultBytes(n int)
- func (s *ToolFormatterService) ShouldAlwaysExpandTool(toolName string) bool
- type ToolRegistry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HintProvider ¶
HintProvider resolves keybinding hints for tool result affordances. It is satisfied by *hints.Formatter.
type ResultBodyProvider ¶
type ResultBodyProvider interface {
FormatResultBody(result *agentdomain.ToolExecutionResult) string
}
ResultBodyProvider is an optional interface a tool may implement to expose its primary output (command stdout, file content, …) for the collapsed preview and the full-on-failure view. It is distinct from FormatPreview (a one-line summary) and FormatForLLM (the full tree) and lives in the services package so adding it does not touch the agentdomain.Tool interface or its generated mocks.
type ToolFormatterService ¶
type ToolFormatterService struct {
// contains filtered or unexported fields
}
ToolFormatterService provides formatting for tool results by delegating to individual tools
func NewToolFormatterService ¶
func NewToolFormatterService(registry ToolRegistry, styleProvider *styles.Provider) *ToolFormatterService
NewToolFormatterService creates a new tool formatter service
func (*ToolFormatterService) FormatToolCall ¶
func (s *ToolFormatterService) FormatToolCall(toolName string, args map[string]any) string
FormatToolCall formats a tool call for consistent display
func (*ToolFormatterService) FormatToolResultExpanded ¶
func (s *ToolFormatterService) FormatToolResultExpanded(result *agentdomain.ToolExecutionResult, terminalWidth int) string
FormatToolResultExpanded formats the expanded (ctrl+o) tool result: the tool's existing detail tree, themed for consistency with the rest of the UI (accent+bold tool-call line, dim connectors, accent field labels), with a dim collapse hint. The underlying tree text is unchanged, so tool-specific bodies (diffs, raw output) are preserved exactly.
func (*ToolFormatterService) FormatToolResultForLLM ¶
func (s *ToolFormatterService) FormatToolResultForLLM(result *agentdomain.ToolExecutionResult) string
FormatToolResultForLLM formats tool execution results for LLM consumption
func (*ToolFormatterService) FormatToolResultForUI ¶
func (s *ToolFormatterService) FormatToolResultForUI(result *agentdomain.ToolExecutionResult, terminalWidth int) string
FormatToolResultForUI formats the collapsed (default) tool result: a themed status line followed by an indented dim output preview (first 5 lines on success, the full output on failure) and a "+N lines · ctrl+o to expand" footer.
func (*ToolFormatterService) RenderToolSummary ¶
func (s *ToolFormatterService) RenderToolSummary(icon, toolName string, args map[string]any, trailing string, terminalWidth int) string
RenderToolSummary renders the shared "<icon> Name(args) <trailing>" line used by the collapsed status line, the live preview, the approval summary and the queue preview. icon and trailing are already-styled by the caller (each surface owns its own status semantics); the tool name and the width-aware, path-shortened argument preview are formatted identically everywhere, replacing the per-call-site drift (e.g. the old byte-slice `args[:47]` truncation in the live renderer). Pass icon=="" / trailing=="" to omit either segment.
func (*ToolFormatterService) SetHintFormatter ¶
func (s *ToolFormatterService) SetHintFormatter(h HintProvider)
SetHintFormatter wires the keybinding hint resolver so the collapsed and expanded views can show the "ctrl+o to expand/collapse" affordance. Nil is safe - the hint is simply omitted.
func (*ToolFormatterService) SetMaxResultBytes ¶
func (s *ToolFormatterService) SetMaxResultBytes(n int)
SetMaxResultBytes caps the size of a single tool result fed back to the LLM (FormatToolResultForLLM). 0 disables the cap. Wired from tools.max_result_bytes in the container so one oversized tool output can't dominate the context window.
func (*ToolFormatterService) ShouldAlwaysExpandTool ¶
func (s *ToolFormatterService) ShouldAlwaysExpandTool(toolName string) bool
ShouldAlwaysExpandTool checks if a tool result should always be expanded
type ToolRegistry ¶
type ToolRegistry interface {
GetTool(name string) (agentdomain.Tool, error)
ListAvailableTools() []string
}
ToolRegistry interface for accessing tools (implemented by tools.Registry)