@pixel-point/toolcraft 0.0.18 → 0.0.19

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 (384) hide show
  1. package/package.json +1 -1
  2. package/src/generate-demand-only-lifecycle.test.mjs +9 -1
  3. package/src/generate-performance-iteration-execution.test.mjs +3 -3
  4. package/src/generate-test-delivery-architecture-assertions.mjs +11 -73
  5. package/src/generate-test-demand-only-lifecycle.mjs +34 -36
  6. package/src/generate-test-dependency-sandbox.mjs +4 -1
  7. package/src/generate-test-doc-assertions.mjs +55 -53
  8. package/src/generate-test-doc-assertions.test.mjs +1 -1
  9. package/src/generate-test-doc-policy-assertions.mjs +1 -1
  10. package/src/generate-test-export-doc-assertions.mjs +53 -0
  11. package/src/generate-test-file-assertions.mjs +51 -8
  12. package/src/generate-test-integrity-assertions.mjs +5 -2
  13. package/src/generate-test-integrity-manifest-assertions.mjs +16 -5
  14. package/src/generate-test-integrity-ownership-assertions.mjs +36 -4
  15. package/src/generate-test-package-assertions.mjs +4 -0
  16. package/src/generate-test-product-fixture.mjs +1 -1
  17. package/src/generate-test-product-fixture.test.mjs +35 -38
  18. package/src/generate-test-product-iteration.mjs +0 -1
  19. package/src/generate-test-product-iteration.test.mjs +0 -1
  20. package/src/generate-test-runtime-boundary-assertions.mjs +20 -0
  21. package/src/generate-test-standalone-assertions.mjs +0 -16
  22. package/src/generate-test-standalone-delivery-stages.mjs +2 -86
  23. package/src/generate.test.mjs +4 -0
  24. package/src/generated-integrity-manifest.test.mjs +5 -2
  25. package/src/generated-source-policy.test.mjs +0 -4
  26. package/src/package-json.mjs +5 -0
  27. package/src/package-json.test.mjs +21 -0
  28. package/src/package-manager.mjs +2 -0
  29. package/src/package-manager.test.mjs +8 -0
  30. package/src/packaged-template-fallback-helpers.mjs +254 -0
  31. package/src/packaged-template-fallback.test.mjs +121 -46
  32. package/src/packaged-template-runtime-assertions.mjs +150 -0
  33. package/templates/runtime/contracts/component-contracts.choices.test.ts +18 -3
  34. package/templates/runtime/contracts/component-contracts.choices.ts +8 -3
  35. package/templates/runtime/contracts/component-contracts.inputs.ts +2 -1
  36. package/templates/runtime/contracts/component-contracts.runtime-acceptance.test.ts +18 -4
  37. package/templates/runtime/contracts/component-contracts.runtime-shell.test.ts +1 -1
  38. package/templates/runtime/contracts/component-contracts.runtime.ts +7 -4
  39. package/templates/runtime/contracts/component-contracts.visual.test.ts +20 -0
  40. package/templates/runtime/contracts/component-contracts.visual.ts +4 -0
  41. package/templates/runtime/contracts/decision-contracts.test.ts +18 -12
  42. package/templates/runtime/contracts/decision-contracts.ts +4 -4
  43. package/templates/runtime/contracts/performance-verification-policy.test.ts +12 -12
  44. package/templates/runtime/contracts/performance-verification-policy.ts +8 -8
  45. package/templates/runtime/export/artifact-download.ts +1 -0
  46. package/templates/runtime/export/artifact-frame-renderer.ts +2 -15
  47. package/templates/runtime/export/artifact-frame-state.ts +16 -0
  48. package/templates/runtime/export/artifact-scene-frame.test.ts +3 -3
  49. package/templates/runtime/export/artifact-scene-frame.ts +3 -3
  50. package/templates/runtime/export/export-error.ts +5 -0
  51. package/templates/runtime/export/export-renderer-coverage.ts +54 -0
  52. package/templates/runtime/export/image-artifact-export.ts +2 -2
  53. package/templates/runtime/export/index.ts +13 -0
  54. package/templates/runtime/export/product-export-renderer.test.ts +38 -4
  55. package/templates/runtime/export/product-export-renderer.ts +0 -41
  56. package/templates/runtime/export/product-svg-export-renderer.ts +21 -0
  57. package/templates/runtime/export/svg-artifact-export.test.ts +98 -0
  58. package/templates/runtime/export/svg-artifact-export.ts +120 -0
  59. package/templates/runtime/export/svg-document.test.ts +221 -0
  60. package/templates/runtime/export/svg-document.ts +400 -0
  61. package/templates/runtime/export/svg-policy.ts +47 -0
  62. package/templates/runtime/index.ts +1 -0
  63. package/templates/runtime/react/app-shell/runtime-public-api.test.tsx +10 -0
  64. package/templates/runtime/react/app-shell/settings-transfer.test.ts +21 -0
  65. package/templates/runtime/react/app-shell/toolcraft-app.scene-export.test.tsx +46 -1
  66. package/templates/runtime/react/app-shell/toolcraft-app.tsx +7 -2
  67. package/templates/runtime/react/canvas/canvas-shell-interactions.test.tsx +30 -0
  68. package/templates/runtime/react/canvas/canvas-shell-pinch-interactions.test.tsx +155 -0
  69. package/templates/runtime/react/canvas/canvas-shell-rendering.test.tsx +1 -1
  70. package/templates/runtime/react/canvas/canvas-shell.tsx +16 -5
  71. package/templates/runtime/react/canvas/canvas-viewport-geometry.ts +133 -0
  72. package/templates/runtime/react/canvas/use-canvas-viewport-interactions.ts +285 -36
  73. package/templates/runtime/react/controls-panel/__tests__/controls-panel.color-applicability-layout.test.tsx +134 -0
  74. package/templates/runtime/react/controls-panel/__tests__/controls-panel.color-layout.test.tsx +16 -1
  75. package/templates/runtime/react/controls-panel/__tests__/controls-panel.render-isolation.test.tsx +2 -0
  76. package/templates/runtime/react/controls-panel/__tests__/controls-panel.scene-export-actions.test.tsx +39 -0
  77. package/templates/runtime/react/controls-panel/__tests__/controls-panel.setup-controls.test.tsx +3 -3
  78. package/templates/runtime/react/controls-panel/__tests__/controls-panel.source-collection.test.tsx +1 -4
  79. package/templates/runtime/react/controls-panel/__tests__/controls-panel.source-color-bank.test.tsx +2 -2
  80. package/templates/runtime/react/controls-panel/__tests__/controls-panel.vector-interaction.test.tsx +6 -6
  81. package/templates/runtime/react/controls-panel/actions/controls-panel-actions.ts +2 -2
  82. package/templates/runtime/react/controls-panel/actions/export-action-runner.ts +40 -11
  83. package/templates/runtime/react/controls-panel/layout/controls-panel-layout.tsx +31 -2
  84. package/templates/runtime/react/controls-panel/layout/controls-panel-section.tsx +4 -1
  85. package/templates/runtime/react/controls-panel/renderers/controls-panel-action-renderer.tsx +2 -1
  86. package/templates/runtime/react/controls-panel/renderers/controls-panel-basic-renderers.tsx +2 -52
  87. package/templates/runtime/react/controls-panel/values/controls-panel-color-values.ts +1 -9
  88. package/templates/runtime/react/controls-panel/values/controls-panel-spatial-values.ts +7 -2
  89. package/templates/runtime/react/orientation-gizmo/orientation-gizmo-math.ts +9 -69
  90. package/templates/runtime/schema/artifact-export-actions.test.ts +47 -0
  91. package/templates/runtime/schema/artifact-export-actions.ts +49 -0
  92. package/templates/runtime/schema/types.ts +1 -0
  93. package/templates/runtime/state/canvas-background-state.ts +1 -16
  94. package/templates/runtime/state/canvas-state.ts +32 -20
  95. package/templates/runtime/state/control-value-codecs.test.ts +98 -0
  96. package/templates/runtime/state/control-value-codecs.ts +700 -0
  97. package/templates/runtime/state/control-value-normalization.test.ts +1 -1
  98. package/templates/runtime/state/control-value-normalization.ts +127 -135
  99. package/templates/runtime/state/controls-reducer.ts +26 -3
  100. package/templates/runtime/state/create-template-state.test.ts +30 -0
  101. package/templates/runtime/state/create-template-state.ts +52 -31
  102. package/templates/runtime/state/orientation-pose.ts +80 -0
  103. package/templates/runtime/state/persistence-control-values.test.ts +59 -0
  104. package/templates/runtime/state/reducer-controls.test.ts +45 -0
  105. package/templates/runtime/state/reducer-media-reset.test.ts +1 -1
  106. package/templates/runtime/state/reducer-timeline.test.ts +70 -0
  107. package/templates/runtime/state/timeline-reducer.ts +40 -2
  108. package/templates/runtime/testing/performance-schema-queries.ts +2 -2
  109. package/templates/starter/AGENTS.md +21 -22
  110. package/templates/starter/docs/toolcraft/README.md +6 -6
  111. package/templates/starter/docs/toolcraft/acceptance-testing.md +20 -20
  112. package/templates/starter/docs/toolcraft/agent-worklog.md +88 -1
  113. package/templates/starter/docs/toolcraft/assembly-workflow.md +7 -6
  114. package/templates/starter/docs/toolcraft/component-rules.md +2 -2
  115. package/templates/starter/docs/toolcraft/core/layout.md +6 -1
  116. package/templates/starter/docs/toolcraft/core/media-upload.md +1 -1
  117. package/templates/starter/docs/toolcraft/core/performance.md +8 -10
  118. package/templates/starter/docs/toolcraft/core/reference-study.md +80 -19
  119. package/templates/starter/docs/toolcraft/core/runtime-boundary.md +2 -1
  120. package/templates/starter/docs/toolcraft/core/setup-export.md +43 -13
  121. package/templates/starter/docs/toolcraft/decision-contract.md +2 -2
  122. package/templates/starter/docs/toolcraft/performance.md +8 -10
  123. package/templates/starter/docs/toolcraft/renderer-technique.md +2 -2
  124. package/templates/starter/docs/toolcraft/schema-reference.md +8 -8
  125. package/templates/starter/docs/toolcraft/workflow.md +14 -14
  126. package/templates/starter/e2e/app-browser-infinity-canvas-evidence.spec.ts +38 -0
  127. package/templates/starter/e2e/app-browser-motion-reference-requirements.spec.ts +411 -0
  128. package/templates/starter/e2e/app-browser-proof-session.spec.ts +85 -0
  129. package/templates/starter/e2e/app-browser-runtime-requirements.spec.ts +62 -0
  130. package/templates/starter/e2e/app-browser-selection-scope-evidence.spec.ts +137 -0
  131. package/templates/starter/e2e/browser-infinity-canvas-svg-evidence.ts +42 -0
  132. package/templates/starter/e2e/browser-layer-evidence-helpers.ts +15 -36
  133. package/templates/starter/e2e/browser-product-raster-snapshot.ts +213 -0
  134. package/templates/starter/e2e/browser-proof-session.ts +43 -15
  135. package/templates/starter/e2e/browser-proof-surface-action.ts +79 -0
  136. package/templates/starter/e2e/browser-proof-types.ts +15 -0
  137. package/templates/starter/e2e/browser-runtime-evidence-requirements.ts +22 -6
  138. package/templates/starter/e2e/browser-selection-scope-evidence.ts +269 -0
  139. package/templates/starter/e2e/browser-semantic-evidence-test-helpers.ts +97 -0
  140. package/templates/starter/e2e/browser-svg-export-evidence.spec.ts +79 -0
  141. package/templates/starter/e2e/browser-svg-export-evidence.ts +152 -0
  142. package/templates/starter/e2e/export-artifact-helpers.ts +70 -0
  143. package/templates/starter/e2e/product-observable-helpers.ts +8 -129
  144. package/templates/starter/e2e/svg-artifact-inspection.spec.ts +136 -0
  145. package/templates/starter/e2e/svg-artifact-inspection.ts +331 -0
  146. package/templates/starter/e2e/svg-download-test-fixtures.ts +34 -0
  147. package/templates/starter/e2e/toolcraft-delivery-catalog-reporter.ts +198 -15
  148. package/templates/starter/e2e/toolcraft-feature-verification-reporter.spec.ts +149 -0
  149. package/templates/starter/e2e/toolcraft-feature-verification-reporter.ts +223 -0
  150. package/templates/starter/package.json +2 -0
  151. package/templates/starter/scripts/check-toolcraft-docs.mjs +1 -0
  152. package/templates/starter/scripts/create-toolcraft-motion-reference-study.mjs +233 -0
  153. package/templates/starter/scripts/create-toolcraft-motion-reference-study.test.mjs +459 -0
  154. package/templates/starter/scripts/playwright-test-title-selection.d.mts +45 -0
  155. package/templates/starter/scripts/run-browser-performance-test-helpers.mjs +0 -27
  156. package/templates/starter/scripts/run-browser-performance.mjs +0 -6
  157. package/templates/starter/scripts/run-browser-performance.test.mjs +5 -13
  158. package/templates/starter/scripts/run-delivery-verification-test-helpers.mjs +0 -34
  159. package/templates/starter/scripts/run-delivery-verification.test.mjs +135 -31
  160. package/templates/starter/scripts/run-feature-verification.mjs +212 -0
  161. package/templates/starter/scripts/run-feature-verification.test.mjs +226 -0
  162. package/templates/starter/scripts/toolcraft-checkpoint-delivery-state.mjs +21 -8
  163. package/templates/starter/scripts/toolcraft-checkpoint-delivery-state.test.mjs +32 -92
  164. package/templates/starter/scripts/toolcraft-checkpoint-transaction.mjs +28 -6
  165. package/templates/starter/scripts/toolcraft-checkpoint-transaction.test.mjs +8 -63
  166. package/templates/starter/scripts/toolcraft-delivery-anchor.mjs +28 -8
  167. package/templates/starter/scripts/toolcraft-delivery-anchor.test.mjs +50 -61
  168. package/templates/starter/scripts/toolcraft-delivery-architecture-inventory.mjs +0 -4
  169. package/templates/starter/scripts/toolcraft-delivery-architecture-policy.mjs +0 -1
  170. package/templates/starter/scripts/toolcraft-delivery-evidence.test.mjs +2 -3
  171. package/templates/starter/scripts/toolcraft-delivery-executor.mjs +5 -1
  172. package/templates/starter/scripts/toolcraft-delivery-executor.test.mjs +5 -12
  173. package/templates/starter/scripts/toolcraft-delivery-functional-context.d.mts +1 -48
  174. package/templates/starter/scripts/toolcraft-delivery-functional-context.mjs +2 -30
  175. package/templates/starter/scripts/toolcraft-delivery-functional-context.test.mjs +4 -166
  176. package/templates/starter/scripts/toolcraft-delivery-functional-initial.test.mjs +4 -20
  177. package/templates/starter/scripts/toolcraft-delivery-lifecycle.mjs +43 -192
  178. package/templates/starter/scripts/toolcraft-delivery-performance-iteration-lifecycle.test.mjs +79 -440
  179. package/templates/starter/scripts/toolcraft-delivery-plan-authority.test.mjs +102 -297
  180. package/templates/starter/scripts/toolcraft-delivery-plan-construction.mjs +46 -97
  181. package/templates/starter/scripts/toolcraft-delivery-plan-test-helpers.mjs +125 -0
  182. package/templates/starter/scripts/toolcraft-delivery-plan-validation.test.mjs +58 -0
  183. package/templates/starter/scripts/toolcraft-delivery-plan.d.mts +19 -31
  184. package/templates/starter/scripts/toolcraft-delivery-plan.mjs +254 -252
  185. package/templates/starter/scripts/toolcraft-delivery-plan.test.mjs +29 -457
  186. package/templates/starter/scripts/toolcraft-delivery-receipt-performance.test.mjs +1 -1
  187. package/templates/starter/scripts/toolcraft-delivery-receipt-strictness.test.mjs +3 -72
  188. package/templates/starter/scripts/toolcraft-delivery-receipt-test-helpers.mjs +7 -36
  189. package/templates/starter/scripts/toolcraft-delivery-receipt.d.mts +3 -5
  190. package/templates/starter/scripts/toolcraft-delivery-receipt.mjs +15 -31
  191. package/templates/starter/scripts/toolcraft-delivery-receipt.test.mjs +28 -20
  192. package/templates/starter/scripts/toolcraft-delivery-receipt.types.test.mts +22 -30
  193. package/templates/starter/scripts/toolcraft-feature-verification-plan.d.mts +20 -0
  194. package/templates/starter/scripts/toolcraft-feature-verification-plan.mjs +146 -0
  195. package/templates/starter/scripts/toolcraft-feature-verification-plan.test.mjs +96 -0
  196. package/templates/starter/scripts/toolcraft-functional-proof-model.d.mts +3 -18
  197. package/templates/starter/scripts/toolcraft-functional-proof-model.mjs +39 -127
  198. package/templates/starter/scripts/toolcraft-functional-proof-model.test.mjs +25 -362
  199. package/templates/starter/scripts/toolcraft-functional-proof-model.types.test.mts +6 -83
  200. package/templates/starter/scripts/toolcraft-functional-proof-primitives.d.mts +11 -0
  201. package/templates/starter/scripts/toolcraft-functional-proof-primitives.mjs +61 -0
  202. package/templates/starter/scripts/toolcraft-functional-proof-primitives.test.mjs +43 -0
  203. package/templates/starter/scripts/toolcraft-integrity-policy.mjs +13 -0
  204. package/templates/starter/scripts/toolcraft-integrity-test-utils.mjs +1 -1
  205. package/templates/starter/scripts/toolcraft-layer-evidence-facade.test.mjs +58 -22
  206. package/templates/starter/scripts/toolcraft-motion-reference-analysis-protocol.mjs +111 -0
  207. package/templates/starter/scripts/toolcraft-motion-reference-analysis-protocol.test.mjs +116 -0
  208. package/templates/starter/scripts/toolcraft-motion-reference-artifacts.d.mts +37 -0
  209. package/templates/starter/scripts/toolcraft-motion-reference-artifacts.mjs +308 -0
  210. package/templates/starter/scripts/toolcraft-motion-reference-artifacts.test.mjs +420 -0
  211. package/templates/starter/scripts/toolcraft-motion-reference-artifacts.types.test.mts +50 -0
  212. package/templates/starter/scripts/toolcraft-motion-reference-command-options.mjs +195 -0
  213. package/templates/starter/scripts/toolcraft-motion-reference-command-options.test.mjs +224 -0
  214. package/templates/starter/scripts/toolcraft-motion-reference-contact-sheet.mjs +122 -0
  215. package/templates/starter/scripts/toolcraft-motion-reference-contact-sheet.test.mjs +153 -0
  216. package/templates/starter/scripts/toolcraft-motion-reference-evidence-assembly.mjs +270 -0
  217. package/templates/starter/scripts/toolcraft-motion-reference-evidence.test.mjs +432 -0
  218. package/templates/starter/scripts/toolcraft-motion-reference-ffmpeg-output.mjs +275 -0
  219. package/templates/starter/scripts/toolcraft-motion-reference-ffmpeg-output.test.mjs +294 -0
  220. package/templates/starter/scripts/toolcraft-motion-reference-group-inventory.mjs +148 -0
  221. package/templates/starter/scripts/toolcraft-motion-reference-image-filter-graph.mjs +101 -0
  222. package/templates/starter/scripts/toolcraft-motion-reference-image-filter-graph.test.mjs +124 -0
  223. package/templates/starter/scripts/toolcraft-motion-reference-image-source.mjs +259 -0
  224. package/templates/starter/scripts/toolcraft-motion-reference-image-source.test.mjs +338 -0
  225. package/templates/starter/scripts/toolcraft-motion-reference-image-timing.mjs +96 -0
  226. package/templates/starter/scripts/toolcraft-motion-reference-image-timing.test.mjs +81 -0
  227. package/templates/starter/scripts/toolcraft-motion-reference-lock-recovery.test.mjs +144 -0
  228. package/templates/starter/scripts/toolcraft-motion-reference-media-source.mjs +165 -0
  229. package/templates/starter/scripts/toolcraft-motion-reference-media-source.test.mjs +299 -0
  230. package/templates/starter/scripts/toolcraft-motion-reference-publication-discovery.test.mjs +142 -0
  231. package/templates/starter/scripts/toolcraft-motion-reference-publication-isolation.test.mjs +234 -0
  232. package/templates/starter/scripts/toolcraft-motion-reference-publication-journal-schema.mjs +122 -0
  233. package/templates/starter/scripts/toolcraft-motion-reference-publication-journal-store.mjs +89 -0
  234. package/templates/starter/scripts/toolcraft-motion-reference-publication-journal-store.test.mjs +74 -0
  235. package/templates/starter/scripts/toolcraft-motion-reference-publication-journal.mjs +264 -0
  236. package/templates/starter/scripts/toolcraft-motion-reference-publication-journal.test.mjs +377 -0
  237. package/templates/starter/scripts/toolcraft-motion-reference-publication-lease.mjs +254 -0
  238. package/templates/starter/scripts/toolcraft-motion-reference-publication-lease.test.mjs +130 -0
  239. package/templates/starter/scripts/toolcraft-motion-reference-publication-staging.mjs +128 -0
  240. package/templates/starter/scripts/toolcraft-motion-reference-publication-staging.test.mjs +209 -0
  241. package/templates/starter/scripts/toolcraft-motion-reference-publication.fixtures.mjs +88 -0
  242. package/templates/starter/scripts/toolcraft-motion-reference-publication.mjs +249 -0
  243. package/templates/starter/scripts/toolcraft-motion-reference-publication.test.mjs +433 -0
  244. package/templates/starter/scripts/toolcraft-motion-reference-review-output.mjs +38 -0
  245. package/templates/starter/scripts/toolcraft-motion-reference-review-output.test.mjs +29 -0
  246. package/templates/starter/scripts/toolcraft-motion-reference-root-safety.test.mjs +84 -0
  247. package/templates/starter/scripts/toolcraft-motion-reference-roots.mjs +83 -0
  248. package/templates/starter/scripts/toolcraft-motion-reference-sampling.mjs +283 -0
  249. package/templates/starter/scripts/toolcraft-motion-reference-sampling.test.mjs +480 -0
  250. package/templates/starter/scripts/toolcraft-motion-reference-stage-registry.mjs +39 -0
  251. package/templates/starter/scripts/toolcraft-motion-reference-stage-registry.test.mjs +59 -0
  252. package/templates/starter/scripts/toolcraft-motion-reference-stage.mjs +71 -0
  253. package/templates/starter/scripts/toolcraft-motion-reference-stage.test.mjs +61 -0
  254. package/templates/starter/scripts/toolcraft-motion-review-numeric.mjs +74 -0
  255. package/templates/starter/scripts/toolcraft-motion-review-numeric.test.mjs +65 -0
  256. package/templates/starter/scripts/toolcraft-motion-review-partitioning.mjs +268 -0
  257. package/templates/starter/scripts/toolcraft-motion-review-partitioning.test.mjs +329 -0
  258. package/templates/starter/scripts/toolcraft-motion-review-protected-units.mjs +120 -0
  259. package/templates/starter/scripts/toolcraft-motion-review-protected-units.test.mjs +111 -0
  260. package/templates/starter/scripts/toolcraft-performance-escalation-policy.test.mjs +77 -345
  261. package/templates/starter/scripts/toolcraft-performance-receipt-validation.test.mjs +19 -21
  262. package/templates/starter/scripts/toolcraft-product-boundary-ast.mjs +1 -1
  263. package/templates/starter/scripts/toolcraft-product-export-boundary.mjs +10 -1
  264. package/templates/starter/scripts/toolcraft-product-export-boundary.test.mjs +5 -1
  265. package/templates/starter/scripts/toolcraft-product-observable-facade.test.mjs +46 -1
  266. package/templates/starter/scripts/toolcraft-receipt-boundary.test.mjs +0 -1
  267. package/templates/starter/scripts/toolcraft-source-inventory.d.mts +5 -0
  268. package/templates/starter/scripts/toolcraft-source-inventory.mjs +25 -14
  269. package/templates/starter/scripts/toolcraft-source-inventory.test.mjs +48 -0
  270. package/templates/starter/scripts/toolcraft-source-ownership.mjs +0 -1
  271. package/templates/starter/scripts/toolcraft-source-ownership.test.mjs +30 -5
  272. package/templates/starter/scripts/toolcraft-verification-receipt-test-helpers.mjs +5 -26
  273. package/templates/starter/scripts/toolcraft-verification-receipt.d.mts +0 -7
  274. package/templates/starter/scripts/toolcraft-verification-receipt.mjs +3 -47
  275. package/templates/starter/scripts/toolcraft-verification-receipt.test.mjs +6 -87
  276. package/templates/starter/scripts/toolcraft-vitest-runtime-contract.d.mts +19 -0
  277. package/templates/starter/scripts/toolcraft-vitest-runtime-contract.mjs +107 -0
  278. package/templates/starter/scripts/toolcraft-vitest-runtime-contract.test.mjs +114 -0
  279. package/templates/starter/scripts/toolcraft-vitest-runtime-evidence-reporter.mjs +13 -2
  280. package/templates/starter/scripts/toolcraft-vitest-runtime-evidence-reporter.test.mjs +110 -0
  281. package/templates/starter/src/app/acceptance/artifact-export-intent.ts +51 -20
  282. package/templates/starter/src/app/acceptance/canvas-coverage.ts +1 -0
  283. package/templates/starter/src/app/acceptance/color-bank-labels.ts +11 -15
  284. package/templates/starter/src/app/acceptance/color-row-grouping.ts +33 -0
  285. package/templates/starter/src/app/acceptance/control-acceptance-coverage.ts +0 -11
  286. package/templates/starter/src/app/acceptance/control-acceptance-policy.ts +2 -3
  287. package/templates/starter/src/app/acceptance/control-component-rules.ts +0 -10
  288. package/templates/starter/src/app/acceptance/control-labels.ts +30 -1
  289. package/templates/starter/src/app/acceptance/control-layout-section-rules.ts +18 -0
  290. package/templates/starter/src/app/acceptance/export-artifact-coverage.ts +25 -17
  291. package/templates/starter/src/app/acceptance/feature-verification-selection.test.ts +295 -0
  292. package/templates/starter/src/app/acceptance/feature-verification-selection.ts +161 -0
  293. package/templates/starter/src/app/acceptance/infinity-canvas.ts +10 -0
  294. package/templates/starter/src/app/acceptance/interaction-ownership-intent.ts +19 -1
  295. package/templates/starter/src/app/acceptance/interaction-ownership.ts +18 -2
  296. package/templates/starter/src/app/acceptance/motion-reference-evidence-validation.mjs +65 -0
  297. package/templates/starter/src/app/acceptance/motion-reference-evidence-windows.mjs +301 -0
  298. package/templates/starter/src/app/acceptance/motion-reference-evidence.d.mts +11 -0
  299. package/templates/starter/src/app/acceptance/motion-reference-evidence.mjs +145 -0
  300. package/templates/starter/src/app/acceptance/motion-reference-study-behaviors.ts +162 -0
  301. package/templates/starter/src/app/acceptance/motion-reference-study-coverage.ts +206 -0
  302. package/templates/starter/src/app/acceptance/motion-reference-study-identity.ts +129 -0
  303. package/templates/starter/src/app/acceptance/motion-reference-study-partitions.ts +186 -0
  304. package/templates/starter/src/app/acceptance/motion-reference-study.ts +90 -0
  305. package/templates/starter/src/app/acceptance/output-export-actions.test.ts +9 -1
  306. package/templates/starter/src/app/acceptance/output-export-actions.ts +14 -22
  307. package/templates/starter/src/app/acceptance/output-export-layout-rules.ts +5 -1
  308. package/templates/starter/src/app/acceptance/output-export-model.ts +4 -0
  309. package/templates/starter/src/app/acceptance/output-export.ts +4 -1
  310. package/templates/starter/src/app/acceptance/reference-study-types.ts +167 -17
  311. package/templates/starter/src/app/acceptance/runtime-coverage.ts +6 -1
  312. package/templates/starter/src/app/acceptance/selection-scope.test.ts +200 -0
  313. package/templates/starter/src/app/acceptance/selection-scope.ts +151 -0
  314. package/templates/starter/src/app/acceptance/transfer-mode-types.ts +114 -0
  315. package/templates/starter/src/app/acceptance/types.ts +43 -118
  316. package/templates/starter/src/app/acceptance/validate-coverage.ts +14 -3
  317. package/templates/starter/src/app/starter-acceptance-data.ts +1 -0
  318. package/templates/starter/src/app/starter-acceptance.animation-intent.test.ts +3 -0
  319. package/templates/starter/src/app/starter-acceptance.artifact-export-intent.test.ts +81 -8
  320. package/templates/starter/src/app/starter-acceptance.background-export.test.ts +2 -0
  321. package/templates/starter/src/app/starter-acceptance.canvas-sizing.test.ts +2 -0
  322. package/templates/starter/src/app/starter-acceptance.color-row-grouping.test.ts +118 -0
  323. package/templates/starter/src/app/starter-acceptance.compound-part-coverage.test.ts +1 -1
  324. package/templates/starter/src/app/starter-acceptance.contract-fixtures.ts +1 -0
  325. package/templates/starter/src/app/starter-acceptance.control-applicability.test.ts +1 -0
  326. package/templates/starter/src/app/starter-acceptance.control-label-context.test.ts +1 -0
  327. package/templates/starter/src/app/starter-acceptance.control-labels.test.ts +78 -3
  328. package/templates/starter/src/app/starter-acceptance.control-naming-rules.test.ts +77 -1
  329. package/templates/starter/src/app/starter-acceptance.custom-control-fit-check.test.ts +1 -1
  330. package/templates/starter/src/app/starter-acceptance.export-artifact.test.ts +74 -3
  331. package/templates/starter/src/app/starter-acceptance.export-test-utils.ts +5 -1
  332. package/templates/starter/src/app/starter-acceptance.image-export-settings.test.ts +2 -0
  333. package/templates/starter/src/app/starter-acceptance.interaction-ownership.test.ts +19 -3
  334. package/templates/starter/src/app/starter-acceptance.layers.test.ts +2 -1
  335. package/templates/starter/src/app/starter-acceptance.media-upload.test.ts +28 -0
  336. package/templates/starter/src/app/starter-acceptance.motion-reference-evidence.test.ts +17 -0
  337. package/templates/starter/src/app/starter-acceptance.motion-reference-identity.test.ts +163 -0
  338. package/templates/starter/src/app/starter-acceptance.motion-reference-mapping.test.ts +133 -0
  339. package/templates/starter/src/app/starter-acceptance.motion-reference-ownership.test.ts +121 -0
  340. package/templates/starter/src/app/starter-acceptance.motion-reference-partitions.test.ts +210 -0
  341. package/templates/starter/src/app/starter-acceptance.motion-reference-test-utils.ts +313 -0
  342. package/templates/starter/src/app/starter-acceptance.output-export-intent.test.ts +78 -4
  343. package/templates/starter/src/app/starter-acceptance.product-output-export.test.ts +6 -1
  344. package/templates/starter/src/app/starter-acceptance.product-readiness.test.ts +18 -1
  345. package/templates/starter/src/app/starter-acceptance.product-worklog.test.ts +123 -2
  346. package/templates/starter/src/app/starter-acceptance.reference-custom-timeline.test.ts +2 -0
  347. package/templates/starter/src/app/starter-acceptance.reference-foundation.test.ts +8 -0
  348. package/templates/starter/src/app/starter-acceptance.reference-timeline.test.ts +7 -0
  349. package/templates/starter/src/app/starter-acceptance.section-cohesion.test.ts +2 -0
  350. package/templates/starter/src/app/starter-acceptance.timeline-playback.test.ts +5 -0
  351. package/templates/starter/src/app/starter-acceptance.ts +34 -8
  352. package/templates/starter/src/app/starter-acceptance.video-export-settings.test.ts +2 -0
  353. package/templates/starter/src/app/starter-acceptance.video-reference-study.test.ts +34 -236
  354. package/templates/starter/src/app/starter-acceptance.view-interaction.test.ts +4 -0
  355. package/templates/starter/src/app/starter-acceptance.worklog-test-utils.ts +122 -6
  356. package/templates/starter/src/app/starter-acceptance.worklog.test.ts +152 -16
  357. package/templates/starter/src/app/starter-performance.gates.test.ts +20 -18
  358. package/templates/starter/src/app/starter-performance.lifecycle.test.ts +22 -6
  359. package/templates/starter/src/app/test-evidence/browser-runtime-contract.ts +3 -0
  360. package/templates/starter/tsconfig.json +1 -0
  361. package/templates/starter/scripts/toolcraft-browser-impact-selection.mjs +0 -26
  362. package/templates/starter/scripts/toolcraft-delivery-framework-refresh.test.mjs +0 -141
  363. package/templates/starter/scripts/toolcraft-delivery-functional-changed.test.mjs +0 -468
  364. package/templates/starter/scripts/toolcraft-delivery-functional-model-lifecycle.test.mjs +0 -254
  365. package/templates/starter/scripts/toolcraft-delivery-functional-semantic-regression.test.mjs +0 -135
  366. package/templates/starter/scripts/toolcraft-delivery-performance-iteration-durability.test.mjs +0 -329
  367. package/templates/starter/scripts/toolcraft-delivery-plan-errors.test.mjs +0 -430
  368. package/templates/starter/scripts/toolcraft-delivery-plan-functional-model.test.mjs +0 -358
  369. package/templates/starter/scripts/toolcraft-functional-proof-regression-fixtures.mjs +0 -298
  370. package/templates/starter/scripts/toolcraft-verification-impact-inventory.d.mts +0 -62
  371. package/templates/starter/scripts/toolcraft-verification-impact-inventory.mjs +0 -344
  372. package/templates/starter/scripts/toolcraft-verification-impact-inventory.test.mjs +0 -204
  373. package/templates/starter/scripts/toolcraft-verification-impact-performance-candidates.test.mjs +0 -210
  374. package/templates/starter/scripts/toolcraft-verification-impact-resolution.mjs +0 -344
  375. package/templates/starter/scripts/toolcraft-verification-impact-resolution.test.mjs +0 -270
  376. package/templates/starter/scripts/toolcraft-verification-impact-semantic-resolution.test.mjs +0 -449
  377. package/templates/starter/scripts/toolcraft-verification-impact-support-resolution.test.mjs +0 -195
  378. package/templates/starter/scripts/toolcraft-verification-impact.d.mts +0 -132
  379. package/templates/starter/scripts/toolcraft-verification-impact.mjs +0 -169
  380. package/templates/starter/scripts/toolcraft-verification-impact.test.mjs +0 -300
  381. package/templates/starter/scripts/toolcraft-verification-input-roles.mjs +0 -197
  382. package/templates/starter/scripts/toolcraft-verification-input-roles.test.mjs +0 -225
  383. package/templates/starter/src/app/acceptance/video-reference-study.ts +0 -217
  384. package/templates/starter/src/app/starter-verification-impact.json +0 -15
@@ -248,7 +248,7 @@ describe("Toolcraft template component contracts: choices and actions", () => {
248
248
  "Do not use panelActions for resetting controls; the controls panel header owns Reset controls.",
249
249
  );
250
250
  expect(contract.aiUsageRules).toContain(
251
- "Handle product-specific non-export panelActions through ToolcraftApp onPanelAction. Typed export-image and export-video actions are runtime-owned and consume ToolcraftAppComposition.exportRenderer.",
251
+ "Handle product-specific non-export panelActions through ToolcraftApp onPanelAction. Typed export-image/export-video actions consume ToolcraftAppComposition.exportRenderer; typed export-svg consumes svgExportRenderer. All typed export actions are runtime-owned.",
252
252
  );
253
253
  expect(contract.aiUsageRules).toContain(
254
254
  "Async non-export product actions such as Download, Copy, Generate, or Apply must return the real Promise from onPanelAction and report progress through the onPanelAction reportProgress callback.",
@@ -263,7 +263,7 @@ describe("Toolcraft template component contracts: choices and actions", () => {
263
263
  "Every product must declare productReadiness.exportIntent before authoring export panelActions or settings sections.",
264
264
  );
265
265
  expect(contract.aiUsageRules).toContain(
266
- 'Export-labeled panelActions use icon "upload-simple", matching the Setup "Export Settings" action; do not use "download", "download-simple", or "export" icons for Export PNG or Export Video.',
266
+ 'Export-labeled panelActions use icon "upload-simple", matching the Setup "Export Settings" action; do not use "download", "download-simple", or "export" icons for Export PNG, Export SVG, or Export Video.',
267
267
  );
268
268
  expect(contract.aiUsageRules).toContain(
269
269
  'Image export is the Toolcraft product default. Keep Export PNG unless productReadiness.exportIntent.image is "user-removed" with non-empty explicit user-removal evidence.',
@@ -283,6 +283,18 @@ describe("Toolcraft template component contracts: choices and actions", () => {
283
283
  expect(contract.aiUsageRules).toContain(
284
284
  "Image Export resolution controls the actual exported image long edge: 2K = 2048px, 4K = 4096px, 8K = 8192px. Runtime resolves the selected value and protected browser acceptance proves decoded image width and height.",
285
285
  );
286
+ expect(contract.aiUsageRules).toContain(
287
+ 'Add Export SVG only when productReadiness.exportIntent.svg is "user-requested" with non-empty explicit user-request evidence.',
288
+ );
289
+ expect(contract.aiUsageRules).toContain(
290
+ "Export SVG means self-contained editable vector geometry/text. Do not wrap raster bytes in image, foreignObject, or data URLs and do not silently trace raster/WebGL/model output.",
291
+ );
292
+ expect(contract.aiUsageRules).toContain(
293
+ "SVG export has no settings section. Product code appends namespace-aware vector nodes through svgExportRenderer; runtime owns frame/viewBox, background, XML validation, serialization, download, progress, and typed failures.",
294
+ );
295
+ expect(contract.aiUsageRules).toContain(
296
+ "Protected SVG browser proof must inspect the exact downloaded bytes with strict XML parsing, namespace/vector-only policy, native decode, content hashing, and exact product vector expectations.",
297
+ );
286
298
  expect(contract.aiUsageRules).toContain(
287
299
  'Add Export Video only when productReadiness.exportIntent.video is "user-requested" with non-empty explicit user-request evidence.',
288
300
  );
@@ -305,7 +317,7 @@ describe("Toolcraft template component contracts: choices and actions", () => {
305
317
  'Video-only apps require explicit image user-removal evidence and place "Video Export" directly above sticky footer panelActions.',
306
318
  );
307
319
  expect(contract.aiUsageRules).toContain(
308
- 'Explicit no-export apps require image user-removal evidence with video "not-requested" and omit export actions and settings sections.',
320
+ 'Explicit no-export apps require image user-removal evidence with SVG/video "not-requested" and omit export actions and settings sections.',
309
321
  );
310
322
  expect(contract.aiUsageRules).toContain(
311
323
  'The Video Export section must include format and resolution controls such as targets "export.video.format" and "export.video.resolution".',
@@ -358,6 +370,9 @@ describe("Toolcraft template component contracts: choices and actions", () => {
358
370
  expect(contract.aiUsageRules).toContain(
359
371
  "ToolcraftAppComposition.exportRenderer draws one deterministic product frame in scene coordinates for both image and video. Runtime owns canvas allocation, background, runtime media/model compositing, selected dimensions, encoding, download, progress, and typed failures.",
360
372
  );
373
+ expect(contract.aiUsageRules).toContain(
374
+ "ToolcraftAppComposition.svgExportRenderer appends one deterministic namespace-aware vector frame. Runtime owns SVG root/frame/background assembly, vector-only validation, strict XML serialization, download, progress, and typed failures.",
375
+ );
361
376
  expect(contract.aiUsageRules).toContain(
362
377
  "Product modules must not encode or download export canvases directly and must not instantiate MediaRecorder or VideoEncoder; the generated-source boundary rejects those duplicate export paths.",
363
378
  );
@@ -360,18 +360,22 @@ export const TOOLCRAFT_CHOICE_COMPONENT_CONTRACTS = {
360
360
  aiUsageRules: [
361
361
  "Use panelActions only for sticky footer product actions such as Generate, Export, Copy, or Download.",
362
362
  "Do not use panelActions for resetting controls; the controls panel header owns Reset controls.",
363
- "Handle product-specific non-export panelActions through ToolcraftApp onPanelAction. Typed export-image and export-video actions are runtime-owned and consume ToolcraftAppComposition.exportRenderer.",
363
+ "Handle product-specific non-export panelActions through ToolcraftApp onPanelAction. Typed export-image/export-video actions consume ToolcraftAppComposition.exportRenderer; typed export-svg consumes svgExportRenderer. All typed export actions are runtime-owned.",
364
364
  "Async non-export product actions such as Download, Copy, Generate, or Apply must return the real Promise from onPanelAction and report progress through the onPanelAction reportProgress callback.",
365
365
  "The sticky footer top accent indicator is determinate when reportProgress receives 0..1 values and falls back to pending state only when progress is unavailable.",
366
366
  "defineToolcraft hoists panelActions into the controls panel sticky footer automatically.",
367
367
  "Every product must declare productReadiness.exportIntent before authoring export panelActions or settings sections.",
368
- 'Export-labeled panelActions use icon "upload-simple", matching the Setup "Export Settings" action; do not use "download", "download-simple", or "export" icons for Export PNG or Export Video.',
368
+ 'Export-labeled panelActions use icon "upload-simple", matching the Setup "Export Settings" action; do not use "download", "download-simple", or "export" icons for Export PNG, Export SVG, or Export Video.',
369
369
  'Image export is the Toolcraft product default. Keep Export PNG unless productReadiness.exportIntent.image is "user-removed" with non-empty explicit user-removal evidence.',
370
370
  'Every app with Export PNG must expose a separate "Image Export" controls section.',
371
371
  'The Image Export section must include "export.image.format" as a Select control with PNG and JPG choices, defaulting to "png".',
372
372
  'The Image Export section must include "export.image.resolution" as a Select control with 2K, 4K, and 8K choices, defaulting to "4k".',
373
373
  "Image Export format and resolution render as one compact two-column inline Select pair, matching the Video Export settings structure.",
374
374
  "Image Export resolution controls the actual exported image long edge: 2K = 2048px, 4K = 4096px, 8K = 8192px. Runtime resolves the selected value and protected browser acceptance proves decoded image width and height.",
375
+ 'Add Export SVG only when productReadiness.exportIntent.svg is "user-requested" with non-empty explicit user-request evidence.',
376
+ "Export SVG means self-contained editable vector geometry/text. Do not wrap raster bytes in image, foreignObject, or data URLs and do not silently trace raster/WebGL/model output.",
377
+ "SVG export has no settings section. Product code appends namespace-aware vector nodes through svgExportRenderer; runtime owns frame/viewBox, background, XML validation, serialization, download, progress, and typed failures.",
378
+ "Protected SVG browser proof must inspect the exact downloaded bytes with strict XML parsing, namespace/vector-only policy, native decode, content hashing, and exact product vector expectations.",
375
379
  'Add Export Video only when productReadiness.exportIntent.video is "user-requested" with non-empty explicit user-request evidence.',
376
380
  'Animation, playback, keyframes, and timeline presence never add Export Video when productReadiness.exportIntent.video is "not-requested".',
377
381
  "Any app with Export Video must enable the top Toolcraft timeline; video duration, loop, and rendered timestamps come from runtime timeline state.",
@@ -379,7 +383,7 @@ export const TOOLCRAFT_CHOICE_COMPONENT_CONTRACTS = {
379
383
  'Apps with both Export PNG and Export Video must expose both "Image Export" and "Video Export"; Image Export sits immediately before Video Export.',
380
384
  'Image-only apps place "Image Export" directly above sticky footer panelActions.',
381
385
  'Video-only apps require explicit image user-removal evidence and place "Video Export" directly above sticky footer panelActions.',
382
- 'Explicit no-export apps require image user-removal evidence with video "not-requested" and omit export actions and settings sections.',
386
+ 'Explicit no-export apps require image user-removal evidence with SVG/video "not-requested" and omit export actions and settings sections.',
383
387
  'The Video Export section must include format and resolution controls such as targets "export.video.format" and "export.video.resolution".',
384
388
  "Use Select controls for Video Export format and resolution; do not use Segmented unless the product has a deliberately tiny fixed output menu and browser tests prove every cell keeps padding.",
385
389
  'Place the Video Export section as the final controls section directly above sticky footer panelActions.',
@@ -397,6 +401,7 @@ export const TOOLCRAFT_CHOICE_COMPONENT_CONTRACTS = {
397
401
  'Product-output apps declare the standard background pair in an authored "Background" source section. Runtime removes that visible section and places Background plus Infinity canvas, then Background color, in Setup; Timeline is the final Setup control.',
398
402
  "Product-output apps call shouldIncludeToolcraftPreviewBackground(state) for bounded live preview background. Runtime artifact export owns Background semantics: PNG may be transparent, JPEG and video remain opaque, Infinity uses the full-viewport color, and Background off restores finite mode and disables Infinity.",
399
403
  "ToolcraftAppComposition.exportRenderer draws one deterministic product frame in scene coordinates for both image and video. Runtime owns canvas allocation, background, runtime media/model compositing, selected dimensions, encoding, download, progress, and typed failures.",
404
+ "ToolcraftAppComposition.svgExportRenderer appends one deterministic namespace-aware vector frame. Runtime owns SVG root/frame/background assembly, vector-only validation, strict XML serialization, download, progress, and typed failures.",
400
405
  "Product modules must not encode or download export canvases directly and must not instantiate MediaRecorder or VideoEncoder; the generated-source boundary rejects those duplicate export paths.",
401
406
  "Runtime video export keeps the selected background and uses getToolcraftVideoExportSize for current/4K output dimensions.",
402
407
  "Copy PNG can be a secondary action when clipboard output is useful, but copy does not replace export.",
@@ -19,12 +19,13 @@ export const TOOLCRAFT_INPUT_COMPONENT_CONTRACTS = {
19
19
  "AspectRatio belongs to the mandatory runtime Setup block before Canvas width and Canvas height.",
20
20
  ],
21
21
  requiredAcceptance: [
22
- "Prove presets resize the current canvas and custom dimensions report the current reduced ratio.",
22
+ "Prove presets resize the current canvas and manual dimensions select Custom, retain the reduced ratio in state, and do not render duplicate ratio dimension fields.",
23
23
  ],
24
24
  }),
25
25
  aiUsageRules: [
26
26
  "AspectRatio is runtime-owned Setup UI and is not authored as a product control.",
27
27
  "Manual canvas dimension edits switch the value to Custom without changing the other dimension.",
28
+ "Custom keeps its reduced ratio in runtime state while Canvas width and Canvas height remain the sole numeric editors.",
28
29
  ],
29
30
  },
30
31
  slider: {
@@ -17,7 +17,7 @@ describe("Toolcraft template component contracts: runtime and composition", () =
17
17
  "Every app entity introduced by the AI must have an acceptance test that proves its product responsibility.",
18
18
  );
19
19
  expect(contract.aiUsageRules).toContain(
20
- "Any supplied video, GIF, screen-recording, contact-sheet, or extracted-frame reference requires a Video Reference Study before implementation: storyboard frames, frame-to-frame transition analysis, behavior decomposition, and acceptance mapping. Do not implement video references from a single screenshot or high-level summary.",
20
+ "Every supplied video, GIF, screen-recording, contact-sheet, or extracted-frame reference must be registered as a typed referenceInputs item and preprocessed with pnpm reference:study before product code. The protected study performs a full source scan, reviews dense 12 FPS evidence, partitions reviews above 120 frames, classifies every detected event, decomposes complete contiguous phases into behaviors, and maps each behavior bidirectionally to observable acceptance and browser reference-parity coverage. A no-reference app declares referenceInputs: [] and runs no preprocessing.",
21
21
  );
22
22
  expect(contract.aiUsageRules).toContain(
23
23
  "Compound control browser tests must explicitly exercise each required value part, not only one visible sub-control.",
@@ -25,6 +25,12 @@ describe("Toolcraft template component contracts: runtime and composition", () =
25
25
  expect(contract.aiUsageRules).toContain(
26
26
  "Acceptance tests must fail when an entity is disconnected from runtime state, renderer output, export output, or command side effects.",
27
27
  );
28
+ expect(contract.aiUsageRules).toContain(
29
+ "Built-in control values enter runtime state through one canonical codec for defaults, live edits, persistence, settings import, and keyframes.",
30
+ );
31
+ expect(contract.aiUsageRules).toContain(
32
+ "Selection-scoped property controls prove two distinct entities: the selected entity changes and the comparison entity remains unchanged in both selection directions.",
33
+ );
28
34
  expect(contract.aiUsageRules).toContain(
29
35
  "Do not accept typecheck, component existence, registered commands, runtime state mutation, renderer input objects, shader uniform presence, or signature strings as final proof.",
30
36
  );
@@ -63,6 +69,14 @@ describe("Toolcraft template component contracts: runtime and composition", () =
63
69
  );
64
70
  });
65
71
 
72
+ it("requires selected-layer properties to use the shared entity-isolation recipe", () => {
73
+ const contract = getToolcraftComponentContract("layersPanel");
74
+
75
+ expect(contract.aiUsageRules).toContain(
76
+ "Every selectedLayer.* control uses the shared two-entity isolation recipe in addition to selected-layer-controls coverage.",
77
+ );
78
+ });
79
+
66
80
  it("requires workload envelopes and render-plan assessment before renderer code", () => {
67
81
  const contract = getToolcraftComponentContract("performanceAcceptance");
68
82
  const rules = contract.aiUsageRules.join("\n");
@@ -75,10 +89,10 @@ describe("Toolcraft template component contracts: runtime and composition", () =
75
89
  TOOLCRAFT_PERFORMANCE_VERIFICATION_POLICY.functionalInitialDelivery,
76
90
  );
77
91
  expect(rules).toContain(
78
- TOOLCRAFT_PERFORMANCE_VERIFICATION_POLICY.functionalTargetedDelivery,
92
+ TOOLCRAFT_PERFORMANCE_VERIFICATION_POLICY.focusedLaterEdits,
79
93
  );
80
94
  expect(rules).toContain(
81
- "Functional delivery cannot silently invoke targeted performance",
95
+ "On a proven product without new performance authority it exits before inventory, tests, build, browser work, or checkpoint writes.",
82
96
  );
83
97
  expect(rules).toContain("performance-iteration");
84
98
  expect(rules).toContain(
@@ -212,7 +226,7 @@ describe("Toolcraft template component contracts: runtime and composition", () =
212
226
  "Reference clone acceptance must include referenceCoverage rows for canvas sizing, control mapping, renderer state, and any renderer loop, spawn/update cadence, pause/resume, export/copy, or media lifecycle behavior in the reference.",
213
227
  );
214
228
  expect(contract.aiUsageRules).toContain(
215
- "Video reference assets used in a reference clone also require starterTransferMode.videoReferenceStudy with storyboard frames, frame-to-frame transition analysis, behavior decomposition, and acceptance mapping.",
229
+ "Motion reference assets used in a reference clone must use typed starterTransferMode.referenceInputs with nested studies backed by pnpm reference:study evidence; each study covers the fully scanned source through dense phases, classifies every detected event, maps behaviors through acceptanceId and motionReferenceCoverage, and requires browser reference-parity.",
216
230
  );
217
231
  });
218
232
  });
@@ -94,7 +94,7 @@ describe("Toolcraft template component contracts: runtime and composition", () =
94
94
  "The runtime Canvas width and Canvas height block uses the mandatory headerless Setup controls block; do not add a separate Canvas section label above these fields.",
95
95
  );
96
96
  expect(contract.aiUsageRules).toContain(
97
- "When the user manually edits Canvas width or Canvas height, the runtime keeps the typed dimension, keeps the other dimension unchanged, switches Aspect ratio to Custom, and shows the reduced current ratio in the custom ratio inputs.",
97
+ "When the user manually edits Canvas width or Canvas height, the runtime keeps the typed dimension, keeps the other dimension unchanged, switches Aspect ratio to Custom, stores the reduced current ratio in state, and keeps Canvas width and Canvas height as the sole custom numeric editors.",
98
98
  );
99
99
  expect(contract.aiUsageRules).toContain(
100
100
  "Aspect ratio presets are the only interaction that may resize both canvas dimensions from a preset; manual size inputs are exact output dimensions.",
@@ -39,7 +39,7 @@ export const TOOLCRAFT_RUNTIME_COMPONENT_CONTRACTS = {
39
39
  "Resolved canvas.size exists for every canvas app, but visible Canvas width and Canvas height controls are mandatory only for editable-output sizing and live in the mandatory runtime Setup section.",
40
40
  "If canvas.size is provided without an explicit sizing mode, defineToolcraft treats it as editable-output and adds Canvas width and Canvas height controls.",
41
41
  "The runtime Canvas width and Canvas height block uses the mandatory headerless Setup controls block; do not add a separate Canvas section label above these fields.",
42
- "When the user manually edits Canvas width or Canvas height, the runtime keeps the typed dimension, keeps the other dimension unchanged, switches Aspect ratio to Custom, and shows the reduced current ratio in the custom ratio inputs.",
42
+ "When the user manually edits Canvas width or Canvas height, the runtime keeps the typed dimension, keeps the other dimension unchanged, switches Aspect ratio to Custom, stores the reduced current ratio in state, and keeps Canvas width and Canvas height as the sole custom numeric editors.",
43
43
  "Aspect ratio presets are the only interaction that may resize both canvas dimensions from a preset; manual size inputs are exact output dimensions.",
44
44
  "For non-vector raster, Canvas 2D, WebGL, and WebGPU previews, set canvas.renderScale: true so the runtime adds Resolution scale after canvas sizing. The scale changes backing pixels from 1 to 2 without changing visible canvas size.",
45
45
  TOOLCRAFT_PERFORMANCE_VERIFICATION_POLICY.renderScaleFidelity,
@@ -105,7 +105,7 @@ export const TOOLCRAFT_RUNTIME_COMPONENT_CONTRACTS = {
105
105
  runtimeSetupModeRowRule,
106
106
  runtimeSetupModeHelpRule,
107
107
  "Keep sticky footer panelActions for product delivery actions only, such as Export PNG, Export Video, Copy, Generate, Apply, or Download.",
108
- "Typed Export PNG and Export Video actions are runtime-owned and consume one ToolcraftAppComposition.exportRenderer; use onPanelAction only for non-export product actions.",
108
+ "Typed Export PNG/Video actions consume ToolcraftAppComposition.exportRenderer and typed Export SVG consumes svgExportRenderer; all are runtime-owned, so use onPanelAction only for non-export product actions.",
109
109
  ],
110
110
  capabilities: ["settings-import-export"],
111
111
  commands: ["controls.setValue", "timeline.setCurrentTime", "timeline.setDuration"],
@@ -122,9 +122,11 @@ export const TOOLCRAFT_RUNTIME_COMPONENT_CONTRACTS = {
122
122
  "Compound controls must declare controlPartCoverage for every semantic value part required by their control type.",
123
123
  "Compound control browser tests must explicitly exercise each required value part, not only one visible sub-control.",
124
124
  "Acceptance tests must fail when an entity is disconnected from runtime state, renderer output, export output, or command side effects.",
125
+ "Built-in control values enter runtime state through one canonical codec for defaults, live edits, persistence, settings import, and keyframes.",
126
+ "Selection-scoped property controls prove two distinct entities: the selected entity changes and the comparison entity remains unchanged in both selection directions.",
125
127
  "Do not accept typecheck, component existence, registered commands, runtime state mutation, renderer input objects, shader uniform presence, or signature strings as final proof.",
126
128
  "Use product-level observables such as rendered pixels, exported image bytes, canvas hash, clipboard payload, cleared media preview, selected layer result, changed viewport, or timeline-rendered frame.",
127
- "Any supplied video, GIF, screen-recording, contact-sheet, or extracted-frame reference requires a Video Reference Study before implementation: storyboard frames, frame-to-frame transition analysis, behavior decomposition, and acceptance mapping. Do not implement video references from a single screenshot or high-level summary.",
129
+ "Every supplied video, GIF, screen-recording, contact-sheet, or extracted-frame reference must be registered as a typed referenceInputs item and preprocessed with pnpm reference:study before product code. The protected study performs a full source scan, reviews dense 12 FPS evidence, partitions reviews above 120 frames, classifies every detected event, decomposes complete contiguous phases into behaviors, and maps each behavior bidirectionally to observable acceptance and browser reference-parity coverage. A no-reference app declares referenceInputs: [] and runs no preprocessing.",
128
130
  "A generic canvas hash difference is not enough for workload or semantic controls; assert the intended direction of the effect.",
129
131
  "Component variants are accepted entities too; tests should fail if a non-default Toolcraft control variant falls back to the default variant or custom markup.",
130
132
  "Conditional entities require fixtures that make the condition observable.",
@@ -216,7 +218,7 @@ export const TOOLCRAFT_RUNTIME_COMPONENT_CONTRACTS = {
216
218
  "Generated reference clone apps must declare starterTransferMode.referenceTimeline with mode none, toolcraft-playback, toolcraft-keyframes, or custom-reference-timeline.",
217
219
  "Custom reference timeline behavior needs referenceTimelineCoverage entries such as state-jump, trim-range, range-playback, all-range, jump-to-trim-start, and export-range.",
218
220
  "Reference clone acceptance must include referenceCoverage rows for canvas sizing, control mapping, renderer state, and any renderer loop, spawn/update cadence, pause/resume, export/copy, or media lifecycle behavior in the reference.",
219
- "Video reference assets used in a reference clone also require starterTransferMode.videoReferenceStudy with storyboard frames, frame-to-frame transition analysis, behavior decomposition, and acceptance mapping.",
221
+ "Motion reference assets used in a reference clone must use typed starterTransferMode.referenceInputs with nested studies backed by pnpm reference:study evidence; each study covers the fully scanned source through dense phases, classifies every detected event, maps behaviors through acceptanceId and motionReferenceCoverage, and requires browser reference-parity.",
220
222
  "Browser tests must compare reference behavior or a reference-derived baseline, not only Toolcraft state mutation.",
221
223
  ],
222
224
  capabilities: [
@@ -292,6 +294,7 @@ export const TOOLCRAFT_RUNTIME_COMPONENT_CONTRACTS = {
292
294
  "Do not use selectedLayer.* targets when panels.layers is disabled; single-layer apps use app-specific targets.",
293
295
  "Layer-enabled apps need layerCoverage acceptance for selection, visibility, reorder, and grouping.",
294
296
  "Every selectedLayer.* control needs selected-layer-controls acceptance proving it edits the currently selected layer output.",
297
+ "Every selectedLayer.* control uses the shared two-entity isolation recipe in addition to selected-layer-controls coverage.",
295
298
  "Layer browser coverage must use real LayersPanel rows and buttons, not direct layers.* command dispatch.",
296
299
  "Layer-enabled custom renderers need layers.interactions coverage around real selection, visibility, reorder or grouping, and selected-layer output checks.",
297
300
  ],
@@ -3,6 +3,14 @@ import { describe, expect, it } from "vitest";
3
3
  import { getToolcraftComponentContract } from "./component-contracts";
4
4
 
5
5
  describe("Toolcraft template component contracts: visual controls", () => {
6
+ it("keeps Color UI payloads behind the canonical string value model", () => {
7
+ const contract = getToolcraftComponentContract("color");
8
+
9
+ expect(contract.aiUsageRules).toContain(
10
+ "Color product state is a canonical hex string even though the UI callback payload is { hex }.",
11
+ );
12
+ });
13
+
6
14
  it("marks standalone controls as component-labeled standalone controls", () => {
7
15
  for (const id of [
8
16
  "palette",
@@ -70,6 +78,9 @@ describe("Toolcraft template component contracts: visual controls", () => {
70
78
  expect(contract.aiUsageRules).toContain(
71
79
  "Vector pad value labels render compact rounded coordinates. Do not expose raw floating-point strings such as -0.07070312499999998 in the controls panel.",
72
80
  );
81
+ expect(contract.aiUsageRules).toContain(
82
+ "Vector product state always stores finite numeric x and y values; decimal strings exist only at the visual input boundary and canonicalize before state or keyframes.",
83
+ );
73
84
  expect(contract.aiUsageRules).toContain(
74
85
  "Double-clicking a vector pad resets both axes to the control default through the normal runtime value update, matching section header reset semantics; if no default is defined, the fallback is 0,0. Do not add a separate custom reset UI for this basic pad reset behavior.",
75
86
  );
@@ -197,6 +208,9 @@ describe("Toolcraft template component contracts: visual controls", () => {
197
208
  expect(color.aiUsageRules).toContain(
198
209
  "Make color label visibility a group-level decision: do not mix labeled and unlabeled items inside one semantic color bank.",
199
210
  );
211
+ expect(color.aiUsageRules).toContain(
212
+ "In a mixed section with multiple plain Color controls, declare semanticGroup on every plain Color; runtime pairs only adjacent colors in the same semantic group. A color-only section is one implicit bank.",
213
+ );
200
214
  expect(color.aiUsageRules).toContain(
201
215
  "Keep visible labels when colors edit distinct user-facing entities or roles, such as Fill, Stroke, Background, Connector, Object, or Highlight.",
202
216
  );
@@ -348,6 +362,12 @@ describe("Toolcraft template component contracts: visual controls", () => {
348
362
  expect(contract.aiUsageRules).toContain(
349
363
  "Render multiple related color fields in one section with at most two colors per row.",
350
364
  );
365
+ expect(contract.decisionCatalog?.layoutConstraints).toContain(
366
+ "In a mixed section with multiple plain Color controls, declare semanticGroup on every plain Color; runtime pairs only adjacent colors in the same semantic group. A color-only section is one implicit bank.",
367
+ );
368
+ expect(contract.aiUsageRules).toContain(
369
+ "In a mixed section with multiple plain Color controls, declare semanticGroup on every plain Color; runtime pairs only adjacent colors in the same semantic group. A color-only section is one implicit bank.",
370
+ );
351
371
  expect(contract.aiUsageRules).toContain(
352
372
  "If a multi-color bank has an odd trailing plain Color, keep that last Color at half width; only ColorOpacity or intentionally full-width compound controls occupy a full row.",
353
373
  );
@@ -127,6 +127,7 @@ export const TOOLCRAFT_VISUAL_COMPONENT_CONTRACTS = {
127
127
  "Use the default vector variant for spatial values such as position, offset, direction, focus, anchor, and light direction.",
128
128
  'Default spatial vector pads use coordinateMode: "screen": dragging left/up makes vector.x and vector.y smaller so canvas objects move left/up without renderer-side Y inversion.',
129
129
  "Vector pad value labels render compact rounded coordinates. Do not expose raw floating-point strings such as -0.07070312499999998 in the controls panel.",
130
+ "Vector product state always stores finite numeric x and y values; decimal strings exist only at the visual input boundary and canonicalize before state or keyframes.",
130
131
  "Double-clicking a vector pad resets both axes to the control default through the normal runtime value update, matching section header reset semantics; if no default is defined, the fallback is 0,0. Do not add a separate custom reset UI for this basic pad reset behavior.",
131
132
  "Holding Shift while dragging a vector pad locks movement to the dominant axis and must not select text or page content; do not build a custom pad just to support axis-constrained movement.",
132
133
  'Use coordinateMode: "cartesian" only when the product intentionally exposes mathematical Y-up coordinates instead of canvas/screen movement.',
@@ -206,6 +207,7 @@ export const TOOLCRAFT_VISUAL_COMPONENT_CONTRACTS = {
206
207
  ],
207
208
  layoutConstraints: [
208
209
  "Plain Color controls may render two per row only when no opacity is present.",
210
+ "In a mixed section with multiple plain Color controls, declare semanticGroup on every plain Color; runtime pairs only adjacent colors in the same semantic group. A color-only section is one implicit bank.",
209
211
  "Odd trailing plain Color controls in a multi-color bank keep the same half-width footprint as paired colors.",
210
212
  "Color label visibility depends on user usefulness: palette variation banks omit per-item labels; distinct color roles keep labels.",
211
213
  ],
@@ -229,10 +231,12 @@ export const TOOLCRAFT_VISUAL_COMPONENT_CONTRACTS = {
229
231
  "When one short numeric/text field and one Color field configure the same entity, keep them in one two-column inline layout group.",
230
232
  "Mixed inline rows usually require visible labels on both controls. Toggle-plus-parameter rows are the section-owned exception: keep the Switch/Checkbox label visible and set the non-toggle parameter label to false; if the parameter label is needed, stack the controls instead. All 50/50 inline rows use the same horizontal column gap as paired Select controls. Palette variation color banks are the other exception when the group/section label already names the color bank.",
231
233
  "Plain Color popovers must not show opacity controls. If opacity is editable, use ColorOpacity instead.",
234
+ "Color product state is a canonical hex string even though the UI callback payload is { hex }.",
232
235
  "Product-output apps always expose renderer-owned output background color as a schema color target such as appearance.background or scene.background.",
233
236
  'Declare renderer-owned output background color with export.includeBackground in one authored Background source section. Runtime normalizes them into Setup: a Switch labeled "Background" sits left of Infinity canvas in an equal-width row, Background color renders below, and Timeline remains the final Setup control.',
234
237
  "Preview, PNG export, video export, and the infinite runtime viewport must read the runtime background color value instead of hardcoding that background in CSS, Canvas fillStyle, or WebGL clearColor. Product renderers suppress their bounded background in Infinity mode while CanvasShell fills the complete viewport; export.includeBackground controls live preview product background and PNG alpha, and disabling it restores finite mode instead of leaving a transparent infinite workspace.",
235
238
  "Render multiple related color fields in one section with at most two colors per row.",
239
+ "In a mixed section with multiple plain Color controls, declare semanticGroup on every plain Color; runtime pairs only adjacent colors in the same semantic group. A color-only section is one implicit bank.",
236
240
  "If a multi-color bank has an odd trailing plain Color, keep that last Color at half width; only ColorOpacity or intentionally full-width compound controls occupy a full row.",
237
241
  ],
238
242
  },
@@ -85,6 +85,9 @@ describe("Toolcraft template decision contract", () => {
85
85
  expect(getToolcraftDecisionRule("layers-enabled-behavior")?.level).toBe(
86
86
  "invariant",
87
87
  );
88
+ expect(
89
+ getToolcraftDecisionRule("layers-enabled-behavior")?.desiredBehavior,
90
+ ).toMatch(/selectedLayer\.\*[^.]*two-entity isolation/i);
88
91
  expect(getToolcraftDecisionRule("timeline-mode-choice")?.level).toBe("heuristic");
89
92
  expect(getToolcraftDecisionRule("timeline-mode-choice")?.desiredBehavior).toMatch(
90
93
  /Animation Intent Inventory/,
@@ -125,13 +128,15 @@ describe("Toolcraft template decision contract", () => {
125
128
  expect(rule?.desiredBehavior).toMatch(/productReadiness\.exportIntent/);
126
129
  expect(rule?.desiredBehavior).toMatch(/image[^.]*Toolcraft default/i);
127
130
  expect(rule?.desiredBehavior).toMatch(/video[^.]*explicit user request[^.]*evidence/i);
131
+ expect(rule?.desiredBehavior).toMatch(/SVG[^.]*explicit user request[^.]*evidence/i);
128
132
  expect(rule?.desiredBehavior).toMatch(
129
133
  /animation, playback, keyframes, or timeline[^.]*never/i,
130
134
  );
131
135
  expect(rule?.desiredBehavior).toMatch(/image[^.]*removed[^.]*explicit user[^.]*evidence/i);
132
136
  expect(rule?.desiredBehavior).toMatch(
133
- /intent[^.]*correspond exactly[^.]*schema actions, settings sections, and acceptance coverage/i,
137
+ /intent[^.]*correspond exactly[^.]*typed schema actions, applicable settings sections, and artifact-specific acceptance coverage/i,
134
138
  );
139
+ expect(rule?.desiredBehavior).toMatch(/SVG[^.]*editable vector[^.]*never permits raster/i);
135
140
  });
136
141
 
137
142
  it("makes renderer technology a default with escape hatches", () => {
@@ -201,11 +206,12 @@ describe("Toolcraft template decision contract", () => {
201
206
  expect(rule?.level).toBe("invariant");
202
207
  expect(rule?.area).toBe("reference-analysis");
203
208
  expect(rule?.desiredBehavior).toMatch(/video, GIF, screen recording/i);
204
- expect(rule?.desiredBehavior).toMatch(/storyboard/i);
205
- expect(rule?.desiredBehavior).toMatch(/timecoded frame observations/i);
206
- expect(rule?.desiredBehavior).toMatch(/frame-to-frame transitions/i);
207
- expect(rule?.desiredBehavior).toMatch(/map those observed behaviors to acceptance rows/i);
208
- expect(rule?.desiredBehavior).toMatch(/independent from loop duration or timeline choice/i);
209
+ expect(rule?.desiredBehavior).toMatch(/typed referenceInputs/i);
210
+ expect(rule?.desiredBehavior).toMatch(/full source scan/i);
211
+ expect(rule?.desiredBehavior).toMatch(/dense 12 FPS review/i);
212
+ expect(rule?.desiredBehavior).toMatch(/classifies every detected event/i);
213
+ expect(rule?.desiredBehavior).toMatch(/complete contiguous phases/i);
214
+ expect(rule?.desiredBehavior).toMatch(/browser reference-parity/i);
209
215
  expect(rule?.enforcement).toContain("acceptance-validator");
210
216
  expect(rule?.enforcement).toContain("starter-agents");
211
217
  });
@@ -225,7 +231,7 @@ describe("Toolcraft template decision contract", () => {
225
231
  /functional delivery plan with basis "initial"[\s\S]*complete functional proof[\s\S]*no measured performance/i,
226
232
  );
227
233
  expect(rule?.desiredBehavior).toMatch(
228
- /functional delivery plan with basis "changed"[\s\S]*exact affected ownership-derived functional proof[\s\S]*no measured performance/i,
234
+ /proven product has no later functional delivery plan[\s\S]*feature-focused tests or browser inspection/i,
229
235
  );
230
236
  expect(rule?.desiredBehavior).toMatch(/development fixture/i);
231
237
  expect(rule?.desiredBehavior).toMatch(
@@ -235,13 +241,13 @@ describe("Toolcraft template decision contract", () => {
235
241
  /cannot claim targeted or full performance evidence/i,
236
242
  );
237
243
  expect(rule?.desiredBehavior).toMatch(/verify:delivery/);
238
- expect(rule?.desiredBehavior).toMatch(/coherent user-visible delivery batch/i);
244
+ expect(rule?.desiredBehavior).toMatch(/first product version/i);
239
245
  expect(rule?.desiredBehavior).toMatch(
240
- /tier, filename, subsystem, complaint repetition, and command selectors cannot authorize proof/i,
246
+ /changed files, verification tier, ownership classification, affected pass or path ids, and touched subsystems never authorize measured performance/i,
241
247
  );
242
248
  expect(rule?.desiredBehavior).toMatch(/ordinary-product-work/i);
243
249
  expect(rule?.desiredBehavior).toMatch(
244
- /cannot silently invoke targeted performance, the full performance matrix/i,
250
+ /complete performance matrix remains outside conversational delivery/i,
245
251
  );
246
252
  expect(rule?.desiredBehavior).toMatch(/performance-iteration/i);
247
253
  expect(rule?.desiredBehavior).toMatch(/bounded targeted iteration/i);
@@ -273,9 +279,9 @@ describe("Toolcraft template decision contract", () => {
273
279
  /explicit natural-language request for the complete audit/i,
274
280
  );
275
281
  expect(rule?.desiredBehavior).toMatch(/user does not need to know the command name/i);
276
- expect(rule?.desiredBehavior).toMatch(/targeted functional\/browser evidence/i);
282
+ expect(rule?.desiredBehavior).toMatch(/focused evidence for the functionality being edited/i);
277
283
  expect(rule?.desiredBehavior).toMatch(
278
- /those changes never authorize measured performance/i,
284
+ /those changes never authorize an aggregate functional gate or measured performance/i,
279
285
  );
280
286
  expect(rule?.desiredBehavior).toMatch(
281
287
  /renderScaleCoverage "selected-backing-pixels" for interaction and steady, plus playback when timeline is enabled/i,
@@ -58,7 +58,7 @@ export const TOOLCRAFT_DECISION_CONTRACT = [
58
58
  area: "runtime-shell",
59
59
  currentConstraint: "Apps must assemble through defineToolcraft and ToolcraftApp.",
60
60
  desiredBehavior:
61
- "Generated apps use the Toolcraft runtime shell and keep product-specific rendering inside supported extension points: schema controls, bounded canvasContent product output, editor-only full-viewport infiniteCanvasContent product output, controlRenderers for true custom controls, one shared ToolcraftAppComposition.exportRenderer for typed image/video actions, ToolcraftApp onPanelAction for non-export product actions, and runtime commands. App-specific code must not import or render low-level runtime surfaces or built-in control components directly, instantiate encoders, or own artifact download mechanics.",
61
+ "Generated apps use the Toolcraft runtime shell and keep product-specific rendering inside supported extension points: schema controls, bounded canvasContent product output, editor-only full-viewport infiniteCanvasContent product output, controlRenderers for true custom controls, ToolcraftAppComposition.exportRenderer for typed image/video actions, svgExportRenderer for typed SVG, ToolcraftApp onPanelAction for non-export product actions, and runtime commands. App-specific code must not import or render low-level runtime surfaces or built-in control components directly, serialize artifacts, instantiate encoders, or own artifact download mechanics.",
62
62
  enforcement: [
63
63
  "cli-integrity-check",
64
64
  "acceptance-validator",
@@ -169,7 +169,7 @@ export const TOOLCRAFT_DECISION_CONTRACT = [
169
169
  currentConstraint:
170
170
  "Once layers are enabled, selection, visibility, reorder, grouping, media lifecycle, and selected-layer controls must work through the real LayersPanel UI.",
171
171
  desiredBehavior:
172
- "Layer-enabled apps prove real layer interactions and product output changes instead of dispatching layer commands directly in browser tests.",
172
+ "Layer-enabled apps prove real layer interactions and product output changes instead of dispatching layer commands directly in browser tests. Every selectedLayer.* property uses the same protected two-entity isolation recipe as app-owned selected-entity properties: editing either selected entity changes only that entity while preserving the comparison entity.",
173
173
  enforcement: ["acceptance-validator", "browser-helper", "performance-validator"],
174
174
  id: "layers-enabled-behavior",
175
175
  level: "invariant",
@@ -217,7 +217,7 @@ export const TOOLCRAFT_DECISION_CONTRACT = [
217
217
  currentConstraint:
218
218
  "Product artifact delivery must match the required productReadiness.exportIntent declaration.",
219
219
  desiredBehavior:
220
- 'Every product declares productReadiness.exportIntent. Image export starts as the Toolcraft default and is removed only with explicit user-removal evidence; video export requires explicit user request evidence. Animation, playback, keyframes, or timeline presence never changes artifact delivery intent. Resolved intent capabilities correspond exactly to schema actions, settings sections, and acceptance coverage: image-only, image-plus-video, video-only, and explicit no-export products expose only the runtime-owned artifact surfaces their intent enables. Product apps declare the standard background pair and runtime places it in Setup: Background beside Infinity canvas, Color below, and Timeline last. One shared product exportRenderer draws deterministic scene-coordinate frames for enabled artifact types; runtime owns settings, scene crop, PNG/JPEG/video background semantics, visible runtime media/model composition, exact timestamped encoding, download, progress, and typed failures.',
220
+ 'Every product declares productReadiness.exportIntent. Image export starts as the Toolcraft default and is removed only with explicit user-removal evidence; SVG and video require explicit user request evidence. Animation, playback, keyframes, or timeline presence never changes artifact delivery intent. Resolved intent capabilities correspond exactly to typed schema actions, applicable settings sections, and artifact-specific acceptance coverage. SVG means self-contained editable vector geometry/text and never permits raster bytes wrapped in SVG. Product apps declare the standard background pair and runtime places it in Setup: Background beside Infinity canvas, Color below, and Timeline last. Product code uses exportRenderer for deterministic image/video pixels and svgExportRenderer for namespace-aware vector nodes; runtime owns settings, scene crop/frame, background, visible runtime media/model composition, validation, encoding/serialization, download, progress, and typed failures.',
221
221
  enforcement: ["acceptance-validator", "performance-validator", "browser-helper", "starter-agents"],
222
222
  id: "output-export-required",
223
223
  level: "invariant",
@@ -326,7 +326,7 @@ export const TOOLCRAFT_DECISION_CONTRACT = [
326
326
  currentConstraint:
327
327
  "Video, GIF, and screen-recording references are often treated as static visual inspiration or summarized from a few frames.",
328
328
  desiredBehavior:
329
- "Whenever a supplied reference is a video, GIF, screen recording, contact sheet, or extracted frame sequence, the agent studies it as behavioral evidence before implementation: extract or inspect a storyboard, record timecoded frame observations, compare frame-to-frame transitions, decompose changing entities and state into product behavior, and map those observed behaviors to acceptance rows. This applies to new Toolcraft apps and reference-runtime-clone work; it is independent from loop duration or timeline choice.",
329
+ "Whenever a supplied reference is a video, GIF, screen recording, contact sheet, or extracted frame sequence, the agent registers a typed referenceInputs item before implementation. Protected preprocessing performs one full source scan, produces a dense 12 FPS review with bounded partitions, and stores content-addressed evidence. The agent covers complete contiguous phases, classifies every detected event, decomposes product behaviors, and maps each behavior bidirectionally to observable acceptance rows plus browser reference-parity coverage. A no-reference product declares referenceInputs: [] and runs no preprocessing.",
330
330
  enforcement: ["acceptance-validator", "browser-helper", "docs", "starter-agents"],
331
331
  id: "video-reference-analysis",
332
332
  level: "invariant",
@@ -29,29 +29,29 @@ describe("Toolcraft canonical performance verification policy", () => {
29
29
  complaintRouting:
30
30
  "Performance authority and path localization are separate decisions. Classifier output establishes complaint authority only and never path localization. A localized complaint lets the agent select canonical affected paths and run one targeted iteration without asking the user. An ambiguous or unresolved localization requires one user-facing clarification naming visible operations and offering targeted diagnosis or a complete review; never ask the user for internal path ids. Regardless of whether the classifier returned high-confidence performance-iteration or needs-agent-judgment, unresolved localization creates neither performance-iteration intent nor canonical path authority. A broad or honestly unlocalizable problem may justify recommending the complete review immediately, but only the user's explicit request or acceptance authorizes it. A direct request for a complete review runs the full audit without another clarification.",
31
31
  deliveryBatch:
32
- "Classify and verify one coherent user-visible delivery batch instead of treating each internal implementation pass or steering correction as a separate aggregate verification boundary.",
32
+ "Run complete protected functional proof once for the first product version. Later ordinary edits are focused development work and never create another aggregate delivery boundary.",
33
33
  deliveryCommand:
34
- "Use the protected pnpm verify:delivery command once at the delivery boundary; it derives selectors automatically. Tier, filename, subsystem, complaint repetition, and command selectors cannot authorize proof.",
34
+ "Use pnpm verify:delivery for the first complete product proof or one exact request-authorized performance iteration. On a proven product without new performance authority it exits before inventory, tests, build, browser work, or checkpoint writes.",
35
35
  demandOnlyPerformance:
36
36
  "Only exact request authority can create a performance-iteration plan and run measured targeted performance. Changed files, verification tier, ownership classification, affected pass or path ids, and touched subsystems never authorize measured performance.",
37
37
  functionalChangeEvidence:
38
- "Renderer, canvas, animation, export, timeline, layers, canvas.renderScale, bug fixes, and performance-sensitive control changes require targeted functional/browser evidence. Those changes never authorize measured performance.",
38
+ "After first delivery, renderer, canvas, animation, export, timeline, layers, canvas.renderScale, bug fixes, and control changes use only focused evidence for the functionality being edited. Those changes never authorize an aggregate functional gate or measured performance.",
39
39
  fullAuditDiscovery:
40
40
  "The complete performance matrix remains outside conversational delivery. Complaints, repetition, tier, filename, and touched subsystem never launch it automatically. After two consecutive compatible protected performance iterations, the agent must offer a slower complete audit if the user remains unsatisfied; a demonstrably broad or unlocalizable cross-system problem may justify the same offer earlier. An explicit natural-language request for the complete audit, or explicit acceptance of the agent's offer, authorizes the agent acting as operator to run pnpm verify:perf; the user does not need to know the command name. After the audit, repair and rerun failed paths with focused checks, then run the complete matrix only once at the requested certification boundary.",
41
41
  performanceIterationDelivery:
42
42
  "The runtime request classifier is a tri-state guard, not a replacement for AI semantic judgment: high-confidence runtime complaints, responsiveness optimization, or excessive CPU, GPU, memory, or resource use classify as performance-iteration; high-confidence product motion, speed, freeze, terminology, or locally negated complaint commands classify as ordinary-product-work; ambiguous or unrecognized wording classifies as needs-agent-judgment and the AI decides from the actual user request. Ordinary work is rejected only for a high-confidence performance iteration. Every performance-iteration worklog intent quotes a nontrivial exact raw substring of Request; whitespace and Unicode code units must match before normalized tri-state classification. Invented, whitespace-collapsed, NFKC-equivalent, or mismatched evidence is rejected; high-confidence ordinary evidence is rejected; exact high-confidence performance-iteration evidence, or needs-agent-judgment evidence after semantic resolution, is accepted under agent ownership. Classifier output establishes complaint authority only and never path localization. Each performance iteration requires an exact reachable development fixture and fails with a configuration error instead of falling back to maximum. Only a localized complaint or a post-clarification targeted choice creates performance-iteration intent and one bounded iteration over exact canonical affected paths. Regardless of whether the classifier returned high-confidence performance-iteration or needs-agent-judgment, unresolved localization creates neither performance-iteration intent nor canonical path authority. Each repeated localized request may create one new bounded targeted iteration over its affected paths; repetition alone never expands scope or selects the complete performance matrix, creates or refreshes a durable baseline, or grants full-performance certification authority.",
43
43
  functionalInitialDelivery:
44
44
  'A functional delivery plan with basis "initial" runs complete functional proof and no measured performance. It preserves any independent full-performance baseline and cannot claim targeted or full performance evidence.',
45
- functionalTargetedDelivery:
46
- 'A functional delivery plan with basis "changed" runs exact affected ownership-derived functional proof and no measured performance. Functional delivery cannot silently invoke targeted performance, the full performance matrix, or create or refresh a performance baseline.',
45
+ focusedLaterEdits:
46
+ "A proven product has no later functional delivery plan. Ordinary edits run only feature-focused tests or browser inspection chosen from the edited behavior; commit, push, deploy, and preview do not authorize aggregate proof.",
47
47
  renderScaleFidelity:
48
48
  'canvas.renderScale is visible functional fidelity. Raster products declare typed renderScaleCoverage "selected-backing-pixels" for interaction and steady, plus playback when timeline is enabled, and prove real canvas backing pixels in every declared state. Every measured path in a render-scale-enabled raster product proves actual CSS × devicePixelRatio × 2 backing after each measured phase. Never downsample, stretch a lower-resolution backing canvas, blur output, or clamp the selected render scale to pass a performance budget.',
49
49
  });
50
50
  expect(TOOLCRAFT_PERFORMANCE_VERIFICATION_LIFECYCLE).toEqual({
51
51
  delivery: {
52
52
  command: "verify:delivery",
53
- modes: ["functional", "performance-iteration"],
54
- selectors: "automatic",
53
+ modes: ["initial-functional", "performance-iteration"],
54
+ selectors: "initial-complete-or-authority-exact",
55
55
  },
56
56
  fullPerformance: {
57
57
  command: "verify:perf",
@@ -59,25 +59,25 @@ describe("Toolcraft canonical performance verification policy", () => {
59
59
  },
60
60
  });
61
61
  expect(TOOLCRAFT_PERFORMANCE_VERIFICATION_POLICY_TEXT).toMatch(
62
- /one coherent user-visible delivery batch/i,
62
+ /complete protected functional proof once for the first product version/i,
63
63
  );
64
64
  expect(TOOLCRAFT_PERFORMANCE_VERIFICATION_POLICY_TEXT).toMatch(
65
65
  /verify:delivery/i,
66
66
  );
67
67
  expect(TOOLCRAFT_PERFORMANCE_VERIFICATION_POLICY_TEXT).toMatch(
68
- /tier, filename, subsystem, complaint repetition, and command selectors cannot authorize proof/i,
68
+ /proven product without new performance authority it exits before inventory, tests, build, browser work, or checkpoint writes/i,
69
69
  );
70
70
  expect(TOOLCRAFT_PERFORMANCE_VERIFICATION_POLICY_TEXT).toMatch(
71
71
  /functional delivery plan with basis "initial"[\s\S]*complete functional proof[\s\S]*no measured performance/i,
72
72
  );
73
73
  expect(TOOLCRAFT_PERFORMANCE_VERIFICATION_POLICY_TEXT).toMatch(
74
- /functional delivery cannot silently invoke targeted performance/i,
74
+ /proven product has no later functional delivery plan/i,
75
75
  );
76
76
  expect(TOOLCRAFT_PERFORMANCE_VERIFICATION_POLICY_TEXT).toMatch(
77
77
  /only exact request authority can create a performance-iteration plan and run measured targeted performance/i,
78
78
  );
79
79
  expect(TOOLCRAFT_PERFORMANCE_VERIFICATION_POLICY_TEXT).toMatch(
80
- /functional delivery plan with basis "changed"[\s\S]*exact affected ownership-derived functional proof[\s\S]*no measured performance/i,
80
+ /ordinary edits run only feature-focused tests or browser inspection[\s\S]*commit, push, deploy, and preview do not authorize aggregate proof/i,
81
81
  );
82
82
  expect(TOOLCRAFT_PERFORMANCE_VERIFICATION_POLICY_TEXT).toMatch(
83
83
  /tri-state guard, not a replacement for AI semantic judgment/i,
@@ -137,7 +137,7 @@ describe("Toolcraft canonical performance verification policy", () => {
137
137
  /run the complete matrix only once at the requested certification boundary/i,
138
138
  );
139
139
  expect(TOOLCRAFT_PERFORMANCE_VERIFICATION_POLICY_TEXT).toMatch(
140
- /renderer, canvas,[\s\S]*canvas\.renderScale[\s\S]*require targeted functional\/browser evidence[\s\S]*never authorize measured performance/i,
140
+ /after first delivery, renderer, canvas,[\s\S]*canvas\.renderScale[\s\S]*focused evidence[\s\S]*never authorize an aggregate functional gate or measured performance/i,
141
141
  );
142
142
  expect(TOOLCRAFT_PERFORMANCE_VERIFICATION_POLICY_TEXT).toMatch(
143
143
  /typed renderScaleCoverage "selected-backing-pixels" for interaction and steady, plus playback when timeline is enabled/i,