-
Notifications
You must be signed in to change notification settings - Fork 0
Protocol
This directory is the single source of truth for the browser/server
WebSocket protocol. The JSON Schema files here (draft 2020-12) are the only
editable authority: the Python pydantic models under server/schemas/, the
generated TypeScript under client/src/protocol/generated.ts, and the wire
itself are all derived from or checked against these schemas.
-
protocol_version.txt— the current version string. It is the single source ofprotocol_versionfor the server, both envelopes, and codegen. -
envelope.schema.json— the shared$defsvocabulary. -
client_message.schema.json— the inbound (browser → server) envelope. -
server_message.schema.json— the outbound (server → browser) envelope. -
payloads/*.schema.json— the nested payload shapes. -
codegen/generate_ts.mjs— emitsclient/src/protocol/generated.ts.
Additive is the default; breaking changes are a MAJOR bump. Edit the
schema first, then regenerate and let the parity test
(tests/test_protocol_schema_parity.py) prove the Python models still agree.
-
Additive, non-breaking (no version bump). Adding an optional payload
key, a new descriptive envelope field, or relaxing a constraint is allowed
without changing
protocol_version. Every envelope and payload setsadditionalProperties: true, so consumers MUST ignore unknown fields and MUST NOT rely on field ordering. -
New
typeenum value (MINOR bump). Adding a value to atypeenum is additive but breaking for a closed consumer, so it requires a MINOR bump (1.0→1.1). A consumer that does not recognise a newtypeMUST ignore the message and continue, never crash. -
MAJOR bump (
1.x→2.0). Removing or renaming atype, removing or retyping an existing field, changing required-ness, or changing aconstis a MAJOR bump. MAJOR bumps require a coordinated server + dashboard release and a shim window.
When the version changes, update protocol_version.txt and the const in
both envelopes together; the parity test asserts they stay equal.
cd client
npm install # once, to pick up json-schema-to-typescript
npm run gen:protocol # writes client/src/protocol/generated.tsCI enforces git diff --exit-code client/src/protocol/generated.ts after
npm run gen:protocol, so a schema change without regenerated types fails,
and a generated-type change without a schema change fails too.
| Change | Version action | Consumer rule |
|---|---|---|
| New optional field / payload key | none | ignore unknown fields |
New type enum value |
MINOR | ignore unknown type
|
| Remove / rename / retype / re-required | MAJOR | coordinate a release |
Missing protocol_version. An inbound message without
protocol_version is rejected with a type: "error" message carrying
payload.code = "protocol_version_mismatch", exactly like a present value
whose MAJOR component differs from the server's. (Phase 1 accepted a missing
version as legacy "0.x" with a one-line deprecation log; that transition
window is closed as of Phase 2.)
- Home
- Architecture
- Backend Execution
- Benchmarks
- Dashboard
- Development
- Event Datasets
- Event Runtime And Energy
- Features
- Implications And Boundaries
- Interop Foldins
- Interpreter Spine
- Introspection
- Model Deployment
- Model Hub
- Notes
- Operational Maturity
- Production Workflows
- Project Layout
- Quickstart
- Requirements
- Sequence Primitives
- Streaming Timeseries
- Targets And Interop
- Usage
- Arch 0001 Adr Repo Topology
- Arch 0001 Core Boundary
- Arch 0001 Decision Metrics
- Arch 0001 Migration Plan
- Arch 0001 Packaging Versioning
- Arch 0001 Protocol Contract
- Arch 0001 Risk Register
- Arch 0001 Target Topology
- Backend Execution Plan
- Ecosystem Listings
- Ecosystem Roadmap
- Event Runtime Plan
- Hub Expansion Plan
- Plans
- Interop Foldins Plan
- Interpreter Spine Plan
- Memory System Research
- Model Hub Plan
- Operations Plan
- Production Toolkit Plan
- Production Use Cases
- Professional Roadmap
- Repo Topology Plan
- Sequence Primitives Plan
- Use Case Audio Keyword Spotting
- Use Case Biosignal Medical Monitoring
- Use Case Computational Neuroscience
- Use Case Edge Power Budgets
- Use Case Event Camera Vision
- Use Case Intrusion Anomaly Detection
- Use Case Low Latency Sensor Stream
- Use Case Rl Control Robotics
- Use Case Spiking Transformers
- Use Case Streaming Timeseries