@cortexkit/aft 0.52.1 → 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.
@@ -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;AAU3D,OAAO,EAGL,KAAK,gBAAgB,EAKtB,MAAM,uBAAuB,CAAC;AAe/B,OAAO,EAAE,KAAK,WAAW,EAAkB,MAAM,qBAAqB,CAAC;AAOvE,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;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,QAAQ,CAAC,EAAE;QACT,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;KAChB,CAA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,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"}
@@ -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,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAKrE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,cAAc,CAAC;IACpC,YAAY,CAAC,EAAE,OAAO,eAAe,CAAC;IACtC,UAAU,CAAC,EAAE,OAAO,aAAa,CAAC;IAClC,eAAe,CAAC,EAAE,OAAO,yBAAyB,CAAC;CACpD;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAA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,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/durable-log.js
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 { dirname, join as join5 } from "node:path";
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
- if (process.env.XDG_DATA_HOME)
2590
- return process.env.XDG_DATA_HOME;
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
- if (process.env.AFT_CACHE_DIR)
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((resolve3, reject) => {
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
- resolve3(new SubcSocket(sock));
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((resolve3, reject) => {
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: resolve3, reject, timer };
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((resolve3, reject) => {
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
- resolve3();
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((resolve3, reject) => {
3486
+ const closed = new Promise((resolve4, reject) => {
3465
3487
  if (this.closedErr) {
3466
3488
  reject(this.closedErr);
3467
3489
  return;
3468
3490
  }
3469
- resolveClosed = resolve3;
3491
+ resolveClosed = resolve4;
3470
3492
  subscriptionPending = {
3471
3493
  handle,
3472
- resolve: () => resolve3(),
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((resolve3) => {
3583
+ waiters.push(new Promise((resolve4) => {
3562
3584
  const previous = pending.onSettle;
3563
3585
  pending.onSettle = () => {
3564
3586
  previous?.();
3565
- resolve3();
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((resolve3, reject) => {
3643
+ return new Promise((resolve4, reject) => {
3622
3644
  const ms = timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
3623
3645
  const pending = {
3624
3646
  handle,
3625
- resolve: resolve3,
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((resolve3, reject) => {
3721
+ return new Promise((resolve4, reject) => {
3700
3722
  const ms = timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
3701
3723
  const pending = {
3702
3724
  handle,
3703
- resolve: resolve3,
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((resolve3) => setTimeout(resolve3, ms))),
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 resolve3 } from "node:path";
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 = resolve3(trimmed);
4696
+ canonical = resolve4(trimmed);
4675
4697
  }
4676
4698
  return normalizeWindowsRoot(canonical);
4677
4699
  }
@@ -5106,8 +5128,8 @@ class SubcTransportPool {
5106
5128
  this.connectFn = options.connect ?? ((opts) => SubcClient.connect(opts));
5107
5129
  this.onBgEventsNudge = options.onBgEventsNudge;
5108
5130
  this.onBgEventsNudgeRef = options.onBgEventsNudgeRef;
5109
- this.bgBackoffSleep = options.bgBackoffSleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
5110
- this.routeRetrySleep = options.routeRetrySleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
5131
+ this.bgBackoffSleep = options.bgBackoffSleep ?? ((ms) => new Promise((resolve5) => setTimeout(resolve5, ms)));
5132
+ this.routeRetrySleep = options.routeRetrySleep ?? ((ms) => new Promise((resolve5) => setTimeout(resolve5, ms)));
5111
5133
  this.bgDispatchProbeIntervalMs = options.bgDispatchProbeIntervalMs ?? BG_DISPATCH_PROBE_INTERVAL_MS;
5112
5134
  const lifecycle = options.lifecycle;
5113
5135
  const demandCheck = options.lifecycleDemandCheck ?? options.demandCheck ?? lifecycle?.demandCheck;
@@ -6101,7 +6123,7 @@ function stripJsoncSymbols(value) {
6101
6123
  // ../aft-bridge/dist/paths.js
6102
6124
  import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync } from "node:fs";
6103
6125
  import { homedir as homedir6 } from "node:os";
6104
- import { dirname as dirname2, isAbsolute as isAbsolute2, join as join6, resolve as resolve4 } from "node:path";
6126
+ import { dirname as dirname2, isAbsolute as isAbsolute2, join as join6, resolve as resolve5 } from "node:path";
6105
6127
  function homeDir3() {
6106
6128
  if (process.platform === "win32")
6107
6129
  return process.env.USERPROFILE || process.env.HOME || homedir6();
@@ -6116,7 +6138,7 @@ function configHome() {
6116
6138
  function legacyOpenCodeConfigDir() {
6117
6139
  const envDir = process.env.OPENCODE_CONFIG_DIR?.trim();
6118
6140
  if (envDir)
6119
- return resolve4(envDir);
6141
+ return resolve5(envDir);
6120
6142
  return join6(configHome(), "opencode");
6121
6143
  }
6122
6144
  function legacyPiAgentDir() {
@@ -6471,7 +6493,7 @@ var init_resolver = __esm(() => {
6471
6493
  import { spawnSync as spawnSync2 } from "node:child_process";
6472
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";
6473
6495
  import { homedir as homedir8, tmpdir } from "node:os";
6474
- import { basename, dirname as dirname3, join as join8, resolve as resolve5 } from "node:path";
6496
+ import { basename, dirname as dirname3, join as join8, resolve as resolve6 } from "node:path";
6475
6497
  function dataHome2() {
6476
6498
  if (process.env.XDG_DATA_HOME)
6477
6499
  return process.env.XDG_DATA_HOME;
@@ -6490,9 +6512,6 @@ function resolveLegacyStorageRoot(harness) {
6490
6512
  return join8(homeDir4(), ".pi", "agent", "aft");
6491
6513
  return join8(dataHome2(), "opencode", "storage", "plugin", "aft");
6492
6514
  }
6493
- function resolveCortexKitStorageRoot() {
6494
- return join8(dataHome2(), "cortexkit", "aft");
6495
- }
6496
6515
  function stripJsoncForParse(input) {
6497
6516
  let out = "";
6498
6517
  let inString = false;
@@ -6760,8 +6779,8 @@ function visibleConfigMigrationWarning(scope, targetPath, paths, reason) {
6760
6779
  }
6761
6780
  function migrateAftConfigFile(opts) {
6762
6781
  const warnings = [];
6763
- const resolvedTarget = resolve5(opts.targetPath);
6764
- const existingSources = opts.legacySources.filter((source) => existsSync6(source.path) && resolve5(source.path) !== resolvedTarget);
6782
+ const resolvedTarget = resolve6(opts.targetPath);
6783
+ const existingSources = opts.legacySources.filter((source) => existsSync6(source.path) && resolve6(source.path) !== resolvedTarget);
6765
6784
  const info = opts.logger?.info ?? opts.logger?.log;
6766
6785
  if (existingSources.length === 0) {
6767
6786
  return { migrated: false, conflict: false, targetPath: opts.targetPath, warnings };
@@ -6923,6 +6942,8 @@ var spawnSyncForMigration, TARGET_MARKER = ".migrated_from_legacy", DEFAULT_TIME
6923
6942
  var init_migration = __esm(() => {
6924
6943
  init_paths();
6925
6944
  init_resolver();
6945
+ init_storage_paths();
6946
+ init_storage_paths();
6926
6947
  spawnSyncForMigration = spawnSync2;
6927
6948
  DEFAULT_TIMEOUT_MS = 30 * 60 * 1000;
6928
6949
  });
@@ -7065,7 +7086,7 @@ var init_npm_resolver = () => {};
7065
7086
  import { execFileSync as execFileSync2 } from "node:child_process";
7066
7087
  import { createHash as createHash4 } from "node:crypto";
7067
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";
7068
- import { basename as basename2, dirname as dirname5, isAbsolute as isAbsolute4, join as join10, relative as relative2, resolve as resolve6, win32 } from "node:path";
7089
+ import { basename as basename2, dirname as dirname5, isAbsolute as isAbsolute4, join as join10, relative as relative2, resolve as resolve7, win32 } from "node:path";
7069
7090
  import { Readable as Readable2 } from "node:stream";
7070
7091
  import { pipeline as pipeline2 } from "node:stream/promises";
7071
7092
  function getPlatformInfo() {
@@ -7334,7 +7355,7 @@ function findSystemOnnxRuntime(libName) {
7334
7355
  const normalizeCase = process.platform === "win32" || process.platform === "darwin";
7335
7356
  const seen = new Set;
7336
7357
  const uniquePaths = searchPaths.filter((p) => {
7337
- let key = resolve6(p).replace(/[/\\]+$/, "");
7358
+ let key = resolve7(p).replace(/[/\\]+$/, "");
7338
7359
  if (normalizeCase)
7339
7360
  key = key.toLowerCase();
7340
7361
  if (seen.has(key))
@@ -7418,7 +7439,7 @@ function validateExtractedTree(stagingRoot) {
7418
7439
  const lst = lstatSync(fullPath);
7419
7440
  if (lst.isSymbolicLink()) {
7420
7441
  const linkTarget = readlinkSync(fullPath);
7421
- const resolvedTarget = resolve6(dirname5(fullPath), linkTarget);
7442
+ const resolvedTarget = resolve7(dirname5(fullPath), linkTarget);
7422
7443
  const rel2 = relative2(realRoot, resolvedTarget);
7423
7444
  if (rel2.startsWith("..") || isAbsolute4(rel2) || win32.isAbsolute(rel2)) {
7424
7445
  throw new Error(`extracted symlink ${fullPath} points outside staging root: ${linkTarget}`);
@@ -7536,7 +7557,7 @@ function copyOnnxLibraries(info, extractedDir, targetDir, realFiles, symlinks, c
7536
7557
  unlinkSync4(dst);
7537
7558
  } catch {}
7538
7559
  const dstForContainment = join10(targetRoot, link.name);
7539
- const resolvedTarget = resolve6(dirname5(dstForContainment), link.target);
7560
+ const resolvedTarget = resolve7(dirname5(dstForContainment), link.target);
7540
7561
  if (!isPathInsideRoot(targetRoot, resolvedTarget)) {
7541
7562
  const message = `ONNX Runtime symlink ${link.name} points outside install dir: ${link.target}`;
7542
7563
  if (requiredLibs.has(link.name)) {
@@ -8685,7 +8706,7 @@ class RevivableTransportPool {
8685
8706
  const delay = Math.max(0, this.revivalRetryNotBefore - Date.now());
8686
8707
  if (delay > 0) {
8687
8708
  let scheduled;
8688
- scheduled = new Promise((resolve7) => setTimeout(resolve7, delay)).then(() => {
8709
+ scheduled = new Promise((resolve8) => setTimeout(resolve8, delay)).then(() => {
8689
8710
  if (this.revival === scheduled)
8690
8711
  this.revival = null;
8691
8712
  return this.ensureActivePool();
@@ -9245,6 +9266,7 @@ var init_dist2 = __esm(() => {
9245
9266
  init_project_identity();
9246
9267
  init_resolver();
9247
9268
  init_revivable_transport();
9269
+ init_storage_paths();
9248
9270
  init_subc_transport();
9249
9271
  init_transport_factory();
9250
9272
  });
@@ -17321,12 +17343,12 @@ var init_self_version = () => {};
17321
17343
  import { execSync as execSync3 } from "node:child_process";
17322
17344
  import { existsSync as existsSync12, readFileSync as readFileSync8, rmSync as rmSync4, statSync as statSync8 } from "node:fs";
17323
17345
  import { homedir as homedir14 } from "node:os";
17324
- import { dirname as dirname7, join as join15, parse, resolve as resolve7 } from "node:path";
17346
+ import { dirname as dirname7, join as join15, parse, resolve as resolve8 } from "node:path";
17325
17347
  import { fileURLToPath } from "node:url";
17326
17348
  function getOpenCodeConfigDir() {
17327
17349
  const envDir = process.env.OPENCODE_CONFIG_DIR?.trim();
17328
17350
  if (envDir)
17329
- return resolve7(envDir);
17351
+ return resolve8(envDir);
17330
17352
  const xdg = process.env.XDG_CONFIG_HOME || join15(homedir14(), ".config");
17331
17353
  return join15(xdg, "opencode");
17332
17354
  }
@@ -17646,11 +17668,11 @@ var init_opencode = __esm(() => {
17646
17668
  import { execSync as execSync4, spawnSync as spawnSync4 } from "node:child_process";
17647
17669
  import { existsSync as existsSync13, readFileSync as readFileSync9 } from "node:fs";
17648
17670
  import { homedir as homedir15 } from "node:os";
17649
- import { join as join16, resolve as resolve8 } from "node:path";
17671
+ import { join as join16, resolve as resolve9 } from "node:path";
17650
17672
  function getPiAgentDir() {
17651
17673
  const configuredDir = process.env.PI_CODING_AGENT_DIR?.trim();
17652
17674
  if (configuredDir)
17653
- return resolve8(configuredDir);
17675
+ return resolve9(configuredDir);
17654
17676
  const envHome = process.platform === "win32" ? process.env.USERPROFILE : process.env.HOME;
17655
17677
  const home = envHome && envHome.length > 0 ? envHome : homedir15();
17656
17678
  return join16(home, ".pi", "agent");
@@ -19329,8 +19351,15 @@ function isResponseForRequest(parsed, expectedIds) {
19329
19351
  return false;
19330
19352
  return expectedIds.has(id);
19331
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
+ }
19332
19361
  async function sendAftRequests(binaryPath, requests) {
19333
- return new Promise((resolve9, reject) => {
19362
+ return new Promise((resolve10, reject) => {
19334
19363
  const child = spawn3(binaryPath, [], {
19335
19364
  stdio: ["pipe", "pipe", "pipe"]
19336
19365
  });
@@ -19367,7 +19396,7 @@ async function sendAftRequests(binaryPath, requests) {
19367
19396
  const response = parsed;
19368
19397
  responses.push(response);
19369
19398
  if (responses.length === requests.length) {
19370
- finish(() => resolve9(responses));
19399
+ finish(() => resolve10(responses));
19371
19400
  }
19372
19401
  };
19373
19402
  child.stdout.setEncoding("utf-8");
@@ -19448,9 +19477,9 @@ __export(exports_lsp, {
19448
19477
  });
19449
19478
  import { existsSync as existsSync14, readdirSync as readdirSync5, statSync as statSync9 } from "node:fs";
19450
19479
  import { createRequire as createRequire4 } from "node:module";
19451
- import { dirname as dirname8, join as join17, resolve as resolve9 } from "node:path";
19480
+ import { dirname as dirname8, join as join17, resolve as resolve10 } from "node:path";
19452
19481
  function findProjectRootForFile(filePath, fallbackCwd = process.cwd()) {
19453
- const resolvedFile = resolve9(fallbackCwd, filePath);
19482
+ const resolvedFile = resolve10(fallbackCwd, filePath);
19454
19483
  let dir = dirname8(resolvedFile);
19455
19484
  try {
19456
19485
  if (existsSync14(resolvedFile) && statSync9(resolvedFile).isDirectory()) {
@@ -19465,7 +19494,7 @@ function findProjectRootForFile(filePath, fallbackCwd = process.cwd()) {
19465
19494
  }
19466
19495
  const parent = dirname8(dir);
19467
19496
  if (parent === dir)
19468
- return resolve9(fallbackCwd);
19497
+ return resolve10(fallbackCwd);
19469
19498
  dir = parent;
19470
19499
  }
19471
19500
  }
@@ -19496,7 +19525,7 @@ async function runLspDoctor(options) {
19496
19525
  log2.error("Could not find the aft binary in the cache, platform package, PATH, or ~/.cargo/bin.");
19497
19526
  return 1;
19498
19527
  }
19499
- const resolvedFile = resolve9(file);
19528
+ const resolvedFile = resolve10(file);
19500
19529
  const projectRoot = findProjectRootForFile(resolvedFile);
19501
19530
  const config = buildConfigureParams(adapter, projectRoot);
19502
19531
  const inspectRequest = {
@@ -19566,13 +19595,18 @@ function renderLspInspection(inputFile, response) {
19566
19595
  }
19567
19596
  const diagnostics = response.diagnostics ?? [];
19568
19597
  lines.push("");
19569
- lines.push(`Diagnostics (${response.diagnostics_count ?? diagnostics.length} found):`);
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):`);
19570
19601
  if (diagnostics.length === 0) {
19571
- lines.push(" (none)");
19602
+ lines.push(diagnosticsComplete ? " (none)" : " (none observed yet)");
19572
19603
  }
19573
19604
  for (const diagnostic of diagnostics) {
19574
19605
  lines.push(` ${diagnostic.file}:${diagnostic.line}:${diagnostic.column} [${diagnostic.severity}] ${diagnostic.message}`);
19575
19606
  }
19607
+ for (const gap of response.diagnostics_gaps ?? []) {
19608
+ lines.push(` Gap: ${gap.server_id}: ${gap.reason}`);
19609
+ }
19576
19610
  return lines.join(`
19577
19611
  `);
19578
19612
  }
@@ -19631,7 +19665,8 @@ function childDirs(path2) {
19631
19665
  }
19632
19666
  function formatBinary(server) {
19633
19667
  if (!server.binary_path) {
19634
- return `${server.binary_name} (NOT FOUND on PATH or in lsp_paths_extra)`;
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})`;
19635
19670
  }
19636
19671
  return `${server.binary_path} (found via ${server.binary_source})`;
19637
19672
  }
@@ -19709,7 +19744,7 @@ __export(exports_doctor_filters, {
19709
19744
  });
19710
19745
  import { existsSync as existsSync15 } from "node:fs";
19711
19746
  import { homedir as homedir16 } from "node:os";
19712
- import { relative as relative3, resolve as resolve10 } from "node:path";
19747
+ import { relative as relative3, resolve as resolve11 } from "node:path";
19713
19748
  function printDoctorFiltersHelp() {
19714
19749
  console.log(`Usage: ${CLI} doctor filters [--show <name>] [trust|untrust]`);
19715
19750
  console.log("");
@@ -19744,7 +19779,7 @@ async function runDoctorFilters(options) {
19744
19779
  log2.error("Could not find the aft binary in the cache, platform package, PATH, or ~/.cargo/bin.");
19745
19780
  return 1;
19746
19781
  }
19747
- const projectRoot = resolve10(process.cwd());
19782
+ const projectRoot = resolve11(process.cwd());
19748
19783
  const list = await listFilters(binary, adapter, projectRoot, options.sendRequests ?? sendAftRequests);
19749
19784
  if (!list.success) {
19750
19785
  log2.error(list.message ?? list.code ?? "list_filters failed");
@@ -20485,7 +20520,7 @@ var init_lsp_cache = __esm(() => {
20485
20520
 
20486
20521
  // src/lib/onnx.ts
20487
20522
  import { existsSync as existsSync21, readdirSync as readdirSync10, readlinkSync as readlinkSync2, realpathSync as realpathSync4 } from "node:fs";
20488
- import { basename as basename3, isAbsolute as isAbsolute6, join as join22, resolve as resolve11, win32 as win322 } from "node:path";
20523
+ import { basename as basename3, isAbsolute as isAbsolute6, join as join22, resolve as resolve12, win32 as win322 } from "node:path";
20489
20524
  function getOnnxLibraryName() {
20490
20525
  if (process.platform === "darwin")
20491
20526
  return "libonnxruntime.dylib";
@@ -20601,7 +20636,7 @@ function findSystemOnnxRuntime2() {
20601
20636
  const seen = new Set;
20602
20637
  const unknownVersionPaths = [];
20603
20638
  for (const dir of searchPaths) {
20604
- let key = resolve11(dir).replace(/[/\\]+$/, "");
20639
+ let key = resolve12(dir).replace(/[/\\]+$/, "");
20605
20640
  if (normalizeCase)
20606
20641
  key = key.toLowerCase();
20607
20642
  if (seen.has(key))
@@ -21484,6 +21519,7 @@ __export(exports_doctor, {
21484
21519
  formatDoctorStorageStatus: () => formatDoctorStorageStatus,
21485
21520
  hasDoctorProblems: () => hasDoctorProblems,
21486
21521
  logBuildBreakerSuspensions: () => logBuildBreakerSuspensions,
21522
+ renderRemovalSection: () => renderRemovalSection,
21487
21523
  runDoctor: () => runDoctor,
21488
21524
  runDoctorBuildBreakerReset: () => runDoctorBuildBreakerReset,
21489
21525
  shouldSkipDoctorFixConfirmation: () => shouldSkipDoctorFixConfirmation
@@ -21513,11 +21549,13 @@ async function runDoctor(options) {
21513
21549
  if (options.clear) {
21514
21550
  return runClearFlow(options.argv);
21515
21551
  }
21516
- const adapters = await resolveAdaptersForCommand(options.argv, {
21552
+ const resolveAdapters = options.resolveAdapters ?? resolveAdaptersForCommand;
21553
+ const adapters = await resolveAdapters(options.argv, {
21517
21554
  allowMulti: false,
21518
21555
  verb: "diagnose"
21519
21556
  });
21520
- const report = await collectDiagnostics(adapters);
21557
+ const report = await (options.collectDiagnostics ?? collectDiagnostics)(adapters);
21558
+ const removalHealth = await (options.collectRemovalHealth ?? collectRemovalHealth)(adapters);
21521
21559
  log2.info(`AFT CLI v${report.cliVersion}, AFT binary ${report.binaryVersion ?? "unknown"}`);
21522
21560
  if (!report.binaryVersion) {
21523
21561
  const hasEnabledRegisteredHarness = report.harnesses.some((h2) => h2.pluginRegistered && h2.aftConfig.enabled);
@@ -21536,6 +21574,10 @@ async function runDoctor(options) {
21536
21574
  }
21537
21575
  log2.info(`Binary cache: ${report.binaryCache.versions.length} version(s), ${formatBytes(report.binaryCache.totalSize)} at ${report.binaryCache.path}`);
21538
21576
  logBuildBreakerSuspensions(report);
21577
+ log2.step("If you remove AFT");
21578
+ for (const line of renderRemovalSection(removalHealth)) {
21579
+ log2.info(` ${line}`);
21580
+ }
21539
21581
  const npmCount = report.lspCache.npm.entries.length;
21540
21582
  const ghCount = report.lspCache.github.entries.length;
21541
21583
  if (npmCount + ghCount > 0) {
@@ -21601,6 +21643,84 @@ async function runDoctor(options) {
21601
21643
  outro("Everything looks good.");
21602
21644
  return 0;
21603
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
+ }
21604
21724
  function hasDoctorProblems(report) {
21605
21725
  return collectDiagnosticIssues(report).some((issue) => issue.severity !== "info") || (report.buildBreakerSuspensions?.length ?? 0) > 0;
21606
21726
  }
@@ -22354,6 +22474,7 @@ https://github.com/cortexkit/aft/issues/new and paste the contents of ${outPath}
22354
22474
  var DOCTOR_CLEAR_TARGET_OPTIONS, DOCTOR_FORCE_CLEAR_TARGETS;
22355
22475
  var init_doctor = __esm(async () => {
22356
22476
  init_dist2();
22477
+ init_aft_bridge();
22357
22478
  init_binary_cache();
22358
22479
  init_bridge_tool_failures();
22359
22480
  init_build_breaker();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/aft",
3
- "version": "0.52.1",
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.1",
27
+ "@cortexkit/aft-bridge": "0.52.2",
28
28
  "comment-json": "^4.6.2"
29
29
  },
30
30
  "devDependencies": {