feat(cluster-protocol): publish TypeScript cluster client - #843
Merged
Conversation
tomdps
enabled auto-merge
July 29, 2026 18:34
Greptile SummaryAdds a published Node 18+ TypeScript client for the v1 cluster WebSocket protocol.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/cluster/connection.ts | Implements request ownership, response routing, bounded inbound processing, subscription registration, cancellation, and connection teardown. |
| src/cluster/subscriptions.ts | Implements bounded subscription streams and constant-memory durable-watch reconnection and boundary deduplication. |
| src/cluster/frames.ts | Enforces frame byte limits before binary decoding or string encoding-copy allocation. |
| src/cluster/client.ts | Exposes the typed client API, protocol initialization, subscription construction, and injectable/default WebSocket connection setup. |
| scripts/generate-cluster-types.js | Deterministically emits TypeScript protocol types, constants, method maps, and the embedded schema. |
| package.json | Adds cluster build, validation, packaging, exports, and optional WebSocket runtime configuration. |
Sequence Diagram
sequenceDiagram
participant App
participant Client as ClusterClient
participant Conn as Connection
participant Peer as Cluster Server
App->>Client: connect(url)
Client->>Conn: initialize protocol
Conn->>Peer: JSON-RPC initialize
Peer-->>Conn: validated response
App->>Client: unary call or subscription
Client->>Conn: dispatch request
Conn->>Peer: bounded WebSocket frame
Peer-->>Conn: response or notification
Conn-->>Client: validated result / bounded queue
Client-->>App: result or async stream item
Reviews (3): Last reviewed commit: "fix(cluster-protocol): bound peer-contro..." | Re-trigger Greptile
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Jul 29, 2026
tomdps
enabled auto-merge
July 29, 2026 19:15
tomdps
force-pushed
the
feat/748-typescript-cluster-client
branch
from
July 29, 2026 19:19
e4bf331 to
417df2f
Compare
|
🎉 This PR is included in version 6.12.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Closes #748
Outcome
Publishes
@the-open-engine/zeroshot/clusteras a Node 18+ CJS/ESM/TypeScript WebSocket client for the full v1 cluster protocol.Ownership decisions
getthenwatch(fromCursor), and suppresses the last ordered physical(runId,cursor)redelivery with constant memory across reconnects.clustersubpath, optional installedwsruntime, and injectable browser-compatible factory.The issue's two ownership-design comments were followed directly. The claimed checked-in
docs/v2/748-typescript-client-design.mdwas absent from freshorigin/main, so no replacement design document was fabricated.Regression coverage
Deterministic tests cover every prior #799-#802 defect class: shared-ID collisions, exact pending cleanup after failed sends, 1024-entry overflow for all stream types, failed/competing reconnect ownership, close at every reconnect boundary, multi-waiter FIFO, close cleanup after cancel failure, post-handshake abort, malformed peer frames and bounded diagnostics, generated response validation, and packed CJS/ESM/TypeScript/default-
wsconsumers.External review added and closed two security P1s before merge: durable-watch dedup state is scalar/constant-memory over thousands of unique events, and inbound binary/text byte limits are enforced before decode/encoding-copy allocation. Both review threads include fix and independent probe evidence.
Independent non-authoring verifiers required four rounds. Their final runs reproduced the historical races plus malformed-frame, error-envelope, cancellation, installed-runtime, 5,000-event dedup, UTF-8 boundary, and decoder-allocation probes. No P0/P1/security finding remains.
Verification
npm run protocol:checknpm run typechecknpm run lint(0 errors; existing warnings remain)npm run test:cluster-client— 38/38npm run test:cluster-package— 4/4npm test— 1953 passing, 18 pendingnpm pack --dry-runnpm run rust:checknpm run test:unit— 1953 passing, 18 pendingnpm run check:agent-cli-provider:ci— 147/147npm run dupcheckopcore check --changedNon-goals preserved
No Rust dispatcher/server/client behavior, in-process TypeScript transport, hosted authentication, provisioning, or native-daemon behavior changed.
Discovered protocol work
WatchResultuniquely lacks Rust#[serde(deny_unknown_fields)], so its generated schema permits unknown properties whileLogsResultandAgentAttachResultare closed. This PR intentionally follows generated authority rather than hand-tightening the TypeScript validator.