feat(kernel-browser-runtime): add slot-based UIOrchestrator#810
Open
feat(kernel-browser-runtime): add slot-based UIOrchestrator#810
Conversation
…ed orchestration Add UIOrchestrator for managing visible UI vat iframes in named slots, enabling multiple caplet UIs to coexist in a structured layout. - Add UIOrchestrator class with slot-based iframe management - Add makeUIVatWorker factory for VatWorker interface - Add <div id="root"> mounting point to vat/iframe.html - Export SlotName type (currently 'main', extensible) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Create logger once at construction time in makeUIVatWorker instead of per method call - Track in-progress launches to prevent concurrent launches with same ID from orphaning iframes - Clean up iframe from DOM when connection establishment fails Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
sirtimid
commented
Feb 5, 2026
| title?: string, | ||
| visible = true, | ||
| ): HTMLIFrameElement { | ||
| const iframe = document.createElement('iframe'); |
Contributor
Author
There was a problem hiding this comment.
Should we use createWindow from @metamask/snaps-utils? But UIOrchestrator needs the iframe element itself for lifecycle management
…ion error handling - Save original document.createElement before mocking to prevent infinite recursion when creating non-iframe elements in tests - Move iframe creation inside try block so ID is removed from launchesInProgress if createIframe throws Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| for (const id of this.#uiVats.keys()) { | ||
| this.terminate(id); | ||
| } | ||
| } |
There was a problem hiding this comment.
Map iteration during modification inconsistent with codebase pattern
Low Severity
The terminateAll method iterates directly over this.#uiVats.keys() while calling terminate() which deletes entries from the Map. While JavaScript handles this correctly for deletions, it's inconsistent with the established pattern in PlatformServicesServer.ts which uses Array.from(this.#vatWorkers.keys()) to snapshot the keys before iteration. Converting to an array first is safer and more maintainable.
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.


Summary
Add
UIOrchestratorfor managing visible UI vat iframes in named slots, enabling multiple caplet UIs to coexist in a structured layout.UIOrchestratorclass with slot-based iframe managementmakeUIVatWorkerfactory forVatWorkerinterface<div id="root">mounting point tovat/iframe.htmlSlotNametype (currently'main', extensible)Usage
Architecture
Test plan
UIOrchestrator(slot management, lifecycle, etc.)🤖 Generated with Claude Code
Note
Medium Risk
Adds new iframe creation and cross-window
postMessage/MessageChannelplumbing, which can impact UI isolation and runtime stability if misused, but is largely additive with test coverage.Overview
Adds a new
UIOrchestratorAPI to launch and manage visible, sandboxed UI vat iframes in named slots, including lifecycle controls (launch,show/hide,terminate,terminateAll) and accessors for ports/iframes.Introduces
makeUIVatWorkerto expose UI vats through the existingVatWorkerinterface, exports the new UI surface from the package index, and updates the vat iframe HTML to include a#rootmount point; adds comprehensive unit tests for orchestrator behavior and ignores.playwright-mcp/artifacts.Written by Cursor Bugbot for commit eec21e3. This will update automatically on new commits. Configure here.