@theokit/agents 0.30.0 → 0.30.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.
@@ -626,8 +626,12 @@ interface DefineAgentConfig<TInput extends z.ZodType = z.ZodType> {
626
626
  system?: string;
627
627
  /** Extended-thinking effort (mirrors `@Agent({ reasoningEffort })`). */
628
628
  reasoningEffort?: ReasoningEffort;
629
- /** Pre-built tools (SDK-ready `CompiledTool` shape). */
630
- tools?: CompiledTool[];
629
+ /**
630
+ * Pre-built tools. Accepts the `@theokit/sdk` `CustomTool` that `defineAgentTool`
631
+ * (theokit/server) and every `@theokit/sdk-tools` factory return (issue #81) — they are
632
+ * normalized to the internal {@link CompiledTool} shape at compile time.
633
+ */
634
+ tools?: readonly CustomTool[];
631
635
  }
632
636
  /** A branded agent definition — the value {@link defineAgent} returns. */
633
637
  type AgentDefinition<TInput extends z.ZodType = z.ZodType> = DefineAgentConfig<TInput> & {
package/dist/bridge.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AGENT_BRAND, b as AgentDefinition, c as AgentDefinitionError, d as AgentExecutionContext, e as AgentManifest, f as AgentManifestEntry, g as AgentManifestTool, h as AgentRoute, i as AgentRouteContext, j as AgentRunInfo, k as AgentStreamEvent, l as AgentWalkResult, m as AgentWarningCode, n as AgentsPluginOptions, o as ApprovalRequiredEvent, p as ArtifactChunkEvent, q as ArtifactStartEvent, B as BudgetExceededError, r as CheckpointSavedEvent, C as CompiledAgentOptions, s as CompiledContextWindow, a as CompiledTool, u as DefineAgentConfig, v as DelegateOptions, w as DelegationError, D as DelegationResult, x as DoneEvent, E as ErrorEvent, F as FileEditEvent, I as InferAgentInput, y as IterationEvent, P as PartialToolCallEvent, N as RunStartedEvent, O as SdkMessage, Q as Segment, T as StateUpdateEvent, S as StreamEvent, U as TextDeltaEvent, V as ThinkingEvent, W as ToolCallEvent, X as ToolResultEvent, Y as ToolWalkResult, Z as ToolboxWalkResult, _ as agentsPlugin, $ as buildModelSelection, a0 as compileAgent, a1 as compileAgentDefinition, a2 as compileAgentModule, a3 as compileContextWindow, a4 as compileProjectContext, a5 as compileSkills, a6 as compileTools, a7 as createAgentExecutionContext, a8 as createSdkAgentStream, a9 as createThinkTagExtractor, aa as defineAgent, ab as delegate, ac as extractThinkTagStream, ad as generateAgentManifest, ae as generateAgentRoutes, af as isAgentContext, ag as isAgentDefinition, ah as isApprovalRequired, ai as isDone, aj as isError, ak as isPartialToolCall, al as isTextDelta, am as isToolCall, an as isToolResult, ar as projectContextMetadataOnlyKnobs, au as streamAgentResponse, av as streamAgentUIMessages, aw as translateSdkEvent, ax as translateToUIMessageStream, ay as validateUniqueRoutes, az as walkAgentMetadata } from './bridge-entry-DVhOQc_f.js';
1
+ export { A as AGENT_BRAND, b as AgentDefinition, c as AgentDefinitionError, d as AgentExecutionContext, e as AgentManifest, f as AgentManifestEntry, g as AgentManifestTool, h as AgentRoute, i as AgentRouteContext, j as AgentRunInfo, k as AgentStreamEvent, l as AgentWalkResult, m as AgentWarningCode, n as AgentsPluginOptions, o as ApprovalRequiredEvent, p as ArtifactChunkEvent, q as ArtifactStartEvent, B as BudgetExceededError, r as CheckpointSavedEvent, C as CompiledAgentOptions, s as CompiledContextWindow, a as CompiledTool, u as DefineAgentConfig, v as DelegateOptions, w as DelegationError, D as DelegationResult, x as DoneEvent, E as ErrorEvent, F as FileEditEvent, I as InferAgentInput, y as IterationEvent, P as PartialToolCallEvent, N as RunStartedEvent, O as SdkMessage, Q as Segment, T as StateUpdateEvent, S as StreamEvent, U as TextDeltaEvent, V as ThinkingEvent, W as ToolCallEvent, X as ToolResultEvent, Y as ToolWalkResult, Z as ToolboxWalkResult, _ as agentsPlugin, $ as buildModelSelection, a0 as compileAgent, a1 as compileAgentDefinition, a2 as compileAgentModule, a3 as compileContextWindow, a4 as compileProjectContext, a5 as compileSkills, a6 as compileTools, a7 as createAgentExecutionContext, a8 as createSdkAgentStream, a9 as createThinkTagExtractor, aa as defineAgent, ab as delegate, ac as extractThinkTagStream, ad as generateAgentManifest, ae as generateAgentRoutes, af as isAgentContext, ag as isAgentDefinition, ah as isApprovalRequired, ai as isDone, aj as isError, ak as isPartialToolCall, al as isTextDelta, am as isToolCall, an as isToolResult, ar as projectContextMetadataOnlyKnobs, au as streamAgentResponse, av as streamAgentUIMessages, aw as translateSdkEvent, ax as translateToUIMessageStream, ay as validateUniqueRoutes, az as walkAgentMetadata } from './bridge-entry-DzSZRp22.js';
2
2
  import '@theokit/http';
3
3
  import './skills-Dx_KJ6Eg.js';
4
4
  import '@theokit/sdk';
package/dist/bridge.js CHANGED
@@ -37,7 +37,7 @@ import {
37
37
  translateToUIMessageStream,
38
38
  validateUniqueRoutes,
39
39
  walkAgentMetadata
40
- } from "./chunk-AUOCWGPS.js";
40
+ } from "./chunk-QJKU2YMC.js";
41
41
  import "./chunk-FI6ZG2YP.js";
42
42
  import "./chunk-7QVYU63E.js";
43
43
  export {
@@ -1120,14 +1120,18 @@ function applyTextTransforms(events, opts) {
1120
1120
  return out;
1121
1121
  }
1122
1122
  __name(applyTextTransforms, "applyTextTransforms");
1123
+ function hasZodInputSchema(schema) {
1124
+ return typeof schema?.parse === "function";
1125
+ }
1126
+ __name(hasZodInputSchema, "hasZodInputSchema");
1123
1127
  function buildSdkTools(compiledTools, defineTool, extraSdkTools = []) {
1124
1128
  return [
1125
- ...compiledTools.map((t) => defineTool({
1129
+ ...compiledTools.map((t) => hasZodInputSchema(t.inputSchema) ? defineTool({
1126
1130
  name: t.name,
1127
1131
  description: t.description,
1128
1132
  inputSchema: t.inputSchema,
1129
1133
  handler: t.handler
1130
- })),
1134
+ }) : t),
1131
1135
  ...extraSdkTools
1132
1136
  ];
1133
1137
  }
@@ -1385,12 +1389,21 @@ function isAgentDefinition(value) {
1385
1389
  return typeof value === "object" && value !== null && value[AGENT_BRAND] === true;
1386
1390
  }
1387
1391
  __name(isAgentDefinition, "isAgentDefinition");
1392
+ function toCompiledTool(tool) {
1393
+ return {
1394
+ name: tool.name,
1395
+ description: tool.description,
1396
+ inputSchema: tool.inputSchema,
1397
+ handler: /* @__PURE__ */ __name((input) => tool.handler(input), "handler")
1398
+ };
1399
+ }
1400
+ __name(toCompiledTool, "toCompiledTool");
1388
1401
  function compileAgentDefinition(def) {
1389
1402
  return {
1390
1403
  model: def.model,
1391
1404
  reasoningEffort: def.reasoningEffort,
1392
1405
  systemPrompt: def.system,
1393
- tools: def.tools ?? [],
1406
+ tools: (def.tools ?? []).map(toCompiledTool),
1394
1407
  agents: {},
1395
1408
  stream: true
1396
1409
  };
@@ -2312,4 +2325,4 @@ export {
2312
2325
  generateAgentManifest,
2313
2326
  agentsPlugin
2314
2327
  };
2315
- //# sourceMappingURL=chunk-AUOCWGPS.js.map
2328
+ //# sourceMappingURL=chunk-QJKU2YMC.js.map