@microfox/ai-router 2.0.0 → 2.0.1-beta.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/dist/index.d.mts DELETED
@@ -1,448 +0,0 @@
1
- import * as ai from 'ai';
2
- import { UIMessageStreamWriter, UIMessage, GenerateObjectResult, UIDataTypes, generateId, ToolSet, JSONValue, Tool, ToolCallOptions } from 'ai';
3
- import { z, ZodObject } from 'zod';
4
- import { S as Store } from './store-BBHh-uTh.mjs';
5
- export { M as MemoryStore } from './store-BBHh-uTh.mjs';
6
-
7
- type UITools = Record<string, {
8
- input: unknown;
9
- output: unknown | undefined;
10
- }>;
11
-
12
- declare const findLastElement: <T>(array: T[]) => T;
13
- declare const findFirstElement: <T>(array: T[]) => T;
14
- declare class StreamWriter<METADATA, TOOLS extends UITools> {
15
- writer: UIMessageStreamWriter<UIMessage<METADATA, any, TOOLS>>;
16
- constructor(writer: UIMessageStreamWriter<UIMessage<METADATA, any, TOOLS>>);
17
- generateId: () => string;
18
- writeMessageMetadata: <NEW_METADATA extends METADATA>(metadata: NEW_METADATA) => void;
19
- writeCustomTool: <K extends keyof TOOLS>(tool: {
20
- toolCallId?: string;
21
- toolName: K;
22
- inputTextDelta?: string[];
23
- input?: any;
24
- output?: any;
25
- }) => void;
26
- writeObjectAsTool: <K extends keyof TOOLS>(tool: {
27
- toolName: K;
28
- result?: GenerateObjectResult<TOOLS[K]["output"]>;
29
- input?: GenerateObjectResult<TOOLS[K]["input"]>;
30
- }) => void;
31
- }
32
- declare const getTextParts: (message: UIMessage | null | undefined) => string[];
33
- declare const getTextPartsContent: (message: UIMessage | null | undefined) => string;
34
- declare const findLastMessageWith: <T>(message: UIMessage[] | null | undefined, filters: {
35
- role?: "user" | "assistant" | "system";
36
- metadata?: Record<string, any>;
37
- }) => UIMessage<unknown, UIDataTypes, ai.UITools> | null | undefined;
38
-
39
- /**
40
- * Sets a global logger that will be used by all router instances when no instance-specific logger is set.
41
- * This is useful for debugging across multiple router instances.
42
- * @param logger The logger to use globally, or undefined to disable global logging
43
- */
44
- declare function setGlobalLogger(logger?: AiLogger): void;
45
- /**
46
- * Gets the current global logger.
47
- * @returns The current global logger or undefined if none is set
48
- */
49
- declare function getGlobalLogger(): AiLogger | undefined;
50
- declare class AiKitError extends Error {
51
- constructor(message: string);
52
- }
53
- declare class AgentNotFoundError extends AiKitError {
54
- constructor(path: string);
55
- }
56
- /**
57
- * @deprecated This error class is deprecated and will be removed in a future version.
58
- * Use agent-as-tools pattern instead.
59
- */
60
- declare class ToolNotFoundError extends AiKitError {
61
- constructor(path: string);
62
- }
63
- /**
64
- * @deprecated This error class is deprecated and will be removed in a future version.
65
- * Use agent-as-tools pattern instead.
66
- */
67
- declare class ToolValidationError extends AiKitError {
68
- constructor(path: string, validationError: z.ZodError);
69
- }
70
- declare class MaxCallDepthExceededError extends AiKitError {
71
- constructor(maxDepth: number);
72
- }
73
- declare class AgentDefinitionMissingError extends AiKitError {
74
- constructor(path: string);
75
- }
76
- type AiStreamWriter<METADATA = unknown, PARTS extends UIDataTypes = UIDataTypes, TOOLS extends UITools = UITools> = UIMessageStreamWriter<UIMessage<METADATA, PARTS, TOOLS>> & Omit<StreamWriter<METADATA, TOOLS>, 'writer'> & {
77
- generateId: typeof generateId;
78
- };
79
- /**
80
- * The context object passed to every agent, tool, and middleware. It contains
81
- * all the necessary information and utilities for a handler to perform its work.
82
- * @template METADATA - The type for custom metadata in UI messages.
83
- * @template PARTS - The type for custom parts in UI messages.
84
- * @template TOOLS - The type for custom tools in UI messages.
85
- * @template ContextState - The type for the shared state object.
86
- */
87
- type AiContext<METADATA extends Record<string, any> = Record<string, any>, ContextState extends Record<string, any> = Record<string, any>, PARAMS extends Record<string, any> = Record<string, any>, PARTS extends UIDataTypes = UIDataTypes, TOOLS extends UITools = UITools> = {
88
- request: {
89
- /** The message history for the current request. */
90
- messages: UIMessage<METADATA, PARTS, TOOLS>[];
91
- /** Parameters passed from an internal tool or agent call. */
92
- params: PARAMS;
93
- [key: string]: any;
94
- } & METADATA;
95
- /** A shared, mutable state object that persists for the lifetime of a single request. */
96
- state: ContextState;
97
- /** A shared, mutable store object that persists for the lifetime of a single request. */
98
- store: Store;
99
- /**
100
- * Internal execution context for the router. Should not be modified by user code.
101
- * @internal
102
- */
103
- executionContext: {
104
- handlerPathStack?: string[];
105
- currentPath?: string;
106
- callDepth?: number;
107
- [key: string]: any;
108
- };
109
- /**
110
- * A unique ID for the top-level request, useful for logging and tracing.
111
- */
112
- requestId: string;
113
- /**
114
- * A structured logger that automatically includes the `requestId` and current handler path.
115
- */
116
- logger: AiLogger;
117
- /**
118
- * The stream writer to send data back to the end-user's UI.
119
- * Includes helpers for writing structured data like tool calls and metadata.
120
- */
121
- response: AiStreamWriter<Partial<METADATA>, PARTS, TOOLS>;
122
- /**
123
- * Provides functions for an agent to dispatch calls to other agents or tools.
124
- * @internal
125
- */
126
- next: NextHandler<METADATA, ContextState, PARAMS, PARTS, TOOLS>;
127
- _onExecutionStart?: () => void;
128
- _onExecutionEnd?: () => void;
129
- };
130
- /** Represents the `next` function in a middleware chain, used to pass control to the next handler. */
131
- type NextFunction = () => Promise<any>;
132
- /** A function that handles a request for a specific agent path. */
133
- type AiHandler<METADATA extends Record<string, any> = Record<string, any>, ContextState extends Record<string, any> = Record<string, any>, PARAMS extends Record<string, any> = Record<string, any>, PARTS extends UIDataTypes = UIDataTypes, TOOLS extends UITools = UITools> = (ctx: AiContext<METADATA, ContextState, PARAMS, PARTS, TOOLS>) => Promise<any>;
134
- /**
135
- * @deprecated Use agent-as-tools pattern instead. This type will be removed in a future version.
136
- * Create agents and use `.actAsTool()` to expose them as tools.
137
- */
138
- type AiToolHandler<METADATA extends Record<string, any> = Record<string, any>, ContextState extends Record<string, any> = Record<string, any>, PARAMS extends Record<string, any> = Record<string, any>, PARTS extends UIDataTypes = UIDataTypes, TOOLS extends UITools = UITools> = ((ctx: AiContext<METADATA, ContextState, PARAMS, PARTS, TOOLS>, params: PARAMS) => Promise<any>) | ((ctx: AiContext<METADATA, ContextState, PARAMS, PARTS, TOOLS>) => Tool<any, any>);
139
- /**
140
- * @deprecated Use agent-as-tools pattern instead. This type will be removed in a future version.
141
- * Create agents and use `.actAsTool()` to expose them as tools.
142
- */
143
- type AiToolFactory<METADATA extends Record<string, any> = Record<string, any>, ContextState extends Record<string, any> = Record<string, any>, PARAMS extends Record<string, any> = Record<string, any>, PARTS extends UIDataTypes = UIDataTypes, TOOLS extends UITools = UITools> = (ctx: AiContext<METADATA, ContextState, PARAMS, PARTS, TOOLS>) => Tool<any, any>;
144
- /** A function that acts as middleware, processing a request and optionally passing control to the next handler. */
145
- type AiMiddleware<METADATA extends Record<string, any> = Record<string, any>, ContextState extends Record<string, any> = Record<string, any>, PARAMS extends Record<string, any> = Record<string, any>, PARTS extends UIDataTypes = UIDataTypes, TOOLS extends UITools = UITools> = (ctx: AiContext<METADATA, ContextState, PARAMS, PARTS, TOOLS>, next: NextFunction) => Promise<any>;
146
- /** A simple structured logger interface. */
147
- type AiLogger = {
148
- log: (...args: any[]) => void;
149
- warn: (...args: any[]) => void;
150
- error: (...args: any[]) => void;
151
- };
152
- /** Internal representation of a registered handler in the router's stack. */
153
- type Layer<METADATA extends Record<string, any> = Record<string, any>, ContextState extends Record<string, any> = Record<string, any>, PARAMS extends Record<string, any> = Record<string, any>, PARTS extends UIDataTypes = UIDataTypes, TOOLS extends UITools = UITools> = {
154
- path: string | RegExp;
155
- handler: AiMiddleware<METADATA, ContextState, PARAMS, PARTS, TOOLS>;
156
- isTool: boolean;
157
- toolOptions?: {
158
- type: 'static';
159
- schema: ZodObject<any>;
160
- description?: string;
161
- handler: AiToolHandler<METADATA, ContextState, PARAMS, PARTS, TOOLS>;
162
- } | {
163
- type: 'factory';
164
- factory: AiToolFactory<METADATA, ContextState, PARAMS, PARTS, TOOLS>;
165
- };
166
- isAgent: boolean;
167
- hasDynamicParams?: boolean;
168
- paramNames?: string[];
169
- };
170
- type AgentTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONValue | unknown | never = any> = Tool<INPUT, OUTPUT> & {
171
- name: string;
172
- id: string;
173
- metadata?: Record<string, any> & {
174
- absolutePath?: string;
175
- name?: string;
176
- description?: string;
177
- toolKey?: string;
178
- icon?: string;
179
- parentTitle?: string;
180
- title?: string;
181
- hideUI?: boolean;
182
- };
183
- };
184
- type AgentData = {
185
- metadata?: Record<string, any> & {
186
- absolutePath?: string;
187
- name?: string;
188
- description?: string;
189
- toolKey?: string;
190
- icon?: string;
191
- parentTitle?: string;
192
- title?: string;
193
- hideUI?: boolean;
194
- };
195
- [key: string]: any;
196
- };
197
- /**
198
- * A composable router for building structured, multi-agent AI applications.
199
- * It allows you to define agents and tools, compose them together, and handle
200
- * requests in a predictable, middleware-style pattern.
201
- *
202
- * @template KIT_METADATA - The base metadata type for all UI messages in this router.
203
- * @template PARTS - The base custom parts type for all UI messages.
204
- * @template TOOLS - The base custom tools type for all UI messages.
205
- * @template ContextState - The base type for the shared state object.
206
- */
207
- declare class AiRouter<KIT_METADATA extends Record<string, any> = Record<string, any>, ContextState extends Record<string, any> = {}, PARAMS extends Record<string, any> = Record<string, any>, PARTS extends UIDataTypes = UIDataTypes, TOOLS extends UITools = UITools, REGISTERED_TOOLS extends ToolSet = {}> {
208
- private stack;
209
- actAsToolDefinitions: Map<string | RegExp, AgentTool<any, any>>;
210
- private logger?;
211
- private _store;
212
- toolExecutionPromise: Promise<any>;
213
- /** Configuration options for the router instance. */
214
- options: {
215
- /** The maximum number of agent-to-agent calls allowed in a single request to prevent infinite loops. */
216
- maxCallDepth: number;
217
- };
218
- /**
219
- * Constructs a new AiAgentKit router.
220
- * @param stack An optional initial stack of layers, used for composing routers.
221
- * @param options Optional configuration for the router.
222
- */
223
- constructor(stack?: Layer<KIT_METADATA, ContextState, PARAMS, PARTS, TOOLS>[], options?: {
224
- maxCallDepth?: number;
225
- logger?: AiLogger;
226
- });
227
- setStore(store: Store): void;
228
- /**
229
- * Sets a logger for this router instance.
230
- * If no logger is set, the router will fall back to the global logger.
231
- * @param logger The logger to use for this router instance, or undefined to use global logger
232
- */
233
- setLogger(logger?: AiLogger): void;
234
- /**
235
- * Gets the effective logger for this router instance.
236
- * Returns instance logger if set, otherwise falls back to global logger.
237
- * @returns The effective logger or undefined if no logging should occur
238
- */
239
- private _getEffectiveLogger;
240
- /**
241
- * Registers a middleware-style agent that runs for a specific path prefix, regex pattern, or wildcard.
242
- * Agents can modify the context and must call `next()` to pass control to the next handler in the chain.
243
- * This method is primarily for middleware. For terminal agents, see `.agent()` on an instance.
244
- *
245
- * @param path The path prefix, regex pattern, or "*" for wildcard matching.
246
- * @param agents The agent middleware function(s).
247
- */
248
- agent<const TAgents extends (AiMiddleware<any, any, any, any, any> | AiRouter<any, any, any, any, any, any>)[]>(agentPath: string | RegExp | AiMiddleware<KIT_METADATA, ContextState, PARAMS, PARTS, TOOLS>, ...agents: TAgents): AiRouter<KIT_METADATA, ContextState, PARAMS, PARTS, TOOLS, REGISTERED_TOOLS & (TAgents[number] extends AiRouter<any, any, any, any, any, infer R> ? R : {})>;
249
- /**
250
- * Mounts a middleware function or another AiAgentKit router at a specific path.
251
- * This is the primary method for composing routers and applying cross-cutting middleware.
252
- *
253
- * @param path The path prefix to mount the handler on.
254
- * @param handler The middleware function or AiAgentKit router instance to mount.
255
- */
256
- use<THandler extends AiMiddleware<KIT_METADATA, ContextState, PARAMS, PARTS, TOOLS> | AiRouter<any, any, any, any, any, any>>(mountPathArg: string | RegExp, handler: THandler): AiRouter<KIT_METADATA, ContextState, PARAMS, PARTS, TOOLS, REGISTERED_TOOLS & (THandler extends AiRouter<any, any, any, any, any, infer R> ? R : {})>;
257
- /**
258
- * Pre-defines the schema and description for an agent when it is used as a tool by an LLM.
259
- * This allows `next.agentAsTool()` to create a valid `Tool` object without needing the definition at call time.
260
- * @param path The path of the agent being defined.
261
- * @param options The tool definition, including a Zod schema and description.
262
- */
263
- actAsTool<const TPath extends string | RegExp, const TTool extends AgentTool<any, any>>(path: TPath, options: TTool): AiRouter<KIT_METADATA, ContextState, PARAMS, PARTS, TOOLS, REGISTERED_TOOLS & {
264
- [K in TTool['id']]: Tool<z.infer<TTool['inputSchema']>, z.infer<TTool['outputSchema']>> & {
265
- metadata: TTool['metadata'] & {
266
- toolKey: TTool['id'];
267
- name: TTool['name'];
268
- description: TTool['description'];
269
- };
270
- };
271
- }>;
272
- getToolSet(): REGISTERED_TOOLS;
273
- getToolDefinition(path: string): AgentTool<any, any>;
274
- /**
275
- * @deprecated Use agent-as-tools pattern instead. Create an agent and use `.actAsTool()` to expose it as a tool.
276
- * This method will be removed in a future version.
277
- *
278
- * Example migration:
279
- * ```typescript
280
- * // Old way (deprecated):
281
- * router.tool('/calculator', { schema: z.object({...}) }, async (ctx, params) => {...});
282
- *
283
- * // New way (recommended):
284
- * router.agent('/calculator', async (ctx) => {...})
285
- * .actAsTool('/calculator', { id: 'calculator', name: 'Calculator', ... });
286
- * ```
287
- */
288
- tool<TOOL_METADATA extends Record<string, any> = Record<string, any>, TOOL_TOOLS extends UITools = UITools, TOOL_STATE extends Record<string, any> = Record<string, any>>(path: string | RegExp, factory: AiToolFactory<TOOL_METADATA, PARTS, TOOL_TOOLS, ContextState & TOOL_STATE>): AiRouter<KIT_METADATA | TOOL_METADATA, PARTS, TOOLS & TOOL_TOOLS, ContextState & TOOL_STATE>;
289
- /**
290
- * @deprecated Use agent-as-tools pattern instead. Create an agent and use `.actAsTool()` to expose it as a tool.
291
- * This method will be removed in a future version.
292
- */
293
- tool<TOOL_METADATA extends Record<string, any> = Record<string, any>, TOOL_TOOLS extends UITools = UITools, TOOL_STATE extends Record<string, any> = Record<string, any>, TOOL_PARAMS extends ZodObject<any> = ZodObject<any>>(path: string | RegExp, options: {
294
- schema: TOOL_PARAMS;
295
- description?: string;
296
- }, handler: (ctx: AiContext<TOOL_METADATA, ContextState & TOOL_STATE, z.infer<TOOL_PARAMS>, PARTS, TOOL_TOOLS>, params: z.infer<TOOL_PARAMS>) => Promise<any>): AiRouter<KIT_METADATA | TOOL_METADATA, PARTS, TOOLS & TOOL_TOOLS, ContextState & TOOL_STATE>;
297
- /**
298
- * Returns the internal stack of layers. Primarily used for manual router composition.
299
- * @deprecated Prefer using `.use()` for router composition.
300
- */
301
- getStack(): Layer<KIT_METADATA, ContextState, PARAMS, PARTS, TOOLS>[];
302
- /**
303
- * Returns the internal stack with a path prefix applied to each layer.
304
- * @param prefix The prefix to add to each path.
305
- * @deprecated Prefer using `.use()` for router composition.
306
- */
307
- getStackWithPrefix(prefix: string): {
308
- path: string | RegExp;
309
- handler: AiMiddleware<KIT_METADATA, ContextState, PARAMS, PARTS, TOOLS>;
310
- isTool: boolean;
311
- toolOptions?: {
312
- type: "static";
313
- schema: ZodObject<any>;
314
- description?: string;
315
- handler: AiToolHandler<KIT_METADATA, ContextState, PARAMS, PARTS, TOOLS>;
316
- } | {
317
- type: "factory";
318
- factory: AiToolFactory<KIT_METADATA, ContextState, PARAMS, PARTS, TOOLS>;
319
- } | undefined;
320
- isAgent: boolean;
321
- hasDynamicParams?: boolean;
322
- paramNames?: string[];
323
- }[];
324
- /**
325
- * Outputs all registered paths, and the tool definitions, middlewares, and agents registered on each path.
326
- * @returns A map of paths to their registered handlers.
327
- */
328
- registry(): {
329
- map: Record<string, {
330
- middlewares: any[];
331
- tools: any[];
332
- agents: any[];
333
- }>;
334
- tools: REGISTERED_TOOLS;
335
- };
336
- /**
337
- * Resolves a path based on the parent path and the requested path.
338
- * - If path starts with `@/`, it's an absolute path from the root.
339
- * - Otherwise, it's a relative path.
340
- * @internal
341
- */
342
- private _resolvePath;
343
- /**
344
- * Creates a new context for an internal agent or tool call.
345
- * It inherits from the parent context but gets a new logger and call depth.
346
- * @internal
347
- */
348
- private _createSubContext;
349
- /**
350
- * Creates a new logger instance with a structured prefix.
351
- * @internal
352
- */
353
- private _createLogger;
354
- /**
355
- * Calculates a specificity score for a layer to enable Express-style routing.
356
- * Higher score means more specific.
357
- * - Middleware is less specific than an agent/tool.
358
- * - Deeper paths are more specific.
359
- * - Static segments are more specific than dynamic segments.
360
- * @internal
361
- */
362
- private _getSpecificityScore;
363
- /**
364
- * The core execution engine. It finds all matching layers for a given path
365
- * and runs them in a middleware-style chain.
366
- * @internal
367
- */
368
- private _execute;
369
- private pendingExecutions;
370
- /**
371
- * The main public entry point for the router. It handles an incoming request,
372
- * sets up the response stream, creates the root context, and starts the execution chain.
373
- *
374
- * @param path The path of the agent or tool to execute.
375
- * @param initialContext The initial context for the request, typically containing messages.
376
- * @returns A standard `Response` object containing the rich UI stream.
377
- */
378
- handle(path: string, initialContext: Omit<AiContext<KIT_METADATA, ContextState, PARAMS, PARTS, TOOLS>, 'state' | 'response' | 'next' | 'requestId' | 'logger' | 'executionContext' | 'store'>): Response;
379
- handleStream(path: string, initialContext: Omit<AiContext<KIT_METADATA, ContextState, PARAMS, PARTS, TOOLS>, 'state' | 'response' | 'next' | 'requestId' | 'logger' | 'executionContext' | 'store'>, executionCompletionPromise: Promise<void>, executionCompletionResolver: (() => void) | null): ReadableStream<ai.InferUIMessageChunk<UIMessage<KIT_METADATA, PARTS, TOOLS>>>;
380
- /**
381
- * Handles an incoming request and returns a promise that resolves with the full,
382
- * non-streamed response. This is useful for environments where streaming is not
383
- * desired or for testing.
384
- *
385
- * @param path The path of the agent or tool to execute.
386
- * @param initialContext The initial context for the request, typically containing messages.
387
- * @returns A `Promise<Response>` that resolves with the final JSON response.
388
- */
389
- toAwaitResponse(path: string, initialContext: Omit<AiContext<KIT_METADATA, ContextState, PARAMS, PARTS, TOOLS>, 'state' | 'response' | 'next' | 'requestId' | 'logger' | 'executionContext' | 'store'>): Promise<Response>;
390
- }
391
- type AiRouterType = typeof AiRouter;
392
- declare class NextHandler<METADATA extends Record<string, any> = Record<string, any>, ContextState extends Record<string, any> = Record<string, any>, PARAMS extends Record<string, any> = Record<string, any>, PARTS extends UIDataTypes = UIDataTypes, TOOLS extends UITools = UITools> {
393
- private ctx;
394
- private router;
395
- private onExecutionStart;
396
- private onExecutionEnd;
397
- maxCallDepth: number;
398
- constructor(ctx: AiContext<METADATA, ContextState, PARAMS, PARTS, TOOLS>, router: AiRouter<METADATA, ContextState, PARAMS, PARTS, TOOLS>, onExecutionStart: () => void, onExecutionEnd: () => void, parentNext?: NextHandler<METADATA, ContextState, PARAMS, PARTS, TOOLS>);
399
- callAgent(agentPath: string, params?: Record<string, any>, options?: {
400
- streamToUI?: boolean;
401
- }): Promise<{
402
- ok: true;
403
- data: any;
404
- } | {
405
- ok: false;
406
- error: Error;
407
- }>;
408
- /**
409
- * @deprecated Use agent-as-tools pattern instead. Use `ctx.next.callAgent()` to call agents that are exposed as tools.
410
- * This method will be removed in a future version.
411
- *
412
- * Example migration:
413
- * ```typescript
414
- * // Old way (deprecated):
415
- * const result = await ctx.next.callTool('/calculator', { a: 5, b: 3 });
416
- *
417
- * // New way (recommended):
418
- * const result = await ctx.next.callAgent('/calculator', { a: 5, b: 3 });
419
- * ```
420
- */
421
- callTool<T extends z.ZodObject<any>>(toolPath: string, params: z.infer<T>, options?: ToolCallOptions): Promise<{
422
- ok: true;
423
- data: any;
424
- } | {
425
- ok: false;
426
- error: Error;
427
- }>;
428
- /**
429
- * @deprecated Use agent-as-tools pattern instead. Use `ctx.next.agentAsTool()` to attach agents as tools.
430
- * This method will be removed in a future version.
431
- *
432
- * Example migration:
433
- * ```typescript
434
- * // Old way (deprecated):
435
- * const tool = ctx.next.attachTool('/calculator');
436
- *
437
- * // New way (recommended):
438
- * const tool = ctx.next.agentAsTool('/calculator');
439
- * ```
440
- */
441
- attachTool<SCHEMA extends z.ZodObject<any>>(toolPath: string, _tool?: Omit<Tool<z.infer<SCHEMA>, any>, 'description'>): Tool<z.infer<SCHEMA>, any>;
442
- agentAsTool<INPUT extends JSONValue | unknown | never = any, OUTPUT = any>(agentPath: string, toolDefinition?: AgentTool<INPUT, OUTPUT>): {
443
- [x: number]: Tool<INPUT, OUTPUT>;
444
- };
445
- getToolDefinition(agentPath: string | RegExp): AgentTool<any, any>;
446
- }
447
-
448
- export { type AgentData, AgentDefinitionMissingError, AgentNotFoundError, type AgentTool, type AiContext, type AiHandler, AiKitError, type AiLogger, type AiMiddleware, AiRouter, type AiRouterType, type AiStreamWriter, type AiToolFactory, type AiToolHandler, MaxCallDepthExceededError, type NextFunction, Store, StreamWriter, ToolNotFoundError, ToolValidationError, type UITools, findFirstElement, findLastElement, findLastMessageWith, getGlobalLogger, getTextParts, getTextPartsContent, setGlobalLogger };