Skip to content

Contract slice 1, the core edge: bindings, typed ids, a validator checked against the engine's - #6094

Draft
joelteply wants to merge 2 commits into
canaryfrom
fable/contract-s1-core
Draft

joelteply wants to merge 2 commits into
canaryfrom
fable/contract-s1-core

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Serves every mind's switch, act and learning step: the seam they cross gets one definition, generated for both sides, instead of JSON each side guesses at. Plan line 3b (one live engine); slice 1 of the accepted design #6092 (CONTINUUM-ENGINE 4.11).

  • core/llama/contract_build.rs:
    • binds the fork's server-continuum.h, with layout tests on;
    • compiles the engine's own validator;
    • derives the schema identity exactly as the fork's CMake does (the first 16 bytes of the header's SHA-256).
  • inference::engine_contract:
    • EngineInstanceId, ActId and LayerId are distinct types over the UUID's 16 bytes. New ids are UUIDv7; the workspace uuid crate gains the v7 feature.
    • validate() mirrors the engine's ctm_validate, reading fields at the bound structs' own offsets and converting every tag with a checked conversion.
  • Cross-language test: both edges must give the same verdict on the same bytes for every case, and both builds must have compiled in the same schema identity.

Draft: the submodule is pinned to fork fable/contract-s1 (llama.cpp#141) until that lands on the shipping line.

No behavior change; nothing calls this yet. Not built locally (the M5 is serving), so CI is the first compile.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…checked byte for byte against the engine's (CONTINUUM-ENGINE 4.11)

Serves every mind's switch, act and learning step: the seam they cross gets one definition, generated for both
sides, instead of JSON each side guesses at. Plan line 3b (one live engine); slice 1 of the accepted design (#6092).

- core/llama/contract_build.rs: binds the fork's tools/server/server-continuum.h (layout tests on: fixed-size POD
  frames), compiles the engine's own validator, and derives the schema identity exactly as the fork's CMake does
  (first 16 bytes of the header's SHA-256). llama::contract exposes the frames, ctm_validate and SCHEMA_ID.
- continuum-engine inference::engine_contract: EngineInstanceId / ActId / LayerId as distinct types over the
  UUID's 16 bytes (ActId/LayerId mint UUIDv7; workspace uuid gains v7); validate() mirrors ctm_validate (magic,
  version, schema, kind, exact size, zero reserved, tags via checked conversion, buffer bounds) reading fields at
  the bound structs' own offsets.
- tests.rs: both edges must give the same verdict on the same bytes for every case, and the two compiled schema
  identities must be equal.
- Submodule pinned to fork fable/contract-s1 (c1b4abceb, llama.cpp#141): draft until that lands on the shipping line.

No behavior change; nothing calls it yet (slices 2-6 replace the JSON call paths). Not built locally (the M5 is
serving); CI is the first compile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ontract-s1, draft until llama.cpp#141 lands); in_range takes a typed Range; the short-frame case slices by the header's size, not a literal

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant