refactor: drop alktype dependency; add BAST doc for chunk header

- Remove alktype from Cargo.toml (its only usage was a thin wrapper
  over jsonschema::options().build())
- Replace alktype::validation::build_validator with direct jsonschema
  in dispatch.rs
- Add docs/architecture/chunk-header.bast.json — the chunk header's
  BAST (Binary Abstract Syntax Tree) machine-readable wire spec
- Embed as channels::wire::CHUNK_HEADER_BAST via include_str! so
  downstream Rust crates can consume it without a file lookup
- Add test asserting the embedded BAST doc is valid JSON and matches
  the wire format
- Update AGENTS.md §10 and implementation-specialist.md: BAST docs
  are the contract; trivial/hot-path formats stay hand-rolled,
  complex formats use the alktype engine or codegen

Verification:
- cargo test: 543 passed, 0 failed
- cargo clippy --all-targets -- -D warnings: clean
- cargo fmt --check: clean
- cargo doc --no-deps: clean
- BAST doc compiles + round-trips against alktype v0.2.0 engine
This commit is contained in:
glm-5.2 committed 2026-08-17 06:08:13 +00:00
1 parent 08e7df2aa0
commit 44d4b496e8
10 files changed
+95 -42

No files matched your search

+12 -5
View File
@@ -136,11 +136,18 @@ session, not just spawned implementation agents.
dial and the TLS config are concerns of the consumer, not of this
crate. See ADR-007, ADR-008, ADR-009.
10. **`alktype` dependency** — use `alktype` for binary layout (the
channels chunk header, future binary payload schemas) and JSON
payload schema validation (`OperationSpec`'s `input_schema`/
`output_schema`). Do not roll your own offset map or validator. See
the alktype crate at `/workspace/@alkdev/alktype`.
10. **BAST documents for wire formats** — every binary wire format in
this crate carries a BAST (Binary Abstract Syntax Tree) document as
its machine-readable spec (e.g. the channels chunk header's
`docs/architecture/chunk-header.bast.json`, embedded as
`CHUNK_HEADER_BAST`). BAST is plain JSON — no dependency required
to author or consume it. The `alktype` crate compiles BAST into
readers/writers/validators; future codegen derives
language-specific implementations. Trivial or hot-path formats
(chunk header, tty framing) stay hand-rolled with the BAST doc as
the contract; complex formats (sftp) use the alktype engine or
codegen. Do not roll your own offset map or validator for complex
formats. See the alktype crate at `/workspace/@alkdev/alktype`.
11. **Feature flags** — transports may be feature-gated if the need
arises. The base crate should compile lean (no `quinn`, no `iroh`