<web-island> Multi-Origin Host Shell

Hypothesis: Combining /.well-known/web-island.json discovery, sandbox="allow-scripts", MessageChannel theme and size negotiation, explicit <dialog> batch confirmation, and ECDSA P-256 receipts enables multi-origin UI composition without granting widgets ambient host authority.

Why this exists

Portals and conversational shells need live interactive widgets from separate origins without granting third-party scripts access to host DOM, cookies, or unapproved actions.

Confirm vs. falsify

Confirm: all 3 islands sync tokens and geometry over MessageChannel, require <dialog> confirmation for batched WebMCP calls, and verify ECDSA receipts. Falsify: ResizeObserver ping-pong or handshake latency degrades responsiveness inside double-isolated frames.

What to try first

Switch Host Design Tokens, click a seat in Island 1 to observe host-mediated budget updates, click Orchestrate 3-Island Booking to approve in <dialog>, then run Tamper 1 Byte and Probe Unbrokered Peer Call.

How This Works & 3 Things To Try

The Custom Element <web-island> mounts an isolated iframe, transfers a private MessageChannel port, pushes allowlisted CSS custom properties, syncs intrinsic height via ResizeObserver, and routes JSON tool invocations only when the host broker approves.

  1. Restyle all 3 opaque sandboxes simultaneously: Switch Host Design Tokens between Archival Light, Deep Slate, and Warm Amber and observe allowlisted token frames in the wire inspector.
  2. Click inside Seat Inventory: Selecting a seat in Island 1 emits an ISLAND_EVENT to the Host Broker, which invokes budget.set_line_item() without islands sharing DOM or ports.
  3. Run the 3-Island Orchestrated Plan: Click Orchestrate 3-Island Booking to open the native <dialog> confirmation gate, verify the signed ECDSA P-256 hold receipt, and test 1-byte tampering + peer-access blocking.

Hub-and-Spoke Broker Architecture

Host Broker + Approval <dialog> Routes tokens + mediates WebMCP invokeTool() Island 1: Seats sandbox=allow-scripts Island 2: Budget sandbox=allow-scripts Island 3: Calendar sandbox=allow-scripts X X
Initializing 3 <web-island> sandboxes over MessageChannel...

Island 1 · Venue Seats

Island 2 · Team Budget

Island 3 · Availability

Brokered ECDSA P-256 Hold Receipt & Isolation Probes

Generated only after explicit confirmation in <dialog>, then verified locally in the browser using crypto.subtle.verify().

Awaiting approved workflow execution
No booking hold signed yet.

Approve Coordinated Cross-Island Plan?

The Host Broker will invoke one WebMCP tool inside each isolated <web-island> in sequence, then request a cryptographic hold signature from /api/sign-hold:

  1. seats.invokeTool("select_seat", { seatId: "B2" })
  2. budget.invokeTool("set_line_item", { label: "Seat B2", amountUsd: 65 })
  3. calendar.invokeTool("reserve_slot", { slotIso: "2026-12-10T09:30Z" })
  4. POST /api/sign-hold -> verify via crypto.subtle.verify()
How This Is Set Up

What You Actually Write With This Pattern

Replacing third-party script tags and untyped window.postMessage broadcasts with /.well-known/web-island.json manifest discovery, opaque <web-island> sandboxes over MessageChannel, native <dialog> batch approval, and ECDSA P-256 receipts.

Today's pattern (the friction)
<!-- Third-party widgets execute in host origin with shared DOM and cookies -->
<script src="https://vendor-a.example/seats.js"></script>
<script src="https://vendor-b.example/budget.js"></script>

<script>
  // Unbrokered cross-widget postMessage("*") with no schema or approval gate
  window.addEventListener("message", (e) => {
    if (e.data.action === "charge") submitOrder(e.data);
  });
</script>
With this pattern (what you author)
<web-island island-id="seats" src="/islands/seats" title="Seats"></web-island>
<web-island island-id="budget" src="/islands/budget" title="Budget"></web-island>
<button commandfor="approval-dialog" command="show-modal">Approve Plan</button>

<script type="module">
  import "/lib/web-island-element.js";
  seatsIsland.setDesignTokens({ "--island-accent": "#1d4ed8" });
  // Invoked sequentially only after confirmation in #approval-dialog:
  const seatRes = await seatsIsland.invokeTool("select_seat", { seatId: "B2" });
  const budgetRes = await budgetIsland.invokeTool("set_line_item", { amountUsd: 65 });
</script>
Complete Page Setup: Real Definition, HTML Markup & Wiring

End-to-end wiring from public/index.html, src/worker.ts, public/lib/web-island-element.js, and public/app.js: the host mounts three opaque <web-island> custom elements plus a modal <dialog> approval gate, discovers capabilities from /.well-known/web-island.json, routes invokeTool() calls over private MessageChannel ports, and verifies /api/sign-hold receipts via WebCrypto ECDSA P-256.

<!-- 1. Page HTML Setup (public/index.html) -->
<web-island island-id="seats" src="/islands/seats" title="Venue Seat Inventory"></web-island>
<web-island island-id="budget" src="/islands/budget" title="Expense Cap Tracker"></web-island>
<web-island island-id="calendar" src="/islands/calendar" title="Session Slot Hold"></web-island>
<button type="button" id="btn-open-approval" commandfor="approval-dialog" command="show-modal">Orchestrate 3-Island Booking</button>
<dialog id="approval-dialog"><button type="button" id="btn-confirm-plan">Approve &amp; Execute Workflow</button></dialog>
<script type="module" src="/app.js"></script>

// 2. Discovery Manifest & Strict Island CSP (src/worker.ts)
// GET /.well-known/web-island.json -> schema, sandboxPolicy: "allow-scripts", allowedDesignTokens[], islands[], brokerSigningKey
// Island documents serve external /islands/island.js & /islands/island.css with zero inline script/style:
// Content-Security-Policy: default-src 'none'; script-src <origin>; style-src <origin>; connect-src 'none';

// 3. MessageChannel Handshake, Policy Check & ECDSA P-256 Receipt Verification
const channel = new MessageChannel(); // inside WebIslandElement.#handshake()
this.#port = channel.port1;
iframe.contentWindow?.postMessage({ type: "ISLAND_INIT", tokens: this.#tokens }, "*", [channel.port2]);

const seatRes = await seatsIsland.invokeTool("select_seat", { seatId: "B2" });
const budgetRes = await budgetIsland.invokeTool("set_line_item", { label: "Seat B2", amountUsd: 65 });
const calRes = await calendarIsland.invokeTool("reserve_slot", { slotIso: "2026-12-10T09:30Z" });
const signed = await (await fetch("/api/sign-hold", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ seatId: seatRes.selected.id, amountUsd: budgetRes.stagedAmount, slotIso: calRes.selectedSlot }),
})).json();
const key = await crypto.subtle.importKey("jwk", signed.publicKeyJwk, { name: "ECDSA", namedCurve: "P-256" }, false, ["verify"]);
const valid = await crypto.subtle.verify({ name: "ECDSA", hash: "SHA-256" }, key, sigBytes, new TextEncoder().encode(signed.canonicalPayload));
Core Plumbing Required Today (Browser + Edge / Protocol Contract)
// public/lib/web-island-element.js — opaque sandbox + private MessageChannel port
const iframe = document.createElement("iframe");
iframe.setAttribute("sandbox", "allow-scripts");
const channel = new MessageChannel();
this.#port = channel.port1;
iframe.contentWindow?.postMessage(
  { type: "ISLAND_INIT", tokens: cleanTokens(this.#tokens) }, "*", [channel.port2]
);

// src/protocol.ts + /api/check-route — hub-and-spoke broker route enforcement
const verdict = validateBrokerRoute("seats", "budget", "set_line_item");
// -> { allowed: false, via: "rejected", reason: "Direct peer invocation from 'seats' denied..." }
What disappears

Third-party <script> widgets sharing host DOM and cookies, direct peer-to-peer island mutation, and unauthenticated window.postMessage("*") event buses.

What becomes explicit

Tool discovery via /.well-known/web-island.json, allowlisted CSS tokens (ALLOWED_ISLAND_TOKENS), host broker mediation (validateBrokerRoute()), <dialog> approval, and ECDSA P-256 receipts.

Platform gaps remaining

Browsers have no built-in <web-island> primitive or automatic /.well-known/web-island.json handshake, requiring custom elements (WebIslandElement) and explicit MessageChannel + ResizeObserver plumbing.