import { type JsonSchema } from "./subschemas.js"; /** * A schema the provider rewriters cannot carry over without changing what it * accepts. Callers refuse it, or report the tool that holds it as unusable, * instead of advertising a contract the source never declared. */ export declare class UnusableSchemaError extends Error { readonly path: string; readonly reason: string; constructor(path: string, reason: string); } /** * An input schema whose `$schema` names a dialect the checks do not read: * usable but unchecked, and offered stripped and without `$schema`. */ export declare class UninterpretedSchema { readonly schema: JsonSchema; readonly dialect: unknown; constructor(schema: JsonSchema, dialect: unknown); } export declare function jsonTypeOf(value: unknown): string; /** * Throws at the first position that accepts no value: an empty `enum`, * `anyOf` or `oneOf`, a `const` or `enum` with no value of the position's * `type`, or a `const` its own `enum` does not list. No rewrite keeps that * meaning. A position is typed from its `enum` values, so one with none would * reach the provider with no type, which the pinned provider rules refuse; the * flattener widens a root composition with no branches to an unconstrained * object; and stripping drops an `enum` Gemini cannot hold but keeps the * position's `type` and `const`, which alone accept a value. */ export declare function assertEveryPositionAcceptsAValue(schema: object): void; /** * A plain copy of a JSON value, which the checks and rewrites read in place * of `value`. Each own enumerable string-keyed property is read once, through * its descriptor, and each of these throws at its position: a getter, which * could pass a check as one value and be advertised as another; NaN, * Infinity, undefined or a function; a cycle; an object that is not plain; * and one whose reads throw. */ export declare function plainJsonSnapshot(value: unknown): unknown; type InputSchemaVerdict = UnusableSchemaError | UninterpretedSchema; /** * Records against the `tool` `defineAction` built what its parameters cannot * show: why it could not advertise the schema, which stripping can hide, or * the dialect it left unread, whose `$schema` it deletes. Only that object * carries it: a copy of the action keeps it while it keeps the tool, and the * runtime `schema` can be shared by actions that advertise other schemas. */ export declare function recordInputSchemaVerdict(tool: object, verdict: InputSchemaVerdict): void; /** `to`, a tool built from `from`, with any verdict recorded against `from`. */ export declare function derivedTool(from: object, to: T): T; /** * `convert(entry.tool.parameters)`, with any `$schema` recorded against the * tool put back, or the `UnusableSchemaError` that leaves the action out of * the MCP and in-app tool lists: the one recorded, or `unusableVerdict` on * what reading or converting the parameters throws. It never throws: that * can be the action's, and would otherwise fail the whole request as its * error. */ export declare function usableInputSchema(entry: { tool: { parameters?: unknown; }; }, convert: (parameters: any) => T): T | UnusableSchemaError; /** * The verdict on a schema whose conversion threw `error`: an * `UnusableSchemaError`'s path and reason, rebuilt, or the thrown value's * message. The error can be a schema emitter's or a proxy trap's, so it is * tested and read without letting either throw. */ export declare function unusableVerdict(error: unknown): UnusableSchemaError; export {};