feat: implement resumable Claude sessions with background execution (#93)

This comprehensive update adds support for resumable Claude Code sessions that can run in the background and be resumed later. Key improvements include:

Backend enhancements:
- Enhanced ProcessRegistry to track both agent runs and Claude sessions
- Added new Tauri commands: list_running_claude_sessions, get_claude_session_output
- Improved Claude process management with proper session ID extraction and lifecycle handling
- Enhanced cancellation logic with registry-based process killing and fallback mechanisms
- Added live output capture and storage for session persistence

Frontend improvements:
- New RunningClaudeSessions component to display and manage active sessions
- Added streaming state management and session tracking in App component
- Implemented navigation protection when Claude is actively streaming
- Enhanced ClaudeCodeSession component with streaming callbacks and session management

Configuration updates:
- Updated .gitignore to exclude documentation files (AGENTS.md, CLAUDE.md, *_TASK.md)

This feature enables users to start Claude sessions, navigate away while Claude continues processing, and resume sessions later from the Projects view, significantly improving the user experience for long-running AI interactions.
This commit is contained in:
Mufeed VH
2025-07-02 18:07:14 +05:30
committed by GitHub
parent 4fb6fd5159
commit e8c54d7fad
9 changed files with 637 additions and 100 deletions

View File

@@ -1,5 +1,21 @@
import { invoke } from "@tauri-apps/api/core";
/** Process type for tracking in ProcessRegistry */
export type ProcessType =
| { AgentRun: { agent_id: number; agent_name: string } }
| { ClaudeSession: { session_id: string } };
/** Information about a running process */
export interface ProcessInfo {
run_id: number;
process_type: ProcessType;
pid: number;
started_at: string;
project_path: string;
task: string;
model: string;
}
/**
* Represents a project in the ~/.claude/projects directory
*/
@@ -1045,6 +1061,23 @@ export const api = {
return invoke("cancel_claude_execution", { sessionId });
},
/**
* Lists all currently running Claude sessions
* @returns Promise resolving to list of running Claude sessions
*/
async listRunningClaudeSessions(): Promise<any[]> {
return invoke("list_running_claude_sessions");
},
/**
* Gets live output from a Claude session
* @param sessionId - The session ID to get output for
* @returns Promise resolving to the current live output
*/
async getClaudeSessionOutput(sessionId: string): Promise<string> {
return invoke("get_claude_session_output", { sessionId });
},
/**
* Lists files and directories in a given path
*/