@theokit/sdk 2.11.0 → 2.11.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 +12 -0
- package/dist/a2a/index.cjs +73 -9
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +73 -9
- package/dist/a2a/index.js.map +1 -1
- package/dist/{cron-CZlMLA1K.d.ts → cron-BRfFPEKY.d.ts} +1 -1
- package/dist/{cron-BNI8pyn_.d.cts → cron-DOw-Hqol.d.cts} +1 -1
- package/dist/cron.cjs +73 -9
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +73 -9
- package/dist/cron.js.map +1 -1
- package/dist/{errors-FKoM44Mj.d.cts → errors-9yw4UQwX.d.cts} +1 -1
- package/dist/{errors-C8EVGqje.d.ts → errors-DFiY-NHK.d.ts} +1 -1
- package/dist/errors.d.cts +2 -2
- package/dist/eval.cjs +73 -9
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +73 -9
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +73 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +73 -9
- package/dist/index.js.map +1 -1
- package/dist/internal/agent-loop/message-builders.d.ts +3 -1
- package/dist/internal/llm/openai.d.ts +64 -0
- package/dist/internal/llm/types.d.ts +23 -0
- package/dist/{run-D22b53SU.d.cts → run-TMdc7gmo.d.cts} +7 -0
- package/dist/{run-D22b53SU.d.ts → run-TMdc7gmo.d.ts} +7 -0
- package/dist/types/run.d.ts +7 -0
- package/package.json +14 -14
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-
|
|
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-
|
|
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-
|
|
5
|
-
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, S as SDKMessage } from './run-
|
|
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-
|
|
1
|
+
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-9yw4UQwX.cjs';
|
|
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-DOw-Hqol.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-DOw-Hqol.cjs';
|
|
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
|
+
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';
|
|
8
8
|
import { ZodType, z } from 'zod';
|
|
9
9
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-
|
|
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-
|
|
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-
|
|
5
|
-
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, S as SDKMessage } from './run-
|
|
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-
|
|
1
|
+
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-DFiY-NHK.js';
|
|
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-BRfFPEKY.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-BRfFPEKY.js';
|
|
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
|
+
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';
|
|
8
8
|
import { ZodType, z } from 'zod';
|
|
9
9
|
|
package/dist/index.js
CHANGED
|
@@ -10802,6 +10802,14 @@ function buildAssistantEvent(inputs, text) {
|
|
|
10802
10802
|
message: { role: "assistant", content: [{ type: "text", text }] }
|
|
10803
10803
|
};
|
|
10804
10804
|
}
|
|
10805
|
+
function buildThinkingEvent(inputs, text) {
|
|
10806
|
+
return {
|
|
10807
|
+
type: "thinking",
|
|
10808
|
+
agent_id: inputs.agentId,
|
|
10809
|
+
run_id: inputs.runId,
|
|
10810
|
+
text
|
|
10811
|
+
};
|
|
10812
|
+
}
|
|
10805
10813
|
function buildAssistantTurn(text, toolCalls) {
|
|
10806
10814
|
const content = [];
|
|
10807
10815
|
if (text.length > 0) content.push({ type: "text", text });
|
|
@@ -10972,6 +10980,10 @@ ${additions}`;
|
|
|
10972
10980
|
function toLlmTool(tool) {
|
|
10973
10981
|
return { name: tool.name, description: tool.description, inputSchema: tool.inputSchema };
|
|
10974
10982
|
}
|
|
10983
|
+
function reasoningEffortFromParams(params) {
|
|
10984
|
+
const thinking = params?.find((p) => p.id === "thinking");
|
|
10985
|
+
return thinking !== void 0 && thinking.value.length > 0 ? thinking.value : void 0;
|
|
10986
|
+
}
|
|
10975
10987
|
async function streamLlmTurn(inputs, ctx) {
|
|
10976
10988
|
const llmSpan = inputs.telemetry?.startSpan("llm.call", {
|
|
10977
10989
|
"model.id": inputs.model.id ?? "auto",
|
|
@@ -10988,6 +11000,15 @@ async function streamLlmTurn(inputs, ctx) {
|
|
|
10988
11000
|
);
|
|
10989
11001
|
return effective !== void 0 ? { system: effective } : {};
|
|
10990
11002
|
})(),
|
|
11003
|
+
// issue #47: forward the reasoning effort from ModelSelection.params (the `thinking` param)
|
|
11004
|
+
// so the provider produces reasoning. Absent param ⇒ no `reasoning` field (bare request).
|
|
11005
|
+
...(() => {
|
|
11006
|
+
const effort = reasoningEffortFromParams(inputs.model.params);
|
|
11007
|
+
return effort !== void 0 ? { reasoning: { effort } } : {};
|
|
11008
|
+
})(),
|
|
11009
|
+
// Step-cap force-close: forward the per-run tool gate (`"none"` on a ceiling round forces a
|
|
11010
|
+
// text close even though tools are advertised). Absent ⇒ provider default (auto).
|
|
11011
|
+
...inputs.toolChoice !== void 0 ? { toolChoice: inputs.toolChoice } : {},
|
|
10991
11012
|
messages: ctx.messages,
|
|
10992
11013
|
tools: ctx.tools.map(toLlmTool)
|
|
10993
11014
|
},
|
|
@@ -11056,6 +11077,7 @@ function registerLoopError(ctx, cause) {
|
|
|
11056
11077
|
}
|
|
11057
11078
|
async function runCollectorLoop(generator, inputs, ctx) {
|
|
11058
11079
|
let accumulatedText = "";
|
|
11080
|
+
let reasoningText = "";
|
|
11059
11081
|
let errored = false;
|
|
11060
11082
|
let finishValue;
|
|
11061
11083
|
while (true) {
|
|
@@ -11068,6 +11090,10 @@ async function runCollectorLoop(generator, inputs, ctx) {
|
|
|
11068
11090
|
accumulatedText += next.value.text;
|
|
11069
11091
|
await emitTextDeltaCallback(inputs, next.value.text);
|
|
11070
11092
|
}
|
|
11093
|
+
if (next.value.type === "reasoning_delta") {
|
|
11094
|
+
reasoningText += next.value.text;
|
|
11095
|
+
await emitReasoningDeltaCallback(inputs, next.value.text);
|
|
11096
|
+
}
|
|
11071
11097
|
if (next.value.type === "error") {
|
|
11072
11098
|
registerLoopError(ctx, next.value);
|
|
11073
11099
|
ctx.finalText = "";
|
|
@@ -11075,6 +11101,9 @@ async function runCollectorLoop(generator, inputs, ctx) {
|
|
|
11075
11101
|
break;
|
|
11076
11102
|
}
|
|
11077
11103
|
}
|
|
11104
|
+
if (reasoningText.length > 0) {
|
|
11105
|
+
ctx.events.push(buildThinkingEvent(inputs, reasoningText));
|
|
11106
|
+
}
|
|
11078
11107
|
return { accumulatedText, errored, finishValue };
|
|
11079
11108
|
}
|
|
11080
11109
|
async function emitTextDeltaCallback(inputs, text) {
|
|
@@ -11086,6 +11115,15 @@ async function emitTextDeltaCallback(inputs, text) {
|
|
|
11086
11115
|
"SendOptions.onDelta"
|
|
11087
11116
|
);
|
|
11088
11117
|
}
|
|
11118
|
+
async function emitReasoningDeltaCallback(inputs, text) {
|
|
11119
|
+
if (inputs.onDelta === void 0) return;
|
|
11120
|
+
const cb = inputs.onDelta;
|
|
11121
|
+
await safeCall(
|
|
11122
|
+
() => cb({ update: { type: "thinking-delta", text } }),
|
|
11123
|
+
void 0,
|
|
11124
|
+
"SendOptions.onDelta"
|
|
11125
|
+
);
|
|
11126
|
+
}
|
|
11089
11127
|
|
|
11090
11128
|
// src/internal/agent-loop/tool-dispatch.ts
|
|
11091
11129
|
init_async_local_storage();
|
|
@@ -13414,7 +13452,7 @@ var OpenAIClient = class {
|
|
|
13414
13452
|
method: "POST",
|
|
13415
13453
|
signal,
|
|
13416
13454
|
headers,
|
|
13417
|
-
body: JSON.stringify(buildOpenAIBody(request))
|
|
13455
|
+
body: JSON.stringify(buildOpenAIBody(request, providerId))
|
|
13418
13456
|
});
|
|
13419
13457
|
} catch (fetchErr) {
|
|
13420
13458
|
const mapped = mapOllamaTransportError({
|
|
@@ -13476,6 +13514,10 @@ var OpenAIStreamAccumulator = class {
|
|
|
13476
13514
|
const events = [];
|
|
13477
13515
|
this.applyUsage(chunk.usage);
|
|
13478
13516
|
for (const choice of chunk.choices ?? []) {
|
|
13517
|
+
const reasoningEvent = this.applyReasoningDelta(
|
|
13518
|
+
choice.delta?.reasoning ?? choice.delta?.reasoning_content
|
|
13519
|
+
);
|
|
13520
|
+
if (reasoningEvent !== void 0) events.push(reasoningEvent);
|
|
13479
13521
|
const textEvent = this.applyContentDelta(choice.delta?.content);
|
|
13480
13522
|
if (textEvent !== void 0) events.push(textEvent);
|
|
13481
13523
|
this.mergeToolCallDeltas(choice.delta?.tool_calls);
|
|
@@ -13483,6 +13525,10 @@ var OpenAIStreamAccumulator = class {
|
|
|
13483
13525
|
}
|
|
13484
13526
|
return events;
|
|
13485
13527
|
}
|
|
13528
|
+
applyReasoningDelta(reasoning) {
|
|
13529
|
+
if (typeof reasoning !== "string" || reasoning.length === 0) return void 0;
|
|
13530
|
+
return { type: "reasoning_delta", text: reasoning };
|
|
13531
|
+
}
|
|
13486
13532
|
applyUsage(usage) {
|
|
13487
13533
|
if (usage?.prompt_tokens !== void 0) this.inputTokens = usage.prompt_tokens;
|
|
13488
13534
|
if (usage?.completion_tokens !== void 0) this.outputTokens = usage.completion_tokens;
|
|
@@ -13545,7 +13591,22 @@ function mapOpenAIFinish(reason) {
|
|
|
13545
13591
|
return "end_turn";
|
|
13546
13592
|
}
|
|
13547
13593
|
}
|
|
13548
|
-
function
|
|
13594
|
+
function applyReasoningRequest(body, effort, providerName) {
|
|
13595
|
+
if (providerName === "openai") {
|
|
13596
|
+
body.reasoning_effort = effort;
|
|
13597
|
+
return;
|
|
13598
|
+
}
|
|
13599
|
+
body.reasoning = { effort };
|
|
13600
|
+
}
|
|
13601
|
+
function applyToolsRequest(body, request) {
|
|
13602
|
+
if (request.tools === void 0 || request.tools.length === 0) return;
|
|
13603
|
+
body.tools = request.tools.map((tool) => ({
|
|
13604
|
+
type: "function",
|
|
13605
|
+
function: { name: tool.name, description: tool.description, parameters: tool.inputSchema }
|
|
13606
|
+
}));
|
|
13607
|
+
if (request.toolChoice !== void 0) body.tool_choice = request.toolChoice;
|
|
13608
|
+
}
|
|
13609
|
+
function buildOpenAIBody(request, providerName) {
|
|
13549
13610
|
const messages = [];
|
|
13550
13611
|
const systemText = openAISystemText(request.system);
|
|
13551
13612
|
if (systemText.length > 0) {
|
|
@@ -13564,12 +13625,9 @@ function buildOpenAIBody(request) {
|
|
|
13564
13625
|
};
|
|
13565
13626
|
if (request.maxTokens !== void 0) body.max_tokens = request.maxTokens;
|
|
13566
13627
|
if (request.temperature !== void 0) body.temperature = request.temperature;
|
|
13567
|
-
if (request.
|
|
13568
|
-
body
|
|
13569
|
-
|
|
13570
|
-
function: { name: tool.name, description: tool.description, parameters: tool.inputSchema }
|
|
13571
|
-
}));
|
|
13572
|
-
}
|
|
13628
|
+
if (request.reasoning?.effort !== void 0)
|
|
13629
|
+
applyReasoningRequest(body, request.reasoning.effort, providerName);
|
|
13630
|
+
applyToolsRequest(body, request);
|
|
13573
13631
|
const responseFormat = encodeOpenAIResponseFormat(request.responseFormat);
|
|
13574
13632
|
if (responseFormat !== void 0) body.response_format = responseFormat;
|
|
13575
13633
|
return body;
|
|
@@ -14398,7 +14456,12 @@ function buildLoopInputs(options, runId, userText) {
|
|
|
14398
14456
|
return {
|
|
14399
14457
|
agentId: options.agentId,
|
|
14400
14458
|
runId,
|
|
14401
|
-
|
|
14459
|
+
// issue #47: carry ModelSelection.params (the reasoning `thinking` param) into the loop so the
|
|
14460
|
+
// request can forward reasoning. The id is stripped/normalized above; params pass through as-is.
|
|
14461
|
+
model: {
|
|
14462
|
+
id: effectiveModelId,
|
|
14463
|
+
...options.model?.params !== void 0 ? { params: options.model.params } : {}
|
|
14464
|
+
},
|
|
14402
14465
|
userMessage: userText,
|
|
14403
14466
|
llm,
|
|
14404
14467
|
mcp: buildMcpMap(options),
|
|
@@ -14408,6 +14471,7 @@ function buildLoopInputs(options, runId, userText) {
|
|
|
14408
14471
|
...options.systemPrompt !== void 0 ? { systemPrompt: options.systemPrompt } : {},
|
|
14409
14472
|
...options.onStep !== void 0 ? { onStep: options.onStep } : {},
|
|
14410
14473
|
...options.onDelta !== void 0 ? { onDelta: options.onDelta } : {},
|
|
14474
|
+
...options.sendOptions.toolChoice !== void 0 ? { toolChoice: options.sendOptions.toolChoice } : {},
|
|
14411
14475
|
...options.priorMessages !== void 0 ? { priorMessages: options.priorMessages } : {},
|
|
14412
14476
|
...options.memoryTools !== void 0 && options.memoryTools.length > 0 ? { memoryTools: options.memoryTools } : {},
|
|
14413
14477
|
...buildCustomToolsInput(
|