openplanr 3.4.0 → 3.5.0

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