Class: Parse::Agent::PendingElicitationRegistry
- Inherits:
-
Object
- Object
- Parse::Agent::PendingElicitationRegistry
- Defined in:
- lib/parse/agent/approval_gate.rb
Overview
Registry of server→client elicitation requests awaiting a client reply. Each pending request owns a Queue the answering POST pushes onto, waking the blocked tool thread. Structurally modeled on the transport's CancellationRegistry: a Mutex-guarded map keyed by the composite [correlation_id, elicitation_id], with session-bound delivery so one session can never answer another's prompt.
Instance Method Summary collapse
-
#abort_all_for(correlation_id, _reason = nil) ⇒ Object
Wake every pending request for a session with an ABORT sentinel.
-
#deliver(correlation_id, elicitation_id, value) ⇒ Object
Deliver a client reply.
-
#deregister(correlation_id, elicitation_id) ⇒ Object
Idempotent removal — called by the waiter on wake/timeout so a late reply finds nothing.
-
#initialize ⇒ PendingElicitationRegistry
constructor
A new instance of PendingElicitationRegistry.
-
#register(correlation_id, elicitation_id) ⇒ Object
Register a pending request and return its Queue.
-
#size ⇒ Integer
Number of outstanding requests (tests/telemetry).
Constructor Details
#initialize ⇒ PendingElicitationRegistry
Returns a new instance of PendingElicitationRegistry.
117 118 119 120 |
# File 'lib/parse/agent/approval_gate.rb', line 117 def initialize @entries = {} @mutex = Mutex.new end |
Instance Method Details
#abort_all_for(correlation_id, _reason = nil) ⇒ Object
Wake every pending request for a session with an ABORT sentinel. Called on session DELETE teardown / listening-stream close.
153 154 155 156 157 158 159 160 161 162 |
# File 'lib/parse/agent/approval_gate.rb', line 153 def abort_all_for(correlation_id, _reason = nil) prefix = "#{correlation_id} |