import type { ZodUnknownSchema } from "../types/index.js";
/**
 * Inline a JSON Schema by recursively resolving all $ref references.
 * zodToJsonSchema with 'name' option produces schemas with $ref pointing to definitions.
 * Some SDKs (like @google/genai) expect flat schemas without $ref.
 *
 * This function handles:
 * - Top-level $ref resolution
 * - Nested $ref within properties, items, additionalProperties
 * - $ref within allOf, anyOf, oneOf arrays
 * - Deep $ref paths like "#/definitions/Foo/properties/bar"
 * - Circular reference detection to prevent infinite loops
 */
export declare function inlineJsonSchema(schema: Record<string, unknown>, definitions?: Record<string, Record<string, unknown>>, visited?: Set<string>, rootSchema?: Record<string, unknown>): Record<string, unknown>;
/**
 * Recursively ensure all nested schemas have a type field.
 * Google Vertex AI requires ALL schema objects (including nested properties) to have a type field.
 * This function walks through the schema tree and adds type:"object" to any object-like schema
 * that's missing its type field.
 */
export declare function ensureNestedSchemaTypes(schema: Record<string, unknown>): Record<string, unknown>;
/**
 * Convert Zod schema to JSON Schema format for provider APIs.
 *
 * Handles three input types:
 * 1. Zod schemas (have `_def.typeName`) -- converted via zod-to-json-schema
 * 2. AI SDK `jsonSchema()` wrappers (have `.jsonSchema` property) -- extracted directly
 * 3. Plain JSON Schema objects (have `type`/`properties` but no `_def`) -- returned as-is
 */
export declare function convertZodToJsonSchema(zodSchema: ZodUnknownSchema | Record<string, unknown>, target?: "jsonSchema7" | "openApi3"): object;
export declare function normalizeJsonSchemaObject(schema: Record<string, unknown> | undefined | null): Record<string, unknown>;
/**
 * Normalize a JSON Schema for the OpenAI chat-completions `tools` wire
 * block. Generic proxied backends (LiteLLM → vllm/GLM/Qwen, local servers)
 * render tool schemas into chat templates more or less verbatim, so `$ref`
 * indirection, `$defs` containers, `$schema` annotations, and zod's
 * nullable `anyOf` pattern all measurably degrade argument generation —
 * this is the parity gap behind "the model can't find the right arguments"
 * on litellm while the same tools work on Gemini/Claude native paths
 * (which sanitize schemas before the wire).
 *
 * Pipeline: strip annotation keys → inline local `$ref`/`$defs`/
 * `definitions` → collapse nullable variants → guarantee a top-level object
 * shape. Identity for already-clean schemas; `description`, `required`,
 * `enum`, and `default` — what models actually read — are always preserved.
 */
export declare function normalizeWireToolSchema(schema: unknown): Record<string, unknown>;
/**
 * Check if a value is a Zod schema
 */
export declare function isZodSchema(value: unknown): boolean;
/**
 * Whether a schema was built by Zod 4 specifically.
 *
 * Zod 4 hangs its internals off `_zod` (and `z.toJSONSchema` reads
 * `schema._zod.def`); Zod 3 has only `_def`. The two can coexist in one install
 * — a host on Zod 3 still resolves NeuroLink's own Zod 4 — so the presence of
 * `z.toJSONSchema` says nothing about the schema actually being handed to it.
 */
export declare function isZod4Schema(value: unknown): boolean;
/**
 * Convert JSON Schema to Zod schema format using official json-schema-to-zod library
 * This ensures complete preservation of all schema structure and validation rules
 */
export declare function convertJsonSchemaToZod(jsonSchema: Record<string, unknown>): ZodUnknownSchema;
