openplanr 3.3.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.
- package/CHANGELOG.md +52 -0
- package/dist/cli/commands/artifact-design-share.d.ts +9 -0
- package/dist/cli/commands/artifact-design-share.d.ts.map +1 -0
- package/dist/cli/commands/artifact-design-share.js +200 -0
- package/dist/cli/commands/artifact-design-share.js.map +1 -0
- package/dist/cli/commands/artifact.d.ts.map +1 -1
- package/dist/cli/commands/artifact.js +5 -18
- package/dist/cli/commands/artifact.js.map +1 -1
- package/dist/cli/commands/ship.d.ts.map +1 -1
- package/dist/cli/commands/ship.js +2 -0
- package/dist/cli/commands/ship.js.map +1 -1
- package/dist/dashboard/.vite/manifest.json +2 -2
- package/dist/dashboard/assets/index-Cv4Vwhuw.css +2 -0
- package/dist/dashboard/assets/index-CvQAlBy3.js +75 -0
- package/dist/dashboard/assets/index-CvQAlBy3.js.map +1 -0
- package/dist/dashboard/dashboard-manifest.json +14 -14
- package/dist/dashboard/index.html +2 -2
- package/dist/services/design-artifact-service.d.ts +20 -1
- package/dist/services/design-artifact-service.d.ts.map +1 -1
- package/dist/services/design-artifact-service.js +137 -18
- package/dist/services/design-artifact-service.js.map +1 -1
- package/dist/services/ship-checks/contract.d.ts +3 -1
- package/dist/services/ship-checks/contract.d.ts.map +1 -1
- package/dist/services/ship-checks/contract.js +1 -1
- package/dist/services/ship-checks/contract.js.map +1 -1
- package/dist/services/ship-checks/discover.d.ts.map +1 -1
- package/dist/services/ship-checks/discover.js +2 -1
- package/dist/services/ship-checks/discover.js.map +1 -1
- package/dist/services/ship-checks/package-contents.d.ts +4 -0
- package/dist/services/ship-checks/package-contents.d.ts.map +1 -0
- package/dist/services/ship-checks/package-contents.js +91 -0
- package/dist/services/ship-checks/package-contents.js.map +1 -0
- package/dist/services/ship-checks/packages.d.ts +2 -0
- package/dist/services/ship-checks/packages.d.ts.map +1 -1
- package/dist/services/ship-checks/packages.js +4 -0
- package/dist/services/ship-checks/packages.js.map +1 -1
- package/dist/services/ship-checks/scope.js +2 -1
- package/dist/services/ship-checks/scope.js.map +1 -1
- package/dist/utils/splice-managed-block.js +1 -1
- package/dist/utils/splice-managed-block.js.map +1 -1
- package/docs/CLI.md +38 -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 +3 -3
- package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +6 -6
- package/lib/host-packages/claude/openplanr/.openplanr-content.json +67 -123
- package/lib/host-packages/claude/openplanr/README.md +12 -12
- package/lib/host-packages/claude/openplanr/references/agents/shared/modes/shared/task-context-resolution.md +4 -4
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-artifact-shell.mjs +2 -4
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-document.mjs +26 -26
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-handoff.mjs +850 -56
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review-state-store.mjs +45 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review.mjs +65 -74
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -1
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +321 -0
- package/lib/host-packages/{openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs → claude/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs} +762 -223
- 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
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +137 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design.mjs +107 -37
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -27
- 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
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +1 -5684
- 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
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +10 -74
- 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/share.js +8 -2
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +545 -4781
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design.mjs +219 -452
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/claude/openplanr/skills/delegate/SKILL.md +2 -1
- package/lib/host-packages/claude/openplanr/skills/delegate/references/integration-review.md +26 -20
- package/lib/host-packages/claude/openplanr/skills/delegate/references/operator-guide.md +25 -1
- package/lib/host-packages/claude/openplanr/skills/delegate/references/run-handoff.md +2 -2
- package/lib/host-packages/claude/openplanr/skills/delegate/references/worktree-custody.md +17 -9
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/claude.mjs +15 -3
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/codex.mjs +38 -2
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/native.mjs +5 -0
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/custody.mjs +217 -10
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/handoff.mjs +1080 -0
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integrate.mjs +96 -201
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integration-files.mjs +3 -382
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/presentation.mjs +29 -12
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-contract.mjs +11 -0
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-execution.mjs +1 -1
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-lifecycle.mjs +14 -10
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-preparation.mjs +4 -0
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-record.mjs +2 -2
- package/lib/host-packages/claude/openplanr/skills/design/references/utilities.md +14 -8
- package/lib/host-packages/claude/openplanr/skills/design-loop/references/utilities.md +14 -8
- package/lib/host-packages/claude/openplanr/skills/design-review/references/utilities.md +14 -8
- package/lib/host-packages/claude/openplanr/skills/investigate/SKILL.md +1 -0
- package/lib/host-packages/claude/openplanr/skills/investigate/references/fail-first.md +40 -0
- package/lib/host-packages/claude/openplanr/skills/ship/SKILL.md +22 -10
- package/lib/host-packages/claude/openplanr/skills/ship/references/fail-first.md +40 -0
- package/lib/host-packages/claude/openplanr/skills/ship/references/result-contract.md +7 -3
- package/lib/host-packages/cursor/openplanr/.openplanr-content.json +65 -121
- package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/integration-review.md +26 -20
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/operator-guide.md +25 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/run-handoff.md +2 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/worktree-custody.md +17 -9
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/claude.mjs +15 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/codex.mjs +38 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/native.mjs +5 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/custody.mjs +217 -10
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/handoff.mjs +1080 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integrate.mjs +96 -201
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integration-files.mjs +3 -382
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/presentation.mjs +29 -12
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-contract.mjs +11 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-execution.mjs +1 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-lifecycle.mjs +14 -10
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-preparation.mjs +4 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-record.mjs +2 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate.mdc +2 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-design/references/utilities.md +14 -8
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/utilities.md +14 -8
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/utilities.md +14 -8
- package/lib/host-packages/cursor/openplanr/rules/planr-investigate/references/fail-first.md +40 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-investigate.mdc +1 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/fail-first.md +40 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/result-contract.md +7 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-ship.mdc +22 -10
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-artifact-shell.mjs +2 -4
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-document.mjs +26 -26
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-handoff.mjs +850 -56
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review-state-store.mjs +45 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review.mjs +65 -74
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -1
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +321 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/{design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs → design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs} +762 -223
- 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
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +137 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design.mjs +107 -37
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -27
- 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
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +1 -5684
- 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
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +10 -74
- 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/share.js +8 -2
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +545 -4781
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design.mjs +219 -452
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/openai/.claude-plugin/marketplace.json +3 -3
- package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +2 -2
- package/lib/host-packages/openai/openplanr/.openplanr-content.json +68 -124
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-artifact-shell.mjs +2 -4
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-document.mjs +26 -26
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-handoff.mjs +850 -56
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review-state-store.mjs +45 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review.mjs +65 -74
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -1
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +321 -0
- package/lib/host-packages/{claude/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs → openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs} +762 -223
- 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
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +137 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design.mjs +107 -37
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -27
- 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
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +1 -5684
- 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
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +10 -74
- 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/share.js +8 -2
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +545 -4781
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design.mjs +219 -452
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/openai/openplanr/skills/delegate/SKILL.md +2 -1
- package/lib/host-packages/openai/openplanr/skills/delegate/openplanr.skill.json +1 -1
- package/lib/host-packages/openai/openplanr/skills/delegate/references/integration-review.md +26 -20
- package/lib/host-packages/openai/openplanr/skills/delegate/references/operator-guide.md +25 -1
- package/lib/host-packages/openai/openplanr/skills/delegate/references/run-handoff.md +2 -2
- package/lib/host-packages/openai/openplanr/skills/delegate/references/worktree-custody.md +17 -9
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/claude.mjs +15 -3
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/codex.mjs +38 -2
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/native.mjs +5 -0
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/custody.mjs +217 -10
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/handoff.mjs +1080 -0
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integrate.mjs +96 -201
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integration-files.mjs +3 -382
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/presentation.mjs +29 -12
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-contract.mjs +11 -0
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-execution.mjs +1 -1
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-lifecycle.mjs +14 -10
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-preparation.mjs +4 -0
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-record.mjs +2 -2
- package/lib/host-packages/openai/openplanr/skills/design/references/utilities.md +14 -8
- package/lib/host-packages/openai/openplanr/skills/design-loop/references/utilities.md +14 -8
- package/lib/host-packages/openai/openplanr/skills/design-review/references/utilities.md +14 -8
- package/lib/host-packages/openai/openplanr/skills/investigate/SKILL.md +1 -0
- package/lib/host-packages/openai/openplanr/skills/investigate/openplanr.skill.json +12 -1
- package/lib/host-packages/openai/openplanr/skills/investigate/references/fail-first.md +40 -0
- package/lib/host-packages/openai/openplanr/skills/ship/SKILL.md +22 -10
- package/lib/host-packages/openai/openplanr/skills/ship/openplanr.skill.json +12 -1
- package/lib/host-packages/openai/openplanr/skills/ship/references/fail-first.md +40 -0
- package/lib/host-packages/openai/openplanr/skills/ship/references/result-contract.md +7 -3
- package/package.json +8 -8
- package/dist/dashboard/assets/index-BU5fzjyz.css +0 -1
- package/dist/dashboard/assets/index-B_96uzCl.js +0 -572
- package/dist/dashboard/assets/index-B_96uzCl.js.map +0 -1
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
- 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
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
- 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
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integration-transaction.mjs +0 -958
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integration-transaction.mjs +0 -958
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
- 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
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
- 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
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
- 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
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
- 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
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integration-transaction.mjs +0 -958
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LARGE_OBJECT_LIMITS,
|
|
3
|
-
validateJson
|
|
4
|
-
} from "./design-shared-protocol-contracts-b5f28f94.mjs";
|
|
5
|
-
|
|
6
1
|
// packages/protocol/src/errors.mjs
|
|
7
2
|
var ARTIFACT_ERROR_CODES = Object.freeze({
|
|
8
3
|
INPUT_INVALID: "E_ARTIFACT_INPUT_INVALID",
|
|
@@ -116,11 +111,547 @@ function resolveArtifactHtml(envelope, artifactOrId) {
|
|
|
116
111
|
// packages/artifact/lib/artifact/envelope.mjs
|
|
117
112
|
import { createHash } from "node:crypto";
|
|
118
113
|
|
|
114
|
+
// packages/protocol/src/large-object-limits.mjs
|
|
115
|
+
var LARGE_OBJECT_LIMITS = Object.freeze({
|
|
116
|
+
uniqueHtmlBytes: 100 * 1024 * 1024,
|
|
117
|
+
decodedBytes: 128 * 1024 * 1024,
|
|
118
|
+
catalogBytes: 8 * 1024 * 1024,
|
|
119
|
+
manifestBytes: 64 * 1024,
|
|
120
|
+
chunkBytes: 1024 * 1024,
|
|
121
|
+
chunkPlaintextBytes: 1024 * 1024 - 16,
|
|
122
|
+
chunks: 129,
|
|
123
|
+
ciphertextBytes: 128 * 1024 * 1024 + 129 * 16,
|
|
124
|
+
sources: 256,
|
|
125
|
+
views: 4096,
|
|
126
|
+
resources: 1024,
|
|
127
|
+
eventBytes: 256 * 1024,
|
|
128
|
+
eventPageBytes: 1024 * 1024,
|
|
129
|
+
eventPageCount: 100
|
|
130
|
+
});
|
|
131
|
+
|
|
119
132
|
// packages/artifact/lib/artifact/internal/schema-loader.mjs
|
|
120
133
|
import { fileURLToPath as __planrAssetFile } from "node:url";
|
|
121
134
|
import { readFileSync } from "node:fs";
|
|
122
135
|
import { createRequire } from "node:module";
|
|
123
136
|
import { dirname, join } from "node:path";
|
|
137
|
+
|
|
138
|
+
// packages/protocol/src/json-schema.mjs
|
|
139
|
+
var typeOf = (v) => {
|
|
140
|
+
if (v === null) return "null";
|
|
141
|
+
if (Array.isArray(v)) return "array";
|
|
142
|
+
if (Number.isInteger(v)) return "integer";
|
|
143
|
+
if (typeof v === "number") return "number";
|
|
144
|
+
return typeof v;
|
|
145
|
+
};
|
|
146
|
+
var matchesType = (v, t) => {
|
|
147
|
+
if (t === "integer") return Number.isInteger(v);
|
|
148
|
+
if (t === "number") return typeof v === "number";
|
|
149
|
+
if (t === "string") return typeof v === "string";
|
|
150
|
+
if (t === "boolean") return typeof v === "boolean";
|
|
151
|
+
if (t === "null") return v === null;
|
|
152
|
+
if (t === "array") return Array.isArray(v);
|
|
153
|
+
if (t === "object") return v !== null && typeof v === "object" && !Array.isArray(v);
|
|
154
|
+
return false;
|
|
155
|
+
};
|
|
156
|
+
var FORMAT_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
157
|
+
var FORMAT_DATETIME = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
158
|
+
var SUPPORTED_FORMATS = /* @__PURE__ */ new Set(["date", "date-time"]);
|
|
159
|
+
var ANNOTATION_KEYWORDS = [
|
|
160
|
+
"$schema",
|
|
161
|
+
"$id",
|
|
162
|
+
"$defs",
|
|
163
|
+
"$comment",
|
|
164
|
+
"title",
|
|
165
|
+
"description",
|
|
166
|
+
"default",
|
|
167
|
+
"examples",
|
|
168
|
+
"deprecated",
|
|
169
|
+
"readOnly",
|
|
170
|
+
"writeOnly"
|
|
171
|
+
];
|
|
172
|
+
var VALIDATION_KEYWORDS = [
|
|
173
|
+
"$ref",
|
|
174
|
+
"type",
|
|
175
|
+
"const",
|
|
176
|
+
"enum",
|
|
177
|
+
"minLength",
|
|
178
|
+
"maxLength",
|
|
179
|
+
"pattern",
|
|
180
|
+
"format",
|
|
181
|
+
"minimum",
|
|
182
|
+
"maximum",
|
|
183
|
+
"exclusiveMinimum",
|
|
184
|
+
"minItems",
|
|
185
|
+
"maxItems",
|
|
186
|
+
"prefixItems",
|
|
187
|
+
"items",
|
|
188
|
+
"uniqueItems",
|
|
189
|
+
"contains",
|
|
190
|
+
"minContains",
|
|
191
|
+
"maxContains",
|
|
192
|
+
"required",
|
|
193
|
+
"properties",
|
|
194
|
+
"propertyNames",
|
|
195
|
+
"additionalProperties",
|
|
196
|
+
"maxProperties",
|
|
197
|
+
"dependentRequired",
|
|
198
|
+
"unevaluatedProperties",
|
|
199
|
+
"oneOf",
|
|
200
|
+
"anyOf",
|
|
201
|
+
"allOf",
|
|
202
|
+
"if",
|
|
203
|
+
"then",
|
|
204
|
+
"else",
|
|
205
|
+
"not"
|
|
206
|
+
];
|
|
207
|
+
var KNOWN_KEYWORDS = /* @__PURE__ */ new Set([...ANNOTATION_KEYWORDS, ...VALIDATION_KEYWORDS]);
|
|
208
|
+
var TYPE_NAMES = /* @__PURE__ */ new Set(["array", "boolean", "integer", "null", "number", "object", "string"]);
|
|
209
|
+
var isSchema = (value) => typeof value === "boolean" || value !== null && typeof value === "object" && !Array.isArray(value);
|
|
210
|
+
var isPlainObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
211
|
+
var isCount = (value) => Number.isSafeInteger(value) && value >= 0;
|
|
212
|
+
var isUniqueStrings = (value) => Array.isArray(value) && value.every((item) => typeof item === "string") && new Set(value).size === value.length;
|
|
213
|
+
var isSchemaArray = (value) => Array.isArray(value) && value.length > 0 && value.every(isSchema);
|
|
214
|
+
var isSchemaMap = (value) => isPlainObject(value) && Object.values(value).every(isSchema);
|
|
215
|
+
var compiledPatterns = /* @__PURE__ */ new Map();
|
|
216
|
+
var MAX_COMPILED_PATTERNS = 1024;
|
|
217
|
+
var tryCompilePattern = (source) => {
|
|
218
|
+
try {
|
|
219
|
+
return new RegExp(source);
|
|
220
|
+
} catch (error) {
|
|
221
|
+
if (error instanceof SyntaxError) return null;
|
|
222
|
+
throw error;
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
var compilePattern = (source) => {
|
|
226
|
+
if (!compiledPatterns.has(source)) {
|
|
227
|
+
if (compiledPatterns.size >= MAX_COMPILED_PATTERNS) compiledPatterns.clear();
|
|
228
|
+
compiledPatterns.set(source, tryCompilePattern(source));
|
|
229
|
+
}
|
|
230
|
+
return compiledPatterns.get(source) ?? null;
|
|
231
|
+
};
|
|
232
|
+
var describeValue = (value) => {
|
|
233
|
+
const text = String(JSON.stringify(value));
|
|
234
|
+
return text.length > 80 ? `${text.slice(0, 77)}...` : text;
|
|
235
|
+
};
|
|
236
|
+
var KEYWORD_SHAPES = {
|
|
237
|
+
$ref: ["a string", (value) => typeof value === "string"],
|
|
238
|
+
$defs: ["an object of schemas", isSchemaMap],
|
|
239
|
+
type: [
|
|
240
|
+
"a type name or a non-empty array of unique type names",
|
|
241
|
+
(value) => typeof value === "string" && TYPE_NAMES.has(value) || isUniqueStrings(value) && value.length > 0 && value.every((name) => TYPE_NAMES.has(name))
|
|
242
|
+
],
|
|
243
|
+
enum: ["an array", Array.isArray],
|
|
244
|
+
minLength: ["a non-negative integer", isCount],
|
|
245
|
+
maxLength: ["a non-negative integer", isCount],
|
|
246
|
+
pattern: [
|
|
247
|
+
"a valid regular expression string",
|
|
248
|
+
(value) => typeof value === "string" && compilePattern(value) !== null
|
|
249
|
+
],
|
|
250
|
+
minimum: ["a finite number", Number.isFinite],
|
|
251
|
+
maximum: ["a finite number", Number.isFinite],
|
|
252
|
+
exclusiveMinimum: ["a finite number", Number.isFinite],
|
|
253
|
+
minItems: ["a non-negative integer", isCount],
|
|
254
|
+
maxItems: ["a non-negative integer", isCount],
|
|
255
|
+
prefixItems: ["a non-empty array of schemas", isSchemaArray],
|
|
256
|
+
items: ["a schema", isSchema],
|
|
257
|
+
uniqueItems: ["a boolean", (value) => typeof value === "boolean"],
|
|
258
|
+
contains: ["a schema", isSchema],
|
|
259
|
+
minContains: ["a non-negative integer", isCount],
|
|
260
|
+
maxContains: ["a non-negative integer", isCount],
|
|
261
|
+
required: ["an array of unique strings", isUniqueStrings],
|
|
262
|
+
properties: ["an object of schemas", isSchemaMap],
|
|
263
|
+
propertyNames: ["a schema", isSchema],
|
|
264
|
+
additionalProperties: ["a schema", isSchema],
|
|
265
|
+
maxProperties: ["a non-negative integer", isCount],
|
|
266
|
+
dependentRequired: [
|
|
267
|
+
"an object of unique string arrays",
|
|
268
|
+
(value) => isPlainObject(value) && Object.values(value).every(isUniqueStrings)
|
|
269
|
+
],
|
|
270
|
+
unevaluatedProperties: ["a schema", isSchema],
|
|
271
|
+
oneOf: ["a non-empty array of schemas", isSchemaArray],
|
|
272
|
+
anyOf: ["a non-empty array of schemas", isSchemaArray],
|
|
273
|
+
allOf: ["a non-empty array of schemas", isSchemaArray],
|
|
274
|
+
if: ["a schema", isSchema],
|
|
275
|
+
then: ["a schema", isSchema],
|
|
276
|
+
else: ["a schema", isSchema],
|
|
277
|
+
not: ["a schema", isSchema]
|
|
278
|
+
};
|
|
279
|
+
function resolveJsonPointer(root, reference) {
|
|
280
|
+
if (reference === "#") return root;
|
|
281
|
+
if (!reference.startsWith("#/")) return null;
|
|
282
|
+
return reference.slice(2).split("/").map((part) => part.replaceAll("~1", "/").replaceAll("~0", "~")).reduce((value, part) => value?.[part], root);
|
|
283
|
+
}
|
|
284
|
+
var wellFormedSchemas = /* @__PURE__ */ new WeakSet();
|
|
285
|
+
var isFrozenNode = (schema) => Object.isFrozen(schema) && Object.values(schema).every(Object.isFrozen) && (!isPlainObject(schema.dependentRequired) || Object.values(schema.dependentRequired).every(Object.isFrozen));
|
|
286
|
+
var checkSchemaNode = (schema, path, context) => {
|
|
287
|
+
if (wellFormedSchemas.has(schema) || context.checkedSchemas.has(schema)) return;
|
|
288
|
+
context.checkedSchemas.add(schema);
|
|
289
|
+
const errorCount = context.schemaErrors.length;
|
|
290
|
+
for (const keyword of Object.keys(schema)) {
|
|
291
|
+
if (!KNOWN_KEYWORDS.has(keyword) && !keyword.startsWith("x-")) {
|
|
292
|
+
context.schemaErrors.push({
|
|
293
|
+
path,
|
|
294
|
+
rule: "unsupported-keyword",
|
|
295
|
+
detail: `schema keyword '${keyword}' is not supported by this validator`
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (Object.hasOwn(schema, "format") && !SUPPORTED_FORMATS.has(schema.format)) {
|
|
300
|
+
context.schemaErrors.push({
|
|
301
|
+
path,
|
|
302
|
+
rule: "unsupported-format",
|
|
303
|
+
detail: `schema format ${JSON.stringify(schema.format)} is not supported by this validator`
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
for (const [keyword, [expected, isValid]] of Object.entries(KEYWORD_SHAPES)) {
|
|
307
|
+
if (Object.hasOwn(schema, keyword) && !isValid(schema[keyword])) {
|
|
308
|
+
context.schemaErrors.push({
|
|
309
|
+
path,
|
|
310
|
+
rule: "schema",
|
|
311
|
+
detail: `schema keyword '${keyword}' must be ${expected}, got ${describeValue(schema[keyword])}`
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (context.schemaErrors.length === errorCount && isFrozenNode(schema)) {
|
|
316
|
+
wellFormedSchemas.add(schema);
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
var reportReference = (schema, path, detail, context) => {
|
|
320
|
+
if (context.reportedReferences.has(schema)) return;
|
|
321
|
+
context.reportedReferences.add(schema);
|
|
322
|
+
context.schemaErrors.push({ path, rule: "$ref", detail });
|
|
323
|
+
};
|
|
324
|
+
var validateNode = (value, schema, path, errs, context) => {
|
|
325
|
+
const evaluated = /* @__PURE__ */ new Set();
|
|
326
|
+
if (schema === true) return evaluated;
|
|
327
|
+
if (schema === false) {
|
|
328
|
+
errs.push({ path, rule: "schema:false", detail: "value not allowed" });
|
|
329
|
+
return evaluated;
|
|
330
|
+
}
|
|
331
|
+
if (!isSchema(schema)) return evaluated;
|
|
332
|
+
checkSchemaNode(schema, path, context);
|
|
333
|
+
if (typeof schema?.$ref === "string") {
|
|
334
|
+
const reference = schema.$ref;
|
|
335
|
+
let resolved;
|
|
336
|
+
let nextRoot = context.rootSchema;
|
|
337
|
+
let resolvedBase = context.base;
|
|
338
|
+
if (reference.startsWith("#")) {
|
|
339
|
+
resolved = resolveJsonPointer(context.rootSchema, reference);
|
|
340
|
+
} else if (typeof context.resolveRef === "function") {
|
|
341
|
+
const result = context.resolveRef(reference, { base: context.base });
|
|
342
|
+
resolved = result?.schema ?? result;
|
|
343
|
+
nextRoot = result?.rootSchema ?? resolved;
|
|
344
|
+
resolvedBase = result?.base ?? resolved?.$id ?? context.base;
|
|
345
|
+
}
|
|
346
|
+
if (!isSchema(resolved)) {
|
|
347
|
+
const detail = resolved === void 0 || resolved === null ? `could not resolve schema reference ${reference}` : `schema reference ${reference} resolved to ${typeOf(resolved)}, not a schema`;
|
|
348
|
+
reportReference(schema, path, detail, context);
|
|
349
|
+
return evaluated;
|
|
350
|
+
}
|
|
351
|
+
const referenceKey = `${path} ${context.base ?? "<root>"}:${reference}`;
|
|
352
|
+
if (context.referenceStack.includes(referenceKey)) {
|
|
353
|
+
reportReference(schema, path, `circular schema reference ${reference}`, context);
|
|
354
|
+
return evaluated;
|
|
355
|
+
}
|
|
356
|
+
const referenced = validateNode(value, resolved, path, errs, {
|
|
357
|
+
...context,
|
|
358
|
+
rootSchema: nextRoot,
|
|
359
|
+
base: resolvedBase,
|
|
360
|
+
referenceStack: [...context.referenceStack, referenceKey]
|
|
361
|
+
});
|
|
362
|
+
for (const key of referenced) evaluated.add(key);
|
|
363
|
+
}
|
|
364
|
+
if (schema.type !== void 0) {
|
|
365
|
+
const types = Array.isArray(schema.type) ? schema.type : [schema.type];
|
|
366
|
+
if (!types.some((t) => matchesType(value, t))) {
|
|
367
|
+
errs.push({
|
|
368
|
+
path,
|
|
369
|
+
rule: "type",
|
|
370
|
+
detail: `expected ${types.join("|")}, got ${typeOf(value)}`
|
|
371
|
+
});
|
|
372
|
+
return evaluated;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
if (schema.const !== void 0) {
|
|
376
|
+
if (value !== schema.const) {
|
|
377
|
+
errs.push({
|
|
378
|
+
path,
|
|
379
|
+
rule: "const",
|
|
380
|
+
detail: `expected ${JSON.stringify(schema.const)}, got ${JSON.stringify(value)}`
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (Array.isArray(schema.enum)) {
|
|
385
|
+
if (!schema.enum.includes(value)) {
|
|
386
|
+
errs.push({
|
|
387
|
+
path,
|
|
388
|
+
rule: "enum",
|
|
389
|
+
detail: `value ${JSON.stringify(value)} not in enum [${schema.enum.map((x) => JSON.stringify(x)).join(", ")}]`
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
if (typeof value === "string") {
|
|
394
|
+
if (typeof schema.minLength === "number" && value.length < schema.minLength) {
|
|
395
|
+
errs.push({
|
|
396
|
+
path,
|
|
397
|
+
rule: "minLength",
|
|
398
|
+
detail: `length ${value.length} < ${schema.minLength}`
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
if (typeof schema.maxLength === "number" && value.length > schema.maxLength) {
|
|
402
|
+
errs.push({
|
|
403
|
+
path,
|
|
404
|
+
rule: "maxLength",
|
|
405
|
+
detail: `length ${value.length} > ${schema.maxLength}`
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
const pattern = typeof schema.pattern === "string" ? compilePattern(schema.pattern) : null;
|
|
409
|
+
if (pattern && !pattern.test(value)) {
|
|
410
|
+
errs.push({
|
|
411
|
+
path,
|
|
412
|
+
rule: "pattern",
|
|
413
|
+
detail: `value ${JSON.stringify(value)} does not match /${schema.pattern}/`
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
if (typeof schema.format === "string") {
|
|
417
|
+
if (schema.format === "date" && !FORMAT_DATE.test(value)) {
|
|
418
|
+
errs.push({
|
|
419
|
+
path,
|
|
420
|
+
rule: "format:date",
|
|
421
|
+
detail: `value ${JSON.stringify(value)} is not YYYY-MM-DD`
|
|
422
|
+
});
|
|
423
|
+
} else if (schema.format === "date-time" && !FORMAT_DATETIME.test(value)) {
|
|
424
|
+
errs.push({
|
|
425
|
+
path,
|
|
426
|
+
rule: "format:date-time",
|
|
427
|
+
detail: `value ${JSON.stringify(value)} is not ISO 8601 date-time`
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
if (typeof value === "number") {
|
|
433
|
+
if (typeof schema.minimum === "number" && value < schema.minimum) {
|
|
434
|
+
errs.push({ path, rule: "minimum", detail: `value ${value} < ${schema.minimum}` });
|
|
435
|
+
}
|
|
436
|
+
if (typeof schema.maximum === "number" && value > schema.maximum) {
|
|
437
|
+
errs.push({ path, rule: "maximum", detail: `value ${value} > ${schema.maximum}` });
|
|
438
|
+
}
|
|
439
|
+
if (typeof schema.exclusiveMinimum === "number" && value <= schema.exclusiveMinimum) {
|
|
440
|
+
errs.push({
|
|
441
|
+
path,
|
|
442
|
+
rule: "exclusiveMinimum",
|
|
443
|
+
detail: `value ${value} <= ${schema.exclusiveMinimum}`
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
if (Array.isArray(value)) {
|
|
448
|
+
if (typeof schema.minItems === "number" && value.length < schema.minItems) {
|
|
449
|
+
errs.push({ path, rule: "minItems", detail: `length ${value.length} < ${schema.minItems}` });
|
|
450
|
+
}
|
|
451
|
+
if (typeof schema.maxItems === "number" && value.length > schema.maxItems) {
|
|
452
|
+
errs.push({ path, rule: "maxItems", detail: `length ${value.length} > ${schema.maxItems}` });
|
|
453
|
+
}
|
|
454
|
+
const prefixLength = Array.isArray(schema.prefixItems) ? schema.prefixItems.length : 0;
|
|
455
|
+
if (prefixLength > 0) {
|
|
456
|
+
for (let i = 0; i < Math.min(value.length, prefixLength); i++) {
|
|
457
|
+
validateNode(value[i], schema.prefixItems[i], `${path}[${i}]`, errs, context);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
if (schema.items !== void 0) {
|
|
461
|
+
for (let i = prefixLength; i < value.length; i++) {
|
|
462
|
+
validateNode(value[i], schema.items, `${path}[${i}]`, errs, context);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
if (schema.uniqueItems === true) {
|
|
466
|
+
const seen = /* @__PURE__ */ new Set();
|
|
467
|
+
for (const item of value) {
|
|
468
|
+
const key = JSON.stringify(item);
|
|
469
|
+
if (seen.has(key)) {
|
|
470
|
+
errs.push({ path, rule: "uniqueItems", detail: `duplicate item ${key}` });
|
|
471
|
+
break;
|
|
472
|
+
}
|
|
473
|
+
seen.add(key);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
if (schema.contains !== void 0) {
|
|
477
|
+
let matches = 0;
|
|
478
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
479
|
+
const containedErrors = [];
|
|
480
|
+
validateNode(value[index], schema.contains, `${path}[${index}]`, containedErrors, context);
|
|
481
|
+
if (containedErrors.length === 0) matches += 1;
|
|
482
|
+
}
|
|
483
|
+
const minimum = Number.isSafeInteger(schema.minContains) ? schema.minContains : 1;
|
|
484
|
+
const maximum = Number.isSafeInteger(schema.maxContains) ? schema.maxContains : null;
|
|
485
|
+
if (matches < minimum) {
|
|
486
|
+
errs.push({
|
|
487
|
+
path,
|
|
488
|
+
rule: "contains",
|
|
489
|
+
detail: `matched ${matches} contained items; expected at least ${minimum}`
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
if (maximum !== null && matches > maximum) {
|
|
493
|
+
errs.push({
|
|
494
|
+
path,
|
|
495
|
+
rule: "contains",
|
|
496
|
+
detail: `matched ${matches} contained items; expected at most ${maximum}`
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
502
|
+
if (Array.isArray(schema.required)) {
|
|
503
|
+
for (const req of schema.required) {
|
|
504
|
+
if (!Object.hasOwn(value, req)) {
|
|
505
|
+
errs.push({ path, rule: "required", detail: `missing required property '${req}'` });
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
if (typeof schema.maxProperties === "number" && Object.keys(value).length > schema.maxProperties) {
|
|
510
|
+
errs.push({
|
|
511
|
+
path,
|
|
512
|
+
rule: "maxProperties",
|
|
513
|
+
detail: `property count ${Object.keys(value).length} > ${schema.maxProperties}`
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
if (schema.dependentRequired !== null && typeof schema.dependentRequired === "object") {
|
|
517
|
+
for (const [trigger, dependencies] of Object.entries(schema.dependentRequired)) {
|
|
518
|
+
if (!Object.hasOwn(value, trigger) || !Array.isArray(dependencies)) continue;
|
|
519
|
+
for (const dependency of dependencies) {
|
|
520
|
+
if (!Object.hasOwn(value, dependency)) {
|
|
521
|
+
errs.push({
|
|
522
|
+
path,
|
|
523
|
+
rule: "dependentRequired",
|
|
524
|
+
detail: `property '${trigger}' requires property '${dependency}'`
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
const props = schema.properties || {};
|
|
531
|
+
for (const [k, v] of Object.entries(value)) {
|
|
532
|
+
if (schema.propertyNames !== void 0)
|
|
533
|
+
validateNode(k, schema.propertyNames, `${path}.${k}`, errs, context);
|
|
534
|
+
if (Object.hasOwn(props, k)) evaluated.add(k);
|
|
535
|
+
else if (schema.additionalProperties !== void 0) evaluated.add(k);
|
|
536
|
+
if (!Object.hasOwn(props, k)) {
|
|
537
|
+
if (schema.additionalProperties === false) {
|
|
538
|
+
errs.push({ path, rule: "additionalProperties", detail: `unknown property '${k}'` });
|
|
539
|
+
} else if (schema.additionalProperties === true || schema.additionalProperties !== null && typeof schema.additionalProperties === "object") {
|
|
540
|
+
validateNode(v, schema.additionalProperties, `${path}.${k}`, errs, context);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
for (const [k, v] of Object.entries(value)) {
|
|
545
|
+
if (Object.hasOwn(props, k)) validateNode(v, props[k], `${path}.${k}`, errs, context);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
if (Array.isArray(schema.oneOf)) {
|
|
549
|
+
let matched = 0;
|
|
550
|
+
for (const sub of schema.oneOf) {
|
|
551
|
+
const e = [];
|
|
552
|
+
const branch = validateNode(value, sub, path, e, context);
|
|
553
|
+
if (e.length === 0) {
|
|
554
|
+
matched++;
|
|
555
|
+
for (const key of branch) evaluated.add(key);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
if (matched !== 1) {
|
|
559
|
+
const titles = schema.oneOf.map((s) => s.title || "(unnamed)").join(" | ");
|
|
560
|
+
errs.push({
|
|
561
|
+
path,
|
|
562
|
+
rule: "oneOf",
|
|
563
|
+
detail: `matched ${matched}/${schema.oneOf.length} branches (expected exactly 1). Branches: ${titles}`
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
if (Array.isArray(schema.anyOf)) {
|
|
568
|
+
let matched = 0;
|
|
569
|
+
for (const sub of schema.anyOf) {
|
|
570
|
+
const candidateErrors = [];
|
|
571
|
+
const branch = validateNode(value, sub, path, candidateErrors, context);
|
|
572
|
+
if (candidateErrors.length === 0) {
|
|
573
|
+
matched += 1;
|
|
574
|
+
for (const key of branch) evaluated.add(key);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
if (matched === 0) {
|
|
578
|
+
const titles = schema.anyOf.map((sub) => sub.title || "(unnamed)").join(" | ");
|
|
579
|
+
errs.push({
|
|
580
|
+
path,
|
|
581
|
+
rule: "anyOf",
|
|
582
|
+
detail: `matched 0/${schema.anyOf.length} branches (expected at least 1). Branches: ${titles}`
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
if (Array.isArray(schema.allOf)) {
|
|
587
|
+
for (const sub of schema.allOf) {
|
|
588
|
+
for (const key of validateNode(value, sub, path, errs, context)) evaluated.add(key);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if (schema.if !== void 0) {
|
|
592
|
+
const conditionErrors = [];
|
|
593
|
+
const condition = validateNode(value, schema.if, path, conditionErrors, context);
|
|
594
|
+
const passed = conditionErrors.length === 0;
|
|
595
|
+
if (passed) for (const key of condition) evaluated.add(key);
|
|
596
|
+
const branch = passed ? schema.then : schema.else;
|
|
597
|
+
if (branch !== void 0) {
|
|
598
|
+
const branchErrors = [];
|
|
599
|
+
const branchEvaluated = validateNode(value, branch, path, branchErrors, context);
|
|
600
|
+
errs.push(...branchErrors);
|
|
601
|
+
if (branchErrors.length === 0) for (const key of branchEvaluated) evaluated.add(key);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
if (schema.not !== void 0) {
|
|
605
|
+
const e = [];
|
|
606
|
+
validateNode(value, schema.not, path, e, context);
|
|
607
|
+
if (e.length === 0) {
|
|
608
|
+
errs.push({ path, rule: "not", detail: "value matched a forbidden subschema" });
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
if (schema.unevaluatedProperties !== void 0 && value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
612
|
+
for (const [k, v] of Object.entries(value)) {
|
|
613
|
+
if (evaluated.has(k)) continue;
|
|
614
|
+
if (schema.unevaluatedProperties === false) {
|
|
615
|
+
errs.push({ path, rule: "unevaluatedProperties", detail: `unevaluated property '${k}'` });
|
|
616
|
+
} else {
|
|
617
|
+
validateNode(v, schema.unevaluatedProperties, `${path}.${k}`, errs, context);
|
|
618
|
+
}
|
|
619
|
+
evaluated.add(k);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
return evaluated;
|
|
623
|
+
};
|
|
624
|
+
var validateJson = (value, schema, {
|
|
625
|
+
resolveRef,
|
|
626
|
+
base = (
|
|
627
|
+
/** @type {{ $id?: string } | null | undefined} */
|
|
628
|
+
schema?.$id ?? null
|
|
629
|
+
)
|
|
630
|
+
} = {}) => {
|
|
631
|
+
const errs = [];
|
|
632
|
+
const schemaErrors = [];
|
|
633
|
+
if (!isSchema(schema)) {
|
|
634
|
+
return [
|
|
635
|
+
{
|
|
636
|
+
path: "$",
|
|
637
|
+
rule: "schema",
|
|
638
|
+
detail: `expected a schema object or boolean, got ${typeOf(schema)}`
|
|
639
|
+
}
|
|
640
|
+
];
|
|
641
|
+
}
|
|
642
|
+
validateNode(value, schema, "$", errs, {
|
|
643
|
+
rootSchema: schema,
|
|
644
|
+
resolveRef,
|
|
645
|
+
base,
|
|
646
|
+
referenceStack: [],
|
|
647
|
+
schemaErrors,
|
|
648
|
+
checkedSchemas: /* @__PURE__ */ new WeakSet(),
|
|
649
|
+
reportedReferences: /* @__PURE__ */ new WeakSet()
|
|
650
|
+
});
|
|
651
|
+
return [...schemaErrors, ...errs];
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
// packages/artifact/lib/artifact/internal/schema-loader.mjs
|
|
124
655
|
var require2 = createRequire(new URL("./runtime/packages/artifact/lib/artifact/internal/schema-loader.mjs", import.meta.url).href);
|
|
125
656
|
var protocolPackageRoot = dirname(__planrAssetFile(new URL("./runtime/packages/protocol/package.json", import.meta.url)));
|
|
126
657
|
var SCHEMAS_ROOT = join(protocolPackageRoot, "schemas");
|
|
@@ -496,6 +1027,7 @@ export {
|
|
|
496
1027
|
ARTIFACT_MAX_SOURCES,
|
|
497
1028
|
ARTIFACT_MAX_VIEWS,
|
|
498
1029
|
resolveArtifactHtml,
|
|
1030
|
+
validateJson,
|
|
499
1031
|
MAX_ARTIFACT_HTML_BYTES,
|
|
500
1032
|
canonicalSerialize,
|
|
501
1033
|
digestArtifactEnvelope,
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isProcessAlive
|
|
3
|
+
} from "./design-loopback-server.mjs";
|
|
4
|
+
|
|
5
|
+
// packages/design/lib/design/document-state.mjs
|
|
6
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
7
|
+
import {
|
|
8
|
+
chmodSync,
|
|
9
|
+
closeSync,
|
|
10
|
+
lstatSync,
|
|
11
|
+
mkdirSync,
|
|
12
|
+
openSync,
|
|
13
|
+
readFileSync,
|
|
14
|
+
realpathSync,
|
|
15
|
+
renameSync,
|
|
16
|
+
rmSync,
|
|
17
|
+
writeFileSync
|
|
18
|
+
} from "node:fs";
|
|
19
|
+
import { dirname, join, resolve } from "node:path";
|
|
20
|
+
var hash = (value) => createHash("sha256").update(value).digest("hex");
|
|
21
|
+
var json = (value) => `${JSON.stringify(value, null, 2)}
|
|
22
|
+
`;
|
|
23
|
+
function readJson(path, fallback = void 0) {
|
|
24
|
+
try {
|
|
25
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
26
|
+
} catch (error) {
|
|
27
|
+
if (error.code === "ENOENT" && fallback !== void 0) return fallback;
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function atomicJson(path, value, { mode } = {}) {
|
|
32
|
+
atomicBytes(path, json(value), mode);
|
|
33
|
+
}
|
|
34
|
+
function atomicBytes(path, bytes, mode) {
|
|
35
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
36
|
+
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
37
|
+
try {
|
|
38
|
+
writeFileSync(temporary, bytes, { mode: 384, flag: "wx" });
|
|
39
|
+
if (mode !== void 0) chmodSync(temporary, mode);
|
|
40
|
+
renameSync(temporary, path);
|
|
41
|
+
} finally {
|
|
42
|
+
rmSync(temporary, { force: true });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function recoverDesignPublication(root, { ownsRenderLock = false } = {}) {
|
|
46
|
+
const journalPath = join(root, ".design/publication.json");
|
|
47
|
+
let journal = readJson(journalPath, null);
|
|
48
|
+
if (!journal) return;
|
|
49
|
+
const lockPath = join(root, ".design/render.lock");
|
|
50
|
+
let recoveryOwner;
|
|
51
|
+
if (!ownsRenderLock) {
|
|
52
|
+
const lock = readJson(lockPath, null);
|
|
53
|
+
if (lock && isProcessAlive(lock.pid)) return;
|
|
54
|
+
if (lock) rmSync(lockPath, { force: true });
|
|
55
|
+
recoveryOwner = randomUUID();
|
|
56
|
+
let descriptor;
|
|
57
|
+
try {
|
|
58
|
+
descriptor = openSync(lockPath, "wx", 384);
|
|
59
|
+
writeFileSync(
|
|
60
|
+
descriptor,
|
|
61
|
+
json({ pid: process.pid, owner: recoveryOwner, createdAt: Date.now() })
|
|
62
|
+
);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
if (error.code === "EEXIST") return;
|
|
65
|
+
throw error;
|
|
66
|
+
} finally {
|
|
67
|
+
if (descriptor !== void 0) closeSync(descriptor);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
journal = readJson(journalPath, null);
|
|
72
|
+
if (!journal) return;
|
|
73
|
+
const pointer = readJson(join(root, ".design/current.json"), null);
|
|
74
|
+
const manifestPath = join(root, "finalized.json");
|
|
75
|
+
if (pointer?.revision === journal.revision) atomicJson(manifestPath, journal.manifest);
|
|
76
|
+
else if ((pointer?.revision ?? null) === journal.previousRevision) {
|
|
77
|
+
if (journal.previousManifest === null) rmSync(manifestPath, { force: true });
|
|
78
|
+
else atomicBytes(manifestPath, Buffer.from(journal.previousManifest, "base64"));
|
|
79
|
+
} else if (pointer?.revision && /^[a-f0-9]{64}$/u.test(pointer.revision)) {
|
|
80
|
+
atomicJson(
|
|
81
|
+
manifestPath,
|
|
82
|
+
readJson(join(root, ".design/revisions", pointer.revision, "render.json")).manifest
|
|
83
|
+
);
|
|
84
|
+
} else
|
|
85
|
+
throw new Error("Design publication recovery could not identify the committed revision.");
|
|
86
|
+
rmSync(journalPath, { force: true });
|
|
87
|
+
} finally {
|
|
88
|
+
if (recoveryOwner && readJson(lockPath, null)?.owner === recoveryOwner)
|
|
89
|
+
rmSync(lockPath, { force: true });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function designSpecPath(root) {
|
|
93
|
+
return /(?:^|\/)output\/feats\/feat-[^/]+\/design$/u.test(root.replaceAll("\\", "/")) ? join(dirname(root), "design-spec.md") : join(root, "design-spec.md");
|
|
94
|
+
}
|
|
95
|
+
function currentDesign(file, { recoverPublication = true } = {}) {
|
|
96
|
+
const root = realpathSync(dirname(resolve(file)));
|
|
97
|
+
if (recoverPublication) recoverDesignPublication(root);
|
|
98
|
+
else {
|
|
99
|
+
try {
|
|
100
|
+
lstatSync(join(root, ".design/publication.json"));
|
|
101
|
+
throw Object.assign(
|
|
102
|
+
new Error(
|
|
103
|
+
"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."
|
|
104
|
+
),
|
|
105
|
+
{ code: "E_DESIGN_PUBLICATION_PENDING", statusCode: 409 }
|
|
106
|
+
);
|
|
107
|
+
} catch (error) {
|
|
108
|
+
if (error.code !== "ENOENT") throw error;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const pointer = readJson(join(root, ".design/current.json"), null);
|
|
112
|
+
if (!pointer || !/^[a-f0-9]{64}$/u.test(pointer.revision))
|
|
113
|
+
throw new Error("Design has no completed render. Run the render utility first.");
|
|
114
|
+
const directory = join(root, ".design/revisions", pointer.revision);
|
|
115
|
+
const prepared = readJson(join(directory, "render.json"));
|
|
116
|
+
return {
|
|
117
|
+
...prepared,
|
|
118
|
+
root,
|
|
119
|
+
directory,
|
|
120
|
+
file: resolve(file),
|
|
121
|
+
verification: readJson(join(root, ".design/verification", `${pointer.revision}.json`), {
|
|
122
|
+
status: "unverified",
|
|
123
|
+
revision: pointer.revision
|
|
124
|
+
})
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export {
|
|
129
|
+
hash,
|
|
130
|
+
json,
|
|
131
|
+
readJson,
|
|
132
|
+
atomicJson,
|
|
133
|
+
atomicBytes,
|
|
134
|
+
recoverDesignPublication,
|
|
135
|
+
designSpecPath,
|
|
136
|
+
currentDesign
|
|
137
|
+
};
|