Skip to content

Embed interactive playgrounds in the web thread - #675

Open
time-attack wants to merge 1 commit into
yc-software:mainfrom
time-attack:feat/miniapps
Open

Embed interactive playgrounds in the web thread#675
time-attack wants to merge 1 commit into
yc-software:mainfrom
time-attack:feat/miniapps

Conversation

@time-attack

@time-attack time-attack commented Aug 25, 2026

Copy link
Copy Markdown

Summary

  • When someone asks to see or play with a mechanism, the agent can store a self-contained HTML miniapp and put [[miniapp: url | title]] in the reply so the web UI renders a Play / Code card in the thread.
  • Slack strips the marker and does not teach or render playground buttons. Playgrounds stay a web surface.
  • Inline scripts are parsed before store; empty, networked, or broken pages are rejected. The host injects light/dark tokens and a first-paint probe so the card does not hang.

Test plan

  • node --experimental-test-module-mocks --test test/miniapp.test.ts test/skill-conformance.test.ts test/pi-tools.test.ts test/route-auth-conformance.test.ts test/dev-cli-lib.test.ts
  • npm test -- test/miniapp.test.ts test/miniapp-proxy.test.ts in plugins/web-ui
  • node --test test/router.test.ts in plugins/portal
  • In a local web UI thread, ask to play with a mechanism (e.g. Riemann sums / drag the rectangles) and confirm a playground card appears with Play and highlighted Code.
  • Confirm ordinary Q&A does not auto-build a playground.
  • Confirm a Slack reply that includes a miniapp marker shows only the stripped text (no buttons, no raw [[miniapp:…]]).
  • Open /m/:id/:key and /m/:id/:key?view=source through portal and web-ui; iframe should load (no X-Frame-Options), source should be raw HTML.

Made with Cursor


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

When someone asks to see or play with a mechanism, the agent can store a self-contained HTML miniapp and render it as a Play/Code card. Slack strips the marker so it stays a web surface, and scripts that do not parse never reach the store.

Co-authored-by: Cursor <cursoragent@cursor.com>
@time-attack

Copy link
Copy Markdown
Author

Live web-thread take: new chat, asked to explain integrals and drag the rectangles. The playground card paints in the thread; then the slider, left/mid/right sampling, and the chart are driven live.

explain-integrals.mp4

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