openplanr 2.2640.8 → 2.2641.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.
- package/CHANGELOG.md +14 -0
- package/dist/dashboard/.vite/manifest.json +1 -1
- package/dist/dashboard/assets/{index-COZ36pFn.js → index-D7R6tnlX.js} +2 -2
- package/dist/dashboard/assets/{index-COZ36pFn.js.map → index-D7R6tnlX.js.map} +1 -1
- package/dist/dashboard/dashboard-manifest.json +8 -8
- package/dist/dashboard/index.html +1 -1
- package/lib/host-packages/adapter-registry.json +5 -5
- package/lib/host-packages/capability-map.json +1 -1
- package/lib/host-packages/claude/.claude-plugin/marketplace.json +2 -2
- package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +1 -1
- package/lib/host-packages/claude/openplanr/.openplanr-content.json +167 -35
- package/lib/host-packages/claude/openplanr/README.md +22 -1
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-artifact-shell.mjs +3 -11
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +555 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/{design-pako-esm.mjs → design-compression.mjs} +2 -1521
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-document.mjs +133 -12
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +647 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-entities.mjs +17 -67
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-handoff.mjs +14 -16
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/{design-planr-home.mjs → design-loopback-server.mjs} +15 -36
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-owner-custody.mjs +121 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-resource-pack.mjs +698 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review.mjs +798 -796
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-home.mjs +39 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-support-5cb7531bede8.mjs +24 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share.mjs +138 -765
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/{design-escape.mjs → design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs} +158 -156
- package/lib/host-packages/{openai/openplanr/runtime/design/scripts/design-artifact-sources.mjs → claude/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs} +1 -1
- package/lib/host-packages/{openai/openplanr/runtime/design/scripts/design-bounded-json-data.mjs → claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-31a760fc.mjs} +241 -454
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +222 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-upload-spool.mjs +198 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design.mjs +12 -5
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +1 -1
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +18 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +809 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +5193 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +4175 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +65 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/06-artifact-review-ui.js +1755 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +62 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/08-artifact-review-ui.js +2600 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +123 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/package.json +3 -3
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +3 -3
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +34 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +992 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +2513 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +1919 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +1759 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +1551 -0
- 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 +1121 -0
- 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 +2183 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +705 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +27 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +13 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-design-review-experience.js +3561 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-studio-shell.js +184 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-interface-primitives.js +5045 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-interface-primitives.js +1698 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-studio-shell.js +455 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-design-studio.js +1844 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +257 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +4966 -0
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design.mjs +240 -5192
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/backend-diagnostics.mjs +6 -2
- package/lib/host-packages/cursor/openplanr/.openplanr-content.json +166 -34
- package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/backend-diagnostics.mjs +6 -2
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-artifact-shell.mjs +3 -11
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +555 -0
- package/lib/host-packages/{openai/openplanr/runtime/design/scripts/design-pako-esm.mjs → cursor/openplanr/runtime/design/scripts/design-compression.mjs} +2 -1521
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-document.mjs +133 -12
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +647 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-entities.mjs +17 -67
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-handoff.mjs +14 -16
- package/lib/host-packages/{openai/openplanr/runtime/design/scripts/design-planr-home.mjs → cursor/openplanr/runtime/design/scripts/design-loopback-server.mjs} +15 -36
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-owner-custody.mjs +121 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-resource-pack.mjs +698 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review.mjs +798 -796
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-home.mjs +39 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-support-5cb7531bede8.mjs +24 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share.mjs +138 -765
- package/lib/host-packages/{openai/openplanr/runtime/design/scripts/design-escape.mjs → cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs} +158 -156
- package/lib/host-packages/{claude/openplanr/runtime/design/scripts/design-artifact-sources.mjs → cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs} +1 -1
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/{design-bounded-json-data.mjs → design-shared-protocol-contracts-31a760fc.mjs} +241 -454
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +222 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-upload-spool.mjs +198 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design.mjs +12 -5
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +1 -1
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +18 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +809 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +5193 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +4175 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +65 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/06-artifact-review-ui.js +1755 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +62 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/08-artifact-review-ui.js +2600 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +123 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/package.json +3 -3
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +3 -3
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +34 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +992 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +2513 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +1919 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +1759 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +1551 -0
- 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 +1121 -0
- 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 +2183 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +705 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +27 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +13 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-design-review-experience.js +3561 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-studio-shell.js +184 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-interface-primitives.js +5045 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-interface-primitives.js +1698 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-studio-shell.js +455 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-design-studio.js +1844 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +257 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +4966 -0
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design.mjs +240 -5192
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/openai/.claude-plugin/marketplace.json +2 -2
- package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +1 -1
- package/lib/host-packages/openai/openplanr/.openplanr-content.json +166 -34
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-artifact-shell.mjs +3 -11
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +555 -0
- package/lib/host-packages/{cursor/openplanr/runtime/design/scripts/design-pako-esm.mjs → openai/openplanr/runtime/design/scripts/design-compression.mjs} +2 -1521
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-document.mjs +133 -12
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +647 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-entities.mjs +17 -67
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-handoff.mjs +14 -16
- package/lib/host-packages/{cursor/openplanr/runtime/design/scripts/design-planr-home.mjs → openai/openplanr/runtime/design/scripts/design-loopback-server.mjs} +15 -36
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-owner-custody.mjs +121 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-resource-pack.mjs +698 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review.mjs +798 -796
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-home.mjs +39 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-support-5cb7531bede8.mjs +24 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share.mjs +138 -765
- package/lib/host-packages/{cursor/openplanr/runtime/design/scripts/design-escape.mjs → openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs} +158 -156
- package/lib/host-packages/{cursor/openplanr/runtime/design/scripts/design-artifact-sources.mjs → openai/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs} +1 -1
- package/lib/host-packages/{claude/openplanr/runtime/design/scripts/design-bounded-json-data.mjs → openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-31a760fc.mjs} +241 -454
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +222 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-upload-spool.mjs +198 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design.mjs +12 -5
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +1 -1
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +18 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +809 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +5193 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +4175 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +65 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/06-artifact-review-ui.js +1755 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +62 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/08-artifact-review-ui.js +2600 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +123 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/package.json +3 -3
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +3 -3
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +34 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +992 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +2513 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +1919 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +1759 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +1551 -0
- 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 +1121 -0
- 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 +2183 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +705 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +27 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +13 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-design-review-experience.js +3561 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-studio-shell.js +184 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-interface-primitives.js +5045 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-interface-primitives.js +1698 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-studio-shell.js +455 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-design-studio.js +1844 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +257 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +4966 -0
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design.mjs +240 -5192
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/backend-diagnostics.mjs +6 -2
- package/package.json +2 -2
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-generated-b0798298053515fd.mjs +0 -18
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js +0 -5
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js +0 -25597
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-generated-b0798298053515fd.mjs +0 -18
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js +0 -5
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js +0 -25597
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-generated-b0798298053515fd.mjs +0 -18
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js +0 -5
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js +0 -25597
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isProcessAlive
|
|
3
|
-
} from "./design-
|
|
3
|
+
} from "./design-loopback-server.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Parser,
|
|
6
6
|
defaultTreeAdapter
|
|
@@ -12,18 +12,141 @@ import {
|
|
|
12
12
|
} from "./design-parse5-tokenizer.mjs";
|
|
13
13
|
import {
|
|
14
14
|
MAX_ARTIFACT_HTML_BYTES
|
|
15
|
-
} from "./design-artifact-
|
|
15
|
+
} from "./design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs";
|
|
16
16
|
import {
|
|
17
17
|
DESIGN_REVIEW_BUNDLE_SCHEMA,
|
|
18
|
-
canonicalizeJson,
|
|
19
|
-
sha256Hex,
|
|
20
18
|
validateJson
|
|
21
|
-
} from "./design-
|
|
19
|
+
} from "./design-shared-protocol-contracts-31a760fc.mjs";
|
|
20
|
+
import {
|
|
21
|
+
canonicalizeJson,
|
|
22
|
+
sha256Hex
|
|
23
|
+
} from "./design-shared-protocol-contracts-75a938cc.mjs";
|
|
24
|
+
|
|
25
|
+
// packages/design/lib/design/document-state.mjs
|
|
26
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
27
|
+
import {
|
|
28
|
+
closeSync,
|
|
29
|
+
lstatSync,
|
|
30
|
+
mkdirSync,
|
|
31
|
+
openSync,
|
|
32
|
+
readFileSync,
|
|
33
|
+
realpathSync,
|
|
34
|
+
renameSync,
|
|
35
|
+
rmSync,
|
|
36
|
+
writeFileSync
|
|
37
|
+
} from "node:fs";
|
|
38
|
+
import { dirname, join, resolve } from "node:path";
|
|
39
|
+
var hash = (value) => createHash("sha256").update(value).digest("hex");
|
|
40
|
+
var json = (value) => `${JSON.stringify(value, null, 2)}
|
|
41
|
+
`;
|
|
42
|
+
function readJson(path, fallback = void 0) {
|
|
43
|
+
try {
|
|
44
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (error.code === "ENOENT" && fallback !== void 0) return fallback;
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function atomicJson(path, value) {
|
|
51
|
+
atomicBytes(path, json(value));
|
|
52
|
+
}
|
|
53
|
+
function atomicBytes(path, bytes) {
|
|
54
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
55
|
+
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
56
|
+
try {
|
|
57
|
+
writeFileSync(temporary, bytes, { mode: 384, flag: "wx" });
|
|
58
|
+
renameSync(temporary, path);
|
|
59
|
+
} finally {
|
|
60
|
+
rmSync(temporary, { force: true });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function recoverDesignPublication(root, { ownsRenderLock = false } = {}) {
|
|
64
|
+
const journalPath = join(root, ".design/publication.json");
|
|
65
|
+
let journal = readJson(journalPath, null);
|
|
66
|
+
if (!journal) return;
|
|
67
|
+
const lockPath = join(root, ".design/render.lock");
|
|
68
|
+
let recoveryOwner;
|
|
69
|
+
if (!ownsRenderLock) {
|
|
70
|
+
const lock = readJson(lockPath, null);
|
|
71
|
+
if (lock && isProcessAlive(lock.pid)) return;
|
|
72
|
+
if (lock) rmSync(lockPath, { force: true });
|
|
73
|
+
recoveryOwner = randomUUID();
|
|
74
|
+
let descriptor;
|
|
75
|
+
try {
|
|
76
|
+
descriptor = openSync(lockPath, "wx", 384);
|
|
77
|
+
writeFileSync(
|
|
78
|
+
descriptor,
|
|
79
|
+
json({ pid: process.pid, owner: recoveryOwner, createdAt: Date.now() })
|
|
80
|
+
);
|
|
81
|
+
} catch (error) {
|
|
82
|
+
if (error.code === "EEXIST") return;
|
|
83
|
+
throw error;
|
|
84
|
+
} finally {
|
|
85
|
+
if (descriptor !== void 0) closeSync(descriptor);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
journal = readJson(journalPath, null);
|
|
90
|
+
if (!journal) return;
|
|
91
|
+
const pointer = readJson(join(root, ".design/current.json"), null);
|
|
92
|
+
const manifestPath = join(root, "finalized.json");
|
|
93
|
+
if (pointer?.revision === journal.revision) atomicJson(manifestPath, journal.manifest);
|
|
94
|
+
else if ((pointer?.revision ?? null) === journal.previousRevision) {
|
|
95
|
+
if (journal.previousManifest === null) rmSync(manifestPath, { force: true });
|
|
96
|
+
else atomicBytes(manifestPath, Buffer.from(journal.previousManifest, "base64"));
|
|
97
|
+
} else if (pointer?.revision && /^[a-f0-9]{64}$/u.test(pointer.revision)) {
|
|
98
|
+
atomicJson(
|
|
99
|
+
manifestPath,
|
|
100
|
+
readJson(join(root, ".design/revisions", pointer.revision, "render.json")).manifest
|
|
101
|
+
);
|
|
102
|
+
} else
|
|
103
|
+
throw new Error("Design publication recovery could not identify the committed revision.");
|
|
104
|
+
rmSync(journalPath, { force: true });
|
|
105
|
+
} finally {
|
|
106
|
+
if (recoveryOwner && readJson(lockPath, null)?.owner === recoveryOwner)
|
|
107
|
+
rmSync(lockPath, { force: true });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function designSpecPath(root) {
|
|
111
|
+
return /(?:^|\/)output\/feats\/feat-[^/]+\/design$/u.test(root.replaceAll("\\", "/")) ? join(dirname(root), "design-spec.md") : join(root, "design-spec.md");
|
|
112
|
+
}
|
|
113
|
+
function currentDesign(file, { recoverPublication = true } = {}) {
|
|
114
|
+
const root = realpathSync(dirname(resolve(file)));
|
|
115
|
+
if (recoverPublication) recoverDesignPublication(root);
|
|
116
|
+
else {
|
|
117
|
+
try {
|
|
118
|
+
lstatSync(join(root, ".design/publication.json"));
|
|
119
|
+
throw Object.assign(
|
|
120
|
+
new Error(
|
|
121
|
+
"Design publication state is pending or needs recovery. Finish or recover it with the Design utility; repair or restore an invalid .design/publication.json before retrying Plan handoff inspection."
|
|
122
|
+
),
|
|
123
|
+
{ code: "E_DESIGN_PUBLICATION_PENDING", statusCode: 409 }
|
|
124
|
+
);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
if (error.code !== "ENOENT") throw error;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const pointer = readJson(join(root, ".design/current.json"), null);
|
|
130
|
+
if (!pointer || !/^[a-f0-9]{64}$/u.test(pointer.revision))
|
|
131
|
+
throw new Error("Design has no completed render. Run the render utility first.");
|
|
132
|
+
const directory = join(root, ".design/revisions", pointer.revision);
|
|
133
|
+
const prepared = readJson(join(directory, "render.json"));
|
|
134
|
+
return {
|
|
135
|
+
...prepared,
|
|
136
|
+
root,
|
|
137
|
+
directory,
|
|
138
|
+
file: resolve(file),
|
|
139
|
+
verification: readJson(join(root, ".design/verification", `${pointer.revision}.json`), {
|
|
140
|
+
status: "unverified",
|
|
141
|
+
revision: pointer.revision
|
|
142
|
+
})
|
|
143
|
+
};
|
|
144
|
+
}
|
|
22
145
|
|
|
23
146
|
// packages/artifact/lib/artifact/local-document.mjs
|
|
24
|
-
import { createHash } from "node:crypto";
|
|
25
|
-
import { readFileSync, realpathSync, statSync } from "node:fs";
|
|
26
|
-
import { dirname, extname, isAbsolute, relative, resolve } from "node:path";
|
|
147
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
148
|
+
import { readFileSync as readFileSync2, realpathSync as realpathSync2, statSync } from "node:fs";
|
|
149
|
+
import { dirname as dirname2, extname, isAbsolute, relative, resolve as resolve2 } from "node:path";
|
|
27
150
|
import { Script } from "node:vm";
|
|
28
151
|
|
|
29
152
|
// node_modules/entities/dist/escape.js
|
|
@@ -209,13 +332,13 @@ function element(name, value) {
|
|
|
209
332
|
function resolveLocalDocumentFile(root, path, from = root) {
|
|
210
333
|
if (typeof path !== "string" || !path || /^(?:[a-z][a-z\d+.-]*:|\/|\\)/iu.test(path))
|
|
211
334
|
throw new Error(`Expected a local relative asset: ${path}`);
|
|
212
|
-
const candidate =
|
|
335
|
+
const candidate = resolve2(from, path);
|
|
213
336
|
const inside = (file) => {
|
|
214
337
|
const r = relative(root, file);
|
|
215
338
|
return r !== ".." && !r.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) && !isAbsolute(r);
|
|
216
339
|
};
|
|
217
340
|
if (!inside(candidate)) throw new Error(`Asset escapes design root: ${path}`);
|
|
218
|
-
const actual =
|
|
341
|
+
const actual = realpathSync2(candidate);
|
|
219
342
|
if (!inside(actual) || !statSync(actual).isFile())
|
|
220
343
|
throw new Error(`Asset is not a contained regular file: ${path}`);
|
|
221
344
|
return actual;
|
|
@@ -229,7 +352,7 @@ function bundleLocalDocument({
|
|
|
229
352
|
readSource,
|
|
230
353
|
passive = false
|
|
231
354
|
}) {
|
|
232
|
-
const root =
|
|
355
|
+
const root = realpathSync2(inputRoot);
|
|
233
356
|
const files = /* @__PURE__ */ new Map();
|
|
234
357
|
const mediaStack = /* @__PURE__ */ new Set();
|
|
235
358
|
let svgDepth = 0;
|
|
@@ -240,7 +363,7 @@ function bundleLocalDocument({
|
|
|
240
363
|
const checked = readSource?.(path, from);
|
|
241
364
|
const file = checked?.file ?? resolveLocalDocumentFile(root, path, from);
|
|
242
365
|
if (!files.has(file)) {
|
|
243
|
-
const value = checked?.value ??
|
|
366
|
+
const value = checked?.value ?? readFileSync2(file);
|
|
244
367
|
bytes += value.length;
|
|
245
368
|
if (bytes > maxBytes || files.size >= 1e3)
|
|
246
369
|
throw new Error("Design source exceeds the local asset budget.");
|
|
@@ -269,7 +392,7 @@ function bundleLocalDocument({
|
|
|
269
392
|
throw new Error("Circular or excessively nested SVG media cannot be published.");
|
|
270
393
|
mediaStack.add(file);
|
|
271
394
|
try {
|
|
272
|
-
payload = Buffer.from(passiveSvg(value.toString("utf8"),
|
|
395
|
+
payload = Buffer.from(passiveSvg(value.toString("utf8"), dirname2(file)));
|
|
273
396
|
} finally {
|
|
274
397
|
mediaStack.delete(file);
|
|
275
398
|
}
|
|
@@ -332,7 +455,7 @@ function bundleLocalDocument({
|
|
|
332
455
|
if (stack.has(next.file)) throw new Error(`Circular stylesheet import: ${ref}`);
|
|
333
456
|
const expanded = css(
|
|
334
457
|
next.value.toString("utf8"),
|
|
335
|
-
|
|
458
|
+
dirname2(next.file),
|
|
336
459
|
/* @__PURE__ */ new Set([...stack, next.file])
|
|
337
460
|
);
|
|
338
461
|
return media.trim() ? `@media ${media.trim()}{${expanded}}` : expanded;
|
|
@@ -371,21 +494,21 @@ function bundleLocalDocument({
|
|
|
371
494
|
);
|
|
372
495
|
if (node.tagName === "meta" && attr(node, "http-equiv")?.value.toLowerCase() === "refresh")
|
|
373
496
|
throw new Error("Design screens cannot redirect.");
|
|
374
|
-
if (node.tagName === "style") setText(node, css(text(node),
|
|
497
|
+
if (node.tagName === "style") setText(node, css(text(node), dirname2(input.file)));
|
|
375
498
|
if (node.tagName === "link" && attr(node, "rel")?.value.toLowerCase().split(/\s+/u).includes("stylesheet")) {
|
|
376
|
-
const linked = read(attr(node, "href")?.value,
|
|
499
|
+
const linked = read(attr(node, "href")?.value, dirname2(input.file));
|
|
377
500
|
node.tagName = "style";
|
|
378
501
|
node.nodeName = "style";
|
|
379
502
|
node.attrs = [];
|
|
380
503
|
setText(
|
|
381
504
|
node,
|
|
382
|
-
css(linked.value.toString("utf8"),
|
|
505
|
+
css(linked.value.toString("utf8"), dirname2(linked.file), /* @__PURE__ */ new Set([linked.file]))
|
|
383
506
|
);
|
|
384
507
|
}
|
|
385
508
|
if (node.tagName === "script") {
|
|
386
509
|
const src = attr(node, "src");
|
|
387
510
|
if (passive) {
|
|
388
|
-
if (src) read(src.value,
|
|
511
|
+
if (src) read(src.value, dirname2(input.file));
|
|
389
512
|
node.parentNode.childNodes = node.parentNode.childNodes.filter((child) => child !== node);
|
|
390
513
|
continue;
|
|
391
514
|
}
|
|
@@ -393,7 +516,7 @@ function bundleLocalDocument({
|
|
|
393
516
|
if (type === "module")
|
|
394
517
|
throw new Error("Compile module scripts before using them in a portable design.");
|
|
395
518
|
if (!type || /(?:javascript|ecmascript)/u.test(type)) {
|
|
396
|
-
const linked = src ? read(src.value,
|
|
519
|
+
const linked = src ? read(src.value, dirname2(input.file)) : null;
|
|
397
520
|
setText(
|
|
398
521
|
node,
|
|
399
522
|
js(linked ? linked.value.toString("utf8") : text(node), linked?.file ?? input.file)
|
|
@@ -409,16 +532,16 @@ function bundleLocalDocument({
|
|
|
409
532
|
}
|
|
410
533
|
if (passive) node.attrs = (node.attrs ?? []).filter((item2) => !/^on/iu.test(item2.name));
|
|
411
534
|
for (const item2 of node.attrs ?? []) {
|
|
412
|
-
if (item2.name === "style") item2.value = css(item2.value,
|
|
535
|
+
if (item2.name === "style") item2.value = css(item2.value, dirname2(input.file));
|
|
413
536
|
if (["src", "poster"].includes(item2.name))
|
|
414
|
-
item2.value = asset(item2.value,
|
|
537
|
+
item2.value = asset(item2.value, dirname2(input.file));
|
|
415
538
|
if (item2.name === "srcset")
|
|
416
539
|
throw new Error("Use a local src and responsive CSS for portable design images.");
|
|
417
540
|
if (["action", "formaction", "target", "formtarget"].includes(item2.name) && item2.value.trim())
|
|
418
541
|
throw new Error("Design forms must use local submit handlers without navigation targets.");
|
|
419
542
|
if (item2.name === "href" && !item2.value.startsWith("#")) {
|
|
420
543
|
if (node.tagName === "link" || node.namespaceURI === "http://www.w3.org/2000/svg")
|
|
421
|
-
item2.value = asset(item2.value,
|
|
544
|
+
item2.value = asset(item2.value, dirname2(input.file));
|
|
422
545
|
else if (node.tagName === "a")
|
|
423
546
|
throw new Error('Use data-design-navigate="screen-id" for prototype navigation.');
|
|
424
547
|
}
|
|
@@ -431,7 +554,7 @@ function bundleLocalDocument({
|
|
|
431
554
|
prepend.push(
|
|
432
555
|
element(
|
|
433
556
|
"style",
|
|
434
|
-
css(linked.value.toString("utf8"),
|
|
557
|
+
css(linked.value.toString("utf8"), dirname2(linked.file), /* @__PURE__ */ new Set([linked.file]))
|
|
435
558
|
)
|
|
436
559
|
);
|
|
437
560
|
}
|
|
@@ -458,7 +581,7 @@ function bundleLocalDocument({
|
|
|
458
581
|
sourceDigests: Object.fromEntries(
|
|
459
582
|
[...files].map(([path, value]) => [
|
|
460
583
|
relative(root, path),
|
|
461
|
-
|
|
584
|
+
createHash2("sha256").update(value).digest("hex")
|
|
462
585
|
])
|
|
463
586
|
),
|
|
464
587
|
inputBytes: bytes,
|
|
@@ -706,10 +829,10 @@ var REVIEW_EXPERIENCE_SCHEMAS = Object.freeze({
|
|
|
706
829
|
});
|
|
707
830
|
|
|
708
831
|
// packages/design/lib/design/context.mjs
|
|
709
|
-
import { createHash as
|
|
710
|
-
import { existsSync, readdirSync, readFileSync as
|
|
711
|
-
import { dirname as
|
|
712
|
-
var reviewDigest = (value) =>
|
|
832
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
833
|
+
import { existsSync, readdirSync, readFileSync as readFileSync3, realpathSync as realpathSync3 } from "node:fs";
|
|
834
|
+
import { dirname as dirname3, join as join2, resolve as resolve3 } from "node:path";
|
|
835
|
+
var reviewDigest = (value) => createHash3("sha256").update(canonicalizeJson(value)).digest("hex");
|
|
713
836
|
function emptyReviewContext(document) {
|
|
714
837
|
return {
|
|
715
838
|
kind: "openplanr-design-review-context",
|
|
@@ -720,10 +843,10 @@ function emptyReviewContext(document) {
|
|
|
720
843
|
};
|
|
721
844
|
}
|
|
722
845
|
function loadReviewContext(root, document, { readSource } = {}) {
|
|
723
|
-
const file =
|
|
846
|
+
const file = join2(root, "review-context.json");
|
|
724
847
|
if (!existsSync(file)) return emptyReviewContext(document);
|
|
725
848
|
const context = JSON.parse(
|
|
726
|
-
readSource ? readSource("review-context.json", root).value.toString("utf8") :
|
|
849
|
+
readSource ? readSource("review-context.json", root).value.toString("utf8") : readFileSync3(resolveLocalDocumentFile(root, "review-context.json"), "utf8")
|
|
727
850
|
);
|
|
728
851
|
assertReviewExperience(context, DESIGN_REVIEW_CONTEXT_SCHEMA);
|
|
729
852
|
if (context.designId !== document.id)
|
|
@@ -807,13 +930,13 @@ function bundleDesignRevision(current, state = {}) {
|
|
|
807
930
|
fingerprints: current.fingerprints ?? []
|
|
808
931
|
};
|
|
809
932
|
}
|
|
810
|
-
var localRoot = (file) =>
|
|
933
|
+
var localRoot = (file) => realpathSync3(dirname3(resolve3(file)));
|
|
811
934
|
function listDesignRevisions(file) {
|
|
812
935
|
const root = localRoot(file);
|
|
813
|
-
const pointer = JSON.parse(
|
|
814
|
-
const revisions = readdirSync(
|
|
936
|
+
const pointer = JSON.parse(readFileSync3(join2(root, ".design/current.json"), "utf8"));
|
|
937
|
+
const revisions = readdirSync(join2(root, ".design/revisions")).filter((name) => /^[a-f0-9]{64}$/u.test(name)).map((revision) => {
|
|
815
938
|
const value = JSON.parse(
|
|
816
|
-
|
|
939
|
+
readFileSync3(join2(root, ".design/revisions", revision, "render.json"), "utf8")
|
|
817
940
|
);
|
|
818
941
|
return {
|
|
819
942
|
revision,
|
|
@@ -828,7 +951,7 @@ function readDesignRevision(file, revision) {
|
|
|
828
951
|
if (!/^[a-f0-9]{64}$/u.test(revision)) throw new Error("Invalid design revision identity.");
|
|
829
952
|
const root = localRoot(file);
|
|
830
953
|
const value = JSON.parse(
|
|
831
|
-
|
|
954
|
+
readFileSync3(
|
|
832
955
|
resolveLocalDocumentFile(root, `.design/revisions/${revision}/render.json`),
|
|
833
956
|
"utf8"
|
|
834
957
|
)
|
|
@@ -836,127 +959,6 @@ function readDesignRevision(file, revision) {
|
|
|
836
959
|
return bundleDesignRevision(value);
|
|
837
960
|
}
|
|
838
961
|
|
|
839
|
-
// packages/design/lib/design/document-state.mjs
|
|
840
|
-
import { createHash as createHash3, randomUUID } from "node:crypto";
|
|
841
|
-
import {
|
|
842
|
-
closeSync,
|
|
843
|
-
lstatSync,
|
|
844
|
-
mkdirSync,
|
|
845
|
-
openSync,
|
|
846
|
-
readFileSync as readFileSync3,
|
|
847
|
-
realpathSync as realpathSync3,
|
|
848
|
-
renameSync,
|
|
849
|
-
rmSync,
|
|
850
|
-
writeFileSync
|
|
851
|
-
} from "node:fs";
|
|
852
|
-
import { dirname as dirname3, join as join2, resolve as resolve3 } from "node:path";
|
|
853
|
-
var hash = (value) => createHash3("sha256").update(value).digest("hex");
|
|
854
|
-
var json = (value) => `${JSON.stringify(value, null, 2)}
|
|
855
|
-
`;
|
|
856
|
-
function readJson(path, fallback = void 0) {
|
|
857
|
-
try {
|
|
858
|
-
return JSON.parse(readFileSync3(path, "utf8"));
|
|
859
|
-
} catch (error) {
|
|
860
|
-
if (error.code === "ENOENT" && fallback !== void 0) return fallback;
|
|
861
|
-
throw error;
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
function atomicJson(path, value) {
|
|
865
|
-
atomicBytes(path, json(value));
|
|
866
|
-
}
|
|
867
|
-
function atomicBytes(path, bytes) {
|
|
868
|
-
mkdirSync(dirname3(path), { recursive: true });
|
|
869
|
-
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
870
|
-
try {
|
|
871
|
-
writeFileSync(temporary, bytes, { mode: 384, flag: "wx" });
|
|
872
|
-
renameSync(temporary, path);
|
|
873
|
-
} finally {
|
|
874
|
-
rmSync(temporary, { force: true });
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
function recoverDesignPublication(root, { ownsRenderLock = false } = {}) {
|
|
878
|
-
const journalPath = join2(root, ".design/publication.json");
|
|
879
|
-
let journal = readJson(journalPath, null);
|
|
880
|
-
if (!journal) return;
|
|
881
|
-
const lockPath = join2(root, ".design/render.lock");
|
|
882
|
-
let recoveryOwner;
|
|
883
|
-
if (!ownsRenderLock) {
|
|
884
|
-
const lock = readJson(lockPath, null);
|
|
885
|
-
if (lock && isProcessAlive(lock.pid)) return;
|
|
886
|
-
if (lock) rmSync(lockPath, { force: true });
|
|
887
|
-
recoveryOwner = randomUUID();
|
|
888
|
-
let descriptor;
|
|
889
|
-
try {
|
|
890
|
-
descriptor = openSync(lockPath, "wx", 384);
|
|
891
|
-
writeFileSync(
|
|
892
|
-
descriptor,
|
|
893
|
-
json({ pid: process.pid, owner: recoveryOwner, createdAt: Date.now() })
|
|
894
|
-
);
|
|
895
|
-
} catch (error) {
|
|
896
|
-
if (error.code === "EEXIST") return;
|
|
897
|
-
throw error;
|
|
898
|
-
} finally {
|
|
899
|
-
if (descriptor !== void 0) closeSync(descriptor);
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
try {
|
|
903
|
-
journal = readJson(journalPath, null);
|
|
904
|
-
if (!journal) return;
|
|
905
|
-
const pointer = readJson(join2(root, ".design/current.json"), null);
|
|
906
|
-
const manifestPath = join2(root, "finalized.json");
|
|
907
|
-
if (pointer?.revision === journal.revision) atomicJson(manifestPath, journal.manifest);
|
|
908
|
-
else if ((pointer?.revision ?? null) === journal.previousRevision) {
|
|
909
|
-
if (journal.previousManifest === null) rmSync(manifestPath, { force: true });
|
|
910
|
-
else atomicBytes(manifestPath, Buffer.from(journal.previousManifest, "base64"));
|
|
911
|
-
} else if (pointer?.revision && /^[a-f0-9]{64}$/u.test(pointer.revision)) {
|
|
912
|
-
atomicJson(
|
|
913
|
-
manifestPath,
|
|
914
|
-
readJson(join2(root, ".design/revisions", pointer.revision, "render.json")).manifest
|
|
915
|
-
);
|
|
916
|
-
} else
|
|
917
|
-
throw new Error("Design publication recovery could not identify the committed revision.");
|
|
918
|
-
rmSync(journalPath, { force: true });
|
|
919
|
-
} finally {
|
|
920
|
-
if (recoveryOwner && readJson(lockPath, null)?.owner === recoveryOwner)
|
|
921
|
-
rmSync(lockPath, { force: true });
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
function designSpecPath(root) {
|
|
925
|
-
return /(?:^|\/)output\/feats\/feat-[^/]+\/design$/u.test(root.replaceAll("\\", "/")) ? join2(dirname3(root), "design-spec.md") : join2(root, "design-spec.md");
|
|
926
|
-
}
|
|
927
|
-
function currentDesign(file, { recoverPublication = true } = {}) {
|
|
928
|
-
const root = realpathSync3(dirname3(resolve3(file)));
|
|
929
|
-
if (recoverPublication) recoverDesignPublication(root);
|
|
930
|
-
else {
|
|
931
|
-
try {
|
|
932
|
-
lstatSync(join2(root, ".design/publication.json"));
|
|
933
|
-
throw Object.assign(
|
|
934
|
-
new Error(
|
|
935
|
-
"Design publication state is pending or needs recovery. Finish or recover it with the Design utility; repair or restore an invalid .design/publication.json before retrying Plan handoff inspection."
|
|
936
|
-
),
|
|
937
|
-
{ code: "E_DESIGN_PUBLICATION_PENDING", statusCode: 409 }
|
|
938
|
-
);
|
|
939
|
-
} catch (error) {
|
|
940
|
-
if (error.code !== "ENOENT") throw error;
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
const pointer = readJson(join2(root, ".design/current.json"), null);
|
|
944
|
-
if (!pointer || !/^[a-f0-9]{64}$/u.test(pointer.revision))
|
|
945
|
-
throw new Error("Design has no completed render. Run the render utility first.");
|
|
946
|
-
const directory = join2(root, ".design/revisions", pointer.revision);
|
|
947
|
-
const prepared = readJson(join2(directory, "render.json"));
|
|
948
|
-
return {
|
|
949
|
-
...prepared,
|
|
950
|
-
root,
|
|
951
|
-
directory,
|
|
952
|
-
file: resolve3(file),
|
|
953
|
-
verification: readJson(join2(root, ".design/verification", `${pointer.revision}.json`), {
|
|
954
|
-
status: "unverified",
|
|
955
|
-
revision: pointer.revision
|
|
956
|
-
})
|
|
957
|
-
};
|
|
958
|
-
}
|
|
959
|
-
|
|
960
962
|
export {
|
|
961
963
|
serialize,
|
|
962
964
|
parse,
|