Skip to content

v9.0.0

Latest

Choose a tag to compare

@PhucPM89 PhucPM89 released this 30 Nov 08:21
· 5 commits to main since this release

@mosaic/ui v9.0.0 — Generative UI Protocol Engine, LLM Schema Compiler, Live SSE/NDJSON Sessions & Full Hardening

Highlights

1. 3-Tier Generative UI Protocol Architecture (SEP-1865, AG-UI, A2UI)

  • @mosaic/ui/protocol/engine (15.65 KB gzip, zero React): Pure TypeScript engine for backend, Edge, CLI, and Node/Worker runtimes (validateUiProtocol, parseStreamingUiJson, applyProtocolPatch, atomic 6-op RFC-6902 applyStateJsonPatch, createProtocolStore, createProtocolSession, connectProtocolStream, parseProtocolStreamChunk, compileLlmProtocolSchema, adaptA2uiMessage, normalizeBridgeMessage).
  • @mosaic/ui/protocol/core (25.45 KB gzip): Selective block-memoized MosaicCoreRenderer wired to createProtocolStore via useSyncExternalStore + Vietnamese/English ProtocolForm i18n.
  • @mosaic/ui/protocol/host (25.29 KB gzip): Full MCP Apps SEP-1865 host (ui/initialize, tool-input / tool-input-partial, resource-teardown, styles.variables CSS bridge, bidirectional tools/call, ResizeObserver size-changed, useProtocolSession).
  • @mosaic/ui/protocol (58.06 KB gzip): Full 35-node renderer (now including BarList data-viz node) + McpAppHost.

2. Compact LLM Structured-Output Schema Compiler (compileLlmProtocolSchema)

  • compact, openai-strict (root object envelope { root }, strict enum, structured payloadEntries/setStateEntries, null-tolerant validation), and gemini (bounded unified flat schema: 16.37 KB for all 35 nodes, 10.96 KB for 16 nodes — eliminating exponential recursion blowup).
  • Validated directly against Ajv Draft-2020-12 and exposed over MCP via get_llm_schema.

3. Live Agent SSE & A2UI NDJSON Streaming Showcase

  • Zero-dependency HTTP SSE reference server in examples/ai-agent-live-stream/server.mjs streaming STATE_SNAPSHOT, mosaic:render (StatCard + BarList + ToolCallCard), and atomic RFC-6902 STATE_DELTA over GET /api/stream + HITL POST /api/action.
  • Interactive Protocol Sandbox tab in the Workbench (lazy-loaded, Light/Dark WCAG AA verified).

4. Accessibility, RTL, Overlay & Dual-Distribution Hardening

  • 100% className & style prop coverage across all visual UI primitives; kebab-case CLI aliases (mosaic-ui add data-table); mosaic.lock.json isolated to --dest.
  • LIFO Nested Focus Traps & Inert Containers (useFocusTrap.ts) fixing nested modal Tab steal and simultaneous-mount deadlocks.
  • WCAG 1.4.13 Hoverable Tooltip, Popover/HoverCard focus restoration, Toast keyboard-focus pause & role="alert", TreeView logical paddingInlineStart + RTL keyboard inversion + roving tabIndex, PinInput aria-describedby + disabled paste guard, Calendar Vietnamese weekday formatting (T2..T7, CN), CommandPalette/ContextMenu/DropdownMenu IME/typeahead/focus hardening.
  • Forced Colors (@media (forced-colors: active)) fallbacks & @container responsive queries on .ui-mcp-host.
  • Agent Tooling & Security: CSPRNG crypto.randomBytes CSP nonce + escapeStyleTag in VS Code preview extension; strict allowlists and crash-safe timeout cleanup in verify-ui-live.mjs; zero false-positive <Button asChild><a/></Button> & custom use[A-Z]* RSC audit in mosaic-mcp.mjs; 0 test/preview leaks in NPM tarball (354.4 KB, 283 files).

Verification Summary (100% Green)

  • TypeScript (typecheck): PASS (app + lib)
  • Vitest (npm test): 23/23 files, 150/150 tests PASS (incl. real HTTP SSE E2E, Ajv Draft-2020-12, axe-core, MCP live verify)
  • Architecture Gate (verify:arch): 0 hardcoded colors, 0 transition: all, 0 physical RTL CSS, 0 hardcoded z-index, RSC "use client" verified, 0 workbench leaks
  • Bundle Budgets (verify:size): 15/15 PASS (mosaic-ui.js 82.47 KB, protocol-engine.js 15.65 KB, protocol.js 58.06 KB, styles.css 9.53 KB)
  • Consumer Smoke (verify:smoke): 10/10 PASS (packed tarball, 16 ESM subpaths SSR, Tailwind v4 @tailwindcss/vite, starter kit, isolated CLI & MCP)
  • Real Browser WCAG AA (verify:browser): 56 static surfaces + 14 open overlays + RTL + Mobile 375px + CSS @layer + Protocol Sandbox Light & Dark — 0 violations
  • Real Sandboxed Iframe E2E (verify:iframe): <iframe sandbox="allow-scripts"> opaque origin SEP-1865 + ResizeObserver + AG-UI delta PASS
  • Visual Regression (verify:visual): 18/18 win32 surfaces — diff: 0%
  • Real React 18.3.1 Parity: SSR renderToString (14,623 B) + real Chromium E2E (0 console/page errors) PASS

Attached Release Assets

  • mosaic-ui-9.0.0.tgz — Packed @mosaic/ui@9.0.0 library & CLI tarball (354.4 KB)
  • mosaic-ui-preview-9.0.0.vsix — VS Code Live Preview Extension (309.24 KB)
  • workbench-offline.html — Zero-server single-file offline Workbench (617.1 KB)
  • mosaic.registry.json — Machine-readable component AST registry (135 primitives)
  • mosaic.protocol.schema.json — Draft-2020-12 Generative UI Protocol JSON Schema (35 nodes)
  • mosaic.tokens.json — W3C DTCG Design Tokens