@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
package/dist/engine/validator.js
CHANGED
|
@@ -6,8 +6,8 @@ import { extractCriteria, extractVerifyBlocks } from './validator/extractors.js'
|
|
|
6
6
|
import { scanCodeForSpec, checkCriterionEvidence, classifyDriftSeverity, quickQualityCheck, } from './validator/analyzer.js';
|
|
7
7
|
import { resolveApplicableDimensions } from './validator/scope-resolver.js';
|
|
8
8
|
import { buildHolisticReportFromFlatScore } from './validator/holistic-report.js';
|
|
9
|
-
import { readEvidenceArtifacts } from './evidence-gates/artifact-reader.js';
|
|
10
|
-
import { createCriterionIdentity } from './criterion-identity.js';
|
|
9
|
+
import { readEvidenceArtifacts, traceabilityRowHasCurrentCommandEvidence, traceabilityRowHasCurrentTestEvidence, } from './evidence-gates/artifact-reader.js';
|
|
10
|
+
import { createCriterionIdentity, hasExplicitCriterionId, normalizeCriterionText, } from './criterion-identity.js';
|
|
11
11
|
import { hashProjectPath } from '../storage/base-store.js';
|
|
12
12
|
// Re-export the full public API so external callers never need to know
|
|
13
13
|
// about the sub-module layout.
|
|
@@ -16,18 +16,6 @@ export { generateChecklist } from './validator/checklist.js';
|
|
|
16
16
|
// SPEC-730: export scope-resolver and holistic-report for consumers
|
|
17
17
|
export { resolveApplicableDimensions, normaliseScore } from './validator/scope-resolver.js';
|
|
18
18
|
export { buildHolisticReportFromFlatScore } from './validator/holistic-report.js';
|
|
19
|
-
function rowHasValidationEvidence(row) {
|
|
20
|
-
const hasImplementationEvidence = [
|
|
21
|
-
row.scenario?.trim(),
|
|
22
|
-
row.testEvidence?.length,
|
|
23
|
-
row.contractEvidence?.length,
|
|
24
|
-
row.manualEvidence?.trim(),
|
|
25
|
-
].some((value) => Boolean(value));
|
|
26
|
-
return (row.changedFiles.length > 0 &&
|
|
27
|
-
hasImplementationEvidence &&
|
|
28
|
-
Boolean(row.validationEvidence?.trim()) &&
|
|
29
|
-
Boolean(row.reviewerEvidence?.trim()));
|
|
30
|
-
}
|
|
31
19
|
async function readTraceabilityEvidence(spec, projectPath) {
|
|
32
20
|
try {
|
|
33
21
|
const artifacts = await readEvidenceArtifacts({
|
|
@@ -37,9 +25,30 @@ async function readTraceabilityEvidence(spec, projectPath) {
|
|
|
37
25
|
projectPath,
|
|
38
26
|
});
|
|
39
27
|
const rows = artifacts.traceabilityMatrix?.rows ?? [];
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
const exactRows = new Map();
|
|
29
|
+
for (const [rowIndex, row] of rows.entries()) {
|
|
30
|
+
const evidenceArgs = { projectId: hashProjectPath(projectPath), projectPath };
|
|
31
|
+
if (!traceabilityRowHasCurrentCommandEvidence(row, evidenceArgs) &&
|
|
32
|
+
!traceabilityRowHasCurrentTestEvidence(row, evidenceArgs)) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const identities = new Set(createCriterionIdentity(row.acceptanceCriterion, { index: rowIndex }).aliases);
|
|
36
|
+
if (row.scenario) {
|
|
37
|
+
const normalizedScenario = normalizeCriterionText(row.scenario);
|
|
38
|
+
if (normalizedScenario) {
|
|
39
|
+
identities.add(normalizedScenario);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
for (const identity of identities) {
|
|
43
|
+
if (!exactRows.has(identity)) {
|
|
44
|
+
exactRows.set(identity, row);
|
|
45
|
+
}
|
|
46
|
+
else if (exactRows.get(identity) !== row) {
|
|
47
|
+
exactRows.set(identity, undefined);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return new Map([...exactRows].filter((entry) => entry[1] !== undefined));
|
|
43
52
|
}
|
|
44
53
|
catch {
|
|
45
54
|
return new Map();
|
|
@@ -94,12 +103,16 @@ export async function validateSpec(spec, projectPath) {
|
|
|
94
103
|
const indeterminate = [];
|
|
95
104
|
const extra = [];
|
|
96
105
|
const qualityIssues = [];
|
|
97
|
-
for (
|
|
98
|
-
const criterion = criteria[criterionIndex] ?? '';
|
|
106
|
+
for (const [criterionIndex, criterion] of criteria.entries()) {
|
|
99
107
|
const verifyBlock = verifyBlockMap.get(criterion);
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
.
|
|
108
|
+
const criterionIdentity = createCriterionIdentity(criterion, { index: criterionIndex });
|
|
109
|
+
const aliases = hasExplicitCriterionId(criterion)
|
|
110
|
+
? criterionIdentity.aliases
|
|
111
|
+
: [criterionIdentity.normalizedText];
|
|
112
|
+
const evidenceRows = new Set(aliases
|
|
113
|
+
.map((alias) => traceabilityEvidence.get(alias))
|
|
114
|
+
.filter((row) => row !== undefined));
|
|
115
|
+
const evidenceRow = evidenceRows.size === 1 ? [...evidenceRows][0] : undefined;
|
|
103
116
|
if (evidenceRow !== undefined) {
|
|
104
117
|
matches.push(criterion);
|
|
105
118
|
continue;
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
// Creates the MCP server, registers tools & resources, and starts stdio transport.
|
|
4
4
|
import { installNetworkPolicy } from './engine/network-policy.js';
|
|
5
5
|
installNetworkPolicy();
|
|
6
|
+
// Remove obsolete entitlement state before CLI dispatch or MCP registration can read requests.
|
|
7
|
+
const { removeCommercialState } = await import('./engine/migrations/remove-commercial-state.js');
|
|
8
|
+
await removeCommercialState();
|
|
6
9
|
// CLI detection — intercept known commands before MCP server setup (SPEC-124)
|
|
7
10
|
const KNOWN_COMMANDS = [
|
|
8
11
|
'init',
|
|
@@ -19,7 +22,6 @@ const KNOWN_COMMANDS = [
|
|
|
19
22
|
'install',
|
|
20
23
|
'doctor',
|
|
21
24
|
'uninstall',
|
|
22
|
-
'activate',
|
|
23
25
|
'publish',
|
|
24
26
|
'watch',
|
|
25
27
|
'spec',
|
|
@@ -78,12 +80,10 @@ function scheduleStartupStateRecovery(startupSync, recoverPendingPostCommitTasks
|
|
|
78
80
|
}
|
|
79
81
|
// Loads post-handshake modules after the MCP handshake has completed.
|
|
80
82
|
// Separated from main() to keep main() within the 80-line function budget.
|
|
81
|
-
// eslint-disable-next-line max-lines-per-function -- startup dependency orchestration
|
|
82
83
|
async function setupPostHandshake(handshakeGate, officialToolNames) {
|
|
83
84
|
// Wait for initialize + notifications/initialized before firing any notifications.
|
|
84
85
|
await handshakeGate;
|
|
85
|
-
const
|
|
86
|
-
const [{ bootstrapAutopilotHandlers }, { registerAgentSquadHandlers }, { startupSync }, { recoverPendingPostCommitTasksAtStartup }, { startSpecCreatedOutboxConsumer }, { checkForUpdates }, { setConnectedClient }, { handleActivateLicense }, { GroupManager }, { setGroupManager },] = await Promise.all([
|
|
86
|
+
const [{ bootstrapAutopilotHandlers }, { registerAgentSquadHandlers }, { startupSync }, { recoverPendingPostCommitTasksAtStartup }, { startSpecCreatedOutboxConsumer }, { checkForUpdates }, { setConnectedClient }, { GroupManager }, { setGroupManager },] = await Promise.all([
|
|
87
87
|
import('./engine/autopilot/bootstrap.js'),
|
|
88
88
|
import('./tools/register-agent-squad-tools.js'),
|
|
89
89
|
import('./tools/sync-spec-state-handler.js'),
|
|
@@ -91,7 +91,6 @@ async function setupPostHandshake(handshakeGate, officialToolNames) {
|
|
|
91
91
|
import('./tools/create-spec/spec-created-outbox-consumer.js'),
|
|
92
92
|
import('./engine/update-notifier.js'),
|
|
93
93
|
import('./engine/llm-runtime/index.js'),
|
|
94
|
-
import('./tools/activate-license.js'),
|
|
95
94
|
import('./engine/tool-groups/group-manager.js'),
|
|
96
95
|
import('./tools/tool-group-handler.js'),
|
|
97
96
|
]);
|
|
@@ -130,17 +129,6 @@ async function setupPostHandshake(handshakeGate, officialToolNames) {
|
|
|
130
129
|
await startSpecCreatedOutboxConsumer().catch((err) => {
|
|
131
130
|
console.error('[Planu] Startup spec.created outbox recovery failed:', err);
|
|
132
131
|
});
|
|
133
|
-
// Auto-activate license from environment variable if present.
|
|
134
|
-
if (envKey) {
|
|
135
|
-
const { licenseStore: ls } = await import('./storage/index.js');
|
|
136
|
-
const existingState = await ls.getLicenseState().catch(() => null);
|
|
137
|
-
const alreadyActive = existingState?.licenseKey === envKey.trim();
|
|
138
|
-
if (!alreadyActive) {
|
|
139
|
-
await handleActivateLicense({ licenseKey: envKey }).catch((err) => {
|
|
140
|
-
console.error('[Planu] License activation from SDD_LICENSE_KEY failed:', err);
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
132
|
try {
|
|
145
133
|
const { registerPlanuMcpResources, registerPlanuMcpPrompts } = await import('./hosts/claude-code/ux/index.js');
|
|
146
134
|
registerPlanuMcpResources(server);
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
import { usageStore } from '../storage/index.js';
|
|
5
5
|
import { filterEventsByPeriod } from '../engine/usage-tracker/core.js';
|
|
6
6
|
import { calculateUsageStats } from '../engine/usage-tracker/stats.js';
|
|
7
|
-
import { calculateDaysSinceFirstRun, isTrialActive } from '../engine/usage-tracker/trial.js';
|
|
8
|
-
import { getCurrentTier } from '../tools/license-gate.js';
|
|
9
7
|
import { estimateTokenSavings } from '../engine/token-savings-estimator.js';
|
|
10
8
|
import { existsSync } from 'node:fs';
|
|
11
9
|
import { join } from 'node:path';
|
|
@@ -15,22 +13,10 @@ import { join } from 'node:path';
|
|
|
15
13
|
*/
|
|
16
14
|
export async function handleUsageStatsResource() {
|
|
17
15
|
const period = '30d';
|
|
18
|
-
const tier = await getCurrentTier();
|
|
19
16
|
const usageLog = await usageStore.getUsageLog();
|
|
20
|
-
const trialState = await usageStore.ensureTrialState();
|
|
21
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
22
|
-
const todayCount = await usageStore.getDailyCallCount(today);
|
|
23
|
-
const daysSinceFirstRun = calculateDaysSinceFirstRun(trialState.firstRunAt);
|
|
24
|
-
const trialActive = isTrialActive(trialState.firstRunAt);
|
|
25
|
-
let remainingDailyCalls = -1;
|
|
26
|
-
if (tier === 'free') {
|
|
27
|
-
const dailyLimit = trialActive ? 50 : 30;
|
|
28
|
-
remainingDailyCalls = Math.max(0, dailyLimit - todayCount);
|
|
29
|
-
}
|
|
30
17
|
const filteredEvents = filterEventsByPeriod(usageLog.events, period);
|
|
31
18
|
const stats = calculateUsageStats(filteredEvents, 0, // activeSpecs — placeholder, no cross-layer access to spec store
|
|
32
|
-
0
|
|
33
|
-
tier, daysSinceFirstRun, trialActive, remainingDailyCalls);
|
|
19
|
+
0);
|
|
34
20
|
const projectPath = process.cwd();
|
|
35
21
|
const hasRules = existsSync(join(projectPath, '.claude/rules/planu-response-style.md'));
|
|
36
22
|
const tokenSavings = estimateTokenSavings({
|
|
@@ -41,8 +27,6 @@ export async function handleUsageStatsResource() {
|
|
|
41
27
|
return JSON.stringify({
|
|
42
28
|
period,
|
|
43
29
|
generatedAt: new Date().toISOString(),
|
|
44
|
-
tier,
|
|
45
|
-
trialActive,
|
|
46
30
|
...stats,
|
|
47
31
|
tokenSavings,
|
|
48
32
|
}, null, 2);
|
|
@@ -50,7 +34,7 @@ export async function handleUsageStatsResource() {
|
|
|
50
34
|
export const usageStatsResourceDefinition = {
|
|
51
35
|
uri: 'planu://usage/stats',
|
|
52
36
|
name: 'Usage Stats',
|
|
53
|
-
description: 'Aggregated usage statistics for the last 30 days: tool call counts
|
|
37
|
+
description: 'Aggregated local usage statistics for the last 30 days: tool call counts and health. ' +
|
|
54
38
|
'Read-only. For custom periods use the usage_stats tool.',
|
|
55
39
|
mimeType: 'application/json',
|
|
56
40
|
};
|
|
@@ -39,9 +39,13 @@ export class LinuxSecretServiceAdapter {
|
|
|
39
39
|
return result.stdout.trim() || null;
|
|
40
40
|
}
|
|
41
41
|
catch (error) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
const failure = error;
|
|
43
|
+
if ((failure.code === 1 || failure.code === '1') &&
|
|
44
|
+
(failure.stderr === undefined ||
|
|
45
|
+
(typeof failure.stderr === 'string' && failure.stderr.trim().length === 0))) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
throw error;
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
async set(id, value) {
|
|
@@ -3,7 +3,7 @@ import { promisify } from 'node:util';
|
|
|
3
3
|
import { reportClassifiedDegradation } from '../../errors/classified-degradation.js';
|
|
4
4
|
const execFile = promisify(execFileCallback);
|
|
5
5
|
const TIMEOUT_MS = 10_000;
|
|
6
|
-
const GET_SCRIPT = "$v=New-Object Windows.Security.Credentials.PasswordVault
|
|
6
|
+
const GET_SCRIPT = "$v=New-Object Windows.Security.Credentials.PasswordVault;try{$c=$v.Retrieve('Planu',$args[0]);$c.RetrievePassword();[Console]::Out.Write($c.Password)}catch{if($_.Exception.HResult -eq -2147023728){exit 3};throw}";
|
|
7
7
|
const SET_SCRIPT = "$v=New-Object Windows.Security.Credentials.PasswordVault;$p=[Console]::In.ReadToEnd();$v.Add((New-Object Windows.Security.Credentials.PasswordCredential('Planu',$args[0],$p)))";
|
|
8
8
|
const DELETE_SCRIPT = "$v=New-Object Windows.Security.Credentials.PasswordVault;$c=$v.Retrieve('Planu',$args[0]);$v.Remove($c)";
|
|
9
9
|
async function storeWithoutArgv(id, value) {
|
|
@@ -37,9 +37,11 @@ export class WindowsCredentialManagerAdapter {
|
|
|
37
37
|
return result.stdout || null;
|
|
38
38
|
}
|
|
39
39
|
catch (error) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
const failure = error;
|
|
41
|
+
if (failure.code === 3 || failure.code === '3') {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
throw error;
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
async set(id, value) {
|
|
@@ -25,6 +25,11 @@ const VALID_STATUSES = [
|
|
|
25
25
|
'done',
|
|
26
26
|
'discarded',
|
|
27
27
|
];
|
|
28
|
+
function containsReconciliationAuthorityFields(body) {
|
|
29
|
+
return ('reconciliationRequestId' in body ||
|
|
30
|
+
'expectedImplementingTransitionId' in body ||
|
|
31
|
+
'implementationReviewDigest' in body);
|
|
32
|
+
}
|
|
28
33
|
/** Resolve projectPath from the request Host header or fallback to process.cwd(). */
|
|
29
34
|
function getProjectPath(ctx) {
|
|
30
35
|
// The server is started with a projectPath; it is injected via the request context
|
|
@@ -188,6 +193,11 @@ export async function handleUpdateSpecStatus(ctx) {
|
|
|
188
193
|
return;
|
|
189
194
|
}
|
|
190
195
|
const { status } = body;
|
|
196
|
+
if (containsReconciliationAuthorityFields(body)) {
|
|
197
|
+
ctx.res.writeHead(403, { 'Content-Type': 'application/json' });
|
|
198
|
+
ctx.res.end(JSON.stringify({ error: 'Reconciliation is available only through local MCP.' }));
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
191
201
|
if (typeof status !== 'string' || !VALID_STATUSES.includes(status)) {
|
|
192
202
|
sendBadRequest(ctx.res, `Field "status" is required. Valid values: ${VALID_STATUSES.join(', ')}`);
|
|
193
203
|
return;
|
|
@@ -59,7 +59,7 @@ export declare function projectDataDir(projectId: string): string;
|
|
|
59
59
|
* Layout: <platform-data-root>/planu/global/ (absolute, independent of cwd)
|
|
60
60
|
*
|
|
61
61
|
* Using an absolute path anchored to the user's home directory ensures that
|
|
62
|
-
* global state (
|
|
62
|
+
* global state (usage and registered projects) persists across sessions
|
|
63
63
|
* regardless of which project directory the MCP server is started from.
|
|
64
64
|
*
|
|
65
65
|
* Override via PLANU_GLOBAL_DATA_DIR environment variable (useful in tests
|
|
@@ -168,7 +168,7 @@ export function projectDataDir(projectId) {
|
|
|
168
168
|
* Layout: <platform-data-root>/planu/global/ (absolute, independent of cwd)
|
|
169
169
|
*
|
|
170
170
|
* Using an absolute path anchored to the user's home directory ensures that
|
|
171
|
-
* global state (
|
|
171
|
+
* global state (usage and registered projects) persists across sessions
|
|
172
172
|
* regardless of which project directory the MCP server is started from.
|
|
173
173
|
*
|
|
174
174
|
* Override via PLANU_GLOBAL_DATA_DIR environment variable (useful in tests
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { FeedbackRemoteResult, RemoteFeedbackPayload } from '../types/feedback.js';
|
|
2
|
-
export declare const DEFAULT_FEEDBACK_API = "https://canusqigtzldstnjddio.supabase.co/functions/v1/license-api/feedback";
|
|
3
2
|
export type { RemoteFeedbackPayload };
|
|
4
|
-
export declare function resolveFeedbackEndpoint(endpoint?: string): string;
|
|
3
|
+
export declare function resolveFeedbackEndpoint(endpoint?: string): string | undefined;
|
|
5
4
|
export declare function sanitizeRemoteFeedbackPayload(payload: RemoteFeedbackPayload): RemoteFeedbackPayload;
|
|
6
5
|
export declare function deliverFeedbackRemote(payload: RemoteFeedbackPayload, endpoint?: string): Promise<FeedbackRemoteResult>;
|
|
7
6
|
/**
|
|
8
|
-
* Send feedback to
|
|
7
|
+
* Send feedback to the explicitly configured remote endpoint (fire-and-forget).
|
|
9
8
|
* Never throws. Returns true if sent successfully, false otherwise.
|
|
10
9
|
*/
|
|
11
10
|
export declare function sendFeedbackRemote(payload: RemoteFeedbackPayload): Promise<boolean>;
|
|
@@ -1,8 +1,34 @@
|
|
|
1
|
-
// storage/feedback-remote.ts —
|
|
1
|
+
// storage/feedback-remote.ts — Configured remote feedback relay (fire-and-forget)
|
|
2
2
|
// No PII is ever sent: no project paths, no user names, no emails.
|
|
3
|
-
|
|
3
|
+
import { networkFetch, withNetworkConsent } from '../engine/network-policy.js';
|
|
4
|
+
function resolveConfiguredFeedbackEndpoint(endpoint) {
|
|
5
|
+
const configured = endpoint ?? process.env.PLANU_FEEDBACK_ENDPOINT;
|
|
6
|
+
const trimmed = configured?.trim();
|
|
7
|
+
return trimmed === '' ? undefined : trimmed;
|
|
8
|
+
}
|
|
9
|
+
function isLoopbackHost(hostname) {
|
|
10
|
+
return hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '[::1]';
|
|
11
|
+
}
|
|
12
|
+
function parseSafeFeedbackEndpoint(endpoint) {
|
|
13
|
+
const url = URL.parse(endpoint);
|
|
14
|
+
if (url === null) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const safe = url.username === '' &&
|
|
18
|
+
url.password === '' &&
|
|
19
|
+
(url.protocol === 'https:' || (url.protocol === 'http:' && isLoopbackHost(url.hostname)));
|
|
20
|
+
return safe ? url : undefined;
|
|
21
|
+
}
|
|
22
|
+
function observableFeedbackEndpoint(url) {
|
|
23
|
+
return `${url.origin}${url.pathname}`;
|
|
24
|
+
}
|
|
4
25
|
export function resolveFeedbackEndpoint(endpoint) {
|
|
5
|
-
|
|
26
|
+
const configured = resolveConfiguredFeedbackEndpoint(endpoint);
|
|
27
|
+
if (configured === undefined) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
const url = parseSafeFeedbackEndpoint(configured);
|
|
31
|
+
return url === undefined ? undefined : observableFeedbackEndpoint(url);
|
|
6
32
|
}
|
|
7
33
|
function redactSensitiveText(value) {
|
|
8
34
|
return value
|
|
@@ -20,63 +46,51 @@ export function sanitizeRemoteFeedbackPayload(payload) {
|
|
|
20
46
|
};
|
|
21
47
|
}
|
|
22
48
|
export async function deliverFeedbackRemote(payload, endpoint) {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
url = new URL(resolvedEndpoint);
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
49
|
+
const configuredEndpoint = resolveConfiguredFeedbackEndpoint(endpoint);
|
|
50
|
+
if (configuredEndpoint === undefined) {
|
|
29
51
|
return {
|
|
30
52
|
ok: false,
|
|
31
53
|
status: 'skipped',
|
|
32
|
-
|
|
33
|
-
error: 'Invalid feedback endpoint URL.',
|
|
54
|
+
error: 'Remote feedback endpoint is not configured.',
|
|
34
55
|
};
|
|
35
56
|
}
|
|
36
|
-
|
|
57
|
+
const url = parseSafeFeedbackEndpoint(configuredEndpoint);
|
|
58
|
+
if (url === undefined) {
|
|
37
59
|
return {
|
|
38
60
|
ok: false,
|
|
39
61
|
status: 'skipped',
|
|
40
|
-
|
|
41
|
-
error: 'Feedback endpoint must use HTTPS.',
|
|
62
|
+
error: 'Remote feedback endpoint configuration is invalid.',
|
|
42
63
|
};
|
|
43
64
|
}
|
|
44
|
-
const
|
|
45
|
-
const timeout = setTimeout(() => {
|
|
46
|
-
controller.abort();
|
|
47
|
-
}, 5000);
|
|
65
|
+
const observableEndpoint = observableFeedbackEndpoint(url);
|
|
48
66
|
try {
|
|
49
|
-
const res = await
|
|
67
|
+
const res = await withNetworkConsent('feedback', (receipt) => networkFetch(receipt, configuredEndpoint, {
|
|
50
68
|
method: 'POST',
|
|
51
69
|
headers: { 'Content-Type': 'application/json' },
|
|
52
70
|
body: JSON.stringify(sanitizeRemoteFeedbackPayload(payload)),
|
|
53
|
-
signal:
|
|
54
|
-
});
|
|
71
|
+
signal: AbortSignal.timeout(5_000),
|
|
72
|
+
}));
|
|
55
73
|
if (res.ok) {
|
|
56
|
-
return { ok: true, status: 'synced', endpoint:
|
|
74
|
+
return { ok: true, status: 'synced', endpoint: observableEndpoint };
|
|
57
75
|
}
|
|
58
76
|
return {
|
|
59
77
|
ok: false,
|
|
60
78
|
status: 'failed',
|
|
61
|
-
endpoint:
|
|
79
|
+
endpoint: observableEndpoint,
|
|
62
80
|
error: `Remote feedback endpoint returned HTTP ${res.status}.`,
|
|
63
81
|
};
|
|
64
82
|
}
|
|
65
|
-
catch
|
|
66
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
83
|
+
catch {
|
|
67
84
|
return {
|
|
68
85
|
ok: false,
|
|
69
86
|
status: 'failed',
|
|
70
|
-
endpoint:
|
|
71
|
-
error:
|
|
87
|
+
endpoint: observableEndpoint,
|
|
88
|
+
error: 'Remote feedback request failed.',
|
|
72
89
|
};
|
|
73
90
|
}
|
|
74
|
-
finally {
|
|
75
|
-
clearTimeout(timeout);
|
|
76
|
-
}
|
|
77
91
|
}
|
|
78
92
|
/**
|
|
79
|
-
* Send feedback to
|
|
93
|
+
* Send feedback to the explicitly configured remote endpoint (fire-and-forget).
|
|
80
94
|
* Never throws. Returns true if sent successfully, false otherwise.
|
|
81
95
|
*/
|
|
82
96
|
export async function sendFeedbackRemote(payload) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GlobalConfig, SupportedLocale, ExperienceLevel, TemplateMap,
|
|
1
|
+
import type { GlobalConfig, SupportedLocale, ExperienceLevel, TemplateMap, LearnedRegistryEntry, TokenUsage, DeveloperPreference, ImprovementOverride, LessonLearned } from '../types/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Get the global configuration. Returns defaults when no config file exists.
|
|
4
4
|
*/
|
|
@@ -43,22 +43,6 @@ export declare function deleteTemplate(key: string): Promise<boolean>;
|
|
|
43
43
|
* List all template keys.
|
|
44
44
|
*/
|
|
45
45
|
export declare function listTemplateKeys(): Promise<string[]>;
|
|
46
|
-
/**
|
|
47
|
-
* Get all pricing data.
|
|
48
|
-
*/
|
|
49
|
-
export declare function getPricing(): Promise<PricingMap>;
|
|
50
|
-
/**
|
|
51
|
-
* Get a pricing tier by key.
|
|
52
|
-
*/
|
|
53
|
-
export declare function getPricingTier(key: string): Promise<Record<string, number> | null>;
|
|
54
|
-
/**
|
|
55
|
-
* Set or overwrite a pricing tier.
|
|
56
|
-
*/
|
|
57
|
-
export declare function setPricingTier(key: string, tier: Record<string, number>): Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* Delete a pricing tier. Returns `true` if it existed.
|
|
60
|
-
*/
|
|
61
|
-
export declare function deletePricingTier(key: string): Promise<boolean>;
|
|
62
46
|
/**
|
|
63
47
|
* Get all learned registry entries across all registry types.
|
|
64
48
|
*/
|
|
@@ -8,9 +8,6 @@ function configFile() {
|
|
|
8
8
|
function templatesFile() {
|
|
9
9
|
return `${globalDataDir()}/templates.json`;
|
|
10
10
|
}
|
|
11
|
-
function pricingFile() {
|
|
12
|
-
return `${globalDataDir()}/pricing.json`;
|
|
13
|
-
}
|
|
14
11
|
// --- defaults ---
|
|
15
12
|
const DEFAULT_CONFIG = {
|
|
16
13
|
defaultLocale: 'en',
|
|
@@ -19,7 +16,7 @@ const DEFAULT_CONFIG = {
|
|
|
19
16
|
pricingOpusPerMToken: 15,
|
|
20
17
|
pricingSonnetPerMToken: 3,
|
|
21
18
|
};
|
|
22
|
-
// TemplateMap
|
|
19
|
+
// TemplateMap imported from types/index.js
|
|
23
20
|
// --- Global Config ---
|
|
24
21
|
/**
|
|
25
22
|
* Get the global configuration. Returns defaults when no config file exists.
|
|
@@ -105,44 +102,6 @@ export async function listTemplateKeys() {
|
|
|
105
102
|
const templates = await getTemplates();
|
|
106
103
|
return Object.keys(templates);
|
|
107
104
|
}
|
|
108
|
-
// --- Pricing ---
|
|
109
|
-
/**
|
|
110
|
-
* Get all pricing data.
|
|
111
|
-
*/
|
|
112
|
-
export async function getPricing() {
|
|
113
|
-
return readJson(pricingFile(), {});
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Get a pricing tier by key.
|
|
117
|
-
*/
|
|
118
|
-
export async function getPricingTier(key) {
|
|
119
|
-
const pricing = await getPricing();
|
|
120
|
-
return pricing[key] ?? null;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Set or overwrite a pricing tier.
|
|
124
|
-
*/
|
|
125
|
-
export async function setPricingTier(key, tier) {
|
|
126
|
-
await withFileLock(pricingFile(), async () => {
|
|
127
|
-
const pricing = await getPricing();
|
|
128
|
-
pricing[key] = tier;
|
|
129
|
-
await writeJson(pricingFile(), pricing);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Delete a pricing tier. Returns `true` if it existed.
|
|
134
|
-
*/
|
|
135
|
-
export async function deletePricingTier(key) {
|
|
136
|
-
return withFileLock(pricingFile(), async () => {
|
|
137
|
-
const pricing = await getPricing();
|
|
138
|
-
if (!(key in pricing)) {
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
const { [key]: _, ...rest } = pricing;
|
|
142
|
-
await writeJson(pricingFile(), rest);
|
|
143
|
-
return true;
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
105
|
// --- Learned Registries (SPEC-011) ---
|
|
147
106
|
function learnedRegistriesFile() {
|
|
148
107
|
return `${globalDataDir()}/learned-registries.json`;
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -10,10 +10,8 @@ export * as patternStore from './pattern-store.js';
|
|
|
10
10
|
export * as knowledgeStore from './knowledge-store.js';
|
|
11
11
|
export * as globalStore from './global-store.js';
|
|
12
12
|
export * as decisionStore from './decision-store.js';
|
|
13
|
-
export * as licenseStore from './license-store.js';
|
|
14
13
|
export * as usageStore from './usage-store.js';
|
|
15
14
|
export * as hooksStore from './hooks-store.js';
|
|
16
|
-
export * as sessionStore from './session-store.js';
|
|
17
15
|
export * as hashSnapshotStore from './hash-snapshot-store.js';
|
|
18
16
|
export * as livingDashboardStore from './living-dashboard-store.js';
|
|
19
17
|
export * as syncLogStore from './sync-log-store.js';
|
package/dist/storage/index.js
CHANGED
|
@@ -11,10 +11,8 @@ export * as patternStore from './pattern-store.js';
|
|
|
11
11
|
export * as knowledgeStore from './knowledge-store.js';
|
|
12
12
|
export * as globalStore from './global-store.js';
|
|
13
13
|
export * as decisionStore from './decision-store.js';
|
|
14
|
-
export * as licenseStore from './license-store.js';
|
|
15
14
|
export * as usageStore from './usage-store.js';
|
|
16
15
|
export * as hooksStore from './hooks-store.js';
|
|
17
|
-
export * as sessionStore from './session-store.js';
|
|
18
16
|
export * as hashSnapshotStore from './hash-snapshot-store.js';
|
|
19
17
|
export * as livingDashboardStore from './living-dashboard-store.js';
|
|
20
18
|
export * as syncLogStore from './sync-log-store.js';
|