* ✨ feat(session): persist and synchronize read state * 🌐 fix(client): complete Japanese labels after base update * 📝 docs: refresh session read-state dependency graph * 🧪 test(web): align session menu and read-state snapshots * 🌐 fix(session): complete Japanese plugin metadata * 🧪 test(web): distinguish unread from pending user input * 🐛 修复会话阅读状态的故障隔离与生命周期 * 🐛 修复阅读状态依赖检查并补齐自动已读覆盖 * 🐛 恢复会话绿点并移除未读标题加粗 * ♻️ Keep shared session reading state in Host memory * 🌐 Complete reading-state metadata for supported locales * 📝 Refresh module graph after removing storage dependency * 🧹 Move storage dependency policy out of memory-only reading * 🐛 Wait for sidebar catalog before replay navigation * 🔧 Give Host TypeScript checks 8 GiB of heap * ✅ Align Host heap checks and Windows diagnostics * ♻️ Keep CI repairs outside the session reading PR * 🐛 Show failed unread turns with an error indicator * 🔧 Adjust npm layout budget for the reading package * 🧪 Scope projection stream assertions to observed units * 🧪 Scope permission and title assertions to their projections * ♻️ Simplify session reading updates to explicit positions * 🐛 Align session reading package with release version * 🧪 Load reading state in LiveShare viewer fixtures * 🧹 Remove persistence-only type link from memory PR * 🧪 Align context menu expectations with reading actions * 🐛 Sync reading package with the release version * 🧪 Include turn boundaries in session summary expectations * ♻️ Derive reading failure facts from Host events instead of a projection The reading service took each completion from the Agent turn-boundary projection, which forced a stateVersion bump and put that projection's whole internal state on the wire for every Session list row. The service now records `turn/end` itself, so `core/agent` and the persisted projection schema are untouched. History that ended before the service started raises no reminder, which keeps "existing history reads as read" without a startup scan. The failure flag therefore describes only turns this Host observed: marking a Session whose last turn failed before a restart shows the ordinary unread reminder. * 🐛 Preserve manual unread until explicit Session interaction * 🧪 Align cold Session reading snapshot with unloaded title * 🔖 chore(session): align session-read-state with 0.2.2-rc.2 Master moved the root and every released manifest to 0.2.2-rc.2, but the new dsh-session-read-state package still declared 0.2.2-rc.1, failing constraints, verify-version-sync, verify-npm-install-layout, and release:verify after the master merge. * ♻️ refactor(gateway): recognize Remote stream carrier loss by error code RemoteStream now decides whether a generation end or failure is a retryable carrier loss by the stable code 'gateway/carrier-lost' instead of `instanceof RemoteStreamCarrierError`. RemoteStreamCarrierError keeps working and carries that code, so existing callers are unchanged, while a Client feature package can return a coded Error from `ended` without importing the class. The new RemoteStreamCarrierFailure type describes such errors; terminal-controller classifies disconnects the same way. * ♻️ refactor(session): move Session reading into ui-session-status Fold the reading feature into the single package packages/client/ui-session-status and delete session-read-state. - Host face: SessionStatusService keeps in-memory reading records and serves the sessionStatus Remote namespace (mark, follow) with session-status/* error codes; its service key is registered only for Gateway discovery and is not declared on Context. - Client face: a package-internal reading model follows the Host stream through RemoteSnapshotStream; ctx.uiSession.sessionStatus folds the records into completionUnread and completionFailed and exposes mark and readingReady; main-view acknowledgement and the session-status/read-intent event live here. No reading service or type is exported. - verify-client-packages lets a packages/client feature package request packages/api rows through dsh.client.external; feature-to-feature requests stay rejected. - ui-workspace, ui-conversation, bundles, remotes, LiveShare, the client test runtime, docs, Agent Notes, and the upgrade guide follow. * ♻️ refactor(session): clear manual unread only when the main view switches to the Session Remove the session-status/read-intent event. ui-session-status now clears an existing manual unread mark when the main view switches to a different Session, including the first selection after a page load, once the reading baseline is ready and the body arrives. Window focus, visibility changes, a replaced binding for the same Session, and activity in the open Session preserve manual unread. ui-conversation returns to master (only the ui-session-status client tsconfig reference remains), and ui-workspace navigation no longer emits the event. Tests, the session-reading Web e2e case, READMEs, and the reading Agent Note follow the new rule. * 🐛 fix(session): address the Session status review findings - Open the reading stream only while ctx.remoteAccess allows sessionStatus/follow, so a LiveShare viewer opens no owner-only stream, keeps readingReady false, and logs no synchronization failure; access changes start or stop the stream. - Hide the unacknowledged completion of the Session the visible, focused main view retains; manual marks stay visible, completionFailed follows completionUnread, and the reminder returns on blur, hiding, or a switch. - Declare ctx.sessionStatus on Context and restore its SERVICE_PAGE and SERVICE_ROLES entries; the service and SessionRead* types document on docs/subsystems/web-client.md, which now owns the reading section with the failed field. - Document that a Host plugin reload can leave the Client with a terminal error until a page reload; drop the redundant types import and the unused publish() result. - Archived Sessions read as read and offer no reading mark in the row menu or the toggle-read shortcut. - session.toggleRead names the open dialog, open panel, or archived Session that blocks it instead of asking to select a Session. - isRemoteStreamCarrierFailure rejects a RemoteError from the Host even when it carries gateway/carrier-lost; the code is Client-local. - ./types is types-only like ui-trajectory, and files no longer ship lib/types JavaScript. * 🐛 fix(session): close the remaining Session status review gaps - The Gateway Client exports isRemoteStreamCarrierFailure, and the terminal view uses it, so a Host RemoteError carrying the carrier code shows as failed rather than disconnected. - Each access grant's reading stream carries a token: frames a revoked or superseded stream still delivers are discarded, and cleanup waits for disposal before leaving reading unavailable unless a newer grant is active. - The status table hides the viewed Session's natural reminder only while that Session is open; the panel case is a documented limitation. - The README limitation and the upgrade guide state that only the main-view switch rule, including a reload restore, clears manual unread automatically. - Add the missing blank line before the next heading in the web-client reading section. * ♻️ refactor(session): install reading under the Session status table - apply returns to master's form plus one line: UiSessionStatus is the root, published as the useSessionStatus source, and installReading() from the new src/client/read.ts follows Host reading records into it. UiSessionStatus takes master's three constructor parameters and creates its own SessionReadModel as the package-internal `reading` member; installSessionStatus is removed and acknowledge.ts stays a separate file. - The viewed Session's snapshot subscription republishes the table only when its openState changes, so streamed events do not rebuild it. - Remove the obsolete Dev Note sentence about failure outcomes. - session.toggleRead passes when the Peer may not mark reading, matching the row menu, and reports readingUnavailable only while unsynchronized. --------- Co-authored-by: imccyu <[email protected]> Co-authored-by: imccyu <[email protected]>
26 KiB
description, kind
| description | kind |
|---|---|
| Typed Client-to-Host calls and streams: dispatch, validation, cancellation, reconnection, and forwarded Host events. | package-reference |
@deepseek-ai/dsh-api-gateway
English | 中文
Summary
Two-sided Typert RPC endpoint for Host and Client Cordis environments. The Host entry provides ctx.typertGateway, while @deepseek-ai/dsh-api-gateway/client provides ctx.remote; both consume the same generated InvocationDescriptor contract and leave business selection to API Remotes. Connection carries unary request correlation, trust, and response envelopes, while Gateway owns multiplexed Remote streams, each carrying a Client-to-Host uplink on the same logical stream.
Table of Contents
- Host service:
TypertGatewayService(ctx key:typertGateway) - Client service:
ClientRemote(ctx key:remote) - Model Experience
- Known Limitations and Deferred Work
- Dev Note
Host service: TypertGatewayService (ctx key: typertGateway)
ctx.typertGateway.invoke() resolves the current descriptor and Cordis Service for each call, validates exact named arguments, resolves registered object or Context identities, and invokes the public business method. Business Services extend TypertRemoteService and mark methods with @Remote or @RemoteScope from dsh-typert-protocol; bindTypertRemote() remains available when another base class owns inheritance.
Strict mode reads generated invocation descriptors from ctx.typert.local. Lookup parameters use the currently active resolver in ctx.typert.lookups: the business package registers the stable declaration and default policy, while Host composition can override resolution behavior with effect-scoped configure(); @RemoteScope resolves its receiver through a registered Host Context adapter. SRC mode is a development fallback for endpoints that have never had a strict definition; it parses simple parameter names and accepts only JSON-safe values for non-lookup parameters. Withdrawing an observed strict definition fails instead of weakening validation. For unary results, Gateway executes the generated codec's encode() when present and otherwise keeps strict JSON values unchanged; SRC recursively detects runtime byte values. Both paths return JSON-compatible metadata and result-relative byte attachments to Connection for transport framing.
The Host entry registers a trusted-host interceptor on Connection's shared /api FetchHandler. Connection passes this composite handler through its HTTP bridge; the handler dispatches claimed endpoints to Gateway and returns 404 for unclaimed requests unless an exact Fetch route owns them. Direct invoke() calls preserve business errors; TypertGatewayError is a RemoteError subclass whose gateway/* codes name the failures owned by dispatch, binding, providers, lookup, Context, arguments, codecs, and the uplink: gateway/uplink-overflow for an uplink whose buffered frames exceed streamInboxBytes, gateway/protocol for an uplink item after end, and the codec code gateway/input-invalid for a rejected uplink item. A resolver that refuses on policy grounds — a cold-resume failure or an ownership fence — throws its own RemoteError, and the code it chose reaches the caller unchanged.
Every call names the Peer it speaks for: InvokeRemoteRequest.peer and the peer argument of wireStream.open() are required, and the Gateway never supplies a default Peer. Dispatch from a disposed Peer fails with gateway/peer-disposed, for unary calls, streams, $events, and $events/result alike, and wire paths check it before they read the payload. The Host service injects remoteAccess and does not start without dsh-api-remote-access. After the endpoint and argument-field checks, every call validates its JSON arguments once against their Typert-compiled types, failing with gateway/input-invalid, and dispatch reuses the validated values. For a call whose Peer principal is not the owner, after that validation and before lookup and Context resolution, the Gateway resolves the resources the call touches and asks ctx.remoteAccess.decide({ principal, action, resources, args }) with the endpoint as the action and the validated arguments as args, or refuses with reason resource-invalid without asking when the resources are invalid; a refused call throws remote-access/denied with details { action, reason }, so a refused call fails before it activates any Session. An owner call is dispatched without resource resolution or a decision.
Resources are read from validated arguments: Typert-compiled codecs drop undeclared object fields, while SRC fallback checks JSON safety without stripping them; lookup and Context identities keep their wire values. For each resource kind, a reader in the method's @Remote({ resources }) or @RemoteScope(key, { resources }) options wins; it is called with the method's positional arguments, where lookup positions hold wire identities and the cancellation position holds the call's signal, and is read from the class metadata of the root Service instance. Otherwise every lookup parameter whose provider declares that kind through resource contributes its wire identity, an omitted optional one contributing none, and a Context method whose Host Context adapter declares that kind contributes its Context identity, read from the arguments before the Context is resolved. Otherwise the kind's declaration in typert.resources supplies either a default field or a synchronous resolver. A field reads a top-level argument of that name or, failing that, the first object argument. A resolver is called once with { args, parameters }: named validated wire values and ordered parameter descriptions containing name and wire. Both defaults return one identity or undefined; arrays are invalid. An explicit reader may return several identities. A resolver or reader that throws, a reader returning an empty list, or an identity, including a Context identity, that is not a non-empty string makes the resolution invalid; a call that names no resource touches the global resource alone, and a call that names resources touches only those. A forwarded event carries every resource its entry declares, so there a reader returning undefined also makes the resolution invalid, while an entry without readers touches global.
getPendingRemoteEvents() returns detached event-name and Agent-ID metadata for currently unsettled forwarded events in arrival order. It neither exposes request bodies nor changes event lifetimes, and it does not provide a change notification.
A cancellation-aware Remote method declares signal: AbortSignal as its final Host parameter. The signal is descriptor metadata rather than a wire argument: Connection supplies it to the Gateway, and the Gateway injects it after decoded business parameters. SRC recognizes the reserved final name, while strict generation additionally requires the global AbortSignal type.
A stream Remote uses @Remote({ mode: 'stream' }) and returns an Iterable or AsyncIterable. ctx.typertGateway.stream() applies the same endpoint, argument, lookup, and cancellation checks as unary invocation, then returns a cancellation-aware iterable over the business items. The Client opens the Gateway-owned /api/remote.mux WebSocket when its plugin activates and keeps it connected while idle. Connection owns the retry schedule; before each retry it asks the mux to cancel any candidate or active socket and make exactly one fresh physical attempt. The Host sends Ping control frames at the configured websocketHeartbeatIntervalMs interval (two seconds by default), and the browser answers Pong at the WebSocket protocol layer, so idle network intermediaries see traffic without any Remote stream frame. A Pong, any received frame, or a downlink write that does not complete at once counts as peer activity; with the default 'deflate', a frame whose JSON text reaches the compression threshold is deflated asynchronously, so its completion always counts. A socket with no activity across two Ping intervals is terminated, so a congested link that delays the Pong behind data stays connected. With websocketCompression at its 'deflate' default, an upgrade that offers permessage-deflate negotiates the extension, and the Host compresses its own outbound frames whose JSON text reaches 1,024 characters; shorter frames stay uncompressed, uplink frames are compressed at the peer's discretion, and 'none' accepts the same upgrades without the extension. Independently cancellable logical streams share that socket; an in-process Connection carrier provides equivalent streams directly without opening it.
When the launcher supplies ctx.appReady, Gateway registers the WebSocket upgrade route only after successful application startup. Earlier connection attempts remain carrier failures handled by Connection's retry policy, so a restarting Host cannot accept streams while its controllers are still initializing. Unloading cancels a pending readiness subscription and closes any registered carrier. Embedded Hosts without appReady register immediately and own their startup ordering; in-process invocation is unchanged.
Every stream also carries a Client-to-Host uplink on the same logical stream. A method declares the uplink item type as the second type argument of its return type, RemoteStream<Out, In> from dsh-typert-protocol; In defaults to never, and a method that returns Iterable, AsyncIterable, or RemoteStream<Out> declares that it reads none. The running method reads its call as this.ctx.invocation: the Gateway derives the receiver from a Context carrying that RemoteInvocation — request, service, peer, signal, and uplink() — so nothing enters the parameter list, and ctx.invocation is undefined on a Context no Remote call derived. uplink() is available once per call. With a descriptor codec it decodes every item before delivery; without one — an SRC method, or a method whose In is never — it delivers JSON-safe unknown values. The Client sends each item as an item frame on the open logical stream, a top-level undefined item as an item frame without value, and its half-close as an end frame; the method observes the half-close as the end of the uplink() iteration and cancellation through signal. A rejected item fails the whole stream with gateway/input-invalid (field uplink). Uplink items are validated one by one at the Host because they arrive from the browser; downlink items are values the Host method produced and pass through unchecked. When the method finishes its downlink the Gateway returns the uplink iterator and drops unread items; items sent to a method that never takes its uplink wait in the inbox until then. Each logical stream buffers at most streamInboxBytes (262144 by default) of uplink frame bytes; overflow fails the stream with gateway/uplink-overflow, and an item after end fails it with gateway/protocol, in both cases without closing the socket. item, end, and cancel frames for a stream id the Host has already finished are dropped; only a duplicate open closes the socket. Gateway-owned streams such as $events return their uplink as soon as they open, so their item frames are dropped instead of buffered. A unary method may also call uplink(); its items are readable only while the method runs. Every stream speaks for an explicitly named Peer: a WebSocket's streams for the Peer Connection admitted at upgrade, whose scope disposal closes the socket, and an in-process carrier's for the Peer its caller passes. A stream method's signal also aborts when that Peer is disposed, so the stream ends with gateway/cancelled, and a $events stream ends with its Peer; a unary call already running is not cancelled.
Stream cancellation and stopping keep read-local state, not a history of delivered items, on the Host downlink, Host uplink, and Client uplink pump. Completing the downlink also wakes pending uplink reads.
Host composition can register one application event source through registerRemoteEvents(). Gateway reserves the internal $events logical endpoint for that source, accepts only empty args, and aborts streams opened by the registration when the source is withdrawn. API Remotes owns the event selection, argument validation, per-Client queues, and the Host home sent in the opening { type: 'ready', clientId, host: { home } } frame. Its source factory attaches incremental listeners synchronously, so the Client publishes the generation and starts baseline reads only after incremental delivery is ready. A $events stream whose Peer principal is not the owner never receives a scoped waterfall it could answer; it receives a broadcast emit frame, whole and untrimmed, only when ctx.remoteAccess.decide({ principal, action: 'event:<name>', resources }) allows it on the resources the frame's readers name, or on global for a frame without readers; the resources are resolved once per frame, a frame whose resources are invalid reaches no non-owner stream without a decision, and a denied frame is dropped for that stream alone. An $events/result reply from such a Peer fails with gateway/invocation-unavailable.
A disposed Peer is refused before event-stream participation checks. $events and $events/result require peer.interactions === 'answer' for owner and non-owner alike; refusal returns gateway/interactions-forbidden. Only owner Peers receive forwarded waterfalls and may answer; a reply must belong to an event stream owned by the same Peer. hasLiveClient() checks uncancelled owner answering streams; non-owner broadcast streams and bare WebSockets do not count. Cancellation excludes a stream even while its iterator awaits cleanup. This synchronous observation does not guarantee delivery or Client provider readiness.
Client service: ClientRemote (ctx key: remote)
The same ./client import selects standalone Node ESM lib/client.node.js or browser loader factory lib/client.browser.js; the Host package root stays separate. The browser carrier accepts the shell-owned stream origin described by Connection; logical stream framing and lifecycle remain unchanged.
ctx.remote.$mount() validates and registers a generated Host-for-Client contribution, then installs concrete direct and scoped methods for the calling Cordis fiber. Each namespace is a traced remote.<namespace> child Service and unloads after its last method is withdrawn. Duplicate endpoints, namespace collisions, and Client-supplied fields without strict generated codecs fail before methods become callable.
Each unary call checks positional arity, constructs the descriptor's exact named args, and sends the typed values through ctx.connection.rpc.call('/api', endpoint, ...) without executing Client-side schemas; the Host validates the received wire fields before business invocation. A generated stream method returns a RemoteStreamHandle<Out, In> from dsh-typert-protocol and opens one logical stream when it is called, through an in-process Connection carrier when available, otherwise through the shared Gateway WebSocket. The handle iterates the downlink once. send(item) queues an uplink item, sent after the open frame; end() half-closes the uplink; dispose() sends cancel unless a terminal frame has arrived and ends the iteration quietly. Breaking out of the iteration early disposes the handle; after the downlink terminates send throws and end is ignored. Generated cancellation-aware methods accept a final optional AbortSignal; the Client combines it with the contribution mount lifetime before invoking the carrier. The Client delegates unary result conversion to the codec's optional decode(). Generated decoders validate nested metadata and native byte types without iterating, copying, or freezing byte payloads. JSON unary results and stream items pass through without Client-side type parsing. Withdrawing a contribution removes its descriptors and methods together, aborts in-flight calls and streams, and makes retained method handles reject.
Every unary call resolves to RemoteResult<T> — { ok: true, value } or { ok: false, error } — and never rejects for a carrier problem: this face folds an offline carrier into the error branch and answers gateway/cancelled when the caller's signal aborts, so no consumer wraps a call to recover one. Only an assembly fault still rejects: wrong arity, an unmounted method, a withdrawn contribution, a missing Context adapter. error is a live RemoteError instance, so throw result.error keeps throw semantics, and isRemoteFailure(value) is the one predicate a consumer needs — a caught value it accepts carries a Host code, and anything it rejects is a local fault the caller should let crash. carrierFailure(endpoint, error) and cancelledFailure(endpoint, cause) build those two folded results, so a test stand-in for this face folds identically.
ctx.remote.$host reads the fixed Host facts as plain values: home (undefined until the first ready frame) and isLoopback. It is not a store — no subscription, no generation counter — so a consumer that must react to reconnection listens for connection/reset instead of polling it.
ctx.remote.$stream() returns a single-consumer RemoteStream spanning physical carrier generations. For answering Clients it permits one immediate retry after an isolated stream failure while the carrier remains available; after physical WebSocket loss it waits for Connection to reopen the carrier. If the Host generation is already unavailable, it waits for the next connected generation. Each item carries its physical generation. Passive Clients cannot use $stream(); they call generated raw stream methods and handle terminal carrier failure themselves. The domain consumer validates and accepts each generation's opening value; business and protocol failures remain terminal. Every terminal failure leaves this face as a RemoteError, including exhausted carrier retries and a generation that ends before its opening value, so a stream consumer discriminates the same way a unary caller does. A failure whose code is gateway/carrier-lost names a retryable physical loss: RemoteStreamCarrierError carries that code, the RemoteStreamCarrierFailure type describes it, isRemoteStreamCarrierFailure(error) applies the same retry test for a domain that classifies its own failures, and a domain ended callback may return a plain Error with it to request reconnection without importing the class. Retry follows the code, not the class; the code is produced only inside the Client process, so a RemoteError from the Host terminates the stream even when it carries that code; such a failure reaches a domain only as the carrierFailed callback argument, never as a terminal outcome. RemoteSnapshotStream adds one opening snapshot followed by deltas. RemoteJournalStream adds follow-before-page opening, pagination, reconnect catch-up, and gap repair over domain-defined inclusive entry ranges; it removes complete duplicates and rejects gaps, inverted ranges, and partial overlaps. A domain may also carry cursorless notifications: they never advance or repair the durable cursor, and notifications received during gap repair publish only after the replacement page commits. If a newer generation supersedes that repair, held notifications from the superseded generation are discarded with its page. Disposing any stream cancels its requests and resolves after the active iterator is fully stopped.
ctx.remote.$on() subscribes to one forwarded Host event. Its legal keys are exactly the Host assembly's forwarding selection, and the listener type is the owning package's own Cordis Events declaration, so no second signature can drift from it. Each subscription belongs to the calling fiber and disappears with it. The Client Remote service registers the $events pump as a Connection generation source only when connection.interactions is answer, whether any $on listener exists. With none, $on() is unavailable and the Client opens only the physical lifecycle socket; unary calls never wait for socket readiness. Browsers use Remote mux, while in-process compositions use connection.rpc.open; the opening ready item establishes a Connection generation and supplies its Host facts. Carrier failure, Remote stream failure, unexpected normal completion, a non-ready opening item, or a malformed event item ends that generation and lets Connection reopen it under continuous, capped jittered exponential backoff. Ordinary notifications run in registration order and isolate listener failures. Agent-scoped waterfalls let a listener return a result, call next(), or reject; Gateway returns that outcome through the existing HTTP unary carrier.
Client waterfall Context resolution stays synchronous. A resolver can return a borrowed Context or TypertOwnedValue<Context>; Gateway releases the owned value only after handler use and reply settlement. Context-resolution failures retain the existing report-and-delegate behavior, while handler failures produce rejected replies. Cancellation suppresses late replies without releasing a Context still used by the handler. Every handler must observe request.signal and settle after cancellation; plugin disposal and Connection generation replacement wait for outstanding handlers to settle. Session Context acquisition itself performs no history I/O.
ctx.remote exposes no Connection lifecycle control. A consumer whose responsibility includes recovery reads ctx.connection.state and calls ctx.connection.reconnect() directly; ordinary Remote consumers stay on generated namespaces and $stream().
Generated declaration merges provide the TypeScript API through the shared TypertClientRemote contract. The Client entry contains no Host Service or Host Cordis interface merge, and method lookup and invocation use ordinary objects and functions rather than a JavaScript Proxy.
Model Experience
None, as the package dispatches application calls and registers no prompt, tool, or session event.
KV Cache effect
No direct effect; invoked business Services own any model-visible result.
Known Limitations and Deferred Work
- The Connection adapter answers
gateway/internalwith empty details for dispatch failures and unclassified exceptions; aRemoteErrorthrown by an owner or by Gateway itself crosses the wire with its own code, message, and details. Itscausechain and theTypertGatewayErrorsubclass identity survive only for same-process callers. - SRC mode supports unique identifier parameters without destructuring, defaults, or rest parameters. It validates JSON safety rather than generated business types and never infers optional fields.
- Every Client-supplied field requires a strict generated codec when its contribution mounts. SRC markers have no Client type projection and are not normal Client contribution inputs.
$stream()supervises carrier replacement but does not infer replay semantics; each domain owns its resume cursor or replacement-baseline validation and normal-end classification. Connection generations reopen the internal$eventsstream; one-way notifications are not replayed, while pending scoped waterfalls retain their event id across replay.- Lookup resolvers are configured per key; an individual Remote parameter or endpoint cannot currently select a live-only policy under the same
agent/sessionkey. - Forwarded events reach
$onwithout business-payload projection or redaction. Ordinary notifications are not replayed after reconnect; Agent-scoped waterfalls project only the top-level Agent identity needed to select the Client Context and carry their own pending lifetime. websocketHeartbeatIntervalMsis both the Ping cadence and the activity deadline. The Host terminates a peer that shows no activity for two intervals, so a deployment whose event loop or network can stall longer than this interval must raise it.websocketCompressiondefaults to'deflate', which negotiatespermessage-deflate; the Host compresses its own outbound frames whose JSON text reaches 1,024 characters and leaves shorter frames uncompressed, becausewsignores itsthresholdoption under the default context takeover. A completed compressed downlink write counts as buffered activity for the heartbeat rule, while a sub-threshold write counts only when the local send buffer was already full; a loopback deployment that gains no bandwidth can set it to'none'.- A completed uncompressed queued write shows that the TCP peer acknowledged data. A compressed write instead completes once
wshas deflated and written it, so it proves only that the local pipeline drained. Behind a buffering reverse proxy that peer is the proxy, so a vanished Client during sustained downlink is detected only after the proxy stops accepting data. - The Gateway exposes each WebSocket stream's inbox capacity and JSON envelope cost through
invocation.uplinkWindow; carriers without an encoded-frame inbox limit leave it absent. Domain protocols can advertise this window and use acknowledgements to bound in-flight bytes. The Gateway itself does not issue credits: a Client that sends faster than the method reads, or that sends to a method never taking its uplink, fails its stream withgateway/uplink-overflow, and no uplink item is replayed across carrier generations; a domain that must resume an uplink carries its own acknowledgement cursor in the reopened request.
Dev Note
Working context for maintainers — click to expand
None.
The ./stream-protocol export supplies the shared Remote stream framing and parser to native Desktop callers. These callers use the same authenticated WebSocket endpoint as the browser client.