Add `volumes` to protocol

Closed
SA
2mo ago
+1375-105

Summary by cubic

Adds volumes to the wire protocol so a serving relay (monty-server) can mount directories from its own store into a session's sandbox and serve their filesystem calls itself, requested at checkout instead of via upgrade headers.

Protocol

  • Configure now carries repeated RemoteVolumes (virtual path, UUID, mode, eager entries, optional name, size and operation limits); children ignore them, so no protocol version bump.
  • The subprocess transport and WASM runtime have no store and refuse or drop volumes.

Python client

  • New RemoteVolume class and AsyncMontyWebsocket.checkout(volumes=...) accepts one or a sequence; mounts ride on Configure and are re-sent on resume.
  • RemoteVolume without an id generates one with uuid.uuid4(); read it back from id to mount the same volume again.
  • Mode defaults to overlay, matching MountDir; overlay writes belong to the connection (survive feeds, never stored), unlike MountDir's feed-scoped overlay. The three limits (size_limit, write_operations_limit, read_operations_limit) take the server's default when None.
  • eager entries are files or Path.glob patterns; a trailing / loads everything beneath a directory, / alone loads the whole volume, and an entry matching nothing fails the checkout.
  • The constructor rejects non-absolute and NUL-containing virtual paths, names over 128 bytes or with control characters, and __repr__ escapes its strings.
  • monty_fs::path_security is now public so a relay serving its own mounts applies the same path policy, including mount-prefix matching.