Class: ToolCallDecorator
- Inherits:
-
EventDecorator
- Object
- Draper::Decorator
- ApplicationDecorator
- EventDecorator
- ToolCallDecorator
- Defined in:
- app/decorators/tool_call_decorator.rb
Overview
Decorates tool_call events for display in the TUI. Hidden in basic mode — tool activity is represented by the aggregated tool counter instead. Verbose mode returns tool name and a formatted preview of the input arguments. Debug mode shows full untruncated input with tool_use_id — TOON format for most tools, but write tool content preserves actual newlines.
Think tool calls are special: “aloud” thoughts are shown in all view modes (with a thought bubble), while “inner” thoughts are visible only in verbose and debug modes.
Constant Summary collapse
- THINK_TOOL =
"think"
Constants inherited from EventDecorator
EventDecorator::ERROR_ICON, EventDecorator::MIDDLE_TRUNCATION_MARKER, EventDecorator::RETURN_ARROW, EventDecorator::TOOL_ICON
Instance Method Summary collapse
-
#render_basic ⇒ Hash?
In basic mode, only “aloud” think calls are visible.
-
#render_brain ⇒ String
Think calls get full text — the agent’s reasoning IS the signal.
-
#render_debug ⇒ Hash
Full tool call data with untruncated input and tool_use_id ‘:tool_call, tool: String, input: String, tool_use_id: String|nil, timestamp: Integer|nil`.
-
#render_verbose ⇒ Hash
Structured tool call data ‘:tool_call, tool: String, input: String, timestamp: Integer|nil`.
Methods inherited from EventDecorator
Instance Method Details
#render_basic ⇒ Hash?
In basic mode, only “aloud” think calls are visible. All other tool calls are hidden (represented by the tool counter).
22 23 24 25 26 27 |
# File 'app/decorators/tool_call_decorator.rb', line 22 def render_basic return unless think? return unless aloud? {role: :think, content: thoughts, visibility: "aloud"} end |
#render_brain ⇒ String
Think calls get full text — the agent’s reasoning IS the signal. Other tool calls show tool name + params (compact JSON).
54 55 56 57 58 59 60 |
# File 'app/decorators/tool_call_decorator.rb', line 54 def render_brain if think? "Think: #{thoughts}" else "Tool call: #{payload["tool_name"]}(#{tool_input.to_json})" end end |
#render_debug ⇒ Hash
Returns full tool call data with untruncated input and tool_use_id ‘:tool_call, tool: String, input: String, tool_use_id: String|nil, timestamp: Integer|nil`.
39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/decorators/tool_call_decorator.rb', line 39 def render_debug return render_think_debug if think? { role: :tool_call, tool: payload["tool_name"], input: format_debug_input, tool_use_id: payload["tool_use_id"], timestamp: } end |
#render_verbose ⇒ Hash
Returns structured tool call data ‘:tool_call, tool: String, input: String, timestamp: Integer|nil`.
31 32 33 34 35 |
# File 'app/decorators/tool_call_decorator.rb', line 31 def render_verbose return render_think_verbose if think? {role: :tool_call, tool: payload["tool_name"], input: format_input, timestamp: } end |