| author | |
| committer | |
| log | 2cd92ae6f510f5b9b44175fad3f96cb872eb41c1 |
| tree | 1ea7a985c69edd1ccc64f839b457fd0e3875c308 |
| parent | 85fe41bad0f6e3ab83de6b83f9635482daee79c4 |
Co-authored-by: codex <codex@users.noreply.github.com>3 files changed, 6 insertions(+), 13 deletions(-)
apps/web/src/components/ChatView.tsx+1-1| ... | @@ -320,7 +320,7 @@ export default function ChatView() { | ... | @@ -320,7 +320,7 @@ export default function ChatView() { |
| 320 | .catch(() => undefined); | 320 | .catch(() => undefined); |
| 321 | if ("close" in api.terminal && typeof api.terminal.close === "function") { | 321 | if ("close" in api.terminal && typeof api.terminal.close === "function") { |
| 322 | void api.terminal | 322 | void api.terminal |
| 323 | .close({ threadId: activeThreadId, terminalId }) | 323 | .close({ threadId: activeThreadId, terminalId, deleteHistory: true }) |
| 324 | .catch(() => fallbackExitWrite()); | 324 | .catch(() => fallbackExitWrite()); |
| 325 | } else { | 325 | } else { |
| 326 | void fallbackExitWrite(); | 326 | void fallbackExitWrite(); |
apps/web/src/store.test.ts+4-4| ... | @@ -301,13 +301,13 @@ describe("store reducer thread continuity", () => { | ... | @@ -301,13 +301,13 @@ describe("store reducer thread continuity", () => { |
| 301 | }); | 301 | }); |
| 302 | 302 | ||
| 303 | expect(next.threads[0]?.terminalOpen).toBe(true); | 303 | expect(next.threads[0]?.terminalOpen).toBe(true); |
| 304 | expect(next.threads[0]?.terminalIds).toEqual([`${DEFAULT_THREAD_TERMINAL_ID}-next`]); | 304 | expect(next.threads[0]?.terminalIds).toEqual([DEFAULT_THREAD_TERMINAL_ID]); |
| 305 | expect(next.threads[0]?.runningTerminalIds).toEqual([]); | 305 | expect(next.threads[0]?.runningTerminalIds).toEqual([]); |
| 306 | expect(next.threads[0]?.activeTerminalId).toBe(`${DEFAULT_THREAD_TERMINAL_ID}-next`); | 306 | expect(next.threads[0]?.activeTerminalId).toBe(DEFAULT_THREAD_TERMINAL_ID); |
| 307 | expect(next.threads[0]?.terminalGroups).toEqual([ | 307 | expect(next.threads[0]?.terminalGroups).toEqual([ |
| 308 | { | 308 | { |
| 309 | id: `group-${DEFAULT_THREAD_TERMINAL_ID}-next`, | 309 | id: `group-${DEFAULT_THREAD_TERMINAL_ID}`, |
| 310 | terminalIds: [`${DEFAULT_THREAD_TERMINAL_ID}-next`], | 310 | terminalIds: [DEFAULT_THREAD_TERMINAL_ID], |
| 311 | }, | 311 | }, |
| 312 | ]); | 312 | ]); |
| 313 | }); | 313 | }); |
apps/web/src/store.ts+1-8| ... | @@ -164,13 +164,6 @@ function fallbackGroupId(terminalId: string): string { | ... | @@ -164,13 +164,6 @@ function fallbackGroupId(terminalId: string): string { |
| 164 | return `group-${terminalId}`; | 164 | return `group-${terminalId}`; |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | function replacementTerminalId(closedTerminalId: string): string { | ||
| 168 | const normalizedId = closedTerminalId.trim(); | ||
| 169 | return normalizedId === DEFAULT_THREAD_TERMINAL_ID | ||
| 170 | ? `${DEFAULT_THREAD_TERMINAL_ID}-next` | ||
| 171 | : DEFAULT_THREAD_TERMINAL_ID; | ||
| 172 | } | ||
| 173 | |||
| 174 | function assignUniqueGroupId(groupId: string, usedGroupIds: Set<string>): string { | 167 | function assignUniqueGroupId(groupId: string, usedGroupIds: Set<string>): string { |
| 175 | if (!usedGroupIds.has(groupId)) { | 168 | if (!usedGroupIds.has(groupId)) { |
| 176 | usedGroupIds.add(groupId); | 169 | usedGroupIds.add(groupId); |
| ... | @@ -276,7 +269,7 @@ function closeThreadTerminal(thread: Thread, terminalId: string): Thread { | ... | @@ -276,7 +269,7 @@ function closeThreadTerminal(thread: Thread, terminalId: string): Thread { |
| 276 | 269 | ||
| 277 | const remainingTerminalIds = thread.terminalIds.filter((id) => id !== terminalId); | 270 | const remainingTerminalIds = thread.terminalIds.filter((id) => id !== terminalId); |
| 278 | if (remainingTerminalIds.length === 0) { | 271 | if (remainingTerminalIds.length === 0) { |
| 279 | const nextTerminalId = replacementTerminalId(terminalId); | 272 | const nextTerminalId = terminalId; |
| 280 | const nextTerminalGroupId = fallbackGroupId(nextTerminalId); | 273 | const nextTerminalGroupId = fallbackGroupId(nextTerminalId); |
| 281 | return normalizeThreadTerminals({ | 274 | return normalizeThreadTerminals({ |
| 282 | ...thread, | 275 | ...thread, |