@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
|
@@ -3,28 +3,13 @@
|
|
|
3
3
|
import { usageStore } from '../storage/index.js';
|
|
4
4
|
import { filterEventsByPeriod } from '../engine/usage-tracker/core.js';
|
|
5
5
|
import { calculateUsageStats, formatStatsAsMarkdown } from '../engine/usage-tracker/stats.js';
|
|
6
|
-
import { calculateDaysSinceFirstRun, isTrialActive } from '../engine/usage-tracker/trial.js';
|
|
7
|
-
import { getCurrentTier } from './license-gate.js';
|
|
8
6
|
import { compactJson, compactResult } from './output-formatter.js';
|
|
9
7
|
export async function handleUsageReport(args) {
|
|
10
8
|
const format = args.format ?? 'markdown';
|
|
11
|
-
const tier = await getCurrentTier();
|
|
12
|
-
// Gather data from storage
|
|
13
9
|
const usageLog = await usageStore.getUsageLog();
|
|
14
|
-
const trialState = await usageStore.ensureTrialState();
|
|
15
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
16
|
-
const todayCount = await usageStore.getDailyCallCount(today);
|
|
17
|
-
// Compute context values
|
|
18
|
-
const daysSinceFirstRun = calculateDaysSinceFirstRun(trialState.firstRunAt);
|
|
19
|
-
const trialActive = isTrialActive(trialState.firstRunAt);
|
|
20
|
-
let remainingDailyCalls = -1;
|
|
21
|
-
if (tier === 'free') {
|
|
22
|
-
const dailyLimit = trialActive ? 50 : 30;
|
|
23
|
-
remainingDailyCalls = Math.max(0, dailyLimit - todayCount);
|
|
24
|
-
}
|
|
25
10
|
// Full report uses all events
|
|
26
11
|
const allEvents = filterEventsByPeriod(usageLog.events, 'all');
|
|
27
|
-
const stats = calculateUsageStats(allEvents, 0, 0
|
|
12
|
+
const stats = calculateUsageStats(allEvents, 0, 0);
|
|
28
13
|
if (format === 'json') {
|
|
29
14
|
return compactResult(compactJson(stats));
|
|
30
15
|
}
|
|
@@ -3,32 +3,15 @@
|
|
|
3
3
|
import { usageStore } from '../storage/index.js';
|
|
4
4
|
import { filterEventsByPeriod } from '../engine/usage-tracker/core.js';
|
|
5
5
|
import { calculateUsageStats, formatStatsAsMarkdown } from '../engine/usage-tracker/stats.js';
|
|
6
|
-
import { calculateDaysSinceFirstRun, isTrialActive } from '../engine/usage-tracker/trial.js';
|
|
7
|
-
import { getCurrentTier } from './license-gate.js';
|
|
8
6
|
import { addNextSteps } from './response-helpers.js';
|
|
9
7
|
import { t } from '../i18n/index.js';
|
|
10
8
|
export async function handleUsageStats(args) {
|
|
11
9
|
const period = args.period ?? '30d';
|
|
12
|
-
const tier = await getCurrentTier();
|
|
13
|
-
// Gather data from storage
|
|
14
10
|
const usageLog = await usageStore.getUsageLog();
|
|
15
|
-
const trialState = await usageStore.ensureTrialState();
|
|
16
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
17
|
-
const todayCount = await usageStore.getDailyCallCount(today);
|
|
18
|
-
// Compute context values
|
|
19
|
-
const daysSinceFirstRun = calculateDaysSinceFirstRun(trialState.firstRunAt);
|
|
20
|
-
const trialActive = isTrialActive(trialState.firstRunAt);
|
|
21
|
-
// Remaining daily calls: only relevant for Starter tier
|
|
22
|
-
let remainingDailyCalls = -1;
|
|
23
|
-
if (tier === 'free') {
|
|
24
|
-
const dailyLimit = trialActive ? 50 : 30;
|
|
25
|
-
remainingDailyCalls = Math.max(0, dailyLimit - todayCount);
|
|
26
|
-
}
|
|
27
11
|
// Filter events by period and calculate stats
|
|
28
12
|
const filteredEvents = filterEventsByPeriod(usageLog.events, period);
|
|
29
13
|
const stats = calculateUsageStats(filteredEvents, 0, // activeSpecs — placeholder, no cross-layer access to spec store
|
|
30
|
-
0
|
|
31
|
-
tier, daysSinceFirstRun, trialActive, remainingDailyCalls);
|
|
14
|
+
0);
|
|
32
15
|
const markdown = formatStatsAsMarkdown(stats);
|
|
33
16
|
const header = t('tools.response.statsTitle');
|
|
34
17
|
const withHeader = `${header}\n\n${markdown}`;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ToolResult } from '../types/index.js';
|
|
2
|
+
/** Record local tool health without entitlement, tier, trial, or quota behavior. */
|
|
3
|
+
export declare function withUsageTracking<T>(toolName: string, handler: (args: T, extra?: unknown) => Promise<ToolResult>): (args: T, extra?: unknown) => Promise<ToolResult>;
|
|
4
|
+
//# sourceMappingURL=usage-tracking.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { recordUsageEvent } from '../engine/usage-tracker/index.js';
|
|
2
|
+
import * as usageStore from '../storage/usage-store.js';
|
|
3
|
+
import { reportClassifiedDegradation } from '../errors/classified-degradation.js';
|
|
4
|
+
/** Record local tool health without entitlement, tier, trial, or quota behavior. */
|
|
5
|
+
export function withUsageTracking(toolName, handler) {
|
|
6
|
+
return async (args, extra) => {
|
|
7
|
+
const rawResult = (await handler(args, extra));
|
|
8
|
+
const result = rawResult ?? {
|
|
9
|
+
content: [{ type: 'text', text: 'Internal error: tool handler returned no result' }],
|
|
10
|
+
isError: true,
|
|
11
|
+
};
|
|
12
|
+
void usageStore
|
|
13
|
+
.appendUsageEvent(recordUsageEvent(toolName, result.isError !== true))
|
|
14
|
+
.catch((error) => {
|
|
15
|
+
reportClassifiedDegradation('USAGE_EVENT_WRITE_FAILED', error);
|
|
16
|
+
});
|
|
17
|
+
return result;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=usage-tracking.js.map
|
|
@@ -2,6 +2,7 @@ import type { LintCheckResult } from '../types/index.js';
|
|
|
2
2
|
interface LintCheckContext {
|
|
3
3
|
projectId?: string;
|
|
4
4
|
specId?: string;
|
|
5
|
+
maximumTimeoutMs?: number;
|
|
5
6
|
}
|
|
6
7
|
export declare function runLintCheck(projectPath: string, lintCommand: string | null, context?: LintCheckContext): Promise<LintCheckResult>;
|
|
7
8
|
export {};
|
|
@@ -80,7 +80,7 @@ export async function runLintCheck(projectPath, lintCommand, context = {}) {
|
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
const timeoutMs = lintCheckTimeoutMs();
|
|
83
|
+
const timeoutMs = Math.min(lintCheckTimeoutMs(), context.maximumTimeoutMs ?? Number.MAX_SAFE_INTEGER);
|
|
84
84
|
try {
|
|
85
85
|
const startedAt = Date.now();
|
|
86
86
|
const processResult = await runProjectCommandPlan(plan, projectPath, timeoutMs, getToolExecutionSignal());
|
package/dist/tools/validate.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import { validateContractCompliance } from '../engine/test-scaffold-generator.js';
|
|
3
3
|
import type { ValidateInput, ToolResult, ContractSpec, ContractValidation } from '../types/index.js';
|
|
4
|
+
import type { ValidateWorkerProgress } from '../types/validate-worker.js';
|
|
4
5
|
export { validateContractCompliance };
|
|
5
6
|
export type { ContractSpec, ContractValidation };
|
|
6
7
|
/** Public MCP boundary: persist and acknowledge validation work without running it inline. */
|
|
7
8
|
export declare function handleValidate(args: ValidateInput): Promise<ToolResult>;
|
|
8
|
-
export declare function executeValidate(args: ValidateInput, server?: McpServer): Promise<ToolResult>;
|
|
9
|
+
export declare function executeValidate(args: ValidateInput, server?: McpServer, onProgress?: (progress: ValidateWorkerProgress) => void): Promise<ToolResult>;
|
|
9
10
|
//# sourceMappingURL=validate.d.ts.map
|
package/dist/tools/validate.js
CHANGED
|
@@ -58,6 +58,7 @@ import { compactObj } from '../engine/compact-obj.js';
|
|
|
58
58
|
import { resolveProjectId, missingProjectIdError } from './resolve-project-id.js';
|
|
59
59
|
import { specStore, knowledgeStore } from '../storage/index.js';
|
|
60
60
|
import { validateSpec, generateDoR, generateDoD } from '../engine/validator.js';
|
|
61
|
+
import { isBlockingQualitySeverity } from '../engine/validator/dor-dod.js';
|
|
61
62
|
import { calcQualityScore } from '../engine/auditor-scoring.js';
|
|
62
63
|
import { dispatchFeedbackEvent } from './learn.js';
|
|
63
64
|
import { t, ti } from '../i18n/index.js';
|
|
@@ -74,14 +75,45 @@ import { runLintCheck } from './validate-lint.js';
|
|
|
74
75
|
import { checkPlanuUncommittedChanges, runAssuranceGates } from './validate-assurance.js';
|
|
75
76
|
import { applyValidateStructuredCompat } from './validate-structured-compat.js';
|
|
76
77
|
import { getToolExecutionSignal } from './safe-handler.js';
|
|
77
|
-
import {
|
|
78
|
+
import { DurableJobRuntime, publicJobCursor } from '../engine/execution/job-runtime.js';
|
|
78
79
|
import { scheduleValidateJobExecution } from '../engine/execution/validate-job-executor.js';
|
|
79
80
|
import { createPendingValidationSubmission } from '../engine/validation/durable-validation.js';
|
|
80
81
|
import { PROJECT_ID as CANONICAL_PROJECT_ID } from '../engine/validation/validation-receipt-codec.js';
|
|
81
82
|
import { acquireLock, releaseLock } from '../engine/safety/cross-process-lock.js';
|
|
82
83
|
import { getRuntimePolicy } from '../engine/runtime-policy.js';
|
|
84
|
+
import { resolveValidationWorktree, ValidationWorktreeError, } from '../engine/validation/validation-worktree.js';
|
|
83
85
|
// Re-export for external use (SPEC-018)
|
|
84
86
|
export { validateContractCompliance };
|
|
87
|
+
const VALIDATION_GATE_TOTAL = 8;
|
|
88
|
+
function createValidationStageRunner(onProgress) {
|
|
89
|
+
const startedAt = Date.now();
|
|
90
|
+
let completedGates = 0;
|
|
91
|
+
return async (phase, command, work) => {
|
|
92
|
+
const emit = (status) => {
|
|
93
|
+
onProgress?.({
|
|
94
|
+
phase,
|
|
95
|
+
command,
|
|
96
|
+
durationMs: Date.now() - startedAt,
|
|
97
|
+
completedGates,
|
|
98
|
+
totalGates: VALIDATION_GATE_TOTAL,
|
|
99
|
+
lastProgressAt: new Date().toISOString(),
|
|
100
|
+
status,
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
emit('running');
|
|
104
|
+
try {
|
|
105
|
+
const result = await work();
|
|
106
|
+
completedGates += 1;
|
|
107
|
+
emit('passed');
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
completedGates += 1;
|
|
112
|
+
emit('failed');
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
85
117
|
/** Public MCP boundary: persist and acknowledge validation work without running it inline. */
|
|
86
118
|
export async function handleValidate(args) {
|
|
87
119
|
const projectId = resolveProjectId(args);
|
|
@@ -130,7 +162,18 @@ export async function handleValidate(args) {
|
|
|
130
162
|
structuredContent: { error: 'project_not_found', code: 404, context: { projectId } },
|
|
131
163
|
};
|
|
132
164
|
}
|
|
133
|
-
|
|
165
|
+
let validationWorktree;
|
|
166
|
+
try {
|
|
167
|
+
validationWorktree = await resolveValidationWorktree({
|
|
168
|
+
requestedProjectPath: args.projectPath ?? knowledge.projectPath,
|
|
169
|
+
canonicalProjectPath: knowledge.projectPath,
|
|
170
|
+
canonicalSpecPath: spec.specPath,
|
|
171
|
+
specId: args.specId,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
return validationWorktreeErrorResult(error, args.specId);
|
|
176
|
+
}
|
|
134
177
|
const submissionLock = await acquireValidationSubmissionLock(projectId, args.specId);
|
|
135
178
|
try {
|
|
136
179
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
@@ -143,21 +186,30 @@ export async function handleValidate(args) {
|
|
|
143
186
|
payload.input?.specId === args.specId);
|
|
144
187
|
});
|
|
145
188
|
if (active) {
|
|
189
|
+
const activePayload = active.payload;
|
|
190
|
+
if (activePayload?.validationRootId !== validationWorktree.validationRootId) {
|
|
191
|
+
return validationWorktreeErrorResult(new ValidationWorktreeError('VALIDATION_ROOT_BUSY', args.specId), args.specId);
|
|
192
|
+
}
|
|
146
193
|
if (active.state === 'accepted' || active.state === 'checkpointed') {
|
|
147
194
|
scheduleValidateJobExecution(projectId, active.workspaceId);
|
|
148
195
|
}
|
|
149
|
-
return validationAcceptedResult(active, projectId);
|
|
196
|
+
return validationAcceptedResult(active, projectId, runtime);
|
|
150
197
|
}
|
|
151
198
|
const job = createPendingValidationSubmission({
|
|
152
199
|
runtime,
|
|
153
200
|
canonicalProjectId: projectId,
|
|
154
|
-
spec: {
|
|
201
|
+
spec: {
|
|
202
|
+
id: args.specId,
|
|
203
|
+
projectPath: validationWorktree.projectPath,
|
|
204
|
+
specPath: validationWorktree.relativeSpecPath,
|
|
205
|
+
validationRootId: validationWorktree.validationRootId,
|
|
206
|
+
},
|
|
155
207
|
deadlineAt: Date.now() + getRuntimePolicy().validation.defaultDeadlineMs,
|
|
156
208
|
});
|
|
157
209
|
if (job.state === 'accepted' || job.state === 'checkpointed') {
|
|
158
210
|
scheduleValidateJobExecution(projectId, job.workspaceId);
|
|
159
211
|
}
|
|
160
|
-
return validationAcceptedResult(job, projectId);
|
|
212
|
+
return validationAcceptedResult(job, projectId, runtime);
|
|
161
213
|
}
|
|
162
214
|
catch (e_1) {
|
|
163
215
|
env_1.error = e_1;
|
|
@@ -171,6 +223,23 @@ export async function handleValidate(args) {
|
|
|
171
223
|
await releaseLock(submissionLock);
|
|
172
224
|
}
|
|
173
225
|
}
|
|
226
|
+
function validationWorktreeErrorResult(error, specId) {
|
|
227
|
+
const failure = error instanceof ValidationWorktreeError
|
|
228
|
+
? error
|
|
229
|
+
: new ValidationWorktreeError('VALIDATION_ROOT_NOT_GIT_WORKTREE', specId);
|
|
230
|
+
return {
|
|
231
|
+
content: [{ type: 'text', text: failure.message }],
|
|
232
|
+
isError: true,
|
|
233
|
+
structuredContent: {
|
|
234
|
+
error: 'validation_worktree_rejected',
|
|
235
|
+
code: failure.code,
|
|
236
|
+
context: {
|
|
237
|
+
specId: failure.specId,
|
|
238
|
+
...(failure.relativeSpecPath ? { path: failure.relativeSpecPath } : {}),
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
}
|
|
174
243
|
async function acquireValidationSubmissionLock(projectId, specId) {
|
|
175
244
|
const policy = getRuntimePolicy().validation;
|
|
176
245
|
const deadlineAt = Date.now() + policy.submissionLockWaitMs;
|
|
@@ -188,7 +257,8 @@ async function acquireValidationSubmissionLock(projectId, specId) {
|
|
|
188
257
|
}
|
|
189
258
|
throw new Error('[Planu] Timed out waiting for the validation submission lock');
|
|
190
259
|
}
|
|
191
|
-
function validationAcceptedResult(job, projectId) {
|
|
260
|
+
function validationAcceptedResult(job, projectId, runtime) {
|
|
261
|
+
const observation = runtime.observe(job);
|
|
192
262
|
const accepted = {
|
|
193
263
|
schemaVersion: 1,
|
|
194
264
|
operationId: job.id,
|
|
@@ -196,7 +266,8 @@ function validationAcceptedResult(job, projectId) {
|
|
|
196
266
|
workspaceId: job.workspaceId,
|
|
197
267
|
state: job.state,
|
|
198
268
|
submittedAt: job.createdAt,
|
|
199
|
-
cursor:
|
|
269
|
+
cursor: publicJobCursor(observation),
|
|
270
|
+
queue: observation.queue,
|
|
200
271
|
terminalStates: ['completed', 'failed', 'cancelled', 'dead-letter'],
|
|
201
272
|
resultSchema: 'validate-completion/v1',
|
|
202
273
|
observation: {
|
|
@@ -213,7 +284,7 @@ function validationAcceptedResult(job, projectId) {
|
|
|
213
284
|
}
|
|
214
285
|
// SPEC-595: server? param enables elicitation for direct internal/test execution.
|
|
215
286
|
// eslint-disable-next-line max-lines-per-function -- validate orchestrates many existing gates in one handler.
|
|
216
|
-
export async function executeValidate(args, server) {
|
|
287
|
+
export async function executeValidate(args, server, onProgress) {
|
|
217
288
|
const { specId } = args;
|
|
218
289
|
const projectId = resolveProjectId(args);
|
|
219
290
|
if (!projectId) {
|
|
@@ -245,49 +316,56 @@ export async function executeValidate(args, server) {
|
|
|
245
316
|
},
|
|
246
317
|
};
|
|
247
318
|
}
|
|
248
|
-
const projectPath = knowledge.projectPath;
|
|
319
|
+
const projectPath = args.projectPath ?? knowledge.projectPath;
|
|
320
|
+
const executionSpec = args.specPath ? { ...spec, specPath: args.specPath } : spec;
|
|
321
|
+
const runStage = createValidationStageRunner(onProgress);
|
|
249
322
|
// SPEC-1017: fail closed when planu/ contains non-canonical artifacts.
|
|
250
|
-
const strictLayoutError = await validateStrictLayoutOrError({
|
|
323
|
+
const strictLayoutError = await runStage('layout', 'validate strict layout', () => validateStrictLayoutOrError({
|
|
251
324
|
projectPath,
|
|
252
325
|
specId,
|
|
253
|
-
specPath:
|
|
254
|
-
});
|
|
326
|
+
specPath: executionSpec.specPath,
|
|
327
|
+
}));
|
|
255
328
|
if (strictLayoutError !== null) {
|
|
256
329
|
return strictLayoutError;
|
|
257
330
|
}
|
|
258
|
-
const result = await
|
|
259
|
-
const graphCoverage = await buildGraphCoverageReport({ projectId, projectPath, specId });
|
|
260
|
-
const dor =
|
|
261
|
-
|
|
331
|
+
const result = await runStage('spec-scan', 'validate spec implementation', () => validateSpec(executionSpec, projectPath));
|
|
332
|
+
const graphCoverage = await runStage('graph', 'validate graph coverage', () => buildGraphCoverageReport({ projectId, projectPath, specId }));
|
|
333
|
+
const { dor, dod } = await runStage('definitions', 'validate ready and done definitions', async () => ({
|
|
334
|
+
dor: generateDoR(executionSpec),
|
|
335
|
+
dod: await generateDoD(executionSpec, result, undefined, projectPath),
|
|
336
|
+
}));
|
|
262
337
|
const implementationQualityScore = calcQualityScore(result.qualityIssues);
|
|
263
338
|
const auditedFiles = [...new Set(result.qualityIssues.map((i) => i.file))];
|
|
264
|
-
const { conventionViolations, regressionDetected } = await scanProjectConventions(projectId, projectPath);
|
|
265
|
-
const lintCheck = await runLintCheck(projectPath, knowledge.lintCommand ?? null, {
|
|
339
|
+
const { conventionViolations, regressionDetected } = await runStage('conventions', 'validate project conventions', () => scanProjectConventions(projectId, projectPath));
|
|
340
|
+
const lintCheck = await runStage('lint', knowledge.lintCommand ?? 'pnpm lint', () => runLintCheck(projectPath, knowledge.lintCommand ?? null, {
|
|
266
341
|
projectId,
|
|
267
342
|
specId,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
const minimalityReport = await
|
|
271
|
-
projectPath,
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
343
|
+
maximumTimeoutMs: getRuntimePolicy().validation.durableLintTimeoutMs,
|
|
344
|
+
}));
|
|
345
|
+
const { assuranceGates, minimalityReport } = await runStage('assurance', 'validate assurance and minimality', async () => ({
|
|
346
|
+
assuranceGates: runAssuranceGates(projectPath),
|
|
347
|
+
minimalityReport: await buildMinimalityReport({
|
|
348
|
+
projectPath,
|
|
349
|
+
specId,
|
|
350
|
+
risk: executionSpec.risk,
|
|
351
|
+
title: executionSpec.title,
|
|
352
|
+
missing: result.missing,
|
|
353
|
+
extra: result.extra,
|
|
354
|
+
qualityIssues: result.qualityIssues,
|
|
355
|
+
}),
|
|
356
|
+
}));
|
|
279
357
|
// SPEC-1050: Generate a mandatory implementation-review artifact.
|
|
280
|
-
const validationReport = await writeImplementationReviewReport({
|
|
358
|
+
const validationReport = await runStage('compliance', 'validate spec compliance', () => writeImplementationReviewReport({
|
|
281
359
|
projectId,
|
|
282
360
|
specId,
|
|
283
|
-
spec,
|
|
361
|
+
spec: executionSpec,
|
|
284
362
|
projectPath,
|
|
285
363
|
score: result.score,
|
|
286
364
|
lintPassed: lintCheck.passed,
|
|
287
365
|
conventionRegression: regressionDetected,
|
|
288
366
|
minimalityReport: minimalityReport ?? undefined,
|
|
289
367
|
signal: getToolExecutionSignal(),
|
|
290
|
-
});
|
|
368
|
+
}));
|
|
291
369
|
const effectiveResult = buildEffectiveValidationResult(result, validationReport.specCompliance);
|
|
292
370
|
const qualityGateSummary = buildQualityGateSummary({
|
|
293
371
|
conventionViolations,
|
|
@@ -299,7 +377,7 @@ export async function executeValidate(args, server) {
|
|
|
299
377
|
});
|
|
300
378
|
const output = {
|
|
301
379
|
specId,
|
|
302
|
-
title:
|
|
380
|
+
title: executionSpec.title,
|
|
303
381
|
score: effectiveResult.score,
|
|
304
382
|
fieldsImplemented: effectiveResult.fieldsImplemented,
|
|
305
383
|
fieldsTotal: effectiveResult.fieldsTotal,
|
|
@@ -654,7 +732,9 @@ function buildValidateStructuredContent(args) {
|
|
|
654
732
|
...args.result.missing.map((missing) => `missing: ${missing}`),
|
|
655
733
|
...args.indeterminate.map((item) => `indeterminate: ${item}`),
|
|
656
734
|
...args.qualityGateSummary.failures.map((failure) => `gate: ${failure}`),
|
|
657
|
-
...args.qualityIssues
|
|
735
|
+
...args.qualityIssues
|
|
736
|
+
.filter((issue) => isBlockingQualitySeverity(issue.severity))
|
|
737
|
+
.map((issue) => `${issue.rule}: ${issue.message}`),
|
|
658
738
|
];
|
|
659
739
|
const risks = [
|
|
660
740
|
...args.conventionCompliance.violations.map((violation) => violation.message),
|
|
@@ -41,7 +41,7 @@ function setSecurityHeaders(res) {
|
|
|
41
41
|
function setCorsHeaders(res, corsOrigin) {
|
|
42
42
|
res.setHeader('Access-Control-Allow-Origin', corsOrigin);
|
|
43
43
|
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, DELETE, OPTIONS');
|
|
44
|
-
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Accept, Authorization, x-api-key, mcp-session-id, Mcp-Session-Id, Last-Event-ID
|
|
44
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Accept, Authorization, x-api-key, mcp-session-id, Mcp-Session-Id, Last-Event-ID');
|
|
45
45
|
res.setHeader('Access-Control-Expose-Headers', 'Content-Type, mcp-session-id, Mcp-Session-Id');
|
|
46
46
|
}
|
|
47
47
|
function handleHealth(res) {
|
|
@@ -107,16 +107,14 @@ async function handlePost(req, res, sessionId, serverFactory, requestSignal) {
|
|
|
107
107
|
res.end(JSON.stringify({ error: 'Invalid JSON in request body' }));
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
|
-
// Existing session —
|
|
110
|
+
// Existing session — preserve isolated cancellation and identity context.
|
|
111
111
|
if (sessionId) {
|
|
112
112
|
const entry = sessions.get(sessionId);
|
|
113
113
|
if (entry) {
|
|
114
|
-
await runWithSessionContext({ sessionId,
|
|
114
|
+
await runWithSessionContext({ sessionId, signal: requestSignal }, () => handleNodeTransportRequest(entry.transport, req, res, parsedBody));
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
// Extract per-session license key from HTTP header (hosted multi-tenant mode)
|
|
119
|
-
const licenseKey = req.headers['x-planu-license-key']?.trim() ?? undefined;
|
|
120
118
|
// New session — create transport and connect a new server instance
|
|
121
119
|
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
122
120
|
sessionIdGenerator: () => randomUUID(),
|
|
@@ -130,10 +128,10 @@ async function handlePost(req, res, sessionId, serverFactory, requestSignal) {
|
|
|
130
128
|
};
|
|
131
129
|
const sessionServer = serverFactory();
|
|
132
130
|
await sessionServer.connect(transport);
|
|
133
|
-
await runWithSessionContext({ sessionId: transport.sessionId ?? sessionId ?? 'unknown',
|
|
131
|
+
await runWithSessionContext({ sessionId: transport.sessionId ?? sessionId ?? 'unknown', signal: requestSignal }, () => handleNodeTransportRequest(transport, req, res, parsedBody));
|
|
134
132
|
const newSessionId = transport.sessionId;
|
|
135
133
|
if (newSessionId) {
|
|
136
|
-
sessions.set(newSessionId, { transport, server: sessionServer
|
|
134
|
+
sessions.set(newSessionId, { transport, server: sessionServer });
|
|
137
135
|
}
|
|
138
136
|
}
|
|
139
137
|
async function handleMcpRequest(req, res, serverFactory, corsOrigin) {
|
|
@@ -176,7 +174,7 @@ async function handleMcpRequest(req, res, serverFactory, corsOrigin) {
|
|
|
176
174
|
if (sessionId) {
|
|
177
175
|
const entry = sessions.get(sessionId);
|
|
178
176
|
if (entry) {
|
|
179
|
-
await runWithSessionContext({ sessionId,
|
|
177
|
+
await runWithSessionContext({ sessionId, signal: cancellation.signal }, () => handleNodeTransportRequest(entry.transport, req, res));
|
|
180
178
|
return;
|
|
181
179
|
}
|
|
182
180
|
}
|
|
@@ -4,7 +4,5 @@ export type McpServerFactory = () => McpServer;
|
|
|
4
4
|
export interface SessionEntry {
|
|
5
5
|
transport: WebStandardStreamableHTTPServerTransport;
|
|
6
6
|
server: McpServer;
|
|
7
|
-
/** Per-session license key from HTTP header (hosted multi-tenant mode) */
|
|
8
|
-
licenseKey?: string;
|
|
9
7
|
}
|
|
10
8
|
//# sourceMappingURL=mcp-types.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// session-context.ts — Per-session context using AsyncLocalStorage.
|
|
2
|
-
//
|
|
2
|
+
// Isolates hosted request cancellation and session identity.
|
|
3
3
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
4
4
|
const sessionStore = new AsyncLocalStorage();
|
|
5
5
|
/**
|
|
@@ -66,7 +66,7 @@ export interface StateDriftAlert {
|
|
|
66
66
|
fix?: string;
|
|
67
67
|
}
|
|
68
68
|
/** SPEC-776: Result of verifyStateFiles() — describes whether planu/ state files are in sync. */
|
|
69
|
-
export interface
|
|
69
|
+
export interface StateFilesDriftReport {
|
|
70
70
|
drifted: boolean;
|
|
71
71
|
alerts: StateDriftAlert[];
|
|
72
72
|
}
|
package/dist/types/ci.d.ts
CHANGED
|
@@ -101,9 +101,6 @@ export interface PlanuCIConfig {
|
|
|
101
101
|
postComment: boolean;
|
|
102
102
|
badge: boolean;
|
|
103
103
|
};
|
|
104
|
-
license?: {
|
|
105
|
-
key: string;
|
|
106
|
-
};
|
|
107
104
|
}
|
|
108
105
|
/** Input for generating a planu-check CI workflow */
|
|
109
106
|
export interface GeneratePlanuCIInput {
|
|
@@ -163,6 +160,5 @@ export interface PlanuConfigOptions {
|
|
|
163
160
|
badge: boolean;
|
|
164
161
|
include?: string[];
|
|
165
162
|
exclude?: string[];
|
|
166
|
-
licenseKeyRef?: string;
|
|
167
163
|
}
|
|
168
164
|
//# sourceMappingURL=ci.d.ts.map
|
|
@@ -28,7 +28,7 @@ export interface PendingClarificationsFile {
|
|
|
28
28
|
/**
|
|
29
29
|
* Context passed to checkGate() to determine whether a tool call should proceed.
|
|
30
30
|
*/
|
|
31
|
-
export interface
|
|
31
|
+
export interface ClarificationGateContext {
|
|
32
32
|
projectId: string;
|
|
33
33
|
toolName: string;
|
|
34
34
|
specId?: string;
|
|
@@ -94,13 +94,6 @@ export interface SanctityHookDecision {
|
|
|
94
94
|
/** Error message displayed when blocking; undefined when allowed. */
|
|
95
95
|
errorMessage?: string;
|
|
96
96
|
}
|
|
97
|
-
/** Options for runPrecompactionDrain(). */
|
|
98
|
-
export interface PrecompactionDrainOptions {
|
|
99
|
-
/** Whether to skip side-effecting writes (for dry-run tests). */
|
|
100
|
-
dryRun?: boolean;
|
|
101
|
-
/** Branch patterns allowed for autopush (default: feat/*, fix/*, chore/*). */
|
|
102
|
-
autopushBranches?: string[];
|
|
103
|
-
}
|
|
104
97
|
/** Minimal line-emitting source for native hook subscriptions (subset of EventEmitter). */
|
|
105
98
|
export interface LineEmitter {
|
|
106
99
|
on(event: 'line', handler: (line: string) => void): void;
|
|
@@ -115,24 +108,4 @@ export interface ExitPlanModeAwaiter {
|
|
|
115
108
|
/** Manually resolve (used in tests and timeout paths). */
|
|
116
109
|
resolve(): void;
|
|
117
110
|
}
|
|
118
|
-
/** Summary returned by runPrecompactionDrain(). */
|
|
119
|
-
export interface PrecompactionDrainReport {
|
|
120
|
-
/** Number of learning entries written to MEMORY.md fragments. */
|
|
121
|
-
learningsFlushed: number;
|
|
122
|
-
/** Whether session-context.md was written successfully. */
|
|
123
|
-
sessionContextWritten: boolean;
|
|
124
|
-
/** Result of the autopush attempt. */
|
|
125
|
-
autopushResult: PrecompactionAutopushSummary;
|
|
126
|
-
/** Overall human-readable status line. */
|
|
127
|
-
humanSummary: string;
|
|
128
|
-
}
|
|
129
|
-
/** Compact autopush summary for the drain report. */
|
|
130
|
-
export type PrecompactionAutopushSummary = {
|
|
131
|
-
pushed: true;
|
|
132
|
-
ref: string;
|
|
133
|
-
commitsPushed: number;
|
|
134
|
-
} | {
|
|
135
|
-
pushed: false;
|
|
136
|
-
reason: string;
|
|
137
|
-
};
|
|
138
111
|
//# sourceMappingURL=claude-code-runtime.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type CommercialCleanupLockRunner = <T>(lockPath: string, operation: (assertFence: () => Promise<void>) => Promise<T>) => Promise<T>;
|
|
2
|
+
export interface RemoveCommercialStateOptions {
|
|
3
|
+
readonly globalDataPath?: string;
|
|
4
|
+
readonly legacyGlobalDataPaths?: readonly string[];
|
|
5
|
+
readonly lockPath?: string;
|
|
6
|
+
readonly hostConfigPaths?: readonly string[];
|
|
7
|
+
readonly strict?: boolean;
|
|
8
|
+
readonly lockRunner?: CommercialCleanupLockRunner;
|
|
9
|
+
readonly homeDirectory?: string;
|
|
10
|
+
readonly projectDirectory?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface RemoveCommercialStateResult {
|
|
13
|
+
readonly removedFiles: number;
|
|
14
|
+
readonly updatedFiles: number;
|
|
15
|
+
readonly errors: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=commercial-migration.d.ts.map
|
|
@@ -10,7 +10,6 @@ export type SpecScope = 'trivial' | 'feature' | 'cross-module' | 'architectural'
|
|
|
10
10
|
export type SpecTarget = 'frontend' | 'backend' | 'shared' | 'fullstack' | 'infrastructure' | 'database' | 'ios' | 'android';
|
|
11
11
|
export type ExecutionMode = 'local' | 'template' | 'light-llm' | 'full-llm';
|
|
12
12
|
export type SddPhase = 'initializing' | 'analyzing' | 'creating-spec' | 'filtering' | 'reviewing' | 'implementing' | 'validating' | 'documenting' | 'done';
|
|
13
|
-
export type PricingTier = 'free' | 'pro' | 'team' | 'enterprise';
|
|
14
13
|
export interface ToolResult {
|
|
15
14
|
[key: string]: unknown;
|
|
16
15
|
content: {
|
|
@@ -24,7 +23,6 @@ export interface NodeError extends Error {
|
|
|
24
23
|
code?: string;
|
|
25
24
|
}
|
|
26
25
|
export type TemplateMap = Record<string, Record<string, unknown>>;
|
|
27
|
-
export type PricingMap = Record<string, Record<string, number>>;
|
|
28
26
|
/** SPEC-340: Guided next action after a status transition */
|
|
29
27
|
export interface NextAction {
|
|
30
28
|
step: string;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { SpecAnnotation } from './living-spec/annotations.js';
|
|
2
|
+
export type { SpecAnnotation } from './living-spec/annotations.js';
|
|
1
3
|
export interface FileHash {
|
|
2
4
|
path: string;
|
|
3
5
|
hash: string;
|
|
@@ -7,14 +9,6 @@ export interface FileMetadata {
|
|
|
7
9
|
mtime: number;
|
|
8
10
|
size: number;
|
|
9
11
|
}
|
|
10
|
-
export interface SpecAnnotation {
|
|
11
|
-
specId: string;
|
|
12
|
-
criteria: number[];
|
|
13
|
-
description: string;
|
|
14
|
-
file: string;
|
|
15
|
-
line: number;
|
|
16
|
-
raw: string;
|
|
17
|
-
}
|
|
18
12
|
/** Versioned contract returned by a native runtime before it may execute work. */
|
|
19
13
|
export interface NativeRuntimeHandshake {
|
|
20
14
|
engineVersion: string;
|
|
@@ -140,7 +134,7 @@ export interface GapsLogChainResultRs {
|
|
|
140
134
|
totalEntries: number;
|
|
141
135
|
brokenAt: number | null;
|
|
142
136
|
}
|
|
143
|
-
export interface
|
|
137
|
+
export interface NativeVectorSearchResult {
|
|
144
138
|
id: string;
|
|
145
139
|
similarity: number;
|
|
146
140
|
}
|
|
@@ -233,7 +227,7 @@ export interface PlanuCore {
|
|
|
233
227
|
fastVerifyGapsChain(filePath: string): GapsLogChainResultRs;
|
|
234
228
|
fastAppendGapEntry(filePath: string, id: string, timestamp: string, specId: string, description: string, severity: string, affectedSpecs: string[]): string;
|
|
235
229
|
fastCosineSimilarity(v1: number[], v2: number[]): number;
|
|
236
|
-
fastHnswSearchFlat(query: number[], nodes: VectorNode[], topK: number):
|
|
230
|
+
fastHnswSearchFlat(query: number[], nodes: VectorNode[], topK: number): NativeVectorSearchResult[];
|
|
237
231
|
fastHmacSign(secret: string, data: string): string;
|
|
238
232
|
fastHmacVerify(secret: string, data: string, signature: string): boolean;
|
|
239
233
|
macosKeychainSet?(account: string, secret: Buffer): Promise<void>;
|
|
@@ -103,10 +103,7 @@ export interface SpecDetailData {
|
|
|
103
103
|
}
|
|
104
104
|
/** Usage stats panel data read from data/global/ (SPEC-064) */
|
|
105
105
|
export interface DashboardUsageStats {
|
|
106
|
-
tier: string;
|
|
107
106
|
callsToday: number;
|
|
108
|
-
dailyLimit: number | null;
|
|
109
|
-
trialDaysLeft: number | null;
|
|
110
107
|
isAvailable: boolean;
|
|
111
108
|
}
|
|
112
109
|
/** Raw structure of project.json files read by data-loader */
|
|
@@ -135,10 +132,9 @@ export interface RawSpecJson {
|
|
|
135
132
|
}
|
|
136
133
|
/** Raw structure of usage.json file read by data-loader */
|
|
137
134
|
export interface RawUsageJson {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
trialDaysLeft?: number | null;
|
|
135
|
+
events?: {
|
|
136
|
+
timestamp?: string;
|
|
137
|
+
}[];
|
|
142
138
|
}
|
|
143
139
|
/** A single event representing a change in project data */
|
|
144
140
|
export interface DashboardEvent {
|