mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-09-01 00:59:33 +00:00
feat: add libSQL/Turso database backend with full feature parity
Introduce a Database trait abstraction (~60 async methods) enabling compile-time backend selection between PostgreSQL and libSQL/Turso. Convert all modules from concrete Store to Arc<dyn Database>, add LibSqlSecretsStore and LibSqlWasmToolStore implementations, wire libsql stores throughout CLI and main entry points, and make the setup wizard backend-agnostic. Key changes: - src/db/: Database trait, PostgresDatabase adapter, LibSqlBackend with native SQLite-dialect SQL, and idempotent migration system - src/secrets/store.rs: LibSqlSecretsStore (all 8 trait methods) - src/tools/wasm/storage.rs: LibSqlWasmToolStore (all 7 trait methods) - src/main.rs, cli/tool.rs, cli/mcp.rs: backend-conditional wiring - src/setup/channels.rs: SecretsContext uses Arc<dyn SecretsStore> - Feature-gate postgres-only tests and examples Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
@@ -19,18 +19,18 @@ use crate::agent::routine::{
|
||||
};
|
||||
use crate::agent::routine_engine::RoutineEngine;
|
||||
use crate::context::JobContext;
|
||||
use crate::history::Store;
|
||||
use crate::db::Database;
|
||||
use crate::tools::tool::{Tool, ToolError, ToolOutput};
|
||||
|
||||
// ==================== routine_create ====================
|
||||
|
||||
pub struct RoutineCreateTool {
|
||||
store: Arc<Store>,
|
||||
store: Arc<dyn Database>,
|
||||
engine: Arc<RoutineEngine>,
|
||||
}
|
||||
|
||||
impl RoutineCreateTool {
|
||||
pub fn new(store: Arc<Store>, engine: Arc<RoutineEngine>) -> Self {
|
||||
pub fn new(store: Arc<dyn Database>, engine: Arc<RoutineEngine>) -> Self {
|
||||
Self { store, engine }
|
||||
}
|
||||
}
|
||||
@@ -277,11 +277,11 @@ impl Tool for RoutineCreateTool {
|
||||
// ==================== routine_list ====================
|
||||
|
||||
pub struct RoutineListTool {
|
||||
store: Arc<Store>,
|
||||
store: Arc<dyn Database>,
|
||||
}
|
||||
|
||||
impl RoutineListTool {
|
||||
pub fn new(store: Arc<Store>) -> Self {
|
||||
pub fn new(store: Arc<dyn Database>) -> Self {
|
||||
Self { store }
|
||||
}
|
||||
}
|
||||
@@ -351,12 +351,12 @@ impl Tool for RoutineListTool {
|
||||
// ==================== routine_update ====================
|
||||
|
||||
pub struct RoutineUpdateTool {
|
||||
store: Arc<Store>,
|
||||
store: Arc<dyn Database>,
|
||||
engine: Arc<RoutineEngine>,
|
||||
}
|
||||
|
||||
impl RoutineUpdateTool {
|
||||
pub fn new(store: Arc<Store>, engine: Arc<RoutineEngine>) -> Self {
|
||||
pub fn new(store: Arc<dyn Database>, engine: Arc<RoutineEngine>) -> Self {
|
||||
Self { store, engine }
|
||||
}
|
||||
}
|
||||
@@ -474,12 +474,12 @@ impl Tool for RoutineUpdateTool {
|
||||
// ==================== routine_delete ====================
|
||||
|
||||
pub struct RoutineDeleteTool {
|
||||
store: Arc<Store>,
|
||||
store: Arc<dyn Database>,
|
||||
engine: Arc<RoutineEngine>,
|
||||
}
|
||||
|
||||
impl RoutineDeleteTool {
|
||||
pub fn new(store: Arc<Store>, engine: Arc<RoutineEngine>) -> Self {
|
||||
pub fn new(store: Arc<dyn Database>, engine: Arc<RoutineEngine>) -> Self {
|
||||
Self { store, engine }
|
||||
}
|
||||
}
|
||||
@@ -551,11 +551,11 @@ impl Tool for RoutineDeleteTool {
|
||||
// ==================== routine_history ====================
|
||||
|
||||
pub struct RoutineHistoryTool {
|
||||
store: Arc<Store>,
|
||||
store: Arc<dyn Database>,
|
||||
}
|
||||
|
||||
impl RoutineHistoryTool {
|
||||
pub fn new(store: Arc<Store>) -> Self {
|
||||
pub fn new(store: Arc<dyn Database>) -> Self {
|
||||
Self { store }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user