// Stands in for the codex binary in daemon tests: `codex app-server --listen ws://127.0.0.1: ...` runs the fake // app-server on that port. A test's wrapper script passes `--record `, where each thread/revert is appended. import { appendFileSync } from "node:fs"; import { startFakeAppServer } from "./app-server.ts"; const arg = (name: string) => { const i = process.argv.indexOf(name); return i >= 0 ? process.argv[i + 1] : undefined; }; const record = arg("--record"); // Daemon integration tests exercise pause behavior separately; start this fake below the default quota gate. startFakeAppServer(30, Number(new URL(arg("--listen") ?? "ws://127.0.0.1:0").port), (params) => { if (record) appendFileSync(record, `${JSON.stringify(params)}\n`); }, 50); await new Promise(() => {}); // until the hub stops it