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.
Constant Summary
Constants inherited from EventDecorator
EventDecorator::ERROR_ICON, EventDecorator::RETURN_ARROW, EventDecorator::TOOL_ICON
Instance Method Summary collapse
-
#render_basic ⇒ nil
Tool responses are hidden in basic mode.
-
#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
Structured tool response data ‘:tool_response, content: String, success: Boolean, timestamp: Integer|nil`.
Methods inherited from EventDecorator
Instance Method Details
#render_basic ⇒ nil
Returns tool responses are hidden in basic mode.
10 11 12 |
# File 'app/decorators/tool_response_decorator.rb', line 10 def render_basic nil 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`.
28 29 30 31 32 33 34 35 36 |
# File 'app/decorators/tool_response_decorator.rb', line 28 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
Returns structured tool response data ‘:tool_response, content: String, success: Boolean, timestamp: Integer|nil`.
16 17 18 19 20 21 22 23 |
# File 'app/decorators/tool_response_decorator.rb', line 16 def render_verbose { role: :tool_response, content: truncate_lines(content, max_lines: 3), success: payload["success"] != false, timestamp: } end |