/** * Web shell boot kernel — the face consumed by the apps/web entry. Everything * here is machinery that cannot itself be a loader entry, and none of it * value-imports a plugin package (web2 shell self-sufficiency rule: the * loading page must work while — especially when — plugins fail). The one * sanctioned exception is the modules package (design §4.7 bootstrap * identity): the module system cannot arrive through itself, so its class * and its client-half wrapper are shell-bundled and the kernel adopts its * plugin entry once cordis is up. * * AppWebEntry.run(), module face first, then plugin face: parse * `window.__DSH_BOOT__` into the two-view BootManifest (wire boundary, D16) * → build the module system over the module-view rows → render the loading * page → prefetch every `immediately` row in parallel with mounting the * vendored cordis Loader (internal-seam injection BEFORE any entry exists — * the bare-import fallback in tree.import must never run in a browser) → * await the prefetch tier, THEN adopt the modules entry and create one * loader entry per plugin-view row plus the shell-own app-shell assembly * entry → loader.await() + a full fiber sweep (all ACTIVE, else fail * listing who/what/which service) → flip the settled signal so AppRoot * switches to the real UI in one pass. * * Entry creation waits for the whole immediately tier: materialization runs * synchronous cross-package require edges (e.g. locale → runtime/client) that * fiber inject waiting cannot protect — a bundle's factory must be * registered before any dependent entry materializes. Per-row prefetch * failures still resolve silently (the create-side import refetches and * owns the loud failure), so the barrier never turns one bad bundle into a * boot-wide fail-fast. * * Composition lives in the host graph; the shell makes zero composition * decisions (the app-shell assembly is itself a graph entry, the only * shell-own module registered with the module system). */ import { Context } from 'cordis' import Loader from '@cordisjs/plugin-loader' import { createRoot, type Root } from 'react-dom/client' import * as ModulesClient from '@deepseek-ai/dsh-client-modules/client' import { ClientModuleSystem, parseBootManifest, type BootManifest, type ClientModuleSystemOptions, type DshWindow, } from '@deepseek-ai/dsh-client-modules/client' import * as AppShell from './app-shell.ts' import { APP_SHELL_ID } from './app-shell.ts' import { AppRoot } from './AppRoot.tsx' import { getStaticModules } from './seed.ts' import { STATE_LABELS, createLoaderStatusStore, createSignal } from './loader-status.ts' import './base.css' /** Module transport seams the shell passes through (jsdom tests replace the