import { StandardSchemaV1 } from "@standard-schema/spec"; //#region ../ai/src/utils/json-schema.d.ts /** * Supported JSON Schema output targets per the Standard JSON Schema V1 * spec. `openai-strict` is the richest for OpenAI structured outputs — * every property listed in `required`, optionals expressed as * `["T", "null"]`, `additionalProperties: false` everywhere. Other * targets produce standards-compliant but looser output. */ type JsonSchemaTarget = "draft-2020-12" | "draft-07" | "openapi-3.0" | "openai-strict"; /** * Options for `extractJsonSchema`. `target` is forwarded to libraries that * implement the Standard JSON Schema V1 spec (Seal, and any future lib * that follows the spec). Libraries using their own top-level `.jsonSchema` * / `._jsonSchema` property ignore the target. */ type ExtractJsonSchemaOptions = { target?: JsonSchemaTarget | (string & {}); }; /** * Best-effort JSON Schema extraction from a Standard Schema instance. * * Different libraries expose their JSON representation through different * paths: * - **Seal / Standard JSON Schema V1**: `["~standard"].jsonSchema.input({ target })` * — nested under the spec object, takes a target switch. Default target * is `"openai-strict"` since the primary consumer is OpenAI's native * structured-output mechanism; pass `options.target` to override. * - **Zod / similar**: top-level `.jsonSchema` property. Zod v4 actually * ships `toJSONSchema` as a module function, not a method, so it does * NOT hit this probe — Zod users pass their converted schema via the * `AgentExecuteOptions.responseSchema` escape hatch. * * Deliberately does NOT probe `toJSON` — that's a generic JavaScript * serialization hook (Seal's schemas have one that dumps internal rule * state) and matching it would return garbage disguised as a JSON Schema. * * Returns `undefined` when no path matches. The caller then either skips * native structured-output wiring or falls back to a schema-less * instruction. * * Shared across every SDK adapter package (OpenAI, Anthropic, Bedrock…) * so each provider converts schemas identically. * * @example * const schema = extractJsonSchema(mySealSchema); * // { type: "object", properties: { ... }, required: [ ... ], additionalProperties: false } * * @example * // Ask for a different target explicitly * const draft = extractJsonSchema(mySealSchema, { target: "draft-2020-12" }); */ declare function extractJsonSchema(schema: StandardSchemaV1 | undefined, options?: ExtractJsonSchemaOptions): Record | undefined; //#endregion export { ExtractJsonSchemaOptions, JsonSchemaTarget, extractJsonSchema }; //# sourceMappingURL=json-schema.d.mts.map