export declare const BITWARDEN_CLI_VERSION = "2026.7.0"; export declare const BITWARDEN_SECRETS_MANAGER_CLI_VERSION = "2.1.0"; export declare const FD_VERSION = "10.4.2"; export declare const RG_VERSION = "15.2.0"; export declare const JQ_VERSION = "1.8.2"; export declare const UV_VERSION = "0.11.28"; type ModuleRequire = ((id: string) => unknown) & { resolve?: (id: string) => string; }; interface ToolConfig { name: string; repo: string; binaryName: string; systemBinaryNames?: string[]; tagPrefix: string; getAssetName: (version: string, plat: string, architecture: string) => string | null; downloadKind?: "archive" | "binary"; pinnedVersion: string; getPinnedVersion?: (plat: string, architecture: string) => string | undefined; sha256ByAsset?: Readonly>; } declare const TOOLS: Record<"bw" | "bws" | "fd" | "jq" | "jscpd" | "rg" | "uv", ToolConfig>; export type ManagedToolName = keyof typeof TOOLS; export type ManagedToolProvisionFailureCode = "offline" | "unsupported_platform" | "installation_failed" | "not_found_after_install" | "unknown_tool"; export type ManagedToolResolution = { status: "available"; path: string; } | { status: "unavailable"; failureCode: ManagedToolProvisionFailureCode; message: string; }; export type ManagedToolResolver = (tool: ManagedToolName, silent?: boolean) => Promise; export declare function formatManagedToolProvisioningFailure(tool: ManagedToolName, resolution: Extract): string; export interface PinnedToolAsset { version: string; assetName: string; expectedSha256: string; } export declare function getPinnedToolAsset(tool: ManagedToolName, targetPlatform?: string, targetArchitecture?: string): PinnedToolAsset | null; export declare function getToolPath(tool: ManagedToolName): string | null; /** Presence check for a SYSTEM tool the doctor only ever reports on -- never installs. */ export interface SystemToolStatus { present: boolean; command?: string; version?: string; } /** * Detect a usable Python interpreter. SYSTEM tool (see src/core/doctor.ts): * the doctor reports presence/version, it never installs this itself. * * @param commands Override the candidate command names, for tests. */ export declare function detectPython(commands?: readonly string[]): SystemToolStatus; /** * Runs ` --version` (or `versionArgs`) and returns its trimmed * combined stdout+stderr, or undefined if the command can't be run. Used by * the doctor (src/core/doctor.ts) to show a version alongside a tool it has * already located by some other means (e.g. getToolPath("rg"), or the binary * path OllamaRuntime.detect() reports) -- callers that only need a yes/no * presence check should use commandExists/getToolPath/detectPython instead. */ export declare function probeVersion(command: string, versionArgs?: readonly string[]): string | undefined; export declare function verifyFileSha256(filePath: string, expectedSha256: string): Promise; /** Move a verified upstream standalone executable into Pi's managed bin directory. */ export declare function installStandaloneBinaryAsset(downloadedPath: string, binaryPath: string, targetPlatform?: string): void; export declare function runExclusiveToolDownload(tool: ManagedToolName, installer: () => Promise): Promise; /** * @param requires Override the resolution candidates, for tests (mirrors * fff-search-backend.ts's loadFffModule(requires?)). Whether this resolves * depends on the ambient environment -- @ff-labs/fff-node is a real npm * dependency (package.json), so moduleRequire succeeds wherever a normal * `npm install`/`npm ci` provisioned it (e.g. CI) even though it fails on a * dev checkout that never ran that install here (this repo resolves fff-node * via the separate managed-dir path instead). A test asserting "nothing is * available" must pass `[]` here rather than relying on that being true. */ export declare function loadAvailableFffNodePackage(requires?: readonly ModuleRequire[]): unknown | undefined; /** * Outcome of the most recent {@link ensureFffNodePackage} call, kept for * observability (e.g. a future `doctor` check) since the function itself * only ever returns the loaded module or `undefined` either way. * * `install-failed` is distinguished from `offline`/`unsupported-platform` * because it is the only one worth *retrying*: offline mode and an * unsupported platform are stable for the life of the process, but a real * install attempt can fail on a transient issue (registry hiccup, timeout) * that may no longer apply on the next search. See * DefaultFffSearchBackend.getFinder in fff-search-backend.ts, which uses * this distinction to decide whether a failed finder is retryable. */ export type FffInstallOutcome = { status: "already-available"; } | { status: "offline"; } | { status: "unsupported-platform"; } | { status: "installed"; } | { status: "install-failed"; reason: string; }; /** * How long a genuine install failure gates out a NEW npm spawn. An agent turn * can fire several find/grep calls in quick succession, and each one now * primes the finder in the background (see tryFffFind/tryFffGrep) -- without * this, a persistently-failing install (registry down, disk full, ...) would * re-spawn npm on every single one of those calls instead of once. * * This gates the SPAWN inside ensureFffNodePackage, not whether a failed * finder is retryable (see isFffInstallRetryable): DefaultFffSearchBackend * always evicts a failed finder so the next search re-enters this function, * and it is THIS cooldown check -- evaluated fresh, at call time -- that * decides whether that re-entry is a real attempt or a fast, spawn-free bail. * (An earlier version conflated the two: it gated eviction itself on the * cooldown, which is checked once, immediately after the failure it's timing * -- i.e. always still within the window -- so the failed finder was never * evicted and the retry never got a chance to happen at all.) */ export declare const FFF_INSTALL_RETRY_COOLDOWN_MS = 30000; /** The outcome of the last {@link ensureFffNodePackage} call, if any. */ export declare function getLastFffInstallOutcome(): FffInstallOutcome | undefined; /** Whether the last install outcome was a genuine failure worth retrying (as opposed to a stable "not applicable" result). Cooldown-independent by design -- see FFF_INSTALL_RETRY_COOLDOWN_MS. */ export declare function isFffInstallRetryable(): boolean; /** * Pure decision logic behind {@link isFffInstallCoolingDown}, exposed directly * so tests can assert the cooldown boundary without faking the system clock. */ export declare function computeIsFffInstallCoolingDown(outcome: FffInstallOutcome | undefined, failedAt: number | undefined, now: number): boolean; export declare function ensureFffNodePackage(silent?: boolean, forceManagedInstall?: boolean, /** Override the "is it already available" resolution candidates, for tests. See loadAvailableFffNodePackage's doc. */ requires?: readonly ModuleRequire[]): Promise; /** Ensure a tool is available while retaining the exact bounded provisioning outcome for callers. */ export declare function ensureToolWithDiagnostics(tool: ManagedToolName, silent?: boolean): Promise; export declare function ensureTool(tool: ManagedToolName, silent?: boolean): Promise; export {}; //# sourceMappingURL=tools-manager.d.ts.map