cascade-ai 0.12.8 → 0.12.9

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.
@@ -222450,7 +222450,7 @@ Anthropic.Models = Models2;
222450
222450
  Anthropic.Beta = Beta;
222451
222451
 
222452
222452
  // src/constants.ts
222453
- var CASCADE_VERSION = "0.12.8";
222453
+ var CASCADE_VERSION = "0.12.9";
222454
222454
  var CASCADE_CONFIG_DIR = ".cascade";
222455
222455
  var CASCADE_MD_FILE = "CASCADE.md";
222456
222456
  var CASCADE_IGNORE_FILE = ".cascadeignore";
@@ -222850,6 +222850,12 @@ var BaseProvider = class {
222850
222850
  };
222851
222851
 
222852
222852
  // src/providers/anthropic.ts
222853
+ function anthropicThinkingParam(modelId, maxTokens) {
222854
+ if (!/claude-(opus|sonnet)-4/i.test(modelId)) return {};
222855
+ const budget = Math.min(8e3, maxTokens - 1024);
222856
+ if (budget < 1024) return {};
222857
+ return { thinking: { type: "enabled", budget_tokens: budget } };
222858
+ }
222853
222859
  var AnthropicProvider = class extends BaseProvider {
222854
222860
  client;
222855
222861
  constructor(config2, model) {
@@ -222879,13 +222885,18 @@ var AnthropicProvider = class extends BaseProvider {
222879
222885
  let fullContent = "";
222880
222886
  let inputTokens = 0;
222881
222887
  let outputTokens = 0;
222888
+ const maxTokens = options.maxTokens ?? this.model.maxOutputTokens;
222889
+ const thinkParam = anthropicThinkingParam(this.model.id, maxTokens);
222890
+ const useThinking = !!thinkParam.thinking;
222882
222891
  const stream2 = this.client.messages.stream({
222883
222892
  model: this.model.id,
222884
- max_tokens: options.maxTokens ?? this.model.maxOutputTokens,
222885
- temperature: options.temperature ?? 0.7,
222893
+ max_tokens: maxTokens,
222894
+ // Extended thinking requires temperature = 1; otherwise honor the request.
222895
+ temperature: useThinking ? 1 : options.temperature ?? 0.7,
222886
222896
  system: options.systemPrompt,
222887
222897
  messages,
222888
- tools: tools?.length ? tools : void 0
222898
+ tools: tools?.length ? tools : void 0,
222899
+ ...thinkParam
222889
222900
  }, { signal: options.signal });
222890
222901
  let isThinking = false;
222891
222902
  for await (const event of stream2) {
package/dist/index.cjs CHANGED
@@ -77,7 +77,7 @@ var cron__default = /*#__PURE__*/_interopDefault(cron);
77
77
 
78
78
 
79
79
  // src/constants.ts
80
- var CASCADE_VERSION = "0.12.8";
80
+ var CASCADE_VERSION = "0.12.9";
81
81
  var CASCADE_CONFIG_DIR = ".cascade";
82
82
  var CASCADE_MD_FILE = "CASCADE.md";
83
83
  var CASCADE_IGNORE_FILE = ".cascadeignore";
@@ -477,6 +477,12 @@ var BaseProvider = class {
477
477
  };
478
478
 
479
479
  // src/providers/anthropic.ts
480
+ function anthropicThinkingParam(modelId, maxTokens) {
481
+ if (!/claude-(opus|sonnet)-4/i.test(modelId)) return {};
482
+ const budget = Math.min(8e3, maxTokens - 1024);
483
+ if (budget < 1024) return {};
484
+ return { thinking: { type: "enabled", budget_tokens: budget } };
485
+ }
480
486
  var AnthropicProvider = class extends BaseProvider {
481
487
  client;
482
488
  constructor(config, model) {
@@ -506,13 +512,18 @@ var AnthropicProvider = class extends BaseProvider {
506
512
  let fullContent = "";
507
513
  let inputTokens = 0;
508
514
  let outputTokens = 0;
515
+ const maxTokens = options.maxTokens ?? this.model.maxOutputTokens;
516
+ const thinkParam = anthropicThinkingParam(this.model.id, maxTokens);
517
+ const useThinking = !!thinkParam.thinking;
509
518
  const stream = this.client.messages.stream({
510
519
  model: this.model.id,
511
- max_tokens: options.maxTokens ?? this.model.maxOutputTokens,
512
- temperature: options.temperature ?? 0.7,
520
+ max_tokens: maxTokens,
521
+ // Extended thinking requires temperature = 1; otherwise honor the request.
522
+ temperature: useThinking ? 1 : options.temperature ?? 0.7,
513
523
  system: options.systemPrompt,
514
524
  messages,
515
- tools: tools?.length ? tools : void 0
525
+ tools: tools?.length ? tools : void 0,
526
+ ...thinkParam
516
527
  }, { signal: options.signal });
517
528
  let isThinking = false;
518
529
  for await (const event of stream) {