Drop Protobuf; move continuum/v1 domain model to JSON Schema

Nothing imported the proto-generated code (zero references to
continuum-rust-types or @continuum/ts-types's proto export in any
consumer repo), and protobuf's real value - one schema compiled to a
compact binary wire format for both languages - never applied: BE<->proxy
and FE<->BE are both JSON. Also fixes 8 broken $ref paths in the bambulab
schemas and a root tsconfig.json that was sweeping the gitignored
examples/ directory into typecheck.

- proto/continuum/v1/*.proto -> schemas/continuum/v1/*.schema.json
- packages/rust-types: hand-written serde structs instead of
  prost-build codegen
- packages/ts-types: drop the generated/ proto barrel export, keep the
  hand-written TypeBox schemas as the TS source of truth
- root package.json: drop build:ts, protoc, ts-proto
This commit is contained in:
2026-09-05 14:56:24 +00:00
parent 8bdade66c2
commit 952b5e1eca
20 changed files with 233 additions and 199 deletions
+32 -20
View File
@@ -1,35 +1,47 @@
# continuum-schemas
Single source of truth for the Continuum data model. Protobuf definitions in
`proto/` are compiled into two consumer packages:
Single source of truth for the Continuum data model. Everything here is
JSON Schema, compiled into two consumer packages:
- `packages/ts-types` - TypeScript types generated via `ts-proto`, plus
hand-written [TypeBox](https://github.com/sinclairzx81/typebox) schemas
under `src/schemas/` used for runtime validation in `continuum-backend`'s
ElysiaJS routes.
- `packages/rust-types` - a Rust crate (`continuum-rust-types`) that compiles
the same `.proto` files with `prost-build` (via `build.rs`), producing
`serde`-derived structs for `continuum-proxy` and `continuum-ai-worker`.
- `packages/ts-types` - hand-written [TypeBox](https://github.com/sinclairzx81/typebox)
schemas under `src/schemas/` used for runtime validation in
`continuum-backend`'s ElysiaJS routes.
- `packages/rust-types` - a Rust crate (`continuum-rust-types`) with
hand-written, `serde`-derived structs for `continuum-proxy` and
`continuum-ai-worker`.
## Layout
```
proto/continuum/v1/ canonical .proto message definitions
packages/ts-types/ TypeBox schemas + generated TS proto types
packages/rust-types/ prost-generated Rust structs (build.rs codegen)
schemas/continuum/v1/ Continuum's own domain model (PrintJob, Template, ...)
schemas/bambulab/ Bambu Lab MQTT wire schemas (v1/v2, report + request)
packages/ts-types/ TypeBox schemas (hand-written, mirrors schemas/)
packages/rust-types/ serde structs (hand-written, mirrors schemas/)
```
## Build
`schemas/continuum/v1/*.schema.json` is the canonical shape for each
domain object; `packages/ts-types/src/schemas/` and
`packages/rust-types/src/lib.rs` both mirror it by hand. There are only
four small, stable DTOs here (`PrintJob`, `MaterialProfile`,
`PrintParameters`, `Template`), so keeping two hand-synced copies in sync
is less overhead than running a codegen pipeline (`protoc`/`ts-proto`/
`prost-build`) nothing actually consumed - see git history for the
protobuf version this replaced, and why it was dropped: every service in
this system talks JSON (JSON Schema for the wire, TypeBox/serde for
runtime validation), so protobuf's actual value - a single schema compiled
into a compact **binary** wire format for both languages - never applied.
Requires `protoc` on `PATH` and `npm install` run at the repo root first.
Whenever a domain schema changes, update all three by hand: the JSON
Schema file, the TypeBox schema, and the Rust struct.
## Build / verify
Requires `npm install` at the repo root, and a Rust toolchain, first.
```
npm install
npm run build:ts # protoc + ts-proto -> packages/ts-types/src/generated
npm run build:rust # cargo build, runs build.rs -> prost-generated structs
npm run build # both
npm run build:rust # cargo build, confirms the Rust structs compile
npm run typecheck # tsc -b, confirms the TypeBox schemas compile
```
Generated TS output under `packages/ts-types/src/generated` is build-derived
and gitignored. The Rust crate's generated code lands in `OUT_DIR` per
standard `prost-build` conventions and is never committed.
There's no `build:ts` step - the TS side is hand-written, not generated.