@planu/cli 4.14.1 → 5.0.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 +35 -1
- package/LICENSE +55 -12
- package/README.md +10 -2
- package/dist/cli/commands/install.d.ts +1 -12
- package/dist/cli/commands/install.js +9 -65
- package/dist/cli/commands/job.js +4 -3
- package/dist/cli/commands/spec.js +2 -2
- package/dist/cli/commands/validate.js +2 -2
- package/dist/cli/router.js +1 -3
- package/dist/config/environment-schema.json +1 -3
- package/dist/config/official-sdd-tools.d.ts +4 -0
- package/dist/config/official-sdd-tools.js +35 -0
- package/dist/config/product-public.d.ts +139 -3
- package/dist/config/product-public.js +8 -1
- package/dist/config/product-public.json +7 -36
- package/dist/config/registries/hosts/codex.json +20 -363
- package/dist/config/release-policy.json +84 -2
- package/dist/config/runtime-policy.json +12 -1
- package/dist/config/skill-templates/planu-resume-work.md +2 -2
- package/dist/core/index.d.ts +1 -1
- package/dist/core/spec-validator.d.ts +4 -4
- package/dist/core/spec-validator.js +1 -1
- package/dist/engine/abortable-process-runner.d.ts +20 -2
- package/dist/engine/abortable-process-runner.js +243 -74
- package/dist/engine/ambiguity-scorer.js +4 -26
- package/dist/engine/auth/scope-mapper.js +1 -7
- package/dist/engine/autopilot/state-updater.js +4 -4
- package/dist/engine/cascade-hooks/hooks/review-enricher.hook.js +9 -6
- package/dist/engine/cascade-hooks/state-drift-detector.d.ts +3 -3
- package/dist/engine/cascade-hooks/state-drift-detector.js +1 -1
- package/dist/engine/ci-generator/planu-config.js +1 -7
- package/dist/engine/clarification-gate/gate.d.ts +3 -3
- package/dist/engine/code-scanner/layer-scanner.js +6 -22
- package/dist/engine/core-bridge.d.ts +3 -3
- package/dist/engine/cost-guardrails.d.ts +1 -1
- package/dist/engine/cost-guardrails.js +1 -1
- package/dist/engine/criterion-identity.d.ts +1 -0
- package/dist/engine/criterion-identity.js +7 -0
- package/dist/engine/dashboard/data-loader.js +2 -7
- package/dist/engine/dashboard/templates-layout.js +0 -3
- package/dist/engine/dashboard/templates-project.js +1 -13
- package/dist/engine/docs-site-generator/data-collector.d.ts +1 -1
- package/dist/engine/docs-site-generator/data-collector.js +7 -28
- package/dist/engine/docs-site-generator/tools-renderer.js +3 -10
- package/dist/engine/evidence-gates/artifact-reader.d.ts +10 -1
- package/dist/engine/evidence-gates/artifact-reader.js +115 -2
- package/dist/engine/evidence-gates/lifecycle-gate.js +4 -3
- package/dist/engine/evidence-gates/reconciliation-freshness.d.ts +11 -0
- package/dist/engine/evidence-gates/reconciliation-freshness.js +72 -0
- package/dist/engine/evidence-index/done-drift.d.ts +1 -1
- package/dist/engine/evidence-index/done-drift.js +40 -18
- package/dist/engine/execution/context.js +3 -0
- package/dist/engine/execution/durable-job-heartbeat-runtime.d.ts +4 -0
- package/dist/engine/execution/durable-job-heartbeat-runtime.js +400 -0
- package/dist/engine/execution/job-runtime.d.ts +30 -0
- package/dist/engine/execution/job-runtime.js +114 -6
- package/dist/engine/execution/public-job-sanitizer.d.ts +4 -0
- package/dist/engine/execution/public-job-sanitizer.js +31 -0
- package/dist/engine/execution/validate-job-executor.d.ts +12 -1
- package/dist/engine/execution/validate-job-executor.js +549 -86
- package/dist/engine/execution/validate-job-payload.js +107 -50
- package/dist/engine/execution/validate-job-recovery.js +1 -1
- package/dist/engine/execution/validate-worker-runtime.d.ts +5 -0
- package/dist/engine/execution/validate-worker-runtime.js +90 -2
- package/dist/engine/execution/validate-worker-thread.js +17 -24
- package/dist/engine/handoff-artifacts/schemas.d.ts +2 -1
- package/dist/engine/handoff-artifacts/schemas.js +33 -0
- package/dist/engine/handoff-packager.d.ts +19 -0
- package/dist/engine/handoff-packager.js +415 -13
- package/dist/engine/hooks/effort-configurator.js +1 -1
- package/dist/engine/impact-detector/test-break-predictor.js +3 -3
- package/dist/engine/impact-detector/tool-registration.js +1 -1
- package/dist/engine/implementation-contract/renderer.js +23 -8
- package/dist/engine/lifecycle-reconciliation-io.d.ts +11 -0
- package/dist/engine/lifecycle-reconciliation-io.js +180 -0
- package/dist/engine/lifecycle-reconciliation.d.ts +16 -0
- package/dist/engine/lifecycle-reconciliation.js +406 -0
- package/dist/engine/local-first/tool-classification.js +2 -0
- package/dist/engine/macos-keychain-native-port.d.ts +5 -0
- package/dist/engine/macos-keychain-native-port.js +19 -7
- package/dist/engine/migrations/remove-commercial-state.d.ts +3 -0
- package/dist/engine/migrations/remove-commercial-state.js +343 -0
- package/dist/engine/network-policy.js +1 -0
- package/dist/engine/planu-core.darwin-arm64.node.manifest.json +7 -7
- package/dist/engine/planu-core.darwin-arm64.node.sbom.json +10 -10
- package/dist/engine/planu-core.darwin-x64.node.manifest.json +7 -7
- package/dist/engine/planu-core.darwin-x64.node.sbom.json +10 -10
- package/dist/engine/planu-core.linux-arm64-gnu.node.manifest.json +7 -7
- package/dist/engine/planu-core.linux-arm64-gnu.node.sbom.json +10 -10
- package/dist/engine/planu-core.linux-arm64-musl.node.manifest.json +7 -7
- package/dist/engine/planu-core.linux-arm64-musl.node.sbom.json +10 -10
- package/dist/engine/planu-core.linux-x64-gnu.node.manifest.json +7 -7
- package/dist/engine/planu-core.linux-x64-gnu.node.sbom.json +10 -10
- package/dist/engine/planu-core.linux-x64-musl.node.manifest.json +7 -7
- package/dist/engine/planu-core.linux-x64-musl.node.sbom.json +10 -10
- package/dist/engine/planu-core.win32-arm64-msvc.node.manifest.json +7 -7
- package/dist/engine/planu-core.win32-arm64-msvc.node.sbom.json +10 -10
- package/dist/engine/planu-core.win32-x64-msvc.node.manifest.json +7 -7
- package/dist/engine/planu-core.win32-x64-msvc.node.sbom.json +10 -10
- package/dist/engine/readiness-checker.d.ts +1 -16
- package/dist/engine/readiness-checker.js +27 -88
- package/dist/engine/runtime-policy.d.ts +2 -0
- package/dist/engine/runtime-policy.js +42 -5
- package/dist/engine/runtime-security/rate-limiter.js +0 -1
- package/dist/engine/safety/contained-project-file.d.ts +3 -0
- package/dist/engine/safety/contained-project-file.js +23 -0
- package/dist/engine/scope-boundaries/contradiction-checker.js +63 -1
- package/dist/engine/scope-boundaries/scope-validator.js +45 -7
- package/dist/engine/session/checkpoint-writer.js +0 -9
- package/dist/engine/spec-format/acceptance-criteria.d.ts +6 -2
- package/dist/engine/spec-format/acceptance-criteria.js +77 -18
- package/dist/engine/spec-format/markdown-sections.d.ts +14 -0
- package/dist/engine/spec-format/markdown-sections.js +105 -0
- package/dist/engine/spec-format/read-technical-section.js +33 -5
- package/dist/engine/spec-format/technical-md-populator.js +3 -2
- package/dist/engine/spec-format/unified-spec-builder.d.ts +7 -0
- package/dist/engine/spec-format/unified-spec-builder.js +202 -0
- package/dist/engine/spec-migrator/canonical-deduplicator.d.ts +18 -0
- package/dist/engine/spec-migrator/canonical-deduplicator.js +479 -0
- package/dist/engine/spec-migrator/filesystem-import.d.ts +4 -8
- package/dist/engine/spec-migrator/filesystem-import.js +121 -14
- package/dist/engine/spec-migrator/frontmatter-parser.js +32 -15
- package/dist/engine/spec-migrator/index.d.ts +1 -0
- package/dist/engine/spec-migrator/index.js +1 -0
- package/dist/engine/spec-state-machine/transition-spec.d.ts +6 -1
- package/dist/engine/spec-state-machine/transition-spec.js +10 -1
- package/dist/engine/technical-enricher/index.js +16 -8
- package/dist/engine/technical-enricher/render-enriched.d.ts +1 -0
- package/dist/engine/technical-enricher/render-enriched.js +42 -14
- package/dist/engine/telemetry/health-checker.js +53 -17
- package/dist/engine/telemetry/telemetry-client.js +26 -8
- package/dist/engine/text-signal-boundaries.d.ts +2 -0
- package/dist/engine/text-signal-boundaries.js +25 -2
- package/dist/engine/time/relative-date.d.ts +3 -0
- package/dist/engine/time/relative-date.js +16 -0
- package/dist/engine/timing/budget.d.ts +11 -0
- package/dist/engine/timing/budget.js +27 -9
- package/dist/engine/token-optimizer/analytics.d.ts +1 -1
- package/dist/engine/token-optimizer/analytics.js +5 -6
- package/dist/engine/usage-tracker/core.d.ts +2 -2
- package/dist/engine/usage-tracker/core.js +1 -2
- package/dist/engine/usage-tracker/index.d.ts +0 -3
- package/dist/engine/usage-tracker/index.js +0 -3
- package/dist/engine/usage-tracker/stats.d.ts +2 -2
- package/dist/engine/usage-tracker/stats.js +1 -28
- package/dist/engine/validation/durable-validation.d.ts +1 -1
- package/dist/engine/validation/durable-validation.js +3 -82
- package/dist/engine/validation/validation-freshness.d.ts +11 -1
- package/dist/engine/validation/validation-freshness.js +231 -91
- package/dist/engine/validation/validation-receipt.d.ts +9 -6
- package/dist/engine/validation/validation-receipt.js +84 -24
- package/dist/engine/validation/validation-source-digest.d.ts +2 -0
- package/dist/engine/validation/validation-source-digest.js +86 -0
- package/dist/engine/validation/validation-submission.d.ts +5 -4
- package/dist/engine/validation/validation-submission.js +25 -11
- package/dist/engine/validation/validation-worktree.d.ts +21 -0
- package/dist/engine/validation/validation-worktree.js +260 -0
- package/dist/engine/validation-impact-planner.d.ts +14 -2
- package/dist/engine/validation-impact-planner.js +0 -3
- package/dist/engine/validator/dor-dod.d.ts +1 -0
- package/dist/engine/validator/dor-dod.js +5 -3
- package/dist/engine/validator/extractors.d.ts +1 -5
- package/dist/engine/validator/extractors.js +24 -69
- package/dist/engine/validator/spec-compliance-runner.d.ts +12 -24
- package/dist/engine/validator/spec-compliance-runner.js +429 -211
- package/dist/engine/validator.js +35 -22
- package/dist/index.js +4 -16
- package/dist/resources/usage-stats-resource.js +2 -18
- package/dist/security/adapters/linux-secret-service.js +7 -3
- package/dist/security/adapters/windows-credential-manager.js +6 -4
- package/dist/server/routes/specs.js +10 -0
- package/dist/storage/base-store.d.ts +1 -1
- package/dist/storage/base-store.js +1 -1
- package/dist/storage/feedback-remote.d.ts +2 -3
- package/dist/storage/feedback-remote.js +45 -31
- package/dist/storage/global-store.d.ts +1 -17
- package/dist/storage/global-store.js +1 -42
- package/dist/storage/index.d.ts +0 -2
- package/dist/storage/index.js +0 -2
- package/dist/storage/migrations/canonical-storage.js +124 -11
- package/dist/storage/runtime-db.d.ts +9 -0
- package/dist/storage/runtime-db.js +64 -8
- package/dist/storage/spec-store.d.ts +14 -2
- package/dist/storage/spec-store.js +104 -14
- package/dist/storage/status-store/atomic-status-write.d.ts +5 -0
- package/dist/storage/status-store/atomic-status-write.js +57 -0
- package/dist/storage/status-store/file-lock.js +30 -11
- package/dist/storage/status-store/self-healing.js +3 -3
- package/dist/storage/status-store/version-sync.d.ts +2 -1
- package/dist/storage/status-store/version-sync.js +35 -40
- package/dist/storage/usage-store.d.ts +1 -5
- package/dist/storage/usage-store.js +0 -35
- package/dist/tools/auto-update-handler.d.ts +3 -3
- package/dist/tools/auto-update-handler.js +3 -3
- package/dist/tools/challenge-spec/resilience-challenge-scenarios.d.ts +2 -1
- package/dist/tools/challenge-spec/resilience-challenge-scenarios.js +10 -7
- package/dist/tools/challenge-spec/scenario-collector.js +1 -1
- package/dist/tools/challenge-spec/scenarios-data.js +1 -1
- package/dist/tools/challenge-spec/scenarios-utils.d.ts +1 -1
- package/dist/tools/challenge-spec/scenarios-utils.js +35 -11
- package/dist/tools/challenge-spec.js +5 -5
- package/dist/tools/check-readiness.js +1 -1
- package/dist/tools/configure-telemetry.js +30 -2
- package/dist/tools/create-spec/spec-builder.js +0 -11
- package/dist/tools/create-spec.d.ts +1 -0
- package/dist/tools/create-spec.js +444 -239
- package/dist/tools/git/branch-ops.d.ts +1 -1
- package/dist/tools/git/branch-ops.js +3 -2
- package/dist/tools/init-project/handler.js +10 -12
- package/dist/tools/init-project/host-assets-writer.js +26 -1
- package/dist/tools/init-project/lint-scaffolder.d.ts +3 -3
- package/dist/tools/init-project/migration-runner.d.ts +2 -4
- package/dist/tools/init-project/migration-runner.js +3 -2
- package/dist/tools/init-project/portable-index-reconciler.d.ts +4 -0
- package/dist/tools/init-project/portable-index-reconciler.js +14 -0
- package/dist/tools/init-project/result-builder.js +1 -3
- package/dist/tools/jobs/handlers.js +38 -6
- package/dist/tools/list-specs.js +5 -26
- package/dist/tools/merge-risk-handler.js +2 -2
- package/dist/tools/package-handoff.js +2 -0
- package/dist/tools/reconcile-spec.js +0 -27
- package/dist/tools/register-agent-squad-tools.js +2 -2
- package/dist/tools/register-platform-tools/design-stack-tools.js +11 -11
- package/dist/tools/register-platform-tools/lifecycle-infra-tools.js +7 -7
- package/dist/tools/register-sdd-tools.d.ts +1 -1
- package/dist/tools/register-sdd-tools.js +2 -29
- package/dist/tools/register-spec-tools/analysis-tools.js +8 -8
- package/dist/tools/register-spec-tools/core-spec-tools.js +17 -8
- package/dist/tools/safe-handler.d.ts +5 -13
- package/dist/tools/safe-handler.js +7 -23
- package/dist/tools/schemas/index.d.ts +1 -1
- package/dist/tools/schemas/index.js +1 -1
- package/dist/tools/schemas/output-schemas.d.ts +0 -23
- package/dist/tools/schemas/output-schemas.js +0 -28
- package/dist/tools/schemas/spec.d.ts +4 -0
- package/dist/tools/schemas/spec.js +3 -0
- package/dist/tools/schemas/validate-output-schema.d.ts +11 -0
- package/dist/tools/schemas/validate-output-schema.js +7 -0
- package/dist/tools/spec-prompt-handler.js +3 -3
- package/dist/tools/sync-spec-state-handler.d.ts +1 -1
- package/dist/tools/sync-spec-state-handler.js +1 -1
- package/dist/tools/tool-entry.d.ts +4 -4
- package/dist/tools/tool-entry.js +3 -3
- package/dist/tools/tool-registry/core-tools.js +31 -15
- package/dist/tools/tool-registry/group-infra.js +27 -110
- package/dist/tools/tool-registry/group-quality-compliance.js +26 -26
- package/dist/tools/tool-registry/inventory.d.ts +2 -0
- package/dist/tools/tool-registry/inventory.js +2 -0
- package/dist/tools/tool-registry-helpers.d.ts +3 -3
- package/dist/tools/tool-registry-helpers.js +3 -3
- package/dist/tools/tool-usage-report/registered-tools.d.ts +1 -1
- package/dist/tools/tool-usage-report/registered-tools.js +3 -15
- package/dist/tools/update-status/approval-gates.js +3 -0
- package/dist/tools/update-status/done-receipt-verifier.js +40 -27
- package/dist/tools/update-status/evidence-gate.js +36 -1
- package/dist/tools/update-status/file-sync.d.ts +2 -1
- package/dist/tools/update-status/file-sync.js +57 -6
- package/dist/tools/update-status/index.d.ts +2 -0
- package/dist/tools/update-status/index.js +95 -58
- package/dist/tools/update-status/response-builder.js +3 -3
- package/dist/tools/update-status/side-effects.d.ts +2 -0
- package/dist/tools/update-status/side-effects.js +2 -2
- package/dist/tools/update-status/transition-guard.js +32 -15
- package/dist/tools/update-status-actions.d.ts +4 -2
- package/dist/tools/update-status-actions.js +16 -14
- package/dist/tools/usage-report.js +1 -16
- package/dist/tools/usage-stats.js +1 -18
- package/dist/tools/usage-tracking.d.ts +4 -0
- package/dist/tools/usage-tracking.js +20 -0
- package/dist/tools/validate-lint.d.ts +1 -0
- package/dist/tools/validate-lint.js +1 -1
- package/dist/tools/validate.d.ts +2 -1
- package/dist/tools/validate.js +114 -34
- package/dist/transports/http-transport.js +6 -8
- package/dist/transports/mcp-types.d.ts +0 -2
- package/dist/transports/session-context.js +1 -1
- package/dist/types/cascade-hooks.d.ts +1 -1
- package/dist/types/ci.d.ts +0 -4
- package/dist/types/clarification-token.d.ts +1 -1
- package/dist/types/claude-code-runtime.d.ts +0 -27
- package/dist/types/commercial-migration.d.ts +17 -0
- package/dist/types/commercial-migration.js +2 -0
- package/dist/types/common/primitives.d.ts +0 -2
- package/dist/types/core-bridge.d.ts +4 -10
- package/dist/types/dashboard.d.ts +3 -7
- package/dist/types/docs.d.ts +0 -1
- package/dist/types/durable-job.d.ts +4 -4
- package/dist/types/durable-validation.d.ts +100 -2
- package/dist/types/durable-validation.js +165 -1
- package/dist/types/errors/structured-error.d.ts +3 -3
- package/dist/types/estimation.d.ts +2 -0
- package/dist/types/evidence-gates.d.ts +9 -1
- package/dist/types/execution.d.ts +2 -0
- package/dist/types/gemini-integration.d.ts +0 -11
- package/dist/types/handoff-artifacts.d.ts +41 -0
- package/dist/types/hooks-advanced.d.ts +0 -13
- package/dist/types/impact-detection.d.ts +2 -2
- package/dist/types/index.d.ts +2 -6
- package/dist/types/index.js +1 -5
- package/dist/types/kiro-integration.d.ts +0 -6
- package/dist/types/network-policy.d.ts +1 -1
- package/dist/types/project/lint-scaffolder.d.ts +1 -1
- package/dist/types/runtime-policy.d.ts +11 -0
- package/dist/types/session-safeguard.d.ts +0 -31
- package/dist/types/spec/canonical-repair.d.ts +81 -0
- package/dist/types/spec/canonical-repair.js +2 -0
- package/dist/types/spec/core.d.ts +14 -0
- package/dist/types/spec/index.d.ts +1 -0
- package/dist/types/spec/index.js +1 -0
- package/dist/types/spec/inputs.d.ts +29 -0
- package/dist/types/spec-format.d.ts +24 -0
- package/dist/types/telemetry.d.ts +4 -1
- package/dist/types/transport.d.ts +0 -2
- package/dist/types/usage.d.ts +1 -36
- package/dist/types/usage.js +1 -1
- package/dist/types/validate-worker.d.ts +6 -0
- package/dist/types/validation-receipt.d.ts +1 -1
- package/dist/types/validation.d.ts +2 -2
- package/package.json +16 -12
- package/planu-native.json +1 -1
- package/planu-plugin.json +23 -40
- package/scripts/lib/pending-release-file.mjs +93 -0
- package/src/i18n/messages/en.json +0 -41
- package/src/i18n/messages/es.json +0 -41
- package/src/i18n/messages/pt.json +0 -41
- package/dist/cli/commands/activate.d.ts +0 -14
- package/dist/cli/commands/activate.js +0 -174
- package/dist/config/license-plans.json +0 -251
- package/dist/config/product-public.ts +0 -148
- package/dist/config/server-instructions.ts +0 -121
- package/dist/config/version-defaults.ts +0 -76
- package/dist/config/version.ts +0 -21
- package/dist/engine/ai-integration/gemini/settings-generator.d.ts +0 -4
- package/dist/engine/ai-integration/gemini/settings-generator.js +0 -195
- package/dist/engine/ai-integration/kiro/hooks-generator.d.ts +0 -6
- package/dist/engine/ai-integration/kiro/hooks-generator.js +0 -75
- package/dist/engine/hooks/full-spectrum-generator.d.ts +0 -32
- package/dist/engine/hooks/full-spectrum-generator.js +0 -117
- package/dist/engine/license-validator/config-loader.d.ts +0 -5
- package/dist/engine/license-validator/config-loader.js +0 -16
- package/dist/engine/license-validator/core.d.ts +0 -15
- package/dist/engine/license-validator/core.js +0 -151
- package/dist/engine/license-validator/fingerprint.d.ts +0 -3
- package/dist/engine/license-validator/fingerprint.js +0 -17
- package/dist/engine/license-validator/lemon-squeezy.d.ts +0 -5
- package/dist/engine/license-validator/lemon-squeezy.js +0 -55
- package/dist/engine/license-validator.d.ts +0 -5
- package/dist/engine/license-validator.js +0 -6
- package/dist/engine/product-intelligence/index.d.ts +0 -7
- package/dist/engine/product-intelligence/index.js +0 -211
- package/dist/engine/session/auto-save.d.ts +0 -18
- package/dist/engine/session/auto-save.js +0 -98
- package/dist/engine/session/context-snapshot.d.ts +0 -8
- package/dist/engine/session/context-snapshot.js +0 -49
- package/dist/engine/session/memory-sync.d.ts +0 -12
- package/dist/engine/session/memory-sync.js +0 -34
- package/dist/engine/session/session-diff.d.ts +0 -11
- package/dist/engine/session/session-diff.js +0 -42
- package/dist/engine/session/session-merge.d.ts +0 -12
- package/dist/engine/session/session-merge.js +0 -55
- package/dist/engine/session-safeguard/checkpoint-runner.d.ts +0 -4
- package/dist/engine/session-safeguard/checkpoint-runner.js +0 -70
- package/dist/engine/session-safeguard/learnings-buffer.d.ts +0 -15
- package/dist/engine/session-safeguard/learnings-buffer.js +0 -91
- package/dist/engine/session-safeguard/precompaction-drain.d.ts +0 -10
- package/dist/engine/session-safeguard/precompaction-drain.js +0 -82
- package/dist/engine/session-safeguard/unpushed-detector.d.ts +0 -7
- package/dist/engine/session-safeguard/unpushed-detector.js +0 -59
- package/dist/engine/spec-changelog/core.d.ts +0 -16
- package/dist/engine/spec-changelog/core.js +0 -176
- package/dist/engine/spec-changelog/diff.d.ts +0 -18
- package/dist/engine/spec-changelog/diff.js +0 -121
- package/dist/engine/spec-changelog/index.d.ts +0 -3
- package/dist/engine/spec-changelog/index.js +0 -4
- package/dist/engine/trial-engine.d.ts +0 -5
- package/dist/engine/trial-engine.js +0 -14
- package/dist/engine/usage-tracker/rate-check.d.ts +0 -7
- package/dist/engine/usage-tracker/rate-check.js +0 -18
- package/dist/engine/usage-tracker/rate-limiter.d.ts +0 -14
- package/dist/engine/usage-tracker/rate-limiter.js +0 -73
- package/dist/engine/usage-tracker/trial.d.ts +0 -27
- package/dist/engine/usage-tracker/trial.js +0 -49
- package/dist/engine/webhook/event-handlers.d.ts +0 -25
- package/dist/engine/webhook/event-handlers.js +0 -89
- package/dist/engine/webhook/index.d.ts +0 -4
- package/dist/engine/webhook/index.js +0 -5
- package/dist/engine/webhook/server.d.ts +0 -12
- package/dist/engine/webhook/server.js +0 -249
- package/dist/engine/webhook/signature.d.ts +0 -16
- package/dist/engine/webhook/signature.js +0 -49
- package/dist/storage/license-store.d.ts +0 -6
- package/dist/storage/license-store.js +0 -63
- package/dist/storage/session-store.d.ts +0 -20
- package/dist/storage/session-store.js +0 -136
- package/dist/tools/activate-license.d.ts +0 -6
- package/dist/tools/activate-license.js +0 -132
- package/dist/tools/checkpoint-handler.d.ts +0 -3
- package/dist/tools/checkpoint-handler.js +0 -130
- package/dist/tools/export-session.d.ts +0 -3
- package/dist/tools/export-session.js +0 -90
- package/dist/tools/license-gate.d.ts +0 -18
- package/dist/tools/license-gate.js +0 -222
- package/dist/tools/license-status.d.ts +0 -3
- package/dist/tools/license-status.js +0 -93
- package/dist/tools/list-sessions.d.ts +0 -3
- package/dist/tools/list-sessions.js +0 -46
- package/dist/tools/planu-session-checkpoint.d.ts +0 -6
- package/dist/tools/planu-session-checkpoint.js +0 -42
- package/dist/tools/restore-session.d.ts +0 -3
- package/dist/tools/restore-session.js +0 -71
- package/dist/tools/spec-history.d.ts +0 -3
- package/dist/tools/spec-history.js +0 -59
- package/dist/tools/webhook.d.ts +0 -6
- package/dist/tools/webhook.js +0 -150
- package/dist/types/changelog.d.ts +0 -49
- package/dist/types/changelog.js +0 -3
- package/dist/types/licensing.d.ts +0 -109
- package/dist/types/licensing.js +0 -4
- package/dist/types/product-intelligence.d.ts +0 -60
- package/dist/types/product-intelligence.js +0 -3
- package/dist/types/session.d.ts +0 -84
- package/dist/types/session.js +0 -3
- package/dist/types/webhook.d.ts +0 -62
- package/dist/types/webhook.js +0 -4
|
@@ -1,87 +1,144 @@
|
|
|
1
1
|
import { mkdir } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { projectDataDir } from '../../storage/base-store.js';
|
|
4
|
+
import { reportClassifiedDegradation } from '../../errors/classified-degradation.js';
|
|
4
5
|
import { computeDurableValidationBindings, toValidationReceiptBindings, } from '../validation/durable-validation.js';
|
|
5
|
-
import { assertValidationFreshnessBarrier, beginValidationFreshnessBarrier, bindValidationFreshnessLease, } from '../validation/validation-freshness.js';
|
|
6
|
-
import { PROJECT_ID as CANONICAL_PROJECT_ID } from '../validation/validation-receipt-codec.js';
|
|
6
|
+
import { assertValidationFreshnessBarrier, beginValidationFreshnessBarrier, bindValidationFreshnessLease, closeValidationFreshnessLease, } from '../validation/validation-freshness.js';
|
|
7
|
+
import { PROJECT_ID as CANONICAL_PROJECT_ID, SPEC_ID as CANONICAL_SPEC_ID, } from '../validation/validation-receipt-codec.js';
|
|
8
|
+
import { isValidationRootId, revalidateValidationWorktree, ValidationWorktreeError, } from '../validation/validation-worktree.js';
|
|
7
9
|
export function isValidateJob(value) {
|
|
8
10
|
return Boolean(value && typeof value === 'object' && value.kind === 'validate');
|
|
9
11
|
}
|
|
12
|
+
async function closeFreshnessLeaseWithoutMasking(lease) {
|
|
13
|
+
try {
|
|
14
|
+
await closeValidationFreshnessLease(lease);
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
reportClassifiedDegradation('VALIDATION_FRESHNESS_CHECK_FAILED', error);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function hasValidBindingIdentity(payload) {
|
|
21
|
+
return (payload.bindings === undefined ||
|
|
22
|
+
(payload.bindings.projectId === payload.input?.projectId &&
|
|
23
|
+
CANONICAL_PROJECT_ID.test(payload.bindings.projectId)));
|
|
24
|
+
}
|
|
25
|
+
function hasValidPayloadShape(payload) {
|
|
26
|
+
return Boolean(payload.kind === 'validate' &&
|
|
27
|
+
payload.schemaVersion === 2 &&
|
|
28
|
+
payload.input &&
|
|
29
|
+
typeof payload.input.specId === 'string' &&
|
|
30
|
+
CANONICAL_SPEC_ID.test(payload.input.specId) &&
|
|
31
|
+
typeof payload.input.projectId === 'string' &&
|
|
32
|
+
CANONICAL_PROJECT_ID.test(payload.input.projectId) &&
|
|
33
|
+
typeof payload.input.projectPath === 'string' &&
|
|
34
|
+
typeof payload.specPath === 'string' &&
|
|
35
|
+
hasValidBindingIdentity(payload));
|
|
36
|
+
}
|
|
10
37
|
export function parseValidatePayload(value) {
|
|
11
38
|
if (!value || typeof value !== 'object') {
|
|
12
39
|
return undefined;
|
|
13
40
|
}
|
|
14
41
|
const payload = value;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
42
|
+
const schemaVersion = value.schemaVersion;
|
|
43
|
+
const rawSpecId = payload.input?.specId;
|
|
44
|
+
const inputSpecId = typeof rawSpecId === 'string' && CANONICAL_SPEC_ID.test(rawSpecId) ? rawSpecId : 'SPEC-unknown';
|
|
45
|
+
if (schemaVersion !== 2) {
|
|
46
|
+
throw new ValidationWorktreeError('VALIDATION_PAYLOAD_VERSION_UNSUPPORTED', inputSpecId);
|
|
47
|
+
}
|
|
48
|
+
if (!isValidationRootId(payload.validationRootId)) {
|
|
49
|
+
throw new ValidationWorktreeError('VALIDATION_ROOT_ID_MALFORMED', inputSpecId);
|
|
50
|
+
}
|
|
51
|
+
if (typeof rawSpecId !== 'string' || !CANONICAL_SPEC_ID.test(rawSpecId)) {
|
|
52
|
+
throw new ValidationWorktreeError('VALIDATION_SPEC_ID_MISMATCH', 'SPEC-unknown');
|
|
53
|
+
}
|
|
54
|
+
if (!hasValidPayloadShape(payload)) {
|
|
25
55
|
return undefined;
|
|
26
56
|
}
|
|
27
57
|
return payload;
|
|
28
58
|
}
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
59
|
+
async function computeFreshSnapshot(input) {
|
|
60
|
+
const handoffPath = join(projectDataDir(input.projectId), 'handoffs', input.specId);
|
|
61
|
+
await mkdir(handoffPath, { recursive: true });
|
|
62
|
+
const freshnessLease = await beginValidationFreshnessBarrier({
|
|
63
|
+
projectId: input.projectId,
|
|
64
|
+
specId: input.specId,
|
|
65
|
+
projectPath: input.projectPath,
|
|
66
|
+
handoffPath,
|
|
67
|
+
});
|
|
68
|
+
try {
|
|
69
|
+
const observed = await computeDurableValidationBindings({
|
|
70
|
+
canonicalProjectId: input.projectId,
|
|
71
|
+
specId: input.specId,
|
|
72
|
+
projectPath: input.projectPath,
|
|
73
|
+
specPath: input.specPath,
|
|
74
|
+
});
|
|
75
|
+
return { freshnessLease, observed };
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
await closeFreshnessLeaseWithoutMasking(freshnessLease);
|
|
79
|
+
throw error;
|
|
34
80
|
}
|
|
81
|
+
}
|
|
82
|
+
export async function rehydrateValidationPayload(payload) {
|
|
83
|
+
const resolved = await revalidateValidationWorktree({
|
|
84
|
+
projectPath: payload.input.projectPath ?? '',
|
|
85
|
+
specPath: payload.specPath,
|
|
86
|
+
specId: payload.input.specId,
|
|
87
|
+
validationRootId: payload.validationRootId,
|
|
88
|
+
});
|
|
89
|
+
const projectPath = resolved.projectPath;
|
|
90
|
+
const specPath = resolved.specPath;
|
|
91
|
+
const normalizedPayload = {
|
|
92
|
+
...payload,
|
|
93
|
+
input: { ...payload.input, projectPath },
|
|
94
|
+
specPath,
|
|
95
|
+
};
|
|
35
96
|
if (!payload.bindings || !payload.artifactDigests) {
|
|
36
|
-
const
|
|
37
|
-
await mkdir(handoffPath, { recursive: true });
|
|
38
|
-
const freshnessLease = await beginValidationFreshnessBarrier({
|
|
97
|
+
const { freshnessLease, observed } = await computeFreshSnapshot({
|
|
39
98
|
projectId: payload.input.projectId,
|
|
40
99
|
specId: payload.input.specId,
|
|
41
100
|
projectPath,
|
|
42
|
-
handoffPath,
|
|
43
|
-
});
|
|
44
|
-
const observed = await computeDurableValidationBindings({
|
|
45
|
-
canonicalProjectId: payload.input.projectId,
|
|
46
|
-
specId: payload.input.specId,
|
|
47
|
-
projectPath,
|
|
48
101
|
specPath,
|
|
49
102
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
103
|
+
try {
|
|
104
|
+
const observedReceiptBindings = toValidationReceiptBindings(observed.bindings, observed.artifactDigests);
|
|
105
|
+
if (!(await bindValidationFreshnessLease(freshnessLease, observedReceiptBindings))) {
|
|
106
|
+
throw new Error('[Planu] Validation inputs changed while the snapshot was computed');
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
...normalizedPayload,
|
|
110
|
+
bindings: observed.bindings,
|
|
111
|
+
artifactDigests: observed.artifactDigests,
|
|
112
|
+
freshnessLease,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
await closeFreshnessLeaseWithoutMasking(freshnessLease);
|
|
117
|
+
throw error;
|
|
53
118
|
}
|
|
54
|
-
return {
|
|
55
|
-
...payload,
|
|
56
|
-
bindings: observed.bindings,
|
|
57
|
-
artifactDigests: observed.artifactDigests,
|
|
58
|
-
freshnessLease,
|
|
59
|
-
};
|
|
60
119
|
}
|
|
61
120
|
const expected = toValidationReceiptBindings(payload.bindings, payload.artifactDigests);
|
|
62
121
|
if (payload.freshnessLease &&
|
|
63
122
|
(await assertValidationFreshnessBarrier(payload.freshnessLease, expected))) {
|
|
64
|
-
return
|
|
123
|
+
return normalizedPayload;
|
|
65
124
|
}
|
|
66
|
-
const
|
|
67
|
-
await mkdir(handoffPath, { recursive: true });
|
|
68
|
-
const freshnessLease = await beginValidationFreshnessBarrier({
|
|
125
|
+
const { freshnessLease, observed } = await computeFreshSnapshot({
|
|
69
126
|
projectId: payload.bindings.projectId,
|
|
70
127
|
specId: payload.bindings.specId,
|
|
71
128
|
projectPath,
|
|
72
|
-
handoffPath,
|
|
73
|
-
});
|
|
74
|
-
const observed = await computeDurableValidationBindings({
|
|
75
|
-
canonicalProjectId: payload.bindings.projectId,
|
|
76
|
-
specId: payload.bindings.specId,
|
|
77
|
-
projectPath,
|
|
78
129
|
specPath,
|
|
79
130
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
131
|
+
try {
|
|
132
|
+
const observedReceiptBindings = toValidationReceiptBindings(observed.bindings, observed.artifactDigests);
|
|
133
|
+
if (JSON.stringify(expected) !== JSON.stringify(observedReceiptBindings) ||
|
|
134
|
+
!(await bindValidationFreshnessLease(freshnessLease, observedReceiptBindings))) {
|
|
135
|
+
throw new Error('[Planu] Durable validation bindings became stale; submit a new validation');
|
|
136
|
+
}
|
|
137
|
+
return { ...normalizedPayload, freshnessLease };
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
await closeFreshnessLeaseWithoutMasking(freshnessLease);
|
|
141
|
+
throw error;
|
|
84
142
|
}
|
|
85
|
-
return { ...payload, freshnessLease };
|
|
86
143
|
}
|
|
87
144
|
//# sourceMappingURL=validate-job-payload.js.map
|
|
@@ -3,7 +3,7 @@ function isValidatePayload(value) {
|
|
|
3
3
|
return Boolean(value &&
|
|
4
4
|
typeof value === 'object' &&
|
|
5
5
|
value.kind === 'validate' &&
|
|
6
|
-
value.schemaVersion ===
|
|
6
|
+
value.schemaVersion === 2);
|
|
7
7
|
}
|
|
8
8
|
/** Recover runnable validation work and program one global sweep for the earliest live lease. */
|
|
9
9
|
export function recoverValidateJobs(defaultSchedule, options = {}) {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { ValidateWorkerCall } from '../../types/validate-worker.js';
|
|
2
2
|
import type { ToolResult } from '../../types/index.js';
|
|
3
|
+
export declare class ValidationWorkerStalledError extends Error {
|
|
4
|
+
readonly code: 'VALIDATION_STALLED';
|
|
5
|
+
readonly lastPhase: string;
|
|
6
|
+
constructor(lastPhase: string);
|
|
7
|
+
}
|
|
3
8
|
/** Execute validation in a supervised OS worker thread, isolated from the MCP event loop. */
|
|
4
9
|
export declare function runValidateWorker(call: ValidateWorkerCall): Promise<ToolResult>;
|
|
5
10
|
//# sourceMappingURL=validate-worker-runtime.d.ts.map
|
|
@@ -3,6 +3,69 @@ import { existsSync } from 'node:fs';
|
|
|
3
3
|
import { resolve } from 'node:path';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
5
|
import { Worker } from 'node:worker_threads';
|
|
6
|
+
import { reportClassifiedDegradation } from '../../errors/classified-degradation.js';
|
|
7
|
+
import { getRuntimePolicy } from '../runtime-policy.js';
|
|
8
|
+
export class ValidationWorkerStalledError extends Error {
|
|
9
|
+
code = 'VALIDATION_STALLED';
|
|
10
|
+
lastPhase;
|
|
11
|
+
constructor(lastPhase) {
|
|
12
|
+
const phase = safePhase(lastPhase);
|
|
13
|
+
super(`[Planu] VALIDATION_STALLED: no semantic progress during ${phase}`);
|
|
14
|
+
this.name = 'ValidationWorkerStalledError';
|
|
15
|
+
this.lastPhase = phase;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function safePhase(phase) {
|
|
19
|
+
const normalized = phase.trim();
|
|
20
|
+
return /^[a-z][a-z0-9_-]{0,79}$/iu.test(normalized) ? normalized : 'redacted';
|
|
21
|
+
}
|
|
22
|
+
function semanticProgressAdvanced(previous, current) {
|
|
23
|
+
if (previous === undefined) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if (current.completedGates < previous.completedGates ||
|
|
27
|
+
current.lastProgressAt < previous.lastProgressAt) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return (current.phase !== previous.phase ||
|
|
31
|
+
current.status !== previous.status ||
|
|
32
|
+
current.completedGates > previous.completedGates);
|
|
33
|
+
}
|
|
34
|
+
class SemanticProgressWatchdog {
|
|
35
|
+
timeoutMs;
|
|
36
|
+
onStalled;
|
|
37
|
+
timer;
|
|
38
|
+
previous;
|
|
39
|
+
phase = 'startup';
|
|
40
|
+
constructor(timeoutMs, onStalled) {
|
|
41
|
+
this.timeoutMs = timeoutMs;
|
|
42
|
+
this.onStalled = onStalled;
|
|
43
|
+
}
|
|
44
|
+
start() {
|
|
45
|
+
this.arm();
|
|
46
|
+
}
|
|
47
|
+
observe(progress) {
|
|
48
|
+
if (!semanticProgressAdvanced(this.previous, progress)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.phase = progress.phase;
|
|
52
|
+
this.previous = progress;
|
|
53
|
+
this.arm();
|
|
54
|
+
}
|
|
55
|
+
dispose() {
|
|
56
|
+
if (this.timer !== undefined) {
|
|
57
|
+
clearTimeout(this.timer);
|
|
58
|
+
this.timer = undefined;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
arm() {
|
|
62
|
+
this.dispose();
|
|
63
|
+
this.timer = setTimeout(() => {
|
|
64
|
+
this.onStalled(this.phase);
|
|
65
|
+
}, this.timeoutMs);
|
|
66
|
+
this.timer.unref();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
6
69
|
function workerUrl() {
|
|
7
70
|
const sibling = new URL('./validate-worker-thread.js', import.meta.url);
|
|
8
71
|
if (existsSync(sibling)) {
|
|
@@ -15,6 +78,7 @@ function workerUrl() {
|
|
|
15
78
|
throw new Error('[Planu] Validate worker artifact is missing; run the production build');
|
|
16
79
|
}
|
|
17
80
|
/** Execute validation in a supervised OS worker thread, isolated from the MCP event loop. */
|
|
81
|
+
// eslint-disable-next-line max-lines-per-function -- lifecycle handlers stay co-located around one worker instance.
|
|
18
82
|
export function runValidateWorker(call) {
|
|
19
83
|
if (call.signal?.aborted) {
|
|
20
84
|
return Promise.reject(abortError(call.signal));
|
|
@@ -23,16 +87,29 @@ export function runValidateWorker(call) {
|
|
|
23
87
|
return Promise.reject(new Error('[Planu] Validate worker requires a future deadline'));
|
|
24
88
|
}
|
|
25
89
|
const secret = randomBytes(32).toString('hex');
|
|
26
|
-
const worker = new Worker(workerUrl(), { workerData: { secret } });
|
|
90
|
+
const worker = new Worker(workerUrl(), { workerData: { secret }, execArgv: [] });
|
|
91
|
+
// eslint-disable-next-line max-lines-per-function -- watchdog and authenticated worker share one settlement boundary
|
|
27
92
|
return new Promise((resolveCall, reject) => {
|
|
28
93
|
let settled = false;
|
|
29
94
|
let sent = false;
|
|
95
|
+
const watchdog = new SemanticProgressWatchdog(getRuntimePolicy().validation.noProgressTimeoutMs, (phase) => {
|
|
96
|
+
if (call.signal?.aborted) {
|
|
97
|
+
abort();
|
|
98
|
+
}
|
|
99
|
+
else if (Date.now() >= call.deadlineAt) {
|
|
100
|
+
finish(new Error('[Planu] Validate worker deadline exceeded'));
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
finish(new ValidationWorkerStalledError(phase));
|
|
104
|
+
}
|
|
105
|
+
});
|
|
30
106
|
const finish = (error, result) => {
|
|
31
107
|
if (settled) {
|
|
32
108
|
return;
|
|
33
109
|
}
|
|
34
110
|
settled = true;
|
|
35
111
|
clearTimeout(timer);
|
|
112
|
+
watchdog.dispose();
|
|
36
113
|
call.signal?.removeEventListener('abort', abort);
|
|
37
114
|
void worker.terminate();
|
|
38
115
|
if (error) {
|
|
@@ -52,6 +129,7 @@ export function runValidateWorker(call) {
|
|
|
52
129
|
finish(new Error('[Planu] Validate worker deadline exceeded'));
|
|
53
130
|
}, Math.max(1, call.deadlineAt - Date.now()));
|
|
54
131
|
timer.unref();
|
|
132
|
+
watchdog.start();
|
|
55
133
|
call.signal?.addEventListener('abort', abort, { once: true });
|
|
56
134
|
worker.once('error', (error) => {
|
|
57
135
|
finish(error instanceof Error ? error : new Error(String(error)));
|
|
@@ -62,6 +140,9 @@ export function runValidateWorker(call) {
|
|
|
62
140
|
}
|
|
63
141
|
});
|
|
64
142
|
worker.on('message', (value) => {
|
|
143
|
+
if (settled) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
65
146
|
const response = value;
|
|
66
147
|
if (response.kind === 'ready' && response.schemaVersion === 1 && !sent) {
|
|
67
148
|
const request = {
|
|
@@ -81,7 +162,14 @@ export function runValidateWorker(call) {
|
|
|
81
162
|
finish(new Error('[Planu] Validate worker response identity mismatch'));
|
|
82
163
|
}
|
|
83
164
|
else if (response.kind === 'validate-progress' && response.progress !== undefined) {
|
|
84
|
-
|
|
165
|
+
watchdog.observe(response.progress);
|
|
166
|
+
try {
|
|
167
|
+
call.onProgress?.(response.progress);
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
reportClassifiedDegradation('VALIDATE_WORKER_PROGRESS_CALLBACK_FAILURE', error);
|
|
171
|
+
finish(error instanceof Error ? error : new Error(String(error)));
|
|
172
|
+
}
|
|
85
173
|
}
|
|
86
174
|
else if (response.kind === 'validate-error') {
|
|
87
175
|
finish(new Error(response.message));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { parentPort, workerData } from 'node:worker_threads';
|
|
2
2
|
import { redactFailureMessage, reportClassifiedDegradation, } from '../../errors/classified-degradation.js';
|
|
3
|
+
import { createExecutionScope } from './context.js';
|
|
3
4
|
const bootstrap = workerData;
|
|
4
5
|
if (!parentPort || typeof bootstrap?.secret !== 'string' || bootstrap.secret.length < 32) {
|
|
5
6
|
throw new Error('[Planu] Validate worker bootstrap authentication failed');
|
|
@@ -26,30 +27,22 @@ async function execute(value) {
|
|
|
26
27
|
throw new Error('[Planu] Validate worker rejected malformed or expired work');
|
|
27
28
|
}
|
|
28
29
|
const { executeValidate } = await import('../../tools/validate.js');
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
requestId,
|
|
46
|
-
progress: {
|
|
47
|
-
phase: 'validation',
|
|
48
|
-
command: 'planu validate',
|
|
49
|
-
durationMs: Date.now() - startedAt,
|
|
50
|
-
status: result.isError === true ? 'failed' : 'passed',
|
|
51
|
-
},
|
|
52
|
-
});
|
|
30
|
+
const input = request.input;
|
|
31
|
+
const scope = createExecutionScope({ requestId, deadlineAt: request.deadlineAt });
|
|
32
|
+
let result;
|
|
33
|
+
try {
|
|
34
|
+
result = await scope.run(() => executeValidate(input, undefined, (progress) => {
|
|
35
|
+
port.postMessage({
|
|
36
|
+
kind: 'validate-progress',
|
|
37
|
+
schemaVersion: 1,
|
|
38
|
+
requestId,
|
|
39
|
+
progress,
|
|
40
|
+
});
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
scope.dispose();
|
|
45
|
+
}
|
|
53
46
|
port.postMessage({
|
|
54
47
|
kind: 'validate-result',
|
|
55
48
|
schemaVersion: 1,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type { ArtifactKind } from '../../types/handoff-artifacts.js';
|
|
2
|
+
import type { ArtifactKind, ReconciliationReceiptV1 } from '../../types/handoff-artifacts.js';
|
|
3
3
|
import type { ValidationOk, ValidationErr } from './validation-result.js';
|
|
4
4
|
export declare const SchemaVersion: z.ZodString;
|
|
5
5
|
export declare const IntakeV1Schema: z.ZodObject<{
|
|
@@ -157,6 +157,7 @@ export declare const ValidationReportV1Schema: z.ZodObject<{
|
|
|
157
157
|
score: z.ZodOptional<z.ZodNumber>;
|
|
158
158
|
completedAt: z.ZodISODateTime;
|
|
159
159
|
}, z.core.$strip>;
|
|
160
|
+
export declare const ReconciliationReceiptV1Schema: z.ZodType<ReconciliationReceiptV1>;
|
|
160
161
|
export declare const ARTIFACT_SCHEMAS: {
|
|
161
162
|
readonly intake: z.ZodObject<{
|
|
162
163
|
schema_version: z.ZodString;
|
|
@@ -121,6 +121,39 @@ export const ValidationReportV1Schema = z.object({
|
|
|
121
121
|
score: z.number().optional(),
|
|
122
122
|
completedAt: z.iso.datetime(),
|
|
123
123
|
});
|
|
124
|
+
export const ReconciliationReceiptV1Schema = z.object({
|
|
125
|
+
schema_version: z.literal('1.0.0'),
|
|
126
|
+
projectId: z.string().min(1),
|
|
127
|
+
specId: z.string().min(1),
|
|
128
|
+
requestId: z
|
|
129
|
+
.string()
|
|
130
|
+
.regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u),
|
|
131
|
+
sourceImplementingTransitionId: z.string().min(1),
|
|
132
|
+
sourceUpdatedAt: z.iso.datetime(),
|
|
133
|
+
bindingDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/u),
|
|
134
|
+
reasonDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/u),
|
|
135
|
+
implementationReviewDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/u),
|
|
136
|
+
supersededArtifacts: z.array(z.object({
|
|
137
|
+
artifactId: z.string().min(1),
|
|
138
|
+
sha256: z
|
|
139
|
+
.string()
|
|
140
|
+
.regex(/^sha256:[a-f0-9]{64}$/u)
|
|
141
|
+
.optional(),
|
|
142
|
+
})),
|
|
143
|
+
state: z.enum(['prepared', 'committed', 'aborted']),
|
|
144
|
+
stateHistory: z.array(z.object({
|
|
145
|
+
state: z.enum(['prepared', 'committed', 'aborted']),
|
|
146
|
+
at: z.iso.datetime(),
|
|
147
|
+
reason: z.string().optional(),
|
|
148
|
+
})),
|
|
149
|
+
preparedAt: z.iso.datetime(),
|
|
150
|
+
committedAt: z.iso.datetime().optional(),
|
|
151
|
+
abortedAt: z.iso.datetime().optional(),
|
|
152
|
+
committedTransitionId: z.string().min(1).optional(),
|
|
153
|
+
transitionId: z.string().min(1).optional(),
|
|
154
|
+
phase: z.enum(['prepared', 'status-committed', 'spec-synced', 'audit-appended']).optional(),
|
|
155
|
+
auditPending: z.boolean().optional(),
|
|
156
|
+
});
|
|
124
157
|
// ---------------------------------------------------------------------------
|
|
125
158
|
// Schema registry
|
|
126
159
|
// ---------------------------------------------------------------------------
|
|
@@ -1,3 +1,22 @@
|
|
|
1
1
|
import type { Spec, ProjectKnowledge, HandoffPackage } from '../types/index.js';
|
|
2
|
+
/** Normalize one repository-relative ownership path without retaining unsafe input in diagnostics. */
|
|
3
|
+
export declare function normalizeOwnedPath(value: string): {
|
|
4
|
+
status: 'valid';
|
|
5
|
+
path: string;
|
|
6
|
+
} | {
|
|
7
|
+
status: 'none';
|
|
8
|
+
} | {
|
|
9
|
+
status: 'invalid';
|
|
10
|
+
code: 'INVALID_FILE_OWNERSHIP_EMPTY' | 'INVALID_FILE_OWNERSHIP_FENCED' | 'INVALID_FILE_OWNERSHIP_NUL' | 'INVALID_FILE_OWNERSHIP_ABSOLUTE' | 'INVALID_FILE_OWNERSHIP_HOME_RELATIVE' | 'INVALID_FILE_OWNERSHIP_UNC' | 'INVALID_FILE_OWNERSHIP_DRIVE_ABSOLUTE' | 'INVALID_FILE_OWNERSHIP_URI' | 'INVALID_FILE_OWNERSHIP_TRAVERSAL' | 'INVALID_FILE_OWNERSHIP_MARKDOWN' | 'INVALID_FILE_OWNERSHIP_DESCRIPTION';
|
|
11
|
+
};
|
|
12
|
+
/** Normalize a raw traceability changed-file value without interpreting Markdown or prose. */
|
|
13
|
+
export declare function normalizeChangedFilePath(value: string): ReturnType<typeof normalizeOwnedPath>;
|
|
14
|
+
export declare function extractCanonicalFileOwnership(content: string): {
|
|
15
|
+
present: boolean;
|
|
16
|
+
toModify: string[];
|
|
17
|
+
toCreate: string[];
|
|
18
|
+
toTest: string[];
|
|
19
|
+
blockers: string[];
|
|
20
|
+
};
|
|
2
21
|
export declare function packageHandoff(spec: Spec, knowledge: ProjectKnowledge): Promise<HandoffPackage>;
|
|
3
22
|
//# sourceMappingURL=handoff-packager.d.ts.map
|