import { z } from 'zod'; import { RunnableToolFunctionWithParse } from 'openai/lib/RunnableFunction'; /** * Parse error from various types */ export declare const parseError: (error: Error | string | object) => any; /** * Filter Zod schema properties using path-based filtering. * Keeps properties in the keep list, all their descendants, and the path to reach them. * * Algorithm: * - If property name is in keep list → keep it entirely (with all descendants) * - If property is a container → check if it contains kept properties * - If yes → keep container and recurse * - If no → remove it * * @param schema - The Zod schema to filter * @param propertiesToKeep - Array of property names to keep (with all their descendants) * @returns A new filtered Zod schema */ export declare const filterSchemaProperties: (schema: z.ZodTypeAny, propertiesToKeep: string[]) => z.ZodTypeAny; /** * Exclude specified properties from a Zod schema. * Removes properties in the exclude list and all their descendants. * * Algorithm: * - If property name is in exclude list → remove entirely (with all descendants) * - Otherwise → keep and recurse to handle nested exclusions * * @param schema - The Zod schema to process * @param propertiesToExclude - Array of property names to remove (with all their descendants) * @returns A new filtered Zod schema */ export declare const excludeSchemaProperties: (schema: z.ZodTypeAny, propertiesToExclude: string[]) => z.ZodTypeAny; /** * Convert a Zod schema to a readable type string representation. * Uses _def.typeName instead of instanceof because instanceof is unreliable * for classes extending built-ins (like Error, Array) when code is downleveled to ES5. * See: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget */ export declare const zodToReadableType: (schema: z.ZodTypeAny, depth?: number, propName?: string, isOptional?: boolean) => string; /** * Create a decoupled zodFunction that wraps Zod schemas for OpenAI tools. * * This is a pure function that does NOT depend on stores or session management. * It only wraps the schema and delegates to the provided function with a generic context. * * @param config - Configuration for the tool * @param config.schema - The Zod schema for parameters * @param config.name - The function name * @param config.description - The function description * @param config.function - The function to execute (receives args and generic context) * @param config.strict - Whether to use strict mode * @returns A runnable tool function for OpenAI */ export declare function zodFunction({ function: fn, schema, description, name, strict, }: { function: (args: T, context: TContext) => Promise; schema: z.ZodSchema; description?: string; name?: string; strict?: boolean; }): RunnableToolFunctionWithParse; //# sourceMappingURL=zod-utils.d.ts.map