/** * Shared Zod → JSON Schema derivation — the single place that fixes the * dialect + strict-mode settings for every Zod-derived schema the SDK * ships on the wire. * * Both `defineFunctionTool` (tool `parameters`) and `outputSchema` * (AgentSpec `output_schema`) route through here so the two derivations * stay byte-for-byte consistent: same `target: 'draft-07'` * (OpenAI-compatible dialect), same `unrepresentable: 'any'` fallback, * same `$schema` strip. Keeping it in one function is what guarantees a * tool-arg schema and an output schema built from the *same* Zod type * produce the *same* JSON Schema — the parity the wire validator and the * model provider both depend on. * * `unrepresentable: 'any'` falls back to `{}` for Zod types that have no * JSON Schema mapping (`z.bigint()`, `z.symbol()`, `z.function()`, …) * instead of throwing — a hard throw would block the consumer from * reaching their first task dispatch over a corner of the schema the * model rarely needs. Conversion errors carry the caller-supplied * `label` so a malformed schema points at the offending call site. */ import { z } from 'zod'; import type { JsonObject } from '../../qar/json.js'; /** * Convert a Zod schema to the OpenAI-compatible JSON Schema body used by * function-tool `parameters` and AgentSpec `output_schema`. * * @param schema The Zod schema to convert. * @param label Caller context woven into error messages (e.g. * `defineFunctionTool(get_time)` or `outputSchema`). * @returns The JSON Schema object with Zod's `$schema` declaration * stripped (the wire shapes don't carry it). * @throws TypeError when conversion fails or yields a non-object schema * (top-level non-object Zod types — wrap them in `z.object({...})`). */ export declare function zodToJsonSchema(schema: z.ZodType, label: string): JsonObject; //# sourceMappingURL=zodToJsonSchema.d.ts.map