Skip to content

feat(artifacts): serve immutable agent-generated MCP App views - #3715

Merged
reachjalil merged 7 commits into
devfrom
codex/server-react-html-artifacts
Aug 12, 2026
Merged

reachjalil merged 7 commits into
devfrom
codex/server-react-html-artifacts

Conversation

@reachjalil

@reachjalil reachjalil commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds the provider-side lifecycle for agent-authored custom Artifact views on top of the saved Script/Dynamic Artifact foundation from #3689.

  • accepts constrained React/TSX plus CSS for a specific authorized saved Script
  • builds each revision server-side into one self-contained HTML/JS/CSS MCP App without executing authored code in Den
  • stores source, compiled HTML, build diagnostics, schema compatibility, closed CSP, compiler metadata, and digests
  • assigns every saved revision an immutable URI:
    ui://openwork/artifacts/{artifactViewId}/views/{viewRevisionId}/index.html
  • serves the stored bytes through authorized resources/read as text/html;profile=mcp-app
  • registers active and preview render tools with the exact immutable URI in _meta.ui.resourceUri
  • keeps Artifact result data separate in the render tool's structuredContent
  • activates the first successful revision, leaves edits as preview revisions, and supports explicit activation/rollback and retirement without mutating stored bytes
  • refreshes resources and render-tool URIs in the same MCP session and emits catalog change notifications after save, activation, rollback, or retirement

The existing generic ui://openwork/dynamic-artifact/v1/view.html renderer remains as a universal fallback. This PR does not add a generic code-injection shell, mutable latest.html, or a URI returned only after tool execution.

Scope

This is the custom-view provider follow-up to #3689. Cross-origin sandboxed iframe hosting is supplied separately by #3700. Automations and ordinary cloud-agent execution are intentionally unchanged.

Security and compatibility

  • authoring is limited to saved Scripts the member can manage; reads reuse saved Script viewer authorization
  • esbuild parses and bundles generated source, but Den never executes the authored React during a build
  • authored code runs only after the immutable resource reaches Host standard MCP Apps inline in desktop conversations #3700's sandboxed iframe
  • imports, network APIs, host globals, raw HTML injection, external CSS references, unsafe elements, and URL-bearing attributes are denied
  • the bundle has a closed CSP and a SHA-256-pinned executable script
  • activation requires the revision output-schema digest to match the saved Script's current schema
  • resource reads recompute and verify the stored HTML digest
  • failed builds are durable diagnostic revisions and do not replace the active view
  • compiled HTML is capped at the host's 512 KiB resource ceiling

Compatibility with MCP Apps host (#3700)

The exact #3700 and #3715 heads are independently rebased onto the same current dev head and merge without source conflicts. Together they cover agent authoring, server build, immutable storage, versioned ui:// resources, exact render-tool registration, sandbox-proxy iframe rendering, and revision activation/rollback.

Verification

  • generated view build/security and MCP lifecycle tests: 11 passing
  • same-session save/activate/retire catalog refresh covered
  • constructor-chain regression proves the server build does not execute authored code
  • oversized bundle rejection covered at the 512 KiB host boundary
  • existing xlsx tarball integrity retained in the lockfile
  • combined current host/provider worktree: 25 focused tests passing
  • desktop app TypeScript check on the combined worktree
  • exact current heads merge cleanly
  • git diff --check

The opt-in live journey remains at evals/specs/generated-artifact-views.slow.test.ts; a full deployed Den plus packaged Electron visual pass is broader follow-up proof, not claimed here.

Base: 396a6e3141e302a230f2319afc45c2e855e79606
Head: 47008bae4fb586181ac367e87f2fbff1fb803c89

@vercel

vercel Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-app Ready Ready Preview Aug 12, 2026 11:14am
openwork-den Ready Ready Preview Aug 12, 2026 11:14am
openwork-den-worker-proxy Ready Ready Preview Aug 12, 2026 11:14am
openwork-diagnostics Ready Ready Preview Aug 12, 2026 11:14am
openwork-landing Ready Ready Preview, v0 Aug 12, 2026 11:14am

@reachjalil
reachjalil force-pushed the codex/server-react-html-artifacts branch from 5f870ae to cabec48 Compare August 12, 2026 08:21
@reachjalil
reachjalil force-pushed the codex/server-react-html-artifacts branch from cabec48 to 2f397be Compare August 12, 2026 08:25
Comment thread ee/apps/den-api/src/mcp/agent.ts Resolved
diff-warden[bot]
diff-warden Bot previously approved these changes Aug 12, 2026

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (143e97aca482ed1ee38248b6e88613589f557363). 1 advisory desktop↔den sync note(s) were posted as review comments; they do not affect clearance. Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (47008bae4fb586181ac367e87f2fbff1fb803c89). 1 advisory desktop↔den sync note(s) were posted as review comments; they do not affect clearance. Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

This branch was successfully deployed

5 active deployments
Preview – openwork-den-worker-proxy — 47008bae Deployed Aug 12, 2026 by vercel[bot]
Preview – openwork-landing — 47008bae Deployed Aug 12, 2026 by vercel[bot]
Preview – openwork-den — 47008bae Deployed Aug 12, 2026 by vercel[bot]
Preview – openwork-app — 47008bae Deployed Aug 12, 2026 by vercel[bot]
Preview – openwork-diagnostics — 47008bae Deployed Aug 12, 2026 by vercel[bot]
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