返回 html-video
gemini.ts
根目录 / packages / runtime / src / defs / gemini.ts
1 import type { AgentDef } from '../types.js';
2
3 /**
4 * Gemini CLI def (`gemini`, by Google — google-gemini/gemini-cli).
5 *
6 * Headless usage: piping a prompt on stdin to a non-TTY `gemini` invocation
7 * drops it into one-shot mode (prints the answer, exits) — verified locally
8 * 2026-06-04 (a stdin-only run went straight to the auth check rather than
9 * opening the interactive TUI). Default stdout is free-form text
10 * (`--output-format text`), which our extractor reads to pull the fenced
11 * ```html``` block, so we stay in plain mode.
12 *
13 * No model / API key is set here: if the user hasn't configured GEMINI_API_KEY
14 * (or another auth method) the CLI prints a clear auth error to stdout, which
15 * surfaces in the studio chat as-is.
16 */
17 export const gemini: AgentDef = {
18 id: 'gemini',
19 name: 'Gemini CLI',
20 bin: 'gemini',
21 versionArgs: ['--version'],
22 buildArgs(_prompt, _ctx) {
23 // Prompt arrives via stdin; no args needed for headless one-shot.
24 return [];
25 },
26 streamFormat: 'plain',
27 promptViaStdin: true,
28 installUrl: 'https://github.com/google-gemini/gemini-cli',
29 };
30
30 lines TYPESCRIPT