@lynx-js/skill-lynx-openui-canary 0.0.0-rc.0 → 0.0.1

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.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/SKILL.md ADDED
@@ -0,0 +1,132 @@
1
+ ---
2
+ name: lynx-openui
3
+ description: Generate valid OpenUI Lang v0.5 functional-notation programs for the Lynx OpenUI renderer. Use when Codex must turn a natural-language UI request into raw OpenUI DSL for OpenUiRenderer, including static mobile UI, $state, Query/Mutation tool flows, Action plans, streaming-friendly output, or catalog-constrained revisions. Do not use for JSX, HTML, CSS, A2UI JSON, or implementing new ReactLynx components.
4
+ ---
5
+
6
+ # Generate Lynx OpenUI Programs
7
+
8
+ Generate valid OpenUI Lang v0.5 consumed by
9
+ `<OpenUiRenderer response={...}>`. Produce declarative DSL, not application
10
+ code.
11
+
12
+ ## Read The References
13
+
14
+ - Always read [components.md](references/components.md) before generating a
15
+ program. Treat caller-supplied component signatures as authoritative
16
+ extensions or replacements.
17
+ - Read [runtime.md](references/runtime.md) when the request involves state,
18
+ tools, live data, mutations, actions, repeated query data, or edits.
19
+ - Read [examples.md](references/examples.md) for a non-trivial layout or tool
20
+ workflow. Adapt patterns; do not copy irrelevant content.
21
+
22
+ ## Workflow
23
+
24
+ 1. Identify the requested UI, supplied component catalog, available tool
25
+ schemas, media URLs, and whether the host supports full programs or
26
+ `mergeStatements` patches.
27
+ 2. Choose the data mode:
28
+ - Use static values for self-contained content and when no tool exists.
29
+ - Use `Query` only for an actual read tool supplied by the caller or host.
30
+ - Use `Mutation` only for an actual write tool and trigger it from an
31
+ explicit `Action`.
32
+ 3. Select only components and positional arguments allowed by the active
33
+ catalog.
34
+ 4. Write a streaming-friendly graph. For a complete program, put the root
35
+ first, followed by state, queries or mutations, structural components, and
36
+ leaf content. For an edit-mode patch, return only changed statements.
37
+ 5. Validate syntax, references, reachability, component names, argument order,
38
+ tool names, and action targets before returning the program.
39
+
40
+ ## Output Contract
41
+
42
+ - Return only OpenUI Lang. Do not return Markdown, code fences, prose, JSON,
43
+ XML, HTML, JavaScript, TypeScript, JSX, or CSS.
44
+ - Put one assignment statement on each line.
45
+ - For a complete program, make the first non-empty line `root = Stack(...)`.
46
+ - Return a complete program by default. When the caller explicitly says the
47
+ host uses edit mode or `mergeStatements`, return only changed statements and
48
+ include `root` only when the root graph changes.
49
+ - If a request needs an unavailable component or capability, render a concise
50
+ explanation with supported OpenUI components instead of inventing syntax.
51
+
52
+ ## Syntax Rules
53
+
54
+ - Use `identifier = Expression` for ordinary declarations and
55
+ `$identifier = defaultValue` for mutable state.
56
+ - Pass component arguments positionally. Never use named arguments such as
57
+ `gap: "m"`.
58
+ - Omit optional arguments only from the end. When setting a later argument,
59
+ provide valid values for every earlier position.
60
+ - Use double-quoted strings and escape embedded quotes and backslashes.
61
+ - Use references or inline components. Prefer references for the root and
62
+ major sections so streaming reveals the structure progressively.
63
+ - Ensure every referenced identifier is defined. Ensure every declaration
64
+ other than `root` is reachable from `root`, an expression reachable from
65
+ `root`, or an action reachable from `root`.
66
+ - Use only documented operators, built-ins, components, and action steps.
67
+
68
+ Correct positional layout:
69
+
70
+ ```text
71
+ root = Stack([header, content], "column", false, "l", "stretch", "start")
72
+ ```
73
+
74
+ Incorrect positional layout:
75
+
76
+ ```text
77
+ root = Stack([header, content], "column", "l", "stretch")
78
+ ```
79
+
80
+ The incorrect form passes a string into `wrap` and shifts every later prop.
81
+
82
+ ## Data And Interaction Rules
83
+
84
+ - Do not invent tool names. If no tool schema is supplied, use static data or
85
+ an explanatory supported UI.
86
+ - Give every `Query` a representative default result matching the real tool
87
+ shape so the UI renders before the request resolves.
88
+ - Keep `Query` and `Mutation` declarations on ordinary identifiers, never
89
+ `$identifiers`.
90
+ - Use `@Each` for query-backed repeated UI. Keep its loop-dependent component
91
+ inline inside `@Each`.
92
+ - Put write operations on a submit or confirmation `Button`. Do not attach a
93
+ mutation to an input's change action.
94
+ - When an input must update a `$variable`, use the same-key `name` pattern in
95
+ [runtime.md](references/runtime.md). Do not invent an event-value variable.
96
+ - Execute multi-step actions in deliberate order. Remember that a failed
97
+ mutation stops the remaining steps.
98
+ - Use `@ToAssistant` for conversational continuation and `@OpenUrl` only with
99
+ a caller-provided or trustworthy URL.
100
+ - Use caller-provided media URLs. Do not fabricate CDN URLs or assume the host
101
+ resolves image-search strings.
102
+
103
+ ## Lynx UI Rules
104
+
105
+ - Prefer compact, mobile-first layouts with a shallow component tree.
106
+ - Use `Stack` or `Column` for ordinary vertical structure, `Row` for small
107
+ horizontal groups, and `List` for grouped or repeated content.
108
+ - Prefer explicit `Image` variants so the Lynx renderer has concrete sizing.
109
+ - Keep readable text in `Text` or `TextContent`; do not emit raw Lynx elements.
110
+ - Use `Tabs` for alternate views and `Modal` for tap-to-open details. Pass a
111
+ modal trigger first and content second; do not also render the trigger as a
112
+ sibling.
113
+
114
+ ## Final Verification
115
+
116
+ Before returning, verify all of the following:
117
+
118
+ - A complete program starts with `root = Stack(...)`. An edit-mode patch omits
119
+ `root` unless the root graph changes. The response contains only OpenUI Lang.
120
+ - Every component exists in the active catalog and every argument matches its
121
+ positional schema.
122
+ - No `Form`, `Input`, `Select`, `SelectItem`, `FormControl`, table, or chart is
123
+ used unless the caller supplied that custom component.
124
+ - Every reference resolves and no declaration is orphaned.
125
+ - Every `Query` or `Mutation` uses a real supplied tool and is referenced by
126
+ visible UI or a visible action.
127
+ - Every `$variable` participates in visible UI, a query argument, or an action.
128
+ - Every `@Each` loop variable stays inside its inline template expression.
129
+ - No working dynamic list relies on `TemplateChildren` in the built-in Lynx
130
+ renderer.
131
+ - If a parser is available, parsing finishes with a root, no validation errors,
132
+ no unresolved references, and no orphaned statements.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Lynx OpenUI"
3
+ short_description: "Create valid OpenUI Lang v0.5 for Lynx"
4
+ default_prompt: "Use $lynx-openui to turn this UI request into valid OpenUI Lang v0.5 code for Lynx."
package/package.json CHANGED
@@ -1,13 +1,23 @@
1
1
  {
2
2
  "name": "@lynx-js/skill-lynx-openui-canary",
3
- "version": "0.0.0-rc.0",
4
- "description": "",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
3
+ "version": "0.0.1",
4
+ "description": "Generate Lynx OpenUI v0.5 programs for @lynx-js/genui.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/lynx-family/lynx-stack.git",
8
+ "directory": "packages/genui/lynx-openui"
8
9
  },
9
- "keywords": [],
10
- "author": "",
11
- "license": "ISC",
12
- "packageManager": "pnpm@10.33.2"
13
- }
10
+ "license": "Apache-2.0",
11
+ "type": "module",
12
+ "files": [
13
+ "SKILL.md",
14
+ "agents",
15
+ "references"
16
+ ],
17
+ "engines": {
18
+ "node": ">=18"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public"
22
+ }
23
+ }
@@ -0,0 +1,111 @@
1
+ # Lynx OpenUI Component Catalog
2
+
3
+ ## Contents
4
+
5
+ - [Shared Types](#shared-types)
6
+ - [Layout](#layout)
7
+ - [Content](#content)
8
+ - [Buttons](#buttons)
9
+ - [Data Display](#data-display)
10
+ - [Media](#media)
11
+ - [Inputs](#inputs)
12
+ - [Unsupported Components](#unsupported-unless-extended-by-the-host)
13
+
14
+ Use the built-in component signatures exactly. Arguments are positional and
15
+ `?` marks a schema-optional argument. Omit an optional argument only when every
16
+ later argument is also omitted. If an optional argument precedes a required
17
+ one, supply it so later positions do not shift. The signatures include exact
18
+ argument types and allowed enum values.
19
+
20
+ ## Shared Types
21
+
22
+ - `StringLike`: string, number, boolean, or a v0.5 expression that resolves to
23
+ one of those primitive values. Although the compatibility schema accepts
24
+ legacy object bindings, generated programs must not use them because the
25
+ built-in Lynx renderer does not resolve them.
26
+ - `BooleanLike`: boolean or a v0.5 expression that resolves to boolean. Do not
27
+ generate legacy path objects.
28
+ - `ActionExpression`: `Action([@step, ...])` or a host-supplied legacy action
29
+ object. Prefer `Action` plans.
30
+
31
+ ## Layout
32
+
33
+ - `Stack(children: any[], direction?: "row" | "column", wrap?: boolean, gap?: "none" | "xs" | "s" | "m" | "l" | "xl", align?: "start" | "center" | "end" | "stretch", justify?: "start" | "center" | "end" | "between")`
34
+ - `Row(children: any[], justify?: "start" | "center" | "end" | "between" | "around" | "evenly" | "spaceBetween" | "spaceAround" | "spaceEvenly" | "stretch", align?: "start" | "center" | "end" | "stretch", gap?: "none" | "xs" | "s" | "m" | "l" | "xl", wrap?: boolean)`
35
+ - `Column(children: any[], justify?: "start" | "center" | "end" | "between" | "around" | "evenly" | "spaceBetween" | "spaceAround" | "spaceEvenly" | "stretch", align?: "start" | "center" | "end" | "stretch", gap?: "none" | "xs" | "s" | "m" | "l" | "xl")`
36
+ - `List(children?: any[] | TemplateChildren, items?: any[] | TemplateChildren, direction?: "vertical" | "horizontal", align?: "start" | "center" | "end" | "stretch", gap?: "none" | "xs" | "s" | "m" | "l" | "xl", divider?: boolean)`
37
+ - `Separator()`
38
+ - `Divider(axis?: "horizontal" | "vertical")`
39
+ - `Modal(trigger: any, content: any, title?: StringLike, closeOnAction?: boolean)`
40
+ - `Tabs(tabs: {value: string, title: StringLike, child: any}[], value?: string)`
41
+
42
+ For the built-in `List`, pass children as the first argument and normally omit
43
+ the remaining arguments. The second position is the `items` alias, not
44
+ `direction`. Use `@Each` for live repeated data. Built-in `TemplateChildren`
45
+ currently renders a diagnostic hint rather than expanding content.
46
+
47
+ ## Content
48
+
49
+ - `Card(children: any[], variant?: "card" | "sunk" | "clear", direction?: "row" | "column", wrap?: boolean, gap?: "none" | "xs" | "s" | "m" | "l" | "xl", align?: "start" | "center" | "end" | "stretch", justify?: "start" | "center" | "end" | "between")`
50
+ - `CardHeader(title: string, subtitle?: string)`
51
+ - `Text(text: StringLike, variant?: "h1" | "h2" | "h3" | "h4" | "h5" | "caption" | "body")`
52
+ - `TextContent(text: string | number | boolean, size?: "small" | "default" | "large" | "small-heavy" | "large-heavy")`
53
+
54
+ `Text.text` uses `StringLike`. `TextContent.text` accepts only a string, number,
55
+ boolean, or an expression that resolves to one of those primitives. Never pass
56
+ an object binding to `TextContent`.
57
+
58
+ ## Buttons
59
+
60
+ - `Button(label: string, action?: ActionExpression, variant?: "primary" | "secondary" | "tertiary", type?: "normal" | "destructive", size?: "extra-small" | "small" | "medium" | "large")`
61
+ - `Buttons(buttons: Button[])`
62
+
63
+ A button without an action sends its label to the assistant. Use `Buttons`
64
+ for a button group.
65
+
66
+ ## Data Display
67
+
68
+ - `Tag(text: string)`
69
+ - `Icon(name: "account_circle" | "add" | "arrow_back" | "arrow_forward" | "camera" | "check" | "close" | "delete" | "edit" | "error" | "favorite" | "help" | "home" | "info" | "location_on" | "lock" | "mail" | "menu" | "more_vert" | "pause" | "person" | "play_arrow" | "refresh" | "search" | "send" | "settings" | "share" | "star" | "warning", size?: "sm" | "md" | "lg", color?: "primary" | "muted" | "inherit")`
70
+ - `Loading(variant?: "inline" | "block")`
71
+
72
+ ## Media
73
+
74
+ - `Image(url: StringLike, fit?: "contain" | "cover" | "fill" | "none" | "scale-down", variant?: "icon" | "avatar" | "smallFeature" | "mediumFeature" | "largeFeature" | "header")`
75
+ - `AudioPlayer(url: StringLike, description?: StringLike)`
76
+ - `Video(url: StringLike, title?: StringLike)`
77
+
78
+ Use a supplied URL. Prefer an explicit image variant; the Lynx implementation
79
+ maps variants to concrete dimensions.
80
+
81
+ ## Inputs
82
+
83
+ - `CheckBox(label: string, value?: boolean, action?: ActionExpression, name?: string)`
84
+ - `RadioGroup(items: string[], value?: string, usageHint?: "default" | "card" | "row", action?: ActionExpression, name?: string)`
85
+ - `ChoicePicker(label?: StringLike, options: (StringLike)[] | StringLike, value?: StringLike, variant?: "default" | "card", displayStyle?: "list" | "chips" | "dropdown", filterable?: BooleanLike)`
86
+ - `Slider(label?: string, min?: number, max?: number, value?: number, step?: number, action?: ActionExpression, name?: string)`
87
+ - `DateTimeInput(value: StringLike, enableDate?: BooleanLike, enableTime?: BooleanLike, min?: StringLike, max?: StringLike, label?: StringLike)`
88
+ - `TextField(label: string, value?: string, variant?: "longText" | "number" | "shortText" | "obscured", validationRegexp?: string, action?: ActionExpression, name?: string)`
89
+
90
+ `ChoicePicker.label` is schema-optional but precedes required `options`. Since
91
+ OpenUI Lang calls are positional, always pass a label so `options` remains the
92
+ second argument.
93
+
94
+ Current Lynx runtime boundaries:
95
+
96
+ - `CheckBox`, `RadioGroup`, `Slider`, and `TextField` persist host form state
97
+ when given `name`; their action fires on value change.
98
+ - To bind one of those inputs to `$state`, pass the exact state key including
99
+ `$` as its literal `name`, for example `"$city"`. See
100
+ [runtime.md](runtime.md#state).
101
+ - `ChoicePicker` keeps selection only inside the component and has no `name` or
102
+ action prop. Do not use it as a live `Query` filter.
103
+ - `DateTimeInput` currently displays a date/time value; do not promise editable
104
+ date picking.
105
+ - Put mutations on explicit submit or confirmation buttons, not change actions.
106
+
107
+ ## Unsupported Unless Extended By The Host
108
+
109
+ Do not emit `Form`, `Input`, `Select`, `SelectItem`, `FormControl`, tables,
110
+ charts, or any other name absent from the signatures above unless the caller
111
+ provides its exact custom schema.
@@ -0,0 +1,64 @@
1
+ # Lynx OpenUI Examples
2
+
3
+ Treat each block as a complete OpenUI program. Adapt component choices and
4
+ content to the request.
5
+
6
+ ## Static Card And Conversational Action
7
+
8
+ ```openui
9
+ root = Stack([hero, actions], "column", false, "m", "stretch", "start")
10
+ hero = Card([CardHeader("Weekly Summary", "Updated just now"), TextContent("Revenue is up 18%.", "large-heavy"), TextContent("Three accounts need follow-up.", "small")], "card", "column", false, "s", "start", "start")
11
+ actions = Buttons([Button("Show details", Action([@ToAssistant("Show the account details")]), "primary")])
12
+ ```
13
+
14
+ ## Local View State
15
+
16
+ ```openui
17
+ root = Stack([switcher, content], "column", false, "m", "stretch", "start")
18
+ $view = "summary"
19
+ switcher = Buttons([Button("Summary", Action([@Set($view, "summary")]), "primary"), Button("Details", Action([@Set($view, "details")]), "secondary")])
20
+ content = $view == "summary" ? summary : details
21
+ summary = Card([CardHeader("Summary"), TextContent("Three tasks are on track.")], "card", "column", false, "s")
22
+ details = Card([CardHeader("Details"), List([Text("Design review", "body"), Text("Release checklist", "body")])], "card", "column", false, "s")
23
+ ```
24
+
25
+ ## Query And Repeated Data
26
+
27
+ Assume the host supplies a `list_tasks` read tool returning `{ rows: [...] }`.
28
+
29
+ ```openui
30
+ root = Stack([header, taskList, refresh], "column", false, "m", "stretch", "start")
31
+ tasks = Query("list_tasks", {}, { rows: [{ title: "Design review", status: "open" }, { title: "Release checklist", status: "done" }] })
32
+ header = CardHeader("Tasks", @Count(tasks.rows) + " total")
33
+ taskList = List(@Each(tasks.rows, "task", Card([Text(task.title, "h4"), Tag(task.status)], "card", "column", false, "s")))
34
+ refresh = Buttons([Button("Refresh", Action([@Run(tasks)]), "secondary")])
35
+ ```
36
+
37
+ ## Query Driven By Text Input
38
+
39
+ Assume the host supplies a `get_weather` read tool returning weather data for
40
+ the requested city. This live pattern runs the query on each input change, so
41
+ use it only when the tool can accept that request frequency.
42
+
43
+ ```openui
44
+ root = Stack([cityInput, weatherCard, refresh], "column", false, "m", "stretch", "start")
45
+ $city = "Seattle"
46
+ weather = Query("get_weather", { city: $city }, { city: "Seattle", temp: 62, condition: "Cloudy" })
47
+ cityInput = TextField("City", $city, "shortText", ".+", null, "$city")
48
+ weatherCard = Card([CardHeader(weather.city, "Current weather"), TextContent(weather.temp + " degrees", "large-heavy"), TextContent(weather.condition)], "card", "column", false, "s")
49
+ refresh = Button("Refresh", Action([@Run(weather)]), "secondary")
50
+ ```
51
+
52
+ ## Mutation With Ordered Feedback
53
+
54
+ Assume the host supplies a `save_preference` write tool.
55
+
56
+ ```openui
57
+ root = Stack([summary, choices, submit, status], "column", false, "m", "stretch", "start")
58
+ $priority = "normal"
59
+ save = Mutation("save_preference", { priority: $priority })
60
+ summary = Card([CardHeader("Notification Priority"), TextContent("Selected: " + $priority)], "card", "column", false, "s")
61
+ choices = Buttons([Button("High", Action([@Set($priority, "high")]), "secondary"), Button("Normal", Action([@Set($priority, "normal")]), "secondary"), Button("Low", Action([@Set($priority, "low")]), "secondary")])
62
+ submit = Button("Save preference", Action([@Run(save)]), "primary")
63
+ status = save.status == "loading" ? Loading("inline") : save.status == "success" ? TextContent("Preference saved.", "small-heavy") : TextContent("Choose a priority, then save.", "small")
64
+ ```
@@ -0,0 +1,145 @@
1
+ # OpenUI Lang v0.5 Runtime
2
+
3
+ Consult this reference for state, tool-backed data, actions, expressions, repeated
4
+ data, or incremental edits.
5
+
6
+ ## Contents
7
+
8
+ - [Program And Expressions](#program-and-expressions)
9
+ - [State](#state)
10
+ - [Query](#query)
11
+ - [Mutation](#mutation)
12
+ - [Actions](#actions)
13
+ - [Data Built-ins](#data-built-ins)
14
+ - [Streaming And Edits](#streaming-and-edits)
15
+
16
+ ## Program And Expressions
17
+
18
+ - Write one `identifier = Expression` statement per line.
19
+ - In a complete program, define `root = Stack(...)` first. Forward references
20
+ are allowed. An edit-mode patch may omit `root`.
21
+ - Use double-quoted strings, numbers, booleans, `null`, arrays, objects,
22
+ component calls, and ordinary references.
23
+ - Access fields and indices with `data.rows`, `rows[0]`, and
24
+ `data.rows.title` (array pluck).
25
+ - Use arithmetic `+ - * / %`, comparisons `== != > < >= <=`, logic `&& || !`,
26
+ ternaries `condition ? yes : no`, and parentheses.
27
+ - Keep every ordinary declaration reachable from `root`. Unreachable
28
+ declarations are orphaned and do not render.
29
+
30
+ ## State
31
+
32
+ Declare mutable state with a `$` prefix:
33
+
34
+ ```openui
35
+ $city = "Seattle"
36
+ ```
37
+
38
+ Use simple string, number, or boolean defaults. Undeclared `$variables` may be
39
+ auto-created as `null`, but explicit defaults make rendering and reset behavior
40
+ predictable. Use `$variables` in expressions, tool arguments, `@Set`, and
41
+ `@Reset`.
42
+
43
+ Built-in Lynx inputs write their `name` into the runtime state store. To bind an
44
+ input directly to a `$variable`, pass the variable as its value and pass the
45
+ exact variable name, including `$`, as the literal `name` argument:
46
+
47
+ ```openui
48
+ $city = "Seattle"
49
+ weather = Query("get_weather", { city: $city }, { city: "Seattle", temp: 62 })
50
+ cityInput = TextField("City", $city, "shortText", ".+", null, "$city")
51
+ ```
52
+
53
+ Here `null` fills the unused action position so `"$city"` reaches `name`.
54
+ Typing writes back to `$city`, so expressions update and dependent queries run
55
+ again. Do not use `"city"` and then try to copy its value with `@Set`: input
56
+ actions do not expose an event-value variable. Use explicit `@Set` buttons for
57
+ fixed choices instead.
58
+
59
+ This same-key binding requires the v0.5 `response` runtime and no enclosing
60
+ custom `Form`; a form writes the value into nested form state instead. Each
61
+ input event updates the state immediately, without debounce or validation
62
+ gating, so use a text-driven `Query` only when live requests on each change are
63
+ acceptable.
64
+
65
+ ## Query
66
+
67
+ Use an actual read tool supplied by the caller or host:
68
+
69
+ ```openui
70
+ weather = Query("get_weather", { city: $city }, { city: "Seattle", temp: 62, alerts: [] }, 30)
71
+ ```
72
+
73
+ Arguments are tool name, arguments object, immediate default result, and an
74
+ optional refresh interval in seconds. Use an ordinary identifier such as
75
+ `weather`, not `$weather`.
76
+
77
+ - Match defaults to the real result shape and keep them compact.
78
+ - Read results with field access, index access, array pluck, or built-ins.
79
+ - Changing a referenced `$variable` re-runs the query.
80
+ - Use `@Run(weather)` for manual refresh.
81
+ - Do not turn tool results into manually copied static component statements.
82
+
83
+ ## Mutation
84
+
85
+ Declare a write tool without executing it:
86
+
87
+ ```openui
88
+ save = Mutation("save_preference", { priority: $priority })
89
+ ```
90
+
91
+ Execute it only from `@Run(save)` in a visible action. Use `save.status`,
92
+ `save.data`, and `save.error` for feedback. Status is `"idle"`, `"loading"`,
93
+ `"success"`, or `"error"`.
94
+
95
+ ## Actions
96
+
97
+ Use `Action([@step, ...])`. Steps run in order:
98
+
99
+ - `@Run(queryOrMutation)` executes a mutation or refreshes a query.
100
+ - `@ToAssistant("message")` continues the conversation.
101
+ - `@OpenUrl("https://...")` asks the host to navigate.
102
+ - `@Set($variable, value)` updates state.
103
+ - `@Reset($var1, $var2, ...)` restores declared defaults.
104
+
105
+ If a mutation fails, later steps do not run. Put a mutation before dependent
106
+ refresh/reset steps only when that halt behavior is intended.
107
+
108
+ ## Data Built-ins
109
+
110
+ Use only these built-ins:
111
+
112
+ - `@Count(array)`, `@First(array)`, `@Last(array)`
113
+ - `@Sum(numbers)`, `@Avg(numbers)`, `@Min(numbers)`, `@Max(numbers)`
114
+ - `@Sort(array, field, direction?)`
115
+ - `@Filter(array, field, operator, value)` where operator is `"=="`, `"!="`,
116
+ `">"`, `"<"`, `">="`, `"<="`, or `"contains"`
117
+ - `@Round(number, decimals?)`, `@Abs(number)`, `@Floor(number)`, `@Ceil(number)`
118
+ - `@Each(array, variableName, inlineTemplate)`
119
+
120
+ Keep the `@Each` loop variable inside the inline template:
121
+
122
+ ```openui
123
+ taskList = List(@Each(tasks.rows, "task", Card([Text(task.title, "h4")])))
124
+ ```
125
+
126
+ Do not extract `Card([Text(task.title)])` into another statement because
127
+ `task` exists only inside the `@Each` template.
128
+
129
+ ## Streaming And Edits
130
+
131
+ For complete programs, use this order:
132
+
133
+ 1. `root = Stack(...)`
134
+ 2. `$state` declarations
135
+ 3. `Query` and `Mutation` declarations
136
+ 4. structural component declarations
137
+ 5. leaf content
138
+
139
+ The parser resolves forward references as statements stream in. Keep the root
140
+ first so the shell appears immediately.
141
+
142
+ Return a complete program unless the caller explicitly says the host enables
143
+ edit mode or merges patches with `mergeStatements`. In edit mode, output only
144
+ assignments that must be added or replaced, and include `root` only when the
145
+ root graph changes.