Skip to content

Artifacts: shared documents and small apps beside the thread (Markdown, HTML, SVG, React) - #104

Open
Erioluwa-dev wants to merge 2 commits into
mainfrom
feat/artifacts
Open

Erioluwa-dev wants to merge 2 commits into
mainfrom
feat/artifacts

Conversation

@Erioluwa-dev

Copy link
Copy Markdown
Collaborator

What

Agents (Claude or Codex) can now create and iterate on artifacts in a room: Markdown, SVG, single-page HTML/CSS/JS, and multi-file React (JSX/TSX). They open in a new Artifacts tab beside the thread, with Preview / Source / Errors, a revision picker, restore, copy and source export, and a chat card that opens the artifact from the message that made it. See docs/artifacts.md.

How

Engine (Go)

  • Per-room JSON store beside the thread data. Each save is an immutable, multi-file revision; the author is stamped from the authenticated session, never from args.
  • base_revision conflict checks (typed ArtifactConflict on gRPC Aborted), durable idempotent create, plan-mode mutations rejected.
  • Hub tools artifact.create/update/restore/list/revisions/read (reads paged by UTF-8 bytes, 2 KiB for agents, 256 KiB for the desktop). New RPCs Artifacts, ArtifactRevisions, ArtifactRead, ArtifactAction, ReportArtifactBuild; event artifact_changed = 30 carries metadata only.
  • The desktop reports build/runtime results back so agents can read compile errors via artifact.read.

Desktop (Electron)

  • Isolated view: own in-memory session, no preload/IPC, deck-artifact:// scheme with a strict CSP, deny-only navigation, and a refusing proxy plus disable_non_proxied_udp so WebRTC reaches nothing. A fresh view per show; events carry a request id so a replaced page can't report into the next one.
  • React is compiled offline with esbuild-wasm in an Electron utility process (killable on cancel). Only the revision's own files and react, react-dom, react-dom/client, react/jsx-runtime can be imported. Artifact code is never evaluated in main.
  • react/react-dom moved to dependencies and esbuild-wasm added so packaged builds can compile.

Verification

  • go build ./..., go vet on touched packages, Go tests for artifacts, hub, workspace: pass.
  • desktop-shell: npm run lint clean; 648 artifact + renderer tests pass.
  • Real-Electron isolation test (test/artifact-electron.cjs, 9 checks): hostile HTML/SVG reach no loopback http/tcp/udp, CSP blocks form/frame/img/script, React renders offline, forbidden imports fail to build, WebRTC STUN/TURN (UDP and TCP, incl. a fresh-frame constructor) sends nothing.
  • Full-app flows with the real engine and the ASAR compiler probe, reported by Codex (details in the PR discussion / local .deck/artifacts-verification.md, not committed).

Known failures, not from this PR

These fail on this Windows machine and I did not confirm each against a clean main:

  • internal/deck/session: TestInstructionsFitTheBudgetAtEveryLevel (the host's team config inflates the briefing), TestAgentRaceReportsOnceAndIsJudged, and a TestWorktreeLifecycle hang that hit the 10-minute timeout.
  • pkg/rpc: TestGitStatusCheckoutAndCommit and TestTerminal time out on git/PowerShell.
  • desktop-shell: 7 test files (unix-socket EACCES, POSIX paths, TLS pinning).

Not covered

  • A signed/installed installer (only an unsigned unpacked package was checked).
  • WebRTC isolation was tested against loopback servers only.
  • The compiler utility process has full Node privileges and parses untrusted source.

Generated with Deck

Agents in a room can create, update, read and restore shared artifacts
(markdown, html, svg, react). Each save is an immutable multi-file revision
with an authenticated author, a base_revision conflict check and durable
idempotent create. Reads are paged by UTF-8 bytes; events carry metadata only.
The desktop reports build and runtime results back through ReportArtifactBuild
so agents can read compile errors. Mutations are rejected in plan mode.

Co-Authored-By: Deck <311780591+deck-cli@users.noreply.github.com>
An Artifacts panel shows Markdown in the app and HTML, SVG and React in an
isolated view: its own in-memory session, no preload or IPC, a strict CSP, a
refusing proxy for WebRTC and a deny-only navigation guard. React revisions are
compiled with esbuild-wasm in a disposable utility process from the revision's
own files and a short import allowlist; the code is never evaluated there.
Adds revision history, restore, source export, chat cards, build and runtime
error reporting, and real-Electron isolation tests.

Co-Authored-By: Deck <311780591+deck-cli@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 571e762f-4f83-4235-8ad4-2db08218d42c
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​esbuild-wasm@​0.28.2991007585100

View full report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants