Skip to content

feat: liveness RPCs (agent.wait, sessions.describe, session message subscription)#32

Merged
clemenshelm merged 7 commits into
mainfrom
feat/liveness-rpcs
Jun 16, 2026
Merged

feat: liveness RPCs (agent.wait, sessions.describe, session message subscription)#32
clemenshelm merged 7 commits into
mainfrom
feat/liveness-rpcs

Conversation

@clemenshelm

Copy link
Copy Markdown
Contributor

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? }) — wraps agent.wait, the gateway's authoritative run-liveness oracle. Returns AgentWaitResult (status, livenessState, endedAt, stopReason, …).
  • sessions.describe(key, { agentId? }) — wraps sessions.describe. Returns SessionDescribeResult (existence + state + active run).
  • sessions.subscribeMessages(key, handler, { agentId? }) — subscribes via sessions.messages.subscribe and forwards every event for the session (word-for-word assistant deltas event:"agent", transcript snapshots event:"session.message", tool + lifecycle events) to handler, returning { unsubscribe }.

Notes

  • All three mirror the existing sessions.* / request() wrapper patterns. Thin pass-through types (gateway owns the shape, documented as best-effort).
  • The subscription filters on both the caller key and the canonical key the gateway echoes (so canonicalization can't silently drop events), registers its listener before the subscribe request (no missed events in the subscribe window), and has a best-effort unsubscribe() that never throws on teardown. The subscription does not survive a reconnect — re-subscribe on connected (documented).
  • Version bumped to 0.13.0 (additive, no breaking changes).

Tests

155 passing (19 new across the three wrappers), build + lint + typecheck green. Tests assert real wire frames + behavior via the mock-ws harness (incl. canonical-key delivery, concurrent-subscription isolation, subscribe-rejection cleanup, safe teardown).

@clemenshelm clemenshelm merged commit 8db42a8 into main Jun 16, 2026
4 checks passed
@clemenshelm clemenshelm deleted the feat/liveness-rpcs branch June 16, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant