import { z } from "zod"; export const queryRefSchema = z.object({ id: z.string(), params: z.record(z.string(), z.unknown()), }); export const componentRefSchema = z.object({ id: z.string(), props: z.record(z.string(), z.unknown()), }); export const panelSchema = z.object({ query: queryRefSchema, component: componentRefSchema, }); /** * The JSON shape an LLM emits. Layout is an open string so consumers can register * their own renderers (`grid`, `stack`, `tabs`, ...). Deeper validation of params * and component prop bindings happens in `validatePlan`. */ export const planSchema = z.object({ layout: z.string(), panels: z.array(panelSchema), }); export type QueryRef = z.infer; export type ComponentRef = z.infer; export type Panel = z.infer; export type Plan = z.infer;