@omnicross/contracts 0.1.7 → 0.1.9
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/canonical-models.cjs +4 -3
- package/dist/canonical-models.d.cts +2 -3
- package/dist/canonical-models.d.ts +2 -3
- package/dist/canonical-models.js +4 -3
- package/dist/index.cjs +77 -6
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +75 -6
- package/dist/provider-presets/index.cjs +59 -0
- package/dist/provider-presets/index.js +59 -0
- package/dist/thinking-config.cjs +218 -3
- package/dist/thinking-config.d.cts +32 -10
- package/dist/thinking-config.d.ts +32 -10
- package/dist/thinking-config.js +214 -3
- package/dist/usage-stats-types.d.cts +6 -0
- package/dist/usage-stats-types.d.ts +6 -0
- package/package.json +1 -1
package/dist/thinking-config.js
CHANGED
|
@@ -1,3 +1,205 @@
|
|
|
1
|
+
// src/canonical-models.ts
|
|
2
|
+
var OPENAI_MODELS = {
|
|
3
|
+
"gpt-5.6-sol": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
|
|
4
|
+
"gpt-5.6-terra": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
|
|
5
|
+
"gpt-5.6-luna": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
|
|
6
|
+
"gpt-5.5": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
|
|
7
|
+
"gpt-5.4": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
|
|
8
|
+
"gpt-5.4-mini": { category: "reasoning", contextLength: 4e5, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
|
|
9
|
+
"gpt-5.3-codex": { category: "code", contextLength: 4e5, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
|
|
10
|
+
"gpt-5.2": { category: "reasoning", contextLength: 105e4, maxTokens: 65536, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "minimal", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 65536 } },
|
|
11
|
+
"gpt-5": { category: "reasoning", contextLength: 105e4, maxTokens: 65536, reasoning: true, vision: true, functionCall: true },
|
|
12
|
+
"gpt-4.1": { category: "chat", contextLength: 105e4, maxTokens: 32768, vision: true, functionCall: true },
|
|
13
|
+
"gpt-4o": { category: "chat", contextLength: 128e3, maxTokens: 16384, vision: true, functionCall: true },
|
|
14
|
+
"gpt-4o-mini": { category: "chat", contextLength: 128e3, maxTokens: 16384, functionCall: true },
|
|
15
|
+
"o3": { category: "reasoning", contextLength: 2e5, maxTokens: 1e5, reasoning: true, thinkingLevels: ["low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 65536 } },
|
|
16
|
+
"o4-mini": { category: "reasoning", contextLength: 2e5, maxTokens: 1e5, reasoning: true, thinkingLevels: ["low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } }
|
|
17
|
+
};
|
|
18
|
+
var ANTHROPIC_MODELS = {
|
|
19
|
+
"claude-fable-5": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
|
|
20
|
+
"claude-opus-5": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
|
|
21
|
+
"claude-opus-4-8": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
|
|
22
|
+
"claude-sonnet-5": { category: "chat", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
|
|
23
|
+
"claude-opus-4-7": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
|
|
24
|
+
"claude-opus-4-7[1m]": { category: "reasoning", contextLength: 1e6, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
|
|
25
|
+
"claude-opus-4-6": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 1024, max: 128e3 } },
|
|
26
|
+
"claude-opus-4-6[1m]": { category: "reasoning", contextLength: 1e6, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 1024, max: 128e3 } },
|
|
27
|
+
"claude-sonnet-4-6": { category: "chat", contextLength: 2e5, maxTokens: 64e3, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 1024, max: 64e3 } },
|
|
28
|
+
"claude-sonnet-4-6[1m]": { category: "chat", contextLength: 1e6, maxTokens: 64e3, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 1024, max: 64e3 } },
|
|
29
|
+
"claude-haiku-4-5": { category: "chat", contextLength: 2e5, maxTokens: 64e3, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 1024, max: 64e3 } }
|
|
30
|
+
};
|
|
31
|
+
var GEMINI_MODELS = {
|
|
32
|
+
"gemini-3.5-flash": { category: "chat", contextLength: 1e6, maxTokens: 65536, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 24576 } },
|
|
33
|
+
"gemini-3-flash": { category: "chat", contextLength: 1e6, maxTokens: 65536, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 24576 } },
|
|
34
|
+
"gemini-3.1-pro": { category: "chat", contextLength: 1e6, maxTokens: 65536, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["low", "medium", "high"], thinkingTokenLimit: { min: 128, max: 32768 } }
|
|
35
|
+
};
|
|
36
|
+
var GROK_MODELS = {
|
|
37
|
+
"grok-4.5": { category: "chat", contextLength: 5e5, maxTokens: 32768, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
|
|
38
|
+
"grok-4.3": { category: "chat", contextLength: 1e6, maxTokens: 32768, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
|
|
39
|
+
"grok-4.20": { category: "chat", contextLength: 131072, maxTokens: 32768, vision: true, functionCall: true },
|
|
40
|
+
"grok-4.20-reasoning": { category: "reasoning", contextLength: 131072, maxTokens: 32768, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
|
|
41
|
+
"grok-4.20-multi-agent": { category: "reasoning", contextLength: 131072, maxTokens: 32768, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } }
|
|
42
|
+
};
|
|
43
|
+
var DEEPSEEK_MODELS = {
|
|
44
|
+
"deepseek-v4-flash": { category: "chat", contextLength: 1e6, maxTokens: 384e3, functionCall: true, reasoning: true, thinkingLevels: ["none", "high", "max"], thinkingTokenLimit: { min: 0, max: 32768 } },
|
|
45
|
+
"deepseek-v4-pro": { category: "reasoning", contextLength: 1e6, maxTokens: 384e3, functionCall: true, reasoning: true, thinkingLevels: ["none", "high", "max"], thinkingTokenLimit: { min: 0, max: 32768 } },
|
|
46
|
+
"deepseek-v3": { category: "chat", contextLength: 65536, maxTokens: 8192, functionCall: true },
|
|
47
|
+
"deepseek-v3.2": { category: "code", contextLength: 256e3, maxTokens: 32768, functionCall: true, reasoning: true },
|
|
48
|
+
"deepseek-r1": { category: "reasoning", contextLength: 64e3, maxTokens: 8192, reasoning: true, thinkingTokenLimit: { min: 0, max: 32768 } }
|
|
49
|
+
};
|
|
50
|
+
var ZHIPU_MODELS = {
|
|
51
|
+
"glm-5.2": { category: "chat", contextLength: 1048576, maxTokens: 131072, functionCall: true },
|
|
52
|
+
"glm-5": { category: "chat", contextLength: 2e5, maxTokens: 128e3, functionCall: true },
|
|
53
|
+
"glm-5.1": { category: "chat", contextLength: 2e5, maxTokens: 128e3, functionCall: true },
|
|
54
|
+
"glm-4.5-air": { category: "chat", contextLength: 128e3, maxTokens: 32768, functionCall: true },
|
|
55
|
+
"glm-4.6v": { category: "chat", contextLength: 128e3, maxTokens: 32768, vision: true, functionCall: true },
|
|
56
|
+
"glm-4.7": { category: "code", contextLength: 2e5, maxTokens: 128e3, functionCall: true }
|
|
57
|
+
};
|
|
58
|
+
var KIMI_MODELS = {
|
|
59
|
+
"kimi-k3": { category: "code", contextLength: 1048576, maxTokens: 1048576, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
|
|
60
|
+
"kimi-k2.6": { category: "code", contextLength: 256e3, maxTokens: 32768, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
|
|
61
|
+
"kimi-k2.5": { category: "chat", contextLength: 256e3, maxTokens: 65535, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
|
|
62
|
+
"kimi-k2-thinking": { category: "reasoning", contextLength: 256e3, reasoning: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } }
|
|
63
|
+
};
|
|
64
|
+
var DASHSCOPE_QWEN_MODELS = {
|
|
65
|
+
"qwen3-max": { category: "chat", contextLength: 262144, maxTokens: 65536, functionCall: true, webSearch: true },
|
|
66
|
+
"qwen3.5-plus": { category: "chat", contextLength: 1e6, vision: true, functionCall: true, webSearch: true },
|
|
67
|
+
"qwen-turbo": { category: "chat", contextLength: 1e6, vision: true, webSearch: true },
|
|
68
|
+
"qwen3-coder-plus": { category: "code", contextLength: 1e6, functionCall: true },
|
|
69
|
+
"qwen-3-coder-480b": { category: "code", contextLength: 131072, maxTokens: 8192, functionCall: true },
|
|
70
|
+
"qwen-3-32b": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
|
|
71
|
+
"qwen2.5-coder-32b-instruct": { category: "code", contextLength: 32768, maxTokens: 8192, functionCall: true },
|
|
72
|
+
"qwen2.5-coder-7b-instruct": { category: "code", contextLength: 32768, maxTokens: 8192, functionCall: true }
|
|
73
|
+
};
|
|
74
|
+
var VOLCENGINE_DOUBAO_MODELS = {
|
|
75
|
+
"ark-code-latest": { category: "code", contextLength: 256e3, maxTokens: 32768, functionCall: true },
|
|
76
|
+
"doubao-seed-2.0-code": { category: "code", contextLength: 256e3, maxTokens: 128e3, vision: true, functionCall: true },
|
|
77
|
+
"doubao-seed-2.0-lite": { category: "chat", contextLength: 256e3, maxTokens: 32768, functionCall: true }
|
|
78
|
+
};
|
|
79
|
+
var TENCENT_HUNYUAN_MODELS = {
|
|
80
|
+
"tc-code-latest": { category: "code", functionCall: true },
|
|
81
|
+
"hunyuan-2.0-instruct": { category: "chat", functionCall: true },
|
|
82
|
+
"hunyuan-turbos": { category: "chat", functionCall: true }
|
|
83
|
+
};
|
|
84
|
+
var MINIMAX_MODELS = {
|
|
85
|
+
"minimax-m2.5": { category: "code", contextLength: 204800, functionCall: true },
|
|
86
|
+
"minimax-m2.5-highspeed": { category: "code", contextLength: 204800, functionCall: true },
|
|
87
|
+
"minimax-m2.1": { category: "code", contextLength: 204800, functionCall: true },
|
|
88
|
+
"minimax-m2.1-highspeed": { category: "code", contextLength: 204800, functionCall: true }
|
|
89
|
+
};
|
|
90
|
+
var XIAOMI_MIMO_CANONICAL = {
|
|
91
|
+
"mimo-v2.5": { category: "code", contextLength: 1e6, maxTokens: 32768, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
|
|
92
|
+
// mimo-v2.5-pro does not support vision (text + reasoning only).
|
|
93
|
+
"mimo-v2.5-pro": { category: "code", contextLength: 1e6, maxTokens: 32768, vision: false, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
|
|
94
|
+
"mimo-v2-pro": { category: "code", contextLength: 1e6, maxTokens: 32768, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
|
|
95
|
+
"mimo-v2-flash": { category: "code", contextLength: 256e3, maxTokens: 32768, vision: true, functionCall: true },
|
|
96
|
+
"mimo-v2-omni": { category: "chat", contextLength: 256e3, maxTokens: 32768, vision: true, functionCall: true }
|
|
97
|
+
};
|
|
98
|
+
var META_LLAMA_MODELS = {
|
|
99
|
+
"llama-3.3-70b": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
|
|
100
|
+
"llama-3.3-70b-versatile": { category: "chat", contextLength: 131072, maxTokens: 32768, functionCall: true },
|
|
101
|
+
"llama-3.3-70b-instruct": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
|
|
102
|
+
"llama-3.3-70b-instruct-turbo": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
|
|
103
|
+
"llama-3.1-8b-instant": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true }
|
|
104
|
+
};
|
|
105
|
+
var MISTRAL_MODELS = {
|
|
106
|
+
"mistral-large-latest": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
|
|
107
|
+
"codestral-latest": { category: "code", contextLength: 256e3, maxTokens: 8192, functionCall: true },
|
|
108
|
+
"mistral-medium-latest": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
|
|
109
|
+
"mixtral-8x7b-32768": { category: "chat", contextLength: 32768, maxTokens: 32768, functionCall: true }
|
|
110
|
+
};
|
|
111
|
+
var PERPLEXITY_MODELS = {
|
|
112
|
+
"sonar": { category: "chat", contextLength: 127072, maxTokens: 8192, webSearch: true },
|
|
113
|
+
"sonar-pro": { category: "chat", contextLength: 2e5, maxTokens: 8192, webSearch: true },
|
|
114
|
+
"sonar-reasoning-pro": { category: "reasoning", contextLength: 127072, maxTokens: 8192, reasoning: true, webSearch: true }
|
|
115
|
+
};
|
|
116
|
+
var BAIDU_ERNIE_MODELS = {
|
|
117
|
+
"qianfan-code-latest": { category: "code", contextLength: 98304, maxTokens: 65536, functionCall: true },
|
|
118
|
+
"ernie-4.5": { category: "chat", functionCall: true },
|
|
119
|
+
"ernie-3.5": { category: "chat" }
|
|
120
|
+
};
|
|
121
|
+
var KUAISHOU_KAT_MODELS = {
|
|
122
|
+
"kat-coder-pro-v1": { category: "code", contextLength: 256e3, maxTokens: 128e3, functionCall: true },
|
|
123
|
+
"kat-coder-air-v1": { category: "code", contextLength: 128e3, maxTokens: 32768, functionCall: true }
|
|
124
|
+
};
|
|
125
|
+
var VENDOR_GROUPS = [
|
|
126
|
+
{ name: "OPENAI_MODELS", entries: OPENAI_MODELS },
|
|
127
|
+
{ name: "ANTHROPIC_MODELS", entries: ANTHROPIC_MODELS },
|
|
128
|
+
{ name: "GEMINI_MODELS", entries: GEMINI_MODELS },
|
|
129
|
+
{ name: "GROK_MODELS", entries: GROK_MODELS },
|
|
130
|
+
{ name: "DEEPSEEK_MODELS", entries: DEEPSEEK_MODELS },
|
|
131
|
+
{ name: "ZHIPU_MODELS", entries: ZHIPU_MODELS },
|
|
132
|
+
{ name: "KIMI_MODELS", entries: KIMI_MODELS },
|
|
133
|
+
{ name: "DASHSCOPE_QWEN_MODELS", entries: DASHSCOPE_QWEN_MODELS },
|
|
134
|
+
{ name: "VOLCENGINE_DOUBAO_MODELS", entries: VOLCENGINE_DOUBAO_MODELS },
|
|
135
|
+
{ name: "TENCENT_HUNYUAN_MODELS", entries: TENCENT_HUNYUAN_MODELS },
|
|
136
|
+
{ name: "MINIMAX_MODELS", entries: MINIMAX_MODELS },
|
|
137
|
+
{ name: "XIAOMI_MIMO_CANONICAL", entries: XIAOMI_MIMO_CANONICAL },
|
|
138
|
+
{ name: "META_LLAMA_MODELS", entries: META_LLAMA_MODELS },
|
|
139
|
+
{ name: "MISTRAL_MODELS", entries: MISTRAL_MODELS },
|
|
140
|
+
{ name: "PERPLEXITY_MODELS", entries: PERPLEXITY_MODELS },
|
|
141
|
+
{ name: "BAIDU_ERNIE_MODELS", entries: BAIDU_ERNIE_MODELS },
|
|
142
|
+
{ name: "KUAISHOU_KAT_MODELS", entries: KUAISHOU_KAT_MODELS }
|
|
143
|
+
];
|
|
144
|
+
function assertNoDuplicateCanonicalIds() {
|
|
145
|
+
const seen = /* @__PURE__ */ new Map();
|
|
146
|
+
for (const { name, entries } of VENDOR_GROUPS) {
|
|
147
|
+
for (const id of Object.keys(entries)) {
|
|
148
|
+
const prior = seen.get(id);
|
|
149
|
+
if (prior) {
|
|
150
|
+
throw new Error(
|
|
151
|
+
`[canonical-models] duplicate id '${id}' registered in both '${prior}' and '${name}'. Each model must live in exactly one vendor group.`
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
seen.set(id, name);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
assertNoDuplicateCanonicalIds();
|
|
159
|
+
var KNOWN_MODELS = Object.freeze(
|
|
160
|
+
Object.assign(
|
|
161
|
+
/* @__PURE__ */ Object.create(null),
|
|
162
|
+
...VENDOR_GROUPS.map((g) => g.entries)
|
|
163
|
+
)
|
|
164
|
+
);
|
|
165
|
+
function normalizeModelId(rawId) {
|
|
166
|
+
if (!rawId) return "";
|
|
167
|
+
const slashIdx = rawId.lastIndexOf("/");
|
|
168
|
+
const base = slashIdx >= 0 ? rawId.slice(slashIdx + 1) : rawId;
|
|
169
|
+
const colonIdx = base.indexOf(":");
|
|
170
|
+
const noSuffix = colonIdx >= 0 ? base.slice(0, colonIdx) : base;
|
|
171
|
+
return noSuffix.toLowerCase();
|
|
172
|
+
}
|
|
173
|
+
var MODEL_ALIASES = {
|
|
174
|
+
"gpt-5.6": "gpt-5.6-sol",
|
|
175
|
+
"deepseek-chat": "deepseek-v3",
|
|
176
|
+
"deepseek-reasoner": "deepseek-r1"
|
|
177
|
+
};
|
|
178
|
+
function applyAlias(normalizedId) {
|
|
179
|
+
return MODEL_ALIASES[normalizedId] ?? normalizedId;
|
|
180
|
+
}
|
|
181
|
+
function assertAliasesPointToKnownModels() {
|
|
182
|
+
for (const [from, to] of Object.entries(MODEL_ALIASES)) {
|
|
183
|
+
if (!(to in KNOWN_MODELS)) {
|
|
184
|
+
throw new Error(
|
|
185
|
+
`[canonical-models] alias '${from}' \u2192 '${to}' points at unknown id. Either add '${to}' to a vendor group or fix the alias.`
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
assertAliasesPointToKnownModels();
|
|
191
|
+
function lookupCanonicalCapabilities(rawId, extendedContext = false) {
|
|
192
|
+
const normalized = normalizeModelId(rawId);
|
|
193
|
+
if (!normalized) return void 0;
|
|
194
|
+
const canonicalId = applyAlias(normalized);
|
|
195
|
+
if (extendedContext) {
|
|
196
|
+
const extendedKey = `${canonicalId}[1m]`;
|
|
197
|
+
const extended = KNOWN_MODELS[extendedKey];
|
|
198
|
+
if (extended) return extended;
|
|
199
|
+
}
|
|
200
|
+
return KNOWN_MODELS[canonicalId];
|
|
201
|
+
}
|
|
202
|
+
|
|
1
203
|
// src/thinking-config.ts
|
|
2
204
|
var EFFORT_RATIO = {
|
|
3
205
|
none: 0.01,
|
|
@@ -9,7 +211,7 @@ var EFFORT_RATIO = {
|
|
|
9
211
|
max: 0.95
|
|
10
212
|
};
|
|
11
213
|
var DEFAULT_MAX_TOKENS = 4096;
|
|
12
|
-
var
|
|
214
|
+
var LEGACY_THINKING_TOKEN_LIMITS = {
|
|
13
215
|
// Gemini
|
|
14
216
|
"gemini-2\\.5-flash-lite": { min: 512, max: 24576 },
|
|
15
217
|
"gemini-.*-flash": { min: 0, max: 24576 },
|
|
@@ -65,6 +267,7 @@ var THINKING_TOKEN_MAP = {
|
|
|
65
267
|
// Doubao
|
|
66
268
|
"doubao.*think": { min: 0, max: 16384 }
|
|
67
269
|
};
|
|
270
|
+
var THINKING_TOKEN_MAP = LEGACY_THINKING_TOKEN_LIMITS;
|
|
68
271
|
var REASONING_MODEL_PATTERNS = [
|
|
69
272
|
/^o[134](-mini|-preview|-pro)?$/i,
|
|
70
273
|
/^gpt-5(\.\d)?(-pro|-codex|-codex-max)?/i,
|
|
@@ -97,8 +300,14 @@ function findTokenLimit(modelOrId) {
|
|
|
97
300
|
if (modelOrId.thinkingTokenLimit) return modelOrId.thinkingTokenLimit;
|
|
98
301
|
return findTokenLimit(modelOrId.id);
|
|
99
302
|
}
|
|
100
|
-
const
|
|
101
|
-
|
|
303
|
+
const canonicalLimit = lookupCanonicalCapabilities(modelOrId)?.thinkingTokenLimit;
|
|
304
|
+
if (canonicalLimit) return canonicalLimit;
|
|
305
|
+
return findLegacyTokenLimit(modelOrId);
|
|
306
|
+
}
|
|
307
|
+
function findLegacyTokenLimit(modelId) {
|
|
308
|
+
if (!modelId) return null;
|
|
309
|
+
const lowerModelId = modelId.toLowerCase();
|
|
310
|
+
for (const [pattern, limit] of Object.entries(LEGACY_THINKING_TOKEN_LIMITS)) {
|
|
102
311
|
const regex = new RegExp(pattern, "i");
|
|
103
312
|
if (regex.test(lowerModelId)) {
|
|
104
313
|
return limit;
|
|
@@ -191,6 +400,7 @@ export {
|
|
|
191
400
|
CANNOT_DISABLE_THINKING_PATTERNS,
|
|
192
401
|
DEFAULT_MAX_TOKENS,
|
|
193
402
|
EFFORT_RATIO,
|
|
403
|
+
LEGACY_THINKING_TOKEN_LIMITS,
|
|
194
404
|
REASONING_MODEL_PATTERNS,
|
|
195
405
|
THINKING_TOKEN_MAP,
|
|
196
406
|
buildAnthropicThinking,
|
|
@@ -198,6 +408,7 @@ export {
|
|
|
198
408
|
buildQwenThinkingConfig,
|
|
199
409
|
calculateThinkingBudget,
|
|
200
410
|
canDisableThinking,
|
|
411
|
+
findLegacyTokenLimit,
|
|
201
412
|
findTokenLimit,
|
|
202
413
|
getClaudeMaxTokens,
|
|
203
414
|
getOpenAIReasoningEffort,
|
|
@@ -46,6 +46,12 @@ interface UsageEventRecord {
|
|
|
46
46
|
rawUsage: string | null;
|
|
47
47
|
/** Host run-correlation id (owning agent-run, when the host has one). Additive / nullable. */
|
|
48
48
|
runId?: string | null;
|
|
49
|
+
/** Token-free process-local Route Lease id; never the route bearer token. */
|
|
50
|
+
routeLeaseId?: string | null;
|
|
51
|
+
/** Bounded logical Route Lease consumer. */
|
|
52
|
+
routeLeaseConsumer?: string | null;
|
|
53
|
+
/** Bounded Route Lease stage attribution. */
|
|
54
|
+
routeLeaseStageId?: string | null;
|
|
49
55
|
/** Host event-correlation id for this LLM call. NULL when unknown. Additive / nullable. */
|
|
50
56
|
eventId?: string | null;
|
|
51
57
|
/** Safe prompt-cache-key provenance; absent on historical/non-attributed rows. */
|
|
@@ -46,6 +46,12 @@ interface UsageEventRecord {
|
|
|
46
46
|
rawUsage: string | null;
|
|
47
47
|
/** Host run-correlation id (owning agent-run, when the host has one). Additive / nullable. */
|
|
48
48
|
runId?: string | null;
|
|
49
|
+
/** Token-free process-local Route Lease id; never the route bearer token. */
|
|
50
|
+
routeLeaseId?: string | null;
|
|
51
|
+
/** Bounded logical Route Lease consumer. */
|
|
52
|
+
routeLeaseConsumer?: string | null;
|
|
53
|
+
/** Bounded Route Lease stage attribution. */
|
|
54
|
+
routeLeaseStageId?: string | null;
|
|
49
55
|
/** Host event-correlation id for this LLM call. NULL when unknown. Additive / nullable. */
|
|
50
56
|
eventId?: string | null;
|
|
51
57
|
/** Safe prompt-cache-key provenance; absent on historical/non-attributed rows. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnicross/contracts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Dependency-light, host-agnostic contract types + runtime-value helpers shared by the @omnicross/* packages.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sayo (https://github.com/Dumoedss)",
|