Class: PendingToolResponseDecorator

Inherits:
PendingMessageDecorator show all
Defined in:
app/decorators/pending_tool_response_decorator.rb

Overview

Decorates a tool_response PendingMessage — a tool result waiting in the mailbox before the drain pairs it with its tool_call and feeds the next LLM turn. Mirrors ToolResponseDecorator: hidden in basic (aggregated by the tool counter), structured tool output in verbose, full untruncated content in debug — all dimmed via status: “pending”.

Instance Method Summary collapse

Methods inherited from PendingMessageDecorator

#render

Instance Method Details

#render_basicnil

Returns tool responses are hidden in basic mode.

Returns:

  • (nil)

    tool responses are hidden in basic mode



11
12
13
# File 'app/decorators/pending_tool_response_decorator.rb', line 11

def render_basic
  nil
end

#render_debugHash

Returns full tool response payload tagged as pending.

Returns:

  • (Hash)

    full tool response payload tagged as pending



31
32
33
34
35
36
37
38
39
40
# File 'app/decorators/pending_tool_response_decorator.rb', line 31

def render_debug
  {
    role: :tool_response,
    tool: source_name,
    content: content,
    success: success != false,
    tool_use_id: tool_use_id,
    status: "pending"
  }
end

#render_meleteString

Returns Melete transcript line.

Returns:

  • (String)

    Melete transcript line



43
44
45
# File 'app/decorators/pending_tool_response_decorator.rb', line 43

def render_melete
  "tool_response #{tool_use_id} (pending): #{truncate_middle(content)}"
end

#render_mnemeString

Returns Mneme transcript line.

Returns:

  • (String)

    Mneme transcript line



48
49
50
# File 'app/decorators/pending_tool_response_decorator.rb', line 48

def render_mneme
  "tool_response #{tool_use_id} (pending): #{truncate_middle(content)}"
end

#render_verboseHash

Returns truncated tool response payload tagged as pending.

Returns:

  • (Hash)

    truncated tool response payload tagged as pending



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/decorators/pending_tool_response_decorator.rb', line 16

def render_verbose
  {
    role: :tool_response,
    tool: source_name,
    content: truncate_lines(content, max_lines: 3),
    # nil treated as success; only an explicit false flips the indicator
    # — mirrors {ToolResponseDecorator}'s convention so legacy PMs
    # without an explicit success column don't render as failures.
    success: success != false,
    tool_use_id: tool_use_id,
    status: "pending"
  }
end