@cortexkit/aft-pi 0.19.3 → 0.19.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -31342,6 +31342,46 @@ function cleanupAbandonedOnnxAttempts(onnxBaseDir, ortDir) {
31342
31342
  warn(`[onnx] failed to sweep ${ortDir}: ${err}`);
31343
31343
  }
31344
31344
  }
31345
+ var REQUIRED_ORT_MAJOR = 1;
31346
+ var REQUIRED_ORT_MIN_MINOR = 20;
31347
+ function detectOnnxVersion(libDir, libName) {
31348
+ try {
31349
+ const entries = readdirSync(libDir);
31350
+ const barePrefix = libName.replace(/\.(so|dylib|dll)$/, "");
31351
+ for (const entry of entries) {
31352
+ if (!entry.startsWith(barePrefix))
31353
+ continue;
31354
+ const match = entry.match(/\.(\d+\.\d+\.\d+)(?:\.dylib)?$/);
31355
+ if (match)
31356
+ return match[1];
31357
+ }
31358
+ const base = join3(libDir, libName);
31359
+ if (existsSync2(base)) {
31360
+ try {
31361
+ const real = realpathSync(base);
31362
+ const m = real.match(/\.(\d+\.\d+\.\d+)(?:\.dylib)?$/);
31363
+ if (m)
31364
+ return m[1];
31365
+ } catch {}
31366
+ try {
31367
+ const target = readlinkSync(base);
31368
+ const m = target.match(/\.(\d+\.\d+\.\d+)(?:\.dylib)?$/);
31369
+ if (m)
31370
+ return m[1];
31371
+ } catch {}
31372
+ }
31373
+ } catch {}
31374
+ return null;
31375
+ }
31376
+ function isOnnxVersionCompatible(version) {
31377
+ const parts = version.split(".").map((p) => Number.parseInt(p, 10));
31378
+ const [major, minor] = parts;
31379
+ if (!Number.isFinite(major) || !Number.isFinite(minor))
31380
+ return false;
31381
+ if (major !== REQUIRED_ORT_MAJOR)
31382
+ return false;
31383
+ return minor >= REQUIRED_ORT_MIN_MINOR;
31384
+ }
31345
31385
  function findSystemOnnxRuntime(libName) {
31346
31386
  if (!libName)
31347
31387
  return null;
@@ -31352,9 +31392,14 @@ function findSystemOnnxRuntime(libName) {
31352
31392
  searchPaths.push("/usr/lib", "/usr/lib/x86_64-linux-gnu", "/usr/lib/aarch64-linux-gnu", "/usr/local/lib");
31353
31393
  }
31354
31394
  for (const dir of searchPaths) {
31355
- if (existsSync2(join3(dir, libName))) {
31356
- return dir;
31395
+ if (!existsSync2(join3(dir, libName)))
31396
+ continue;
31397
+ const version = detectOnnxVersion(dir, libName);
31398
+ if (version && !isOnnxVersionCompatible(version)) {
31399
+ warn(`Skipping system ONNX Runtime at ${dir} (v${version}); AFT requires ` + `v${REQUIRED_ORT_MAJOR}.${REQUIRED_ORT_MIN_MINOR}+. Falling through to AFT-managed download.`);
31400
+ continue;
31357
31401
  }
31402
+ return dir;
31358
31403
  }
31359
31404
  return null;
31360
31405
  }
@@ -48732,6 +48777,12 @@ var ReplaceParams = Type.Object({
48732
48777
  globs: Type.Optional(Type.Array(Type.String(), { description: "Include/exclude globs" })),
48733
48778
  dryRun: Type.Optional(Type.Boolean({ description: "Preview without applying (default: false)" }))
48734
48779
  });
48780
+ function appendHintSection(response, sections, theme) {
48781
+ const hint = asString(response.hint);
48782
+ if (hint && hint.length > 0) {
48783
+ sections.push(theme.fg("warning", hint));
48784
+ }
48785
+ }
48735
48786
  function appendScopeSections(response, sections, theme) {
48736
48787
  if (response.no_files_matched_scope === true) {
48737
48788
  sections.push(theme.fg("warning", "No files matched the scope (paths/globs resolved to zero files)"));
@@ -48760,6 +48811,7 @@ function buildAstSearchSections(payload, theme) {
48760
48811
  if (matches.length === 0) {
48761
48812
  const sections2 = [header, theme.fg("muted", "No AST matches found.")];
48762
48813
  appendScopeSections(response, sections2, theme);
48814
+ appendHintSection(response, sections2, theme);
48763
48815
  return sections2;
48764
48816
  }
48765
48817
  const grouped = groupByFile(matches, (match) => asString(match.file));
@@ -48808,6 +48860,7 @@ function buildAstReplaceSections(payload, theme) {
48808
48860
  if (files.length === 0) {
48809
48861
  sections.push(theme.fg("muted", "No files changed."));
48810
48862
  appendScopeSections(response, sections, theme);
48863
+ appendHintSection(response, sections, theme);
48811
48864
  return sections;
48812
48865
  }
48813
48866
  files.forEach((fileResult) => {
@@ -49975,7 +50028,7 @@ function registerLspTools(pi, ctx) {
49975
50028
  pi.registerTool({
49976
50029
  name: "lsp_diagnostics",
49977
50030
  label: "lsp diagnostics",
49978
- description: "On-demand LSP file/scope check. Spawns the relevant language server (if registered for the extension), opens the document, prefers LSP 3.17 pull diagnostics where supported, falls back to push + waitMs otherwise. NOT a project-wide type checker — for full coverage run `tsc --noEmit`, `cargo check`, `pyright`, etc.\n\nResponse fields: `diagnostics`, `total`, `files_with_errors`, `complete` (true = trustable absence), `lsp_servers_used` (per-server status, e.g. `pull_ok`, `push_only`, `binary_not_installed: <name>`, `no_root_marker (...)`), and (directory mode) `unchecked_files`.\n\nReading honestly:\n- `total: 0` + empty `lsp_servers_used` → **nothing was checked** (no server registered for this extension). Tell the user, don't claim 'no errors'.\n- `total: 0` + `pull_ok` → the file is genuinely clean.\n- `binary_not_installed: <name>` → server matched the extension but its binary isn't on PATH. Tell the user to install it.\n- `no_root_marker (...)` → server is registered but couldn't find a workspace root marker. The user's project layout doesn't match what the server expects.\n\nProvide `filePath` for a single file, `directory` for files under a path (workspace pull from active servers + 200-file walk for unchecked listing), or omit both to dump cached diagnostics.\n\n**When this tool gives an unhelpful answer**, run `bunx --bun @cortexkit/aft doctor lsp <filePath>` from a terminal to get a full per-server breakdown (registered servers, binary resolution, root-marker resolution, spawn outcome).",
50031
+ description: "On-demand LSP file/scope check. Spawns the relevant language server (if registered for the extension), opens the document, prefers LSP 3.17 pull diagnostics where supported, falls back to push + waitMs otherwise. NOT a project-wide type checker — for full coverage run `tsc --noEmit`, `cargo check`, `pyright`, etc.\n\nResponse fields: `diagnostics`, `total`, `files_with_errors`, `complete` (true = trustable absence), `lsp_servers_used` (per-server status, e.g. `pull_ok`, `push_only`, `binary_not_installed: <name>`, `no_root_marker (...)`), and (directory mode) `unchecked_files`.\n\nReading honestly:\n- `total: 0` + empty `lsp_servers_used` → **nothing was checked** (no server registered for this extension). Tell the user, don't claim 'no errors'.\n- `total: 0` + `pull_ok` → the file is genuinely clean.\n- `binary_not_installed: <name>` → server matched the extension but its binary isn't on PATH. Tell the user to install it.\n- `no_root_marker (...)` → server is registered but couldn't find a workspace root marker. The user's project layout doesn't match what the server expects.\n\nProvide `filePath` for a single file, `directory` for files under a path (workspace pull from active servers + 200-file walk for unchecked listing), or omit both to dump cached diagnostics.\n\n**When this tool gives an unhelpful answer**, run `npx @cortexkit/aft doctor lsp <filePath>` from a terminal to get a full per-server breakdown (registered servers, binary resolution, root-marker resolution, spawn outcome).",
49979
50032
  parameters: LspDiagnosticsParams,
49980
50033
  async execute(_toolCallId, params, _signal, _onUpdate, extCtx) {
49981
50034
  const hasFile = typeof params.filePath === "string" && params.filePath.length > 0;
@@ -1 +1 @@
1
- {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/tools/ast.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EASL,KAAK,iBAAiB,EAMvB,MAAM,qBAAqB,CAAC;AAM7B,QAAA,MAAM,YAAY;;;;;;EAehB,CAAC;AAEH,QAAA,MAAM,aAAa;;;;;;;EAOjB,CAAC;AAEH,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACrB;AAqBD,wCAAwC;AACxC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE,CAoD/E;AAED,wCAAwC;AACxC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EA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EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE,CAmDhF;AAED,wCAAwC;AACxC,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,iBAAiB,GAAG,kBAAkB,EAChD,IAAI,EAAE,MAAM,CAAC,OAAO,YAAY,CAAC,GAAG,MAAM,CAAC,OAAO,aAAa,CAAC,EAChE,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,iBAAiB,uCAa3B;AAED,wCAAwC;AACxC,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,iBAAiB,GAAG,kBAAkB,EAChD,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,EAChC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,iBAAiB,kFAiB3B;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI,CAsEhG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/aft-pi",
3
- "version": "0.19.3",
3
+ "version": "0.19.5",
4
4
  "type": "module",
5
5
  "description": "Pi coding agent extension for Agent File Tools (AFT) — tree-sitter and LSP-powered code analysis",
6
6
  "main": "dist/index.js",
@@ -22,18 +22,18 @@
22
22
  "prepublishOnly": "bun run build"
23
23
  },
24
24
  "dependencies": {
25
- "@cortexkit/aft-bridge": "0.19.3",
25
+ "@cortexkit/aft-bridge": "0.19.5",
26
26
  "@sinclair/typebox": "^0.34.33",
27
27
  "comment-json": "^5.0.0",
28
28
  "diff": "^8.0.4",
29
29
  "zod": "^4.1.8"
30
30
  },
31
31
  "optionalDependencies": {
32
- "@cortexkit/aft-darwin-arm64": "0.19.3",
33
- "@cortexkit/aft-darwin-x64": "0.19.3",
34
- "@cortexkit/aft-linux-arm64": "0.19.3",
35
- "@cortexkit/aft-linux-x64": "0.19.3",
36
- "@cortexkit/aft-win32-x64": "0.19.3"
32
+ "@cortexkit/aft-darwin-arm64": "0.19.5",
33
+ "@cortexkit/aft-darwin-x64": "0.19.5",
34
+ "@cortexkit/aft-linux-arm64": "0.19.5",
35
+ "@cortexkit/aft-linux-x64": "0.19.5",
36
+ "@cortexkit/aft-win32-x64": "0.19.5"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@mariozechner/pi-coding-agent": "*",