ADR-0007: The viewer writes a self-contained HTML file; live mode adds a local server¶
- Status: Accepted
- Date: 2026-12-01
Context¶
v0.4 adds a viewer for run logs (SPEC-012). The two usual designs are a local web server that reads logs on request, or a generator that writes a static page with the log inside.
Decision¶
- By default,
agentplaykit viewwrites one self-contained HTML file per run (data, script and styles inline) and opens it in the default browser. There is no server. - To watch a run while it plays,
--livestarts a temporary server on the user's machine that serves the same page and streams new log events to it. A browser cannot follow a growing file from afile://page, so live viewing needs this server; it is opt-in, local only and read-only, and it stops when the run ends (VWR-024, VWR-025).
Consequences¶
- By default nothing listens on a port, so there is no local-server attack surface, no port conflicts and nothing to stop afterwards.
- A page can be shared as one file (attached to an issue, emailed, published with the docs) and opens offline, years later, without AgentPlay installed.
- Log content is untrusted model output, so the page must treat it strictly as text and block network loads (VWR-006, VWR-007).
- A very large log makes a large page; v0.4 targets 10,000 events (VWR-018).
- Live mode brings a small server back, but only on request: bound to 127.0.0.1, behind a random
token and a
Hostcheck (against other web pages and DNS rebinding), answering only GET requests for one run, and gone when the run ends. - Both modes share one page, so everything the replay shows also works live.