/** * Antigravity CLI (`agy`) user settings — force the Gemini API key provider. * * Google does not allow third-party tools to drive Antigravity with the * user's Google account (product OAuth), so Crewly runs agy only with a * Gemini API key. Per https://antigravity.google/docs/cli/install/ that * takes two things: `"modelProvider": "gemini"` in * `~/.gemini/antigravity-cli/settings.json` and `GEMINI_API_KEY` in the * environment ("Only setting a GEMINI_API_KEY environment variable on its * own has no effect"). With the provider set, agy skips the sign-in screen * and "never establishes an account session" — an account login already in * the OS keyring is not used. * * The same write also records folders in `trustedWorkspaces` (the list agy * itself appends to when the user answers its folder-trust screen), so an * agent started in a new project does not stop on that screen. * * The settings file is agy's own: every other key is preserved, and a file * that is not a JSON object is never rewritten (the caller refuses to launch * instead). There is no per-process override — see the "Limitations" * section of specs/antigravity-runtime.md for what this means for the * user's own `agy`. * * @module utils/antigravity-settings */ /** What {@link ensureAntigravityApiKeyProvider} did. */ export type AntigravityProviderResult = /** The file was created or updated */ 'written' /** Provider and trusted folders were already as required */ | 'unchanged' /** The file exists but is not a JSON object; left untouched */ | 'unparseable' /** Reading or writing failed; nothing changed */ | 'error'; /** Minimal logger accepted by this module. */ export interface AntigravitySettingsLogger { warn(message: string, meta?: Record): void; info(message: string, meta?: Record): void; } /** Options for {@link ensureAntigravityApiKeyProvider}. */ export interface EnsureAntigravityProviderOptions { /** Settings file; defaults to `~/.gemini/antigravity-cli/settings.json` */ settingsPath?: string; /** Folders to add to `trustedWorkspaces` (absolute; relative ones are resolved) */ trustedPaths?: readonly string[]; logger?: AntigravitySettingsLogger; } /** * agy's config directory. * * @param homeDir - Home directory (injectable for tests) * @returns `~/.gemini/antigravity-cli` */ export declare function getAntigravityConfigDir(homeDir?: string): string; /** * agy's user settings file. * * @param homeDir - Home directory (injectable for tests) * @returns `~/.gemini/antigravity-cli/settings.json` */ export declare function getAntigravitySettingsPath(homeDir?: string): string; /** * Parse agy settings text. * * @param raw - File content * @returns The settings object, `{}` for an empty file, or null when it is not a JSON object */ export declare function parseAntigravitySettings(raw: string): Record | null; /** * Whether settings already select the Gemini API key provider. * * @param settings - Parsed settings * @returns True when `modelProvider` is `gemini` */ export declare function hasGeminiProvider(settings: Record): boolean; /** * Settings with the Gemini provider selected and the folders trusted. * * Pure: returns a new object and whether anything changed. Existing trusted * folders keep their order; new ones are appended once. * * @param settings - Current settings * @param trustedPaths - Folders to trust * @returns The merged settings and a change flag */ export declare function mergeAntigravitySettings(settings: Record, trustedPaths?: readonly string[]): { settings: Record; changed: boolean; }; /** * Make agy use the Gemini API key provider, and trust the given folders. * * Call before every agy launch Crewly makes, and when an Antigravity key is * saved. Serialized per file, so parallel agent launches do not lose each * other's trusted folders. * * @param options - Settings path, folders to trust, logger * @returns What was done * * @example * ```typescript * const result = await ensureAntigravityApiKeyProvider({ trustedPaths: [projectPath] }); * if (result === 'unparseable') throw new Error('fix agy settings first'); * ``` */ export declare function ensureAntigravityApiKeyProvider(options?: EnsureAntigravityProviderOptions): Promise; /** * Read whether agy is set to the Gemini API key provider (status display). * * @param settingsPath - Settings file * @returns True / false, or null when the file is missing or unreadable */ export declare function readAntigravityProviderIsGemini(settingsPath?: string): Promise; //# sourceMappingURL=antigravity-settings.utils.d.ts.map