/** * Pre-select Gemini CLI's authentication method. * * Interactive Gemini CLI reads its auth method only from settings * (`security.auth.selectedType`). With none saved it opens the * "How would you like to authenticate for this project?" dialog on every * launch, even when GEMINI_API_KEY is set ("Existing API key detected ... * Select 'Gemini API Key' option to use it"). Non-interactive runs fall back * to the environment, which is why `gemini` looks fine when run by hand * without a terminal but a Crewly-launched session stalls on the dialog and * never reaches its ready prompt. * * Verified against Gemini CLI 0.61.0 in a clean HOME: no saved method + * GEMINI_API_KEY -> auth dialog at 2s; `selectedType: "gemini-api-key"` -> * ready prompt at 2s. * * @module utils/gemini-auth-settings */ /** Gemini CLI's value for "Use Gemini API Key". */ export declare const GEMINI_API_KEY_AUTH_TYPE = "gemini-api-key"; /** Top-level key older Gemini CLI settings (v1 schema) used for the auth method. */ export declare const LEGACY_AUTH_TYPE_KEY = "selectedAuthType"; /** What {@link ensureGeminiApiKeyAuthSelected} did. */ export type GeminiAuthSeedResult = /** No method was saved; "Use Gemini API Key" is now selected. */ 'seeded' /** A method was already saved (the user's choice); left untouched. */ | 'kept' /** The settings file exists but is not plain JSON; left untouched. */ | 'unparseable' /** Reading or writing failed; nothing changed. */ | 'error'; /** Minimal logger accepted by this module. */ export interface GeminiAuthSettingsLogger { warn(message: string, meta?: Record): void; info(message: string, meta?: Record): void; } /** * Path of Gemini CLI's user settings file. * * @returns `~/.gemini/settings.json` */ export declare function getDefaultGeminiUserSettingsPath(): string; /** * Select "Use Gemini API Key" in Gemini's user settings when no auth method * has been chosen yet. * * Call only when a Gemini API key is actually available to the session. * Never overrides an existing choice (e.g. Login with Google), never rewrites * a file it cannot parse, and preserves every other setting. * * @param logger - Optional logger * @param settingsPath - Override for tests; defaults to ~/.gemini/settings.json * @returns What was done * * @example * ```typescript * if (apiKey) await ensureGeminiApiKeyAuthSelected(logger); * ``` */ export declare function ensureGeminiApiKeyAuthSelected(logger?: GeminiAuthSettingsLogger, settingsPath?: string): Promise; //# sourceMappingURL=gemini-auth-settings.d.ts.map