/** * Host side of the Collection Profile protocol: one JSON object per line on * stdin and stdout. The connector reads START, then emits records, cursors, * progress and interaction requests, and ends with exactly one DONE. */ export interface StartMessage { type: "START"; run_id: string; collection_mode: "full_refresh" | "incremental"; scope: { streams: Array<{ name: string; }>; }; state: Record; } export interface ConnectorRecord { stream: string; key: string; data: Record; op?: "upsert" | "delete"; } export interface SkipResult { stream?: string; reason?: string; message?: string; } export interface InteractionRequest { requestId: string; kind: string; message: string; schema?: { properties?: Record; required?: string[]; }; timeoutMs: number; } export type InteractionReply = { status: "success"; data?: Record; } | { status: "cancelled"; message: string; }; export interface RunOutcome { status: "succeeded" | "failed" | "cancelled"; recordsEmitted: number; error?: { message: string; code?: string; retryable: boolean; }; } export interface RunProtocolOptions { node: string; args: string[]; cwd: string; env: NodeJS.ProcessEnv; start: StartMessage; signal?: AbortSignal; /** Silence after which a run is considered stuck; paused during interactions. */ idleTimeoutMs?: number; onRecord(record: ConnectorRecord): void; onState(stream: string, cursor: Record): void; onProgress(progress: { stream?: string; message: string; count?: number; total?: number; }): void; onSkip(skip: SkipResult): void; /** A browser step that resolves itself rather than requesting an stdin reply. */ onAssistance?(message: string): void; onInteraction(request: InteractionRequest): Promise; log(line: string): void; } export declare const DEFAULT_IDLE_TIMEOUT_MS: number; /** The last few stderr lines for an error message, or nothing if they may carry a secret. */ export declare function stderrExcerpt(lines: string[]): string; export declare function runCollectionProfile(options: RunProtocolOptions): Promise; //# sourceMappingURL=protocol.d.ts.map