(
options: { setCurrentAsParent?: boolean } = {},
)
| 439 | } |
| 440 | |
| 441 | export function regenerateSessionId( |
| 442 | options: { setCurrentAsParent?: boolean } = {}, |
| 443 | ): SessionId { |
| 444 | if (options.setCurrentAsParent) { |
| 445 | STATE.parentSessionId = STATE.sessionId |
| 446 | } |
| 447 | // Drop the outgoing session's plan-slug entry so the Map doesn't |
| 448 | // accumulate stale keys. Callers that need to carry the slug across |
| 449 | // (REPL.tsx clearContext) read it before calling clearConversation. |
| 450 | STATE.planSlugCache.delete(STATE.sessionId) |
| 451 | // Regenerated sessions live in the current project: reset projectDir to |
| 452 | // null so getTranscriptPath() derives from originalCwd. |
| 453 | STATE.sessionId = randomUUID() as SessionId |
| 454 | STATE.sessionProjectDir = null |
| 455 | return STATE.sessionId |
| 456 | } |
| 457 | |
| 458 | export function getParentSessionId(): SessionId | undefined { |
| 459 | return STATE.parentSessionId |
no test coverage detected