@cortexkit/aft 0.56.0 → 0.56.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 +60 -14
- package/dist/setup/host-generation.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -11982,12 +11982,15 @@ import { spawnSync as spawnSync5 } from "node:child_process";
|
|
|
11982
11982
|
import { createHash as createHash4 } from "node:crypto";
|
|
11983
11983
|
import {
|
|
11984
11984
|
accessSync as accessSync2,
|
|
11985
|
+
closeSync as closeSync4,
|
|
11985
11986
|
constants as constants2,
|
|
11986
11987
|
existsSync as existsSync11,
|
|
11987
11988
|
mkdirSync as mkdirSync5,
|
|
11988
11989
|
mkdtempSync,
|
|
11990
|
+
openSync as openSync4,
|
|
11989
11991
|
readdirSync as readdirSync5,
|
|
11990
11992
|
readFileSync as readFileSync8,
|
|
11993
|
+
readSync as readSync2,
|
|
11991
11994
|
realpathSync as realpathSync2,
|
|
11992
11995
|
rmSync as rmSync3,
|
|
11993
11996
|
statSync as statSync6
|
|
@@ -12043,27 +12046,67 @@ function packageMetadataNearExecutable(executable, expectedName) {
|
|
|
12043
12046
|
function packageVersion(metadata) {
|
|
12044
12047
|
return typeof metadata?.version === "string" && metadata.version.length > 0 ? metadata.version : null;
|
|
12045
12048
|
}
|
|
12049
|
+
function hashFileBytes(hash, path, size) {
|
|
12050
|
+
const buffer = Buffer.allocUnsafe(Math.min(Math.max(size, 1), PARTIAL_CONTENT_WINDOW_BYTES));
|
|
12051
|
+
const descriptor = openSync4(path, "r");
|
|
12052
|
+
try {
|
|
12053
|
+
if (size <= FULL_CONTENT_HASH_MAX_BYTES) {
|
|
12054
|
+
let position = 0;
|
|
12055
|
+
while (position < size) {
|
|
12056
|
+
const read = readSync2(descriptor, buffer, 0, buffer.length, position);
|
|
12057
|
+
if (read <= 0)
|
|
12058
|
+
break;
|
|
12059
|
+
hash.update(buffer.subarray(0, read));
|
|
12060
|
+
position += read;
|
|
12061
|
+
}
|
|
12062
|
+
return;
|
|
12063
|
+
}
|
|
12064
|
+
hash.update("partial\x00");
|
|
12065
|
+
const head = readSync2(descriptor, buffer, 0, buffer.length, 0);
|
|
12066
|
+
hash.update(buffer.subarray(0, Math.max(head, 0)));
|
|
12067
|
+
const tailStart = Math.max(size - PARTIAL_CONTENT_WINDOW_BYTES, 0);
|
|
12068
|
+
const tail = readSync2(descriptor, buffer, 0, buffer.length, tailStart);
|
|
12069
|
+
hash.update(buffer.subarray(0, Math.max(tail, 0)));
|
|
12070
|
+
} finally {
|
|
12071
|
+
closeSync4(descriptor);
|
|
12072
|
+
}
|
|
12073
|
+
}
|
|
12046
12074
|
function snapshotTree(path) {
|
|
12047
12075
|
if (!existsSync11(path))
|
|
12048
12076
|
return "missing";
|
|
12049
12077
|
const hash = createHash4("sha256");
|
|
12050
12078
|
const visit = (current, relativePath) => {
|
|
12051
|
-
|
|
12052
|
-
|
|
12079
|
+
let info;
|
|
12080
|
+
try {
|
|
12081
|
+
info = statSync6(current);
|
|
12082
|
+
} catch (error) {
|
|
12083
|
+
hash.update(`${relativePath}\x00unreadable\x00${error.code}\x00`);
|
|
12084
|
+
return;
|
|
12085
|
+
}
|
|
12086
|
+
hash.update(`${relativePath}\x00${info.mode}\x00${info.size}\x00${info.mtimeMs}\x00`);
|
|
12053
12087
|
if (info.isDirectory()) {
|
|
12054
12088
|
for (const entry of readdirSync5(current).sort()) {
|
|
12055
12089
|
visit(join13(current, entry), join13(relativePath, entry));
|
|
12056
12090
|
}
|
|
12057
12091
|
return;
|
|
12058
12092
|
}
|
|
12059
|
-
|
|
12093
|
+
if (!info.isFile())
|
|
12094
|
+
return;
|
|
12095
|
+
try {
|
|
12096
|
+
hashFileBytes(hash, current, info.size);
|
|
12097
|
+
} catch (error) {
|
|
12098
|
+
hash.update(`unreadable\x00${error.code}\x00`);
|
|
12099
|
+
}
|
|
12060
12100
|
};
|
|
12061
12101
|
visit(path, ".");
|
|
12062
12102
|
return hash.digest("hex");
|
|
12063
12103
|
}
|
|
12064
12104
|
function snapshotOperatorState(operatorHome) {
|
|
12105
|
+
const database = join13(operatorHome, ".local", "share", "opencode", "opencode.db");
|
|
12065
12106
|
return JSON.stringify({
|
|
12066
|
-
database: snapshotTree(
|
|
12107
|
+
database: snapshotTree(database),
|
|
12108
|
+
databaseWal: snapshotTree(`${database}-wal`),
|
|
12109
|
+
databaseShm: snapshotTree(`${database}-shm`),
|
|
12067
12110
|
logs: snapshotTree(join13(operatorHome, ".local", "share", "opencode", "log"))
|
|
12068
12111
|
});
|
|
12069
12112
|
}
|
|
@@ -12166,8 +12209,11 @@ function formatHostGenerations(detection) {
|
|
|
12166
12209
|
return "V2";
|
|
12167
12210
|
return "unknown";
|
|
12168
12211
|
}
|
|
12212
|
+
var FULL_CONTENT_HASH_MAX_BYTES, PARTIAL_CONTENT_WINDOW_BYTES;
|
|
12169
12213
|
var init_host_generation = __esm(() => {
|
|
12170
12214
|
init_opencode_config();
|
|
12215
|
+
FULL_CONTENT_HASH_MAX_BYTES = 64 * 1024 * 1024;
|
|
12216
|
+
PARTIAL_CONTENT_WINDOW_BYTES = 1024 * 1024;
|
|
12171
12217
|
});
|
|
12172
12218
|
|
|
12173
12219
|
// src/adapters/opencode.ts
|
|
@@ -14587,7 +14633,7 @@ var init_sanitize = __esm(() => {
|
|
|
14587
14633
|
});
|
|
14588
14634
|
|
|
14589
14635
|
// src/lib/bridge-tool-failures.ts
|
|
14590
|
-
import { closeSync as
|
|
14636
|
+
import { closeSync as closeSync5, existsSync as existsSync16, openSync as openSync5, readSync as readSync3, statSync as statSync9 } from "node:fs";
|
|
14591
14637
|
function resolveBridgePluginLogPath() {
|
|
14592
14638
|
const isTestEnv = process.env.BUN_TEST === "1" || false;
|
|
14593
14639
|
return resolveAftLogPath(isTestEnv ? "aft-plugin-test.log" : "aft-plugin.log");
|
|
@@ -14602,16 +14648,16 @@ function tailLogFileBytes(path, maxBytes) {
|
|
|
14602
14648
|
return "";
|
|
14603
14649
|
const readLength = Math.min(size, maxBytes);
|
|
14604
14650
|
const position = size - readLength;
|
|
14605
|
-
fd =
|
|
14651
|
+
fd = openSync5(path, "r");
|
|
14606
14652
|
const buffer = Buffer.allocUnsafe(readLength);
|
|
14607
|
-
const bytesRead =
|
|
14653
|
+
const bytesRead = readSync3(fd, buffer, 0, readLength, position);
|
|
14608
14654
|
return buffer.subarray(0, bytesRead).toString("utf-8").trim();
|
|
14609
14655
|
} catch {
|
|
14610
14656
|
return "";
|
|
14611
14657
|
} finally {
|
|
14612
14658
|
if (fd !== null) {
|
|
14613
14659
|
try {
|
|
14614
|
-
|
|
14660
|
+
closeSync5(fd);
|
|
14615
14661
|
} catch {}
|
|
14616
14662
|
}
|
|
14617
14663
|
}
|
|
@@ -15236,11 +15282,11 @@ var init_onnx = () => {};
|
|
|
15236
15282
|
// src/lib/diagnostics.ts
|
|
15237
15283
|
import {
|
|
15238
15284
|
accessSync as accessSync3,
|
|
15239
|
-
closeSync as
|
|
15285
|
+
closeSync as closeSync6,
|
|
15240
15286
|
constants as constants3,
|
|
15241
15287
|
existsSync as existsSync21,
|
|
15242
|
-
openSync as
|
|
15243
|
-
readSync as
|
|
15288
|
+
openSync as openSync6,
|
|
15289
|
+
readSync as readSync4,
|
|
15244
15290
|
statSync as statSync12
|
|
15245
15291
|
} from "node:fs";
|
|
15246
15292
|
async function collectDiagnostics(adapters) {
|
|
@@ -15538,7 +15584,7 @@ function tailLogFile(path, lines) {
|
|
|
15538
15584
|
let fd = null;
|
|
15539
15585
|
try {
|
|
15540
15586
|
const size = statSync12(path).size;
|
|
15541
|
-
fd =
|
|
15587
|
+
fd = openSync6(path, "r");
|
|
15542
15588
|
const chunks = [];
|
|
15543
15589
|
let position = size;
|
|
15544
15590
|
let newlineCount = 0;
|
|
@@ -15546,7 +15592,7 @@ function tailLogFile(path, lines) {
|
|
|
15546
15592
|
const readLength = Math.min(chunkSize, position);
|
|
15547
15593
|
position -= readLength;
|
|
15548
15594
|
const buffer = Buffer.allocUnsafe(readLength);
|
|
15549
|
-
const bytesRead =
|
|
15595
|
+
const bytesRead = readSync4(fd, buffer, 0, readLength, position);
|
|
15550
15596
|
const chunk = bytesRead === readLength ? buffer : buffer.subarray(0, bytesRead);
|
|
15551
15597
|
chunks.unshift(chunk);
|
|
15552
15598
|
for (let i = chunk.length - 1;i >= 0; i -= 1) {
|
|
@@ -15561,7 +15607,7 @@ function tailLogFile(path, lines) {
|
|
|
15561
15607
|
} finally {
|
|
15562
15608
|
if (fd !== null) {
|
|
15563
15609
|
try {
|
|
15564
|
-
|
|
15610
|
+
closeSync6(fd);
|
|
15565
15611
|
} catch {}
|
|
15566
15612
|
}
|
|
15567
15613
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-generation.d.ts","sourceRoot":"","sources":["../../src/setup/host-generation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"host-generation.d.ts","sourceRoot":"","sources":["../../src/setup/host-generation.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAAC;AACjD,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,MAAM,CAAC;AAEjD,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,sBAAsB,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,sBAAsB,GAAG,WAAW,GAAG,SAAS,CAAC;IACzD,WAAW,EAAE,sBAAsB,EAAE,CAAC;IACtC,QAAQ,EAAE,oBAAoB,EAAE,CAAC;CAClC;AAOD,MAAM,WAAW,0BAA0B;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,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ANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft",
|
|
3
|
-
"version": "0.56.
|
|
3
|
+
"version": "0.56.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Unified CLI for Agent File Tools (AFT) — setup, one-shot index snapshots, 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.56.
|
|
27
|
+
"@cortexkit/aft-bridge": "0.56.1",
|
|
28
28
|
"comment-json": "^4.6.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|