@cortexkit/aft-pi 0.50.0 → 0.50.1

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.
Files changed (2) hide show
  1. package/dist/index.js +166 -54
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -9840,7 +9840,8 @@ function formatDroppedKeyWarnings(dropped) {
9840
9840
  // ../aft-bridge/dist/downloader.js
9841
9841
  import { spawnSync } from "node:child_process";
9842
9842
  import { createHash as createHash2, randomUUID } from "node:crypto";
9843
- import { chmodSync, closeSync, copyFileSync, createWriteStream, existsSync as existsSync2, mkdirSync, openSync, readFileSync as readFileSync3, renameSync, rmSync, statSync as statSync2, unlinkSync, writeSync } from "node:fs";
9843
+ import { chmodSync, closeSync, copyFileSync, createWriteStream, existsSync as existsSync2, mkdirSync, openSync, readdirSync, readFileSync as readFileSync3, renameSync, rmSync, statSync as statSync2, unlinkSync, writeSync } from "node:fs";
9844
+ import { hostname } from "node:os";
9844
9845
  import { join as join4 } from "node:path";
9845
9846
  import { Readable } from "node:stream";
9846
9847
  import { pipeline } from "node:stream/promises";
@@ -9865,8 +9866,8 @@ var REPO = "cortexkit/aft";
9865
9866
  var DOWNLOAD_TIMEOUT_MS = 300000;
9866
9867
  var LATEST_TAG_TIMEOUT_MS = 30000;
9867
9868
  var MAX_DOWNLOAD_BYTES = 200 * 1024 * 1024;
9868
- var DOWNLOAD_LOCK_TIMEOUT_MS = 120000;
9869
9869
  var DOWNLOAD_LOCK_STALE_MS = 10 * 60000;
9870
+ var DOWNLOAD_LOCK_TIMEOUT_MS = DOWNLOAD_LOCK_STALE_MS + 30000;
9870
9871
  function readBinaryVersion(binaryPath) {
9871
9872
  try {
9872
9873
  const result = spawnSync(binaryPath, ["--version"], {
@@ -9934,11 +9935,37 @@ async function downloadBinary(version) {
9934
9935
  let binaryTimeout = null;
9935
9936
  let checksumTimeout = null;
9936
9937
  const tmpPath = `${binaryPath}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`;
9938
+ const cleanUpPartialDownload = () => {
9939
+ try {
9940
+ if (existsSync2(tmpPath))
9941
+ unlinkSync(tmpPath);
9942
+ } catch {}
9943
+ };
9944
+ let interrupted = false;
9945
+ const cleanUpInterruptedDownload = () => {
9946
+ if (interrupted)
9947
+ return;
9948
+ interrupted = true;
9949
+ binaryController?.abort();
9950
+ checksumController?.abort();
9951
+ cleanUpPartialDownload();
9952
+ releaseLock?.();
9953
+ releaseLock = null;
9954
+ };
9955
+ const handleSigint = () => {
9956
+ cleanUpInterruptedDownload();
9957
+ process.off("SIGINT", handleSigint);
9958
+ process.kill(process.pid, "SIGINT");
9959
+ };
9960
+ const handleExit = () => cleanUpInterruptedDownload();
9961
+ process.once("SIGINT", handleSigint);
9962
+ process.once("exit", handleExit);
9937
9963
  try {
9938
9964
  if (!existsSync2(versionedCacheDir)) {
9939
9965
  mkdirSync(versionedCacheDir, { recursive: true });
9940
9966
  }
9941
9967
  releaseLock = await acquireDownloadLock(lockPath);
9968
+ sweepStaleDownloadTemps(versionedCacheDir, binaryName);
9942
9969
  if (existsSync2(binaryPath) && isExpectedCachedBinary(binaryPath, tag)) {
9943
9970
  return binaryPath;
9944
9971
  }
@@ -10014,13 +10041,11 @@ async function downloadBinary(version) {
10014
10041
  } catch (err) {
10015
10042
  const msg = err instanceof Error ? err.message : String(err);
10016
10043
  error(`Failed to download AFT binary: ${msg}`);
10017
- if (existsSync2(tmpPath)) {
10018
- try {
10019
- unlinkSync(tmpPath);
10020
- } catch {}
10021
- }
10044
+ cleanUpPartialDownload();
10022
10045
  return null;
10023
10046
  } finally {
10047
+ process.off("SIGINT", handleSigint);
10048
+ process.off("exit", handleExit);
10024
10049
  if (binaryTimeout) {
10025
10050
  binaryController?.abort();
10026
10051
  clearTimeout(binaryTimeout);
@@ -10046,17 +10071,85 @@ async function ensureBinary(version) {
10046
10071
  log("No cached binary found, downloading latest...");
10047
10072
  return downloadBinary();
10048
10073
  }
10049
- async function acquireDownloadLock(lockPath) {
10074
+ function createDownloadLockOwner() {
10075
+ return JSON.stringify({
10076
+ pid: process.pid,
10077
+ hostname: hostname(),
10078
+ createdAt: Date.now(),
10079
+ token: randomUUID()
10080
+ });
10081
+ }
10082
+ function parseDownloadLockOwner(raw) {
10083
+ try {
10084
+ const parsed = JSON.parse(raw);
10085
+ if (typeof parsed === "object" && parsed !== null) {
10086
+ const { pid, hostname: ownerHostname } = parsed;
10087
+ return {
10088
+ pid: typeof pid === "number" && Number.isSafeInteger(pid) && pid > 0 ? pid : null,
10089
+ hostname: typeof ownerHostname === "string" && ownerHostname ? ownerHostname : null
10090
+ };
10091
+ }
10092
+ } catch {}
10093
+ const legacyPid = Number(raw.split(":", 1)[0]);
10094
+ return {
10095
+ pid: Number.isSafeInteger(legacyPid) && legacyPid > 0 ? legacyPid : null,
10096
+ hostname: null
10097
+ };
10098
+ }
10099
+ function isProcessAlive(pid) {
10100
+ try {
10101
+ process.kill(pid, 0);
10102
+ return true;
10103
+ } catch (err) {
10104
+ return err.code !== "ESRCH";
10105
+ }
10106
+ }
10107
+ function isReclaimableDownloadLock(owner, ageMs, staleMs) {
10108
+ if (Math.abs(ageMs) > staleMs)
10109
+ return true;
10110
+ return (owner.hostname === null || owner.hostname === hostname()) && owner.pid !== null && !isProcessAlive(owner.pid);
10111
+ }
10112
+ function reclaimDownloadLock(lockPath, expectedOwner) {
10113
+ try {
10114
+ if (readFileSync3(lockPath, "utf-8") !== expectedOwner)
10115
+ return false;
10116
+ rmSync(lockPath, { force: true });
10117
+ return true;
10118
+ } catch (err) {
10119
+ if (err.code === "ENOENT")
10120
+ return true;
10121
+ throw err;
10122
+ }
10123
+ }
10124
+ function sweepStaleDownloadTemps(versionedCacheDir, binaryName) {
10125
+ const tempPrefix = `${binaryName}.`;
10126
+ try {
10127
+ for (const entry of readdirSync(versionedCacheDir, { withFileTypes: true })) {
10128
+ if (!entry.isFile() || !entry.name.startsWith(tempPrefix) || !entry.name.endsWith(".tmp")) {
10129
+ continue;
10130
+ }
10131
+ const tempPath = join4(versionedCacheDir, entry.name);
10132
+ const ageMs = Date.now() - statSync2(tempPath).mtimeMs;
10133
+ if (Math.abs(ageMs) > DOWNLOAD_LOCK_STALE_MS)
10134
+ unlinkSync(tempPath);
10135
+ }
10136
+ } catch {}
10137
+ }
10138
+ async function acquireDownloadLock(lockPath, timing = {}) {
10139
+ const timeoutMs = timing.timeoutMs ?? DOWNLOAD_LOCK_TIMEOUT_MS;
10140
+ const staleMs = timing.staleMs ?? DOWNLOAD_LOCK_STALE_MS;
10141
+ const pollIntervalMs = timing.pollIntervalMs ?? 100;
10050
10142
  const startedAt = Date.now();
10051
10143
  while (true) {
10052
10144
  try {
10053
- const owner = `${process.pid}:${Date.now()}:${randomUUID()}`;
10145
+ const owner = createDownloadLockOwner();
10054
10146
  const fd = openSync(lockPath, "wx");
10055
- writeSync(fd, owner);
10147
+ try {
10148
+ writeSync(fd, owner);
10149
+ } finally {
10150
+ closeSync(fd);
10151
+ }
10056
10152
  return () => {
10057
- try {
10058
- closeSync(fd);
10059
- } catch {}
10060
10153
  try {
10061
10154
  if (readFileSync3(lockPath, "utf-8") === owner) {
10062
10155
  rmSync(lockPath, { force: true });
@@ -10067,19 +10160,24 @@ async function acquireDownloadLock(lockPath) {
10067
10160
  const code = err.code;
10068
10161
  if (code !== "EEXIST")
10069
10162
  throw err;
10163
+ let existingOwner;
10164
+ let ageMs;
10070
10165
  try {
10071
- const ageMs = Date.now() - statSync2(lockPath).mtimeMs;
10072
- if (ageMs > DOWNLOAD_LOCK_STALE_MS) {
10073
- rmSync(lockPath, { force: true });
10166
+ existingOwner = readFileSync3(lockPath, "utf-8");
10167
+ ageMs = Date.now() - statSync2(lockPath).mtimeMs;
10168
+ } catch (readErr) {
10169
+ if (readErr.code === "ENOENT")
10170
+ continue;
10171
+ throw readErr;
10172
+ }
10173
+ if (isReclaimableDownloadLock(parseDownloadLockOwner(existingOwner), ageMs, staleMs)) {
10174
+ if (reclaimDownloadLock(lockPath, existingOwner))
10074
10175
  continue;
10075
- }
10076
- } catch {
10077
- continue;
10078
10176
  }
10079
- if (Date.now() - startedAt > DOWNLOAD_LOCK_TIMEOUT_MS) {
10177
+ if (Date.now() - startedAt > timeoutMs) {
10080
10178
  throw new Error(`Timed out waiting for download lock: ${lockPath}`);
10081
10179
  }
10082
- await new Promise((resolve3) => setTimeout(resolve3, 100));
10180
+ await new Promise((resolve3) => setTimeout(resolve3, pollIntervalMs));
10083
10181
  }
10084
10182
  }
10085
10183
  }
@@ -15008,7 +15106,7 @@ async function ensureStorageMigrated(opts) {
15008
15106
  throw new Error(`AFT storage migration failed (${detail}). ` + `Harness: ${opts.harness}. Legacy: ${legacyRoot}. Target: ${newRoot}. ` + `See log: ${logPath}. ` + `Plugin load aborted to prevent legacy/new state divergence.` + (stderrTail ? ` Stderr tail: ${stderrTail}` : "") + (stdoutTail ? ` Stdout tail: ${stdoutTail}` : ""));
15009
15107
  }
15010
15108
  // ../aft-bridge/dist/npm-resolver.js
15011
- import { readdirSync, statSync as statSync5 } from "node:fs";
15109
+ import { readdirSync as readdirSync2, statSync as statSync5 } from "node:fs";
15012
15110
  import { homedir as homedir9 } from "node:os";
15013
15111
  import { delimiter, dirname as dirname4, isAbsolute as isAbsolute3, join as join9 } from "node:path";
15014
15112
  function defaultDeps() {
@@ -15048,7 +15146,7 @@ function npmAdjacentToNode(deps) {
15048
15146
  function highestVersionedNodeBin(installsDir, name) {
15049
15147
  let entries;
15050
15148
  try {
15051
- entries = readdirSync(installsDir);
15149
+ entries = readdirSync2(installsDir);
15052
15150
  } catch {
15053
15151
  return null;
15054
15152
  }
@@ -15124,7 +15222,7 @@ function npmSpawnEnv(resolved, baseEnv = process.env) {
15124
15222
  // ../aft-bridge/dist/onnx-runtime.js
15125
15223
  import { execFileSync } from "node:child_process";
15126
15224
  import { createHash as createHash3 } from "node:crypto";
15127
- import { chmodSync as chmodSync3, closeSync as closeSync4, copyFileSync as copyFileSync3, createWriteStream as createWriteStream2, existsSync as existsSync7, lstatSync, mkdirSync as mkdirSync5, openSync as openSync4, readdirSync as readdirSync2, readFileSync as readFileSync6, readlinkSync, realpathSync as realpathSync2, rmSync as rmSync3, statSync as statSync6, symlinkSync, unlinkSync as unlinkSync4, writeFileSync as writeFileSync3 } from "node:fs";
15225
+ import { chmodSync as chmodSync3, closeSync as closeSync4, copyFileSync as copyFileSync3, createWriteStream as createWriteStream2, existsSync as existsSync7, lstatSync, mkdirSync as mkdirSync5, openSync as openSync4, readdirSync as readdirSync3, readFileSync as readFileSync6, readlinkSync, realpathSync as realpathSync2, rmSync as rmSync3, statSync as statSync6, symlinkSync, unlinkSync as unlinkSync4, writeFileSync as writeFileSync3 } from "node:fs";
15128
15226
  import { basename as basename2, dirname as dirname5, isAbsolute as isAbsolute4, join as join10, relative as relative2, resolve as resolve6, win32 } from "node:path";
15129
15227
  import { Readable as Readable2 } from "node:stream";
15130
15228
  import { pipeline as pipeline2 } from "node:stream/promises";
@@ -15238,7 +15336,7 @@ async function ensureOnnxRuntime(storageDir) {
15238
15336
  }
15239
15337
  function cleanupAbandonedStagingDirs(onnxBaseDir) {
15240
15338
  try {
15241
- const entries = readdirSync2(onnxBaseDir);
15339
+ const entries = readdirSync3(onnxBaseDir);
15242
15340
  for (const entry of entries) {
15243
15341
  if (!entry.startsWith(`${ORT_VERSION}.tmp.`))
15244
15342
  continue;
@@ -15249,7 +15347,7 @@ function cleanupAbandonedStagingDirs(onnxBaseDir) {
15249
15347
  let abandoned = false;
15250
15348
  if (Number.isFinite(pid) && pid > 0) {
15251
15349
  if (process.platform === "win32") {
15252
- const ownerAlive = isProcessAlive(pid);
15350
+ const ownerAlive = isProcessAlive2(pid);
15253
15351
  if (!ownerAlive) {
15254
15352
  abandoned = true;
15255
15353
  } else {
@@ -15261,7 +15359,7 @@ function cleanupAbandonedStagingDirs(onnxBaseDir) {
15261
15359
  }
15262
15360
  }
15263
15361
  } else {
15264
- abandoned = !isProcessAlive(pid);
15362
+ abandoned = !isProcessAlive2(pid);
15265
15363
  }
15266
15364
  } else {
15267
15365
  abandoned = true;
@@ -15312,7 +15410,7 @@ function isPathInsideRoot(root, candidate) {
15312
15410
  }
15313
15411
  function detectOnnxVersion(libDir, libName) {
15314
15412
  try {
15315
- const entries = readdirSync2(libDir);
15413
+ const entries = readdirSync3(libDir);
15316
15414
  const barePrefix = libName.replace(/\.(so|dylib|dll)$/, "");
15317
15415
  const expectedPrefix = process.platform === "win32" ? barePrefix.toLowerCase() : barePrefix;
15318
15416
  for (const entry of entries) {
@@ -15375,7 +15473,7 @@ function isWindowsSystem32Directory(dir) {
15375
15473
  }
15376
15474
  function directoryContainsLibrary(dir, libName) {
15377
15475
  try {
15378
- const entries = readdirSync2(dir);
15476
+ const entries = readdirSync3(dir);
15379
15477
  if (process.platform === "win32") {
15380
15478
  const expected = libName.toLowerCase();
15381
15479
  return entries.some((entry) => entry.toLowerCase() === expected);
@@ -15413,7 +15511,7 @@ function findSystemOnnxRuntime(libName) {
15413
15511
  if (!existsSync7(nugetPackageDir))
15414
15512
  return nugetPaths;
15415
15513
  try {
15416
- for (const entry of readdirSync2(nugetPackageDir, { withFileTypes: true })) {
15514
+ for (const entry of readdirSync3(nugetPackageDir, { withFileTypes: true })) {
15417
15515
  if (!entry.isDirectory())
15418
15516
  continue;
15419
15517
  if (entry.name === "__globalPackagesFolder" || entry.name.startsWith("."))
@@ -15508,7 +15606,7 @@ function validateExtractedTree(stagingRoot) {
15508
15606
  const realRoot = realpathSync2(stagingRoot);
15509
15607
  let totalBytes = 0;
15510
15608
  const walk = (dir) => {
15511
- const entries = readdirSync2(dir);
15609
+ const entries = readdirSync3(dir);
15512
15610
  for (const entry of entries) {
15513
15611
  const fullPath = join10(dir, entry);
15514
15612
  const lst = lstatSync(fullPath);
@@ -15566,7 +15664,7 @@ async function downloadOnnxRuntime(info, targetDir) {
15566
15664
  throw new Error(`Expected directory not found: ${extractedDir}`);
15567
15665
  }
15568
15666
  mkdirSync5(targetDir, { recursive: true });
15569
- const libFiles = readdirSync2(extractedDir).filter((f) => f.startsWith("libonnxruntime") || f.startsWith("onnxruntime"));
15667
+ const libFiles = readdirSync3(extractedDir).filter((f) => f.startsWith("libonnxruntime") || f.startsWith("onnxruntime"));
15570
15668
  const realFiles = [];
15571
15669
  const symlinks = [];
15572
15670
  for (const libFile of libFiles) {
@@ -15744,7 +15842,7 @@ ${new Date().toISOString()}
15744
15842
  }
15745
15843
  const age = Date.now() - lockMtimeMs;
15746
15844
  const ageWithinFresh = Math.abs(age) < STALE_LOCK_MS;
15747
- const ownerAlive = owningPid !== null && isProcessAlive(owningPid);
15845
+ const ownerAlive = owningPid !== null && isProcessAlive2(owningPid);
15748
15846
  if (ownerAlive && ageWithinFresh) {
15749
15847
  return false;
15750
15848
  }
@@ -15808,7 +15906,7 @@ function isWindowsProcessAlive(pid) {
15808
15906
  return false;
15809
15907
  }
15810
15908
  }
15811
- function isProcessAlive(pid) {
15909
+ function isProcessAlive2(pid) {
15812
15910
  if (process.platform === "win32")
15813
15911
  return isWindowsProcessAlive(pid);
15814
15912
  try {
@@ -16183,6 +16281,19 @@ function parseEditArray(value) {
16183
16281
  }
16184
16282
  return value;
16185
16283
  }
16284
+ function stripLineRangeSentinels(item) {
16285
+ const hasRangeField = ["startLine", "endLine", "content"].some((key) => hasOwn(item, key));
16286
+ if (!hasRangeField)
16287
+ return;
16288
+ if (item.oldString === "")
16289
+ delete item.oldString;
16290
+ if (item.newString === "")
16291
+ delete item.newString;
16292
+ if (item.replaceAll === false)
16293
+ delete item.replaceAll;
16294
+ if (item.occurrence === 1)
16295
+ delete item.occurrence;
16296
+ }
16186
16297
  function normalizeEditItem(value, index) {
16187
16298
  if (!value || typeof value !== "object" || Array.isArray(value)) {
16188
16299
  throw new InvalidRequestError(`edit: edits[${index}] must be an object`);
@@ -16191,6 +16302,7 @@ function normalizeEditItem(value, index) {
16191
16302
  const item = copyOwnProperties(source);
16192
16303
  normalizeItemAlias(item, "oldString", "oldText");
16193
16304
  normalizeItemAlias(item, "newString", "newText");
16305
+ stripLineRangeSentinels(item);
16194
16306
  const hasFindField = ["oldString", "newString", "replaceAll", "occurrence"].some((key) => hasOwn(item, key));
16195
16307
  const hasRangeField = ["startLine", "endLine", "content"].some((key) => hasOwn(item, key));
16196
16308
  if (hasFindField && hasRangeField) {
@@ -17766,7 +17878,7 @@ import {
17766
17878
  // package.json
17767
17879
  var package_default = {
17768
17880
  name: "@cortexkit/aft-pi",
17769
- version: "0.50.0",
17881
+ version: "0.50.1",
17770
17882
  type: "module",
17771
17883
  description: "Pi coding agent extension for Agent File Tools (AFT) — tree-sitter and LSP-powered code analysis",
17772
17884
  main: "dist/index.js",
@@ -17789,19 +17901,19 @@ var package_default = {
17789
17901
  "test:unit": "bun test src/__tests__ --path-ignore-patterns 'src/__tests__/e2e/**'"
17790
17902
  },
17791
17903
  dependencies: {
17792
- "@cortexkit/aft-bridge": "0.50.0",
17904
+ "@cortexkit/aft-bridge": "0.50.1",
17793
17905
  "comment-json": "^5.0.0",
17794
17906
  diff: "^8.0.4",
17795
17907
  typebox: "1.1.38",
17796
17908
  zod: "^4.4.3"
17797
17909
  },
17798
17910
  optionalDependencies: {
17799
- "@cortexkit/aft-darwin-arm64": "0.50.0",
17800
- "@cortexkit/aft-darwin-x64": "0.50.0",
17801
- "@cortexkit/aft-linux-arm64": "0.50.0",
17802
- "@cortexkit/aft-linux-x64": "0.50.0",
17803
- "@cortexkit/aft-win32-arm64": "0.50.0",
17804
- "@cortexkit/aft-win32-x64": "0.50.0"
17911
+ "@cortexkit/aft-darwin-arm64": "0.50.1",
17912
+ "@cortexkit/aft-darwin-x64": "0.50.1",
17913
+ "@cortexkit/aft-linux-arm64": "0.50.1",
17914
+ "@cortexkit/aft-linux-x64": "0.50.1",
17915
+ "@cortexkit/aft-win32-arm64": "0.50.1",
17916
+ "@cortexkit/aft-win32-x64": "0.50.1"
17805
17917
  },
17806
17918
  devDependencies: {
17807
17919
  "@earendil-works/pi-coding-agent": "^0.80.2",
@@ -18541,7 +18653,7 @@ __export(exports_external, {
18541
18653
  instanceof: () => _instanceof,
18542
18654
  includes: () => _includes,
18543
18655
  httpUrl: () => httpUrl,
18544
- hostname: () => hostname2,
18656
+ hostname: () => hostname3,
18545
18657
  hex: () => hex2,
18546
18658
  hash: () => hash,
18547
18659
  guid: () => guid2,
@@ -19992,7 +20104,7 @@ __export(exports_regexes, {
19992
20104
  idnEmail: () => idnEmail,
19993
20105
  httpProtocol: () => httpProtocol,
19994
20106
  html5Email: () => html5Email,
19995
- hostname: () => hostname,
20107
+ hostname: () => hostname2,
19996
20108
  hex: () => hex,
19997
20109
  guid: () => guid,
19998
20110
  extendedDuration: () => extendedDuration,
@@ -20050,7 +20162,7 @@ var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]
20050
20162
  var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
20051
20163
  var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
20052
20164
  var base64url = /^[A-Za-z0-9_-]*$/;
20053
- var hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
20165
+ var hostname2 = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
20054
20166
  var domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
20055
20167
  var httpProtocol = /^https?$/;
20056
20168
  var e164 = /^\+[1-9]\d{6,14}$/;
@@ -30674,7 +30786,7 @@ __export(exports_schemas2, {
30674
30786
  int: () => int,
30675
30787
  instanceof: () => _instanceof,
30676
30788
  httpUrl: () => httpUrl,
30677
- hostname: () => hostname2,
30789
+ hostname: () => hostname3,
30678
30790
  hex: () => hex2,
30679
30791
  hash: () => hash,
30680
30792
  guid: () => guid2,
@@ -31326,7 +31438,7 @@ var ZodCustomStringFormat = /* @__PURE__ */ $constructor("ZodCustomStringFormat"
31326
31438
  function stringFormat(format, fnOrRegex, _params = {}) {
31327
31439
  return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
31328
31440
  }
31329
- function hostname2(_params) {
31441
+ function hostname3(_params) {
31330
31442
  return _stringFormat(ZodCustomStringFormat, "hostname", exports_regexes.hostname, _params);
31331
31443
  }
31332
31444
  function hex2(_params) {
@@ -33489,7 +33601,7 @@ ${new Date().toISOString()}
33489
33601
  const age = Date.now() - lockMtimeMs;
33490
33602
  const ageWithinFresh = Math.abs(age) < STALE_LOCK_MS2;
33491
33603
  const skipLiveness = process.platform === "win32";
33492
- const ownerAlive = !skipLiveness && owningPid !== null && isProcessAlive2(owningPid);
33604
+ const ownerAlive = !skipLiveness && owningPid !== null && isProcessAlive3(owningPid);
33493
33605
  if (skipLiveness ? ageWithinFresh : ownerAlive && ageWithinFresh) {
33494
33606
  return false;
33495
33607
  }
@@ -33499,7 +33611,7 @@ ${new Date().toISOString()}
33499
33611
  } catch {}
33500
33612
  return tryClaim();
33501
33613
  }
33502
- function isProcessAlive2(pid) {
33614
+ function isProcessAlive3(pid) {
33503
33615
  try {
33504
33616
  process.kill(pid, 0);
33505
33617
  return true;
@@ -33733,7 +33845,7 @@ var NPM_LSP_TABLE = [
33733
33845
  ];
33734
33846
 
33735
33847
  // src/lsp-project-relevance.ts
33736
- import { existsSync as existsSync11, readdirSync as readdirSync3, readFileSync as readFileSync9 } from "node:fs";
33848
+ import { existsSync as existsSync11, readdirSync as readdirSync4, readFileSync as readFileSync9 } from "node:fs";
33737
33849
  import { join as join13 } from "node:path";
33738
33850
  var MAX_WALK_DIRS = 200;
33739
33851
  var MAX_WALK_DEPTH = 4;
@@ -33798,7 +33910,7 @@ function relevantExtensionsInProject(projectRoot, extToServer) {
33798
33910
  visitedDirs += 1;
33799
33911
  let entries;
33800
33912
  try {
33801
- entries = readdirSync3(current.dir, { withFileTypes: true });
33913
+ entries = readdirSync4(current.dir, { withFileTypes: true });
33802
33914
  } catch {
33803
33915
  continue;
33804
33916
  }
@@ -34218,7 +34330,7 @@ import {
34218
34330
  existsSync as existsSync13,
34219
34331
  lstatSync as lstatSync2,
34220
34332
  mkdirSync as mkdirSync8,
34221
- readdirSync as readdirSync4,
34333
+ readdirSync as readdirSync5,
34222
34334
  readFileSync as readFileSync11,
34223
34335
  readlinkSync as readlinkSync2,
34224
34336
  realpathSync as realpathSync3,
@@ -34621,7 +34733,7 @@ function validateExtraction(stagingRoot) {
34621
34733
  const walk = (dir) => {
34622
34734
  let entries;
34623
34735
  try {
34624
- entries = readdirSync4(dir);
34736
+ entries = readdirSync5(dir);
34625
34737
  } catch (err) {
34626
34738
  throw new Error(`failed to read staging dir ${dir}: ${err}`);
34627
34739
  }
@@ -38985,7 +39097,7 @@ var PLUGIN_VERSION = (() => {
38985
39097
  return "0.0.0";
38986
39098
  }
38987
39099
  })();
38988
- var ANNOUNCEMENT_VERSION = "0.50.0";
39100
+ var ANNOUNCEMENT_VERSION = "0.50.1";
38989
39101
  var ANNOUNCEMENT_FEATURES = [
38990
39102
  "Callgraph stays consistent under load: edits arriving mid-rebuild can no longer be silently lost from navigation results.",
38991
39103
  "aft_zoom handles real-world .jsonc: files with comment banners above the opening brace now resolve, and not-found errors point at the segment that actually failed (thanks @iceteaSA).",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/aft-pi",
3
- "version": "0.50.0",
3
+ "version": "0.50.1",
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",
@@ -23,19 +23,19 @@
23
23
  "test:unit": "bun test src/__tests__ --path-ignore-patterns 'src/__tests__/e2e/**'"
24
24
  },
25
25
  "dependencies": {
26
- "@cortexkit/aft-bridge": "0.50.0",
26
+ "@cortexkit/aft-bridge": "0.50.1",
27
27
  "comment-json": "^5.0.0",
28
28
  "diff": "^8.0.4",
29
29
  "typebox": "1.1.38",
30
30
  "zod": "^4.4.3"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@cortexkit/aft-darwin-arm64": "0.50.0",
34
- "@cortexkit/aft-darwin-x64": "0.50.0",
35
- "@cortexkit/aft-linux-arm64": "0.50.0",
36
- "@cortexkit/aft-linux-x64": "0.50.0",
37
- "@cortexkit/aft-win32-arm64": "0.50.0",
38
- "@cortexkit/aft-win32-x64": "0.50.0"
33
+ "@cortexkit/aft-darwin-arm64": "0.50.1",
34
+ "@cortexkit/aft-darwin-x64": "0.50.1",
35
+ "@cortexkit/aft-linux-arm64": "0.50.1",
36
+ "@cortexkit/aft-linux-x64": "0.50.1",
37
+ "@cortexkit/aft-win32-arm64": "0.50.1",
38
+ "@cortexkit/aft-win32-x64": "0.50.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@earendil-works/pi-coding-agent": "^0.80.2",