@omnicross/contracts 0.1.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.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/dist/account-tokens-types.cjs +18 -0
  4. package/dist/account-tokens-types.d.cts +142 -0
  5. package/dist/account-tokens-types.d.ts +142 -0
  6. package/dist/account-tokens-types.js +0 -0
  7. package/dist/canonical-models.cjs +262 -0
  8. package/dist/canonical-models.d.cts +107 -0
  9. package/dist/canonical-models.d.ts +107 -0
  10. package/dist/canonical-models.js +232 -0
  11. package/dist/completion-types.cjs +18 -0
  12. package/dist/completion-types.d.cts +324 -0
  13. package/dist/completion-types.d.ts +324 -0
  14. package/dist/completion-types.js +0 -0
  15. package/dist/endpoint-resolver.cjs +54 -0
  16. package/dist/endpoint-resolver.d.cts +43 -0
  17. package/dist/endpoint-resolver.d.ts +43 -0
  18. package/dist/endpoint-resolver.js +29 -0
  19. package/dist/extended-context.cjs +39 -0
  20. package/dist/extended-context.d.cts +21 -0
  21. package/dist/extended-context.d.ts +21 -0
  22. package/dist/extended-context.js +13 -0
  23. package/dist/index.cjs +2724 -0
  24. package/dist/index.d.cts +14 -0
  25. package/dist/index.d.ts +14 -0
  26. package/dist/index.js +2656 -0
  27. package/dist/llm-config-CQjOimv2.d.cts +390 -0
  28. package/dist/llm-config-D1jKQLVp.d.ts +390 -0
  29. package/dist/llm-config.cjs +18 -0
  30. package/dist/llm-config.d.cts +2 -0
  31. package/dist/llm-config.d.ts +2 -0
  32. package/dist/llm-config.js +0 -0
  33. package/dist/mcp-types.cjs +33 -0
  34. package/dist/mcp-types.d.cts +131 -0
  35. package/dist/mcp-types.d.ts +131 -0
  36. package/dist/mcp-types.js +8 -0
  37. package/dist/message-blocks.cjs +18 -0
  38. package/dist/message-blocks.d.cts +44 -0
  39. package/dist/message-blocks.d.ts +44 -0
  40. package/dist/message-blocks.js +0 -0
  41. package/dist/provider-presets/index.cjs +2183 -0
  42. package/dist/provider-presets/index.d.cts +104 -0
  43. package/dist/provider-presets/index.d.ts +104 -0
  44. package/dist/provider-presets/index.js +2143 -0
  45. package/dist/subscription-types.cjs +48 -0
  46. package/dist/subscription-types.d.cts +149 -0
  47. package/dist/subscription-types.d.ts +149 -0
  48. package/dist/subscription-types.js +22 -0
  49. package/dist/thinking-CBWSLel8.d.cts +33 -0
  50. package/dist/thinking-CBWSLel8.d.ts +33 -0
  51. package/dist/thinking-config.cjs +243 -0
  52. package/dist/thinking-config.d.cts +71 -0
  53. package/dist/thinking-config.d.ts +71 -0
  54. package/dist/thinking-config.js +205 -0
  55. package/dist/usage-types.cjs +18 -0
  56. package/dist/usage-types.d.cts +41 -0
  57. package/dist/usage-types.d.ts +41 -0
  58. package/dist/usage-types.js +0 -0
  59. package/dist/websearch-types.cjs +37 -0
  60. package/dist/websearch-types.d.cts +76 -0
  61. package/dist/websearch-types.d.ts +76 -0
  62. package/dist/websearch-types.js +11 -0
  63. package/package.json +116 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sayo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @omnicross/contracts
2
+
3
+ Dependency-light, host-agnostic contract types + runtime-value helpers shared across the omnicross packages: LLM config, completion types + message blocks, provider presets, thinking config, usage, and subscription/account-token types.
4
+
5
+ Consumed via subpaths to keep the dependency graph tight, e.g. `@omnicross/contracts/llm-config`, `@omnicross/contracts/provider-presets`, `@omnicross/contracts/completion-types`.
6
+
7
+ Part of the [omnicross](https://github.com/Dumoedss/omnicross) monorepo — see the root README for the full overview.
8
+
9
+ ```bash
10
+ npm install @omnicross/contracts
11
+ ```
12
+
13
+ ## License
14
+
15
+ [MIT](LICENSE)
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/account-tokens-types.ts
17
+ var account_tokens_types_exports = {};
18
+ module.exports = __toCommonJS(account_tokens_types_exports);
@@ -0,0 +1,142 @@
1
+ import { OpenCodeGoTokenConfig } from './subscription-types.cjs';
2
+
3
+ /**
4
+ * Account token configuration contracts.
5
+ *
6
+ * Holds the subscription account-token types the `@omnicross/*` packages
7
+ * consume: the four provider token configs (claude / codex / gemini /
8
+ * opencodego) plus their auth/status enums, the nested-account entry and
9
+ * sanitized shapes, and the OAuth exchange request types.
10
+ */
11
+
12
+ /**
13
+ * Authorization method (general)
14
+ */
15
+ type AuthMethod = 'oauth' | 'manual';
16
+ /**
17
+ * Claude specific authorization method (includes setup_token)
18
+ */
19
+ type ClaudeAuthMethod = 'oauth' | 'setup_token' | 'manual';
20
+ /**
21
+ * Subscription level for Claude accounts
22
+ */
23
+ type SubscriptionLevel = 'Free' | 'Pro' | 'Max';
24
+ /**
25
+ * Token configuration status
26
+ */
27
+ type TokenStatus = 'unconfigured' | 'authorized' | 'configured' | 'expired' | 'error';
28
+ /**
29
+ * Claude token configuration
30
+ */
31
+ type ClaudeTokenConfig = {
32
+ authMethod: ClaudeAuthMethod;
33
+ status: TokenStatus;
34
+ subscriptionLevel?: SubscriptionLevel;
35
+ accessToken?: string;
36
+ refreshToken?: string;
37
+ expiresAt?: string;
38
+ scopes?: string[];
39
+ isSetupToken?: boolean;
40
+ setupTokenExpiresAt?: string;
41
+ lastRefreshedAt?: string;
42
+ errorMessage?: string;
43
+ };
44
+ /**
45
+ * Codex (OpenAI) token configuration
46
+ */
47
+ type CodexTokenConfig = {
48
+ authMethod: AuthMethod;
49
+ status: TokenStatus;
50
+ accessToken?: string;
51
+ refreshToken?: string;
52
+ idToken?: string;
53
+ expiresAt?: string;
54
+ accountId?: string;
55
+ email?: string;
56
+ organizationId?: string;
57
+ lastRefreshedAt?: string;
58
+ errorMessage?: string;
59
+ };
60
+ /**
61
+ * Gemini token configuration
62
+ */
63
+ type GeminiTokenConfig = {
64
+ authMethod: AuthMethod;
65
+ status: TokenStatus;
66
+ accessToken?: string;
67
+ refreshToken?: string;
68
+ expiresAt?: string;
69
+ lastRefreshedAt?: string;
70
+ errorMessage?: string;
71
+ };
72
+ /**
73
+ * A single subscription account entry. The provider's existing token config
74
+ * is carried verbatim under a nested `tokens` field; entry metadata
75
+ * (`id`/`label`/`createdAt`) is kept cleanly separate from token material so
76
+ * the daemon secrets walker can recurse into `tokens` unambiguously.
77
+ *
78
+ * See design.md D2 (nested-tokens shape).
79
+ */
80
+ type SubscriptionAccountEntry<TConfig> = {
81
+ /** Stable, generated id (`crypto.randomUUID()`). */
82
+ id: string;
83
+ /** User-supplied label; default "账号 N" / "Account N". */
84
+ label?: string;
85
+ /** ISO creation timestamp. */
86
+ createdAt?: string;
87
+ /** The provider's existing token config, verbatim. */
88
+ tokens: TConfig;
89
+ };
90
+ /**
91
+ * Complete account tokens configuration (internal use).
92
+ *
93
+ * The four top-level provider blocks (`claude`/`codex`/`gemini`/`opencodego`)
94
+ * are ALWAYS a byte-equal MIRROR of the active account's token config (design
95
+ * D1). The `<provider>Accounts` arrays + `active<Provider>AccountId` pointers
96
+ * are NEW siblings the downstream subscription chain never reads.
97
+ */
98
+ type AccountTokensConfig = {
99
+ claude?: ClaudeTokenConfig;
100
+ codex?: CodexTokenConfig;
101
+ gemini?: GeminiTokenConfig;
102
+ opencodego?: OpenCodeGoTokenConfig;
103
+ claudeAccounts?: SubscriptionAccountEntry<ClaudeTokenConfig>[];
104
+ activeClaudeAccountId?: string;
105
+ codexAccounts?: SubscriptionAccountEntry<CodexTokenConfig>[];
106
+ activeCodexAccountId?: string;
107
+ geminiAccounts?: SubscriptionAccountEntry<GeminiTokenConfig>[];
108
+ activeGeminiAccountId?: string;
109
+ opencodegoAccounts?: SubscriptionAccountEntry<OpenCodeGoTokenConfig>[];
110
+ activeOpencodegoAccountId?: string;
111
+ updatedAt: string;
112
+ };
113
+ /**
114
+ * Sanitized view of a single subscription account (frontend display).
115
+ * NEVER carries raw token material (no accessToken/refreshToken/idToken/apiKey).
116
+ */
117
+ type SubscriptionAccountSanitized = {
118
+ id: string;
119
+ label?: string;
120
+ status: TokenStatus;
121
+ expiresAt?: string;
122
+ hasAccessToken: boolean;
123
+ isActive: boolean;
124
+ };
125
+ /**
126
+ * OAuth authorization parameters
127
+ */
128
+ type OAuthParams = {
129
+ authUrl: string;
130
+ codeVerifier: string;
131
+ state: string;
132
+ };
133
+ /**
134
+ * Token exchange request
135
+ */
136
+ type TokenExchangeRequest = {
137
+ authorizationCode: string;
138
+ codeVerifier: string;
139
+ state: string;
140
+ };
141
+
142
+ export type { AccountTokensConfig, AuthMethod, ClaudeAuthMethod, ClaudeTokenConfig, CodexTokenConfig, GeminiTokenConfig, OAuthParams, SubscriptionAccountEntry, SubscriptionAccountSanitized, SubscriptionLevel, TokenExchangeRequest, TokenStatus };
@@ -0,0 +1,142 @@
1
+ import { OpenCodeGoTokenConfig } from './subscription-types.js';
2
+
3
+ /**
4
+ * Account token configuration contracts.
5
+ *
6
+ * Holds the subscription account-token types the `@omnicross/*` packages
7
+ * consume: the four provider token configs (claude / codex / gemini /
8
+ * opencodego) plus their auth/status enums, the nested-account entry and
9
+ * sanitized shapes, and the OAuth exchange request types.
10
+ */
11
+
12
+ /**
13
+ * Authorization method (general)
14
+ */
15
+ type AuthMethod = 'oauth' | 'manual';
16
+ /**
17
+ * Claude specific authorization method (includes setup_token)
18
+ */
19
+ type ClaudeAuthMethod = 'oauth' | 'setup_token' | 'manual';
20
+ /**
21
+ * Subscription level for Claude accounts
22
+ */
23
+ type SubscriptionLevel = 'Free' | 'Pro' | 'Max';
24
+ /**
25
+ * Token configuration status
26
+ */
27
+ type TokenStatus = 'unconfigured' | 'authorized' | 'configured' | 'expired' | 'error';
28
+ /**
29
+ * Claude token configuration
30
+ */
31
+ type ClaudeTokenConfig = {
32
+ authMethod: ClaudeAuthMethod;
33
+ status: TokenStatus;
34
+ subscriptionLevel?: SubscriptionLevel;
35
+ accessToken?: string;
36
+ refreshToken?: string;
37
+ expiresAt?: string;
38
+ scopes?: string[];
39
+ isSetupToken?: boolean;
40
+ setupTokenExpiresAt?: string;
41
+ lastRefreshedAt?: string;
42
+ errorMessage?: string;
43
+ };
44
+ /**
45
+ * Codex (OpenAI) token configuration
46
+ */
47
+ type CodexTokenConfig = {
48
+ authMethod: AuthMethod;
49
+ status: TokenStatus;
50
+ accessToken?: string;
51
+ refreshToken?: string;
52
+ idToken?: string;
53
+ expiresAt?: string;
54
+ accountId?: string;
55
+ email?: string;
56
+ organizationId?: string;
57
+ lastRefreshedAt?: string;
58
+ errorMessage?: string;
59
+ };
60
+ /**
61
+ * Gemini token configuration
62
+ */
63
+ type GeminiTokenConfig = {
64
+ authMethod: AuthMethod;
65
+ status: TokenStatus;
66
+ accessToken?: string;
67
+ refreshToken?: string;
68
+ expiresAt?: string;
69
+ lastRefreshedAt?: string;
70
+ errorMessage?: string;
71
+ };
72
+ /**
73
+ * A single subscription account entry. The provider's existing token config
74
+ * is carried verbatim under a nested `tokens` field; entry metadata
75
+ * (`id`/`label`/`createdAt`) is kept cleanly separate from token material so
76
+ * the daemon secrets walker can recurse into `tokens` unambiguously.
77
+ *
78
+ * See design.md D2 (nested-tokens shape).
79
+ */
80
+ type SubscriptionAccountEntry<TConfig> = {
81
+ /** Stable, generated id (`crypto.randomUUID()`). */
82
+ id: string;
83
+ /** User-supplied label; default "账号 N" / "Account N". */
84
+ label?: string;
85
+ /** ISO creation timestamp. */
86
+ createdAt?: string;
87
+ /** The provider's existing token config, verbatim. */
88
+ tokens: TConfig;
89
+ };
90
+ /**
91
+ * Complete account tokens configuration (internal use).
92
+ *
93
+ * The four top-level provider blocks (`claude`/`codex`/`gemini`/`opencodego`)
94
+ * are ALWAYS a byte-equal MIRROR of the active account's token config (design
95
+ * D1). The `<provider>Accounts` arrays + `active<Provider>AccountId` pointers
96
+ * are NEW siblings the downstream subscription chain never reads.
97
+ */
98
+ type AccountTokensConfig = {
99
+ claude?: ClaudeTokenConfig;
100
+ codex?: CodexTokenConfig;
101
+ gemini?: GeminiTokenConfig;
102
+ opencodego?: OpenCodeGoTokenConfig;
103
+ claudeAccounts?: SubscriptionAccountEntry<ClaudeTokenConfig>[];
104
+ activeClaudeAccountId?: string;
105
+ codexAccounts?: SubscriptionAccountEntry<CodexTokenConfig>[];
106
+ activeCodexAccountId?: string;
107
+ geminiAccounts?: SubscriptionAccountEntry<GeminiTokenConfig>[];
108
+ activeGeminiAccountId?: string;
109
+ opencodegoAccounts?: SubscriptionAccountEntry<OpenCodeGoTokenConfig>[];
110
+ activeOpencodegoAccountId?: string;
111
+ updatedAt: string;
112
+ };
113
+ /**
114
+ * Sanitized view of a single subscription account (frontend display).
115
+ * NEVER carries raw token material (no accessToken/refreshToken/idToken/apiKey).
116
+ */
117
+ type SubscriptionAccountSanitized = {
118
+ id: string;
119
+ label?: string;
120
+ status: TokenStatus;
121
+ expiresAt?: string;
122
+ hasAccessToken: boolean;
123
+ isActive: boolean;
124
+ };
125
+ /**
126
+ * OAuth authorization parameters
127
+ */
128
+ type OAuthParams = {
129
+ authUrl: string;
130
+ codeVerifier: string;
131
+ state: string;
132
+ };
133
+ /**
134
+ * Token exchange request
135
+ */
136
+ type TokenExchangeRequest = {
137
+ authorizationCode: string;
138
+ codeVerifier: string;
139
+ state: string;
140
+ };
141
+
142
+ export type { AccountTokensConfig, AuthMethod, ClaudeAuthMethod, ClaudeTokenConfig, CodexTokenConfig, GeminiTokenConfig, OAuthParams, SubscriptionAccountEntry, SubscriptionAccountSanitized, SubscriptionLevel, TokenExchangeRequest, TokenStatus };
File without changes
@@ -0,0 +1,262 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/canonical-models.ts
21
+ var canonical_models_exports = {};
22
+ __export(canonical_models_exports, {
23
+ KNOWN_MODELS: () => KNOWN_MODELS,
24
+ MODEL_ALIASES: () => MODEL_ALIASES,
25
+ applyAlias: () => applyAlias,
26
+ lookupCanonicalCapabilities: () => lookupCanonicalCapabilities,
27
+ normalizeModelId: () => normalizeModelId,
28
+ resolveModelCapabilities: () => resolveModelCapabilities
29
+ });
30
+ module.exports = __toCommonJS(canonical_models_exports);
31
+ var OPENAI_MODELS = {
32
+ "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 } },
33
+ "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 } },
34
+ "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 } },
35
+ "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 } },
36
+ "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 } },
37
+ "gpt-5": { category: "reasoning", contextLength: 105e4, maxTokens: 65536, reasoning: true, vision: true, functionCall: true },
38
+ "gpt-4.1": { category: "chat", contextLength: 105e4, maxTokens: 32768, vision: true, functionCall: true },
39
+ "gpt-4o": { category: "chat", contextLength: 128e3, maxTokens: 16384, vision: true, functionCall: true },
40
+ "gpt-4o-mini": { category: "chat", contextLength: 128e3, maxTokens: 16384, functionCall: true },
41
+ "o3": { category: "reasoning", contextLength: 2e5, maxTokens: 1e5, reasoning: true, thinkingLevels: ["low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 65536 } },
42
+ "o4-mini": { category: "reasoning", contextLength: 2e5, maxTokens: 1e5, reasoning: true, thinkingLevels: ["low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } }
43
+ };
44
+ var ANTHROPIC_MODELS = {
45
+ "claude-opus-4-7": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
46
+ "claude-opus-4-7[1m]": { category: "reasoning", contextLength: 1e6, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
47
+ "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 } },
48
+ "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 } },
49
+ "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 } },
50
+ "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 } },
51
+ "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 } }
52
+ };
53
+ var GEMINI_MODELS = {
54
+ "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 } },
55
+ "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 } }
56
+ };
57
+ var GROK_MODELS = {
58
+ "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 } },
59
+ "grok-4.20": { category: "chat", contextLength: 131072, maxTokens: 32768, vision: true, functionCall: true },
60
+ "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 } },
61
+ "grok-4.20-multi-agent": { category: "reasoning", contextLength: 131072, maxTokens: 32768, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } }
62
+ };
63
+ var DEEPSEEK_MODELS = {
64
+ "deepseek-v4-flash": { category: "chat", contextLength: 1e6, maxTokens: 384e3, functionCall: true, reasoning: true, thinkingLevels: ["none", "high", "max"], thinkingTokenLimit: { min: 0, max: 32768 } },
65
+ "deepseek-v4-pro": { category: "reasoning", contextLength: 1e6, maxTokens: 384e3, functionCall: true, reasoning: true, thinkingLevels: ["none", "high", "max"], thinkingTokenLimit: { min: 0, max: 32768 } },
66
+ "deepseek-v3": { category: "chat", contextLength: 65536, maxTokens: 8192, functionCall: true },
67
+ "deepseek-v3.2": { category: "code", contextLength: 256e3, maxTokens: 32768, functionCall: true, reasoning: true },
68
+ "deepseek-r1": { category: "reasoning", contextLength: 64e3, maxTokens: 8192, reasoning: true, thinkingTokenLimit: { min: 0, max: 32768 } }
69
+ };
70
+ var ZHIPU_MODELS = {
71
+ "glm-5": { category: "chat", contextLength: 2e5, maxTokens: 128e3, functionCall: true },
72
+ "glm-5.1": { category: "chat", contextLength: 2e5, maxTokens: 128e3, functionCall: true },
73
+ "glm-4.5-air": { category: "chat", contextLength: 128e3, maxTokens: 32768, functionCall: true },
74
+ "glm-4.6v": { category: "chat", contextLength: 128e3, maxTokens: 32768, vision: true, functionCall: true },
75
+ "glm-4.7": { category: "code", contextLength: 2e5, maxTokens: 128e3, functionCall: true }
76
+ };
77
+ var KIMI_MODELS = {
78
+ "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 } },
79
+ "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 } },
80
+ "kimi-k2-thinking": { category: "reasoning", contextLength: 256e3, reasoning: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } }
81
+ };
82
+ var DASHSCOPE_QWEN_MODELS = {
83
+ "qwen3-max": { category: "chat", contextLength: 262144, maxTokens: 65536, functionCall: true, webSearch: true },
84
+ "qwen3.5-plus": { category: "chat", contextLength: 1e6, vision: true, functionCall: true, webSearch: true },
85
+ "qwen-turbo": { category: "chat", contextLength: 1e6, vision: true, webSearch: true },
86
+ "qwen3-coder-plus": { category: "code", contextLength: 1e6, functionCall: true },
87
+ "qwen-3-coder-480b": { category: "code", contextLength: 131072, maxTokens: 8192, functionCall: true },
88
+ "qwen-3-32b": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
89
+ "qwen2.5-coder-32b-instruct": { category: "code", contextLength: 32768, maxTokens: 8192, functionCall: true },
90
+ "qwen2.5-coder-7b-instruct": { category: "code", contextLength: 32768, maxTokens: 8192, functionCall: true }
91
+ };
92
+ var VOLCENGINE_DOUBAO_MODELS = {
93
+ "ark-code-latest": { category: "code", contextLength: 256e3, maxTokens: 32768, functionCall: true },
94
+ "doubao-seed-2.0-code": { category: "code", contextLength: 256e3, maxTokens: 128e3, vision: true, functionCall: true },
95
+ "doubao-seed-2.0-lite": { category: "chat", contextLength: 256e3, maxTokens: 32768, functionCall: true }
96
+ };
97
+ var TENCENT_HUNYUAN_MODELS = {
98
+ "tc-code-latest": { category: "code", functionCall: true },
99
+ "hunyuan-2.0-instruct": { category: "chat", functionCall: true },
100
+ "hunyuan-turbos": { category: "chat", functionCall: true }
101
+ };
102
+ var MINIMAX_MODELS = {
103
+ "minimax-m2.5": { category: "code", contextLength: 204800, functionCall: true },
104
+ "minimax-m2.5-highspeed": { category: "code", contextLength: 204800, functionCall: true },
105
+ "minimax-m2.1": { category: "code", contextLength: 204800, functionCall: true },
106
+ "minimax-m2.1-highspeed": { category: "code", contextLength: 204800, functionCall: true }
107
+ };
108
+ var XIAOMI_MIMO_CANONICAL = {
109
+ "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 } },
110
+ // mimo-v2.5-pro does not support vision (text + reasoning only).
111
+ "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 } },
112
+ "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 } },
113
+ "mimo-v2-flash": { category: "code", contextLength: 256e3, maxTokens: 32768, vision: true, functionCall: true },
114
+ "mimo-v2-omni": { category: "chat", contextLength: 256e3, maxTokens: 32768, vision: true, functionCall: true }
115
+ };
116
+ var META_LLAMA_MODELS = {
117
+ "llama-3.3-70b": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
118
+ "llama-3.3-70b-versatile": { category: "chat", contextLength: 131072, maxTokens: 32768, functionCall: true },
119
+ "llama-3.3-70b-instruct": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
120
+ "llama-3.3-70b-instruct-turbo": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
121
+ "llama-3.1-8b-instant": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true }
122
+ };
123
+ var MISTRAL_MODELS = {
124
+ "mistral-large-latest": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
125
+ "codestral-latest": { category: "code", contextLength: 256e3, maxTokens: 8192, functionCall: true },
126
+ "mistral-medium-latest": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
127
+ "mixtral-8x7b-32768": { category: "chat", contextLength: 32768, maxTokens: 32768, functionCall: true }
128
+ };
129
+ var PERPLEXITY_MODELS = {
130
+ "sonar": { category: "chat", contextLength: 127072, maxTokens: 8192, webSearch: true },
131
+ "sonar-pro": { category: "chat", contextLength: 2e5, maxTokens: 8192, webSearch: true },
132
+ "sonar-reasoning-pro": { category: "reasoning", contextLength: 127072, maxTokens: 8192, reasoning: true, webSearch: true }
133
+ };
134
+ var BAIDU_ERNIE_MODELS = {
135
+ "qianfan-code-latest": { category: "code", contextLength: 98304, maxTokens: 65536, functionCall: true },
136
+ "ernie-4.5": { category: "chat", functionCall: true },
137
+ "ernie-3.5": { category: "chat" }
138
+ };
139
+ var KUAISHOU_KAT_MODELS = {
140
+ "kat-coder-pro-v1": { category: "code", contextLength: 256e3, maxTokens: 128e3, functionCall: true },
141
+ "kat-coder-air-v1": { category: "code", contextLength: 128e3, maxTokens: 32768, functionCall: true }
142
+ };
143
+ var VENDOR_GROUPS = [
144
+ { name: "OPENAI_MODELS", entries: OPENAI_MODELS },
145
+ { name: "ANTHROPIC_MODELS", entries: ANTHROPIC_MODELS },
146
+ { name: "GEMINI_MODELS", entries: GEMINI_MODELS },
147
+ { name: "GROK_MODELS", entries: GROK_MODELS },
148
+ { name: "DEEPSEEK_MODELS", entries: DEEPSEEK_MODELS },
149
+ { name: "ZHIPU_MODELS", entries: ZHIPU_MODELS },
150
+ { name: "KIMI_MODELS", entries: KIMI_MODELS },
151
+ { name: "DASHSCOPE_QWEN_MODELS", entries: DASHSCOPE_QWEN_MODELS },
152
+ { name: "VOLCENGINE_DOUBAO_MODELS", entries: VOLCENGINE_DOUBAO_MODELS },
153
+ { name: "TENCENT_HUNYUAN_MODELS", entries: TENCENT_HUNYUAN_MODELS },
154
+ { name: "MINIMAX_MODELS", entries: MINIMAX_MODELS },
155
+ { name: "XIAOMI_MIMO_CANONICAL", entries: XIAOMI_MIMO_CANONICAL },
156
+ { name: "META_LLAMA_MODELS", entries: META_LLAMA_MODELS },
157
+ { name: "MISTRAL_MODELS", entries: MISTRAL_MODELS },
158
+ { name: "PERPLEXITY_MODELS", entries: PERPLEXITY_MODELS },
159
+ { name: "BAIDU_ERNIE_MODELS", entries: BAIDU_ERNIE_MODELS },
160
+ { name: "KUAISHOU_KAT_MODELS", entries: KUAISHOU_KAT_MODELS }
161
+ ];
162
+ function assertNoDuplicateCanonicalIds() {
163
+ const seen = /* @__PURE__ */ new Map();
164
+ for (const { name, entries } of VENDOR_GROUPS) {
165
+ for (const id of Object.keys(entries)) {
166
+ const prior = seen.get(id);
167
+ if (prior) {
168
+ throw new Error(
169
+ `[canonical-models] duplicate id '${id}' registered in both '${prior}' and '${name}'. Each model must live in exactly one vendor group.`
170
+ );
171
+ }
172
+ seen.set(id, name);
173
+ }
174
+ }
175
+ }
176
+ assertNoDuplicateCanonicalIds();
177
+ var KNOWN_MODELS = Object.freeze(
178
+ Object.assign(
179
+ /* @__PURE__ */ Object.create(null),
180
+ ...VENDOR_GROUPS.map((g) => g.entries)
181
+ )
182
+ );
183
+ function normalizeModelId(rawId) {
184
+ if (!rawId) return "";
185
+ const slashIdx = rawId.lastIndexOf("/");
186
+ const base = slashIdx >= 0 ? rawId.slice(slashIdx + 1) : rawId;
187
+ const colonIdx = base.indexOf(":");
188
+ const noSuffix = colonIdx >= 0 ? base.slice(0, colonIdx) : base;
189
+ return noSuffix.toLowerCase();
190
+ }
191
+ var MODEL_ALIASES = {
192
+ "deepseek-chat": "deepseek-v3",
193
+ "deepseek-reasoner": "deepseek-r1"
194
+ };
195
+ function applyAlias(normalizedId) {
196
+ return MODEL_ALIASES[normalizedId] ?? normalizedId;
197
+ }
198
+ function assertAliasesPointToKnownModels() {
199
+ for (const [from, to] of Object.entries(MODEL_ALIASES)) {
200
+ if (!(to in KNOWN_MODELS)) {
201
+ throw new Error(
202
+ `[canonical-models] alias '${from}' \u2192 '${to}' points at unknown id. Either add '${to}' to a vendor group or fix the alias.`
203
+ );
204
+ }
205
+ }
206
+ }
207
+ assertAliasesPointToKnownModels();
208
+ var CAPABILITY_FIELDS = [
209
+ "category",
210
+ "contextLength",
211
+ "maxTokens",
212
+ "vision",
213
+ "functionCall",
214
+ "reasoning",
215
+ "webSearch",
216
+ "thinkingLevels",
217
+ "thinkingTokenLimit"
218
+ ];
219
+ function lookupCanonicalCapabilities(rawId, extendedContext = false) {
220
+ const normalized = normalizeModelId(rawId);
221
+ if (!normalized) return void 0;
222
+ const canonicalId = applyAlias(normalized);
223
+ if (extendedContext) {
224
+ const extendedKey = `${canonicalId}[1m]`;
225
+ const extended = KNOWN_MODELS[extendedKey];
226
+ if (extended) return extended;
227
+ }
228
+ return KNOWN_MODELS[canonicalId];
229
+ }
230
+ function resolveModelCapabilities(modelId, presetOverride, rowOverride) {
231
+ const canonical = lookupCanonicalCapabilities(modelId) ?? {};
232
+ const result = {};
233
+ for (const field of CAPABILITY_FIELDS) {
234
+ const rowValue = rowOverride?.[field];
235
+ if (rowValue !== void 0) {
236
+ assignField(result, field, rowValue);
237
+ continue;
238
+ }
239
+ const presetValue = presetOverride?.[field];
240
+ if (presetValue !== void 0) {
241
+ assignField(result, field, presetValue);
242
+ continue;
243
+ }
244
+ const canonicalValue = canonical[field];
245
+ if (canonicalValue !== void 0) {
246
+ assignField(result, field, canonicalValue);
247
+ }
248
+ }
249
+ return result;
250
+ }
251
+ function assignField(target, field, value) {
252
+ target[field] = value;
253
+ }
254
+ // Annotate the CommonJS export names for ESM import in node:
255
+ 0 && (module.exports = {
256
+ KNOWN_MODELS,
257
+ MODEL_ALIASES,
258
+ applyAlias,
259
+ lookupCanonicalCapabilities,
260
+ normalizeModelId,
261
+ resolveModelCapabilities
262
+ });