Vela live render (offline, in-container)
Routing: the vela-drive.js commands here are code-based scripts for
repeatable, committed automation only (CI UI battery, recorded demo videos,
benchmark screenshots). If you're doing a one-off / interactive task —
exploring the app, reproducing a bug, a quick screenshot, verifying a UX change —
stop and use the playwright-cli-setup skill instead: a persistent browser you
drive one command at a time, inspecting state between steps. Same offline render,
better fit for exploration.
The container blocks the React/lucide CDNs (esm.sh) and the Playwright browser CDN.
serve.py's default HTML uses an esm.sh importmap and therefore never boots here.
Do NOT waste time trying to reach esm.sh, run npx playwright install, or debug
serve.py's CDN path. Use the offline harness below — it reuses the Neutralino
desktop shell's proven recipe: vendored UMD React/ReactDOM/lucide-react + Babel,
transpiled in Node, loaded as an EXTERNAL <script>.
One-time environment facts (already true in this container)
- Prebuilt Chromium:
/opt/pw-browsers/chromium-1194/chrome-linux/chrome
(the npm playwright expects a newer build → executablePath must be pinned;
vela-drive.js already does this).
- ffmpeg (for webm→mp4/gif if needed):
/opt/pw-browsers/ffmpeg-1011/ffmpeg-linux
- Vendored UMD libs:
vela-neutralino/resources/vendor/{react,react-dom,lucide-react,babel}.min.js
- The two Node security suites need
jsdom: npm i jsdom (once).
serve.py needs --no-auth and, if binding a port in a Bash tool, the sandbox
may SIGKILL listeners (exit 144) → prefer the file:// harness below, which needs
no server at all.
Quick start
# 1. Build the monolith (only after editing part-files)
python3 tools/vela-dev/scripts/concat.py
# 2. Build an offline render of a deck (STARTUP_PATCH-injected, transpiled)
node tools/vela-dev/scripts/render-offline.js examples/vela-demo.vela /tmp/vout
# 3a. Boot-check + screenshot (great for eyeballing a change)
node tools/vela-dev/scripts/vela-drive.js shot /tmp/vout/render.html /tmp/shot.png --w 1280 --h 800
# add: --eval "window.dispatchEvent(new KeyboardEvent('keydown',{key:'ArrowRight'}))" --wait 500
# 3b. Run the in-app UI-test battery headless (needs the window.__velaRunUITests hook,
# see part-uitest.jsx). Exits non-zero on any failure; --json dumps results.
node tools/vela-dev/scripts/vela-drive.js uitests /tmp/vout/render.html --json /tmp/ui.json
# 3c. Record a demo video (webm). scenario.js: module.exports = async (page, h) => {...}
# helpers h = { key, click, type, wait, shot, caption, clearCaption, page }
node tools/vela-dev/scripts/vela-drive.js video /tmp/vout/render.html /tmp/vid --script scenario.js
# 3d. Test AI integration against the local `claude` CLI (real round-trips).
# One command: starts the tool-sandboxed channel backend (agent_backend.py)
# on a free loopback port, builds an agent-mode render, boots it, and runs
# the real Vera engine helpers (callClaudeAPI, callVera, generateSlide),
# asserting deck mutations. Each probe is a paid claude call — dev/QA only.
node tools/vela-dev/scripts/vela-drive.js ai examples/vela-demo.vela --json /tmp/ai.json
# limit which probes run: --only ping,veraAddSlide
AI integration testing (mode: ai)
The ai mode is how you verify Vera/AI features actually work in this
container. It wires the app's local-mode channel (VELA_CHANNEL_PORT) to
agent_backend.py, which spawns claude -p locked down to a pure text
completion (--tools "" --strict-mcp-config --setting-sources "" — no tools,
no MCP, no hooks; same contract as the Neutralino gatekeeper, enforced by a
parity test). To add a feature check, add a probe to AI_PROBES in
vela-drive.js (call the real engine global and assert the result). To wire
AI into any other harness mode, build with render-offline.js … --channel-port <port> while a channel is running.
AI is opt-in / OFF by default. The channel spawns the user's claude (their
credentials/spend), so it never starts implicitly. Enable it deliberately:
vela-drive.js ai (dev/testing), render-offline.js … --channel-port N, or, for
a real served session, python3 tools/vela-dev/scripts/serve.py <folder> --ai. The channel is
loopback-only, Host/Origin-checked, token-gated, and caps concurrent spawns.
Gotchas already solved (don't rediscover)
- Never inline the 1.3MB monolith as
<script type="text/babel"> — it contains
literal </script> inside XSS-test string payloads, which truncates the block
("Unterminated string constant"). render-offline.js transpiles in Node and
loads an external app.js instead.
- Strip the three ESM
import lines (react/lucide) and export default function →
UMD-global shim; inject the deck via the const STARTUP_PATCH = null; sentinel
(identical to assemble.py).
ERR_INVALID_URL / ERR_CONNECTION_CLOSED console errors are just Google-Fonts /
external asset fetches — harmless, the app renders fully without them.
Headless UI-test hook
part-uitest.jsx exposes window.__velaRunUITests() → resolves to the results
array and also sets window.__velaUITestResults. vela-drive.js uitests uses it.
Add new UI suites via uiSuite("Name", [{ name, fn: async () => {...} }]).
1---2name: vela-live-render3description: Offline in-container render harness for the FULL Vela app (no CDN) plus the committed `vela-drive.js` scripts — headless UI-test battery, scripted screenshot, recorded demo video, and an opt-in AI mode. Use for REPEATABLE, COMMITTED automation where the harness itself is the deliverable — running the UI battery in CI, recording a demo video, a scripted screenshot in a benchmark, or verifying real Vera/AI features against the local `claude` CLI via `vela-drive.js ai`. For AD-HOC / INTERACTIVE work — explore/test the app, poke a state, reproduce a bug, a one-off screenshot, verify a UX change, drive presenter/gallery — use the `playwright-cli-setup` skill instead (a persistent CLI browser driven step by step). This skill still documents the blocked-CDN offline render recipe that both skills share.4---56# Vela live render (offline, in-container)78> **Routing:** the `vela-drive.js` commands here are **code-based scripts for9> repeatable, committed automation only** (CI UI battery, recorded demo videos,10> benchmark screenshots). If you're doing a **one-off / interactive** task —11> exploring the app, reproducing a bug, a quick screenshot, verifying a UX change —12> stop and use the **`playwright-cli-setup`** skill instead: a persistent browser you13> drive one command at a time, inspecting state between steps. Same offline render,14> better fit for exploration.1516The container **blocks the React/lucide CDNs (esm.sh) and the Playwright browser CDN**.17`serve.py`'s default HTML uses an esm.sh importmap and therefore **never boots here**.18Do NOT waste time trying to reach esm.sh, run `npx playwright install`, or debug19`serve.py`'s CDN path. Use the offline harness below — it reuses the Neutralino20desktop shell's proven recipe: **vendored UMD React/ReactDOM/lucide-react + Babel,21transpiled in Node, loaded as an EXTERNAL `<script>`.**2223## One-time environment facts (already true in this container)24- Prebuilt Chromium: `/opt/pw-browsers/chromium-1194/chrome-linux/chrome`25 (the npm `playwright` expects a newer build → `executablePath` must be pinned;26 `vela-drive.js` already does this).27- ffmpeg (for webm→mp4/gif if needed): `/opt/pw-browsers/ffmpeg-1011/ffmpeg-linux`28- Vendored UMD libs: `vela-neutralino/resources/vendor/{react,react-dom,lucide-react,babel}.min.js`29- The two Node security suites need `jsdom`: `npm i jsdom` (once).30- `serve.py` needs `--no-auth` and, if binding a port in a Bash tool, the sandbox31 may SIGKILL listeners (exit 144) → prefer the file:// harness below, which needs32 no server at all.3334## Quick start35```bash36# 1. Build the monolith (only after editing part-files)37python3 tools/vela-dev/scripts/concat.py3839# 2. Build an offline render of a deck (STARTUP_PATCH-injected, transpiled)40node tools/vela-dev/scripts/render-offline.js examples/vela-demo.vela /tmp/vout4142# 3a. Boot-check + screenshot (great for eyeballing a change)43node tools/vela-dev/scripts/vela-drive.js shot /tmp/vout/render.html /tmp/shot.png --w 1280 --h 80044# add: --eval "window.dispatchEvent(new KeyboardEvent('keydown',{key:'ArrowRight'}))" --wait 5004546# 3b. Run the in-app UI-test battery headless (needs the window.__velaRunUITests hook,47# see part-uitest.jsx). Exits non-zero on any failure; --json dumps results.48node tools/vela-dev/scripts/vela-drive.js uitests /tmp/vout/render.html --json /tmp/ui.json4950# 3c. Record a demo video (webm). scenario.js: module.exports = async (page, h) => {...}51# helpers h = { key, click, type, wait, shot, caption, clearCaption, page }52node tools/vela-dev/scripts/vela-drive.js video /tmp/vout/render.html /tmp/vid --script scenario.js5354# 3d. Test AI integration against the local `claude` CLI (real round-trips).55# One command: starts the tool-sandboxed channel backend (agent_backend.py)56# on a free loopback port, builds an agent-mode render, boots it, and runs57# the real Vera engine helpers (callClaudeAPI, callVera, generateSlide),58# asserting deck mutations. Each probe is a paid claude call — dev/QA only.59node tools/vela-dev/scripts/vela-drive.js ai examples/vela-demo.vela --json /tmp/ai.json60# limit which probes run: --only ping,veraAddSlide61```6263## AI integration testing (mode: `ai`)64The `ai` mode is how you verify Vera/AI features actually work in this65container. It wires the app's local-mode channel (`VELA_CHANNEL_PORT`) to66`agent_backend.py`, which spawns `claude -p` locked down to a pure text67completion (`--tools "" --strict-mcp-config --setting-sources ""` — no tools,68no MCP, no hooks; same contract as the Neutralino gatekeeper, enforced by a69parity test). To add a feature check, add a probe to `AI_PROBES` in70`vela-drive.js` (call the real engine global and assert the result). To wire71AI into any other harness mode, build with `render-offline.js … --channel-port72<port>` while a channel is running.7374**AI is opt-in / OFF by default.** The channel spawns the user's `claude` (their75credentials/spend), so it never starts implicitly. Enable it deliberately:76`vela-drive.js ai` (dev/testing), `render-offline.js … --channel-port N`, or, for77a real served session, `python3 tools/vela-dev/scripts/serve.py <folder> --ai`. The channel is78loopback-only, Host/Origin-checked, token-gated, and caps concurrent spawns.7980## Gotchas already solved (don't rediscover)81- **Never inline the 1.3MB monolith as `<script type="text/babel">`** — it contains82 literal `</script>` inside XSS-test string payloads, which truncates the block83 ("Unterminated string constant"). `render-offline.js` transpiles in Node and84 loads an **external** `app.js` instead.85- Strip the three ESM `import` lines (react/lucide) and `export default function` →86 UMD-global shim; inject the deck via the `const STARTUP_PATCH = null;` sentinel87 (identical to `assemble.py`).88- `ERR_INVALID_URL` / `ERR_CONNECTION_CLOSED` console errors are just Google-Fonts /89 external asset fetches — **harmless**, the app renders fully without them.9091## Headless UI-test hook92`part-uitest.jsx` exposes `window.__velaRunUITests()` → resolves to the results93array and also sets `window.__velaUITestResults`. `vela-drive.js uitests` uses it.94Add new UI suites via `uiSuite("Name", [{ name, fn: async () => {...} }])`.