Class: PendingMessageDecorator
- Inherits:
-
ApplicationDecorator
- Object
- Draper::Decorator
- ApplicationDecorator
- PendingMessageDecorator
- Defined in:
- app/decorators/pending_message_decorator.rb
Overview
Base decorator for PendingMessage records, providing multi-resolution rendering for the TUI (“basic” / “verbose” / “debug”) and for the enrichment subsystems Mneme and Melete.
Each PM type has a dedicated subclass that mirrors the visual treatment of its promoted-Message counterpart, with status: “pending” added so the TUI can render it dimmed.
Subclasses must override #render_basic. Default delegations form a two-step chain: render_debug → render_verbose → render_basic. A subclass that only overrides render_verbose inherits its render_debug for free. Melete and Mneme transcript modes return nil by default — subclasses opt in by overriding #render_melete or #render_mneme.
Instantiate via pending_message.decorate — PendingMessage#decorator_class picks the concrete subclass based on message_type.
Direct Known Subclasses
PendingFromMeleteDecorator, PendingFromMnemeDecorator, PendingSubagentDecorator, PendingToolResponseDecorator, PendingUserMessageDecorator
Instance Method Summary collapse
-
#render(mode) ⇒ Hash, ...
Dispatches to the render method for the given view mode.
-
#render_basic ⇒ Hash?
abstract
Structured payload, or nil to hide.
-
#render_debug ⇒ Hash?
Debug payload (defaults to verbose).
-
#render_melete ⇒ String?
Melete transcript line, or nil to skip.
-
#render_mneme ⇒ String?
Mneme transcript line, or nil to skip.
-
#render_verbose ⇒ Hash?
Verbose payload (defaults to basic).
Instance Method Details
#render(mode) ⇒ Hash, ...
Dispatches to the render method for the given view mode.
37 38 39 40 41 42 |
# File 'app/decorators/pending_message_decorator.rb', line 37 def render(mode) method = RENDER_DISPATCH[mode] raise ArgumentError, "Invalid view mode: #{mode.inspect}" unless method public_send(method) end |
#render_basic ⇒ Hash?
Subclasses must implement to render the pending message for basic view mode.
Returns structured payload, or nil to hide.
46 47 48 |
# File 'app/decorators/pending_message_decorator.rb', line 46 def render_basic raise NotImplementedError, "#{self.class} must implement #render_basic" end |
#render_debug ⇒ Hash?
Returns debug payload (defaults to verbose).
56 57 58 |
# File 'app/decorators/pending_message_decorator.rb', line 56 def render_debug render_verbose end |
#render_melete ⇒ String?
Returns Melete transcript line, or nil to skip.
61 62 63 |
# File 'app/decorators/pending_message_decorator.rb', line 61 def render_melete nil end |
#render_mneme ⇒ String?
Returns Mneme transcript line, or nil to skip.
66 67 68 |
# File 'app/decorators/pending_message_decorator.rb', line 66 def render_mneme nil end |
#render_verbose ⇒ Hash?
Returns verbose payload (defaults to basic).
51 52 53 |
# File 'app/decorators/pending_message_decorator.rb', line 51 def render_verbose render_basic end |