🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@cortexkit/aft

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cortexkit/aft - npm Package Compare versions

Comparing version
0.19.4
to
0.19.5
+69
dist/lib/onnx-fix.d.ts
/**
* 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.
*
* None of those is automatable safely. But there's a fourth option AFT
* actually owns end-to-end: clear `<storage_dir>/onnxruntime/` and let
* the bridge re-download v1.24 on next start. 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's ONNX resolution is broken and could be
* auto-fixed by clearing `<storage_dir>/onnxruntime/`. 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;
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<boolean>;
/** Inject a custom rmSync impl for testing. */
rmFn?: (path: string, options: {
recursive: boolean;
force: boolean;
}) => void;
}
/**
* Interactive ONNX fix flow. Returns the apply result (or null if no
* fixable issues were found, or the user declined).
*
* Safety contract:
* - Only deletes paths inside `<storage_dir>/onnxruntime/` (AFT-owned).
* - NEVER touches `/usr/lib/...`, `/opt/homebrew/lib/...`, or any other
* system path.
* - Asks consent before any deletion (unless `options.yes` is set).
* - Reports byte counts so the user knows what's being reclaimed.
*/
export declare function runOnnxFix(adapters: HarnessAdapter[], report: DiagnosticReport, options?: OnnxFixOptions): Promise<OnnxFixResult | null>;
//# sourceMappingURL=onnx-fix.d.ts.map
{"version":3,"file":"onnx-fix.d.ts","sourceRoot":"","sources":["../../src/lib/onnx-fix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAI5E,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,CAyClF;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,cAAc;IAC7B,iFAAiF;IACjF,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,gDAAgD;IAChD,S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force` cache clearing. OpenCode nukes
* its bunx package cache; Pi may be a no-op because Pi caches are managed by
* `pi install` itself.
* its npm/npx package cache (`~/.cache/opencode/packages/...`); Pi may be a
* no-op because Pi caches are managed by `pi install` itself.
*/

@@ -73,0 +73,0 @@ clearPluginCache(force: boolean): Promise<{

import type { HarnessAdapter } from "../adapters/types.js";
import { type ClearResult } from "../lib/lsp-cache.js";
export type DoctorClearTarget = "plugin-cache" | "lsp-cache";
export type DoctorClearTarget = "plugin-cache" | "lsp-cache" | "binary-cache";
export declare const DOCTOR_CLEAR_TARGET_OPTIONS: {

@@ -11,2 +11,3 @@ label: string;

clear: boolean;
fix: boolean;
force: boolean;

@@ -28,2 +29,7 @@ issue: boolean;

};
binaryCache?: {
cleared: number;
totalBytes: number;
errors: number;
};
}

@@ -36,2 +42,23 @@ export interface CacheClearOptions {

export declare function clearDoctorCaches(adapters: HarnessAdapter[], targets: readonly DoctorClearTarget[], options?: CacheClearOptions): Promise<CacheClearSummary>;
/**
* Clear cached `aft` binaries except the version this CLI ships with.
*
* Each release of `@cortexkit/aft` bundles a matching binary version; the
* plugin downloads it on first use into `~/.cache/aft/bin/v<version>/aft`.
* Older versions are kept around for rollback and to handle the
* "old plugin instance still running" scenario, but they pile up over
* time and a single binary is ~30 MB on macOS / Linux. Clearing keeps
* the version that matches the running CLI so we don't yank the binary
* a live OpenCode/Pi process is currently executing from.
*/
export interface BinaryCacheClearResult {
cleared: number;
bytesReclaimed: number;
errors: {
path: string;
error: string;
}[];
keptVersion: string | null;
}
export declare function clearOldBinaries(): BinaryCacheClearResult;
//# sourceMappingURL=doctor.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAK3D,OAAO,EAAE,KAAK,WAAW,EAAkB,MAAM,qBAAqB,CAAC;AAIvE,MAAM,MAAM,iBAAi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WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC1C,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,wBAAgB,gBAAgB,IAAI,sBAAsB,CAsDzD"}

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEH,QAAA,MAAM,OAAO,QAAkB,CAAC;AAChC,QAAA,MAAM,IAAI,UAAwB,CAAC;AAEnC,iBAAS,SAAS,IAAI,IAAI,CAwBzB;AAED,iBAAe,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAkBrC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEH,QAAA,MAAM,OAAO,QAAkB,CAAC;AAChC,QAAA,MAAM,IAAI,UAAwB,CAAC;AAEnC,iBAAS,SAAS,IAAI,IAAI,CAyBzB;AAED,iBAAe,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAmBrC"}

@@ -14,3 +14,18 @@ export interface AftRequest {

export declare function sendAftRequest(binaryPath: string, request: AftRequest): Promise<AftResponse>;
/**
* Send NDJSON requests to a long-running `aft` binary and collect
* matching responses.
*
* The contract is forgiving by design: any stdout line that isn't valid
* JSON is treated as binary noise (panic message, banner from a wrapper
* script, log line that escaped to stdout, etc.) and remembered for
* diagnostics rather than crashing the caller. We only report failure
* when the binary exits without producing the expected number of valid
* responses — and when we do, the error message names the specific
* binary path, the noise we observed, and the stderr tail so the user
* gets actionable context (issue #29 was a raw `SyntaxError` stack from
* `JSON.parse` on the first leaked stdout line, with no hint what to
* try next).
*/
export declare function sendAftRequests(binaryPath: string, requests: AftRequest[]): Promise<AftResponse[]>;
//# sourceMappingURL=aft-bridge.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"aft-bridge.d.ts","sourceRoot":"","sources":["../../src/lib/aft-bridge.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,WAAW,CAAC,CAKtB;AAED,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,UAAU,EAAE,GACrB,OAAO,CAAC,WAAW,EAAE,CAAC,CAgExB"}
{"version":3,"file":"aft-bridge.d.ts","sourceRoot":"","sources":["../../src/lib/aft-bridge.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAUD,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,WAAW,CAAC,CAKtB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,UAAU,EAAE,GACrB,OAAO,CAAC,WAAW,EAAE,CAAC,CAuExB"}
{
"name": "@cortexkit/aft",
"version": "0.19.4",
"version": "0.19.5",
"type": "module",

@@ -5,0 +5,0 @@ "description": "Unified CLI for Agent File Tools (AFT) — setup, doctor, and diagnostics across supported agent harnesses (OpenCode, Pi)",

@@ -8,6 +8,6 @@ # @cortexkit/aft

```bash
bunx --bun @cortexkit/aft setup # interactive setup for one or more harnesses
bunx --bun @cortexkit/aft doctor # check and fix configuration issues
bunx --bun @cortexkit/aft doctor --force # force clear plugin cache
bunx --bun @cortexkit/aft doctor --issue # collect diagnostics and open a GitHub issue
npx @cortexkit/aft setup # interactive setup for one or more harnesses
npx @cortexkit/aft doctor # check and fix configuration issues
npx @cortexkit/aft doctor --force # force clear plugin cache
npx @cortexkit/aft doctor --issue # collect diagnostics and open a GitHub issue
```

@@ -14,0 +14,0 @@

Sorry, the diff of this file is too big to display