openplanr 3.3.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 (493) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/dist/cli/commands/artifact-design-share.d.ts +9 -0
  3. package/dist/cli/commands/artifact-design-share.d.ts.map +1 -0
  4. package/dist/cli/commands/artifact-design-share.js +200 -0
  5. package/dist/cli/commands/artifact-design-share.js.map +1 -0
  6. package/dist/cli/commands/artifact.d.ts.map +1 -1
  7. package/dist/cli/commands/artifact.js +5 -18
  8. package/dist/cli/commands/artifact.js.map +1 -1
  9. package/dist/cli/commands/design.d.ts +3 -0
  10. package/dist/cli/commands/design.d.ts.map +1 -0
  11. package/dist/cli/commands/design.js +137 -0
  12. package/dist/cli/commands/design.js.map +1 -0
  13. package/dist/cli/commands/groups/operations.d.ts.map +1 -1
  14. package/dist/cli/commands/groups/operations.js +2 -0
  15. package/dist/cli/commands/groups/operations.js.map +1 -1
  16. package/dist/cli/commands/ship.d.ts.map +1 -1
  17. package/dist/cli/commands/ship.js +2 -0
  18. package/dist/cli/commands/ship.js.map +1 -1
  19. package/dist/dashboard/.vite/manifest.json +2 -2
  20. package/dist/dashboard/assets/index-B-l_941W.js +75 -0
  21. package/dist/dashboard/assets/index-B-l_941W.js.map +1 -0
  22. package/dist/dashboard/assets/index-Cv4Vwhuw.css +2 -0
  23. package/dist/dashboard/dashboard-manifest.json +14 -14
  24. package/dist/dashboard/index.html +2 -2
  25. package/dist/services/design-artifact-service.d.ts +42 -1
  26. package/dist/services/design-artifact-service.d.ts.map +1 -1
  27. package/dist/services/design-artifact-service.js +198 -19
  28. package/dist/services/design-artifact-service.js.map +1 -1
  29. package/dist/services/runtime-manager/runtime-package.js +1 -1
  30. package/dist/services/runtime-manager/runtime-package.js.map +1 -1
  31. package/dist/services/ship-checks/contract.d.ts +3 -1
  32. package/dist/services/ship-checks/contract.d.ts.map +1 -1
  33. package/dist/services/ship-checks/contract.js +1 -1
  34. package/dist/services/ship-checks/contract.js.map +1 -1
  35. package/dist/services/ship-checks/discover.d.ts.map +1 -1
  36. package/dist/services/ship-checks/discover.js +2 -1
  37. package/dist/services/ship-checks/discover.js.map +1 -1
  38. package/dist/services/ship-checks/package-contents.d.ts +4 -0
  39. package/dist/services/ship-checks/package-contents.d.ts.map +1 -0
  40. package/dist/services/ship-checks/package-contents.js +91 -0
  41. package/dist/services/ship-checks/package-contents.js.map +1 -0
  42. package/dist/services/ship-checks/packages.d.ts +2 -0
  43. package/dist/services/ship-checks/packages.d.ts.map +1 -1
  44. package/dist/services/ship-checks/packages.js +4 -0
  45. package/dist/services/ship-checks/packages.js.map +1 -1
  46. package/dist/services/ship-checks/scope.js +2 -1
  47. package/dist/services/ship-checks/scope.js.map +1 -1
  48. package/dist/utils/splice-managed-block.js +1 -1
  49. package/dist/utils/splice-managed-block.js.map +1 -1
  50. package/docs/CLI.md +67 -1
  51. package/lib/host-packages/adapter-registry.json +5 -5
  52. package/lib/host-packages/capability-map.json +1 -1
  53. package/lib/host-packages/claude/.claude-plugin/marketplace.json +3 -3
  54. package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +6 -6
  55. package/lib/host-packages/claude/openplanr/.openplanr-content.json +57 -429
  56. package/lib/host-packages/claude/openplanr/README.md +16 -16
  57. package/lib/host-packages/claude/openplanr/references/agents/shared/modes/shared/task-context-resolution.md +4 -4
  58. package/lib/host-packages/claude/openplanr/skills/artifact/references/design-sharing.md +2 -2
  59. package/lib/host-packages/claude/openplanr/skills/delegate/SKILL.md +2 -1
  60. package/lib/host-packages/claude/openplanr/skills/delegate/references/integration-review.md +26 -20
  61. package/lib/host-packages/claude/openplanr/skills/delegate/references/operator-guide.md +25 -1
  62. package/lib/host-packages/claude/openplanr/skills/delegate/references/run-handoff.md +2 -2
  63. package/lib/host-packages/claude/openplanr/skills/delegate/references/worktree-custody.md +17 -9
  64. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/claude.mjs +15 -3
  65. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/codex.mjs +38 -2
  66. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/native.mjs +5 -0
  67. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/custody.mjs +217 -10
  68. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/handoff.mjs +1080 -0
  69. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integrate.mjs +96 -201
  70. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integration-files.mjs +3 -382
  71. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/presentation.mjs +29 -12
  72. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-contract.mjs +11 -0
  73. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-execution.mjs +1 -1
  74. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-lifecycle.mjs +14 -10
  75. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-preparation.mjs +4 -0
  76. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-record.mjs +2 -2
  77. package/lib/host-packages/claude/openplanr/skills/design/SKILL.md +23 -12
  78. package/lib/host-packages/claude/openplanr/skills/design/references/design-system.md +2 -2
  79. package/lib/host-packages/claude/openplanr/skills/design/references/generation.md +3 -3
  80. package/lib/host-packages/claude/openplanr/skills/design/references/hosted-canvas.md +6 -3
  81. package/lib/host-packages/claude/openplanr/skills/design/references/review.md +6 -6
  82. package/lib/host-packages/claude/openplanr/skills/design/references/team-review.md +3 -4
  83. package/lib/host-packages/claude/openplanr/skills/design/references/utilities.md +78 -32
  84. package/lib/host-packages/claude/openplanr/skills/design-loop/SKILL.md +15 -7
  85. package/lib/host-packages/claude/openplanr/skills/design-loop/references/design-system.md +2 -2
  86. package/lib/host-packages/claude/openplanr/skills/design-loop/references/generation.md +3 -3
  87. package/lib/host-packages/claude/openplanr/skills/design-loop/references/review.md +6 -6
  88. package/lib/host-packages/claude/openplanr/skills/design-loop/references/team-review.md +3 -4
  89. package/lib/host-packages/claude/openplanr/skills/design-loop/references/utilities.md +78 -32
  90. package/lib/host-packages/claude/openplanr/skills/design-review/SKILL.md +25 -5
  91. package/lib/host-packages/claude/openplanr/skills/design-review/references/design-system.md +2 -2
  92. package/lib/host-packages/claude/openplanr/skills/design-review/references/generation.md +3 -3
  93. package/lib/host-packages/claude/openplanr/skills/design-review/references/review.md +6 -6
  94. package/lib/host-packages/claude/openplanr/skills/design-review/references/team-review.md +3 -4
  95. package/lib/host-packages/claude/openplanr/skills/design-review/references/utilities.md +78 -32
  96. package/lib/host-packages/claude/openplanr/skills/investigate/SKILL.md +1 -0
  97. package/lib/host-packages/claude/openplanr/skills/investigate/references/fail-first.md +40 -0
  98. package/lib/host-packages/claude/openplanr/skills/plan/SKILL.md +7 -3
  99. package/lib/host-packages/claude/openplanr/skills/ship/SKILL.md +22 -10
  100. package/lib/host-packages/claude/openplanr/skills/ship/references/fail-first.md +40 -0
  101. package/lib/host-packages/claude/openplanr/skills/ship/references/result-contract.md +7 -3
  102. package/lib/host-packages/cursor/openplanr/.openplanr-content.json +55 -427
  103. package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
  104. package/lib/host-packages/cursor/openplanr/rules/planr-artifact/references/design-sharing.md +2 -2
  105. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/integration-review.md +26 -20
  106. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/operator-guide.md +25 -1
  107. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/run-handoff.md +2 -2
  108. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/worktree-custody.md +17 -9
  109. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/claude.mjs +15 -3
  110. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/codex.mjs +38 -2
  111. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/native.mjs +5 -0
  112. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/custody.mjs +217 -10
  113. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/handoff.mjs +1080 -0
  114. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integrate.mjs +96 -201
  115. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integration-files.mjs +3 -382
  116. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/presentation.mjs +29 -12
  117. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-contract.mjs +11 -0
  118. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-execution.mjs +1 -1
  119. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-lifecycle.mjs +14 -10
  120. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-preparation.mjs +4 -0
  121. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-record.mjs +2 -2
  122. package/lib/host-packages/cursor/openplanr/rules/planr-delegate.mdc +2 -1
  123. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/design-system.md +2 -2
  124. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/generation.md +3 -3
  125. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/hosted-canvas.md +6 -3
  126. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/review.md +6 -6
  127. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/team-review.md +3 -4
  128. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/utilities.md +78 -32
  129. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/design-system.md +2 -2
  130. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/generation.md +3 -3
  131. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/review.md +6 -6
  132. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/team-review.md +3 -4
  133. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/utilities.md +78 -32
  134. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop.mdc +15 -7
  135. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/design-system.md +2 -2
  136. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/generation.md +3 -3
  137. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/review.md +6 -6
  138. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/team-review.md +3 -4
  139. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/utilities.md +78 -32
  140. package/lib/host-packages/cursor/openplanr/rules/planr-design-review.mdc +25 -5
  141. package/lib/host-packages/cursor/openplanr/rules/planr-design.mdc +23 -12
  142. package/lib/host-packages/cursor/openplanr/rules/planr-investigate/references/fail-first.md +40 -0
  143. package/lib/host-packages/cursor/openplanr/rules/planr-investigate.mdc +1 -0
  144. package/lib/host-packages/cursor/openplanr/rules/planr-plan.mdc +7 -3
  145. package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/fail-first.md +40 -0
  146. package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/result-contract.md +7 -3
  147. package/lib/host-packages/cursor/openplanr/rules/planr-ship.mdc +22 -10
  148. package/lib/host-packages/openai/.claude-plugin/marketplace.json +3 -3
  149. package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +2 -2
  150. package/lib/host-packages/openai/openplanr/.openplanr-content.json +62 -434
  151. package/lib/host-packages/openai/openplanr/skills/artifact/references/design-sharing.md +2 -2
  152. package/lib/host-packages/openai/openplanr/skills/delegate/SKILL.md +2 -1
  153. package/lib/host-packages/openai/openplanr/skills/delegate/openplanr.skill.json +1 -1
  154. package/lib/host-packages/openai/openplanr/skills/delegate/references/integration-review.md +26 -20
  155. package/lib/host-packages/openai/openplanr/skills/delegate/references/operator-guide.md +25 -1
  156. package/lib/host-packages/openai/openplanr/skills/delegate/references/run-handoff.md +2 -2
  157. package/lib/host-packages/openai/openplanr/skills/delegate/references/worktree-custody.md +17 -9
  158. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/claude.mjs +15 -3
  159. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/codex.mjs +38 -2
  160. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/native.mjs +5 -0
  161. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/custody.mjs +217 -10
  162. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/handoff.mjs +1080 -0
  163. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integrate.mjs +96 -201
  164. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integration-files.mjs +3 -382
  165. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/presentation.mjs +29 -12
  166. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-contract.mjs +11 -0
  167. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-execution.mjs +1 -1
  168. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-lifecycle.mjs +14 -10
  169. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-preparation.mjs +4 -0
  170. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-record.mjs +2 -2
  171. package/lib/host-packages/openai/openplanr/skills/design/SKILL.md +23 -12
  172. package/lib/host-packages/openai/openplanr/skills/design/openplanr.skill.json +0 -11
  173. package/lib/host-packages/openai/openplanr/skills/design/references/design-system.md +2 -2
  174. package/lib/host-packages/openai/openplanr/skills/design/references/generation.md +3 -3
  175. package/lib/host-packages/openai/openplanr/skills/design/references/hosted-canvas.md +6 -3
  176. package/lib/host-packages/openai/openplanr/skills/design/references/review.md +6 -6
  177. package/lib/host-packages/openai/openplanr/skills/design/references/team-review.md +3 -4
  178. package/lib/host-packages/openai/openplanr/skills/design/references/utilities.md +78 -32
  179. package/lib/host-packages/openai/openplanr/skills/design-loop/SKILL.md +15 -7
  180. package/lib/host-packages/openai/openplanr/skills/design-loop/openplanr.skill.json +0 -11
  181. package/lib/host-packages/openai/openplanr/skills/design-loop/references/design-system.md +2 -2
  182. package/lib/host-packages/openai/openplanr/skills/design-loop/references/generation.md +3 -3
  183. package/lib/host-packages/openai/openplanr/skills/design-loop/references/review.md +6 -6
  184. package/lib/host-packages/openai/openplanr/skills/design-loop/references/team-review.md +3 -4
  185. package/lib/host-packages/openai/openplanr/skills/design-loop/references/utilities.md +78 -32
  186. package/lib/host-packages/openai/openplanr/skills/design-review/SKILL.md +25 -5
  187. package/lib/host-packages/openai/openplanr/skills/design-review/openplanr.skill.json +0 -11
  188. package/lib/host-packages/openai/openplanr/skills/design-review/references/design-system.md +2 -2
  189. package/lib/host-packages/openai/openplanr/skills/design-review/references/generation.md +3 -3
  190. package/lib/host-packages/openai/openplanr/skills/design-review/references/review.md +6 -6
  191. package/lib/host-packages/openai/openplanr/skills/design-review/references/team-review.md +3 -4
  192. package/lib/host-packages/openai/openplanr/skills/design-review/references/utilities.md +78 -32
  193. package/lib/host-packages/openai/openplanr/skills/investigate/SKILL.md +1 -0
  194. package/lib/host-packages/openai/openplanr/skills/investigate/openplanr.skill.json +12 -1
  195. package/lib/host-packages/openai/openplanr/skills/investigate/references/fail-first.md +40 -0
  196. package/lib/host-packages/openai/openplanr/skills/plan/SKILL.md +7 -3
  197. package/lib/host-packages/openai/openplanr/skills/plan/openplanr.skill.json +0 -11
  198. package/lib/host-packages/openai/openplanr/skills/ship/SKILL.md +22 -10
  199. package/lib/host-packages/openai/openplanr/skills/ship/openplanr.skill.json +12 -1
  200. package/lib/host-packages/openai/openplanr/skills/ship/references/fail-first.md +40 -0
  201. package/lib/host-packages/openai/openplanr/skills/ship/references/result-contract.md +7 -3
  202. package/package.json +8 -8
  203. package/dist/dashboard/assets/index-BU5fzjyz.css +0 -1
  204. package/dist/dashboard/assets/index-B_96uzCl.js +0 -572
  205. package/dist/dashboard/assets/index-B_96uzCl.js.map +0 -1
  206. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1774
  207. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
  208. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
  209. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
  210. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
  211. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
  212. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-handoff.mjs +0 -1576
  213. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
  214. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
  215. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
  216. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
  217. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
  218. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review.mjs +0 -3385
  219. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -39
  220. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
  221. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
  222. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
  223. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs +0 -1113
  224. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs +0 -505
  225. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
  226. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
  227. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
  228. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design.mjs +0 -1430
  229. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2050
  230. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
  231. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
  232. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -809
  233. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -5693
  234. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
  235. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
  236. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/06-artifact-review-ui.js +0 -1755
  237. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
  238. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/08-artifact-review-ui.js +0 -2633
  239. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -124
  240. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
  241. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
  242. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
  243. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
  244. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -133
  245. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
  246. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
  247. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
  248. 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
  249. 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
  250. 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
  251. 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
  252. 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
  253. 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
  254. 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
  255. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
  256. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
  257. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
  258. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
  259. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
  260. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
  261. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
  262. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
  263. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
  264. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
  265. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
  266. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
  267. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
  268. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -159
  269. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
  270. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
  271. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
  272. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
  273. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  274. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
  275. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
  276. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
  277. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
  278. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
  279. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
  280. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
  281. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
  282. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
  283. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
  284. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
  285. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
  286. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
  287. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
  288. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
  289. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
  290. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
  291. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
  292. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -5468
  293. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design.mjs +0 -2844
  294. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
  295. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -159
  296. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  297. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integration-transaction.mjs +0 -958
  298. package/lib/host-packages/claude/openplanr/skills/design/scripts/design.mjs +0 -12
  299. package/lib/host-packages/claude/openplanr/skills/design-loop/scripts/design.mjs +0 -12
  300. package/lib/host-packages/claude/openplanr/skills/design-review/scripts/design.mjs +0 -12
  301. package/lib/host-packages/claude/openplanr/skills/plan/scripts/design.mjs +0 -12
  302. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integration-transaction.mjs +0 -958
  303. package/lib/host-packages/cursor/openplanr/rules/planr-design/scripts/design.mjs +0 -12
  304. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/scripts/design.mjs +0 -12
  305. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/scripts/design.mjs +0 -12
  306. package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/design.mjs +0 -12
  307. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1774
  308. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
  309. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
  310. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
  311. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
  312. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
  313. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-handoff.mjs +0 -1576
  314. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
  315. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
  316. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
  317. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
  318. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
  319. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review.mjs +0 -3385
  320. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -39
  321. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
  322. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
  323. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
  324. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs +0 -1113
  325. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs +0 -505
  326. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
  327. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
  328. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
  329. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design.mjs +0 -1430
  330. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2050
  331. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
  332. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
  333. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -809
  334. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -5693
  335. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
  336. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
  337. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/06-artifact-review-ui.js +0 -1755
  338. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
  339. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/08-artifact-review-ui.js +0 -2633
  340. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -124
  341. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
  342. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
  343. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
  344. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
  345. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -133
  346. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
  347. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
  348. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
  349. 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
  350. 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
  351. 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
  352. 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
  353. 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
  354. 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
  355. 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
  356. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
  357. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
  358. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
  359. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
  360. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
  361. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
  362. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
  363. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
  364. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
  365. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
  366. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
  367. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
  368. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
  369. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -159
  370. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
  371. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
  372. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
  373. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
  374. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  375. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
  376. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
  377. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
  378. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
  379. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
  380. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
  381. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
  382. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
  383. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
  384. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
  385. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
  386. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
  387. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
  388. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
  389. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
  390. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
  391. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
  392. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
  393. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -5468
  394. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design.mjs +0 -2844
  395. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
  396. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -159
  397. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  398. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1774
  399. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
  400. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
  401. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
  402. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
  403. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
  404. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-handoff.mjs +0 -1576
  405. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
  406. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
  407. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
  408. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
  409. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
  410. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review.mjs +0 -3385
  411. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -39
  412. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
  413. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
  414. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
  415. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs +0 -1113
  416. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs +0 -505
  417. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
  418. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
  419. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
  420. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design.mjs +0 -1430
  421. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2050
  422. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
  423. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
  424. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -809
  425. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -5693
  426. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
  427. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
  428. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/06-artifact-review-ui.js +0 -1755
  429. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
  430. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/08-artifact-review-ui.js +0 -2633
  431. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -124
  432. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
  433. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
  434. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
  435. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
  436. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -133
  437. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
  438. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
  439. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
  440. 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
  441. 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
  442. 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
  443. 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
  444. 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
  445. 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
  446. 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
  447. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
  448. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
  449. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
  450. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
  451. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
  452. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
  453. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
  454. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
  455. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
  456. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
  457. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
  458. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
  459. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
  460. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -159
  461. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
  462. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
  463. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
  464. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
  465. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  466. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
  467. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
  468. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
  469. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
  470. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
  471. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
  472. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
  473. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
  474. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
  475. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
  476. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
  477. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
  478. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
  479. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
  480. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
  481. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
  482. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
  483. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
  484. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -5468
  485. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design.mjs +0 -2844
  486. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
  487. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -159
  488. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  489. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integration-transaction.mjs +0 -958
  490. package/lib/host-packages/openai/openplanr/skills/design/scripts/design.mjs +0 -12
  491. package/lib/host-packages/openai/openplanr/skills/design-loop/scripts/design.mjs +0 -12
  492. package/lib/host-packages/openai/openplanr/skills/design-review/scripts/design.mjs +0 -12
  493. package/lib/host-packages/openai/openplanr/skills/plan/scripts/design.mjs +0 -12
@@ -1,2844 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- DESIGN_DOCUMENT_SCHEMA,
4
- DESIGN_DOCUMENT_V120_SCHEMA,
5
- DESIGN_REVIEW_BUNDLE_SCHEMA,
6
- LARGE_OBJECT_LIMITS,
7
- assertPlainData,
8
- canonicalizeJson,
9
- validateJson
10
- } from "./design-protocol-contracts.mjs";
11
-
12
- // packages/design/lib/design/plan-handoff-utility.mjs
13
- import { realpathSync as realpathSync5 } from "node:fs";
14
- import { resolve as resolve6 } from "node:path";
15
- import { fileURLToPath } from "node:url";
16
-
17
- // packages/design/lib/design/handoff-reader.mjs
18
- import { existsSync as existsSync5, readFileSync as readFileSync6 } from "node:fs";
19
- import { dirname as dirname6, join as join8 } from "node:path";
20
-
21
- // packages/artifact/lib/artifact/envelope.mjs
22
- import { createHash } from "node:crypto";
23
-
24
- // packages/protocol/src/errors.mjs
25
- var ARTIFACT_ERROR_CODES = Object.freeze({
26
- INPUT_INVALID: "E_ARTIFACT_INPUT_INVALID",
27
- FILE_MISSING: "E_ARTIFACT_FILE_MISSING",
28
- ROOT_MISSING: "E_ARTIFACT_ROOT_MISSING",
29
- PATH_TRAVERSAL: "E_ARTIFACT_PATH_TRAVERSAL",
30
- SYMLINK_ESCAPE: "E_ARTIFACT_SYMLINK_ESCAPE",
31
- EXTERNAL_ASSET: "E_ARTIFACT_EXTERNAL_ASSET",
32
- UNRESOLVED_ASSET: "E_ARTIFACT_UNRESOLVED_ASSET",
33
- UNSUPPORTED_MODULE: "E_ARTIFACT_UNSUPPORTED_MODULE",
34
- UNSAFE_HTML: "E_ARTIFACT_UNSAFE_HTML",
35
- FILE_LIMIT: "E_ARTIFACT_FILE_LIMIT",
36
- BYTE_LIMIT: "E_ARTIFACT_BYTE_LIMIT",
37
- OUTPUT_LIMIT: "E_ARTIFACT_OUTPUT_LIMIT",
38
- REDACTION: "E_ARTIFACT_REDACTION",
39
- ENVELOPE_INVALID: "E_ARTIFACT_ENVELOPE_INVALID",
40
- SCHEMA_UNSUPPORTED: "E_ARTIFACT_SCHEMA_UNSUPPORTED",
41
- LOOPBACK_BIND: "E_ARTIFACT_LOOPBACK_BIND",
42
- LOOPBACK_STATE: "E_ARTIFACT_LOOPBACK_STATE",
43
- PORT_IN_USE: "E_ARTIFACT_PORT_IN_USE",
44
- SESSION_TOKEN: "E_ARTIFACT_SESSION_TOKEN",
45
- SESSION_NOT_FOUND: "E_ARTIFACT_SESSION_NOT_FOUND",
46
- REQUEST_INVALID: "E_ARTIFACT_REQUEST_INVALID",
47
- REQUEST_LIMIT: "E_ARTIFACT_REQUEST_LIMIT",
48
- SANDBOX_POLICY: "E_ARTIFACT_SANDBOX_POLICY",
49
- BRIDGE_INVALID: "E_ARTIFACT_BRIDGE_INVALID",
50
- REVIEW_INVALID: "E_ARTIFACT_REVIEW_INVALID",
51
- REVIEW_WRITE: "E_ARTIFACT_REVIEW_WRITE",
52
- REVIEW_IMPORT: "E_ARTIFACT_REVIEW_IMPORT",
53
- REVIEW_DECODER_REQUIRED: "E_ARTIFACT_REVIEW_DECODER_REQUIRED",
54
- REVIEW_EXPORT: "E_ARTIFACT_REVIEW_EXPORT",
55
- DIGEST_MISMATCH: "E_ARTIFACT_DIGEST_MISMATCH",
56
- STALE_REVIEW: "E_ARTIFACT_STALE_REVIEW",
57
- MERGE_CONFLICT: "E_ARTIFACT_MERGE_CONFLICT",
58
- CODEC_INVALID: "E_ARTIFACT_CODEC_INVALID",
59
- CODEC_UNAVAILABLE: "E_ARTIFACT_CODEC_UNAVAILABLE",
60
- CODEC_FAILED: "E_ARTIFACT_CODEC_FAILED",
61
- FRAGMENT_INVALID: "E_ARTIFACT_FRAGMENT_INVALID",
62
- FRAGMENT_VERSION_UNSUPPORTED: "E_ARTIFACT_FRAGMENT_VERSION_UNSUPPORTED",
63
- FRAGMENT_TOO_LARGE: "E_ARTIFACT_FRAGMENT_TOO_LARGE",
64
- DECOMPRESSION_LIMIT: "E_ARTIFACT_DECOMPRESSION_LIMIT",
65
- BROWSER_UNSUPPORTED: "E_ARTIFACT_BROWSER_UNSUPPORTED",
66
- ENCRYPTION_FAILED: "E_ARTIFACT_ENCRYPTION_FAILED",
67
- DECRYPTION_FAILED: "E_ARTIFACT_DECRYPTION_FAILED",
68
- CONFIRMATION_REQUIRED: "E_ARTIFACT_CONFIRMATION_REQUIRED",
69
- SHORT_CONFIRMATION_REQUIRED: "E_ARTIFACT_SHORT_CONFIRMATION_REQUIRED",
70
- PASTE_INVALID: "E_ARTIFACT_PASTE_INVALID",
71
- PASTE_UNAVAILABLE: "E_ARTIFACT_PASTE_UNAVAILABLE",
72
- PASTE_EXPIRED: "E_ARTIFACT_PASTE_EXPIRED",
73
- PASTE_LIMIT: "E_ARTIFACT_PASTE_LIMIT",
74
- SHARE_NETWORK: "E_ARTIFACT_SHARE_NETWORK",
75
- ROOM_CREATE_AMBIGUOUS: "E_ARTIFACT_ROOM_CREATE_AMBIGUOUS",
76
- ROOM_INVALID: "E_ARTIFACT_ROOM_INVALID",
77
- ROOM_UNAVAILABLE: "E_ARTIFACT_ROOM_UNAVAILABLE",
78
- ROOM_EXPIRED: "E_ARTIFACT_ROOM_EXPIRED",
79
- ROOM_CLOSED: "E_ARTIFACT_ROOM_CLOSED",
80
- ROOM_LEGACY_READ_ONLY: "E_ARTIFACT_ROOM_LEGACY_READ_ONLY",
81
- ROOM_FORBIDDEN: "E_ARTIFACT_ROOM_FORBIDDEN",
82
- ROOM_EVENT_INVALID: "E_ARTIFACT_ROOM_EVENT_INVALID",
83
- ROOM_EVENT_REPLAY: "E_ARTIFACT_ROOM_EVENT_REPLAY"
84
- });
85
- var PROTOCOL_ERROR_CODES = Object.freeze({
86
- ASSET_NOT_FOUND: "E_PROTOCOL_ASSET_NOT_FOUND",
87
- DIGEST_MISMATCH: "E_PROTOCOL_DIGEST_MISMATCH",
88
- DOCUMENT_INVALID: "E_PROTOCOL_DOCUMENT_INVALID",
89
- DOCUMENT_VERSION_UNSUPPORTED: "E_PROTOCOL_DOCUMENT_VERSION_UNSUPPORTED",
90
- DUPLICATE_ID: "E_PROTOCOL_DUPLICATE_ID",
91
- REFERENCE_INVALID: "E_PROTOCOL_REFERENCE_INVALID",
92
- REGISTRY_INVALID: "E_PROTOCOL_REGISTRY_INVALID",
93
- SCHEMA_INVALID: "E_PROTOCOL_SCHEMA_INVALID",
94
- SCHEMA_UNKNOWN: "E_SCHEMA_UNKNOWN",
95
- SCHEMA_VERSION_UNSUPPORTED: "E_SCHEMA_VERSION_UNSUPPORTED",
96
- SORT_ORDER_INVALID: "E_PROTOCOL_SORT_ORDER_INVALID"
97
- });
98
- var PipelineError = class extends Error {
99
- constructor(code, message2, fix = "", details = void 0) {
100
- super(message2);
101
- this.name = "PipelineError";
102
- this.code = code;
103
- this.fix = fix;
104
- if (details !== void 0) this.details = details;
105
- }
106
- toJSON() {
107
- return {
108
- ok: false,
109
- code: this.code,
110
- problem: this.message,
111
- ...this.fix ? { fix: this.fix } : {},
112
- ...this.details === void 0 ? {} : { details: this.details }
113
- };
114
- }
115
- };
116
-
117
- // packages/artifact/lib/artifact/artifact-sources.mjs
118
- var ARTIFACT_SHARED_ENVELOPE_VERSION = "1.1.0";
119
-
120
- // packages/artifact/lib/artifact/internal/schema-loader.mjs
121
- import { fileURLToPath as __planrAssetFile } from "node:url";
122
- import { readFileSync } from "node:fs";
123
- import { createRequire } from "node:module";
124
- import { dirname, join } from "node:path";
125
- var require2 = createRequire(new URL("./runtime/packages/artifact/lib/artifact/internal/schema-loader.mjs", import.meta.url).href);
126
- var protocolPackageRoot = dirname(__planrAssetFile(new URL("./runtime/packages/protocol/package.json", import.meta.url)));
127
- var SCHEMAS_ROOT = join(protocolPackageRoot, "schemas");
128
- var DEFAULT_SCHEMA_VERSIONS = Object.freeze(["v1.0.0", "v1.1.0"]);
129
- var schemaCache = /* @__PURE__ */ new Map();
130
- function parseSchemaReference(name, version) {
131
- if (typeof name !== "string" || !/^[a-z0-9-]+(?:\.schema\.json)?$/i.test(name)) {
132
- throw new Error(`invalid schema name: ${String(name)}`);
133
- }
134
- const cleanName = name.replace(/\.schema\.json$/i, "");
135
- if (version !== void 0 && !/^v\d+\.\d+\.\d+$/.test(version)) {
136
- throw new Error(`invalid schema version: ${String(version)}`);
137
- }
138
- return { cleanName, versions: version ? [version] : DEFAULT_SCHEMA_VERSIONS };
139
- }
140
- function loadSchema(name, version = void 0) {
141
- if (typeof name === "string" && name.includes("/")) {
142
- const [qualifiedVersion, qualifiedName, ...rest] = name.split("/");
143
- if (rest.length > 0 || version !== void 0)
144
- throw new Error(`invalid schema reference: ${name}`);
145
- return loadSchema(qualifiedName, qualifiedVersion);
146
- }
147
- const { cleanName, versions } = parseSchemaReference(name, version);
148
- for (const candidateVersion of versions) {
149
- const key = `${candidateVersion}/${cleanName}`;
150
- if (schemaCache.has(key)) return schemaCache.get(key);
151
- const path = join(SCHEMAS_ROOT, candidateVersion, `${cleanName}.schema.json`);
152
- try {
153
- const schema2 = JSON.parse(readFileSync(path, "utf-8"));
154
- schemaCache.set(key, schema2);
155
- return schema2;
156
- } catch (error) {
157
- if (error?.code !== "ENOENT") throw error;
158
- }
159
- }
160
- throw new Error(`unknown schema: ${cleanName}${version ? ` (${version})` : ""}`);
161
- }
162
- function validate(data, schemaName, version = void 0) {
163
- return validateJson(data, loadSchema(schemaName, version));
164
- }
165
-
166
- // packages/artifact/lib/artifact/envelope.mjs
167
- var textEncoder = new TextEncoder();
168
- var SHA256_RE = /^[a-f0-9]{64}$/;
169
- var MAX_ARTIFACT_HTML_BYTES = LARGE_OBJECT_LIMITS.uniqueHtmlBytes;
170
- var MAX_PINS = 1e4;
171
- var MAX_REPLIES = 1e4;
172
- var MAX_PASTE_BYTES = 5 * 1024 * 1024;
173
- var ARTIFACT_PRESENTATIONS = Object.freeze(["document", "canvas"]);
174
- var ARTIFACT_DOCUMENT_MAX_HEIGHT = 262144;
175
- function invalid(message2, details = void 0) {
176
- throw new PipelineError(ARTIFACT_ERROR_CODES.ENVELOPE_INVALID, message2, "", details);
177
- }
178
- function assertBoundedString(value, label, { min = 0, max, pattern } = {}) {
179
- if (typeof value !== "string" || value.length < min || max !== void 0 && value.length > max || pattern && !pattern.test(value)) {
180
- invalid(`${label} is outside its allowed string bounds.`);
181
- }
182
- }
183
- function assertViewport(viewport, label, { maxHeight = 16384 } = {}) {
184
- if (!viewport || !Number.isInteger(viewport.width) || !Number.isInteger(viewport.height) || viewport.width < 1 || viewport.width > 16384 || viewport.height < 1 || viewport.height > maxHeight) {
185
- invalid(
186
- `${label} must have an integer width from 1 through 16384 pixels and height from 1 through ${maxHeight} pixels.`
187
- );
188
- }
189
- }
190
- function sha256Hex(bytes) {
191
- return createHash("sha256").update(bytes).digest("hex");
192
- }
193
- function canonicalObject(value) {
194
- if (Array.isArray(value)) return value.map(canonicalObject);
195
- if (!value || typeof value !== "object") return value;
196
- return Object.fromEntries(
197
- Object.keys(value).sort().map((key) => [key, canonicalObject(value[key])])
198
- );
199
- }
200
- function canonicalSerialize(value) {
201
- return JSON.stringify(canonicalObject(value));
202
- }
203
- function canonicalBytes(value) {
204
- return textEncoder.encode(canonicalSerialize(value));
205
- }
206
- function envelopeWithoutReview(envelope) {
207
- return {
208
- schemaVersion: envelope.schemaVersion,
209
- ...envelope.schemaVersion === ARTIFACT_SHARED_ENVELOPE_VERSION ? { sources: envelope.sources } : {},
210
- artifacts: envelope.artifacts,
211
- viewer: envelope.viewer
212
- };
213
- }
214
- function canonicalEnvelopeBytes(envelope, { includeReview = false } = {}) {
215
- const value = includeReview ? envelope : envelopeWithoutReview(envelope);
216
- return canonicalBytes(value);
217
- }
218
- function digestArtifactEnvelope(envelope) {
219
- return sha256Hex(canonicalEnvelopeBytes(envelope));
220
- }
221
- function validateArtifactReview(review) {
222
- const issues = validate(review, "artifact-review", "v1.1.0");
223
- if (issues.length > 0) {
224
- throw new PipelineError(
225
- ARTIFACT_ERROR_CODES.ENVELOPE_INVALID,
226
- `Invalid artifact review at ${issues[0].path}: ${issues[0].detail}`,
227
- "",
228
- { issues }
229
- );
230
- }
231
- assertBoundedString(review.reviewId, "reviewId", { min: 1, max: 128 });
232
- assertBoundedString(review.reviewOf, "reviewOf", { min: 64, max: 64, pattern: SHA256_RE });
233
- assertBoundedString(review.overall, "overall", { max: 65536 });
234
- if (!Array.isArray(review.pins) || review.pins.length > MAX_PINS)
235
- invalid(`Review pins exceed ${MAX_PINS}.`);
236
- for (const [pinIndex, pin] of review.pins.entries()) {
237
- const label = `pins[${pinIndex}]`;
238
- assertBoundedString(pin.id, `${label}.id`, { min: 1, max: 128 });
239
- assertBoundedString(pin.author?.id ?? "", `${label}.author.id`, { max: 128 });
240
- assertBoundedString(pin.author?.name, `${label}.author.name`, { min: 1, max: 256 });
241
- assertBoundedString(pin.artifactId, `${label}.artifactId`, { min: 1, max: 128 });
242
- if (pin.variant !== void 0)
243
- assertBoundedString(pin.variant, `${label}.variant`, { min: 1, max: 128 });
244
- assertBoundedString(pin.comment, `${label}.comment`, { min: 1, max: 65536 });
245
- if (pin.anchor) {
246
- assertBoundedString(pin.anchor.planrId, `${label}.anchor.planrId`, { min: 1, max: 512 });
247
- if (pin.anchor.screen !== void 0)
248
- assertBoundedString(pin.anchor.screen, `${label}.anchor.screen`, { min: 1, max: 128 });
249
- }
250
- assertViewport(pin.viewport, `${label}.viewport`, { maxHeight: ARTIFACT_DOCUMENT_MAX_HEIGHT });
251
- for (const coordinate of ["x", "y", "w", "h"]) {
252
- const value = pin.region?.[coordinate];
253
- if (typeof value !== "number" || !Number.isFinite(value) || value < 0 || value > 1) {
254
- invalid(`${label}.region.${coordinate} must be a finite normalized coordinate.`);
255
- }
256
- }
257
- if (pin.region.x + pin.region.w > 1 || pin.region.y + pin.region.h > 1) {
258
- invalid(`${label}.region must remain inside normalized artifact bounds.`);
259
- }
260
- if (!Array.isArray(pin.replies) || pin.replies.length > MAX_REPLIES)
261
- invalid(`${label}.replies exceeds ${MAX_REPLIES}.`);
262
- for (const [replyIndex, reply] of pin.replies.entries()) {
263
- const replyLabel = `${label}.replies[${replyIndex}]`;
264
- assertBoundedString(reply.id, `${replyLabel}.id`, { min: 1, max: 128 });
265
- assertBoundedString(reply.author?.id ?? "", `${replyLabel}.author.id`, { max: 128 });
266
- assertBoundedString(reply.author?.name, `${replyLabel}.author.name`, { min: 1, max: 256 });
267
- assertBoundedString(reply.comment, `${replyLabel}.comment`, { min: 1, max: 65536 });
268
- }
269
- }
270
- return review;
271
- }
272
-
273
- // packages/protocol/src/review-experience-contracts.mjs
274
- var text = { type: "string", maxLength: 16384 };
275
- var id = { type: "string", minLength: 1, maxLength: 128 };
276
- var digest = { type: "string", pattern: "^[a-f0-9]{64}$" };
277
- var texts = { type: "array", maxItems: 256, items: text };
278
- var closed = (properties, required = Object.keys(properties)) => ({
279
- type: "object",
280
- additionalProperties: false,
281
- properties,
282
- required
283
- });
284
- var list = (items, maxItems = 256) => ({ type: "array", maxItems, items });
285
- var schema = (name, properties, required) => ({
286
- $schema: "https://json-schema.org/draft/2020-12/schema",
287
- $id: `https://openplanr.dev/schemas/v1.10.0/${name}.schema.json`,
288
- "x-openplanr-contract": { id: name, version: "1.10.0" },
289
- ...closed(properties, required)
290
- });
291
- var DESIGN_REVIEW_CONTEXT_SCHEMA = schema(
292
- "design-review-context",
293
- {
294
- kind: { const: "openplanr-design-review-context" },
295
- schemaVersion: { const: "1.0.0" },
296
- designId: id,
297
- brief: closed({ purpose: text, requests: { ...texts, maxItems: 3 }, audience: text }, [
298
- "purpose",
299
- "requests"
300
- ]),
301
- revisionSummary: text,
302
- implementation: closed({
303
- tokens: list(closed({ name: id, value: text, description: text }, ["name", "value"]), 512),
304
- components: list(
305
- closed(
306
- {
307
- id,
308
- name: text,
309
- screenIds: list(id),
310
- anchorIds: list(id),
311
- states: list(closed({ name: id, description: text })),
312
- notes: text,
313
- responsive: text,
314
- accessibility: text
315
- },
316
- ["id", "name"]
317
- )
318
- ),
319
- responsive: texts,
320
- accessibility: texts
321
- })
322
- },
323
- ["kind", "schemaVersion", "designId", "brief", "implementation"]
324
- );
325
- var DESIGN_FINGERPRINT_SCHEMA = closed({
326
- screenId: id,
327
- variantId: id,
328
- frameId: id,
329
- contentDigest: digest,
330
- guidanceDigest: digest
331
- });
332
- var bundleV11 = {
333
- .../** @type {MutableSchema} */
334
- structuredClone(DESIGN_REVIEW_BUNDLE_SCHEMA),
335
- $id: "https://openplanr.dev/schemas/v1.10.0/design-review-bundle.schema.json",
336
- "x-openplanr-contract": { id: "design-review-bundle", version: "1.10.0" }
337
- };
338
- Object.assign(bundleV11.properties, {
339
- schemaVersion: { const: "1.1.0" },
340
- reviewContext: DESIGN_REVIEW_CONTEXT_SCHEMA,
341
- contextDigest: digest,
342
- fingerprints: list(DESIGN_FINGERPRINT_SCHEMA)
343
- });
344
- bundleV11.required.push("reviewContext", "contextDigest", "fingerprints");
345
- var DESIGN_REVIEW_BUNDLE_V11_SCHEMA = bundleV11;
346
- var bundleV12 = (
347
- /** @type {MutableSchema} */
348
- structuredClone(DESIGN_REVIEW_BUNDLE_V11_SCHEMA)
349
- );
350
- bundleV12.$id = "https://openplanr.dev/schemas/v1.16.0/design-review-bundle.schema.json";
351
- bundleV12["x-openplanr-contract"] = { id: "design-review-bundle", version: "1.16.0" };
352
- Object.assign(bundleV12.properties, {
353
- schemaVersion: { const: "1.2.0" },
354
- envelope: {
355
- type: "object",
356
- required: ["schemaVersion", "sources", "artifacts", "viewer"],
357
- properties: { schemaVersion: { const: "1.1.0" } }
358
- },
359
- entries: {
360
- .../** @type {Record<string, unknown>} */
361
- bundleV12.properties.entries,
362
- maxItems: 4096
363
- },
364
- fingerprints: list(DESIGN_FINGERPRINT_SCHEMA, 4096)
365
- });
366
- var bundleCurrent = (
367
- /** @type {MutableSchema} */
368
- structuredClone(bundleV12)
369
- );
370
- bundleCurrent.$id = "https://openplanr.dev/schemas/v1.20.0/design-review-bundle.schema.json";
371
- bundleCurrent["x-openplanr-contract"] = { id: "design-review-bundle", version: "1.20.0" };
372
- bundleCurrent.properties.schemaVersion = { enum: ["1.1.0", "1.2.0"] };
373
- bundleCurrent.properties.envelope = bundleV11.properties.envelope;
374
- bundleCurrent.allOf = [
375
- {
376
- if: { properties: { schemaVersion: { const: "1.2.0" } } },
377
- then: { properties: { envelope: bundleV12.properties.envelope } }
378
- }
379
- ];
380
- var currentDesign = (
381
- /** @type {MutableSchema} */
382
- bundleCurrent.properties.design
383
- );
384
- for (const key of ["frames", "layout"])
385
- currentDesign.properties[key] = /** @type {Record<string, unknown>} */
386
- DESIGN_DOCUMENT_V120_SCHEMA.properties[key];
387
- bundleCurrent.$defs = structuredClone(DESIGN_DOCUMENT_V120_SCHEMA.$defs);
388
- var currentEntries = (
389
- /** @type {{ items: { properties: Record<string, unknown> } }} */
390
- bundleCurrent.properties.entries
391
- );
392
- currentEntries.items.properties.height = { const: "auto" };
393
- var bundleProps = (
394
- /** @type {MutableSchema} */
395
- structuredClone(bundleCurrent)
396
- );
397
- bundleProps.$id = "https://openplanr.dev/schemas/v1.22.0/design-review-bundle.schema.json";
398
- bundleProps["x-openplanr-contract"] = { id: "design-review-bundle", version: "1.22.0" };
399
- var propsDesign = (
400
- /** @type {MutableSchema} */
401
- bundleProps.properties.design
402
- );
403
- var authoredProperties = (
404
- /** @type {Record<string, unknown>} */
405
- DESIGN_DOCUMENT_SCHEMA.properties
406
- );
407
- propsDesign.properties.schemaVersion = authoredProperties.schemaVersion;
408
- for (const key of ["screens", "variants"]) {
409
- const projected = (
410
- /** @type {{ items: { properties: Record<string, unknown> } }} */
411
- propsDesign.properties[key]
412
- );
413
- const authored = (
414
- /** @type {{ items: { properties: Record<string, unknown> } }} */
415
- authoredProperties[key]
416
- );
417
- projected.items.properties.props = authored.items.properties.props;
418
- }
419
- propsDesign.allOf = structuredClone(DESIGN_DOCUMENT_SCHEMA.allOf);
420
- var item = closed(
421
- {
422
- pinId: id,
423
- reviewId: id,
424
- screenId: id,
425
- revisionId: id,
426
- text,
427
- refinement: text,
428
- stale: { type: "boolean" },
429
- author: text,
430
- reviewOf: digest,
431
- source: text
432
- },
433
- ["pinId", "text"]
434
- );
435
- var DESIGN_HANDOFF_CONTENT_SCHEMA = closed({
436
- summary: text,
437
- agreedChanges: list(item, 1e4),
438
- openQuestions: list(item, 1e4),
439
- deferred: list(item, 1e4),
440
- rejected: list(item, 1e4)
441
- });
442
- var DESIGN_HANDOFF_SCHEMA = schema(
443
- "design-review-handoff",
444
- {
445
- kind: { const: "openplanr-design-review-handoff" },
446
- schemaVersion: { const: "1.0.0" },
447
- title: text,
448
- version: { type: "integer", minimum: 1 },
449
- status: { enum: ["draft", "approved"] },
450
- basis: closed({
451
- designId: id,
452
- sourceRevision: digest,
453
- contextDigest: digest,
454
- reviewOf: digest,
455
- selectedVariant: id,
456
- feedbackDigest: digest,
457
- verificationDigest: digest,
458
- feedbackWatermark: { type: "integer", minimum: 0 }
459
- }),
460
- content: DESIGN_HANDOFF_CONTENT_SCHEMA,
461
- contentHash: digest,
462
- markdown: { type: "string", maxLength: 2097152 },
463
- affectedScreens: list(id),
464
- verificationGaps: texts,
465
- reviewNotes: list(closed({ reviewId: id, text }), 1e4),
466
- approval: closed({ contentHash: digest, at: { type: "string", format: "date-time" } })
467
- },
468
- [
469
- "kind",
470
- "schemaVersion",
471
- "title",
472
- "version",
473
- "status",
474
- "basis",
475
- "content",
476
- "contentHash",
477
- "markdown",
478
- "affectedScreens",
479
- "verificationGaps",
480
- "reviewNotes"
481
- ]
482
- );
483
- var DESIGN_REVIEW_METADATA_PAYLOAD_SCHEMA = {
484
- ...schema(
485
- "design-review-metadata-payload",
486
- {
487
- schemaVersion: { const: "1.0.0" },
488
- kind: { enum: ["category", "disposition"] },
489
- author: { ...text, minLength: 1, maxLength: 160 },
490
- reviewOf: digest,
491
- pinId: id,
492
- category: { enum: ["question", "suggestion", "blocker"] },
493
- disposition: { enum: ["accepted", "deferred", "rejected"] },
494
- reason: text,
495
- updatedAt: { type: "string", format: "date-time" }
496
- },
497
- ["schemaVersion", "kind", "author", "reviewOf", "pinId", "updatedAt"]
498
- ),
499
- allOf: [
500
- {
501
- if: { properties: { kind: { const: "category" } } },
502
- then: { required: ["category"], not: { required: ["disposition"] } }
503
- },
504
- {
505
- if: { properties: { kind: { const: "disposition" } } },
506
- then: { required: ["disposition", "reason"], not: { required: ["category"] } }
507
- }
508
- ]
509
- };
510
- var payloadV11 = {
511
- .../** @type {MutableSchema} */
512
- structuredClone(DESIGN_REVIEW_METADATA_PAYLOAD_SCHEMA),
513
- $id: "https://openplanr.dev/schemas/v1.11.0/design-review-metadata-payload.schema.json",
514
- "x-openplanr-contract": { id: "design-review-metadata-payload", version: "1.11.0" }
515
- };
516
- Object.assign(payloadV11.properties, {
517
- schemaVersion: { const: "1.1.0" },
518
- category: { enum: ["question", "suggestion", "change-request", "blocker"] }
519
- });
520
- function assertReviewExperience(value, contract) {
521
- const errors = validateJson(value, contract);
522
- if (errors.length)
523
- throw new TypeError(
524
- `Invalid ${contract["x-openplanr-contract"]?.id ?? "review data"}: ${errors.slice(0, 4).map((item2) => `${item2.path} ${item2.detail}`).join("; ")}`
525
- );
526
- return value;
527
- }
528
- var REVIEW_EXPERIENCE_SCHEMAS = Object.freeze({
529
- "design-review-context": DESIGN_REVIEW_CONTEXT_SCHEMA,
530
- "design-review-bundle": DESIGN_REVIEW_BUNDLE_V11_SCHEMA,
531
- "design-review-handoff": DESIGN_HANDOFF_SCHEMA,
532
- "design-review-metadata-payload": DESIGN_REVIEW_METADATA_PAYLOAD_SCHEMA
533
- });
534
-
535
- // packages/design/lib/design/context.mjs
536
- import { createHash as createHash2 } from "node:crypto";
537
-
538
- // node_modules/parse5/dist/common/unicode.js
539
- var CODE_POINTS;
540
- (function(CODE_POINTS2) {
541
- CODE_POINTS2[CODE_POINTS2["EOF"] = -1] = "EOF";
542
- CODE_POINTS2[CODE_POINTS2["NULL"] = 0] = "NULL";
543
- CODE_POINTS2[CODE_POINTS2["TABULATION"] = 9] = "TABULATION";
544
- CODE_POINTS2[CODE_POINTS2["CARRIAGE_RETURN"] = 13] = "CARRIAGE_RETURN";
545
- CODE_POINTS2[CODE_POINTS2["LINE_FEED"] = 10] = "LINE_FEED";
546
- CODE_POINTS2[CODE_POINTS2["FORM_FEED"] = 12] = "FORM_FEED";
547
- CODE_POINTS2[CODE_POINTS2["SPACE"] = 32] = "SPACE";
548
- CODE_POINTS2[CODE_POINTS2["EXCLAMATION_MARK"] = 33] = "EXCLAMATION_MARK";
549
- CODE_POINTS2[CODE_POINTS2["QUOTATION_MARK"] = 34] = "QUOTATION_MARK";
550
- CODE_POINTS2[CODE_POINTS2["AMPERSAND"] = 38] = "AMPERSAND";
551
- CODE_POINTS2[CODE_POINTS2["APOSTROPHE"] = 39] = "APOSTROPHE";
552
- CODE_POINTS2[CODE_POINTS2["HYPHEN_MINUS"] = 45] = "HYPHEN_MINUS";
553
- CODE_POINTS2[CODE_POINTS2["SOLIDUS"] = 47] = "SOLIDUS";
554
- CODE_POINTS2[CODE_POINTS2["DIGIT_0"] = 48] = "DIGIT_0";
555
- CODE_POINTS2[CODE_POINTS2["DIGIT_9"] = 57] = "DIGIT_9";
556
- CODE_POINTS2[CODE_POINTS2["SEMICOLON"] = 59] = "SEMICOLON";
557
- CODE_POINTS2[CODE_POINTS2["LESS_THAN_SIGN"] = 60] = "LESS_THAN_SIGN";
558
- CODE_POINTS2[CODE_POINTS2["EQUALS_SIGN"] = 61] = "EQUALS_SIGN";
559
- CODE_POINTS2[CODE_POINTS2["GREATER_THAN_SIGN"] = 62] = "GREATER_THAN_SIGN";
560
- CODE_POINTS2[CODE_POINTS2["QUESTION_MARK"] = 63] = "QUESTION_MARK";
561
- CODE_POINTS2[CODE_POINTS2["LATIN_CAPITAL_A"] = 65] = "LATIN_CAPITAL_A";
562
- CODE_POINTS2[CODE_POINTS2["LATIN_CAPITAL_Z"] = 90] = "LATIN_CAPITAL_Z";
563
- CODE_POINTS2[CODE_POINTS2["RIGHT_SQUARE_BRACKET"] = 93] = "RIGHT_SQUARE_BRACKET";
564
- CODE_POINTS2[CODE_POINTS2["GRAVE_ACCENT"] = 96] = "GRAVE_ACCENT";
565
- CODE_POINTS2[CODE_POINTS2["LATIN_SMALL_A"] = 97] = "LATIN_SMALL_A";
566
- CODE_POINTS2[CODE_POINTS2["LATIN_SMALL_Z"] = 122] = "LATIN_SMALL_Z";
567
- })(CODE_POINTS || (CODE_POINTS = {}));
568
-
569
- // node_modules/parse5/dist/common/error-codes.js
570
- var ERR;
571
- (function(ERR2) {
572
- ERR2["controlCharacterInInputStream"] = "control-character-in-input-stream";
573
- ERR2["noncharacterInInputStream"] = "noncharacter-in-input-stream";
574
- ERR2["surrogateInInputStream"] = "surrogate-in-input-stream";
575
- ERR2["nonVoidHtmlElementStartTagWithTrailingSolidus"] = "non-void-html-element-start-tag-with-trailing-solidus";
576
- ERR2["endTagWithAttributes"] = "end-tag-with-attributes";
577
- ERR2["endTagWithTrailingSolidus"] = "end-tag-with-trailing-solidus";
578
- ERR2["unexpectedSolidusInTag"] = "unexpected-solidus-in-tag";
579
- ERR2["unexpectedNullCharacter"] = "unexpected-null-character";
580
- ERR2["unexpectedQuestionMarkInsteadOfTagName"] = "unexpected-question-mark-instead-of-tag-name";
581
- ERR2["invalidFirstCharacterOfTagName"] = "invalid-first-character-of-tag-name";
582
- ERR2["unexpectedEqualsSignBeforeAttributeName"] = "unexpected-equals-sign-before-attribute-name";
583
- ERR2["missingEndTagName"] = "missing-end-tag-name";
584
- ERR2["unexpectedCharacterInAttributeName"] = "unexpected-character-in-attribute-name";
585
- ERR2["unknownNamedCharacterReference"] = "unknown-named-character-reference";
586
- ERR2["missingSemicolonAfterCharacterReference"] = "missing-semicolon-after-character-reference";
587
- ERR2["unexpectedCharacterAfterDoctypeSystemIdentifier"] = "unexpected-character-after-doctype-system-identifier";
588
- ERR2["unexpectedCharacterInUnquotedAttributeValue"] = "unexpected-character-in-unquoted-attribute-value";
589
- ERR2["eofBeforeTagName"] = "eof-before-tag-name";
590
- ERR2["eofInTag"] = "eof-in-tag";
591
- ERR2["missingAttributeValue"] = "missing-attribute-value";
592
- ERR2["missingWhitespaceBetweenAttributes"] = "missing-whitespace-between-attributes";
593
- ERR2["missingWhitespaceAfterDoctypePublicKeyword"] = "missing-whitespace-after-doctype-public-keyword";
594
- ERR2["missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers"] = "missing-whitespace-between-doctype-public-and-system-identifiers";
595
- ERR2["missingWhitespaceAfterDoctypeSystemKeyword"] = "missing-whitespace-after-doctype-system-keyword";
596
- ERR2["missingQuoteBeforeDoctypePublicIdentifier"] = "missing-quote-before-doctype-public-identifier";
597
- ERR2["missingQuoteBeforeDoctypeSystemIdentifier"] = "missing-quote-before-doctype-system-identifier";
598
- ERR2["missingDoctypePublicIdentifier"] = "missing-doctype-public-identifier";
599
- ERR2["missingDoctypeSystemIdentifier"] = "missing-doctype-system-identifier";
600
- ERR2["abruptDoctypePublicIdentifier"] = "abrupt-doctype-public-identifier";
601
- ERR2["abruptDoctypeSystemIdentifier"] = "abrupt-doctype-system-identifier";
602
- ERR2["cdataInHtmlContent"] = "cdata-in-html-content";
603
- ERR2["incorrectlyOpenedComment"] = "incorrectly-opened-comment";
604
- ERR2["eofInScriptHtmlCommentLikeText"] = "eof-in-script-html-comment-like-text";
605
- ERR2["eofInDoctype"] = "eof-in-doctype";
606
- ERR2["nestedComment"] = "nested-comment";
607
- ERR2["abruptClosingOfEmptyComment"] = "abrupt-closing-of-empty-comment";
608
- ERR2["eofInComment"] = "eof-in-comment";
609
- ERR2["incorrectlyClosedComment"] = "incorrectly-closed-comment";
610
- ERR2["eofInCdata"] = "eof-in-cdata";
611
- ERR2["absenceOfDigitsInNumericCharacterReference"] = "absence-of-digits-in-numeric-character-reference";
612
- ERR2["nullCharacterReference"] = "null-character-reference";
613
- ERR2["surrogateCharacterReference"] = "surrogate-character-reference";
614
- ERR2["characterReferenceOutsideUnicodeRange"] = "character-reference-outside-unicode-range";
615
- ERR2["controlCharacterReference"] = "control-character-reference";
616
- ERR2["noncharacterCharacterReference"] = "noncharacter-character-reference";
617
- ERR2["missingWhitespaceBeforeDoctypeName"] = "missing-whitespace-before-doctype-name";
618
- ERR2["missingDoctypeName"] = "missing-doctype-name";
619
- ERR2["invalidCharacterSequenceAfterDoctypeName"] = "invalid-character-sequence-after-doctype-name";
620
- ERR2["duplicateAttribute"] = "duplicate-attribute";
621
- ERR2["nonConformingDoctype"] = "non-conforming-doctype";
622
- ERR2["missingDoctype"] = "missing-doctype";
623
- ERR2["misplacedDoctype"] = "misplaced-doctype";
624
- ERR2["endTagWithoutMatchingOpenElement"] = "end-tag-without-matching-open-element";
625
- ERR2["closingOfElementWithOpenChildElements"] = "closing-of-element-with-open-child-elements";
626
- ERR2["disallowedContentInNoscriptInHead"] = "disallowed-content-in-noscript-in-head";
627
- ERR2["openElementsLeftAfterEof"] = "open-elements-left-after-eof";
628
- ERR2["abandonedHeadElementChild"] = "abandoned-head-element-child";
629
- ERR2["misplacedStartTagForHeadElement"] = "misplaced-start-tag-for-head-element";
630
- ERR2["nestedNoscriptInHead"] = "nested-noscript-in-head";
631
- ERR2["eofInElementThatCanContainOnlyText"] = "eof-in-element-that-can-contain-only-text";
632
- })(ERR || (ERR = {}));
633
-
634
- // node_modules/parse5/dist/tokenizer/preprocessor.js
635
- var DEFAULT_BUFFER_WATERLINE = 1 << 16;
636
-
637
- // node_modules/parse5/dist/common/token.js
638
- var TokenType;
639
- (function(TokenType2) {
640
- TokenType2[TokenType2["CHARACTER"] = 0] = "CHARACTER";
641
- TokenType2[TokenType2["NULL_CHARACTER"] = 1] = "NULL_CHARACTER";
642
- TokenType2[TokenType2["WHITESPACE_CHARACTER"] = 2] = "WHITESPACE_CHARACTER";
643
- TokenType2[TokenType2["START_TAG"] = 3] = "START_TAG";
644
- TokenType2[TokenType2["END_TAG"] = 4] = "END_TAG";
645
- TokenType2[TokenType2["COMMENT"] = 5] = "COMMENT";
646
- TokenType2[TokenType2["DOCTYPE"] = 6] = "DOCTYPE";
647
- TokenType2[TokenType2["EOF"] = 7] = "EOF";
648
- TokenType2[TokenType2["HIBERNATION"] = 8] = "HIBERNATION";
649
- })(TokenType || (TokenType = {}));
650
-
651
- // node_modules/parse5/dist/common/html.js
652
- var NS;
653
- (function(NS2) {
654
- NS2["HTML"] = "http://www.w3.org/1999/xhtml";
655
- NS2["MATHML"] = "http://www.w3.org/1998/Math/MathML";
656
- NS2["SVG"] = "http://www.w3.org/2000/svg";
657
- NS2["XLINK"] = "http://www.w3.org/1999/xlink";
658
- NS2["XML"] = "http://www.w3.org/XML/1998/namespace";
659
- NS2["XMLNS"] = "http://www.w3.org/2000/xmlns/";
660
- })(NS || (NS = {}));
661
- var ATTRS;
662
- (function(ATTRS2) {
663
- ATTRS2["TYPE"] = "type";
664
- ATTRS2["ACTION"] = "action";
665
- ATTRS2["ENCODING"] = "encoding";
666
- ATTRS2["PROMPT"] = "prompt";
667
- ATTRS2["NAME"] = "name";
668
- ATTRS2["COLOR"] = "color";
669
- ATTRS2["FACE"] = "face";
670
- ATTRS2["SIZE"] = "size";
671
- })(ATTRS || (ATTRS = {}));
672
- var DOCUMENT_MODE;
673
- (function(DOCUMENT_MODE2) {
674
- DOCUMENT_MODE2["NO_QUIRKS"] = "no-quirks";
675
- DOCUMENT_MODE2["QUIRKS"] = "quirks";
676
- DOCUMENT_MODE2["LIMITED_QUIRKS"] = "limited-quirks";
677
- })(DOCUMENT_MODE || (DOCUMENT_MODE = {}));
678
- var TAG_NAMES;
679
- (function(TAG_NAMES2) {
680
- TAG_NAMES2["A"] = "a";
681
- TAG_NAMES2["ADDRESS"] = "address";
682
- TAG_NAMES2["ANNOTATION_XML"] = "annotation-xml";
683
- TAG_NAMES2["APPLET"] = "applet";
684
- TAG_NAMES2["AREA"] = "area";
685
- TAG_NAMES2["ARTICLE"] = "article";
686
- TAG_NAMES2["ASIDE"] = "aside";
687
- TAG_NAMES2["B"] = "b";
688
- TAG_NAMES2["BASE"] = "base";
689
- TAG_NAMES2["BASEFONT"] = "basefont";
690
- TAG_NAMES2["BGSOUND"] = "bgsound";
691
- TAG_NAMES2["BIG"] = "big";
692
- TAG_NAMES2["BLOCKQUOTE"] = "blockquote";
693
- TAG_NAMES2["BODY"] = "body";
694
- TAG_NAMES2["BR"] = "br";
695
- TAG_NAMES2["BUTTON"] = "button";
696
- TAG_NAMES2["CAPTION"] = "caption";
697
- TAG_NAMES2["CENTER"] = "center";
698
- TAG_NAMES2["CODE"] = "code";
699
- TAG_NAMES2["COL"] = "col";
700
- TAG_NAMES2["COLGROUP"] = "colgroup";
701
- TAG_NAMES2["DD"] = "dd";
702
- TAG_NAMES2["DESC"] = "desc";
703
- TAG_NAMES2["DETAILS"] = "details";
704
- TAG_NAMES2["DIALOG"] = "dialog";
705
- TAG_NAMES2["DIR"] = "dir";
706
- TAG_NAMES2["DIV"] = "div";
707
- TAG_NAMES2["DL"] = "dl";
708
- TAG_NAMES2["DT"] = "dt";
709
- TAG_NAMES2["EM"] = "em";
710
- TAG_NAMES2["EMBED"] = "embed";
711
- TAG_NAMES2["FIELDSET"] = "fieldset";
712
- TAG_NAMES2["FIGCAPTION"] = "figcaption";
713
- TAG_NAMES2["FIGURE"] = "figure";
714
- TAG_NAMES2["FONT"] = "font";
715
- TAG_NAMES2["FOOTER"] = "footer";
716
- TAG_NAMES2["FOREIGN_OBJECT"] = "foreignObject";
717
- TAG_NAMES2["FORM"] = "form";
718
- TAG_NAMES2["FRAME"] = "frame";
719
- TAG_NAMES2["FRAMESET"] = "frameset";
720
- TAG_NAMES2["H1"] = "h1";
721
- TAG_NAMES2["H2"] = "h2";
722
- TAG_NAMES2["H3"] = "h3";
723
- TAG_NAMES2["H4"] = "h4";
724
- TAG_NAMES2["H5"] = "h5";
725
- TAG_NAMES2["H6"] = "h6";
726
- TAG_NAMES2["HEAD"] = "head";
727
- TAG_NAMES2["HEADER"] = "header";
728
- TAG_NAMES2["HGROUP"] = "hgroup";
729
- TAG_NAMES2["HR"] = "hr";
730
- TAG_NAMES2["HTML"] = "html";
731
- TAG_NAMES2["I"] = "i";
732
- TAG_NAMES2["IMG"] = "img";
733
- TAG_NAMES2["IMAGE"] = "image";
734
- TAG_NAMES2["INPUT"] = "input";
735
- TAG_NAMES2["IFRAME"] = "iframe";
736
- TAG_NAMES2["KEYGEN"] = "keygen";
737
- TAG_NAMES2["LABEL"] = "label";
738
- TAG_NAMES2["LI"] = "li";
739
- TAG_NAMES2["LINK"] = "link";
740
- TAG_NAMES2["LISTING"] = "listing";
741
- TAG_NAMES2["MAIN"] = "main";
742
- TAG_NAMES2["MALIGNMARK"] = "malignmark";
743
- TAG_NAMES2["MARQUEE"] = "marquee";
744
- TAG_NAMES2["MATH"] = "math";
745
- TAG_NAMES2["MENU"] = "menu";
746
- TAG_NAMES2["META"] = "meta";
747
- TAG_NAMES2["MGLYPH"] = "mglyph";
748
- TAG_NAMES2["MI"] = "mi";
749
- TAG_NAMES2["MO"] = "mo";
750
- TAG_NAMES2["MN"] = "mn";
751
- TAG_NAMES2["MS"] = "ms";
752
- TAG_NAMES2["MTEXT"] = "mtext";
753
- TAG_NAMES2["NAV"] = "nav";
754
- TAG_NAMES2["NOBR"] = "nobr";
755
- TAG_NAMES2["NOFRAMES"] = "noframes";
756
- TAG_NAMES2["NOEMBED"] = "noembed";
757
- TAG_NAMES2["NOSCRIPT"] = "noscript";
758
- TAG_NAMES2["OBJECT"] = "object";
759
- TAG_NAMES2["OL"] = "ol";
760
- TAG_NAMES2["OPTGROUP"] = "optgroup";
761
- TAG_NAMES2["OPTION"] = "option";
762
- TAG_NAMES2["P"] = "p";
763
- TAG_NAMES2["PARAM"] = "param";
764
- TAG_NAMES2["PLAINTEXT"] = "plaintext";
765
- TAG_NAMES2["PRE"] = "pre";
766
- TAG_NAMES2["RB"] = "rb";
767
- TAG_NAMES2["RP"] = "rp";
768
- TAG_NAMES2["RT"] = "rt";
769
- TAG_NAMES2["RTC"] = "rtc";
770
- TAG_NAMES2["RUBY"] = "ruby";
771
- TAG_NAMES2["S"] = "s";
772
- TAG_NAMES2["SCRIPT"] = "script";
773
- TAG_NAMES2["SEARCH"] = "search";
774
- TAG_NAMES2["SECTION"] = "section";
775
- TAG_NAMES2["SELECT"] = "select";
776
- TAG_NAMES2["SOURCE"] = "source";
777
- TAG_NAMES2["SMALL"] = "small";
778
- TAG_NAMES2["SPAN"] = "span";
779
- TAG_NAMES2["STRIKE"] = "strike";
780
- TAG_NAMES2["STRONG"] = "strong";
781
- TAG_NAMES2["STYLE"] = "style";
782
- TAG_NAMES2["SUB"] = "sub";
783
- TAG_NAMES2["SUMMARY"] = "summary";
784
- TAG_NAMES2["SUP"] = "sup";
785
- TAG_NAMES2["TABLE"] = "table";
786
- TAG_NAMES2["TBODY"] = "tbody";
787
- TAG_NAMES2["TEMPLATE"] = "template";
788
- TAG_NAMES2["TEXTAREA"] = "textarea";
789
- TAG_NAMES2["TFOOT"] = "tfoot";
790
- TAG_NAMES2["TD"] = "td";
791
- TAG_NAMES2["TH"] = "th";
792
- TAG_NAMES2["THEAD"] = "thead";
793
- TAG_NAMES2["TITLE"] = "title";
794
- TAG_NAMES2["TR"] = "tr";
795
- TAG_NAMES2["TRACK"] = "track";
796
- TAG_NAMES2["TT"] = "tt";
797
- TAG_NAMES2["U"] = "u";
798
- TAG_NAMES2["UL"] = "ul";
799
- TAG_NAMES2["SVG"] = "svg";
800
- TAG_NAMES2["VAR"] = "var";
801
- TAG_NAMES2["WBR"] = "wbr";
802
- TAG_NAMES2["XMP"] = "xmp";
803
- })(TAG_NAMES || (TAG_NAMES = {}));
804
- var TAG_ID;
805
- (function(TAG_ID2) {
806
- TAG_ID2[TAG_ID2["UNKNOWN"] = 0] = "UNKNOWN";
807
- TAG_ID2[TAG_ID2["A"] = 1] = "A";
808
- TAG_ID2[TAG_ID2["ADDRESS"] = 2] = "ADDRESS";
809
- TAG_ID2[TAG_ID2["ANNOTATION_XML"] = 3] = "ANNOTATION_XML";
810
- TAG_ID2[TAG_ID2["APPLET"] = 4] = "APPLET";
811
- TAG_ID2[TAG_ID2["AREA"] = 5] = "AREA";
812
- TAG_ID2[TAG_ID2["ARTICLE"] = 6] = "ARTICLE";
813
- TAG_ID2[TAG_ID2["ASIDE"] = 7] = "ASIDE";
814
- TAG_ID2[TAG_ID2["B"] = 8] = "B";
815
- TAG_ID2[TAG_ID2["BASE"] = 9] = "BASE";
816
- TAG_ID2[TAG_ID2["BASEFONT"] = 10] = "BASEFONT";
817
- TAG_ID2[TAG_ID2["BGSOUND"] = 11] = "BGSOUND";
818
- TAG_ID2[TAG_ID2["BIG"] = 12] = "BIG";
819
- TAG_ID2[TAG_ID2["BLOCKQUOTE"] = 13] = "BLOCKQUOTE";
820
- TAG_ID2[TAG_ID2["BODY"] = 14] = "BODY";
821
- TAG_ID2[TAG_ID2["BR"] = 15] = "BR";
822
- TAG_ID2[TAG_ID2["BUTTON"] = 16] = "BUTTON";
823
- TAG_ID2[TAG_ID2["CAPTION"] = 17] = "CAPTION";
824
- TAG_ID2[TAG_ID2["CENTER"] = 18] = "CENTER";
825
- TAG_ID2[TAG_ID2["CODE"] = 19] = "CODE";
826
- TAG_ID2[TAG_ID2["COL"] = 20] = "COL";
827
- TAG_ID2[TAG_ID2["COLGROUP"] = 21] = "COLGROUP";
828
- TAG_ID2[TAG_ID2["DD"] = 22] = "DD";
829
- TAG_ID2[TAG_ID2["DESC"] = 23] = "DESC";
830
- TAG_ID2[TAG_ID2["DETAILS"] = 24] = "DETAILS";
831
- TAG_ID2[TAG_ID2["DIALOG"] = 25] = "DIALOG";
832
- TAG_ID2[TAG_ID2["DIR"] = 26] = "DIR";
833
- TAG_ID2[TAG_ID2["DIV"] = 27] = "DIV";
834
- TAG_ID2[TAG_ID2["DL"] = 28] = "DL";
835
- TAG_ID2[TAG_ID2["DT"] = 29] = "DT";
836
- TAG_ID2[TAG_ID2["EM"] = 30] = "EM";
837
- TAG_ID2[TAG_ID2["EMBED"] = 31] = "EMBED";
838
- TAG_ID2[TAG_ID2["FIELDSET"] = 32] = "FIELDSET";
839
- TAG_ID2[TAG_ID2["FIGCAPTION"] = 33] = "FIGCAPTION";
840
- TAG_ID2[TAG_ID2["FIGURE"] = 34] = "FIGURE";
841
- TAG_ID2[TAG_ID2["FONT"] = 35] = "FONT";
842
- TAG_ID2[TAG_ID2["FOOTER"] = 36] = "FOOTER";
843
- TAG_ID2[TAG_ID2["FOREIGN_OBJECT"] = 37] = "FOREIGN_OBJECT";
844
- TAG_ID2[TAG_ID2["FORM"] = 38] = "FORM";
845
- TAG_ID2[TAG_ID2["FRAME"] = 39] = "FRAME";
846
- TAG_ID2[TAG_ID2["FRAMESET"] = 40] = "FRAMESET";
847
- TAG_ID2[TAG_ID2["H1"] = 41] = "H1";
848
- TAG_ID2[TAG_ID2["H2"] = 42] = "H2";
849
- TAG_ID2[TAG_ID2["H3"] = 43] = "H3";
850
- TAG_ID2[TAG_ID2["H4"] = 44] = "H4";
851
- TAG_ID2[TAG_ID2["H5"] = 45] = "H5";
852
- TAG_ID2[TAG_ID2["H6"] = 46] = "H6";
853
- TAG_ID2[TAG_ID2["HEAD"] = 47] = "HEAD";
854
- TAG_ID2[TAG_ID2["HEADER"] = 48] = "HEADER";
855
- TAG_ID2[TAG_ID2["HGROUP"] = 49] = "HGROUP";
856
- TAG_ID2[TAG_ID2["HR"] = 50] = "HR";
857
- TAG_ID2[TAG_ID2["HTML"] = 51] = "HTML";
858
- TAG_ID2[TAG_ID2["I"] = 52] = "I";
859
- TAG_ID2[TAG_ID2["IMG"] = 53] = "IMG";
860
- TAG_ID2[TAG_ID2["IMAGE"] = 54] = "IMAGE";
861
- TAG_ID2[TAG_ID2["INPUT"] = 55] = "INPUT";
862
- TAG_ID2[TAG_ID2["IFRAME"] = 56] = "IFRAME";
863
- TAG_ID2[TAG_ID2["KEYGEN"] = 57] = "KEYGEN";
864
- TAG_ID2[TAG_ID2["LABEL"] = 58] = "LABEL";
865
- TAG_ID2[TAG_ID2["LI"] = 59] = "LI";
866
- TAG_ID2[TAG_ID2["LINK"] = 60] = "LINK";
867
- TAG_ID2[TAG_ID2["LISTING"] = 61] = "LISTING";
868
- TAG_ID2[TAG_ID2["MAIN"] = 62] = "MAIN";
869
- TAG_ID2[TAG_ID2["MALIGNMARK"] = 63] = "MALIGNMARK";
870
- TAG_ID2[TAG_ID2["MARQUEE"] = 64] = "MARQUEE";
871
- TAG_ID2[TAG_ID2["MATH"] = 65] = "MATH";
872
- TAG_ID2[TAG_ID2["MENU"] = 66] = "MENU";
873
- TAG_ID2[TAG_ID2["META"] = 67] = "META";
874
- TAG_ID2[TAG_ID2["MGLYPH"] = 68] = "MGLYPH";
875
- TAG_ID2[TAG_ID2["MI"] = 69] = "MI";
876
- TAG_ID2[TAG_ID2["MO"] = 70] = "MO";
877
- TAG_ID2[TAG_ID2["MN"] = 71] = "MN";
878
- TAG_ID2[TAG_ID2["MS"] = 72] = "MS";
879
- TAG_ID2[TAG_ID2["MTEXT"] = 73] = "MTEXT";
880
- TAG_ID2[TAG_ID2["NAV"] = 74] = "NAV";
881
- TAG_ID2[TAG_ID2["NOBR"] = 75] = "NOBR";
882
- TAG_ID2[TAG_ID2["NOFRAMES"] = 76] = "NOFRAMES";
883
- TAG_ID2[TAG_ID2["NOEMBED"] = 77] = "NOEMBED";
884
- TAG_ID2[TAG_ID2["NOSCRIPT"] = 78] = "NOSCRIPT";
885
- TAG_ID2[TAG_ID2["OBJECT"] = 79] = "OBJECT";
886
- TAG_ID2[TAG_ID2["OL"] = 80] = "OL";
887
- TAG_ID2[TAG_ID2["OPTGROUP"] = 81] = "OPTGROUP";
888
- TAG_ID2[TAG_ID2["OPTION"] = 82] = "OPTION";
889
- TAG_ID2[TAG_ID2["P"] = 83] = "P";
890
- TAG_ID2[TAG_ID2["PARAM"] = 84] = "PARAM";
891
- TAG_ID2[TAG_ID2["PLAINTEXT"] = 85] = "PLAINTEXT";
892
- TAG_ID2[TAG_ID2["PRE"] = 86] = "PRE";
893
- TAG_ID2[TAG_ID2["RB"] = 87] = "RB";
894
- TAG_ID2[TAG_ID2["RP"] = 88] = "RP";
895
- TAG_ID2[TAG_ID2["RT"] = 89] = "RT";
896
- TAG_ID2[TAG_ID2["RTC"] = 90] = "RTC";
897
- TAG_ID2[TAG_ID2["RUBY"] = 91] = "RUBY";
898
- TAG_ID2[TAG_ID2["S"] = 92] = "S";
899
- TAG_ID2[TAG_ID2["SCRIPT"] = 93] = "SCRIPT";
900
- TAG_ID2[TAG_ID2["SEARCH"] = 94] = "SEARCH";
901
- TAG_ID2[TAG_ID2["SECTION"] = 95] = "SECTION";
902
- TAG_ID2[TAG_ID2["SELECT"] = 96] = "SELECT";
903
- TAG_ID2[TAG_ID2["SOURCE"] = 97] = "SOURCE";
904
- TAG_ID2[TAG_ID2["SMALL"] = 98] = "SMALL";
905
- TAG_ID2[TAG_ID2["SPAN"] = 99] = "SPAN";
906
- TAG_ID2[TAG_ID2["STRIKE"] = 100] = "STRIKE";
907
- TAG_ID2[TAG_ID2["STRONG"] = 101] = "STRONG";
908
- TAG_ID2[TAG_ID2["STYLE"] = 102] = "STYLE";
909
- TAG_ID2[TAG_ID2["SUB"] = 103] = "SUB";
910
- TAG_ID2[TAG_ID2["SUMMARY"] = 104] = "SUMMARY";
911
- TAG_ID2[TAG_ID2["SUP"] = 105] = "SUP";
912
- TAG_ID2[TAG_ID2["TABLE"] = 106] = "TABLE";
913
- TAG_ID2[TAG_ID2["TBODY"] = 107] = "TBODY";
914
- TAG_ID2[TAG_ID2["TEMPLATE"] = 108] = "TEMPLATE";
915
- TAG_ID2[TAG_ID2["TEXTAREA"] = 109] = "TEXTAREA";
916
- TAG_ID2[TAG_ID2["TFOOT"] = 110] = "TFOOT";
917
- TAG_ID2[TAG_ID2["TD"] = 111] = "TD";
918
- TAG_ID2[TAG_ID2["TH"] = 112] = "TH";
919
- TAG_ID2[TAG_ID2["THEAD"] = 113] = "THEAD";
920
- TAG_ID2[TAG_ID2["TITLE"] = 114] = "TITLE";
921
- TAG_ID2[TAG_ID2["TR"] = 115] = "TR";
922
- TAG_ID2[TAG_ID2["TRACK"] = 116] = "TRACK";
923
- TAG_ID2[TAG_ID2["TT"] = 117] = "TT";
924
- TAG_ID2[TAG_ID2["U"] = 118] = "U";
925
- TAG_ID2[TAG_ID2["UL"] = 119] = "UL";
926
- TAG_ID2[TAG_ID2["SVG"] = 120] = "SVG";
927
- TAG_ID2[TAG_ID2["VAR"] = 121] = "VAR";
928
- TAG_ID2[TAG_ID2["WBR"] = 122] = "WBR";
929
- TAG_ID2[TAG_ID2["XMP"] = 123] = "XMP";
930
- })(TAG_ID || (TAG_ID = {}));
931
- var TAG_NAME_TO_ID = /* @__PURE__ */ new Map([
932
- [TAG_NAMES.A, TAG_ID.A],
933
- [TAG_NAMES.ADDRESS, TAG_ID.ADDRESS],
934
- [TAG_NAMES.ANNOTATION_XML, TAG_ID.ANNOTATION_XML],
935
- [TAG_NAMES.APPLET, TAG_ID.APPLET],
936
- [TAG_NAMES.AREA, TAG_ID.AREA],
937
- [TAG_NAMES.ARTICLE, TAG_ID.ARTICLE],
938
- [TAG_NAMES.ASIDE, TAG_ID.ASIDE],
939
- [TAG_NAMES.B, TAG_ID.B],
940
- [TAG_NAMES.BASE, TAG_ID.BASE],
941
- [TAG_NAMES.BASEFONT, TAG_ID.BASEFONT],
942
- [TAG_NAMES.BGSOUND, TAG_ID.BGSOUND],
943
- [TAG_NAMES.BIG, TAG_ID.BIG],
944
- [TAG_NAMES.BLOCKQUOTE, TAG_ID.BLOCKQUOTE],
945
- [TAG_NAMES.BODY, TAG_ID.BODY],
946
- [TAG_NAMES.BR, TAG_ID.BR],
947
- [TAG_NAMES.BUTTON, TAG_ID.BUTTON],
948
- [TAG_NAMES.CAPTION, TAG_ID.CAPTION],
949
- [TAG_NAMES.CENTER, TAG_ID.CENTER],
950
- [TAG_NAMES.CODE, TAG_ID.CODE],
951
- [TAG_NAMES.COL, TAG_ID.COL],
952
- [TAG_NAMES.COLGROUP, TAG_ID.COLGROUP],
953
- [TAG_NAMES.DD, TAG_ID.DD],
954
- [TAG_NAMES.DESC, TAG_ID.DESC],
955
- [TAG_NAMES.DETAILS, TAG_ID.DETAILS],
956
- [TAG_NAMES.DIALOG, TAG_ID.DIALOG],
957
- [TAG_NAMES.DIR, TAG_ID.DIR],
958
- [TAG_NAMES.DIV, TAG_ID.DIV],
959
- [TAG_NAMES.DL, TAG_ID.DL],
960
- [TAG_NAMES.DT, TAG_ID.DT],
961
- [TAG_NAMES.EM, TAG_ID.EM],
962
- [TAG_NAMES.EMBED, TAG_ID.EMBED],
963
- [TAG_NAMES.FIELDSET, TAG_ID.FIELDSET],
964
- [TAG_NAMES.FIGCAPTION, TAG_ID.FIGCAPTION],
965
- [TAG_NAMES.FIGURE, TAG_ID.FIGURE],
966
- [TAG_NAMES.FONT, TAG_ID.FONT],
967
- [TAG_NAMES.FOOTER, TAG_ID.FOOTER],
968
- [TAG_NAMES.FOREIGN_OBJECT, TAG_ID.FOREIGN_OBJECT],
969
- [TAG_NAMES.FORM, TAG_ID.FORM],
970
- [TAG_NAMES.FRAME, TAG_ID.FRAME],
971
- [TAG_NAMES.FRAMESET, TAG_ID.FRAMESET],
972
- [TAG_NAMES.H1, TAG_ID.H1],
973
- [TAG_NAMES.H2, TAG_ID.H2],
974
- [TAG_NAMES.H3, TAG_ID.H3],
975
- [TAG_NAMES.H4, TAG_ID.H4],
976
- [TAG_NAMES.H5, TAG_ID.H5],
977
- [TAG_NAMES.H6, TAG_ID.H6],
978
- [TAG_NAMES.HEAD, TAG_ID.HEAD],
979
- [TAG_NAMES.HEADER, TAG_ID.HEADER],
980
- [TAG_NAMES.HGROUP, TAG_ID.HGROUP],
981
- [TAG_NAMES.HR, TAG_ID.HR],
982
- [TAG_NAMES.HTML, TAG_ID.HTML],
983
- [TAG_NAMES.I, TAG_ID.I],
984
- [TAG_NAMES.IMG, TAG_ID.IMG],
985
- [TAG_NAMES.IMAGE, TAG_ID.IMAGE],
986
- [TAG_NAMES.INPUT, TAG_ID.INPUT],
987
- [TAG_NAMES.IFRAME, TAG_ID.IFRAME],
988
- [TAG_NAMES.KEYGEN, TAG_ID.KEYGEN],
989
- [TAG_NAMES.LABEL, TAG_ID.LABEL],
990
- [TAG_NAMES.LI, TAG_ID.LI],
991
- [TAG_NAMES.LINK, TAG_ID.LINK],
992
- [TAG_NAMES.LISTING, TAG_ID.LISTING],
993
- [TAG_NAMES.MAIN, TAG_ID.MAIN],
994
- [TAG_NAMES.MALIGNMARK, TAG_ID.MALIGNMARK],
995
- [TAG_NAMES.MARQUEE, TAG_ID.MARQUEE],
996
- [TAG_NAMES.MATH, TAG_ID.MATH],
997
- [TAG_NAMES.MENU, TAG_ID.MENU],
998
- [TAG_NAMES.META, TAG_ID.META],
999
- [TAG_NAMES.MGLYPH, TAG_ID.MGLYPH],
1000
- [TAG_NAMES.MI, TAG_ID.MI],
1001
- [TAG_NAMES.MO, TAG_ID.MO],
1002
- [TAG_NAMES.MN, TAG_ID.MN],
1003
- [TAG_NAMES.MS, TAG_ID.MS],
1004
- [TAG_NAMES.MTEXT, TAG_ID.MTEXT],
1005
- [TAG_NAMES.NAV, TAG_ID.NAV],
1006
- [TAG_NAMES.NOBR, TAG_ID.NOBR],
1007
- [TAG_NAMES.NOFRAMES, TAG_ID.NOFRAMES],
1008
- [TAG_NAMES.NOEMBED, TAG_ID.NOEMBED],
1009
- [TAG_NAMES.NOSCRIPT, TAG_ID.NOSCRIPT],
1010
- [TAG_NAMES.OBJECT, TAG_ID.OBJECT],
1011
- [TAG_NAMES.OL, TAG_ID.OL],
1012
- [TAG_NAMES.OPTGROUP, TAG_ID.OPTGROUP],
1013
- [TAG_NAMES.OPTION, TAG_ID.OPTION],
1014
- [TAG_NAMES.P, TAG_ID.P],
1015
- [TAG_NAMES.PARAM, TAG_ID.PARAM],
1016
- [TAG_NAMES.PLAINTEXT, TAG_ID.PLAINTEXT],
1017
- [TAG_NAMES.PRE, TAG_ID.PRE],
1018
- [TAG_NAMES.RB, TAG_ID.RB],
1019
- [TAG_NAMES.RP, TAG_ID.RP],
1020
- [TAG_NAMES.RT, TAG_ID.RT],
1021
- [TAG_NAMES.RTC, TAG_ID.RTC],
1022
- [TAG_NAMES.RUBY, TAG_ID.RUBY],
1023
- [TAG_NAMES.S, TAG_ID.S],
1024
- [TAG_NAMES.SCRIPT, TAG_ID.SCRIPT],
1025
- [TAG_NAMES.SEARCH, TAG_ID.SEARCH],
1026
- [TAG_NAMES.SECTION, TAG_ID.SECTION],
1027
- [TAG_NAMES.SELECT, TAG_ID.SELECT],
1028
- [TAG_NAMES.SOURCE, TAG_ID.SOURCE],
1029
- [TAG_NAMES.SMALL, TAG_ID.SMALL],
1030
- [TAG_NAMES.SPAN, TAG_ID.SPAN],
1031
- [TAG_NAMES.STRIKE, TAG_ID.STRIKE],
1032
- [TAG_NAMES.STRONG, TAG_ID.STRONG],
1033
- [TAG_NAMES.STYLE, TAG_ID.STYLE],
1034
- [TAG_NAMES.SUB, TAG_ID.SUB],
1035
- [TAG_NAMES.SUMMARY, TAG_ID.SUMMARY],
1036
- [TAG_NAMES.SUP, TAG_ID.SUP],
1037
- [TAG_NAMES.TABLE, TAG_ID.TABLE],
1038
- [TAG_NAMES.TBODY, TAG_ID.TBODY],
1039
- [TAG_NAMES.TEMPLATE, TAG_ID.TEMPLATE],
1040
- [TAG_NAMES.TEXTAREA, TAG_ID.TEXTAREA],
1041
- [TAG_NAMES.TFOOT, TAG_ID.TFOOT],
1042
- [TAG_NAMES.TD, TAG_ID.TD],
1043
- [TAG_NAMES.TH, TAG_ID.TH],
1044
- [TAG_NAMES.THEAD, TAG_ID.THEAD],
1045
- [TAG_NAMES.TITLE, TAG_ID.TITLE],
1046
- [TAG_NAMES.TR, TAG_ID.TR],
1047
- [TAG_NAMES.TRACK, TAG_ID.TRACK],
1048
- [TAG_NAMES.TT, TAG_ID.TT],
1049
- [TAG_NAMES.U, TAG_ID.U],
1050
- [TAG_NAMES.UL, TAG_ID.UL],
1051
- [TAG_NAMES.SVG, TAG_ID.SVG],
1052
- [TAG_NAMES.VAR, TAG_ID.VAR],
1053
- [TAG_NAMES.WBR, TAG_ID.WBR],
1054
- [TAG_NAMES.XMP, TAG_ID.XMP]
1055
- ]);
1056
- var $ = TAG_ID;
1057
- var SPECIAL_ELEMENTS = {
1058
- [NS.HTML]: /* @__PURE__ */ new Set([
1059
- $.ADDRESS,
1060
- $.APPLET,
1061
- $.AREA,
1062
- $.ARTICLE,
1063
- $.ASIDE,
1064
- $.BASE,
1065
- $.BASEFONT,
1066
- $.BGSOUND,
1067
- $.BLOCKQUOTE,
1068
- $.BODY,
1069
- $.BR,
1070
- $.BUTTON,
1071
- $.CAPTION,
1072
- $.CENTER,
1073
- $.COL,
1074
- $.COLGROUP,
1075
- $.DD,
1076
- $.DETAILS,
1077
- $.DIR,
1078
- $.DIV,
1079
- $.DL,
1080
- $.DT,
1081
- $.EMBED,
1082
- $.FIELDSET,
1083
- $.FIGCAPTION,
1084
- $.FIGURE,
1085
- $.FOOTER,
1086
- $.FORM,
1087
- $.FRAME,
1088
- $.FRAMESET,
1089
- $.H1,
1090
- $.H2,
1091
- $.H3,
1092
- $.H4,
1093
- $.H5,
1094
- $.H6,
1095
- $.HEAD,
1096
- $.HEADER,
1097
- $.HGROUP,
1098
- $.HR,
1099
- $.HTML,
1100
- $.IFRAME,
1101
- $.IMG,
1102
- $.INPUT,
1103
- $.LI,
1104
- $.LINK,
1105
- $.LISTING,
1106
- $.MAIN,
1107
- $.MARQUEE,
1108
- $.MENU,
1109
- $.META,
1110
- $.NAV,
1111
- $.NOEMBED,
1112
- $.NOFRAMES,
1113
- $.NOSCRIPT,
1114
- $.OBJECT,
1115
- $.OL,
1116
- $.P,
1117
- $.PARAM,
1118
- $.PLAINTEXT,
1119
- $.PRE,
1120
- $.SCRIPT,
1121
- $.SECTION,
1122
- $.SELECT,
1123
- $.SOURCE,
1124
- $.STYLE,
1125
- $.SUMMARY,
1126
- $.TABLE,
1127
- $.TBODY,
1128
- $.TD,
1129
- $.TEMPLATE,
1130
- $.TEXTAREA,
1131
- $.TFOOT,
1132
- $.TH,
1133
- $.THEAD,
1134
- $.TITLE,
1135
- $.TR,
1136
- $.TRACK,
1137
- $.UL,
1138
- $.WBR,
1139
- $.XMP
1140
- ]),
1141
- [NS.MATHML]: /* @__PURE__ */ new Set([$.MI, $.MO, $.MN, $.MS, $.MTEXT, $.ANNOTATION_XML]),
1142
- [NS.SVG]: /* @__PURE__ */ new Set([$.TITLE, $.FOREIGN_OBJECT, $.DESC]),
1143
- [NS.XLINK]: /* @__PURE__ */ new Set(),
1144
- [NS.XML]: /* @__PURE__ */ new Set(),
1145
- [NS.XMLNS]: /* @__PURE__ */ new Set()
1146
- };
1147
- var NUMBERED_HEADERS = /* @__PURE__ */ new Set([$.H1, $.H2, $.H3, $.H4, $.H5, $.H6]);
1148
- var UNESCAPED_TEXT = /* @__PURE__ */ new Set([
1149
- TAG_NAMES.STYLE,
1150
- TAG_NAMES.SCRIPT,
1151
- TAG_NAMES.XMP,
1152
- TAG_NAMES.IFRAME,
1153
- TAG_NAMES.NOEMBED,
1154
- TAG_NAMES.NOFRAMES,
1155
- TAG_NAMES.PLAINTEXT
1156
- ]);
1157
-
1158
- // node_modules/parse5/dist/tokenizer/index.js
1159
- var State;
1160
- (function(State2) {
1161
- State2[State2["DATA"] = 0] = "DATA";
1162
- State2[State2["RCDATA"] = 1] = "RCDATA";
1163
- State2[State2["RAWTEXT"] = 2] = "RAWTEXT";
1164
- State2[State2["SCRIPT_DATA"] = 3] = "SCRIPT_DATA";
1165
- State2[State2["PLAINTEXT"] = 4] = "PLAINTEXT";
1166
- State2[State2["TAG_OPEN"] = 5] = "TAG_OPEN";
1167
- State2[State2["END_TAG_OPEN"] = 6] = "END_TAG_OPEN";
1168
- State2[State2["TAG_NAME"] = 7] = "TAG_NAME";
1169
- State2[State2["RCDATA_LESS_THAN_SIGN"] = 8] = "RCDATA_LESS_THAN_SIGN";
1170
- State2[State2["RCDATA_END_TAG_OPEN"] = 9] = "RCDATA_END_TAG_OPEN";
1171
- State2[State2["RCDATA_END_TAG_NAME"] = 10] = "RCDATA_END_TAG_NAME";
1172
- State2[State2["RAWTEXT_LESS_THAN_SIGN"] = 11] = "RAWTEXT_LESS_THAN_SIGN";
1173
- State2[State2["RAWTEXT_END_TAG_OPEN"] = 12] = "RAWTEXT_END_TAG_OPEN";
1174
- State2[State2["RAWTEXT_END_TAG_NAME"] = 13] = "RAWTEXT_END_TAG_NAME";
1175
- State2[State2["SCRIPT_DATA_LESS_THAN_SIGN"] = 14] = "SCRIPT_DATA_LESS_THAN_SIGN";
1176
- State2[State2["SCRIPT_DATA_END_TAG_OPEN"] = 15] = "SCRIPT_DATA_END_TAG_OPEN";
1177
- State2[State2["SCRIPT_DATA_END_TAG_NAME"] = 16] = "SCRIPT_DATA_END_TAG_NAME";
1178
- State2[State2["SCRIPT_DATA_ESCAPE_START"] = 17] = "SCRIPT_DATA_ESCAPE_START";
1179
- State2[State2["SCRIPT_DATA_ESCAPE_START_DASH"] = 18] = "SCRIPT_DATA_ESCAPE_START_DASH";
1180
- State2[State2["SCRIPT_DATA_ESCAPED"] = 19] = "SCRIPT_DATA_ESCAPED";
1181
- State2[State2["SCRIPT_DATA_ESCAPED_DASH"] = 20] = "SCRIPT_DATA_ESCAPED_DASH";
1182
- State2[State2["SCRIPT_DATA_ESCAPED_DASH_DASH"] = 21] = "SCRIPT_DATA_ESCAPED_DASH_DASH";
1183
- State2[State2["SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN"] = 22] = "SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN";
1184
- State2[State2["SCRIPT_DATA_ESCAPED_END_TAG_OPEN"] = 23] = "SCRIPT_DATA_ESCAPED_END_TAG_OPEN";
1185
- State2[State2["SCRIPT_DATA_ESCAPED_END_TAG_NAME"] = 24] = "SCRIPT_DATA_ESCAPED_END_TAG_NAME";
1186
- State2[State2["SCRIPT_DATA_DOUBLE_ESCAPE_START"] = 25] = "SCRIPT_DATA_DOUBLE_ESCAPE_START";
1187
- State2[State2["SCRIPT_DATA_DOUBLE_ESCAPED"] = 26] = "SCRIPT_DATA_DOUBLE_ESCAPED";
1188
- State2[State2["SCRIPT_DATA_DOUBLE_ESCAPED_DASH"] = 27] = "SCRIPT_DATA_DOUBLE_ESCAPED_DASH";
1189
- State2[State2["SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH"] = 28] = "SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH";
1190
- State2[State2["SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN"] = 29] = "SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN";
1191
- State2[State2["SCRIPT_DATA_DOUBLE_ESCAPE_END"] = 30] = "SCRIPT_DATA_DOUBLE_ESCAPE_END";
1192
- State2[State2["BEFORE_ATTRIBUTE_NAME"] = 31] = "BEFORE_ATTRIBUTE_NAME";
1193
- State2[State2["ATTRIBUTE_NAME"] = 32] = "ATTRIBUTE_NAME";
1194
- State2[State2["AFTER_ATTRIBUTE_NAME"] = 33] = "AFTER_ATTRIBUTE_NAME";
1195
- State2[State2["BEFORE_ATTRIBUTE_VALUE"] = 34] = "BEFORE_ATTRIBUTE_VALUE";
1196
- State2[State2["ATTRIBUTE_VALUE_DOUBLE_QUOTED"] = 35] = "ATTRIBUTE_VALUE_DOUBLE_QUOTED";
1197
- State2[State2["ATTRIBUTE_VALUE_SINGLE_QUOTED"] = 36] = "ATTRIBUTE_VALUE_SINGLE_QUOTED";
1198
- State2[State2["ATTRIBUTE_VALUE_UNQUOTED"] = 37] = "ATTRIBUTE_VALUE_UNQUOTED";
1199
- State2[State2["AFTER_ATTRIBUTE_VALUE_QUOTED"] = 38] = "AFTER_ATTRIBUTE_VALUE_QUOTED";
1200
- State2[State2["SELF_CLOSING_START_TAG"] = 39] = "SELF_CLOSING_START_TAG";
1201
- State2[State2["BOGUS_COMMENT"] = 40] = "BOGUS_COMMENT";
1202
- State2[State2["MARKUP_DECLARATION_OPEN"] = 41] = "MARKUP_DECLARATION_OPEN";
1203
- State2[State2["COMMENT_START"] = 42] = "COMMENT_START";
1204
- State2[State2["COMMENT_START_DASH"] = 43] = "COMMENT_START_DASH";
1205
- State2[State2["COMMENT"] = 44] = "COMMENT";
1206
- State2[State2["COMMENT_LESS_THAN_SIGN"] = 45] = "COMMENT_LESS_THAN_SIGN";
1207
- State2[State2["COMMENT_LESS_THAN_SIGN_BANG"] = 46] = "COMMENT_LESS_THAN_SIGN_BANG";
1208
- State2[State2["COMMENT_LESS_THAN_SIGN_BANG_DASH"] = 47] = "COMMENT_LESS_THAN_SIGN_BANG_DASH";
1209
- State2[State2["COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH"] = 48] = "COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH";
1210
- State2[State2["COMMENT_END_DASH"] = 49] = "COMMENT_END_DASH";
1211
- State2[State2["COMMENT_END"] = 50] = "COMMENT_END";
1212
- State2[State2["COMMENT_END_BANG"] = 51] = "COMMENT_END_BANG";
1213
- State2[State2["DOCTYPE"] = 52] = "DOCTYPE";
1214
- State2[State2["BEFORE_DOCTYPE_NAME"] = 53] = "BEFORE_DOCTYPE_NAME";
1215
- State2[State2["DOCTYPE_NAME"] = 54] = "DOCTYPE_NAME";
1216
- State2[State2["AFTER_DOCTYPE_NAME"] = 55] = "AFTER_DOCTYPE_NAME";
1217
- State2[State2["AFTER_DOCTYPE_PUBLIC_KEYWORD"] = 56] = "AFTER_DOCTYPE_PUBLIC_KEYWORD";
1218
- State2[State2["BEFORE_DOCTYPE_PUBLIC_IDENTIFIER"] = 57] = "BEFORE_DOCTYPE_PUBLIC_IDENTIFIER";
1219
- State2[State2["DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED"] = 58] = "DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED";
1220
- State2[State2["DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED"] = 59] = "DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED";
1221
- State2[State2["AFTER_DOCTYPE_PUBLIC_IDENTIFIER"] = 60] = "AFTER_DOCTYPE_PUBLIC_IDENTIFIER";
1222
- State2[State2["BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS"] = 61] = "BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS";
1223
- State2[State2["AFTER_DOCTYPE_SYSTEM_KEYWORD"] = 62] = "AFTER_DOCTYPE_SYSTEM_KEYWORD";
1224
- State2[State2["BEFORE_DOCTYPE_SYSTEM_IDENTIFIER"] = 63] = "BEFORE_DOCTYPE_SYSTEM_IDENTIFIER";
1225
- State2[State2["DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED"] = 64] = "DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED";
1226
- State2[State2["DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED"] = 65] = "DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED";
1227
- State2[State2["AFTER_DOCTYPE_SYSTEM_IDENTIFIER"] = 66] = "AFTER_DOCTYPE_SYSTEM_IDENTIFIER";
1228
- State2[State2["BOGUS_DOCTYPE"] = 67] = "BOGUS_DOCTYPE";
1229
- State2[State2["CDATA_SECTION"] = 68] = "CDATA_SECTION";
1230
- State2[State2["CDATA_SECTION_BRACKET"] = 69] = "CDATA_SECTION_BRACKET";
1231
- State2[State2["CDATA_SECTION_END"] = 70] = "CDATA_SECTION_END";
1232
- State2[State2["CHARACTER_REFERENCE"] = 71] = "CHARACTER_REFERENCE";
1233
- State2[State2["AMBIGUOUS_AMPERSAND"] = 72] = "AMBIGUOUS_AMPERSAND";
1234
- })(State || (State = {}));
1235
- var TokenizerMode = {
1236
- DATA: State.DATA,
1237
- RCDATA: State.RCDATA,
1238
- RAWTEXT: State.RAWTEXT,
1239
- SCRIPT_DATA: State.SCRIPT_DATA,
1240
- PLAINTEXT: State.PLAINTEXT,
1241
- CDATA_SECTION: State.CDATA_SECTION
1242
- };
1243
-
1244
- // node_modules/parse5/dist/parser/open-element-stack.js
1245
- var IMPLICIT_END_TAG_REQUIRED = /* @__PURE__ */ new Set([TAG_ID.DD, TAG_ID.DT, TAG_ID.LI, TAG_ID.OPTGROUP, TAG_ID.OPTION, TAG_ID.P, TAG_ID.RB, TAG_ID.RP, TAG_ID.RT, TAG_ID.RTC]);
1246
- var IMPLICIT_END_TAG_REQUIRED_THOROUGHLY = /* @__PURE__ */ new Set([
1247
- ...IMPLICIT_END_TAG_REQUIRED,
1248
- TAG_ID.CAPTION,
1249
- TAG_ID.COLGROUP,
1250
- TAG_ID.TBODY,
1251
- TAG_ID.TD,
1252
- TAG_ID.TFOOT,
1253
- TAG_ID.TH,
1254
- TAG_ID.THEAD,
1255
- TAG_ID.TR
1256
- ]);
1257
- var SCOPING_ELEMENTS_HTML = /* @__PURE__ */ new Set([
1258
- TAG_ID.APPLET,
1259
- TAG_ID.CAPTION,
1260
- TAG_ID.HTML,
1261
- TAG_ID.MARQUEE,
1262
- TAG_ID.OBJECT,
1263
- TAG_ID.TABLE,
1264
- TAG_ID.TD,
1265
- TAG_ID.TEMPLATE,
1266
- TAG_ID.TH
1267
- ]);
1268
- var SCOPING_ELEMENTS_HTML_LIST = /* @__PURE__ */ new Set([...SCOPING_ELEMENTS_HTML, TAG_ID.OL, TAG_ID.UL]);
1269
- var SCOPING_ELEMENTS_HTML_BUTTON = /* @__PURE__ */ new Set([...SCOPING_ELEMENTS_HTML, TAG_ID.BUTTON]);
1270
- var SCOPING_ELEMENTS_MATHML = /* @__PURE__ */ new Set([TAG_ID.ANNOTATION_XML, TAG_ID.MI, TAG_ID.MN, TAG_ID.MO, TAG_ID.MS, TAG_ID.MTEXT]);
1271
- var SCOPING_ELEMENTS_SVG = /* @__PURE__ */ new Set([TAG_ID.DESC, TAG_ID.FOREIGN_OBJECT, TAG_ID.TITLE]);
1272
- var TABLE_ROW_CONTEXT = /* @__PURE__ */ new Set([TAG_ID.TR, TAG_ID.TEMPLATE, TAG_ID.HTML]);
1273
- var TABLE_BODY_CONTEXT = /* @__PURE__ */ new Set([TAG_ID.TBODY, TAG_ID.TFOOT, TAG_ID.THEAD, TAG_ID.TEMPLATE, TAG_ID.HTML]);
1274
- var TABLE_CONTEXT = /* @__PURE__ */ new Set([TAG_ID.TABLE, TAG_ID.TEMPLATE, TAG_ID.HTML]);
1275
- var TABLE_CELLS = /* @__PURE__ */ new Set([TAG_ID.TD, TAG_ID.TH]);
1276
-
1277
- // node_modules/parse5/dist/parser/formatting-element-list.js
1278
- var EntryType;
1279
- (function(EntryType2) {
1280
- EntryType2[EntryType2["Marker"] = 0] = "Marker";
1281
- EntryType2[EntryType2["Element"] = 1] = "Element";
1282
- })(EntryType || (EntryType = {}));
1283
- var MARKER = { type: EntryType.Marker };
1284
-
1285
- // node_modules/parse5/dist/common/doctype.js
1286
- var QUIRKS_MODE_PUBLIC_ID_PREFIXES = [
1287
- "+//silmaril//dtd html pro v0r11 19970101//",
1288
- "-//as//dtd html 3.0 aswedit + extensions//",
1289
- "-//advasoft ltd//dtd html 3.0 aswedit + extensions//",
1290
- "-//ietf//dtd html 2.0 level 1//",
1291
- "-//ietf//dtd html 2.0 level 2//",
1292
- "-//ietf//dtd html 2.0 strict level 1//",
1293
- "-//ietf//dtd html 2.0 strict level 2//",
1294
- "-//ietf//dtd html 2.0 strict//",
1295
- "-//ietf//dtd html 2.0//",
1296
- "-//ietf//dtd html 2.1e//",
1297
- "-//ietf//dtd html 3.0//",
1298
- "-//ietf//dtd html 3.2 final//",
1299
- "-//ietf//dtd html 3.2//",
1300
- "-//ietf//dtd html 3//",
1301
- "-//ietf//dtd html level 0//",
1302
- "-//ietf//dtd html level 1//",
1303
- "-//ietf//dtd html level 2//",
1304
- "-//ietf//dtd html level 3//",
1305
- "-//ietf//dtd html strict level 0//",
1306
- "-//ietf//dtd html strict level 1//",
1307
- "-//ietf//dtd html strict level 2//",
1308
- "-//ietf//dtd html strict level 3//",
1309
- "-//ietf//dtd html strict//",
1310
- "-//ietf//dtd html//",
1311
- "-//metrius//dtd metrius presentational//",
1312
- "-//microsoft//dtd internet explorer 2.0 html strict//",
1313
- "-//microsoft//dtd internet explorer 2.0 html//",
1314
- "-//microsoft//dtd internet explorer 2.0 tables//",
1315
- "-//microsoft//dtd internet explorer 3.0 html strict//",
1316
- "-//microsoft//dtd internet explorer 3.0 html//",
1317
- "-//microsoft//dtd internet explorer 3.0 tables//",
1318
- "-//netscape comm. corp.//dtd html//",
1319
- "-//netscape comm. corp.//dtd strict html//",
1320
- "-//o'reilly and associates//dtd html 2.0//",
1321
- "-//o'reilly and associates//dtd html extended 1.0//",
1322
- "-//o'reilly and associates//dtd html extended relaxed 1.0//",
1323
- "-//sq//dtd html 2.0 hotmetal + extensions//",
1324
- "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//",
1325
- "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//",
1326
- "-//spyglass//dtd html 2.0 extended//",
1327
- "-//sun microsystems corp.//dtd hotjava html//",
1328
- "-//sun microsystems corp.//dtd hotjava strict html//",
1329
- "-//w3c//dtd html 3 1995-03-24//",
1330
- "-//w3c//dtd html 3.2 draft//",
1331
- "-//w3c//dtd html 3.2 final//",
1332
- "-//w3c//dtd html 3.2//",
1333
- "-//w3c//dtd html 3.2s draft//",
1334
- "-//w3c//dtd html 4.0 frameset//",
1335
- "-//w3c//dtd html 4.0 transitional//",
1336
- "-//w3c//dtd html experimental 19960712//",
1337
- "-//w3c//dtd html experimental 970421//",
1338
- "-//w3c//dtd w3 html//",
1339
- "-//w3o//dtd w3 html 3.0//",
1340
- "-//webtechs//dtd mozilla html 2.0//",
1341
- "-//webtechs//dtd mozilla html//"
1342
- ];
1343
- var QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = [
1344
- ...QUIRKS_MODE_PUBLIC_ID_PREFIXES,
1345
- "-//w3c//dtd html 4.01 frameset//",
1346
- "-//w3c//dtd html 4.01 transitional//"
1347
- ];
1348
- var LIMITED_QUIRKS_PUBLIC_ID_PREFIXES = ["-//w3c//dtd xhtml 1.0 frameset//", "-//w3c//dtd xhtml 1.0 transitional//"];
1349
- var LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES = [
1350
- ...LIMITED_QUIRKS_PUBLIC_ID_PREFIXES,
1351
- "-//w3c//dtd html 4.01 frameset//",
1352
- "-//w3c//dtd html 4.01 transitional//"
1353
- ];
1354
-
1355
- // node_modules/parse5/dist/common/foreign-content.js
1356
- var SVG_ATTRS_ADJUSTMENT_MAP = new Map([
1357
- "attributeName",
1358
- "attributeType",
1359
- "baseFrequency",
1360
- "baseProfile",
1361
- "calcMode",
1362
- "clipPathUnits",
1363
- "diffuseConstant",
1364
- "edgeMode",
1365
- "filterUnits",
1366
- "glyphRef",
1367
- "gradientTransform",
1368
- "gradientUnits",
1369
- "kernelMatrix",
1370
- "kernelUnitLength",
1371
- "keyPoints",
1372
- "keySplines",
1373
- "keyTimes",
1374
- "lengthAdjust",
1375
- "limitingConeAngle",
1376
- "markerHeight",
1377
- "markerUnits",
1378
- "markerWidth",
1379
- "maskContentUnits",
1380
- "maskUnits",
1381
- "numOctaves",
1382
- "pathLength",
1383
- "patternContentUnits",
1384
- "patternTransform",
1385
- "patternUnits",
1386
- "pointsAtX",
1387
- "pointsAtY",
1388
- "pointsAtZ",
1389
- "preserveAlpha",
1390
- "preserveAspectRatio",
1391
- "primitiveUnits",
1392
- "refX",
1393
- "refY",
1394
- "repeatCount",
1395
- "repeatDur",
1396
- "requiredExtensions",
1397
- "requiredFeatures",
1398
- "specularConstant",
1399
- "specularExponent",
1400
- "spreadMethod",
1401
- "startOffset",
1402
- "stdDeviation",
1403
- "stitchTiles",
1404
- "surfaceScale",
1405
- "systemLanguage",
1406
- "tableValues",
1407
- "targetX",
1408
- "targetY",
1409
- "textLength",
1410
- "viewBox",
1411
- "viewTarget",
1412
- "xChannelSelector",
1413
- "yChannelSelector",
1414
- "zoomAndPan"
1415
- ].map((attr) => [attr.toLowerCase(), attr]));
1416
- var XML_ATTRS_ADJUSTMENT_MAP = /* @__PURE__ */ new Map([
1417
- ["xlink:actuate", { prefix: "xlink", name: "actuate", namespace: NS.XLINK }],
1418
- ["xlink:arcrole", { prefix: "xlink", name: "arcrole", namespace: NS.XLINK }],
1419
- ["xlink:href", { prefix: "xlink", name: "href", namespace: NS.XLINK }],
1420
- ["xlink:role", { prefix: "xlink", name: "role", namespace: NS.XLINK }],
1421
- ["xlink:show", { prefix: "xlink", name: "show", namespace: NS.XLINK }],
1422
- ["xlink:title", { prefix: "xlink", name: "title", namespace: NS.XLINK }],
1423
- ["xlink:type", { prefix: "xlink", name: "type", namespace: NS.XLINK }],
1424
- ["xml:lang", { prefix: "xml", name: "lang", namespace: NS.XML }],
1425
- ["xml:space", { prefix: "xml", name: "space", namespace: NS.XML }],
1426
- ["xmlns", { prefix: "", name: "xmlns", namespace: NS.XMLNS }],
1427
- ["xmlns:xlink", { prefix: "xmlns", name: "xlink", namespace: NS.XMLNS }]
1428
- ]);
1429
- var SVG_TAG_NAMES_ADJUSTMENT_MAP = new Map([
1430
- "altGlyph",
1431
- "altGlyphDef",
1432
- "altGlyphItem",
1433
- "animateColor",
1434
- "animateMotion",
1435
- "animateTransform",
1436
- "clipPath",
1437
- "feBlend",
1438
- "feColorMatrix",
1439
- "feComponentTransfer",
1440
- "feComposite",
1441
- "feConvolveMatrix",
1442
- "feDiffuseLighting",
1443
- "feDisplacementMap",
1444
- "feDistantLight",
1445
- "feFlood",
1446
- "feFuncA",
1447
- "feFuncB",
1448
- "feFuncG",
1449
- "feFuncR",
1450
- "feGaussianBlur",
1451
- "feImage",
1452
- "feMerge",
1453
- "feMergeNode",
1454
- "feMorphology",
1455
- "feOffset",
1456
- "fePointLight",
1457
- "feSpecularLighting",
1458
- "feSpotLight",
1459
- "feTile",
1460
- "feTurbulence",
1461
- "foreignObject",
1462
- "glyphRef",
1463
- "linearGradient",
1464
- "radialGradient",
1465
- "textPath"
1466
- ].map((tn) => [tn.toLowerCase(), tn]));
1467
- var EXITS_FOREIGN_CONTENT = /* @__PURE__ */ new Set([
1468
- TAG_ID.B,
1469
- TAG_ID.BIG,
1470
- TAG_ID.BLOCKQUOTE,
1471
- TAG_ID.BODY,
1472
- TAG_ID.BR,
1473
- TAG_ID.CENTER,
1474
- TAG_ID.CODE,
1475
- TAG_ID.DD,
1476
- TAG_ID.DIV,
1477
- TAG_ID.DL,
1478
- TAG_ID.DT,
1479
- TAG_ID.EM,
1480
- TAG_ID.EMBED,
1481
- TAG_ID.H1,
1482
- TAG_ID.H2,
1483
- TAG_ID.H3,
1484
- TAG_ID.H4,
1485
- TAG_ID.H5,
1486
- TAG_ID.H6,
1487
- TAG_ID.HEAD,
1488
- TAG_ID.HR,
1489
- TAG_ID.I,
1490
- TAG_ID.IMG,
1491
- TAG_ID.LI,
1492
- TAG_ID.LISTING,
1493
- TAG_ID.MENU,
1494
- TAG_ID.META,
1495
- TAG_ID.NOBR,
1496
- TAG_ID.OL,
1497
- TAG_ID.P,
1498
- TAG_ID.PRE,
1499
- TAG_ID.RUBY,
1500
- TAG_ID.S,
1501
- TAG_ID.SMALL,
1502
- TAG_ID.SPAN,
1503
- TAG_ID.STRONG,
1504
- TAG_ID.STRIKE,
1505
- TAG_ID.SUB,
1506
- TAG_ID.SUP,
1507
- TAG_ID.TABLE,
1508
- TAG_ID.TT,
1509
- TAG_ID.U,
1510
- TAG_ID.UL,
1511
- TAG_ID.VAR
1512
- ]);
1513
-
1514
- // node_modules/parse5/dist/parser/index.js
1515
- var InsertionMode;
1516
- (function(InsertionMode2) {
1517
- InsertionMode2[InsertionMode2["INITIAL"] = 0] = "INITIAL";
1518
- InsertionMode2[InsertionMode2["BEFORE_HTML"] = 1] = "BEFORE_HTML";
1519
- InsertionMode2[InsertionMode2["BEFORE_HEAD"] = 2] = "BEFORE_HEAD";
1520
- InsertionMode2[InsertionMode2["IN_HEAD"] = 3] = "IN_HEAD";
1521
- InsertionMode2[InsertionMode2["IN_HEAD_NO_SCRIPT"] = 4] = "IN_HEAD_NO_SCRIPT";
1522
- InsertionMode2[InsertionMode2["AFTER_HEAD"] = 5] = "AFTER_HEAD";
1523
- InsertionMode2[InsertionMode2["IN_BODY"] = 6] = "IN_BODY";
1524
- InsertionMode2[InsertionMode2["TEXT"] = 7] = "TEXT";
1525
- InsertionMode2[InsertionMode2["IN_TABLE"] = 8] = "IN_TABLE";
1526
- InsertionMode2[InsertionMode2["IN_TABLE_TEXT"] = 9] = "IN_TABLE_TEXT";
1527
- InsertionMode2[InsertionMode2["IN_CAPTION"] = 10] = "IN_CAPTION";
1528
- InsertionMode2[InsertionMode2["IN_COLUMN_GROUP"] = 11] = "IN_COLUMN_GROUP";
1529
- InsertionMode2[InsertionMode2["IN_TABLE_BODY"] = 12] = "IN_TABLE_BODY";
1530
- InsertionMode2[InsertionMode2["IN_ROW"] = 13] = "IN_ROW";
1531
- InsertionMode2[InsertionMode2["IN_CELL"] = 14] = "IN_CELL";
1532
- InsertionMode2[InsertionMode2["IN_SELECT"] = 15] = "IN_SELECT";
1533
- InsertionMode2[InsertionMode2["IN_SELECT_IN_TABLE"] = 16] = "IN_SELECT_IN_TABLE";
1534
- InsertionMode2[InsertionMode2["IN_TEMPLATE"] = 17] = "IN_TEMPLATE";
1535
- InsertionMode2[InsertionMode2["AFTER_BODY"] = 18] = "AFTER_BODY";
1536
- InsertionMode2[InsertionMode2["IN_FRAMESET"] = 19] = "IN_FRAMESET";
1537
- InsertionMode2[InsertionMode2["AFTER_FRAMESET"] = 20] = "AFTER_FRAMESET";
1538
- InsertionMode2[InsertionMode2["AFTER_AFTER_BODY"] = 21] = "AFTER_AFTER_BODY";
1539
- InsertionMode2[InsertionMode2["AFTER_AFTER_FRAMESET"] = 22] = "AFTER_AFTER_FRAMESET";
1540
- })(InsertionMode || (InsertionMode = {}));
1541
- var TABLE_STRUCTURE_TAGS = /* @__PURE__ */ new Set([TAG_ID.TABLE, TAG_ID.TBODY, TAG_ID.TFOOT, TAG_ID.THEAD, TAG_ID.TR]);
1542
- var TABLE_VOID_ELEMENTS = /* @__PURE__ */ new Set([TAG_ID.CAPTION, TAG_ID.COL, TAG_ID.COLGROUP, TAG_ID.TBODY, TAG_ID.TD, TAG_ID.TFOOT, TAG_ID.TH, TAG_ID.THEAD, TAG_ID.TR]);
1543
-
1544
- // node_modules/parse5/dist/serializer/index.js
1545
- var VOID_ELEMENTS = /* @__PURE__ */ new Set([
1546
- TAG_NAMES.AREA,
1547
- TAG_NAMES.BASE,
1548
- TAG_NAMES.BASEFONT,
1549
- TAG_NAMES.BGSOUND,
1550
- TAG_NAMES.BR,
1551
- TAG_NAMES.COL,
1552
- TAG_NAMES.EMBED,
1553
- TAG_NAMES.FRAME,
1554
- TAG_NAMES.HR,
1555
- TAG_NAMES.IMG,
1556
- TAG_NAMES.INPUT,
1557
- TAG_NAMES.KEYGEN,
1558
- TAG_NAMES.LINK,
1559
- TAG_NAMES.META,
1560
- TAG_NAMES.PARAM,
1561
- TAG_NAMES.SOURCE,
1562
- TAG_NAMES.TRACK,
1563
- TAG_NAMES.WBR
1564
- ]);
1565
-
1566
- // packages/design/lib/design/context.mjs
1567
- var reviewDigest = (value) => createHash2("sha256").update(canonicalizeJson(value)).digest("hex");
1568
- function emptyReviewContext(document) {
1569
- return {
1570
- kind: "openplanr-design-review-context",
1571
- schemaVersion: "1.0.0",
1572
- designId: document.id,
1573
- brief: { purpose: "", requests: [] },
1574
- implementation: { tokens: [], components: [], responsive: [], accessibility: [] }
1575
- };
1576
- }
1577
-
1578
- // packages/design/lib/design/document-state.mjs
1579
- import { createHash as createHash3, randomUUID } from "node:crypto";
1580
- import {
1581
- chmodSync,
1582
- closeSync,
1583
- lstatSync,
1584
- mkdirSync,
1585
- openSync,
1586
- readFileSync as readFileSync2,
1587
- realpathSync,
1588
- renameSync,
1589
- rmSync,
1590
- writeFileSync
1591
- } from "node:fs";
1592
- import { dirname as dirname2, join as join2, resolve } from "node:path";
1593
-
1594
- // packages/artifact/lib/artifact/internal/server-util.mjs
1595
- function isProcessAlive(pid) {
1596
- if (!Number.isInteger(pid) || pid <= 0) return false;
1597
- try {
1598
- process.kill(pid, 0);
1599
- return true;
1600
- } catch (err) {
1601
- return err && err.code === "EPERM";
1602
- }
1603
- }
1604
-
1605
- // packages/design/lib/design/document-state.mjs
1606
- var hash = (value) => createHash3("sha256").update(value).digest("hex");
1607
- var json = (value) => `${JSON.stringify(value, null, 2)}
1608
- `;
1609
- function readJson(path, fallback = void 0) {
1610
- try {
1611
- return JSON.parse(readFileSync2(path, "utf8"));
1612
- } catch (error) {
1613
- if (error.code === "ENOENT" && fallback !== void 0) return fallback;
1614
- throw error;
1615
- }
1616
- }
1617
- function atomicJson(path, value, { mode } = {}) {
1618
- atomicBytes(path, json(value), mode);
1619
- }
1620
- function atomicBytes(path, bytes, mode) {
1621
- mkdirSync(dirname2(path), { recursive: true });
1622
- const temporary = `${path}.${randomUUID()}.tmp`;
1623
- try {
1624
- writeFileSync(temporary, bytes, { mode: 384, flag: "wx" });
1625
- if (mode !== void 0) chmodSync(temporary, mode);
1626
- renameSync(temporary, path);
1627
- } finally {
1628
- rmSync(temporary, { force: true });
1629
- }
1630
- }
1631
- function recoverDesignPublication(root, { ownsRenderLock = false } = {}) {
1632
- const journalPath = join2(root, ".design/publication.json");
1633
- let journal = readJson(journalPath, null);
1634
- if (!journal) return;
1635
- const lockPath = join2(root, ".design/render.lock");
1636
- let recoveryOwner;
1637
- if (!ownsRenderLock) {
1638
- const lock = readJson(lockPath, null);
1639
- if (lock && isProcessAlive(lock.pid)) return;
1640
- if (lock) rmSync(lockPath, { force: true });
1641
- recoveryOwner = randomUUID();
1642
- let descriptor;
1643
- try {
1644
- descriptor = openSync(lockPath, "wx", 384);
1645
- writeFileSync(
1646
- descriptor,
1647
- json({ pid: process.pid, owner: recoveryOwner, createdAt: Date.now() })
1648
- );
1649
- } catch (error) {
1650
- if (error.code === "EEXIST") return;
1651
- throw error;
1652
- } finally {
1653
- if (descriptor !== void 0) closeSync(descriptor);
1654
- }
1655
- }
1656
- try {
1657
- journal = readJson(journalPath, null);
1658
- if (!journal) return;
1659
- const pointer = readJson(join2(root, ".design/current.json"), null);
1660
- const manifestPath = join2(root, "finalized.json");
1661
- if (pointer?.revision === journal.revision) atomicJson(manifestPath, journal.manifest);
1662
- else if ((pointer?.revision ?? null) === journal.previousRevision) {
1663
- if (journal.previousManifest === null) rmSync(manifestPath, { force: true });
1664
- else atomicBytes(manifestPath, Buffer.from(journal.previousManifest, "base64"));
1665
- } else if (pointer?.revision && /^[a-f0-9]{64}$/u.test(pointer.revision)) {
1666
- atomicJson(
1667
- manifestPath,
1668
- readJson(join2(root, ".design/revisions", pointer.revision, "render.json")).manifest
1669
- );
1670
- } else
1671
- throw new Error("Design publication recovery could not identify the committed revision.");
1672
- rmSync(journalPath, { force: true });
1673
- } finally {
1674
- if (recoveryOwner && readJson(lockPath, null)?.owner === recoveryOwner)
1675
- rmSync(lockPath, { force: true });
1676
- }
1677
- }
1678
- function designSpecPath(root) {
1679
- return /(?:^|\/)output\/feats\/feat-[^/]+\/design$/u.test(root.replaceAll("\\", "/")) ? join2(dirname2(root), "design-spec.md") : join2(root, "design-spec.md");
1680
- }
1681
- function currentDesign2(file, { recoverPublication = true } = {}) {
1682
- const root = realpathSync(dirname2(resolve(file)));
1683
- if (recoverPublication) recoverDesignPublication(root);
1684
- else {
1685
- try {
1686
- lstatSync(join2(root, ".design/publication.json"));
1687
- throw Object.assign(
1688
- new Error(
1689
- "Design publication state is pending or needs recovery. Finish or recover it with the Design utility; repair or restore an invalid .design/publication.json before retrying Plan handoff inspection."
1690
- ),
1691
- { code: "E_DESIGN_PUBLICATION_PENDING", statusCode: 409 }
1692
- );
1693
- } catch (error) {
1694
- if (error.code !== "ENOENT") throw error;
1695
- }
1696
- }
1697
- const pointer = readJson(join2(root, ".design/current.json"), null);
1698
- if (!pointer || !/^[a-f0-9]{64}$/u.test(pointer.revision))
1699
- throw new Error("Design has no completed render. Run the render utility first.");
1700
- const directory = join2(root, ".design/revisions", pointer.revision);
1701
- const prepared = readJson(join2(directory, "render.json"));
1702
- return {
1703
- ...prepared,
1704
- root,
1705
- directory,
1706
- file: resolve(file),
1707
- verification: readJson(join2(root, ".design/verification", `${pointer.revision}.json`), {
1708
- status: "unverified",
1709
- revision: pointer.revision
1710
- })
1711
- };
1712
- }
1713
-
1714
- // packages/design/lib/design/feedback-reader.mjs
1715
- import { join as join5 } from "node:path";
1716
-
1717
- // packages/artifact/lib/artifact/import.mjs
1718
- import {
1719
- existsSync as existsSync2,
1720
- lstatSync as lstatSync3,
1721
- mkdirSync as mkdirSync3,
1722
- readFileSync as readFileSync4,
1723
- realpathSync as realpathSync2,
1724
- renameSync as renameSync3,
1725
- rmSync as rmSync3,
1726
- statSync as statSync2,
1727
- writeFileSync as writeFileSync3
1728
- } from "node:fs";
1729
- import { homedir as homedir2 } from "node:os";
1730
- import { dirname as dirname3, isAbsolute, join as join4, relative, resolve as resolve3 } from "node:path";
1731
-
1732
- // packages/protocol/src/names.mjs
1733
- var PLANNING_FOLDER = ".planr";
1734
-
1735
- // packages/artifact/lib/artifact/internal/feedback.mjs
1736
- var FEEDBACK_FILE = "feedback.json";
1737
-
1738
- // packages/artifact/lib/artifact/internal/planr-home.mjs
1739
- import { homedir } from "node:os";
1740
- import { join as join3, resolve as resolve2 } from "node:path";
1741
- var WARNED = /* @__PURE__ */ Symbol.for("openplanr.home-variable-warning");
1742
- function nonBlank(value) {
1743
- return typeof value === "string" && value.trim() ? value : void 0;
1744
- }
1745
- function warnOnce(message2) {
1746
- if (globalThis[WARNED]) return;
1747
- globalThis[WARNED] = true;
1748
- process.stderr.write(`Warning: ${message2}
1749
- `);
1750
- }
1751
- function homeVariables(env) {
1752
- const home = nonBlank(env.PLANR_HOME);
1753
- const legacy = nonBlank(env.OPENPLANR_HOME);
1754
- if (legacy === void 0) return { home, legacy };
1755
- const legacyHome = join3(legacy, ".planr");
1756
- if (home === void 0) {
1757
- warnOnce(`OPENPLANR_HOME is deprecated; set PLANR_HOME=${legacyHome} instead.`);
1758
- return { home, legacy };
1759
- }
1760
- warnOnce(
1761
- resolve2(home) === resolve2(legacyHome) ? "OPENPLANR_HOME is deprecated and ignored because PLANR_HOME is set; unset OPENPLANR_HOME." : `PLANR_HOME=${home} and OPENPLANR_HOME=${legacy} name different OpenPlanr homes; using PLANR_HOME. OPENPLANR_HOME is deprecated; unset it.`
1762
- );
1763
- return { home, legacy: void 0 };
1764
- }
1765
- function configuredPlanrHome(env = process.env) {
1766
- const { home, legacy } = homeVariables(env);
1767
- return home ?? (legacy === void 0 ? void 0 : join3(legacy, ".planr"));
1768
- }
1769
- function planrHome(env = process.env) {
1770
- return configuredPlanrHome(env) ?? join3(homedir(), ".planr");
1771
- }
1772
-
1773
- // packages/artifact/lib/artifact/merge.mjs
1774
- var ARTIFACT_REVIEW_STATE_VERSION = "1.0.0";
1775
- var ARTIFACT_REVIEW_STATE_KIND = "artifact-review-state";
1776
- var SHA256_RE2 = /^[a-f0-9]{64}$/;
1777
- var ARTIFACT_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
1778
- function assertUniqueReviewItemIds(review) {
1779
- const pinIds = /* @__PURE__ */ new Set();
1780
- for (const pin of review.pins ?? []) {
1781
- if (pinIds.has(pin.id)) {
1782
- throw new PipelineError(
1783
- ARTIFACT_ERROR_CODES.REVIEW_INVALID,
1784
- "Artifact review contains a duplicate pin ID."
1785
- );
1786
- }
1787
- pinIds.add(pin.id);
1788
- const replyIds = /* @__PURE__ */ new Set();
1789
- for (const reply of pin.replies ?? []) {
1790
- if (replyIds.has(reply.id)) {
1791
- throw new PipelineError(
1792
- ARTIFACT_ERROR_CODES.REVIEW_INVALID,
1793
- "Artifact review contains a duplicate reply ID in one thread."
1794
- );
1795
- }
1796
- replyIds.add(reply.id);
1797
- }
1798
- }
1799
- return review;
1800
- }
1801
- function validateReviewLedger(ledger) {
1802
- if (!ledger || typeof ledger !== "object" || Array.isArray(ledger) || ledger.schemaVersion !== ARTIFACT_REVIEW_STATE_VERSION || ledger.kind !== ARTIFACT_REVIEW_STATE_KIND || !ARTIFACT_ID_RE.test(ledger.artifactId ?? "") || !SHA256_RE2.test(ledger.currentReviewOf ?? "") || !Array.isArray(ledger.reviews)) {
1803
- throw new PipelineError(
1804
- ARTIFACT_ERROR_CODES.REVIEW_INVALID,
1805
- "Artifact review state is not a valid versioned review ledger."
1806
- );
1807
- }
1808
- const ids = /* @__PURE__ */ new Set();
1809
- for (const entry of ledger.reviews) {
1810
- if (!entry || typeof entry !== "object" || Array.isArray(entry) || typeof entry.stale !== "boolean" || !entry.review) {
1811
- throw new PipelineError(
1812
- ARTIFACT_ERROR_CODES.REVIEW_INVALID,
1813
- "Artifact review ledger entry is invalid."
1814
- );
1815
- }
1816
- validateArtifactReview(entry.review);
1817
- assertUniqueReviewItemIds(entry.review);
1818
- if (ids.has(entry.review.reviewId)) {
1819
- throw new PipelineError(
1820
- ARTIFACT_ERROR_CODES.REVIEW_INVALID,
1821
- "Artifact review ledger IDs must be unique."
1822
- );
1823
- }
1824
- ids.add(entry.review.reviewId);
1825
- }
1826
- return ledger;
1827
- }
1828
-
1829
- // packages/artifact/lib/artifact/review.mjs
1830
- import {
1831
- existsSync,
1832
- lstatSync as lstatSync2,
1833
- mkdirSync as mkdirSync2,
1834
- readFileSync as readFileSync3,
1835
- renameSync as renameSync2,
1836
- rmSync as rmSync2,
1837
- statSync,
1838
- writeFileSync as writeFileSync2
1839
- } from "node:fs";
1840
- var ARTIFACT_REVIEW_MAX_STATE_BYTES = 5 * 1024 * 1024;
1841
- function finalEntry(path, fs = { lstatSync: lstatSync2 }) {
1842
- try {
1843
- return fs.lstatSync(path);
1844
- } catch (error) {
1845
- if (error?.code === "ENOENT") return null;
1846
- throw error;
1847
- }
1848
- }
1849
- function readArtifactReviewState(path, { allowMissing = false } = {}) {
1850
- const entry = finalEntry(path);
1851
- if (!entry) {
1852
- if (allowMissing) return null;
1853
- throw new PipelineError(
1854
- ARTIFACT_ERROR_CODES.REVIEW_IMPORT,
1855
- "Artifact review state does not exist."
1856
- );
1857
- }
1858
- try {
1859
- if (entry.isSymbolicLink() || !entry.isFile()) {
1860
- throw new PipelineError(
1861
- ARTIFACT_ERROR_CODES.SYMLINK_ESCAPE,
1862
- "Artifact review state destination is not a regular file."
1863
- );
1864
- }
1865
- if (statSync(path).size > ARTIFACT_REVIEW_MAX_STATE_BYTES) {
1866
- throw new PipelineError(
1867
- ARTIFACT_ERROR_CODES.REQUEST_LIMIT,
1868
- `Artifact review state exceeds ${ARTIFACT_REVIEW_MAX_STATE_BYTES} bytes.`
1869
- );
1870
- }
1871
- return validateReviewLedger(JSON.parse(readFileSync3(path, "utf8")));
1872
- } catch (error) {
1873
- if (error instanceof PipelineError) throw error;
1874
- throw new PipelineError(
1875
- ARTIFACT_ERROR_CODES.REVIEW_INVALID,
1876
- "Artifact review state is malformed."
1877
- );
1878
- }
1879
- }
1880
-
1881
- // packages/artifact/lib/artifact/import.mjs
1882
- var ARTIFACT_ID_RE2 = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
1883
- function pathError(code, message2) {
1884
- throw new PipelineError(
1885
- code,
1886
- message2,
1887
- "Choose a real, non-symlinked project or user review destination."
1888
- );
1889
- }
1890
- function pathEntry(path, fs = { lstatSync: lstatSync3 }) {
1891
- try {
1892
- return fs.lstatSync(path);
1893
- } catch (error) {
1894
- if (error?.code === "ENOENT") return null;
1895
- throw error;
1896
- }
1897
- }
1898
- function inside(base, candidate) {
1899
- const rel = relative(base, candidate);
1900
- return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
1901
- }
1902
- function parseablePlanrConfig(root) {
1903
- const path = join4(root, PLANNING_FOLDER, "config.json");
1904
- if (!existsSync2(path)) return false;
1905
- try {
1906
- if (lstatSync3(path).isSymbolicLink()) return false;
1907
- const value = JSON.parse(readFileSync4(path, "utf8"));
1908
- return value && typeof value === "object" && !Array.isArray(value) && (typeof value.projectName === "string" && value.projectName.trim() !== "" || value.idPrefix && typeof value.idPrefix === "object" && !Array.isArray(value.idPrefix) && Object.keys(value.idPrefix).length > 0);
1909
- } catch {
1910
- return false;
1911
- }
1912
- }
1913
- function hasGitMarker(root) {
1914
- const marker = join4(root, ".git");
1915
- if (!existsSync2(marker)) return false;
1916
- try {
1917
- const stat = lstatSync3(marker);
1918
- if (stat.isSymbolicLink()) return false;
1919
- if (stat.isDirectory()) {
1920
- const head = join4(marker, "HEAD");
1921
- return existsSync2(head) && lstatSync3(head).isFile();
1922
- }
1923
- if (!stat.isFile() || stat.size > 4096) return false;
1924
- const match = /^gitdir:\s*(.+?)\s*$/u.exec(readFileSync4(marker, "utf8"));
1925
- if (!match) return false;
1926
- const gitDir = resolve3(root, match[1]);
1927
- return existsSync2(gitDir) && statSync2(gitDir).isDirectory() && existsSync2(join4(gitDir, "HEAD")) && lstatSync3(join4(gitDir, "HEAD")).isFile();
1928
- } catch {
1929
- return false;
1930
- }
1931
- }
1932
- function findArtifactProjectRoot(start = process.cwd(), { env = process.env } = {}) {
1933
- let current;
1934
- try {
1935
- current = realpathSync2(resolve3(start));
1936
- } catch {
1937
- pathError(
1938
- ARTIFACT_ERROR_CODES.REVIEW_IMPORT,
1939
- "Artifact review working directory does not exist."
1940
- );
1941
- }
1942
- const homeCandidate = resolve3(env.HOME ?? homedir2());
1943
- let home = homeCandidate;
1944
- try {
1945
- home = realpathSync2(homeCandidate);
1946
- } catch {
1947
- }
1948
- while (true) {
1949
- if (current !== home && (parseablePlanrConfig(current) || hasGitMarker(current)))
1950
- return current;
1951
- const parent = dirname3(current);
1952
- if (parent === current) return null;
1953
- current = parent;
1954
- }
1955
- }
1956
- function assertSafeDestination(base, relativeParts) {
1957
- const absoluteBase = resolve3(base);
1958
- if (existsSync2(absoluteBase) && lstatSync3(absoluteBase).isSymbolicLink()) {
1959
- pathError(
1960
- ARTIFACT_ERROR_CODES.SYMLINK_ESCAPE,
1961
- "Artifact review destination base is a symlink."
1962
- );
1963
- }
1964
- let realBase = absoluteBase;
1965
- if (existsSync2(absoluteBase)) realBase = realpathSync2(absoluteBase);
1966
- let current = absoluteBase;
1967
- for (const part of relativeParts) {
1968
- if (!part || part === "." || part === ".." || part.includes("/") || part.includes("\\") || part.includes("\0")) {
1969
- pathError(
1970
- ARTIFACT_ERROR_CODES.PATH_TRAVERSAL,
1971
- "Artifact review destination contains an unsafe segment."
1972
- );
1973
- }
1974
- current = join4(current, part);
1975
- const entry = pathEntry(current);
1976
- if (!entry) continue;
1977
- if (entry.isSymbolicLink()) {
1978
- pathError(
1979
- ARTIFACT_ERROR_CODES.SYMLINK_ESCAPE,
1980
- "Artifact review destination contains a symlink."
1981
- );
1982
- }
1983
- if (!inside(realBase, realpathSync2(current))) {
1984
- pathError(
1985
- ARTIFACT_ERROR_CODES.PATH_TRAVERSAL,
1986
- "Artifact review destination escapes its storage root."
1987
- );
1988
- }
1989
- }
1990
- if (!inside(absoluteBase, current)) {
1991
- pathError(
1992
- ARTIFACT_ERROR_CODES.PATH_TRAVERSAL,
1993
- "Artifact review destination escapes its storage root."
1994
- );
1995
- }
1996
- return current;
1997
- }
1998
- function resolveArtifactReviewDestination({
1999
- cwd = process.cwd(),
2000
- env = process.env,
2001
- artifactId,
2002
- designDir
2003
- } = {}) {
2004
- if (!ARTIFACT_ID_RE2.test(artifactId ?? "")) {
2005
- pathError(
2006
- ARTIFACT_ERROR_CODES.PATH_TRAVERSAL,
2007
- "Artifact review ID is unsafe for local storage."
2008
- );
2009
- }
2010
- if (designDir !== void 0) {
2011
- const lexical = resolve3(designDir);
2012
- if (!existsSync2(lexical) || !statSync2(lexical).isDirectory()) {
2013
- pathError(ARTIFACT_ERROR_CODES.REVIEW_IMPORT, "Design review destination does not exist.");
2014
- }
2015
- if (lstatSync3(lexical).isSymbolicLink()) {
2016
- pathError(
2017
- ARTIFACT_ERROR_CODES.SYMLINK_ESCAPE,
2018
- "Design review destination must be a real directory."
2019
- );
2020
- }
2021
- const requested = realpathSync2(lexical);
2022
- return Object.freeze({
2023
- kind: "design",
2024
- artifactId,
2025
- directory: requested,
2026
- path: join4(requested, FEEDBACK_FILE),
2027
- reviewStatePath: join4(requested, "artifact-review-state.json")
2028
- });
2029
- }
2030
- const projectRoot = findArtifactProjectRoot(cwd, { env });
2031
- if (projectRoot) {
2032
- const directory2 = assertSafeDestination(projectRoot, [
2033
- PLANNING_FOLDER,
2034
- "artifacts",
2035
- artifactId
2036
- ]);
2037
- return Object.freeze({
2038
- kind: "project",
2039
- artifactId,
2040
- root: projectRoot,
2041
- directory: directory2,
2042
- path: join4(directory2, "review-state.json")
2043
- });
2044
- }
2045
- const root = resolve3(planrHome(env));
2046
- const directory = assertSafeDestination(root, ["artifacts", artifactId]);
2047
- return Object.freeze({
2048
- kind: "user",
2049
- artifactId,
2050
- root,
2051
- directory,
2052
- path: join4(directory, "review-state.json")
2053
- });
2054
- }
2055
-
2056
- // packages/design/lib/design/feedback-reader.mjs
2057
- var designReviewKey = (document) => `design-${hash(document.id).slice(0, 24)}`;
2058
- function designReviewPath(file, env = process.env, options = {}) {
2059
- const { root, document } = currentDesign2(file, options);
2060
- return resolveArtifactReviewDestination({
2061
- cwd: root,
2062
- env,
2063
- artifactId: designReviewKey(document)
2064
- }).path;
2065
- }
2066
- function readDesignFeedback(file, env = process.env, options = {}) {
2067
- const current = currentDesign2(file, options);
2068
- const ledger = readArtifactReviewState(designReviewPath(file, env, options), {
2069
- allowMissing: true
2070
- });
2071
- const digest2 = digestArtifactEnvelope(current.envelope);
2072
- const pins = (ledger?.reviews ?? []).flatMap(
2073
- (entry) => entry.review.pins.map((pin) => {
2074
- const target = current.entries.find((item2) => item2.artifactId === pin.artifactId);
2075
- const screen = target && current.document.screens.find((item2) => item2.id === target.screenId);
2076
- const anchorMissing = pin.anchor?.planrId && screen?.anchors?.length && !screen.anchors.includes(pin.anchor.planrId) && pin.anchor.planrId !== screen.id;
2077
- return {
2078
- ...pin,
2079
- reviewId: entry.review.reviewId,
2080
- reviewOf: entry.review.reviewOf,
2081
- ...entry.review.reviewId.startsWith("shared-") ? { revisionId: entry.review.reviewId.slice(7) } : {},
2082
- stale: entry.stale || entry.review.reviewOf !== digest2 || !target || Boolean(anchorMissing),
2083
- ...target ? { screenId: target.screenId, variantId: target.variantId } : {}
2084
- };
2085
- })
2086
- );
2087
- return {
2088
- revision: current.revision,
2089
- reviewPath: designReviewPath(file, env, options),
2090
- pins,
2091
- state: readJson(join5(current.root, ".design/studio-state.json"), {
2092
- state: {},
2093
- stateVersion: 0
2094
- }).state,
2095
- ledger,
2096
- shared: readJson(join5(current.root, ".design/shared-feedback.json"), null)
2097
- };
2098
- }
2099
-
2100
- // packages/design/lib/design/handoff-format.mjs
2101
- var safeMd = (text2) => String(text2).replaceAll("[", "\\[").replaceAll("]", "\\]").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2102
- function renderMarkdown(draft, title) {
2103
- const lines = [
2104
- `# ${safeMd(title)} \u2014 review handoff`,
2105
- "",
2106
- `Status: ${draft.status}. Source revision: ${draft.basis.sourceRevision}.`,
2107
- "",
2108
- draft.content.summary || "Owner summary has not been written.",
2109
- ""
2110
- ];
2111
- for (const [key, label] of [
2112
- ["agreedChanges", "Agreed changes"],
2113
- ["openQuestions", "Open questions"],
2114
- ["deferred", "Deferred"],
2115
- ["rejected", "Rejected"]
2116
- ]) {
2117
- lines.push(`## ${label}`, "");
2118
- for (const item2 of draft.content[key]) {
2119
- lines.push(
2120
- `- ${safeMd(item2.refinement ?? item2.text)} \u2014 ${safeMd(item2.author ?? "Reviewer")}${item2.stale ? " \xB7 original revision" : ""} [source comment](${item2.source})`
2121
- );
2122
- if (item2.refinement) lines.push(` Original comment: ${safeMd(item2.text)}`);
2123
- }
2124
- if (!draft.content[key].length) lines.push("None recorded.");
2125
- lines.push("");
2126
- }
2127
- lines.push(
2128
- "## Overall review notes",
2129
- "",
2130
- ...draft.reviewNotes.map((note) => `- ${safeMd(note.text)} (${safeMd(note.reviewId)})`),
2131
- ""
2132
- );
2133
- lines.push(
2134
- "## Verification gaps",
2135
- "",
2136
- ...draft.verificationGaps.length ? draft.verificationGaps.map((value) => `- ${safeMd(value)}`) : ["None recorded."],
2137
- "",
2138
- "Plan and Ship remain separate user invocations.",
2139
- ""
2140
- );
2141
- return lines.join("\n");
2142
- }
2143
-
2144
- // packages/design/lib/design/handoff-readiness.mjs
2145
- var CHECKS = Object.freeze([
2146
- "current-revision",
2147
- "selected-direction",
2148
- "design-specification",
2149
- "rendered-verification",
2150
- "review-freshness",
2151
- "review-dispositions",
2152
- "unresolved-blockers",
2153
- "approved-review-handoff"
2154
- ]);
2155
- var action = Object.freeze({
2156
- "current-revision": Object.freeze({ id: "render-design", label: "Render the current design" }),
2157
- "selected-direction": Object.freeze({
2158
- id: "select-direction",
2159
- label: "Choose one ready direction"
2160
- }),
2161
- "design-specification": Object.freeze({
2162
- id: "complete-design-specification",
2163
- label: "Complete the design specification"
2164
- }),
2165
- "rendered-verification": Object.freeze({
2166
- id: "verify-rendered-design",
2167
- label: "Verify the rendered design"
2168
- }),
2169
- "review-freshness": Object.freeze({
2170
- id: "refresh-review",
2171
- label: "Refresh review against the current design"
2172
- }),
2173
- "review-dispositions": Object.freeze({
2174
- id: "resolve-review-decisions",
2175
- label: "Record the remaining review decisions"
2176
- }),
2177
- "unresolved-blockers": Object.freeze({
2178
- id: "resolve-review-blockers",
2179
- label: "Resolve the blocking feedback"
2180
- }),
2181
- "approved-review-handoff": Object.freeze({
2182
- id: "approve-review-handoff",
2183
- label: "Prepare and approve the current review handoff"
2184
- })
2185
- });
2186
- var message = Object.freeze({
2187
- "current-revision": Object.freeze({
2188
- pass: "The current design has a completed render.",
2189
- blocked: "Render the design before preparing work for engineering."
2190
- }),
2191
- "selected-direction": Object.freeze({
2192
- pass: "One ready design direction is selected.",
2193
- blocked: "Choose one ready design direction before continuing.",
2194
- stale: "The selected direction changed after the review handoff was prepared."
2195
- }),
2196
- "design-specification": Object.freeze({
2197
- pass: "The design specification is complete for this revision.",
2198
- blocked: "Complete the design specification before continuing.",
2199
- stale: "The design specification belongs to an earlier revision."
2200
- }),
2201
- "rendered-verification": Object.freeze({
2202
- pass: "The rendered design is verified for this revision.",
2203
- blocked: "Complete rendered design verification before continuing.",
2204
- stale: "Rendered verification belongs to an earlier revision."
2205
- }),
2206
- "review-freshness": Object.freeze({
2207
- pass: "Review feedback is current for this revision.",
2208
- blocked: "Review feedback contains ambiguous identities or anchors.",
2209
- stale: "Review feedback belongs to an earlier revision."
2210
- }),
2211
- "review-dispositions": Object.freeze({
2212
- pass: "Every current review comment has a recorded outcome.",
2213
- attention: "Some non-blocking review comments still need an owner decision.",
2214
- blocked: "Review decisions are incomplete or ambiguous."
2215
- }),
2216
- "unresolved-blockers": Object.freeze({
2217
- pass: "No blocking feedback remains open.",
2218
- blocked: "Blocking feedback must be resolved before continuing.",
2219
- stale: "A prior decision must be reviewed against the current design."
2220
- }),
2221
- "approved-review-handoff": Object.freeze({
2222
- pass: "The current review handoff is approved.",
2223
- blocked: "Prepare and approve the review handoff before continuing.",
2224
- stale: "The approved review handoff no longer matches the current design."
2225
- })
2226
- });
2227
- var priority = Object.freeze({ pass: 0, attention: 1, blocked: 2, stale: 3 });
2228
-
2229
- // packages/design/lib/design/handoff-resolution.mjs
2230
- var OUTCOMES = /* @__PURE__ */ new Set(["accepted", "open", "blocking", "deferred", "declined"]);
2231
- var CATEGORIES = /* @__PURE__ */ new Set(["question", "suggestion", "change-request", "blocker"]);
2232
- var DISPOSITIONS = /* @__PURE__ */ new Set(["accepted", "deferred", "rejected", "declined"]);
2233
- var MAX_COMMENTS = 1e4;
2234
- var MAX_ISSUES = 1e4;
2235
- var digestPattern = /^[a-f0-9]{64}$/u;
2236
- var revisionOf = (pin) => pin.revisionId ?? pin.reviewId;
2237
- var keyOf = (pin) => `${revisionOf(pin)}:${pin.id}`;
2238
- var compare = (left, right) => left.localeCompare(right, "en");
2239
- var clone = (value) => {
2240
- assertPlainData(value, "Review resolution data");
2241
- return JSON.parse(canonicalizeJson(value));
2242
- };
2243
- function issue(code, severity, message2, { pinId, revisionId, recoveryAction } = {}) {
2244
- return {
2245
- code,
2246
- severity,
2247
- message: message2,
2248
- ...revisionId ? { revisionId } : {},
2249
- ...pinId ? { pinId } : {},
2250
- recoveryAction: recoveryAction ?? {
2251
- id: "refresh-review-resolution",
2252
- label: "Refresh review decisions"
2253
- }
2254
- };
2255
- }
2256
- function validatePin(pin) {
2257
- if (!pin || typeof pin !== "object" || Array.isArray(pin))
2258
- throw new TypeError("Every review comment must be an object.");
2259
- if (typeof pin.id !== "string" || !pin.id || pin.id.length > 160)
2260
- throw new TypeError("Every review comment requires a stable identity.");
2261
- const revisionId = revisionOf(pin);
2262
- if (typeof revisionId !== "string" || !revisionId || revisionId.length > 160)
2263
- throw new TypeError("Every review comment requires its original revision identity.");
2264
- if (typeof pin.reviewOf !== "string" || !digestPattern.test(pin.reviewOf))
2265
- throw new TypeError("Every review comment requires its original review basis.");
2266
- if (pin.screenId !== void 0 && (typeof pin.screenId !== "string" || !pin.screenId))
2267
- throw new TypeError("Review screen references must be stable identities.");
2268
- if (pin.elementId !== void 0 && (typeof pin.elementId !== "string" || !pin.elementId || !pin.screenId))
2269
- throw new TypeError("Review element references require a stable screen identity.");
2270
- }
2271
- function scopedMetadata(metadata2, pin, duplicatePinIds, diagnostics) {
2272
- const revisionId = revisionOf(pin);
2273
- const scoped = metadata2.byRevision?.[revisionId] ?? {};
2274
- let category = scoped.categories?.[pin.id];
2275
- let disposition = scoped.dispositions?.[pin.id];
2276
- if (category === void 0 && Object.hasOwn(metadata2.categories ?? {}, pin.id)) {
2277
- if (duplicatePinIds.has(pin.id))
2278
- diagnostics.push(
2279
- issue(
2280
- "AMBIGUOUS_LEGACY_CATEGORY",
2281
- "blocked",
2282
- "A legacy category cannot be matched to one original revision.",
2283
- { pinId: pin.id, revisionId }
2284
- )
2285
- );
2286
- else category = metadata2.categories[pin.id];
2287
- }
2288
- if (disposition === void 0 && Object.hasOwn(metadata2.dispositions ?? {}, pin.id)) {
2289
- if (duplicatePinIds.has(pin.id))
2290
- diagnostics.push(
2291
- issue(
2292
- "AMBIGUOUS_LEGACY_DISPOSITION",
2293
- "blocked",
2294
- "A legacy owner decision cannot be matched to one original revision.",
2295
- { pinId: pin.id, revisionId }
2296
- )
2297
- );
2298
- else disposition = metadata2.dispositions[pin.id];
2299
- }
2300
- if (category !== void 0 && !CATEGORIES.has(category)) {
2301
- diagnostics.push(
2302
- issue("UNKNOWN_CATEGORY", "blocked", "The comment category is not supported.", {
2303
- pinId: pin.id,
2304
- revisionId
2305
- })
2306
- );
2307
- category = void 0;
2308
- }
2309
- const dispositionValue = typeof disposition === "string" ? disposition : disposition?.disposition;
2310
- if (dispositionValue !== void 0 && !DISPOSITIONS.has(dispositionValue)) {
2311
- diagnostics.push(
2312
- issue("UNKNOWN_DISPOSITION", "blocked", "The owner decision is not supported.", {
2313
- pinId: pin.id,
2314
- revisionId
2315
- })
2316
- );
2317
- disposition = void 0;
2318
- }
2319
- return {
2320
- category,
2321
- disposition,
2322
- dispositionValue: typeof disposition === "string" ? disposition : disposition?.disposition
2323
- };
2324
- }
2325
- function unknownMetadata(metadata2, known, diagnostics) {
2326
- for (const [revisionId, value] of Object.entries(metadata2.byRevision ?? {}).sort(
2327
- ([left], [right]) => compare(left, right)
2328
- )) {
2329
- for (const field of ["categories", "dispositions"]) {
2330
- for (const pinId of Object.keys(value?.[field] ?? {}).sort(compare)) {
2331
- if (!known.has(`${revisionId}:${pinId}`))
2332
- diagnostics.push(
2333
- issue(
2334
- "UNKNOWN_COMMENT_METADATA",
2335
- "blocked",
2336
- "Review metadata targets a comment that is not present in the recorded review history.",
2337
- { revisionId, pinId }
2338
- )
2339
- );
2340
- }
2341
- }
2342
- }
2343
- }
2344
- function compileDesignHandoffResolution(input) {
2345
- const source = clone(input ?? {});
2346
- const pins = Array.isArray(source.pins) ? source.pins : [];
2347
- if (pins.length > MAX_COMMENTS)
2348
- throw new RangeError("Review resolution exceeds the comment limit.");
2349
- const metadata2 = source.metadata && typeof source.metadata === "object" && !Array.isArray(source.metadata) ? source.metadata : {};
2350
- const diagnostics = [];
2351
- const counts = /* @__PURE__ */ new Map();
2352
- for (const pin of pins) {
2353
- validatePin(pin);
2354
- counts.set(pin.id, (counts.get(pin.id) ?? 0) + 1);
2355
- }
2356
- const duplicatePinIds = new Set([...counts].filter(([, count]) => count > 1).map(([id2]) => id2));
2357
- const known = /* @__PURE__ */ new Set();
2358
- for (const pin of pins) {
2359
- const key = keyOf(pin);
2360
- if (known.has(key)) throw new TypeError(`Duplicate review comment identity: ${key}.`);
2361
- known.add(key);
2362
- }
2363
- unknownMetadata(metadata2, known, diagnostics);
2364
- const items = [...pins].sort((left, right) => compare(keyOf(left), keyOf(right))).map((pin) => {
2365
- const revisionId = revisionOf(pin);
2366
- const current = pin.stale !== true && (!source.currentReviewOf || pin.reviewOf === source.currentReviewOf);
2367
- const resolved = scopedMetadata(metadata2, pin, duplicatePinIds, diagnostics);
2368
- let outcome;
2369
- if (resolved.dispositionValue === "accepted") outcome = "accepted";
2370
- else if (resolved.dispositionValue === "deferred") outcome = "deferred";
2371
- else if (["rejected", "declined"].includes(resolved.dispositionValue)) outcome = "declined";
2372
- else if (["blocker", "change-request"].includes(resolved.category)) outcome = "blocking";
2373
- else outcome = "open";
2374
- if (!OUTCOMES.has(outcome)) throw new Error("Review resolution produced an invalid outcome.");
2375
- if (!current && outcome === "accepted")
2376
- diagnostics.push(
2377
- issue(
2378
- "STALE_ACCEPTED_DECISION",
2379
- "stale",
2380
- "An accepted change belongs to an earlier design revision and must be reviewed again.",
2381
- {
2382
- pinId: pin.id,
2383
- revisionId,
2384
- recoveryAction: {
2385
- id: "review-stale-decision",
2386
- label: "Review this decision against the current design"
2387
- }
2388
- }
2389
- )
2390
- );
2391
- if (current && outcome === "blocking")
2392
- diagnostics.push(
2393
- issue(
2394
- "UNRESOLVED_BLOCKING_COMMENT",
2395
- "blocked",
2396
- "A blocking comment still needs an owner decision.",
2397
- {
2398
- pinId: pin.id,
2399
- revisionId,
2400
- recoveryAction: {
2401
- id: "resolve-blocking-comment",
2402
- label: "Record the owner decision"
2403
- }
2404
- }
2405
- )
2406
- );
2407
- return {
2408
- id: keyOf(pin),
2409
- pinId: pin.id,
2410
- reviewId: pin.reviewId,
2411
- revisionId,
2412
- reviewOf: pin.reviewOf,
2413
- current,
2414
- category: resolved.category ?? "question",
2415
- outcome,
2416
- implementationScope: current && outcome === "accepted",
2417
- anchor: pin.elementId ? { screenId: pin.screenId, elementId: pin.elementId } : pin.screenId ? { screenId: pin.screenId } : pin.anchor?.planrId ? { planrId: pin.anchor.planrId } : { artifactId: pin.artifactId },
2418
- source: {
2419
- text: pin.comment,
2420
- author: clone(pin.author),
2421
- status: pin.status,
2422
- ...resolved.disposition && typeof resolved.disposition === "object" ? { decision: clone(resolved.disposition) } : {}
2423
- }
2424
- };
2425
- });
2426
- if (source.historyComplete === false)
2427
- diagnostics.push(
2428
- issue("INCOMPLETE_REVIEW_HISTORY", "blocked", "The complete review history is unavailable.", {
2429
- recoveryAction: {
2430
- id: "restore-review-history",
2431
- label: "Restore the complete review history"
2432
- }
2433
- })
2434
- );
2435
- if (source.synchronizationPending === true)
2436
- diagnostics.push(
2437
- issue(
2438
- "SYNCHRONIZATION_PENDING",
2439
- "blocked",
2440
- "A review decision is still waiting to synchronize.",
2441
- {
2442
- recoveryAction: {
2443
- id: "retry-review-sync",
2444
- label: "Retry review synchronization"
2445
- }
2446
- }
2447
- )
2448
- );
2449
- for (const value of (source.synchronizationIssues ?? []).slice(0, MAX_ISSUES))
2450
- diagnostics.push(
2451
- issue(
2452
- "UNTRUSTED_HOSTED_FEEDBACK",
2453
- "blocked",
2454
- value?.reason || "Hosted feedback could not be validated.",
2455
- {
2456
- pinId: value?.pinId,
2457
- revisionId: value?.revisionId,
2458
- recoveryAction: {
2459
- id: "inspect-review-sync",
2460
- label: "Inspect the rejected hosted feedback"
2461
- }
2462
- }
2463
- )
2464
- );
2465
- if ((source.synchronizationIssues ?? []).length > MAX_ISSUES)
2466
- throw new RangeError("Review resolution exceeds the synchronization issue limit.");
2467
- diagnostics.sort(
2468
- (left, right) => compare(
2469
- `${left.code}:${left.revisionId ?? ""}:${left.pinId ?? ""}:${left.message}`,
2470
- `${right.code}:${right.revisionId ?? ""}:${right.pinId ?? ""}:${right.message}`
2471
- )
2472
- );
2473
- const severity = new Set(diagnostics.map((value) => value.severity));
2474
- const status = severity.has("stale") ? "stale" : severity.has("blocked") ? "blocked" : items.some((item2) => item2.outcome === "open") ? "attention" : "ready";
2475
- return {
2476
- kind: "openplanr-design-handoff-resolution",
2477
- schemaVersion: "1.0.0",
2478
- currentReviewOf: source.currentReviewOf ?? null,
2479
- status,
2480
- complete: source.historyComplete !== false && !["blocked", "stale"].includes(status),
2481
- items,
2482
- implementationScope: items.filter((item2) => item2.implementationScope).map((item2) => item2.id),
2483
- diagnostics
2484
- };
2485
- }
2486
-
2487
- // packages/design/lib/design/share-status.mjs
2488
- import { existsSync as existsSync4, realpathSync as realpathSync4 } from "node:fs";
2489
- import { homedir as homedir3 } from "node:os";
2490
- import { dirname as dirname5, isAbsolute as isAbsolute3, join as join7, relative as relative3, resolve as resolve5 } from "node:path";
2491
-
2492
- // packages/artifact/lib/artifact/owner-custody.mjs
2493
- import {
2494
- chmodSync as chmodSync2,
2495
- closeSync as closeSync2,
2496
- existsSync as existsSync3,
2497
- fsyncSync,
2498
- linkSync,
2499
- lstatSync as lstatSync4,
2500
- mkdirSync as mkdirSync4,
2501
- openSync as openSync2,
2502
- readFileSync as readFileSync5,
2503
- realpathSync as realpathSync3,
2504
- renameSync as renameSync4,
2505
- unlinkSync,
2506
- writeFileSync as writeFileSync4
2507
- } from "node:fs";
2508
- import { basename, dirname as dirname4, isAbsolute as isAbsolute2, join as join6, relative as relative2, resolve as resolve4 } from "node:path";
2509
- function custodyError(message2, code = "E_OWNER_CUSTODY_LOCATION") {
2510
- return Object.assign(new Error(message2), { code, status: 400 });
2511
- }
2512
- function pathExists(path) {
2513
- try {
2514
- lstatSync4(path);
2515
- return true;
2516
- } catch (error) {
2517
- if (error.code === "ENOENT") return false;
2518
- throw error;
2519
- }
2520
- }
2521
- function assertDirectoryAncestry(root, label) {
2522
- for (let path = root; dirname4(path) !== path; path = dirname4(path)) {
2523
- if (pathExists(path) && lstatSync4(path).isSymbolicLink())
2524
- throw custodyError(`${label} custody directory must not contain symbolic links.`);
2525
- }
2526
- }
2527
- function assertPrivateFile(path, label) {
2528
- const stat = lstatSync4(path);
2529
- if (!stat.isFile() || stat.isSymbolicLink() || process.platform !== "win32" && (stat.mode & 63 || stat.uid !== process.getuid()))
2530
- throw custodyError(
2531
- `${label} owner custody must be a private 0600 file.`,
2532
- "E_OWNER_CUSTODY_INVALID"
2533
- );
2534
- }
2535
- function assertPrivateDirectory(root, label, recoveryOutput = false) {
2536
- const stat = lstatSync4(root);
2537
- if (!stat.isDirectory() || stat.isSymbolicLink() || !recoveryOutput && process.platform !== "win32" && (stat.mode & 63 || stat.uid !== process.getuid()))
2538
- throw custodyError(`${label} custody must use a private local directory.`);
2539
- }
2540
- function readCustody(path, { label = "Owner", format, recoveryInput = false } = {}) {
2541
- if (recoveryInput && existsSync3(path)) {
2542
- assertPrivateFile(path, label);
2543
- path = realpathSync3(path);
2544
- }
2545
- assertDirectoryAncestry(dirname4(path), label);
2546
- if (!pathExists(path)) return null;
2547
- assertPrivateDirectory(dirname4(path), label, recoveryInput);
2548
- assertPrivateFile(path, label);
2549
- let record;
2550
- try {
2551
- record = JSON.parse(readFileSync5(path, "utf8"));
2552
- } catch {
2553
- throw custodyError(`${label} owner custody is invalid.`, "E_OWNER_CUSTODY_INVALID");
2554
- }
2555
- if (record?.kind !== format || record.schemaVersion !== "1.0.0" || !record.custody)
2556
- throw custodyError(`${label} owner custody is invalid.`, "E_OWNER_CUSTODY_INVALID");
2557
- return record;
2558
- }
2559
-
2560
- // packages/artifact/lib/artifact/internal/workspace-address.mjs
2561
- function createWorkspaceAddress({
2562
- label,
2563
- reviewPath,
2564
- defaultBaseUrl = "https://share.openplanr.dev"
2565
- }) {
2566
- function normalizeWorkspaceBase2(baseUrl = defaultBaseUrl) {
2567
- const url = new URL(baseUrl);
2568
- if (url.username || url.password || url.search || url.hash || url.pathname !== "/" || url.protocol !== "https:" && !(url.protocol === "http:" && ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname)))
2569
- throw new TypeError(
2570
- `${label} sharing requires an HTTPS origin or a local development server.`
2571
- );
2572
- return url.origin;
2573
- }
2574
- function workspaceReviewUrl2(access) {
2575
- if (!/^[A-Za-z0-9_-]{22,64}$/.test(access.id))
2576
- throw new TypeError(`Invalid ${label.toLowerCase()} workspace identity.`);
2577
- return `${normalizeWorkspaceBase2(access.baseUrl)}${reviewPath}/${access.id}`;
2578
- }
2579
- return { normalizeWorkspaceBase: normalizeWorkspaceBase2, workspaceReviewUrl: workspaceReviewUrl2 };
2580
- }
2581
-
2582
- // packages/design/lib/design/workspace-address.mjs
2583
- var DESIGN_SHARE_BASE_URL = "https://share.openplanr.dev";
2584
- var DESIGN_SHARE_REVIEW_PATH = "/d";
2585
- var address = createWorkspaceAddress({
2586
- label: "Design",
2587
- reviewPath: DESIGN_SHARE_REVIEW_PATH,
2588
- defaultBaseUrl: DESIGN_SHARE_BASE_URL
2589
- });
2590
- var normalizeWorkspaceBase = address.normalizeWorkspaceBase;
2591
- var workspaceReviewUrl = (access) => `${address.workspaceReviewUrl(access)}${access.schemaVersion === "2.0.0" ? "?v=2" : ""}`;
2592
-
2593
- // packages/design/lib/design/share-status.mjs
2594
- var FORMAT = "openplanr-design-owner-custody";
2595
- function custodyLocation(file, options = {}, { allowMissing = false } = {}) {
2596
- const current = currentDesign2(file, options);
2597
- const env = options.env ?? process.env;
2598
- const root = resolve5(options.custodyRoot ?? join7(planrHome(env), "design-shares"));
2599
- let project = current.root;
2600
- for (let candidate = current.root; dirname5(candidate) !== candidate; candidate = dirname5(candidate)) {
2601
- if (existsSync4(join7(candidate, ".git")) || existsSync4(join7(candidate, PLANNING_FOLDER))) {
2602
- project = candidate;
2603
- break;
2604
- }
2605
- }
2606
- const key = hash(`${current.root}
2607
- ${current.document.id}`);
2608
- const path = join7(root, `${key}.json`);
2609
- const within = relative3(project, root);
2610
- if ((!allowMissing || existsSync4(path)) && (within === "" || !within.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) && within !== ".." && !isAbsolute3(within)))
2611
- throw new Error(
2612
- "Design owner keys must be stored outside the project. Set PLANR_HOME to a private user-level directory."
2613
- );
2614
- const legacyPath = !options.custodyRoot && !configuredPlanrHome(env) ? join7(realpathSync4(env.HOME || homedir3()), ".openplanr", "design-shares", `${key}.json`) : null;
2615
- return { root, path, current, legacyPath };
2616
- }
2617
- function presentationFingerprint(current, { legacy = false } = {}) {
2618
- const state = readJson(join7(current.root, ".design/studio-state.json"), { state: {} }).state;
2619
- return hash(
2620
- JSON.stringify({
2621
- revision: current.revision,
2622
- selectedVariant: state.selectedVariant ?? current.document.selectedVariant,
2623
- ...legacy ? { positions: state.positions ?? {} } : {},
2624
- verification: current.verification.status
2625
- })
2626
- );
2627
- }
2628
- var safeStatus = (record, current) => ({
2629
- ok: true,
2630
- shared: Boolean(record),
2631
- title: current.document.title,
2632
- localRevision: current.revision,
2633
- retention: "until-revoked",
2634
- ...record ? {
2635
- id: record.custody.id,
2636
- url: workspaceReviewUrl(record.custody),
2637
- revision: record.custody.currentRevision ?? record.publishedRevision ?? null,
2638
- publishedRevision: record.publishedRevision ?? null,
2639
- hasUpdate: record.publishedRevision !== current.revision || ![
2640
- presentationFingerprint(current),
2641
- presentationFingerprint(current, { legacy: true })
2642
- ].includes(record.publishedPresentation),
2643
- epoch: record.custody.epoch,
2644
- commentsPaused: Boolean(record.custody.commentsPaused ?? record.commentsPaused),
2645
- revoked: Boolean(record.revoked),
2646
- deleted: Boolean(record.deleted),
2647
- pending: Boolean(
2648
- record.custody.pendingCreate || record.custody.pendingMutation || record.pendingReviewMetadata?.length
2649
- ),
2650
- pendingAction: record.custody.pendingCreate ? "create" : record.custody.pendingMutation?.action ?? (record.pendingReviewMetadata?.length ? "review-metadata" : null),
2651
- pendingReviewMetadata: Boolean(record.pendingReviewMetadata?.length)
2652
- } : {}
2653
- });
2654
- function getDesignShareStatus(file, options = {}) {
2655
- const { path, current, legacyPath } = custodyLocation(file, options);
2656
- const record = readCustody(path, { label: "Design", format: FORMAT }) ?? (legacyPath ? readCustody(legacyPath, { label: "Design", format: FORMAT }) : null);
2657
- return safeStatus(record, current);
2658
- }
2659
-
2660
- // packages/design/lib/design/handoff-reader.mjs
2661
- var metadataPath = (current) => join8(current.root, ".design/review-metadata.json");
2662
- var revisionOf2 = (pin) => pin.revisionId ?? pin.reviewId;
2663
- function metadata(current, feedback) {
2664
- const local = readJson(metadataPath(current), { version: 0, byRevision: {} });
2665
- const byRevision = structuredClone(feedback.shared?.metadataByRevision ?? {});
2666
- for (const [revision, value] of Object.entries(local.byRevision ?? {})) {
2667
- const remote = byRevision[revision] ?? {};
2668
- byRevision[revision] = {
2669
- categories: { ...remote.categories, ...value.categories },
2670
- dispositions: { ...remote.dispositions, ...value.dispositions }
2671
- };
2672
- }
2673
- const counts = /* @__PURE__ */ new Map();
2674
- for (const pin of feedback.pins) counts.set(pin.id, (counts.get(pin.id) ?? 0) + 1);
2675
- const categories = {}, dispositions = {};
2676
- for (const pin of feedback.pins) {
2677
- const value = byRevision[revisionOf2(pin)];
2678
- if (counts.get(pin.id) === 1 && value) {
2679
- if (Object.hasOwn(value.categories ?? {}, pin.id))
2680
- Object.defineProperty(categories, pin.id, {
2681
- value: value.categories[pin.id],
2682
- enumerable: true
2683
- });
2684
- if (Object.hasOwn(value.dispositions ?? {}, pin.id))
2685
- Object.defineProperty(dispositions, pin.id, {
2686
- value: value.dispositions[pin.id],
2687
- enumerable: true
2688
- });
2689
- }
2690
- if (counts.get(pin.id) === 1 && !Object.hasOwn(categories, pin.id) && Object.hasOwn(local.categories ?? {}, pin.id))
2691
- Object.defineProperty(categories, pin.id, {
2692
- value: local.categories[pin.id],
2693
- enumerable: true
2694
- });
2695
- if (counts.get(pin.id) === 1 && !Object.hasOwn(dispositions, pin.id) && Object.hasOwn(local.dispositions ?? {}, pin.id))
2696
- Object.defineProperty(dispositions, pin.id, {
2697
- value: local.dispositions[pin.id],
2698
- enumerable: true
2699
- });
2700
- }
2701
- return {
2702
- version: local.version,
2703
- categories,
2704
- dispositions,
2705
- byRevision,
2706
- legacy: {
2707
- categories: structuredClone(local.categories ?? {}),
2708
- dispositions: structuredClone(local.dispositions ?? {})
2709
- }
2710
- };
2711
- }
2712
- function resolutionFor(value, shareStatus) {
2713
- return compileDesignHandoffResolution({
2714
- currentReviewOf: value.basis.reviewOf,
2715
- pins: value.feedback.pins,
2716
- metadata: {
2717
- byRevision: value.metadata.byRevision,
2718
- categories: value.metadata.legacy.categories,
2719
- dispositions: value.metadata.legacy.dispositions
2720
- },
2721
- historyComplete: !value.feedback.shared?.issues?.length,
2722
- synchronizationPending: Boolean(shareStatus?.pendingReviewMetadata),
2723
- synchronizationIssues: value.feedback.shared?.issues ?? []
2724
- });
2725
- }
2726
- function snapshot(file, env, shareOptions = {}) {
2727
- const current = currentDesign2(file, shareOptions), feedback = readDesignFeedback(file, env, shareOptions), meta = metadata(current, feedback);
2728
- const reviewContext = current.reviewContext ?? emptyReviewContext(current.document);
2729
- const basis = {
2730
- designId: current.document.id,
2731
- sourceRevision: current.revision,
2732
- contextDigest: current.contextDigest ?? reviewDigest(reviewContext),
2733
- reviewOf: digestArtifactEnvelope(current.envelope),
2734
- selectedVariant: feedback.state.selectedVariant ?? current.document.selectedVariant,
2735
- feedbackDigest: reviewDigest({
2736
- pins: feedback.pins,
2737
- metadata: {
2738
- byRevision: meta.byRevision,
2739
- categories: meta.categories,
2740
- dispositions: meta.dispositions
2741
- },
2742
- overall: (feedback.ledger?.reviews ?? []).map((entry) => ({
2743
- reviewId: entry.review.reviewId,
2744
- reviewOf: entry.review.reviewOf,
2745
- overall: entry.review.overall
2746
- })),
2747
- directions: feedback.shared?.directions ?? []
2748
- }),
2749
- verificationDigest: reviewDigest(current.verification),
2750
- feedbackWatermark: Math.max(
2751
- 0,
2752
- ...(feedback.shared?.events ?? []).map((event) => event.sequence ?? 0)
2753
- )
2754
- };
2755
- let shareStatus = null;
2756
- try {
2757
- shareStatus = getDesignShareStatus(file, { env, ...shareOptions });
2758
- } catch (error) {
2759
- if (error.code === "E_DESIGN_PUBLICATION_PENDING") throw error;
2760
- }
2761
- const value = { current, feedback, metadata: meta, reviewContext, basis };
2762
- return { ...value, resolution: resolutionFor(value, shareStatus), shareStatus };
2763
- }
2764
- function readDesignHandoff(file, { env = process.env, ...shareOptions } = {}) {
2765
- const value = snapshot(file, env, shareOptions);
2766
- const path = join8(dirname6(designSpecPath(value.current.root)), "review-handoff.json");
2767
- const draft = readJson(path, null);
2768
- if (draft) {
2769
- assertDraft(draft);
2770
- const markdownPath = path.replace(/\.json$/u, ".md");
2771
- if (!existsSync5(markdownPath) || readFileSync6(markdownPath, "utf8") !== draft.markdown)
2772
- throw new Error(
2773
- "The handoff Markdown differs from its approved JSON. Rebuild the handoff projection before using it in Plan."
2774
- );
2775
- }
2776
- return {
2777
- ok: true,
2778
- path,
2779
- revision: value.current.revision,
2780
- draft,
2781
- current: Boolean(draft && reviewDigest(draft.basis) === reviewDigest(value.basis)),
2782
- metadata: value.metadata,
2783
- feedback: { pins: value.feedback.pins },
2784
- basis: value.basis,
2785
- resolution: value.resolution
2786
- };
2787
- }
2788
- function assertDraft(draft) {
2789
- assertReviewExperience(draft, DESIGN_HANDOFF_SCHEMA);
2790
- const expected = reviewDigest({
2791
- title: draft.title,
2792
- reviewNotes: draft.reviewNotes,
2793
- basis: draft.basis,
2794
- content: draft.content,
2795
- affectedScreens: draft.affectedScreens ?? [],
2796
- verificationGaps: draft.verificationGaps ?? []
2797
- });
2798
- if (draft.contentHash !== expected || draft.status === "approved" && draft.approval?.contentHash !== expected)
2799
- throw new Error(
2800
- "The handoff content does not match its approval digest. Refine it through the handoff utility."
2801
- );
2802
- if (draft.markdown !== renderMarkdown(draft, draft.title))
2803
- throw new Error("The handoff Markdown does not match its approved content.");
2804
- return draft;
2805
- }
2806
-
2807
- // packages/design/lib/design/plan-handoff-utility.mjs
2808
- function inspectPlanDesignHandoff(argv, { stdout = (value) => process.stdout.write(`${JSON.stringify(value)}
2809
- `) } = {}) {
2810
- if (argv.length === 0 || ["--help", "help"].includes(argv[0])) {
2811
- const help = {
2812
- usage: "design.mjs handoff <design-document.json> [--action inspect] [--json]",
2813
- note: "Reads the existing handoff and its current approval; never renders, publishes, or starts implementation."
2814
- };
2815
- stdout(help);
2816
- return help;
2817
- }
2818
- const [command, input, ...args] = argv;
2819
- if (command !== "handoff" || !input)
2820
- throw new Error("Usage: design.mjs handoff <design-document.json> [--action inspect] [--json]");
2821
- for (let index = 0; index < args.length; index += 1) {
2822
- if (args[index] === "--json") continue;
2823
- if (args[index] === "--action" && args[++index] === "inspect") continue;
2824
- throw new Error("Plan handoff support only accepts --action inspect and --json.");
2825
- }
2826
- const result = readDesignHandoff(resolve6(input), { recoverPublication: false });
2827
- stdout(result);
2828
- return result;
2829
- }
2830
- async function main(argv = process.argv.slice(2)) {
2831
- try {
2832
- return inspectPlanDesignHandoff(argv);
2833
- } catch (error) {
2834
- process.stderr.write(`${error.code ? `${error.code}: ` : ""}${error.message}
2835
- `);
2836
- process.exitCode = 1;
2837
- }
2838
- }
2839
- if (process.argv[1] && fileURLToPath(import.meta.url) === realpathSync5(process.argv[1]))
2840
- await main();
2841
- export {
2842
- inspectPlanDesignHandoff,
2843
- main
2844
- };