@corbat-tech/coco 2.30.0 → 2.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -503,16 +503,16 @@ declare const CocoConfigSchema: z.ZodObject<{
503
503
  "kimi-code": "kimi-code";
504
504
  lmstudio: "lmstudio";
505
505
  codex: "codex";
506
- qwen: "qwen";
507
- deepseek: "deepseek";
508
- mistral: "mistral";
509
506
  copilot: "copilot";
510
- vertex: "vertex";
511
- ollama: "ollama";
512
507
  groq: "groq";
513
508
  openrouter: "openrouter";
509
+ mistral: "mistral";
510
+ deepseek: "deepseek";
514
511
  together: "together";
515
512
  huggingface: "huggingface";
513
+ qwen: "qwen";
514
+ vertex: "vertex";
515
+ ollama: "ollama";
516
516
  }>>;
517
517
  apiKey: z.ZodOptional<z.ZodString>;
518
518
  model: z.ZodDefault<z.ZodString>;
@@ -523,6 +523,15 @@ declare const CocoConfigSchema: z.ZodObject<{
523
523
  location: z.ZodOptional<z.ZodString>;
524
524
  }, z.core.$strip>>;
525
525
  providerModels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
526
+ providerThinking: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
527
+ high: "high";
528
+ medium: "medium";
529
+ low: "low";
530
+ off: "off";
531
+ auto: "auto";
532
+ }>, z.ZodObject<{
533
+ budget: z.ZodNumber;
534
+ }, z.core.$strip>]>>>;
526
535
  quality: z.ZodDefault<z.ZodObject<{
527
536
  minScore: z.ZodDefault<z.ZodNumber>;
528
537
  minCoverage: z.ZodDefault<z.ZodNumber>;
@@ -926,9 +935,33 @@ interface InputAnalysis {
926
935
  */
927
936
  type ProjectType = "cli" | "api" | "web_app" | "library" | "service" | "full_stack" | "automation" | "unknown";
928
937
 
938
+ /**
939
+ * Unified thinking/reasoning mode support for all LLM providers.
940
+ *
941
+ * Normalizes three distinct API surfaces:
942
+ * - Anthropic: thinking.budget_tokens
943
+ * - OpenAI Chat Completions: reasoning_effort
944
+ * - OpenAI Responses API: reasoning.effort
945
+ * - Gemini: thinkingConfig.thinkingBudget
946
+ * - Kimi: thinking.type enabled/disabled
947
+ */
948
+ /**
949
+ * Provider-agnostic thinking mode.
950
+ * "off" — disable thinking entirely (or keep disabled for models like Kimi)
951
+ * "auto" — provider default / dynamic budget
952
+ * "low" — minimal reasoning
953
+ * "medium" — balanced reasoning
954
+ * "high" — maximum reasoning
955
+ * { budget: N } — explicit token budget (Anthropic / Gemini only; rejected for effort-only providers)
956
+ */
957
+ type ThinkingMode = "off" | "auto" | "low" | "medium" | "high" | {
958
+ budget: number;
959
+ };
960
+
929
961
  /**
930
962
  * LLM Provider types for Corbat-Coco
931
963
  */
964
+
932
965
  /**
933
966
  * Message role
934
967
  */
@@ -1016,6 +1049,8 @@ interface ChatOptions {
1016
1049
  timeout?: number;
1017
1050
  /** Abort signal to cancel in-flight requests */
1018
1051
  signal?: AbortSignal;
1052
+ /** Thinking/reasoning mode to pass to the model (if supported) */
1053
+ thinking?: ThinkingMode;
1019
1054
  }
1020
1055
  /**
1021
1056
  * Chat response
package/dist/index.js CHANGED
@@ -1032,6 +1032,7 @@ __export(schema_exports, {
1032
1032
  ShipConfigSchema: () => ShipConfigSchema,
1033
1033
  SkillsConfigSchema: () => SkillsConfigSchema,
1034
1034
  StackConfigSchema: () => StackConfigSchema,
1035
+ ThinkingModeSchema: () => ThinkingModeSchema,
1035
1036
  ToolsConfigSchema: () => ToolsConfigSchema,
1036
1037
  createDefaultConfigObject: () => createDefaultConfigObject,
1037
1038
  validateConfig: () => validateConfig
@@ -1076,9 +1077,13 @@ function createDefaultConfigObject(projectName, language = "typescript") {
1076
1077
  }
1077
1078
  };
1078
1079
  }
1079
- var ProviderConfigSchema, QualityConfigSchema, PersistenceConfigSchema, StackConfigSchema, ProjectConfigSchema2, GitHubConfigSchema, IntegrationsConfigSchema, MCPServerConfigEntrySchema, MCPConfigSchema, ToolsConfigSchema, ShipConfigSchema, SkillsConfigSchema, CocoConfigSchema;
1080
+ var ThinkingModeSchema, ProviderConfigSchema, QualityConfigSchema, PersistenceConfigSchema, StackConfigSchema, ProjectConfigSchema2, GitHubConfigSchema, IntegrationsConfigSchema, MCPServerConfigEntrySchema, MCPConfigSchema, ToolsConfigSchema, ShipConfigSchema, SkillsConfigSchema, CocoConfigSchema;
1080
1081
  var init_schema = __esm({
1081
1082
  "src/config/schema.ts"() {
1083
+ ThinkingModeSchema = z.union([
1084
+ z.enum(["off", "auto", "low", "medium", "high"]),
1085
+ z.object({ budget: z.number().int().min(0).max(2e5) })
1086
+ ]);
1082
1087
  ProviderConfigSchema = z.object({
1083
1088
  type: z.enum([
1084
1089
  "anthropic",
@@ -1240,6 +1245,7 @@ var init_schema = __esm({
1240
1245
  timeout: 12e4
1241
1246
  }),
1242
1247
  providerModels: z.record(z.string(), z.string()).optional(),
1248
+ providerThinking: z.record(z.string(), ThinkingModeSchema).optional(),
1243
1249
  quality: QualityConfigSchema.default({
1244
1250
  minScore: 85,
1245
1251
  minCoverage: 80,
@@ -13563,6 +13569,94 @@ async function withRetry(fn, config = {}) {
13563
13569
 
13564
13570
  // src/providers/anthropic.ts
13565
13571
  init_logger();
13572
+
13573
+ // src/providers/thinking.ts
13574
+ var ANTHROPIC_BUDGET = {
13575
+ low: 2048,
13576
+ medium: 8e3,
13577
+ high: 16e3
13578
+ };
13579
+ var GEMINI_BUDGET = {
13580
+ low: 2048,
13581
+ medium: 8e3,
13582
+ high: 16e3
13583
+ };
13584
+ function isAnthropicThinkingModel(model) {
13585
+ const m = model.toLowerCase();
13586
+ if (m === "kimi-for-coding") return false;
13587
+ return m.includes("claude-3-7") || m.includes("claude-opus-4") || m.includes("claude-sonnet-4") || m.includes("claude-haiku-4-5") || m.includes("claude-4");
13588
+ }
13589
+ function isOpenAIReasoningModel(model) {
13590
+ const m = model.toLowerCase();
13591
+ return m.startsWith("o1") || m.startsWith("o3") || m.startsWith("o4") || m.startsWith("gpt-5") || m.includes("codex");
13592
+ }
13593
+ function isGeminiThinkingModel(model) {
13594
+ const m = model.toLowerCase();
13595
+ return m.includes("gemini-2.5-pro") || m.includes("gemini-2.5-flash") || m.includes("gemini-3") && !m.includes("flash-lite") || m.includes("gemini-2.0-flash-thinking");
13596
+ }
13597
+ function isKimiThinkingModel(model) {
13598
+ const m = model.toLowerCase();
13599
+ return m.includes("kimi-k2") || m === "kimi-latest";
13600
+ }
13601
+ var ANTHROPIC_CAPABILITY = {
13602
+ budgetRange: { min: 1024, max: 64e3, default: ANTHROPIC_BUDGET.medium }};
13603
+ var GEMINI_CAPABILITY = {
13604
+ budgetRange: { min: 0, max: 32e3}};
13605
+ function mapToAnthropic(mode, model) {
13606
+ if (!mode || mode === "off") return void 0;
13607
+ if (!isAnthropicThinkingModel(model)) return void 0;
13608
+ const cap = ANTHROPIC_CAPABILITY;
13609
+ const { min, max } = cap.budgetRange;
13610
+ if (typeof mode === "object") {
13611
+ return { type: "enabled", budget_tokens: Math.min(Math.max(mode.budget, min), max) };
13612
+ }
13613
+ const budgetMap = {
13614
+ auto: cap.budgetRange.default,
13615
+ low: ANTHROPIC_BUDGET.low,
13616
+ medium: ANTHROPIC_BUDGET.medium,
13617
+ high: ANTHROPIC_BUDGET.high
13618
+ };
13619
+ const budget = budgetMap[mode];
13620
+ if (budget === void 0) return void 0;
13621
+ return { type: "enabled", budget_tokens: budget };
13622
+ }
13623
+ function mapToOpenAIEffort(mode, model) {
13624
+ if (!mode || mode === "off") return void 0;
13625
+ if (!isOpenAIReasoningModel(model)) return void 0;
13626
+ if (typeof mode === "object") {
13627
+ const { budget } = mode;
13628
+ if (budget <= 2048) return "low";
13629
+ if (budget <= 8e3) return "medium";
13630
+ return "high";
13631
+ }
13632
+ if (mode === "auto") return "medium";
13633
+ if (mode === "low" || mode === "medium" || mode === "high") return mode;
13634
+ return void 0;
13635
+ }
13636
+ function mapToGeminiBudget(mode, model) {
13637
+ if (!isGeminiThinkingModel(model)) return void 0;
13638
+ if (!mode) return void 0;
13639
+ if (mode === "off") return 0;
13640
+ if (mode === "auto") return -1;
13641
+ const { min, max } = GEMINI_CAPABILITY.budgetRange;
13642
+ if (typeof mode === "object") {
13643
+ return Math.min(Math.max(mode.budget, min), max);
13644
+ }
13645
+ const budgetMap = {
13646
+ low: GEMINI_BUDGET.low,
13647
+ medium: GEMINI_BUDGET.medium,
13648
+ high: GEMINI_BUDGET.high
13649
+ };
13650
+ return budgetMap[mode];
13651
+ }
13652
+ function mapToKimiExtraBody(mode, model) {
13653
+ if (!isKimiThinkingModel(model)) return void 0;
13654
+ const effectiveMode = mode ?? "off";
13655
+ const enabled = effectiveMode !== "off";
13656
+ return { thinking: { type: enabled ? "enabled" : "disabled" } };
13657
+ }
13658
+
13659
+ // src/providers/anthropic.ts
13566
13660
  var DEFAULT_MODEL = "claude-opus-4-6";
13567
13661
  var CONTEXT_WINDOWS = {
13568
13662
  // Kimi Code model (Anthropic-compatible endpoint)
@@ -13623,13 +13717,19 @@ var AnthropicProvider = class {
13623
13717
  this.ensureInitialized();
13624
13718
  return withRetry(async () => {
13625
13719
  try {
13720
+ const model = options?.model ?? this.config.model ?? DEFAULT_MODEL;
13721
+ const thinkingParam = mapToAnthropic(options?.thinking, model);
13722
+ const baseMaxTokens = options?.maxTokens ?? this.config.maxTokens ?? 8192;
13626
13723
  const response = await this.client.messages.create({
13627
- model: options?.model ?? this.config.model ?? DEFAULT_MODEL,
13628
- max_tokens: options?.maxTokens ?? this.config.maxTokens ?? 8192,
13629
- temperature: options?.temperature ?? this.config.temperature ?? 0,
13724
+ model,
13725
+ // Anthropic requires max_tokens > budget_tokens
13726
+ max_tokens: thinkingParam ? Math.max(baseMaxTokens, thinkingParam.budget_tokens + 1024) : baseMaxTokens,
13727
+ // Anthropic requires temperature=1 when thinking is enabled
13728
+ temperature: thinkingParam ? 1 : options?.temperature ?? this.config.temperature ?? 0,
13630
13729
  system: this.extractSystem(messages, options?.system),
13631
13730
  messages: this.convertMessages(messages),
13632
- stop_sequences: options?.stopSequences
13731
+ stop_sequences: options?.stopSequences,
13732
+ ...thinkingParam && { thinking: thinkingParam }
13633
13733
  });
13634
13734
  return {
13635
13735
  id: response.id,
@@ -13653,14 +13753,18 @@ var AnthropicProvider = class {
13653
13753
  this.ensureInitialized();
13654
13754
  return withRetry(async () => {
13655
13755
  try {
13756
+ const model = options?.model ?? this.config.model ?? DEFAULT_MODEL;
13757
+ const thinkingParam = mapToAnthropic(options?.thinking, model);
13758
+ const baseMaxTokens = options?.maxTokens ?? this.config.maxTokens ?? 8192;
13656
13759
  const response = await this.client.messages.create({
13657
- model: options?.model ?? this.config.model ?? DEFAULT_MODEL,
13658
- max_tokens: options?.maxTokens ?? this.config.maxTokens ?? 8192,
13659
- temperature: options?.temperature ?? this.config.temperature ?? 0,
13760
+ model,
13761
+ max_tokens: thinkingParam ? Math.max(baseMaxTokens, thinkingParam.budget_tokens + 1024) : baseMaxTokens,
13762
+ temperature: thinkingParam ? 1 : options?.temperature ?? this.config.temperature ?? 0,
13660
13763
  system: this.extractSystem(messages, options?.system),
13661
13764
  messages: this.convertMessages(messages),
13662
13765
  tools: this.convertTools(options.tools),
13663
- tool_choice: options.toolChoice ? this.convertToolChoice(options.toolChoice) : void 0
13766
+ tool_choice: options.toolChoice ? this.convertToolChoice(options.toolChoice) : void 0,
13767
+ ...thinkingParam && { thinking: thinkingParam }
13664
13768
  });
13665
13769
  const toolCalls = this.extractToolCalls(response.content);
13666
13770
  return {
@@ -13686,13 +13790,17 @@ var AnthropicProvider = class {
13686
13790
  this.ensureInitialized();
13687
13791
  let timeoutTriggered = false;
13688
13792
  try {
13793
+ const model = options?.model ?? this.config.model ?? DEFAULT_MODEL;
13794
+ const thinkingParam = mapToAnthropic(options?.thinking, model);
13795
+ const baseMaxTokens = options?.maxTokens ?? this.config.maxTokens ?? 8192;
13689
13796
  const stream = await this.client.messages.stream(
13690
13797
  {
13691
- model: options?.model ?? this.config.model ?? DEFAULT_MODEL,
13692
- max_tokens: options?.maxTokens ?? this.config.maxTokens ?? 8192,
13693
- temperature: options?.temperature ?? this.config.temperature ?? 0,
13798
+ model,
13799
+ max_tokens: thinkingParam ? Math.max(baseMaxTokens, thinkingParam.budget_tokens + 1024) : baseMaxTokens,
13800
+ temperature: thinkingParam ? 1 : options?.temperature ?? this.config.temperature ?? 0,
13694
13801
  system: this.extractSystem(messages, options?.system),
13695
- messages: this.convertMessages(messages)
13802
+ messages: this.convertMessages(messages),
13803
+ ...thinkingParam && { thinking: thinkingParam }
13696
13804
  },
13697
13805
  { signal: options?.signal }
13698
13806
  );
@@ -13748,15 +13856,19 @@ var AnthropicProvider = class {
13748
13856
  this.ensureInitialized();
13749
13857
  let timeoutTriggered = false;
13750
13858
  try {
13859
+ const model = options?.model ?? this.config.model ?? DEFAULT_MODEL;
13860
+ const thinkingParam = mapToAnthropic(options?.thinking, model);
13861
+ const baseMaxTokens = options?.maxTokens ?? this.config.maxTokens ?? 8192;
13751
13862
  const stream = await this.client.messages.stream(
13752
13863
  {
13753
- model: options?.model ?? this.config.model ?? DEFAULT_MODEL,
13754
- max_tokens: options?.maxTokens ?? this.config.maxTokens ?? 8192,
13755
- temperature: options?.temperature ?? this.config.temperature ?? 0,
13864
+ model,
13865
+ max_tokens: thinkingParam ? Math.max(baseMaxTokens, thinkingParam.budget_tokens + 1024) : baseMaxTokens,
13866
+ temperature: thinkingParam ? 1 : options?.temperature ?? this.config.temperature ?? 0,
13756
13867
  system: this.extractSystem(messages, options?.system),
13757
13868
  messages: this.convertMessages(messages),
13758
13869
  tools: this.convertTools(options.tools),
13759
- tool_choice: options.toolChoice ? this.convertToolChoice(options.toolChoice) : void 0
13870
+ tool_choice: options.toolChoice ? this.convertToolChoice(options.toolChoice) : void 0,
13871
+ ...thinkingParam && { thinking: thinkingParam }
13760
13872
  },
13761
13873
  { signal: options?.signal }
13762
13874
  );
@@ -14421,26 +14533,15 @@ var OpenAIProvider = class {
14421
14533
  return !MODELS_WITHOUT_TEMPERATURE.some((m) => model.toLowerCase().includes(m.toLowerCase()));
14422
14534
  }
14423
14535
  /**
14424
- * Check if a model needs thinking mode disabled for tool use
14425
- * Kimi models have thinking mode enabled by default which requires
14426
- * reasoning_content in multi-turn conversations with tools
14536
+ * Get extra body parameters for API calls.
14537
+ * Honors the user's ThinkingMode for Kimi models; defaults to disabled
14538
+ * (preserving existing behavior) when no mode is specified.
14427
14539
  */
14428
- needsThinkingDisabled(model) {
14429
- return MODELS_WITH_THINKING_MODE.some((m) => model.toLowerCase().includes(m.toLowerCase()));
14430
- }
14431
- /**
14432
- * Get extra body parameters for API calls
14433
- * Used to disable thinking mode for Kimi models
14434
- * See: https://huggingface.co/moonshotai/Kimi-K2.5
14435
- *
14436
- * For Official Moonshot API: {'thinking': {'type': 'disabled'}}
14437
- * For vLLM/SGLang: {'chat_template_kwargs': {"thinking": False}}
14438
- */
14439
- getExtraBody(model) {
14440
- if (this.needsThinkingDisabled(model)) {
14441
- return {
14442
- thinking: { type: "disabled" }
14443
- };
14540
+ getExtraBody(model, thinking) {
14541
+ const kimiBody = mapToKimiExtraBody(thinking, model);
14542
+ if (kimiBody) return kimiBody;
14543
+ if (MODELS_WITH_THINKING_MODE.some((m) => model.toLowerCase().includes(m.toLowerCase()))) {
14544
+ return { thinking: { type: "disabled" } };
14444
14545
  }
14445
14546
  return void 0;
14446
14547
  }
@@ -14457,6 +14558,7 @@ var OpenAIProvider = class {
14457
14558
  try {
14458
14559
  const supportsTemp = this.supportsTemperature(model);
14459
14560
  const maxTokens = options?.maxTokens ?? this.config.maxTokens ?? 8192;
14561
+ const reasoningEffort = mapToOpenAIEffort(options?.thinking, model);
14460
14562
  const response = await this.client.chat.completions.create({
14461
14563
  model,
14462
14564
  ...buildMaxTokensParam(model, maxTokens),
@@ -14464,7 +14566,8 @@ var OpenAIProvider = class {
14464
14566
  stop: options?.stopSequences,
14465
14567
  ...supportsTemp && {
14466
14568
  temperature: options?.temperature ?? this.config.temperature ?? 0
14467
- }
14569
+ },
14570
+ ...reasoningEffort && { reasoning_effort: reasoningEffort }
14468
14571
  });
14469
14572
  const choice = response.choices[0];
14470
14573
  return {
@@ -14494,7 +14597,8 @@ var OpenAIProvider = class {
14494
14597
  return withRetry(async () => {
14495
14598
  try {
14496
14599
  const supportsTemp = this.supportsTemperature(model);
14497
- const extraBody = this.getExtraBody(model);
14600
+ const extraBody = this.getExtraBody(model, options?.thinking);
14601
+ const reasoningEffort = mapToOpenAIEffort(options?.thinking, model);
14498
14602
  const maxTokens = options?.maxTokens ?? this.config.maxTokens ?? 8192;
14499
14603
  const requestParams = {
14500
14604
  model,
@@ -14506,6 +14610,9 @@ var OpenAIProvider = class {
14506
14610
  if (supportsTemp) {
14507
14611
  requestParams.temperature = options?.temperature ?? this.config.temperature ?? 0;
14508
14612
  }
14613
+ if (reasoningEffort) {
14614
+ requestParams.reasoning_effort = reasoningEffort;
14615
+ }
14509
14616
  if (extraBody) {
14510
14617
  Object.assign(requestParams, extraBody);
14511
14618
  }
@@ -14543,12 +14650,14 @@ var OpenAIProvider = class {
14543
14650
  try {
14544
14651
  const supportsTemp = this.supportsTemperature(model);
14545
14652
  const maxTokens = options?.maxTokens ?? this.config.maxTokens ?? 8192;
14653
+ const reasoningEffort = mapToOpenAIEffort(options?.thinking, model);
14546
14654
  const stream = await this.client.chat.completions.create({
14547
14655
  model,
14548
14656
  ...buildMaxTokensParam(model, maxTokens),
14549
14657
  messages: this.convertMessages(messages, options?.system),
14550
14658
  stream: true,
14551
- ...supportsTemp && { temperature: options?.temperature ?? this.config.temperature ?? 0 }
14659
+ ...supportsTemp && { temperature: options?.temperature ?? this.config.temperature ?? 0 },
14660
+ ...reasoningEffort && { reasoning_effort: reasoningEffort }
14552
14661
  });
14553
14662
  let streamStopReason;
14554
14663
  for await (const chunk of stream) {
@@ -14579,7 +14688,8 @@ var OpenAIProvider = class {
14579
14688
  let timeoutTriggered = false;
14580
14689
  try {
14581
14690
  const supportsTemp = this.supportsTemperature(model);
14582
- const extraBody = this.getExtraBody(model);
14691
+ const extraBody = this.getExtraBody(model, options?.thinking);
14692
+ const reasoningEffort = mapToOpenAIEffort(options?.thinking, model);
14583
14693
  const maxTokens = options?.maxTokens ?? this.config.maxTokens ?? 8192;
14584
14694
  const requestParams = {
14585
14695
  model,
@@ -14592,6 +14702,9 @@ var OpenAIProvider = class {
14592
14702
  if (supportsTemp) {
14593
14703
  requestParams.temperature = options?.temperature ?? this.config.temperature ?? 0;
14594
14704
  }
14705
+ if (reasoningEffort) {
14706
+ requestParams.reasoning_effort = reasoningEffort;
14707
+ }
14595
14708
  if (extraBody) {
14596
14709
  Object.assign(requestParams, extraBody);
14597
14710
  }
@@ -15059,6 +15172,7 @@ var OpenAIProvider = class {
15059
15172
  const model = options?.model ?? this.config.model ?? DEFAULT_MODEL2;
15060
15173
  const { input, instructions } = this.convertToResponsesInput(messages, options?.system);
15061
15174
  const supportsTemp = this.supportsTemperature(model);
15175
+ const reasoningEffort = mapToOpenAIEffort(options?.thinking, model);
15062
15176
  const response = await this.client.responses.create({
15063
15177
  model,
15064
15178
  input,
@@ -15067,6 +15181,8 @@ var OpenAIProvider = class {
15067
15181
  ...supportsTemp && {
15068
15182
  temperature: options?.temperature ?? this.config.temperature ?? 0
15069
15183
  },
15184
+ // Responses API uses nested reasoning.effort (not top-level reasoning_effort)
15185
+ ...reasoningEffort && { reasoning: { effort: reasoningEffort } },
15070
15186
  store: false
15071
15187
  });
15072
15188
  return {
@@ -15095,6 +15211,7 @@ var OpenAIProvider = class {
15095
15211
  const { input, instructions } = this.convertToResponsesInput(messages, options?.system);
15096
15212
  const tools = this.convertToolsForResponses(options.tools);
15097
15213
  const supportsTemp = this.supportsTemperature(model);
15214
+ const reasoningEffort = mapToOpenAIEffort(options?.thinking, model);
15098
15215
  const response = await this.client.responses.create({
15099
15216
  model,
15100
15217
  input,
@@ -15104,6 +15221,7 @@ var OpenAIProvider = class {
15104
15221
  ...supportsTemp && {
15105
15222
  temperature: options?.temperature ?? this.config.temperature ?? 0
15106
15223
  },
15224
+ ...reasoningEffort && { reasoning: { effort: reasoningEffort } },
15107
15225
  store: false
15108
15226
  });
15109
15227
  let content = "";
@@ -15149,12 +15267,14 @@ var OpenAIProvider = class {
15149
15267
  const model = options?.model ?? this.config.model ?? DEFAULT_MODEL2;
15150
15268
  const { input, instructions } = this.convertToResponsesInput(messages, options?.system);
15151
15269
  const supportsTemp = this.supportsTemperature(model);
15270
+ const reasoningEffort = mapToOpenAIEffort(options?.thinking, model);
15152
15271
  const stream = await this.client.responses.create({
15153
15272
  model,
15154
15273
  input,
15155
15274
  instructions: instructions ?? void 0,
15156
15275
  max_output_tokens: options?.maxTokens ?? this.config.maxTokens ?? 8192,
15157
15276
  ...supportsTemp && { temperature: options?.temperature ?? this.config.temperature ?? 0 },
15277
+ ...reasoningEffort && { reasoning: { effort: reasoningEffort } },
15158
15278
  store: false,
15159
15279
  stream: true
15160
15280
  });
@@ -15212,12 +15332,14 @@ var OpenAIProvider = class {
15212
15332
  const { input, instructions } = this.convertToResponsesInput(messages, options?.system);
15213
15333
  const tools = options.tools.length > 0 ? this.convertToolsForResponses(options.tools) : void 0;
15214
15334
  const supportsTemp = this.supportsTemperature(model);
15335
+ const reasoningEffort = mapToOpenAIEffort(options?.thinking, model);
15215
15336
  const requestParams = {
15216
15337
  model,
15217
15338
  input,
15218
15339
  instructions: instructions ?? void 0,
15219
15340
  max_output_tokens: options?.maxTokens ?? this.config.maxTokens ?? 8192,
15220
15341
  ...supportsTemp && { temperature: options?.temperature ?? this.config.temperature ?? 0 },
15342
+ ...reasoningEffort && { reasoning: { effort: reasoningEffort } },
15221
15343
  store: false,
15222
15344
  stream: true
15223
15345
  };
@@ -16396,12 +16518,17 @@ var GeminiProvider = class {
16396
16518
  return model ?? this.config.model ?? DEFAULT_MODEL5;
16397
16519
  }
16398
16520
  buildConfig(messages, options, tools, toolChoice) {
16521
+ const model = this.getModel(options?.model);
16522
+ const thinkingBudget = mapToGeminiBudget(options?.thinking, model);
16399
16523
  const config = {
16400
16524
  maxOutputTokens: options?.maxTokens ?? this.config.maxTokens ?? 8192,
16401
16525
  temperature: options?.temperature ?? this.config.temperature ?? 0,
16402
16526
  stopSequences: options?.stopSequences,
16403
16527
  systemInstruction: this.extractSystem(messages, options?.system)
16404
16528
  };
16529
+ if (thinkingBudget !== void 0) {
16530
+ config.thinkingConfig = { thinkingBudget };
16531
+ }
16405
16532
  if (tools && tools.length > 0) {
16406
16533
  config.tools = [{ functionDeclarations: this.convertTools(tools) }];
16407
16534
  config.toolConfig = {