Skip to main content

Module bundle_versions

Module bundle_versions 

Source
Expand description

Append-only version history for Global Memory entry content — mirrors agent_native_memory_versions.rs’s shape exactly, adapted for a single bundle_id key instead of that table’s composite (agent_id, filename) (a Bundle’s identity is already a single id). See docs/specs/SPEC_AGENT_FACING_GLOBAL_MEMORY_API_2026_09_15.md Phase 0 — Global Memory (db_bundles) previously had no audit trail at all, only updated_at; this exists specifically because Global Memory is about to gain a write path an agent, not just a human in Memory, can reach.

The WRITE side (bundle_version_insert, called via Store::bundle_upsert_with_version in bundles.rs on every globalmemory.write AND Memory → Global’s own upsertmemory save path) and the READ side (bundle_version_list/bundle_version_get, called by global_memory_history_impl/global_memory_diff_impl/ global_memory_revert_impl in app_api/mod.rs, backing the GlobalMemoryHistory/GlobalMemoryDiff/GlobalMemoryRevert MCP tools) are both wired into the agent-facing MCP surface now — see docs/specs/SPEC_AGENT_FACING_GLOBAL_MEMORY_API_2026_09_15.md. No Memory pane surface for this yet — that remains out of scope (MCP/REST only, per that spec’s own non-goals).

Structs§

BundleVersion
One version of one bundle’s Global Memory content, including its full name/instructions. Deliberately no serde derives, same as NativeMemoryVersion — a wire type belongs in rpc_types, not here.
BundleVersionSummary
A version’s metadata without its full name/instructions — the list-view shape.

Functions§

bundle_version_insert_tx 🔒
Appends a version row within an ALREADY-OPEN transaction — the shared implementation both Store::bundle_version_insert below (opens its own transaction) and Store::bundle_upsert_with_version (bundles.rs, reuses the SAME transaction as its own db_bundles write, so the bundle row and its version can never observably diverge under a concurrent writer — codex P2, PR #3237) call, rather than duplicating the parent-chain-lookup + INSERT SQL in two places. pub(crate), not private: bundles.rs is a sibling module in this same crate, not this one.
content_hash 🔒
Hashes name + instructions together (not instructions alone) — unlike native memory, where a version’s whole identity IS its content, a bundle’s name is content too (renaming a Global Memory entry without touching its body is a real, meaningful edit an operator or agent might make, and should still produce a new version + a changed hash).