From 62d2da3815736f9866c9e98bf60a07edb7e12369 Mon Sep 17 00:00:00 2001 From: icarus Date: Thu, 18 Sep 2025 12:58:56 +0800 Subject: [PATCH] refactor(types): convert Tool interface to zod schema Use zod schema for better type safety and validation capabilities --- src/renderer/src/types/agent.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/renderer/src/types/agent.ts b/src/renderer/src/types/agent.ts index e6ab574011..338856ffcd 100644 --- a/src/renderer/src/types/agent.ts +++ b/src/renderer/src/types/agent.ts @@ -19,12 +19,14 @@ export const isAgentType = (type: unknown): type is AgentType => { export type SessionMessageType = TextStreamPart>['type'] -export interface Tool { - id: string - name: string - description?: string - requirePermissions?: boolean -} +export const ToolSchema = z.object({ + id: z.string(), + name: z.string(), + description: z.string().optional(), + requirePermissions: z.boolean().optional() +}) + +export type Tool = z.infer export const AgentConfigurationSchema = z .object({