/** * The server-driven UI contract between a module runtime and keemakr-core. * * A module's `load` handler returns a ScreenTree; core validates it against * this schema BEFORE rendering — that validation is the security boundary. * Nothing here ever becomes raw HTML: every node maps to a platform-owned * component, so module output is data, not code. * * Versioning: `version` is a literal. A breaking change to any node shape * bumps UI_SCHEMA_VERSION and adds a new literal; core keeps rendering old * versions until modules migrate. */ import { z } from 'zod'; export declare const UI_SCHEMA_VERSION = 1; /** What a button (or table row) does when pressed. */ export declare const pressSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"action">; action: z.ZodString; input: z.ZodOptional>; confirm: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"navigate">; screen: z.ZodString; params: z.ZodOptional>; }, z.core.$strip>], "kind">; export declare const buttonSchema: z.ZodObject<{ type: z.ZodLiteral<"button">; label: z.ZodString; onPress: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"action">; action: z.ZodString; input: z.ZodOptional>; confirm: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"navigate">; screen: z.ZodString; params: z.ZodOptional>; }, z.core.$strip>], "kind">; variant: z.ZodDefault>; }, z.core.$strip>; /** A table cell. Dates are ISO 8601; core formats them tenant-locale-aware. */ export declare const cellSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"text">; value: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"badge">; value: z.ZodString; tone: z.ZodDefault>; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"date">; value: z.ZodISODateTime; }, z.core.$strip>], "kind">; declare const leafNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"heading">; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"text">; value: z.ZodString; muted: z.ZodDefault; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"markdown">; value: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"stat">; label: z.ZodString; value: z.ZodString; hint: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"button">; label: z.ZodString; onPress: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"action">; action: z.ZodString; input: z.ZodOptional>; confirm: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"navigate">; screen: z.ZodString; params: z.ZodOptional>; }, z.core.$strip>], "kind">; variant: z.ZodDefault>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"form">; key: z.ZodString; fields: z.ZodArray; name: z.ZodString; label: z.ZodString; value: z.ZodOptional; options: z.ZodOptional>>; required: z.ZodDefault; }, z.core.$strip>>; submit: z.ZodObject<{ label: z.ZodString; action: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"table">; columns: z.ZodArray>; rows: z.ZodArray; value: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"badge">; value: z.ZodString; tone: z.ZodDefault>; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"date">; value: z.ZodISODateTime; }, z.core.$strip>], "kind">>; onPress: z.ZodOptional; action: z.ZodString; input: z.ZodOptional>; confirm: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"navigate">; screen: z.ZodString; params: z.ZodOptional>; }, z.core.$strip>], "kind">>; expand: z.ZodOptional; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"text">; value: z.ZodString; muted: z.ZodDefault; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"markdown">; value: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"stat">; label: z.ZodString; value: z.ZodString; hint: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"button">; label: z.ZodString; onPress: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"action">; action: z.ZodString; input: z.ZodOptional>; confirm: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"navigate">; screen: z.ZodString; params: z.ZodOptional>; }, z.core.$strip>], "kind">; variant: z.ZodDefault>; }, z.core.$strip>], "type">>; }, z.core.$strip>>; }, z.core.$strip>>; empty: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"timeline">; items: z.ZodArray; at: z.ZodOptional; detail: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"pending_request">; requestId: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"pending_requests">; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"choice_cards">; choices: z.ZodArray; meta: z.ZodOptional; selected: z.ZodDefault; onPress: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"action">; action: z.ZodString; input: z.ZodOptional>; confirm: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"navigate">; screen: z.ZodString; params: z.ZodOptional>; }, z.core.$strip>], "kind">; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"progress">; steps: z.ZodArray; detail: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"chart">; chartType: z.ZodEnum<{ bar: "bar"; line: "line"; }>; title: z.ZodOptional; categories: z.ZodArray; series: z.ZodArray; }, z.core.$strip>>; }, z.core.$strip>], "type">; type LeafScreenNode = z.infer; type LeafScreenNodeInput = z.input; export type ScreenNode = LeafScreenNode | { type: 'section'; title?: string; description?: string; layout: 'stack' | 'grid'; columns: number; children: ScreenNode[]; }; type ScreenNodeInput = LeafScreenNodeInput | { type: 'section'; title?: string; description?: string; layout: 'stack' | 'grid'; columns: number; children: ScreenNodeInput[]; }; /** * A tab strip. Unlike `section` this is NOT part of the recursive chain: it * exists only in the composed root union below, and a tab's children descend * into the chain — which carries no `tabs` branch. Nested tabs, and tabs inside * a section, are therefore unrepresentable rather than merely rejected, and * `tabs` serialises into the generated contract exactly once. */ type TabsScreenNode = { type: 'tabs'; key: string; active?: string; tabs: { key: string; label: string; badge?: string; children: ScreenNode[]; }[]; }; type TabsScreenNodeInput = { type: 'tabs'; key: string; active?: string; tabs: { key: string; label: string; badge?: string; children: ScreenNodeInput[]; }[]; }; /** What a screen's top-level `children` may hold — the only place `tabs` appears. */ export type ScreenRootNode = ScreenNode | TabsScreenNode; type ScreenRootNodeInput = ScreenNodeInput | TabsScreenNodeInput; /** * The root union: the chain's own membership plus `tabs`. Both container * branches descend into the chain at depth 1, so nesting stays bounded by * MAX_SECTION_DEPTH exactly as it was before `tabs` existed. */ export declare const nodeSchema: z.ZodType; export declare const screenTreeSchema: z.ZodObject<{ version: z.ZodLiteral<1>; title: z.ZodString; description: z.ZodOptional; actions: z.ZodOptional; label: z.ZodString; onPress: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"action">; action: z.ZodString; input: z.ZodOptional>; confirm: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"navigate">; screen: z.ZodString; params: z.ZodOptional>; }, z.core.$strip>], "kind">; variant: z.ZodDefault>; }, z.core.$strip>>>; children: z.ZodArray>>; refreshSeconds: z.ZodOptional; }, z.core.$strip>; /** What an action handler returns. `refresh` re-runs `load` after the action. */ export declare const actionResultSchema: z.ZodObject<{ toast: z.ZodOptional; navigate: z.ZodOptional>; }, z.core.$strip>>; refresh: z.ZodDefault; }, z.core.$strip>; export declare const screenLoadRequestSchema: z.ZodObject<{ params: z.ZodDefault>; }, z.core.$strip>; export declare const screenLoadResponseSchema: z.ZodObject<{ tree: z.ZodObject<{ version: z.ZodLiteral<1>; title: z.ZodString; description: z.ZodOptional; actions: z.ZodOptional; label: z.ZodString; onPress: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"action">; action: z.ZodString; input: z.ZodOptional>; confirm: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"navigate">; screen: z.ZodString; params: z.ZodOptional>; }, z.core.$strip>], "kind">; variant: z.ZodDefault>; }, z.core.$strip>>>; children: z.ZodArray>>; refreshSeconds: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>; export declare const screenActionRequestSchema: z.ZodObject<{ params: z.ZodDefault>; input: z.ZodDefault>; idempotencyKey: z.ZodOptional; }, z.core.$strip>; export declare const interfaceFamilySchema: z.ZodEnum<{ dashboard: "dashboard"; client: "client"; }>; export declare const surfaceDefinitionSchema: z.ZodObject<{ label: z.ZodString; icon: z.ZodOptional; description: z.ZodOptional; availableOn: z.ZodArray>; }, z.core.$strip>; /** * Manifest addition: `manifest.surfaces[]` in entry.json. Each surface is a * side-menu entry pointing at an entry screen. Core's marketplace * validateSubmission composes this in (wired in the proxy phase). */ export declare const surfaceSchema: z.ZodObject<{ label: z.ZodString; icon: z.ZodOptional; description: z.ZodOptional; availableOn: z.ZodArray>; key: z.ZodString; screen: z.ZodString; }, z.core.$strip>; export declare const screenRegistrationSchema: z.ZodObject<{ screen: z.ZodString; surface: z.ZodString; }, z.core.$strip>; /** The complete generated UI portion of a module manifest. */ export declare const uiManifestSchema: z.ZodObject<{ surfaces: z.ZodArray; description: z.ZodOptional; availableOn: z.ZodArray>; key: z.ZodString; screen: z.ZodString; }, z.core.$strip>>; screenRegistry: z.ZodArray>; }, z.core.$strip>; export type Press = z.infer; export type ScreenTree = z.infer; export type ActionResult = z.infer; export type InterfaceFamily = z.infer; export type SurfaceDefinition = z.infer; export type Surface = z.infer; export type ScreenRegistration = z.infer; export type UiManifest = z.infer; export type ScreenTreeInput = z.input; export type ActionResultInput = z.input; export {};