@cortexkit/aft-opencode 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 +165 -50
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -8302,11 +8302,12 @@ function parseStatusBarCounts(value) {
|
|
|
8302
8302
|
unused_exports: num("unused_exports"),
|
|
8303
8303
|
duplicates: num("duplicates"),
|
|
8304
8304
|
todos: num("todos"),
|
|
8305
|
-
tier2_stale: record.tier2_stale === true
|
|
8305
|
+
tier2_stale: record.tier2_stale === true,
|
|
8306
|
+
...typeof record.line === "string" ? { line: record.line } : {}
|
|
8306
8307
|
};
|
|
8307
8308
|
}
|
|
8308
8309
|
function countsEqual(a, b) {
|
|
8309
|
-
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;
|
|
8310
|
+
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;
|
|
8310
8311
|
}
|
|
8311
8312
|
function shouldEmitStatusBar(state, next) {
|
|
8312
8313
|
const changed = state.last === undefined || !countsEqual(state.last, next);
|
|
@@ -8320,6 +8321,8 @@ function shouldEmitStatusBar(state, next) {
|
|
|
8320
8321
|
return false;
|
|
8321
8322
|
}
|
|
8322
8323
|
function formatStatusBar(counts) {
|
|
8324
|
+
if (counts.line !== undefined)
|
|
8325
|
+
return counts.line;
|
|
8323
8326
|
const staleMark = counts.tier2_stale ? "~" : "";
|
|
8324
8327
|
return `[AFT E${counts.errors} W${counts.warnings} | ` + `${staleMark}D${counts.dead_code} U${counts.unused_exports} C${counts.duplicates} | ` + `T${counts.todos}]`;
|
|
8325
8328
|
}
|
|
@@ -9492,7 +9495,8 @@ function formatDroppedKeyWarnings(dropped) {
|
|
|
9492
9495
|
// ../aft-bridge/dist/downloader.js
|
|
9493
9496
|
import { spawnSync } from "node:child_process";
|
|
9494
9497
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
9495
|
-
import { chmodSync, closeSync, copyFileSync, createWriteStream, existsSync as existsSync2, mkdirSync, openSync, readFileSync as readFileSync3, renameSync, rmSync, statSync as statSync2, unlinkSync, writeSync } from "node:fs";
|
|
9498
|
+
import { chmodSync, closeSync, copyFileSync, createWriteStream, existsSync as existsSync2, mkdirSync, openSync, readdirSync, readFileSync as readFileSync3, renameSync, rmSync, statSync as statSync2, unlinkSync, writeSync } from "node:fs";
|
|
9499
|
+
import { hostname } from "node:os";
|
|
9496
9500
|
import { join as join4 } from "node:path";
|
|
9497
9501
|
import { Readable } from "node:stream";
|
|
9498
9502
|
import { pipeline } from "node:stream/promises";
|
|
@@ -9517,8 +9521,8 @@ var REPO = "cortexkit/aft";
|
|
|
9517
9521
|
var DOWNLOAD_TIMEOUT_MS = 300000;
|
|
9518
9522
|
var LATEST_TAG_TIMEOUT_MS = 30000;
|
|
9519
9523
|
var MAX_DOWNLOAD_BYTES = 200 * 1024 * 1024;
|
|
9520
|
-
var DOWNLOAD_LOCK_TIMEOUT_MS = 120000;
|
|
9521
9524
|
var DOWNLOAD_LOCK_STALE_MS = 10 * 60000;
|
|
9525
|
+
var DOWNLOAD_LOCK_TIMEOUT_MS = DOWNLOAD_LOCK_STALE_MS + 30000;
|
|
9522
9526
|
function readBinaryVersion(binaryPath) {
|
|
9523
9527
|
try {
|
|
9524
9528
|
const result = spawnSync(binaryPath, ["--version"], {
|
|
@@ -9586,11 +9590,37 @@ async function downloadBinary(version) {
|
|
|
9586
9590
|
let binaryTimeout = null;
|
|
9587
9591
|
let checksumTimeout = null;
|
|
9588
9592
|
const tmpPath = `${binaryPath}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`;
|
|
9593
|
+
const cleanUpPartialDownload = () => {
|
|
9594
|
+
try {
|
|
9595
|
+
if (existsSync2(tmpPath))
|
|
9596
|
+
unlinkSync(tmpPath);
|
|
9597
|
+
} catch {}
|
|
9598
|
+
};
|
|
9599
|
+
let interrupted = false;
|
|
9600
|
+
const cleanUpInterruptedDownload = () => {
|
|
9601
|
+
if (interrupted)
|
|
9602
|
+
return;
|
|
9603
|
+
interrupted = true;
|
|
9604
|
+
binaryController?.abort();
|
|
9605
|
+
checksumController?.abort();
|
|
9606
|
+
cleanUpPartialDownload();
|
|
9607
|
+
releaseLock?.();
|
|
9608
|
+
releaseLock = null;
|
|
9609
|
+
};
|
|
9610
|
+
const handleSigint = () => {
|
|
9611
|
+
cleanUpInterruptedDownload();
|
|
9612
|
+
process.off("SIGINT", handleSigint);
|
|
9613
|
+
process.kill(process.pid, "SIGINT");
|
|
9614
|
+
};
|
|
9615
|
+
const handleExit = () => cleanUpInterruptedDownload();
|
|
9616
|
+
process.once("SIGINT", handleSigint);
|
|
9617
|
+
process.once("exit", handleExit);
|
|
9589
9618
|
try {
|
|
9590
9619
|
if (!existsSync2(versionedCacheDir)) {
|
|
9591
9620
|
mkdirSync(versionedCacheDir, { recursive: true });
|
|
9592
9621
|
}
|
|
9593
9622
|
releaseLock = await acquireDownloadLock(lockPath);
|
|
9623
|
+
sweepStaleDownloadTemps(versionedCacheDir, binaryName);
|
|
9594
9624
|
if (existsSync2(binaryPath) && isExpectedCachedBinary(binaryPath, tag)) {
|
|
9595
9625
|
return binaryPath;
|
|
9596
9626
|
}
|
|
@@ -9666,13 +9696,11 @@ async function downloadBinary(version) {
|
|
|
9666
9696
|
} catch (err) {
|
|
9667
9697
|
const msg = err instanceof Error ? err.message : String(err);
|
|
9668
9698
|
error(`Failed to download AFT binary: ${msg}`);
|
|
9669
|
-
|
|
9670
|
-
try {
|
|
9671
|
-
unlinkSync(tmpPath);
|
|
9672
|
-
} catch {}
|
|
9673
|
-
}
|
|
9699
|
+
cleanUpPartialDownload();
|
|
9674
9700
|
return null;
|
|
9675
9701
|
} finally {
|
|
9702
|
+
process.off("SIGINT", handleSigint);
|
|
9703
|
+
process.off("exit", handleExit);
|
|
9676
9704
|
if (binaryTimeout) {
|
|
9677
9705
|
binaryController?.abort();
|
|
9678
9706
|
clearTimeout(binaryTimeout);
|
|
@@ -9698,17 +9726,85 @@ async function ensureBinary(version) {
|
|
|
9698
9726
|
log("No cached binary found, downloading latest...");
|
|
9699
9727
|
return downloadBinary();
|
|
9700
9728
|
}
|
|
9701
|
-
|
|
9729
|
+
function createDownloadLockOwner() {
|
|
9730
|
+
return JSON.stringify({
|
|
9731
|
+
pid: process.pid,
|
|
9732
|
+
hostname: hostname(),
|
|
9733
|
+
createdAt: Date.now(),
|
|
9734
|
+
token: randomUUID()
|
|
9735
|
+
});
|
|
9736
|
+
}
|
|
9737
|
+
function parseDownloadLockOwner(raw) {
|
|
9738
|
+
try {
|
|
9739
|
+
const parsed = JSON.parse(raw);
|
|
9740
|
+
if (typeof parsed === "object" && parsed !== null) {
|
|
9741
|
+
const { pid, hostname: ownerHostname } = parsed;
|
|
9742
|
+
return {
|
|
9743
|
+
pid: typeof pid === "number" && Number.isSafeInteger(pid) && pid > 0 ? pid : null,
|
|
9744
|
+
hostname: typeof ownerHostname === "string" && ownerHostname ? ownerHostname : null
|
|
9745
|
+
};
|
|
9746
|
+
}
|
|
9747
|
+
} catch {}
|
|
9748
|
+
const legacyPid = Number(raw.split(":", 1)[0]);
|
|
9749
|
+
return {
|
|
9750
|
+
pid: Number.isSafeInteger(legacyPid) && legacyPid > 0 ? legacyPid : null,
|
|
9751
|
+
hostname: null
|
|
9752
|
+
};
|
|
9753
|
+
}
|
|
9754
|
+
function isProcessAlive(pid) {
|
|
9755
|
+
try {
|
|
9756
|
+
process.kill(pid, 0);
|
|
9757
|
+
return true;
|
|
9758
|
+
} catch (err) {
|
|
9759
|
+
return err.code !== "ESRCH";
|
|
9760
|
+
}
|
|
9761
|
+
}
|
|
9762
|
+
function isReclaimableDownloadLock(owner, ageMs, staleMs) {
|
|
9763
|
+
if (Math.abs(ageMs) > staleMs)
|
|
9764
|
+
return true;
|
|
9765
|
+
return (owner.hostname === null || owner.hostname === hostname()) && owner.pid !== null && !isProcessAlive(owner.pid);
|
|
9766
|
+
}
|
|
9767
|
+
function reclaimDownloadLock(lockPath, expectedOwner) {
|
|
9768
|
+
try {
|
|
9769
|
+
if (readFileSync3(lockPath, "utf-8") !== expectedOwner)
|
|
9770
|
+
return false;
|
|
9771
|
+
rmSync(lockPath, { force: true });
|
|
9772
|
+
return true;
|
|
9773
|
+
} catch (err) {
|
|
9774
|
+
if (err.code === "ENOENT")
|
|
9775
|
+
return true;
|
|
9776
|
+
throw err;
|
|
9777
|
+
}
|
|
9778
|
+
}
|
|
9779
|
+
function sweepStaleDownloadTemps(versionedCacheDir, binaryName) {
|
|
9780
|
+
const tempPrefix = `${binaryName}.`;
|
|
9781
|
+
try {
|
|
9782
|
+
for (const entry of readdirSync(versionedCacheDir, { withFileTypes: true })) {
|
|
9783
|
+
if (!entry.isFile() || !entry.name.startsWith(tempPrefix) || !entry.name.endsWith(".tmp")) {
|
|
9784
|
+
continue;
|
|
9785
|
+
}
|
|
9786
|
+
const tempPath = join4(versionedCacheDir, entry.name);
|
|
9787
|
+
const ageMs = Date.now() - statSync2(tempPath).mtimeMs;
|
|
9788
|
+
if (Math.abs(ageMs) > DOWNLOAD_LOCK_STALE_MS)
|
|
9789
|
+
unlinkSync(tempPath);
|
|
9790
|
+
}
|
|
9791
|
+
} catch {}
|
|
9792
|
+
}
|
|
9793
|
+
async function acquireDownloadLock(lockPath, timing = {}) {
|
|
9794
|
+
const timeoutMs = timing.timeoutMs ?? DOWNLOAD_LOCK_TIMEOUT_MS;
|
|
9795
|
+
const staleMs = timing.staleMs ?? DOWNLOAD_LOCK_STALE_MS;
|
|
9796
|
+
const pollIntervalMs = timing.pollIntervalMs ?? 100;
|
|
9702
9797
|
const startedAt = Date.now();
|
|
9703
9798
|
while (true) {
|
|
9704
9799
|
try {
|
|
9705
|
-
const owner =
|
|
9800
|
+
const owner = createDownloadLockOwner();
|
|
9706
9801
|
const fd = openSync(lockPath, "wx");
|
|
9707
|
-
|
|
9802
|
+
try {
|
|
9803
|
+
writeSync(fd, owner);
|
|
9804
|
+
} finally {
|
|
9805
|
+
closeSync(fd);
|
|
9806
|
+
}
|
|
9708
9807
|
return () => {
|
|
9709
|
-
try {
|
|
9710
|
-
closeSync(fd);
|
|
9711
|
-
} catch {}
|
|
9712
9808
|
try {
|
|
9713
9809
|
if (readFileSync3(lockPath, "utf-8") === owner) {
|
|
9714
9810
|
rmSync(lockPath, { force: true });
|
|
@@ -9719,19 +9815,24 @@ async function acquireDownloadLock(lockPath) {
|
|
|
9719
9815
|
const code = err.code;
|
|
9720
9816
|
if (code !== "EEXIST")
|
|
9721
9817
|
throw err;
|
|
9818
|
+
let existingOwner;
|
|
9819
|
+
let ageMs;
|
|
9722
9820
|
try {
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
|
|
9821
|
+
existingOwner = readFileSync3(lockPath, "utf-8");
|
|
9822
|
+
ageMs = Date.now() - statSync2(lockPath).mtimeMs;
|
|
9823
|
+
} catch (readErr) {
|
|
9824
|
+
if (readErr.code === "ENOENT")
|
|
9726
9825
|
continue;
|
|
9727
|
-
|
|
9728
|
-
} catch {
|
|
9729
|
-
continue;
|
|
9826
|
+
throw readErr;
|
|
9730
9827
|
}
|
|
9731
|
-
if (
|
|
9828
|
+
if (isReclaimableDownloadLock(parseDownloadLockOwner(existingOwner), ageMs, staleMs)) {
|
|
9829
|
+
if (reclaimDownloadLock(lockPath, existingOwner))
|
|
9830
|
+
continue;
|
|
9831
|
+
}
|
|
9832
|
+
if (Date.now() - startedAt > timeoutMs) {
|
|
9732
9833
|
throw new Error(`Timed out waiting for download lock: ${lockPath}`);
|
|
9733
9834
|
}
|
|
9734
|
-
await new Promise((resolve3) => setTimeout(resolve3,
|
|
9835
|
+
await new Promise((resolve3) => setTimeout(resolve3, pollIntervalMs));
|
|
9735
9836
|
}
|
|
9736
9837
|
}
|
|
9737
9838
|
}
|
|
@@ -14611,7 +14712,7 @@ async function ensureStorageMigrated(opts) {
|
|
|
14611
14712
|
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}` : ""));
|
|
14612
14713
|
}
|
|
14613
14714
|
// ../aft-bridge/dist/npm-resolver.js
|
|
14614
|
-
import { readdirSync, statSync as statSync5 } from "node:fs";
|
|
14715
|
+
import { readdirSync as readdirSync2, statSync as statSync5 } from "node:fs";
|
|
14615
14716
|
import { homedir as homedir8 } from "node:os";
|
|
14616
14717
|
import { delimiter, dirname as dirname4, isAbsolute as isAbsolute3, join as join9 } from "node:path";
|
|
14617
14718
|
function defaultDeps() {
|
|
@@ -14651,7 +14752,7 @@ function npmAdjacentToNode(deps) {
|
|
|
14651
14752
|
function highestVersionedNodeBin(installsDir, name) {
|
|
14652
14753
|
let entries;
|
|
14653
14754
|
try {
|
|
14654
|
-
entries =
|
|
14755
|
+
entries = readdirSync2(installsDir);
|
|
14655
14756
|
} catch {
|
|
14656
14757
|
return null;
|
|
14657
14758
|
}
|
|
@@ -14730,7 +14831,7 @@ function isNpmAvailable(deps = defaultDeps()) {
|
|
|
14730
14831
|
// ../aft-bridge/dist/onnx-runtime.js
|
|
14731
14832
|
import { execFileSync } from "node:child_process";
|
|
14732
14833
|
import { createHash as createHash4 } from "node:crypto";
|
|
14733
|
-
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
|
|
14834
|
+
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";
|
|
14734
14835
|
import { basename as basename2, dirname as dirname5, isAbsolute as isAbsolute4, join as join10, relative as relative2, resolve as resolve6, win32 } from "node:path";
|
|
14735
14836
|
import { Readable as Readable2 } from "node:stream";
|
|
14736
14837
|
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
@@ -14847,7 +14948,7 @@ async function ensureOnnxRuntime(storageDir) {
|
|
|
14847
14948
|
}
|
|
14848
14949
|
function cleanupAbandonedStagingDirs(onnxBaseDir) {
|
|
14849
14950
|
try {
|
|
14850
|
-
const entries =
|
|
14951
|
+
const entries = readdirSync3(onnxBaseDir);
|
|
14851
14952
|
for (const entry of entries) {
|
|
14852
14953
|
if (!entry.startsWith(`${ORT_VERSION}.tmp.`))
|
|
14853
14954
|
continue;
|
|
@@ -14858,7 +14959,7 @@ function cleanupAbandonedStagingDirs(onnxBaseDir) {
|
|
|
14858
14959
|
let abandoned = false;
|
|
14859
14960
|
if (Number.isFinite(pid) && pid > 0) {
|
|
14860
14961
|
if (process.platform === "win32") {
|
|
14861
|
-
const ownerAlive =
|
|
14962
|
+
const ownerAlive = isProcessAlive2(pid);
|
|
14862
14963
|
if (!ownerAlive) {
|
|
14863
14964
|
abandoned = true;
|
|
14864
14965
|
} else {
|
|
@@ -14870,7 +14971,7 @@ function cleanupAbandonedStagingDirs(onnxBaseDir) {
|
|
|
14870
14971
|
}
|
|
14871
14972
|
}
|
|
14872
14973
|
} else {
|
|
14873
|
-
abandoned = !
|
|
14974
|
+
abandoned = !isProcessAlive2(pid);
|
|
14874
14975
|
}
|
|
14875
14976
|
} else {
|
|
14876
14977
|
abandoned = true;
|
|
@@ -14921,7 +15022,7 @@ function isPathInsideRoot(root, candidate) {
|
|
|
14921
15022
|
}
|
|
14922
15023
|
function detectOnnxVersion(libDir, libName) {
|
|
14923
15024
|
try {
|
|
14924
|
-
const entries =
|
|
15025
|
+
const entries = readdirSync3(libDir);
|
|
14925
15026
|
const barePrefix = libName.replace(/\.(so|dylib|dll)$/, "");
|
|
14926
15027
|
const expectedPrefix = process.platform === "win32" ? barePrefix.toLowerCase() : barePrefix;
|
|
14927
15028
|
for (const entry of entries) {
|
|
@@ -14984,7 +15085,7 @@ function isWindowsSystem32Directory(dir) {
|
|
|
14984
15085
|
}
|
|
14985
15086
|
function directoryContainsLibrary(dir, libName) {
|
|
14986
15087
|
try {
|
|
14987
|
-
const entries =
|
|
15088
|
+
const entries = readdirSync3(dir);
|
|
14988
15089
|
if (process.platform === "win32") {
|
|
14989
15090
|
const expected = libName.toLowerCase();
|
|
14990
15091
|
return entries.some((entry) => entry.toLowerCase() === expected);
|
|
@@ -15022,7 +15123,7 @@ function findSystemOnnxRuntime(libName) {
|
|
|
15022
15123
|
if (!existsSync7(nugetPackageDir))
|
|
15023
15124
|
return nugetPaths;
|
|
15024
15125
|
try {
|
|
15025
|
-
for (const entry of
|
|
15126
|
+
for (const entry of readdirSync3(nugetPackageDir, { withFileTypes: true })) {
|
|
15026
15127
|
if (!entry.isDirectory())
|
|
15027
15128
|
continue;
|
|
15028
15129
|
if (entry.name === "__globalPackagesFolder" || entry.name.startsWith("."))
|
|
@@ -15117,7 +15218,7 @@ function validateExtractedTree(stagingRoot) {
|
|
|
15117
15218
|
const realRoot = realpathSync2(stagingRoot);
|
|
15118
15219
|
let totalBytes = 0;
|
|
15119
15220
|
const walk = (dir) => {
|
|
15120
|
-
const entries =
|
|
15221
|
+
const entries = readdirSync3(dir);
|
|
15121
15222
|
for (const entry of entries) {
|
|
15122
15223
|
const fullPath = join10(dir, entry);
|
|
15123
15224
|
const lst = lstatSync(fullPath);
|
|
@@ -15175,7 +15276,7 @@ async function downloadOnnxRuntime(info, targetDir) {
|
|
|
15175
15276
|
throw new Error(`Expected directory not found: ${extractedDir}`);
|
|
15176
15277
|
}
|
|
15177
15278
|
mkdirSync5(targetDir, { recursive: true });
|
|
15178
|
-
const libFiles =
|
|
15279
|
+
const libFiles = readdirSync3(extractedDir).filter((f) => f.startsWith("libonnxruntime") || f.startsWith("onnxruntime"));
|
|
15179
15280
|
const realFiles = [];
|
|
15180
15281
|
const symlinks = [];
|
|
15181
15282
|
for (const libFile of libFiles) {
|
|
@@ -15353,7 +15454,7 @@ ${new Date().toISOString()}
|
|
|
15353
15454
|
}
|
|
15354
15455
|
const age = Date.now() - lockMtimeMs;
|
|
15355
15456
|
const ageWithinFresh = Math.abs(age) < STALE_LOCK_MS;
|
|
15356
|
-
const ownerAlive = owningPid !== null &&
|
|
15457
|
+
const ownerAlive = owningPid !== null && isProcessAlive2(owningPid);
|
|
15357
15458
|
if (ownerAlive && ageWithinFresh) {
|
|
15358
15459
|
return false;
|
|
15359
15460
|
}
|
|
@@ -15417,7 +15518,7 @@ function isWindowsProcessAlive(pid) {
|
|
|
15417
15518
|
return false;
|
|
15418
15519
|
}
|
|
15419
15520
|
}
|
|
15420
|
-
function
|
|
15521
|
+
function isProcessAlive2(pid) {
|
|
15421
15522
|
if (process.platform === "win32")
|
|
15422
15523
|
return isWindowsProcessAlive(pid);
|
|
15423
15524
|
try {
|
|
@@ -15792,6 +15893,19 @@ function parseEditArray(value) {
|
|
|
15792
15893
|
}
|
|
15793
15894
|
return value;
|
|
15794
15895
|
}
|
|
15896
|
+
function stripLineRangeSentinels(item) {
|
|
15897
|
+
const hasRangeField = ["startLine", "endLine", "content"].some((key) => hasOwn(item, key));
|
|
15898
|
+
if (!hasRangeField)
|
|
15899
|
+
return;
|
|
15900
|
+
if (item.oldString === "")
|
|
15901
|
+
delete item.oldString;
|
|
15902
|
+
if (item.newString === "")
|
|
15903
|
+
delete item.newString;
|
|
15904
|
+
if (item.replaceAll === false)
|
|
15905
|
+
delete item.replaceAll;
|
|
15906
|
+
if (item.occurrence === 1)
|
|
15907
|
+
delete item.occurrence;
|
|
15908
|
+
}
|
|
15795
15909
|
function normalizeEditItem(value, index) {
|
|
15796
15910
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
15797
15911
|
throw new InvalidRequestError(`edit: edits[${index}] must be an object`);
|
|
@@ -15800,6 +15914,7 @@ function normalizeEditItem(value, index) {
|
|
|
15800
15914
|
const item = copyOwnProperties(source);
|
|
15801
15915
|
normalizeItemAlias(item, "oldString", "oldText");
|
|
15802
15916
|
normalizeItemAlias(item, "newString", "newText");
|
|
15917
|
+
stripLineRangeSentinels(item);
|
|
15803
15918
|
const hasFindField = ["oldString", "newString", "replaceAll", "occurrence"].some((key) => hasOwn(item, key));
|
|
15804
15919
|
const hasRangeField = ["startLine", "endLine", "content"].some((key) => hasOwn(item, key));
|
|
15805
15920
|
if (hasFindField && hasRangeField) {
|
|
@@ -17878,7 +17993,7 @@ __export(exports_external, {
|
|
|
17878
17993
|
instanceof: () => _instanceof,
|
|
17879
17994
|
includes: () => _includes,
|
|
17880
17995
|
httpUrl: () => httpUrl,
|
|
17881
|
-
hostname: () =>
|
|
17996
|
+
hostname: () => hostname3,
|
|
17882
17997
|
hex: () => hex2,
|
|
17883
17998
|
hash: () => hash,
|
|
17884
17999
|
guid: () => guid2,
|
|
@@ -19329,7 +19444,7 @@ __export(exports_regexes, {
|
|
|
19329
19444
|
idnEmail: () => idnEmail,
|
|
19330
19445
|
httpProtocol: () => httpProtocol,
|
|
19331
19446
|
html5Email: () => html5Email,
|
|
19332
|
-
hostname: () =>
|
|
19447
|
+
hostname: () => hostname2,
|
|
19333
19448
|
hex: () => hex,
|
|
19334
19449
|
guid: () => guid,
|
|
19335
19450
|
extendedDuration: () => extendedDuration,
|
|
@@ -19387,7 +19502,7 @@ var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]
|
|
|
19387
19502
|
var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
19388
19503
|
var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
19389
19504
|
var base64url = /^[A-Za-z0-9_-]*$/;
|
|
19390
|
-
var
|
|
19505
|
+
var hostname2 = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
|
|
19391
19506
|
var domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
|
|
19392
19507
|
var httpProtocol = /^https?$/;
|
|
19393
19508
|
var e164 = /^\+[1-9]\d{6,14}$/;
|
|
@@ -30011,7 +30126,7 @@ __export(exports_schemas2, {
|
|
|
30011
30126
|
int: () => int,
|
|
30012
30127
|
instanceof: () => _instanceof,
|
|
30013
30128
|
httpUrl: () => httpUrl,
|
|
30014
|
-
hostname: () =>
|
|
30129
|
+
hostname: () => hostname3,
|
|
30015
30130
|
hex: () => hex2,
|
|
30016
30131
|
hash: () => hash,
|
|
30017
30132
|
guid: () => guid2,
|
|
@@ -30663,7 +30778,7 @@ var ZodCustomStringFormat = /* @__PURE__ */ $constructor("ZodCustomStringFormat"
|
|
|
30663
30778
|
function stringFormat(format, fnOrRegex, _params = {}) {
|
|
30664
30779
|
return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
|
|
30665
30780
|
}
|
|
30666
|
-
function
|
|
30781
|
+
function hostname3(_params) {
|
|
30667
30782
|
return _stringFormat(ZodCustomStringFormat, "hostname", exports_regexes.hostname, _params);
|
|
30668
30783
|
}
|
|
30669
30784
|
function hex2(_params) {
|
|
@@ -34151,7 +34266,7 @@ ${new Date().toISOString()}
|
|
|
34151
34266
|
const age = Date.now() - lockMtimeMs;
|
|
34152
34267
|
const ageWithinFresh = Math.abs(age) < STALE_LOCK_MS2;
|
|
34153
34268
|
const skipLiveness = process.platform === "win32";
|
|
34154
|
-
const ownerAlive = !skipLiveness && owningPid !== null &&
|
|
34269
|
+
const ownerAlive = !skipLiveness && owningPid !== null && isProcessAlive3(owningPid);
|
|
34155
34270
|
if (skipLiveness ? ageWithinFresh : ownerAlive && ageWithinFresh) {
|
|
34156
34271
|
return false;
|
|
34157
34272
|
}
|
|
@@ -34161,7 +34276,7 @@ ${new Date().toISOString()}
|
|
|
34161
34276
|
} catch {}
|
|
34162
34277
|
return tryClaim();
|
|
34163
34278
|
}
|
|
34164
|
-
function
|
|
34279
|
+
function isProcessAlive3(pid) {
|
|
34165
34280
|
try {
|
|
34166
34281
|
process.kill(pid, 0);
|
|
34167
34282
|
return true;
|
|
@@ -34395,7 +34510,7 @@ var NPM_LSP_TABLE = [
|
|
|
34395
34510
|
];
|
|
34396
34511
|
|
|
34397
34512
|
// src/lsp-project-relevance.ts
|
|
34398
|
-
import { existsSync as existsSync15, readdirSync as
|
|
34513
|
+
import { existsSync as existsSync15, readdirSync as readdirSync4, readFileSync as readFileSync13 } from "node:fs";
|
|
34399
34514
|
import { join as join17 } from "node:path";
|
|
34400
34515
|
var MAX_WALK_DIRS = 200;
|
|
34401
34516
|
var MAX_WALK_DEPTH = 4;
|
|
@@ -34460,7 +34575,7 @@ function relevantExtensionsInProject(projectRoot, extToServer) {
|
|
|
34460
34575
|
visitedDirs += 1;
|
|
34461
34576
|
let entries;
|
|
34462
34577
|
try {
|
|
34463
|
-
entries =
|
|
34578
|
+
entries = readdirSync4(current.dir, { withFileTypes: true });
|
|
34464
34579
|
} catch {
|
|
34465
34580
|
continue;
|
|
34466
34581
|
}
|
|
@@ -34881,7 +34996,7 @@ import {
|
|
|
34881
34996
|
existsSync as existsSync17,
|
|
34882
34997
|
lstatSync as lstatSync2,
|
|
34883
34998
|
mkdirSync as mkdirSync9,
|
|
34884
|
-
readdirSync as
|
|
34999
|
+
readdirSync as readdirSync5,
|
|
34885
35000
|
readFileSync as readFileSync15,
|
|
34886
35001
|
readlinkSync as readlinkSync2,
|
|
34887
35002
|
realpathSync as realpathSync3,
|
|
@@ -35284,7 +35399,7 @@ function validateExtraction(stagingRoot) {
|
|
|
35284
35399
|
const walk = (dir) => {
|
|
35285
35400
|
let entries;
|
|
35286
35401
|
try {
|
|
35287
|
-
entries =
|
|
35402
|
+
entries = readdirSync5(dir);
|
|
35288
35403
|
} catch (err) {
|
|
35289
35404
|
throw new Error(`failed to read staging dir ${dir}: ${err}`);
|
|
35290
35405
|
}
|
|
@@ -35897,7 +36012,7 @@ import { randomBytes as randomBytes3, timingSafeEqual as timingSafeEqual2 } from
|
|
|
35897
36012
|
import {
|
|
35898
36013
|
existsSync as existsSync18,
|
|
35899
36014
|
mkdirSync as mkdirSync10,
|
|
35900
|
-
readdirSync as
|
|
36015
|
+
readdirSync as readdirSync6,
|
|
35901
36016
|
readFileSync as readFileSync16,
|
|
35902
36017
|
renameSync as renameSync9,
|
|
35903
36018
|
unlinkSync as unlinkSync8,
|
|
@@ -36067,7 +36182,7 @@ class AftRpcServer {
|
|
|
36067
36182
|
sweepDeadPortFiles() {
|
|
36068
36183
|
let entries;
|
|
36069
36184
|
try {
|
|
36070
|
-
entries =
|
|
36185
|
+
entries = readdirSync6(this.portsDir);
|
|
36071
36186
|
} catch {
|
|
36072
36187
|
return;
|
|
36073
36188
|
}
|
|
@@ -39828,7 +39943,7 @@ var PLUGIN_VERSION = (() => {
|
|
|
39828
39943
|
return "0.0.0";
|
|
39829
39944
|
}
|
|
39830
39945
|
})();
|
|
39831
|
-
var ANNOUNCEMENT_VERSION = "0.50.
|
|
39946
|
+
var ANNOUNCEMENT_VERSION = "0.50.2";
|
|
39832
39947
|
var ANNOUNCEMENT_FEATURES = [
|
|
39833
39948
|
"Callgraph stays consistent under load: edits arriving mid-rebuild can no longer be silently lost from navigation results.",
|
|
39834
39949
|
"aft_zoom handles real-world .jsonc: files with comment banners above the opening brace now resolve, and not-found errors point at the segment that actually failed (thanks @iceteaSA).",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft-opencode",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode plugin for Agent File Tools (AFT) — tree-sitter and lsp powered code analysis",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@clack/prompts": "^1.6.0",
|
|
37
|
-
"@cortexkit/aft-bridge": "0.50.
|
|
37
|
+
"@cortexkit/aft-bridge": "0.50.2",
|
|
38
38
|
"@opentui/core": "0.4.3",
|
|
39
39
|
"@opentui/solid": "0.4.3",
|
|
40
40
|
"comment-json": "^4.6.2",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"zod": "^4.4.3"
|
|
44
44
|
},
|
|
45
45
|
"optionalDependencies": {
|
|
46
|
-
"@cortexkit/aft-darwin-arm64": "0.50.
|
|
47
|
-
"@cortexkit/aft-darwin-x64": "0.50.
|
|
48
|
-
"@cortexkit/aft-linux-arm64": "0.50.
|
|
49
|
-
"@cortexkit/aft-linux-x64": "0.50.
|
|
50
|
-
"@cortexkit/aft-win32-arm64": "0.50.
|
|
51
|
-
"@cortexkit/aft-win32-x64": "0.50.
|
|
46
|
+
"@cortexkit/aft-darwin-arm64": "0.50.2",
|
|
47
|
+
"@cortexkit/aft-darwin-x64": "0.50.2",
|
|
48
|
+
"@cortexkit/aft-linux-arm64": "0.50.2",
|
|
49
|
+
"@cortexkit/aft-linux-x64": "0.50.2",
|
|
50
|
+
"@cortexkit/aft-win32-arm64": "0.50.2",
|
|
51
|
+
"@cortexkit/aft-win32-x64": "0.50.2"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@opencode-ai/plugin": "^1.17.11",
|