/** * Shared line-buffering helpers for deploy targets. * * Both the local target (subprocess stdout) and the container runtimes * (` logs`) read text off a web `ReadableStream` and need the * same UTF-8 decode + newline-split logic, plus a timestamped ring buffer so * `DeployHandle.logs()` can replay what was already seen. */ /** One buffered log line with the wall-clock time it was observed. */ export interface BufferedLine { ts: number; line: string; } /** * Bounded FIFO of decoded lines. Drives both the readiness watcher and * `logs()` replay; the cap keeps a long-running process from growing unbounded. */ export declare class LineBuffer { private readonly max; private readonly lines; private readonly waiters; constructor(max?: number); push(line: string): void; /** Snapshot of buffered lines at or after `sinceMs` (epoch millis). */ since(sinceMs?: number): BufferedLine[]; /** Subscribe to future pushes; returns an unsubscribe fn. */ subscribe(fn: (line: BufferedLine) => void): () => void; } /** * Pump a byte stream into a {@link LineBuffer}, splitting on `\n`. Resolves when * the stream ends. Errors (e.g. the process being killed mid-read) are * swallowed — a dead stream just means no more lines. */ export declare function pumpLines(stream: ReadableStream, buffer: LineBuffer): Promise; /** * Resolve once a buffered line matches `pattern`, reject on timeout or abort. * Checks already-buffered lines first so a fast-printing process never races * the subscription. */ export declare function waitForLine(buffer: LineBuffer, pattern: RegExp, opts: { timeoutMs: number; signal: AbortSignal; }): Promise; //# sourceMappingURL=stream-lines.d.ts.map