Skip to main content

Module agent_media_files

Module agent_media_files 

Source
Expand description

A file a container agent’s message shows or opens: read from the agent’s own folders, never from a host path.

A message of a container agent can name any path: ![](C:/Users/me/photo.png), ![](/etc/x.png), a link the agent made inside its workspace that points elsewhere. The window that draws the message reads a path as the person, so reading the path as written would show the person’s own files in a pane the agent can screenshot. So a request that names the agent’s pane (block_id) is answered here: the path is taken as the agent wrote it, a path in its container (/workspace/a.png) or a path of the folder it shares (a relative path resolved against the working directory), found in one of the folders the pane binds writable into its container, and opened by walking down from that folder without following a link (workspace_copy::open_beneath). A path anywhere else (another folder of the host, a drive or network path, the agent’s home inside its container) is refused with the reason, and so is one that leaves the folder through a link.

The pane’s own folders only: another container agent’s workspace is not this agent’s. A folder bound read-only is not listed (the agent can’t change it, but nothing in this check needs it).

Structs§

Found 🔒
A file found in one of an agent’s folders.

Constants§

LEADS_OUT 🔒
The refusal for a path that is in the agent’s folder and leads out of it.
NO_FOLDER 🔒
The refusal for an agent with no folder to show.
OUTSIDE 🔒
The refusal for a path that is not in the agent’s own folders.

Functions§

collapse 🔒
path with . and .. taken out, as one text with / separators; None when a .. would leave its root.
is_relative 🔒
Whether path is a name or a path from the working folder: not rooted, and not led by a drive.
open 🔒
The file asked names, opened from the agent’s own folders (see resolve) without following a link.
pane_meta 🔒
The settings of the pane block_id when it is a container agent’s pane: the one an agent’s message is shown in, whose folders its paths may lead into. None for any other pane (a native agent’s messages are unchanged) and for a pane that is not there.
resolve 🔒
asked, as a message of the container agent of the pane meta wrote it, found in the agent’s own folders.
within 🔒
What lexical (collapsed, absolute) is inside bind, if it is: as the container names it (/workspace/a.png; a container’s paths are case-sensitive) or as the host does (the folder’s own path, which a relative path of the message is resolved against). Returns how long the match is, so the deepest folder wins, and the rest of the path.