Repository navigation
feat(mcp): the card offers the activity in a new tab where a chat cannot play it in a reply (#274) - #275
Merged
Conversation
…not play it in a reply (#274) A card with no origin frames nothing, since no frame inside it can have a Service Worker, and a frame the chat refuses is known from the browser's securitypolicyviolation. The card then shows one state in the loader's place: what happens, and a button that asks the chat to open the play page's address with the source in it (ui/open-link, or ChatGPT's openExternal), with the address to copy from the first press on. The page's own word from the frame takes the card back. The chat's theme is read the MCP Apps way as well (hostContext.theme). tests/card.test.ts runs the card in a browser in three stand-in chats.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
… card opened itself would keep it, as probed in three engines (#274)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #274.
Where a chat cannot play the activity inside its reply, the card says so and offers it in a new tab, where the whole player runs. Nothing changes in ChatGPT, on the server or on the play page.
How the card knows
From the browser, never from a chat's name:
self.originis"null"). The chat sandboxed it without one, and a sandbox passes to every frame inside, so the play page there could not register its Service Worker. No frame is tried. This is Open WebUI 0.13.4.securitypolicyviolationfor the play page's address. This is Claude.What is seen
One state, in the loader's place and as tall as what it says, in the chat's theme:
The button asks the chat to open the play page's address with the source in it (
ui/open-link, or ChatGPT'sopenExternal). A plain link would not do: a tab opened from a sandboxed card keeps the sandbox, in Chromium, Firefox and WebKit. Whether a tab opened is not the card's to see, so the address is there from the first press on. Each state was looked at in light and dark, at 760 px and at a phone's 390 px, in the three engines: no scroller in the card, and Copy works in a card without an origin.The card now also takes the chat's theme the MCP Apps way (
hostContext.theme, andui/notifications/host-context-changed), which it read only from ChatGPT'swindow.openaibefore.Testing
packages/mcp/tests/card.test.ts, five tests, in the verifier's browser: the card in a chat that sandboxes it as Open WebUI does, under the policy Open WebUI writes from the card's own domains; in one that refuses the frame; and in one that lets the page be framed. Each speaks MCP Apps to the card. Against the card before this change all five fail.typecheckis clean.ui/open-link, the chat opened the tab, and the live play page built and played the True/False sample there ("True False · 882 kB").Not verified: Claude and Open WebUI themselves, which the card met only as stand-ins built from Open WebUI's source and from the policy Claude was seen to apply.
Notes
playwright-coreis a dev dependency of the package now, for the test's types; the browser is the verifier's own choice (launch).design/mcp.mdhas the rule;design/scope.mdrecords that a player without the Service Worker is not built, with the corpus numbers behind that.Summary by cubic
Where a chat cannot play the activity inside its reply, the MCP card now offers it in a new tab instead of hanging on a spinner. The chat opens the tab itself, because a tab opened from a sandboxed card keeps the sandbox and loses its origin, as probed in Chromium, Firefox, and WebKit.
self.origin === 'null'orsecuritypolicyviolation), never from a chat's name.hostContext.theme) as well as ChatGPT'swindow.openai.tests/card.test.ts, which runs the card in a browser in three stand-in chats, andplaywright-coreas a dev dependency.Written for commit 0e86804. Summary will update on new commits.