Class: AgentMessageDecorator
- Inherits:
-
MessageDecorator
- Object
- Draper::Decorator
- ApplicationDecorator
- MessageDecorator
- AgentMessageDecorator
- Defined in:
- app/decorators/agent_message_decorator.rb
Overview
Decorates agent_message records 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 MessageDecorator
MessageDecorator::ERROR_ICON, MessageDecorator::MIDDLE_TRUNCATION_MARKER, MessageDecorator::RETURN_ARROW, MessageDecorator::TOOL_ICON
Instance Method Summary collapse
-
#render_basic ⇒ Hash
Structured agent message data ‘:assistant, content: String`.
-
#render_brain ⇒ String
Agent message for the analytical brain, middle-truncated if very long (preserves opening context and final conclusion).
-
#render_debug ⇒ Hash
Verbose output plus token count for debugging ‘:assistant, content: String, timestamp: Integer|nil, tokens: Integer, estimated: Boolean`.
-
#render_verbose ⇒ Hash
Structured agent message with nanosecond timestamp ‘:assistant, content: String, timestamp: Integer|nil`.
Methods inherited from MessageDecorator
Instance Method Details
#render_basic ⇒ Hash
Returns 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_brain ⇒ String
Returns agent message for the analytical brain, middle-truncated if very long (preserves opening context and final conclusion).
27 28 29 |
# File 'app/decorators/agent_message_decorator.rb', line 27 def render_brain "Assistant: #{truncate_middle(content)}" end |
#render_debug ⇒ Hash
Returns 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_verbose ⇒ Hash
Returns 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: } end |