/**
 * Agent execution command.
 *
 * Registers the `agents run` command which spawns agent CLIs interactively
 * or headlessly. Supports profile resolution, version rotation, secrets
 * injection, and multi-agent fallback chains for rate-limit resilience.
 */
import { type Command } from 'commander';
import type { ExecEffort } from '../lib/exec.js';
import { RUN_AUTO_KEYWORD } from '../lib/types.js';
/** Validate a caller-supplied session id before it reaches tmux, paths, indexes, or remote dispatch. */
export declare function parseExplicitSessionId(value: string): string;
export interface RunAccountPickerRequest {
    requested: boolean;
    normalizedAgentSpec: string;
    valid: boolean;
}
/** Distinguish a terminal account-picker marker from an explicit @version pin. */
export declare function parseRunAccountPickerRequest(agentSpec: string): RunAccountPickerRequest;
/**
 * The `--device` alias family — the flags that mean "dispatch this run to another
 * machine over SSH". `--device` is canonical; `--on`/`--computer` are hidden
 * aliases. Returns the values actually given (so callers can both test presence
 * and read the target). Kept in ONE place because a guard that listed only a
 * subset silently let `--terminal --device` open a local tab and drop the remote
 * target — the drift this predicate exists to prevent.
 */
export declare function hostTargetGiven(options: {
    host?: string;
    device?: string;
    on?: string;
    computer?: string;
}): string[];
/** Return every option whose selection semantics conflict with an account choice. */
export declare function runAccountPickerConflicts(options: {
    resume?: string | boolean;
    strategy?: string;
    balanced?: boolean;
    lease?: string | boolean;
    box?: string;
    host?: string;
    device?: string;
    on?: string;
    computer?: string;
}): string[];
export { RUN_AUTO_KEYWORD };
/**
 * Whether `run auto` should default its host layer to the affinity pick (the
 * same machinery as `--device auto`). False when the caller pinned any host
 * flag, and false when this process was itself dispatched by a host run — the
 * dispatcher exports AGENTS_RUN_AUTO_HOST_RESOLVED=1 into the remote SHELL
 * (hosts/dispatch.ts remoteRunShellPrelude) because it already resolved the
 * host layer, and re-picking here would chain-hop the run across the fleet.
 * Pure so the pinning matrix is unit-testable.
 */
export declare function runAutoDefaultsToAffinity(options: {
    host?: string;
    device?: string;
    on?: string;
    computer?: string;
}, env?: NodeJS.ProcessEnv): boolean;
/**
 * Whether an interactive host dispatch must mint a correlation launch id and
 * resolve the remote session via the launch-id join (RUSH-2034), rather than
 * trusting a pre-known session id. `run auto` ALWAYS joins: the harness is
 * picked on the remote, so an explicit --session-id is only adopted when the
 * pick lands on claude — pre-registering it would strand a stale session-index
 * entry naming an id a non-claude pick never used (RUSH-2132). Pure so the
 * decision matrix is unit-testable.
 */
export declare function hostInteractiveNeedsCorrelationId(runAgent: string, hostSessionId: string | undefined, resumeId: string | undefined): boolean;
/**
 * Whether `cwd` is inside a git work tree.
 *
 * `--lease` / `--box` sync the working directory to the box through crabbox,
 * which enumerates the files to copy with `git ls-files`. Outside a git repo
 * that exits 128 (`fatal: not a git repository`) and the whole run dies at
 * "build sync file list: exit status 128" — AFTER the box is provisioned and
 * billed. Checking this up front lets the caller fail fast, before provisioning.
 */
export declare function isInsideGitWorkTree(cwd: string): boolean;
/** Absolute git toplevel for `cwd`, or null when it is not a git repo. */
export declare function gitToplevel(cwd: string): string | null;
/**
 * Network mode for a `--lease` run (F5, RUSH-1924). `--tailscale` forces the
 * tailnet, `--no-tailscale` forces public, and neither (undefined) defaults to
 * the tailnet ONLY in a reuse context (`--reuse`, `--box`, or a picked warm
 * box) — a one-shot solo `--lease` stays public. Pure so it is unit-testable;
 * the caller downgrades to `'public'` when no auth key is configured.
 */
export declare function computeNetMode(opts: {
    tailscale?: boolean;
    reuseContext: boolean;
}): 'public' | 'tailscale';
/** True when `repoRoot` is in the remembered always-fresh set. Pure. */
export declare function isAlwaysFreshRepo(repos: string[], repoRoot: string): boolean;
/** Add `repoRoot` to the always-fresh set (idempotent). Pure. */
export declare function addAlwaysFreshRepo(repos: string[], repoRoot: string): string[];
/** Path to the always-fresh state file under the USER agents dir (CLI-written per-user preference, never the maintainer-owned `.system` repo). */
export declare function leaseFreshReposPath(): string;
/** Read the remembered always-fresh repo roots (empty on any read/parse error). */
export declare function readAlwaysFreshRepos(): string[];
/** Persist the always-fresh repo roots. Best-effort — never throws. */
export declare function writeAlwaysFreshRepos(repos: string[]): void;
/**
 * Build the LoopConfig the driver consumes from CLI flags and/or a workflow's
 * `loop:` frontmatter block (issue #332). Returns undefined when neither source
 * activates a loop (the common single-shot run). CLI flags take precedence over
 * the workflow's declared values field-by-field, so `--max-iterations 5`
 * overrides a workflow's `max_iterations: 3`.
 *
 * `--loop` with no sub-options is a valid bare loop (driver applies its own
 * maxIterations safety cap). A workflow `loop:` block activates a loop even
 * without `--loop` so `agents run <workflow>` honors a declared loop.
 */
export declare function buildLoopConfig(flags: {
    loop?: boolean;
    maxIterations?: string;
    budget?: string;
    until?: string;
    interval?: string;
}, workflowLoop?: import('../lib/workflows.js').LoopConfigRaw): import('../lib/loop.js').LoopConfig | undefined;
/** Map a loop stop reason to a process exit code. condition-met/max are clean exits. */
export declare function loopExitCode(stoppedBy: import('../lib/loop.js').LoopStoppedBy): number;
/**
 * Drive a workflow's declarative `for_each:` fan-out end-to-end (issue #343).
 *
 * Runs the producer, expands one stage teammate per produced item (respecting
 * `max_items` / `DEFAULT_FOR_EACH_CAP`, surfacing any truncation — never a
 * silent cap), stages them into a fresh team via the existing `runForEach`
 * bridge, then drives the teams supervisor until the DAG drains. When a verify
 * panel is declared, tallies each item's `keep_if` gate from the skeptics'
 * terminal status and logs which items survived.
 *
 * Reuses the teams substrate wholesale — no new orchestration engine. Returns
 * the process exit code (0 on drain, 1 on producer failure / non-drain).
 */
export declare function runWorkflowForEach(spec: import('../lib/workflows.js').ForEachSpec, opts: {
    workflowName: string;
    cwd: string;
    effort?: ExecEffort;
}): Promise<number>;
/** Register the `agents run <agent> [prompt]` command. */
export declare function registerRunCommand(program: Command): void;
