feat(agent-chat): serve artifacts in the shared CEF page host

Merged
TE
8d ago
+164-0

The default cmux NEXT agent tab uses the shared CEF cmux-page://cmux.agent/ host. This prerequisite adds the artifact document route cmux-page://cmux.agent/__artifact with the same one-shot render protocol as the native artifact endpoint, an opaque sandbox policy (default-src 'none', inline styles/scripts only, data/blob media), and refusal of artifact/srcdoc subframe, refresh and resource escapes.

Leo: "the /side thing i heard somebody really liked in codex... and i think html/html artifacts and that kinda good viewing and good support for it would be cool" / "like the claude.ai artifacts but imagien you didnt need to only have it on claude.ai...".

The CEF-only change is intentionally separate from the web capability/URL seam: the agent page descriptor must allow this exact frame source, and the web Run path will select /__artifact only on cmux-page://cmux.agent/; passive previews remain sandbox="" srcdoc. It does not alter ordinary page files, Chief, or performance behavior.

Red first / static evidence

  • Test-first commit: b71fd15fede.
  • Fix head: a47a65d01ca5b1a4e8168c520164ec37d15988d4; tree ce42ffd5aa6736d8f723dfb0acfed05cd3fc2fa6.
  • Static verify-local checks, JavaScript syntax and diff check pass. Native C++ execution, CEF build and browser probe are pending on the managed fleet; the hosted recipe runs scripts/cmux-next/test-cmux-page-path-cpp.sh on both commits, then probes first load, refresh/self-navigation, nested frames, network/file access and bridge refusal.

Agent session: agent session

Astra xhigh SHIP at exact head a47a65d01ca5b1a4e8168c520164ec37d15988d4: exact bare artifact factory, opaque CSP, ancestor/resource denial and ordinary page preservation reviewed with no static findings. Native CEF build/browser/C++ execution and the web descriptor seam remain hosted integration evidence.

Performance

No perf numbers: this adds a CEF page route for artifact documents and changes no hot path; nothing here is a performance change.