@theokit/agents 4.28.0 → 4.29.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.
@@ -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.
@@ -1226,10 +1226,16 @@ interface AgentBuilder<TInput extends z.ZodType | UnsetMarker = UnsetMarker, TMo
1226
1226
  /** Set the request schema (lifted into the typed client via {@link AgentDefinition}). */
1227
1227
  input<S extends z.ZodType>(schema: S): AgentBuilder<S, TModel, TContext, TTools>;
1228
1228
  /**
1229
- * Set the model id. Required before `.build()`. COMPILE ERROR when called twice — the argument
1229
+ * Set the model. Required before `.build()`. COMPILE ERROR when called twice — the argument
1230
1230
  * type collapses to `never` once the model is set (tRPC's set-once technique).
1231
+ *
1232
+ * M94 — aceita `ModelSelection` além do id cru. A implementação do SDK **sempre** aceitou
1233
+ * (`agent-builder.ts:50`: `model(m: string | ModelSelection)`); era esta fachada que estreitava
1234
+ * para `string`, e o estreitamento tornava inalcançável qualquer campo da seleção — incluindo o
1235
+ * `contextWindow` que o SDK passou a publicar. Fachada divergindo da implementação é a mesma
1236
+ * classe de defeito que o M91 pagou dois patches para corrigir.
1231
1237
  */
1232
- model(id: TModel extends UnsetMarker ? string : never): AgentBuilder<TInput, string, TContext, TTools>;
1238
+ model(id: TModel extends UnsetMarker ? string | ModelSelection : never): AgentBuilder<TInput, string, TContext, TTools>;
1233
1239
  /** Set the static system prompt. */
1234
1240
  system(prompt: string): AgentBuilder<TInput, TModel, TContext, TTools>;
1235
1241
  /** Set the extended-thinking effort. */
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-BBtYaYVe.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-FPJ3MSRH.js";
47
+ } from "./chunk-6M2HOKRH.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
@@ -3528,4 +3532,4 @@ export {
3528
3532
  generateAgentManifest,
3529
3533
  agentsPlugin
3530
3534
  };
3531
- //# sourceMappingURL=chunk-FPJ3MSRH.js.map
3535
+ //# sourceMappingURL=chunk-6M2HOKRH.js.map