/** `bin` is both the executable to look for on PATH and the choice's identity. */ export type CodingAgent = { label: string; bin: string; /** * Whether a launch prompt beginning `/` is expanded as a command. * Claude Code injects the named skill before the model's first turn, which * removes both a routing decision and the round trip that loads it. Only set * where that has actually been verified — everywhere else the prompt is * prose, and a stray leading slash would just be odd-looking prose. */ skillCommands?: boolean; }; /** The coding agents installed on this machine, in preference order. */ export declare function availableCodingAgents(): CodingAgent[]; /** * Open `agent` on `cwd` with `prompt`, replacing this command's terminal for as * long as the session lasts. Returns whether it actually started: a machine * that reports the binary on PATH can still fail to launch it. */ export declare function launchCodingAgent(payload: { agent: CodingAgent; cwd: string; prompt: string; }): boolean; /** * How to spawn `bin` with a brief as its last argument, optionally after * `leadingArgs` (`cargo-ai ask `). * * Never with `shell: true`, which is what this used to do on Windows to get at * the `.cmd` shims these agents ship as. Node does not escape arguments when * the shell is enabled — it joins them and hands the string to `cmd.exe` — and * a brief is multi-line markdown full of backticks and quotes. So that path * both mangled the prompt and let anything the brief interpolates (the `--icp` * text, the company answers) reach a command line. * * Invoking `cmd.exe` ourselves keeps `shell` off, so Node applies its own * Windows quoting to each argument. `/d` skips AutoRun, and `/s` makes cmd * treat the rest as one already-quoted command rather than re-parsing it. * * Exported for tests; `launchCodingAgent` and `spawnCargoAsk` are the * production callers. */ export declare function launchCommand(bin: string, prompt: string, leadingArgs?: readonly string[]): { command: string; args: string[]; carriesPrompt: boolean; }; /** * The prompt to launch `agent` with: the brief, preceded by the skill as a * command where the agent understands one. Loading the right skill up front is * worth more than it looks — see `HandoffSkill` in @cargo-ai/cli's start/brief * for what routing from scratch cost. * * Exported for tests; the handoffs are the only production callers. */ export declare function skillCommandPrompt(payload: { agent: CodingAgent; /** Absent when the skills are not installed, so none can be loaded. */ skill: string | undefined; prompt: string; }): string; /** * The brief the agent is opened with after the skills install has been * offered. Every handoff — coding agents and Ask Cargo — has to say the same * thing when the skills are missing, or one path starts a session that cannot * see `cargo-cdk` while the others still can. * * Exported for tests; `offerHandoff` is the only production caller. */ export declare function skillsFallbackBrief(prompt: string, skillsInstalled: boolean): string; /** * Install the skills if they are not there, then open `agent` on `cwd` with * the brief they imply. * * The handoffs — the `cdk` menu below (coding agents and Ask Cargo), and * `start`'s agent and demo destinations — were the same four steps each, * differing only in which brief they built. Written out separately they also * drifted: Ask Cargo skipped the install, and two of the others decided * differently what to tell an agent whose skills are missing. * * `brief` takes that answer rather than the caller pre-computing it, because * every brief says something different when the skills are absent and none of * them can know until the install has been offered. */ export declare function launchBriefed(payload: { agent: CodingAgent; cwd: string; /** Loaded as a command before the first turn, where the agent supports it. */ skill: string | undefined; brief: (skillsInstalled: boolean) => string; }): Promise<{ launched: boolean; skillsInstalled: boolean; }>; /** Whether `cargo-ai` is installed and available on PATH. */ export declare function cargoAiAvailable(): boolean; /** * Install the skills if they are not there, then open `cargo-ai ask` on `cwd` * with the brief they imply. Same four steps as `launchBriefed`; the spawn is * `cargo-ai ask` rather than a coding-agent binary. */ export declare function launchCargoAsk(payload: { cwd: string; skill: string | undefined; brief: (skillsInstalled: boolean) => string; }): Promise<{ launched: boolean; skillsInstalled: boolean; }>; /** * Offer to open a coding agent on `cwd` with `prompt`. Returns whether one was * launched, so the caller can decide whether its "next steps" block is still * worth printing. A machine with no coding agent installed never sees a menu. */ export declare function offerHandoff(payload: { cwd: string; prompt: string; /** Shown next to the agent's name, e.g. "build it with the cargo-project skill". */ hint: string; /** Loaded as a command before the first turn, where the agent supports it. */ skill?: string; }): Promise; //# sourceMappingURL=handoff.d.ts.map