export type JsonLineProcessState = "running" | "closing" | "closed" | "failed"; export type JsonLineProtocolErrorKind = "invalid_utf8" | "malformed_json" | "line_too_large" | "truncated_line" | "stdout_error"; export interface JsonLineProcessOptions { /** The executable followed by its arguments. This is never interpreted by a shell. */ argv: readonly [string, ...string[]]; cwd?: string; env?: NodeJS.ProcessEnv; maxStdoutLineBytes?: number; maxStderrChars?: number; closeGraceMs?: number; killGraceMs?: number; } export interface JsonLineCloseOptions { graceMs?: number; killGraceMs?: number; } export interface JsonLineProcessExit { code: number | null; signal: NodeJS.Signals | null; expected: boolean; forced: boolean; stderr: string; error?: string; } export declare class JsonLineProtocolError extends Error { readonly kind: JsonLineProtocolErrorKind; readonly lineSummary: string | undefined; constructor(kind: JsonLineProtocolErrorKind, message: string, lineSummary?: string); } export declare class JsonLineProcessClosedError extends Error { constructor(message?: string); } export declare class JsonLineProcessTerminationError extends Error { readonly pid: number | undefined; constructor(pid: number | undefined); } type Listener = (value: T) => void; /** * Owns one child process whose stdout is a UTF-8, newline-delimited JSON stream. * stderr is never parsed as protocol input and is only exposed as bounded diagnostic text. */ export declare class JsonLineProcess { readonly pid: number | undefined; private readonly child; private readonly maxStdoutLineBytes; private readonly maxStderrChars; private readonly defaultCloseGraceMs; private readonly defaultKillGraceMs; private readonly messages; private readonly protocolErrors; private readonly stderrListeners; private readonly exitListeners; private stdoutBuffer; private stdoutBroken; private protocolErrorValue; private readonly stderrDecoder; private stderrPending; private stderrCaptured; private stderrTruncated; private stateValue; private expectedExit; private forcedExit; private failureObserved; private spawnError; private processExitValue; private exitValue; private readonly exitPromise; private resolveExit; private closePromise; private constructor(); static spawn(options: JsonLineProcessOptions): JsonLineProcess; get state(): JsonLineProcessState; get stderr(): string; onMessage(listener: Listener): () => void; onProtocolError(listener: Listener): () => void; onStderr(listener: Listener): () => void; onExit(listener: Listener): () => void; send(value: unknown, signal?: AbortSignal): Promise; waitForExit(): Promise; close(options?: JsonLineCloseOptions): Promise; terminate(options?: Omit): Promise; private closeInternal; private terminateTree; private waitWithin; private consumeStdout; private parseLine; private breakStdout; private consumeStderr; private captureStderr; private finish; private observeProcessExit; } export {}; //# sourceMappingURL=jsonline-process.d.ts.map