/**
 * Spawn helper for the Gemini CLI.
 *
 * Mirrors openai-codex/transport/codexSpawn.ts (process-level, framework-
 * agnostic structure) but encodes the Gemini-specific credential boundary
 * and the canonical one-shot argv.
 *
 * stdin discipline: like Codex, the binary may read stdin; without an
 * explicit EOF it can hang waiting for input. `spawn` + an immediate
 * `child.stdin.end()` defeats this (harmless and defensive regardless of
 * whether Gemini actually exhibits it).
 *
 * Output-byte cap (improves on codex): codexSpawn's `Buffer.concat` of
 * stdout chunks is UNBOUNDED — a runaway/looping child could OOM the
 * supervising process. `spawnGeminiAndWait` hard-caps captured stdout +
 * stderr at `maxOutputBytes` and flags the result `truncated`.
 */
/** Default output cap: 8 MiB per stream. A one-shot final message is tiny;
 *  the cap only fires on a runaway/looping child. */
export declare const DEFAULT_MAX_OUTPUT_BYTES: number;
/**
 * The canonical one-shot argv — pinned, no ambiguity.
 *
 *   gemini -m <model> --approval-mode default -p <prompt>
 *
 * - `-p/--prompt` is the documented one-shot entrypoint and takes the prompt
 *   as its SOLE value, so the prompt is exactly ONE argv element. A
 *   leading-dash prompt (`"--help me"`, `"-y do X"`) can NEVER be re-parsed
 *   as a flag — a thin but real argument-injection boundary. `--` is NOT
 *   used (the end-of-options separator is only meaningful for a positional
 *   prompt, which the canonical form never uses).
 * - `--approval-mode default` is pinned HERE (part of the canonical argv,
 *   not an optional add-on). `yolo`/`auto_edit`/`-y` let the model take
 *   filesystem/exec actions without confirmation — they are a capability-only
 *   mode, never reachable from this one-shot builder. (Analog of codex's
 *   `--sandbox read-only` pin at the call site.)
 */
export declare function buildGeminiOneShotArgv(model: string, prompt: string): string[];
/**
 * Argv for a RESUME turn — continue an existing gemini session by its stable
 * handle (a session UUID, or `latest`/index per `gemini --resume`).
 *
 * Empirically proven (gemini-cli 0.25.2, 2026-06-04): `gemini -m <model> -r
 * <uuid> -p "<next>"` restores the full prior context of that session across a
 * SEPARATE process invocation — so a multi-turn driver re-prompts with only the
 * next instruction, never the accumulated transcript (the quota-efficient path;
 * see `docs/specs/gemini-multi-turn-loop-driver.md`). The explicit `-m` is kept
 * because it ALSO bypasses gemini-cli's flaky pre-turn ModelRouterService
 * classifier (`generateJson` can exhaust retries on invalid-content and kill the
 * turn pre-generation); mirroring `buildGeminiOneShotArgv` keeps that bypass.
 */
export declare function buildGeminiResumeArgv(model: string, sessionHandle: string, prompt: string): string[];
/**
 * The Google/Gemini billing-capable vars that are UNCONDITIONALLY deleted
 * from the child env, regardless of allowlist contents. Any of these present
 * would silently route Gemini onto a billed API path instead of the
 * cached-OAuth/subscription path. A false-negative (silent billing) is
 * asymmetrically costly, so the delete is unconditional and the
 * geminiKeyLeakageCanary asserts none of these ever reaches the child.
 */
export declare const GEMINI_BILLING_ENV_VARS: readonly ["GEMINI_API_KEY", "GOOGLE_API_KEY", "GOOGLE_APPLICATION_CREDENTIALS", "GOOGLE_GENAI_USE_VERTEXAI", "GOOGLE_CLOUD_PROJECT"];
/**
 * Build the env for a `gemini` child process per the Rule-1a analog.
 * Constructs an explicit allowlist (variables not listed are dropped), then
 * UNCONDITIONALLY hard-deletes every billing-capable Google/Gemini var.
 */
export declare function buildGeminiChildEnv(parentEnv?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
export interface GeminiSpawnResult {
    exitCode: number | null;
    stdout: string;
    stderr: string;
    /** True when stdout OR stderr capture hit the byte cap and was truncated. */
    truncated: boolean;
}
export interface SpawnGeminiOptions {
    timeoutMs: number;
    env: NodeJS.ProcessEnv;
    signal?: AbortSignal;
    /** Hard cap on captured stdout/stderr bytes (each stream). */
    maxOutputBytes?: number;
}
/**
 * Spawn `gemini` with the given argv and wait for completion.
 *
 * - Closes stdin immediately (Gemini may otherwise block waiting for EOF).
 * - SIGTERM→SIGKILL on timeout (2s grace), AbortSignal handling.
 * - Bounds captured stdout/stderr at `maxOutputBytes` (default 8 MiB),
 *   killing the child and flagging `truncated` once the cap is exceeded.
 * - The benign `Loaded cached credentials` stderr line is NOT treated as a
 *   failure — the caller only fails on a non-zero exit code.
 */
export declare function spawnGeminiAndWait(binary: string, args: string[], options: SpawnGeminiOptions): Promise<GeminiSpawnResult>;
//# sourceMappingURL=geminiSpawn.d.ts.map