import { type PersistedOperationObserver } from "../persisted-operation-observer.js"; /** 仅受信 driver 在本次启动未产生进程或已确认回收全部所属进程后抛出。 */ export declare class GatewayStartReapedError extends Error { } export interface GatewayInstance { id: string; readonly pid?: number; readonly address?: { host: "127.0.0.1"; port: number; }; } /** start resolves only after handshake; stop resolves only after the child is reaped. */ export interface GatewayDriver { start(): Promise; stop(instance: GatewayInstance): Promise; } export type GatewayDesiredState = "running" | "stopped"; export type GatewayActualState = "starting" | "running" | "stopping" | "stopped" | "failed"; export interface GatewayOperation { id: string; action: "start" | "stop" | "restart" | "shutdown" | "reconcile" | "suspend"; status: "running" | "succeeded" | "failed"; startedAt: string; finishedAt?: string; error?: string; } export interface GatewayControllerState { schemaVersion: 1; desired: GatewayDesiredState; actual: GatewayActualState; instance?: GatewayInstance; recoveryRequired: boolean; operations: GatewayOperation[]; error?: string; } export interface GatewayControllerOptions { statePath: string; driver: GatewayDriver; initialDesired?: GatewayDesiredState; /** Called only after the final operation state is durable; failures must remain isolated. */ onOperation?: PersistedOperationObserver; } /** One workspace lock must be held by the host throughout this controller's lifetime. */ export declare class GatewayController { private readonly options; private state; private instance?; private initialized; private closed; private storageUncertain; private effectAttempted; private committedState?; private queue; constructor(options: GatewayControllerOptions); initialize(): Promise; status(): GatewayControllerState; /** Resolves with the final durable result, never just an acceptance acknowledgement. */ start(): Promise; stop(): Promise; restart(): Promise; /** Internal generation switch: release the current instance without changing user intent. */ suspend(): Promise; shutdown(): Promise; /** Host must prove the old process/group is gone; a stale PID is never sufficient. */ reconcileStopped(): Promise; /** Driver reports confirmed exit; do not await this callback inside driver.start/stop. */ observeExit(instanceId: string, error?: string): Promise; private run; private startInstance; private stopInstance; private assertInitialized; private serial; private markUnknown; private persist; private writeState; } //# sourceMappingURL=gateway-controller.d.ts.map