openbutler-protocol
The wire contract between the OpenButler daemon and its clients: frame encoding, action envelopes, responses, and the shared session/state types. Shapes only — every rule, validation and computation lives in the daemon; this crate defines what the messages look like and nothing else.
Contract rules
- Field names and JSON shapes are stable at the schema level: changing them is a breaking change for every consumer and needs a version bump. JSON object key order and whitespace are not part of the wire contract.
conformance/holds semantic round-trip and negative vectors;tests/proves encode → decode identity and rejects malformed variants against them.- Consumers pin a git revision while the wire is moving; each published crate version is cut from a tagged release of this repository.
- The wire version and the crate's semver move together: a patch or minor
release never changes the wire, and a wire change is a major bump of
this crate that the owner approves before it ships. The envelope carries
DAEMON_PROTOCOL_VERSION, and the host refuses a frame whose version differs from its own, so a mixed-version pair fails loudly instead of misreading a field.
Layout
src/— envelope, framing, and the session/runtime/ledger types.conformance/— the wire vectors the tests decode and re-encode.tests/— conformance and action-payload suites.
Action catalog
GET /api/actions returns the ACTIONS catalog. Each entry names the action
and its action-level exposure, mutates, viewOnly, and streams rules.
When subcommands under one action have different exposure or mutation rules,
the entry also carries commands:
commands is optional and appears only for real per-command differences.
schedule.manage uses it to distinguish its non-mutating capabilities, list,
and log commands from its mutating commands. Entries without it retain their
existing JSON shape. Action::new and Action::streaming leave it absent;
Action::with_commands supplies the const metadata.
Writing your own client
Everything a client needs is published; no source reading required.
- Read the surface.
GET /api/actionson a running host answers the full catalog — each action'sexposure,mutates,viewOnlyandstreamsrules — andGET /api/healthanswers readiness plus the wire and build identity. Both are unauthenticated. - Pick a door. The local door (a named pipe on Windows, a unix socket
elsewhere) and the WebSocket door at
/wscarry the same newline-delimited JSON frames.POST /api/{action}carries one request and one envelope withAuthorization: Bearer <token>; it refusesstreamsactions with a sentence, because their answers are followed by frames and only/wscan carry the whole stream. - Authenticate.
POST /api/logintrades the account password for a device session token; the framed door's first frame carries that token (conformance/auth-first-frame.jsonis the vector). - Attach before you send.
attachanswersbindingKey, and every session-bound action echoes the key in its payload — the host refuses a frame whose key does not match the connection's binding, so the client stores the key and returns it verbatim. - Prove your codec.
cargo testin this repository runs the conformance vectors underconformance/: decode → re-encode identity and the malformed rejections. Point your own encoder at the same JSON.
Build
cargo test