@khanglvm/relay 0.17.0 → 0.18.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.
- package/README.md +50 -238
- package/docs/A2UI.md +221 -0
- package/docs/AGENT.md +34 -0
- package/docs/SETUP.md +74 -0
- package/package.json +2 -2
- package/skills/relay/SKILL.md +19 -0
- package/src/a2ui/catalog.json +630 -0
- package/src/a2ui/compile.js +255 -0
- package/src/a2ui/examples.json +217 -0
- package/src/a2ui/guide.md +50 -0
- package/src/a2ui/vendor/LICENSE +227 -0
- package/src/a2ui/vendor/VERSION +1 -0
- package/src/a2ui/vendor/a2ui-agent.mjs +193 -0
- package/src/a2ui/vendor/antlr4ng-LICENSE.txt +29 -0
- package/src/cli.js +67 -19
- package/src/link.js +120 -0
- package/src/mcp.js +2 -2
- package/src/server.js +70 -12
- package/src/spec.js +26 -2
- package/src/store.js +6 -0
- package/src/ui/a2ui-state.js +89 -0
- package/src/ui/a2ui.css +106 -0
- package/src/ui/a2ui.js +289 -0
- package/src/ui/blocks.css +10 -5
- package/src/ui/blocks.js +60 -1
- package/src/ui/kit.js +20 -7
package/README.md
CHANGED
|
@@ -1,269 +1,81 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Relay
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Relay gives your AI coding agent a board for showing work and asking for
|
|
4
|
+
feedback. Review a design, compare a diff, or answer several questions in one
|
|
5
|
+
place, in your browser or inside a chat app that supports MCP Apps.
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
and
|
|
8
|
-
|
|
9
|
-
JSON and keeps working.
|
|
7
|
+
Feedback stays attached to the thing you mean: a chart point, a line of text,
|
|
8
|
+
or a marked area of an image. When you submit, the agent gets your choices
|
|
9
|
+
and comments as structured JSON, including the target of each comment.
|
|
10
|
+
It works with agents such as Claude Code and Codex.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+

|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
browser; you pick a style, expand the chart, comment on a data point, leave a
|
|
15
|
-
note, Submit — and the agent picks up your answers and keeps going:
|
|
14
|
+
## Install and try it
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Quick start
|
|
16
|
+
Requires Node.js 18.3 or newer.
|
|
20
17
|
|
|
21
18
|
```sh
|
|
22
|
-
# the rly CLI
|
|
23
19
|
npm i -g @khanglvm/relay
|
|
24
|
-
|
|
25
|
-
# the agent skill → every detected agent (Claude Code, Codex, Cursor, …)
|
|
26
|
-
npx skills add khanglvm/relay --skill relay --all
|
|
27
|
-
|
|
28
|
-
# enforce it (recommended) — a skill alone is an ignorable hint; `rly install`
|
|
29
|
-
# writes relay's usage rules into the file each agent reads (run `rly install`
|
|
30
|
-
# with no args to see every supported target and where it lands):
|
|
31
|
-
rly install --all # every agent detected on this machine
|
|
20
|
+
rly ask -q "Which layout?::single::Sidebar,Top navigation"
|
|
32
21
|
```
|
|
33
22
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Keep relay current with **`rly upgrade`** — it installs the latest CLI and
|
|
38
|
-
refreshes the skill (via `npx skills`, falling back to the bundled copy) in one
|
|
39
|
-
step, leaving any boards you have open untouched.
|
|
40
|
-
|
|
41
|
-
## Inside the Claude & Codex apps (MCP App)
|
|
23
|
+
A board opens in your browser. Choose an option and submit to see the result
|
|
24
|
+
in your terminal.
|
|
42
25
|
|
|
43
|
-
|
|
44
|
-
— so the same board renders **inline, right in the conversation**, on Claude
|
|
45
|
-
desktop **and mobile** and in Codex, no browser tab. `rly mcp` is a
|
|
46
|
-
stdio MCP server with no npm runtime dependencies; register it once and the agent gets two tools,
|
|
47
|
-
`relay_ask` (collect decisions/feedback with real form controls) and
|
|
48
|
-
`relay_show` (present a plan, diagram, diff, table, or prototype):
|
|
26
|
+
You can also open local files or review changes from a Git repository:
|
|
49
27
|
|
|
50
28
|
```sh
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# Claude Desktop / Codex — write the host config for you
|
|
55
|
-
rly mcp install --target claude # claude_desktop_config.json
|
|
56
|
-
rly mcp install --target codex # ~/.codex/config.toml
|
|
57
|
-
|
|
58
|
-
# or print the snippet for any MCP host (incl. the raw JSON/TOML)
|
|
59
|
-
rly mcp config
|
|
29
|
+
rly view README.md
|
|
30
|
+
rly diff --staged
|
|
60
31
|
```
|
|
61
32
|
|
|
62
|
-
|
|
63
|
-
resource in a sandboxed iframe, hands it the board spec, and the user's answers
|
|
64
|
-
flow back to the agent as a `ui/message` user turn, with
|
|
65
|
-
`ui/update-model-context` used as a best-effort structured context sync —
|
|
66
|
-
markdown, code, diffs, tables, charts, mermaid/graphviz diagrams, images, and
|
|
67
|
-
forms, all in-chat. The classic browser board (`rly ask` / `rly show`) is
|
|
68
|
-
unchanged; pick whichever surface fits.
|
|
69
|
-
|
|
70
|
-
## What it improves
|
|
33
|
+
## What you can review
|
|
71
34
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
| ASCII architecture art | Mermaid, Graphviz, PlantUML — zoomable, full-screen, even user-editable |
|
|
77
|
-
| Numbers buried in prose | Charts and sortable tables; screenshots and HTML prototypes in a sandbox |
|
|
78
|
-
| "Here's the diff — paste it in your editor" | Side-by-side **diff** blocks, syntax-highlighted **code**, **video** walkthroughs, and **file paths you click to open** in the default app |
|
|
79
|
-
| "Which commits should I pick? Resolve this conflict manually." | `rly git pick` / `rly git cherry-pick` boards and color-coded `git-conflict` resolvers with ours/theirs/custom hunk choices |
|
|
80
|
-
| "Type *done* when finished reviewing" | A Submit button; answers, notes, and inline comments returned as JSON |
|
|
81
|
-
| Feedback = another wall of text | Click any chart point, diagram node, table cell, or sentence; drag an image region to attach a local crop — the agent replies and the thread grows on the board |
|
|
35
|
+
- Plans, documents, charts, and diagrams.
|
|
36
|
+
- Images and HTML prototypes, with comments on individual elements or areas.
|
|
37
|
+
- Source files and diffs, including commit choices and merge conflicts.
|
|
38
|
+
- Questions with choices, notes, and other form controls.
|
|
82
39
|
|
|
83
|
-
|
|
84
|
-
agent timeouts, multiple boards run at once, and the package has **zero npm
|
|
85
|
-
runtime dependencies** — plain Node ≥ 18. Browser-side Chart.js, Mermaid, and
|
|
86
|
-
Viz.js assets are vendored in the package and lazy-loaded offline when a board
|
|
87
|
-
actually needs them.
|
|
40
|
+
- Small live widgets such as status lists, numbers, progress bars and buttons, written in [A2UI](docs/A2UI.md).
|
|
88
41
|
|
|
89
|
-
|
|
42
|
+
Answers and comments autosave. To stop a board, run `rly list` to find its
|
|
43
|
+
ID, then `rly stop <board-id>`.
|
|
90
44
|
|
|
91
|
-
|
|
92
|
-
|---|---|
|
|
93
|
-
| `rly help` | every command at a glance |
|
|
94
|
-
| `rly git pick` / `rly git cherry-pick` | choose commit actions and rank the order directly on a board; add `--code` to cherry-pick with split code review and per-hunk Apply/Skip/Hold |
|
|
95
|
-
| `rly git conflict [files…]` | auto-detect unmerged conflict files, or open specific local paths, and return resolved content in `result.blockEdits` |
|
|
96
|
-
| `rly share <board-id>` | activate/list/revoke same-Wi-Fi collaborator, reference-only reviewer, or read-only links for a running browser board |
|
|
97
|
-
| `rly view <file.md> …` | open a quick read-only board that renders local markdown file(s), data files, or PDFs — library-free; great for plans, READMEs, reports, quotes |
|
|
98
|
-
| `rly show --file spec.json --display-only` | present a browser board and continue immediately — no comment/note or acknowledgement required; inline `relay_show` uses this mode by default |
|
|
99
|
-
| `rly install --target <agent>` | write relay's rules into an agent's instruction file — `claude` `codex` `cursor` `copilot` `kiro` `windsurf` `cline` `gemini` `opencode` `droid` `agents`; `--all`, `--scope`, `--print`, `--list` |
|
|
100
|
-
| `rly upgrade` | update the CLI **and** refresh the skill in one step (safe around open boards; `--dry-run`, `--cli-only`, `--skill-only`) |
|
|
101
|
-
| `rly mcp` | run relay as an MCP App server so boards render **inline** in the chat — **stdio** for local desktop hosts (Claude Desktop, Codex), or `rly mcp --http` (Streamable HTTP) for web/mobile/remote; `rly mcp config` / `rly mcp install --target claude\|codex` to register it |
|
|
102
|
-
| `rly agent` | the full agent guide — spec format, all block types, annotations, patterns ([docs/AGENT.md](docs/AGENT.md)) |
|
|
103
|
-
| `rly schema` | board spec JSON Schema |
|
|
104
|
-
| [skills/relay/SKILL.md](skills/relay/SKILL.md) | the bundled skill |
|
|
45
|
+
## For AI agents
|
|
105
46
|
|
|
106
|
-
|
|
47
|
+
Install the skill so your agent knows how to create boards and read feedback:
|
|
107
48
|
|
|
108
49
|
```sh
|
|
109
|
-
|
|
50
|
+
npx skills add khanglvm/relay --skill relay --all
|
|
110
51
|
```
|
|
111
52
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
### 0.16.1 — reliable area-comment zones
|
|
115
|
-
|
|
116
|
-
- Primary drag now draws a comment area directly on image and comparison views;
|
|
117
|
-
**Area** remains as a visible one-shot lock. Image pan uses Space-drag or the
|
|
118
|
-
middle button, while the comparison divider moves only from its handle.
|
|
119
|
-
- The selected rectangle remains visible while its comment is composed. Saved
|
|
120
|
-
zones carry a comment icon plus count, reopen for add/edit/delete, and disappear
|
|
121
|
-
automatically when their final comment is removed.
|
|
53
|
+
Give your agent this instruction:
|
|
122
54
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
lines; unsupported files retain an explicit **Open in app** fallback.
|
|
130
|
-
- Shorter agent skill and installed instructions, with clear display-only,
|
|
131
|
-
feedback, file-preview, and existing-board workflows.
|
|
132
|
-
|
|
133
|
-
### 0.16.0 — native viewer chrome, area comments, and durable agent waits
|
|
134
|
-
|
|
135
|
-
- Viewer toolbars now use browser-native sticky positioning instead of a
|
|
136
|
-
scroll-event counter-translation; open comment composers re-anchor on scroll
|
|
137
|
-
and preserve unsaved per-target drafts.
|
|
138
|
-
- Hold then drag on an image to comment on an exact rectangular area. Relay
|
|
139
|
-
saves the crop beside the browser-board record and returns its path; comparison
|
|
140
|
-
crops also identify and capture the selected Before/After source.
|
|
141
|
-
- Browser boards support `responseRequired:false` / `--display-only`; inline
|
|
142
|
-
`relay_show` is display-only by default. Board and waiter deadlines now default
|
|
143
|
-
to one day (`--timeout 0` removes Relay's deadline), with client-specific
|
|
144
|
-
background/polling guidance in the agent docs.
|
|
145
|
-
|
|
146
|
-
### 0.11.0 — render inline inside the Claude & Codex apps (MCP App)
|
|
147
|
-
- **`rly mcp` — relay as an MCP App** ([SEP-1865](https://modelcontextprotocol.io/seps/1865-mcp-apps-interactive-user-interfaces-for-mcp),
|
|
148
|
-
extension `io.modelcontextprotocol/ui`). A stdio MCP server with no npm runtime dependencies
|
|
149
|
-
that declares a `ui://relay/board` resource (`text/html;profile=mcp-app`) and
|
|
150
|
-
two tools, **`relay_ask`** and **`relay_show`**, linked to it via
|
|
151
|
-
`_meta.ui.resourceUri` (plus `openai/outputTemplate` for ChatGPT/Codex). The
|
|
152
|
-
host renders the board **inline in the conversation** — Claude desktop **and
|
|
153
|
-
mobile**, Codex — instead of opening a browser tab.
|
|
154
|
-
- **Same board, postMessage transport.** The inline board reuses relay's block
|
|
155
|
-
renderer (markdown, code, diff, table, chart, mermaid, graphviz, image, html)
|
|
156
|
-
over the MCP Apps JSON-RPC bridge: the spec arrives as the tool result, the
|
|
157
|
-
user's submit goes back via `ui/message` so the agent resumes, the structured
|
|
158
|
-
payload is also offered through `ui/update-model-context`, the iframe
|
|
159
|
-
auto-sizes via `ui/notifications/size-changed`, and vendored Chart.js /
|
|
160
|
-
Mermaid / Viz.js load on demand through the host's `resources/read` (no
|
|
161
|
-
`/vendor` route, no server in the sandbox).
|
|
162
|
-
- **One-command setup** — `rly mcp install --target claude|codex` writes the
|
|
163
|
-
host config; `rly mcp config` prints the snippet for any MCP host. The classic
|
|
164
|
-
browser board is untouched.
|
|
165
|
-
- **Streamable HTTP transport for web/mobile/remote** — `rly mcp --http
|
|
166
|
-
[--port N --host H --token SECRET --allow-origin ORIGIN]` serves the same tools
|
|
167
|
-
over MCP's Streamable HTTP transport (single `/mcp` endpoint, JSON responses,
|
|
168
|
-
CORS, Origin validation, bearer auth, `Mcp-Session-Id`, `$PORT`-aware). relay is
|
|
169
|
-
**stateless**, so one instance serves everyone — deploy it once with the repo
|
|
170
|
-
**`Dockerfile`** on any free MCP host (mcpdeploy.dev, mcphosting.io,
|
|
171
|
-
Render/Railway/Fly, Glama) or publish to **Smithery**, then add the URL as a
|
|
172
|
-
custom connector. Only the relay CLI is required — no tunnel/tailscale. stdio
|
|
173
|
-
stays the zero-setup path for local desktop.
|
|
174
|
-
- **Native look** — the inline board **color-blends** onto the host's SEP-1865
|
|
175
|
-
style variables (surfaces, text, borders, primary button, fonts), pins
|
|
176
|
-
`color-scheme` so `light-dark()` tokens resolve, and uses the host's **own
|
|
177
|
-
full-screen** control (centering content to a readable column in fullscreen).
|
|
178
|
-
After submit it collapses to a one-line confirmation so the iframe shrinks.
|
|
179
|
-
- **Progressive rendering** — when the host streams the tool call
|
|
180
|
-
(`ui/notifications/tool-input-partial`), the board renders valid blocks as they
|
|
181
|
-
arrive (a "Composing…" preview) instead of waiting for the whole spec.
|
|
182
|
-
- **`palette` block** — color palettes as swatch cards (hover reveals hex, click
|
|
183
|
-
copies); mark one `featured` for a spotlight. **`color` question type** — native
|
|
184
|
-
picker + hex field + optional `presets`, returns a hex string. Both work on the
|
|
185
|
-
browser board and inline.
|
|
186
|
-
- **Element annotations inline** — comment on chart points, diagram nodes, table
|
|
187
|
-
cells, images and text selections in the MCP board too, returned in
|
|
188
|
-
`annotations` exactly like the CLI board.
|
|
189
|
-
|
|
190
|
-
### 0.10.0 — open files, richer code, diffs & video
|
|
191
|
-
- **Clickable local file-links.** Write a path in any markdown (`~/clip.mp4`,
|
|
192
|
-
`./src/app.ts`, `/abs/report.pdf`, a `file://` URL, a backtick-wrapped path,
|
|
193
|
-
or `[label](path)`) and it renders as a link that opens the file in the OS
|
|
194
|
-
default app — guarded by a same-origin check + an allowlist of paths the
|
|
195
|
-
board actually references. `RLY_OPEN_CMD` overrides the opener.
|
|
196
|
-
- **`code` blocks leveled up** — syntax highlighting for ~20 languages (js, ts,
|
|
197
|
-
py, go, rust, java, c, cpp, csharp, ruby, php, swift, kotlin, sql, yaml, json,
|
|
198
|
-
sh, css, html…), a line-number gutter, a filename/lang header, and `codeFile`
|
|
199
|
-
to load source straight from a local file.
|
|
200
|
-
- **`diff` block** — render a unified git diff as a colored, line-numbered
|
|
201
|
-
comparison with a live **Unified ⇄ Split (side-by-side)** toggle. No git
|
|
202
|
-
required; the agent supplies the diff text (`diff`/`diffFile`, `view`).
|
|
203
|
-
- **`video` block** — YouTube/Vimeo embeds, a direct media URL, or a local
|
|
204
|
-
video file streamed from the server with HTTP Range (seekable), never
|
|
205
|
-
embedded in the payload.
|
|
206
|
-
- **`pdf` block** — render local `.pdf` files or PDF URLs inline. Local PDFs
|
|
207
|
-
stream from the board server and are never embedded in the page payload.
|
|
208
|
-
- **Durable boards / rescue** — detached boards keep serving after timeout
|
|
209
|
-
until Submit or `rly stop`; every autosave mirrors to `localStorage`; a board
|
|
210
|
-
whose connection drops blocks further input instead of losing it, and
|
|
211
|
-
`rly rescue <id>` re-serves on the same port so an open tab reconnects. Active
|
|
212
|
-
same-Wi-Fi share links stay tied to the board and survive a same-port re-serve
|
|
213
|
-
until revoked. Reviewer submissions are isolated, reference-only side reviews
|
|
214
|
-
that never finish the owner's board; read-only links cannot mutate feedback.
|
|
215
|
-
- Still **zero npm runtime dependencies**, offline, and cross-platform. Vendored
|
|
216
|
-
browser libraries are loaded only for boards that need them.
|
|
217
|
-
|
|
218
|
-
### 0.9.1
|
|
219
|
-
- The board **intro renders as markdown** (bold/italic/code/links/lists).
|
|
220
|
-
|
|
221
|
-
### 0.9.0 — interactive visual annotations
|
|
222
|
-
- Drag/zoom/full-screen viewer, per-element **and** whole-block comments, chart
|
|
223
|
-
data-point comment badges, and inline-SVG PlantUML rendering.
|
|
224
|
-
|
|
225
|
-
### 0.8.1
|
|
226
|
-
- `rly install` adds **OpenCode** (`~/.config/opencode/AGENTS.md`) and **Droid /
|
|
227
|
-
Factory** (`~/.factory/AGENTS.md`) targets.
|
|
228
|
-
- README documents `rly install` and `rly upgrade`.
|
|
229
|
-
|
|
230
|
-
### 0.8.0 — install into any agent
|
|
231
|
-
- **`rly install --target <agent>`** writes relay's usage rules into the right
|
|
232
|
-
file for Claude Code, Codex, Cursor, GitHub Copilot (VS Code / Visual Studio /
|
|
233
|
-
JetBrains), Kiro, Windsurf, Cline, Gemini, or the generic `AGENTS.md` —
|
|
234
|
-
cross-platform (macOS / Linux / Windows), idempotent, with `--all`, `--scope`,
|
|
235
|
-
and `--print`.
|
|
236
|
-
- Fixed `rly skill install` crashing when the target skill dir was a symlink.
|
|
237
|
-
|
|
238
|
-
### 0.7.0 — sturdier boards, self-update
|
|
239
|
-
- **Markdown blocks render GFM tables**; element comments moved to an
|
|
240
|
-
Outline-style right sidebar with inline highlights on commented text.
|
|
241
|
-
- **Seamless timeouts** — a detached board that runs past its deadline keeps
|
|
242
|
-
serving until Submit or explicit stop, so you can still submit (it lands as
|
|
243
|
-
`submitted`); the page shows a calm note instead of disconnecting.
|
|
244
|
-
- **`rly upgrade`** — install the latest CLI and refresh the skill in one step.
|
|
245
|
-
- Per-question notes are multi-line textboxes.
|
|
55
|
+
```text
|
|
56
|
+
Use Relay to show work or collect visual feedback. Install the CLI with
|
|
57
|
+
`npm i -g @khanglvm/relay` if missing. Run `rly agent` for the board format.
|
|
58
|
+
Create with `rly ask --file spec.json --detach`, then use `rly wait <board-id>`
|
|
59
|
+
to collect answers. On timeout, check `rly result <board-id>` before continuing.
|
|
60
|
+
```
|
|
246
61
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
a button, a card, the price — and a pin appears to leave an inline note. No
|
|
250
|
-
setup needed; the agent writes zero annotation code. Want to scope it? Mark
|
|
251
|
-
specific elements with `data-relay-annotate="label"`.
|
|
252
|
-
- **Radio questions can carry a note.** Pick an option *and* say why, in one
|
|
253
|
-
optional field — now shown by default (set `"note": false` to hide it).
|
|
254
|
-
- **Edge-to-edge fullscreen** for charts and HTML mockups, with the toolbar
|
|
255
|
-
pinned to the top while you scroll.
|
|
256
|
-
- The board **title and intro are commentable** too.
|
|
62
|
+
To make this a standing preference, `rly install --target codex` adds Relay
|
|
63
|
+
rules to Codex's instruction file. Run `rly install` to see other targets.
|
|
257
64
|
|
|
258
|
-
|
|
259
|
-
- Visual answer options, image blocks, viewer redesign, adoption rules.
|
|
65
|
+
## Open a board on your phone
|
|
260
66
|
|
|
261
|
-
|
|
67
|
+
If the `devlink` command is installed, `rly ask --file spec.json --detach --devlink`
|
|
68
|
+
prints a private https URL that works on other devices. Any https URL that reaches the
|
|
69
|
+
board works too: `--public-url 'https://host:{port}'`. Run `rly config link devlink` to make
|
|
70
|
+
it the default. The details are in the [agent guide](docs/AGENT.md).
|
|
262
71
|
|
|
263
|
-
|
|
264
|
-
deprecated. Storage moved from `~/.quest-board` to `~/.relay` (override with
|
|
265
|
-
`RLY_HOME`); legacy `"html"` / `"htmlFile"` spec fields keep working.
|
|
72
|
+
## More help
|
|
266
73
|
|
|
267
|
-
|
|
74
|
+
- [Setup and MCP Apps](docs/SETUP.md): agent configuration, in-chat boards, sharing, and updates.
|
|
75
|
+
- [A2UI widgets](docs/A2UI.md): the `a2ui` block, also available as `rly a2ui`.
|
|
76
|
+
- [Agent guide](docs/AGENT.md): board examples, block types, and JSON schemas; also available as `rly agent`.
|
|
77
|
+
- `rly help` lists commands. `rly upgrade` updates the CLI and skill.
|
|
78
|
+
- [Changelog](CHANGELOG.md) · [MIT license](LICENSE)
|
|
268
79
|
|
|
269
|
-
|
|
80
|
+
For development, clone the repo and run `npm test`. The smoke tests use local
|
|
81
|
+
servers and do not require external services.
|
package/docs/A2UI.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
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`).
|
|
51
|
+
|
|
52
|
+
# A2UI Express DSL Output Contract
|
|
53
|
+
|
|
54
|
+
You must output the user interface using A2UI Express.
|
|
55
|
+
|
|
56
|
+
IMPORTANT: You MUST always surround the entire A2UI Express block with the literal sentinel tags `<a2ui>` and `</a2ui>` (always include both the opening and closing tags; do NOT wrap the tags in backticks or replace the opening tag with a markdown code fence such as ```a2ui).
|
|
57
|
+
|
|
58
|
+
The host compiler will compile your A2UI Express output into the correct JSON envelopes automatically.
|
|
59
|
+
|
|
60
|
+
## Grammar Rules
|
|
61
|
+
|
|
62
|
+
1. Component constructors can be assigned to variables or nested inline inside parent component arguments:
|
|
63
|
+
header = ComponentA(prop1="val1")
|
|
64
|
+
root = ComponentB([header, ComponentC("Click", action=Event("submit"))])
|
|
65
|
+
|
|
66
|
+
Keyword arguments (`param=value`) and positional arguments with `_` placeholders are supported.
|
|
67
|
+
|
|
68
|
+
Variable names MUST start with a letter or underscore, and only contain letters, digits, and underscores.
|
|
69
|
+
|
|
70
|
+
2. The interface tree must have a single entry point assigned to the reserved variable 'root'.
|
|
71
|
+
|
|
72
|
+
3. Primitives:
|
|
73
|
+
- Strings: Quoted with `"` or `"""`. Support for `\n`, `\t`, `\\`, and `\"` escapes.
|
|
74
|
+
Raw Strings: Prefaced by `r` (e.g., `r"..."` or `r"""..."""`), with no escape processing.
|
|
75
|
+
- Numbers: write as integers or decimals, e.g., 42
|
|
76
|
+
- Booleans: write true or false
|
|
77
|
+
- Null values: write null
|
|
78
|
+
- Dates & Times: Values for date-time inputs (e.g. in DateTimeInput) must strictly use RFC 3339 format with a timezone offset (e.g. "2026-03-14T00:00:00Z").
|
|
79
|
+
|
|
80
|
+
4. Lists: represent as arrays, e.g., [child1, child2].
|
|
81
|
+
|
|
82
|
+
5. Maps: represent as key-value blocks, e.g., {title: "Overview", child: contentCol}. Map keys are always literal strings (dynamic variable resolution is not supported for keys).
|
|
83
|
+
|
|
84
|
+
6. Data bindings: prefix absolute paths in the data model with '$', e.g., $/user/firstName.
|
|
85
|
+
Prefix relative list scopes with '$', e.g., $firstName.
|
|
86
|
+
A lone '$' represents an empty relative path which resolves to the root of the current context (e.g. inside a template, representing the entire item itself).
|
|
87
|
+
|
|
88
|
+
7. Logic and validation: prefix client check rules with '?', e.g., ?required or ?regex("^[0-9]{5}$"). To specify a custom error message for validation failures, append it as an extra string argument, e.g. ?regex("^[0-9]{5}$", "Postal code must be 5 digits").
|
|
89
|
+
|
|
90
|
+
8. Action events: represent server-side actions using the Event helper:
|
|
91
|
+
Event("save_deal", {rep: $/form/rep})
|
|
92
|
+
|
|
93
|
+
9. Nested functions: call client functions directly using catalog signatures, for example myFunction("value").
|
|
94
|
+
|
|
95
|
+
10. Data model population: Assign a value directly to an absolute data path (e.g. $/path/to/key = "value") to populate or initialize values inside the shared dataModel. The value can be a primitive, array, or map.
|
|
96
|
+
|
|
97
|
+
11. Dynamic list templates: If a component expects a template child list, represent it using the _template helper:
|
|
98
|
+
_template($/path/to/list, itemTemplate)
|
|
99
|
+
And define the template component variable on another line, utilizing relative path references prefixed with $:
|
|
100
|
+
itemTemplate = Image($url)
|
|
101
|
+
|
|
102
|
+
12. To delete a user interface surface, output the standalone `deleteSurface(surfaceId)` command (no variable assignment):
|
|
103
|
+
deleteSurface("dashboard-surface-1")
|
|
104
|
+
|
|
105
|
+
13. Static properties: Arguments annotated with '(static)' in the signatures below MUST be defined as literal values or arrays inline. You CANNOT use a dynamic data binding path (prefixed by $) for these arguments.
|
|
106
|
+
|
|
107
|
+
14. Required actions: Parameters named 'action' (or annotated in component signatures) are strictly required. You must pass a valid Event (e.g. Event("click")) or function call. If no specific action is described in the user request, you must provide a dummy click event like Event("click") instead of passing null or omitting the parameter.
|
|
108
|
+
|
|
109
|
+
15. Surface targeting: Output `surface(surfaceId)` to specify or target a user interface surface:
|
|
110
|
+
surface("dashboard-surface-1")
|
|
111
|
+
root = Card(...)
|
|
112
|
+
|
|
113
|
+
## Positional Component Signatures
|
|
114
|
+
|
|
115
|
+
Use these exact positional signatures to instantiate components. Do not output property keys:
|
|
116
|
+
• Button(label, action (static), style? (static))
|
|
117
|
+
- Description: A button. `Event(name, context)` sends the click back to the agent in the board's answer, with the current values of the inputs on the card; `openUrl` opens an https link.
|
|
118
|
+
- style: Must be one of: 'primary', 'plain'
|
|
119
|
+
• Card(title, children)
|
|
120
|
+
- Description: The root of a board widget (id `root`): an optional title and its children. Use it for the one widget a board shows.
|
|
121
|
+
• Code(code, language? (static))
|
|
122
|
+
- Description: A code block, shown as text.
|
|
123
|
+
• Divider()
|
|
124
|
+
- Description: A hairline between sections.
|
|
125
|
+
• Grid(columns (static), children, gap? (static))
|
|
126
|
+
- Description: Equal-width columns, filled row by row. On a phone, 3 or 4 columns drop to 2.
|
|
127
|
+
- gap: Must be one of: 'xs', 'sm', 'md', 'lg'
|
|
128
|
+
• Icon(name (static), label, tone? (static))
|
|
129
|
+
- Description: One icon from a fixed set. `label` is what a screen reader says.
|
|
130
|
+
- name: Must be one of: 'check', 'alert', 'info', 'x', 'clock', 'file', 'folder', 'git-branch', 'play', 'star', 'link', 'user', 'bell', 'lock'
|
|
131
|
+
- tone: Must be one of: 'info', 'ok', 'warn', 'error', 'needs'
|
|
132
|
+
• Image(url (static), alt)
|
|
133
|
+
- Description: A picture from an https address.
|
|
134
|
+
• List(items, max? (static))
|
|
135
|
+
- Description: Rows of things with a state: a title, an optional subtitle and trailing value, a tone pill and an optional https link.
|
|
136
|
+
- items: Array of {title, subtitle?, trailing?, tone?, url?}, usually bound to a data-model path.
|
|
137
|
+
- max: Rows shown before `N more`.
|
|
138
|
+
• Metric(label, value, note?)
|
|
139
|
+
- Description: One number with a label and an optional note.
|
|
140
|
+
• Pill(text, tone (static))
|
|
141
|
+
- Description: A short state word in a tone.
|
|
142
|
+
- tone: `ok` done or healthy, `info` in progress, `warn` slipping, `error` failed, `needs` the person must act. Must be one of: 'info', 'ok', 'warn', 'error', 'needs'
|
|
143
|
+
• Progress(label, value, total, note?, tone? (static))
|
|
144
|
+
- Description: A bar with `value` of `total`, a label and an optional note.
|
|
145
|
+
- tone: Must be one of: 'info', 'ok', 'warn', 'error'
|
|
146
|
+
• Select(label, path (static), options (static))
|
|
147
|
+
- Description: A pick-one input bound to `path`; the value is the picked option's `key`.
|
|
148
|
+
- options: List of maps with keys:
|
|
149
|
+
* key
|
|
150
|
+
* label
|
|
151
|
+
• Slider(label, path (static), min (static), max (static), step? (static))
|
|
152
|
+
- Description: A number input bound to `path` between `min` and `max`.
|
|
153
|
+
• Stack(direction (static), children, gap? (static), align? (static))
|
|
154
|
+
- Description: Lays children out in a row or a column.
|
|
155
|
+
- direction: Must be one of: 'row', 'column'
|
|
156
|
+
- gap: Space between children: xs 4, sm 8 (default), md 12 or lg 16 pixels. Must be one of: 'xs', 'sm', 'md', 'lg'
|
|
157
|
+
- align: Must be one of: 'start', 'center', 'end', 'stretch'
|
|
158
|
+
• Table(columns (static), rows, max? (static))
|
|
159
|
+
- Description: Rows under typed columns.
|
|
160
|
+
- columns: List of maps with keys:
|
|
161
|
+
* key
|
|
162
|
+
* label
|
|
163
|
+
- rows: Array of objects keyed by column `key`.
|
|
164
|
+
• Text(text, variant? (static))
|
|
165
|
+
- Description: Plain prose, never markup. `title` is a heading for the widget's sections, `muted` a quiet note.
|
|
166
|
+
- variant: Must be one of: 'body', 'title', 'muted'
|
|
167
|
+
• TextField(label, path (static), placeholder?, multiline? (static))
|
|
168
|
+
- Description: A text input bound to the data model at `path`. Its value comes back in the board's answer.
|
|
169
|
+
• Toggle(label, path (static))
|
|
170
|
+
- Description: An on/off input bound to `path`.
|
|
171
|
+
|
|
172
|
+
## Positional Function Signatures
|
|
173
|
+
|
|
174
|
+
Use these exact positional signatures to instantiate check rules or logic functions:
|
|
175
|
+
• openUrl(url)
|
|
176
|
+
- Description: Opens an https link in a new tab.
|
|
177
|
+
|
|
178
|
+
## Catalog Instructions
|
|
179
|
+
|
|
180
|
+
One surface is one widget. The root is always a Card (id `root`). Keep it small: at most 60 components, one question per widget. State is a tone (`ok`, `info`, `warn`, `error`, `needs`), never a colour word. Put values in the data model with `$/path = value` lines and bind components to them. A Button's `Event(name, {key: value})` comes back to you in `result.blockEdits[blockId]`, with the values of every input on the card, so name the events for what the person decided (`approve`, `retry`). Use `openUrl` for links. Never put markup in a string: text is drawn as text. Use the board's own question blocks for anything the answer depends on; an A2UI widget is for state, quick actions and small forms.
|
|
181
|
+
|
|
182
|
+
### Examples:
|
|
183
|
+
|
|
184
|
+
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.
|
|
185
|
+
|
|
186
|
+
<a2ui>
|
|
187
|
+
surface("example")
|
|
188
|
+
$/runs = [{title: "Deploy staging", subtitle: "waiting on your approval", tone: "needs"}, {title: "Build 412", subtitle: "main, 2 minutes ago", trailing: "Passed", tone: "ok", url: "https://ci.example.com/runs/412"}, {title: "Lint", trailing: "3 warnings", tone: "warn"}]
|
|
189
|
+
root = Card("Release checks", [root_children_0, root_children_1])
|
|
190
|
+
root_children_0 = List($/runs, 5)
|
|
191
|
+
root_children_1 = Stack("row", [root_children_1_children_0, root_children_1_children_1])
|
|
192
|
+
root_children_1_children_0 = Button("Approve", Event("approve"), "primary")
|
|
193
|
+
root_children_1_children_1 = Button("Hold", Event("hold"))
|
|
194
|
+
</a2ui>
|
|
195
|
+
|
|
196
|
+
Numbers and progress: two headline numbers side by side, then one bar against a goal.
|
|
197
|
+
|
|
198
|
+
<a2ui>
|
|
199
|
+
surface("example")
|
|
200
|
+
$/shipped = 31
|
|
201
|
+
$/target = 50
|
|
202
|
+
root = Card("Orders this week", [root_children_0, root_children_1])
|
|
203
|
+
root_children_0 = Grid(2, [root_children_0_children_0, root_children_0_children_1])
|
|
204
|
+
root_children_0_children_0 = Metric("Shipped", "31")
|
|
205
|
+
root_children_0_children_1 = Metric("Late", "4", "was 1")
|
|
206
|
+
root_children_1 = Progress("Shipped", $/shipped, $/target, "8 packing")
|
|
207
|
+
</a2ui>
|
|
208
|
+
|
|
209
|
+
Small form: inputs bound to the data model; the Button sends their values back with the event.
|
|
210
|
+
|
|
211
|
+
<a2ui>
|
|
212
|
+
surface("example")
|
|
213
|
+
$/dry = true
|
|
214
|
+
$/env = "staging"
|
|
215
|
+
$/note = ""
|
|
216
|
+
root = Card("Deploy", [root_children_0, root_children_1, root_children_2, root_children_3])
|
|
217
|
+
root_children_0 = Select("Environment", "/env", [{key: "staging", label: "Staging"}, {key: "prod", label: "Production"}])
|
|
218
|
+
root_children_1 = Toggle("Dry run", "/dry")
|
|
219
|
+
root_children_2 = TextField("Note", "/note", _, true)
|
|
220
|
+
root_children_3 = Button("Deploy", Event("deploy", {env: $/env, dry: $/dry, note: $/note}), "primary")
|
|
221
|
+
</a2ui>
|
package/docs/AGENT.md
CHANGED
|
@@ -87,6 +87,39 @@ links, or submit. Collaborators retain owner-authorized edit/comment/final-submi
|
|
|
87
87
|
permission. Active links keep the same token across a same-port
|
|
88
88
|
`rly reopen`/`rly rescue` until revoked.
|
|
89
89
|
|
|
90
|
+
## A private URL for other devices
|
|
91
|
+
|
|
92
|
+
A board listens on this machine. To open it from a phone or another computer
|
|
93
|
+
without Wi-Fi sharing, give it a link setting. `rly ask`, `rly show`, `rly view`
|
|
94
|
+
and `rly diff` accept:
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
rly ask --file spec.json --detach --devlink # publish through devlink
|
|
98
|
+
rly ask --file spec.json --detach --public-url 'https://boards.example.com:{port}'
|
|
99
|
+
rly config link devlink # make it the default (also: auto, off, or a URL)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
- `--devlink` runs `devlink --json internal PORT`, requires a private https URL
|
|
103
|
+
back, and prints it as the board `url` (with a collaborator token). It stops
|
|
104
|
+
with an error if `devlink` is missing or fails. Relay finds it through
|
|
105
|
+
`RLY_DEVLINK_BIN`, then `PATH`, then `~/.local/bin/devlink`.
|
|
106
|
+
- `auto` does the same when `devlink` is installed and keeps the board local when
|
|
107
|
+
it is not. `off` (the default) never publishes.
|
|
108
|
+
- `--public-url` takes any https URL that reaches the board's port, such as a
|
|
109
|
+
reverse proxy or tunnel you run. `{port}` becomes the board port. Loopback
|
|
110
|
+
hosts are refused. `RLY_PUBLIC_URL` and `RLY_LINK` set the same from the
|
|
111
|
+
environment; `--no-devlink` turns it off for one run.
|
|
112
|
+
- Precedence: `--no-devlink`, `--devlink`, `--public-url`, `RLY_PUBLIC_URL`,
|
|
113
|
+
`RLY_LINK`, `rly config link`, then off.
|
|
114
|
+
- Answers return as usual: `rly wait <id>` and `rly result <id>`.
|
|
115
|
+
- When the board closes, Relay removes the devlink route again.
|
|
116
|
+
|
|
117
|
+
Report the printed URL to the user and never a `localhost`, `127.0.0.1` or
|
|
118
|
+
`0.0.0.0` address. A published board is reachable by whoever can reach the
|
|
119
|
+
link, and devlink's gateway makes every request look local to the board, so the
|
|
120
|
+
token in the URL and the network behind the link (Tailscale for devlink) are the
|
|
121
|
+
access control. Use `rly share <id> --revoke --all` to cut access.
|
|
122
|
+
|
|
90
123
|
## Inline mode — relay as an MCP App (Claude & Codex apps)
|
|
91
124
|
|
|
92
125
|
Everything above is the **CLI** surface (you run `rly` in a terminal and read
|
|
@@ -543,6 +576,7 @@ the question-types section above.
|
|
|
543
576
|
| `kpi` | big-number metric cards (`items:[{label,value,delta?,dir?,sub?}]`) with up/down/flat-tinted deltas — at-a-glance numbers without a chart |
|
|
544
577
|
| `typography` | type specimens (`specimens:[{label?,size?,weight?,font?,text?}]`) — react to type choices like a palette |
|
|
545
578
|
| `compare` | before/after images with a draggable divider (`before`/`after` = url/path/`{src,label}`); area comments preserve which side was selected |
|
|
579
|
+
| `a2ui` | a small live widget: status list, numbers, progress, quick-action buttons, a short form. Written in A2UI Express; the clicks and input values come back in `result.blockEdits[blockId]`. Full grammar and examples: `rly a2ui` (docs/A2UI.md) |
|
|
546
580
|
| `html` | anything else — pixel-perfect mockups, custom widgets, embeds |
|
|
547
581
|
|
|
548
582
|
Two cross-block fields work on **any** block: `"ref":"name"` makes it openable in
|