Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
render the app shell without waiting on Google Fonts
[._.]/ Adam Eivy4e88499375f5
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 357713bd8f..a990d04788 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -36,6 +36,8 @@- **Labels floating over 3D and Three.js previews now follow the active theme.** The status bar on a generating Three.js model read as dark green text on a near-black slab — that chrome was written as a fixed black scrim with white text, and on a light theme the white text is remapped to the theme's dark ink while the black scrim stays black. Overlay chrome across the 3D and Three.js surfaces (the generation status bar, the preview's background/explode and part-selection panels, the orbit hint and articulation badge, the mesh viewer's display-settings button, and the "Change image" labels on both pickers) now takes its surface and ink from the theme itself, so it matches the page and stays legible over a dark canvas, a light one, or a photograph.+- **PortOS no longer boots to a blank white page when it can't reach the public internet.** The app shell pulled Inter and IBM Plex Mono from `fonts.googleapis.com` as a render-blocking `<link rel="stylesheet">`, so on any install with no route to Google — no WAN, a DNS sinkhole, an outbound firewall — the browser held the first paint until that request timed out. Measured on a live install: **~60 seconds of blank white page on every single navigation**, with no console error to explain it. The service worker made it durable rather than causing it: `public/sw.js` deliberately caches the font hosts, but `cacheFirst` can never populate that cache when the fetch never succeeds, so each navigation re-hung — the exact opposite of the offline app shell that service worker exists to provide, on a product whose documented deployment is a private Tailscale network. The stylesheet now loads non-blocking (`media="print"` flipped to `all` on load, with a `<noscript>` fallback), so first paint no longer waits on a third-party host. Nothing regresses when the fonts *are* reachable: only the `lumen-glass-day` theme puts them at the front of its stack, every stack in `themes/portosThemes.js` falls back to system fonts, and the sheet still applies the moment it arrives. A guard suite pins the shell so no future `<link>` can make boot depend on a cross-origin host again.+- **Brain Memory and Media History no longer paint every record at once.** A live install with ~1.5k imported ChatGPT memories was mounting full Markdown trees for every card (~180k DOM nodes / multi-MB of text), and Media History mounted ~1.8k gallery cards with images in one grid — both tabs froze on open. Memory now shows a plain teaser for imported transcripts (full thread still opens in the conversation viewer) and both lists use a progressive "Show more" window so search still covers the full set while only a page of cards mounts. CoS 3D avatars also probe WebGL before creating a canvas, so headless/no-GPU displays degrade to a hint instead of unhandled `WebGLRenderer` rejections.- **The pre-episode arc-spine check now resolves at the altitude it judged at.** That checkpoint deliberately verifies the arc spine with the episode lineup hidden — no episodes have been planned in earnest yet, so it only asks whether the premise, principals, engine, and volume allocation are safe to expand. The auto-resolver behind it, though, was still handed the full episode lineup and the general "correct an episode synopsis when the contradiction originates there" instruction, so it answered spine findings by rewriting episode synopses the gate had never read. Those edits could not close what was flagged, the arc and volume text stayed unfixed, and the next spine verification came back with twice the blockers — a round that got reverted wholesale and paused the run. (Observed on a run that went in with 3 blocking findings, spent its round editing 3 episode synopses, and came back with 6.) Spine rounds now render the resolver the same episode-empty plan the verifier saw, tell it to fix the arc and volumes only, and discard any episode edits it returns anyway, so a customized or stale installed prompt can't re-open the blast radius. Nothing changes for the full arc gate that runs after episodes exist: it still verifies and repairs episode synopses, which is the only place an episode-scoped contradiction can converge. Sparse finding-keyed patches and the blocker-count rollback are untouched.diff --git a/client/index.html b/client/index.htmlindex ec98289445..9d84344ee6 100644--- a/client/index.html+++ b/client/index.html@@ -12,10 +12,36 @@<meta name="theme-color" content="#01051F" /><link rel="preconnect" href="https://fonts.googleapis.com" /><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />+ <!-- Webfonts load NON-render-blocking. Only the `lumen-glass-day` theme puts+ Inter / IBM Plex Mono at the front of its font stack, and every stack in+ portosThemes.js falls back to system fonts — so these are a progressive+ enhancement, never a boot dependency.++ A plain `<link rel="stylesheet">` here is render-blocking against a+ THIRD-PARTY host, which is the wrong trade for PortOS: an install runs on+ a private Tailscale network and is expected to work with no route to the+ public internet (that is the whole point of the offline app-shell service+ worker in public/sw.js). When fonts.googleapis.com is unreachable — no+ WAN, a DNS sinkhole, an outbound firewall — the browser holds rendering+ until the request times out, so the app is a blank white page for ~60s on+ EVERY load, service worker or not.++ `media="print"` makes the stylesheet non-matching, so it downloads+ without blocking the first paint; `onload` flips it to `all` to apply it+ once it actually arrives. If it never arrives, nothing is delayed and the+ system-font fallback stands. --><linkrel="stylesheet"href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap"+ media="print"+ onload="this.media='all'; this.onload=null;"/>+ <noscript>+ <link+ rel="stylesheet"+ href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap"+ />+ </noscript></head><body><div id="root"></div>diff --git a/client/src/test/appShell.test.js b/client/src/test/appShell.test.jsnew file mode 100644index 0000000000..d32150b8db--- /dev/null+++ b/client/src/test/appShell.test.js@@ -0,0 +1,82 @@+/**+ * App-shell (`client/index.html`) boot guards.+ *+ * PortOS installs run on a private Tailscale network and are expected to work+ * with no route to the public internet — that is the premise of the offline+ * app-shell service worker in `public/sw.js`. A render-blocking stylesheet+ * pointed at a THIRD-PARTY host breaks that premise outright: when the host is+ * unreachable (no WAN, DNS sinkhole, outbound firewall) the browser holds the+ * first paint until the request times out, so the app is a blank white page for+ * ~60s on every load — with or without the service worker, because the SW's own+ * `fetch` for the stylesheet hangs the same way.+ *+ * The webfonts are a progressive enhancement: only the `lumen-glass-day` theme+ * puts Inter / IBM Plex Mono at the front of its stack, and every stack in+ * `themes/portosThemes.js` falls back to system fonts. So they must load+ * non-blocking (`media="print"` + `onload="this.media='all'"`), never as a boot+ * dependency.+ */++import { describe, it, expect } from 'vitest';+import { readFileSync } from 'fs';+import { join, dirname } from 'path';+import { fileURLToPath } from 'url';++const CLIENT_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..');+const html = readFileSync(join(CLIENT_ROOT, 'index.html'), 'utf8');++// Every <link> tag in the shell, as whole tags (attributes may span lines).+const linkTags = html.match(/<link\b[^>]*>/gs) || [];++// `<noscript>` content is inert while JS is enabled, so a blocking stylesheet+// in there can't stall the app's boot. With JS off the SPA can't render at all,+// which makes it moot — so the render-blocking guard scans the shell WITHOUT+// noscript blocks, or it would flag its own graceful-degradation fallback.+const htmlWithoutNoscript = html.replace(/<noscript>.*?<\/noscript>/gs, '');+const activeLinkTags = htmlWithoutNoscript.match(/<link\b[^>]*>/gs) || [];++const attr = (tag, name) => {+ const m = tag.match(new RegExp(`${name}\\s*=\\s*"([^"]*)"`, 's'));+ return m ? m[1] : null;+};++const isStylesheet = (tag) => attr(tag, 'rel') === 'stylesheet';+const isCrossOrigin = (tag) => /^https?:\/\//.test(attr(tag, 'href') || '');++// A stylesheet only blocks the first paint when its media query matches the+// screen. `media="print"` (flipped to `all` by onload) downloads without+// blocking — the standard non-blocking-CSS pattern.+const isRenderBlocking = (tag) => {+ const media = attr(tag, 'media');+ return media === null || media === 'all' || media === 'screen';+};++describe('client/index.html — boot must not depend on a third-party host', () => {+ it('has no render-blocking cross-origin stylesheet', () => {+ const offenders = activeLinkTags+ .filter((t) => isStylesheet(t) && isCrossOrigin(t) && isRenderBlocking(t))+ .map((t) => attr(t, 'href'));++ expect(offenders).toEqual([]);+ });++ it('loads the Google Fonts stylesheet non-blocking and applies it on load', () => {+ const fontTag = activeLinkTags.find(+ (t) => isStylesheet(t) && (attr(t, 'href') || '').includes('fonts.googleapis.com')+ );+ // The webfonts are optional — if a future change drops them entirely, the+ // guard above still holds and there is nothing left to assert here.+ if (!fontTag) return;++ expect(attr(fontTag, 'media')).toBe('print');+ expect(attr(fontTag, 'onload')).toMatch(/this\.media\s*=\s*'all'/);+ });++ it('keeps a <noscript> fallback so the webfonts still apply without JS', () => {+ const noscript = html.match(/<noscript>(.*?)<\/noscript>/s)?.[1] || '';+ const hasFontLink = /<link\b[^>]*fonts\.googleapis\.com/s.test(noscript);+ const shellHasFonts = html.includes('fonts.googleapis.com/css2');++ expect(hasFontLink).toBe(shellHasFonts);+ });+});