Expand description
The resource plane: the read-only file surface a capsule declares under exports.files.
Two verbs, list and read, served host-side off the ordinary host path the runtime already
holds for the workdir. No wasm is instantiated, no store is locked and no running turn is
consulted, so the plane answers whether the capsule is idle or mid-task — and a read never
costs an inference turn.
Three responsibilities are kept apart:
- The agent owns what a file contains. Nothing here asks it anything.
- The runtime owns who may read it. Path resolution lives entirely in this module: a
caller never sanitises a path, because a gateway that normalises
..into something servable has taken over the containment boundary, and the component holding that boundary must not think. Every escaping request is refused, never repaired. - The trace owns the record. Every read and every refusal lands in
trace.jsonlat the moment of the request, because the agent has been removed from the loop and the trace is the only account of what left the capsule and when.
Declaring an export does not change the achieved containment class — see
crate::containment. Containment describes the guest’s reach outward; an export widens the
operator’s reach inward and hands the guest nothing.
The filesystem work is synchronous std::fs run on tokio::task::spawn_blocking, and the
resolve-then-verify-prefix path is the only one: openat2(RESOLVE_BENEATH) is Linux-only and
could never be more than an extra layer over a portable path that has to be correct by
itself, so this module keeps the portable path alone rather than two that can disagree.
Structs§
- Declared
Export - One
exports.filesblock, with its root already resolved against the session’s accessible workdir. - List
Entry - One regular file under the export root.
size_bytes,mtime_msandsha256all come from a single open of that file, so they describe one version of it and never a mixture of two. - List
Response - Read
Response - The bytes of one file together with the validator that describes those bytes.
- Resource
Plane - Everything the resource plane needs to answer a request, and nothing that a running task leaves behind.
- Resource
Response - A status, headers and a body — everything a transport needs and nothing about the transport.
Enums§
Constants§
- RESOURCE_
PATH_ PREFIX - Path prefix the plane answers under. Everything below it is
GET-only.
Functions§
- check_
export_ root - Refuses a launch whose declared export root already resolves outside the accessible workdir.
- check_
peer_ files_ root - Refuses a launch whose declared
exports.peer_files.rootalready resolves outside the accessible workdir —check_export_rootfor the peer plane’s root, and the same refusal. - handle_
resource_ request - Answers one resource-plane request: a method, a raw request path, and nothing else.
- reason_
phrase - The reason phrase for a status either plane can return. Only these appear; anything else is a programming error rather than a response shape callers depend on.
- symlink_
policy - What a symlink under the export root means at each achieved containment class.