@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.mjs CHANGED
@@ -886,10 +886,16 @@ var SupportedAiModels = {
886
886
  // GPT-6 Astra (2026-09-03): OpenAI's frontier tier above Sol. No `none` reasoning effort;
887
887
  // temperature/top_p are rejected — Gpt5Agent sends neither, so the same agent serves it.
888
888
  // The catalog temperature is only carried for the agent constructor signature.
889
+ // All four OpenAI entries carry reasoningEffort: 'medium' as of 2026-09-22. That is
890
+ // OpenAI's own current default, established by MEASUREMENT rather than docs: each model was
891
+ // called with no reasoning param and the effort it echoes back read off the response, since
892
+ // OpenAI documents the default for Sol, Luna and the 5.6 family but never states Astra's.
893
+ // Pinning it changes no behaviour today; it stops the default moving under us silently.
889
894
  [LLM_CONSTANTS.GPT_ASTRA]: {
890
895
  displayName: "GPT-6 Astra",
891
896
  modelApiName: "gpt-6-astra",
892
897
  apiKeyName: API_KEY_CONSTANTS.OPENAI,
898
+ reasoningEffort: "medium",
893
899
  hasThinking: true,
894
900
  temperature: 1,
895
901
  tags: ["expensive"]
@@ -904,6 +910,7 @@ var SupportedAiModels = {
904
910
  displayName: "GPT-6 Sol",
905
911
  modelApiName: "gpt-6-sol",
906
912
  apiKeyName: API_KEY_CONSTANTS.OPENAI,
913
+ reasoningEffort: "medium",
907
914
  hasThinking: true,
908
915
  temperature: 1,
909
916
  tags: ["expensive"]
@@ -912,6 +919,7 @@ var SupportedAiModels = {
912
919
  displayName: "GPT-5.6 Terra",
913
920
  modelApiName: "gpt-5.6-terra",
914
921
  apiKeyName: API_KEY_CONSTANTS.OPENAI,
922
+ reasoningEffort: "medium",
915
923
  hasThinking: true,
916
924
  temperature: 1,
917
925
  tags: ["fast", "expensive"]
@@ -920,6 +928,7 @@ var SupportedAiModels = {
920
928
  displayName: "GPT-6 Luna",
921
929
  modelApiName: "gpt-6-luna",
922
930
  apiKeyName: API_KEY_CONSTANTS.OPENAI,
931
+ reasoningEffort: "medium",
923
932
  hasThinking: true,
924
933
  temperature: 1,
925
934
  tags: ["fast", "cheap"]
@@ -2333,6 +2342,17 @@ ${instruction}`);
2333
2342
  apiKey
2334
2343
  });
2335
2344
  }
2345
+ /**
2346
+ * `reasoning: {effort}`, sent only when the catalog names a level. Every current OpenAI
2347
+ * model defaults to "medium" when the field is omitted — verified 2026-09-22 by calling
2348
+ * astra/sol/terra/luna with no reasoning param and reading the effort the API echoes back,
2349
+ * since OpenAI documents the default for Sol, Luna and the 5.6 family but not for Astra.
2350
+ * The catalog pins all four to medium so the level is explicit in our request rather than
2351
+ * inherited from a default OpenAI can change under us.
2352
+ */
2353
+ reasoningParams() {
2354
+ return this.reasoningEffort ? { reasoning: { effort: toOpenAIEffort(this.reasoningEffort) } } : {};
2355
+ }
2336
2356
  /**
2337
2357
  * Structured output method using Zod with OpenAI's Responses API
2338
2358
  * This provides better schema handling and runtime validation
@@ -2353,6 +2373,7 @@ ${instruction}`);
2353
2373
  input,
2354
2374
  max_output_tokens: this.maxOutputTokens,
2355
2375
  prompt_cache_key: this.promptCacheKey,
2376
+ ...this.reasoningParams(),
2356
2377
  text: {
2357
2378
  format: zodTextFormat(schemaToSend, "response_schema")
2358
2379
  }
@@ -2437,7 +2458,8 @@ ${instruction}`);
2437
2458
  instructions: this.instruction,
2438
2459
  input,
2439
2460
  max_output_tokens: this.maxOutputTokens,
2440
- prompt_cache_key: this.promptCacheKey
2461
+ prompt_cache_key: this.promptCacheKey,
2462
+ ...this.reasoningParams()
2441
2463
  });
2442
2464
  const content = response.output_text;
2443
2465
  if (!content) {
@@ -4550,12 +4572,21 @@ var QwenAgent = class extends AbstractAgent {
4550
4572
  * generation); without it the model thinks at the provider default, and qwen3.8-max's
4551
4573
  * latency then swings 30–100s.
4552
4574
  *
4553
- * `reasoning_effort` is deliberately NOT sent. Probed live 2026-08-30 on qwen3.8-flash and
4554
- * qwen3.8-max: every value low..max is accepted, but reasoning length doesn't track it
4555
- * (max: low → 1,686 reasoning tokens / 44s, high → 226 / 7s, xhigh → 1,102 / 30s), while
4556
- * thinking_budget bounds it reliably (≤340 at 1024). The docs also call the two mutually
4557
- * exclusive on qwen3.8-max. So on Qwen the budget IS the effort knob; `reasoningEffort`
4558
- * on this agent is ignored.
4575
+ * `reasoning_effort` is NOT sent, and the earlier reason recorded here was wrong. The
4576
+ * 2026-08-30 probe concluded "reasoning length doesn't track effort"; it had tested
4577
+ * low/high/max/xhigh, but Qwen only defines low|medium|xhigh and aliases both `high` and
4578
+ * `max` onto `xhigh`. So that probe compared low against xhigh twice and read the noise as
4579
+ * non-monotonicity.
4580
+ *
4581
+ * Re-probed 2026-09-22 with the documented levels, and effort tracks cleanly:
4582
+ * qwen3.8-max budget 1024 → 77 reasoning | low 132 | medium 160 | xhigh 422
4583
+ * qwen3.8-flash budget 1024 → 86 reasoning | low 87 | medium 251 | xhigh 417
4584
+ *
4585
+ * We still send the budget, for a better reason: the two are mutually exclusive (sending
4586
+ * both is a 400), Qwen documents effort as a coarse alias for a budget (low = 4,096,
4587
+ * medium = 16,384, xhigh = 262,144 tokens), and our 1,024 is tighter than the lowest level
4588
+ * it can express. The budget is the finer AND cheaper knob here, so `reasoningEffort` on
4589
+ * this agent stays ignored — deliberately, not because effort is broken.
4559
4590
  */
4560
4591
  thinkingParams() {
4561
4592
  const budget = this.thinkingBudgetTokens;