MCPcopy
hub / github.com/claude-code-best/claude-code / switchSession

Function switchSession

src/bootstrap/state.ts:462–473  ·  view source on GitHub ↗
(
  sessionId: SessionId,
  projectDir: string | null = null,
)

Source from the content-addressed store, hash-verified

460 * carries over from the previous session.
461 */
462export function switchSession(
463 sessionId: SessionId,
464 projectDir: string | null = null,
465): void {
466 // Drop the outgoing session's plan-slug entry so the Map stays bounded
467 // across repeated /resume. Only the current session's slug is ever read
468 // (plans.ts getPlanSlug defaults to getSessionId()).
469 STATE.planSlugCache.delete(STATE.sessionId)
470 STATE.sessionId = sessionId
471 STATE.sessionProjectDir = projectDir
472 sessionSwitched.emit(sessionId)
473}
474
475const sessionSwitched = createSignal<[id: SessionId]>()
476

Callers 11

runFunction · 0.85
setupFunction · 0.85
hydrateRemoteSessionFunction · 0.85
onSelectFunction · 0.85
REPLFunction · 0.85
loadInitialMessagesFunction · 0.85
getOrCreateSessionFunction · 0.85
promptFunction · 0.85
createSessionFunction · 0.85

Calls 2

deleteMethod · 0.65
emitMethod · 0.45

Tested by

no test coverage detected