Expand description
§aidaemon-store-sqlite
A SQLite implementation of aidaemon_core::RunStore: an append-only
event journal (run_events) plus the latest RunState snapshot per run
(run_states), with versioned migrations.
Beyond the trait, SqliteStore offers query helpers an application
needs after a restart: SqliteStore::interrupted_runs (waiting on a
human decision, settle with Agent::resume) and
SqliteStore::in_flight_runs (stopped mid tool batch, continue with
Agent::run_from).
With the channels feature, [SqliteApprovalStore] keeps a
ChannelRunner’s open approvals in the same database, so they survive a
restart (it is the crate that depends on aidaemon-channels, not the
other way round, so channels stay free of SQL).
With the client-events feature, [SqliteClientEventLog] is the Client
Gateway’s durable event log (resume by seq) and its remembered command
replies, in the same database.
maintenance keeps a long-lived database healthy: planner statistics
(maintenance::optimize) and consistent live copies
(maintenance::snapshot). Write transactions on a shared database
should begin with BEGIN IMMEDIATE (pool.begin_with("BEGIN IMMEDIATE")):
under WAL a deferred one that reads first fails when another connection
commits before it writes.
use std::sync::Arc;
use aidaemon_store_sqlite::SqliteStore;
let store = Arc::new(SqliteStore::open("runs.db").await?);
for state in store.in_flight_runs().await? {
// agent.run_from(state, CancellationToken::new()).await
}Modules§
- maintenance
- Upkeep for a long-lived SQLite database: query-planner statistics and consistent snapshots.
Structs§
- Migration
- One schema step.
- Sqlite
Store - SQLite-backed
RunStore. Cheap to clone (wraps a pool). - Stored
Event - One journal row as stored.
Enums§
- Error
- Errors from this crate. Converted to
StoreErrorat the trait boundary.
Constants§
- MIGRATIONS
- Every migration this build knows, in order.
Functions§
- erase_
session_ in_ tx - Erase every run of one session from the journal and the checkpoints, in
the caller’s transaction (a
/wipedeletes conversation text atomically). - latest_
version - The newest schema version this build understands.