kernl 0.1.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.
Files changed (257) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/CHANGELOG.md +53 -0
  3. package/LICENSE +201 -0
  4. package/dist/agent.d.ts +43 -0
  5. package/dist/agent.d.ts.map +1 -0
  6. package/dist/agent.js +130 -0
  7. package/dist/context.d.ts +70 -0
  8. package/dist/context.d.ts.map +1 -0
  9. package/dist/context.js +111 -0
  10. package/dist/env.d.ts +45 -0
  11. package/dist/env.d.ts.map +1 -0
  12. package/dist/env.js +31 -0
  13. package/dist/error.d.ts +1 -0
  14. package/dist/error.d.ts.map +1 -0
  15. package/dist/error.js +1 -0
  16. package/dist/guardrail.d.ts +178 -0
  17. package/dist/guardrail.d.ts.map +1 -0
  18. package/dist/guardrail.js +34 -0
  19. package/dist/index.d.ts +4 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +2 -0
  22. package/dist/kernel.d.ts +7 -0
  23. package/dist/kernel.d.ts.map +1 -0
  24. package/dist/kernel.js +7 -0
  25. package/dist/kernl.d.ts +18 -0
  26. package/dist/kernl.d.ts.map +1 -0
  27. package/dist/kernl.js +16 -0
  28. package/dist/lib/env.d.ts +43 -0
  29. package/dist/lib/env.d.ts.map +1 -0
  30. package/dist/lib/env.js +29 -0
  31. package/dist/lib/error.d.ts +88 -0
  32. package/dist/lib/error.d.ts.map +1 -0
  33. package/dist/lib/error.js +117 -0
  34. package/dist/lib/logger.d.ts +36 -0
  35. package/dist/lib/logger.d.ts.map +1 -0
  36. package/dist/lib/logger.js +43 -0
  37. package/dist/lib/serde/__tests__/codec.test.d.ts +2 -0
  38. package/dist/lib/serde/__tests__/codec.test.d.ts.map +1 -0
  39. package/dist/lib/serde/__tests__/codec.test.js +75 -0
  40. package/dist/lib/serde/codec.d.ts +12 -0
  41. package/dist/lib/serde/codec.d.ts.map +1 -0
  42. package/dist/lib/serde/codec.js +54 -0
  43. package/dist/lib/serde/json.d.ts +8 -0
  44. package/dist/lib/serde/json.d.ts.map +1 -0
  45. package/dist/lib/serde/json.js +13 -0
  46. package/dist/lib/serde/thread.d.ts +1 -0
  47. package/dist/lib/serde/thread.d.ts.map +1 -0
  48. package/dist/lib/serde/thread.js +172 -0
  49. package/dist/lib/serde/tool.d.ts +36 -0
  50. package/dist/lib/serde/tool.d.ts.map +1 -0
  51. package/dist/lib/serde/tool.js +1 -0
  52. package/dist/lib/utils.d.ts +19 -0
  53. package/dist/lib/utils.d.ts.map +1 -0
  54. package/dist/lib/utils.js +41 -0
  55. package/dist/lifecycle.d.ts +133 -0
  56. package/dist/lifecycle.d.ts.map +1 -0
  57. package/dist/lifecycle.js +29 -0
  58. package/dist/logger.d.ts +36 -0
  59. package/dist/logger.d.ts.map +1 -0
  60. package/dist/logger.js +43 -0
  61. package/dist/mcp/__tests__/base.test.d.ts +2 -0
  62. package/dist/mcp/__tests__/base.test.d.ts.map +1 -0
  63. package/dist/mcp/__tests__/base.test.js +268 -0
  64. package/dist/mcp/__tests__/fixtures/echo-server.d.ts +3 -0
  65. package/dist/mcp/__tests__/fixtures/echo-server.d.ts.map +1 -0
  66. package/dist/mcp/__tests__/fixtures/echo-server.js +92 -0
  67. package/dist/mcp/__tests__/fixtures/math-server.d.ts +3 -0
  68. package/dist/mcp/__tests__/fixtures/math-server.d.ts.map +1 -0
  69. package/dist/mcp/__tests__/fixtures/math-server.js +98 -0
  70. package/dist/mcp/__tests__/fixtures/server.d.ts +3 -0
  71. package/dist/mcp/__tests__/fixtures/server.d.ts.map +1 -0
  72. package/dist/mcp/__tests__/fixtures/server.js +162 -0
  73. package/dist/mcp/__tests__/fixtures/test-server.d.ts +3 -0
  74. package/dist/mcp/__tests__/fixtures/test-server.d.ts.map +1 -0
  75. package/dist/mcp/__tests__/fixtures/test-server.js +163 -0
  76. package/dist/mcp/__tests__/fixtures/utils.d.ts +17 -0
  77. package/dist/mcp/__tests__/fixtures/utils.d.ts.map +1 -0
  78. package/dist/mcp/__tests__/fixtures/utils.js +42 -0
  79. package/dist/mcp/__tests__/integration.test.d.ts +2 -0
  80. package/dist/mcp/__tests__/integration.test.d.ts.map +1 -0
  81. package/dist/mcp/__tests__/integration.test.js +360 -0
  82. package/dist/mcp/__tests__/stdio.test.d.ts +2 -0
  83. package/dist/mcp/__tests__/stdio.test.d.ts.map +1 -0
  84. package/dist/mcp/__tests__/stdio.test.js +180 -0
  85. package/dist/mcp/__tests__/test-utils.d.ts +17 -0
  86. package/dist/mcp/__tests__/test-utils.d.ts.map +1 -0
  87. package/dist/mcp/__tests__/test-utils.js +42 -0
  88. package/dist/mcp/__tests__/utils.test.d.ts +2 -0
  89. package/dist/mcp/__tests__/utils.test.d.ts.map +1 -0
  90. package/dist/mcp/__tests__/utils.test.js +300 -0
  91. package/dist/mcp/base.d.ts +88 -0
  92. package/dist/mcp/base.d.ts.map +1 -0
  93. package/dist/mcp/base.js +68 -0
  94. package/dist/mcp/http.d.ts +34 -0
  95. package/dist/mcp/http.d.ts.map +1 -0
  96. package/dist/mcp/http.js +100 -0
  97. package/dist/mcp/node.d.ts +60 -0
  98. package/dist/mcp/node.d.ts.map +1 -0
  99. package/dist/mcp/node.js +297 -0
  100. package/dist/mcp/sse.d.ts +34 -0
  101. package/dist/mcp/sse.d.ts.map +1 -0
  102. package/dist/mcp/sse.js +97 -0
  103. package/dist/mcp/stdio.d.ts +32 -0
  104. package/dist/mcp/stdio.d.ts.map +1 -0
  105. package/dist/mcp/stdio.js +96 -0
  106. package/dist/mcp/types.d.ts +172 -0
  107. package/dist/mcp/types.d.ts.map +1 -0
  108. package/dist/mcp/types.js +16 -0
  109. package/dist/mcp/utils.d.ts +23 -0
  110. package/dist/mcp/utils.d.ts.map +1 -0
  111. package/dist/mcp/utils.js +44 -0
  112. package/dist/model.d.ts +175 -0
  113. package/dist/model.d.ts.map +1 -0
  114. package/dist/model.js +1 -0
  115. package/dist/providers/ai.d.ts +1 -0
  116. package/dist/providers/ai.d.ts.map +1 -0
  117. package/dist/providers/ai.js +1 -0
  118. package/dist/providers/default.d.ts +16 -0
  119. package/dist/providers/default.d.ts.map +1 -0
  120. package/dist/providers/default.js +17 -0
  121. package/dist/providers/registry.d.ts +1 -0
  122. package/dist/providers/registry.d.ts.map +1 -0
  123. package/dist/providers/registry.js +1 -0
  124. package/dist/sched/scheduler.d.ts +20 -0
  125. package/dist/sched/scheduler.d.ts.map +1 -0
  126. package/dist/sched/scheduler.js +1 -0
  127. package/dist/sched/task.d.ts +92 -0
  128. package/dist/sched/task.d.ts.map +1 -0
  129. package/dist/sched/task.js +102 -0
  130. package/dist/serde/__tests__/codec.test.d.ts +2 -0
  131. package/dist/serde/__tests__/codec.test.d.ts.map +1 -0
  132. package/dist/serde/__tests__/codec.test.js +75 -0
  133. package/dist/serde/codec.d.ts +12 -0
  134. package/dist/serde/codec.d.ts.map +1 -0
  135. package/dist/serde/codec.js +54 -0
  136. package/dist/serde/json.d.ts +8 -0
  137. package/dist/serde/json.d.ts.map +1 -0
  138. package/dist/serde/json.js +13 -0
  139. package/dist/serde/thread.d.ts +687 -0
  140. package/dist/serde/thread.d.ts.map +1 -0
  141. package/dist/serde/thread.js +158 -0
  142. package/dist/serde/tool.d.ts +36 -0
  143. package/dist/serde/tool.d.ts.map +1 -0
  144. package/dist/serde/tool.js +1 -0
  145. package/dist/session.d.ts +1 -0
  146. package/dist/session.d.ts.map +1 -0
  147. package/dist/session.js +1 -0
  148. package/dist/task.d.ts +87 -0
  149. package/dist/task.d.ts.map +1 -0
  150. package/dist/task.js +97 -0
  151. package/dist/thread/__tests__/mock.d.ts +28 -0
  152. package/dist/thread/__tests__/mock.d.ts.map +1 -0
  153. package/dist/thread/__tests__/mock.js +74 -0
  154. package/dist/thread/__tests__/thread.test.d.ts +2 -0
  155. package/dist/thread/__tests__/thread.test.d.ts.map +1 -0
  156. package/dist/thread/__tests__/thread.test.js +1412 -0
  157. package/dist/thread/index.d.ts +2 -0
  158. package/dist/thread/index.d.ts.map +1 -0
  159. package/dist/thread/index.js +1 -0
  160. package/dist/thread/thread.d.ts +66 -0
  161. package/dist/thread/thread.d.ts.map +1 -0
  162. package/dist/thread/thread.js +472 -0
  163. package/dist/thread/utils.d.ts +19 -0
  164. package/dist/thread/utils.d.ts.map +1 -0
  165. package/dist/thread/utils.js +50 -0
  166. package/dist/tool/__tests__/fixtures.d.ts +45 -0
  167. package/dist/tool/__tests__/fixtures.d.ts.map +1 -0
  168. package/dist/tool/__tests__/fixtures.js +97 -0
  169. package/dist/tool/__tests__/tool.test.d.ts +2 -0
  170. package/dist/tool/__tests__/tool.test.d.ts.map +1 -0
  171. package/dist/tool/__tests__/tool.test.js +172 -0
  172. package/dist/tool/__tests__/toolkit.test.d.ts +2 -0
  173. package/dist/tool/__tests__/toolkit.test.d.ts.map +1 -0
  174. package/dist/tool/__tests__/toolkit.test.js +134 -0
  175. package/dist/tool/index.d.ts +4 -0
  176. package/dist/tool/index.d.ts.map +1 -0
  177. package/dist/tool/index.js +2 -0
  178. package/dist/tool/mcp.d.ts +75 -0
  179. package/dist/tool/mcp.d.ts.map +1 -0
  180. package/dist/tool/mcp.js +111 -0
  181. package/dist/tool/tool.d.ts +95 -0
  182. package/dist/tool/tool.d.ts.map +1 -0
  183. package/dist/tool/tool.js +176 -0
  184. package/dist/tool/toolkit.d.ts +121 -0
  185. package/dist/tool/toolkit.d.ts.map +1 -0
  186. package/dist/tool/toolkit.js +180 -0
  187. package/dist/tool/types.d.ts +187 -0
  188. package/dist/tool/types.d.ts.map +1 -0
  189. package/dist/tool/types.js +1 -0
  190. package/dist/tools.d.ts +362 -0
  191. package/dist/tools.d.ts.map +1 -0
  192. package/dist/tools.js +220 -0
  193. package/dist/trace/processor.d.ts +1 -0
  194. package/dist/trace/processor.d.ts.map +1 -0
  195. package/dist/trace/processor.js +1 -0
  196. package/dist/trace/traces.d.ts +1 -0
  197. package/dist/trace/traces.d.ts.map +1 -0
  198. package/dist/trace/traces.js +73 -0
  199. package/dist/trace/utils.d.ts +22 -0
  200. package/dist/trace/utils.d.ts.map +1 -0
  201. package/dist/trace/utils.js +30 -0
  202. package/dist/types/agent.d.ts +91 -0
  203. package/dist/types/agent.d.ts.map +1 -0
  204. package/dist/types/agent.js +1 -0
  205. package/dist/types/proto.d.ts +1551 -0
  206. package/dist/types/proto.d.ts.map +1 -0
  207. package/dist/types/proto.js +531 -0
  208. package/dist/types/thread.d.ts +71 -0
  209. package/dist/types/thread.d.ts.map +1 -0
  210. package/dist/types/thread.js +5 -0
  211. package/dist/usage.d.ts +43 -0
  212. package/dist/usage.d.ts.map +1 -0
  213. package/dist/usage.js +61 -0
  214. package/package.json +52 -0
  215. package/src/agent.ts +203 -0
  216. package/src/context.ts +265 -0
  217. package/src/guardrail.ts +277 -0
  218. package/src/index.ts +3 -0
  219. package/src/kernl.ts +22 -0
  220. package/src/lib/env.ts +36 -0
  221. package/src/lib/error.ts +158 -0
  222. package/src/lib/logger.ts +78 -0
  223. package/src/lib/serde/json.ts +18 -0
  224. package/src/lib/serde/thread.ts +188 -0
  225. package/src/lifecycle.ts +181 -0
  226. package/src/mcp/__tests__/base.test.ts +344 -0
  227. package/src/mcp/__tests__/fixtures/server.ts +179 -0
  228. package/src/mcp/__tests__/fixtures/utils.ts +58 -0
  229. package/src/mcp/__tests__/integration.test.ts +447 -0
  230. package/src/mcp/__tests__/stdio.test.ts +236 -0
  231. package/src/mcp/__tests__/utils.test.ts +360 -0
  232. package/src/mcp/base.ts +162 -0
  233. package/src/mcp/http.ts +147 -0
  234. package/src/mcp/sse.ts +137 -0
  235. package/src/mcp/stdio.ts +136 -0
  236. package/src/mcp/types.ts +202 -0
  237. package/src/mcp/utils.ts +62 -0
  238. package/src/task.ts +119 -0
  239. package/src/thread/__tests__/mock.ts +95 -0
  240. package/src/thread/__tests__/thread.test.ts +1574 -0
  241. package/src/thread/index.ts +1 -0
  242. package/src/thread/thread.ts +611 -0
  243. package/src/thread/utils.ts +67 -0
  244. package/src/tool/__tests__/fixtures.ts +106 -0
  245. package/src/tool/__tests__/tool.test.ts +235 -0
  246. package/src/tool/__tests__/toolkit.test.ts +174 -0
  247. package/src/tool/index.ts +10 -0
  248. package/src/tool/tool.ts +264 -0
  249. package/src/tool/toolkit.ts +234 -0
  250. package/src/tool/types.ts +243 -0
  251. package/src/trace/processor.ts +0 -0
  252. package/src/trace/traces.ts +86 -0
  253. package/src/trace/utils.ts +38 -0
  254. package/src/types/agent.ts +145 -0
  255. package/src/types/thread.ts +86 -0
  256. package/tsconfig.json +13 -0
  257. package/vitest.config.ts +14 -0
@@ -0,0 +1,187 @@
1
+ import { z, type ZodType } from "zod";
2
+ import { Agent } from "../agent";
3
+ import { Context, UnknownContext } from "../context";
4
+ import { MCPServer } from "../mcp/base";
5
+ import type { ToolCallState } from "@kernl/protocol";
6
+ import type { FunctionTool, HostedTool } from "./tool";
7
+ /**
8
+ * A tool that can be called by the model.
9
+ * @template TContext The context passed to the tool
10
+ */
11
+ export type Tool<TContext = UnknownContext> = FunctionTool<TContext, any, any> | HostedTool;
12
+ /**
13
+ * Configuration options for creating a tool.
14
+ *
15
+ * @param TContext The context of the tool
16
+ * @param TParameters The parameters of the tool
17
+ * @param TResult The result type of the tool
18
+ */
19
+ export type ToolConfig<TContext = UnknownContext, TParameters extends ToolInputParameters = undefined, TResult = unknown> = {
20
+ /**
21
+ * Unique identifier for the tool (required)
22
+ */
23
+ id: string;
24
+ /**
25
+ * Optional friendly name for the tool
26
+ */
27
+ name?: string;
28
+ /**
29
+ * The description of the tool that helps the model understand when to use it.
30
+ */
31
+ description: string;
32
+ /**
33
+ * A Zod object schema describing the tool parameters, or undefined for string input.
34
+ */
35
+ parameters: TParameters;
36
+ /**
37
+ * Execution mode - 'blocking' waits for completion, 'async' lets the agent continue to execute while executing.
38
+ * Defaults to 'blocking'.
39
+ */
40
+ mode?: "blocking" | "async";
41
+ /**
42
+ * The function to invoke when the tool is called.
43
+ */
44
+ execute: ToolExecuteFunction<TContext, TParameters, TResult>;
45
+ /**
46
+ * The function to invoke when an error occurs while running the tool.
47
+ */
48
+ errorfn?: ToolErrorFunction | null;
49
+ /**
50
+ * Whether the tool requires human approval before it can be called.
51
+ */
52
+ requiresApproval?: boolean | ToolApprovalFunction<TParameters>;
53
+ /**
54
+ * Determines whether the tool should be exposed to the model for the current run.
55
+ */
56
+ isEnabled?: ToolEnabledOption<TContext>;
57
+ };
58
+ /**
59
+ * Context provided to toolkit filters during tool resolution.
60
+ */
61
+ export interface ToolkitFilterContext<TContext = UnknownContext> {
62
+ context: Context<TContext>;
63
+ agent: Agent<TContext, any>;
64
+ toolkitId: string;
65
+ }
66
+ /**
67
+ * Toolkit-level filter for tools.
68
+ *
69
+ * Operates at the application layer on converted Tool objects.
70
+ * Use this for dynamic, context-aware filtering based on runtime state
71
+ * (e.g., user permissions, current workflow, etc.).
72
+ *
73
+ * This is the second filter in the pipeline (after MCPToolFilter for MCP tools).
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * const toolkit = new MCPToolkit({
78
+ * id: "github",
79
+ * server: githubServer,
80
+ * filter: async (ctx, tool) => {
81
+ * // Only allow read tools for non-admin users
82
+ * if (!ctx.context.data.isAdmin) {
83
+ * return tool.id.startsWith("read_");
84
+ * }
85
+ * return true;
86
+ * }
87
+ * });
88
+ * ```
89
+ */
90
+ export type ToolkitFilter<TContext = UnknownContext> = (context: ToolkitFilterContext<TContext>, tool: Tool<TContext>) => Promise<boolean> | boolean;
91
+ /**
92
+ * Configuration for FunctionToolkit.
93
+ */
94
+ export interface FunctionToolkitConfig<TContext = UnknownContext> {
95
+ /**
96
+ * Unique identifier for this toolkit.
97
+ */
98
+ id: string;
99
+ /**
100
+ * Array of tools to include in this toolkit.
101
+ */
102
+ tools: Tool<TContext>[];
103
+ }
104
+ /**
105
+ * Configuration for MCPToolkit.
106
+ */
107
+ export interface MCPToolkitConfig<TContext = UnknownContext> {
108
+ /**
109
+ * Unique identifier for this toolkit.
110
+ */
111
+ id: string;
112
+ /**
113
+ * The MCP server instance to wrap.
114
+ */
115
+ server: MCPServer;
116
+ /**
117
+ * Toolkit-level filter to control which tools are exposed to the agent.
118
+ * Defaults to allowing all tools if not provided.
119
+ *
120
+ * This is applied after the server's toolFilter (if any). Use this for
121
+ * dynamic, context-aware filtering. Use server.toolFilter for static filtering.
122
+ */
123
+ filter?: ToolkitFilter<TContext>;
124
+ }
125
+ /**
126
+ * Type of tool
127
+ */
128
+ export type ToolType = "function" | "hosted-tool";
129
+ /**
130
+ * The result of invoking a function tool. Either the actual output of the execution or a tool
131
+ * approval request.
132
+ *
133
+ * These get passed for example to the `toolUseBehavior` option of the `Agent` constructor.
134
+ */
135
+ export type ToolResult<TResult = unknown> = {
136
+ state: ToolCallState;
137
+ /**
138
+ * The result of the tool call.
139
+ */
140
+ result: TResult | undefined;
141
+ /**
142
+ * Error message if state is "error"
143
+ */
144
+ error: string | null;
145
+ };
146
+ /**
147
+ * The parameters of a tool.
148
+ * Either undefined (tool takes string input) or a Zod schema.
149
+ */
150
+ export type ToolInputParameters = ZodType | undefined;
151
+ /**
152
+ * The arguments to a tool - inferred from the Zod schema or string.
153
+ */
154
+ export type ToolExecuteArgument<TParameters extends ToolInputParameters> = TParameters extends ZodType ? z.infer<TParameters> : string;
155
+ /**
156
+ * The function to invoke when the tool is called.
157
+ *
158
+ * @param context An instance of the current RunContext
159
+ * @param params The arguments to the tool (see ToolExecuteArgument)
160
+ */
161
+ export type ToolExecuteFunction<TContext = UnknownContext, TParameters extends ToolInputParameters = undefined, TResult = unknown> = (context: Context<TContext>, params: ToolExecuteArgument<TParameters>) => Promise<TResult> | TResult;
162
+ /**
163
+ * A function that determines if a tool call should be approved.
164
+ *
165
+ * @param context The current execution context
166
+ * @param input The input to the tool
167
+ * @param callId The ID of the tool call
168
+ * @returns True if the tool call should be approved, false otherwise
169
+ */
170
+ export type ToolApprovalFunction<TParameters extends ToolInputParameters> = (context: Context, input: ToolExecuteArgument<TParameters>, callId?: string) => Promise<boolean>;
171
+ export type ToolEnabledFunction<TContext = UnknownContext> = (context: Context<TContext>, agent: Agent<any, any>) => Promise<boolean>;
172
+ export type ToolEnabledPredicate<TContext = UnknownContext> = (args: {
173
+ context: Context<TContext>;
174
+ agent: Agent<any, any>;
175
+ }) => boolean | Promise<boolean>;
176
+ type ToolEnabledOption<Context = UnknownContext> = boolean | ToolEnabledPredicate<Context>;
177
+ /**
178
+ * The function to invoke when an error occurs while running the tool. This can be used to define
179
+ * what the model should receive as tool output in case of an error. It can be used to provide
180
+ * for example additional context or a fallback value.
181
+ *
182
+ * @param context An instance of the current RunContext
183
+ * @param error The error that occurred
184
+ */
185
+ export type ToolErrorFunction = (context: Context, error: Error | unknown) => string;
186
+ export {};
187
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tool/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,KAAK,OAAO,EAAE,MAAM,KAAK,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEvD;;;GAGG;AACH,MAAM,MAAM,IAAI,CAAC,QAAQ,GAAG,cAAc,IACtC,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,GAChC,UAAU,CAAC;AAEf;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,CACpB,QAAQ,GAAG,cAAc,EACzB,WAAW,SAAS,mBAAmB,GAAG,SAAS,EACnD,OAAO,GAAG,OAAO,IACf;IACF;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;O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KAAK,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,KACnB,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB,MAAM,MAAM,oBAAoB,CAAC,QAAQ,GAAG,cAAc,IAAI,CAAC,IAAI,EAAE;IACnE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;CACxB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEjC,KAAK,iBAAiB,CAAC,OAAO,GAAG,cAAc,IAC3C,OAAO,GACP,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC9B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,GAAG,OAAO,KACnB,MAAM,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,362 @@
1
+ import { z } from "zod";
2
+ import type { Agent } from "./agent";
3
+ import type { RunResult } from "./result";
4
+ import { RunToolApprovalItem, RunToolCallOutputItem } from "./items";
5
+ import * as protocol from "./types/proto";
6
+ import { Context, UnknownContext } from "./context";
7
+ export type { ToolOutputText, ToolOutputImage, ToolOutputFileContent, ToolCallStructuredOutput, ToolCallOutputContent, } from "./types/proto";
8
+ /**
9
+ * A function that determines if a tool call should be approved.
10
+ *
11
+ * @param runContext The current run context
12
+ * @param input The input to the tool
13
+ * @param callId The ID of the tool call
14
+ * @returns True if the tool call should be approved, false otherwise
15
+ */
16
+ export type ToolApprovalFunction<TParameters extends ToolInputParameters> = (context: Context, input: ToolExecuteArgument<TParameters>, callId?: string) => Promise<boolean>;
17
+ export type ToolEnabledFunction<TContext = UnknownContext> = (context: Context<TContext>, agent: Agent<any, any>) => Promise<boolean>;
18
+ type ToolEnabledPredicate<TContext = UnknownContext> = (args: {
19
+ context: Context<TContext>;
20
+ agent: Agent<any, any>;
21
+ }) => boolean | Promise<boolean>;
22
+ type ToolEnabledOption<Context = UnknownContext> = boolean | ToolEnabledPredicate<Context>;
23
+ /**
24
+ * Exposes a function to the agent as a tool to be called
25
+ *
26
+ * @param Context The context of the tool
27
+ * @param Result The result of the tool
28
+ */
29
+ export type FunctionTool<TContext = UnknownContext, TParameters extends ToolInputParameters = undefined, Result = unknown> = {
30
+ type: "function";
31
+ /**
32
+ * The name of the tool.
33
+ */
34
+ name: string;
35
+ /**
36
+ * The description of the tool that helps the model to understand when to use the tool
37
+ */
38
+ description: string;
39
+ /**
40
+ * A JSON schema describing the parameters of the tool.
41
+ */
42
+ parameters: JsonObjectSchema<any>;
43
+ /**
44
+ * Whether the tool is strict. If true, the model must try to strictly follow the schema (might result in slower response times).
45
+ */
46
+ strict: boolean;
47
+ /**
48
+ * The function to invoke when the tool is called.
49
+ */
50
+ invoke: (context: Context<TContext>, input: string, details?: {
51
+ toolCall: protocol.FunctionCallItem;
52
+ }) => Promise<string | Result>;
53
+ /**
54
+ * Whether the tool needs human approval before it can be called. If this is true, the run will result in an `interruption` that the
55
+ * program has to resolve by approving or rejecting the tool call.
56
+ */
57
+ needsApproval: ToolApprovalFunction<TParameters>;
58
+ /**
59
+ * Determines whether the tool should be made available to the model for the current run.
60
+ */
61
+ isEnabled: ToolEnabledFunction<Context>;
62
+ };
63
+ /**
64
+ * Exposes a computer to the model as a tool to be called
65
+ *
66
+ * @param Context The context of the tool
67
+ * @param Result The result of the tool
68
+ */
69
+ export type ComputerTool = {
70
+ type: "computer";
71
+ /**
72
+ * The name of the tool.
73
+ */
74
+ name: "computer_use_preview" | string;
75
+ };
76
+ export type HostedMCPApprovalFunction<TContext = UnknownContext> = (context: Context<TContext>, data: RunToolApprovalItem) => Promise<{
77
+ approve: boolean;
78
+ reason?: string;
79
+ }>;
80
+ /**
81
+ * A hosted MCP tool that lets the model call a remote MCP server directly
82
+ * without a round trip back to your code.
83
+ */
84
+ export type HostedMCPTool<TContext = UnknownContext> = HostedTool & {
85
+ name: "hosted_mcp";
86
+ providerData: ProviderData.HostedMCPTool<TContext>;
87
+ };
88
+ /**
89
+ * Creates a hosted MCP tool definition.
90
+ *
91
+ * @param options - Configuration for the hosted MCP tool, including server connection details
92
+ * and approval requirements.
93
+ */
94
+ export declare function hostedMcpTool<TContext = UnknownContext>(options: {
95
+ allowedTools?: string[] | {
96
+ toolNames?: string[];
97
+ };
98
+ } & ({
99
+ serverLabel: string;
100
+ serverUrl?: string;
101
+ authorization?: string;
102
+ headers?: Record<string, string>;
103
+ } | {
104
+ serverLabel: string;
105
+ connectorId: string;
106
+ authorization?: string;
107
+ headers?: Record<string, string>;
108
+ }) & ({
109
+ requireApproval?: never;
110
+ } | {
111
+ requireApproval: "never";
112
+ } | {
113
+ requireApproval: "always" | {
114
+ never?: {
115
+ toolNames: string[];
116
+ };
117
+ always?: {
118
+ toolNames: string[];
119
+ };
120
+ };
121
+ onApproval?: HostedMCPApprovalFunction<Context>;
122
+ })): HostedMCPTool<Context>;
123
+ /**
124
+ * A built-in hosted tool that will be executed directly by the model during the request and won't result in local code executions.
125
+ * Examples of these are `web_search_call` or `file_search_call`.
126
+ *
127
+ * @param Context The context of the tool
128
+ * @param Result The result of the tool
129
+ */
130
+ export type HostedTool = {
131
+ type: "hosted_tool";
132
+ /**
133
+ * A unique name for the tool.
134
+ */
135
+ name: string;
136
+ /**
137
+ * Additional configuration data that gets passed to the tool
138
+ */
139
+ providerData?: Record<string, any>;
140
+ };
141
+ /**
142
+ * A tool that can be called by the model.
143
+ * @template Context The context passed to the tool
144
+ */
145
+ export type Tool<Context = unknown> = FunctionTool<Context, any, any> | ComputerTool | HostedTool;
146
+ /**
147
+ * The result of invoking a function tool. Either the actual output of the execution or a tool
148
+ * approval request.
149
+ *
150
+ * These get passed for example to the `toolUseBehavior` option of the `Agent` constructor.
151
+ */
152
+ export type FunctionToolResult<TContext = UnknownContext, TParameters extends ToolInputParameters = any, Result = any> = {
153
+ type: "function_output";
154
+ /**
155
+ * The tool that was called.
156
+ */
157
+ tool: FunctionTool<TContext, TParameters, Result>;
158
+ /**
159
+ * The output of the tool call. This can be a string or a stringifable item.
160
+ */
161
+ output: string | unknown;
162
+ /**
163
+ * The run item representing the tool call output.
164
+ */
165
+ runItem: RunToolCallOutputItem;
166
+ /**
167
+ * The result returned when the tool execution runs another agent. Populated when the
168
+ * invocation originated from {@link Agent.asTool} and the nested agent completed a run.
169
+ */
170
+ agentRunResult?: RunResult<TContext, Agent<TContext, any>>;
171
+ /**
172
+ * Any interruptions collected while the nested agent executed. These are surfaced to allow
173
+ * callers to pause and resume workflows that require approvals.
174
+ */
175
+ interruptions?: RunToolApprovalItem[];
176
+ } | {
177
+ /**
178
+ * Indicates that the tool requires approval before it can be called.
179
+ */
180
+ type: "function_approval";
181
+ /**
182
+ * The tool that is requiring to be approved.
183
+ */
184
+ tool: FunctionTool<TContext, TParameters, Result>;
185
+ /**
186
+ * The item representing the tool call that is requiring approval.
187
+ */
188
+ runItem: RunToolApprovalItem;
189
+ } | {
190
+ /**
191
+ * Indicates that the tool requires approval before it can be called.
192
+ */
193
+ type: "hosted_mcp_tool_approval";
194
+ /**
195
+ * The tool that is requiring to be approved.
196
+ */
197
+ tool: HostedMCPTool<TContext>;
198
+ /**
199
+ * The item representing the tool call that is requiring approval.
200
+ */
201
+ runItem: RunToolApprovalItem;
202
+ };
203
+ /**
204
+ * The parameters of a tool.
205
+ *
206
+ * This can be a Zod schema, a JSON schema or undefined.
207
+ *
208
+ * If a Zod schema is provided, the arguments to the tool will automatically be parsed and validated
209
+ * against the schema.
210
+ *
211
+ * If a JSON schema is provided, the arguments to the tool will be passed as is.
212
+ *
213
+ * If undefined is provided, the arguments to the tool will be passed as a string.
214
+ */
215
+ export type ToolInputParameters = undefined | ZodObjectLike | JsonObjectSchema<any>;
216
+ /**
217
+ * The parameters of a tool that has strict mode enabled.
218
+ *
219
+ * This can be a Zod schema, a JSON schema or undefined.
220
+ *
221
+ * If a Zod schema is provided, the arguments to the tool will automatically be parsed and validated
222
+ * against the schema.
223
+ *
224
+ * If a JSON schema is provided, the arguments to the tool will be parsed as JSON but not validated.
225
+ *
226
+ * If undefined is provided, the arguments to the tool will be passed as a string.
227
+ */
228
+ export type ToolInputParametersStrict = undefined | ZodObjectLike | JsonObjectSchemaStrict<any>;
229
+ /**
230
+ * The parameters of a tool that has strict mode disabled.
231
+ *
232
+ * If a JSON schema is provided, the arguments to the tool will be parsed as JSON but not validated.
233
+ *
234
+ * Zod schemas are not supported without strict: true.
235
+ */
236
+ export type ToolInputParametersNonStrict = undefined | JsonObjectSchemaNonStrict<any>;
237
+ /**
238
+ * The arguments to a tool.
239
+ *
240
+ * The type of the arguments are derived from the parameters passed to the tool definition.
241
+ *
242
+ * If the parameters are passed as a JSON schema the type is `unknown`. For Zod schemas it will
243
+ * match the inferred Zod type. Otherwise the type is `string`
244
+ */
245
+ export type ToolExecuteArgument<TParameters extends ToolInputParameters> = TParameters extends ZodObjectLike ? z.infer<TParameters> : TParameters extends JsonObjectSchema<any> ? unknown : string;
246
+ /**
247
+ * The function to invoke when the tool is called.
248
+ *
249
+ * @param input The arguments to the tool (see ToolExecuteArgument)
250
+ * @param context An instance of the current RunContext
251
+ */
252
+ type ToolExecuteFunction<TContext = UnknownContext, TParameters extends ToolInputParameters> = (context: Context<TContext>, input: ToolExecuteArgument<TParameters>, details?: {
253
+ toolCall: protocol.FunctionCallItem;
254
+ }) => Promise<unknown> | unknown;
255
+ /**
256
+ * The function to invoke when an error occurs while running the tool. This can be used to define
257
+ * what the model should receive as tool output in case of an error. It can be used to provide
258
+ * for example additional context or a fallback value.
259
+ *
260
+ * @param context An instance of the current RunContext
261
+ * @param error The error that occurred
262
+ */
263
+ type ToolErrorFunction = (context: Context, error: Error | unknown) => Promise<string> | string;
264
+ /**
265
+ * The options for a tool that has strict mode enabled.
266
+ *
267
+ * @param TParameters The parameters of the tool
268
+ * @param Context The context of the tool
269
+ */
270
+ type StrictToolOptions<TParameters extends ToolInputParametersStrict, Context = UnknownContext> = {
271
+ /**
272
+ * The name of the tool. Must be unique within the agent.
273
+ */
274
+ name?: string;
275
+ /**
276
+ * The description of the tool. This is used to help the model understand when to use the tool.
277
+ */
278
+ description: string;
279
+ /**
280
+ * A Zod schema or JSON schema describing the parameters of the tool.
281
+ * If a Zod schema is provided, the arguments to the tool will automatically be parsed and validated
282
+ * against the schema.
283
+ */
284
+ parameters: TParameters;
285
+ /**
286
+ * Whether the tool is strict. If true, the model must try to strictly follow the schema (might result in slower response times).
287
+ */
288
+ strict?: true;
289
+ /**
290
+ * The function to invoke when the tool is called.
291
+ */
292
+ execute: ToolExecuteFunction<TParameters, Context>;
293
+ /**
294
+ * The function to invoke when an error occurs while running the tool.
295
+ */
296
+ errorFunction?: ToolErrorFunction | null;
297
+ /**
298
+ * Whether the tool needs human approval before it can be called. If this is true, the run will result in an `interruption` that the
299
+ * program has to resolve by approving or rejecting the tool call.
300
+ */
301
+ needsApproval?: boolean | ToolApprovalFunction<TParameters>;
302
+ /**
303
+ * Determines whether the tool should be exposed to the model for the current run.
304
+ */
305
+ isEnabled?: ToolEnabledOption<Context>;
306
+ };
307
+ /**
308
+ * The options for a tool that has strict mode disabled.
309
+ *
310
+ * @param TParameters The parameters of the tool
311
+ * @param Context The context of the tool
312
+ */
313
+ type NonStrictToolOptions<TParameters extends ToolInputParametersNonStrict, TContext = UnknownContext> = {
314
+ /**
315
+ * The name of the tool. Must be unique within the agent.
316
+ */
317
+ name?: string;
318
+ /**
319
+ * The description of the tool. This is used to help the model understand when to use the tool.
320
+ */
321
+ description: string;
322
+ /**
323
+ * A JSON schema of the tool. To use a Zod schema, you need to use a `strict` schema.
324
+ */
325
+ parameters: TParameters;
326
+ /**
327
+ * Whether the tool is strict If true, the model must try to strictly follow the schema (might result in slower response times).
328
+ */
329
+ strict: false;
330
+ /**
331
+ * The function to invoke when the tool is called.
332
+ */
333
+ execute: ToolExecuteFunction<TContext, TParameters>;
334
+ /**
335
+ * The function to invoke when an error occurs while running the tool.
336
+ */
337
+ errorFunction?: ToolErrorFunction | null;
338
+ /**
339
+ * Whether the tool needs human approval before it can be called. If this is true, the run will result in an `interruption` that the
340
+ * program has to resolve by approving or rejecting the tool call.
341
+ */
342
+ needsApproval?: boolean | ToolApprovalFunction<TParameters>;
343
+ /**
344
+ * Determines whether the tool should be exposed to the model for the current run.
345
+ */
346
+ isEnabled?: ToolEnabledOption<TContext>;
347
+ };
348
+ /**
349
+ * The options for a tool.
350
+ *
351
+ * @param TContext The context of the tool
352
+ * @param TParameters The parameters of the tool
353
+ */
354
+ export type ToolOptions<TContext = UnknownContext, TParameters extends ToolInputParameters> = StrictToolOptions<Extract<TParameters, ToolInputParametersStrict>, TContext> | NonStrictToolOptions<Extract<TParameters, ToolInputParametersNonStrict>, TContext>;
355
+ /**
356
+ * Exposes a function to the agent as a tool to be called
357
+ *
358
+ * @param options The options for the tool
359
+ * @returns A new tool
360
+ */
361
+ export declare function tool<TContext = UnknownContext, TParameters extends ToolInputParameters = undefined, Result = string>(options: ToolOptions<TContext, TParameters>): FunctionTool<TContext, TParameters, Result>;
362
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAYrE,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEpD,YAAY,EACV,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB;;;;;;;GAOG;AACH,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