Staging every write until close broke tempfile, git, and SQLite, which expect normal files. Actors that need an atomic publish write a temporary file and rename it; the SDK has write_atomic for that.
1.9 KiB
1.9 KiB
Working on Sausage
Sausage is meant to be read and changed by agents, including its own agent. Keep it that way.
Priorities
- Correct. Every behavior in
PROTOCOL.mdhas a test incli/tests/. - Simple and short. Prefer the obvious code. No abstraction for one caller. No configuration that nobody asked for.
- Readable. A new reader must understand a file without the others. Each module starts with a doc comment that says what it owns.
- Efficient on the paths that run per message.
- Raw and minimal. Sausage has no permissions, sandboxing beyond WASI, limits, or authentication. Do not add them to the core. Add nothing to the host that an actor (or the agent, by changing itself) could do.
Layout
cli/: the host (sausagebinary and library).lib.rs:Host, which starts and stops a world.broker.rs: routing, mailboxes, the version store, broker requests.supervisor.rs: runs one WASM actor (restarts, swaps, rollbacks).runtime.rs: Wasmtime instances and what they get (mounts, network).candidate.rs: tests a new version.cargo_actor.rs: builds Rust.world.rs: the on-disk layout.console.rs: the terminal.
sdk/:sausage-actor, the SDK for Rust actors. Never published: thecargoactor pointssausage-actor = "0.1"at its local copy.agent/: the agent actor.sausage initembeds and builds it.examples/: small actors. They are not workspace members.PROTOCOL.md: the contract between the host and the actors. Change it in the same commit as the behavior.DECISIONS.mdsays why; when the two disagree,PROTOCOL.mdand the code win.
Checks
nix develop -c cargo test -p sausage -p sausage-actor -p agent
nix develop -c cargo build --release -p agent --target wasm32-wasip2
nix develop -c cargo clippy --workspace
nix run -- init and nix run -- run must keep working without other
setup.