@theokit/sdk 2.11.3 → 2.13.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 +12 -0
- package/dist/a2a/index.cjs +85 -6
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +85 -6
- package/dist/a2a/index.js.map +1 -1
- package/dist/{cron-BRfFPEKY.d.ts → cron-CL_9nfhQ.d.ts} +18 -0
- package/dist/{cron-DOw-Hqol.d.cts → cron-CpxLdAXc.d.cts} +18 -0
- package/dist/cron.cjs +79 -6
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +1 -1
- package/dist/cron.d.ts +1 -1
- package/dist/cron.js +79 -6
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +79 -6
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +79 -6
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +79 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +79 -6
- package/dist/index.js.map +1 -1
- package/dist/internal/llm/hermes-tool-extract.d.ts +6 -0
- package/dist/internal/llm/openai.d.ts +7 -0
- package/dist/internal/llm/router.d.ts +8 -0
- package/dist/internal/providers/types.d.ts +7 -0
- package/dist/types/providers.d.ts +11 -0
- package/package.json +14 -14
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-9yw4UQwX.cjs';
|
|
2
2
|
export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, E as ErrorCode, m as ErrorMetadata, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-9yw4UQwX.cjs';
|
|
3
|
-
import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as ProviderProfile, m as Plugin, n as ConversationStorageAdapter, o as StoredMessage, B as BudgetTracker, p as MemoryProvider, q as MemoryId, r as PreToolCallDecision, s as SDKProvider } from './cron-
|
|
4
|
-
export { t as ActiveMemoryPassArgs, u as ActiveMemoryPassResult, v as AgentMemory, w as BudgetCheck, x as BudgetTotal, y as BudgetUsageEvent, z as CloudEnv, D as CloudRepo, E as ContextBudget, F as ContextManagerKind, H as ContextSnapshot, I as ContextSource, J as ContextSourceStatus, K as Cron, N as CronCreateOptions, O as CronGetOptions, Q as CronJob, R as CronJobStatus, T as CronListOptions, U as CronOperationOptions, V as CronRunOptions, W as CronRuntime, X as CronSchedulerStatus, Y as CronStartOptions, Z as GoalEvent, _ as GoalOptions, $ as GoalResult, a0 as HookName, a1 as InvalidateCacheOptions, a2 as MemoryAdapter, a3 as MemoryAdapterCapabilities, a4 as MemoryContext, a5 as MemoryFact, a6 as MemoryProviderHandle, a7 as MemoryProviderInitOptions, a8 as MemoryRevision, a9 as MemoryToolSchema, aa as MemoryTurnMessage, ab as PersonalityPreset, ac as PluginContext, ad as PostAssistantReplyContext, ae as PreToolCallContext, af as PreUserSendContext, ag as PreUserSendResult, ah as ProviderCapability, ai as ProviderRoute, aj as RecordSessionSummaryArgs, ak as ResolvedProviderRoute, al as RunUntilIterator, am as SDKAgentPlugins, an as SDKAgentSkills, ao as SDKArtifact, ap as SDKContextManager, aq as SDKPluginMetadata, ar as SDKProvidersManager, as as SettingSource, at as SystemPromptContext, au as SystemPromptMemoryFact, av as SystemPromptSkillRef, aw as TelemetrySettings, ax as definePlugin } from './cron-
|
|
3
|
+
import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as ProviderProfile, m as Plugin, n as ConversationStorageAdapter, o as StoredMessage, B as BudgetTracker, p as MemoryProvider, q as MemoryId, r as PreToolCallDecision, s as SDKProvider } from './cron-CpxLdAXc.cjs';
|
|
4
|
+
export { t as ActiveMemoryPassArgs, u as ActiveMemoryPassResult, v as AgentMemory, w as BudgetCheck, x as BudgetTotal, y as BudgetUsageEvent, z as CloudEnv, D as CloudRepo, E as ContextBudget, F as ContextManagerKind, H as ContextSnapshot, I as ContextSource, J as ContextSourceStatus, K as Cron, N as CronCreateOptions, O as CronGetOptions, Q as CronJob, R as CronJobStatus, T as CronListOptions, U as CronOperationOptions, V as CronRunOptions, W as CronRuntime, X as CronSchedulerStatus, Y as CronStartOptions, Z as GoalEvent, _ as GoalOptions, $ as GoalResult, a0 as HookName, a1 as InvalidateCacheOptions, a2 as MemoryAdapter, a3 as MemoryAdapterCapabilities, a4 as MemoryContext, a5 as MemoryFact, a6 as MemoryProviderHandle, a7 as MemoryProviderInitOptions, a8 as MemoryRevision, a9 as MemoryToolSchema, aa as MemoryTurnMessage, ab as PersonalityPreset, ac as PluginContext, ad as PostAssistantReplyContext, ae as PreToolCallContext, af as PreUserSendContext, ag as PreUserSendResult, ah as ProviderCapability, ai as ProviderRoute, aj as RecordSessionSummaryArgs, ak as ResolvedProviderRoute, al as RunUntilIterator, am as SDKAgentPlugins, an as SDKAgentSkills, ao as SDKArtifact, ap as SDKContextManager, aq as SDKPluginMetadata, ar as SDKProvidersManager, as as SettingSource, at as SystemPromptContext, au as SystemPromptMemoryFact, av as SystemPromptSkillRef, aw as TelemetrySettings, ax as definePlugin } from './cron-CpxLdAXc.cjs';
|
|
5
5
|
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, S as SDKMessage } from './run-TMdc7gmo.cjs';
|
|
6
6
|
export { A as AgentConversationTurn, c as AssistantMessage, d as ConversationStep, e as ConversationTurn, f as CostBreakdown, g as CostSource, h as CostStatus, I as InteractionUpdate, i as McpAuthConfig, j as McpHttpServerConfig, k as McpOAuthConfig, l as McpStdioServerConfig, m as ModelParameterValue, P as PartialToolCallUpdate, n as RunErrorDetail, o as RunGitInfo, p as RunOperation, q as RunStatus, r as RunToCompletionOptions, s as RunToCompletionResult, t as SDKAssistantMessage, u as SDKImage, v as SDKImageDimension, w as SDKObjectDelta, x as SDKRequestMessage, y as SDKStatusMessage, z as SDKSystemMessage, B as SDKTaskMessage, D as SDKThinkingMessage, E as SDKToolUseMessage, F as SDKUserMessage, G as SDKUserMessageEvent, H as SendOptions, J as ShellCommand, K as ShellConversationTurn, L as ShellOutput, N as ShellOutputDeltaUpdate, O as StepCompletedUpdate, Q as StepStartedUpdate, T as StreamToCompletionResult, U as SummaryCompletedUpdate, V as SummaryStartedUpdate, W as SummaryUpdate, X as TextBlock, Y as TextDeltaUpdate, Z as ThinkingCompletedUpdate, _ as ThinkingDeltaUpdate, $ as ThinkingMessage, a0 as TokenDeltaUpdate, a1 as TokenUsage, a2 as ToolCall, a3 as ToolCallCompletedUpdate, a4 as ToolCallStartedUpdate, a5 as ToolResult, a6 as ToolUseBlock, a7 as TurnEndedUpdate, a8 as UserMessage, a9 as UserMessageAppendedUpdate } from './run-TMdc7gmo.cjs';
|
|
7
7
|
import * as zod from 'zod';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-DFiY-NHK.js';
|
|
2
2
|
export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, E as ErrorCode, m as ErrorMetadata, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-DFiY-NHK.js';
|
|
3
|
-
import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as ProviderProfile, m as Plugin, n as ConversationStorageAdapter, o as StoredMessage, B as BudgetTracker, p as MemoryProvider, q as MemoryId, r as PreToolCallDecision, s as SDKProvider } from './cron-
|
|
4
|
-
export { t as ActiveMemoryPassArgs, u as ActiveMemoryPassResult, v as AgentMemory, w as BudgetCheck, x as BudgetTotal, y as BudgetUsageEvent, z as CloudEnv, D as CloudRepo, E as ContextBudget, F as ContextManagerKind, H as ContextSnapshot, I as ContextSource, J as ContextSourceStatus, K as Cron, N as CronCreateOptions, O as CronGetOptions, Q as CronJob, R as CronJobStatus, T as CronListOptions, U as CronOperationOptions, V as CronRunOptions, W as CronRuntime, X as CronSchedulerStatus, Y as CronStartOptions, Z as GoalEvent, _ as GoalOptions, $ as GoalResult, a0 as HookName, a1 as InvalidateCacheOptions, a2 as MemoryAdapter, a3 as MemoryAdapterCapabilities, a4 as MemoryContext, a5 as MemoryFact, a6 as MemoryProviderHandle, a7 as MemoryProviderInitOptions, a8 as MemoryRevision, a9 as MemoryToolSchema, aa as MemoryTurnMessage, ab as PersonalityPreset, ac as PluginContext, ad as PostAssistantReplyContext, ae as PreToolCallContext, af as PreUserSendContext, ag as PreUserSendResult, ah as ProviderCapability, ai as ProviderRoute, aj as RecordSessionSummaryArgs, ak as ResolvedProviderRoute, al as RunUntilIterator, am as SDKAgentPlugins, an as SDKAgentSkills, ao as SDKArtifact, ap as SDKContextManager, aq as SDKPluginMetadata, ar as SDKProvidersManager, as as SettingSource, at as SystemPromptContext, au as SystemPromptMemoryFact, av as SystemPromptSkillRef, aw as TelemetrySettings, ax as definePlugin } from './cron-
|
|
3
|
+
import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as ProviderProfile, m as Plugin, n as ConversationStorageAdapter, o as StoredMessage, B as BudgetTracker, p as MemoryProvider, q as MemoryId, r as PreToolCallDecision, s as SDKProvider } from './cron-CL_9nfhQ.js';
|
|
4
|
+
export { t as ActiveMemoryPassArgs, u as ActiveMemoryPassResult, v as AgentMemory, w as BudgetCheck, x as BudgetTotal, y as BudgetUsageEvent, z as CloudEnv, D as CloudRepo, E as ContextBudget, F as ContextManagerKind, H as ContextSnapshot, I as ContextSource, J as ContextSourceStatus, K as Cron, N as CronCreateOptions, O as CronGetOptions, Q as CronJob, R as CronJobStatus, T as CronListOptions, U as CronOperationOptions, V as CronRunOptions, W as CronRuntime, X as CronSchedulerStatus, Y as CronStartOptions, Z as GoalEvent, _ as GoalOptions, $ as GoalResult, a0 as HookName, a1 as InvalidateCacheOptions, a2 as MemoryAdapter, a3 as MemoryAdapterCapabilities, a4 as MemoryContext, a5 as MemoryFact, a6 as MemoryProviderHandle, a7 as MemoryProviderInitOptions, a8 as MemoryRevision, a9 as MemoryToolSchema, aa as MemoryTurnMessage, ab as PersonalityPreset, ac as PluginContext, ad as PostAssistantReplyContext, ae as PreToolCallContext, af as PreUserSendContext, ag as PreUserSendResult, ah as ProviderCapability, ai as ProviderRoute, aj as RecordSessionSummaryArgs, ak as ResolvedProviderRoute, al as RunUntilIterator, am as SDKAgentPlugins, an as SDKAgentSkills, ao as SDKArtifact, ap as SDKContextManager, aq as SDKPluginMetadata, ar as SDKProvidersManager, as as SettingSource, at as SystemPromptContext, au as SystemPromptMemoryFact, av as SystemPromptSkillRef, aw as TelemetrySettings, ax as definePlugin } from './cron-CL_9nfhQ.js';
|
|
5
5
|
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, S as SDKMessage } from './run-TMdc7gmo.js';
|
|
6
6
|
export { A as AgentConversationTurn, c as AssistantMessage, d as ConversationStep, e as ConversationTurn, f as CostBreakdown, g as CostSource, h as CostStatus, I as InteractionUpdate, i as McpAuthConfig, j as McpHttpServerConfig, k as McpOAuthConfig, l as McpStdioServerConfig, m as ModelParameterValue, P as PartialToolCallUpdate, n as RunErrorDetail, o as RunGitInfo, p as RunOperation, q as RunStatus, r as RunToCompletionOptions, s as RunToCompletionResult, t as SDKAssistantMessage, u as SDKImage, v as SDKImageDimension, w as SDKObjectDelta, x as SDKRequestMessage, y as SDKStatusMessage, z as SDKSystemMessage, B as SDKTaskMessage, D as SDKThinkingMessage, E as SDKToolUseMessage, F as SDKUserMessage, G as SDKUserMessageEvent, H as SendOptions, J as ShellCommand, K as ShellConversationTurn, L as ShellOutput, N as ShellOutputDeltaUpdate, O as StepCompletedUpdate, Q as StepStartedUpdate, T as StreamToCompletionResult, U as SummaryCompletedUpdate, V as SummaryStartedUpdate, W as SummaryUpdate, X as TextBlock, Y as TextDeltaUpdate, Z as ThinkingCompletedUpdate, _ as ThinkingDeltaUpdate, $ as ThinkingMessage, a0 as TokenDeltaUpdate, a1 as TokenUsage, a2 as ToolCall, a3 as ToolCallCompletedUpdate, a4 as ToolCallStartedUpdate, a5 as ToolResult, a6 as ToolUseBlock, a7 as TurnEndedUpdate, a8 as UserMessage, a9 as UserMessageAppendedUpdate } from './run-TMdc7gmo.js';
|
|
7
7
|
import * as zod from 'zod';
|
package/dist/index.js
CHANGED
|
@@ -13425,6 +13425,35 @@ function toOllamaTools(tools) {
|
|
|
13425
13425
|
}));
|
|
13426
13426
|
}
|
|
13427
13427
|
|
|
13428
|
+
// src/internal/llm/hermes-tool-extract.ts
|
|
13429
|
+
var HERMES_BLOCK = /<function=\s*([^>\s]+)\s*>([\s\S]*?)<\/tool_call>/g;
|
|
13430
|
+
var HERMES_PARAM = /<parameter=\s*([^>\s]+)\s*>([\s\S]*?)<\/parameter>/g;
|
|
13431
|
+
function extractHermesToolCalls(content, makeId) {
|
|
13432
|
+
const toolCalls = [];
|
|
13433
|
+
for (const block of content.matchAll(HERMES_BLOCK)) {
|
|
13434
|
+
const name = (block[1] ?? "").trim();
|
|
13435
|
+
if (name.length === 0) continue;
|
|
13436
|
+
toolCalls.push({
|
|
13437
|
+
type: "tool_use",
|
|
13438
|
+
id: makeId(),
|
|
13439
|
+
name,
|
|
13440
|
+
input: parseHermesParams(block[2] ?? "")
|
|
13441
|
+
});
|
|
13442
|
+
}
|
|
13443
|
+
const residualText = toolCalls.length === 0 ? content : content.replace(HERMES_BLOCK, "").trim();
|
|
13444
|
+
return { toolCalls, residualText };
|
|
13445
|
+
}
|
|
13446
|
+
function parseHermesParams(inner) {
|
|
13447
|
+
const input = {};
|
|
13448
|
+
for (const param of inner.matchAll(HERMES_PARAM)) {
|
|
13449
|
+
const key2 = param[1];
|
|
13450
|
+
const value = param[2];
|
|
13451
|
+
if (key2 === void 0 || value === void 0) continue;
|
|
13452
|
+
input[key2.trim()] = value;
|
|
13453
|
+
}
|
|
13454
|
+
return input;
|
|
13455
|
+
}
|
|
13456
|
+
|
|
13428
13457
|
// src/internal/llm/openai.ts
|
|
13429
13458
|
var OpenAIClient = class {
|
|
13430
13459
|
constructor(options) {
|
|
@@ -13436,6 +13465,14 @@ var OpenAIClient = class {
|
|
|
13436
13465
|
name = "openai";
|
|
13437
13466
|
baseUrl;
|
|
13438
13467
|
fetchImpl;
|
|
13468
|
+
/**
|
|
13469
|
+
* Whether this client recovers leaked Hermes tool-call dialect from assistant
|
|
13470
|
+
* text (theokit#58 follow-up). Observability for the route→client wiring of
|
|
13471
|
+
* `extractToolCallsFromContent`. @internal
|
|
13472
|
+
*/
|
|
13473
|
+
get recoversLeakedToolCalls() {
|
|
13474
|
+
return this.options.extractToolCallsFromContent ?? false;
|
|
13475
|
+
}
|
|
13439
13476
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: HTTP+SSE handshake + accumulator is intentionally one block
|
|
13440
13477
|
async *stream(request, signal) {
|
|
13441
13478
|
const headers = {
|
|
@@ -13486,7 +13523,10 @@ var OpenAIClient = class {
|
|
|
13486
13523
|
endpoint: "/v1/chat/completions"
|
|
13487
13524
|
});
|
|
13488
13525
|
}
|
|
13489
|
-
const accumulator = new OpenAIStreamAccumulator(
|
|
13526
|
+
const accumulator = new OpenAIStreamAccumulator(
|
|
13527
|
+
this.options.extractToolCallsFromContent ?? false,
|
|
13528
|
+
providerId
|
|
13529
|
+
);
|
|
13490
13530
|
for await (const record of parseSseStream(response.body, signal)) {
|
|
13491
13531
|
if (record.data === "[DONE]") break;
|
|
13492
13532
|
let chunk;
|
|
@@ -13512,6 +13552,16 @@ var OpenAIClient = class {
|
|
|
13512
13552
|
}
|
|
13513
13553
|
};
|
|
13514
13554
|
var OpenAIStreamAccumulator = class {
|
|
13555
|
+
/**
|
|
13556
|
+
* @param extractFromContent opt-in leaked-dialect safe-parse (theokit#58). Default false.
|
|
13557
|
+
* @param providerName provider id, used only to label the recovery log line.
|
|
13558
|
+
*/
|
|
13559
|
+
constructor(extractFromContent = false, providerName = "openai") {
|
|
13560
|
+
this.extractFromContent = extractFromContent;
|
|
13561
|
+
this.providerName = providerName;
|
|
13562
|
+
}
|
|
13563
|
+
extractFromContent;
|
|
13564
|
+
providerName;
|
|
13515
13565
|
text = "";
|
|
13516
13566
|
stopReason = "end_turn";
|
|
13517
13567
|
inputTokens;
|
|
@@ -13577,9 +13627,26 @@ var OpenAIStreamAccumulator = class {
|
|
|
13577
13627
|
const input = parseToolArguments(call.args);
|
|
13578
13628
|
toolCalls.push({ type: "tool_use", id: call.id, name: call.name, input });
|
|
13579
13629
|
}
|
|
13630
|
+
let text = this.text;
|
|
13631
|
+
let stopReason = this.stopReason;
|
|
13632
|
+
if (this.extractFromContent && toolCalls.length === 0) {
|
|
13633
|
+
const recovered = extractHermesToolCalls(
|
|
13634
|
+
this.text,
|
|
13635
|
+
() => `hermes-${globalThis.crypto.randomUUID()}`
|
|
13636
|
+
);
|
|
13637
|
+
if (recovered.toolCalls.length > 0) {
|
|
13638
|
+
toolCalls.push(...recovered.toolCalls);
|
|
13639
|
+
text = recovered.residualText;
|
|
13640
|
+
stopReason = "tool_use";
|
|
13641
|
+
process.stderr.write(
|
|
13642
|
+
`[theokit-sdk] recovered ${recovered.toolCalls.length} leaked tool call(s) from assistant content (provider="${this.providerName}", names=${recovered.toolCalls.map((c) => c.name).join(",")})
|
|
13643
|
+
`
|
|
13644
|
+
);
|
|
13645
|
+
}
|
|
13646
|
+
}
|
|
13580
13647
|
return makeLlmFinish({
|
|
13581
|
-
stopReason
|
|
13582
|
-
text
|
|
13648
|
+
stopReason,
|
|
13649
|
+
text,
|
|
13583
13650
|
toolCalls,
|
|
13584
13651
|
inputTokens: this.inputTokens,
|
|
13585
13652
|
outputTokens: this.outputTokens,
|
|
@@ -14056,8 +14123,9 @@ function buildChain(options) {
|
|
|
14056
14123
|
return clients;
|
|
14057
14124
|
}
|
|
14058
14125
|
function buildClient(name, routerOptions) {
|
|
14059
|
-
const
|
|
14060
|
-
if (
|
|
14126
|
+
const baseProfile = getProviderProfile(name);
|
|
14127
|
+
if (baseProfile === void 0) return void 0;
|
|
14128
|
+
const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
|
|
14061
14129
|
const ambient = currentCredentialPool(name);
|
|
14062
14130
|
if (ambient !== void 0) {
|
|
14063
14131
|
return new PoolAwareLlmClient(ambient, (apiKey) => selectTransport(profile, apiKey));
|
|
@@ -14159,6 +14227,9 @@ function selectTransport(profile, apiKey) {
|
|
|
14159
14227
|
const opts = { apiKey };
|
|
14160
14228
|
opts.baseUrl = profile.baseUrl;
|
|
14161
14229
|
opts.providerName = profile.name;
|
|
14230
|
+
if (profile.extractToolCallsFromContent === true) {
|
|
14231
|
+
opts.extractToolCallsFromContent = true;
|
|
14232
|
+
}
|
|
14162
14233
|
if (profile.name === "openai" && process.env.OPENAI_ORGANIZATION !== void 0) {
|
|
14163
14234
|
opts.organization = process.env.OPENAI_ORGANIZATION;
|
|
14164
14235
|
}
|
|
@@ -14456,11 +14527,13 @@ function buildLoopInputs(options, runId, userText) {
|
|
|
14456
14527
|
const fallback = options.agentOptions.providers?.fallback;
|
|
14457
14528
|
const apiKeys = options.agentOptions.providers?.apiKeys;
|
|
14458
14529
|
const credentialPoolStrategy = options.agentOptions.providers?.credentialPoolStrategy;
|
|
14530
|
+
const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
|
|
14459
14531
|
const chain = resolveProviderChain({
|
|
14460
14532
|
primary,
|
|
14461
14533
|
...fallback !== void 0 ? { fallback } : {},
|
|
14462
14534
|
...apiKeys !== void 0 ? { apiKeys } : {},
|
|
14463
|
-
...credentialPoolStrategy !== void 0 ? { credentialPoolStrategy } : {}
|
|
14535
|
+
...credentialPoolStrategy !== void 0 ? { credentialPoolStrategy } : {},
|
|
14536
|
+
...extractToolCallsFromContent === true ? { extractToolCallsFromContent: true } : {}
|
|
14464
14537
|
});
|
|
14465
14538
|
const llm = chain.length === 1 ? chain[0] : new FallbackLlmClient(chain);
|
|
14466
14539
|
return {
|