@theokit/sdk 5.9.1 → 5.10.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/CHANGELOG.md +119 -0
- package/dist/{agent-enXXu447.d.ts → agent-CmKwSyyD.d.ts} +27 -0
- package/dist/{agent-5M7WLUWH.cjs → agent-TLRURB7W.cjs} +18 -16
- package/dist/{agent-5M7WLUWH.cjs.map → agent-TLRURB7W.cjs.map} +1 -1
- package/dist/{agent-Dh2YHSLj.d.cts → agent-XMkGzff_.d.cts} +27 -0
- package/dist/{agent-R5RERYFU.js → agent-XTLAVVYC.js} +17 -15
- package/dist/{agent-R5RERYFU.js.map → agent-XTLAVVYC.js.map} +1 -1
- package/dist/agent-session-store-ODD3IZCW.js +6 -0
- package/dist/{agent-session-store-AFML3AXC.js.map → agent-session-store-ODD3IZCW.js.map} +1 -1
- package/dist/agent-session-store-SVEJHSUA.cjs +23 -0
- package/dist/{agent-session-store-MTSIY3MH.cjs.map → agent-session-store-SVEJHSUA.cjs.map} +1 -1
- package/dist/auth/index.cjs +8 -7
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.js +3 -2
- package/dist/auth/index.js.map +1 -1
- package/dist/{chunk-QCIARBLS.js → chunk-523O5UYB.js} +3 -3
- package/dist/{chunk-QCIARBLS.js.map → chunk-523O5UYB.js.map} +1 -1
- package/dist/chunk-7KIN3L2S.js +103 -0
- package/dist/chunk-7KIN3L2S.js.map +1 -0
- package/dist/chunk-ASK2OQM5.cjs +84 -0
- package/dist/chunk-ASK2OQM5.cjs.map +1 -0
- package/dist/{chunk-56BCEM26.cjs → chunk-CVEQ5366.cjs} +105 -91
- package/dist/chunk-CVEQ5366.cjs.map +1 -0
- package/dist/{chunk-R2C3HXR3.js → chunk-DPY2M74T.js} +3 -3
- package/dist/{chunk-R2C3HXR3.js.map → chunk-DPY2M74T.js.map} +1 -1
- package/dist/chunk-EHD25JBZ.cjs +10 -0
- package/dist/chunk-EHD25JBZ.cjs.map +1 -0
- package/dist/{chunk-NOO6GZTZ.js → chunk-EVH3OUMY.js} +13 -12
- package/dist/chunk-EVH3OUMY.js.map +1 -0
- package/dist/{chunk-5522X223.js → chunk-EXI7EHDN.js} +4 -4
- package/dist/{chunk-5522X223.js.map → chunk-EXI7EHDN.js.map} +1 -1
- package/dist/{chunk-PSLCVSCS.cjs → chunk-FR6COQXZ.cjs} +6 -6
- package/dist/{chunk-PSLCVSCS.cjs.map → chunk-FR6COQXZ.cjs.map} +1 -1
- package/dist/{chunk-JOFVLOFY.js → chunk-FTZTZBCU.js} +12 -4
- package/dist/chunk-FTZTZBCU.js.map +1 -0
- package/dist/{chunk-T5KOSR5Y.cjs → chunk-FYEHYQ7T.cjs} +8 -8
- package/dist/{chunk-T5KOSR5Y.cjs.map → chunk-FYEHYQ7T.cjs.map} +1 -1
- package/dist/{chunk-HOHR75KF.js → chunk-HI3W37FY.js} +4 -3
- package/dist/chunk-HI3W37FY.js.map +1 -0
- package/dist/chunk-HU666T3Q.cjs +1891 -0
- package/dist/chunk-HU666T3Q.cjs.map +1 -0
- package/dist/{chunk-53RDNK3H.js → chunk-I2ORT6QD.js} +3 -3
- package/dist/{chunk-53RDNK3H.js.map → chunk-I2ORT6QD.js.map} +1 -1
- package/dist/{chunk-UNZOJVVC.js → chunk-IZDDSLL2.js} +5 -4
- package/dist/chunk-IZDDSLL2.js.map +1 -0
- package/dist/{chunk-TTBIQTO5.cjs → chunk-L3C6CCBG.cjs} +15 -15
- package/dist/{chunk-TTBIQTO5.cjs.map → chunk-L3C6CCBG.cjs.map} +1 -1
- package/dist/{chunk-B3XXQX6L.cjs → chunk-NQVWSSX2.cjs} +10 -9
- package/dist/chunk-NQVWSSX2.cjs.map +1 -0
- package/dist/{chunk-LL4QA3DI.cjs → chunk-PCLRIQPX.cjs} +4 -4
- package/dist/{chunk-LL4QA3DI.cjs.map → chunk-PCLRIQPX.cjs.map} +1 -1
- package/dist/chunk-Q7GYMXVC.js +8 -0
- package/dist/chunk-Q7GYMXVC.js.map +1 -0
- package/dist/{chunk-ARMFXTY6.cjs → chunk-QY3CIMUV.cjs} +34 -33
- package/dist/chunk-QY3CIMUV.cjs.map +1 -0
- package/dist/chunk-R5YPDAKD.cjs +108 -0
- package/dist/chunk-R5YPDAKD.cjs.map +1 -0
- package/dist/chunk-RGQICWFU.js +82 -0
- package/dist/chunk-RGQICWFU.js.map +1 -0
- package/dist/{chunk-OOM236Z4.js → chunk-RTE2DD4S.js} +32 -18
- package/dist/chunk-RTE2DD4S.js.map +1 -0
- package/dist/chunk-SGC7LSHF.cjs +18 -0
- package/dist/{chunk-R3ZQBPA5.cjs.map → chunk-SGC7LSHF.cjs.map} +1 -1
- package/dist/{chunk-RA7IE4NK.cjs → chunk-SKDNCTXG.cjs} +4 -3
- package/dist/chunk-SKDNCTXG.cjs.map +1 -0
- package/dist/chunk-SVCPJRUB.js +1874 -0
- package/dist/chunk-SVCPJRUB.js.map +1 -0
- package/dist/{chunk-EJROML3Q.js → chunk-TX56N7FR.js} +4 -3
- package/dist/chunk-TX56N7FR.js.map +1 -0
- package/dist/{chunk-QDQQYRJI.js → chunk-W2ZVTEOD.js} +3 -3
- package/dist/{chunk-QDQQYRJI.js.map → chunk-W2ZVTEOD.js.map} +1 -1
- package/dist/{chunk-TC4RWP3Y.js → chunk-X3LOJJMO.js} +89 -29
- package/dist/chunk-X3LOJJMO.js.map +1 -0
- package/dist/{chunk-2WXHA33T.js → chunk-XERM7PDQ.js} +3 -3
- package/dist/{chunk-2WXHA33T.js.map → chunk-XERM7PDQ.js.map} +1 -1
- package/dist/{chunk-MEUBLCM4.cjs → chunk-YEHQ3SIC.cjs} +4 -3
- package/dist/chunk-YEHQ3SIC.cjs.map +1 -0
- package/dist/{chunk-YIFFF23U.cjs → chunk-ZAM7BJXJ.cjs} +5 -5
- package/dist/{chunk-YIFFF23U.cjs.map → chunk-ZAM7BJXJ.cjs.map} +1 -1
- package/dist/{chunk-76PIKR4P.cjs → chunk-ZD66GFH5.cjs} +91 -29
- package/dist/chunk-ZD66GFH5.cjs.map +1 -0
- package/dist/{chunk-GZV6AVRL.cjs → chunk-ZWACQM5U.cjs} +11 -3
- package/dist/chunk-ZWACQM5U.cjs.map +1 -0
- package/dist/{compact-session-RBPLUPCK.cjs → compact-session-4QHBBGEY.cjs} +16 -15
- package/dist/{compact-session-RBPLUPCK.cjs.map → compact-session-4QHBBGEY.cjs.map} +1 -1
- package/dist/{compact-session-2N3ZYJTW.js → compact-session-PVAWTKKL.js} +7 -6
- package/dist/{compact-session-2N3ZYJTW.js.map → compact-session-PVAWTKKL.js.map} +1 -1
- package/dist/{cron-DTuaPMVI.d.ts → cron-BPccQCO8.d.ts} +1 -1
- package/dist/{cron-QTgcwcZt.d.cts → cron-Blj6wMYg.d.cts} +1 -1
- package/dist/cron.cjs +17 -15
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +16 -14
- package/dist/eval.cjs +20 -18
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +16 -14
- package/dist/eval.js.map +1 -1
- package/dist/fs-session-store-3VI4CPTX.js +11 -0
- package/dist/{fs-session-store-STZZFXH2.js.map → fs-session-store-3VI4CPTX.js.map} +1 -1
- package/dist/fs-session-store-IQ6PEHYF.cjs +20 -0
- package/dist/{fs-session-store-JHBJFKVV.cjs.map → fs-session-store-IQ6PEHYF.cjs.map} +1 -1
- package/dist/{index-manager-ONQJSWX5.js → index-manager-JVYIVTZG.js} +6 -5
- package/dist/{index-manager-ONQJSWX5.js.map → index-manager-JVYIVTZG.js.map} +1 -1
- package/dist/{index-manager-ZGJN25FD.cjs → index-manager-YGXRFJMZ.cjs} +7 -6
- package/dist/{index-manager-ZGJN25FD.cjs.map → index-manager-YGXRFJMZ.cjs.map} +1 -1
- package/dist/index.cjs +68 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -6
- package/dist/index.d.ts +42 -6
- package/dist/index.js +31 -23
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-YNNOE3O6.js → inject-session-O24XGRR6.js} +5 -5
- package/dist/{inject-session-YNNOE3O6.js.map → inject-session-O24XGRR6.js.map} +1 -1
- package/dist/{inject-session-3FPXJDJP.cjs → inject-session-OMLFL2V3.cjs} +7 -7
- package/dist/{inject-session-3FPXJDJP.cjs.map → inject-session-OMLFL2V3.cjs.map} +1 -1
- package/dist/internal/memory/adapters/index.cjs +3 -2
- package/dist/internal/memory/adapters/index.js +2 -1
- package/dist/internal/memory/dreaming/phases.d.ts +2 -0
- package/dist/internal/memory/dreaming/run.d.ts +5 -0
- package/dist/internal/memory/sdk-memory-peer-loader.d.ts +2 -0
- package/dist/internal/memory/storage/fact-ceiling.d.cts +19 -0
- package/dist/internal/memory/storage/fact-ceiling.d.ts +19 -0
- package/dist/internal/memory/storage/index.cjs +41 -32
- package/dist/internal/memory/storage/index.d.cts +1 -0
- package/dist/internal/memory/storage/index.d.ts +1 -0
- package/dist/internal/memory/storage/index.js +4 -3
- package/dist/internal/memory/storage/markdown-store.d.cts +3 -1
- package/dist/internal/memory/storage/markdown-store.d.ts +3 -1
- package/dist/internal/memory/types.d.ts +6 -0
- package/dist/internal/persistence/index.cjs +7 -6
- package/dist/internal/persistence/index.cjs.map +1 -1
- package/dist/internal/persistence/index.js +2 -1
- package/dist/internal/persistence/index.js.map +1 -1
- package/dist/internal/persistence/persistence-schema.d.cts +1 -1
- package/dist/internal/persistence/persistence-schema.d.ts +1 -1
- package/dist/internal/providers/catalog-loader.d.ts +30 -3
- package/dist/internal/runtime/registry/agent-registry-store.d.ts +2 -0
- package/dist/internal/runtime-fetch.d.ts +1 -0
- package/dist/models.cjs +12 -11
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +4 -3
- package/dist/models.js.map +1 -1
- package/dist/persistence.cjs +14 -13
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.js +4 -3
- package/dist/persistence.js.map +1 -1
- package/dist/providers.cjs +6 -5
- package/dist/providers.js +4 -3
- package/dist/{session-transcript-VTBTCGQX.js → session-transcript-AR7IBICT.js} +3 -3
- package/dist/{session-transcript-VTBTCGQX.js.map → session-transcript-AR7IBICT.js.map} +1 -1
- package/dist/{session-transcript-LGHSNVY5.cjs → session-transcript-RACG7BK2.cjs} +16 -16
- package/dist/{session-transcript-LGHSNVY5.cjs.map → session-transcript-RACG7BK2.cjs.map} +1 -1
- package/dist/subagents-loader.d.cts +1 -1
- package/dist/subagents-loader.d.ts +1 -1
- package/dist/subscription/index.cjs +2 -1
- package/dist/subscription/index.cjs.map +1 -1
- package/dist/subscription/index.js +2 -1
- package/dist/subscription/index.js.map +1 -1
- package/dist/types/agent.d.ts +27 -0
- package/docs/error-codes.md +40 -38
- package/docs/harness-capability-map.md +6 -1
- package/package.json +2 -2
- package/dist/agent-session-store-AFML3AXC.js +0 -6
- package/dist/agent-session-store-MTSIY3MH.cjs +0 -23
- package/dist/chunk-56BCEM26.cjs.map +0 -1
- package/dist/chunk-76PIKR4P.cjs.map +0 -1
- package/dist/chunk-ARMFXTY6.cjs.map +0 -1
- package/dist/chunk-B3XXQX6L.cjs.map +0 -1
- package/dist/chunk-BKMDRBJ7.js +0 -180
- package/dist/chunk-BKMDRBJ7.js.map +0 -1
- package/dist/chunk-EJROML3Q.js.map +0 -1
- package/dist/chunk-GZV6AVRL.cjs.map +0 -1
- package/dist/chunk-HOHR75KF.js.map +0 -1
- package/dist/chunk-JOFVLOFY.js.map +0 -1
- package/dist/chunk-MEUBLCM4.cjs.map +0 -1
- package/dist/chunk-MFZODA5Y.js +0 -583
- package/dist/chunk-MFZODA5Y.js.map +0 -1
- package/dist/chunk-NOO6GZTZ.js.map +0 -1
- package/dist/chunk-OF2CLCTH.cjs +0 -186
- package/dist/chunk-OF2CLCTH.cjs.map +0 -1
- package/dist/chunk-OOM236Z4.js.map +0 -1
- package/dist/chunk-R3ZQBPA5.cjs +0 -18
- package/dist/chunk-RA7IE4NK.cjs.map +0 -1
- package/dist/chunk-TC4RWP3Y.js.map +0 -1
- package/dist/chunk-UNZOJVVC.js.map +0 -1
- package/dist/chunk-YRJA2POB.cjs +0 -601
- package/dist/chunk-YRJA2POB.cjs.map +0 -1
- package/dist/fs-session-store-JHBJFKVV.cjs +0 -19
- package/dist/fs-session-store-STZZFXH2.js +0 -10
- package/dist/provider-catalog.json +0 -1295
package/dist/chunk-YRJA2POB.cjs
DELETED
|
@@ -1,601 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkNVXXWAU7_cjs = require('./chunk-NVXXWAU7.cjs');
|
|
4
|
-
var chunkRA7IE4NK_cjs = require('./chunk-RA7IE4NK.cjs');
|
|
5
|
-
var chunkNAGPKWOD_cjs = require('./chunk-NAGPKWOD.cjs');
|
|
6
|
-
var chunkUNFBHV46_cjs = require('./chunk-UNFBHV46.cjs');
|
|
7
|
-
var chunk6LHQPOMI_cjs = require('./chunk-6LHQPOMI.cjs');
|
|
8
|
-
var fs = require('fs');
|
|
9
|
-
var path = require('path');
|
|
10
|
-
var url = require('url');
|
|
11
|
-
var zod = require('zod');
|
|
12
|
-
var os = require('os');
|
|
13
|
-
|
|
14
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
15
|
-
// src/internal/providers/registry.ts
|
|
16
|
-
var REGISTRY = chunkNVXXWAU7_cjs.globalSingleton(
|
|
17
|
-
"theokit-sdk.providers.registry",
|
|
18
|
-
() => /* @__PURE__ */ new Map()
|
|
19
|
-
);
|
|
20
|
-
var ALIASES = chunkNVXXWAU7_cjs.globalSingleton("theokit-sdk.providers.aliases", () => /* @__PURE__ */ new Map());
|
|
21
|
-
function registerProvider(profile) {
|
|
22
|
-
if (REGISTRY.has(profile.name)) {
|
|
23
|
-
chunk6LHQPOMI_cjs.diag(`[theokit-sdk] Provider "${profile.name}" overridden by user plugin.
|
|
24
|
-
`);
|
|
25
|
-
}
|
|
26
|
-
REGISTRY.set(profile.name, profile);
|
|
27
|
-
for (const alias of profile.aliases ?? []) {
|
|
28
|
-
const previous = ALIASES.get(alias);
|
|
29
|
-
if (previous !== void 0 && previous !== profile.name) {
|
|
30
|
-
chunk6LHQPOMI_cjs.diag(`[theokit-sdk] Alias "${alias}" collision: was "${previous}", now "${profile.name}".
|
|
31
|
-
`);
|
|
32
|
-
}
|
|
33
|
-
ALIASES.set(alias, profile.name);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function getProviderProfile(name) {
|
|
37
|
-
const canonical = ALIASES.get(name) ?? name;
|
|
38
|
-
return REGISTRY.get(canonical);
|
|
39
|
-
}
|
|
40
|
-
function listProviders() {
|
|
41
|
-
return Array.from(REGISTRY.values());
|
|
42
|
-
}
|
|
43
|
-
var MODALITIES = ["text", "audio", "image", "video", "pdf"];
|
|
44
|
-
var costSchema = zod.z.object({
|
|
45
|
-
/** USD per 1M tokens (models.dev convention). */
|
|
46
|
-
input: zod.z.number().nonnegative(),
|
|
47
|
-
output: zod.z.number().nonnegative(),
|
|
48
|
-
cache_read: zod.z.number().nonnegative().optional(),
|
|
49
|
-
cache_write: zod.z.number().nonnegative().optional()
|
|
50
|
-
}).loose();
|
|
51
|
-
var limitSchema = zod.z.object({
|
|
52
|
-
context: zod.z.number().positive(),
|
|
53
|
-
input: zod.z.number().positive().optional(),
|
|
54
|
-
output: zod.z.number().positive().optional()
|
|
55
|
-
}).loose();
|
|
56
|
-
var modalitiesSchema = zod.z.object({
|
|
57
|
-
input: zod.z.array(zod.z.enum(MODALITIES)).optional(),
|
|
58
|
-
output: zod.z.array(zod.z.enum(MODALITIES)).optional()
|
|
59
|
-
}).loose();
|
|
60
|
-
var catalogModelSchema = zod.z.object({
|
|
61
|
-
name: zod.z.string().optional(),
|
|
62
|
-
release_date: zod.z.string().optional(),
|
|
63
|
-
attachment: zod.z.boolean().optional(),
|
|
64
|
-
reasoning: zod.z.boolean().optional(),
|
|
65
|
-
temperature: zod.z.boolean().optional(),
|
|
66
|
-
tool_call: zod.z.boolean().optional(),
|
|
67
|
-
/** theokit extension — maps to ModelCapabilities.supportsStructuredOutput. */
|
|
68
|
-
structured_output: zod.z.boolean().optional(),
|
|
69
|
-
/** theokit extension — maps to ModelCapabilities.supportsCacheControl. */
|
|
70
|
-
cache_control: zod.z.boolean().optional(),
|
|
71
|
-
cost: costSchema.optional(),
|
|
72
|
-
limit: limitSchema.optional(),
|
|
73
|
-
modalities: modalitiesSchema.optional(),
|
|
74
|
-
status: zod.z.enum(["alpha", "beta", "deprecated"]).optional()
|
|
75
|
-
}).loose();
|
|
76
|
-
var catalogEntrySchema = zod.z.object({
|
|
77
|
-
id: zod.z.string().min(1),
|
|
78
|
-
displayName: zod.z.string().min(1),
|
|
79
|
-
apiMode: zod.z.enum([
|
|
80
|
-
"chat_completions",
|
|
81
|
-
"anthropic_messages",
|
|
82
|
-
"responses_api",
|
|
83
|
-
"bedrock",
|
|
84
|
-
"bedrock_anthropic"
|
|
85
|
-
]),
|
|
86
|
-
authType: zod.z.enum([
|
|
87
|
-
"api_key",
|
|
88
|
-
"oauth_device_code",
|
|
89
|
-
"oauth_external",
|
|
90
|
-
"aws_sdk",
|
|
91
|
-
"aws_bearer",
|
|
92
|
-
"gcp_oauth",
|
|
93
|
-
"none"
|
|
94
|
-
]),
|
|
95
|
-
baseUrl: zod.z.string(),
|
|
96
|
-
envVars: zod.z.array(zod.z.string()),
|
|
97
|
-
fallbackModels: zod.z.array(zod.z.string()),
|
|
98
|
-
capabilities: zod.z.object({
|
|
99
|
-
supportsToolUse: zod.z.boolean(),
|
|
100
|
-
supportsVision: zod.z.boolean(),
|
|
101
|
-
supportsStructuredOutput: zod.z.boolean(),
|
|
102
|
-
supportsStreaming: zod.z.boolean(),
|
|
103
|
-
supportsCacheControl: zod.z.boolean(),
|
|
104
|
-
maxContextTokens: zod.z.number().int().positive().optional(),
|
|
105
|
-
maxOutputTokens: zod.z.number().int().positive().optional()
|
|
106
|
-
}),
|
|
107
|
-
aliases: zod.z.array(zod.z.string()).optional(),
|
|
108
|
-
modelsUrl: zod.z.string().optional(),
|
|
109
|
-
hostname: zod.z.string().optional(),
|
|
110
|
-
extraHeaders: zod.z.record(zod.z.string(), zod.z.string()).optional(),
|
|
111
|
-
models: zod.z.record(zod.z.string(), catalogModelSchema).optional()
|
|
112
|
-
}).loose();
|
|
113
|
-
|
|
114
|
-
// src/internal/providers/catalog-loader.ts
|
|
115
|
-
var __dirname_resolved = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-YRJA2POB.cjs', document.baseURI).href))));
|
|
116
|
-
var modelInfoIndex = chunkNVXXWAU7_cjs.globalSingleton(
|
|
117
|
-
"theokit-sdk.providers.model-info-index",
|
|
118
|
-
() => /* @__PURE__ */ new Map()
|
|
119
|
-
);
|
|
120
|
-
var patchedModelKeys = chunkNVXXWAU7_cjs.globalSingleton(
|
|
121
|
-
"theokit-sdk.providers.model-info-patched",
|
|
122
|
-
() => /* @__PURE__ */ new Set()
|
|
123
|
-
);
|
|
124
|
-
var indexState = chunkNVXXWAU7_cjs.globalSingleton("theokit-sdk.providers.model-info-loaded", () => ({
|
|
125
|
-
loaded: false
|
|
126
|
-
}));
|
|
127
|
-
function getCatalogModelInfo(key) {
|
|
128
|
-
ensureModelIndexLoaded();
|
|
129
|
-
return modelInfoIndex.get(key);
|
|
130
|
-
}
|
|
131
|
-
function isPatchedModelKey(key) {
|
|
132
|
-
return patchedModelKeys.has(key);
|
|
133
|
-
}
|
|
134
|
-
function patchModelInfo(key, model) {
|
|
135
|
-
ensureModelIndexLoaded();
|
|
136
|
-
const existing = modelInfoIndex.get(key);
|
|
137
|
-
modelInfoIndex.set(key, existing === void 0 ? model : { ...existing, ...model });
|
|
138
|
-
patchedModelKeys.add(key);
|
|
139
|
-
}
|
|
140
|
-
function ensureModelIndexLoaded() {
|
|
141
|
-
if (indexState.loaded) return;
|
|
142
|
-
indexState.loaded = true;
|
|
143
|
-
try {
|
|
144
|
-
const catalog = loadProviderCatalog();
|
|
145
|
-
for (const entry of Object.values(catalog)) {
|
|
146
|
-
indexEntryModels(entry);
|
|
147
|
-
}
|
|
148
|
-
} catch (err) {
|
|
149
|
-
chunk6LHQPOMI_cjs.diag(
|
|
150
|
-
`[theokit-sdk] WARN: provider catalog unavailable (${err.message}) \u2014 per-model data disabled
|
|
151
|
-
`
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function indexEntryModels(entry) {
|
|
156
|
-
if (entry.models === void 0 || typeof entry.models !== "object") return;
|
|
157
|
-
for (const [modelId, raw] of Object.entries(entry.models)) {
|
|
158
|
-
const parsed = catalogModelSchema.safeParse(raw);
|
|
159
|
-
if (!parsed.success) {
|
|
160
|
-
chunk6LHQPOMI_cjs.diag(
|
|
161
|
-
`[theokit-sdk] WARN: Skipping malformed catalog model "${entry.id}/${modelId}": ${parsed.error.issues[0]?.message ?? "invalid"}
|
|
162
|
-
`
|
|
163
|
-
);
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
modelInfoIndex.set(`${entry.id}/${modelId}`, parsed.data);
|
|
167
|
-
for (const alias of entry.aliases ?? []) {
|
|
168
|
-
const key = `${alias}/${modelId}`;
|
|
169
|
-
if (!modelInfoIndex.has(key)) modelInfoIndex.set(key, parsed.data);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
function validateEntry(raw) {
|
|
174
|
-
const parsed = catalogEntrySchema.safeParse(raw);
|
|
175
|
-
return parsed.success ? parsed.data : null;
|
|
176
|
-
}
|
|
177
|
-
function loadProviderCatalog(opts) {
|
|
178
|
-
const catalogPath = path.join(__dirname_resolved, "provider-catalog.json");
|
|
179
|
-
const rawText = fs.readFileSync(catalogPath, "utf-8");
|
|
180
|
-
let entries = JSON.parse(rawText);
|
|
181
|
-
if (opts?._testInjectMalformed) {
|
|
182
|
-
entries = [
|
|
183
|
-
...entries,
|
|
184
|
-
{ id: "malformed-provider", displayName: "Bad" }
|
|
185
|
-
];
|
|
186
|
-
}
|
|
187
|
-
const result = {};
|
|
188
|
-
for (const raw of entries) {
|
|
189
|
-
const validated = validateEntry(raw);
|
|
190
|
-
if (validated === null) {
|
|
191
|
-
chunk6LHQPOMI_cjs.diag(
|
|
192
|
-
`[theokit-sdk] WARN: Skipping malformed catalog entry: ${JSON.stringify(raw).slice(0, 100)}
|
|
193
|
-
`
|
|
194
|
-
);
|
|
195
|
-
continue;
|
|
196
|
-
}
|
|
197
|
-
result[validated.id] = validated;
|
|
198
|
-
}
|
|
199
|
-
return result;
|
|
200
|
-
}
|
|
201
|
-
var _capabilitiesCache = null;
|
|
202
|
-
function getCatalogCapabilities(providerId) {
|
|
203
|
-
if (_capabilitiesCache === null) {
|
|
204
|
-
const catalog = loadProviderCatalog();
|
|
205
|
-
_capabilitiesCache = {};
|
|
206
|
-
for (const entry of Object.values(catalog)) {
|
|
207
|
-
_capabilitiesCache[entry.id] = entry.capabilities;
|
|
208
|
-
for (const alias of entry.aliases ?? []) {
|
|
209
|
-
if (_capabilitiesCache[alias] === void 0) _capabilitiesCache[alias] = entry.capabilities;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return _capabilitiesCache[providerId];
|
|
214
|
-
}
|
|
215
|
-
function registerCatalogProviders(opts) {
|
|
216
|
-
const catalog = loadProviderCatalog(opts);
|
|
217
|
-
for (const entry of Object.values(catalog)) {
|
|
218
|
-
if (getProviderProfile(entry.id) !== void 0) continue;
|
|
219
|
-
if (entry.aliases?.some((a) => getProviderProfile(a) !== void 0)) continue;
|
|
220
|
-
const profile = {
|
|
221
|
-
name: entry.id,
|
|
222
|
-
apiMode: entry.apiMode,
|
|
223
|
-
authType: entry.authType,
|
|
224
|
-
baseUrl: entry.baseUrl,
|
|
225
|
-
envVars: entry.envVars,
|
|
226
|
-
fallbackModels: entry.fallbackModels,
|
|
227
|
-
displayName: entry.displayName,
|
|
228
|
-
aliases: entry.aliases,
|
|
229
|
-
modelsUrl: entry.modelsUrl,
|
|
230
|
-
hostname: entry.hostname,
|
|
231
|
-
extraHeaders: entry.extraHeaders
|
|
232
|
-
};
|
|
233
|
-
registerProvider(profile);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// src/internal/providers/builtin/anthropic.ts
|
|
238
|
-
var ANTHROPIC = {
|
|
239
|
-
name: "anthropic",
|
|
240
|
-
apiMode: "anthropic_messages",
|
|
241
|
-
envVars: ["ANTHROPIC_API_KEY"],
|
|
242
|
-
authType: "api_key",
|
|
243
|
-
baseUrl: "https://api.anthropic.com",
|
|
244
|
-
modelsUrl: "https://api.anthropic.com/v1/models",
|
|
245
|
-
hostname: "api.anthropic.com",
|
|
246
|
-
fallbackModels: ["claude-opus-4-7", "claude-sonnet-4-6", "claude-haiku-4-5-20251001"],
|
|
247
|
-
// M45 — the Anthropic beta-features header (interleaved thinking + fine-grained tool streaming). An
|
|
248
|
-
// Anthropic API constant. The
|
|
249
|
-
// SANCTIONED behavior delta of M45 (ADR D4) — consumed by the anthropic transport's extraHeaders wiring.
|
|
250
|
-
extraHeaders: {
|
|
251
|
-
"anthropic-beta": "interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14"
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
// src/internal/providers/builtin/bedrock.ts
|
|
256
|
-
var BEDROCK = {
|
|
257
|
-
name: "bedrock",
|
|
258
|
-
apiMode: "bedrock_anthropic",
|
|
259
|
-
envVars: ["AWS_BEARER_TOKEN_BEDROCK"],
|
|
260
|
-
authType: "aws_bearer",
|
|
261
|
-
baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",
|
|
262
|
-
modelsUrl: void 0,
|
|
263
|
-
hostname: "bedrock-runtime.amazonaws.com",
|
|
264
|
-
fallbackModels: [
|
|
265
|
-
"bedrock/us.anthropic.claude-sonnet-4-5-v1:0",
|
|
266
|
-
"bedrock/us.anthropic.claude-opus-4-7-v1:0",
|
|
267
|
-
"bedrock/global.anthropic.claude-haiku-4-5-v1:0"
|
|
268
|
-
]
|
|
269
|
-
};
|
|
270
|
-
function stripBedrockPrefix(modelId) {
|
|
271
|
-
return modelId.replace(/^bedrock\//, "");
|
|
272
|
-
}
|
|
273
|
-
function inferRegionFromModelId(modelId) {
|
|
274
|
-
const id = stripBedrockPrefix(modelId);
|
|
275
|
-
if (id.startsWith("global.")) return "us-east-1";
|
|
276
|
-
if (id.startsWith("us.")) return process.env.AWS_REGION ?? "us-east-1";
|
|
277
|
-
if (id.startsWith("eu.")) return process.env.AWS_REGION ?? "eu-west-1";
|
|
278
|
-
if (id.startsWith("apac.")) return process.env.AWS_REGION ?? "ap-southeast-1";
|
|
279
|
-
if (id.startsWith("jp.")) return "ap-northeast-1";
|
|
280
|
-
return void 0;
|
|
281
|
-
}
|
|
282
|
-
function resolveBedrockBaseUrl(modelId) {
|
|
283
|
-
const region = inferRegionFromModelId(modelId) ?? process.env.AWS_REGION ?? "us-east-1";
|
|
284
|
-
return `https://bedrock-runtime.${region}.amazonaws.com`;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
// src/internal/providers/builtin/openai-compatible.ts
|
|
288
|
-
function openAiCompatibleProfile(p) {
|
|
289
|
-
return {
|
|
290
|
-
apiMode: "chat_completions",
|
|
291
|
-
authType: "api_key",
|
|
292
|
-
fallbackModels: [],
|
|
293
|
-
...p
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
// src/internal/providers/builtin/cerebras.ts
|
|
298
|
-
var CEREBRAS = openAiCompatibleProfile({
|
|
299
|
-
name: "cerebras",
|
|
300
|
-
baseUrl: "https://api.cerebras.ai/v1",
|
|
301
|
-
envVars: ["CEREBRAS_API_KEY"],
|
|
302
|
-
fallbackModels: ["gpt-oss-120b", "zai-glm-4.7"],
|
|
303
|
-
extraHeaders: { "X-Cerebras-3rd-Party-Integration": "theokit" },
|
|
304
|
-
hostname: "api.cerebras.ai"
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
// src/internal/providers/builtin/cohere.ts
|
|
308
|
-
var COHERE = openAiCompatibleProfile({
|
|
309
|
-
name: "cohere",
|
|
310
|
-
baseUrl: "https://api.cohere.ai/compatibility/v1",
|
|
311
|
-
envVars: ["COHERE_API_KEY", "CO_API_KEY"],
|
|
312
|
-
fallbackModels: ["command-a-03-2025"],
|
|
313
|
-
hostname: "api.cohere.ai"
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
// src/internal/providers/builtin/deepinfra.ts
|
|
317
|
-
var DEEPINFRA = openAiCompatibleProfile({
|
|
318
|
-
name: "deepinfra",
|
|
319
|
-
baseUrl: "https://api.deepinfra.com/v1/openai",
|
|
320
|
-
envVars: ["DEEPINFRA_API_KEY"],
|
|
321
|
-
fallbackModels: ["Qwen/Qwen3-32B"],
|
|
322
|
-
hostname: "api.deepinfra.com"
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
// src/internal/providers/builtin/gemini.ts
|
|
326
|
-
var GEMINI = {
|
|
327
|
-
name: "gemini",
|
|
328
|
-
apiMode: "chat_completions",
|
|
329
|
-
envVars: ["OPENROUTER_API_KEY"],
|
|
330
|
-
authType: "api_key",
|
|
331
|
-
baseUrl: "https://openrouter.ai/api",
|
|
332
|
-
hostname: "openrouter.ai",
|
|
333
|
-
fallbackModels: ["google/gemini-2.0-flash-001"]
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
// src/internal/providers/builtin/google.ts
|
|
337
|
-
var GOOGLE = openAiCompatibleProfile({
|
|
338
|
-
name: "google",
|
|
339
|
-
baseUrl: "https://generativelanguage.googleapis.com/v1beta/openai",
|
|
340
|
-
envVars: ["GOOGLE_API_KEY", "GEMINI_API_KEY", "GOOGLE_GENERATIVE_AI_API_KEY"],
|
|
341
|
-
fallbackModels: ["gemini-2.5-pro", "gemini-2.5-flash"],
|
|
342
|
-
hostname: "generativelanguage.googleapis.com"
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
// src/internal/providers/builtin/groq.ts
|
|
346
|
-
var GROQ = openAiCompatibleProfile({
|
|
347
|
-
name: "groq",
|
|
348
|
-
baseUrl: "https://api.groq.com/openai/v1",
|
|
349
|
-
envVars: ["GROQ_API_KEY"],
|
|
350
|
-
fallbackModels: ["llama-3.3-70b-versatile", "llama-3.1-8b-instant"],
|
|
351
|
-
hostname: "api.groq.com"
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
// src/internal/providers/builtin/llamacpp.ts
|
|
355
|
-
var LLAMACPP = {
|
|
356
|
-
name: "llamacpp",
|
|
357
|
-
aliases: ["llama-cpp", "llama.cpp"],
|
|
358
|
-
apiMode: "chat_completions",
|
|
359
|
-
envVars: ["LLAMACPP_API_KEY"],
|
|
360
|
-
authType: "none",
|
|
361
|
-
baseUrl: "http://localhost:8080",
|
|
362
|
-
modelsUrl: "http://localhost:8080/v1/models",
|
|
363
|
-
hostname: "localhost",
|
|
364
|
-
fallbackModels: ["loaded-model"]
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
// src/internal/providers/builtin/lmstudio.ts
|
|
368
|
-
var LMSTUDIO = {
|
|
369
|
-
name: "lmstudio",
|
|
370
|
-
aliases: ["lm-studio", "lm_studio"],
|
|
371
|
-
apiMode: "chat_completions",
|
|
372
|
-
envVars: ["LMSTUDIO_API_KEY"],
|
|
373
|
-
authType: "none",
|
|
374
|
-
baseUrl: "http://localhost:1234",
|
|
375
|
-
modelsUrl: "http://localhost:1234/v1/models",
|
|
376
|
-
hostname: "localhost",
|
|
377
|
-
fallbackModels: ["loaded-model"]
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
// src/internal/providers/builtin/mistral.ts
|
|
381
|
-
var MISTRAL = openAiCompatibleProfile({
|
|
382
|
-
name: "mistral",
|
|
383
|
-
baseUrl: "https://api.mistral.ai/v1",
|
|
384
|
-
envVars: ["MISTRAL_API_KEY"],
|
|
385
|
-
fallbackModels: ["mistral-large-latest", "codestral-latest"],
|
|
386
|
-
hostname: "api.mistral.ai"
|
|
387
|
-
});
|
|
388
|
-
|
|
389
|
-
// src/internal/providers/builtin/ollama.ts
|
|
390
|
-
var OLLAMA = {
|
|
391
|
-
name: "ollama",
|
|
392
|
-
apiMode: "chat_completions",
|
|
393
|
-
envVars: ["OLLAMA_API_KEY"],
|
|
394
|
-
authType: "none",
|
|
395
|
-
baseUrl: "http://localhost:11434",
|
|
396
|
-
modelsUrl: "http://localhost:11434/v1/models",
|
|
397
|
-
hostname: "localhost",
|
|
398
|
-
fallbackModels: ["llama3.2", "qwen2.5", "mistral"]
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
// src/internal/providers/builtin/openai.ts
|
|
402
|
-
var OPENAI = {
|
|
403
|
-
name: "openai",
|
|
404
|
-
apiMode: "chat_completions",
|
|
405
|
-
envVars: ["OPENAI_API_KEY"],
|
|
406
|
-
authType: "api_key",
|
|
407
|
-
baseUrl: "https://api.openai.com",
|
|
408
|
-
modelsUrl: "https://api.openai.com/v1/models",
|
|
409
|
-
hostname: "api.openai.com",
|
|
410
|
-
fallbackModels: ["gpt-4o", "gpt-4o-mini"]
|
|
411
|
-
};
|
|
412
|
-
var DEFAULT_STORE = {
|
|
413
|
-
home: os.homedir(),
|
|
414
|
-
dirName: ".theokit",
|
|
415
|
-
fileName: "auth.json",
|
|
416
|
-
homeEnvVar: "THEOKIT_AUTH_HOME"
|
|
417
|
-
};
|
|
418
|
-
var OPENAI_OAUTH_CONFIG = {
|
|
419
|
-
provider: "openai",
|
|
420
|
-
authorizeEndpoint: "https://auth.openai.com/oauth/authorize",
|
|
421
|
-
tokenEndpoint: "https://auth.openai.com/oauth/token",
|
|
422
|
-
clientId: "app_EMoamEEZ73f0CkXaXp7hrann",
|
|
423
|
-
scopes: ["openid", "profile", "email", "offline_access"],
|
|
424
|
-
redirectUri: "https://auth.openai.com/deviceauth/callback"
|
|
425
|
-
};
|
|
426
|
-
function codexFetch() {
|
|
427
|
-
return (async (input, init) => {
|
|
428
|
-
const env = process.env;
|
|
429
|
-
const resolved = await chunkRA7IE4NK_cjs.resolveCredential({
|
|
430
|
-
provider: "openai",
|
|
431
|
-
store: DEFAULT_STORE,
|
|
432
|
-
oauth: OPENAI_OAUTH_CONFIG,
|
|
433
|
-
env
|
|
434
|
-
});
|
|
435
|
-
if (resolved === void 0) {
|
|
436
|
-
throw new chunkUNFBHV46_cjs.AuthenticationError(
|
|
437
|
-
'openai-chatgpt: no ChatGPT credential found \u2014 run the OpenAI device login (e.g. "/login openai") first.',
|
|
438
|
-
{ code: "missing_credential" }
|
|
439
|
-
);
|
|
440
|
-
}
|
|
441
|
-
const accountId = chunkNAGPKWOD_cjs.readStoredOAuth(DEFAULT_STORE, env)?.account_id;
|
|
442
|
-
const headers = new Headers(init?.headers);
|
|
443
|
-
headers.set("authorization", `Bearer ${resolved.apiKey}`);
|
|
444
|
-
if (accountId !== void 0) headers.set("ChatGPT-Account-Id", accountId);
|
|
445
|
-
return fetch(input, { ...init, headers });
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
var OPENAI_CHATGPT = {
|
|
449
|
-
name: "openai-chatgpt",
|
|
450
|
-
apiMode: "responses_api",
|
|
451
|
-
authType: "oauth_device_code",
|
|
452
|
-
baseUrl: "https://chatgpt.com/backend-api/codex",
|
|
453
|
-
envVars: [],
|
|
454
|
-
fallbackModels: [
|
|
455
|
-
"openai-chatgpt/gpt-5.4",
|
|
456
|
-
"openai-chatgpt/gpt-5.4-mini",
|
|
457
|
-
"openai-chatgpt/gpt-5.5"
|
|
458
|
-
],
|
|
459
|
-
// #165 — this shipped as `codex_cli_rs`, another vendor's client identifier. Claiming to be a different
|
|
460
|
-
// vendor's client is a false statement of identity. Third-party clients send their OWN name against
|
|
461
|
-
// this same endpoint, which also shows the route is not restricted to the official client.
|
|
462
|
-
extraHeaders: { originator: "theokit" },
|
|
463
|
-
// usetheokit/theokit-sdk#383 — carry the model's encrypted reasoning between the rounds of a turn.
|
|
464
|
-
// On for THIS profile and no other because this is the endpoint the issue measured: OpenAI Codex
|
|
465
|
-
// sends `include: ["reasoning.encrypted_content"]` with `reasoning.context: "all_turns"` to the
|
|
466
|
-
// same backend, same model, on the same account, so acceptance is observed rather than assumed.
|
|
467
|
-
// The issue's measurement — a third of our bytes, 2.8x our tokens — is what this closes together
|
|
468
|
-
// with `prompt_cache_key`.
|
|
469
|
-
encryptedReasoning: true,
|
|
470
|
-
transform: {
|
|
471
|
-
// Only `fetch` (async) can await the credential refresh; `headers` is sync and cannot.
|
|
472
|
-
fetch: () => codexFetch()
|
|
473
|
-
}
|
|
474
|
-
};
|
|
475
|
-
|
|
476
|
-
// src/internal/providers/builtin/openrouter.ts
|
|
477
|
-
var OPENROUTER = {
|
|
478
|
-
name: "openrouter",
|
|
479
|
-
apiMode: "chat_completions",
|
|
480
|
-
aliases: ["or"],
|
|
481
|
-
// Ordered fallback (EC-10): OPENROUTER_API_KEY preferred, OPENAI_API_KEY as compat.
|
|
482
|
-
envVars: ["OPENROUTER_API_KEY", "OPENAI_API_KEY"],
|
|
483
|
-
authType: "api_key",
|
|
484
|
-
baseUrl: "https://openrouter.ai/api",
|
|
485
|
-
modelsUrl: "https://openrouter.ai/api/v1/models",
|
|
486
|
-
hostname: "openrouter.ai",
|
|
487
|
-
// M45 — models refreshed (claude-3-haiku retired upstream).
|
|
488
|
-
fallbackModels: ["openai/gpt-4o-mini", "anthropic/claude-haiku-4-5"],
|
|
489
|
-
// M45 — OpenRouter app-attribution headers. VALUES are
|
|
490
|
-
// theokit's own — copying another app's referer would misattribute traffic).
|
|
491
|
-
extraHeaders: { "HTTP-Referer": "https://usetheo.dev", "X-Title": "theokit" }
|
|
492
|
-
};
|
|
493
|
-
|
|
494
|
-
// src/internal/providers/builtin/perplexity.ts
|
|
495
|
-
var PERPLEXITY = openAiCompatibleProfile({
|
|
496
|
-
name: "perplexity",
|
|
497
|
-
baseUrl: "https://api.perplexity.ai",
|
|
498
|
-
chatCompletionsPath: "/chat/completions",
|
|
499
|
-
envVars: ["PERPLEXITY_API_KEY"],
|
|
500
|
-
fallbackModels: ["sonar-pro", "sonar"],
|
|
501
|
-
hostname: "api.perplexity.ai"
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
// src/internal/providers/builtin/together.ts
|
|
505
|
-
var TOGETHER = openAiCompatibleProfile({
|
|
506
|
-
name: "together",
|
|
507
|
-
aliases: ["togetherai"],
|
|
508
|
-
baseUrl: "https://api.together.xyz/v1",
|
|
509
|
-
envVars: ["TOGETHER_API_KEY"],
|
|
510
|
-
fallbackModels: ["Qwen/Qwen2.5-7B-Instruct-Turbo"],
|
|
511
|
-
hostname: "api.together.xyz"
|
|
512
|
-
});
|
|
513
|
-
|
|
514
|
-
// src/internal/providers/builtin/vertex.ts
|
|
515
|
-
var VERTEX = {
|
|
516
|
-
name: "vertex",
|
|
517
|
-
apiMode: "anthropic_messages",
|
|
518
|
-
// sub-dispatched in selectTransport by profile.name
|
|
519
|
-
envVars: ["GOOGLE_APPLICATION_CREDENTIALS"],
|
|
520
|
-
authType: "gcp_oauth",
|
|
521
|
-
baseUrl: "https://us-central1-aiplatform.googleapis.com",
|
|
522
|
-
modelsUrl: void 0,
|
|
523
|
-
hostname: "aiplatform.googleapis.com",
|
|
524
|
-
fallbackModels: [
|
|
525
|
-
"vertex/anthropic/claude-sonnet-4-5@20250929",
|
|
526
|
-
"vertex/google/gemini-2.0-flash-001"
|
|
527
|
-
]
|
|
528
|
-
};
|
|
529
|
-
function resolveVertexBaseUrl(opts) {
|
|
530
|
-
const host = opts.location === "global" ? "aiplatform.googleapis.com" : `${opts.location}-aiplatform.googleapis.com`;
|
|
531
|
-
if (opts.modelDialect === "gemini") {
|
|
532
|
-
return `https://${host}/v1/projects/${opts.projectId}/locations/${opts.location}/endpoints/openapi`;
|
|
533
|
-
}
|
|
534
|
-
return `https://${host}/v1/projects/${opts.projectId}/locations/${opts.location}/publishers/anthropic`;
|
|
535
|
-
}
|
|
536
|
-
function inferModelDialect(modelId) {
|
|
537
|
-
if (modelId.includes("/anthropic/")) return "anthropic";
|
|
538
|
-
if (modelId.includes("/google/")) return "gemini";
|
|
539
|
-
return "gemini";
|
|
540
|
-
}
|
|
541
|
-
function stripVertexPrefix(modelId) {
|
|
542
|
-
return modelId.replace(/^vertex\/(anthropic|google)\//, "");
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
// src/internal/providers/builtin/xai.ts
|
|
546
|
-
var XAI = openAiCompatibleProfile({
|
|
547
|
-
name: "xai",
|
|
548
|
-
aliases: ["grok"],
|
|
549
|
-
baseUrl: "https://api.x.ai/v1",
|
|
550
|
-
envVars: ["XAI_API_KEY"],
|
|
551
|
-
fallbackModels: ["grok-4.5", "grok-4.3"],
|
|
552
|
-
hostname: "api.x.ai"
|
|
553
|
-
});
|
|
554
|
-
|
|
555
|
-
// src/internal/providers/builtin/index.ts
|
|
556
|
-
var _registeredState = chunkNVXXWAU7_cjs.globalSingleton("theokit-sdk.providers.builtins-registered", () => ({
|
|
557
|
-
done: false
|
|
558
|
-
}));
|
|
559
|
-
function registerBuiltins() {
|
|
560
|
-
if (_registeredState.done) return;
|
|
561
|
-
_registeredState.done = true;
|
|
562
|
-
registerProvider(ANTHROPIC);
|
|
563
|
-
registerProvider(OPENAI);
|
|
564
|
-
registerProvider(OPENAI_CHATGPT);
|
|
565
|
-
registerProvider(OPENROUTER);
|
|
566
|
-
registerProvider(GEMINI);
|
|
567
|
-
registerProvider(OLLAMA);
|
|
568
|
-
registerProvider(LMSTUDIO);
|
|
569
|
-
registerProvider(LLAMACPP);
|
|
570
|
-
registerProvider(BEDROCK);
|
|
571
|
-
registerProvider(VERTEX);
|
|
572
|
-
registerProvider(GOOGLE);
|
|
573
|
-
registerProvider(MISTRAL);
|
|
574
|
-
registerProvider(GROQ);
|
|
575
|
-
registerProvider(COHERE);
|
|
576
|
-
registerProvider(DEEPINFRA);
|
|
577
|
-
registerProvider(TOGETHER);
|
|
578
|
-
registerProvider(XAI);
|
|
579
|
-
registerProvider(PERPLEXITY);
|
|
580
|
-
registerProvider(CEREBRAS);
|
|
581
|
-
registerCatalogProviders();
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
exports.catalogModelSchema = catalogModelSchema;
|
|
585
|
-
exports.getCatalogCapabilities = getCatalogCapabilities;
|
|
586
|
-
exports.getCatalogModelInfo = getCatalogModelInfo;
|
|
587
|
-
exports.getProviderProfile = getProviderProfile;
|
|
588
|
-
exports.inferModelDialect = inferModelDialect;
|
|
589
|
-
exports.inferRegionFromModelId = inferRegionFromModelId;
|
|
590
|
-
exports.isPatchedModelKey = isPatchedModelKey;
|
|
591
|
-
exports.listProviders = listProviders;
|
|
592
|
-
exports.loadProviderCatalog = loadProviderCatalog;
|
|
593
|
-
exports.patchModelInfo = patchModelInfo;
|
|
594
|
-
exports.registerBuiltins = registerBuiltins;
|
|
595
|
-
exports.registerProvider = registerProvider;
|
|
596
|
-
exports.resolveBedrockBaseUrl = resolveBedrockBaseUrl;
|
|
597
|
-
exports.resolveVertexBaseUrl = resolveVertexBaseUrl;
|
|
598
|
-
exports.stripBedrockPrefix = stripBedrockPrefix;
|
|
599
|
-
exports.stripVertexPrefix = stripVertexPrefix;
|
|
600
|
-
//# sourceMappingURL=chunk-YRJA2POB.cjs.map
|
|
601
|
-
//# sourceMappingURL=chunk-YRJA2POB.cjs.map
|