MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getTranscriptPathForSession

Function getTranscriptPathForSession

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

Source from the content-addressed store, hash-verified

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

Callers 13

hydrateRemoteSessionFunction · 0.85
saveCustomTitleFunction · 0.85
saveAiGeneratedTitleFunction · 0.85
saveTaskSummaryFunction · 0.85
saveTagFunction · 0.85
linkSessionToPRFunction · 0.85
saveAgentNameFunction · 0.85
saveAgentColorFunction · 0.85
getLastSessionLogFunction · 0.85
createBaseHookInputFunction · 0.85

Calls 4

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

Tested by

no test coverage detected