Live picker: derive the command vocabulary from one canonical source

The verbs/labels/icons were copied three ways: live-browser.js (ICONS + ACTIONS),
VISUAL_ACTIONS in live-event-validation.mjs, and the marketing demo. Collapse
them to one source, skill/scripts/live-vocabulary.mjs (LIVE_COMMANDS + derived
VISUAL_ACTIONS).

- live-event-validation.mjs imports VISUAL_ACTIONS from it.
- live-server.mjs serializes LIVE_COMMANDS into window.__IMPECCABLE_VOCAB__ when
  it serves /live.js, next to the token/port. live-browser.js (served raw, can't
  import at runtime) builds its ICONS + ACTIONS from that injected vocab instead
  of an inline copy — byte-identical icons, zero behaviour change.
- site/components/LiveDemoPalette.astro imports the same module at build time, so
  the demo and the real picker can no longer drift.

Adds a /live.js test asserting the injected vocab deep-equals the canonical list.
Harness skill dirs refreshed via build. (Pre-existing, unrelated: `bun run
build:site` fails on an htmlparser2 import in the CLI detector.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Paul Bakaus
2026-06-05 14:05:41 -07:00
co-authored by Claude Opus 4.8
parent 1f975a69e4
commit 5fb30e03e6
58 changed files with 817 additions and 541 deletions
+11
View File
@@ -158,6 +158,17 @@ describe('live-server integration', () => {
assert.equal(data.connectedClients, 0);
});
it('/live.js injects the canonical command vocabulary', async () => {
// live-browser.js builds its action picker from window.__IMPECCABLE_VOCAB__
// rather than an inline copy, so the server must serialize the canonical
// vocabulary into /live.js (next to the token/port).
const { LIVE_COMMANDS } = await import('../skill/scripts/live-vocabulary.mjs');
const body = await (await fetch(`http://localhost:${server.port}/live.js`)).text();
assert.match(body, /window\.__IMPECCABLE_VOCAB__\s*=/);
const injected = JSON.parse(body.match(/window\.__IMPECCABLE_VOCAB__\s*=\s*(\[.*?\]);/s)[1]);
assert.deepEqual(injected, LIVE_COMMANDS);
});
it('/status returns durable recovery state', async () => {
await drainPolls(server);
const eventRes = await fetch(`http://localhost:${server.port}/events`, {