What
Artifact preview lets Claude look at a page it built. It can now choose between two engines: local_chrome, the existing local headless browser, and a new emulator that downloads the real artifact viewer on first use and runs it without a window inside a cloud session. Two new per-session state fields, artifactPreviewEmulator and artifactPreviewEngine, hold the choice.
- The emulator is picked only when
CLAUDE_CODE_ARTIFACT_PREVIEWis not false,CLAUDE_CODE_REMOTEis true, a built-in switch in the code is on, and the emulator check passes. - The emulator check:
CLAUDE_CODE_ARTIFACT_PREVIEW_EMULATORset to false turns it off; missing or unreadable emulator files under/mnt/skills(examples/artifact-emulator), which must also pass ownership and permission checks, turn it off;CLAUDE_CODE_ARTIFACT_PREVIEW_EMULATORset to true turns it on; otherwise a server-side setting decides, defaulting to off. - When the emulator is in use, the tool tells the model "Look at a local page in the real artifact viewer inside this cloud session. Nothing is published.", drops the width and theme options, and describes
file_pathas "the page's .html file to look at in the artifact viewer."
In the code one finding examined, the built-in switch starts off and nothing seen turns it on, so the engine falls back to local_chrome; the whole program was not searched. A related check in the local preview path also stays false for the same reason.
Why
This prepares a way to preview artifacts in the real viewer during cloud sessions. For now, expect previews to keep using the local browser engine.