@moonshot-ai/kimi-code 0.24.0 → 0.24.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.
Files changed (68) hide show
  1. package/dist/main.mjs +627 -534
  2. package/dist-web/assets/{CodeBlockNode-CJ5S3jcL.js → CodeBlockNode--cMVMvaD.js} +1 -1
  3. package/dist-web/assets/{CodeBlockShell.vue_vue_type_style_index_0_lang-DUnzbdWv.js → CodeBlockShell.vue_vue_type_style_index_0_lang-DkL0l1V_.js} +1 -1
  4. package/dist-web/assets/{DesignSystemView-CNbvXMLA.js → DesignSystemView-GbzPebf3.js} +1 -1
  5. package/dist-web/assets/{Tooltip-CYfSKW77.js → Tooltip-Ck9N0lEl.js} +1 -1
  6. package/dist-web/assets/{arc-DM5w0UUk.js → arc-BWGqy2UA.js} +1 -1
  7. package/dist-web/assets/{architectureDiagram-3BPJPVTR-BJGCvcyq.js → architectureDiagram-3BPJPVTR-mUgmRLbZ.js} +1 -1
  8. package/dist-web/assets/{blockDiagram-GPEHLZMM-Ak3DV2hQ.js → blockDiagram-GPEHLZMM-R0PSMA9C.js} +1 -1
  9. package/dist-web/assets/{c4Diagram-AAUBKEIU-CXmo8JCq.js → c4Diagram-AAUBKEIU-CbRoqn4Y.js} +1 -1
  10. package/dist-web/assets/channel-Dkvx9pgo.js +1 -0
  11. package/dist-web/assets/{chunk-2J33WTMH-hsEGBMgQ.js → chunk-2J33WTMH-BgdbLCzY.js} +1 -1
  12. package/dist-web/assets/{chunk-4BX2VUAB-BuRXIxwX.js → chunk-4BX2VUAB-BjVqrZsb.js} +1 -1
  13. package/dist-web/assets/{chunk-55IACEB6-D36fUZmW.js → chunk-55IACEB6-vfTspjvT.js} +1 -1
  14. package/dist-web/assets/{chunk-727SXJPM-CSCtMBtG.js → chunk-727SXJPM-BOx5PWA4.js} +1 -1
  15. package/dist-web/assets/{chunk-AQP2D5EJ-CVmv6q-C.js → chunk-AQP2D5EJ-B1E9C4Td.js} +1 -1
  16. package/dist-web/assets/{chunk-FMBD7UC4-CH1uVWZS.js → chunk-FMBD7UC4-Df1Y6ISb.js} +1 -1
  17. package/dist-web/assets/{chunk-ND2GUHAM-BAsHVCmB.js → chunk-ND2GUHAM-Bez1HURS.js} +1 -1
  18. package/dist-web/assets/{chunk-QZHKN3VN-34z8roSX.js → chunk-QZHKN3VN-tkKX6Q71.js} +1 -1
  19. package/dist-web/assets/classDiagram-4FO5ZUOK-D2Bct7OK.js +1 -0
  20. package/dist-web/assets/classDiagram-v2-Q7XG4LA2-D2Bct7OK.js +1 -0
  21. package/dist-web/assets/{cose-bilkent-S5V4N54A-CZ3dL5vA.js → cose-bilkent-S5V4N54A-CJ2MVt0e.js} +1 -1
  22. package/dist-web/assets/{dagre-BM42HDAG-BFyCXAsK.js → dagre-BM42HDAG-OTtBLo46.js} +1 -1
  23. package/dist-web/assets/{diagram-2AECGRRQ-CrGQtKum.js → diagram-2AECGRRQ-XiNyaYnO.js} +1 -1
  24. package/dist-web/assets/{diagram-5GNKFQAL-DjrbO2YB.js → diagram-5GNKFQAL-BlIfSHzF.js} +1 -1
  25. package/dist-web/assets/{diagram-KO2AKTUF-BidfbUQS.js → diagram-KO2AKTUF-nsDPaMCq.js} +1 -1
  26. package/dist-web/assets/{diagram-LMA3HP47-DSb43eJz.js → diagram-LMA3HP47-Dzs1NlAK.js} +1 -1
  27. package/dist-web/assets/{diagram-OG6HWLK6-DbIEjLYd.js → diagram-OG6HWLK6-DS7pZXR7.js} +1 -1
  28. package/dist-web/assets/{erDiagram-TEJ5UH35-PqhrwUsN.js → erDiagram-TEJ5UH35-DVBSYJWC.js} +1 -1
  29. package/dist-web/assets/{flowDiagram-I6XJVG4X-B6Y_JEK9.js → flowDiagram-I6XJVG4X-BfI6v7Fm.js} +1 -1
  30. package/dist-web/assets/{ganttDiagram-6RSMTGT7-Bgzb2wCP.js → ganttDiagram-6RSMTGT7-DeQxHXH6.js} +1 -1
  31. package/dist-web/assets/{gitGraphDiagram-PVQCEYII-BuPKv8u1.js → gitGraphDiagram-PVQCEYII-AwCWO2qH.js} +1 -1
  32. package/dist-web/assets/{index-DKUtUfyZ.js → index-4XDR0dLV.js} +1 -1
  33. package/dist-web/assets/index-DILMH5vD.js +325 -0
  34. package/dist-web/assets/{index-CXANJOpJ.js → index-bBT3xvAJ.js} +2 -2
  35. package/dist-web/assets/{index-BRLKiXrx.css → index-fzG0L2x7.css} +1 -1
  36. package/dist-web/assets/{index10-geSt3mfj.js → index10-CEkQu_GO.js} +1 -1
  37. package/dist-web/assets/{index11-j-uBECZt.js → index11-CQsnWOL1.js} +1 -1
  38. package/dist-web/assets/{index5-C-Vgz62s.js → index5-D3mN0q-1.js} +1 -1
  39. package/dist-web/assets/{index6-CyOQc7vf.js → index6-X2_QEqKR.js} +1 -1
  40. package/dist-web/assets/{index7-BsqLagLn.js → index7-DwTyDXWL.js} +1 -1
  41. package/dist-web/assets/{index8-CmPghiWh.js → index8-DVszZ_QU.js} +2 -2
  42. package/dist-web/assets/{infoDiagram-5YYISTIA-DIshBg7O.js → infoDiagram-5YYISTIA-DcvFupZ9.js} +1 -1
  43. package/dist-web/assets/{ishikawaDiagram-YF4QCWOH-COkhNYqM.js → ishikawaDiagram-YF4QCWOH-Dr_9jlZ2.js} +1 -1
  44. package/dist-web/assets/{journeyDiagram-JHISSGLW-ChCikam8.js → journeyDiagram-JHISSGLW-B8Bl1l7f.js} +1 -1
  45. package/dist-web/assets/{kanban-definition-UN3LZRKU-Tpr3y2G7.js → kanban-definition-UN3LZRKU-DEsZeBp1.js} +1 -1
  46. package/dist-web/assets/{linear-B4vx9XxZ.js → linear-D1XVpWDR.js} +1 -1
  47. package/dist-web/assets/{mermaid.core-BuL5LAnc.js → mermaid.core-BkZly3Xv.js} +4 -4
  48. package/dist-web/assets/{mindmap-definition-RKZ34NQL-DXOpYlyO.js → mindmap-definition-RKZ34NQL-Bna83V-D.js} +1 -1
  49. package/dist-web/assets/{pieDiagram-4H26LBE5-BLbISlhP.js → pieDiagram-4H26LBE5-Cam9RjI7.js} +1 -1
  50. package/dist-web/assets/{quadrantDiagram-W4KKPZXB-C0112avZ.js → quadrantDiagram-W4KKPZXB-oC9ccOFM.js} +1 -1
  51. package/dist-web/assets/{requirementDiagram-4Y6WPE33-BNFdetqm.js → requirementDiagram-4Y6WPE33-DfFS2yCW.js} +1 -1
  52. package/dist-web/assets/{sankeyDiagram-5OEKKPKP-CcgvE5-p.js → sankeyDiagram-5OEKKPKP-BVdOnz7E.js} +1 -1
  53. package/dist-web/assets/{sequenceDiagram-3UESZ5HK-BvIw4dCy.js → sequenceDiagram-3UESZ5HK-Dru_zABA.js} +1 -1
  54. package/dist-web/assets/{stateDiagram-AJRCARHV-B3aH9w2s.js → stateDiagram-AJRCARHV-CkaDYGbg.js} +1 -1
  55. package/dist-web/assets/stateDiagram-v2-BHNVJYJU-BZhwJEM-.js +1 -0
  56. package/dist-web/assets/{timeline-definition-PNZ67QCA-DoZdpZ4G.js → timeline-definition-PNZ67QCA-CcLLZupA.js} +1 -1
  57. package/dist-web/assets/{vennDiagram-CIIHVFJN-9XQhhQFt.js → vennDiagram-CIIHVFJN-DJuDAa8E.js} +1 -1
  58. package/dist-web/assets/{vue.runtime.esm-bundler-DvsjYmbL.js → vue.runtime.esm-bundler-D8_2k_mF.js} +1 -1
  59. package/dist-web/assets/{wardley-L42UT6IY-DlNxrTF5.js → wardley-L42UT6IY-CDHFB4H4.js} +1 -1
  60. package/dist-web/assets/{wardleyDiagram-YWT4CUSO-Cb8vH0kt.js → wardleyDiagram-YWT4CUSO-D5_Z1oK0.js} +1 -1
  61. package/dist-web/assets/{xychartDiagram-2RQKCTM6-Bmi9SOWb.js → xychartDiagram-2RQKCTM6-CFW74y_e.js} +1 -1
  62. package/dist-web/index.html +2 -2
  63. package/package.json +6 -6
  64. package/dist-web/assets/channel-bC8DwGBL.js +0 -1
  65. package/dist-web/assets/classDiagram-4FO5ZUOK-Cgnn_8I-.js +0 -1
  66. package/dist-web/assets/classDiagram-v2-Q7XG4LA2-Cgnn_8I-.js +0 -1
  67. package/dist-web/assets/index-CkGmgp0_.js +0 -325
  68. package/dist-web/assets/stateDiagram-v2-BHNVJYJU-Bx0mCnl0.js +0 -1
package/dist/main.mjs CHANGED
@@ -5,8 +5,8 @@ const __filename = __cjsShimFileURLToPath(import.meta.url);
5
5
  const __dirname = __cjsShimDirname(__filename);
6
6
  import { createRequire } from "node:module";
7
7
  import crypto$1, { createHash, randomBytes, randomInt, randomUUID, timingSafeEqual } from "node:crypto";
8
- import * as fs$16 from "node:fs";
9
- import Vt, { accessSync, appendFileSync, chmodSync, closeSync, constants, copyFileSync, createReadStream, createWriteStream, existsSync, fsyncSync, mkdirSync, openSync, promises, readFileSync, readSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
8
+ import * as fs$17 from "node:fs";
9
+ import fs, { accessSync, appendFileSync, chmodSync, closeSync, constants, copyFileSync, createReadStream, createWriteStream, existsSync, fsyncSync, mkdirSync, openSync, promises, readFileSync, readSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
10
10
  import * as path$15 from "node:path";
11
11
  import path, { basename, dirname, extname, isAbsolute, join, normalize, posix, relative, resolve, sep, win32 } from "node:path";
12
12
  import { spawn } from "child_process";
@@ -30,14 +30,14 @@ import net, { createServer as createServer$2, isIP } from "node:net";
30
30
  import Kr, { EventEmitter } from "events";
31
31
  import * as path$1$1 from "path";
32
32
  import path$1, { basename as basename$1, dirname as dirname$1, join as join$1, parse } from "path";
33
- import * as fs$17 from "fs/promises";
33
+ import * as fs$18 from "fs/promises";
34
34
  import { lstat, open, readdir, realpath, stat as stat$1, writeFile } from "fs/promises";
35
35
  import { finished, pipeline as pipeline$1 } from "node:stream/promises";
36
36
  import * as ks from "zlib";
37
37
  import qr from "zlib";
38
38
  import * as nodeOs from "node:os";
39
39
  import os, { arch, cpus, freemem, homedir as homedir$1, hostname, loadavg, networkInterfaces, platform, release, tmpdir, totalmem, type as type$1, userInfo } from "node:os";
40
- import fs, { access, appendFile, chmod, copyFile, cp, lstat as lstat$1, mkdir, mkdtemp, open as open$1, readFile, readdir as readdir$1, realpath as realpath$1, rename, rm, stat as stat$2, unlink, utimes, writeFile as writeFile$1 } from "node:fs/promises";
40
+ import fs$1, { access, appendFile, chmod, copyFile, cp, lstat as lstat$1, mkdir, mkdtemp, open as open$1, readFile, readdir as readdir$1, realpath as realpath$1, rename, rm, stat as stat$2, unlink, utimes, writeFile as writeFile$1 } from "node:fs/promises";
41
41
  import { execFile, execFileSync, execSync, spawn as spawn$1, spawnSync } from "node:child_process";
42
42
  import * as posixPath from "node:path/posix";
43
43
  import * as win32Path from "node:path/win32";
@@ -1140,6 +1140,15 @@ function classifyBaseApiError$1(message) {
1140
1140
  if (NETWORK_RE$3.test(message)) return new APIConnectionError$4(message);
1141
1141
  return new ChatProviderError$1(`Error: ${message}`);
1142
1142
  }
1143
+ function appendThinkingEffortConfigHint$1(statusCode, message) {
1144
+ if (statusCode !== 400 && statusCode !== 422) return message;
1145
+ const lowerMessage = message.toLowerCase();
1146
+ if (!THINKING_EFFORT_STATUS_MESSAGE_PATTERNS$1.some((pattern) => pattern.test(lowerMessage))) return message;
1147
+ if (message.includes(THINKING_EFFORT_CONFIG_DOCS_URL$2)) return message;
1148
+ return `${message}
1149
+
1150
+ The provider rejected the configured thinking effort. Non-Kimi providers receive effort strings without client-side mapping; choose an effort supported by the selected model. For Kimi models, check support_efforts and default_effort. See ${THINKING_EFFORT_CONFIG_DOCS_URL$2}`;
1151
+ }
1143
1152
  function isContextOverflowErrorCode$1(code) {
1144
1153
  return code === "context_length_exceeded";
1145
1154
  }
@@ -1147,7 +1156,7 @@ function normalizeAPIStatusError$1(statusCode, message, requestId, retryAfterMs)
1147
1156
  if (statusCode === 429) return new APIProviderRateLimitError$1(message, requestId, retryAfterMs);
1148
1157
  if (isContextOverflowStatusError$1(statusCode, message)) return new APIContextOverflowError$1(statusCode, message, requestId, retryAfterMs);
1149
1158
  if (isRequestTooLargeStatusError$1(statusCode, message)) return new APIRequestTooLargeError$1(statusCode, message, requestId, retryAfterMs);
1150
- return new APIStatusError$1(statusCode, message, requestId, retryAfterMs);
1159
+ return new APIStatusError$1(statusCode, appendThinkingEffortConfigHint$1(statusCode, message), requestId, retryAfterMs);
1151
1160
  }
1152
1161
  /**
1153
1162
  * Parse a `retry-after` response header into milliseconds. Only integer
@@ -1213,7 +1222,7 @@ function getStatusCode$1(error) {
1213
1222
  function errorMessage$14(error) {
1214
1223
  return error instanceof Error ? error.message : String(error);
1215
1224
  }
1216
- var ChatProviderError$1, APIConnectionError$4, APITimeoutError$1, APIStatusError$1, APIContextOverflowError$1, APIRequestTooLargeError$1, APIProviderRateLimitError$1, APIEmptyResponseError$1, IMAGE_FORMAT_PROVIDER_MESSAGE_PATTERNS$1, IMAGE_FORMAT_STATUS_MESSAGE_PATTERNS$1, MEDIA_TYPE_FIELD_PATTERN$1, NETWORK_RE$3, TIMEOUT_RE$3, CONTEXT_OVERFLOW_MESSAGE_PATTERNS$1, PROVIDER_RATE_LIMIT_MESSAGE_PATTERNS$1, REQUEST_TOO_LARGE_MESSAGE_PATTERNS$1, TOOL_EXCHANGE_ADJACENCY_MESSAGE_PATTERNS$1, STRUCTURAL_REQUEST_MESSAGE_PATTERNS$1;
1225
+ var ChatProviderError$1, APIConnectionError$4, APITimeoutError$1, APIStatusError$1, APIContextOverflowError$1, APIRequestTooLargeError$1, APIProviderRateLimitError$1, APIEmptyResponseError$1, IMAGE_FORMAT_PROVIDER_MESSAGE_PATTERNS$1, IMAGE_FORMAT_STATUS_MESSAGE_PATTERNS$1, MEDIA_TYPE_FIELD_PATTERN$1, NETWORK_RE$3, TIMEOUT_RE$3, CONTEXT_OVERFLOW_MESSAGE_PATTERNS$1, PROVIDER_RATE_LIMIT_MESSAGE_PATTERNS$1, REQUEST_TOO_LARGE_MESSAGE_PATTERNS$1, THINKING_EFFORT_CONFIG_DOCS_URL$2, THINKING_EFFORT_STATUS_MESSAGE_PATTERNS$1, TOOL_EXCHANGE_ADJACENCY_MESSAGE_PATTERNS$1, STRUCTURAL_REQUEST_MESSAGE_PATTERNS$1;
1217
1226
  var init_errors$39 = __esmMin((() => {
1218
1227
  ChatProviderError$1 = class extends Error {
1219
1228
  constructor(message) {
@@ -1319,6 +1328,14 @@ var init_errors$39 = __esmMin((() => {
1319
1328
  /content too large/,
1320
1329
  /request (?:body )?too large/
1321
1330
  ];
1331
+ THINKING_EFFORT_CONFIG_DOCS_URL$2 = "https://moonshotai.github.io/kimi-code/en/configuration/config-files.html#thinking";
1332
+ THINKING_EFFORT_STATUS_MESSAGE_PATTERNS$1 = [
1333
+ /reasoning[_ .-]?effort/,
1334
+ /thinking[_ .-]?effort/,
1335
+ /output_config[\s\S]*effort/,
1336
+ /unsupported[\s\S]*effort/,
1337
+ /invalid[\s\S]*effort/
1338
+ ];
1322
1339
  TOOL_EXCHANGE_ADJACENCY_MESSAGE_PATTERNS$1 = [
1323
1340
  /tool_use[\s\S]*tool_result/,
1324
1341
  /tool_result[\s\S]*tool_use/,
@@ -9454,15 +9471,6 @@ function resolveDefaultMaxTokens$1(model, override) {
9454
9471
  if (ceiling === void 0) return override ?? FALLBACK_MAX_TOKENS$1;
9455
9472
  return override === void 0 ? ceiling : Math.min(override, ceiling);
9456
9473
  }
9457
- function parseVersion$1(match) {
9458
- const majorRaw = match[1];
9459
- const minorRaw = match[2];
9460
- if (majorRaw === void 0 || minorRaw === void 0) throw new Error("Model version regex did not capture major and minor versions.");
9461
- return {
9462
- major: Number.parseInt(majorRaw, 10),
9463
- minor: Number.parseInt(minorRaw, 10)
9464
- };
9465
- }
9466
9474
  function versionAtLeast$1(version, minimum) {
9467
9475
  return version.major > minimum.major || version.major === minimum.major && version.minor >= minimum.minor;
9468
9476
  }
@@ -9474,12 +9482,6 @@ function supportsAdaptiveThinking$1(model) {
9474
9482
  minor: version.minor ?? 0
9475
9483
  }, ADAPTIVE_MIN_VERSION$1);
9476
9484
  }
9477
- function isOpus47$1(model) {
9478
- const match = OPUS_VERSION_RE$1.exec(model.toLowerCase());
9479
- if (match === null) return false;
9480
- const version = parseVersion$1(match);
9481
- return version.major === 4 && version.minor === 7;
9482
- }
9483
9485
  function isFableModel$1(model) {
9484
9486
  return parseClaudeAliasVersion$1(model)?.family === "fable";
9485
9487
  }
@@ -9488,23 +9490,14 @@ function supportsEffortParam$1(model, adaptive) {
9488
9490
  const normalized = model.toLowerCase();
9489
9491
  return normalized.includes("opus-4-5") || normalized.includes("opus-4.5");
9490
9492
  }
9491
- function clampEffort$1(effort, model, adaptive) {
9492
- if (effort === "off") return effort;
9493
- if (effort === "xhigh" && !isOpus47$1(model) && !isFableModel$1(model)) return "high";
9494
- if (effort === "max" && !adaptive) return "high";
9495
- if (effort !== "low" && effort !== "medium" && effort !== "high" && effort !== "xhigh" && effort !== "max") return "high";
9496
- return effort;
9497
- }
9498
9493
  function budgetTokensForEffort$1(effort) {
9499
9494
  switch (effort) {
9500
9495
  case "low": return 1024;
9501
9496
  case "medium": return 4096;
9497
+ case "on":
9502
9498
  case "high": return 32e3;
9503
- case "off":
9504
- case "xhigh":
9505
- case "max": throw new Error(`Unsupported budget-based thinking effort: ${effort}`);
9499
+ default: throw new Error(`Anthropic budget-based thinking cannot express effort "${effort}". Use low, medium, or high, or configure an adaptive / effort-param-capable model. See ${THINKING_EFFORT_CONFIG_DOCS_URL$1}`);
9506
9500
  }
9507
- throw new Error(`Unknown thinking effort: ${String(effort)}`);
9508
9501
  }
9509
9502
  function shouldPreserveUnsignedThinking$1(model) {
9510
9503
  return parseClaudeAliasVersion$1(model) === null;
@@ -9682,7 +9675,7 @@ function convertAnthropicError$1(error) {
9682
9675
  if (error instanceof Error) return classifyBaseApiError$1(error.message);
9683
9676
  return new ChatProviderError$1(`Error: ${String(error)}`);
9684
9677
  }
9685
- var INTERLEAVED_THINKING_BETA$1, CONTEXT_MANAGEMENT_BETA$1, CLEAR_THINKING_EDIT$1, OPUS_VERSION_RE$1, ADAPTIVE_MIN_VERSION$1, ANTHROPIC_TOOL_CALL_ID_POLICY$1, CEILING_BY_FAMILY_VERSION$1, FALLBACK_MAX_TOKENS$1, FAMILY_FIRST_RE$1, VERSION_FIRST_RE$1, BARE_FAMILY_RE$1, CACHE_CONTROL$1, CACHEABLE_TYPES$1, OMITTED_MEDIA_PLACEHOLDER$1, SUPPORTED_B64_MEDIA_TYPES$1, SUPPORTED_B64_VIDEO_TYPES$1, AnthropicStreamedMessage$1, AnthropicChatProvider$1;
9678
+ var INTERLEAVED_THINKING_BETA$1, CONTEXT_MANAGEMENT_BETA$1, CLEAR_THINKING_EDIT$1, ADAPTIVE_MIN_VERSION$1, THINKING_EFFORT_CONFIG_DOCS_URL$1, ANTHROPIC_TOOL_CALL_ID_POLICY$1, CEILING_BY_FAMILY_VERSION$1, FALLBACK_MAX_TOKENS$1, FAMILY_FIRST_RE$1, VERSION_FIRST_RE$1, BARE_FAMILY_RE$1, CACHE_CONTROL$1, CACHEABLE_TYPES$1, OMITTED_MEDIA_PLACEHOLDER$1, SUPPORTED_B64_MEDIA_TYPES$1, SUPPORTED_B64_VIDEO_TYPES$1, AnthropicStreamedMessage$1, AnthropicChatProvider$1;
9686
9679
  var init_anthropic$1 = __esmMin((() => {
9687
9680
  init_errors$39();
9688
9681
  init_message$4();
@@ -9693,11 +9686,11 @@ var init_anthropic$1 = __esmMin((() => {
9693
9686
  INTERLEAVED_THINKING_BETA$1 = "interleaved-thinking-2025-05-14";
9694
9687
  CONTEXT_MANAGEMENT_BETA$1 = "context-management-2025-06-27";
9695
9688
  CLEAR_THINKING_EDIT$1 = "clear_thinking_20251015";
9696
- OPUS_VERSION_RE$1 = /opus[.-](\d+)[.-](\d{1,2})(?!\d)/;
9697
9689
  ADAPTIVE_MIN_VERSION$1 = {
9698
9690
  major: 4,
9699
9691
  minor: 6
9700
9692
  };
9693
+ THINKING_EFFORT_CONFIG_DOCS_URL$1 = "https://moonshotai.github.io/kimi-code/en/configuration/config-files.html#thinking";
9701
9694
  ANTHROPIC_TOOL_CALL_ID_POLICY$1 = {
9702
9695
  normalize: (id) => sanitizeToolCallId$1(id, 64),
9703
9696
  maxLength: 64
@@ -9955,6 +9948,7 @@ var init_anthropic$1 = __esmMin((() => {
9955
9948
  _defaultHeaders;
9956
9949
  _clientFactory;
9957
9950
  _adaptiveThinking;
9951
+ _kimiThinking;
9958
9952
  _betaApi;
9959
9953
  _explicitMaxTokens;
9960
9954
  constructor(options) {
@@ -9962,6 +9956,7 @@ var init_anthropic$1 = __esmMin((() => {
9962
9956
  this._stream = options.stream ?? true;
9963
9957
  this._metadata = options.metadata;
9964
9958
  this._adaptiveThinking = options.adaptiveThinking;
9959
+ this._kimiThinking = options.kimiThinking ?? false;
9965
9960
  this._betaApi = options.betaApi ?? false;
9966
9961
  this._apiKey = options.apiKey === void 0 || options.apiKey.length === 0 ? void 0 : options.apiKey;
9967
9962
  this._baseUrl = options.baseUrl;
@@ -9978,21 +9973,14 @@ var init_anthropic$1 = __esmMin((() => {
9978
9973
  return this._model;
9979
9974
  }
9980
9975
  get thinkingEffort() {
9981
- const thinkingConfig = this._generationKwargs.thinking;
9982
- if (thinkingConfig === void 0 || thinkingConfig === null) return null;
9983
- if (thinkingConfig.type === "disabled") return "off";
9984
- if (thinkingConfig.type === "adaptive") {
9985
- const effort = this._generationKwargs.output_config?.effort;
9986
- if (effort === void 0 || effort === null) return "high";
9987
- switch (effort) {
9988
- case "low":
9989
- case "medium":
9990
- case "high":
9991
- case "xhigh":
9992
- case "max": return effort;
9993
- }
9994
- }
9995
- const budget = thinkingConfig.budget_tokens ?? 0;
9976
+ const thinking = this._generationKwargs.thinking;
9977
+ if (thinking === void 0 || thinking === null) return null;
9978
+ if (thinking.type === "disabled") return "off";
9979
+ const effort = this._generationKwargs.output_config?.effort;
9980
+ if (typeof effort === "string" && effort.length > 0) return effort;
9981
+ if (thinking.type === "adaptive") return "on";
9982
+ const budget = thinking.budget_tokens;
9983
+ if (budget === void 0) return "on";
9996
9984
  if (budget <= 1024) return "low";
9997
9985
  if (budget <= 4096) return "medium";
9998
9986
  return "high";
@@ -10115,42 +10103,33 @@ var init_anthropic$1 = __esmMin((() => {
10115
10103
  }
10116
10104
  withThinking(effort) {
10117
10105
  const adaptive = this._adaptiveThinking ?? supportsAdaptiveThinking$1(this._model);
10118
- if (effort === "off") {
10119
- let newBetas = [...this._generationKwargs.betaFeatures ?? []];
10120
- if (adaptive) newBetas = newBetas.filter((b) => b !== INTERLEAVED_THINKING_BETA$1);
10121
- const clone = this._withGenerationKwargs({
10122
- thinking: { type: "disabled" },
10123
- betaFeatures: newBetas
10124
- });
10125
- delete clone._generationKwargs.output_config;
10126
- return clone;
10106
+ let thinking;
10107
+ let outputConfig;
10108
+ if (effort === "off") thinking = { type: "disabled" };
10109
+ else if (this._kimiThinking) {
10110
+ thinking = { type: "enabled" };
10111
+ outputConfig = effort === "on" ? void 0 : { effort };
10112
+ } else if (adaptive) {
10113
+ thinking = {
10114
+ type: "adaptive",
10115
+ display: "summarized"
10116
+ };
10117
+ outputConfig = effort === "on" ? void 0 : { effort };
10118
+ } else {
10119
+ thinking = {
10120
+ type: "enabled",
10121
+ budget_tokens: budgetTokensForEffort$1(effort)
10122
+ };
10123
+ outputConfig = supportsEffortParam$1(this._model, adaptive) && effort !== "on" ? { effort } : void 0;
10127
10124
  }
10128
- const clamped = clampEffort$1(effort, this._model, adaptive);
10129
- if (clamped === "off") throw new Error("Non-off thinking effort unexpectedly clamped to off.");
10130
- const effectiveEffort = clamped;
10131
10125
  let newBetas = [...this._generationKwargs.betaFeatures ?? []];
10132
- if (adaptive) {
10133
- newBetas = newBetas.filter((b) => b !== INTERLEAVED_THINKING_BETA$1);
10134
- return this._withGenerationKwargs({
10135
- thinking: {
10136
- type: "adaptive",
10137
- display: "summarized"
10138
- },
10139
- output_config: { effort: effectiveEffort },
10140
- betaFeatures: newBetas
10141
- });
10142
- }
10143
- const kwargs = {
10144
- thinking: {
10145
- type: "enabled",
10146
- budget_tokens: budgetTokensForEffort$1(effectiveEffort)
10147
- },
10126
+ if (adaptive) newBetas = newBetas.filter((b) => b !== INTERLEAVED_THINKING_BETA$1);
10127
+ const clone = this._withGenerationKwargs({
10128
+ thinking,
10148
10129
  betaFeatures: newBetas
10149
- };
10150
- if (supportsEffortParam$1(this._model, adaptive)) kwargs.output_config = { effort: effectiveEffort };
10151
- else kwargs.output_config = void 0;
10152
- const clone = this._withGenerationKwargs(kwargs);
10153
- if (!supportsEffortParam$1(this._model, adaptive)) delete clone._generationKwargs.output_config;
10130
+ });
10131
+ if (outputConfig !== void 0) clone._generationKwargs.output_config = outputConfig;
10132
+ else delete clone._generationKwargs.output_config;
10154
10133
  return clone;
10155
10134
  }
10156
10135
  withThinkingKeep(keep) {
@@ -20967,7 +20946,7 @@ var require_util$10 = /* @__PURE__ */ __commonJSMin(((exports) => {
20967
20946
  exports.removeUndefinedValuesInObject = removeUndefinedValuesInObject;
20968
20947
  exports.isValidFile = isValidFile;
20969
20948
  exports.getWellKnownCertificateConfigFileLocation = getWellKnownCertificateConfigFileLocation;
20970
- const fs$23 = __require("fs");
20949
+ const fs$24 = __require("fs");
20971
20950
  const os$7 = __require("os");
20972
20951
  const path$20 = __require("path");
20973
20952
  const WELL_KNOWN_CERTIFICATE_CONFIG_FILE = "certificate_config.json";
@@ -21087,7 +21066,7 @@ var require_util$10 = /* @__PURE__ */ __commonJSMin(((exports) => {
21087
21066
  */
21088
21067
  async function isValidFile(filePath) {
21089
21068
  try {
21090
- return (await fs$23.promises.lstat(filePath)).isFile();
21069
+ return (await fs$24.promises.lstat(filePath)).isFile();
21091
21070
  } catch (e) {
21092
21071
  return false;
21093
21072
  }
@@ -22801,10 +22780,10 @@ var require_getCredentials = /* @__PURE__ */ __commonJSMin(((exports) => {
22801
22780
  Object.defineProperty(exports, "__esModule", { value: true });
22802
22781
  exports.getCredentials = getCredentials;
22803
22782
  const path$19 = __require("path");
22804
- const fs$22 = __require("fs");
22783
+ const fs$23 = __require("fs");
22805
22784
  const util_1$1 = __require("util");
22806
22785
  const errorWithCode_1 = require_errorWithCode();
22807
- const readFile = fs$22.readFile ? (0, util_1$1.promisify)(fs$22.readFile) : async () => {
22786
+ const readFile = fs$23.readFile ? (0, util_1$1.promisify)(fs$23.readFile) : async () => {
22808
22787
  throw new errorWithCode_1.ErrorWithCode("use key rather than keyFile.", "MISSING_CREDENTIALS");
22809
22788
  };
22810
22789
  var ExtensionFiles;
@@ -24352,10 +24331,10 @@ var require_filesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((exports)
24352
24331
  Object.defineProperty(exports, "__esModule", { value: true });
24353
24332
  exports.FileSubjectTokenSupplier = void 0;
24354
24333
  const util_1 = __require("util");
24355
- const fs$21 = __require("fs");
24356
- const readFile = (0, util_1.promisify)(fs$21.readFile ?? (() => {}));
24357
- const realpath = (0, util_1.promisify)(fs$21.realpath ?? (() => {}));
24358
- const lstat = (0, util_1.promisify)(fs$21.lstat ?? (() => {}));
24334
+ const fs$22 = __require("fs");
24335
+ const readFile = (0, util_1.promisify)(fs$22.readFile ?? (() => {}));
24336
+ const realpath = (0, util_1.promisify)(fs$22.realpath ?? (() => {}));
24337
+ const lstat = (0, util_1.promisify)(fs$22.lstat ?? (() => {}));
24359
24338
  /**
24360
24339
  * Internal subject token supplier implementation used when a file location
24361
24340
  * is configured in the credential configuration used to build an {@link IdentityPoolClient}
@@ -24457,7 +24436,7 @@ var require_certificatesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((ex
24457
24436
  Object.defineProperty(exports, "__esModule", { value: true });
24458
24437
  exports.CertificateSubjectTokenSupplier = exports.InvalidConfigurationError = exports.CertificateSourceUnavailableError = exports.CERTIFICATE_CONFIGURATION_ENV_VARIABLE = void 0;
24459
24438
  const util_1 = require_util$10();
24460
- const fs$20 = __require("fs");
24439
+ const fs$21 = __require("fs");
24461
24440
  const crypto_1 = __require("crypto");
24462
24441
  const https$3 = __require("https");
24463
24442
  exports.CERTIFICATE_CONFIGURATION_ENV_VARIABLE = "GOOGLE_API_CERTIFICATE_CONFIG";
@@ -24552,7 +24531,7 @@ var require_certificatesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((ex
24552
24531
  const configPath = this.certificateConfigPath;
24553
24532
  let fileContents;
24554
24533
  try {
24555
- fileContents = await fs$20.promises.readFile(configPath, "utf8");
24534
+ fileContents = await fs$21.promises.readFile(configPath, "utf8");
24556
24535
  } catch (err) {
24557
24536
  throw new CertificateSourceUnavailableError(`Failed to read certificate config file at: ${configPath}`);
24558
24537
  }
@@ -24577,13 +24556,13 @@ var require_certificatesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((ex
24577
24556
  async #getKeyAndCert(certPath, keyPath) {
24578
24557
  let cert, key;
24579
24558
  try {
24580
- cert = await fs$20.promises.readFile(certPath);
24559
+ cert = await fs$21.promises.readFile(certPath);
24581
24560
  new crypto_1.X509Certificate(cert);
24582
24561
  } catch (err) {
24583
24562
  throw new CertificateSourceUnavailableError(`Failed to read certificate file at ${certPath}: ${err instanceof Error ? err.message : String(err)}`);
24584
24563
  }
24585
24564
  try {
24586
- key = await fs$20.promises.readFile(keyPath);
24565
+ key = await fs$21.promises.readFile(keyPath);
24587
24566
  (0, crypto_1.createPrivateKey)(key);
24588
24567
  } catch (err) {
24589
24568
  throw new CertificateSourceUnavailableError(`Failed to read private key file at ${keyPath}: ${err instanceof Error ? err.message : String(err)}`);
@@ -24602,7 +24581,7 @@ var require_certificatesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((ex
24602
24581
  const leafCert = new crypto_1.X509Certificate(leafCertBuffer);
24603
24582
  if (!this.trustChainPath) return JSON.stringify([leafCert.raw.toString("base64")]);
24604
24583
  try {
24605
- const chainCerts = ((await fs$20.promises.readFile(this.trustChainPath, "utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g) ?? []).map((pem, index) => {
24584
+ const chainCerts = ((await fs$21.promises.readFile(this.trustChainPath, "utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g) ?? []).map((pem, index) => {
24606
24585
  try {
24607
24586
  return new crypto_1.X509Certificate(pem);
24608
24587
  } catch (err) {
@@ -25263,7 +25242,7 @@ var require_pluggable_auth_handler = /* @__PURE__ */ __commonJSMin(((exports) =>
25263
25242
  exports.PluggableAuthHandler = exports.ExecutableError = void 0;
25264
25243
  const executable_response_1 = require_executable_response();
25265
25244
  const childProcess$1 = __require("child_process");
25266
- const fs$19 = __require("fs");
25245
+ const fs$20 = __require("fs");
25267
25246
  /**
25268
25247
  * Error thrown from the executable run by PluggableAuthClient.
25269
25248
  */
@@ -25340,12 +25319,12 @@ var require_pluggable_auth_handler = /* @__PURE__ */ __commonJSMin(((exports) =>
25340
25319
  if (!this.outputFile || this.outputFile.length === 0) return;
25341
25320
  let filePath;
25342
25321
  try {
25343
- filePath = await fs$19.promises.realpath(this.outputFile);
25322
+ filePath = await fs$20.promises.realpath(this.outputFile);
25344
25323
  } catch {
25345
25324
  return;
25346
25325
  }
25347
- if (!(await fs$19.promises.lstat(filePath)).isFile()) return;
25348
- const responseString = await fs$19.promises.readFile(filePath, { encoding: "utf8" });
25326
+ if (!(await fs$20.promises.lstat(filePath)).isFile()) return;
25327
+ const responseString = await fs$20.promises.readFile(filePath, { encoding: "utf8" });
25349
25328
  if (responseString === "") return;
25350
25329
  try {
25351
25330
  const responseJson = JSON.parse(responseString);
@@ -25767,7 +25746,7 @@ var require_googleauth = /* @__PURE__ */ __commonJSMin(((exports) => {
25767
25746
  Object.defineProperty(exports, "__esModule", { value: true });
25768
25747
  exports.GoogleAuth = exports.GoogleAuthExceptionMessages = void 0;
25769
25748
  const child_process_1 = __require("child_process");
25770
- const fs$18 = __require("fs");
25749
+ const fs$19 = __require("fs");
25771
25750
  const gaxios_1 = require_src$4();
25772
25751
  const gcpMetadata = require_src$2();
25773
25752
  const os$6 = __require("os");
@@ -26015,7 +25994,7 @@ var require_googleauth = /* @__PURE__ */ __commonJSMin(((exports) => {
26015
25994
  }
26016
25995
  if (location) {
26017
25996
  location = path$18.join(location, "gcloud", "application_default_credentials.json");
26018
- if (!fs$18.existsSync(location)) location = null;
25997
+ if (!fs$19.existsSync(location)) location = null;
26019
25998
  }
26020
25999
  if (!location) return null;
26021
26000
  return await this._getApplicationCredentialsFromFilePath(location, options);
@@ -26029,13 +26008,13 @@ var require_googleauth = /* @__PURE__ */ __commonJSMin(((exports) => {
26029
26008
  async _getApplicationCredentialsFromFilePath(filePath, options = {}) {
26030
26009
  if (!filePath || filePath.length === 0) throw new Error("The file path is invalid.");
26031
26010
  try {
26032
- filePath = fs$18.realpathSync(filePath);
26033
- if (!fs$18.lstatSync(filePath).isFile()) throw new Error();
26011
+ filePath = fs$19.realpathSync(filePath);
26012
+ if (!fs$19.lstatSync(filePath).isFile()) throw new Error();
26034
26013
  } catch (err) {
26035
26014
  if (err instanceof Error) err.message = `The file at ${filePath} does not exist, or it is not a file. ${err.message}`;
26036
26015
  throw err;
26037
26016
  }
26038
- const readStream = fs$18.createReadStream(filePath);
26017
+ const readStream = fs$19.createReadStream(filePath);
26039
26018
  return this.fromStream(readStream, options);
26040
26019
  }
26041
26020
  /**
@@ -26302,7 +26281,7 @@ var require_googleauth = /* @__PURE__ */ __commonJSMin(((exports) => {
26302
26281
  if (this.jsonContent) return this._cacheClientFromJSON(this.jsonContent, this.clientOptions);
26303
26282
  else if (this.keyFilename) {
26304
26283
  const filePath = path$18.resolve(this.keyFilename);
26305
- const stream = fs$18.createReadStream(filePath);
26284
+ const stream = fs$19.createReadStream(filePath);
26306
26285
  return await this.fromStreamAsync(stream, this.clientOptions);
26307
26286
  } else if (this.apiKey) {
26308
26287
  const client = await this.fromAPIKey(this.apiKey, this.clientOptions);
@@ -44615,7 +44594,7 @@ var init_node$6 = __esmMin((() => {
44615
44594
  type: void 0
44616
44595
  };
44617
44596
  if (typeof file === "string") {
44618
- fileStat.size = (await fs$17.stat(file)).size;
44597
+ fileStat.size = (await fs$18.stat(file)).size;
44619
44598
  fileStat.type = this.inferMimeType(file);
44620
44599
  return fileStat;
44621
44600
  } else return await getBlobStat(file);
@@ -44747,7 +44726,7 @@ var init_node$6 = __esmMin((() => {
44747
44726
  let fileHandle;
44748
44727
  const fileName = path$1$1.basename(file);
44749
44728
  try {
44750
- fileHandle = await fs$17.open(file, "r");
44729
+ fileHandle = await fs$18.open(file, "r");
44751
44730
  if (!fileHandle) throw new Error(`Failed to open file`);
44752
44731
  fileSize = (await fileHandle.stat()).size;
44753
44732
  while (offset < fileSize) {
@@ -53296,36 +53275,6 @@ function isFunctionToolCall$1(tc) {
53296
53275
  return tc.type === "function";
53297
53276
  }
53298
53277
  /**
53299
- * Map kosong `ThinkingEffort` to OpenAI `reasoning_effort` string.
53300
- */
53301
- function thinkingEffortToReasoningEffort$1(effort) {
53302
- switch (effort) {
53303
- case "off": return;
53304
- case "low": return "low";
53305
- case "medium": return "medium";
53306
- case "high": return "high";
53307
- case "xhigh":
53308
- case "max": return "xhigh";
53309
- default: return;
53310
- }
53311
- }
53312
- /**
53313
- * Map OpenAI `reasoning_effort` string back to kosong `ThinkingEffort`.
53314
- */
53315
- function reasoningEffortToThinkingEffort$1(reasoning) {
53316
- if (reasoning === void 0 || reasoning === null) return null;
53317
- switch (reasoning) {
53318
- case "low":
53319
- case "minimal": return "low";
53320
- case "medium": return "medium";
53321
- case "high": return "high";
53322
- case "xhigh":
53323
- case "max": return "xhigh";
53324
- case "none": return "off";
53325
- default: return "off";
53326
- }
53327
- }
53328
- /**
53329
53278
  * Extract `TokenUsage` from an OpenAI-compatible usage object.
53330
53279
  */
53331
53280
  function extractUsage$1(usage) {
@@ -53468,11 +53417,11 @@ var init_kimi_files$1 = __esmMin((() => {
53468
53417
  async uploadVideo(input, options) {
53469
53418
  let file;
53470
53419
  if (typeof input === "string") {
53471
- if (!fs$16.existsSync(input)) throw new ChatProviderError$1(`Video file not found: ${input}`);
53420
+ if (!fs$17.existsSync(input)) throw new ChatProviderError$1(`Video file not found: ${input}`);
53472
53421
  const filename = path$15.basename(input);
53473
53422
  const mimeType = guessMimeTypeFromExt$1(filename);
53474
53423
  if (mimeType === void 0 || !mimeType.startsWith("video/")) throw new ChatProviderError$1(`KimiFiles.uploadVideo: file extension does not indicate a video type: ${filename}`);
53475
- const data = await fs$16.promises.readFile(input);
53424
+ const data = await fs$17.promises.readFile(input);
53476
53425
  file = new File$1([new Blob$1([new Uint8Array(data)], { type: mimeType })], filename, { type: mimeType });
53477
53426
  } else {
53478
53427
  if (!input.mimeType.startsWith("video/")) throw new ChatProviderError$1(`Expected a video mime type, got ${input.mimeType}`);
@@ -53593,7 +53542,7 @@ function isEffectivelyEmptyContent$1(parts) {
53593
53542
  }
53594
53543
  return true;
53595
53544
  }
53596
- function convertMessage$6(message) {
53545
+ function convertMessage$6(message, preservedThinkingEnabled) {
53597
53546
  let reasoningContent = "";
53598
53547
  let hasReasoningPart = false;
53599
53548
  const nonThinkParts = [];
@@ -53622,7 +53571,7 @@ function convertMessage$6(message) {
53622
53571
  return mapped;
53623
53572
  });
53624
53573
  if (message.toolCallId !== void 0) result.tool_call_id = message.toolCallId;
53625
- if (hasReasoningPart) result.reasoning_content = reasoningContent;
53574
+ if (hasReasoningPart || preservedThinkingEnabled && message.role === "assistant") result.reasoning_content = reasoningContent;
53626
53575
  if (message.tools !== void 0 && message.tools.length > 0) result.tools = message.tools.map((tool) => convertTool$4(tool));
53627
53576
  return result;
53628
53577
  }
@@ -53778,7 +53727,6 @@ var init_kimi$1 = __esmMin((() => {
53778
53727
  _baseUrl;
53779
53728
  _defaultHeaders;
53780
53729
  _generationKwargs;
53781
- _supportEfforts;
53782
53730
  _client;
53783
53731
  _clientFactory;
53784
53732
  _files;
@@ -53791,7 +53739,6 @@ var init_kimi$1 = __esmMin((() => {
53791
53739
  this._model = options.model;
53792
53740
  this._stream = options.stream ?? true;
53793
53741
  this._generationKwargs = { ...options.generationKwargs };
53794
- this._supportEfforts = options.supportEfforts ?? [];
53795
53742
  this._client = this._apiKey === void 0 ? void 0 : new OpenAI({
53796
53743
  apiKey: this._apiKey,
53797
53744
  baseURL: this._baseUrl,
@@ -53839,8 +53786,10 @@ var init_kimi$1 = __esmMin((() => {
53839
53786
  role: "system",
53840
53787
  content: systemPrompt
53841
53788
  });
53789
+ const thinking = this._generationKwargs.extra_body?.thinking;
53790
+ const preservedThinkingEnabled = thinking?.keep === "all" && thinking.type !== "disabled";
53842
53791
  const normalizedHistory = normalizeToolCallIdsForProvider$1(history, KIMI_TOOL_CALL_ID_POLICY$1);
53843
- for (const msg of normalizedHistory) messages.push(convertMessage$6(msg));
53792
+ for (const msg of normalizedHistory) messages.push(convertMessage$6(msg, preservedThinkingEnabled));
53844
53793
  const kwargs = { ...this._generationKwargs };
53845
53794
  for (const key of Object.keys(kwargs)) if (kwargs[key] === void 0) delete kwargs[key];
53846
53795
  if (kwargs["max_completion_tokens"] === void 0 && kwargs["max_tokens"] !== void 0) kwargs["max_completion_tokens"] = kwargs["max_tokens"];
@@ -53867,10 +53816,10 @@ var init_kimi$1 = __esmMin((() => {
53867
53816
  withThinking(effort) {
53868
53817
  let thinking;
53869
53818
  if (effort === "off") thinking = { type: "disabled" };
53870
- else thinking = this._supportEfforts.includes(effort) ? {
53819
+ else thinking = effort === "on" ? { type: "enabled" } : {
53871
53820
  type: "enabled",
53872
53821
  effort
53873
- } : { type: "enabled" };
53822
+ };
53874
53823
  const oldExtra = this._generationKwargs.extra_body ?? {};
53875
53824
  const keep = oldExtra.thinking?.keep;
53876
53825
  if (keep !== void 0) thinking = {
@@ -54193,7 +54142,8 @@ var init_openai_legacy$1 = __esmMin((() => {
54193
54142
  return this._model;
54194
54143
  }
54195
54144
  get thinkingEffort() {
54196
- return reasoningEffortToThinkingEffort$1(this._reasoningEffort);
54145
+ if (this._reasoningEffort === void 0) return null;
54146
+ return this._reasoningEffort === "none" ? "off" : this._reasoningEffort;
54197
54147
  }
54198
54148
  get modelParameters() {
54199
54149
  return {
@@ -54235,7 +54185,7 @@ var init_openai_legacy$1 = __esmMin((() => {
54235
54185
  }
54236
54186
  }
54237
54187
  withThinking(effort) {
54238
- const reasoningEffort = thinkingEffortToReasoningEffort$1(effort);
54188
+ const reasoningEffort = effort === "off" || effort === "on" ? void 0 : effort;
54239
54189
  const clone = this._clone();
54240
54190
  clone._reasoningEffort = reasoningEffort;
54241
54191
  return clone;
@@ -54959,7 +54909,9 @@ var init_openai_responses$1 = __esmMin((() => {
54959
54909
  return this._model;
54960
54910
  }
54961
54911
  get thinkingEffort() {
54962
- return reasoningEffortToThinkingEffort$1(this._generationKwargs.reasoning_effort);
54912
+ const effort = this._generationKwargs.reasoning_effort;
54913
+ if (effort === void 0) return null;
54914
+ return effort === "none" ? "off" : effort;
54963
54915
  }
54964
54916
  get modelParameters() {
54965
54917
  return {
@@ -55006,7 +54958,7 @@ var init_openai_responses$1 = __esmMin((() => {
55006
54958
  }
55007
54959
  }
55008
54960
  withThinking(effort) {
55009
- const reasoningEffort = thinkingEffortToReasoningEffort$1(effort);
54961
+ const reasoningEffort = effort === "off" || effort === "on" ? void 0 : effort;
55010
54962
  const clone = this._clone();
55011
54963
  clone._generationKwargs = {
55012
54964
  ...clone._generationKwargs,
@@ -62631,7 +62583,7 @@ async function syncDir$2(dirPath) {
62631
62583
  */
62632
62584
  function syncFd$1(fd) {
62633
62585
  return new Promise((resolve, reject) => {
62634
- fs$16.fsync(fd, (err) => {
62586
+ fs$17.fsync(fd, (err) => {
62635
62587
  if (err) {
62636
62588
  reject(err);
62637
62589
  return;
@@ -76115,7 +76067,7 @@ var require_gifframe = /* @__PURE__ */ __commonJSMin(((exports) => {
76115
76067
  //#region ../../node_modules/.pnpm/gifwrap@0.10.1/node_modules/gifwrap/src/gifutil.js
76116
76068
  var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
76117
76069
  /** @namespace GifUtil */
76118
- const fs$15 = __require("fs");
76070
+ const fs$16 = __require("fs");
76119
76071
  const ImageQ = require_image_q();
76120
76072
  const BitmapImage = require_bitmapimage();
76121
76073
  const { GifFrame } = require_gifframe();
@@ -76382,7 +76334,7 @@ var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
76382
76334
  }
76383
76335
  function _readBinary(path) {
76384
76336
  return new Promise((resolve, reject) => {
76385
- fs$15.readFile(path, (err, buffer) => {
76337
+ fs$16.readFile(path, (err, buffer) => {
76386
76338
  if (err) return reject(err);
76387
76339
  return resolve(buffer);
76388
76340
  });
@@ -76390,7 +76342,7 @@ var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
76390
76342
  }
76391
76343
  function _writeBinary(path, buffer) {
76392
76344
  return new Promise((resolve, reject) => {
76393
- fs$15.writeFile(path, buffer, (err) => {
76345
+ fs$16.writeFile(path, buffer, (err) => {
76394
76346
  if (err) return reject(err);
76395
76347
  return resolve();
76396
76348
  });
@@ -101384,7 +101336,7 @@ var init_file_type$1 = __esmMin((() => {
101384
101336
  }
101385
101337
  async fromFile(path) {
101386
101338
  this.options.signal?.throwIfAborted();
101387
- const fileHandle = await fs.open(path, constants.O_RDONLY | constants.O_NONBLOCK);
101339
+ const fileHandle = await fs$1.open(path, constants.O_RDONLY | constants.O_NONBLOCK);
101388
101340
  const fileStat = await fileHandle.stat();
101389
101341
  if (!fileStat.isFile()) {
101390
101342
  await fileHandle.close();
@@ -118435,7 +118387,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
118435
118387
  };
118436
118388
  return _setPrototypeOf(o, p);
118437
118389
  }
118438
- var fs$14 = __require("fs");
118390
+ var fs$15 = __require("fs");
118439
118391
  var path$13 = __require("path");
118440
118392
  var Loader = require_loader();
118441
118393
  var PrecompiledLoader = require_precompiled_loader().PrecompiledLoader;
@@ -118459,7 +118411,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
118459
118411
  } catch (e) {
118460
118412
  throw new Error("watch requires chokidar to be installed");
118461
118413
  }
118462
- var paths = _this.searchPaths.filter(fs$14.existsSync);
118414
+ var paths = _this.searchPaths.filter(fs$15.existsSync);
118463
118415
  var watcher = chokidar.watch(paths);
118464
118416
  watcher.on("all", function(event, fullname) {
118465
118417
  fullname = path$13.resolve(fullname);
@@ -118478,7 +118430,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
118478
118430
  for (var i = 0; i < paths.length; i++) {
118479
118431
  var basePath = path$13.resolve(paths[i]);
118480
118432
  var p = path$13.resolve(paths[i], name);
118481
- if (p.indexOf(basePath) === 0 && fs$14.existsSync(p)) {
118433
+ if (p.indexOf(basePath) === 0 && fs$15.existsSync(p)) {
118482
118434
  fullpath = p;
118483
118435
  break;
118484
118436
  }
@@ -118486,7 +118438,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
118486
118438
  if (!fullpath) return null;
118487
118439
  this.pathsToNames[fullpath] = name;
118488
118440
  var source = {
118489
- src: fs$14.readFileSync(fullpath, "utf-8"),
118441
+ src: fs$15.readFileSync(fullpath, "utf-8"),
118490
118442
  path: fullpath,
118491
118443
  noCache: this.noCache
118492
118444
  };
@@ -118534,7 +118486,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
118534
118486
  }
118535
118487
  this.pathsToNames[fullpath] = name;
118536
118488
  var source = {
118537
- src: fs$14.readFileSync(fullpath, "utf-8"),
118489
+ src: fs$15.readFileSync(fullpath, "utf-8"),
118538
118490
  path: fullpath,
118539
118491
  noCache: this.noCache
118540
118492
  };
@@ -119278,7 +119230,7 @@ var require_precompile_global = /* @__PURE__ */ __commonJSMin(((exports, module)
119278
119230
  //#endregion
119279
119231
  //#region ../../node_modules/.pnpm/nunjucks@3.2.4_chokidar@4.0.3/node_modules/nunjucks/src/precompile.js
119280
119232
  var require_precompile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
119281
- var fs$13 = __require("fs");
119233
+ var fs$14 = __require("fs");
119282
119234
  var path$11 = __require("path");
119283
119235
  var _prettifyError = require_lib$5()._prettifyError;
119284
119236
  var compiler = require_compiler();
@@ -119303,27 +119255,27 @@ var require_precompile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
119303
119255
  var env = opts.env || new Environment([]);
119304
119256
  var wrapper = opts.wrapper || precompileGlobal;
119305
119257
  if (opts.isString) return precompileString(input, opts);
119306
- var pathStats = fs$13.existsSync(input) && fs$13.statSync(input);
119258
+ var pathStats = fs$14.existsSync(input) && fs$14.statSync(input);
119307
119259
  var precompiled = [];
119308
119260
  var templates = [];
119309
119261
  function addTemplates(dir) {
119310
- fs$13.readdirSync(dir).forEach(function(file) {
119262
+ fs$14.readdirSync(dir).forEach(function(file) {
119311
119263
  var filepath = path$11.join(dir, file);
119312
119264
  var subpath = filepath.substr(path$11.join(input, "/").length);
119313
- var stat = fs$13.statSync(filepath);
119265
+ var stat = fs$14.statSync(filepath);
119314
119266
  if (stat && stat.isDirectory()) {
119315
119267
  subpath += "/";
119316
119268
  if (!match(subpath, opts.exclude)) addTemplates(filepath);
119317
119269
  } else if (match(subpath, opts.include)) templates.push(filepath);
119318
119270
  });
119319
119271
  }
119320
- if (pathStats.isFile()) precompiled.push(_precompile(fs$13.readFileSync(input, "utf-8"), opts.name || input, env));
119272
+ if (pathStats.isFile()) precompiled.push(_precompile(fs$14.readFileSync(input, "utf-8"), opts.name || input, env));
119321
119273
  else if (pathStats.isDirectory()) {
119322
119274
  addTemplates(input);
119323
119275
  for (var i = 0; i < templates.length; i++) {
119324
119276
  var name = templates[i].replace(path$11.join(input, "/"), "");
119325
119277
  try {
119326
- precompiled.push(_precompile(fs$13.readFileSync(templates[i], "utf-8"), name, env));
119278
+ precompiled.push(_precompile(fs$14.readFileSync(templates[i], "utf-8"), name, env));
119327
119279
  } catch (e) {
119328
119280
  if (opts.force) console.error(e);
119329
119281
  else throw e;
@@ -123903,20 +123855,17 @@ function applyKimiEnvSamplingParams(provider, env = process.env) {
123903
123855
  return Object.keys(kwargs).length > 0 ? provider.withGenerationKwargs(kwargs) : provider;
123904
123856
  }
123905
123857
  /**
123906
- * Force a specific thinking effort via `KIMI_MODEL_THINKING_EFFORT`, bypassing
123907
- * the model's declared `support_efforts`. Applied in `ConfigState.provider`
123908
- * after `withThinking`, and only while thinking is on — effort has no meaning
123909
- * when thinking is disabled. The value is forwarded verbatim as
123910
- * `thinking.effort`, so callers can target a model that accepts an effort but
123911
- * does not advertise one via `support_efforts`.
123858
+ * Resolve the operational `KIMI_MODEL_THINKING_EFFORT` override after the
123859
+ * model-aware effort has been resolved. The override intentionally bypasses
123860
+ * `support_efforts`, but cannot turn Thinking on after the user disabled it.
123912
123861
  *
123913
- * Non-Kimi providers — and an unset/blank value — are returned unchanged.
123862
+ * Provider identity is supplied separately from the wire adapter so a Kimi
123863
+ * provider routed through the Anthropic protocol still receives Kimi semantics.
123914
123864
  */
123915
- function applyKimiEnvThinkingEffort(provider, thinkingEffort, env = process.env) {
123916
- if (!(provider instanceof KimiChatProvider$1)) return provider;
123865
+ function resolveKimiEnvThinkingEffort(thinkingEffort, kimiProvider, env = process.env) {
123866
+ if (!kimiProvider || thinkingEffort === "off") return void 0;
123917
123867
  const effort = env["KIMI_MODEL_THINKING_EFFORT"]?.trim();
123918
- if (effort === void 0 || effort.length === 0 || thinkingEffort === "off") return provider;
123919
- return provider.withExtraBody({ thinking: { effort } });
123868
+ return effort === void 0 || effort.length === 0 ? void 0 : effort;
123920
123869
  }
123921
123870
  /**
123922
123871
  * Parse a single keep source (env var or config field). A blank value is
@@ -124008,6 +123957,9 @@ function supportsThinking(model) {
124008
123957
  function middleOf$1(efforts) {
124009
123958
  return efforts[Math.floor(efforts.length / 2)];
124010
123959
  }
123960
+ function effortsFor$1(model) {
123961
+ return (model === void 0 ? void 0 : effectiveModelAlias(model))?.supportEfforts?.filter((effort) => effort.length > 0) ?? [];
123962
+ }
124011
123963
  /**
124012
123964
  * Resolve the default thinking effort for a model from its declared metadata:
124013
123965
  * - models that do not support thinking (or an unknown model) -> `'off'`
@@ -124021,10 +123973,30 @@ function middleOf$1(efforts) {
124021
123973
  function defaultThinkingEffortFor$1(model) {
124022
123974
  const effective = model === void 0 ? void 0 : effectiveModelAlias(model);
124023
123975
  if (!supportsThinking(effective)) return "off";
124024
- const efforts = effective?.supportEfforts;
124025
- if (efforts !== void 0 && efforts.length > 0) return effective?.defaultEffort ?? middleOf$1(efforts);
123976
+ const efforts = effortsFor$1(effective);
123977
+ if (efforts.length > 0) {
123978
+ const declaredDefault = effective?.defaultEffort;
123979
+ return declaredDefault !== void 0 && efforts.includes(declaredDefault) ? declaredDefault : middleOf$1(efforts);
123980
+ }
124026
123981
  return "on";
124027
123982
  }
123983
+ function supportsThinkingEffort$1(effort, model, kimiProvider) {
123984
+ if (!kimiProvider || effort === "off") return true;
123985
+ const effective = model === void 0 ? void 0 : effectiveModelAlias(model);
123986
+ if (!supportsThinking(effective)) return false;
123987
+ const efforts = effortsFor$1(effective);
123988
+ return efforts.length === 0 || effort === "on" || efforts.includes(effort);
123989
+ }
123990
+ function normalizeThinkingEffortForModel$1(effort, model, kimiProvider) {
123991
+ const effective = model === void 0 ? void 0 : effectiveModelAlias(model);
123992
+ if (effort === "off" && effective?.capabilities?.includes("always_thinking") !== true) return "off";
123993
+ const efforts = effortsFor$1(effective);
123994
+ if (!kimiProvider) return effort === "on" && efforts.length > 0 ? defaultThinkingEffortFor$1(effective) : effort;
123995
+ if (!supportsThinking(effective)) return "off";
123996
+ if (efforts.length === 0) return "on";
123997
+ if (effort === "on" || !efforts.includes(effort)) return defaultThinkingEffortFor$1(effective);
123998
+ return effort;
123999
+ }
124028
124000
  /**
124029
124001
  * Resolve the effective thinking effort for a session.
124030
124002
  *
@@ -124037,14 +124009,14 @@ function defaultThinkingEffortFor$1(model) {
124037
124009
  * model declares `always_thinking`, an `'off'` result is clamped back to the
124038
124010
  * model's default effort so thinking can never be disabled for it.
124039
124011
  */
124040
- function resolveThinkingEffort$1(requested, config, model) {
124012
+ function resolveThinkingEffort$1(requested, config, model, kimiProvider = false) {
124041
124013
  const effectiveModel = model === void 0 ? void 0 : effectiveModelAlias(model);
124042
124014
  let effort;
124043
124015
  if (requested !== void 0) effort = requested;
124044
124016
  else if (config?.enabled === false) effort = "off";
124045
124017
  else effort = config?.effort ?? defaultThinkingEffortFor$1(effectiveModel);
124046
124018
  if (effort === "off" && effectiveModel?.capabilities?.includes("always_thinking") === true) effort = config?.effort ?? defaultThinkingEffortFor$1(effectiveModel);
124047
- return effort;
124019
+ return normalizeThinkingEffortForModel$1(effort, effectiveModel, kimiProvider);
124048
124020
  }
124049
124021
  var init_thinking$3 = __esmMin((() => {
124050
124022
  init_config$8();
@@ -124066,6 +124038,7 @@ var init_config$7 = __esmMin((() => {
124066
124038
  _cwd;
124067
124039
  _modelAlias;
124068
124040
  _profileName;
124041
+ _unforcedThinkingEffort = "off";
124069
124042
  _thinkingEffort = "off";
124070
124043
  _systemPrompt = "";
124071
124044
  constructor(agent) {
@@ -124075,13 +124048,26 @@ var init_config$7 = __esmMin((() => {
124075
124048
  }
124076
124049
  update(changed) {
124077
124050
  if (Object.keys(changed).length === 0) return;
124051
+ const targetAlias = changed.modelAlias ?? this._modelAlias;
124052
+ const targetProvider = this.tryResolvedProviderConfigFor(targetAlias);
124053
+ const targetModel = this.modelForThinking(targetAlias, targetProvider);
124054
+ const kimiProvider = targetProvider?.type === "kimi";
124055
+ let unforcedThinkingEffort;
124056
+ let thinkingEffort;
124057
+ if (changed.thinkingEffort !== void 0) unforcedThinkingEffort = resolveThinkingEffort$1(changed.thinkingEffort, this.agent.kimiConfig?.thinking, targetModel, kimiProvider);
124058
+ else if (changed.modelAlias !== void 0) unforcedThinkingEffort = resolveThinkingEffort$1(this._modelAlias === void 0 ? void 0 : this._unforcedThinkingEffort, this.agent.kimiConfig?.thinking, targetModel, kimiProvider);
124059
+ if (unforcedThinkingEffort !== void 0) thinkingEffort = resolveKimiEnvThinkingEffort(unforcedThinkingEffort, kimiProvider) ?? unforcedThinkingEffort;
124060
+ const effectiveChanged = thinkingEffort === void 0 ? changed : {
124061
+ ...changed,
124062
+ thinkingEffort
124063
+ };
124078
124064
  this.agent.records.logRecord({
124079
124065
  type: "config.update",
124080
- ...changed
124066
+ ...effectiveChanged
124081
124067
  });
124082
124068
  this.agent.replayBuilder.push({
124083
124069
  type: "config_updated",
124084
- config: changed
124070
+ config: effectiveChanged
124085
124071
  });
124086
124072
  if (changed.cwd) {
124087
124073
  this._cwd = changed.cwd;
@@ -124089,11 +124075,22 @@ var init_config$7 = __esmMin((() => {
124089
124075
  }
124090
124076
  if (changed.modelAlias) this._modelAlias = changed.modelAlias;
124091
124077
  if (changed.profileName) this._profileName = changed.profileName;
124092
- if (changed.thinkingEffort !== void 0) this._thinkingEffort = resolveThinkingEffort$1(changed.thinkingEffort, this.agent.kimiConfig?.thinking, this.currentModel);
124093
- else if (changed.modelAlias !== void 0) this._thinkingEffort = resolveThinkingEffort$1(this._thinkingEffort, this.agent.kimiConfig?.thinking, this.currentModel);
124078
+ if (unforcedThinkingEffort !== void 0 && thinkingEffort !== void 0) {
124079
+ this._unforcedThinkingEffort = unforcedThinkingEffort;
124080
+ this._thinkingEffort = thinkingEffort;
124081
+ }
124094
124082
  if (changed.systemPrompt !== void 0) this._systemPrompt = changed.systemPrompt;
124095
124083
  if (this.hasProvider && (changed.cwd !== void 0 || changed.modelAlias)) this.agent.tools.initializeBuiltinTools();
124096
- this.agent.emitStatusUpdated();
124084
+ this.agent.emitStatusUpdated(thinkingEffort !== void 0);
124085
+ }
124086
+ setThinkingEffort(effort) {
124087
+ const model = this.currentModel;
124088
+ if (!supportsThinkingEffort$1(effort, model, this.tryResolvedProviderConfig()?.type === "kimi")) {
124089
+ const efforts = model?.supportEfforts ?? [];
124090
+ const supported = efforts.length === 0 ? "off" : ["off", ...efforts].join(", ");
124091
+ throw new KimiError(ErrorCodes$1.MODEL_CONFIG_INVALID, `Thinking effort "${effort}" is not supported by model "${this.modelAlias}". Supported efforts: ${supported}.`);
124092
+ }
124093
+ this.update({ thinkingEffort: effort });
124097
124094
  }
124098
124095
  data() {
124099
124096
  const resolved = this.tryResolvedProviderConfig();
@@ -124122,9 +124119,9 @@ var init_config$7 = __esmMin((() => {
124122
124119
  return provider;
124123
124120
  }
124124
124121
  get provider() {
124125
- const withEffort = applyKimiEnvThinkingEffort(applyKimiEnvSamplingParams(createProvider$1(this.providerConfig).withThinking(this.thinkingEffort)), this.thinkingEffort);
124122
+ const withSampling = applyKimiEnvSamplingParams(createProvider$1(this.providerConfig).withThinking(this.thinkingEffort));
124126
124123
  const configKeep = this.agent.kimiConfig?.thinking?.keep;
124127
- return applyAnthropicThinkingKeep(applyKimiEnvThinkingKeep(withEffort, this.thinkingEffort, void 0, configKeep), this.thinkingEffort, void 0, configKeep);
124124
+ return applyAnthropicThinkingKeep(applyKimiEnvThinkingKeep(withSampling, this.thinkingEffort, void 0, configKeep), this.thinkingEffort, void 0, configKeep);
124128
124125
  }
124129
124126
  get model() {
124130
124127
  if (this._modelAlias === void 0) throw new KimiError(ErrorCodes$1.MODEL_NOT_CONFIGURED, "Model not set");
@@ -124137,9 +124134,22 @@ var init_config$7 = __esmMin((() => {
124137
124134
  return this._thinkingEffort;
124138
124135
  }
124139
124136
  get currentModel() {
124140
- const alias = this._modelAlias;
124141
- if (alias === void 0) return void 0;
124142
- return this.agent.kimiConfig?.models?.[alias];
124137
+ const resolved = this.tryResolvedProviderConfig();
124138
+ return this.modelForThinking(this._modelAlias, resolved);
124139
+ }
124140
+ modelForThinking(alias, resolved) {
124141
+ if (resolved !== void 0) {
124142
+ const capabilities = resolved.alwaysThinking ? ["always_thinking"] : resolved.modelCapabilities.thinking ? ["thinking"] : [];
124143
+ return {
124144
+ provider: resolved.providerName,
124145
+ model: resolved.provider.model,
124146
+ maxContextSize: Math.max(resolved.modelCapabilities.max_context_tokens, 1),
124147
+ capabilities,
124148
+ supportEfforts: resolved.supportEfforts === void 0 ? void 0 : [...resolved.supportEfforts],
124149
+ defaultEffort: resolved.defaultEffort
124150
+ };
124151
+ }
124152
+ return alias === void 0 ? void 0 : this.agent.kimiConfig?.models?.[alias];
124143
124153
  }
124144
124154
  get profileName() {
124145
124155
  return this._profileName;
@@ -124158,8 +124168,11 @@ var init_config$7 = __esmMin((() => {
124158
124168
  return this.agent.modelProvider?.resolveProviderConfig(this._modelAlias);
124159
124169
  }
124160
124170
  tryResolvedProviderConfig() {
124171
+ return this.tryResolvedProviderConfigFor(this._modelAlias);
124172
+ }
124173
+ tryResolvedProviderConfigFor(alias) {
124161
124174
  try {
124162
- return this.resolvedProviderConfig;
124175
+ return alias === void 0 ? void 0 : this.agent.modelProvider?.resolveProviderConfig(alias);
124163
124176
  } catch {
124164
124177
  return;
124165
124178
  }
@@ -139480,6 +139493,7 @@ var init_events$3 = __esmMin((() => {
139480
139493
  agentStatusUpdatedEventSchema = object({
139481
139494
  type: literal("agent.status.updated"),
139482
139495
  model: string().optional(),
139496
+ thinkingEffort: string().optional(),
139483
139497
  contextTokens: number$1().optional(),
139484
139498
  maxContextTokens: number$1().optional(),
139485
139499
  contextUsage: number$1().optional(),
@@ -147197,7 +147211,7 @@ function Pn(s, t) {
147197
147211
  function zn(s, t) {
147198
147212
  s.head = new ue$1(t, void 0, s.head, s), s.tail || (s.tail = s.head), s.length++;
147199
147213
  }
147200
- var kr, vr, Os, Br, Pr, zr, q$1, j$1, rt$1, Le$1, jt, Ne$1, Ts, Ae$1, xs, z$1, Mt, b$1, Qt, Bt, _$1, A$1, g$1, yi, De$1, L$1, w$1, Ri, bi, Ls, _i, Z$1, gi, Ie$1, Jt$1, yt, C, te, Ur, Hr, Wr, Gr, Ce$1, Oi, Zr, Yr, D$1, Vr, ot, H$1, ee$1, m$1, xi, J$1, Li, Ii, Ci, se$1, Fe$1, Ut$1, Ht, Ni, Pt, ht, U$1, nt$1, Y$1, zt, Ai, Q$1, ie$1, Di, ke$1, Rt, ve$1, bt, _t, Me, tt$1, Wt$1, $r, As, Ds, Is, Cs, Fs, Xr, re, K$1, jr, M$1, Qr, vs, Jr, ki, Ot, Gt, vi, ne, Be$1, Pe$1, ze$1, Ue, He$1, We$1, Ge$1, Ze$1, Ye$1, Ms, en, sn, Bs, rn, nn, Ps, zs, Bi, oe$1, hn, he$1, Ke$1, F$1, an, Tt, Pi, ln, at, cn, fn, dn, lt, un, mn, pn, zi, En, xt, ct, Sn, yn, Rn, f, Yt$1, Lt, gn, Zi, Yi, On, B$1, Nt, et$1, Ui, Us, V$1, ae$1, ft, Hs, p, it, dt, Hi, At, y$1, Ve$1, $e$1, Wi, Ws, Gs, le$1, Gi, Xe$1, Kt$1, ut, qe$1, Dt, je$1, Qe$1, Zs, Tn, st$1, mt, Nn, Ki, An, Dn, It, Vi, Cn, Ys, ce$1, Je$1, $i, Fn, kn, Xi, Ks, Js, vn, Xs, qs, js, ji, Qs, fe$1, ti, Qi, ei, Ji, ts, es, is$2, pt, ii, ss, qi, X$1, de$1, si, ri, Mn, ni, ue$1, di, tr, oi, me$1, W$1, Ct, Ft$1, pe$2, rs, G, ns, hi, er, as, ls, ai, li, ir, os$5, ci, rr, hs, Et, kt, Un, Hn, or, hr, Wn, Gn, fr, dr, ar, ur, mr, pr, Kn, Vn, $n, lr, cs, fs$12, ui, Xn, ds, qn, us, we$1, wt, Qn, Er, ms, wr, Jn, Sr, ps, yr, $t, Rr, eo, io, Ei, _r, gr, ys, Or, Rs, P$2, bs, _s, Si, Tr, xr, ye$1, Lr, Nr, Es, St, O$1, wi, Ar, Xt$1, ws, Ss, gs, Re, be, _e$1, ge$1, Oe$1, no, oo, ho, Dr, qt, Se$1, Te$1, ao, lo, co, fo, uo, mo, po, Eo, vt, So;
147214
+ var kr, vr, Os, Br, Pr, zr, q$1, j$1, rt$1, Le$1, jt, Ne$1, Ts, Ae$1, xs, z$1, Mt, b$1, Qt, Bt, _$1, A$1, g$1, yi, De$1, L$1, w$1, Ri, bi, Ls, _i, Z$1, gi, Ie$1, Jt$1, yt, C, te, Ur, Hr, Wr, Gr, Ce$1, Oi, Zr, Yr, D$1, Vr, ot, H$1, ee$1, m$1, xi, J$1, Li, Ii, Ci, se$1, Fe$1, Ut$1, Ht, Ni, Pt, ht, U$1, nt$1, Y$1, zt, Ai, Q$1, ie$1, Di, ke$1, Rt, ve$1, bt, _t, Me, tt$1, Wt$1, $r, As, Ds, Is, Cs, Fs, Xr, re, K$1, jr, M$1, Qr, vs, Jr, ki, Ot, Gt, vi, ne, Be$1, Pe$1, ze$1, Ue, He$1, We$1, Ge$1, Ze$1, Ye$1, Ms, en, sn, Bs, rn, nn, Ps, zs, Bi, oe$1, hn, he$1, Ke$1, F$1, an, Tt, Pi, ln, at, cn, fn, dn, lt, un, mn, pn, zi, En, xt, ct, Sn, yn, Rn, f, Yt$1, Lt, gn, Zi, Yi, On, B$1, Nt, et$1, Ui, Us, V$1, ae$1, ft, Hs, p, it, dt, Hi, At, y$1, Ve$1, $e$1, Wi, Ws, Gs, le$1, Gi, Xe$1, Kt$1, ut, qe$1, Dt, je$1, Qe$1, Zs, Tn, st$1, mt, Nn, Ki, An, Dn, It, Vi, Cn, Ys, ce$1, Je$1, $i, Fn, kn, Xi, Ks, Js, vn, Xs, qs, js, ji, Qs, fe$1, ti, Qi, ei, Ji, ts, es, is$2, pt, ii, ss, qi, X$1, de$1, si, ri, Mn, ni, ue$1, di, tr, oi, me$1, W$1, Ct, Ft$1, pe$2, rs, G, ns, hi, er, as, ls, ai, li, ir, os$5, ci, rr, hs, Et, kt, Un, Hn, or, hr, Wn, Gn, fr, dr, ar, ur, mr, pr, Kn, Vn, $n, lr, cs, fs$13, ui, Xn, ds, qn, us, we$1, wt, Qn, Er, ms, wr, Jn, Sr, ps, yr, $t, Rr, eo, io, Ei, _r, gr, ys, Or, Rs, P$2, bs, _s, Si, Tr, xr, ye$1, Lr, Nr, Es, St, O$1, wi, Ar, Xt$1, ws, Ss, gs, Re, be, _e$1, ge$1, Oe$1, no, oo, ho, Dr, qt, Se$1, Te$1, ao, lo, co, fo, uo, mo, po, Eo, vt, So;
147201
147215
  var init_index_min = __esmMin((() => {
147202
147216
  kr = Object.defineProperty;
147203
147217
  vr = (s, t) => {
@@ -148576,15 +148590,15 @@ while (this[Us](this[it].shift()));
148576
148590
  }, An = (s) => {
148577
148591
  let t = new st$1(s), e = s.file, i;
148578
148592
  try {
148579
- i = Vt.openSync(e, "r");
148580
- let r = Vt.fstatSync(i), n = s.maxReadSize || 16 * 1024 * 1024;
148593
+ i = fs.openSync(e, "r");
148594
+ let r = fs.fstatSync(i), n = s.maxReadSize || 16 * 1024 * 1024;
148581
148595
  if (r.size < n) {
148582
- let o = Buffer.allocUnsafe(r.size), h = Vt.readSync(i, o, 0, r.size, 0);
148596
+ let o = Buffer.allocUnsafe(r.size), h = fs.readSync(i, o, 0, r.size, 0);
148583
148597
  t.end(h === o.byteLength ? o : o.subarray(0, h));
148584
148598
  } else {
148585
148599
  let o = 0, h = Buffer.allocUnsafe(n);
148586
148600
  for (; o < r.size;) {
148587
- let a = Vt.readSync(i, h, 0, n, o);
148601
+ let a = fs.readSync(i, h, 0, n, o);
148588
148602
  if (a === 0) break;
148589
148603
  o += a, t.write(h.subarray(0, a));
148590
148604
  }
@@ -148592,13 +148606,13 @@ while (this[Us](this[it].shift()));
148592
148606
  }
148593
148607
  } finally {
148594
148608
  if (typeof i == "number") try {
148595
- Vt.closeSync(i);
148609
+ fs.closeSync(i);
148596
148610
  } catch {}
148597
148611
  }
148598
148612
  }, Dn = (s, t) => {
148599
148613
  let e = new st$1(s), i = s.maxReadSize || 16 * 1024 * 1024, r = s.file;
148600
148614
  return new Promise((o, h) => {
148601
- e.on("error", h), e.on("end", o), Vt.stat(r, (a, l) => {
148615
+ e.on("error", h), e.on("end", o), fs.stat(r, (a, l) => {
148602
148616
  if (a) h(a);
148603
148617
  else {
148604
148618
  let c = new _t(r, {
@@ -149340,14 +149354,14 @@ while (this[Us](this[it].shift()));
149340
149354
  if (!t?.length) throw new TypeError("no paths specified to add to archive");
149341
149355
  });
149342
149356
  fr = (process.env.__FAKE_PLATFORM__ || process.platform) === "win32", {O_CREAT: dr, O_NOFOLLOW: ar, O_TRUNC: ur, O_WRONLY: mr} = I.constants, pr = Number(process.env.__FAKE_FS_O_FILENAME__) || I.constants.UV_FS_O_FILEMAP || 0, Kn = fr && !!pr, Vn = 512 * 1024, $n = pr | ur | dr | mr, lr = !fr && typeof ar == "number" ? ar | ur | dr | mr : null, cs = lr !== null ? () => lr : Kn ? (s) => s < Vn ? $n : "w" : () => "w";
149343
- fs$12 = (s, t, e) => {
149357
+ fs$13 = (s, t, e) => {
149344
149358
  try {
149345
- return Vt.lchownSync(s, t, e);
149359
+ return fs.lchownSync(s, t, e);
149346
149360
  } catch (i) {
149347
149361
  if (i?.code !== "ENOENT") throw i;
149348
149362
  }
149349
149363
  }, ui = (s, t, e, i) => {
149350
- Vt.lchown(s, t, e, (r) => {
149364
+ fs.lchown(s, t, e, (r) => {
149351
149365
  i(r && r?.code !== "ENOENT" ? r : null);
149352
149366
  });
149353
149367
  }, Xn = (s, t, e, i, r) => {
@@ -149357,7 +149371,7 @@ while (this[Us](this[it].shift()));
149357
149371
  });
149358
149372
  else ui(path.resolve(s, t.name), e, i, r);
149359
149373
  }, ds = (s, t, e, i) => {
149360
- Vt.readdir(s, { withFileTypes: !0 }, (r, n) => {
149374
+ fs.readdir(s, { withFileTypes: !0 }, (r, n) => {
149361
149375
  if (r) {
149362
149376
  if (r.code === "ENOENT") return i();
149363
149377
  if (r.code !== "ENOTDIR" && r.code !== "ENOTSUP") return i(r);
@@ -149372,19 +149386,19 @@ while (this[Us](this[it].shift()));
149372
149386
  for (let l of n) Xn(s, l, t, e, a);
149373
149387
  });
149374
149388
  }, qn = (s, t, e, i) => {
149375
- t.isDirectory() && us(path.resolve(s, t.name), e, i), fs$12(path.resolve(s, t.name), e, i);
149389
+ t.isDirectory() && us(path.resolve(s, t.name), e, i), fs$13(path.resolve(s, t.name), e, i);
149376
149390
  }, us = (s, t, e) => {
149377
149391
  let i;
149378
149392
  try {
149379
- i = Vt.readdirSync(s, { withFileTypes: !0 });
149393
+ i = fs.readdirSync(s, { withFileTypes: !0 });
149380
149394
  } catch (r) {
149381
149395
  let n = r;
149382
149396
  if (n?.code === "ENOENT") return;
149383
- if (n?.code === "ENOTDIR" || n?.code === "ENOTSUP") return fs$12(s, t, e);
149397
+ if (n?.code === "ENOTDIR" || n?.code === "ENOTSUP") return fs$13(s, t, e);
149384
149398
  throw n;
149385
149399
  }
149386
149400
  for (let r of i) qn(s, r, t, e);
149387
- return fs$12(s, t, e);
149401
+ return fs$13(s, t, e);
149388
149402
  };
149389
149403
  we$1 = class extends Error {
149390
149404
  path;
@@ -149410,16 +149424,16 @@ while (this[Us](this[it].shift()));
149410
149424
  }
149411
149425
  };
149412
149426
  Qn = (s, t) => {
149413
- Vt.stat(s, (e, i) => {
149427
+ fs.stat(s, (e, i) => {
149414
149428
  (e || !i.isDirectory()) && (e = new we$1(s, e?.code || "ENOTDIR")), t(e);
149415
149429
  });
149416
149430
  }, Er = (s, t, e) => {
149417
149431
  s = f(s);
149418
149432
  let i = t.umask ?? 18, r = t.mode | 448, n = (r & i) !== 0, o = t.uid, h = t.gid, a = typeof o == "number" && typeof h == "number" && (o !== t.processUid || h !== t.processGid), l = t.preserve, c = t.unlink, d = f(t.cwd), S = (E, x) => {
149419
- E ? e(E) : x && a ? ds(x, o, h, (xe) => S(xe)) : n ? Vt.chmod(s, r, e) : e();
149433
+ E ? e(E) : x && a ? ds(x, o, h, (xe) => S(xe)) : n ? fs.chmod(s, r, e) : e();
149420
149434
  };
149421
149435
  if (s === d) return Qn(s, S);
149422
- if (l) return fs.mkdir(s, {
149436
+ if (l) return fs$1.mkdir(s, {
149423
149437
  mode: r,
149424
149438
  recursive: !0
149425
149439
  }).then((E) => S(null, E ?? void 0), S);
@@ -149427,14 +149441,14 @@ while (this[Us](this[it].shift()));
149427
149441
  }, ms = (s, t, e, i, r, n, o) => {
149428
149442
  if (t.length === 0) return o(null, n);
149429
149443
  let h = t.shift(), a = f(path.resolve(s + "/" + h));
149430
- Vt.mkdir(a, e, wr(a, t, e, i, r, n, o));
149444
+ fs.mkdir(a, e, wr(a, t, e, i, r, n, o));
149431
149445
  }, wr = (s, t, e, i, r, n, o) => (h) => {
149432
- h ? Vt.lstat(s, (a, l) => {
149446
+ h ? fs.lstat(s, (a, l) => {
149433
149447
  if (a) a.path = a.path && f(a.path), o(a);
149434
149448
  else if (l.isDirectory()) ms(s, t, e, i, r, n, o);
149435
- else if (i) Vt.unlink(s, (c) => {
149449
+ else if (i) fs.unlink(s, (c) => {
149436
149450
  if (c) return o(c);
149437
- Vt.mkdir(s, e, wr(s, t, e, i, r, n, o));
149451
+ fs.mkdir(s, e, wr(s, t, e, i, r, n, o));
149438
149452
  });
149439
149453
  else {
149440
149454
  if (l.isSymbolicLink()) return o(new wt(s, s + "/" + t.join("/")));
@@ -149444,7 +149458,7 @@ while (this[Us](this[it].shift()));
149444
149458
  }, Jn = (s) => {
149445
149459
  let t = !1, e;
149446
149460
  try {
149447
- t = Vt.statSync(s).isDirectory();
149461
+ t = fs.statSync(s).isDirectory();
149448
149462
  } catch (i) {
149449
149463
  e = i?.code;
149450
149464
  } finally {
@@ -149453,10 +149467,10 @@ while (this[Us](this[it].shift()));
149453
149467
  }, Sr = (s, t) => {
149454
149468
  s = f(s);
149455
149469
  let e = t.umask ?? 18, i = t.mode | 448, r = (i & e) !== 0, n = t.uid, o = t.gid, h = typeof n == "number" && typeof o == "number" && (n !== t.processUid || o !== t.processGid), a = t.preserve, l = t.unlink, c = f(t.cwd), d = (E) => {
149456
- E && h && us(E, n, o), r && Vt.chmodSync(s, i);
149470
+ E && h && us(E, n, o), r && fs.chmodSync(s, i);
149457
149471
  };
149458
149472
  if (s === c) return Jn(c), d();
149459
- if (a) return d(Vt.mkdirSync(s, {
149473
+ if (a) return d(fs.mkdirSync(s, {
149460
149474
  mode: i,
149461
149475
  recursive: !0
149462
149476
  }) ?? void 0);
@@ -149464,12 +149478,12 @@ while (this[Us](this[it].shift()));
149464
149478
  for (let E = T.shift(), x = c; E && (x += "/" + E); E = T.shift()) {
149465
149479
  x = f(path.resolve(x));
149466
149480
  try {
149467
- Vt.mkdirSync(x, i), N = N || x;
149481
+ fs.mkdirSync(x, i), N = N || x;
149468
149482
  } catch {
149469
- let xe = Vt.lstatSync(x);
149483
+ let xe = fs.lstatSync(x);
149470
149484
  if (xe.isDirectory()) continue;
149471
149485
  if (l) {
149472
- Vt.unlinkSync(x), Vt.mkdirSync(x, i), N = N || x;
149486
+ fs.unlinkSync(x), fs.mkdirSync(x, i), N = N || x;
149473
149487
  continue;
149474
149488
  } else if (xe.isSymbolicLink()) return new wt(x, x + "/" + T.join("/"));
149475
149489
  }
@@ -149559,16 +149573,16 @@ while (this[Us](this[it].shift()));
149559
149573
  };
149560
149574
  _r = () => process.umask();
149561
149575
  gr = Symbol("onEntry"), ys = Symbol("checkFs"), Or = Symbol("checkFs2"), Rs = Symbol("isReusable"), P$2 = Symbol("makeFs"), bs = Symbol("file"), _s = Symbol("directory"), Si = Symbol("link"), Tr = Symbol("symlink"), xr = Symbol("hardlink"), ye$1 = Symbol("ensureNoSymlink"), Lr = Symbol("unsupported"), Nr = Symbol("checkPath"), Es = Symbol("stripAbsolutePath"), St = Symbol("mkdir"), O$1 = Symbol("onError"), wi = Symbol("pending"), Ar = Symbol("pend"), Xt$1 = Symbol("unpend"), ws = Symbol("ended"), Ss = Symbol("maybeClose"), gs = Symbol("skip"), Re = Symbol("doChown"), be = Symbol("uid"), _e$1 = Symbol("gid"), ge$1 = Symbol("checkedCwd"), Oe$1 = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32", no = 1024, oo = (s, t) => {
149562
- if (!Oe$1) return Vt.unlink(s, t);
149576
+ if (!Oe$1) return fs.unlink(s, t);
149563
149577
  let e = s + ".DELETE." + randomBytes(16).toString("hex");
149564
- Vt.rename(s, e, (i) => {
149578
+ fs.rename(s, e, (i) => {
149565
149579
  if (i) return t(i);
149566
- Vt.unlink(e, t);
149580
+ fs.unlink(e, t);
149567
149581
  });
149568
149582
  }, ho = (s) => {
149569
- if (!Oe$1) return Vt.unlinkSync(s);
149583
+ if (!Oe$1) return fs.unlinkSync(s);
149570
149584
  let t = s + ".DELETE." + randomBytes(16).toString("hex");
149571
- Vt.renameSync(s, t), Vt.unlinkSync(t);
149585
+ fs.renameSync(s, t), fs.unlinkSync(t);
149572
149586
  }, Dr = (s, t, e) => s !== void 0 && s === s >>> 0 ? s : t !== void 0 && t === t >>> 0 ? t : e, qt = class extends st$1 {
149573
149587
  [ws] = !1;
149574
149588
  [ge$1] = !1;
@@ -149712,14 +149726,14 @@ while (this[Us](this[it].shift()));
149712
149726
  autoClose: !1
149713
149727
  });
149714
149728
  r.on("error", (a) => {
149715
- r.fd && Vt.close(r.fd, () => {}), r.write = () => !0, this[O$1](a, t), e();
149729
+ r.fd && fs.close(r.fd, () => {}), r.write = () => !0, this[O$1](a, t), e();
149716
149730
  });
149717
149731
  let n = 1, o = (a) => {
149718
149732
  if (a) {
149719
- r.fd && Vt.close(r.fd, () => {}), this[O$1](a, t), e();
149733
+ r.fd && fs.close(r.fd, () => {}), this[O$1](a, t), e();
149720
149734
  return;
149721
149735
  }
149722
- --n === 0 && r.fd !== void 0 && Vt.close(r.fd, (l) => {
149736
+ --n === 0 && r.fd !== void 0 && fs.close(r.fd, (l) => {
149723
149737
  l ? this[O$1](l, t) : this[Xt$1](), e();
149724
149738
  });
149725
149739
  };
@@ -149728,12 +149742,12 @@ while (this[Us](this[it].shift()));
149728
149742
  if (typeof l == "number" && t.mtime && !this.noMtime) {
149729
149743
  n++;
149730
149744
  let c = t.atime || /* @__PURE__ */ new Date(), d = t.mtime;
149731
- Vt.futimes(l, c, d, (S) => S ? Vt.utimes(a, c, d, (T) => o(T && S)) : o());
149745
+ fs.futimes(l, c, d, (S) => S ? fs.utimes(a, c, d, (T) => o(T && S)) : o());
149732
149746
  }
149733
149747
  if (typeof l == "number" && this[Re](t)) {
149734
149748
  n++;
149735
149749
  let c = this[be](t), d = this[_e$1](t);
149736
- typeof c == "number" && typeof d == "number" && Vt.fchown(l, c, d, (S) => S ? Vt.chown(a, c, d, (T) => o(T && S)) : o());
149750
+ typeof c == "number" && typeof d == "number" && fs.fchown(l, c, d, (S) => S ? fs.chown(a, c, d, (T) => o(T && S)) : o());
149737
149751
  }
149738
149752
  o();
149739
149753
  });
@@ -149752,7 +149766,7 @@ while (this[Us](this[it].shift()));
149752
149766
  let n = 1, o = () => {
149753
149767
  --n === 0 && (e(), this[Xt$1](), t.resume());
149754
149768
  };
149755
- t.mtime && !this.noMtime && (n++, Vt.utimes(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime, o)), this[Re](t) && (n++, Vt.chown(String(t.absolute), Number(this[be](t)), Number(this[_e$1](t)), o)), o();
149769
+ t.mtime && !this.noMtime && (n++, fs.utimes(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime, o)), this[Re](t) && (n++, fs.chown(String(t.absolute), Number(this[be](t)), Number(this[_e$1](t)), o)), o();
149756
149770
  });
149757
149771
  }
149758
149772
  [Lr](t) {
@@ -149774,7 +149788,7 @@ while (this[Us](this[it].shift()));
149774
149788
  let o = i.shift();
149775
149789
  if (this.preservePaths || o === void 0) return r();
149776
149790
  let h = path.resolve(e, o);
149777
- Vt.lstat(h, (a, l) => {
149791
+ fs.lstat(h, (a, l) => {
149778
149792
  if (a) return r();
149779
149793
  if (l?.isSymbolicLink()) return n(new wt(h, path.resolve(h, i.join("/"))));
149780
149794
  this[ye$1](t, h, i, r, n);
@@ -149821,7 +149835,7 @@ while (this[Us](this[it].shift()));
149821
149835
  }
149822
149836
  o();
149823
149837
  }, o = () => {
149824
- Vt.lstat(String(t.absolute), (h, a) => {
149838
+ fs.lstat(String(t.absolute), (h, a) => {
149825
149839
  if (a && (this.keep || this.newer && a.mtime > (t.mtime ?? a.mtime))) {
149826
149840
  this[gs](t), i();
149827
149841
  return;
@@ -149830,9 +149844,9 @@ while (this[Us](this[it].shift()));
149830
149844
  if (a.isDirectory()) {
149831
149845
  if (t.type === "Directory") {
149832
149846
  let l = this.chmod && t.mode && (a.mode & 4095) !== t.mode, c = (d) => this[P$2](d ?? null, t, i);
149833
- return l ? Vt.chmod(String(t.absolute), Number(t.mode), c) : c();
149847
+ return l ? fs.chmod(String(t.absolute), Number(t.mode), c) : c();
149834
149848
  }
149835
- if (t.absolute !== this.cwd) return Vt.rmdir(String(t.absolute), (l) => this[P$2](l ?? null, t, i));
149849
+ if (t.absolute !== this.cwd) return fs.rmdir(String(t.absolute), (l) => this[P$2](l ?? null, t, i));
149836
149850
  }
149837
149851
  if (t.absolute === this.cwd) return this[P$2](null, t, i);
149838
149852
  oo(String(t.absolute), (l) => this[P$2](l ?? null, t, i));
@@ -149856,7 +149870,7 @@ while (this[Us](this[it].shift()));
149856
149870
  }
149857
149871
  }
149858
149872
  [Si](t, e, i, r) {
149859
- Vt[i](e, String(t.absolute), (n) => {
149873
+ fs[i](e, String(t.absolute), (n) => {
149860
149874
  n ? this[O$1](n, t) : (this[Xt$1](), t.resume()), r();
149861
149875
  });
149862
149876
  }
@@ -149884,17 +149898,17 @@ while (this[Us](this[it].shift()));
149884
149898
  if (o) return this[O$1](o, t);
149885
149899
  }
149886
149900
  }
149887
- let [e, i] = Se$1(() => Vt.lstatSync(String(t.absolute)));
149901
+ let [e, i] = Se$1(() => fs.lstatSync(String(t.absolute)));
149888
149902
  if (i && (this.keep || this.newer && i.mtime > (t.mtime ?? i.mtime))) return this[gs](t);
149889
149903
  if (e || this[Rs](t, i)) return this[P$2](null, t);
149890
149904
  if (i.isDirectory()) {
149891
149905
  if (t.type === "Directory") {
149892
149906
  let [h] = this.chmod && t.mode && (i.mode & 4095) !== t.mode ? Se$1(() => {
149893
- Vt.chmodSync(String(t.absolute), Number(t.mode));
149907
+ fs.chmodSync(String(t.absolute), Number(t.mode));
149894
149908
  }) : [];
149895
149909
  return this[P$2](h, t);
149896
149910
  }
149897
- let [n] = Se$1(() => Vt.rmdirSync(String(t.absolute)));
149911
+ let [n] = Se$1(() => fs.rmdirSync(String(t.absolute)));
149898
149912
  this[P$2](n, t);
149899
149913
  }
149900
149914
  let [r] = t.absolute === this.cwd ? [] : Se$1(() => ho(String(t.absolute)));
@@ -149904,21 +149918,21 @@ while (this[Us](this[it].shift()));
149904
149918
  let i = typeof t.mode == "number" ? t.mode & 4095 : this.fmode, r = (h) => {
149905
149919
  let a;
149906
149920
  try {
149907
- Vt.closeSync(n);
149921
+ fs.closeSync(n);
149908
149922
  } catch (l) {
149909
149923
  a = l;
149910
149924
  }
149911
149925
  (h || a) && this[O$1](h || a, t), e();
149912
149926
  }, n;
149913
149927
  try {
149914
- n = Vt.openSync(String(t.absolute), cs(t.size), i);
149928
+ n = fs.openSync(String(t.absolute), cs(t.size), i);
149915
149929
  } catch (h) {
149916
149930
  return r(h);
149917
149931
  }
149918
149932
  let o = this.transform && this.transform(t) || t;
149919
149933
  o !== t && (o.on("error", (h) => this[O$1](h, t)), t.pipe(o)), o.on("data", (h) => {
149920
149934
  try {
149921
- Vt.writeSync(n, h, 0, h.length);
149935
+ fs.writeSync(n, h, 0, h.length);
149922
149936
  } catch (a) {
149923
149937
  r(a);
149924
149938
  }
@@ -149927,10 +149941,10 @@ while (this[Us](this[it].shift()));
149927
149941
  if (t.mtime && !this.noMtime) {
149928
149942
  let a = t.atime || /* @__PURE__ */ new Date(), l = t.mtime;
149929
149943
  try {
149930
- Vt.futimesSync(n, a, l);
149944
+ fs.futimesSync(n, a, l);
149931
149945
  } catch (c) {
149932
149946
  try {
149933
- Vt.utimesSync(String(t.absolute), a, l);
149947
+ fs.utimesSync(String(t.absolute), a, l);
149934
149948
  } catch {
149935
149949
  h = c;
149936
149950
  }
@@ -149939,10 +149953,10 @@ while (this[Us](this[it].shift()));
149939
149953
  if (this[Re](t)) {
149940
149954
  let a = this[be](t), l = this[_e$1](t);
149941
149955
  try {
149942
- Vt.fchownSync(n, Number(a), Number(l));
149956
+ fs.fchownSync(n, Number(a), Number(l));
149943
149957
  } catch (c) {
149944
149958
  try {
149945
- Vt.chownSync(String(t.absolute), Number(a), Number(l));
149959
+ fs.chownSync(String(t.absolute), Number(a), Number(l));
149946
149960
  } catch {
149947
149961
  h = h || c;
149948
149962
  }
@@ -149958,10 +149972,10 @@ while (this[Us](this[it].shift()));
149958
149972
  return;
149959
149973
  }
149960
149974
  if (t.mtime && !this.noMtime) try {
149961
- Vt.utimesSync(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime);
149975
+ fs.utimesSync(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime);
149962
149976
  } catch {}
149963
149977
  if (this[Re](t)) try {
149964
- Vt.chownSync(String(t.absolute), Number(this[be](t)), Number(this[_e$1](t)));
149978
+ fs.chownSync(String(t.absolute), Number(this[be](t)), Number(this[_e$1](t)));
149965
149979
  } catch {}
149966
149980
  e(), t.resume();
149967
149981
  }
@@ -149987,7 +150001,7 @@ while (this[Us](this[it].shift()));
149987
150001
  let o = e;
149988
150002
  for (let h of i) {
149989
150003
  o = path.resolve(o, h);
149990
- let [a, l] = Se$1(() => Vt.lstatSync(o));
150004
+ let [a, l] = Se$1(() => fs.lstatSync(o));
149991
150005
  if (a) return r();
149992
150006
  if (l.isSymbolicLink()) return n(new wt(o, path.resolve(e, i.join("/"))));
149993
150007
  }
@@ -149996,14 +150010,14 @@ while (this[Us](this[it].shift()));
149996
150010
  [Si](t, e, i, r) {
149997
150011
  let n = `${i}Sync`;
149998
150012
  try {
149999
- Vt[n](e, String(t.absolute)), r(), t.resume();
150013
+ fs[n](e, String(t.absolute)), r(), t.resume();
150000
150014
  } catch (o) {
150001
150015
  return this[O$1](o, t);
150002
150016
  }
150003
150017
  }
150004
150018
  };
150005
150019
  ao = (s) => {
150006
- let t = new Te$1(s), e = s.file, i = Vt.statSync(e);
150020
+ let t = new Te$1(s), e = s.file, i = fs.statSync(e);
150007
150021
  new Me(e, {
150008
150022
  readSize: s.maxReadSize || 16 * 1024 * 1024,
150009
150023
  size: i.size
@@ -150011,7 +150025,7 @@ while (this[Us](this[it].shift()));
150011
150025
  }, lo = (s, t) => {
150012
150026
  let e = new qt(s), i = s.maxReadSize || 16 * 1024 * 1024, r = s.file;
150013
150027
  return new Promise((o, h) => {
150014
- e.on("error", h), e.on("close", o), Vt.stat(r, (a, l) => {
150028
+ e.on("error", h), e.on("close", o), fs.stat(r, (a, l) => {
150015
150029
  if (a) h(a);
150016
150030
  else {
150017
150031
  let c = new _t(r, {
@@ -150029,15 +150043,15 @@ while (this[Us](this[it].shift()));
150029
150043
  let e = new kt(s), i = !0, r, n;
150030
150044
  try {
150031
150045
  try {
150032
- r = Vt.openSync(s.file, "r+");
150046
+ r = fs.openSync(s.file, "r+");
150033
150047
  } catch (a) {
150034
- if (a?.code === "ENOENT") r = Vt.openSync(s.file, "w+");
150048
+ if (a?.code === "ENOENT") r = fs.openSync(s.file, "w+");
150035
150049
  else throw a;
150036
150050
  }
150037
- let o = Vt.fstatSync(r), h = Buffer.alloc(512);
150051
+ let o = fs.fstatSync(r), h = Buffer.alloc(512);
150038
150052
  t: for (n = 0; n < o.size; n += 512) {
150039
150053
  for (let c = 0, d = 0; c < 512; c += d) {
150040
- if (d = Vt.readSync(r, h, c, h.length - c, n + c), n === 0 && h[0] === 31 && h[1] === 139) throw new Error("cannot append to compressed archives");
150054
+ if (d = fs.readSync(r, h, c, h.length - c, n + c), n === 0 && h[0] === 31 && h[1] === 139) throw new Error("cannot append to compressed archives");
150041
150055
  if (!d) break t;
150042
150056
  }
150043
150057
  let a = new F$1(h);
@@ -150049,7 +150063,7 @@ while (this[Us](this[it].shift()));
150049
150063
  i = !1, uo(s, e, n, r, t);
150050
150064
  } finally {
150051
150065
  if (i) try {
150052
- Vt.closeSync(r);
150066
+ fs.closeSync(r);
150053
150067
  } catch {}
150054
150068
  }
150055
150069
  }, uo = (s, t, e, i, r) => {
@@ -150062,29 +150076,29 @@ while (this[Us](this[it].shift()));
150062
150076
  t = Array.from(t);
150063
150077
  let e = new Et(s), i = (n, o, h) => {
150064
150078
  let a = (T, N) => {
150065
- T ? Vt.close(n, (E) => h(T)) : h(null, N);
150079
+ T ? fs.close(n, (E) => h(T)) : h(null, N);
150066
150080
  }, l = 0;
150067
150081
  if (o === 0) return a(null, 0);
150068
150082
  let c = 0, d = Buffer.alloc(512), S = (T, N) => {
150069
150083
  if (T || N === void 0) return a(T);
150070
- if (c += N, c < 512 && N) return Vt.read(n, d, c, d.length - c, l + c, S);
150084
+ if (c += N, c < 512 && N) return fs.read(n, d, c, d.length - c, l + c, S);
150071
150085
  if (l === 0 && d[0] === 31 && d[1] === 139) return a(/* @__PURE__ */ new Error("cannot append to compressed archives"));
150072
150086
  if (c < 512) return a(null, l);
150073
150087
  let E = new F$1(d);
150074
150088
  if (!E.cksumValid) return a(null, l);
150075
150089
  let x = 512 * Math.ceil((E.size ?? 0) / 512);
150076
150090
  if (l + x + 512 > o || (l += x + 512, l >= o)) return a(null, l);
150077
- s.mtimeCache && E.mtime && s.mtimeCache.set(String(E.path), E.mtime), c = 0, Vt.read(n, d, 0, 512, l, S);
150091
+ s.mtimeCache && E.mtime && s.mtimeCache.set(String(E.path), E.mtime), c = 0, fs.read(n, d, 0, 512, l, S);
150078
150092
  };
150079
- Vt.read(n, d, 0, 512, l, S);
150093
+ fs.read(n, d, 0, 512, l, S);
150080
150094
  };
150081
150095
  return new Promise((n, o) => {
150082
150096
  e.on("error", o);
150083
150097
  let h = "r+", a = (l, c) => {
150084
- if (l && l.code === "ENOENT" && h === "r+") return h = "w+", Vt.open(s.file, h, a);
150098
+ if (l && l.code === "ENOENT" && h === "r+") return h = "w+", fs.open(s.file, h, a);
150085
150099
  if (l || !c) return o(l);
150086
- Vt.fstat(c, (d, S) => {
150087
- if (d) return Vt.close(c, () => o(d));
150100
+ fs.fstat(c, (d, S) => {
150101
+ if (d) return fs.close(c, () => o(d));
150088
150102
  i(c, S.size, (T, N) => {
150089
150103
  if (T) return o(T);
150090
150104
  let E = new tt$1(s.file, {
@@ -150095,7 +150109,7 @@ while (this[Us](this[it].shift()));
150095
150109
  });
150096
150110
  });
150097
150111
  };
150098
- Vt.open(s.file, h, a);
150112
+ fs.open(s.file, h, a);
150099
150113
  });
150100
150114
  }, po = (s, t) => {
150101
150115
  t.forEach((e) => {
@@ -150178,7 +150192,7 @@ var require_pend = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150178
150192
  //#endregion
150179
150193
  //#region ../../node_modules/.pnpm/yauzl@3.3.0/node_modules/yauzl/fd-slicer.js
150180
150194
  var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
150181
- var fs$11 = __require("fs");
150195
+ var fs$12 = __require("fs");
150182
150196
  var util$7 = __require("util");
150183
150197
  var stream$2 = __require("stream");
150184
150198
  var Readable = stream$2.Readable;
@@ -150203,7 +150217,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
150203
150217
  FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
150204
150218
  var self = this;
150205
150219
  self.pend.go(function(cb) {
150206
- fs$11.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) {
150220
+ fs$12.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) {
150207
150221
  cb();
150208
150222
  callback(err, bytesRead, buffer);
150209
150223
  });
@@ -150212,7 +150226,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
150212
150226
  FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
150213
150227
  var self = this;
150214
150228
  self.pend.go(function(cb) {
150215
- fs$11.write(self.fd, buffer, offset, length, position, function(err, written, buffer) {
150229
+ fs$12.write(self.fd, buffer, offset, length, position, function(err, written, buffer) {
150216
150230
  cb();
150217
150231
  callback(err, written, buffer);
150218
150232
  });
@@ -150232,7 +150246,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
150232
150246
  self.refCount -= 1;
150233
150247
  if (self.refCount > 0) return;
150234
150248
  if (self.refCount < 0) throw new Error("invalid unref");
150235
- if (self.autoClose) fs$11.close(self.fd, onCloseDone);
150249
+ if (self.autoClose) fs$12.close(self.fd, onCloseDone);
150236
150250
  function onCloseDone(err) {
150237
150251
  if (err) self.emit("error", err);
150238
150252
  else self.emit("close");
@@ -150263,7 +150277,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
150263
150277
  self.context.pend.go(function(cb) {
150264
150278
  if (self.destroyed) return cb();
150265
150279
  var buffer = Buffer.allocUnsafe(toRead);
150266
- fs$11.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
150280
+ fs$12.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
150267
150281
  if (err) self.destroy(err);
150268
150282
  else if (bytesRead === 0) {
150269
150283
  self.destroyed = true;
@@ -150309,7 +150323,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
150309
150323
  }
150310
150324
  self.context.pend.go(function(cb) {
150311
150325
  if (self.destroyed) return cb();
150312
- fs$11.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err, bytes) {
150326
+ fs$12.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err, bytes) {
150313
150327
  if (err) {
150314
150328
  self.destroy();
150315
150329
  cb();
@@ -155124,6 +155138,11 @@ var init_tool$2 = __esmMin((() => {
155124
155138
  }
155125
155139
  get loopTools() {
155126
155140
  if (this.loopToolsOverride !== void 0) return this.loopToolsOverride;
155141
+ if (this.builtinTools.size === 0 && this.agent.config.hasProvider) try {
155142
+ this.initializeBuiltinTools();
155143
+ } catch (error) {
155144
+ this.agent.log.warn("lazy initializeBuiltinTools failed; will retry on next read", { error: error instanceof Error ? error.message : String(error) });
155145
+ }
155127
155146
  const disclosure = this.progressiveDisclosure;
155128
155147
  const enabledMcpNames = [...this.mcpTools.keys()].filter((name) => this.isMcpToolEnabled(name));
155129
155148
  const loadedSet = disclosure ? this.loadedDynamicToolNames() : void 0;
@@ -157092,7 +157111,7 @@ var init_agent$2 = __esmMin((() => {
157092
157111
  },
157093
157112
  setThinking: (payload) => {
157094
157113
  const previousEffort = this.config.thinkingEffort;
157095
- this.config.update({ thinkingEffort: payload.effort });
157114
+ this.config.setThinkingEffort(payload.effort);
157096
157115
  const effort = this.config.thinkingEffort;
157097
157116
  if (effort !== previousEffort) this.telemetry.track("thinking_toggle", {
157098
157117
  enabled: effort !== "off",
@@ -157216,7 +157235,7 @@ var init_agent$2 = __esmMin((() => {
157216
157235
  if (this.records.restoring) return;
157217
157236
  this.rpc?.emitEvent?.(event);
157218
157237
  }
157219
- emitStatusUpdated() {
157238
+ emitStatusUpdated(includeThinkingEffort = false) {
157220
157239
  if (this.records.restoring) return;
157221
157240
  if (!this.config.hasModel) return;
157222
157241
  const contextTokens = this.context.tokenCount;
@@ -157227,6 +157246,7 @@ var init_agent$2 = __esmMin((() => {
157227
157246
  this.emitEvent({
157228
157247
  type: "agent.status.updated",
157229
157248
  model,
157249
+ thinkingEffort: includeThinkingEffort ? this.config.thinkingEffort : void 0,
157230
157250
  contextTokens,
157231
157251
  maxContextTokens,
157232
157252
  contextUsage,
@@ -186147,7 +186167,7 @@ var init_proxy$1 = __esmMin((() => {
186147
186167
  var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
186148
186168
  module.exports = isexe;
186149
186169
  isexe.sync = sync;
186150
- var fs$9 = __require("fs");
186170
+ var fs$10 = __require("fs");
186151
186171
  function checkPathExt(path, options) {
186152
186172
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
186153
186173
  if (!pathext) return true;
@@ -186164,12 +186184,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
186164
186184
  return checkPathExt(path, options);
186165
186185
  }
186166
186186
  function isexe(path, options, cb) {
186167
- fs$9.stat(path, function(er, stat) {
186187
+ fs$10.stat(path, function(er, stat) {
186168
186188
  cb(er, er ? false : checkStat(stat, path, options));
186169
186189
  });
186170
186190
  }
186171
186191
  function sync(path, options) {
186172
- return checkStat(fs$9.statSync(path), path, options);
186192
+ return checkStat(fs$10.statSync(path), path, options);
186173
186193
  }
186174
186194
  }));
186175
186195
  //#endregion
@@ -186177,14 +186197,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
186177
186197
  var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
186178
186198
  module.exports = isexe;
186179
186199
  isexe.sync = sync;
186180
- var fs$8 = __require("fs");
186200
+ var fs$9 = __require("fs");
186181
186201
  function isexe(path, options, cb) {
186182
- fs$8.stat(path, function(er, stat) {
186202
+ fs$9.stat(path, function(er, stat) {
186183
186203
  cb(er, er ? false : checkStat(stat, options));
186184
186204
  });
186185
186205
  }
186186
186206
  function sync(path, options) {
186187
- return checkStat(fs$8.statSync(path), options);
186207
+ return checkStat(fs$9.statSync(path), options);
186188
186208
  }
186189
186209
  function checkStat(stat, options) {
186190
186210
  return stat.isFile() && checkMode(stat, options);
@@ -186399,16 +186419,16 @@ var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) =
186399
186419
  //#endregion
186400
186420
  //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
186401
186421
  var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
186402
- const fs$7 = __require("fs");
186422
+ const fs$8 = __require("fs");
186403
186423
  const shebangCommand = require_shebang_command();
186404
186424
  function readShebang(command) {
186405
186425
  const size = 150;
186406
186426
  const buffer = Buffer.alloc(size);
186407
186427
  let fd;
186408
186428
  try {
186409
- fd = fs$7.openSync(command, "r");
186410
- fs$7.readSync(fd, buffer, 0, size, 0);
186411
- fs$7.closeSync(fd);
186429
+ fd = fs$8.openSync(command, "r");
186430
+ fs$8.readSync(fd, buffer, 0, size, 0);
186431
+ fs$8.closeSync(fd);
186412
186432
  } catch (e) {}
186413
186433
  return shebangCommand(buffer.toString());
186414
186434
  }
@@ -203791,7 +203811,7 @@ var require_dist$5 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
203791
203811
  //#endregion
203792
203812
  //#region ../../node_modules/.pnpm/yazl@3.3.1/node_modules/yazl/index.js
203793
203813
  var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
203794
- var fs$6 = __require("fs");
203814
+ var fs$7 = __require("fs");
203795
203815
  var Transform$1 = __require("stream").Transform;
203796
203816
  var PassThrough$2 = __require("stream").PassThrough;
203797
203817
  var zlib$1 = __require("zlib");
@@ -203820,14 +203840,14 @@ var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
203820
203840
  if (shouldIgnoreAdding(self)) return;
203821
203841
  var entry = new Entry(metadataPath, false, options);
203822
203842
  self.entries.push(entry);
203823
- fs$6.stat(realPath, function(err, stats) {
203843
+ fs$7.stat(realPath, function(err, stats) {
203824
203844
  if (err) return self.emit("error", err);
203825
203845
  if (!stats.isFile()) return self.emit("error", /* @__PURE__ */ new Error("not a file: " + realPath));
203826
203846
  entry.uncompressedSize = stats.size;
203827
203847
  if (options.mtime == null) entry.setLastModDate(stats.mtime);
203828
203848
  if (options.mode == null) entry.setFileAttributesMode(stats.mode);
203829
203849
  entry.setFileDataPumpFunction(function() {
203830
- var readStream = fs$6.createReadStream(realPath);
203850
+ var readStream = fs$7.createReadStream(realPath);
203831
203851
  entry.state = Entry.FILE_DATA_IN_PROGRESS;
203832
203852
  readStream.on("error", function(err) {
203833
203853
  self.emit("error", err);
@@ -205214,7 +205234,7 @@ var require_clone = /* @__PURE__ */ __commonJSMin(((exports, module) => {
205214
205234
  //#endregion
205215
205235
  //#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
205216
205236
  var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
205217
- var fs$5 = __require("fs");
205237
+ var fs$6 = __require("fs");
205218
205238
  var polyfills = require_polyfills();
205219
205239
  var legacy = require_legacy_streams();
205220
205240
  var clone = require_clone();
@@ -205243,36 +205263,36 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
205243
205263
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
205244
205264
  console.error(m);
205245
205265
  };
205246
- if (!fs$5[gracefulQueue]) {
205247
- publishQueue(fs$5, global[gracefulQueue] || []);
205248
- fs$5.close = (function(fs$close) {
205266
+ if (!fs$6[gracefulQueue]) {
205267
+ publishQueue(fs$6, global[gracefulQueue] || []);
205268
+ fs$6.close = (function(fs$close) {
205249
205269
  function close(fd, cb) {
205250
- return fs$close.call(fs$5, fd, function(err) {
205270
+ return fs$close.call(fs$6, fd, function(err) {
205251
205271
  if (!err) resetQueue();
205252
205272
  if (typeof cb === "function") cb.apply(this, arguments);
205253
205273
  });
205254
205274
  }
205255
205275
  Object.defineProperty(close, previousSymbol, { value: fs$close });
205256
205276
  return close;
205257
- })(fs$5.close);
205258
- fs$5.closeSync = (function(fs$closeSync) {
205277
+ })(fs$6.close);
205278
+ fs$6.closeSync = (function(fs$closeSync) {
205259
205279
  function closeSync(fd) {
205260
- fs$closeSync.apply(fs$5, arguments);
205280
+ fs$closeSync.apply(fs$6, arguments);
205261
205281
  resetQueue();
205262
205282
  }
205263
205283
  Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
205264
205284
  return closeSync;
205265
- })(fs$5.closeSync);
205285
+ })(fs$6.closeSync);
205266
205286
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
205267
- debug(fs$5[gracefulQueue]);
205268
- __require("assert").equal(fs$5[gracefulQueue].length, 0);
205287
+ debug(fs$6[gracefulQueue]);
205288
+ __require("assert").equal(fs$6[gracefulQueue].length, 0);
205269
205289
  });
205270
205290
  }
205271
- if (!global[gracefulQueue]) publishQueue(global, fs$5[gracefulQueue]);
205272
- module.exports = patch(clone(fs$5));
205273
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$5.__patched) {
205274
- module.exports = patch(fs$5);
205275
- fs$5.__patched = true;
205291
+ if (!global[gracefulQueue]) publishQueue(global, fs$6[gracefulQueue]);
205292
+ module.exports = patch(clone(fs$6));
205293
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$6.__patched) {
205294
+ module.exports = patch(fs$6);
205295
+ fs$6.__patched = true;
205276
205296
  }
205277
205297
  function patch(fs) {
205278
205298
  polyfills(fs);
@@ -205527,23 +205547,23 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
205527
205547
  }
205528
205548
  function enqueue(elem) {
205529
205549
  debug("ENQUEUE", elem[0].name, elem[1]);
205530
- fs$5[gracefulQueue].push(elem);
205550
+ fs$6[gracefulQueue].push(elem);
205531
205551
  retry();
205532
205552
  }
205533
205553
  var retryTimer;
205534
205554
  function resetQueue() {
205535
205555
  var now = Date.now();
205536
- for (var i = 0; i < fs$5[gracefulQueue].length; ++i) if (fs$5[gracefulQueue][i].length > 2) {
205537
- fs$5[gracefulQueue][i][3] = now;
205538
- fs$5[gracefulQueue][i][4] = now;
205556
+ for (var i = 0; i < fs$6[gracefulQueue].length; ++i) if (fs$6[gracefulQueue][i].length > 2) {
205557
+ fs$6[gracefulQueue][i][3] = now;
205558
+ fs$6[gracefulQueue][i][4] = now;
205539
205559
  }
205540
205560
  retry();
205541
205561
  }
205542
205562
  function retry() {
205543
205563
  clearTimeout(retryTimer);
205544
205564
  retryTimer = void 0;
205545
- if (fs$5[gracefulQueue].length === 0) return;
205546
- var elem = fs$5[gracefulQueue].shift();
205565
+ if (fs$6[gracefulQueue].length === 0) return;
205566
+ var elem = fs$6[gracefulQueue].shift();
205547
205567
  var fn = elem[0];
205548
205568
  var args = elem[1];
205549
205569
  var err = elem[2];
@@ -205562,7 +205582,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
205562
205582
  if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
205563
205583
  debug("RETRY", fn.name, args);
205564
205584
  fn.apply(null, args.concat([startTime]));
205565
- } else fs$5[gracefulQueue].push(elem);
205585
+ } else fs$6[gracefulQueue].push(elem);
205566
205586
  }
205567
205587
  if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
205568
205588
  }
@@ -208499,7 +208519,7 @@ function resolveModelCapabilities$1(alias, provider) {
208499
208519
  dynamically_loaded_tools: declared.has("dynamically_loaded_tools") || detected.dynamically_loaded_tools === true
208500
208520
  };
208501
208521
  }
208502
- function toKosongProviderConfig$1(provider, model, modelProtocol, kimiRequestHeaders, maxOutputSize, reasoningKey, promptCacheKey, adaptiveThinking, betaApi, supportEfforts) {
208522
+ function toKosongProviderConfig$1(provider, model, modelProtocol, kimiRequestHeaders, maxOutputSize, reasoningKey, promptCacheKey, adaptiveThinking, betaApi) {
208503
208523
  const effectiveType = modelProtocol === "anthropic" ? "anthropic" : provider.type;
208504
208524
  const envCustomHeaders = parseKimiCodeCustomHeaders();
208505
208525
  switch (effectiveType) {
@@ -208512,6 +208532,7 @@ function toKosongProviderConfig$1(provider, model, modelProtocol, kimiRequestHea
208512
208532
  apiKey: providerApiKey(provider),
208513
208533
  ...maxOutputSize !== void 0 ? { defaultMaxTokens: maxOutputSize } : {},
208514
208534
  ...adaptiveThinking !== void 0 ? { adaptiveThinking } : {},
208535
+ ...provider.type === "kimi" ? { kimiThinking: true } : {},
208515
208536
  ...betaApi !== void 0 ? { betaApi } : {},
208516
208537
  ...promptCacheKey !== void 0 ? { metadata: { user_id: promptCacheKey } } : {},
208517
208538
  ...defaultHeadersField(provider.type === "kimi" && modelProtocol === "anthropic" ? {
@@ -208543,7 +208564,6 @@ function toKosongProviderConfig$1(provider, model, modelProtocol, kimiRequestHea
208543
208564
  baseUrl: providerValue(provider.baseUrl, provider.env, "KIMI_BASE_URL"),
208544
208565
  apiKey: providerApiKey(provider),
208545
208566
  generationKwargs: { prompt_cache_key: promptCacheKey },
208546
- supportEfforts,
208547
208567
  ...defaultHeadersField({
208548
208568
  ...envCustomHeaders,
208549
208569
  ...kimiRequestHeaders,
@@ -208671,12 +208691,14 @@ var init_provider_manager$1 = __esmMin((() => {
208671
208691
  const providerConfig = this.config.providers[providerName];
208672
208692
  if (providerConfig === void 0) throw new KimiError(ErrorCodes$1.CONFIG_INVALID, `Provider "${providerName}" for model "${model}" is not configured.`);
208673
208693
  if (!Number.isInteger(effectiveAlias.maxContextSize) || effectiveAlias.maxContextSize <= 0) throw new KimiError(ErrorCodes$1.CONFIG_INVALID, `Model "${model}" must define a positive max_context_size in config.toml.`);
208674
- const provider = toKosongProviderConfig$1(providerConfig, alias.model, alias.protocol, this.options.kimiRequestHeaders, effectiveAlias.maxOutputSize, effectiveAlias.reasoningKey, this.options.promptCacheKey, effectiveAlias.adaptiveThinking, alias.betaApi, effectiveAlias.supportEfforts);
208694
+ const provider = toKosongProviderConfig$1(providerConfig, alias.model, alias.protocol, this.options.kimiRequestHeaders, effectiveAlias.maxOutputSize, effectiveAlias.reasoningKey, this.options.promptCacheKey, effectiveAlias.adaptiveThinking, alias.betaApi);
208675
208695
  return {
208676
208696
  providerName,
208677
208697
  provider,
208678
208698
  modelCapabilities: resolveModelCapabilities$1(effectiveAlias, provider),
208679
208699
  alwaysThinking: (effectiveAlias.capabilities ?? []).some((c) => c.trim().toLowerCase() === "always_thinking"),
208700
+ supportEfforts: effectiveAlias.supportEfforts,
208701
+ defaultEffort: effectiveAlias.defaultEffort,
208680
208702
  maxOutputSize: effectiveAlias.maxOutputSize,
208681
208703
  type: providerConfig.type,
208682
208704
  protocol: alias.protocol
@@ -227755,7 +227777,7 @@ var init_tui = __esmMin((() => {
227755
227777
  if (!debugRedraw) return;
227756
227778
  const logPath = path$15.join(nodeOs.homedir(), ".pi", "agent", "pi-debug.log");
227757
227779
  const msg = `[${(/* @__PURE__ */ new Date()).toISOString()}] fullRender: ${reason} (prev=${this.previousLines.length}, new=${newLines.length}, height=${height})\n`;
227758
- fs$16.appendFileSync(logPath, msg);
227780
+ fs$17.appendFileSync(logPath, msg);
227759
227781
  };
227760
227782
  if (this.previousLines.length === 0 && !widthChanged && !heightChanged) {
227761
227783
  logRedraw("first render");
@@ -227902,7 +227924,7 @@ var init_tui = __esmMin((() => {
227902
227924
  buffer += "\x1B[?2026l";
227903
227925
  if (process.env["PI_TUI_DEBUG"] === "1") {
227904
227926
  const debugDir = "/tmp/tui";
227905
- fs$16.mkdirSync(debugDir, { recursive: true });
227927
+ fs$17.mkdirSync(debugDir, { recursive: true });
227906
227928
  const debugPath = path$15.join(debugDir, `render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`);
227907
227929
  const debugData = [
227908
227930
  `firstChanged: ${firstChanged}`,
@@ -227926,7 +227948,7 @@ var init_tui = __esmMin((() => {
227926
227948
  "=== buffer ===",
227927
227949
  JSON.stringify(buffer)
227928
227950
  ].join("\n");
227929
- fs$16.writeFileSync(debugPath, debugData);
227951
+ fs$17.writeFileSync(debugPath, debugData);
227930
227952
  }
227931
227953
  this.terminal.write(buffer);
227932
227954
  this.cursorRow = Math.max(0, newLines.length - 1);
@@ -232604,7 +232626,7 @@ var init_terminal$3 = __esmMin((() => {
232604
232626
  const env = process.env["PI_TUI_WRITE_LOG"] || "";
232605
232627
  if (!env) return "";
232606
232628
  try {
232607
- if (fs$16.statSync(env).isDirectory()) {
232629
+ if (fs$17.statSync(env).isDirectory()) {
232608
232630
  const now = /* @__PURE__ */ new Date();
232609
232631
  const ts = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}_${String(now.getHours()).padStart(2, "0")}-${String(now.getMinutes()).padStart(2, "0")}-${String(now.getSeconds()).padStart(2, "0")}`;
232610
232632
  return path$15.join(env, `tui-${ts}-${process.pid}.log`);
@@ -232842,7 +232864,7 @@ var init_terminal$3 = __esmMin((() => {
232842
232864
  write(data) {
232843
232865
  process.stdout.write(data);
232844
232866
  if (this.writeLogPath) try {
232845
- fs$16.appendFileSync(this.writeLogPath, data, { encoding: "utf8" });
232867
+ fs$17.appendFileSync(this.writeLogPath, data, { encoding: "utf8" });
232846
232868
  } catch {}
232847
232869
  }
232848
232870
  get columns() {
@@ -235069,7 +235091,7 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
235069
235091
  const EventEmitter$10 = __require("node:events").EventEmitter;
235070
235092
  const childProcess = __require("node:child_process");
235071
235093
  const path$6 = __require("node:path");
235072
- const fs$4 = __require("node:fs");
235094
+ const fs$5 = __require("node:fs");
235073
235095
  const process$2 = __require("node:process");
235074
235096
  const { Argument, humanReadableArgName } = require_argument();
235075
235097
  const { CommanderError } = require_error$2();
@@ -235952,7 +235974,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
235952
235974
  * @param {string} subcommandName
235953
235975
  */
235954
235976
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
235955
- if (fs$4.existsSync(executableFile)) return;
235977
+ if (fs$5.existsSync(executableFile)) return;
235956
235978
  const executableMissing = `'${executableFile}' does not exist
235957
235979
  - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
235958
235980
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
@@ -235976,9 +235998,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
235976
235998
  ];
235977
235999
  function findFile(baseDir, baseName) {
235978
236000
  const localBin = path$6.resolve(baseDir, baseName);
235979
- if (fs$4.existsSync(localBin)) return localBin;
236001
+ if (fs$5.existsSync(localBin)) return localBin;
235980
236002
  if (sourceExt.includes(path$6.extname(baseName))) return void 0;
235981
- const foundExt = sourceExt.find((ext) => fs$4.existsSync(`${localBin}${ext}`));
236003
+ const foundExt = sourceExt.find((ext) => fs$5.existsSync(`${localBin}${ext}`));
235982
236004
  if (foundExt) return `${localBin}${foundExt}`;
235983
236005
  }
235984
236006
  this._checkForMissingMandatoryOptions();
@@ -235988,7 +236010,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
235988
236010
  if (this._scriptPath) {
235989
236011
  let resolvedScriptPath;
235990
236012
  try {
235991
- resolvedScriptPath = fs$4.realpathSync(this._scriptPath);
236013
+ resolvedScriptPath = fs$5.realpathSync(this._scriptPath);
235992
236014
  } catch {
235993
236015
  resolvedScriptPath = this._scriptPath;
235994
236016
  }
@@ -246438,6 +246460,15 @@ function classifyBaseApiError(message) {
246438
246460
  if (NETWORK_RE$1.test(message)) return new APIConnectionError(message);
246439
246461
  return new ChatProviderError(`Error: ${message}`);
246440
246462
  }
246463
+ function appendThinkingEffortConfigHint(statusCode, message) {
246464
+ if (statusCode !== 400 && statusCode !== 422) return message;
246465
+ const lowerMessage = message.toLowerCase();
246466
+ if (!THINKING_EFFORT_STATUS_MESSAGE_PATTERNS.some((pattern) => pattern.test(lowerMessage))) return message;
246467
+ if (message.includes(THINKING_EFFORT_CONFIG_DOCS_URL)) return message;
246468
+ return `${message}
246469
+
246470
+ The provider rejected the configured thinking effort. Non-Kimi providers receive effort strings without client-side mapping; choose an effort supported by the selected model. For Kimi models, check support_efforts and default_effort. See ${THINKING_EFFORT_CONFIG_DOCS_URL}`;
246471
+ }
246441
246472
  function isContextOverflowErrorCode(code) {
246442
246473
  return code === "context_length_exceeded";
246443
246474
  }
@@ -246446,7 +246477,7 @@ function normalizeAPIStatusError(statusCode, message, requestId, retryAfterMs) {
246446
246477
  if (isContextOverflowStatusError(statusCode, message)) return new APIContextOverflowError(statusCode, message, requestId, retryAfterMs);
246447
246478
  if (isRequestTooLargeStatusError(statusCode, message)) return new APIRequestTooLargeError(statusCode, message, requestId, retryAfterMs);
246448
246479
  if (isProviderOverloadStatusError(statusCode, message)) return new APIProviderOverloadedError(statusCode, message, requestId, retryAfterMs);
246449
- return new APIStatusError(statusCode, message, requestId, retryAfterMs);
246480
+ return new APIStatusError(statusCode, appendThinkingEffortConfigHint(statusCode, message), requestId, retryAfterMs);
246450
246481
  }
246451
246482
  function parseRetryAfterMs(headers) {
246452
246483
  const raw = headers !== null && typeof headers === "object" && typeof headers.get === "function" ? headers.get("retry-after") : null;
@@ -246511,7 +246542,7 @@ function getStatusCode(error) {
246511
246542
  function errorMessage$7(error) {
246512
246543
  return error instanceof Error ? error.message : String(error);
246513
246544
  }
246514
- var ChatProviderError, APIConnectionError, APITimeoutError, APIStatusError, APIContextOverflowError, APIRequestTooLargeError, APIProviderRateLimitError, APIProviderOverloadedError, APIEmptyResponseError, IMAGE_FORMAT_PROVIDER_MESSAGE_PATTERNS, IMAGE_FORMAT_STATUS_MESSAGE_PATTERNS, MEDIA_TYPE_FIELD_PATTERN, NETWORK_RE$1, TIMEOUT_RE$1, CONTEXT_OVERFLOW_MESSAGE_PATTERNS, PROVIDER_RATE_LIMIT_MESSAGE_PATTERNS, PROVIDER_OVERLOAD_MESSAGE_PATTERNS, REQUEST_TOO_LARGE_MESSAGE_PATTERNS, TOOL_EXCHANGE_ADJACENCY_MESSAGE_PATTERNS, STRUCTURAL_REQUEST_MESSAGE_PATTERNS;
246545
+ var ChatProviderError, APIConnectionError, APITimeoutError, APIStatusError, APIContextOverflowError, APIRequestTooLargeError, APIProviderRateLimitError, APIProviderOverloadedError, APIEmptyResponseError, IMAGE_FORMAT_PROVIDER_MESSAGE_PATTERNS, IMAGE_FORMAT_STATUS_MESSAGE_PATTERNS, MEDIA_TYPE_FIELD_PATTERN, NETWORK_RE$1, TIMEOUT_RE$1, CONTEXT_OVERFLOW_MESSAGE_PATTERNS, PROVIDER_RATE_LIMIT_MESSAGE_PATTERNS, PROVIDER_OVERLOAD_MESSAGE_PATTERNS, REQUEST_TOO_LARGE_MESSAGE_PATTERNS, THINKING_EFFORT_CONFIG_DOCS_URL, THINKING_EFFORT_STATUS_MESSAGE_PATTERNS, TOOL_EXCHANGE_ADJACENCY_MESSAGE_PATTERNS, STRUCTURAL_REQUEST_MESSAGE_PATTERNS;
246515
246546
  var init_errors$21 = __esmMin((() => {
246516
246547
  ChatProviderError = class extends Error {
246517
246548
  constructor(message) {
@@ -246618,6 +246649,14 @@ var init_errors$21 = __esmMin((() => {
246618
246649
  /content too large/,
246619
246650
  /request (?:body )?too large/
246620
246651
  ];
246652
+ THINKING_EFFORT_CONFIG_DOCS_URL = "https://moonshotai.github.io/kimi-code/en/configuration/config-files.html#thinking";
246653
+ THINKING_EFFORT_STATUS_MESSAGE_PATTERNS = [
246654
+ /reasoning[_ .-]?effort/,
246655
+ /thinking[_ .-]?effort/,
246656
+ /output_config[\s\S]*effort/,
246657
+ /unsupported[\s\S]*effort/,
246658
+ /invalid[\s\S]*effort/
246659
+ ];
246621
246660
  TOOL_EXCHANGE_ADJACENCY_MESSAGE_PATTERNS = [
246622
246661
  /tool_use[\s\S]*tool_result/,
246623
246662
  /tool_result[\s\S]*tool_use/,
@@ -248348,7 +248387,7 @@ async function syncDir(dirPath) {
248348
248387
  }
248349
248388
  function syncFd(fd) {
248350
248389
  return new Promise((resolve, reject) => {
248351
- fs$16.fsync(fd, (err) => {
248390
+ fs$17.fsync(fd, (err) => {
248352
248391
  if (err) {
248353
248392
  reject(err);
248354
248393
  return;
@@ -256696,6 +256735,7 @@ var init_anthropic = __esmMin((() => {
256696
256735
  _defaultHeaders;
256697
256736
  _clientFactory;
256698
256737
  _adaptiveThinking;
256738
+ _kimiThinking;
256699
256739
  _betaApi;
256700
256740
  _explicitMaxTokens;
256701
256741
  constructor(options) {
@@ -256703,6 +256743,7 @@ var init_anthropic = __esmMin((() => {
256703
256743
  this._stream = options.stream ?? true;
256704
256744
  this._metadata = options.metadata;
256705
256745
  this._adaptiveThinking = options.adaptiveThinking;
256746
+ this._kimiThinking = options.kimiThinking ?? false;
256706
256747
  this._betaApi = options.betaApi ?? false;
256707
256748
  this._apiKey = options.apiKey === void 0 || options.apiKey.length === 0 ? void 0 : options.apiKey;
256708
256749
  this._baseUrl = options.baseUrl;
@@ -256722,18 +256763,11 @@ var init_anthropic = __esmMin((() => {
256722
256763
  const thinkingConfig = this._generationKwargs.thinking;
256723
256764
  if (thinkingConfig === void 0 || thinkingConfig === null) return null;
256724
256765
  if (thinkingConfig.type === "disabled") return "off";
256725
- if (thinkingConfig.type === "adaptive") {
256726
- const effort = this._generationKwargs.output_config?.effort;
256727
- if (effort === void 0 || effort === null) return "high";
256728
- switch (effort) {
256729
- case "low":
256730
- case "medium":
256731
- case "high":
256732
- case "xhigh":
256733
- case "max": return effort;
256734
- }
256735
- }
256736
- const budget = thinkingConfig.budget_tokens ?? 0;
256766
+ const effort = this._generationKwargs.output_config?.effort;
256767
+ if (typeof effort === "string" && effort.length > 0) return effort;
256768
+ if (thinkingConfig.type === "adaptive") return "high";
256769
+ const budget = thinkingConfig.budget_tokens;
256770
+ if (budget === void 0) return "on";
256737
256771
  if (budget <= 1024) return "low";
256738
256772
  if (budget <= 4096) return "medium";
256739
256773
  return "high";
@@ -256869,21 +256903,28 @@ var init_anthropic = __esmMin((() => {
256869
256903
  delete clone._generationKwargs.output_config;
256870
256904
  return clone;
256871
256905
  }
256872
- const clamped = clampEffort(effort, this._model, adaptive);
256873
- if (clamped === "off") throw new Error("Non-off thinking effort unexpectedly clamped to off.");
256874
- const effectiveEffort = clamped;
256875
256906
  let newBetas = [...this._generationKwargs.betaFeatures ?? []];
256876
- if (adaptive) {
256877
- newBetas = newBetas.filter((b) => b !== INTERLEAVED_THINKING_BETA);
256878
- return this._withGenerationKwargs({
256879
- thinking: {
256880
- type: "adaptive",
256881
- display: "summarized"
256882
- },
256883
- output_config: { effort: effectiveEffort },
256907
+ if (adaptive) newBetas = newBetas.filter((b) => b !== INTERLEAVED_THINKING_BETA);
256908
+ if (this._kimiThinking) {
256909
+ const clone = this._withGenerationKwargs({
256910
+ thinking: { type: "enabled" },
256884
256911
  betaFeatures: newBetas
256885
256912
  });
256913
+ if (effort === "on") delete clone._generationKwargs.output_config;
256914
+ else clone._generationKwargs.output_config = { effort };
256915
+ return clone;
256886
256916
  }
256917
+ const clamped = clampEffort(effort, this._model, adaptive);
256918
+ if (clamped === "off") throw new Error("Non-off thinking effort unexpectedly clamped to off.");
256919
+ const effectiveEffort = clamped;
256920
+ if (adaptive) return this._withGenerationKwargs({
256921
+ thinking: {
256922
+ type: "adaptive",
256923
+ display: "summarized"
256924
+ },
256925
+ output_config: { effort: effectiveEffort },
256926
+ betaFeatures: newBetas
256927
+ });
256887
256928
  const kwargs = {
256888
256929
  thinking: {
256889
256930
  type: "enabled",
@@ -258114,30 +258155,6 @@ function convertOpenAIError(error) {
258114
258155
  function isFunctionToolCall(tc) {
258115
258156
  return tc.type === "function";
258116
258157
  }
258117
- function thinkingEffortToReasoningEffort(effort) {
258118
- switch (effort) {
258119
- case "off": return;
258120
- case "low": return "low";
258121
- case "medium": return "medium";
258122
- case "high": return "high";
258123
- case "xhigh":
258124
- case "max": return "xhigh";
258125
- default: return;
258126
- }
258127
- }
258128
- function reasoningEffortToThinkingEffort(reasoning) {
258129
- if (reasoning === void 0 || reasoning === null) return null;
258130
- switch (reasoning) {
258131
- case "low":
258132
- case "minimal": return "low";
258133
- case "medium": return "medium";
258134
- case "high": return "high";
258135
- case "xhigh":
258136
- case "max": return "xhigh";
258137
- case "none": return "off";
258138
- default: return "off";
258139
- }
258140
- }
258141
258158
  function extractUsage(usage) {
258142
258159
  if (usage === null || usage === void 0 || typeof usage !== "object") return null;
258143
258160
  const u = usage;
@@ -258236,11 +258253,11 @@ var init_kimi_files = __esmMin((() => {
258236
258253
  async uploadVideo(input, options) {
258237
258254
  let file;
258238
258255
  if (typeof input === "string") {
258239
- if (!fs$16.existsSync(input)) throw new ChatProviderError(`Video file not found: ${input}`);
258256
+ if (!fs$17.existsSync(input)) throw new ChatProviderError(`Video file not found: ${input}`);
258240
258257
  const filename = path$15.basename(input);
258241
258258
  const mimeType = guessMimeTypeFromExt(filename);
258242
258259
  if (mimeType === void 0 || !mimeType.startsWith("video/")) throw new ChatProviderError(`KimiFiles.uploadVideo: file extension does not indicate a video type: ${filename}`);
258243
- const data = await fs$16.promises.readFile(input);
258260
+ const data = await fs$17.promises.readFile(input);
258244
258261
  file = new File$1([new Blob$1([new Uint8Array(data)], { type: mimeType })], filename, { type: mimeType });
258245
258262
  } else {
258246
258263
  if (!input.mimeType.startsWith("video/")) throw new ChatProviderError(`Expected a video mime type, got ${input.mimeType}`);
@@ -258352,7 +258369,7 @@ function isEffectivelyEmptyContent(parts) {
258352
258369
  }
258353
258370
  return true;
258354
258371
  }
258355
- function convertMessage$2(message) {
258372
+ function convertMessage$2(message, preservedThinkingEnabled) {
258356
258373
  let reasoningContent = "";
258357
258374
  let hasReasoningPart = false;
258358
258375
  const nonThinkParts = [];
@@ -258381,7 +258398,7 @@ function convertMessage$2(message) {
258381
258398
  return mapped;
258382
258399
  });
258383
258400
  if (message.toolCallId !== void 0) result.tool_call_id = message.toolCallId;
258384
- if (hasReasoningPart) result.reasoning_content = reasoningContent;
258401
+ if (hasReasoningPart || preservedThinkingEnabled && message.role === "assistant") result.reasoning_content = reasoningContent;
258385
258402
  if (message.tools !== void 0 && message.tools.length > 0) result.tools = message.tools.map((tool) => convertTool$1(tool));
258386
258403
  return result;
258387
258404
  }
@@ -258525,7 +258542,6 @@ var init_kimi = __esmMin((() => {
258525
258542
  _baseUrl;
258526
258543
  _defaultHeaders;
258527
258544
  _generationKwargs;
258528
- _supportEfforts;
258529
258545
  _client;
258530
258546
  _clientFactory;
258531
258547
  _files;
@@ -258538,7 +258554,6 @@ var init_kimi = __esmMin((() => {
258538
258554
  this._model = options.model;
258539
258555
  this._stream = options.stream ?? true;
258540
258556
  this._generationKwargs = { ...options.generationKwargs };
258541
- this._supportEfforts = options.supportEfforts ?? [];
258542
258557
  this._client = this._apiKey === void 0 ? void 0 : new OpenAI({
258543
258558
  apiKey: this._apiKey,
258544
258559
  baseURL: this._baseUrl,
@@ -258582,8 +258597,10 @@ var init_kimi = __esmMin((() => {
258582
258597
  role: "system",
258583
258598
  content: systemPrompt
258584
258599
  });
258600
+ const thinking = this._generationKwargs.extra_body?.thinking;
258601
+ const preservedThinkingEnabled = thinking?.keep === "all" && thinking.type !== "disabled";
258585
258602
  const normalizedHistory = normalizeToolCallIdsForProvider(history, KIMI_TOOL_CALL_ID_POLICY);
258586
- for (const msg of normalizedHistory) messages.push(convertMessage$2(msg));
258603
+ for (const msg of normalizedHistory) messages.push(convertMessage$2(msg, preservedThinkingEnabled));
258587
258604
  const kwargs = { ...this._generationKwargs };
258588
258605
  for (const key of Object.keys(kwargs)) if (kwargs[key] === void 0) delete kwargs[key];
258589
258606
  if (kwargs["max_completion_tokens"] === void 0 && kwargs["max_tokens"] !== void 0) kwargs["max_completion_tokens"] = kwargs["max_tokens"];
@@ -258610,10 +258627,10 @@ var init_kimi = __esmMin((() => {
258610
258627
  withThinking(effort) {
258611
258628
  let thinking;
258612
258629
  if (effort === "off") thinking = { type: "disabled" };
258613
- else thinking = this._supportEfforts.includes(effort) ? {
258630
+ else thinking = effort === "on" ? { type: "enabled" } : {
258614
258631
  type: "enabled",
258615
258632
  effort
258616
- } : { type: "enabled" };
258633
+ };
258617
258634
  const oldExtra = this._generationKwargs.extra_body ?? {};
258618
258635
  const keep = oldExtra.thinking?.keep;
258619
258636
  if (keep !== void 0) thinking = {
@@ -258927,7 +258944,8 @@ var init_openai_legacy = __esmMin((() => {
258927
258944
  return this._model;
258928
258945
  }
258929
258946
  get thinkingEffort() {
258930
- return reasoningEffortToThinkingEffort(this._reasoningEffort);
258947
+ if (this._reasoningEffort === void 0) return null;
258948
+ return this._reasoningEffort === "none" ? "off" : this._reasoningEffort;
258931
258949
  }
258932
258950
  get maxCompletionTokens() {
258933
258951
  return this._generationKwargs.max_completion_tokens ?? this._generationKwargs.max_tokens;
@@ -258972,7 +258990,7 @@ var init_openai_legacy = __esmMin((() => {
258972
258990
  }
258973
258991
  }
258974
258992
  withThinking(effort) {
258975
- const reasoningEffort = thinkingEffortToReasoningEffort(effort);
258993
+ const reasoningEffort = effort === "off" || effort === "on" ? void 0 : effort;
258976
258994
  const clone = this._clone();
258977
258995
  clone._reasoningEffort = reasoningEffort;
258978
258996
  return clone;
@@ -259677,7 +259695,9 @@ var init_openai_responses = __esmMin((() => {
259677
259695
  return this._model;
259678
259696
  }
259679
259697
  get thinkingEffort() {
259680
- return reasoningEffortToThinkingEffort(this._generationKwargs.reasoning_effort);
259698
+ const effort = this._generationKwargs.reasoning_effort;
259699
+ if (effort === void 0) return null;
259700
+ return effort === "none" ? "off" : effort;
259681
259701
  }
259682
259702
  get maxCompletionTokens() {
259683
259703
  return this._generationKwargs.max_output_tokens;
@@ -259727,7 +259747,7 @@ var init_openai_responses = __esmMin((() => {
259727
259747
  }
259728
259748
  }
259729
259749
  withThinking(effort) {
259730
- const reasoningEffort = thinkingEffortToReasoningEffort(effort);
259750
+ const reasoningEffort = effort === "off" || effort === "on" ? void 0 : effort;
259731
259751
  const clone = this._clone();
259732
259752
  clone._generationKwargs = {
259733
259753
  ...clone._generationKwargs,
@@ -260403,6 +260423,7 @@ var init_modelImpl = __esmMin((() => {
260403
260423
  authProvider;
260404
260424
  thinkingEffort;
260405
260425
  alwaysThinking;
260426
+ providerType;
260406
260427
  providerName;
260407
260428
  protocolRegistry;
260408
260429
  providerOptions;
@@ -260427,6 +260448,7 @@ var init_modelImpl = __esmMin((() => {
260427
260448
  this.providerOptions = init.providerOptions ?? {};
260428
260449
  this.transforms = transforms;
260429
260450
  this.alwaysThinking = init.alwaysThinking;
260451
+ this.providerType = init.providerType;
260430
260452
  this.providerName = init.providerName;
260431
260453
  this.thinkingEffort = null;
260432
260454
  }
@@ -260446,6 +260468,7 @@ var init_modelImpl = __esmMin((() => {
260446
260468
  supportEfforts: this.supportEfforts,
260447
260469
  defaultEffort: this.defaultEffort,
260448
260470
  alwaysThinking: this.alwaysThinking,
260471
+ providerType: this.providerType,
260449
260472
  providerName: this.providerName,
260450
260473
  authProvider: this.authProvider,
260451
260474
  protocolRegistry: this.protocolRegistry,
@@ -260616,6 +260639,13 @@ function nonEmpty$3(value) {
260616
260639
  const trimmed = value?.trim();
260617
260640
  return trimmed === void 0 || trimmed.length === 0 ? void 0 : trimmed;
260618
260641
  }
260642
+ function normalizeRequestedThinkingEffort(requested) {
260643
+ return nonEmpty$3(requested)?.toLowerCase();
260644
+ }
260645
+ function resolveKimiThinkingEffortOverride(forced, effective, kimiProvider) {
260646
+ if (!kimiProvider || effective === "off") return void 0;
260647
+ return nonEmpty$3(forced);
260648
+ }
260619
260649
  function hasCapability(capabilities, capability) {
260620
260650
  if (capabilities === void 0) return false;
260621
260651
  if (isCapabilityList(capabilities)) return capabilities.some((candidate) => candidate.trim().toLowerCase() === capability);
@@ -260631,25 +260661,46 @@ function isCapabilityList(capabilities) {
260631
260661
  function middleOf(values) {
260632
260662
  return values[Math.floor(values.length / 2)];
260633
260663
  }
260664
+ function effortsFor(model) {
260665
+ return model?.supportEfforts?.map(nonEmpty$3).filter((v) => v !== void 0) ?? [];
260666
+ }
260634
260667
  function modelSupportsThinking(model) {
260635
260668
  if (model === void 0) return false;
260636
260669
  return model.alwaysThinking === true || model.adaptiveThinking === true || hasCapability(model.capabilities, "thinking") || hasCapability(model.capabilities, "always_thinking");
260637
260670
  }
260638
260671
  function defaultThinkingEffortForModel(model) {
260639
260672
  if (model === void 0 || !modelSupportsThinking(model)) return "off";
260640
- const efforts = model.supportEfforts?.map(nonEmpty$3).filter((v) => v !== void 0);
260641
- if (efforts !== void 0 && efforts.length > 0) return nonEmpty$3(model.defaultEffort) ?? middleOf(efforts);
260673
+ const efforts = effortsFor(model);
260674
+ if (efforts.length > 0) {
260675
+ const declaredDefault = nonEmpty$3(model.defaultEffort);
260676
+ return declaredDefault !== void 0 && efforts.includes(declaredDefault) ? declaredDefault : middleOf(efforts);
260677
+ }
260642
260678
  return "on";
260643
260679
  }
260644
- function resolveThinkingEffortForModel(requested, defaults, model) {
260680
+ function modelSupportsThinkingEffort(effort, model, kimiProvider) {
260681
+ if (!kimiProvider || effort === "off") return true;
260682
+ if (!modelSupportsThinking(model)) return false;
260683
+ const efforts = effortsFor(model);
260684
+ return efforts.length === 0 || effort === "on" || efforts.includes(effort);
260685
+ }
260686
+ function normalizeThinkingEffortForModel(effort, model, kimiProvider) {
260687
+ if (effort === "off" && model?.alwaysThinking !== true) return "off";
260688
+ const efforts = effortsFor(model);
260689
+ if (!kimiProvider) return effort === "on" && efforts.length > 0 ? defaultThinkingEffortForModel(model) : effort;
260690
+ if (!modelSupportsThinking(model)) return "off";
260691
+ if (efforts.length === 0) return "on";
260692
+ if (effort === "on" || !efforts.includes(effort)) return defaultThinkingEffortForModel(model);
260693
+ return effort;
260694
+ }
260695
+ function resolveThinkingEffortForModel(requested, defaults, model, kimiProvider = false) {
260645
260696
  const configured = nonEmpty$3(defaults?.effort);
260646
- const normalized = nonEmpty$3(requested)?.toLowerCase();
260697
+ const normalized = normalizeRequestedThinkingEffort(requested);
260647
260698
  let effort;
260648
260699
  if (normalized !== void 0) effort = normalized;
260649
260700
  else if (defaults?.enabled === false) effort = "off";
260650
260701
  else effort = configured ?? defaultThinkingEffortForModel(model);
260651
- if (effort === "off" && model?.alwaysThinking === true) return configured ?? defaultThinkingEffortForModel(model);
260652
- return effort;
260702
+ if (effort === "off" && model?.alwaysThinking === true) effort = configured ?? defaultThinkingEffortForModel(model);
260703
+ return normalizeThinkingEffortForModel(effort, model, kimiProvider);
260653
260704
  }
260654
260705
  var init_thinking$2 = __esmMin((() => {}));
260655
260706
  //#endregion
@@ -260688,6 +260739,7 @@ function buildProtocolProviderOptions(model, protocol, provider, baseUrl) {
260688
260739
  case "anthropic":
260689
260740
  if (model.maxOutputSize !== void 0) options.defaultMaxTokens = model.maxOutputSize;
260690
260741
  if (model.adaptiveThinking !== void 0) options.adaptiveThinking = model.adaptiveThinking;
260742
+ if (provider?.type === "kimi") options.kimiThinking = true;
260691
260743
  if (model.betaApi !== void 0) options.betaApi = model.betaApi;
260692
260744
  break;
260693
260745
  case "openai": {
@@ -260695,9 +260747,7 @@ function buildProtocolProviderOptions(model, protocol, provider, baseUrl) {
260695
260747
  if (reasoningKey !== void 0) options.reasoningKey = reasoningKey;
260696
260748
  break;
260697
260749
  }
260698
- case "kimi":
260699
- if (model.supportEfforts !== void 0) options.supportEfforts = model.supportEfforts;
260700
- break;
260750
+ case "kimi": break;
260701
260751
  case "vertexai": {
260702
260752
  const project = vertexAIProject(provider);
260703
260753
  const location = vertexAILocation(provider, baseUrl);
@@ -260797,6 +260847,7 @@ var init_modelResolverService = __esmMin((() => {
260797
260847
  });
260798
260848
  const authProvider = this.buildAuthProvider(providerName, auth);
260799
260849
  const protocol = this.resolveProtocol(id, model, providerConfig);
260850
+ const providerType = providerConfig?.type ?? protocol;
260800
260851
  const resolvedBaseUrl = model.protocol === "anthropic" && rawBaseUrl !== void 0 ? stripTrailingV1(rawBaseUrl) : rawBaseUrl;
260801
260852
  const wireName = model.name ?? model.model;
260802
260853
  if (wireName === void 0) throw new Error2(ErrorCodes.CONFIG_INVALID, `Model "${id}" must define a wire-facing name in config.toml.`);
@@ -260819,23 +260870,25 @@ var init_modelResolverService = __esmMin((() => {
260819
260870
  supportEfforts: model.supportEfforts,
260820
260871
  defaultEffort: model.defaultEffort,
260821
260872
  alwaysThinking,
260873
+ providerType,
260822
260874
  providerName,
260823
260875
  authProvider,
260824
260876
  protocolRegistry: this.protocolRegistry,
260825
260877
  providerOptions
260826
260878
  });
260827
- const effort = this.resolveDefaultThinking(model, alwaysThinking);
260879
+ const effort = this.resolveDefaultThinking(model, alwaysThinking, providerType === "kimi");
260828
260880
  return effort === "off" ? impl : impl.withThinking(effort);
260829
260881
  }
260830
- resolveDefaultThinking(model, alwaysThinking) {
260882
+ resolveDefaultThinking(model, alwaysThinking, kimiProvider) {
260831
260883
  const thinking = this.config.get("thinking");
260832
- return resolveThinkingEffortForModel(void 0, {
260884
+ const effort = resolveThinkingEffortForModel(void 0, {
260833
260885
  enabled: thinking?.enabled,
260834
260886
  effort: thinking?.effort
260835
260887
  }, {
260836
260888
  ...model,
260837
260889
  alwaysThinking
260838
- });
260890
+ }, kimiProvider);
260891
+ return resolveKimiThinkingEffortOverride(thinking?.forcedEffort, effort, kimiProvider) ?? effort;
260839
260892
  }
260840
260893
  findByName(name) {
260841
260894
  const out = [];
@@ -266928,7 +266981,7 @@ var init_goalService = __esmMin((() => {
266928
266981
  const snapshot = this.toSnapshot(completed);
266929
266982
  this.emitCompletion(completed, snapshot, input.reason, actor);
266930
266983
  this.trackStatusChanged(completed, actor);
266931
- this.clearInternal(actor);
266984
+ this.clearInternal(actor, { preserveLiveContinuation: true });
266932
266985
  return snapshot;
266933
266986
  }
266934
266987
  dispatchCompletion(state, reason, actor) {
@@ -267099,8 +267152,9 @@ var init_goalService = __esmMin((() => {
267099
267152
  const status = this.loopService.status();
267100
267153
  return status.state === "idle" && !status.hasPendingRequests;
267101
267154
  }
267102
- cancelPendingContinuation() {
267155
+ cancelPendingContinuation(preserveLiveContinuation = false) {
267103
267156
  const pending = this.pendingContinuation;
267157
+ if (preserveLiveContinuation && pending?.turnId === this.liveTurnId) return;
267104
267158
  this.pendingContinuation = void 0;
267105
267159
  pending?.receipt.abort();
267106
267160
  }
@@ -267134,7 +267188,7 @@ var init_goalService = __esmMin((() => {
267134
267188
  }
267135
267189
  clearInternal(actor, opts = {}) {
267136
267190
  if (this.goalState === null) return;
267137
- this.cancelPendingContinuation();
267191
+ this.cancelPendingContinuation(opts.preserveLiveContinuation === true);
267138
267192
  this.wallClockResumedAt = void 0;
267139
267193
  this.wire.dispatch(clearGoal({}));
267140
267194
  if (opts.emit !== false) this.emitGoalUpdated(null);
@@ -276731,7 +276785,6 @@ var init_sessionLegacyService = __esmMin((() => {
276731
276785
  const permission = agent.accessor.get(IAgentPermissionModeService);
276732
276786
  const plan = agent.accessor.get(IAgentPlanService);
276733
276787
  const swarm = agent.accessor.get(IAgentSwarmService);
276734
- const profileData = profile.data();
276735
276788
  const model = profile.getModel();
276736
276789
  const caps = profile.getModelCapabilities();
276737
276790
  const maxTokens = model === "" ? resolveDefaultModelContextTokens(agent) : caps.max_context_tokens ?? 0;
@@ -276740,7 +276793,7 @@ var init_sessionLegacyService = __esmMin((() => {
276740
276793
  return {
276741
276794
  status: session?.accessor.get(ISessionActivity).status() ?? "idle",
276742
276795
  model: model === "" ? void 0 : model,
276743
- thinking_level: profileData.thinkingLevel,
276796
+ thinking_level: profile.getEffectiveThinkingLevel(),
276744
276797
  permission: permission.mode,
276745
276798
  plan_mode: planData !== null,
276746
276799
  swarm_mode: swarm.isActive,
@@ -280685,7 +280738,7 @@ var init_wal = __esmMin((() => {
280685
280738
  }
280686
280739
  async open() {
280687
280740
  if (this.fh) return;
280688
- this.fh = await fs.open(this.path, "a");
280741
+ this.fh = await fs$1.open(this.path, "a");
280689
280742
  const st = await this.fh.stat();
280690
280743
  this.size = st.size;
280691
280744
  this.nextOffset = st.size;
@@ -280837,7 +280890,7 @@ var init_value_reader = __esmMin((() => {
280837
280890
  }
280838
280891
  openIfExists(file) {
280839
280892
  try {
280840
- return Vt.openSync(file, "r");
280893
+ return fs.openSync(file, "r");
280841
280894
  } catch (e) {
280842
280895
  if (e.code === "ENOENT") return null;
280843
280896
  throw e;
@@ -280854,7 +280907,7 @@ var init_value_reader = __esmMin((() => {
280854
280907
  const buf = Buffer.allocUnsafe(loc.len);
280855
280908
  let got = 0;
280856
280909
  while (got < loc.len) {
280857
- const r = Vt.readSync(fd, buf, got, loc.len - got, loc.off + got);
280910
+ const r = fs.readSync(fd, buf, got, loc.len - got, loc.off + got);
280858
280911
  if (r === 0) throw new Error(`value reader: short read from ${loc.file} at ${loc.off + got}`);
280859
280912
  got += r;
280860
280913
  }
@@ -280862,14 +280915,14 @@ var init_value_reader = __esmMin((() => {
280862
280915
  }
280863
280916
  reopenSnapshot() {
280864
280917
  if (this.snapshotFd !== null) {
280865
- Vt.closeSync(this.snapshotFd);
280918
+ fs.closeSync(this.snapshotFd);
280866
280919
  this.snapshotFd = null;
280867
280920
  }
280868
280921
  this.snapshotFd = this.openIfExists(this.snapshotPath);
280869
280922
  }
280870
280923
  reopenWal() {
280871
280924
  if (this.walFd !== null) {
280872
- Vt.closeSync(this.walFd);
280925
+ fs.closeSync(this.walFd);
280873
280926
  this.walFd = null;
280874
280927
  }
280875
280928
  this.walFd = this.openIfExists(this.walPath);
@@ -280880,11 +280933,11 @@ var init_value_reader = __esmMin((() => {
280880
280933
  }
280881
280934
  close() {
280882
280935
  if (this.snapshotFd !== null) {
280883
- Vt.closeSync(this.snapshotFd);
280936
+ fs.closeSync(this.snapshotFd);
280884
280937
  this.snapshotFd = null;
280885
280938
  }
280886
280939
  if (this.walFd !== null) {
280887
- Vt.closeSync(this.walFd);
280940
+ fs.closeSync(this.walFd);
280888
280941
  this.walFd = null;
280889
280942
  }
280890
280943
  }
@@ -280992,7 +281045,7 @@ function encodeBatchOps(ops) {
280992
281045
  function readExactSync(fd, buf, pos) {
280993
281046
  let got = 0;
280994
281047
  while (got < buf.length) {
280995
- const r = Vt.readSync(fd, buf, got, buf.length - got, pos + got);
281048
+ const r = fs.readSync(fd, buf, got, buf.length - got, pos + got);
280996
281049
  if (r === 0) throw new Error("codec: short read past EOF");
280997
281050
  got += r;
280998
281051
  }
@@ -281050,7 +281103,7 @@ function findMagicSync(fd, start, size) {
281050
281103
  let pos = start;
281051
281104
  while (pos < size) {
281052
281105
  const len = Math.min(MAGIC_SCAN_CHUNK, size - pos);
281053
- const n = Vt.readSync(fd, buf, 0, len, pos);
281106
+ const n = fs.readSync(fd, buf, 0, len, pos);
281054
281107
  if (n === 0) return -1;
281055
281108
  const idx = buf.subarray(0, n).indexOf(MAGIC);
281056
281109
  if (idx >= 0) return pos + idx;
@@ -281061,7 +281114,7 @@ function findMagicSync(fd, start, size) {
281061
281114
  }
281062
281115
  /** Scan an open snapshot/WAL fd into frame refs without copying values. */
281063
281116
  function scanFrameRefsFd(fd, { onCorrupt = "resync" } = {}) {
281064
- const size = Vt.fstatSync(fd).size;
281117
+ const size = fs.fstatSync(fd).size;
281065
281118
  const frames = [];
281066
281119
  const corruptRanges = [];
281067
281120
  let pos = 0;
@@ -281151,7 +281204,7 @@ function readAtSync(fd, off, len) {
281151
281204
  const buf = Buffer.allocUnsafe(len);
281152
281205
  let got = 0;
281153
281206
  while (got < len) {
281154
- const r = Vt.readSync(fd, buf, got, len - got, off + got);
281207
+ const r = fs.readSync(fd, buf, got, len - got, off + got);
281155
281208
  if (r === 0) throw new Error("recovery: short read past EOF");
281156
281209
  got += r;
281157
281210
  }
@@ -281199,25 +281252,25 @@ async function recover({ dir, store, mode = "resync", truncate = true, valueMode
281199
281252
  const walPath = path.join(dir, "db.wal");
281200
281253
  let snapshotFrames = 0;
281201
281254
  let snapshotCorrupt = [];
281202
- if (Vt.existsSync(snapPath)) {
281203
- const fd = Vt.openSync(snapPath, "r");
281255
+ if (fs.existsSync(snapPath)) {
281256
+ const fd = fs.openSync(snapPath, "r");
281204
281257
  try {
281205
281258
  const r = scanFrameRefsFd(fd, { onCorrupt: mode });
281206
281259
  applyFrames(r.frames, "snapshot", fd, store, valueMode);
281207
281260
  snapshotFrames = r.frames.length;
281208
281261
  snapshotCorrupt = r.corruptRanges;
281209
281262
  } finally {
281210
- Vt.closeSync(fd);
281263
+ fs.closeSync(fd);
281211
281264
  }
281212
281265
  }
281213
281266
  let walFrames = 0;
281214
281267
  let walCorrupt = [];
281215
281268
  let truncatedWal = false;
281216
- if (Vt.existsSync(walPath)) {
281217
- const fd = Vt.openSync(walPath, "r");
281269
+ if (fs.existsSync(walPath)) {
281270
+ const fd = fs.openSync(walPath, "r");
281218
281271
  let walSize = 0;
281219
281272
  try {
281220
- walSize = Vt.fstatSync(fd).size;
281273
+ walSize = fs.fstatSync(fd).size;
281221
281274
  const r = scanFrameRefsFd(fd, { onCorrupt: mode });
281222
281275
  applyFrames(r.frames, "wal", fd, store, valueMode);
281223
281276
  walFrames = r.frames.length;
@@ -281225,12 +281278,12 @@ async function recover({ dir, store, mode = "resync", truncate = true, valueMode
281225
281278
  const last = r.corruptRanges[r.corruptRanges.length - 1];
281226
281279
  if (last && last[1] === walSize) {
281227
281280
  if (truncate) {
281228
- await fs.truncate(walPath, last[0]);
281281
+ await fs$1.truncate(walPath, last[0]);
281229
281282
  truncatedWal = true;
281230
281283
  }
281231
281284
  }
281232
281285
  } finally {
281233
- Vt.closeSync(fd);
281286
+ fs.closeSync(fd);
281234
281287
  }
281235
281288
  }
281236
281289
  return {
@@ -281249,7 +281302,7 @@ var init_recovery = __esmMin((() => {
281249
281302
  //#region ../../packages/minidb/src/snapshot.ts
281250
281303
  async function writeSnapshot(store, tmpPath, opts = {}) {
281251
281304
  const yieldEvery = opts.yieldEvery ?? 2e3;
281252
- const fh = await fs.open(tmpPath, "w");
281305
+ const fh = await fs$1.open(tmpPath, "w");
281253
281306
  let count = 0;
281254
281307
  let bytes = 0;
281255
281308
  let batch = [];
@@ -281326,7 +281379,7 @@ function shouldCompact(db) {
281326
281379
  async function fsyncDir(dir) {
281327
281380
  let fh = null;
281328
281381
  try {
281329
- fh = await fs.open(dir, "r");
281382
+ fh = await fs$1.open(dir, "r");
281330
281383
  await fh.sync();
281331
281384
  } catch {} finally {
281332
281385
  if (fh) await fh.close().catch(() => {});
@@ -281340,10 +281393,10 @@ async function fsyncDir(dir) {
281340
281393
  * even when there is no post-fence tail). */
281341
281394
  async function copyFileRange(srcPath, dstPath, start, end, opts = {}) {
281342
281395
  if (end < start) throw new RangeError(`copyFileRange: end (${end}) < start (${start})`);
281343
- const dst = await fs.open(dstPath, opts.append ? "a" : "w");
281396
+ const dst = await fs$1.open(dstPath, opts.append ? "a" : "w");
281344
281397
  try {
281345
281398
  if (end > start) {
281346
- const src = await fs.open(srcPath, "r");
281399
+ const src = await fs$1.open(srcPath, "r");
281347
281400
  try {
281348
281401
  const buf = Buffer.allocUnsafe(COPY_CHUNK);
281349
281402
  let pos = start;
@@ -281414,9 +281467,9 @@ async function runCompaction(db) {
281414
281467
  const endOffset = db.wal.size;
281415
281468
  await copyFileRange(db.walPath, walTmp, copiedUpTo, endOffset, { append: appended });
281416
281469
  await db.wal.close();
281417
- await fs.rename(tmp, snap);
281470
+ await fs$1.rename(tmp, snap);
281418
281471
  await fsyncDir(db.dir);
281419
- await fs.rename(walTmp, db.walPath);
281472
+ await fs$1.rename(walTmp, db.walPath);
281420
281473
  await fsyncDir(db.dir);
281421
281474
  db.wal = new WAL(db.walPath, {
281422
281475
  fsyncPolicy: db.fsyncPolicy,
@@ -282018,7 +282071,7 @@ var init_text_postings = __esmMin((() => {
282018
282071
  */
282019
282072
  static open(filePath) {
282020
282073
  const pf = new PostingsFile(filePath);
282021
- pf.fd = Vt.openSync(filePath, "r");
282074
+ pf.fd = fs.openSync(filePath, "r");
282022
282075
  return pf;
282023
282076
  }
282024
282077
  get open() {
@@ -282030,7 +282083,7 @@ var init_text_postings = __esmMin((() => {
282030
282083
  const buf = Buffer.alloc(entry.len);
282031
282084
  let got = 0;
282032
282085
  while (got < entry.len) {
282033
- const r = Vt.readSync(this.fd, buf, got, entry.len - got, entry.off + got);
282086
+ const r = fs.readSync(this.fd, buf, got, entry.len - got, entry.off + got);
282034
282087
  if (r === 0) throw new Error("postings: short read past EOF");
282035
282088
  got += r;
282036
282089
  }
@@ -282038,7 +282091,7 @@ var init_text_postings = __esmMin((() => {
282038
282091
  }
282039
282092
  close() {
282040
282093
  if (this.fd !== null) {
282041
- Vt.closeSync(this.fd);
282094
+ fs.closeSync(this.fd);
282042
282095
  this.fd = null;
282043
282096
  }
282044
282097
  }
@@ -282051,7 +282104,7 @@ var init_text_postings = __esmMin((() => {
282051
282104
  */
282052
282105
  static rebuildSync(filePath, iter) {
282053
282106
  const tmp = filePath + ".tmp";
282054
- const fd = Vt.openSync(tmp, "w");
282107
+ const fd = fs.openSync(tmp, "w");
282055
282108
  const dict = /* @__PURE__ */ new Map();
282056
282109
  let off = 0;
282057
282110
  try {
@@ -282061,7 +282114,7 @@ var init_text_postings = __esmMin((() => {
282061
282114
  const rec = encodeRecord(term, entries.length, payload);
282062
282115
  let written = 0;
282063
282116
  while (written < rec.length) {
282064
- const w = Vt.writeSync(fd, rec, written, rec.length - written, off + written);
282117
+ const w = fs.writeSync(fd, rec, written, rec.length - written, off + written);
282065
282118
  if (w === 0) throw new Error("postings: rebuild write made no progress");
282066
282119
  written += w;
282067
282120
  }
@@ -282072,17 +282125,17 @@ var init_text_postings = __esmMin((() => {
282072
282125
  });
282073
282126
  off += rec.length;
282074
282127
  }
282075
- Vt.fsyncSync(fd);
282128
+ fs.fsyncSync(fd);
282076
282129
  } finally {
282077
- Vt.closeSync(fd);
282130
+ fs.closeSync(fd);
282078
282131
  }
282079
- Vt.renameSync(tmp, filePath);
282132
+ fs.renameSync(tmp, filePath);
282080
282133
  try {
282081
- const dfd = Vt.openSync(path.dirname(filePath), "r");
282134
+ const dfd = fs.openSync(path.dirname(filePath), "r");
282082
282135
  try {
282083
- Vt.fsyncSync(dfd);
282136
+ fs.fsyncSync(dfd);
282084
282137
  } finally {
282085
- Vt.closeSync(dfd);
282138
+ fs.closeSync(dfd);
282086
282139
  }
282087
282140
  } catch {}
282088
282141
  return dict;
@@ -282472,7 +282525,7 @@ var init_lockfile = __esmMin((() => {
282472
282525
  /** Try to acquire the lock. Returns true if acquired, false if held by a live process. */
282473
282526
  async acquire() {
282474
282527
  try {
282475
- const fh = await fs.open(this.path, "wx");
282528
+ const fh = await fs$1.open(this.path, "wx");
282476
282529
  await fh.writeFile(JSON.stringify({
282477
282530
  pid: process.pid,
282478
282531
  ts: Date.now()
@@ -282484,14 +282537,14 @@ var init_lockfile = __esmMin((() => {
282484
282537
  if (e.code !== "EEXIST") throw e;
282485
282538
  }
282486
282539
  if (await this.isStale()) {
282487
- await fs.unlink(this.path).catch(() => {});
282540
+ await fs$1.unlink(this.path).catch(() => {});
282488
282541
  return this.acquire();
282489
282542
  }
282490
282543
  return false;
282491
282544
  }
282492
282545
  async isStale() {
282493
282546
  try {
282494
- const raw = await fs.readFile(this.path, "utf8");
282547
+ const raw = await fs$1.readFile(this.path, "utf8");
282495
282548
  const { pid } = JSON.parse(raw);
282496
282549
  return !pidAlive$3(pid);
282497
282550
  } catch {
@@ -282505,7 +282558,7 @@ var init_lockfile = __esmMin((() => {
282505
282558
  }
282506
282559
  async release() {
282507
282560
  if (!this.held) return;
282508
- await fs.unlink(this.path).catch(() => {});
282561
+ await fs$1.unlink(this.path).catch(() => {});
282509
282562
  this.held = false;
282510
282563
  HELD.delete(this);
282511
282564
  }
@@ -282550,7 +282603,7 @@ function normDt(dt) {
282550
282603
  }
282551
282604
  async function fileSize(file) {
282552
282605
  try {
282553
- return (await fs.stat(file)).size;
282606
+ return (await fs$1.stat(file)).size;
282554
282607
  } catch (e) {
282555
282608
  if (e.code === "ENOENT") return 0;
282556
282609
  throw e;
@@ -282662,7 +282715,7 @@ var init_src$2 = __esmMin((() => {
282662
282715
  db.maxMemoryBytes = opts.maxMemoryBytes ?? null;
282663
282716
  db.maxMemoryPolicy = opts.maxMemoryPolicy ?? "reject";
282664
282717
  if (db.maxMemoryBytes !== null && (!Number.isFinite(db.maxMemoryBytes) || db.maxMemoryBytes <= 0)) throw new RangeError("maxMemoryBytes must be a positive finite number");
282665
- await fs.mkdir(db.dir, { recursive: true });
282718
+ await fs$1.mkdir(db.dir, { recursive: true });
282666
282719
  db.valueMode = await resolveValueMode(valueMode, db.dir, db.maxMemoryBytes);
282667
282720
  db.readOnly = !!opts.readOnly;
282668
282721
  if (!db.readOnly) {
@@ -282725,7 +282778,7 @@ var init_src$2 = __esmMin((() => {
282725
282778
  if (err instanceof LockError || err.code === "ELOCKED") throw err;
282726
282779
  if (!(err instanceof SyntaxError || err.name === "CorruptFrameError")) throw err;
282727
282780
  if (hooks.onRebuild) hooks.onRebuild(err);
282728
- await fs.rm(opts.dir, {
282781
+ await fs$1.rm(opts.dir, {
282729
282782
  recursive: true,
282730
282783
  force: true
282731
282784
  });
@@ -282787,18 +282840,18 @@ var init_src$2 = __esmMin((() => {
282787
282840
  }
282788
282841
  async loadIndexDefinitions() {
282789
282842
  try {
282790
- const raw = await fs.readFile(this.indexPath, "utf8");
282843
+ const raw = await fs$1.readFile(this.indexPath, "utf8");
282791
282844
  for (const d of JSON.parse(raw)) this.indexes.create(d.name, d);
282792
282845
  } catch (e) {
282793
282846
  if (e.code !== "ENOENT") throw e;
282794
282847
  }
282795
282848
  }
282796
282849
  async persistIndexDefinitions() {
282797
- await fs.writeFile(this.indexPath, JSON.stringify(this.indexes.list()), "utf8");
282850
+ await fs$1.writeFile(this.indexPath, JSON.stringify(this.indexes.list()), "utf8");
282798
282851
  }
282799
282852
  async loadTextIndexDefinitions() {
282800
282853
  try {
282801
- const raw = await fs.readFile(this.textIndexPath, "utf8");
282854
+ const raw = await fs$1.readFile(this.textIndexPath, "utf8");
282802
282855
  this.textDefs = JSON.parse(raw);
282803
282856
  for (const d of this.textDefs) this.text.set(d.name, new TextIndex({
282804
282857
  fields: d.fields,
@@ -282809,11 +282862,11 @@ var init_src$2 = __esmMin((() => {
282809
282862
  }
282810
282863
  }
282811
282864
  async persistTextIndexDefinitions() {
282812
- await fs.writeFile(this.textIndexPath, JSON.stringify(this.textDefs), "utf8");
282865
+ await fs$1.writeFile(this.textIndexPath, JSON.stringify(this.textDefs), "utf8");
282813
282866
  }
282814
282867
  async loadCompoundIndexDefinitions() {
282815
282868
  try {
282816
- const raw = await fs.readFile(this.compoundIndexPath, "utf8");
282869
+ const raw = await fs$1.readFile(this.compoundIndexPath, "utf8");
282817
282870
  for (const d of JSON.parse(raw)) this.compound.create(d.name, {
282818
282871
  groupBy: d.groupBy,
282819
282872
  orderBy: d.orderBy,
@@ -282824,7 +282877,7 @@ var init_src$2 = __esmMin((() => {
282824
282877
  }
282825
282878
  }
282826
282879
  async persistCompoundIndexDefinitions() {
282827
- await fs.writeFile(this.compoundIndexPath, JSON.stringify(this.compound.list()), "utf8");
282880
+ await fs$1.writeFile(this.compoundIndexPath, JSON.stringify(this.compound.list()), "utf8");
282828
282881
  }
282829
282882
  /** Drop every derived index entry for a key that just expired in the Store. */
282830
282883
  onStoreExpire(k, _rec) {
@@ -283381,7 +283434,7 @@ var init_src$2 = __esmMin((() => {
283381
283434
  const ok = this.text.delete(name);
283382
283435
  if (ti) {
283383
283436
  ti.close();
283384
- await fs.rm(this.textPostingsPath(name), { force: true }).catch(() => {});
283437
+ await fs$1.rm(this.textPostingsPath(name), { force: true }).catch(() => {});
283385
283438
  }
283386
283439
  this.textDefs = this.textDefs.filter((d) => d.name !== name);
283387
283440
  await this.persistTextIndexDefinitions();
@@ -283618,11 +283671,11 @@ var init_src$2 = __esmMin((() => {
283618
283671
  }));
283619
283672
  }
283620
283673
  async persistentFiles() {
283621
- return (await fs.readdir(this.dir)).filter((n) => /^db\.(snapshot|wal|indexes\.json|compound-indexes\.json|textindexes\.json)$/.test(n) || /^db\.text-.*\.postings$/.test(n));
283674
+ return (await fs$1.readdir(this.dir)).filter((n) => /^db\.(snapshot|wal|indexes\.json|compound-indexes\.json|textindexes\.json)$/.test(n) || /^db\.text-.*\.postings$/.test(n));
283622
283675
  }
283623
283676
  async copyIfExists(name, destDir) {
283624
283677
  try {
283625
- await fs.copyFile(path.join(this.dir, name), path.join(destDir, name));
283678
+ await fs$1.copyFile(path.join(this.dir, name), path.join(destDir, name));
283626
283679
  return true;
283627
283680
  } catch (e) {
283628
283681
  if (e.code === "ENOENT") return false;
@@ -283642,11 +283695,11 @@ var init_src$2 = __esmMin((() => {
283642
283695
  });
283643
283696
  try {
283644
283697
  await this.wal.flush();
283645
- await fs.mkdir(destDir, { recursive: true });
283698
+ await fs$1.mkdir(destDir, { recursive: true });
283646
283699
  const files = await this.persistentFiles();
283647
283700
  const copied = [];
283648
283701
  for (const name of files) if (await this.copyIfExists(name, destDir)) copied.push(name);
283649
- await fs.writeFile(path.join(destDir, "backup.manifest.json"), JSON.stringify({
283702
+ await fs$1.writeFile(path.join(destDir, "backup.manifest.json"), JSON.stringify({
283650
283703
  version: 1,
283651
283704
  createdAt: Date.now(),
283652
283705
  files: copied
@@ -283661,18 +283714,18 @@ var init_src$2 = __esmMin((() => {
283661
283714
  if (!srcDir) throw new TypeError("restore: srcDir is required");
283662
283715
  if (!destDir) throw new TypeError("restore: destDir is required");
283663
283716
  const { force, ...openOpts } = opts;
283664
- if (force) await fs.rm(destDir, {
283717
+ if (force) await fs$1.rm(destDir, {
283665
283718
  recursive: true,
283666
283719
  force: true
283667
283720
  });
283668
283721
  else try {
283669
- if ((await fs.readdir(destDir)).length) throw new Error(`restore destination is not empty: ${destDir}`);
283722
+ if ((await fs$1.readdir(destDir)).length) throw new Error(`restore destination is not empty: ${destDir}`);
283670
283723
  } catch (e) {
283671
283724
  if (e.code !== "ENOENT") throw e;
283672
283725
  }
283673
- await fs.mkdir(destDir, { recursive: true });
283674
- const names = await fs.readdir(srcDir);
283675
- for (const name of names) if (/^db\.(snapshot|wal|indexes\.json|compound-indexes\.json|textindexes\.json)$/.test(name) || /^db\.text-.*\.postings$/.test(name) || name === "backup.manifest.json") await fs.copyFile(path.join(srcDir, name), path.join(destDir, name));
283726
+ await fs$1.mkdir(destDir, { recursive: true });
283727
+ const names = await fs$1.readdir(srcDir);
283728
+ for (const name of names) if (/^db\.(snapshot|wal|indexes\.json|compound-indexes\.json|textindexes\.json)$/.test(name) || /^db\.text-.*\.postings$/.test(name) || name === "backup.manifest.json") await fs$1.copyFile(path.join(srcDir, name), path.join(destDir, name));
283676
283729
  return MiniDb.open({
283677
283730
  ...openOpts,
283678
283731
  dir: destDir
@@ -289213,11 +289266,13 @@ var init_fullCompactionService = __esmMin((() => {
289213
289266
  const originalHistory = [...this.context.get()];
289214
289267
  const tokensBefore = estimateTokensForMessages(originalHistory);
289215
289268
  let retryCount = 0;
289269
+ let thinkingEffort = this.profile.data().thinkingLevel;
289216
289270
  try {
289217
289271
  const signal = active.abortController.signal;
289218
289272
  signal.throwIfAborted();
289219
289273
  await this.hooks.onWillCompact.run(active);
289220
289274
  const resolvedModel = this.profile.resolveModelContext();
289275
+ thinkingEffort = resolvedModel.thinkingLevel;
289221
289276
  const maxContextTokens = resolvedModel.modelCapabilities.max_context_tokens;
289222
289277
  const defaultCompactionCap = maxContextTokens > 0 ? Math.min(maxContextTokens, DEFAULT_COMPACTION_MAX_COMPLETION_TOKENS) : void 0;
289223
289278
  const compactionMaxOutputSize = resolvedModel.maxOutputSize ?? defaultCompactionCap;
@@ -289291,7 +289346,7 @@ var init_fullCompactionService = __esmMin((() => {
289291
289346
  dropped_count: result.droppedCount,
289292
289347
  retry_count: retryCount,
289293
289348
  round: 1,
289294
- thinking_effort: this.profile.data().thinkingLevel,
289349
+ thinking_effort: thinkingEffort,
289295
289350
  ...usageTelemetry(attempt.usage)
289296
289351
  };
289297
289352
  this.telemetry.track2("compaction_finished", properties);
@@ -289304,7 +289359,7 @@ var init_fullCompactionService = __esmMin((() => {
289304
289359
  duration_ms: Date.now() - startedAt,
289305
289360
  round: 1,
289306
289361
  retry_count: retryCount,
289307
- thinking_effort: this.profile.data().thinkingLevel,
289362
+ thinking_effort: thinkingEffort,
289308
289363
  error_type: error instanceof Error ? error.name : "Unknown"
289309
289364
  });
289310
289365
  if (isError2(error) && (error.code === ErrorCodes.AUTH_LOGIN_REQUIRED || error.code === ErrorCodes.PROVIDER_AUTH_ERROR)) throw error;
@@ -289354,7 +289409,7 @@ var init_faultInjection = __esmMin((() => {
289354
289409
  }));
289355
289410
  //#endregion
289356
289411
  //#region ../../packages/agent-core-v2/src/agent/profile/configSection.ts
289357
- var THINKING_SECTION, ThinkingConfigSchema, thinkingEnvBindings;
289412
+ var THINKING_SECTION, ThinkingConfigSchema, thinkingEnvBindings, stripThinkingEnv;
289358
289413
  var init_configSection$1 = __esmMin((() => {
289359
289414
  init_zod$1();
289360
289415
  init_config$3();
@@ -289363,15 +289418,27 @@ var init_configSection$1 = __esmMin((() => {
289363
289418
  ThinkingConfigSchema = object({
289364
289419
  enabled: boolean$1().optional(),
289365
289420
  effort: string().optional(),
289421
+ forcedEffort: string().optional(),
289366
289422
  keep: string().optional()
289367
289423
  });
289368
- thinkingEnvBindings = envBindings(ThinkingConfigSchema, { effort: "KIMI_MODEL_THINKING_EFFORT" });
289369
- registerConfigSection(THINKING_SECTION, ThinkingConfigSchema, { env: thinkingEnvBindings });
289424
+ thinkingEnvBindings = envBindings(ThinkingConfigSchema, { forcedEffort: "KIMI_MODEL_THINKING_EFFORT" });
289425
+ stripThinkingEnv = (value) => {
289426
+ const result = { ...value };
289427
+ delete result.forcedEffort;
289428
+ return result;
289429
+ };
289430
+ registerConfigSection(THINKING_SECTION, ThinkingConfigSchema, {
289431
+ env: thinkingEnvBindings,
289432
+ stripEnv: stripThinkingEnv
289433
+ });
289370
289434
  }));
289371
289435
  //#endregion
289372
289436
  //#region ../../packages/agent-core-v2/src/agent/profile/thinking.ts
289373
289437
  function resolveThinkingEffort(requested, defaults, model) {
289374
- return resolveThinkingEffortForModel(requested, defaults, model);
289438
+ return resolveThinkingEffortForModel(requested, defaults, model, model?.providerType === "kimi");
289439
+ }
289440
+ function supportsThinkingEffort(effort, model) {
289441
+ return modelSupportsThinkingEffort(effort, model, model?.providerType === "kimi");
289375
289442
  }
289376
289443
  function parseKeepValue(raw) {
289377
289444
  const trimmed = raw?.trim();
@@ -290589,7 +290656,8 @@ var init_loopService = __esmMin((() => {
290589
290656
  }
290590
290657
  failLoopStep(runtime, error) {
290591
290658
  const reason = isMaxStepsExceededError(error) ? "max_steps" : "error";
290592
- this.emitStepInterrupted(runtime.turnId, runtime.current?.number, reason, toErrorMessage(error));
290659
+ const interruptedError = isError2(error) && error.code === ErrorCodes.INTERNAL && error.cause !== void 0 ? error.cause : error;
290660
+ this.emitStepInterrupted(runtime.turnId, runtime.current?.number, reason, toErrorMessage(interruptedError));
290593
290661
  return {
290594
290662
  type: "return",
290595
290663
  result: {
@@ -293296,16 +293364,13 @@ var init_profileOps = __esmMin((() => {
293296
293364
  }));
293297
293365
  //#endregion
293298
293366
  //#region ../../packages/agent-core-v2/src/agent/profile/profileService.ts
293299
- function normalizeKimiThinkingEffort(raw) {
293300
- const trimmed = raw?.trim();
293301
- return trimmed === void 0 || trimmed.length === 0 ? void 0 : trimmed;
293302
- }
293303
293367
  var import_picomatch, AgentProfileService;
293304
293368
  var init_profileService = __esmMin((() => {
293305
293369
  init_scope();
293306
293370
  init_capability();
293307
293371
  init_agentProfileCatalog();
293308
293372
  init_modelResolver();
293373
+ init_thinking$2();
293309
293374
  import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
293310
293375
  init_errors$2();
293311
293376
  init_bootstrap();
@@ -293424,7 +293489,14 @@ var init_profileService = __esmMin((() => {
293424
293489
  }
293425
293490
  setThinking(level) {
293426
293491
  const previousEffort = this.thinkingLevel;
293427
- this.update({ thinkingLevel: level });
293492
+ const model = this.tryResolveRawModel();
293493
+ const normalized = normalizeRequestedThinkingEffort(level);
293494
+ if (normalized !== void 0 && !supportsThinkingEffort(normalized, model)) {
293495
+ const efforts = model?.supportEfforts ?? [];
293496
+ const supported = efforts.length === 0 ? "off" : ["off", ...efforts].join(", ");
293497
+ throw new ProfileError(ProfileErrors.codes.MODEL_CONFIG_INVALID, `Thinking effort "${level}" is not supported by model "${this.modelAlias}". Supported efforts: ${supported}.`);
293498
+ }
293499
+ this.update({ thinkingLevel: normalized ?? level });
293428
293500
  const effort = this.thinkingLevel;
293429
293501
  if (effort !== previousEffort) this.telemetry.track2("thinking_toggle", {
293430
293502
  enabled: effort !== "off",
@@ -293476,6 +293548,9 @@ var init_profileService = __esmMin((() => {
293476
293548
  activeToolNames: this.activeToolNames === void 0 ? void 0 : [...this.activeToolNames]
293477
293549
  };
293478
293550
  }
293551
+ getEffectiveThinkingLevel() {
293552
+ return this.resolveThinkingState(this.tryResolveRawModel()).effective;
293553
+ }
293479
293554
  resolveModelContext() {
293480
293555
  const modelAlias = this.model;
293481
293556
  const model = this.modelFactory.resolve(modelAlias);
@@ -293485,7 +293560,7 @@ var init_profileService = __esmMin((() => {
293485
293560
  modelCapabilities: model.capabilities,
293486
293561
  maxOutputSize: model.maxOutputSize,
293487
293562
  alwaysThinking: model.alwaysThinking || void 0,
293488
- thinkingLevel: this.thinkingLevel,
293563
+ thinkingLevel: this.resolveThinkingState(model).effective,
293489
293564
  reservedContextSize: loopControl?.reservedContextSize,
293490
293565
  compactionTriggerRatio: loopControl?.compactionTriggerRatio
293491
293566
  };
@@ -293501,9 +293576,8 @@ var init_profileService = __esmMin((() => {
293501
293576
  resolveModel() {
293502
293577
  if (this.modelAlias === void 0) return void 0;
293503
293578
  let model = this.modelFactory.resolve(this.modelAlias);
293504
- const thinkingLevel = this.thinkingLevel;
293579
+ const thinking = this.resolveThinkingState(model);
293505
293580
  const thinkingConfig = this.config.get(THINKING_SECTION);
293506
- const forcedKimiThinkingEffort = model.protocol === "kimi" && thinkingLevel !== "off" ? normalizeKimiThinkingEffort(thinkingConfig?.effort) : void 0;
293507
293581
  const kwargs = {};
293508
293582
  if (model.protocol === "kimi") kwargs.prompt_cache_key = this.sessionContext.sessionId;
293509
293583
  else if (model.protocol === "anthropic") model = model.withProviderOptions({ metadata: { user_id: this.sessionContext.sessionId } });
@@ -293512,20 +293586,20 @@ var init_profileService = __esmMin((() => {
293512
293586
  if (overrides.temperature !== void 0) kwargs.temperature = overrides.temperature;
293513
293587
  if (overrides.topP !== void 0) kwargs.top_p = overrides.topP;
293514
293588
  }
293515
- const keep = resolveThinkingKeep(overrides?.thinkingKeep, thinkingConfig?.keep, thinkingLevel);
293589
+ const keep = resolveThinkingKeep(overrides?.thinkingKeep, thinkingConfig?.keep, thinking.effective);
293516
293590
  if (keep !== void 0) {
293517
- if (model.protocol === "kimi" && forcedKimiThinkingEffort === void 0) kwargs.extra_body = { thinking: { keep } };
293591
+ if (model.protocol === "kimi" && thinking.forced === void 0) kwargs.extra_body = { thinking: { keep } };
293518
293592
  else if (model.protocol === "anthropic") model = model.withThinkingKeep(keep);
293519
293593
  }
293520
293594
  if (Object.keys(kwargs).length > 0) model = model.withGenerationKwargs(kwargs);
293521
- model = model.withThinking(forcedKimiThinkingEffort ?? thinkingLevel);
293522
- if (forcedKimiThinkingEffort !== void 0) {
293523
- const thinking = {
293595
+ model = model.withThinking(thinking.effective);
293596
+ if (model.protocol === "kimi" && thinking.forced !== void 0) {
293597
+ const requestThinking = {
293524
293598
  type: "enabled",
293525
- effort: forcedKimiThinkingEffort
293599
+ effort: thinking.forced
293526
293600
  };
293527
- if (keep !== void 0) thinking.keep = keep;
293528
- model = model.withGenerationKwargs({ extra_body: { thinking } });
293601
+ if (keep !== void 0) requestThinking.keep = keep;
293602
+ model = model.withGenerationKwargs({ extra_body: { thinking: requestThinking } });
293529
293603
  }
293530
293604
  return model;
293531
293605
  }
@@ -293571,9 +293645,9 @@ var init_profileService = __esmMin((() => {
293571
293645
  if (changed.cwd !== void 0) payload.cwd = changed.cwd;
293572
293646
  if (changed.modelAlias !== void 0) payload.modelAlias = changed.modelAlias;
293573
293647
  if (changed.profileName !== void 0) payload.profileName = changed.profileName;
293574
- if (changed.thinkingLevel !== void 0) {
293575
- const model = this.resolveModelForThinking(changed.modelAlias);
293576
- payload.thinkingEffort = resolveThinkingEffort(changed.thinkingLevel, this.config.get(THINKING_SECTION), model);
293648
+ if (changed.thinkingLevel !== void 0 || changed.modelAlias !== void 0) {
293649
+ const model = this.resolveModelForThinking(changed.modelAlias ?? this.modelAlias);
293650
+ payload.thinkingEffort = resolveThinkingEffort(changed.thinkingLevel ?? (this.modelAlias === void 0 ? void 0 : this.thinkingLevel), this.config.get(THINKING_SECTION), model);
293577
293651
  }
293578
293652
  if (changed.systemPrompt !== void 0) payload.systemPrompt = changed.systemPrompt;
293579
293653
  return payload;
@@ -293587,13 +293661,13 @@ var init_profileService = __esmMin((() => {
293587
293661
  protocol
293588
293662
  });
293589
293663
  }
293590
- this.emitStatusUpdated();
293664
+ this.emitStatusUpdated(changed.modelAlias !== void 0 || changed.thinkingLevel !== void 0);
293591
293665
  }
293592
293666
  setActiveTools(names) {
293593
293667
  this.activeToolNamesOverlay = void 0;
293594
293668
  this.wire.dispatch(setActiveTools({ names: [...names] }));
293595
293669
  }
293596
- emitStatusUpdated() {
293670
+ emitStatusUpdated(includeThinkingEffort = false) {
293597
293671
  const custom = this.optionsValue.emitStatusUpdated;
293598
293672
  if (custom !== void 0) {
293599
293673
  custom();
@@ -293603,6 +293677,7 @@ var init_profileService = __esmMin((() => {
293603
293677
  this.eventBus.publish({
293604
293678
  type: "agent.status.updated",
293605
293679
  model: this.modelAlias,
293680
+ thinkingEffort: includeThinkingEffort ? this.getEffectiveThinkingLevel() : void 0,
293606
293681
  maxContextTokens: this.getModelCapabilities().max_context_tokens
293607
293682
  });
293608
293683
  }
@@ -293631,6 +293706,14 @@ var init_profileService = __esmMin((() => {
293631
293706
  if (stored === "off" && this.alwaysThinkingModel) return resolveThinkingEffort(stored, this.config.get(THINKING_SECTION), this.tryResolveRawModel());
293632
293707
  return stored;
293633
293708
  }
293709
+ resolveThinkingState(model) {
293710
+ const base = this.thinkingLevel;
293711
+ const forced = resolveKimiThinkingEffortOverride(this.config.get(THINKING_SECTION)?.forcedEffort, base, model?.providerType === "kimi");
293712
+ return {
293713
+ effective: forced ?? base,
293714
+ forced
293715
+ };
293716
+ }
293634
293717
  get alwaysThinkingModel() {
293635
293718
  return this.tryResolveRawModel()?.alwaysThinking === true;
293636
293719
  }
@@ -301495,7 +301578,7 @@ var require_atomic_sleep = /* @__PURE__ */ __commonJSMin(((exports, module) => {
301495
301578
  //#endregion
301496
301579
  //#region ../../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js
301497
301580
  var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
301498
- const fs$3 = __require("fs");
301581
+ const fs$4 = __require("fs");
301499
301582
  const EventEmitter$8 = __require("events");
301500
301583
  const inherits$6 = __require("util").inherits;
301501
301584
  const path$5 = __require("path");
@@ -301538,17 +301621,17 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
301538
301621
  const flags = sonic.append ? "a" : "w";
301539
301622
  const mode = sonic.mode;
301540
301623
  if (sonic.sync) try {
301541
- if (sonic.mkdir) fs$3.mkdirSync(path$5.dirname(file), { recursive: true });
301542
- fileOpened(null, fs$3.openSync(file, flags, mode));
301624
+ if (sonic.mkdir) fs$4.mkdirSync(path$5.dirname(file), { recursive: true });
301625
+ fileOpened(null, fs$4.openSync(file, flags, mode));
301543
301626
  } catch (err) {
301544
301627
  fileOpened(err);
301545
301628
  throw err;
301546
301629
  }
301547
- else if (sonic.mkdir) fs$3.mkdir(path$5.dirname(file), { recursive: true }, (err) => {
301630
+ else if (sonic.mkdir) fs$4.mkdir(path$5.dirname(file), { recursive: true }, (err) => {
301548
301631
  if (err) return fileOpened(err);
301549
- fs$3.open(file, flags, mode, fileOpened);
301632
+ fs$4.open(file, flags, mode, fileOpened);
301550
301633
  });
301551
- else fs$3.open(file, flags, mode, fileOpened);
301634
+ else fs$4.open(file, flags, mode, fileOpened);
301552
301635
  }
301553
301636
  function SonicBoom(opts) {
301554
301637
  if (!(this instanceof SonicBoom)) return new SonicBoom(opts);
@@ -301586,8 +301669,8 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
301586
301669
  this.flush = flushBuffer;
301587
301670
  this.flushSync = flushBufferSync;
301588
301671
  this._actualWrite = actualWriteBuffer;
301589
- fsWriteSync = () => fs$3.writeSync(this.fd, this._writingBuf);
301590
- fsWrite = () => fs$3.write(this.fd, this._writingBuf, this.release);
301672
+ fsWriteSync = () => fs$4.writeSync(this.fd, this._writingBuf);
301673
+ fsWrite = () => fs$4.write(this.fd, this._writingBuf, this.release);
301591
301674
  } else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
301592
301675
  this._writingBuf = "";
301593
301676
  this.write = write;
@@ -301595,12 +301678,12 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
301595
301678
  this.flushSync = flushSync;
301596
301679
  this._actualWrite = actualWrite;
301597
301680
  fsWriteSync = () => {
301598
- if (Buffer.isBuffer(this._writingBuf)) return fs$3.writeSync(this.fd, this._writingBuf);
301599
- return fs$3.writeSync(this.fd, this._writingBuf, "utf8");
301681
+ if (Buffer.isBuffer(this._writingBuf)) return fs$4.writeSync(this.fd, this._writingBuf);
301682
+ return fs$4.writeSync(this.fd, this._writingBuf, "utf8");
301600
301683
  };
301601
301684
  fsWrite = () => {
301602
- if (Buffer.isBuffer(this._writingBuf)) return fs$3.write(this.fd, this._writingBuf, this.release);
301603
- return fs$3.write(this.fd, this._writingBuf, "utf8", this.release);
301685
+ if (Buffer.isBuffer(this._writingBuf)) return fs$4.write(this.fd, this._writingBuf, this.release);
301686
+ return fs$4.write(this.fd, this._writingBuf, "utf8", this.release);
301604
301687
  };
301605
301688
  } else throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
301606
301689
  if (typeof fd === "number") {
@@ -301645,7 +301728,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
301645
301728
  return;
301646
301729
  }
301647
301730
  }
301648
- if (this._fsync) fs$3.fsyncSync(this.fd);
301731
+ if (this._fsync) fs$4.fsyncSync(this.fd);
301649
301732
  const len = this._len;
301650
301733
  if (this._reopening) {
301651
301734
  this._writing = false;
@@ -301742,7 +301825,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
301742
301825
  this._flushPending = true;
301743
301826
  const onDrain = () => {
301744
301827
  if (!this._fsync) try {
301745
- fs$3.fsync(this.fd, (err) => {
301828
+ fs$4.fsync(this.fd, (err) => {
301746
301829
  this._flushPending = false;
301747
301830
  cb(err);
301748
301831
  });
@@ -301819,7 +301902,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
301819
301902
  if (this._writing) return;
301820
301903
  const fd = this.fd;
301821
301904
  this.once("ready", () => {
301822
- if (fd !== this.fd) fs$3.close(fd, (err) => {
301905
+ if (fd !== this.fd) fs$4.close(fd, (err) => {
301823
301906
  if (err) return this.emit("error", err);
301824
301907
  });
301825
301908
  });
@@ -301850,7 +301933,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
301850
301933
  while (this._bufs.length || buf.length) {
301851
301934
  if (buf.length <= 0) buf = this._bufs[0];
301852
301935
  try {
301853
- const n = Buffer.isBuffer(buf) ? fs$3.writeSync(this.fd, buf) : fs$3.writeSync(this.fd, buf, "utf8");
301936
+ const n = Buffer.isBuffer(buf) ? fs$4.writeSync(this.fd, buf) : fs$4.writeSync(this.fd, buf, "utf8");
301854
301937
  const releasedBufObj = releaseWritingBuf(buf, this._len, n);
301855
301938
  buf = releasedBufObj.writingBuf;
301856
301939
  this._len = releasedBufObj.len;
@@ -301861,7 +301944,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
301861
301944
  }
301862
301945
  }
301863
301946
  try {
301864
- fs$3.fsyncSync(this.fd);
301947
+ fs$4.fsyncSync(this.fd);
301865
301948
  } catch {}
301866
301949
  }
301867
301950
  function flushBufferSync() {
@@ -301875,7 +301958,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
301875
301958
  while (this._bufs.length || buf.length) {
301876
301959
  if (buf.length <= 0) buf = mergeBuf(this._bufs[0], this._lens[0]);
301877
301960
  try {
301878
- const n = fs$3.writeSync(this.fd, buf);
301961
+ const n = fs$4.writeSync(this.fd, buf);
301879
301962
  buf = buf.subarray(n);
301880
301963
  this._len = Math.max(this._len - n, 0);
301881
301964
  if (buf.length <= 0) {
@@ -301897,24 +301980,24 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
301897
301980
  this._writing = true;
301898
301981
  this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
301899
301982
  if (this.sync) try {
301900
- release(null, Buffer.isBuffer(this._writingBuf) ? fs$3.writeSync(this.fd, this._writingBuf) : fs$3.writeSync(this.fd, this._writingBuf, "utf8"));
301983
+ release(null, Buffer.isBuffer(this._writingBuf) ? fs$4.writeSync(this.fd, this._writingBuf) : fs$4.writeSync(this.fd, this._writingBuf, "utf8"));
301901
301984
  } catch (err) {
301902
301985
  release(err);
301903
301986
  }
301904
- else fs$3.write(this.fd, this._writingBuf, release);
301987
+ else fs$4.write(this.fd, this._writingBuf, release);
301905
301988
  }
301906
301989
  function actualWriteBuffer() {
301907
301990
  const release = this.release;
301908
301991
  this._writing = true;
301909
301992
  this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
301910
301993
  if (this.sync) try {
301911
- release(null, fs$3.writeSync(this.fd, this._writingBuf));
301994
+ release(null, fs$4.writeSync(this.fd, this._writingBuf));
301912
301995
  } catch (err) {
301913
301996
  release(err);
301914
301997
  }
301915
301998
  else {
301916
301999
  if (kCopyBuffer) this._writingBuf = Buffer.from(this._writingBuf);
301917
- fs$3.write(this.fd, this._writingBuf, release);
302000
+ fs$4.write(this.fd, this._writingBuf, release);
301918
302001
  }
301919
302002
  }
301920
302003
  function actualClose(sonic) {
@@ -301928,10 +302011,10 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
301928
302011
  sonic._lens = [];
301929
302012
  assert$8(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
301930
302013
  try {
301931
- fs$3.fsync(sonic.fd, closeWrapped);
302014
+ fs$4.fsync(sonic.fd, closeWrapped);
301932
302015
  } catch {}
301933
302016
  function closeWrapped() {
301934
- if (sonic.fd !== 1 && sonic.fd !== 2) fs$3.close(sonic.fd, done);
302017
+ if (sonic.fd !== 1 && sonic.fd !== 2) fs$4.close(sonic.fd, done);
301935
302018
  else done();
301936
302019
  }
301937
302020
  function done(err) {
@@ -341904,7 +341987,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
341904
341987
  //#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/mode/static.js
341905
341988
  var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
341906
341989
  const path$3 = __require("node:path");
341907
- const fs$2 = __require("node:fs");
341990
+ const fs$3 = __require("node:fs");
341908
341991
  const yaml = require_dist$1();
341909
341992
  module.exports = function(fastify, opts, done) {
341910
341993
  if (!opts.specification) return done(/* @__PURE__ */ new Error("specification is missing in the module options"));
@@ -341913,14 +341996,14 @@ var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
341913
341996
  if (!opts.specification.path && !opts.specification.document) return done(/* @__PURE__ */ new Error("both specification.path and specification.document are missing, should be path to the file or swagger document spec"));
341914
341997
  else if (opts.specification.path) {
341915
341998
  if (typeof opts.specification.path !== "string") return done(/* @__PURE__ */ new Error("specification.path is not a string"));
341916
- if (!fs$2.existsSync(path$3.resolve(opts.specification.path))) return done(/* @__PURE__ */ new Error(`${opts.specification.path} does not exist`));
341999
+ if (!fs$3.existsSync(path$3.resolve(opts.specification.path))) return done(/* @__PURE__ */ new Error(`${opts.specification.path} does not exist`));
341917
342000
  const extName = path$3.extname(opts.specification.path).toLowerCase();
341918
342001
  if ([".yaml", ".json"].indexOf(extName) === -1) return done(/* @__PURE__ */ new Error("specification.path extension name is not supported, should be one from ['.yaml', '.json']"));
341919
342002
  if (opts.specification.postProcessor && typeof opts.specification.postProcessor !== "function") return done(/* @__PURE__ */ new Error("specification.postProcessor should be a function"));
341920
342003
  if (opts.specification.baseDir && typeof opts.specification.baseDir !== "string") return done(/* @__PURE__ */ new Error("specification.baseDir should be string"));
341921
342004
  if (!opts.specification.baseDir) opts.specification.baseDir = path$3.resolve(path$3.dirname(opts.specification.path));
341922
342005
  else while (opts.specification.baseDir.endsWith("/")) opts.specification.baseDir = opts.specification.baseDir.slice(0, -1);
341923
- const source = fs$2.readFileSync(path$3.resolve(opts.specification.path), "utf8");
342006
+ const source = fs$3.readFileSync(path$3.resolve(opts.specification.path), "utf8");
341924
342007
  switch (extName) {
341925
342008
  case ".yaml":
341926
342009
  swaggerObject = yaml.parse(source);
@@ -342187,11 +342270,11 @@ var require_should_route_hide = /* @__PURE__ */ __commonJSMin(((exports, module)
342187
342270
  //#endregion
342188
342271
  //#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/util/read-package-json.js
342189
342272
  var require_read_package_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
342190
- const fs$1 = __require("node:fs");
342273
+ const fs$2 = __require("node:fs");
342191
342274
  const path$2 = __require("node:path");
342192
342275
  function readPackageJson() {
342193
342276
  try {
342194
- return JSON.parse(fs$1.readFileSync(path$2.join(__dirname, "..", "..", "package.json")));
342277
+ return JSON.parse(fs$2.readFileSync(path$2.join(__dirname, "..", "..", "package.json")));
342195
342278
  } catch {
342196
342279
  return {};
342197
342280
  }
@@ -353926,47 +354009,56 @@ async function performModelSwitch(host, alias, effort, persist) {
353926
354009
  }
353927
354010
  const prevModel = host.state.appState.model;
353928
354011
  const prevEffort = host.state.appState.thinkingEffort;
353929
- const modelChanged = alias !== prevModel;
353930
- const effortChanged = effort !== prevEffort;
353931
- const runtimeChanged = modelChanged || effortChanged;
353932
- const displayName = modelDisplayName$1(alias, host.state.appState.availableModels[alias]);
354012
+ const runtimeChanged = alias !== prevModel || effort !== prevEffort;
354013
+ let effectiveAlias = alias;
354014
+ let effectiveEffort = effort;
353933
354015
  const session = host.session;
353934
354016
  try {
353935
354017
  if (session === void 0 && runtimeChanged) await host.authFlow.activateModelAfterLogin(alias, effort);
353936
354018
  else if (session !== void 0) {
353937
354019
  if (alias !== prevModel) await session.setModel(alias);
353938
354020
  if (effort !== prevEffort) await session.setThinking(effort);
354021
+ const status = await session.getStatus();
354022
+ effectiveAlias = status.model ?? alias;
354023
+ effectiveEffort = status.thinkingEffort;
353939
354024
  }
353940
354025
  } catch (error) {
353941
354026
  const msg = formatErrorMessage$2(error);
353942
354027
  host.showError(`Failed to switch model: ${msg}`);
353943
354028
  return;
353944
354029
  }
354030
+ if (session === void 0) {
354031
+ effectiveAlias = host.state.appState.model;
354032
+ effectiveEffort = host.state.appState.thinkingEffort;
354033
+ }
354034
+ const effectiveModelChanged = effectiveAlias !== prevModel;
354035
+ const effectiveEffortChanged = effectiveEffort !== prevEffort;
354036
+ const displayName = modelDisplayName$1(effectiveAlias, host.state.appState.availableModels[effectiveAlias]);
353945
354037
  host.setAppState({
353946
- model: alias,
353947
- thinkingEffort: effort
354038
+ model: effectiveAlias,
354039
+ thinkingEffort: effectiveEffort
353948
354040
  });
353949
354041
  if (session === void 0 && runtimeChanged) {
353950
- if (alias !== prevModel) host.track("model_switch", { model: alias });
353951
- if (effort !== prevEffort) host.track("thinking_toggle", {
353952
- enabled: effort !== "off",
353953
- effort,
354042
+ if (effectiveModelChanged) host.track("model_switch", { model: effectiveAlias });
354043
+ if (effectiveEffortChanged) host.track("thinking_toggle", {
354044
+ enabled: effectiveEffort !== "off",
354045
+ effort: effectiveEffort,
353954
354046
  from: prevEffort
353955
354047
  });
353956
354048
  }
353957
354049
  let persisted = false;
353958
354050
  if (persist) try {
353959
- persisted = await persistModelSelection(host, alias, effort);
354051
+ persisted = await persistModelSelection(host, effectiveAlias, effectiveEffort);
353960
354052
  } catch (error) {
353961
354053
  const msg = formatErrorMessage$2(error);
353962
354054
  host.showError(`Switched to ${displayName}, but failed to save default: ${msg}`);
353963
354055
  return;
353964
354056
  }
353965
354057
  let status;
353966
- if (modelChanged) status = persist ? `Switched to ${displayName} with thinking ${effort}.` : `Switched to ${displayName} with thinking ${effort} for this session only.`;
353967
- else if (effortChanged) status = persist ? `Thinking set to ${effort}.` : `Thinking set to ${effort} for this session only.`;
353968
- else if (persist && persisted) status = `Saved ${displayName} with thinking ${effort} as default.`;
353969
- else status = `Already using ${displayName} with thinking ${effort}.`;
354058
+ if (effectiveModelChanged) status = persist ? `Switched to ${displayName} with thinking ${effectiveEffort}.` : `Switched to ${displayName} with thinking ${effectiveEffort} for this session only.`;
354059
+ else if (effectiveEffortChanged) status = persist ? `Thinking set to ${effectiveEffort}.` : `Thinking set to ${effectiveEffort} for this session only.`;
354060
+ else if (persist && persisted) status = `Saved ${displayName} with thinking ${effectiveEffort} as default.`;
354061
+ else status = `Already using ${displayName} with thinking ${effectiveEffort}.`;
353970
354062
  host.showStatus(status, "success");
353971
354063
  }
353972
354064
  async function persistModelSelection(host, alias, effort) {
@@ -430757,6 +430849,7 @@ var SessionEventHandler = class {
430757
430849
  if (event.swarmMode !== void 0) patch.swarmMode = event.swarmMode;
430758
430850
  if (event.permission !== void 0) patch.permissionMode = event.permission;
430759
430851
  if (event.model !== void 0) patch.model = event.model;
430852
+ if (event.thinkingEffort !== void 0) patch.thinkingEffort = event.thinkingEffort;
430760
430853
  if (Object.keys(patch).length > 0) this.host.setAppState(patch);
430761
430854
  if (event.swarmMode === false) {
430762
430855
  this.host.state.swarmModeEntry = void 0;