From 9beffca985bd4f3db8afa9c790565ac7469a49da Mon Sep 17 00:00:00 2001 From: Simon <10131203+gaomeng1900@users.noreply.github.com> Date: Thu, 5 Mar 2026 19:15:03 +0800 Subject: [PATCH] docs: update doc for Zod v4 support --- packages/core/src/types.ts | 5 +++-- .../pages/docs/features/custom-tools/page.tsx | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 80b6f07..9319647 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -24,13 +24,14 @@ export interface AgentConfig extends LLMConfig { * * @example * // override internal tool + * import { z } from 'zod/v4' * import { tool } from 'page-agent' * const customTools = { * ask_user: tool({ * description: * 'Ask the user or parent model a question and wait for their answer. Use this if you need more information or clarification.', - * inputSchema: zod.object({ - * question: zod.string(), + * inputSchema: z.object({ + * question: z.string(), * }), * execute: async function (this: PageAgent, input) { * const answer = await do_some_thing(input.question) diff --git a/packages/website/src/pages/docs/features/custom-tools/page.tsx b/packages/website/src/pages/docs/features/custom-tools/page.tsx index 55bf25e..10c5b3b 100644 --- a/packages/website/src/pages/docs/features/custom-tools/page.tsx +++ b/packages/website/src/pages/docs/features/custom-tools/page.tsx @@ -16,6 +16,22 @@ export default function CustomTools() {
+ {isZh + ? 'Page Agent 使用 Zod 定义工具的输入 schema。支持 Zod 3 (>=3.25.0) 和 Zod 4,请从 zod/v4 子路径导入。不支持 Zod Mini。' + : 'Page Agent uses Zod for tool input schemas. Both Zod 3 (>=3.25.0) and Zod 4 are supported. Always import from the zod/v4 subpath. Zod Mini is not supported.'} +
+