import * as z from "zod"; /** * Any JSON value accepted by an authoring field (`input.example`, * `defaults.run_input`, node bindings, JSON Schema documents). * * Structurally identical to zod's own `util.JSONType`, and mutually assignable * with it — the only difference is that the array member is a **named** * interface instead of the anonymous `JSONType[]`. * * That difference is load-bearing for every frontend consumer. Vue's * `UnwrapRef` maps an array member to a fresh anonymous mapped type at each * level (`{ [K in keyof T]: UnwrapRefSimple }`), so TypeScript's * recursion-identity check never fires on a self-recursive JSON alias and the * instantiation depth limit is hit instead: * * ``` * error TS2589: Type instantiation is excessively deep and possibly infinite. * ``` * * A consumer sees that error on their own `const d = ref(…)` * line, with nothing pointing back here. Naming the array member gives the * recursion a stable identity, so the check fires and `ref()` * resolves. Verified against both TypeScript 5.9 and 6.0. * * Do not replace `FlowJsonArray` with `FlowJsonValue[]` — that reintroduces the * regression. `packages/bridge-vue/test/flow-definition-vue-ref.test-d.ts` * guards it. */ export interface FlowJsonArray extends Array { } /** @see {@link FlowJsonArray} for why the array member is a named interface. */ export type FlowJsonValue = string | number | boolean | null | FlowJsonArray | { [key: string]: FlowJsonValue; }; declare const modelTier: z.ZodEnum<{ default: "default"; small: "small"; deep: "deep"; }>; export declare const InputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"text">; multiline: z.ZodOptional; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"choice">; options: z.ZodArray; }, z.core.$strict>>; multiple: z.ZodOptional; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"form">; fields: z.ZodArray; required: z.ZodOptional; options: z.ZodOptional; }, z.core.$strict>>>; accept: z.ZodOptional>; }, z.core.$strict>>; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"file">; accept: z.ZodOptional>; maxSize: z.ZodOptional; multiple: z.ZodOptional; }, z.core.$strict>], "kind">; /** Validates normalized field shapes without applying authored-v2 graph semantics. */ export declare function parseFlowDefinitionStructure(data: unknown): z.ZodSafeParseResult<{ schemaVersion: 2; id: string; version: string; name: string; nodes: { id: string; label: string; description: string; run: { kind: "agent"; instruction: string; assets?: string[] | undefined; model?: "default" | "small" | "deep" | undefined; } | { kind: "subprompt"; instruction: string; assets?: string[] | undefined; model?: "default" | "small" | "deep" | undefined; } | { command: string; kind: "function"; assets?: string[] | undefined; runtime?: "shell" | "node" | "python" | undefined; cwd?: string | undefined; successExit?: number[] | undefined; capture?: { stdout?: string | undefined; stderr?: string | undefined; } | undefined; } | { command: string; kind: "check"; onFail: "escalate" | "fail"; assets?: string[] | undefined; runtime?: "shell" | "node" | "python" | undefined; cwd?: string | undefined; successExit?: number[] | undefined; capture?: { stdout?: string | undefined; stderr?: string | undefined; } | undefined; } | { kind: "gate"; prompt: string; schema: { kind: "text"; multiline?: boolean | undefined; } | { kind: "choice"; options: { id: string; label: string; description?: string | undefined; }[]; multiple?: boolean | undefined; } | { kind: "form"; fields: { id: string; label: string; type: "number" | "boolean" | "file" | "text" | "choice" | "textarea" | "date"; required?: boolean | undefined; options?: { id: string; label: string; description?: string | undefined; }[] | undefined; accept?: string[] | undefined; }[]; } | { kind: "file"; accept?: string[] | undefined; maxSize?: number | undefined; multiple?: boolean | undefined; }; assets?: string[] | undefined; } | { kind: "router"; routes: { when: string; target: string | null; }[]; assets?: string[] | undefined; } | { kind: "sub-flow"; flow: string; assets?: string[] | undefined; passContext?: boolean | undefined; }; phase?: string | undefined; contract?: { requires?: { expr: string; message?: string | undefined; }[] | undefined; input?: Record | undefined; output?: { fields?: Record | undefined; artifacts?: { kind: string; lifetime: "session" | "persistent"; }[] | undefined; } | undefined; } | undefined; gate?: { approval: "none" | "optional" | "mandatory"; } | undefined; control?: { optional?: boolean | undefined; retries?: number | undefined; timeoutSec?: number | undefined; parallelGroup?: string | undefined; } | undefined; }[]; edges: { id: string; source: string; target: string; type: "flow" | "optional" | "parallel"; }[]; $schema?: string | undefined; description?: string | undefined; input?: { schema: Record; example?: FlowJsonValue | undefined; labelField?: string | undefined; } | undefined; output?: { schema: Record; } | undefined; defaults?: { approval?: "manual" | "auto" | "checkpoint" | undefined; researchDepth?: string | undefined; autoReview?: boolean | undefined; verbosity?: string | undefined; cliMode?: boolean | undefined; run_input?: FlowJsonValue | undefined; parameters?: Record | undefined; } | undefined; entry?: string | undefined; meta?: { icon?: string | undefined; category?: string | undefined; tags?: string[] | undefined; stage?: string | undefined; onboarding?: { input_style: "repo" | "freeform" | "structured"; placeholder?: string | undefined; fields?: string[] | undefined; } | undefined; } | undefined; }>; /** Authoritative strict runtime schema for authored, acyclic Flow v2 definitions. */ export declare const FlowDefinitionSchema: z.ZodObject<{ $schema: z.ZodOptional; schemaVersion: z.ZodLiteral<2>; id: z.ZodString; version: z.ZodString; name: z.ZodString; description: z.ZodOptional; input: z.ZodOptional>>; example: z.ZodOptional>>; labelField: z.ZodOptional; }, z.core.$strict>>; output: z.ZodOptional>>; }, z.core.$strict>>; defaults: z.ZodOptional>; researchDepth: z.ZodOptional; autoReview: z.ZodOptional; verbosity: z.ZodOptional; cliMode: z.ZodOptional; run_input: z.ZodOptional>>; parameters: z.ZodOptional>>>; }, z.core.$strict>>; entry: z.ZodOptional; nodes: z.ZodArray; run: z.ZodDiscriminatedUnion<[z.ZodObject<{ assets: z.ZodOptional>; kind: z.ZodLiteral<"agent">; instruction: z.ZodString; model: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ assets: z.ZodOptional>; kind: z.ZodLiteral<"subprompt">; instruction: z.ZodString; model: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ assets: z.ZodOptional>; runtime: z.ZodOptional>; command: z.ZodString; cwd: z.ZodOptional; successExit: z.ZodOptional>; capture: z.ZodOptional; stderr: z.ZodOptional; }, z.core.$strict>>; kind: z.ZodLiteral<"function">; }, z.core.$strict>, z.ZodObject<{ assets: z.ZodOptional>; runtime: z.ZodOptional>; command: z.ZodString; cwd: z.ZodOptional; successExit: z.ZodOptional>; capture: z.ZodOptional; stderr: z.ZodOptional; }, z.core.$strict>>; kind: z.ZodLiteral<"check">; onFail: z.ZodDefault>; }, z.core.$strict>, z.ZodObject<{ assets: z.ZodOptional>; kind: z.ZodLiteral<"gate">; prompt: z.ZodString; schema: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"text">; multiline: z.ZodOptional; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"choice">; options: z.ZodArray; }, z.core.$strict>>; multiple: z.ZodOptional; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"form">; fields: z.ZodArray; required: z.ZodOptional; options: z.ZodOptional; }, z.core.$strict>>>; accept: z.ZodOptional>; }, z.core.$strict>>; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"file">; accept: z.ZodOptional>; maxSize: z.ZodOptional; multiple: z.ZodOptional; }, z.core.$strict>], "kind">; }, z.core.$strict>, z.ZodObject<{ assets: z.ZodOptional>; kind: z.ZodLiteral<"router">; routes: z.ZodArray; }, z.core.$strict>>; }, z.core.$strict>, z.ZodObject<{ assets: z.ZodOptional>; kind: z.ZodLiteral<"sub-flow">; flow: z.ZodString; passContext: z.ZodOptional; }, z.core.$strict>], "kind">; contract: z.ZodOptional; }, z.core.$strict>>>; input: z.ZodOptional>>>>; output: z.ZodOptional>>>; artifacts: z.ZodOptional; }, z.core.$strict>>>; }, z.core.$strict>>; }, z.core.$strict>>; gate: z.ZodOptional; }, z.core.$strict>>; control: z.ZodOptional; retries: z.ZodOptional; timeoutSec: z.ZodOptional; parallelGroup: z.ZodOptional; }, z.core.$strict>>; }, z.core.$strict>>; edges: z.ZodArray; }, z.core.$strict>>; meta: z.ZodOptional; category: z.ZodOptional; tags: z.ZodOptional>; stage: z.ZodOptional; onboarding: z.ZodOptional; placeholder: z.ZodOptional; fields: z.ZodOptional>; }, z.core.$strict>>; }, z.core.$strict>>; }, z.core.$strict>; /** Validated authoring content that is strict, acyclic, and always schema version 2. */ export type FlowDefinition = z.infer; /** Graph vertex whose execution identity comes only from its `run.kind`. */ export type FlowNode = FlowDefinition["nodes"][number]; /** Directed dependency link whose authored array position remains content-significant. */ export type FlowEdge = FlowDefinition["edges"][number]; /** Closed execution-owner declaration with no dispatch or conversation-mode switches. */ export type FlowNodeRun = FlowNode["run"]; /** Closed vocabulary of the seven supported execution-owner identities. */ export type FlowNodeKind = FlowNodeRun["kind"]; /** Validation boundary applied to values entering a Flow run. */ export type FlowInputContract = NonNullable; /** Validation boundary applied to values leaving a Flow run. */ export type FlowOutputContract = NonNullable; /** Node admission and data contract; output typing is paid only when downstream consumers need it. */ export type FlowNodeContract = NonNullable; /** Availability and failure policy that never changes execution ownership. */ export type FlowNodeControl = NonNullable; /** Named values resolved at the consumer boundary before admission. */ export type FlowNodeBindings = NonNullable["input"]; /** Bounded deterministic admission condition; arbitrary calls and property access are invalid. */ export type FlowNodePrecondition = NonNullable["requires"] extends Array | undefined ? T : never; /** Ordered router branch; the first matching condition owns the routing decision. */ export type FlowRoute = Extract["routes"][number]; /** Asset requirement independent of node identity and available on every run kind. */ export type FlowAssetRef = NonNullable[number]; /** Model tier for `agent` and `subprompt` runs; `default` inherits the session model * (`agent`) or the runtime default (`subprompt`) rather than naming a concrete model. */ export type FlowModelTier = z.infer; export {}; //# sourceMappingURL=schema.d.ts.map