@reqvire-org/ads 0.4.7 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (751) hide show
  1. package/README.md +268 -420
  2. package/dist/accessibility-declarations.mjs +43 -0
  3. package/dist/active-clock.d.mts +30 -0
  4. package/dist/active-clock.mjs +26 -17
  5. package/dist/ads-errors.mjs +3684 -0
  6. package/dist/ads-view-choices.mjs +17 -0
  7. package/dist/ads-views.mjs +12 -0
  8. package/dist/analysis/captured-content.mjs +16 -0
  9. package/dist/analysis/compiler-options.mjs +3 -7
  10. package/dist/analysis/context.mjs +14 -20
  11. package/dist/analysis/controller-gates.mjs +119 -0
  12. package/dist/analysis/design-usage.mjs +142 -0
  13. package/dist/analysis/file-tree.mjs +44 -29
  14. package/dist/analysis/framework-imports.mjs +62 -0
  15. package/dist/analysis/glyph-macros.mjs +103 -0
  16. package/dist/analysis/helpers.mjs +119 -91
  17. package/dist/analysis/impact.mjs +25 -12
  18. package/dist/analysis/inputs.mjs +19 -13
  19. package/dist/analysis/mock-check.mjs +99 -0
  20. package/dist/analysis/module-graph.mjs +156 -0
  21. package/dist/analysis/module-resolvers.mjs +30 -28
  22. package/dist/analysis/native-adapter.mjs +139 -146
  23. package/dist/analysis/native-boundary.mjs +52 -0
  24. package/dist/analysis/native-project.mjs +331 -231
  25. package/dist/analysis/native-session.mjs +20 -0
  26. package/dist/analysis/owner-accessibility.mjs +74 -0
  27. package/dist/analysis/owner-analysis-cache.mjs +125 -0
  28. package/dist/analysis/owner-analysis-key.mjs +114 -0
  29. package/dist/analysis/owner-choices.mjs +896 -0
  30. package/dist/analysis/owner-composition.mjs +636 -0
  31. package/dist/analysis/owner-controls.mjs +27 -0
  32. package/dist/analysis/owner-discovery.mjs +164 -0
  33. package/dist/analysis/owner-failures.mjs +19 -0
  34. package/dist/analysis/owner-outcomes.mjs +42 -0
  35. package/dist/analysis/owner-reuse.mjs +100 -0
  36. package/dist/analysis/owner-source.mjs +1555 -0
  37. package/dist/analysis/prose-owners.mjs +57 -0
  38. package/dist/analysis/public-imports.mjs +31 -0
  39. package/dist/analysis/queries.mjs +72 -54
  40. package/dist/analysis/runtime-setters.mjs +114 -0
  41. package/dist/analysis/scenario-keys.mjs +151 -0
  42. package/dist/analysis/service.mjs +111 -70
  43. package/dist/analysis/standalone.mjs +40 -37
  44. package/dist/analysis/styling-ownership.mjs +298 -0
  45. package/dist/analysis/svg-attributes.mjs +199 -0
  46. package/dist/analysis/syntax.mjs +82 -78
  47. package/dist/analysis/visual-bindings.mjs +68 -0
  48. package/dist/analysis/worker-protocol.mjs +302 -0
  49. package/dist/analysis/worker.mjs +234 -166
  50. package/dist/api-signature.mjs +53 -0
  51. package/dist/app-icon-checks.mjs +298 -0
  52. package/dist/app-icon-declaration.d.mts +53 -0
  53. package/dist/app-icon-declaration.mjs +66 -0
  54. package/dist/asset-binding.mjs +35 -0
  55. package/dist/asset-catalog.mjs +83 -0
  56. package/dist/asset-declaration.d.mts +42 -0
  57. package/dist/asset-declaration.mjs +108 -0
  58. package/dist/asset-macro.d.mts +63 -0
  59. package/dist/asset-macro.mjs +22 -0
  60. package/dist/asset-model.mjs +74 -0
  61. package/dist/asset-usage.mjs +14 -0
  62. package/dist/asset-view-facts.mjs +41 -0
  63. package/dist/authoring-macro.d.mts +11 -0
  64. package/dist/authoring-macro.mjs +21 -0
  65. package/dist/autocomplete-hints.mjs +31 -0
  66. package/dist/availability.mjs +9 -0
  67. package/dist/behavior-macro.d.mts +31 -0
  68. package/dist/behavior-macro.mjs +3 -0
  69. package/dist/behavior-registry.mjs +358 -0
  70. package/dist/boundaries.mjs +50 -212
  71. package/dist/browser-runtime.mjs +73 -0
  72. package/dist/browser-test.d.mts +3 -0
  73. package/dist/browser-test.mjs +2 -0
  74. package/dist/bun-bundler.mjs +10 -0
  75. package/dist/bun-compiler.mjs +30 -18
  76. package/dist/bun-runtime.mjs +4 -0
  77. package/dist/bun-worker.mjs +10 -4
  78. package/dist/capture/request.mjs +81 -0
  79. package/dist/capture/worker.mjs +69 -40
  80. package/dist/capture/worker.page.mjs +6 -0
  81. package/dist/capture-store.mjs +159 -75
  82. package/dist/capture.mjs +232 -95
  83. package/dist/check-service.mjs +27 -33
  84. package/dist/check.mjs +206 -904
  85. package/dist/cli-arguments.mjs +278 -0
  86. package/dist/cli.mjs +374 -304
  87. package/dist/color-values.mjs +294 -242
  88. package/dist/composed-contrast.mjs +648 -0
  89. package/dist/composed-keyline.mjs +107 -0
  90. package/dist/config.mjs +162 -468
  91. package/dist/construction-output.mjs +345 -0
  92. package/dist/construction-spec.d.mts +915 -0
  93. package/dist/construction-spec.mjs +1178 -0
  94. package/dist/corner-overpaint.mjs +53 -0
  95. package/dist/css-length.mjs +80 -0
  96. package/dist/css-quantity.mjs +173 -0
  97. package/dist/deletion-model.mjs +56 -0
  98. package/dist/deletion-plan.mjs +364 -0
  99. package/dist/dependency-manifest.mjs +56 -0
  100. package/dist/design-context-model.d.mts +61 -0
  101. package/dist/design-context-model.mjs +79 -0
  102. package/dist/design-contexts.mjs +105 -0
  103. package/dist/design-foundation.mjs +532 -0
  104. package/dist/design-inputs.mjs +156 -0
  105. package/dist/design-modules.mjs +27 -0
  106. package/dist/design-rejection.d.mts +23 -0
  107. package/dist/design-rejection.mjs +29 -0
  108. package/dist/design-system-closure.mjs +108 -0
  109. package/dist/design-usage.mjs +54 -0
  110. package/dist/development-modules.mjs +2 -0
  111. package/dist/development-runtime.mjs +0 -7
  112. package/dist/digest.mjs +2 -0
  113. package/dist/draft-boundary.mjs +1 -27
  114. package/dist/draft-workspace.mjs +11 -5
  115. package/dist/emit/accept.mjs +33 -0
  116. package/dist/emit/app-icon-emission.mjs +124 -0
  117. package/dist/emit/app-icon-render.mjs +126 -0
  118. package/dist/emit/asset-imports.mjs +18 -0
  119. package/dist/emit/cli-report.mjs +97 -0
  120. package/dist/emit/contract.mjs +136 -0
  121. package/dist/emit/emission.mjs +182 -0
  122. package/dist/emit/font-emission.mjs +111 -0
  123. package/dist/emit/foundation-sheet.mjs +56 -0
  124. package/dist/emit/icon-containers.mjs +46 -0
  125. package/dist/emit/integrity.mjs +61 -0
  126. package/dist/emit/lock.mjs +66 -0
  127. package/dist/emit/namespace.mjs +79 -0
  128. package/dist/emit/operation-reply.mjs +3 -0
  129. package/dist/emit/operation.mjs +36 -0
  130. package/dist/emit/output-location.mjs +20 -0
  131. package/dist/emit/output-package.mjs +7 -0
  132. package/dist/emit/owner-emission-cache.mjs +52 -0
  133. package/dist/emit/palette-module.mjs +19 -0
  134. package/dist/emit/palette-refresh.mjs +77 -0
  135. package/dist/emit/preview-emitter.mjs +110 -0
  136. package/dist/emit/preview-tree.mjs +174 -0
  137. package/dist/emit/scheduler.mjs +75 -0
  138. package/dist/emit/service.mjs +249 -0
  139. package/dist/emit/sync.mjs +38 -0
  140. package/dist/emit/watch.mjs +74 -0
  141. package/dist/emit/writer.mjs +102 -0
  142. package/dist/evidence.mjs +6 -8
  143. package/dist/example-babel.mjs +7 -0
  144. package/dist/example-literals.mjs +88 -0
  145. package/dist/finding-rules.mjs +78 -77
  146. package/dist/focus-checks.mjs +93 -0
  147. package/dist/font-checks.mjs +185 -0
  148. package/dist/font-declaration.d.mts +64 -0
  149. package/dist/font-declaration.mjs +99 -0
  150. package/dist/font-fallback.d.mts +37 -0
  151. package/dist/font-fallback.mjs +25 -0
  152. package/dist/font-macro.d.mts +42 -0
  153. package/dist/font-macro.mjs +6 -0
  154. package/dist/font-metrics.d.mts +34 -0
  155. package/dist/font-metrics.mjs +314 -0
  156. package/dist/font-model.mjs +63 -0
  157. package/dist/form-states.mjs +82 -0
  158. package/dist/foundation-macro.d.mts +108 -0
  159. package/dist/foundation-macro.mjs +6 -0
  160. package/dist/frame-regions.mjs +253 -0
  161. package/dist/glyph-set-declaration.d.mts +27 -0
  162. package/dist/glyph-set-declaration.mjs +36 -0
  163. package/dist/grid-checks.mjs +94 -0
  164. package/dist/grid-facts.mjs +148 -0
  165. package/dist/grid-lowering.mjs +263 -0
  166. package/dist/guard/cli.mjs +51 -0
  167. package/dist/guard/config.mjs +67 -0
  168. package/dist/guard/files.mjs +31 -0
  169. package/dist/guard/index.mjs +3 -0
  170. package/dist/guard/run.mjs +56 -0
  171. package/dist/guard/tsconfig.declarations.json +13 -0
  172. package/dist/index.mjs +2 -7
  173. package/dist/init-project.mjs +134 -0
  174. package/dist/init.mjs +217 -264
  175. package/dist/input-digests.mjs +109 -163
  176. package/dist/input-scope.mjs +18 -41
  177. package/dist/inspected-svg.d.mts +28 -0
  178. package/dist/inspected-svg.mjs +40 -0
  179. package/dist/inventories.mjs +149 -0
  180. package/dist/inventory-query.mjs +15 -0
  181. package/dist/investigations.mjs +177 -99
  182. package/dist/json.d.mts +10 -0
  183. package/dist/json.mjs +36 -0
  184. package/dist/linaria/atomic-processor.json +96 -0
  185. package/dist/linaria/atomic-processor.mjs +2452 -0
  186. package/dist/linaria/backend-identity.mjs +26 -0
  187. package/dist/linaria/compatibility.json +61 -0
  188. package/dist/linaria/css-shape.mjs +94 -0
  189. package/dist/linaria/custom-property-css.mjs +56 -0
  190. package/dist/linaria/delivery.mjs +111 -0
  191. package/dist/linaria/direct-extract.mjs +43 -0
  192. package/dist/linaria/extraction-cache.mjs +31 -0
  193. package/dist/linaria/extraction-model.mjs +5 -0
  194. package/dist/linaria/fingerprint.mjs +183 -0
  195. package/dist/linaria/pair-manifest.json +2315 -0
  196. package/dist/linaria/persisted-extraction-cache.mjs +352 -0
  197. package/dist/linaria/preservation.mjs +13 -0
  198. package/dist/linaria/priority-emitted-rank.mjs +40 -0
  199. package/dist/linaria/priority-manifest.mjs +87 -0
  200. package/dist/linaria/priority-table.mjs +47 -0
  201. package/dist/linaria/priority-tiers.mjs +27 -0
  202. package/dist/linaria/processor-host.mjs +42 -0
  203. package/dist/linaria/processor-runtime.mjs +36 -0
  204. package/dist/linaria-processor-NOTICES.md +147 -0
  205. package/dist/lowering-components.mjs +14 -0
  206. package/dist/lowering-effects.mjs +38 -0
  207. package/dist/lowering-emitter.mjs +29 -0
  208. package/dist/lowering-enter.mjs +31 -0
  209. package/dist/lowering-hidden.mjs +30 -0
  210. package/dist/lowering-layer.mjs +141 -0
  211. package/dist/lowering-motion.mjs +37 -0
  212. package/dist/lowering-normalize.mjs +194 -0
  213. package/dist/lowering-overlaps.mjs +328 -0
  214. package/dist/lowering-paint.mjs +32 -0
  215. package/dist/lowering-properties.mjs +165 -0
  216. package/dist/lowering-region-layout.mjs +225 -0
  217. package/dist/lowering-sequence.mjs +89 -0
  218. package/dist/lowering-serialize.mjs +40 -0
  219. package/dist/lowering-session.mjs +137 -0
  220. package/dist/lowering-tiers.mjs +23 -0
  221. package/dist/lowering-transitions.mjs +53 -0
  222. package/dist/mcp/ads-mcp.mjs +423 -0
  223. package/dist/mcp/apps.mjs +3 -25
  224. package/dist/mcp/behavior-pages.mjs +58 -51
  225. package/dist/mcp/build-status.mjs +233 -267
  226. package/dist/mcp/catalog.mjs +21 -128
  227. package/dist/mcp/compiler-channel.mjs +218 -83
  228. package/dist/mcp/context.mjs +50 -40
  229. package/dist/mcp/deletions.mjs +147 -0
  230. package/dist/mcp/draft-discovery.mjs +43 -38
  231. package/dist/mcp/drafts.mjs +635 -691
  232. package/dist/mcp/execution-context.mjs +33 -22
  233. package/dist/mcp/execution-coordinator.mjs +367 -354
  234. package/dist/mcp/execution-results.mjs +440 -173
  235. package/dist/mcp/mutation-limits.mjs +1 -2
  236. package/dist/mcp/mutations.mjs +515 -553
  237. package/dist/mcp/patch.mjs +117 -75
  238. package/dist/mcp/preview-http.bundle.js +3 -7
  239. package/dist/mcp/preview-http.mjs +220 -107
  240. package/dist/mcp/preview-owner-guard.mjs +81 -43
  241. package/dist/mcp/preview-watch.mjs +428 -365
  242. package/dist/mcp/preview-widget.bundle.js +42 -46
  243. package/dist/mcp/preview-work.mjs +25 -13
  244. package/dist/mcp/prompts.mjs +22 -16
  245. package/dist/mcp/resource-loader.js +1 -1
  246. package/dist/mcp/result-pages.mjs +94 -54
  247. package/dist/mcp/sandbox-host.mjs +41 -19
  248. package/dist/mcp/server-discovery.mjs +96 -0
  249. package/dist/mcp/server-guides.mjs +43 -0
  250. package/dist/mcp/server-host.mjs +203 -0
  251. package/dist/mcp/server-observation.mjs +225 -0
  252. package/dist/mcp/server-project.mjs +371 -0
  253. package/dist/mcp/server-resources.mjs +466 -0
  254. package/dist/mcp/server-shared.mjs +79 -0
  255. package/dist/mcp/server-tools.mjs +791 -0
  256. package/dist/mcp/server.mjs +2 -2813
  257. package/dist/mcp/showcase-host.mjs +209 -135
  258. package/dist/mcp/showcase-http.mjs +50 -28
  259. package/dist/mcp/skills.mjs +32 -36
  260. package/dist/mcp/text-diff.mjs +18 -36
  261. package/dist/measured-geometry.mjs +157 -0
  262. package/dist/motion-model.mjs +52 -0
  263. package/dist/non-text-contrast.mjs +118 -0
  264. package/dist/owner-analysis-check.mjs +711 -0
  265. package/dist/owner-design.mjs +15 -0
  266. package/dist/owner-errors.mjs +216 -0
  267. package/dist/owner-lowering.mjs +206 -0
  268. package/dist/owner-scenarios.mjs +854 -0
  269. package/dist/ownership-model.d.mts +6 -0
  270. package/dist/ownership-model.mjs +143 -0
  271. package/dist/package-declarations.mjs +34 -0
  272. package/dist/paint-contrast.mjs +186 -0
  273. package/dist/palette-generated.mjs +101 -116
  274. package/dist/pictogram-model.mjs +13 -51
  275. package/dist/placeholder-contrast.mjs +35 -0
  276. package/dist/platform-features.mjs +401 -0
  277. package/dist/press-scale.mjs +26 -0
  278. package/dist/preview-bun.mjs +334 -404
  279. package/dist/preview-compile-inputs.mjs +78 -0
  280. package/dist/preview-contexts.mjs +7 -0
  281. package/dist/preview-controls.mjs +35 -0
  282. package/dist/preview-failure.mjs +20 -10
  283. package/dist/preview-files.mjs +18 -36
  284. package/dist/preview-imports.mjs +76 -70
  285. package/dist/preview-incremental.mjs +322 -222
  286. package/dist/preview-inputs.mjs +26 -26
  287. package/dist/preview-manifest-update.mjs +67 -49
  288. package/dist/preview-requests.mjs +10 -17
  289. package/dist/preview-resources.mjs +275 -323
  290. package/dist/preview-scope.mjs +15 -17
  291. package/dist/preview-source.mjs +182 -0
  292. package/dist/preview-spatial.mjs +27 -0
  293. package/dist/profile-macro.d.mts +56 -0
  294. package/dist/profile-macro.mjs +6 -0
  295. package/dist/profile-model.d.mts +65 -0
  296. package/dist/profile-model.mjs +213 -0
  297. package/dist/profile-view-facts.mjs +93 -0
  298. package/dist/program-cache.mjs +9 -7
  299. package/dist/project-boundary.mjs +8 -13
  300. package/dist/project-documents.mjs +25 -29
  301. package/dist/property-registrations.mjs +44 -35
  302. package/dist/prose-model.d.mts +81 -0
  303. package/dist/prose-model.mjs +101 -0
  304. package/dist/public-catalog.mjs +76 -0
  305. package/dist/recipe-defaults.mjs +117 -0
  306. package/dist/recipe-macro.d.mts +502 -0
  307. package/dist/recipe-macro.mjs +23 -0
  308. package/dist/recipe-model.d.mts +26 -0
  309. package/dist/recipe-model.mjs +214 -0
  310. package/dist/region-lowering.mjs +723 -0
  311. package/dist/registration-css.mjs +41 -0
  312. package/dist/registration-roles.mjs +35 -0
  313. package/dist/render-audit/axe-run.page.mjs +28 -0
  314. package/dist/render-audit/corner-overpaint.page.mjs +54 -0
  315. package/dist/render-audit/first-render.page.mjs +35 -0
  316. package/dist/render-audit/image-shape.page.mjs +42 -0
  317. package/dist/render-audit/layout-overflow.page.mjs +240 -0
  318. package/dist/render-audit/layout-shift.page.mjs +36 -0
  319. package/dist/render-audit/non-text-contrast.page.mjs +138 -0
  320. package/dist/render-audit/render-states.mjs +66 -293
  321. package/dist/render-audit/render-states.page.mjs +177 -0
  322. package/dist/render-audit/text-scale.mjs +42 -0
  323. package/dist/render-audit/text-scale.page.mjs +25 -0
  324. package/dist/render-audit/worker.mjs +130 -112
  325. package/dist/render-audit/worker.page.mjs +21 -0
  326. package/dist/render-audit.mjs +490 -500
  327. package/dist/resource-limits.mjs +174 -223
  328. package/dist/result.d.mts +34 -0
  329. package/dist/result.mjs +60 -0
  330. package/dist/role-vocabulary.d.mts +260 -0
  331. package/dist/role-vocabulary.mjs +258 -0
  332. package/dist/runtime-paint-contrast.mjs +97 -0
  333. package/dist/runtime-paint.mjs +42 -0
  334. package/dist/runtime-requirements.mjs +10 -11
  335. package/dist/runtime-style.mjs +21 -0
  336. package/dist/scenario-groups.mjs +42 -33
  337. package/dist/scenario-inspector.mjs +4 -4
  338. package/dist/scenario-kit.d.mts +85 -0
  339. package/dist/scenario-kit.mjs +18 -0
  340. package/dist/scenario-registry-model.mjs +2 -0
  341. package/dist/scenario-registry.mjs +89 -108
  342. package/dist/scenarios-compiler.mjs +875 -662
  343. package/dist/scheme-switch.d.mts +8 -0
  344. package/dist/scheme-switch.mjs +1 -0
  345. package/dist/showcase/ads-views.mjs +166 -0
  346. package/dist/showcase/assets-view.mjs +252 -0
  347. package/dist/showcase/client.bundle.js +211 -48
  348. package/dist/showcase/guide-controls.d.mts +28 -0
  349. package/dist/showcase/guide-controls.mjs +31 -0
  350. package/dist/showcase/http-client.bundle.js +172 -9
  351. package/dist/showcase/index.html +1 -1
  352. package/dist/showcase/preview-frame.css +18 -0
  353. package/dist/showcase/preview-frame.d.mts +5 -0
  354. package/dist/showcase/preview-frame.mjs +4 -0
  355. package/dist/showcase/preview-root.d.mts +2 -0
  356. package/dist/showcase/preview-root.mjs +9 -0
  357. package/dist/showcase/profiles-view.mjs +321 -0
  358. package/dist/showcase/project-rules.mjs +9 -0
  359. package/dist/showcase/sandbox.bundle.js +1 -1
  360. package/dist/showcase/scenario-page.d.mts +49 -0
  361. package/dist/showcase/scenario-page.mjs +105 -0
  362. package/dist/showcase/style.css +2 -0
  363. package/dist/showcase/token-sample.mjs +89 -0
  364. package/dist/showcase/tokens-view.mjs +233 -0
  365. package/dist/showcase/ui/apple-touch-icon-9zwv3w79.png +0 -0
  366. package/dist/showcase/{favicon.ico → ui/favicon-c2c9kvtf.ico} +0 -0
  367. package/dist/showcase/ui/icon-192-t5zh7mxx.png +0 -0
  368. package/dist/showcase/ui/icon-512-ed6yz0n0.png +0 -0
  369. package/dist/showcase/ui/ui.css +1 -1353
  370. package/dist/showcase/ui/ui.js +165 -1064
  371. package/dist/showcase-http-routes.mjs +28 -21
  372. package/dist/skills/README.md +28 -28
  373. package/dist/skills/ads-designer/README.md +1 -1
  374. package/dist/skills/ads-designer/SKILL.md +313 -551
  375. package/dist/skills/ads-designer/references/accessibility.md +162 -114
  376. package/dist/skills/ads-designer/references/atomic-styles.md +72 -277
  377. package/dist/skills/ads-designer/references/behaviors.md +144 -280
  378. package/dist/skills/ads-designer/references/branding.md +137 -222
  379. package/dist/skills/ads-designer/references/captures.md +13 -7
  380. package/dist/skills/ads-designer/references/cli.md +80 -63
  381. package/dist/skills/ads-designer/references/contracts.md +225 -286
  382. package/dist/skills/ads-designer/references/design-craft.md +2 -2
  383. package/dist/skills/ads-designer/references/design-data.md +299 -323
  384. package/dist/skills/ads-designer/references/drafts.md +83 -22
  385. package/dist/skills/ads-designer/references/evidence.md +2 -1
  386. package/dist/skills/ads-designer/references/forms.md +199 -0
  387. package/dist/skills/ads-designer/references/guarded-editing.md +37 -48
  388. package/dist/skills/ads-designer/references/layers.md +64 -76
  389. package/dist/skills/ads-designer/references/layout.md +224 -330
  390. package/dist/skills/ads-designer/references/mobile.md +2 -2
  391. package/dist/skills/ads-designer/references/motion.md +66 -25
  392. package/dist/skills/ads-designer/references/performance.md +55 -50
  393. package/dist/skills/ads-designer/references/pictograms.md +62 -127
  394. package/dist/skills/ads-designer/references/recipes.md +368 -0
  395. package/dist/skills/ads-designer/references/review.md +51 -95
  396. package/dist/skills/ads-designer/references/runtimes.md +34 -33
  397. package/dist/skills/ads-designer/references/scenarios.md +256 -216
  398. package/dist/skills/ads-designer/references/stress-test.md +13 -5
  399. package/dist/skills/ads-designer/references/validation.md +28 -21
  400. package/dist/skills/ads-designer/references/workflows.md +7 -5
  401. package/dist/skills/ads-import/SKILL.md +29 -29
  402. package/dist/skills/ads-import/references/atomic-styles.md +72 -277
  403. package/dist/skills/ads-import/references/behaviors.md +144 -280
  404. package/dist/skills/ads-import/references/branding.md +24 -41
  405. package/dist/skills/ads-import/references/captures.md +13 -7
  406. package/dist/skills/ads-import/references/cli.md +80 -63
  407. package/dist/skills/ads-import/references/compatibility.md +3 -3
  408. package/dist/skills/ads-import/references/contracts.md +225 -286
  409. package/dist/skills/ads-import/references/design-data.md +299 -323
  410. package/dist/skills/ads-import/references/drafts.md +83 -22
  411. package/dist/skills/ads-import/references/evidence.md +2 -1
  412. package/dist/skills/ads-import/references/forms.md +199 -0
  413. package/dist/skills/ads-import/references/guarded-editing.md +37 -48
  414. package/dist/skills/ads-import/references/implementation.md +20 -20
  415. package/dist/skills/ads-import/references/layers.md +64 -76
  416. package/dist/skills/ads-import/references/layout.md +224 -330
  417. package/dist/skills/ads-import/references/recipes.md +368 -0
  418. package/dist/skills/ads-import/references/review.md +51 -95
  419. package/dist/skills/ads-import/references/runtimes.md +34 -33
  420. package/dist/skills/ads-import/references/scenarios.md +256 -216
  421. package/dist/skills/ads-import/references/tokens.md +26 -17
  422. package/dist/skills/ads-import/references/validation.md +28 -21
  423. package/dist/skills/ads-import/references/workflows.md +7 -5
  424. package/dist/skills/ads-migrate/SKILL.md +20 -5
  425. package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +6 -0
  426. package/dist/skills/ads-migrate/references/0.4.7-to-0.5.0-boundary.md +71 -0
  427. package/dist/skills/ads-migrate/references/0.4.7-to-0.5.0-grid.md +204 -0
  428. package/dist/skills/ads-migrate/references/0.4.7-to-0.5.0.md +727 -0
  429. package/dist/skills/ads-migrate/references/0.5.0-to-0.5.1.md +239 -0
  430. package/dist/skills/ads-port/SKILL.md +27 -28
  431. package/dist/skills/ads-port/references/atomic-styles.md +72 -277
  432. package/dist/skills/ads-port/references/behaviors.md +144 -280
  433. package/dist/skills/ads-port/references/captures.md +13 -7
  434. package/dist/skills/ads-port/references/cli.md +80 -63
  435. package/dist/skills/ads-port/references/contracts.md +225 -286
  436. package/dist/skills/ads-port/references/design-data.md +299 -323
  437. package/dist/skills/ads-port/references/drafts.md +83 -22
  438. package/dist/skills/ads-port/references/evidence.md +2 -1
  439. package/dist/skills/ads-port/references/forms.md +199 -0
  440. package/dist/skills/ads-port/references/guarded-editing.md +37 -48
  441. package/dist/skills/ads-port/references/layers.md +64 -76
  442. package/dist/skills/ads-port/references/layout.md +224 -330
  443. package/dist/skills/ads-port/references/lint-and-docs.md +2 -3
  444. package/dist/skills/ads-port/references/native-implementation.md +23 -33
  445. package/dist/skills/ads-port/references/recipes.md +368 -0
  446. package/dist/skills/ads-port/references/review.md +51 -95
  447. package/dist/skills/ads-port/references/runtimes.md +34 -33
  448. package/dist/skills/ads-port/references/scenarios.md +256 -216
  449. package/dist/skills/ads-port/references/validation.md +28 -21
  450. package/dist/skills/ads-port/references/workflows.md +7 -5
  451. package/dist/source-inventory.mjs +33 -0
  452. package/dist/source-values.mjs +272 -262
  453. package/dist/spatial-css.mjs +403 -0
  454. package/dist/spatial-metadata.mjs +11 -11
  455. package/dist/spatial-model.mjs +438 -0
  456. package/dist/spatial-reading.mjs +127 -0
  457. package/dist/stage-timing.mjs +27 -0
  458. package/dist/state-conditions.d.mts +80 -0
  459. package/dist/state-conditions.mjs +107 -0
  460. package/dist/static-values.mjs +94 -0
  461. package/dist/surface-contrast.mjs +252 -0
  462. package/dist/surface-effects.mjs +98 -0
  463. package/dist/target-size.mjs +177 -0
  464. package/dist/task-cache.mjs +142 -136
  465. package/dist/task-worker.mjs +18 -18
  466. package/dist/test-boundaries.mjs +50 -189
  467. package/dist/token-checks.mjs +21 -0
  468. package/dist/token-dtcg.mjs +136 -0
  469. package/dist/token-expression.mjs +19 -0
  470. package/dist/token-inventory.mjs +146 -0
  471. package/dist/token-operations.mjs +37 -0
  472. package/dist/token-overlap.mjs +29 -0
  473. package/dist/token-provenance.mjs +260 -0
  474. package/dist/token-references.mjs +71 -0
  475. package/dist/token-registrations.mjs +116 -0
  476. package/dist/token-resolution.mjs +38 -0
  477. package/dist/token-sections.mjs +123 -0
  478. package/dist/token-shapes.mjs +121 -0
  479. package/dist/token-sheet-check.mjs +54 -0
  480. package/dist/token-type-check.mjs +89 -0
  481. package/dist/token-view-facts.mjs +111 -0
  482. package/dist/tsconfig.declarations.json +24 -0
  483. package/dist/types/css-tree.d.ts +45 -0
  484. package/dist/ui-framework.mjs +34 -34
  485. package/dist/units.mjs +186 -226
  486. package/dist/unknown.d.mts +9 -0
  487. package/dist/unknown.mjs +13 -0
  488. package/dist/unreached-sources.mjs +5 -0
  489. package/dist/validation-checks.mjs +62 -71
  490. package/dist/validation-inputs.mjs +209 -279
  491. package/dist/validation.mjs +132 -159
  492. package/dist/verification/browser.d.mts +21 -25
  493. package/dist/verification/browser.mjs +281 -124
  494. package/dist/verification/browser.page.d.mts +22 -0
  495. package/dist/verification/browser.page.mjs +19 -0
  496. package/dist/verification/paint-audit.page.d.mts +55 -0
  497. package/dist/verification/paint-audit.page.mjs +144 -0
  498. package/dist/verification/playwright-reporter.mjs +160 -0
  499. package/dist/verification/preview-startup.d.mts +51 -0
  500. package/dist/verification/preview-startup.mjs +76 -0
  501. package/dist/verification/request.d.mts +28 -0
  502. package/dist/verification/request.mjs +30 -0
  503. package/dist/verification/unit-preload.mjs +37 -0
  504. package/dist/verification.mjs +574 -607
  505. package/docs/ADS.md +585 -565
  506. package/docs/ARCHITECTURE.md +2002 -1384
  507. package/docs/ASSETS.md +487 -0
  508. package/docs/BEHAVIORS.md +339 -370
  509. package/docs/CACHING.md +365 -154
  510. package/docs/CHANGELOG.md +462 -21
  511. package/docs/COMPARISON.md +21 -26
  512. package/docs/DESIGN-REFERENCES.md +40 -27
  513. package/docs/GUIDE.md +2473 -1292
  514. package/docs/LANGUAGE.md +1159 -0
  515. package/docs/LOWERING.md +180 -0
  516. package/docs/MCP.md +1461 -1179
  517. package/docs/MOTION.md +491 -0
  518. package/docs/PROFILE-KINDS.md +544 -0
  519. package/docs/PROFILES.md +176 -0
  520. package/docs/RULES.md +590 -0
  521. package/docs/TOKEN-ROLES.md +377 -0
  522. package/docs/benchmarks/README.md +26 -27
  523. package/package.json +59 -45
  524. package/dist/a11y.mjs +0 -187
  525. package/dist/assets.mjs +0 -159
  526. package/dist/atomic-composition.mjs +0 -337
  527. package/dist/atomic-trace.mjs +0 -162
  528. package/dist/behavior-libraries.mjs +0 -174
  529. package/dist/behaviors.mjs +0 -306
  530. package/dist/brand-assets.mjs +0 -458
  531. package/dist/brands.mjs +0 -141
  532. package/dist/component-contrast.mjs +0 -256
  533. package/dist/construction-styles.cjs +0 -10
  534. package/dist/contracts/foundation.json +0 -211
  535. package/dist/contracts/tokens.json +0 -52
  536. package/dist/contracts.d.mts +0 -30
  537. package/dist/contrast-composition.mjs +0 -80
  538. package/dist/contrast-styles.mjs +0 -88
  539. package/dist/control-padding.mjs +0 -113
  540. package/dist/css-values.mjs +0 -27
  541. package/dist/declarative-flow.mjs +0 -244
  542. package/dist/design-values.mjs +0 -173
  543. package/dist/font-rules.mjs +0 -108
  544. package/dist/fonts-generated.mjs +0 -112
  545. package/dist/foundation-views.mjs +0 -242
  546. package/dist/foundation.mjs +0 -154
  547. package/dist/generated-entries.mjs +0 -198
  548. package/dist/html.mjs +0 -30
  549. package/dist/icons.mjs +0 -154
  550. package/dist/image-attributes.mjs +0 -187
  551. package/dist/image-size.mjs +0 -28
  552. package/dist/layers.mjs +0 -461
  553. package/dist/layout-widths.mjs +0 -332
  554. package/dist/linaria/atomic-css.cjs +0 -2
  555. package/dist/linaria/atomic-styled.cjs +0 -2
  556. package/dist/linaria/preserve-values.cjs +0 -58
  557. package/dist/linaria/spatial-inputs.cjs +0 -56
  558. package/dist/linaria.d.mts +0 -1
  559. package/dist/linaria.mjs +0 -9
  560. package/dist/lockup-composition.mjs +0 -44
  561. package/dist/lockup-model.cjs +0 -64
  562. package/dist/paint-contracts.mjs +0 -216
  563. package/dist/pictograms.mjs +0 -52
  564. package/dist/public-api.mjs +0 -121
  565. package/dist/public-props.mjs +0 -91
  566. package/dist/render-audit/axe-run.mjs +0 -17
  567. package/dist/render-audit/first-render.mjs +0 -40
  568. package/dist/render-audit/image-shape.mjs +0 -46
  569. package/dist/render-audit/layout-overflow.mjs +0 -167
  570. package/dist/render-audit/layout-shift.mjs +0 -32
  571. package/dist/render-audit/non-text-contrast.mjs +0 -151
  572. package/dist/render-audit/pictograms.mjs +0 -88
  573. package/dist/render-color-probe.mjs +0 -202
  574. package/dist/render-composition.mjs +0 -186
  575. package/dist/runtime-contracts.mjs +0 -506
  576. package/dist/scenario-program.mjs +0 -19
  577. package/dist/scenario-selectors.mjs +0 -237
  578. package/dist/scenario-slots.mjs +0 -217
  579. package/dist/scenario-trace.mjs +0 -314
  580. package/dist/scenarios-vite.d.mts +0 -2
  581. package/dist/scenarios-vite.mjs +0 -2
  582. package/dist/scenarios.mjs +0 -616
  583. package/dist/selector-match.mjs +0 -94
  584. package/dist/showcase/comparison.js +0 -48
  585. package/dist/showcase/connection.js +0 -10
  586. package/dist/showcase/draft-navigation.js +0 -59
  587. package/dist/showcase/foundation-view.css +0 -58
  588. package/dist/showcase/foundation-view.mjs +0 -255
  589. package/dist/showcase/guide-controls.ads.review.mjs +0 -32
  590. package/dist/showcase/http-connection.js +0 -86
  591. package/dist/showcase/http-preview.js +0 -81
  592. package/dist/showcase/icons.js +0 -2
  593. package/dist/showcase/navigation.js +0 -13
  594. package/dist/showcase/pictogram-view.mjs +0 -53
  595. package/dist/showcase/preview-frame.ads.review.css +0 -46
  596. package/dist/showcase/preview-frame.ads.review.d.mts +0 -11
  597. package/dist/showcase/preview-frame.ads.review.mjs +0 -22
  598. package/dist/showcase/preview-state.js +0 -11
  599. package/dist/showcase/refresh-scheduler.js +0 -23
  600. package/dist/showcase/resource-reader.js +0 -37
  601. package/dist/showcase-coverage.mjs +0 -139
  602. package/dist/source-symbols.mjs +0 -4
  603. package/dist/spatial-composition.mjs +0 -322
  604. package/dist/spatial-contexts.cjs +0 -56
  605. package/dist/spatial-css.cjs +0 -351
  606. package/dist/spatial-inputs.cjs +0 -80
  607. package/dist/spatial-model.cjs +0 -322
  608. package/dist/spatial.mjs +0 -21
  609. package/dist/stage-timing.cjs +0 -21
  610. package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +0 -105
  611. package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +0 -275
  612. package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +0 -7
  613. package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +0 -10
  614. package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +0 -8
  615. package/dist/starters/preact/ds.config.json +0 -37
  616. package/dist/starters/preact/package.json +0 -35
  617. package/dist/starters/preact/src/vite-env.d.ts +0 -7
  618. package/dist/starters/preact/tsconfig.json +0 -35
  619. package/dist/starters/preact/vite.config.ts +0 -23
  620. package/dist/starters/react/ADS.md +0 -286
  621. package/dist/starters/react/README.md +0 -184
  622. package/dist/starters/react/biome.css.json +0 -21
  623. package/dist/starters/react/design-system/assets/brand/README.md +0 -41
  624. package/dist/starters/react/design-system/assets/brand/app-icon.svg +0 -4
  625. package/dist/starters/react/design-system/assets/brand/logo.dark.svg +0 -6
  626. package/dist/starters/react/design-system/assets/brand/logo.svg +0 -6
  627. package/dist/starters/react/design-system/assets/glyphs/README.md +0 -15
  628. package/dist/starters/react/design-system/assets/glyphs/aliases.json +0 -1
  629. package/dist/starters/react/design-system/assets/glyphs/check.svg +0 -1
  630. package/dist/starters/react/design-system/assets/glyphs/chevron-down.svg +0 -1
  631. package/dist/starters/react/design-system/assets/glyphs/chevron-right.svg +0 -1
  632. package/dist/starters/react/design-system/assets/glyphs/close.svg +0 -1
  633. package/dist/starters/react/design-system/assets/glyphs/external-link.svg +0 -1
  634. package/dist/starters/react/design-system/assets/glyphs/info.svg +0 -1
  635. package/dist/starters/react/design-system/assets/glyphs/menu.svg +0 -1
  636. package/dist/starters/react/design-system/assets/glyphs/plus.svg +0 -1
  637. package/dist/starters/react/design-system/assets/glyphs/search.svg +0 -1
  638. package/dist/starters/react/design-system/assets/glyphs/warning.svg +0 -1
  639. package/dist/starters/react/design-system/assets/pictograms/catalog.ads.json +0 -13
  640. package/dist/starters/react/design-system/assets/pictograms/journey.dark.svg +0 -7
  641. package/dist/starters/react/design-system/assets/pictograms/journey.svg +0 -7
  642. package/dist/starters/react/design-system/components/Actions/Button/Button.ads.exports.ts +0 -1
  643. package/dist/starters/react/design-system/components/Actions/Button/Button.ads.fixture.ts +0 -1
  644. package/dist/starters/react/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -13
  645. package/dist/starters/react/design-system/components/Actions/Button/Button.tsx +0 -56
  646. package/dist/starters/react/design-system/components/Actions/Button/README.md +0 -12
  647. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.exports.ts +0 -1
  648. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.fixture.ts +0 -9
  649. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.scenario.tsx +0 -16
  650. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +0 -60
  651. package/dist/starters/react/design-system/components/Actions/IconButton/README.md +0 -17
  652. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.exports.ts +0 -1
  653. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.fixture.ts +0 -6
  654. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.scenario.tsx +0 -16
  655. package/dist/starters/react/design-system/components/Content/Icon/Icon.tsx +0 -42
  656. package/dist/starters/react/design-system/components/Content/Icon/README.md +0 -17
  657. package/dist/starters/react/design-system/components/Content/Icon/glyphs.ts +0 -17
  658. package/dist/starters/react/design-system/components/Content/Image/Image.ads.exports.ts +0 -1
  659. package/dist/starters/react/design-system/components/Content/Image/Image.ads.fixture.ts +0 -2
  660. package/dist/starters/react/design-system/components/Content/Image/Image.ads.scenario.tsx +0 -13
  661. package/dist/starters/react/design-system/components/Content/Image/Image.tsx +0 -51
  662. package/dist/starters/react/design-system/components/Content/Image/README.md +0 -20
  663. package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.exports.ts +0 -1
  664. package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.fixture.ts +0 -1
  665. package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.scenario.tsx +0 -12
  666. package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +0 -35
  667. package/dist/starters/react/design-system/components/Content/Logo/README.md +0 -12
  668. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.exports.ts +0 -1
  669. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.fixture.ts +0 -1
  670. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.scenario.tsx +0 -7
  671. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.tsx +0 -26
  672. package/dist/starters/react/design-system/components/Forms/TextField/README.md +0 -14
  673. package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.exports.ts +0 -1
  674. package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.fixture.ts +0 -6
  675. package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -13
  676. package/dist/starters/react/design-system/components/Forms/TextField/TextField.tsx +0 -61
  677. package/dist/starters/react/design-system/composition/Search/SearchPage/README.md +0 -4
  678. package/dist/starters/react/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +0 -7
  679. package/dist/starters/react/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +0 -16
  680. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/README.md +0 -5
  681. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.fixture.ts +0 -13
  682. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.scenario.tsx +0 -22
  683. package/dist/starters/react/design-system/controllers/Palette/Palette.ads.exports.ts +0 -1
  684. package/dist/starters/react/design-system/controllers/Palette/Palette.ts +0 -164
  685. package/dist/starters/react/design-system/index.ts +0 -12
  686. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.exports.ts +0 -1
  687. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.fixture.ts +0 -7
  688. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.scenario.tsx +0 -15
  689. package/dist/starters/react/design-system/patterns/Conversation/Conversation.tsx +0 -105
  690. package/dist/starters/react/design-system/patterns/Conversation/README.md +0 -9
  691. package/dist/starters/react/design-system/patterns/Search/SearchBar/README.md +0 -12
  692. package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.exports.ts +0 -1
  693. package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +0 -1
  694. package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +0 -11
  695. package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.tsx +0 -41
  696. package/dist/starters/react/design-system/patterns/Shell/Floating.ads.fixture.ts +0 -5
  697. package/dist/starters/react/design-system/patterns/Shell/Floating.ads.scenario.tsx +0 -21
  698. package/dist/starters/react/design-system/patterns/Shell/README.md +0 -43
  699. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.exports.ts +0 -1
  700. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.fixture.ts +0 -5
  701. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +0 -21
  702. package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +0 -274
  703. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +0 -1
  704. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.review.tsx +0 -7
  705. package/dist/starters/react/design-system/review/index.ads.review.ts +0 -4
  706. package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.exports.ts +0 -1
  707. package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.review.tsx +0 -6
  708. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +0 -1
  709. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +0 -10
  710. package/dist/starters/react/design-system/showcase/mcp/main.ads.mount.tsx +0 -10
  711. package/dist/starters/react/design-system/styles.css +0 -7
  712. package/dist/starters/react/design-system/tokens/base.css +0 -36
  713. package/dist/starters/react/design-system/tokens/catalog.ads.json +0 -1221
  714. package/dist/starters/react/design-system/tokens/colors.css +0 -215
  715. package/dist/starters/react/design-system/tokens/elevation.css +0 -53
  716. package/dist/starters/react/design-system/tokens/spacing.css +0 -87
  717. package/dist/starters/react/design-system/tokens/spatial.ads.json +0 -70
  718. package/dist/starters/react/design-system/tokens/themes.generated.css +0 -142
  719. package/dist/starters/react/design-system/tokens/themes.generated.ts +0 -402
  720. package/dist/starters/react/design-system/tokens/typography.css +0 -31
  721. package/dist/starters/react/ds.config.json +0 -37
  722. package/dist/starters/react/gitignore.template +0 -8
  723. package/dist/starters/react/package.json +0 -39
  724. package/dist/starters/react/scripts/build-mcp-previews.mjs +0 -3
  725. package/dist/starters/react/src/vite-env.d.ts +0 -7
  726. package/dist/starters/react/tsconfig.build.json +0 -20
  727. package/dist/starters/react/tsconfig.json +0 -34
  728. package/dist/starters/react/vite.config.ts +0 -23
  729. package/dist/style-boundaries.mjs +0 -106
  730. package/dist/style-token-rules.mjs +0 -51
  731. package/dist/themes-generated.mjs +0 -161
  732. package/dist/themes-watch.mjs +0 -83
  733. package/dist/themes.mjs +0 -360
  734. package/dist/token-export.mjs +0 -94
  735. package/dist/token-origins.mjs +0 -24
  736. package/dist/token-policy.mjs +0 -26
  737. package/dist/token-quality.mjs +0 -149
  738. package/dist/token-samples.mjs +0 -19
  739. package/dist/tokens.mjs +0 -194
  740. package/dist/unit-contracts.mjs +0 -396
  741. package/dist/usage.mjs +0 -184
  742. package/dist/verification/playwright-reporter.cjs +0 -87
  743. package/docs/CONTRACTS.md +0 -285
  744. package/docs/HTTP-SHOWCASE-POC.md +0 -397
  745. package/docs/SPATIAL-CHECKS.md +0 -69
  746. package/docs/benchmarks/http-showcase-optimized.json +0 -1879
  747. package/docs/benchmarks/http-showcase-profile.json +0 -308
  748. package/docs/benchmarks/http-showcase.json +0 -3069
  749. /package/dist/{starters/react/design-system/assets/fonts/.gitkeep → analysis/semantic.mjs} +0 -0
  750. /package/dist/{starters/react/design-system/controllers/.gitkeep → lowering-model.mjs} +0 -0
  751. /package/dist/showcase/{favicon.svg → ui/favicon-scavmehf.svg} +0 -0
@@ -1,590 +1,829 @@
1
1
  # Architecture
2
2
 
3
- ADS makes shared design standards a tooling contract while keeping UI source in
4
- the project. Coding agents can build and evolve that source directly; the tools
5
- keep changes within a defined architecture. The project owns its components,
6
- patterns, token values, and branding.
3
+ ADS makes shared design standards a tooling contract and keeps the UI source in
4
+ the project. Coding agents build and change that source directly. The tools
5
+ keep each change inside a defined architecture. The project owns its components,
6
+ patterns, token values and branding.
7
7
 
8
8
  ADS manages project-owned UI for websites and MCP Apps. Both use the same public
9
9
  components, patterns, controllers, tokens and styles. The consuming application
10
- supplies data, actions, mounting and integration, including serving its MCP Apps.
11
- The ADS showcase renders those real implementations in isolated HTTP frames; its previews
12
- and registered checks provide evidence for the exercised states and conditions.
13
- Normal application checks verify website integration.
14
-
15
- This document explains the what, why, and high-level how. [ADS.md](ADS.md) defines
16
- the enforceable contract, [GUIDE.md](GUIDE.md) covers tool integration, and the
17
- [starter/playground guide](../starters/README.md) covers implementation details.
10
+ supplies data, actions, mounting and integration, and serves its own MCP Apps.
11
+ The ADS showcase renders the real implementations in isolated HTTP frames. Its
12
+ previews and registered checks are evidence for the states and conditions they
13
+ exercise. Normal application checks verify website integration.
14
+
15
+ This document explains the what, the why and the high-level how.
16
+ [ADS.md](ADS.md) defines the enforceable contract. [GUIDE.md](GUIDE.md) covers
17
+ tool integration, configuration and commands. [MCP.md](MCP.md) covers the MCP
18
+ surface. Component-local READMEs cover APIs, lifecycle, tests and provenance.
19
+
20
+ ## ADS closes what it has to prove
21
+
22
+ **ADS closes a form where a proof depends on understanding it, and reports what
23
+ it cannot evaluate.** This is the rule behind every check and every change to
24
+ them. It decides, for each thing an author can write, whether an unlisted form
25
+ is an error or a review item.
26
+
27
+ - **A proof depends on the form: closed.** The form is a finite list. An
28
+ unlisted form is an **error** that names the supported forms. The remedy is
29
+ an ADS change that adds the form with its grammar, checks, lowering,
30
+ documentation and tests. Recipe and profile fields, `when` selectors, token
31
+ roles, breakpoint units, and the colour, shadow and gradient forms a token
32
+ reference may sit in are closed. Each has positions with different meanings,
33
+ and ADS cannot say what belongs where in a form it does not know.
34
+ - **No proof depends on the form: open, and reported.** The value is accepted,
35
+ every rule that still applies is enforced, and what ADS cannot evaluate is a
36
+ **review item**, never silently passed. A token's own numeric value is open:
37
+ a reference in it follows one contract (its own role, or `spacing` where that
38
+ route exists) inside any CSS function. So `env(safe-area-inset-left,
39
+ var(--space-4))` or a function a browser shipped last month needs no ADS
40
+ release. Its role is still checked; its value is reviewed as unevaluable.
41
+
42
+ So a new CSS function is usable in a token's numeric value at once, and inside
43
+ a colour, shadow or gradient only once ADS lists it. See
44
+ [the token-role reference](TOKEN-ROLES.md#functions-a-token-value-may-use).
45
+
46
+ For ADS development this means:
47
+
48
+ - Before closing a form, name the proof that needs it. Do not close a form for
49
+ uniformity: a refusal that proves nothing only blocks valid design.
50
+ - Before leaving a form open, confirm that nothing ADS guarantees reads through
51
+ it, and that the unevaluable case is reported.
52
+ - A closed form has no "for now" fallback for unlisted input. In review, a new
53
+ permissive branch inside a closed form is a defect, and so is a new refusal
54
+ with no proof behind it.
55
+ - An agent or developer who meets a refusal in a project uses a supported form,
56
+ which the error names. If the design needs the unlisted one, that is an ADS
57
+ change to request, not a check to work around.
18
58
 
19
59
  ## Shared tooling, project-owned design
20
60
 
21
- Skills ship in the package and are served as an immutable snapshot, each file under
22
- `skill://ads/<name>/`. Connections on protocol `2026-07-28` get the skills extension: entries with
23
- verbatim frontmatter and complete manifests, each digest computed from the bytes served, and directory
24
- reads. Earlier connections get the same files as ordinary resources and through tools. ADS serves
25
- content; verification, approval and activation belong to the host.
26
-
27
- The shared layer supplies architectural rules, token definitions, checks,
28
- skills, and setup. Components, patterns, themes, and examples are authored in
29
- the project or brought in through explicit imports and adaptations.
30
-
31
- This lets standards evolve without tying the product's UI to a centrally
32
- distributed component catalogue. A project can change its implementation,
33
- branding, or external dependencies while retaining compatible contracts.
34
- Tool updates preserve local values and customized source; content updates have
35
- their own reviewed lifecycle.
36
-
37
- ADS is opinionated about tooling and ownership. Linaria is required for the
38
- component and pattern styling pipeline. Visual choices belong to the project.
39
- ADS's tools run on Bun 1.4.1+ and compile MCP previews independently of the
40
- application's build tools. The project may use Node or Bun: what it imports from
41
- ADS in its own build, lint or Playwright specs works under Node. Project scripts
42
- and behavior profiles retain their explicit interpreter commands; `command:
43
- "runtime"` runs on ADS's Bun. This tooling choice is separate
44
- from the UI framework and adds no Node/Bun dependency to deployed components.
61
+ The shared layer supplies the architectural rules, the authoring macros, the
62
+ compiler, the checks, the skills and the setup. The project authors its
63
+ components, patterns, themes and examples, or brings them in through explicit
64
+ imports and adaptations.
65
+
66
+ This split lets standards change without a centrally distributed component
67
+ catalogue. A project can change its implementation, branding or external
68
+ dependencies and keep compatible contracts. A tool update preserves local values
69
+ and customized source. A content update has its own reviewed lifecycle.
70
+
71
+ ADS is opinionated about tooling and ownership, not about visual choices:
72
+
73
+ - Design is declared through ADS's typed macros. ADS compiles it into plain
74
+ modules and CSS.
75
+ - Visual choices belong to the project.
76
+ - ADS's tools run on Bun 1.4.1 or later. ADS compiles MCP previews
77
+ independently of the application's build tools.
78
+
79
+ ### ADS is self-sufficient
80
+
81
+ ADS needs nothing from the project to do its job:
82
+
83
+ - ADS ships its own Playwright. Playwright's own installer installs the browser
84
+ on first need.
85
+ - ADS runs unit specs with its own Bun and browser.
86
+ - ADS runs strict specs with its own Playwright test runner.
87
+ - ADS takes no command, runner or framework from configuration. A project
88
+ setting can only tune ADS (a budget, a browser choice).
89
+
90
+ ### The design system is its own package
91
+
92
+ The design system is a folder with its own `package.json`, `ds.config.json`,
93
+ `tsconfig.json` and `design-system/`, where ADS is a development dependency.
94
+ Applications consume its emitted output and never install ADS. Several
95
+ applications install the design package as a copy (git reference, tarball or
96
+ registry) and get its committed `dist/`. One application can instead keep the
97
+ design package in a folder and have it emit into the application's source. The
98
+ [guide](GUIDE.md#set-up-a-design-package) covers both layouts.
99
+
100
+ Either way the emitted modules resolve the framework from the application's own
101
+ `node_modules`, so there is one React (or Preact). A copy carries none of the
102
+ design package's development dependencies, and output in the application's
103
+ source resolves upward from there.
104
+
105
+ The design package declares what its output imports: `dependencies`, and
106
+ `peerDependencies` for what the application must share.
107
+ `package-dependency-undeclared` checks it, and `ads-dependencies.json` lists it
108
+ for the application.
109
+
110
+ What an application imports from ADS in its own build works under Node. The Bun
111
+ tooling choice is separate from the UI framework and adds no Node or Bun
112
+ dependency to deployed components.
113
+
114
+ ### Frameworks
115
+
116
+ The project declares its framework in `ds.config.json`: React or native Preact.
117
+ The framework's own JSX runtime and hooks module type the owners, emission
118
+ writes its JSX runtime, and a package of the other framework is an error.
119
+ Additional frameworks need explicit tooling support.
120
+
121
+ The package ships no design system. `ads init --framework react` (or
122
+ `preact`), run inside an existing project, writes the configuration and the
123
+ dependencies and creates an empty design-system folder for the project to
124
+ author in. It never replaces a project file, edits `.gitignore` or writes a
125
+ lockfile.
126
+
127
+ ADS tests itself with one example design system, written for React
128
+ (`tests/fixtures/starter-project/`). The build writes its declared file set
129
+ and, through an overlay (`tests/helpers/starter/starter-overlay.mts`), a native
130
+ Preact copy of the same source to `.ds/test-starters/`, outside the package;
131
+ the overlay stops the build on a React API without a declared Preact
132
+ counterpart. The tests install it after `ads init`
133
+ (`tests/helpers/starter-project.mjs`).
134
+
135
+ ### No production runtime
45
136
 
46
- ### Semantic analysis
137
+ ADS checks run during development and builds. The tool adds no production UI
138
+ runtime.
139
+
140
+ The ownership boundaries preserve the project's optimization strategy. Lazy
141
+ loading, code splitting, memoized data, caching, worker execution and
142
+ cancellable work can stay behind public APIs. A shared screen pattern does not
143
+ require eager loading of its renderer, and application services do not move
144
+ into the design system.
145
+
146
+ ## Tokens, profiles and recipes
147
+
148
+ Design moves through four kinds of source. Each has one job:
149
+
150
+ | Source | Defines |
151
+ | --- | --- |
152
+ | Role token sheets (`tokens/<group>/<role>.ads.css`) | Shared primitive and semantic values; the filename declares the role |
153
+ | Profiles (`profiles/<group>/*.ads.ts`) | Named, typed combinations of token values for one design responsibility, with explicit composition |
154
+ | Recipes (`recipe()`, `combineRecipes()` in a component or pattern) | Owner-local construction: frame, arrangement, parts and alignment, selecting profiles |
155
+ | `foundation.ads.ts` | The document's text, surface and reset, and the design system's themes and brands |
156
+
157
+ TypeScript beside a recipe handles markup and behavior. Asset declarations
158
+ (`assets/<group>/*.ads.ts` beside their SVG drawings) give artwork a shared
159
+ identity, paint contract, variants and optical anchors.
160
+
161
+ Every declaration uses a typed Bun macro from `@reqvire-org/ads`: `recipe`,
162
+ `profile`, `asset`, `font` or `foundation`. A `font()` declaration beside its
163
+ files makes a font family part of the design system.
164
+
165
+ Recipes select profiles and use closed structural choices. Mocks under
166
+ `mocks/` are mocks of the application's screens: they render public components
167
+ and patterns with explicit props and carry no design, not even through
168
+ profiles. The part of their check that concerns design use
169
+ (`src/analysis/design-usage.mts`) is pure and knows nothing about mocks, so an
170
+ application's own source can later be checked with the same code.
171
+
172
+ Groups organize files and showcase navigation. They are not reference
173
+ namespaces: profile names are globally unique, and references cross groups
174
+ without imports.
175
+
176
+ ### Themes, brands and input modality are token contexts
177
+
178
+ Token sheets set default values on `:root`. A theme or brand sets values again
179
+ on `:root[data-theme="…"]`, `:root[data-brand="…"]` or both. Themes and brands
180
+ are only value sets over the same token names. A theme sets the color mode and
181
+ a brand sets identity values. So a white-label product needs one brand per
182
+ customer, not one theme per customer and mode.
183
+
184
+ `foundation.ads.ts` declares the themes and brands in order; the first is the
185
+ default. It is the one list that checks, previews, the render audit, capture
186
+ and `ads_status` read.
187
+
188
+ Input modality is also a token context, not a recipe construct. A token sheet
189
+ that overrides size tokens under `@media (pointer: coarse)` gives touch screens
190
+ larger controls the same way `:root[data-theme]` gives a theme its colours.
191
+ The token checks evaluate the overrides of each `@media`/`@supports` condition
192
+ crossed with every theme and brand (`tokenDefinitionContexts`,
193
+ `src/design-foundation.mts`). So target size, contrast and token types are
194
+ proven for touch values too, and emission carries the overrides unchanged.
195
+ Owners read the same tokens and need no modality branch.
196
+
197
+ ### Theme and brand sections
198
+
199
+ Themes and brands are also ADS's subtree mechanism. With
200
+ `foundation({ sections: true })`, `data-theme` or `data-brand` on any element
201
+ switches every token below it. A dark footer on a light page is a nested theme
202
+ section, not a parallel set of "on dark" tokens or component variants.
203
+
204
+ A theme is the unit for sections because it is the unit the checks prove. Every
205
+ token sheet value is evaluated, and the contrast of every surface pair is
206
+ proven, in each theme, brand and brand × theme context. A section can therefore
207
+ only select a context whose whole colour mode already passes. ADS has no finer
208
+ construct, such as a surface that sets the colours its descendants read
209
+ (selected rows, tinted banners): it would need its own context in those proofs.
210
+ Explicit choices on the child cover those cases.
211
+
212
+ Sections are opt-in because of their cost: the section rules add CSS to every
213
+ owner sheet, and a design system that switches only `<html>` gains nothing from
214
+ them.
215
+
216
+ Authors write the contexts on `:root` only; emission applies them to sections
217
+ (`src/token-sections.mts`). The flag is part of the declared contexts, so it is
218
+ in the foundation's identity and an edit re-emits every sheet. Without the flag
219
+ the emitted bytes carry no toggle, section rule or section `color-scheme`.
220
+
221
+ Every rule of `foundation.css` that sets `color-scheme` (the `:root` default,
222
+ `:root[data-theme]`, a section when sections are declared, and
223
+ `:root:not([data-theme])` under the OS preference) also writes the two scheme
224
+ switches (`src/scheme-switch.mts`): in a light scope `--ads-not-light: initial`
225
+ and `--ads-not-dark: none`, in a dark scope the reverse. `initial` makes a
226
+ custom property guaranteed-invalid, so `display: var(--ads-not-light, block)`
227
+ is `block` in a light scope and `none` in a dark one. Each scope writes both
228
+ because custom properties inherit. A visual part's `scheme` lowers to that
229
+ display (`src/region-lowering.mts`); the switch is the construction's own
230
+ property (`Output.own`), not a token of the owner sheet's closure.
231
+
232
+ - **Toggles.** Selectors cannot find the nearest ancestor on two independent
233
+ axes, so each axis travels as inherited toggle custom properties:
234
+ `--ads-theme-dark`, `--ads-brand-iris`, and `--ads-root-theme` for the base.
235
+ - **Selecting a state.** A section with the attribute, or the root without it
236
+ (following `followSystemTheme`), sets that state's toggle to the
237
+ guaranteed-invalid `initial` and the axis's other toggles to the empty value.
238
+ - **Alternatives.** One zero-specificity rule on `[data-theme], [data-brand]`
239
+ declares each context-dependent token, and each token that reads one, as one
240
+ alternative per state: `var(--ads-theme-dark, <dark value>)`. Theme
241
+ alternatives nest inside brand ones for a token that varies with both. Only
242
+ the selected state's fallback substitutes.
243
+ - **Values.** The values are written on the section element, so a token that
244
+ reads another resolves with the section's values. They are the cascade the
245
+ root gets (`contextDefinitions`, the same values the checks evaluate).
246
+ Conditional overrides sit in their own section rule under the same at-rules.
247
+ - **Reset.** The default theme and brand select the base state, so a default
248
+ section inside another context resets.
249
+ - **Placement.** Every owner sheet carries the toggles and section rules of its
250
+ own token closure, as it carries its root token rules. `foundation.css` adds
251
+ each theme's `color-scheme` on sections.
252
+
253
+ The namespaced emission (the showcase UI drawn inside a project's preview)
254
+ writes no section rules: the hosting document's sections belong to the project.
255
+
256
+ ### Token provenance
257
+
258
+ Token provenance is an authored-edge check. It is separate from
259
+ context-dependent value evaluation.
260
+
261
+ - `src/token-references.mts` owns the parsed expression and reference facts per
262
+ immutable foundation.
263
+ - `src/token-provenance.mts` applies role routes and operation/composite
264
+ positions to every declaration and fallback.
265
+ - `src/token-operations.mts` shares operation syntax between provenance and
266
+ emission. Value resolution and invariant quantum checks stay with their input
267
+ adapters.
268
+
269
+ The check needs no filesystem or semantic query. `tokenChecks()` caches the
270
+ report with the foundation. An owner edit reuses the report; changed captured
271
+ token bytes form a new foundation.
272
+
273
+ A reference that is declared nowhere uses the `token-css/token-missing`
274
+ identity, also for unused definitions. Derivative display duplicates are
275
+ suppressed. In inventories, shape facts stay unresolved; they are not labeled
276
+ valid.
277
+
278
+ ### What an owner declares
279
+
280
+ Components and patterns cannot author design measurements, paints or local
281
+ token aliases, and cannot read tokens directly.
282
+
283
+ **Runtime values.** What an owner can only know at runtime is declared in its
284
+ recipe:
285
+
286
+ - `measured` geometry, such as the position of an anchored popup or the track
287
+ of a splitter.
288
+ - `paints` chosen from data among a finite set of paint-role tokens, such as a
289
+ chart series.
290
+
291
+ Each compiles to an owner-private custom property that the owner writes through
292
+ a typed setter. The values therefore stay inside the checks: the property list,
293
+ profile conflicts, and the contrast of every declared paint.
294
+
295
+ **Interaction properties.** These are compile-time recipe fields with no
296
+ runtime:
297
+
298
+ - The `normalize` of a root or part declares a cursor, touch action or text
299
+ selection from a closed set.
300
+ - The arrangement of a scrolling element declares scroll snap.
301
+
302
+ Analysis reads them from the captured source, and lowering writes them as
303
+ ordinary atomic declarations.
304
+
305
+ **Runtime state.** Runtime state enters in two ways only. The owner's own state
306
+ attribute selects a `when` variant that is compiled beforehand
307
+ (`&[data-dragging="true"] > .grip`). The measured setters carry the geometry
308
+ that a drag computes.
309
+
310
+ **Scroll snap.** Snap follows ownership. The scrolling element takes
311
+ `scroll-snap-type`. The children it places take `scroll-snap-align` from its
312
+ arrangement, as a grid places its cells. A child never snaps itself.
313
+
314
+ **Root press.** A root press (`transition: ["scale"]` with the `scale` endpoint
315
+ of a root `when` entry) lowers like a glyph's press and joins the root's
316
+ transition set. Its review, `review/press-scale-large-surface`
317
+ (`src/press-scale.mts`), is the one press check that reads token values. It
318
+ reads them only for a `frame: "container"` root that presses. Other owners stay
319
+ token-independent, so their analyses survive token edits.
320
+
321
+ **Sequences.** A `sequence` profile's steps are profile clauses
322
+ (`ads-step at-<n>`), like a spatial profile's breakpoints, so composition and
323
+ selection work unchanged. `src/lowering-sequence.mts` is pure: it turns the
324
+ selected steps into keyframes (mirrored for right-to-left when a step travels
325
+ inline), the `animation-*` writes and the reduced-motion rule, and names the
326
+ properties it animates so `partPlays` (`src/region-lowering.mts`) can refuse a
327
+ second source of motion for one property. Keyframes are named by their content
328
+ (`keyframesName`), so parts with equal steps share one rule; the session keeps
329
+ them through `writeKeyframes`. Script-defined animation is refused by
330
+ `scriptAnimations` (`src/analysis/styling-ownership.mts`), which resolves each
331
+ `animate` / `setKeyframes` call and `new Animation` / `new KeyframeEffect`
332
+ through the checker so that a project function of the same name is not
333
+ reported.
334
+
335
+ **Prose.** `src/prose-model.mts` is the closed set: element names, their tags,
336
+ the browser defaults replaced, and which element can contain which. A prose
337
+ root is a region whose `RegionSpec.prose` holds the declared elements;
338
+ `lowerProse` (`src/region-lowering.mts`) writes one rule per tag with the
339
+ selector `& <tag>:not([class])`, a descendant selector the overlap check
340
+ already reasons about by element type, and proves contrast with
341
+ `paintContrast` over the token contexts, so a prose owner that declares a
342
+ colour is token-dependent. The markup checks need to know prose owners without
343
+ the owner analysis: `src/analysis/prose-owners.mts` reads them syntactically
344
+ from the barrel's re-exports and each file's own `recipe({ layout: "prose" })`
345
+ literal, in the captured revision. Emission writes that map as
346
+ `ads-prose.json`; the design-use library reads it beside the entry file,
347
+ because an emitted owner carries no recipe.
348
+
349
+ **Entrances.** `enter` on a region root, a region part or a control root is
350
+ parsed into an `EnterSpec` (`src/construction-spec.mts`) that carries its
351
+ driver as a union with one member today, `first-render`; a driver started by an
352
+ owner state or by the scroll position joins that union without changing what
353
+ authors wrote. `src/lowering-enter.mts` is pure: it returns the first style
354
+ (`@starting-style`, repeated under each state surface that writes the same
355
+ property), the transition group, and whether the element enters blurred.
356
+ `writeEnter` (`src/construction-output.mts`) resolves the profiles and writes
357
+ the first style; the caller adds the group to the element's one transition set
358
+ (`transitionSetRules`), whose reduced-motion rule zeroes durations and never
359
+ the starting values, as the layer motion does. `settled` adds a zero blur to
360
+ the surfaces of an element that enters blurred and casts a shape or group
361
+ shadow, so its filter lists keep one shape and interpolate. The recipe model
362
+ carries the entrance as an `ads-enter` clause (`src/recipe-model.mts`,
363
+ validated in `src/ownership-model.mts`).
364
+
365
+ **Surface effects.** `src/surface-effects.mts` owns the surface fields that are
366
+ not paints of the element's box: `blur`, `shapeShadow`, `groupShadow`,
367
+ `backdropBlur` and `backdropSaturate`. It is pure. A profile keeps them as
368
+ separate fields; the one writer of rules (`output().rule` in
369
+ `src/construction-output.mts`) composes those of a rule into `filter` and
370
+ `backdrop-filter` (with `-webkit-backdrop-filter` before it) in a fixed order,
371
+ so every construction that applies a surface lowers them the same way; a grid's
372
+ own rule, which is a tree and not a rule write, calls the same function.
373
+ `checkSurfaceEffects` runs where a construction selects its surfaces (region
374
+ root and parts, control, grid) and knows the place: a visual part or a
375
+ container. It rejects a misplaced shape or group shadow, and reads token values
376
+ only for a surface that declares one, to prove its token is one
377
+ `drop-shadow()` layer in every token context. So only those owners become
378
+ token-dependent. The paint-transition channels `filter` and `backdrop-filter`
379
+ (`src/lowering-transitions.mts`) each cover the fields composed into that
380
+ property.
381
+
382
+ ### Composed contrast
383
+
384
+ Another owner often paints the backdrop of the text an owner renders.
385
+ `component-contrast` (`src/composed-contrast.mts`) checks text against the
386
+ backdrop it is rendered on. [ADS.md](ADS.md#composed-text-contrast) defines the
387
+ rule and its unresolved cases. This section explains how owners stay
388
+ independent.
389
+
390
+ **Composition facts.** Each owner's checked outcome carries plain composition
391
+ facts (`src/analysis/owner-composition.mts`), read from its captured AST after
392
+ its analysis accepted it:
393
+
394
+ - Every text position, prop it renders in place and component placement.
395
+ - The owned elements above each, in every reachable choice, enumerated jointly
396
+ over what those elements read: their surface profiles by name, text fields,
397
+ top-layer or covering-cell flow, `hidden`, `aria-disabled`, `disabled` and
398
+ `data-theme`.
399
+ - The literal arguments of each placement.
400
+
401
+ The child records what it offers; the parent records what it renders. No
402
+ owner's analysis reads another's facts. So no owner key gains another owner's
403
+ dependency (unlike the public rows `alignRows` reads), and owners stay
404
+ token-independent. A failed owner contributes no facts; its own error fails the
405
+ check.
406
+
407
+ **The join.** A revision-level join in the revision's memoized check follows
408
+ each text outward through slots and placements, and onto the document surface
409
+ for every component the barrel exports. It resolves the colour and backdrop in
410
+ every token context through the shared paint mechanism
411
+ (`src/paint-contrast.mts`). An element's `data-theme`/`data-brand` restricts its
412
+ subtree to that context only when the foundation declares `sections: true`;
413
+ either way `foundation.css` repaints the element with the document surface.
414
+
415
+ **Boundaries.** A boundary is a placement above which neither paint is known.
416
+ A pair that the elements below a boundary decide is checked; a side that
417
+ reaches it is `component-contrast-unresolved` at the placement.
418
+
419
+ - A component of the placing owner's own file is expanded only when its facts
420
+ show it passes its children through: it renders `children` in place, passes
421
+ it on, or spreads its props into a placement. Any other same-file component
422
+ ends the chain at its placement.
423
+ - Plain modules record no composition facts, only the design-system components
424
+ their markup places. These are read from the revision's program beside the
425
+ other plain-module checks, each revision, so no owner outcome changes. The
426
+ join ends those components' chains at each such placement.
427
+
428
+ A native control's pair is the user agent's, and skipped, only when neither its
429
+ colour nor any background between the text and its fill comes from the design
430
+ system.
431
+
432
+ ### Data and behavior ownership
433
+
434
+ Business data is a separate input. Each layer owns one kind of responsibility:
435
+
436
+ | Layer | Owns |
437
+ | --- | --- |
438
+ | Component | One cohesive UI capability: control semantics, input handling, focus, accessibility and state mechanics |
439
+ | Pattern | Reusable layout and mock: it arranges capabilities into a reusable structure or workflow |
440
+ | Application container | Domain data, routing, application effects and callbacks, supplied through public APIs |
441
+ | Application adapter | Live business-data loading, authentication, stores, routing, caching and refresh policy |
442
+
443
+ Import count, element count and implementation size do not decide the layer.
444
+
445
+ Components and patterns receive typed inputs and callbacks. They can invoke an
446
+ injected callback or service to request work, and present its loading and error
447
+ state. The consumer keeps ownership of the data source.
448
+
449
+ UI mechanics stay with their owner. Lazy implementation imports, asset loading,
450
+ measured geometry and cancellable layout workers are compatible with this
451
+ boundary.
452
+
453
+ A visual change preserves the interaction contract unless the behavior is
454
+ changed deliberately. A disabled control stays disabled across themes and
455
+ brands. A field keeps its label association and error semantics.
456
+
457
+ When a project adapts external UI, it uses its own text, spacing and other
458
+ profiles even when their values differ from the reference. It adds a shared
459
+ role or profile only for a missing design decision, and documents intentional
460
+ visual differences. Acceptance checks required behavior and project
461
+ consistency. Exact upstream pixels apply only when explicitly requested.
462
+
463
+ ## Owners compile to plain modules
464
+
465
+ `ads check` analyzes every owner the public barrel reaches, on one captured
466
+ revision. It reads the design inputs and type-checks the owners. It analyzes,
467
+ lowers and compiles each construction. Then it resolves the token CSS that the
468
+ construction uses.
469
+
470
+ Lowering turns a recipe into atomic declarations through one typed emission
471
+ boundary. The boundary rejects unregistered properties and normalizes competing
472
+ writes.
473
+
474
+ ### Extraction
475
+
476
+ ADS extracts the declarations to classes with the processor of
477
+ `@linaria/atomic`, called directly on the resolved CSS (`src/linaria/`). No
478
+ project module is generated, transformed or evaluated, and there is no
479
+ build-time tag resolver.
480
+
481
+ The processor runs only inside ADS's process:
482
+
483
+ - The build bundles the processor, with exactly the modules it imports, into
484
+ `dist/linaria/atomic-processor.mjs` (`scripts/linaria-processor-bundle.mjs`).
485
+ The published package therefore depends on no `@linaria` package.
486
+ - `postcss` stays external and resolves to ADS's own pinned dependency.
487
+ - The bundle reads no files and no environment. The package index of
488
+ `@wyw-in-js/shared` (with its module-resolution helpers) is replaced by the
489
+ five members the processor imports, and `debug` by a silent logger.
490
+ - A manifest beside the bundle records its SHA-256 and the reviewed fingerprint
491
+ of the bundled packages (`src/linaria/compatibility.json`).
492
+ - A source checkout loads the installed package instead of the bundle.
493
+
494
+ Extraction results are cached in memory and on disk
495
+ ([caching](CACHING.md#persisted-extraction-cache)).
496
+
497
+ ### Text layout
498
+
499
+ Text layout is part of lowering. It is decided at compile time without text
500
+ measurement:
501
+
502
+ - Wrapping.
503
+ - Balanced or pretty line breaks (`text-wrap`).
504
+ - One-line truncation.
505
+ - A multi-line clamp (`line-clamp` beside the `-webkit-box` form that browsers
506
+ implement).
507
+ - Reserved lines (`min-block-size` in `lh` of the part's own line height).
508
+
509
+ Each property is registered in the emission inventory
510
+ (`src/lowering-properties.mts`). `text-wrap` is a progressive enhancement: a
511
+ browser without it wraps normally, so ADS writes no fallback.
512
+
513
+ ADS cannot know the length of a text. So the cut-off content of a clamp is a
514
+ review fact: the full text must stay reachable. The rule against a clamp on a
515
+ control or its label reads the rendered elements in owner analysis.
516
+
517
+ ### What `ads emit` writes
518
+
519
+ `ads emit` writes what the check compiled ([file list](ADS.md#emission)). Each
520
+ owner's module has its class expressions replaced by compiled classes and a
521
+ side-effect import of its own stylesheet. `fonts.ts` is the declared fonts'
522
+ preload list. `app-icons.ts` holds the application icon's link tags and
523
+ manifest icons. `ads-contract.json` records every emitted file's digest and the
524
+ platform features the emitted CSS uses.
47
525
 
48
- ADS semantic analysis uses its own pinned TypeScript 7.1 beta asynchronous
49
- native API from Bun. Analysis, orchestration and preview compilation all run on
50
- Bun; registered application commands retain their explicit runtimes. Generated
51
- applications retain their TypeScript 5.9.3 dependency and their own `tsc`; ADS's
52
- compiler is a separate nested package when necessary.
526
+ The output is plain TypeScript and CSS that an application builds with its own
527
+ bundler and without ADS. ADS owns the output folder, never reads it as an input,
528
+ writes only changed files and swaps the tree in whole. The
529
+ [guide](GUIDE.md#emitting-the-design-system) covers the folder, watch mode and
530
+ exit codes.
53
531
 
54
- `src/analysis/service.mjs` is the shared asynchronous entry point for acceptance,
55
- architecture checks, scenario/catalog discovery, tokens, behavior planning and
56
- audit selection. Each calling ADS process shares a Bun child host with plain-data IPC. That host
57
- serializes analysis requests and owns bounded native project sessions. One job
58
- is an inspection/check/selection request that may inspect many files. Independent
59
- native queries inside it can share pending promises and be batched.
60
- Rendering and registered test commands execute outside this service.
61
-
62
- Each project keeps an immutable live snapshot. Drafts branch from it using file
63
- deltas; acceptance promotes the checked revision, while rejection releases it.
64
- Sibling drafts cannot alter each other, and a changed live generation prevents
65
- stale promotion. Project input bytes are captured during the existing validation
66
- inventory read. Imported dependencies, missing resolution targets, configuration
67
- and package changes invalidate the compiler state. Content fences remain required
68
- around operations that can overlap filesystem edits; timestamps alone never
69
- establish freshness. The beta compiler's unsafe program-removal operation is
70
- avoided by bounded snapshot compaction within the same compiler process.
71
- Relocated AST wrappers belong to a live project or one draft, rather than a
72
- global map of draft paths. Unchanged live trees keep their identity across
73
- revisions; releasing a draft releases its wrapper cache. Promotion creates live
74
- paths without mutating trees already returned to draft callers.
75
-
76
- Production acceptance registers the candidate's file delta against its live
77
- project before checking. The architecture guard, contract discovery and affected
78
- selection use that branch through the shared analysis service. Successful source
79
- publication promotes the checked snapshot; rejected, abandoned and temporary
80
- branches are released. Configured scripts and browser evidence remain separate
81
- acceptance stages and retain their own source-freshness requirements.
82
-
83
- Rules must use `analysis/helpers.mjs` for `sourceAst`, `sourceText`, `symbolAt`,
84
- `valueSymbolAt`, `localValueDeclarations`, `walk`, `findNode`, `nodesOfKind`, `memoFact` and `memoProgram`. Program acquisition
85
- goes through `cachedProgram`; import resolution goes through `importResolver`.
86
- With fixed compiler options, import resolution shares normalized specifiers by
87
- importing directory, including pending queries from sibling files. Its cache
88
- belongs to the current inventory/request; a new capture resolves against current
89
- package/configuration bytes and cannot inherit an earlier resolution by path alone.
90
- Input capture shares compiler options and the import resolver with configuration
91
- discovery. `analysis/module-resolvers.mjs` owns native resolver leases for that
92
- capture, including pending queries; cleanup drains them on success or failure.
93
- The syntax client stays alive until the capture releases its leases. No resolver
94
- that observes the live filesystem survives into the next capture.
95
- Warm checks collect compiler source bytes while computing the task input key and
96
- pass them through `analyzeCaptured`; registered draft branches remain authoritative.
97
- The independent post-check input capture still verifies freshness before caching
98
- the report. Draft preparation similarly shares one inventory between inspection
99
- and workspace population, retaining its targeted live conflict/path checks.
100
- `render-composition.mjs` reuses the captured native program and `createSourceValues`
101
- for owned JSX, component calls, props and classes. Its pending/completed graph is weakly
102
- memoized by immutable program, so sibling drafts and edited imports do not share mutable
103
- render facts. It does not execute project code or open another compiler. The contrast
104
- adapter consumes the CSS trees already parsed by the check, resolves ancestor backdrops
105
- and caches identical token-pair calculations within the check. It reports incomplete
106
- cascade/branch evidence explicitly; browser axe audits retain dynamic rendering coverage.
107
- Class choices stay factored in the immutable render graph. The contrast adapter compares
108
- all alternatives' paint facts without enumerating their Cartesian product; layout-only
109
- choices can retain a known ancestor backdrop. Captured selector targets distinguish inert
110
- class hooks from possible paint overrides. Native type queries identify string/number
111
- text slots without treating arbitrary React/Preact children as plain text.
112
- Optional inputs and immediate directory membership use `optionalSourceText` and
113
- `sourceDirectoryFiles`; both observe the captured revision, including absence.
114
- `sourceCss` shares read-only PostCSS trees across requests on the same captured revision; transforms clone
115
- before modifying them. Spatial guards and foundation discovery use
116
- `spatial.mjs` over these helpers. The pure `spatial-model.cjs` compiler does no
117
- filesystem I/O. `spatial-inputs.cjs` retains a bounded cache of immutable models
118
- by contents, without branch paths or ASTs. Linaria's build adapter captures at
119
- the build/extraction boundary, and Bun previews track spatial contents and token
120
- sheet membership, including layouts introduced by evaluated interpolations.
121
- `spatial-contexts.cjs` validates bounded conditional token graphs and shares immutable
122
- context models. `spatial-css.cjs` normalizes supported ordinary CSS placement and protects
123
- generated geometry. Its bounded 256-entry cache contains only immutable selector-text
124
- facts, including finite functional branches and attribute targets; it retains no source
125
- trees or project paths. Keyframe effects join the same target/property checks.
126
- `spatial-composition.mjs` binds those facts to existing native JSX
127
- nodes and owned component calls; it creates no compiler or independent syntax tree.
128
- Standalone extraction checks algebra; acceptance adds the owned composition evidence.
129
-
130
- The spatial design and starter defaults draw on IBM Carbon's 2x Grid. The
131
- [design references](DESIGN-REFERENCES.md) record adopted concepts, the consulted
132
- source revision, and attribution boundaries. ADS's compiler and analysis services
133
- are separate from Carbon's Sass/React grid packages; consumers own their definitions.
134
-
135
- File-local accessibility and image-attribute checks consume the main check's source
136
- inventory and captured native ASTs. Their findings are memoized by immutable source
137
- tree; they create no separate syntax parser or filesystem scan. Font checking and
138
- preload generation share captured CSS trees and parsed face facts. Token values,
139
- current preload configuration and actual style uses are evaluated separately on
140
- each operation, so changing a consumer or theme cannot reuse an unrelated result.
141
- Optional text (including absence) and CSS trees have weak captured-revision ownership;
142
- new revisions invalidate them, while repeated reads on the same revision share data.
143
-
144
- Do not create compiler programs, native clients, path-keyed semantic caches or
145
- independent AST parsers in new rules. `memoFact` lives for one fenced request;
146
- `memoProgram` is only for facts determined by an immutable program/tree or captured
147
- revision, with weak ownership. Return
148
- copies when exposing cached mutable results. A boundary test prevents rule modules
149
- from constructing programs or importing native transports. Library inspection
150
- APIs are asynchronous and use the same native session implementation. Await
151
- `checkProject`, `inspectTokens`, contract/scenario inspection and import
152
- resolution. Direct library callers acquire a context through `standalone.mjs`;
153
- they do not select a different engine. Syntax-only work uses the native API's
154
- bounded source-file leases. There is one compiler implementation.
155
-
156
- Semantic calls go through `analysis/queries.mjs`, which shares pending promises
157
- and batches independent symbol/type queries. Await source and semantic lookups;
158
- ordinary syntax predicates remain synchronous. Use the ordered async traversal
159
- and collection helpers when callbacks perform semantic work, so short-circuit
160
- checks and diagnostic order remain deterministic.
161
- Use `walkValuesAsync` for CSS values: returning false prunes that function's
162
- children. `walkAsync` follows PostCSS's different contract, stopping the walk.
163
- Resolve named subjects through `localValueDeclarations` instead of enumerating
164
- all symbols in scope. Resolving declarations for a global symbol inventory can
165
- load the compiler libraries unnecessarily and exhaust memory.
166
-
167
- `bun run test:analysis` verifies native analysis, cache invalidation, production
168
- draft acceptance and computed-CSS compilation without browser rendering or
169
- registered behavior execution. The [analysis benchmark](../scripts/benchmarks/analysis/README.md)
170
- runs the current engine serially with correctness assertions and time/memory
171
- regression gates when a compatible baseline is supplied. Its acceptance fixtures
172
- disable scripts, registered behavior execution and rendering so measurements
173
- include input capture, branching, guards and publication without browser work.
174
- [AGENTS.md](../AGENTS.md#mandatory-analysis-benchmarks) requires both inventory
175
- sizes for relevant changes. Browser and component behavior suites remain
176
- separate from these engine measurements.
177
-
178
- Changed-scope validation follows shared source trees and native import resolution.
179
- Its successful full baseline also retains plain dependency closures, so later
180
- selection includes consumers from both the previous and current revisions.
181
- Deleted inputs without previous evidence, unknown ownership, computed imports
182
- and shared configuration widen selection conservatively. This selects what to
183
- audit; it does not replace browser evidence or grant a passing result.
184
- The project declares React or native Preact in `ds.config.json` and uses the
185
- matching compiler and mount adapter. Both integrate with the required styling
186
- and validation pipeline; additional frameworks need explicit tooling support.
187
-
188
- A design system can start from the starter that ships inside the same ADS package:
189
- `ads init --framework react|preact --include-starter`, run inside an existing project, adds
190
- `dist/starters/react` and its generated Preact overlay
191
- where the project has nothing, so it always matches the tool version that checks it. It
192
- never replaces a project file or writes a lockfile. Skills carry no starter copy; they
193
- point agents to `ads init --include-starter`. The starter is a working base: a
194
- token foundation in six groups (color ramps with AA-checked roles, type,
195
- space and sizing, shape and elevation, motion, layout with a column grid), brand artwork
196
- with Brand previews, an icon set, and one example of each layer.
532
+ ### The foundation has a narrow styling role
197
533
 
198
- ADS checks run during development and builds. The tool adds no production UI
199
- runtime. Its ownership boundaries preserve a project's optimization strategy:
200
- lazy loading, code splitting, memoized data, caching, worker execution, and
201
- cancellable work can remain behind public APIs. Sharing a screen pattern does
202
- not require eager loading of its renderer or moving application services into
203
- the ADS. Validate these properties when migrating an existing application.
204
-
205
- ## Data, UX, and Skin
206
-
207
- Every UI implementation has three cooperating responsibilities:
208
-
209
- | Pillar | Defines | Implemented through | Result |
210
- |--------|---------|---------------------|--------|
211
- | **Data** | Design values, semantic roles, and their relationships | Shared token definitions with project-owned values and themes | A consistent visual vocabulary |
212
- | **UX** | Structure, behavior, accessibility, states, and layout | Markup, interaction logic, and structural styles in components and patterns | Operable controls and reusable compositions |
213
- | **Skin** | Visual identity and the appearance of each state or variant | Token-backed styles composed with the UX structure | The project's visual treatment |
214
-
215
- The separation makes each decision's purpose clear while keeping related code
216
- together. A button gets its dimensions and colors from Data, its native semantics
217
- and focus behavior from UX, and its fills, borders, and typography from Skin.
218
- A form group or application shell applies the same model to composition.
219
-
220
- ### Data gives implementations a common language
221
-
222
- Data includes both primitive values and semantic roles. A color ramp describes
223
- available values; a surface or accent token describes their intended use.
224
- Typography, spacing, elevation, and motion follow the same principle.
225
-
226
- Projects share compatible token names, meanings, types, and relationships while
227
- choosing their own values. Stable names let implementations move between
228
- projects without importing an unrelated brand. Themes evolve by changing
229
- values behind those names, and visual formulas have one source of truth.
230
-
231
- The shared foundation is the only design-value catalogue. Components and patterns
232
- map its roles into owned `--ds-*` and `--ux-*` variables; these namespaces cannot
233
- introduce independent design values. Raw literals hidden by aliases, fallbacks,
234
- themes or static helper/import interpolation follow the same source checks.
235
- Every interpolated alternative must resolve. The checker deduplicates known
236
- values and checks all resulting styles; unknown alternatives and work-limit
237
- exhaustion produce a blocking `design-value-source` finding. A template may
238
- produce at most 256 distinct styles, including combinations of interpolations;
239
- larger constructions must be split into smaller styles, never silently sampled.
240
- Runtime measurements and typed instance paints retain narrow, explicit contracts.
241
- When adapting external UI, use the project's existing font, text, spacing and
242
- other semantic roles even when their values differ from the reference. Add a
243
- shared role only for a missing design decision, and document intentional visual
244
- differences. Equal values alone do not prove equivalent roles: duplicate shared
245
- definitions invite review; ownership and value-source violations are errors.
246
- Ports should converge on that shared vocabulary, consolidating equivalent roles
247
- introduced by their source dependencies. Acceptance checks required behavior and
248
- project consistency; exact upstream pixels apply only when explicitly requested.
249
-
250
- ### UX owns the interaction contract
251
-
252
- Components own control semantics, input handling, focus, accessibility, and
253
- state mechanics. Patterns own reusable layout and composition. Application
254
- containers provide domain data, routing, application effects, and callbacks through public
255
- APIs.
256
-
257
- A component provides one cohesive UI capability. A pattern arranges capabilities
258
- into a reusable structure or workflow; a layout part may arrange content slots.
259
- Components may compose other components/controllers, and patterns may compose
260
- patterns. Import count, element count and implementation size do not decide the
261
- layer. Scenarios may compose public UI and development review helpers to demonstrate their
262
- subject without becoming production patterns.
263
-
264
- Patterns are production application UI. The showcase owns generic preview UX:
265
- navigation, theme/viewport controls, framing and hosting inside the App iframe.
266
- Projects supply `.ads.scenario.*` demonstrations and `.ads.fixture.*` inputs for
267
- the actual production implementation. Small project-specific arrangements
268
- and demonstration controls use `.ads.review.*` files. `review/`
269
- is an optional organizational home for shared helpers, not another production
270
- UI layer or an exemption from the filename marker. Its generated helper entry is
271
- `review/index.ads.review.ts`, imported through `@ds/review`.
272
-
273
- The tool-owned `@reqvire-org/ads/preview` API supplies generic frame classes and
274
- mount containers; project framework adapters use `.ads.mount.*`. Its development-only
275
- `setPreviewGuides(options)` and `observePreviewGuides(listener)` helpers let a
276
- composed inspection toolbar control the managed preview’s existing guide overlay.
277
- Choices are a `mode` (`off`, `hover` or `always`: where guides show) and boolean
278
- layers (`bounds`, `tracks`, `gaps`, `padding`, `margins`, `mini`: what they draw);
279
- the observer receives the current choices immediately and returns an unsubscribe
280
- function. The App forwards edits to its host, which retains them across views and
281
- synchronizes other controls. This does not create a second overlay or a production
282
- layout dependency. Neither this
283
- preview API nor marked project code/styles may enter production dependencies.
284
- Review helpers retain public product-contract and style checks. They reuse
285
- production tokens unchanged; literal width/height and grid-track dimensions are
286
- permitted only for isolated demonstration geometry. Colors, typography, spacing
287
- and component states remain governed by production Data and owners. Showcase-only
288
- values do not belong in the production token foundation. See the
289
- [scenario support guide](../skills/ads-designer/references/review.md).
290
-
291
- Core guards reject component runtime dependencies on patterns/composition through
292
- resolved imports, re-exports and helpers. Patterns consume public component
293
- contracts rather than private implementation symbols or rendered style hooks;
294
- documented non-state customization variables remain available. Source tracing
295
- distinguishes styling a private part from reading ancestor context for the
296
- pattern's own arrangement. Application and development dependencies retain their
297
- separate boundaries. The portable skill-local [layer guide](../skills/ads-designer/references/layers.md)
298
- explains repairs and analysis limits; semantic classification still needs review.
299
-
300
- The Data pillar describes design values; business data is a separate input to
301
- the UX contract. Application adapters own live business-data loading,
302
- authentication, stores, routing, caching and refresh policy. Components and
303
- patterns receive typed inputs and callbacks. They may invoke an injected
304
- callback or service to request work and present its loading/error state, while
305
- the consumer retains ownership of the data source. They do not bind themselves
306
- to a product backend or application provider.
307
-
308
- UI mechanics remain with their owner: lazy implementation imports, asset
309
- loading, measured geometry and cancellable layout workers are compatible with
310
- this boundary. Separating business-data access does not require moving renderer
311
- work into the application or sacrificing performance.
312
-
313
- A visual change should preserve the interaction contract unless behavior is
314
- deliberately changed. A disabled control remains disabled across skins; a field
315
- keeps its label association and error semantics. Keeping this policy with its
316
- owner prevents consumers from creating conflicting versions of the same UI.
317
-
318
- ### Skin applies identity to that structure
319
-
320
- Skin maps the visual vocabulary to the structure and its states. Visual
321
- variants reuse the same UX implementation when their behavior is the same.
322
-
323
- Broad identity changes flow through token values. Changes to a particular
324
- control's treatment live with that control as a supported variant. Changes to
325
- layout or interaction also involve UX. Some decisions span all three pillars:
326
- motion uses Data for timing, UX for when transitions happen, and Skin for their
327
- visual expression.
328
-
329
- ## Linaria is the implementation mechanism
330
-
331
- Linaria connects these responsibilities in the component and pattern styling
332
- pipeline. The starter has one authored `starters/shared/` design with generated
333
- native React/Preact imports and configuration. Both runtimes are supported: the project
334
- chooses its rendering runtime, while ADS checks the same architecture and serves
335
- its actual compiled scenarios. A React application remains React; MCP does not
336
- substitute a different runtime or a visual reproduction.
337
-
338
- The choice serves both architecture and performance:
339
-
340
- | Reason | How it supports ADS |
341
- |--------|--------------------|
342
- | **Colocation and ownership** | Structural UX styles, Skin styles, and modifiers remain distinct local blocks beside their behavior. A change has one reviewable owner. |
343
- | **Explicit composition** | Atomic styles assemble a UX base, visual treatment, and size/state variants with precedence for matching declarations. Different visual variants can reuse the same UX implementation. |
344
- | **Less browser work** | Style templates become CSS at build time, avoiding render-time CSS generation, serialization, and stylesheet injection for those styles. |
345
- | **Independent CSS caching** | Extracted CSS can be delivered and cached separately from JavaScript. With stable content-hashed assets and suitable cache headers, unchanged CSS can be reused across code changes. |
346
- | **Bundle optimization** | Colocated style dependencies and static extraction let build tooling analyze usage and remove unreachable code and styles. The result depends on references, extraction, and side-effect configuration. |
347
- | **Declaration reuse** | Atomic extraction can deduplicate identical declarations across components and combinations, reducing repeated CSS. |
348
- | **Token-driven themes** | The browser applies theme values to already compiled rules. Changing token values does not need a runtime CSS generator. |
349
- | **Inspectable policy** | Source checks inspect Linaria templates alongside their owner for token use and ownership violations before bundling. |
350
-
351
- Linaria's [colocation and extraction model](https://github.com/callstack/linaria/blob/master/docs/BENEFITS.md)
352
- and [atomic composition model](https://github.com/callstack/linaria/blob/master/docs/ATOMIC_CSS.md)
353
- support this combination of local ownership and compiled styling.
354
-
355
- CSS file count is an output detail, not an ownership boundary. The native preview
356
- compiler attaches extracted styles after JavaScript tree shaking, retaining only
357
- owners whose generated classes survive in that chunk. Foundation CSS loads first
358
- to preserve cascade-layer declarations. Owner styles and fonts have separate,
359
- immutable resource identities, so unchanged CSS survives JavaScript edits and can
360
- be reused by multiple views. A shared JavaScript chunk can carry styles for its
361
- shared owners; this is not selector-level pruning of every unused variant. The
362
- compiler does not inject one whole-system stylesheet into every preview. Product
363
- builds keep their own bundler's splitting and caching policy.
364
-
365
- Atomic merging matches property/selector/condition keys; it does not resolve
366
- every shorthand/logical-property overlap. ADS reports detectable composition
367
- risks as nonblocking review items with guidance, while registered rendered checks
368
- can enforce actual geometry. See the skill-local
369
- [atomic style composition guide](../skills/ads-designer/references/atomic-styles.md).
370
- Bounded source tracing follows local class helpers and explicit component
371
- `className` forwarding to DOM targets. Separate elements remain separate;
372
- unsupported paths are informational limits, not evidence of safe composition.
373
-
374
- Airbnb's 2022 [migration report](https://medium.com/airbnb-engineering/airbnbs-trip-to-linaria-dc169230bd12)
375
- provides practical evidence for this choice: performance was its leading
376
- criterion, with separate CSS caching and colocated authoring among the benefits.
377
- Its measurements describe Airbnb's workloads, not promised gains for ADS projects.
378
-
379
- The requirement concerns how styling is authored and built; visual identity
380
- belongs to the project. Foundation tokens and base document styles remain CSS.
381
- “Zero runtime” describes CSS generation, not the whole component: rendering,
382
- interaction, class composition, and dynamic values can still require JavaScript.
383
- Colocation makes dependencies explicit; it does not by itself guarantee removal
384
- of every unused variant. Atomic composition still requires care with the cascade.
385
-
386
- Apply extraction to application and project preview builds, preserve intentional
387
- foundation CSS, and inspect compiled output when performance matters. The
388
- [starter guide](../starters/shared/README.md) covers these details.
389
- Both extraction pipelines use the build-only `@reqvire-org/ads/linaria` tag
390
- resolver. It delegates atomization and nesting to the project's installed Linaria
391
- processor while preserving custom-property token streams around that pass.
392
- Arithmetic becomes meaningful after `var()` substitution, so stripping whitespace
393
- can invalidate otherwise valid source. Verify emitted CSS and computed browser
394
- values; source guards alone cannot establish extraction correctness. The
395
- skill-local [atomic styling guide](../skills/ads-designer/references/atomic-styles.md#preserve-custom-property-arithmetic-during-extraction)
396
- documents integration and source-workaround semantics.
397
-
398
- The resolver also preserves complete `@property` registrations and their
399
- conditional at-rule context for atomic `css`/`styled`. Their descriptors are schema
400
- metadata, not separate atomic declarations. CSS-tree validates CSS value grammar;
401
- PostCSS supplies source/at-rule structure. Registered names have one owner and a
402
- stable schema across its modules, because registration is document-global. Runtime
403
- variables are registered in owned Linaria; shared design tokens are
404
- registered beside their real value definitions. Base resets and fonts cannot own
405
- registrations. Descriptor literals are narrowly permitted where CSS requires an
406
- independent initial value; ordinary visual assignments remain token-governed.
407
- MCP serves these styles to the sandboxed App document. Registration metadata
408
- neither creates new token definitions nor replaces token sample coverage.
409
- Compiled-CSS and browser tests verify interpolation in React and Preact Apps.
534
+ `foundation.ads.ts` declares the document's shared responsibilities: the reset,
535
+ the `text` and `surface` profiles applied to the document, the default focus
536
+ indicator, the themes and brands, the generated palette and the application
537
+ icon ([fields](ADS.md#foundation-declaration)).
538
+
539
+ Emission writes them once as `foundation.css`. The sheet contains:
540
+
541
+ - One `@font-face` per declared font face, and for a family that declares a
542
+ `fallback`, one matched fallback face per declared face. `src/font-metrics.mts`
543
+ reads a face's measurements from its captured bytes (bare SFNT, WOFF, WOFF2;
544
+ only `head`, `hhea`, `OS/2`, `cmap` and `hmtx`; a WOFF2 stream is decompressed
545
+ once per captured byte array, held weakly). `src/font-fallback.mts` is pure:
546
+ the size adjustment is the face's average width of English prose
547
+ (`CHARACTER_FREQUENCY`: lowercase, space, capitals, punctuation and digits by
548
+ their share) over the system font's, and the line-metric overrides are the face's own divided by
549
+ it. The widths of Arial, Times New Roman and Courier New are constants
550
+ measured with the same reader. The record is computed when the font
551
+ declaration is read (`src/font-model.mts`), only for a declaration that
552
+ states a fallback.
553
+ - The reset.
554
+ - The text and surface fields on `body`. The surface is also on `[data-theme]`
555
+ and `[data-brand]`, so a nested context repaints.
556
+ - The focus indicator on `:focus-visible` at zero specificity.
557
+ - `color-scheme` per declared theme. With `followSystemTheme`, the rules of the
558
+ first light and first dark theme repeat for a root without `data-theme`,
559
+ under the matching `prefers-color-scheme`. With `sections: true`, each
560
+ theme's `color-scheme` is also on nested `data-theme` sections, with the
561
+ section rules of the token closure
562
+ ([sections](#theme-and-brand-sections)).
563
+ - The page scroll lock behind a modal dialog, when an owner needs it.
564
+ - The tokens that these rules use.
565
+
566
+ The emitted barrel imports `foundation.css` first. Components and patterns own
567
+ their layout, appearance, states and animations in their recipes. The
568
+ foundation holds no component treatment.
569
+
570
+ ### The platform feature inventory
571
+
572
+ `src/platform-features.mts` registers the platform feature inventory. Each
573
+ listed feature names:
574
+
575
+ - The CSS constructs that use it: properties, the value keywords it names,
576
+ at-rules, media features, pseudo-classes and pseudo-elements, units and
577
+ functions.
578
+ - Its vendor-prefixed forms. Prefixed companions (`PREFIXED_COMPANIONS`) are the
579
+ prefixed forms of their feature.
580
+ - How the output degrades in a browser without it.
581
+
582
+ The CSS core (CSS 2.1 and the long-established CSS3 modules) is a second,
583
+ unlisted set.
584
+
585
+ The contract builder reads the final emitted sheets with that registry. The
586
+ record therefore holds whatever lowering, the foundation sheet and the
587
+ project's own token values wrote, attributed to the owner beside each sheet. A
588
+ construct in neither set is recorded as unrecognized; it is not dropped.
589
+
590
+ Two controls stop a new lowered construct from shipping unlisted. A unit test
591
+ requires a classification for every property the lowering inventory registers.
592
+ The emitted example design system and fixtures are held to the inventory in both directions.
593
+
594
+ The registry states facts, never browser versions. ADS has no declared browser
595
+ targets: the application checks the recorded features against its own targets.
596
+
597
+ ### Why compile at build time
598
+
599
+ The choice serves performance as well as ownership:
600
+
601
+ - Styles are compiled at build time. The browser does no render-time CSS
602
+ generation and no stylesheet injection.
603
+ - Each owner's stylesheet carries only the token CSS and atomic rules it uses.
604
+ The import of an owner's module loads the owner's own sheet.
605
+ - The output's `package.json` declares only the stylesheets as side effects. A
606
+ bundler that honours the declaration (measured with Vite) drops the sheet of
607
+ an unused owner with its module, even through the barrel. Bun.build keeps
608
+ every reached sheet.
609
+ - Atomic extraction deduplicates identical declarations.
610
+ - The browser applies theme and brand values to compiled rules, so a context
611
+ change needs no runtime CSS generator.
612
+ - CSS can be cached separately from JavaScript.
613
+
614
+ ### The generated palette
615
+
616
+ Code that draws on a canvas or with WebGL reads theme colors as values from
617
+ `palette.generated.ts`. This generated source holds every paint-role token
618
+ resolved in every declared context. It exists when `foundation.ads.ts` declares
619
+ `palette: true`. `ads check` reports a missing, stale or undeclared palette.
620
+ `ads sync` creates and regenerates it
621
+ ([guide](GUIDE.md#regenerating-generated-source)).
410
622
 
411
623
  ## Public APIs preserve the boundary
412
624
 
413
- The application and project-owned preview scenarios consume a project's public ADS entry. Components
414
- and patterns expose supported behavior and visual variants; internal styling
415
- blocks and external implementation dependencies stay with their owner.
625
+ The application and the project-owned preview scenarios consume the project's
626
+ public entry. The public entry is the authored barrel `index.ts`, which names
627
+ each public owner; `export *` is rejected.
628
+
629
+ Components and patterns expose supported behavior and visual variants. Internal
630
+ construction and external implementation dependencies stay with their owner.
631
+ An import that leaves the design-system folder is an error, because previews,
632
+ drafts and emitted packages read only that folder.
416
633
 
417
- That boundary lets the project replace or adapt an implementation while
418
- preserving compatible consumer APIs. Markup, accessibility, events, layout, and
419
- motion still need verification when an implementation changes. Imported or
420
- adapted source carries its credits and applicable notices in its local guide.
634
+ This boundary lets the project replace or adapt an implementation and keep
635
+ compatible consumer APIs. Markup, accessibility, events, layout and motion
636
+ still need verification when an implementation changes. Imported or adapted
637
+ source carries its credits and applicable notices in its local guide.
421
638
 
422
639
  ## Controllers own reusable behavior
423
640
 
424
- A private controller stays beside its component or pattern. Shared behavior uses
425
- `controllers/<Name>/` as an independent edit owner. Controllers may be plain
426
- functions/classes, framework hooks or context providers; sharing code does not
427
- implicitly share instances. Use the configured framework and declared project
428
- dependencies, with no runtime supplied by the MCP host. Shared controllers do not
429
- import styled consumers or introduce another skin layer. Existing measurement and
430
- style-write boundaries still apply.
431
-
432
- Projects can explicitly allow installed runtime packages with
433
- `"behaviorLibraries": ["@floating-ui/dom@1.7.4", "tabbable@6.2.0"]` in `ds.config.json`.
434
- Each name must also appear in `package.json` dependencies and be installed.
435
- Pin each package, and the framework (`"framework": "preact@10.27.2"`), to its exact
436
- installed version: compiled previews are keyed by ADS-owned inputs only, so the pin
437
- is how a dependency upgrade invalidates them. `ads check` reports
438
- `behavior-library-version` when the installed version differs from the pin.
439
- Production ADS code may import those packages and their subpaths directly from
440
- components, patterns or controllers; extract a shared controller only when the
441
- behavior is shared. Other external runtime imports fail
442
- `behavior-library-undeclared`. Type-only imports and development roles retain
443
- their existing rules, as do the configured framework and Linaria exceptions.
444
- `ads check` reports import locations and the exact list to declare.
445
-
446
- This is project approval, not a recursive dependency audit or a guarantee about
447
- third-party internals. ADS reads installed versions without executing packages
448
- or scanning their dependency source or stylesheets. The declaration authorizes
449
- package imports and subpaths. Existing source styling and measured-geometry
450
- checks retain their scope; it introduces no new package-CSS certification gate. Use libraries as installed, with minimal lifecycle/event integration.
451
- For example, Floating UI's `computePosition` can supply `x` and `y` to an
452
- allowlisted producer's `style.setProperty("--ds-popover-x", ...)` and
453
- `style.setProperty("--ds-popover-y", ...)`; project Linaria owns positioning
454
- rules and visual treatment. Declare those exact properties in the owner contract's
455
- `styles.writes`. Clean up positioning observers on unmount.
456
- ADS's managed preview compiler bundles used library code into the normal MCP App
457
- resource graph; declarations alone do not load packages or change its sandbox.
458
-
459
- Optional `<Owner>.ads.contract.ts` modules identify public APIs or private
460
- implementation symbols, named guarantees and registered execution checks. Scenario
461
- `exercises` links public behavior APIs to reachable demonstrations; `covers`
462
- continues to describe rendered public UI. Controllers need no artificial standalone
463
- visual scenario. Static registration is separate from current passing evidence.
464
-
465
- Manifests, checks, scenarios and fixtures are development inputs; production
466
- imports only actual components/controllers and their styles. Browser checks can
467
- exercise the real isolated preview. React development StrictMode uses a project development
468
- harness, since production previews do not replay those effects. The
469
- [behavior contract](BEHAVIORS.md) defines profiles, execution and evidence freshness.
470
-
471
- The normal compiled import graph delivers controller dependencies through HTTP or MCP
472
- resources. There is no eager global controller registry. ESM splitting and selected
473
- asset loading remain in place; tree shaking depends on actual imports, exports and
474
- side effects, rather than the controller directory name.
641
+ A private controller stays beside its component or pattern. Shared behavior
642
+ uses `controllers/<Name>/` as an independent edit owner: a plain module that
643
+ the barrel exports, with no recipe or markup.
644
+
645
+ A controller can be a plain function or class, a framework hook or a context
646
+ provider. Shared code does not implicitly share instances. Controllers use the
647
+ configured framework and the declared project dependencies. The MCP host
648
+ supplies no runtime.
649
+
650
+ The normal compiled import graph delivers controller dependencies through HTTP
651
+ or MCP resources. There is no eager global controller registry. ESM splitting
652
+ and selected asset loading apply. Tree shaking depends on actual imports,
653
+ exports and side effects, not on the controller directory name.
654
+
655
+ ### Behavior checks
656
+
657
+ Behavior checks are development inputs. Production imports only the actual
658
+ components and controllers and their styles. Browser checks exercise the real
659
+ isolated preview.
660
+
661
+ ADS runs what owners register. It runs the built-in `unit`, `browser` and
662
+ `strict` profiles itself, with its own Bun and Playwright, and it owns evidence
663
+ freshness and investigations. The example design system's form-field bridge
664
+ (`controllers/FormField`) registers unit checks.
665
+
666
+ A project that registers no behavior checks gets `{ status: "not-available",
667
+ reason: "no-behavior-checks", message }` from `ads behaviors`, `ads verify`,
668
+ the acceptance stage and `ads validate`. It never gets a pass. The
669
+ [behavior guide](BEHAVIORS.md#registered-checks-and-their-status) defines the
670
+ statuses, profiles and evidence.
475
671
 
476
672
  ## The showcase is the shared design workspace
477
673
 
674
+ Humans and coding agents inspect the same project through one ADS runtime.
675
+ Humans use the local showcase. Agents and external MCP Apps use MCP tools and
676
+ resources. Both reach the same services.
677
+
678
+ The shell belongs to tooling. Components, patterns, design values, scenario
679
+ inputs and the UI rendered inside Apps belong to the project. The tool is
680
+ therefore useful with an empty design system, and every implementation becomes
681
+ addressable when its scenario exists.
682
+
683
+ ### A preview scenario is the unit of review
684
+
685
+ A component export alone can need inputs, parent context, local state or
686
+ callbacks to produce useful UI. A scenario supplies that development context
687
+ around the real public implementation. It mounts independently: no showcase
688
+ page, application router, store or service must start first.
689
+
690
+ A scenario file is data and subjects (`scenario`: text, named states and
691
+ specimens whose `render` returns owners). It lays out nothing. ADS draws the
692
+ page with a pattern of its own showcase design system (`ScenarioPage` in
693
+ `showcase-ui/`, checked by ADS like any design system), so a page cannot break
694
+ because of scenario markup, and it looks the same in every project. The check
695
+ refuses markup in a scenario file (`scenario-markup`, `src/owner-scenarios.mts`).
696
+ What a subject needs around it comes from the scenario kit
697
+ (`@reqvire-org/ads/showcase`, typed in `src/scenario-kit.mts`), whose
698
+ components are also showcase-ui owners.
699
+
700
+ Larger scenarios live under `mocks/` and use the same public screen
701
+ patterns as production. Application adapters supply live data and effects.
702
+ Scenario adapters supply fixture data, local state and simulated services.
703
+
704
+ **Development boundary.** These are development-only: any `.ads.` scenario,
705
+ fixture or exports stub, every test, and everything under `mocks/`. This
706
+ holds even when the file is colocated with a production component.
707
+
708
+ - Emission never writes a development module.
709
+ - Runtime implementation, types and styles cannot import one through aliases or
710
+ barrels, and the public barrel cannot export one. A production import of a
711
+ development module fails the module graph.
712
+ - Previews compile development modules from source, beside the emitted
713
+ production modules. Only the closure of the selected scenario and its
714
+ fixtures enters a preview.
715
+ - Derived App audit data adds no ADS dependency to production components.
716
+
717
+ Browser tests still verify mounting, states, accessibility and visual parity.
718
+
719
+ **Registry.** The server discovers one path-derived scenario registry. The
720
+ showcase's sections browse that same registry through MCP results. Scenarios
721
+ register from the owners' `*.ads.scenario.tsx` files
722
+ (`src/owner-scenarios.mts`), read statically from the captured revision.
723
+ `ads check` reports their coverage.
724
+
725
+ In a project without scenarios the registry is empty, and everything that
726
+ renders scenarios (captures, the render audit, preview verification) reports
727
+ `{ status: "not-available", reason: "no-scenarios", message }` and does not
728
+ pass ([showcase contract](ADS.md#showcase-contract)).
729
+
730
+ ### Folder-derived navigation
731
+
732
+ The filesystem is the only grouping source:
733
+
734
+ - A nonempty container above an owner, whose non-hidden children are all real
735
+ directories, supplies its exact folder name as the group.
736
+ - An owner directory and a layer root never become groups.
737
+ - A direct file or symlink disqualifies a container.
738
+ - Nested qualifying containers form a path label such as `Forms / Selection`.
739
+ - Flat owners stay ungrouped, with no Default heading.
740
+
741
+ To reorganize groups, move the owners, and update imports and path-derived
742
+ identities where needed. No scenario or owner metadata can override the folder
743
+ rule.
744
+
745
+ Discovery adds an optional derived `group` to scenario results. One registry
746
+ feeds `ads_scenarios`, its searchable group labels, `ads://project/scenarios`
747
+ and the showcase. The browser only groups those results. It does not scan
748
+ folders and owns no second taxonomy.
749
+
750
+ Directory entries participate in discovery and build freshness. So the addition
751
+ or removal of a non-source file also updates the grouping, without a TSX edit.
752
+ Grouping grants no API visibility, render coverage or runtime behavior.
753
+
754
+ ### Drafts are tracked proposals
755
+
478
756
  Every MCP source change is a tracked proposal: `ads-drafts/` source in explicit
479
757
  `.ads` files, with canonical target mappings and baseline fingerprints. Only
480
758
  `ads_accept` of an exact draft revision writes accepted source. Production
481
- discovery/imports exclude drafts.
482
-
483
- Ownership makes drafts independent. Every authored file has one owner, and an owner
484
- is in at most one open draft, so concurrent clients edit different owners and drafts
485
- never share a file. A draft carries only its owners' files; a companion such as
486
- `ds.config.json` joins when the draft changes it. Shared entries are generated from
487
- owned files: the public barrel and review entry from each owner's
488
- `<Owner>.ads.exports.ts` (its named re-exports, copied with rebased paths, so a product
489
- build never includes an exports file), the styles entry from the canonical token sheets, the theme
490
- files from the token halves. Style permissions live in the owner's contract. ADS
491
- therefore never merges: if accepted source changes under a draft (a direct edit or a
492
- Git pull), acceptance reports a baseline conflict and the draft is recreated.
493
-
494
- Each connected project runtime owns one managed preview compiler process.
495
- Semantic analysis uses the shared host described above. Generated preview
496
- workspaces (`.ds/draft-previews/<id>/project`) retain the normal project layout and
497
- public imports while overlaying proposed owner files and declared draft dependencies,
498
- with the generated entries regenerated. The preview compiler process hosts each
499
- draft workspace as an in-process instance listed in a control file, and one scheduler
500
- runs their builds in turn: the viewed draft first, then the project, then background
501
- work. A draft's preview is a view of its workspace served by the project's showcase,
502
- in comparison (`?draft=<id>`) or alone (`/draft/<id>/`, the same client with that
503
- workspace's MCP endpoint). Only these workspaces skip acceptance validation for fast
504
- feedback. A draft's own edits and the viewed draft resync at once; other drafts
505
- behind an accepted-source change catch up in the background.
506
-
507
- Acceptance fences the exact reviewed revision, builds a candidate copy and rechecks
508
- live inputs before publication. When the draft's workspace holds the same inputs as
509
- the candidate, `ads check` and the browser renders run there, through the project's
510
- compiler and host, so a dry run followed by acceptance of the same revision reuses its
511
- check and audit results. Pattern/composition and token-group draft dependencies
512
- resolve to normal accepted source after promotion.
513
- The [draft guide](../skills/ads-designer/references/drafts.md) defines lifecycle,
514
- completion requirements, build integration and recovery.
515
-
516
- Humans and coding agents inspect the same project through one ADS runtime.
517
- The local showcase is a minimal HTTP shell. It discovers navigation and scoped
518
- preview actions through a narrow JSON adapter over the same services used by
519
- MCP. Agents and external MCP Apps retain MCP tools/resources; the HTTP browser
520
- bundle contains no MCP SDK or JSON-RPC implementation. The shell has no project
521
- implementation imports and does not execute project code.
522
-
523
- The local preview is one persistent opaque iframe on a separate loopback origin,
524
- without the extra MCP Apps proxy frame. Checked manifests use bounded revision
525
- reuse/deltas; immutable asset URLs refer to pinned, authorized graph bytes, never
526
- filesystem paths. Ordinary modules, CSS, fonts and images load over HTTP. Worker
527
- scripts and modules referring to them use verified Blob URLs because the opaque
528
- sandbox cannot directly create workers from another origin. External MCP Apps
529
- continue to use the existing resource adapter and sandbox proxy.
530
-
531
- HTTP build reports arrive over SSE. Connect/reconnect and visibility resume
532
- reconcile discovery and scoped build state; there is no periodic HTTP status
533
- poll. Interrupted connections mark retained previews potentially stale. Frame
534
- capabilities have a separate lifetime connection, a bounded reconnect grace,
535
- and immediate retirement on explicit close, scope removal or shutdown. The
536
- [HTTP design and measurements](HTTP-SHOWCASE-POC.md) record limits and historical
537
- comparisons. Captures and verification use the default local HTTP host while
538
- preserving exact viewport, revision, readiness and publication gates.
539
-
540
- Starting MCP starts the website; browser-only showcase starts the same runtime
541
- without stdio. All modes share the managed Bun compiler. Shutdown closes the
542
- website, streams, frame capabilities, connections and compiler.
543
-
544
- The ADS host gives inline App documents an `about:srcdoc` base when the App
545
- provides no explicit base URL. Fragment links then stay inside their own document
546
- with native scrolling, history and events. The sandbox permits this local base;
547
- external bases still require declared CSP origins. This belongs to document
548
- loading and changes no project link or scenario handler. External hosts control
549
- their own document-loading and CSP behavior.
550
-
551
- The proxy and App sandbox permit native forms (`allow-forms`). This lets browser constraint validation and `submit`
552
- handlers run for clicks, Enter and `requestSubmit()`. Client-side handlers retain
553
- their own `preventDefault()` behavior. The App stays opaque; CSP
554
- `form-action 'none'` blocks native action requests without suppressing submit
555
- handlers. Hosts outside ADS choose their own sandbox and CSP permissions.
556
-
557
- ADS's Bun preview compiler publishes a versioned dependency graph: shared runtime and
558
- foundation assets, plus independently addressable scenario modules. Inside the
559
- preview, the selected dependency closure loads from checked HTTP assets or
560
- verified MCP resources and mounts it using the project's framework adapter. Native
561
- ES modules preserve shared runtime identity, cycles and live bindings. Switching
562
- scenarios unmounts the previous view while keeping unchanged dependencies cached.
563
- Persistence is a host lifecycle choice; a new external widget loads the same
564
- resources independently. Resource sharing is scoped to an App instance.
565
-
566
- Resource IDs hash original bytes and the transitive graph of URLs they rewrite.
567
- Cyclic module groups share a deterministic fingerprint. This makes
568
- IDs independent of compiler filename hashing: rewriting a changed dependency
569
- cannot put different bytes behind an existing URI. Unrelated graph branches keep
570
- their IDs and caches. The App still verifies the digest of the final bytes and
571
- rejects any identity collision without partially registering the new graph.
572
-
573
- The showcase's resource bridge can recover a transient fetch failure with at most
574
- three read attempts and bounded backoff. This applies only to resource reads;
575
- tool calls, assertions and whole checks are never replayed. Cancellation,
576
- HTTP/protocol/content errors and integrity failures remain failures. Browser
577
- diagnostics record retries, and verification retains recovered startup reads in
578
- its case results. Persistent transport failures still block a mutation. External
579
- hosts own their transport recovery; the reusable App's integrity checks remain
580
- the same.
581
-
582
- Managed graph builders publish into `.ds/preview/sessions/<session>/`.
583
- Logical scenario IDs and resource URIs stay unchanged;
584
- standalone builds publish `.ds/preview/manifest.json` and cannot overwrite a live
585
- session's success record. Verified compiled snapshots form a bounded shared
586
- warm-start cache. Source, compiler, dependency and output hashes still gate reuse.
587
- Ordinary shutdown removes owned session output while retaining that cache.
759
+ discovery and imports exclude drafts.
760
+
761
+ **Ownership makes drafts independent.**
762
+
763
+ - Every authored file has one owner, and an owner is in at most one open draft.
764
+ Concurrent clients therefore edit different owners, and drafts never share a
765
+ file.
766
+ - A draft carries only the files of its owners. A companion such as
767
+ `ds.config.json` joins when the draft changes it.
768
+ - The public barrel and `foundation.ads.ts` belong to the foundation owner. The
769
+ token sheets belong to the tokens owner.
770
+ - ADS never merges. If accepted source changes under a draft (a direct edit or
771
+ a Git pull), acceptance reports a baseline conflict and the draft is
772
+ recreated.
773
+
774
+ **Draft workspaces.** A generated preview workspace
775
+ (`.ds/draft-previews/<id>/project`) keeps the normal project layout and public
776
+ imports. It overlays the proposed owner files and the declared draft
777
+ dependencies. The preview of a draft is a view of its workspace, served by the
778
+ project's showcase:
779
+
780
+ - In comparison: `?draft=<id>`.
781
+ - Alone: `/draft/<id>/`, the same client with the MCP endpoint of that
782
+ workspace.
783
+
784
+ Only these workspaces skip acceptance validation, for fast feedback. A draft's
785
+ own edits and the viewed draft resync at once. Other drafts that are behind an
786
+ accepted-source change catch up in the background.
787
+
788
+ **Acceptance.** Acceptance fences the exact reviewed revision, builds a
789
+ candidate copy, and checks live inputs again before publication.
790
+
791
+ - Acceptance regenerates `palette.generated.ts` in the candidate before its
792
+ check, so the published change includes it.
793
+ - When the draft's workspace holds the same inputs as the candidate,
794
+ `ads check` and the browser renders run there, through the project's compiler
795
+ and host. A dry run followed by acceptance of the same revision therefore
796
+ reuses its check and audit results.
797
+ - After promotion, pattern and mock draft dependencies resolve to normal
798
+ accepted source.
799
+ - Unless `compile.emitOnAccept` is `false`, the published revision is emitted.
800
+ The emit reuses the analysis of the acceptance check
801
+ ([MCP](MCP.md#emitting-from-mcp)).
802
+
803
+ The [draft guide](../skills/ads-designer/references/drafts.md) defines the
804
+ lifecycle, completion requirements, build integration and recovery.
805
+
806
+ ### The HTTP shell and the preview frame
807
+
808
+ The local showcase is a minimal HTTP shell. It uses HTTP for discovery, status,
809
+ events, preview actions and checked assets.
810
+
811
+ - The shell discovers navigation and scoped preview actions through a narrow
812
+ JSON adapter over the same services that MCP uses.
813
+ - The HTTP browser bundle contains no MCP SDK or JSON-RPC implementation.
814
+ - The shell imports no project implementation and executes no project code.
815
+
816
+ **The frame.** The local preview is one persistent opaque iframe on a separate
817
+ loopback origin, without the extra MCP Apps proxy frame. It preserves isolation
818
+ and viewport behavior.
819
+
820
+ - Checked manifests use bounded revision reuse and deltas.
821
+ - Immutable asset URLs refer to pinned, authorized graph bytes, never to
822
+ filesystem paths.
823
+ - Ordinary modules, CSS, fonts and images load over HTTP.
824
+ - Worker scripts, and modules that refer to them, use verified Blob URLs: the
825
+ opaque sandbox cannot create workers directly from another origin.
826
+ - External MCP Apps use the resource adapter and the sandbox proxy.
588
827
 
589
828
  ```mermaid
590
829
  flowchart LR
@@ -595,158 +834,354 @@ flowchart LR
595
834
  MCP --> Graph
596
835
  ```
597
836
 
598
- The shell belongs to tooling. Components, patterns, design values, scenario inputs
599
- and the UI rendered inside Apps belong to the project. This keeps the tool useful
600
- with an empty ADS while making every implementation addressable once its scenario
601
- exists.
837
+ **Events and connections.** HTTP build reports arrive over SSE; there is no
838
+ periodic HTTP status poll.
839
+
840
+ - Connect, reconnect and visibility resume reconcile discovery and scoped build
841
+ state. An interrupted connection marks retained previews potentially stale.
842
+ - Frame capabilities have a separate lifetime connection and a bounded
843
+ reconnect grace. They retire at once on explicit close, scope removal or
844
+ shutdown.
845
+ - Captures and verification use the default local HTTP host and preserve the
846
+ exact viewport, revision, readiness and publication gates.
847
+
848
+ **Modes.** A started MCP server also starts the website. A browser-only showcase
849
+ starts the same runtime without stdio. All modes share the managed Bun
850
+ compiler. Shutdown closes the website, streams, frame capabilities, connections
851
+ and compiler.
852
+
853
+ **Sandbox.** The sandbox keeps the App opaque and still lets a scenario behave
854
+ as a document: an `about:srcdoc` base for inline documents, native forms
855
+ (`allow-forms`, with CSP `form-action 'none'`), and bundled binary assets with
856
+ blob reads and WebAssembly compilation but no external network access,
857
+ JavaScript eval or host DOM access. These rules belong to document loading and
858
+ change no project link or scenario handler. External hosts choose their own
859
+ ([host boundary](MCP.md#host-boundary-and-compatibility)).
860
+
861
+ ### The preview resource graph
862
+
863
+ ADS's Bun preview compiler publishes a versioned dependency graph: shared
864
+ runtime and foundation assets, plus independently addressable scenario modules.
865
+ The MCP server serves compiled bytes and does not evaluate project TSX.
866
+
867
+ **Loading and mounting.** Inside the preview, the selected dependency closure
868
+ loads from checked HTTP assets or verified MCP resources. A mount that ADS
869
+ generates for the project's framework normalizes each entry to mount/unmount
870
+ with native framework semantics. The choice of a framework installs none into
871
+ the tooling host.
872
+
873
+ - The mount hands the scenario to `mountScenarioPage`
874
+ (`showcase-client/scenario-page.mts`, part of `@reqvire-org/ads/preview`). It
875
+ draws the page with the showcase UI bundle and gives each specimen's box
876
+ (`[data-slot="specimen"]`) to the framework, which renders that specimen's
877
+ `render` as a component with the chosen state's props. Each specimen is its
878
+ own framework root.
879
+ - The scenario kit is generated for the project's framework beside the mount
880
+ (`generatedKit`, `src/preview-source.mts`): each kit component is a host
881
+ element in which ADS draws its own component; a `Container` places its
882
+ children in that component's content slot through a portal.
883
+ - The frame's root is `createPreviewRoot` (`showcase-client/preview-root.mts`).
884
+ The frame module is `showcase-client/preview-frame.mts`, shipped as
885
+ `dist/showcase/preview-frame.mjs`; a checkout uses the built frame, because
886
+ the page needs the built UI bundle.
887
+ - The root also carries the layout-guide controls
888
+ (`showcase-client/guide-controls.mts`).
889
+ - ADS views render into the same root (`showcase-client/ads-views.mts`).
890
+
891
+ Native ES modules preserve shared runtime identity, cycles and live bindings. A
892
+ scenario switch unmounts the previous view and keeps unchanged dependencies
893
+ cached. Persistence is a host lifecycle choice: a new external widget loads the
894
+ same resources independently. Resource sharing is scoped to an App instance.
895
+
896
+ **One shared graph.** Previews build one shared multi-entry graph on first
897
+ preview demand or accepted-edit preparation, then reuse it across selections
898
+ and unchanged restarts. The App loads the selected scenario's static dependency
899
+ closure; dynamic imports stay lazy. Production bundles, workers and
900
+ cancellation stay project-owned.
901
+
902
+ **Code inside the frame.** The code that runs inside the frame lives in
903
+ `preview-client/`, as strict TypeScript with no Node APIs: one transport-neutral
904
+ runtime (`runtime.mts`) with its resource and HTTP loaders, hot-update runtime,
905
+ manifest cache, grid overlay and subject stage. The build bundles it per
906
+ delivery:
907
+
908
+ | Bundle | Delivery |
909
+ | --- | --- |
910
+ | `dist/mcp/preview-widget.bundle.js` | The MCP App (`preview-widget.mts`) |
911
+ | `dist/mcp/preview-http.bundle.js` | The HTTP showcase (`preview-http.mts`) |
912
+ | `dist/mcp/resource-loader.js` | The loader alone |
913
+
914
+ Page code that Playwright evaluates stays in `src/` as `*.page.mts` (the paint
915
+ audit in `src/verification/paint-audit.page.mts`).
916
+
917
+ **Resource identity.** A resource ID hashes the original bytes and the
918
+ transitive graph of URLs they rewrite. Cyclic module groups share a
919
+ deterministic fingerprint. IDs are therefore independent of compiler filename
920
+ hashing: the rewrite of a changed dependency cannot put different bytes behind
921
+ an existing URI, and unrelated graph branches keep their IDs and caches. The
922
+ App still verifies the digest of the final bytes, and rejects an identity
923
+ collision without partially registering the new graph.
924
+
925
+ **Transient read failures.** The showcase's resource bridge recovers a
926
+ transient fetch failure with at most three read attempts and bounded backoff.
927
+ Only resource reads are retried: tool calls, assertions and whole checks are
928
+ never replayed. Cancellation, HTTP, protocol and content errors and integrity
929
+ failures stay failures, and a persistent transport failure still blocks a
930
+ mutation. Browser diagnostics record retries, and verification keeps recovered
931
+ startup reads in its case results. External hosts own their transport
932
+ recovery; the reusable App's integrity checks are the same.
933
+
934
+ **Published output.** Managed graph builders publish into
935
+ `.ds/preview/sessions/<session>/`; logical scenario IDs and resource URIs do
936
+ not change. A standalone build publishes `.ds/preview/manifest.json` and cannot
937
+ overwrite a live session's success record. Verified compiled snapshots form a
938
+ bounded shared warm-start cache, gated by source, compiler, dependency and
939
+ output hashes, which ordinary shutdown keeps
940
+ ([output locations](MCP.md#output-locations-and-limits)).
941
+
942
+ ### ADS views
943
+
944
+ `src/ads-views.mts` declares the ADS views. Each names the part of the preview
945
+ tree's facts file its module embeds and what it brings into the frame.
946
+
947
+ A view is laid out by showcase-ui components, which ADS checks; the view module
948
+ sets only the inspected project's values on them. A token's sample is
949
+ `TokenSample`, a profile applied as a whole is `AppliedSample`, a motion
950
+ profile plays on `MotionSample` (through the Web Animations API, with the
951
+ profile's own timing), an asset is drawn in `ArtworkSample`, and a grid is
952
+ shown by `GridExample` and `MiniUnitSample`. Each exposes one element
953
+ (`[data-slot="value"]`, `"dot"` or `"drawing"`) for the project's value. A
954
+ view module holds no stylesheet and no CSS rule
955
+ (`tests/unit/view-modules.test.ts`). The one sheet a view adds is the grid's
956
+ own rules from the facts, written as they are by
957
+ `showcase-client/project-rules.mts`.
958
+
959
+ **The views are cards.** `showcase-ui`'s `CardGroup`, `SampleCard` and
960
+ `GridMiniature` (`patterns/SampleCards/`) draw a view as groups of cards: a
961
+ stage for the sample, the name and one line. The
962
+ host passes them as data (`renderCardPage`) and fills each stage
963
+ (`[data-slot="stage"][data-key]`) with the sample it draws. On a miniature
964
+ grid it sets the project's values only: each column's share of the line, the
965
+ outer margin as the grid's inline padding, a gutter as a column's.
966
+
967
+ **Spatial grids** (`foundation`, in `showcase-client/ads-views.mts`, in the
968
+ Profiles section after its summary):
969
+
970
+ - Each grid's facts name the profiles it builds on (`buildsOn`, written at
971
+ emission from the profile facts). A profile whose breakpoints, gutters and
972
+ scale equal those of one it builds on shows only its own examples (a hybrid
973
+ grid, a fixed tiling); the shared cards stand under the profile that states
974
+ them.
975
+
976
+ - It embeds the facts' `grids` (`src/grid-facts.mts`): each spatial profile's
977
+ definition, its resolved breakpoints and lengths, and `examples`, the grid
978
+ algebra's own expansion of example regions on the profile. There is one
979
+ fluid example per gutter mode; a `hybrid` one when the profile states
980
+ `fixedStart` or `fixedEnd` (with its per-breakpoint tracks, and the first
981
+ gutter mode its cells fit with); and a `fixed` tiling when it states
982
+ `tileSize`. An optional example the algebra refuses is listed in `omitted`
983
+ with the reason, and the view says so.
984
+ - Like every view it takes the token-sheets frame: the document sheet and the
985
+ preview-only tokens sheet, which declares every token. An example reads the
986
+ profile's own tokens (a fixed track, a tile size), which no owner's sheet is
987
+ sure to carry. No owner is in its module graph, so an owner-only edit leaves
988
+ it unchanged.
989
+
990
+ **Tokens** (`tokens`, `showcase-client/tokens-view.mts`):
991
+
992
+ - It embeds the facts' `tokens` (`src/token-view-facts.mts`): the token
993
+ inventory's builder given no owners, so the bytes depend on the foundation
994
+ alone.
995
+ - It imports only the document sheet and the tree's preview-only
996
+ `ads-preview-tokens.css` (the `tokenCss` of every token, since an emitted
997
+ sheet carries only the tokens its owner reaches).
998
+ - No owner is in its module graph: an owner-only edit leaves it unchanged, and
999
+ a token edit rebuilds it.
1000
+
1001
+ **Profiles** (`profiles`, `showcase-client/profiles-view.mts`):
1002
+
1003
+ - It embeds the facts' `profiles` (`src/profile-view-facts.mts`): each
1004
+ profile's kind, declaration file, the profiles it builds on, every field with
1005
+ the profile that states it and the tokens it reads, its choices, and the
1006
+ profiles that build on it or select it in a slot. The foundation keeps this
1007
+ in each profile's `declared` data.
1008
+ - It takes the same frame as the tokens view, so a field that reads one token
1009
+ draws that token's sample in the frame's theme and brand.
1010
+ - It lists no owners, so an owner-only edit leaves it unchanged; a profile or
1011
+ token edit rebuilds it.
1012
+ - ADS decides the sample, the showcase draws it. Each profile's `applied`
1013
+ fact (`profileApplied`) states what its sample is (one control, a box,
1014
+ text, a gap, a size, a focus indicator), what sits inside it, the CSS
1015
+ values for its box, its text and its artwork, the frame's own extent with
1016
+ whether it is a share of its container, and, for a composite, the fields
1017
+ that shape it. `showcase-ui`'s `AppliedSample` has a shape for each; the
1018
+ view sets the values on its slots and decides nothing. A new kind of sample
1019
+ is a new fact and a new shape, never a guess in the view.
1020
+
1021
+ **Tokens**, beside the above: each token's `purpose` is the comment its author
1022
+ wrote directly above its declaration (`tokenPurposes`); the view shows it,
1023
+ the profiles that read the token, a status only where one is not valid, and
1024
+ the contexts only where some token differs between them.
1025
+
1026
+ **Scenario pages** (`showcase-client/scenario-page.mts`): a scenario is data
1027
+ and subjects; ADS draws the page with `showcase-ui`'s `ScenarioPage`.
1028
+
1029
+ - Named `states` are one switch; the chosen set is every specimen's props.
1030
+ - Live controls (`controls: true`): owner analysis records each component's
1031
+ props that select markup or styling from a closed list of values
1032
+ (`src/analysis/owner-controls.mts`, the equality axes of the choice
1033
+ analysis). Emission writes them to the preview tree as
1034
+ `ads-preview-controls.json` (`src/preview-controls.mts`), a file of its own
1035
+ so that a token edit does not rebuild scenario modules. Each scenario's
1036
+ entry module embeds it; the page draws one control per prop of the first
1037
+ owner in `covers` and passes the chosen values over the state's props.
1038
+ - `frame: "screen"` fills the preview: the page takes the preview root's
1039
+ height and the specimen what the state bar leaves.
1040
+ - `tests/browser/showcase-ui-pages.test.mjs` measures what `ads check` cannot
1041
+ see on these pages: a screen that fills, a sample inside its box, a control
1042
+ that sets a prop, a header that keeps the current section in view.
1043
+
1044
+ **Artwork** (`assets`, `showcase-client/assets-view.mts`):
1045
+
1046
+ - It embeds the facts' `assets` (`src/asset-view-facts.mts`): every asset of
1047
+ the asset catalog with its authored drawings as text, and every glyph set.
1048
+ - It draws each asset with `sanitizeInspectedSvg` (`src/inspected-svg.mts`),
1049
+ the one sanitizer for inspected SVG. A frame module may import a pure module
1050
+ of `src/`; the build rewrites that import for the built tool.
1051
+ - It takes the token-sheets frame, so a paint slot's token colours its drawing.
1052
+ It lists no owners.
1053
+ - It renders one token group at a time through showcase-ui's
1054
+ `renderSpecimenSections`: choices, role sections, and a sample column that
1055
+ the view fills with the token's own custom property, at most 100 rows per
1056
+ page.
1057
+ - It reads each value from the frame's computed style.
1058
+ - It keeps the chosen group across a rebuild through the runtime's
1059
+ navigate/focus round trip with the host.
1060
+
1061
+ The explorer's token category counts the `tokens` of the preview tree's facts,
1062
+ the list the view renders, so a warm explorer read never walks the project's
1063
+ inputs. Before any revision is previewed, the analysis worker's `token-summary`
1064
+ operation counts them from the design inputs only.
602
1065
 
603
- ### The foundation has a narrow styling role
1066
+ ### Incremental compilation and refresh
604
1067
 
605
- Shared token sheets define values on the document root, per-theme values as halves, and
606
- brand values on `[data-brand]`; the generated `themes.generated.css` resolves them. The
607
- import-only entry loads them in canonical order, the generated sheet last. `fonts.css` declares font faces;
608
- `base.css` establishes shared native defaults and normalization. Components and
609
- patterns own their layout, skin, states and animations in Linaria.
610
-
611
- `base.css` has a closed contract with three roles: root/body typography, canvas
612
- colors and theme behavior; limited native normalization; and global accessibility
613
- through focus indicators and reduced-motion rules. Selector, property and value
614
- checks reject component skins and layout even when they use native selectors and
615
- valid tokens. A `button` background or `body` grid belongs to a Linaria owner.
616
- Document defaults also cover shared text selection and document scrollbars;
617
- local control/scroll-container styling stays with its owner.
618
-
619
- Foundation CSS passes the ordinary token-reference and visual-value checks too.
620
- Parsed selectors reject component hooks, local shared-token overrides and
621
- contextual selectors, including hooks concealed in `:where()` or `:is()`. The
622
- policy describes CSS roles and normalization keywords, with no project classes,
623
- token catalogue or sample templates. Lower specificity cannot bypass ownership.
624
- Static gates establish this source contract; browser review still checks its
625
- actual effects and accessibility.
1068
+ Each connected project runtime owns one managed preview compiler process.
1069
+ Semantic analysis uses the [shared analysis host](#semantic-analysis), not this
1070
+ process. TSX needs compilation, and there is one preview pipeline with
1071
+ automatic updates.
626
1072
 
627
- ### A preview scenario is the unit of review
1073
+ The compiler process hosts each draft workspace as an in-process instance,
1074
+ listed in a control file. One scheduler runs the builds in turn: the viewed
1075
+ draft first, then the project, then background work.
628
1076
 
629
- A component export alone may need inputs, parent context, local state or callbacks
630
- to produce useful UI. A scenario supplies that development context around the
631
- real public implementation. It mounts independently, without opening a showcase
632
- page or initializing the application's router, store or services first.
633
-
634
- Scenarios and their fixtures live beside the component or pattern they exercise.
635
- Demo framing belongs to development-only review helpers; component props describe
636
- intentional product behavior and visual variants.
637
- The token and brand views are tool-owned: ADS builds them from the token sheets,
638
- `tokens/catalog.ads.json` (groups and sample bindings) and `assets/brand/`. The project
639
- owns the data; ADS owns the presentation. The tool contains no project token list,
640
- sample values or assumed visual identity.
641
- Larger scenarios live under `composition/`. They use the same public screen
642
- patterns as production: application adapters supply live data and effects;
643
- scenario adapters supply fixture data, local state and simulated services.
644
- Reassembling a second screen from shared primitives still allows design drift.
645
-
646
- The server discovers one path-derived scenario registry. The showcase's scenario
647
- sections (Brand, Tokens, Components, Patterns and Composition) browse that same registry
648
- through MCP results. They do not initialize the entry or define
649
- its UI. Every preview uses `?scenario=<id>`; discovered `kind` selects its section. The host supplies theme and
650
- available space; the public implementation
651
- supplies presentation. Several related public parts may share a scenario with
652
- their required parent. Every declared token and every public renderable component
653
- and pattern needs addressable coverage. Token references must exist in the real
654
- foundation; claimed token/UI coverage must be reachable from the scenario entry.
655
- Types, constants and utilities do not require UI scenarios.
656
- Explicitly declared public children can share a parent's scenario when bounded
657
- source tracing reaches them through its returned JSX and selected props/defaults.
658
- Opaque conditional branches do not grant speculative coverage. Scenarios may
659
- consume deliberate public class helpers when their returned styles retain
660
- runtime-owned Linaria provenance; stable owner-authored hooks may accompany real
661
- styles. This preserves ownership rather than granting scenario styling freedom.
662
- A native element may provide semantics as the single direct child of a public
663
- runtime slot when source tracing proves it is cloned with that owner's props.
664
- This preserves polymorphic composition without allowing standalone scenario
665
- controls, scenario styling or name-based exceptions. Selector-based composition
666
- can establish the same ownership through actual returned DOM and attached runtime
667
- Linaria: a positive native-tag relationship, or a `:has` relationship to a marker
668
- declared by a real runtime-owned child. Broad selectors and scenario-authored
669
- lookalikes grant no permission. This source proof does not establish computed
670
- appearance, keyboard behavior or visual parity; browser checks remain necessary.
671
- The skill-local [scenario guide](../skills/ads-designer/references/scenarios.md)
672
- explains evidence, limits and diagnostics.
1077
+ #### The emitted tree and complete revisions
673
1078
 
674
- ### Folder-derived navigation
1079
+ A preview compiles the emitted output of the design system:
675
1080
 
676
- The filesystem is the only grouping source. A nonempty container above an owner,
677
- whose non-hidden children are all real directories, supplies its exact folder
678
- name. An owner directory and layer root never become groups; a direct file or
679
- symlink disqualifies a container. Nested qualifying containers form a path label
680
- such as `Forms / Selection`. Flat owners stay ungrouped with no Default heading.
681
- This applies to components, patterns, compositions and brand previews (`brand/`);
682
- token categories remain unchanged. Move owners to reorganize groups, updating imports and path-derived
683
- identities where needed. No scenario/owner metadata can override the folder rule.
684
-
685
- Discovery adds an optional derived `group` to scenario results. One registry feeds
686
- `ads_scenarios`, its searchable group labels, `ads://project/scenarios` and the
687
- showcase. The browser only groups those results; it does not scan folders or own a
688
- second taxonomy. Directory entries participate in discovery and build freshness,
689
- so adding/removing a non-source file also updates grouping without a TSX edit.
690
- Public catalogue preview IDs, edit-unit ownership and compiled
691
- resource selection continue to use the real owner/scenario paths. Grouping grants
692
- no API visibility, render coverage, styling permission or runtime behavior.
1081
+ - Production modules come from a stable preview-owned tree
1082
+ (`.ds/emitted/live/`). The tree holds the same bytes that `ads emit` writes.
1083
+ - Scenarios, fixtures and other development files compile from source beside
1084
+ the tree.
1085
+ - Nothing is transformed.
1086
+ - If a development file imports an authored production file that the tree does
1087
+ not hold, the build fails. ADS never renders authored source silently.
693
1088
 
694
- ### Incremental compilation and refresh
1089
+ The compiler builds only when it is told that a complete revision is in place.
1090
+ It never builds on file events in the tree, so it never builds a mix of two
1091
+ revisions.
1092
+
1093
+ - An edit of a production module holds its builds until a tree holds the edit.
1094
+ - A compiler that starts after such an edit also holds for it, from the sources
1095
+ the tree records.
1096
+ - MCP replays the emitter's latest revision (or its failure) to a restarted
1097
+ compiler.
1098
+ - A build that a newer revision supersedes is built again. It is never reported
1099
+ as a failure.
1100
+
1101
+ #### Watched and complete builds
695
1102
 
696
- `runScenarioCompiler` remains the single scheduler for live feedback, source
1103
+ `runScenarioCompiler` is the single scheduler for live feedback, source
697
1104
  validation, discovery, freshness and verified publication. Watched previews use
698
- `createIncrementalPreviewBuilder`: a private Vite module graph with the same ADS
699
- Linaria extraction, import optimization, spatial metadata and source identities
700
- as complete builds. React Refresh and native Prefresh supply component signatures
701
- and replacement. This is preview compilation, not a second analysis engine.
702
- Unwatched builds and acceptance preparation retain the complete Bun builder.
703
- The application retains its own production bundler.
704
-
705
- Vite runs in middleware mode without a listening server, filesystem routes or
706
- browser websocket. The builder snapshots transformed modules, CSS, local assets,
707
- literal lazy imports and self-contained Bun worker output into the existing
708
- immutable `ads://assets/…` graph. Module reads never compile live filesystem
709
- contents. The existing scheduler fences the source revision before publishing;
710
- project and draft roots own separate compiler sessions. The shared analysis
711
- service continues to supply discovery and checking.
712
-
713
- Watched manifests add optional `refresh: {version: 1, epoch}` and module metadata
714
- `hot: {id, source}`. The ID is stable within that compiler session; `source` hashes
715
- the lowered module before immutable dependency URI rewriting. This lets the
716
- loader distinguish changed code from a changed dependency address. A bounded
717
- rewrite cache avoids reparsing unchanged compiler output while still observing
718
- output membership and worker content changes.
719
-
720
- The existing sandboxed iframe remains alive for compatible updates. Its resource
721
- loader evaluates changed framework boundaries, updates styles, and preserves
722
- component state, input values, focus and selection where the framework permits.
723
- It tracks already executed lazy modules and visited views too; unopened lazy
724
- branches remain unloaded. Navigation still mounts the selected scenario normally.
725
- Changed hook signatures follow the framework's reset semantics. Removed or
726
- incompatible exports, compiler/configuration epoch changes, interrupted refresh,
727
- and restoration of an already evaluated old revision require a clean frame.
728
- A failed source check restores the last verified output and remains a failure;
729
- state retention is never a substitute for validation or acceptance.
730
-
731
- The internal graph is renewed when configuration/dependency manifests or the
732
- captured original inputs of optimized dependencies change, on source-directory
733
- membership changes that can alter resolution, or when
734
- its retained input/module count exceeds 4096 or retained lowered source/code
735
- exceeds 64 MiB. Browser retained module metadata is bounded at 4096 records and
736
- materialized resource bodies at 64 MiB, with a clean-frame reopen at the next
737
- mount. These are retention limits, not process RSS guarantees. Owned Vite,
738
- extraction, worker and temporary-directory lifetimes end with their builder.
739
- See [caching](CACHING.md#preview-restoration) for the content checks.
740
-
741
- The [preview benchmark](../scripts/benchmarks/preview/README.md) records the
742
- integrated measurement method and results. Frame removal, the V3/source-emission
743
- proposal and HTTP delivery remain outside this release. This integration does
744
- not claim to fix Chromium's raw corner pixels.
745
-
746
- New preview requests share one input-stamp capture per batch. After that
747
- asynchronous capture, scheduling reads the current candidate, publication and
748
- registry together. Candidate completion or replacement during capture cannot
749
- lose a requested view or reuse coverage from a retired candidate.
1105
+ `createIncrementalPreviewBuilder`: a private Vite module graph with the same
1106
+ import optimization and source identities as complete builds. Unwatched builds
1107
+ and acceptance preparation use the complete Bun builder. React Refresh and
1108
+ native Prefresh supply component signatures and replacement.
1109
+
1110
+ This is preview compilation, not a second analysis engine: the shared analysis
1111
+ service supplies discovery and checking, and the application keeps its own
1112
+ production bundler.
1113
+
1114
+ - Vite runs in middleware mode, without a listening server, filesystem routes
1115
+ or a browser websocket.
1116
+ - The builder snapshots modules, CSS, local assets, literal lazy imports and
1117
+ self-contained Bun worker output into the immutable `ads://assets/…` graph.
1118
+ Module reads never compile live filesystem contents.
1119
+ - The scheduler fences the source revision before publication. Project and
1120
+ draft roots own separate compiler sessions.
1121
+ - A watched graph includes the requested scenario roots and their dependencies,
1122
+ and preserves the roots that other mounted Apps use. Untouched entries are
1123
+ not compiled until requested. Unwatched full builds keep complete entry
1124
+ coverage.
1125
+ - Worker bundle reuse and the pruning of generated output trees from watches
1126
+ are described in [MCP.md](MCP.md#warming-and-the-job-queue). The worker build
1127
+ cache is separate from source-validation evidence.
1128
+
1129
+ #### Hot updates
1130
+
1131
+ The sandboxed iframe stays alive for compatible updates and keeps component
1132
+ state, input values, focus and selection where the framework permits.
1133
+ [MCP.md](MCP.md#refresh-in-the-preview-frame) lists which change refreshes in
1134
+ place and which reopens a clean frame.
1135
+
1136
+ - A watched manifest's `hot.source` hashes the lowered module before immutable
1137
+ dependency URI rewriting, so the loader can tell changed code from a changed
1138
+ dependency address ([fields](MCP.md#output-locations-and-limits)).
1139
+ - A bounded rewrite cache avoids reparsing unchanged compiler output and still
1140
+ observes output membership and worker content changes.
1141
+ - Unopened lazy branches stay unloaded. Changed hook signatures follow the
1142
+ framework's reset semantics.
1143
+ - A failed source check restores the last verified output and stays a failure.
1144
+ State retention never substitutes for validation or acceptance.
1145
+
1146
+ Production modules refresh from the emitted tree and development files from
1147
+ the design system: the framework refresh transforms cover both directories. An
1148
+ owner edit therefore replaces the emitted owner in place even when its scenario
1149
+ module is no refresh boundary itself (it exports its `scenario` metadata).
1150
+ Otherwise the update would reach the scenario and reopen the frame.
1151
+
1152
+ **Fidelity guarantee.** A hot update renders exactly what a clean render of the
1153
+ same revision renders. `tests/browser/hot-update-fidelity.test.mjs` holds the
1154
+ guarantee in the default HTTP showcase with normal Chromium settings. It
1155
+ compares live views that received an owner source edit, and separately token
1156
+ sheet edits, as hot updates against a fresh page in a fresh browser context on
1157
+ the same revision, selections and interactions. The frames must match pixel for
1158
+ pixel. Every element's classes, interaction state and computed style, and the
1159
+ applied sheets and their order, must be equal.
1160
+
1161
+ The one explained difference is Chromium's own: a hovered rounded control whose
1162
+ radius changes in place keeps slightly different corner antialiasing than a
1163
+ fresh paint, until the pointer enters again. For that case the hot update must
1164
+ equal, pixel for pixel, a clean render whose page makes the same value change
1165
+ in place itself.
1166
+
1167
+ **Renewal and retention.** The internal graph is renewed when configuration or
1168
+ dependency manifests change, when the captured original inputs of optimized
1169
+ dependencies change, and on source-directory membership changes that can alter
1170
+ resolution ([builder graph](CACHING.md#builder-graph)). It is also renewed, and
1171
+ the frame reopened clean at the next mount, past the retention
1172
+ [limits](CACHING.md#limits): 4096 retained inputs, modules or metadata records,
1173
+ or 64 MiB of lowered source and code or of materialized resource bodies. These
1174
+ are retention limits, not process RSS guarantees. Owned Vite, worker and
1175
+ temporary-directory lifetimes end with their builder.
1176
+
1177
+ #### Validation and publication
1178
+
1179
+ Watched compilation gives immediate visual feedback. Validation and scenario
1180
+ inspection run in the background on the shared asynchronous analysis host, not
1181
+ on an inspector-owned worker. Rapid edits replace pending work, with one
1182
+ verification run in flight.
1183
+ [MCP.md](MCP.md#verified-and-live-graphs) states the contract of the two
1184
+ graphs.
750
1185
 
751
1186
  ```mermaid
752
1187
  flowchart LR
@@ -762,704 +1197,887 @@ flowchart LR
762
1197
  App --> Mount[Incompatible or rollback: clean frame]
763
1198
  ```
764
1199
 
765
- Watched compilation provides immediate visual feedback while validation and
766
- scenario inspection run in the background. Inspection uses the shared asynchronous
767
- analysis host, rather than an inspector-owned worker. Rapid edits replace pending work, with one
768
- verification run in flight. Production builds retain their own optimization.
769
-
770
- Preview discovery shares `.ds/scenario-registry.json` between the MCP host,
771
- draft selector and compiler processes. The snapshot contains scenario metadata
772
- and diagnostics, keyed to the full relevant source/dependency/directory revision
773
- and the loaded ADS code/runtime. Accepted and draft roots retain separate
774
- snapshots. A matching snapshot avoids repeating TypeScript analysis during
775
- startup; changed inputs or missing/corrupt snapshots trigger fresh discovery.
776
- Explicit catalogue reads fence their in-memory registry against current source,
777
- so edits and removals are visible before the next observation/reconciliation tick.
778
- Reopening an already known draft scenario retains its last discovered metadata
779
- while the shared asynchronous analysis service refreshes the catalogue.
780
- New/missing scenario identities await discovery; accepted comparison metadata
781
- is independently revision-fenced.
782
- The response's `discovery` distinguishes current, pending and failed metadata
783
- from the exact proposal revision and the actual preview build. Superseded worker
784
- results cannot replace newer requests; drop/shutdown removes owned discovery
785
- state and releases registered revisions. Preview analysis and checks share
786
- bounded native snapshots through `analysis/service.mjs`. Program acquisition
787
- delegates through `program-cache.mjs`; unchanged ASTs retain identity, and source,
788
- import and configuration edits invalidate the relevant snapshot. Watched graphs
789
- include requested scenario roots and their dependencies,
790
- preserving roots used by other mounted Apps; untouched catalogue entries are not
791
- compiled until requested. Unwatched full builds retain complete entry coverage.
792
- Snapshot publication fences source edits during inspection. This cache supplies
793
- no passing validation or behavior evidence: architecture and acceptance checks
794
- continue to inspect and validate source independently.
795
-
796
- Draft creation queues background compiler initialization. One prewarm runs at a
797
- time, newer pending drafts supersede unused queued work and reclaim an older
798
- unused speculative session, and explicit preview requests share the same startup.
799
- Explicitly opened sessions remain subject to the four-session bound.
800
- File events and MCP writes synchronize warm
801
- overlays after a short debounce; a slower periodic reconciliation recovers lost
802
- events and replaced directories. Closing ADS stops queued jobs, source watchers
803
- and every owned compiler.
804
-
805
- Draft build reports flow from their preview hosts into the parent build resource
806
- and proposal summaries. `ads://project/build.drafts` identifies active proposal
807
- builds, their scenario states, session/revision, freshness and scoped resource
808
- addresses; `ads_drafts` and relevant discovery/preview results carry compact
809
- status. Draft source edits immediately mark an existing preview queued/stale.
810
- Build transitions change the parent resource fingerprint and emit standard
811
- resource-update notifications for build/draft subscribers, including completion
812
- and failure without another edit. Active scoped build resources are listed and
813
- subscribable; removal emits a final invalidation and a resource-list change.
814
- Observers share draft events across connections, detach when closed and serialize
815
- refreshes so overlapping file events cannot replay older state. Native report-file
816
- events notify promptly; periodic observation also covers missed/replaced files.
817
- Stateless HTTP mutation handlers forward refreshes to those observers; they do
818
- not initialize fresh observation and misclassify each request as a source edit.
819
- Draft-only edits preserve accepted registry/catalogue snapshots. Capture updates
820
- reuse source-fenced discovery rather than allocating another semantic program.
821
- Explorer uses these reports for monochrome
822
- entry glyphs and refreshes its mounted Apps. Its notification scheduler keeps an
823
- already scheduled refresh's deadline; later build notices cannot postpone a
824
- catalogue update indefinitely. Refreshes run one at a time, and notices arriving
825
- during a refresh form one follow-up batch that retains any discovery request.
826
- A ready draft preview remains
827
- unaccepted; catalogue metadata or compiled feedback cannot establish acceptance.
828
-
829
- Live resources are fenced to the current source digest and managed session.
830
- They never update accepted artifacts, the successful graph cache or `current`.
831
- Only validation and compilation passing against unchanged source can publish the
832
- verified graph. Failure restores the last verified view; compilation errors are
833
- reported without waiting for a slow validation command. Files outside the compiled
834
- module graph still cause validation and build reconciliation. Normal compiler
835
- shutdown clears its current transform/worker caches and removes its scratch directory.
836
-
837
- The shared Bun builder reuses unchanged worker bundles using source, transitive
838
- dependency and configuration hashes. Workers compile sequentially in temporary
839
- Bun processes, which release their heaps before the next worker runs. This build
840
- cache is separate from source-validation evidence.
841
-
842
- Accepted MCP edits prepare previews even when no viewer has opened them. A
843
- matching checked candidate graph and scenario registry carry into the project's existing cache;
844
- otherwise the normal watcher builds it in the background. Builds tied to a
845
- temporary candidate location are rebuilt. Source, dependencies, compiler and
846
- output content determine reuse, with no expiry based on elapsed time.
847
- Cache recording checks the compiled source stamp before and after hashing
848
- dependencies. An edit racing publication cannot associate previous output with
849
- newer inputs; it leaves the previous cache intact and requires the next build.
850
- A transferred checked graph can refresh older watcher metadata without recompiling
851
- it, while a partial watched graph cannot replace the complete catalogue.
852
- Its full semantic registry snapshot transfers only when source revisions match,
853
- so reopening a compiler need not repeat discovery of accepted source.
854
- Shared dependency maps are stored once, with a fresh validation memo for each
855
- reuse operation. No file hash is retained across operations. Configuration input
856
- ordering is canonical; complete caches stay within the
857
- existing 8 MiB budget rather than silently writing an unreadable large file.
858
-
859
- Background acceptance, validation and architecture checks serialize independently
860
- of the accepted/draft preview lane. They never suspend Explorer's compiler or
861
- make a cold selection wait for a browser verification suite. Existing publications
862
- remain readable while interactive source changes compile.
1200
+ - **Two graphs.** Live resources are fenced to the current source digest and
1201
+ managed session and never update accepted artifacts, the successful graph
1202
+ cache or `current`. Only validation and compilation that both pass against
1203
+ unchanged source publish the verified graph; a failure restores the last
1204
+ verified view.
1205
+ - **Recovery.** Guarded publication invalidates the compiler explicitly.
1206
+ Content reconciliation recovers missed atomic file replacements, so OS watch
1207
+ delivery cannot establish freshness.
1208
+ - **Request batches.** New preview requests share one input-stamp capture per
1209
+ batch. After that asynchronous capture, scheduling reads the current
1210
+ candidate, publication and registry together. A candidate that completes or
1211
+ is replaced during capture cannot lose a requested view or lend coverage from
1212
+ a retired candidate.
1213
+ - **Waiting.** The built-in client waits only for compiled output on
1214
+ interactive selections; default MCP preview calls, captures and verification
1215
+ wait for verified output. A pending selection never reports App readiness as
1216
+ verified. Discovery notifications are reconciled after validation.
1217
+ - **Remount or retain.** A successful global revision does not remount an
1218
+ unchanged selected view. The App compares its static module, style and asset
1219
+ closure and keeps DOM, form and scroll state when it matches. When it
1220
+ changes, a watched graph refreshes compatible framework boundaries, and a
1221
+ complete bundled graph remounts through the generated mount.
1222
+ - **Framing.** The visible preview keeps its framing while replacement
1223
+ resources load. Kind and subject framing change only after a successful
1224
+ mount. Structural padding is resolved before paint, including delayed
1225
+ framework commits, and font readiness does not temporarily restore specimen
1226
+ padding during reloads. The subject stage takes its subjects by selector
1227
+ (a scenario's specimen boxes, a view's samples), measures their border
1228
+ boxes, and again when the document's theme or brand changes. So a change that
1229
+ only moves a subject, or changes its border or padding, still moves its
1230
+ stage.
1231
+ - **Status.** The showcase's header indicator exposes compilation, checking,
1232
+ reload and fallback status ([showcase client](MCP.md#built-in-showcase-client)).
1233
+ Messages from an older selection cannot end the loading transition of an
1234
+ entry switch.
1235
+ - **Lanes.** Background acceptance, validation and checks serialize
1236
+ independently of the accepted/draft preview lane. They never suspend
1237
+ Explorer's compiler or make a cold selection wait for a browser verification
1238
+ suite. Published graphs stay readable while source changes compile.
1239
+ - **Shutdown.** Normal compiler shutdown clears the current module and worker
1240
+ caches and removes the scratch directory.
1241
+
1242
+ #### Scenario discovery snapshots
1243
+
1244
+ Preview discovery shares `.ds/scenario-registry.json` between the MCP host, the
1245
+ draft selector and the compiler processes.
1246
+
1247
+ - The snapshot holds scenario metadata and diagnostics, keyed to the full
1248
+ relevant source, dependency and directory revision and to the loaded ADS code
1249
+ and runtime.
1250
+ - Accepted and draft roots have separate snapshots. Draft-only edits preserve
1251
+ accepted registry snapshots.
1252
+ - A matching snapshot avoids repeated discovery during startup. Changed inputs,
1253
+ or a missing or corrupt snapshot, trigger fresh discovery.
1254
+ - Explicit registry reads fence their in-memory registry against current
1255
+ source, so edits and removals are visible before the next observation or
1256
+ reconciliation tick.
1257
+ - Snapshot publication fences source edits during inspection.
1258
+
1259
+ For drafts:
1260
+
1261
+ - A reopened, already known draft scenario keeps its last discovered metadata
1262
+ while the shared analysis service refreshes the registry.
1263
+ - New or missing scenario identities wait for discovery. Accepted comparison
1264
+ metadata is revision-fenced independently.
1265
+ - The response's `discovery` distinguishes current, pending and failed metadata
1266
+ from the exact proposal revision and the actual preview build.
1267
+ - Superseded worker results cannot replace newer requests. Drop and shutdown
1268
+ remove owned discovery state and release registered revisions.
1269
+ - Capture updates reuse source-fenced discovery and allocate no other semantic
1270
+ program.
1271
+
1272
+ Preview analysis and checks share bounded native snapshots through
1273
+ `analysis/service.mts`. Program acquisition delegates through
1274
+ `program-cache.mts`. Unchanged ASTs keep their identity; source, import and
1275
+ configuration edits invalidate the relevant snapshot.
1276
+
1277
+ This cache supplies no passing validation or behavior evidence: checks and
1278
+ acceptance inspect and validate source independently.
1279
+
1280
+ #### Draft preview startup and build reports
1281
+
1282
+ **Startup.** Draft creation queues background compiler initialization.
1283
+
1284
+ - One prewarm runs at a time. Newer pending drafts supersede unused queued work
1285
+ and reclaim an older unused speculative session.
1286
+ - Explicit preview requests share the same startup. At most four draft preview
1287
+ sessions are starting at one time: one more retires the oldest starting
1288
+ session.
1289
+ - File events and MCP writes synchronize warm overlays after a short debounce.
1290
+ A slower periodic reconciliation recovers lost events and replaced
1291
+ directories.
1292
+ - Closing ADS stops queued jobs, source watchers and every owned compiler.
1293
+
1294
+ **Reports.** Draft build reports flow from their preview hosts into the parent
1295
+ build resource and the proposal summaries.
1296
+
1297
+ - `ads://project/build.drafts` identifies active proposal builds, their
1298
+ scenario states, session and revision, freshness and scoped resource
1299
+ addresses. `ads_drafts` and the relevant discovery and preview results carry
1300
+ compact status.
1301
+ - A draft source edit immediately marks an existing preview queued/stale.
1302
+ - A build transition changes the parent resource fingerprint and emits standard
1303
+ resource-update notifications for build and draft subscribers, including
1304
+ completion and failure without another edit.
1305
+ - Active scoped build resources are listed and subscribable. Removal emits a
1306
+ final invalidation and a resource-list change.
1307
+
1308
+ **Observers.** Observers share draft events across connections, detach when
1309
+ closed, and serialize refreshes so overlapping file events cannot replay older
1310
+ state. Native report-file events notify promptly; periodic observation covers
1311
+ missed or replaced files. Stateless HTTP mutation handlers forward refreshes to
1312
+ those observers. They do not initialize fresh observation, which would
1313
+ misclassify each request as a source edit.
1314
+
1315
+ **Explorer.** Explorer uses these reports for its monochrome entry glyphs and
1316
+ refreshes its mounted Apps. Its notification scheduler keeps an already
1317
+ scheduled refresh's deadline, so later build notices cannot postpone a registry
1318
+ update indefinitely. Refreshes run one at a time; notices that arrive during a
1319
+ refresh form one follow-up batch that keeps any discovery request.
1320
+
1321
+ A ready draft preview is still unaccepted: discovery metadata and compiled
1322
+ feedback cannot establish acceptance.
1323
+
1324
+ #### Previews after accepted edits
1325
+
1326
+ Accepted MCP edits prepare previews even when no viewer has opened them
1327
+ ([MCP](MCP.md#preparation-after-accepted-edits)).
1328
+
1329
+ - A matching checked candidate graph and scenario registry carry into the
1330
+ project's cache. Reuse follows content, never elapsed time.
1331
+ - A transferred checked graph can refresh older watcher metadata without a
1332
+ recompile, while a partial watched graph cannot replace the complete
1333
+ registry. Its full registry snapshot transfers only when the source revisions
1334
+ match, so a reopened compiler need not repeat discovery of accepted source.
1335
+ - Cache recording checks the compiled source stamp before and after it hashes
1336
+ dependencies. An edit that races publication therefore cannot associate
1337
+ previous output with newer inputs: it leaves the previous cache intact and
1338
+ requires the next build.
1339
+ - Shared dependency maps are stored once, with a fresh validation memo for each
1340
+ reuse operation. No file hash is kept across operations. Configuration input
1341
+ ordering is canonical.
1342
+ - A complete cache stays within the 8 MiB budget; ADS does not silently write
1343
+ an unreadable large file.
1344
+
1345
+ #### Production previews for acceptance
863
1346
 
864
1347
  For managed resource previews, ADS requests the scenarios in production mode
865
- through the reviewed draft's workspace, compiled by ADS's managed compiler and
866
- served by its host. Only a candidate without such a workspace gets a preview host
867
- of its own; its compiler is parked after production publication while the host
868
- continues serving that immutable graph to registered browser verification. Either
869
- way the incremental graph is closed before production compilation starts.
870
- Warming an already-current selection does not restart or wait for that compiler.
871
- Production reuse requires a successful production build of the exact inputs,
872
- not merely a previously compiled development graph. Project-owned additional
873
- commands still run as configured. Remove the standalone preview-build command
874
- from `acceptance.scripts`; keep it in the ordinary project build.
875
-
876
- Candidate architecture inspection shares the project's native compiler through
877
- an isolated snapshot rather than starting a compiler for each acceptance.
878
- Releasing a candidate drops its adapters, resolvers and snapshot leases while
879
- keeping live/sibling revisions valid. The service bounds active project/revision
880
- state and closes after idle time when no registered revision pins it. Direct
881
- library and syntax-only clients have their own short idle cleanup. Closing one
882
- scenario inspector cancels its requests without retiring other callers' shared
883
- compiler. Persisted registry metadata has separate content checks.
884
-
885
- After the selected view paints, a connected showcase can prefetch changed peers'
886
- static resources into the App's existing byte cache. This bounded, opportunistic
887
- work neither evaluates modules nor mounts hidden examples. Navigation remains
888
- independent of background preparation, and resource integrity checks still apply.
889
-
890
- A successful global revision does not require remounting an unchanged selected
891
- view. The App compares its static module/style/asset closure, retains DOM/form/
892
- scroll state when that closure matches, and reruns token/paint audits against the
893
- accepted manifest. Watched graphs refresh compatible framework boundaries when
894
- the selected closure changes; complete bundled graphs remount through the
895
- project's adapter. Native ESM resources still obey digest checks and the bounded
896
- revision lifecycle described above.
897
- The visible preview retains its framing while replacement resources load. Kind
898
- and subject framing change only after a successful mount; structural padding is
899
- resolved before paint, including delayed framework commits. Font readiness and
900
- the later audits do not temporarily restore specimen padding during reloads.
901
-
902
- Incremental compilation is separate from test selection. Preview refresh runs the
903
- adapter's validation callback. Draft acceptance executes the draft owners' own
904
- registered behavior checks when `acceptance.behavior` is enabled. `ads validate`
905
- selects affected behavior owners through registered input dependencies; a shared
906
- foundation change can select every owner. Configured project checks still run as
907
- authored; releases run the full test suite. ADS does not claim per-test-case
908
- selection or skip validation because a module transform was cached.
909
-
910
- Architecture inspection shares immutable ASTs/programs, native semantic queries
911
- and request-scoped facts. A new inspection still observes current source and
912
- configuration; successful reports are reused only for their exact input key.
913
- Source scans prepare generated-directory and source-root comparisons once per
914
- inventory. Every scan still discovers tests and hashes current input bytes.
915
-
916
- After source changes, validation and compilation must both succeed before a new
917
- graph becomes current. MCP announces build/resource updates.
918
- Build success records the project input digest captured before compilation;
919
- status reads independently verify that digest and the output bytes. Unchanged
920
- asset checks reuse bounded verification metadata keyed by the expected digest
921
- and file identity, size and nanosecond modification/change timestamps. Resource
922
- delivery still hashes the actual returned bytes. Guarded
923
- publication invalidates the compiler explicitly. Content reconciliation recovers
924
- missed atomic file replacements, so OS watch delivery cannot establish freshness.
925
- The built-in client uses `waitFor: compiled` for interactive selections, so it
926
- can browse compiled feedback or a retained verified graph while checks run.
927
- Default MCP preview calls, captures and verification still wait for verified
928
- output. Pending selections never report App readiness as verified. Discovery
929
- notifications are reconciled after validation through asynchronous discovery.
930
- The App retains or remounts its view
931
- according to its dependency closure. A quiet monochrome indicator in the
932
- showcase's upper-right header exposes compilation, checking, reload and fallback
933
- status through its accessible label, tooltip and details popover. Editing keeps
934
- the widget area interactive without overlays. Switching entries uses a temporary
935
- loading spinner until the selected App mounts; messages from an older selection
936
- cannot end that transition. External Apps hosts retain an in-App
937
- fallback. Invalid scenario metadata at startup and later source
938
- failures stay in the watcher's recoverable diagnostic path. Fixing source triggers validation again.
939
- If the compiler process exits, the next preview request starts one fresh child;
940
- MCP inspection remains available. Each child generation has its own status report,
941
- so independent MCP clients do not overwrite each other's build state.
942
- Standalone compilation writes `.ds/build-status.json`. A compiler managed by MCP
943
- coordinates with its watcher over direct IPC (`src/mcp/compiler-channel.mjs`): a
944
- private local socket (a Unix socket in a 0700 temporary directory, or a named pipe on
945
- Windows) named with a per-launch token in the compiler's environment, so it works
946
- through any configured compiler command. Requests and draft control go to the
947
- compiler; build reports, full-build results and input digests come back, keyed by
948
- session and held in the MCP process. The latest request and draft list are replayed
949
- when a compiler (re)connects. Nothing is exchanged through `.ds/` status files;
950
- preview artifacts and resources keep their own transport. Session identity
951
- separates revisions across restarts; source and artifact digests establish
952
- freshness independently of process state.
953
- Those source digests cover only ADS-owned inputs: `ds.config.json`, the
954
- design-system folder and the public folders it declares. Package versions are
955
- pinned in `ds.config.json` (`name@version`), so compiled-preview cache keys need no
956
- project lockfile, `tsconfig.json`, `src/` or `node_modules` read either. The managed
957
- compiler is the one owner of the digest map of these inputs (`src/input-digests.mjs`)
958
- and the only process that watches them. One full walk seeds it, and file events on
959
- the owned folders and `ds.config.json` name the files to read again; equal size or
960
- modification time never counts as unchanged. Additions, removals, renames, unnamed
961
- events, watcher errors and configuration changes force a full walk before the next
962
- answer, and a periodic full walk (at most every 30 s) is the safety net. The compiler
963
- sends each changed map to MCP and marks it pending the moment an event arrives.
964
- Before a request answers from the map, MCP asks the compiler to flush: it processes
965
- every file event already delivered, re-reads those files and replies with its map, so
966
- an edit made before a status read is never reported as built. Without a reply within
967
- one second the request walks the owned inputs. MCP's
968
- status, discovery and capture reads use that map; without a running managed
969
- compiler (CLI commands, a stopped or parked compiler) they walk the owned inputs.
970
- Draft workspaces change only through MCP: the draft controller sends each written or
971
- removed file to the draft's hosted compiler instance over the same channel, and
972
- neither the controller nor the draft instances watch files. Accepted-source changes
973
- reach open draft previews through the project map.
974
- Within one read-only request (a tool call such as `ads_show_scenario`, an
975
- accepted-project resource read, an observation pass, a build-report change or a
976
- preview wait), every reader shares one revision. A wait reads it again only after
977
- the compiler's status report changes. Discovery and capture fence long work with a
978
- fresh walk. Compiler children, timers and shared discovery tasks start outside any
979
- request's revision.
980
-
981
- Validation evidence and draft acceptance still use the full project input set
982
- (`validationInputFiles`), because they run the project's own scripts and copy what
983
- those scripts need into candidate workspaces; draft preview workspaces are still
984
- full copies for the same reason. Planned for V3 Phase 2: narrow those to ADS-owned
985
- inputs (the digest map is keyed by an input-set definition, so the narrower set
986
- reuses the same map and fallbacks), serve draft bytes to the compiler without a
987
- workspace copy, and measure whether one compiler graph per draft still costs enough
988
- to justify a deliberate multi-root graph.
989
- Compilation remains necessary for TSX and Linaria;
990
- there is one preview pipeline with automatic updates.
991
-
992
- Scenario entries, adapters and fixtures are development source even when
993
- colocated with production components. Runtime imports and public-barrel exports
994
- cannot cross that boundary. Static checks require real public render references
995
- reachable from the scenario entry; browser tests still verify mounting, states,
996
- accessibility and visual parity.
997
-
998
- The working example and starter build one shared multi-entry graph on first
999
- preview demand or accepted-edit preparation, then reuse it across selections and
1000
- unchanged restarts. The App loads the selected scenario's static dependency
1001
- closure and may prefetch changed peers; dynamic imports remain lazy. Production
1002
- bundles, workers and cancellation stay project-owned.
1003
- The MCP server serves compiled bytes without evaluating project TSX. Compiler
1004
- adapters normalize each entry to mount/unmount, retaining native React or Preact
1005
- semantics; choosing a framework does not install one into the tooling host.
1348
+ through the workspace of the reviewed draft. ADS's managed compiler compiles
1349
+ them and its host serves them.
1350
+
1351
+ - Only a candidate without such a workspace gets a preview host of its own. Its
1352
+ compiler is parked after production publication, and the host keeps serving
1353
+ that immutable graph to registered browser verification.
1354
+ - In both cases the incremental graph is closed before production compilation
1355
+ starts.
1356
+ - Warming an already-current selection does not restart that compiler or wait
1357
+ for it.
1358
+ - Production reuse requires a successful production build of the exact inputs.
1359
+ A previously compiled development graph is not enough.
1360
+ - Project-owned additional commands run as configured. A standalone
1361
+ preview-build command belongs in the ordinary project build, not in
1362
+ `acceptance.scripts`.
1363
+
1364
+ Candidate inspection shares the project's native compiler through an isolated
1365
+ snapshot; no compiler starts per acceptance. The release of a candidate drops
1366
+ its adapters, resolvers and snapshot leases, and keeps live and sibling
1367
+ revisions valid.
1368
+
1369
+ #### The compiler process and its channel
1370
+
1371
+ If the compiler process exits, the next preview request starts one fresh child.
1372
+ MCP inspection stays available. Each child generation has its own status
1373
+ report, so independent MCP clients do not overwrite each other's build state.
1374
+
1375
+ Standalone compilation writes `.ds/build-status.json`. A compiler managed by
1376
+ MCP coordinates with its watcher over direct IPC
1377
+ (`src/mcp/compiler-channel.mts`):
1378
+
1379
+ - The channel is a private local socket: a Unix socket in a 0700 temporary
1380
+ directory, or a named pipe on Windows.
1381
+ - The socket is named with a per-launch token in the compiler's environment, so
1382
+ it works through any configured compiler command.
1383
+ - Requests and draft control go to the compiler. Build reports, full-build
1384
+ results and input digests come back, keyed by session and held in the MCP
1385
+ process.
1386
+ - The latest request and the draft list are replayed when a compiler connects
1387
+ or reconnects.
1388
+ - Nothing is exchanged through `.ds/` status files. Preview artifacts and
1389
+ resources keep their own transport.
1390
+
1391
+ Session identity separates revisions across restarts. Source and artifact
1392
+ digests establish freshness independently of process state.
1393
+
1394
+ **Build evidence.** Build success records the project input digest captured
1395
+ before compilation. Status reads verify that digest and the output bytes
1396
+ independently. Unchanged asset checks reuse bounded verification metadata,
1397
+ keyed by the expected digest and the file identity, size and nanosecond
1398
+ modification and change timestamps. Resource delivery still hashes the actual
1399
+ returned bytes.
1400
+
1401
+ #### Input sets
1402
+
1403
+ Two input sets decide freshness. Both hold only design-system inputs.
1404
+
1405
+ | Set | Used by | Contains |
1406
+ | --- | --- | --- |
1407
+ | Owned inputs | Source digests, compiled-preview cache keys; status, discovery and capture reads | `ds.config.json`, the design-system folder, and the package manifest and lockfile(s) |
1408
+ | Validation inputs (`validationInputFiles`) | Validation evidence and draft acceptance | The owned inputs, plus the TypeScript configuration chain, dependency-resolution configuration (`.npmrc`, `bunfig.toml`, `.yarnrc.yml`, patched dependencies, the installed-dependencies digest), the entry files of configured package scripts with their import closure, notices and `validation.inputs` |
1409
+
1410
+ The validation set is wider because validation and acceptance run the project's
1411
+ own scripts and copy what those scripts need into candidate workspaces. Draft
1412
+ preview workspaces are full copies of that set.
1413
+
1414
+ Neither set holds application source, public folders, the root `index.html` or
1415
+ tests outside `dsDir`. So an application, backend, native-toolchain or
1416
+ documentation edit never stales a validation, preview or acceptance revision.
1417
+ The emitted output folder is never an input.
1418
+
1419
+ Compiled-preview cache keys need no read of application source or
1420
+ `node_modules`. The preview compiler's own inputs are the TypeScript
1421
+ configuration chain and `bunfig.toml`.
1422
+
1423
+ **Widening and fences.**
1424
+
1425
+ - A change outside `dsDir` (configuration, manifest, lockfiles or tooling)
1426
+ widens changed-scope validation to everything.
1427
+ - Opaque commands declare additional files or directories through
1428
+ `validation.inputs`; these add to the mandatory scope.
1429
+ - During validation and acceptance, the source-change fence watches `dsDir`,
1430
+ `ds.config.json`, the manifest and lockfiles, and `validation.inputs`,
1431
+ alongside the captured configuration files.
1432
+ - Guarded edits also fence every patched file and both sides of a configuration
1433
+ change. Candidate commands cannot rewrite source while ADS checks it.
1434
+
1435
+ The [validation guide](../skills/ads-designer/references/validation.md) holds
1436
+ the operational details.
1437
+
1438
+ **The digest map.** The managed compiler is the one owner of the digest map of
1439
+ the owned inputs (`src/input-digests.mts`) and the only process that watches
1440
+ them.
1441
+
1442
+ - One full walk seeds the map.
1443
+ - File events on the owned folder, `ds.config.json` and the manifest and
1444
+ lockfiles name the files to read again. Equal size or modification time never
1445
+ counts as unchanged.
1446
+ - Additions, removals, renames, unnamed events, watcher errors and
1447
+ configuration changes force a full walk before the next answer. A periodic
1448
+ full walk (at most every 30 s) is the safety net.
1449
+ - The compiler sends each changed map to MCP, and marks the map pending the
1450
+ moment an event arrives.
1451
+
1452
+ Before a request answers from the map, MCP asks the compiler to flush: the
1453
+ compiler processes every file event already delivered, reads those files again
1454
+ and replies with its map. An edit made before a status read is therefore never
1455
+ reported as built. Without a reply within one second, the request walks the
1456
+ owned inputs.
1457
+
1458
+ MCP's status, discovery and capture reads use that map. Without a running
1459
+ managed compiler (CLI commands, a stopped or parked compiler) they walk the
1460
+ owned inputs.
1461
+
1462
+ **Draft workspaces.** Draft workspaces change only through MCP. The draft
1463
+ controller sends each written or removed file to the draft's hosted compiler
1464
+ instance over the same channel; neither the controller nor the draft instances
1465
+ watch files. Accepted-source changes reach open draft previews through the
1466
+ project map.
1467
+
1468
+ **One revision per request.** Within one read-only request (a tool call such as
1469
+ `ads_show_scenario`, an accepted-project resource read, an observation pass, a
1470
+ build-report change or a preview wait), every reader shares one revision. A
1471
+ wait reads it again only after the compiler's status report changes. Discovery
1472
+ and capture fence long work with a fresh walk. Compiler children, timers and
1473
+ shared discovery tasks start outside any request's revision.
1474
+
1475
+ #### Compilation is separate from test selection
1476
+
1477
+ A cached module never skips validation, and ADS does not claim per-test-case
1478
+ selection.
1479
+
1480
+ | Trigger | What runs |
1481
+ | --- | --- |
1482
+ | Preview refresh | The adapter's validation callback |
1483
+ | Draft acceptance | The draft owners' own registered behavior checks, when `acceptance.behavior` is enabled |
1484
+ | `ads validate` | The affected behavior owners, selected through registered input dependencies; a shared foundation change can select every owner |
1485
+
1486
+ Configured project checks run as authored. Releases run the full test suite.
1487
+
1488
+ Checks share immutable ASTs and programs, native semantic queries and
1489
+ request-scoped facts. A new check still observes current source and
1490
+ configuration. A successful report is reused only for its exact input key.
1491
+ Within a running process, an owner whose analysis inputs are unchanged keeps
1492
+ its analysis and emitted module
1493
+ ([caching](CACHING.md#owner-analysis-reuse)).
1494
+
1495
+ The analysis service bounds active project and revision state. It closes after
1496
+ idle time when no registered revision pins it. Direct library clients and
1497
+ syntax-only clients have their own short idle cleanup. A one-shot CLI command
1498
+ closes its clients when it has reported, so it exits without a wait for that
1499
+ idle period. When one scenario inspector closes, its requests are canceled and
1500
+ the shared compiler of other callers stays. Persisted registry metadata has
1501
+ separate content checks.
1006
1502
 
1007
1503
  ## On-demand visual evidence
1008
1504
 
1009
- The capture unit is a registered, independently mountable scenario or one of its
1010
- project-declared `captureTargets`. Components, patterns, compositions and token
1011
- previews use the same real isolated frame, fixtures and adapter as interactive review.
1012
- Shared controllers/hooks need a visible demonstration. Capture introduces no
1013
- tool-owned component templates, styling or fixture inference.
1014
-
1015
- ADS owns isolated preview hosting, App readiness and an owned Playwright process;
1016
- the receiving project supplies Playwright and its installed browser. The capture
1017
- host is the HTTP showcase with navigation hidden, giving the
1018
- isolated preview the requested viewport. Project runtime, fonts and styles remain
1019
- inside the App resource graph. The image excludes showcase chrome.
1020
-
1021
- Captures exist only when requested. `ads_capture` replaces current and removes any
1022
- candidate for that scenario/target; with a draft and its exact revision it renders
1023
- current and candidate under matching settings without changing live source.
1024
- Acceptance and its dry run take no screenshots.
1025
- A new scenario has no fabricated baseline. Final freshness/conflict checks precede
1026
- image publication. Matching accepted source promotes candidate to current.
1027
-
1028
- There are at most two slots per target: current and candidate. Revisions/settings
1029
- are metadata, not new resource identities. There is no previous slot, accumulating
1030
- history or TTL. Stale source is identified explicitly; deleted targets are collected.
1031
- PNG/pixel/store limits and explicit clearing bound generated storage. These images
1032
- are visual evidence for one state, not passing behavioral guarantees.
1033
-
1034
- One MCP capture index and a PNG resource template expose stable image slots.
1035
- Subscriptions receive resource updates when images change or disappear. The pair
1036
- is published as one atomic generated record under `.ds/captures/` and stays outside
1037
- source ownership and product bundles. Detailed usage lives in each portable skill's
1038
- [capture reference](../skills/ads-designer/references/captures.md).
1039
-
1040
- ## Brand assets and icons
1041
-
1042
- Brand artwork lives in `assets/brand/`: SVG masters, finished PNG/JPEG/WebP images and
1043
- delivered `.ico`/`.icns` files, each described with its use and license in the folder's
1044
- README. ADS generates the Brand view from those assets, including construction grids
1045
- and actual-size samples; projects do not author brand preview scenarios.
1046
-
1047
- `ads assets` makes three kinds of output. Web icons from `assets.iconSource` are rebuilt
1048
- into ignored `.ds/assets/` on every build, for the application's bundler. Committed targets
1049
- (`assets.targets`) are native and upload outputs that must exist without running ADS (a
1050
- Tauri bundle, a tray icon compiled into a binary, a file uploaded by hand): each copies or
1051
- renders one master to a project path, and the committed `assets/generated.json` records
1052
- its master hash, settings and output hash. A glyph set (`assets.glyphs`) turns a folder of
1053
- icon SVGs into one typed module. Freshness is checked by comparing recorded hashes, never by
1054
- rendering, so the result is the same on every machine; a finished image is never enlarged.
1055
- The starter's `Icon` and `IconButton` read that module: icons take `currentColor`, pair
1056
- their size with text, and an icon-only button always has a label. The showcase renders the
1057
- glyph set itself in its Icons tab, from the folder and the same default attributes the
1058
- module uses, so a set is reviewed without a project scenario. Other products' logos
1059
- live in `assets/logos/`, outside both the brand artwork and the glyph set: they keep their
1060
- owners' colors, render as images, and are never muted, tinted or recolored (a one-color mask
1061
- only where the owner's rules allow it, in the colors they name). ADS generates and checks
1062
- nothing there.
1063
-
1064
- ### Declared artwork/text lockups
1065
-
1066
- `@ads-lockup { artwork: .hook; text: .other-hook; size: --icon-sm; }` is an opt-in
1067
- construction on an owned row. It emits ordinary CSS for centered artwork, an intrinsic
1068
- aspect ratio, a baseline-aligned text group and font-metric trimming of the group's
1069
- native text runs. It does not impose a canvas shape, symmetric artwork, internal
1070
- padding or cap-height-sized logos. Older browsers without text trimming retain box
1071
- centering. The [branding guide](../skills/ads-designer/references/branding.md#aligning-artwork-with-text)
1072
- contains the complete authoring example and visual-review boundaries.
1073
-
1074
- The `lockup-construction` control is a blocking source check, shared by `ads check`,
1075
- validation and draft acceptance. It rejects malformed declarations, missing or
1076
- unresolved owned hooks, explicitly distorted inline SVGs and conflicting geometry,
1077
- alignment or text-trimming declarations across resolved class compositions. It
1078
- does not claim proof of painted-edge alignment or inspect opaque artwork internals.
1079
-
1080
- `src/construction-styles.cjs` runs the pure lockup and spatial transforms for both
1081
- checking and the public Linaria resolver, including preview compilation. The lockup
1082
- transform in `src/lockup-model.cjs` reads no files and needs no spatial model. Generated
1083
- declarations retain their rule identity for shared CSS override protection.
1084
- `src/lockup-composition.mjs` binds the declaration through the existing captured native
1085
- AST/class-composition analysis. It adds no compiler, source capture, disk reads or
1086
- persistent rule-local cache. Preview fingerprints include the transform modules;
1087
- changes cannot reuse previously compiled output. Optical review remains separate
1088
- from these source-only checks and benchmarks.
1089
-
1090
- ## Build checks keep the architecture in place
1091
-
1092
- The project build runs ADS checks before producing application or showcase
1093
- output. These checks enforce token use, source ownership, public imports,
1094
- showcase coverage, component state boundaries, and separation of runtime code from development
1095
- fixtures. Component-specific usage rules extend the shared checks when needed.
1096
-
1097
- Themes and brands are declared in `ds.config.json` and are only value sets: every theme and
1098
- brand shares the same token names. A theme sets the color mode and a brand sets identity
1099
- values (an accent ramp, a font), so a white-label product needs one brand per customer
1100
- rather than one theme per customer and mode. The declaration is the one list the showcase,
1101
- captures, preview host context, contrast review, render audit and token export read, so a
1102
- project can add a high-contrast theme or a brand without tool changes.
1103
-
1104
- A token that differs per theme is authored as one plain half per theme (`--x-light`,
1105
- `--x-dark`) on `:root`, and a brand re-sets its halves on `[data-brand]`. ADS generates
1106
- `themes.generated.css` from them: each `[data-theme]` sets inherited switch properties,
1107
- and each themed token resolves from its halves through those switches on every theme and
1108
- brand anchor. Custom properties inherit and resolve where they are declared, so every
1109
- element takes the halves of its nearest brand and the switch of its nearest theme, at any
1110
- nesting depth and in any order, with plain CSS variables. The same switches give display
1111
- switches (`--display-<theme>`, `--display-brand-<brand>`) for content that belongs to one
1112
- theme or brand. Theme and brand selectors are not used, in tokens or components, because
1113
- CSS resolves them by specificity and order, not by nearest ancestor.
1114
-
1115
- Because every themed value is a plain half, ADS also resolves every color token for every
1116
- theme and brand ahead of time into `themes.generated.ts`. Renderers that need colors as
1117
- values (Canvas, WebGL, SVG graphs) look them up there for the element's nearest context,
1118
- instead of asking the browser to normalize a color per drawn item.
1119
-
1120
- ADS findings are errors, review items or info items. An error is a rule ADS can decide: it
1121
- fails `ads check`, validation and acceptance, and no setting turns it off. Token, theme, brand,
1122
- glyph and accessibility rules read from tokens and source are errors: contrast between the
1123
- roles that meet on screen, declared component pairs and source-proven composed text/backdrop
1124
- pairs, in every theme and
1125
- brand, the 2 px spacing rhythm, fixed widths built from spacing tokens, theme and brand
1126
- coverage, brand artwork that is undescribed, unlicensed or unpreviewed, glyphs off the
1127
- shared viewBox or with fixed colors, controls padded off their size, target size, focus,
1128
- text resize, reduced motion, text spacing, image alternatives and icon-only controls. A
1129
- review item names something source analysis cannot settle (overlapping atomic declarations,
1130
- equal token values with possibly different roles, keyboard reach, unused artwork, color reads
1131
- in a render path); it is shown with guidance and never blocks. An info item notes an analysis
1132
- limit. Stale or hand-edited generated outputs are errors, since they ship.
1133
-
1134
- The [spatial check map](SPATIAL-CHECKS.md) records GC-01–GC-06 enforcement, supported
1135
- construction boundaries and focused evidence, including per-call container ancestry,
1136
- placement alternatives and protection of emitted geometry.
1137
-
1138
- Fixed minima use the spatial scale, mini/fine units, standard control/icon dimensions or
1139
- explicit `layout.widthTokens` roles; their resolved minimum must fit the spatial maximum.
1140
- Projects without a spatial definition may use their shared spacing primitives. The checker
1141
- follows private aliases and calculated expressions. Responsive, fractional and intrinsic
1142
- sizing remain supported; maximum sizes can cap otherwise fixed dimensions. Validated
1143
- `@ads-layout` fixed/hybrid tracks use their own local algebra. Declared fixed roles and
1144
- `layout.fixedWidthUnits` owners remain visible as review findings. The browser
1145
- audit adds what source cannot show: axe-core, non-text contrast of control borders and icons,
1146
- image shape and horizontal overflow at 390, 768 and 1280 px, by resizing each rendered scenario. It
1147
- also narrows components and patterns to a 240 px container: a set width above the browser review threshold of 96 px
1148
- that overflows it is a review item, since whether a part ever sits in a pane takes judgement.
1149
-
1150
- Audit previews retain the same subject framing and layout as showcase previews but disable
1151
- the decorative grey surround and clipped canvas layer before mounting. The preview root
1152
- therefore paints the project's theme/brand canvas directly, so axe and non-text contrast
1153
- resolve the real ancestor background. Authored surfaces remain intact. Image shape uses
1154
- untransformed CSS dimensions: explicit ratios respect `box-sizing`, while width/height
1155
- attribute ratios compare the content box, excluding border and padding.
1156
-
1157
- Each render waits, bounded, for its content to settle before anything is measured, and says so when it
1158
- did not. The audit also renders what a scenario shows only after someone acts on it. It opens what
1159
- `aria-haspopup` controls open, and hovers and focuses controls for contrast. Each worker lists what
1160
- every render could measure, then assigns targets in request order, so which render measures a shared
1161
- control does not depend on page speed. Its result states what it covered, and what it skipped is an
1162
- info item per reason. `mcp.auditPages` (1–16, default 4) sets how many pages render at once.
1163
-
1164
- The audit runs in both gates. Draft acceptance audits the draft owners' own UI
1165
- scenarios unless `acceptance.audit` is false. `ads validate` always audits every
1166
- scenario its change set reaches through imports: everything with scope `all`, and
1167
- with scope `changed` what changed since the last successful full run (all scenarios
1168
- after shared configuration, foundation or token changes). The cost of auditing what
1169
- a change reaches grows with how widely the owner is used, so it runs once for a
1170
- series of drafts, before a commit or release, rather than on every acceptance. A dry run's audit is remembered by candidate revision and selection,
1171
- so accepting that revision does not render again.
1172
-
1173
- Static errors split by what they stop. A preview session the audit starts renders despite policy
1174
- errors, records no pass, and reports them with the audit's findings; the audit still exits non-zero.
1175
- Only errors that stop rendering block it (source and CSS syntax, project structure, the styles entry,
1176
- scenario contracts). `ads check`, `ads compile`, validation and acceptance stop on every error.
1177
-
1178
- Fonts are read from `tokens/fonts.css` and `base.css`. `ads assets` generates a module naming the files
1179
- the first text uses, importing each plainly so that Vite, Bun and the preview compiler give the
1180
- stylesheet's URL. `ads check` holds declared faces against the weights CSS uses. ADS writes no HTML and
1181
- touches no hosting: the module's list, tags and header value are for the project to place.
1505
+ The capture unit is a registered, independently mountable scenario, or one of
1506
+ its project-declared `captureTargets`. Capture uses the same real isolated
1507
+ frame, fixtures and adapter as interactive review, for components, patterns
1508
+ and mocks. It introduces no tool-owned component templates, styling or
1509
+ fixture inference, so shared controllers and hooks need a visible
1510
+ demonstration. [MCP.md](MCP.md#screenshots-and-candidate-comparison) and each
1511
+ portable skill's
1512
+ [capture reference](../skills/ads-designer/references/captures.md) describe
1513
+ usage.
1514
+
1515
+ - **Hosting.** ADS owns the isolated preview hosting, App readiness and the
1516
+ Playwright process, with its own Playwright. The capture host is the HTTP
1517
+ showcase with navigation hidden, which gives the isolated preview the
1518
+ requested viewport. Project runtime, fonts and styles stay inside the App
1519
+ resource graph, and the image excludes showcase chrome.
1520
+ - **On request only.** Captures exist only when requested. Acceptance and its
1521
+ dry run take no screenshots. With no registered scenarios, `ads_capture`
1522
+ returns `ok: false` with `{ status: "not-available", reason: "no-scenarios",
1523
+ message }`.
1524
+ - **Two slots.** A target has at most two slots, current and candidate, with
1525
+ no previous slot, history or TTL. Revisions and settings are metadata, not
1526
+ new resource identities. A new scenario has no fabricated baseline. Stale
1527
+ source is identified explicitly, and deleted targets are collected. PNG,
1528
+ pixel and store limits and explicit clearing bound the generated storage.
1529
+ - **Publication.** Final freshness and conflict checks precede image
1530
+ publication. The pair is published as one atomic generated record under
1531
+ `.ds/captures/`, outside source ownership and product bundles.
1532
+ - **Resources.** One MCP capture index and a PNG resource template expose
1533
+ stable image slots. Subscriptions receive resource updates when images change
1534
+ or disappear.
1535
+
1536
+ These images are visual evidence for one state, not passing behavioral
1537
+ guarantees.
1538
+
1539
+ ## Checks keep the architecture in place
1540
+
1541
+ The project build runs `ads check` before it produces application output. One
1542
+ check of the captured revision covers:
1543
+
1544
+ - The structure of the design system: the barrel and `foundation.ads.ts`.
1545
+ - The design-system import closure.
1546
+ - Mock ownership.
1547
+ - Owner analysis of everything the barrel reaches.
1548
+ - The declared themes and brands.
1549
+ - The generated palette.
1550
+ - The integrity of the emitted output folder against its contract.
1551
+
1552
+ Every owner is analyzed, so one check reports each failing owner. An owner that
1553
+ depends on the grid rows of a failed owner is reported as blocked; it is not
1554
+ analyzed against unknown rows. Each owner-analysis failure carries a
1555
+ fine-grained code, its mistake group, a repair hint and the authored position.
1556
+ The repair plan orders the failures by group.
1557
+ [ADS.md](ADS.md#design-system-checks-and-emission) defines the contract.
1558
+
1559
+ ### Findings
1560
+
1561
+ ADS findings are errors, review items or info items
1562
+ ([finding kinds](ADS.md#finding-kinds)):
1563
+
1564
+ - An **error** is a rule ADS can decide. It fails `ads check`, validation and
1565
+ acceptance, and no setting turns it off.
1566
+ - A **review item** names something analysis cannot settle, such as a scroll
1567
+ container nothing focuses or truncated text without a `title`. It is shown
1568
+ with guidance and never blocks.
1569
+ - An **info item** notes an analysis limit or a blocked owner.
1570
+
1571
+ A stale `palette.generated.ts` and hand-edited emitted output are errors, since
1572
+ they ship. Output emitted from an earlier source revision is a
1573
+ `generated-stale` info item, since the next emit refreshes it.
1182
1574
 
1183
1575
  Static checks establish the policies and source formats they cover. Behavior
1184
1576
  tests and browser review verify the resulting accessibility, layout, themes,
1185
- states, and motion. Both forms of verification support agent-driven iteration.
1186
-
1187
- The CLI `ads validate` and MCP `ads_validate` share one audit engine, combining
1188
- architecture and test-boundary guards, configured project lint/check scripts
1189
- and behavior contracts. Full audits establish a content baseline. Changed audits
1190
- select affected behavior owners from that baseline; broad or unclassified changes
1191
- expand to full. Opaque project commands retain their declared scope.
1192
-
1193
- MCP executions share a process-wide exclusive lease spanning checks, guarded
1194
- mutations, child cleanup and durable result publication. Conflicting requests get
1195
- a structured `ADS_VALIDATION_LOCKED` response; Explorer and preview serving keep
1196
- their independent lane. Relevant source edits abort working-tree runs early,
1197
- recording changed paths and known/unknown attribution. Source-change interruption
1198
- cannot publish a successful baseline. A small run journal supports crash recovery;
1199
- immutable run results and exact-run investigations survive reconnects and subsequent
1200
- runs under bounded age/count/disk retention. Collection protects active work and
1201
- expires owned evidence with its result. See
1577
+ states and motion. Both support agent-driven iteration.
1578
+
1579
+ ### The browser render audit
1580
+
1581
+ The render audit adds what source cannot show. It also measures what the static
1582
+ composed check only reviews: unanalyzed wrappers, user-agent paint, opacity and
1583
+ scenario data. The [guide](GUIDE.md#checks-and-guards) lists each measurement
1584
+ and its exemptions.
1585
+
1586
+ - The audit page sets `__ADS_RENDER_AUDIT__` before the preview loads. The
1587
+ scenario page then mounts the specimens as the preview root's own content
1588
+ (`mountBare`, `showcase-client/scenario-page.mts`), with no showcase
1589
+ component around them; a lone subject fills the preview. Each named state is
1590
+ its own render: the audit page names the state before the preview loads
1591
+ (`__ADS_SCENARIO_STATE__`), and findings are built for each state's runs and
1592
+ merged (`findingsByState`, `src/render-audit.mts`).
1593
+ - It runs axe-core and measures non-text contrast of control borders and icons,
1594
+ image shape, layout shift and horizontal overflow at 390, 768 and 1280 px, by
1595
+ resizing each rendered scenario in every declared brand and theme.
1596
+ - Once per scenario it runs the [text passes](#text-passes).
1597
+ - It narrows components and patterns to a 240 px container. A set width above
1598
+ the browser review threshold of 96 px that overflows it is a review item.
1599
+ - Audit previews keep the subject framing and layout of showcase previews and
1600
+ disable the decorative surround, so axe and non-text contrast resolve the
1601
+ real ancestor background.
1602
+ - Image shape uses untransformed CSS dimensions: explicit ratios respect
1603
+ `box-sizing`, and width/height attribute ratios compare the content box.
1604
+ - Each render waits, bounded, for its content to settle, and the audit also
1605
+ renders interaction states (opened `aria-haspopup` overlays, hovered and
1606
+ focused controls).
1607
+ - Each worker lists what every render could measure, then assigns targets in
1608
+ request order, so which render measures a shared control does not depend on
1609
+ page speed.
1610
+ - The result states what was covered; what was skipped is an info item per
1611
+ reason.
1612
+ - `mcp.auditPages` (1–16, default 4) sets how many pages render at once.
1613
+
1614
+ **When it runs.** The audit runs in both gates
1615
+ ([stages](ADS.md#validation-and-acceptance-stages)): draft acceptance audits
1616
+ the draft owners' own UI scenarios, and `ads validate` audits every scenario
1617
+ its change set reaches through imports. With scope `changed` that is what
1618
+ changed since the last successful full run, and all scenarios after shared
1619
+ configuration, foundation or token changes. A dry run's audit is remembered by
1620
+ candidate revision and selection, so acceptance of that revision does not
1621
+ render again. An audit with nothing to render is not-available, never
1622
+ established.
1623
+
1624
+ Previews hold only a revision that passes `ads check`. So every static error
1625
+ stops the audit before it renders, as it stops `ads check`, `ads compile`,
1626
+ validation and acceptance. Review and info items never stop it: the audit
1627
+ renders and reports its own findings beside them.
1628
+
1629
+ #### Text passes
1630
+
1631
+ The text passes cover WCAG 2.2 1.4.4, 1.4.10 and 1.4.12. No static rule
1632
+ replaces them. 1.4.12 asks that content survives the reader's spacing
1633
+ overrides, not that tokens carry particular values, so there is no token-name
1634
+ rule for it. `a11y-text-resize` proves only that text sizes follow the root,
1635
+ not that the layout around them keeps up. The
1636
+ [guide](GUIDE.md#checks-and-guards) states the override values, the viewport
1637
+ sizes and what each finding kind means.
1638
+
1639
+ The passes extend the layout check the worker already runs:
1640
+ `src/render-audit/worker.mts` calls `layoutOverflow` from
1641
+ `src/render-audit/layout-overflow.page.mts` at each of `overflowWidths`. Their
1642
+ orchestration is `src/render-audit/text-scale.mts`; the overrides are in
1643
+ `src/render-audit/text-scale.page.mts`.
1644
+
1645
+ 1. One render per scenario runs them: the first theme and brand
1646
+ (`AuditApp.text`), since text does not follow colour. Its ordinary
1647
+ measurement at each width also measures block-axis fit
1648
+ (`layoutOverflow({ fit: true })`), the passes' baseline. Only its horizontal
1649
+ part is kept for `layout-overflow`.
1650
+ 2. At each width, before the next resize, the worker adds one override style
1651
+ (`font`, then `spacing`) as the document's last, `!important` standing in
1652
+ for the reader's stylesheet, measures, and removes it.
1653
+ 3. The viewport passes (`reflow`, then `zoom` to `textWidths.zoom`) resize the
1654
+ same page. Zoom scales px and rem alike, so layout there is the zoomed
1655
+ layout. The page returns to the widest width before the interaction states
1656
+ run.
1657
+ 4. `layoutOverflow`'s settling wait also follows heights under `fit`, which an
1658
+ override changes without changing a width. Fit adds the kinds
1659
+ `block-clipped`, `spilled`, `overlap` and `focus-clipped` over the same
1660
+ exemptions. Each counts past a tolerance of a quarter of the element's font
1661
+ size (at least 2 px), what a tight line height already lets a glyph out.
1662
+ For `focus-clipped`, only controls within 16 px of a clip edge are focused,
1663
+ at most twice the node limit, with focus restored.
1664
+ 5. `freshIssues` keeps only what rest does not show, by kind and selector. An
1665
+ override is compared against the same width. A viewport pass is compared
1666
+ against horizontal overflow at every width (already a `layout-overflow`
1667
+ finding) and fit at the widest width (the page before it was zoomed).
1668
+ 6. `AuditRun.textScale` carries `{ pass, width, issues, counts }`.
1669
+ `textScaleFindings` groups them per scenario, pass, kind and element set
1670
+ across widths, through the same grouping as `layoutOverflowFindings`.
1671
+
1672
+ `font` and `zoom` are `a11y-text-scale`, `spacing` is
1673
+ `a11y-text-spacing-override` and `reflow` is `a11y-reflow`: errors with the
1674
+ WCAG criterion, registered in `src/finding-rules.mts` and catalogued in
1675
+ `src/ads-errors.mts`.
1676
+
1677
+ ### Validation
1678
+
1679
+ The CLI `ads validate` and MCP `ads_validate` share one audit engine. It
1680
+ combines `ads check`, the configured project lint/check scripts, the registered
1681
+ behavior checks and the render audit.
1682
+
1683
+ - A stage with nothing to run is skipped with a not-available status and a
1684
+ reason code. It is never reported as passed.
1685
+ - A full audit establishes a content baseline. Only a successful full audit
1686
+ against unchanged source advances it.
1687
+ - A changed audit selects the affected behavior owners from that baseline.
1688
+ Broad or unclassified changes expand to full.
1689
+ - Opaque project commands keep their declared scope.
1690
+ - The baseline works without Git history and caches no individual test result.
1691
+
1692
+ Skills guide agents toward affected checks during editing, and toward full
1693
+ audits after ownership or runner migrations, before releases and for explicit
1694
+ complete validation.
1695
+
1696
+ **Freshness.** Freshness follows only the design-system project: the `dsDir`
1697
+ tree with its local import and asset dependencies and tests, and the
1698
+ configuration around it. [Input sets](#input-sets) defines the sets, their
1699
+ widening and their fences.
1700
+
1701
+ **Changed-scope selection.** Changed-scope validation follows shared source
1702
+ trees and native import resolution. Its successful full baseline also keeps
1703
+ plain dependency closures, so later selection includes consumers from both the
1704
+ previous and current revisions. Deleted inputs without previous evidence,
1705
+ unknown ownership, computed imports and shared configuration widen selection
1706
+ conservatively. Selection decides what to audit; it does not replace browser
1707
+ evidence or grant a passing result.
1708
+
1709
+ **Execution coordination.** MCP executions share a process-wide exclusive lease
1710
+ that spans checks, guarded mutations, child cleanup and durable result
1711
+ publication. A conflicting request gets a structured `ADS_VALIDATION_LOCKED`
1712
+ response, while Explorer and preview serving keep their independent lane. A
1713
+ relevant source edit aborts a working-tree run early, and such a run cannot
1714
+ publish a successful baseline. A small run journal supports crash recovery, and
1715
+ immutable run results and exact-run investigations survive reconnects and later
1716
+ runs under bounded retention. See
1202
1717
  [execution coordination](MCP.md#shared-process-execution-coordination).
1203
1718
 
1204
- Only a successful full audit against unchanged source advances the baseline.
1205
- This works without Git history and does not cache individual test results. Skills
1206
- guide agents toward affected checks during editing and full audits after ownership
1207
- or runner migrations, before releases and for explicit complete validation.
1208
-
1209
- Freshness follows the design system and consuming UI, their local import/asset
1210
- dependencies, registered build and guard configuration, and project test inputs.
1211
- Unrelated backend, native-toolchain and documentation edits do not invalidate an
1212
- ADS candidate. Opaque commands declare additional files or directories through
1213
- `validation.inputs`; these declarations add to the mandatory scope. Guarded edits
1214
- also fence every patched file and both sides of a configuration change. Candidate
1215
- commands still cannot rewrite source while checking it.
1216
-
1217
- Tests follow the same ownership boundaries as implementation: pure ADS tests stay
1218
- with their owners, marked behavior specs require registration, and private imports
1219
- cannot cross owners through helpers. Application integration tests stay with their
1220
- application subject. Static guards enforce these boundaries without claiming to
1221
- infer arbitrary assertion intent. Operational details live in the
1222
- [validation guide](../skills/ads-designer/references/validation.md).
1719
+ ### Semantic analysis
1223
1720
 
1224
- ## MCP makes the project ADS available to agents
1721
+ ADS semantic analysis uses its own pinned TypeScript 7.1 beta asynchronous
1722
+ native API from Bun. Analysis, orchestration and preview compilation all run on
1723
+ Bun. There is one compiler implementation.
1225
1724
 
1226
- The stdio server exposes the same token inspection and core architecture checks
1227
- as the CLI, alongside the project's public UI catalogue and source guides.
1228
- Bounded tools establish what exists; explicit resource reads provide detail.
1229
- Prompts and packaged skills explain how to reason through Data, UX and Skin and
1230
- how to inspect the real implementation before changing it.
1231
-
1232
- The MCP runtime owns its browser hosts and preview builder lifetime. Closing the
1233
- client connection releases them together; a separate ownership guard can stop
1234
- detached builders after abrupt owner death. A preview process must not outlive
1235
- its owner and continue publishing stale output.
1236
- HTTP request instances share a source observer instead of initializing another
1237
- source/build inspection for each resource read. Immutable resources retain byte
1238
- integrity checks; status, build and validation requests still establish freshness.
1239
- Build reports expose queued, validation, compilation and publication progress.
1240
- A timed-out preview request marks the builder stalled; the next explicit request
1241
- restarts it within the same MCP session. A running process alone is not freshness.
1242
-
1243
- Opt-in MCP editing makes validation part of the write operation. The agent edits a
1244
- draft of one or more owners (file contents or a Git unified diff) and accepts it. ADS
1245
- resolves file ownership, takes the draft's files as they are and validates a
1246
- temporary project copy with architecture checks and configured project
1247
- lint/validation scripts.
1248
- The temporary copy contains the relevant input graph and patched files, with room
1249
- for 100,000 files / 2 GiB. Unrelated native artifacts are not copied. Declared extra
1250
- inputs support project commands that read data outside the UI graph. When
1251
- `acceptance.behavior` is true (the default), the draft owners' own registered behavior
1252
- checks run in the isolated candidate project; the consumers of a changed shared
1253
- controller run in `ads validate`.
1254
- Architecture batch checks from the CLI and CI use the internal pinned Turbo runner
1255
- and its installed platform binary; no global Turbo or runtime dependency installer is
1256
- invoked. A task miss invokes the same asynchronous native analysis service.
1257
- The MCP server, its preview compiler and registered candidates use warm checks
1258
- (`check-service.mjs`) backed by that service. Native snapshots reuse unchanged
1259
- ASTs and query results; an exact input-key repeat can return a remembered passing
1260
- report. Local artifact
1261
- reuse is enabled by default and fenced by current input/tool/runtime/Git state;
1262
- gate results, browser evidence, locks and baselines are never task outputs.
1263
- Project scripts remain uncached without a known deterministic contract. The warm
1264
- Bun preview compiler retains its module cache; complete verified graph restoration
1265
- publishes fresh build-session evidence without semantic rediscovery. See
1266
- [cache controls and CI wiring](CACHING.md).
1267
-
1268
- `acceptance.scripts` and `validation.scripts` explicitly select project scripts; no
1269
- names are inferred, and `ads validate` runs both lists, so each script is listed
1270
- once. Direct edits invoke `ads validate --changed`; draft acceptance records no
1271
- baseline, so its owner-scoped evidence never satisfies a complete validation. The project owns its test code and runner policy;
1272
- ADS owns affected-check selection, candidate hosting, progress, evidence freshness
1273
- and process cleanup. One profile timeout bounds its entire runner process. Parallel
1274
- workers can share that candidate host with independent App state. Partial outcomes
1275
- remain diagnostic when execution is interrupted; they cannot approve a mutation.
1276
- Passing checks describe their registered assertions, not every natural-language claim.
1277
- Results distinguish architecture, project-build, transport, runner and assertion
1278
- boundaries with structured phase/code evidence; an unclassified test exception
1279
- does not become an assertion or a component defect. Acceptance explicitly lists
1280
- established and unverified scope. Verification retains one latest investigation
1281
- per registered check, including isolated candidates: exact input revision,
1282
- observed preview revision, failing step/source, observed startup viewport,
1283
- failed requests and available project-recorded artifacts. MCP exposes bounded
1284
- bundle/index resources and only registered, digest-checked artifact files.
1285
- Another run replaces that check's resource access; candidate evidence never
1286
- certifies live source. Detailed usage lives in the portable skill-local
1287
- [evidence guide](../skills/ads-designer/references/evidence.md).
1725
+ Registered application commands keep their explicit runtimes. Generated
1726
+ applications keep their own TypeScript dependency and their own `tsc`. ADS's
1727
+ compiler is a separate nested package when necessary.
1288
1728
 
1289
- MCP delivery is separate from validation: verification and mutation controllers
1290
- use complete results to decide acceptance. Their MCP replies contain counts,
1291
- bounded acceptance, at most three failure previews and a result ID in at most
1292
- 4 KiB of UTF-8 JSON. `ads_results` reads saved outcomes, diagnostics and other
1293
- sections without rerunning checks. Pages have at most 20 rows and 8 KiB of JSON;
1294
- truncated records support bounded text ranges. Discovery and investigation
1295
- sections use the same paging budget. Cursors bind the query and result/revision;
1296
- expired IDs fail explicitly instead of silently returning another run.
1297
- Immutable run snapshots persist under `.ds/tool-results/`, each at most 8 MiB,
1298
- with configurable age/count/disk retention and associated evidence collection. Oversized reports retain a summary with an
1299
- explicit unavailable-details warning. Storage/notification failure cannot change
1300
- an accepted edit's applied state. These are payload byte budgets, not tokenizer
1301
- estimates; MCP compatibility text may duplicate structured JSON on the wire.
1302
-
1303
- Edits stay focused without requiring entire file bodies in model context. Peer units and
1304
- unrelated owners remain outside the selected unit's edit boundary. Shared foundation,
1305
- branding and guides have their own units. Shared credits and text license notices
1306
- belong to the documentation unit, including conventional root notices and shared
1307
- `licenses/` collections. Colocated notices remain with their component or asset
1308
- owner. Documentation paths and UTF-8 validation do not grant code/configuration
1309
- ownership. Project configuration, registered guards
1310
- and compiler integration form an explicit configuration unit; their proposed
1311
- settings pass the same mandatory validation. Binary assets can travel as Git patch
1312
- artifacts without entering model context, and compiler configuration changes
1313
- replace the managed process while retaining the MCP connection. Normal build gates
1314
- remain in place for source changes made through other editors; preview review remains
1315
- necessary after either editing path.
1316
-
1317
- Genuinely coupled owners share one draft (up to 64 owners), validated as a single
1318
- complete candidate and published together. Token-sample reconciliation writes into
1319
- a draft, preserves project bindings and reports unresolved mappings; it never
1320
- changes live source or substitutes for rendered review and acceptance.
1321
-
1322
- No owner edits a shared entry. An owner's public names, its style permissions and its
1323
- token sheets are its own files; ADS regenerates the barrels and the styles entry in
1324
- the candidate, and deletes an empty `.gitkeep` itself when accepted source is added
1325
- beneath it. Coupled changes therefore need no companion edits or guard bypass.
1729
+ #### The analysis host
1730
+
1731
+ `src/analysis/service.mts` is the shared asynchronous entry point for
1732
+ acceptance, checks and emission, scenario discovery, behavior planning and
1733
+ audit selection.
1734
+
1735
+ - Each calling ADS process shares a Bun child host with plain-data IPC.
1736
+ - The host serializes analysis requests and owns bounded native project
1737
+ sessions.
1738
+ - One job is an inspection, check or selection request. A job can inspect many
1739
+ files.
1740
+ - Independent native queries inside a job can share pending promises and be
1741
+ batched.
1742
+ - Rendering and registered test commands execute outside this service.
1743
+
1744
+ Library inspection APIs are asynchronous and use the same native session
1745
+ implementation. Callers await `checkProject`, behavior inspection and import
1746
+ resolution. Direct library callers acquire a context through
1747
+ `analysis/standalone.mts`; they do not select a different engine. Syntax-only
1748
+ work uses the bounded source-file leases of the native API.
1749
+
1750
+ #### Snapshots, drafts and acceptance
1751
+
1752
+ Each project keeps an immutable live snapshot. Drafts branch from it with file
1753
+ deltas.
1754
+
1755
+ - Acceptance promotes the checked revision. Rejection releases it.
1756
+ - Sibling drafts cannot alter each other. A changed live generation prevents
1757
+ stale promotion.
1758
+ - Project input bytes are captured during the validation inventory read.
1759
+ - Imported dependencies, missing resolution targets, configuration and package
1760
+ changes invalidate the compiler state.
1761
+ - Content fences are required around operations that can overlap filesystem
1762
+ edits. Timestamps alone never establish freshness.
1763
+ - The beta compiler has an unsafe program-removal operation. ADS avoids it with
1764
+ bounded snapshot compaction within the same compiler process.
1765
+
1766
+ Relocated AST wrappers belong to a live project or to one draft, not to a
1767
+ global map of draft paths. Unchanged live trees keep their identity across
1768
+ revisions. The release of a draft releases its wrapper cache. Promotion creates
1769
+ live paths and does not mutate trees already returned to draft callers.
1770
+
1771
+ Production acceptance registers the file delta of the candidate against its
1772
+ live project before the check. The check, owner analysis and affected selection
1773
+ use that branch through the shared analysis service. Successful source
1774
+ publication promotes the checked snapshot. Rejected, abandoned and temporary
1775
+ branches are released. Configured scripts and browser evidence are separate
1776
+ acceptance stages with their own source-freshness requirements.
1777
+
1778
+ #### Captured inputs
1779
+
1780
+ Rules read the captured revision, never the live filesystem.
1781
+
1782
+ - Import resolution, with fixed compiler options, shares normalized specifiers
1783
+ by importing directory, including pending queries from sibling files. Its
1784
+ cache belongs to the current inventory or request. A new capture resolves
1785
+ against current package and configuration bytes and cannot inherit an earlier
1786
+ resolution by path alone.
1787
+ - Input capture shares compiler options and the import resolver with
1788
+ configuration discovery. `analysis/module-resolvers.mts` owns the native
1789
+ resolver leases for that capture, including pending queries. Cleanup drains
1790
+ them on success or failure. The syntax client stays alive until the capture
1791
+ releases its leases. No resolver that observes the live filesystem survives
1792
+ into the next capture.
1793
+ - Warm checks collect compiler source bytes while they compute the task input
1794
+ key, and pass them through `analyzeCaptured`. Registered draft branches stay
1795
+ authoritative. The independent post-check input capture still verifies
1796
+ freshness before the report is cached.
1797
+ - Draft preparation shares one inventory between inspection and workspace
1798
+ population, and keeps its targeted live conflict and path checks.
1799
+ - Optional inputs and immediate directory membership use `optionalSourceText`
1800
+ and `sourceDirectoryFiles`. Both observe the captured revision, including
1801
+ absence.
1802
+ - `sourceCss` shares read-only PostCSS trees across requests on the same
1803
+ captured revision. Transforms clone a tree before they modify it.
1804
+ - The pure grid model (`spatial-model.mts`, with `spatial-css.mts`) does no
1805
+ filesystem I/O. Owner analysis binds its facts through the captured native
1806
+ AST.
1807
+
1808
+ The spatial model borrows concepts from IBM Carbon's 2x Grid, and spacing
1809
+ borrows Adobe Spectrum's non-uniform scale. The
1810
+ [design references](DESIGN-REFERENCES.md) record what was adopted. Carbon's
1811
+ Sass and React grid packages are not dependencies.
1812
+
1813
+ #### Rules for rule code
1814
+
1815
+ [AGENTS.md](../AGENTS.md#extending-analysis-and-guards) states the rules for
1816
+ rule code and names the helpers: `analysis/helpers.mts` (`sourceAst`,
1817
+ `sourceText`, `symbolAt`, `valueSymbolAt`, `localValueDeclarations`, `walk`,
1818
+ `findNode`, `nodesOfKind`, `memoFact`, `memoProgram`), `cachedProgram`,
1819
+ `importResolver`, and `analysis/queries.mts` with `walkValuesAsync` and
1820
+ `walkAsync`. The reasons:
1821
+
1822
+ - A rule creates no compiler program, native client, path-keyed semantic cache
1823
+ or independent AST parser, so every rule reads the one captured revision. A
1824
+ boundary test prevents rule modules from constructing programs or importing
1825
+ native transports.
1826
+ - `memoFact` lives for one fenced request. `memoProgram` is only for facts
1827
+ determined by an immutable program/tree or captured revision, with weak
1828
+ ownership. A rule returns copies when it exposes cached mutable results.
1829
+ - `analysis/queries.mts` shares pending promises and batches independent
1830
+ symbol/type queries. Its ordered async helpers keep short-circuit checks and
1831
+ diagnostic order deterministic. Ordinary syntax predicates stay synchronous.
1832
+ - Named subjects resolve through `localValueDeclarations`, because enumerating
1833
+ all symbols in scope can load the compiler libraries and exhaust memory.
1834
+
1835
+ #### Verification and benchmarks
1836
+
1837
+ `bun run test:analysis` verifies native analysis, cache invalidation,
1838
+ production draft acceptance and compilation, without browser rendering or
1839
+ registered behavior execution. The
1840
+ [analysis benchmark](../scripts/benchmarks/analysis/README.md) measures the
1841
+ engine the same way: input capture, branching, checks and publication, without
1842
+ browser work. [AGENTS.md](../AGENTS.md#mandatory-analysis-benchmarks) states
1843
+ when it is required.
1844
+
1845
+ ## MCP makes the project ADS available to agents
1846
+
1847
+ The stdio server exposes the same checks as the CLI, alongside the project's
1848
+ public entry, units and source guides. Bounded tools establish what exists.
1849
+ Explicit resource reads provide detail. Prompts and packaged skills explain how
1850
+ to inspect the real implementation before a change.
1326
1851
 
1327
1852
  The architecture makes that inspection practical. A public export has an owning
1328
- source and addressable preview coverage. Token definitions expose its visual
1329
- vocabulary; local guides explain contracts when present. An agent can discover a
1330
- small set of relevant entities, read their source and mount a real scenario with
1331
- its fixture context. Humans can exercise the same entry in the showcase. This
1332
- keeps inspection connected to the implementation that will reach the application.
1853
+ source. Profiles and token sheets expose its visual vocabulary. Local guides
1854
+ explain contracts when present. An agent can discover a small set of relevant
1855
+ entities, read their source and mount a real scenario with its fixture context.
1856
+ Humans can exercise the same entry in the showcase. Inspection therefore stays
1857
+ connected to the implementation that reaches the application.
1333
1858
 
1334
1859
  MCP provides a progressive interface to those sources: structured listings,
1335
1860
  explicit detail reads, selectable workflows and rendered Apps where supported.
1336
1861
  Reported revisions and diagnostics make preview freshness inspectable after a
1337
1862
  change. Reading source, compiling it and interacting with it are separate forms
1338
- of evidence; source checks and metadata cannot establish visual or behavioral
1339
- correctness. Text/resource access and the normal showcase keep the workflow
1863
+ of evidence. Source checks and metadata cannot establish visual or behavioral
1864
+ correctness. Text and resource access and the normal showcase keep the workflow
1340
1865
  usable when a client lacks experimental presentation capabilities.
1341
1866
 
1342
- Experimental MCP Apps are another development review surface. Component, pattern and
1343
- composition views are project-built scenarios with the project's own extracted CSS and
1344
- public implementations; token and brand views are built by ADS from project definitions.
1345
- The server serves those artifacts; it does not interpret arbitrary component
1346
- code or introduce production UI dependencies. File-change notifications let
1347
- hosts refresh their views. ADS runs its Bun preview compiler itself, with no launch command.
1348
- Editing access is independent: direct editors can use MCP only for preview/checks,
1349
- while MCP-only editors use enabled mutation tools. Both use ADS's compiler. See the [editing workflows](../skills/ads-designer/references/workflows.md). Structured build reports distinguish running compilers
1350
- from successful, current previews; diagnostics remain readable even when a host
1351
- does not forward notifications. Older clients retain tools/resources/prompts;
1352
- native skill discovery and Apps presentation depend on the host's capabilities.
1353
- Concrete setup and compatibility evidence belong in the [MCP guide](MCP.md).
1354
-
1355
- For concrete instructions, use:
1356
-
1357
- - [ADS tooling contract](ADS.md) for naming, ownership rules, updates, and lint responsibilities.
1358
- - [Tool guide](GUIDE.md) for prerequisites, supported formats, configuration, and build wiring.
1359
- - [Starter/playground guide](../starters/README.md) for Linaria composition, extraction, and project commands.
1360
- - Component-local READMEs for APIs, lifecycle, tests, and provenance.
1361
-
1362
- Token preview completeness has two checks. Static guards validate the catalogue's explicit
1363
- bindings (`token`, CSS `property`, and project-selected `probe`; `foundation-catalog`). The
1364
- view then verifies rendered samples in the actual browser by probing those bindings and
1365
- restoring them. The tool supplies no token/property
1366
- classification or visual sample palette. A source build alone is not a rendered
1367
- verification, and the browser check does not judge design quality.
1368
-
1369
- The Data pillar has one shared design catalogue in the configured token foundation.
1370
- Components/patterns own mappings (`--ds-*`/`--ux-*`) and mechanics, not independent
1371
- value sheets or token namespaces. Private variables, fallbacks, themes and static
1372
- helper/import interpolation obey the same design-value source checks. Unknown
1373
- interpolation grants no permission. Intrinsic runtime geometry and typed instance
1374
- bindings keep their existing narrow contracts. Shared token previews consume the
1375
- same foundation through the project mount adapter.
1376
-
1377
- Shared tokens with identical normalized theme/condition definitions receive a
1378
- nonblocking `token-overlap-review` review item. Equal values do not establish equal
1379
- meaning; ownership/value-source violations remain errors. See the
1380
- [shared Data contract](ADS.md#shared-data-and-component-mappings).
1381
-
1382
- ## Static contracts and instance data
1383
-
1384
- Owner-local tooling declarations use optional `<Owner>.ads.contract.ts` modules.
1385
- ADS resolves their data and implementation symbols statically without executing
1386
- project imports. Behavior shares this contract with constrained paint
1387
- inputs, instance binding families and declarative parent/consumer relationships.
1388
- Declarative relationships form an acyclic graph: parts may have several parents
1389
- and contain nested parts, with every chain anchored at a rendering root. Exercise
1390
- metadata records reachable use; registered browser checks establish its effects.
1391
- Binding producers declare each direct/derived paint path explicitly. Private
1392
- visual implementation subjects are distinct from headless controller subjects.
1393
- Competing registrations fail. The
1394
- [contract reference](CONTRACTS.md) specifies the authoring and analysis limits.
1395
-
1396
- Any `.ads.` source is development-only. Runtime implementation/types/styles cannot
1397
- import it through aliases or barrels. Only the selected scenario/fixture/review
1398
- closure enters a preview; contracts and specs are not widget modules. Derived
1399
- App audit data adds no ADS dependency to production components. New starter
1400
- scenarios and fixtures use the marked names; existing IDs remain stable.
1401
-
1402
- Instance bindings are distinct from static tokens and arbitrary inline styles.
1403
- Source checks trace config origin, key validation, exact map construction and
1404
- attachment to an owner root. Shared token and private runtime-variable ownership and consumer permissions
1405
- remain enforced. Render audits inspect current scoped values, paint effects and
1406
- local SVG resources; registered checks must cover updates/removal, isolation and
1407
- relevant themes. Registration, source-demonstrated consumption and current browser
1408
- verification are separate evidence. Unknown paths establish no blanket permission.
1409
-
1410
- Declarative child APIs belong in `exercises`, while `covers` retains rendered UI.
1411
- Resolved child identity/prop consumption must reach the declared consumer through
1412
- a rendered parent. Metadata alone cannot turn a null-returning stub into verified
1413
- UI. Invalid scenario fields preserve independent valid coverage; unreadable
1414
- prerequisites report that coverage is not established.
1415
-
1416
- Shared token references remain visible across the project. Component state and
1417
- implementation variables retain their existing ownership boundaries. Project checks
1418
- may use `inspectTokenOrigins` to audit more specific shared alias relationships;
1419
- core Data/UX/Skin separation does not depend on opting into such a check. ADS does
1420
- not hardcode a spacing scale or palette.
1421
-
1422
- Preview scheduling prunes standard generated output trees before allocating OS
1423
- watches and computing source freshness. Explicit source roots retain priority;
1424
- custom outputs use `assets.generatedPaths`. Bundled binary assets are forwarded
1425
- as resources: the built-in Apps sandbox permits blob reads and WebAssembly
1426
- compilation without granting external network access, JavaScript eval or host
1427
- DOM access. External MCP hosts retain their own CSP policy.
1428
-
1429
- ### Pictogram ownership and evidence
1430
-
1431
- Pictograms are project-owned illustrative SVGs in `assets/pictograms/`, separate
1432
- from brand identity, glyphs and raster images. `catalog.ads.json` declares their
1433
- meaning, license, minimum drawn height and exact-theme/scheme/shared source
1434
- selection. See the [pictogram contract and examples](../skills/ads-designer/references/pictograms.md).
1435
-
1436
- `src/pictogram-model.mjs` is the pure catalogue/XML/geometry model;
1437
- `src/pictograms.mjs` is its captured-input adapter. Pictogram SVG text is retained during the
1438
- existing analysis input read; unrelated image assets are not added to the source tree. The adapter shares immutable results per request
1439
- and weakly per captured revision, including missing inputs; rules/discovery never
1440
- fall back to disk for a missing snapshot. No TypeScript program or parser is
1441
- created for asset metadata. The XML parser checks document structure without
1442
- executing SVG. Artwork is embedded as image data, never injected into gallery DOM.
1443
-
1444
- Discovery publishes tool-owned `pictograms/<id>` foundation views attached to the
1445
- `assets/pictograms` draft owner. CLI checks, MCP discovery, validation and acceptance
1446
- share the same diagnostics. The gallery resolves explicit theme variants, renders
1447
- clean/actual-size samples and a separate construction-grid card. Components keep
1448
- normal SVG imports and their own theme selection; no ADS runtime ships with them.
1449
-
1450
- The render audit receives the registry's checked digests and geometry, without
1451
- rereading sources. It identifies visible SVG images by digest, caches source
1452
- identities across viewport samples, and checks the active variant, accessibility
1453
- markup, drawn size and proportions. `data-ads-pictogram` disambiguates shared bytes
1454
- and detects wrong source substitutions. Inline SVG/CSS backgrounds, arbitrary
1455
- transformations, illustration meaning and optical quality remain outside this
1456
- image guard. Assets remain shared inputs for change selection, so their edits
1457
- widen verification to consuming UI. Browser measurements are not included in
1458
- analysis/acceptance performance benchmarks.
1459
-
1460
- ## HTTP showcase delivery
1461
-
1462
- The 0.4.5 local showcase uses HTTP for discovery, status, events, preview actions
1463
- and checked assets. Agents retain MCP against the same engine. See the
1464
- [scope, endpoint boundary and proof history](HTTP-SHOWCASE-POC.md). The persistent
1465
- preview iframe preserves isolation and viewport behavior.
1867
+ The [MCP guide](MCP.md) holds concrete setup and compatibility evidence.
1868
+
1869
+ ### Skills
1870
+
1871
+ Skills ship in the package and are served as an immutable snapshot, each file
1872
+ under `skill://ads/<name>/`, with each digest computed from the bytes served.
1873
+ ADS serves content; verification, approval and activation belong to the host.
1874
+ [MCP.md](MCP.md#skills) states what each protocol version gets.
1875
+
1876
+ ### Token inventory and public catalogue
1877
+
1878
+ The token inventory and the public catalogue have one implementation,
1879
+ `src/inventories.mts`, behind every surface: `ads tokens`, `ads_tokens`,
1880
+ `ads_catalog`, `ads://project/tokens`, `/tokens/dtcg` and `/catalog`, and the
1881
+ library's `inspectTokens`, `exportTokensDtcg` and `inspectCatalog`.
1882
+
1883
+ The analysis worker runs it as the `tokens`, `tokens-dtcg` and `catalog`
1884
+ operations on one captured revision. `token-summary` returns the token total
1885
+ and the groups the explorer's token category counts, from the design inputs
1886
+ alone. Nothing in them reads the disk.
1887
+
1888
+ **The catalogue** (`src/public-catalog.mts`) reads:
1889
+
1890
+ - The barrel's named exports through the scenario program (`publicApi` in
1891
+ `src/owner-scenarios.mts`), classified by the same API role that scenario
1892
+ `covers` and `exercises` use, with each export's signature printed by the
1893
+ checker (`src/api-signature.mts`).
1894
+ - The scenario registry and the public owners (`publicExports`).
1895
+ - The revision's owner analysis (`ownerRevision`, memoized on the revision and
1896
+ shared with `ads check`).
1897
+
1898
+ Each analyzed owner keeps its design (`src/owner-design.mts`): the profile
1899
+ selections its constructions' lowering read (`Lowered.profiles`, recorded by
1900
+ the profile access in `src/construction-output.mts`). So the catalogue reports
1901
+ what the owner renders, slot profiles included, not what its source mentions.
1902
+
1903
+ **The token inventory** (`src/token-inventory.mts`) reads the revision's
1904
+ foundation from the content-keyed design inputs:
1905
+
1906
+ - Values per context from `tokenDefinitionContexts`.
1907
+ - Declarations from the parsed sheets.
1908
+ - Profile bindings from the resolved profiles.
1909
+ - Value-shape status from the token checks, reused per foundation.
1910
+ - Owner reach from each analyzed owner's lowered constructions, followed
1911
+ through token references.
1912
+
1913
+ The DTCG export (`src/token-dtcg.mts`) is a pure, key-sorted function of the
1914
+ inventory. Paging and queries are shared (`src/inventory-query.mts`). The MCP
1915
+ view adds source and guide URIs, units and draft annotations. An empty
1916
+ inventory is `not-available`, never an empty match; design inputs that do not
1917
+ read are an error.
1918
+
1919
+ ### Runtime lifetime
1920
+
1921
+ The MCP runtime owns its browser hosts and the lifetime of its preview builder.
1922
+
1923
+ - When the client connection closes, they are released together. A separate
1924
+ ownership guard can stop detached builders after abrupt owner death. A
1925
+ preview process must not outlive its owner and continue to publish stale
1926
+ output.
1927
+ - HTTP request instances share a source observer. They do not initialize
1928
+ another source/build inspection for each resource read.
1929
+ - Immutable resources keep byte integrity checks. Status, build and validation
1930
+ requests still establish freshness.
1931
+ - Build reports expose queued, validation, compilation and publication
1932
+ progress.
1933
+ - A timed-out preview request marks the builder stalled. The next explicit
1934
+ request restarts it within the same MCP session. A running process alone is
1935
+ not freshness.
1936
+
1937
+ ### Guarded editing
1938
+
1939
+ Opt-in MCP editing makes validation part of the write operation
1940
+ ([MCP](MCP.md#guarded-editing)). The agent edits a draft of one or more owners
1941
+ (file contents or a Git unified diff) and accepts it. ADS resolves file
1942
+ ownership, takes the draft's files as they are, and validates a temporary
1943
+ project copy with `ads check` and the configured project lint/validation
1944
+ scripts.
1945
+
1946
+ - The copy contains the relevant input graph and the patched files, within
1947
+ bounds. Unrelated native artifacts are not copied. Declared extra inputs
1948
+ support project commands that read data outside the UI graph.
1949
+ - When `acceptance.behavior` is true (the default), the draft owners' own
1950
+ registered behavior checks run in the isolated candidate project. The
1951
+ consumers of a changed shared controller run in `ads validate`.
1952
+
1953
+ **Edit units.** Edits stay focused without entire file bodies in model context.
1954
+ Peer units and unrelated owners stay outside the selected unit's edit boundary.
1955
+
1956
+ - The foundation (the public barrel and `foundation.ads.ts`), the token sheets,
1957
+ asset groups, guides, documentation (shared credits and license notices) and
1958
+ configuration (project configuration, registered guards and compiler
1959
+ integration) have their own units ([units](MCP.md#guarded-editing)).
1960
+ - Colocated notices stay with their component or asset owner. Documentation
1961
+ paths and UTF-8 validation grant no code or configuration ownership.
1962
+ - Proposed configuration settings pass the same mandatory validation. A
1963
+ compiler configuration change replaces the managed process and keeps the MCP
1964
+ connection.
1965
+ - Binary assets can travel as Git patch artifacts without entering model
1966
+ context.
1967
+
1968
+ **Coupled owners.** Genuinely coupled owners share one draft, validated as a
1969
+ single complete candidate and published together. A new public owner is added
1970
+ to the barrel in the same draft as the foundation owner. ADS removes the
1971
+ design-system folders an accepted deletion leaves empty.
1972
+
1973
+ **Other editors.** Editing access is independent: a direct editor can use MCP
1974
+ only for preview and checks, and an MCP-only editor uses enabled mutation
1975
+ tools. Both use ADS's compiler
1976
+ ([editing workflows](../skills/ads-designer/references/workflows.md)). Normal
1977
+ build gates stay in place for source changes made through other editors, and
1978
+ preview review is necessary after either editing path.
1979
+
1980
+ ### Guarded deletion
1981
+
1982
+ Guarded deletion (`ads_delete`, `src/mcp/deletions.mts`) removes declared
1983
+ targets without a visible draft, through the same publication path as
1984
+ acceptance and not a second workflow ([MCP](MCP.md#guarded-deletion)).
1985
+
1986
+ 1. It checks the requested revision against `previewSourceRevision`, the
1987
+ accepted-source revision that drafts track.
1988
+ 2. It captures the project inputs once and runs the `deletion-plan` analysis
1989
+ operation (`src/deletion-plan.mts`) on exactly those bytes. Targets resolve
1990
+ against the revision's design inputs and unit inventory. Token removals edit
1991
+ a clone of the shared captured CSS tree. Profile and artwork removals cut
1992
+ statement ranges of the captured native AST, leaving neighbouring bytes
1993
+ untouched. The barrel drops the deleted owners' re-exports through the
1994
+ shared import resolver. Surviving references in the design inputs are
1995
+ listed.
1996
+ 3. Each planned file carries the digest it was derived from, and the mutation
1997
+ controller's candidate must hold exactly those bytes (`expectedDigest`).
1998
+ 4. A `beforeApply` fence requires the source revision to still be the requested
1999
+ one at publication.
2000
+
2001
+ Open drafts that hold a changed file or owner refuse the deletion.
2002
+ `MutationController.apply` checks and publishes the candidate. So the ordinary
2003
+ `ads check` over the candidate (every captured alternative) catches references
2004
+ the design-input scan does not see: recipes, bindings, imports and scenarios.
2005
+ Emission, cancellation, dry runs and rollback behave exactly as for acceptance.
2006
+ Protection covers the captured ADS graph only, never consumers outside it.
2007
+
2008
+ ### Checks, scripts and evidence
2009
+
2010
+ **Check execution.** Batch checks from the CLI and CI use the internal pinned
2011
+ Turbo runner. The MCP server, its preview compiler and registered candidates
2012
+ use warm checks (`check-service.mts`). Both use the same asynchronous native
2013
+ analysis service ([check paths](CACHING.md#check-paths)).
2014
+
2015
+ - Local artifact reuse is fenced by current input, tool, runtime and Git state.
2016
+ Gate results, browser evidence, locks and baselines are never task outputs.
2017
+ Project scripts stay uncached without a known deterministic contract.
2018
+ - The warm Bun preview compiler keeps its module cache. Complete verified graph
2019
+ restoration publishes fresh build-session evidence without semantic
2020
+ rediscovery.
2021
+
2022
+ **Scripts.** `acceptance.scripts` and `validation.scripts` explicitly select
2023
+ project scripts; no names are inferred. `ads validate` runs both lists, so each
2024
+ script is listed once. Direct edits invoke `ads validate --changed`. Draft
2025
+ acceptance records no baseline, so its owner-scoped evidence never satisfies a
2026
+ complete validation.
2027
+
2028
+ **Responsibilities.** The project owns its test code and runner policy. ADS
2029
+ owns affected-check selection, candidate hosting, progress, evidence freshness
2030
+ and process cleanup.
2031
+
2032
+ - One profile timeout bounds its entire runner process. Parallel workers can
2033
+ share the candidate host with independent App state.
2034
+ - Partial outcomes stay diagnostic when execution is interrupted; they cannot
2035
+ approve a mutation.
2036
+ - Passing checks describe their registered assertions, not every
2037
+ natural-language claim.
2038
+ - Results distinguish architecture, project-build, transport, runner and
2039
+ assertion boundaries with structured phase/code evidence. An unclassified
2040
+ test exception does not become an assertion or a component defect.
2041
+ - Acceptance explicitly lists established and unverified scope. A stage that
2042
+ ran nothing is listed as skipped with its not-available status, never as
2043
+ established, and does not block acceptance.
2044
+
2045
+ **Investigations.** Verification keeps one latest investigation per registered
2046
+ check, including isolated candidates
2047
+ ([contents](BEHAVIORS.md#investigate-a-failure)). MCP exposes bounded
2048
+ bundle/index resources and only registered, digest-checked artifact files.
2049
+ Another run replaces that check's resource access, and candidate evidence never
2050
+ certifies live source. See the
2051
+ [evidence guide](../skills/ads-designer/references/evidence.md).
2052
+
2053
+ ### Bounded results
2054
+
2055
+ MCP delivery is separate from validation: verification and mutation controllers
2056
+ use complete results to decide acceptance, and their replies are bounded
2057
+ summaries with a result ID. `ads_results` reads saved sections without
2058
+ rerunning checks. [BEHAVIORS.md](BEHAVIORS.md#read-results) states the reply,
2059
+ page and snapshot budgets.
2060
+
2061
+ - Cursors bind the query and the result/revision. An expired ID fails
2062
+ explicitly and never returns another run.
2063
+ - Run snapshots are immutable and persist under `.ds/tool-results/`. Evidence
2064
+ is collected with its result.
2065
+ - A storage or notification failure cannot change an accepted edit's applied
2066
+ state.
2067
+ - The budgets are payload bytes, not tokenizer estimates. MCP compatibility
2068
+ text can duplicate structured JSON on the wire.
2069
+
2070
+ ### Experimental MCP Apps
2071
+
2072
+ Experimental MCP Apps are another development review surface. Component,
2073
+ pattern and mock views are project scenarios, compiled with the
2074
+ project's emitted CSS and public implementations.
2075
+
2076
+ - The server serves those artifacts. It does not interpret arbitrary component
2077
+ code and introduces no production UI dependencies.
2078
+ - ADS runs its Bun preview compiler itself, with no launch command.
2079
+ - File-change notifications let hosts refresh their views. Structured build
2080
+ reports distinguish running compilers from successful, current previews, and
2081
+ diagnostics stay readable when a host does not forward notifications.
2082
+ - Older clients keep tools, resources and prompts. Native skill discovery and
2083
+ Apps presentation depend on the capabilities of the host.