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

Function loadFullLog

src/utils/sessionStorage.ts:2949–3056  ·  view source on GitHub ↗
(log: LogOption)

Source from the content-addressed store, hash-verified

2947 * If the log is already full or loading fails, returns the original log.
2948 */
2949export async function loadFullLog(log: LogOption): Promise<LogOption> {
2950 // If already full, return as-is
2951 if (!isLiteLog(log)) {
2952 return log
2953 }
2954
2955 // Use the fullPath from the index entry directly
2956 const sessionFile = log.fullPath
2957 if (!sessionFile) {
2958 return log
2959 }
2960
2961 try {
2962 const {
2963 messages,
2964 summaries,
2965 customTitles,
2966 tags,
2967 agentNames,
2968 agentColors,
2969 agentSettings,
2970 prNumbers,
2971 prUrls,
2972 prRepositories,
2973 modes,
2974 worktreeStates,
2975 fileHistorySnapshots,
2976 attributionSnapshots,
2977 contentReplacements,
2978 contextCollapseCommits,
2979 contextCollapseSnapshot,
2980 leafUuids,
2981 } = await loadTranscriptFile(sessionFile)
2982
2983 if (messages.size === 0) {
2984 return log
2985 }
2986
2987 // Find the most recent user/assistant leaf message from the transcript
2988 const mostRecentLeaf = findLatestMessage(
2989 messages.values(),
2990 msg =>
2991 leafUuids.has(msg.uuid) &&
2992 (msg.type === 'user' || msg.type === 'assistant'),
2993 )
2994 if (!mostRecentLeaf) {
2995 return log
2996 }
2997
2998 // Build the conversation chain from this leaf
2999 const transcript = buildConversationChain(messages, mostRecentLeaf)
3000 // Leaf's sessionId — forked sessions copy chain[0] from the source, but
3001 // metadata entries (custom-title etc.) are keyed by the current session.
3002 const sessionId = mostRecentLeaf.sessionId as UUID | undefined
3003 return {
3004 ...log,
3005 messages: removeExtraFields(transcript),
3006 firstPrompt: extractFirstPrompt(transcript),

Callers 5

SessionPreviewFunction · 0.85
agenticSessionSearchFunction · 0.85
handleSelectFunction · 0.85
callFunction · 0.85

Calls 12

isLiteLogFunction · 0.85
loadTranscriptFileFunction · 0.85
findLatestMessageFunction · 0.85
buildConversationChainFunction · 0.85
removeExtraFieldsFunction · 0.85
countVisibleMessagesFunction · 0.85
valuesMethod · 0.80
extractFirstPromptFunction · 0.70
getMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected