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