()
| 4549 | |
| 4550 | // Globs the session's subagents dir directly — unlike AppState.tasks, this survives task eviction. |
| 4551 | export async function loadAllSubagentTranscriptsFromDisk(): Promise<{ |
| 4552 | [agentId: string]: Message[] |
| 4553 | }> { |
| 4554 | const subagentsDir = join( |
| 4555 | getSessionProjectDir() ?? getProjectDir(getOriginalCwd()), |
| 4556 | getSessionId(), |
| 4557 | 'subagents', |
| 4558 | ) |
| 4559 | let entries: Dirent[] |
| 4560 | try { |
| 4561 | entries = await readdir(subagentsDir, { withFileTypes: true }) |
| 4562 | } catch { |
| 4563 | return {} |
| 4564 | } |
| 4565 | // Filename format is the inverse of getAgentTranscriptPath() — keep in sync. |
| 4566 | const agentIds = entries |
| 4567 | .filter( |
| 4568 | d => |
| 4569 | d.isFile() && d.name.startsWith('agent-') && d.name.endsWith('.jsonl'), |
| 4570 | ) |
| 4571 | .map(d => d.name.slice('agent-'.length, -'.jsonl'.length)) |
| 4572 | return loadSubagentTranscripts(agentIds) |
| 4573 | } |
| 4574 | |
| 4575 | // Exported so useLogMessages can sync-compute the last loggable uuid |
| 4576 | // without awaiting recordTranscript's return value (race-free hint tracking). |
no test coverage detected