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

Function getTranscriptPathForSession

src/utils/sessionStorage.ts:208–226  ·  view source on GitHub ↗
(sessionId: string)

Source from the content-addressed store, hash-verified

206}
207
208export function getTranscriptPathForSession(sessionId: string): string {
209 // When asking for the CURRENT session's transcript, honor sessionProjectDir
210 // the same way getTranscriptPath() does. Without this, hooks get a
211 // transcript_path computed from originalCwd while the actual file was
212 // written to sessionProjectDir (set by switchActiveSession on resume/branch)
213 // — different directories, so the hook sees MISSING (gh-30217). CC-34
214 // made sessionId + sessionProjectDir atomic precisely to prevent this
215 // kind of drift; this function just wasn't updated to read both.
216 //
217 // For OTHER session IDs we can only guess via originalCwd — we don't
218 // track a sessionId→projectDir map. Callers wanting a specific other
219 // session's path should pass fullPath explicitly (most save* functions
220 // already accept this).
221 if (sessionId === getSessionId()) {
222 return getTranscriptPath()
223 }
224 const projectDir = getProjectDir(getOriginalCwd())
225 return join(projectDir, `${sessionId}.jsonl`)
226}
227
228// 50 MB — session JSONL can grow to multiple GB (inc-3930). Callers that
229// read the raw transcript must bail out above this threshold to avoid OOM.

Callers 15

hydrateRemoteSessionFunction · 0.85
saveCustomTitleFunction · 0.85
saveAiGeneratedTitleFunction · 0.85
saveTaskSummaryFunction · 0.85
saveTagFunction · 0.85
saveGoalFunction · 0.85
clearGoalEntryFunction · 0.85
linkSessionToPRFunction · 0.85
saveAgentNameFunction · 0.85
saveAgentColorFunction · 0.85

Calls 4

getSessionIdFunction · 0.85
getOriginalCwdFunction · 0.85
getTranscriptPathFunction · 0.70
getProjectDirFunction · 0.70

Tested by

no test coverage detected