/**
 * Factory (Droid) cloud provider.
 *
 * Dispatches to a Factory **Droid Computer** — a persistent cloud VM (managed
 * by Factory, or bring-your-own via `droid computer register`). There is no
 * `droid cloud run`; remote execution = reach the computer over the Droid relay
 * (`droid computer ssh <name>`) and run a headless `droid exec` there.
 *
 * `droid exec` is synchronous (it runs to completion and exits, unlike Codex
 * Cloud which is async server-side). So `dispatch()` runs the remote exec to
 * completion with `--output-format stream-json`, buffers the NDJSON events, and
 * `stream()` replays them. The task id is droid's own `session_id` (captured
 * from the run output), so it lines up with `droid exec -s <id>` for future
 * resume support.
 *
 * Transport note: the exact relay SSH composition (user + ProxyCommand) is
 * built in `buildSshArgs()` and must be confirmed against a live provisioned
 * Droid Computer (Factory auth required). `capabilities().available` gates on
 * the droid binary + a configured computer so the provider fails with a clear
 * message rather than misfiring when unconfigured.
 */
import type { CloudProvider, CloudTask, CloudTaskStatus, CloudEvent, CloudTarget, DispatchOptions, ProviderCapabilities, DroidAutonomy } from './types.js';
/** Locate the droid binary, checking agents-cli shims first then PATH. */
export declare function findDroidBinary(): string | null;
/** Normalize an autonomy value, falling back to the safe cloud default (`high`). */
export declare function resolveAutonomy(value: unknown, fallback?: DroidAutonomy): DroidAutonomy;
/**
 * Parse `droid computer list` text into targets. Defensive: the exact column
 * layout isn't documented, so we take the first whitespace token of each data
 * row as the computer name and keep the remainder as a label, skipping headers,
 * separators, and status messages. The interactive picker degrades to free-text
 * entry if this yields nothing, so an unexpected layout never blocks a dispatch.
 */
export declare function parseComputerList(text: string): CloudTarget[];
/**
 * Build the remote `droid exec` argv. Headless, stream-json output, given
 * autonomy. `sessionId` (when resuming) maps to `-s`.
 */
export declare function buildExecArgs(prompt: string, opts: {
    autonomy: DroidAutonomy;
    sessionId?: string;
}): string[];
/**
 * Build the `ssh` argv that runs a remote command on a Droid Computer through
 * the Droid relay. The relay is used as an OpenSSH ProxyCommand
 * (`droid computer ssh <name> --proxy`), so the connection rides Factory's
 * brokered tunnel rather than a directly reachable host.
 *
 * `remoteArgv` is the already-built remote command (e.g. droid exec argv); it is
 * shell-quoted into a single remote command string.
 */
export declare function buildSshArgs(computer: string, remoteBin: string, remoteArgv: string[], opts: {
    droidBin: string;
    user: string;
    port?: string;
    env?: Record<string, string>;
}): string[];
/** Map a droid stream-json `result.subtype` / `is_error` to a CloudTaskStatus. */
export declare function mapResultStatus(line: {
    is_error?: boolean;
    subtype?: string;
}): CloudTaskStatus;
/**
 * Map one parsed droid stream-json event to a CloudEvent. The stream-json
 * schema is only partially documented, so this is defensive: known shapes map
 * to typed events, everything else surfaces as `unknown` rather than being
 * dropped (mirrors the rest of the cloud event pipeline).
 */
export declare function mapDroidEvent(obj: Record<string, unknown>): CloudEvent;
export declare class FactoryCloudProvider implements CloudProvider {
    id: "factory";
    name: string;
    targetKind: "computer";
    private defaultComputer?;
    private defaultAutonomy;
    /** session_id → buffered run, populated by dispatch, drained by stream. */
    private runs;
    constructor(config?: {
        computer?: string;
        autonomy?: DroidAutonomy;
    });
    capabilities(): ProviderCapabilities;
    /** Enumerate Droid Computers via `droid computer list`. Throws if not signed in. */
    listTargets(): Promise<CloudTarget[]>;
    dispatch(options: DispatchOptions): Promise<CloudTask>;
    /** Run the remote droid exec to completion, collecting events + final result. */
    private runRemote;
    status(taskId: string): Promise<CloudTask>;
    list(): Promise<CloudTask[]>;
    stream(taskId: string): AsyncIterable<CloudEvent>;
    cancel(_taskId: string): Promise<void>;
    message(_taskId: string, _content: string): Promise<void>;
}
