Skip to content

feat(canvas): render inline HTML canvas via sanitized Shadow DOM#517

Open
beruro wants to merge 1 commit into
developfrom
feat/canvas-static-html
Open

feat(canvas): render inline HTML canvas via sanitized Shadow DOM#517
beruro wants to merge 1 commit into
developfrom
feat/canvas-static-html

Conversation

@beruro

@beruro beruro commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Replace the inline HTML canvas's sandboxed-iframe path with a sanitized Shadow DOM renderer (staticHtmlCanvas): styles preserved, <script> and event-handler attributes stripped. url mode becomes an external-open action instead of being embedded in chat.
  • render_inline_canvas tool now returns an honest acceptance acknowledgment ("accepted ...; visual output not verified") rather than claiming it rendered — the tool path cannot inspect the card.

Test plan

  • tsc --noEmit and cargo clippy -p agent_core pass (pre-commit hook).
  • pnpm vitest run for staticHtmlCanvas.test.ts; cargo test -p agent_core for the acceptance-message tests.
  • Manual: render an HTML canvas card — confirm styles apply, scripts do not execute, and url mode shows an external-open action.

Based on latest develop.

- Replace the sandboxed-iframe HTML path with a sanitized Shadow DOM renderer
  (`staticHtmlCanvas`): styles are preserved while scripts and event-handler
  attributes are stripped. `url` mode becomes an external-open action instead
  of being embedded in chat.
- `render_inline_canvas` now returns an honest acceptance acknowledgment
  ("accepted ...; visual output not verified") rather than claiming it
  rendered, since the tool execution path cannot inspect the card.

Adds unit tests for the acceptance message and the static HTML sanitizer.
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.

1 participant