Repository navigation
feat(hub): production agent docs, changelog channel & richer hub rendering - #1839
Conversation
…endering Before: the hub rendered agent README markdown through a renderer that emitted dead `gaia-*` Tailwind classes (the theme only defines `g-*`), so docs read poorly and leaked white headings into the light theme; there was no changelog on the hub; the email agent shipped two drifting READMEs and a broken `pip install` tab (it is not on PyPI). After: one canonical, integration-focused README plus a SPEC + SKILL, a changelog channel end to end, and a Mintlify-style prose theme. - Hub Worker: optional `changelog` part on /publish, stored per-version and carried into index.json (storage/publish/catalog/types/schema + tests). - Website: Mintlify-style `.doc` prose theme (renderer now emits classless semantic HTML); Changelog section; npm-only install for npm-distributed agents; hide placeholder-zero requirement rows; standalone-diagram lightbox. - Email docs: consolidate to one README (leads with what the agent does, focuses on the integration interface + troubleshooting), add SPEC.md (full reference) and SKILL.md (Claude Code integration playbook), shipped in the npm tarball. Delete the redundant python README + its dead pyproject readme field and stamp rule. - Authoring: `gaia agent init` scaffolds CHANGELOG.md; `--lint` warns when README/CHANGELOG is missing; `gaia agent publish` attaches CHANGELOG.
Critique pass for a team integrating the package into a production web app: - README: add a 'Running in production' section (spawn once at boot, fetchBinary as a build step, single-Lemonade-slot concurrency, port conflicts, no auto-restart, SIGTERM->shutdown) and an errors-and-retries table keyed on status. - Fix the renderer story: the sidecar serves same-origin/no-CORS, so a renderer can't call it cross-origin — document the Electron main-process/IPC proxy pattern in README/SPEC/SKILL instead of a direct fetch. - State 'send' returns 503 on a headless server (no mailbox connector); qualify the privacy claim (triage/draft stay on-device, send transmits to the provider); tie the 8 GB requirement to the local model. - Strip stale internal refs (#1648/#1262/'spike'/'pending R2') from shipped source comments and user-facing error/CLI strings — R2 is wired, so they were wrong too. npm build clean, 32 tests pass.
Round-3 critique caught a real defect: the README said send 'takes no token', which contradicted its own interface table and the source. send requires the single-use confirmation token from draft — a missing/invalid token is rejected with 403 *before* the mailbox checks (api_routes.py: "an invalid or missing confirmation token raises a 403"). Document the full ladder (403 → 503 → 400) consistently across README, SPEC, and SKILL.
- Tabbed doc area on the agent page: switch between the rendered README and Changelog (replaces the always-on bottom changelog section). - Syntax highlighting: the markdown renderer emits a sanitized `language-*` class per fenced block, highlighted client-side with Prism (ts/js/bash/json) under a token theme tuned for the dark code card.
The website already reads npm_package (npm-only install) and playground_url (the playground launcher) from the catalog, but the Worker never emitted them — so they only worked against an injected catalog. Parse both optional manifest fields and carry them into index.json (manifest/types/catalog/schemas + tests), and declare them on the email agent's manifest. Now a real publish lights up the npm install method and the in-README playground link on the live hub. Worker: 60 tests pass, tsc clean.
Review —
|
…size Round-5 fresh-lens critiques (copy-paste/compile + cross-doc consistency) came back clean except two facts: the README 'last updated' stamp was a day in the future (2026-06-24 → 2026-06-23), and '~31 MB' understated the Windows binary (published artifacts are 32-43 MB) — now a per-platform range.
…e sidecar)
Empirical round — booted the real sidecar (v0.2.1) and exercised every documented
endpoint. Most claims held (GET routes 200, triage returns result.category/summary,
missing/invalid send token -> 403, valid token + no mailbox -> 503), but two real
gaps surfaced that six reading-only rounds missed:
- 'to' (and triage's from/principal) are address OBJECTS { email, name? }, not
strings — the prior 'wraps your (to, subject, body)' wording 422s if you pass a
string. Documented the shape + a verified draft->send round-trip in SPEC, and
corrected the README/SKILL.
- SKILL's '`send` has no token parameter' contradicted its own table and the 403
gate; rewritten to distinguish the required confirmation_token (403) from OAuth
(none — host-resolved, 503 when no mailbox).
The added draft->send example was run against the sidecar: draft 200 -> send with
the token reaches 503 (not 403), confirming the token round-trip.
The empirical round hardened the request side but left the response side vague — the docs showed only result.category/summary, yet triage is the primary surface and an integrator routes on the full result. Added a 'Triage response shape' table to SPEC documenting EmailTriageResult per types.ts: the exact uppercase category enum (URGENT/NEEDS_RESPONSE/FYI/PROMOTIONAL/PERSONAL), is_spam/is_phishing, action_items, suggested_action (reply/none/archive), draft, and usage.
…aragraph) Found by rendering the README through the hub's own markdown renderer (not GitHub's): the renderer only supported '-'/'*' bullets, so the README's numbered Prerequisites (1. … 2. …) collapsed into a single <p> with literal '1.'/'2.' text on the hub page. Add <ol> support (mirrors the <ul> lazy-continuation logic; switching marker type starts a new list) so numbered steps in any agent README render correctly. The .doc ol theme was already in place. +2 renderer tests.
Second hub-rendering gap from the same angle: the renderer only handled **bold**, so the README's *italic* (e.g. *Settings → Connectors*) showed literal asterisks on the hub. Add *...* -> <em> after the bold pass (so **x** is already consumed); underscores are deliberately left alone so identifiers like suggested_action survive. +1 test.
…e dead) Third hub-rendering gap from the same angle: the README links to [...](#browser--electron-renderer), but the renderer emitted headings with no id, so that anchor went nowhere on the hub (works on GitHub, which auto-slugs). Add a slug per heading matching GitHub's algorithm — drop markers, lowercase, strip to [a-z0-9 -], replace each space with a hyphen (so 'Browser / Electron renderer' -> 'browser--electron-renderer', double hyphen). +1 test.
|
🟡 The new README/Changelog tab widget is missing the ARIA wiring that associates tabs with their panels. Screen readers announcing 🔍 Technical detailsFile: Minimum fix — add ids and <button type="button" role="tab"
id="tab-readme" aria-controls="panel-readme"
data-doc-tab="readme" aria-selected="true" class="doc-tab">README</button>
<button type="button" role="tab"
id="tab-changelog" aria-controls="panel-changelog"
data-doc-tab="changelog" aria-selected="false" class="doc-tab">Changelog</button><article role="tabpanel" id="panel-readme"
aria-labelledby="tab-readme" data-doc-panel="readme" class="doc max-w-[70ch]"><article role="tabpanel" id="panel-changelog"
aria-labelledby="tab-changelog" data-doc-panel="changelog" class="doc max-w-[70ch]" hidden>Arrow-key navigation (add inside the tab tabRoot.addEventListener('keydown', (e) => {
const i = tabs.indexOf(document.activeElement as HTMLButtonElement);
if (i === -1) return;
if (e.key === 'ArrowRight') { tabs[(i + 1) % tabs.length].focus(); e.preventDefault(); }
if (e.key === 'ArrowLeft') { tabs[(i - 1 + tabs.length) % tabs.length].focus(); e.preventDefault(); }
});These two changes bring the widget up to WCAG 2.1 AA / WAI-ARIA 1.2. |
CRITICAL, found by rendering the actual page in a browser (not just inspecting HTML): the renderer parked code spans as the placeholder ' <index> ' (a space-wrapped number), then restored with / (\d+) /g — which ALSO matched literal numbers in prose. So '`HttpError` 502' rendered as 'HttpError undefined' (502 -> codeSpans[502]), '`HttpError` 0' duplicated the code span, and 'Memory: 8 GB' became 'undefinedGB'. The email README's entire Errors-&-retries table (the 502/403/503/400 codes an integrator relies on) and the RAM requirement were corrupted on the hub. Fix: park code spans behind control-char sentinels (\u0000 … \u0001) that can't occur in prose. +1 regression test; verified in-browser.
Found by an accessibility/keyboard audit (comparing against the hub's own InstallMethods tabs, which are ARIA-correct): the README/Changelog doc tabs I added were missing tab id/aria-controls, panel id/aria-labelledby, roving tabindex, and ArrowLeft/Right navigation — a regression vs the established pattern (a screen-reader/keyboard user couldn't navigate them properly). Wire them to the same WAI-ARIA tablist standard; verified in-browser (ArrowRight moves selection + focus, panels announce their tab name).
…solute) Found by checking where the links actually resolve in the live hub page: the README's [SPEC.md]/[SKILL.md]/[CHANGELOG.md] used relative paths (./SPEC.md), which work as sibling files on GitHub/npm but on the hub resolve to /hub/SPEC.md — a 404, since the hub renders only the README (not those files). A developer clicking them on hub.amd-gaia.ai/hub/email hit dead links. Point them at absolute GitHub URLs (same main convention the architecture image uses) so they resolve on the hub, GitHub, and npm alike. (Also verified the architecture diagram loads: 200.)
|
🟡 The README article gets The tablist block is guarded by {changelogHtml && (
<div role="tablist" ...> {/* tab buttons — conditional */}
<button id="doctab-readme" ...>README</button>
...
</div>
)}
<article role="tabpanel" aria-labelledby="doctab-readme" ...> {/* ← always present */}Fix: strip <article
{...(changelogHtml ? { role: 'tabpanel', id: 'docpanel-readme', 'aria-labelledby': 'doctab-readme' } : {})}
data-doc-panel="readme"
class="doc max-w-[70ch]"
>🔍 Technical details
The |
…iew) Addresses the reviewer's remaining a11y note on the image lightbox: it's role=dialog but didn't manage focus. Now aria-modal, focusable, and on open it moves focus into the dialog + remembers the trigger; Escape/click closes and restores focus to the image that opened it; Tab is trapped (the dialog has no other focusable children). The zoomable diagrams are also made keyboard-operable (tabindex=0, role=button, Enter/Space) since they're interactive.
|
Thanks — all review points addressed (the blocker and both a11y notes):
All website tests pass and |
…card (amd#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 amd#1839). - **Docs synced** (README/SPEC/SKILL/CHANGELOG) per the doc-sync rule (amd#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
Why this matters
The Agent Hub rendered README markdown through a renderer that emitted dead
gaia-*Tailwind classes (the theme only definesg-*), so docs read poorly and leaked white headings into the light theme; there was no changelog on the hub; and the email agent shipped two drifting READMEs plus a brokenpip installtab (it isn't on PyPI). This makes the hub presentable for handing a packaged agent to an external integration team: one canonical, production-grade README, a real changelog channel, npm-aware install, and a Mintlify-style reading experience.What's in it
.docprose theme owns presentation (ruled h2, dark code cards, bordered tables,<hr>). Adds Prism syntax highlighting, a standalone-diagram lightbox, and README/Changelog doc tabs./publishaccepts an optionalchangelogpart → stored per-version → intoindex.json→ rendered in the Changelog tab.gaia agent initnow scaffoldsCHANGELOG.md;--lintwarns when README/CHANGELOG is missing;gaia agent publishattaches it.npm_package+playground_urlthread through the Worker into the catalog. The email page now shows npm-only install (the broken pip/Source tabs are gone), an in-README playground launcher, and hides placeholder-zero requirement rows (e.g. "Disk 0 GB").SPEC.md(full reference) andSKILL.md(Claude Code integration playbook), shipped in the npm tarball. Four adversarial critique rounds hardened it — CORS/renderer, server concurrency & lifecycle, errors→retries, headlesssend403/503; deleted the redundant python README.Test plan
cd workers/agent-hub && npm test(60 pass) +npx tsc --noEmitcd website && npx vitest run(14) +npx astro check(0 errors) +HUB_CATALOG_URL=https://hub.amd-gaia.ai npm run buildcd hub/agents/npm/agent-email && npm run build && npm test(32)pytest tests/unit/test_cli_agent.py tests/unit/test_hub_publisher.py hub/agents/python/email/tests/test_stamp_version.py/hub/email: npm install tab, README/Changelog tabs, highlighted code, click-to-zoom diagram, no placeholder requirement rows