huskies: merge 490_story_crdt_state_layer_backed_by_sqlite

CRDT state layer backed by SQLite for pipeline state. Integrates the
BFT JSON CRDT crate with SQLite persistence via sqlx. Ops are persisted
and replayed on startup. Node identity via Ed25519 keypair.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dave
2026-04-07 16:12:19 +00:00
parent c621bca7b1
commit c73153dd4e
8 changed files with 1990 additions and 69 deletions
+9 -5
View File
@@ -6,6 +6,7 @@ mod agent_log;
mod agents;
mod chat;
mod config;
pub mod crdt_state;
mod db;
mod http;
mod io;
@@ -283,7 +284,7 @@ async fn main() -> Result<(), std::io::Error> {
log_buffer::global().set_log_file(log_dir.join("server.log"));
}
// Initialise the SQLite pipeline shadow-write database.
// Initialise the SQLite pipeline shadow-write database and CRDT state layer.
// Clone the path out before the await so we don't hold the MutexGuard across
// an await point.
let pipeline_db_path = app_state
@@ -292,10 +293,13 @@ async fn main() -> Result<(), std::io::Error> {
.unwrap()
.as_ref()
.map(|root| root.join(".huskies").join("pipeline.db"));
if let Some(db_path) = pipeline_db_path
&& let Err(e) = db::init(&db_path).await
{
slog!("[db] Failed to initialise pipeline.db: {e}");
if let Some(ref db_path) = pipeline_db_path {
if let Err(e) = db::init(db_path).await {
slog!("[db] Failed to initialise pipeline.db: {e}");
}
if let Err(e) = crdt_state::init(db_path).await {
slog!("[crdt] Failed to initialise CRDT state layer: {e}");
}
}
let workflow = Arc::new(std::sync::Mutex::new(WorkflowState::default()));