MCPcopy Create free account
hub / github.com/Noumena-Network/code / restoreSessionMetadata

Function restoreSessionMetadata

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

2936 * agent banner) and re-appended on session exit via reAppendSessionMetadata.
2937 */
2938export function restoreSessionMetadata(meta: {
2939 customTitle?: string
2940 tag?: string
2941 agentName?: string
2942 agentColor?: string
2943 agentSetting?: string
2944 mode?: 'coordinator' | 'normal'
2945 worktreeSession?: PersistedWorktreeSession | null
2946 prNumber?: number
2947 prUrl?: string
2948 prRepository?: string
2949}): void {
2950 const project = getProject()
2951 // ??= so --name (cacheSessionTitle) wins over the resumed
2952 // session's title. REPL.tsx clears before calling, so /resume is unaffected.
2953 if (meta.customTitle) project.currentSessionTitle ??= meta.customTitle
2954 if (meta.tag !== undefined) project.currentSessionTag = meta.tag || undefined
2955 if (meta.agentName) project.currentSessionAgentName = meta.agentName
2956 if (meta.agentColor) project.currentSessionAgentColor = meta.agentColor
2957 if (meta.agentSetting) project.currentSessionAgentSetting = meta.agentSetting
2958 if (meta.mode) project.currentSessionMode = meta.mode
2959 if (meta.worktreeSession !== undefined)
2960 project.currentSessionWorktree = meta.worktreeSession
2961 if (meta.prNumber !== undefined)
2962 project.currentSessionPrNumber = meta.prNumber
2963 if (meta.prUrl) project.currentSessionPrUrl = meta.prUrl
2964 if (meta.prRepository) project.currentSessionPrRepository = meta.prRepository
2965}
2966
2967/**
2968 * Clear all cached session metadata (title, tag, agent name/color).

Callers 4

onSelectFunction · 0.85
loadInitialMessagesFunction · 0.85

Calls 1

getProjectFunction · 0.85

Tested by

no test coverage detected