Module agent_bundle
Expand description
Agent bundle export planning.
An agent bundle is a portable directory describing one agent:
<bundle>/
zeroclaw-agent.toml — manifest (format version, root alias, provenance,
required secrets, carried skill bundles,
dropped refs, risk flags)
config.toml — the config closure this agent needs
workspace/ — the agent's workspace tree
skills/<alias>/ — content of each referenced skill bundle, which
lives outside the workspace on the source hostThis module owns the planning half: given a live Config and an agent
alias, it computes the transitive config closure, strips credentials and
host-specific state, and reports what an operator on the receiving end
would be accepting. It performs no I/O — materializing the plan onto disk
is the caller’s job — which keeps the security-relevant logic unit-testable
without a filesystem.
The closure is deliberately narrow. An agent entry references providers,
profiles, bundles, MCP servers, channels, cron jobs and sibling agents; only
the subset that can be meaningfully reconstituted on a different install is
carried, and everything omitted is reported in ExportPlan::dropped
rather than silently disappearing.
Re-exports§
pub use crate::paths::MEMORY_SNAPSHOT_FILE;
Structs§
- Dropped
Ref - One omitted piece of configuration.
- Export
Plan - A computed export, ready to be written to disk.
- Provenance
- Provenance recorded in the manifest. Supplied by the caller so the planner stays a pure function of the config.
- Risk
Flag - One flagged capability, bound to the config path that grants it.
- Skill
Bundle Source - One skill bundle’s content to carry, resolved to a source directory.
- Source
Boundaries - How the copy reaches each kind of source, and what that proves.
Enums§
- Drop
Reason - Why a piece of the agent’s configuration was left out of the bundle.
- Export
Error - Risk
Kind - A capability in the bundle that widens the target install’s trust boundary.
Constants§
- BUNDLE_
FORMAT_ VERSION - Bundle format version written to (and expected in) the manifest.
- CONFIG_
FILE - Config-fragment filename inside a bundle directory.
- MANIFEST_
FILE - Manifest filename inside a bundle directory.
- SKILLS_
DIR - Directory inside a bundle holding carried skill-bundle content, one
subdirectory per skill-bundle alias. Skills live under the install-wide
<install>/shared/skills/tree rather than the agent’s workspace, so carrying the config alone would import an agent whose skills are missing. - WORKSPACE_
DIR - Workspace directory name inside a bundle directory.
- WORKSPACE_
MEMORY_ DIR - Workspace subdirectory holding the agent’s private memory store. Never
carried by bundle format 1 — see
plan_export.
Functions§
- access_
mode_ label - Cross-agent access modes present in a bundle, for the import-side report. Exposed so the importer can describe grants without re-deriving them.
- is_
safe_ path_ component - Whether
aliasis safe to use as one path component inside a bundle. - plan_
export - Compute the export closure for
alias. - record_
missing_ identity_ document - Record that the workspace copy did not carry the identity document the closure references, and drop the reference.
- record_
missing_ skill_ content - Record that
missingskill bundles contributed no content to the bundle. - render_
config_ toml - Render the closure as the bundle’s
config.toml. - render_
manifest - Build the bundle manifest table.
- render_
manifest_ toml - Render the manifest as the bundle’s
zeroclaw-agent.toml. - workspace_
entry_ included - Whether a workspace-relative path should be copied into the bundle.