@cortexkit/aft 0.50.0 → 0.50.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 +168 -52
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -567,11 +567,12 @@ function parseStatusBarCounts(value) {
|
|
|
567
567
|
unused_exports: num("unused_exports"),
|
|
568
568
|
duplicates: num("duplicates"),
|
|
569
569
|
todos: num("todos"),
|
|
570
|
-
tier2_stale: record.tier2_stale === true
|
|
570
|
+
tier2_stale: record.tier2_stale === true,
|
|
571
|
+
...typeof record.line === "string" ? { line: record.line } : {}
|
|
571
572
|
};
|
|
572
573
|
}
|
|
573
574
|
function countsEqual(a, b) {
|
|
574
|
-
return a.errors === b.errors && a.warnings === b.warnings && a.dead_code === b.dead_code && a.unused_exports === b.unused_exports && a.duplicates === b.duplicates && a.todos === b.todos && a.tier2_stale === b.tier2_stale;
|
|
575
|
+
return a.errors === b.errors && a.warnings === b.warnings && a.dead_code === b.dead_code && a.unused_exports === b.unused_exports && a.duplicates === b.duplicates && a.todos === b.todos && a.tier2_stale === b.tier2_stale && a.line === b.line;
|
|
575
576
|
}
|
|
576
577
|
function shouldEmitStatusBar(state, next) {
|
|
577
578
|
const changed = state.last === undefined || !countsEqual(state.last, next);
|
|
@@ -585,6 +586,8 @@ function shouldEmitStatusBar(state, next) {
|
|
|
585
586
|
return false;
|
|
586
587
|
}
|
|
587
588
|
function formatStatusBar(counts) {
|
|
589
|
+
if (counts.line !== undefined)
|
|
590
|
+
return counts.line;
|
|
588
591
|
const staleMark = counts.tier2_stale ? "~" : "";
|
|
589
592
|
return `[AFT E${counts.errors} W${counts.warnings} | ` + `${staleMark}D${counts.dead_code} U${counts.unused_exports} C${counts.duplicates} | ` + `T${counts.todos}]`;
|
|
590
593
|
}
|
|
@@ -2076,7 +2079,8 @@ var init_platform = __esm(() => {
|
|
|
2076
2079
|
// ../aft-bridge/dist/downloader.js
|
|
2077
2080
|
import { spawnSync } from "node:child_process";
|
|
2078
2081
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
2079
|
-
import { chmodSync, closeSync, copyFileSync, createWriteStream, existsSync as existsSync2, mkdirSync, openSync, readFileSync as readFileSync3, renameSync, rmSync, statSync as statSync2, unlinkSync, writeSync } from "node:fs";
|
|
2082
|
+
import { chmodSync, closeSync, copyFileSync, createWriteStream, existsSync as existsSync2, mkdirSync, openSync, readdirSync, readFileSync as readFileSync3, renameSync, rmSync, statSync as statSync2, unlinkSync, writeSync } from "node:fs";
|
|
2083
|
+
import { hostname } from "node:os";
|
|
2080
2084
|
import { join as join4 } from "node:path";
|
|
2081
2085
|
import { Readable } from "node:stream";
|
|
2082
2086
|
import { pipeline } from "node:stream/promises";
|
|
@@ -2147,11 +2151,37 @@ async function downloadBinary(version) {
|
|
|
2147
2151
|
let binaryTimeout = null;
|
|
2148
2152
|
let checksumTimeout = null;
|
|
2149
2153
|
const tmpPath = `${binaryPath}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`;
|
|
2154
|
+
const cleanUpPartialDownload = () => {
|
|
2155
|
+
try {
|
|
2156
|
+
if (existsSync2(tmpPath))
|
|
2157
|
+
unlinkSync(tmpPath);
|
|
2158
|
+
} catch {}
|
|
2159
|
+
};
|
|
2160
|
+
let interrupted = false;
|
|
2161
|
+
const cleanUpInterruptedDownload = () => {
|
|
2162
|
+
if (interrupted)
|
|
2163
|
+
return;
|
|
2164
|
+
interrupted = true;
|
|
2165
|
+
binaryController?.abort();
|
|
2166
|
+
checksumController?.abort();
|
|
2167
|
+
cleanUpPartialDownload();
|
|
2168
|
+
releaseLock?.();
|
|
2169
|
+
releaseLock = null;
|
|
2170
|
+
};
|
|
2171
|
+
const handleSigint = () => {
|
|
2172
|
+
cleanUpInterruptedDownload();
|
|
2173
|
+
process.off("SIGINT", handleSigint);
|
|
2174
|
+
process.kill(process.pid, "SIGINT");
|
|
2175
|
+
};
|
|
2176
|
+
const handleExit = () => cleanUpInterruptedDownload();
|
|
2177
|
+
process.once("SIGINT", handleSigint);
|
|
2178
|
+
process.once("exit", handleExit);
|
|
2150
2179
|
try {
|
|
2151
2180
|
if (!existsSync2(versionedCacheDir)) {
|
|
2152
2181
|
mkdirSync(versionedCacheDir, { recursive: true });
|
|
2153
2182
|
}
|
|
2154
2183
|
releaseLock = await acquireDownloadLock(lockPath);
|
|
2184
|
+
sweepStaleDownloadTemps(versionedCacheDir, binaryName);
|
|
2155
2185
|
if (existsSync2(binaryPath) && isExpectedCachedBinary(binaryPath, tag)) {
|
|
2156
2186
|
return binaryPath;
|
|
2157
2187
|
}
|
|
@@ -2227,13 +2257,11 @@ async function downloadBinary(version) {
|
|
|
2227
2257
|
} catch (err) {
|
|
2228
2258
|
const msg = err instanceof Error ? err.message : String(err);
|
|
2229
2259
|
error(`Failed to download AFT binary: ${msg}`);
|
|
2230
|
-
|
|
2231
|
-
try {
|
|
2232
|
-
unlinkSync(tmpPath);
|
|
2233
|
-
} catch {}
|
|
2234
|
-
}
|
|
2260
|
+
cleanUpPartialDownload();
|
|
2235
2261
|
return null;
|
|
2236
2262
|
} finally {
|
|
2263
|
+
process.off("SIGINT", handleSigint);
|
|
2264
|
+
process.off("exit", handleExit);
|
|
2237
2265
|
if (binaryTimeout) {
|
|
2238
2266
|
binaryController?.abort();
|
|
2239
2267
|
clearTimeout(binaryTimeout);
|
|
@@ -2259,17 +2287,85 @@ async function ensureBinary(version) {
|
|
|
2259
2287
|
log("No cached binary found, downloading latest...");
|
|
2260
2288
|
return downloadBinary();
|
|
2261
2289
|
}
|
|
2262
|
-
|
|
2290
|
+
function createDownloadLockOwner() {
|
|
2291
|
+
return JSON.stringify({
|
|
2292
|
+
pid: process.pid,
|
|
2293
|
+
hostname: hostname(),
|
|
2294
|
+
createdAt: Date.now(),
|
|
2295
|
+
token: randomUUID()
|
|
2296
|
+
});
|
|
2297
|
+
}
|
|
2298
|
+
function parseDownloadLockOwner(raw) {
|
|
2299
|
+
try {
|
|
2300
|
+
const parsed = JSON.parse(raw);
|
|
2301
|
+
if (typeof parsed === "object" && parsed !== null) {
|
|
2302
|
+
const { pid, hostname: ownerHostname } = parsed;
|
|
2303
|
+
return {
|
|
2304
|
+
pid: typeof pid === "number" && Number.isSafeInteger(pid) && pid > 0 ? pid : null,
|
|
2305
|
+
hostname: typeof ownerHostname === "string" && ownerHostname ? ownerHostname : null
|
|
2306
|
+
};
|
|
2307
|
+
}
|
|
2308
|
+
} catch {}
|
|
2309
|
+
const legacyPid = Number(raw.split(":", 1)[0]);
|
|
2310
|
+
return {
|
|
2311
|
+
pid: Number.isSafeInteger(legacyPid) && legacyPid > 0 ? legacyPid : null,
|
|
2312
|
+
hostname: null
|
|
2313
|
+
};
|
|
2314
|
+
}
|
|
2315
|
+
function isProcessAlive(pid) {
|
|
2316
|
+
try {
|
|
2317
|
+
process.kill(pid, 0);
|
|
2318
|
+
return true;
|
|
2319
|
+
} catch (err) {
|
|
2320
|
+
return err.code !== "ESRCH";
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
function isReclaimableDownloadLock(owner, ageMs, staleMs) {
|
|
2324
|
+
if (Math.abs(ageMs) > staleMs)
|
|
2325
|
+
return true;
|
|
2326
|
+
return (owner.hostname === null || owner.hostname === hostname()) && owner.pid !== null && !isProcessAlive(owner.pid);
|
|
2327
|
+
}
|
|
2328
|
+
function reclaimDownloadLock(lockPath, expectedOwner) {
|
|
2329
|
+
try {
|
|
2330
|
+
if (readFileSync3(lockPath, "utf-8") !== expectedOwner)
|
|
2331
|
+
return false;
|
|
2332
|
+
rmSync(lockPath, { force: true });
|
|
2333
|
+
return true;
|
|
2334
|
+
} catch (err) {
|
|
2335
|
+
if (err.code === "ENOENT")
|
|
2336
|
+
return true;
|
|
2337
|
+
throw err;
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
function sweepStaleDownloadTemps(versionedCacheDir, binaryName) {
|
|
2341
|
+
const tempPrefix = `${binaryName}.`;
|
|
2342
|
+
try {
|
|
2343
|
+
for (const entry of readdirSync(versionedCacheDir, { withFileTypes: true })) {
|
|
2344
|
+
if (!entry.isFile() || !entry.name.startsWith(tempPrefix) || !entry.name.endsWith(".tmp")) {
|
|
2345
|
+
continue;
|
|
2346
|
+
}
|
|
2347
|
+
const tempPath = join4(versionedCacheDir, entry.name);
|
|
2348
|
+
const ageMs = Date.now() - statSync2(tempPath).mtimeMs;
|
|
2349
|
+
if (Math.abs(ageMs) > DOWNLOAD_LOCK_STALE_MS)
|
|
2350
|
+
unlinkSync(tempPath);
|
|
2351
|
+
}
|
|
2352
|
+
} catch {}
|
|
2353
|
+
}
|
|
2354
|
+
async function acquireDownloadLock(lockPath, timing = {}) {
|
|
2355
|
+
const timeoutMs = timing.timeoutMs ?? DOWNLOAD_LOCK_TIMEOUT_MS;
|
|
2356
|
+
const staleMs = timing.staleMs ?? DOWNLOAD_LOCK_STALE_MS;
|
|
2357
|
+
const pollIntervalMs = timing.pollIntervalMs ?? 100;
|
|
2263
2358
|
const startedAt = Date.now();
|
|
2264
2359
|
while (true) {
|
|
2265
2360
|
try {
|
|
2266
|
-
const owner =
|
|
2361
|
+
const owner = createDownloadLockOwner();
|
|
2267
2362
|
const fd = openSync(lockPath, "wx");
|
|
2268
|
-
|
|
2363
|
+
try {
|
|
2364
|
+
writeSync(fd, owner);
|
|
2365
|
+
} finally {
|
|
2366
|
+
closeSync(fd);
|
|
2367
|
+
}
|
|
2269
2368
|
return () => {
|
|
2270
|
-
try {
|
|
2271
|
-
closeSync(fd);
|
|
2272
|
-
} catch {}
|
|
2273
2369
|
try {
|
|
2274
2370
|
if (readFileSync3(lockPath, "utf-8") === owner) {
|
|
2275
2371
|
rmSync(lockPath, { force: true });
|
|
@@ -2280,19 +2376,24 @@ async function acquireDownloadLock(lockPath) {
|
|
|
2280
2376
|
const code = err.code;
|
|
2281
2377
|
if (code !== "EEXIST")
|
|
2282
2378
|
throw err;
|
|
2379
|
+
let existingOwner;
|
|
2380
|
+
let ageMs;
|
|
2283
2381
|
try {
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2382
|
+
existingOwner = readFileSync3(lockPath, "utf-8");
|
|
2383
|
+
ageMs = Date.now() - statSync2(lockPath).mtimeMs;
|
|
2384
|
+
} catch (readErr) {
|
|
2385
|
+
if (readErr.code === "ENOENT")
|
|
2386
|
+
continue;
|
|
2387
|
+
throw readErr;
|
|
2388
|
+
}
|
|
2389
|
+
if (isReclaimableDownloadLock(parseDownloadLockOwner(existingOwner), ageMs, staleMs)) {
|
|
2390
|
+
if (reclaimDownloadLock(lockPath, existingOwner))
|
|
2287
2391
|
continue;
|
|
2288
|
-
}
|
|
2289
|
-
} catch {
|
|
2290
|
-
continue;
|
|
2291
2392
|
}
|
|
2292
|
-
if (Date.now() - startedAt >
|
|
2393
|
+
if (Date.now() - startedAt > timeoutMs) {
|
|
2293
2394
|
throw new Error(`Timed out waiting for download lock: ${lockPath}`);
|
|
2294
2395
|
}
|
|
2295
|
-
await new Promise((resolve3) => setTimeout(resolve3,
|
|
2396
|
+
await new Promise((resolve3) => setTimeout(resolve3, pollIntervalMs));
|
|
2296
2397
|
}
|
|
2297
2398
|
}
|
|
2298
2399
|
}
|
|
@@ -2327,7 +2428,7 @@ async function fetchLatestTag() {
|
|
|
2327
2428
|
clearTimeout(timeout);
|
|
2328
2429
|
}
|
|
2329
2430
|
}
|
|
2330
|
-
var REPO = "cortexkit/aft", DOWNLOAD_TIMEOUT_MS = 300000, LATEST_TAG_TIMEOUT_MS = 30000, MAX_DOWNLOAD_BYTES,
|
|
2431
|
+
var REPO = "cortexkit/aft", DOWNLOAD_TIMEOUT_MS = 300000, LATEST_TAG_TIMEOUT_MS = 30000, MAX_DOWNLOAD_BYTES, DOWNLOAD_LOCK_STALE_MS, DOWNLOAD_LOCK_TIMEOUT_MS;
|
|
2331
2432
|
var init_downloader = __esm(() => {
|
|
2332
2433
|
init_active_logger();
|
|
2333
2434
|
init_cache_paths();
|
|
@@ -2335,6 +2436,7 @@ var init_downloader = __esm(() => {
|
|
|
2335
2436
|
init_cache_paths();
|
|
2336
2437
|
MAX_DOWNLOAD_BYTES = 200 * 1024 * 1024;
|
|
2337
2438
|
DOWNLOAD_LOCK_STALE_MS = 10 * 60000;
|
|
2439
|
+
DOWNLOAD_LOCK_TIMEOUT_MS = DOWNLOAD_LOCK_STALE_MS + 30000;
|
|
2338
2440
|
});
|
|
2339
2441
|
|
|
2340
2442
|
// ../aft-bridge/dist/durable-log.js
|
|
@@ -7291,7 +7393,7 @@ var init_migration = __esm(() => {
|
|
|
7291
7393
|
|
|
7292
7394
|
// ../aft-bridge/dist/npm-resolver.js
|
|
7293
7395
|
import { execFileSync } from "node:child_process";
|
|
7294
|
-
import { readdirSync, statSync as statSync5 } from "node:fs";
|
|
7396
|
+
import { readdirSync as readdirSync2, statSync as statSync5 } from "node:fs";
|
|
7295
7397
|
import { homedir as homedir9 } from "node:os";
|
|
7296
7398
|
import { delimiter, dirname as dirname4, isAbsolute as isAbsolute3, join as join9 } from "node:path";
|
|
7297
7399
|
function defaultDeps() {
|
|
@@ -7331,7 +7433,7 @@ function npmAdjacentToNode(deps) {
|
|
|
7331
7433
|
function highestVersionedNodeBin(installsDir, name) {
|
|
7332
7434
|
let entries;
|
|
7333
7435
|
try {
|
|
7334
|
-
entries =
|
|
7436
|
+
entries = readdirSync2(installsDir);
|
|
7335
7437
|
} catch {
|
|
7336
7438
|
return null;
|
|
7337
7439
|
}
|
|
@@ -7426,7 +7528,7 @@ var init_npm_resolver = () => {};
|
|
|
7426
7528
|
// ../aft-bridge/dist/onnx-runtime.js
|
|
7427
7529
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
7428
7530
|
import { createHash as createHash4 } from "node:crypto";
|
|
7429
|
-
import { chmodSync as chmodSync3, closeSync as closeSync4, copyFileSync as copyFileSync3, createWriteStream as createWriteStream2, existsSync as existsSync7, lstatSync, mkdirSync as mkdirSync5, openSync as openSync4, readdirSync as
|
|
7531
|
+
import { chmodSync as chmodSync3, closeSync as closeSync4, copyFileSync as copyFileSync3, createWriteStream as createWriteStream2, existsSync as existsSync7, lstatSync, mkdirSync as mkdirSync5, openSync as openSync4, readdirSync as readdirSync3, readFileSync as readFileSync6, readlinkSync, realpathSync as realpathSync2, rmSync as rmSync3, statSync as statSync6, symlinkSync, unlinkSync as unlinkSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
7430
7532
|
import { basename as basename2, dirname as dirname5, isAbsolute as isAbsolute4, join as join10, relative as relative2, resolve as resolve6, win32 } from "node:path";
|
|
7431
7533
|
import { Readable as Readable2 } from "node:stream";
|
|
7432
7534
|
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
@@ -7503,7 +7605,7 @@ async function ensureOnnxRuntime(storageDir) {
|
|
|
7503
7605
|
}
|
|
7504
7606
|
function cleanupAbandonedStagingDirs(onnxBaseDir) {
|
|
7505
7607
|
try {
|
|
7506
|
-
const entries =
|
|
7608
|
+
const entries = readdirSync3(onnxBaseDir);
|
|
7507
7609
|
for (const entry of entries) {
|
|
7508
7610
|
if (!entry.startsWith(`${ORT_VERSION}.tmp.`))
|
|
7509
7611
|
continue;
|
|
@@ -7514,7 +7616,7 @@ function cleanupAbandonedStagingDirs(onnxBaseDir) {
|
|
|
7514
7616
|
let abandoned = false;
|
|
7515
7617
|
if (Number.isFinite(pid) && pid > 0) {
|
|
7516
7618
|
if (process.platform === "win32") {
|
|
7517
|
-
const ownerAlive =
|
|
7619
|
+
const ownerAlive = isProcessAlive2(pid);
|
|
7518
7620
|
if (!ownerAlive) {
|
|
7519
7621
|
abandoned = true;
|
|
7520
7622
|
} else {
|
|
@@ -7526,7 +7628,7 @@ function cleanupAbandonedStagingDirs(onnxBaseDir) {
|
|
|
7526
7628
|
}
|
|
7527
7629
|
}
|
|
7528
7630
|
} else {
|
|
7529
|
-
abandoned = !
|
|
7631
|
+
abandoned = !isProcessAlive2(pid);
|
|
7530
7632
|
}
|
|
7531
7633
|
} else {
|
|
7532
7634
|
abandoned = true;
|
|
@@ -7578,7 +7680,7 @@ function isPathInsideRoot(root, candidate) {
|
|
|
7578
7680
|
}
|
|
7579
7681
|
function detectOnnxVersion(libDir, libName) {
|
|
7580
7682
|
try {
|
|
7581
|
-
const entries =
|
|
7683
|
+
const entries = readdirSync3(libDir);
|
|
7582
7684
|
const barePrefix = libName.replace(/\.(so|dylib|dll)$/, "");
|
|
7583
7685
|
const expectedPrefix = process.platform === "win32" ? barePrefix.toLowerCase() : barePrefix;
|
|
7584
7686
|
for (const entry of entries) {
|
|
@@ -7641,7 +7743,7 @@ function isWindowsSystem32Directory(dir) {
|
|
|
7641
7743
|
}
|
|
7642
7744
|
function directoryContainsLibrary(dir, libName) {
|
|
7643
7745
|
try {
|
|
7644
|
-
const entries =
|
|
7746
|
+
const entries = readdirSync3(dir);
|
|
7645
7747
|
if (process.platform === "win32") {
|
|
7646
7748
|
const expected = libName.toLowerCase();
|
|
7647
7749
|
return entries.some((entry) => entry.toLowerCase() === expected);
|
|
@@ -7679,7 +7781,7 @@ function findSystemOnnxRuntime(libName) {
|
|
|
7679
7781
|
if (!existsSync7(nugetPackageDir))
|
|
7680
7782
|
return nugetPaths;
|
|
7681
7783
|
try {
|
|
7682
|
-
for (const entry of
|
|
7784
|
+
for (const entry of readdirSync3(nugetPackageDir, { withFileTypes: true })) {
|
|
7683
7785
|
if (!entry.isDirectory())
|
|
7684
7786
|
continue;
|
|
7685
7787
|
if (entry.name === "__globalPackagesFolder" || entry.name.startsWith("."))
|
|
@@ -7774,7 +7876,7 @@ function validateExtractedTree(stagingRoot) {
|
|
|
7774
7876
|
const realRoot = realpathSync2(stagingRoot);
|
|
7775
7877
|
let totalBytes = 0;
|
|
7776
7878
|
const walk = (dir) => {
|
|
7777
|
-
const entries =
|
|
7879
|
+
const entries = readdirSync3(dir);
|
|
7778
7880
|
for (const entry of entries) {
|
|
7779
7881
|
const fullPath = join10(dir, entry);
|
|
7780
7882
|
const lst = lstatSync(fullPath);
|
|
@@ -7832,7 +7934,7 @@ async function downloadOnnxRuntime(info, targetDir) {
|
|
|
7832
7934
|
throw new Error(`Expected directory not found: ${extractedDir}`);
|
|
7833
7935
|
}
|
|
7834
7936
|
mkdirSync5(targetDir, { recursive: true });
|
|
7835
|
-
const libFiles =
|
|
7937
|
+
const libFiles = readdirSync3(extractedDir).filter((f) => f.startsWith("libonnxruntime") || f.startsWith("onnxruntime"));
|
|
7836
7938
|
const realFiles = [];
|
|
7837
7939
|
const symlinks = [];
|
|
7838
7940
|
for (const libFile of libFiles) {
|
|
@@ -8010,7 +8112,7 @@ ${new Date().toISOString()}
|
|
|
8010
8112
|
}
|
|
8011
8113
|
const age = Date.now() - lockMtimeMs;
|
|
8012
8114
|
const ageWithinFresh = Math.abs(age) < STALE_LOCK_MS;
|
|
8013
|
-
const ownerAlive = owningPid !== null &&
|
|
8115
|
+
const ownerAlive = owningPid !== null && isProcessAlive2(owningPid);
|
|
8014
8116
|
if (ownerAlive && ageWithinFresh) {
|
|
8015
8117
|
return false;
|
|
8016
8118
|
}
|
|
@@ -8074,7 +8176,7 @@ function isWindowsProcessAlive(pid) {
|
|
|
8074
8176
|
return false;
|
|
8075
8177
|
}
|
|
8076
8178
|
}
|
|
8077
|
-
function
|
|
8179
|
+
function isProcessAlive2(pid) {
|
|
8078
8180
|
if (process.platform === "win32")
|
|
8079
8181
|
return isWindowsProcessAlive(pid);
|
|
8080
8182
|
try {
|
|
@@ -8486,6 +8588,19 @@ function parseEditArray(value) {
|
|
|
8486
8588
|
}
|
|
8487
8589
|
return value;
|
|
8488
8590
|
}
|
|
8591
|
+
function stripLineRangeSentinels(item) {
|
|
8592
|
+
const hasRangeField = ["startLine", "endLine", "content"].some((key) => hasOwn(item, key));
|
|
8593
|
+
if (!hasRangeField)
|
|
8594
|
+
return;
|
|
8595
|
+
if (item.oldString === "")
|
|
8596
|
+
delete item.oldString;
|
|
8597
|
+
if (item.newString === "")
|
|
8598
|
+
delete item.newString;
|
|
8599
|
+
if (item.replaceAll === false)
|
|
8600
|
+
delete item.replaceAll;
|
|
8601
|
+
if (item.occurrence === 1)
|
|
8602
|
+
delete item.occurrence;
|
|
8603
|
+
}
|
|
8489
8604
|
function normalizeEditItem(value, index) {
|
|
8490
8605
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
8491
8606
|
throw new InvalidRequestError(`edit: edits[${index}] must be an object`);
|
|
@@ -8494,6 +8609,7 @@ function normalizeEditItem(value, index) {
|
|
|
8494
8609
|
const item = copyOwnProperties(source);
|
|
8495
8610
|
normalizeItemAlias(item, "oldString", "oldText");
|
|
8496
8611
|
normalizeItemAlias(item, "newString", "newText");
|
|
8612
|
+
stripLineRangeSentinels(item);
|
|
8497
8613
|
const hasFindField = ["oldString", "newString", "replaceAll", "occurrence"].some((key) => hasOwn(item, key));
|
|
8498
8614
|
const hasRangeField = ["startLine", "endLine", "content"].some((key) => hasOwn(item, key));
|
|
8499
8615
|
if (hasFindField && hasRangeField) {
|
|
@@ -9764,7 +9880,7 @@ var init_binary_probe = __esm(async () => {
|
|
|
9764
9880
|
});
|
|
9765
9881
|
|
|
9766
9882
|
// src/lib/fs-util.ts
|
|
9767
|
-
import { existsSync as existsSync10, readdirSync as
|
|
9883
|
+
import { existsSync as existsSync10, readdirSync as readdirSync4, statSync as statSync7 } from "node:fs";
|
|
9768
9884
|
import { join as join14 } from "node:path";
|
|
9769
9885
|
function dirSize(path2) {
|
|
9770
9886
|
if (!existsSync10(path2)) {
|
|
@@ -9778,7 +9894,7 @@ function dirSize(path2) {
|
|
|
9778
9894
|
return 0;
|
|
9779
9895
|
}
|
|
9780
9896
|
let total = 0;
|
|
9781
|
-
for (const entry of
|
|
9897
|
+
for (const entry of readdirSync4(path2)) {
|
|
9782
9898
|
total += dirSize(join14(path2, entry));
|
|
9783
9899
|
}
|
|
9784
9900
|
return total;
|
|
@@ -20205,7 +20321,7 @@ __export(exports_lsp, {
|
|
|
20205
20321
|
printLspDoctorHelp: () => printLspDoctorHelp,
|
|
20206
20322
|
findProjectRootForFile: () => findProjectRootForFile
|
|
20207
20323
|
});
|
|
20208
|
-
import { existsSync as existsSync14, readdirSync as
|
|
20324
|
+
import { existsSync as existsSync14, readdirSync as readdirSync5, statSync as statSync9 } from "node:fs";
|
|
20209
20325
|
import { createRequire as createRequire4 } from "node:module";
|
|
20210
20326
|
import { dirname as dirname8, join as join17, resolve as resolve8 } from "node:path";
|
|
20211
20327
|
function findProjectRootForFile(filePath, fallbackCwd = process.cwd()) {
|
|
@@ -20377,7 +20493,7 @@ function childDirs(path2) {
|
|
|
20377
20493
|
if (!existsSync14(path2))
|
|
20378
20494
|
return [];
|
|
20379
20495
|
try {
|
|
20380
|
-
return
|
|
20496
|
+
return readdirSync5(path2).map((entry) => join17(path2, entry)).filter((entry) => {
|
|
20381
20497
|
try {
|
|
20382
20498
|
return statSync9(entry).isDirectory();
|
|
20383
20499
|
} catch {
|
|
@@ -20708,7 +20824,7 @@ var init_doctor_filters = __esm(async () => {
|
|
|
20708
20824
|
});
|
|
20709
20825
|
|
|
20710
20826
|
// src/lib/binary-cache.ts
|
|
20711
|
-
import { existsSync as existsSync16, readdirSync as
|
|
20827
|
+
import { existsSync as existsSync16, readdirSync as readdirSync6, statSync as statSync10 } from "node:fs";
|
|
20712
20828
|
import { join as join18 } from "node:path";
|
|
20713
20829
|
function getBinaryCacheInfo(activeVersion) {
|
|
20714
20830
|
const path2 = getAftBinaryCacheDir();
|
|
@@ -20720,7 +20836,7 @@ function getBinaryCacheInfo(activeVersion) {
|
|
|
20720
20836
|
path: path2
|
|
20721
20837
|
};
|
|
20722
20838
|
}
|
|
20723
|
-
const versions =
|
|
20839
|
+
const versions = readdirSync6(path2).filter((entry) => {
|
|
20724
20840
|
try {
|
|
20725
20841
|
return statSync10(join18(path2, entry)).isDirectory();
|
|
20726
20842
|
} catch {
|
|
@@ -20962,7 +21078,7 @@ var init_bridge_tool_failures = __esm(() => {
|
|
|
20962
21078
|
});
|
|
20963
21079
|
|
|
20964
21080
|
// src/lib/legacy-storage.ts
|
|
20965
|
-
import { existsSync as existsSync18, readdirSync as
|
|
21081
|
+
import { existsSync as existsSync18, readdirSync as readdirSync7, statSync as statSync12 } from "node:fs";
|
|
20966
21082
|
import { join as join19 } from "node:path";
|
|
20967
21083
|
function summarizeLegacyPartitionDuplication(storageRoot) {
|
|
20968
21084
|
if (!existsSync18(storageRoot)) {
|
|
@@ -21060,7 +21176,7 @@ function looksLikePartitionKey(value) {
|
|
|
21060
21176
|
}
|
|
21061
21177
|
function safeReadDir(path2) {
|
|
21062
21178
|
try {
|
|
21063
|
-
return
|
|
21179
|
+
return readdirSync7(path2).sort((left, right) => left.localeCompare(right));
|
|
21064
21180
|
} catch {
|
|
21065
21181
|
return [];
|
|
21066
21182
|
}
|
|
@@ -21086,7 +21202,7 @@ var init_legacy_storage = __esm(() => {
|
|
|
21086
21202
|
});
|
|
21087
21203
|
|
|
21088
21204
|
// src/lib/lsp-cache.ts
|
|
21089
|
-
import { existsSync as existsSync19, readdirSync as
|
|
21205
|
+
import { existsSync as existsSync19, readdirSync as readdirSync8, rmSync as rmSync5, statSync as statSync13 } from "node:fs";
|
|
21090
21206
|
import { join as join20 } from "node:path";
|
|
21091
21207
|
function inspectDir(path2) {
|
|
21092
21208
|
if (!existsSync19(path2)) {
|
|
@@ -21096,7 +21212,7 @@ function inspectDir(path2) {
|
|
|
21096
21212
|
let totalSize = 0;
|
|
21097
21213
|
let names;
|
|
21098
21214
|
try {
|
|
21099
|
-
names =
|
|
21215
|
+
names = readdirSync8(path2);
|
|
21100
21216
|
} catch {
|
|
21101
21217
|
return { entries: [], totalSize: 0 };
|
|
21102
21218
|
}
|
|
@@ -21159,7 +21275,7 @@ var init_lsp_cache = __esm(() => {
|
|
|
21159
21275
|
});
|
|
21160
21276
|
|
|
21161
21277
|
// src/lib/onnx.ts
|
|
21162
|
-
import { existsSync as existsSync20, readdirSync as
|
|
21278
|
+
import { existsSync as existsSync20, readdirSync as readdirSync9, readlinkSync as readlinkSync2, realpathSync as realpathSync4 } from "node:fs";
|
|
21163
21279
|
import { basename as basename3, isAbsolute as isAbsolute6, join as join21, resolve as resolve10, win32 as win322 } from "node:path";
|
|
21164
21280
|
function getOnnxLibraryName() {
|
|
21165
21281
|
if (process.platform === "darwin")
|
|
@@ -21213,7 +21329,7 @@ function isWindowsSystem32Directory2(dir) {
|
|
|
21213
21329
|
}
|
|
21214
21330
|
function directoryContainsLibrary2(dir, libName) {
|
|
21215
21331
|
try {
|
|
21216
|
-
const entries =
|
|
21332
|
+
const entries = readdirSync9(dir);
|
|
21217
21333
|
if (process.platform === "win32") {
|
|
21218
21334
|
const expected = libName.toLowerCase();
|
|
21219
21335
|
return entries.some((entry) => entry.toLowerCase() === expected);
|
|
@@ -21261,7 +21377,7 @@ function findSystemOnnxRuntime2() {
|
|
|
21261
21377
|
if (!existsSync20(nugetPackageDir))
|
|
21262
21378
|
return nugetPaths;
|
|
21263
21379
|
try {
|
|
21264
|
-
for (const entry of
|
|
21380
|
+
for (const entry of readdirSync9(nugetPackageDir, { withFileTypes: true })) {
|
|
21265
21381
|
if (!entry.isDirectory())
|
|
21266
21382
|
continue;
|
|
21267
21383
|
if (entry.name === "__globalPackagesFolder" || entry.name.startsWith("."))
|
|
@@ -21328,7 +21444,7 @@ function detectOrtVersion(libDir) {
|
|
|
21328
21444
|
return null;
|
|
21329
21445
|
const libName = getOnnxLibraryName();
|
|
21330
21446
|
try {
|
|
21331
|
-
const entries =
|
|
21447
|
+
const entries = readdirSync9(libDir);
|
|
21332
21448
|
const barePrefix = libName.replace(/\.(so|dylib|dll)$/, "");
|
|
21333
21449
|
const expectedPrefix = process.platform === "win32" ? barePrefix.toLowerCase() : barePrefix;
|
|
21334
21450
|
for (const entry of entries) {
|
|
@@ -21960,7 +22076,7 @@ var init_onnx_fix = __esm(() => {
|
|
|
21960
22076
|
});
|
|
21961
22077
|
|
|
21962
22078
|
// src/lib/sessions.ts
|
|
21963
|
-
import { existsSync as existsSync23, readdirSync as
|
|
22079
|
+
import { existsSync as existsSync23, readdirSync as readdirSync10, readFileSync as readFileSync10, statSync as statSync15 } from "node:fs";
|
|
21964
22080
|
import { createRequire as createRequire5 } from "node:module";
|
|
21965
22081
|
import { homedir as homedir18 } from "node:os";
|
|
21966
22082
|
import { basename as basename4, join as join23 } from "node:path";
|
|
@@ -22056,7 +22172,7 @@ function collectJsonlFiles(root) {
|
|
|
22056
22172
|
continue;
|
|
22057
22173
|
let entries;
|
|
22058
22174
|
try {
|
|
22059
|
-
entries =
|
|
22175
|
+
entries = readdirSync10(dir, { withFileTypes: true });
|
|
22060
22176
|
} catch {
|
|
22061
22177
|
continue;
|
|
22062
22178
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Unified CLI for Agent File Tools (AFT) — setup, doctor, and diagnostics across supported agent harnesses (OpenCode, Pi)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@clack/prompts": "^1.6.0",
|
|
27
|
-
"@cortexkit/aft-bridge": "0.50.
|
|
27
|
+
"@cortexkit/aft-bridge": "0.50.2",
|
|
28
28
|
"comment-json": "^4.6.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|