# kcode-rust-bins 1.0.0 Specification
## Boundary
The crate owns immutable managed-source generations, optimistic complete replacement, strict migration from the earlier flat layout, disposable Podman validation, exact executable publication through `ObjectStore`, one framed guest protocol, and generic executable-object execution. The integrating server owns authorization, configured roots, object policy, durable attempt fencing, blocking supervision, deployment, and model-facing schemas.
The shared source API deliberately follows `kcode-rust-libs-v2`: free `create`, `open`, and `docs`; one `Lib` with public complete `files`; and `Lib::{write, check, publish}`. There is no manager, accessor layer, public snapshot or check-stage model, persistent-open lock, patch, delete, rename, list, reload, or close.
## Source
Names and paths use the same canonical rules as `kcode-rust-libs-v2`. Root `Cargo.toml` and `Documentation.md` are mandatory. `Cargo.lock` is omitted on read and rejected on write. Persistent source is stored as immutable generations behind atomic `HEAD`. A `Lib` privately retains its expected generation; write rejects stale snapshots and atomically installs the complete proposed source. Valid legacy flat repositories migrate on first open or docs while preserving their original files as recovery material.
## Build and publication
Check and publish materialize exactly the current in-memory source. A fixed Rust 1.97 Bookworm image performs networked dependency fetch, then network-disabled locked/offline formatting, all-target build, Clippy with warnings denied, tests, doc tests, a size-optimized `x86_64-unknown-linux-musl` release build, and static-link inspection with `readelf`. Check discards the executable. Publish runs that flow once and saves the exact validated bytes through `ObjectStore`.
## Protocol and execution
Both frame directions use the fixed 8-byte `KRBIN` revision-1 magic, little-endian lengths, exactly one UTF-8 JSON value, and ordered byte objects. Frames reject bad magic, invalid JSON or UTF-8, overflow, truncation, trailing bytes, JSON over 16 MiB, more than 1,024 objects, an object over 512 MiB, or aggregate payload over 1 GiB.
`run` loads the supplied arbitrary executable object and ordered inputs, starts the executable in an open-networked rootless disposable Podman container, concurrently writes stdin and drains stdout/stderr, enforces a ten-minute timeout, requires zero exit plus one complete output frame, and saves output objects in order. It grants no provenance, authorization, confidentiality, exactly-once effects, or safety claim. No host secrets, Podman socket, or ambient host data are injected.