feat: another wave of features #61

Merged
naomi merged 11 commits from feat/more-things into main 2026-01-23 19:07:23 -08:00
2 changed files with 12 additions and 8 deletions
Showing only changes of commit 4971f2c436 - Show all commits
+6 -6
View File
@@ -29,7 +29,7 @@ impl BridgeManager {
conversation_id: &str,
options: ClaudeStartOptions,
) -> Result<(), String> {
// Check if a bridge already exists for this conversation
// Check if a bridge already exists and is running for this conversation
if self.bridges.get(conversation_id).map(|b| b.is_running()).unwrap_or(false) {
return Err("Claude is already running for this conversation".to_string());
}
@@ -38,15 +38,15 @@ impl BridgeManager {
.ok_or_else(|| "App handle not set".to_string())?
.clone();
// Create a new bridge for this conversation
let mut bridge = WslBridge::new_with_conversation_id(conversation_id.to_string());
// Reuse existing bridge if it exists (preserves stats across reconnects)
// Only create a new bridge if one doesn't exist for this conversation
let bridge = self.bridges
.entry(conversation_id.to_string())
.or_insert_with(|| WslBridge::new_with_conversation_id(conversation_id.to_string()));
// Start the Claude process
bridge.start(app, options)?;
// Store the bridge
self.bridges.insert(conversation_id.to_string(), bridge);
Ok(())
}
+6 -2
View File
@@ -292,8 +292,8 @@ impl WslBridge {
self.stdin = stdin;
self.process = Some(child);
// Reset session stats when starting new session
self.stats.write().reset_session();
// Note: We no longer reset stats here - stats persist across reconnects
// Stats are only reset when explicitly disconnecting via stop()
// Load saved achievements
let app_handle = app.clone();
@@ -411,6 +411,10 @@ impl WslBridge {
self.stdin = None;
self.session_id = None;
self.mcp_config_file = None; // Temp file is automatically deleted when dropped
// Reset session stats on explicit disconnect
self.stats.write().reset_session();
emit_connection_status(app, ConnectionStatus::Disconnected, self.conversation_id.clone());
}