MCPcopy Create free account
hub / github.com/WJX20/claude-code / loadAllSubagentTranscriptsFromDisk

Function loadAllSubagentTranscriptsFromDisk

src/utils/sessionStorage.ts:4326–4348  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4324
4325// Globs the session's subagents dir directly — unlike AppState.tasks, this survives task eviction.
4326export async function loadAllSubagentTranscriptsFromDisk(): Promise<{
4327 [agentId: string]: Message[]
4328}> {
4329 const subagentsDir = join(
4330 getSessionProjectDir() ?? getProjectDir(getOriginalCwd()),
4331 getSessionId(),
4332 'subagents',
4333 )
4334 let entries: Dirent[]
4335 try {
4336 entries = await readdir(subagentsDir, { withFileTypes: true })
4337 } catch {
4338 return {}
4339 }
4340 // Filename format is the inverse of getAgentTranscriptPath() — keep in sync.
4341 const agentIds = entries
4342 .filter(
4343 d =>
4344 d.isFile() && d.name.startsWith('agent-') && d.name.endsWith('.jsonl'),
4345 )
4346 .map(d => d.name.slice('agent-'.length, -'.jsonl'.length))
4347 return loadSubagentTranscripts(agentIds)
4348}
4349
4350// Exported so useLogMessages can sync-compute the last loggable uuid
4351// without awaiting recordTranscript's return value (race-free hint tracking).

Callers 1

FeedbackFunction · 0.85

Calls 6

getSessionProjectDirFunction · 0.85
getOriginalCwdFunction · 0.85
getSessionIdFunction · 0.85
readdirFunction · 0.85
loadSubagentTranscriptsFunction · 0.85
getProjectDirFunction · 0.70

Tested by

no test coverage detected