@cortexkit/aft 0.49.0 → 0.49.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +136 -50
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -144,6 +144,7 @@ function sleep(ms) {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
// ../aft-bridge/dist/bash-hints.js
|
|
147
|
+
import * as fs from "node:fs";
|
|
147
148
|
import * as os from "node:os";
|
|
148
149
|
import * as path from "node:path";
|
|
149
150
|
function maybeAppendConflictsHint(output) {
|
|
@@ -217,12 +218,19 @@ function shouldSuppressGrepSearchHint(command, projectRoot) {
|
|
|
217
218
|
const operands = collectPathOperands(firstStage, firstToken.end);
|
|
218
219
|
if (operands.length === 0)
|
|
219
220
|
return false;
|
|
221
|
+
let sawInProjectOperand = false;
|
|
220
222
|
for (const operand of operands) {
|
|
221
223
|
if (isDynamicPathOperand(operand))
|
|
222
224
|
continue;
|
|
223
|
-
|
|
224
|
-
|
|
225
|
+
const resolvedOperand = resolvePathOperand(effectiveCwd, operand);
|
|
226
|
+
if (!isPathInsideProject(resolvedRoot, effectiveCwd, operand))
|
|
227
|
+
continue;
|
|
228
|
+
sawInProjectOperand = true;
|
|
229
|
+
if (shouldSuppressResolvedPath(resolvedOperand))
|
|
230
|
+
return true;
|
|
225
231
|
}
|
|
232
|
+
if (sawInProjectOperand)
|
|
233
|
+
return false;
|
|
226
234
|
}
|
|
227
235
|
return sawCodeSearchStatement;
|
|
228
236
|
}
|
|
@@ -321,6 +329,17 @@ function isPathInsideProject(resolvedRoot, baseCwd, operand) {
|
|
|
321
329
|
const rel = path.relative(resolvedRoot, resolved);
|
|
322
330
|
return rel === "" || !rel.startsWith("..") && !path.isAbsolute(rel);
|
|
323
331
|
}
|
|
332
|
+
function shouldSuppressResolvedPath(resolved) {
|
|
333
|
+
try {
|
|
334
|
+
const stats = fs.statSync(resolved);
|
|
335
|
+
if (stats.isFile())
|
|
336
|
+
return true;
|
|
337
|
+
const ageMs = Date.now() - stats.mtimeMs;
|
|
338
|
+
return ageMs >= 0 && ageMs < GREP_SEARCH_FRESHNESS_WINDOW_MS;
|
|
339
|
+
} catch {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
324
343
|
function splitTopLevelStatements(command) {
|
|
325
344
|
const statements = [];
|
|
326
345
|
let start = 0;
|
|
@@ -493,7 +512,7 @@ function skipSpaces(input, start) {
|
|
|
493
512
|
}
|
|
494
513
|
var CONFLICT_HINT = `
|
|
495
514
|
|
|
496
|
-
[Hint] Use aft_conflicts to see all conflict regions across files in a single call.`, GREP_SEARCH_AFT_SEARCH_HINT = "DO NOT search code by running grep/rg in bash — it is unindexed, unranked, and serial. Use the `aft_search` tool instead (it auto-routes concepts, identifiers, regex, and literals).", GREP_SEARCH_GREP_HINT = "DO NOT search code by running grep/rg in bash — it is unindexed, unranked, and serial. Use the `grep` tool instead (indexed and ranked).", GREP_SEARCH_HINT_PREFIX = "DO NOT search code by running grep/rg in bash —";
|
|
515
|
+
[Hint] Use aft_conflicts to see all conflict regions across files in a single call.`, GREP_SEARCH_AFT_SEARCH_HINT = "DO NOT search code by running grep/rg in bash — it is unindexed, unranked, and serial. Use the `aft_search` tool instead (it auto-routes concepts, identifiers, regex, and literals).", GREP_SEARCH_GREP_HINT = "DO NOT search code by running grep/rg in bash — it is unindexed, unranked, and serial. Use the `grep` tool instead (indexed and ranked).", GREP_SEARCH_HINT_PREFIX = "DO NOT search code by running grep/rg in bash —", GREP_SEARCH_FRESHNESS_WINDOW_MS = 60000;
|
|
497
516
|
var init_bash_hints = () => {};
|
|
498
517
|
|
|
499
518
|
// ../aft-bridge/dist/bash-timeout.js
|
|
@@ -1973,7 +1992,7 @@ var init_platform = __esm(() => {
|
|
|
1973
1992
|
// ../aft-bridge/dist/downloader.js
|
|
1974
1993
|
import { spawnSync } from "node:child_process";
|
|
1975
1994
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
1976
|
-
import { chmodSync, closeSync, copyFileSync, createWriteStream, existsSync as existsSync2, mkdirSync, openSync, readFileSync as readFileSync3, renameSync, rmSync, statSync, unlinkSync, writeSync } from "node:fs";
|
|
1995
|
+
import { chmodSync, closeSync, copyFileSync, createWriteStream, existsSync as existsSync2, mkdirSync, openSync, readFileSync as readFileSync3, renameSync, rmSync, statSync as statSync2, unlinkSync, writeSync } from "node:fs";
|
|
1977
1996
|
import { homedir as homedir4 } from "node:os";
|
|
1978
1997
|
import { join as join3 } from "node:path";
|
|
1979
1998
|
import { Readable } from "node:stream";
|
|
@@ -1983,7 +2002,7 @@ function readBinaryVersion(binaryPath) {
|
|
|
1983
2002
|
const result = spawnSync(binaryPath, ["--version"], {
|
|
1984
2003
|
encoding: "utf-8",
|
|
1985
2004
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1986
|
-
timeout:
|
|
2005
|
+
timeout: 60000
|
|
1987
2006
|
});
|
|
1988
2007
|
const stdoutVersion = result.stdout?.trim();
|
|
1989
2008
|
const stderrVersion = result.stderr?.trim();
|
|
@@ -2188,7 +2207,7 @@ async function acquireDownloadLock(lockPath) {
|
|
|
2188
2207
|
if (code !== "EEXIST")
|
|
2189
2208
|
throw err;
|
|
2190
2209
|
try {
|
|
2191
|
-
const ageMs = Date.now() -
|
|
2210
|
+
const ageMs = Date.now() - statSync2(lockPath).mtimeMs;
|
|
2192
2211
|
if (ageMs > DOWNLOAD_LOCK_STALE_MS) {
|
|
2193
2212
|
rmSync(lockPath, { force: true });
|
|
2194
2213
|
continue;
|
|
@@ -2827,7 +2846,7 @@ var init_resolver = __esm(() => {
|
|
|
2827
2846
|
|
|
2828
2847
|
// ../aft-bridge/dist/migration.js
|
|
2829
2848
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
2830
|
-
import { closeSync as closeSync3, existsSync as existsSync5, mkdirSync as mkdirSync4, openSync as openSync3, readFileSync as readFileSync5, renameSync as renameSync4, rmSync as rmSync2, statSync as
|
|
2849
|
+
import { closeSync as closeSync3, existsSync as existsSync5, mkdirSync as mkdirSync4, openSync as openSync3, readFileSync as readFileSync5, renameSync as renameSync4, rmSync as rmSync2, statSync as statSync3, unlinkSync as unlinkSync3, writeFileSync as writeFileSync2 } from "node:fs";
|
|
2831
2850
|
import { homedir as homedir8, tmpdir } from "node:os";
|
|
2832
2851
|
import { basename, dirname as dirname3, join as join7, resolve as resolve4 } from "node:path";
|
|
2833
2852
|
function dataHome2() {
|
|
@@ -2964,7 +2983,7 @@ function acquireConfigMigrationLock(lockDir) {
|
|
|
2964
2983
|
if (code !== "EEXIST")
|
|
2965
2984
|
throw err;
|
|
2966
2985
|
try {
|
|
2967
|
-
const ageMs = Date.now() -
|
|
2986
|
+
const ageMs = Date.now() - statSync3(lockDir).mtimeMs;
|
|
2968
2987
|
if (ageMs > 60000) {
|
|
2969
2988
|
rmSync2(lockDir, { recursive: true, force: true });
|
|
2970
2989
|
continue;
|
|
@@ -3287,7 +3306,7 @@ var init_migration = __esm(() => {
|
|
|
3287
3306
|
|
|
3288
3307
|
// ../aft-bridge/dist/npm-resolver.js
|
|
3289
3308
|
import { execFileSync } from "node:child_process";
|
|
3290
|
-
import { readdirSync, statSync as
|
|
3309
|
+
import { readdirSync, statSync as statSync4 } from "node:fs";
|
|
3291
3310
|
import { homedir as homedir9 } from "node:os";
|
|
3292
3311
|
import { delimiter, dirname as dirname4, isAbsolute as isAbsolute3, join as join8 } from "node:path";
|
|
3293
3312
|
function defaultDeps() {
|
|
@@ -3303,7 +3322,7 @@ function npmBinaryName(platform) {
|
|
|
3303
3322
|
}
|
|
3304
3323
|
function isFile(p) {
|
|
3305
3324
|
try {
|
|
3306
|
-
return
|
|
3325
|
+
return statSync4(p).isFile();
|
|
3307
3326
|
} catch {
|
|
3308
3327
|
return false;
|
|
3309
3328
|
}
|
|
@@ -3422,7 +3441,7 @@ var init_npm_resolver = () => {};
|
|
|
3422
3441
|
// ../aft-bridge/dist/onnx-runtime.js
|
|
3423
3442
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
3424
3443
|
import { createHash as createHash3 } from "node:crypto";
|
|
3425
|
-
import { chmodSync as chmodSync3, closeSync as closeSync4, copyFileSync as copyFileSync3, createWriteStream as createWriteStream2, existsSync as existsSync6, lstatSync, mkdirSync as mkdirSync5, openSync as openSync4, readdirSync as readdirSync2, readFileSync as readFileSync6, readlinkSync, realpathSync, rmSync as rmSync3, statSync as
|
|
3444
|
+
import { chmodSync as chmodSync3, closeSync as closeSync4, copyFileSync as copyFileSync3, createWriteStream as createWriteStream2, existsSync as existsSync6, lstatSync, mkdirSync as mkdirSync5, openSync as openSync4, readdirSync as readdirSync2, readFileSync as readFileSync6, readlinkSync, realpathSync, rmSync as rmSync3, statSync as statSync5, symlinkSync, unlinkSync as unlinkSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
3426
3445
|
import { basename as basename2, dirname as dirname5, isAbsolute as isAbsolute4, join as join9, relative as relative2, resolve as resolve5, win32 } from "node:path";
|
|
3427
3446
|
import { Readable as Readable2 } from "node:stream";
|
|
3428
3447
|
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
@@ -3515,7 +3534,7 @@ function cleanupAbandonedStagingDirs(onnxBaseDir) {
|
|
|
3515
3534
|
abandoned = true;
|
|
3516
3535
|
} else {
|
|
3517
3536
|
try {
|
|
3518
|
-
const ageMs = Date.now() -
|
|
3537
|
+
const ageMs = Date.now() - statSync5(stagingDir).mtimeMs;
|
|
3519
3538
|
abandoned = ageMs > STALE_LOCK_MS;
|
|
3520
3539
|
} catch {
|
|
3521
3540
|
abandoned = true;
|
|
@@ -3949,7 +3968,7 @@ function writeOnnxInstalledMeta(installDir, version, sha256, archiveSha256) {
|
|
|
3949
3968
|
function readOnnxInstalledMeta(installDir) {
|
|
3950
3969
|
const path2 = join9(installDir, ONNX_INSTALLED_META_FILE);
|
|
3951
3970
|
try {
|
|
3952
|
-
if (!
|
|
3971
|
+
if (!statSync5(path2).isFile())
|
|
3953
3972
|
return null;
|
|
3954
3973
|
const raw = readFileSync6(path2, "utf8");
|
|
3955
3974
|
const parsed = JSON.parse(raw);
|
|
@@ -4000,7 +4019,7 @@ ${new Date().toISOString()}
|
|
|
4000
4019
|
const parsed = Number.parseInt(firstLine, 10);
|
|
4001
4020
|
if (Number.isFinite(parsed) && parsed > 0)
|
|
4002
4021
|
owningPid = parsed;
|
|
4003
|
-
lockMtimeMs =
|
|
4022
|
+
lockMtimeMs = statSync5(lockPath).mtimeMs;
|
|
4004
4023
|
} catch {
|
|
4005
4024
|
return tryClaim();
|
|
4006
4025
|
}
|
|
@@ -4310,11 +4329,14 @@ function prepareCanonicalEditArguments(toolName, rawArguments) {
|
|
|
4310
4329
|
throw new InvalidRequestError(formatUnknownKeys(unknownRootKeys));
|
|
4311
4330
|
}
|
|
4312
4331
|
const modes = editModesPresent(record);
|
|
4332
|
+
if (hasOrphanedSymbolContent(record)) {
|
|
4333
|
+
throw new InvalidRequestError("edit: 'content' requires a non-empty string 'symbol' when symbol mode is selected");
|
|
4334
|
+
}
|
|
4313
4335
|
if (modes.length > 1) {
|
|
4314
|
-
throw new InvalidRequestError(`edit: conflicting modes: ${modes.join(", ")}`);
|
|
4336
|
+
throw new InvalidRequestError(`edit: conflicting modes: ${modes.join(", ")}. ` + OMIT_OPTIONAL_FIELDS_STEERING);
|
|
4315
4337
|
}
|
|
4316
4338
|
if (modes.length === 0) {
|
|
4317
|
-
throw new InvalidRequestError("edit: exactly one of `appendContent`, `edits`, or `symbol` plus `content` is required");
|
|
4339
|
+
throw new InvalidRequestError("edit: exactly one of `appendContent`, `edits`, or `symbol` plus `content` is required. " + OMIT_OPTIONAL_FIELDS_STEERING);
|
|
4318
4340
|
}
|
|
4319
4341
|
const mode = modes[0];
|
|
4320
4342
|
if (mode === "appendContent") {
|
|
@@ -4379,18 +4401,82 @@ function formatUnknownKeys(keys) {
|
|
|
4379
4401
|
return `Unrecognized keys: ${keys.map((key) => `"${key}"`).join(", ")}`;
|
|
4380
4402
|
}
|
|
4381
4403
|
function editModesPresent(record) {
|
|
4404
|
+
const hasAppendContent = isNonEmptyString(record.appendContent);
|
|
4405
|
+
if (!hasAppendContent)
|
|
4406
|
+
delete record.appendContent;
|
|
4407
|
+
const hasEdits = normalizeEditArraySentinels(record);
|
|
4408
|
+
if (!hasEdits)
|
|
4409
|
+
delete record.edits;
|
|
4410
|
+
const hasSymbol = isNonEmptyString(record.symbol);
|
|
4411
|
+
if (!hasSymbol) {
|
|
4412
|
+
delete record.symbol;
|
|
4413
|
+
if (record.content === null || record.content === "")
|
|
4414
|
+
delete record.content;
|
|
4415
|
+
} else if (record.content === null) {
|
|
4416
|
+
delete record.content;
|
|
4417
|
+
}
|
|
4418
|
+
const hasSingleEdit = isNonEmptyString(record.oldString);
|
|
4419
|
+
if (!hasSingleEdit) {
|
|
4420
|
+
for (const key of EDIT_ROOT_COMPATIBILITY_KEYS)
|
|
4421
|
+
delete record[key];
|
|
4422
|
+
} else {
|
|
4423
|
+
for (const key of ["newString", "replaceAll", "occurrence"]) {
|
|
4424
|
+
if (record[key] === null)
|
|
4425
|
+
delete record[key];
|
|
4426
|
+
}
|
|
4427
|
+
}
|
|
4382
4428
|
const modes = [];
|
|
4383
|
-
if (
|
|
4429
|
+
if (hasAppendContent)
|
|
4384
4430
|
modes.push("appendContent");
|
|
4385
|
-
if (
|
|
4431
|
+
if (hasEdits)
|
|
4386
4432
|
modes.push("edits");
|
|
4387
|
-
if (
|
|
4433
|
+
if (hasSymbol)
|
|
4388
4434
|
modes.push("symbol/content");
|
|
4389
|
-
if (
|
|
4435
|
+
if (hasSingleEdit)
|
|
4390
4436
|
modes.push("oldString/newString");
|
|
4391
|
-
}
|
|
4392
4437
|
return modes;
|
|
4393
4438
|
}
|
|
4439
|
+
function isNonEmptyString(value) {
|
|
4440
|
+
return typeof value === "string" && value.length > 0;
|
|
4441
|
+
}
|
|
4442
|
+
function isEditSentinelItem(item) {
|
|
4443
|
+
if (!item || typeof item !== "object" || Array.isArray(item))
|
|
4444
|
+
return false;
|
|
4445
|
+
const record = item;
|
|
4446
|
+
if (record.oldString !== "")
|
|
4447
|
+
return false;
|
|
4448
|
+
const newStringEmpty = !hasOwn(record, "newString") || record.newString === "" || record.newString === null;
|
|
4449
|
+
if (!newStringEmpty)
|
|
4450
|
+
return false;
|
|
4451
|
+
return !hasOwn(record, "content") || record.content === "" || record.content === null;
|
|
4452
|
+
}
|
|
4453
|
+
function normalizeEditArraySentinels(record) {
|
|
4454
|
+
const value = record.edits;
|
|
4455
|
+
if (Array.isArray(value)) {
|
|
4456
|
+
const survivors = value.filter((item) => !isEditSentinelItem(item));
|
|
4457
|
+
if (survivors.length === 0)
|
|
4458
|
+
return false;
|
|
4459
|
+
record.edits = survivors;
|
|
4460
|
+
return true;
|
|
4461
|
+
}
|
|
4462
|
+
if (typeof value !== "string" || value.length === 0)
|
|
4463
|
+
return false;
|
|
4464
|
+
try {
|
|
4465
|
+
const parsed = JSON.parse(value);
|
|
4466
|
+
if (!Array.isArray(parsed))
|
|
4467
|
+
return true;
|
|
4468
|
+
const survivors = parsed.filter((item) => !isEditSentinelItem(item));
|
|
4469
|
+
if (survivors.length === 0)
|
|
4470
|
+
return false;
|
|
4471
|
+
record.edits = survivors;
|
|
4472
|
+
return true;
|
|
4473
|
+
} catch {
|
|
4474
|
+
return true;
|
|
4475
|
+
}
|
|
4476
|
+
}
|
|
4477
|
+
function hasOrphanedSymbolContent(record) {
|
|
4478
|
+
return isNonEmptyString(record.content) && !isNonEmptyString(record.symbol);
|
|
4479
|
+
}
|
|
4394
4480
|
function parseEditArray(value) {
|
|
4395
4481
|
if (typeof value === "string") {
|
|
4396
4482
|
let parsed;
|
|
@@ -4535,7 +4621,7 @@ function copyOwnProperties(source) {
|
|
|
4535
4621
|
copy[key] = source[key];
|
|
4536
4622
|
return copy;
|
|
4537
4623
|
}
|
|
4538
|
-
var InvalidRequestError, EDIT_ROOT_COMPATIBILITY_KEYS, EDIT_ROOT_CANONICAL_KEYS, EDIT_ITEM_KEYS, ASCII_WHITESPACE, ASCII_TRIM, MAX_SAFE_INTEGER;
|
|
4624
|
+
var InvalidRequestError, EDIT_ROOT_COMPATIBILITY_KEYS, EDIT_ROOT_CANONICAL_KEYS, EDIT_ITEM_KEYS, ASCII_WHITESPACE, ASCII_TRIM, MAX_SAFE_INTEGER, OMIT_OPTIONAL_FIELDS_STEERING = "Omit unused optional fields entirely; do not send empty strings or empty arrays for them.";
|
|
4539
4625
|
var init_path_aliases = __esm(() => {
|
|
4540
4626
|
init_error_contract();
|
|
4541
4627
|
InvalidRequestError = class InvalidRequestError extends AftToolError {
|
|
@@ -5231,7 +5317,7 @@ var init_envelope = __esm(() => {
|
|
|
5231
5317
|
});
|
|
5232
5318
|
|
|
5233
5319
|
// ../../node_modules/.bun/@cortexkit+subc-client@0.5.0/node_modules/@cortexkit/subc-client/dist/connection-file.js
|
|
5234
|
-
import { promises as
|
|
5320
|
+
import { promises as fs2 } from "node:fs";
|
|
5235
5321
|
function toBytes(value, field) {
|
|
5236
5322
|
if (!Array.isArray(value) || value.some((n) => typeof n !== "number")) {
|
|
5237
5323
|
throw new ConnectionFileError(`connection file field '${field}' must be a JSON array of bytes`);
|
|
@@ -5255,7 +5341,7 @@ function validate(info) {
|
|
|
5255
5341
|
async function verifyOwnerOnly(path2) {
|
|
5256
5342
|
if (process.platform === "win32")
|
|
5257
5343
|
return;
|
|
5258
|
-
const stat2 = await
|
|
5344
|
+
const stat2 = await fs2.stat(path2);
|
|
5259
5345
|
const mode = stat2.mode & 511;
|
|
5260
5346
|
if ((mode & 63) !== 0) {
|
|
5261
5347
|
throw new ConnectionFileError(`connection file ${path2} has insecure permissions 0o${mode.toString(8)}; expected owner-only 0600`);
|
|
@@ -5263,7 +5349,7 @@ async function verifyOwnerOnly(path2) {
|
|
|
5263
5349
|
}
|
|
5264
5350
|
async function readConnectionFile(path2) {
|
|
5265
5351
|
await verifyOwnerOnly(path2);
|
|
5266
|
-
const raw = await
|
|
5352
|
+
const raw = await fs2.readFile(path2, "utf8");
|
|
5267
5353
|
let parsed;
|
|
5268
5354
|
try {
|
|
5269
5355
|
parsed = JSON.parse(raw);
|
|
@@ -5561,7 +5647,7 @@ var init_socket = __esm(() => {
|
|
|
5561
5647
|
});
|
|
5562
5648
|
|
|
5563
5649
|
// ../../node_modules/.bun/@cortexkit+subc-client@0.5.0/node_modules/@cortexkit/subc-client/dist/client.js
|
|
5564
|
-
import { promises as
|
|
5650
|
+
import { promises as fs3 } from "node:fs";
|
|
5565
5651
|
import { debuglog } from "node:util";
|
|
5566
5652
|
|
|
5567
5653
|
class SubcClient {
|
|
@@ -6298,7 +6384,7 @@ function isRetryableRouteOpenCode(code) {
|
|
|
6298
6384
|
}
|
|
6299
6385
|
async function connectionFileExists(path2) {
|
|
6300
6386
|
try {
|
|
6301
|
-
await
|
|
6387
|
+
await fs3.access(path2);
|
|
6302
6388
|
return true;
|
|
6303
6389
|
} catch {
|
|
6304
6390
|
return false;
|
|
@@ -8325,13 +8411,13 @@ var init_binary_probe = __esm(async () => {
|
|
|
8325
8411
|
});
|
|
8326
8412
|
|
|
8327
8413
|
// src/lib/fs-util.ts
|
|
8328
|
-
import { existsSync as existsSync8, readdirSync as readdirSync3, statSync as
|
|
8414
|
+
import { existsSync as existsSync8, readdirSync as readdirSync3, statSync as statSync6 } from "node:fs";
|
|
8329
8415
|
import { join as join13 } from "node:path";
|
|
8330
8416
|
function dirSize(path2) {
|
|
8331
8417
|
if (!existsSync8(path2)) {
|
|
8332
8418
|
return 0;
|
|
8333
8419
|
}
|
|
8334
|
-
const stat2 =
|
|
8420
|
+
const stat2 = statSync6(path2);
|
|
8335
8421
|
if (stat2.isFile()) {
|
|
8336
8422
|
return stat2.size;
|
|
8337
8423
|
}
|
|
@@ -16202,7 +16288,7 @@ var init_self_version = () => {};
|
|
|
16202
16288
|
|
|
16203
16289
|
// src/adapters/opencode.ts
|
|
16204
16290
|
import { execSync as execSync3 } from "node:child_process";
|
|
16205
|
-
import { existsSync as existsSync10, readFileSync as readFileSync8, rmSync as rmSync4, statSync as
|
|
16291
|
+
import { existsSync as existsSync10, readFileSync as readFileSync8, rmSync as rmSync4, statSync as statSync7 } from "node:fs";
|
|
16206
16292
|
import { homedir as homedir14 } from "node:os";
|
|
16207
16293
|
import { dirname as dirname7, join as join14, parse, resolve as resolve7 } from "node:path";
|
|
16208
16294
|
import { fileURLToPath } from "node:url";
|
|
@@ -16268,7 +16354,7 @@ function pathPointsToOurPlugin(entry) {
|
|
|
16268
16354
|
try {
|
|
16269
16355
|
if (!existsSync10(fsPath))
|
|
16270
16356
|
return false;
|
|
16271
|
-
let searchDir =
|
|
16357
|
+
let searchDir = statSync7(fsPath).isDirectory() ? fsPath : dirname7(fsPath);
|
|
16272
16358
|
let pkgJsonPath = null;
|
|
16273
16359
|
while (true) {
|
|
16274
16360
|
const candidate = join14(searchDir, "package.json");
|
|
@@ -18766,14 +18852,14 @@ __export(exports_lsp, {
|
|
|
18766
18852
|
printLspDoctorHelp: () => printLspDoctorHelp,
|
|
18767
18853
|
findProjectRootForFile: () => findProjectRootForFile
|
|
18768
18854
|
});
|
|
18769
|
-
import { existsSync as existsSync12, readdirSync as readdirSync4, statSync as
|
|
18855
|
+
import { existsSync as existsSync12, readdirSync as readdirSync4, statSync as statSync8 } from "node:fs";
|
|
18770
18856
|
import { createRequire as createRequire4 } from "node:module";
|
|
18771
18857
|
import { dirname as dirname8, join as join16, resolve as resolve8 } from "node:path";
|
|
18772
18858
|
function findProjectRootForFile(filePath, fallbackCwd = process.cwd()) {
|
|
18773
18859
|
const resolvedFile = resolve8(fallbackCwd, filePath);
|
|
18774
18860
|
let dir = dirname8(resolvedFile);
|
|
18775
18861
|
try {
|
|
18776
|
-
if (existsSync12(resolvedFile) &&
|
|
18862
|
+
if (existsSync12(resolvedFile) && statSync8(resolvedFile).isDirectory()) {
|
|
18777
18863
|
dir = resolvedFile;
|
|
18778
18864
|
}
|
|
18779
18865
|
} catch {
|
|
@@ -18940,7 +19026,7 @@ function childDirs(path2) {
|
|
|
18940
19026
|
try {
|
|
18941
19027
|
return readdirSync4(path2).map((entry) => join16(path2, entry)).filter((entry) => {
|
|
18942
19028
|
try {
|
|
18943
|
-
return
|
|
19029
|
+
return statSync8(entry).isDirectory();
|
|
18944
19030
|
} catch {
|
|
18945
19031
|
return false;
|
|
18946
19032
|
}
|
|
@@ -19269,7 +19355,7 @@ var init_doctor_filters = __esm(async () => {
|
|
|
19269
19355
|
});
|
|
19270
19356
|
|
|
19271
19357
|
// src/lib/binary-cache.ts
|
|
19272
|
-
import { existsSync as existsSync14, readdirSync as readdirSync5, statSync as
|
|
19358
|
+
import { existsSync as existsSync14, readdirSync as readdirSync5, statSync as statSync9 } from "node:fs";
|
|
19273
19359
|
import { join as join17 } from "node:path";
|
|
19274
19360
|
function getBinaryCacheInfo(activeVersion) {
|
|
19275
19361
|
const path2 = getAftBinaryCacheDir();
|
|
@@ -19283,7 +19369,7 @@ function getBinaryCacheInfo(activeVersion) {
|
|
|
19283
19369
|
}
|
|
19284
19370
|
const versions = readdirSync5(path2).filter((entry) => {
|
|
19285
19371
|
try {
|
|
19286
|
-
return
|
|
19372
|
+
return statSync9(join17(path2, entry)).isDirectory();
|
|
19287
19373
|
} catch {
|
|
19288
19374
|
return false;
|
|
19289
19375
|
}
|
|
@@ -19381,7 +19467,7 @@ var init_sanitize = __esm(() => {
|
|
|
19381
19467
|
});
|
|
19382
19468
|
|
|
19383
19469
|
// src/lib/bridge-tool-failures.ts
|
|
19384
|
-
import { closeSync as closeSync5, existsSync as existsSync15, openSync as openSync5, readSync as readSync2, statSync as
|
|
19470
|
+
import { closeSync as closeSync5, existsSync as existsSync15, openSync as openSync5, readSync as readSync2, statSync as statSync10 } from "node:fs";
|
|
19385
19471
|
function resolveBridgePluginLogPath() {
|
|
19386
19472
|
const isTestEnv = process.env.BUN_TEST === "1" || false;
|
|
19387
19473
|
return resolveAftLogPath(isTestEnv ? "aft-plugin-test.log" : "aft-plugin.log");
|
|
@@ -19391,7 +19477,7 @@ function tailLogFileBytes(path2, maxBytes) {
|
|
|
19391
19477
|
return "";
|
|
19392
19478
|
let fd = null;
|
|
19393
19479
|
try {
|
|
19394
|
-
const size =
|
|
19480
|
+
const size = statSync10(path2).size;
|
|
19395
19481
|
if (size === 0)
|
|
19396
19482
|
return "";
|
|
19397
19483
|
const readLength = Math.min(size, maxBytes);
|
|
@@ -19523,7 +19609,7 @@ var init_bridge_tool_failures = __esm(() => {
|
|
|
19523
19609
|
});
|
|
19524
19610
|
|
|
19525
19611
|
// src/lib/legacy-storage.ts
|
|
19526
|
-
import { existsSync as existsSync16, readdirSync as readdirSync6, statSync as
|
|
19612
|
+
import { existsSync as existsSync16, readdirSync as readdirSync6, statSync as statSync11 } from "node:fs";
|
|
19527
19613
|
import { join as join18 } from "node:path";
|
|
19528
19614
|
function summarizeLegacyPartitionDuplication(storageRoot) {
|
|
19529
19615
|
if (!existsSync16(storageRoot)) {
|
|
@@ -19628,14 +19714,14 @@ function safeReadDir(path2) {
|
|
|
19628
19714
|
}
|
|
19629
19715
|
function isDirectory(path2) {
|
|
19630
19716
|
try {
|
|
19631
|
-
return
|
|
19717
|
+
return statSync11(path2).isDirectory();
|
|
19632
19718
|
} catch {
|
|
19633
19719
|
return false;
|
|
19634
19720
|
}
|
|
19635
19721
|
}
|
|
19636
19722
|
function safeFileSize(path2) {
|
|
19637
19723
|
try {
|
|
19638
|
-
return
|
|
19724
|
+
return statSync11(path2).isFile() ? statSync11(path2).size : 0;
|
|
19639
19725
|
} catch {
|
|
19640
19726
|
return 0;
|
|
19641
19727
|
}
|
|
@@ -19647,7 +19733,7 @@ var init_legacy_storage = __esm(() => {
|
|
|
19647
19733
|
});
|
|
19648
19734
|
|
|
19649
19735
|
// src/lib/lsp-cache.ts
|
|
19650
|
-
import { existsSync as existsSync17, readdirSync as readdirSync7, rmSync as rmSync5, statSync as
|
|
19736
|
+
import { existsSync as existsSync17, readdirSync as readdirSync7, rmSync as rmSync5, statSync as statSync12 } from "node:fs";
|
|
19651
19737
|
import { join as join19 } from "node:path";
|
|
19652
19738
|
function inspectDir(path2) {
|
|
19653
19739
|
if (!existsSync17(path2)) {
|
|
@@ -19664,7 +19750,7 @@ function inspectDir(path2) {
|
|
|
19664
19750
|
for (const name of names) {
|
|
19665
19751
|
const full = join19(path2, name);
|
|
19666
19752
|
try {
|
|
19667
|
-
if (!
|
|
19753
|
+
if (!statSync12(full).isDirectory())
|
|
19668
19754
|
continue;
|
|
19669
19755
|
const size = dirSize(full);
|
|
19670
19756
|
entries.push({
|
|
@@ -19939,7 +20025,7 @@ import {
|
|
|
19939
20025
|
existsSync as existsSync19,
|
|
19940
20026
|
openSync as openSync6,
|
|
19941
20027
|
readSync as readSync3,
|
|
19942
|
-
statSync as
|
|
20028
|
+
statSync as statSync13
|
|
19943
20029
|
} from "node:fs";
|
|
19944
20030
|
async function collectDiagnostics(adapters) {
|
|
19945
20031
|
const cliVersion = getSelfVersion();
|
|
@@ -20030,7 +20116,7 @@ async function diagnoseHarness(adapter) {
|
|
|
20030
20116
|
logFile: {
|
|
20031
20117
|
path: logPath,
|
|
20032
20118
|
exists: existsSync19(logPath),
|
|
20033
|
-
sizeKb: existsSync19(logPath) ? Math.round(
|
|
20119
|
+
sizeKb: existsSync19(logPath) ? Math.round(statSync13(logPath).size / 1024) : 0
|
|
20034
20120
|
}
|
|
20035
20121
|
};
|
|
20036
20122
|
}
|
|
@@ -20233,7 +20319,7 @@ function tailLogFile(path2, lines) {
|
|
|
20233
20319
|
const chunkSize = 64 * 1024;
|
|
20234
20320
|
let fd = null;
|
|
20235
20321
|
try {
|
|
20236
|
-
const size =
|
|
20322
|
+
const size = statSync13(path2).size;
|
|
20237
20323
|
fd = openSync6(path2, "r");
|
|
20238
20324
|
const chunks = [];
|
|
20239
20325
|
let position = size;
|
|
@@ -20521,7 +20607,7 @@ var init_onnx_fix = __esm(() => {
|
|
|
20521
20607
|
});
|
|
20522
20608
|
|
|
20523
20609
|
// src/lib/sessions.ts
|
|
20524
|
-
import { existsSync as existsSync21, readdirSync as readdirSync9, readFileSync as readFileSync10, statSync as
|
|
20610
|
+
import { existsSync as existsSync21, readdirSync as readdirSync9, readFileSync as readFileSync10, statSync as statSync14 } from "node:fs";
|
|
20525
20611
|
import { createRequire as createRequire5 } from "node:module";
|
|
20526
20612
|
import { homedir as homedir18 } from "node:os";
|
|
20527
20613
|
import { basename as basename4, join as join22 } from "node:path";
|
|
@@ -20588,7 +20674,7 @@ function listPiSessionsFromDir(sessionsDir) {
|
|
|
20588
20674
|
return [];
|
|
20589
20675
|
const files = collectJsonlFiles(sessionsDir).map((filePath) => {
|
|
20590
20676
|
try {
|
|
20591
|
-
const stats =
|
|
20677
|
+
const stats = statSync14(filePath);
|
|
20592
20678
|
return { filePath, mtimeMs: stats.mtimeMs };
|
|
20593
20679
|
} catch {
|
|
20594
20680
|
return null;
|
|
@@ -20728,7 +20814,7 @@ import {
|
|
|
20728
20814
|
readFileSync as readFileSync11,
|
|
20729
20815
|
realpathSync as realpathSync5,
|
|
20730
20816
|
rmSync as rmSync7,
|
|
20731
|
-
statSync as
|
|
20817
|
+
statSync as statSync15,
|
|
20732
20818
|
writeFileSync as writeFileSync5
|
|
20733
20819
|
} from "node:fs";
|
|
20734
20820
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
@@ -20912,7 +20998,7 @@ function clearOldBinaries() {
|
|
|
20912
20998
|
const dir = join23(info.path, version);
|
|
20913
20999
|
let bytes = 0;
|
|
20914
21000
|
try {
|
|
20915
|
-
bytes =
|
|
21001
|
+
bytes = statSync15(dir).isDirectory() ? dirSize(dir) : 0;
|
|
20916
21002
|
} catch {
|
|
20917
21003
|
bytes = 0;
|
|
20918
21004
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft",
|
|
3
|
-
"version": "0.49.
|
|
3
|
+
"version": "0.49.1",
|
|
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.49.
|
|
27
|
+
"@cortexkit/aft-bridge": "0.49.1",
|
|
28
28
|
"comment-json": "^4.6.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|