Skip to main content

nexo_memory_snapshot/
lib.rs

1//! Atomic point-in-time agent memory snapshots.
2//!
3//! Captures a verifiable bundle of:
4//!
5//! - Git-backed memory dir (`memdir/`) as a `git bundle`
6//! - SQLite tables produced by the memory crate: `long_term`, `vector`,
7//!   `concepts`, `compactions`
8//! - Extractor cursor + last `dream_run` registry row
9//!
10//! The bundle is a `tar.zst` archive sealed with a SHA-256 manifest. An
11//! optional `age` encryption layer is available behind the
12//! `snapshot-encryption` Cargo feature; the manifest itself stays
13//! plaintext so integrity can be verified without the identity.
14//!
15//! The crate ships:
16//!
17//! - [`MemorySnapshotter`] — trait every backend implements.
18//! - [`SnapshotRequest`] / [`RestoreRequest`] — call inputs.
19//! - [`SnapshotMeta`] / [`RestoreReport`] / [`SnapshotDiff`] /
20//!   [`VerifyReport`] — public output shapes (also wire-shape for
21//!   NATS lifecycle events and CLI JSON).
22//! - [`Manifest`] — on-disk bundle header.
23//! - [`SnapshotError`] — typed error class with stable variants.
24//!
25//! See `docs/src/ops/memory-snapshot.md` for the operator surface.
26
27#![cfg_attr(docsrs, feature(doc_cfg))]
28
29pub mod codec;
30pub mod config;
31pub mod dream_adapter;
32pub mod error;
33pub mod events;
34pub mod git_capture;
35pub mod id;
36pub mod local_fs;
37pub mod manifest;
38pub mod memdir;
39pub mod meta;
40pub mod metrics;
41pub mod path_resolver;
42pub mod redaction;
43pub mod request;
44pub mod retention;
45pub mod snapshotter;
46pub mod sqlite_backup;
47pub mod state_capture;
48pub mod tenant_path;
49
50pub use config::{EncryptionSection, EventsSection, MemorySnapshotConfig, RetentionSection};
51pub use dream_adapter::{MemoryMutationPublisher, PreDreamSnapshotAdapter};
52pub use error::SnapshotError;
53pub use events::{
54    EventPublisher, LifecycleEvent, MutationEvent, MutationOp, MutationScope, NoopPublisher,
55    LIFECYCLE_SUBJECT_PREFIX, MUTATION_SUBJECT_PREFIX,
56};
57pub use id::{AgentId, SnapshotId};
58pub use manifest::{
59    ArtifactKind, ArtifactMeta, EncryptionMeta, GitMeta, Manifest, RedactionReport, SchemaVersions,
60    ToolVersions, BUNDLE_FORMAT, MANIFEST_VERSION,
61};
62pub use meta::{
63    GitDiffSummary, RestoreReport, SnapshotDiff, SnapshotMeta, SqliteDiffSummary, StateDiffSummary,
64    VerifyReport,
65};
66pub use path_resolver::{ClosureResolver, DefaultPathResolver, PathResolver};
67pub use redaction::{DefaultRedactionPolicy, RedactionPass, RedactionPolicy};
68pub use request::{DecryptionIdentity, EncryptionKey, RestoreRequest, SnapshotRequest};
69pub use retention::{RetentionConfig, RetentionTickReport, RetentionWorker};
70pub use snapshotter::MemorySnapshotter;