Skip to main content

Crate harn_session_store

Crate harn_session_store 

Source
Expand description

Durable Harn session-store primitive.

One source of truth for persisted agent/session events (Message, ToolCall, ToolResult, Plan, Compaction, SystemReminder, Hypothesis, Receipt, Reminder, PermissionDecision, plus arbitrary Custom shapes), snapshots, replay, fork/truncate, signed receipts (Ed25519 over canonical JSON), and retention. Server and host adapters can layer transport, auth, and product policy on top without reimplementing transcript storage semantics.

§Layout

  • event - event taxonomy and canonical JSON encoder
  • signing - Ed25519 chain hashes and receipt signatures
  • store - public SessionStore trait and shared types
  • memory - in-memory backend for tests and headless dev
  • sqlite - persistent SQLite backend for local/self-hosted use
  • retention - declarative per-tenant retention policy

Re-exports§

pub use event::canonical_event_bytes;
pub use event::canonical_json_bytes;
pub use event::AppendEvent;
pub use event::EventId;
pub use event::EventSignature;
pub use event::SessionEventKind;
pub use event::StoredEvent;
pub use memory::MemorySessionStore;
pub use retention::ArchiveSink;
pub use retention::RetentionPolicy;
pub use retention::SharedArchiveSink;
pub use retention::Tombstone;
pub use signing::chain_root_fold;
pub use signing::chain_root_hash;
pub use signing::chain_root_init;
pub use signing::compute_record_hash;
pub use signing::re_anchor_events;
pub use signing::verify_event;
pub use signing::verify_event_chain;
pub use signing::verify_receipt_root;
pub use signing::SessionSigner;
pub use signing::VerifyError;
pub use signing::ALGORITHM as SIGNATURE_ALGORITHM;
pub use sqlite::SqliteSessionStore;
pub use store::CreateSession;
pub use store::EventPage;
pub use store::ForkResult;
pub use store::ListFilter;
pub use store::ReadRange;
pub use store::SessionId;
pub use store::SessionMeta;
pub use store::SessionStatus;
pub use store::SessionStore;
pub use store::SharedSessionStore;
pub use store::Snapshot;
pub use store::SnapshotId;
pub use store::StoreError;
pub use store::StoreHooks;
pub use store::StoreResult;
pub use store::SweepReport;
pub use store::TruncateResult;
pub use store::VerifyFailure;
pub use store::VerifyReport;
pub use store::MAX_READ_BATCH;

Modules§

event
Session event taxonomy and canonical serialization.
memory
In-memory backend. Single-process, no persistence — but matches the public SessionStore contract exactly so the rest of the primitive can be exercised end-to-end in tests without touching disk.
retention
Per-tenant retention policy: lifecycle windows + archive sink hooks.
signing
Ed25519 signing for session event chains.
sqlite
SQLite-backed SessionStore.
store
SessionStore trait + the shared types every backend speaks.