@hiper2d/ai-agents 0.30.0 → 0.31.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
@@ -845,6 +845,8 @@ var LLM_CONSTANTS = {
845
845
  GEMINI_FLASH: "gemini-flash",
846
846
  GEMINI_LITE: "gemini-lite",
847
847
  MISTRAL_SMALL: "mistral-small",
848
+ // Version-free id (Large 3 used it until 2026-09-18; Large 4 took it over 2026-10-06).
849
+ MISTRAL_LARGE: "mistral-large",
848
850
  GROK: "grok",
849
851
  KIMI: "kimi",
850
852
  // Kimi K3.1 Pro Highspeed: the same model served 2-3x faster at 2x the price (added
@@ -1084,7 +1086,7 @@ var SupportedAiModels = {
1084
1086
  // at medium effort; the 15-character story pipeline took 213s on 2026-10-07.
1085
1087
  tags: ["very-slow"]
1086
1088
  },
1087
- // Mistral models. One hybrid entry: reasoning is off by default on the API and switched on
1089
+ // Mistral models. Two hybrid entries: reasoning is off by default on the API and switched on
1088
1090
  // per request with `reasoning_effort` (see mistral-agent.ts); the trace comes back as a
1089
1091
  // `thinking` content chunk and works with json_schema structured output (verified live
1090
1092
  // 2026-09-18). Pinned to 'high' — the only level Mistral's docs describe ("full thinking
@@ -1105,12 +1107,27 @@ var SupportedAiModels = {
1105
1107
  // `magistral-medium-latest` as one entry — so Magistral seats had silently become Medium
1106
1108
  // seats already. Consumers map both retired ids onto Small (Medium itself is gone since 0.21.0).
1107
1109
  //
1108
- // Mistral Large 4 (`mistral-large-4`, $0.68/$2.09, $0.07 cached) was added in 0.19.0 and
1109
- // removed in 0.19.1 (2026-10-06/07): too slow to play. Like Small/Medium it accepts only
1110
- // reasoning_effort high|none, and unlike them it reasons when the field is omitted. At high
1111
- // a realistic day-2 vote took 25-154s (half past the 60s timeout) and its parallel story
1112
- // batches finished ~100s apart (Mistral served them one at a time: ~6 min per story). Off,
1113
- // it answers in ~1s with no trace. Re-test before re-adding.
1110
+ // Mistral Large 4 (`mistral-large-4`, released 2026-10-06 in public preview) was added in
1111
+ // 0.19.0 and removed in 0.19.1 the next day: at launch a realistic day-2 vote took 25-154s
1112
+ // (half past the 60s timeout) and the story batches finished ~100s apart. Re-tested
1113
+ // 2026-10-30 on the same requests and RE-ADDED in 0.31.0: 19 day-2 votes ran 6-25s (median
1114
+ // ~14s, no timeouts, 760-3,100 output tokens, $0.002-0.011 each) and the 15-character story
1115
+ // pipeline 114-118s — the launch-week slowness was serving load, since `high` is fast now
1116
+ // too. Two things still hold: Mistral serves our parallel sheet batches one at a time
1117
+ // (~22-25s each, finishing 22/50/77/99s), so story time scales with the lobby; and the
1118
+ // model reasons when the field is omitted. The API now takes low|medium|high on Large 4
1119
+ // (the 400 for `none` lists exactly those; Small still takes only high|none); the level
1120
+ // barely moved latency or trace size (4-12k chars at every level), so it stays on the
1121
+ // documented 'high' default. Model list: 1M context. Tagged `slow`: the 15-25s band.
1122
+ [LLM_CONSTANTS.MISTRAL_LARGE]: {
1123
+ displayName: "Mistral Large 4",
1124
+ // `mistral-large-latest` still points at Large 3 (no reasoning); use the explicit id.
1125
+ modelApiName: "mistral-large-4",
1126
+ apiKeyName: API_KEY_CONSTANTS.MISTRAL,
1127
+ hasThinking: true,
1128
+ reasoningEffort: "high",
1129
+ tags: ["slow"]
1130
+ },
1114
1131
  [LLM_CONSTANTS.MISTRAL_SMALL]: {
1115
1132
  displayName: "Mistral 4 Small",
1116
1133
  // Resolves to mistral-small-2603 (Small 4), which also carries the magistral-small alias.
@@ -1568,6 +1585,13 @@ var MODEL_PRICING = {
1568
1585
  outputPrice: 0.6,
1569
1586
  cacheHitPrice: 0.015
1570
1587
  },
1588
+ // Large 4: docs.mistral.ai/models/mistral-large-4-0, read 2026-10-30 ($0.70 / $0.07 cached /
1589
+ // $2.10). The $0.68/$2.09 recorded in 0.19.0 was the two-week launch discount.
1590
+ [SupportedAiModels[LLM_CONSTANTS.MISTRAL_LARGE].modelApiName]: {
1591
+ inputPrice: 0.7,
1592
+ outputPrice: 2.1,
1593
+ cacheHitPrice: 0.07
1594
+ },
1571
1595
  // Grok models. Cached price is per-model on xAI (not a uniform ratio):
1572
1596
  // grok-4.7 is $0.50/M cached vs $2.00/M input, and all rates double for prompts
1573
1597
  // >= 200K tokens, per docs.x.ai/docs/models (re-verified 2026-09-22 for 4.7).
@@ -1647,7 +1671,8 @@ var HYBRID_THINKING_API_NAMES = /* @__PURE__ */ new Set([
1647
1671
  // MiniMax left the set 2026-10-27: M3.1 Flash cannot turn thinking off (M3 could).
1648
1672
  // Mistral reasons only when asked (`reasoning_effort`), and we always ask — hybrid by the
1649
1673
  // same definition as Qwen. Added 2026-09-18 when the Mistral entries went thinking-on.
1650
- SupportedAiModels[LLM_CONSTANTS.MISTRAL_SMALL].modelApiName
1674
+ SupportedAiModels[LLM_CONSTANTS.MISTRAL_SMALL].modelApiName,
1675
+ SupportedAiModels[LLM_CONSTANTS.MISTRAL_LARGE].modelApiName
1651
1676
  ]);
1652
1677
  function isHybridThinkingModel(modelApiName) {
1653
1678
  return HYBRID_THINKING_API_NAMES.has(modelApiName);
@@ -3950,9 +3975,8 @@ ${updatedMessages[0].content}`
3950
3975
  * New method using Zod with DeepSeek API
3951
3976
  * This provides better schema handling and runtime validation
3952
3977
  *
3953
- * DeepSeek V4 uses thinking toggle via extra_body. JSON mode (response_format
3954
- * json_object) is supported with or without thinking, so we always request it.
3955
- * Thinking additionally surfaces reasoning via reasoning_content.
3978
+ * DeepSeek V4 uses thinking toggle via extra_body; reasoning comes back in
3979
+ * reasoning_content. No JSON mode (response_format json_object), see below.
3956
3980
  */
3957
3981
  async doAskWithZodSchema(zodSchema, messages) {
3958
3982
  try {
@@ -3978,9 +4002,6 @@ ${schemaDescription}`
3978
4002
  };
3979
4003
  requestParams.messages = this.addSystemInstruction(modifiedInput);
3980
4004
  }
3981
- requestParams.response_format = {
3982
- type: "json_object"
3983
- };
3984
4005
  Object.assign(requestParams, this.thinkingParams());
3985
4006
  let response;
3986
4007
  try {
@@ -5571,6 +5592,7 @@ var AgentFactory = class {
5571
5592
  case LLM_CONSTANTS.DEEPSEEK_PRO:
5572
5593
  return new DeepSeekV2Agent(name, instruction, model.modelApiName, key, model.temperature ?? 0, shouldEnableThinking);
5573
5594
  // Mistral models
5595
+ case LLM_CONSTANTS.MISTRAL_LARGE:
5574
5596
  case LLM_CONSTANTS.MISTRAL_SMALL:
5575
5597
  return new MistralAgent(name, instruction, model.modelApiName, key, shouldEnableThinking);
5576
5598
  case LLM_CONSTANTS.KIMI: