Accept story 39: Persistent Claude Code Sessions in Web UI

Use --resume <session_id> with claude -p so the web UI claude-code-pty
provider maintains full conversation context across messages, identical
to a long-running terminal Claude Code session.

Changes:
- Capture session_id from claude -p stream-json system event
- Pass --resume on subsequent messages in same chat session
- Thread session_id through ProviderConfig, ChatResult, WsResponse
- Frontend stores sessionId per chat, clears on New Session
- Unset CLAUDECODE env to allow nested spawning from server
- Wait for clean process exit to ensure transcript flush to disk

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave
2026-02-20 11:51:19 +00:00
parent cff7f5fe7f
commit cde75bd7fb
11 changed files with 9524 additions and 61 deletions
+2
View File
@@ -21,6 +21,7 @@ export interface ProviderConfig {
model: string;
base_url?: string;
enable_tools?: boolean;
session_id?: string;
}
export interface FileEntry {
@@ -52,6 +53,7 @@ export type WsRequest =
export type WsResponse =
| { type: "token"; content: string }
| { type: "update"; messages: Message[] }
| { type: "session_id"; session_id: string }
| { type: "error"; message: string };
// Re-export API client types for convenience