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 as pretty-printed JSON with tool_use_id.
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).
19 20 21 22 23 24 |
# File 'app/decorators/tool_call_decorator.rb', line 19 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).
51 52 53 54 55 56 57 |
# File 'app/decorators/tool_call_decorator.rb', line 51 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`.
36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/decorators/tool_call_decorator.rb', line 36 def render_debug return render_think_debug if think? { role: :tool_call, tool: payload["tool_name"], input: JSON.pretty_generate(payload["tool_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`.
28 29 30 31 32 |
# File 'app/decorators/tool_call_decorator.rb', line 28 def render_verbose return render_think_verbose if think? {role: :tool_call, tool: payload["tool_name"], input: format_input, timestamp: } end |