@hiper2d/ai-agents 0.19.2 → 0.21.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 +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +44 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -806,7 +806,6 @@ var LLM_CONSTANTS = {
|
|
|
806
806
|
GEMINI_PRO: "gemini-pro",
|
|
807
807
|
GEMINI_FLASH: "gemini-flash",
|
|
808
808
|
GEMINI_LITE: "gemini-lite",
|
|
809
|
-
MISTRAL_MEDIUM: "mistral-medium",
|
|
810
809
|
MISTRAL_SMALL: "mistral-small",
|
|
811
810
|
GROK: "grok",
|
|
812
811
|
KIMI: "kimi",
|
|
@@ -860,13 +859,19 @@ var SupportedAiModels = {
|
|
|
860
859
|
reasoningEffort: "high",
|
|
861
860
|
tags: ["expensive"]
|
|
862
861
|
},
|
|
862
|
+
// Haiku moved 4.5 → 5.5 on 2026-10-08 (`claude-haiku-5-5`, verified live with the platform
|
|
863
|
+
// key). 10x cheaper ($0.10/$0.50 up to 100K-token prompts), 1M context / 128K output.
|
|
864
|
+
// Adaptive thinking now (the `enabled` + budget_tokens mode 4.5 used is rejected), API
|
|
865
|
+
// default effort `medium`; we pin `high` like the other Claude entries. It reads Haiku 4.5
|
|
866
|
+
// thinking blocks, so games moving onto it keep the bots' earlier reasoning. 'slow' tag
|
|
867
|
+
// dropped: Anthropic lists it as the fastest model in the lineup.
|
|
863
868
|
[LLM_CONSTANTS.CLAUDE_HAIKU]: {
|
|
864
|
-
displayName: "Claude
|
|
865
|
-
modelApiName: "claude-haiku-
|
|
869
|
+
displayName: "Claude 5.5 Haiku",
|
|
870
|
+
modelApiName: "claude-haiku-5-5",
|
|
866
871
|
apiKeyName: API_KEY_CONSTANTS.ANTHROPIC,
|
|
867
872
|
hasThinking: true,
|
|
868
|
-
|
|
869
|
-
tags: ["
|
|
873
|
+
reasoningEffort: "high",
|
|
874
|
+
tags: ["cheap"]
|
|
870
875
|
},
|
|
871
876
|
// DeepSeek V4 models — thinking-only entries (non-thinking variants retired 2026-08-05).
|
|
872
877
|
// reasoningEffort pinned to 'low' 2026-08-30: at the provider default ('high', no budget
|
|
@@ -1006,14 +1011,18 @@ var SupportedAiModels = {
|
|
|
1006
1011
|
reasoningEffort: "medium",
|
|
1007
1012
|
temperature: 0.7
|
|
1008
1013
|
},
|
|
1009
|
-
// Mistral models.
|
|
1010
|
-
//
|
|
1011
|
-
//
|
|
1012
|
-
//
|
|
1013
|
-
//
|
|
1014
|
-
//
|
|
1015
|
-
//
|
|
1016
|
-
//
|
|
1014
|
+
// Mistral models. One hybrid entry: reasoning is off by default on the API and switched on
|
|
1015
|
+
// per request with `reasoning_effort` (see mistral-agent.ts); the trace comes back as a
|
|
1016
|
+
// `thinking` content chunk and works with json_schema structured output (verified live
|
|
1017
|
+
// 2026-09-18). Pinned to 'high' — the only level Mistral's docs describe ("full thinking
|
|
1018
|
+
// chunk before the final answer"); Small is cheap enough that the extra tokens don't
|
|
1019
|
+
// matter. Live 2026-09-18 (one short schema ask): 1.7s with a ~600-char trace.
|
|
1020
|
+
//
|
|
1021
|
+
// Mistral Medium 3.5 (`mistral-medium-3-5`, $1.5/$7.5, $0.15 cached) was removed in 0.21.0
|
|
1022
|
+
// (2026-10-10): too slow and too expensive at the only reasoning level it takes (high|none).
|
|
1023
|
+
// Production 2026-10-03..10: p50 15.9s, p90 35.1s, $0.036 a request (2x Gemini 3.1 Pro,
|
|
1024
|
+
// 19x Small; reasoning spiked to 15-24k tokens), ~6% of calls failed (60s timeouts, empty
|
|
1025
|
+
// replies, empty JSON), and a 15-player story pipeline took 277s. Wait for Medium 4.
|
|
1017
1026
|
//
|
|
1018
1027
|
// Mistral Large 3 and Magistral Medium 1.2 were dropped 2026-09-18. Large 3 was retired by
|
|
1019
1028
|
// Mistral on 2026-08-31 (the `-latest` alias still answered, but its capabilities say
|
|
@@ -1021,7 +1030,7 @@ var SupportedAiModels = {
|
|
|
1021
1030
|
// and `magistral-medium-latest` is now literally an alias of Medium 3.5 — the model list
|
|
1022
1031
|
// returns `mistral-medium-3-5`, `mistral-medium-3`, `mistral-medium-latest` and
|
|
1023
1032
|
// `magistral-medium-latest` as one entry — so Magistral seats had silently become Medium
|
|
1024
|
-
// seats already. Consumers map both retired ids onto
|
|
1033
|
+
// seats already. Consumers map both retired ids onto Small (Medium itself is gone since 0.21.0).
|
|
1025
1034
|
//
|
|
1026
1035
|
// Mistral Large 4 (`mistral-large-4`, $0.68/$2.09, $0.07 cached) was added in 0.19.0 and
|
|
1027
1036
|
// removed in 0.19.1 (2026-10-06/07): too slow to play. Like Small/Medium it accepts only
|
|
@@ -1029,16 +1038,6 @@ var SupportedAiModels = {
|
|
|
1029
1038
|
// a realistic day-2 vote took 25-154s (half past the 60s timeout) and its parallel story
|
|
1030
1039
|
// batches finished ~100s apart (Mistral served them one at a time: ~6 min per story). Off,
|
|
1031
1040
|
// it answers in ~1s with no trace. Re-test before re-adding.
|
|
1032
|
-
[LLM_CONSTANTS.MISTRAL_MEDIUM]: {
|
|
1033
|
-
displayName: "Mistral Medium 3.5",
|
|
1034
|
-
// The docs' explicit 3.5 id. It was `mistral-medium-3` until 2026-09-18, which Mistral
|
|
1035
|
-
// now serves as an alias of the same model (Medium 3 itself retired 2026-08-31).
|
|
1036
|
-
modelApiName: "mistral-medium-3-5",
|
|
1037
|
-
apiKeyName: API_KEY_CONSTANTS.MISTRAL,
|
|
1038
|
-
hasThinking: true,
|
|
1039
|
-
reasoningEffort: "high",
|
|
1040
|
-
tags: ["fast", "expensive"]
|
|
1041
|
-
},
|
|
1042
1041
|
[LLM_CONSTANTS.MISTRAL_SMALL]: {
|
|
1043
1042
|
displayName: "Mistral 4 Small",
|
|
1044
1043
|
// Resolves to mistral-small-2603 (Small 4), which also carries the magistral-small alias.
|
|
@@ -1384,9 +1383,16 @@ var MODEL_PRICING = {
|
|
|
1384
1383
|
cacheHitPrice: 0.2
|
|
1385
1384
|
},
|
|
1386
1385
|
[SupportedAiModels[LLM_CONSTANTS.CLAUDE_HAIKU].modelApiName]: {
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1386
|
+
// Haiku 5.5 (2026-10-07): the first Claude with a long-context tier — every rate is 5x
|
|
1387
|
+
// for prompts over 100K tokens (cache reads + writes count toward the prompt size,
|
|
1388
|
+
// which is what AnthropicAgent passes as inputTokens).
|
|
1389
|
+
inputPrice: 0.1,
|
|
1390
|
+
outputPrice: 0.5,
|
|
1391
|
+
cacheHitPrice: 0.01,
|
|
1392
|
+
extendedContextInputPrice: 0.5,
|
|
1393
|
+
extendedContextOutputPrice: 2.5,
|
|
1394
|
+
extendedContextCacheHitPrice: 0.05,
|
|
1395
|
+
extendedContextThresholdTokens: 1e5
|
|
1390
1396
|
},
|
|
1391
1397
|
// Google models
|
|
1392
1398
|
[SupportedAiModels[LLM_CONSTANTS.GEMINI_PRO].modelApiName]: {
|
|
@@ -1419,11 +1425,6 @@ var MODEL_PRICING = {
|
|
|
1419
1425
|
// the input price (documented on the prompt_cache_key param; no per-model cached prices
|
|
1420
1426
|
// published). Reasoning tokens are counted inside completion_tokens — no separate
|
|
1421
1427
|
// reasoning_tokens field — so the output rate already covers the trace.
|
|
1422
|
-
[SupportedAiModels[LLM_CONSTANTS.MISTRAL_MEDIUM].modelApiName]: {
|
|
1423
|
-
inputPrice: 1.5,
|
|
1424
|
-
outputPrice: 7.5,
|
|
1425
|
-
cacheHitPrice: 0.15
|
|
1426
|
-
},
|
|
1427
1428
|
[SupportedAiModels[LLM_CONSTANTS.MISTRAL_SMALL].modelApiName]: {
|
|
1428
1429
|
inputPrice: 0.15,
|
|
1429
1430
|
outputPrice: 0.6,
|
|
@@ -1504,8 +1505,7 @@ var HYBRID_THINKING_API_NAMES = /* @__PURE__ */ new Set([
|
|
|
1504
1505
|
SupportedAiModels[LLM_CONSTANTS.QWEN_FLASH].modelApiName,
|
|
1505
1506
|
SupportedAiModels[LLM_CONSTANTS.MINIMAX].modelApiName,
|
|
1506
1507
|
// Mistral reasons only when asked (`reasoning_effort`), and we always ask — hybrid by the
|
|
1507
|
-
// same definition as Qwen. Added 2026-09-18 when the
|
|
1508
|
-
SupportedAiModels[LLM_CONSTANTS.MISTRAL_MEDIUM].modelApiName,
|
|
1508
|
+
// same definition as Qwen. Added 2026-09-18 when the Mistral entries went thinking-on.
|
|
1509
1509
|
SupportedAiModels[LLM_CONSTANTS.MISTRAL_SMALL].modelApiName
|
|
1510
1510
|
]);
|
|
1511
1511
|
function isHybridThinkingModel(modelApiName) {
|
|
@@ -2236,7 +2236,7 @@ var AbstractAgent = class {
|
|
|
2236
2236
|
* Reasoning-depth knobs, resolved once from the catalog like maxOutputTokens and, like it,
|
|
2237
2237
|
* overridable per instance for calls whose profile differs from a turn (story generation
|
|
2238
2238
|
* 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
|
|
2239
|
+
* adaptive) or a token budget (Qwen, Claude Haiku 4.5) — and reads only the field it
|
|
2240
2240
|
* understands; the other is ignored. Subclasses read these when building a request.
|
|
2241
2241
|
*/
|
|
2242
2242
|
reasoningEffort;
|
|
@@ -2636,6 +2636,7 @@ ${instruction}`);
|
|
|
2636
2636
|
import { Anthropic } from "@anthropic-ai/sdk";
|
|
2637
2637
|
var rejectsDisabledThinking = (model) => model.includes("fable") || model.includes("opus-5-5");
|
|
2638
2638
|
var usesBetweenToolsForOff = (model) => model.includes("sonnet-5-5");
|
|
2639
|
+
var usesAdaptiveThinking = (model) => !model.includes("haiku-4");
|
|
2639
2640
|
var ClaudeAgent = class extends AbstractAgent {
|
|
2640
2641
|
client;
|
|
2641
2642
|
/**
|
|
@@ -2657,7 +2658,8 @@ var ClaudeAgent = class extends AbstractAgent {
|
|
|
2657
2658
|
// state writes (a lynch, the night resolution, the summary rewrite, the new
|
|
2658
2659
|
// day), so every call inside one of those windows reads it.
|
|
2659
2660
|
// 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
|
|
2661
|
+
// 4096-token cacheable prefix, so tiers below that silently no-op there; Haiku 5.5 caches
|
|
2662
|
+
// from ~1024 tokens (measured 2026-10-08: a 1,083-token prefix was written, 492 was not).
|
|
2661
2663
|
// A getter, not a field: `maxOutputTokens` can be raised after construction, and a field
|
|
2662
2664
|
// initializer would snapshot the default and silently ignore the override.
|
|
2663
2665
|
get defaultParams() {
|
|
@@ -2842,16 +2844,16 @@ ${schemaDescription}`;
|
|
|
2842
2844
|
...this.defaultParams,
|
|
2843
2845
|
messages: anthropicMessages
|
|
2844
2846
|
};
|
|
2845
|
-
const
|
|
2847
|
+
const adaptive = usesAdaptiveThinking(this.model);
|
|
2846
2848
|
if (canUseThinking) {
|
|
2847
|
-
if (
|
|
2849
|
+
if (adaptive) {
|
|
2848
2850
|
params.thinking = { type: "adaptive", display: "summarized" };
|
|
2849
2851
|
params.output_config = { effort: toAnthropicEffort(this.reasoningEffort ?? "high") };
|
|
2850
2852
|
} else {
|
|
2851
2853
|
params.thinking = { type: "enabled", budget_tokens: this.thinkingBudgetTokens ?? 1024 };
|
|
2852
2854
|
params.temperature = 1;
|
|
2853
2855
|
}
|
|
2854
|
-
} else if (
|
|
2856
|
+
} else if (adaptive) {
|
|
2855
2857
|
if (usesBetweenToolsForOff(this.model)) {
|
|
2856
2858
|
params.thinking = { type: "between_tools" };
|
|
2857
2859
|
} else if (!rejectsDisabledThinking(this.model)) {
|
|
@@ -2940,16 +2942,16 @@ ${schemaDescription}`;
|
|
|
2940
2942
|
...this.defaultParams,
|
|
2941
2943
|
messages: anthropicMessages
|
|
2942
2944
|
};
|
|
2943
|
-
const
|
|
2945
|
+
const adaptive = usesAdaptiveThinking(this.model);
|
|
2944
2946
|
if (canUseThinking) {
|
|
2945
|
-
if (
|
|
2947
|
+
if (adaptive) {
|
|
2946
2948
|
params.thinking = { type: "adaptive", display: "summarized" };
|
|
2947
2949
|
params.output_config = { effort: toAnthropicEffort(this.reasoningEffort ?? "high") };
|
|
2948
2950
|
} else {
|
|
2949
2951
|
params.thinking = { type: "enabled", budget_tokens: this.thinkingBudgetTokens ?? 1024 };
|
|
2950
2952
|
params.temperature = 1;
|
|
2951
2953
|
}
|
|
2952
|
-
} else if (
|
|
2954
|
+
} else if (adaptive) {
|
|
2953
2955
|
if (usesBetweenToolsForOff(this.model)) {
|
|
2954
2956
|
params.thinking = { type: "between_tools" };
|
|
2955
2957
|
} else if (!rejectsDisabledThinking(this.model)) {
|
|
@@ -5335,7 +5337,6 @@ var AgentFactory = class {
|
|
|
5335
5337
|
case LLM_CONSTANTS.DEEPSEEK_PRO:
|
|
5336
5338
|
return new DeepSeekV2Agent(name, instruction, model.modelApiName, key, model.temperature ?? 0, shouldEnableThinking);
|
|
5337
5339
|
// Mistral models
|
|
5338
|
-
case LLM_CONSTANTS.MISTRAL_MEDIUM:
|
|
5339
5340
|
case LLM_CONSTANTS.MISTRAL_SMALL:
|
|
5340
5341
|
return new MistralAgent(name, instruction, model.modelApiName, key, shouldEnableThinking);
|
|
5341
5342
|
case LLM_CONSTANTS.KIMI:
|