@theokit/sdk 4.54.0 → 4.55.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 +96 -0
- package/dist/{agent-CIUgz7cN.d.cts → agent-D3Xr_-6Z.d.cts} +61 -6
- package/dist/{agent-DSec-E0c.d.ts → agent-DIu6FooJ.d.ts} +61 -6
- package/dist/{agent-VGD5WL4N.js → agent-HDEVVUBS.js} +7 -7
- package/dist/{agent-VGD5WL4N.js.map → agent-HDEVVUBS.js.map} +1 -1
- package/dist/{agent-NOEGF4GI.cjs → agent-R2HOJFZJ.cjs} +8 -8
- package/dist/{agent-NOEGF4GI.cjs.map → agent-R2HOJFZJ.cjs.map} +1 -1
- package/dist/{chunk-SSQZA3DZ.js → chunk-2BDH744Z.js} +3 -3
- package/dist/{chunk-SSQZA3DZ.js.map → chunk-2BDH744Z.js.map} +1 -1
- package/dist/chunk-6HTXPPHK.cjs +18 -0
- package/dist/{chunk-3KGLRRFC.cjs.map → chunk-6HTXPPHK.cjs.map} +1 -1
- package/dist/{chunk-UFAO4T7Z.cjs → chunk-F5WMX4EA.cjs} +114 -73
- package/dist/chunk-F5WMX4EA.cjs.map +1 -0
- package/dist/{chunk-UNDROG5N.cjs → chunk-HLPSLDGL.cjs} +94 -26
- package/dist/chunk-HLPSLDGL.cjs.map +1 -0
- package/dist/{chunk-TPTZA6NI.js → chunk-I5BE5M5L.js} +68 -27
- package/dist/chunk-I5BE5M5L.js.map +1 -0
- package/dist/{chunk-TTHBHAJI.cjs → chunk-ITSSOVOB.cjs} +4 -4
- package/dist/{chunk-TTHBHAJI.cjs.map → chunk-ITSSOVOB.cjs.map} +1 -1
- package/dist/{chunk-AGSBJD2L.js → chunk-IVNNSANC.js} +3 -3
- package/dist/{chunk-AGSBJD2L.js.map → chunk-IVNNSANC.js.map} +1 -1
- package/dist/{chunk-VDEWG5TV.js → chunk-MVAPK2BX.js} +77 -9
- package/dist/chunk-MVAPK2BX.js.map +1 -0
- package/dist/{chunk-RM7Y65IG.cjs → chunk-NIRE5CNO.cjs} +10 -3
- package/dist/{chunk-FXEUP75G.js.map → chunk-NIRE5CNO.cjs.map} +1 -1
- package/dist/{chunk-DUIF54UP.js → chunk-OHBIUXKM.js} +3 -3
- package/dist/{chunk-DUIF54UP.js.map → chunk-OHBIUXKM.js.map} +1 -1
- package/dist/{chunk-FXEUP75G.js → chunk-Q4CMI2LP.js} +9 -2
- package/dist/chunk-Q4CMI2LP.js.map +1 -0
- package/dist/{chunk-5BJV5UPY.cjs → chunk-V2UUGUY4.cjs} +3 -3
- package/dist/{chunk-5BJV5UPY.cjs.map → chunk-V2UUGUY4.cjs.map} +1 -1
- package/dist/{compact-session-K5LXTBPJ.js → compact-session-FUJDVF7B.js} +4 -4
- package/dist/{compact-session-K5LXTBPJ.js.map → compact-session-FUJDVF7B.js.map} +1 -1
- package/dist/{compact-session-YCT6JMBX.cjs → compact-session-LEWF554G.cjs} +12 -12
- package/dist/{compact-session-YCT6JMBX.cjs.map → compact-session-LEWF554G.cjs.map} +1 -1
- package/dist/{cron-DxxeQ-sK.d.cts → cron-BcWmzWzT.d.cts} +1 -1
- package/dist/{cron-CRwy2JBF.d.ts → cron-De6hzWCF.d.ts} +1 -1
- package/dist/cron.cjs +7 -7
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +6 -6
- package/dist/eval.cjs +6 -6
- package/dist/eval.js +5 -5
- package/dist/index.cjs +36 -36
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -8
- package/dist/{inject-session-DDR6X6PC.js → inject-session-BJMJH5BX.js} +3 -3
- package/dist/{inject-session-DDR6X6PC.js.map → inject-session-BJMJH5BX.js.map} +1 -1
- package/dist/{inject-session-XLO3KTBM.cjs → inject-session-WQGGMCQY.cjs} +4 -4
- package/dist/{inject-session-XLO3KTBM.cjs.map → inject-session-WQGGMCQY.cjs.map} +1 -1
- package/dist/internal/llm/prompt-cache-key.d.ts +1 -0
- package/dist/internal/llm/responses.d.ts +67 -1
- package/dist/internal/llm/types.d.ts +15 -0
- package/dist/internal/local-agent/real-local-run-tools.d.ts +17 -6
- package/dist/models.cjs +9 -9
- package/dist/models.js +1 -1
- package/dist/providers.cjs +4 -4
- package/dist/providers.js +2 -2
- package/dist/subagents-loader.d.cts +1 -1
- package/dist/subagents-loader.d.ts +1 -1
- package/dist/types/agent.d.ts +47 -5
- package/dist/types/provider-profile.d.ts +13 -0
- package/docs/error-codes.md +19 -19
- package/docs/harness-capability-map.md +2 -1
- package/package.json +1 -1
- package/dist/chunk-3KGLRRFC.cjs +0 -18
- package/dist/chunk-RM7Y65IG.cjs.map +0 -1
- package/dist/chunk-TPTZA6NI.js.map +0 -1
- package/dist/chunk-UFAO4T7Z.cjs.map +0 -1
- package/dist/chunk-UNDROG5N.cjs.map +0 -1
- package/dist/chunk-VDEWG5TV.js.map +0 -1
|
@@ -7,7 +7,7 @@ var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
|
|
|
7
7
|
var chunkFRITRLZQ_cjs = require('./chunk-FRITRLZQ.cjs');
|
|
8
8
|
var chunkJHPGF3FP_cjs = require('./chunk-JHPGF3FP.cjs');
|
|
9
9
|
var chunkXSX2UU6Y_cjs = require('./chunk-XSX2UU6Y.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunkNIRE5CNO_cjs = require('./chunk-NIRE5CNO.cjs');
|
|
11
11
|
var chunkK3FW2XZD_cjs = require('./chunk-K3FW2XZD.cjs');
|
|
12
12
|
var chunkNUKRL3I6_cjs = require('./chunk-NUKRL3I6.cjs');
|
|
13
13
|
var fs = require('fs');
|
|
@@ -18,7 +18,7 @@ var url = require('url');
|
|
|
18
18
|
var module$1 = require('module');
|
|
19
19
|
|
|
20
20
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
21
|
-
var discoveryState =
|
|
21
|
+
var discoveryState = chunkNIRE5CNO_cjs.globalSingleton("theokit-sdk.providers.discovered", () => ({
|
|
22
22
|
done: false
|
|
23
23
|
}));
|
|
24
24
|
function pluginsRoot() {
|
|
@@ -97,7 +97,7 @@ async function loadOne(dir, entryName) {
|
|
|
97
97
|
if (plugin !== null && typeof plugin === "object" && plugin.kind === "model-provider") {
|
|
98
98
|
const profile = plugin.profile;
|
|
99
99
|
if (profile !== void 0 && typeof profile === "object") {
|
|
100
|
-
|
|
100
|
+
chunkNIRE5CNO_cjs.registerProvider(profile);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
return;
|
|
@@ -757,7 +757,7 @@ async function resolveBedrockToken(region) {
|
|
|
757
757
|
return cachedToken.value;
|
|
758
758
|
}
|
|
759
759
|
try {
|
|
760
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
760
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-HLPSLDGL.cjs', document.baseURI).href)));
|
|
761
761
|
const gen = r("@aws/bedrock-token-generator");
|
|
762
762
|
if (typeof gen.getToken !== "function") return void 0;
|
|
763
763
|
const providers = r("@aws-sdk/credential-providers");
|
|
@@ -791,10 +791,10 @@ var BedrockAnthropicClient = class {
|
|
|
791
791
|
);
|
|
792
792
|
}
|
|
793
793
|
async *stream(request, signal) {
|
|
794
|
-
const region =
|
|
794
|
+
const region = chunkNIRE5CNO_cjs.inferRegionFromModelId(request.model) ?? process.env.AWS_REGION ?? "us-east-1";
|
|
795
795
|
const token = await this.resolveTokenOrThrow(region);
|
|
796
|
-
const bareModel =
|
|
797
|
-
const baseUrl = this.options.baseUrl ??
|
|
796
|
+
const bareModel = chunkNIRE5CNO_cjs.stripBedrockPrefix(request.model);
|
|
797
|
+
const baseUrl = this.options.baseUrl ?? chunkNIRE5CNO_cjs.resolveBedrockBaseUrl(request.model);
|
|
798
798
|
const endpoint = `/model/${encodeURIComponent(bareModel)}/invoke`;
|
|
799
799
|
const url = `${baseUrl}${endpoint}`;
|
|
800
800
|
const response = await postAnthropicRequest({
|
|
@@ -2076,7 +2076,7 @@ function abortError(signal) {
|
|
|
2076
2076
|
}
|
|
2077
2077
|
|
|
2078
2078
|
// src/internal/llm/responses.ts
|
|
2079
|
-
function messageToInputItems(message) {
|
|
2079
|
+
function messageToInputItems(message, reasoningByCallId) {
|
|
2080
2080
|
const items = [];
|
|
2081
2081
|
if (message.role === "user") {
|
|
2082
2082
|
const content = [];
|
|
@@ -2103,6 +2103,14 @@ function messageToInputItems(message) {
|
|
|
2103
2103
|
if (part.type === "text") {
|
|
2104
2104
|
content.push({ type: "output_text", text: part.text });
|
|
2105
2105
|
} else if (part.type === "tool_use") {
|
|
2106
|
+
for (const reasoning of reasoningByCallId?.get(part.id) ?? []) {
|
|
2107
|
+
items.push({
|
|
2108
|
+
type: "reasoning",
|
|
2109
|
+
id: reasoning.id,
|
|
2110
|
+
encrypted_content: reasoning.encrypted_content,
|
|
2111
|
+
summary: []
|
|
2112
|
+
});
|
|
2113
|
+
}
|
|
2106
2114
|
items.push({
|
|
2107
2115
|
type: "function_call",
|
|
2108
2116
|
call_id: part.id,
|
|
@@ -2118,10 +2126,10 @@ function messageToInputItems(message) {
|
|
|
2118
2126
|
if (text.length > 0) items.push({ role: "system", content: text });
|
|
2119
2127
|
return items;
|
|
2120
2128
|
}
|
|
2121
|
-
function buildResponsesBody(request) {
|
|
2129
|
+
function buildResponsesBody(request, options = {}) {
|
|
2122
2130
|
const input = [];
|
|
2123
2131
|
for (const message of request.messages) {
|
|
2124
|
-
for (const item of messageToInputItems(message)) input.push(item);
|
|
2132
|
+
for (const item of messageToInputItems(message, options.reasoningByCallId)) input.push(item);
|
|
2125
2133
|
}
|
|
2126
2134
|
const slash = request.model.lastIndexOf("/");
|
|
2127
2135
|
const model = slash >= 0 ? request.model.slice(slash + 1) : request.model;
|
|
@@ -2138,9 +2146,21 @@ function buildResponsesBody(request) {
|
|
|
2138
2146
|
strict: false
|
|
2139
2147
|
}));
|
|
2140
2148
|
if (tools.length > 0) body.tools = tools;
|
|
2141
|
-
|
|
2149
|
+
applyPromptCachingFields(body, request, options);
|
|
2142
2150
|
return body;
|
|
2143
2151
|
}
|
|
2152
|
+
function applyPromptCachingFields(body, request, options) {
|
|
2153
|
+
const carryReasoning = options.encryptedReasoning === true;
|
|
2154
|
+
if (request.reasoning !== void 0) {
|
|
2155
|
+
body.reasoning = {
|
|
2156
|
+
effort: request.reasoning.effort,
|
|
2157
|
+
...carryReasoning ? { context: "all_turns" } : {}
|
|
2158
|
+
};
|
|
2159
|
+
}
|
|
2160
|
+
if (carryReasoning) body.include = ["reasoning.encrypted_content"];
|
|
2161
|
+
if (request.promptCacheKey !== void 0) body.prompt_cache_key = request.promptCacheKey;
|
|
2162
|
+
}
|
|
2163
|
+
var MAX_REMEMBERED_REASONING_CALLS = 256;
|
|
2144
2164
|
var ResponsesApiClient = class {
|
|
2145
2165
|
constructor(options) {
|
|
2146
2166
|
this.options = options;
|
|
@@ -2152,6 +2172,26 @@ var ResponsesApiClient = class {
|
|
|
2152
2172
|
name;
|
|
2153
2173
|
baseUrl;
|
|
2154
2174
|
fetchImpl;
|
|
2175
|
+
/**
|
|
2176
|
+
* usetheokit/theokit-sdk#383 — reasoning ciphertext captured from earlier rounds, keyed by the
|
|
2177
|
+
* `call_id` it preceded. Held on the CLIENT rather than threaded through `LlmRequest` because a
|
|
2178
|
+
* round's reasoning is provider-shaped ciphertext with a provider-shaped ordering rule; the agent
|
|
2179
|
+
* loop has no use for it and the same client instance serves every round of a turn. Insertion
|
|
2180
|
+
* order is the eviction order (see {@link MAX_REMEMBERED_REASONING_CALLS}).
|
|
2181
|
+
*/
|
|
2182
|
+
reasoningByCallId = /* @__PURE__ */ new Map();
|
|
2183
|
+
/**
|
|
2184
|
+
* usetheokit/theokit-sdk#383 — bind a batch of reasoning ciphertext to the tool call it produced,
|
|
2185
|
+
* evicting the oldest binding once the cap is reached.
|
|
2186
|
+
*/
|
|
2187
|
+
rememberReasoning(callId, items) {
|
|
2188
|
+
this.reasoningByCallId.set(callId, [...items]);
|
|
2189
|
+
while (this.reasoningByCallId.size > MAX_REMEMBERED_REASONING_CALLS) {
|
|
2190
|
+
const oldest = this.reasoningByCallId.keys().next();
|
|
2191
|
+
if (oldest.done === true) break;
|
|
2192
|
+
this.reasoningByCallId.delete(oldest.value);
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2155
2195
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: the SSE dispatch (text / reasoning / tool-call add+delta+done / terminal+usage / error) is one cohesive state machine, mirroring OpenAIStreamAccumulator.consume.
|
|
2156
2196
|
async *stream(request, signal) {
|
|
2157
2197
|
const providerId = this.options.providerName ?? "openai";
|
|
@@ -2166,7 +2206,15 @@ var ResponsesApiClient = class {
|
|
|
2166
2206
|
method: "POST",
|
|
2167
2207
|
signal,
|
|
2168
2208
|
headers,
|
|
2169
|
-
body: JSON.stringify(
|
|
2209
|
+
body: JSON.stringify(
|
|
2210
|
+
// Both options ride the SAME flag on purpose: a provider that never declared support gets
|
|
2211
|
+
// the byte-identical pre-#383 body, even in the impossible case where it returned ciphertext
|
|
2212
|
+
// nobody asked for.
|
|
2213
|
+
buildResponsesBody(
|
|
2214
|
+
request,
|
|
2215
|
+
this.options.encryptedReasoning === true ? { encryptedReasoning: true, reasoningByCallId: this.reasoningByCallId } : {}
|
|
2216
|
+
)
|
|
2217
|
+
)
|
|
2170
2218
|
});
|
|
2171
2219
|
if (!response.ok) {
|
|
2172
2220
|
const text2 = await response.text().catch(() => "");
|
|
@@ -2189,7 +2237,10 @@ var ResponsesApiClient = class {
|
|
|
2189
2237
|
let inputTokens;
|
|
2190
2238
|
let outputTokens;
|
|
2191
2239
|
let reasoningTokens;
|
|
2240
|
+
let cacheReadTokens;
|
|
2241
|
+
let cacheWriteTokens;
|
|
2192
2242
|
const pending = {};
|
|
2243
|
+
let unclaimedReasoning = [];
|
|
2193
2244
|
if (response.body !== null) {
|
|
2194
2245
|
for await (const record of parseSseStream(response.body, signal)) {
|
|
2195
2246
|
if (record.data === "[DONE]") break;
|
|
@@ -2209,6 +2260,12 @@ var ResponsesApiClient = class {
|
|
|
2209
2260
|
} else if (t === "response.reasoning_summary_text.delta" || t === "response.reasoning_text.delta") {
|
|
2210
2261
|
const d = event.delta ?? "";
|
|
2211
2262
|
if (d.length > 0) yield { type: "reasoning_delta", text: d };
|
|
2263
|
+
} else if (t === "response.output_item.done" && event.item?.type === "reasoning") {
|
|
2264
|
+
const id = event.item.id;
|
|
2265
|
+
const encrypted = event.item.encrypted_content;
|
|
2266
|
+
if (id !== void 0 && encrypted !== void 0 && encrypted.length > 0) {
|
|
2267
|
+
unclaimedReasoning.push({ id, encrypted_content: encrypted });
|
|
2268
|
+
}
|
|
2212
2269
|
} else if (t === "response.output_item.added" && event.item?.type === "function_call") {
|
|
2213
2270
|
const id = event.item.id ?? event.item.call_id ?? "call-0";
|
|
2214
2271
|
pending[id] = {
|
|
@@ -2234,6 +2291,10 @@ var ResponsesApiClient = class {
|
|
|
2234
2291
|
input: parseToolArguments(rawArgs)
|
|
2235
2292
|
};
|
|
2236
2293
|
toolCalls.push(call);
|
|
2294
|
+
if (unclaimedReasoning.length > 0) {
|
|
2295
|
+
this.rememberReasoning(call.id, unclaimedReasoning);
|
|
2296
|
+
unclaimedReasoning = [];
|
|
2297
|
+
}
|
|
2237
2298
|
delete pending[id];
|
|
2238
2299
|
} else if (t === "response.completed" || t === "response.incomplete") {
|
|
2239
2300
|
const usage = event.response?.usage;
|
|
@@ -2241,6 +2302,8 @@ var ResponsesApiClient = class {
|
|
|
2241
2302
|
inputTokens = usage.input_tokens;
|
|
2242
2303
|
outputTokens = usage.output_tokens;
|
|
2243
2304
|
reasoningTokens = usage.output_tokens_details?.reasoning_tokens;
|
|
2305
|
+
cacheReadTokens = usage.input_tokens_details?.cached_tokens;
|
|
2306
|
+
cacheWriteTokens = usage.input_tokens_details?.cache_write_tokens;
|
|
2244
2307
|
}
|
|
2245
2308
|
stopReason = t === "response.incomplete" ? "max_tokens" : "end_turn";
|
|
2246
2309
|
} else if (t === "response.failed" || t === "error") {
|
|
@@ -2263,7 +2326,9 @@ var ResponsesApiClient = class {
|
|
|
2263
2326
|
toolCalls,
|
|
2264
2327
|
inputTokens,
|
|
2265
2328
|
outputTokens,
|
|
2266
|
-
reasoningTokens
|
|
2329
|
+
reasoningTokens,
|
|
2330
|
+
cacheReadTokens,
|
|
2331
|
+
cacheWriteTokens
|
|
2267
2332
|
});
|
|
2268
2333
|
}
|
|
2269
2334
|
};
|
|
@@ -2439,7 +2504,7 @@ async function resolveVertexAccessToken() {
|
|
|
2439
2504
|
async function getAuthClientOrThrow() {
|
|
2440
2505
|
let mod;
|
|
2441
2506
|
try {
|
|
2442
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
2507
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-HLPSLDGL.cjs', document.baseURI).href)));
|
|
2443
2508
|
mod = r("google-auth-library");
|
|
2444
2509
|
} catch (err) {
|
|
2445
2510
|
const isModuleMissing = err instanceof Error && (err.message.includes("Cannot find module") || err.code === "MODULE_NOT_FOUND");
|
|
@@ -2500,8 +2565,8 @@ var VertexAnthropicClient = class {
|
|
|
2500
2565
|
const projectId = this.resolveProjectOrThrow();
|
|
2501
2566
|
const location = this.options.location ?? resolveVertexLocation();
|
|
2502
2567
|
const accessToken = await this.resolveTokenOrThrow();
|
|
2503
|
-
const baseUrl =
|
|
2504
|
-
const bareModel =
|
|
2568
|
+
const baseUrl = chunkNIRE5CNO_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "anthropic" });
|
|
2569
|
+
const bareModel = chunkNIRE5CNO_cjs.stripVertexPrefix(request.model);
|
|
2505
2570
|
const endpoint = `/models/${encodeURIComponent(bareModel)}:rawPredict`;
|
|
2506
2571
|
const url = `${baseUrl}${endpoint}`;
|
|
2507
2572
|
const response = await postAnthropicRequest({
|
|
@@ -2550,7 +2615,7 @@ var VertexGeminiClient = class {
|
|
|
2550
2615
|
{ code: "auth_failed" }
|
|
2551
2616
|
);
|
|
2552
2617
|
}
|
|
2553
|
-
const baseUrl =
|
|
2618
|
+
const baseUrl = chunkNIRE5CNO_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "gemini" });
|
|
2554
2619
|
const url = `${baseUrl}/chat/completions`;
|
|
2555
2620
|
const innerFetch = this.options.fetch ?? fetch;
|
|
2556
2621
|
const rewriteFetch = (_input, init) => innerFetch(url, init);
|
|
@@ -2572,7 +2637,7 @@ var VertexRouterClient = class {
|
|
|
2572
2637
|
options;
|
|
2573
2638
|
name = "vertex";
|
|
2574
2639
|
async *stream(request, signal) {
|
|
2575
|
-
const dialect =
|
|
2640
|
+
const dialect = chunkNIRE5CNO_cjs.inferModelDialect(request.model);
|
|
2576
2641
|
if (dialect === "anthropic") {
|
|
2577
2642
|
const inner2 = new VertexAnthropicClient(this.options);
|
|
2578
2643
|
return yield* inner2.stream(request, signal);
|
|
@@ -2584,7 +2649,7 @@ var VertexRouterClient = class {
|
|
|
2584
2649
|
|
|
2585
2650
|
// src/internal/llm/router.ts
|
|
2586
2651
|
function resolveProviderChain(options) {
|
|
2587
|
-
|
|
2652
|
+
chunkNIRE5CNO_cjs.registerBuiltins();
|
|
2588
2653
|
return buildChain(options);
|
|
2589
2654
|
}
|
|
2590
2655
|
function buildChain(options) {
|
|
@@ -2609,7 +2674,7 @@ function buildChain(options) {
|
|
|
2609
2674
|
return clients;
|
|
2610
2675
|
}
|
|
2611
2676
|
function buildClient(name, routerOptions, perCallBaseUrl) {
|
|
2612
|
-
const baseProfile =
|
|
2677
|
+
const baseProfile = chunkNIRE5CNO_cjs.getProviderProfile(name);
|
|
2613
2678
|
if (baseProfile === void 0) return void 0;
|
|
2614
2679
|
const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
|
|
2615
2680
|
const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
|
|
@@ -2704,7 +2769,7 @@ function warnUnknownProvidersInApiKeys(apiKeys) {
|
|
|
2704
2769
|
if (apiKeys === void 0) return;
|
|
2705
2770
|
for (const name of Object.keys(apiKeys)) {
|
|
2706
2771
|
if (warnedProviders.has(name)) continue;
|
|
2707
|
-
const profile =
|
|
2772
|
+
const profile = chunkNIRE5CNO_cjs.getProviderProfile(name);
|
|
2708
2773
|
if (profile === void 0) {
|
|
2709
2774
|
warnedProviders.add(name);
|
|
2710
2775
|
chunkNUKRL3I6_cjs.diag(
|
|
@@ -2792,6 +2857,9 @@ function selectTransport(profile, apiKey, baseUrl) {
|
|
|
2792
2857
|
...(baseUrl ?? profile.baseUrl) !== void 0 ? { baseUrl: baseUrl ?? profile.baseUrl } : {},
|
|
2793
2858
|
...mergedHeaders !== void 0 ? { extraHeaders: mergedHeaders } : {},
|
|
2794
2859
|
...t.fetch !== void 0 ? { fetch: t.fetch } : {},
|
|
2860
|
+
// usetheokit/theokit-sdk#383 — forwarded only when the profile declares it, so a provider that
|
|
2861
|
+
// has not been measured against `reasoning.context` keeps the request it had.
|
|
2862
|
+
...profile.encryptedReasoning === true ? { encryptedReasoning: true } : {},
|
|
2795
2863
|
providerName: profile.name
|
|
2796
2864
|
});
|
|
2797
2865
|
}
|
|
@@ -2805,7 +2873,7 @@ function selectTransport(profile, apiKey, baseUrl) {
|
|
|
2805
2873
|
function inferProviderFromApiKey(apiKey) {
|
|
2806
2874
|
const provider = chunkFRITRLZQ_cjs.providerFromApiKeyPrefix(apiKey);
|
|
2807
2875
|
if (provider === void 0) return void 0;
|
|
2808
|
-
return
|
|
2876
|
+
return chunkNIRE5CNO_cjs.getProviderProfile(provider) === void 0 ? void 0 : provider;
|
|
2809
2877
|
}
|
|
2810
2878
|
function detectPrimaryProvider() {
|
|
2811
2879
|
if (process.env.ANTHROPIC_API_KEY !== void 0 && process.env.ANTHROPIC_API_KEY.length > 0) {
|
|
@@ -3000,9 +3068,9 @@ function resolveSummarizerRoute(opts) {
|
|
|
3000
3068
|
}
|
|
3001
3069
|
function buildDefaultSummarizer(opts) {
|
|
3002
3070
|
return async (messages) => {
|
|
3003
|
-
|
|
3071
|
+
chunkNIRE5CNO_cjs.registerBuiltins();
|
|
3004
3072
|
const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
|
|
3005
|
-
const prefixProfile = modelPrefix !== void 0 ?
|
|
3073
|
+
const prefixProfile = modelPrefix !== void 0 ? chunkNIRE5CNO_cjs.getProviderProfile(modelPrefix) : void 0;
|
|
3006
3074
|
const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
|
|
3007
3075
|
const route = resolveSummarizerRoute({
|
|
3008
3076
|
keyProvider: inferProviderFromApiKey(opts.apiKey),
|
|
@@ -3106,5 +3174,5 @@ exports.shouldUseFixtureMode = shouldUseFixtureMode;
|
|
|
3106
3174
|
exports.shouldUseRealLocalRuntime = shouldUseRealLocalRuntime;
|
|
3107
3175
|
exports.tryFirstEvent = tryFirstEvent;
|
|
3108
3176
|
exports.warnProviderPrecedenceOnce = warnProviderPrecedenceOnce;
|
|
3109
|
-
//# sourceMappingURL=chunk-
|
|
3110
|
-
//# sourceMappingURL=chunk-
|
|
3177
|
+
//# sourceMappingURL=chunk-HLPSLDGL.cjs.map
|
|
3178
|
+
//# sourceMappingURL=chunk-HLPSLDGL.cjs.map
|