@cortexkit/aft 0.54.0 → 0.55.1

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.
@@ -21,11 +21,12 @@ export declare class OpenCodeAdapter implements HarnessAdapter {
21
21
  getLogFile(): string;
22
22
  getInstallHint(): string;
23
23
  clearPluginCache(force: boolean): Promise<{
24
- action: "cleared" | "up_to_date" | "not_found" | "not_applicable" | "error";
24
+ action: "cleared" | "legacy_path_cleared" | "up_to_date" | "not_found" | "not_applicable" | "error";
25
25
  path: string;
26
26
  cached?: string;
27
27
  latest?: string;
28
28
  error?: string;
29
+ legacy_path_cleared?: string;
29
30
  }>;
30
31
  /** Exposed for diagnostic reporting — harness-specific side data. */
31
32
  getOpenCodeCacheDir(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../src/adapters/opencode.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAkIpB,qBAAa,eAAgB,YAAW,cAAc;IACpD,QAAQ,CAAC,IAAI,EAAG,UAAU,CAAU;IACpC,QAAQ,CAAC,WAAW,cAAc;IAClC,QAAQ,CAAC,iBAAiB,6BAAe;IACzC,QAAQ,CAAC,sBAAsB,oCAAgB;IAE/C,WAAW,IAAI,OAAO;IAqBtB,cAAc,IAAI,MAAM,GAAG,IAAI;IAY/B,iBAAiB,IAAI,kBAAkB;IAqBvC,cAAc,IAAI,OAAO;IAOnB,iBAAiB,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAkDrD,iBAAiB,IAAI,OAAO;IAQ5B;;;;OAIG;IACG,oBAAoB,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAwDxD,kBAAkB,IAAI,eAAe;IA0BrC,aAAa,IAAI,MAAM;IAIvB,UAAU,IAAI,MAAM;IAIpB,cAAc,IAAI,MAAM;IAIlB,gBAAgB,CAA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X,gBAAgB,GAChB,OAAO,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;IAgDF,qEAAqE;IACrE,mBAAmB,IAAI,MAAM;IAI7B,mEAAmE;IACnE,uBAAuB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAWlD"}
@@ -82,11 +82,13 @@ export interface HarnessAdapter {
82
82
  * no-op because Pi caches are managed by `pi install` itself.
83
83
  */
84
84
  clearPluginCache(force: boolean): Promise<{
85
- action: "cleared" | "up_to_date" | "not_found" | "not_applicable" | "error";
85
+ action: "cleared" | "legacy_path_cleared" | "up_to_date" | "not_found" | "not_applicable" | "error";
86
86
  path: string;
87
87
  cached?: string;
88
88
  latest?: string;
89
89
  error?: string;
90
+ /** Reports whether the cache location previously used on Windows (`LOCALAPPDATA`) was removed while clearing the current cache. */
91
+ legacy_path_cleared?: string;
90
92
  }>;
91
93
  }
92
94
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/adapters/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC;AAE5C,MAAM,WAAW,kBAAkB;IACjC,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,gFAAgF;IAChF,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAC/C,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAC3C,0FAA0F;IAC1F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB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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;AA0GD,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/index.js CHANGED
@@ -1110,6 +1110,21 @@ var init_bridge = __esm(() => {
1110
1110
  }
1111
1111
  return this.sendWithVersionMismatchRetry(command, dispatchParams, options, true);
1112
1112
  }
1113
+ listenForRequestAbort(requestId, signal) {
1114
+ if (!signal)
1115
+ return () => {};
1116
+ let fired = false;
1117
+ const onAbort = () => {
1118
+ if (fired)
1119
+ return;
1120
+ fired = true;
1121
+ this.send("cancel_request", { id: requestId }, { keepBridgeOnTimeout: true }).catch(() => {});
1122
+ };
1123
+ signal.addEventListener("abort", onAbort, { once: true });
1124
+ if (signal.aborted)
1125
+ onAbort();
1126
+ return () => signal.removeEventListener("abort", onAbort);
1127
+ }
1113
1128
  async toolCall(sessionId, name, rawArgs = {}, options) {
1114
1129
  const params = { name, arguments: rawArgs };
1115
1130
  if (sessionId)
@@ -1132,7 +1147,7 @@ var init_bridge = __esm(() => {
1132
1147
  if (this._shuttingDown) {
1133
1148
  throw new BridgeTransportUnavailableError(`${this.errorPrefix} Bridge is shutting down, cannot send "${command}"`);
1134
1149
  }
1135
- if (Object.hasOwn(params, "id")) {
1150
+ if (Object.hasOwn(params, "id") && command !== "cancel_request") {
1136
1151
  throw new Error("params cannot contain reserved key 'id'");
1137
1152
  }
1138
1153
  const requestSessionId = typeof params.session_id === "string" && params.session_id.length > 0 ? params.session_id : undefined;
@@ -1186,7 +1201,7 @@ var init_bridge = __esm(() => {
1186
1201
  }
1187
1202
  const id = String(this.nextId++);
1188
1203
  let request;
1189
- if (Object.hasOwn(params, "command") || Object.hasOwn(params, "method")) {
1204
+ if (command === "cancel_request" || Object.hasOwn(params, "command") || Object.hasOwn(params, "method")) {
1190
1205
  const nested = { ...params };
1191
1206
  const reserved = {};
1192
1207
  for (const key of ["session_id", "lsp_hints"]) {
@@ -1206,11 +1221,12 @@ var init_bridge = __esm(() => {
1206
1221
  const child = this.process;
1207
1222
  const response = await new Promise((resolve3, reject) => {
1208
1223
  const timer = setTimeout(() => {
1209
- const entry = this.pending.get(id);
1210
- if (!entry)
1224
+ const entry2 = this.pending.get(id);
1225
+ if (!entry2)
1211
1226
  return;
1212
1227
  this.pending.delete(id);
1213
- clearTimeout(entry.timer);
1228
+ clearTimeout(entry2.timer);
1229
+ entry2.onSettled?.();
1214
1230
  if (keepBridgeOnTimeout) {
1215
1231
  const timeoutMsg2 = `Request "${command}" (id=${id}) timed out after ${effectiveTimeoutMs}ms`;
1216
1232
  if (requestSessionId) {
@@ -1218,7 +1234,7 @@ var init_bridge = __esm(() => {
1218
1234
  } else {
1219
1235
  this.warnVia(timeoutMsg2);
1220
1236
  }
1221
- entry.reject(new BridgeTransportTimeoutError(command, effectiveTimeoutMs, `${this.errorPrefix} Request "${command}" (id=${id}) timed out after ${effectiveTimeoutMs}ms`));
1237
+ entry2.reject(new BridgeTransportTimeoutError(command, effectiveTimeoutMs, `${this.errorPrefix} Request "${command}" (id=${id}) timed out after ${effectiveTimeoutMs}ms`));
1222
1238
  return;
1223
1239
  }
1224
1240
  const childActiveSinceRequest = this.lastChildActivityAt > requestSentAt;
@@ -1233,13 +1249,20 @@ var init_bridge = __esm(() => {
1233
1249
  this.warnVia(timeoutMsg);
1234
1250
  }
1235
1251
  if (keepWarm) {
1236
- entry.reject(new Error(`${this.errorPrefix} request "${command}" timed out after ${effectiveTimeoutMs}ms (bridge busy/under load); bridge kept warm — retry`));
1252
+ entry2.reject(new Error(`${this.errorPrefix} request "${command}" timed out after ${effectiveTimeoutMs}ms (bridge busy/under load); bridge kept warm — retry`));
1237
1253
  return;
1238
1254
  }
1239
- entry.reject(new Error(`${this.errorPrefix} Request "${command}" (id=${id}) timed out after ${effectiveTimeoutMs}ms`));
1255
+ entry2.reject(new Error(`${this.errorPrefix} Request "${command}" (id=${id}) timed out after ${effectiveTimeoutMs}ms`));
1240
1256
  this.handleTimeout(requestSessionId);
1241
1257
  }, effectiveTimeoutMs);
1242
- this.pending.set(id, { resolve: resolve3, reject, timer, onProgress: options?.onProgress, command });
1258
+ const entry = {
1259
+ resolve: resolve3,
1260
+ reject,
1261
+ timer,
1262
+ onProgress: options?.onProgress,
1263
+ command
1264
+ };
1265
+ this.pending.set(id, entry);
1243
1266
  if (!child?.stdin?.writable) {
1244
1267
  this.pending.delete(id);
1245
1268
  clearTimeout(timer);
@@ -1253,11 +1276,12 @@ var init_bridge = __esm(() => {
1253
1276
  const handleWriteFailure = (cause) => {
1254
1277
  const writeError = cause instanceof Error ? cause : new Error(String(cause));
1255
1278
  const error2 = new BridgeTransportUnknownOutcomeError(`${this.errorPrefix} Failed to write to stdin: ${writeError.message}`, { cause: writeError });
1256
- const entry = this.pending.get(id);
1257
- if (entry) {
1279
+ const entry2 = this.pending.get(id);
1280
+ if (entry2) {
1258
1281
  this.pending.delete(id);
1259
- clearTimeout(entry.timer);
1260
- entry.reject(error2);
1282
+ clearTimeout(entry2.timer);
1283
+ entry2.onSettled?.();
1284
+ entry2.reject(error2);
1261
1285
  }
1262
1286
  if (this.process === child)
1263
1287
  this.invalidateTransportProcess(error2);
@@ -1270,6 +1294,9 @@ var init_bridge = __esm(() => {
1270
1294
  } catch (err) {
1271
1295
  handleWriteFailure(err);
1272
1296
  }
1297
+ if (this.pending.has(id)) {
1298
+ entry.onSettled = this.listenForRequestAbort(id, options?.abortSignal);
1299
+ }
1273
1300
  });
1274
1301
  if (command === "configure" && response.success === true && options?.markConfiguredOnSuccess !== false) {
1275
1302
  this.configured = true;
@@ -1638,6 +1665,7 @@ var init_bridge = __esm(() => {
1638
1665
  if (requestId && entry) {
1639
1666
  this.pending.delete(requestId);
1640
1667
  clearTimeout(entry.timer);
1668
+ entry.onSettled?.();
1641
1669
  entry.resolve({
1642
1670
  success: false,
1643
1671
  code: "permission_required",
@@ -1679,6 +1707,7 @@ var init_bridge = __esm(() => {
1679
1707
  return;
1680
1708
  this.pending.delete(id);
1681
1709
  clearTimeout(entry.timer);
1710
+ entry.onSettled?.();
1682
1711
  this.consecutiveRequestTimeouts = 0;
1683
1712
  this.scheduleRestartCountReset();
1684
1713
  this.accountForBashTaskResponse(entry.command, response);
@@ -1769,6 +1798,7 @@ var init_bridge = __esm(() => {
1769
1798
  rejectAllPending(error2) {
1770
1799
  for (const [_id, entry] of this.pending) {
1771
1800
  clearTimeout(entry.timer);
1801
+ entry.onSettled?.();
1772
1802
  entry.reject(error2);
1773
1803
  }
1774
1804
  this.pending.clear();
@@ -1795,6 +1825,12 @@ import { join as join5 } from "node:path";
1795
1825
  function homeDir2(env) {
1796
1826
  return (process.platform === "win32" ? env.USERPROFILE || env.HOME : env.HOME) || homedir4();
1797
1827
  }
1828
+ function getOpenCodeCacheRoot(env = process.env, home = homedir4()) {
1829
+ return join5(env.XDG_CACHE_HOME || join5(home, ".cache"), "opencode");
1830
+ }
1831
+ function getOpenCodeConfigRoot(env = process.env, home = homedir4()) {
1832
+ return join5(env.XDG_CONFIG_HOME || join5(home, ".config"), "opencode");
1833
+ }
1798
1834
  function getAftCacheRoot(env = process.env) {
1799
1835
  if (env.AFT_CACHE_DIR)
1800
1836
  return env.AFT_CACHE_DIR;
@@ -6969,7 +7005,7 @@ var init_migration = __esm(() => {
6969
7005
  });
6970
7006
 
6971
7007
  // ../aft-bridge/dist/npm-resolver.js
6972
- import { execFileSync } from "node:child_process";
7008
+ import { spawn as spawn3, spawnSync as spawnSync3 } from "node:child_process";
6973
7009
  import { readdirSync as readdirSync2, statSync as statSync5 } from "node:fs";
6974
7010
  import { homedir as homedir9 } from "node:os";
6975
7011
  import { delimiter as delimiter2, dirname as dirname4, isAbsolute as isAbsolute3, join as join10 } from "node:path";
@@ -7076,6 +7112,181 @@ function resolveNpm(deps = defaultDeps()) {
7076
7112
  }
7077
7113
  return null;
7078
7114
  }
7115
+ function quoteCmdArgument(value) {
7116
+ if (/[\0\r\n"%]/.test(value)) {
7117
+ throw new Error(`npm argument cannot be represented safely for cmd.exe: ${JSON.stringify(value)}`);
7118
+ }
7119
+ return `"${value}"`;
7120
+ }
7121
+ function npmInvocation(resolved, npmArgs, platform = process.platform, env = process.env) {
7122
+ if (platform !== "win32" || !/\.(?:cmd|bat)$/i.test(resolved.command)) {
7123
+ return { command: resolved.command, args: [...npmArgs] };
7124
+ }
7125
+ if (/[\0\r\n"]/.test(resolved.command)) {
7126
+ throw new Error(`npm command cannot be represented safely for cmd.exe: ${JSON.stringify(resolved.command)}`);
7127
+ }
7128
+ const commandEnvName = "AFT_NPM_COMMAND";
7129
+ const quotedArgs = npmArgs.map(quoteCmdArgument);
7130
+ const commandLine = `""%${commandEnvName}%"${quotedArgs.length > 0 ? ` ${quotedArgs.join(" ")}` : ""}"`;
7131
+ return {
7132
+ command: env.ComSpec ?? env.COMSPEC ?? "cmd.exe",
7133
+ args: ["/d", "/s", "/v:off", "/c", commandLine],
7134
+ env: { [commandEnvName]: resolved.command },
7135
+ windowsVerbatimArguments: true,
7136
+ windowsCmdShim: true
7137
+ };
7138
+ }
7139
+ function terminateDirectNpmChild(child, gracePeriodMs) {
7140
+ if (child.exitCode !== null || child.signalCode !== null)
7141
+ return Promise.resolve();
7142
+ return new Promise((resolve7, reject) => {
7143
+ let settled = false;
7144
+ let forceTimer = null;
7145
+ let confirmationTimer = null;
7146
+ let signalFailure = null;
7147
+ const cleanup = () => {
7148
+ if (forceTimer)
7149
+ clearTimeout(forceTimer);
7150
+ if (confirmationTimer)
7151
+ clearTimeout(confirmationTimer);
7152
+ child.removeListener("exit", finish);
7153
+ child.removeListener("error", onChildError);
7154
+ };
7155
+ const finish = () => {
7156
+ if (settled)
7157
+ return;
7158
+ settled = true;
7159
+ cleanup();
7160
+ resolve7();
7161
+ };
7162
+ const fail = () => {
7163
+ if (settled)
7164
+ return;
7165
+ if (child.exitCode !== null || child.signalCode !== null) {
7166
+ finish();
7167
+ return;
7168
+ }
7169
+ settled = true;
7170
+ cleanup();
7171
+ reject(new NpmTerminationUnknownError(signalFailure ?? `direct npm child did not exit after SIGKILL within ${gracePeriodMs}ms`));
7172
+ };
7173
+ const onChildError = (error2) => {
7174
+ signalFailure = `direct npm child error during termination: ${String(error2)}`;
7175
+ };
7176
+ const signal = (value) => {
7177
+ try {
7178
+ if (!child.kill(value)) {
7179
+ signalFailure = `direct npm child rejected ${value ?? "SIGTERM"}`;
7180
+ }
7181
+ } catch (error2) {
7182
+ signalFailure = `direct npm child ${value ?? "SIGTERM"} failed: ${String(error2)}`;
7183
+ }
7184
+ };
7185
+ child.once("exit", finish);
7186
+ child.on("error", onChildError);
7187
+ forceTimer = setTimeout(() => {
7188
+ signal("SIGKILL");
7189
+ confirmationTimer = setTimeout(fail, gracePeriodMs);
7190
+ }, gracePeriodMs);
7191
+ signal();
7192
+ if (child.exitCode !== null || child.signalCode !== null)
7193
+ finish();
7194
+ });
7195
+ }
7196
+ function terminateNpmProcessTree(child, invocation, env = process.env, gracePeriodMs = 5000) {
7197
+ if (!invocation.windowsCmdShim)
7198
+ return terminateDirectNpmChild(child, gracePeriodMs);
7199
+ const exitedSuccessfully = () => child.exitCode === 0 && child.signalCode === null;
7200
+ if (exitedSuccessfully())
7201
+ return Promise.resolve();
7202
+ if (child.pid === undefined) {
7203
+ return Promise.reject(new NpmTerminationUnknownError("cmd.exe child has no process ID"));
7204
+ }
7205
+ return new Promise((resolve7, reject) => {
7206
+ let settled = false;
7207
+ let childExited = child.exitCode !== null || child.signalCode !== null;
7208
+ let treeKillConfirmed = false;
7209
+ let treeKillFailure = null;
7210
+ let killer = null;
7211
+ const timeout = setTimeout(() => {
7212
+ try {
7213
+ killer?.kill();
7214
+ } catch {}
7215
+ if (treeKillConfirmed || exitedSuccessfully()) {
7216
+ settled = true;
7217
+ cleanup();
7218
+ resolve7();
7219
+ return;
7220
+ }
7221
+ fail(treeKillFailure ?? `taskkill.exe did not finish within ${gracePeriodMs}ms`);
7222
+ }, gracePeriodMs);
7223
+ const cleanup = () => {
7224
+ clearTimeout(timeout);
7225
+ child.removeListener("exit", onChildExit);
7226
+ };
7227
+ const succeedIfConfirmed = () => {
7228
+ if (settled || !childExited || !treeKillConfirmed)
7229
+ return;
7230
+ settled = true;
7231
+ cleanup();
7232
+ resolve7();
7233
+ };
7234
+ const fail = (detail) => {
7235
+ if (settled)
7236
+ return;
7237
+ settled = true;
7238
+ cleanup();
7239
+ reject(new NpmTerminationUnknownError(detail));
7240
+ };
7241
+ function onChildExit() {
7242
+ childExited = true;
7243
+ if (treeKillFailure !== null) {
7244
+ if (exitedSuccessfully()) {
7245
+ settled = true;
7246
+ cleanup();
7247
+ resolve7();
7248
+ } else {
7249
+ fail(treeKillFailure);
7250
+ }
7251
+ return;
7252
+ }
7253
+ succeedIfConfirmed();
7254
+ }
7255
+ const recordTreeKillFailure = (detail) => {
7256
+ if (settled)
7257
+ return;
7258
+ if (exitedSuccessfully()) {
7259
+ settled = true;
7260
+ cleanup();
7261
+ resolve7();
7262
+ return;
7263
+ }
7264
+ treeKillFailure = detail;
7265
+ if (childExited)
7266
+ fail(detail);
7267
+ };
7268
+ child.once("exit", onChildExit);
7269
+ const systemRoot = env.SystemRoot ?? env.SYSTEMROOT;
7270
+ const taskkill = systemRoot ? join10(systemRoot, "System32", "taskkill.exe") : "taskkill.exe";
7271
+ try {
7272
+ killer = spawn3(taskkill, ["/pid", String(child.pid), "/t", "/f"], {
7273
+ stdio: "ignore",
7274
+ windowsHide: true
7275
+ });
7276
+ killer.once("error", (error2) => recordTreeKillFailure(`taskkill.exe failed to start: ${String(error2)}`));
7277
+ killer.once("exit", (code) => {
7278
+ if (code !== 0) {
7279
+ recordTreeKillFailure(`taskkill.exe exited with code ${code ?? "unknown"}`);
7280
+ return;
7281
+ }
7282
+ treeKillConfirmed = true;
7283
+ succeedIfConfirmed();
7284
+ });
7285
+ } catch (error2) {
7286
+ recordTreeKillFailure(`taskkill.exe failed to start: ${String(error2)}`);
7287
+ }
7288
+ });
7289
+ }
7079
7290
  function npmSpawnEnv(resolved, baseEnv = process.env) {
7080
7291
  if (!resolved.binDir)
7081
7292
  return { ...baseEnv };
@@ -7088,22 +7299,35 @@ function isNpmAvailable(deps = defaultDeps()) {
7088
7299
  }
7089
7300
  function probeNpmVersion(resolved) {
7090
7301
  try {
7091
- const out = execFileSync(resolved.command, ["--version"], {
7092
- env: npmSpawnEnv(resolved),
7302
+ const invocation = npmInvocation(resolved, ["--version"]);
7303
+ const result = spawnSync3(invocation.command, invocation.args, {
7304
+ env: { ...npmSpawnEnv(resolved), ...invocation.env },
7093
7305
  encoding: "utf-8",
7094
7306
  timeout: 5000,
7095
- stdio: ["ignore", "pipe", "ignore"]
7307
+ stdio: ["ignore", "pipe", "ignore"],
7308
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments
7096
7309
  });
7097
- const v = out.trim();
7098
- return /^\d+\.\d+\.\d+/.test(v) ? v : null;
7310
+ if (result.error || result.status !== 0)
7311
+ return null;
7312
+ const version = result.stdout.trim();
7313
+ return /^\d+\.\d+\.\d+/.test(version) ? version : null;
7099
7314
  } catch {
7100
7315
  return null;
7101
7316
  }
7102
7317
  }
7103
- var init_npm_resolver = () => {};
7318
+ var NpmTerminationUnknownError;
7319
+ var init_npm_resolver = __esm(() => {
7320
+ NpmTerminationUnknownError = class NpmTerminationUnknownError extends Error {
7321
+ code = "npm_termination_unknown";
7322
+ constructor(detail) {
7323
+ super(`npm process-tree termination could not be confirmed: ${detail}`);
7324
+ this.name = "NpmTerminationUnknownError";
7325
+ }
7326
+ };
7327
+ });
7104
7328
 
7105
7329
  // ../aft-bridge/dist/onnx-runtime.js
7106
- import { execFileSync as execFileSync2 } from "node:child_process";
7330
+ import { execFileSync } from "node:child_process";
7107
7331
  import { createHash as createHash4 } from "node:crypto";
7108
7332
  import { chmodSync as chmodSync3, closeSync as closeSync4, copyFileSync as copyFileSync3, createWriteStream as createWriteStream2, existsSync as existsSync8, 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";
7109
7333
  import { basename as basename2, dirname as dirname5, isAbsolute as isAbsolute4, join as join11, relative as relative2, resolve as resolve7, win32 } from "node:path";
@@ -7495,7 +7719,7 @@ async function downloadOnnxRuntime(info, targetDir) {
7495
7719
  const archiveSha256 = sha256File(archivePath);
7496
7720
  log(`ONNX Runtime archive sha256=${archiveSha256}`);
7497
7721
  if (info.archiveType === "tgz") {
7498
- execFileSync2("tar", ["xzf", archivePath, "-C", tmpDir], {
7722
+ execFileSync("tar", ["xzf", archivePath, "-C", tmpDir], {
7499
7723
  stdio: "pipe",
7500
7724
  timeout: 120000
7501
7725
  });
@@ -7605,13 +7829,13 @@ function copyOnnxLibraries(info, extractedDir, targetDir, realFiles, symlinks, c
7605
7829
  }
7606
7830
  async function extractZipArchive(archivePath, destinationDir) {
7607
7831
  if (process.platform === "win32") {
7608
- execFileSync2("tar.exe", ["-xf", archivePath, "-C", destinationDir], {
7832
+ execFileSync("tar.exe", ["-xf", archivePath, "-C", destinationDir], {
7609
7833
  stdio: "pipe",
7610
7834
  timeout: 120000
7611
7835
  });
7612
7836
  return;
7613
7837
  }
7614
- execFileSync2("unzip", ["-q", archivePath, "-d", destinationDir], {
7838
+ execFileSync("unzip", ["-q", archivePath, "-d", destinationDir], {
7615
7839
  stdio: "pipe",
7616
7840
  timeout: 120000
7617
7841
  });
@@ -7742,7 +7966,7 @@ function isWindowsProcessAlive(pid) {
7742
7966
  if (!Number.isInteger(pid) || pid <= 0)
7743
7967
  return false;
7744
7968
  try {
7745
- const output = execFileSync2("tasklist.exe", ["/FI", `PID eq ${pid}`, "/FO", "CSV", "/NH"], {
7969
+ const output = execFileSync("tasklist.exe", ["/FI", `PID eq ${pid}`, "/FO", "CSV", "/NH"], {
7746
7970
  encoding: "utf8",
7747
7971
  timeout: 2000,
7748
7972
  windowsHide: true
@@ -7862,6 +8086,10 @@ function pathValue(record, property) {
7862
8086
  return value;
7863
8087
  }
7864
8088
  function normalizeAliasPair(record, canonical, legacy, required) {
8089
+ if (isNullOrEmptyString(record[canonical]))
8090
+ delete record[canonical];
8091
+ if (isNullOrEmptyString(record[legacy]))
8092
+ delete record[legacy];
7865
8093
  const hasCanonical = hasOwn(record, canonical);
7866
8094
  const hasLegacy = hasOwn(record, legacy);
7867
8095
  if (!hasCanonical && !hasLegacy) {
@@ -7893,8 +8121,13 @@ function normalizeAliasPair(record, canonical, legacy, required) {
7893
8121
  delete record[legacy];
7894
8122
  }
7895
8123
  function validateOptionalCanonicalPath(record, property) {
7896
- if (hasOwn(record, property))
7897
- pathValue(record, property);
8124
+ if (!hasOwn(record, property))
8125
+ return;
8126
+ if (isNullOrEmptyString(record[property])) {
8127
+ delete record[property];
8128
+ return;
8129
+ }
8130
+ pathValue(record, property);
7898
8131
  }
7899
8132
  function normalizeZoomTargets(record) {
7900
8133
  if (!hasOwn(record, "targets"))
@@ -8031,6 +8264,10 @@ function prepareCanonicalEditArguments(toolName, rawArguments) {
8031
8264
  return record;
8032
8265
  }
8033
8266
  function normalizeEditPathAlias(record) {
8267
+ if (isNullOrEmptyString(record.path))
8268
+ delete record.path;
8269
+ if (isNullOrEmptyString(record.filePath))
8270
+ delete record.filePath;
8034
8271
  const hasCanonical = hasOwn(record, "path");
8035
8272
  const hasLegacy = hasOwn(record, "filePath");
8036
8273
  if (!hasCanonical && !hasLegacy)
@@ -8056,7 +8293,7 @@ function normalizeEditPathAlias(record) {
8056
8293
  }
8057
8294
  }
8058
8295
  function validateEditPath(record) {
8059
- if (!hasOwn(record, "path")) {
8296
+ if (!hasOwn(record, "path") || isNullOrEmptyString(record.path)) {
8060
8297
  throw new InvalidRequestError("'path' is required");
8061
8298
  }
8062
8299
  pathValue(record, "path");
@@ -8116,10 +8353,13 @@ function isEditSentinelItem(item) {
8116
8353
  if (record.oldString === null && ["startLine", "endLine"].some((key) => hasOwn(record, key) && record[key] !== null)) {
8117
8354
  return false;
8118
8355
  }
8119
- const newStringEmpty = !hasOwn(record, "newString") || isNullOrEmptyString(record.newString);
8120
- if (!newStringEmpty)
8121
- return false;
8122
- return !hasOwn(record, "content") || isNullOrEmptyString(record.content);
8356
+ return (!hasOwn(record, "newString") || isNullOrEmptyString(record.newString)) && (!hasOwn(record, "content") || isNullOrEmptyString(record.content)) && (!hasOwn(record, "replaceAll") || record.replaceAll === null || record.replaceAll === false) && isDefaultOccurrence(record.occurrence);
8357
+ }
8358
+ function hasMeaningfulFindPayload(item) {
8359
+ return isNonEmptyString(item.oldString);
8360
+ }
8361
+ function isDefaultOccurrence(value) {
8362
+ return value === undefined || value === null || value === 1;
8123
8363
  }
8124
8364
  function normalizeEditArraySentinels(record) {
8125
8365
  const value = record.edits;
@@ -8172,8 +8412,8 @@ function parseEditArray(value) {
8172
8412
  }
8173
8413
  return value;
8174
8414
  }
8175
- function stripLineRangeSentinels(item) {
8176
- const hasRangeField = ["startLine", "endLine", "content"].some((key) => hasOwn(item, key));
8415
+ function normalizeEditItemSentinels(item) {
8416
+ const hadRangeFields = ["startLine", "endLine", "content"].some((key) => hasOwn(item, key));
8177
8417
  for (const key of [
8178
8418
  "oldString",
8179
8419
  "newString",
@@ -8186,7 +8426,19 @@ function stripLineRangeSentinels(item) {
8186
8426
  if (item[key] === null)
8187
8427
  delete item[key];
8188
8428
  }
8189
- if (!hasRangeField)
8429
+ const contentIsEmpty = item.content === "";
8430
+ if (hasMeaningfulFindPayload(item) && (!hasOwn(item, "content") || contentIsEmpty)) {
8431
+ for (const key of ["startLine", "endLine", "content"])
8432
+ delete item[key];
8433
+ if (hadRangeFields) {
8434
+ if (item.replaceAll === false)
8435
+ delete item.replaceAll;
8436
+ if (hasOwn(item, "occurrence") && isDefaultOccurrence(item.occurrence))
8437
+ delete item.occurrence;
8438
+ }
8439
+ return;
8440
+ }
8441
+ if (!isNonEmptyString(item.content))
8190
8442
  return;
8191
8443
  if (item.oldString === "")
8192
8444
  delete item.oldString;
@@ -8194,7 +8446,7 @@ function stripLineRangeSentinels(item) {
8194
8446
  delete item.newString;
8195
8447
  if (item.replaceAll === false)
8196
8448
  delete item.replaceAll;
8197
- if (item.occurrence === 1)
8449
+ if (hasOwn(item, "occurrence") && isDefaultOccurrence(item.occurrence))
8198
8450
  delete item.occurrence;
8199
8451
  }
8200
8452
  function normalizeEditItem(value, index) {
@@ -8205,7 +8457,7 @@ function normalizeEditItem(value, index) {
8205
8457
  const item = copyOwnProperties(source);
8206
8458
  normalizeItemAlias(item, "oldString", "oldText");
8207
8459
  normalizeItemAlias(item, "newString", "newText");
8208
- stripLineRangeSentinels(item);
8460
+ normalizeEditItemSentinels(item);
8209
8461
  const hasFindField = ["oldString", "newString", "replaceAll", "occurrence"].some((key) => hasOwn(item, key));
8210
8462
  const hasRangeField = ["startLine", "endLine", "content"].some((key) => hasOwn(item, key));
8211
8463
  if (hasFindField && hasRangeField) {
@@ -9187,6 +9439,7 @@ __export(exports_dist, {
9187
9439
  HomeProjectRootError: () => HomeProjectRootError,
9188
9440
  InvalidRequestError: () => InvalidRequestError,
9189
9441
  LONG_RUNNING_COMMAND_TIMEOUT_MS: () => LONG_RUNNING_COMMAND_TIMEOUT_MS,
9442
+ NpmTerminationUnknownError: () => NpmTerminationUnknownError,
9190
9443
  OPENCODE_ONLY_KEYS: () => OPENCODE_ONLY_KEYS,
9191
9444
  PI_ONLY_KEYS: () => PI_ONLY_KEYS,
9192
9445
  PLAIN_CALLGRAPH_THEME: () => PLAIN_CALLGRAPH_THEME,
@@ -9236,6 +9489,8 @@ __export(exports_dist, {
9236
9489
  getCachedBinaryPath: () => getCachedBinaryPath,
9237
9490
  getManualInstallHint: () => getManualInstallHint,
9238
9491
  getMigrationStatus: () => getMigrationStatus,
9492
+ getOpenCodeCacheRoot: () => getOpenCodeCacheRoot,
9493
+ getOpenCodeConfigRoot: () => getOpenCodeConfigRoot,
9239
9494
  inlineUserConfigTier: () => inlineUserConfigTier,
9240
9495
  isBashTransportDeadError: () => isBashTransportDeadError,
9241
9496
  isBridgeTransportTimeout: () => isBridgeTransportTimeout,
@@ -9251,6 +9506,7 @@ __export(exports_dist, {
9251
9506
  maybeAppendConflictsHint: () => maybeAppendConflictsHint,
9252
9507
  maybeAppendGrepSearchHint: () => maybeAppendGrepSearchHint,
9253
9508
  migrateAftConfigFile: () => migrateAftConfigFile,
9509
+ npmInvocation: () => npmInvocation,
9254
9510
  npmSpawnEnv: () => npmSpawnEnv,
9255
9511
  platformKey: () => platformKey,
9256
9512
  prepareCanonicalEditArguments: () => prepareCanonicalEditArguments,
@@ -9278,6 +9534,7 @@ __export(exports_dist, {
9278
9534
  stripHarnessSpecificConfigKeys: () => stripHarnessSpecificConfigKeys,
9279
9535
  stripJsoncSymbols: () => stripJsoncSymbols,
9280
9536
  tagStderrLine: () => tagStderrLine,
9537
+ terminateNpmProcessTree: () => terminateNpmProcessTree,
9281
9538
  timeoutForCommand: () => timeoutForCommand,
9282
9539
  toolErrorFromResponse: () => toolErrorFromResponse,
9283
9540
  unwrapRustZoomBatchEnvelope: () => unwrapRustZoomBatchEnvelope
@@ -9339,7 +9596,7 @@ var init_paths2 = __esm(() => {
9339
9596
  });
9340
9597
 
9341
9598
  // src/lib/binary-probe.ts
9342
- import { execSync as execSync2, spawnSync as spawnSync3 } from "node:child_process";
9599
+ import { execSync as execSync2, spawnSync as spawnSync4 } from "node:child_process";
9343
9600
  import { existsSync as existsSync10 } from "node:fs";
9344
9601
  import { createRequire as createRequire2 } from "node:module";
9345
9602
  import { homedir as homedir13 } from "node:os";
@@ -9397,7 +9654,7 @@ function probeAftBinary(preferredVersion) {
9397
9654
  try {
9398
9655
  if (!existsSync10(candidate))
9399
9656
  continue;
9400
- const result = spawnSync3(candidate, ["--version"], {
9657
+ const result = spawnSync4(candidate, ["--version"], {
9401
9658
  stdio: ["ignore", "pipe", "pipe"],
9402
9659
  encoding: "utf-8",
9403
9660
  timeout: 5000,
@@ -17388,18 +17645,28 @@ function getOpenCodeConfigDir() {
17388
17645
  const envDir = process.env.OPENCODE_CONFIG_DIR?.trim();
17389
17646
  if (envDir)
17390
17647
  return resolve8(envDir);
17391
- const xdg = process.env.XDG_CONFIG_HOME || join16(homedir14(), ".config");
17392
- return join16(xdg, "opencode");
17648
+ return getOpenCodeConfigRoot();
17393
17649
  }
17394
- function getOpenCodeCacheDir() {
17395
- const xdg = process.env.XDG_CACHE_HOME;
17396
- if (xdg)
17397
- return join16(xdg, "opencode");
17398
- if (process.platform === "win32") {
17399
- const localAppData = process.env.LOCALAPPDATA ?? join16(homedir14(), "AppData", "Local");
17400
- return join16(localAppData, "opencode");
17650
+ function getLegacyOpenCodePluginCachePath(primaryPath) {
17651
+ if (process.platform !== "win32")
17652
+ return null;
17653
+ const localAppData = process.env.LOCALAPPDATA ?? join16(homedir14(), "AppData", "Local");
17654
+ const legacyPath = join16(localAppData, "opencode", "packages", PLUGIN_ENTRY);
17655
+ return resolve8(legacyPath) === resolve8(primaryPath) ? null : legacyPath;
17656
+ }
17657
+ function clearLegacyOpenCodePluginCache(primaryPath) {
17658
+ const legacyPath = getLegacyOpenCodePluginCachePath(primaryPath);
17659
+ if (!legacyPath || !existsSync13(legacyPath))
17660
+ return { clearedPath: null };
17661
+ try {
17662
+ rmSync4(legacyPath, { recursive: true, force: true });
17663
+ return { clearedPath: legacyPath };
17664
+ } catch (error2) {
17665
+ return { clearedPath: null, error: error2 instanceof Error ? error2.message : String(error2) };
17401
17666
  }
17402
- return join16(homedir14(), ".cache", "opencode");
17667
+ }
17668
+ function getOpenCodeCacheDir() {
17669
+ return getOpenCodeCacheRoot();
17403
17670
  }
17404
17671
  function hasOpenCodeCli() {
17405
17672
  try {
@@ -17649,8 +17916,21 @@ class OpenCodeAdapter {
17649
17916
  }
17650
17917
  async clearPluginCache(force) {
17651
17918
  const info = this.getPluginCacheInfo();
17919
+ const clearLegacy = force ? clearLegacyOpenCodePluginCache(info.path) : { clearedPath: null };
17920
+ if (clearLegacy.error) {
17921
+ return {
17922
+ action: "error",
17923
+ path: info.path,
17924
+ error: `Could not clear legacy OpenCode cache: ${clearLegacy.error}`,
17925
+ ...clearLegacy.clearedPath ? { legacy_path_cleared: clearLegacy.clearedPath } : {}
17926
+ };
17927
+ }
17652
17928
  if (!info.exists) {
17653
- return { action: "not_found", path: info.path };
17929
+ return clearLegacy.clearedPath ? {
17930
+ action: "legacy_path_cleared",
17931
+ path: clearLegacy.clearedPath,
17932
+ legacy_path_cleared: clearLegacy.clearedPath
17933
+ } : { action: "not_found", path: info.path };
17654
17934
  }
17655
17935
  if (!force && info.cached && info.cached === info.latest) {
17656
17936
  return {
@@ -17666,7 +17946,8 @@ class OpenCodeAdapter {
17666
17946
  action: "cleared",
17667
17947
  path: info.path,
17668
17948
  cached: info.cached,
17669
- latest: info.latest
17949
+ latest: info.latest,
17950
+ ...clearLegacy.clearedPath ? { legacy_path_cleared: clearLegacy.clearedPath } : {}
17670
17951
  };
17671
17952
  } catch (error2) {
17672
17953
  return {
@@ -17704,7 +17985,7 @@ var init_opencode = __esm(() => {
17704
17985
  });
17705
17986
 
17706
17987
  // src/adapters/pi.ts
17707
- import { execSync as execSync4, spawnSync as spawnSync4 } from "node:child_process";
17988
+ import { execSync as execSync4, spawnSync as spawnSync5 } from "node:child_process";
17708
17989
  import { existsSync as existsSync14, readFileSync as readFileSync9 } from "node:fs";
17709
17990
  import { homedir as homedir15 } from "node:os";
17710
17991
  import { join as join17, resolve as resolve9 } from "node:path";
@@ -17813,7 +18094,7 @@ class PiAdapter {
17813
18094
  }
17814
18095
  getHostVersion() {
17815
18096
  try {
17816
- const result = spawnSync4("pi", ["--version"], {
18097
+ const result = spawnSync5("pi", ["--version"], {
17817
18098
  stdio: ["ignore", "pipe", "pipe"],
17818
18099
  encoding: "utf-8",
17819
18100
  timeout: 5000
@@ -19384,14 +19665,14 @@ var exports_commands = {};
19384
19665
  __export(exports_commands, {
19385
19666
  runIndex: () => runIndex
19386
19667
  });
19387
- import { spawnSync as spawnSync5 } from "node:child_process";
19668
+ import { spawnSync as spawnSync6 } from "node:child_process";
19388
19669
  function runIndex(argv) {
19389
19670
  const binary = findAftBinary();
19390
19671
  if (!binary) {
19391
19672
  console.error("aft index requires a native AFT binary; run `aft doctor` to install or repair it.");
19392
19673
  return 1;
19393
19674
  }
19394
- const result = spawnSync5(binary, ["index", ...argv], {
19675
+ const result = spawnSync6(binary, ["index", ...argv], {
19395
19676
  stdio: "inherit",
19396
19677
  env: process.env
19397
19678
  });
@@ -19406,7 +19687,7 @@ var init_commands = __esm(async () => {
19406
19687
  });
19407
19688
 
19408
19689
  // src/lib/aft-bridge.ts
19409
- import { spawn as spawn3 } from "node:child_process";
19690
+ import { spawn as spawn4 } from "node:child_process";
19410
19691
  function isResponseForRequest(parsed, expectedIds) {
19411
19692
  if (!parsed || typeof parsed !== "object")
19412
19693
  return false;
@@ -19425,7 +19706,7 @@ async function sendAftRequest(binaryPath, request) {
19425
19706
  }
19426
19707
  async function sendAftRequests(binaryPath, requests) {
19427
19708
  return new Promise((resolve10, reject) => {
19428
- const child = spawn3(binaryPath, [], {
19709
+ const child = spawn4(binaryPath, [], {
19429
19710
  stdio: ["pipe", "pipe", "pipe"]
19430
19711
  });
19431
19712
  const responses = [];
@@ -21142,7 +21423,7 @@ var init_diagnostics = __esm(async () => {
21142
21423
  });
21143
21424
 
21144
21425
  // src/lib/github.ts
21145
- import { execSync as execSync5, spawnSync as spawnSync6 } from "node:child_process";
21426
+ import { execSync as execSync5, spawnSync as spawnSync7 } from "node:child_process";
21146
21427
  function isGhInstalled() {
21147
21428
  try {
21148
21429
  execSync5("gh --version", { stdio: "ignore" });
@@ -21158,14 +21439,14 @@ function openBrowser(url) {
21158
21439
  const commands = getOpenBrowserCommand(url);
21159
21440
  try {
21160
21441
  const [cmd, args] = commands;
21161
- spawnSync6(cmd, args, { stdio: "ignore" });
21442
+ spawnSync7(cmd, args, { stdio: "ignore" });
21162
21443
  } catch {}
21163
21444
  }
21164
21445
  function createGitHubIssue(repo, title, body) {
21165
21446
  if (!isGhInstalled()) {
21166
21447
  return { url: null, stderr: "gh CLI not installed" };
21167
21448
  }
21168
- const result = spawnSync6("gh", ["issue", "create", "--repo", repo, "--title", title, "--body-file", "-"], {
21449
+ const result = spawnSync7("gh", ["issue", "create", "--repo", repo, "--title", title, "--body-file", "-"], {
21169
21450
  input: body,
21170
21451
  encoding: "utf-8",
21171
21452
  stdio: ["pipe", "pipe", "pipe"]
@@ -21589,7 +21870,7 @@ __export(exports_doctor, {
21589
21870
  runDoctorBuildBreakerReset: () => runDoctorBuildBreakerReset,
21590
21871
  shouldSkipDoctorFixConfirmation: () => shouldSkipDoctorFixConfirmation
21591
21872
  });
21592
- import { execFileSync as execFileSync3 } from "node:child_process";
21873
+ import { spawn as spawn5 } from "node:child_process";
21593
21874
  import {
21594
21875
  chmodSync as chmodSync4,
21595
21876
  existsSync as existsSync26,
@@ -21970,6 +22251,64 @@ function findSchemaFixTargets(adapters) {
21970
22251
  }
21971
22252
  return targets;
21972
22253
  }
22254
+ async function runDoctorNpmInstall(npm, installDir) {
22255
+ const invocation = npmInvocation(npm, [
22256
+ "install",
22257
+ "--no-audit",
22258
+ "--no-fund",
22259
+ "--no-progress",
22260
+ "--ignore-scripts"
22261
+ ]);
22262
+ await new Promise((resolve13, reject) => {
22263
+ const child = spawn5(invocation.command, invocation.args, {
22264
+ cwd: installDir,
22265
+ env: { ...npmSpawnEnv(npm), ...invocation.env },
22266
+ stdio: ["ignore", "ignore", "pipe"],
22267
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments
22268
+ });
22269
+ let stderr = "";
22270
+ let settled = false;
22271
+ let terminating = false;
22272
+ let timeout = null;
22273
+ const finish = (error2) => {
22274
+ if (settled)
22275
+ return;
22276
+ settled = true;
22277
+ if (timeout)
22278
+ clearTimeout(timeout);
22279
+ if (error2)
22280
+ reject(error2);
22281
+ else
22282
+ resolve13();
22283
+ };
22284
+ child.stderr?.on("data", (chunk) => {
22285
+ stderr += chunk.toString("utf8");
22286
+ if (stderr.length > 16 * 1024)
22287
+ stderr = stderr.slice(-16 * 1024);
22288
+ });
22289
+ child.once("error", (error2) => {
22290
+ if (terminating)
22291
+ return;
22292
+ finish(error2);
22293
+ });
22294
+ child.once("exit", (code) => {
22295
+ if (terminating)
22296
+ return;
22297
+ const detail = stderr.trim();
22298
+ if (code !== 0) {
22299
+ finish(new Error(`npm install exited with code ${code}${detail ? `: ${detail}` : ""}`));
22300
+ } else {
22301
+ finish();
22302
+ }
22303
+ });
22304
+ timeout = setTimeout(() => {
22305
+ if (settled)
22306
+ return;
22307
+ terminating = true;
22308
+ terminateNpmProcessTree(child, invocation).then(() => finish(new Error("npm install timed out after 120000ms")), (error2) => finish(new Error(`npm install timed out and termination outcome is unknown: ${String(error2)}`)));
22309
+ }, 120000);
22310
+ });
22311
+ }
21973
22312
  async function applyPluginUpdates(targets) {
21974
22313
  let updated = 0;
21975
22314
  let errors = 0;
@@ -21983,12 +22322,7 @@ async function applyPluginUpdates(targets) {
21983
22322
  }
21984
22323
  for (const target of targets) {
21985
22324
  try {
21986
- execFileSync3(npm.command, ["install", "--no-audit", "--no-fund", "--no-progress", "--ignore-scripts"], {
21987
- cwd: target.installDir,
21988
- env: npmSpawnEnv(npm),
21989
- stdio: ["ignore", "pipe", "pipe"],
21990
- timeout: 120000
21991
- });
22325
+ await runDoctorNpmInstall(npm, target.installDir);
21992
22326
  updated += 1;
21993
22327
  log2.success(`${target.adapter.displayName}: plugin updated ${target.cached} → ${target.latest} (restart ${target.adapter.displayName} to apply)`);
21994
22328
  } catch (err) {
@@ -22264,7 +22598,10 @@ async function clearPluginCache(adapter, includeBytes) {
22264
22598
  const info = adapter.getPluginCacheInfo();
22265
22599
  const bytes = info.exists ? dirSize(info.path) : 0;
22266
22600
  const result = await adapter.clearPluginCache(true);
22267
- if (result.action === "cleared") {
22601
+ if (result.legacy_path_cleared) {
22602
+ log2.success(`${adapter.displayName}: legacy_path_cleared at ${result.legacy_path_cleared}`);
22603
+ }
22604
+ if (result.action === "cleared" || result.action === "legacy_path_cleared") {
22268
22605
  const suffix = includeBytes ? `, reclaimed ${formatBytes(bytes)}` : "";
22269
22606
  log2.success(`${adapter.displayName}: cleared plugin cache at ${result.path}${suffix}`);
22270
22607
  return { action: "cleared", bytes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/aft",
3
- "version": "0.54.0",
3
+ "version": "0.55.1",
4
4
  "type": "module",
5
5
  "description": "Unified CLI for Agent File Tools (AFT) — setup, one-shot index snapshots, doctor, and diagnostics across supported agent harnesses (OpenCode, Pi)",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@clack/prompts": "^1.6.0",
27
- "@cortexkit/aft-bridge": "0.54.0",
27
+ "@cortexkit/aft-bridge": "0.55.1",
28
28
  "comment-json": "^4.6.2"
29
29
  },
30
30
  "devDependencies": {