feat(backend): implement Phase 1 of Intelligence Layer Migration

- Add SQLite-based persistent memory storage (persistent.rs)
- Create memory persistence Tauri commands (memory_commands.rs)
- Add sqlx dependency to Cargo.toml for SQLite support
- Update memory module to export new persistent types
- Register memory commands in Tauri invoke handler
- Add comprehensive migration plan document

Phase 1 delivers:
- PersistentMemory struct with SQLite storage
- MemoryStoreState for Tauri state management
- 10 memory commands: init, store, get, search, delete,
  delete_all, stats, export, import, db_path
- Full-text search capability
- Cross-session memory retention

Reference: docs/plans/INTELLIGENCE-LAYER-MIGRATION.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-03-21 00:36:06 +08:00
parent 48a430fc97
commit 0db8a2822f
7 changed files with 1633 additions and 11 deletions

View File

@@ -18,6 +18,9 @@ mod browser;
// Secure storage module for OS keyring/keychain
mod secure_storage;
// Memory commands for persistent storage
mod memory_commands;
use serde::Serialize;
use serde_json::{json, Value};
use std::fs;
@@ -1294,9 +1297,13 @@ pub fn run() {
// Initialize browser state
let browser_state = browser::commands::BrowserState::new();
// Initialize memory store state
let memory_state: memory_commands::MemoryStoreState = std::sync::Arc::new(tokio::sync::Mutex::new(None));
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
.manage(browser_state)
.manage(memory_state)
.invoke_handler(tauri::generate_handler![
// OpenFang commands (new naming)
openfang_status,
@@ -1372,7 +1379,18 @@ pub fn run() {
secure_storage::secure_store_set,
secure_storage::secure_store_get,
secure_storage::secure_store_delete,
secure_storage::secure_store_is_available
secure_storage::secure_store_is_available,
// Memory persistence commands (Phase 1 Intelligence Layer Migration)
memory_commands::memory_init,
memory_commands::memory_store,
memory_commands::memory_get,
memory_commands::memory_search,
memory_commands::memory_delete,
memory_commands::memory_delete_all,
memory_commands::memory_stats,
memory_commands::memory_export,
memory_commands::memory_import,
memory_commands::memory_db_path
])
.run(tauri::generate_context!())
.expect("error while running tauri application");