import { type IFlexServiceInit, type IFlexServiceStatus, type TFlexChildEvent, type TFlexHostRequestMethod, type TFlexHostRequest, type TFlexHostResponse, type TFlexRequest, type TFlexRequestMethod, type TFlexResponse } from './interfaces.flexipc.js'; export interface IFlexSupervisorStatus { state: IFlexServiceStatus['state']; ready: boolean; code?: IFlexServiceStatus['code']; startedAt?: string; pid?: number; lastExit?: IFlexSupervisorExit; } export interface IFlexSupervisorExit { type: 'exit' | 'error'; timestamp: number; code?: number | null; signal?: NodeJS.Signals | null; errorMessage?: string; } export interface IFlexSupervisorLogEntry { timestamp: number; stream: 'stdout' | 'stderr'; line: string; truncated: boolean; } export interface IFlexSupervisorOptions { onChildExitObserved?: (exitArg: IFlexSupervisorExit) => void; onChildExit?: (exitArg: IFlexSupervisorExit) => void; cancellationGraceTimeoutMs?: number; childTaskDrainTimeoutMs?: number; handleHostRequest?(methodArg: TMethod, payloadArg: TFlexHostRequest, peerIdArg: string, signalArg: AbortSignal): Promise>; handleUndeliveredHostSuccess?(methodArg: TMethod, payloadArg: TFlexHostRequest, resultArg: TFlexHostResponse, peerIdArg: string): Promise; handleBrowserFrame?(channelIdArg: string, bytesArg: Buffer, peerIdArg: string): Promise; } export declare class FlexBrowserChannelNotificationUnavailableError extends Error { constructor(); } export declare const resolveFlexChildEntryPath: () => string; export declare class FlexSupervisor { private readonly options; private status; private child?; private lifecycle?; private transport?; private ownedProcessGroupId?; private orphanReapTask?; private childTaskDrainTask?; private childExitCleanupPending; private pendingChildExit?; private lastExit?; private browserPeerId; private startPromise?; private stopPromise?; private startupResolve?; private startupReject?; private readonly pendingRequests; private readonly activeHostRequests; private readonly hostRequestTasks; private readonly pendingHostSuccessAcknowledgements; private readonly activeReadyHostRequests; private readonly browserFrameTasks; private droppedBrowserFrames; private browserFrameTaskBytes; private readonly browserChannelGenerations; private readonly settledHostRequestIds; private readonly eventListeners; private readonly logs; private readonly stdoutAccumulator; private readonly stderrAccumulator; private readonly cancellationGraceTimeoutMs; private readonly childTaskDrainTimeoutMs; constructor(options?: IFlexSupervisorOptions); getStatus(): IFlexSupervisorStatus; getLogSnapshot(): IFlexSupervisorLogEntry[]; ownsChildPeer(peerIdArg: string): boolean; ownsBrowserPeer(peerIdArg: string): boolean; ownsHostPeer(peerIdArg: string): boolean; getActiveHostPeerId(): string | undefined; ownsDelegatedRunClosePeer(peerIdArg: string): boolean; private ownsHostRequestPeer; subscribe(listenerArg: (eventArg: TFlexChildEvent) => void): () => void; settleReadyHostRequests(): Promise; start(initArg: IFlexServiceInit, signalArg?: AbortSignal): Promise; request(methodArg: TMethod, payloadArg: TFlexRequest, signalArg?: AbortSignal): Promise>; requestToCompletion(methodArg: TMethod, payloadArg: TFlexRequest, signalArg?: AbortSignal): Promise>; stop(): Promise; private performStart; private waitForStartup; private handleChildMessage; sendBrowserFrame(channelIdArg: string, bytesArg: Buffer, peerIdArg: string): Promise; notifyBrowserChannelClosed(channelIdArg: string, peerIdArg: string): Promise; private handleHostRequest; private sendRequest; private sendDispose; private sendPending; private cancelPendingRequest; private clearPendingRequest; private performStop; private terminateOwnedChild; private observeChild; private reapOrphanedGroup; private reapRetainedProcessGroup; private notifyChildExitCleanup; private handleProtocolFailure; private rejectPending; private clearCancellationGraceTimeouts; private failClosedChildGeneration; private startChildTaskDrain; private awaitChildTaskDrain; private drainChildTasks; private rememberSettledHostRequest; private normalizeDeadline; private consumeLog; private flushLog; private addLog; }