import type { TurnEventSink } from "./agent/events.js"; export type LogStream = "stdout" | "stderr"; /** * Patch the global console so each call is forwarded to the original AND handed (formatted) to * `sink`. Returns a restore function — ALWAYS call it (the worker runs `restore()` in a finally). */ export declare function captureConsole(sink: (stream: LogStream, text: string) => void, /** Scrub known secret values from each formatted line before it reaches EITHER sink. A program * that `console.log`s a resolved secret must not leak it — to the run's `program_output` events * OR to container stdout (CloudWatch). We format+redact once and print the SAME redacted string * to the original console (equivalent output; `util.format` is what console does internally). * Defaults to identity (tests/local). */ redact?: (text: string) => string): () => void; export interface ProgramLogSinkOptions { /** The run's shared event emitter — program logs ride the one ordered stream (`log` channel). */ sink: TurnEventSink; /** Stop emitting after this many frames (the rest still print to CloudWatch). Default 10_000. */ maxFrames?: number; /** Truncate a single line longer than this many chars. Default 8 KiB. */ maxLineLength?: number; } /** * Build the sink `captureConsole` feeds: turn each formatted console line into a v1 * `program_output` event (best-effort). Caps + truncates to stay efficient. */ export declare function createProgramLogSink(opts: ProgramLogSinkOptions): (stream: LogStream, text: string) => void;