@cortexkit/aft 0.56.0 → 0.56.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAY3D,OAAO,EAEL,kBAAkB,EAClB,KAAK,gBAAgB,EAKtB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAYrE,OAAO,EAAE,KAAK,WAAW,EAAkB,MAAM,qBAAqB,CAAC;AAMvE,OAAO,EAAyB,KAAK,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEhG,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,WAAW,GAAG,cAAc,CAAC;AAE9E,eAAO,MAAM,2BAA2B,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,iBAAiB,CAAA;CAAE,EAapF,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,iBAAiB,EAAqB,CAAC;AAEhF,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,0FAA0F;IAC1F,eAAe,CAAC,EAAE,OAAO,yBAAyB,CAAC;IACnD,kBAAkB,CAAC,EAAE,OAAO,kBAAkB,CAAC;IAC/C,oBAAoB,CAAC,EAAE,OAAO,oBAAoB,CAAC;IACnD,kBAAkB,CAAC,EAAE,MAAM,qBAAqB,CAAC;CAClD;AA8BD,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,C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const OPENCODE_LOAD_PATHS: readonly ["root-default", "export-server-
|
|
2
|
+
export declare const OPENCODE_LOAD_PATHS: readonly ["root-default", "export-server-effect-bun", "export-server-effect-node"];
|
|
3
3
|
export type OpenCodeLoadPath = (typeof OPENCODE_LOAD_PATHS)[number];
|
|
4
4
|
export interface OpenCodeDoctorInput {
|
|
5
5
|
detection: OpenCodeHostDetection;
|
|
@@ -8,6 +8,7 @@ export interface OpenCodeDoctorInput {
|
|
|
8
8
|
pluginCachePath: string;
|
|
9
9
|
cachedPluginVersion?: string;
|
|
10
10
|
expectedPluginEntry?: string;
|
|
11
|
+
acceptExplicitPluginVersion?: boolean;
|
|
11
12
|
}
|
|
12
13
|
export interface OpenCodeDoctorResult {
|
|
13
14
|
expectedLoadPath: OpenCodeLoadPath | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../src/doctor/opencode.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAuB,MAAM,6BAA6B,CAAC;AAG9F,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../src/doctor/opencode.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAuB,MAAM,6BAA6B,CAAC;AAG9F,eAAO,MAAM,mBAAmB,oFAItB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,qBAAqB,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC;AAED,MAAM,WAAW,oBAAoB;IACnC,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC1C,aAAa,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACvC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAmGD,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,qBAAqB,GAC/B,gBAAgB,GAAG,IAAI,CAQzB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,GAAG,oBAAoB,CA8CrF"}
|
package/dist/index.js
CHANGED
|
@@ -366,6 +366,7 @@ var init_bridge = __esm(() => {
|
|
|
366
366
|
pending = new Map;
|
|
367
367
|
outstandingBackgroundTaskIds = new Set;
|
|
368
368
|
nextId = 1;
|
|
369
|
+
processGeneration = 0;
|
|
369
370
|
stdoutBuffer = "";
|
|
370
371
|
stdoutReadOffset = 0;
|
|
371
372
|
stderrBuffer = "";
|
|
@@ -678,6 +679,7 @@ var init_bridge = __esm(() => {
|
|
|
678
679
|
}
|
|
679
680
|
}
|
|
680
681
|
const id = String(this.nextId++);
|
|
682
|
+
const tool = command === "tool_call" && typeof params.name === "string" ? params.name : command;
|
|
681
683
|
let request;
|
|
682
684
|
if (command === "cancel_request" || Object.hasOwn(params, "command") || Object.hasOwn(params, "method")) {
|
|
683
685
|
const nested = { ...params };
|
|
@@ -731,14 +733,20 @@ var init_bridge = __esm(() => {
|
|
|
731
733
|
return;
|
|
732
734
|
}
|
|
733
735
|
entry.reject(new Error(`${this.errorPrefix} Request "${command}" (id=${id}) timed out after ${effectiveTimeoutMs}ms`));
|
|
734
|
-
this.handleTimeout(
|
|
736
|
+
this.handleTimeout({
|
|
737
|
+
requestId: id,
|
|
738
|
+
tool: entry.tool,
|
|
739
|
+
generation: entry.generation
|
|
740
|
+
}, requestSessionId);
|
|
735
741
|
}, effectiveTimeoutMs);
|
|
736
742
|
const entry = {
|
|
737
743
|
resolve,
|
|
738
744
|
reject,
|
|
739
745
|
timer,
|
|
740
746
|
onProgress: options?.onProgress,
|
|
741
|
-
command
|
|
747
|
+
command,
|
|
748
|
+
tool,
|
|
749
|
+
generation: this.processGeneration
|
|
742
750
|
};
|
|
743
751
|
this.pending.set(id, entry);
|
|
744
752
|
if (!child?.stdin?.writable) {
|
|
@@ -1041,6 +1049,7 @@ var init_bridge = __esm(() => {
|
|
|
1041
1049
|
this.handleCrash();
|
|
1042
1050
|
});
|
|
1043
1051
|
this.process = child;
|
|
1052
|
+
this.processGeneration += 1;
|
|
1044
1053
|
this.spawnedBinaryFingerprint = readBinaryFingerprint(this.binaryPath);
|
|
1045
1054
|
this.lastBinaryFingerprintCheckAt = Date.now();
|
|
1046
1055
|
this.stdoutBuffer = "";
|
|
@@ -1212,10 +1221,15 @@ var init_bridge = __esm(() => {
|
|
|
1212
1221
|
this.outstandingBackgroundTaskIds.add(taskId);
|
|
1213
1222
|
}
|
|
1214
1223
|
}
|
|
1215
|
-
handleTimeout(triggeringSessionId) {
|
|
1224
|
+
handleTimeout(trigger, triggeringSessionId) {
|
|
1216
1225
|
this.consecutiveRequestTimeouts = 0;
|
|
1217
1226
|
this.spawnedBinaryFingerprint = null;
|
|
1218
|
-
|
|
1227
|
+
const abortedSiblings = Array.from(this.pending, ([requestId, entry]) => ({
|
|
1228
|
+
request_id: requestId,
|
|
1229
|
+
tool: entry.tool
|
|
1230
|
+
}));
|
|
1231
|
+
const attribution = `triggering_request_id=${trigger.requestId} ` + `triggering_tool=${JSON.stringify(trigger.tool)} ` + `bridge_generation=${trigger.generation} ` + `aborted_siblings=${JSON.stringify(abortedSiblings)}`;
|
|
1232
|
+
this.rejectAllPending(new BridgeTransportUnknownOutcomeError(`${this.errorPrefix} bridge killed during sibling timeout — request aborted; ${attribution}`));
|
|
1219
1233
|
this.outstandingBackgroundTaskIds.clear();
|
|
1220
1234
|
if (this.process) {
|
|
1221
1235
|
this.process.kill("SIGKILL");
|
|
@@ -1225,17 +1239,11 @@ var init_bridge = __esm(() => {
|
|
|
1225
1239
|
this.configured = false;
|
|
1226
1240
|
const tail = this.formatStderrTail();
|
|
1227
1241
|
this.stderrTail = [];
|
|
1228
|
-
const killedMsg = tail ? `Bridge killed after timeout.${tail}` : `Bridge killed after timeout (see ${this.getLogFilePathVia()})`;
|
|
1229
|
-
if (
|
|
1230
|
-
|
|
1231
|
-
this.sessionErrorVia(triggeringSessionId, killedMsg);
|
|
1232
|
-
} else {
|
|
1233
|
-
this.errorVia(killedMsg);
|
|
1234
|
-
}
|
|
1235
|
-
} else if (triggeringSessionId) {
|
|
1236
|
-
this.sessionWarnVia(triggeringSessionId, killedMsg);
|
|
1242
|
+
const killedMsg = tail ? `Bridge killed after timeout; ${attribution}.${tail}` : `Bridge killed after timeout; ${attribution} (see ${this.getLogFilePathVia()})`;
|
|
1243
|
+
if (triggeringSessionId) {
|
|
1244
|
+
this.sessionErrorVia(triggeringSessionId, killedMsg);
|
|
1237
1245
|
} else {
|
|
1238
|
-
this.
|
|
1246
|
+
this.errorVia(killedMsg);
|
|
1239
1247
|
}
|
|
1240
1248
|
}
|
|
1241
1249
|
handleCrash(cause) {
|
|
@@ -11982,12 +11990,15 @@ import { spawnSync as spawnSync5 } from "node:child_process";
|
|
|
11982
11990
|
import { createHash as createHash4 } from "node:crypto";
|
|
11983
11991
|
import {
|
|
11984
11992
|
accessSync as accessSync2,
|
|
11993
|
+
closeSync as closeSync4,
|
|
11985
11994
|
constants as constants2,
|
|
11986
11995
|
existsSync as existsSync11,
|
|
11987
11996
|
mkdirSync as mkdirSync5,
|
|
11988
11997
|
mkdtempSync,
|
|
11998
|
+
openSync as openSync4,
|
|
11989
11999
|
readdirSync as readdirSync5,
|
|
11990
12000
|
readFileSync as readFileSync8,
|
|
12001
|
+
readSync as readSync2,
|
|
11991
12002
|
realpathSync as realpathSync2,
|
|
11992
12003
|
rmSync as rmSync3,
|
|
11993
12004
|
statSync as statSync6
|
|
@@ -12043,30 +12054,77 @@ function packageMetadataNearExecutable(executable, expectedName) {
|
|
|
12043
12054
|
function packageVersion(metadata) {
|
|
12044
12055
|
return typeof metadata?.version === "string" && metadata.version.length > 0 ? metadata.version : null;
|
|
12045
12056
|
}
|
|
12057
|
+
function hashFileBytes(hash, path, size) {
|
|
12058
|
+
const buffer = Buffer.allocUnsafe(Math.min(Math.max(size, 1), PARTIAL_CONTENT_WINDOW_BYTES));
|
|
12059
|
+
const descriptor = openSync4(path, "r");
|
|
12060
|
+
try {
|
|
12061
|
+
if (size <= FULL_CONTENT_HASH_MAX_BYTES) {
|
|
12062
|
+
let position = 0;
|
|
12063
|
+
while (position < size) {
|
|
12064
|
+
const read = readSync2(descriptor, buffer, 0, buffer.length, position);
|
|
12065
|
+
if (read <= 0)
|
|
12066
|
+
break;
|
|
12067
|
+
hash.update(buffer.subarray(0, read));
|
|
12068
|
+
position += read;
|
|
12069
|
+
}
|
|
12070
|
+
return;
|
|
12071
|
+
}
|
|
12072
|
+
hash.update("partial\x00");
|
|
12073
|
+
const head = readSync2(descriptor, buffer, 0, buffer.length, 0);
|
|
12074
|
+
hash.update(buffer.subarray(0, Math.max(head, 0)));
|
|
12075
|
+
const tailStart = Math.max(size - PARTIAL_CONTENT_WINDOW_BYTES, 0);
|
|
12076
|
+
const tail = readSync2(descriptor, buffer, 0, buffer.length, tailStart);
|
|
12077
|
+
hash.update(buffer.subarray(0, Math.max(tail, 0)));
|
|
12078
|
+
} finally {
|
|
12079
|
+
closeSync4(descriptor);
|
|
12080
|
+
}
|
|
12081
|
+
}
|
|
12046
12082
|
function snapshotTree(path) {
|
|
12047
12083
|
if (!existsSync11(path))
|
|
12048
12084
|
return "missing";
|
|
12049
12085
|
const hash = createHash4("sha256");
|
|
12050
12086
|
const visit = (current, relativePath) => {
|
|
12051
|
-
|
|
12052
|
-
|
|
12087
|
+
let info;
|
|
12088
|
+
try {
|
|
12089
|
+
info = statSync6(current);
|
|
12090
|
+
} catch (error) {
|
|
12091
|
+
hash.update(`${relativePath}\x00unreadable\x00${error.code}\x00`);
|
|
12092
|
+
return;
|
|
12093
|
+
}
|
|
12094
|
+
hash.update(`${relativePath}\x00${info.mode}\x00${info.size}\x00${info.mtimeMs}\x00`);
|
|
12053
12095
|
if (info.isDirectory()) {
|
|
12054
12096
|
for (const entry of readdirSync5(current).sort()) {
|
|
12055
12097
|
visit(join13(current, entry), join13(relativePath, entry));
|
|
12056
12098
|
}
|
|
12057
12099
|
return;
|
|
12058
12100
|
}
|
|
12059
|
-
|
|
12101
|
+
if (!info.isFile())
|
|
12102
|
+
return;
|
|
12103
|
+
try {
|
|
12104
|
+
hashFileBytes(hash, current, info.size);
|
|
12105
|
+
} catch (error) {
|
|
12106
|
+
hash.update(`unreadable\x00${error.code}\x00`);
|
|
12107
|
+
}
|
|
12060
12108
|
};
|
|
12061
12109
|
visit(path, ".");
|
|
12062
12110
|
return hash.digest("hex");
|
|
12063
12111
|
}
|
|
12064
12112
|
function snapshotOperatorState(operatorHome) {
|
|
12113
|
+
const database = join13(operatorHome, ".local", "share", "opencode", "opencode.db");
|
|
12065
12114
|
return JSON.stringify({
|
|
12066
|
-
database: snapshotTree(
|
|
12115
|
+
database: snapshotTree(database),
|
|
12116
|
+
databaseWal: snapshotTree(`${database}-wal`),
|
|
12117
|
+
databaseShm: snapshotTree(`${database}-shm`),
|
|
12067
12118
|
logs: snapshotTree(join13(operatorHome, ".local", "share", "opencode", "log"))
|
|
12068
12119
|
});
|
|
12069
12120
|
}
|
|
12121
|
+
function probeCreatedIsolatedState(dataRoot, stateRoot) {
|
|
12122
|
+
return [dataRoot, stateRoot].some((root) => {
|
|
12123
|
+
const opencodeRoot = join13(root, "opencode");
|
|
12124
|
+
const database = join13(opencodeRoot, "opencode.db");
|
|
12125
|
+
return [database, `${database}-wal`, `${database}-shm`, join13(opencodeRoot, "log")].some(existsSync11);
|
|
12126
|
+
});
|
|
12127
|
+
}
|
|
12070
12128
|
function probeOpenCodeV1Version(executable, options = {}) {
|
|
12071
12129
|
const operatorHome = options.operatorHome ?? homedir9();
|
|
12072
12130
|
const before = snapshotOperatorState(operatorHome);
|
|
@@ -12108,10 +12166,14 @@ function probeOpenCodeV1Version(executable, options = {}) {
|
|
|
12108
12166
|
probeError = error;
|
|
12109
12167
|
}
|
|
12110
12168
|
const after = snapshotOperatorState(operatorHome);
|
|
12169
|
+
const createdIsolatedState = probeCreatedIsolatedState(data, state);
|
|
12111
12170
|
rmSync3(root, { recursive: true, force: true });
|
|
12112
|
-
if (after !== before) {
|
|
12171
|
+
if (after !== before && env.AFT_LOAD_MATRIX_ALLOW_LIVE_OPERATOR === "0") {
|
|
12113
12172
|
throw new Error("OpenCode host probe changed the operator database or log directory");
|
|
12114
12173
|
}
|
|
12174
|
+
if (after !== before && !createdIsolatedState) {
|
|
12175
|
+
console.warn("OpenCode operator state changed during an isolated host probe while its data and state roots stayed empty; an active host may be writing concurrently");
|
|
12176
|
+
}
|
|
12115
12177
|
if (probeError)
|
|
12116
12178
|
throw probeError;
|
|
12117
12179
|
if (!result || result.error || result.status !== 0)
|
|
@@ -12166,8 +12228,11 @@ function formatHostGenerations(detection) {
|
|
|
12166
12228
|
return "V2";
|
|
12167
12229
|
return "unknown";
|
|
12168
12230
|
}
|
|
12231
|
+
var FULL_CONTENT_HASH_MAX_BYTES, PARTIAL_CONTENT_WINDOW_BYTES;
|
|
12169
12232
|
var init_host_generation = __esm(() => {
|
|
12170
12233
|
init_opencode_config();
|
|
12234
|
+
FULL_CONTENT_HASH_MAX_BYTES = 64 * 1024 * 1024;
|
|
12235
|
+
PARTIAL_CONTENT_WINDOW_BYTES = 1024 * 1024;
|
|
12171
12236
|
});
|
|
12172
12237
|
|
|
12173
12238
|
// src/adapters/opencode.ts
|
|
@@ -14271,19 +14336,16 @@ function pluginManifest(entry, cachePath) {
|
|
|
14271
14336
|
return manifestFromLocalPath(localRoot);
|
|
14272
14337
|
return readManifest(join16(cachePath, "node_modules", "@cortexkit", "aft-opencode", "package.json"));
|
|
14273
14338
|
}
|
|
14274
|
-
function
|
|
14275
|
-
|
|
14276
|
-
|
|
14277
|
-
const discovered = manifest["oc-plugin"];
|
|
14278
|
-
const exports = manifest.exports;
|
|
14279
|
-
return Array.isArray(discovered) && discovered.includes("server") && typeof exports === "object" && exports !== null && Object.hasOwn(exports, "./server");
|
|
14339
|
+
function hasExplicitSemver(entry) {
|
|
14340
|
+
const version = configuredVersion(entry);
|
|
14341
|
+
return Boolean(version && /^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.test(version));
|
|
14280
14342
|
}
|
|
14281
14343
|
function latestLoggedLoadPath(logPath) {
|
|
14282
14344
|
if (!existsSync14(logPath))
|
|
14283
14345
|
return null;
|
|
14284
14346
|
try {
|
|
14285
14347
|
const text = readFileSync11(logPath, "utf8");
|
|
14286
|
-
const pattern = /(?:load path|load_path)\s*[:=]\s*(root-default|export-server-
|
|
14348
|
+
const pattern = /(?:load path|load_path)\s*[:=]\s*(root-default|export-server-effect-bun|export-server-effect-node)/gi;
|
|
14287
14349
|
let latest = null;
|
|
14288
14350
|
for (const match of text.matchAll(pattern)) {
|
|
14289
14351
|
const value = match[1];
|
|
@@ -14300,7 +14362,7 @@ function detectedV2Runtime(detection) {
|
|
|
14300
14362
|
}
|
|
14301
14363
|
function expectedOpenCodeLoadPath(detection) {
|
|
14302
14364
|
if (detection.status === "v1")
|
|
14303
|
-
return "
|
|
14365
|
+
return "root-default";
|
|
14304
14366
|
if (detection.status === "v2") {
|
|
14305
14367
|
return detectedV2Runtime(detection) === "bun" ? "export-server-effect-bun" : "export-server-effect-node";
|
|
14306
14368
|
}
|
|
@@ -14314,7 +14376,7 @@ function diagnoseOpenCodeLoad(input) {
|
|
|
14314
14376
|
const logged = latestLoggedLoadPath(input.logPath);
|
|
14315
14377
|
let takenLoadPath = logged;
|
|
14316
14378
|
if (!takenLoadPath && input.detection.status === "v1") {
|
|
14317
|
-
takenLoadPath =
|
|
14379
|
+
takenLoadPath = "root-default";
|
|
14318
14380
|
} else if (!takenLoadPath && input.detection.status === "v2") {
|
|
14319
14381
|
takenLoadPath = expectedLoadPath;
|
|
14320
14382
|
}
|
|
@@ -14323,7 +14385,7 @@ function diagnoseOpenCodeLoad(input) {
|
|
|
14323
14385
|
if (config && Object.hasOwn(config, "plugins")) {
|
|
14324
14386
|
problems.push("config uses unsupported `plugins`; run doctor --fix to migrate it to `plugin`");
|
|
14325
14387
|
}
|
|
14326
|
-
if (entry && isAftNpmEntry(entry) && input.expectedPluginEntry && entry !== input.expectedPluginEntry) {
|
|
14388
|
+
if (entry && isAftNpmEntry(entry) && input.expectedPluginEntry && entry !== input.expectedPluginEntry && !(input.acceptExplicitPluginVersion && hasExplicitSemver(entry))) {
|
|
14327
14389
|
problems.push(`plugin entry ${entry} is not the required exact pin ${input.expectedPluginEntry}`);
|
|
14328
14390
|
}
|
|
14329
14391
|
if (input.detection.status === "ambiguous") {
|
|
@@ -14342,7 +14404,6 @@ var init_opencode2 = __esm(() => {
|
|
|
14342
14404
|
init_opencode_config();
|
|
14343
14405
|
OPENCODE_LOAD_PATHS = [
|
|
14344
14406
|
"root-default",
|
|
14345
|
-
"export-server-v1",
|
|
14346
14407
|
"export-server-effect-bun",
|
|
14347
14408
|
"export-server-effect-node"
|
|
14348
14409
|
];
|
|
@@ -14587,7 +14648,7 @@ var init_sanitize = __esm(() => {
|
|
|
14587
14648
|
});
|
|
14588
14649
|
|
|
14589
14650
|
// src/lib/bridge-tool-failures.ts
|
|
14590
|
-
import { closeSync as
|
|
14651
|
+
import { closeSync as closeSync5, existsSync as existsSync16, openSync as openSync5, readSync as readSync3, statSync as statSync9 } from "node:fs";
|
|
14591
14652
|
function resolveBridgePluginLogPath() {
|
|
14592
14653
|
const isTestEnv = process.env.BUN_TEST === "1" || false;
|
|
14593
14654
|
return resolveAftLogPath(isTestEnv ? "aft-plugin-test.log" : "aft-plugin.log");
|
|
@@ -14602,16 +14663,16 @@ function tailLogFileBytes(path, maxBytes) {
|
|
|
14602
14663
|
return "";
|
|
14603
14664
|
const readLength = Math.min(size, maxBytes);
|
|
14604
14665
|
const position = size - readLength;
|
|
14605
|
-
fd =
|
|
14666
|
+
fd = openSync5(path, "r");
|
|
14606
14667
|
const buffer = Buffer.allocUnsafe(readLength);
|
|
14607
|
-
const bytesRead =
|
|
14668
|
+
const bytesRead = readSync3(fd, buffer, 0, readLength, position);
|
|
14608
14669
|
return buffer.subarray(0, bytesRead).toString("utf-8").trim();
|
|
14609
14670
|
} catch {
|
|
14610
14671
|
return "";
|
|
14611
14672
|
} finally {
|
|
14612
14673
|
if (fd !== null) {
|
|
14613
14674
|
try {
|
|
14614
|
-
|
|
14675
|
+
closeSync5(fd);
|
|
14615
14676
|
} catch {}
|
|
14616
14677
|
}
|
|
14617
14678
|
}
|
|
@@ -15236,11 +15297,11 @@ var init_onnx = () => {};
|
|
|
15236
15297
|
// src/lib/diagnostics.ts
|
|
15237
15298
|
import {
|
|
15238
15299
|
accessSync as accessSync3,
|
|
15239
|
-
closeSync as
|
|
15300
|
+
closeSync as closeSync6,
|
|
15240
15301
|
constants as constants3,
|
|
15241
15302
|
existsSync as existsSync21,
|
|
15242
|
-
openSync as
|
|
15243
|
-
readSync as
|
|
15303
|
+
openSync as openSync6,
|
|
15304
|
+
readSync as readSync4,
|
|
15244
15305
|
statSync as statSync12
|
|
15245
15306
|
} from "node:fs";
|
|
15246
15307
|
async function collectDiagnostics(adapters) {
|
|
@@ -15538,7 +15599,7 @@ function tailLogFile(path, lines) {
|
|
|
15538
15599
|
let fd = null;
|
|
15539
15600
|
try {
|
|
15540
15601
|
const size = statSync12(path).size;
|
|
15541
|
-
fd =
|
|
15602
|
+
fd = openSync6(path, "r");
|
|
15542
15603
|
const chunks = [];
|
|
15543
15604
|
let position = size;
|
|
15544
15605
|
let newlineCount = 0;
|
|
@@ -15546,7 +15607,7 @@ function tailLogFile(path, lines) {
|
|
|
15546
15607
|
const readLength = Math.min(chunkSize, position);
|
|
15547
15608
|
position -= readLength;
|
|
15548
15609
|
const buffer = Buffer.allocUnsafe(readLength);
|
|
15549
|
-
const bytesRead =
|
|
15610
|
+
const bytesRead = readSync4(fd, buffer, 0, readLength, position);
|
|
15550
15611
|
const chunk = bytesRead === readLength ? buffer : buffer.subarray(0, bytesRead);
|
|
15551
15612
|
chunks.unshift(chunk);
|
|
15552
15613
|
for (let i = chunk.length - 1;i >= 0; i -= 1) {
|
|
@@ -15561,7 +15622,7 @@ function tailLogFile(path, lines) {
|
|
|
15561
15622
|
} finally {
|
|
15562
15623
|
if (fd !== null) {
|
|
15563
15624
|
try {
|
|
15564
|
-
|
|
15625
|
+
closeSync6(fd);
|
|
15565
15626
|
} catch {}
|
|
15566
15627
|
}
|
|
15567
15628
|
}
|
|
@@ -16101,7 +16162,8 @@ async function runDoctor(options) {
|
|
|
16101
16162
|
logPath: opencodeHarness.logFile.path,
|
|
16102
16163
|
pluginCachePath: opencodeHarness.pluginCache.path,
|
|
16103
16164
|
cachedPluginVersion: opencodeHarness.pluginCache.cached,
|
|
16104
|
-
expectedPluginEntry: opencodeAdapter.pluginEntryWithVersion
|
|
16165
|
+
expectedPluginEntry: hostDetection.status === "v1" ? `${opencodeAdapter.pluginPackageName}@latest` : opencodeAdapter.pluginEntryWithVersion,
|
|
16166
|
+
acceptExplicitPluginVersion: hostDetection.status === "v1"
|
|
16105
16167
|
}) : null;
|
|
16106
16168
|
log2.info(`AFT CLI v${report.cliVersion}, AFT binary ${report.binaryVersion ?? "unknown"}`);
|
|
16107
16169
|
if (!report.binaryVersion) {
|
|
@@ -37,8 +37,9 @@ export interface V1VersionProbeOptions {
|
|
|
37
37
|
}
|
|
38
38
|
export declare function findExecutableOnPath(name: "opencode" | "opencode2", pathValue?: string, platform?: NodeJS.Platform): string | null;
|
|
39
39
|
/**
|
|
40
|
-
* Run the V1 version probe in disposable host roots.
|
|
41
|
-
*
|
|
40
|
+
* Run the V1 version probe in disposable host roots. CI can enable the strict
|
|
41
|
+
* operator canary used by the load matrix, while production tolerates writes
|
|
42
|
+
* from an OpenCode process that is already using the live operator store.
|
|
42
43
|
*/
|
|
43
44
|
export declare function probeOpenCodeV1Version(executable: string, options?: V1VersionProbeOptions): string | null;
|
|
44
45
|
export declare function detectOpenCodeHostGeneration(dependencies?: HostGenerationDependencies): OpenCodeHostDetection;
|
|
@@ -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,CAAC;IAC3B,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW,KAAK,MAAM,GAAG,IAAI,CAAC;IACnE,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CACxD;AAED,UAAU,WAAW;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,CACN,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;QACvB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAClC,OAAO,EAAE,MAAM,CAAC;KACjB,KACE,WAAW,CAAC;CAClB;AAOD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,UAAU,GAAG,WAAW,EAC9B,SAAS,SAAyB,EAClC,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC3C,MAAM,GAAG,IAAI,CAef;AAqID;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,qBAA0B,GAClC,MAAM,GAAG,IAAI,CA0Df;AAED,wBAAgB,4BAA4B,CAC1C,YAAY,GAAE,0BAA+B,GAC5C,qBAAqB,CAiDvB;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,qBAAqB,GAAG,MAAM,CAK9E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft",
|
|
3
|
-
"version": "0.56.
|
|
3
|
+
"version": "0.56.2",
|
|
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.2",
|
|
28
28
|
"comment-json": "^4.6.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|