Skip to main content

Module agent_bundle

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 host

This 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§

DroppedRef
One omitted piece of configuration.
ExportPlan
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.
RiskFlag
One flagged capability, bound to the config path that grants it.
SkillBundleSource
One skill bundle’s content to carry, resolved to a source directory.
SourceBoundaries
How the copy reaches each kind of source, and what that proves.

Enums§

DropReason
Why a piece of the agent’s configuration was left out of the bundle.
ExportError
RiskKind
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 alias is 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 missing skill 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.