MCPcopy
hub / github.com/codeaashu/claude-code / restoreSessionMetadata

Function restoreSessionMetadata

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

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