@cortexkit/aft 0.52.0 → 0.52.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/commands/doctor.d.ts +20 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/lsp.d.ts +5 -0
- package/dist/commands/lsp.d.ts.map +1 -1
- package/dist/index.js +249 -79
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HarnessAdapter } from "../adapters/types.js";
|
|
2
|
-
import { type DiagnosticReport } from "../lib/diagnostics.js";
|
|
2
|
+
import { collectDiagnostics, type DiagnosticReport } from "../lib/diagnostics.js";
|
|
3
|
+
import { resolveAdaptersForCommand } from "../lib/harness-select.js";
|
|
3
4
|
import { type ClearResult } from "../lib/lsp-cache.js";
|
|
4
5
|
export type DoctorClearTarget = "plugin-cache" | "lsp-cache" | "binary-cache";
|
|
5
6
|
export declare const DOCTOR_CLEAR_TARGET_OPTIONS: {
|
|
@@ -13,6 +14,20 @@ export interface DoctorOptions {
|
|
|
13
14
|
force: boolean;
|
|
14
15
|
issue: boolean;
|
|
15
16
|
argv: string[];
|
|
17
|
+
/** Test seams keep command rendering covered without spawning a binary. */
|
|
18
|
+
resolveAdapters?: typeof resolveAdaptersForCommand;
|
|
19
|
+
collectDiagnostics?: typeof collectDiagnostics;
|
|
20
|
+
collectRemovalHealth?: typeof collectRemovalHealth;
|
|
21
|
+
}
|
|
22
|
+
export interface RemovalHealth {
|
|
23
|
+
available: boolean;
|
|
24
|
+
usageWindowDays?: number;
|
|
25
|
+
projectRootsServed?: number;
|
|
26
|
+
sessionsServed?: number;
|
|
27
|
+
projectRootsSource?: string;
|
|
28
|
+
runningBackgroundTasks?: number;
|
|
29
|
+
undoHistorySessions?: number;
|
|
30
|
+
message?: string;
|
|
16
31
|
}
|
|
17
32
|
export interface CacheClearSummary {
|
|
18
33
|
hadErrors: boolean;
|
|
@@ -37,6 +52,9 @@ export interface CacheClearOptions {
|
|
|
37
52
|
includePluginBytes?: boolean;
|
|
38
53
|
}
|
|
39
54
|
export declare function runDoctor(options: DoctorOptions): Promise<number>;
|
|
55
|
+
declare function collectRemovalHealth(adapters: HarnessAdapter[]): Promise<RemovalHealth>;
|
|
56
|
+
/** Render AFT's durable removal costs; the section is shown even when state is unavailable. */
|
|
57
|
+
export declare function renderRemovalSection(health: RemovalHealth): string[];
|
|
40
58
|
export declare function hasDoctorProblems(report: DiagnosticReport): boolean;
|
|
41
59
|
export declare function logBuildBreakerSuspensions(report: DiagnosticReport): void;
|
|
42
60
|
export declare function runDoctorBuildBreakerReset(argv: string[]): Promise<number>;
|
|
@@ -72,4 +90,5 @@ export declare function doctorSkewBinaryDownloadDecision(argv: string[]): "promp
|
|
|
72
90
|
export declare function formatDoctorStorageStatus(h: DiagnosticReport["harnesses"][number]): string;
|
|
73
91
|
export declare function fixPluginEntries(adapters: HarnessAdapter[]): Promise<void>;
|
|
74
92
|
export declare function deriveIssueTitleFromBody(body: string): string;
|
|
93
|
+
export {};
|
|
75
94
|
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAW3D,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;AAOvE,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,WAAW,GA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AC;IAC5E,OAAO,EAAE,MAAM,CAAC;CACjB;AA2ID,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,cAAc,EAAE,EAC1B,MAAM,EAAE,gBAAgB,GACvB,iBAAiB,EAAE,CAqFrB;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAIvE;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAK9F;AA2KD,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,CAQ1F;AAsGD,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAIhF;AAuFD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG7D"}
|
package/dist/commands/lsp.d.ts
CHANGED
|
@@ -20,6 +20,11 @@ export interface LspInspectResponse {
|
|
|
20
20
|
disabled_lsp?: string[];
|
|
21
21
|
lsp_paths_extra?: string[];
|
|
22
22
|
matching_servers?: LspServerInspection[];
|
|
23
|
+
diagnostics_complete?: boolean;
|
|
24
|
+
diagnostics_gaps?: Array<{
|
|
25
|
+
server_id: string;
|
|
26
|
+
reason: string;
|
|
27
|
+
}>;
|
|
23
28
|
diagnostics_count?: number;
|
|
24
29
|
diagnostics?: LspDiagnostic[];
|
|
25
30
|
typescript_package_warning?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp.d.ts","sourceRoot":"","sources":["../../src/commands/lsp.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EA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AAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAkBD,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,WAAW,GAAE,MAAsB,GAClC,MAAM,CAoBR;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAIzC;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkE7E;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,GAAG,MAAM,CAiE3F;AA+FD,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,GAAG,IAAI,CAapF"}
|
package/dist/index.js
CHANGED
|
@@ -139,7 +139,7 @@ function formatForegroundResult(data) {
|
|
|
139
139
|
return rendered;
|
|
140
140
|
}
|
|
141
141
|
function isTerminalStatus(status) {
|
|
142
|
-
return status === "completed" || status === "failed" || status === "killed" || status === "timed_out";
|
|
142
|
+
return status === "completed" || status === "failed" || status === "killed" || status === "timed_out" || status === "fate_unknown";
|
|
143
143
|
}
|
|
144
144
|
function sleep(ms) {
|
|
145
145
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -777,6 +777,7 @@ var init_bridge = __esm(() => {
|
|
|
777
777
|
"failed",
|
|
778
778
|
"killed",
|
|
779
779
|
"timed_out",
|
|
780
|
+
"fate_unknown",
|
|
780
781
|
"cancelled",
|
|
781
782
|
"timeout"
|
|
782
783
|
]);
|
|
@@ -2576,33 +2577,53 @@ var init_downloader = __esm(() => {
|
|
|
2576
2577
|
ensureBinaryInFlight = new Map;
|
|
2577
2578
|
});
|
|
2578
2579
|
|
|
2579
|
-
// ../aft-bridge/dist/
|
|
2580
|
-
import { appendFile, mkdir, rename, rm, stat } from "node:fs/promises";
|
|
2580
|
+
// ../aft-bridge/dist/storage-paths.js
|
|
2581
2581
|
import { homedir as homedir5 } from "node:os";
|
|
2582
|
-
import {
|
|
2582
|
+
import { join as join5, resolve as resolve3 } from "node:path";
|
|
2583
2583
|
function homeDir2() {
|
|
2584
2584
|
if (process.platform === "win32")
|
|
2585
2585
|
return process.env.USERPROFILE || process.env.HOME || homedir5();
|
|
2586
2586
|
return process.env.HOME || homedir5();
|
|
2587
2587
|
}
|
|
2588
2588
|
function dataHome() {
|
|
2589
|
-
|
|
2590
|
-
|
|
2589
|
+
const xdg = process.env.XDG_DATA_HOME;
|
|
2590
|
+
if (xdg)
|
|
2591
|
+
return xdg;
|
|
2591
2592
|
if (process.platform === "win32") {
|
|
2592
2593
|
return process.env.LOCALAPPDATA || process.env.APPDATA || join5(homeDir2(), "AppData", "Local");
|
|
2593
2594
|
}
|
|
2594
2595
|
return join5(homeDir2(), ".local", "share");
|
|
2595
2596
|
}
|
|
2597
|
+
function resolveStoragePath(raw) {
|
|
2598
|
+
let expanded = raw;
|
|
2599
|
+
if (raw === "~") {
|
|
2600
|
+
expanded = homeDir2();
|
|
2601
|
+
} else if (raw.startsWith("~/") || raw.startsWith("~\\")) {
|
|
2602
|
+
expanded = join5(homeDir2(), raw.slice(2));
|
|
2603
|
+
}
|
|
2604
|
+
return resolve3(expanded);
|
|
2605
|
+
}
|
|
2606
|
+
function resolveCortexKitStorageRoot() {
|
|
2607
|
+
const override = process.env.AFT_STORAGE_DIR;
|
|
2608
|
+
if (override)
|
|
2609
|
+
return resolveStoragePath(override);
|
|
2610
|
+
return resolveStoragePath(join5(dataHome(), "cortexkit", "aft"));
|
|
2611
|
+
}
|
|
2596
2612
|
function resolveAftStorageRoot(configuredRoot) {
|
|
2613
|
+
if (process.env.AFT_STORAGE_DIR)
|
|
2614
|
+
return resolveCortexKitStorageRoot();
|
|
2597
2615
|
if (configuredRoot)
|
|
2598
2616
|
return configuredRoot;
|
|
2599
|
-
|
|
2600
|
-
return join5(process.env.AFT_CACHE_DIR, "aft");
|
|
2601
|
-
return join5(dataHome(), "cortexkit", "aft");
|
|
2617
|
+
return resolveCortexKitStorageRoot();
|
|
2602
2618
|
}
|
|
2603
2619
|
function resolveAftLogPath(filename, configuredRoot) {
|
|
2604
2620
|
return join5(resolveAftStorageRoot(configuredRoot), "logs", filename);
|
|
2605
2621
|
}
|
|
2622
|
+
var init_storage_paths = () => {};
|
|
2623
|
+
|
|
2624
|
+
// ../aft-bridge/dist/durable-log.js
|
|
2625
|
+
import { appendFile, mkdir, rename, rm, stat } from "node:fs/promises";
|
|
2626
|
+
import { dirname } from "node:path";
|
|
2606
2627
|
|
|
2607
2628
|
class RotatingLogSink {
|
|
2608
2629
|
path;
|
|
@@ -2687,6 +2708,7 @@ async function renameIfPresent(from, to) {
|
|
|
2687
2708
|
}
|
|
2688
2709
|
var DEFAULT_LOG_BYTES, DEFAULT_LOG_GENERATIONS = 1;
|
|
2689
2710
|
var init_durable_log = __esm(() => {
|
|
2711
|
+
init_storage_paths();
|
|
2690
2712
|
DEFAULT_LOG_BYTES = 32 * 1024 * 1024;
|
|
2691
2713
|
});
|
|
2692
2714
|
|
|
@@ -2960,7 +2982,7 @@ var init_socket = __esm(() => {
|
|
|
2960
2982
|
return this.sock.localPort ?? null;
|
|
2961
2983
|
}
|
|
2962
2984
|
static connect(host, port, deadlineMs) {
|
|
2963
|
-
return new Promise((
|
|
2985
|
+
return new Promise((resolve4, reject) => {
|
|
2964
2986
|
const sock = net.connect({ host, port });
|
|
2965
2987
|
sock.setNoDelay(true);
|
|
2966
2988
|
const timer = setTimeout(() => {
|
|
@@ -2969,7 +2991,7 @@ var init_socket = __esm(() => {
|
|
|
2969
2991
|
}, Math.max(0, deadlineMs - Date.now()));
|
|
2970
2992
|
sock.once("connect", () => {
|
|
2971
2993
|
clearTimeout(timer);
|
|
2972
|
-
|
|
2994
|
+
resolve4(new SubcSocket(sock));
|
|
2973
2995
|
});
|
|
2974
2996
|
sock.once("error", (err) => {
|
|
2975
2997
|
clearTimeout(timer);
|
|
@@ -3001,7 +3023,7 @@ var init_socket = __esm(() => {
|
|
|
3001
3023
|
}
|
|
3002
3024
|
if (n === 0)
|
|
3003
3025
|
return Promise.resolve(new Uint8Array(0));
|
|
3004
|
-
return new Promise((
|
|
3026
|
+
return new Promise((resolve4, reject) => {
|
|
3005
3027
|
let timer = null;
|
|
3006
3028
|
if (Number.isFinite(deadlineMs)) {
|
|
3007
3029
|
const remaining = deadlineMs - Date.now();
|
|
@@ -3014,7 +3036,7 @@ var init_socket = __esm(() => {
|
|
|
3014
3036
|
reject(new SocketTimeoutError(`timed out waiting for ${n} bytes`));
|
|
3015
3037
|
}, remaining);
|
|
3016
3038
|
}
|
|
3017
|
-
this.waiter = { need: n, resolve:
|
|
3039
|
+
this.waiter = { need: n, resolve: resolve4, reject, timer };
|
|
3018
3040
|
this.tryServe();
|
|
3019
3041
|
});
|
|
3020
3042
|
}
|
|
@@ -3050,7 +3072,7 @@ var init_socket = __esm(() => {
|
|
|
3050
3072
|
let queued = false;
|
|
3051
3073
|
let settled = false;
|
|
3052
3074
|
let timer = null;
|
|
3053
|
-
const completed = new Promise((
|
|
3075
|
+
const completed = new Promise((resolve4, reject) => {
|
|
3054
3076
|
const settle = (run) => {
|
|
3055
3077
|
if (settled)
|
|
3056
3078
|
return;
|
|
@@ -3074,7 +3096,7 @@ var init_socket = __esm(() => {
|
|
|
3074
3096
|
if (err) {
|
|
3075
3097
|
reject(new SocketWriteQueuedError("subc socket reported a write error after bytes were handed to the socket", err instanceof Error ? err : new Error(String(err))));
|
|
3076
3098
|
} else {
|
|
3077
|
-
|
|
3099
|
+
resolve4();
|
|
3078
3100
|
}
|
|
3079
3101
|
});
|
|
3080
3102
|
});
|
|
@@ -3461,15 +3483,15 @@ class SubcClient {
|
|
|
3461
3483
|
const key = pendingKey(handle, corr);
|
|
3462
3484
|
let subscriptionPending = null;
|
|
3463
3485
|
let resolveClosed = null;
|
|
3464
|
-
const closed = new Promise((
|
|
3486
|
+
const closed = new Promise((resolve4, reject) => {
|
|
3465
3487
|
if (this.closedErr) {
|
|
3466
3488
|
reject(this.closedErr);
|
|
3467
3489
|
return;
|
|
3468
3490
|
}
|
|
3469
|
-
resolveClosed =
|
|
3491
|
+
resolveClosed = resolve4;
|
|
3470
3492
|
subscriptionPending = {
|
|
3471
3493
|
handle,
|
|
3472
|
-
resolve: () =>
|
|
3494
|
+
resolve: () => resolve4(),
|
|
3473
3495
|
reject,
|
|
3474
3496
|
onProgress: onEvent,
|
|
3475
3497
|
timer: null,
|
|
@@ -3558,11 +3580,11 @@ class SubcClient {
|
|
|
3558
3580
|
const waiters = [];
|
|
3559
3581
|
for (const pending of this.pending.values()) {
|
|
3560
3582
|
if (pending.handle === handle && !pending.subscription) {
|
|
3561
|
-
waiters.push(new Promise((
|
|
3583
|
+
waiters.push(new Promise((resolve4) => {
|
|
3562
3584
|
const previous = pending.onSettle;
|
|
3563
3585
|
pending.onSettle = () => {
|
|
3564
3586
|
previous?.();
|
|
3565
|
-
|
|
3587
|
+
resolve4();
|
|
3566
3588
|
};
|
|
3567
3589
|
}));
|
|
3568
3590
|
}
|
|
@@ -3618,11 +3640,11 @@ class SubcClient {
|
|
|
3618
3640
|
const channel = handle?.channel ?? 0;
|
|
3619
3641
|
const epoch = handle?.epoch ?? 0;
|
|
3620
3642
|
const frame = buildFrame(FrameType.Request, buildFlags(false, priority, false, admission), channel, epoch, corr, body);
|
|
3621
|
-
return new Promise((
|
|
3643
|
+
return new Promise((resolve4, reject) => {
|
|
3622
3644
|
const ms = timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
3623
3645
|
const pending = {
|
|
3624
3646
|
handle,
|
|
3625
|
-
resolve:
|
|
3647
|
+
resolve: resolve4,
|
|
3626
3648
|
reject,
|
|
3627
3649
|
onProgress,
|
|
3628
3650
|
timer: null,
|
|
@@ -3696,11 +3718,11 @@ class SubcClient {
|
|
|
3696
3718
|
}
|
|
3697
3719
|
return this.outcomeUnknownCallError("connection dropped before the managed call returned a response", error2);
|
|
3698
3720
|
};
|
|
3699
|
-
return new Promise((
|
|
3721
|
+
return new Promise((resolve4, reject) => {
|
|
3700
3722
|
const ms = timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
3701
3723
|
const pending = {
|
|
3702
3724
|
handle,
|
|
3703
|
-
resolve:
|
|
3725
|
+
resolve: resolve4,
|
|
3704
3726
|
reject,
|
|
3705
3727
|
onProgress,
|
|
3706
3728
|
timer: null,
|
|
@@ -4149,7 +4171,7 @@ function normalizeConnectOptions(opts) {
|
|
|
4149
4171
|
identity: opts.identity,
|
|
4150
4172
|
targetKind: opts.targetKind ?? DEFAULT_MANAGED_TARGET_KIND,
|
|
4151
4173
|
reconnectBackoff: opts.reconnectBackoff ?? DEFAULT_RECONNECT_BACKOFF,
|
|
4152
|
-
sleep: opts.sleep ?? ((ms) => new Promise((
|
|
4174
|
+
sleep: opts.sleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms))),
|
|
4153
4175
|
timeoutArbitrationGraceMs: opts.timeoutArbitrationGraceMs ?? TIMEOUT_ARBITRATION_GRACE_MS,
|
|
4154
4176
|
livenessProbeWindowMs: opts.livenessProbeWindowMs ?? LIVENESS_PROBE_WINDOW_MS,
|
|
4155
4177
|
onControlPush: opts.onControlPush
|
|
@@ -4664,14 +4686,14 @@ var init_lifecycle_registry = __esm(() => {
|
|
|
4664
4686
|
// ../aft-bridge/dist/project-identity.js
|
|
4665
4687
|
import { createHash as createHash3 } from "node:crypto";
|
|
4666
4688
|
import { realpathSync } from "node:fs";
|
|
4667
|
-
import { resolve as
|
|
4689
|
+
import { resolve as resolve4 } from "node:path";
|
|
4668
4690
|
function canonicalizeProjectRoot(dir) {
|
|
4669
4691
|
const trimmed = dir.replace(/[/\\]+$/, "");
|
|
4670
4692
|
let canonical;
|
|
4671
4693
|
try {
|
|
4672
4694
|
canonical = realpathSync(trimmed);
|
|
4673
4695
|
} catch {
|
|
4674
|
-
canonical =
|
|
4696
|
+
canonical = resolve4(trimmed);
|
|
4675
4697
|
}
|
|
4676
4698
|
return normalizeWindowsRoot(canonical);
|
|
4677
4699
|
}
|
|
@@ -4956,6 +4978,15 @@ function isAbsentRootRouteError(err) {
|
|
|
4956
4978
|
function absentRootError(root) {
|
|
4957
4979
|
return new SubcError(`invalid route project root: project root does not exist: ${root}`, "config_divergence");
|
|
4958
4980
|
}
|
|
4981
|
+
function reloadWindowExhaustedError(error2) {
|
|
4982
|
+
if (error2 instanceof Error) {
|
|
4983
|
+
try {
|
|
4984
|
+
error2.message += ROUTE_OPEN_RELOAD_WAIT_EXHAUSTED_SUFFIX;
|
|
4985
|
+
return error2;
|
|
4986
|
+
} catch {}
|
|
4987
|
+
}
|
|
4988
|
+
return new Error(`${String(error2)}${ROUTE_OPEN_RELOAD_WAIT_EXHAUSTED_SUFFIX}`);
|
|
4989
|
+
}
|
|
4959
4990
|
function safeCloseRoute(client, route) {
|
|
4960
4991
|
try {
|
|
4961
4992
|
client.closeRouteChannel(route).catch(() => {
|
|
@@ -5077,6 +5108,7 @@ class SubcTransportPool {
|
|
|
5077
5108
|
connecting = null;
|
|
5078
5109
|
routeReopenRetryDelayMs = RECONNECT_RETRY_FLOOR_MS;
|
|
5079
5110
|
routeReopenRetry = null;
|
|
5111
|
+
routeReopenRetryMs = null;
|
|
5080
5112
|
sessions = new Map;
|
|
5081
5113
|
rootIndex = new Map;
|
|
5082
5114
|
dormantRoots = new Map;
|
|
@@ -5096,8 +5128,8 @@ class SubcTransportPool {
|
|
|
5096
5128
|
this.connectFn = options.connect ?? ((opts) => SubcClient.connect(opts));
|
|
5097
5129
|
this.onBgEventsNudge = options.onBgEventsNudge;
|
|
5098
5130
|
this.onBgEventsNudgeRef = options.onBgEventsNudgeRef;
|
|
5099
|
-
this.bgBackoffSleep = options.bgBackoffSleep ?? ((ms) => new Promise((
|
|
5100
|
-
this.routeRetrySleep = options.routeRetrySleep ?? ((ms) => new Promise((
|
|
5131
|
+
this.bgBackoffSleep = options.bgBackoffSleep ?? ((ms) => new Promise((resolve5) => setTimeout(resolve5, ms)));
|
|
5132
|
+
this.routeRetrySleep = options.routeRetrySleep ?? ((ms) => new Promise((resolve5) => setTimeout(resolve5, ms)));
|
|
5101
5133
|
this.bgDispatchProbeIntervalMs = options.bgDispatchProbeIntervalMs ?? BG_DISPATCH_PROBE_INTERVAL_MS;
|
|
5102
5134
|
const lifecycle = options.lifecycle;
|
|
5103
5135
|
const demandCheck = options.lifecycleDemandCheck ?? options.demandCheck ?? lifecycle?.demandCheck;
|
|
@@ -5550,6 +5582,23 @@ class SubcTransportPool {
|
|
|
5550
5582
|
throw error2;
|
|
5551
5583
|
}
|
|
5552
5584
|
};
|
|
5585
|
+
const openRouteAfterReloadWindow = async () => {
|
|
5586
|
+
let reloadWaitedMs = 0;
|
|
5587
|
+
while (true) {
|
|
5588
|
+
try {
|
|
5589
|
+
return await openRoute();
|
|
5590
|
+
} catch (error2) {
|
|
5591
|
+
if (!isRouteOpenReloadWindowError(error2))
|
|
5592
|
+
throw error2;
|
|
5593
|
+
const { delayMs, wait } = this.waitForRouteReopenBackoff();
|
|
5594
|
+
if (reloadWaitedMs + delayMs > ROUTE_OPEN_RELOAD_WAIT_CAP_MS) {
|
|
5595
|
+
throw reloadWindowExhaustedError(error2);
|
|
5596
|
+
}
|
|
5597
|
+
reloadWaitedMs += delayMs;
|
|
5598
|
+
await wait;
|
|
5599
|
+
}
|
|
5600
|
+
}
|
|
5601
|
+
};
|
|
5553
5602
|
const clearRouteEntry = (entry) => {
|
|
5554
5603
|
if (record.routeEntry !== entry)
|
|
5555
5604
|
return;
|
|
@@ -5586,7 +5635,7 @@ class SubcTransportPool {
|
|
|
5586
5635
|
this.ensureBgSubscription(identity, record);
|
|
5587
5636
|
return reply;
|
|
5588
5637
|
};
|
|
5589
|
-
let routeAndEntry = await
|
|
5638
|
+
let routeAndEntry = await openRouteAfterReloadWindow();
|
|
5590
5639
|
try {
|
|
5591
5640
|
return await requestOnRoute(routeAndEntry.route);
|
|
5592
5641
|
} catch (error2) {
|
|
@@ -5594,8 +5643,8 @@ class SubcTransportPool {
|
|
|
5594
5643
|
throw this.annotateReapError(error2, record);
|
|
5595
5644
|
if (isRouteProvenAbsentError(error2) && this.isCurrentSession(key, record) && this.client === client) {
|
|
5596
5645
|
clearRouteEntry(routeAndEntry.entry);
|
|
5597
|
-
await this.waitForRouteReopenBackoff();
|
|
5598
|
-
routeAndEntry = await
|
|
5646
|
+
await this.waitForRouteReopenBackoff().wait;
|
|
5647
|
+
routeAndEntry = await openRouteAfterReloadWindow();
|
|
5599
5648
|
try {
|
|
5600
5649
|
const reply = await requestOnRoute(routeAndEntry.route);
|
|
5601
5650
|
this.resetRouteReopenBackoff();
|
|
@@ -5621,17 +5670,21 @@ class SubcTransportPool {
|
|
|
5621
5670
|
}
|
|
5622
5671
|
waitForRouteReopenBackoff() {
|
|
5623
5672
|
const pending = this.routeReopenRetry;
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5673
|
+
const pendingDelay = this.routeReopenRetryMs;
|
|
5674
|
+
if (pending && pendingDelay !== null)
|
|
5675
|
+
return { delayMs: pendingDelay, wait: pending };
|
|
5676
|
+
const delayMs = this.routeReopenRetryDelayMs;
|
|
5677
|
+
this.routeReopenRetryDelayMs = Math.min(delayMs * 2, RECONNECT_RETRY_CAP_MS);
|
|
5628
5678
|
let retry;
|
|
5629
|
-
retry = Promise.resolve().then(() => this.routeRetrySleep(
|
|
5630
|
-
if (this.routeReopenRetry === retry)
|
|
5679
|
+
retry = Promise.resolve().then(() => this.routeRetrySleep(delayMs)).finally(() => {
|
|
5680
|
+
if (this.routeReopenRetry === retry) {
|
|
5631
5681
|
this.routeReopenRetry = null;
|
|
5682
|
+
this.routeReopenRetryMs = null;
|
|
5683
|
+
}
|
|
5632
5684
|
});
|
|
5633
5685
|
this.routeReopenRetry = retry;
|
|
5634
|
-
|
|
5686
|
+
this.routeReopenRetryMs = delayMs;
|
|
5687
|
+
return { delayMs, wait: retry };
|
|
5635
5688
|
}
|
|
5636
5689
|
resetRouteReopenBackoff() {
|
|
5637
5690
|
this.routeReopenRetryDelayMs = RECONNECT_RETRY_FLOOR_MS;
|
|
@@ -5889,10 +5942,11 @@ function resolveBridgeForNudge(pool, ref) {
|
|
|
5889
5942
|
currentConcretePoolId: candidate.getConcretePoolId?.()
|
|
5890
5943
|
});
|
|
5891
5944
|
}
|
|
5892
|
-
var SubcTransportShuttingDownError, AFT_MODULE_ID = "aft", MAX_CONSECUTIVE_TRANSPORT_FAILURES = 3, RECONNECT_RETRY_FLOOR_MS = 100, RECONNECT_RETRY_CAP_MS = 2000, BG_STABLE_MS = 5000, BG_LIFECYCLE_LOG_INTERVAL_MS = 60000, BG_DISPATCH_PROBE_INTERVAL_MS = 60000, DEFAULT_SESSION_ID = "__default__", LOCALLY_SATISFIED_COMMANDS, SubcRootReapedError, SubcRootGenerationExpiredError, SubcRootDemandRequiredError, RouteTornDownError;
|
|
5945
|
+
var SubcTransportShuttingDownError, AFT_MODULE_ID = "aft", MAX_CONSECUTIVE_TRANSPORT_FAILURES = 3, RECONNECT_RETRY_FLOOR_MS = 100, RECONNECT_RETRY_CAP_MS = 2000, ROUTE_OPEN_RELOAD_WAIT_CAP_MS = 15000, ROUTE_OPEN_RELOAD_WAIT_EXHAUSTED_SUFFIX = " The AFT daemon module did not return within the 15s reload window.", BG_STABLE_MS = 5000, BG_LIFECYCLE_LOG_INTERVAL_MS = 60000, BG_DISPATCH_PROBE_INTERVAL_MS = 60000, DEFAULT_SESSION_ID = "__default__", LOCALLY_SATISFIED_COMMANDS, SubcRootReapedError, SubcRootGenerationExpiredError, SubcRootDemandRequiredError, RouteTornDownError;
|
|
5893
5946
|
var init_subc_transport = __esm(() => {
|
|
5894
5947
|
init_dist();
|
|
5895
5948
|
init_active_logger();
|
|
5949
|
+
init_error_contract();
|
|
5896
5950
|
init_lifecycle_registry();
|
|
5897
5951
|
init_project_identity();
|
|
5898
5952
|
SubcTransportShuttingDownError = class SubcTransportShuttingDownError extends SubcCallError {
|
|
@@ -5963,6 +6017,12 @@ function isRouteGoodbyeError(error2) {
|
|
|
5963
6017
|
}
|
|
5964
6018
|
return error2.code === "route_closed" && error2.message.includes("route closed by subc");
|
|
5965
6019
|
}
|
|
6020
|
+
function isRouteOpenReloadWindowError(error2) {
|
|
6021
|
+
if (error2 === null || typeof error2 !== "object")
|
|
6022
|
+
return false;
|
|
6023
|
+
const code = error2.code;
|
|
6024
|
+
return code === "module_reloading" || code === "module_warming" || code === "target_unavailable";
|
|
6025
|
+
}
|
|
5966
6026
|
function hasEngineResponse(error2) {
|
|
5967
6027
|
const response = error2.response;
|
|
5968
6028
|
if (response !== null && typeof response === "object")
|
|
@@ -6063,7 +6123,7 @@ function stripJsoncSymbols(value) {
|
|
|
6063
6123
|
// ../aft-bridge/dist/paths.js
|
|
6064
6124
|
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync } from "node:fs";
|
|
6065
6125
|
import { homedir as homedir6 } from "node:os";
|
|
6066
|
-
import { dirname as dirname2, isAbsolute as isAbsolute2, join as join6, resolve as
|
|
6126
|
+
import { dirname as dirname2, isAbsolute as isAbsolute2, join as join6, resolve as resolve5 } from "node:path";
|
|
6067
6127
|
function homeDir3() {
|
|
6068
6128
|
if (process.platform === "win32")
|
|
6069
6129
|
return process.env.USERPROFILE || process.env.HOME || homedir6();
|
|
@@ -6078,7 +6138,7 @@ function configHome() {
|
|
|
6078
6138
|
function legacyOpenCodeConfigDir() {
|
|
6079
6139
|
const envDir = process.env.OPENCODE_CONFIG_DIR?.trim();
|
|
6080
6140
|
if (envDir)
|
|
6081
|
-
return
|
|
6141
|
+
return resolve5(envDir);
|
|
6082
6142
|
return join6(configHome(), "opencode");
|
|
6083
6143
|
}
|
|
6084
6144
|
function legacyPiAgentDir() {
|
|
@@ -6321,7 +6381,16 @@ function platformKey(platform = process.platform, arch = process.arch) {
|
|
|
6321
6381
|
}
|
|
6322
6382
|
return key;
|
|
6323
6383
|
}
|
|
6384
|
+
function logBinaryResolution(resolution) {
|
|
6385
|
+
log(`Resolved binary from ${resolution.source}: ${resolution.path}`);
|
|
6386
|
+
}
|
|
6324
6387
|
function findBinarySync(expectedVersion) {
|
|
6388
|
+
const resolution = findBinarySyncInner(expectedVersion);
|
|
6389
|
+
if (resolution)
|
|
6390
|
+
logBinaryResolution(resolution);
|
|
6391
|
+
return resolution?.path ?? null;
|
|
6392
|
+
}
|
|
6393
|
+
function findBinarySyncInner(expectedVersion) {
|
|
6325
6394
|
const ext = process.platform === "win32" ? ".exe" : "";
|
|
6326
6395
|
const env = { ...process.env };
|
|
6327
6396
|
const pluginVersion = expectedVersion ?? (() => {
|
|
@@ -6335,8 +6404,9 @@ function findBinarySync(expectedVersion) {
|
|
|
6335
6404
|
if (pluginVersion) {
|
|
6336
6405
|
const tag = pluginVersion.startsWith("v") ? pluginVersion : `v${pluginVersion}`;
|
|
6337
6406
|
const versionCached = cachedBinaryPathFromEnv(tag, env, ext);
|
|
6338
|
-
if (versionCached && isExpectedCachedBinary2(versionCached, pluginVersion))
|
|
6339
|
-
return versionCached;
|
|
6407
|
+
if (versionCached && isExpectedCachedBinary2(versionCached, pluginVersion)) {
|
|
6408
|
+
return { path: versionCached, source: "versioned cache" };
|
|
6409
|
+
}
|
|
6340
6410
|
}
|
|
6341
6411
|
try {
|
|
6342
6412
|
const key = platformKey();
|
|
@@ -6351,7 +6421,7 @@ function findBinarySync(expectedVersion) {
|
|
|
6351
6421
|
warn(`npm platform package binary v${npmVersion} does not match plugin v${pluginVersion}; skipping (continuing to PATH lookup)`);
|
|
6352
6422
|
} else {
|
|
6353
6423
|
const copied = copyToVersionedCache(resolved, npmVersion);
|
|
6354
|
-
return copied ?? resolved;
|
|
6424
|
+
return { path: copied ?? resolved, source: "npm platform package" };
|
|
6355
6425
|
}
|
|
6356
6426
|
}
|
|
6357
6427
|
} catch {}
|
|
@@ -6369,27 +6439,28 @@ function findBinarySync(expectedVersion) {
|
|
|
6369
6439
|
}
|
|
6370
6440
|
const usable = probeBinaryCandidate(candidate, "PATH", expectedVersion);
|
|
6371
6441
|
if (usable)
|
|
6372
|
-
return usable;
|
|
6442
|
+
return { path: usable, source: "PATH" };
|
|
6373
6443
|
}
|
|
6374
6444
|
} catch {}
|
|
6375
6445
|
const cargoPath = join7(homeDirFromEnv(env), ".cargo", "bin", `aft${ext}`);
|
|
6376
6446
|
if (existsSync5(cargoPath)) {
|
|
6377
6447
|
const usable = probeBinaryCandidate(cargoPath, "cargo", expectedVersion);
|
|
6378
6448
|
if (usable)
|
|
6379
|
-
return usable;
|
|
6449
|
+
return { path: usable, source: "cargo" };
|
|
6380
6450
|
}
|
|
6381
6451
|
return null;
|
|
6382
6452
|
}
|
|
6383
6453
|
async function findBinary(expectedVersion) {
|
|
6384
6454
|
const syncResult = findBinarySync(expectedVersion);
|
|
6385
6455
|
if (syncResult) {
|
|
6386
|
-
log(`Resolved binary: ${syncResult}`);
|
|
6387
6456
|
return syncResult;
|
|
6388
6457
|
}
|
|
6389
6458
|
log("Binary not found locally, attempting auto-download...");
|
|
6390
6459
|
const downloaded = await ensureBinaryForResolver(expectedVersion);
|
|
6391
|
-
if (downloaded)
|
|
6460
|
+
if (downloaded) {
|
|
6461
|
+
logBinaryResolution({ path: downloaded, source: "auto-download" });
|
|
6392
6462
|
return downloaded;
|
|
6463
|
+
}
|
|
6393
6464
|
throw new Error([
|
|
6394
6465
|
"Could not find the `aft` binary.",
|
|
6395
6466
|
"",
|
|
@@ -6422,7 +6493,7 @@ var init_resolver = __esm(() => {
|
|
|
6422
6493
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
6423
6494
|
import { closeSync as closeSync3, existsSync as existsSync6, mkdirSync as mkdirSync4, openSync as openSync3, readFileSync as readFileSync5, renameSync as renameSync4, rmSync as rmSync2, statSync as statSync4, unlinkSync as unlinkSync3, writeFileSync as writeFileSync2 } from "node:fs";
|
|
6424
6495
|
import { homedir as homedir8, tmpdir } from "node:os";
|
|
6425
|
-
import { basename, dirname as dirname3, join as join8, resolve as
|
|
6496
|
+
import { basename, dirname as dirname3, join as join8, resolve as resolve6 } from "node:path";
|
|
6426
6497
|
function dataHome2() {
|
|
6427
6498
|
if (process.env.XDG_DATA_HOME)
|
|
6428
6499
|
return process.env.XDG_DATA_HOME;
|
|
@@ -6441,9 +6512,6 @@ function resolveLegacyStorageRoot(harness) {
|
|
|
6441
6512
|
return join8(homeDir4(), ".pi", "agent", "aft");
|
|
6442
6513
|
return join8(dataHome2(), "opencode", "storage", "plugin", "aft");
|
|
6443
6514
|
}
|
|
6444
|
-
function resolveCortexKitStorageRoot() {
|
|
6445
|
-
return join8(dataHome2(), "cortexkit", "aft");
|
|
6446
|
-
}
|
|
6447
6515
|
function stripJsoncForParse(input) {
|
|
6448
6516
|
let out = "";
|
|
6449
6517
|
let inString = false;
|
|
@@ -6711,8 +6779,8 @@ function visibleConfigMigrationWarning(scope, targetPath, paths, reason) {
|
|
|
6711
6779
|
}
|
|
6712
6780
|
function migrateAftConfigFile(opts) {
|
|
6713
6781
|
const warnings = [];
|
|
6714
|
-
const resolvedTarget =
|
|
6715
|
-
const existingSources = opts.legacySources.filter((source) => existsSync6(source.path) &&
|
|
6782
|
+
const resolvedTarget = resolve6(opts.targetPath);
|
|
6783
|
+
const existingSources = opts.legacySources.filter((source) => existsSync6(source.path) && resolve6(source.path) !== resolvedTarget);
|
|
6716
6784
|
const info = opts.logger?.info ?? opts.logger?.log;
|
|
6717
6785
|
if (existingSources.length === 0) {
|
|
6718
6786
|
return { migrated: false, conflict: false, targetPath: opts.targetPath, warnings };
|
|
@@ -6874,6 +6942,8 @@ var spawnSyncForMigration, TARGET_MARKER = ".migrated_from_legacy", DEFAULT_TIME
|
|
|
6874
6942
|
var init_migration = __esm(() => {
|
|
6875
6943
|
init_paths();
|
|
6876
6944
|
init_resolver();
|
|
6945
|
+
init_storage_paths();
|
|
6946
|
+
init_storage_paths();
|
|
6877
6947
|
spawnSyncForMigration = spawnSync2;
|
|
6878
6948
|
DEFAULT_TIMEOUT_MS = 30 * 60 * 1000;
|
|
6879
6949
|
});
|
|
@@ -7016,7 +7086,7 @@ var init_npm_resolver = () => {};
|
|
|
7016
7086
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
7017
7087
|
import { createHash as createHash4 } from "node:crypto";
|
|
7018
7088
|
import { chmodSync as chmodSync3, closeSync as closeSync4, copyFileSync as copyFileSync3, createWriteStream as createWriteStream2, existsSync as existsSync7, lstatSync, mkdirSync as mkdirSync5, openSync as openSync4, readdirSync as readdirSync3, readFileSync as readFileSync6, readlinkSync, realpathSync as realpathSync2, rmSync as rmSync3, statSync as statSync6, symlinkSync, unlinkSync as unlinkSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
7019
|
-
import { basename as basename2, dirname as dirname5, isAbsolute as isAbsolute4, join as join10, relative as relative2, resolve as
|
|
7089
|
+
import { basename as basename2, dirname as dirname5, isAbsolute as isAbsolute4, join as join10, relative as relative2, resolve as resolve7, win32 } from "node:path";
|
|
7020
7090
|
import { Readable as Readable2 } from "node:stream";
|
|
7021
7091
|
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
7022
7092
|
function getPlatformInfo() {
|
|
@@ -7285,7 +7355,7 @@ function findSystemOnnxRuntime(libName) {
|
|
|
7285
7355
|
const normalizeCase = process.platform === "win32" || process.platform === "darwin";
|
|
7286
7356
|
const seen = new Set;
|
|
7287
7357
|
const uniquePaths = searchPaths.filter((p) => {
|
|
7288
|
-
let key =
|
|
7358
|
+
let key = resolve7(p).replace(/[/\\]+$/, "");
|
|
7289
7359
|
if (normalizeCase)
|
|
7290
7360
|
key = key.toLowerCase();
|
|
7291
7361
|
if (seen.has(key))
|
|
@@ -7369,7 +7439,7 @@ function validateExtractedTree(stagingRoot) {
|
|
|
7369
7439
|
const lst = lstatSync(fullPath);
|
|
7370
7440
|
if (lst.isSymbolicLink()) {
|
|
7371
7441
|
const linkTarget = readlinkSync(fullPath);
|
|
7372
|
-
const resolvedTarget =
|
|
7442
|
+
const resolvedTarget = resolve7(dirname5(fullPath), linkTarget);
|
|
7373
7443
|
const rel2 = relative2(realRoot, resolvedTarget);
|
|
7374
7444
|
if (rel2.startsWith("..") || isAbsolute4(rel2) || win32.isAbsolute(rel2)) {
|
|
7375
7445
|
throw new Error(`extracted symlink ${fullPath} points outside staging root: ${linkTarget}`);
|
|
@@ -7487,7 +7557,7 @@ function copyOnnxLibraries(info, extractedDir, targetDir, realFiles, symlinks, c
|
|
|
7487
7557
|
unlinkSync4(dst);
|
|
7488
7558
|
} catch {}
|
|
7489
7559
|
const dstForContainment = join10(targetRoot, link.name);
|
|
7490
|
-
const resolvedTarget =
|
|
7560
|
+
const resolvedTarget = resolve7(dirname5(dstForContainment), link.target);
|
|
7491
7561
|
if (!isPathInsideRoot(targetRoot, resolvedTarget)) {
|
|
7492
7562
|
const message = `ONNX Runtime symlink ${link.name} points outside install dir: ${link.target}`;
|
|
7493
7563
|
if (requiredLibs.has(link.name)) {
|
|
@@ -8636,7 +8706,7 @@ class RevivableTransportPool {
|
|
|
8636
8706
|
const delay = Math.max(0, this.revivalRetryNotBefore - Date.now());
|
|
8637
8707
|
if (delay > 0) {
|
|
8638
8708
|
let scheduled;
|
|
8639
|
-
scheduled = new Promise((
|
|
8709
|
+
scheduled = new Promise((resolve8) => setTimeout(resolve8, delay)).then(() => {
|
|
8640
8710
|
if (this.revival === scheduled)
|
|
8641
8711
|
this.revival = null;
|
|
8642
8712
|
return this.ensureActivePool();
|
|
@@ -9196,6 +9266,7 @@ var init_dist2 = __esm(() => {
|
|
|
9196
9266
|
init_project_identity();
|
|
9197
9267
|
init_resolver();
|
|
9198
9268
|
init_revivable_transport();
|
|
9269
|
+
init_storage_paths();
|
|
9199
9270
|
init_subc_transport();
|
|
9200
9271
|
init_transport_factory();
|
|
9201
9272
|
});
|
|
@@ -17272,12 +17343,12 @@ var init_self_version = () => {};
|
|
|
17272
17343
|
import { execSync as execSync3 } from "node:child_process";
|
|
17273
17344
|
import { existsSync as existsSync12, readFileSync as readFileSync8, rmSync as rmSync4, statSync as statSync8 } from "node:fs";
|
|
17274
17345
|
import { homedir as homedir14 } from "node:os";
|
|
17275
|
-
import { dirname as dirname7, join as join15, parse, resolve as
|
|
17346
|
+
import { dirname as dirname7, join as join15, parse, resolve as resolve8 } from "node:path";
|
|
17276
17347
|
import { fileURLToPath } from "node:url";
|
|
17277
17348
|
function getOpenCodeConfigDir() {
|
|
17278
17349
|
const envDir = process.env.OPENCODE_CONFIG_DIR?.trim();
|
|
17279
17350
|
if (envDir)
|
|
17280
|
-
return
|
|
17351
|
+
return resolve8(envDir);
|
|
17281
17352
|
const xdg = process.env.XDG_CONFIG_HOME || join15(homedir14(), ".config");
|
|
17282
17353
|
return join15(xdg, "opencode");
|
|
17283
17354
|
}
|
|
@@ -17597,11 +17668,11 @@ var init_opencode = __esm(() => {
|
|
|
17597
17668
|
import { execSync as execSync4, spawnSync as spawnSync4 } from "node:child_process";
|
|
17598
17669
|
import { existsSync as existsSync13, readFileSync as readFileSync9 } from "node:fs";
|
|
17599
17670
|
import { homedir as homedir15 } from "node:os";
|
|
17600
|
-
import { join as join16, resolve as
|
|
17671
|
+
import { join as join16, resolve as resolve9 } from "node:path";
|
|
17601
17672
|
function getPiAgentDir() {
|
|
17602
17673
|
const configuredDir = process.env.PI_CODING_AGENT_DIR?.trim();
|
|
17603
17674
|
if (configuredDir)
|
|
17604
|
-
return
|
|
17675
|
+
return resolve9(configuredDir);
|
|
17605
17676
|
const envHome = process.platform === "win32" ? process.env.USERPROFILE : process.env.HOME;
|
|
17606
17677
|
const home = envHome && envHome.length > 0 ? envHome : homedir15();
|
|
17607
17678
|
return join16(home, ".pi", "agent");
|
|
@@ -19280,8 +19351,15 @@ function isResponseForRequest(parsed, expectedIds) {
|
|
|
19280
19351
|
return false;
|
|
19281
19352
|
return expectedIds.has(id);
|
|
19282
19353
|
}
|
|
19354
|
+
async function sendAftRequest(binaryPath, request) {
|
|
19355
|
+
const responses = await sendAftRequests(binaryPath, [request]);
|
|
19356
|
+
const response = responses[0];
|
|
19357
|
+
if (!response)
|
|
19358
|
+
throw new Error("aft exited before responding");
|
|
19359
|
+
return response;
|
|
19360
|
+
}
|
|
19283
19361
|
async function sendAftRequests(binaryPath, requests) {
|
|
19284
|
-
return new Promise((
|
|
19362
|
+
return new Promise((resolve10, reject) => {
|
|
19285
19363
|
const child = spawn3(binaryPath, [], {
|
|
19286
19364
|
stdio: ["pipe", "pipe", "pipe"]
|
|
19287
19365
|
});
|
|
@@ -19318,7 +19396,7 @@ async function sendAftRequests(binaryPath, requests) {
|
|
|
19318
19396
|
const response = parsed;
|
|
19319
19397
|
responses.push(response);
|
|
19320
19398
|
if (responses.length === requests.length) {
|
|
19321
|
-
finish(() =>
|
|
19399
|
+
finish(() => resolve10(responses));
|
|
19322
19400
|
}
|
|
19323
19401
|
};
|
|
19324
19402
|
child.stdout.setEncoding("utf-8");
|
|
@@ -19399,9 +19477,9 @@ __export(exports_lsp, {
|
|
|
19399
19477
|
});
|
|
19400
19478
|
import { existsSync as existsSync14, readdirSync as readdirSync5, statSync as statSync9 } from "node:fs";
|
|
19401
19479
|
import { createRequire as createRequire4 } from "node:module";
|
|
19402
|
-
import { dirname as dirname8, join as join17, resolve as
|
|
19480
|
+
import { dirname as dirname8, join as join17, resolve as resolve10 } from "node:path";
|
|
19403
19481
|
function findProjectRootForFile(filePath, fallbackCwd = process.cwd()) {
|
|
19404
|
-
const resolvedFile =
|
|
19482
|
+
const resolvedFile = resolve10(fallbackCwd, filePath);
|
|
19405
19483
|
let dir = dirname8(resolvedFile);
|
|
19406
19484
|
try {
|
|
19407
19485
|
if (existsSync14(resolvedFile) && statSync9(resolvedFile).isDirectory()) {
|
|
@@ -19416,7 +19494,7 @@ function findProjectRootForFile(filePath, fallbackCwd = process.cwd()) {
|
|
|
19416
19494
|
}
|
|
19417
19495
|
const parent = dirname8(dir);
|
|
19418
19496
|
if (parent === dir)
|
|
19419
|
-
return
|
|
19497
|
+
return resolve10(fallbackCwd);
|
|
19420
19498
|
dir = parent;
|
|
19421
19499
|
}
|
|
19422
19500
|
}
|
|
@@ -19447,7 +19525,7 @@ async function runLspDoctor(options) {
|
|
|
19447
19525
|
log2.error("Could not find the aft binary in the cache, platform package, PATH, or ~/.cargo/bin.");
|
|
19448
19526
|
return 1;
|
|
19449
19527
|
}
|
|
19450
|
-
const resolvedFile =
|
|
19528
|
+
const resolvedFile = resolve10(file);
|
|
19451
19529
|
const projectRoot = findProjectRootForFile(resolvedFile);
|
|
19452
19530
|
const config = buildConfigureParams(adapter, projectRoot);
|
|
19453
19531
|
const inspectRequest = {
|
|
@@ -19517,13 +19595,18 @@ function renderLspInspection(inputFile, response) {
|
|
|
19517
19595
|
}
|
|
19518
19596
|
const diagnostics = response.diagnostics ?? [];
|
|
19519
19597
|
lines.push("");
|
|
19520
|
-
|
|
19598
|
+
const diagnosticsComplete = response.diagnostics_complete !== false;
|
|
19599
|
+
const observed = response.diagnostics_count ?? diagnostics.length;
|
|
19600
|
+
lines.push(diagnosticsComplete ? `Diagnostics (${observed} found):` : `Diagnostics incomplete (${observed} observed):`);
|
|
19521
19601
|
if (diagnostics.length === 0) {
|
|
19522
|
-
lines.push(" (none)");
|
|
19602
|
+
lines.push(diagnosticsComplete ? " (none)" : " (none observed yet)");
|
|
19523
19603
|
}
|
|
19524
19604
|
for (const diagnostic of diagnostics) {
|
|
19525
19605
|
lines.push(` ${diagnostic.file}:${diagnostic.line}:${diagnostic.column} [${diagnostic.severity}] ${diagnostic.message}`);
|
|
19526
19606
|
}
|
|
19607
|
+
for (const gap of response.diagnostics_gaps ?? []) {
|
|
19608
|
+
lines.push(` Gap: ${gap.server_id}: ${gap.reason}`);
|
|
19609
|
+
}
|
|
19527
19610
|
return lines.join(`
|
|
19528
19611
|
`);
|
|
19529
19612
|
}
|
|
@@ -19582,7 +19665,8 @@ function childDirs(path2) {
|
|
|
19582
19665
|
}
|
|
19583
19666
|
function formatBinary(server) {
|
|
19584
19667
|
if (!server.binary_path) {
|
|
19585
|
-
|
|
19668
|
+
const locations = server.kind === "python" || server.kind === "ty" ? "workspace virtualenv, node_modules/.bin, lsp_paths_extra, or PATH" : "node_modules/.bin, lsp_paths_extra, or PATH";
|
|
19669
|
+
return `${server.binary_name} (NOT FOUND in ${locations})`;
|
|
19586
19670
|
}
|
|
19587
19671
|
return `${server.binary_path} (found via ${server.binary_source})`;
|
|
19588
19672
|
}
|
|
@@ -19660,7 +19744,7 @@ __export(exports_doctor_filters, {
|
|
|
19660
19744
|
});
|
|
19661
19745
|
import { existsSync as existsSync15 } from "node:fs";
|
|
19662
19746
|
import { homedir as homedir16 } from "node:os";
|
|
19663
|
-
import { relative as relative3, resolve as
|
|
19747
|
+
import { relative as relative3, resolve as resolve11 } from "node:path";
|
|
19664
19748
|
function printDoctorFiltersHelp() {
|
|
19665
19749
|
console.log(`Usage: ${CLI} doctor filters [--show <name>] [trust|untrust]`);
|
|
19666
19750
|
console.log("");
|
|
@@ -19695,7 +19779,7 @@ async function runDoctorFilters(options) {
|
|
|
19695
19779
|
log2.error("Could not find the aft binary in the cache, platform package, PATH, or ~/.cargo/bin.");
|
|
19696
19780
|
return 1;
|
|
19697
19781
|
}
|
|
19698
|
-
const projectRoot =
|
|
19782
|
+
const projectRoot = resolve11(process.cwd());
|
|
19699
19783
|
const list = await listFilters(binary, adapter, projectRoot, options.sendRequests ?? sendAftRequests);
|
|
19700
19784
|
if (!list.success) {
|
|
19701
19785
|
log2.error(list.message ?? list.code ?? "list_filters failed");
|
|
@@ -20436,7 +20520,7 @@ var init_lsp_cache = __esm(() => {
|
|
|
20436
20520
|
|
|
20437
20521
|
// src/lib/onnx.ts
|
|
20438
20522
|
import { existsSync as existsSync21, readdirSync as readdirSync10, readlinkSync as readlinkSync2, realpathSync as realpathSync4 } from "node:fs";
|
|
20439
|
-
import { basename as basename3, isAbsolute as isAbsolute6, join as join22, resolve as
|
|
20523
|
+
import { basename as basename3, isAbsolute as isAbsolute6, join as join22, resolve as resolve12, win32 as win322 } from "node:path";
|
|
20440
20524
|
function getOnnxLibraryName() {
|
|
20441
20525
|
if (process.platform === "darwin")
|
|
20442
20526
|
return "libonnxruntime.dylib";
|
|
@@ -20552,7 +20636,7 @@ function findSystemOnnxRuntime2() {
|
|
|
20552
20636
|
const seen = new Set;
|
|
20553
20637
|
const unknownVersionPaths = [];
|
|
20554
20638
|
for (const dir of searchPaths) {
|
|
20555
|
-
let key =
|
|
20639
|
+
let key = resolve12(dir).replace(/[/\\]+$/, "");
|
|
20556
20640
|
if (normalizeCase)
|
|
20557
20641
|
key = key.toLowerCase();
|
|
20558
20642
|
if (seen.has(key))
|
|
@@ -21435,6 +21519,7 @@ __export(exports_doctor, {
|
|
|
21435
21519
|
formatDoctorStorageStatus: () => formatDoctorStorageStatus,
|
|
21436
21520
|
hasDoctorProblems: () => hasDoctorProblems,
|
|
21437
21521
|
logBuildBreakerSuspensions: () => logBuildBreakerSuspensions,
|
|
21522
|
+
renderRemovalSection: () => renderRemovalSection,
|
|
21438
21523
|
runDoctor: () => runDoctor,
|
|
21439
21524
|
runDoctorBuildBreakerReset: () => runDoctorBuildBreakerReset,
|
|
21440
21525
|
shouldSkipDoctorFixConfirmation: () => shouldSkipDoctorFixConfirmation
|
|
@@ -21464,11 +21549,13 @@ async function runDoctor(options) {
|
|
|
21464
21549
|
if (options.clear) {
|
|
21465
21550
|
return runClearFlow(options.argv);
|
|
21466
21551
|
}
|
|
21467
|
-
const
|
|
21552
|
+
const resolveAdapters = options.resolveAdapters ?? resolveAdaptersForCommand;
|
|
21553
|
+
const adapters = await resolveAdapters(options.argv, {
|
|
21468
21554
|
allowMulti: false,
|
|
21469
21555
|
verb: "diagnose"
|
|
21470
21556
|
});
|
|
21471
|
-
const report = await collectDiagnostics(adapters);
|
|
21557
|
+
const report = await (options.collectDiagnostics ?? collectDiagnostics)(adapters);
|
|
21558
|
+
const removalHealth = await (options.collectRemovalHealth ?? collectRemovalHealth)(adapters);
|
|
21472
21559
|
log2.info(`AFT CLI v${report.cliVersion}, AFT binary ${report.binaryVersion ?? "unknown"}`);
|
|
21473
21560
|
if (!report.binaryVersion) {
|
|
21474
21561
|
const hasEnabledRegisteredHarness = report.harnesses.some((h2) => h2.pluginRegistered && h2.aftConfig.enabled);
|
|
@@ -21487,6 +21574,10 @@ async function runDoctor(options) {
|
|
|
21487
21574
|
}
|
|
21488
21575
|
log2.info(`Binary cache: ${report.binaryCache.versions.length} version(s), ${formatBytes(report.binaryCache.totalSize)} at ${report.binaryCache.path}`);
|
|
21489
21576
|
logBuildBreakerSuspensions(report);
|
|
21577
|
+
log2.step("If you remove AFT");
|
|
21578
|
+
for (const line of renderRemovalSection(removalHealth)) {
|
|
21579
|
+
log2.info(` ${line}`);
|
|
21580
|
+
}
|
|
21490
21581
|
const npmCount = report.lspCache.npm.entries.length;
|
|
21491
21582
|
const ghCount = report.lspCache.github.entries.length;
|
|
21492
21583
|
if (npmCount + ghCount > 0) {
|
|
@@ -21552,6 +21643,84 @@ async function runDoctor(options) {
|
|
|
21552
21643
|
outro("Everything looks good.");
|
|
21553
21644
|
return 0;
|
|
21554
21645
|
}
|
|
21646
|
+
async function collectRemovalHealth(adapters) {
|
|
21647
|
+
const adapter = adapters[0];
|
|
21648
|
+
if (!adapter) {
|
|
21649
|
+
return { available: false, message: "no harness storage root was selected" };
|
|
21650
|
+
}
|
|
21651
|
+
const binary = findAftBinary(getSelfVersion());
|
|
21652
|
+
if (!binary) {
|
|
21653
|
+
return { available: false, message: "the aft binary could not be found" };
|
|
21654
|
+
}
|
|
21655
|
+
try {
|
|
21656
|
+
const response = await sendAftRequest(binary, {
|
|
21657
|
+
id: "doctor-removal-status",
|
|
21658
|
+
command: "status",
|
|
21659
|
+
removal_storage_dir: adapter.getStorageDir()
|
|
21660
|
+
});
|
|
21661
|
+
return coerceRemovalHealth(response);
|
|
21662
|
+
} catch (error2) {
|
|
21663
|
+
return {
|
|
21664
|
+
available: false,
|
|
21665
|
+
message: error2 instanceof Error ? error2.message : String(error2)
|
|
21666
|
+
};
|
|
21667
|
+
}
|
|
21668
|
+
}
|
|
21669
|
+
function coerceRemovalHealth(response) {
|
|
21670
|
+
if (!response.success) {
|
|
21671
|
+
return { available: false, message: response.message ?? response.code ?? "status failed" };
|
|
21672
|
+
}
|
|
21673
|
+
const raw = response.removal;
|
|
21674
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
21675
|
+
return { available: false, message: "the aft binary did not return removal state" };
|
|
21676
|
+
}
|
|
21677
|
+
const removal = raw;
|
|
21678
|
+
if (removal.available !== true) {
|
|
21679
|
+
return {
|
|
21680
|
+
available: false,
|
|
21681
|
+
message: typeof removal.message === "string" ? removal.message : "removal state is unavailable"
|
|
21682
|
+
};
|
|
21683
|
+
}
|
|
21684
|
+
const usageWindowDays = nonNegativeInteger(removal.usage_window_days);
|
|
21685
|
+
const projectRootsServed = nonNegativeInteger(removal.project_roots_served);
|
|
21686
|
+
const sessionsServed = nonNegativeInteger(removal.sessions_served);
|
|
21687
|
+
const runningBackgroundTasks = nonNegativeInteger(removal.running_background_tasks);
|
|
21688
|
+
const undoHistorySessions = nonNegativeInteger(removal.undo_history_sessions);
|
|
21689
|
+
if (usageWindowDays === null || projectRootsServed === null || sessionsServed === null || runningBackgroundTasks === null || undoHistorySessions === null || typeof removal.project_roots_source !== "string") {
|
|
21690
|
+
return { available: false, message: "the aft binary returned incomplete removal state" };
|
|
21691
|
+
}
|
|
21692
|
+
return {
|
|
21693
|
+
available: true,
|
|
21694
|
+
usageWindowDays,
|
|
21695
|
+
projectRootsServed,
|
|
21696
|
+
sessionsServed,
|
|
21697
|
+
projectRootsSource: removal.project_roots_source,
|
|
21698
|
+
runningBackgroundTasks,
|
|
21699
|
+
undoHistorySessions
|
|
21700
|
+
};
|
|
21701
|
+
}
|
|
21702
|
+
function nonNegativeInteger(value) {
|
|
21703
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
21704
|
+
}
|
|
21705
|
+
function renderRemovalSection(health) {
|
|
21706
|
+
if (!health.available) {
|
|
21707
|
+
return [`usage and deferred work: unavailable (${health.message ?? "unknown error"})`];
|
|
21708
|
+
}
|
|
21709
|
+
const usageWindowDays = health.usageWindowDays ?? 7;
|
|
21710
|
+
const projectRootsServed = health.projectRootsServed ?? 0;
|
|
21711
|
+
const sessionsServed = health.sessionsServed ?? 0;
|
|
21712
|
+
const runningBackgroundTasks = health.runningBackgroundTasks ?? 0;
|
|
21713
|
+
const undoHistorySessions = health.undoHistorySessions ?? 0;
|
|
21714
|
+
return [
|
|
21715
|
+
`last ${usageWindowDays} days: ${projectRootsServed} ${plural(projectRootsServed, "project root")} served (approx. from durable task/backup project keys; root paths are not retained)`,
|
|
21716
|
+
`last ${usageWindowDays} days: ${sessionsServed} ${plural(sessionsServed, "session")} served (durable task/backup activity)`,
|
|
21717
|
+
runningBackgroundTasks === 0 ? "no running tasks" : `${runningBackgroundTasks} running background ${plural(runningBackgroundTasks, "task")} would orphan`,
|
|
21718
|
+
undoHistorySessions === 0 ? "no undo history recorded" : `undo history for ${undoHistorySessions} ${plural(undoHistorySessions, "session")} becomes unreachable (files themselves are untouched)`
|
|
21719
|
+
];
|
|
21720
|
+
}
|
|
21721
|
+
function plural(count, singular) {
|
|
21722
|
+
return count === 1 ? singular : `${singular}s`;
|
|
21723
|
+
}
|
|
21555
21724
|
function hasDoctorProblems(report) {
|
|
21556
21725
|
return collectDiagnosticIssues(report).some((issue) => issue.severity !== "info") || (report.buildBreakerSuspensions?.length ?? 0) > 0;
|
|
21557
21726
|
}
|
|
@@ -22305,6 +22474,7 @@ https://github.com/cortexkit/aft/issues/new and paste the contents of ${outPath}
|
|
|
22305
22474
|
var DOCTOR_CLEAR_TARGET_OPTIONS, DOCTOR_FORCE_CLEAR_TARGETS;
|
|
22306
22475
|
var init_doctor = __esm(async () => {
|
|
22307
22476
|
init_dist2();
|
|
22477
|
+
init_aft_bridge();
|
|
22308
22478
|
init_binary_cache();
|
|
22309
22479
|
init_bridge_tool_failures();
|
|
22310
22480
|
init_build_breaker();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft",
|
|
3
|
-
"version": "0.52.
|
|
3
|
+
"version": "0.52.2",
|
|
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.52.
|
|
27
|
+
"@cortexkit/aft-bridge": "0.52.2",
|
|
28
28
|
"comment-json": "^4.6.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|