/** * Gemini CLI backend. * * Implements the {@link AIBackend} interface for the Gemini CLI (`gemini`). * Parses the JSON output format produced by `gemini -p --output-format json`, * extracts token metrics from `stats.models`, and maps ARE model aliases * to Gemini model identifiers. * * @module */ import type { AIBackend, AICallOptions, AIResponse } from '../types.js'; /** * Gemini CLI backend. * * @example * ```typescript * const backend = new GeminiBackend(); * if (await backend.isAvailable()) { * const args = backend.buildArgs({ prompt: 'Hello', model: 'flash' }); * // → ['-p', 'Hello', '--output-format', 'json', '-m', 'gemini-3-flash-preview'] * } * ``` */ export declare class GeminiBackend implements AIBackend { readonly name = "gemini"; readonly cliCommand = "gemini"; isAvailable(): Promise; /** * Build CLI arguments for a Gemini invocation. * * Uses `-p ` for headless mode and `--output-format json` for * structured output. Unlike the Claude CLI (where `-p` means * "non-interactive mode" and the prompt goes to stdin), Gemini CLI's * `-p`/`--prompt` flag requires the prompt text as its argument value. * * The system prompt is folded into the prompt using XML tags since * Gemini CLI has no `--system-prompt` flag. */ buildArgs(options: AICallOptions): string[]; /** * Compose stdin input for the subprocess. * * Returns an empty string because Gemini CLI receives the prompt via * the `-p` argument, not stdin. */ composeStdinInput(_options: AICallOptions): string; /** * Parse Gemini CLI JSON output into a normalized {@link AIResponse}. * * Handles the `{ response, stats, error }` shape produced by * `gemini -p --output-format json`. Token metrics are extracted from * `stats.models[modelName].tokens` when available. */ parseResponse(stdout: string, durationMs: number, exitCode: number): AIResponse; getInstallInstructions(): string; /** * Extract the JSON object from stdout, handling potential prefix text * (e.g., version notices, warnings) before the JSON body. */ private extractJson; /** * Extract token counts and model name from the `stats.models` map. * * If multiple models appear (e.g., routing), tokens are aggregated and * the first model name is used. Returns zeros if stats are absent. */ private extractMetrics; } //# sourceMappingURL=gemini.d.ts.map