feat: implement ADR-007 subscription transport — PendingRequestMap.subscribe(), CallHandler dispatch, SSE AsyncGenerator handlers

Add remote subscription support so spokes can consume streaming operations
over pubsub transports (WebSocket, Redis). Extract checkAccess to access.ts
to break circular dep between call.ts and subscribe.ts.
This commit is contained in:
2026-05-16 06:03:21 +00:00
parent 5ec6c380a7
commit 92936f4232
14 changed files with 907 additions and 106 deletions

View File

@@ -1,6 +1,6 @@
---
status: draft
last_updated: 2026-05-11
status: stable
last_updated: 2026-05-16
---
# Adapters

View File

@@ -1,6 +1,6 @@
---
status: draft
last_updated: 2026-05-11
status: stable
last_updated: 2026-05-16
---
# API Surface

View File

@@ -1,6 +1,6 @@
---
status: draft
last_updated: 2026-05-11
status: stable
last_updated: 2026-05-16
---
# Call Protocol

View File

@@ -1,6 +1,6 @@
---
status: draft
last_updated: 2026-05-13
status: accepted
last_updated: 2026-05-16
---
# ADR-007: Subscription Transport for SSE and Remote Streaming

View File

@@ -1,6 +1,6 @@
---
status: draft
last_updated: 2026-05-11
status: stable
last_updated: 2026-05-16
---
# Response Envelopes
@@ -514,9 +514,9 @@ The following **code** changes are pending:
| Code | Change | Status |
|------|--------|--------|
| `src/from_openapi.ts` | Generate `SubscriptionHandler` (AsyncGenerator) for SUBSCRIPTION operations, parse SSE stream, yield per-event | ❌ Not started |
| `src/call.ts` | Add `PendingRequestMap.subscribe()` method using Repeater from `@alkdev/pubsub` | ❌ Not started |
| `src/call.ts` | Update `CallHandler` to dispatch on operation type | ❌ Not started |
| `src/from_openapi.ts` | Generate `SubscriptionHandler` (AsyncGenerator) for SUBSCRIPTION operations, parse SSE stream, yield per-event | ✅ Implemented |
| `src/call.ts` | Add `PendingRequestMap.subscribe()` method using Repeater from `@alkdev/pubsub` | ✅ Implemented |
| `src/call.ts` | Update `CallHandler` to dispatch on operation type | ✅ Implemented |
| `src/subscribe.ts` | Ensure `subscribe()` handles `httpEnvelope` detection for SSE yields | ✅ Already handles envelopes |
## References