@theokit/sdk 4.52.0 → 4.52.1
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 +35 -17
- package/dist/{agent-HYQGJTIN.js → agent-RDHK6MVT.js} +6 -6
- package/dist/{agent-HYQGJTIN.js.map → agent-RDHK6MVT.js.map} +1 -1
- package/dist/{agent-C66BEJGO.cjs → agent-U2R2R5JP.cjs} +7 -7
- package/dist/{agent-C66BEJGO.cjs.map → agent-U2R2R5JP.cjs.map} +1 -1
- package/dist/auth/index.cjs +2 -2
- package/dist/auth/index.d.cts +15 -0
- package/dist/auth/index.d.ts +15 -0
- package/dist/auth/index.js +1 -1
- package/dist/{chunk-SPZZSAHV.js → chunk-42PLABFU.js} +3 -3
- package/dist/{chunk-SPZZSAHV.js.map → chunk-42PLABFU.js.map} +1 -1
- package/dist/{chunk-LLK2RS6I.cjs → chunk-6GS7JI64.cjs} +43 -43
- package/dist/{chunk-LLK2RS6I.cjs.map → chunk-6GS7JI64.cjs.map} +1 -1
- package/dist/{chunk-YARJG3GV.cjs → chunk-CY7MIMI4.cjs} +3 -3
- package/dist/{chunk-YARJG3GV.cjs.map → chunk-CY7MIMI4.cjs.map} +1 -1
- package/dist/{chunk-WVDH34LK.cjs → chunk-FRITRLZQ.cjs} +2 -2
- package/dist/chunk-FRITRLZQ.cjs.map +1 -0
- package/dist/{chunk-DU7PBCAM.js → chunk-GNPI5IWZ.js} +3 -3
- package/dist/{chunk-DU7PBCAM.js.map → chunk-GNPI5IWZ.js.map} +1 -1
- package/dist/{chunk-ZFARZBOX.js → chunk-KELIQH7K.js} +6 -6
- package/dist/{chunk-ZFARZBOX.js.map → chunk-KELIQH7K.js.map} +1 -1
- package/dist/{chunk-YBB66SZZ.js → chunk-M5EK7N6R.js} +3 -3
- package/dist/{chunk-YBB66SZZ.js.map → chunk-M5EK7N6R.js.map} +1 -1
- package/dist/{chunk-U3PAW4PL.js → chunk-NAF4L3T6.js} +2 -2
- package/dist/chunk-NAF4L3T6.js.map +1 -0
- package/dist/{chunk-ZNEYQ56O.cjs → chunk-WLESQ3ZQ.cjs} +6 -6
- package/dist/{chunk-ZNEYQ56O.cjs.map → chunk-WLESQ3ZQ.cjs.map} +1 -1
- package/dist/{chunk-2CD5XUAG.cjs → chunk-ZNEE4WWQ.cjs} +5 -5
- package/dist/{chunk-2CD5XUAG.cjs.map → chunk-ZNEE4WWQ.cjs.map} +1 -1
- package/dist/{compact-session-AXKDB6FC.cjs → compact-session-FBVWO6B3.cjs} +12 -12
- package/dist/{compact-session-AXKDB6FC.cjs.map → compact-session-FBVWO6B3.cjs.map} +1 -1
- package/dist/{compact-session-DUAUEFRR.js → compact-session-XLXC2CZN.js} +4 -4
- package/dist/{compact-session-DUAUEFRR.js.map → compact-session-XLXC2CZN.js.map} +1 -1
- package/dist/cron.cjs +6 -6
- package/dist/cron.js +5 -5
- package/dist/eval.cjs +5 -5
- package/dist/eval.js +4 -4
- package/dist/index.cjs +28 -28
- package/dist/index.js +7 -7
- package/dist/{inject-session-TASLP5FA.cjs → inject-session-UBAQ7I3G.cjs} +4 -4
- package/dist/{inject-session-TASLP5FA.cjs.map → inject-session-UBAQ7I3G.cjs.map} +1 -1
- package/dist/{inject-session-RBGOGACE.js → inject-session-UEH5MAKU.js} +3 -3
- package/dist/{inject-session-RBGOGACE.js.map → inject-session-UEH5MAKU.js.map} +1 -1
- package/dist/internal/auth/api-key-prefix.d.ts +7 -1
- package/package.json +1 -1
- package/dist/chunk-U3PAW4PL.js.map +0 -1
- package/dist/chunk-WVDH34LK.cjs.map +0 -1
|
@@ -18,5 +18,5 @@ function providerFromApiKeyPrefix(apiKey) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export { providerFromApiKeyPrefix };
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
22
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-NAF4L3T6.js.map
|
|
22
|
+
//# sourceMappingURL=chunk-NAF4L3T6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/internal/auth/api-key-prefix.ts"],"names":[],"mappings":";AAiBA,IAAM,QAAA,GAA6C;AAAA,EACjD,QAAA,EAAU,YAAA;AAAA,EACV,SAAA,EAAW,WAAA;AAAA,EACX,KAAA,EAAO;AACT,CAAA;AAYA,IAAM,SAAA,GAAsD,MAAA,CAAO,OAAA,CAAQ,QAAQ,CAAA,CAAE,IAAA;AAAA,EACnF,CAAC,GAAG,CAAA,KAAM,CAAA,CAAE,CAAC,CAAA,CAAE,MAAA,GAAS,CAAA,CAAE,CAAC,CAAA,CAAE;AAC/B,CAAA;AASO,SAAS,yBAAyB,MAAA,EAAgD;AACvF,EAAA,IAAI,MAAA,KAAW,QAAW,OAAO,MAAA;AACjC,EAAA,MAAM,GAAA,GAAM,OAAO,IAAA,EAAK;AACxB,EAAA,IAAI,GAAA,CAAI,MAAA,KAAW,CAAA,EAAG,OAAO,MAAA;AAC7B,EAAA,KAAA,MAAW,CAAC,MAAA,EAAQ,QAAQ,CAAA,IAAK,SAAA,EAAW;AAC1C,IAAA,IAAI,GAAA,CAAI,UAAA,CAAW,MAAM,CAAA,EAAG,OAAO,QAAA;AAAA,EACrC;AACA,EAAA,OAAO,MAAA;AACT","file":"chunk-NAF4L3T6.js","sourcesContent":["/**\n * \"Which provider issued this key?\" — the pure prefix answer.\n *\n * Lives in `auth/` and not beside the local-run helper that used to own it, because the question is\n * an auth question. The local-run path additionally refuses a provider it has no profile for; that\n * is its policy, not part of this answer, so it stays there and composes with this.\n *\n * Lives under `internal/` by FOLDER, and is PUBLIC by contract — re-exported from\n * `@theokit/sdk/auth`.\n *\n * Deliberately NOT tagged `@internal`: `tsconfig.base.json` sets `stripInternal: true`, so that tag\n * deletes the declaration from every emitted `.d.ts`. The symbol then exists at runtime and cannot\n * be imported with types — which is the exact defect this module was published to fix, reintroduced\n * one layer down by a docblock. Measured: usetheodev/theokit-sdk#283.\n */\n\n/** Prefix → provider. Order here is irrelevant: the lookup sorts. */\nconst PREFIXES: Readonly<Record<string, string>> = {\n \"sk-or-\": \"openrouter\",\n \"sk-ant-\": \"anthropic\",\n \"sk-\": \"openai\",\n};\n\n/**\n * Longest first, computed once.\n *\n * The ordering IS the correctness property, so it is derived rather than written down: every\n * OpenRouter and Anthropic key also starts with `sk-`, and a shortest-match-first scan resolves\n * them to OpenAI. That failure is invisible locally — it surfaces as a remote 401 from the wrong\n * endpoint, with a message that says nothing about prefixes. The previous implementation was\n * correct only because the entries happened to be written in a workable order; appending a longer\n * prefix, or sorting the table for readability, would have broken it silently.\n */\nconst BY_LENGTH: ReadonlyArray<readonly [string, string]> = Object.entries(PREFIXES).sort(\n (a, b) => b[0].length - a[0].length,\n);\n\n/**\n * The provider whose key prefix matches, or `undefined` when none does.\n *\n * `undefined` means \"cannot tell\" and never a guess: a wrong guess here routes a real credential to\n * the wrong endpoint. Whitespace-only and empty inputs are \"cannot tell\" too — they are what an\n * empty prompt submits, not a key.\n */\nexport function providerFromApiKeyPrefix(apiKey: string | undefined): string | undefined {\n if (apiKey === undefined) return undefined;\n const key = apiKey.trim();\n if (key.length === 0) return undefined;\n for (const [prefix, provider] of BY_LENGTH) {\n if (key.startsWith(prefix)) return provider;\n }\n return undefined;\n}\n"]}
|
|
@@ -4,7 +4,7 @@ var chunk4JBHSLQO_cjs = require('./chunk-4JBHSLQO.cjs');
|
|
|
4
4
|
var chunkRAACTJ7C_cjs = require('./chunk-RAACTJ7C.cjs');
|
|
5
5
|
var chunkE3OCRJU6_cjs = require('./chunk-E3OCRJU6.cjs');
|
|
6
6
|
var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunkFRITRLZQ_cjs = require('./chunk-FRITRLZQ.cjs');
|
|
8
8
|
var chunkECPL5RV6_cjs = require('./chunk-ECPL5RV6.cjs');
|
|
9
9
|
var chunkAMYY3JHQ_cjs = require('./chunk-AMYY3JHQ.cjs');
|
|
10
10
|
var chunkT6ZCG5AP_cjs = require('./chunk-T6ZCG5AP.cjs');
|
|
@@ -740,7 +740,7 @@ async function resolveBedrockToken(region) {
|
|
|
740
740
|
return cachedToken.value;
|
|
741
741
|
}
|
|
742
742
|
try {
|
|
743
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
743
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-WLESQ3ZQ.cjs', document.baseURI).href)));
|
|
744
744
|
const gen = r("@aws/bedrock-token-generator");
|
|
745
745
|
if (typeof gen.getToken !== "function") return void 0;
|
|
746
746
|
const providers = r("@aws-sdk/credential-providers");
|
|
@@ -2404,7 +2404,7 @@ async function resolveVertexAccessToken() {
|
|
|
2404
2404
|
async function getAuthClientOrThrow() {
|
|
2405
2405
|
let mod;
|
|
2406
2406
|
try {
|
|
2407
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
2407
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-WLESQ3ZQ.cjs', document.baseURI).href)));
|
|
2408
2408
|
mod = r("google-auth-library");
|
|
2409
2409
|
} catch (err) {
|
|
2410
2410
|
const isModuleMissing = err instanceof Error && (err.message.includes("Cannot find module") || err.code === "MODULE_NOT_FOUND");
|
|
@@ -2769,7 +2769,7 @@ function selectTransport(profile, apiKey) {
|
|
|
2769
2769
|
|
|
2770
2770
|
// src/internal/local-agent/real-local-run-provider.ts
|
|
2771
2771
|
function inferProviderFromApiKey(apiKey) {
|
|
2772
|
-
const provider =
|
|
2772
|
+
const provider = chunkFRITRLZQ_cjs.providerFromApiKeyPrefix(apiKey);
|
|
2773
2773
|
if (provider === void 0) return void 0;
|
|
2774
2774
|
return chunkT6ZCG5AP_cjs.getProviderProfile(provider) === void 0 ? void 0 : provider;
|
|
2775
2775
|
}
|
|
@@ -3059,5 +3059,5 @@ exports.shouldAutoCompact = shouldAutoCompact;
|
|
|
3059
3059
|
exports.shouldUseFixtureMode = shouldUseFixtureMode;
|
|
3060
3060
|
exports.shouldUseRealLocalRuntime = shouldUseRealLocalRuntime;
|
|
3061
3061
|
exports.tryFirstEvent = tryFirstEvent;
|
|
3062
|
-
//# sourceMappingURL=chunk-
|
|
3063
|
-
//# sourceMappingURL=chunk-
|
|
3062
|
+
//# sourceMappingURL=chunk-WLESQ3ZQ.cjs.map
|
|
3063
|
+
//# sourceMappingURL=chunk-WLESQ3ZQ.cjs.map
|