@clickless/react 0.0.0-stage → 0.1.0

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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1095 -2
  3. package/dist/actions/actionCalls.d.ts +50 -0
  4. package/dist/actions/actionRegistry.d.ts +78 -0
  5. package/dist/components/Adaptive.d.ts +116 -0
  6. package/dist/components/AdaptiveAction.d.ts +4 -0
  7. package/dist/components/AdaptiveProvider.d.ts +38 -0
  8. package/dist/components/AdaptiveRegion.d.ts +60 -0
  9. package/dist/components/ClicklessUiErrorBoundary.d.ts +24 -0
  10. package/dist/components/OriginalToolbar.d.ts +21 -0
  11. package/dist/components/PromptBar.d.ts +21 -0
  12. package/dist/components/PromptPanel.d.ts +103 -0
  13. package/dist/components/WorkingDots.d.ts +4 -0
  14. package/dist/components/focusAfterPromptAction.d.ts +15 -0
  15. package/dist/components/hostColorScheme.d.ts +35 -0
  16. package/dist/components/promptPanelStyles.d.ts +14 -0
  17. package/dist/core/applyOperations.d.ts +21 -0
  18. package/dist/core/colorContrast.d.ts +22 -0
  19. package/dist/core/defaultLayout.d.ts +12 -0
  20. package/dist/core/index.d.ts +8 -0
  21. package/dist/core/ownProperties.d.ts +11 -0
  22. package/dist/core/propValues.d.ts +8 -0
  23. package/dist/core/reconcileLayout.d.ts +59 -0
  24. package/dist/core/schemas.gen.d.ts +427 -0
  25. package/dist/core/validateActionCalls.d.ts +28 -0
  26. package/dist/core/validateManifest.d.ts +11 -0
  27. package/dist/core/validateOperations.d.ts +15 -0
  28. package/dist/engine/engineClient.d.ts +231 -0
  29. package/dist/engine/engineErrorMessages.d.ts +13 -0
  30. package/dist/engine/engineResponses.d.ts +201 -0
  31. package/dist/engine/plainReplies.d.ts +2 -0
  32. package/dist/hooks/useActionRunHistory.d.ts +12 -0
  33. package/dist/hooks/useAdaptiveAction.d.ts +11 -0
  34. package/dist/hooks/useAdaptiveRegion.d.ts +34 -0
  35. package/dist/hooks/useChangeHistory.d.ts +32 -0
  36. package/dist/hooks/useDictation.d.ts +50 -0
  37. package/dist/hooks/useEngineReachable.d.ts +5 -0
  38. package/dist/hooks/usePromptBar.d.ts +163 -0
  39. package/dist/hooks/useRegionGroup.d.ts +15 -0
  40. package/dist/index.d.ts +21 -0
  41. package/dist/index.js +6600 -0
  42. package/dist/presets/mergePresets.d.ts +20 -0
  43. package/dist/presets/propPresets.d.ts +305 -0
  44. package/dist/region/changedComponentIds.d.ts +13 -0
  45. package/dist/region/firstPaintOrder.d.ts +19 -0
  46. package/dist/region/previewRequests.d.ts +21 -0
  47. package/dist/region/regionContext.d.ts +96 -0
  48. package/dist/region/regionGroup.d.ts +189 -0
  49. package/dist/region/regionSnapshot.d.ts +52 -0
  50. package/dist/region/regionStore.d.ts +361 -0
  51. package/dist/region/responsiveColumns.d.ts +35 -0
  52. package/dist/region/retrier.d.ts +22 -0
  53. package/dist/region/savedLayoutParsing.d.ts +7 -0
  54. package/dist/region/settleIntoSavedLayout.d.ts +14 -0
  55. package/dist/region/textDirection.d.ts +12 -0
  56. package/dist/region/unsavedChangeSaver.d.ts +45 -0
  57. package/dist/region/unsavedChanges.d.ts +78 -0
  58. package/dist/region/userFacingTitle.d.ts +7 -0
  59. package/package.json +59 -3
@@ -0,0 +1,12 @@
1
+ import { Layout, type Component, type LayoutItem, type Manifest } from "./schemas.gen.js";
2
+ /** The layout shape this SDK writes and reads, as the schema states it. */
3
+ export declare const LAYOUT_FORMAT_VERSION: 1;
4
+ export declare function cloneLayoutItem(layoutItem: LayoutItem): LayoutItem;
5
+ /** A width and a height for a layout item, leaving out whichever the component does not have. */
6
+ export declare function withSize(width: number | undefined, height: number | undefined): Pick<LayoutItem, "w" | "h">;
7
+ /** The values each of a component's list props offers, to record alongside a saved item. */
8
+ export declare function offeredValuesOf(component: Component): LayoutItem["offeredValues"];
9
+ export declare function defaultLayoutItem(component: Component): LayoutItem;
10
+ export declare function defaultLayout(manifest: Manifest): Layout;
11
+ /** True when the layout holds exactly the manifest's components, each once. */
12
+ export declare function layoutMatchesManifest(manifest: Manifest, layout: Layout): boolean;
@@ -0,0 +1,8 @@
1
+ export * from "./schemas.gen.js";
2
+ export { defaultLayout, layoutMatchesManifest } from "./defaultLayout.js";
3
+ export { validateOperations, type OperationError, type OperationErrorCode } from "./validateOperations.js";
4
+ export { fileTypeAccepted, findActionsFailure, validateActionCalls, type ActionCallError, type ActionCallErrorCode, type AttachedFile, } from "./validateActionCalls.js";
5
+ export { applyOperations, type ApplyOperationsOutcome } from "./applyOperations.js";
6
+ export { MAX_OFF_SCREEN_COMPONENTS, reconcileLayout, reconcileLayoutItem, savedOrderOfKnownComponents, type LayoutChange, type ReconciledLayout, } from "./reconcileLayout.js";
7
+ export { contrastRatio, ensureReadableTextColor, readableTextColor } from "./colorContrast.js";
8
+ export { propAcceptsValue } from "./propValues.js";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Sets an entry that is the record's own, whatever it is called. Assigning to
3
+ * the name `__proto__` would change what the record inherits from instead of
4
+ * adding an entry, and components and props are named by developers.
5
+ */
6
+ export declare function setOwnProperty<T>(record: Record<string, T>, propertyName: string, propertyValue: T): void;
7
+ /**
8
+ * What a record holds under a property name, leaving out what every object inherits: a
9
+ * prop named "constructor" or "toString" is absent unless the record has it.
10
+ */
11
+ export declare function ownPropertyValue<T>(record: Record<string, T> | undefined, propertyName: string): T | undefined;
@@ -0,0 +1,8 @@
1
+ import type { PropCapabilities, PropValue } from "./schemas.gen.js";
2
+ export declare function clonePropValue(propValue: PropValue): PropValue;
3
+ /**
4
+ * Whether a prop declared this way may hold the value. Comparison is strict on
5
+ * purpose: "25" is not 25 and 1 is not true.
6
+ */
7
+ export declare function propAcceptsValue(propCapabilities: PropCapabilities, propValue: PropValue): boolean;
8
+ export declare function propValuesEqual(firstValue: PropValue | undefined, secondValue: PropValue | undefined): boolean;
@@ -0,0 +1,59 @@
1
+ import type { Component, Layout, LayoutItem, Manifest } from "./schemas.gen.js";
2
+ export interface LayoutChange {
3
+ /**
4
+ * `added`: the component is new in this version and was placed with its defaults.
5
+ * `removed`: something the layout held for a component was dropped for good.
6
+ * `adjusted`: a setting the manifest no longer allows was corrected.
7
+ */
8
+ type: "added" | "removed" | "adjusted";
9
+ id: string;
10
+ }
11
+ export interface ReconciledLayout {
12
+ layout: Layout;
13
+ changes: LayoutChange[];
14
+ }
15
+ /**
16
+ * The most components a layout keeps settings for while they are off screen.
17
+ * Nothing else ever drops them: a component a release deleted cannot be told
18
+ * from one that is not showing, and losing what a user set is worse than
19
+ * keeping an entry nobody sees. So without a limit, deleted components would
20
+ * pile up release after release, and a caller sending a different manifest
21
+ * with every change could grow the stored layout without end. It is the most
22
+ * one manifest may list, so a region whose every component is off screen at
23
+ * once still fits. Past it, the ones last in the order are dropped.
24
+ * Must equal the engine's own `MAX_OFF_SCREEN_COMPONENTS`, or the screen and
25
+ * the engine would disagree.
26
+ */
27
+ export declare const MAX_OFF_SCREEN_COMPONENTS = 500;
28
+ /**
29
+ * Carries a saved layout over to a manifest, keeping everything the manifest
30
+ * still allows. The result's `order` and `items` always hold exactly the
31
+ * manifest's components.
32
+ *
33
+ * A manifest lists what is on screen now, which may be only part of the region:
34
+ * one tab's content, say. A saved component it does not list is set aside in
35
+ * `offScreen` with its settings and its place, and takes them again when it is
36
+ * listed. It is kept however long it stays away, up to
37
+ * `MAX_OFF_SCREEN_COMPONENTS`, since a component a release deleted looks the
38
+ * same as one that is merely not showing.
39
+ *
40
+ * New components take their defaults and go after the nearest earlier manifest
41
+ * neighbour already in the layout, or first if there is none. They are reported
42
+ * as added only when the version changed: within one version, a component the
43
+ * layout has not met was simply not on screen when it was saved. Settings are
44
+ * corrected only where they break the manifest.
45
+ */
46
+ export declare function reconcileLayout(manifest: Manifest, layout: Layout): ReconciledLayout;
47
+ /**
48
+ * Every component the layout has settings and a place for, on screen or off,
49
+ * in one order. `offScreen.order` gives each its slot, but `order` may have
50
+ * been rearranged since it was written, so the slots of the components in
51
+ * `order` are filled in the sequence `order` now gives. Anything with no slot
52
+ * goes last.
53
+ */
54
+ export declare function savedOrderOfKnownComponents(layout: Layout): string[];
55
+ /**
56
+ * One component's saved settings, corrected the way `reconcileLayout` corrects them.
57
+ * For showing a saved item before the whole manifest is known.
58
+ */
59
+ export declare function reconcileLayoutItem(component: Component, savedItem: LayoutItem, columnCount: number): LayoutItem;
@@ -0,0 +1,427 @@
1
+ import { z } from "zod";
2
+ export declare const PropValue: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>]>;
3
+ export type PropValue = z.infer<typeof PropValue>;
4
+ export declare const ResizeCapabilities: z.ZodObject<{
5
+ minW: z.ZodNumber;
6
+ maxW: z.ZodNumber;
7
+ minH: z.ZodNumber;
8
+ maxH: z.ZodNumber;
9
+ }, z.core.$strict>;
10
+ export type ResizeCapabilities = z.infer<typeof ResizeCapabilities>;
11
+ export declare const ChoiceCapabilities: z.ZodObject<{
12
+ values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>;
13
+ multiple: z.ZodOptional<z.ZodBoolean>;
14
+ min: z.ZodOptional<z.ZodNumber>;
15
+ required: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>>;
16
+ }, z.core.$strict>;
17
+ export type ChoiceCapabilities = z.infer<typeof ChoiceCapabilities>;
18
+ export declare const ColorCapabilities: z.ZodObject<{
19
+ type: z.ZodLiteral<"color">;
20
+ suggested: z.ZodOptional<z.ZodArray<z.ZodString>>;
21
+ textOn: z.ZodOptional<z.ZodObject<{
22
+ colorProp: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$strict>>;
24
+ against: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strict>;
26
+ export type ColorCapabilities = z.infer<typeof ColorCapabilities>;
27
+ export declare const NumberCapabilities: z.ZodObject<{
28
+ type: z.ZodLiteral<"number">;
29
+ min: z.ZodNumber;
30
+ max: z.ZodNumber;
31
+ integer: z.ZodOptional<z.ZodBoolean>;
32
+ }, z.core.$strict>;
33
+ export type NumberCapabilities = z.infer<typeof NumberCapabilities>;
34
+ export declare const PropCapabilities: z.ZodUnion<readonly [z.ZodObject<{
35
+ values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>;
36
+ multiple: z.ZodOptional<z.ZodBoolean>;
37
+ min: z.ZodOptional<z.ZodNumber>;
38
+ required: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>>;
39
+ }, z.core.$strict>, z.ZodObject<{
40
+ type: z.ZodLiteral<"color">;
41
+ suggested: z.ZodOptional<z.ZodArray<z.ZodString>>;
42
+ textOn: z.ZodOptional<z.ZodObject<{
43
+ colorProp: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$strict>>;
45
+ against: z.ZodOptional<z.ZodString>;
46
+ }, z.core.$strict>, z.ZodObject<{
47
+ type: z.ZodLiteral<"number">;
48
+ min: z.ZodNumber;
49
+ max: z.ZodNumber;
50
+ integer: z.ZodOptional<z.ZodBoolean>;
51
+ }, z.core.$strict>]>;
52
+ export type PropCapabilities = z.infer<typeof PropCapabilities>;
53
+ export declare const Capabilities: z.ZodObject<{
54
+ move: z.ZodBoolean;
55
+ hide: z.ZodBoolean;
56
+ resize: z.ZodOptional<z.ZodObject<{
57
+ minW: z.ZodNumber;
58
+ maxW: z.ZodNumber;
59
+ minH: z.ZodNumber;
60
+ maxH: z.ZodNumber;
61
+ }, z.core.$strict>>;
62
+ props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
63
+ values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>;
64
+ multiple: z.ZodOptional<z.ZodBoolean>;
65
+ min: z.ZodOptional<z.ZodNumber>;
66
+ required: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>>;
67
+ }, z.core.$strict>, z.ZodObject<{
68
+ type: z.ZodLiteral<"color">;
69
+ suggested: z.ZodOptional<z.ZodArray<z.ZodString>>;
70
+ textOn: z.ZodOptional<z.ZodObject<{
71
+ colorProp: z.ZodOptional<z.ZodString>;
72
+ }, z.core.$strict>>;
73
+ against: z.ZodOptional<z.ZodString>;
74
+ }, z.core.$strict>, z.ZodObject<{
75
+ type: z.ZodLiteral<"number">;
76
+ min: z.ZodNumber;
77
+ max: z.ZodNumber;
78
+ integer: z.ZodOptional<z.ZodBoolean>;
79
+ }, z.core.$strict>]>>>;
80
+ }, z.core.$strict>;
81
+ export type Capabilities = z.infer<typeof Capabilities>;
82
+ export declare const LayoutItem: z.ZodObject<{
83
+ w: z.ZodOptional<z.ZodNumber>;
84
+ h: z.ZodOptional<z.ZodNumber>;
85
+ hidden: z.ZodBoolean;
86
+ props: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>]>>;
87
+ offeredValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>>>;
88
+ }, z.core.$strict>;
89
+ export type LayoutItem = z.infer<typeof LayoutItem>;
90
+ export declare const Component: z.ZodObject<{
91
+ id: z.ZodString;
92
+ kind: z.ZodString;
93
+ title: z.ZodString;
94
+ description: z.ZodOptional<z.ZodString>;
95
+ locked: z.ZodOptional<z.ZodBoolean>;
96
+ group: z.ZodOptional<z.ZodString>;
97
+ capabilities: z.ZodObject<{
98
+ move: z.ZodBoolean;
99
+ hide: z.ZodBoolean;
100
+ resize: z.ZodOptional<z.ZodObject<{
101
+ minW: z.ZodNumber;
102
+ maxW: z.ZodNumber;
103
+ minH: z.ZodNumber;
104
+ maxH: z.ZodNumber;
105
+ }, z.core.$strict>>;
106
+ props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
107
+ values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>;
108
+ multiple: z.ZodOptional<z.ZodBoolean>;
109
+ min: z.ZodOptional<z.ZodNumber>;
110
+ required: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>>;
111
+ }, z.core.$strict>, z.ZodObject<{
112
+ type: z.ZodLiteral<"color">;
113
+ suggested: z.ZodOptional<z.ZodArray<z.ZodString>>;
114
+ textOn: z.ZodOptional<z.ZodObject<{
115
+ colorProp: z.ZodOptional<z.ZodString>;
116
+ }, z.core.$strict>>;
117
+ against: z.ZodOptional<z.ZodString>;
118
+ }, z.core.$strict>, z.ZodObject<{
119
+ type: z.ZodLiteral<"number">;
120
+ min: z.ZodNumber;
121
+ max: z.ZodNumber;
122
+ integer: z.ZodOptional<z.ZodBoolean>;
123
+ }, z.core.$strict>]>>>;
124
+ }, z.core.$strict>;
125
+ defaults: z.ZodObject<{
126
+ w: z.ZodOptional<z.ZodNumber>;
127
+ h: z.ZodOptional<z.ZodNumber>;
128
+ hidden: z.ZodBoolean;
129
+ props: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>]>>;
130
+ offeredValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>>>;
131
+ }, z.core.$strict>;
132
+ }, z.core.$strict>;
133
+ export type Component = z.infer<typeof Component>;
134
+ export declare const Manifest: z.ZodObject<{
135
+ regionId: z.ZodString;
136
+ version: z.ZodString;
137
+ columns: z.ZodNumber;
138
+ title: z.ZodOptional<z.ZodString>;
139
+ grid: z.ZodOptional<z.ZodBoolean>;
140
+ components: z.ZodArray<z.ZodObject<{
141
+ id: z.ZodString;
142
+ kind: z.ZodString;
143
+ title: z.ZodString;
144
+ description: z.ZodOptional<z.ZodString>;
145
+ locked: z.ZodOptional<z.ZodBoolean>;
146
+ group: z.ZodOptional<z.ZodString>;
147
+ capabilities: z.ZodObject<{
148
+ move: z.ZodBoolean;
149
+ hide: z.ZodBoolean;
150
+ resize: z.ZodOptional<z.ZodObject<{
151
+ minW: z.ZodNumber;
152
+ maxW: z.ZodNumber;
153
+ minH: z.ZodNumber;
154
+ maxH: z.ZodNumber;
155
+ }, z.core.$strict>>;
156
+ props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
157
+ values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>;
158
+ multiple: z.ZodOptional<z.ZodBoolean>;
159
+ min: z.ZodOptional<z.ZodNumber>;
160
+ required: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>>;
161
+ }, z.core.$strict>, z.ZodObject<{
162
+ type: z.ZodLiteral<"color">;
163
+ suggested: z.ZodOptional<z.ZodArray<z.ZodString>>;
164
+ textOn: z.ZodOptional<z.ZodObject<{
165
+ colorProp: z.ZodOptional<z.ZodString>;
166
+ }, z.core.$strict>>;
167
+ against: z.ZodOptional<z.ZodString>;
168
+ }, z.core.$strict>, z.ZodObject<{
169
+ type: z.ZodLiteral<"number">;
170
+ min: z.ZodNumber;
171
+ max: z.ZodNumber;
172
+ integer: z.ZodOptional<z.ZodBoolean>;
173
+ }, z.core.$strict>]>>>;
174
+ }, z.core.$strict>;
175
+ defaults: z.ZodObject<{
176
+ w: z.ZodOptional<z.ZodNumber>;
177
+ h: z.ZodOptional<z.ZodNumber>;
178
+ hidden: z.ZodBoolean;
179
+ props: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>]>>;
180
+ offeredValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>>>;
181
+ }, z.core.$strict>;
182
+ }, z.core.$strict>>;
183
+ }, z.core.$strict>;
184
+ export type Manifest = z.infer<typeof Manifest>;
185
+ export declare const OffScreen: z.ZodObject<{
186
+ order: z.ZodArray<z.ZodString>;
187
+ items: z.ZodRecord<z.ZodString, z.ZodObject<{
188
+ w: z.ZodOptional<z.ZodNumber>;
189
+ h: z.ZodOptional<z.ZodNumber>;
190
+ hidden: z.ZodBoolean;
191
+ props: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>]>>;
192
+ offeredValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>>>;
193
+ }, z.core.$strict>>;
194
+ }, z.core.$strict>;
195
+ export type OffScreen = z.infer<typeof OffScreen>;
196
+ export declare const Layout: z.ZodObject<{
197
+ formatVersion: z.ZodLiteral<1>;
198
+ regionId: z.ZodString;
199
+ manifestVersion: z.ZodString;
200
+ order: z.ZodArray<z.ZodString>;
201
+ items: z.ZodRecord<z.ZodString, z.ZodObject<{
202
+ w: z.ZodOptional<z.ZodNumber>;
203
+ h: z.ZodOptional<z.ZodNumber>;
204
+ hidden: z.ZodBoolean;
205
+ props: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>]>>;
206
+ offeredValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>>>;
207
+ }, z.core.$strict>>;
208
+ offScreen: z.ZodOptional<z.ZodObject<{
209
+ order: z.ZodArray<z.ZodString>;
210
+ items: z.ZodRecord<z.ZodString, z.ZodObject<{
211
+ w: z.ZodOptional<z.ZodNumber>;
212
+ h: z.ZodOptional<z.ZodNumber>;
213
+ hidden: z.ZodBoolean;
214
+ props: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>]>>;
215
+ offeredValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>>>;
216
+ }, z.core.$strict>>;
217
+ }, z.core.$strict>>;
218
+ }, z.core.$strict>;
219
+ export type Layout = z.infer<typeof Layout>;
220
+ export declare const MoveOperation: z.ZodObject<{
221
+ type: z.ZodLiteral<"move">;
222
+ id: z.ZodString;
223
+ position: z.ZodEnum<{
224
+ after: "after";
225
+ before: "before";
226
+ end: "end";
227
+ start: "start";
228
+ }>;
229
+ targetId: z.ZodOptional<z.ZodString>;
230
+ }, z.core.$strict>;
231
+ export type MoveOperation = z.infer<typeof MoveOperation>;
232
+ export declare const ResizeOperation: z.ZodObject<{
233
+ type: z.ZodLiteral<"resize">;
234
+ id: z.ZodString;
235
+ w: z.ZodOptional<z.ZodNumber>;
236
+ h: z.ZodOptional<z.ZodNumber>;
237
+ }, z.core.$strict>;
238
+ export type ResizeOperation = z.infer<typeof ResizeOperation>;
239
+ export declare const HideOperation: z.ZodObject<{
240
+ type: z.ZodLiteral<"hide">;
241
+ id: z.ZodString;
242
+ }, z.core.$strict>;
243
+ export type HideOperation = z.infer<typeof HideOperation>;
244
+ export declare const ShowOperation: z.ZodObject<{
245
+ type: z.ZodLiteral<"show">;
246
+ id: z.ZodString;
247
+ }, z.core.$strict>;
248
+ export type ShowOperation = z.infer<typeof ShowOperation>;
249
+ export declare const SetPropOperation: z.ZodObject<{
250
+ type: z.ZodLiteral<"setProp">;
251
+ id: z.ZodString;
252
+ prop: z.ZodString;
253
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>]>;
254
+ }, z.core.$strict>;
255
+ export type SetPropOperation = z.infer<typeof SetPropOperation>;
256
+ export declare const ReorderOperation: z.ZodObject<{
257
+ type: z.ZodLiteral<"reorder">;
258
+ ids: z.ZodArray<z.ZodString>;
259
+ }, z.core.$strict>;
260
+ export type ReorderOperation = z.infer<typeof ReorderOperation>;
261
+ export declare const ResetOperation: z.ZodObject<{
262
+ type: z.ZodLiteral<"reset">;
263
+ id: z.ZodOptional<z.ZodString>;
264
+ }, z.core.$strict>;
265
+ export type ResetOperation = z.infer<typeof ResetOperation>;
266
+ export declare const Operation: z.ZodUnion<readonly [z.ZodObject<{
267
+ type: z.ZodLiteral<"move">;
268
+ id: z.ZodString;
269
+ position: z.ZodEnum<{
270
+ after: "after";
271
+ before: "before";
272
+ end: "end";
273
+ start: "start";
274
+ }>;
275
+ targetId: z.ZodOptional<z.ZodString>;
276
+ }, z.core.$strict>, z.ZodObject<{
277
+ type: z.ZodLiteral<"resize">;
278
+ id: z.ZodString;
279
+ w: z.ZodOptional<z.ZodNumber>;
280
+ h: z.ZodOptional<z.ZodNumber>;
281
+ }, z.core.$strict>, z.ZodObject<{
282
+ type: z.ZodLiteral<"hide">;
283
+ id: z.ZodString;
284
+ }, z.core.$strict>, z.ZodObject<{
285
+ type: z.ZodLiteral<"show">;
286
+ id: z.ZodString;
287
+ }, z.core.$strict>, z.ZodObject<{
288
+ type: z.ZodLiteral<"setProp">;
289
+ id: z.ZodString;
290
+ prop: z.ZodString;
291
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>]>;
292
+ }, z.core.$strict>, z.ZodObject<{
293
+ type: z.ZodLiteral<"reorder">;
294
+ ids: z.ZodArray<z.ZodString>;
295
+ }, z.core.$strict>, z.ZodObject<{
296
+ type: z.ZodLiteral<"reset">;
297
+ id: z.ZodOptional<z.ZodString>;
298
+ }, z.core.$strict>]>;
299
+ export type Operation = z.infer<typeof Operation>;
300
+ export declare const OperationList: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
301
+ type: z.ZodLiteral<"move">;
302
+ id: z.ZodString;
303
+ position: z.ZodEnum<{
304
+ after: "after";
305
+ before: "before";
306
+ end: "end";
307
+ start: "start";
308
+ }>;
309
+ targetId: z.ZodOptional<z.ZodString>;
310
+ }, z.core.$strict>, z.ZodObject<{
311
+ type: z.ZodLiteral<"resize">;
312
+ id: z.ZodString;
313
+ w: z.ZodOptional<z.ZodNumber>;
314
+ h: z.ZodOptional<z.ZodNumber>;
315
+ }, z.core.$strict>, z.ZodObject<{
316
+ type: z.ZodLiteral<"hide">;
317
+ id: z.ZodString;
318
+ }, z.core.$strict>, z.ZodObject<{
319
+ type: z.ZodLiteral<"show">;
320
+ id: z.ZodString;
321
+ }, z.core.$strict>, z.ZodObject<{
322
+ type: z.ZodLiteral<"setProp">;
323
+ id: z.ZodString;
324
+ prop: z.ZodString;
325
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNumber, z.ZodBoolean]>>]>;
326
+ }, z.core.$strict>, z.ZodObject<{
327
+ type: z.ZodLiteral<"reorder">;
328
+ ids: z.ZodArray<z.ZodString>;
329
+ }, z.core.$strict>, z.ZodObject<{
330
+ type: z.ZodLiteral<"reset">;
331
+ id: z.ZodOptional<z.ZodString>;
332
+ }, z.core.$strict>]>>;
333
+ export type OperationList = z.infer<typeof OperationList>;
334
+ export declare const TextParameter: z.ZodObject<{
335
+ type: z.ZodLiteral<"text">;
336
+ description: z.ZodOptional<z.ZodString>;
337
+ required: z.ZodOptional<z.ZodBoolean>;
338
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
339
+ maxLength: z.ZodOptional<z.ZodNumber>;
340
+ }, z.core.$strict>;
341
+ export type TextParameter = z.infer<typeof TextParameter>;
342
+ export declare const NumberParameter: z.ZodObject<{
343
+ type: z.ZodLiteral<"number">;
344
+ description: z.ZodOptional<z.ZodString>;
345
+ required: z.ZodOptional<z.ZodBoolean>;
346
+ min: z.ZodOptional<z.ZodNumber>;
347
+ max: z.ZodOptional<z.ZodNumber>;
348
+ integer: z.ZodOptional<z.ZodBoolean>;
349
+ }, z.core.$strict>;
350
+ export type NumberParameter = z.infer<typeof NumberParameter>;
351
+ export declare const BooleanParameter: z.ZodObject<{
352
+ type: z.ZodLiteral<"boolean">;
353
+ description: z.ZodOptional<z.ZodString>;
354
+ required: z.ZodOptional<z.ZodBoolean>;
355
+ }, z.core.$strict>;
356
+ export type BooleanParameter = z.infer<typeof BooleanParameter>;
357
+ export declare const FileParameter: z.ZodObject<{
358
+ type: z.ZodLiteral<"file">;
359
+ description: z.ZodOptional<z.ZodString>;
360
+ required: z.ZodOptional<z.ZodBoolean>;
361
+ accept: z.ZodOptional<z.ZodArray<z.ZodString>>;
362
+ }, z.core.$strict>;
363
+ export type FileParameter = z.infer<typeof FileParameter>;
364
+ export declare const ActionParameter: z.ZodUnion<readonly [z.ZodObject<{
365
+ type: z.ZodLiteral<"text">;
366
+ description: z.ZodOptional<z.ZodString>;
367
+ required: z.ZodOptional<z.ZodBoolean>;
368
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
369
+ maxLength: z.ZodOptional<z.ZodNumber>;
370
+ }, z.core.$strict>, z.ZodObject<{
371
+ type: z.ZodLiteral<"number">;
372
+ description: z.ZodOptional<z.ZodString>;
373
+ required: z.ZodOptional<z.ZodBoolean>;
374
+ min: z.ZodOptional<z.ZodNumber>;
375
+ max: z.ZodOptional<z.ZodNumber>;
376
+ integer: z.ZodOptional<z.ZodBoolean>;
377
+ }, z.core.$strict>, z.ZodObject<{
378
+ type: z.ZodLiteral<"boolean">;
379
+ description: z.ZodOptional<z.ZodString>;
380
+ required: z.ZodOptional<z.ZodBoolean>;
381
+ }, z.core.$strict>, z.ZodObject<{
382
+ type: z.ZodLiteral<"file">;
383
+ description: z.ZodOptional<z.ZodString>;
384
+ required: z.ZodOptional<z.ZodBoolean>;
385
+ accept: z.ZodOptional<z.ZodArray<z.ZodString>>;
386
+ }, z.core.$strict>]>;
387
+ export type ActionParameter = z.infer<typeof ActionParameter>;
388
+ export declare const Action: z.ZodObject<{
389
+ name: z.ZodString;
390
+ title: z.ZodString;
391
+ description: z.ZodOptional<z.ZodString>;
392
+ mode: z.ZodEnum<{
393
+ read: "read";
394
+ write: "write";
395
+ }>;
396
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
397
+ type: z.ZodLiteral<"text">;
398
+ description: z.ZodOptional<z.ZodString>;
399
+ required: z.ZodOptional<z.ZodBoolean>;
400
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
401
+ maxLength: z.ZodOptional<z.ZodNumber>;
402
+ }, z.core.$strict>, z.ZodObject<{
403
+ type: z.ZodLiteral<"number">;
404
+ description: z.ZodOptional<z.ZodString>;
405
+ required: z.ZodOptional<z.ZodBoolean>;
406
+ min: z.ZodOptional<z.ZodNumber>;
407
+ max: z.ZodOptional<z.ZodNumber>;
408
+ integer: z.ZodOptional<z.ZodBoolean>;
409
+ }, z.core.$strict>, z.ZodObject<{
410
+ type: z.ZodLiteral<"boolean">;
411
+ description: z.ZodOptional<z.ZodString>;
412
+ required: z.ZodOptional<z.ZodBoolean>;
413
+ }, z.core.$strict>, z.ZodObject<{
414
+ type: z.ZodLiteral<"file">;
415
+ description: z.ZodOptional<z.ZodString>;
416
+ required: z.ZodOptional<z.ZodBoolean>;
417
+ accept: z.ZodOptional<z.ZodArray<z.ZodString>>;
418
+ }, z.core.$strict>]>>;
419
+ }, z.core.$strict>;
420
+ export type Action = z.infer<typeof Action>;
421
+ export declare const ActionArgument: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
422
+ export type ActionArgument = z.infer<typeof ActionArgument>;
423
+ export declare const ActionCall: z.ZodObject<{
424
+ name: z.ZodString;
425
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
426
+ }, z.core.$strict>;
427
+ export type ActionCall = z.infer<typeof ActionCall>;
@@ -0,0 +1,28 @@
1
+ import type { Action, ActionCall } from "./schemas.gen.js";
2
+ export type ActionCallErrorCode = "unknown_action" | "unknown_argument" | "missing_argument" | "invalid_argument";
3
+ export interface ActionCallError {
4
+ /** Position of the offending call in the list. */
5
+ index: number;
6
+ code: ActionCallErrorCode;
7
+ message: string;
8
+ }
9
+ /** What a call is told about a file the user attached: only its media type, never its content. */
10
+ export interface AttachedFile {
11
+ type: string;
12
+ }
13
+ /**
14
+ * Checks every call against the actions declared, and reports at most one error
15
+ * per call. The check order is part of the contract shared with the Python
16
+ * engine: the action exists, then each argument is one it declares (in the
17
+ * order the call gives them), then each required parameter is given and each
18
+ * value is one it accepts (in the order the action declares them).
19
+ */
20
+ export declare function validateActionCalls(actions: readonly Action[], actionCalls: readonly ActionCall[], attachedFiles?: readonly AttachedFile[]): ActionCallError[];
21
+ /** Whether a media type is one of `accept`, where `image/*` stands for every image type. */
22
+ export declare function fileTypeAccepted(acceptedTypes: readonly string[] | undefined, fileType: string): boolean;
23
+ /**
24
+ * Why a list of actions cannot be offered, or undefined if it can: two with one
25
+ * name, a parameter with a name a call could not use, or a number range that
26
+ * holds nothing. Worded as the engine words it.
27
+ */
28
+ export declare function findActionsFailure(actions: readonly Action[]): string | undefined;
@@ -0,0 +1,11 @@
1
+ import type { Manifest } from "./schemas.gen.js";
2
+ /**
3
+ * Why a manifest that passes its schema still cannot be used, or undefined
4
+ * when it can: a component with half a default size, one that can be resized
5
+ * but has no default size, one resized between limits that contradict each
6
+ * other or its default size, or one with a list that must hold an entry it
7
+ * does not offer. The engine refuses the same manifests with the
8
+ * same messages (its `validate_manifest`), on top of the request limits it
9
+ * alone enforces.
10
+ */
11
+ export declare function findManifestFailure(manifest: Manifest): string | undefined;
@@ -0,0 +1,15 @@
1
+ import type { Manifest, Operation } from "./schemas.gen.js";
2
+ export type OperationErrorCode = "unknown_component" | "locked" | "capability_not_allowed" | "invalid_target" | "invalid_operation" | "out_of_bounds" | "unknown_prop" | "invalid_value" | "empty_region";
3
+ export interface OperationError {
4
+ /** Position of the offending operation in the list. */
5
+ index: number;
6
+ code: OperationErrorCode;
7
+ message: string;
8
+ }
9
+ /**
10
+ * Checks every operation against the manifest and reports at most one error per
11
+ * operation. The check order is part of the contract shared with the Python
12
+ * engine: component exists, not locked, capability declared, then the
13
+ * operation's own arguments.
14
+ */
15
+ export declare function validateOperations(manifest: Manifest, operations: readonly Operation[]): OperationError[];