@theokit/sdk 4.39.2 → 4.39.4
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 +40 -0
- package/dist/{agent-TOWHPM7B.cjs → agent-DB245YMC.cjs} +9 -9
- package/dist/{agent-TOWHPM7B.cjs.map → agent-DB245YMC.cjs.map} +1 -1
- package/dist/{agent-KGKKAGXY.js → agent-UNWZCXBS.js} +8 -8
- package/dist/{agent-KGKKAGXY.js.map → agent-UNWZCXBS.js.map} +1 -1
- package/dist/{chunk-AFJAQ5JV.js → chunk-23HI77BZ.js} +8 -3
- package/dist/chunk-23HI77BZ.js.map +1 -0
- package/dist/{chunk-RTDT2UMT.js → chunk-5VKUZ26Q.js} +22 -7
- package/dist/chunk-5VKUZ26Q.js.map +1 -0
- package/dist/{chunk-TZ47DTM2.cjs → chunk-KV3HR7KL.cjs} +5 -5
- package/dist/{chunk-TZ47DTM2.cjs.map → chunk-KV3HR7KL.cjs.map} +1 -1
- package/dist/{chunk-Z5DYGBPV.cjs → chunk-N4JNY5DT.cjs} +3 -3
- package/dist/{chunk-Z5DYGBPV.cjs.map → chunk-N4JNY5DT.cjs.map} +1 -1
- package/dist/{chunk-7HP6N5X3.js → chunk-ONVIALVV.js} +3 -3
- package/dist/{chunk-7HP6N5X3.js.map → chunk-ONVIALVV.js.map} +1 -1
- package/dist/{chunk-MDN44YMZ.js → chunk-P3ZVI46Y.js} +3 -3
- package/dist/{chunk-MDN44YMZ.js.map → chunk-P3ZVI46Y.js.map} +1 -1
- package/dist/{chunk-LR3VKB7A.cjs → chunk-SEWAPWAF.cjs} +20 -20
- package/dist/{chunk-LR3VKB7A.cjs.map → chunk-SEWAPWAF.cjs.map} +1 -1
- package/dist/{chunk-ERBH54V3.js → chunk-SGGH3B2W.js} +10 -10
- package/dist/{chunk-ERBH54V3.js.map → chunk-SGGH3B2W.js.map} +1 -1
- package/dist/{chunk-AYDSWY35.cjs → chunk-SHQEZ6Q2.cjs} +55 -55
- package/dist/{chunk-AYDSWY35.cjs.map → chunk-SHQEZ6Q2.cjs.map} +1 -1
- package/dist/{chunk-UDSGSPUY.cjs → chunk-T6KFGMNY.cjs} +9 -4
- package/dist/chunk-T6KFGMNY.cjs.map +1 -0
- package/dist/{chunk-MWVLE5RY.cjs → chunk-WMWZAJMJ.cjs} +5 -5
- package/dist/{chunk-MWVLE5RY.cjs.map → chunk-WMWZAJMJ.cjs.map} +1 -1
- package/dist/{chunk-RMO7HAIF.js → chunk-X627TO3A.js} +3 -3
- package/dist/{chunk-RMO7HAIF.js.map → chunk-X627TO3A.js.map} +1 -1
- package/dist/{chunk-7WXT5M6P.js → chunk-XRKFWV7K.js} +3 -3
- package/dist/{chunk-7WXT5M6P.js.map → chunk-XRKFWV7K.js.map} +1 -1
- package/dist/{chunk-JERO4TP6.cjs → chunk-ZVQJHY4Y.cjs} +22 -7
- package/dist/chunk-ZVQJHY4Y.cjs.map +1 -0
- package/dist/{compact-session-KPYRNTQN.js → compact-session-AZU2LEAE.js} +4 -4
- package/dist/{compact-session-KPYRNTQN.js.map → compact-session-AZU2LEAE.js.map} +1 -1
- package/dist/{compact-session-FCEFK2CG.cjs → compact-session-TRCEYCPG.cjs} +12 -12
- package/dist/{compact-session-FCEFK2CG.cjs.map → compact-session-TRCEYCPG.cjs.map} +1 -1
- package/dist/cron.cjs +8 -8
- package/dist/cron.js +7 -7
- package/dist/eval.cjs +11 -11
- package/dist/eval.js +7 -7
- package/dist/fs-session-store-I6GUIFRO.js +10 -0
- package/dist/{fs-session-store-YPZIOLJM.js.map → fs-session-store-I6GUIFRO.js.map} +1 -1
- package/dist/{fs-session-store-V32XJ63Z.cjs → fs-session-store-KRZZIG3O.cjs} +5 -5
- package/dist/{fs-session-store-V32XJ63Z.cjs.map → fs-session-store-KRZZIG3O.cjs.map} +1 -1
- package/dist/index.cjs +38 -38
- package/dist/index.js +9 -9
- package/dist/{inject-session-BIVVFWGL.cjs → inject-session-BVSERZCI.cjs} +4 -4
- package/dist/{inject-session-BIVVFWGL.cjs.map → inject-session-BVSERZCI.cjs.map} +1 -1
- package/dist/{inject-session-OLWZ2NJN.js → inject-session-E75EP3LL.js} +3 -3
- package/dist/{inject-session-OLWZ2NJN.js.map → inject-session-E75EP3LL.js.map} +1 -1
- package/dist/internal/persistence/index.cjs +6 -6
- package/dist/internal/persistence/index.js +1 -1
- package/dist/models.cjs +9 -9
- package/dist/models.js +1 -1
- package/dist/persistence.cjs +6 -6
- package/dist/persistence.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AFJAQ5JV.js.map +0 -1
- package/dist/chunk-JERO4TP6.cjs.map +0 -1
- package/dist/chunk-RTDT2UMT.js.map +0 -1
- package/dist/chunk-UDSGSPUY.cjs.map +0 -1
- package/dist/fs-session-store-YPZIOLJM.js +0 -10
|
@@ -6,7 +6,7 @@ var chunkU53AYSHS_cjs = require('./chunk-U53AYSHS.cjs');
|
|
|
6
6
|
var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
|
|
7
7
|
var chunkNJVV5OAV_cjs = require('./chunk-NJVV5OAV.cjs');
|
|
8
8
|
var chunkOVGNXGCK_cjs = require('./chunk-OVGNXGCK.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunkT6KFGMNY_cjs = require('./chunk-T6KFGMNY.cjs');
|
|
10
10
|
var chunkE7WWIX34_cjs = require('./chunk-E7WWIX34.cjs');
|
|
11
11
|
var chunkA76OFN2B_cjs = require('./chunk-A76OFN2B.cjs');
|
|
12
12
|
var fs = require('fs');
|
|
@@ -17,7 +17,7 @@ var url = require('url');
|
|
|
17
17
|
var module$1 = require('module');
|
|
18
18
|
|
|
19
19
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
20
|
-
var discoveryState =
|
|
20
|
+
var discoveryState = chunkT6KFGMNY_cjs.globalSingleton("theokit-sdk.providers.discovered", () => ({
|
|
21
21
|
done: false
|
|
22
22
|
}));
|
|
23
23
|
function pluginsRoot() {
|
|
@@ -96,7 +96,7 @@ async function loadOne(dir, entryName) {
|
|
|
96
96
|
if (plugin !== null && typeof plugin === "object" && plugin.kind === "model-provider") {
|
|
97
97
|
const profile = plugin.profile;
|
|
98
98
|
if (profile !== void 0 && typeof profile === "object") {
|
|
99
|
-
|
|
99
|
+
chunkT6KFGMNY_cjs.registerProvider(profile);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
return;
|
|
@@ -739,7 +739,7 @@ async function resolveBedrockToken(region) {
|
|
|
739
739
|
return cachedToken.value;
|
|
740
740
|
}
|
|
741
741
|
try {
|
|
742
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
742
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-SEWAPWAF.cjs', document.baseURI).href)));
|
|
743
743
|
const gen = r("@aws/bedrock-token-generator");
|
|
744
744
|
if (typeof gen.getToken !== "function") return void 0;
|
|
745
745
|
const providers = r("@aws-sdk/credential-providers");
|
|
@@ -773,10 +773,10 @@ var BedrockAnthropicClient = class {
|
|
|
773
773
|
);
|
|
774
774
|
}
|
|
775
775
|
async *stream(request, signal) {
|
|
776
|
-
const region =
|
|
776
|
+
const region = chunkT6KFGMNY_cjs.inferRegionFromModelId(request.model) ?? process.env.AWS_REGION ?? "us-east-1";
|
|
777
777
|
const token = await this.resolveTokenOrThrow(region);
|
|
778
|
-
const bareModel =
|
|
779
|
-
const baseUrl = this.options.baseUrl ??
|
|
778
|
+
const bareModel = chunkT6KFGMNY_cjs.stripBedrockPrefix(request.model);
|
|
779
|
+
const baseUrl = this.options.baseUrl ?? chunkT6KFGMNY_cjs.resolveBedrockBaseUrl(request.model);
|
|
780
780
|
const endpoint = `/model/${encodeURIComponent(bareModel)}/invoke`;
|
|
781
781
|
const url = `${baseUrl}${endpoint}`;
|
|
782
782
|
const response = await postAnthropicRequest({
|
|
@@ -2403,7 +2403,7 @@ async function resolveVertexAccessToken() {
|
|
|
2403
2403
|
async function getAuthClientOrThrow() {
|
|
2404
2404
|
let mod;
|
|
2405
2405
|
try {
|
|
2406
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
2406
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-SEWAPWAF.cjs', document.baseURI).href)));
|
|
2407
2407
|
mod = r("google-auth-library");
|
|
2408
2408
|
} catch (err) {
|
|
2409
2409
|
const isModuleMissing = err instanceof Error && (err.message.includes("Cannot find module") || err.code === "MODULE_NOT_FOUND");
|
|
@@ -2464,8 +2464,8 @@ var VertexAnthropicClient = class {
|
|
|
2464
2464
|
const projectId = this.resolveProjectOrThrow();
|
|
2465
2465
|
const location = this.options.location ?? resolveVertexLocation();
|
|
2466
2466
|
const accessToken = await this.resolveTokenOrThrow();
|
|
2467
|
-
const baseUrl =
|
|
2468
|
-
const bareModel =
|
|
2467
|
+
const baseUrl = chunkT6KFGMNY_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "anthropic" });
|
|
2468
|
+
const bareModel = chunkT6KFGMNY_cjs.stripVertexPrefix(request.model);
|
|
2469
2469
|
const endpoint = `/models/${encodeURIComponent(bareModel)}:rawPredict`;
|
|
2470
2470
|
const url = `${baseUrl}${endpoint}`;
|
|
2471
2471
|
const response = await postAnthropicRequest({
|
|
@@ -2514,7 +2514,7 @@ var VertexGeminiClient = class {
|
|
|
2514
2514
|
{ code: "auth_failed" }
|
|
2515
2515
|
);
|
|
2516
2516
|
}
|
|
2517
|
-
const baseUrl =
|
|
2517
|
+
const baseUrl = chunkT6KFGMNY_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "gemini" });
|
|
2518
2518
|
const url = `${baseUrl}/chat/completions`;
|
|
2519
2519
|
const innerFetch = this.options.fetch ?? fetch;
|
|
2520
2520
|
const rewriteFetch = (input, init) => {
|
|
@@ -2540,7 +2540,7 @@ var VertexRouterClient = class {
|
|
|
2540
2540
|
options;
|
|
2541
2541
|
name = "vertex";
|
|
2542
2542
|
async *stream(request, signal) {
|
|
2543
|
-
const dialect =
|
|
2543
|
+
const dialect = chunkT6KFGMNY_cjs.inferModelDialect(request.model);
|
|
2544
2544
|
if (dialect === "anthropic") {
|
|
2545
2545
|
const inner2 = new VertexAnthropicClient(this.options);
|
|
2546
2546
|
return yield* inner2.stream(request, signal);
|
|
@@ -2552,7 +2552,7 @@ var VertexRouterClient = class {
|
|
|
2552
2552
|
|
|
2553
2553
|
// src/internal/llm/router.ts
|
|
2554
2554
|
function resolveProviderChain(options) {
|
|
2555
|
-
|
|
2555
|
+
chunkT6KFGMNY_cjs.registerBuiltins();
|
|
2556
2556
|
return buildChain(options);
|
|
2557
2557
|
}
|
|
2558
2558
|
function buildChain(options) {
|
|
@@ -2577,7 +2577,7 @@ function buildChain(options) {
|
|
|
2577
2577
|
return clients;
|
|
2578
2578
|
}
|
|
2579
2579
|
function buildClient(name, routerOptions) {
|
|
2580
|
-
const baseProfile =
|
|
2580
|
+
const baseProfile = chunkT6KFGMNY_cjs.getProviderProfile(name);
|
|
2581
2581
|
if (baseProfile === void 0) return void 0;
|
|
2582
2582
|
const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
|
|
2583
2583
|
const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
|
|
@@ -2674,7 +2674,7 @@ function warnUnknownProvidersInApiKeys(apiKeys) {
|
|
|
2674
2674
|
if (apiKeys === void 0) return;
|
|
2675
2675
|
for (const name of Object.keys(apiKeys)) {
|
|
2676
2676
|
if (warnedProviders.has(name)) continue;
|
|
2677
|
-
const profile =
|
|
2677
|
+
const profile = chunkT6KFGMNY_cjs.getProviderProfile(name);
|
|
2678
2678
|
if (profile === void 0) {
|
|
2679
2679
|
warnedProviders.add(name);
|
|
2680
2680
|
chunkA76OFN2B_cjs.diag(
|
|
@@ -2775,7 +2775,7 @@ function inferProviderFromApiKey(apiKey) {
|
|
|
2775
2775
|
{ provider: "openai", prefix: "sk-" }
|
|
2776
2776
|
];
|
|
2777
2777
|
for (const { provider, prefix } of byPrefix) {
|
|
2778
|
-
if (apiKey.startsWith(prefix) &&
|
|
2778
|
+
if (apiKey.startsWith(prefix) && chunkT6KFGMNY_cjs.getProviderProfile(provider) !== void 0) {
|
|
2779
2779
|
return provider;
|
|
2780
2780
|
}
|
|
2781
2781
|
}
|
|
@@ -2963,9 +2963,9 @@ function resolveSummarizerRoute(opts) {
|
|
|
2963
2963
|
}
|
|
2964
2964
|
function buildDefaultSummarizer(opts) {
|
|
2965
2965
|
return async (messages) => {
|
|
2966
|
-
|
|
2966
|
+
chunkT6KFGMNY_cjs.registerBuiltins();
|
|
2967
2967
|
const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
|
|
2968
|
-
const prefixProfile = modelPrefix !== void 0 ?
|
|
2968
|
+
const prefixProfile = modelPrefix !== void 0 ? chunkT6KFGMNY_cjs.getProviderProfile(modelPrefix) : void 0;
|
|
2969
2969
|
const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
|
|
2970
2970
|
const route = resolveSummarizerRoute({
|
|
2971
2971
|
keyProvider: inferProviderFromApiKey(opts.apiKey),
|
|
@@ -3067,5 +3067,5 @@ exports.shouldAutoCompact = shouldAutoCompact;
|
|
|
3067
3067
|
exports.shouldUseFixtureMode = shouldUseFixtureMode;
|
|
3068
3068
|
exports.shouldUseRealLocalRuntime = shouldUseRealLocalRuntime;
|
|
3069
3069
|
exports.tryFirstEvent = tryFirstEvent;
|
|
3070
|
-
//# sourceMappingURL=chunk-
|
|
3071
|
-
//# sourceMappingURL=chunk-
|
|
3070
|
+
//# sourceMappingURL=chunk-SEWAPWAF.cjs.map
|
|
3071
|
+
//# sourceMappingURL=chunk-SEWAPWAF.cjs.map
|