* Terminal-agent discovery. The non-compiled bun process at * `browse/src/terminal-agent.ts` writes its chosen port to * ` /terminal-port` and the loopback handshake token to * ` /terminal-internal-token` once it boots. Read on demand — * lazy so we don't break tests that don't
()
| 403 | * lazy so we don't break tests that don't spawn the agent. |
| 404 | */ |
| 405 | function readTerminalPort(): number | null { |
| 406 | try { |
| 407 | const f = path.join(path.dirname(config.stateFile), 'terminal-port'); |
| 408 | const v = parseInt(fs.readFileSync(f, 'utf-8').trim(), 10); |
| 409 | return Number.isFinite(v) && v > 0 ? v : null; |
| 410 | } catch { return null; } |
| 411 | } |
| 412 | function readTerminalInternalToken(): string | null { |
| 413 | try { |
| 414 | const f = path.join(path.dirname(config.stateFile), 'terminal-internal-token'); |
no outgoing calls
no test coverage detected