@cortexkit/aft-pi 0.35.1 → 0.35.2
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
|
@@ -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) {
|
|
@@ -12816,6 +12816,35 @@ async function fetchLatestTag() {
|
|
|
12816
12816
|
clearTimeout(timeout);
|
|
12817
12817
|
}
|
|
12818
12818
|
}
|
|
12819
|
+
// ../aft-bridge/dist/edit-summary.js
|
|
12820
|
+
function formatEditSummary(data) {
|
|
12821
|
+
if (data.rolled_back === true) {
|
|
12822
|
+
return "Edit rolled back: the change produced invalid syntax, so the file was left unchanged.";
|
|
12823
|
+
}
|
|
12824
|
+
if (typeof data.files_modified === "number") {
|
|
12825
|
+
const n = data.files_modified;
|
|
12826
|
+
return `Applied edits to ${n} file${n === 1 ? "" : "s"}.`;
|
|
12827
|
+
}
|
|
12828
|
+
const additions = data.diff?.additions ?? 0;
|
|
12829
|
+
const deletions = data.diff?.deletions ?? 0;
|
|
12830
|
+
const counts = `+${additions}/-${deletions}`;
|
|
12831
|
+
if (data.created === true) {
|
|
12832
|
+
let s2 = `Created file (${counts}).`;
|
|
12833
|
+
if (data.formatted)
|
|
12834
|
+
s2 += " Auto-formatted.";
|
|
12835
|
+
return s2;
|
|
12836
|
+
}
|
|
12837
|
+
let detail = counts;
|
|
12838
|
+
if (typeof data.edits_applied === "number" && data.edits_applied > 1) {
|
|
12839
|
+
detail = `${counts}, ${data.edits_applied} edits`;
|
|
12840
|
+
} else if (typeof data.replacements === "number" && data.replacements > 1) {
|
|
12841
|
+
detail = `${counts}, ${data.replacements} replacements`;
|
|
12842
|
+
}
|
|
12843
|
+
let s = `Edited (${detail}).`;
|
|
12844
|
+
if (data.formatted)
|
|
12845
|
+
s += " Auto-formatted.";
|
|
12846
|
+
return s;
|
|
12847
|
+
}
|
|
12819
12848
|
// ../aft-bridge/dist/format.js
|
|
12820
12849
|
function compressionSavingsPercent(original, compressed) {
|
|
12821
12850
|
if (original <= 0)
|
|
@@ -13210,11 +13239,125 @@ async function ensureStorageMigrated(opts) {
|
|
|
13210
13239
|
const stdoutTail = tail(result.stdout);
|
|
13211
13240
|
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
13241
|
}
|
|
13242
|
+
// ../aft-bridge/dist/npm-resolver.js
|
|
13243
|
+
import { readdirSync, statSync as statSync2 } from "node:fs";
|
|
13244
|
+
import { homedir as homedir5 } from "node:os";
|
|
13245
|
+
import { delimiter, dirname as dirname3, isAbsolute, join as join6 } from "node:path";
|
|
13246
|
+
function defaultDeps() {
|
|
13247
|
+
return {
|
|
13248
|
+
platform: process.platform,
|
|
13249
|
+
env: process.env,
|
|
13250
|
+
home: homedir5(),
|
|
13251
|
+
execPath: process.execPath
|
|
13252
|
+
};
|
|
13253
|
+
}
|
|
13254
|
+
function npmBinaryName(platform) {
|
|
13255
|
+
return platform === "win32" ? "npm.cmd" : "npm";
|
|
13256
|
+
}
|
|
13257
|
+
function isFile(p) {
|
|
13258
|
+
try {
|
|
13259
|
+
return statSync2(p).isFile();
|
|
13260
|
+
} catch {
|
|
13261
|
+
return false;
|
|
13262
|
+
}
|
|
13263
|
+
}
|
|
13264
|
+
function npmFromPath(deps) {
|
|
13265
|
+
const name = npmBinaryName(deps.platform);
|
|
13266
|
+
const raw = deps.env.PATH ?? deps.env.Path ?? "";
|
|
13267
|
+
for (const entry of raw.split(delimiter)) {
|
|
13268
|
+
const dir = entry.trim().replace(/^"|"$/g, "");
|
|
13269
|
+
if (!dir || !isAbsolute(dir))
|
|
13270
|
+
continue;
|
|
13271
|
+
if (isFile(join6(dir, name)))
|
|
13272
|
+
return dir;
|
|
13273
|
+
}
|
|
13274
|
+
return null;
|
|
13275
|
+
}
|
|
13276
|
+
function npmAdjacentToNode(deps) {
|
|
13277
|
+
const dir = dirname3(deps.execPath);
|
|
13278
|
+
return isFile(join6(dir, npmBinaryName(deps.platform))) ? dir : null;
|
|
13279
|
+
}
|
|
13280
|
+
function highestVersionedNodeBin(installsDir, name) {
|
|
13281
|
+
let entries;
|
|
13282
|
+
try {
|
|
13283
|
+
entries = readdirSync(installsDir);
|
|
13284
|
+
} catch {
|
|
13285
|
+
return null;
|
|
13286
|
+
}
|
|
13287
|
+
const candidates = entries.filter((v) => isFile(join6(installsDir, v, "bin", name))).sort((a, b) => compareVersionsDesc(a, b));
|
|
13288
|
+
return candidates.length > 0 ? join6(installsDir, candidates[0], "bin") : null;
|
|
13289
|
+
}
|
|
13290
|
+
function compareVersionsDesc(a, b) {
|
|
13291
|
+
const pa = a.replace(/^v/, "").split(".").map((n) => Number.parseInt(n, 10));
|
|
13292
|
+
const pb = b.replace(/^v/, "").split(".").map((n) => Number.parseInt(n, 10));
|
|
13293
|
+
for (let i = 0;i < Math.max(pa.length, pb.length); i++) {
|
|
13294
|
+
const na = Number.isFinite(pa[i]) ? pa[i] : -1;
|
|
13295
|
+
const nb = Number.isFinite(pb[i]) ? pb[i] : -1;
|
|
13296
|
+
if (na !== nb)
|
|
13297
|
+
return nb - na;
|
|
13298
|
+
}
|
|
13299
|
+
return b.localeCompare(a);
|
|
13300
|
+
}
|
|
13301
|
+
function wellKnownNpmDirs(deps) {
|
|
13302
|
+
const { platform, env, home } = deps;
|
|
13303
|
+
const name = npmBinaryName(platform);
|
|
13304
|
+
const dirs = [];
|
|
13305
|
+
const push = (dir) => {
|
|
13306
|
+
if (dir && !dirs.includes(dir))
|
|
13307
|
+
dirs.push(dir);
|
|
13308
|
+
};
|
|
13309
|
+
if (platform === "win32") {
|
|
13310
|
+
const programFiles = env.ProgramFiles || "C:\\Program Files";
|
|
13311
|
+
const appData = env.APPDATA;
|
|
13312
|
+
const localAppData = env.LOCALAPPDATA;
|
|
13313
|
+
push(join6(programFiles, "nodejs"));
|
|
13314
|
+
if (appData)
|
|
13315
|
+
push(join6(appData, "npm"));
|
|
13316
|
+
if (localAppData)
|
|
13317
|
+
push(join6(localAppData, "Volta", "bin"));
|
|
13318
|
+
if (env.NVM_SYMLINK)
|
|
13319
|
+
push(env.NVM_SYMLINK);
|
|
13320
|
+
} else {
|
|
13321
|
+
if (env.NVM_BIN)
|
|
13322
|
+
push(env.NVM_BIN);
|
|
13323
|
+
push(highestVersionedNodeBin(join6(home, ".nvm", "versions", "node"), name));
|
|
13324
|
+
push(highestVersionedNodeBin(join6(home, ".local", "share", "mise", "installs", "node"), name));
|
|
13325
|
+
push(highestVersionedNodeBin(join6(home, ".asdf", "installs", "nodejs"), name));
|
|
13326
|
+
push(join6(home, ".volta", "bin"));
|
|
13327
|
+
push(join6(home, ".asdf", "shims"));
|
|
13328
|
+
const systemDirs = deps.systemNpmDirs ?? (platform === "darwin" ? ["/opt/homebrew/bin", "/usr/local/bin"] : ["/usr/local/bin", "/usr/bin", join6(home, ".local", "bin")]);
|
|
13329
|
+
for (const dir of systemDirs)
|
|
13330
|
+
push(dir);
|
|
13331
|
+
}
|
|
13332
|
+
return dirs;
|
|
13333
|
+
}
|
|
13334
|
+
function resolveNpm(deps = defaultDeps()) {
|
|
13335
|
+
const name = npmBinaryName(deps.platform);
|
|
13336
|
+
const onPath = npmFromPath(deps);
|
|
13337
|
+
if (onPath)
|
|
13338
|
+
return { command: join6(onPath, name), binDir: onPath };
|
|
13339
|
+
const adjacent = npmAdjacentToNode(deps);
|
|
13340
|
+
if (adjacent)
|
|
13341
|
+
return { command: join6(adjacent, name), binDir: adjacent };
|
|
13342
|
+
for (const dir of wellKnownNpmDirs(deps)) {
|
|
13343
|
+
const candidate = join6(dir, name);
|
|
13344
|
+
if (isFile(candidate))
|
|
13345
|
+
return { command: candidate, binDir: dir };
|
|
13346
|
+
}
|
|
13347
|
+
return null;
|
|
13348
|
+
}
|
|
13349
|
+
function npmSpawnEnv(resolved, baseEnv = process.env) {
|
|
13350
|
+
if (!resolved.binDir)
|
|
13351
|
+
return { ...baseEnv };
|
|
13352
|
+
const existing = baseEnv.PATH ?? baseEnv.Path ?? "";
|
|
13353
|
+
const next = existing ? `${resolved.binDir}${delimiter}${existing}` : resolved.binDir;
|
|
13354
|
+
return { ...baseEnv, PATH: next };
|
|
13355
|
+
}
|
|
13213
13356
|
// ../aft-bridge/dist/onnx-runtime.js
|
|
13214
13357
|
import { execFileSync } from "node:child_process";
|
|
13215
13358
|
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
|
|
13359
|
+
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";
|
|
13360
|
+
import { basename, dirname as dirname4, isAbsolute as isAbsolute2, join as join7, relative, resolve, win32 } from "node:path";
|
|
13218
13361
|
import { Readable as Readable2 } from "node:stream";
|
|
13219
13362
|
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
13220
13363
|
var ORT_VERSION = "1.24.4";
|
|
@@ -13277,10 +13420,10 @@ function getManualInstallHint() {
|
|
|
13277
13420
|
}
|
|
13278
13421
|
async function ensureOnnxRuntime(storageDir) {
|
|
13279
13422
|
const info = getPlatformInfo();
|
|
13280
|
-
const ortVersionDir =
|
|
13423
|
+
const ortVersionDir = join7(storageDir, "onnxruntime", ORT_VERSION);
|
|
13281
13424
|
const libName = info?.libName ?? "libonnxruntime.dylib";
|
|
13282
13425
|
const resolvedOrtDir = resolveCachedOnnxRuntimeDir(ortVersionDir, libName);
|
|
13283
|
-
const libPath =
|
|
13426
|
+
const libPath = join7(resolvedOrtDir, libName);
|
|
13284
13427
|
if (existsSync5(libPath)) {
|
|
13285
13428
|
const meta = readOnnxInstalledMeta(ortVersionDir);
|
|
13286
13429
|
if (meta?.sha256) {
|
|
@@ -13310,9 +13453,9 @@ async function ensureOnnxRuntime(storageDir) {
|
|
|
13310
13453
|
warn(`ONNX Runtime auto-download not available for ${process.platform}/${process.arch}. Install manually: ${getManualInstallHint()}`);
|
|
13311
13454
|
return null;
|
|
13312
13455
|
}
|
|
13313
|
-
const onnxBaseDir =
|
|
13456
|
+
const onnxBaseDir = join7(storageDir, "onnxruntime");
|
|
13314
13457
|
mkdirSync5(onnxBaseDir, { recursive: true });
|
|
13315
|
-
const lockPath =
|
|
13458
|
+
const lockPath = join7(onnxBaseDir, ONNX_LOCK_FILE);
|
|
13316
13459
|
cleanupAbandonedStagingDirs(onnxBaseDir);
|
|
13317
13460
|
if (!acquireLock(lockPath)) {
|
|
13318
13461
|
warn(`ONNX Runtime install already in progress in another process (lock: ${lockPath}). Skipping.`);
|
|
@@ -13327,11 +13470,11 @@ async function ensureOnnxRuntime(storageDir) {
|
|
|
13327
13470
|
}
|
|
13328
13471
|
function cleanupAbandonedStagingDirs(onnxBaseDir) {
|
|
13329
13472
|
try {
|
|
13330
|
-
const entries =
|
|
13473
|
+
const entries = readdirSync2(onnxBaseDir);
|
|
13331
13474
|
for (const entry of entries) {
|
|
13332
13475
|
if (!entry.startsWith(`${ORT_VERSION}.tmp.`))
|
|
13333
13476
|
continue;
|
|
13334
|
-
const stagingDir =
|
|
13477
|
+
const stagingDir = join7(onnxBaseDir, entry);
|
|
13335
13478
|
const parts = entry.split(".");
|
|
13336
13479
|
const pidStr = parts[parts.length - 2];
|
|
13337
13480
|
const pid = pidStr ? Number.parseInt(pidStr, 10) : NaN;
|
|
@@ -13343,7 +13486,7 @@ function cleanupAbandonedStagingDirs(onnxBaseDir) {
|
|
|
13343
13486
|
abandoned = true;
|
|
13344
13487
|
} else {
|
|
13345
13488
|
try {
|
|
13346
|
-
const ageMs = Date.now() -
|
|
13489
|
+
const ageMs = Date.now() - statSync3(stagingDir).mtimeMs;
|
|
13347
13490
|
abandoned = ageMs > STALE_LOCK_MS;
|
|
13348
13491
|
} catch {
|
|
13349
13492
|
abandoned = true;
|
|
@@ -13368,7 +13511,7 @@ function cleanupAbandonedStagingDirs(onnxBaseDir) {
|
|
|
13368
13511
|
}
|
|
13369
13512
|
function cleanupIncompleteTargetIfUnowned(ortDir) {
|
|
13370
13513
|
try {
|
|
13371
|
-
if (existsSync5(ortDir) && !existsSync5(
|
|
13514
|
+
if (existsSync5(ortDir) && !existsSync5(join7(ortDir, ONNX_INSTALLED_META_FILE))) {
|
|
13372
13515
|
log(`[onnx] removing half-populated install dir ${ortDir} (no meta file)`);
|
|
13373
13516
|
rmSync2(ortDir, { recursive: true, force: true });
|
|
13374
13517
|
}
|
|
@@ -13397,11 +13540,11 @@ function parseOnnxVersionFromDirectoryPath(value) {
|
|
|
13397
13540
|
}
|
|
13398
13541
|
function isPathInsideRoot(root, candidate) {
|
|
13399
13542
|
const rel = relative(root, candidate);
|
|
13400
|
-
return rel === "" || !rel.startsWith("../") && !rel.startsWith("..\\") && rel !== ".." && !
|
|
13543
|
+
return rel === "" || !rel.startsWith("../") && !rel.startsWith("..\\") && rel !== ".." && !isAbsolute2(rel) && !win32.isAbsolute(rel);
|
|
13401
13544
|
}
|
|
13402
13545
|
function detectOnnxVersion(libDir, libName) {
|
|
13403
13546
|
try {
|
|
13404
|
-
const entries =
|
|
13547
|
+
const entries = readdirSync2(libDir);
|
|
13405
13548
|
const barePrefix = libName.replace(/\.(so|dylib|dll)$/, "");
|
|
13406
13549
|
const expectedPrefix = process.platform === "win32" ? barePrefix.toLowerCase() : barePrefix;
|
|
13407
13550
|
for (const entry of entries) {
|
|
@@ -13412,7 +13555,7 @@ function detectOnnxVersion(libDir, libName) {
|
|
|
13412
13555
|
if (version)
|
|
13413
13556
|
return version;
|
|
13414
13557
|
}
|
|
13415
|
-
const base =
|
|
13558
|
+
const base = join7(libDir, libName);
|
|
13416
13559
|
if (existsSync5(base)) {
|
|
13417
13560
|
try {
|
|
13418
13561
|
const real = realpathSync(base);
|
|
@@ -13444,16 +13587,16 @@ function pathEnvValue() {
|
|
|
13444
13587
|
return process.env.PATH ?? process.env.Path ?? process.env.path ?? "";
|
|
13445
13588
|
}
|
|
13446
13589
|
function pathEntriesForPlatform() {
|
|
13447
|
-
const
|
|
13448
|
-
return pathEnvValue().split(
|
|
13590
|
+
const delimiter2 = process.platform === "win32" ? ";" : ":";
|
|
13591
|
+
return pathEnvValue().split(delimiter2).map((entry) => entry.trim().replace(/^"|"$/g, "")).filter((entry) => {
|
|
13449
13592
|
if (!entry || entry === "." || entry.includes("\x00"))
|
|
13450
13593
|
return false;
|
|
13451
|
-
return
|
|
13594
|
+
return isAbsolute2(entry) || win32.isAbsolute(entry);
|
|
13452
13595
|
});
|
|
13453
13596
|
}
|
|
13454
13597
|
function directoryContainsLibrary(dir, libName) {
|
|
13455
13598
|
try {
|
|
13456
|
-
const entries =
|
|
13599
|
+
const entries = readdirSync2(dir);
|
|
13457
13600
|
if (process.platform === "win32") {
|
|
13458
13601
|
const expected = libName.toLowerCase();
|
|
13459
13602
|
return entries.some((entry) => entry.toLowerCase() === expected);
|
|
@@ -13464,10 +13607,10 @@ function directoryContainsLibrary(dir, libName) {
|
|
|
13464
13607
|
}
|
|
13465
13608
|
}
|
|
13466
13609
|
function resolveCachedOnnxRuntimeDir(ortVersionDir, libName) {
|
|
13467
|
-
if (existsSync5(
|
|
13610
|
+
if (existsSync5(join7(ortVersionDir, libName)))
|
|
13468
13611
|
return ortVersionDir;
|
|
13469
|
-
const libSubdir =
|
|
13470
|
-
if (existsSync5(
|
|
13612
|
+
const libSubdir = join7(ortVersionDir, "lib");
|
|
13613
|
+
if (existsSync5(join7(libSubdir, libName)))
|
|
13471
13614
|
return libSubdir;
|
|
13472
13615
|
return ortVersionDir;
|
|
13473
13616
|
}
|
|
@@ -13482,21 +13625,21 @@ function findSystemOnnxRuntime(libName) {
|
|
|
13482
13625
|
} else if (process.platform === "win32") {
|
|
13483
13626
|
const programFiles = process.env.ProgramFiles ?? "C:\\Program Files";
|
|
13484
13627
|
const programFilesX86 = process.env["ProgramFiles(x86)"] ?? "C:\\Program Files (x86)";
|
|
13485
|
-
searchPaths.push(
|
|
13628
|
+
searchPaths.push(join7(programFiles, "onnxruntime", "lib"), join7(programFiles, "Microsoft ONNX Runtime", "lib"), join7(programFiles, "Microsoft Machine Learning", "lib"), join7(programFilesX86, "onnxruntime", "lib"), ...(() => {
|
|
13486
13629
|
const nugetPaths = [];
|
|
13487
13630
|
const userProfile = process.env.USERPROFILE ?? "";
|
|
13488
13631
|
if (!userProfile)
|
|
13489
13632
|
return nugetPaths;
|
|
13490
|
-
const nugetPackageDir =
|
|
13633
|
+
const nugetPackageDir = join7(userProfile, ".nuget", "packages", "microsoft.ml.onnxruntime");
|
|
13491
13634
|
if (!existsSync5(nugetPackageDir))
|
|
13492
13635
|
return nugetPaths;
|
|
13493
13636
|
try {
|
|
13494
|
-
for (const entry of
|
|
13637
|
+
for (const entry of readdirSync2(nugetPackageDir, { withFileTypes: true })) {
|
|
13495
13638
|
if (!entry.isDirectory())
|
|
13496
13639
|
continue;
|
|
13497
13640
|
if (entry.name === "__globalPackagesFolder" || entry.name.startsWith("."))
|
|
13498
13641
|
continue;
|
|
13499
|
-
nugetPaths.push(
|
|
13642
|
+
nugetPaths.push(join7(nugetPackageDir, entry.name, "runtimes", "win-x64", "native"), join7(nugetPackageDir, entry.name, "runtimes", "win-arm64", "native"));
|
|
13500
13643
|
}
|
|
13501
13644
|
} catch (err) {
|
|
13502
13645
|
warn(`Failed to scan NuGet ONNX Runtime cache ${nugetPackageDir}: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -13518,7 +13661,7 @@ function findSystemOnnxRuntime(libName) {
|
|
|
13518
13661
|
});
|
|
13519
13662
|
const unknownVersionPaths = [];
|
|
13520
13663
|
for (const dir of uniquePaths) {
|
|
13521
|
-
const libPath =
|
|
13664
|
+
const libPath = join7(dir, libName);
|
|
13522
13665
|
if (process.platform === "win32") {
|
|
13523
13666
|
if (!directoryContainsLibrary(dir, libName))
|
|
13524
13667
|
continue;
|
|
@@ -13554,7 +13697,7 @@ async function downloadFileWithCap(url, destPath) {
|
|
|
13554
13697
|
if (Number.isFinite(advertised) && advertised > MAX_DOWNLOAD_BYTES2) {
|
|
13555
13698
|
throw new Error(`Content-Length ${advertised} exceeds max ${MAX_DOWNLOAD_BYTES2}`);
|
|
13556
13699
|
}
|
|
13557
|
-
mkdirSync5(
|
|
13700
|
+
mkdirSync5(dirname4(destPath), { recursive: true });
|
|
13558
13701
|
let bytesWritten = 0;
|
|
13559
13702
|
const guard = new TransformStream({
|
|
13560
13703
|
transform(chunk, transformController) {
|
|
@@ -13582,21 +13725,21 @@ function validateExtractedTree(stagingRoot) {
|
|
|
13582
13725
|
const realRoot = realpathSync(stagingRoot);
|
|
13583
13726
|
let totalBytes = 0;
|
|
13584
13727
|
const walk = (dir) => {
|
|
13585
|
-
const entries =
|
|
13728
|
+
const entries = readdirSync2(dir);
|
|
13586
13729
|
for (const entry of entries) {
|
|
13587
|
-
const fullPath =
|
|
13730
|
+
const fullPath = join7(dir, entry);
|
|
13588
13731
|
const lst = lstatSync(fullPath);
|
|
13589
13732
|
if (lst.isSymbolicLink()) {
|
|
13590
13733
|
const linkTarget = readlinkSync(fullPath);
|
|
13591
|
-
const resolvedTarget = resolve(
|
|
13734
|
+
const resolvedTarget = resolve(dirname4(fullPath), linkTarget);
|
|
13592
13735
|
const rel2 = relative(realRoot, resolvedTarget);
|
|
13593
|
-
if (rel2.startsWith("..") ||
|
|
13736
|
+
if (rel2.startsWith("..") || isAbsolute2(rel2) || win32.isAbsolute(rel2)) {
|
|
13594
13737
|
throw new Error(`extracted symlink ${fullPath} points outside staging root: ${linkTarget}`);
|
|
13595
13738
|
}
|
|
13596
13739
|
continue;
|
|
13597
13740
|
}
|
|
13598
13741
|
const rel = relative(realRoot, fullPath);
|
|
13599
|
-
if (rel.startsWith("..") ||
|
|
13742
|
+
if (rel.startsWith("..") || isAbsolute2(rel) || win32.isAbsolute(rel)) {
|
|
13600
13743
|
throw new Error(`extracted entry ${fullPath} escapes staging root`);
|
|
13601
13744
|
}
|
|
13602
13745
|
if (lst.isDirectory()) {
|
|
@@ -13619,7 +13762,7 @@ async function downloadOnnxRuntime(info, targetDir) {
|
|
|
13619
13762
|
const tmpDir = `${targetDir}.tmp.${process.pid}.${Date.now().toString(36)}`;
|
|
13620
13763
|
try {
|
|
13621
13764
|
mkdirSync5(tmpDir, { recursive: true });
|
|
13622
|
-
const archivePath =
|
|
13765
|
+
const archivePath = join7(tmpDir, `onnxruntime.${info.archiveType}`);
|
|
13623
13766
|
await downloadFileWithCap(url, archivePath);
|
|
13624
13767
|
const archiveSha256 = sha256File(archivePath);
|
|
13625
13768
|
log(`ONNX Runtime archive sha256=${archiveSha256}`);
|
|
@@ -13635,16 +13778,16 @@ async function downloadOnnxRuntime(info, targetDir) {
|
|
|
13635
13778
|
unlinkSync3(archivePath);
|
|
13636
13779
|
} catch {}
|
|
13637
13780
|
validateExtractedTree(tmpDir);
|
|
13638
|
-
const extractedDir =
|
|
13781
|
+
const extractedDir = join7(tmpDir, info.assetName, "lib");
|
|
13639
13782
|
if (!existsSync5(extractedDir)) {
|
|
13640
13783
|
throw new Error(`Expected directory not found: ${extractedDir}`);
|
|
13641
13784
|
}
|
|
13642
13785
|
mkdirSync5(targetDir, { recursive: true });
|
|
13643
|
-
const libFiles =
|
|
13786
|
+
const libFiles = readdirSync2(extractedDir).filter((f) => f.startsWith("libonnxruntime") || f.startsWith("onnxruntime"));
|
|
13644
13787
|
const realFiles = [];
|
|
13645
13788
|
const symlinks = [];
|
|
13646
13789
|
for (const libFile of libFiles) {
|
|
13647
|
-
const src =
|
|
13790
|
+
const src = join7(extractedDir, libFile);
|
|
13648
13791
|
try {
|
|
13649
13792
|
const stat = lstatSync(src);
|
|
13650
13793
|
log(`ORT extract: ${libFile} — isSymlink=${stat.isSymbolicLink()}, isFile=${stat.isFile()}, size=${stat.size}`);
|
|
@@ -13659,7 +13802,7 @@ async function downloadOnnxRuntime(info, targetDir) {
|
|
|
13659
13802
|
}
|
|
13660
13803
|
}
|
|
13661
13804
|
copyOnnxLibraries(info, extractedDir, targetDir, realFiles, symlinks);
|
|
13662
|
-
const libPath =
|
|
13805
|
+
const libPath = join7(targetDir, info.libName);
|
|
13663
13806
|
let libHash = null;
|
|
13664
13807
|
try {
|
|
13665
13808
|
libHash = sha256File(libPath);
|
|
@@ -13684,8 +13827,8 @@ async function downloadOnnxRuntime(info, targetDir) {
|
|
|
13684
13827
|
function copyOnnxLibraries(info, extractedDir, targetDir, realFiles, symlinks, copyFile = copyFileSync3) {
|
|
13685
13828
|
const requiredLibs = new Set([info.libName]);
|
|
13686
13829
|
for (const libFile of realFiles) {
|
|
13687
|
-
const src =
|
|
13688
|
-
const dst =
|
|
13830
|
+
const src = join7(extractedDir, libFile);
|
|
13831
|
+
const dst = join7(targetDir, libFile);
|
|
13689
13832
|
try {
|
|
13690
13833
|
copyFile(src, dst);
|
|
13691
13834
|
if (process.platform !== "win32") {
|
|
@@ -13701,12 +13844,12 @@ function copyOnnxLibraries(info, extractedDir, targetDir, realFiles, symlinks, c
|
|
|
13701
13844
|
}
|
|
13702
13845
|
const targetRoot = realpathSync(targetDir);
|
|
13703
13846
|
for (const link of symlinks) {
|
|
13704
|
-
const dst =
|
|
13847
|
+
const dst = join7(targetDir, link.name);
|
|
13705
13848
|
try {
|
|
13706
13849
|
unlinkSync3(dst);
|
|
13707
13850
|
} catch {}
|
|
13708
|
-
const dstForContainment =
|
|
13709
|
-
const resolvedTarget = resolve(
|
|
13851
|
+
const dstForContainment = join7(targetRoot, link.name);
|
|
13852
|
+
const resolvedTarget = resolve(dirname4(dstForContainment), link.target);
|
|
13710
13853
|
if (!isPathInsideRoot(targetRoot, resolvedTarget)) {
|
|
13711
13854
|
const message = `ONNX Runtime symlink ${link.name} points outside install dir: ${link.target}`;
|
|
13712
13855
|
if (requiredLibs.has(link.name)) {
|
|
@@ -13726,7 +13869,7 @@ function copyOnnxLibraries(info, extractedDir, targetDir, realFiles, symlinks, c
|
|
|
13726
13869
|
log(`ORT extract: failed to symlink optional ${link.name}: ${symlinkErr}`);
|
|
13727
13870
|
}
|
|
13728
13871
|
}
|
|
13729
|
-
const requiredPath =
|
|
13872
|
+
const requiredPath = join7(targetDir, info.libName);
|
|
13730
13873
|
if (!existsSync5(requiredPath)) {
|
|
13731
13874
|
rmSync2(targetDir, { recursive: true, force: true });
|
|
13732
13875
|
throw new Error(`Required ONNX Runtime library missing after install: ${requiredPath}`);
|
|
@@ -13753,15 +13896,15 @@ function writeOnnxInstalledMeta(installDir, version, sha256, archiveSha256) {
|
|
|
13753
13896
|
...sha256 ? { sha256 } : {},
|
|
13754
13897
|
archiveSha256
|
|
13755
13898
|
};
|
|
13756
|
-
writeFileSync2(
|
|
13899
|
+
writeFileSync2(join7(installDir, ONNX_INSTALLED_META_FILE), JSON.stringify(meta), "utf8");
|
|
13757
13900
|
} catch (err) {
|
|
13758
13901
|
log(`[onnx] failed to write installed-meta in ${installDir}: ${err}`);
|
|
13759
13902
|
}
|
|
13760
13903
|
}
|
|
13761
13904
|
function readOnnxInstalledMeta(installDir) {
|
|
13762
|
-
const path =
|
|
13905
|
+
const path = join7(installDir, ONNX_INSTALLED_META_FILE);
|
|
13763
13906
|
try {
|
|
13764
|
-
if (!
|
|
13907
|
+
if (!statSync3(path).isFile())
|
|
13765
13908
|
return null;
|
|
13766
13909
|
const raw = readFileSync3(path, "utf8");
|
|
13767
13910
|
const parsed = JSON.parse(raw);
|
|
@@ -13812,7 +13955,7 @@ ${new Date().toISOString()}
|
|
|
13812
13955
|
const parsed = Number.parseInt(firstLine, 10);
|
|
13813
13956
|
if (Number.isFinite(parsed) && parsed > 0)
|
|
13814
13957
|
owningPid = parsed;
|
|
13815
|
-
lockMtimeMs =
|
|
13958
|
+
lockMtimeMs = statSync3(lockPath).mtimeMs;
|
|
13816
13959
|
} catch {
|
|
13817
13960
|
return tryClaim();
|
|
13818
13961
|
}
|
|
@@ -13897,13 +14040,13 @@ function isProcessAlive(pid) {
|
|
|
13897
14040
|
}
|
|
13898
14041
|
// ../aft-bridge/dist/pool.js
|
|
13899
14042
|
import { realpathSync as realpathSync2 } from "node:fs";
|
|
13900
|
-
import { homedir as
|
|
14043
|
+
import { homedir as homedir6 } from "node:os";
|
|
13901
14044
|
var DEFAULT_IDLE_TIMEOUT_MS = Infinity;
|
|
13902
14045
|
var DEFAULT_MAX_POOL_SIZE = 8;
|
|
13903
14046
|
var CLEANUP_INTERVAL_MS = 60 * 1000;
|
|
13904
14047
|
function canonicalHomeDir() {
|
|
13905
14048
|
try {
|
|
13906
|
-
const home =
|
|
14049
|
+
const home = homedir6();
|
|
13907
14050
|
if (!home)
|
|
13908
14051
|
return null;
|
|
13909
14052
|
try {
|
|
@@ -14823,7 +14966,7 @@ import {
|
|
|
14823
14966
|
// package.json
|
|
14824
14967
|
var package_default = {
|
|
14825
14968
|
name: "@cortexkit/aft-pi",
|
|
14826
|
-
version: "0.35.
|
|
14969
|
+
version: "0.35.2",
|
|
14827
14970
|
type: "module",
|
|
14828
14971
|
description: "Pi coding agent extension for Agent File Tools (AFT) — tree-sitter and LSP-powered code analysis",
|
|
14829
14972
|
main: "dist/index.js",
|
|
@@ -14846,7 +14989,7 @@ var package_default = {
|
|
|
14846
14989
|
"test:unit": "bun test src/__tests__ --path-ignore-patterns 'src/__tests__/e2e/**'"
|
|
14847
14990
|
},
|
|
14848
14991
|
dependencies: {
|
|
14849
|
-
"@cortexkit/aft-bridge": "0.35.
|
|
14992
|
+
"@cortexkit/aft-bridge": "0.35.2",
|
|
14850
14993
|
"@xterm/headless": "^5.5.0",
|
|
14851
14994
|
"comment-json": "^5.0.0",
|
|
14852
14995
|
diff: "^8.0.4",
|
|
@@ -14854,12 +14997,12 @@ var package_default = {
|
|
|
14854
14997
|
zod: "^4.1.8"
|
|
14855
14998
|
},
|
|
14856
14999
|
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.
|
|
15000
|
+
"@cortexkit/aft-darwin-arm64": "0.35.2",
|
|
15001
|
+
"@cortexkit/aft-darwin-x64": "0.35.2",
|
|
15002
|
+
"@cortexkit/aft-linux-arm64": "0.35.2",
|
|
15003
|
+
"@cortexkit/aft-linux-x64": "0.35.2",
|
|
15004
|
+
"@cortexkit/aft-win32-arm64": "0.35.2",
|
|
15005
|
+
"@cortexkit/aft-win32-x64": "0.35.2"
|
|
14863
15006
|
},
|
|
14864
15007
|
devDependencies: {
|
|
14865
15008
|
"@earendil-works/pi-coding-agent": "*",
|
|
@@ -15506,8 +15649,8 @@ function registerStatusCommand(pi, ctx) {
|
|
|
15506
15649
|
|
|
15507
15650
|
// src/config.ts
|
|
15508
15651
|
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
|
|
15652
|
+
import { homedir as homedir7 } from "node:os";
|
|
15653
|
+
import { join as join9 } from "node:path";
|
|
15511
15654
|
var import_comment_json = __toESM(require_src2(), 1);
|
|
15512
15655
|
|
|
15513
15656
|
// ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
@@ -17094,8 +17237,8 @@ function emoji() {
|
|
|
17094
17237
|
}
|
|
17095
17238
|
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
17239
|
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(
|
|
17240
|
+
var mac = (delimiter2) => {
|
|
17241
|
+
const escapedDelim = escapeRegex(delimiter2 ?? ":");
|
|
17099
17242
|
return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);
|
|
17100
17243
|
};
|
|
17101
17244
|
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 +29784,15 @@ function mergeConfigs(base, override) {
|
|
|
29641
29784
|
};
|
|
29642
29785
|
}
|
|
29643
29786
|
function getGlobalPiDir() {
|
|
29644
|
-
return
|
|
29787
|
+
return join9(homedir7(), ".pi", "agent");
|
|
29645
29788
|
}
|
|
29646
29789
|
function loadAftConfig(projectDirectory) {
|
|
29647
|
-
const userBasePath =
|
|
29790
|
+
const userBasePath = join9(getGlobalPiDir(), "aft");
|
|
29648
29791
|
migrateAftConfigFile(`${userBasePath}.jsonc`);
|
|
29649
29792
|
migrateAftConfigFile(`${userBasePath}.json`);
|
|
29650
29793
|
const userDetected = detectConfigFile(userBasePath);
|
|
29651
29794
|
const userConfigPath = userDetected.format !== "none" ? userDetected.path : `${userBasePath}.json`;
|
|
29652
|
-
const projectBasePath =
|
|
29795
|
+
const projectBasePath = join9(projectDirectory, ".pi", "aft");
|
|
29653
29796
|
migrateAftConfigFile(`${projectBasePath}.jsonc`);
|
|
29654
29797
|
migrateAftConfigFile(`${projectBasePath}.json`);
|
|
29655
29798
|
const projectDetected = detectConfigFile(projectBasePath);
|
|
@@ -29676,8 +29819,8 @@ function loadAftConfig(projectDirectory) {
|
|
|
29676
29819
|
// src/lsp-auto-install.ts
|
|
29677
29820
|
import { spawn as spawn2 } from "node:child_process";
|
|
29678
29821
|
import { createHash as createHash3 } from "node:crypto";
|
|
29679
|
-
import { createReadStream, mkdirSync as mkdirSync7, readFileSync as readFileSync7, renameSync as renameSync5, rmSync as rmSync3, statSync as
|
|
29680
|
-
import { join as
|
|
29822
|
+
import { createReadStream, mkdirSync as mkdirSync7, readFileSync as readFileSync7, renameSync as renameSync5, rmSync as rmSync3, statSync as statSync5 } from "node:fs";
|
|
29823
|
+
import { join as join12 } from "node:path";
|
|
29681
29824
|
|
|
29682
29825
|
// src/lsp-cache.ts
|
|
29683
29826
|
import {
|
|
@@ -29685,40 +29828,40 @@ import {
|
|
|
29685
29828
|
mkdirSync as mkdirSync6,
|
|
29686
29829
|
openSync as openSync4,
|
|
29687
29830
|
readFileSync as readFileSync5,
|
|
29688
|
-
statSync as
|
|
29831
|
+
statSync as statSync4,
|
|
29689
29832
|
unlinkSync as unlinkSync5,
|
|
29690
29833
|
writeFileSync as writeFileSync4
|
|
29691
29834
|
} from "node:fs";
|
|
29692
|
-
import { homedir as
|
|
29693
|
-
import { join as
|
|
29835
|
+
import { homedir as homedir8 } from "node:os";
|
|
29836
|
+
import { join as join10 } from "node:path";
|
|
29694
29837
|
function aftCacheBase() {
|
|
29695
29838
|
const override = process.env.AFT_CACHE_DIR;
|
|
29696
29839
|
if (override && override.length > 0)
|
|
29697
29840
|
return override;
|
|
29698
29841
|
if (process.platform === "win32") {
|
|
29699
29842
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
29700
|
-
const base2 = localAppData ||
|
|
29701
|
-
return
|
|
29843
|
+
const base2 = localAppData || join10(homedir8(), "AppData", "Local");
|
|
29844
|
+
return join10(base2, "aft");
|
|
29702
29845
|
}
|
|
29703
|
-
const base = process.env.XDG_CACHE_HOME ||
|
|
29704
|
-
return
|
|
29846
|
+
const base = process.env.XDG_CACHE_HOME || join10(homedir8(), ".cache");
|
|
29847
|
+
return join10(base, "aft");
|
|
29705
29848
|
}
|
|
29706
29849
|
function lspCacheRoot() {
|
|
29707
|
-
return
|
|
29850
|
+
return join10(aftCacheBase(), "lsp-packages");
|
|
29708
29851
|
}
|
|
29709
29852
|
function lspPackageDir(npmPackage) {
|
|
29710
|
-
return
|
|
29853
|
+
return join10(lspCacheRoot(), encodeURIComponent(npmPackage));
|
|
29711
29854
|
}
|
|
29712
29855
|
function lspBinaryPath(npmPackage, binary) {
|
|
29713
|
-
return
|
|
29856
|
+
return join10(lspPackageDir(npmPackage), "node_modules", ".bin", binary);
|
|
29714
29857
|
}
|
|
29715
29858
|
function lspBinDir(npmPackage) {
|
|
29716
|
-
return
|
|
29859
|
+
return join10(lspPackageDir(npmPackage), "node_modules", ".bin");
|
|
29717
29860
|
}
|
|
29718
29861
|
function isInstalled(npmPackage, binary) {
|
|
29719
29862
|
for (const candidate of lspBinaryCandidates(binary)) {
|
|
29720
29863
|
try {
|
|
29721
|
-
if (
|
|
29864
|
+
if (statSync4(join10(lspBinDir(npmPackage), candidate)).isFile())
|
|
29722
29865
|
return true;
|
|
29723
29866
|
} catch {}
|
|
29724
29867
|
}
|
|
@@ -29738,15 +29881,15 @@ function writeInstalledMetaIn(installDir, version2, sha256) {
|
|
|
29738
29881
|
installedAt: new Date().toISOString(),
|
|
29739
29882
|
...sha256 ? { sha256 } : {}
|
|
29740
29883
|
};
|
|
29741
|
-
writeFileSync4(
|
|
29884
|
+
writeFileSync4(join10(installDir, INSTALLED_META_FILE), JSON.stringify(meta3), "utf8");
|
|
29742
29885
|
} catch (err) {
|
|
29743
29886
|
log2(`[lsp-cache] failed to write installed-meta in ${installDir}: ${err}`);
|
|
29744
29887
|
}
|
|
29745
29888
|
}
|
|
29746
29889
|
function readInstalledMetaIn(installDir) {
|
|
29747
|
-
const path2 =
|
|
29890
|
+
const path2 = join10(installDir, INSTALLED_META_FILE);
|
|
29748
29891
|
try {
|
|
29749
|
-
if (!
|
|
29892
|
+
if (!statSync4(path2).isFile())
|
|
29750
29893
|
return null;
|
|
29751
29894
|
const raw = readFileSync5(path2, "utf8");
|
|
29752
29895
|
const parsed = JSON.parse(raw);
|
|
@@ -29768,7 +29911,7 @@ function readInstalledMeta(packageKey) {
|
|
|
29768
29911
|
return readInstalledMetaIn(lspPackageDir(packageKey));
|
|
29769
29912
|
}
|
|
29770
29913
|
function lockPath(npmPackage) {
|
|
29771
|
-
return
|
|
29914
|
+
return join10(lspPackageDir(npmPackage), ".aft-installing");
|
|
29772
29915
|
}
|
|
29773
29916
|
var STALE_LOCK_MS2 = 30 * 60 * 1000;
|
|
29774
29917
|
function acquireInstallLock(lockKey) {
|
|
@@ -29803,7 +29946,7 @@ ${new Date().toISOString()}
|
|
|
29803
29946
|
const parsed = Number.parseInt(firstLine, 10);
|
|
29804
29947
|
if (Number.isFinite(parsed) && parsed > 0)
|
|
29805
29948
|
owningPid = parsed;
|
|
29806
|
-
lockMtimeMs =
|
|
29949
|
+
lockMtimeMs = statSync4(lock).mtimeMs;
|
|
29807
29950
|
} catch {
|
|
29808
29951
|
return tryClaim();
|
|
29809
29952
|
}
|
|
@@ -29875,7 +30018,7 @@ async function withInstallLock(lockKey, task) {
|
|
|
29875
30018
|
}
|
|
29876
30019
|
var VERSION_CHECK_FILE = ".aft-version-check";
|
|
29877
30020
|
function readVersionCheck(npmPackage) {
|
|
29878
|
-
const file2 =
|
|
30021
|
+
const file2 = join10(lspPackageDir(npmPackage), VERSION_CHECK_FILE);
|
|
29879
30022
|
try {
|
|
29880
30023
|
const raw = readFileSync5(file2, "utf8");
|
|
29881
30024
|
const parsed = JSON.parse(raw);
|
|
@@ -29892,7 +30035,7 @@ function readVersionCheck(npmPackage) {
|
|
|
29892
30035
|
}
|
|
29893
30036
|
function writeVersionCheck(npmPackage, latest) {
|
|
29894
30037
|
mkdirSync6(lspPackageDir(npmPackage), { recursive: true });
|
|
29895
|
-
const file2 =
|
|
30038
|
+
const file2 = join10(lspPackageDir(npmPackage), VERSION_CHECK_FILE);
|
|
29896
30039
|
const record2 = {
|
|
29897
30040
|
last_checked: new Date().toISOString(),
|
|
29898
30041
|
latest_eligible: latest
|
|
@@ -30054,8 +30197,8 @@ var NPM_LSP_TABLE = [
|
|
|
30054
30197
|
];
|
|
30055
30198
|
|
|
30056
30199
|
// src/lsp-project-relevance.ts
|
|
30057
|
-
import { existsSync as existsSync7, readdirSync as
|
|
30058
|
-
import { join as
|
|
30200
|
+
import { existsSync as existsSync7, readdirSync as readdirSync3, readFileSync as readFileSync6 } from "node:fs";
|
|
30201
|
+
import { join as join11 } from "node:path";
|
|
30059
30202
|
var MAX_WALK_DIRS = 200;
|
|
30060
30203
|
var MAX_WALK_DEPTH = 4;
|
|
30061
30204
|
var NOISE_DIRS = new Set([
|
|
@@ -30072,7 +30215,7 @@ function hasRootMarker(projectRoot, rootMarkers) {
|
|
|
30072
30215
|
if (!rootMarkers)
|
|
30073
30216
|
return false;
|
|
30074
30217
|
for (const marker of rootMarkers) {
|
|
30075
|
-
if (existsSync7(
|
|
30218
|
+
if (existsSync7(join11(projectRoot, marker)))
|
|
30076
30219
|
return true;
|
|
30077
30220
|
}
|
|
30078
30221
|
return false;
|
|
@@ -30096,7 +30239,7 @@ function hasPackageJsonDep(projectRoot, depNames) {
|
|
|
30096
30239
|
}
|
|
30097
30240
|
function readPackageJson(projectRoot) {
|
|
30098
30241
|
try {
|
|
30099
|
-
const raw = readFileSync6(
|
|
30242
|
+
const raw = readFileSync6(join11(projectRoot, "package.json"), "utf8");
|
|
30100
30243
|
const parsed = JSON.parse(raw);
|
|
30101
30244
|
if (typeof parsed !== "object" || parsed === null)
|
|
30102
30245
|
return null;
|
|
@@ -30119,14 +30262,14 @@ function relevantExtensionsInProject(projectRoot, extToServer) {
|
|
|
30119
30262
|
visitedDirs += 1;
|
|
30120
30263
|
let entries;
|
|
30121
30264
|
try {
|
|
30122
|
-
entries =
|
|
30265
|
+
entries = readdirSync3(current.dir, { withFileTypes: true });
|
|
30123
30266
|
} catch {
|
|
30124
30267
|
continue;
|
|
30125
30268
|
}
|
|
30126
30269
|
for (const entry of entries) {
|
|
30127
30270
|
if (entry.isDirectory()) {
|
|
30128
30271
|
if (current.depth < MAX_WALK_DEPTH && !NOISE_DIRS.has(entry.name.toLowerCase())) {
|
|
30129
|
-
queue.push({ dir:
|
|
30272
|
+
queue.push({ dir: join11(current.dir, entry.name), depth: current.depth + 1 });
|
|
30130
30273
|
}
|
|
30131
30274
|
continue;
|
|
30132
30275
|
}
|
|
@@ -30260,10 +30403,16 @@ function runInstall(spec, version2, cwd, signal) {
|
|
|
30260
30403
|
resolve2(false);
|
|
30261
30404
|
return;
|
|
30262
30405
|
}
|
|
30263
|
-
const
|
|
30264
|
-
|
|
30406
|
+
const npm = resolveNpm();
|
|
30407
|
+
if (!npm) {
|
|
30408
|
+
warn2(`[lsp] npm not found on PATH or known locations; cannot install ${target}`);
|
|
30409
|
+
resolve2(false);
|
|
30410
|
+
return;
|
|
30411
|
+
}
|
|
30412
|
+
const child = spawn2(npm.command, ["install", "--no-save", "--ignore-scripts", "--silent", target], {
|
|
30265
30413
|
stdio: ["ignore", "pipe", "pipe"],
|
|
30266
|
-
cwd
|
|
30414
|
+
cwd,
|
|
30415
|
+
env: npmSpawnEnv(npm)
|
|
30267
30416
|
});
|
|
30268
30417
|
child.unref();
|
|
30269
30418
|
let stderrBuf = "";
|
|
@@ -30390,7 +30539,7 @@ function hashInstalledBinary(spec) {
|
|
|
30390
30539
|
let pathToHash = null;
|
|
30391
30540
|
for (const p of candidates) {
|
|
30392
30541
|
try {
|
|
30393
|
-
if (
|
|
30542
|
+
if (statSync5(p).isFile()) {
|
|
30394
30543
|
pathToHash = p;
|
|
30395
30544
|
break;
|
|
30396
30545
|
}
|
|
@@ -30416,7 +30565,7 @@ function installedBinaryPath(spec) {
|
|
|
30416
30565
|
] : [lspBinaryPath(spec.npm, spec.binary)];
|
|
30417
30566
|
for (const candidate of candidates) {
|
|
30418
30567
|
try {
|
|
30419
|
-
if (
|
|
30568
|
+
if (statSync5(candidate).isFile())
|
|
30420
30569
|
return candidate;
|
|
30421
30570
|
} catch {}
|
|
30422
30571
|
}
|
|
@@ -30427,10 +30576,10 @@ function sha256OfFileSync(path2) {
|
|
|
30427
30576
|
}
|
|
30428
30577
|
function quarantineCachedNpmInstall(spec, reason) {
|
|
30429
30578
|
const packageDir = lspPackageDir(spec.npm);
|
|
30430
|
-
const dest =
|
|
30579
|
+
const dest = join12(packageDir, "..", ".quarantine", encodeURIComponent(spec.npm), `${Date.now()}`);
|
|
30431
30580
|
warn2(`[lsp] tofu_mismatch ${spec.npm}: ${reason}; quarantining ${packageDir} -> ${dest}`);
|
|
30432
30581
|
try {
|
|
30433
|
-
mkdirSync7(
|
|
30582
|
+
mkdirSync7(join12(dest, ".."), { recursive: true });
|
|
30434
30583
|
rmSync3(dest, { recursive: true, force: true });
|
|
30435
30584
|
renameSync5(packageDir, dest);
|
|
30436
30585
|
} catch (err) {
|
|
@@ -30515,17 +30664,17 @@ import {
|
|
|
30515
30664
|
existsSync as existsSync8,
|
|
30516
30665
|
lstatSync as lstatSync2,
|
|
30517
30666
|
mkdirSync as mkdirSync8,
|
|
30518
|
-
readdirSync as
|
|
30667
|
+
readdirSync as readdirSync4,
|
|
30519
30668
|
readFileSync as readFileSync8,
|
|
30520
30669
|
readlinkSync as readlinkSync2,
|
|
30521
30670
|
realpathSync as realpathSync3,
|
|
30522
30671
|
renameSync as renameSync6,
|
|
30523
30672
|
rmSync as rmSync4,
|
|
30524
|
-
statSync as
|
|
30673
|
+
statSync as statSync6,
|
|
30525
30674
|
unlinkSync as unlinkSync6,
|
|
30526
30675
|
writeFileSync as writeFileSync5
|
|
30527
30676
|
} from "node:fs";
|
|
30528
|
-
import { dirname as
|
|
30677
|
+
import { dirname as dirname5, join as join13, relative as relative2, resolve as resolve2 } from "node:path";
|
|
30529
30678
|
import { Readable as Readable3 } from "node:stream";
|
|
30530
30679
|
import { pipeline as pipeline3 } from "node:stream/promises";
|
|
30531
30680
|
|
|
@@ -30615,26 +30764,26 @@ function detectHostPlatform() {
|
|
|
30615
30764
|
|
|
30616
30765
|
// src/lsp-github-install.ts
|
|
30617
30766
|
function ghCacheRoot() {
|
|
30618
|
-
return
|
|
30767
|
+
return join13(aftCacheBase(), "lsp-binaries");
|
|
30619
30768
|
}
|
|
30620
30769
|
function ghPackageDir(spec) {
|
|
30621
|
-
return
|
|
30770
|
+
return join13(ghCacheRoot(), spec.id);
|
|
30622
30771
|
}
|
|
30623
30772
|
function ghBinDir(spec) {
|
|
30624
|
-
return
|
|
30773
|
+
return join13(ghPackageDir(spec), "bin");
|
|
30625
30774
|
}
|
|
30626
30775
|
function ghExtractDir(spec) {
|
|
30627
|
-
return
|
|
30776
|
+
return join13(ghPackageDir(spec), "extracted");
|
|
30628
30777
|
}
|
|
30629
30778
|
var INSTALLED_META_FILE2 = ".aft-installed";
|
|
30630
30779
|
function ghBinaryPath(spec, platform) {
|
|
30631
30780
|
const ext = platform === "win32" ? ".exe" : "";
|
|
30632
|
-
return
|
|
30781
|
+
return join13(ghBinDir(spec), `${spec.binary}${ext}`);
|
|
30633
30782
|
}
|
|
30634
30783
|
function isGithubInstalled(spec, platform) {
|
|
30635
30784
|
for (const candidate of ghBinaryCandidates(spec, platform)) {
|
|
30636
30785
|
try {
|
|
30637
|
-
if (
|
|
30786
|
+
if (statSync6(join13(ghBinDir(spec), candidate)).isFile())
|
|
30638
30787
|
return true;
|
|
30639
30788
|
} catch {}
|
|
30640
30789
|
}
|
|
@@ -30647,8 +30796,8 @@ function ghBinaryCandidates(spec, platform) {
|
|
|
30647
30796
|
}
|
|
30648
30797
|
function readGithubInstalledMetaIn(installDir) {
|
|
30649
30798
|
try {
|
|
30650
|
-
const path2 =
|
|
30651
|
-
if (!
|
|
30799
|
+
const path2 = join13(installDir, INSTALLED_META_FILE2);
|
|
30800
|
+
if (!statSync6(path2).isFile())
|
|
30652
30801
|
return null;
|
|
30653
30802
|
const parsed = JSON.parse(readFileSync8(path2, "utf8"));
|
|
30654
30803
|
if (typeof parsed.version !== "string" || parsed.version.length === 0)
|
|
@@ -30674,7 +30823,7 @@ function writeGithubInstalledMetaIn(installDir, version2, binarySha256, archiveS
|
|
|
30674
30823
|
binarySha256,
|
|
30675
30824
|
...archiveSha256 ? { archiveSha256 } : {}
|
|
30676
30825
|
};
|
|
30677
|
-
writeFileSync5(
|
|
30826
|
+
writeFileSync5(join13(installDir, INSTALLED_META_FILE2), JSON.stringify(meta3), "utf8");
|
|
30678
30827
|
} catch (err) {
|
|
30679
30828
|
warn2(`[lsp] failed to write github installed metadata in ${installDir}: ${err}`);
|
|
30680
30829
|
}
|
|
@@ -30867,7 +31016,7 @@ async function downloadFile(url2, destPath, fetchImpl, assetSize, signal) {
|
|
|
30867
31016
|
if (Number.isFinite(advertised) && advertised > MAX_DOWNLOAD_BYTES3) {
|
|
30868
31017
|
throw new Error(`Content-Length ${advertised} exceeds max ${MAX_DOWNLOAD_BYTES3}`);
|
|
30869
31018
|
}
|
|
30870
|
-
mkdirSync8(
|
|
31019
|
+
mkdirSync8(dirname5(destPath), { recursive: true });
|
|
30871
31020
|
let bytesWritten = 0;
|
|
30872
31021
|
const guard = new TransformStream({
|
|
30873
31022
|
transform(chunk, controller) {
|
|
@@ -30918,12 +31067,12 @@ function validateExtraction(stagingRoot) {
|
|
|
30918
31067
|
const walk = (dir) => {
|
|
30919
31068
|
let entries;
|
|
30920
31069
|
try {
|
|
30921
|
-
entries =
|
|
31070
|
+
entries = readdirSync4(dir);
|
|
30922
31071
|
} catch (err) {
|
|
30923
31072
|
throw new Error(`failed to read staging dir ${dir}: ${err}`);
|
|
30924
31073
|
}
|
|
30925
31074
|
for (const entry of entries) {
|
|
30926
|
-
const full =
|
|
31075
|
+
const full = join13(dir, entry);
|
|
30927
31076
|
let lst;
|
|
30928
31077
|
try {
|
|
30929
31078
|
lst = lstatSync2(full);
|
|
@@ -31011,10 +31160,10 @@ function extractArchiveSafely(archivePath, destDir, archiveType) {
|
|
|
31011
31160
|
}
|
|
31012
31161
|
function quarantineCachedGithubInstall(spec, reason) {
|
|
31013
31162
|
const packageDir = ghPackageDir(spec);
|
|
31014
|
-
const dest =
|
|
31163
|
+
const dest = join13(ghCacheRoot(), ".quarantine", encodeURIComponent(spec.id), `${Date.now()}`);
|
|
31015
31164
|
warn2(`[lsp] tofu_mismatch ${spec.id}: ${reason}; quarantining ${packageDir} -> ${dest}`);
|
|
31016
31165
|
try {
|
|
31017
|
-
mkdirSync8(
|
|
31166
|
+
mkdirSync8(dirname5(dest), { recursive: true });
|
|
31018
31167
|
rmSync4(dest, { recursive: true, force: true });
|
|
31019
31168
|
renameSync6(packageDir, dest);
|
|
31020
31169
|
} catch (err) {
|
|
@@ -31024,9 +31173,9 @@ function quarantineCachedGithubInstall(spec, reason) {
|
|
|
31024
31173
|
function validateCachedGithubInstall(spec, platform) {
|
|
31025
31174
|
const packageDir = ghPackageDir(spec);
|
|
31026
31175
|
const meta3 = readGithubInstalledMetaIn(packageDir);
|
|
31027
|
-
const binaryPath = ghBinaryCandidates(spec, platform).map((candidate) =>
|
|
31176
|
+
const binaryPath = ghBinaryCandidates(spec, platform).map((candidate) => join13(ghBinDir(spec), candidate)).find((candidate) => {
|
|
31028
31177
|
try {
|
|
31029
|
-
return
|
|
31178
|
+
return statSync6(candidate).isFile();
|
|
31030
31179
|
} catch {
|
|
31031
31180
|
return false;
|
|
31032
31181
|
}
|
|
@@ -31102,7 +31251,7 @@ async function downloadAndInstall(spec, tag, assets, platform, arch, fetchImpl,
|
|
|
31102
31251
|
}
|
|
31103
31252
|
const pkgDir = ghPackageDir(spec);
|
|
31104
31253
|
const extractDir = ghExtractDir(spec);
|
|
31105
|
-
const archivePath =
|
|
31254
|
+
const archivePath = join13(pkgDir, expected.name);
|
|
31106
31255
|
log2(`[lsp] downloading ${spec.id} ${tag} → ${matchingAsset.url}`);
|
|
31107
31256
|
try {
|
|
31108
31257
|
await downloadFile(matchingAsset.url, archivePath, fetchImpl, matchingAsset.size, signal);
|
|
@@ -31142,13 +31291,13 @@ async function downloadAndInstall(spec, tag, assets, platform, arch, fetchImpl,
|
|
|
31142
31291
|
unlinkSync6(archivePath);
|
|
31143
31292
|
} catch {}
|
|
31144
31293
|
}
|
|
31145
|
-
const innerBinaryPath =
|
|
31294
|
+
const innerBinaryPath = join13(extractDir, spec.binaryPathInArchive(platform, arch, version2));
|
|
31146
31295
|
if (!existsSync8(innerBinaryPath)) {
|
|
31147
31296
|
error2(`[lsp] ${spec.id}: extracted binary not found at ${innerBinaryPath}`);
|
|
31148
31297
|
return null;
|
|
31149
31298
|
}
|
|
31150
31299
|
const targetBinary = ghBinaryPath(spec, platform);
|
|
31151
|
-
mkdirSync8(
|
|
31300
|
+
mkdirSync8(dirname5(targetBinary), { recursive: true });
|
|
31152
31301
|
try {
|
|
31153
31302
|
copyFileSync4(innerBinaryPath, targetBinary);
|
|
31154
31303
|
if (platform !== "win32") {
|
|
@@ -31596,8 +31745,8 @@ import { Type as Type3 } from "typebox";
|
|
|
31596
31745
|
|
|
31597
31746
|
// src/tools/hoisted.ts
|
|
31598
31747
|
import { stat } from "node:fs/promises";
|
|
31599
|
-
import { homedir as
|
|
31600
|
-
import { isAbsolute as
|
|
31748
|
+
import { homedir as homedir9 } from "node:os";
|
|
31749
|
+
import { isAbsolute as isAbsolute3, relative as relative3, resolve as resolve3, sep } from "node:path";
|
|
31601
31750
|
import {
|
|
31602
31751
|
renderDiff
|
|
31603
31752
|
} from "@earendil-works/pi-coding-agent";
|
|
@@ -31713,15 +31862,15 @@ function diagnosticsOnEditDefault(ctx) {
|
|
|
31713
31862
|
}
|
|
31714
31863
|
function containsPath(parent, child) {
|
|
31715
31864
|
const rel = relative3(parent, child);
|
|
31716
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
31865
|
+
return rel === "" || !rel.startsWith("..") && !isAbsolute3(rel);
|
|
31717
31866
|
}
|
|
31718
31867
|
function expandTilde(path2) {
|
|
31719
31868
|
if (!path2 || !path2.startsWith("~"))
|
|
31720
31869
|
return path2;
|
|
31721
31870
|
if (path2 === "~")
|
|
31722
|
-
return
|
|
31871
|
+
return homedir9();
|
|
31723
31872
|
if (path2.startsWith(`~${sep}`) || path2.startsWith("~/")) {
|
|
31724
|
-
return resolve3(
|
|
31873
|
+
return resolve3(homedir9(), path2.slice(2));
|
|
31725
31874
|
}
|
|
31726
31875
|
return path2;
|
|
31727
31876
|
}
|
|
@@ -31736,7 +31885,7 @@ async function assertExternalDirectoryPermission(extCtx, target, action = "modif
|
|
|
31736
31885
|
if (!target)
|
|
31737
31886
|
return;
|
|
31738
31887
|
const expanded = expandTilde(target);
|
|
31739
|
-
const absoluteTarget =
|
|
31888
|
+
const absoluteTarget = isAbsolute3(expanded) ? expanded : resolve3(extCtx.cwd, expanded);
|
|
31740
31889
|
if (containsPath(extCtx.cwd, absoluteTarget))
|
|
31741
31890
|
return;
|
|
31742
31891
|
if (options.restrictToProjectRoot === false)
|
|
@@ -31857,7 +32006,7 @@ function registerHoistedTools(pi, ctx, surface) {
|
|
|
31857
32006
|
diagnostics: params.diagnostics ?? diagnosticsOnEditDefault(ctx),
|
|
31858
32007
|
include_diff_content: true
|
|
31859
32008
|
}, extCtx);
|
|
31860
|
-
return buildMutationResult(
|
|
32009
|
+
return buildMutationResult(response);
|
|
31861
32010
|
},
|
|
31862
32011
|
renderCall(args, theme, context) {
|
|
31863
32012
|
return renderMutationCall("write", args?.filePath, theme, context);
|
|
@@ -31893,7 +32042,7 @@ function registerHoistedTools(pi, ctx, surface) {
|
|
|
31893
32042
|
include_diff_content: true
|
|
31894
32043
|
};
|
|
31895
32044
|
const response2 = await callBridge(bridge, "edit_match", req2, extCtx);
|
|
31896
|
-
return buildMutationResult(
|
|
32045
|
+
return buildMutationResult(response2);
|
|
31897
32046
|
}
|
|
31898
32047
|
const req = {
|
|
31899
32048
|
file: params.filePath,
|
|
@@ -31908,7 +32057,7 @@ function registerHoistedTools(pi, ctx, surface) {
|
|
|
31908
32057
|
if (occurrence !== undefined)
|
|
31909
32058
|
req.occurrence = occurrence;
|
|
31910
32059
|
const response = await callBridge(bridge, "edit_match", req, extCtx);
|
|
31911
|
-
return buildMutationResult(
|
|
32060
|
+
return buildMutationResult(response);
|
|
31912
32061
|
},
|
|
31913
32062
|
renderCall(args, theme, context) {
|
|
31914
32063
|
return renderMutationCall("edit", args?.filePath, theme, context);
|
|
@@ -31949,7 +32098,7 @@ function registerHoistedTools(pi, ctx, surface) {
|
|
|
31949
32098
|
});
|
|
31950
32099
|
}
|
|
31951
32100
|
}
|
|
31952
|
-
function buildMutationResult(
|
|
32101
|
+
function buildMutationResult(response) {
|
|
31953
32102
|
const diffObj = response.diff;
|
|
31954
32103
|
const additions = diffObj?.additions ?? 0;
|
|
31955
32104
|
const deletions = diffObj?.deletions ?? 0;
|
|
@@ -31967,8 +32116,7 @@ function buildMutationResult(filePath, response) {
|
|
|
31967
32116
|
diffText = piDiff.diff;
|
|
31968
32117
|
firstChangedLine = piDiff.firstChangedLine;
|
|
31969
32118
|
}
|
|
31970
|
-
|
|
31971
|
-
let text = summaryHeader;
|
|
32119
|
+
let text = formatEditSummary(response);
|
|
31972
32120
|
if (noOp) {
|
|
31973
32121
|
text += `
|
|
31974
32122
|
|
|
@@ -32090,14 +32238,14 @@ ${summary}${suffix}`);
|
|
|
32090
32238
|
return container;
|
|
32091
32239
|
}
|
|
32092
32240
|
function shortenPath(path2) {
|
|
32093
|
-
const home =
|
|
32241
|
+
const home = homedir9();
|
|
32094
32242
|
if (path2.startsWith(home))
|
|
32095
32243
|
return `~${path2.slice(home.length)}`;
|
|
32096
32244
|
return path2;
|
|
32097
32245
|
}
|
|
32098
32246
|
async function resolvePathArg(cwd, path2) {
|
|
32099
32247
|
const expanded = expandTilde(path2);
|
|
32100
|
-
const abs =
|
|
32248
|
+
const abs = isAbsolute3(expanded) ? expanded : resolve3(cwd, expanded);
|
|
32101
32249
|
try {
|
|
32102
32250
|
await stat(abs);
|
|
32103
32251
|
return abs;
|
|
@@ -32151,7 +32299,7 @@ function formatReadFooter(agentSpecifiedRange, data) {
|
|
|
32151
32299
|
}
|
|
32152
32300
|
|
|
32153
32301
|
// src/tools/render-helpers.ts
|
|
32154
|
-
import { homedir as
|
|
32302
|
+
import { homedir as homedir10 } from "node:os";
|
|
32155
32303
|
import { renderDiff as renderDiff2 } from "@earendil-works/pi-coding-agent";
|
|
32156
32304
|
import { Container as Container2, Spacer as Spacer2, Text as Text2 } from "@earendil-works/pi-tui";
|
|
32157
32305
|
function reuseText2(last) {
|
|
@@ -32161,7 +32309,7 @@ function reuseContainer2(last) {
|
|
|
32161
32309
|
return last instanceof Container2 ? last : new Container2;
|
|
32162
32310
|
}
|
|
32163
32311
|
function shortenPath2(path2) {
|
|
32164
|
-
const home =
|
|
32312
|
+
const home = homedir10();
|
|
32165
32313
|
if (path2.startsWith(home))
|
|
32166
32314
|
return `~${path2.slice(home.length)}`;
|
|
32167
32315
|
return path2;
|
|
@@ -34788,6 +34936,14 @@ function semanticHonestyNote(response, theme) {
|
|
|
34788
34936
|
notes.push("partial/incomplete");
|
|
34789
34937
|
return notes.length > 0 ? theme.fg("warning", `Search status: ${notes.join("; ")}.`) : undefined;
|
|
34790
34938
|
}
|
|
34939
|
+
function extraAgentHonestyNote(response) {
|
|
34940
|
+
const notes = [];
|
|
34941
|
+
if (response.fully_degraded === true)
|
|
34942
|
+
notes.push("fully degraded");
|
|
34943
|
+
if (response.complete === false)
|
|
34944
|
+
notes.push("partial/incomplete");
|
|
34945
|
+
return notes.length > 0 ? `Search status: ${notes.join("; ")}.` : undefined;
|
|
34946
|
+
}
|
|
34791
34947
|
var SearchParams2 = Type13.Object({
|
|
34792
34948
|
query: Type13.String({
|
|
34793
34949
|
description: "Concept, regex, literal text, filename, or capability to find. Examples: 'fuzzy match with whitespace tolerance', '^export', 'Cargo.lock'."
|
|
@@ -34923,7 +35079,12 @@ function registerSemanticTool(pi, ctx) {
|
|
|
34923
35079
|
if (params.hint !== undefined)
|
|
34924
35080
|
req.hint = params.hint;
|
|
34925
35081
|
const response = await callBridge(bridge, "semantic_search", req, extCtx);
|
|
34926
|
-
|
|
35082
|
+
let agentText = response.text ?? "No results.";
|
|
35083
|
+
const extra = extraAgentHonestyNote(response);
|
|
35084
|
+
if (extra)
|
|
35085
|
+
agentText = `${agentText}
|
|
35086
|
+
${extra}`;
|
|
35087
|
+
return textResult(agentText, response);
|
|
34927
35088
|
},
|
|
34928
35089
|
renderCall(args, theme, context) {
|
|
34929
35090
|
return renderSemanticCall(args, theme, context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-auto-install.d.ts","sourceRoot":"","sources":["../src/lsp-auto-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;
|
|
1
|
+
{"version":3,"file":"lsp-auto-install.d.ts","sourceRoot":"","sources":["../src/lsp-auto-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA6BH,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,WAAW,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3C,kGAAkG;IAClG,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,qCAAqC;AACrC,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gDAAgD;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B;;;;;;;OAOG;IACH,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C;;;;;;;;;OASG;IACH,gBAAgB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AA8DD,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM/D;AAyWD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,iBAAiB,EACzB,SAAS,GAAE,OAAO,KAAa,GAC9B,iBAAiB,CA0EnB"}
|
package/dist/tools/hoisted.d.ts
CHANGED
|
@@ -91,7 +91,7 @@ export declare function registerHoistedTools(pi: ExtensionAPI, ctx: PluginContex
|
|
|
91
91
|
* Pi can render. Exported for unit tests covering truncation and diagnostics
|
|
92
92
|
* behavior without spinning up a real bridge.
|
|
93
93
|
*/
|
|
94
|
-
export declare function buildMutationResult(
|
|
94
|
+
export declare function buildMutationResult(response: Record<string, unknown>): AgentToolResult<FileMutationDetails>;
|
|
95
95
|
/** Resolve a path argument to an absolute path if it exists, expanding `~`. */
|
|
96
96
|
export declare function resolvePathArg(cwd: string, path: string): Promise<string>;
|
|
97
97
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hoisted.d.ts","sourceRoot":"","sources":["../../src/tools/hoisted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"hoisted.d.ts","sourceRoot":"","sources":["../../src/tools/hoisted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EAGlB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAyDjD,wBAAsB,iCAAiC,CACrD,MAAM,EAAE;IACN,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,EAAE,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC;CACzE,EACD,MAAM,EAAE,MAAM,EACd,MAAM,SAAW,EACjB,OAAO,GAAE;IAAE,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAAO,GAChD,OAAO,CAAC,IAAI,CAAC,CAkDf;AAmDD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;;;;;;OAWG;IACH,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAED,kEAAkE;AAClE,UAAU,mBAAmB;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;IACxB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,YAAY,EAChB,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,gBAAgB,GACxB,IAAI,CA4MN;AAMD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,eAAe,CAAC,mBAAmB,CAAC,CA6FtC;AA8ID,+EAA+E;AAC/E,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAS/E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CA0B3D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,mBAAmB,EAAE,OAAO,EAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,MAAM,CAgBR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semantic.d.ts","sourceRoot":"","sources":["../../src/tools/semantic.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAOL,KAAK,iBAAiB,EAKvB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"semantic.d.ts","sourceRoot":"","sources":["../../src/tools/semantic.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAOL,KAAK,iBAAiB,EAKvB,MAAM,qBAAqB,CAAC;AAwB7B,QAAA,MAAM,YAAY;;;;EA0BhB,CAAC;AAEH,wCAAwC;AACxC,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,CAAC,OAAO,YAAY,CAAC,EACjC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,GACX,MAAM,EAAE,CAuFV;AAED,wCAAwC;AACxC,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,CAAC,OAAO,YAAY,CAAC,EACjC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,iBAAiB,yCAG3B;AAED,wCAAwC;AACxC,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,EAChC,IAAI,EAAE,MAAM,CAAC,OAAO,YAAY,CAAC,EACjC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,iBAAiB,sFAO3B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAkE/E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft-pi",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.2",
|
|
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,7 +23,7 @@
|
|
|
23
23
|
"test:unit": "bun test src/__tests__ --path-ignore-patterns 'src/__tests__/e2e/**'"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@cortexkit/aft-bridge": "0.35.
|
|
26
|
+
"@cortexkit/aft-bridge": "0.35.2",
|
|
27
27
|
"@xterm/headless": "^5.5.0",
|
|
28
28
|
"comment-json": "^5.0.0",
|
|
29
29
|
"diff": "^8.0.4",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"zod": "^4.1.8"
|
|
32
32
|
},
|
|
33
33
|
"optionalDependencies": {
|
|
34
|
-
"@cortexkit/aft-darwin-arm64": "0.35.
|
|
35
|
-
"@cortexkit/aft-darwin-x64": "0.35.
|
|
36
|
-
"@cortexkit/aft-linux-arm64": "0.35.
|
|
37
|
-
"@cortexkit/aft-linux-x64": "0.35.
|
|
38
|
-
"@cortexkit/aft-win32-arm64": "0.35.
|
|
39
|
-
"@cortexkit/aft-win32-x64": "0.35.
|
|
34
|
+
"@cortexkit/aft-darwin-arm64": "0.35.2",
|
|
35
|
+
"@cortexkit/aft-darwin-x64": "0.35.2",
|
|
36
|
+
"@cortexkit/aft-linux-arm64": "0.35.2",
|
|
37
|
+
"@cortexkit/aft-linux-x64": "0.35.2",
|
|
38
|
+
"@cortexkit/aft-win32-arm64": "0.35.2",
|
|
39
|
+
"@cortexkit/aft-win32-x64": "0.35.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@earendil-works/pi-coding-agent": "*",
|