Class: Opencode::StreamBlockObserver
- Inherits:
-
Object
- Object
- Opencode::StreamBlockObserver
- Includes:
- ReplyObserver
- Defined in:
- lib/opencode/client.rb
Overview
Internal Reply observer that bridges Reply’s multi-callback protocol to a single user-supplied block for Client#stream. Each part-level callback (part_added, part_changed, part_finalized, tool_progressed) forwards the current part to the user’s block.
Non-part-level callbacks (step_finished, session_*, message_updated, todos_changed, question_*, permission_*) are intentionally NOT forwarded — they’re either telemetry the gem owns internally, or interactive-protocol concerns that callers route through #stream_events directly when they need them.
Instance Method Summary collapse
-
#initialize(&block) ⇒ StreamBlockObserver
constructor
A new instance of StreamBlockObserver.
- #part_added(part:) ⇒ Object
- #part_changed(part:) ⇒ Object
- #part_finalized(part:) ⇒ Object
- #tool_progressed(part:) ⇒ Object
Methods included from ReplyObserver
#message_updated, #permission_asked, #permission_replied, #question_asked, #question_rejected, #question_replied, #session_errored, #session_retried, #step_finished, #todos_changed
Constructor Details
#initialize(&block) ⇒ StreamBlockObserver
Returns a new instance of StreamBlockObserver.
544 545 546 |
# File 'lib/opencode/client.rb', line 544 def initialize(&block) @block = block end |
Instance Method Details
#part_added(part:) ⇒ Object
548 549 550 |
# File 'lib/opencode/client.rb', line 548 def part_added(part:, **) @block.call(part) end |
#part_changed(part:) ⇒ Object
552 553 554 |
# File 'lib/opencode/client.rb', line 552 def part_changed(part:, **) @block.call(part) end |
#part_finalized(part:) ⇒ Object
556 557 558 |
# File 'lib/opencode/client.rb', line 556 def part_finalized(part:, **) @block.call(part) end |
#tool_progressed(part:) ⇒ Object
560 561 562 |
# File 'lib/opencode/client.rb', line 560 def tool_progressed(part:, **) @block.call(part) end |