@cortexkit/aft-pi 0.35.1 → 0.35.3
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.d.ts.map +1 -1
- package/dist/index.js +355 -157
- package/dist/lsp-auto-install.d.ts +19 -0
- package/dist/lsp-auto-install.d.ts.map +1 -1
- package/dist/shared/status.d.ts +23 -0
- package/dist/shared/status.d.ts.map +1 -1
- package/dist/tools/hoisted.d.ts +1 -1
- package/dist/tools/hoisted.d.ts.map +1 -1
- package/dist/tools/semantic.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -7709,9 +7709,9 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
7709
7709
|
value
|
|
7710
7710
|
} = comment;
|
|
7711
7711
|
const line_breaks_before = blank_lines > 0 ? blank_lines + (inline ? 0 : 1) : null;
|
|
7712
|
-
const
|
|
7712
|
+
const delimiter2 = line_breaks_before > 0 ? repeat_line_breaks(line_breaks_before, deeper_gap) : inline ? SPACE : i === 0 && symbol_tag === PREFIX_BEFORE_ALL && deeper_gap === EMPTY ? EMPTY : LF + deeper_gap;
|
|
7713
7713
|
const is_line_comment = type === "LineComment";
|
|
7714
|
-
str +=
|
|
7714
|
+
str += delimiter2 + comment_stringify(value, is_line_comment);
|
|
7715
7715
|
blank_lines = 0;
|
|
7716
7716
|
last_comment = comment;
|
|
7717
7717
|
});
|
|
@@ -7728,10 +7728,10 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
7728
7728
|
replacer = null;
|
|
7729
7729
|
indent = EMPTY;
|
|
7730
7730
|
};
|
|
7731
|
-
var
|
|
7731
|
+
var join9 = (one, two, gap) => one ? two ? one + two.trim() + LF + gap : one.trimRight() + repeat_line_breaks(Math.max(1, count_trailing_line_breaks(one)), gap) : two ? two.trimRight() + repeat_line_breaks(Math.max(1, count_trailing_line_breaks(two)), gap) : EMPTY;
|
|
7732
7732
|
var join_content = (inside, value, gap) => {
|
|
7733
7733
|
const comment = process_comments(value, PREFIX_BEFORE, gap + indent, true);
|
|
7734
|
-
return
|
|
7734
|
+
return join9(comment, inside, gap);
|
|
7735
7735
|
};
|
|
7736
7736
|
var stringify_string = (holder, key, value) => {
|
|
7737
7737
|
const raw = get_raw_string_literal(holder, key);
|
|
@@ -7753,13 +7753,13 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
7753
7753
|
if (i !== 0) {
|
|
7754
7754
|
inside += COMMA;
|
|
7755
7755
|
}
|
|
7756
|
-
const before =
|
|
7756
|
+
const before = join9(after_comma, process_comments(value, BEFORE(i), deeper_gap), deeper_gap);
|
|
7757
7757
|
inside += before || LF + deeper_gap;
|
|
7758
7758
|
inside += stringify(i, value, deeper_gap) || STR_NULL;
|
|
7759
7759
|
inside += process_comments(value, AFTER_VALUE(i), deeper_gap);
|
|
7760
7760
|
after_comma = process_comments(value, AFTER(i), deeper_gap);
|
|
7761
7761
|
}
|
|
7762
|
-
inside +=
|
|
7762
|
+
inside += join9(after_comma, process_comments(value, PREFIX_AFTER, deeper_gap), deeper_gap);
|
|
7763
7763
|
return BRACKET_OPEN + join_content(inside, value, gap) + BRACKET_CLOSE;
|
|
7764
7764
|
};
|
|
7765
7765
|
var object_stringify = (value, gap) => {
|
|
@@ -7780,13 +7780,13 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
7780
7780
|
inside += COMMA;
|
|
7781
7781
|
}
|
|
7782
7782
|
first = false;
|
|
7783
|
-
const before =
|
|
7783
|
+
const before = join9(after_comma, process_comments(value, BEFORE(key), deeper_gap), deeper_gap);
|
|
7784
7784
|
inside += before || LF + deeper_gap;
|
|
7785
7785
|
inside += quote(key) + process_comments(value, AFTER_PROP(key), deeper_gap) + COLON + process_comments(value, AFTER_COLON(key), deeper_gap) + SPACE + sv + process_comments(value, AFTER_VALUE(key), deeper_gap);
|
|
7786
7786
|
after_comma = process_comments(value, AFTER(key), deeper_gap);
|
|
7787
7787
|
};
|
|
7788
7788
|
keys.forEach(iteratee);
|
|
7789
|
-
inside +=
|
|
7789
|
+
inside += join9(after_comma, process_comments(value, PREFIX_AFTER, deeper_gap), deeper_gap);
|
|
7790
7790
|
return CURLY_BRACKET_OPEN + join_content(inside, value, gap) + CURLY_BRACKET_CLOSE;
|
|
7791
7791
|
};
|
|
7792
7792
|
function stringify(key, holder, gap) {
|
|
@@ -12140,7 +12140,6 @@ class BinaryBridge {
|
|
|
12140
12140
|
if (!snapshot || typeof snapshot !== "object" || Array.isArray(snapshot))
|
|
12141
12141
|
return;
|
|
12142
12142
|
this.cachedStatus = snapshot;
|
|
12143
|
-
this.logVia("Received status_changed push frame; cached AFT status snapshot");
|
|
12144
12143
|
for (const listener of this.statusListeners) {
|
|
12145
12144
|
this.deliverStatusSnapshot(listener, this.cachedStatus);
|
|
12146
12145
|
}
|
|
@@ -12816,6 +12815,35 @@ async function fetchLatestTag() {
|
|
|
12816
12815
|
clearTimeout(timeout);
|
|
12817
12816
|
}
|
|
12818
12817
|
}
|
|
12818
|
+
// ../aft-bridge/dist/edit-summary.js
|
|
12819
|
+
function formatEditSummary(data) {
|
|
12820
|
+
if (data.rolled_back === true) {
|
|
12821
|
+
return "Edit rolled back: the change produced invalid syntax, so the file was left unchanged.";
|
|
12822
|
+
}
|
|
12823
|
+
if (typeof data.files_modified === "number") {
|
|
12824
|
+
const n = data.files_modified;
|
|
12825
|
+
return `Applied edits to ${n} file${n === 1 ? "" : "s"}.`;
|
|
12826
|
+
}
|
|
12827
|
+
const additions = data.diff?.additions ?? 0;
|
|
12828
|
+
const deletions = data.diff?.deletions ?? 0;
|
|
12829
|
+
const counts = `+${additions}/-${deletions}`;
|
|
12830
|
+
if (data.created === true) {
|
|
12831
|
+
let s2 = `Created file (${counts}).`;
|
|
12832
|
+
if (data.formatted)
|
|
12833
|
+
s2 += " Auto-formatted.";
|
|
12834
|
+
return s2;
|
|
12835
|
+
}
|
|
12836
|
+
let detail = counts;
|
|
12837
|
+
if (typeof data.edits_applied === "number" && data.edits_applied > 1) {
|
|
12838
|
+
detail = `${counts}, ${data.edits_applied} edits`;
|
|
12839
|
+
} else if (typeof data.replacements === "number" && data.replacements > 1) {
|
|
12840
|
+
detail = `${counts}, ${data.replacements} replacements`;
|
|
12841
|
+
}
|
|
12842
|
+
let s = `Edited (${detail}).`;
|
|
12843
|
+
if (data.formatted)
|
|
12844
|
+
s += " Auto-formatted.";
|
|
12845
|
+
return s;
|
|
12846
|
+
}
|
|
12819
12847
|
// ../aft-bridge/dist/format.js
|
|
12820
12848
|
function compressionSavingsPercent(original, compressed) {
|
|
12821
12849
|
if (original <= 0)
|
|
@@ -13210,11 +13238,125 @@ async function ensureStorageMigrated(opts) {
|
|
|
13210
13238
|
const stdoutTail = tail(result.stdout);
|
|
13211
13239
|
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}` : ""));
|
|
13212
13240
|
}
|
|
13241
|
+
// ../aft-bridge/dist/npm-resolver.js
|
|
13242
|
+
import { readdirSync, statSync as statSync2 } from "node:fs";
|
|
13243
|
+
import { homedir as homedir5 } from "node:os";
|
|
13244
|
+
import { delimiter, dirname as dirname3, isAbsolute, join as join6 } from "node:path";
|
|
13245
|
+
function defaultDeps() {
|
|
13246
|
+
return {
|
|
13247
|
+
platform: process.platform,
|
|
13248
|
+
env: process.env,
|
|
13249
|
+
home: homedir5(),
|
|
13250
|
+
execPath: process.execPath
|
|
13251
|
+
};
|
|
13252
|
+
}
|
|
13253
|
+
function npmBinaryName(platform) {
|
|
13254
|
+
return platform === "win32" ? "npm.cmd" : "npm";
|
|
13255
|
+
}
|
|
13256
|
+
function isFile(p) {
|
|
13257
|
+
try {
|
|
13258
|
+
return statSync2(p).isFile();
|
|
13259
|
+
} catch {
|
|
13260
|
+
return false;
|
|
13261
|
+
}
|
|
13262
|
+
}
|
|
13263
|
+
function npmFromPath(deps) {
|
|
13264
|
+
const name = npmBinaryName(deps.platform);
|
|
13265
|
+
const raw = deps.env.PATH ?? deps.env.Path ?? "";
|
|
13266
|
+
for (const entry of raw.split(delimiter)) {
|
|
13267
|
+
const dir = entry.trim().replace(/^"|"$/g, "");
|
|
13268
|
+
if (!dir || !isAbsolute(dir))
|
|
13269
|
+
continue;
|
|
13270
|
+
if (isFile(join6(dir, name)))
|
|
13271
|
+
return dir;
|
|
13272
|
+
}
|
|
13273
|
+
return null;
|
|
13274
|
+
}
|
|
13275
|
+
function npmAdjacentToNode(deps) {
|
|
13276
|
+
const dir = dirname3(deps.execPath);
|
|
13277
|
+
return isFile(join6(dir, npmBinaryName(deps.platform))) ? dir : null;
|
|
13278
|
+
}
|
|
13279
|
+
function highestVersionedNodeBin(installsDir, name) {
|
|
13280
|
+
let entries;
|
|
13281
|
+
try {
|
|
13282
|
+
entries = readdirSync(installsDir);
|
|
13283
|
+
} catch {
|
|
13284
|
+
return null;
|
|
13285
|
+
}
|
|
13286
|
+
const candidates = entries.filter((v) => isFile(join6(installsDir, v, "bin", name))).sort((a, b) => compareVersionsDesc(a, b));
|
|
13287
|
+
return candidates.length > 0 ? join6(installsDir, candidates[0], "bin") : null;
|
|
13288
|
+
}
|
|
13289
|
+
function compareVersionsDesc(a, b) {
|
|
13290
|
+
const pa = a.replace(/^v/, "").split(".").map((n) => Number.parseInt(n, 10));
|
|
13291
|
+
const pb = b.replace(/^v/, "").split(".").map((n) => Number.parseInt(n, 10));
|
|
13292
|
+
for (let i = 0;i < Math.max(pa.length, pb.length); i++) {
|
|
13293
|
+
const na = Number.isFinite(pa[i]) ? pa[i] : -1;
|
|
13294
|
+
const nb = Number.isFinite(pb[i]) ? pb[i] : -1;
|
|
13295
|
+
if (na !== nb)
|
|
13296
|
+
return nb - na;
|
|
13297
|
+
}
|
|
13298
|
+
return b.localeCompare(a);
|
|
13299
|
+
}
|
|
13300
|
+
function wellKnownNpmDirs(deps) {
|
|
13301
|
+
const { platform, env, home } = deps;
|
|
13302
|
+
const name = npmBinaryName(platform);
|
|
13303
|
+
const dirs = [];
|
|
13304
|
+
const push = (dir) => {
|
|
13305
|
+
if (dir && !dirs.includes(dir))
|
|
13306
|
+
dirs.push(dir);
|
|
13307
|
+
};
|
|
13308
|
+
if (platform === "win32") {
|
|
13309
|
+
const programFiles = env.ProgramFiles || "C:\\Program Files";
|
|
13310
|
+
const appData = env.APPDATA;
|
|
13311
|
+
const localAppData = env.LOCALAPPDATA;
|
|
13312
|
+
push(join6(programFiles, "nodejs"));
|
|
13313
|
+
if (appData)
|
|
13314
|
+
push(join6(appData, "npm"));
|
|
13315
|
+
if (localAppData)
|
|
13316
|
+
push(join6(localAppData, "Volta", "bin"));
|
|
13317
|
+
if (env.NVM_SYMLINK)
|
|
13318
|
+
push(env.NVM_SYMLINK);
|
|
13319
|
+
} else {
|
|
13320
|
+
if (env.NVM_BIN)
|
|
13321
|
+
push(env.NVM_BIN);
|
|
13322
|
+
push(highestVersionedNodeBin(join6(home, ".nvm", "versions", "node"), name));
|
|
13323
|
+
push(highestVersionedNodeBin(join6(home, ".local", "share", "mise", "installs", "node"), name));
|
|
13324
|
+
push(highestVersionedNodeBin(join6(home, ".asdf", "installs", "nodejs"), name));
|
|
13325
|
+
push(join6(home, ".volta", "bin"));
|
|
13326
|
+
push(join6(home, ".asdf", "shims"));
|
|
13327
|
+
const systemDirs = deps.systemNpmDirs ?? (platform === "darwin" ? ["/opt/homebrew/bin", "/usr/local/bin"] : ["/usr/local/bin", "/usr/bin", join6(home, ".local", "bin")]);
|
|
13328
|
+
for (const dir of systemDirs)
|
|
13329
|
+
push(dir);
|
|
13330
|
+
}
|
|
13331
|
+
return dirs;
|
|
13332
|
+
}
|
|
13333
|
+
function resolveNpm(deps = defaultDeps()) {
|
|
13334
|
+
const name = npmBinaryName(deps.platform);
|
|
13335
|
+
const onPath = npmFromPath(deps);
|
|
13336
|
+
if (onPath)
|
|
13337
|
+
return { command: join6(onPath, name), binDir: onPath };
|
|
13338
|
+
const adjacent = npmAdjacentToNode(deps);
|
|
13339
|
+
if (adjacent)
|
|
13340
|
+
return { command: join6(adjacent, name), binDir: adjacent };
|
|
13341
|
+
for (const dir of wellKnownNpmDirs(deps)) {
|
|
13342
|
+
const candidate = join6(dir, name);
|
|
13343
|
+
if (isFile(candidate))
|
|
13344
|
+
return { command: candidate, binDir: dir };
|
|
13345
|
+
}
|
|
13346
|
+
return null;
|
|
13347
|
+
}
|
|
13348
|
+
function npmSpawnEnv(resolved, baseEnv = process.env) {
|
|
13349
|
+
if (!resolved.binDir)
|
|
13350
|
+
return { ...baseEnv };
|
|
13351
|
+
const existing = baseEnv.PATH ?? baseEnv.Path ?? "";
|
|
13352
|
+
const next = existing ? `${resolved.binDir}${delimiter}${existing}` : resolved.binDir;
|
|
13353
|
+
return { ...baseEnv, PATH: next };
|
|
13354
|
+
}
|
|
13213
13355
|
// ../aft-bridge/dist/onnx-runtime.js
|
|
13214
13356
|
import { execFileSync } from "node:child_process";
|
|
13215
13357
|
import { createHash as createHash2 } from "node:crypto";
|
|
13216
|
-
import { chmodSync as chmodSync3, closeSync as closeSync3, copyFileSync as copyFileSync3, createWriteStream as createWriteStream2, existsSync as existsSync5, lstatSync, mkdirSync as mkdirSync5, openSync as openSync3, readdirSync, readFileSync as readFileSync3, readlinkSync, realpathSync, rmSync as rmSync2, statSync as
|
|
13217
|
-
import { basename, dirname as
|
|
13358
|
+
import { chmodSync as chmodSync3, closeSync as closeSync3, copyFileSync as copyFileSync3, createWriteStream as createWriteStream2, existsSync as existsSync5, lstatSync, mkdirSync as mkdirSync5, openSync as openSync3, readdirSync as readdirSync2, readFileSync as readFileSync3, readlinkSync, realpathSync, rmSync as rmSync2, statSync as statSync3, symlinkSync, unlinkSync as unlinkSync3, writeFileSync as writeFileSync2 } from "node:fs";
|
|
13359
|
+
import { basename, dirname as dirname4, isAbsolute as isAbsolute2, join as join7, relative, resolve, win32 } from "node:path";
|
|
13218
13360
|
import { Readable as Readable2 } from "node:stream";
|
|
13219
13361
|
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
13220
13362
|
var ORT_VERSION = "1.24.4";
|
|
@@ -13277,10 +13419,10 @@ function getManualInstallHint() {
|
|
|
13277
13419
|
}
|
|
13278
13420
|
async function ensureOnnxRuntime(storageDir) {
|
|
13279
13421
|
const info = getPlatformInfo();
|
|
13280
|
-
const ortVersionDir =
|
|
13422
|
+
const ortVersionDir = join7(storageDir, "onnxruntime", ORT_VERSION);
|
|
13281
13423
|
const libName = info?.libName ?? "libonnxruntime.dylib";
|
|
13282
13424
|
const resolvedOrtDir = resolveCachedOnnxRuntimeDir(ortVersionDir, libName);
|
|
13283
|
-
const libPath =
|
|
13425
|
+
const libPath = join7(resolvedOrtDir, libName);
|
|
13284
13426
|
if (existsSync5(libPath)) {
|
|
13285
13427
|
const meta = readOnnxInstalledMeta(ortVersionDir);
|
|
13286
13428
|
if (meta?.sha256) {
|
|
@@ -13310,9 +13452,9 @@ async function ensureOnnxRuntime(storageDir) {
|
|
|
13310
13452
|
warn(`ONNX Runtime auto-download not available for ${process.platform}/${process.arch}. Install manually: ${getManualInstallHint()}`);
|
|
13311
13453
|
return null;
|
|
13312
13454
|
}
|
|
13313
|
-
const onnxBaseDir =
|
|
13455
|
+
const onnxBaseDir = join7(storageDir, "onnxruntime");
|
|
13314
13456
|
mkdirSync5(onnxBaseDir, { recursive: true });
|
|
13315
|
-
const lockPath =
|
|
13457
|
+
const lockPath = join7(onnxBaseDir, ONNX_LOCK_FILE);
|
|
13316
13458
|
cleanupAbandonedStagingDirs(onnxBaseDir);
|
|
13317
13459
|
if (!acquireLock(lockPath)) {
|
|
13318
13460
|
warn(`ONNX Runtime install already in progress in another process (lock: ${lockPath}). Skipping.`);
|
|
@@ -13327,11 +13469,11 @@ async function ensureOnnxRuntime(storageDir) {
|
|
|
13327
13469
|
}
|
|
13328
13470
|
function cleanupAbandonedStagingDirs(onnxBaseDir) {
|
|
13329
13471
|
try {
|
|
13330
|
-
const entries =
|
|
13472
|
+
const entries = readdirSync2(onnxBaseDir);
|
|
13331
13473
|
for (const entry of entries) {
|
|
13332
13474
|
if (!entry.startsWith(`${ORT_VERSION}.tmp.`))
|
|
13333
13475
|
continue;
|
|
13334
|
-
const stagingDir =
|
|
13476
|
+
const stagingDir = join7(onnxBaseDir, entry);
|
|
13335
13477
|
const parts = entry.split(".");
|
|
13336
13478
|
const pidStr = parts[parts.length - 2];
|
|
13337
13479
|
const pid = pidStr ? Number.parseInt(pidStr, 10) : NaN;
|
|
@@ -13343,7 +13485,7 @@ function cleanupAbandonedStagingDirs(onnxBaseDir) {
|
|
|
13343
13485
|
abandoned = true;
|
|
13344
13486
|
} else {
|
|
13345
13487
|
try {
|
|
13346
|
-
const ageMs = Date.now() -
|
|
13488
|
+
const ageMs = Date.now() - statSync3(stagingDir).mtimeMs;
|
|
13347
13489
|
abandoned = ageMs > STALE_LOCK_MS;
|
|
13348
13490
|
} catch {
|
|
13349
13491
|
abandoned = true;
|
|
@@ -13368,7 +13510,7 @@ function cleanupAbandonedStagingDirs(onnxBaseDir) {
|
|
|
13368
13510
|
}
|
|
13369
13511
|
function cleanupIncompleteTargetIfUnowned(ortDir) {
|
|
13370
13512
|
try {
|
|
13371
|
-
if (existsSync5(ortDir) && !existsSync5(
|
|
13513
|
+
if (existsSync5(ortDir) && !existsSync5(join7(ortDir, ONNX_INSTALLED_META_FILE))) {
|
|
13372
13514
|
log(`[onnx] removing half-populated install dir ${ortDir} (no meta file)`);
|
|
13373
13515
|
rmSync2(ortDir, { recursive: true, force: true });
|
|
13374
13516
|
}
|
|
@@ -13397,11 +13539,11 @@ function parseOnnxVersionFromDirectoryPath(value) {
|
|
|
13397
13539
|
}
|
|
13398
13540
|
function isPathInsideRoot(root, candidate) {
|
|
13399
13541
|
const rel = relative(root, candidate);
|
|
13400
|
-
return rel === "" || !rel.startsWith("../") && !rel.startsWith("..\\") && rel !== ".." && !
|
|
13542
|
+
return rel === "" || !rel.startsWith("../") && !rel.startsWith("..\\") && rel !== ".." && !isAbsolute2(rel) && !win32.isAbsolute(rel);
|
|
13401
13543
|
}
|
|
13402
13544
|
function detectOnnxVersion(libDir, libName) {
|
|
13403
13545
|
try {
|
|
13404
|
-
const entries =
|
|
13546
|
+
const entries = readdirSync2(libDir);
|
|
13405
13547
|
const barePrefix = libName.replace(/\.(so|dylib|dll)$/, "");
|
|
13406
13548
|
const expectedPrefix = process.platform === "win32" ? barePrefix.toLowerCase() : barePrefix;
|
|
13407
13549
|
for (const entry of entries) {
|
|
@@ -13412,7 +13554,7 @@ function detectOnnxVersion(libDir, libName) {
|
|
|
13412
13554
|
if (version)
|
|
13413
13555
|
return version;
|
|
13414
13556
|
}
|
|
13415
|
-
const base =
|
|
13557
|
+
const base = join7(libDir, libName);
|
|
13416
13558
|
if (existsSync5(base)) {
|
|
13417
13559
|
try {
|
|
13418
13560
|
const real = realpathSync(base);
|
|
@@ -13444,16 +13586,16 @@ function pathEnvValue() {
|
|
|
13444
13586
|
return process.env.PATH ?? process.env.Path ?? process.env.path ?? "";
|
|
13445
13587
|
}
|
|
13446
13588
|
function pathEntriesForPlatform() {
|
|
13447
|
-
const
|
|
13448
|
-
return pathEnvValue().split(
|
|
13589
|
+
const delimiter2 = process.platform === "win32" ? ";" : ":";
|
|
13590
|
+
return pathEnvValue().split(delimiter2).map((entry) => entry.trim().replace(/^"|"$/g, "")).filter((entry) => {
|
|
13449
13591
|
if (!entry || entry === "." || entry.includes("\x00"))
|
|
13450
13592
|
return false;
|
|
13451
|
-
return
|
|
13593
|
+
return isAbsolute2(entry) || win32.isAbsolute(entry);
|
|
13452
13594
|
});
|
|
13453
13595
|
}
|
|
13454
13596
|
function directoryContainsLibrary(dir, libName) {
|
|
13455
13597
|
try {
|
|
13456
|
-
const entries =
|
|
13598
|
+
const entries = readdirSync2(dir);
|
|
13457
13599
|
if (process.platform === "win32") {
|
|
13458
13600
|
const expected = libName.toLowerCase();
|
|
13459
13601
|
return entries.some((entry) => entry.toLowerCase() === expected);
|
|
@@ -13464,10 +13606,10 @@ function directoryContainsLibrary(dir, libName) {
|
|
|
13464
13606
|
}
|
|
13465
13607
|
}
|
|
13466
13608
|
function resolveCachedOnnxRuntimeDir(ortVersionDir, libName) {
|
|
13467
|
-
if (existsSync5(
|
|
13609
|
+
if (existsSync5(join7(ortVersionDir, libName)))
|
|
13468
13610
|
return ortVersionDir;
|
|
13469
|
-
const libSubdir =
|
|
13470
|
-
if (existsSync5(
|
|
13611
|
+
const libSubdir = join7(ortVersionDir, "lib");
|
|
13612
|
+
if (existsSync5(join7(libSubdir, libName)))
|
|
13471
13613
|
return libSubdir;
|
|
13472
13614
|
return ortVersionDir;
|
|
13473
13615
|
}
|
|
@@ -13482,21 +13624,21 @@ function findSystemOnnxRuntime(libName) {
|
|
|
13482
13624
|
} else if (process.platform === "win32") {
|
|
13483
13625
|
const programFiles = process.env.ProgramFiles ?? "C:\\Program Files";
|
|
13484
13626
|
const programFilesX86 = process.env["ProgramFiles(x86)"] ?? "C:\\Program Files (x86)";
|
|
13485
|
-
searchPaths.push(
|
|
13627
|
+
searchPaths.push(join7(programFiles, "onnxruntime", "lib"), join7(programFiles, "Microsoft ONNX Runtime", "lib"), join7(programFiles, "Microsoft Machine Learning", "lib"), join7(programFilesX86, "onnxruntime", "lib"), ...(() => {
|
|
13486
13628
|
const nugetPaths = [];
|
|
13487
13629
|
const userProfile = process.env.USERPROFILE ?? "";
|
|
13488
13630
|
if (!userProfile)
|
|
13489
13631
|
return nugetPaths;
|
|
13490
|
-
const nugetPackageDir =
|
|
13632
|
+
const nugetPackageDir = join7(userProfile, ".nuget", "packages", "microsoft.ml.onnxruntime");
|
|
13491
13633
|
if (!existsSync5(nugetPackageDir))
|
|
13492
13634
|
return nugetPaths;
|
|
13493
13635
|
try {
|
|
13494
|
-
for (const entry of
|
|
13636
|
+
for (const entry of readdirSync2(nugetPackageDir, { withFileTypes: true })) {
|
|
13495
13637
|
if (!entry.isDirectory())
|
|
13496
13638
|
continue;
|
|
13497
13639
|
if (entry.name === "__globalPackagesFolder" || entry.name.startsWith("."))
|
|
13498
13640
|
continue;
|
|
13499
|
-
nugetPaths.push(
|
|
13641
|
+
nugetPaths.push(join7(nugetPackageDir, entry.name, "runtimes", "win-x64", "native"), join7(nugetPackageDir, entry.name, "runtimes", "win-arm64", "native"));
|
|
13500
13642
|
}
|
|
13501
13643
|
} catch (err) {
|
|
13502
13644
|
warn(`Failed to scan NuGet ONNX Runtime cache ${nugetPackageDir}: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -13518,7 +13660,7 @@ function findSystemOnnxRuntime(libName) {
|
|
|
13518
13660
|
});
|
|
13519
13661
|
const unknownVersionPaths = [];
|
|
13520
13662
|
for (const dir of uniquePaths) {
|
|
13521
|
-
const libPath =
|
|
13663
|
+
const libPath = join7(dir, libName);
|
|
13522
13664
|
if (process.platform === "win32") {
|
|
13523
13665
|
if (!directoryContainsLibrary(dir, libName))
|
|
13524
13666
|
continue;
|
|
@@ -13554,7 +13696,7 @@ async function downloadFileWithCap(url, destPath) {
|
|
|
13554
13696
|
if (Number.isFinite(advertised) && advertised > MAX_DOWNLOAD_BYTES2) {
|
|
13555
13697
|
throw new Error(`Content-Length ${advertised} exceeds max ${MAX_DOWNLOAD_BYTES2}`);
|
|
13556
13698
|
}
|
|
13557
|
-
mkdirSync5(
|
|
13699
|
+
mkdirSync5(dirname4(destPath), { recursive: true });
|
|
13558
13700
|
let bytesWritten = 0;
|
|
13559
13701
|
const guard = new TransformStream({
|
|
13560
13702
|
transform(chunk, transformController) {
|
|
@@ -13582,21 +13724,21 @@ function validateExtractedTree(stagingRoot) {
|
|
|
13582
13724
|
const realRoot = realpathSync(stagingRoot);
|
|
13583
13725
|
let totalBytes = 0;
|
|
13584
13726
|
const walk = (dir) => {
|
|
13585
|
-
const entries =
|
|
13727
|
+
const entries = readdirSync2(dir);
|
|
13586
13728
|
for (const entry of entries) {
|
|
13587
|
-
const fullPath =
|
|
13729
|
+
const fullPath = join7(dir, entry);
|
|
13588
13730
|
const lst = lstatSync(fullPath);
|
|
13589
13731
|
if (lst.isSymbolicLink()) {
|
|
13590
13732
|
const linkTarget = readlinkSync(fullPath);
|
|
13591
|
-
const resolvedTarget = resolve(
|
|
13733
|
+
const resolvedTarget = resolve(dirname4(fullPath), linkTarget);
|
|
13592
13734
|
const rel2 = relative(realRoot, resolvedTarget);
|
|
13593
|
-
if (rel2.startsWith("..") ||
|
|
13735
|
+
if (rel2.startsWith("..") || isAbsolute2(rel2) || win32.isAbsolute(rel2)) {
|
|
13594
13736
|
throw new Error(`extracted symlink ${fullPath} points outside staging root: ${linkTarget}`);
|
|
13595
13737
|
}
|
|
13596
13738
|
continue;
|
|
13597
13739
|
}
|
|
13598
13740
|
const rel = relative(realRoot, fullPath);
|
|
13599
|
-
if (rel.startsWith("..") ||
|
|
13741
|
+
if (rel.startsWith("..") || isAbsolute2(rel) || win32.isAbsolute(rel)) {
|
|
13600
13742
|
throw new Error(`extracted entry ${fullPath} escapes staging root`);
|
|
13601
13743
|
}
|
|
13602
13744
|
if (lst.isDirectory()) {
|
|
@@ -13619,7 +13761,7 @@ async function downloadOnnxRuntime(info, targetDir) {
|
|
|
13619
13761
|
const tmpDir = `${targetDir}.tmp.${process.pid}.${Date.now().toString(36)}`;
|
|
13620
13762
|
try {
|
|
13621
13763
|
mkdirSync5(tmpDir, { recursive: true });
|
|
13622
|
-
const archivePath =
|
|
13764
|
+
const archivePath = join7(tmpDir, `onnxruntime.${info.archiveType}`);
|
|
13623
13765
|
await downloadFileWithCap(url, archivePath);
|
|
13624
13766
|
const archiveSha256 = sha256File(archivePath);
|
|
13625
13767
|
log(`ONNX Runtime archive sha256=${archiveSha256}`);
|
|
@@ -13635,16 +13777,16 @@ async function downloadOnnxRuntime(info, targetDir) {
|
|
|
13635
13777
|
unlinkSync3(archivePath);
|
|
13636
13778
|
} catch {}
|
|
13637
13779
|
validateExtractedTree(tmpDir);
|
|
13638
|
-
const extractedDir =
|
|
13780
|
+
const extractedDir = join7(tmpDir, info.assetName, "lib");
|
|
13639
13781
|
if (!existsSync5(extractedDir)) {
|
|
13640
13782
|
throw new Error(`Expected directory not found: ${extractedDir}`);
|
|
13641
13783
|
}
|
|
13642
13784
|
mkdirSync5(targetDir, { recursive: true });
|
|
13643
|
-
const libFiles =
|
|
13785
|
+
const libFiles = readdirSync2(extractedDir).filter((f) => f.startsWith("libonnxruntime") || f.startsWith("onnxruntime"));
|
|
13644
13786
|
const realFiles = [];
|
|
13645
13787
|
const symlinks = [];
|
|
13646
13788
|
for (const libFile of libFiles) {
|
|
13647
|
-
const src =
|
|
13789
|
+
const src = join7(extractedDir, libFile);
|
|
13648
13790
|
try {
|
|
13649
13791
|
const stat = lstatSync(src);
|
|
13650
13792
|
log(`ORT extract: ${libFile} — isSymlink=${stat.isSymbolicLink()}, isFile=${stat.isFile()}, size=${stat.size}`);
|
|
@@ -13659,7 +13801,7 @@ async function downloadOnnxRuntime(info, targetDir) {
|
|
|
13659
13801
|
}
|
|
13660
13802
|
}
|
|
13661
13803
|
copyOnnxLibraries(info, extractedDir, targetDir, realFiles, symlinks);
|
|
13662
|
-
const libPath =
|
|
13804
|
+
const libPath = join7(targetDir, info.libName);
|
|
13663
13805
|
let libHash = null;
|
|
13664
13806
|
try {
|
|
13665
13807
|
libHash = sha256File(libPath);
|
|
@@ -13684,8 +13826,8 @@ async function downloadOnnxRuntime(info, targetDir) {
|
|
|
13684
13826
|
function copyOnnxLibraries(info, extractedDir, targetDir, realFiles, symlinks, copyFile = copyFileSync3) {
|
|
13685
13827
|
const requiredLibs = new Set([info.libName]);
|
|
13686
13828
|
for (const libFile of realFiles) {
|
|
13687
|
-
const src =
|
|
13688
|
-
const dst =
|
|
13829
|
+
const src = join7(extractedDir, libFile);
|
|
13830
|
+
const dst = join7(targetDir, libFile);
|
|
13689
13831
|
try {
|
|
13690
13832
|
copyFile(src, dst);
|
|
13691
13833
|
if (process.platform !== "win32") {
|
|
@@ -13701,12 +13843,12 @@ function copyOnnxLibraries(info, extractedDir, targetDir, realFiles, symlinks, c
|
|
|
13701
13843
|
}
|
|
13702
13844
|
const targetRoot = realpathSync(targetDir);
|
|
13703
13845
|
for (const link of symlinks) {
|
|
13704
|
-
const dst =
|
|
13846
|
+
const dst = join7(targetDir, link.name);
|
|
13705
13847
|
try {
|
|
13706
13848
|
unlinkSync3(dst);
|
|
13707
13849
|
} catch {}
|
|
13708
|
-
const dstForContainment =
|
|
13709
|
-
const resolvedTarget = resolve(
|
|
13850
|
+
const dstForContainment = join7(targetRoot, link.name);
|
|
13851
|
+
const resolvedTarget = resolve(dirname4(dstForContainment), link.target);
|
|
13710
13852
|
if (!isPathInsideRoot(targetRoot, resolvedTarget)) {
|
|
13711
13853
|
const message = `ONNX Runtime symlink ${link.name} points outside install dir: ${link.target}`;
|
|
13712
13854
|
if (requiredLibs.has(link.name)) {
|
|
@@ -13726,7 +13868,7 @@ function copyOnnxLibraries(info, extractedDir, targetDir, realFiles, symlinks, c
|
|
|
13726
13868
|
log(`ORT extract: failed to symlink optional ${link.name}: ${symlinkErr}`);
|
|
13727
13869
|
}
|
|
13728
13870
|
}
|
|
13729
|
-
const requiredPath =
|
|
13871
|
+
const requiredPath = join7(targetDir, info.libName);
|
|
13730
13872
|
if (!existsSync5(requiredPath)) {
|
|
13731
13873
|
rmSync2(targetDir, { recursive: true, force: true });
|
|
13732
13874
|
throw new Error(`Required ONNX Runtime library missing after install: ${requiredPath}`);
|
|
@@ -13753,15 +13895,15 @@ function writeOnnxInstalledMeta(installDir, version, sha256, archiveSha256) {
|
|
|
13753
13895
|
...sha256 ? { sha256 } : {},
|
|
13754
13896
|
archiveSha256
|
|
13755
13897
|
};
|
|
13756
|
-
writeFileSync2(
|
|
13898
|
+
writeFileSync2(join7(installDir, ONNX_INSTALLED_META_FILE), JSON.stringify(meta), "utf8");
|
|
13757
13899
|
} catch (err) {
|
|
13758
13900
|
log(`[onnx] failed to write installed-meta in ${installDir}: ${err}`);
|
|
13759
13901
|
}
|
|
13760
13902
|
}
|
|
13761
13903
|
function readOnnxInstalledMeta(installDir) {
|
|
13762
|
-
const path =
|
|
13904
|
+
const path = join7(installDir, ONNX_INSTALLED_META_FILE);
|
|
13763
13905
|
try {
|
|
13764
|
-
if (!
|
|
13906
|
+
if (!statSync3(path).isFile())
|
|
13765
13907
|
return null;
|
|
13766
13908
|
const raw = readFileSync3(path, "utf8");
|
|
13767
13909
|
const parsed = JSON.parse(raw);
|
|
@@ -13812,7 +13954,7 @@ ${new Date().toISOString()}
|
|
|
13812
13954
|
const parsed = Number.parseInt(firstLine, 10);
|
|
13813
13955
|
if (Number.isFinite(parsed) && parsed > 0)
|
|
13814
13956
|
owningPid = parsed;
|
|
13815
|
-
lockMtimeMs =
|
|
13957
|
+
lockMtimeMs = statSync3(lockPath).mtimeMs;
|
|
13816
13958
|
} catch {
|
|
13817
13959
|
return tryClaim();
|
|
13818
13960
|
}
|
|
@@ -13897,13 +14039,13 @@ function isProcessAlive(pid) {
|
|
|
13897
14039
|
}
|
|
13898
14040
|
// ../aft-bridge/dist/pool.js
|
|
13899
14041
|
import { realpathSync as realpathSync2 } from "node:fs";
|
|
13900
|
-
import { homedir as
|
|
14042
|
+
import { homedir as homedir6 } from "node:os";
|
|
13901
14043
|
var DEFAULT_IDLE_TIMEOUT_MS = Infinity;
|
|
13902
14044
|
var DEFAULT_MAX_POOL_SIZE = 8;
|
|
13903
14045
|
var CLEANUP_INTERVAL_MS = 60 * 1000;
|
|
13904
14046
|
function canonicalHomeDir() {
|
|
13905
14047
|
try {
|
|
13906
|
-
const home =
|
|
14048
|
+
const home = homedir6();
|
|
13907
14049
|
if (!home)
|
|
13908
14050
|
return null;
|
|
13909
14051
|
try {
|
|
@@ -14823,7 +14965,7 @@ import {
|
|
|
14823
14965
|
// package.json
|
|
14824
14966
|
var package_default = {
|
|
14825
14967
|
name: "@cortexkit/aft-pi",
|
|
14826
|
-
version: "0.35.
|
|
14968
|
+
version: "0.35.3",
|
|
14827
14969
|
type: "module",
|
|
14828
14970
|
description: "Pi coding agent extension for Agent File Tools (AFT) — tree-sitter and LSP-powered code analysis",
|
|
14829
14971
|
main: "dist/index.js",
|
|
@@ -14846,7 +14988,7 @@ var package_default = {
|
|
|
14846
14988
|
"test:unit": "bun test src/__tests__ --path-ignore-patterns 'src/__tests__/e2e/**'"
|
|
14847
14989
|
},
|
|
14848
14990
|
dependencies: {
|
|
14849
|
-
"@cortexkit/aft-bridge": "0.35.
|
|
14991
|
+
"@cortexkit/aft-bridge": "0.35.3",
|
|
14850
14992
|
"@xterm/headless": "^5.5.0",
|
|
14851
14993
|
"comment-json": "^5.0.0",
|
|
14852
14994
|
diff: "^8.0.4",
|
|
@@ -14854,12 +14996,12 @@ var package_default = {
|
|
|
14854
14996
|
zod: "^4.1.8"
|
|
14855
14997
|
},
|
|
14856
14998
|
optionalDependencies: {
|
|
14857
|
-
"@cortexkit/aft-darwin-arm64": "0.35.
|
|
14858
|
-
"@cortexkit/aft-darwin-x64": "0.35.
|
|
14859
|
-
"@cortexkit/aft-linux-arm64": "0.35.
|
|
14860
|
-
"@cortexkit/aft-linux-x64": "0.35.
|
|
14861
|
-
"@cortexkit/aft-win32-arm64": "0.35.
|
|
14862
|
-
"@cortexkit/aft-win32-x64": "0.35.
|
|
14999
|
+
"@cortexkit/aft-darwin-arm64": "0.35.3",
|
|
15000
|
+
"@cortexkit/aft-darwin-x64": "0.35.3",
|
|
15001
|
+
"@cortexkit/aft-linux-arm64": "0.35.3",
|
|
15002
|
+
"@cortexkit/aft-linux-x64": "0.35.3",
|
|
15003
|
+
"@cortexkit/aft-win32-arm64": "0.35.3",
|
|
15004
|
+
"@cortexkit/aft-win32-x64": "0.35.3"
|
|
14863
15005
|
},
|
|
14864
15006
|
devDependencies: {
|
|
14865
15007
|
"@earendil-works/pi-coding-agent": "*",
|
|
@@ -14922,6 +15064,20 @@ function readCompression(value) {
|
|
|
14922
15064
|
session: readCompressionAggregate(compression.session)
|
|
14923
15065
|
};
|
|
14924
15066
|
}
|
|
15067
|
+
function readStatusBar(value) {
|
|
15068
|
+
if (typeof value !== "object" || value === null)
|
|
15069
|
+
return;
|
|
15070
|
+
const bar = asRecord(value);
|
|
15071
|
+
return {
|
|
15072
|
+
errors: readNumber(bar.errors),
|
|
15073
|
+
warnings: readNumber(bar.warnings),
|
|
15074
|
+
dead_code: readNumber(bar.dead_code),
|
|
15075
|
+
unused_exports: readNumber(bar.unused_exports),
|
|
15076
|
+
duplicates: readNumber(bar.duplicates),
|
|
15077
|
+
todos: readNumber(bar.todos),
|
|
15078
|
+
tier2_stale: readBoolean(bar.tier2_stale)
|
|
15079
|
+
};
|
|
15080
|
+
}
|
|
14925
15081
|
function formatFlag(enabled) {
|
|
14926
15082
|
return enabled ? "enabled" : "disabled";
|
|
14927
15083
|
}
|
|
@@ -15013,7 +15169,8 @@ function coerceAftStatus(response) {
|
|
|
15013
15169
|
tracked_files: readNumber(session.tracked_files),
|
|
15014
15170
|
checkpoints: readNumber(session.checkpoints)
|
|
15015
15171
|
},
|
|
15016
|
-
compression: readCompression(response.compression)
|
|
15172
|
+
compression: readCompression(response.compression),
|
|
15173
|
+
status_bar: readStatusBar(response.status_bar)
|
|
15017
15174
|
};
|
|
15018
15175
|
}
|
|
15019
15176
|
function formatStatusDialogMessage(status) {
|
|
@@ -15051,6 +15208,10 @@ function formatStatusDialogMessage(status) {
|
|
|
15051
15208
|
lines.push(`- dimension: ${formatCount(status.semantic_index.dimension)}`);
|
|
15052
15209
|
}
|
|
15053
15210
|
lines.push("", "Disk usage", `- trigram index: ${formatBytes(status.disk.trigram_disk_bytes)}`, `- semantic index: ${formatBytes(status.disk.semantic_disk_bytes)}`, "", "Runtime", `- LSP servers: ${formatCount(status.lsp_servers)}`, `- symbol cache: ${formatCount(status.symbol_cache.local_entries)} local / ${formatCount(status.symbol_cache.warm_entries)} warm`);
|
|
15211
|
+
if (status.status_bar) {
|
|
15212
|
+
const sb = status.status_bar;
|
|
15213
|
+
lines.push("", `Code Health${sb.tier2_stale ? " (~ stale)" : ""}`, `- errors: ${formatCount(sb.errors)}`, `- warnings: ${formatCount(sb.warnings)}`, `- duplicates: ${formatCount(sb.duplicates)}`, `- todos: ${formatCount(sb.todos)}`);
|
|
15214
|
+
}
|
|
15054
15215
|
if (status.storage_dir ?? status.disk.storage_dir) {
|
|
15055
15216
|
lines.push(`- storage dir: ${status.storage_dir ?? status.disk.storage_dir}`);
|
|
15056
15217
|
}
|
|
@@ -15506,8 +15667,8 @@ function registerStatusCommand(pi, ctx) {
|
|
|
15506
15667
|
|
|
15507
15668
|
// src/config.ts
|
|
15508
15669
|
import { existsSync as existsSync6, readFileSync as readFileSync4, renameSync as renameSync4, unlinkSync as unlinkSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
15509
|
-
import { homedir as
|
|
15510
|
-
import { join as
|
|
15670
|
+
import { homedir as homedir7 } from "node:os";
|
|
15671
|
+
import { join as join9 } from "node:path";
|
|
15511
15672
|
var import_comment_json = __toESM(require_src2(), 1);
|
|
15512
15673
|
|
|
15513
15674
|
// ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
@@ -17094,8 +17255,8 @@ function emoji() {
|
|
|
17094
17255
|
}
|
|
17095
17256
|
var ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
17096
17257
|
var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
|
|
17097
|
-
var mac = (
|
|
17098
|
-
const escapedDelim = escapeRegex(
|
|
17258
|
+
var mac = (delimiter2) => {
|
|
17259
|
+
const escapedDelim = escapeRegex(delimiter2 ?? ":");
|
|
17099
17260
|
return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);
|
|
17100
17261
|
};
|
|
17101
17262
|
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]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
@@ -29641,15 +29802,15 @@ function mergeConfigs(base, override) {
|
|
|
29641
29802
|
};
|
|
29642
29803
|
}
|
|
29643
29804
|
function getGlobalPiDir() {
|
|
29644
|
-
return
|
|
29805
|
+
return join9(homedir7(), ".pi", "agent");
|
|
29645
29806
|
}
|
|
29646
29807
|
function loadAftConfig(projectDirectory) {
|
|
29647
|
-
const userBasePath =
|
|
29808
|
+
const userBasePath = join9(getGlobalPiDir(), "aft");
|
|
29648
29809
|
migrateAftConfigFile(`${userBasePath}.jsonc`);
|
|
29649
29810
|
migrateAftConfigFile(`${userBasePath}.json`);
|
|
29650
29811
|
const userDetected = detectConfigFile(userBasePath);
|
|
29651
29812
|
const userConfigPath = userDetected.format !== "none" ? userDetected.path : `${userBasePath}.json`;
|
|
29652
|
-
const projectBasePath =
|
|
29813
|
+
const projectBasePath = join9(projectDirectory, ".pi", "aft");
|
|
29653
29814
|
migrateAftConfigFile(`${projectBasePath}.jsonc`);
|
|
29654
29815
|
migrateAftConfigFile(`${projectBasePath}.json`);
|
|
29655
29816
|
const projectDetected = detectConfigFile(projectBasePath);
|
|
@@ -29676,8 +29837,17 @@ function loadAftConfig(projectDirectory) {
|
|
|
29676
29837
|
// src/lsp-auto-install.ts
|
|
29677
29838
|
import { spawn as spawn2 } from "node:child_process";
|
|
29678
29839
|
import { createHash as createHash3 } from "node:crypto";
|
|
29679
|
-
import {
|
|
29680
|
-
|
|
29840
|
+
import {
|
|
29841
|
+
createReadStream,
|
|
29842
|
+
existsSync as existsSync8,
|
|
29843
|
+
mkdirSync as mkdirSync7,
|
|
29844
|
+
readFileSync as readFileSync7,
|
|
29845
|
+
renameSync as renameSync5,
|
|
29846
|
+
rmSync as rmSync3,
|
|
29847
|
+
statSync as statSync5,
|
|
29848
|
+
writeFileSync as writeFileSync5
|
|
29849
|
+
} from "node:fs";
|
|
29850
|
+
import { join as join12 } from "node:path";
|
|
29681
29851
|
|
|
29682
29852
|
// src/lsp-cache.ts
|
|
29683
29853
|
import {
|
|
@@ -29685,40 +29855,40 @@ import {
|
|
|
29685
29855
|
mkdirSync as mkdirSync6,
|
|
29686
29856
|
openSync as openSync4,
|
|
29687
29857
|
readFileSync as readFileSync5,
|
|
29688
|
-
statSync as
|
|
29858
|
+
statSync as statSync4,
|
|
29689
29859
|
unlinkSync as unlinkSync5,
|
|
29690
29860
|
writeFileSync as writeFileSync4
|
|
29691
29861
|
} from "node:fs";
|
|
29692
|
-
import { homedir as
|
|
29693
|
-
import { join as
|
|
29862
|
+
import { homedir as homedir8 } from "node:os";
|
|
29863
|
+
import { join as join10 } from "node:path";
|
|
29694
29864
|
function aftCacheBase() {
|
|
29695
29865
|
const override = process.env.AFT_CACHE_DIR;
|
|
29696
29866
|
if (override && override.length > 0)
|
|
29697
29867
|
return override;
|
|
29698
29868
|
if (process.platform === "win32") {
|
|
29699
29869
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
29700
|
-
const base2 = localAppData ||
|
|
29701
|
-
return
|
|
29870
|
+
const base2 = localAppData || join10(homedir8(), "AppData", "Local");
|
|
29871
|
+
return join10(base2, "aft");
|
|
29702
29872
|
}
|
|
29703
|
-
const base = process.env.XDG_CACHE_HOME ||
|
|
29704
|
-
return
|
|
29873
|
+
const base = process.env.XDG_CACHE_HOME || join10(homedir8(), ".cache");
|
|
29874
|
+
return join10(base, "aft");
|
|
29705
29875
|
}
|
|
29706
29876
|
function lspCacheRoot() {
|
|
29707
|
-
return
|
|
29877
|
+
return join10(aftCacheBase(), "lsp-packages");
|
|
29708
29878
|
}
|
|
29709
29879
|
function lspPackageDir(npmPackage) {
|
|
29710
|
-
return
|
|
29880
|
+
return join10(lspCacheRoot(), encodeURIComponent(npmPackage));
|
|
29711
29881
|
}
|
|
29712
29882
|
function lspBinaryPath(npmPackage, binary) {
|
|
29713
|
-
return
|
|
29883
|
+
return join10(lspPackageDir(npmPackage), "node_modules", ".bin", binary);
|
|
29714
29884
|
}
|
|
29715
29885
|
function lspBinDir(npmPackage) {
|
|
29716
|
-
return
|
|
29886
|
+
return join10(lspPackageDir(npmPackage), "node_modules", ".bin");
|
|
29717
29887
|
}
|
|
29718
29888
|
function isInstalled(npmPackage, binary) {
|
|
29719
29889
|
for (const candidate of lspBinaryCandidates(binary)) {
|
|
29720
29890
|
try {
|
|
29721
|
-
if (
|
|
29891
|
+
if (statSync4(join10(lspBinDir(npmPackage), candidate)).isFile())
|
|
29722
29892
|
return true;
|
|
29723
29893
|
} catch {}
|
|
29724
29894
|
}
|
|
@@ -29738,15 +29908,15 @@ function writeInstalledMetaIn(installDir, version2, sha256) {
|
|
|
29738
29908
|
installedAt: new Date().toISOString(),
|
|
29739
29909
|
...sha256 ? { sha256 } : {}
|
|
29740
29910
|
};
|
|
29741
|
-
writeFileSync4(
|
|
29911
|
+
writeFileSync4(join10(installDir, INSTALLED_META_FILE), JSON.stringify(meta3), "utf8");
|
|
29742
29912
|
} catch (err) {
|
|
29743
29913
|
log2(`[lsp-cache] failed to write installed-meta in ${installDir}: ${err}`);
|
|
29744
29914
|
}
|
|
29745
29915
|
}
|
|
29746
29916
|
function readInstalledMetaIn(installDir) {
|
|
29747
|
-
const path2 =
|
|
29917
|
+
const path2 = join10(installDir, INSTALLED_META_FILE);
|
|
29748
29918
|
try {
|
|
29749
|
-
if (!
|
|
29919
|
+
if (!statSync4(path2).isFile())
|
|
29750
29920
|
return null;
|
|
29751
29921
|
const raw = readFileSync5(path2, "utf8");
|
|
29752
29922
|
const parsed = JSON.parse(raw);
|
|
@@ -29768,7 +29938,7 @@ function readInstalledMeta(packageKey) {
|
|
|
29768
29938
|
return readInstalledMetaIn(lspPackageDir(packageKey));
|
|
29769
29939
|
}
|
|
29770
29940
|
function lockPath(npmPackage) {
|
|
29771
|
-
return
|
|
29941
|
+
return join10(lspPackageDir(npmPackage), ".aft-installing");
|
|
29772
29942
|
}
|
|
29773
29943
|
var STALE_LOCK_MS2 = 30 * 60 * 1000;
|
|
29774
29944
|
function acquireInstallLock(lockKey) {
|
|
@@ -29803,7 +29973,7 @@ ${new Date().toISOString()}
|
|
|
29803
29973
|
const parsed = Number.parseInt(firstLine, 10);
|
|
29804
29974
|
if (Number.isFinite(parsed) && parsed > 0)
|
|
29805
29975
|
owningPid = parsed;
|
|
29806
|
-
lockMtimeMs =
|
|
29976
|
+
lockMtimeMs = statSync4(lock).mtimeMs;
|
|
29807
29977
|
} catch {
|
|
29808
29978
|
return tryClaim();
|
|
29809
29979
|
}
|
|
@@ -29875,7 +30045,7 @@ async function withInstallLock(lockKey, task) {
|
|
|
29875
30045
|
}
|
|
29876
30046
|
var VERSION_CHECK_FILE = ".aft-version-check";
|
|
29877
30047
|
function readVersionCheck(npmPackage) {
|
|
29878
|
-
const file2 =
|
|
30048
|
+
const file2 = join10(lspPackageDir(npmPackage), VERSION_CHECK_FILE);
|
|
29879
30049
|
try {
|
|
29880
30050
|
const raw = readFileSync5(file2, "utf8");
|
|
29881
30051
|
const parsed = JSON.parse(raw);
|
|
@@ -29892,7 +30062,7 @@ function readVersionCheck(npmPackage) {
|
|
|
29892
30062
|
}
|
|
29893
30063
|
function writeVersionCheck(npmPackage, latest) {
|
|
29894
30064
|
mkdirSync6(lspPackageDir(npmPackage), { recursive: true });
|
|
29895
|
-
const file2 =
|
|
30065
|
+
const file2 = join10(lspPackageDir(npmPackage), VERSION_CHECK_FILE);
|
|
29896
30066
|
const record2 = {
|
|
29897
30067
|
last_checked: new Date().toISOString(),
|
|
29898
30068
|
latest_eligible: latest
|
|
@@ -30054,8 +30224,8 @@ var NPM_LSP_TABLE = [
|
|
|
30054
30224
|
];
|
|
30055
30225
|
|
|
30056
30226
|
// src/lsp-project-relevance.ts
|
|
30057
|
-
import { existsSync as existsSync7, readdirSync as
|
|
30058
|
-
import { join as
|
|
30227
|
+
import { existsSync as existsSync7, readdirSync as readdirSync3, readFileSync as readFileSync6 } from "node:fs";
|
|
30228
|
+
import { join as join11 } from "node:path";
|
|
30059
30229
|
var MAX_WALK_DIRS = 200;
|
|
30060
30230
|
var MAX_WALK_DEPTH = 4;
|
|
30061
30231
|
var NOISE_DIRS = new Set([
|
|
@@ -30072,7 +30242,7 @@ function hasRootMarker(projectRoot, rootMarkers) {
|
|
|
30072
30242
|
if (!rootMarkers)
|
|
30073
30243
|
return false;
|
|
30074
30244
|
for (const marker of rootMarkers) {
|
|
30075
|
-
if (existsSync7(
|
|
30245
|
+
if (existsSync7(join11(projectRoot, marker)))
|
|
30076
30246
|
return true;
|
|
30077
30247
|
}
|
|
30078
30248
|
return false;
|
|
@@ -30096,7 +30266,7 @@ function hasPackageJsonDep(projectRoot, depNames) {
|
|
|
30096
30266
|
}
|
|
30097
30267
|
function readPackageJson(projectRoot) {
|
|
30098
30268
|
try {
|
|
30099
|
-
const raw = readFileSync6(
|
|
30269
|
+
const raw = readFileSync6(join11(projectRoot, "package.json"), "utf8");
|
|
30100
30270
|
const parsed = JSON.parse(raw);
|
|
30101
30271
|
if (typeof parsed !== "object" || parsed === null)
|
|
30102
30272
|
return null;
|
|
@@ -30119,14 +30289,14 @@ function relevantExtensionsInProject(projectRoot, extToServer) {
|
|
|
30119
30289
|
visitedDirs += 1;
|
|
30120
30290
|
let entries;
|
|
30121
30291
|
try {
|
|
30122
|
-
entries =
|
|
30292
|
+
entries = readdirSync3(current.dir, { withFileTypes: true });
|
|
30123
30293
|
} catch {
|
|
30124
30294
|
continue;
|
|
30125
30295
|
}
|
|
30126
30296
|
for (const entry of entries) {
|
|
30127
30297
|
if (entry.isDirectory()) {
|
|
30128
30298
|
if (current.depth < MAX_WALK_DEPTH && !NOISE_DIRS.has(entry.name.toLowerCase())) {
|
|
30129
|
-
queue.push({ dir:
|
|
30299
|
+
queue.push({ dir: join11(current.dir, entry.name), depth: current.depth + 1 });
|
|
30130
30300
|
}
|
|
30131
30301
|
continue;
|
|
30132
30302
|
}
|
|
@@ -30251,6 +30421,17 @@ async function resolveTargetVersion(spec, config2, fetchImpl = fetch) {
|
|
|
30251
30421
|
writeVersionCheck(spec.npm, probe.version);
|
|
30252
30422
|
return { version: probe.version, pinned: false, probe };
|
|
30253
30423
|
}
|
|
30424
|
+
function ensureInstallAnchor(cwd) {
|
|
30425
|
+
try {
|
|
30426
|
+
const stub = join12(cwd, "package.json");
|
|
30427
|
+
if (!existsSync8(stub)) {
|
|
30428
|
+
writeFileSync5(stub, `${JSON.stringify({ name: "aft-lsp-cache", version: "0.0.0", private: true })}
|
|
30429
|
+
`);
|
|
30430
|
+
}
|
|
30431
|
+
} catch (err) {
|
|
30432
|
+
warn2(`[lsp] could not write package.json stub in ${cwd}: ${err}`);
|
|
30433
|
+
}
|
|
30434
|
+
}
|
|
30254
30435
|
function runInstall(spec, version2, cwd, signal) {
|
|
30255
30436
|
return new Promise((resolve2) => {
|
|
30256
30437
|
const target = `${spec.npm}@${version2}`;
|
|
@@ -30260,10 +30441,17 @@ function runInstall(spec, version2, cwd, signal) {
|
|
|
30260
30441
|
resolve2(false);
|
|
30261
30442
|
return;
|
|
30262
30443
|
}
|
|
30263
|
-
const
|
|
30264
|
-
|
|
30444
|
+
const npm = resolveNpm();
|
|
30445
|
+
if (!npm) {
|
|
30446
|
+
warn2(`[lsp] npm not found on PATH or known locations; cannot install ${target}`);
|
|
30447
|
+
resolve2(false);
|
|
30448
|
+
return;
|
|
30449
|
+
}
|
|
30450
|
+
ensureInstallAnchor(cwd);
|
|
30451
|
+
const child = spawn2(npm.command, ["install", "--no-save", "--ignore-scripts", "--silent", target], {
|
|
30265
30452
|
stdio: ["ignore", "pipe", "pipe"],
|
|
30266
|
-
cwd
|
|
30453
|
+
cwd,
|
|
30454
|
+
env: npmSpawnEnv(npm)
|
|
30267
30455
|
});
|
|
30268
30456
|
child.unref();
|
|
30269
30457
|
let stderrBuf = "";
|
|
@@ -30390,7 +30578,7 @@ function hashInstalledBinary(spec) {
|
|
|
30390
30578
|
let pathToHash = null;
|
|
30391
30579
|
for (const p of candidates) {
|
|
30392
30580
|
try {
|
|
30393
|
-
if (
|
|
30581
|
+
if (statSync5(p).isFile()) {
|
|
30394
30582
|
pathToHash = p;
|
|
30395
30583
|
break;
|
|
30396
30584
|
}
|
|
@@ -30416,7 +30604,7 @@ function installedBinaryPath(spec) {
|
|
|
30416
30604
|
] : [lspBinaryPath(spec.npm, spec.binary)];
|
|
30417
30605
|
for (const candidate of candidates) {
|
|
30418
30606
|
try {
|
|
30419
|
-
if (
|
|
30607
|
+
if (statSync5(candidate).isFile())
|
|
30420
30608
|
return candidate;
|
|
30421
30609
|
} catch {}
|
|
30422
30610
|
}
|
|
@@ -30427,10 +30615,10 @@ function sha256OfFileSync(path2) {
|
|
|
30427
30615
|
}
|
|
30428
30616
|
function quarantineCachedNpmInstall(spec, reason) {
|
|
30429
30617
|
const packageDir = lspPackageDir(spec.npm);
|
|
30430
|
-
const dest =
|
|
30618
|
+
const dest = join12(packageDir, "..", ".quarantine", encodeURIComponent(spec.npm), `${Date.now()}`);
|
|
30431
30619
|
warn2(`[lsp] tofu_mismatch ${spec.npm}: ${reason}; quarantining ${packageDir} -> ${dest}`);
|
|
30432
30620
|
try {
|
|
30433
|
-
mkdirSync7(
|
|
30621
|
+
mkdirSync7(join12(dest, ".."), { recursive: true });
|
|
30434
30622
|
rmSync3(dest, { recursive: true, force: true });
|
|
30435
30623
|
renameSync5(packageDir, dest);
|
|
30436
30624
|
} catch (err) {
|
|
@@ -30512,20 +30700,20 @@ import {
|
|
|
30512
30700
|
copyFileSync as copyFileSync4,
|
|
30513
30701
|
createReadStream as createReadStream2,
|
|
30514
30702
|
createWriteStream as createWriteStream3,
|
|
30515
|
-
existsSync as
|
|
30703
|
+
existsSync as existsSync9,
|
|
30516
30704
|
lstatSync as lstatSync2,
|
|
30517
30705
|
mkdirSync as mkdirSync8,
|
|
30518
|
-
readdirSync as
|
|
30706
|
+
readdirSync as readdirSync4,
|
|
30519
30707
|
readFileSync as readFileSync8,
|
|
30520
30708
|
readlinkSync as readlinkSync2,
|
|
30521
30709
|
realpathSync as realpathSync3,
|
|
30522
30710
|
renameSync as renameSync6,
|
|
30523
30711
|
rmSync as rmSync4,
|
|
30524
|
-
statSync as
|
|
30712
|
+
statSync as statSync6,
|
|
30525
30713
|
unlinkSync as unlinkSync6,
|
|
30526
|
-
writeFileSync as
|
|
30714
|
+
writeFileSync as writeFileSync6
|
|
30527
30715
|
} from "node:fs";
|
|
30528
|
-
import { dirname as
|
|
30716
|
+
import { dirname as dirname5, join as join13, relative as relative2, resolve as resolve2 } from "node:path";
|
|
30529
30717
|
import { Readable as Readable3 } from "node:stream";
|
|
30530
30718
|
import { pipeline as pipeline3 } from "node:stream/promises";
|
|
30531
30719
|
|
|
@@ -30615,26 +30803,26 @@ function detectHostPlatform() {
|
|
|
30615
30803
|
|
|
30616
30804
|
// src/lsp-github-install.ts
|
|
30617
30805
|
function ghCacheRoot() {
|
|
30618
|
-
return
|
|
30806
|
+
return join13(aftCacheBase(), "lsp-binaries");
|
|
30619
30807
|
}
|
|
30620
30808
|
function ghPackageDir(spec) {
|
|
30621
|
-
return
|
|
30809
|
+
return join13(ghCacheRoot(), spec.id);
|
|
30622
30810
|
}
|
|
30623
30811
|
function ghBinDir(spec) {
|
|
30624
|
-
return
|
|
30812
|
+
return join13(ghPackageDir(spec), "bin");
|
|
30625
30813
|
}
|
|
30626
30814
|
function ghExtractDir(spec) {
|
|
30627
|
-
return
|
|
30815
|
+
return join13(ghPackageDir(spec), "extracted");
|
|
30628
30816
|
}
|
|
30629
30817
|
var INSTALLED_META_FILE2 = ".aft-installed";
|
|
30630
30818
|
function ghBinaryPath(spec, platform) {
|
|
30631
30819
|
const ext = platform === "win32" ? ".exe" : "";
|
|
30632
|
-
return
|
|
30820
|
+
return join13(ghBinDir(spec), `${spec.binary}${ext}`);
|
|
30633
30821
|
}
|
|
30634
30822
|
function isGithubInstalled(spec, platform) {
|
|
30635
30823
|
for (const candidate of ghBinaryCandidates(spec, platform)) {
|
|
30636
30824
|
try {
|
|
30637
|
-
if (
|
|
30825
|
+
if (statSync6(join13(ghBinDir(spec), candidate)).isFile())
|
|
30638
30826
|
return true;
|
|
30639
30827
|
} catch {}
|
|
30640
30828
|
}
|
|
@@ -30647,8 +30835,8 @@ function ghBinaryCandidates(spec, platform) {
|
|
|
30647
30835
|
}
|
|
30648
30836
|
function readGithubInstalledMetaIn(installDir) {
|
|
30649
30837
|
try {
|
|
30650
|
-
const path2 =
|
|
30651
|
-
if (!
|
|
30838
|
+
const path2 = join13(installDir, INSTALLED_META_FILE2);
|
|
30839
|
+
if (!statSync6(path2).isFile())
|
|
30652
30840
|
return null;
|
|
30653
30841
|
const parsed = JSON.parse(readFileSync8(path2, "utf8"));
|
|
30654
30842
|
if (typeof parsed.version !== "string" || parsed.version.length === 0)
|
|
@@ -30674,7 +30862,7 @@ function writeGithubInstalledMetaIn(installDir, version2, binarySha256, archiveS
|
|
|
30674
30862
|
binarySha256,
|
|
30675
30863
|
...archiveSha256 ? { archiveSha256 } : {}
|
|
30676
30864
|
};
|
|
30677
|
-
|
|
30865
|
+
writeFileSync6(join13(installDir, INSTALLED_META_FILE2), JSON.stringify(meta3), "utf8");
|
|
30678
30866
|
} catch (err) {
|
|
30679
30867
|
warn2(`[lsp] failed to write github installed metadata in ${installDir}: ${err}`);
|
|
30680
30868
|
}
|
|
@@ -30867,7 +31055,7 @@ async function downloadFile(url2, destPath, fetchImpl, assetSize, signal) {
|
|
|
30867
31055
|
if (Number.isFinite(advertised) && advertised > MAX_DOWNLOAD_BYTES3) {
|
|
30868
31056
|
throw new Error(`Content-Length ${advertised} exceeds max ${MAX_DOWNLOAD_BYTES3}`);
|
|
30869
31057
|
}
|
|
30870
|
-
mkdirSync8(
|
|
31058
|
+
mkdirSync8(dirname5(destPath), { recursive: true });
|
|
30871
31059
|
let bytesWritten = 0;
|
|
30872
31060
|
const guard = new TransformStream({
|
|
30873
31061
|
transform(chunk, controller) {
|
|
@@ -30918,12 +31106,12 @@ function validateExtraction(stagingRoot) {
|
|
|
30918
31106
|
const walk = (dir) => {
|
|
30919
31107
|
let entries;
|
|
30920
31108
|
try {
|
|
30921
|
-
entries =
|
|
31109
|
+
entries = readdirSync4(dir);
|
|
30922
31110
|
} catch (err) {
|
|
30923
31111
|
throw new Error(`failed to read staging dir ${dir}: ${err}`);
|
|
30924
31112
|
}
|
|
30925
31113
|
for (const entry of entries) {
|
|
30926
|
-
const full =
|
|
31114
|
+
const full = join13(dir, entry);
|
|
30927
31115
|
let lst;
|
|
30928
31116
|
try {
|
|
30929
31117
|
lst = lstatSync2(full);
|
|
@@ -31011,10 +31199,10 @@ function extractArchiveSafely(archivePath, destDir, archiveType) {
|
|
|
31011
31199
|
}
|
|
31012
31200
|
function quarantineCachedGithubInstall(spec, reason) {
|
|
31013
31201
|
const packageDir = ghPackageDir(spec);
|
|
31014
|
-
const dest =
|
|
31202
|
+
const dest = join13(ghCacheRoot(), ".quarantine", encodeURIComponent(spec.id), `${Date.now()}`);
|
|
31015
31203
|
warn2(`[lsp] tofu_mismatch ${spec.id}: ${reason}; quarantining ${packageDir} -> ${dest}`);
|
|
31016
31204
|
try {
|
|
31017
|
-
mkdirSync8(
|
|
31205
|
+
mkdirSync8(dirname5(dest), { recursive: true });
|
|
31018
31206
|
rmSync4(dest, { recursive: true, force: true });
|
|
31019
31207
|
renameSync6(packageDir, dest);
|
|
31020
31208
|
} catch (err) {
|
|
@@ -31024,9 +31212,9 @@ function quarantineCachedGithubInstall(spec, reason) {
|
|
|
31024
31212
|
function validateCachedGithubInstall(spec, platform) {
|
|
31025
31213
|
const packageDir = ghPackageDir(spec);
|
|
31026
31214
|
const meta3 = readGithubInstalledMetaIn(packageDir);
|
|
31027
|
-
const binaryPath = ghBinaryCandidates(spec, platform).map((candidate) =>
|
|
31215
|
+
const binaryPath = ghBinaryCandidates(spec, platform).map((candidate) => join13(ghBinDir(spec), candidate)).find((candidate) => {
|
|
31028
31216
|
try {
|
|
31029
|
-
return
|
|
31217
|
+
return statSync6(candidate).isFile();
|
|
31030
31218
|
} catch {
|
|
31031
31219
|
return false;
|
|
31032
31220
|
}
|
|
@@ -31102,7 +31290,7 @@ async function downloadAndInstall(spec, tag, assets, platform, arch, fetchImpl,
|
|
|
31102
31290
|
}
|
|
31103
31291
|
const pkgDir = ghPackageDir(spec);
|
|
31104
31292
|
const extractDir = ghExtractDir(spec);
|
|
31105
|
-
const archivePath =
|
|
31293
|
+
const archivePath = join13(pkgDir, expected.name);
|
|
31106
31294
|
log2(`[lsp] downloading ${spec.id} ${tag} → ${matchingAsset.url}`);
|
|
31107
31295
|
try {
|
|
31108
31296
|
await downloadFile(matchingAsset.url, archivePath, fetchImpl, matchingAsset.size, signal);
|
|
@@ -31142,13 +31330,13 @@ async function downloadAndInstall(spec, tag, assets, platform, arch, fetchImpl,
|
|
|
31142
31330
|
unlinkSync6(archivePath);
|
|
31143
31331
|
} catch {}
|
|
31144
31332
|
}
|
|
31145
|
-
const innerBinaryPath =
|
|
31146
|
-
if (!
|
|
31333
|
+
const innerBinaryPath = join13(extractDir, spec.binaryPathInArchive(platform, arch, version2));
|
|
31334
|
+
if (!existsSync9(innerBinaryPath)) {
|
|
31147
31335
|
error2(`[lsp] ${spec.id}: extracted binary not found at ${innerBinaryPath}`);
|
|
31148
31336
|
return null;
|
|
31149
31337
|
}
|
|
31150
31338
|
const targetBinary = ghBinaryPath(spec, platform);
|
|
31151
|
-
mkdirSync8(
|
|
31339
|
+
mkdirSync8(dirname5(targetBinary), { recursive: true });
|
|
31152
31340
|
try {
|
|
31153
31341
|
copyFileSync4(innerBinaryPath, targetBinary);
|
|
31154
31342
|
if (platform !== "win32") {
|
|
@@ -31227,7 +31415,7 @@ function runGithubAutoInstall(relevantServers, config2, fetchImpl = fetch) {
|
|
|
31227
31415
|
if (!host) {
|
|
31228
31416
|
for (const spec of GITHUB_LSP_TABLE) {
|
|
31229
31417
|
try {
|
|
31230
|
-
if (
|
|
31418
|
+
if (existsSync9(ghBinDir(spec))) {
|
|
31231
31419
|
cachedBinDirs.push(ghBinDir(spec));
|
|
31232
31420
|
}
|
|
31233
31421
|
} catch {}
|
|
@@ -31596,8 +31784,8 @@ import { Type as Type3 } from "typebox";
|
|
|
31596
31784
|
|
|
31597
31785
|
// src/tools/hoisted.ts
|
|
31598
31786
|
import { stat } from "node:fs/promises";
|
|
31599
|
-
import { homedir as
|
|
31600
|
-
import { isAbsolute as
|
|
31787
|
+
import { homedir as homedir9 } from "node:os";
|
|
31788
|
+
import { isAbsolute as isAbsolute3, relative as relative3, resolve as resolve3, sep } from "node:path";
|
|
31601
31789
|
import {
|
|
31602
31790
|
renderDiff
|
|
31603
31791
|
} from "@earendil-works/pi-coding-agent";
|
|
@@ -31713,15 +31901,15 @@ function diagnosticsOnEditDefault(ctx) {
|
|
|
31713
31901
|
}
|
|
31714
31902
|
function containsPath(parent, child) {
|
|
31715
31903
|
const rel = relative3(parent, child);
|
|
31716
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
31904
|
+
return rel === "" || !rel.startsWith("..") && !isAbsolute3(rel);
|
|
31717
31905
|
}
|
|
31718
31906
|
function expandTilde(path2) {
|
|
31719
31907
|
if (!path2 || !path2.startsWith("~"))
|
|
31720
31908
|
return path2;
|
|
31721
31909
|
if (path2 === "~")
|
|
31722
|
-
return
|
|
31910
|
+
return homedir9();
|
|
31723
31911
|
if (path2.startsWith(`~${sep}`) || path2.startsWith("~/")) {
|
|
31724
|
-
return resolve3(
|
|
31912
|
+
return resolve3(homedir9(), path2.slice(2));
|
|
31725
31913
|
}
|
|
31726
31914
|
return path2;
|
|
31727
31915
|
}
|
|
@@ -31736,7 +31924,7 @@ async function assertExternalDirectoryPermission(extCtx, target, action = "modif
|
|
|
31736
31924
|
if (!target)
|
|
31737
31925
|
return;
|
|
31738
31926
|
const expanded = expandTilde(target);
|
|
31739
|
-
const absoluteTarget =
|
|
31927
|
+
const absoluteTarget = isAbsolute3(expanded) ? expanded : resolve3(extCtx.cwd, expanded);
|
|
31740
31928
|
if (containsPath(extCtx.cwd, absoluteTarget))
|
|
31741
31929
|
return;
|
|
31742
31930
|
if (options.restrictToProjectRoot === false)
|
|
@@ -31857,7 +32045,7 @@ function registerHoistedTools(pi, ctx, surface) {
|
|
|
31857
32045
|
diagnostics: params.diagnostics ?? diagnosticsOnEditDefault(ctx),
|
|
31858
32046
|
include_diff_content: true
|
|
31859
32047
|
}, extCtx);
|
|
31860
|
-
return buildMutationResult(
|
|
32048
|
+
return buildMutationResult(response);
|
|
31861
32049
|
},
|
|
31862
32050
|
renderCall(args, theme, context) {
|
|
31863
32051
|
return renderMutationCall("write", args?.filePath, theme, context);
|
|
@@ -31893,7 +32081,7 @@ function registerHoistedTools(pi, ctx, surface) {
|
|
|
31893
32081
|
include_diff_content: true
|
|
31894
32082
|
};
|
|
31895
32083
|
const response2 = await callBridge(bridge, "edit_match", req2, extCtx);
|
|
31896
|
-
return buildMutationResult(
|
|
32084
|
+
return buildMutationResult(response2);
|
|
31897
32085
|
}
|
|
31898
32086
|
const req = {
|
|
31899
32087
|
file: params.filePath,
|
|
@@ -31908,7 +32096,7 @@ function registerHoistedTools(pi, ctx, surface) {
|
|
|
31908
32096
|
if (occurrence !== undefined)
|
|
31909
32097
|
req.occurrence = occurrence;
|
|
31910
32098
|
const response = await callBridge(bridge, "edit_match", req, extCtx);
|
|
31911
|
-
return buildMutationResult(
|
|
32099
|
+
return buildMutationResult(response);
|
|
31912
32100
|
},
|
|
31913
32101
|
renderCall(args, theme, context) {
|
|
31914
32102
|
return renderMutationCall("edit", args?.filePath, theme, context);
|
|
@@ -31949,7 +32137,7 @@ function registerHoistedTools(pi, ctx, surface) {
|
|
|
31949
32137
|
});
|
|
31950
32138
|
}
|
|
31951
32139
|
}
|
|
31952
|
-
function buildMutationResult(
|
|
32140
|
+
function buildMutationResult(response) {
|
|
31953
32141
|
const diffObj = response.diff;
|
|
31954
32142
|
const additions = diffObj?.additions ?? 0;
|
|
31955
32143
|
const deletions = diffObj?.deletions ?? 0;
|
|
@@ -31967,8 +32155,7 @@ function buildMutationResult(filePath, response) {
|
|
|
31967
32155
|
diffText = piDiff.diff;
|
|
31968
32156
|
firstChangedLine = piDiff.firstChangedLine;
|
|
31969
32157
|
}
|
|
31970
|
-
|
|
31971
|
-
let text = summaryHeader;
|
|
32158
|
+
let text = formatEditSummary(response);
|
|
31972
32159
|
if (noOp) {
|
|
31973
32160
|
text += `
|
|
31974
32161
|
|
|
@@ -32090,14 +32277,14 @@ ${summary}${suffix}`);
|
|
|
32090
32277
|
return container;
|
|
32091
32278
|
}
|
|
32092
32279
|
function shortenPath(path2) {
|
|
32093
|
-
const home =
|
|
32280
|
+
const home = homedir9();
|
|
32094
32281
|
if (path2.startsWith(home))
|
|
32095
32282
|
return `~${path2.slice(home.length)}`;
|
|
32096
32283
|
return path2;
|
|
32097
32284
|
}
|
|
32098
32285
|
async function resolvePathArg(cwd, path2) {
|
|
32099
32286
|
const expanded = expandTilde(path2);
|
|
32100
|
-
const abs =
|
|
32287
|
+
const abs = isAbsolute3(expanded) ? expanded : resolve3(cwd, expanded);
|
|
32101
32288
|
try {
|
|
32102
32289
|
await stat(abs);
|
|
32103
32290
|
return abs;
|
|
@@ -32151,7 +32338,7 @@ function formatReadFooter(agentSpecifiedRange, data) {
|
|
|
32151
32338
|
}
|
|
32152
32339
|
|
|
32153
32340
|
// src/tools/render-helpers.ts
|
|
32154
|
-
import { homedir as
|
|
32341
|
+
import { homedir as homedir10 } from "node:os";
|
|
32155
32342
|
import { renderDiff as renderDiff2 } from "@earendil-works/pi-coding-agent";
|
|
32156
32343
|
import { Container as Container2, Spacer as Spacer2, Text as Text2 } from "@earendil-works/pi-tui";
|
|
32157
32344
|
function reuseText2(last) {
|
|
@@ -32161,7 +32348,7 @@ function reuseContainer2(last) {
|
|
|
32161
32348
|
return last instanceof Container2 ? last : new Container2;
|
|
32162
32349
|
}
|
|
32163
32350
|
function shortenPath2(path2) {
|
|
32164
|
-
const home =
|
|
32351
|
+
const home = homedir10();
|
|
32165
32352
|
if (path2.startsWith(home))
|
|
32166
32353
|
return `~${path2.slice(home.length)}`;
|
|
32167
32354
|
return path2;
|
|
@@ -34788,6 +34975,14 @@ function semanticHonestyNote(response, theme) {
|
|
|
34788
34975
|
notes.push("partial/incomplete");
|
|
34789
34976
|
return notes.length > 0 ? theme.fg("warning", `Search status: ${notes.join("; ")}.`) : undefined;
|
|
34790
34977
|
}
|
|
34978
|
+
function extraAgentHonestyNote(response) {
|
|
34979
|
+
const notes = [];
|
|
34980
|
+
if (response.fully_degraded === true)
|
|
34981
|
+
notes.push("fully degraded");
|
|
34982
|
+
if (response.complete === false)
|
|
34983
|
+
notes.push("partial/incomplete");
|
|
34984
|
+
return notes.length > 0 ? `Search status: ${notes.join("; ")}.` : undefined;
|
|
34985
|
+
}
|
|
34791
34986
|
var SearchParams2 = Type13.Object({
|
|
34792
34987
|
query: Type13.String({
|
|
34793
34988
|
description: "Concept, regex, literal text, filename, or capability to find. Examples: 'fuzzy match with whitespace tolerance', '^export', 'Cargo.lock'."
|
|
@@ -34923,7 +35118,12 @@ function registerSemanticTool(pi, ctx) {
|
|
|
34923
35118
|
if (params.hint !== undefined)
|
|
34924
35119
|
req.hint = params.hint;
|
|
34925
35120
|
const response = await callBridge(bridge, "semantic_search", req, extCtx);
|
|
34926
|
-
|
|
35121
|
+
let agentText = response.text ?? "No results.";
|
|
35122
|
+
const extra = extraAgentHonestyNote(response);
|
|
35123
|
+
if (extra)
|
|
35124
|
+
agentText = `${agentText}
|
|
35125
|
+
${extra}`;
|
|
35126
|
+
return textResult(agentText, response);
|
|
34927
35127
|
},
|
|
34928
35128
|
renderCall(args, theme, context) {
|
|
34929
35129
|
return renderSemanticCall(args, theme, context);
|
|
@@ -35200,14 +35400,12 @@ var PLUGIN_VERSION = (() => {
|
|
|
35200
35400
|
return "0.0.0";
|
|
35201
35401
|
}
|
|
35202
35402
|
})();
|
|
35203
|
-
var ANNOUNCEMENT_VERSION = "0.35.
|
|
35403
|
+
var ANNOUNCEMENT_VERSION = "0.35.3";
|
|
35204
35404
|
var ANNOUNCEMENT_FEATURES = [
|
|
35205
|
-
"
|
|
35206
|
-
"
|
|
35207
|
-
"
|
|
35208
|
-
"
|
|
35209
|
-
"`npx @cortexkit/aft --version` reports CLI, binary, and per-harness versions; `doctor --issue` can scope its report to a single session.",
|
|
35210
|
-
"New SCSS support and `.inc` files parsed as PHP."
|
|
35405
|
+
"Code Health in `/aft-status`: live LSP errors and warnings plus duplicate and TODO counts.",
|
|
35406
|
+
"The semantic index now recovers on its own from a transient embedding-backend blip (a restarted local server, or a model still loading) instead of getting stuck on `failed`.",
|
|
35407
|
+
"Fixed a background codebase-scan crash on very deep or minified files.",
|
|
35408
|
+
"More reliable LSP auto-install when a parent directory has its own `package.json`."
|
|
35211
35409
|
];
|
|
35212
35410
|
var ANNOUNCEMENT_FOOTER = "Join us on Discord: https://discord.gg/DSa65w8wuf";
|
|
35213
35411
|
var ALL_ONLY_TOOLS = new Set([
|