Module: previews
src/core/src/previews/ — the registry behind Live Preview: which local ports/files are being shared, under which slugs, with which lifetimes.
src/core/src/previews/ — the registry behind Live Preview: which local ports/files are being shared, under which slugs, with which lifetimes.
Responsibility
Track preview sessions (dev-server ports and rendered files), mint owner and share URLs, enforce the share TTL, and clean up preview-related processes. The HTTP serving side (reverse proxy, iframe toolbar, markdown rendering) lives in server's preview submodule.
Key types
| Type | File | Role |
|---|---|---|
Preview store / SESSIONS | store.rs | Slug → preview session; SHARE_TTL_SECS = 600 |
| Owner vs share semantics | store.rs | Owner URL lives with the preview; share URL expires 600 s after minting |
kill_by_session / shutdown_kill_all_ports | mod.rs | Kill dev-server processes tied to an agent session / all previewed ports at daemon stop |
Interactions
- ← server (MCP
preview/md_preview): agents create previews via tools; skills (va-preview,va-md-preview) wrap them. - ← server (
preview/handlers): resolve slugs, proxy requests, render markdown. - ← workspace: closing a thread kills previews bound to its session.
- ← cli / dashboard: list and delete.
Invariants — do not break
- Share URLs are the only unauthenticated surface — single slug, hard TTL. Never widen scope or lifetime without revisiting the security model.
- Preview processes are session-scoped: an agent session's dev servers die with
/closeand with the daemon — no orphanednpm run dev. - Owner links require the daemon token; share expiry must not affect the owner path.
Known debt
- None tracked in the remediation plan.
Source anchors: src/core/src/previews/ (mod, store), src/server/src/web_server/preview/ (proxy, iframe, markdown, cookie_proxy), src/server/src/web_server/mcp/tools.rs (preview tools).
Last verified: v0.7.11
Module: channels
src/core/src/channels/ — everything between "a message arrived from some surface" and "a thread runtime got a prompt", plus the reverse direction. Flows through it: IM message, web chat, permission.
Module: process
src/core/src/process/ — every subprocess the daemon owns goes through here: spawning, supervision, restart policy, watchdogs, and last resort cleanup. If it forks, this module is accountable for it dying properly.