import { Channel, type ConsoleChunk, type ReadResult } from './types.ts'; import type { ConsoleStore } from './store.ts'; /** * Everything one job has printed, readable from any position. * * A job writes here as it runs, and any number of readers consume at * their own pace. A reader's whole state is one number, so readers cost * nothing, may join late, and may disappear without the console * noticing. */ export declare class JobConsole { private readonly backing; private finishedFlag; /** * @param store where chunks live. Defaults to memory, which is the * right home whenever the job and its readers share a process. * @param finished whether the job has already ended, set when * rebuilding a finished console from a snapshot. */ constructor(store?: ConsoleStore | null, finished?: boolean); /** * Where this console's chunks live. * * Public because the store carries the console's address: a shared * store (`RedisConsoleStore.keyPrefix`) is how an embedder points a * reader in another process at a live console. */ get store(): ConsoleStore; /** Whether this process has seen the job end. */ get finished(): boolean; /** * Append output produced by the job. * * Ignored once the job has ended, so a runner still unwinding after a * kill cannot append past the ending chunk and strand readers that * already stopped following. */ emit(channel: Channel, data: Uint8Array): Promise; /** * Record how the job ended and release every waiting reader. * * Idempotent, so a job killed while it was already exiting does not * get two endings. */ finish(outcome: string): Promise; /** Read chunks at or after a cursor. */ readFrom(seq: number, limit?: number): Promise; /** Yield chunks as they arrive, ending when the job does. */ follow(seq?: number): AsyncGenerator; /** * Resolve once the job has ended. * * Resolves on a closed store too, so a console discarded while someone * was joining on it does not strand them. */ waitFinished(): Promise; /** * Join everything the job has printed so far. * * With no channel, joins stdout and stderr in the order they were * produced and omits the CONTROL chunk, which is status not output. */ snapshot(channel?: Channel | null): Promise; /** Release the underlying store. */ close(): Promise; } //# sourceMappingURL=job_console.d.ts.map