import { z } from "zod"; import type { HumanInputResult, JsonValue } from "@boardwalk-labs/workflow"; /** The response form a gate presents — discriminated on `kind`. Mirrors SDK `HumanInputSpec` (the * inferred output widens optionals to `T | undefined`; {@link parseHumanInputSpec} returns it). */ export declare const humanInputSpecSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"text">; multiline: z.ZodOptional; placeholder: z.ZodOptional; required: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"choice">; options: z.ZodArray; allowOther: z.ZodOptional; otherLabel: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"multiselect">; options: z.ZodArray; allowOther: z.ZodOptional; otherLabel: z.ZodOptional; min: z.ZodOptional; max: z.ZodOptional; }, z.core.$strip>], "kind">; /** Parsed spec shape (optionals as `T | undefined`); a SDK `HumanInputSpec` is assignable to it. */ export type ParsedHumanInputSpec = z.infer; /** Parse an `unknown` (jsonb) spec into a typed spec. A tool-level gate may omit a spec entirely * (the model just asked a free-text question) → text; a malformed/foreign spec also degrades to * free text rather than stranding the gate unanswerable. */ export declare function parseHumanInputSpec(raw: unknown): ParsedHumanInputSpec; /** Re-hydrate a stored (jsonb) human-input result into the exact-optional SDK {@link HumanInputResult} * (the host returns it from a resumed `humanInput()` seam). The value was validated on submit, so a * parse failure here is a corrupt stored answer — surfaced as a clear program error. */ export declare function normalizeHumanInputResult(raw: unknown): HumanInputResult; /** Convert a validated {@link HumanInputResult} to a {@link JsonValue} for storage (the result is an * interface with optional props, which TS won't structurally accept as JsonValue; an explicit object * literal IS assignable to the index signature). The inverse of {@link normalizeHumanInputResult}. */ export declare function humanInputResultToJson(result: HumanInputResult): JsonValue; /** What to do when a gate's `timeout` elapses with no answer (the durable-suspension design). Mirrors the * SDK's `HumanInputOptions.onTimeout`: fail the run, or resolve the gate with a default value. */ export type OnTimeoutPolicy = { kind: "fail"; } | { kind: "value"; value: HumanInputResult; }; /** Parse a stored (jsonb) `on_timeout` into a policy. NULL / unrecognized ⇒ the SDK default `fail`; * a `{ value }` whose value doesn't validate as a result also degrades to `fail` (never strands). */ export declare function parseOnTimeout(raw: unknown): OnTimeoutPolicy; /** A responder's raw submission, before validation against the gate's spec. */ export interface RawHumanInputSubmission { /** Free text, or the chosen option / typed "other" value for a `choice` gate. */ value?: unknown; /** Selected values for a `multiselect` gate. */ values?: unknown; /** The typed freeform value for a `multiselect` "Other..." entry. */ other?: unknown; } /** * Validate a raw submission against the gate's spec, producing the typed {@link HumanInputResult} * the program receives. Throws `VALIDATION_FAILED` with a precise message on any mismatch — the * respond surfaces turn that into a 400 so a bad answer never resumes the run with garbage. */ export declare function validateHumanInputResponse(spec: ParsedHumanInputSpec, raw: RawHumanInputSubmission): HumanInputResult;