Skip to main content

Module state_store

Module state_store 

Source
Expand description

Durable, capsule-scoped state stores: ~/.murmur/state/<store>/, granted per artifact by capabilities.state and mounted into a guest as a second WASI preopen named STATE_PREOPEN_NAME.

Two properties decide the layout, and both are load-bearing:

  • Outside every workdir. A subdirectory of the session workdir is reachable by any artifact that holds the workdir preopen, and capabilities.filesystem.scope cannot protect it — scope is a single path prefix, so hiding one subtree from one artifact would mean narrowing every other artifact to some sibling prefix. A path the workdir preopen cannot name is the only version of this that holds.
  • Keyed by capsule, not by workdir. A workdir-keyed store would be an undeclared sharing channel: two capsules launched in the same directory would read each other’s state with no grant on either side. Sharing between capsules goes over A2A, with a grant on both ends, or it does not happen. A capsule wanting per-project notes writes them into the workdir — the workdir already is the project. state/ is for what outlives one.

Resolution and creation are deliberately separate calls. state_store_reports resolves and validates without touching the filesystem, so mur run --explain-scope can print exactly what a launch would open while remaining the read-only diagnostic it claims to be; only ensure_state_store, on the real staging path, creates anything.

Constants§

STATE_PREOPEN_NAME
The guest path a granted state directory is preopened at. A guest reaches its store by writing state/<file> — a relative path resolved against this preopen rather than against the workdir preopen mounted as ".".

Functions§

ensure_state_store
Resolve store, create both the state root and the store directory at 0700, and return the store’s host path.
state_store_reports
Every state store the given artifacts declare, resolved and validated but not created.
validate_store_name
Whether store is a single usable directory segment under ~/.murmur/state/.