@zenera/cli 1.3.11 → 1.3.13

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.
@@ -0,0 +1,268 @@
1
+ ---
2
+ name: a2ui
3
+ description: How to answer with an A2UI v1.0 surface (forms, cards, tables, layouts, images) - message format, components, data binding and actions. Load before writing any A2UI.
4
+ tags: [ui, a2ui]
5
+ version: 1.0.0
6
+ ---
7
+
8
+ # A2UI surfaces
9
+
10
+ A2UI is a JSON description of UI that the chat renders in place of your text.
11
+ You write it; the user sees and uses it.
12
+
13
+ ## Emitting it
14
+
15
+ Put the messages in a fenced block tagged `a2ui` as a JSON array. The block may
16
+ sit between ordinary Markdown paragraphs:
17
+
18
+ ````markdown
19
+ Here is the booking form.
20
+
21
+ ```a2ui
22
+ [
23
+ {
24
+ "version": "1.0",
25
+ "createSurface": {
26
+ "surfaceId": "main",
27
+ "catalogId": "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json",
28
+ "components": []
29
+ }
30
+ }
31
+ ]
32
+ ```
33
+ ````
34
+
35
+ - The array contains complete JSON objects, each with `"version": "1.0"` and
36
+ exactly one of `createSurface`, `updateComponents`, `updateDataModel`,
37
+ `deleteSurface`.
38
+ - Use strict JSON: no comments or trailing commas.
39
+ - Prefer a single `createSurface` that carries both `components` and
40
+ `dataModel`. Send `updateComponents` / `updateDataModel` only to change a
41
+ surface you already created.
42
+
43
+ ## The surface
44
+
45
+ ```json
46
+ {
47
+ "version": "1.0",
48
+ "createSurface": {
49
+ "surfaceId": "trip_booking_1",
50
+ "catalogId": "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json",
51
+ "sendDataModel": true,
52
+ "components": [],
53
+ "dataModel": {}
54
+ }
55
+ }
56
+ ```
57
+
58
+ - `surfaceId` is unique for the whole conversation: never reuse one without a
59
+ `deleteSurface` first. Use a descriptive name plus a counter.
60
+ - `catalogId` is always the basic catalog above. Zenera components add their
61
+ own `@catalogId` (see below).
62
+ - Set `sendDataModel: true` on forms, so the user's input reaches you with the
63
+ action.
64
+ - `components` is a **flat** list. Each has a unique `id` and a `component`
65
+ type; containers refer to children by id. Exactly one component has
66
+ `"id": "root"` — that is what is shown.
67
+ - `dataModel` is a plain JSON object. Bind to it with `{"@path": "/pointer"}`
68
+ (JSON Pointer) wherever a property accepts a dynamic value.
69
+
70
+ ## Components
71
+
72
+ Basic catalog (A2UI v1.0). Only these, and only these properties:
73
+
74
+ | Component | Required | Optional |
75
+ | --------------- | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
76
+ | `Text` | `text` | `variant`: `body` \| `caption` |
77
+ | `Image` | `url` | `description`, `fit`, `variant`: `icon` \| `avatar` \| `smallFeature` \| `mediumFeature` \| `largeFeature` \| `header` |
78
+ | `Icon` | `name` (e.g. `check`, `warning`) | — |
79
+ | `Video` | `url` | `posterUrl` |
80
+ | `AudioPlayer` | `url` | `description` |
81
+ | `Row`, `Column` | `children` | `justify`, `align` |
82
+ | `List` | `children` | `direction`: `vertical` \| `horizontal`, `align` |
83
+ | `Card` | `child` (exactly one id) | — |
84
+ | `Tabs` | `tabs`: `[{title, child}]` | — |
85
+ | `Divider` | — | `axis` |
86
+ | `Modal` | `trigger`, `content` | — |
87
+ | `Button` | `child`, `action` | `variant`: `default` \| `primary` \| `borderless` |
88
+ | `TextField` | `label`, `value` | `placeholder`, `variant`: `shortText` \| `longText` \| `number` \| `obscured` |
89
+ | `CheckBox` | `label`, `value` (boolean) | — |
90
+ | `ChoicePicker` | `options`: `[{label, value}]`, `value` (string array) | `label`, `variant`: `mutuallyExclusive` \| `multipleSelection`, `displayStyle`: `checkbox` \| `chips`, `filterable` |
91
+ | `Slider` | `value`, `max` | `label`, `min`, `steps` |
92
+ | `DateTimeInput` | `value` (ISO 8601, `""` if unset) | `enableDate`, `enableTime`, `min`, `max` |
93
+
94
+ Zenera catalog — each instance must carry
95
+ `"@catalogId": "https://zenera.ai/a2ui/catalogs/zenera/v1_0/catalog.json"`:
96
+
97
+ | Component | Required | Optional | Notes |
98
+ | ----------- | -------- | ------------------ | --------------------------------------------- |
99
+ | `EChart` | `apiUrl` | — | Load the `a2ui-charts` skill before using it. |
100
+ | `DataTable` | `apiUrl` | `pageSize` (1–100) | Not fully supported yet; see below. |
101
+
102
+ Rules that catch most mistakes:
103
+
104
+ - A `Card` holds one child — wrap several in a `Column`.
105
+ - `children` is an array of ids, or a template
106
+ `{"componentId": "row_tpl", "path": "/items"}` that repeats one component per
107
+ array element; inside the template, bind relative to the element.
108
+ - A `Button` shows its `child` (usually a `Text`), never a `label`.
109
+ - Media URLs are `https:` or `data:` ones you actually have. Never invent one;
110
+ omit the component instead.
111
+
112
+ ## Forms
113
+
114
+ Pick the input by the value you need:
115
+
116
+ | Value | Component |
117
+ | ------------------------------ | ------------------------------------------- |
118
+ | Short / long free text | `TextField` `shortText` / `longText` |
119
+ | Number without a natural range | `TextField` `number` |
120
+ | Number within a known range | `Slider` |
121
+ | Yes / no, consent | `CheckBox` |
122
+ | One of a fixed set | `ChoicePicker` `mutuallyExclusive` |
123
+ | Several of a fixed set | `ChoicePicker` `multipleSelection` |
124
+ | Date, time, or both | `DateTimeInput` (enable only what you need) |
125
+
126
+ - Bind every input's `value` to its own path in `dataModel`, and give that path
127
+ a starting value: `""`, `false`, `[]`, a number, or what you already know.
128
+ Never ask for something you already have — prefill it.
129
+ - Use `displayStyle: "chips"` for up to ~6 short options, `filterable: true`
130
+ for more than ~10.
131
+ - Validate with `@checks`, e.g.
132
+ `"@checks": [{"condition": {"@call": "required", "args": {"value": {"@path": "/email"}}}, "message": "Email is required"}]`.
133
+ Available checks: `required`, `email`, `regex`, `length`, `numeric`, and
134
+ `and` / `or` / `not` to combine them.
135
+ - Ask only for what the next step needs; past 5–6 fields, split the form.
136
+ - End with one `primary` `Button` whose label names the outcome ("Book
137
+ flight", not "Submit"). Secondary actions are `default` or `borderless`.
138
+
139
+ ## Actions
140
+
141
+ A `Button` sends an event back to you as the user's next message:
142
+
143
+ ```json
144
+ "action": {
145
+ "event": {
146
+ "name": "book_flight",
147
+ "context": { "from": { "@path": "/from" }, "date": { "@path": "/date" } }
148
+ }
149
+ }
150
+ ```
151
+
152
+ - `name` is a snake_case verb you will recognise when it comes back.
153
+ - Put in `context` exactly what you need to act — bound paths for user input,
154
+ literals for fixed ids.
155
+ - When the event arrives, act on it. Then update the same surface with
156
+ `updateDataModel` / `updateComponents`, or reply in text — do not create a
157
+ second copy of the form.
158
+ - Put destructive actions behind a `Modal` whose content asks for
159
+ confirmation.
160
+
161
+ ## Tables
162
+
163
+ `DataTable` is not fully supported yet. Show up to 20 rows as a Markdown table
164
+ unless the user explicitly asked for `DataTable`. For more than 20 rows, use
165
+ `DataTable` so the data loads dynamically instead of being pasted into the
166
+ response. Write one page of JSON to a file under `/workspace` and point `apiUrl`
167
+ at it as a `file:///workspace/...` URL:
168
+
169
+ ```json
170
+ {
171
+ "columns": [{ "key": "name", "label": "Name", "type": "string" }],
172
+ "rows": [{ "name": "Ada" }],
173
+ "total": 1,
174
+ "page": 1,
175
+ "pageSize": 10
176
+ }
177
+ ```
178
+
179
+ `type` is `string`, `number`, `date` or `boolean`.
180
+
181
+ ## Example: a form
182
+
183
+ ```a2ui
184
+ [
185
+ {
186
+ "version": "1.0",
187
+ "createSurface": {
188
+ "surfaceId": "meeting_request_1",
189
+ "catalogId": "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json",
190
+ "sendDataModel": true,
191
+ "dataModel": {
192
+ "topic": "",
193
+ "when": "",
194
+ "length": 30,
195
+ "remote": false
196
+ },
197
+ "components": [
198
+ { "id": "root", "component": "Card", "child": "form" },
199
+ {
200
+ "id": "form",
201
+ "component": "Column",
202
+ "children": ["title", "topic", "when", "length", "remote", "submit"]
203
+ },
204
+ { "id": "title", "component": "Text", "text": "Request a meeting" },
205
+ {
206
+ "id": "topic",
207
+ "component": "TextField",
208
+ "label": "Topic",
209
+ "value": { "@path": "/topic" },
210
+ "@checks": [
211
+ {
212
+ "condition": {
213
+ "@call": "required",
214
+ "args": { "value": { "@path": "/topic" } }
215
+ },
216
+ "message": "Give the meeting a topic"
217
+ }
218
+ ]
219
+ },
220
+ {
221
+ "id": "when",
222
+ "component": "DateTimeInput",
223
+ "value": { "@path": "/when" },
224
+ "enableDate": true,
225
+ "enableTime": true
226
+ },
227
+ {
228
+ "id": "length",
229
+ "component": "Slider",
230
+ "label": "Minutes",
231
+ "min": 15,
232
+ "max": 120,
233
+ "steps": 7,
234
+ "value": { "@path": "/length" }
235
+ },
236
+ {
237
+ "id": "remote",
238
+ "component": "CheckBox",
239
+ "label": "Remote",
240
+ "value": { "@path": "/remote" }
241
+ },
242
+ {
243
+ "id": "submit",
244
+ "component": "Button",
245
+ "variant": "primary",
246
+ "child": "submit_label",
247
+ "action": {
248
+ "event": {
249
+ "name": "request_meeting",
250
+ "context": {
251
+ "topic": { "@path": "/topic" },
252
+ "when": { "@path": "/when" },
253
+ "length": { "@path": "/length" },
254
+ "remote": { "@path": "/remote" }
255
+ }
256
+ }
257
+ }
258
+ },
259
+ {
260
+ "id": "submit_label",
261
+ "component": "Text",
262
+ "text": "Request meeting"
263
+ }
264
+ ]
265
+ }
266
+ }
267
+ ]
268
+ ```
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: a2ui-charts
3
+ description: How to display charts in A2UI surfaces - choosing the right chart type, preparing its data, and rendering it. Load together with a2ui.
4
+ tags: [ui, a2ui, charts]
5
+ version: 1.0.0
6
+ ---
7
+
8
+ # Charts in A2UI (Zenera `EChart`)
9
+
10
+ `EChart` draws an [Apache ECharts](https://echarts.apache.org) chart. It does
11
+ not take data inline: it loads an ECharts **option** — the object
12
+ `echarts.setOption` takes, data included — as JSON from `apiUrl`. So a chart is
13
+ two steps:
14
+
15
+ 1. Write the option to a JSON file under `/workspace` with `write_file`.
16
+ 2. Emit a surface whose `EChart` points at it as a `file:///workspace/...` URL.
17
+
18
+ Without `write_file` you cannot make a chart: answer with a Markdown table
19
+ instead. Load the `a2ui` skill too — it has the message format.
20
+
21
+ ## When a chart helps
22
+
23
+ Draw one only for numbers you actually have — from a tool, a file, or the user.
24
+ Never invent, round off or "illustrate" data. A single number, or two or three
25
+ values, reads better as a sentence.
26
+
27
+ ## Choosing the type
28
+
29
+ | The question | `series.type` |
30
+ | --------------------------------- | ----------------------------------------------------- |
31
+ | How does it change over time? | `line` (`area` = `line` with `areaStyle: {}`) |
32
+ | How do categories compare? | `bar` (horizontal bars when labels are long) |
33
+ | How is a whole split? (≤ 6 parts) | `pie` — otherwise a sorted `bar` |
34
+ | How do two measures relate? | `scatter` |
35
+ | How are values distributed? | `bar` over bucketed ranges |
36
+ | Parts of a whole over time | `bar` or `line` with `stack: "total"` on every series |
37
+ | Two dimensions × intensity | `heatmap` with `visualMap` |
38
+ | Progress against one target | `gauge` |
39
+
40
+ Keep it readable: at most ~5 series, ~12 pie/bar categories (group the rest as
41
+ "Other"), and sort bars by value unless the categories have a natural order.
42
+
43
+ ## The option file
44
+
45
+ Write strict JSON — no JavaScript. Function-valued options (`formatter`
46
+ functions, callbacks) cannot be expressed; use string templates such as
47
+ `"{b}: {c}"` instead.
48
+
49
+ ```json
50
+ {
51
+ "title": { "text": "Monthly revenue, 2026", "subtext": "USD thousands" },
52
+ "tooltip": { "trigger": "axis" },
53
+ "legend": {},
54
+ "xAxis": { "type": "category", "data": ["Jan", "Feb", "Mar", "Apr"] },
55
+ "yAxis": { "type": "value", "name": "USD k" },
56
+ "series": [
57
+ { "name": "Online", "type": "line", "data": [120, 132, 101, 134] },
58
+ { "name": "Retail", "type": "line", "data": [220, 182, 191, 234] }
59
+ ]
60
+ }
61
+ ```
62
+
63
+ - Always a `title`, and units in the subtitle or axis `name`.
64
+ - `tooltip.trigger`: `axis` for line/bar, `item` for pie/scatter.
65
+ - Add `legend` only with more than one series (or for a pie).
66
+ - Pie and gauge take no `xAxis`/`yAxis`; pie data is `[{"name", "value"}]`.
67
+ - Leave colours and fonts to the theme.
68
+ - Name the file after what it shows: `/workspace/charts/revenue_2026.json`.
69
+ Write a new file for a changed chart rather than rewriting one already shown.
70
+
71
+ ## The surface
72
+
73
+ ```a2ui
74
+ [
75
+ {
76
+ "version": "1.0",
77
+ "createSurface": {
78
+ "surfaceId": "revenue_chart_1",
79
+ "catalogId": "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json",
80
+ "components": [
81
+ { "id": "root", "component": "Card", "child": "body" },
82
+ {
83
+ "id": "body",
84
+ "component": "Column",
85
+ "children": ["chart", "note"]
86
+ },
87
+ {
88
+ "id": "chart",
89
+ "component": "EChart",
90
+ "@catalogId": "https://zenera.ai/a2ui/catalogs/zenera/v1_0/catalog.json",
91
+ "apiUrl": "file:///workspace/charts/revenue_2026.json"
92
+ },
93
+ {
94
+ "id": "note",
95
+ "component": "Text",
96
+ "variant": "caption",
97
+ "text": "Source: sales ledger, Jan–Apr 2026"
98
+ }
99
+ ]
100
+ }
101
+ }
102
+ ]
103
+ ```
104
+
105
+ - Every `EChart` carries the Zenera `@catalogId`; the surface keeps the basic
106
+ `catalogId`.
107
+ - Put a caption `Text` under the chart naming the data source.
108
+ - Several charts: one `EChart` each, stacked in a `Column` — or in `Tabs` when
109
+ they are alternative views of the same data.
110
+ - In your text, state the one finding the chart shows; do not list its numbers
111
+ again.
@@ -55,3 +55,7 @@ agents:
55
55
  - files:*
56
56
  - sandbox:*
57
57
  {{exa}}
58
+ #
59
+ # The skills in agents/skills, listed in the prompt for it to load when a
60
+ # case needs one — among them a2ui and a2ui-charts, for forms and charts.
61
+ skills: {}