/** * Guards the Codex SDK's internal `child_process.spawn` against unhandled * 'error' events on stdio streams. * * The SDK spawns the Codex CLI binary and writes the turn input to the * child's stdin immediately. When the child exits before the write completes, * the write fails with EPIPE and the 'error' event on stdin has no listener, * crashing the host process. The SDK only attaches an 'error' listener to * the ChildProcess itself, not to its stdio streams. * * This module patches `child_process.spawn` at the CJS module layer and * synchronizes Node's ESM built-in bindings. The wrapper only activates for * Codex binary names or the SDK's argument and environment markers; every * other spawn passes through untouched. * * For matching spawns, `guardChildProcessStreams` attaches 'error' listeners * on the process and each stdio stream. The guard logs and swallows the * error, terminates the child when a stream fails, and tears down listeners * on child close. The SDK can then surface `Codex Exec exited with ...` * through the existing provider-error classification. * * Matching spawns also get their stdout routed through the U+2028 / U+2029 * escape stream from `json-line-separator-stream.ts`, so the SDK's * readline-based JSONL parser never splits one JSON event into fragments. * The replacement happens synchronously inside the spawn wrapper, before the * SDK reads `child.stdout`. */ export declare function installCodexSpawnGuard(): void; //# sourceMappingURL=codex-spawn-guard.d.ts.map