/** * Host executable resolution + literal-argv runner (#2854). * * Finds the `claude` / `codex` CLI without a shell: no `which`, no * `execSync` strings. PATH is scanned with fs.access(X_OK); on Windows each * PATHEXT extension is tried. A resolved `.exe`/`.com` is spawned directly. * An npm `.cmd`/`.bat` shim is never handed to cmd.exe: it is accepted only * when the owning npm package sits next to it and declares the expected * `bin`, and then the package's JavaScript entry is run with Node. * * Exported so `@claude-flow/codex`'s initializer can adopt the same * resolver instead of `execSync('which codex')` (follow-up, not done here). */ export type HostId = 'claude' | 'codex'; export declare const HOST_IDS: readonly HostId[]; /** npm package that owns each host's launcher, and the bin name it declares. */ export declare const HOST_PACKAGES: Readonly>; /** Absolute-path override, for layouts PATH does not cover. */ export declare const HOST_OVERRIDE_ENV: Readonly>; export interface ExecFileResult { stdout: string; stderr: string; } /** Injectable process + fs boundary. Tests replace every member. */ export interface HostSystemDeps { execFile(file: string, args: readonly string[], options: { env: NodeJS.ProcessEnv; timeout: number; }): Promise; access(path: string, mode: number): Promise; readFile(path: string): Promise; env: NodeJS.ProcessEnv; platform: NodeJS.Platform; execPath: string; } /** The exact invocation carried through an operation: `file ...prefixArgs ...argv`. */ export interface HostInvocation { host: HostId; file: string; prefixArgs: string[]; /** The launcher found on disk (the shim, for a validated npm .cmd). */ resolvedFrom: string; } export type HostResolution = { ok: true; invocation: HostInvocation; } | { ok: false; host: HostId; reason: string; }; export declare function defaultHostSystemDeps(): HostSystemDeps; /** Resolve a host CLI once, before any mutation. Never runs a shell. */ export declare function resolveHostExecutable(host: HostId, deps?: HostSystemDeps): Promise; export interface HostRunResult { ok: boolean; stdout: string; stderr: string; error?: string; } /** Run `invocation` with a literal argv. No shell, no string concatenation. */ export declare function runHostArgv(invocation: HostInvocation, argv: readonly string[], deps?: HostSystemDeps, timeoutMs?: number): Promise; /** Human-readable form of an argv for dry-run output (display only, never executed). */ export declare function formatArgv(host: HostId, argv: readonly string[]): string; //# sourceMappingURL=host-executable.d.ts.map