Skip to content

Commit 7eab656

Browse files
committed
fix lockfile + add zod v3 support to ai tool param
1 parent ce5f4c4 commit 7eab656

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed

packages/ai/src/tools/common/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Schema, tool } from 'ai';
22
import { AiContext } from '../../context';
33
import { getAiWorkerContext } from '../../ai-context-worker';
44
import { z } from 'zod';
5+
import { z as z3 } from 'zod/v3';
56

67
/**
78
* Utility type that represents a value that can be either synchronous or asynchronous.
@@ -14,7 +15,7 @@ type Awaitable<T> = T | Promise<T>;
1415
* Type representing the parameters schema for AI tools.
1516
* Extracted from the first parameter of the `tool` function from the 'ai' library.
1617
*/
17-
export type ToolParameterType = z.ZodType | Schema<any>;
18+
export type ToolParameterType = z.ZodType | z3.ZodType | Schema<any>;
1819

1920
/**
2021
* Utility type that infers the TypeScript type from a tool parameter schema.
@@ -26,8 +27,9 @@ export type InferParameters<T extends ToolParameterType> =
2627
? T['_type']
2728
: T extends z.ZodTypeAny
2829
? z.infer<T>
29-
: never;
30-
30+
: T extends z3.ZodTypeAny
31+
? z3.infer<T>
32+
: never;
3133
/**
3234
* Configuration options for creating an AI tool.
3335
* @template T - The parameter schema type for the tool

pnpm-lock.yaml

Lines changed: 10 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)