MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / restoreSessionMetadata

Function restoreSessionMetadata

source code/utils/sessionStorage.ts:2760–2787  ·  view source on GitHub ↗
(meta: {
  customTitle?: string
  tag?: string
  agentName?: string
  agentColor?: string
  agentSetting?: string
  mode?: 'coordinator' | 'normal'
  worktreeSession?: PersistedWorktreeSession | null
  prNumber?: number
  prUrl?: string
  prRepository?: string
})

Source from the content-addressed store, hash-verified

2758 * agent banner) and re-appended on session exit via reAppendSessionMetadata.
2759 */
2760export function restoreSessionMetadata(meta: {
2761 customTitle?: string
2762 tag?: string
2763 agentName?: string
2764 agentColor?: string
2765 agentSetting?: string
2766 mode?: 'coordinator' | 'normal'
2767 worktreeSession?: PersistedWorktreeSession | null
2768 prNumber?: number
2769 prUrl?: string
2770 prRepository?: string
2771}): void {
2772 const project = getProject()
2773 // ??= so --name (cacheSessionTitle) wins over the resumed
2774 // session's title. REPL.tsx clears before calling, so /resume is unaffected.
2775 if (meta.customTitle) project.currentSessionTitle ??= meta.customTitle
2776 if (meta.tag !== undefined) project.currentSessionTag = meta.tag || undefined
2777 if (meta.agentName) project.currentSessionAgentName = meta.agentName
2778 if (meta.agentColor) project.currentSessionAgentColor = meta.agentColor
2779 if (meta.agentSetting) project.currentSessionAgentSetting = meta.agentSetting
2780 if (meta.mode) project.currentSessionMode = meta.mode
2781 if (meta.worktreeSession !== undefined)
2782 project.currentSessionWorktree = meta.worktreeSession
2783 if (meta.prNumber !== undefined)
2784 project.currentSessionPrNumber = meta.prNumber
2785 if (meta.prUrl) project.currentSessionPrUrl = meta.prUrl
2786 if (meta.prRepository) project.currentSessionPrRepository = meta.prRepository
2787}
2788
2789/**
2790 * Clear all cached session metadata (title, tag, agent name/color).

Callers 4

onSelectFunction · 0.85
REPLFunction · 0.85
loadInitialMessagesFunction · 0.85

Calls 1

getProjectFunction · 0.85

Tested by

no test coverage detected