openplanr 3.2.0 → 3.4.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 (411) hide show
  1. package/CHANGELOG.md +73 -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/ship.d.ts.map +1 -1
  10. package/dist/cli/commands/ship.js +2 -0
  11. package/dist/cli/commands/ship.js.map +1 -1
  12. package/dist/cli/commands/spec.d.ts +2 -1
  13. package/dist/cli/commands/spec.d.ts.map +1 -1
  14. package/dist/cli/commands/spec.js +45 -5
  15. package/dist/cli/commands/spec.js.map +1 -1
  16. package/dist/dashboard/.vite/manifest.json +2 -2
  17. package/dist/dashboard/assets/index-Cv4Vwhuw.css +2 -0
  18. package/dist/dashboard/assets/index-CvQAlBy3.js +75 -0
  19. package/dist/dashboard/assets/index-CvQAlBy3.js.map +1 -0
  20. package/dist/dashboard/dashboard-manifest.json +14 -14
  21. package/dist/dashboard/index.html +2 -2
  22. package/dist/services/claude-plugin-service.d.ts +5 -0
  23. package/dist/services/claude-plugin-service.d.ts.map +1 -1
  24. package/dist/services/claude-plugin-service.js +18 -2
  25. package/dist/services/claude-plugin-service.js.map +1 -1
  26. package/dist/services/codex-plugin-service.d.ts.map +1 -1
  27. package/dist/services/codex-plugin-service.js +11 -3
  28. package/dist/services/codex-plugin-service.js.map +1 -1
  29. package/dist/services/design-artifact-service.d.ts +20 -1
  30. package/dist/services/design-artifact-service.d.ts.map +1 -1
  31. package/dist/services/design-artifact-service.js +137 -18
  32. package/dist/services/design-artifact-service.js.map +1 -1
  33. package/dist/services/runtime-manager/codex-discovery.d.ts +1 -3
  34. package/dist/services/runtime-manager/codex-discovery.d.ts.map +1 -1
  35. package/dist/services/runtime-manager/codex-discovery.js +3 -16
  36. package/dist/services/runtime-manager/codex-discovery.js.map +1 -1
  37. package/dist/services/runtime-manager/doctor.d.ts +25 -0
  38. package/dist/services/runtime-manager/doctor.d.ts.map +1 -1
  39. package/dist/services/runtime-manager/doctor.js +480 -0
  40. package/dist/services/runtime-manager/doctor.js.map +1 -1
  41. package/dist/services/runtime-manager/errors.d.ts +12 -0
  42. package/dist/services/runtime-manager/errors.d.ts.map +1 -0
  43. package/dist/services/runtime-manager/errors.js +14 -0
  44. package/dist/services/runtime-manager/errors.js.map +1 -0
  45. package/dist/services/runtime-manager/global-state.d.ts +7 -0
  46. package/dist/services/runtime-manager/global-state.d.ts.map +1 -1
  47. package/dist/services/runtime-manager/global-state.js +116 -0
  48. package/dist/services/runtime-manager/global-state.js.map +1 -1
  49. package/dist/services/runtime-manager/host-version-probe.d.ts +8 -0
  50. package/dist/services/runtime-manager/host-version-probe.d.ts.map +1 -0
  51. package/dist/services/runtime-manager/host-version-probe.js +14 -0
  52. package/dist/services/runtime-manager/host-version-probe.js.map +1 -0
  53. package/dist/services/runtime-manager/install-plan.d.ts +25 -0
  54. package/dist/services/runtime-manager/install-plan.d.ts.map +1 -1
  55. package/dist/services/runtime-manager/install-plan.js +305 -0
  56. package/dist/services/runtime-manager/install-plan.js.map +1 -1
  57. package/dist/services/runtime-manager/inventory.d.ts +6 -0
  58. package/dist/services/runtime-manager/inventory.d.ts.map +1 -1
  59. package/dist/services/runtime-manager/inventory.js +16 -1
  60. package/dist/services/runtime-manager/inventory.js.map +1 -1
  61. package/dist/services/runtime-manager/legacy-adapters.d.ts +9 -0
  62. package/dist/services/runtime-manager/legacy-adapters.d.ts.map +1 -0
  63. package/dist/services/runtime-manager/legacy-adapters.js +187 -0
  64. package/dist/services/runtime-manager/legacy-adapters.js.map +1 -0
  65. package/dist/services/runtime-manager/paths.d.ts +18 -0
  66. package/dist/services/runtime-manager/paths.d.ts.map +1 -0
  67. package/dist/services/runtime-manager/paths.js +83 -0
  68. package/dist/services/runtime-manager/paths.js.map +1 -0
  69. package/dist/services/runtime-manager/runtime-package.d.ts +21 -0
  70. package/dist/services/runtime-manager/runtime-package.d.ts.map +1 -1
  71. package/dist/services/runtime-manager/runtime-package.js +77 -0
  72. package/dist/services/runtime-manager/runtime-package.js.map +1 -1
  73. package/dist/services/runtime-manager/storage.d.ts +47 -0
  74. package/dist/services/runtime-manager/storage.d.ts.map +1 -0
  75. package/dist/services/runtime-manager/storage.js +604 -0
  76. package/dist/services/runtime-manager/storage.js.map +1 -0
  77. package/dist/services/runtime-manager-service.d.ts +7 -17
  78. package/dist/services/runtime-manager-service.d.ts.map +1 -1
  79. package/dist/services/runtime-manager-service.js +32 -1695
  80. package/dist/services/runtime-manager-service.js.map +1 -1
  81. package/dist/services/ship-checks/contract.d.ts +15 -1
  82. package/dist/services/ship-checks/contract.d.ts.map +1 -1
  83. package/dist/services/ship-checks/contract.js +1 -1
  84. package/dist/services/ship-checks/contract.js.map +1 -1
  85. package/dist/services/ship-checks/coverage.d.ts +4 -0
  86. package/dist/services/ship-checks/coverage.d.ts.map +1 -0
  87. package/dist/services/ship-checks/coverage.js +113 -0
  88. package/dist/services/ship-checks/coverage.js.map +1 -0
  89. package/dist/services/ship-checks/discover.d.ts.map +1 -1
  90. package/dist/services/ship-checks/discover.js +5 -1
  91. package/dist/services/ship-checks/discover.js.map +1 -1
  92. package/dist/services/ship-checks/package-contents.d.ts +4 -0
  93. package/dist/services/ship-checks/package-contents.d.ts.map +1 -0
  94. package/dist/services/ship-checks/package-contents.js +91 -0
  95. package/dist/services/ship-checks/package-contents.js.map +1 -0
  96. package/dist/services/ship-checks/packages.d.ts +2 -0
  97. package/dist/services/ship-checks/packages.d.ts.map +1 -1
  98. package/dist/services/ship-checks/packages.js +4 -0
  99. package/dist/services/ship-checks/packages.js.map +1 -1
  100. package/dist/services/ship-checks/scope.js +2 -1
  101. package/dist/services/ship-checks/scope.js.map +1 -1
  102. package/dist/services/spec-service.d.ts +18 -0
  103. package/dist/services/spec-service.d.ts.map +1 -1
  104. package/dist/services/spec-service.js +174 -9
  105. package/dist/services/spec-service.js.map +1 -1
  106. package/dist/templates/spec/spec-shaped.md.hbs +1 -1
  107. package/dist/templates/spec/spec.md.hbs +2 -2
  108. package/dist/utils/splice-managed-block.js +1 -1
  109. package/dist/utils/splice-managed-block.js.map +1 -1
  110. package/docs/CLI.md +86 -2
  111. package/lib/host-packages/adapter-registry.json +5 -5
  112. package/lib/host-packages/capability-map.json +3 -3
  113. package/lib/host-packages/claude/.claude-plugin/marketplace.json +3 -3
  114. package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +6 -6
  115. package/lib/host-packages/claude/openplanr/.openplanr-content.json +94 -146
  116. package/lib/host-packages/claude/openplanr/README.md +12 -12
  117. package/lib/host-packages/claude/openplanr/agents/planr-qa.md +5 -3
  118. package/lib/host-packages/claude/openplanr/references/agents/shared/modes/shared/task-context-resolution.md +4 -4
  119. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-artifact-shell.mjs +2 -4
  120. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-document.mjs +110 -25
  121. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-handoff.mjs +851 -57
  122. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review-state-store.mjs +45 -0
  123. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review.mjs +65 -74
  124. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -1
  125. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +321 -0
  126. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs +1652 -0
  127. package/lib/host-packages/{openai/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs → claude/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-9f6918b0.mjs} +537 -5
  128. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +137 -0
  129. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design.mjs +374 -61
  130. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +32 -59
  131. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +138 -133
  132. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +1 -5608
  133. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +2568 -0
  134. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +10 -74
  135. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/package.json +4 -4
  136. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +8 -2
  137. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +2 -2
  138. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +5 -5
  139. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +72 -2
  140. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +14 -7
  141. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +71 -34
  142. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +28 -14
  143. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +12 -12
  144. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +6 -2
  145. package/lib/host-packages/{openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.20.0 → claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0}/design-document.schema.json +131 -4
  146. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +822 -0
  147. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +616 -4775
  148. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design.mjs +219 -424
  149. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +6 -2
  150. package/lib/host-packages/claude/openplanr/skills/delegate/SKILL.md +2 -1
  151. package/lib/host-packages/claude/openplanr/skills/delegate/references/integration-review.md +26 -20
  152. package/lib/host-packages/claude/openplanr/skills/delegate/references/operator-guide.md +25 -1
  153. package/lib/host-packages/claude/openplanr/skills/delegate/references/run-handoff.md +2 -2
  154. package/lib/host-packages/claude/openplanr/skills/delegate/references/worktree-custody.md +17 -9
  155. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/claude.mjs +15 -3
  156. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/codex.mjs +38 -2
  157. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/native.mjs +5 -0
  158. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/custody.mjs +217 -10
  159. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/handoff.mjs +1080 -0
  160. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integrate.mjs +96 -201
  161. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integration-files.mjs +3 -382
  162. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/presentation.mjs +29 -12
  163. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-contract.mjs +11 -0
  164. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-execution.mjs +1 -1
  165. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-lifecycle.mjs +14 -10
  166. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-preparation.mjs +4 -0
  167. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-record.mjs +2 -2
  168. package/lib/host-packages/claude/openplanr/skills/design/references/design-system.md +17 -2
  169. package/lib/host-packages/claude/openplanr/skills/design/references/generation.md +60 -2
  170. package/lib/host-packages/claude/openplanr/skills/design/references/utilities.md +23 -7
  171. package/lib/host-packages/claude/openplanr/skills/design/schemas/design-document.schema.json +131 -4
  172. package/lib/host-packages/claude/openplanr/skills/design-loop/references/design-system.md +17 -2
  173. package/lib/host-packages/claude/openplanr/skills/design-loop/references/generation.md +60 -2
  174. package/lib/host-packages/claude/openplanr/skills/design-loop/references/utilities.md +23 -7
  175. package/lib/host-packages/claude/openplanr/skills/design-loop/schemas/design-document.schema.json +131 -4
  176. package/lib/host-packages/claude/openplanr/skills/design-review/references/design-system.md +17 -2
  177. package/lib/host-packages/claude/openplanr/skills/design-review/references/generation.md +60 -2
  178. package/lib/host-packages/claude/openplanr/skills/design-review/references/utilities.md +23 -7
  179. package/lib/host-packages/claude/openplanr/skills/design-review/schemas/design-document.schema.json +131 -4
  180. package/lib/host-packages/claude/openplanr/skills/investigate/SKILL.md +2 -1
  181. package/lib/host-packages/claude/openplanr/skills/investigate/references/fail-first.md +40 -0
  182. package/lib/host-packages/claude/openplanr/skills/plan/SKILL.md +21 -11
  183. package/lib/host-packages/claude/openplanr/skills/plan/schemas/design-document.schema.json +131 -4
  184. package/lib/host-packages/claude/openplanr/skills/ship/SKILL.md +51 -18
  185. package/lib/host-packages/claude/openplanr/skills/ship/references/fail-first.md +40 -0
  186. package/lib/host-packages/claude/openplanr/skills/ship/references/result-contract.md +7 -3
  187. package/lib/host-packages/claude/openplanr/skills/spec/SKILL.md +6 -0
  188. package/lib/host-packages/claude/openplanr/skills/spec/references/specification-contract.md +3 -1
  189. package/lib/host-packages/cursor/openplanr/.openplanr-content.json +91 -143
  190. package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
  191. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/integration-review.md +26 -20
  192. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/operator-guide.md +25 -1
  193. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/run-handoff.md +2 -2
  194. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/worktree-custody.md +17 -9
  195. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/claude.mjs +15 -3
  196. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/codex.mjs +38 -2
  197. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/native.mjs +5 -0
  198. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/custody.mjs +217 -10
  199. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/handoff.mjs +1080 -0
  200. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integrate.mjs +96 -201
  201. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integration-files.mjs +3 -382
  202. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/presentation.mjs +29 -12
  203. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-contract.mjs +11 -0
  204. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-execution.mjs +1 -1
  205. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-lifecycle.mjs +14 -10
  206. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-preparation.mjs +4 -0
  207. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-record.mjs +2 -2
  208. package/lib/host-packages/cursor/openplanr/rules/planr-delegate.mdc +2 -1
  209. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/design-system.md +17 -2
  210. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/generation.md +60 -2
  211. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/utilities.md +23 -7
  212. package/lib/host-packages/cursor/openplanr/rules/planr-design/schemas/design-document.schema.json +131 -4
  213. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/design-system.md +17 -2
  214. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/generation.md +60 -2
  215. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/utilities.md +23 -7
  216. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/schemas/design-document.schema.json +131 -4
  217. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/design-system.md +17 -2
  218. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/generation.md +60 -2
  219. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/utilities.md +23 -7
  220. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/schemas/design-document.schema.json +131 -4
  221. package/lib/host-packages/cursor/openplanr/rules/planr-investigate/references/fail-first.md +40 -0
  222. package/lib/host-packages/cursor/openplanr/rules/planr-investigate.mdc +2 -1
  223. package/lib/host-packages/cursor/openplanr/rules/planr-plan/schemas/design-document.schema.json +131 -4
  224. package/lib/host-packages/cursor/openplanr/rules/planr-plan.mdc +21 -11
  225. package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/fail-first.md +40 -0
  226. package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/result-contract.md +7 -3
  227. package/lib/host-packages/cursor/openplanr/rules/planr-ship.mdc +51 -18
  228. package/lib/host-packages/cursor/openplanr/rules/planr-spec/references/specification-contract.md +3 -1
  229. package/lib/host-packages/cursor/openplanr/rules/planr-spec.mdc +6 -0
  230. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-artifact-shell.mjs +2 -4
  231. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-document.mjs +110 -25
  232. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-handoff.mjs +851 -57
  233. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review-state-store.mjs +45 -0
  234. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review.mjs +65 -74
  235. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -1
  236. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +321 -0
  237. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs +1652 -0
  238. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/{design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs → design-shared-artifact-support-protocol-contracts-9f6918b0.mjs} +537 -5
  239. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +137 -0
  240. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design.mjs +374 -61
  241. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +32 -59
  242. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +138 -133
  243. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +1 -5608
  244. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +2568 -0
  245. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +10 -74
  246. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/package.json +4 -4
  247. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +8 -2
  248. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +2 -2
  249. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +5 -5
  250. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +72 -2
  251. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +14 -7
  252. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +71 -34
  253. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +28 -14
  254. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +12 -12
  255. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +6 -2
  256. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/{v1.20.0 → v1.22.0}/design-document.schema.json +131 -4
  257. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +822 -0
  258. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +616 -4775
  259. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design.mjs +219 -424
  260. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +6 -2
  261. package/lib/host-packages/openai/.claude-plugin/marketplace.json +3 -3
  262. package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +2 -2
  263. package/lib/host-packages/openai/openplanr/.openplanr-content.json +98 -150
  264. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-artifact-shell.mjs +2 -4
  265. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-document.mjs +110 -25
  266. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-handoff.mjs +851 -57
  267. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review-state-store.mjs +45 -0
  268. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review.mjs +65 -74
  269. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -1
  270. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +321 -0
  271. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs +1652 -0
  272. package/lib/host-packages/{claude/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs → openai/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-9f6918b0.mjs} +537 -5
  273. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +137 -0
  274. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design.mjs +374 -61
  275. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +32 -59
  276. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +138 -133
  277. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +1 -5608
  278. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +2568 -0
  279. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +10 -74
  280. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/package.json +4 -4
  281. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +8 -2
  282. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +2 -2
  283. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +5 -5
  284. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +72 -2
  285. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +14 -7
  286. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +71 -34
  287. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +28 -14
  288. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +12 -12
  289. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +6 -2
  290. package/lib/host-packages/{claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.20.0 → openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0}/design-document.schema.json +131 -4
  291. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +822 -0
  292. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +616 -4775
  293. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design.mjs +219 -424
  294. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +6 -2
  295. package/lib/host-packages/openai/openplanr/skills/delegate/SKILL.md +2 -1
  296. package/lib/host-packages/openai/openplanr/skills/delegate/openplanr.skill.json +1 -1
  297. package/lib/host-packages/openai/openplanr/skills/delegate/references/integration-review.md +26 -20
  298. package/lib/host-packages/openai/openplanr/skills/delegate/references/operator-guide.md +25 -1
  299. package/lib/host-packages/openai/openplanr/skills/delegate/references/run-handoff.md +2 -2
  300. package/lib/host-packages/openai/openplanr/skills/delegate/references/worktree-custody.md +17 -9
  301. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/claude.mjs +15 -3
  302. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/codex.mjs +38 -2
  303. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/native.mjs +5 -0
  304. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/custody.mjs +217 -10
  305. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/handoff.mjs +1080 -0
  306. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integrate.mjs +96 -201
  307. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integration-files.mjs +3 -382
  308. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/presentation.mjs +29 -12
  309. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-contract.mjs +11 -0
  310. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-execution.mjs +1 -1
  311. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-lifecycle.mjs +14 -10
  312. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-preparation.mjs +4 -0
  313. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-record.mjs +2 -2
  314. package/lib/host-packages/openai/openplanr/skills/design/references/design-system.md +17 -2
  315. package/lib/host-packages/openai/openplanr/skills/design/references/generation.md +60 -2
  316. package/lib/host-packages/openai/openplanr/skills/design/references/utilities.md +23 -7
  317. package/lib/host-packages/openai/openplanr/skills/design/schemas/design-document.schema.json +131 -4
  318. package/lib/host-packages/openai/openplanr/skills/design-loop/references/design-system.md +17 -2
  319. package/lib/host-packages/openai/openplanr/skills/design-loop/references/generation.md +60 -2
  320. package/lib/host-packages/openai/openplanr/skills/design-loop/references/utilities.md +23 -7
  321. package/lib/host-packages/openai/openplanr/skills/design-loop/schemas/design-document.schema.json +131 -4
  322. package/lib/host-packages/openai/openplanr/skills/design-review/references/design-system.md +17 -2
  323. package/lib/host-packages/openai/openplanr/skills/design-review/references/generation.md +60 -2
  324. package/lib/host-packages/openai/openplanr/skills/design-review/references/utilities.md +23 -7
  325. package/lib/host-packages/openai/openplanr/skills/design-review/schemas/design-document.schema.json +131 -4
  326. package/lib/host-packages/openai/openplanr/skills/investigate/SKILL.md +2 -1
  327. package/lib/host-packages/openai/openplanr/skills/investigate/agents/openai.yaml +1 -1
  328. package/lib/host-packages/openai/openplanr/skills/investigate/openplanr.skill.json +12 -1
  329. package/lib/host-packages/openai/openplanr/skills/investigate/references/fail-first.md +40 -0
  330. package/lib/host-packages/openai/openplanr/skills/plan/SKILL.md +21 -11
  331. package/lib/host-packages/openai/openplanr/skills/plan/openplanr.skill.json +1 -1
  332. package/lib/host-packages/openai/openplanr/skills/plan/schemas/design-document.schema.json +131 -4
  333. package/lib/host-packages/openai/openplanr/skills/ship/SKILL.md +51 -18
  334. package/lib/host-packages/openai/openplanr/skills/ship/agents/openai.yaml +1 -1
  335. package/lib/host-packages/openai/openplanr/skills/ship/openplanr.skill.json +12 -1
  336. package/lib/host-packages/openai/openplanr/skills/ship/references/fail-first.md +40 -0
  337. package/lib/host-packages/openai/openplanr/skills/ship/references/result-contract.md +7 -3
  338. package/lib/host-packages/openai/openplanr/skills/spec/SKILL.md +6 -0
  339. package/lib/host-packages/openai/openplanr/skills/spec/openplanr.skill.json +1 -1
  340. package/lib/host-packages/openai/openplanr/skills/spec/references/specification-contract.md +3 -1
  341. package/lib/json-schema.mjs +4 -0
  342. package/package.json +16 -16
  343. package/dist/dashboard/assets/index-BU5fzjyz.css +0 -1
  344. package/dist/dashboard/assets/index-L8qtwqv6.js +0 -572
  345. package/dist/dashboard/assets/index-L8qtwqv6.js.map +0 -1
  346. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
  347. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
  348. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
  349. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
  350. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
  351. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-support-6774fd3d5d02.mjs +0 -24
  352. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
  353. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs +0 -1020
  354. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
  355. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5778
  356. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
  357. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
  358. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
  359. 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
  360. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
  361. 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
  362. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
  363. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
  364. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
  365. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
  366. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
  367. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integration-transaction.mjs +0 -958
  368. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integration-transaction.mjs +0 -958
  369. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
  370. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
  371. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
  372. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
  373. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
  374. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-support-6774fd3d5d02.mjs +0 -24
  375. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
  376. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs +0 -1020
  377. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
  378. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5778
  379. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
  380. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
  381. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
  382. 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
  383. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
  384. 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
  385. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
  386. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
  387. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
  388. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
  389. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
  390. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
  391. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
  392. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
  393. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
  394. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
  395. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-support-6774fd3d5d02.mjs +0 -24
  396. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
  397. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs +0 -1020
  398. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
  399. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5778
  400. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
  401. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
  402. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
  403. 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
  404. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
  405. 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
  406. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
  407. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
  408. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
  409. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
  410. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
  411. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integration-transaction.mjs +0 -958
@@ -1,21 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- DESIGN_DOCUMENT_SCHEMA,
4
- DESIGN_REVIEW_BUNDLE_SCHEMA,
5
- LARGE_OBJECT_LIMITS,
3
+ DESIGN_HANDOFF_SCHEMA,
6
4
  assertPlainData,
5
+ assertReviewExperience,
7
6
  canonicalizeJson,
8
7
  validateJson
9
8
  } from "./design-protocol-contracts.mjs";
10
9
 
11
10
  // packages/design/lib/design/plan-handoff-utility.mjs
12
- import { realpathSync as realpathSync5 } from "node:fs";
13
- import { resolve as resolve6 } from "node:path";
11
+ import { realpathSync as realpathSync3 } from "node:fs";
12
+ import { resolve as resolve4 } from "node:path";
14
13
  import { fileURLToPath } from "node:url";
15
14
 
16
15
  // packages/design/lib/design/handoff-reader.mjs
17
- import { existsSync as existsSync5, readFileSync as readFileSync6 } from "node:fs";
18
- import { dirname as dirname6, join as join8 } from "node:path";
16
+ import { existsSync as existsSync4, readFileSync as readFileSync6 } from "node:fs";
17
+ import { dirname as dirname4, join as join7 } from "node:path";
19
18
 
20
19
  // packages/artifact/lib/artifact/envelope.mjs
21
20
  import { createHash } from "node:crypto";
@@ -113,6 +112,24 @@ var PipelineError = class extends Error {
113
112
  }
114
113
  };
115
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
+
116
133
  // packages/artifact/lib/artifact/artifact-sources.mjs
117
134
  var ARTIFACT_SHARED_ENVELOPE_VERSION = "1.1.0";
118
135
 
@@ -149,9 +166,9 @@ function loadSchema(name, version = void 0) {
149
166
  if (schemaCache.has(key)) return schemaCache.get(key);
150
167
  const path = join(SCHEMAS_ROOT, candidateVersion, `${cleanName}.schema.json`);
151
168
  try {
152
- const schema2 = JSON.parse(readFileSync(path, "utf-8"));
153
- schemaCache.set(key, schema2);
154
- return schema2;
169
+ const schema = JSON.parse(readFileSync(path, "utf-8"));
170
+ schemaCache.set(key, schema);
171
+ return schema;
155
172
  } catch (error) {
156
173
  if (error?.code !== "ENOENT") throw error;
157
174
  }
@@ -269,241 +286,6 @@ function validateArtifactReview(review) {
269
286
  return review;
270
287
  }
271
288
 
272
- // packages/protocol/src/review-experience-contracts.mjs
273
- var text = { type: "string", maxLength: 16384 };
274
- var id = { type: "string", minLength: 1, maxLength: 128 };
275
- var digest = { type: "string", pattern: "^[a-f0-9]{64}$" };
276
- var texts = { type: "array", maxItems: 256, items: text };
277
- var closed = (properties, required = Object.keys(properties)) => ({
278
- type: "object",
279
- additionalProperties: false,
280
- properties,
281
- required
282
- });
283
- var list = (items, maxItems = 256) => ({ type: "array", maxItems, items });
284
- var schema = (name, properties, required) => ({
285
- $schema: "https://json-schema.org/draft/2020-12/schema",
286
- $id: `https://openplanr.dev/schemas/v1.10.0/${name}.schema.json`,
287
- "x-openplanr-contract": { id: name, version: "1.10.0" },
288
- ...closed(properties, required)
289
- });
290
- var DESIGN_REVIEW_CONTEXT_SCHEMA = schema(
291
- "design-review-context",
292
- {
293
- kind: { const: "openplanr-design-review-context" },
294
- schemaVersion: { const: "1.0.0" },
295
- designId: id,
296
- brief: closed({ purpose: text, requests: { ...texts, maxItems: 3 }, audience: text }, [
297
- "purpose",
298
- "requests"
299
- ]),
300
- revisionSummary: text,
301
- implementation: closed({
302
- tokens: list(closed({ name: id, value: text, description: text }, ["name", "value"]), 512),
303
- components: list(
304
- closed(
305
- {
306
- id,
307
- name: text,
308
- screenIds: list(id),
309
- anchorIds: list(id),
310
- states: list(closed({ name: id, description: text })),
311
- notes: text,
312
- responsive: text,
313
- accessibility: text
314
- },
315
- ["id", "name"]
316
- )
317
- ),
318
- responsive: texts,
319
- accessibility: texts
320
- })
321
- },
322
- ["kind", "schemaVersion", "designId", "brief", "implementation"]
323
- );
324
- var DESIGN_FINGERPRINT_SCHEMA = closed({
325
- screenId: id,
326
- variantId: id,
327
- frameId: id,
328
- contentDigest: digest,
329
- guidanceDigest: digest
330
- });
331
- var bundleV11 = {
332
- .../** @type {MutableSchema} */
333
- structuredClone(DESIGN_REVIEW_BUNDLE_SCHEMA),
334
- $id: "https://openplanr.dev/schemas/v1.10.0/design-review-bundle.schema.json",
335
- "x-openplanr-contract": { id: "design-review-bundle", version: "1.10.0" }
336
- };
337
- Object.assign(bundleV11.properties, {
338
- schemaVersion: { const: "1.1.0" },
339
- reviewContext: DESIGN_REVIEW_CONTEXT_SCHEMA,
340
- contextDigest: digest,
341
- fingerprints: list(DESIGN_FINGERPRINT_SCHEMA)
342
- });
343
- bundleV11.required.push("reviewContext", "contextDigest", "fingerprints");
344
- var DESIGN_REVIEW_BUNDLE_V11_SCHEMA = bundleV11;
345
- var bundleV12 = (
346
- /** @type {MutableSchema} */
347
- structuredClone(DESIGN_REVIEW_BUNDLE_V11_SCHEMA)
348
- );
349
- bundleV12.$id = "https://openplanr.dev/schemas/v1.16.0/design-review-bundle.schema.json";
350
- bundleV12["x-openplanr-contract"] = { id: "design-review-bundle", version: "1.16.0" };
351
- Object.assign(bundleV12.properties, {
352
- schemaVersion: { const: "1.2.0" },
353
- envelope: {
354
- type: "object",
355
- required: ["schemaVersion", "sources", "artifacts", "viewer"],
356
- properties: { schemaVersion: { const: "1.1.0" } }
357
- },
358
- entries: {
359
- .../** @type {Record<string, unknown>} */
360
- bundleV12.properties.entries,
361
- maxItems: 4096
362
- },
363
- fingerprints: list(DESIGN_FINGERPRINT_SCHEMA, 4096)
364
- });
365
- var bundleCurrent = (
366
- /** @type {MutableSchema} */
367
- structuredClone(bundleV12)
368
- );
369
- bundleCurrent.$id = "https://openplanr.dev/schemas/v1.20.0/design-review-bundle.schema.json";
370
- bundleCurrent["x-openplanr-contract"] = { id: "design-review-bundle", version: "1.20.0" };
371
- bundleCurrent.properties.schemaVersion = { enum: ["1.1.0", "1.2.0"] };
372
- bundleCurrent.properties.envelope = bundleV11.properties.envelope;
373
- bundleCurrent.allOf = [
374
- {
375
- if: { properties: { schemaVersion: { const: "1.2.0" } } },
376
- then: { properties: { envelope: bundleV12.properties.envelope } }
377
- }
378
- ];
379
- var currentDesign = (
380
- /** @type {MutableSchema} */
381
- bundleCurrent.properties.design
382
- );
383
- for (const key of ["frames", "layout"])
384
- currentDesign.properties[key] = /** @type {Record<string, unknown>} */
385
- DESIGN_DOCUMENT_SCHEMA.properties[key];
386
- bundleCurrent.$defs = structuredClone(DESIGN_DOCUMENT_SCHEMA.$defs);
387
- var currentEntries = (
388
- /** @type {{ items: { properties: Record<string, unknown> } }} */
389
- bundleCurrent.properties.entries
390
- );
391
- currentEntries.items.properties.height = { const: "auto" };
392
- var item = closed(
393
- {
394
- pinId: id,
395
- reviewId: id,
396
- screenId: id,
397
- revisionId: id,
398
- text,
399
- refinement: text,
400
- stale: { type: "boolean" },
401
- author: text,
402
- reviewOf: digest,
403
- source: text
404
- },
405
- ["pinId", "text"]
406
- );
407
- var DESIGN_HANDOFF_CONTENT_SCHEMA = closed({
408
- summary: text,
409
- agreedChanges: list(item, 1e4),
410
- openQuestions: list(item, 1e4),
411
- deferred: list(item, 1e4),
412
- rejected: list(item, 1e4)
413
- });
414
- var DESIGN_HANDOFF_SCHEMA = schema(
415
- "design-review-handoff",
416
- {
417
- kind: { const: "openplanr-design-review-handoff" },
418
- schemaVersion: { const: "1.0.0" },
419
- title: text,
420
- version: { type: "integer", minimum: 1 },
421
- status: { enum: ["draft", "approved"] },
422
- basis: closed({
423
- designId: id,
424
- sourceRevision: digest,
425
- contextDigest: digest,
426
- reviewOf: digest,
427
- selectedVariant: id,
428
- feedbackDigest: digest,
429
- verificationDigest: digest,
430
- feedbackWatermark: { type: "integer", minimum: 0 }
431
- }),
432
- content: DESIGN_HANDOFF_CONTENT_SCHEMA,
433
- contentHash: digest,
434
- markdown: { type: "string", maxLength: 2097152 },
435
- affectedScreens: list(id),
436
- verificationGaps: texts,
437
- reviewNotes: list(closed({ reviewId: id, text }), 1e4),
438
- approval: closed({ contentHash: digest, at: { type: "string", format: "date-time" } })
439
- },
440
- [
441
- "kind",
442
- "schemaVersion",
443
- "title",
444
- "version",
445
- "status",
446
- "basis",
447
- "content",
448
- "contentHash",
449
- "markdown",
450
- "affectedScreens",
451
- "verificationGaps",
452
- "reviewNotes"
453
- ]
454
- );
455
- var DESIGN_REVIEW_METADATA_PAYLOAD_SCHEMA = {
456
- ...schema(
457
- "design-review-metadata-payload",
458
- {
459
- schemaVersion: { const: "1.0.0" },
460
- kind: { enum: ["category", "disposition"] },
461
- author: { ...text, minLength: 1, maxLength: 160 },
462
- reviewOf: digest,
463
- pinId: id,
464
- category: { enum: ["question", "suggestion", "blocker"] },
465
- disposition: { enum: ["accepted", "deferred", "rejected"] },
466
- reason: text,
467
- updatedAt: { type: "string", format: "date-time" }
468
- },
469
- ["schemaVersion", "kind", "author", "reviewOf", "pinId", "updatedAt"]
470
- ),
471
- allOf: [
472
- {
473
- if: { properties: { kind: { const: "category" } } },
474
- then: { required: ["category"], not: { required: ["disposition"] } }
475
- },
476
- {
477
- if: { properties: { kind: { const: "disposition" } } },
478
- then: { required: ["disposition", "reason"], not: { required: ["category"] } }
479
- }
480
- ]
481
- };
482
- var payloadV11 = {
483
- .../** @type {MutableSchema} */
484
- structuredClone(DESIGN_REVIEW_METADATA_PAYLOAD_SCHEMA),
485
- $id: "https://openplanr.dev/schemas/v1.11.0/design-review-metadata-payload.schema.json",
486
- "x-openplanr-contract": { id: "design-review-metadata-payload", version: "1.11.0" }
487
- };
488
- Object.assign(payloadV11.properties, {
489
- schemaVersion: { const: "1.1.0" },
490
- category: { enum: ["question", "suggestion", "change-request", "blocker"] }
491
- });
492
- function assertReviewExperience(value, contract) {
493
- const errors = validateJson(value, contract);
494
- if (errors.length)
495
- throw new TypeError(
496
- `Invalid ${contract["x-openplanr-contract"]?.id ?? "review data"}: ${errors.slice(0, 4).map((item2) => `${item2.path} ${item2.detail}`).join("; ")}`
497
- );
498
- return value;
499
- }
500
- var REVIEW_EXPERIENCE_SCHEMAS = Object.freeze({
501
- "design-review-context": DESIGN_REVIEW_CONTEXT_SCHEMA,
502
- "design-review-bundle": DESIGN_REVIEW_BUNDLE_V11_SCHEMA,
503
- "design-review-handoff": DESIGN_HANDOFF_SCHEMA,
504
- "design-review-metadata-payload": DESIGN_REVIEW_METADATA_PAYLOAD_SCHEMA
505
- });
506
-
507
289
  // packages/design/lib/design/context.mjs
508
290
  import { createHash as createHash2 } from "node:crypto";
509
291
 
@@ -1650,7 +1432,7 @@ function recoverDesignPublication(root, { ownsRenderLock = false } = {}) {
1650
1432
  function designSpecPath(root) {
1651
1433
  return /(?:^|\/)output\/feats\/feat-[^/]+\/design$/u.test(root.replaceAll("\\", "/")) ? join2(dirname2(root), "design-spec.md") : join2(root, "design-spec.md");
1652
1434
  }
1653
- function currentDesign2(file, { recoverPublication = true } = {}) {
1435
+ function currentDesign(file, { recoverPublication = true } = {}) {
1654
1436
  const root = realpathSync(dirname2(resolve(file)));
1655
1437
  if (recoverPublication) recoverDesignPublication(root);
1656
1438
  else {
@@ -2028,7 +1810,7 @@ function resolveArtifactReviewDestination({
2028
1810
  // packages/design/lib/design/feedback-reader.mjs
2029
1811
  var designReviewKey = (document) => `design-${hash(document.id).slice(0, 24)}`;
2030
1812
  function designReviewPath(file, env = process.env, options = {}) {
2031
- const { root, document } = currentDesign2(file, options);
1813
+ const { root, document } = currentDesign(file, options);
2032
1814
  return resolveArtifactReviewDestination({
2033
1815
  cwd: root,
2034
1816
  env,
@@ -2036,22 +1818,22 @@ function designReviewPath(file, env = process.env, options = {}) {
2036
1818
  }).path;
2037
1819
  }
2038
1820
  function readDesignFeedback(file, env = process.env, options = {}) {
2039
- const current = currentDesign2(file, options);
1821
+ const current = currentDesign(file, options);
2040
1822
  const ledger = readArtifactReviewState(designReviewPath(file, env, options), {
2041
1823
  allowMissing: true
2042
1824
  });
2043
- const digest2 = digestArtifactEnvelope(current.envelope);
1825
+ const digest = digestArtifactEnvelope(current.envelope);
2044
1826
  const pins = (ledger?.reviews ?? []).flatMap(
2045
1827
  (entry) => entry.review.pins.map((pin) => {
2046
- const target = current.entries.find((item2) => item2.artifactId === pin.artifactId);
2047
- const screen = target && current.document.screens.find((item2) => item2.id === target.screenId);
1828
+ const target = current.entries.find((item) => item.artifactId === pin.artifactId);
1829
+ const screen = target && current.document.screens.find((item) => item.id === target.screenId);
2048
1830
  const anchorMissing = pin.anchor?.planrId && screen?.anchors?.length && !screen.anchors.includes(pin.anchor.planrId) && pin.anchor.planrId !== screen.id;
2049
1831
  return {
2050
1832
  ...pin,
2051
1833
  reviewId: entry.review.reviewId,
2052
1834
  reviewOf: entry.review.reviewOf,
2053
1835
  ...entry.review.reviewId.startsWith("shared-") ? { revisionId: entry.review.reviewId.slice(7) } : {},
2054
- stale: entry.stale || entry.review.reviewOf !== digest2 || !target || Boolean(anchorMissing),
1836
+ stale: entry.stale || entry.review.reviewOf !== digest || !target || Boolean(anchorMissing),
2055
1837
  ...target ? { screenId: target.screenId, variantId: target.variantId } : {}
2056
1838
  };
2057
1839
  })
@@ -2070,7 +1852,7 @@ function readDesignFeedback(file, env = process.env, options = {}) {
2070
1852
  }
2071
1853
 
2072
1854
  // packages/design/lib/design/handoff-format.mjs
2073
- var safeMd = (text2) => String(text2).replaceAll("[", "\\[").replaceAll("]", "\\]").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
1855
+ var safeMd = (text) => String(text).replaceAll("[", "\\[").replaceAll("]", "\\]").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2074
1856
  function renderMarkdown(draft, title) {
2075
1857
  const lines = [
2076
1858
  `# ${safeMd(title)} \u2014 review handoff`,
@@ -2087,11 +1869,11 @@ function renderMarkdown(draft, title) {
2087
1869
  ["rejected", "Rejected"]
2088
1870
  ]) {
2089
1871
  lines.push(`## ${label}`, "");
2090
- for (const item2 of draft.content[key]) {
1872
+ for (const item of draft.content[key]) {
2091
1873
  lines.push(
2092
- `- ${safeMd(item2.refinement ?? item2.text)} \u2014 ${safeMd(item2.author ?? "Reviewer")}${item2.stale ? " \xB7 original revision" : ""} [source comment](${item2.source})`
1874
+ `- ${safeMd(item.refinement ?? item.text)} \u2014 ${safeMd(item.author ?? "Reviewer")}${item.stale ? " \xB7 original revision" : ""} [source comment](${item.source})`
2093
1875
  );
2094
- if (item2.refinement) lines.push(` Original comment: ${safeMd(item2.text)}`);
1876
+ if (item.refinement) lines.push(` Original comment: ${safeMd(item.text)}`);
2095
1877
  }
2096
1878
  if (!draft.content[key].length) lines.push("None recorded.");
2097
1879
  lines.push("");
@@ -2325,7 +2107,7 @@ function compileDesignHandoffResolution(input) {
2325
2107
  validatePin(pin);
2326
2108
  counts.set(pin.id, (counts.get(pin.id) ?? 0) + 1);
2327
2109
  }
2328
- const duplicatePinIds = new Set([...counts].filter(([, count]) => count > 1).map(([id2]) => id2));
2110
+ const duplicatePinIds = new Set([...counts].filter(([, count]) => count > 1).map(([id]) => id));
2329
2111
  const known = /* @__PURE__ */ new Set();
2330
2112
  for (const pin of pins) {
2331
2113
  const key = keyOf(pin);
@@ -2443,7 +2225,7 @@ function compileDesignHandoffResolution(input) {
2443
2225
  )
2444
2226
  );
2445
2227
  const severity = new Set(diagnostics.map((value) => value.severity));
2446
- const status = severity.has("stale") ? "stale" : severity.has("blocked") ? "blocked" : items.some((item2) => item2.outcome === "open") ? "attention" : "ready";
2228
+ const status = severity.has("stale") ? "stale" : severity.has("blocked") ? "blocked" : items.some((item) => item.outcome === "open") ? "attention" : "ready";
2447
2229
  return {
2448
2230
  kind: "openplanr-design-handoff-resolution",
2449
2231
  schemaVersion: "1.0.0",
@@ -2451,186 +2233,197 @@ function compileDesignHandoffResolution(input) {
2451
2233
  status,
2452
2234
  complete: source.historyComplete !== false && !["blocked", "stale"].includes(status),
2453
2235
  items,
2454
- implementationScope: items.filter((item2) => item2.implementationScope).map((item2) => item2.id),
2236
+ implementationScope: items.filter((item) => item.implementationScope).map((item) => item.id),
2455
2237
  diagnostics
2456
2238
  };
2457
2239
  }
2458
2240
 
2459
- // packages/design/lib/design/share-status.mjs
2460
- import { existsSync as existsSync4, realpathSync as realpathSync4 } from "node:fs";
2461
- import { homedir as homedir3 } from "node:os";
2462
- import { dirname as dirname5, isAbsolute as isAbsolute3, join as join7, relative as relative3, resolve as resolve5 } from "node:path";
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";
2463
2245
 
2464
- // packages/artifact/lib/artifact/owner-custody.mjs
2465
- import {
2466
- chmodSync as chmodSync2,
2467
- closeSync as closeSync2,
2468
- existsSync as existsSync3,
2469
- fsyncSync,
2470
- linkSync,
2471
- lstatSync as lstatSync4,
2472
- mkdirSync as mkdirSync4,
2473
- openSync as openSync2,
2474
- readFileSync as readFileSync5,
2475
- realpathSync as realpathSync3,
2476
- renameSync as renameSync4,
2477
- unlinkSync,
2478
- writeFileSync as writeFileSync4
2479
- } from "node:fs";
2480
- import { basename, dirname as dirname4, isAbsolute as isAbsolute2, join as join6, relative as relative2, resolve as resolve4 } from "node:path";
2481
- function custodyError(message2, code = "E_OWNER_CUSTODY_LOCATION") {
2482
- return Object.assign(new Error(message2), { code, status: 400 });
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
+ );
2483
2271
  }
2484
- function pathExists(path) {
2485
- try {
2486
- lstatSync4(path);
2487
- return true;
2488
- } catch (error) {
2489
- if (error.code === "ENOENT") return false;
2490
- throw error;
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] };
2491
2288
  }
2289
+ return null;
2492
2290
  }
2493
- function assertDirectoryAncestry(root, label) {
2494
- for (let path = root; dirname4(path) !== path; path = dirname4(path)) {
2495
- if (pathExists(path) && lstatSync4(path).isSymbolicLink())
2496
- throw custodyError(`${label} custody directory must not contain symbolic links.`);
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;
2497
2297
  }
2498
2298
  }
2499
- function assertPrivateFile(path, label) {
2500
- const stat = lstatSync4(path);
2501
- if (!stat.isFile() || stat.isSymbolicLink() || process.platform !== "win32" && (stat.mode & 63 || stat.uid !== process.getuid()))
2502
- throw custodyError(
2503
- `${label} owner custody must be a private 0600 file.`,
2504
- "E_OWNER_CUSTODY_INVALID"
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."
2505
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
+ );
2506
2320
  }
2507
- function assertPrivateDirectory(root, label, recoveryOutput = false) {
2508
- const stat = lstatSync4(root);
2509
- if (!stat.isDirectory() || stat.isSymbolicLink() || !recoveryOutput && process.platform !== "win32" && (stat.mode & 63 || stat.uid !== process.getuid()))
2510
- throw custodyError(`${label} custody must use a private local directory.`);
2321
+ function argv(command, file, flags) {
2322
+ return ["artifact", command, ...flags, "--json", ...file === void 0 ? [] : ["--", file]];
2511
2323
  }
2512
- function readCustody(path, { label = "Owner", format, recoveryInput = false } = {}) {
2513
- if (recoveryInput && existsSync3(path)) {
2514
- assertPrivateFile(path, label);
2515
- path = realpathSync3(path);
2516
- }
2517
- assertDirectoryAncestry(dirname4(path), label);
2518
- if (!pathExists(path)) return null;
2519
- assertPrivateDirectory(dirname4(path), label, recoveryInput);
2520
- assertPrivateFile(path, label);
2521
- let record;
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;
2522
2332
  try {
2523
- record = JSON.parse(readFileSync5(path, "utf8"));
2524
- } catch {
2525
- throw custodyError(`${label} owner custody is invalid.`, "E_OWNER_CUSTODY_INVALID");
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);
2526
2342
  }
2527
- if (record?.kind !== format || record.schemaVersion !== "1.0.0" || !record.custody)
2528
- throw custodyError(`${label} owner custody is invalid.`, "E_OWNER_CUSTODY_INVALID");
2529
- return record;
2343
+ return settle(command, timeout, null, stdout, "");
2530
2344
  }
2531
-
2532
- // packages/artifact/lib/artifact/internal/workspace-address.mjs
2533
- function createWorkspaceAddress({
2534
- label,
2535
- reviewPath,
2536
- defaultBaseUrl = "https://share.openplanr.dev"
2537
- }) {
2538
- function normalizeWorkspaceBase2(baseUrl = defaultBaseUrl) {
2539
- const url = new URL(baseUrl);
2540
- if (url.username || url.password || url.search || url.hash || url.pathname !== "/" || url.protocol !== "https:" && !(url.protocol === "http:" && ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname)))
2541
- throw new TypeError(
2542
- `${label} sharing requires an HTTPS origin or a local development server.`
2543
- );
2544
- return url.origin;
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
+ };
2545
2355
  }
2546
- function workspaceReviewUrl2(access) {
2547
- if (!/^[A-Za-z0-9_-]{22,64}$/.test(access.id))
2548
- throw new TypeError(`Invalid ${label.toLowerCase()} workspace identity.`);
2549
- return `${normalizeWorkspaceBase2(access.baseUrl)}${reviewPath}/${access.id}`;
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;
2550
2372
  }
2551
- return { normalizeWorkspaceBase: normalizeWorkspaceBase2, workspaceReviewUrl: workspaceReviewUrl2 };
2373
+ return known;
2552
2374
  }
2553
-
2554
- // packages/design/lib/design/workspace-address.mjs
2555
- var DESIGN_SHARE_BASE_URL = "https://share.openplanr.dev";
2556
- var DESIGN_SHARE_REVIEW_PATH = "/d";
2557
- var address = createWorkspaceAddress({
2558
- label: "Design",
2559
- reviewPath: DESIGN_SHARE_REVIEW_PATH,
2560
- defaultBaseUrl: DESIGN_SHARE_BASE_URL
2561
- });
2562
- var normalizeWorkspaceBase = address.normalizeWorkspaceBase;
2563
- var workspaceReviewUrl = (access) => `${address.workspaceReviewUrl(access)}${access.schemaVersion === "2.0.0" ? "?v=2" : ""}`;
2564
-
2565
- // packages/design/lib/design/share-status.mjs
2566
- var FORMAT = "openplanr-design-owner-custody";
2567
- function custodyLocation(file, options = {}, { allowMissing = false } = {}) {
2568
- const current = currentDesign2(file, options);
2569
- const env = options.env ?? process.env;
2570
- const root = resolve5(options.custodyRoot ?? join7(planrHome(env), "design-shares"));
2571
- let project = current.root;
2572
- for (let candidate = current.root; dirname5(candidate) !== candidate; candidate = dirname5(candidate)) {
2573
- if (existsSync4(join7(candidate, ".git")) || existsSync4(join7(candidate, PLANNING_FOLDER))) {
2574
- project = candidate;
2575
- break;
2576
- }
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);
2577
2391
  }
2578
- const key = hash(`${current.root}
2579
- ${current.document.id}`);
2580
- const path = join7(root, `${key}.json`);
2581
- const within = relative3(project, root);
2582
- if ((!allowMissing || existsSync4(path)) && (within === "" || !within.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) && within !== ".." && !isAbsolute3(within)))
2583
- throw new Error(
2584
- "Design owner keys must be stored outside the project. Set PLANR_HOME to a private user-level directory."
2585
- );
2586
- const legacyPath = !options.custodyRoot && !configuredPlanrHome(env) ? join7(realpathSync4(env.HOME || homedir3()), ".openplanr", "design-shares", `${key}.json`) : null;
2587
- return { root, path, current, legacyPath };
2588
- }
2589
- function presentationFingerprint(current, { legacy = false } = {}) {
2590
- const state = readJson(join7(current.root, ".design/studio-state.json"), { state: {} }).state;
2591
- return hash(
2592
- JSON.stringify({
2593
- revision: current.revision,
2594
- selectedVariant: state.selectedVariant ?? current.document.selectedVariant,
2595
- ...legacy ? { positions: state.positions ?? {} } : {},
2596
- verification: current.verification.status
2597
- })
2598
- );
2392
+ return outcomeOf(remember(env, outcome));
2599
2393
  }
2600
- var safeStatus = (record, current) => ({
2601
- ok: true,
2602
- shared: Boolean(record),
2603
- title: current.document.title,
2604
- localRevision: current.revision,
2605
- retention: "until-revoked",
2606
- ...record ? {
2607
- id: record.custody.id,
2608
- url: workspaceReviewUrl(record.custody),
2609
- revision: record.custody.currentRevision ?? record.publishedRevision ?? null,
2610
- publishedRevision: record.publishedRevision ?? null,
2611
- hasUpdate: record.publishedRevision !== current.revision || ![
2612
- presentationFingerprint(current),
2613
- presentationFingerprint(current, { legacy: true })
2614
- ].includes(record.publishedPresentation),
2615
- epoch: record.custody.epoch,
2616
- commentsPaused: Boolean(record.custody.commentsPaused ?? record.commentsPaused),
2617
- revoked: Boolean(record.revoked),
2618
- deleted: Boolean(record.deleted),
2619
- pending: Boolean(
2620
- record.custody.pendingCreate || record.custody.pendingMutation || record.pendingReviewMetadata?.length
2621
- ),
2622
- pendingAction: record.custody.pendingCreate ? "create" : record.custody.pendingMutation?.action ?? (record.pendingReviewMetadata?.length ? "review-metadata" : null),
2623
- pendingReviewMetadata: Boolean(record.pendingReviewMetadata?.length)
2624
- } : {}
2625
- });
2626
- function getDesignShareStatus(file, options = {}) {
2627
- const { path, current, legacyPath } = custodyLocation(file, options);
2628
- const record = readCustody(path, { label: "Design", format: FORMAT }) ?? (legacyPath ? readCustody(legacyPath, { label: "Design", format: FORMAT }) : null);
2629
- return safeStatus(record, current);
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;
2630
2423
  }
2631
2424
 
2632
2425
  // packages/design/lib/design/handoff-reader.mjs
2633
- var metadataPath = (current) => join8(current.root, ".design/review-metadata.json");
2426
+ var metadataPath = (current) => join7(current.root, ".design/review-metadata.json");
2634
2427
  var revisionOf2 = (pin) => pin.revisionId ?? pin.reviewId;
2635
2428
  function metadata(current, feedback) {
2636
2429
  const local = readJson(metadataPath(current), { version: 0, byRevision: {} });
@@ -2696,7 +2489,7 @@ function resolutionFor(value, shareStatus) {
2696
2489
  });
2697
2490
  }
2698
2491
  function snapshot(file, env, shareOptions = {}) {
2699
- const current = currentDesign2(file, shareOptions), feedback = readDesignFeedback(file, env, shareOptions), meta = metadata(current, feedback);
2492
+ const current = currentDesign(file, shareOptions), feedback = readDesignFeedback(file, env, shareOptions), meta = metadata(current, feedback);
2700
2493
  const reviewContext = current.reviewContext ?? emptyReviewContext(current.document);
2701
2494
  const basis = {
2702
2495
  designId: current.document.id,
@@ -2735,12 +2528,12 @@ function snapshot(file, env, shareOptions = {}) {
2735
2528
  }
2736
2529
  function readDesignHandoff(file, { env = process.env, ...shareOptions } = {}) {
2737
2530
  const value = snapshot(file, env, shareOptions);
2738
- const path = join8(dirname6(designSpecPath(value.current.root)), "review-handoff.json");
2531
+ const path = join7(dirname4(designSpecPath(value.current.root)), "review-handoff.json");
2739
2532
  const draft = readJson(path, null);
2740
2533
  if (draft) {
2741
2534
  assertDraft(draft);
2742
2535
  const markdownPath = path.replace(/\.json$/u, ".md");
2743
- if (!existsSync5(markdownPath) || readFileSync6(markdownPath, "utf8") !== draft.markdown)
2536
+ if (!existsSync4(markdownPath) || readFileSync6(markdownPath, "utf8") !== draft.markdown)
2744
2537
  throw new Error(
2745
2538
  "The handoff Markdown differs from its approved JSON. Rebuild the handoff projection before using it in Plan."
2746
2539
  );
@@ -2777,9 +2570,9 @@ function assertDraft(draft) {
2777
2570
  }
2778
2571
 
2779
2572
  // packages/design/lib/design/plan-handoff-utility.mjs
2780
- function inspectPlanDesignHandoff(argv, { stdout = (value) => process.stdout.write(`${JSON.stringify(value)}
2573
+ function inspectPlanDesignHandoff(argv2, { stdout = (value) => process.stdout.write(`${JSON.stringify(value)}
2781
2574
  `) } = {}) {
2782
- if (argv.length === 0 || ["--help", "help"].includes(argv[0])) {
2575
+ if (argv2.length === 0 || argv2[0] === "help" || argv2.some((value) => ["--help", "-h"].includes(value))) {
2783
2576
  const help = {
2784
2577
  usage: "design.mjs handoff <design-document.json> [--action inspect] [--json]",
2785
2578
  note: "Reads the existing handoff and its current approval; never renders, publishes, or starts implementation."
@@ -2787,7 +2580,9 @@ function inspectPlanDesignHandoff(argv, { stdout = (value) => process.stdout.wri
2787
2580
  stdout(help);
2788
2581
  return help;
2789
2582
  }
2790
- const [command, input, ...args] = argv;
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.`);
2791
2586
  if (command !== "handoff" || !input)
2792
2587
  throw new Error("Usage: design.mjs handoff <design-document.json> [--action inspect] [--json]");
2793
2588
  for (let index = 0; index < args.length; index += 1) {
@@ -2795,20 +2590,20 @@ function inspectPlanDesignHandoff(argv, { stdout = (value) => process.stdout.wri
2795
2590
  if (args[index] === "--action" && args[++index] === "inspect") continue;
2796
2591
  throw new Error("Plan handoff support only accepts --action inspect and --json.");
2797
2592
  }
2798
- const result = readDesignHandoff(resolve6(input), { recoverPublication: false });
2593
+ const result = readDesignHandoff(resolve4(input), { recoverPublication: false });
2799
2594
  stdout(result);
2800
2595
  return result;
2801
2596
  }
2802
- async function main(argv = process.argv.slice(2)) {
2597
+ async function main(argv2 = process.argv.slice(2)) {
2803
2598
  try {
2804
- return inspectPlanDesignHandoff(argv);
2599
+ return inspectPlanDesignHandoff(argv2);
2805
2600
  } catch (error) {
2806
2601
  process.stderr.write(`${error.code ? `${error.code}: ` : ""}${error.message}
2807
2602
  `);
2808
2603
  process.exitCode = 1;
2809
2604
  }
2810
2605
  }
2811
- if (process.argv[1] && fileURLToPath(import.meta.url) === realpathSync5(process.argv[1]))
2606
+ if (process.argv[1] && fileURLToPath(import.meta.url) === realpathSync3(process.argv[1]))
2812
2607
  await main();
2813
2608
  export {
2814
2609
  inspectPlanDesignHandoff,