Clean room implementation of the chat process (#5079)

Co-authored-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Zane <75694352+zanesq@users.noreply.github.com>
This commit is contained in:
Douwe Osinga
2025-10-11 10:45:16 -04:00
committed by GitHub
parent 73f109237e
commit 0c2127124f
36 changed files with 1024 additions and 541 deletions
+16 -8
View File
@@ -1,16 +1,24 @@
import { Session } from './api';
export function resumeSession(session: Session) {
console.log('Launching session in new window:', session.description || session.id);
export function resumeSession(
session: Session,
navigateInSameWindow?: (sessionId: string) => void
) {
const workingDir = session.working_dir;
if (!workingDir) {
throw new Error('Cannot resume session: working directory is missing in session');
}
window.electron.createChatWindow(
undefined, // query
workingDir,
undefined, // version
session.id
);
// When ALPHA is true and we have a navigation callback, resume in the same window
// Otherwise, open in a new window (old behavior)
if (process.env.ALPHA && navigateInSameWindow) {
navigateInSameWindow(session.id);
} else {
window.electron.createChatWindow(
undefined, // query
workingDir,
undefined, // version
session.id
);
}
}