@theokit/sdk 5.9.0 → 5.9.2
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 +100 -0
- package/dist/{agent-6STOEBGQ.js → agent-GZVZXKME.js} +18 -17
- package/dist/{agent-6STOEBGQ.js.map → agent-GZVZXKME.js.map} +1 -1
- package/dist/{agent-ZM4FDDL7.cjs → agent-WQ4LLTSY.cjs} +19 -18
- package/dist/{agent-ZM4FDDL7.cjs.map → agent-WQ4LLTSY.cjs.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-TC4RWP3Y.js → chunk-47Z6LP3I.js} +3 -3
- package/dist/{chunk-TC4RWP3Y.js.map → chunk-47Z6LP3I.js.map} +1 -1
- package/dist/{chunk-DDRX4LYS.js → chunk-7QJYKVP6.js} +3 -3
- package/dist/{chunk-DDRX4LYS.js.map → chunk-7QJYKVP6.js.map} +1 -1
- package/dist/{chunk-TTBIQTO5.cjs → chunk-DLUCTZ56.cjs} +15 -15
- package/dist/{chunk-TTBIQTO5.cjs.map → chunk-DLUCTZ56.cjs.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-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-BM6PDJW3.cjs → chunk-JU76WCW7.cjs} +113 -112
- package/dist/chunk-JU76WCW7.cjs.map +1 -0
- package/dist/{chunk-J4SA2ZEJ.cjs → chunk-KIKKTW5O.cjs} +4 -4
- package/dist/{chunk-J4SA2ZEJ.cjs.map → chunk-KIKKTW5O.cjs.map} +1 -1
- package/dist/{chunk-5WR33BHA.cjs → chunk-KXKT3HSD.cjs} +4 -4
- package/dist/{chunk-5WR33BHA.cjs.map → chunk-KXKT3HSD.cjs.map} +1 -1
- package/dist/{chunk-UKBBYVNS.js → chunk-M2CCHC66.js} +3 -3
- package/dist/{chunk-UKBBYVNS.js.map → chunk-M2CCHC66.js.map} +1 -1
- package/dist/{chunk-OCEQ6DW2.cjs → chunk-N6OEX5TN.cjs} +2 -2
- package/dist/chunk-N6OEX5TN.cjs.map +1 -0
- package/dist/{chunk-QDQQYRJI.js → chunk-N7KYUNFO.js} +3 -3
- package/dist/{chunk-QDQQYRJI.js.map → chunk-N7KYUNFO.js.map} +1 -1
- package/dist/{chunk-7GDHFV2M.js → chunk-OPAKPEPG.js} +2 -2
- package/dist/chunk-OPAKPEPG.js.map +1 -0
- package/dist/{chunk-UNZOJVVC.js → chunk-OZLQ6ZFM.js} +3 -3
- package/dist/{chunk-UNZOJVVC.js.map → chunk-OZLQ6ZFM.js.map} +1 -1
- package/dist/{chunk-PYFBS6OQ.js → chunk-PEIV7LOU.js} +22 -21
- package/dist/chunk-PEIV7LOU.js.map +1 -0
- 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-B3XXQX6L.cjs → chunk-RX3CFWQ2.cjs} +6 -6
- package/dist/{chunk-B3XXQX6L.cjs.map → chunk-RX3CFWQ2.cjs.map} +1 -1
- 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-76PIKR4P.cjs → chunk-VZ2JZ2EH.cjs} +5 -5
- package/dist/{chunk-76PIKR4P.cjs.map → chunk-VZ2JZ2EH.cjs.map} +1 -1
- package/dist/{chunk-T5KOSR5Y.cjs → chunk-X7Z2FEI7.cjs} +8 -8
- package/dist/{chunk-T5KOSR5Y.cjs.map → chunk-X7Z2FEI7.cjs.map} +1 -1
- 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-KTA7YTZQ.cjs → chunk-XKZFIP7Z.cjs} +4 -4
- package/dist/{chunk-KTA7YTZQ.cjs.map → chunk-XKZFIP7Z.cjs.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-R2C3HXR3.js → chunk-ZDF2IJKC.js} +3 -3
- package/dist/{chunk-R2C3HXR3.js.map → chunk-ZDF2IJKC.js.map} +1 -1
- package/dist/{chunk-PQCTDMUI.js → chunk-ZHWKT2NI.js} +3 -3
- package/dist/{chunk-PQCTDMUI.js.map → chunk-ZHWKT2NI.js.map} +1 -1
- 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/context/index.cjs +6 -6
- package/dist/context/index.js +3 -3
- package/dist/context-3FZRAO5K.js +7 -0
- package/dist/{context-SXR2HLHT.js.map → context-3FZRAO5K.js.map} +1 -1
- package/dist/{context-ZOULM2RB.cjs → context-B5J4GX2F.cjs} +7 -7
- package/dist/{context-ZOULM2RB.cjs.map → context-B5J4GX2F.cjs.map} +1 -1
- package/dist/cron.cjs +18 -17
- package/dist/cron.js +17 -16
- package/dist/eval.cjs +17 -16
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +16 -15
- package/dist/eval.js.map +1 -1
- package/dist/fs-session-store-LCZBM3LT.js +10 -0
- package/dist/{fs-session-store-STZZFXH2.js.map → fs-session-store-LCZBM3LT.js.map} +1 -1
- package/dist/{fs-session-store-JHBJFKVV.cjs → fs-session-store-SVEMRE4K.cjs} +5 -5
- package/dist/{fs-session-store-JHBJFKVV.cjs.map → fs-session-store-SVEMRE4K.cjs.map} +1 -1
- package/dist/{index-manager-ONQJSWX5.js → index-manager-6B2UF5S3.js} +5 -5
- package/dist/{index-manager-ONQJSWX5.js.map → index-manager-6B2UF5S3.js.map} +1 -1
- package/dist/{index-manager-ZGJN25FD.cjs → index-manager-M3FHJCHQ.cjs} +6 -6
- package/dist/{index-manager-ZGJN25FD.cjs.map → index-manager-M3FHJCHQ.cjs.map} +1 -1
- package/dist/index.cjs +58 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -3
- package/dist/index.d.ts +30 -3
- package/dist/index.js +21 -20
- 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/storage/index.cjs +32 -32
- package/dist/internal/memory/storage/index.js +3 -3
- 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/hooks/hooks-source.d.ts +24 -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 +7 -7
- package/dist/persistence.js +2 -2
- 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/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/docs/error-codes.md +16 -16
- 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-7GDHFV2M.js.map +0 -1
- package/dist/chunk-ARMFXTY6.cjs.map +0 -1
- package/dist/chunk-BM6PDJW3.cjs.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-OCEQ6DW2.cjs.map +0 -1
- package/dist/chunk-PYFBS6OQ.js.map +0 -1
- package/dist/chunk-R3ZQBPA5.cjs +0 -18
- package/dist/chunk-RA7IE4NK.cjs.map +0 -1
- package/dist/chunk-YRJA2POB.cjs +0 -601
- package/dist/chunk-YRJA2POB.cjs.map +0 -1
- package/dist/context-SXR2HLHT.js +0 -7
- package/dist/fs-session-store-STZZFXH2.js +0 -10
- package/dist/provider-catalog.json +0 -1295
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/internal/runtime-fetch.ts"],"names":[],"mappings":";AAiCO,SAAS,WAAW,QAAA,EAAuC;AAChE,EAAA,OAAO,QAAA,IAAY,UAAA,CAAW,KAAA,CAAM,IAAA,CAAK,UAAU,CAAA;AACrD","file":"chunk-Q7GYMXVC.js","sourcesContent":["/**\n * The global `fetch`, bound to its own receiver.\n *\n * ## Why this exists\n *\n * `this.fetchImpl = options.fetch ?? fetch` detaches the global. Node's undici tolerates that;\n * **workerd does not** — calling the reference as a property of another object, or as a bare function\n * in a module where `this` is `undefined`, throws:\n *\n * Illegal invocation: function called with incorrect `this` reference.\n *\n * Measured on 2026-09-28, on a real Cloudflare deploy, after two filesystem defects in this package\n * had been cleared and the turn finally reached the model:\n *\n * agent turn failed (AGENT_ERROR): openrouter transport failure on /v1/chat/completions:\n * Illegal invocation: function called with incorrect `this` reference.\n *\n * Thirteen call sites across eleven files wrote that expression, so fixing the one that happened to\n * run would have left twelve identical landmines — every other provider, the memory adapter, the\n * credential resolver, the cloud-run client — each a deploy that fails on the first request through\n * it.\n *\n * ## Why binding, and not a call-site trick\n *\n * `(0, this.fetchImpl)(url)` also works and has to be remembered at every invocation. Binding where\n * the reference is TAKEN fixes every call that reference will ever receive, and puts the rule in one\n * place a test can sweep for.\n *\n * An injected `fetch` is returned untouched: it is a caller's own function, already carrying whatever\n * receiver it needs, and binding it would break every suite that asserts on the double it passed in.\n *\n * @internal\n */\nexport function boundFetch(override?: typeof fetch): typeof fetch {\n return override ?? globalThis.fetch.bind(globalThis);\n}\n"]}
|
|
@@ -6,12 +6,13 @@ var chunkWPO3VCY4_cjs = require('./chunk-WPO3VCY4.cjs');
|
|
|
6
6
|
var chunkQOGNZMHD_cjs = require('./chunk-QOGNZMHD.cjs');
|
|
7
7
|
var chunkYSTXFWQE_cjs = require('./chunk-YSTXFWQE.cjs');
|
|
8
8
|
var chunkFRITRLZQ_cjs = require('./chunk-FRITRLZQ.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunkZWACQM5U_cjs = require('./chunk-ZWACQM5U.cjs');
|
|
10
10
|
var chunkJ5623RIV_cjs = require('./chunk-J5623RIV.cjs');
|
|
11
11
|
var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
|
|
12
|
-
var
|
|
12
|
+
var chunkHU666T3Q_cjs = require('./chunk-HU666T3Q.cjs');
|
|
13
13
|
var chunkNVXXWAU7_cjs = require('./chunk-NVXXWAU7.cjs');
|
|
14
14
|
var chunkNAGPKWOD_cjs = require('./chunk-NAGPKWOD.cjs');
|
|
15
|
+
var chunkEHD25JBZ_cjs = require('./chunk-EHD25JBZ.cjs');
|
|
15
16
|
var chunkUNFBHV46_cjs = require('./chunk-UNFBHV46.cjs');
|
|
16
17
|
var chunk6LHQPOMI_cjs = require('./chunk-6LHQPOMI.cjs');
|
|
17
18
|
var fs = require('fs');
|
|
@@ -101,7 +102,7 @@ async function loadOne(dir, entryName) {
|
|
|
101
102
|
if (plugin !== null && typeof plugin === "object" && plugin.kind === "model-provider") {
|
|
102
103
|
const profile = plugin.profile;
|
|
103
104
|
if (profile !== void 0 && typeof profile === "object") {
|
|
104
|
-
|
|
105
|
+
chunkHU666T3Q_cjs.registerProvider(profile);
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
return;
|
|
@@ -498,7 +499,7 @@ var AnthropicClient = class {
|
|
|
498
499
|
constructor(options) {
|
|
499
500
|
this.options = options;
|
|
500
501
|
this.baseUrl = options.baseUrl ?? "https://api.anthropic.com";
|
|
501
|
-
this.fetchImpl = options.fetch
|
|
502
|
+
this.fetchImpl = chunkEHD25JBZ_cjs.boundFetch(options.fetch);
|
|
502
503
|
}
|
|
503
504
|
options;
|
|
504
505
|
name = "anthropic";
|
|
@@ -747,7 +748,7 @@ async function resolveBedrockToken(region) {
|
|
|
747
748
|
return cachedToken.value;
|
|
748
749
|
}
|
|
749
750
|
try {
|
|
750
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
751
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-QY3CIMUV.cjs', document.baseURI).href)));
|
|
751
752
|
const gen = r("@aws/bedrock-token-generator");
|
|
752
753
|
if (typeof gen.getToken !== "function") return void 0;
|
|
753
754
|
const providers = r("@aws-sdk/credential-providers");
|
|
@@ -765,7 +766,7 @@ async function resolveBedrockToken(region) {
|
|
|
765
766
|
var BedrockAnthropicClient = class {
|
|
766
767
|
constructor(options) {
|
|
767
768
|
this.options = options;
|
|
768
|
-
this.fetchImpl = options.fetch
|
|
769
|
+
this.fetchImpl = chunkEHD25JBZ_cjs.boundFetch(options.fetch);
|
|
769
770
|
}
|
|
770
771
|
options;
|
|
771
772
|
name = "bedrock";
|
|
@@ -781,10 +782,10 @@ var BedrockAnthropicClient = class {
|
|
|
781
782
|
);
|
|
782
783
|
}
|
|
783
784
|
async *stream(request, signal) {
|
|
784
|
-
const region =
|
|
785
|
+
const region = chunkHU666T3Q_cjs.inferRegionFromModelId(request.model) ?? process.env.AWS_REGION ?? "us-east-1";
|
|
785
786
|
const token = await this.resolveTokenOrThrow(region);
|
|
786
|
-
const bareModel =
|
|
787
|
-
const baseUrl = this.options.baseUrl ??
|
|
787
|
+
const bareModel = chunkHU666T3Q_cjs.stripBedrockPrefix(request.model);
|
|
788
|
+
const baseUrl = this.options.baseUrl ?? chunkHU666T3Q_cjs.resolveBedrockBaseUrl(request.model);
|
|
788
789
|
const endpoint = `/model/${encodeURIComponent(bareModel)}/invoke`;
|
|
789
790
|
const url = `${baseUrl}${endpoint}`;
|
|
790
791
|
const response = await postAnthropicRequest({
|
|
@@ -988,7 +989,7 @@ var OllamaNativeClient = class {
|
|
|
988
989
|
this.options = options;
|
|
989
990
|
const raw = (options.baseUrl ?? "http://localhost:11434").replace(/\/+$/, "");
|
|
990
991
|
this.baseUrl = raw.replace(/\/v1$/i, "");
|
|
991
|
-
this.fetchImpl = options.fetch
|
|
992
|
+
this.fetchImpl = chunkEHD25JBZ_cjs.boundFetch(options.fetch);
|
|
992
993
|
}
|
|
993
994
|
options;
|
|
994
995
|
name = "ollama";
|
|
@@ -1244,7 +1245,7 @@ function resolveBaseUrl() {
|
|
|
1244
1245
|
}
|
|
1245
1246
|
async function httpRequest(path, options) {
|
|
1246
1247
|
const url = `${resolveBaseUrl()}${path}`;
|
|
1247
|
-
const fetchFn = options.fetchFn
|
|
1248
|
+
const fetchFn = chunkEHD25JBZ_cjs.boundFetch(options.fetchFn);
|
|
1248
1249
|
const headers = {
|
|
1249
1250
|
"content-type": "application/json",
|
|
1250
1251
|
authorization: `Bearer ${options.apiKey}`,
|
|
@@ -1519,7 +1520,7 @@ var OpenAIClient = class {
|
|
|
1519
1520
|
this.options = options;
|
|
1520
1521
|
this.baseUrl = (options.baseUrl ?? "https://api.openai.com").replace(/\/+$/, "");
|
|
1521
1522
|
this.chatPath = options.chatCompletionsPath ?? deriveChatPath(this.baseUrl);
|
|
1522
|
-
this.fetchImpl = options.fetch
|
|
1523
|
+
this.fetchImpl = chunkEHD25JBZ_cjs.boundFetch(options.fetch);
|
|
1523
1524
|
}
|
|
1524
1525
|
options;
|
|
1525
1526
|
name = "openai";
|
|
@@ -2250,7 +2251,7 @@ var ResponsesApiClient = class {
|
|
|
2250
2251
|
this.options = options;
|
|
2251
2252
|
this.name = options.providerName ?? "openai-responses";
|
|
2252
2253
|
this.baseUrl = (options.baseUrl ?? "https://api.openai.com/v1").replace(/\/+$/, "");
|
|
2253
|
-
this.fetchImpl = options.fetch
|
|
2254
|
+
this.fetchImpl = chunkEHD25JBZ_cjs.boundFetch(options.fetch);
|
|
2254
2255
|
}
|
|
2255
2256
|
options;
|
|
2256
2257
|
name;
|
|
@@ -2515,7 +2516,7 @@ async function resolveVertexAccessToken() {
|
|
|
2515
2516
|
async function getAuthClientOrThrow() {
|
|
2516
2517
|
let mod;
|
|
2517
2518
|
try {
|
|
2518
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
2519
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-QY3CIMUV.cjs', document.baseURI).href)));
|
|
2519
2520
|
mod = r("google-auth-library");
|
|
2520
2521
|
} catch (err) {
|
|
2521
2522
|
const isModuleMissing = err instanceof Error && (err.message.includes("Cannot find module") || err.code === "MODULE_NOT_FOUND");
|
|
@@ -2549,7 +2550,7 @@ function resolveVertexLocation() {
|
|
|
2549
2550
|
var VertexAnthropicClient = class {
|
|
2550
2551
|
constructor(options) {
|
|
2551
2552
|
this.options = options;
|
|
2552
|
-
this.fetchImpl = options.fetch
|
|
2553
|
+
this.fetchImpl = chunkEHD25JBZ_cjs.boundFetch(options.fetch);
|
|
2553
2554
|
}
|
|
2554
2555
|
options;
|
|
2555
2556
|
name = "vertex_anthropic";
|
|
@@ -2576,8 +2577,8 @@ var VertexAnthropicClient = class {
|
|
|
2576
2577
|
const projectId = this.resolveProjectOrThrow();
|
|
2577
2578
|
const location = this.options.location ?? resolveVertexLocation();
|
|
2578
2579
|
const accessToken = await this.resolveTokenOrThrow();
|
|
2579
|
-
const baseUrl =
|
|
2580
|
-
const bareModel =
|
|
2580
|
+
const baseUrl = chunkHU666T3Q_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "anthropic" });
|
|
2581
|
+
const bareModel = chunkHU666T3Q_cjs.stripVertexPrefix(request.model);
|
|
2581
2582
|
const endpoint = `/models/${encodeURIComponent(bareModel)}:rawPredict`;
|
|
2582
2583
|
const url = `${baseUrl}${endpoint}`;
|
|
2583
2584
|
const response = await postAnthropicRequest({
|
|
@@ -2626,9 +2627,9 @@ var VertexGeminiClient = class {
|
|
|
2626
2627
|
{ code: "auth_failed" }
|
|
2627
2628
|
);
|
|
2628
2629
|
}
|
|
2629
|
-
const baseUrl =
|
|
2630
|
+
const baseUrl = chunkHU666T3Q_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "gemini" });
|
|
2630
2631
|
const url = `${baseUrl}/chat/completions`;
|
|
2631
|
-
const innerFetch = this.options.fetch
|
|
2632
|
+
const innerFetch = chunkEHD25JBZ_cjs.boundFetch(this.options.fetch);
|
|
2632
2633
|
const rewriteFetch = (_input, init) => innerFetch(url, init);
|
|
2633
2634
|
const inner = new OpenAIClient({
|
|
2634
2635
|
apiKey: accessToken,
|
|
@@ -2648,7 +2649,7 @@ var VertexRouterClient = class {
|
|
|
2648
2649
|
options;
|
|
2649
2650
|
name = "vertex";
|
|
2650
2651
|
async *stream(request, signal) {
|
|
2651
|
-
const dialect =
|
|
2652
|
+
const dialect = chunkHU666T3Q_cjs.inferModelDialect(request.model);
|
|
2652
2653
|
if (dialect === "anthropic") {
|
|
2653
2654
|
const inner2 = new VertexAnthropicClient(this.options);
|
|
2654
2655
|
return yield* inner2.stream(request, signal);
|
|
@@ -2660,7 +2661,7 @@ var VertexRouterClient = class {
|
|
|
2660
2661
|
|
|
2661
2662
|
// src/internal/llm/router.ts
|
|
2662
2663
|
function resolveProviderChain(options) {
|
|
2663
|
-
|
|
2664
|
+
chunkHU666T3Q_cjs.registerBuiltins();
|
|
2664
2665
|
return buildChain(options);
|
|
2665
2666
|
}
|
|
2666
2667
|
function buildChain(options) {
|
|
@@ -2685,7 +2686,7 @@ function buildChain(options) {
|
|
|
2685
2686
|
return clients;
|
|
2686
2687
|
}
|
|
2687
2688
|
function buildTransport(name, routerOptions, perCallBaseUrl) {
|
|
2688
|
-
const baseProfile =
|
|
2689
|
+
const baseProfile = chunkHU666T3Q_cjs.getProviderProfile(name);
|
|
2689
2690
|
if (baseProfile === void 0) return void 0;
|
|
2690
2691
|
const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
|
|
2691
2692
|
const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
|
|
@@ -2780,7 +2781,7 @@ function warnUnknownProvidersInApiKeys(apiKeys) {
|
|
|
2780
2781
|
if (apiKeys === void 0) return;
|
|
2781
2782
|
for (const name of Object.keys(apiKeys)) {
|
|
2782
2783
|
if (warnedProviders.has(name)) continue;
|
|
2783
|
-
const profile =
|
|
2784
|
+
const profile = chunkHU666T3Q_cjs.getProviderProfile(name);
|
|
2784
2785
|
if (profile === void 0) {
|
|
2785
2786
|
warnedProviders.add(name);
|
|
2786
2787
|
chunk6LHQPOMI_cjs.diag(
|
|
@@ -2955,7 +2956,7 @@ function checkProviderPrefix(key, provider) {
|
|
|
2955
2956
|
function registerPluginProviderProfiles(entries) {
|
|
2956
2957
|
let registered = 0;
|
|
2957
2958
|
for (const entry of entries) {
|
|
2958
|
-
|
|
2959
|
+
chunkHU666T3Q_cjs.registerProvider(entry.profile);
|
|
2959
2960
|
registered += 1;
|
|
2960
2961
|
}
|
|
2961
2962
|
return registered;
|
|
@@ -3039,7 +3040,7 @@ function shouldUseRealLocalRuntime(apiKey) {
|
|
|
3039
3040
|
function inferProviderFromApiKey(apiKey) {
|
|
3040
3041
|
const provider = chunkFRITRLZQ_cjs.providerFromApiKeyPrefix(apiKey);
|
|
3041
3042
|
if (provider === void 0) return void 0;
|
|
3042
|
-
return
|
|
3043
|
+
return chunkHU666T3Q_cjs.getProviderProfile(provider) === void 0 ? void 0 : provider;
|
|
3043
3044
|
}
|
|
3044
3045
|
function detectPrimaryProvider() {
|
|
3045
3046
|
if (process.env.ANTHROPIC_API_KEY !== void 0 && process.env.ANTHROPIC_API_KEY.length > 0) {
|
|
@@ -3066,7 +3067,7 @@ function warnProviderPrecedenceOnce(asked, used) {
|
|
|
3066
3067
|
}
|
|
3067
3068
|
var pluginProvidersAnnounced = false;
|
|
3068
3069
|
function resolveRunProvider(options) {
|
|
3069
|
-
|
|
3070
|
+
chunkHU666T3Q_cjs.registerBuiltins();
|
|
3070
3071
|
const profiles = options.pluginManager?.aggregated.providerProfiles ?? [];
|
|
3071
3072
|
const registered = registerPluginProviderProfiles(profiles);
|
|
3072
3073
|
if (registered > 0 && !pluginProvidersAnnounced) {
|
|
@@ -3076,7 +3077,7 @@ function resolveRunProvider(options) {
|
|
|
3076
3077
|
`);
|
|
3077
3078
|
}
|
|
3078
3079
|
const parsedModel = chunk3EE6LVWT_cjs.parseModelId(options.model?.id);
|
|
3079
|
-
const modelInferredProvider = parsedModel.provider !== void 0 &&
|
|
3080
|
+
const modelInferredProvider = parsedModel.provider !== void 0 && chunkHU666T3Q_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
|
|
3080
3081
|
const keyInferredProvider = inferProviderFromApiKey(options.agentOptions.apiKey);
|
|
3081
3082
|
const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? detectPrimaryProvider();
|
|
3082
3083
|
warnProviderPrecedenceOnce(modelInferredProvider, primary);
|
|
@@ -3159,7 +3160,7 @@ async function runPreCompactBounded(handler, ctx, timeoutMs, onError) {
|
|
|
3159
3160
|
}
|
|
3160
3161
|
async function compactSessionTranscript(opts) {
|
|
3161
3162
|
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
3162
|
-
const history =
|
|
3163
|
+
const history = chunkZWACQM5U_cjs.reconstructMessages(prior);
|
|
3163
3164
|
const compressible = [];
|
|
3164
3165
|
for (const m of history) {
|
|
3165
3166
|
const text = plainText(m.content);
|
|
@@ -3196,7 +3197,7 @@ async function compactSessionTranscript(opts) {
|
|
|
3196
3197
|
}
|
|
3197
3198
|
const summary = `${COMPACT_SUMMARY_MARKER}
|
|
3198
3199
|
${summaryBody}`;
|
|
3199
|
-
const transcript =
|
|
3200
|
+
const transcript = chunkZWACQM5U_cjs.SessionTranscript.fromRecords(prior, {
|
|
3200
3201
|
cwd: opts.loc.cwd,
|
|
3201
3202
|
sessionId: opts.sessionId,
|
|
3202
3203
|
model: opts.loc.model ?? "unknown"
|
|
@@ -3216,9 +3217,9 @@ function resolveSummarizerRoute(opts) {
|
|
|
3216
3217
|
}
|
|
3217
3218
|
function buildDefaultSummarizer(opts) {
|
|
3218
3219
|
return async (messages) => {
|
|
3219
|
-
|
|
3220
|
+
chunkHU666T3Q_cjs.registerBuiltins();
|
|
3220
3221
|
const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
|
|
3221
|
-
const prefixProfile = modelPrefix !== void 0 ?
|
|
3222
|
+
const prefixProfile = modelPrefix !== void 0 ? chunkHU666T3Q_cjs.getProviderProfile(modelPrefix) : void 0;
|
|
3222
3223
|
const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
|
|
3223
3224
|
const route = resolveSummarizerRoute({
|
|
3224
3225
|
keyProvider: inferProviderFromApiKey(opts.apiKey),
|
|
@@ -3322,5 +3323,5 @@ exports.shouldUseFixtureMode = shouldUseFixtureMode;
|
|
|
3322
3323
|
exports.shouldUseRealLocalRuntime = shouldUseRealLocalRuntime;
|
|
3323
3324
|
exports.tryFirstEvent = tryFirstEvent;
|
|
3324
3325
|
exports.validateApiKeyShape = validateApiKeyShape;
|
|
3325
|
-
//# sourceMappingURL=chunk-
|
|
3326
|
-
//# sourceMappingURL=chunk-
|
|
3326
|
+
//# sourceMappingURL=chunk-QY3CIMUV.cjs.map
|
|
3327
|
+
//# sourceMappingURL=chunk-QY3CIMUV.cjs.map
|