Class: AgentMessageDecorator

Inherits:
EventDecorator show all
Defined in:
app/decorators/agent_message_decorator.rb

Overview

Decorates agent_message events for display in the TUI. Basic mode returns role and content. Verbose mode adds a timestamp. Debug mode adds token count (exact when counted, estimated when not).

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_basicHash

Returns structured agent message data ‘:assistant, content: String`.

Returns:

  • (Hash)

    structured agent message data ‘:assistant, content: String`



9
10
11
# File 'app/decorators/agent_message_decorator.rb', line 9

def render_basic
  {role: :assistant, content: content}
end

#render_debugHash

Returns verbose output plus token count for debugging ‘:assistant, content: String, timestamp: Integer|nil, tokens: Integer, estimated: Boolean`.

Returns:

  • (Hash)

    verbose output plus token count for debugging ‘:assistant, content: String, timestamp: Integer|nil, tokens: Integer, estimated: Boolean`



21
22
23
# File 'app/decorators/agent_message_decorator.rb', line 21

def render_debug
  render_verbose.merge(token_info)
end

#render_verboseHash

Returns structured agent message with nanosecond timestamp ‘:assistant, content: String, timestamp: Integer|nil`.

Returns:

  • (Hash)

    structured agent message with nanosecond timestamp ‘:assistant, content: String, timestamp: Integer|nil`



15
16
17
# File 'app/decorators/agent_message_decorator.rb', line 15

def render_verbose
  {role: :assistant, content: content, timestamp: timestamp}
end