import type { ReadyContract } from '../../types.js'; import { type GapFrame, type LogEvent, type ReadyFrame } from './contracts.js'; export interface ReadyContractInfo { controlPort: number; instanceId: string; runId: string; /** Ready-contract version, `ReadyContract['schemaVersion']` on current engines. */ schemaVersion?: number; /** Result-envelope capability advertisement, `1` on current engines. */ schema?: number; logsPath?: string; status?: string; /** The command that wrote the contract: `dev`, `start` or `preview`. */ command?: string; engine?: string; /** Dev-server pid; absent in pre-4.1 contracts. */ pid?: number; /** When that pid's process started (ISO UTC); a reused pid will not match it. */ pidStartedAt?: string; /** Browser CDP port, stamped post-launch, may lag `status: 'ready'`. */ cdpPort?: number; /** Gecko debugger-server port, the `cdpPort` of a Firefox-family session. */ rdpPort?: number; /** The launched browser process, the only handle on its liveness. */ browserPid?: number; /** When the browser process started (ISO UTC), the same check for `browserPid`. */ browserStartedAt?: string; /** Stamped when the launched browser exits while the server keeps running. */ browserExitedAt?: string; browserExitCode?: number; /** When this run began (ISO), kept across recompiles of the same run. */ startedAt?: string; /** When the compile finished (ISO), the meaning of `status: 'ready'`. */ compiledAt?: string; /** When the extension's service worker attached to the control channel (ISO). */ executorAttachedAt?: string; /** `'attached'` once the SW has connected; absent while still launching. */ runtime?: string; /** Last contract write time (ISO). */ ts?: string; binary?: string; binaryProvenance?: string; } export type ReadyContractDocument = Partial & Record; export declare function readReadyContractDocument(projectPath: string, browser?: string): ReadyContractDocument | null; export declare function readExtensionLoadRefusal(projectPath: string, browser: string, runId?: string): string | null; export declare function readReadyContract(projectPath: string, browser?: string): ReadyContractInfo | null; export interface ConsumerCloseInfo { code: number; reason: string; } export interface ConsumerOptions { controlPort: number; instanceId: string; host?: string; path?: string; token?: string; reconnect?: boolean; onReady?: (frame: ReadyFrame) => void; onLog?: (event: LogEvent) => void; onGap?: (frame: GapFrame) => void; onClose?: (info: ConsumerCloseInfo) => void; } export declare class BridgeConsumer { private readonly opts; private socket; private backoff; private readonly maxBackoff; private closed; private timer; private lastCloseInfo; constructor(options: ConsumerOptions); /** Why the last socket closed; null until a close has happened. */ get lastClose(): ConsumerCloseInfo | null; start(): void; close(): void; private url; private connect; private scheduleReconnect; }