Skip to main content

Module agent_export

Module agent_export 

Source
Expand description

Agents export (POST /api/v1/agent/export): one agent saved as a portable archive file (.abf, kind agent): its definition, Personal Memory and conversation in the history store’s compact form (SPEC_MOVE_AN_AGENT_TO_ANOTHER_COMPUTER section 4, step A of the build). The file is written as a stream, never held in memory and never base64.

Who may ask: the agent itself, or the agent that leads it (its seat’s lead). Another agent’s conversation is its own to share (conversation_visibility), so no other agent is let read it through here. Where the file goes: under the caller’s own working folder, never over an existing file, and never outside it by .. or a link. A container agent has no host folder to write to; its export arrives with the container step of the build. Each export, and each refusal, is recorded in the audit log under the calling agent.

Structs§

ExportRequest 🔒
HandOverClaim 🔒
Held for the length of one hand-over; dropping it lets the next begin.

Constants§

AUDIT_ACTION 🔒
The audit entry’s action.
EXTENSION 🔒
The extension of an agent archive.
TEARDOWN_WAIT 🔒
How long a stopped agent is given to finish shutting down before the export is refused.

Statics§

HAND_OVERS_IN_FLIGHT 🔒
The agents a hand-over is under way for in this srv: a second one for the same agent would put back a mark the first had already settled, so it is refused while the first runs.

Functions§

audit 🔒
claim_hand_over 🔒
hand_over_in_flight 🔒
Whether a hand-over of agent uid is under way in this srv: bring_back waits for it rather than clear the mark under it.
handle_agent_export 🔒
parse_include 🔒
plain 🔒
The path without the \?\ prefix a canonical Windows path carries, which nothing a person reads should show.
quiesce 🔒
raise_fence 🔒
A move by file marks the agent handed over first, then stops it through the normal stop path, so nothing can start it or reach a live process between the stop and the file, and nothing writes to its conversation after the file is made. Returns the mark it had before, to put back if the export fails. A refusal puts it back too.
refuse_if_shutdown_unconfirmable 🔒
This build can confirm that a stopped agent has finished shutting down only for the controller most agents run on. An agent in a pane with another kind of controller (ACP, App Server, a plain subprocess) stops asynchronously with nothing to wait on, so a file made right after could lack its last output: refused until those controllers report it.
resolve_input 🔒
The archive to read: file under base (relative, or absolute inside it), an existing regular .abf file, reached by no .. and no link that leaves base. The same folder Agents export writes to, so a file an agent or the person put there is the one it imports.
resolve_output 🔒
The file to write: to under base (relative, or absolute inside it), or exports/<default_name> there. Never an existing file, never a name with .., never through a link that leaves base.
run 🔒
run_as 🔒
wait_for_teardown 🔒
Waits until no pane of this process holds agent uid’s lease, which its process releases as the last step of its teardown.
write_archive 🔒
Builds and writes the file: under the caller’s working folder, from a frozen read of the agent’s stores.