Class: ToolResponseDecorator

Inherits:
EventDecorator show all
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

Methods inherited from EventDecorator

for, #render

Instance Method Details

#render_basicnil

Returns tool responses are hidden in basic mode.

Returns:

  • (nil)

    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_debugHash

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`.

Returns:

  • (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`
    


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: timestamp
  }.merge(token_info)
end

#render_verboseHash

Returns structured tool response data ‘:tool_response, content: String, success: Boolean, timestamp: Integer|nil`.

Returns:

  • (Hash)

    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: timestamp
  }
end