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

Function restoreSessionMetadata

src/utils/sessionStorage.ts:2759–2786  ·  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

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