harn_session_store/lib.rs
1//! Durable Harn session-store primitive.
2//!
3//! One source of truth for persisted agent/session events (`Message`,
4//! `ToolCall`, `ToolResult`, `Plan`, `Compaction`, `SystemReminder`,
5//! `Hypothesis`, `Receipt`, `Reminder`, `PermissionDecision`, plus
6//! arbitrary `Custom` shapes), snapshots, replay, fork/truncate, signed
7//! receipts (Ed25519 over canonical JSON), and retention. Server and host
8//! adapters can layer transport, auth, and product policy on top without
9//! reimplementing transcript storage semantics.
10//!
11//! ## Layout
12//!
13//! - [`event`] - event taxonomy and canonical JSON encoder
14//! - [`signing`] - Ed25519 chain hashes and receipt signatures
15//! - [`store`] - public `SessionStore` trait and shared types
16//! - [`memory`] - in-memory backend for tests and headless dev
17//! - [`sqlite`] - persistent SQLite backend for local/self-hosted use
18//! - [`retention`] - declarative per-tenant retention policy
19
20pub mod event;
21pub mod memory;
22pub(crate) mod memory_helpers;
23pub mod retention;
24pub mod signing;
25pub mod sqlite;
26pub mod store;
27
28pub use event::{
29 canonical_event_bytes, canonical_json_bytes, AppendEvent, EventId, EventSignature,
30 SessionEventKind, StoredEvent,
31};
32pub use memory::MemorySessionStore;
33pub use retention::{ArchiveSink, RetentionPolicy, SharedArchiveSink, Tombstone};
34pub use signing::{
35 chain_root_fold, chain_root_hash, chain_root_init, compute_record_hash, re_anchor_events,
36 verify_event, verify_event_chain, verify_receipt_root, SessionSigner, VerifyError,
37 ALGORITHM as SIGNATURE_ALGORITHM,
38};
39pub use sqlite::SqliteSessionStore;
40pub use store::{
41 CreateSession, EventPage, ForkResult, ListFilter, ReadRange, SessionId, SessionMeta,
42 SessionStatus, SessionStore, SharedSessionStore, Snapshot, SnapshotId, StoreError, StoreHooks,
43 StoreResult, SweepReport, TruncateResult, VerifyFailure, VerifyReport, MAX_READ_BATCH,
44};