import { z } from "zod";
import type { ResultValue } from "./result.js";
import { AgencyFunction } from "./agencyFunction.js";
/**
 * Async validator used by `@validate(...)` chains. May be:
 *  - a plain async function `(value) => Result` (the simplest shape;
 *    users can import `success` / `failure` from the agency-lang runtime
 *    and return whichever applies);
 *  - an `AgencyFunction` (an Agency `def` referenced by name), which is
 *    invoked via `.invoke({ type: "positional", args: [value] })` so we
 *    go through the same call infrastructure as `__call(...)`.
 *
 * Validators that need access to the execution context read it from the
 * active `agencyStore` ALS frame via `getRuntimeContext()`. There is no
 * `ctx` arg to thread through.
 */
export type AgencyValidator = ((value: unknown) => Promise<ResultValue> | ResultValue) | AgencyFunction;
/**
 * Run Zod parse then thread the result through validators in order,
 * stopping on the first failure. Validators may transform: the value
 * passed to validator N+1 is whatever validator N returned with success.
 *
 * Why outside Zod? See spec § "Why run validators outside Zod" —
 * keeping validators out of the sync Zod path lets them be async,
 * call other Agency functions, hit the network, etc.
 */
export declare function __validateChain(value: unknown, schema: z.ZodType, validators: AgencyValidator[]): Promise<ResultValue>;
/**
 * Structural descriptor for nested validation. Built at codegen time
 * from the resolved type tree. The walker uses this descriptor to know
 * which validator list to apply at each depth and how to dispatch
 * unions / arrays / objects / nullables.
 */
export type TypeValidationDescriptor = {
    kind: "leaf";
    schema: z.ZodType;
    validators: AgencyValidator[];
} | {
    kind: "object";
    schema: z.ZodType;
    validators: AgencyValidator[];
    properties: Record<string, TypeValidationDescriptor>;
} | {
    kind: "array";
    schema: z.ZodType;
    validators: AgencyValidator[];
    element: TypeValidationDescriptor;
} | {
    kind: "union";
    schema: z.ZodType;
    validators: AgencyValidator[];
    branches: Array<{
        test: (v: unknown) => boolean;
        descriptor: TypeValidationDescriptor;
    }>;
} | {
    kind: "nullable";
    schema: z.ZodType;
    validators: AgencyValidator[];
    inner: TypeValidationDescriptor;
};
export type RecursiveValidationOpts = {
    /** Hard cap on traversal depth. Default 64. */
    maxDepth?: number;
};
/**
 * Walk `value` alongside `descriptor`, running per-node validator chains
 * and recursing into nested types. Bails with a failure once depth
 * exceeds `opts.maxDepth ?? 64`.
 */
export declare function __validateChainRecursive(value: unknown, descriptor: TypeValidationDescriptor, opts?: RecursiveValidationOpts): Promise<ResultValue>;
