@hiper2d/ai-agents 0.12.0 → 0.13.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.
package/dist/index.d.mts CHANGED
@@ -543,8 +543,12 @@ declare function getProviderSignatureFields(aiType: string, signature?: string):
543
543
  * - Moonshot Kimi K3 (platform.kimi.ai/docs/guide/use-reasoning-effort, 2026-09-22):
544
544
  * low|high|max, default max, top-level on Chat Completions. Moonshot shipped the lower
545
545
  * levels after launch; K3 accepted only "max" when this agent was written.
546
- * Qwen accepts reasoning_effort but ignores it (thinking_budget is its knob); MiniMax exposes
547
- * no effort parameter.
546
+ * - Qwen 3.8 max/flash (docs.qwencloud.com, re-probed 2026-09-22): low|medium|xhigh, default
547
+ * xhigh, with `high` and `max` aliased onto xhigh and `minimal` onto low. It is a coarse
548
+ * alias for thinking_budget (low = 4,096, medium = 16,384, xhigh = 262,144 tokens) and the
549
+ * two are mutually exclusive — sending both is a 400. QwenAgent sends the budget instead,
550
+ * because 1,024 is tighter than the lowest level effort can express.
551
+ * MiniMax exposes no effort parameter.
548
552
  */
549
553
  type OpenAIReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
550
554
  type AnthropicReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh' | 'max';
@@ -1394,6 +1398,15 @@ declare class Gpt5Agent extends AbstractAgent {
1394
1398
  private readonly logTemplates;
1395
1399
  private readonly errorMessages;
1396
1400
  constructor(name: string, instruction: string, model: string, apiKey: string, temperature: number, enableThinking?: boolean, agentLoggingConfig?: AgentLoggingConfig);
1401
+ /**
1402
+ * `reasoning: {effort}`, sent only when the catalog names a level. Every current OpenAI
1403
+ * model defaults to "medium" when the field is omitted — verified 2026-09-22 by calling
1404
+ * astra/sol/terra/luna with no reasoning param and reading the effort the API echoes back,
1405
+ * since OpenAI documents the default for Sol, Luna and the 5.6 family but not for Astra.
1406
+ * The catalog pins all four to medium so the level is explicit in our request rather than
1407
+ * inherited from a default OpenAI can change under us.
1408
+ */
1409
+ private reasoningParams;
1397
1410
  /**
1398
1411
  * Structured output method using Zod with OpenAI's Responses API
1399
1412
  * This provides better schema handling and runtime validation
@@ -1695,12 +1708,21 @@ declare class QwenAgent extends AbstractAgent {
1695
1708
  * generation); without it the model thinks at the provider default, and qwen3.8-max's
1696
1709
  * latency then swings 30–100s.
1697
1710
  *
1698
- * `reasoning_effort` is deliberately NOT sent. Probed live 2026-08-30 on qwen3.8-flash and
1699
- * qwen3.8-max: every value low..max is accepted, but reasoning length doesn't track it
1700
- * (max: low → 1,686 reasoning tokens / 44s, high → 226 / 7s, xhigh → 1,102 / 30s), while
1701
- * thinking_budget bounds it reliably (≤340 at 1024). The docs also call the two mutually
1702
- * exclusive on qwen3.8-max. So on Qwen the budget IS the effort knob; `reasoningEffort`
1703
- * on this agent is ignored.
1711
+ * `reasoning_effort` is NOT sent, and the earlier reason recorded here was wrong. The
1712
+ * 2026-08-30 probe concluded "reasoning length doesn't track effort"; it had tested
1713
+ * low/high/max/xhigh, but Qwen only defines low|medium|xhigh and aliases both `high` and
1714
+ * `max` onto `xhigh`. So that probe compared low against xhigh twice and read the noise as
1715
+ * non-monotonicity.
1716
+ *
1717
+ * Re-probed 2026-09-22 with the documented levels, and effort tracks cleanly:
1718
+ * qwen3.8-max budget 1024 → 77 reasoning | low 132 | medium 160 | xhigh 422
1719
+ * qwen3.8-flash budget 1024 → 86 reasoning | low 87 | medium 251 | xhigh 417
1720
+ *
1721
+ * We still send the budget, for a better reason: the two are mutually exclusive (sending
1722
+ * both is a 400), Qwen documents effort as a coarse alias for a budget (low = 4,096,
1723
+ * medium = 16,384, xhigh = 262,144 tokens), and our 1,024 is tighter than the lowest level
1724
+ * it can express. The budget is the finer AND cheaper knob here, so `reasoningEffort` on
1725
+ * this agent stays ignored — deliberately, not because effort is broken.
1704
1726
  */
1705
1727
  private thinkingParams;
1706
1728
  private convertToOpenAIMessages;
package/dist/index.d.ts CHANGED
@@ -543,8 +543,12 @@ declare function getProviderSignatureFields(aiType: string, signature?: string):
543
543
  * - Moonshot Kimi K3 (platform.kimi.ai/docs/guide/use-reasoning-effort, 2026-09-22):
544
544
  * low|high|max, default max, top-level on Chat Completions. Moonshot shipped the lower
545
545
  * levels after launch; K3 accepted only "max" when this agent was written.
546
- * Qwen accepts reasoning_effort but ignores it (thinking_budget is its knob); MiniMax exposes
547
- * no effort parameter.
546
+ * - Qwen 3.8 max/flash (docs.qwencloud.com, re-probed 2026-09-22): low|medium|xhigh, default
547
+ * xhigh, with `high` and `max` aliased onto xhigh and `minimal` onto low. It is a coarse
548
+ * alias for thinking_budget (low = 4,096, medium = 16,384, xhigh = 262,144 tokens) and the
549
+ * two are mutually exclusive — sending both is a 400. QwenAgent sends the budget instead,
550
+ * because 1,024 is tighter than the lowest level effort can express.
551
+ * MiniMax exposes no effort parameter.
548
552
  */
549
553
  type OpenAIReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
550
554
  type AnthropicReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh' | 'max';
@@ -1394,6 +1398,15 @@ declare class Gpt5Agent extends AbstractAgent {
1394
1398
  private readonly logTemplates;
1395
1399
  private readonly errorMessages;
1396
1400
  constructor(name: string, instruction: string, model: string, apiKey: string, temperature: number, enableThinking?: boolean, agentLoggingConfig?: AgentLoggingConfig);
1401
+ /**
1402
+ * `reasoning: {effort}`, sent only when the catalog names a level. Every current OpenAI
1403
+ * model defaults to "medium" when the field is omitted — verified 2026-09-22 by calling
1404
+ * astra/sol/terra/luna with no reasoning param and reading the effort the API echoes back,
1405
+ * since OpenAI documents the default for Sol, Luna and the 5.6 family but not for Astra.
1406
+ * The catalog pins all four to medium so the level is explicit in our request rather than
1407
+ * inherited from a default OpenAI can change under us.
1408
+ */
1409
+ private reasoningParams;
1397
1410
  /**
1398
1411
  * Structured output method using Zod with OpenAI's Responses API
1399
1412
  * This provides better schema handling and runtime validation
@@ -1695,12 +1708,21 @@ declare class QwenAgent extends AbstractAgent {
1695
1708
  * generation); without it the model thinks at the provider default, and qwen3.8-max's
1696
1709
  * latency then swings 30–100s.
1697
1710
  *
1698
- * `reasoning_effort` is deliberately NOT sent. Probed live 2026-08-30 on qwen3.8-flash and
1699
- * qwen3.8-max: every value low..max is accepted, but reasoning length doesn't track it
1700
- * (max: low → 1,686 reasoning tokens / 44s, high → 226 / 7s, xhigh → 1,102 / 30s), while
1701
- * thinking_budget bounds it reliably (≤340 at 1024). The docs also call the two mutually
1702
- * exclusive on qwen3.8-max. So on Qwen the budget IS the effort knob; `reasoningEffort`
1703
- * on this agent is ignored.
1711
+ * `reasoning_effort` is NOT sent, and the earlier reason recorded here was wrong. The
1712
+ * 2026-08-30 probe concluded "reasoning length doesn't track effort"; it had tested
1713
+ * low/high/max/xhigh, but Qwen only defines low|medium|xhigh and aliases both `high` and
1714
+ * `max` onto `xhigh`. So that probe compared low against xhigh twice and read the noise as
1715
+ * non-monotonicity.
1716
+ *
1717
+ * Re-probed 2026-09-22 with the documented levels, and effort tracks cleanly:
1718
+ * qwen3.8-max budget 1024 → 77 reasoning | low 132 | medium 160 | xhigh 422
1719
+ * qwen3.8-flash budget 1024 → 86 reasoning | low 87 | medium 251 | xhigh 417
1720
+ *
1721
+ * We still send the budget, for a better reason: the two are mutually exclusive (sending
1722
+ * both is a 400), Qwen documents effort as a coarse alias for a budget (low = 4,096,
1723
+ * medium = 16,384, xhigh = 262,144 tokens), and our 1,024 is tighter than the lowest level
1724
+ * it can express. The budget is the finer AND cheaper knob here, so `reasoningEffort` on
1725
+ * this agent stays ignored — deliberately, not because effort is broken.
1704
1726
  */
1705
1727
  private thinkingParams;
1706
1728
  private convertToOpenAIMessages;
package/dist/index.js CHANGED
@@ -1061,10 +1061,16 @@ var SupportedAiModels = {
1061
1061
  // GPT-6 Astra (2026-09-03): OpenAI's frontier tier above Sol. No `none` reasoning effort;
1062
1062
  // temperature/top_p are rejected — Gpt5Agent sends neither, so the same agent serves it.
1063
1063
  // The catalog temperature is only carried for the agent constructor signature.
1064
+ // All four OpenAI entries carry reasoningEffort: 'medium' as of 2026-09-22. That is
1065
+ // OpenAI's own current default, established by MEASUREMENT rather than docs: each model was
1066
+ // called with no reasoning param and the effort it echoes back read off the response, since
1067
+ // OpenAI documents the default for Sol, Luna and the 5.6 family but never states Astra's.
1068
+ // Pinning it changes no behaviour today; it stops the default moving under us silently.
1064
1069
  [LLM_CONSTANTS.GPT_ASTRA]: {
1065
1070
  displayName: "GPT-6 Astra",
1066
1071
  modelApiName: "gpt-6-astra",
1067
1072
  apiKeyName: API_KEY_CONSTANTS.OPENAI,
1073
+ reasoningEffort: "medium",
1068
1074
  hasThinking: true,
1069
1075
  temperature: 1,
1070
1076
  tags: ["expensive"]
@@ -1079,6 +1085,7 @@ var SupportedAiModels = {
1079
1085
  displayName: "GPT-6 Sol",
1080
1086
  modelApiName: "gpt-6-sol",
1081
1087
  apiKeyName: API_KEY_CONSTANTS.OPENAI,
1088
+ reasoningEffort: "medium",
1082
1089
  hasThinking: true,
1083
1090
  temperature: 1,
1084
1091
  tags: ["expensive"]
@@ -1087,6 +1094,7 @@ var SupportedAiModels = {
1087
1094
  displayName: "GPT-5.6 Terra",
1088
1095
  modelApiName: "gpt-5.6-terra",
1089
1096
  apiKeyName: API_KEY_CONSTANTS.OPENAI,
1097
+ reasoningEffort: "medium",
1090
1098
  hasThinking: true,
1091
1099
  temperature: 1,
1092
1100
  tags: ["fast", "expensive"]
@@ -1095,6 +1103,7 @@ var SupportedAiModels = {
1095
1103
  displayName: "GPT-6 Luna",
1096
1104
  modelApiName: "gpt-6-luna",
1097
1105
  apiKeyName: API_KEY_CONSTANTS.OPENAI,
1106
+ reasoningEffort: "medium",
1098
1107
  hasThinking: true,
1099
1108
  temperature: 1,
1100
1109
  tags: ["fast", "cheap"]
@@ -2508,6 +2517,17 @@ ${instruction}`);
2508
2517
  apiKey
2509
2518
  });
2510
2519
  }
2520
+ /**
2521
+ * `reasoning: {effort}`, sent only when the catalog names a level. Every current OpenAI
2522
+ * model defaults to "medium" when the field is omitted — verified 2026-09-22 by calling
2523
+ * astra/sol/terra/luna with no reasoning param and reading the effort the API echoes back,
2524
+ * since OpenAI documents the default for Sol, Luna and the 5.6 family but not for Astra.
2525
+ * The catalog pins all four to medium so the level is explicit in our request rather than
2526
+ * inherited from a default OpenAI can change under us.
2527
+ */
2528
+ reasoningParams() {
2529
+ return this.reasoningEffort ? { reasoning: { effort: toOpenAIEffort(this.reasoningEffort) } } : {};
2530
+ }
2511
2531
  /**
2512
2532
  * Structured output method using Zod with OpenAI's Responses API
2513
2533
  * This provides better schema handling and runtime validation
@@ -2528,6 +2548,7 @@ ${instruction}`);
2528
2548
  input,
2529
2549
  max_output_tokens: this.maxOutputTokens,
2530
2550
  prompt_cache_key: this.promptCacheKey,
2551
+ ...this.reasoningParams(),
2531
2552
  text: {
2532
2553
  format: (0, import_zod2.zodTextFormat)(schemaToSend, "response_schema")
2533
2554
  }
@@ -2612,7 +2633,8 @@ ${instruction}`);
2612
2633
  instructions: this.instruction,
2613
2634
  input,
2614
2635
  max_output_tokens: this.maxOutputTokens,
2615
- prompt_cache_key: this.promptCacheKey
2636
+ prompt_cache_key: this.promptCacheKey,
2637
+ ...this.reasoningParams()
2616
2638
  });
2617
2639
  const content = response.output_text;
2618
2640
  if (!content) {
@@ -4725,12 +4747,21 @@ var QwenAgent = class extends AbstractAgent {
4725
4747
  * generation); without it the model thinks at the provider default, and qwen3.8-max's
4726
4748
  * latency then swings 30–100s.
4727
4749
  *
4728
- * `reasoning_effort` is deliberately NOT sent. Probed live 2026-08-30 on qwen3.8-flash and
4729
- * qwen3.8-max: every value low..max is accepted, but reasoning length doesn't track it
4730
- * (max: low → 1,686 reasoning tokens / 44s, high → 226 / 7s, xhigh → 1,102 / 30s), while
4731
- * thinking_budget bounds it reliably (≤340 at 1024). The docs also call the two mutually
4732
- * exclusive on qwen3.8-max. So on Qwen the budget IS the effort knob; `reasoningEffort`
4733
- * on this agent is ignored.
4750
+ * `reasoning_effort` is NOT sent, and the earlier reason recorded here was wrong. The
4751
+ * 2026-08-30 probe concluded "reasoning length doesn't track effort"; it had tested
4752
+ * low/high/max/xhigh, but Qwen only defines low|medium|xhigh and aliases both `high` and
4753
+ * `max` onto `xhigh`. So that probe compared low against xhigh twice and read the noise as
4754
+ * non-monotonicity.
4755
+ *
4756
+ * Re-probed 2026-09-22 with the documented levels, and effort tracks cleanly:
4757
+ * qwen3.8-max budget 1024 → 77 reasoning | low 132 | medium 160 | xhigh 422
4758
+ * qwen3.8-flash budget 1024 → 86 reasoning | low 87 | medium 251 | xhigh 417
4759
+ *
4760
+ * We still send the budget, for a better reason: the two are mutually exclusive (sending
4761
+ * both is a 400), Qwen documents effort as a coarse alias for a budget (low = 4,096,
4762
+ * medium = 16,384, xhigh = 262,144 tokens), and our 1,024 is tighter than the lowest level
4763
+ * it can express. The budget is the finer AND cheaper knob here, so `reasoningEffort` on
4764
+ * this agent stays ignored — deliberately, not because effort is broken.
4734
4765
  */
4735
4766
  thinkingParams() {
4736
4767
  const budget = this.thinkingBudgetTokens;