@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
@@ -0,0 +1,107 @@
1
+ import { T as ThinkLevel } from './thinking-CBWSLel8.cjs';
2
+ import { M as ModelConfig } from './llm-config-CQjOimv2.cjs';
3
+
4
+ /**
5
+ * Canonical Model Registry
6
+ *
7
+ * Single source of truth for **model capabilities** (contextLength, vision,
8
+ * reasoning, thinking levels, etc.). Capabilities are properties of the
9
+ * *model*, not of the provider that hosts it — so this registry is keyed by a
10
+ * normalized model id and used by every provider that exposes that model.
11
+ *
12
+ * Use cases:
13
+ * - Aggregator providers (OpenRouter / SiliconFlow / Together) that host
14
+ * upstream models inherit caps automatically; their preset modelConfigs
15
+ * don't have to redeclare vision/reasoning/etc. for every model.
16
+ * - User adds a model id (e.g. `glm-5.1`) via Manage Models on any provider:
17
+ * runtime fills capability fields from this registry on every load.
18
+ * - Per-preset and per-row overrides remain authoritative when defined —
19
+ * `resolveModelCapabilities` does per-field merge with preset / row
20
+ * winning over canonical.
21
+ *
22
+ * Maintenance: vendor-grouped const blocks below. To add a new model from
23
+ * vendor X, edit the `X_MODELS` block. The flat `KNOWN_MODELS` export at the
24
+ * bottom is auto-merged at module init; a duplicate-id assertion fails fast
25
+ * if two vendors accidentally claim the same id.
26
+ */
27
+
28
+ /**
29
+ * Capability subset of {@link ModelConfig} — fields that describe what the
30
+ * model can do, independent of who's hosting it. Excludes `id`, `name`,
31
+ * `enabled`, `group`, `completionSettings`, `openRouterProvider` (per-row /
32
+ * per-provider concerns).
33
+ */
34
+ interface KnownModelCapabilities {
35
+ category?: ModelConfig['category'];
36
+ contextLength?: number;
37
+ maxTokens?: number;
38
+ vision?: boolean;
39
+ functionCall?: boolean;
40
+ reasoning?: boolean;
41
+ webSearch?: boolean;
42
+ thinkingLevels?: ThinkLevel[];
43
+ thinkingTokenLimit?: {
44
+ min: number;
45
+ max: number;
46
+ };
47
+ }
48
+ /**
49
+ * Result of three-layer resolution. Same shape as KnownModelCapabilities;
50
+ * any subset of fields may be defined.
51
+ */
52
+ type ResolvedModelCapabilities = KnownModelCapabilities;
53
+ declare const KNOWN_MODELS: Record<string, KnownModelCapabilities>;
54
+ /**
55
+ * Reduce a raw model id (as it appears in any provider's model list) to its
56
+ * canonical key for {@link KNOWN_MODELS} lookup.
57
+ *
58
+ * Rules:
59
+ * 1. Strip publisher prefix: take everything after the LAST `/`. Handles
60
+ * `zai-org/GLM-4.7` → `GLM-4.7`, `anthropic/claude-haiku` → `claude-haiku`.
61
+ * 2. Strip aggregator quality / deployment suffixes — anything after `:`
62
+ * (e.g. `:beta`, `:nitro`, `:free`) — they don't change capabilities.
63
+ * 3. Lowercase. Aggregators disagree on case (`DeepSeek-V3` vs `deepseek-v3`).
64
+ *
65
+ * Pure, deterministic, idempotent.
66
+ */
67
+ declare function normalizeModelId(rawId: string): string;
68
+ /**
69
+ * Marketing / legacy aliases that resolve to canonical ids. Applied AFTER
70
+ * `normalizeModelId`. Values MUST be keys of {@link KNOWN_MODELS}; an
71
+ * assertion at module load enforces this so the alias map can't drift to
72
+ * point at non-existent entries.
73
+ *
74
+ * Currently covers DeepSeek's marketing names (`deepseek-chat` is the
75
+ * marketing alias for the latest non-reasoning model — historically v3,
76
+ * may rotate as new releases land).
77
+ */
78
+ declare const MODEL_ALIASES: Record<string, string>;
79
+ /**
80
+ * Resolve a normalized id through the alias map. Pass-through if no alias
81
+ * is registered.
82
+ */
83
+ declare function applyAlias(normalizedId: string): string;
84
+ /**
85
+ * Look up canonical capabilities for a model id. Pure read — no merge.
86
+ * Returns `undefined` if the id (after normalize + alias) isn't in the table.
87
+ *
88
+ * Hosts store the bare model id and a separate `useExtendedContext`
89
+ * flag. When that flag is true, this lookup first
90
+ * tries the `<id>[1m]` capability key (which has the 1M `contextLength` and
91
+ * higher `maxTokens` values) and falls back to the bare id. The `[1m]`
92
+ * suffix in `KNOWN_MODELS` is a lookup convention, not a string-protocol
93
+ * violation — it lives entirely inside this capability table.
94
+ */
95
+ declare function lookupCanonicalCapabilities(rawId: string, extendedContext?: boolean): KnownModelCapabilities | undefined;
96
+ /**
97
+ * Three-layer merge for a single model. Priority (lowest → highest):
98
+ * 1. Canonical `KNOWN_MODELS` entry (after normalize + alias)
99
+ * 2. `presetOverride` — `modelConfig` declared on a `PresetProviderTemplate`
100
+ * 3. `rowOverride` — user-edited fields persisted on the `llm_models` row
101
+ *
102
+ * Each capability field is merged independently — a higher-priority
103
+ * `undefined` does NOT shadow a lower-priority defined value.
104
+ */
105
+ declare function resolveModelCapabilities(modelId: string, presetOverride?: Partial<ModelConfig>, rowOverride?: Partial<ModelConfig>): ResolvedModelCapabilities;
106
+
107
+ export { KNOWN_MODELS, type KnownModelCapabilities, MODEL_ALIASES, type ResolvedModelCapabilities, applyAlias, lookupCanonicalCapabilities, normalizeModelId, resolveModelCapabilities };
@@ -0,0 +1,107 @@
1
+ import { T as ThinkLevel } from './thinking-CBWSLel8.js';
2
+ import { M as ModelConfig } from './llm-config-D1jKQLVp.js';
3
+
4
+ /**
5
+ * Canonical Model Registry
6
+ *
7
+ * Single source of truth for **model capabilities** (contextLength, vision,
8
+ * reasoning, thinking levels, etc.). Capabilities are properties of the
9
+ * *model*, not of the provider that hosts it — so this registry is keyed by a
10
+ * normalized model id and used by every provider that exposes that model.
11
+ *
12
+ * Use cases:
13
+ * - Aggregator providers (OpenRouter / SiliconFlow / Together) that host
14
+ * upstream models inherit caps automatically; their preset modelConfigs
15
+ * don't have to redeclare vision/reasoning/etc. for every model.
16
+ * - User adds a model id (e.g. `glm-5.1`) via Manage Models on any provider:
17
+ * runtime fills capability fields from this registry on every load.
18
+ * - Per-preset and per-row overrides remain authoritative when defined —
19
+ * `resolveModelCapabilities` does per-field merge with preset / row
20
+ * winning over canonical.
21
+ *
22
+ * Maintenance: vendor-grouped const blocks below. To add a new model from
23
+ * vendor X, edit the `X_MODELS` block. The flat `KNOWN_MODELS` export at the
24
+ * bottom is auto-merged at module init; a duplicate-id assertion fails fast
25
+ * if two vendors accidentally claim the same id.
26
+ */
27
+
28
+ /**
29
+ * Capability subset of {@link ModelConfig} — fields that describe what the
30
+ * model can do, independent of who's hosting it. Excludes `id`, `name`,
31
+ * `enabled`, `group`, `completionSettings`, `openRouterProvider` (per-row /
32
+ * per-provider concerns).
33
+ */
34
+ interface KnownModelCapabilities {
35
+ category?: ModelConfig['category'];
36
+ contextLength?: number;
37
+ maxTokens?: number;
38
+ vision?: boolean;
39
+ functionCall?: boolean;
40
+ reasoning?: boolean;
41
+ webSearch?: boolean;
42
+ thinkingLevels?: ThinkLevel[];
43
+ thinkingTokenLimit?: {
44
+ min: number;
45
+ max: number;
46
+ };
47
+ }
48
+ /**
49
+ * Result of three-layer resolution. Same shape as KnownModelCapabilities;
50
+ * any subset of fields may be defined.
51
+ */
52
+ type ResolvedModelCapabilities = KnownModelCapabilities;
53
+ declare const KNOWN_MODELS: Record<string, KnownModelCapabilities>;
54
+ /**
55
+ * Reduce a raw model id (as it appears in any provider's model list) to its
56
+ * canonical key for {@link KNOWN_MODELS} lookup.
57
+ *
58
+ * Rules:
59
+ * 1. Strip publisher prefix: take everything after the LAST `/`. Handles
60
+ * `zai-org/GLM-4.7` → `GLM-4.7`, `anthropic/claude-haiku` → `claude-haiku`.
61
+ * 2. Strip aggregator quality / deployment suffixes — anything after `:`
62
+ * (e.g. `:beta`, `:nitro`, `:free`) — they don't change capabilities.
63
+ * 3. Lowercase. Aggregators disagree on case (`DeepSeek-V3` vs `deepseek-v3`).
64
+ *
65
+ * Pure, deterministic, idempotent.
66
+ */
67
+ declare function normalizeModelId(rawId: string): string;
68
+ /**
69
+ * Marketing / legacy aliases that resolve to canonical ids. Applied AFTER
70
+ * `normalizeModelId`. Values MUST be keys of {@link KNOWN_MODELS}; an
71
+ * assertion at module load enforces this so the alias map can't drift to
72
+ * point at non-existent entries.
73
+ *
74
+ * Currently covers DeepSeek's marketing names (`deepseek-chat` is the
75
+ * marketing alias for the latest non-reasoning model — historically v3,
76
+ * may rotate as new releases land).
77
+ */
78
+ declare const MODEL_ALIASES: Record<string, string>;
79
+ /**
80
+ * Resolve a normalized id through the alias map. Pass-through if no alias
81
+ * is registered.
82
+ */
83
+ declare function applyAlias(normalizedId: string): string;
84
+ /**
85
+ * Look up canonical capabilities for a model id. Pure read — no merge.
86
+ * Returns `undefined` if the id (after normalize + alias) isn't in the table.
87
+ *
88
+ * Hosts store the bare model id and a separate `useExtendedContext`
89
+ * flag. When that flag is true, this lookup first
90
+ * tries the `<id>[1m]` capability key (which has the 1M `contextLength` and
91
+ * higher `maxTokens` values) and falls back to the bare id. The `[1m]`
92
+ * suffix in `KNOWN_MODELS` is a lookup convention, not a string-protocol
93
+ * violation — it lives entirely inside this capability table.
94
+ */
95
+ declare function lookupCanonicalCapabilities(rawId: string, extendedContext?: boolean): KnownModelCapabilities | undefined;
96
+ /**
97
+ * Three-layer merge for a single model. Priority (lowest → highest):
98
+ * 1. Canonical `KNOWN_MODELS` entry (after normalize + alias)
99
+ * 2. `presetOverride` — `modelConfig` declared on a `PresetProviderTemplate`
100
+ * 3. `rowOverride` — user-edited fields persisted on the `llm_models` row
101
+ *
102
+ * Each capability field is merged independently — a higher-priority
103
+ * `undefined` does NOT shadow a lower-priority defined value.
104
+ */
105
+ declare function resolveModelCapabilities(modelId: string, presetOverride?: Partial<ModelConfig>, rowOverride?: Partial<ModelConfig>): ResolvedModelCapabilities;
106
+
107
+ export { KNOWN_MODELS, type KnownModelCapabilities, MODEL_ALIASES, type ResolvedModelCapabilities, applyAlias, lookupCanonicalCapabilities, normalizeModelId, resolveModelCapabilities };
@@ -0,0 +1,232 @@
1
+ // src/canonical-models.ts
2
+ var OPENAI_MODELS = {
3
+ "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 } },
4
+ "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 } },
5
+ "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 } },
6
+ "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 } },
7
+ "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 } },
8
+ "gpt-5": { category: "reasoning", contextLength: 105e4, maxTokens: 65536, reasoning: true, vision: true, functionCall: true },
9
+ "gpt-4.1": { category: "chat", contextLength: 105e4, maxTokens: 32768, vision: true, functionCall: true },
10
+ "gpt-4o": { category: "chat", contextLength: 128e3, maxTokens: 16384, vision: true, functionCall: true },
11
+ "gpt-4o-mini": { category: "chat", contextLength: 128e3, maxTokens: 16384, functionCall: true },
12
+ "o3": { category: "reasoning", contextLength: 2e5, maxTokens: 1e5, reasoning: true, thinkingLevels: ["low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 65536 } },
13
+ "o4-mini": { category: "reasoning", contextLength: 2e5, maxTokens: 1e5, reasoning: true, thinkingLevels: ["low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } }
14
+ };
15
+ var ANTHROPIC_MODELS = {
16
+ "claude-opus-4-7": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
17
+ "claude-opus-4-7[1m]": { category: "reasoning", contextLength: 1e6, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
18
+ "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 } },
19
+ "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 } },
20
+ "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 } },
21
+ "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 } },
22
+ "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 } }
23
+ };
24
+ var GEMINI_MODELS = {
25
+ "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 } },
26
+ "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 } }
27
+ };
28
+ var GROK_MODELS = {
29
+ "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 } },
30
+ "grok-4.20": { category: "chat", contextLength: 131072, maxTokens: 32768, vision: true, functionCall: true },
31
+ "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 } },
32
+ "grok-4.20-multi-agent": { category: "reasoning", contextLength: 131072, maxTokens: 32768, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } }
33
+ };
34
+ var DEEPSEEK_MODELS = {
35
+ "deepseek-v4-flash": { category: "chat", contextLength: 1e6, maxTokens: 384e3, functionCall: true, reasoning: true, thinkingLevels: ["none", "high", "max"], thinkingTokenLimit: { min: 0, max: 32768 } },
36
+ "deepseek-v4-pro": { category: "reasoning", contextLength: 1e6, maxTokens: 384e3, functionCall: true, reasoning: true, thinkingLevels: ["none", "high", "max"], thinkingTokenLimit: { min: 0, max: 32768 } },
37
+ "deepseek-v3": { category: "chat", contextLength: 65536, maxTokens: 8192, functionCall: true },
38
+ "deepseek-v3.2": { category: "code", contextLength: 256e3, maxTokens: 32768, functionCall: true, reasoning: true },
39
+ "deepseek-r1": { category: "reasoning", contextLength: 64e3, maxTokens: 8192, reasoning: true, thinkingTokenLimit: { min: 0, max: 32768 } }
40
+ };
41
+ var ZHIPU_MODELS = {
42
+ "glm-5": { category: "chat", contextLength: 2e5, maxTokens: 128e3, functionCall: true },
43
+ "glm-5.1": { category: "chat", contextLength: 2e5, maxTokens: 128e3, functionCall: true },
44
+ "glm-4.5-air": { category: "chat", contextLength: 128e3, maxTokens: 32768, functionCall: true },
45
+ "glm-4.6v": { category: "chat", contextLength: 128e3, maxTokens: 32768, vision: true, functionCall: true },
46
+ "glm-4.7": { category: "code", contextLength: 2e5, maxTokens: 128e3, functionCall: true }
47
+ };
48
+ var KIMI_MODELS = {
49
+ "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 } },
50
+ "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 } },
51
+ "kimi-k2-thinking": { category: "reasoning", contextLength: 256e3, reasoning: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } }
52
+ };
53
+ var DASHSCOPE_QWEN_MODELS = {
54
+ "qwen3-max": { category: "chat", contextLength: 262144, maxTokens: 65536, functionCall: true, webSearch: true },
55
+ "qwen3.5-plus": { category: "chat", contextLength: 1e6, vision: true, functionCall: true, webSearch: true },
56
+ "qwen-turbo": { category: "chat", contextLength: 1e6, vision: true, webSearch: true },
57
+ "qwen3-coder-plus": { category: "code", contextLength: 1e6, functionCall: true },
58
+ "qwen-3-coder-480b": { category: "code", contextLength: 131072, maxTokens: 8192, functionCall: true },
59
+ "qwen-3-32b": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
60
+ "qwen2.5-coder-32b-instruct": { category: "code", contextLength: 32768, maxTokens: 8192, functionCall: true },
61
+ "qwen2.5-coder-7b-instruct": { category: "code", contextLength: 32768, maxTokens: 8192, functionCall: true }
62
+ };
63
+ var VOLCENGINE_DOUBAO_MODELS = {
64
+ "ark-code-latest": { category: "code", contextLength: 256e3, maxTokens: 32768, functionCall: true },
65
+ "doubao-seed-2.0-code": { category: "code", contextLength: 256e3, maxTokens: 128e3, vision: true, functionCall: true },
66
+ "doubao-seed-2.0-lite": { category: "chat", contextLength: 256e3, maxTokens: 32768, functionCall: true }
67
+ };
68
+ var TENCENT_HUNYUAN_MODELS = {
69
+ "tc-code-latest": { category: "code", functionCall: true },
70
+ "hunyuan-2.0-instruct": { category: "chat", functionCall: true },
71
+ "hunyuan-turbos": { category: "chat", functionCall: true }
72
+ };
73
+ var MINIMAX_MODELS = {
74
+ "minimax-m2.5": { category: "code", contextLength: 204800, functionCall: true },
75
+ "minimax-m2.5-highspeed": { category: "code", contextLength: 204800, functionCall: true },
76
+ "minimax-m2.1": { category: "code", contextLength: 204800, functionCall: true },
77
+ "minimax-m2.1-highspeed": { category: "code", contextLength: 204800, functionCall: true }
78
+ };
79
+ var XIAOMI_MIMO_CANONICAL = {
80
+ "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 } },
81
+ // mimo-v2.5-pro does not support vision (text + reasoning only).
82
+ "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 } },
83
+ "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 } },
84
+ "mimo-v2-flash": { category: "code", contextLength: 256e3, maxTokens: 32768, vision: true, functionCall: true },
85
+ "mimo-v2-omni": { category: "chat", contextLength: 256e3, maxTokens: 32768, vision: true, functionCall: true }
86
+ };
87
+ var META_LLAMA_MODELS = {
88
+ "llama-3.3-70b": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
89
+ "llama-3.3-70b-versatile": { category: "chat", contextLength: 131072, maxTokens: 32768, functionCall: true },
90
+ "llama-3.3-70b-instruct": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
91
+ "llama-3.3-70b-instruct-turbo": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
92
+ "llama-3.1-8b-instant": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true }
93
+ };
94
+ var MISTRAL_MODELS = {
95
+ "mistral-large-latest": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
96
+ "codestral-latest": { category: "code", contextLength: 256e3, maxTokens: 8192, functionCall: true },
97
+ "mistral-medium-latest": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
98
+ "mixtral-8x7b-32768": { category: "chat", contextLength: 32768, maxTokens: 32768, functionCall: true }
99
+ };
100
+ var PERPLEXITY_MODELS = {
101
+ "sonar": { category: "chat", contextLength: 127072, maxTokens: 8192, webSearch: true },
102
+ "sonar-pro": { category: "chat", contextLength: 2e5, maxTokens: 8192, webSearch: true },
103
+ "sonar-reasoning-pro": { category: "reasoning", contextLength: 127072, maxTokens: 8192, reasoning: true, webSearch: true }
104
+ };
105
+ var BAIDU_ERNIE_MODELS = {
106
+ "qianfan-code-latest": { category: "code", contextLength: 98304, maxTokens: 65536, functionCall: true },
107
+ "ernie-4.5": { category: "chat", functionCall: true },
108
+ "ernie-3.5": { category: "chat" }
109
+ };
110
+ var KUAISHOU_KAT_MODELS = {
111
+ "kat-coder-pro-v1": { category: "code", contextLength: 256e3, maxTokens: 128e3, functionCall: true },
112
+ "kat-coder-air-v1": { category: "code", contextLength: 128e3, maxTokens: 32768, functionCall: true }
113
+ };
114
+ var VENDOR_GROUPS = [
115
+ { name: "OPENAI_MODELS", entries: OPENAI_MODELS },
116
+ { name: "ANTHROPIC_MODELS", entries: ANTHROPIC_MODELS },
117
+ { name: "GEMINI_MODELS", entries: GEMINI_MODELS },
118
+ { name: "GROK_MODELS", entries: GROK_MODELS },
119
+ { name: "DEEPSEEK_MODELS", entries: DEEPSEEK_MODELS },
120
+ { name: "ZHIPU_MODELS", entries: ZHIPU_MODELS },
121
+ { name: "KIMI_MODELS", entries: KIMI_MODELS },
122
+ { name: "DASHSCOPE_QWEN_MODELS", entries: DASHSCOPE_QWEN_MODELS },
123
+ { name: "VOLCENGINE_DOUBAO_MODELS", entries: VOLCENGINE_DOUBAO_MODELS },
124
+ { name: "TENCENT_HUNYUAN_MODELS", entries: TENCENT_HUNYUAN_MODELS },
125
+ { name: "MINIMAX_MODELS", entries: MINIMAX_MODELS },
126
+ { name: "XIAOMI_MIMO_CANONICAL", entries: XIAOMI_MIMO_CANONICAL },
127
+ { name: "META_LLAMA_MODELS", entries: META_LLAMA_MODELS },
128
+ { name: "MISTRAL_MODELS", entries: MISTRAL_MODELS },
129
+ { name: "PERPLEXITY_MODELS", entries: PERPLEXITY_MODELS },
130
+ { name: "BAIDU_ERNIE_MODELS", entries: BAIDU_ERNIE_MODELS },
131
+ { name: "KUAISHOU_KAT_MODELS", entries: KUAISHOU_KAT_MODELS }
132
+ ];
133
+ function assertNoDuplicateCanonicalIds() {
134
+ const seen = /* @__PURE__ */ new Map();
135
+ for (const { name, entries } of VENDOR_GROUPS) {
136
+ for (const id of Object.keys(entries)) {
137
+ const prior = seen.get(id);
138
+ if (prior) {
139
+ throw new Error(
140
+ `[canonical-models] duplicate id '${id}' registered in both '${prior}' and '${name}'. Each model must live in exactly one vendor group.`
141
+ );
142
+ }
143
+ seen.set(id, name);
144
+ }
145
+ }
146
+ }
147
+ assertNoDuplicateCanonicalIds();
148
+ var KNOWN_MODELS = Object.freeze(
149
+ Object.assign(
150
+ /* @__PURE__ */ Object.create(null),
151
+ ...VENDOR_GROUPS.map((g) => g.entries)
152
+ )
153
+ );
154
+ function normalizeModelId(rawId) {
155
+ if (!rawId) return "";
156
+ const slashIdx = rawId.lastIndexOf("/");
157
+ const base = slashIdx >= 0 ? rawId.slice(slashIdx + 1) : rawId;
158
+ const colonIdx = base.indexOf(":");
159
+ const noSuffix = colonIdx >= 0 ? base.slice(0, colonIdx) : base;
160
+ return noSuffix.toLowerCase();
161
+ }
162
+ var MODEL_ALIASES = {
163
+ "deepseek-chat": "deepseek-v3",
164
+ "deepseek-reasoner": "deepseek-r1"
165
+ };
166
+ function applyAlias(normalizedId) {
167
+ return MODEL_ALIASES[normalizedId] ?? normalizedId;
168
+ }
169
+ function assertAliasesPointToKnownModels() {
170
+ for (const [from, to] of Object.entries(MODEL_ALIASES)) {
171
+ if (!(to in KNOWN_MODELS)) {
172
+ throw new Error(
173
+ `[canonical-models] alias '${from}' \u2192 '${to}' points at unknown id. Either add '${to}' to a vendor group or fix the alias.`
174
+ );
175
+ }
176
+ }
177
+ }
178
+ assertAliasesPointToKnownModels();
179
+ var CAPABILITY_FIELDS = [
180
+ "category",
181
+ "contextLength",
182
+ "maxTokens",
183
+ "vision",
184
+ "functionCall",
185
+ "reasoning",
186
+ "webSearch",
187
+ "thinkingLevels",
188
+ "thinkingTokenLimit"
189
+ ];
190
+ function lookupCanonicalCapabilities(rawId, extendedContext = false) {
191
+ const normalized = normalizeModelId(rawId);
192
+ if (!normalized) return void 0;
193
+ const canonicalId = applyAlias(normalized);
194
+ if (extendedContext) {
195
+ const extendedKey = `${canonicalId}[1m]`;
196
+ const extended = KNOWN_MODELS[extendedKey];
197
+ if (extended) return extended;
198
+ }
199
+ return KNOWN_MODELS[canonicalId];
200
+ }
201
+ function resolveModelCapabilities(modelId, presetOverride, rowOverride) {
202
+ const canonical = lookupCanonicalCapabilities(modelId) ?? {};
203
+ const result = {};
204
+ for (const field of CAPABILITY_FIELDS) {
205
+ const rowValue = rowOverride?.[field];
206
+ if (rowValue !== void 0) {
207
+ assignField(result, field, rowValue);
208
+ continue;
209
+ }
210
+ const presetValue = presetOverride?.[field];
211
+ if (presetValue !== void 0) {
212
+ assignField(result, field, presetValue);
213
+ continue;
214
+ }
215
+ const canonicalValue = canonical[field];
216
+ if (canonicalValue !== void 0) {
217
+ assignField(result, field, canonicalValue);
218
+ }
219
+ }
220
+ return result;
221
+ }
222
+ function assignField(target, field, value) {
223
+ target[field] = value;
224
+ }
225
+ export {
226
+ KNOWN_MODELS,
227
+ MODEL_ALIASES,
228
+ applyAlias,
229
+ lookupCanonicalCapabilities,
230
+ normalizeModelId,
231
+ resolveModelCapabilities
232
+ };
@@ -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/completion-types.ts
17
+ var completion_types_exports = {};
18
+ module.exports = __toCommonJS(completion_types_exports);