diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 70f248b70574b1491be73691d4e2d7b8e0298e7a..c57ef71b7e8beca4f158f8219a727c6ea4c81276 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -320,7 +320,7 @@ export default function ChatView() { .catch(() => undefined); if ("close" in api.terminal && typeof api.terminal.close === "function") { void api.terminal - .close({ threadId: activeThreadId, terminalId }) + .close({ threadId: activeThreadId, terminalId, deleteHistory: true }) .catch(() => fallbackExitWrite()); } else { void fallbackExitWrite(); diff --git a/apps/web/src/store.test.ts b/apps/web/src/store.test.ts index eb8662dd97a4b034c6989397a176ca382649164c..e2e083e3be91c8ac2720c427fc8451c45a9438bf 100644 --- a/apps/web/src/store.test.ts +++ b/apps/web/src/store.test.ts @@ -301,13 +301,13 @@ describe("store reducer thread continuity", () => { }); expect(next.threads[0]?.terminalOpen).toBe(true); - expect(next.threads[0]?.terminalIds).toEqual([`${DEFAULT_THREAD_TERMINAL_ID}-next`]); + expect(next.threads[0]?.terminalIds).toEqual([DEFAULT_THREAD_TERMINAL_ID]); expect(next.threads[0]?.runningTerminalIds).toEqual([]); - expect(next.threads[0]?.activeTerminalId).toBe(`${DEFAULT_THREAD_TERMINAL_ID}-next`); + expect(next.threads[0]?.activeTerminalId).toBe(DEFAULT_THREAD_TERMINAL_ID); expect(next.threads[0]?.terminalGroups).toEqual([ { - id: `group-${DEFAULT_THREAD_TERMINAL_ID}-next`, - terminalIds: [`${DEFAULT_THREAD_TERMINAL_ID}-next`], + id: `group-${DEFAULT_THREAD_TERMINAL_ID}`, + terminalIds: [DEFAULT_THREAD_TERMINAL_ID], }, ]); }); diff --git a/apps/web/src/store.ts b/apps/web/src/store.ts index ad5564979925498869039e3f3aec325f5e1f856b..44d2ff02d03d530626b19b5215d2d82688fde41f 100644 --- a/apps/web/src/store.ts +++ b/apps/web/src/store.ts @@ -164,13 +164,6 @@ function fallbackGroupId(terminalId: string): string { return `group-${terminalId}`; } -function replacementTerminalId(closedTerminalId: string): string { - const normalizedId = closedTerminalId.trim(); - return normalizedId === DEFAULT_THREAD_TERMINAL_ID - ? `${DEFAULT_THREAD_TERMINAL_ID}-next` - : DEFAULT_THREAD_TERMINAL_ID; -} - function assignUniqueGroupId(groupId: string, usedGroupIds: Set): string { if (!usedGroupIds.has(groupId)) { usedGroupIds.add(groupId); @@ -276,7 +269,7 @@ function closeThreadTerminal(thread: Thread, terminalId: string): Thread { const remainingTerminalIds = thread.terminalIds.filter((id) => id !== terminalId); if (remainingTerminalIds.length === 0) { - const nextTerminalId = replacementTerminalId(terminalId); + const nextTerminalId = terminalId; const nextTerminalGroupId = fallbackGroupId(nextTerminalId); return normalizeThreadTerminals({ ...thread,