/** * ONNX Runtime auto-fix logic for `aft doctor --fix`. * * The most common ONNX failure mode in production is: a distro ships an * old `libonnxruntime.so` (Ubuntu 22.04 still has v1.9, etc.), AFT's * resolver picks it up, the Rust pre-validator rejects it as too old, * and semantic search shows "failed" forever in the TUI sidebar. * * The error message tells users to either: * 1. `rm /usr/lib/.../libonnxruntime.so` — needs sudo, breaks anything * else linking that library, irreversible. * 2. Install ONNX 1.24 system-wide — manual, slow, distro-specific. * 3. Run doctor — diagnostics only. * * AFT owns a safe fourth option end-to-end: clear only * `/onnxruntime/` and immediately download a managed v1.24. * That's what `--fix` does. * * Pair this with the resolver fix in `packages/aft-bridge/src/onnx-runtime.ts` * (which now skips system installs below v1.20) and the user gets a working * AFT-managed ONNX even when the system library is too old, with NO change * to system files. */ import type { HarnessAdapter } from "../adapters/types.js"; import type { DiagnosticReport, HarnessDiagnostic } from "./diagnostics.js"; export interface OnnxFixCandidate { harness: HarnessDiagnostic; reason: string; storageOnnxDir: string; storageOnnxBytes: number; } /** * Identify harnesses where AFT can repair ONNX resolution by replacing its * managed cache and downloading a compatible runtime. Each entry carries a * human-readable reason so the prompt explains exactly what's wrong. */ export declare function findOnnxFixCandidates(report: DiagnosticReport): OnnxFixCandidate[]; export interface OnnxFixResult { cleared: number; installed: number; bytesReclaimed: number; errors: { path: string; error: string; }[]; } export interface OnnxFixOptions { /** Skip the user prompt and act immediately (used by tests + scripted flows). */ yes?: boolean; /** Inject a custom confirm impl for testing. */ confirmFn?: (message: string, defaultYes?: boolean) => Promise; /** Inject a custom rmSync impl for testing. */ rmFn?: (path: string, options: { recursive: boolean; force: boolean; }) => void; /** Inject the managed-runtime installer for testing. */ ensureFn?: (storageDir: string) => Promise; } export declare function runOnnxFix(adapters: HarnessAdapter[], report: DiagnosticReport, options?: OnnxFixOptions): Promise; //# sourceMappingURL=onnx-fix.d.ts.map