Skip to content

feat: relay runtime calls through the editor socket - #102

Merged
kpal81xd merged 4 commits into
mainfrom
feat/runtime-relay
Aug 25, 2026
Merged

feat: relay runtime calls through the editor socket#102
kpal81xd merged 4 commits into
mainfrom
feat/runtime-relay

Conversation

@kpal81xd

@kpal81xd kpal81xd commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Chromium gates public→loopback behind a per-origin permission (Chrome 142+, websockets from 147), so the launch page needed a second grant — requested silently while a popup loaded, and silent when refused.

The editor peer can now declare that it relays for the launch page: runtime:* frames ride the editor socket, so only the editor origin needs the permission. A hello frame advertises the capability; editors that ignore it keep opening their own runtime socket, and older servers send no greeting, so both directions still work (verified against the published 0.6.1).

Failure text now names the permission instead of only blaming popups, and launch_start reports adopted.

Pairs with playcanvas/editor#2217.

Smoke test

  1. Connect the Editor, ask an assistant to start a Launch instance and screenshot it. Expected: the window opens, its URL has no mcp_port, the screenshot returns.
  2. Ask again while that app runs. Expected: adopted: true, no second window.
  3. Ask with mini stats enabled. Expected: adopted: false, the old window closes.
  4. Reload the Editor tab, reconnect, ask for a screenshot without launching. Expected: it succeeds.
  5. Stop the instance, then ask for a screenshot. Expected: the error says to call launch_start first and mentions no launch-page permission.

Chromium gates a public page's connection to 127.0.0.1 behind a local access
permission, per origin (Chrome 142+, websockets from 147). The launch page is a
separate origin from the editor, so runtime tools needed a second grant that was
requested silently during a popup's page load — when it wasn't given, the launch
page simply never connected and the failure was indistinguishable from a server
that wasn't running.

The editor peer can now declare that it relays for the launch page. `runtime:*`
frames ride the editor socket unchanged, so only the editor origin ever needs the
permission. A `hello` frame advertises the capability on connect; an editor that
doesn't answer it keeps opening its own runtime socket, so older editor builds
work untouched.

Failure text now names the permission instead of only blaming popups, and
launch_start reports whether it adopted an already-running app.
@kpal81xd kpal81xd self-assigned this Aug 24, 2026
@kpal81xd kpal81xd added the enhancement New feature or request label Aug 24, 2026
The launch page no longer opens its own websocket. The editor holds the only
socket and relays runtime:* over it, so the runtime role, the _relay flag and
the hello/relay negotiation are gone — the relay is the sole path.
@kpal81xd
kpal81xd merged commit a15aef9 into main Aug 25, 2026
3 checks passed
@kpal81xd
kpal81xd deleted the feat/runtime-relay branch August 25, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant