feat: add session deletion with per-provider cleanup and path safety

Add delete_session Tauri command dispatching to provider-specific deletion
logic for all 5 providers (Claude, Codex, Gemini, OpenCode, OpenClaw).
Includes path traversal protection via canonicalize + starts_with validation,
session ID verification against file contents, frontend confirmation dialog
with optimistic cache updates, i18n keys (zh/en/ja), and component tests.
This commit is contained in:
Jason
2026-03-06 23:09:38 +08:00
parent e18db31752
commit 8c3f18a9bd
17 changed files with 1043 additions and 15 deletions
+17
View File
@@ -57,3 +57,20 @@ pub async fn launch_session_terminal(
Ok(true)
}
#[tauri::command]
pub async fn delete_session(
providerId: String,
sessionId: String,
sourcePath: String,
) -> Result<bool, String> {
let provider_id = providerId.clone();
let session_id = sessionId.clone();
let source_path = sourcePath.clone();
tauri::async_runtime::spawn_blocking(move || {
session_manager::delete_session(&provider_id, &session_id, &source_path)
})
.await
.map_err(|e| format!("Failed to delete session: {e}"))?
}