@keemakr/ui-sdk 1.5.0 → 1.6.0-dev-20261026112734

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +118 -0
  2. package/dist/badges.d.ts +65 -0
  3. package/dist/badges.js +96 -0
  4. package/dist/build.js +2 -2
  5. package/dist/cells.d.ts +31 -0
  6. package/dist/cells.js +45 -0
  7. package/dist/chart.d.ts +20 -0
  8. package/dist/chart.js +38 -0
  9. package/dist/conform.d.ts +21 -0
  10. package/dist/conform.js +310 -0
  11. package/dist/dataset.d.ts +6 -6
  12. package/dist/date-format.d.ts +64 -0
  13. package/dist/date-format.js +132 -0
  14. package/dist/drawer.d.ts +22 -0
  15. package/dist/drawer.js +21 -0
  16. package/dist/edit.d.ts +60 -0
  17. package/dist/edit.js +60 -0
  18. package/dist/filters.d.ts +54 -0
  19. package/dist/filters.js +81 -0
  20. package/dist/form.d.ts +45 -1
  21. package/dist/form.js +39 -0
  22. package/dist/heatmap.d.ts +36 -0
  23. package/dist/heatmap.js +56 -0
  24. package/dist/icon.d.ts +20 -0
  25. package/dist/icon.js +43 -0
  26. package/dist/index.d.ts +37 -4
  27. package/dist/index.js +21 -2
  28. package/dist/markdown-links.d.ts +29 -0
  29. package/dist/markdown-links.js +99 -0
  30. package/dist/media.js +7 -1
  31. package/dist/negotiate.d.ts +302 -0
  32. package/dist/negotiate.js +1092 -0
  33. package/dist/nodes.d.ts +1 -1
  34. package/dist/nodes.js +3 -0
  35. package/dist/pager.d.ts +2 -2
  36. package/dist/player.d.ts +46 -0
  37. package/dist/player.js +86 -0
  38. package/dist/published/index.d.ts +4 -0
  39. package/dist/published/index.js +18 -0
  40. package/dist/published/v1.1.0/schema.d.ts +439 -0
  41. package/dist/published/v1.1.0/schema.js +405 -0
  42. package/dist/published/v1.4.0/dataset-view.d.ts +160 -0
  43. package/dist/published/v1.4.0/dataset-view.js +702 -0
  44. package/dist/published/v1.4.0/dataset.d.ts +331 -0
  45. package/dist/published/v1.4.0/dataset.js +628 -0
  46. package/dist/published/v1.4.0/schema.d.ts +1132 -0
  47. package/dist/published/v1.4.0/schema.js +1410 -0
  48. package/dist/schema.d.ts +1638 -20
  49. package/dist/schema.js +1275 -72
  50. package/dist/section.d.ts +65 -0
  51. package/dist/section.js +81 -0
  52. package/dist/stacked-bar.d.ts +34 -0
  53. package/dist/stacked-bar.js +20 -0
  54. package/dist/stat.d.ts +24 -0
  55. package/dist/stat.js +27 -0
  56. package/dist/table-row.d.ts +24 -0
  57. package/dist/table-row.js +23 -0
  58. package/dist/tabs.d.ts +36 -0
  59. package/dist/tabs.js +83 -0
  60. package/dist/testkit.d.ts +38 -0
  61. package/dist/testkit.js +68 -0
  62. package/dist/timeline.d.ts +5 -0
  63. package/dist/timeline.js +35 -0
  64. package/examples/campaigns/README.md +22 -1
  65. package/examples/campaigns/approvals/index.ts +23 -0
  66. package/examples/campaigns/approvals/launch.ts +38 -0
  67. package/examples/campaigns/brief/index.ts +23 -0
  68. package/examples/campaigns/brief/ready.ts +43 -0
  69. package/examples/campaigns/demo-approvals.ts +35 -0
  70. package/examples/campaigns/demo-brief.ts +23 -0
  71. package/examples/campaigns/entry.json +71 -1
  72. package/examples/campaigns/tsconfig.json +8 -1
  73. package/package.json +6 -1
package/dist/nodes.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { ScreenRootNode } from './schema.js';
2
2
  /** Every node type the root union admits (KEE-574 item 3). */
3
- export declare const KNOWN_NODE_TYPES: readonly ["heading", "text", "markdown", "stat", "button", "form", "table", "timeline", "pending_request", "pending_requests", "choice_cards", "progress", "chart", "pagination", "select", "alert", "details", "timestamp", "divider", "board", "link", "tags", "toggle", "segmented", "progress_bar", "conversation", "composer", "calendar", "image", "video", "dataset", "section", "tabs"];
3
+ export declare const KNOWN_NODE_TYPES: readonly ["heading", "text", "markdown", "stat", "button", "form", "table", "timeline", "pending_request", "pending_requests", "choice_cards", "progress", "chart", "pagination", "select", "alert", "details", "timestamp", "divider", "board", "link", "tags", "toggle", "segmented", "progress_bar", "stacked_bar", "heatmap", "conversation", "composer", "calendar", "image", "video", "audio", "dataset", "section", "tabs"];
4
4
  export type KnownNodeType = (typeof KNOWN_NODE_TYPES)[number];
5
5
  /**
6
6
  * The node types that hold child nodes. `section` mounts its children
package/dist/nodes.js CHANGED
@@ -35,11 +35,14 @@ export const KNOWN_NODE_TYPES = [
35
35
  'toggle',
36
36
  'segmented',
37
37
  'progress_bar',
38
+ 'stacked_bar',
39
+ 'heatmap',
38
40
  'conversation',
39
41
  'composer',
40
42
  'calendar',
41
43
  'image',
42
44
  'video',
45
+ 'audio',
43
46
  'dataset',
44
47
  'section',
45
48
  'tabs',
package/dist/pager.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Press } from './schema.js';
1
+ import type { ValuePress } from './schema.js';
2
2
  /**
3
3
  * The press a pager or select fires once the user has chosen `value`: the
4
4
  * declared press with the value merged in under `name` — into `params` for a
@@ -6,7 +6,7 @@ import type { Press } from './schema.js';
6
6
  * `input` for an action. The chosen value wins over a same-named key the
7
7
  * author put there, since the author cannot know which page will be chosen.
8
8
  */
9
- export declare function pressWithValue(press: Press, name: string, value: string | number): Press;
9
+ export declare function pressWithValue(press: ValuePress, name: string, value: string | number): ValuePress;
10
10
  /**
11
11
  * The page numbers a compact pager draws, `null` marking an ellipsis:
12
12
  * `pageWindow(5, 13)` → `[1, null, 4, 5, 6, null, 13]`. First and last pages
@@ -0,0 +1,46 @@
1
+ /** The playback speeds an `audio` transport offers, slowest first. */
2
+ export declare const PLAYBACK_RATES: readonly [1, 1.5, 2];
3
+ export type PlaybackRate = (typeof PLAYBACK_RATES)[number];
4
+ /** The latest point a seek may name: 24 hours, in seconds. */
5
+ export declare const SEEK_AT_MAX = 86400;
6
+ /** A playhead position as a reader writes it: "0:42", "12:04", "1:02:03". Not a number: "0:00". */
7
+ export declare function formatPlayhead(seconds: number): string;
8
+ /** A playhead position in words, for a scrubber's `aria-valuetext`: "1 minute 42 seconds". */
9
+ export declare function playheadWords(seconds: number): string;
10
+ /** The speed after `rate` in PLAYBACK_RATES, wrapping to 1×: for a single speed button. */
11
+ export declare function nextPlaybackRate(rate: number): PlaybackRate;
12
+ /** "1×", "1.5×", "2×". */
13
+ export declare function playbackRateLabel(rate: number): string;
14
+ /**
15
+ * Where a seek lands: `at`, held inside the recording once its length is known, so a seek past
16
+ * the end stops at the end instead of failing. Before the length is known, `at` as it is.
17
+ */
18
+ export declare function seekTarget(at: number, duration: number): number;
19
+ /** True for a press that moves a recording's playhead. */
20
+ export declare function isSeekPress(press: {
21
+ kind: string;
22
+ } | undefined): press is {
23
+ kind: 'seek';
24
+ player: string;
25
+ at: number;
26
+ };
27
+ /** One place a tree names a player: a seek press, or a moment's or turn's `seek`. */
28
+ export interface SeekReference {
29
+ path: Array<string | number>;
30
+ player: string;
31
+ }
32
+ /** One `audio` or `video` that takes seeks, by its `key`. */
33
+ export interface PlayerKey {
34
+ path: Array<string | number>;
35
+ key: string;
36
+ }
37
+ /**
38
+ * Every recording key and every seek in a tree's children, with where each sits. Walks the
39
+ * tree as data, so a seek is found wherever a press is taken, without a list of press places to
40
+ * keep in step with the schema. An action's `input` and a navigate's `params` are the module's own
41
+ * data and are not read.
42
+ */
43
+ export declare function seeksIn(value: unknown): {
44
+ players: PlayerKey[];
45
+ seeks: SeekReference[];
46
+ };
package/dist/player.js ADDED
@@ -0,0 +1,86 @@
1
+ // Recordings a screen can drive: the `audio` block's transport, and a `seek` (a press, or a
2
+ // timeline item's or conversation turn's `seek`) that moves an `audio` or `video` playhead. Shared
3
+ // by core and the clients, so every renderer writes a time, offers the same speeds and finds the
4
+ // same player for a seek.
5
+ /** The playback speeds an `audio` transport offers, slowest first. */
6
+ export const PLAYBACK_RATES = [1, 1.5, 2];
7
+ /** The latest point a seek may name: 24 hours, in seconds. */
8
+ export const SEEK_AT_MAX = 86_400;
9
+ /** A playhead position as a reader writes it: "0:42", "12:04", "1:02:03". Not a number: "0:00". */
10
+ export function formatPlayhead(seconds) {
11
+ const whole = Number.isFinite(seconds) && seconds > 0 ? Math.floor(seconds) : 0;
12
+ const h = Math.floor(whole / 3600);
13
+ const m = Math.floor((whole % 3600) / 60);
14
+ const s = String(whole % 60).padStart(2, '0');
15
+ return h > 0 ? `${h}:${String(m).padStart(2, '0')}:${s}` : `${m}:${s}`;
16
+ }
17
+ /** A playhead position in words, for a scrubber's `aria-valuetext`: "1 minute 42 seconds". */
18
+ export function playheadWords(seconds) {
19
+ const whole = Number.isFinite(seconds) && seconds > 0 ? Math.floor(seconds) : 0;
20
+ const parts = [
21
+ [Math.floor(whole / 3600), 'hour'],
22
+ [Math.floor((whole % 3600) / 60), 'minute'],
23
+ [whole % 60, 'second'],
24
+ ];
25
+ const said = parts.filter(([n]) => n > 0).map(([n, unit]) => `${n} ${unit}${n === 1 ? '' : 's'}`);
26
+ return said.length > 0 ? said.join(' ') : '0 seconds';
27
+ }
28
+ /** The speed after `rate` in PLAYBACK_RATES, wrapping to 1×: for a single speed button. */
29
+ export function nextPlaybackRate(rate) {
30
+ const index = PLAYBACK_RATES.findIndex((r) => r === rate);
31
+ return PLAYBACK_RATES[(index + 1) % PLAYBACK_RATES.length];
32
+ }
33
+ /** "1×", "1.5×", "2×". */
34
+ export function playbackRateLabel(rate) {
35
+ return `${rate}×`;
36
+ }
37
+ /**
38
+ * Where a seek lands: `at`, held inside the recording once its length is known, so a seek past
39
+ * the end stops at the end instead of failing. Before the length is known, `at` as it is.
40
+ */
41
+ export function seekTarget(at, duration) {
42
+ const start = Number.isFinite(at) && at > 0 ? at : 0;
43
+ return Number.isFinite(duration) && duration > 0 ? Math.min(start, duration) : start;
44
+ }
45
+ /** True for a press that moves a recording's playhead. */
46
+ export function isSeekPress(press) {
47
+ return press?.kind === 'seek';
48
+ }
49
+ /**
50
+ * Every recording key and every seek in a tree's children, with where each sits. Walks the
51
+ * tree as data, so a seek is found wherever a press is taken, without a list of press places to
52
+ * keep in step with the schema. An action's `input` and a navigate's `params` are the module's own
53
+ * data and are not read.
54
+ */
55
+ export function seeksIn(value) {
56
+ const players = [];
57
+ const seeks = [];
58
+ const walk = (item, path) => {
59
+ if (Array.isArray(item)) {
60
+ item.forEach((child, index) => walk(child, [...path, index]));
61
+ return;
62
+ }
63
+ if (!item || typeof item !== 'object')
64
+ return;
65
+ const record = item;
66
+ if ((record.type === 'audio' || record.type === 'video') && typeof record.key === 'string') {
67
+ players.push({ path: [...path, 'key'], key: record.key });
68
+ }
69
+ if (record.kind === 'seek' && typeof record.player === 'string') {
70
+ seeks.push({ path: [...path, 'player'], player: record.player });
71
+ }
72
+ for (const [key, child] of Object.entries(record)) {
73
+ if (key === 'input' || key === 'params')
74
+ continue;
75
+ if (key === 'seek' && child && typeof child === 'object' && !Array.isArray(child)) {
76
+ const player = child.player;
77
+ if (typeof player === 'string')
78
+ seeks.push({ path: [...path, 'seek', 'player'], player });
79
+ continue;
80
+ }
81
+ walk(child, [...path, key]);
82
+ }
83
+ };
84
+ walk(value, []);
85
+ return { players, seeks };
86
+ }
@@ -0,0 +1,4 @@
1
+ import type { z } from 'zod';
2
+ /** The published ui-sdk releases a released app parses with. */
3
+ export type PublishedParser = '1.1.0' | '1.4.0';
4
+ export declare const PUBLISHED_PARSERS: Readonly<Record<PublishedParser, z.ZodType>>;
@@ -0,0 +1,18 @@
1
+ // The screen tree schemas that released apps really parse with.
2
+ //
3
+ // An app does not parse a screen with this package. It parses with the ui-sdk bundled inside the
4
+ // @fsztpartners/sdk it was built with, and that one is frozen the day the app ships:
5
+ //
6
+ // mobile 0.2.0 (sdk 2.5.0) -> ui-sdk 1.1.0 (1.2.0 has the same schema)
7
+ // mobile 0.2.3 to 0.2.5, web (sdk 3.5.0) -> ui-sdk 1.4.0
8
+ //
9
+ // Each copy under ./v1.1.0 and ./v1.4.0 is the published source, byte for byte, below a header.
10
+ // negotiate.ts checks every tree it sends an app against that app's copy (conform.ts), so a value
11
+ // or a field the app's parse refuses never reaches it, and a safety field its parse strips
12
+ // (a confirm, a disabled flag) never leaves a control that acts without it.
13
+ import { screenTreeSchema as parse110 } from './v1.1.0/schema.js';
14
+ import { screenTreeSchema as parse140 } from './v1.4.0/schema.js';
15
+ export const PUBLISHED_PARSERS = {
16
+ '1.1.0': parse110,
17
+ '1.4.0': parse140,
18
+ };
@@ -0,0 +1,439 @@
1
+ /**
2
+ * The server-driven UI contract between a module runtime and keemakr-core.
3
+ *
4
+ * A module's `load` handler returns a ScreenTree; core validates it against
5
+ * this schema BEFORE rendering — that validation is the security boundary.
6
+ * Nothing here ever becomes raw HTML: every node maps to a platform-owned
7
+ * component, so module output is data, not code.
8
+ *
9
+ * Versioning: `version` is a literal. A breaking change to any node shape
10
+ * bumps UI_SCHEMA_VERSION and adds a new literal; core keeps rendering old
11
+ * versions until modules migrate.
12
+ */
13
+ import { z } from 'zod';
14
+ export declare const UI_SCHEMA_VERSION = 1;
15
+ /** What a button (or table row) does when pressed. */
16
+ export declare const pressSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
17
+ kind: z.ZodLiteral<"action">;
18
+ action: z.ZodString;
19
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
20
+ confirm: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strip>, z.ZodObject<{
22
+ kind: z.ZodLiteral<"navigate">;
23
+ screen: z.ZodString;
24
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
25
+ }, z.core.$strip>], "kind">;
26
+ export declare const buttonSchema: z.ZodObject<{
27
+ type: z.ZodLiteral<"button">;
28
+ label: z.ZodString;
29
+ onPress: z.ZodDiscriminatedUnion<[z.ZodObject<{
30
+ kind: z.ZodLiteral<"action">;
31
+ action: z.ZodString;
32
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
33
+ confirm: z.ZodOptional<z.ZodString>;
34
+ }, z.core.$strip>, z.ZodObject<{
35
+ kind: z.ZodLiteral<"navigate">;
36
+ screen: z.ZodString;
37
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
38
+ }, z.core.$strip>], "kind">;
39
+ variant: z.ZodDefault<z.ZodEnum<{
40
+ destructive: "destructive";
41
+ secondary: "secondary";
42
+ primary: "primary";
43
+ }>>;
44
+ }, z.core.$strip>;
45
+ /** A table cell. Dates are ISO 8601; core formats them tenant-locale-aware. */
46
+ export declare const cellSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
47
+ kind: z.ZodLiteral<"text">;
48
+ value: z.ZodString;
49
+ }, z.core.$strip>, z.ZodObject<{
50
+ kind: z.ZodLiteral<"badge">;
51
+ value: z.ZodString;
52
+ tone: z.ZodDefault<z.ZodEnum<{
53
+ default: "default";
54
+ success: "success";
55
+ warning: "warning";
56
+ destructive: "destructive";
57
+ }>>;
58
+ }, z.core.$strip>, z.ZodObject<{
59
+ kind: z.ZodLiteral<"date">;
60
+ value: z.ZodISODateTime;
61
+ }, z.core.$strip>], "kind">;
62
+ declare const leafNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
63
+ type: z.ZodLiteral<"heading">;
64
+ text: z.ZodString;
65
+ }, z.core.$strip>, z.ZodObject<{
66
+ type: z.ZodLiteral<"text">;
67
+ value: z.ZodString;
68
+ muted: z.ZodDefault<z.ZodBoolean>;
69
+ }, z.core.$strip>, z.ZodObject<{
70
+ type: z.ZodLiteral<"markdown">;
71
+ value: z.ZodString;
72
+ }, z.core.$strip>, z.ZodObject<{
73
+ type: z.ZodLiteral<"stat">;
74
+ label: z.ZodString;
75
+ value: z.ZodString;
76
+ hint: z.ZodOptional<z.ZodString>;
77
+ }, z.core.$strip>, z.ZodObject<{
78
+ type: z.ZodLiteral<"button">;
79
+ label: z.ZodString;
80
+ onPress: z.ZodDiscriminatedUnion<[z.ZodObject<{
81
+ kind: z.ZodLiteral<"action">;
82
+ action: z.ZodString;
83
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
84
+ confirm: z.ZodOptional<z.ZodString>;
85
+ }, z.core.$strip>, z.ZodObject<{
86
+ kind: z.ZodLiteral<"navigate">;
87
+ screen: z.ZodString;
88
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
89
+ }, z.core.$strip>], "kind">;
90
+ variant: z.ZodDefault<z.ZodEnum<{
91
+ destructive: "destructive";
92
+ secondary: "secondary";
93
+ primary: "primary";
94
+ }>>;
95
+ }, z.core.$strip>, z.ZodObject<{
96
+ type: z.ZodLiteral<"form">;
97
+ key: z.ZodString;
98
+ fields: z.ZodArray<z.ZodObject<{
99
+ kind: z.ZodEnum<{
100
+ text: "text";
101
+ select: "select";
102
+ textarea: "textarea";
103
+ }>;
104
+ name: z.ZodString;
105
+ label: z.ZodString;
106
+ value: z.ZodOptional<z.ZodString>;
107
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
108
+ value: z.ZodString;
109
+ label: z.ZodString;
110
+ }, z.core.$strip>>>;
111
+ required: z.ZodDefault<z.ZodBoolean>;
112
+ }, z.core.$strip>>;
113
+ submit: z.ZodObject<{
114
+ label: z.ZodString;
115
+ action: z.ZodString;
116
+ }, z.core.$strip>;
117
+ }, z.core.$strip>, z.ZodObject<{
118
+ type: z.ZodLiteral<"table">;
119
+ columns: z.ZodArray<z.ZodObject<{
120
+ key: z.ZodString;
121
+ label: z.ZodString;
122
+ }, z.core.$strip>>;
123
+ rows: z.ZodArray<z.ZodObject<{
124
+ key: z.ZodString;
125
+ cells: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
126
+ kind: z.ZodLiteral<"text">;
127
+ value: z.ZodString;
128
+ }, z.core.$strip>, z.ZodObject<{
129
+ kind: z.ZodLiteral<"badge">;
130
+ value: z.ZodString;
131
+ tone: z.ZodDefault<z.ZodEnum<{
132
+ default: "default";
133
+ success: "success";
134
+ warning: "warning";
135
+ destructive: "destructive";
136
+ }>>;
137
+ }, z.core.$strip>, z.ZodObject<{
138
+ kind: z.ZodLiteral<"date">;
139
+ value: z.ZodISODateTime;
140
+ }, z.core.$strip>], "kind">>;
141
+ onPress: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
142
+ kind: z.ZodLiteral<"action">;
143
+ action: z.ZodString;
144
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
145
+ confirm: z.ZodOptional<z.ZodString>;
146
+ }, z.core.$strip>, z.ZodObject<{
147
+ kind: z.ZodLiteral<"navigate">;
148
+ screen: z.ZodString;
149
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
150
+ }, z.core.$strip>], "kind">>;
151
+ expand: z.ZodOptional<z.ZodObject<{
152
+ children: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
153
+ type: z.ZodLiteral<"heading">;
154
+ text: z.ZodString;
155
+ }, z.core.$strip>, z.ZodObject<{
156
+ type: z.ZodLiteral<"text">;
157
+ value: z.ZodString;
158
+ muted: z.ZodDefault<z.ZodBoolean>;
159
+ }, z.core.$strip>, z.ZodObject<{
160
+ type: z.ZodLiteral<"markdown">;
161
+ value: z.ZodString;
162
+ }, z.core.$strip>, z.ZodObject<{
163
+ type: z.ZodLiteral<"stat">;
164
+ label: z.ZodString;
165
+ value: z.ZodString;
166
+ hint: z.ZodOptional<z.ZodString>;
167
+ }, z.core.$strip>, z.ZodObject<{
168
+ type: z.ZodLiteral<"button">;
169
+ label: z.ZodString;
170
+ onPress: z.ZodDiscriminatedUnion<[z.ZodObject<{
171
+ kind: z.ZodLiteral<"action">;
172
+ action: z.ZodString;
173
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
174
+ confirm: z.ZodOptional<z.ZodString>;
175
+ }, z.core.$strip>, z.ZodObject<{
176
+ kind: z.ZodLiteral<"navigate">;
177
+ screen: z.ZodString;
178
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
179
+ }, z.core.$strip>], "kind">;
180
+ variant: z.ZodDefault<z.ZodEnum<{
181
+ destructive: "destructive";
182
+ secondary: "secondary";
183
+ primary: "primary";
184
+ }>>;
185
+ }, z.core.$strip>], "type">>;
186
+ }, z.core.$strip>>;
187
+ }, z.core.$strip>>;
188
+ empty: z.ZodString;
189
+ }, z.core.$strip>, z.ZodObject<{
190
+ type: z.ZodLiteral<"timeline">;
191
+ items: z.ZodArray<z.ZodObject<{
192
+ label: z.ZodString;
193
+ status: z.ZodEnum<{
194
+ error: "error";
195
+ pending: "pending";
196
+ active: "active";
197
+ done: "done";
198
+ }>;
199
+ at: z.ZodOptional<z.ZodISODateTime>;
200
+ detail: z.ZodOptional<z.ZodString>;
201
+ }, z.core.$strip>>;
202
+ }, z.core.$strip>, z.ZodObject<{
203
+ type: z.ZodLiteral<"pending_request">;
204
+ requestId: z.ZodString;
205
+ }, z.core.$strip>, z.ZodObject<{
206
+ type: z.ZodLiteral<"pending_requests">;
207
+ }, z.core.$strip>, z.ZodObject<{
208
+ type: z.ZodLiteral<"choice_cards">;
209
+ choices: z.ZodArray<z.ZodObject<{
210
+ id: z.ZodString;
211
+ title: z.ZodString;
212
+ description: z.ZodOptional<z.ZodString>;
213
+ meta: z.ZodOptional<z.ZodString>;
214
+ selected: z.ZodDefault<z.ZodBoolean>;
215
+ onPress: z.ZodDiscriminatedUnion<[z.ZodObject<{
216
+ kind: z.ZodLiteral<"action">;
217
+ action: z.ZodString;
218
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
219
+ confirm: z.ZodOptional<z.ZodString>;
220
+ }, z.core.$strip>, z.ZodObject<{
221
+ kind: z.ZodLiteral<"navigate">;
222
+ screen: z.ZodString;
223
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
224
+ }, z.core.$strip>], "kind">;
225
+ }, z.core.$strip>>;
226
+ }, z.core.$strip>, z.ZodObject<{
227
+ type: z.ZodLiteral<"progress">;
228
+ steps: z.ZodArray<z.ZodObject<{
229
+ label: z.ZodString;
230
+ status: z.ZodEnum<{
231
+ error: "error";
232
+ pending: "pending";
233
+ active: "active";
234
+ done: "done";
235
+ }>;
236
+ detail: z.ZodOptional<z.ZodString>;
237
+ }, z.core.$strip>>;
238
+ }, z.core.$strip>, z.ZodObject<{
239
+ type: z.ZodLiteral<"chart">;
240
+ chartType: z.ZodEnum<{
241
+ bar: "bar";
242
+ line: "line";
243
+ }>;
244
+ title: z.ZodOptional<z.ZodString>;
245
+ categories: z.ZodArray<z.ZodString>;
246
+ series: z.ZodArray<z.ZodObject<{
247
+ name: z.ZodString;
248
+ values: z.ZodArray<z.ZodNumber>;
249
+ }, z.core.$strip>>;
250
+ }, z.core.$strip>], "type">;
251
+ type LeafScreenNode = z.infer<typeof leafNodeSchema>;
252
+ type LeafScreenNodeInput = z.input<typeof leafNodeSchema>;
253
+ export type ScreenNode = LeafScreenNode | {
254
+ type: 'section';
255
+ title?: string;
256
+ description?: string;
257
+ layout: 'stack' | 'grid';
258
+ columns: number;
259
+ children: ScreenNode[];
260
+ };
261
+ type ScreenNodeInput = LeafScreenNodeInput | {
262
+ type: 'section';
263
+ title?: string;
264
+ description?: string;
265
+ layout: 'stack' | 'grid';
266
+ columns: number;
267
+ children: ScreenNodeInput[];
268
+ };
269
+ /**
270
+ * A tab strip. Unlike `section` this is NOT part of the recursive chain: it
271
+ * exists only in the composed root union below, and a tab's children descend
272
+ * into the chain — which carries no `tabs` branch. Nested tabs, and tabs inside
273
+ * a section, are therefore unrepresentable rather than merely rejected, and
274
+ * `tabs` serialises into the generated contract exactly once.
275
+ */
276
+ type TabsScreenNode = {
277
+ type: 'tabs';
278
+ key: string;
279
+ active?: string;
280
+ tabs: {
281
+ key: string;
282
+ label: string;
283
+ badge?: string;
284
+ children: ScreenNode[];
285
+ }[];
286
+ };
287
+ type TabsScreenNodeInput = {
288
+ type: 'tabs';
289
+ key: string;
290
+ active?: string;
291
+ tabs: {
292
+ key: string;
293
+ label: string;
294
+ badge?: string;
295
+ children: ScreenNodeInput[];
296
+ }[];
297
+ };
298
+ /** What a screen's top-level `children` may hold — the only place `tabs` appears. */
299
+ export type ScreenRootNode = ScreenNode | TabsScreenNode;
300
+ type ScreenRootNodeInput = ScreenNodeInput | TabsScreenNodeInput;
301
+ /**
302
+ * The root union: the chain's own membership plus `tabs`. Both container
303
+ * branches descend into the chain at depth 1, so nesting stays bounded by
304
+ * MAX_SECTION_DEPTH exactly as it was before `tabs` existed.
305
+ */
306
+ export declare const nodeSchema: z.ZodType<ScreenRootNode, ScreenRootNodeInput>;
307
+ export declare const screenTreeSchema: z.ZodObject<{
308
+ version: z.ZodLiteral<1>;
309
+ title: z.ZodString;
310
+ description: z.ZodOptional<z.ZodString>;
311
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
312
+ type: z.ZodLiteral<"button">;
313
+ label: z.ZodString;
314
+ onPress: z.ZodDiscriminatedUnion<[z.ZodObject<{
315
+ kind: z.ZodLiteral<"action">;
316
+ action: z.ZodString;
317
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
318
+ confirm: z.ZodOptional<z.ZodString>;
319
+ }, z.core.$strip>, z.ZodObject<{
320
+ kind: z.ZodLiteral<"navigate">;
321
+ screen: z.ZodString;
322
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
323
+ }, z.core.$strip>], "kind">;
324
+ variant: z.ZodDefault<z.ZodEnum<{
325
+ destructive: "destructive";
326
+ secondary: "secondary";
327
+ primary: "primary";
328
+ }>>;
329
+ }, z.core.$strip>>>;
330
+ children: z.ZodArray<z.ZodType<ScreenRootNode, ScreenRootNodeInput, z.core.$ZodTypeInternals<ScreenRootNode, ScreenRootNodeInput>>>;
331
+ refreshSeconds: z.ZodOptional<z.ZodNumber>;
332
+ }, z.core.$strip>;
333
+ /** What an action handler returns. `refresh` re-runs `load` after the action. */
334
+ export declare const actionResultSchema: z.ZodObject<{
335
+ toast: z.ZodOptional<z.ZodString>;
336
+ navigate: z.ZodOptional<z.ZodObject<{
337
+ screen: z.ZodString;
338
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
339
+ }, z.core.$strip>>;
340
+ refresh: z.ZodDefault<z.ZodBoolean>;
341
+ }, z.core.$strip>;
342
+ export declare const screenLoadRequestSchema: z.ZodObject<{
343
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
344
+ }, z.core.$strip>;
345
+ export declare const screenLoadResponseSchema: z.ZodObject<{
346
+ tree: z.ZodObject<{
347
+ version: z.ZodLiteral<1>;
348
+ title: z.ZodString;
349
+ description: z.ZodOptional<z.ZodString>;
350
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
351
+ type: z.ZodLiteral<"button">;
352
+ label: z.ZodString;
353
+ onPress: z.ZodDiscriminatedUnion<[z.ZodObject<{
354
+ kind: z.ZodLiteral<"action">;
355
+ action: z.ZodString;
356
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
357
+ confirm: z.ZodOptional<z.ZodString>;
358
+ }, z.core.$strip>, z.ZodObject<{
359
+ kind: z.ZodLiteral<"navigate">;
360
+ screen: z.ZodString;
361
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
362
+ }, z.core.$strip>], "kind">;
363
+ variant: z.ZodDefault<z.ZodEnum<{
364
+ destructive: "destructive";
365
+ secondary: "secondary";
366
+ primary: "primary";
367
+ }>>;
368
+ }, z.core.$strip>>>;
369
+ children: z.ZodArray<z.ZodType<ScreenRootNode, ScreenRootNodeInput, z.core.$ZodTypeInternals<ScreenRootNode, ScreenRootNodeInput>>>;
370
+ refreshSeconds: z.ZodOptional<z.ZodNumber>;
371
+ }, z.core.$strip>;
372
+ }, z.core.$strip>;
373
+ export declare const screenActionRequestSchema: z.ZodObject<{
374
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
375
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
376
+ idempotencyKey: z.ZodOptional<z.ZodString>;
377
+ }, z.core.$strip>;
378
+ export declare const interfaceFamilySchema: z.ZodEnum<{
379
+ dashboard: "dashboard";
380
+ client: "client";
381
+ }>;
382
+ export declare const surfaceDefinitionSchema: z.ZodObject<{
383
+ label: z.ZodString;
384
+ icon: z.ZodOptional<z.ZodString>;
385
+ description: z.ZodOptional<z.ZodString>;
386
+ availableOn: z.ZodArray<z.ZodEnum<{
387
+ dashboard: "dashboard";
388
+ client: "client";
389
+ }>>;
390
+ }, z.core.$strip>;
391
+ /**
392
+ * Manifest addition: `manifest.surfaces[]` in entry.json. Each surface is a
393
+ * side-menu entry pointing at an entry screen. Core's marketplace
394
+ * validateSubmission composes this in (wired in the proxy phase).
395
+ */
396
+ export declare const surfaceSchema: z.ZodObject<{
397
+ label: z.ZodString;
398
+ icon: z.ZodOptional<z.ZodString>;
399
+ description: z.ZodOptional<z.ZodString>;
400
+ availableOn: z.ZodArray<z.ZodEnum<{
401
+ dashboard: "dashboard";
402
+ client: "client";
403
+ }>>;
404
+ key: z.ZodString;
405
+ screen: z.ZodString;
406
+ }, z.core.$strip>;
407
+ export declare const screenRegistrationSchema: z.ZodObject<{
408
+ screen: z.ZodString;
409
+ surface: z.ZodString;
410
+ }, z.core.$strip>;
411
+ /** The complete generated UI portion of a module manifest. */
412
+ export declare const uiManifestSchema: z.ZodObject<{
413
+ surfaces: z.ZodArray<z.ZodObject<{
414
+ label: z.ZodString;
415
+ icon: z.ZodOptional<z.ZodString>;
416
+ description: z.ZodOptional<z.ZodString>;
417
+ availableOn: z.ZodArray<z.ZodEnum<{
418
+ dashboard: "dashboard";
419
+ client: "client";
420
+ }>>;
421
+ key: z.ZodString;
422
+ screen: z.ZodString;
423
+ }, z.core.$strip>>;
424
+ screenRegistry: z.ZodArray<z.ZodObject<{
425
+ screen: z.ZodString;
426
+ surface: z.ZodString;
427
+ }, z.core.$strip>>;
428
+ }, z.core.$strip>;
429
+ export type Press = z.infer<typeof pressSchema>;
430
+ export type ScreenTree = z.infer<typeof screenTreeSchema>;
431
+ export type ActionResult = z.infer<typeof actionResultSchema>;
432
+ export type InterfaceFamily = z.infer<typeof interfaceFamilySchema>;
433
+ export type SurfaceDefinition = z.infer<typeof surfaceDefinitionSchema>;
434
+ export type Surface = z.infer<typeof surfaceSchema>;
435
+ export type ScreenRegistration = z.infer<typeof screenRegistrationSchema>;
436
+ export type UiManifest = z.infer<typeof uiManifestSchema>;
437
+ export type ScreenTreeInput = z.input<typeof screenTreeSchema>;
438
+ export type ActionResultInput = z.input<typeof actionResultSchema>;
439
+ export {};