import type { z } from "zod"; import type { AbortedResult } from "./abortedResult.js"; import type { Run } from "./asyncContext.js"; import type { Interrupt } from "./interrupts.js"; import type { ResultValue } from "./result.js"; import type { TypeValidationDescriptor } from "./validateChain.js"; /** What a validation hands back: the checked value, a failure, the * interrupts a `@validate` function raised, or the abort that stopped * the validator (a cancel or a guard trip). */ export type CheckOutcome = ResultValue | Interrupt[] | AbortedResult; /** One `!` parameter's check: the type text for the failure message, and * the validation the compiler chose for the type. */ export type ParamCheck = { typeText: string; validate: (run: Run, value: unknown) => Promise | CheckOutcome; }; /** The checks of one function, by parameter name. */ export type ParamChecks = Record; /** The check for a type that runs no validator: a zod schema. `build` runs * on the first check and the schema is kept, so a tool a model calls over * and over builds its schema once. Building late also lets a type alias * declared below the function resolve. */ export declare function __schemaCheck(build: () => z.ZodType): ParamCheck["validate"]; /** The check for a type that reaches a `@validate` tag: a descriptor walk. * The descriptor is built once, like the schema above. */ export declare function __descriptorCheck(build: () => TypeValidationDescriptor): ParamCheck["validate"]; export type HaltingRunner = { halt(result: unknown): void; readonly isNodeContext: boolean; }; export type ArgFrame = { args: Record; }; /** * Check the named `!` parameters of a function or node in order, reading * each raw argument from the frame and writing the checked value back. * * A check that fails halts the runner with the invalid-argument failure * and stops: later parameters are not checked. A validator that raised an * interrupt comes back as an interrupt list; a parameter check cannot * pause, so that halts with a failure too. So does anything else a * validator written in TypeScript might hand back. * * A validator that was aborted (the user cancelled, or a guard tripped) * comes back as an `AbortedResult`. That is not a failed check: the abort * is rethrown as the exception the function's catch turns back into an * aborted result, the same way a checked cast rethrows it. */ export declare function __checkParams(run: Run, runner: HaltingRunner, frame: ArgFrame, functionName: string, checks: ParamChecks, names: string[]): Promise;