First line only — codex rollout line-1 (session_meta) can be many KB * (it embeds the full base instructions), so stream rather than readFile.
(fp: string)
| 365 | /** First line only — codex rollout line-1 (session_meta) can be many KB |
| 366 | * (it embeds the full base instructions), so stream rather than readFile. */ |
| 367 | async function firstLine(fp: string): Promise<string> { |
| 368 | const input = createReadStream(fp, { encoding: 'utf8' }); |
| 369 | const rl = createInterface({ input, crlfDelay: Infinity }); |
| 370 | try { |
| 371 | for await (const line of rl) return line; |
| 372 | return ''; |
| 373 | } finally { |
| 374 | rl.close(); |
| 375 | input.destroy(); |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | /** |
| 380 | * Add (or no-op if present) a `[projects."<abs>"] trust_level = "trusted"` |