Artifacts / Canvas
Navin can present concrete results beside the chat: HTML previews, Markdown,
Mermaid diagrams, and files. Artifacts persist locally under
~/.navin/artifacts/<chat_id>/.
How artifacts appear
- The agent calls the
present_artifacttool, or - The gateway auto-detects fenced blocks (
html` /mermaid`) in an assistant reply on the WebSocket channel.
The WebUI opens a resizable Artifact canvas next to the thread
(ArtifactCanvas). HTML renders in a sandboxed iframe.
WebSocket events
| Event | Direction | Role |
|---|---|---|
artifact_upsert | server → client | Create or update an artifact record |
artifact_select | server → client | Focus an artifact in the panel |
Types: html, markdown, mermaid, file (and related preview kinds).
Code map
| Area | Path |
|---|---|
| Store | navin/artifacts/store.py |
| Fence detect | navin/artifacts/detect.py |
| Agent tool | navin/agent/tools/present_artifact.py |
| UI panel | webui/src/components/thread/ArtifactCanvas.tsx |
| Tests | tests/test_artifacts.py |
Related
- Image generation media (chat media, not the artifact canvas): Image generation
- Mobile PWA can view artifacts read-only: Mobile usage PWA