nexum-code 0.13.5 → 0.14.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.
@@ -6,7 +6,7 @@ const __dirname = __cjsShimDirname(__filename);
6
6
  import { i as __require, o as __toESM, r as __exportAll, t as __commonJSMin } from "./chunk-D90kvbyJ.mjs";
7
7
  import { C as join$1, D as resolve$1, E as relative$1, S as isAbsolute$1, T as parse$7, a as isSupportedFile, b as basename$1, i as ingestFile, r as ingestDirectory, t as multiSearch, w as normalize, x as dirname$2, y as KnowledgeStore } from "./src-BH9W5k24.mjs";
8
8
  import { t as require_base64_js } from "./base64-js-DzVmk6Nb.mjs";
9
- import { a as setLocale, i as getLocale, n as assertNexumHostIdentity, o as t, r as createNexumDefaultHeaders, t as TextInputDialogComponent } from "./text-input-dialog-Bncn0-6m.mjs";
9
+ import { a as setLocale, i as getLocale, n as assertNexumHostIdentity, o as t, r as createNexumDefaultHeaders, t as TextInputDialogComponent } from "./text-input-dialog-9TU2p7Py.mjs";
10
10
  import { createRequire } from "node:module";
11
11
  import { createHash, randomBytes, randomInt, randomUUID } from "node:crypto";
12
12
  import * as fs$1 from "node:fs/promises";
@@ -9277,7 +9277,8 @@ var AnthropicChatProvider = class {
9277
9277
  return new Anthropic({
9278
9278
  apiKey,
9279
9279
  baseURL: this._baseUrl,
9280
- defaultHeaders: this._defaultHeaders
9280
+ defaultHeaders: this._defaultHeaders,
9281
+ maxRetries: 0
9281
9282
  });
9282
9283
  }
9283
9284
  withThinking(effort) {
@@ -9654,7 +9655,7 @@ var require_extend = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9654
9655
  };
9655
9656
  }));
9656
9657
  //#endregion
9657
- //#region ../../node_modules/.pnpm/gaxios@7.1.4/node_modules/gaxios/package.json
9658
+ //#region ../../node_modules/.pnpm/gaxios@7.1.4_supports-color@8.1.1/node_modules/gaxios/package.json
9658
9659
  var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9659
9660
  module.exports = {
9660
9661
  "name": "gaxios",
@@ -9757,12 +9758,12 @@ var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9757
9758
  };
9758
9759
  }));
9759
9760
  //#endregion
9760
- //#region ../../node_modules/.pnpm/gaxios@7.1.4/node_modules/gaxios/build/cjs/src/util.cjs
9761
+ //#region ../../node_modules/.pnpm/gaxios@7.1.4_supports-color@8.1.1/node_modules/gaxios/build/cjs/src/util.cjs
9761
9762
  var require_util$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9762
9763
  module.exports = { pkg: require_package$1() };
9763
9764
  }));
9764
9765
  //#endregion
9765
- //#region ../../node_modules/.pnpm/gaxios@7.1.4/node_modules/gaxios/build/cjs/src/common.js
9766
+ //#region ../../node_modules/.pnpm/gaxios@7.1.4_supports-color@8.1.1/node_modules/gaxios/build/cjs/src/common.js
9766
9767
  var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
9767
9768
  var __importDefault = exports && exports.__importDefault || function(mod) {
9768
9769
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -9968,7 +9969,7 @@ var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
9968
9969
  }
9969
9970
  }));
9970
9971
  //#endregion
9971
- //#region ../../node_modules/.pnpm/gaxios@7.1.4/node_modules/gaxios/build/cjs/src/retry.js
9972
+ //#region ../../node_modules/.pnpm/gaxios@7.1.4_supports-color@8.1.1/node_modules/gaxios/build/cjs/src/retry.js
9972
9973
  var require_retry = /* @__PURE__ */ __commonJSMin(((exports) => {
9973
9974
  Object.defineProperty(exports, "__esModule", { value: true });
9974
9975
  exports.getRetryConfig = getRetryConfig;
@@ -10058,7 +10059,7 @@ var require_retry = /* @__PURE__ */ __commonJSMin(((exports) => {
10058
10059
  }
10059
10060
  }));
10060
10061
  //#endregion
10061
- //#region ../../node_modules/.pnpm/gaxios@7.1.4/node_modules/gaxios/build/cjs/src/interceptor.js
10062
+ //#region ../../node_modules/.pnpm/gaxios@7.1.4_supports-color@8.1.1/node_modules/gaxios/build/cjs/src/interceptor.js
10062
10063
  var require_interceptor = /* @__PURE__ */ __commonJSMin(((exports) => {
10063
10064
  Object.defineProperty(exports, "__esModule", { value: true });
10064
10065
  exports.GaxiosInterceptorManager = void 0;
@@ -10069,7 +10070,7 @@ var require_interceptor = /* @__PURE__ */ __commonJSMin(((exports) => {
10069
10070
  exports.GaxiosInterceptorManager = GaxiosInterceptorManager;
10070
10071
  }));
10071
10072
  //#endregion
10072
- //#region ../../node_modules/.pnpm/gaxios@7.1.4/node_modules/gaxios/build/cjs/src/gaxios.js
10073
+ //#region ../../node_modules/.pnpm/gaxios@7.1.4_supports-color@8.1.1/node_modules/gaxios/build/cjs/src/gaxios.js
10073
10074
  var require_gaxios = /* @__PURE__ */ __commonJSMin(((exports) => {
10074
10075
  var __importDefault = exports && exports.__importDefault || function(mod) {
10075
10076
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -10412,7 +10413,7 @@ var require_gaxios = /* @__PURE__ */ __commonJSMin(((exports) => {
10412
10413
  * @returns A proxy agent
10413
10414
  */
10414
10415
  static async #getProxyAgent() {
10415
- this.#proxyAgent ||= (await import("./dist-AcjRoBBn.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).HttpsProxyAgent;
10416
+ this.#proxyAgent ||= (await import("./dist-B_OG4w84.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).HttpsProxyAgent;
10416
10417
  return this.#proxyAgent;
10417
10418
  }
10418
10419
  static async #getFetch() {
@@ -10448,7 +10449,7 @@ var require_gaxios = /* @__PURE__ */ __commonJSMin(((exports) => {
10448
10449
  _a = Gaxios;
10449
10450
  }));
10450
10451
  //#endregion
10451
- //#region ../../node_modules/.pnpm/gaxios@7.1.4/node_modules/gaxios/build/cjs/src/index.js
10452
+ //#region ../../node_modules/.pnpm/gaxios@7.1.4_supports-color@8.1.1/node_modules/gaxios/build/cjs/src/index.js
10452
10453
  var require_src$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
10453
10454
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
10454
10455
  if (k2 === void 0) k2 = k;
@@ -12018,7 +12019,7 @@ var require_json_bigint = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12018
12019
  module.exports.stringify = json_stringify;
12019
12020
  }));
12020
12021
  //#endregion
12021
- //#region ../../node_modules/.pnpm/gcp-metadata@8.1.2/node_modules/gcp-metadata/build/src/gcp-residency.js
12022
+ //#region ../../node_modules/.pnpm/gcp-metadata@8.1.2_supports-color@8.1.1/node_modules/gcp-metadata/build/src/gcp-residency.js
12022
12023
  var require_gcp_residency = /* @__PURE__ */ __commonJSMin(((exports) => {
12023
12024
  /**
12024
12025
  * Copyright 2022 Google LLC
@@ -12544,7 +12545,7 @@ var require_src$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
12544
12545
  __exportStar(require_logging_utils(), exports);
12545
12546
  }));
12546
12547
  //#endregion
12547
- //#region ../../node_modules/.pnpm/gcp-metadata@8.1.2/node_modules/gcp-metadata/build/src/index.js
12548
+ //#region ../../node_modules/.pnpm/gcp-metadata@8.1.2_supports-color@8.1.1/node_modules/gcp-metadata/build/src/index.js
12548
12549
  var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
12549
12550
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
12550
12551
  if (k2 === void 0) k2 = k;
@@ -12871,7 +12872,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
12871
12872
  __exportStar(require_gcp_residency(), exports);
12872
12873
  }));
12873
12874
  //#endregion
12874
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/crypto/shared.js
12875
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/crypto/shared.js
12875
12876
  var require_shared$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
12876
12877
  Object.defineProperty(exports, "__esModule", { value: true });
12877
12878
  exports.fromArrayBufferToHex = fromArrayBufferToHex;
@@ -12887,7 +12888,7 @@ var require_shared$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
12887
12888
  }
12888
12889
  }));
12889
12890
  //#endregion
12890
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/crypto/browser/crypto.js
12891
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/crypto/browser/crypto.js
12891
12892
  var require_crypto$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
12892
12893
  Object.defineProperty(exports, "__esModule", { value: true });
12893
12894
  exports.BrowserCrypto = void 0;
@@ -12970,7 +12971,7 @@ var require_crypto$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
12970
12971
  };
12971
12972
  }));
12972
12973
  //#endregion
12973
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/crypto/node/crypto.js
12974
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/crypto/node/crypto.js
12974
12975
  var require_crypto$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
12975
12976
  Object.defineProperty(exports, "__esModule", { value: true });
12976
12977
  exports.NodeCrypto = void 0;
@@ -13045,7 +13046,7 @@ var require_crypto$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
13045
13046
  }
13046
13047
  }));
13047
13048
  //#endregion
13048
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/crypto/crypto.js
13049
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/crypto/crypto.js
13049
13050
  var require_crypto = /* @__PURE__ */ __commonJSMin(((exports) => {
13050
13051
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
13051
13052
  if (k2 === void 0) k2 = k;
@@ -13229,7 +13230,7 @@ var require_ecdsa_sig_formatter = /* @__PURE__ */ __commonJSMin(((exports, modul
13229
13230
  };
13230
13231
  }));
13231
13232
  //#endregion
13232
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/util.js
13233
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/util.js
13233
13234
  var require_util$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
13234
13235
  Object.defineProperty(exports, "__esModule", { value: true });
13235
13236
  exports.LRUCache = void 0;
@@ -13382,7 +13383,7 @@ var require_util$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
13382
13383
  }
13383
13384
  }));
13384
13385
  //#endregion
13385
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/package.json
13386
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/package.json
13386
13387
  var require_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13387
13388
  module.exports = {
13388
13389
  "name": "google-auth-library",
@@ -13473,7 +13474,7 @@ var require_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13473
13474
  };
13474
13475
  }));
13475
13476
  //#endregion
13476
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/shared.cjs
13477
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/shared.cjs
13477
13478
  var require_shared = /* @__PURE__ */ __commonJSMin(((exports) => {
13478
13479
  Object.defineProperty(exports, "__esModule", { value: true });
13479
13480
  exports.USER_AGENT = exports.PRODUCT_NAME = exports.pkg = void 0;
@@ -13484,7 +13485,7 @@ var require_shared = /* @__PURE__ */ __commonJSMin(((exports) => {
13484
13485
  exports.USER_AGENT = `${PRODUCT_NAME}/${pkg.version}`;
13485
13486
  }));
13486
13487
  //#endregion
13487
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/authclient.js
13488
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/authclient.js
13488
13489
  var require_authclient = /* @__PURE__ */ __commonJSMin(((exports) => {
13489
13490
  Object.defineProperty(exports, "__esModule", { value: true });
13490
13491
  exports.AuthClient = exports.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS = exports.DEFAULT_UNIVERSE = void 0;
@@ -13699,7 +13700,7 @@ var require_authclient = /* @__PURE__ */ __commonJSMin(((exports) => {
13699
13700
  };
13700
13701
  }));
13701
13702
  //#endregion
13702
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/loginticket.js
13703
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/loginticket.js
13703
13704
  var require_loginticket = /* @__PURE__ */ __commonJSMin(((exports) => {
13704
13705
  Object.defineProperty(exports, "__esModule", { value: true });
13705
13706
  exports.LoginTicket = void 0;
@@ -13749,7 +13750,7 @@ var require_loginticket = /* @__PURE__ */ __commonJSMin(((exports) => {
13749
13750
  exports.LoginTicket = LoginTicket;
13750
13751
  }));
13751
13752
  //#endregion
13752
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/oauth2client.js
13753
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/oauth2client.js
13753
13754
  var require_oauth2client = /* @__PURE__ */ __commonJSMin(((exports) => {
13754
13755
  Object.defineProperty(exports, "__esModule", { value: true });
13755
13756
  exports.OAuth2Client = exports.ClientAuthentication = exports.CertificateFormat = exports.CodeChallengeMethod = void 0;
@@ -14321,7 +14322,7 @@ var require_oauth2client = /* @__PURE__ */ __commonJSMin(((exports) => {
14321
14322
  };
14322
14323
  }));
14323
14324
  //#endregion
14324
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/computeclient.js
14325
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/computeclient.js
14325
14326
  var require_computeclient = /* @__PURE__ */ __commonJSMin(((exports) => {
14326
14327
  Object.defineProperty(exports, "__esModule", { value: true });
14327
14328
  exports.Compute = void 0;
@@ -14403,7 +14404,7 @@ var require_computeclient = /* @__PURE__ */ __commonJSMin(((exports) => {
14403
14404
  exports.Compute = Compute;
14404
14405
  }));
14405
14406
  //#endregion
14406
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/idtokenclient.js
14407
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/idtokenclient.js
14407
14408
  var require_idtokenclient = /* @__PURE__ */ __commonJSMin(((exports) => {
14408
14409
  Object.defineProperty(exports, "__esModule", { value: true });
14409
14410
  exports.IdTokenClient = void 0;
@@ -14440,7 +14441,7 @@ var require_idtokenclient = /* @__PURE__ */ __commonJSMin(((exports) => {
14440
14441
  exports.IdTokenClient = IdTokenClient;
14441
14442
  }));
14442
14443
  //#endregion
14443
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/envDetect.js
14444
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/envDetect.js
14444
14445
  var require_envDetect = /* @__PURE__ */ __commonJSMin(((exports) => {
14445
14446
  Object.defineProperty(exports, "__esModule", { value: true });
14446
14447
  exports.GCPEnv = void 0;
@@ -14966,7 +14967,7 @@ var require_jws = /* @__PURE__ */ __commonJSMin(((exports) => {
14966
14967
  };
14967
14968
  }));
14968
14969
  //#endregion
14969
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/gtoken/jwsSign.js
14970
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/gtoken/jwsSign.js
14970
14971
  var require_jwsSign = /* @__PURE__ */ __commonJSMin(((exports) => {
14971
14972
  Object.defineProperty(exports, "__esModule", { value: true });
14972
14973
  exports.buildPayloadForJwsSign = buildPayloadForJwsSign;
@@ -15008,7 +15009,7 @@ var require_jwsSign = /* @__PURE__ */ __commonJSMin(((exports) => {
15008
15009
  }
15009
15010
  }));
15010
15011
  //#endregion
15011
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/gtoken/getToken.js
15012
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/gtoken/getToken.js
15012
15013
  var require_getToken = /* @__PURE__ */ __commonJSMin(((exports) => {
15013
15014
  Object.defineProperty(exports, "__esModule", { value: true });
15014
15015
  exports.getToken = getToken;
@@ -15053,7 +15054,7 @@ var require_getToken = /* @__PURE__ */ __commonJSMin(((exports) => {
15053
15054
  }
15054
15055
  }));
15055
15056
  //#endregion
15056
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/gtoken/errorWithCode.js
15057
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/gtoken/errorWithCode.js
15057
15058
  var require_errorWithCode = /* @__PURE__ */ __commonJSMin(((exports) => {
15058
15059
  Object.defineProperty(exports, "__esModule", { value: true });
15059
15060
  exports.ErrorWithCode = void 0;
@@ -15067,7 +15068,7 @@ var require_errorWithCode = /* @__PURE__ */ __commonJSMin(((exports) => {
15067
15068
  exports.ErrorWithCode = ErrorWithCode;
15068
15069
  }));
15069
15070
  //#endregion
15070
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/gtoken/getCredentials.js
15071
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/gtoken/getCredentials.js
15071
15072
  var require_getCredentials = /* @__PURE__ */ __commonJSMin(((exports) => {
15072
15073
  Object.defineProperty(exports, "__esModule", { value: true });
15073
15074
  exports.getCredentials = getCredentials;
@@ -15175,7 +15176,7 @@ var require_getCredentials = /* @__PURE__ */ __commonJSMin(((exports) => {
15175
15176
  }
15176
15177
  }));
15177
15178
  //#endregion
15178
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/gtoken/tokenHandler.js
15179
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/gtoken/tokenHandler.js
15179
15180
  var require_tokenHandler = /* @__PURE__ */ __commonJSMin(((exports) => {
15180
15181
  Object.defineProperty(exports, "__esModule", { value: true });
15181
15182
  exports.TokenHandler = void 0;
@@ -15255,7 +15256,7 @@ var require_tokenHandler = /* @__PURE__ */ __commonJSMin(((exports) => {
15255
15256
  exports.TokenHandler = TokenHandler;
15256
15257
  }));
15257
15258
  //#endregion
15258
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/gtoken/revokeToken.js
15259
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/gtoken/revokeToken.js
15259
15260
  var require_revokeToken = /* @__PURE__ */ __commonJSMin(((exports) => {
15260
15261
  Object.defineProperty(exports, "__esModule", { value: true });
15261
15262
  exports.revokeToken = revokeToken;
@@ -15278,7 +15279,7 @@ var require_revokeToken = /* @__PURE__ */ __commonJSMin(((exports) => {
15278
15279
  }
15279
15280
  }));
15280
15281
  //#endregion
15281
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/gtoken/googleToken.js
15282
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/gtoken/googleToken.js
15282
15283
  var require_googleToken = /* @__PURE__ */ __commonJSMin(((exports) => {
15283
15284
  Object.defineProperty(exports, "__esModule", { value: true });
15284
15285
  exports.GoogleToken = void 0;
@@ -15370,7 +15371,7 @@ var require_googleToken = /* @__PURE__ */ __commonJSMin(((exports) => {
15370
15371
  exports.GoogleToken = GoogleToken;
15371
15372
  }));
15372
15373
  //#endregion
15373
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/jwtaccess.js
15374
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/jwtaccess.js
15374
15375
  var require_jwtaccess = /* @__PURE__ */ __commonJSMin(((exports) => {
15375
15376
  Object.defineProperty(exports, "__esModule", { value: true });
15376
15377
  exports.JWTAccess = void 0;
@@ -15515,7 +15516,7 @@ var require_jwtaccess = /* @__PURE__ */ __commonJSMin(((exports) => {
15515
15516
  };
15516
15517
  }));
15517
15518
  //#endregion
15518
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/jwtclient.js
15519
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/jwtclient.js
15519
15520
  var require_jwtclient = /* @__PURE__ */ __commonJSMin(((exports) => {
15520
15521
  Object.defineProperty(exports, "__esModule", { value: true });
15521
15522
  exports.JWT = void 0;
@@ -15741,7 +15742,7 @@ var require_jwtclient = /* @__PURE__ */ __commonJSMin(((exports) => {
15741
15742
  };
15742
15743
  }));
15743
15744
  //#endregion
15744
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/refreshclient.js
15745
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/refreshclient.js
15745
15746
  var require_refreshclient = /* @__PURE__ */ __commonJSMin(((exports) => {
15746
15747
  Object.defineProperty(exports, "__esModule", { value: true });
15747
15748
  exports.UserRefreshClient = exports.USER_REFRESH_ACCOUNT_TYPE = void 0;
@@ -15846,7 +15847,7 @@ var require_refreshclient = /* @__PURE__ */ __commonJSMin(((exports) => {
15846
15847
  };
15847
15848
  }));
15848
15849
  //#endregion
15849
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/impersonated.js
15850
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/impersonated.js
15850
15851
  var require_impersonated = /* @__PURE__ */ __commonJSMin(((exports) => {
15851
15852
  /**
15852
15853
  * Copyright 2021 Google LLC
@@ -16029,7 +16030,7 @@ var require_impersonated = /* @__PURE__ */ __commonJSMin(((exports) => {
16029
16030
  };
16030
16031
  }));
16031
16032
  //#endregion
16032
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/oauth2common.js
16033
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/oauth2common.js
16033
16034
  var require_oauth2common = /* @__PURE__ */ __commonJSMin(((exports) => {
16034
16035
  Object.defineProperty(exports, "__esModule", { value: true });
16035
16036
  exports.OAuthClientAuthHandler = void 0;
@@ -16178,7 +16179,7 @@ var require_oauth2common = /* @__PURE__ */ __commonJSMin(((exports) => {
16178
16179
  }
16179
16180
  }));
16180
16181
  //#endregion
16181
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/stscredentials.js
16182
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/stscredentials.js
16182
16183
  var require_stscredentials = /* @__PURE__ */ __commonJSMin(((exports) => {
16183
16184
  Object.defineProperty(exports, "__esModule", { value: true });
16184
16185
  exports.StsCredentials = void 0;
@@ -16251,7 +16252,7 @@ var require_stscredentials = /* @__PURE__ */ __commonJSMin(((exports) => {
16251
16252
  };
16252
16253
  }));
16253
16254
  //#endregion
16254
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/baseexternalclient.js
16255
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/baseexternalclient.js
16255
16256
  var require_baseexternalclient = /* @__PURE__ */ __commonJSMin(((exports) => {
16256
16257
  Object.defineProperty(exports, "__esModule", { value: true });
16257
16258
  exports.BaseExternalAccountClient = exports.CLOUD_RESOURCE_MANAGER = exports.EXTERNAL_ACCOUNT_TYPE = exports.EXPIRATION_TIME_OFFSET = void 0;
@@ -16618,7 +16619,7 @@ var require_baseexternalclient = /* @__PURE__ */ __commonJSMin(((exports) => {
16618
16619
  };
16619
16620
  }));
16620
16621
  //#endregion
16621
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/filesubjecttokensupplier.js
16622
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/filesubjecttokensupplier.js
16622
16623
  var require_filesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((exports) => {
16623
16624
  Object.defineProperty(exports, "__esModule", { value: true });
16624
16625
  exports.FileSubjectTokenSupplier = void 0;
@@ -16671,7 +16672,7 @@ var require_filesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((exports)
16671
16672
  exports.FileSubjectTokenSupplier = FileSubjectTokenSupplier;
16672
16673
  }));
16673
16674
  //#endregion
16674
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/urlsubjecttokensupplier.js
16675
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/urlsubjecttokensupplier.js
16675
16676
  var require_urlsubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((exports) => {
16676
16677
  Object.defineProperty(exports, "__esModule", { value: true });
16677
16678
  exports.UrlSubjectTokenSupplier = void 0;
@@ -16723,7 +16724,7 @@ var require_urlsubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((exports) =
16723
16724
  exports.UrlSubjectTokenSupplier = UrlSubjectTokenSupplier;
16724
16725
  }));
16725
16726
  //#endregion
16726
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/certificatesubjecttokensupplier.js
16727
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/certificatesubjecttokensupplier.js
16727
16728
  var require_certificatesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((exports) => {
16728
16729
  Object.defineProperty(exports, "__esModule", { value: true });
16729
16730
  exports.CertificateSubjectTokenSupplier = exports.InvalidConfigurationError = exports.CertificateSourceUnavailableError = exports.CERTIFICATE_CONFIGURATION_ENV_VARIABLE = void 0;
@@ -16897,7 +16898,7 @@ var require_certificatesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((ex
16897
16898
  exports.CertificateSubjectTokenSupplier = CertificateSubjectTokenSupplier;
16898
16899
  }));
16899
16900
  //#endregion
16900
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/identitypoolclient.js
16901
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/identitypoolclient.js
16901
16902
  var require_identitypoolclient = /* @__PURE__ */ __commonJSMin(((exports) => {
16902
16903
  Object.defineProperty(exports, "__esModule", { value: true });
16903
16904
  exports.IdentityPoolClient = void 0;
@@ -16994,7 +16995,7 @@ var require_identitypoolclient = /* @__PURE__ */ __commonJSMin(((exports) => {
16994
16995
  };
16995
16996
  }));
16996
16997
  //#endregion
16997
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/awsrequestsigner.js
16998
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/awsrequestsigner.js
16998
16999
  var require_awsrequestsigner = /* @__PURE__ */ __commonJSMin(((exports) => {
16999
17000
  Object.defineProperty(exports, "__esModule", { value: true });
17000
17001
  exports.AwsRequestSigner = void 0;
@@ -17141,7 +17142,7 @@ var require_awsrequestsigner = /* @__PURE__ */ __commonJSMin(((exports) => {
17141
17142
  }
17142
17143
  }));
17143
17144
  //#endregion
17144
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/defaultawssecuritycredentialssupplier.js
17145
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/defaultawssecuritycredentialssupplier.js
17145
17146
  var require_defaultawssecuritycredentialssupplier = /* @__PURE__ */ __commonJSMin(((exports) => {
17146
17147
  Object.defineProperty(exports, "__esModule", { value: true });
17147
17148
  exports.DefaultAwsSecurityCredentialsSupplier = void 0;
@@ -17295,7 +17296,7 @@ var require_defaultawssecuritycredentialssupplier = /* @__PURE__ */ __commonJSMi
17295
17296
  exports.DefaultAwsSecurityCredentialsSupplier = DefaultAwsSecurityCredentialsSupplier;
17296
17297
  }));
17297
17298
  //#endregion
17298
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/awsclient.js
17299
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/awsclient.js
17299
17300
  var require_awsclient = /* @__PURE__ */ __commonJSMin(((exports) => {
17300
17301
  Object.defineProperty(exports, "__esModule", { value: true });
17301
17302
  exports.AwsClient = void 0;
@@ -17394,7 +17395,7 @@ var require_awsclient = /* @__PURE__ */ __commonJSMin(((exports) => {
17394
17395
  };
17395
17396
  }));
17396
17397
  //#endregion
17397
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/executable-response.js
17398
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/executable-response.js
17398
17399
  var require_executable_response = /* @__PURE__ */ __commonJSMin(((exports) => {
17399
17400
  Object.defineProperty(exports, "__esModule", { value: true });
17400
17401
  exports.InvalidSubjectTokenError = exports.InvalidMessageFieldError = exports.InvalidCodeFieldError = exports.InvalidTokenTypeFieldError = exports.InvalidExpirationTimeFieldError = exports.InvalidSuccessFieldError = exports.InvalidVersionFieldError = exports.ExecutableResponseError = exports.ExecutableResponse = void 0;
@@ -17528,7 +17529,7 @@ var require_executable_response = /* @__PURE__ */ __commonJSMin(((exports) => {
17528
17529
  exports.InvalidSubjectTokenError = InvalidSubjectTokenError;
17529
17530
  }));
17530
17531
  //#endregion
17531
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/pluggable-auth-handler.js
17532
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/pluggable-auth-handler.js
17532
17533
  var require_pluggable_auth_handler = /* @__PURE__ */ __commonJSMin(((exports) => {
17533
17534
  Object.defineProperty(exports, "__esModule", { value: true });
17534
17535
  exports.PluggableAuthHandler = exports.ExecutableError = void 0;
@@ -17640,7 +17641,7 @@ var require_pluggable_auth_handler = /* @__PURE__ */ __commonJSMin(((exports) =>
17640
17641
  };
17641
17642
  }));
17642
17643
  //#endregion
17643
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/pluggable-auth-client.js
17644
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/pluggable-auth-client.js
17644
17645
  var require_pluggable_auth_client = /* @__PURE__ */ __commonJSMin(((exports) => {
17645
17646
  Object.defineProperty(exports, "__esModule", { value: true });
17646
17647
  exports.PluggableAuthClient = exports.ExecutableError = void 0;
@@ -17815,7 +17816,7 @@ var require_pluggable_auth_client = /* @__PURE__ */ __commonJSMin(((exports) =>
17815
17816
  exports.PluggableAuthClient = PluggableAuthClient;
17816
17817
  }));
17817
17818
  //#endregion
17818
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/externalclient.js
17819
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/externalclient.js
17819
17820
  var require_externalclient = /* @__PURE__ */ __commonJSMin(((exports) => {
17820
17821
  Object.defineProperty(exports, "__esModule", { value: true });
17821
17822
  exports.ExternalAccountClient = void 0;
@@ -17857,7 +17858,7 @@ var require_externalclient = /* @__PURE__ */ __commonJSMin(((exports) => {
17857
17858
  exports.ExternalAccountClient = ExternalAccountClient;
17858
17859
  }));
17859
17860
  //#endregion
17860
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/externalAccountAuthorizedUserClient.js
17861
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/externalAccountAuthorizedUserClient.js
17861
17862
  var require_externalAccountAuthorizedUserClient = /* @__PURE__ */ __commonJSMin(((exports) => {
17862
17863
  Object.defineProperty(exports, "__esModule", { value: true });
17863
17864
  exports.ExternalAccountAuthorizedUserClient = exports.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE = void 0;
@@ -18033,7 +18034,7 @@ var require_externalAccountAuthorizedUserClient = /* @__PURE__ */ __commonJSMin(
18033
18034
  exports.ExternalAccountAuthorizedUserClient = ExternalAccountAuthorizedUserClient;
18034
18035
  }));
18035
18036
  //#endregion
18036
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/googleauth.js
18037
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/googleauth.js
18037
18038
  var require_googleauth = /* @__PURE__ */ __commonJSMin(((exports) => {
18038
18039
  Object.defineProperty(exports, "__esModule", { value: true });
18039
18040
  exports.GoogleAuth = exports.GoogleAuthExceptionMessages = void 0;
@@ -18699,7 +18700,7 @@ var require_googleauth = /* @__PURE__ */ __commonJSMin(((exports) => {
18699
18700
  exports.GoogleAuth = GoogleAuth;
18700
18701
  }));
18701
18702
  //#endregion
18702
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/iam.js
18703
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/iam.js
18703
18704
  var require_iam = /* @__PURE__ */ __commonJSMin(((exports) => {
18704
18705
  Object.defineProperty(exports, "__esModule", { value: true });
18705
18706
  exports.IAMAuth = void 0;
@@ -18732,7 +18733,7 @@ var require_iam = /* @__PURE__ */ __commonJSMin(((exports) => {
18732
18733
  exports.IAMAuth = IAMAuth;
18733
18734
  }));
18734
18735
  //#endregion
18735
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/downscopedclient.js
18736
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/downscopedclient.js
18736
18737
  var require_downscopedclient = /* @__PURE__ */ __commonJSMin(((exports) => {
18737
18738
  Object.defineProperty(exports, "__esModule", { value: true });
18738
18739
  exports.DownscopedClient = exports.EXPIRATION_TIME_OFFSET = exports.MAX_ACCESS_BOUNDARY_RULES_COUNT = void 0;
@@ -18923,7 +18924,7 @@ var require_downscopedclient = /* @__PURE__ */ __commonJSMin(((exports) => {
18923
18924
  exports.DownscopedClient = DownscopedClient;
18924
18925
  }));
18925
18926
  //#endregion
18926
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/auth/passthrough.js
18927
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/auth/passthrough.js
18927
18928
  var require_passthrough = /* @__PURE__ */ __commonJSMin(((exports) => {
18928
18929
  Object.defineProperty(exports, "__esModule", { value: true });
18929
18930
  exports.PassThroughClient = void 0;
@@ -18972,7 +18973,7 @@ var require_passthrough = /* @__PURE__ */ __commonJSMin(((exports) => {
18972
18973
  exports.PassThroughClient = PassThroughClient;
18973
18974
  }));
18974
18975
  //#endregion
18975
- //#region ../../node_modules/.pnpm/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/index.js
18976
+ //#region ../../node_modules/.pnpm/google-auth-library@10.6.2_supports-color@8.1.1/node_modules/google-auth-library/build/src/index.js
18976
18977
  var require_src = /* @__PURE__ */ __commonJSMin(((exports) => {
18977
18978
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
18978
18979
  if (k2 === void 0) k2 = k;
@@ -44633,7 +44634,8 @@ var NexumFiles = class {
44633
44634
  this._client = options.apiKey === void 0 || options.apiKey.length === 0 ? void 0 : new OpenAI({
44634
44635
  apiKey: options.apiKey,
44635
44636
  baseURL: options.baseUrl,
44636
- defaultHeaders: options.defaultHeaders
44637
+ defaultHeaders: options.defaultHeaders,
44638
+ maxRetries: 0
44637
44639
  });
44638
44640
  }
44639
44641
  /**
@@ -44692,7 +44694,8 @@ var NexumFiles = class {
44692
44694
  return new OpenAI({
44693
44695
  apiKey: requireProviderApiKey("NexumFiles.uploadVideo", a, this._apiKey),
44694
44696
  baseURL: this._baseUrl,
44695
- defaultHeaders
44697
+ defaultHeaders,
44698
+ maxRetries: 0
44696
44699
  });
44697
44700
  });
44698
44701
  }
@@ -44961,7 +44964,8 @@ var NexumChatProvider = class {
44961
44964
  this._client = this._apiKey === void 0 ? void 0 : new OpenAI({
44962
44965
  apiKey: this._apiKey,
44963
44966
  baseURL: this._baseUrl,
44964
- defaultHeaders: this._defaultHeaders
44967
+ defaultHeaders: this._defaultHeaders,
44968
+ maxRetries: 0
44965
44969
  });
44966
44970
  }
44967
44971
  get modelName() {
@@ -45077,7 +45081,8 @@ var NexumChatProvider = class {
45077
45081
  return new OpenAI({
45078
45082
  apiKey: requireProviderApiKey("NexumChatProvider", a, this._apiKey),
45079
45083
  baseURL: this._baseUrl,
45080
- defaultHeaders
45084
+ defaultHeaders,
45085
+ maxRetries: 0
45081
45086
  });
45082
45087
  });
45083
45088
  }
@@ -45346,7 +45351,8 @@ var OpenAILegacyChatProvider = class {
45346
45351
  _buildClient(apiKey, auth) {
45347
45352
  const clientOpts = {
45348
45353
  apiKey,
45349
- baseURL: this._baseUrl
45354
+ baseURL: this._baseUrl,
45355
+ maxRetries: 0
45350
45356
  };
45351
45357
  const defaultHeaders = mergeRequestHeaders(this._defaultHeaders, auth?.headers);
45352
45358
  if (defaultHeaders !== void 0) clientOpts["defaultHeaders"] = defaultHeaders;
@@ -45993,7 +45999,8 @@ var OpenAIResponsesChatProvider = class {
45993
45999
  _buildClient(apiKey, auth) {
45994
46000
  const clientOpts = {
45995
46001
  apiKey,
45996
- baseURL: this._baseUrl
46002
+ baseURL: this._baseUrl,
46003
+ maxRetries: 0
45997
46004
  };
45998
46005
  const defaultHeaders = mergeRequestHeaders(this._defaultHeaders, auth?.headers);
45999
46006
  if (defaultHeaders !== void 0) clientOpts["defaultHeaders"] = defaultHeaders;
@@ -47334,6 +47341,236 @@ function resolveGlobalLogPath(homeDir) {
47334
47341
  return join$1(homeDir, "logs", "nexum-code.log");
47335
47342
  }
47336
47343
  //#endregion
47344
+ //#region ../../node_modules/.pnpm/@antfu+utils@9.3.0/node_modules/@antfu/utils/dist/index.mjs
47345
+ function uniq(array) {
47346
+ return Array.from(new Set(array));
47347
+ }
47348
+ function notNullish(v) {
47349
+ return v != null;
47350
+ }
47351
+ function objectMap(obj, fn) {
47352
+ return Object.fromEntries(Object.entries(obj).map(([k, v]) => fn(k, v)).filter(notNullish));
47353
+ }
47354
+ function sleep$1(ms, callback) {
47355
+ return new Promise((resolve) => setTimeout(async () => {
47356
+ await callback?.();
47357
+ resolve();
47358
+ }, ms));
47359
+ }
47360
+ function createControlledPromise() {
47361
+ let resolve, reject;
47362
+ const promise = new Promise((_resolve, _reject) => {
47363
+ resolve = _resolve;
47364
+ reject = _reject;
47365
+ });
47366
+ promise.resolve = resolve;
47367
+ promise.reject = reject;
47368
+ return promise;
47369
+ }
47370
+ //#endregion
47371
+ //#region ../../packages/agent-core/src/utils/abort.ts
47372
+ function abortError() {
47373
+ const error = /* @__PURE__ */ new Error("Aborted");
47374
+ error.name = "AbortError";
47375
+ return error;
47376
+ }
47377
+ /**
47378
+ * Marks an abort the user triggered deliberately (e.g. pressing ESC to
47379
+ * interrupt the agent), as distinct from a timeout, an internal error, or any
47380
+ * other programmatic abort. It travels as the AbortSignal's `reason`, so code
47381
+ * that settles an interrupted operation can tell a user interruption apart from
47382
+ * a failure and report it to the model accordingly instead of emitting a
47383
+ * neutral "was aborted" that the model mistakes for a system problem.
47384
+ *
47385
+ * `name` stays 'AbortError' so existing `isAbortError()` checks (and
47386
+ * `AbortSignal.throwIfAborted()`) keep treating it as an abort.
47387
+ */
47388
+ var UserCancellationError = class extends Error {
47389
+ userCancelled = true;
47390
+ constructor() {
47391
+ super("Aborted by the user");
47392
+ this.name = "AbortError";
47393
+ }
47394
+ };
47395
+ function userCancellationReason() {
47396
+ return new UserCancellationError();
47397
+ }
47398
+ function isUserCancellation(value) {
47399
+ return value instanceof UserCancellationError;
47400
+ }
47401
+ function abortable(promise, signal) {
47402
+ signal.throwIfAborted();
47403
+ return new Promise((resolve, reject) => {
47404
+ const onAbort = () => {
47405
+ reject(abortError());
47406
+ };
47407
+ signal.addEventListener("abort", onAbort, { once: true });
47408
+ promise.then(resolve, reject).finally(() => {
47409
+ signal.removeEventListener("abort", onAbort);
47410
+ });
47411
+ });
47412
+ }
47413
+ function linkAbortSignal(source, target) {
47414
+ const onAbort = () => {
47415
+ target.abort(source.reason);
47416
+ };
47417
+ if (source.aborted) {
47418
+ onAbort();
47419
+ return () => {};
47420
+ }
47421
+ source.addEventListener("abort", onAbort, { once: true });
47422
+ return () => {
47423
+ source.removeEventListener("abort", onAbort);
47424
+ };
47425
+ }
47426
+ function createDeadlineAbortSignal(source, timeoutMs) {
47427
+ const controller = new AbortController();
47428
+ const unlinkAbortSignal = linkAbortSignal(source, controller);
47429
+ let didTimeout = false;
47430
+ let timeout = setTimeout(() => {
47431
+ didTimeout = true;
47432
+ controller.abort(abortError());
47433
+ }, timeoutMs);
47434
+ return {
47435
+ signal: controller.signal,
47436
+ timedOut: () => didTimeout,
47437
+ clear: () => {
47438
+ if (timeout !== void 0) clearTimeout(timeout);
47439
+ timeout = void 0;
47440
+ unlinkAbortSignal();
47441
+ }
47442
+ };
47443
+ }
47444
+ //#endregion
47445
+ //#region ../../packages/agent-core/src/loop/errors.ts
47446
+ /**
47447
+ * Loop-local error helpers.
47448
+ */
47449
+ function createMaxStepsExceededError(maxSteps, message) {
47450
+ return new NexumError(ErrorCodes.LOOP_MAX_STEPS_EXCEEDED, message ?? `Turn exceeded maxSteps=${maxSteps}`, { details: { maxSteps } });
47451
+ }
47452
+ function isMaxStepsExceededError(error) {
47453
+ return isNexumError(error) && error.code === ErrorCodes.LOOP_MAX_STEPS_EXCEEDED;
47454
+ }
47455
+ function isAbortError$1(err) {
47456
+ if (err instanceof Error) return err.name === "AbortError";
47457
+ return false;
47458
+ }
47459
+ function errorMessage$4(err) {
47460
+ if (err instanceof Error) return err.message;
47461
+ return String(err);
47462
+ }
47463
+ const BASE_DELAY_MS = 500;
47464
+ const MAX_DELAY_MS = 32e3;
47465
+ const RETRY_FACTOR = 2;
47466
+ const JITTER_FACTOR = .25;
47467
+ async function chatWithRetry(input) {
47468
+ const maxAttempts = input.maxAttempts ?? 10;
47469
+ if (input.llm.isRetryableError === void 0 || maxAttempts <= 1) {
47470
+ const effectiveMaxAttempts = Math.max(maxAttempts, 1);
47471
+ try {
47472
+ return await input.llm.chat(paramsForAttempt(input, 1, effectiveMaxAttempts));
47473
+ } catch (error) {
47474
+ logRequestFailure(input, error, 1, effectiveMaxAttempts);
47475
+ throw error;
47476
+ }
47477
+ }
47478
+ const delays = retryBackoffDelays(maxAttempts);
47479
+ for (let attempt = 1;; attempt += 1) try {
47480
+ return await input.llm.chat(paramsForAttempt(input, attempt, maxAttempts));
47481
+ } catch (error) {
47482
+ if (error instanceof APIContextOverflowError) {
47483
+ logRequestFailure(input, error, attempt, maxAttempts);
47484
+ throw error;
47485
+ }
47486
+ if (error instanceof APIProviderRateLimitError && error.reason === "QUOTA_EXHAUSTED") {
47487
+ logRequestFailure(input, error, attempt, maxAttempts);
47488
+ throw error;
47489
+ }
47490
+ if (attempt >= maxAttempts || !input.llm.isRetryableError(error)) {
47491
+ logRequestFailure(input, error, attempt, maxAttempts);
47492
+ throw error;
47493
+ }
47494
+ const delayMs = computeDelayMs(error, delays, attempt);
47495
+ input.params.signal.throwIfAborted();
47496
+ input.dispatchEvent({
47497
+ type: "step.retrying",
47498
+ turnId: input.turnId,
47499
+ step: input.currentStep,
47500
+ stepUuid: input.stepUuid,
47501
+ failedAttempt: attempt,
47502
+ nextAttempt: attempt + 1,
47503
+ maxAttempts,
47504
+ delayMs,
47505
+ ...retryErrorFields(error)
47506
+ });
47507
+ await sleepForRetry(delayMs, input.params.signal);
47508
+ }
47509
+ }
47510
+ function computeDelayMs(error, delays, attempt) {
47511
+ const retryAfter = readRetryAfterMs(error);
47512
+ if (retryAfter !== null) return retryAfter;
47513
+ if (error instanceof APIProviderRateLimitError) return calculateRateLimitBackoffMs(error.reason);
47514
+ return delays[attempt - 1] ?? 0;
47515
+ }
47516
+ /**
47517
+ * Server-requested backoff carried on an `APIStatusError` (parsed from
47518
+ * the `Retry-After` response header). When present and positive it
47519
+ * overrides the computed backoff - a server `Retry-After` directive
47520
+ * takes precedence over the local exponential delay.
47521
+ */
47522
+ function readRetryAfterMs(error) {
47523
+ if (typeof error !== "object" || error === null) return null;
47524
+ const value = error.retryAfterMs;
47525
+ return typeof value === "number" && value > 0 ? value : null;
47526
+ }
47527
+ function logRequestFailure(input, error, attempt, maxAttempts) {
47528
+ if (isAbortError$1(error) || input.params.signal.aborted) return;
47529
+ input.log?.warn("llm request failed", {
47530
+ turnStep: `${input.turnId}.${String(input.currentStep)}`,
47531
+ attempt: `${String(attempt)}/${String(maxAttempts)}`,
47532
+ model: input.llm.modelName,
47533
+ ...retryErrorFields(error)
47534
+ });
47535
+ }
47536
+ function paramsForAttempt(input, attempt, maxAttempts) {
47537
+ return {
47538
+ ...input.params,
47539
+ requestLogContext: {
47540
+ turnId: input.turnId,
47541
+ step: input.currentStep,
47542
+ stepUuid: input.stepUuid,
47543
+ attempt,
47544
+ maxAttempts
47545
+ }
47546
+ };
47547
+ }
47548
+ function retryBackoffDelays(maxAttempts) {
47549
+ const count = Math.max(maxAttempts - 1, 0);
47550
+ const delays = [];
47551
+ for (let i = 0; i < count; i += 1) {
47552
+ const base = Math.min(BASE_DELAY_MS * Math.pow(RETRY_FACTOR, i), MAX_DELAY_MS);
47553
+ delays.push(base + Math.random() * JITTER_FACTOR * base);
47554
+ }
47555
+ return delays;
47556
+ }
47557
+ async function sleepForRetry(delayMs, signal) {
47558
+ signal.throwIfAborted();
47559
+ await abortable(sleep$1(delayMs), signal);
47560
+ }
47561
+ function retryErrorFields(error) {
47562
+ return {
47563
+ errorName: error instanceof Error ? error.name : typeof error,
47564
+ errorMessage: error instanceof Error ? error.message : String(error),
47565
+ statusCode: maybeStatusCode(error)
47566
+ };
47567
+ }
47568
+ function maybeStatusCode(error) {
47569
+ if (typeof error !== "object" || error === null) return void 0;
47570
+ const statusCode = error.statusCode;
47571
+ return typeof statusCode === "number" ? statusCode : void 0;
47572
+ }
47573
+ //#endregion
47337
47574
  //#region ../../packages/agent-core/src/utils/tokens.ts
47338
47575
  /**
47339
47576
  * WeakMap cache for per-message token estimates. Messages are immutable once
@@ -47390,25 +47627,6 @@ function estimateTokensForContentPart(part) {
47390
47627
  return 0;
47391
47628
  }
47392
47629
  //#endregion
47393
- //#region ../../packages/agent-core/src/loop/errors.ts
47394
- /**
47395
- * Loop-local error helpers.
47396
- */
47397
- function createMaxStepsExceededError(maxSteps, message) {
47398
- return new NexumError(ErrorCodes.LOOP_MAX_STEPS_EXCEEDED, message ?? `Turn exceeded maxSteps=${maxSteps}`, { details: { maxSteps } });
47399
- }
47400
- function isMaxStepsExceededError(error) {
47401
- return isNexumError(error) && error.code === ErrorCodes.LOOP_MAX_STEPS_EXCEEDED;
47402
- }
47403
- function isAbortError$1(err) {
47404
- if (err instanceof Error) return err.name === "AbortError";
47405
- return false;
47406
- }
47407
- function errorMessage$4(err) {
47408
- if (err instanceof Error) return err.message;
47409
- return String(err);
47410
- }
47411
- //#endregion
47412
47630
  //#region ../../packages/agent-core/src/utils/per-id-json-store.ts
47413
47631
  /**
47414
47632
  * Per-id JSON record store — write each value as `<rootDir>/<subdir>/<id>.json`.
@@ -51667,80 +51885,6 @@ function normalizePath$1(path) {
51667
51885
  return folded;
51668
51886
  }
51669
51887
  //#endregion
51670
- //#region ../../packages/agent-core/src/utils/abort.ts
51671
- function abortError() {
51672
- const error = /* @__PURE__ */ new Error("Aborted");
51673
- error.name = "AbortError";
51674
- return error;
51675
- }
51676
- /**
51677
- * Marks an abort the user triggered deliberately (e.g. pressing ESC to
51678
- * interrupt the agent), as distinct from a timeout, an internal error, or any
51679
- * other programmatic abort. It travels as the AbortSignal's `reason`, so code
51680
- * that settles an interrupted operation can tell a user interruption apart from
51681
- * a failure and report it to the model accordingly instead of emitting a
51682
- * neutral "was aborted" that the model mistakes for a system problem.
51683
- *
51684
- * `name` stays 'AbortError' so existing `isAbortError()` checks (and
51685
- * `AbortSignal.throwIfAborted()`) keep treating it as an abort.
51686
- */
51687
- var UserCancellationError = class extends Error {
51688
- userCancelled = true;
51689
- constructor() {
51690
- super("Aborted by the user");
51691
- this.name = "AbortError";
51692
- }
51693
- };
51694
- function userCancellationReason() {
51695
- return new UserCancellationError();
51696
- }
51697
- function isUserCancellation(value) {
51698
- return value instanceof UserCancellationError;
51699
- }
51700
- function abortable(promise, signal) {
51701
- signal.throwIfAborted();
51702
- return new Promise((resolve, reject) => {
51703
- const onAbort = () => {
51704
- reject(abortError());
51705
- };
51706
- signal.addEventListener("abort", onAbort, { once: true });
51707
- promise.then(resolve, reject).finally(() => {
51708
- signal.removeEventListener("abort", onAbort);
51709
- });
51710
- });
51711
- }
51712
- function linkAbortSignal(source, target) {
51713
- const onAbort = () => {
51714
- target.abort(source.reason);
51715
- };
51716
- if (source.aborted) {
51717
- onAbort();
51718
- return () => {};
51719
- }
51720
- source.addEventListener("abort", onAbort, { once: true });
51721
- return () => {
51722
- source.removeEventListener("abort", onAbort);
51723
- };
51724
- }
51725
- function createDeadlineAbortSignal(source, timeoutMs) {
51726
- const controller = new AbortController();
51727
- const unlinkAbortSignal = linkAbortSignal(source, controller);
51728
- let didTimeout = false;
51729
- let timeout = setTimeout(() => {
51730
- didTimeout = true;
51731
- controller.abort(abortError());
51732
- }, timeoutMs);
51733
- return {
51734
- signal: controller.signal,
51735
- timedOut: () => didTimeout,
51736
- clear: () => {
51737
- if (timeout !== void 0) clearTimeout(timeout);
51738
- timeout = void 0;
51739
- unlinkAbortSignal();
51740
- }
51741
- };
51742
- }
51743
- //#endregion
51744
51888
  //#region ../../packages/agent-core/src/tools/builtin/collaboration/agent-background-disabled.md
51745
51889
  var agent_background_disabled_default = "Background agent execution is disabled for this agent. Do not set `run_in_background=true`.";
51746
51890
  //#endregion
@@ -54956,7 +55100,7 @@ var LspClient = class {
54956
55100
  while (Date.now() - start < timeoutMs) {
54957
55101
  const collected = this.collectedDiagnostics.get(uri);
54958
55102
  if (collected !== void 0) return collected;
54959
- await sleep$1(100);
55103
+ await sleep(100);
54960
55104
  }
54961
55105
  return this.collectedDiagnostics.get(uri) ?? [];
54962
55106
  }
@@ -55058,7 +55202,7 @@ function uriToPath(uri) {
55058
55202
  if (process.platform === "win32" && filePath.startsWith("/") && /^[A-Za-z]:/.test(filePath.slice(1))) filePath = filePath.slice(1);
55059
55203
  return filePath;
55060
55204
  }
55061
- function sleep$1(ms) {
55205
+ function sleep(ms) {
55062
55206
  return new Promise((resolve) => {
55063
55207
  setTimeout(resolve, ms);
55064
55208
  });
@@ -59584,7 +59728,8 @@ const DOCUMENTATION_MARKDOWN_LOWER$1 = new Set([
59584
59728
  "code_of_conduct.md",
59585
59729
  "architecture.md",
59586
59730
  "design.md",
59587
- "notes.md"
59731
+ "notes.md",
59732
+ "agents.md"
59588
59733
  ]);
59589
59734
  async function resolveSkillRoots(options) {
59590
59735
  const isDir = options.isDir ?? defaultIsDir;
@@ -70217,7 +70362,23 @@ function renderPrompt(template, vars) {
70217
70362
  }
70218
70363
  //#endregion
70219
70364
  //#region ../../packages/agent-core/src/tools/builtin/collaboration/skill-tool.md
70220
- var skill_tool_default = "Invoke a registered skill from the current skill listing. BLOCKING REQUIREMENT: when a skill from the listing matches the user's request, you MUST call this tool (not free-form text). Do NOT call the same skill repeatedly inside one turn — recursive depth is capped at {{ MAX_SKILL_QUERY_DEPTH }}.";
70365
+ var skill_tool_default = "Invoke a registered skill from the current skill listing. BLOCKING REQUIREMENT: when a skill from the listing matches the user's request, you MUST call this tool (not free-form text). Do NOT call the same skill repeatedly inside one turn — recursive depth is capped at {{ MAX_SKILL_QUERY_DEPTH }}.\r\n\r\n## Currently model-invocable skills\r\n{{ AVAILABLE_SKILLS }}\r\nThis list is a construction-time snapshot; for the live catalog inspect the skill registry.";
70366
+ /** Max skills to list inline in the tool description; rest are summarized. */
70367
+ const MAX_INLINE_SKILLS = 15;
70368
+ /** Max description length per skill line. */
70369
+ const MAX_SKILL_DESC_CHARS = 100;
70370
+ function buildSkillToolDescription(agent) {
70371
+ const skills = agent.skills?.registry.listInvocableSkills() ?? [];
70372
+ const lines = skills.slice(0, MAX_INLINE_SKILLS).map((s) => {
70373
+ const desc = s.description.trim().replaceAll(/\n/g, " ").slice(0, MAX_SKILL_DESC_CHARS);
70374
+ return `- ${s.name}: ${desc}`;
70375
+ });
70376
+ if (skills.length > MAX_INLINE_SKILLS) lines.push(`…${String(skills.length - MAX_INLINE_SKILLS)} more (see skill registry)`);
70377
+ return renderPrompt(skill_tool_default, {
70378
+ MAX_SKILL_QUERY_DEPTH: 3,
70379
+ AVAILABLE_SKILLS: lines.length > 0 ? lines.join("\n") : "(none currently registered)"
70380
+ });
70381
+ }
70221
70382
  var NestedSkillTooDeepError = class extends Error {
70222
70383
  skillName;
70223
70384
  depth;
@@ -70237,11 +70398,12 @@ var SkillTool = class SkillTool {
70237
70398
  agent;
70238
70399
  options;
70239
70400
  name = "Skill";
70240
- description = renderPrompt(skill_tool_default, { MAX_SKILL_QUERY_DEPTH: 3 });
70401
+ description;
70241
70402
  parameters = toInputJsonSchema(SkillToolInputSchema);
70242
70403
  constructor(agent, options = {}) {
70243
70404
  this.agent = agent;
70244
70405
  this.options = options;
70406
+ this.description = buildSkillToolDescription(agent);
70245
70407
  }
70246
70408
  resolveExecution(args) {
70247
70409
  return {
@@ -71950,7 +72112,6 @@ const BARE_SKILL_PATH = "SKILL.md";
71950
72112
  const UNSUPPORTED_RUNTIME_FIELDS = [
71951
72113
  "tools",
71952
72114
  "commands",
71953
- "hooks",
71954
72115
  "apps",
71955
72116
  "inject",
71956
72117
  "configFile",
@@ -72047,7 +72208,10 @@ async function parseManifest(pluginRoot) {
72047
72208
  if (await isFile$1(path.join(pluginRoot, "SKILL.md"))) skills = [pluginRoot];
72048
72209
  }
72049
72210
  const skillInstructions = typeof raw["skillInstructions"] === "string" ? raw["skillInstructions"] : void 0;
72211
+ const config = typeof raw["config"] === "object" && raw["config"] !== null && !Array.isArray(raw["config"]) ? raw["config"] : void 0;
72050
72212
  recordUnsupportedRuntimeFields(raw, diagnostics);
72213
+ const entryPoint = await readEntryPoint(pluginRoot, raw["entryPoint"], diagnostics);
72214
+ const hooks = readHooks(pluginRoot, raw["hooks"], diagnostics);
72051
72215
  return {
72052
72216
  manifest: {
72053
72217
  name,
@@ -72061,7 +72225,10 @@ async function parseManifest(pluginRoot) {
72061
72225
  sessionStart: readSessionStart(raw["sessionStart"], diagnostics),
72062
72226
  mcpServers: await readMcpServers(pluginRoot, raw["mcpServers"], diagnostics),
72063
72227
  interface: readInterface(raw["interface"]),
72064
- skillInstructions
72228
+ skillInstructions,
72229
+ config,
72230
+ entryPoint,
72231
+ hooks
72065
72232
  },
72066
72233
  manifestKind,
72067
72234
  manifestPath,
@@ -72078,6 +72245,75 @@ function recordUnsupportedRuntimeFields(raw, diagnostics) {
72078
72245
  });
72079
72246
  }
72080
72247
  }
72248
+ async function readEntryPoint(pluginRoot, raw, diagnostics) {
72249
+ if (raw === void 0) return void 0;
72250
+ if (typeof raw !== "string") {
72251
+ diagnostics.push({
72252
+ severity: "warn",
72253
+ message: "\"entryPoint\" must be a string"
72254
+ });
72255
+ return;
72256
+ }
72257
+ return resolvePluginPathField({
72258
+ pluginRoot,
72259
+ field: "entryPoint",
72260
+ value: raw,
72261
+ diagnostics
72262
+ });
72263
+ }
72264
+ /**
72265
+ * Parse a plugin's declared hooks (external-command HookEngine channel). Each
72266
+ * entry mirrors {@link HookDef}: event, optional matcher, command (a `./`
72267
+ * relative command is resolved against the plugin root), optional timeout.
72268
+ * Unknown event names are kept (cast): they can never match a HookEngine
72269
+ * trigger, so they are inert rather than harmful.
72270
+ */
72271
+ function readHooks(pluginRoot, raw, diagnostics) {
72272
+ if (raw === void 0) return void 0;
72273
+ if (!Array.isArray(raw)) {
72274
+ diagnostics.push({
72275
+ severity: "warn",
72276
+ message: "\"hooks\" must be an array"
72277
+ });
72278
+ return;
72279
+ }
72280
+ const out = [];
72281
+ for (const entry of raw) {
72282
+ if (!isObject(entry)) {
72283
+ diagnostics.push({
72284
+ severity: "warn",
72285
+ message: "\"hooks\" entries must be objects"
72286
+ });
72287
+ continue;
72288
+ }
72289
+ const event = stringField$1(entry, "event");
72290
+ if (event === void 0) {
72291
+ diagnostics.push({
72292
+ severity: "warn",
72293
+ message: "\"hooks\" entry is missing \"event\""
72294
+ });
72295
+ continue;
72296
+ }
72297
+ let command = stringField$1(entry, "command");
72298
+ if (command === void 0) {
72299
+ diagnostics.push({
72300
+ severity: "warn",
72301
+ message: "\"hooks\" entry is missing \"command\""
72302
+ });
72303
+ continue;
72304
+ }
72305
+ if (command.startsWith("./")) command = path.resolve(pluginRoot, command);
72306
+ const timeout = typeof entry["timeout"] === "number" ? entry["timeout"] : void 0;
72307
+ const hook = {
72308
+ event,
72309
+ command,
72310
+ ...stringField$1(entry, "matcher") !== void 0 ? { matcher: stringField$1(entry, "matcher") } : {},
72311
+ ...timeout !== void 0 ? { timeout } : {}
72312
+ };
72313
+ out.push(hook);
72314
+ }
72315
+ return out.length > 0 ? out : void 0;
72316
+ }
72081
72317
  async function resolveSkillsField(pluginRoot, raw, diagnostics) {
72082
72318
  if (raw === void 0) return [];
72083
72319
  const entries = [];
@@ -73174,7 +73410,7 @@ var MakeSkillPlanTool = class {
73174
73410
  }
73175
73411
  async generatePlan(args) {
73176
73412
  const userPrompt = buildUserPrompt(args, buildTranscript(this.agent.context.history));
73177
- const response = await this.agent.generate(this.agent.config.provider, SYSTEM_PROMPT, [], [{
73413
+ const response = await this.agent.generateWithRetry(this.agent.config.provider, SYSTEM_PROMPT, [], [{
73178
73414
  role: "user",
73179
73415
  content: [{
73180
73416
  type: "text",
@@ -82103,142 +82339,62 @@ function buildBackgroundTaskNotificationBody(info, isAgentTask) {
82103
82339
  ].join("\n")}`;
82104
82340
  }
82105
82341
  //#endregion
82106
- //#region ../../node_modules/.pnpm/@antfu+utils@9.3.0/node_modules/@antfu/utils/dist/index.mjs
82107
- function uniq(array) {
82108
- return Array.from(new Set(array));
82109
- }
82110
- function notNullish(v) {
82111
- return v != null;
82112
- }
82113
- function objectMap(obj, fn) {
82114
- return Object.fromEntries(Object.entries(obj).map(([k, v]) => fn(k, v)).filter(notNullish));
82115
- }
82116
- function sleep(ms, callback) {
82117
- return new Promise((resolve) => setTimeout(async () => {
82118
- await callback?.();
82119
- resolve();
82120
- }, ms));
82121
- }
82122
- function createControlledPromise() {
82123
- let resolve, reject;
82124
- const promise = new Promise((_resolve, _reject) => {
82125
- resolve = _resolve;
82126
- reject = _reject;
82127
- });
82128
- promise.resolve = resolve;
82129
- promise.reject = reject;
82130
- return promise;
82131
- }
82132
- const BASE_DELAY_MS = 500;
82133
- const MAX_DELAY_MS = 32e3;
82134
- const RETRY_FACTOR = 2;
82135
- const JITTER_FACTOR = .25;
82136
- async function chatWithRetry(input) {
82137
- const maxAttempts = input.maxAttempts ?? 10;
82138
- if (input.llm.isRetryableError === void 0 || maxAttempts <= 1) {
82139
- const effectiveMaxAttempts = Math.max(maxAttempts, 1);
82140
- try {
82141
- return await input.llm.chat(paramsForAttempt(input, 1, effectiveMaxAttempts));
82142
- } catch (error) {
82143
- logRequestFailure(input, error, 1, effectiveMaxAttempts);
82144
- throw error;
82145
- }
82146
- }
82147
- const delays = retryBackoffDelays(maxAttempts);
82148
- for (let attempt = 1;; attempt += 1) try {
82149
- return await input.llm.chat(paramsForAttempt(input, attempt, maxAttempts));
82150
- } catch (error) {
82151
- if (error instanceof APIContextOverflowError) {
82152
- logRequestFailure(input, error, attempt, maxAttempts);
82153
- throw error;
82154
- }
82155
- if (error instanceof APIProviderRateLimitError && error.reason === "QUOTA_EXHAUSTED") {
82156
- logRequestFailure(input, error, attempt, maxAttempts);
82157
- throw error;
82158
- }
82159
- if (attempt >= maxAttempts || !input.llm.isRetryableError(error)) {
82160
- logRequestFailure(input, error, attempt, maxAttempts);
82161
- throw error;
82162
- }
82163
- const delayMs = computeDelayMs(error, delays, attempt);
82164
- input.params.signal.throwIfAborted();
82165
- input.dispatchEvent({
82166
- type: "step.retrying",
82167
- turnId: input.turnId,
82168
- step: input.currentStep,
82169
- stepUuid: input.stepUuid,
82170
- failedAttempt: attempt,
82171
- nextAttempt: attempt + 1,
82172
- maxAttempts,
82173
- delayMs,
82174
- ...retryErrorFields(error)
82175
- });
82176
- await sleepForRetry(delayMs, input.params.signal);
82177
- }
82178
- }
82179
- function computeDelayMs(error, delays, attempt) {
82180
- const retryAfter = readRetryAfterMs(error);
82181
- if (retryAfter !== null) return retryAfter;
82182
- if (error instanceof APIProviderRateLimitError) return calculateRateLimitBackoffMs(error.reason);
82183
- return delays[attempt - 1] ?? 0;
82184
- }
82342
+ //#region ../../packages/agent-core/src/agent/events.ts
82185
82343
  /**
82186
- * Server-requested backoff carried on an `APIStatusError` (parsed from
82187
- * the `Retry-After` response header). When present and positive it
82188
- * overrides the computed backoff - a server `Retry-After` directive
82189
- * takes precedence over the local exponential delay.
82344
+ * In-process subscription bus for {@link AgentEvent}s.
82345
+ *
82346
+ * Mirrors the events the agent already broadcasts to the host via
82347
+ * `rpc.emitEvent`, so third-party extensions running inside the agent process
82348
+ * can subscribe without round-tripping through the host. This is the
82349
+ * read-side companion to {@link import('./index').Agent.emitEvent}.
82350
+ *
82351
+ * Lifecycle: extensions call `subscribe()` when activated and must call
82352
+ * `clear()` (or the returned unsubscribe) when deactivated to avoid leaking
82353
+ * handlers across sessions/restarts.
82190
82354
  */
82191
- function readRetryAfterMs(error) {
82192
- if (typeof error !== "object" || error === null) return null;
82193
- const value = error.retryAfterMs;
82194
- return typeof value === "number" && value > 0 ? value : null;
82195
- }
82196
- function logRequestFailure(input, error, attempt, maxAttempts) {
82197
- if (isAbortError$1(error) || input.params.signal.aborted) return;
82198
- input.log?.warn("llm request failed", {
82199
- turnStep: `${input.turnId}.${String(input.currentStep)}`,
82200
- attempt: `${String(attempt)}/${String(maxAttempts)}`,
82201
- model: input.llm.modelName,
82202
- ...retryErrorFields(error)
82203
- });
82204
- }
82205
- function paramsForAttempt(input, attempt, maxAttempts) {
82206
- return {
82207
- ...input.params,
82208
- requestLogContext: {
82209
- turnId: input.turnId,
82210
- step: input.currentStep,
82211
- stepUuid: input.stepUuid,
82212
- attempt,
82213
- maxAttempts
82355
+ var EventSubscriptionBus = class {
82356
+ byType = /* @__PURE__ */ new Map();
82357
+ wildcard = /* @__PURE__ */ new Set();
82358
+ /**
82359
+ * Subscribe to a specific event type (or `'*'` for all events).
82360
+ * Returns an unsubscribe function.
82361
+ */
82362
+ subscribe(type, handler) {
82363
+ if (type === "*") {
82364
+ this.wildcard.add(handler);
82365
+ return () => {
82366
+ this.wildcard.delete(handler);
82367
+ };
82214
82368
  }
82215
- };
82216
- }
82217
- function retryBackoffDelays(maxAttempts) {
82218
- const count = Math.max(maxAttempts - 1, 0);
82219
- const delays = [];
82220
- for (let i = 0; i < count; i += 1) {
82221
- const base = Math.min(BASE_DELAY_MS * Math.pow(RETRY_FACTOR, i), MAX_DELAY_MS);
82222
- delays.push(base + Math.random() * JITTER_FACTOR * base);
82369
+ let set = this.byType.get(type);
82370
+ if (set === void 0) {
82371
+ set = /* @__PURE__ */ new Set();
82372
+ this.byType.set(type, set);
82373
+ }
82374
+ set.add(handler);
82375
+ return () => {
82376
+ set.delete(handler);
82377
+ };
82223
82378
  }
82224
- return delays;
82225
- }
82226
- async function sleepForRetry(delayMs, signal) {
82227
- signal.throwIfAborted();
82228
- await abortable(sleep(delayMs), signal);
82229
- }
82230
- function retryErrorFields(error) {
82231
- return {
82232
- errorName: error instanceof Error ? error.name : typeof error,
82233
- errorMessage: error instanceof Error ? error.message : String(error),
82234
- statusCode: maybeStatusCode(error)
82235
- };
82236
- }
82237
- function maybeStatusCode(error) {
82238
- if (typeof error !== "object" || error === null) return void 0;
82239
- const statusCode = error.statusCode;
82240
- return typeof statusCode === "number" ? statusCode : void 0;
82241
- }
82379
+ /** Drop every subscriber (used on deactivate / session switch). */
82380
+ clear() {
82381
+ this.byType.clear();
82382
+ this.wildcard.clear();
82383
+ }
82384
+ /**
82385
+ * Deliver an event to matching handlers. A handler that throws is isolated
82386
+ * so a subscriber bug can never break the agent's event loop.
82387
+ */
82388
+ dispatch(event) {
82389
+ const typed = this.byType.get(event.type);
82390
+ if (typed !== void 0) for (const handler of typed) try {
82391
+ handler(event);
82392
+ } catch {}
82393
+ if (this.wildcard.size > 0) for (const handler of this.wildcard) try {
82394
+ handler(event);
82395
+ } catch {}
82396
+ }
82397
+ };
82242
82398
  //#endregion
82243
82399
  //#region ../../packages/agent-core/src/agent/context/projector.ts
82244
82400
  /** Synthetic error text used when a tool result is missing and must be
@@ -82362,10 +82518,10 @@ function stripContextMetadata(message) {
82362
82518
  }
82363
82519
  //#endregion
82364
82520
  //#region ../../packages/agent-core/src/agent/compaction/compaction-instruction.md
82365
- var compaction_instruction_default = "\r\n--- This message is a direct task, not part of the above conversation ---\r\n\r\nYou are now given a task to compact this conversation context according to specific priorities and output requirements.\r\n\r\nOutput text only. DO NOT CALL ANY TOOLS. Calling tools will be rejected and fails the task. You already have all the information you need in the conversation history. You have only one chance.\r\n\r\nThe goal of compaction is to keep essential code patterns, technical details, and architectural decisions for continuing development without losing context after the above messages are cleared work.\r\n\r\n{{ customInstruction }}\r\n\r\n<!-- Memory Memo Extraction (PRIORITY — do not skip) -->\r\n\r\n## 任务经验提取\r\n\r\nAFTER completing the compaction summary below, scan the messages being compacted for **task loops**. A task loop is \"completed\" when:\r\n- The user made a clear request or asked a specific question\r\n- You provided a solution or answer\r\n- The outcome is clear (success, partial success, or failure)\r\n\r\n**You MUST output at least one memory-memo block** (or the `{\"none\": true}` marker) at the very end of your response — omitting the section entirely is not allowed. Record completed task loops as full experience records; record **in-progress work** as a lower-priority record whose \"outcome\" is \"进行中\" (so the ongoing task survives compaction and can be resumed later).\r\n\r\nFor each task loop found, output a structured experience record **at the very end of your response**:\r\n\r\n```memory-memo\r\n{\r\n \"userNeed\": \"<the user's need or goal, one sentence>\",\r\n \"approach\": \"<what was done — the approach taken, 2-4 sentences>\",\r\n \"outcome\": \"<final result, e.g. '完成', '部分完成', '失败: reason', or '进行中' for in-progress work>\",\r\n \"whatFailed\": \"<dead ends tried — things that didn't work, or 'none'>\",\r\n \"whatWorked\": \"<key actions that ultimately worked, or 'none'>\",\r\n \"tags\": [\"<tag1>\", \"<tag2>\", \"<tag3>\"],\r\n \"note\": \"<optional: a soft, AI-readable note/suggestion that makes the record easier for future turns to understand — e.g. '这类任务先查接口可用性再写代码'. Omit if none>\"\r\n}\r\n```\r\n\r\nGuidelines:\r\n- Record important failed attempts in \"whatFailed\" to help avoid repeating mistakes.\r\n- Record key successful actions in \"whatWorked\" to help reuse effective approaches.\r\n- Include 3-5 semantic \"tags\" summarizing the task domain, tech stack, or action type (e.g. [\"react\", \"auth\", \"部署\"]).\r\n- \"note\" is optional: a one-sentence advisory note that helps future AI understand/reuse the record faster. It is a soft suggestion, not a user-enforced rule.\r\n- For in-progress work: record it with \"outcome\": \"进行中\" and describe where the task stands and what remains — this is what lets the agent resume seamlessly after compaction.\r\n- Merge closely related sub-tasks into a single record.\r\n- Use the exact field names and JSON format shown above (no extra fields beyond \"note\").\r\n\r\nIf no task loops (completed or in-progress) are found in the compacted messages, output:\r\n```memory-memo\r\n{\"none\": true}\r\n```\r\n\r\n<!-- Compression Priorities (in order) -->\r\n\r\n1. **Current Task State**: What is being worked on RIGHT NOW\r\n2. **Errors & Solutions**: All encountered errors and their resolutions\r\n3. **Code Evolution**: Final working versions only (remove intermediate attempts)\r\n4. **System Context**: Project structure, dependencies, environment setup\r\n5. **Design Decisions**: Architectural choices and their rationale\r\n6. **Next Steps**: The ordered, actionable plan going forward\r\n7. **TODO Items**: Unfinished tasks and known issues\r\n\r\n<!-- Required Output Structure -->\r\n\r\n## Current Focus\r\n\r\n[What we're working on now]\r\n\r\n## Environment\r\n\r\n- [Key setup/config points]\r\n- ...\r\n\r\n## Completed Tasks\r\n\r\n- [Task]: [Brief outcome]\r\n- ...\r\n\r\n## Active Issues\r\n\r\n- [Issue]: [Status/Next steps]\r\n- ...\r\n\r\n## Key Decisions\r\n\r\n- [Decision]: [rationale] — preserve architectural choices and why they were made\r\n- ...\r\n\r\n## Next Steps\r\n\r\n1. [The very next actionable step]\r\n2. [Then this]\r\n3. ...\r\n\r\n## Code State\r\n\r\n### [Critical file name]\r\n\r\n[Brief description of the file's purpose and current state]\r\n\r\n```\r\n[The latest version of critical code snippets in this file, <20 lines]\r\n```\r\n\r\n### [Critical file name]\r\n\r\n- [Useful classes/methods/functions]: [Brief description/usage]\r\n- ...\r\n\r\n<!-- Omit non-critical code, intermediate attempts, and resolved errors -->\r\n\r\n## Important Context\r\n\r\n- [Any crucial information not covered above]\r\n- ...\r\n\r\n## All User Messages\r\n\r\n- [Detailed non tool use user message]\r\n- ...\r\n\r\n## Skill candidates\r\n\r\nScan the compressed messages for reusable processes (project-specific build\r\nsteps, recurring debugging patterns, or tool workflows). If any is genuinely\r\nworth capturing as a reusable skill, output at the very end, at most one:\r\n\r\n[[skill-candidate: <name>|<one-line purpose>|<evidence>]]\r\n\r\n- The evidence must be concrete and verifiable: exact file paths, commands, or\r\n step sequences from the conversation (e.g. \"run `pnpm vitest run -t compaction`\r\n in packages/agent-core to reproduce the compaction snapshots\"). Vague evidence\r\n like \"used a script\" is not acceptable.\r\n- Only emit a candidate when the process is genuinely reusable beyond this one\r\n task; do not emit for one-off actions.\r\n\r\nOmit if none.\r\n";
82521
+ var compaction_instruction_default = "\r\n--- This message is a direct task, not part of the above conversation ---\r\n\r\nYou are now given a task to compact this conversation context according to specific priorities and output requirements.\r\n\r\nOutput text only. DO NOT CALL ANY TOOLS. Calling tools will be rejected and fails the task. You already have all the information you need in the conversation history. You have only one chance.\r\n\r\nThe goal of compaction is to keep essential code patterns, technical details, and architectural decisions for continuing development without losing context after the above messages are cleared work.\r\n\r\n{{ customInstruction }}\r\n\r\n<!-- Memory Memo Extraction (PRIORITY — do not skip) -->\r\n\r\n## 任务经验提取\r\n\r\nAFTER completing the compaction summary below, scan the messages being compacted for **task loops**. A task loop is \"completed\" when:\r\n- The user made a clear request or asked a specific question\r\n- You provided a solution or answer\r\n- The outcome is clear (success, partial success, or failure)\r\n\r\n**You MUST output at least one memory-memo block** (or the `{\"none\": true}` marker) after the summary — omitting the section entirely is not allowed. Record completed task loops as full experience records; record **in-progress work** as a lower-priority record whose \"outcome\" is \"进行中\" (so the ongoing task survives compaction and can be resumed later).\r\n\r\nFor each task loop found, output a structured experience record after the summary (the skill-candidate marker line described below comes after all memory-memo blocks):\r\n\r\n```memory-memo\r\n{\r\n \"userNeed\": \"<the user's need or goal, one sentence>\",\r\n \"approach\": \"<what was done — the approach taken, 2-4 sentences>\",\r\n \"outcome\": \"<final result, e.g. '完成', '部分完成', '失败: reason', or '进行中' for in-progress work>\",\r\n \"whatFailed\": \"<dead ends tried — things that didn't work, or 'none'>\",\r\n \"whatWorked\": \"<key actions that ultimately worked, or 'none'>\",\r\n \"tags\": [\"<tag1>\", \"<tag2>\", \"<tag3>\"],\r\n \"note\": \"<optional: a soft, AI-readable note/suggestion that makes the record easier for future turns to understand — e.g. '这类任务先查接口可用性再写代码'. Omit if none>\"\r\n}\r\n```\r\n\r\nGuidelines:\r\n- Record important failed attempts in \"whatFailed\" to help avoid repeating mistakes.\r\n- Record key successful actions in \"whatWorked\" to help reuse effective approaches.\r\n- Include 3-5 semantic \"tags\" summarizing the task domain, tech stack, or action type (e.g. [\"react\", \"auth\", \"部署\"]).\r\n- \"note\" is optional: a one-sentence advisory note that helps future AI understand/reuse the record faster. It is a soft suggestion, not a user-enforced rule.\r\n- For in-progress work: record it with \"outcome\": \"进行中\" and describe where the task stands and what remains — this is what lets the agent resume seamlessly after compaction.\r\n- Merge closely related sub-tasks into a single record.\r\n- Use the exact field names and JSON format shown above (no extra fields beyond \"note\").\r\n\r\nIf no task loops (completed or in-progress) are found in the compacted messages, output:\r\n```memory-memo\r\n{\"none\": true}\r\n```\r\n\r\n<!-- Compression Priorities (in order) -->\r\n\r\n1. **Current Task State**: What is being worked on RIGHT NOW\r\n2. **Errors & Solutions**: All encountered errors and their resolutions\r\n3. **Code Evolution**: Final working versions only (remove intermediate attempts)\r\n4. **System Context**: Project structure, dependencies, environment setup\r\n5. **Design Decisions**: Architectural choices and their rationale\r\n6. **Next Steps**: The ordered, actionable plan going forward\r\n7. **TODO Items**: Unfinished tasks and known issues\r\n\r\n<!-- Required Output Structure -->\r\n\r\n## Current Focus\r\n\r\n[What we're working on now]\r\n\r\n## Environment\r\n\r\n- [Key setup/config points]\r\n- ...\r\n\r\n## Completed Tasks\r\n\r\n- [Task]: [Brief outcome]\r\n- ...\r\n\r\n## Active Issues\r\n\r\n- [Issue]: [Status/Next steps]\r\n- ...\r\n\r\n## Key Decisions\r\n\r\n- [Decision]: [rationale] — preserve architectural choices and why they were made\r\n- ...\r\n\r\n## Next Steps\r\n\r\n1. [The very next actionable step]\r\n2. [Then this]\r\n3. ...\r\n\r\n## Code State\r\n\r\n### [Critical file name]\r\n\r\n[Brief description of the file's purpose and current state]\r\n\r\n```\r\n[The latest version of critical code snippets in this file, <20 lines]\r\n```\r\n\r\n### [Critical file name]\r\n\r\n- [Useful classes/methods/functions]: [Brief description/usage]\r\n- ...\r\n\r\n<!-- Omit non-critical code, intermediate attempts, and resolved errors -->\r\n\r\n## Important Context\r\n\r\n- [Any crucial information not covered above]\r\n- ...\r\n\r\n## All User Messages\r\n\r\n- [Detailed non tool use user message]\r\n- ...\r\n\r\n## Skill candidates\r\n\r\nScan the compressed messages for reusable processes (project-specific build\r\nsteps, recurring debugging patterns, or tool workflows). Then output exactly\r\none marker as the very LAST line of your response — after all memory-memo\r\nblocks:\r\n\r\n- If a process is genuinely worth capturing as a reusable skill (reusable\r\n beyond this one task — do not emit for one-off actions; the evidence must\r\n be concrete and verifiable: exact file paths, commands, or step sequences\r\n from the conversation, e.g. \"run `pnpm vitest run -t compaction` in\r\n packages/agent-core to reproduce the compaction snapshots\". Vague evidence\r\n like \"used a script\" is not acceptable):\r\n\r\n[[skill-candidate: <name>|<one-line purpose>|<evidence>]]\r\n\r\n- If none exists, output instead:\r\n\r\n[[skill-candidate: none]]\r\n\r\nThis marker line is MANDATORY — never omit it, and output at most one\r\ncandidate marker.\r\n";
82366
82522
  //#endregion
82367
82523
  //#region ../../packages/agent-core/src/agent/compaction/compaction-update-instruction.md
82368
- var compaction_update_instruction_default = "\r\n--- This message is a direct task, not part of the above conversation ---\r\n\r\nYou are now given a task to UPDATE an existing compaction summary with new messages that came in after the last compaction.\r\n\r\nA previous compaction summary already exists at the top of the conversation (the first assistant message). You must NOT discard it. Instead, merge the new information into the existing structure, keeping all previously captured state intact unless explicitly contradicted or resolved by the new messages.\r\n\r\nOutput text only. DO NOT CALL ANY TOOLS. Calling tools will be rejected and fails the task. You have only one chance.\r\n\r\n{{ customInstruction }}\r\n\r\n<!-- Previous Summary Reference -->\r\n\r\nThe first assistant message above is the PREVIOUS summary. Treat it as the source of truth for everything that happened before the new messages. Do not restate it verbatim — produce an updated, merged summary.\r\n\r\n<!-- Memory Memo Extraction (PRIORITY — do not skip) -->\r\n\r\n## 任务经验提取\r\n\r\nAFTER completing the updated summary below, scan ONLY the new messages being compacted (not those already covered by the previous summary) for **task loops**. A task loop is \"completed\" when:\r\n- The user made a clear request or asked a specific question\r\n- You provided a solution or answer\r\n- The outcome is clear (success, partial success, or failure)\r\n\r\n**You MUST output at least one memory-memo block** (or the `{\"none\": true}` marker) at the very end of your response — omitting the section entirely is not allowed. Record completed task loops as full experience records; record **in-progress work** as a lower-priority record whose \"outcome\" is \"进行中\" (so the ongoing task survives compaction and can be resumed later).\r\n\r\nFor each task loop found, output a structured experience record **at the very end of your response**:\r\n\r\n```memory-memo\r\n{\r\n \"userNeed\": \"<the user's need or goal, one sentence>\",\r\n \"approach\": \"<what was done — the approach taken, 2-4 sentences>\",\r\n \"outcome\": \"<final result, e.g. '完成', '部分完成', '失败: reason', or '进行中' for in-progress work>\",\r\n \"whatFailed\": \"<dead ends tried — things that didn't work, or 'none'>\",\r\n \"whatWorked\": \"<key actions that ultimately worked, or 'none'>\",\r\n \"tags\": [\"<tag1>\", \"<tag2>\", \"<tag3>\"],\r\n \"note\": \"<optional: a soft, AI-readable note/suggestion that makes the record easier for future turns to understand — e.g. '这类任务先查接口可用性再写代码'. Omit if none>\"\r\n}\r\n```\r\n\r\nGuidelines:\r\n- Record important failed attempts in \"whatFailed\" to help avoid repeating mistakes.\r\n- Record key successful actions in \"whatWorked\" to help reuse effective approaches.\r\n- Include 3-5 semantic \"tags\" summarizing the task domain, tech stack, or action type.\r\n- For in-progress work: record it with \"outcome\": \"进行中\" and describe where the task stands and what remains — this is what lets the agent resume seamlessly after compaction.\r\n- Merge closely related sub-tasks into a single record.\r\n- Use the exact field names and JSON format shown above.\r\n\r\nIf no task loops (completed or in-progress) are found in the new compacted messages, output:\r\n```memory-memo\r\n{\"none\": true}\r\n```\r\n\r\n<!-- Update Rules -->\r\n\r\n1. Preserve the section structure of the previous summary (Current Focus, Environment, Completed Tasks, Active Issues, Key Decisions, Next Steps, Code State, Important Context, All User Messages).\r\n2. Move newly-completed tasks from \"Current Focus\" / \"Active Issues\" into \"Completed Tasks\".\r\n3. Update \"Current Focus\" to reflect what is being worked on RIGHT NOW.\r\n4. Append new user messages to \"All User Messages\" — do not repeat those already captured.\r\n5. Refresh \"Code State\" code snippets only if newer versions exist in the new messages.\r\n6. Drop resolved issues from \"Active Issues\"; add newly-discovered ones.\r\n7. Merge new decisions into \"Key Decisions\" (keep prior decisions unless explicitly overturned); merge new steps into \"Next Steps\" (reorder if priorities changed).\r\n8. Do not invent new information. If the new messages say nothing about a section, carry the previous content forward unchanged.\r\n\r\n<!-- Required Output Structure -->\r\n\r\n## Current Focus\r\n\r\n[What we're working on now]\r\n\r\n## Environment\r\n\r\n- [Key setup/config points]\r\n- ...\r\n\r\n## Completed Tasks\r\n\r\n- [Task]: [Brief outcome]\r\n- ...\r\n\r\n## Active Issues\r\n\r\n- [Issue]: [Status/Next steps]\r\n- ...\r\n\r\n## Key Decisions\r\n\r\n- [Decision]: [rationale] — preserve architectural choices and why they were made\r\n- ...\r\n\r\n## Next Steps\r\n\r\n1. [The very next actionable step]\r\n2. [Then this]\r\n3. ...\r\n\r\n## Code State\r\n\r\n### [Critical file name]\r\n\r\n[Brief description of the file's purpose and current state]\r\n\r\n```\r\n[The latest version of critical code snippets in this file, <20 lines]\r\n```\r\n\r\n## Important Context\r\n\r\n- [Any crucial information not covered above]\r\n- ...\r\n\r\n## All User Messages\r\n\r\n- [Detailed non tool use user message]\r\n- ...\r\n";
82524
+ var compaction_update_instruction_default = "\r\n--- This message is a direct task, not part of the above conversation ---\r\n\r\nYou are now given a task to UPDATE an existing compaction summary with new messages that came in after the last compaction.\r\n\r\nA previous compaction summary already exists at the top of the conversation (the first assistant message). You must NOT discard it. Instead, merge the new information into the existing structure, keeping all previously captured state intact unless explicitly contradicted or resolved by the new messages.\r\n\r\nOutput text only. DO NOT CALL ANY TOOLS. Calling tools will be rejected and fails the task. You have only one chance.\r\n\r\n{{ customInstruction }}\r\n\r\n<!-- Previous Summary Reference -->\r\n\r\nThe first assistant message above is the PREVIOUS summary. Treat it as the source of truth for everything that happened before the new messages. Do not restate it verbatim — produce an updated, merged summary.\r\n\r\n<!-- Memory Memo Extraction (PRIORITY — do not skip) -->\r\n\r\n## 任务经验提取\r\n\r\nAFTER completing the updated summary below, scan ONLY the new messages being compacted (not those already covered by the previous summary) for **task loops**. A task loop is \"completed\" when:\r\n- The user made a clear request or asked a specific question\r\n- You provided a solution or answer\r\n- The outcome is clear (success, partial success, or failure)\r\n\r\n**You MUST output at least one memory-memo block** (or the `{\"none\": true}` marker) after the updated summary — omitting the section entirely is not allowed. Record completed task loops as full experience records; record **in-progress work** as a lower-priority record whose \"outcome\" is \"进行中\" (so the ongoing task survives compaction and can be resumed later).\r\n\r\nFor each task loop found, output a structured experience record after the updated summary (the skill-candidate marker line described below comes after all memory-memo blocks):\r\n\r\n```memory-memo\r\n{\r\n \"userNeed\": \"<the user's need or goal, one sentence>\",\r\n \"approach\": \"<what was done — the approach taken, 2-4 sentences>\",\r\n \"outcome\": \"<final result, e.g. '完成', '部分完成', '失败: reason', or '进行中' for in-progress work>\",\r\n \"whatFailed\": \"<dead ends tried — things that didn't work, or 'none'>\",\r\n \"whatWorked\": \"<key actions that ultimately worked, or 'none'>\",\r\n \"tags\": [\"<tag1>\", \"<tag2>\", \"<tag3>\"],\r\n \"note\": \"<optional: a soft, AI-readable note/suggestion that makes the record easier for future turns to understand — e.g. '这类任务先查接口可用性再写代码'. Omit if none>\"\r\n}\r\n```\r\n\r\nGuidelines:\r\n- Record important failed attempts in \"whatFailed\" to help avoid repeating mistakes.\r\n- Record key successful actions in \"whatWorked\" to help reuse effective approaches.\r\n- Include 3-5 semantic \"tags\" summarizing the task domain, tech stack, or action type.\r\n- For in-progress work: record it with \"outcome\": \"进行中\" and describe where the task stands and what remains — this is what lets the agent resume seamlessly after compaction.\r\n- Merge closely related sub-tasks into a single record.\r\n- Use the exact field names and JSON format shown above.\r\n\r\nIf no task loops (completed or in-progress) are found in the new compacted messages, output:\r\n```memory-memo\r\n{\"none\": true}\r\n```\r\n\r\n<!-- Skill Candidate Detection (after memory-memo) -->\r\n\r\n## Skill candidates\r\n\r\nAFTER the memory-memo block(s), scan ONLY the new messages being compacted\r\n(not the content already covered by the previous summary — candidates from\r\nolder messages were already considered) for reusable processes\r\n(project-specific build steps, recurring debugging patterns, or tool\r\nworkflows). Then output exactly one marker as the very LAST line of your\r\nresponse — after all memory-memo blocks:\r\n\r\n- If a process is genuinely worth capturing as a reusable skill (reusable\r\n beyond this one task — do not emit for one-off actions; the evidence must\r\n be concrete and verifiable: exact file paths, commands, or step sequences\r\n from the new messages):\r\n\r\n[[skill-candidate: <name>|<one-line purpose>|<evidence>]]\r\n\r\n- If none exists, output instead:\r\n\r\n[[skill-candidate: none]]\r\n\r\nThis marker line is MANDATORY — never omit it, and output at most one\r\ncandidate marker.\r\n\r\n<!-- Update Rules -->\r\n\r\n1. Preserve the section structure of the previous summary (Current Focus, Environment, Completed Tasks, Active Issues, Key Decisions, Next Steps, Code State, Important Context, All User Messages).\r\n2. Move newly-completed tasks from \"Current Focus\" / \"Active Issues\" into \"Completed Tasks\".\r\n3. Update \"Current Focus\" to reflect what is being worked on RIGHT NOW.\r\n4. Append new user messages to \"All User Messages\" — do not repeat those already captured.\r\n5. Refresh \"Code State\" code snippets only if newer versions exist in the new messages.\r\n6. Drop resolved issues from \"Active Issues\"; add newly-discovered ones.\r\n7. Merge new decisions into \"Key Decisions\" (keep prior decisions unless explicitly overturned); merge new steps into \"Next Steps\" (reorder if priorities changed).\r\n8. Do not invent new information. If the new messages say nothing about a section, carry the previous content forward unchanged.\r\n\r\n<!-- Required Output Structure -->\r\n\r\n## Current Focus\r\n\r\n[What we're working on now]\r\n\r\n## Environment\r\n\r\n- [Key setup/config points]\r\n- ...\r\n\r\n## Completed Tasks\r\n\r\n- [Task]: [Brief outcome]\r\n- ...\r\n\r\n## Active Issues\r\n\r\n- [Issue]: [Status/Next steps]\r\n- ...\r\n\r\n## Key Decisions\r\n\r\n- [Decision]: [rationale] — preserve architectural choices and why they were made\r\n- ...\r\n\r\n## Next Steps\r\n\r\n1. [The very next actionable step]\r\n2. [Then this]\r\n3. ...\r\n\r\n## Code State\r\n\r\n### [Critical file name]\r\n\r\n[Brief description of the file's purpose and current state]\r\n\r\n```\r\n[The latest version of critical code snippets in this file, <20 lines]\r\n```\r\n\r\n## Important Context\r\n\r\n- [Any crucial information not covered above]\r\n- ...\r\n\r\n## All User Messages\r\n\r\n- [Detailed non tool use user message]\r\n- ...\r\n";
82369
82525
  //#endregion
82370
82526
  //#region ../../packages/agent-core/src/agent/compaction/render-messages.ts
82371
82527
  const TOOL_RESULT_MAX_CHARS = 2e3;
@@ -82767,6 +82923,14 @@ var FullCompaction = class {
82767
82923
  get compactedHistory() {
82768
82924
  return this._compactedHistory;
82769
82925
  }
82926
+ /**
82927
+ * Restore the compaction debug trail from a `context.snapshot` record. During
82928
+ * snapshot replay the pre-fold history is skipped, so `markCompleted` can no
82929
+ * longer re-render it — the snapshot carries the trail instead.
82930
+ */
82931
+ restoreCompactedHistory(entries) {
82932
+ this._compactedHistory = [...entries];
82933
+ }
82770
82934
  /** One-shot: true if session memory summary should be injected at the next step. */
82771
82935
  shouldInjectSessionSummary() {
82772
82936
  if (this._shouldInjectSessionSummary) {
@@ -82805,7 +82969,7 @@ var FullCompaction = class {
82805
82969
  blockedByTurn: false
82806
82970
  };
82807
82971
  this.compacting = active;
82808
- active.promise = this.compactionWorker(abortController.signal, data, compactedCount);
82972
+ active.promise = this.compactionWorker(abortController.signal, data, compactedCount, active);
82809
82973
  }
82810
82974
  cancel() {
82811
82975
  this.markCanceled();
@@ -82834,6 +82998,13 @@ var FullCompaction = class {
82834
82998
  this.lowWaterMark = 0;
82835
82999
  this.reactiveAttempted = false;
82836
83000
  }
83001
+ /** The low-water mark is measured against the model's context window, so a
83002
+ * model switch (different max_context_tokens) invalidates it. Without a
83003
+ * reset, a stale mark from a large model can mask the overflow threshold
83004
+ * of a smaller model and suppress compaction until the provider overflows. */
83005
+ resetLowWaterMark() {
83006
+ this.lowWaterMark = 0;
83007
+ }
82837
83008
  async handleOverflowError(signal, error) {
82838
83009
  if (this.reactiveAttempted) throw error;
82839
83010
  if (!this.beginAutoCompaction(false) && !this.compacting) {
@@ -82845,6 +83016,12 @@ var FullCompaction = class {
82845
83016
  throw error;
82846
83017
  }
82847
83018
  this.reactiveAttempted = true;
83019
+ if (this.compacting) try {
83020
+ await this.block(signal);
83021
+ } catch (blockError) {
83022
+ if (signal.aborted || isAbortError$1(blockError)) throw blockError;
83023
+ throw error;
83024
+ }
82848
83025
  }
82849
83026
  async beforeStep(signal) {
82850
83027
  this.agent.microCompaction.detect();
@@ -82894,13 +83071,14 @@ var FullCompaction = class {
82894
83071
  async block(signal) {
82895
83072
  const active = this.compacting;
82896
83073
  if (!active) return;
83074
+ signal.throwIfAborted();
82897
83075
  active.blockedByTurn = true;
82898
83076
  const timeoutId = setTimeout(() => {
82899
83077
  if (this.compacting === active) {
82900
83078
  this.compactionTimedOut = true;
82901
- this.markCanceled("压缩超时(60秒),已取消。请使用 /compact 手动重试。");
83079
+ this.markCanceled("压缩超时(120秒),已取消。请使用 /compact 手动重试。");
82902
83080
  }
82903
- }, 6e4);
83081
+ }, 12e4);
82904
83082
  const onAbort = () => {
82905
83083
  clearTimeout(timeoutId);
82906
83084
  if (this.compacting === active) this.cancel();
@@ -82917,9 +83095,11 @@ var FullCompaction = class {
82917
83095
  signal.removeEventListener("abort", onAbort);
82918
83096
  }
82919
83097
  }
82920
- async compactionWorker(signal, data, compactedCount) {
83098
+ async compactionWorker(signal, data, compactedCount, owner) {
82921
83099
  const originalHistory = [...this.agent.context.history];
82922
- const tokensBefore = estimateTokensForMessages(originalHistory);
83100
+ const systemPromptTokens = estimateTokens$1(this.agent.getRuntimeSystemPrompt());
83101
+ const toolTokens = estimateTokensForTools(this.agent.tools.loopTools);
83102
+ const tokensBefore = systemPromptTokens + toolTokens + estimateTokensForMessages(originalHistory);
82923
83103
  const model = this.agent.config.model;
82924
83104
  const isUpdate = extractPreviousSummary(originalHistory) !== null;
82925
83105
  let retryCount = 0;
@@ -82955,24 +83135,27 @@ var FullCompaction = class {
82955
83135
  } catch (error) {
82956
83136
  if (error instanceof APIContextOverflowError || error instanceof TruncatedError) {
82957
83137
  const reduced = this.strategy.reduceCompactOnOverflow(messagesToCompact);
82958
- if (reduced < compactedCount) compactedCount = reduced;
82959
- else {
82960
- this.agent.log.warn("compaction overflow at minimum split, falling back to re-summarize", {
82961
- compactedCount,
82962
- tokensBefore: estimateTokensForMessages(messagesToCompact)
82963
- });
82964
- const result = await summarizeWithFallback(messagesToCompact, summarizeOnce);
82965
- summary = result.summary;
82966
- usage = result.usage;
82967
- break;
83138
+ if (reduced < compactedCount) {
83139
+ compactedCount = reduced;
83140
+ continue;
82968
83141
  }
82969
- } else if (!isRetryableGenerateError(error)) throw error;
83142
+ this.agent.log.warn("compaction overflow at minimum split, falling back to re-summarize", {
83143
+ compactedCount,
83144
+ tokensBefore: estimateTokensForMessages(messagesToCompact)
83145
+ });
83146
+ const result = await summarizeWithFallback(messagesToCompact, summarizeOnce);
83147
+ summary = result.summary;
83148
+ usage = result.usage;
83149
+ break;
83150
+ }
83151
+ if (!isRetryableGenerateError(error)) throw error;
82970
83152
  if (retryCount + 1 >= 5) throw error;
82971
- await sleepForRetry(delays[retryCount], signal);
83153
+ await sleepForRetry(computeDelayMs(error, delays, retryCount + 1), signal);
82972
83154
  retryCount += 1;
82973
83155
  }
82974
83156
  }
82975
83157
  if (usage !== null) this.agent.usage.record(model, usage);
83158
+ if (this.compacting !== owner) return void 0;
82976
83159
  const newHistory = this.agent.context.history;
82977
83160
  for (let i = 0; i < originalHistory.length; i++) if (newHistory[i] !== originalHistory[i]) {
82978
83161
  this.markCanceled("上下文已被更改(如 /revoke),压缩已取消");
@@ -82987,8 +83170,9 @@ var FullCompaction = class {
82987
83170
  } else this.lastCompactionFiles = void 0;
82988
83171
  for (const msg of messagesToCompactForOps) extractFileOpsFromMessage(msg, fileOps);
82989
83172
  const toolCallHistory = formatToolCallHistory(messagesToCompactForOps);
83173
+ const skillCandidateSummary = summary;
82990
83174
  const processedSummary = this.postProcessSummary(summary, fileOps, toolCallHistory, compactedCount);
82991
- const tokensAfter = estimateTokens$1(processedSummary) + estimateTokensForMessages(recent);
83175
+ const tokensAfter = systemPromptTokens + toolTokens + estimateTokens$1(processedSummary) + estimateTokensForMessages(recent);
82992
83176
  const fileLists = computeFileLists(fileOps);
82993
83177
  const MAX_PERSISTED_FILES = 100;
82994
83178
  const readFiles = fileLists.readFiles.slice(0, MAX_PERSISTED_FILES);
@@ -83012,20 +83196,23 @@ var FullCompaction = class {
83012
83196
  this.lowWaterMark = Math.floor(this.effectiveTokenCount * 1.1);
83013
83197
  await this.extractAndStoreMemos(processedSummary, messagesToCompactForOps);
83014
83198
  this.triggerPostCompactHook(data, result);
83015
- this.detectSkillCandidates(processedSummary);
83199
+ this.detectSkillCandidates(skillCandidateSummary);
83016
83200
  this.consecutiveCompactionFailures = 0;
83017
83201
  this._shouldInjectSessionSummary = true;
83018
83202
  } catch (error) {
83019
- const wasTimedOut = this.compactionTimedOut;
83020
- this.compactionTimedOut = false;
83203
+ const stale = this.compacting !== null && this.compacting !== owner;
83204
+ const wasTimedOut = stale ? false : this.compactionTimedOut;
83205
+ if (!stale) this.compactionTimedOut = false;
83021
83206
  if (!isAbortError$1(error) || wasTimedOut) {
83022
- const blockedByTurn = this.compacting?.blockedByTurn === true;
83023
- this.consecutiveCompactionFailures += 1;
83024
- if (this.consecutiveCompactionFailures >= MAX_CONSECUTIVE_FAILURES) this.agent.emitEvent({
83025
- type: "warning",
83026
- message: `压缩连续失败 ${String(this.consecutiveCompactionFailures)} 次,已自动暂停本回合的自动压缩。使用 /compact 手动重试。`,
83027
- code: "compaction_circuit_open"
83028
- });
83207
+ const blockedByTurn = stale || owner.blockedByTurn === true;
83208
+ if (!stale) {
83209
+ this.consecutiveCompactionFailures += 1;
83210
+ if (this.consecutiveCompactionFailures >= MAX_CONSECUTIVE_FAILURES) this.agent.emitEvent({
83211
+ type: "warning",
83212
+ message: `压缩连续失败 ${String(this.consecutiveCompactionFailures)} 次,已自动暂停本回合的自动压缩。使用 /compact 手动重试。`,
83213
+ code: "compaction_circuit_open"
83214
+ });
83215
+ }
83029
83216
  this.agent.log.error("compaction failed", {
83030
83217
  code: isNexumError(error) ? error.code : void 0,
83031
83218
  error,
@@ -83034,7 +83221,7 @@ var FullCompaction = class {
83034
83221
  compactedCount,
83035
83222
  tokensBefore
83036
83223
  });
83037
- this.markCanceled();
83224
+ if (!stale) this.markCanceled();
83038
83225
  if (!blockedByTurn) {
83039
83226
  const details = {
83040
83227
  model,
@@ -83046,7 +83233,7 @@ var FullCompaction = class {
83046
83233
  ...payload
83047
83234
  });
83048
83235
  }
83049
- if (blockedByTurn) {
83236
+ if (blockedByTurn && !stale) {
83050
83237
  if (isNexumError(error) && error.code === ErrorCodes.AUTH_LOGIN_REQUIRED) throw error;
83051
83238
  throw new NexumError(ErrorCodes.COMPACTION_FAILED, String(error), { cause: error });
83052
83239
  }
@@ -83137,27 +83324,41 @@ var FullCompaction = class {
83137
83324
  }
83138
83325
  /**
83139
83326
  * Detects [[skill-candidate: <name>|<purpose>|<evidence>]] markers in the
83140
- * compaction summary and emits a `skill_candidate` event for each one (at
83141
- * most one per compact). Best-effort and fully isolated: a parse failure or
83142
- * a missing marker never affects compaction or memory extraction — this
83143
- * method only reads the summary and emits an event.
83327
+ * compaction summary and emits a `skill_candidate` event (at most one per
83328
+ * compact). Best-effort and fully isolated: a parse failure or a missing
83329
+ * marker never affects compaction or memory extraction — this method only
83330
+ * reads the summary and emits an event.
83331
+ *
83332
+ * Tolerant parsing: the evidence segment may contain `|` characters and
83333
+ * newlines, and the explicit `[[skill-candidate: none]]` marker (emitted
83334
+ * when the model found nothing) is recognized and skipped. When several
83335
+ * markers appear (e.g. an old one carried over into an update summary),
83336
+ * the LAST valid candidate wins — the templates mandate the marker as the
83337
+ * final line of the response, so the trailing one is the model's verdict
83338
+ * for this round.
83144
83339
  */
83145
83340
  detectSkillCandidates(summary) {
83146
83341
  try {
83147
- const matches = summary.matchAll(/\[\[skill-candidate:\s*([^|\]]+)\|([^|\]]+)\|([^|\]]+)\]\]/g);
83342
+ const matches = summary.matchAll(/\[\[skill-candidate:\s*([^|\]]+?)(?:\|([^|\]]*)\|([\s\S]*?))?\]\]/g);
83343
+ let chosen;
83148
83344
  for (const m of matches) {
83149
- const name = m[1].trim();
83345
+ const name = m[1]?.trim() ?? "";
83150
83346
  if (name.length === 0) continue;
83151
- this.agent.emitEvent({
83152
- type: "skill_candidate",
83153
- candidate: {
83154
- name,
83155
- purpose: m[2].trim(),
83156
- evidence: m[3].trim()
83157
- }
83158
- });
83159
- break;
83347
+ if (name.toLowerCase() === "none") {
83348
+ chosen = void 0;
83349
+ continue;
83350
+ }
83351
+ if (m[2] === void 0) continue;
83352
+ chosen = {
83353
+ name,
83354
+ purpose: m[2].trim(),
83355
+ evidence: (m[3] ?? "").trim()
83356
+ };
83160
83357
  }
83358
+ if (chosen !== void 0) this.agent.emitEvent({
83359
+ type: "skill_candidate",
83360
+ candidate: chosen
83361
+ });
83161
83362
  } catch (error) {
83162
83363
  this.agent.log.warn("Skill candidate detection failed", { error: String(error) });
83163
83364
  }
@@ -83175,7 +83376,7 @@ var FullCompaction = class {
83175
83376
  */
83176
83377
  postProcessSummary(summary, fileOps, toolCallHistory, compactedCount) {
83177
83378
  const todos = this.agent.tools.storeData()["todo"] ?? [];
83178
- const base = summary.trim().replaceAll(/<files>[\s\S]*?<\/files>\s*/g, "").replace(/^> The conversation before this point was compacted:[\s\S]*?continue from here\.\s*\n+/m, "").trimEnd();
83379
+ const base = summary.trim().replaceAll(/<files>[\s\S]*?<\/files>\s*/g, "").replaceAll(/\[\[skill-candidate:[\s\S]*?\]\]\s*/g, "").replace(/^> The conversation before this point was compacted:[\s\S]*?continue from here\.\s*\n+/m, "").trimEnd();
83179
83380
  const sections = [];
83180
83381
  if (compactedCount > 0) sections.push(`> The conversation before this point was compacted: ${String(compactedCount)} earlier message(s) were omitted and are covered by this summary. Treat the summary below as working notes, not verbatim history — the messages after it continue from here.`);
83181
83382
  if (base.length > 0) sections.push(base);
@@ -84501,7 +84702,10 @@ var ConfigState = class {
84501
84702
  this._cwd = changed.cwd;
84502
84703
  this.agent.jian.chdir(changed.cwd);
84503
84704
  }
84504
- if (changed.modelAlias) this._modelAlias = changed.modelAlias;
84705
+ if (changed.modelAlias && changed.modelAlias !== this._modelAlias) {
84706
+ this._modelAlias = changed.modelAlias;
84707
+ this.agent.fullCompaction.resetLowWaterMark();
84708
+ }
84505
84709
  if (changed.profileName) this._profileName = changed.profileName;
84506
84710
  if (changed.thinkingLevel !== void 0) this._thinkingLevel = resolveThinkingEffort(changed.thinkingLevel, this.agent.nexumConfig?.thinking);
84507
84711
  if (changed.systemPrompt !== void 0) this._systemPrompt = changed.systemPrompt;
@@ -84705,6 +84909,42 @@ var ContextMemory = class {
84705
84909
  this.pendingToolResultIds = new Set(snapshot.pendingToolResultIds);
84706
84910
  this.deferredMessages = [...snapshot.deferredMessages];
84707
84911
  }
84912
+ /**
84913
+ * JSON-safe snapshot for wire persistence. `openSteps` values are recorded as
84914
+ * their index into `history` so restoring can rebuild the live reference
84915
+ * identity between history messages and open steps (see
84916
+ * {@link ContextMemoryJSONSnapshot}).
84917
+ */
84918
+ toJSONSnapshot() {
84919
+ return {
84920
+ history: [...this._history],
84921
+ tokenCount: this._tokenCount,
84922
+ tokenCountCoveredMessageCount: this.tokenCountCoveredMessageCount,
84923
+ openSteps: [...this.openSteps.entries()].map(([uuid, message]) => [uuid, this._history.indexOf(message)]),
84924
+ pendingToolResultIds: [...this.pendingToolResultIds],
84925
+ deferredMessages: [...this.deferredMessages]
84926
+ };
84927
+ }
84928
+ /**
84929
+ * Restore from a JSON-safe snapshot produced by {@link toJSONSnapshot}.
84930
+ * Open steps are re-attached to the exact history message objects they
84931
+ * pointed at, preserving reference identity: later `content.part`/`tool.call`
84932
+ * events and `applyCompaction` pruning operate on the same objects the
84933
+ * history array holds, exactly as they did in the live session.
84934
+ */
84935
+ restoreJSONSnapshot(snapshot) {
84936
+ this._history = [...snapshot.history];
84937
+ this._tokenCount = snapshot.tokenCount;
84938
+ this.tokenCountCoveredMessageCount = snapshot.tokenCountCoveredMessageCount;
84939
+ const openSteps = /* @__PURE__ */ new Map();
84940
+ for (const [uuid, historyIndex] of snapshot.openSteps) {
84941
+ const message = this._history[historyIndex];
84942
+ if (message !== void 0) openSteps.set(uuid, message);
84943
+ }
84944
+ this.openSteps = openSteps;
84945
+ this.pendingToolResultIds = new Set(snapshot.pendingToolResultIds);
84946
+ this.deferredMessages = [...snapshot.deferredMessages];
84947
+ }
84708
84948
  appendUserMessage(content, origin = USER_PROMPT_ORIGIN) {
84709
84949
  this.appendMessage({
84710
84950
  role: "user",
@@ -84818,6 +85058,11 @@ var ContextMemory = class {
84818
85058
  this.agent.injection.onContextCompacted(summary.compactedCount);
84819
85059
  this.agent.emitStatusUpdated();
84820
85060
  this.agent.microCompaction.reset();
85061
+ if (!this.agent.records.restoring) this.agent.records.logRecord({
85062
+ type: "context.snapshot",
85063
+ snapshot: this.toJSONSnapshot(),
85064
+ compactedHistory: [...this.agent.fullCompaction.compactedHistory]
85065
+ });
84821
85066
  }
84822
85067
  data() {
84823
85068
  return {
@@ -84875,7 +85120,16 @@ var ContextMemory = class {
84875
85120
  this.lastSentFingerprints = messages.map(messageFingerprint);
84876
85121
  if (prev.length === 0) return;
84877
85122
  const appended = messages.length - prev.length;
84878
- if (stable >= prev.length) return;
85123
+ if (stable >= prev.length) {
85124
+ if (appended > 0) this.agent.log.debug("prefix-stability: provider prompt cache prefix hit", {
85125
+ stablePrefixLength: stable,
85126
+ cachedPrefixTokens: estimateTokensForMessages(messages.slice(0, stable)),
85127
+ prevMessageCount: prev.length,
85128
+ currentMessageCount: messages.length,
85129
+ appendedSinceLast: appended
85130
+ });
85131
+ return;
85132
+ }
84879
85133
  this.agent.log.debug("prefix-stability: provider prompt cache prefix broke", {
84880
85134
  stablePrefixLength: stable,
84881
85135
  prevMessageCount: prev.length,
@@ -84996,6 +85250,30 @@ var ContextMemory = class {
84996
85250
  });
84997
85251
  }
84998
85252
  }
85253
+ /**
85254
+ * Drop in-flight assistant messages that cannot be serialized into a valid
85255
+ * provider request. An interrupted or empty step leaves an open assistant
85256
+ * message whose content is either empty or only "think" parts; after
85257
+ * projection it serializes to a message with no content and no tool_calls,
85258
+ * which strict OpenAI-compatible gateways reject with a 400 on every later
85259
+ * request. Messages carrying any sendable part (text / image / audio / video)
85260
+ * or tool calls are kept.
85261
+ */
85262
+ dropVacuousOpenMessages() {
85263
+ for (const [uuid, message] of this.openSteps) {
85264
+ if (message.content.some((part) => part.type !== "think") || message.toolCalls.length > 0) continue;
85265
+ const index = this._history.indexOf(message);
85266
+ if (index !== -1) {
85267
+ this._history.splice(index, 1);
85268
+ this.agent.injection.onContextMessageRemoved(index);
85269
+ if (index < this.tokenCountCoveredMessageCount) {
85270
+ this.tokenCountCoveredMessageCount--;
85271
+ this._tokenCount = Math.max(0, this._tokenCount - estimateTokensForMessages([message]));
85272
+ }
85273
+ }
85274
+ this.openSteps.delete(uuid);
85275
+ }
85276
+ }
84999
85277
  };
85000
85278
  function toolResultOutputForModel(result) {
85001
85279
  const output = result.output;
@@ -85746,6 +86024,39 @@ var HookEngine = class {
85746
86024
  for (const [event, hooks] of this.byEvent.entries()) result[event] = hooks.length;
85747
86025
  return result;
85748
86026
  }
86027
+ /**
86028
+ * Register a hook at runtime (e.g. when a plugin activates). Returns an
86029
+ * unregister function for symmetric removal when the plugin deactivates.
86030
+ * The existing constructor-injected hooks are unaffected; the byEvent map
86031
+ * stays the single source of truth so trigger paths need no changes.
86032
+ */
86033
+ register(hook) {
86034
+ const entries = this.byEvent.get(hook.event) ?? [];
86035
+ entries.push(hook);
86036
+ this.byEvent.set(hook.event, entries);
86037
+ return () => {
86038
+ this.unregister(hook);
86039
+ };
86040
+ }
86041
+ /**
86042
+ * Register several hooks at once (e.g. a plugin's manifest hooks). Returns
86043
+ * a single function that unregisters all of them.
86044
+ */
86045
+ registerAll(hooks) {
86046
+ const unregisters = hooks.map((hook) => this.register(hook));
86047
+ return () => {
86048
+ for (const unregister of unregisters) unregister();
86049
+ };
86050
+ }
86051
+ unregister(hook) {
86052
+ const entries = this.byEvent.get(hook.event);
86053
+ if (entries === void 0) return;
86054
+ const index = entries.lastIndexOf(hook);
86055
+ if (index >= 0) {
86056
+ entries.splice(index, 1);
86057
+ if (entries.length === 0) this.byEvent.delete(hook.event);
86058
+ }
86059
+ }
85749
86060
  trigger(event, args = {}) {
85750
86061
  try {
85751
86062
  return this.triggerInner(event, args).catch(() => []);
@@ -88833,6 +89144,14 @@ const MISSING_MEDIA_PLACEHOLDER = "[media missing]";
88833
89144
  function isBlobRef(url) {
88834
89145
  return url.startsWith(BLOBREF_PROTOCOL);
88835
89146
  }
89147
+ /**
89148
+ * Blob storage for large message content (images, files, videos). Content above
89149
+ * the size threshold is offloaded to blobs in `blobsDir` and referenced from
89150
+ * wire records as `blobref:` URLs; `rehydrateParts` resolves them back to
89151
+ * inline data when a session is loaded. A single filesystem implementation is
89152
+ * used across the engine; the class boundary is what keeps blob details out of
89153
+ * the wire/records code.
89154
+ */
88836
89155
  var BlobStore = class {
88837
89156
  blobsDir;
88838
89157
  threshold;
@@ -88881,6 +89200,33 @@ var BlobStore = class {
88881
89200
  }
88882
89201
  };
88883
89202
  }
89203
+ case "context.snapshot": {
89204
+ const history = await Promise.all(record.snapshot.history.map(async (message) => {
89205
+ const content = await this.offloadParts(message.content);
89206
+ return content === message.content ? message : {
89207
+ ...message,
89208
+ content
89209
+ };
89210
+ }));
89211
+ const deferredMessages = await Promise.all(record.snapshot.deferredMessages.map(async (message) => {
89212
+ const content = await this.offloadParts(message.content);
89213
+ return content === message.content ? message : {
89214
+ ...message,
89215
+ content
89216
+ };
89217
+ }));
89218
+ const historyChanged = history.some((message, i) => message !== record.snapshot.history[i]);
89219
+ const deferredChanged = deferredMessages.some((message, i) => message !== record.snapshot.deferredMessages[i]);
89220
+ if (!historyChanged && !deferredChanged) return record;
89221
+ return {
89222
+ ...record,
89223
+ snapshot: {
89224
+ ...record.snapshot,
89225
+ history,
89226
+ deferredMessages
89227
+ }
89228
+ };
89229
+ }
88884
89230
  default: return record;
88885
89231
  }
88886
89232
  }
@@ -89024,6 +89370,28 @@ function asMediaContainer(value) {
89024
89370
  }
89025
89371
  //#endregion
89026
89372
  //#region ../../packages/agent-core/src/agent/records/index.ts
89373
+ /**
89374
+ * Record types whose state is fully captured by a `context.snapshot` record.
89375
+ * When a snapshot exists, every one of these that predates it is skipped during
89376
+ * replay because the snapshot already holds the folded context memory. Note
89377
+ * `micro_compaction.apply` is written with an `as never` cast (it is not part of
89378
+ * the AgentRecord union), so it is matched here by its literal type string.
89379
+ *
89380
+ * `full_compaction.complete` is included because its only lasting effect is
89381
+ * pushing onto `compactedHistory` — a debug trail rendered from the pre-fold
89382
+ * history. Snapshot replay skips that pre-fold history, so the trail would be
89383
+ * re-rendered as empty; the snapshot carries the trail itself instead.
89384
+ */
89385
+ const SNAPSHOT_FOLDED_CONTEXT_TYPES = new Set([
89386
+ "context.append_message",
89387
+ "context.append_loop_event",
89388
+ "context.apply_compaction",
89389
+ "micro_compaction.apply",
89390
+ "full_compaction.complete"
89391
+ ]);
89392
+ function isSnapshotFoldedContextRecord(type) {
89393
+ return SNAPSHOT_FOLDED_CONTEXT_TYPES.has(type);
89394
+ }
89027
89395
  function restoreAgentRecord(agent, input) {
89028
89396
  switch (input.type) {
89029
89397
  case "metadata": return;
@@ -89106,6 +89474,17 @@ function restoreAgentRecord(agent, input) {
89106
89474
  case "context.apply_compaction":
89107
89475
  agent.context.applyCompaction(input);
89108
89476
  return;
89477
+ case "context.snapshot":
89478
+ agent.context.restoreJSONSnapshot(input.snapshot);
89479
+ agent.fullCompaction.restoreCompactedHistory(input.compactedHistory);
89480
+ for (const message of agent.context.history) {
89481
+ if (message.origin?.kind === "background_task") agent.background.markDeliveredNotification(message.origin);
89482
+ agent.replayBuilder.push({
89483
+ type: "message",
89484
+ message
89485
+ });
89486
+ }
89487
+ return;
89109
89488
  case "tools.register_user_tool":
89110
89489
  agent.tools.registerUserTool(input);
89111
89490
  return;
@@ -89184,8 +89563,19 @@ var AgentRecords = class {
89184
89563
  protocol_version: "1.4"
89185
89564
  };
89186
89565
  replayedRecords.push(migratedRecord);
89187
- this.restore(migratedRecord);
89188
89566
  }
89567
+ let snapshotIndex = -1;
89568
+ for (let i = replayedRecords.length - 1; i >= 0; i--) if (replayedRecords[i]?.type === "context.snapshot") {
89569
+ snapshotIndex = i;
89570
+ break;
89571
+ }
89572
+ for (let i = 0; i < replayedRecords.length; i++) {
89573
+ const record = replayedRecords[i];
89574
+ if (!record) continue;
89575
+ if (i < snapshotIndex && isSnapshotFoldedContextRecord(record.type)) continue;
89576
+ this.restore(record);
89577
+ }
89578
+ this.agent.context.dropVacuousOpenMessages();
89189
89579
  if (shouldRewrite) {
89190
89580
  this.persistence.rewrite(replayedRecords);
89191
89581
  await this.persistence.flush();
@@ -102410,6 +102800,13 @@ var ToolManager = class {
102410
102800
  getTodos() {
102411
102801
  return cloneTodos(this.store.todo ?? []);
102412
102802
  }
102803
+ /**
102804
+ * Register a user/plugin tool. This is the public entry point for any
102805
+ * third-party extension (plugins, skills, future harness adapters) to expose
102806
+ * a tool — built-in tools use the internal `builtinTools` map and should not
102807
+ * route through here. Prefer `defineTool()` for the typed high-level API;
102808
+ * this method takes a hand-written registration.
102809
+ */
102413
102810
  registerUserTool(input) {
102414
102811
  this.agent.records.logRecord({
102415
102812
  type: "tools.register_user_tool",
@@ -102445,6 +102842,10 @@ var ToolManager = class {
102445
102842
  this.userTools.delete(name);
102446
102843
  this.enabledTools.delete(name);
102447
102844
  }
102845
+ /**
102846
+ * Register an MCP server (and its tools). Public entry point for third-party
102847
+ * extensions to expose MCP-backed tools; built-in tooling does not use it.
102848
+ */
102448
102849
  registerMcpServer(serverName, client, tools, enabledTools, options) {
102449
102850
  this.unregisterMcpServer(serverName);
102450
102851
  const qualifiedNames = [];
@@ -103547,6 +103948,11 @@ var TurnFlow = class {
103547
103948
  } catch (error) {
103548
103949
  this.agent.log.error("closeAbandonedToolExchange failed", error);
103549
103950
  }
103951
+ try {
103952
+ this.agent.context.dropVacuousOpenMessages();
103953
+ } catch (error) {
103954
+ console.error("dropVacuousOpenMessages failed", error);
103955
+ }
103550
103956
  if (this.currentId === turnId) this.agent.usage.endTurn();
103551
103957
  this.agent.emitEvent(ended);
103552
103958
  if (standalone && this.currentId === turnId) this.activeTurn = null;
@@ -104274,6 +104680,8 @@ var Agent = class {
104274
104680
  mcp;
104275
104681
  hooks;
104276
104682
  log;
104683
+ /** In-process event bus for extensions running inside the agent process. */
104684
+ eventBus;
104277
104685
  blobStore;
104278
104686
  records;
104279
104687
  fullCompaction;
@@ -104297,6 +104705,8 @@ var Agent = class {
104297
104705
  workingSet;
104298
104706
  dreamTracker;
104299
104707
  replayBuilder;
104708
+ /** Read-only manifest of the core engine subsystems (see {@link AgentServices}). */
104709
+ services;
104300
104710
  lastLlmConfigLogSignature;
104301
104711
  sharedEmbeddingEngine;
104302
104712
  resolveRuntimeSystemPrompt;
@@ -104315,6 +104725,7 @@ var Agent = class {
104315
104725
  this.subagentHost = options.subagentHost;
104316
104726
  this.mcp = options.mcp;
104317
104727
  this.hooks = options.hookEngine;
104728
+ this.eventBus = new EventSubscriptionBus();
104318
104729
  const embedCacheDir = options.nexumHomeDir !== void 0 ? join$1(options.nexumHomeDir, "cache", "fastembed") : void 0;
104319
104730
  this.sharedEmbeddingEngine = createFastEmbedEngine(embedCacheDir);
104320
104731
  this.log = options.log ?? log;
@@ -104349,6 +104760,25 @@ var Agent = class {
104349
104760
  this.workingSet = new WorkingSet();
104350
104761
  this.dreamTracker = new DreamTracker(nexumHomeDir ?? "");
104351
104762
  this.replayBuilder = new ReplayBuilder(this);
104763
+ this.services = {
104764
+ records: this.records,
104765
+ context: this.context,
104766
+ config: this.config,
104767
+ turn: this.turn,
104768
+ injection: this.injection,
104769
+ permission: this.permission,
104770
+ planMode: this.planMode,
104771
+ usage: this.usage,
104772
+ tools: this.tools,
104773
+ skills: this.skills,
104774
+ background: this.background,
104775
+ goal: this.goal,
104776
+ sessionMemory: this.sessionMemory,
104777
+ workingSet: this.workingSet,
104778
+ fullCompaction: this.fullCompaction,
104779
+ microCompaction: this.microCompaction,
104780
+ systemPrompt: () => this.getRuntimeSystemPrompt()
104781
+ };
104352
104782
  }
104353
104783
  /**
104354
104784
  * Promise that resolves once the shared memory store (and any legacy migration)
@@ -104515,6 +104945,26 @@ var Agent = class {
104515
104945
  });
104516
104946
  };
104517
104947
  }
104948
+ /**
104949
+ * Bounded-retry wrapper around `generate` for auxiliary LLM calls (exit
104950
+ * memory extraction, side questions, knowledge-base text generation, skill
104951
+ * plan generation). These call the model directly, outside the loop's
104952
+ * step-retry layer, and SDK-level retries are disabled — without this they
104953
+ * would hard-fail on any transient 429/5xx. Mirrors the main loop's policy:
104954
+ * only retryable errors, exponential backoff, bounded attempts.
104955
+ */
104956
+ async generateWithRetry(provider, systemPrompt, tools, messages, maxAttempts = 3) {
104957
+ const delays = retryBackoffDelays(maxAttempts);
104958
+ for (let attempt = 1;; attempt++) try {
104959
+ return await this.generate(provider, systemPrompt, [...tools], [...messages]);
104960
+ } catch (error) {
104961
+ if (attempt >= maxAttempts || !isRetryableGenerateError(error)) throw error;
104962
+ const delayMs = computeDelayMs(error, delays, attempt);
104963
+ await new Promise((resolve) => {
104964
+ setTimeout(resolve, delayMs);
104965
+ });
104966
+ }
104967
+ }
104518
104968
  get llm() {
104519
104969
  const model = this.config.model;
104520
104970
  const provider = this.config.provider.withThinking(this.config.thinkingLevel);
@@ -104766,7 +105216,7 @@ var Agent = class {
104766
105216
  }).join("\n");
104767
105217
  const userPrompt = buildExitExtractionPrompt(sessionId, history.length, sampleText);
104768
105218
  try {
104769
- const response = await this.generate(this.config.provider, EXIT_EXTRACTION_SYSTEM_PROMPT, [], [{
105219
+ const response = await this.generateWithRetry(this.config.provider, EXIT_EXTRACTION_SYSTEM_PROMPT, [], [{
104770
105220
  role: "user",
104771
105221
  content: [{
104772
105222
  type: "text",
@@ -104815,7 +105265,7 @@ var Agent = class {
104815
105265
  const conversationContext = contextParts.join("\n\n");
104816
105266
  const system = conversationContext ? `${SIDE_QUESTION_SYSTEM}\n\n<conversation_context>\n${conversationContext}\n</conversation_context>` : SIDE_QUESTION_SYSTEM;
104817
105267
  if (!this.config.hasModel) return "No model configured. Run `nexum config` or use `/model` to set a default model.";
104818
- return (await this.generate(this.config.provider, system, [], [{
105268
+ return (await this.generateWithRetry(this.config.provider, system, [], [{
104819
105269
  role: "user",
104820
105270
  content: [{
104821
105271
  type: "text",
@@ -104831,7 +105281,7 @@ var Agent = class {
104831
105281
  */
104832
105282
  async generateText(systemPrompt, userPrompt) {
104833
105283
  if (!this.config.hasModel) throw new Error("No model configured. Run `nexum config` or use `/model` to set a default model.");
104834
- return (await this.generate(this.config.provider, systemPrompt, [], [{
105284
+ return (await this.generateWithRetry(this.config.provider, systemPrompt, [], [{
104835
105285
  role: "user",
104836
105286
  content: [{
104837
105287
  type: "text",
@@ -104842,6 +105292,7 @@ var Agent = class {
104842
105292
  }
104843
105293
  emitEvent(event) {
104844
105294
  if (this.records.restoring) return;
105295
+ this.eventBus.dispatch(event);
104845
105296
  this.rpc?.emitEvent?.(event)?.catch(() => {});
104846
105297
  }
104847
105298
  emitStatusUpdated() {
@@ -109886,6 +110337,90 @@ function createRPC() {
109886
110337
  return [leftClient, rightClient];
109887
110338
  }
109888
110339
  //#endregion
110340
+ //#region ../../packages/agent-core/src/plugin/runtime/extension.ts
110341
+ /**
110342
+ * Loads and activates code-entry plugins inside the agent process.
110343
+ *
110344
+ * Responsibilities:
110345
+ * - `discover()` — pick plugins whose manifest declares an `entryPoint`
110346
+ * - `load()` — dynamic-import the entry point (cached per path)
110347
+ * - `activate()` — inject declared manifest hooks into the agent's HookEngine,
110348
+ * then call the plugin's `activate(context)`; tools are registered by the
110349
+ * plugin itself via `context.services.tools.registerUserTool`
110350
+ * - `deactivate()` — symmetric removal (hooks + deactivate hook), isolated so
110351
+ * a failing plugin never breaks the agent
110352
+ *
110353
+ * Activation is deliberately lazy (a `/plugin activate` command or explicit
110354
+ * config opt-in), so merely installing a plugin never executes its code.
110355
+ */
110356
+ var ExtensionRuntime = class {
110357
+ loaded = /* @__PURE__ */ new Map();
110358
+ activations = /* @__PURE__ */ new Map();
110359
+ /** Plugins that declare a code entry point, in installation order. */
110360
+ discover(plugins) {
110361
+ const result = [];
110362
+ for (const plugin of plugins) {
110363
+ if (plugin.manifest?.entryPoint === void 0) continue;
110364
+ result.push({
110365
+ pluginId: plugin.id,
110366
+ entryPoint: plugin.manifest.entryPoint,
110367
+ manifest: plugin.manifest
110368
+ });
110369
+ }
110370
+ return result;
110371
+ }
110372
+ /** Import (and cache) an entry point module. Rejects for non-conforming modules. */
110373
+ async load(entryPoint) {
110374
+ const cached = this.loaded.get(entryPoint);
110375
+ if (cached !== void 0) return cached;
110376
+ const module = normalizeExtensionModule(await import(entryPoint));
110377
+ this.loaded.set(entryPoint, module);
110378
+ return module;
110379
+ }
110380
+ /** Activate a discovered plugin against a live agent. */
110381
+ async activate(agent, extension) {
110382
+ if (this.activations.has(extension.pluginId)) throw new Error(`Plugin "${extension.pluginId}" is already active`);
110383
+ const module = await this.load(extension.entryPoint);
110384
+ let hooksUnregister;
110385
+ if (extension.manifest.hooks !== void 0 && extension.manifest.hooks.length > 0) hooksUnregister = agent.hooks?.registerAll(extension.manifest.hooks);
110386
+ const context = {
110387
+ services: agent.services,
110388
+ events: agent.eventBus,
110389
+ config: extension.manifest.config,
110390
+ pluginId: extension.pluginId
110391
+ };
110392
+ try {
110393
+ await module.activate(context);
110394
+ } catch (error) {
110395
+ hooksUnregister?.();
110396
+ throw error;
110397
+ }
110398
+ this.activations.set(extension.pluginId, {
110399
+ module,
110400
+ hooksUnregister
110401
+ });
110402
+ }
110403
+ /** Deactivate a plugin: remove its hooks and call its deactivate hook. */
110404
+ async deactivate(pluginId) {
110405
+ const activation = this.activations.get(pluginId);
110406
+ if (activation === void 0) return;
110407
+ activation.hooksUnregister?.();
110408
+ this.activations.delete(pluginId);
110409
+ await activation.module.deactivate?.();
110410
+ }
110411
+ isActive(pluginId) {
110412
+ return this.activations.has(pluginId);
110413
+ }
110414
+ activePluginIds() {
110415
+ return [...this.activations.keys()];
110416
+ }
110417
+ };
110418
+ function normalizeExtensionModule(mod) {
110419
+ const candidate = mod?.default ?? mod;
110420
+ if (candidate === void 0 || typeof candidate.activate !== "function") throw new Error("Plugin entry point must export an activate(context) function");
110421
+ return candidate;
110422
+ }
110423
+ //#endregion
109889
110424
  //#region ../../packages/agent-core/src/tools/providers/fetch-cache.ts
109890
110425
  /**
109891
110426
  * Simple in-memory LRU cache for URL fetch results.
@@ -126208,6 +126743,8 @@ var NexumCore = class {
126208
126743
  subagentModelBindings;
126209
126744
  sessionStore;
126210
126745
  plugins;
126746
+ /** Loads/activates code-entry plugins (manifest `entryPoint`). */
126747
+ extensionRuntime = new ExtensionRuntime();
126211
126748
  pluginsReady;
126212
126749
  pluginsLoadError;
126213
126750
  constructor(rpcClient, options = {}) {
@@ -126500,6 +127037,37 @@ var NexumCore = class {
126500
127037
  registerTool({ sessionId, ...payload }) {
126501
127038
  return this.sessionApi(sessionId).registerTool(payload);
126502
127039
  }
127040
+ /**
127041
+ * Activate a code plugin (one with a manifest `entryPoint`) on the session's
127042
+ * main agent: injects declared manifest hooks into the agent's HookEngine and
127043
+ * calls the plugin's `activate(context)`.
127044
+ */
127045
+ async activatePlugin({ sessionId, pluginId }) {
127046
+ await this.pluginsReady;
127047
+ const session = this.sessions.get(sessionId);
127048
+ if (session === void 0) throw new NexumError(ErrorCodes.SESSION_NOT_FOUND, `Session "${sessionId}" was not found`, { details: { sessionId } });
127049
+ const agent = session.agents.get("main");
127050
+ if (agent === void 0) throw new NexumError(ErrorCodes.AGENT_NOT_FOUND, `Session "${sessionId}" has no main agent`, { details: { sessionId } });
127051
+ const plugin = this.plugins.list().find((record) => record.id === pluginId);
127052
+ if (plugin === void 0) throw new NexumError(ErrorCodes.PLUGIN_NOT_FOUND, `Plugin "${pluginId}" was not found`, { details: { pluginId } });
127053
+ const [extension] = this.extensionRuntime.discover([plugin]);
127054
+ if (extension === void 0) throw new NexumError(ErrorCodes.PLUGIN_NOT_FOUND, `Plugin "${pluginId}" has no code entry point`, { details: { pluginId } });
127055
+ await this.extensionRuntime.activate(agent, extension);
127056
+ }
127057
+ /** Deactivate a code plugin (removes its hooks and runs its deactivate). */
127058
+ async deactivatePlugin({ pluginId }) {
127059
+ await this.pluginsReady;
127060
+ await this.extensionRuntime.deactivate(pluginId);
127061
+ }
127062
+ /** Code plugins the runtime can load, with their activation state. */
127063
+ async pluginExtensionStatus() {
127064
+ await this.pluginsReady;
127065
+ return this.extensionRuntime.discover(this.plugins.list()).map((extension) => ({
127066
+ pluginId: extension.pluginId,
127067
+ entryPoint: extension.entryPoint,
127068
+ active: this.extensionRuntime.isActive(extension.pluginId)
127069
+ }));
127070
+ }
126503
127071
  unregisterTool({ sessionId, ...payload }) {
126504
127072
  return this.sessionApi(sessionId).unregisterTool(payload);
126505
127073
  }
@@ -127391,6 +127959,18 @@ var SDKRpcClient = class {
127391
127959
  args: input.args
127392
127960
  });
127393
127961
  }
127962
+ async activatePlugin(input) {
127963
+ return (await this.getRpc()).activatePlugin({
127964
+ sessionId: input.sessionId,
127965
+ pluginId: input.pluginId
127966
+ });
127967
+ }
127968
+ async deactivatePlugin(input) {
127969
+ return (await this.getRpc()).deactivatePlugin({ pluginId: input.pluginId });
127970
+ }
127971
+ async pluginExtensionStatus(input) {
127972
+ return (await this.getRpc()).pluginExtensionStatus({ sessionId: input.sessionId });
127973
+ }
127394
127974
  async undoHistory(input) {
127395
127975
  return (await this.getRpc()).undoHistory({
127396
127976
  sessionId: input.sessionId,
@@ -127860,6 +128440,30 @@ var Session = class {
127860
128440
  });
127861
128441
  }
127862
128442
  /**
128443
+ * Activate a code-entry plugin (manifest `entryPoint`) on the session's main
128444
+ * agent. Lazy and isolated: the plugin's code runs only after this call.
128445
+ */
128446
+ async activatePlugin(pluginId) {
128447
+ this.ensureOpen();
128448
+ await this.rpc.activatePlugin({
128449
+ sessionId: this.id,
128450
+ pluginId
128451
+ });
128452
+ }
128453
+ /** Deactivate a code-entry plugin (removes its hooks, runs its deactivate). */
128454
+ async deactivatePlugin(pluginId) {
128455
+ this.ensureOpen();
128456
+ await this.rpc.deactivatePlugin({
128457
+ sessionId: this.id,
128458
+ pluginId
128459
+ });
128460
+ }
128461
+ /** Code plugins the runtime can load, with their activation state. */
128462
+ async pluginExtensionStatus() {
128463
+ this.ensureOpen();
128464
+ return this.rpc.pluginExtensionStatus({ sessionId: this.id });
128465
+ }
128466
+ /**
127863
128467
  * Remove the last N user-prompt turns from the conversation history.
127864
128468
  * The TUI is responsible for cleaning up the corresponding transcript
127865
128469
  * entries and UI components after this call succeeds.
@@ -128812,16 +129416,20 @@ const BUILTIN_SLASH_COMMANDS = [
128812
129416
  availability: "always"
128813
129417
  },
128814
129418
  {
128815
- name: "skill",
128816
- aliases: [
128817
- "skills",
128818
- "plugin",
128819
- "plugins"
128820
- ],
128821
- description: "registry.skill_desc",
129419
+ name: "plugin",
129420
+ aliases: ["skills", "plugins"],
129421
+ hiddenAliases: ["skill"],
129422
+ description: "registry.plugin_desc",
128822
129423
  priority: 202,
128823
129424
  availability: "always"
128824
129425
  },
129426
+ {
129427
+ name: "extension",
129428
+ aliases: ["extensions"],
129429
+ description: "registry.extension_desc",
129430
+ priority: 203,
129431
+ availability: "always"
129432
+ },
128825
129433
  {
128826
129434
  name: "fork",
128827
129435
  aliases: [],
@@ -128998,7 +129606,7 @@ const BUILTIN_SLASH_COMMANDS = [
128998
129606
  }
128999
129607
  ];
129000
129608
  function findBuiltInSlashCommand(commandName) {
129001
- return BUILTIN_SLASH_COMMANDS.find((command) => command.name === commandName || command.aliases.includes(commandName));
129609
+ return BUILTIN_SLASH_COMMANDS.find((command) => command.name === commandName || command.aliases.includes(commandName) || command.hiddenAliases?.includes(commandName) === true);
129002
129610
  }
129003
129611
  function resolveSlashCommandAvailability(command, args) {
129004
129612
  const availability = command.availability ?? "idle-only";
@@ -129180,6 +129788,7 @@ function isManagedUsageProvider(providerKey) {
129180
129788
  const STREAMING_ARGS_FIELD_RE = /"(path|file_path|command|pattern|query|url|description|title|name)"\s*:\s*"((?:\\.|[^"\\])*)"/g;
129181
129789
  const STREAMING_ARGS_PREVIEW_MAX_CHARS = 8 * 1024;
129182
129790
  const STREAMING_ARGS_BUFFER_MAX_CHARS = 1024 * 1024;
129791
+ const CHARS_PER_TOKEN = 2.5;
129183
129792
  //#endregion
129184
129793
  //#region src/tui/utils/event-payload.ts
129185
129794
  function appendStreamingArgsPreview(current, next) {
@@ -134650,7 +135259,7 @@ async function guidedGoalSetup(host) {
134650
135259
  host.showNotice(t("goal.storm_breaker"), t("goal.conflict_loop"));
134651
135260
  return;
134652
135261
  }
134653
- const { TextInputDialogComponent } = await import("./text-input-dialog-B5DB64Yp.mjs");
135262
+ const { TextInputDialogComponent } = await import("./text-input-dialog-D7p11_lV.mjs");
134654
135263
  const initialDesc = await promptText(host, TextInputDialogComponent, {
134655
135264
  title: t("goal.setup_title_initial"),
134656
135265
  subtitle: t("goal.setup_desc_hint"),
@@ -134671,7 +135280,7 @@ async function guidedGoalSetup(host) {
134671
135280
  await showGoalConfigWizard(host, session, confirmed.trim() || objective, false);
134672
135281
  }
134673
135282
  async function showGoalConfigWizard(host, session, objective, replace) {
134674
- const { TextInputDialogComponent } = await import("./text-input-dialog-B5DB64Yp.mjs");
135283
+ const { TextInputDialogComponent } = await import("./text-input-dialog-D7p11_lV.mjs");
134675
135284
  const turnInput = await promptNumber(host, TextInputDialogComponent, {
134676
135285
  title: t("goal.wizard_title", { objective }),
134677
135286
  subtitle: t("goal.budget_turns_hint"),
@@ -136756,16 +137365,16 @@ const renderTruncated = (_toolCall, result, ctx) => {
136756
137365
  var ShellExecutionComponent = class extends Container {
136757
137366
  constructor(options) {
136758
137367
  super();
136759
- if (options.showCommand === true) this.addCommandPreview(options.command ?? "", options.commandPreviewLines);
137368
+ if (options.showCommand === true) this.addCommandPreview(options.command ?? "", options.commandPreviewLines, options.colors);
136760
137369
  if (options.result !== void 0) this.addResultPreview(options.result, options.colors, options.expanded ?? false, options.resultPreviewLines ?? 15);
136761
137370
  }
136762
- addCommandPreview(command, previewLines) {
137371
+ addCommandPreview(command, previewLines, colors) {
136763
137372
  if (command.length === 0) return;
136764
- const allLines = command.split("\n");
137373
+ const allLines = highlightLines(command, "bash", colors);
136765
137374
  const lines = previewLines === void 0 ? allLines : allLines.slice(0, previewLines);
136766
137375
  for (const [i, line] of lines.entries()) {
136767
137376
  const prefix = i === 0 ? "$ " : " ";
136768
- this.addChild(new Text(chalk.dim(prefix + line), 2, 0));
137377
+ this.addChild(new Text(`${chalk.dim(prefix)}${line}`, 2, 0));
136769
137378
  }
136770
137379
  }
136771
137380
  addResultPreview(result, colors, expanded, previewLines) {
@@ -136786,8 +137395,8 @@ const shellExecutionResultRenderer = (toolCall, result, ctx) => [new ShellExecut
136786
137395
  result,
136787
137396
  colors: ctx.colors,
136788
137397
  expanded: ctx.expanded,
136789
- showCommand: ctx.expanded,
136790
- commandPreviewLines: void 0
137398
+ showCommand: true,
137399
+ commandPreviewLines: ctx.expanded ? void 0 : 3
136791
137400
  })];
136792
137401
  //#endregion
136793
137402
  //#region src/tui/components/media/image-thumbnail.ts
@@ -137066,6 +137675,20 @@ function pickChip(toolName) {
137066
137675
  return REGISTRY[toolName];
137067
137676
  }
137068
137677
  //#endregion
137678
+ //#region src/tui/components/messages/tool-renderers/glance-lines.ts
137679
+ /** Render pre-styled glance lines without allowing terminal wrapping. */
137680
+ var GlanceLinesComponent = class {
137681
+ lines;
137682
+ constructor(lines) {
137683
+ this.lines = lines;
137684
+ }
137685
+ invalidate() {}
137686
+ render(width) {
137687
+ const safeWidth = Math.max(width, 1);
137688
+ return this.lines.map((line) => truncateToWidth(` ${line}`, safeWidth, "…"));
137689
+ }
137690
+ };
137691
+ //#endregion
137069
137692
  //#region src/tui/components/messages/tool-renderers/summary.ts
137070
137693
  const GLANCE_SAMPLES = 3;
137071
137694
  const MAX_EXTENSION_COUNTS = 4;
@@ -137075,11 +137698,11 @@ function withGlance(glance) {
137075
137698
  if (result.is_error) return renderTruncated(toolCall, result, ctx);
137076
137699
  const out = [];
137077
137700
  if (glance !== null) {
137078
- const line = glance(toolCall, result, ctx.colors);
137079
- if (line.length > 0) {
137080
- const indented = line.split("\n").map((l) => ` ${l}`).join("\n");
137701
+ const glanceOut = glance(toolCall, result, ctx.colors);
137702
+ if (typeof glanceOut === "string" && glanceOut.length > 0) {
137703
+ const indented = glanceOut.split("\n").map((l) => ` ${l}`).join("\n");
137081
137704
  out.push(new Text(indented, 0, 0));
137082
- }
137705
+ } else if (typeof glanceOut !== "string") out.push(glanceOut);
137083
137706
  }
137084
137707
  if (ctx.expanded && result.output.length > 0) out.push(new Text(chalk.dim(result.output), 4, 0));
137085
137708
  return out;
@@ -137102,29 +137725,35 @@ function readSearchResultsMatches(result) {
137102
137725
  if (display.kind !== "search_results") return void 0;
137103
137726
  return display.matches;
137104
137727
  }
137105
- function truncateMatchText(text, max = 80) {
137106
- if (text.length <= max) return text;
137107
- return `${text.slice(0, max - 1)}…`;
137728
+ function styleFilePath(path) {
137729
+ const index = path.lastIndexOf("/");
137730
+ if (index < 0) return path;
137731
+ return `${chalk.dim(path.slice(0, index + 1))}${path.slice(index + 1)}`;
137108
137732
  }
137109
137733
  const grepGlance = (_toolCall, result, colors) => {
137110
137734
  const matches = readSearchResultsMatches(result);
137111
137735
  if (matches !== void 0 && matches.length > 0) {
137112
- const fileColor = chalk.hex(colors.roleTool);
137113
- const lines = matches.slice(0, GLANCE_SAMPLES).map((m) => {
137114
- return `${m.line > 0 ? `${fileColor(m.file)}${chalk.dim(":")}${chalk.hex(colors.primary)(String(m.line))}` : fileColor(m.file)}${chalk.dim(` ${truncateMatchText(m.text.trim())}`)}`;
137736
+ const samples = matches.slice(0, GLANCE_SAMPLES);
137737
+ const plainLocations = samples.map((match) => match.line > 0 ? `${match.file}:${String(match.line)}` : match.file);
137738
+ const columnWidth = Math.max(...plainLocations.map((location) => visibleWidth(location)));
137739
+ const lineNumberColor = chalk.hex(colors.roleTool);
137740
+ const lines = samples.map((match, index) => {
137741
+ const location = match.line > 0 ? `${styleFilePath(match.file)}${chalk.dim(":")}${lineNumberColor(String(match.line))}` : styleFilePath(match.file);
137742
+ const padding = " ".repeat(Math.max(0, columnWidth - visibleWidth(plainLocations[index] ?? "")));
137743
+ const text = match.text.trim();
137744
+ return text.length > 0 ? `${location}${padding} ${chalk.dim(text)}` : `${location}${padding}`;
137115
137745
  });
137116
137746
  const remaining = matches.length - GLANCE_SAMPLES;
137117
137747
  if (remaining > 0) lines.push(chalk.dim(`+${String(remaining)} more`));
137118
- return lines.join("\n");
137748
+ return new GlanceLinesComponent(lines);
137119
137749
  }
137120
137750
  const lines = nonEmptyLines(result.output);
137121
137751
  if (lines.length === 0) return "";
137122
137752
  const samples = lines.slice(0, GLANCE_SAMPLES).map(pathFromGrepLine);
137123
137753
  const remaining = lines.length - samples.length;
137124
- const fileColor = chalk.hex(colors.roleTool);
137125
- const out = samples.map((s) => fileColor(s));
137754
+ const out = samples.map((sample) => styleFilePath(sample));
137126
137755
  if (remaining > 0) out.push(chalk.dim(`+${String(remaining)} more`));
137127
- return out.join("\n");
137756
+ return new GlanceLinesComponent(out);
137128
137757
  };
137129
137758
  function fileBasename(path) {
137130
137759
  const idx = path.lastIndexOf("/");
@@ -139264,7 +139893,7 @@ async function findCcConnectResidualPaths(excludePath) {
139264
139893
  existing.push(p);
139265
139894
  } catch {}
139266
139895
  }
139267
- return existing.sort();
139896
+ return existing.toSorted();
139268
139897
  }
139269
139898
  async function handleCcCommand(host) {
139270
139899
  const daemon = resolveDaemonMode();
@@ -139304,7 +139933,7 @@ function runLifecycleAction(host, daemon, action) {
139304
139933
  host.refreshCcStatus();
139305
139934
  } else host.showError(t("cc.start_failed", {
139306
139935
  label,
139307
- output: output || "未知错误"
139936
+ output: output || t("cc.unknown_error")
139308
139937
  }));
139309
139938
  })();
139310
139939
  }
@@ -139314,7 +139943,7 @@ function buildUninstallSummary(daemon, install, residualPaths = []) {
139314
139943
  t("cc.will_clean"),
139315
139944
  t("cc.clean_daemon", { label: daemon.method }),
139316
139945
  t("cc.clean_config", { detail: t("cc.clean_config.detail") }),
139317
- "· 执行 npm uninstall -g cc-connect"
139946
+ t("cc.uninstall_step_npm")
139318
139947
  ];
139319
139948
  if (install.version) lines.push(t("cc.current_version", { version: install.version }));
139320
139949
  if (install.entry) lines.push(t("cc.install_path", { path: install.entry }));
@@ -139480,6 +140109,28 @@ function confirmCcConnectUninstall(host, summary) {
139480
140109
  });
139481
140110
  }
139482
140111
  //#endregion
140112
+ //#region src/cli/update/prefix.ts
140113
+ /** Derive the npm global prefix that contains the running Nexum Code entrypoint. */
140114
+ function globalPrefixForNexum() {
140115
+ const entry = process.argv[1];
140116
+ if (!entry) return void 0;
140117
+ const separator = entry.includes("\\") ? "\\" : "/";
140118
+ const parts = entry.split(/[\\/]/);
140119
+ const index = parts.lastIndexOf("node_modules");
140120
+ if (index < 2 || parts[index - 1] !== "lib") return void 0;
140121
+ return parts.slice(0, index - 1).join(separator);
140122
+ }
140123
+ /** Build npm arguments while preserving the prefix used by this installation. */
140124
+ function installLatestArgs() {
140125
+ const prefix = globalPrefixForNexum();
140126
+ return [
140127
+ "install",
140128
+ "-g",
140129
+ "nexum-code@latest",
140130
+ ...prefix !== void 0 ? ["--prefix", prefix] : []
140131
+ ];
140132
+ }
140133
+ //#endregion
139483
140134
  //#region src/utils/persistence.ts
139484
140135
  /**
139485
140136
  * Small persistence helpers for CLI-owned data files.
@@ -139742,11 +140393,7 @@ async function handleUpdateCommand(host) {
139742
140393
  }
139743
140394
  host.showStatus(t("update.updating", { version: target.version }));
139744
140395
  host.showStatus(t("update.npm_install"));
139745
- const result = await runInstallStep(npmExecutable(), [
139746
- "install",
139747
- "-g",
139748
- "nexum-code@latest"
139749
- ], void 0, t("update.install_label"));
140396
+ const result = await runInstallStep(npmExecutable(), installLatestArgs(), void 0, t("update.install_label"));
139750
140397
  if (!result.ok) {
139751
140398
  host.showError(`❌ ${result.message}`);
139752
140399
  return;
@@ -140229,9 +140876,87 @@ function getPlatforms() {
140229
140876
  type: "wecom",
140230
140877
  setupCmd: "wecom setup --project default",
140231
140878
  note: t("ccconnect.note_wecom")
140879
+ },
140880
+ {
140881
+ name: "QQ 官方 bot",
140882
+ type: "qqbot",
140883
+ setupCmd: "qqbot setup --project default"
140884
+ },
140885
+ {
140886
+ name: "LINE",
140887
+ type: "line",
140888
+ setupCmd: "line setup --project default"
140889
+ },
140890
+ {
140891
+ name: "微博",
140892
+ type: "weibo",
140893
+ setupCmd: "weibo setup --project default"
140894
+ },
140895
+ {
140896
+ name: "WPS 协作",
140897
+ type: "wps-xiezuo",
140898
+ setupCmd: "wps-xiezuo setup --project default"
140899
+ },
140900
+ {
140901
+ name: "Matrix",
140902
+ type: "matrix",
140903
+ setupCmd: "matrix setup --project default",
140904
+ note: t("ccconnect.note_matrix")
140905
+ },
140906
+ {
140907
+ name: "Cisco Webex",
140908
+ type: "webex",
140909
+ setupCmd: "webex setup --project default",
140910
+ note: t("ccconnect.note_webex")
140911
+ },
140912
+ {
140913
+ name: "MAX",
140914
+ type: "max",
140915
+ setupCmd: "max setup --project default",
140916
+ note: t("ccconnect.note_max")
140917
+ },
140918
+ {
140919
+ name: "Google Chat",
140920
+ type: "googlechat",
140921
+ setupCmd: "googlechat setup --project default",
140922
+ note: t("ccconnect.note_googlechat")
140923
+ },
140924
+ {
140925
+ name: "Cloud Web",
140926
+ type: "cloud_web",
140927
+ setupCmd: "cloud_web setup --project default",
140928
+ note: t("ccconnect.note_cloud_web")
140929
+ },
140930
+ {
140931
+ name: "腾讯元宝",
140932
+ type: "yuanbao",
140933
+ setupCmd: "yuanbao setup --project default",
140934
+ note: t("ccconnect.note_yuanbao")
140935
+ },
140936
+ {
140937
+ name: "Tuitui",
140938
+ type: "tuitui",
140939
+ setupCmd: "tuitui setup --project default",
140940
+ note: t("ccconnect.note_tuitui")
140941
+ },
140942
+ {
140943
+ name: "WPS 数字员工",
140944
+ type: "wps-agentspace",
140945
+ setupCmd: "wps-agentspace setup --project default",
140946
+ note: t("ccconnect.note_wps_agentspace")
140232
140947
  }
140233
140948
  ];
140234
140949
  }
140950
+ const NEW_PLATFORM_TYPES = new Set([
140951
+ "matrix",
140952
+ "webex",
140953
+ "max",
140954
+ "googlechat",
140955
+ "cloud_web",
140956
+ "yuanbao",
140957
+ "tuitui",
140958
+ "wps-agentspace"
140959
+ ]);
140235
140960
  const CONFIG_PATH = join(homedir(), ".cc-connect", "config.toml");
140236
140961
  function checkCcConnect() {
140237
140962
  try {
@@ -140247,42 +140972,66 @@ function checkCcConnect() {
140247
140972
  }
140248
140973
  }
140249
140974
  function detectNexumPath() {
140975
+ const execBase = process.execPath.toLowerCase();
140976
+ if (execBase.endsWith("/nexum") || execBase.endsWith("\\nexum") || execBase.endsWith("nexum.exe")) return `${quoteShellPath(process.execPath)} stream-json`;
140977
+ if (execBase.includes("node") && process.argv[1]) {
140978
+ const arg1 = process.argv[1];
140979
+ if (arg1.includes("nexum-code") || arg1.includes("nexum")) return `node ${quoteShellPath(arg1)} stream-json`;
140980
+ }
140250
140981
  try {
140251
140982
  const first = execSync(process.platform === "win32" ? "where nexum" : "which nexum 2>/dev/null", {
140252
140983
  encoding: "utf-8",
140253
140984
  timeout: 3e3
140254
140985
  }).trim().split(/[\r\n]+/)[0]?.trim() ?? "";
140255
- if (first) return `${first} stream-json`;
140986
+ if (first) return `${quoteShellPath(first)} stream-json`;
140256
140987
  } catch {}
140257
140988
  return "nexum stream-json";
140258
140989
  }
140259
- function readConfiguredType() {
140260
- if (!existsSync(CONFIG_PATH)) return void 0;
140261
- try {
140262
- const content = readFileSync(CONFIG_PATH, "utf-8");
140263
- let inPlatforms = false;
140264
- for (const line of content.split("\n")) {
140265
- const trimmed = line.trim();
140266
- if (trimmed === "[[projects.platforms]]") {
140267
- inPlatforms = true;
140268
- continue;
140269
- }
140270
- if (trimmed.startsWith("[[") && trimmed !== "[[projects.platforms]]") {
140271
- inPlatforms = false;
140272
- continue;
140273
- }
140274
- if (inPlatforms) {
140275
- const m = line.match(/^type\s*=\s*"(\S+)"/);
140276
- if (m) return m[1];
140277
- }
140990
+ function quoteShellPath(path) {
140991
+ return `"${path.replaceAll(/"/g, "\\\"")}"`;
140992
+ }
140993
+ function parseConfiguredTypes(content) {
140994
+ const types = [];
140995
+ let inPlatforms = false;
140996
+ for (const line of content.split("\n")) {
140997
+ const trimmed = line.trim();
140998
+ if (trimmed.startsWith("[[projects.platforms]]")) {
140999
+ inPlatforms = true;
141000
+ continue;
140278
141001
  }
140279
- return;
141002
+ if (trimmed.startsWith("[")) {
141003
+ inPlatforms = false;
141004
+ continue;
141005
+ }
141006
+ if (inPlatforms) {
141007
+ const match = trimmed.match(/^type\s*=\s*["']([^"']+)["']/);
141008
+ if (match?.[1]) types.push(match[1]);
141009
+ }
141010
+ }
141011
+ return types;
141012
+ }
141013
+ function readConfiguredTypes() {
141014
+ if (!existsSync(CONFIG_PATH)) return [];
141015
+ try {
141016
+ return parseConfiguredTypes(readFileSync(CONFIG_PATH, "utf-8"));
140280
141017
  } catch {
140281
- return;
141018
+ return [];
140282
141019
  }
140283
141020
  }
140284
- function escapeSingleQuotes(str) {
140285
- return str.replaceAll("'", "\\'");
141021
+ function hasPlatformConfigured(content, type) {
141022
+ const escaped = type.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&");
141023
+ return new RegExp(`^\\s*type\\s*=\\s*["']${escaped}["']`, "m").test(content);
141024
+ }
141025
+ function isVersionAtLeast(version, min) {
141026
+ if (!version) return false;
141027
+ const parse = (value) => value.split(".").map((part) => Number.parseInt(part, 10) || 0);
141028
+ const [a = 0, b = 0, c = 0] = parse(version);
141029
+ const [x = 0, y = 0, z = 0] = parse(min);
141030
+ return a > x || a === x && (b > y || b === y && c >= z);
141031
+ }
141032
+ function tomlString(value) {
141033
+ if (!value.includes("'")) return `'${value}'`;
141034
+ return `"${value.replaceAll(/\\/g, "\\\\").replaceAll(/"/g, "\\\"")}"`;
140286
141035
  }
140287
141036
  function generateConfig(platform) {
140288
141037
  const dir = dirname$1(CONFIG_PATH);
@@ -140290,11 +141039,14 @@ function generateConfig(platform) {
140290
141039
  const platformBlock = `\n[[projects.platforms]]\ntype = "${platform.type}"\n`;
140291
141040
  if (existsSync(CONFIG_PATH)) {
140292
141041
  const existing = readFileSync(CONFIG_PATH, "utf-8");
140293
- if (existing.includes(`type = "${platform.type}"`)) return;
141042
+ if (hasPlatformConfigured(existing, platform.type)) return;
140294
141043
  writeFileSync(CONFIG_PATH, existing + platformBlock, "utf-8");
140295
141044
  return;
140296
141045
  }
140297
- writeFileSync(CONFIG_PATH, [
141046
+ writeFileSync(CONFIG_PATH, buildConfigContent(platform, detectNexumPath(), process.cwd()), "utf-8");
141047
+ }
141048
+ function buildConfigContent(platform, nexumCmd, cwd) {
141049
+ return [
140298
141050
  t("ccconnect.config_comment_attachment"),
140299
141051
  "attachment_send = \"on\"",
140300
141052
  "",
@@ -140305,21 +141057,22 @@ function generateConfig(platform) {
140305
141057
  "type = \"claudecode\"",
140306
141058
  "",
140307
141059
  "[projects.agent.options]",
140308
- `cmd = '${escapeSingleQuotes(detectNexumPath())}'`,
140309
- `work_dir = '${escapeSingleQuotes(process.cwd())}'`,
140310
- "mode = \"default\"",
141060
+ `cmd = ${tomlString(nexumCmd)}`,
141061
+ `work_dir = ${tomlString(cwd)}`,
141062
+ "# Permission mode: default (confirm each tool) | acceptEdits | plan | auto | bypassPermissions (yolo) | dontAsk",
141063
+ "mode = \"auto\"",
140311
141064
  "",
140312
141065
  "[[projects.platforms]]",
140313
141066
  `type = "${platform.type}"`,
140314
141067
  ""
140315
- ].join("\n"), "utf-8");
141068
+ ].join("\n");
140316
141069
  }
140317
141070
  const SEP = "──".repeat(20);
140318
141071
  /**
140319
141072
  * Build the full notice text shown after platform selection.
140320
141073
  * Common management commands come first; detailed setup steps follow.
140321
141074
  */
140322
- function buildNoticeText(platform, isReconfigure) {
141075
+ function buildNoticeText(platform, isReconfigure, installedVersion) {
140323
141076
  const daemon = getDaemonInstructions(dirname$1(CONFIG_PATH));
140324
141077
  const parts = [];
140325
141078
  if (isReconfigure) {
@@ -140331,6 +141084,10 @@ function buildNoticeText(platform, isReconfigure) {
140331
141084
  parts.push("");
140332
141085
  parts.push(t("ccconnect.config_written", { path: CONFIG_PATH }));
140333
141086
  }
141087
+ if (NEW_PLATFORM_TYPES.has(platform.type) && !isVersionAtLeast(installedVersion, "1.5.0")) {
141088
+ parts.push("");
141089
+ parts.push(t("ccconnect.new_platform_version_hint"));
141090
+ }
140334
141091
  parts.push("");
140335
141092
  parts.push(t("ccconnect.quick_ref"));
140336
141093
  parts.push("");
@@ -140384,13 +141141,14 @@ function buildNoticeText(platform, isReconfigure) {
140384
141141
  return parts.join("\n");
140385
141142
  }
140386
141143
  async function handleChannelCommand(host, _args) {
140387
- if (!checkCcConnect().installed) {
141144
+ const cc = checkCcConnect();
141145
+ if (!cc.installed) {
140388
141146
  host.showNotice(t("ccconnect.not_installed"), t("ccconnect.install_guide"));
140389
141147
  return;
140390
141148
  }
140391
- const configuredType = readConfiguredType();
141149
+ const configuredTypes = readConfiguredTypes();
140392
141150
  const options = getPlatforms().map((p) => {
140393
- const isConfigured = configuredType === p.type;
141151
+ const isConfigured = configuredTypes.includes(p.type);
140394
141152
  return {
140395
141153
  value: p.type,
140396
141154
  label: isConfigured ? t("ccconnect.already_configured", { name: p.name }) : p.name,
@@ -140401,7 +141159,7 @@ async function handleChannelCommand(host, _args) {
140401
141159
  title: t("ccconnect.picker_title"),
140402
141160
  hint: t("ccconnect.picker_hint"),
140403
141161
  options,
140404
- currentValue: configuredType,
141162
+ currentValue: configuredTypes[0],
140405
141163
  colors: host.state.theme.colors,
140406
141164
  onSelect: (value) => {
140407
141165
  host.restoreEditor();
@@ -140410,12 +141168,12 @@ async function handleChannelCommand(host, _args) {
140410
141168
  host.showError(t("error.internal"));
140411
141169
  return;
140412
141170
  }
140413
- if (configuredType === value) {
140414
- host.showNotice(t("ccconnect.reconfigured", { name: platform.name }), buildNoticeText(platform, true));
141171
+ if (configuredTypes.includes(value)) {
141172
+ host.showNotice(t("ccconnect.reconfigured", { name: platform.name }), buildNoticeText(platform, true, cc.version));
140415
141173
  return;
140416
141174
  }
140417
141175
  generateConfig(platform);
140418
- host.showNotice(t("ccconnect.config_done", { name: platform.name }), buildNoticeText(platform, false));
141176
+ host.showNotice(t("ccconnect.config_done", { name: platform.name }), buildNoticeText(platform, false, cc.version));
140419
141177
  },
140420
141178
  onCancel: () => {
140421
141179
  host.restoreEditor();
@@ -140786,13 +141544,13 @@ function disposeChildren(container) {
140786
141544
  const SKILL_DESC_MAX = 60;
140787
141545
  async function handleSkillCommand(host, _args) {
140788
141546
  if (!host.session) {
140789
- host.showError(t("skill.no_session"));
141547
+ host.showError(t("plugin.no_session"));
140790
141548
  return;
140791
141549
  }
140792
141550
  await openSkillCenter(host);
140793
141551
  }
140794
141552
  async function openSkillCenter(host) {
140795
- const loading = new SkillCenterLoadingComponent(host, t("skill.loading"));
141553
+ const loading = new SkillCenterLoadingComponent(host, t("plugin.loading"));
140796
141554
  host.mountEditorReplacement(loading);
140797
141555
  const [skillsResult, pluginsResult, marketplaceResult] = await Promise.allSettled([
140798
141556
  loadActivatableSkills(host),
@@ -140807,12 +141565,12 @@ async function openSkillCenter(host) {
140807
141565
  const options = buildOptions(host, skills, plugins, marketplace);
140808
141566
  if (options.length === 0) {
140809
141567
  host.restoreEditor();
140810
- host.showNotice(t("skill.center_title"), t("skill.no_skills"));
141568
+ host.showNotice(t("plugin.center_title"), t("plugin.no_plugins"));
140811
141569
  return;
140812
141570
  }
140813
141571
  const picker = new ChoicePickerComponent({
140814
- title: t("skill.center_title"),
140815
- hint: t("skill.footer_hint"),
141572
+ title: t("plugin.center_title"),
141573
+ hint: t("plugin.footer_hint"),
140816
141574
  options,
140817
141575
  colors: host.state.theme.colors,
140818
141576
  searchable: true,
@@ -140892,7 +141650,7 @@ function buildOptions(host, skills, plugins, marketplace) {
140892
141650
  if (skills.length > 0) {
140893
141651
  options.push({
140894
141652
  value: "__section__installed",
140895
- label: "── " + t("skill.installed") + " ──"
141653
+ label: "── " + t("plugin.installed") + " ──"
140896
141654
  });
140897
141655
  for (const skill of skills) {
140898
141656
  const actionKeys = {};
@@ -140919,12 +141677,12 @@ function buildOptions(host, skills, plugins, marketplace) {
140919
141677
  if (installable.length > 0) {
140920
141678
  options.push({
140921
141679
  value: "__section__installable",
140922
- label: "── " + t("skill.installable") + " ──"
141680
+ label: "── " + t("plugin.installable") + " ──"
140923
141681
  });
140924
141682
  for (const entry of installable) options.push({
140925
141683
  value: `install:${entry.source}`,
140926
141684
  label: entry.displayName,
140927
- description: entry.description ? `${truncate(entry.description, SKILL_DESC_MAX)} [${t("skill.not_installed")}]` : `[${t("skill.not_installed")}]`,
141685
+ description: entry.description ? `${truncate(entry.description, SKILL_DESC_MAX)} [${t("plugin.not_installed")}]` : `[${t("plugin.not_installed")}]`,
140928
141686
  actionKeys: { i: () => {
140929
141687
  host.restoreEditor();
140930
141688
  installInjectActivate(host, entry.source);
@@ -140951,12 +141709,12 @@ async function handleSelect(host, value, skills, _plugins, _marketplace) {
140951
141709
  async function activateSkillByName(host, name, skills) {
140952
141710
  const session = host.session;
140953
141711
  if (!session) {
140954
- host.showError(t("skill.no_session_activate"));
141712
+ host.showError(t("plugin.no_session_activate"));
140955
141713
  return;
140956
141714
  }
140957
141715
  const skill = skills.find((s) => s.name === name);
140958
141716
  if (!skill) {
140959
- host.showError(t("skill.not_found"));
141717
+ host.showError(t("plugin.not_found"));
140960
141718
  return;
140961
141719
  }
140962
141720
  host.sendSkillActivation(session, skill.name, "");
@@ -140964,20 +141722,20 @@ async function activateSkillByName(host, name, skills) {
140964
141722
  async function installInjectActivate(host, source) {
140965
141723
  const session = host.session;
140966
141724
  if (!session) {
140967
- host.showError(t("skill.no_session_activate"));
141725
+ host.showError(t("plugin.no_session_activate"));
140968
141726
  return;
140969
141727
  }
140970
- const spinner = host.showProgressSpinner(t("skill.installing_package"));
141728
+ const spinner = host.showProgressSpinner(t("plugin.installing_package"));
140971
141729
  try {
140972
141730
  const summary = await session.installPlugin(source);
140973
141731
  await session.injectPlugin(summary.id);
140974
141732
  spinner.stop({
140975
141733
  ok: true,
140976
- label: `"${summary.displayName}" ${t("skill.installed_injected")}`
141734
+ label: `"${summary.displayName}" ${t("plugin.installed_injected")}`
140977
141735
  });
140978
141736
  const pluginSkills = (await session.listSkills()).filter((s) => s.pluginId === summary.id && isUserActivatableSkill(s));
140979
141737
  if (pluginSkills.length === 0) {
140980
- host.showNotice(t("skill.plugin_installed"), `${summary.displayName} ${t("skill.no_manual_skill")}`);
141738
+ host.showNotice(t("plugin.plugin_installed"), `${summary.displayName} ${t("plugin.no_manual_plugin")}`);
140981
141739
  return;
140982
141740
  }
140983
141741
  if (pluginSkills.length === 1) {
@@ -140989,9 +141747,9 @@ async function installInjectActivate(host, source) {
140989
141747
  } catch (error) {
140990
141748
  spinner.stop({
140991
141749
  ok: false,
140992
- label: t("skill.install_failed")
141750
+ label: t("plugin.install_failed")
140993
141751
  });
140994
- host.showError(t("skill.install_failed_msg", { msg: error instanceof Error ? error.message : String(error) }));
141752
+ host.showError(t("plugin.install_failed_msg", { msg: error instanceof Error ? error.message : String(error) }));
140995
141753
  }
140996
141754
  }
140997
141755
  async function pickAndActivateSkill(host, skills, plugins = []) {
@@ -141003,8 +141761,8 @@ async function pickAndActivateSkill(host, skills, plugins = []) {
141003
141761
  description: formatSkillDescription(skill, plugins)
141004
141762
  }));
141005
141763
  const picker = new ChoicePickerComponent({
141006
- title: t("skill.select_activate"),
141007
- hint: t("skill.select_hint"),
141764
+ title: t("plugin.select_activate"),
141765
+ hint: t("plugin.select_hint"),
141008
141766
  options,
141009
141767
  colors: host.state.theme.colors,
141010
141768
  searchable: true,
@@ -141022,7 +141780,7 @@ async function pickAndActivateSkill(host, skills, plugins = []) {
141022
141780
  async function uninstallByPluginId(host, pluginId, plugin) {
141023
141781
  const session = host.session;
141024
141782
  if (!session) {
141025
- host.showError(t("skill.no_session_activate"));
141783
+ host.showError(t("plugin.no_session_activate"));
141026
141784
  return;
141027
141785
  }
141028
141786
  if (plugin === void 0) try {
@@ -141030,24 +141788,24 @@ async function uninstallByPluginId(host, pluginId, plugin) {
141030
141788
  } catch {}
141031
141789
  const label = plugin?.displayName ?? pluginId;
141032
141790
  const skillCount = plugin?.skillCount;
141033
- if (!await confirmUninstall(host, label, skillCount !== void 0 && skillCount > 0 ? t("skill.uninstall_whole_pkg", { count: skillCount }) : t("skill.uninstall_single"))) {
141791
+ if (!await confirmUninstall(host, label, skillCount !== void 0 && skillCount > 0 ? t("plugin.uninstall_whole_pkg", { count: skillCount }) : t("plugin.uninstall_single"))) {
141034
141792
  await openSkillCenter(host);
141035
141793
  return;
141036
141794
  }
141037
- const spinner = host.showProgressSpinner(`${t("skill.uninstalling")} "${label}"…`);
141795
+ const spinner = host.showProgressSpinner(`${t("plugin.uninstalling")} "${label}"…`);
141038
141796
  try {
141039
141797
  await session.removePlugin(pluginId);
141040
141798
  spinner.stop({
141041
141799
  ok: true,
141042
- label: `"${label}" ${t("skill.uninstalled")}`
141800
+ label: `"${label}" ${t("plugin.uninstalled")}`
141043
141801
  });
141044
- host.showNotice(t("skill.plugin_uninstalled"), t("skill.plugin_removed"));
141802
+ host.showNotice(t("plugin.plugin_uninstalled"), t("plugin.plugin_removed"));
141045
141803
  } catch (error) {
141046
141804
  spinner.stop({
141047
141805
  ok: false,
141048
- label: t("skill.uninstall_failed")
141806
+ label: t("plugin.uninstall_failed")
141049
141807
  });
141050
- host.showError(t("skill.uninstall_failed_msg", { msg: error instanceof Error ? error.message : String(error) }));
141808
+ host.showError(t("plugin.uninstall_failed_msg", { msg: error instanceof Error ? error.message : String(error) }));
141051
141809
  } finally {
141052
141810
  await openSkillCenter(host);
141053
141811
  }
@@ -141055,27 +141813,27 @@ async function uninstallByPluginId(host, pluginId, plugin) {
141055
141813
  async function uninstallManualSkill(host, skill) {
141056
141814
  const session = host.session;
141057
141815
  if (!session) {
141058
- host.showError(t("skill.no_session_activate"));
141816
+ host.showError(t("plugin.no_session_activate"));
141059
141817
  return;
141060
141818
  }
141061
- if (!await confirmUninstall(host, skill.name, t("skill.deleting_skill"))) {
141819
+ if (!await confirmUninstall(host, skill.name, t("plugin.deleting_plugin"))) {
141062
141820
  await openSkillCenter(host);
141063
141821
  return;
141064
141822
  }
141065
- const spinner = host.showProgressSpinner(`${t("skill.deleting")} "${skill.name}"…`);
141823
+ const spinner = host.showProgressSpinner(`${t("plugin.deleting")} "${skill.name}"…`);
141066
141824
  try {
141067
141825
  await session.removeSkill(skill.name);
141068
141826
  spinner.stop({
141069
141827
  ok: true,
141070
- label: `"${skill.name}" ${t("skill.deleted")}`
141828
+ label: `"${skill.name}" ${t("plugin.deleted")}`
141071
141829
  });
141072
- host.showNotice(t("skill.skill_deleted"), t("skill.skill_removed"));
141830
+ host.showNotice(t("plugin.plugin_deleted"), t("plugin.skill_removed"));
141073
141831
  } catch (error) {
141074
141832
  spinner.stop({
141075
141833
  ok: false,
141076
- label: t("skill.delete_failed")
141834
+ label: t("plugin.delete_failed")
141077
141835
  });
141078
- host.showError(t("skill.delete_failed_msg", { msg: error instanceof Error ? error.message : String(error) }));
141836
+ host.showError(t("plugin.delete_failed_msg", { msg: error instanceof Error ? error.message : String(error) }));
141079
141837
  } finally {
141080
141838
  await openSkillCenter(host);
141081
141839
  }
@@ -141083,14 +141841,14 @@ async function uninstallManualSkill(host, skill) {
141083
141841
  async function confirmUninstall(host, label, description) {
141084
141842
  return new Promise((resolve) => {
141085
141843
  const picker = new ChoicePickerComponent({
141086
- title: t("skill.confirm_uninstall", { label }),
141087
- hint: t("skill.uninstall_reversible"),
141844
+ title: t("plugin.confirm_uninstall", { label }),
141845
+ hint: t("plugin.uninstall_reversible"),
141088
141846
  options: [{
141089
141847
  value: "no",
141090
141848
  label: t("common.cancel")
141091
141849
  }, {
141092
141850
  value: "yes",
141093
- label: t("skill.uninstall_yes"),
141851
+ label: t("plugin.uninstall_yes"),
141094
141852
  tone: "danger",
141095
141853
  description
141096
141854
  }],
@@ -141109,10 +141867,10 @@ async function confirmUninstall(host, label, description) {
141109
141867
  }
141110
141868
  function formatSkillDescription(skill, plugins = []) {
141111
141869
  const parts = [];
141112
- if (skill.source) parts.push(`${t("skill.source_label")} ${skill.source}`);
141870
+ if (skill.source) parts.push(`${t("plugin.source_label")} ${skill.source}`);
141113
141871
  if (skill.pluginId !== void 0) {
141114
141872
  const label = plugins.find((p) => p.id === skill.pluginId)?.displayName ?? skill.pluginId;
141115
- parts.push(`${t("skill.plugin_label")} ${label}`);
141873
+ parts.push(`${t("plugin.plugin_label")} ${label}`);
141116
141874
  }
141117
141875
  if (skill.description) parts.push(truncate(skill.description, SKILL_DESC_MAX));
141118
141876
  return parts.join(" · ");
@@ -141121,6 +141879,61 @@ function truncate(value, max) {
141121
141879
  return value.length > max ? `${value.slice(0, max)}…` : value;
141122
141880
  }
141123
141881
  //#endregion
141882
+ //#region src/tui/commands/extension.ts
141883
+ /** Activate, deactivate, or list code-entry plugin extensions. */
141884
+ async function handleExtensionCommand(host, args) {
141885
+ const session = host.session;
141886
+ if (!session) {
141887
+ host.showError(t("extension.no_session"));
141888
+ return;
141889
+ }
141890
+ const [action, ...rest] = args.trim().split(/\s+/);
141891
+ const pluginId = rest.join(" ").trim();
141892
+ switch (action === "" || action === void 0 ? "status" : action) {
141893
+ case "activate":
141894
+ if (!pluginId) {
141895
+ host.showError(t("extension.missing_id", { action: "activate" }));
141896
+ return;
141897
+ }
141898
+ try {
141899
+ await session.activatePlugin(pluginId);
141900
+ host.showStatus(t("extension.activated", { pluginId }));
141901
+ } catch (error) {
141902
+ host.showError(getErrorMessage(error));
141903
+ }
141904
+ return;
141905
+ case "deactivate":
141906
+ if (!pluginId) {
141907
+ host.showError(t("extension.missing_id", { action: "deactivate" }));
141908
+ return;
141909
+ }
141910
+ try {
141911
+ await session.deactivatePlugin(pluginId);
141912
+ host.showStatus(t("extension.deactivated", { pluginId }));
141913
+ } catch (error) {
141914
+ host.showError(getErrorMessage(error));
141915
+ }
141916
+ return;
141917
+ case "status":
141918
+ try {
141919
+ const extensions = await session.pluginExtensionStatus();
141920
+ if (extensions.length === 0) {
141921
+ host.showStatus(t("extension.no_extensions"));
141922
+ return;
141923
+ }
141924
+ for (const extension of extensions) host.showStatus(`${extension.active ? "●" : "○"} ${extension.pluginId}`);
141925
+ } catch (error) {
141926
+ host.showError(getErrorMessage(error));
141927
+ }
141928
+ return;
141929
+ default: host.showError(t("extension.usage"));
141930
+ }
141931
+ }
141932
+ function getErrorMessage(error) {
141933
+ if (error === null || error === void 0) return String(error);
141934
+ return String(error.message ?? error);
141935
+ }
141936
+ //#endregion
141124
141937
  //#region src/tui/commands/btw.ts
141125
141938
  /**
141126
141939
  * /btw — Fast side question without interrupting the main conversation.
@@ -141317,7 +142130,7 @@ function buildRoleAdditionalText(prefs) {
141317
142130
  lines.push("", ...items);
141318
142131
  if (doNot !== void 0 && doNot.length > 0) lines.push("", "## Do NOT (explicit prohibitions — NEVER do these)", doNot);
141319
142132
  if (hasToolPriority) {
141320
- const instruction = prefs.toolPriority === "skill" ? "For every user request, first analyze the intent, then check all installed skills and try to solve the problem with a matching one. Only when no installed skill fits should you fall back to MCP tools or decide on your own how to solve it." : "For every user request, first analyze the intent, then check all available MCP tools and try to solve the problem with one. Only when no MCP tool fits should you fall back to the Skill tool or decide on your own how to solve it.";
142133
+ const instruction = prefs.toolPriority === "skill" ? "For every user request: (1) first analyze the intent, (2) then identify whether any installed skill matches THIS request, (3) if one matches, invoke the Skill tool with it as your FIRST action — before MCP tools or doing it yourself, (4) if none matches, proceed with MCP tools or solve it yourself. Consult the skill list shown in the Skill tool description whenever you are unsure what is installed." : "For every user request: (1) first analyze the intent, (2) then identify whether any available MCP tool matches THIS request, (3) if one matches, use it as your FIRST action — before the Skill tool or doing it yourself, (4) if none matches, proceed with the Skill tool or solve it yourself.";
141321
142134
  lines.push("", "## Tool priority (set via /like — HIGHEST PRIORITY)", instruction);
141322
142135
  }
141323
142136
  lines.push("", t("like.priority"));
@@ -144141,13 +144954,16 @@ async function handleBuiltInSlashCommand(host, name, args) {
144141
144954
  case "make-skill":
144142
144955
  await handleMakeSkillCommand(host, args);
144143
144956
  return;
144144
- case "skill":
144957
+ case "plugin":
144145
144958
  await handleSkillCommand(host, args);
144146
144959
  return;
144960
+ case "extension":
144961
+ await handleExtensionCommand(host, args);
144962
+ return;
144147
144963
  default:
144148
144964
  host.showError(`Unknown slash command: /${String(name)}`);
144149
144965
  return;
144150
144966
  }
144151
144967
  }
144152
144968
  //#endregion
144153
- export { handleTitleCommand as $, isTodoItemShape as $t, highlightLines as A, CLI_UI_MODE as An, ENABLE_TERMINAL_FOCUS_REPORTING as At, AssistantMessageComponent as B, flushDiagnosticLogs as Bn, TERMINAL_THEME_LIGHT as Bt, UserMessageComponent as C, saveTuiConfig as Cn, createThemeStyles as Ct, ToolCallComponent as D, getLogDir as Dn, parseOsc11BackgroundTheme as Dt, toggleEmptySessionHint as E, getInputHistoryFile as En, detectTerminalTheme as Et, getSharedSpeedTracker as F, saveCatalogCache as Fn, OSC11_RESPONSE_PREFIX_NO_ESC as Ft, getBreathingFrame as G, ErrorCodes as Gn, handleSearchCommand as Gt, WelcomeComponent as H, resolveGlobalLogPath as Hn, isStreaming as Ht, SkillActivationComponent as I, NexumHarness as In, QUERY_TERMINAL_THEME as It, refineGoal as J, printableChar as Jt, resetBreathingClock as K, NEXUM_ERROR_INFO as Kn, handleConnectCommand as Kt, ReadGroupComponent as L, MCP_OAUTH_AUTHORIZATION_URL_TOOL_UPDATE as Ln, TERMINAL_FOCUS_IN as Lt, CachedContainer as M, PRODUCT_NAME as Mn, OSC11_QUERY as Mt, ThinkingComponent as N, DEFAULT_CATALOG_URL as Nn, OSC11_RESPONSE as Nt, renderDiffLines as O, detectInstallSource as On, DISABLE_TERMINAL_FOCUS_REPORTING as Ot, estimateTokens as P, fetchCatalog as Pn, OSC11_RESPONSE_PREFIX as Pt, handleInitCommand as Q, formatErrorMessage as Qt, parseReadGroupOutput as R, resolveNexumHome as Rn, TERMINAL_FOCUS_OUT as Rt, handleRevokeCommand as S, loadTuiConfig as Sn, createMarkdownTheme as St, isTurnElapsedEnabled as T, getDataDir as Tn, getColorPalette as Tt, NEXUM_CODE_LOGO as U, isNexumError as Un, FooterComponent as Ut, AgentGroupComponent as V, log as Vn, isBusy as Vt, BREATHE_CYCLE_MS as W, isOrphanedToolCallError as Wn, handleTraceCommand as Wt, handleExportMdCommand as X, appendStreamingArgsPreview as Xt, handleExportDebugZipCommand as Y, STATUS_BULLET as Yt, handleForkCommand as Z, argsRecord as Zt, readUpdateCache as _, setExperimentalFlags as _n, clearInfoPanelState as _t, handleSkillCommand as a, EXIT_CONFIRM_WINDOW_MS as an, handleEditorCommand as at, handleCcCommand as b, TuiConfigParseError as bn, resolveThemeSync as bt, isPlanExpandable as c, TIP_ROTATION_INTERVAL_MS as cn, handlePlanCommand as ct, handleMemoryCommand as d, getLlmNotSetMessage as dn, handleYoloCommand as dt, parseStreamingArgs as en, toTerminalHyperlink as et, handleChannelCommand as f, getNoActiveSessionMessage as fn, showModelPicker as ft, refreshUpdateCache as g, isExperimentalFlagEnabled as gn, supportsBalance as gt, selectUpdateTarget as h, sortSlashCommands as hn, refreshProviderBalance as ht, buildRoleAdditionalText as i, EMPTY_SESSION_HINT_URL as in, handleCompactCommand as it, langFromPath as j, CLI_USER_AGENT_PRODUCT as jn, ENABLE_TERMINAL_THEME_REPORTING as jt, renderDiffLinesClustered as k, CLI_COMMAND_NAME as kn, DISABLE_TERMINAL_THEME_REPORTING as kt, MoonLoader as l, getCtrlCHint as ln, handleThemeCommand as lt, handleUpdateCommand as m, BUILTIN_SLASH_COMMANDS as mn, showSettingsSelector as mt, clearEvalPanelState as n, stringValue as nn, getModelCycleLevel as nt, disposeChildren as o, MAIN_AGENT_ID$1 as on, handleFusionPlanCommand as ot, handleMcpCommand as p, buildSkillSlashCommands as pn, showPermissionPicker as pt, clearGoalState as q, handleLogoutCommand as qt, openUrl as r, truncateErrorMessage as rn, handleAutoCommand as rt, hasDispose as s, SESSION_TIPS as sn, handleModelCommand as st, dispatchInput as t, serializeToolResultOutput as tn, changeThinkingLevel as tt, formatMemoryMemoForInjection as u, getCtrlDHint as un, handleWolfpackCommand as ut, appendJsonlLine as v, PIXEL_PULSE_FRAMES as vn, showStatusReport as vt, isEmptySessionHintDismissed as w, detectShellEnvironment as wn, contrastTextHex as wt, getDaemonInstructions as x, TuiLikePreferencesSchema as xn, createEditorTheme as xt, readJsonlFile as y, PULSE_WAVE_FRAMES as yn, showUsage as yt, BackgroundAgentStatusComponent as z, MemoryMemoStore as zn, TERMINAL_THEME_DARK as zt };
144969
+ export { handleInitCommand as $, formatErrorMessage as $t, renderDiffLinesClustered as A, detectInstallSource as An, DISABLE_TERMINAL_THEME_REPORTING as At, BackgroundAgentStatusComponent as B, resolveNexumHome as Bn, TERMINAL_THEME_DARK as Bt, handleRevokeCommand as C, TuiLikePreferencesSchema as Cn, createMarkdownTheme as Ct, toggleEmptySessionHint as D, getDataDir as Dn, detectTerminalTheme as Dt, isTurnElapsedEnabled as E, detectShellEnvironment as En, getColorPalette as Et, estimateTokens as F, DEFAULT_CATALOG_URL as Fn, OSC11_RESPONSE_PREFIX as Ft, BREATHE_CYCLE_MS as G, isNexumError as Gn, handleTraceCommand as Gt, AgentGroupComponent as H, flushDiagnosticLogs as Hn, isBusy as Ht, getSharedSpeedTracker as I, fetchCatalog as In, OSC11_RESPONSE_PREFIX_NO_ESC as It, clearGoalState as J, NEXUM_ERROR_INFO as Jn, handleLogoutCommand as Jt, getBreathingFrame as K, isOrphanedToolCallError as Kn, handleSearchCommand as Kt, SkillActivationComponent as L, saveCatalogCache as Ln, QUERY_TERMINAL_THEME as Lt, langFromPath as M, CLI_UI_MODE as Mn, ENABLE_TERMINAL_THEME_REPORTING as Mt, CachedContainer as N, CLI_USER_AGENT_PRODUCT as Nn, OSC11_QUERY as Nt, ToolCallComponent as O, getInputHistoryFile as On, parseOsc11BackgroundTheme as Ot, ThinkingComponent as P, PRODUCT_NAME as Pn, OSC11_RESPONSE as Pt, handleForkCommand as Q, argsRecord as Qt, ReadGroupComponent as R, NexumHarness as Rn, TERMINAL_FOCUS_IN as Rt, getDaemonInstructions as S, TuiConfigParseError as Sn, createEditorTheme as St, isEmptySessionHintDismissed as T, saveTuiConfig as Tn, contrastTextHex as Tt, WelcomeComponent as U, log as Un, isStreaming as Ut, AssistantMessageComponent as V, MemoryMemoStore as Vn, TERMINAL_THEME_LIGHT as Vt, NEXUM_CODE_LOGO as W, resolveGlobalLogPath as Wn, FooterComponent as Wt, handleExportDebugZipCommand as X, STATUS_BULLET as Xt, refineGoal as Y, printableChar as Yt, handleExportMdCommand as Z, appendStreamingArgsPreview as Zt, refreshUpdateCache as _, sortSlashCommands as _n, supportsBalance as _t, handleExtensionCommand as a, CHARS_PER_TOKEN as an, handleCompactCommand as at, readJsonlFile as b, PIXEL_PULSE_FRAMES as bn, showUsage as bt, hasDispose as c, MAIN_AGENT_ID$1 as cn, handleModelCommand as ct, formatMemoryMemoForInjection as d, getCtrlCHint as dn, handleWolfpackCommand as dt, isTodoItemShape as en, handleTitleCommand as et, handleMemoryCommand as f, getCtrlDHint as fn, handleYoloCommand as ft, selectUpdateTarget as g, BUILTIN_SLASH_COMMANDS as gn, refreshProviderBalance as gt, handleUpdateCommand as h, buildSkillSlashCommands as hn, showSettingsSelector as ht, buildRoleAdditionalText as i, truncateErrorMessage as in, handleAutoCommand as it, highlightLines as j, CLI_COMMAND_NAME as jn, ENABLE_TERMINAL_FOCUS_REPORTING as jt, renderDiffLines as k, getLogDir as kn, DISABLE_TERMINAL_FOCUS_REPORTING as kt, isPlanExpandable as l, SESSION_TIPS as ln, handlePlanCommand as lt, handleMcpCommand as m, getNoActiveSessionMessage as mn, showPermissionPicker as mt, clearEvalPanelState as n, serializeToolResultOutput as nn, changeThinkingLevel as nt, handleSkillCommand as o, EMPTY_SESSION_HINT_URL as on, handleEditorCommand as ot, handleChannelCommand as p, getLlmNotSetMessage as pn, showModelPicker as pt, resetBreathingClock as q, ErrorCodes as qn, handleConnectCommand as qt, openUrl as r, stringValue as rn, getModelCycleLevel as rt, disposeChildren as s, EXIT_CONFIRM_WINDOW_MS as sn, handleFusionPlanCommand as st, dispatchInput as t, parseStreamingArgs as tn, toTerminalHyperlink as tt, MoonLoader as u, TIP_ROTATION_INTERVAL_MS as un, handleThemeCommand as ut, readUpdateCache as v, isExperimentalFlagEnabled as vn, clearInfoPanelState as vt, UserMessageComponent as w, loadTuiConfig as wn, createThemeStyles as wt, handleCcCommand as x, PULSE_WAVE_FRAMES as xn, resolveThemeSync as xt, appendJsonlLine as y, setExperimentalFlags as yn, showStatusReport as yt, parseReadGroupOutput as z, MCP_OAUTH_AUTHORIZATION_URL_TOOL_UPDATE as zn, TERMINAL_FOCUS_OUT as zt };