Hypermedia Islands Lab

Hypothesis: Implementing all four hypermedia directions (A -> B, A <- B StretchText/transclusion, B -> A backlinks, B <- A shareable #trail= hashes) alongside isolated MessageChannel islands lets web documents compose context without origin collapse or link rot.

Why this exists

HTML standardized one-way A -> B navigation via <a>, leaving inline StretchText transclusion, shareable reader trails, and capability-isolated multi-origin widgets unstandardized.

Confirm vs. falsify

Confirm: fetch live HTTPS pages via the SSRF guard, serialize #trail= + #:~:text= links, and isolate Mode 4 without leaking host globals. Falsify: upstream X-Frame-Options, CSP frame-ancestors, or client-only JS hydration block extraction.

What to try first

Fetch a live URL (or click Test SSRF: 127.0.0.1), slide Depth (0–3) to expand StretchText, click SVG regions to build a #trail= hash, then open 2. <web-island> 4-Mode Bench.

How This Works & 3 Things To Try

Pull any public https:// page through the SSRF-shielded Cloudflare Worker (/api/fetch-doc), adjust inline StretchText depth, merge two documents with citation fragments, and save a trail into the URL hash.

  1. Fetch a live URL & test SSRF guards: Click Fetch Live URL into Card B or use a quick preset (including http://127.0.0.1/) to inspect extracted sections, upstream framing headers, and JS-hydration diagnostics.
  2. StretchText & Text Fragments: Drag the Depth (0–3) slider (uses CSS View Transitions when supported) and inspect live #:~:text= links.
  3. Build a Memex #trail= URL: Click any quadrant on the spatial SVG diagram or + Add to #trail= to update the shareable base64url URL fragment live in the address bar.

Four Link Directions Beyond <a>

A -> B Standard navigation A <- B StretchText & merge B -> A Inbound backlinks B <- A Reader #trail & SVG Live SSRF Proxy (/api/fetch-doc) + Client State (#:~:text= , #trail= , AudioContext #t=) Blocks 127.0.0.0/8, 10/8, 169.254/16, HTTP, non-443 ports · Caps stream reads at 512 KiB

Live Document Loader

Ready. Select a corpus node or fetch any public HTTPS URL.

A <- B StretchText Expansion

Level 2

B -> A Backlinks & A -> B Outbound

Outbound Links (Click to Transclude B)

A ⊕ B Context Merger

B <- A Memex #trail= & Rich Anchors

Click any diagram quadrant below to append a spatial anchor to your trail:

1. A -> B Navigation 2. A <- B Transclusion 3. B -> A Backlinks 4. B <- A Spatial / #t=
How This Is Set Up

What You Actually Write With This Pattern

Extending unidirectional links with client-encoded fragment trails, StretchText expansion, SSRF-validated edge extraction, and sandboxed <web-island> embeds communicating over typed MessageChannel ports.

Today's pattern (the friction)
<!-- 1. Flat link discards context; no span pointer or trail -->
<a href="https://example.com/essay">Read essay</a>

<!-- 2. Unisolated third-party script shares host DOM & storage -->
<script src="https://third-party.example/widget.js"></script>
<raw-seat-widget></raw-seat-widget>
<!-- Script reads localStorage.getItem("hypermedia_host_token") -->
With this pattern (what you author)
<!-- Four-direction fragment pointers + isolated <web-island> iframe -->
<a href="https://aifoc.us/hypermedia/#:~:text=StretchText%20and%20transclusion">
  Cited span
</a>
<iframe id="web-island-frame" sandbox="allow-scripts"
        src="/islands/seat-picker?mode=web-island"></iframe>

<script type="module">
  import { stretchTextLevels, encodeTrail } from "/lib/hypermedia-core.js";
  const view = stretchTextLevels(section, 2);
  location.hash = encodeTrail([{ title: section.heading, url: view.fragmentUrl, note }]);
</script>
Complete Page Setup: Real Definition, HTML Markup & Wiring

End-to-end wiring from public/index.html, public/lib/hypermedia-core.js, public/app.js, src/ssrf.ts, and src/worker.ts: the page renders StretchText depth controls, serializes #trail= fragments, compares all four embedding isolation modes, and proxies external HTTPS reads through SSRF validation on /api/fetch-doc.

<!-- 1. Page HTML Setup (public/index.html: StretchText + 4 Isolation Modes) -->
<input type="range" id="stretch-depth" min="0" max="3" value="2">
<div id="stretch-container"></div>
<iframe class="island-frame" sandbox="allow-scripts" src="/islands/seat-picker?mode=classic"></iframe> <!-- Mode 1 -->
<div id="mode2-status">No remote session key custody inside scraped host DOM.</div>               <!-- Mode 2 -->
<div id="mode3-mount"></div>                                                                     <!-- Mode 3 (<raw-seat-widget>) -->
<iframe id="web-island-frame" class="island-frame" sandbox="allow-scripts" src="/islands/seat-picker?mode=web-island"></iframe> <!-- Mode 4 -->
<script type="module" src="/app.js"></script>

// 2. Concrete Trail, Island Manifest, Theme Tokens & SSRF Policy (hypermedia-core.js, app.js, ssrf.ts)
const THEMES = {
  editorial: { "--island-bg": "#f8fafc", "--island-fg": "#0f172a", "--island-accent": "#1d4ed8", "--island-radius": "6px" },
  slate: { "--island-bg": "#161d2f", "--island-fg": "#e2e8f0", "--island-accent": "#38bdf8", "--island-radius": "8px" },
  amber: { "--island-bg": "#1c1917", "--island-fg": "#fef3c7", "--island-accent": "#f59e0b", "--island-radius": "10px" },
};
// GET /.well-known/web-island.json -> schema: "https://aifoc.us/schemas/web-island-v0", sandbox: "allow-scripts",
// channelProtocol: "web-island-messagechannel-v1", tools: ["list_seats", "select_seat", "checkout_with_passkey_demo"]
// Island CSP (src/worker.ts): script-src <origin>; style-src <origin>; connect-src <origin> (zero inline scripts)
const BLOCKED_HOSTNAMES = new Set(["localhost", "ip6-localhost", "ip6-loopback", "metadata.google.internal", "metadata"]);

// 3. Page Bootstrap, SSRF-Checked /api/fetch-doc & MessageChannel Wiring
const res = await fetch(`/api/fetch-doc?url=${encodeURIComponent(rawUrl)}`);
// src/worker.ts + src/ssrf.ts: validatePublicHttpsUrl() enforces https://, port 443, no private CIDRs,
// follows up to 4 redirect: "manual" hops, caps body at 524288 bytes, reports X-Frame-Options & JS-hydration diagnostics
const expanded = stretchTextLevels(section, hyperState.stretchDepth);
history.replaceState(null, "", encodeTrail(hyperState.trail));

const channel = new MessageChannel();
channel.port1.onmessage = async (event) => {
  if (event.data?.type === "CHECKOUT_RECEIPT") {
    await verifyReceiptSignature(event.data.signed.canonicalPayload, event.data.signed.signatureB64u, event.data.signed.publicKeyJwk);
  }
};
frame.contentWindow?.postMessage({ type: "ISLAND_INIT", tokens: sanitizeDesignTokens(THEMES[theme]) }, "*", [channel.port2]);
Core Plumbing Required Today (Browser + Edge / Protocol Contract)
// src/worker.ts + src/ssrf.ts — SSRF-shielded fetch with manual redirect checks & 512 KiB cap
let check = validatePublicHttpsUrl(targetRaw); // blocks 127.0.0.0/8, 10/8, 169.254/16, non-443
const res = await fetch(currentUrl, { redirect: "manual" }); // re-validates every 3xx Location

// public/app.js + public/lib/hypermedia-core.js — MessageChannel + ECDSA P-256 verification
const channel = new MessageChannel();
frame.contentWindow?.postMessage(
  { type: "ISLAND_INIT", tokens: sanitizeDesignTokens(theme) }, "*", [channel.port2]
);
const valid = await verifyReceiptSignature(
  signed.canonicalPayload, signed.signatureB64u, signed.publicKeyJwk
);
What disappears

Unisolated third-party <script> widgets sharing host storage, brittle ad-hoc scraping without SSRF guards, and server databases dedicated solely to storing reader trails.

What becomes explicit

Client-encoded fragment trails (#:~:text=, #t=, #trail=), strict IP/redirect allowlisting in /api/fetch-doc, sanitized --island-* theme tokens, and ECDSA P-256 receipts.

Platform gaps remaining

HTML lacks a built-in bidirectional transclusion primitive or native <web-island> contract for theme negotiation, intrinsic sizing, and tool calls without manual MessageChannel plumbing.