/** * Drive Antigravity CLI's first-run screens to the owner's choice, * deterministically, in a terminal the harness controls. * * One key at a time; before every key the screen is read and parsed * ({@link parseAntigravityTermsScreen}) and the next key is chosen from what * is on screen — never from a fixed key count: * * - colour scheme: bring the focus to `terminal`, Enter; leave "Import * extensions from Gemini CLI" unchecked; Enter on Next only when the * screen shows `* terminal` and the import box unchecked; * - Terms: toggle the data-sharing box only when it differs from the * owner's choice, re-read to verify, then go to Done and press Enter — * only when the box (read again, right then) matches the choice; * - then wait for the main prompt. * * Anything that does not match (an unknown screen for too long, an account * sign-in, no focus, too many keys) aborts: Done is never pressed after a * mismatch. specs/2026-10-01-runtime-terms-consent.md * * @module services/runtime-terms/antigravity-terms-driver */ import { type AntigravityTermsScreen } from './antigravity-terms-screens.js'; /** A terminal the driver can type into and read (a PTY session; the fake TUI in tests). */ export interface TermsTerminal { /** Write raw bytes (key escape sequences) */ write(data: string): void | Promise; /** Current screen text */ capture(): string | Promise; } /** Keys the driver sends. */ export type DriverKey = 'Up' | 'Down' | 'Left' | 'Right' | 'Enter'; /** Their bytes (the same as the session helper's KEY_CODES). */ export declare const DRIVER_KEY_BYTES: Readonly>; /** Outcome of a drive. */ export interface TermsDriveResult { ok: boolean; /** Done was pressed (the terms were accepted on screen) */ donePressed: boolean; /** The runtime opened straight to its prompt: terms were already accepted */ alreadyAccepted: boolean; /** Data-sharing box state when Done was pressed */ dataSharing?: boolean; /** Why it stopped (English), when not ok */ error?: string; /** Keys sent, in order */ keys: DriverKey[]; /** Last screen text */ screen: string; } /** Options. */ export interface TermsDriveOptions { /** Leave the data-sharing box checked */ shareData: boolean; now?: () => number; sleep?: (ms: number) => Promise; pollMs?: number; keySettleMs?: number; launchTimeoutMs?: number; unknownScreenTimeoutMs?: number; promptTimeoutMs?: number; maxKeys?: number; } /** What the next step is. */ type Step = { key: DriverKey; } | { wait: true; } | { done: true; } | { abort: string; }; /** * Decide the next step for a parsed screen. * * @param s - Parsed screen * @param shareData - Owner's choice for the data-sharing box * @param donePressed - Done was already pressed * @returns Next step */ export declare function nextTermsStep(s: AntigravityTermsScreen, shareData: boolean, donePressed: boolean): Step; /** * Drive the first-run screens. Never throws. * * @param term - Terminal running a freshly launched `agy` * @param opts - Owner's choice and timing * @returns Result */ export declare function driveAntigravityTerms(term: TermsTerminal, opts: TermsDriveOptions): Promise; export {}; //# sourceMappingURL=antigravity-terms-driver.d.ts.map