Skip to main content

Module bundle

Module bundle 

Source
Expand description

bundle.* MuxAPI handlers β€” the Armory Bundle Format (ABF) surface.

Module layout (split 2026-09-22): this file holds registration, the plain CRUD/validate/self_get handlers, and the helpers every family shares; each bundle.* family lives in its own child module. The children are glob-imported back here so that, exactly as when this was one file, any function can call any other without an import.

ModulesΒ§

components πŸ”’
Component plumbing shared by the per-agent export and import paths: purging dangling component refs, resolving a bundle’s components to their backing rows, and splicing history/instructions/memory into a manifest.
export πŸ”’
bundle.export: serialise one stored bundle to an ABF archive.
export_for_agent πŸ”’
bundle.export_for_agent / bundle.export_for_agent_with_history: build an ABF from a live agent definition, optionally with its session history under the size budgets defined here.
import πŸ”’
bundle.import, bundle.import.preview, bundle.import.commit: the ABF file/bytes intake path, its size and warning budgets, and the two-phase preview/commit flow.
import_for_agent πŸ”’
bundle.import_for_agent: apply an ABF to an existing agent definition, serialised per agent by bundle_import_for_agent_lock.

StructsΒ§

AgentProjectInstructionFile πŸ”’
One file in agent.project_instructions: a resolved ProjectInstructionFile, plus how it compares to the last launch’s observation of it.
AgentProjectInstructionsReq πŸ”’
AgentProjectInstructionsResponse πŸ”’
Response for agent.project_instructions.
BundleGetReq πŸ”’
BundleListItem πŸ”’
One bundle.list row: a bundle’s summary fields, not the whole bundle.
BundleListResponse πŸ”’
Response for bundle.list: the same rows under both keys (see bundle_list_impl).
BundleSelfGetReq πŸ”’
RequirementResolution πŸ”’
Read-only account-requirement resolution (spec Β§4.5) β€” one identity lookup per DISTINCT provider, not per requirement row (codex P1, PR #2379 round 4: bundle_import.rs bounds the requirements array length, but even at that bound many rows commonly share a handful of providers). Extracted here (Phase 3 spec Β§3.1’s account-resolution implementation note) so the existing bundle.import route and the new bundle.import.preview/.commit handlers share the exact same resolution logic rather than duplicating it in a second place where it could drift. Full, untruncated values β€” callers apply the shared bounded-display projection (bounded_display) to id/provider/env before ever serializing these into an RPC response (Phase 3 spec Β§3.1, round 11).

EnumsΒ§

SelfOwner πŸ”’
The agent a self-scoped MuxAPI call is about β€” whose personal memory (memory.*, M4c-2b), linked accounts (identity.self.accounts, identity.account.validate), bound preset (preset.get self) and history (history.search, M4c-2c) β€” identity spec Β§6.5.9.

StaticsΒ§

BUNDLE_IMPORT_FOR_AGENT_LOCKS πŸ”’
Per-agent async lock serializing bundle.import_for_agent’s β€œcheck zero existing memory rows, then write” sequence β€” ABF v0.2 Β§2.3, reagent P2 on PR #2527. Mirrors agent_open.rs’s AGENT_OPEN_LOCKS precedent exactly, including its scope note: this only serializes calls handled by THIS process, not a genuinely different AgentMux instance/channel racing the same agent_id.

FunctionsΒ§

bounded_display πŸ”’
Shared bounded-display projection (Phase 3 spec, round 12’s governing rule) for every β€œmeant to be short” field both preview and commit echo back: skill slug/description, requirement id/provider/env, context-file display_path, bundle description, and commit’s skipped_skills/resolved_requirement_ids entries. bundle.name is NOT projected through this β€” it’s bounded at parse time instead (round 13), since it’s re-submitted verbatim as bundle_name.
bundle_get_impl πŸ”’
bundle_import_for_agent_lock πŸ”’
bundle_list_impl πŸ”’
bundle_self_get_by_memory_id πŸ”’
The bundle memory_id names, or the blank singleton when none is bound.
bundle_self_get_impl πŸ”’
bundle_validate_impl πŸ”’
Structurally validate a bundle draft β€” ABF UI-alignment pass. Takes the SAME payload shape bundle.upsert accepts (reuses its normalize_bundle_upsert_input), not just an id, so the Memory β†’ Bundles editor’s β€œValidate” button can check an unsaved draft (including a brand-new bundle with no id yet) rather than only whatever was last persisted.
normalize_bundle_upsert_input πŸ”’
Normalize a bundle.upsert request body into the shape the Bundle struct deserializes from, so MuxAPI accepts the request exactly as documented in the spec:
register
register_agent_project_instructions πŸ”’
agent.project_instructions β€” what this agent will actually read.
register_bundle_delete πŸ”’
register_bundle_get πŸ”’
register_bundle_list πŸ”’
register_bundle_self_get πŸ”’
register_bundle_upsert πŸ”’
register_bundle_validate πŸ”’
resolve_account_requirements πŸ”’
resolve_agent_for_s1 πŸ”’
Resolve the agent definition behind an S1-authenticated agent_id.