Expand description
Which files an agent may upload into a browser pane (docs/specs/SPEC_AGENT_DRIVEN_BROWSER_PANES_2026_10_07.md §5.3): only files inside its own workspace, so a page (or a tricked agent) can’t use an upload field to carry off anything else on the machine.
Structs§
- Upload
File 🔒 - A file ready to hand to the page: its name, a content type from its extension, and its bytes.
Constants§
- CONTAINER_
WORKSPACE 🔒 - Where a container agent sees its workspace.
- MAX_
UPLOAD_ 🔒BYTES - At most this many bytes in one upload, all files together. Bigger files
are for the user to pick (
BrowserHandoff). - MAX_
UPLOAD_ 🔒FILES - At most this many files per upload.
Functions§
- agent_
workspace 🔒 - The workspace the agent on
block_idwas launched in, if srv started it as a host agent. - canonical 🔒
canonicalizewithout Windows’\\?\verbatim prefix, which the browser doesn’t expect in a file path.- check_
upload_ 🔒paths - Check
paths(absolute, or relative to the workspace) and return their canonical forms: each must be an existing file insideworkspaceafter resolving..and symlinks. - container_
view 🔒 - What a container agent is told when a file it named is not inside its workspace: the same as for a file that isn’t there, so a link in the workspace can’t be used to ask whether a host path exists.
- container_
workspace 🔒 - The host folder behind
/workspacefor the container agent onblock_id. - files_
for_ 🔒agent - The files
pathsname, read for the agent onown(its block) as the objects the page is given: name, type and base64 bytes. They come from the agent’s own workspace only: where srv launched a host agent (not its block’scmd:cwd, which any client can rewrite, spec §5.3), or the folder behind a container agent’s/workspace, whose answers never name the host folder. Up to 25 MB of file I/O and base64 happens off the async workers. - handle_
path 🔒 - map_
container_ 🔒paths - The host paths for files a container agent names:
/workspace/..., or a path relative to its workspace. Anything else in the container (its home,/tmp) isn’t on the host and isn’t uploaded, and neither is a path with..in it, which would reach the host folders beside the workspace. The result goes throughcheck_upload_pathslike a host agent’s, which resolves links on the host: a link in the workspace that leads outside it is refused. - mime_
for 🔒 - A content type for the file, from its extension, as a browser’s own file picker would give it. An extension not known here gets no type at all (empty), as the picker gives one it doesn’t know, rather than a forced generic one a page might reject.
- read_
upload_ 🔒files - Read the files
check_upload_pathsapproved. Each is opened once, and the check is repeated on the open handle: the file it really refers to must be a regular file inside the workspace. The bytes are read from that same handle and the page is given the bytes, never a path, so replacing a checked file with a link afterwards changes nothing. - record_
container_ 🔒workspace - Remember the host folder mounted at
/workspacein the container of the agent onblock_id, as srv started it: the mount’s source, not the block’scmd:cwd, which any client can rewrite after the launch. Called where the container’s mounts are decided. - record_
launch_ 🔒workspace - Remember the workspace the agent on
block_idwas started in: theAGENTMUX_AGENT_WORKDIRsrv just put in its spawn env (host agents only; a container agent has none). Called by every spawn path right afterspawn_env::block_identity::carry_agent_workdir_env.