@theokit/agents 4.29.0 → 4.30.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.
@@ -1,5 +1,5 @@
1
1
  import { ExecutionContext } from '@theokit/http';
2
- import { SystemPromptResolver, InlineSkill, SettingSource, MemorySettings, SkillsSettings, ContextSettings, PreToolCallContext, PreToolCallDecision, PostToolCallContext, ToolResultTransformContext, TransformContext, SessionLifecycleContext, PreUserSendContext, PreUserSendResult, PostAssistantReplyContext, CustomTool, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker, ModelSelection } from '@theokit/sdk';
2
+ import { SystemPromptResolver, InlineSkill, SettingSource, MemorySettings, SkillsSettings, ContextSettings, PreToolCallContext, PreToolCallDecision, PostToolCallContext, ToolResultTransformContext, TransformContext, SessionLifecycleContext, PreUserSendContext, PreUserSendResult, PostAssistantReplyContext, CustomTool, ModelSelection, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker } from '@theokit/sdk';
3
3
  import { z } from 'zod';
4
4
  import { UIMessageChunk } from 'ai';
5
5
  import { RetryOptions } from '@theokit/sdk/retry';
@@ -936,7 +936,7 @@ type BridgeImage = {
936
936
  };
937
937
  interface RuntimeOverrides {
938
938
  /** Overrides the model for this call (`?? compiled.model ?? default`). */
939
- model?: string;
939
+ model?: string | ModelSelection;
940
940
  /**
941
941
  * M35 (multimodal) — images to send alongside the text. When present, the SDK send switches from the
942
942
  * plain-string form to the structured `{ text, images }` form (`SDKUserMessage`). Absent ⇒ the
@@ -1004,7 +1004,7 @@ interface RuntimeOverrides {
1004
1004
  declare function createSdkAgentStream(compiled: CompiledAgentOptions, compiledTools: CompiledTool[], apiKey: string | (() => string | Promise<string>), overrides?: RuntimeOverrides): ((message: string, sessionId: string, factoryOpts?: {
1005
1005
  disableTools?: boolean;
1006
1006
  }) => AsyncIterable<StreamEvent>) & {
1007
- resolvedModel: string;
1007
+ resolvedModel: string | ModelSelection;
1008
1008
  };
1009
1009
  /**
1010
1010
  * The minimal `SDKAgent` surface a serving host needs (ACP checks `agentId: string` + `send: fn`).
@@ -1078,7 +1078,7 @@ declare function toAgentFactory(def: DefinicaoOuThunk, opts: {
1078
1078
  * effort it returns the bare `{ id }` — byte-identical to the prior behavior (backward-compat). With
1079
1079
  * an effort it adds the canonical reasoning param `{ id: 'thinking', value: effort }`. Pure.
1080
1080
  */
1081
- declare function buildModelSelection(modelId: string, effort?: ReasoningEffort): ModelSelection;
1081
+ declare function buildModelSelection(model: string | ModelSelection, effort?: ReasoningEffort): ModelSelection;
1082
1082
 
1083
1083
  /**
1084
1084
  * `<think>`-tag reasoning extractor (M2 reasoning-visibility) — bridge middleware.
package/dist/bridge.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { h as AGENT_BRAND, i as AfterToolCallContext, j as AgentBuilder, k as AgentDefinition, l as AgentDefinitionError, m as AgentExecutionContext, n as AgentManifest, f as AgentManifestEntry, o as AgentManifestSource, p as AgentManifestTool, r as AgentRoute, t as AgentRouteContext, u as AgentRunInfo, v as AgentStreamEvent, w as AgentTurnMetadata, x as AgentsPluginOptions, y as ApiErrorContext, z as ApiErrorDecision, B as ApiErrorPolicy, E as ApprovalRequiredEvent, F as ArtifactChunkEvent, I as ArtifactStartEvent, J as BackgroundDelegation, K as BeforeToolCallContext, N as BudgetExceededError, P as CheckpointSavedEvent, C as CompiledAgentOptions, Q as CompiledContextWindow, a as CompiledTool, U as ContextualTool, X as DefineAgentConfig, Y as DefinicaoOuThunk, Z as DelegateFn, _ as DelegateOptions, $ as DelegationBudgetExceededError, a0 as DelegationError, D as DelegationResult, a1 as DoneEvent, a2 as ErrorEvent, a3 as FileEditEvent, a9 as InferAgentInput, aa as InferAgentToolNames, ab as IterationEvent, ac as LLMCallContext, ah as McpApprovalSpec, ai as McpRegistryConfig, aj as McpRequestContext, ak as McpSelection, al as PartialToolCallEvent, an as ProcessInputContext, ar as RunStartedEvent, as as ScoreVerdict, at as ScoredDelegation, au as Scorer, av as SdkAgentHandle, aw as SdkMessage, ax as SdkSendOptions, ay as SdkTurnHandle, az as Segment, aC as StateUpdateEvent, S as StreamEvent, aD as TextDeltaEvent, aE as ThinkingEvent, aG as ToolCallEvent, aH as ToolCallVeto, aI as ToolHooks, aJ as ToolHooksPlugin, aK as ToolResultEvent, aL as ToolWalkResult, aN as ToolboxWalkResult, aO as agentsPlugin, aP as buildModelSelection, aQ as compileAgentDefinition, aR as compileAgentModule, aS as compileContextWindow, aT as compileProjectContext, aU as compileSkills, aV as compileTools, aW as createAgentExecutionContext, aX as createApiErrorHandler, aY as createSdkAgentStream, aZ as createThinkTagExtractor, a_ as createToolHooksPlugin, a$ as delegate, b0 as delegateBackground, b1 as delegateWithScoring, b2 as extractThinkTagStream, b3 as generateAgentManifest, b4 as generateAgentRoutes, b5 as isAgentContext, b6 as isAgentDefinition, b7 as isApprovalRequired, b8 as isDone, b9 as isError, ba as isPartialToolCall, bb as isTextDelta, bc as isToolCall, bd as isToolResult, bg as mcpRegistry, bh as mcpToolApprovals, bj as presentUIMessageStream, bk as projectContextMetadataOnlyKnobs, bo as resolveMcpServers, bp as runWithApiErrorHandling, bq as streamAgentResponse, s as streamAgentUIMessages, br as toAgentFactory, bs as translateSdkEvent } from './bridge-entry-C1m5EjfY.js';
1
+ export { h as AGENT_BRAND, i as AfterToolCallContext, j as AgentBuilder, k as AgentDefinition, l as AgentDefinitionError, m as AgentExecutionContext, n as AgentManifest, f as AgentManifestEntry, o as AgentManifestSource, p as AgentManifestTool, r as AgentRoute, t as AgentRouteContext, u as AgentRunInfo, v as AgentStreamEvent, w as AgentTurnMetadata, x as AgentsPluginOptions, y as ApiErrorContext, z as ApiErrorDecision, B as ApiErrorPolicy, E as ApprovalRequiredEvent, F as ArtifactChunkEvent, I as ArtifactStartEvent, J as BackgroundDelegation, K as BeforeToolCallContext, N as BudgetExceededError, P as CheckpointSavedEvent, C as CompiledAgentOptions, Q as CompiledContextWindow, a as CompiledTool, U as ContextualTool, X as DefineAgentConfig, Y as DefinicaoOuThunk, Z as DelegateFn, _ as DelegateOptions, $ as DelegationBudgetExceededError, a0 as DelegationError, D as DelegationResult, a1 as DoneEvent, a2 as ErrorEvent, a3 as FileEditEvent, a9 as InferAgentInput, aa as InferAgentToolNames, ab as IterationEvent, ac as LLMCallContext, ah as McpApprovalSpec, ai as McpRegistryConfig, aj as McpRequestContext, ak as McpSelection, al as PartialToolCallEvent, an as ProcessInputContext, ar as RunStartedEvent, as as ScoreVerdict, at as ScoredDelegation, au as Scorer, av as SdkAgentHandle, aw as SdkMessage, ax as SdkSendOptions, ay as SdkTurnHandle, az as Segment, aC as StateUpdateEvent, S as StreamEvent, aD as TextDeltaEvent, aE as ThinkingEvent, aG as ToolCallEvent, aH as ToolCallVeto, aI as ToolHooks, aJ as ToolHooksPlugin, aK as ToolResultEvent, aL as ToolWalkResult, aN as ToolboxWalkResult, aO as agentsPlugin, aP as buildModelSelection, aQ as compileAgentDefinition, aR as compileAgentModule, aS as compileContextWindow, aT as compileProjectContext, aU as compileSkills, aV as compileTools, aW as createAgentExecutionContext, aX as createApiErrorHandler, aY as createSdkAgentStream, aZ as createThinkTagExtractor, a_ as createToolHooksPlugin, a$ as delegate, b0 as delegateBackground, b1 as delegateWithScoring, b2 as extractThinkTagStream, b3 as generateAgentManifest, b4 as generateAgentRoutes, b5 as isAgentContext, b6 as isAgentDefinition, b7 as isApprovalRequired, b8 as isDone, b9 as isError, ba as isPartialToolCall, bb as isTextDelta, bc as isToolCall, bd as isToolResult, bg as mcpRegistry, bh as mcpToolApprovals, bj as presentUIMessageStream, bk as projectContextMetadataOnlyKnobs, bo as resolveMcpServers, bp as runWithApiErrorHandling, bq as streamAgentResponse, s as streamAgentUIMessages, br as toAgentFactory, bs as translateSdkEvent } from './bridge-entry-BL74g1Em.js';
2
2
  import '@theokit/http';
3
3
  import '@theokit/sdk';
4
4
  import 'zod';
package/dist/bridge.js CHANGED
@@ -44,7 +44,7 @@ import {
44
44
  streamAgentUIMessages,
45
45
  toAgentFactory,
46
46
  translateSdkEvent
47
- } from "./chunk-3WTH25DJ.js";
47
+ } from "./chunk-HFMH3AIP.js";
48
48
  import "./chunk-7QVYU63E.js";
49
49
  export {
50
50
  AGENT_BRAND,
@@ -652,13 +652,17 @@ function translateInteractionUpdate(update) {
652
652
  __name(translateInteractionUpdate, "translateInteractionUpdate");
653
653
 
654
654
  // src/bridge/model-selection.ts
655
- function buildModelSelection(modelId, effort) {
656
- if (!effort) return {
657
- id: modelId
655
+ function buildModelSelection(model, effort) {
656
+ const base = typeof model === "string" ? {
657
+ id: model
658
+ } : {
659
+ ...model
658
660
  };
661
+ if (!effort) return base;
659
662
  return {
660
- id: modelId,
663
+ ...base,
661
664
  params: [
665
+ ...base.params ?? [],
662
666
  {
663
667
  id: "thinking",
664
668
  value: effort
@@ -1954,9 +1958,13 @@ async function* presentUIMessageStream(events, opts) {
1954
1958
  continue;
1955
1959
  }
1956
1960
  if (event.type === "error") {
1961
+ const code = event.code;
1957
1962
  yield {
1958
1963
  type: "error",
1959
- errorText: event.message
1964
+ errorText: event.message,
1965
+ ...code !== void 0 ? {
1966
+ errorCode: code
1967
+ } : {}
1960
1968
  };
1961
1969
  break;
1962
1970
  }
@@ -1966,9 +1974,13 @@ async function* presentUIMessageStream(events, opts) {
1966
1974
  }
1967
1975
  }
1968
1976
  } catch (err) {
1977
+ const code = err.code;
1969
1978
  yield {
1970
1979
  type: "error",
1971
- errorText: String(err)
1980
+ errorText: String(err),
1981
+ ...typeof code === "string" ? {
1982
+ errorCode: code
1983
+ } : {}
1972
1984
  };
1973
1985
  }
1974
1986
  yield* presenter.finish(turnMetadata);
@@ -3528,4 +3540,4 @@ export {
3528
3540
  generateAgentManifest,
3529
3541
  agentsPlugin
3530
3542
  };
3531
- //# sourceMappingURL=chunk-3WTH25DJ.js.map
3543
+ //# sourceMappingURL=chunk-HFMH3AIP.js.map