@hiper2d/ai-agents 0.34.1 → 0.36.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.mjs CHANGED
@@ -807,6 +807,15 @@ var API_KEY_CONSTANTS = {
807
807
  MINIMAX: "MINIMAX_API_KEY",
808
808
  META: "META_API_KEY"
809
809
  };
810
+ var SCHEMA_ENFORCING_API_KEYS = /* @__PURE__ */ new Set([
811
+ API_KEY_CONSTANTS.OPENAI,
812
+ API_KEY_CONSTANTS.ANTHROPIC,
813
+ API_KEY_CONSTANTS.GOOGLE,
814
+ API_KEY_CONSTANTS.MISTRAL,
815
+ API_KEY_CONSTANTS.QWEN,
816
+ API_KEY_CONSTANTS.MOONSHOT,
817
+ API_KEY_CONSTANTS.META
818
+ ]);
810
819
  var SupportedAiKeyNames = {
811
820
  [API_KEY_CONSTANTS.OPENAI]: "OpenAI",
812
821
  [API_KEY_CONSTANTS.ANTHROPIC]: "Anthropic",
@@ -1046,14 +1055,27 @@ var SupportedAiModels = {
1046
1055
  tags: ["expensive"]
1047
1056
  },
1048
1057
  [LLM_CONSTANTS.GEMINI_FLASH]: {
1049
- // Repointed 3.6 → 3.7 (2026-08-13) → 3.8 (2026-09-02); stable picker id, same pattern as gpt.
1050
- // 3.7 rejected thinkingLevel 'minimal' (low|medium|high only), unlike 3.5/3.6 — 3.8 untested
1051
- // on 'minimal', so keep the pin at 'medium' or above.
1052
- displayName: "Gemini 3.8 Flash",
1053
- modelApiName: "gemini-3.8-flash",
1058
+ // Repointed 3.6 → 3.7 (2026-08-13) → 3.8 (2026-09-02) → Gemini 4 Hydrogen (2026-11-12);
1059
+ // stable picker id, same pattern as gpt — the slot keeps the name `gemini-flash` although
1060
+ // Google dropped "Flash" from the model's name. Id verified against GET /v1beta/models
1061
+ // (1M in / 65K out). Accepts low|medium|high, rejects 'minimal' (400, probed — as did
1062
+ // 3.7 and 3.8 Flash).
1063
+ // Pinned 'low' (3.8 Flash ran 'medium'): Hydrogen is twice the price and thinks about
1064
+ // twice as much per level. Werewolf day-2 vote fixture, 3 runs a level, 2026-11-12:
1065
+ // Hydrogen low 3.4-3.9s 211-263 thinking tokens 0.58-0.60¢
1066
+ // Hydrogen medium 5.4-6.7s 528-761 0.81-0.98¢
1067
+ // Hydrogen high 6.4-7.8s 839-1175 1.03-1.29¢
1068
+ // 3.8 Flash medium 5.1-7.1s 203-315 0.29-0.34¢
1069
+ // 3.8 Flash low 2.1-2.3s 0 0.21¢
1070
+ // So 'low' is the level that thinks as much as the model it replaces did, a little
1071
+ // faster, at twice the cost instead of three times; every run named the same vote target
1072
+ // with a reason as specific. No `temperature` (see the Pro note). No speed tag until it
1073
+ // has 100+ production turns (3.8 Flash had none: p50 9.9s).
1074
+ displayName: "Gemini 4 Hydrogen",
1075
+ modelApiName: "gemini-4-hydrogen",
1054
1076
  apiKeyName: API_KEY_CONSTANTS.GOOGLE,
1055
1077
  hasThinking: true,
1056
- reasoningEffort: "medium"
1078
+ reasoningEffort: "low"
1057
1079
  },
1058
1080
  [LLM_CONSTANTS.GEMINI_LITE]: {
1059
1081
  displayName: "Gemini 3.5 Flash Lite",
@@ -1561,13 +1583,12 @@ var MODEL_PRICING = {
1561
1583
  extendedContextThresholdTokens: 2e5
1562
1584
  },
1563
1585
  [SupportedAiModels[LLM_CONSTANTS.GEMINI_FLASH].modelApiName]: {
1564
- // 3.8 Flash (2026-09-02) launched at the same rates as 3.7. 3.7's launch pricing was
1565
- // scheduled to double to $1.50/$7.50/$0.15 on 2027-01-01 (ai.google.dev pricing page,
1566
- // fetched 2026-08-13) — ACTION NEEDED then: re-check whether 3.8 follows and update.
1567
- // Cache storage cost ($0.50 / 1M tokens per hour) is not tracked here — the
1568
- // schema only models per-token call costs, not time-based storage.
1569
- inputPrice: 0.75,
1570
- outputPrice: 3.75,
1586
+ // Gemini 4 Hydrogen (ai.google.dev pricing page, Standard tier, read 2026-11-12): one
1587
+ // flat tier, twice the input and output rates of the 3.8 Flash it replaced
1588
+ // ($0.75 / $3.75) with the same $0.075 cached rate (5% of input, as on Argon). Implicit
1589
+ // caching only — explicit caching is not supported, so there is no storage cost.
1590
+ inputPrice: 1.5,
1591
+ outputPrice: 7.5,
1571
1592
  cacheHitPrice: 0.075
1572
1593
  },
1573
1594
  [SupportedAiModels[LLM_CONSTANTS.GEMINI_LITE].modelApiName]: {
@@ -1730,6 +1751,10 @@ function getProviderSignatureFields(aiType, signature) {
1730
1751
  }
1731
1752
  return {};
1732
1753
  }
1754
+ function enforcesSchema(modelId) {
1755
+ const config = SupportedAiModels[modelId];
1756
+ return !!config && SCHEMA_ENFORCING_API_KEYS.has(config.apiKeyName);
1757
+ }
1733
1758
 
1734
1759
  // src/reasoning-effort.ts
1735
1760
  var REASONING_EFFORT_SCALE = ["minimal", "low", "medium", "high", "xhigh", "max"];
@@ -5700,6 +5725,7 @@ export {
5700
5725
  OpenAiVoiceAgent,
5701
5726
  QwenAgent,
5702
5727
  REASONING_EFFORT_SCALE,
5728
+ SCHEMA_ENFORCING_API_KEYS,
5703
5729
  SUPPORTED_VOICE_PROVIDERS,
5704
5730
  SupportedAiKeyNames,
5705
5731
  SupportedAiModels,
@@ -5729,6 +5755,7 @@ export {
5729
5755
  createCatalog,
5730
5756
  createVoiceAgent,
5731
5757
  describeEmptyTtsResponse,
5758
+ enforcesSchema,
5732
5759
  evaluateBudget,
5733
5760
  extractAnthropicTokenUsage,
5734
5761
  extractTokenUsageFromResponse6 as extractAnthropicTokenUsageFromResponse,