@kenkaiiii/gg-boss 4.11.2 → 4.11.3

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.
@@ -63845,16 +63845,17 @@ function toAnthropicThinking(level, maxTokens, model) {
63845
63845
  outputConfig: { effort }
63846
63846
  };
63847
63847
  }
63848
+ const VISIBLE_FLOOR = 1024;
63848
63849
  const effectiveLevel = level === "xhigh" || level === "max" ? "high" : level;
63849
63850
  const budgetMap = {
63850
- low: Math.max(1024, Math.floor(maxTokens * 0.25)),
63851
- medium: Math.max(2048, Math.floor(maxTokens * 0.5)),
63852
- high: Math.max(4096, maxTokens)
63851
+ low: Math.max(1024, Math.floor(maxTokens * 0.2)),
63852
+ medium: Math.max(2048, Math.floor(maxTokens * 0.45)),
63853
+ high: Math.max(4096, Math.floor(maxTokens * 0.8))
63853
63854
  };
63854
- const budget = budgetMap[effectiveLevel];
63855
+ const budget = Math.max(0, Math.min(budgetMap[effectiveLevel], maxTokens - VISIBLE_FLOOR));
63855
63856
  return {
63856
63857
  thinking: { type: "enabled", budget_tokens: budget },
63857
- maxTokens: maxTokens + budget
63858
+ maxTokens
63858
63859
  };
63859
63860
  }
63860
63861
  function remapToolCallId(id2, idMap) {
@@ -83733,10 +83734,25 @@ var AgentSession = class {
83733
83734
  this.model = options.model;
83734
83735
  this.cwd = options.cwd;
83735
83736
  this.baseUrl = options.baseUrl;
83736
- this.maxTokens = options.maxTokens ?? getModel(options.model)?.maxOutputTokens ?? 16384;
83737
+ this.maxTokens = this.resolveMaxTokens(options.model);
83737
83738
  this.thinkingLevel = options.thinkingLevel;
83738
83739
  this.customSystemPrompt = options.systemPrompt;
83739
83740
  }
83741
+ /**
83742
+ * Derive the output-token cap for a model. Follows the active model's
83743
+ * `maxOutputTokens` so a session booted on a large-output model (e.g. Kimi's
83744
+ * 256K) doesn't carry that cap to a smaller one (e.g. Opus's 128K) after a
83745
+ * model switch — that mismatch surfaces from the provider as
83746
+ * `max_tokens: 262144 > 128000, which is the maximum allowed …`. An explicit
83747
+ * `maxTokens` override is honored but clamped to the model's ceiling.
83748
+ */
83749
+ resolveMaxTokens(modelId) {
83750
+ const modelInfo = getModel(modelId);
83751
+ if (this.opts.maxTokens) {
83752
+ return modelInfo ? Math.min(this.opts.maxTokens, modelInfo.maxOutputTokens) : this.opts.maxTokens;
83753
+ }
83754
+ return modelInfo?.maxOutputTokens ?? 16384;
83755
+ }
83740
83756
  async initialize() {
83741
83757
  setEstimatorModel(this.model);
83742
83758
  const paths = await ensureAppDirs();
@@ -84147,6 +84163,7 @@ ${fileNotes.join("\n")}`);
84147
84163
  this.provider = provider;
84148
84164
  this.model = model;
84149
84165
  setEstimatorModel(model);
84166
+ this.maxTokens = this.resolveMaxTokens(model);
84150
84167
  this.eventBus.emit("model_change", { provider: this.provider, model: this.model });
84151
84168
  if (provider && provider !== prevProvider) {
84152
84169
  const hasWebSearch = this.tools.some((t) => t.name === "web_search");
@@ -116497,4 +116514,4 @@ react/cjs/react-jsx-runtime.development.js:
116497
116514
  * LICENSE file in the root directory of this source tree.
116498
116515
  *)
116499
116516
  */
116500
- //# sourceMappingURL=chunk-CR6V6KR3.js.map
116517
+ //# sourceMappingURL=chunk-WECKKLXP.js.map