import { ensureBinary, readBinaryVersion } from "./downloader.js"; type EnsureBinary = typeof ensureBinary; export declare function __setEnsureBinaryForTests(impl: EnsureBinary | null): void; export { readBinaryVersion }; declare function parsePathLookupOutput(output: string): string[]; /** * True when `binaryPath` begins with a recognized native-executable magic * number (Mach-O, ELF, or PE/`MZ`). False for script shims that start with a * shebang (`#!`) or anything else. * * This is the guard against a `which aft` / `where aft` PATH lookup resolving to * the `@cortexkit/aft` CLI's OWN node-script shim. The CLI publishes a `bin` * named `aft` (same name as the native binary), and npx prepends its * `node_modules/.bin` to PATH, so `which aft` can resolve to that shim. Probing * it with `--version` re-enters the CLI, which probes `which aft` again, which * forks `opencode --version` / `pi --version` for its harness report — an * exponential fork bomb (issue: self-resolution recursion). Native binaries * never start with `#!`, so a magic-number check rejects the shim regardless of * where it lives (npx cache, global `npm i -g`, etc.). */ export declare function isNativeExecutable(binaryPath: string): boolean; /** * Map the current `process.platform` and `process.arch` to the npm platform * package suffix (e.g. `"darwin-arm64"`, `"linux-x64"`). * * Exported for testability — agents and scripts can call this directly to * verify the platform mapping without running the full resolver. * * @throws {Error} with the exact `process.platform` and `process.arch` values * when the combination is unsupported. */ export declare function platformKey(platform?: string, arch?: string): string; /** * Locate the `aft` binary synchronously by checking (in order): * 1. Cached binary from previous auto-download (~/.cache/aft/bin/) * 2. npm platform package via `require.resolve(@cortexkit/aft-/bin/aft)` * 3. PATH lookup via `which aft` (or `where aft` on Windows) * 4. ~/.cargo/bin/aft (Rust cargo install location) * * @param expectedVersion Optional version (without `v` prefix) — when set, the * versioned cache for that version is checked first. Hosts that ship in * lock-step with the binary should pass their own package version so a * freshly downloaded binary is picked up before fallback resolution. * @returns Absolute path to the first binary found, or null if none found. */ export declare function findBinarySync(expectedVersion?: string): string | null; export declare const __test__: { parsePathLookupOutput: typeof parsePathLookupOutput; }; /** * Locate the `aft` binary, with auto-download as a last resort. * * Resolution order: * 0. Explicit AFT_BINARY_PATH (hermetic host probes) * 1. Cached binary (~/.cache/aft/bin/) * 2. npm platform package (@cortexkit/aft-) * 3. PATH lookup (which aft) * 4. ~/.cargo/bin/aft * 5. Auto-download from GitHub releases * * Returns the absolute path to the binary. * Throws a descriptive error with install instructions if all sources fail. */ export declare function findBinary(expectedVersion?: string): Promise; //# sourceMappingURL=resolver.d.ts.map