openplanr 3.4.0 → 3.5.0

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 (336) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/cli/commands/design.d.ts +3 -0
  3. package/dist/cli/commands/design.d.ts.map +1 -0
  4. package/dist/cli/commands/design.js +137 -0
  5. package/dist/cli/commands/design.js.map +1 -0
  6. package/dist/cli/commands/groups/operations.d.ts.map +1 -1
  7. package/dist/cli/commands/groups/operations.js +2 -0
  8. package/dist/cli/commands/groups/operations.js.map +1 -1
  9. package/dist/dashboard/.vite/manifest.json +1 -1
  10. package/dist/dashboard/assets/{index-CvQAlBy3.js → index-B-l_941W.js} +2 -2
  11. package/dist/dashboard/assets/{index-CvQAlBy3.js.map → index-B-l_941W.js.map} +1 -1
  12. package/dist/dashboard/dashboard-manifest.json +13 -13
  13. package/dist/dashboard/index.html +1 -1
  14. package/dist/services/design-artifact-service.d.ts +22 -0
  15. package/dist/services/design-artifact-service.d.ts.map +1 -1
  16. package/dist/services/design-artifact-service.js +76 -16
  17. package/dist/services/design-artifact-service.js.map +1 -1
  18. package/dist/services/runtime-manager/runtime-package.js +1 -1
  19. package/dist/services/runtime-manager/runtime-package.js.map +1 -1
  20. package/docs/CLI.md +29 -0
  21. package/lib/host-packages/adapter-registry.json +5 -5
  22. package/lib/host-packages/capability-map.json +1 -1
  23. package/lib/host-packages/claude/.claude-plugin/marketplace.json +2 -2
  24. package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +1 -1
  25. package/lib/host-packages/claude/openplanr/.openplanr-content.json +24 -340
  26. package/lib/host-packages/claude/openplanr/README.md +8 -8
  27. package/lib/host-packages/claude/openplanr/skills/artifact/references/design-sharing.md +2 -2
  28. package/lib/host-packages/claude/openplanr/skills/design/SKILL.md +23 -12
  29. package/lib/host-packages/claude/openplanr/skills/design/references/design-system.md +2 -2
  30. package/lib/host-packages/claude/openplanr/skills/design/references/generation.md +3 -3
  31. package/lib/host-packages/claude/openplanr/skills/design/references/hosted-canvas.md +6 -3
  32. package/lib/host-packages/claude/openplanr/skills/design/references/review.md +6 -6
  33. package/lib/host-packages/claude/openplanr/skills/design/references/team-review.md +3 -4
  34. package/lib/host-packages/claude/openplanr/skills/design/references/utilities.md +78 -38
  35. package/lib/host-packages/claude/openplanr/skills/design-loop/SKILL.md +15 -7
  36. package/lib/host-packages/claude/openplanr/skills/design-loop/references/design-system.md +2 -2
  37. package/lib/host-packages/claude/openplanr/skills/design-loop/references/generation.md +3 -3
  38. package/lib/host-packages/claude/openplanr/skills/design-loop/references/review.md +6 -6
  39. package/lib/host-packages/claude/openplanr/skills/design-loop/references/team-review.md +3 -4
  40. package/lib/host-packages/claude/openplanr/skills/design-loop/references/utilities.md +78 -38
  41. package/lib/host-packages/claude/openplanr/skills/design-review/SKILL.md +25 -5
  42. package/lib/host-packages/claude/openplanr/skills/design-review/references/design-system.md +2 -2
  43. package/lib/host-packages/claude/openplanr/skills/design-review/references/generation.md +3 -3
  44. package/lib/host-packages/claude/openplanr/skills/design-review/references/review.md +6 -6
  45. package/lib/host-packages/claude/openplanr/skills/design-review/references/team-review.md +3 -4
  46. package/lib/host-packages/claude/openplanr/skills/design-review/references/utilities.md +78 -38
  47. package/lib/host-packages/claude/openplanr/skills/plan/SKILL.md +7 -3
  48. package/lib/host-packages/cursor/openplanr/.openplanr-content.json +23 -339
  49. package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
  50. package/lib/host-packages/cursor/openplanr/rules/planr-artifact/references/design-sharing.md +2 -2
  51. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/design-system.md +2 -2
  52. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/generation.md +3 -3
  53. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/hosted-canvas.md +6 -3
  54. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/review.md +6 -6
  55. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/team-review.md +3 -4
  56. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/utilities.md +78 -38
  57. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/design-system.md +2 -2
  58. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/generation.md +3 -3
  59. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/review.md +6 -6
  60. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/team-review.md +3 -4
  61. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/utilities.md +78 -38
  62. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop.mdc +15 -7
  63. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/design-system.md +2 -2
  64. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/generation.md +3 -3
  65. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/review.md +6 -6
  66. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/team-review.md +3 -4
  67. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/utilities.md +78 -38
  68. package/lib/host-packages/cursor/openplanr/rules/planr-design-review.mdc +25 -5
  69. package/lib/host-packages/cursor/openplanr/rules/planr-design.mdc +23 -12
  70. package/lib/host-packages/cursor/openplanr/rules/planr-plan.mdc +7 -3
  71. package/lib/host-packages/openai/.claude-plugin/marketplace.json +2 -2
  72. package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +1 -1
  73. package/lib/host-packages/openai/openplanr/.openplanr-content.json +27 -343
  74. package/lib/host-packages/openai/openplanr/skills/artifact/references/design-sharing.md +2 -2
  75. package/lib/host-packages/openai/openplanr/skills/design/SKILL.md +23 -12
  76. package/lib/host-packages/openai/openplanr/skills/design/openplanr.skill.json +0 -11
  77. package/lib/host-packages/openai/openplanr/skills/design/references/design-system.md +2 -2
  78. package/lib/host-packages/openai/openplanr/skills/design/references/generation.md +3 -3
  79. package/lib/host-packages/openai/openplanr/skills/design/references/hosted-canvas.md +6 -3
  80. package/lib/host-packages/openai/openplanr/skills/design/references/review.md +6 -6
  81. package/lib/host-packages/openai/openplanr/skills/design/references/team-review.md +3 -4
  82. package/lib/host-packages/openai/openplanr/skills/design/references/utilities.md +78 -38
  83. package/lib/host-packages/openai/openplanr/skills/design-loop/SKILL.md +15 -7
  84. package/lib/host-packages/openai/openplanr/skills/design-loop/openplanr.skill.json +0 -11
  85. package/lib/host-packages/openai/openplanr/skills/design-loop/references/design-system.md +2 -2
  86. package/lib/host-packages/openai/openplanr/skills/design-loop/references/generation.md +3 -3
  87. package/lib/host-packages/openai/openplanr/skills/design-loop/references/review.md +6 -6
  88. package/lib/host-packages/openai/openplanr/skills/design-loop/references/team-review.md +3 -4
  89. package/lib/host-packages/openai/openplanr/skills/design-loop/references/utilities.md +78 -38
  90. package/lib/host-packages/openai/openplanr/skills/design-review/SKILL.md +25 -5
  91. package/lib/host-packages/openai/openplanr/skills/design-review/openplanr.skill.json +0 -11
  92. package/lib/host-packages/openai/openplanr/skills/design-review/references/design-system.md +2 -2
  93. package/lib/host-packages/openai/openplanr/skills/design-review/references/generation.md +3 -3
  94. package/lib/host-packages/openai/openplanr/skills/design-review/references/review.md +6 -6
  95. package/lib/host-packages/openai/openplanr/skills/design-review/references/team-review.md +3 -4
  96. package/lib/host-packages/openai/openplanr/skills/design-review/references/utilities.md +78 -38
  97. package/lib/host-packages/openai/openplanr/skills/plan/SKILL.md +7 -3
  98. package/lib/host-packages/openai/openplanr/skills/plan/openplanr.skill.json +0 -11
  99. package/package.json +2 -2
  100. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1772
  101. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
  102. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
  103. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-handoff.mjs +0 -2370
  104. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
  105. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
  106. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
  107. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review-state-store.mjs +0 -45
  108. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review.mjs +0 -3376
  109. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -38
  110. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
  111. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +0 -321
  112. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs +0 -1652
  113. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-9f6918b0.mjs +0 -1037
  114. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +0 -137
  115. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design.mjs +0 -1500
  116. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2023
  117. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
  118. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
  119. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -814
  120. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -10
  121. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +0 -2568
  122. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -60
  123. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
  124. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
  125. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
  126. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
  127. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -139
  128. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
  129. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
  130. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
  131. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +0 -2261
  132. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +0 -1595
  133. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +0 -1467
  134. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +0 -1860
  135. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +0 -914
  136. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +0 -2578
  137. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +0 -582
  138. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
  139. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
  140. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
  141. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
  142. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
  143. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
  144. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
  145. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
  146. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
  147. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
  148. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
  149. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
  150. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
  151. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -163
  152. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
  153. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
  154. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
  155. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  156. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
  157. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
  158. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
  159. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
  160. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
  161. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
  162. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
  163. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
  164. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
  165. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
  166. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
  167. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
  168. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
  169. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
  170. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -1232
  171. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design.mjs +0 -2611
  172. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
  173. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -163
  174. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  175. package/lib/host-packages/claude/openplanr/skills/design/scripts/design.mjs +0 -12
  176. package/lib/host-packages/claude/openplanr/skills/design-loop/scripts/design.mjs +0 -12
  177. package/lib/host-packages/claude/openplanr/skills/design-review/scripts/design.mjs +0 -12
  178. package/lib/host-packages/claude/openplanr/skills/plan/scripts/design.mjs +0 -12
  179. package/lib/host-packages/cursor/openplanr/rules/planr-design/scripts/design.mjs +0 -12
  180. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/scripts/design.mjs +0 -12
  181. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/scripts/design.mjs +0 -12
  182. package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/design.mjs +0 -12
  183. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1772
  184. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
  185. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
  186. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-handoff.mjs +0 -2370
  187. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
  188. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
  189. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
  190. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review-state-store.mjs +0 -45
  191. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review.mjs +0 -3376
  192. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -38
  193. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
  194. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +0 -321
  195. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs +0 -1652
  196. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-9f6918b0.mjs +0 -1037
  197. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +0 -137
  198. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design.mjs +0 -1500
  199. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2023
  200. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
  201. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
  202. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -814
  203. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -10
  204. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +0 -2568
  205. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -60
  206. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
  207. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
  208. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
  209. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
  210. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -139
  211. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
  212. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
  213. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
  214. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +0 -2261
  215. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +0 -1595
  216. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +0 -1467
  217. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +0 -1860
  218. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +0 -914
  219. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +0 -2578
  220. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +0 -582
  221. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
  222. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
  223. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
  224. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
  225. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
  226. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
  227. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
  228. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
  229. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
  230. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
  231. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
  232. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
  233. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
  234. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -163
  235. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
  236. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
  237. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
  238. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  239. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
  240. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
  241. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
  242. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
  243. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
  244. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
  245. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
  246. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
  247. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
  248. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
  249. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
  250. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
  251. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
  252. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
  253. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -1232
  254. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design.mjs +0 -2611
  255. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
  256. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -163
  257. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  258. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1772
  259. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
  260. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
  261. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-handoff.mjs +0 -2370
  262. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
  263. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
  264. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
  265. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review-state-store.mjs +0 -45
  266. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review.mjs +0 -3376
  267. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -38
  268. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
  269. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +0 -321
  270. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs +0 -1652
  271. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-9f6918b0.mjs +0 -1037
  272. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +0 -137
  273. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design.mjs +0 -1500
  274. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2023
  275. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
  276. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
  277. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -814
  278. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -10
  279. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +0 -2568
  280. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -60
  281. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
  282. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
  283. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
  284. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
  285. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -139
  286. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
  287. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
  288. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
  289. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +0 -2261
  290. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +0 -1595
  291. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +0 -1467
  292. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +0 -1860
  293. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +0 -914
  294. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +0 -2578
  295. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +0 -582
  296. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
  297. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
  298. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
  299. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
  300. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
  301. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
  302. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
  303. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
  304. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
  305. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
  306. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
  307. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
  308. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
  309. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -163
  310. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
  311. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
  312. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
  313. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  314. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
  315. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
  316. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
  317. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
  318. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
  319. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
  320. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
  321. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
  322. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
  323. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
  324. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
  325. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
  326. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
  327. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
  328. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -1232
  329. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design.mjs +0 -2611
  330. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
  331. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -163
  332. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  333. package/lib/host-packages/openai/openplanr/skills/design/scripts/design.mjs +0 -12
  334. package/lib/host-packages/openai/openplanr/skills/design-loop/scripts/design.mjs +0 -12
  335. package/lib/host-packages/openai/openplanr/skills/design-review/scripts/design.mjs +0 -12
  336. package/lib/host-packages/openai/openplanr/skills/plan/scripts/design.mjs +0 -12
@@ -1,1037 +0,0 @@
1
- // packages/protocol/src/errors.mjs
2
- var ARTIFACT_ERROR_CODES = Object.freeze({
3
- INPUT_INVALID: "E_ARTIFACT_INPUT_INVALID",
4
- FILE_MISSING: "E_ARTIFACT_FILE_MISSING",
5
- ROOT_MISSING: "E_ARTIFACT_ROOT_MISSING",
6
- PATH_TRAVERSAL: "E_ARTIFACT_PATH_TRAVERSAL",
7
- SYMLINK_ESCAPE: "E_ARTIFACT_SYMLINK_ESCAPE",
8
- EXTERNAL_ASSET: "E_ARTIFACT_EXTERNAL_ASSET",
9
- UNRESOLVED_ASSET: "E_ARTIFACT_UNRESOLVED_ASSET",
10
- UNSUPPORTED_MODULE: "E_ARTIFACT_UNSUPPORTED_MODULE",
11
- UNSAFE_HTML: "E_ARTIFACT_UNSAFE_HTML",
12
- FILE_LIMIT: "E_ARTIFACT_FILE_LIMIT",
13
- BYTE_LIMIT: "E_ARTIFACT_BYTE_LIMIT",
14
- OUTPUT_LIMIT: "E_ARTIFACT_OUTPUT_LIMIT",
15
- REDACTION: "E_ARTIFACT_REDACTION",
16
- ENVELOPE_INVALID: "E_ARTIFACT_ENVELOPE_INVALID",
17
- SCHEMA_UNSUPPORTED: "E_ARTIFACT_SCHEMA_UNSUPPORTED",
18
- LOOPBACK_BIND: "E_ARTIFACT_LOOPBACK_BIND",
19
- LOOPBACK_STATE: "E_ARTIFACT_LOOPBACK_STATE",
20
- PORT_IN_USE: "E_ARTIFACT_PORT_IN_USE",
21
- SESSION_TOKEN: "E_ARTIFACT_SESSION_TOKEN",
22
- SESSION_NOT_FOUND: "E_ARTIFACT_SESSION_NOT_FOUND",
23
- REQUEST_INVALID: "E_ARTIFACT_REQUEST_INVALID",
24
- REQUEST_LIMIT: "E_ARTIFACT_REQUEST_LIMIT",
25
- SANDBOX_POLICY: "E_ARTIFACT_SANDBOX_POLICY",
26
- BRIDGE_INVALID: "E_ARTIFACT_BRIDGE_INVALID",
27
- REVIEW_INVALID: "E_ARTIFACT_REVIEW_INVALID",
28
- REVIEW_WRITE: "E_ARTIFACT_REVIEW_WRITE",
29
- REVIEW_IMPORT: "E_ARTIFACT_REVIEW_IMPORT",
30
- REVIEW_DECODER_REQUIRED: "E_ARTIFACT_REVIEW_DECODER_REQUIRED",
31
- REVIEW_EXPORT: "E_ARTIFACT_REVIEW_EXPORT",
32
- DIGEST_MISMATCH: "E_ARTIFACT_DIGEST_MISMATCH",
33
- STALE_REVIEW: "E_ARTIFACT_STALE_REVIEW",
34
- MERGE_CONFLICT: "E_ARTIFACT_MERGE_CONFLICT",
35
- CODEC_INVALID: "E_ARTIFACT_CODEC_INVALID",
36
- CODEC_UNAVAILABLE: "E_ARTIFACT_CODEC_UNAVAILABLE",
37
- CODEC_FAILED: "E_ARTIFACT_CODEC_FAILED",
38
- FRAGMENT_INVALID: "E_ARTIFACT_FRAGMENT_INVALID",
39
- FRAGMENT_VERSION_UNSUPPORTED: "E_ARTIFACT_FRAGMENT_VERSION_UNSUPPORTED",
40
- FRAGMENT_TOO_LARGE: "E_ARTIFACT_FRAGMENT_TOO_LARGE",
41
- DECOMPRESSION_LIMIT: "E_ARTIFACT_DECOMPRESSION_LIMIT",
42
- BROWSER_UNSUPPORTED: "E_ARTIFACT_BROWSER_UNSUPPORTED",
43
- ENCRYPTION_FAILED: "E_ARTIFACT_ENCRYPTION_FAILED",
44
- DECRYPTION_FAILED: "E_ARTIFACT_DECRYPTION_FAILED",
45
- CONFIRMATION_REQUIRED: "E_ARTIFACT_CONFIRMATION_REQUIRED",
46
- SHORT_CONFIRMATION_REQUIRED: "E_ARTIFACT_SHORT_CONFIRMATION_REQUIRED",
47
- PASTE_INVALID: "E_ARTIFACT_PASTE_INVALID",
48
- PASTE_UNAVAILABLE: "E_ARTIFACT_PASTE_UNAVAILABLE",
49
- PASTE_EXPIRED: "E_ARTIFACT_PASTE_EXPIRED",
50
- PASTE_LIMIT: "E_ARTIFACT_PASTE_LIMIT",
51
- SHARE_NETWORK: "E_ARTIFACT_SHARE_NETWORK",
52
- ROOM_CREATE_AMBIGUOUS: "E_ARTIFACT_ROOM_CREATE_AMBIGUOUS",
53
- ROOM_INVALID: "E_ARTIFACT_ROOM_INVALID",
54
- ROOM_UNAVAILABLE: "E_ARTIFACT_ROOM_UNAVAILABLE",
55
- ROOM_EXPIRED: "E_ARTIFACT_ROOM_EXPIRED",
56
- ROOM_CLOSED: "E_ARTIFACT_ROOM_CLOSED",
57
- ROOM_LEGACY_READ_ONLY: "E_ARTIFACT_ROOM_LEGACY_READ_ONLY",
58
- ROOM_FORBIDDEN: "E_ARTIFACT_ROOM_FORBIDDEN",
59
- ROOM_EVENT_INVALID: "E_ARTIFACT_ROOM_EVENT_INVALID",
60
- ROOM_EVENT_REPLAY: "E_ARTIFACT_ROOM_EVENT_REPLAY"
61
- });
62
- var PROTOCOL_ERROR_CODES = Object.freeze({
63
- ASSET_NOT_FOUND: "E_PROTOCOL_ASSET_NOT_FOUND",
64
- DIGEST_MISMATCH: "E_PROTOCOL_DIGEST_MISMATCH",
65
- DOCUMENT_INVALID: "E_PROTOCOL_DOCUMENT_INVALID",
66
- DOCUMENT_VERSION_UNSUPPORTED: "E_PROTOCOL_DOCUMENT_VERSION_UNSUPPORTED",
67
- DUPLICATE_ID: "E_PROTOCOL_DUPLICATE_ID",
68
- REFERENCE_INVALID: "E_PROTOCOL_REFERENCE_INVALID",
69
- REGISTRY_INVALID: "E_PROTOCOL_REGISTRY_INVALID",
70
- SCHEMA_INVALID: "E_PROTOCOL_SCHEMA_INVALID",
71
- SCHEMA_UNKNOWN: "E_SCHEMA_UNKNOWN",
72
- SCHEMA_VERSION_UNSUPPORTED: "E_SCHEMA_VERSION_UNSUPPORTED",
73
- SORT_ORDER_INVALID: "E_PROTOCOL_SORT_ORDER_INVALID"
74
- });
75
- var PipelineError = class extends Error {
76
- constructor(code, message, fix = "", details = void 0) {
77
- super(message);
78
- this.name = "PipelineError";
79
- this.code = code;
80
- this.fix = fix;
81
- if (details !== void 0) this.details = details;
82
- }
83
- toJSON() {
84
- return {
85
- ok: false,
86
- code: this.code,
87
- problem: this.message,
88
- ...this.fix ? { fix: this.fix } : {},
89
- ...this.details === void 0 ? {} : { details: this.details }
90
- };
91
- }
92
- };
93
-
94
- // packages/artifact/lib/artifact/artifact-sources.mjs
95
- var ARTIFACT_SHARED_ENVELOPE_VERSION = "1.1.0";
96
- var ARTIFACT_MAX_SOURCES = 256;
97
- var ARTIFACT_MAX_VIEWS = 4096;
98
- function resolveArtifactHtml(envelope, artifactOrId) {
99
- const id = typeof artifactOrId === "string" ? artifactOrId : artifactOrId?.id;
100
- const artifact = envelope?.artifacts?.find((value) => value.id === id);
101
- const source = envelope?.schemaVersion === ARTIFACT_SHARED_ENVELOPE_VERSION ? envelope.sources?.find((value) => value.id === artifact?.sourceId) : artifact;
102
- if (!artifact || typeof source?.html !== "string" || source.sha256 !== artifact.sha256) {
103
- throw new PipelineError(
104
- ARTIFACT_ERROR_CODES.ENVELOPE_INVALID,
105
- "Artifact source is missing or does not match its viewport reference."
106
- );
107
- }
108
- return source.html;
109
- }
110
-
111
- // packages/artifact/lib/artifact/envelope.mjs
112
- import { createHash } from "node:crypto";
113
-
114
- // packages/protocol/src/large-object-limits.mjs
115
- var LARGE_OBJECT_LIMITS = Object.freeze({
116
- uniqueHtmlBytes: 100 * 1024 * 1024,
117
- decodedBytes: 128 * 1024 * 1024,
118
- catalogBytes: 8 * 1024 * 1024,
119
- manifestBytes: 64 * 1024,
120
- chunkBytes: 1024 * 1024,
121
- chunkPlaintextBytes: 1024 * 1024 - 16,
122
- chunks: 129,
123
- ciphertextBytes: 128 * 1024 * 1024 + 129 * 16,
124
- sources: 256,
125
- views: 4096,
126
- resources: 1024,
127
- eventBytes: 256 * 1024,
128
- eventPageBytes: 1024 * 1024,
129
- eventPageCount: 100
130
- });
131
-
132
- // packages/artifact/lib/artifact/internal/schema-loader.mjs
133
- import { fileURLToPath as __planrAssetFile } from "node:url";
134
- import { readFileSync } from "node:fs";
135
- import { createRequire } from "node:module";
136
- import { dirname, join } from "node:path";
137
-
138
- // packages/protocol/src/json-schema.mjs
139
- var typeOf = (v) => {
140
- if (v === null) return "null";
141
- if (Array.isArray(v)) return "array";
142
- if (Number.isInteger(v)) return "integer";
143
- if (typeof v === "number") return "number";
144
- return typeof v;
145
- };
146
- var matchesType = (v, t) => {
147
- if (t === "integer") return Number.isInteger(v);
148
- if (t === "number") return typeof v === "number";
149
- if (t === "string") return typeof v === "string";
150
- if (t === "boolean") return typeof v === "boolean";
151
- if (t === "null") return v === null;
152
- if (t === "array") return Array.isArray(v);
153
- if (t === "object") return v !== null && typeof v === "object" && !Array.isArray(v);
154
- return false;
155
- };
156
- var FORMAT_DATE = /^\d{4}-\d{2}-\d{2}$/;
157
- var FORMAT_DATETIME = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
158
- var SUPPORTED_FORMATS = /* @__PURE__ */ new Set(["date", "date-time"]);
159
- var ANNOTATION_KEYWORDS = [
160
- "$schema",
161
- "$id",
162
- "$defs",
163
- "$comment",
164
- "title",
165
- "description",
166
- "default",
167
- "examples",
168
- "deprecated",
169
- "readOnly",
170
- "writeOnly"
171
- ];
172
- var VALIDATION_KEYWORDS = [
173
- "$ref",
174
- "type",
175
- "const",
176
- "enum",
177
- "minLength",
178
- "maxLength",
179
- "pattern",
180
- "format",
181
- "minimum",
182
- "maximum",
183
- "exclusiveMinimum",
184
- "minItems",
185
- "maxItems",
186
- "prefixItems",
187
- "items",
188
- "uniqueItems",
189
- "contains",
190
- "minContains",
191
- "maxContains",
192
- "required",
193
- "properties",
194
- "propertyNames",
195
- "additionalProperties",
196
- "maxProperties",
197
- "dependentRequired",
198
- "unevaluatedProperties",
199
- "oneOf",
200
- "anyOf",
201
- "allOf",
202
- "if",
203
- "then",
204
- "else",
205
- "not"
206
- ];
207
- var KNOWN_KEYWORDS = /* @__PURE__ */ new Set([...ANNOTATION_KEYWORDS, ...VALIDATION_KEYWORDS]);
208
- var TYPE_NAMES = /* @__PURE__ */ new Set(["array", "boolean", "integer", "null", "number", "object", "string"]);
209
- var isSchema = (value) => typeof value === "boolean" || value !== null && typeof value === "object" && !Array.isArray(value);
210
- var isPlainObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
211
- var isCount = (value) => Number.isSafeInteger(value) && value >= 0;
212
- var isUniqueStrings = (value) => Array.isArray(value) && value.every((item) => typeof item === "string") && new Set(value).size === value.length;
213
- var isSchemaArray = (value) => Array.isArray(value) && value.length > 0 && value.every(isSchema);
214
- var isSchemaMap = (value) => isPlainObject(value) && Object.values(value).every(isSchema);
215
- var compiledPatterns = /* @__PURE__ */ new Map();
216
- var MAX_COMPILED_PATTERNS = 1024;
217
- var tryCompilePattern = (source) => {
218
- try {
219
- return new RegExp(source);
220
- } catch (error) {
221
- if (error instanceof SyntaxError) return null;
222
- throw error;
223
- }
224
- };
225
- var compilePattern = (source) => {
226
- if (!compiledPatterns.has(source)) {
227
- if (compiledPatterns.size >= MAX_COMPILED_PATTERNS) compiledPatterns.clear();
228
- compiledPatterns.set(source, tryCompilePattern(source));
229
- }
230
- return compiledPatterns.get(source) ?? null;
231
- };
232
- var describeValue = (value) => {
233
- const text = String(JSON.stringify(value));
234
- return text.length > 80 ? `${text.slice(0, 77)}...` : text;
235
- };
236
- var KEYWORD_SHAPES = {
237
- $ref: ["a string", (value) => typeof value === "string"],
238
- $defs: ["an object of schemas", isSchemaMap],
239
- type: [
240
- "a type name or a non-empty array of unique type names",
241
- (value) => typeof value === "string" && TYPE_NAMES.has(value) || isUniqueStrings(value) && value.length > 0 && value.every((name) => TYPE_NAMES.has(name))
242
- ],
243
- enum: ["an array", Array.isArray],
244
- minLength: ["a non-negative integer", isCount],
245
- maxLength: ["a non-negative integer", isCount],
246
- pattern: [
247
- "a valid regular expression string",
248
- (value) => typeof value === "string" && compilePattern(value) !== null
249
- ],
250
- minimum: ["a finite number", Number.isFinite],
251
- maximum: ["a finite number", Number.isFinite],
252
- exclusiveMinimum: ["a finite number", Number.isFinite],
253
- minItems: ["a non-negative integer", isCount],
254
- maxItems: ["a non-negative integer", isCount],
255
- prefixItems: ["a non-empty array of schemas", isSchemaArray],
256
- items: ["a schema", isSchema],
257
- uniqueItems: ["a boolean", (value) => typeof value === "boolean"],
258
- contains: ["a schema", isSchema],
259
- minContains: ["a non-negative integer", isCount],
260
- maxContains: ["a non-negative integer", isCount],
261
- required: ["an array of unique strings", isUniqueStrings],
262
- properties: ["an object of schemas", isSchemaMap],
263
- propertyNames: ["a schema", isSchema],
264
- additionalProperties: ["a schema", isSchema],
265
- maxProperties: ["a non-negative integer", isCount],
266
- dependentRequired: [
267
- "an object of unique string arrays",
268
- (value) => isPlainObject(value) && Object.values(value).every(isUniqueStrings)
269
- ],
270
- unevaluatedProperties: ["a schema", isSchema],
271
- oneOf: ["a non-empty array of schemas", isSchemaArray],
272
- anyOf: ["a non-empty array of schemas", isSchemaArray],
273
- allOf: ["a non-empty array of schemas", isSchemaArray],
274
- if: ["a schema", isSchema],
275
- then: ["a schema", isSchema],
276
- else: ["a schema", isSchema],
277
- not: ["a schema", isSchema]
278
- };
279
- function resolveJsonPointer(root, reference) {
280
- if (reference === "#") return root;
281
- if (!reference.startsWith("#/")) return null;
282
- return reference.slice(2).split("/").map((part) => part.replaceAll("~1", "/").replaceAll("~0", "~")).reduce((value, part) => value?.[part], root);
283
- }
284
- var wellFormedSchemas = /* @__PURE__ */ new WeakSet();
285
- var isFrozenNode = (schema) => Object.isFrozen(schema) && Object.values(schema).every(Object.isFrozen) && (!isPlainObject(schema.dependentRequired) || Object.values(schema.dependentRequired).every(Object.isFrozen));
286
- var checkSchemaNode = (schema, path, context) => {
287
- if (wellFormedSchemas.has(schema) || context.checkedSchemas.has(schema)) return;
288
- context.checkedSchemas.add(schema);
289
- const errorCount = context.schemaErrors.length;
290
- for (const keyword of Object.keys(schema)) {
291
- if (!KNOWN_KEYWORDS.has(keyword) && !keyword.startsWith("x-")) {
292
- context.schemaErrors.push({
293
- path,
294
- rule: "unsupported-keyword",
295
- detail: `schema keyword '${keyword}' is not supported by this validator`
296
- });
297
- }
298
- }
299
- if (Object.hasOwn(schema, "format") && !SUPPORTED_FORMATS.has(schema.format)) {
300
- context.schemaErrors.push({
301
- path,
302
- rule: "unsupported-format",
303
- detail: `schema format ${JSON.stringify(schema.format)} is not supported by this validator`
304
- });
305
- }
306
- for (const [keyword, [expected, isValid]] of Object.entries(KEYWORD_SHAPES)) {
307
- if (Object.hasOwn(schema, keyword) && !isValid(schema[keyword])) {
308
- context.schemaErrors.push({
309
- path,
310
- rule: "schema",
311
- detail: `schema keyword '${keyword}' must be ${expected}, got ${describeValue(schema[keyword])}`
312
- });
313
- }
314
- }
315
- if (context.schemaErrors.length === errorCount && isFrozenNode(schema)) {
316
- wellFormedSchemas.add(schema);
317
- }
318
- };
319
- var reportReference = (schema, path, detail, context) => {
320
- if (context.reportedReferences.has(schema)) return;
321
- context.reportedReferences.add(schema);
322
- context.schemaErrors.push({ path, rule: "$ref", detail });
323
- };
324
- var validateNode = (value, schema, path, errs, context) => {
325
- const evaluated = /* @__PURE__ */ new Set();
326
- if (schema === true) return evaluated;
327
- if (schema === false) {
328
- errs.push({ path, rule: "schema:false", detail: "value not allowed" });
329
- return evaluated;
330
- }
331
- if (!isSchema(schema)) return evaluated;
332
- checkSchemaNode(schema, path, context);
333
- if (typeof schema?.$ref === "string") {
334
- const reference = schema.$ref;
335
- let resolved;
336
- let nextRoot = context.rootSchema;
337
- let resolvedBase = context.base;
338
- if (reference.startsWith("#")) {
339
- resolved = resolveJsonPointer(context.rootSchema, reference);
340
- } else if (typeof context.resolveRef === "function") {
341
- const result = context.resolveRef(reference, { base: context.base });
342
- resolved = result?.schema ?? result;
343
- nextRoot = result?.rootSchema ?? resolved;
344
- resolvedBase = result?.base ?? resolved?.$id ?? context.base;
345
- }
346
- if (!isSchema(resolved)) {
347
- const detail = resolved === void 0 || resolved === null ? `could not resolve schema reference ${reference}` : `schema reference ${reference} resolved to ${typeOf(resolved)}, not a schema`;
348
- reportReference(schema, path, detail, context);
349
- return evaluated;
350
- }
351
- const referenceKey = `${path} ${context.base ?? "<root>"}:${reference}`;
352
- if (context.referenceStack.includes(referenceKey)) {
353
- reportReference(schema, path, `circular schema reference ${reference}`, context);
354
- return evaluated;
355
- }
356
- const referenced = validateNode(value, resolved, path, errs, {
357
- ...context,
358
- rootSchema: nextRoot,
359
- base: resolvedBase,
360
- referenceStack: [...context.referenceStack, referenceKey]
361
- });
362
- for (const key of referenced) evaluated.add(key);
363
- }
364
- if (schema.type !== void 0) {
365
- const types = Array.isArray(schema.type) ? schema.type : [schema.type];
366
- if (!types.some((t) => matchesType(value, t))) {
367
- errs.push({
368
- path,
369
- rule: "type",
370
- detail: `expected ${types.join("|")}, got ${typeOf(value)}`
371
- });
372
- return evaluated;
373
- }
374
- }
375
- if (schema.const !== void 0) {
376
- if (value !== schema.const) {
377
- errs.push({
378
- path,
379
- rule: "const",
380
- detail: `expected ${JSON.stringify(schema.const)}, got ${JSON.stringify(value)}`
381
- });
382
- }
383
- }
384
- if (Array.isArray(schema.enum)) {
385
- if (!schema.enum.includes(value)) {
386
- errs.push({
387
- path,
388
- rule: "enum",
389
- detail: `value ${JSON.stringify(value)} not in enum [${schema.enum.map((x) => JSON.stringify(x)).join(", ")}]`
390
- });
391
- }
392
- }
393
- if (typeof value === "string") {
394
- if (typeof schema.minLength === "number" && value.length < schema.minLength) {
395
- errs.push({
396
- path,
397
- rule: "minLength",
398
- detail: `length ${value.length} < ${schema.minLength}`
399
- });
400
- }
401
- if (typeof schema.maxLength === "number" && value.length > schema.maxLength) {
402
- errs.push({
403
- path,
404
- rule: "maxLength",
405
- detail: `length ${value.length} > ${schema.maxLength}`
406
- });
407
- }
408
- const pattern = typeof schema.pattern === "string" ? compilePattern(schema.pattern) : null;
409
- if (pattern && !pattern.test(value)) {
410
- errs.push({
411
- path,
412
- rule: "pattern",
413
- detail: `value ${JSON.stringify(value)} does not match /${schema.pattern}/`
414
- });
415
- }
416
- if (typeof schema.format === "string") {
417
- if (schema.format === "date" && !FORMAT_DATE.test(value)) {
418
- errs.push({
419
- path,
420
- rule: "format:date",
421
- detail: `value ${JSON.stringify(value)} is not YYYY-MM-DD`
422
- });
423
- } else if (schema.format === "date-time" && !FORMAT_DATETIME.test(value)) {
424
- errs.push({
425
- path,
426
- rule: "format:date-time",
427
- detail: `value ${JSON.stringify(value)} is not ISO 8601 date-time`
428
- });
429
- }
430
- }
431
- }
432
- if (typeof value === "number") {
433
- if (typeof schema.minimum === "number" && value < schema.minimum) {
434
- errs.push({ path, rule: "minimum", detail: `value ${value} < ${schema.minimum}` });
435
- }
436
- if (typeof schema.maximum === "number" && value > schema.maximum) {
437
- errs.push({ path, rule: "maximum", detail: `value ${value} > ${schema.maximum}` });
438
- }
439
- if (typeof schema.exclusiveMinimum === "number" && value <= schema.exclusiveMinimum) {
440
- errs.push({
441
- path,
442
- rule: "exclusiveMinimum",
443
- detail: `value ${value} <= ${schema.exclusiveMinimum}`
444
- });
445
- }
446
- }
447
- if (Array.isArray(value)) {
448
- if (typeof schema.minItems === "number" && value.length < schema.minItems) {
449
- errs.push({ path, rule: "minItems", detail: `length ${value.length} < ${schema.minItems}` });
450
- }
451
- if (typeof schema.maxItems === "number" && value.length > schema.maxItems) {
452
- errs.push({ path, rule: "maxItems", detail: `length ${value.length} > ${schema.maxItems}` });
453
- }
454
- const prefixLength = Array.isArray(schema.prefixItems) ? schema.prefixItems.length : 0;
455
- if (prefixLength > 0) {
456
- for (let i = 0; i < Math.min(value.length, prefixLength); i++) {
457
- validateNode(value[i], schema.prefixItems[i], `${path}[${i}]`, errs, context);
458
- }
459
- }
460
- if (schema.items !== void 0) {
461
- for (let i = prefixLength; i < value.length; i++) {
462
- validateNode(value[i], schema.items, `${path}[${i}]`, errs, context);
463
- }
464
- }
465
- if (schema.uniqueItems === true) {
466
- const seen = /* @__PURE__ */ new Set();
467
- for (const item of value) {
468
- const key = JSON.stringify(item);
469
- if (seen.has(key)) {
470
- errs.push({ path, rule: "uniqueItems", detail: `duplicate item ${key}` });
471
- break;
472
- }
473
- seen.add(key);
474
- }
475
- }
476
- if (schema.contains !== void 0) {
477
- let matches = 0;
478
- for (let index = 0; index < value.length; index += 1) {
479
- const containedErrors = [];
480
- validateNode(value[index], schema.contains, `${path}[${index}]`, containedErrors, context);
481
- if (containedErrors.length === 0) matches += 1;
482
- }
483
- const minimum = Number.isSafeInteger(schema.minContains) ? schema.minContains : 1;
484
- const maximum = Number.isSafeInteger(schema.maxContains) ? schema.maxContains : null;
485
- if (matches < minimum) {
486
- errs.push({
487
- path,
488
- rule: "contains",
489
- detail: `matched ${matches} contained items; expected at least ${minimum}`
490
- });
491
- }
492
- if (maximum !== null && matches > maximum) {
493
- errs.push({
494
- path,
495
- rule: "contains",
496
- detail: `matched ${matches} contained items; expected at most ${maximum}`
497
- });
498
- }
499
- }
500
- }
501
- if (value !== null && typeof value === "object" && !Array.isArray(value)) {
502
- if (Array.isArray(schema.required)) {
503
- for (const req of schema.required) {
504
- if (!Object.hasOwn(value, req)) {
505
- errs.push({ path, rule: "required", detail: `missing required property '${req}'` });
506
- }
507
- }
508
- }
509
- if (typeof schema.maxProperties === "number" && Object.keys(value).length > schema.maxProperties) {
510
- errs.push({
511
- path,
512
- rule: "maxProperties",
513
- detail: `property count ${Object.keys(value).length} > ${schema.maxProperties}`
514
- });
515
- }
516
- if (schema.dependentRequired !== null && typeof schema.dependentRequired === "object") {
517
- for (const [trigger, dependencies] of Object.entries(schema.dependentRequired)) {
518
- if (!Object.hasOwn(value, trigger) || !Array.isArray(dependencies)) continue;
519
- for (const dependency of dependencies) {
520
- if (!Object.hasOwn(value, dependency)) {
521
- errs.push({
522
- path,
523
- rule: "dependentRequired",
524
- detail: `property '${trigger}' requires property '${dependency}'`
525
- });
526
- }
527
- }
528
- }
529
- }
530
- const props = schema.properties || {};
531
- for (const [k, v] of Object.entries(value)) {
532
- if (schema.propertyNames !== void 0)
533
- validateNode(k, schema.propertyNames, `${path}.${k}`, errs, context);
534
- if (Object.hasOwn(props, k)) evaluated.add(k);
535
- else if (schema.additionalProperties !== void 0) evaluated.add(k);
536
- if (!Object.hasOwn(props, k)) {
537
- if (schema.additionalProperties === false) {
538
- errs.push({ path, rule: "additionalProperties", detail: `unknown property '${k}'` });
539
- } else if (schema.additionalProperties === true || schema.additionalProperties !== null && typeof schema.additionalProperties === "object") {
540
- validateNode(v, schema.additionalProperties, `${path}.${k}`, errs, context);
541
- }
542
- }
543
- }
544
- for (const [k, v] of Object.entries(value)) {
545
- if (Object.hasOwn(props, k)) validateNode(v, props[k], `${path}.${k}`, errs, context);
546
- }
547
- }
548
- if (Array.isArray(schema.oneOf)) {
549
- let matched = 0;
550
- for (const sub of schema.oneOf) {
551
- const e = [];
552
- const branch = validateNode(value, sub, path, e, context);
553
- if (e.length === 0) {
554
- matched++;
555
- for (const key of branch) evaluated.add(key);
556
- }
557
- }
558
- if (matched !== 1) {
559
- const titles = schema.oneOf.map((s) => s.title || "(unnamed)").join(" | ");
560
- errs.push({
561
- path,
562
- rule: "oneOf",
563
- detail: `matched ${matched}/${schema.oneOf.length} branches (expected exactly 1). Branches: ${titles}`
564
- });
565
- }
566
- }
567
- if (Array.isArray(schema.anyOf)) {
568
- let matched = 0;
569
- for (const sub of schema.anyOf) {
570
- const candidateErrors = [];
571
- const branch = validateNode(value, sub, path, candidateErrors, context);
572
- if (candidateErrors.length === 0) {
573
- matched += 1;
574
- for (const key of branch) evaluated.add(key);
575
- }
576
- }
577
- if (matched === 0) {
578
- const titles = schema.anyOf.map((sub) => sub.title || "(unnamed)").join(" | ");
579
- errs.push({
580
- path,
581
- rule: "anyOf",
582
- detail: `matched 0/${schema.anyOf.length} branches (expected at least 1). Branches: ${titles}`
583
- });
584
- }
585
- }
586
- if (Array.isArray(schema.allOf)) {
587
- for (const sub of schema.allOf) {
588
- for (const key of validateNode(value, sub, path, errs, context)) evaluated.add(key);
589
- }
590
- }
591
- if (schema.if !== void 0) {
592
- const conditionErrors = [];
593
- const condition = validateNode(value, schema.if, path, conditionErrors, context);
594
- const passed = conditionErrors.length === 0;
595
- if (passed) for (const key of condition) evaluated.add(key);
596
- const branch = passed ? schema.then : schema.else;
597
- if (branch !== void 0) {
598
- const branchErrors = [];
599
- const branchEvaluated = validateNode(value, branch, path, branchErrors, context);
600
- errs.push(...branchErrors);
601
- if (branchErrors.length === 0) for (const key of branchEvaluated) evaluated.add(key);
602
- }
603
- }
604
- if (schema.not !== void 0) {
605
- const e = [];
606
- validateNode(value, schema.not, path, e, context);
607
- if (e.length === 0) {
608
- errs.push({ path, rule: "not", detail: "value matched a forbidden subschema" });
609
- }
610
- }
611
- if (schema.unevaluatedProperties !== void 0 && value !== null && typeof value === "object" && !Array.isArray(value)) {
612
- for (const [k, v] of Object.entries(value)) {
613
- if (evaluated.has(k)) continue;
614
- if (schema.unevaluatedProperties === false) {
615
- errs.push({ path, rule: "unevaluatedProperties", detail: `unevaluated property '${k}'` });
616
- } else {
617
- validateNode(v, schema.unevaluatedProperties, `${path}.${k}`, errs, context);
618
- }
619
- evaluated.add(k);
620
- }
621
- }
622
- return evaluated;
623
- };
624
- var validateJson = (value, schema, {
625
- resolveRef,
626
- base = (
627
- /** @type {{ $id?: string } | null | undefined} */
628
- schema?.$id ?? null
629
- )
630
- } = {}) => {
631
- const errs = [];
632
- const schemaErrors = [];
633
- if (!isSchema(schema)) {
634
- return [
635
- {
636
- path: "$",
637
- rule: "schema",
638
- detail: `expected a schema object or boolean, got ${typeOf(schema)}`
639
- }
640
- ];
641
- }
642
- validateNode(value, schema, "$", errs, {
643
- rootSchema: schema,
644
- resolveRef,
645
- base,
646
- referenceStack: [],
647
- schemaErrors,
648
- checkedSchemas: /* @__PURE__ */ new WeakSet(),
649
- reportedReferences: /* @__PURE__ */ new WeakSet()
650
- });
651
- return [...schemaErrors, ...errs];
652
- };
653
-
654
- // packages/artifact/lib/artifact/internal/schema-loader.mjs
655
- var require2 = createRequire(new URL("./runtime/packages/artifact/lib/artifact/internal/schema-loader.mjs", import.meta.url).href);
656
- var protocolPackageRoot = dirname(__planrAssetFile(new URL("./runtime/packages/protocol/package.json", import.meta.url)));
657
- var SCHEMAS_ROOT = join(protocolPackageRoot, "schemas");
658
- var DEFAULT_SCHEMA_VERSIONS = Object.freeze(["v1.0.0", "v1.1.0"]);
659
- var schemaCache = /* @__PURE__ */ new Map();
660
- function parseSchemaReference(name, version) {
661
- if (typeof name !== "string" || !/^[a-z0-9-]+(?:\.schema\.json)?$/i.test(name)) {
662
- throw new Error(`invalid schema name: ${String(name)}`);
663
- }
664
- const cleanName = name.replace(/\.schema\.json$/i, "");
665
- if (version !== void 0 && !/^v\d+\.\d+\.\d+$/.test(version)) {
666
- throw new Error(`invalid schema version: ${String(version)}`);
667
- }
668
- return { cleanName, versions: version ? [version] : DEFAULT_SCHEMA_VERSIONS };
669
- }
670
- function loadSchema(name, version = void 0) {
671
- if (typeof name === "string" && name.includes("/")) {
672
- const [qualifiedVersion, qualifiedName, ...rest] = name.split("/");
673
- if (rest.length > 0 || version !== void 0)
674
- throw new Error(`invalid schema reference: ${name}`);
675
- return loadSchema(qualifiedName, qualifiedVersion);
676
- }
677
- const { cleanName, versions } = parseSchemaReference(name, version);
678
- for (const candidateVersion of versions) {
679
- const key = `${candidateVersion}/${cleanName}`;
680
- if (schemaCache.has(key)) return schemaCache.get(key);
681
- const path = join(SCHEMAS_ROOT, candidateVersion, `${cleanName}.schema.json`);
682
- try {
683
- const schema = JSON.parse(readFileSync(path, "utf-8"));
684
- schemaCache.set(key, schema);
685
- return schema;
686
- } catch (error) {
687
- if (error?.code !== "ENOENT") throw error;
688
- }
689
- }
690
- throw new Error(`unknown schema: ${cleanName}${version ? ` (${version})` : ""}`);
691
- }
692
- function validate(data, schemaName, version = void 0) {
693
- return validateJson(data, loadSchema(schemaName, version));
694
- }
695
-
696
- // packages/artifact/lib/artifact/envelope.mjs
697
- var textEncoder = new TextEncoder();
698
- var SHA256_RE = /^[a-f0-9]{64}$/;
699
- var ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
700
- var MAX_ARTIFACTS = 256;
701
- var MAX_ARTIFACT_HTML_BYTES = LARGE_OBJECT_LIMITS.uniqueHtmlBytes;
702
- var MAX_PINS = 1e4;
703
- var MAX_REPLIES = 1e4;
704
- var MAX_PASTE_BYTES = 5 * 1024 * 1024;
705
- var ARTIFACT_PRESENTATIONS = Object.freeze(["document", "canvas"]);
706
- var ARTIFACT_DOCUMENT_MAX_HEIGHT = 262144;
707
- function invalid(message, details = void 0) {
708
- throw new PipelineError(ARTIFACT_ERROR_CODES.ENVELOPE_INVALID, message, "", details);
709
- }
710
- function assertBoundedString(value, label, { min = 0, max, pattern } = {}) {
711
- if (typeof value !== "string" || value.length < min || max !== void 0 && value.length > max || pattern && !pattern.test(value)) {
712
- invalid(`${label} is outside its allowed string bounds.`);
713
- }
714
- }
715
- function assertViewport(viewport, label, { maxHeight = 16384 } = {}) {
716
- if (!viewport || !Number.isInteger(viewport.width) || !Number.isInteger(viewport.height) || viewport.width < 1 || viewport.width > 16384 || viewport.height < 1 || viewport.height > maxHeight) {
717
- invalid(
718
- `${label} must have an integer width from 1 through 16384 pixels and height from 1 through ${maxHeight} pixels.`
719
- );
720
- }
721
- }
722
- function normalizeUtf8Text(value) {
723
- if (typeof value !== "string") {
724
- throw new PipelineError(ARTIFACT_ERROR_CODES.INPUT_INVALID, "Artifact HTML must be a string.");
725
- }
726
- return value.replace(/^\uFEFF/, "").replace(/\r\n?/g, "\n");
727
- }
728
- function canonicalArtifactBytes(html) {
729
- return textEncoder.encode(normalizeUtf8Text(html));
730
- }
731
- function sha256Hex(bytes) {
732
- return createHash("sha256").update(bytes).digest("hex");
733
- }
734
- function digestArtifact(html) {
735
- return sha256Hex(canonicalArtifactBytes(html));
736
- }
737
- function canonicalObject(value) {
738
- if (Array.isArray(value)) return value.map(canonicalObject);
739
- if (!value || typeof value !== "object") return value;
740
- return Object.fromEntries(
741
- Object.keys(value).sort().map((key) => [key, canonicalObject(value[key])])
742
- );
743
- }
744
- function canonicalSerialize(value) {
745
- return JSON.stringify(canonicalObject(value));
746
- }
747
- function canonicalBytes(value) {
748
- return textEncoder.encode(canonicalSerialize(value));
749
- }
750
- function normalizeViewport(viewport = {}) {
751
- const width = viewport.width ?? 1440;
752
- const height = viewport.height ?? 900;
753
- if (!Number.isInteger(width) || width < 1 || width > 16384 || !Number.isInteger(height) || height < 1 || height > 16384) {
754
- throw new PipelineError(
755
- ARTIFACT_ERROR_CODES.ENVELOPE_INVALID,
756
- "Artifact viewport width and height must be integers from 1 through 16384."
757
- );
758
- }
759
- return { width, height };
760
- }
761
- function normalizeArtifact(artifact) {
762
- if (!artifact || typeof artifact !== "object") {
763
- throw new PipelineError(
764
- ARTIFACT_ERROR_CODES.ENVELOPE_INVALID,
765
- "Each artifact must be an object."
766
- );
767
- }
768
- const id = artifact.id;
769
- const title = artifact.title;
770
- if (typeof id !== "string" || !ID_RE.test(id) || id.length > 128) {
771
- throw new PipelineError(
772
- ARTIFACT_ERROR_CODES.ENVELOPE_INVALID,
773
- `Invalid artifact id: ${String(id)}`
774
- );
775
- }
776
- if (typeof title !== "string" || title.length === 0 || title.length > 512) {
777
- throw new PipelineError(
778
- ARTIFACT_ERROR_CODES.ENVELOPE_INVALID,
779
- `Artifact ${id} requires a title.`
780
- );
781
- }
782
- const html = normalizeUtf8Text(artifact.html);
783
- if (html.length === 0) {
784
- throw new PipelineError(ARTIFACT_ERROR_CODES.ENVELOPE_INVALID, `Artifact ${id} HTML is empty.`);
785
- }
786
- if (Buffer.byteLength(html, "utf8") > MAX_ARTIFACT_HTML_BYTES) {
787
- invalid(`Artifact ${id} exceeds ${MAX_ARTIFACT_HTML_BYTES} UTF-8 bytes.`);
788
- }
789
- const sha256 = digestArtifact(html);
790
- if (artifact.sha256 !== void 0 && artifact.sha256 !== sha256) {
791
- throw new PipelineError(
792
- ARTIFACT_ERROR_CODES.ENVELOPE_INVALID,
793
- `Artifact ${id} digest does not match its canonical bundled HTML.`,
794
- "",
795
- { expected: sha256, actual: artifact.sha256 }
796
- );
797
- }
798
- const colorScheme = artifact.colorScheme ?? "light";
799
- if (!["light", "dark"].includes(colorScheme)) {
800
- throw new PipelineError(
801
- ARTIFACT_ERROR_CODES.ENVELOPE_INVALID,
802
- `Artifact ${id} has an invalid color scheme.`
803
- );
804
- }
805
- return {
806
- id,
807
- kind: "html",
808
- title,
809
- sha256,
810
- html,
811
- viewport: normalizeViewport(artifact.viewport),
812
- colorScheme
813
- };
814
- }
815
- function normalizeViewer(viewer, artifacts) {
816
- const ids = new Set(artifacts.map(({ id }) => id));
817
- const normalized = {
818
- mode: viewer?.mode ?? (artifacts.length > 1 ? "variants" : "single"),
819
- activeArtifactId: viewer?.activeArtifactId ?? artifacts[0].id
820
- };
821
- if (!["single", "variants"].includes(normalized.mode)) {
822
- throw new PipelineError(
823
- ARTIFACT_ERROR_CODES.ENVELOPE_INVALID,
824
- "Viewer mode must be single or variants."
825
- );
826
- }
827
- if (!ids.has(normalized.activeArtifactId)) {
828
- throw new PipelineError(
829
- ARTIFACT_ERROR_CODES.ENVELOPE_INVALID,
830
- "Viewer activeArtifactId is not present in artifacts."
831
- );
832
- }
833
- if (viewer?.presentation !== void 0) {
834
- if (!ARTIFACT_PRESENTATIONS.includes(viewer.presentation)) {
835
- throw new PipelineError(
836
- ARTIFACT_ERROR_CODES.ENVELOPE_INVALID,
837
- "Viewer presentation must be document or canvas."
838
- );
839
- }
840
- normalized.presentation = viewer.presentation;
841
- }
842
- return normalized;
843
- }
844
- function envelopeWithoutReview(envelope) {
845
- return {
846
- schemaVersion: envelope.schemaVersion,
847
- ...envelope.schemaVersion === ARTIFACT_SHARED_ENVELOPE_VERSION ? { sources: envelope.sources } : {},
848
- artifacts: envelope.artifacts,
849
- viewer: envelope.viewer
850
- };
851
- }
852
- function canonicalEnvelopeBytes(envelope, { includeReview = false } = {}) {
853
- const value = includeReview ? envelope : envelopeWithoutReview(envelope);
854
- return canonicalBytes(value);
855
- }
856
- function digestArtifactEnvelope(envelope) {
857
- return sha256Hex(canonicalEnvelopeBytes(envelope));
858
- }
859
- function validateArtifactReview(review) {
860
- const issues = validate(review, "artifact-review", "v1.1.0");
861
- if (issues.length > 0) {
862
- throw new PipelineError(
863
- ARTIFACT_ERROR_CODES.ENVELOPE_INVALID,
864
- `Invalid artifact review at ${issues[0].path}: ${issues[0].detail}`,
865
- "",
866
- { issues }
867
- );
868
- }
869
- assertBoundedString(review.reviewId, "reviewId", { min: 1, max: 128 });
870
- assertBoundedString(review.reviewOf, "reviewOf", { min: 64, max: 64, pattern: SHA256_RE });
871
- assertBoundedString(review.overall, "overall", { max: 65536 });
872
- if (!Array.isArray(review.pins) || review.pins.length > MAX_PINS)
873
- invalid(`Review pins exceed ${MAX_PINS}.`);
874
- for (const [pinIndex, pin] of review.pins.entries()) {
875
- const label = `pins[${pinIndex}]`;
876
- assertBoundedString(pin.id, `${label}.id`, { min: 1, max: 128 });
877
- assertBoundedString(pin.author?.id ?? "", `${label}.author.id`, { max: 128 });
878
- assertBoundedString(pin.author?.name, `${label}.author.name`, { min: 1, max: 256 });
879
- assertBoundedString(pin.artifactId, `${label}.artifactId`, { min: 1, max: 128 });
880
- if (pin.variant !== void 0)
881
- assertBoundedString(pin.variant, `${label}.variant`, { min: 1, max: 128 });
882
- assertBoundedString(pin.comment, `${label}.comment`, { min: 1, max: 65536 });
883
- if (pin.anchor) {
884
- assertBoundedString(pin.anchor.planrId, `${label}.anchor.planrId`, { min: 1, max: 512 });
885
- if (pin.anchor.screen !== void 0)
886
- assertBoundedString(pin.anchor.screen, `${label}.anchor.screen`, { min: 1, max: 128 });
887
- }
888
- assertViewport(pin.viewport, `${label}.viewport`, { maxHeight: ARTIFACT_DOCUMENT_MAX_HEIGHT });
889
- for (const coordinate of ["x", "y", "w", "h"]) {
890
- const value = pin.region?.[coordinate];
891
- if (typeof value !== "number" || !Number.isFinite(value) || value < 0 || value > 1) {
892
- invalid(`${label}.region.${coordinate} must be a finite normalized coordinate.`);
893
- }
894
- }
895
- if (pin.region.x + pin.region.w > 1 || pin.region.y + pin.region.h > 1) {
896
- invalid(`${label}.region must remain inside normalized artifact bounds.`);
897
- }
898
- if (!Array.isArray(pin.replies) || pin.replies.length > MAX_REPLIES)
899
- invalid(`${label}.replies exceeds ${MAX_REPLIES}.`);
900
- for (const [replyIndex, reply] of pin.replies.entries()) {
901
- const replyLabel = `${label}.replies[${replyIndex}]`;
902
- assertBoundedString(reply.id, `${replyLabel}.id`, { min: 1, max: 128 });
903
- assertBoundedString(reply.author?.id ?? "", `${replyLabel}.author.id`, { max: 128 });
904
- assertBoundedString(reply.author?.name, `${replyLabel}.author.name`, { min: 1, max: 256 });
905
- assertBoundedString(reply.comment, `${replyLabel}.comment`, { min: 1, max: 65536 });
906
- }
907
- }
908
- return review;
909
- }
910
- function validateArtifactEnvelope(envelope) {
911
- const shared = envelope?.schemaVersion === ARTIFACT_SHARED_ENVELOPE_VERSION;
912
- const issues = validate(envelope, "artifact-envelope", shared ? "v1.16.0" : "v1.1.0");
913
- if (issues.length > 0) {
914
- throw new PipelineError(
915
- ARTIFACT_ERROR_CODES.ENVELOPE_INVALID,
916
- `Invalid artifact envelope at ${issues[0].path}: ${issues[0].detail}`,
917
- "",
918
- { issues }
919
- );
920
- }
921
- if (!Array.isArray(envelope.artifacts) || envelope.artifacts.length < 1 || envelope.artifacts.length > (shared ? ARTIFACT_MAX_VIEWS : MAX_ARTIFACTS)) {
922
- invalid(
923
- `Envelope requires 1 through ${shared ? ARTIFACT_MAX_VIEWS : MAX_ARTIFACTS} artifacts.`
924
- );
925
- }
926
- const ids = envelope.artifacts.map(({ id }) => id);
927
- if (new Set(ids).size !== ids.length) {
928
- throw new PipelineError(ARTIFACT_ERROR_CODES.ENVELOPE_INVALID, "Artifact ids must be unique.");
929
- }
930
- const sources = shared ? envelope.sources : envelope.artifacts;
931
- if (shared && new Set(sources.map(({ id }) => id)).size !== sources.length) {
932
- invalid("Artifact source ids must be unique.");
933
- }
934
- let artifactBytes = 0;
935
- for (const source of sources) {
936
- assertBoundedString(source.html, `Source ${source.id} HTML`, { min: 1 });
937
- artifactBytes += Buffer.byteLength(source.html, "utf8");
938
- if (artifactBytes > MAX_ARTIFACT_HTML_BYTES) {
939
- invalid(`Envelope sources exceed ${MAX_ARTIFACT_HTML_BYTES} UTF-8 bytes in total.`);
940
- }
941
- if (!SHA256_RE.test(source.sha256) || digestArtifact(source.html) !== source.sha256) {
942
- invalid(`Artifact source ${source.id} digest is invalid.`);
943
- }
944
- }
945
- for (const artifact of envelope.artifacts) {
946
- assertBoundedString(artifact.id, "artifact.id", { min: 1, max: 128, pattern: ID_RE });
947
- assertBoundedString(artifact.title, `Artifact ${artifact.id} title`, { min: 1, max: 512 });
948
- assertViewport(artifact.viewport, `Artifact ${artifact.id} viewport`);
949
- if (shared) resolveArtifactHtml(envelope, artifact);
950
- }
951
- if (shared && new Set(envelope.artifacts.map(({ sourceId }) => sourceId)).size !== sources.length) {
952
- invalid("Every shared artifact source must be referenced by a viewport.");
953
- }
954
- assertBoundedString(envelope.viewer.activeArtifactId, "viewer.activeArtifactId", {
955
- min: 1,
956
- max: 128
957
- });
958
- if (!ids.includes(envelope.viewer.activeArtifactId)) {
959
- throw new PipelineError(
960
- ARTIFACT_ERROR_CODES.ENVELOPE_INVALID,
961
- "Viewer references an unknown artifact."
962
- );
963
- }
964
- if (envelope.review) {
965
- validateArtifactReview(envelope.review);
966
- for (const pin of envelope.review.pins) {
967
- if (!ids.includes(pin.artifactId))
968
- invalid(`Review pin references unknown artifact: ${pin.artifactId}`);
969
- }
970
- const expected = digestArtifactEnvelope(envelope);
971
- if (envelope.review.reviewOf !== expected) {
972
- throw new PipelineError(
973
- ARTIFACT_ERROR_CODES.ENVELOPE_INVALID,
974
- "Review digest does not match the canonical review-free envelope.",
975
- "",
976
- { expected, actual: envelope.review.reviewOf }
977
- );
978
- }
979
- }
980
- return envelope;
981
- }
982
- function createSharedArtifactEnvelope({ sources, artifacts, viewer, review } = {}) {
983
- if (!Array.isArray(sources) || sources.length < 1 || sources.length > ARTIFACT_MAX_SOURCES) {
984
- invalid(`Shared envelope requires 1 through ${ARTIFACT_MAX_SOURCES} sources.`);
985
- }
986
- if (!Array.isArray(artifacts) || artifacts.length < 1 || artifacts.length > ARTIFACT_MAX_VIEWS) {
987
- invalid(`Shared envelope requires 1 through ${ARTIFACT_MAX_VIEWS} viewport references.`);
988
- }
989
- const normalizedSources = sources.map((source) => {
990
- const value = normalizeArtifact({ ...source, title: source?.id });
991
- return { id: value.id, kind: value.kind, sha256: value.sha256, html: value.html };
992
- });
993
- const sourceMap = new Map(normalizedSources.map((source) => [source.id, source]));
994
- const normalizedArtifacts = artifacts.map((artifact) => {
995
- const source = sourceMap.get(artifact?.sourceId);
996
- if (!source) invalid("Artifact viewport references an unknown shared source.");
997
- assertBoundedString(artifact.id, "artifact.id", { min: 1, max: 128, pattern: ID_RE });
998
- assertBoundedString(artifact.title, "artifact.title", { min: 1, max: 512 });
999
- if (artifact.sha256 !== void 0 && artifact.sha256 !== source.sha256) {
1000
- invalid("Artifact viewport digest does not match its shared source.");
1001
- }
1002
- const colorScheme = artifact.colorScheme ?? "light";
1003
- if (!["light", "dark"].includes(colorScheme))
1004
- invalid("Artifact viewport color scheme is invalid.");
1005
- return {
1006
- id: artifact.id,
1007
- kind: "html",
1008
- title: artifact.title,
1009
- sourceId: source.id,
1010
- sha256: source.sha256,
1011
- viewport: normalizeViewport(artifact.viewport),
1012
- colorScheme
1013
- };
1014
- });
1015
- return validateArtifactEnvelope({
1016
- schemaVersion: ARTIFACT_SHARED_ENVELOPE_VERSION,
1017
- sources: normalizedSources,
1018
- artifacts: normalizedArtifacts,
1019
- viewer: normalizeViewer(viewer, normalizedArtifacts),
1020
- ...review ? { review: canonicalObject(review) } : {}
1021
- });
1022
- }
1023
-
1024
- export {
1025
- ARTIFACT_ERROR_CODES,
1026
- PipelineError,
1027
- ARTIFACT_MAX_SOURCES,
1028
- ARTIFACT_MAX_VIEWS,
1029
- resolveArtifactHtml,
1030
- validateJson,
1031
- MAX_ARTIFACT_HTML_BYTES,
1032
- canonicalSerialize,
1033
- digestArtifactEnvelope,
1034
- validateArtifactReview,
1035
- validateArtifactEnvelope,
1036
- createSharedArtifactEnvelope
1037
- };