/** * @file Multi-agent CLI backend registry + role routing. Socket's review / * scan / fix skills delegate work to whichever agent CLIs are installed * (`codex`, `claude`, `kimi`, `opencode`), falling back through a per-role * preference order and skipping a pass when nothing usable is present. Before * this module each skill copied the same registry + detection block inline * (the canonical copy lived in * `.claude/skills/fleet/reviewing-code/run.mts`); the shared policy doc * (`_shared/multi-agent-backends.md`) flagged the extraction. Import * `BACKENDS` / `detectAvailableBackends` / `resolveBackendForRole` here * instead so a new backend or a routing-policy change is a single edit. The * registry is prompt-agnostic: it owns WHICH CLI runs and HOW its argv is * built ({ argv, outMode }), not WHAT to ask. A skill keeps its own role * table (prompts + per-role `preferenceOrder` + timeouts) and passes the * order into `resolveBackendForRole`. Detection uses `which` (cross-platform) * rather than `command -v` under `shell: true`, which mangles on Windows. The * resolver is pure — it returns a structured result (chosen backend + why) * and never logs, so the caller decides how to surface a fallback or a skip. * `opencode` is hybrid (it dispatches to whatever provider its own config * selects, e.g. Fireworks / Synthetic), so it is NEVER auto-picked from a * preference order — only when a caller names it explicitly — to keep model * attribution accurate. */ /** * A CLI backend Socket can delegate a pass to. */ export type BackendName = 'claude' | 'codex' | 'kimi' | 'opencode'; /** * How a backend's process emits its result. */ export type BackendOutMode = 'file' | 'stdout'; export interface BackendRun { readonly argv: readonly string[]; readonly outMode: BackendOutMode; } export interface BackendDescriptor { readonly bin: string; readonly hybrid: boolean; readonly name: BackendName; readonly run: (promptFile: string, outFile: string) => BackendRun; } export declare const BACKENDS: Readonly>; /** * The set of backends whose CLI is installed. Fans the `which` lookups out * concurrently rather than awaiting one at a time. */ export declare function detectAvailableBackends(): Promise>; /** * True when `value` names a known backend. */ export declare function isBackendName(value: string): value is BackendName; /** * True when the named CLI resolves on PATH (cross-platform via `which`). */ export declare function isCommandAvailable(bin: string): Promise; export type BackendResolution = { readonly backend: BackendName; readonly reason: 'override'; } | { readonly backend: BackendName; readonly reason: 'preference'; } | { readonly backend: BackendName; readonly reason: 'preference'; readonly overrideMissing: BackendName; } | { readonly backend: undefined; readonly reason: 'unavailable'; }; export interface ResolveBackendOptions { readonly preferenceOrder: readonly BackendName[]; readonly available: ReadonlySet; readonly override?: BackendName | undefined; } /** * Resolve which backend runs a pass, encoding Socket's detection policy * (`_shared/multi-agent-backends.md`): an installed explicit override wins; * else the first installed non-hybrid entry in the preference order; else * nothing, which skips the pass. Pure — returns the decision + why, never * logs. An override that isn't installed is reported via `overrideMissing` so * the caller can warn. */ export declare function resolveBackendForRole(options: ResolveBackendOptions): BackendResolution;