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