openplanr 3.3.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (493) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/dist/cli/commands/artifact-design-share.d.ts +9 -0
  3. package/dist/cli/commands/artifact-design-share.d.ts.map +1 -0
  4. package/dist/cli/commands/artifact-design-share.js +200 -0
  5. package/dist/cli/commands/artifact-design-share.js.map +1 -0
  6. package/dist/cli/commands/artifact.d.ts.map +1 -1
  7. package/dist/cli/commands/artifact.js +5 -18
  8. package/dist/cli/commands/artifact.js.map +1 -1
  9. package/dist/cli/commands/design.d.ts +3 -0
  10. package/dist/cli/commands/design.d.ts.map +1 -0
  11. package/dist/cli/commands/design.js +137 -0
  12. package/dist/cli/commands/design.js.map +1 -0
  13. package/dist/cli/commands/groups/operations.d.ts.map +1 -1
  14. package/dist/cli/commands/groups/operations.js +2 -0
  15. package/dist/cli/commands/groups/operations.js.map +1 -1
  16. package/dist/cli/commands/ship.d.ts.map +1 -1
  17. package/dist/cli/commands/ship.js +2 -0
  18. package/dist/cli/commands/ship.js.map +1 -1
  19. package/dist/dashboard/.vite/manifest.json +2 -2
  20. package/dist/dashboard/assets/index-B-l_941W.js +75 -0
  21. package/dist/dashboard/assets/index-B-l_941W.js.map +1 -0
  22. package/dist/dashboard/assets/index-Cv4Vwhuw.css +2 -0
  23. package/dist/dashboard/dashboard-manifest.json +14 -14
  24. package/dist/dashboard/index.html +2 -2
  25. package/dist/services/design-artifact-service.d.ts +42 -1
  26. package/dist/services/design-artifact-service.d.ts.map +1 -1
  27. package/dist/services/design-artifact-service.js +198 -19
  28. package/dist/services/design-artifact-service.js.map +1 -1
  29. package/dist/services/runtime-manager/runtime-package.js +1 -1
  30. package/dist/services/runtime-manager/runtime-package.js.map +1 -1
  31. package/dist/services/ship-checks/contract.d.ts +3 -1
  32. package/dist/services/ship-checks/contract.d.ts.map +1 -1
  33. package/dist/services/ship-checks/contract.js +1 -1
  34. package/dist/services/ship-checks/contract.js.map +1 -1
  35. package/dist/services/ship-checks/discover.d.ts.map +1 -1
  36. package/dist/services/ship-checks/discover.js +2 -1
  37. package/dist/services/ship-checks/discover.js.map +1 -1
  38. package/dist/services/ship-checks/package-contents.d.ts +4 -0
  39. package/dist/services/ship-checks/package-contents.d.ts.map +1 -0
  40. package/dist/services/ship-checks/package-contents.js +91 -0
  41. package/dist/services/ship-checks/package-contents.js.map +1 -0
  42. package/dist/services/ship-checks/packages.d.ts +2 -0
  43. package/dist/services/ship-checks/packages.d.ts.map +1 -1
  44. package/dist/services/ship-checks/packages.js +4 -0
  45. package/dist/services/ship-checks/packages.js.map +1 -1
  46. package/dist/services/ship-checks/scope.js +2 -1
  47. package/dist/services/ship-checks/scope.js.map +1 -1
  48. package/dist/utils/splice-managed-block.js +1 -1
  49. package/dist/utils/splice-managed-block.js.map +1 -1
  50. package/docs/CLI.md +67 -1
  51. package/lib/host-packages/adapter-registry.json +5 -5
  52. package/lib/host-packages/capability-map.json +1 -1
  53. package/lib/host-packages/claude/.claude-plugin/marketplace.json +3 -3
  54. package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +6 -6
  55. package/lib/host-packages/claude/openplanr/.openplanr-content.json +57 -429
  56. package/lib/host-packages/claude/openplanr/README.md +16 -16
  57. package/lib/host-packages/claude/openplanr/references/agents/shared/modes/shared/task-context-resolution.md +4 -4
  58. package/lib/host-packages/claude/openplanr/skills/artifact/references/design-sharing.md +2 -2
  59. package/lib/host-packages/claude/openplanr/skills/delegate/SKILL.md +2 -1
  60. package/lib/host-packages/claude/openplanr/skills/delegate/references/integration-review.md +26 -20
  61. package/lib/host-packages/claude/openplanr/skills/delegate/references/operator-guide.md +25 -1
  62. package/lib/host-packages/claude/openplanr/skills/delegate/references/run-handoff.md +2 -2
  63. package/lib/host-packages/claude/openplanr/skills/delegate/references/worktree-custody.md +17 -9
  64. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/claude.mjs +15 -3
  65. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/codex.mjs +38 -2
  66. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/native.mjs +5 -0
  67. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/custody.mjs +217 -10
  68. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/handoff.mjs +1080 -0
  69. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integrate.mjs +96 -201
  70. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integration-files.mjs +3 -382
  71. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/presentation.mjs +29 -12
  72. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-contract.mjs +11 -0
  73. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-execution.mjs +1 -1
  74. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-lifecycle.mjs +14 -10
  75. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-preparation.mjs +4 -0
  76. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-record.mjs +2 -2
  77. package/lib/host-packages/claude/openplanr/skills/design/SKILL.md +23 -12
  78. package/lib/host-packages/claude/openplanr/skills/design/references/design-system.md +2 -2
  79. package/lib/host-packages/claude/openplanr/skills/design/references/generation.md +3 -3
  80. package/lib/host-packages/claude/openplanr/skills/design/references/hosted-canvas.md +6 -3
  81. package/lib/host-packages/claude/openplanr/skills/design/references/review.md +6 -6
  82. package/lib/host-packages/claude/openplanr/skills/design/references/team-review.md +3 -4
  83. package/lib/host-packages/claude/openplanr/skills/design/references/utilities.md +78 -32
  84. package/lib/host-packages/claude/openplanr/skills/design-loop/SKILL.md +15 -7
  85. package/lib/host-packages/claude/openplanr/skills/design-loop/references/design-system.md +2 -2
  86. package/lib/host-packages/claude/openplanr/skills/design-loop/references/generation.md +3 -3
  87. package/lib/host-packages/claude/openplanr/skills/design-loop/references/review.md +6 -6
  88. package/lib/host-packages/claude/openplanr/skills/design-loop/references/team-review.md +3 -4
  89. package/lib/host-packages/claude/openplanr/skills/design-loop/references/utilities.md +78 -32
  90. package/lib/host-packages/claude/openplanr/skills/design-review/SKILL.md +25 -5
  91. package/lib/host-packages/claude/openplanr/skills/design-review/references/design-system.md +2 -2
  92. package/lib/host-packages/claude/openplanr/skills/design-review/references/generation.md +3 -3
  93. package/lib/host-packages/claude/openplanr/skills/design-review/references/review.md +6 -6
  94. package/lib/host-packages/claude/openplanr/skills/design-review/references/team-review.md +3 -4
  95. package/lib/host-packages/claude/openplanr/skills/design-review/references/utilities.md +78 -32
  96. package/lib/host-packages/claude/openplanr/skills/investigate/SKILL.md +1 -0
  97. package/lib/host-packages/claude/openplanr/skills/investigate/references/fail-first.md +40 -0
  98. package/lib/host-packages/claude/openplanr/skills/plan/SKILL.md +7 -3
  99. package/lib/host-packages/claude/openplanr/skills/ship/SKILL.md +22 -10
  100. package/lib/host-packages/claude/openplanr/skills/ship/references/fail-first.md +40 -0
  101. package/lib/host-packages/claude/openplanr/skills/ship/references/result-contract.md +7 -3
  102. package/lib/host-packages/cursor/openplanr/.openplanr-content.json +55 -427
  103. package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
  104. package/lib/host-packages/cursor/openplanr/rules/planr-artifact/references/design-sharing.md +2 -2
  105. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/integration-review.md +26 -20
  106. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/operator-guide.md +25 -1
  107. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/run-handoff.md +2 -2
  108. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/worktree-custody.md +17 -9
  109. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/claude.mjs +15 -3
  110. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/codex.mjs +38 -2
  111. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/native.mjs +5 -0
  112. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/custody.mjs +217 -10
  113. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/handoff.mjs +1080 -0
  114. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integrate.mjs +96 -201
  115. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integration-files.mjs +3 -382
  116. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/presentation.mjs +29 -12
  117. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-contract.mjs +11 -0
  118. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-execution.mjs +1 -1
  119. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-lifecycle.mjs +14 -10
  120. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-preparation.mjs +4 -0
  121. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-record.mjs +2 -2
  122. package/lib/host-packages/cursor/openplanr/rules/planr-delegate.mdc +2 -1
  123. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/design-system.md +2 -2
  124. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/generation.md +3 -3
  125. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/hosted-canvas.md +6 -3
  126. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/review.md +6 -6
  127. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/team-review.md +3 -4
  128. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/utilities.md +78 -32
  129. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/design-system.md +2 -2
  130. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/generation.md +3 -3
  131. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/review.md +6 -6
  132. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/team-review.md +3 -4
  133. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/utilities.md +78 -32
  134. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop.mdc +15 -7
  135. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/design-system.md +2 -2
  136. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/generation.md +3 -3
  137. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/review.md +6 -6
  138. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/team-review.md +3 -4
  139. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/utilities.md +78 -32
  140. package/lib/host-packages/cursor/openplanr/rules/planr-design-review.mdc +25 -5
  141. package/lib/host-packages/cursor/openplanr/rules/planr-design.mdc +23 -12
  142. package/lib/host-packages/cursor/openplanr/rules/planr-investigate/references/fail-first.md +40 -0
  143. package/lib/host-packages/cursor/openplanr/rules/planr-investigate.mdc +1 -0
  144. package/lib/host-packages/cursor/openplanr/rules/planr-plan.mdc +7 -3
  145. package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/fail-first.md +40 -0
  146. package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/result-contract.md +7 -3
  147. package/lib/host-packages/cursor/openplanr/rules/planr-ship.mdc +22 -10
  148. package/lib/host-packages/openai/.claude-plugin/marketplace.json +3 -3
  149. package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +2 -2
  150. package/lib/host-packages/openai/openplanr/.openplanr-content.json +62 -434
  151. package/lib/host-packages/openai/openplanr/skills/artifact/references/design-sharing.md +2 -2
  152. package/lib/host-packages/openai/openplanr/skills/delegate/SKILL.md +2 -1
  153. package/lib/host-packages/openai/openplanr/skills/delegate/openplanr.skill.json +1 -1
  154. package/lib/host-packages/openai/openplanr/skills/delegate/references/integration-review.md +26 -20
  155. package/lib/host-packages/openai/openplanr/skills/delegate/references/operator-guide.md +25 -1
  156. package/lib/host-packages/openai/openplanr/skills/delegate/references/run-handoff.md +2 -2
  157. package/lib/host-packages/openai/openplanr/skills/delegate/references/worktree-custody.md +17 -9
  158. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/claude.mjs +15 -3
  159. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/codex.mjs +38 -2
  160. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/native.mjs +5 -0
  161. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/custody.mjs +217 -10
  162. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/handoff.mjs +1080 -0
  163. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integrate.mjs +96 -201
  164. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integration-files.mjs +3 -382
  165. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/presentation.mjs +29 -12
  166. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-contract.mjs +11 -0
  167. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-execution.mjs +1 -1
  168. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-lifecycle.mjs +14 -10
  169. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-preparation.mjs +4 -0
  170. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-record.mjs +2 -2
  171. package/lib/host-packages/openai/openplanr/skills/design/SKILL.md +23 -12
  172. package/lib/host-packages/openai/openplanr/skills/design/openplanr.skill.json +0 -11
  173. package/lib/host-packages/openai/openplanr/skills/design/references/design-system.md +2 -2
  174. package/lib/host-packages/openai/openplanr/skills/design/references/generation.md +3 -3
  175. package/lib/host-packages/openai/openplanr/skills/design/references/hosted-canvas.md +6 -3
  176. package/lib/host-packages/openai/openplanr/skills/design/references/review.md +6 -6
  177. package/lib/host-packages/openai/openplanr/skills/design/references/team-review.md +3 -4
  178. package/lib/host-packages/openai/openplanr/skills/design/references/utilities.md +78 -32
  179. package/lib/host-packages/openai/openplanr/skills/design-loop/SKILL.md +15 -7
  180. package/lib/host-packages/openai/openplanr/skills/design-loop/openplanr.skill.json +0 -11
  181. package/lib/host-packages/openai/openplanr/skills/design-loop/references/design-system.md +2 -2
  182. package/lib/host-packages/openai/openplanr/skills/design-loop/references/generation.md +3 -3
  183. package/lib/host-packages/openai/openplanr/skills/design-loop/references/review.md +6 -6
  184. package/lib/host-packages/openai/openplanr/skills/design-loop/references/team-review.md +3 -4
  185. package/lib/host-packages/openai/openplanr/skills/design-loop/references/utilities.md +78 -32
  186. package/lib/host-packages/openai/openplanr/skills/design-review/SKILL.md +25 -5
  187. package/lib/host-packages/openai/openplanr/skills/design-review/openplanr.skill.json +0 -11
  188. package/lib/host-packages/openai/openplanr/skills/design-review/references/design-system.md +2 -2
  189. package/lib/host-packages/openai/openplanr/skills/design-review/references/generation.md +3 -3
  190. package/lib/host-packages/openai/openplanr/skills/design-review/references/review.md +6 -6
  191. package/lib/host-packages/openai/openplanr/skills/design-review/references/team-review.md +3 -4
  192. package/lib/host-packages/openai/openplanr/skills/design-review/references/utilities.md +78 -32
  193. package/lib/host-packages/openai/openplanr/skills/investigate/SKILL.md +1 -0
  194. package/lib/host-packages/openai/openplanr/skills/investigate/openplanr.skill.json +12 -1
  195. package/lib/host-packages/openai/openplanr/skills/investigate/references/fail-first.md +40 -0
  196. package/lib/host-packages/openai/openplanr/skills/plan/SKILL.md +7 -3
  197. package/lib/host-packages/openai/openplanr/skills/plan/openplanr.skill.json +0 -11
  198. package/lib/host-packages/openai/openplanr/skills/ship/SKILL.md +22 -10
  199. package/lib/host-packages/openai/openplanr/skills/ship/openplanr.skill.json +12 -1
  200. package/lib/host-packages/openai/openplanr/skills/ship/references/fail-first.md +40 -0
  201. package/lib/host-packages/openai/openplanr/skills/ship/references/result-contract.md +7 -3
  202. package/package.json +8 -8
  203. package/dist/dashboard/assets/index-BU5fzjyz.css +0 -1
  204. package/dist/dashboard/assets/index-B_96uzCl.js +0 -572
  205. package/dist/dashboard/assets/index-B_96uzCl.js.map +0 -1
  206. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1774
  207. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
  208. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
  209. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
  210. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
  211. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
  212. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-handoff.mjs +0 -1576
  213. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
  214. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
  215. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
  216. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
  217. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
  218. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review.mjs +0 -3385
  219. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -39
  220. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
  221. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
  222. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
  223. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs +0 -1113
  224. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs +0 -505
  225. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
  226. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
  227. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
  228. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design.mjs +0 -1430
  229. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2050
  230. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
  231. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
  232. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -809
  233. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -5693
  234. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
  235. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
  236. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/06-artifact-review-ui.js +0 -1755
  237. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
  238. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/08-artifact-review-ui.js +0 -2633
  239. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -124
  240. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
  241. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
  242. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
  243. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
  244. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -133
  245. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
  246. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
  247. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
  248. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +0 -2261
  249. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +0 -1595
  250. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +0 -1467
  251. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +0 -1860
  252. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +0 -914
  253. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +0 -2578
  254. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +0 -582
  255. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
  256. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
  257. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
  258. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
  259. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
  260. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
  261. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
  262. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
  263. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
  264. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
  265. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
  266. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
  267. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
  268. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -159
  269. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
  270. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
  271. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
  272. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
  273. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  274. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
  275. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
  276. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
  277. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
  278. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
  279. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
  280. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
  281. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
  282. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
  283. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
  284. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
  285. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
  286. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
  287. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
  288. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
  289. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
  290. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
  291. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
  292. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -5468
  293. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design.mjs +0 -2844
  294. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
  295. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -159
  296. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  297. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integration-transaction.mjs +0 -958
  298. package/lib/host-packages/claude/openplanr/skills/design/scripts/design.mjs +0 -12
  299. package/lib/host-packages/claude/openplanr/skills/design-loop/scripts/design.mjs +0 -12
  300. package/lib/host-packages/claude/openplanr/skills/design-review/scripts/design.mjs +0 -12
  301. package/lib/host-packages/claude/openplanr/skills/plan/scripts/design.mjs +0 -12
  302. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integration-transaction.mjs +0 -958
  303. package/lib/host-packages/cursor/openplanr/rules/planr-design/scripts/design.mjs +0 -12
  304. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/scripts/design.mjs +0 -12
  305. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/scripts/design.mjs +0 -12
  306. package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/design.mjs +0 -12
  307. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1774
  308. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
  309. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
  310. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
  311. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
  312. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
  313. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-handoff.mjs +0 -1576
  314. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
  315. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
  316. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
  317. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
  318. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
  319. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review.mjs +0 -3385
  320. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -39
  321. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
  322. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
  323. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
  324. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs +0 -1113
  325. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs +0 -505
  326. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
  327. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
  328. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
  329. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design.mjs +0 -1430
  330. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2050
  331. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
  332. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
  333. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -809
  334. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -5693
  335. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
  336. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
  337. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/06-artifact-review-ui.js +0 -1755
  338. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
  339. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/08-artifact-review-ui.js +0 -2633
  340. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -124
  341. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
  342. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
  343. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
  344. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
  345. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -133
  346. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
  347. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
  348. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
  349. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +0 -2261
  350. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +0 -1595
  351. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +0 -1467
  352. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +0 -1860
  353. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +0 -914
  354. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +0 -2578
  355. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +0 -582
  356. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
  357. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
  358. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
  359. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
  360. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
  361. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
  362. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
  363. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
  364. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
  365. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
  366. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
  367. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
  368. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
  369. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -159
  370. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
  371. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
  372. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
  373. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
  374. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  375. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
  376. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
  377. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
  378. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
  379. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
  380. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
  381. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
  382. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
  383. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
  384. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
  385. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
  386. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
  387. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
  388. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
  389. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
  390. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
  391. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
  392. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
  393. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -5468
  394. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design.mjs +0 -2844
  395. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
  396. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -159
  397. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  398. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1774
  399. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
  400. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
  401. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
  402. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
  403. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
  404. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-handoff.mjs +0 -1576
  405. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
  406. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
  407. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
  408. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
  409. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
  410. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review.mjs +0 -3385
  411. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -39
  412. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
  413. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
  414. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
  415. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs +0 -1113
  416. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs +0 -505
  417. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
  418. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
  419. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
  420. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design.mjs +0 -1430
  421. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2050
  422. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
  423. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
  424. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -809
  425. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -5693
  426. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
  427. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
  428. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/06-artifact-review-ui.js +0 -1755
  429. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
  430. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/08-artifact-review-ui.js +0 -2633
  431. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -124
  432. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
  433. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
  434. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
  435. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
  436. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -133
  437. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
  438. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
  439. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
  440. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +0 -2261
  441. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +0 -1595
  442. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +0 -1467
  443. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +0 -1860
  444. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +0 -914
  445. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +0 -2578
  446. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +0 -582
  447. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
  448. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
  449. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
  450. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
  451. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
  452. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
  453. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
  454. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
  455. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
  456. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
  457. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
  458. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
  459. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
  460. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -159
  461. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
  462. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
  463. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
  464. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
  465. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  466. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
  467. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
  468. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
  469. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
  470. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
  471. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
  472. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
  473. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
  474. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
  475. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
  476. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
  477. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
  478. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
  479. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
  480. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
  481. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
  482. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
  483. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
  484. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -5468
  485. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design.mjs +0 -2844
  486. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
  487. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -159
  488. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  489. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integration-transaction.mjs +0 -958
  490. package/lib/host-packages/openai/openplanr/skills/design/scripts/design.mjs +0 -12
  491. package/lib/host-packages/openai/openplanr/skills/design-loop/scripts/design.mjs +0 -12
  492. package/lib/host-packages/openai/openplanr/skills/design-review/scripts/design.mjs +0 -12
  493. package/lib/host-packages/openai/openplanr/skills/plan/scripts/design.mjs +0 -12
@@ -1,698 +0,0 @@
1
- import {
2
- Inflate_1,
3
- deflateRaw_1
4
- } from "./design-compression.mjs";
5
- import {
6
- LARGE_OBJECT_CHUNK_CONTEXT,
7
- LARGE_OBJECT_LIMITS,
8
- RESOURCE_HTML_SEGMENT_ENCODING,
9
- assertLargeObjectContract
10
- } from "./design-shared-protocol-contracts-b5f28f94.mjs";
11
- import {
12
- canonicalizeJson
13
- } from "./design-shared-protocol-contracts-75a938cc.mjs";
14
-
15
- // packages/artifact/lib/artifact/resource-pack.mjs
16
- var encoder = new TextEncoder();
17
- var decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
18
- var htmlSegmentMagic = encoder.encode(`\0${RESOURCE_HTML_SEGMENT_ENCODING}\0`);
19
- var blockPattern = /(<(script|style)\b[^>]*>)([\s\S]*?)<\/\2\s*>/gi;
20
- function encodeResourceBytes(bytes) {
21
- let binary = "";
22
- for (let offset = 0; offset < bytes.length; offset += 8192)
23
- binary += String.fromCharCode(...bytes.subarray(offset, offset + 8192));
24
- return btoa(binary).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/u, "");
25
- }
26
- function decodeResourceBytes(value, maxBytes = 65536) {
27
- if (typeof value !== "string" || !/^[A-Za-z0-9_-]+$/u.test(value) || value.length > Math.ceil(maxBytes * 4 / 3))
28
- throw new TypeError("Invalid encoded resource value.");
29
- const bytes = Uint8Array.from(
30
- atob(value.replaceAll("-", "+").replaceAll("_", "/")),
31
- (char) => char.charCodeAt(0)
32
- );
33
- if (bytes.byteLength > maxBytes || encodeResourceBytes(bytes) !== value)
34
- throw new TypeError("Noncanonical resource encoding.");
35
- return bytes;
36
- }
37
- async function resourceSha256(bytes) {
38
- return [...new Uint8Array(await crypto.subtle.digest("SHA-256", bytes))].map((part) => part.toString(16).padStart(2, "0")).join("");
39
- }
40
- function encodeResource(bytes) {
41
- const compressed = deflateRaw_1(bytes);
42
- return compressed.byteLength < bytes.byteLength ? { bytes: compressed, codec: "deflate-raw" } : { bytes, codec: "identity" };
43
- }
44
- function decodeResource(bytes, descriptor, maxBytes = LARGE_OBJECT_LIMITS.decodedBytes) {
45
- if (descriptor.encodedBytes !== bytes.byteLength || descriptor.decodedBytes > maxBytes || descriptor.decodedBytes < 1)
46
- throw new RangeError("Resource size is invalid.");
47
- if (descriptor.codec === "identity") {
48
- if (bytes.byteLength !== descriptor.decodedBytes)
49
- throw new TypeError("Identity resource length differs.");
50
- return bytes;
51
- }
52
- if (descriptor.codec !== "deflate-raw") throw new TypeError("Unsupported resource codec.");
53
- const inflater = new Inflate_1({ raw: true, chunkSize: 65536 });
54
- const chunks = [];
55
- let size = 0;
56
- inflater.onData = (part) => {
57
- size += part.byteLength;
58
- if (size > descriptor.decodedBytes || size > maxBytes)
59
- throw new RangeError("Resource expands beyond its declared limit.");
60
- chunks.push(part);
61
- };
62
- inflater.push(bytes, true);
63
- if (!inflater.ended && !inflater.err && inflater.strm?.avail_in === 0)
64
- inflater.push(new Uint8Array(0), true);
65
- if (!inflater.ended || inflater.err || size !== descriptor.decodedBytes || inflater.strm?.avail_in)
66
- throw new TypeError("Compressed resource is corrupt or has trailing data.");
67
- const output = new Uint8Array(size);
68
- let offset = 0;
69
- for (const part of chunks) {
70
- output.set(part, offset);
71
- offset += part.byteLength;
72
- }
73
- return output;
74
- }
75
- function jsonStringByteLength(value, maxBytes) {
76
- let bytes = 2;
77
- for (let index = 0; index < value.length; index++) {
78
- const code = value.charCodeAt(index);
79
- if (code === 34 || code === 92) bytes += 2;
80
- else if (code < 32) bytes += [8, 9, 10, 12, 13].includes(code) ? 2 : 6;
81
- else if (code < 128) bytes++;
82
- else if (code < 2048) bytes += 2;
83
- else if (code >= 55296 && code <= 56319) {
84
- const next = value.charCodeAt(index + 1);
85
- if (next >= 56320 && next <= 57343) {
86
- bytes += 4;
87
- index++;
88
- } else bytes += 6;
89
- } else bytes += code >= 56320 && code <= 57343 ? 6 : 3;
90
- if (bytes > maxBytes) throw new RangeError("Resource pack exceeds its decoded byte limit.");
91
- }
92
- return bytes;
93
- }
94
- function utf8SegmentInfo(text, maximum) {
95
- let bytes = 0, wellFormed = true;
96
- for (let index = 0; index < text.length; index++) {
97
- const code = text.charCodeAt(index);
98
- if (code < 128) bytes++;
99
- else if (code < 2048) bytes += 2;
100
- else if (code >= 55296 && code <= 56319) {
101
- const next = text.charCodeAt(index + 1);
102
- if (next >= 56320 && next <= 57343) {
103
- bytes += 4;
104
- index++;
105
- } else {
106
- bytes += 3;
107
- wellFormed = false;
108
- }
109
- } else {
110
- bytes += 3;
111
- if (code >= 56320 && code <= 57343) wellFormed = false;
112
- }
113
- if (bytes > maximum) throw new RangeError("Resource pack exceeds its decoded byte limit.");
114
- }
115
- return { bytes, wellFormed };
116
- }
117
- function segmentText(segment) {
118
- if (typeof segment === "string") return { type: 0, text: segment };
119
- if (!segment || typeof segment !== "object" || Array.isArray(segment))
120
- throw new TypeError("Source segment is invalid.");
121
- const descriptors = Object.getOwnPropertyDescriptors(segment);
122
- if (Reflect.ownKeys(descriptors).length !== 1 || !Object.hasOwn(descriptors, "resourceId") || !Object.hasOwn(descriptors.resourceId, "value") || typeof descriptors.resourceId.value !== "string" || !/^r[0-9]{1,4}$/u.test(descriptors.resourceId.value))
123
- throw new TypeError("Source segment is invalid.");
124
- return { type: 1, text: descriptors.resourceId.value };
125
- }
126
- function encodeHtmlSegments(segments, maxBytes = LARGE_OBJECT_LIMITS.decodedBytes) {
127
- if (!Array.isArray(segments) || !segments.length || segments.length > LARGE_OBJECT_LIMITS.resources * 2 + 1 || !Number.isSafeInteger(maxBytes) || maxBytes < 1 || maxBytes > LARGE_OBJECT_LIMITS.decodedBytes)
128
- throw new RangeError("Source segment count or byte limit is invalid.");
129
- let byteLength = htmlSegmentMagic.byteLength + 4, wellFormed = true;
130
- const parts = [];
131
- for (const segment of segments) {
132
- const part = segmentText(segment);
133
- byteLength += 5;
134
- if (byteLength > maxBytes)
135
- throw new RangeError("Resource pack exceeds its decoded byte limit.");
136
- const info = utf8SegmentInfo(part.text, maxBytes - byteLength);
137
- byteLength += info.bytes;
138
- wellFormed &&= info.wellFormed;
139
- parts.push({ ...part, byteLength: info.bytes });
140
- }
141
- if (!wellFormed) throw new TypeError("Source segment text is not valid Unicode.");
142
- const bytes = new Uint8Array(byteLength), view = new DataView(bytes.buffer);
143
- bytes.set(htmlSegmentMagic);
144
- view.setUint32(htmlSegmentMagic.byteLength, parts.length);
145
- let cursor = htmlSegmentMagic.byteLength + 4;
146
- for (const part of parts) {
147
- bytes[cursor++] = part.type;
148
- view.setUint32(cursor, part.byteLength);
149
- cursor += 4;
150
- const encoded = encoder.encodeInto(part.text, bytes.subarray(cursor, cursor + part.byteLength));
151
- if (encoded.read !== part.text.length || encoded.written !== part.byteLength)
152
- throw new TypeError("Source segment byte accounting differs.");
153
- cursor += part.byteLength;
154
- }
155
- return bytes;
156
- }
157
- function decodeHtmlSegments(bytes, maxBytes = LARGE_OBJECT_LIMITS.decodedBytes) {
158
- if (!(bytes instanceof Uint8Array) || !bytes.byteLength || bytes.byteLength > maxBytes || !Number.isSafeInteger(maxBytes) || maxBytes < 1 || maxBytes > LARGE_OBJECT_LIMITS.decodedBytes)
159
- throw new RangeError("Source segment bytes exceed their limit.");
160
- if (bytes[0] !== 0) {
161
- const segments2 = JSON.parse(decoder.decode(bytes));
162
- if (!Array.isArray(segments2) || !segments2.length || segments2.length > LARGE_OBJECT_LIMITS.resources * 2 + 1)
163
- throw new TypeError("Source segment count is invalid.");
164
- for (const segment of segments2) segmentText(segment);
165
- return segments2;
166
- }
167
- if (bytes.byteLength < htmlSegmentMagic.byteLength + 4 || htmlSegmentMagic.some((byte, index) => byte !== bytes[index]))
168
- throw new TypeError("Source segment encoding is unsupported or corrupt.");
169
- const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
170
- const count = view.getUint32(htmlSegmentMagic.byteLength);
171
- if (!count || count > LARGE_OBJECT_LIMITS.resources * 2 + 1)
172
- throw new TypeError("Source segment count is invalid.");
173
- const segments = [];
174
- let cursor = htmlSegmentMagic.byteLength + 4;
175
- for (let index = 0; index < count; index++) {
176
- if (bytes.byteLength - cursor < 5) throw new TypeError("Source segment span is truncated.");
177
- const type = bytes[cursor++], length = view.getUint32(cursor);
178
- cursor += 4;
179
- if (![0, 1].includes(type) || length > bytes.byteLength - cursor || type === 1 && length > 128)
180
- throw new TypeError("Source segment span is invalid.");
181
- const text = decoder.decode(bytes.subarray(cursor, cursor + length));
182
- cursor += length;
183
- const segment = type === 0 ? text : { resourceId: text };
184
- segmentText(segment);
185
- segments.push(segment);
186
- }
187
- if (cursor !== bytes.byteLength) throw new TypeError("Source segment bytes have trailing data.");
188
- return segments;
189
- }
190
- async function packResourceBundle(bundle, { reviewOf } = {}) {
191
- if (reviewOf !== void 0 && !/^[a-f0-9]{64}$/u.test(reviewOf))
192
- throw new TypeError("Invalid full review identity.");
193
- const diagram = bundle?.kind === "openplanr-diagram-review-bundle";
194
- const envelope = diagram ? { schemaVersion: "1.0.0", artifacts: [{ id: "diagram", html: bundle.scene?.svg }] } : bundle?.envelope;
195
- const views = envelope?.artifacts;
196
- if (!Array.isArray(views) || !views.length || views.length > LARGE_OBJECT_LIMITS.views || new Set(views.map((view) => view.id)).size !== views.length)
197
- throw new RangeError("Resource pack view count or identity is invalid.");
198
- const pooled = envelope.schemaVersion === "1.1.0";
199
- let sources;
200
- const viewSources = /* @__PURE__ */ Object.create(null);
201
- if (pooled) {
202
- sources = envelope.sources;
203
- if (!Array.isArray(sources) || !sources.length || sources.length > LARGE_OBJECT_LIMITS.sources || new Set(sources.map((source) => source.id)).size !== sources.length)
204
- throw new RangeError("Resource pack source count or identity is invalid.");
205
- const sourceIds = new Set(sources.map((source) => source.id));
206
- for (const view of views) {
207
- if (!sourceIds.has(view.sourceId)) throw new TypeError("View references an unknown source.");
208
- viewSources[view.id] = view.sourceId;
209
- }
210
- } else {
211
- sources = [];
212
- const pages = /* @__PURE__ */ new Map();
213
- for (const view of views) {
214
- if (typeof view.html !== "string") throw new TypeError("View has no HTML source.");
215
- if (!pages.has(view.html)) {
216
- const id = `source-${sources.length}`;
217
- pages.set(view.html, id);
218
- sources.push({ id, html: view.html });
219
- }
220
- viewSources[view.id] = pages.get(view.html);
221
- }
222
- }
223
- if (sources.length > LARGE_OBJECT_LIMITS.sources)
224
- throw new RangeError("Resource pack exceeds its source limit.");
225
- const blocks = /* @__PURE__ */ new Map();
226
- const resources = [];
227
- const encodedResources = [];
228
- let encodedBytes = 0, decodedBytes = 0, uniqueHtmlBytes = 0;
229
- async function addResource(type, bytes) {
230
- if (!bytes.byteLength || resources.length >= LARGE_OBJECT_LIMITS.resources)
231
- throw new RangeError("Resource count exceeds its limit.");
232
- if (bytes.byteLength > LARGE_OBJECT_LIMITS.decodedBytes - decodedBytes)
233
- throw new RangeError("Resource pack exceeds its decoded byte limit.");
234
- const encoded = encodeResource(bytes);
235
- const descriptor = {
236
- id: `r${resources.length}`,
237
- type,
238
- offset: encodedBytes,
239
- encodedBytes: encoded.bytes.byteLength,
240
- decodedBytes: bytes.byteLength,
241
- codec: encoded.codec,
242
- sha256: await resourceSha256(bytes)
243
- };
244
- encodedBytes += descriptor.encodedBytes;
245
- decodedBytes += descriptor.decodedBytes;
246
- if (decodedBytes > LARGE_OBJECT_LIMITS.decodedBytes || encodedBytes > LARGE_OBJECT_LIMITS.decodedBytes)
247
- throw new RangeError("Resource pack exceeds its decoded byte limit.");
248
- resources.push(descriptor);
249
- encodedResources.push(encoded.bytes);
250
- return descriptor.id;
251
- }
252
- const sourceRecords = [];
253
- for (const source of sources) {
254
- if (typeof source.html !== "string" || !source.html.length)
255
- throw new TypeError("Source HTML is invalid.");
256
- let info;
257
- try {
258
- info = utf8SegmentInfo(source.html, LARGE_OBJECT_LIMITS.uniqueHtmlBytes - uniqueHtmlBytes);
259
- } catch {
260
- throw new RangeError("Resource pack exceeds its unique HTML limit.");
261
- }
262
- if (!info.wellFormed) throw new TypeError("Source HTML is not valid Unicode.");
263
- uniqueHtmlBytes += info.bytes;
264
- const htmlBytes = encoder.encode(source.html);
265
- const sha256 = await resourceSha256(htmlBytes);
266
- if (source.sha256 && source.sha256 !== sha256)
267
- throw new TypeError("Source digest does not match its HTML.");
268
- const segments = [];
269
- let offset = 0;
270
- for (const match of source.html.matchAll(blockPattern)) {
271
- const body = match[3];
272
- if (segments.length >= LARGE_OBJECT_LIMITS.resources * 2 || body.length < 2048 || !blocks.has(body) && blocks.size >= 512)
273
- continue;
274
- const start = match.index + match[1].length;
275
- segments.push(source.html.slice(offset, start));
276
- if (!blocks.has(body))
277
- blocks.set(body, await addResource("shared-block", encoder.encode(body)));
278
- segments.push({ resourceId: blocks.get(body) });
279
- offset = start + body.length;
280
- }
281
- segments.push(source.html.slice(offset));
282
- const resourceId = await addResource(
283
- "html-segments",
284
- encodeHtmlSegments(segments, LARGE_OBJECT_LIMITS.decodedBytes - decodedBytes)
285
- );
286
- sourceRecords.push({ id: source.id, resourceId, htmlBytes: htmlBytes.byteLength, sha256 });
287
- }
288
- const withoutHtml = ({ html: _html, ...value }) => value;
289
- const metadata = diagram ? { ...bundle, scene: { ...bundle.scene, svg: "" } } : {
290
- ...bundle,
291
- envelope: {
292
- ...envelope,
293
- artifacts: views.map(withoutHtml),
294
- ...pooled ? { sources: sources.map(withoutHtml) } : {}
295
- }
296
- };
297
- const catalog = {
298
- schemaVersion: "1.0.0",
299
- kind: "openplanr-resource-catalog",
300
- ...reviewOf === void 0 ? {} : { reviewOf },
301
- bundle: metadata,
302
- uniqueHtmlBytes,
303
- totalDecodedBytes: decodedBytes,
304
- resources,
305
- sources: sourceRecords,
306
- viewSources
307
- };
308
- let catalogBytes;
309
- for (let attempt = 0; attempt < 4; attempt++) {
310
- catalogBytes = encoder.encode(canonicalizeJson(catalog));
311
- const total = decodedBytes + catalogBytes.byteLength;
312
- if (catalog.totalDecodedBytes === total) break;
313
- catalog.totalDecodedBytes = total;
314
- }
315
- catalogBytes = encoder.encode(canonicalizeJson(catalog));
316
- if (decodedBytes + catalogBytes.byteLength !== catalog.totalDecodedBytes || catalog.totalDecodedBytes > LARGE_OBJECT_LIMITS.decodedBytes)
317
- throw new RangeError("Resource pack total exceeds its decoded limit.");
318
- assertLargeObjectContract(catalog, "resource-catalog");
319
- const encodedCatalog = encodeResource(catalogBytes);
320
- const catalogSpan = {
321
- offset: encodedBytes,
322
- encodedBytes: encodedCatalog.bytes.byteLength,
323
- decodedBytes: catalogBytes.byteLength,
324
- codec: encodedCatalog.codec
325
- };
326
- return {
327
- catalog,
328
- catalogSpan,
329
- encodedResources: [...encodedResources, encodedCatalog.bytes],
330
- plaintextBytes: encodedBytes + encodedCatalog.bytes.byteLength
331
- };
332
- }
333
- function resourceChunkAAD(manifest, index) {
334
- return encoder.encode(
335
- canonicalizeJson({
336
- context: LARGE_OBJECT_CHUNK_CONTEXT,
337
- workspaceId: manifest.workspaceId,
338
- revisionId: manifest.revisionId,
339
- epoch: manifest.epoch,
340
- index
341
- })
342
- );
343
- }
344
- async function encryptResourcePack(pack, { workspaceId, revisionId, epoch, rawKey, sign, createdAt = (/* @__PURE__ */ new Date()).toISOString() }) {
345
- const header = {
346
- schemaVersion: "2.0.0",
347
- kind: "openplanr-encrypted-resource-manifest",
348
- workspaceId,
349
- revisionId,
350
- epoch,
351
- createdAt,
352
- plaintextBytes: pack.plaintextBytes,
353
- catalog: pack.catalogSpan
354
- };
355
- const key = await crypto.subtle.importKey("raw", rawKey, "AES-GCM", false, ["encrypt"]);
356
- const chunks = [];
357
- const descriptors = [];
358
- const ivs = /* @__PURE__ */ new Set();
359
- let part = new Uint8Array(LARGE_OBJECT_LIMITS.chunkPlaintextBytes), filled = 0;
360
- async function flush() {
361
- if (!filled) return;
362
- let iv, encodedIv;
363
- do {
364
- iv = crypto.getRandomValues(new Uint8Array(12));
365
- encodedIv = encodeResourceBytes(iv);
366
- } while (ivs.has(encodedIv));
367
- ivs.add(encodedIv);
368
- const index = chunks.length;
369
- const cipher = new Uint8Array(
370
- await crypto.subtle.encrypt(
371
- { name: "AES-GCM", iv, additionalData: resourceChunkAAD(header, index), tagLength: 128 },
372
- key,
373
- part.subarray(0, filled)
374
- )
375
- );
376
- if (chunks.length >= LARGE_OBJECT_LIMITS.chunks)
377
- throw new RangeError("Encrypted pack exceeds its chunk limit.");
378
- chunks.push(cipher);
379
- descriptors.push({
380
- index,
381
- iv: encodedIv,
382
- byteLength: cipher.byteLength,
383
- sha256: await resourceSha256(cipher)
384
- });
385
- filled = 0;
386
- }
387
- for (const bytes of pack.encodedResources) {
388
- for (let offset = 0; offset < bytes.byteLength; ) {
389
- const take = Math.min(part.byteLength - filled, bytes.byteLength - offset);
390
- part.set(bytes.subarray(offset, offset + take), filled);
391
- filled += take;
392
- offset += take;
393
- if (filled === part.byteLength) await flush();
394
- }
395
- }
396
- await flush();
397
- part.fill(0);
398
- const manifest = await sign({
399
- ...header,
400
- ciphertextBytes: chunks.reduce((sum, value) => sum + value.byteLength, 0),
401
- chunks: descriptors
402
- });
403
- assertLargeObjectContract(manifest, "encrypted-resource-manifest");
404
- return { manifest, chunks };
405
- }
406
- async function openResourcePack(manifest, { rawKey, verify, fetchChunk, maxCachedBytes = 8 * 1024 * 1024 }) {
407
- assertLargeObjectContract(manifest, "encrypted-resource-manifest");
408
- if (!await verify(manifest)) throw new TypeError("Resource manifest signature is invalid.");
409
- const key = await crypto.subtle.importKey("raw", rawKey, "AES-GCM", false, ["decrypt"]);
410
- const cache = /* @__PURE__ */ new Map();
411
- let cacheBytes = 0, disposed = false;
412
- if (!Number.isSafeInteger(maxCachedBytes) || maxCachedBytes < LARGE_OBJECT_LIMITS.chunkBytes || maxCachedBytes > LARGE_OBJECT_LIMITS.decodedBytes)
413
- throw new RangeError("Resource cache bound is invalid.");
414
- async function chunkAt(index) {
415
- if (disposed) throw new Error("Resource pack has been disposed.");
416
- if (cache.has(index)) {
417
- const bytes2 = cache.get(index);
418
- cache.delete(index);
419
- cache.set(index, bytes2);
420
- return bytes2;
421
- }
422
- const descriptor = manifest.chunks[index];
423
- const bytes = await fetchChunk(index, descriptor);
424
- if (!(bytes instanceof Uint8Array) || bytes.byteLength !== descriptor.byteLength || await resourceSha256(bytes) !== descriptor.sha256)
425
- throw new TypeError("Ciphertext chunk integrity check failed.");
426
- const plaintext = new Uint8Array(
427
- await crypto.subtle.decrypt(
428
- {
429
- name: "AES-GCM",
430
- iv: decodeResourceBytes(descriptor.iv, 12),
431
- additionalData: resourceChunkAAD(manifest, index),
432
- tagLength: 128
433
- },
434
- key,
435
- bytes
436
- )
437
- );
438
- if (disposed) {
439
- plaintext.fill(0);
440
- throw new Error("Resource pack has been disposed.");
441
- }
442
- cache.set(index, plaintext);
443
- cacheBytes += plaintext.byteLength;
444
- while (cacheBytes > maxCachedBytes && cache.size > 1) {
445
- const first = cache.keys().next().value;
446
- cacheBytes -= cache.get(first).byteLength;
447
- cache.delete(first);
448
- }
449
- return plaintext;
450
- }
451
- return openPackedResources({
452
- catalogSpan: manifest.catalog,
453
- plaintextBytes: manifest.plaintextBytes,
454
- chunkPlaintextBytes: LARGE_OBJECT_LIMITS.chunkPlaintextBytes,
455
- chunkAt,
456
- dispose() {
457
- disposed = true;
458
- for (const bytes of cache.values()) bytes.fill(0);
459
- cache.clear();
460
- cacheBytes = 0;
461
- }
462
- });
463
- }
464
- async function openPackedResources({
465
- catalogSpan,
466
- plaintextBytes,
467
- chunkPlaintextBytes,
468
- chunkAt,
469
- dispose = () => {
470
- }
471
- }) {
472
- async function spanBytes(span) {
473
- if (!Number.isSafeInteger(span.offset) || !Number.isSafeInteger(span.encodedBytes) || span.offset < 0 || span.encodedBytes < 1 || span.offset + span.encodedBytes > plaintextBytes)
474
- throw new TypeError("Resource span is invalid.");
475
- const bytes = new Uint8Array(span.encodedBytes);
476
- for (let copied = 0; copied < bytes.byteLength; ) {
477
- const absolute = span.offset + copied, index = Math.floor(absolute / chunkPlaintextBytes), within = absolute % chunkPlaintextBytes;
478
- const chunk = await chunkAt(index);
479
- const take = Math.min(chunk.byteLength - within, bytes.byteLength - copied);
480
- if (take < 1) throw new TypeError("Resource span exceeds its chunks.");
481
- bytes.set(chunk.subarray(within, within + take), copied);
482
- copied += take;
483
- }
484
- return bytes;
485
- }
486
- const catalogBytes = decodeResource(
487
- await spanBytes(catalogSpan),
488
- catalogSpan,
489
- LARGE_OBJECT_LIMITS.catalogBytes
490
- );
491
- const catalog = assertLargeObjectContract(
492
- JSON.parse(decoder.decode(catalogBytes)),
493
- "resource-catalog"
494
- );
495
- const resourceBytes = catalog.resources.reduce((sum, part) => sum + part.decodedBytes, 0);
496
- const encodedBytes = catalog.resources.reduce((sum, part) => sum + part.encodedBytes, 0);
497
- if (resourceBytes + catalogBytes.byteLength !== catalog.totalDecodedBytes || encodedBytes !== catalogSpan.offset)
498
- throw new TypeError("Catalog and manifest byte accounting differ.");
499
- const resources = new Map(catalog.resources.map((resource) => [resource.id, resource]));
500
- const sourceRecords = new Map(catalog.sources.map((source) => [source.id, source]));
501
- async function resourceAt(id, expectedType, maxBytes = LARGE_OBJECT_LIMITS.decodedBytes) {
502
- const descriptor = resources.get(id);
503
- if (!descriptor || descriptor.type !== expectedType || descriptor.offset + descriptor.encodedBytes > catalogSpan.offset)
504
- throw new TypeError("Resource reference is invalid.");
505
- if (descriptor.decodedBytes > maxBytes || descriptor.encodedBytes > maxBytes)
506
- throw new RangeError("Selected source resource exceeds its read limit.");
507
- const decoded = decodeResource(await spanBytes(descriptor), descriptor, maxBytes);
508
- if (await resourceSha256(decoded) !== descriptor.sha256)
509
- throw new TypeError("Decoded resource integrity check failed.");
510
- return decoded;
511
- }
512
- async function loadSource(id, { maxSourceBytes } = {}) {
513
- const source = sourceRecords.get(id);
514
- if (!source) throw new TypeError("Unknown source.");
515
- if (maxSourceBytes !== void 0 && (!Number.isSafeInteger(maxSourceBytes) || maxSourceBytes < 1 || maxSourceBytes > LARGE_OBJECT_LIMITS.uniqueHtmlBytes))
516
- throw new RangeError("Selected source read limit is invalid.");
517
- if (maxSourceBytes !== void 0 && source.htmlBytes > maxSourceBytes)
518
- throw new RangeError("Selected source exceeds its read limit.");
519
- const segmentLimit = maxSourceBytes === void 0 ? LARGE_OBJECT_LIMITS.decodedBytes : Math.min(
520
- LARGE_OBJECT_LIMITS.decodedBytes,
521
- maxSourceBytes * 6 + (LARGE_OBJECT_LIMITS.resources * 2 + 1) * 160 + htmlSegmentMagic.byteLength + 4
522
- );
523
- const segments = decodeHtmlSegments(
524
- await resourceAt(source.resourceId, "html-segments", segmentLimit),
525
- segmentLimit
526
- );
527
- if (!Array.isArray(segments) || segments.length > LARGE_OBJECT_LIMITS.resources * 2 + 1)
528
- throw new TypeError("Source segment count is invalid.");
529
- const parts = [];
530
- let htmlBytes = 0;
531
- for (const segment of segments) {
532
- let text;
533
- if (typeof segment === "string") text = segment;
534
- else if (segment && Object.keys(segment).length === 1 && typeof segment.resourceId === "string")
535
- text = decoder.decode(
536
- await resourceAt(
537
- segment.resourceId,
538
- "shared-block",
539
- maxSourceBytes ?? LARGE_OBJECT_LIMITS.decodedBytes
540
- )
541
- );
542
- else throw new TypeError("Source segment is invalid.");
543
- htmlBytes += encoder.encode(text).byteLength;
544
- if (htmlBytes > source.htmlBytes)
545
- throw new RangeError("Source expands beyond its declared limit.");
546
- parts.push(text);
547
- }
548
- const html = parts.join("");
549
- if (htmlBytes !== source.htmlBytes || await resourceSha256(encoder.encode(html)) !== source.sha256)
550
- throw new TypeError("Reconstructed HTML integrity check failed.");
551
- return html;
552
- }
553
- async function loadView(viewId, options) {
554
- if (catalog.bundle.kind === "openplanr-diagram-review-bundle") {
555
- if (viewId !== "diagram") throw new TypeError("Unknown diagram view.");
556
- return { id: "diagram", html: await loadSource(catalog.viewSources.diagram, options) };
557
- }
558
- const view = catalog.bundle.envelope.artifacts.find((item) => item.id === viewId);
559
- if (!view || !Object.hasOwn(catalog.viewSources, viewId)) throw new TypeError("Unknown view.");
560
- return { ...view, html: await loadSource(catalog.viewSources[viewId], options) };
561
- }
562
- async function loadBundle({ sourcePool = false } = {}) {
563
- const metadataBytes = encoder.encode(canonicalizeJson(catalog.bundle)).byteLength;
564
- const poolInline = sourcePool && catalog.bundle.kind === "openplanr-design-review-bundle" && catalog.bundle.envelope.schemaVersion !== "1.1.0";
565
- const references = catalog.bundle.kind === "openplanr-diagram-review-bundle" ? [{ id: catalog.viewSources.diagram, field: null }] : catalog.bundle.envelope.schemaVersion === "1.1.0" ? catalog.bundle.envelope.sources.map((source) => ({ id: source.id, field: "html" })) : poolInline ? catalog.sources.map((source) => ({ id: source.id, field: "html" })) : catalog.bundle.envelope.artifacts.map((view) => ({
566
- id: catalog.viewSources[view.id],
567
- field: "html"
568
- }));
569
- const counts = /* @__PURE__ */ new Map();
570
- let serializedBytes = metadataBytes;
571
- for (const { id, field } of references) {
572
- const source = sourceRecords.get(id);
573
- if (!source) throw new TypeError("Unknown source.");
574
- serializedBytes += source.htmlBytes + (field === null ? 0 : field.length + 6);
575
- if (serializedBytes > LARGE_OBJECT_LIMITS.decodedBytes)
576
- throw new RangeError(
577
- "Complete bundle reconstruction exceeds its serialized byte limit. Use lazy views."
578
- );
579
- counts.set(id, (counts.get(id) ?? 0) + 1);
580
- }
581
- const uniqueRepresentation = [...counts.values()].every((count) => count === 1);
582
- const htmlBySource = /* @__PURE__ */ new Map();
583
- for (const [id, count] of counts) {
584
- const html = await loadSource(id);
585
- const source = sourceRecords.get(id);
586
- if (!uniqueRepresentation) {
587
- const escapedBytes = jsonStringByteLength(html, LARGE_OBJECT_LIMITS.decodedBytes);
588
- serializedBytes += count * (escapedBytes - source.htmlBytes - 2);
589
- }
590
- if (serializedBytes > LARGE_OBJECT_LIMITS.decodedBytes)
591
- throw new RangeError(
592
- "Complete bundle reconstruction exceeds its serialized byte limit. Use lazy views."
593
- );
594
- htmlBySource.set(id, html);
595
- }
596
- const bundle = structuredClone(catalog.bundle);
597
- if (poolInline) {
598
- if (bundle.schemaVersion === "1.1.0") bundle.schemaVersion = "1.2.0";
599
- bundle.envelope.schemaVersion = "1.1.0";
600
- bundle.envelope.sources = catalog.sources.map((source) => ({
601
- id: source.id,
602
- kind: "html",
603
- sha256: source.sha256,
604
- html: htmlBySource.get(source.id)
605
- }));
606
- bundle.envelope.artifacts = bundle.envelope.artifacts.map((view) => ({
607
- ...view,
608
- sourceId: catalog.viewSources[view.id]
609
- }));
610
- const actualMetadata = {
611
- ...bundle,
612
- envelope: {
613
- ...bundle.envelope,
614
- sources: bundle.envelope.sources.map(({ html: _html, ...source }) => source)
615
- }
616
- };
617
- const extraMetadata = encoder.encode(canonicalizeJson(actualMetadata)).byteLength - metadataBytes;
618
- if (serializedBytes + extraMetadata > LARGE_OBJECT_LIMITS.decodedBytes)
619
- throw new RangeError("Complete pooled reconstruction exceeds its serialized byte limit.");
620
- return bundle;
621
- }
622
- if (bundle.kind === "openplanr-diagram-review-bundle")
623
- bundle.scene.svg = htmlBySource.get(catalog.viewSources.diagram);
624
- else if (bundle.envelope.schemaVersion === "1.1.0") {
625
- for (const source of bundle.envelope.sources) source.html = htmlBySource.get(source.id);
626
- } else
627
- for (const view of bundle.envelope.artifacts)
628
- view.html = htmlBySource.get(catalog.viewSources[view.id]);
629
- return bundle;
630
- }
631
- return {
632
- catalog: structuredClone(catalog),
633
- bundle: structuredClone(catalog.bundle),
634
- reviewOf: catalog.reviewOf,
635
- loadSource,
636
- loadView,
637
- loadBundle,
638
- assertMatchesBundle: (value) => assertResourceBundleMatchesCatalog(value, catalog),
639
- dispose
640
- };
641
- }
642
- async function assertResourceBundleMatchesCatalog(bundle, catalog) {
643
- assertLargeObjectContract(catalog, "resource-catalog");
644
- const diagram = bundle?.kind === "openplanr-diagram-review-bundle";
645
- const envelope = diagram ? { schemaVersion: "1.0.0", artifacts: [{ id: "diagram", html: bundle.scene?.svg }] } : bundle?.envelope;
646
- if (!Array.isArray(envelope?.artifacts))
647
- throw new TypeError("Saved content differs from resource catalog.");
648
- const sources = [], viewSources = /* @__PURE__ */ Object.create(null), pages = /* @__PURE__ */ new Map();
649
- if (envelope.schemaVersion === "1.1.0") {
650
- if (!Array.isArray(envelope.sources))
651
- throw new TypeError("Saved content differs from resource catalog.");
652
- sources.push(...envelope.sources);
653
- for (const view of envelope.artifacts) viewSources[view.id] = view.sourceId;
654
- } else
655
- for (const view of envelope.artifacts) {
656
- if (typeof view.html !== "string")
657
- throw new TypeError("Saved content differs from resource catalog.");
658
- if (!pages.has(view.html)) {
659
- const id = `source-${sources.length}`;
660
- pages.set(view.html, id);
661
- sources.push({ id, html: view.html });
662
- }
663
- viewSources[view.id] = pages.get(view.html);
664
- }
665
- const withoutHtml = ({ html: _html, ...value }) => value;
666
- const metadata = diagram ? { ...bundle, scene: { ...bundle.scene, svg: "" } } : {
667
- ...bundle,
668
- envelope: {
669
- ...envelope,
670
- artifacts: envelope.artifacts.map(withoutHtml),
671
- ...envelope.schemaVersion === "1.1.0" ? { sources: sources.map(withoutHtml) } : {}
672
- }
673
- };
674
- if (canonicalizeJson(metadata) !== canonicalizeJson(catalog.bundle) || canonicalizeJson(viewSources) !== canonicalizeJson(catalog.viewSources) || sources.length !== catalog.sources.length)
675
- throw new TypeError("Saved content differs from resource catalog.");
676
- const saved = new Map(catalog.sources.map((source) => [source.id, source]));
677
- for (const source of sources) {
678
- const record = saved.get(source.id);
679
- if (!record || typeof source.html !== "string")
680
- throw new TypeError("Saved source differs from resource catalog.");
681
- const info = utf8SegmentInfo(source.html, record.htmlBytes);
682
- if (!info.wellFormed || info.bytes !== record.htmlBytes)
683
- throw new TypeError("Saved source differs from resource catalog.");
684
- const bytes = encoder.encode(source.html);
685
- if (await resourceSha256(bytes) !== record.sha256)
686
- throw new TypeError("Saved source differs from resource catalog.");
687
- }
688
- return bundle;
689
- }
690
-
691
- export {
692
- encodeResourceBytes,
693
- decodeResourceBytes,
694
- resourceSha256,
695
- packResourceBundle,
696
- encryptResourcePack,
697
- openResourcePack
698
- };