import { type RunOptions, type RunResult } from '../util/exec.js'; import { type ClaudeInvoker } from '../invoker.js'; import { type CapClassification } from './cap-detect.js'; export interface LaunchTarget { name: string; dir: string; } export interface LaunchDeps { claude: ClaudeInvoker; /** Injectable runner (defaults to runInherit); tests substitute a fake. */ run?: (bin: string, args: string[], opts?: RunOptions) => Promise; } export interface LaunchResult { exitCode: number; } /** * Launch claude on an account with inherited stdio (interactive passthrough). * Returns the raw exit code. */ export declare function launch(args: string[], account: LaunchTarget, deps: LaunchDeps): Promise; /** * Run claude with the arguments and the environment exactly as they arrived. * * For a SUBCOMMAND, "transparent" has to mean transparent: no added flags and * no redirected config. Pointing CLAUDE_CONFIG_DIR at an account profile looked * harmless and was not, because the profile is not where the operator's own * configuration lives: * * $ ccx run -- mcp list * No MCP servers configured. * * They had several. A wrong answer delivered confidently is worse than the * error this replaced. Inheriting the environment also keeps the daemon's * OS-level CLAUDE_CONFIG_DIR working, so a subcommand still follows the active * account wherever that is set up, and behaves exactly as it did before ccx was * installed where it is not. */ export declare function launchPassthrough(args: string[], deps: LaunchDeps): Promise; export type HeadlessRunner = (bin: string, args: string[], opts?: RunOptions) => Promise; export interface HeadlessDeps { claude: ClaudeInvoker; run?: HeadlessRunner; } export interface HeadlessResult extends RunResult { classification: CapClassification; } /** * Launch claude on an account capturing full output, then classify the outcome * (ok / capped / error). Used by the auto-rotation loop for headless runs, where * we must read stderr to detect a usage cap. */ export declare function launchHeadless(args: string[], account: LaunchTarget, deps: HeadlessDeps): Promise; export interface WatchedResult { exitCode: number; classification: CapClassification; /** * What the run actually printed. Carried out so a caller confirming a cap * can hand the verifier the real rendered text (which is how a per-model * limit gets matched to its model) instead of a one-line summary. */ stderr: string; } /** * Launch claude for an INTERACTIVE session: stdin and stdout are inherited (fully * transparent for the TUI and the extension's protocol) while stderr is echoed * through AND watched for the rate-limit signal. We cannot hot-swap a live * session, but detecting the cap here lets the NEXT session rotate. */ export declare function launchWatched(args: string[], account: LaunchTarget, deps: LaunchDeps): Promise; /** * Spawn any command with inherited stdin/stdout (transparent) while teeing and * watching stderr for the rate-limit signal. Used to run claude directly AND to * run an editor's exact "run this" command on a chosen account. */ export declare function spawnWatched(bin: string, args: string[], extraEnv?: Record): Promise;