@cortexkit/aft-pi 0.51.1 → 0.51.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 +65 -25
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -8613,6 +8613,13 @@ class BridgeTransportUnavailableError extends Error {
|
|
|
8613
8613
|
this.name = "BridgeTransportUnavailableError";
|
|
8614
8614
|
}
|
|
8615
8615
|
}
|
|
8616
|
+
|
|
8617
|
+
class BridgeTransportUnknownOutcomeError extends BridgeTransportUnavailableError {
|
|
8618
|
+
constructor(message, options) {
|
|
8619
|
+
super(message, options);
|
|
8620
|
+
this.name = "BridgeTransportUnknownOutcomeError";
|
|
8621
|
+
}
|
|
8622
|
+
}
|
|
8616
8623
|
function isBridgeTransportTimeout(err) {
|
|
8617
8624
|
return err instanceof Error && err.code === "transport_timeout";
|
|
8618
8625
|
}
|
|
@@ -8766,7 +8773,7 @@ class BinaryBridge {
|
|
|
8766
8773
|
this.clearRestartResetTimer();
|
|
8767
8774
|
this.configured = false;
|
|
8768
8775
|
this.outstandingBackgroundTaskIds.clear();
|
|
8769
|
-
this.rejectAllPending(error2);
|
|
8776
|
+
this.rejectAllPending(error2 instanceof BridgeTransportUnknownOutcomeError ? error2 : new BridgeTransportUnknownOutcomeError(error2.message, { cause: error2 }));
|
|
8770
8777
|
}
|
|
8771
8778
|
hasPendingRequests() {
|
|
8772
8779
|
return this.pending.size > 0;
|
|
@@ -8889,6 +8896,12 @@ class BinaryBridge {
|
|
|
8889
8896
|
if (!this.configured) {
|
|
8890
8897
|
if (command !== "configure" && command !== "version") {
|
|
8891
8898
|
if (!this._configurePromise) {
|
|
8899
|
+
const configuringChild = this.process;
|
|
8900
|
+
const requireConfiguringChild = () => {
|
|
8901
|
+
if (this.process !== configuringChild) {
|
|
8902
|
+
throw new BridgeTransportUnavailableError(`${this.errorPrefix} Bridge process changed during configure; retry on replacement`);
|
|
8903
|
+
}
|
|
8904
|
+
};
|
|
8892
8905
|
const sessionIdForConfigure = typeof params.session_id === "string" ? params.session_id : undefined;
|
|
8893
8906
|
this._configurePromise = (async () => {
|
|
8894
8907
|
try {
|
|
@@ -8897,11 +8910,14 @@ class BinaryBridge {
|
|
|
8897
8910
|
...this.configOverrides,
|
|
8898
8911
|
...sessionIdForConfigure ? { session_id: sessionIdForConfigure } : {}
|
|
8899
8912
|
}, implicitTransportOptions);
|
|
8913
|
+
requireConfiguringChild();
|
|
8900
8914
|
if (configResult.success === false) {
|
|
8901
8915
|
throw new Error(`${this.errorPrefix} Configure failed: ${configResult.message ?? "unknown error"}`);
|
|
8902
8916
|
}
|
|
8903
8917
|
await this.deliverConfigureWarnings(configResult, params, options);
|
|
8918
|
+
requireConfiguringChild();
|
|
8904
8919
|
await this.checkVersion(implicitTransportOptions);
|
|
8920
|
+
requireConfiguringChild();
|
|
8905
8921
|
if (!this.isAlive()) {
|
|
8906
8922
|
throw new BridgeTransportUnavailableError(`${this.errorPrefix} Bridge died during version check. Check logs: ${this.getLogFilePathVia()}`);
|
|
8907
8923
|
}
|
|
@@ -8980,19 +8996,26 @@ class BinaryBridge {
|
|
|
8980
8996
|
return;
|
|
8981
8997
|
}
|
|
8982
8998
|
requestSentAt = Date.now();
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
}
|
|
8992
|
-
if (this.process === child)
|
|
8993
|
-
this.invalidateTransportProcess(error2);
|
|
8999
|
+
const handleWriteFailure = (cause) => {
|
|
9000
|
+
const writeError = cause instanceof Error ? cause : new Error(String(cause));
|
|
9001
|
+
const error2 = new BridgeTransportUnknownOutcomeError(`${this.errorPrefix} Failed to write to stdin: ${writeError.message}`, { cause: writeError });
|
|
9002
|
+
const entry = this.pending.get(id);
|
|
9003
|
+
if (entry) {
|
|
9004
|
+
this.pending.delete(id);
|
|
9005
|
+
clearTimeout(entry.timer);
|
|
9006
|
+
entry.reject(error2);
|
|
8994
9007
|
}
|
|
8995
|
-
|
|
9008
|
+
if (this.process === child)
|
|
9009
|
+
this.invalidateTransportProcess(error2);
|
|
9010
|
+
};
|
|
9011
|
+
try {
|
|
9012
|
+
child.stdin.write(line, (err) => {
|
|
9013
|
+
if (err)
|
|
9014
|
+
handleWriteFailure(err);
|
|
9015
|
+
});
|
|
9016
|
+
} catch (err) {
|
|
9017
|
+
handleWriteFailure(err);
|
|
9018
|
+
}
|
|
8996
9019
|
});
|
|
8997
9020
|
if (command === "configure" && response.success === true && options?.markConfiguredOnSuccess !== false) {
|
|
8998
9021
|
this.configured = true;
|
|
@@ -9207,9 +9230,13 @@ class BinaryBridge {
|
|
|
9207
9230
|
const currentChild = child;
|
|
9208
9231
|
const stdoutDecoder = new StringDecoder("utf8");
|
|
9209
9232
|
child.stdout?.on("data", (chunk) => {
|
|
9233
|
+
if (this.process !== currentChild)
|
|
9234
|
+
return;
|
|
9210
9235
|
this.onStdoutData(stdoutDecoder.write(chunk));
|
|
9211
9236
|
});
|
|
9212
9237
|
child.stdout?.on("end", () => {
|
|
9238
|
+
if (this.process !== currentChild)
|
|
9239
|
+
return;
|
|
9213
9240
|
const remaining = stdoutDecoder.end();
|
|
9214
9241
|
if (remaining)
|
|
9215
9242
|
this.onStdoutData(remaining);
|
|
@@ -9217,9 +9244,13 @@ class BinaryBridge {
|
|
|
9217
9244
|
});
|
|
9218
9245
|
const stderrDecoder = new StringDecoder("utf8");
|
|
9219
9246
|
child.stderr?.on("data", (chunk) => {
|
|
9247
|
+
if (this.process !== currentChild)
|
|
9248
|
+
return;
|
|
9220
9249
|
this.onStderrData(stderrDecoder.write(chunk));
|
|
9221
9250
|
});
|
|
9222
9251
|
child.stderr?.on("end", () => {
|
|
9252
|
+
if (this.process !== currentChild)
|
|
9253
|
+
return;
|
|
9223
9254
|
const remaining = stderrDecoder.end();
|
|
9224
9255
|
if (remaining)
|
|
9225
9256
|
this.onStderrData(remaining);
|
|
@@ -9242,7 +9273,7 @@ class BinaryBridge {
|
|
|
9242
9273
|
this.process = null;
|
|
9243
9274
|
this.configured = false;
|
|
9244
9275
|
this.clearRestartResetTimer();
|
|
9245
|
-
this.rejectAllPending(new
|
|
9276
|
+
this.rejectAllPending(new BridgeTransportUnknownOutcomeError(`${this.errorPrefix} Binary killed by ${signal}`));
|
|
9246
9277
|
return;
|
|
9247
9278
|
}
|
|
9248
9279
|
this.handleCrash();
|
|
@@ -9420,7 +9451,7 @@ class BinaryBridge {
|
|
|
9420
9451
|
handleTimeout(triggeringSessionId) {
|
|
9421
9452
|
this.consecutiveRequestTimeouts = 0;
|
|
9422
9453
|
this.spawnedBinaryFingerprint = null;
|
|
9423
|
-
this.rejectAllPending(new
|
|
9454
|
+
this.rejectAllPending(new BridgeTransportUnknownOutcomeError(`${this.errorPrefix} bridge killed during sibling timeout — request aborted`));
|
|
9424
9455
|
this.outstandingBackgroundTaskIds.clear();
|
|
9425
9456
|
if (this.process) {
|
|
9426
9457
|
this.process.kill("SIGKILL");
|
|
@@ -9457,7 +9488,7 @@ class BinaryBridge {
|
|
|
9457
9488
|
if (tail) {
|
|
9458
9489
|
this.errorVia(`Binary crashed (restarts: ${this._restartCount})${cause ? `: ${cause.message}` : ""}.${tail}`);
|
|
9459
9490
|
}
|
|
9460
|
-
this.rejectAllPending(new
|
|
9491
|
+
this.rejectAllPending(new BridgeTransportUnknownOutcomeError(`${this.errorPrefix} Binary crashed (restarts: ${this._restartCount})${cause ? `: ${cause.message}` : ""} (see ${this.getLogFilePathVia()})`, { cause }));
|
|
9461
9492
|
if (this._retiringDueToBinaryChange) {
|
|
9462
9493
|
this.logVia("Binary exited while retiring after an on-disk update; skipping auto-restart");
|
|
9463
9494
|
return;
|
|
@@ -14364,6 +14395,7 @@ function toolErrorFromResponse(command, response) {
|
|
|
14364
14395
|
}
|
|
14365
14396
|
var BASH_TRANSPORT_DISPOSITION = "The transport to the AFT daemon was interrupted; no background task was created for this command and no task ID exists. Re-run the command. Do not poll bash_status for it.";
|
|
14366
14397
|
var SUBC_MODULE_RESTART_DISPOSITION = "The AFT daemon module restarted while this call was in flight, so its outcome is UNKNOWN: it may or may not have executed. Verify actual state before re-running, and never blind-retry a mutation.";
|
|
14398
|
+
var BRIDGE_TRANSPORT_UNKNOWN_OUTCOME_DISPOSITION = "The standalone AFT transport failed after this call may have been sent, so its outcome is UNKNOWN: it may or may not have executed. Verify actual state before re-running, and never blind-retry a mutation.";
|
|
14367
14399
|
function isRouteGoodbyeError(error2) {
|
|
14368
14400
|
if (!(error2 instanceof SubcError))
|
|
14369
14401
|
return false;
|
|
@@ -14386,6 +14418,8 @@ function isBashTransportDeadError(error2) {
|
|
|
14386
14418
|
if (!(error2 instanceof Error) || hasEngineResponse(error2) || isRouteGoodbyeError(error2)) {
|
|
14387
14419
|
return false;
|
|
14388
14420
|
}
|
|
14421
|
+
if (error2 instanceof BridgeTransportUnknownOutcomeError)
|
|
14422
|
+
return false;
|
|
14389
14423
|
return error2 instanceof BridgeTransportUnavailableError || error2 instanceof SubcTransportShuttingDownError || isConsumerReconnectTransient(error2) || error2 instanceof StaleRouteHandleError || error2 instanceof SubcRootGenerationExpiredError || error2 instanceof SubcRootReapedError;
|
|
14390
14424
|
}
|
|
14391
14425
|
function isTransportClassError(error2) {
|
|
@@ -14394,6 +14428,12 @@ function isTransportClassError(error2) {
|
|
|
14394
14428
|
function adaptToolError(command, error2) {
|
|
14395
14429
|
if (!(error2 instanceof Error))
|
|
14396
14430
|
return error2;
|
|
14431
|
+
if (error2 instanceof BridgeTransportUnknownOutcomeError) {
|
|
14432
|
+
if (error2.message.includes(BRIDGE_TRANSPORT_UNKNOWN_OUTCOME_DISPOSITION))
|
|
14433
|
+
return error2;
|
|
14434
|
+
error2.message = error2.message ? `${error2.message} ${BRIDGE_TRANSPORT_UNKNOWN_OUTCOME_DISPOSITION}` : BRIDGE_TRANSPORT_UNKNOWN_OUTCOME_DISPOSITION;
|
|
14435
|
+
return error2;
|
|
14436
|
+
}
|
|
14397
14437
|
if (isRouteGoodbyeError(error2)) {
|
|
14398
14438
|
if (error2.message.includes(SUBC_MODULE_RESTART_DISPOSITION))
|
|
14399
14439
|
return error2;
|
|
@@ -17977,7 +18017,7 @@ import {
|
|
|
17977
18017
|
// package.json
|
|
17978
18018
|
var package_default = {
|
|
17979
18019
|
name: "@cortexkit/aft-pi",
|
|
17980
|
-
version: "0.51.
|
|
18020
|
+
version: "0.51.2",
|
|
17981
18021
|
type: "module",
|
|
17982
18022
|
description: "Pi coding agent extension for Agent File Tools (AFT) — tree-sitter and LSP-powered code analysis",
|
|
17983
18023
|
main: "dist/index.js",
|
|
@@ -18000,19 +18040,19 @@ var package_default = {
|
|
|
18000
18040
|
"test:unit": "bun test src/__tests__ --path-ignore-patterns 'src/__tests__/e2e/**'"
|
|
18001
18041
|
},
|
|
18002
18042
|
dependencies: {
|
|
18003
|
-
"@cortexkit/aft-bridge": "0.51.
|
|
18043
|
+
"@cortexkit/aft-bridge": "0.51.2",
|
|
18004
18044
|
"comment-json": "^5.0.0",
|
|
18005
18045
|
diff: "^8.0.4",
|
|
18006
18046
|
typebox: "1.1.38",
|
|
18007
18047
|
zod: "^4.4.3"
|
|
18008
18048
|
},
|
|
18009
18049
|
optionalDependencies: {
|
|
18010
|
-
"@cortexkit/aft-darwin-arm64": "0.51.
|
|
18011
|
-
"@cortexkit/aft-darwin-x64": "0.51.
|
|
18012
|
-
"@cortexkit/aft-linux-arm64": "0.51.
|
|
18013
|
-
"@cortexkit/aft-linux-x64": "0.51.
|
|
18014
|
-
"@cortexkit/aft-win32-arm64": "0.51.
|
|
18015
|
-
"@cortexkit/aft-win32-x64": "0.51.
|
|
18050
|
+
"@cortexkit/aft-darwin-arm64": "0.51.2",
|
|
18051
|
+
"@cortexkit/aft-darwin-x64": "0.51.2",
|
|
18052
|
+
"@cortexkit/aft-linux-arm64": "0.51.2",
|
|
18053
|
+
"@cortexkit/aft-linux-x64": "0.51.2",
|
|
18054
|
+
"@cortexkit/aft-win32-arm64": "0.51.2",
|
|
18055
|
+
"@cortexkit/aft-win32-x64": "0.51.2"
|
|
18016
18056
|
},
|
|
18017
18057
|
devDependencies: {
|
|
18018
18058
|
"@earendil-works/pi-coding-agent": "^0.80.2",
|
|
@@ -39275,7 +39315,7 @@ var PLUGIN_VERSION = (() => {
|
|
|
39275
39315
|
return "0.0.0";
|
|
39276
39316
|
}
|
|
39277
39317
|
})();
|
|
39278
|
-
var ANNOUNCEMENT_VERSION = "0.51.
|
|
39318
|
+
var ANNOUNCEMENT_VERSION = "0.51.2";
|
|
39279
39319
|
var ANNOUNCEMENT_FEATURES = [
|
|
39280
39320
|
"Callgraph stays consistent under load: edits arriving mid-rebuild can no longer be silently lost from navigation results.",
|
|
39281
39321
|
"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-pi",
|
|
3
|
-
"version": "0.51.
|
|
3
|
+
"version": "0.51.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Pi coding agent extension for Agent File Tools (AFT) — tree-sitter and LSP-powered code analysis",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,19 +23,19 @@
|
|
|
23
23
|
"test:unit": "bun test src/__tests__ --path-ignore-patterns 'src/__tests__/e2e/**'"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@cortexkit/aft-bridge": "0.51.
|
|
26
|
+
"@cortexkit/aft-bridge": "0.51.2",
|
|
27
27
|
"comment-json": "^5.0.0",
|
|
28
28
|
"diff": "^8.0.4",
|
|
29
29
|
"typebox": "1.1.38",
|
|
30
30
|
"zod": "^4.4.3"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@cortexkit/aft-darwin-arm64": "0.51.
|
|
34
|
-
"@cortexkit/aft-darwin-x64": "0.51.
|
|
35
|
-
"@cortexkit/aft-linux-arm64": "0.51.
|
|
36
|
-
"@cortexkit/aft-linux-x64": "0.51.
|
|
37
|
-
"@cortexkit/aft-win32-arm64": "0.51.
|
|
38
|
-
"@cortexkit/aft-win32-x64": "0.51.
|
|
33
|
+
"@cortexkit/aft-darwin-arm64": "0.51.2",
|
|
34
|
+
"@cortexkit/aft-darwin-x64": "0.51.2",
|
|
35
|
+
"@cortexkit/aft-linux-arm64": "0.51.2",
|
|
36
|
+
"@cortexkit/aft-linux-x64": "0.51.2",
|
|
37
|
+
"@cortexkit/aft-win32-arm64": "0.51.2",
|
|
38
|
+
"@cortexkit/aft-win32-x64": "0.51.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@earendil-works/pi-coding-agent": "^0.80.2",
|