@khanglvm/relay 0.17.1 → 0.19.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.
@@ -0,0 +1,257 @@
1
+ // Turns what an agent writes for an `a2ui` block into a safe, flat A2UI v1.0
2
+ // surface ({components, dataModel}) that the board's renderer can draw.
3
+ // Two inputs: A2UI Express text (compiled by the vendored @a2ui/agent SDK) or
4
+ // ready JSON components. Both pass the same checks against Relay's catalog.
5
+ // Drawing is src/ui/a2ui.js; this module never touches the DOM.
6
+ import fs from 'node:fs';
7
+ import path from 'node:path';
8
+ import { fileURLToPath, pathToFileURL } from 'node:url';
9
+ import { CliError } from '../util.js';
10
+
11
+ const HERE = path.dirname(fileURLToPath(import.meta.url));
12
+ export const CATALOG_FILE = path.join(HERE, 'catalog.json');
13
+ const SDK_FILE = path.join(HERE, 'vendor', 'a2ui-agent.mjs');
14
+
15
+ export const A2UI_LIMITS = {
16
+ // The SDK's parser holds about 400 times the text in memory, so this bounds it.
17
+ expressChars: 64 * 1024,
18
+ components: 60,
19
+ componentsBytes: 96 * 1024,
20
+ dataBytes: 64 * 1024,
21
+ depth: 12,
22
+ eventContextBytes: 1024,
23
+ };
24
+
25
+ const ID_RE = /^[A-Za-z0-9_-]{1,64}$/;
26
+ const POINTER_RE = /^\/[A-Za-z0-9_.-]*(?:\/[A-Za-z0-9_.-]+)*$/;
27
+ const EVENT_NAME_RE = /^[a-z][a-z0-9_-]{0,39}$/;
28
+ const UNSAFE_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
29
+
30
+ // Security: @a2ui/agent 0.1.0's Express compiler writes `$/__proto__/x = 1`
31
+ // (and `$/constructor/prototype/x = 1`) onto Object.prototype of the running
32
+ // process, so such text never reaches it. Bump with the SDK once upstream fixes it.
33
+ const UNSAFE_EXPRESS = /__proto__|\$\/?(?:[\w-]+\/)*(?:constructor|prototype)\b/;
34
+
35
+ let catalogCache;
36
+ /** Relay's catalog: component name -> JSON-schema-style definition. */
37
+ export function loadCatalog() {
38
+ catalogCache ??= JSON.parse(fs.readFileSync(CATALOG_FILE, 'utf8'));
39
+ return catalogCache;
40
+ }
41
+
42
+ const isPlainObject = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
43
+
44
+ /** Refuses prototype-polluting keys anywhere in a JSON-like value, and runaway nesting. */
45
+ export function assertSafeJson(value, where, depth = 0) {
46
+ if (depth > A2UI_LIMITS.depth) throw new CliError(`${where}: nested deeper than ${A2UI_LIMITS.depth} levels.`);
47
+ if (Array.isArray(value)) {
48
+ value.forEach((item) => assertSafeJson(item, where, depth + 1));
49
+ } else if (isPlainObject(value)) {
50
+ for (const key of Object.keys(value)) {
51
+ if (UNSAFE_KEYS.has(key)) throw new CliError(`${where}: the key "${key}" is not allowed.`);
52
+ assertSafeJson(value[key], where, depth + 1);
53
+ }
54
+ }
55
+ }
56
+
57
+ /** Size and path checks that run before the SDK sees the text. */
58
+ export function guardExpress(text, where) {
59
+ if (typeof text !== 'string' || !text.trim()) throw new CliError(`${where}: "express" must be A2UI Express text with a \`root = ...\` line.`);
60
+ if (text.length > A2UI_LIMITS.expressChars) throw new CliError(`${where}: "express" is over ${A2UI_LIMITS.expressChars} characters.`);
61
+ if (UNSAFE_EXPRESS.test(text)) throw new CliError(`${where}: express cannot use __proto__, or constructor or prototype in a $/path.`);
62
+ return text;
63
+ }
64
+
65
+ /** Agents paste the block with or without its `<a2ui>` tags, and sometimes inside a Markdown fence. */
66
+ export function wrapExpress(source) {
67
+ const text = source.trim().replace(/^```[a-z0-9-]*\n/i, '').replace(/\n```$/, '').trim();
68
+ return text.startsWith('<a2ui>') ? text : `<a2ui>\n${text}\n</a2ui>`;
69
+ }
70
+
71
+ let processorPromise;
72
+ // Loaded on first use, so a board without Express never reads the 600 KB bundle.
73
+ function sdkProcessor() {
74
+ processorPromise ??= import(pathToFileURL(SDK_FILE).href).then((sdk) => {
75
+ const catalog = sdk.CatalogConfig.fromPath(CATALOG_FILE);
76
+ const generator = new sdk.A2uiGenerator([catalog]);
77
+ return generator.createProcessor({ '1.0': { supportedCatalogIds: [catalog.catalog.id] } });
78
+ }).catch((err) => {
79
+ processorPromise = undefined;
80
+ throw new CliError(`a2ui express cannot be compiled right now (${err && err.message ? err.message : err}); send the tree as "components" JSON instead.`, 1);
81
+ });
82
+ return processorPromise;
83
+ }
84
+
85
+ /** Compiles one Express block into flat components (root first) and the data model its `$/path = value` lines set. */
86
+ export async function compileExpress(source, where = 'a2ui') {
87
+ guardExpress(source, where);
88
+ const processor = await sdkProcessor();
89
+ let parts;
90
+ try {
91
+ parts = processor.parseResponse(wrapExpress(source));
92
+ } catch (err) {
93
+ throw new CliError(`${where}: express did not compile: ${err && err.message ? err.message : err}`);
94
+ }
95
+ const created = parts.flatMap((part) => part.a2ui ?? []).map((message) => message.createSurface).filter(Boolean);
96
+ if (created.length !== 1) throw new CliError(`${where}: express must hold exactly one \`root = ...\` tree.`);
97
+ const { components, dataModel } = created[0];
98
+ return { components, ...(dataModel && Object.keys(dataModel).length ? { dataModel } : {}) };
99
+ }
100
+
101
+ // ---------- validation against the catalog ----------
102
+
103
+ const DYNAMIC = {
104
+ DynamicString: (v) => typeof v === 'string',
105
+ DynamicNumber: (v) => typeof v === 'number' && Number.isFinite(v),
106
+ DynamicBoolean: (v) => typeof v === 'boolean',
107
+ DynamicValue: () => true,
108
+ };
109
+
110
+ function checkBinding(value, where) {
111
+ const pointer = value['@path'];
112
+ if (typeof pointer !== 'string' || !POINTER_RE.test(pointer)) throw new CliError(`${where}: "@path" must be a data-model pointer like /jobs.`);
113
+ if (pointer.split('/').some((seg) => UNSAFE_KEYS.has(seg))) throw new CliError(`${where}: "@path" cannot name __proto__, constructor or prototype.`);
114
+ }
115
+
116
+ function checkAction(action, where) {
117
+ if (!isPlainObject(action)) throw new CliError(`${where}: action must be Event("name", {...}) or openUrl("https://...").`);
118
+ if (isPlainObject(action.event)) {
119
+ const { name, context } = action.event;
120
+ if (typeof name !== 'string' || !EVENT_NAME_RE.test(name)) throw new CliError(`${where}: event name must be lowercase letters, digits, - or _ (max 40).`);
121
+ if (context !== undefined) {
122
+ if (!isPlainObject(context)) throw new CliError(`${where}: event context must be a map.`);
123
+ if (JSON.stringify(context).length > A2UI_LIMITS.eventContextBytes) throw new CliError(`${where}: event context is over ${A2UI_LIMITS.eventContextBytes} bytes.`);
124
+ }
125
+ return;
126
+ }
127
+ const call = action.functionCall;
128
+ if (isPlainObject(call) && call['@call'] === 'openUrl' && isPlainObject(call.args)) {
129
+ if (typeof call.args.url !== 'string' || !/^https:\/\//i.test(call.args.url)) throw new CliError(`${where}: openUrl takes an https:// link.`);
130
+ return;
131
+ }
132
+ throw new CliError(`${where}: action must be Event("name", {...}) or openUrl("https://...").`);
133
+ }
134
+
135
+ function checkProp(schema, value, where) {
136
+ const ref = typeof schema.$ref === 'string' ? schema.$ref.split('/').pop() : '';
137
+ if (ref === 'Action') return checkAction(value, where);
138
+ if (ref === 'ChildList') {
139
+ if (!Array.isArray(value) || value.some((id) => typeof id !== 'string' || !ID_RE.test(id))) {
140
+ throw new CliError(`${where}: children must be a list of component ids.`);
141
+ }
142
+ return undefined;
143
+ }
144
+ if (DYNAMIC[ref]) {
145
+ if (isPlainObject(value) && '@path' in value) return checkBinding(value, where);
146
+ if (!DYNAMIC[ref](value)) throw new CliError(`${where}: expected ${ref.replace('Dynamic', '').toLowerCase()} or a $/path binding.`);
147
+ return undefined;
148
+ }
149
+ return checkPlain(schema, value, where);
150
+ }
151
+
152
+ function checkPlain(schema, value, where) {
153
+ if (schema.const !== undefined) {
154
+ if (value !== schema.const) throw new CliError(`${where}: must be ${JSON.stringify(schema.const)}.`);
155
+ return;
156
+ }
157
+ const type = schema.type;
158
+ if (type === 'string') {
159
+ if (typeof value !== 'string') throw new CliError(`${where}: must be a string.`);
160
+ if (schema.enum && !schema.enum.includes(value)) throw new CliError(`${where}: must be one of ${schema.enum.join(', ')}.`);
161
+ if (schema.pattern && !new RegExp(schema.pattern).test(value)) throw new CliError(`${where}: "${value.slice(0, 40)}" is not allowed here (pattern ${schema.pattern}).`);
162
+ } else if (type === 'number' || type === 'integer') {
163
+ if (typeof value !== 'number' || !Number.isFinite(value) || (type === 'integer' && !Number.isInteger(value))) throw new CliError(`${where}: must be a ${type}.`);
164
+ if (schema.minimum !== undefined && value < schema.minimum) throw new CliError(`${where}: must be at least ${schema.minimum}.`);
165
+ if (schema.maximum !== undefined && value > schema.maximum) throw new CliError(`${where}: must be at most ${schema.maximum}.`);
166
+ } else if (type === 'boolean') {
167
+ if (typeof value !== 'boolean') throw new CliError(`${where}: must be true or false.`);
168
+ } else if (type === 'array') {
169
+ if (!Array.isArray(value)) throw new CliError(`${where}: must be a list.`);
170
+ if (schema.minItems !== undefined && value.length < schema.minItems) throw new CliError(`${where}: needs at least ${schema.minItems} items.`);
171
+ if (schema.maxItems !== undefined && value.length > schema.maxItems) throw new CliError(`${where}: takes at most ${schema.maxItems} items.`);
172
+ if (schema.items) value.forEach((item, i) => checkProp(schema.items, item, `${where}[${i}]`));
173
+ } else if (type === 'object') {
174
+ if (!isPlainObject(value)) throw new CliError(`${where}: must be a map.`);
175
+ const props = schema.properties || {};
176
+ for (const key of Object.keys(value)) {
177
+ if (!(key in props)) throw new CliError(`${where}: unknown key "${key}".`);
178
+ checkProp(props[key], value[key], `${where}.${key}`);
179
+ }
180
+ for (const key of schema.required || []) if (!(key in value)) throw new CliError(`${where}: missing "${key}".`);
181
+ }
182
+ }
183
+
184
+ function checkComponent(def, comp, where) {
185
+ const props = def.properties;
186
+ for (const key of Object.keys(comp)) {
187
+ if (key === 'id') continue;
188
+ if (!(key in props)) throw new CliError(`${where}: ${comp.component} has no "${key}" property. Known: ${Object.keys(props).filter((k) => k !== 'component').join(', ') || 'none'}.`);
189
+ checkProp(props[key], comp[key], `${where}.${key}`);
190
+ }
191
+ for (const key of def.required || []) if (!(key in comp)) throw new CliError(`${where}: ${comp.component} needs "${key}".`);
192
+ }
193
+
194
+ /** Every component is reachable from `root`, in one place only, with no cycles. */
195
+ function assertTree(byId, where) {
196
+ const seen = new Set();
197
+ const walk = (id, trail) => {
198
+ if (trail.includes(id)) throw new CliError(`${where}: component "${id}" contains itself.`);
199
+ if (seen.has(id)) throw new CliError(`${where}: component "${id}" sits in two parents; give each its own id.`);
200
+ seen.add(id);
201
+ const comp = byId.get(id);
202
+ if (!comp) throw new CliError(`${where}: children name "${id}", which is not defined.`);
203
+ for (const child of Array.isArray(comp.children) ? comp.children : []) walk(child, [...trail, id]);
204
+ };
205
+ walk('root', []);
206
+ const orphan = [...byId.keys()].find((id) => !seen.has(id));
207
+ if (orphan) throw new CliError(`${where}: component "${orphan}" is not reachable from root.`);
208
+ }
209
+
210
+ /**
211
+ * Validates a flat surface against Relay's catalog and returns it as plain data.
212
+ * Throws a CliError worded for the agent that wrote it.
213
+ * @param {{ components: any, dataModel?: any }} surface
214
+ * @param {string} [where]
215
+ */
216
+ export function validateSurface({ components, dataModel }, where = 'a2ui') {
217
+ const catalog = loadCatalog().components;
218
+ if (!Array.isArray(components) || !components.length) throw new CliError(`${where}: "components" must be a non-empty list.`);
219
+ if (components.length > A2UI_LIMITS.components) throw new CliError(`${where}: ${components.length} components; the most a board widget takes is ${A2UI_LIMITS.components}.`);
220
+ assertSafeJson(components, where);
221
+ if (JSON.stringify(components).length > A2UI_LIMITS.componentsBytes) throw new CliError(`${where}: components are over ${A2UI_LIMITS.componentsBytes} bytes.`);
222
+ const byId = new Map();
223
+ components.forEach((comp, i) => {
224
+ const at = `${where}.components[${i}]`;
225
+ if (!isPlainObject(comp)) throw new CliError(`${at}: must be an object.`);
226
+ if (typeof comp.id !== 'string' || !ID_RE.test(comp.id)) throw new CliError(`${at}: "id" must be letters, digits, - or _ (max 64).`);
227
+ if (byId.has(comp.id)) throw new CliError(`${at}: duplicate id "${comp.id}".`);
228
+ const def = Object.hasOwn(catalog, comp.component) ? catalog[comp.component] : null;
229
+ if (!def) throw new CliError(`${at}: unknown component "${comp.component}". Known: ${Object.keys(catalog).join(', ')}.`);
230
+ checkComponent(def, comp, `${at} (${comp.id})`);
231
+ byId.set(comp.id, comp);
232
+ });
233
+ const root = byId.get('root');
234
+ if (!root) throw new CliError(`${where}: needs a component with id "root".`);
235
+ if (root.component !== 'Card') throw new CliError(`${where}: the root must be a Card, not ${root.component}.`);
236
+ assertTree(byId, where);
237
+ if (dataModel !== undefined) {
238
+ if (!isPlainObject(dataModel)) throw new CliError(`${where}: "dataModel" must be an object.`);
239
+ assertSafeJson(dataModel, `${where}.dataModel`);
240
+ if (JSON.stringify(dataModel).length > A2UI_LIMITS.dataBytes) throw new CliError(`${where}: dataModel is over ${A2UI_LIMITS.dataBytes} bytes.`);
241
+ }
242
+ return { components, ...(dataModel && Object.keys(dataModel).length ? { dataModel } : {}) };
243
+ }
244
+
245
+ /**
246
+ * Compiles a block's `express` in place into `components` and `dataModel`, then
247
+ * validates the result. Blocks that already hold components are left alone.
248
+ */
249
+ export async function resolveA2uiBlock(block, where = 'a2ui') {
250
+ if (typeof block.express !== 'string') return block;
251
+ const compiled = await compileExpress(block.express, where);
252
+ const surface = validateSurface(compiled, where);
253
+ delete block.express;
254
+ block.components = surface.components;
255
+ if (surface.dataModel) block.dataModel = surface.dataModel;
256
+ return block;
257
+ }
@@ -0,0 +1,217 @@
1
+ {
2
+ "Status list: things with a state, one row each. The tone carries the state, `trailing` the short word, `url` opens the thing. Rows that need the person come first; the Button reports the decision.": [
3
+ {
4
+ "version": "1.0",
5
+ "createSurface": {
6
+ "surfaceId": "example",
7
+ "catalogId": "https://github.com/khanglvm/relay/a2ui/catalog/v1",
8
+ "components": [
9
+ {
10
+ "id": "root",
11
+ "component": "Card",
12
+ "title": "Release checks",
13
+ "children": [
14
+ "root_children_0",
15
+ "root_children_1"
16
+ ]
17
+ },
18
+ {
19
+ "id": "root_children_0",
20
+ "component": "List",
21
+ "items": {
22
+ "@path": "/runs"
23
+ },
24
+ "max": 5
25
+ },
26
+ {
27
+ "id": "root_children_1",
28
+ "component": "Stack",
29
+ "direction": "row",
30
+ "children": [
31
+ "root_children_1_children_0",
32
+ "root_children_1_children_1"
33
+ ]
34
+ },
35
+ {
36
+ "id": "root_children_1_children_0",
37
+ "component": "Button",
38
+ "label": "Approve",
39
+ "action": {
40
+ "event": {
41
+ "name": "approve"
42
+ }
43
+ },
44
+ "style": "primary"
45
+ },
46
+ {
47
+ "id": "root_children_1_children_1",
48
+ "component": "Button",
49
+ "label": "Hold",
50
+ "action": {
51
+ "event": {
52
+ "name": "hold"
53
+ }
54
+ }
55
+ }
56
+ ],
57
+ "dataModel": {
58
+ "runs": [
59
+ {
60
+ "title": "Deploy staging",
61
+ "subtitle": "waiting on your approval",
62
+ "tone": "needs"
63
+ },
64
+ {
65
+ "title": "Build 412",
66
+ "subtitle": "main, 2 minutes ago",
67
+ "trailing": "Passed",
68
+ "tone": "ok",
69
+ "url": "https://ci.example.com/runs/412"
70
+ },
71
+ {
72
+ "title": "Lint",
73
+ "trailing": "3 warnings",
74
+ "tone": "warn"
75
+ }
76
+ ]
77
+ }
78
+ }
79
+ }
80
+ ],
81
+ "Numbers and progress: two headline numbers side by side, then one bar against a goal.": [
82
+ {
83
+ "version": "1.0",
84
+ "createSurface": {
85
+ "surfaceId": "example",
86
+ "catalogId": "https://github.com/khanglvm/relay/a2ui/catalog/v1",
87
+ "components": [
88
+ {
89
+ "id": "root",
90
+ "component": "Card",
91
+ "title": "Orders this week",
92
+ "children": [
93
+ "root_children_0",
94
+ "root_children_1"
95
+ ]
96
+ },
97
+ {
98
+ "id": "root_children_0",
99
+ "component": "Grid",
100
+ "columns": 2,
101
+ "children": [
102
+ "root_children_0_children_0",
103
+ "root_children_0_children_1"
104
+ ]
105
+ },
106
+ {
107
+ "id": "root_children_0_children_0",
108
+ "component": "Metric",
109
+ "label": "Shipped",
110
+ "value": "31"
111
+ },
112
+ {
113
+ "id": "root_children_0_children_1",
114
+ "component": "Metric",
115
+ "label": "Late",
116
+ "value": "4",
117
+ "note": "was 1"
118
+ },
119
+ {
120
+ "id": "root_children_1",
121
+ "component": "Progress",
122
+ "label": "Shipped",
123
+ "value": {
124
+ "@path": "/shipped"
125
+ },
126
+ "total": {
127
+ "@path": "/target"
128
+ },
129
+ "note": "8 packing"
130
+ }
131
+ ],
132
+ "dataModel": {
133
+ "shipped": 31,
134
+ "target": 50
135
+ }
136
+ }
137
+ }
138
+ ],
139
+ "Small form: inputs bound to the data model; the Button sends their values back with the event.": [
140
+ {
141
+ "version": "1.0",
142
+ "createSurface": {
143
+ "surfaceId": "example",
144
+ "catalogId": "https://github.com/khanglvm/relay/a2ui/catalog/v1",
145
+ "components": [
146
+ {
147
+ "id": "root",
148
+ "component": "Card",
149
+ "title": "Deploy",
150
+ "children": [
151
+ "root_children_0",
152
+ "root_children_1",
153
+ "root_children_2",
154
+ "root_children_3"
155
+ ]
156
+ },
157
+ {
158
+ "id": "root_children_0",
159
+ "component": "Select",
160
+ "label": "Environment",
161
+ "path": "/env",
162
+ "options": [
163
+ {
164
+ "key": "staging",
165
+ "label": "Staging"
166
+ },
167
+ {
168
+ "key": "prod",
169
+ "label": "Production"
170
+ }
171
+ ]
172
+ },
173
+ {
174
+ "id": "root_children_1",
175
+ "component": "Toggle",
176
+ "label": "Dry run",
177
+ "path": "/dry"
178
+ },
179
+ {
180
+ "id": "root_children_2",
181
+ "component": "TextField",
182
+ "label": "Note",
183
+ "path": "/note",
184
+ "multiline": true
185
+ },
186
+ {
187
+ "id": "root_children_3",
188
+ "component": "Button",
189
+ "label": "Deploy",
190
+ "action": {
191
+ "event": {
192
+ "name": "deploy",
193
+ "context": {
194
+ "env": {
195
+ "@path": "/env"
196
+ },
197
+ "dry": {
198
+ "@path": "/dry"
199
+ },
200
+ "note": {
201
+ "@path": "/note"
202
+ }
203
+ }
204
+ }
205
+ },
206
+ "style": "primary"
207
+ }
208
+ ],
209
+ "dataModel": {
210
+ "env": "staging",
211
+ "note": "",
212
+ "dry": true
213
+ }
214
+ }
215
+ }
216
+ ]
217
+ }
@@ -0,0 +1,50 @@
1
+ # A2UI widgets in Relay
2
+
3
+ An `a2ui` block puts a small live widget on a board: a status list, a few numbers, a progress bar, or a short form with buttons. Write it in A2UI Express. Relay compiles the text with the official A2UI agent SDK against Relay's own catalog and draws it with its own renderer.
4
+
5
+ Use a widget for state and quick actions. Use the board's question blocks (`single`, `multi`, `text`) for any answer you depend on, because those come back in `result.answers` with notes and comments. A widget never replaces a question you must have answered.
6
+
7
+ ## Add one to a board
8
+
9
+ ```json
10
+ {
11
+ "title": "Release checks",
12
+ "blocks": [
13
+ {
14
+ "id": "checks",
15
+ "type": "a2ui",
16
+ "title": "Release checks",
17
+ "express": "$/runs = [{title: \"Build\", trailing: \"2m\", tone: \"ok\"}, {title: \"E2E\", trailing: \"failed\", tone: \"error\"}]\nroot = Card(\"Release checks\", [List($/runs), Button(\"Retry E2E\", action=Event(\"retry\", {job: \"e2e\"}))])"
18
+ }
19
+ ],
20
+ "questions": [
21
+ { "id": "go", "type": "yesno", "label": "Ship after the retry?" }
22
+ ]
23
+ }
24
+ ```
25
+
26
+ Send `components` (a flat A2UI v1.0 component list with a `dataModel`) instead of `express` when you already hold JSON. Give exactly one of the two. `height` (pixels) limits the block's height.
27
+
28
+ ## What comes back
29
+
30
+ The person's clicks and input values are part of the board result, under `result.blockEdits[blockId]`:
31
+
32
+ ```json
33
+ { "type": "a2ui", "data": { "note": "via phone" }, "events": [{ "name": "retry", "context": { "job": "e2e" }, "at": "2026-11-22T10:15:00.000Z" }] }
34
+ ```
35
+
36
+ - `data` is the widget's data model with the current value of every input.
37
+ - `events` lists each button press in order. Name an event for what the person decided (`approve`, `retry`), and put the values you need into its context.
38
+ - Clicks are recorded in the draft and sent with the board when the person submits. A button does not submit the board.
39
+
40
+ ## Rules for good widgets
41
+
42
+ - One widget, one purpose. At most 60 components, 64 KB of data, 12 levels deep. Put the state first.
43
+ - The root is a `Card`. State is a tone: `ok`, `info`, `warn`, `error` or `needs` (the person has to act). Never name a colour.
44
+ - Text is drawn as text. Markup, HTML and script in a string are shown as written, never run. Links open only when they are https URLs.
45
+ - Bind with `$/path`. Paths with `__proto__`, `constructor` or `prototype` segments are refused at compile time.
46
+ - The grammar below says to wrap Express in `<a2ui>` tags. In a Relay spec, leave the tags out: the `express` field holds the Express text alone.
47
+ - Run `rly ask --file spec.json --detach` as usual: a spec with an invalid widget fails before the board opens, with the compiler's message.
48
+
49
+
50
+ The rest of this page comes from the A2UI agent SDK, generated from Relay's catalog (`src/a2ui/catalog.json`) and examples (`src/a2ui/examples.json`).