You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(agent-email): one-command playground launcher + live hub launch card (#1846)
## Why this matters
Trying the email agent meant a multi-step dance — fetch the binary,
spawn the sidecar, find the localhost URL, open it. This makes it **one
command** (`npx @amd-gaia/agent-email playground`) and surfaces it on
the hub agent page with a copy-the-command card whose **Open
playground** button goes live the moment the local sidecar is reachable.
A static web page **can't start a local process**, so this is the
meet-in-the-middle: a one-command launcher in the CLI + a smart button
on the page that detects when the sidecar is up.
## What's in it
- **npm CLI** — new `playground` command: `fetchBinary` → `startSidecar`
→ open the default browser to `/v1/email/playground` → run until Ctrl+C
(auto-reaped on exit). Flags: `--port` (default 8131), `--out` (binary
cache dir), `--no-open`.
- **Hub agent page** — a Playground card: the one-liner with a copy
button, plus an **Open playground** button gated by a **live liveness
probe** of the local sidecar (a `no-cors` fetch resolves if it's up,
rejects if not; `127.0.0.1` is a trustworthy origin so the HTTPS hub may
probe/link it). Shown only for npm agents that declare a
`playground_url` (from #1839).
- **Docs synced** (README/SPEC/SKILL/CHANGELOG) per the doc-sync rule
(#1842).
## Test plan
- [ ] npm: `cd hub/agents/npm/agent-email && npm run build && npm test`
(36); `node dist/cli.js help` lists `playground`
- [ ] Website: `cd website && npx astro check` (0 errors) + `npx vitest
run` (19) + build
- [ ] Hub agent page: Playground card shows the command (copy works) +
an Open button that activates only once the local sidecar responds
- [ ] End-to-end (needs the published binary): `npx
@amd-gaia/agent-email playground` fetches, starts the sidecar, and opens
the playground
Copy file name to clipboardExpand all lines: hub/agents/npm/agent-email/SPEC.md
+15-7Lines changed: 15 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,19 +122,27 @@ control, the steps are exported individually:
122
122
-`verifySha256(buf, expected, label)` → throws `IntegrityError` on mismatch.
123
123
-`shutdown(sidecar)` → kill the **whole process tree** (`taskkill /F /T` on Windows; detached process-group kill on POSIX). The default auto-reaper does the same on process exit/crash/signal, so only a hard `SIGKILL` of the host can still orphan the child.
124
124
125
-
## The `fetch` CLI
126
-
127
-
`fetch` is the supported, build-time path. It resolves
128
-
`${process.platform}-${process.arch}`, downloads that platform's artifact from the
129
-
base URL in `binaries.lock.json`, **verifies its SHA-256 against the lock and fails
130
-
loudly on any mismatch**, writes it to `--out`, and `chmod +x`'s it on POSIX.
125
+
## CLI
131
126
132
127
```bash
128
+
npx @amd-gaia/agent-email playground # fetch + run the sidecar, open the playground
133
129
npx @amd-gaia/agent-email fetch --out resources
134
-
npx @amd-gaia/agent-email version # show manifest + current platform
130
+
npx @amd-gaia/agent-email version # show manifest + current platform
135
131
npx @amd-gaia/agent-email help
136
132
```
137
133
134
+
`playground` is the zero-to-running shortcut: it `fetchBinary`s into a temp cache
135
+
(`--out` to override), `startSidecar`s on `--port` (default 8131), opens the default
136
+
browser to `/v1/email/playground` (`--no-open` to skip), and runs until Ctrl+C.
137
+
The command owns the sidecar lifecycle itself (`autoCleanup: false`) and shuts it
138
+
down on `SIGINT`/`SIGTERM`/`SIGHUP` or on any startup error. Lemonade still has to
139
+
be running for live triage — the page itself reports if it isn't.
140
+
141
+
`fetch` is the supported, build-time path. It resolves
142
+
`${process.platform}-${process.arch}`, downloads that platform's artifact from the
143
+
base URL in `binaries.lock.json`, **verifies its SHA-256 against the lock and fails
144
+
loudly on any mismatch**, writes it to `--out`, and `chmod +x`'s it on POSIX.
145
+
138
146
| Flag | Meaning |
139
147
|------|---------|
140
148
|`--out <dir>`| Resources dir to write the verified binary into (**required**) |
0 commit comments