# 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.
## 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`:
```json
{
"name": "mcp.manage",
"exposure": "remote",
"mutates": true,
"viewOnly": false,
"streams": false,
"commands": {
"list": { "exposure": "remote", "mutates": false },
"add": { "exposure": "local", "mutates": true },
"remove": { "exposure": "local", "mutates": true }
}
}
```
`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.
## Build
```
cargo test
```