refactor(desktop): ChatStore structured split + IDB persistence + stream cancel
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Split monolithic chatStore.ts (908 lines) into 4 focused stores: - chatStore.ts: facade layer, owns messages[], backward-compatible selectors - conversationStore.ts: conversation CRUD, agent switching, IndexedDB persistence - streamStore.ts: streaming orchestration, chat mode, suggestions - messageStore.ts: token tracking Key fixes from 3-round deep audit: - C1: Fix Rust serde camelCase vs TS snake_case mismatch (toolStart/toolEnd/iterationStart) - C2: Fix IDB async rehydration race with persist.hasHydrated() subscribe - C3: Add sessionKey to partialize to survive page refresh - H3: Fix IDB migration retry on failure (don't set migrated=true in catch) - M3: Fix ToolCallStep deduplication (toolStart creates, toolEnd updates) - M-NEW-2: Clear sessionKey on cancelStream Also adds: - Rust backend stream cancellation via AtomicBool + cancel_stream command - IndexedDB storage adapter with one-time localStorage migration - HMR cleanup for cross-store subscriptions
This commit is contained in:
@@ -110,6 +110,7 @@ impl From<zclaw_hands::HandResult> for HandResult {
|
||||
///
|
||||
/// Returns hands from the Kernel's HandRegistry.
|
||||
/// Hands are registered during kernel initialization.
|
||||
// @connected
|
||||
#[tauri::command]
|
||||
pub async fn hand_list(
|
||||
state: State<'_, KernelState>,
|
||||
@@ -128,6 +129,7 @@ pub async fn hand_list(
|
||||
/// Executes a hand with the given ID and input.
|
||||
/// If the hand has `needs_approval = true`, creates a pending approval instead.
|
||||
/// Returns the hand result as JSON, or a pending status with approval ID.
|
||||
// @connected
|
||||
#[tauri::command]
|
||||
pub async fn hand_execute(
|
||||
state: State<'_, KernelState>,
|
||||
@@ -190,6 +192,7 @@ pub async fn hand_execute(
|
||||
/// When approved, the kernel's `respond_to_approval` internally spawns the Hand
|
||||
/// execution. We additionally emit Tauri events so the frontend can track when
|
||||
/// the execution finishes.
|
||||
// @connected
|
||||
#[tauri::command]
|
||||
pub async fn hand_approve(
|
||||
app: AppHandle,
|
||||
@@ -292,6 +295,7 @@ pub async fn hand_approve(
|
||||
}
|
||||
|
||||
/// Cancel a hand execution
|
||||
// @connected
|
||||
#[tauri::command]
|
||||
pub async fn hand_cancel(
|
||||
state: State<'_, KernelState>,
|
||||
@@ -330,6 +334,7 @@ pub async fn hand_cancel(
|
||||
// ============================================================
|
||||
|
||||
/// Get detailed info for a single hand
|
||||
// @connected
|
||||
#[tauri::command]
|
||||
pub async fn hand_get(
|
||||
state: State<'_, KernelState>,
|
||||
@@ -348,6 +353,7 @@ pub async fn hand_get(
|
||||
}
|
||||
|
||||
/// Get status of a specific hand run
|
||||
// @connected
|
||||
#[tauri::command]
|
||||
pub async fn hand_run_status(
|
||||
state: State<'_, KernelState>,
|
||||
@@ -375,6 +381,7 @@ pub async fn hand_run_status(
|
||||
}
|
||||
|
||||
/// List run history for a hand (or all hands)
|
||||
// @connected
|
||||
#[tauri::command]
|
||||
pub async fn hand_run_list(
|
||||
state: State<'_, KernelState>,
|
||||
@@ -409,6 +416,7 @@ pub async fn hand_run_list(
|
||||
}
|
||||
|
||||
/// Cancel a running hand execution
|
||||
// @reserved: 暂无前端集成
|
||||
#[tauri::command]
|
||||
pub async fn hand_run_cancel(
|
||||
state: State<'_, KernelState>,
|
||||
|
||||
Reference in New Issue
Block a user