Expand description
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.
Structsยง
- Bundle
Import ๐Req - Bundle
Import ๐Response - Response for
bundle.import. - Resolved
Import ๐Input - The outcome of resolving one of
file_path/zip_base64/filesinto intake-ready files plus the Phase 3 content digest (ยง3.0.5) โ shared bybundle.import.previewand.commitso both compute the digest identically. The mode tag baked intocontent_digest(round 7) means a plain digest-equality check at commit is sufficient to enforce โsame input mode as previewโ (round 6) โ no separate mode field is needed.
Constantsยง
- MAX_
ABF_ ๐FILE_ SIZE_ BYTES - On-disk size ceiling for
file_pathinput (Phase 3 spec ยง3.0.5, rounds 4/5) โ generous headroom aboveMAX_TOTAL_UNCOMPRESSED_BYTESโs 50 MiB for compression/container overhead and imperfectly-compressed content. - MAX_
PROJECT_ ๐INSTRUCTION_ PREVIEW_ CHARS - Final combined-list bound applied to a preview/commit responseโs
warnings(Phase 3 spec ยง3.1 round 8 / round 9โs commit-response generalization) โ cheap defense-in-depth over an already per-source-bounded list (each ofresolve_import_inputโs intake warnings andparse_bundle_import_with_budgetโs own warnings is already individually bounded; concatenating two independently-bounded lists can still exceed either bound alone, so one more pass caps the combined total before itโs ever serialized). Per-entry content cap forproject_instructionsin an import preview.
Functionsยง
- bound_
warnings_ ๐for_ response - bundle_
import ๐ bundle.importโ ABF importer, Phase 2 of docs/specs/SPEC_ABF_V0_1_SINGLE_FILE_AND_IMPORTER_2026_08_01.md. Window- scoped likebundle.export(bundles arenโt agent-specific). Accepts EITHERzip_base64(a.abfarchive, mirroringbundle.exportโs ownzip_base64response field) ORfiles(a raw[{path, content}]list) โ exactly one must be present. Hands the bytes to the purebundle_importmodule for parsing/validation, then owns every Store side-effect: creates the bundle row, creates one global Skill row per parsed skill, and performs READ-ONLY account-requirement lookups (never creates an account, never writes a secret anywhere โ see the specโs ยง4.5 correction for why this stopped short of โresolvingโ placeholders in place).- bundle_
import_ ๐commit_ impl bundle.import.commitโ Phase 3 ยง3.2. Re-resolves and re-parses the same input fresh (never trusts client-supplied preview data for anything written), rejects on a content-digest mismatch, then writes only the selected items. Sharesbundle.importโs existing skill-write/ rollback logic; the differences are selection filtering, thebundle_name/import_asoverrides, and the digest gate. Extracted from the RPC closure into a directly-callable, directly-testable function (the closure itself only deserializes the request and forwards).- bundle_
import_ ๐intake - Parses the two intake shapes of
bundle.importโzip_base64or a rawfileslist, exactly one โ into the file list plus the intake warnings. - bundle_
import_ ๐preview_ impl bundle.import.previewโ Phase 3 of docs/specs/SPEC_ABF_IMPORT_UI_PHASE3_2026_08_02.md ยง3.1. Pure parse plus read-only collision/name-collision lookups โ zero Store writes. Window- scoped like the rest ofbundle.*. Extracted from the RPC closure into a directly-callable, directly-testable function (the closure itself only deserializes the request and forwards).- commit_
bundle_ ๐row - The bundle row a commit writes: the parsed bundle with only the selected components.
- context_
file_ ๐previews - create_
global_ ๐skills - Skills โ global, not bound to any agent (mirrors
skill.catalog.upsertโs own is_global: true convention for
a shared-resource creation path). A genuine name
conflict (the ONLY intentional business error
skill_upsert_unique_globalreturns โStoreError::Othercontaining โalready existsโ) is a per-skill warning, not an aborted import. Codex P2, PR #2379: any OTHER error (locked/corrupt store, I/O failure) previously hit this same arm and was silently treated as a skip too โ turning an infrastructure failure into an apparently-successful lossy import. Only the confirmed-conflict shape is swallowed; anything else aborts the whole RPC. - dedupe_
skill_ ๐selections - The selections to import: the client-supplied
include_skillshas no length cap and no dedup by source_dir, so an unbounded or repeated array could otherwise drive an unbounded number of skill_upsert_unique_global writes regardless of how many skills the archive itself parsed to (parsed.skills is already bounded by MAX_IMPORTED_SKILLS). First occurrence wins per source_dir, then the list is capped at the same MAX_IMPORTED_SKILLS the parser enforces. - import_
selected_ ๐skills - Write the selected skills as global skills and return the ids created. A skill whose slug collides and has no non-empty rename is skipped; a name conflict at write time is a warning and a skip; any other write error rolls back the skills already created and fails the commit.
- imported_
bundle_ ๐row - The bundle row a parsed import becomes.
- install_
bundle_ ๐widgets - After a commit: copy in the chosen widgets and ask the user to approve
each, the way an agentโs
WidgetInstalldoes. The archive is read again and held to the digest the user previewed, so what installs is what they saw (SPEC_WIDGET_SHARING_2026_10_10.md ยง3.3). A bundle never approves a widget. - mcp_
server_ ๐previews - preview_
commit_ ๐warning_ budget - Bounded warning budget shared by
bundle.import.preview/.commit(Phase 3 spec ยง3.1, round 11) โ unlike the existingbundle.importrouteโs effectively-unbounded budget, preserved unchanged above. - preview_
widgets ๐ - The import previewโs line for each widget the bundle carries.
- project_
instruction_ ๐previews - Phase 3, Codex P1 on PR #3163. Read-only: this is what the SOURCE agent
was reading, and
bundle.import.commithas no counterpart field โ the entries exist to be looked at, never to be written into the importing repository (spec ยง5.2). Each content is bounded the same wayinstructions_previewis, since a snapshot can be an arbitrarily large repository file and the response carries up to MAX_IMPORTED_PROJECT_INSTRUCTIONS of them. - read_
abf_ ๐file_ path - Reads a
file_pathinput server-side (Phase 3 spec ยง3.0.5). Opens the path with a no-follow mechanism so a symlink fails to open at all rather than being silently resolved to its target (round 6) โ one handle, one continuous read, no second path resolution for anything to race against (round 5โs TOCTOU fix): metadata comes from that SAME open handle and is checked againstMAX_ABF_FILE_SIZE_BYTESBEFORE any read (round 4); the actual read is still hard-bounded via.take(...)regardless of what the metadata claimed. - register_
bundle_ ๐import - register_
bundle_ ๐import_ commit - register_
bundle_ ๐import_ preview - requirement_
previews ๐ - resolve_
import_ ๐input - rollback_
skill_ ๐rows - Delete the skill rows a failed commit already created; returns one message per row that would not delete.
- rollback_
skills ๐ - codex P2, PR #2379 round 4: rollback previously discarded
every skill_delete error via
let _ = ..., so if the SAME failing store also rejects the cleanup deletes, previously- inserted global skills could silently survive an RPC that reports failure. No transaction primitive exists on Store today, so full atomicity is out of scope here; surfacing the rollback failure instead of swallowing it is the fix that fits โ the caller at least learns cleanup itself may not have fully succeeded. - skill_
previews ๐ - Skill collision detection (ยง3.1, two-pass): against the skills already installed, and among the bundleโs own.
- split_
requirements ๐ - The commit responseโs requirement lists, using the same bounded-display projection as preview.
- split_
widgets ๐ - Takes a zipโs widget entries out of the text files and their warnings, and reads them as bytes instead.