feat: liveness RPCs (agent.wait, sessions.describe, session message subscription)#32
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds three thin gateway-RPC wrappers that Pinchy needs for an authoritative chat-liveness redesign (replacing client-side silence-guessing with gateway truth).
What
agentWait(runId, { timeoutMs? })— wrapsagent.wait, the gateway's authoritative run-liveness oracle. ReturnsAgentWaitResult(status,livenessState,endedAt,stopReason, …).sessions.describe(key, { agentId? })— wrapssessions.describe. ReturnsSessionDescribeResult(existence + state + active run).sessions.subscribeMessages(key, handler, { agentId? })— subscribes viasessions.messages.subscribeand forwards every event for the session (word-for-word assistant deltasevent:"agent", transcript snapshotsevent:"session.message", tool + lifecycle events) tohandler, returning{ unsubscribe }.Notes
sessions.*/request()wrapper patterns. Thin pass-through types (gateway owns the shape, documented as best-effort).unsubscribe()that never throws on teardown. The subscription does not survive a reconnect — re-subscribe onconnected(documented).Tests
155 passing (19 new across the three wrappers), build + lint + typecheck green. Tests assert real wire frames + behavior via the
mock-wsharness (incl. canonical-key delivery, concurrent-subscription isolation, subscribe-rejection cleanup, safe teardown).