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

Function restoreSessionMetadata

src/utils/sessionStorage.ts:2839–2868  ·  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
  goal?: GoalState
})

Source from the content-addressed store, hash-verified

2837 * agent banner) and re-appended on session exit via reAppendSessionMetadata.
2838 */
2839export function restoreSessionMetadata(meta: {
2840 customTitle?: string
2841 tag?: string
2842 agentName?: string
2843 agentColor?: string
2844 agentSetting?: string
2845 mode?: 'coordinator' | 'normal'
2846 worktreeSession?: PersistedWorktreeSession | null
2847 prNumber?: number
2848 prUrl?: string
2849 prRepository?: string
2850 goal?: GoalState
2851}): void {
2852 const project = getProject()
2853 // ??= so --name (cacheSessionTitle) wins over the resumed
2854 // session's title. REPL.tsx clears before calling, so /resume is unaffected.
2855 if (meta.customTitle) project.currentSessionTitle ??= meta.customTitle
2856 if (meta.tag !== undefined) project.currentSessionTag = meta.tag || undefined
2857 if (meta.agentName) project.currentSessionAgentName = meta.agentName
2858 if (meta.agentColor) project.currentSessionAgentColor = meta.agentColor
2859 if (meta.agentSetting) project.currentSessionAgentSetting = meta.agentSetting
2860 if (meta.mode) project.currentSessionMode = meta.mode
2861 if (meta.worktreeSession !== undefined)
2862 project.currentSessionWorktree = meta.worktreeSession
2863 if (meta.prNumber !== undefined)
2864 project.currentSessionPrNumber = meta.prNumber
2865 if (meta.prUrl) project.currentSessionPrUrl = meta.prUrl
2866 if (meta.prRepository) project.currentSessionPrRepository = meta.prRepository
2867 if (meta.goal) project.currentSessionGoal = meta.goal
2868}
2869
2870/**
2871 * 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