@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.d.mts CHANGED
@@ -1298,7 +1298,7 @@ declare abstract class AbstractAgent {
1298
1298
  * Reasoning-depth knobs, resolved once from the catalog like maxOutputTokens and, like it,
1299
1299
  * overridable per instance for calls whose profile differs from a turn (story generation
1300
1300
  * runs deeper). Each provider speaks one dialect — effort (DeepSeek, GLM, Gemini, Claude
1301
- * adaptive) or a token budget (Qwen, Claude Haiku) — and reads only the field it
1301
+ * adaptive) or a token budget (Qwen, Claude Haiku 4.5) — and reads only the field it
1302
1302
  * understands; the other is ignored. Subclasses read these when building a request.
1303
1303
  */
1304
1304
  reasoningEffort?: ReasoningEffort;
package/dist/index.d.ts CHANGED
@@ -1298,7 +1298,7 @@ declare abstract class AbstractAgent {
1298
1298
  * Reasoning-depth knobs, resolved once from the catalog like maxOutputTokens and, like it,
1299
1299
  * overridable per instance for calls whose profile differs from a turn (story generation
1300
1300
  * runs deeper). Each provider speaks one dialect — effort (DeepSeek, GLM, Gemini, Claude
1301
- * adaptive) or a token budget (Qwen, Claude Haiku) — and reads only the field it
1301
+ * adaptive) or a token budget (Qwen, Claude Haiku 4.5) — and reads only the field it
1302
1302
  * understands; the other is ignored. Subclasses read these when building a request.
1303
1303
  */
1304
1304
  reasoningEffort?: ReasoningEffort;
package/dist/index.js CHANGED
@@ -1038,13 +1038,19 @@ var SupportedAiModels = {
1038
1038
  reasoningEffort: "high",
1039
1039
  tags: ["expensive"]
1040
1040
  },
1041
+ // Haiku moved 4.5 → 5.5 on 2026-10-08 (`claude-haiku-5-5`, verified live with the platform
1042
+ // key). 10x cheaper ($0.10/$0.50 up to 100K-token prompts), 1M context / 128K output.
1043
+ // Adaptive thinking now (the `enabled` + budget_tokens mode 4.5 used is rejected), API
1044
+ // default effort `medium`; we pin `high` like the other Claude entries. It reads Haiku 4.5
1045
+ // thinking blocks, so games moving onto it keep the bots' earlier reasoning. 'slow' tag
1046
+ // dropped: Anthropic lists it as the fastest model in the lineup.
1041
1047
  [LLM_CONSTANTS.CLAUDE_HAIKU]: {
1042
- displayName: "Claude 4.5 Haiku",
1043
- modelApiName: "claude-haiku-4-5",
1048
+ displayName: "Claude 5.5 Haiku",
1049
+ modelApiName: "claude-haiku-5-5",
1044
1050
  apiKeyName: API_KEY_CONSTANTS.ANTHROPIC,
1045
1051
  hasThinking: true,
1046
- thinkingBudgetTokens: 1024,
1047
- tags: ["slow", "cheap"]
1052
+ reasoningEffort: "high",
1053
+ tags: ["cheap"]
1048
1054
  },
1049
1055
  // DeepSeek V4 models — thinking-only entries (non-thinking variants retired 2026-08-05).
1050
1056
  // reasoningEffort pinned to 'low' 2026-08-30: at the provider default ('high', no budget
@@ -1562,9 +1568,16 @@ var MODEL_PRICING = {
1562
1568
  cacheHitPrice: 0.2
1563
1569
  },
1564
1570
  [SupportedAiModels[LLM_CONSTANTS.CLAUDE_HAIKU].modelApiName]: {
1565
- inputPrice: 1,
1566
- outputPrice: 5,
1567
- cacheHitPrice: 0.1
1571
+ // Haiku 5.5 (2026-10-07): the first Claude with a long-context tier — every rate is 5x
1572
+ // for prompts over 100K tokens (cache reads + writes count toward the prompt size,
1573
+ // which is what AnthropicAgent passes as inputTokens).
1574
+ inputPrice: 0.1,
1575
+ outputPrice: 0.5,
1576
+ cacheHitPrice: 0.01,
1577
+ extendedContextInputPrice: 0.5,
1578
+ extendedContextOutputPrice: 2.5,
1579
+ extendedContextCacheHitPrice: 0.05,
1580
+ extendedContextThresholdTokens: 1e5
1568
1581
  },
1569
1582
  // Google models
1570
1583
  [SupportedAiModels[LLM_CONSTANTS.GEMINI_PRO].modelApiName]: {
@@ -2414,7 +2427,7 @@ var AbstractAgent = class {
2414
2427
  * Reasoning-depth knobs, resolved once from the catalog like maxOutputTokens and, like it,
2415
2428
  * overridable per instance for calls whose profile differs from a turn (story generation
2416
2429
  * runs deeper). Each provider speaks one dialect — effort (DeepSeek, GLM, Gemini, Claude
2417
- * adaptive) or a token budget (Qwen, Claude Haiku) — and reads only the field it
2430
+ * adaptive) or a token budget (Qwen, Claude Haiku 4.5) — and reads only the field it
2418
2431
  * understands; the other is ignored. Subclasses read these when building a request.
2419
2432
  */
2420
2433
  reasoningEffort;
@@ -2814,6 +2827,7 @@ ${instruction}`);
2814
2827
  var import_sdk = require("@anthropic-ai/sdk");
2815
2828
  var rejectsDisabledThinking = (model) => model.includes("fable") || model.includes("opus-5-5");
2816
2829
  var usesBetweenToolsForOff = (model) => model.includes("sonnet-5-5");
2830
+ var usesAdaptiveThinking = (model) => !model.includes("haiku-4");
2817
2831
  var ClaudeAgent = class extends AbstractAgent {
2818
2832
  client;
2819
2833
  /**
@@ -2835,7 +2849,8 @@ var ClaudeAgent = class extends AbstractAgent {
2835
2849
  // state writes (a lynch, the night resolution, the summary rewrite, the new
2836
2850
  // day), so every call inside one of those windows reads it.
2837
2851
  // GM prompts have no marker → single block, same behavior as before. Haiku 4.5 needs a
2838
- // 4096-token cacheable prefix, so tiers below that silently no-op on Haiku — expected.
2852
+ // 4096-token cacheable prefix, so tiers below that silently no-op there; Haiku 5.5 caches
2853
+ // from ~1024 tokens (measured 2026-10-08: a 1,083-token prefix was written, 492 was not).
2839
2854
  // A getter, not a field: `maxOutputTokens` can be raised after construction, and a field
2840
2855
  // initializer would snapshot the default and silently ignore the override.
2841
2856
  get defaultParams() {
@@ -3020,16 +3035,16 @@ ${schemaDescription}`;
3020
3035
  ...this.defaultParams,
3021
3036
  messages: anthropicMessages
3022
3037
  };
3023
- const usesAdaptiveThinking = this.model.includes("fable") || this.model.includes("opus") || this.model.includes("sonnet");
3038
+ const adaptive = usesAdaptiveThinking(this.model);
3024
3039
  if (canUseThinking) {
3025
- if (usesAdaptiveThinking) {
3040
+ if (adaptive) {
3026
3041
  params.thinking = { type: "adaptive", display: "summarized" };
3027
3042
  params.output_config = { effort: toAnthropicEffort(this.reasoningEffort ?? "high") };
3028
3043
  } else {
3029
3044
  params.thinking = { type: "enabled", budget_tokens: this.thinkingBudgetTokens ?? 1024 };
3030
3045
  params.temperature = 1;
3031
3046
  }
3032
- } else if (usesAdaptiveThinking) {
3047
+ } else if (adaptive) {
3033
3048
  if (usesBetweenToolsForOff(this.model)) {
3034
3049
  params.thinking = { type: "between_tools" };
3035
3050
  } else if (!rejectsDisabledThinking(this.model)) {
@@ -3118,16 +3133,16 @@ ${schemaDescription}`;
3118
3133
  ...this.defaultParams,
3119
3134
  messages: anthropicMessages
3120
3135
  };
3121
- const usesAdaptiveThinking = this.model.includes("fable") || this.model.includes("opus") || this.model.includes("sonnet");
3136
+ const adaptive = usesAdaptiveThinking(this.model);
3122
3137
  if (canUseThinking) {
3123
- if (usesAdaptiveThinking) {
3138
+ if (adaptive) {
3124
3139
  params.thinking = { type: "adaptive", display: "summarized" };
3125
3140
  params.output_config = { effort: toAnthropicEffort(this.reasoningEffort ?? "high") };
3126
3141
  } else {
3127
3142
  params.thinking = { type: "enabled", budget_tokens: this.thinkingBudgetTokens ?? 1024 };
3128
3143
  params.temperature = 1;
3129
3144
  }
3130
- } else if (usesAdaptiveThinking) {
3145
+ } else if (adaptive) {
3131
3146
  if (usesBetweenToolsForOff(this.model)) {
3132
3147
  params.thinking = { type: "between_tools" };
3133
3148
  } else if (!rejectsDisabledThinking(this.model)) {