@cortexkit/aft 0.54.0 → 0.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
@@ -8116,10 +8340,13 @@ function isEditSentinelItem(item) {
8116
8340
  if (record.oldString === null && ["startLine", "endLine"].some((key) => hasOwn(record, key) && record[key] !== null)) {
8117
8341
  return false;
8118
8342
  }
8119
- const newStringEmpty = !hasOwn(record, "newString") || isNullOrEmptyString(record.newString);
8120
- if (!newStringEmpty)
8121
- return false;
8122
- return !hasOwn(record, "content") || isNullOrEmptyString(record.content);
8343
+ 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);
8344
+ }
8345
+ function hasMeaningfulFindPayload(item) {
8346
+ return isNonEmptyString(item.oldString);
8347
+ }
8348
+ function isDefaultOccurrence(value) {
8349
+ return value === undefined || value === null || value === 1;
8123
8350
  }
8124
8351
  function normalizeEditArraySentinels(record) {
8125
8352
  const value = record.edits;
@@ -8172,8 +8399,8 @@ function parseEditArray(value) {
8172
8399
  }
8173
8400
  return value;
8174
8401
  }
8175
- function stripLineRangeSentinels(item) {
8176
- const hasRangeField = ["startLine", "endLine", "content"].some((key) => hasOwn(item, key));
8402
+ function normalizeEditItemSentinels(item) {
8403
+ const hadRangeFields = ["startLine", "endLine", "content"].some((key) => hasOwn(item, key));
8177
8404
  for (const key of [
8178
8405
  "oldString",
8179
8406
  "newString",
@@ -8186,7 +8413,19 @@ function stripLineRangeSentinels(item) {
8186
8413
  if (item[key] === null)
8187
8414
  delete item[key];
8188
8415
  }
8189
- if (!hasRangeField)
8416
+ const contentIsEmpty = item.content === "";
8417
+ if (hasMeaningfulFindPayload(item) && (!hasOwn(item, "content") || contentIsEmpty)) {
8418
+ for (const key of ["startLine", "endLine", "content"])
8419
+ delete item[key];
8420
+ if (hadRangeFields) {
8421
+ if (item.replaceAll === false)
8422
+ delete item.replaceAll;
8423
+ if (hasOwn(item, "occurrence") && isDefaultOccurrence(item.occurrence))
8424
+ delete item.occurrence;
8425
+ }
8426
+ return;
8427
+ }
8428
+ if (!isNonEmptyString(item.content))
8190
8429
  return;
8191
8430
  if (item.oldString === "")
8192
8431
  delete item.oldString;
@@ -8194,7 +8433,7 @@ function stripLineRangeSentinels(item) {
8194
8433
  delete item.newString;
8195
8434
  if (item.replaceAll === false)
8196
8435
  delete item.replaceAll;
8197
- if (item.occurrence === 1)
8436
+ if (hasOwn(item, "occurrence") && isDefaultOccurrence(item.occurrence))
8198
8437
  delete item.occurrence;
8199
8438
  }
8200
8439
  function normalizeEditItem(value, index) {
@@ -8205,7 +8444,7 @@ function normalizeEditItem(value, index) {
8205
8444
  const item = copyOwnProperties(source);
8206
8445
  normalizeItemAlias(item, "oldString", "oldText");
8207
8446
  normalizeItemAlias(item, "newString", "newText");
8208
- stripLineRangeSentinels(item);
8447
+ normalizeEditItemSentinels(item);
8209
8448
  const hasFindField = ["oldString", "newString", "replaceAll", "occurrence"].some((key) => hasOwn(item, key));
8210
8449
  const hasRangeField = ["startLine", "endLine", "content"].some((key) => hasOwn(item, key));
8211
8450
  if (hasFindField && hasRangeField) {
@@ -9187,6 +9426,7 @@ __export(exports_dist, {
9187
9426
  HomeProjectRootError: () => HomeProjectRootError,
9188
9427
  InvalidRequestError: () => InvalidRequestError,
9189
9428
  LONG_RUNNING_COMMAND_TIMEOUT_MS: () => LONG_RUNNING_COMMAND_TIMEOUT_MS,
9429
+ NpmTerminationUnknownError: () => NpmTerminationUnknownError,
9190
9430
  OPENCODE_ONLY_KEYS: () => OPENCODE_ONLY_KEYS,
9191
9431
  PI_ONLY_KEYS: () => PI_ONLY_KEYS,
9192
9432
  PLAIN_CALLGRAPH_THEME: () => PLAIN_CALLGRAPH_THEME,
@@ -9236,6 +9476,8 @@ __export(exports_dist, {
9236
9476
  getCachedBinaryPath: () => getCachedBinaryPath,
9237
9477
  getManualInstallHint: () => getManualInstallHint,
9238
9478
  getMigrationStatus: () => getMigrationStatus,
9479
+ getOpenCodeCacheRoot: () => getOpenCodeCacheRoot,
9480
+ getOpenCodeConfigRoot: () => getOpenCodeConfigRoot,
9239
9481
  inlineUserConfigTier: () => inlineUserConfigTier,
9240
9482
  isBashTransportDeadError: () => isBashTransportDeadError,
9241
9483
  isBridgeTransportTimeout: () => isBridgeTransportTimeout,
@@ -9251,6 +9493,7 @@ __export(exports_dist, {
9251
9493
  maybeAppendConflictsHint: () => maybeAppendConflictsHint,
9252
9494
  maybeAppendGrepSearchHint: () => maybeAppendGrepSearchHint,
9253
9495
  migrateAftConfigFile: () => migrateAftConfigFile,
9496
+ npmInvocation: () => npmInvocation,
9254
9497
  npmSpawnEnv: () => npmSpawnEnv,
9255
9498
  platformKey: () => platformKey,
9256
9499
  prepareCanonicalEditArguments: () => prepareCanonicalEditArguments,
@@ -9278,6 +9521,7 @@ __export(exports_dist, {
9278
9521
  stripHarnessSpecificConfigKeys: () => stripHarnessSpecificConfigKeys,
9279
9522
  stripJsoncSymbols: () => stripJsoncSymbols,
9280
9523
  tagStderrLine: () => tagStderrLine,
9524
+ terminateNpmProcessTree: () => terminateNpmProcessTree,
9281
9525
  timeoutForCommand: () => timeoutForCommand,
9282
9526
  toolErrorFromResponse: () => toolErrorFromResponse,
9283
9527
  unwrapRustZoomBatchEnvelope: () => unwrapRustZoomBatchEnvelope
@@ -9339,7 +9583,7 @@ var init_paths2 = __esm(() => {
9339
9583
  });
9340
9584
 
9341
9585
  // src/lib/binary-probe.ts
9342
- import { execSync as execSync2, spawnSync as spawnSync3 } from "node:child_process";
9586
+ import { execSync as execSync2, spawnSync as spawnSync4 } from "node:child_process";
9343
9587
  import { existsSync as existsSync10 } from "node:fs";
9344
9588
  import { createRequire as createRequire2 } from "node:module";
9345
9589
  import { homedir as homedir13 } from "node:os";
@@ -9397,7 +9641,7 @@ function probeAftBinary(preferredVersion) {
9397
9641
  try {
9398
9642
  if (!existsSync10(candidate))
9399
9643
  continue;
9400
- const result = spawnSync3(candidate, ["--version"], {
9644
+ const result = spawnSync4(candidate, ["--version"], {
9401
9645
  stdio: ["ignore", "pipe", "pipe"],
9402
9646
  encoding: "utf-8",
9403
9647
  timeout: 5000,
@@ -17388,18 +17632,28 @@ function getOpenCodeConfigDir() {
17388
17632
  const envDir = process.env.OPENCODE_CONFIG_DIR?.trim();
17389
17633
  if (envDir)
17390
17634
  return resolve8(envDir);
17391
- const xdg = process.env.XDG_CONFIG_HOME || join16(homedir14(), ".config");
17392
- return join16(xdg, "opencode");
17635
+ return getOpenCodeConfigRoot();
17393
17636
  }
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");
17637
+ function getLegacyOpenCodePluginCachePath(primaryPath) {
17638
+ if (process.platform !== "win32")
17639
+ return null;
17640
+ const localAppData = process.env.LOCALAPPDATA ?? join16(homedir14(), "AppData", "Local");
17641
+ const legacyPath = join16(localAppData, "opencode", "packages", PLUGIN_ENTRY);
17642
+ return resolve8(legacyPath) === resolve8(primaryPath) ? null : legacyPath;
17643
+ }
17644
+ function clearLegacyOpenCodePluginCache(primaryPath) {
17645
+ const legacyPath = getLegacyOpenCodePluginCachePath(primaryPath);
17646
+ if (!legacyPath || !existsSync13(legacyPath))
17647
+ return { clearedPath: null };
17648
+ try {
17649
+ rmSync4(legacyPath, { recursive: true, force: true });
17650
+ return { clearedPath: legacyPath };
17651
+ } catch (error2) {
17652
+ return { clearedPath: null, error: error2 instanceof Error ? error2.message : String(error2) };
17401
17653
  }
17402
- return join16(homedir14(), ".cache", "opencode");
17654
+ }
17655
+ function getOpenCodeCacheDir() {
17656
+ return getOpenCodeCacheRoot();
17403
17657
  }
17404
17658
  function hasOpenCodeCli() {
17405
17659
  try {
@@ -17649,8 +17903,21 @@ class OpenCodeAdapter {
17649
17903
  }
17650
17904
  async clearPluginCache(force) {
17651
17905
  const info = this.getPluginCacheInfo();
17906
+ const clearLegacy = force ? clearLegacyOpenCodePluginCache(info.path) : { clearedPath: null };
17907
+ if (clearLegacy.error) {
17908
+ return {
17909
+ action: "error",
17910
+ path: info.path,
17911
+ error: `Could not clear legacy OpenCode cache: ${clearLegacy.error}`,
17912
+ ...clearLegacy.clearedPath ? { legacy_path_cleared: clearLegacy.clearedPath } : {}
17913
+ };
17914
+ }
17652
17915
  if (!info.exists) {
17653
- return { action: "not_found", path: info.path };
17916
+ return clearLegacy.clearedPath ? {
17917
+ action: "legacy_path_cleared",
17918
+ path: clearLegacy.clearedPath,
17919
+ legacy_path_cleared: clearLegacy.clearedPath
17920
+ } : { action: "not_found", path: info.path };
17654
17921
  }
17655
17922
  if (!force && info.cached && info.cached === info.latest) {
17656
17923
  return {
@@ -17666,7 +17933,8 @@ class OpenCodeAdapter {
17666
17933
  action: "cleared",
17667
17934
  path: info.path,
17668
17935
  cached: info.cached,
17669
- latest: info.latest
17936
+ latest: info.latest,
17937
+ ...clearLegacy.clearedPath ? { legacy_path_cleared: clearLegacy.clearedPath } : {}
17670
17938
  };
17671
17939
  } catch (error2) {
17672
17940
  return {
@@ -17704,7 +17972,7 @@ var init_opencode = __esm(() => {
17704
17972
  });
17705
17973
 
17706
17974
  // src/adapters/pi.ts
17707
- import { execSync as execSync4, spawnSync as spawnSync4 } from "node:child_process";
17975
+ import { execSync as execSync4, spawnSync as spawnSync5 } from "node:child_process";
17708
17976
  import { existsSync as existsSync14, readFileSync as readFileSync9 } from "node:fs";
17709
17977
  import { homedir as homedir15 } from "node:os";
17710
17978
  import { join as join17, resolve as resolve9 } from "node:path";
@@ -17813,7 +18081,7 @@ class PiAdapter {
17813
18081
  }
17814
18082
  getHostVersion() {
17815
18083
  try {
17816
- const result = spawnSync4("pi", ["--version"], {
18084
+ const result = spawnSync5("pi", ["--version"], {
17817
18085
  stdio: ["ignore", "pipe", "pipe"],
17818
18086
  encoding: "utf-8",
17819
18087
  timeout: 5000
@@ -19384,14 +19652,14 @@ var exports_commands = {};
19384
19652
  __export(exports_commands, {
19385
19653
  runIndex: () => runIndex
19386
19654
  });
19387
- import { spawnSync as spawnSync5 } from "node:child_process";
19655
+ import { spawnSync as spawnSync6 } from "node:child_process";
19388
19656
  function runIndex(argv) {
19389
19657
  const binary = findAftBinary();
19390
19658
  if (!binary) {
19391
19659
  console.error("aft index requires a native AFT binary; run `aft doctor` to install or repair it.");
19392
19660
  return 1;
19393
19661
  }
19394
- const result = spawnSync5(binary, ["index", ...argv], {
19662
+ const result = spawnSync6(binary, ["index", ...argv], {
19395
19663
  stdio: "inherit",
19396
19664
  env: process.env
19397
19665
  });
@@ -19406,7 +19674,7 @@ var init_commands = __esm(async () => {
19406
19674
  });
19407
19675
 
19408
19676
  // src/lib/aft-bridge.ts
19409
- import { spawn as spawn3 } from "node:child_process";
19677
+ import { spawn as spawn4 } from "node:child_process";
19410
19678
  function isResponseForRequest(parsed, expectedIds) {
19411
19679
  if (!parsed || typeof parsed !== "object")
19412
19680
  return false;
@@ -19425,7 +19693,7 @@ async function sendAftRequest(binaryPath, request) {
19425
19693
  }
19426
19694
  async function sendAftRequests(binaryPath, requests) {
19427
19695
  return new Promise((resolve10, reject) => {
19428
- const child = spawn3(binaryPath, [], {
19696
+ const child = spawn4(binaryPath, [], {
19429
19697
  stdio: ["pipe", "pipe", "pipe"]
19430
19698
  });
19431
19699
  const responses = [];
@@ -21142,7 +21410,7 @@ var init_diagnostics = __esm(async () => {
21142
21410
  });
21143
21411
 
21144
21412
  // src/lib/github.ts
21145
- import { execSync as execSync5, spawnSync as spawnSync6 } from "node:child_process";
21413
+ import { execSync as execSync5, spawnSync as spawnSync7 } from "node:child_process";
21146
21414
  function isGhInstalled() {
21147
21415
  try {
21148
21416
  execSync5("gh --version", { stdio: "ignore" });
@@ -21158,14 +21426,14 @@ function openBrowser(url) {
21158
21426
  const commands = getOpenBrowserCommand(url);
21159
21427
  try {
21160
21428
  const [cmd, args] = commands;
21161
- spawnSync6(cmd, args, { stdio: "ignore" });
21429
+ spawnSync7(cmd, args, { stdio: "ignore" });
21162
21430
  } catch {}
21163
21431
  }
21164
21432
  function createGitHubIssue(repo, title, body) {
21165
21433
  if (!isGhInstalled()) {
21166
21434
  return { url: null, stderr: "gh CLI not installed" };
21167
21435
  }
21168
- const result = spawnSync6("gh", ["issue", "create", "--repo", repo, "--title", title, "--body-file", "-"], {
21436
+ const result = spawnSync7("gh", ["issue", "create", "--repo", repo, "--title", title, "--body-file", "-"], {
21169
21437
  input: body,
21170
21438
  encoding: "utf-8",
21171
21439
  stdio: ["pipe", "pipe", "pipe"]
@@ -21589,7 +21857,7 @@ __export(exports_doctor, {
21589
21857
  runDoctorBuildBreakerReset: () => runDoctorBuildBreakerReset,
21590
21858
  shouldSkipDoctorFixConfirmation: () => shouldSkipDoctorFixConfirmation
21591
21859
  });
21592
- import { execFileSync as execFileSync3 } from "node:child_process";
21860
+ import { spawn as spawn5 } from "node:child_process";
21593
21861
  import {
21594
21862
  chmodSync as chmodSync4,
21595
21863
  existsSync as existsSync26,
@@ -21970,6 +22238,64 @@ function findSchemaFixTargets(adapters) {
21970
22238
  }
21971
22239
  return targets;
21972
22240
  }
22241
+ async function runDoctorNpmInstall(npm, installDir) {
22242
+ const invocation = npmInvocation(npm, [
22243
+ "install",
22244
+ "--no-audit",
22245
+ "--no-fund",
22246
+ "--no-progress",
22247
+ "--ignore-scripts"
22248
+ ]);
22249
+ await new Promise((resolve13, reject) => {
22250
+ const child = spawn5(invocation.command, invocation.args, {
22251
+ cwd: installDir,
22252
+ env: { ...npmSpawnEnv(npm), ...invocation.env },
22253
+ stdio: ["ignore", "ignore", "pipe"],
22254
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments
22255
+ });
22256
+ let stderr = "";
22257
+ let settled = false;
22258
+ let terminating = false;
22259
+ let timeout = null;
22260
+ const finish = (error2) => {
22261
+ if (settled)
22262
+ return;
22263
+ settled = true;
22264
+ if (timeout)
22265
+ clearTimeout(timeout);
22266
+ if (error2)
22267
+ reject(error2);
22268
+ else
22269
+ resolve13();
22270
+ };
22271
+ child.stderr?.on("data", (chunk) => {
22272
+ stderr += chunk.toString("utf8");
22273
+ if (stderr.length > 16 * 1024)
22274
+ stderr = stderr.slice(-16 * 1024);
22275
+ });
22276
+ child.once("error", (error2) => {
22277
+ if (terminating)
22278
+ return;
22279
+ finish(error2);
22280
+ });
22281
+ child.once("exit", (code) => {
22282
+ if (terminating)
22283
+ return;
22284
+ const detail = stderr.trim();
22285
+ if (code !== 0) {
22286
+ finish(new Error(`npm install exited with code ${code}${detail ? `: ${detail}` : ""}`));
22287
+ } else {
22288
+ finish();
22289
+ }
22290
+ });
22291
+ timeout = setTimeout(() => {
22292
+ if (settled)
22293
+ return;
22294
+ terminating = true;
22295
+ 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)}`)));
22296
+ }, 120000);
22297
+ });
22298
+ }
21973
22299
  async function applyPluginUpdates(targets) {
21974
22300
  let updated = 0;
21975
22301
  let errors = 0;
@@ -21983,12 +22309,7 @@ async function applyPluginUpdates(targets) {
21983
22309
  }
21984
22310
  for (const target of targets) {
21985
22311
  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
- });
22312
+ await runDoctorNpmInstall(npm, target.installDir);
21992
22313
  updated += 1;
21993
22314
  log2.success(`${target.adapter.displayName}: plugin updated ${target.cached} → ${target.latest} (restart ${target.adapter.displayName} to apply)`);
21994
22315
  } catch (err) {
@@ -22264,7 +22585,10 @@ async function clearPluginCache(adapter, includeBytes) {
22264
22585
  const info = adapter.getPluginCacheInfo();
22265
22586
  const bytes = info.exists ? dirSize(info.path) : 0;
22266
22587
  const result = await adapter.clearPluginCache(true);
22267
- if (result.action === "cleared") {
22588
+ if (result.legacy_path_cleared) {
22589
+ log2.success(`${adapter.displayName}: legacy_path_cleared at ${result.legacy_path_cleared}`);
22590
+ }
22591
+ if (result.action === "cleared" || result.action === "legacy_path_cleared") {
22268
22592
  const suffix = includeBytes ? `, reclaimed ${formatBytes(bytes)}` : "";
22269
22593
  log2.success(`${adapter.displayName}: cleared plugin cache at ${result.path}${suffix}`);
22270
22594
  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.0",
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.0",
28
28
  "comment-json": "^4.6.2"
29
29
  },
30
30
  "devDependencies": {