-
Notifications
You must be signed in to change notification settings - Fork 0
summary
Jacob Sampson edited this page Mar 23, 2026
·
1 revision
Auto-generated during canon synthesis. Consumed by agents at branch start. Target: 300–500 tokens. Optimize for density, not readability.
Patchwork is a platform for building generative UI experiences — compile JSX/TypeScript widgets in-browser via esbuild-wasm, mount them with configurable isolation, and connect them to external tool services. Ships as a TypeScript monorepo (pnpm + Turbo) with a VS Code extension and standalone chat app.
- Layered library architecture: independently publishable packages composed by integration surfaces (VS Code extension, chat app)
- Compiler pipeline: Source → VFS → esbuild-wasm + transforms (CDN rewriting, VFS resolution) → ESM bundle → Mount (embedded or iframe with postMessage bridge)
-
ServiceBackend abstraction: all external calls flow through
callProcedure(namespace, procedure, args)— Stitchery aggregates MCP/UTCP tools into a unified service registry - VFS with pluggable backends: Memory, IndexedDB, HTTP — same compiler works in browser, VS Code, and remote contexts; bidirectional sync with explicit conflict resolution
- iframe isolation: widgets sandboxed with configurable permissions; service calls bridged via structured postMessage RPC
-
compiler (
packages/compiler): esbuild-wasm compilation, VFS (3 backends + sync), widget mounting (embedded/iframe + bridge), image/dependency loading, CDN transforms -
bobbin (
packages/bobbin): Visual DOM inspector — element selection, margin/padding overlays, style editing with design tokens, change serialization -
editor (
packages/editor): TipTap markdown editor, code block extraction from markdown, edit sessions (state machine), diff preview, file tree -
patchwork (
packages/patchwork): Service proxy layer —callProcedure,createProxy,ServiceBackendinterface (zero deps) -
stitchery (
packages/stitchery): Backend server — MCP/UTCP tool aggregation, service registry,/api/chat,/api/edit,/api/proxy/*endpoints -
utcp (
packages/utcp): UTCP protocol adapter → ServiceBackend interface -
images/shadcn (
packages/images/shadcn): ShadCN/ui runtime — Tailwind Play CDN injection, CSS variable theming, utility exports -
vscode (
packages/vscode): VS Code extension — TreeProvider, FileSystemProvider, PreviewPanel, embedded Stitchery, Copilot proxy edits -
chat (
apps/chat): Standalone React SPA — Vercel AI SDK (useChat), TipTap input, inline widget preview
- All packages export via single
index.tsbarrel; no cross-package internal imports - Libraries built with
tsup; apps built withvite - React components: PascalCase files; hooks:
useprefix camelCase; utilities: camelCase files - External calls always via
ServiceBackendinterface — never call APIs directly from widgets - File ops always via VFS abstraction — never use
fsdirectly in browser-targeted code - ShadCN/ui (Radix + Tailwind) is the standard component system