Class: ToolResponseDecorator
- Inherits:
-
EventDecorator
- Object
- Draper::Decorator
- ApplicationDecorator
- EventDecorator
- ToolResponseDecorator
- Defined in:
- app/decorators/tool_response_decorator.rb
Overview
Decorates tool_response events for display in the TUI. Hidden in basic mode — tool activity is represented by the aggregated tool counter instead. Verbose mode returns truncated output with a success/failure indicator. Debug mode shows full untruncated output with tool_use_id and estimated token count.
Think tool responses (“OK”) are hidden in basic and verbose modes because the value is in the tool_call (the thoughts), not the response.
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 ⇒ nil
Tool responses are hidden in basic mode.
-
#render_brain ⇒ String?
Think responses (“OK”) are noise — excluded from the brain’s transcript.
-
#render_debug ⇒ Hash
Full tool response data with untruncated content, tool_use_id, and token estimate ‘:tool_response, content: String, success: Boolean, tool_use_id: String|nil, timestamp: Integer|nil, tokens: Integer, estimated: Boolean`.
-
#render_verbose ⇒ Hash?
Think responses are hidden in verbose mode — the “OK” adds no information.
Methods inherited from EventDecorator
Instance Method Details
#render_basic ⇒ nil
Returns tool responses are hidden in basic mode.
15 16 17 |
# File 'app/decorators/tool_response_decorator.rb', line 15 def render_basic nil end |
#render_brain ⇒ String?
Think responses (“OK”) are noise — excluded from the brain’s transcript. Other tool responses are compressed to success/failure indicators only.
48 49 50 51 52 |
# File 'app/decorators/tool_response_decorator.rb', line 48 def render_brain return if think? (payload["success"] != false) ? "\u2705" : "\u274C" end |
#render_debug ⇒ Hash
Returns full tool response data with untruncated content, tool_use_id, and token estimate ‘:tool_response, content: String, success: Boolean, tool_use_id: String|nil,
timestamp: Integer|nil, tokens: Integer, estimated: Boolean`.
35 36 37 38 39 40 41 42 43 |
# File 'app/decorators/tool_response_decorator.rb', line 35 def render_debug { role: :tool_response, content: content, success: payload["success"] != false, tool_use_id: payload["tool_use_id"], timestamp: }.merge(token_info) end |
#render_verbose ⇒ Hash?
Think responses are hidden in verbose mode — the “OK” adds no information.
21 22 23 24 25 26 27 28 29 30 |
# File 'app/decorators/tool_response_decorator.rb', line 21 def render_verbose return if think? { role: :tool_response, content: truncate_lines(content, max_lines: 3), success: payload["success"] != false, timestamp: } end |