Skip to content

Consume the hosted agent widget script instead of owning the chrome#240

Merged
jakemor merged 1 commit into
mainfrom
claude/embedded-agent-standardize-4futfe
Jul 7, 2026
Merged

Consume the hosted agent widget script instead of owning the chrome#240
jakemor merged 1 commit into
mainfrom
claude/embedded-agent-standardize-4futfe

Conversation

@jakemor

@jakemor jakemor commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What

AgentChatWidget.tsx shrinks from ~300 lines of ported launcher/teaser/panel chrome + postMessage bridge to a small client-side loader for the embedded-agent worker's /widget.js — the standard hosted embed superwall.com now uses (superwall-com#14, merged) — so the widget deploys in lockstep with the agent and can never drift from its bridge protocol. AgentLauncherDither.tsx and the @paper-design/shaders-react dependency are deleted; the dither launcher ships inside widget.js on the vanilla shader core.

Behavior parity (and one fix)

  • Same visuals (the hosted chrome was ported from the same source), same z-40 stacking via data-z-index, all chrome in a shadow root.
  • Same agentWidget.* localStorage keys — visitors keep their conversation, open state, and teaser dismissal.
  • SPA route changes still re-push page context with each page's Markdown twin (the widget patches history itself — no router hook needed).
  • Search's "Ask AI" keeps dispatching OPEN_AGENT_EVENT — the hosted widget listens for that exact event. Bonus fix: the agent app now actually consumes the seeded query (composer pre-fill + auto-send, shipped to embedded-agent main today); the old copy forwarded ?query=…&send=1 to an agent that ignored it.

Testing

  • bun run build:cf clean, bun test 65/65.
  • The hosted widget itself has a 48-check Playwright E2E (chrome, bridge round-trips, persistence, Ask-AI query seeding + auto-send) against the same production script this loads.
  • Will verify end-to-end on this PR's Cloudflare preview URL before merging.

Docs for every embed use case: https://github.com/superwall/embedded-agent#embedding-the-agent

🤖 Generated with Claude Code

https://claude.ai/code/session_01DxD3A8vSXgLxyVTPpugXFj


Generated by Claude Code

AgentChatWidget.tsx shrinks from ~300 lines of ported launcher/teaser/panel
chrome + postMessage bridge to a client-side loader for the embedded-agent
worker's /widget.js — the standard embed superwall.com now uses — so the
widget deploys with the agent and can never drift from its bridge protocol.
AgentLauncherDither.tsx and the @paper-design/shaders-react dependency go
away; the dither launcher ships inside widget.js on the vanilla shader core.

Behavior parity: same visuals, same z-40 stacking, same agentWidget.*
localStorage keys (visitors keep their conversation), same SPA page-context
re-pushes with Markdown twins, same live theme follow. The search dialog's
"Ask AI" keeps dispatching OPEN_AGENT_EVENT — the hosted widget listens for
that exact event, and the agent now actually consumes the seeded query
(pre-fill + auto-send), which the old copy forwarded to no effect.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DxD3A8vSXgLxyVTPpugXFj
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
superwall-docs 8a38f11 Commit Preview URL

Branch Preview URL
Jul 07 2026, 08:18 PM

@jakemor jakemor merged commit db2230a into main Jul 7, 2026
2 checks passed
@jakemor jakemor deleted the claude/embedded-agent-standardize-4futfe branch July 7, 2026 20:35
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