/** * Capture Agent — CLI Runner * * Entry point for deterministic execution from the CLI. * Flow: * 1. Authenticate via stored API key * 2. Fetch compiled program from server * 3. Validate program against Zod schema * 4. Launch local Playwright browser per variant * 5. Execute program via opcode-runner * 6. Upload artifacts + telemetry to server */ import { type ProgressEvent } from './opcode-runner.js'; import { type VideoClipMetadata } from './cli-contract.js'; import type { ExecutionProgram, VariantSpec, RunResult } from './execution-types.js'; export interface RecordableBrowserSettings { viewport: VariantSpec['viewport']; requestedDeviceScaleFactor: number; runtimeDeviceScaleFactor: number; } export declare function resolveRecordableBrowserSettings(program: ExecutionProgram, variant: VariantSpec): RecordableBrowserSettings; export interface CLIRunnerOptions { /** Preset ID to run */ presetId: string; /** Project environment name used by the server to resolve capture URLs */ env?: string; /** Override: provide program directly instead of fetching from server */ program?: ExecutionProgram; /** Keep the legacy success result when upload/telemetry persistence fails */ allowUploadFailure?: boolean; /** Dry run: skip capture opcodes (CAPTURE_SCREENSHOT/BEGIN_CLIP/END_CLIP) and upload. 0 credits charged. */ dryRun?: boolean; /** * Force fresh TTS synthesis for every narration segment instead of reusing * cached audio. Only meaningful when `mediaMode === 'video'`. Every reused * segment becomes billable at full rate. */ regenerateTts?: boolean; /** Selector memory map (fetched from server or cached locally) */ selectorMemory?: Record; /** Show browser window. Default: false (headless) */ headed?: boolean; /** Abort signal for cancellation */ abortSignal?: AbortSignal; /** Progress callback */ onProgress?: (event: ProgressEvent) => void; /** * Override the user/CLI `exportDebugLogs` preference for this run. * When `false`, skips the failed-run debug logs export (AUT-149). */ exportDebugLogs?: boolean; /** * Shared invocation id for billing. A multi-preset invocation (`run --outdated`, * `auto-recapture`) passes one sessionId for every preset so all their charges * group into a single "CLI capture" entry (migration 267). Defaults to the * run's own id for a single-preset invocation. */ sessionId?: string; } export interface CLIRunResult { success: boolean; runId?: string; runResult?: RunResult; error?: string; } export declare function runCapture(options: CLIRunnerOptions): Promise; export declare function buildVideoClipMetadata(videoId: string, result: RunResult, program?: ExecutionProgram, runId?: string): VideoClipMetadata[]; export declare function resolveEffectiveCliArtifactPlan(artifactPlan: ExecutionProgram['artifactPlan'], deviceFrame?: string | null): ExecutionProgram['artifactPlan'];