( rootDir: string, filename: string, )
| 258 | } |
| 259 | |
| 260 | async function findNestedAgentFilePath( |
| 261 | rootDir: string, |
| 262 | filename: string, |
| 263 | ): Promise<string | null> { |
| 264 | let entries: Dirent[] |
| 265 | try { |
| 266 | entries = await readdir(rootDir, { withFileTypes: true }) |
| 267 | } catch (e) { |
| 268 | if (isFsInaccessible(e)) return null |
| 269 | throw e |
| 270 | } |
| 271 | |
| 272 | for (const entry of entries) { |
| 273 | const fullPath = join(rootDir, entry.name) |
| 274 | if (entry.isFile() && entry.name === filename) { |
| 275 | return fullPath |
| 276 | } |
| 277 | if (entry.isDirectory()) { |
| 278 | const nested = await findNestedAgentFilePath(fullPath, filename) |
| 279 | if (nested) return nested |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | return null |
| 284 | } |
| 285 | |
| 286 | async function resolveAgentTranscriptPath(agentId: AgentId): Promise<string> { |
| 287 | const directPath = getAgentTranscriptPath(agentId) |
no test coverage detected