Status: Accepted (2026-11-27, revised for ADRs 0019-0022)
The render loop must stay isolated from sync and UI. Server tiers must reuse document rules without pulling in WebGL/DOM, and the realtime tier must never materialize documents.
Allowed imports (anything not listed is forbidden):
| Package | May import | Runtime APIs |
|---|---|---|
| shared | nothing | ES2022 only |
| packages/doc | shared | ES2022 only |
| packages/sync-client | shared, doc | ES2022 + global WebSocket/fetch |
| packages/engine | shared, doc | DOM, WebGL2 |
| packages/editor | shared, doc, engine; sync-client types only (DocSession) |
DOM |
| packages/server-common | shared | Node |
| apps/web | shared, doc, engine, editor, sync-client | DOM |
| apps/realtime | shared, server-common, doc only ScanBatch, StructIndex, structure codec |
Node, uWS.js |
| apps/api | shared, server-common, doc only JSON <-> op helpers | Node |
| apps/docworker | shared, server-common, doc | Node, resvg |
| apps/mcp | shared, doc pure helpers, sync-client connection only | Node |
Rules:
erasableSyntaxOnly everywhere except legacy web code: no enums, namespaces or parameter properties (Node runs .ts unbundled). Use as const objects..ts extensions.DocCore.cols and drainChanges() only.tools/check-deps.mjs (zero-dependency import scanner, including the “only” restrictions via an allow-list of entry files) in npm run check.Client and server validation share one implementation (packages/doc rule tables), and the realtime tier cannot accidentally load a document.