import { type ForkOptions } from "node:child_process"; import type { EventEmitter } from "node:events"; import type { Readable } from "node:stream"; import { type TrustedSchemaRequest, type TrustedSchemaResponse } from "./protocol.js"; export type TrustedSchemaTrustGate = Readonly<{ workspaceTrusted: boolean; enabled: boolean; }>; /** Private process boundary, injectable for deterministic execution/stale-delivery proofs. */ export type TrustedSchemaRuntimeProcess = EventEmitter & { connected: boolean; killed: boolean; stdout?: Readable | null; stderr?: Readable | null; send: (request: TrustedSchemaRequest, callback: (error: Error | null) => void) => unknown; kill: (signal: "SIGKILL") => unknown; }; export type TrustedSchemaSupervisorOptions = Readonly<{ trust: TrustedSchemaTrustGate; startupDeadlineMs?: number; validationDeadlineMs?: number; maxRestarts?: number; runtimeEntry?: string; execArgv?: readonly string[]; spawnRuntime?: (entry: string, options: ForkOptions) => TrustedSchemaRuntimeProcess; }>; type RequestInput = T extends TrustedSchemaRequest ? Omit : never; export declare class TrustedSchemaInfrastructureError extends Error { readonly code: "TRUST_REQUIRED" | "REQUEST_TIMEOUT" | "RUNTIME_RETIRED" | "RUNTIME_DISCONNECTED" | "RESTART_BUDGET_EXHAUSTED" | "DISPOSED"; constructor(code: "TRUST_REQUIRED" | "REQUEST_TIMEOUT" | "RUNTIME_RETIRED" | "RUNTIME_DISCONNECTED" | "RESTART_BUDGET_EXHAUSTED" | "DISPOSED", message: string); } /** * One initial launch plus maxRestarts replacement attempts per supervisor lifetime. * A replacement consumes budget BEFORE spawn, including failed startup attempts. * Successful handshakes/validation do not reset it. Exhaustion never spawns. * terminate retires all pending work immediately; dispose permanently closes the owner. */ export declare class TrustedSchemaNodeSupervisor { #private; constructor(options: TrustedSchemaSupervisorOptions); get generation(): number; get activeGeneration(): number | undefined; get restarts(): number; get running(): boolean; get output(): Readonly<{ stdout: string; stderr: string; }>; onRetired(listener: (reason: Error) => void): () => void; start(): Promise; private launch; request(request: RequestInput, deadlineMs?: number): Promise; private dispatch; terminate(reason?: Error): void; dispose(): void; private require_trust; } export {}; //# sourceMappingURL=node-supervisor.d.ts.map