import { type BatchRunDeps } from "./commands/batch.ts"; import type { StartAgent } from "./commands/index.ts"; /** A parsed `run [--input …] [--result-out ]` argument vector. */ export interface ParsedCliRunArgs { readonly target: string | undefined; /** Everything after `--input`, joined with single spaces: inline JSON or `@`. */ readonly inputArg: string | undefined; readonly resultOut: string | undefined; readonly error: string | undefined; } /** * Parse the CLI's argv. Mirrors `parseRunArgs`' shape and error text, but argv is already tokenized: * `--result-out` takes the next token, `--input` consumes the rest of the vector (its payload is a * verbatim JSON object that routinely contains spaces), and anything else starting with `--` is a * syntax error rather than something a workflow could be named. */ export declare function parseRunArgv(argv: readonly string[]): ParsedCliRunArgs; /** Process identity inputs for {@link resolveCliStepInvocation}, injectable for tests. */ export interface CliProcessIdentity { /** `process.argv[1]` of the running CLI process. Defaults to the real one. */ readonly argv1?: string; /** `process.execPath` of the running CLI process. Defaults to the real one. */ readonly execPath?: string; /** Absolute path of this package's bin entry; defaults to the real one. */ readonly binEntry?: string; } /** * Pick the binary a step's subagent turn spawns. Delegates to the production * {@link resolvePiInvocation} with ONE exception: when argv[1] is this package's own CLI entry, the * invocation must NOT respawn it — that re-enters argument parsing rather than starting an agent. * The remaining cases are then exactly `resolvePiInvocation`'s case 2 (a compiled harness executable * respawns itself) and case 3 (an interpreter-launched standalone CLI falls back to `pi` on PATH). */ export declare function resolveCliStepInvocation(args: readonly string[], identity?: CliProcessIdentity): { command: string; args: readonly string[]; }; /** * The seams the CLI needs that tests cannot be allowed to touch for real. `cwd` and `startAgent` * isolate the filesystem and the model; the rest forward to {@link handleBatchRun}'s own process * seams (exit capture, stderr capture, injectable signal source). */ export interface CliDeps extends BatchRunDeps { readonly cwd?: string; /** Defaults to the harness-subprocess starter; tests inject a scripted or no-agent starter. */ readonly startAgent?: StartAgent; } /** * CLI entry: `main(["run", "", ...])`. Returns the exit code; the caller (bin script, or the * harness dispatching `kimchi workflow …`) sets it on the process. Everything user-facing — * progress, notifications, warnings, usage — is stderr; stdout carries NOTHING a scheduler could * mistake for output. */ export declare function main(args: readonly string[], deps?: CliDeps): Promise; //# sourceMappingURL=cli.d.ts.map