@cortexkit/aft-pi 0.25.2 → 0.26.0
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.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +188 -102
- package/dist/lsp-auto-install.d.ts +1 -1
- package/dist/lsp-auto-install.d.ts.map +1 -1
- package/dist/tools/fs.d.ts.map +1 -1
- package/dist/tools/imports.d.ts +1 -1
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
*/
|
|
32
32
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
33
33
|
import { type AftConfig, loadAftConfig } from "./config.js";
|
|
34
|
+
type VersionMismatchPool = {
|
|
35
|
+
replaceBinary(path: string): Promise<string>;
|
|
36
|
+
};
|
|
37
|
+
declare function createVersionMismatchHandler(getPool: () => VersionMismatchPool | undefined, ensureCompatibleBinary?: (version?: string) => Promise<string | null>): (binaryVersion: string, minVersion: string) => Promise<string | null>;
|
|
34
38
|
declare function shouldPrepareOnnxRuntime(config: Pick<AftConfig, "semantic_search" | "semantic">): boolean;
|
|
35
39
|
declare function handleConfigureWarningsForSession(context: {
|
|
36
40
|
projectRoot: string;
|
|
@@ -80,6 +84,7 @@ export declare const __test__: {
|
|
|
80
84
|
resolveToolSurface: typeof resolveToolSurface;
|
|
81
85
|
handleConfigureWarningsForSession: typeof handleConfigureWarningsForSession;
|
|
82
86
|
shouldPrepareOnnxRuntime: typeof shouldPrepareOnnxRuntime;
|
|
87
|
+
createVersionMismatchHandler: typeof createVersionMismatchHandler;
|
|
83
88
|
};
|
|
84
89
|
export {};
|
|
85
90
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;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AS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAiEA;AAED;;;;GAIG;AACH,yBAA+B,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA+Z9D;AAED,eAAO,MAAM,QAAQ;;;;;CAKpB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -30601,6 +30601,15 @@ function clampSemanticTimeout(configOverrides, bridgeTimeoutMs) {
|
|
|
30601
30601
|
};
|
|
30602
30602
|
}
|
|
30603
30603
|
|
|
30604
|
+
class BridgeReplacedDuringVersionCheck extends Error {
|
|
30605
|
+
newBinaryPath;
|
|
30606
|
+
constructor(newBinaryPath) {
|
|
30607
|
+
super(`Bridge binary replaced during version check: ${newBinaryPath}`);
|
|
30608
|
+
this.newBinaryPath = newBinaryPath;
|
|
30609
|
+
this.name = "BridgeReplacedDuringVersionCheck";
|
|
30610
|
+
}
|
|
30611
|
+
}
|
|
30612
|
+
|
|
30604
30613
|
class BinaryBridge {
|
|
30605
30614
|
static RESTART_RESET_MS = 5 * 60 * 1000;
|
|
30606
30615
|
static STDERR_TAIL_MAX = 20;
|
|
@@ -30689,97 +30698,108 @@ class BinaryBridge {
|
|
|
30689
30698
|
this.cachedStatus = snapshot;
|
|
30690
30699
|
}
|
|
30691
30700
|
async send(command, params = {}, options) {
|
|
30692
|
-
|
|
30693
|
-
|
|
30694
|
-
|
|
30695
|
-
|
|
30696
|
-
|
|
30697
|
-
|
|
30698
|
-
|
|
30699
|
-
|
|
30700
|
-
|
|
30701
|
-
|
|
30702
|
-
|
|
30703
|
-
|
|
30704
|
-
if (
|
|
30705
|
-
|
|
30706
|
-
|
|
30707
|
-
|
|
30708
|
-
|
|
30709
|
-
|
|
30710
|
-
|
|
30711
|
-
|
|
30712
|
-
|
|
30713
|
-
|
|
30714
|
-
|
|
30715
|
-
|
|
30716
|
-
|
|
30717
|
-
|
|
30718
|
-
|
|
30719
|
-
|
|
30720
|
-
|
|
30701
|
+
return this.sendWithVersionMismatchRetry(command, params, options, true);
|
|
30702
|
+
}
|
|
30703
|
+
async sendWithVersionMismatchRetry(command, params, options, canRetryAfterVersionSwap) {
|
|
30704
|
+
try {
|
|
30705
|
+
if (this._shuttingDown) {
|
|
30706
|
+
throw new Error(`${this.errorPrefix} Bridge is shutting down, cannot send "${command}"`);
|
|
30707
|
+
}
|
|
30708
|
+
if (Object.hasOwn(params, "id")) {
|
|
30709
|
+
throw new Error("params cannot contain reserved key 'id'");
|
|
30710
|
+
}
|
|
30711
|
+
const requestSessionId = typeof params.session_id === "string" && params.session_id.length > 0 ? params.session_id : undefined;
|
|
30712
|
+
this.ensureSpawned(requestSessionId);
|
|
30713
|
+
if (requestSessionId && options?.configureWarningClient !== undefined) {
|
|
30714
|
+
this.configureWarningClients.set(requestSessionId, options.configureWarningClient);
|
|
30715
|
+
}
|
|
30716
|
+
if (!this.configured) {
|
|
30717
|
+
if (command !== "configure" && command !== "version") {
|
|
30718
|
+
if (!this._configurePromise) {
|
|
30719
|
+
const sessionIdForConfigure = typeof params.session_id === "string" ? params.session_id : undefined;
|
|
30720
|
+
this._configurePromise = (async () => {
|
|
30721
|
+
try {
|
|
30722
|
+
const configResult = await this.send("configure", {
|
|
30723
|
+
project_root: this.cwd,
|
|
30724
|
+
...this.configOverrides,
|
|
30725
|
+
...sessionIdForConfigure ? { session_id: sessionIdForConfigure } : {}
|
|
30726
|
+
});
|
|
30727
|
+
if (configResult.success === false) {
|
|
30728
|
+
throw new Error(`${this.errorPrefix} Configure failed: ${configResult.message ?? "unknown error"}`);
|
|
30729
|
+
}
|
|
30730
|
+
await this.deliverConfigureWarnings(configResult, params, options);
|
|
30731
|
+
await this.checkVersion();
|
|
30732
|
+
if (!this.isAlive()) {
|
|
30733
|
+
throw new Error(`${this.errorPrefix} Bridge died during version check. Check logs: ${getLogFilePath()}`);
|
|
30734
|
+
}
|
|
30735
|
+
this.configured = true;
|
|
30736
|
+
} finally {
|
|
30737
|
+
this._configurePromise = null;
|
|
30721
30738
|
}
|
|
30722
|
-
|
|
30723
|
-
|
|
30724
|
-
|
|
30725
|
-
}
|
|
30726
|
-
})();
|
|
30739
|
+
})();
|
|
30740
|
+
}
|
|
30741
|
+
await this._configurePromise;
|
|
30727
30742
|
}
|
|
30728
|
-
await this._configurePromise;
|
|
30729
30743
|
}
|
|
30730
|
-
|
|
30731
|
-
|
|
30732
|
-
|
|
30733
|
-
|
|
30734
|
-
|
|
30735
|
-
|
|
30736
|
-
|
|
30737
|
-
|
|
30738
|
-
|
|
30739
|
-
|
|
30744
|
+
const id = String(this.nextId++);
|
|
30745
|
+
let request;
|
|
30746
|
+
if (Object.hasOwn(params, "command") || Object.hasOwn(params, "method")) {
|
|
30747
|
+
const nested = { ...params };
|
|
30748
|
+
const reserved = {};
|
|
30749
|
+
for (const key of ["session_id", "lsp_hints"]) {
|
|
30750
|
+
if (Object.hasOwn(nested, key)) {
|
|
30751
|
+
reserved[key] = nested[key];
|
|
30752
|
+
delete nested[key];
|
|
30753
|
+
}
|
|
30740
30754
|
}
|
|
30755
|
+
request = { id, command, ...reserved, params: nested };
|
|
30756
|
+
} else {
|
|
30757
|
+
request = { id, command, ...params };
|
|
30741
30758
|
}
|
|
30742
|
-
|
|
30743
|
-
} else {
|
|
30744
|
-
request = { id, command, ...params };
|
|
30745
|
-
}
|
|
30746
|
-
const line = `${JSON.stringify(request)}
|
|
30759
|
+
const line = `${JSON.stringify(request)}
|
|
30747
30760
|
`;
|
|
30748
|
-
|
|
30749
|
-
|
|
30750
|
-
|
|
30751
|
-
|
|
30752
|
-
|
|
30753
|
-
|
|
30754
|
-
|
|
30755
|
-
|
|
30756
|
-
|
|
30757
|
-
|
|
30758
|
-
|
|
30759
|
-
|
|
30760
|
-
|
|
30761
|
-
|
|
30762
|
-
|
|
30763
|
-
}
|
|
30764
|
-
}, effectiveTimeoutMs);
|
|
30765
|
-
this.pending.set(id, { resolve, reject, timer, onProgress: options?.onProgress });
|
|
30766
|
-
if (!this.process?.stdin?.writable) {
|
|
30767
|
-
this.pending.delete(id);
|
|
30768
|
-
clearTimeout(timer);
|
|
30769
|
-
reject(new Error(`${this.errorPrefix} stdin not writable for command "${command}"`));
|
|
30770
|
-
return;
|
|
30771
|
-
}
|
|
30772
|
-
this.process.stdin.write(line, (err) => {
|
|
30773
|
-
if (err) {
|
|
30774
|
-
const entry = this.pending.get(id);
|
|
30775
|
-
if (entry) {
|
|
30776
|
-
this.pending.delete(id);
|
|
30777
|
-
clearTimeout(entry.timer);
|
|
30778
|
-
entry.reject(new Error(`${this.errorPrefix} Failed to write to stdin: ${err.message}`));
|
|
30761
|
+
const effectiveTimeoutMs = options?.transportTimeoutMs ?? options?.timeoutMs ?? this.timeoutMs;
|
|
30762
|
+
const keepBridgeOnTimeout = options?.keepBridgeOnTimeout === true;
|
|
30763
|
+
return new Promise((resolve, reject) => {
|
|
30764
|
+
const timer = setTimeout(() => {
|
|
30765
|
+
this.pending.delete(id);
|
|
30766
|
+
const restartSuffix = keepBridgeOnTimeout ? "" : " — restarting bridge";
|
|
30767
|
+
const timeoutMsg = `Request "${command}" (id=${id}) timed out after ${effectiveTimeoutMs}ms${restartSuffix}`;
|
|
30768
|
+
if (requestSessionId) {
|
|
30769
|
+
sessionWarn(requestSessionId, timeoutMsg);
|
|
30770
|
+
} else {
|
|
30771
|
+
warn(timeoutMsg);
|
|
30772
|
+
}
|
|
30773
|
+
reject(new Error(`${this.errorPrefix} Request "${command}" (id=${id}) timed out after ${effectiveTimeoutMs}ms`));
|
|
30774
|
+
if (!keepBridgeOnTimeout) {
|
|
30775
|
+
this.handleTimeout(requestSessionId);
|
|
30779
30776
|
}
|
|
30777
|
+
}, effectiveTimeoutMs);
|
|
30778
|
+
this.pending.set(id, { resolve, reject, timer, onProgress: options?.onProgress });
|
|
30779
|
+
if (!this.process?.stdin?.writable) {
|
|
30780
|
+
this.pending.delete(id);
|
|
30781
|
+
clearTimeout(timer);
|
|
30782
|
+
reject(new Error(`${this.errorPrefix} stdin not writable for command "${command}"`));
|
|
30783
|
+
return;
|
|
30780
30784
|
}
|
|
30785
|
+
this.process.stdin.write(line, (err) => {
|
|
30786
|
+
if (err) {
|
|
30787
|
+
const entry = this.pending.get(id);
|
|
30788
|
+
if (entry) {
|
|
30789
|
+
this.pending.delete(id);
|
|
30790
|
+
clearTimeout(entry.timer);
|
|
30791
|
+
entry.reject(new Error(`${this.errorPrefix} Failed to write to stdin: ${err.message}`));
|
|
30792
|
+
}
|
|
30793
|
+
}
|
|
30794
|
+
});
|
|
30781
30795
|
});
|
|
30782
|
-
})
|
|
30796
|
+
} catch (err) {
|
|
30797
|
+
if (err instanceof BridgeReplacedDuringVersionCheck && canRetryAfterVersionSwap && command !== "configure" && command !== "version") {
|
|
30798
|
+
log(`Retrying request "${command}" once after coordinated binary replacement: ${err.newBinaryPath}`);
|
|
30799
|
+
return this.sendWithVersionMismatchRetry(command, params, options, false);
|
|
30800
|
+
}
|
|
30801
|
+
throw err;
|
|
30802
|
+
}
|
|
30783
30803
|
}
|
|
30784
30804
|
async deliverConfigureWarnings(configResult, params, options) {
|
|
30785
30805
|
if (!this.onConfigureWarnings || !Array.isArray(configResult.warnings))
|
|
@@ -30878,13 +30898,43 @@ class BinaryBridge {
|
|
|
30878
30898
|
log(`Binary version: ${binaryVersion}`);
|
|
30879
30899
|
if (compareSemver(binaryVersion, this.minVersion) < 0) {
|
|
30880
30900
|
warn(`Binary version ${binaryVersion} is older than required ${this.minVersion}`);
|
|
30881
|
-
this.onVersionMismatch?.(binaryVersion, this.minVersion);
|
|
30901
|
+
const replacementPath = await this.onVersionMismatch?.(binaryVersion, this.minVersion);
|
|
30902
|
+
if (replacementPath === undefined) {
|
|
30903
|
+
return;
|
|
30904
|
+
}
|
|
30905
|
+
if (replacementPath === null || replacementPath.length === 0) {
|
|
30906
|
+
throw new Error(`Binary version ${binaryVersion} is older than required ${this.minVersion}; no compatible replacement binary was provided`);
|
|
30907
|
+
}
|
|
30908
|
+
await this.replaceCurrentBinary(replacementPath);
|
|
30909
|
+
throw new BridgeReplacedDuringVersionCheck(replacementPath);
|
|
30882
30910
|
}
|
|
30883
30911
|
} catch (err) {
|
|
30884
30912
|
warn(`Version check failed: ${err.message}`);
|
|
30885
30913
|
throw err;
|
|
30886
30914
|
}
|
|
30887
30915
|
}
|
|
30916
|
+
async replaceCurrentBinary(newBinaryPath) {
|
|
30917
|
+
this.binaryPath = newBinaryPath;
|
|
30918
|
+
this.configured = false;
|
|
30919
|
+
this.clearRestartResetTimer();
|
|
30920
|
+
this.rejectAllPending(new Error(`${this.errorPrefix} Bridge restarting with updated binary: ${newBinaryPath}`));
|
|
30921
|
+
if (!this.process)
|
|
30922
|
+
return;
|
|
30923
|
+
const proc = this.process;
|
|
30924
|
+
this.process = null;
|
|
30925
|
+
await new Promise((resolve) => {
|
|
30926
|
+
const forceKillTimer = setTimeout(() => {
|
|
30927
|
+
proc.kill("SIGKILL");
|
|
30928
|
+
resolve();
|
|
30929
|
+
}, 5000);
|
|
30930
|
+
proc.once("exit", () => {
|
|
30931
|
+
clearTimeout(forceKillTimer);
|
|
30932
|
+
log("Process exited during coordinated binary replacement");
|
|
30933
|
+
resolve();
|
|
30934
|
+
});
|
|
30935
|
+
proc.kill("SIGTERM");
|
|
30936
|
+
});
|
|
30937
|
+
}
|
|
30888
30938
|
ensureSpawned(triggeringSessionId) {
|
|
30889
30939
|
if (this.isAlive())
|
|
30890
30940
|
return;
|
|
@@ -31969,6 +32019,7 @@ class BridgePool {
|
|
|
31969
32019
|
this.bridges.clear();
|
|
31970
32020
|
await Promise.allSettled(shutdowns);
|
|
31971
32021
|
this.log(`Binary path updated to ${newPath}. All bridges cleared — next calls will use the new binary.`);
|
|
32022
|
+
return newPath;
|
|
31972
32023
|
}
|
|
31973
32024
|
log(message, meta) {
|
|
31974
32025
|
const logger = this.logger ?? getActiveLogger();
|
|
@@ -32019,7 +32070,9 @@ function readBinaryVersion(binaryPath) {
|
|
|
32019
32070
|
stdio: ["pipe", "pipe", "pipe"],
|
|
32020
32071
|
timeout: 5000
|
|
32021
32072
|
});
|
|
32022
|
-
const
|
|
32073
|
+
const stdoutVersion = result.stdout?.trim();
|
|
32074
|
+
const stderrVersion = result.stderr?.trim();
|
|
32075
|
+
const rawVersion = stdoutVersion || stderrVersion;
|
|
32023
32076
|
if (!rawVersion)
|
|
32024
32077
|
return null;
|
|
32025
32078
|
return rawVersion.replace(/^aft\s+/, "");
|
|
@@ -32498,6 +32551,7 @@ async function fetchUrlToTempFile(url, storageDir, options = {}) {
|
|
|
32498
32551
|
throw new Error(`Only http:// and https:// URLs are supported, got: ${parsed.protocol}`);
|
|
32499
32552
|
}
|
|
32500
32553
|
const allowPrivate = options.allowPrivate === true;
|
|
32554
|
+
await assertPublicUrl(parsed, allowPrivate, options.lookup);
|
|
32501
32555
|
const dir = cacheDir(storageDir);
|
|
32502
32556
|
mkdirSync4(dir, { recursive: true });
|
|
32503
32557
|
const hash = hashUrl(url);
|
|
@@ -33001,7 +33055,7 @@ import {
|
|
|
33001
33055
|
// package.json
|
|
33002
33056
|
var package_default = {
|
|
33003
33057
|
name: "@cortexkit/aft-pi",
|
|
33004
|
-
version: "0.
|
|
33058
|
+
version: "0.26.0",
|
|
33005
33059
|
type: "module",
|
|
33006
33060
|
description: "Pi coding agent extension for Agent File Tools (AFT) — tree-sitter and LSP-powered code analysis",
|
|
33007
33061
|
main: "dist/index.js",
|
|
@@ -33023,18 +33077,18 @@ var package_default = {
|
|
|
33023
33077
|
prepublishOnly: "bun run build"
|
|
33024
33078
|
},
|
|
33025
33079
|
dependencies: {
|
|
33026
|
-
"@cortexkit/aft-bridge": "0.
|
|
33080
|
+
"@cortexkit/aft-bridge": "0.26.0",
|
|
33027
33081
|
typebox: "^1.1.24",
|
|
33028
33082
|
"comment-json": "^5.0.0",
|
|
33029
33083
|
diff: "^8.0.4",
|
|
33030
33084
|
zod: "^4.1.8"
|
|
33031
33085
|
},
|
|
33032
33086
|
optionalDependencies: {
|
|
33033
|
-
"@cortexkit/aft-darwin-arm64": "0.
|
|
33034
|
-
"@cortexkit/aft-darwin-x64": "0.
|
|
33035
|
-
"@cortexkit/aft-linux-arm64": "0.
|
|
33036
|
-
"@cortexkit/aft-linux-x64": "0.
|
|
33037
|
-
"@cortexkit/aft-win32-x64": "0.
|
|
33087
|
+
"@cortexkit/aft-darwin-arm64": "0.26.0",
|
|
33088
|
+
"@cortexkit/aft-darwin-x64": "0.26.0",
|
|
33089
|
+
"@cortexkit/aft-linux-arm64": "0.26.0",
|
|
33090
|
+
"@cortexkit/aft-linux-x64": "0.26.0",
|
|
33091
|
+
"@cortexkit/aft-win32-x64": "0.26.0"
|
|
33038
33092
|
},
|
|
33039
33093
|
devDependencies: {
|
|
33040
33094
|
"@earendil-works/pi-coding-agent": "*",
|
|
@@ -48050,8 +48104,9 @@ function runInstall(spec, version2, cwd, signal) {
|
|
|
48050
48104
|
resolve2(false);
|
|
48051
48105
|
return;
|
|
48052
48106
|
}
|
|
48053
|
-
const child = spawn2("
|
|
48054
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
48107
|
+
const child = spawn2("npm", ["install", "--no-save", "--ignore-scripts", "--silent", target], {
|
|
48108
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
48109
|
+
cwd
|
|
48055
48110
|
});
|
|
48056
48111
|
child.unref();
|
|
48057
48112
|
let stderrBuf = "";
|
|
@@ -50099,12 +50154,10 @@ function registerFsTools(pi, ctx, surface) {
|
|
|
50099
50154
|
parameters: DeleteParams,
|
|
50100
50155
|
async execute(_toolCallId, params, _signal, _onUpdate, extCtx) {
|
|
50101
50156
|
const bridge = bridgeFor(ctx, extCtx.cwd);
|
|
50102
|
-
const
|
|
50103
|
-
const response = await bridge.send("delete_file", {
|
|
50157
|
+
const response = await callBridge(bridge, "delete_file", {
|
|
50104
50158
|
files: params.files,
|
|
50105
|
-
recursive: params.recursive === true
|
|
50106
|
-
|
|
50107
|
-
});
|
|
50159
|
+
recursive: params.recursive === true
|
|
50160
|
+
}, extCtx);
|
|
50108
50161
|
const deletedEntries = response.deleted ?? [];
|
|
50109
50162
|
const skipped = response.skipped_files ?? [];
|
|
50110
50163
|
const deleted = deletedEntries.map((entry) => entry.file);
|
|
@@ -51736,7 +51789,7 @@ function buildWorkflowHints(opts) {
|
|
|
51736
51789
|
const hasNavigate = opts.toolSurface === "all" && !opts.absentTools.has("aft_navigate");
|
|
51737
51790
|
const hasBgBash = opts.bashBackgroundEnabled && !opts.absentTools.has(bashName) && !opts.absentTools.has("bash_status");
|
|
51738
51791
|
if (hasOutline && hasZoom) {
|
|
51739
|
-
sections.push(`**Web/URL access**: \`aft_outline({ url })\` first for structure, then \`aft_zoom({ url, symbol: "<heading>" })\` for the specific section.`);
|
|
51792
|
+
sections.push(`**Web/URL access**: \`aft_outline({ target: "<url>" })\` first for structure, then \`aft_zoom({ target: "<url>", symbol: "<heading>" })\` for the specific section.`);
|
|
51740
51793
|
}
|
|
51741
51794
|
if (hasOutline && hasZoom && (hasGrep || hasSearch)) {
|
|
51742
51795
|
const locator = hasGrep ? `\`${grepName}\`` : "`aft_search`";
|
|
@@ -51753,7 +51806,7 @@ function buildWorkflowHints(opts) {
|
|
|
51753
51806
|
`));
|
|
51754
51807
|
}
|
|
51755
51808
|
if (hasBgBash) {
|
|
51756
|
-
sections.push(`**Long-running commands** (builds, installs, full test suites): \`${bashName}({ background: true })\` returns immediately with a \`
|
|
51809
|
+
sections.push(`**Long-running commands** (builds, installs, full test suites): \`${bashName}({ background: true })\` returns immediately with a \`task_id\`. A completion reminder is delivered automatically — do not poll \`bash_status({ task_id })\`. Use \`bash_status\` only after the reminder arrives, or to inspect a task you already know is complete.`);
|
|
51757
51810
|
}
|
|
51758
51811
|
if (sections.length === 0) {
|
|
51759
51812
|
return null;
|
|
@@ -51802,6 +51855,36 @@ ${hintsBlock}` };
|
|
|
51802
51855
|
|
|
51803
51856
|
// src/index.ts
|
|
51804
51857
|
setActiveLogger(bridgeLogger);
|
|
51858
|
+
function createVersionMismatchHandler(getPool, ensureCompatibleBinary = ensureBinary) {
|
|
51859
|
+
let versionUpgradeAttempted = null;
|
|
51860
|
+
return async (binaryVersion, minVersion) => {
|
|
51861
|
+
if (versionUpgradeAttempted === binaryVersion) {
|
|
51862
|
+
log2(`Version ${binaryVersion} < ${minVersion} but upgrade already attempted — continuing`);
|
|
51863
|
+
return null;
|
|
51864
|
+
}
|
|
51865
|
+
versionUpgradeAttempted = binaryVersion;
|
|
51866
|
+
warn2(`WARNING: aft binary v${binaryVersion} is older than plugin v${minVersion}. ` + "Some features may not work. Attempting to download a compatible binary...");
|
|
51867
|
+
try {
|
|
51868
|
+
const path2 = await ensureCompatibleBinary(`v${minVersion}`);
|
|
51869
|
+
if (!path2) {
|
|
51870
|
+
warn2(`Could not find or download v${minVersion}. Continuing with v${binaryVersion}.`);
|
|
51871
|
+
return null;
|
|
51872
|
+
}
|
|
51873
|
+
const pool = getPool();
|
|
51874
|
+
if (!pool) {
|
|
51875
|
+
warn2(`Found/downloaded compatible binary at ${path2}, but bridge pool is not ready.`);
|
|
51876
|
+
return null;
|
|
51877
|
+
}
|
|
51878
|
+
log2(`Found/downloaded compatible binary at ${path2}. Replacing running bridges...`);
|
|
51879
|
+
const replaced = await pool.replaceBinary(path2);
|
|
51880
|
+
log2("Binary replaced successfully. New bridges will use the updated binary.");
|
|
51881
|
+
return replaced;
|
|
51882
|
+
} catch (err) {
|
|
51883
|
+
error2(`Auto-download failed: ${err.message}. Install manually: cargo install agent-file-tools@${minVersion}`);
|
|
51884
|
+
return null;
|
|
51885
|
+
}
|
|
51886
|
+
};
|
|
51887
|
+
}
|
|
51805
51888
|
var PLUGIN_VERSION = (() => {
|
|
51806
51889
|
try {
|
|
51807
51890
|
const req = createRequire3(import.meta.url);
|
|
@@ -52043,9 +52126,11 @@ ${lines}
|
|
|
52043
52126
|
} catch (err) {
|
|
52044
52127
|
warn2(`[lsp] auto-install setup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
52045
52128
|
}
|
|
52129
|
+
let pool;
|
|
52046
52130
|
const poolOptions = {
|
|
52047
52131
|
errorPrefix: "[aft-pi]",
|
|
52048
52132
|
minVersion: PLUGIN_VERSION,
|
|
52133
|
+
onVersionMismatch: createVersionMismatchHandler(() => pool),
|
|
52049
52134
|
onConfigureWarnings: async ({ projectRoot, sessionId, client, warnings }) => {
|
|
52050
52135
|
const pendingWarnings = sessionId ? drainPendingEagerWarnings(projectRoot) : [];
|
|
52051
52136
|
await handleConfigureWarningsForSession({
|
|
@@ -52074,7 +52159,7 @@ ${lines}
|
|
|
52074
52159
|
}, reminder);
|
|
52075
52160
|
}
|
|
52076
52161
|
};
|
|
52077
|
-
|
|
52162
|
+
pool = new BridgePool(binaryPath, poolOptions, configOverrides);
|
|
52078
52163
|
const ctx = { pool, config: config2, storageDir };
|
|
52079
52164
|
if (onnxRuntimePromise) {
|
|
52080
52165
|
onnxRuntimePromise.then((ortDylibDir) => {
|
|
@@ -52190,7 +52275,8 @@ ${lines}
|
|
|
52190
52275
|
var __test__2 = {
|
|
52191
52276
|
resolveToolSurface,
|
|
52192
52277
|
handleConfigureWarningsForSession,
|
|
52193
|
-
shouldPrepareOnnxRuntime
|
|
52278
|
+
shouldPrepareOnnxRuntime,
|
|
52279
|
+
createVersionMismatchHandler
|
|
52194
52280
|
};
|
|
52195
52281
|
export {
|
|
52196
52282
|
src_default as default,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* installed, log a warning and keep the existing version.
|
|
20
20
|
* Otherwise skip + warn.
|
|
21
21
|
*
|
|
22
|
-
* 3. Spawn `
|
|
22
|
+
* 3. Spawn `npm install --no-save <pkg>@<version> --ignore-scripts`
|
|
23
23
|
* in the background. Drop a lockfile while running. Log progress.
|
|
24
24
|
*
|
|
25
25
|
* 4. The newly-installed binary will be picked up on the user's NEXT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-auto-install.d.ts","sourceRoot":"","sources":["../src/lsp-auto-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAwBH,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,WAAW,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3C,kGAAkG;IAClG,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,qCAAqC;AACrC,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gDAAgD;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B;;;;;;;OAOG;IACH,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C;;;;;;;;;OASG;IACH,gBAAgB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AAkDD,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM/D;
|
|
1
|
+
{"version":3,"file":"lsp-auto-install.d.ts","sourceRoot":"","sources":["../src/lsp-auto-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAwBH,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,WAAW,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3C,kGAAkG;IAClG,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,qCAAqC;AACrC,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gDAAgD;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B;;;;;;;OAOG;IACH,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C;;;;;;;;;OASG;IACH,gBAAgB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AAkDD,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM/D;AAyVD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,iBAAiB,EACzB,SAAS,GAAE,OAAO,KAAa,GAC9B,iBAAiB,CAwEnB"}
|
package/dist/tools/fs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/tools/fs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,KAAK,EAAE,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E,MAAM,aAAa,CAAC;AAEjD,OAAO,EAEL,KAAK,iBAAiB,EAKvB,MAAM,qBAAqB,CAAC;AAE7B,QAAA,MAAM,YAAY;;;EAWhB,CAAC;AAEH,QAAA,MAAM,UAAU;;;EAGd,CAAC;AAEH,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,wCAAwC;AACxC,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,YAAY,GAAG,UAAU,EACnC,IAAI,EAAE,MAAM,CAAC,OAAO,YAAY,CAAC,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,EAC7D,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,iBAAiB,yCAkB3B;AAED,wCAAwC;AACxC,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,YAAY,GAAG,UAAU,EACnC,IAAI,EAAE,MAAM,CAAC,OAAO,YAAY,CAAC,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,EAC7D,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,EAChC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,iBAAiB,sFAsC3B;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,GAAG,IAAI,CA+F9F"}
|
package/dist/tools/imports.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { type Static, Type } from "typebox";
|
|
|
7
7
|
import type { PluginContext } from "../types.js";
|
|
8
8
|
import { type RenderContextLike } from "./render-helpers.js";
|
|
9
9
|
declare const ImportParams: Type.TObject<{
|
|
10
|
-
op: Type.TUnsafe<"
|
|
10
|
+
op: Type.TUnsafe<"remove" | "add" | "organize">;
|
|
11
11
|
filePath: Type.TString;
|
|
12
12
|
module: Type.TOptional<Type.TString>;
|
|
13
13
|
names: Type.TOptional<Type.TArray<Type.TString>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft-pi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
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",
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"prepublishOnly": "bun run build"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@cortexkit/aft-bridge": "0.
|
|
25
|
+
"@cortexkit/aft-bridge": "0.26.0",
|
|
26
26
|
"typebox": "^1.1.24",
|
|
27
27
|
"comment-json": "^5.0.0",
|
|
28
28
|
"diff": "^8.0.4",
|
|
29
29
|
"zod": "^4.1.8"
|
|
30
30
|
},
|
|
31
31
|
"optionalDependencies": {
|
|
32
|
-
"@cortexkit/aft-darwin-arm64": "0.
|
|
33
|
-
"@cortexkit/aft-darwin-x64": "0.
|
|
34
|
-
"@cortexkit/aft-linux-arm64": "0.
|
|
35
|
-
"@cortexkit/aft-linux-x64": "0.
|
|
36
|
-
"@cortexkit/aft-win32-x64": "0.
|
|
32
|
+
"@cortexkit/aft-darwin-arm64": "0.26.0",
|
|
33
|
+
"@cortexkit/aft-darwin-x64": "0.26.0",
|
|
34
|
+
"@cortexkit/aft-linux-arm64": "0.26.0",
|
|
35
|
+
"@cortexkit/aft-linux-x64": "0.26.0",
|
|
36
|
+
"@cortexkit/aft-win32-x64": "0.26.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@earendil-works/pi-coding-agent": "*",
|