@hiper2d/ai-agents 0.19.2 → 0.20.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
@@ -860,13 +860,19 @@ var SupportedAiModels = {
860
860
  reasoningEffort: "high",
861
861
  tags: ["expensive"]
862
862
  },
863
+ // Haiku moved 4.5 → 5.5 on 2026-10-08 (`claude-haiku-5-5`, verified live with the platform
864
+ // key). 10x cheaper ($0.10/$0.50 up to 100K-token prompts), 1M context / 128K output.
865
+ // Adaptive thinking now (the `enabled` + budget_tokens mode 4.5 used is rejected), API
866
+ // default effort `medium`; we pin `high` like the other Claude entries. It reads Haiku 4.5
867
+ // thinking blocks, so games moving onto it keep the bots' earlier reasoning. 'slow' tag
868
+ // dropped: Anthropic lists it as the fastest model in the lineup.
863
869
  [LLM_CONSTANTS.CLAUDE_HAIKU]: {
864
- displayName: "Claude 4.5 Haiku",
865
- modelApiName: "claude-haiku-4-5",
870
+ displayName: "Claude 5.5 Haiku",
871
+ modelApiName: "claude-haiku-5-5",
866
872
  apiKeyName: API_KEY_CONSTANTS.ANTHROPIC,
867
873
  hasThinking: true,
868
- thinkingBudgetTokens: 1024,
869
- tags: ["slow", "cheap"]
874
+ reasoningEffort: "high",
875
+ tags: ["cheap"]
870
876
  },
871
877
  // DeepSeek V4 models — thinking-only entries (non-thinking variants retired 2026-08-05).
872
878
  // reasoningEffort pinned to 'low' 2026-08-30: at the provider default ('high', no budget
@@ -1384,9 +1390,16 @@ var MODEL_PRICING = {
1384
1390
  cacheHitPrice: 0.2
1385
1391
  },
1386
1392
  [SupportedAiModels[LLM_CONSTANTS.CLAUDE_HAIKU].modelApiName]: {
1387
- inputPrice: 1,
1388
- outputPrice: 5,
1389
- cacheHitPrice: 0.1
1393
+ // Haiku 5.5 (2026-10-07): the first Claude with a long-context tier — every rate is 5x
1394
+ // for prompts over 100K tokens (cache reads + writes count toward the prompt size,
1395
+ // which is what AnthropicAgent passes as inputTokens).
1396
+ inputPrice: 0.1,
1397
+ outputPrice: 0.5,
1398
+ cacheHitPrice: 0.01,
1399
+ extendedContextInputPrice: 0.5,
1400
+ extendedContextOutputPrice: 2.5,
1401
+ extendedContextCacheHitPrice: 0.05,
1402
+ extendedContextThresholdTokens: 1e5
1390
1403
  },
1391
1404
  // Google models
1392
1405
  [SupportedAiModels[LLM_CONSTANTS.GEMINI_PRO].modelApiName]: {
@@ -2236,7 +2249,7 @@ var AbstractAgent = class {
2236
2249
  * Reasoning-depth knobs, resolved once from the catalog like maxOutputTokens and, like it,
2237
2250
  * overridable per instance for calls whose profile differs from a turn (story generation
2238
2251
  * runs deeper). Each provider speaks one dialect — effort (DeepSeek, GLM, Gemini, Claude
2239
- * adaptive) or a token budget (Qwen, Claude Haiku) — and reads only the field it
2252
+ * adaptive) or a token budget (Qwen, Claude Haiku 4.5) — and reads only the field it
2240
2253
  * understands; the other is ignored. Subclasses read these when building a request.
2241
2254
  */
2242
2255
  reasoningEffort;
@@ -2636,6 +2649,7 @@ ${instruction}`);
2636
2649
  import { Anthropic } from "@anthropic-ai/sdk";
2637
2650
  var rejectsDisabledThinking = (model) => model.includes("fable") || model.includes("opus-5-5");
2638
2651
  var usesBetweenToolsForOff = (model) => model.includes("sonnet-5-5");
2652
+ var usesAdaptiveThinking = (model) => !model.includes("haiku-4");
2639
2653
  var ClaudeAgent = class extends AbstractAgent {
2640
2654
  client;
2641
2655
  /**
@@ -2657,7 +2671,8 @@ var ClaudeAgent = class extends AbstractAgent {
2657
2671
  // state writes (a lynch, the night resolution, the summary rewrite, the new
2658
2672
  // day), so every call inside one of those windows reads it.
2659
2673
  // GM prompts have no marker → single block, same behavior as before. Haiku 4.5 needs a
2660
- // 4096-token cacheable prefix, so tiers below that silently no-op on Haiku — expected.
2674
+ // 4096-token cacheable prefix, so tiers below that silently no-op there; Haiku 5.5 caches
2675
+ // from ~1024 tokens (measured 2026-10-08: a 1,083-token prefix was written, 492 was not).
2661
2676
  // A getter, not a field: `maxOutputTokens` can be raised after construction, and a field
2662
2677
  // initializer would snapshot the default and silently ignore the override.
2663
2678
  get defaultParams() {
@@ -2842,16 +2857,16 @@ ${schemaDescription}`;
2842
2857
  ...this.defaultParams,
2843
2858
  messages: anthropicMessages
2844
2859
  };
2845
- const usesAdaptiveThinking = this.model.includes("fable") || this.model.includes("opus") || this.model.includes("sonnet");
2860
+ const adaptive = usesAdaptiveThinking(this.model);
2846
2861
  if (canUseThinking) {
2847
- if (usesAdaptiveThinking) {
2862
+ if (adaptive) {
2848
2863
  params.thinking = { type: "adaptive", display: "summarized" };
2849
2864
  params.output_config = { effort: toAnthropicEffort(this.reasoningEffort ?? "high") };
2850
2865
  } else {
2851
2866
  params.thinking = { type: "enabled", budget_tokens: this.thinkingBudgetTokens ?? 1024 };
2852
2867
  params.temperature = 1;
2853
2868
  }
2854
- } else if (usesAdaptiveThinking) {
2869
+ } else if (adaptive) {
2855
2870
  if (usesBetweenToolsForOff(this.model)) {
2856
2871
  params.thinking = { type: "between_tools" };
2857
2872
  } else if (!rejectsDisabledThinking(this.model)) {
@@ -2940,16 +2955,16 @@ ${schemaDescription}`;
2940
2955
  ...this.defaultParams,
2941
2956
  messages: anthropicMessages
2942
2957
  };
2943
- const usesAdaptiveThinking = this.model.includes("fable") || this.model.includes("opus") || this.model.includes("sonnet");
2958
+ const adaptive = usesAdaptiveThinking(this.model);
2944
2959
  if (canUseThinking) {
2945
- if (usesAdaptiveThinking) {
2960
+ if (adaptive) {
2946
2961
  params.thinking = { type: "adaptive", display: "summarized" };
2947
2962
  params.output_config = { effort: toAnthropicEffort(this.reasoningEffort ?? "high") };
2948
2963
  } else {
2949
2964
  params.thinking = { type: "enabled", budget_tokens: this.thinkingBudgetTokens ?? 1024 };
2950
2965
  params.temperature = 1;
2951
2966
  }
2952
- } else if (usesAdaptiveThinking) {
2967
+ } else if (adaptive) {
2953
2968
  if (usesBetweenToolsForOff(this.model)) {
2954
2969
  params.thinking = { type: "between_tools" };
2955
2970
  } else if (!rejectsDisabledThinking(this.model)) {