peaks-loop 4.1.3 → 4.1.5
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/.claude-plugin/marketplace.json +7 -2
- package/CHANGELOG.md +168 -0
- package/README-en.md +1 -1
- package/README.md +1 -1
- package/dist/cli/cli-helpers.d.ts +20 -0
- package/dist/cli/cli-helpers.js +34 -0
- package/dist/cli/commands/_register.js +2 -0
- package/dist/cli/commands/asset-command-shared.d.ts +12 -0
- package/dist/cli/commands/asset-command-shared.js +45 -0
- package/dist/cli/commands/asset-commands.d.ts +6 -1
- package/dist/cli/commands/asset-commands.js +11 -372
- package/dist/cli/commands/asset-crystallize-command.d.ts +3 -0
- package/dist/cli/commands/asset-crystallize-command.js +60 -0
- package/dist/cli/commands/asset-crystallize-payload.d.ts +47 -0
- package/dist/cli/commands/asset-crystallize-payload.js +85 -0
- package/dist/cli/commands/asset-crystallize-runner.d.ts +3 -0
- package/dist/cli/commands/asset-crystallize-runner.js +133 -0
- package/dist/cli/commands/asset-dispose-command.d.ts +3 -0
- package/dist/cli/commands/asset-dispose-command.js +99 -0
- package/dist/cli/commands/asset-status-command.d.ts +3 -0
- package/dist/cli/commands/asset-status-command.js +100 -0
- package/dist/cli/commands/baseline-audit-command.d.ts +3 -0
- package/dist/cli/commands/baseline-audit-command.js +64 -0
- package/dist/cli/commands/baseline-command-shared.d.ts +23 -0
- package/dist/cli/commands/baseline-command-shared.js +39 -0
- package/dist/cli/commands/baseline-commands.js +33 -313
- package/dist/cli/commands/baseline-freeze-commands.d.ts +4 -0
- package/dist/cli/commands/baseline-freeze-commands.js +81 -0
- package/dist/cli/commands/baseline-guard-command.d.ts +3 -0
- package/dist/cli/commands/baseline-guard-command.js +52 -0
- package/dist/cli/commands/baseline-read-commands.d.ts +5 -0
- package/dist/cli/commands/baseline-read-commands.js +72 -0
- package/dist/cli/commands/baseline-rollback-commands.d.ts +4 -0
- package/dist/cli/commands/baseline-rollback-commands.js +88 -0
- package/dist/cli/commands/classify-downgrade-command.d.ts +9 -0
- package/dist/cli/commands/classify-downgrade-command.js +21 -0
- package/dist/cli/commands/classify-run-command.d.ts +9 -0
- package/dist/cli/commands/classify-run-command.js +73 -0
- package/dist/cli/commands/classify-signals.d.ts +5 -0
- package/dist/cli/commands/classify-signals.js +104 -0
- package/dist/cli/commands/code-commands.d.ts +6 -4
- package/dist/cli/commands/code-commands.js +6 -4
- package/dist/cli/commands/code-emit-handoff-command.js +40 -3
- package/dist/cli/commands/code-gate-command.d.ts +5 -5
- package/dist/cli/commands/code-gate-command.js +49 -9
- package/dist/cli/commands/code-gate-step-08-command.js +25 -9
- package/dist/cli/commands/code-mode-gate-plan-command.d.ts +1 -1
- package/dist/cli/commands/code-mode-gate-plan-command.js +2 -2
- package/dist/cli/commands/codegraph-command-options.d.ts +22 -0
- package/dist/cli/commands/codegraph-command-options.js +22 -0
- package/dist/cli/commands/codegraph-commands.d.ts +2 -2
- package/dist/cli/commands/codegraph-commands.js +14 -397
- package/dist/cli/commands/codegraph-config-restore-command.d.ts +3 -0
- package/dist/cli/commands/codegraph-config-restore-command.js +200 -0
- package/dist/cli/commands/codegraph-proxy-commands.d.ts +10 -0
- package/dist/cli/commands/codegraph-proxy-commands.js +159 -0
- package/dist/cli/commands/codegraph-repair-commands.d.ts +3 -0
- package/dist/cli/commands/codegraph-repair-commands.js +94 -0
- package/dist/cli/commands/codegraph-status-command.d.ts +1 -1
- package/dist/cli/commands/codegraph-status-command.js +27 -214
- package/dist/cli/commands/codegraph-status-integrity.d.ts +44 -0
- package/dist/cli/commands/codegraph-status-integrity.js +121 -0
- package/dist/cli/commands/codegraph-status-json.d.ts +5 -0
- package/dist/cli/commands/codegraph-status-json.js +127 -0
- package/dist/cli/commands/container-command-shared.d.ts +60 -0
- package/dist/cli/commands/container-command-shared.js +52 -0
- package/dist/cli/commands/container-commands.d.ts +1 -1
- package/dist/cli/commands/container-commands.js +4 -216
- package/dist/cli/commands/container-release-command.d.ts +3 -0
- package/dist/cli/commands/container-release-command.js +105 -0
- package/dist/cli/commands/container-spawn-command.d.ts +3 -0
- package/dist/cli/commands/container-spawn-command.js +148 -0
- package/dist/cli/commands/context-check-command.d.ts +3 -0
- package/dist/cli/commands/context-check-command.js +81 -0
- package/dist/cli/commands/context-commands.d.ts +2 -7
- package/dist/cli/commands/context-commands.js +6 -276
- package/dist/cli/commands/context-layer-command.d.ts +3 -0
- package/dist/cli/commands/context-layer-command.js +34 -0
- package/dist/cli/commands/context-layer-fetchers.d.ts +15 -0
- package/dist/cli/commands/context-layer-fetchers.js +162 -0
- package/dist/cli/commands/context-status-command.d.ts +17 -0
- package/dist/cli/commands/context-status-command.js +41 -0
- package/dist/cli/commands/contract-write-command.d.ts +3 -0
- package/dist/cli/commands/contract-write-command.js +144 -0
- package/dist/cli/commands/core/doctor-bindings.d.ts +17 -0
- package/dist/cli/commands/core/doctor-bindings.js +30 -0
- package/dist/cli/commands/core/doctor-command.d.ts +4 -18
- package/dist/cli/commands/core/doctor-command.js +2 -323
- package/dist/cli/commands/core/doctor-logs.d.ts +8 -0
- package/dist/cli/commands/core/doctor-logs.js +32 -0
- package/dist/cli/commands/core/doctor-probes.d.ts +3 -0
- package/dist/cli/commands/core/doctor-probes.js +55 -0
- package/dist/cli/commands/core/doctor-run-command.d.ts +12 -0
- package/dist/cli/commands/core/doctor-run-command.js +172 -0
- package/dist/cli/commands/core/doctor-summary.d.ts +7 -0
- package/dist/cli/commands/core/doctor-summary.js +39 -0
- package/dist/cli/commands/core/memory-command-shared.d.ts +25 -0
- package/dist/cli/commands/core/memory-command-shared.js +20 -0
- package/dist/cli/commands/core/memory-command.d.ts +1 -1
- package/dist/cli/commands/core/memory-command.js +6 -227
- package/dist/cli/commands/core/memory-delegated-verbs.d.ts +4 -0
- package/dist/cli/commands/core/memory-delegated-verbs.js +178 -0
- package/dist/cli/commands/core/memory-extract-command.d.ts +3 -0
- package/dist/cli/commands/core/memory-extract-command.js +95 -0
- package/dist/cli/commands/core/memory-sync-command.d.ts +3 -0
- package/dist/cli/commands/core/memory-sync-command.js +38 -0
- package/dist/cli/commands/core/session-command.d.ts +1 -1
- package/dist/cli/commands/core/session-command.js +12 -206
- package/dist/cli/commands/core/session-info-command.d.ts +3 -0
- package/dist/cli/commands/core/session-info-command.js +142 -0
- package/dist/cli/commands/core/session-verb-commands.d.ts +5 -0
- package/dist/cli/commands/core/session-verb-commands.js +58 -0
- package/dist/cli/commands/core/standards-command.d.ts +1 -24
- package/dist/cli/commands/core/standards-command.js +33 -201
- package/dist/cli/commands/core/standards-init-command.d.ts +3 -0
- package/dist/cli/commands/core/standards-init-command.js +87 -0
- package/dist/cli/commands/core/standards-lint.d.ts +24 -0
- package/dist/cli/commands/core/standards-lint.js +57 -0
- package/dist/cli/commands/core/standards-migrate-command.d.ts +3 -0
- package/dist/cli/commands/core/standards-migrate-command.js +57 -0
- package/dist/cli/commands/cron-scheduler-commands.d.ts +5 -1
- package/dist/cli/commands/cron-scheduler-commands.js +36 -206
- package/dist/cli/commands/cron-scheduler-run-once-command.d.ts +7 -0
- package/dist/cli/commands/cron-scheduler-run-once-command.js +35 -0
- package/dist/cli/commands/cron-scheduler-shared.d.ts +6 -0
- package/dist/cli/commands/cron-scheduler-shared.js +48 -0
- package/dist/cli/commands/cron-scheduler-start-command.d.ts +7 -0
- package/dist/cli/commands/cron-scheduler-start-command.js +65 -0
- package/dist/cli/commands/cron-scheduler-status-command.d.ts +7 -0
- package/dist/cli/commands/cron-scheduler-status-command.js +46 -0
- package/dist/cli/commands/cron-scheduler-stop-command.d.ts +7 -0
- package/dist/cli/commands/cron-scheduler-stop-command.js +61 -0
- package/dist/cli/commands/dispatch-cli-invocation-check.d.ts +108 -0
- package/dist/cli/commands/dispatch-cli-invocation-check.js +87 -0
- package/dist/cli/commands/dispatch-cli-invocation-scan.d.ts +66 -0
- package/dist/cli/commands/dispatch-cli-invocation-scan.js +162 -0
- package/dist/cli/commands/dispatch-commands.js +12 -5
- package/dist/cli/commands/dispatch-dag-envelope.d.ts +41 -0
- package/dist/cli/commands/dispatch-dag-envelope.js +49 -0
- package/dist/cli/commands/dispatch-dag-failure.d.ts +18 -0
- package/dist/cli/commands/dispatch-dag-failure.js +16 -0
- package/dist/cli/commands/dispatch-dag-preflight.d.ts +51 -0
- package/dist/cli/commands/dispatch-dag-preflight.js +105 -0
- package/dist/cli/commands/dispatch-dag-runners.d.ts +48 -0
- package/dist/cli/commands/dispatch-dag-runners.js +73 -0
- package/dist/cli/commands/dispatch-from-dag.d.ts +27 -0
- package/dist/cli/commands/dispatch-from-dag.js +87 -257
- package/dist/cli/commands/dispatch-preflight.js +46 -0
- package/dist/cli/commands/dispatch-prompt-composition.d.ts +6 -0
- package/dist/cli/commands/dispatch-prompt-composition.js +29 -7
- package/dist/cli/commands/doc-commands.js +1 -1
- package/dist/cli/commands/feedback-commands-helpers.js +1 -1
- package/dist/cli/commands/final-review-command-envelopes.d.ts +44 -0
- package/dist/cli/commands/final-review-command-envelopes.js +100 -0
- package/dist/cli/commands/final-review-command-shared.d.ts +52 -0
- package/dist/cli/commands/final-review-command-shared.js +35 -0
- package/dist/cli/commands/final-review-commands.d.ts +7 -27
- package/dist/cli/commands/final-review-commands.js +13 -240
- package/dist/cli/commands/final-review-prepare-command.d.ts +3 -0
- package/dist/cli/commands/final-review-prepare-command.js +221 -0
- package/dist/cli/commands/gate-commands-enforce.js +3 -3
- package/dist/cli/commands/governance-classify-contract-commands.d.ts +23 -9
- package/dist/cli/commands/governance-classify-contract-commands.js +26 -269
- package/dist/cli/commands/hook-handle.js +41 -20
- package/dist/cli/commands/hooks-command-shared.d.ts +42 -0
- package/dist/cli/commands/hooks-command-shared.js +32 -0
- package/dist/cli/commands/hooks-commands.d.ts +20 -0
- package/dist/cli/commands/hooks-commands.js +75 -309
- package/dist/cli/commands/hooks-install-envelopes.d.ts +6 -0
- package/dist/cli/commands/hooks-install-envelopes.js +144 -0
- package/dist/cli/commands/hooks-status-command.d.ts +3 -0
- package/dist/cli/commands/hooks-status-command.js +93 -0
- package/dist/cli/commands/hooks-uninstall-command.d.ts +3 -0
- package/dist/cli/commands/hooks-uninstall-command.js +43 -0
- package/dist/cli/commands/lint-commands.js +3 -1
- package/dist/cli/commands/loop-command-shared.d.ts +31 -0
- package/dist/cli/commands/loop-command-shared.js +15 -0
- package/dist/cli/commands/loop-commands.d.ts +12 -17
- package/dist/cli/commands/loop-commands.js +56 -238
- package/dist/cli/commands/loop-eval-capture-index.js +2 -4
- package/dist/cli/commands/loop-export-command.d.ts +3 -0
- package/dist/cli/commands/loop-export-command.js +73 -0
- package/dist/cli/commands/loop-goal-compose-command.d.ts +3 -0
- package/dist/cli/commands/loop-goal-compose-command.js +36 -0
- package/dist/cli/commands/loop-import-command.d.ts +3 -0
- package/dist/cli/commands/loop-import-command.js +86 -0
- package/dist/cli/commands/loop-placeholder-commands.d.ts +3 -0
- package/dist/cli/commands/loop-placeholder-commands.js +52 -0
- package/dist/cli/commands/memory-command-shared.d.ts +59 -0
- package/dist/cli/commands/memory-command-shared.js +39 -0
- package/dist/cli/commands/memory-commands.d.ts +6 -79
- package/dist/cli/commands/memory-commands.js +19 -309
- package/dist/cli/commands/memory-ingest-command.d.ts +3 -0
- package/dist/cli/commands/memory-ingest-command.js +50 -0
- package/dist/cli/commands/memory-list-command.d.ts +16 -0
- package/dist/cli/commands/memory-list-command.js +129 -0
- package/dist/cli/commands/memory-reindex-command.d.ts +9 -0
- package/dist/cli/commands/memory-reindex-command.js +78 -0
- package/dist/cli/commands/memory-rotate-command.d.ts +3 -0
- package/dist/cli/commands/memory-rotate-command.js +55 -0
- package/dist/cli/commands/memory-search-command.d.ts +7 -0
- package/dist/cli/commands/memory-search-command.js +46 -0
- package/dist/cli/commands/openspec-archive-command.d.ts +3 -0
- package/dist/cli/commands/openspec-archive-command.js +55 -0
- package/dist/cli/commands/openspec-command-shared.d.ts +62 -0
- package/dist/cli/commands/openspec-command-shared.js +135 -0
- package/dist/cli/commands/openspec-commands.d.ts +1 -1
- package/dist/cli/commands/openspec-commands.js +33 -306
- package/dist/cli/commands/openspec-from-doctor-command.d.ts +3 -0
- package/dist/cli/commands/openspec-from-doctor-command.js +66 -0
- package/dist/cli/commands/openspec-init-command.d.ts +3 -0
- package/dist/cli/commands/openspec-init-command.js +49 -0
- package/dist/cli/commands/openspec-list-command.d.ts +3 -0
- package/dist/cli/commands/openspec-list-command.js +27 -0
- package/dist/cli/commands/openspec-render-command.d.ts +3 -0
- package/dist/cli/commands/openspec-render-command.js +33 -0
- package/dist/cli/commands/openspec-show-command.d.ts +3 -0
- package/dist/cli/commands/openspec-show-command.js +33 -0
- package/dist/cli/commands/openspec-to-rd-command.d.ts +3 -0
- package/dist/cli/commands/openspec-to-rd-command.js +33 -0
- package/dist/cli/commands/openspec-validate-command.d.ts +3 -0
- package/dist/cli/commands/openspec-validate-command.js +45 -0
- package/dist/cli/commands/perf-audit-commands.js +15 -5
- package/dist/cli/commands/playwright-browser-command.d.ts +8 -0
- package/dist/cli/commands/playwright-browser-command.js +61 -0
- package/dist/cli/commands/playwright-commands.d.ts +10 -62
- package/dist/cli/commands/playwright-commands.js +77 -400
- package/dist/cli/commands/playwright-envelope.d.ts +8 -0
- package/dist/cli/commands/playwright-envelope.js +29 -0
- package/dist/cli/commands/playwright-ls-stop-commands.d.ts +4 -0
- package/dist/cli/commands/playwright-ls-stop-commands.js +74 -0
- package/dist/cli/commands/playwright-session-store.d.ts +65 -0
- package/dist/cli/commands/playwright-session-store.js +189 -0
- package/dist/cli/commands/project-commands.d.ts +19 -0
- package/dist/cli/commands/project-commands.js +101 -259
- package/dist/cli/commands/project-context-command.d.ts +3 -0
- package/dist/cli/commands/project-context-command.js +44 -0
- package/dist/cli/commands/project-dashboard-command.d.ts +3 -0
- package/dist/cli/commands/project-dashboard-command.js +74 -0
- package/dist/cli/commands/project-knowledge-command.d.ts +3 -0
- package/dist/cli/commands/project-knowledge-command.js +48 -0
- package/dist/cli/commands/project-memories-show-command.d.ts +3 -0
- package/dist/cli/commands/project-memories-show-command.js +87 -0
- package/dist/cli/commands/project-memory-index-command.d.ts +3 -0
- package/dist/cli/commands/project-memory-index-command.js +31 -0
- package/dist/cli/commands/qa-archive-screenshots-command.d.ts +3 -0
- package/dist/cli/commands/qa-archive-screenshots-command.js +53 -0
- package/dist/cli/commands/qa-commands.d.ts +14 -87
- package/dist/cli/commands/qa-commands.js +17 -315
- package/dist/cli/commands/qa-context-prestep.d.ts +1 -0
- package/dist/cli/commands/qa-context-prestep.js +34 -0
- package/dist/cli/commands/qa-run-command.d.ts +3 -0
- package/dist/cli/commands/qa-run-command.js +105 -0
- package/dist/cli/commands/qa-run-options.d.ts +23 -0
- package/dist/cli/commands/qa-run-options.js +31 -0
- package/dist/cli/commands/qa-run-slice.d.ts +41 -0
- package/dist/cli/commands/qa-run-slice.js +145 -0
- package/dist/cli/commands/race-commands.d.ts +15 -0
- package/dist/cli/commands/race-commands.js +65 -0
- package/dist/cli/commands/race-pilot-gate-record-command.d.ts +3 -0
- package/dist/cli/commands/race-pilot-gate-record-command.js +81 -0
- package/dist/cli/commands/release-canary-command.d.ts +28 -0
- package/dist/cli/commands/release-canary-command.js +129 -0
- package/dist/cli/commands/release-command-shared.d.ts +13 -0
- package/dist/cli/commands/release-command-shared.js +18 -0
- package/dist/cli/commands/release-commands.d.ts +10 -18
- package/dist/cli/commands/release-commands.js +25 -298
- package/dist/cli/commands/release-done-command.d.ts +3 -0
- package/dist/cli/commands/release-done-command.js +64 -0
- package/dist/cli/commands/release-hotfix-command.d.ts +3 -0
- package/dist/cli/commands/release-hotfix-command.js +50 -0
- package/dist/cli/commands/release-plan-command.d.ts +3 -0
- package/dist/cli/commands/release-plan-command.js +33 -0
- package/dist/cli/commands/release-precheck-command.d.ts +3 -0
- package/dist/cli/commands/release-precheck-command.js +28 -0
- package/dist/cli/commands/release-promote-command.d.ts +3 -0
- package/dist/cli/commands/release-promote-command.js +34 -0
- package/dist/cli/commands/release-rollback-command.d.ts +3 -0
- package/dist/cli/commands/release-rollback-command.js +33 -0
- package/dist/cli/commands/release-watch-command.d.ts +3 -0
- package/dist/cli/commands/release-watch-command.js +44 -0
- package/dist/cli/commands/request-command-options.d.ts +8 -0
- package/dist/cli/commands/request-commands.js +2 -0
- package/dist/cli/commands/request-init-command.js +67 -12
- package/dist/cli/commands/request-retag-command.d.ts +3 -0
- package/dist/cli/commands/request-retag-command.js +50 -0
- package/dist/cli/commands/request-show-command.d.ts +8 -0
- package/dist/cli/commands/request-show-command.js +14 -1
- package/dist/cli/commands/request-transition-command.js +12 -4
- package/dist/cli/commands/request-transition-failures.d.ts +14 -0
- package/dist/cli/commands/request-transition-failures.js +45 -3
- package/dist/cli/commands/scan-scope-commands.js +2 -2
- package/dist/cli/commands/security-audit-commands.js +26 -6
- package/dist/cli/commands/sediment-argv-flags.d.ts +54 -0
- package/dist/cli/commands/sediment-argv-flags.js +116 -0
- package/dist/cli/commands/sediment-command-shared.d.ts +15 -0
- package/dist/cli/commands/sediment-command-shared.js +5 -0
- package/dist/cli/commands/sediment-commands.d.ts +35 -59
- package/dist/cli/commands/sediment-commands.js +36 -590
- package/dist/cli/commands/sediment-pool-commands.d.ts +9 -0
- package/dist/cli/commands/sediment-pool-commands.js +185 -0
- package/dist/cli/commands/sediment-query-commands.d.ts +4 -0
- package/dist/cli/commands/sediment-query-commands.js +94 -0
- package/dist/cli/commands/sediment-release-commands.d.ts +8 -0
- package/dist/cli/commands/sediment-release-commands.js +232 -0
- package/dist/cli/commands/sop-advance-command.d.ts +3 -0
- package/dist/cli/commands/sop-advance-command.js +160 -0
- package/dist/cli/commands/sop-check-command.d.ts +3 -0
- package/dist/cli/commands/sop-check-command.js +44 -0
- package/dist/cli/commands/sop-command-shared.d.ts +23 -0
- package/dist/cli/commands/sop-command-shared.js +18 -0
- package/dist/cli/commands/sop-commands.d.ts +15 -1
- package/dist/cli/commands/sop-commands.js +26 -240
- package/dist/cli/commands/sop-init-command.d.ts +3 -0
- package/dist/cli/commands/sop-init-command.js +51 -0
- package/dist/cli/commands/sop-lint-command.d.ts +3 -0
- package/dist/cli/commands/sop-lint-command.js +64 -0
- package/dist/cli/commands/sop-register-command.d.ts +3 -0
- package/dist/cli/commands/sop-register-command.js +48 -0
- package/dist/cli/commands/sop-registry-command.d.ts +3 -0
- package/dist/cli/commands/sop-registry-command.js +30 -0
- package/dist/cli/commands/statusline-command-shared.d.ts +73 -0
- package/dist/cli/commands/statusline-command-shared.js +90 -0
- package/dist/cli/commands/statusline-commands.d.ts +1 -19
- package/dist/cli/commands/statusline-commands.js +48 -287
- package/dist/cli/commands/statusline-compact-command.d.ts +4 -0
- package/dist/cli/commands/statusline-compact-command.js +54 -0
- package/dist/cli/commands/statusline-install-command.d.ts +3 -0
- package/dist/cli/commands/statusline-install-command.js +48 -0
- package/dist/cli/commands/statusline-render-command.d.ts +9 -0
- package/dist/cli/commands/statusline-render-command.js +55 -0
- package/dist/cli/commands/statusline-status-command.d.ts +3 -0
- package/dist/cli/commands/statusline-status-command.js +23 -0
- package/dist/cli/commands/statusline-uninstall-command.d.ts +3 -0
- package/dist/cli/commands/statusline-uninstall-command.js +23 -0
- package/dist/cli/commands/test-command-run-helpers.d.ts +27 -0
- package/dist/cli/commands/test-command-run-helpers.js +73 -0
- package/dist/cli/commands/test-command-runner-resolution.d.ts +57 -0
- package/dist/cli/commands/test-command-runner-resolution.js +183 -0
- package/dist/cli/commands/test-commands.d.ts +8 -56
- package/dist/cli/commands/test-commands.js +26 -249
- package/dist/cli/commands/vm-command-shared.d.ts +23 -0
- package/dist/cli/commands/vm-command-shared.js +23 -0
- package/dist/cli/commands/vm-commands.d.ts +1 -28
- package/dist/cli/commands/vm-commands.js +36 -270
- package/dist/cli/commands/vm-hypervisor-runtime.d.ts +15 -0
- package/dist/cli/commands/vm-hypervisor-runtime.js +64 -0
- package/dist/cli/commands/vm-release-command.d.ts +5 -0
- package/dist/cli/commands/vm-release-command.js +101 -0
- package/dist/cli/commands/vm-spawn-command.d.ts +5 -0
- package/dist/cli/commands/vm-spawn-command.js +177 -0
- package/dist/cli/commands/web-command-shared.d.ts +12 -0
- package/dist/cli/commands/web-command-shared.js +30 -0
- package/dist/cli/commands/web-commands.d.ts +7 -14
- package/dist/cli/commands/web-commands.js +6 -314
- package/dist/cli/commands/web-install-command.d.ts +10 -0
- package/dist/cli/commands/web-install-command.js +116 -0
- package/dist/cli/commands/web-lifecycle-commands.d.ts +9 -30
- package/dist/cli/commands/web-lifecycle-commands.js +14 -322
- package/dist/cli/commands/web-login-command.d.ts +14 -0
- package/dist/cli/commands/web-login-command.js +189 -0
- package/dist/cli/commands/web-op-payload.d.ts +22 -0
- package/dist/cli/commands/web-op-payload.js +89 -0
- package/dist/cli/commands/web-op-refusals.d.ts +37 -0
- package/dist/cli/commands/web-op-refusals.js +73 -0
- package/dist/cli/commands/web-op-runner.d.ts +14 -0
- package/dist/cli/commands/web-op-runner.js +166 -0
- package/dist/cli/commands/web-status-command.d.ts +4 -0
- package/dist/cli/commands/web-status-command.js +32 -0
- package/dist/cli/commands/web-stop-command.d.ts +10 -0
- package/dist/cli/commands/web-stop-command.js +59 -0
- package/dist/cli/commands/web-verb-specs.d.ts +18 -0
- package/dist/cli/commands/web-verb-specs.js +66 -0
- package/dist/cli/commands/workflow-command-shared.d.ts +102 -0
- package/dist/cli/commands/workflow-command-shared.js +74 -0
- package/dist/cli/commands/workflow-graph-commands.d.ts +3 -0
- package/dist/cli/commands/workflow-graph-commands.js +73 -0
- package/dist/cli/commands/workflow-init-command.d.ts +3 -0
- package/dist/cli/commands/workflow-init-command.js +68 -0
- package/dist/cli/commands/workflow-lifecycle-commands.d.ts +9 -59
- package/dist/cli/commands/workflow-lifecycle-commands.js +14 -348
- package/dist/cli/commands/workflow-node-commands.d.ts +3 -0
- package/dist/cli/commands/workflow-node-commands.js +154 -0
- package/dist/cli/commands/workflow-terminalize-command.d.ts +3 -0
- package/dist/cli/commands/workflow-terminalize-command.js +56 -0
- package/dist/cli/commands/worktree-lease-gc-command.js +1 -1
- package/dist/services/artifacts/artifact-contract-block.d.ts +53 -0
- package/dist/services/artifacts/artifact-contract-block.js +212 -0
- package/dist/services/artifacts/artifact-prerequisites.d.ts +27 -19
- package/dist/services/artifacts/artifact-prerequisites.js +63 -133
- package/dist/services/artifacts/artifact-templates.d.ts +1 -1
- package/dist/services/artifacts/artifact-templates.js +17 -10
- package/dist/services/artifacts/prerequisite-checks.d.ts +87 -0
- package/dist/services/artifacts/prerequisite-checks.js +198 -0
- package/dist/services/artifacts/prerequisite-transition-event.d.ts +20 -0
- package/dist/services/artifacts/prerequisite-transition-event.js +27 -0
- package/dist/services/artifacts/request-artifact-metadata.d.ts +31 -0
- package/dist/services/artifacts/request-artifact-metadata.js +44 -0
- package/dist/services/artifacts/request-artifact-service.d.ts +5 -0
- package/dist/services/artifacts/request-artifact-service.js +23 -51
- package/dist/services/artifacts/request-artifact-state-helpers.d.ts +12 -0
- package/dist/services/artifacts/request-artifact-state-helpers.js +28 -4
- package/dist/services/artifacts/request-retag-service.d.ts +68 -0
- package/dist/services/artifacts/request-retag-service.js +125 -0
- package/dist/services/artifacts/request-state-order.d.ts +38 -0
- package/dist/services/artifacts/request-state-order.js +99 -0
- package/dist/services/artifacts/request-type-demand.d.ts +44 -0
- package/dist/services/artifacts/request-type-demand.js +71 -0
- package/dist/services/audit/audit-goal-service.d.ts +7 -0
- package/dist/services/audit/enforcers/active-skill-resolver.d.ts +18 -0
- package/dist/services/audit/enforcers/active-skill-resolver.js +48 -1
- package/dist/services/audit/enforcers/code-ban.d.ts +11 -2
- package/dist/services/audit/enforcers/code-ban.js +21 -1
- package/dist/services/audit/red-line-catalog-p2-a-bee-runtime.d.ts +17 -0
- package/dist/services/audit/red-line-catalog-p2-a-bee-runtime.js +24 -7
- package/dist/services/audit-independent/handoff-missing-refusal.d.ts +26 -0
- package/dist/services/audit-independent/handoff-missing-refusal.js +109 -0
- package/dist/services/audit-independent/handoff-readers.d.ts +37 -0
- package/dist/services/audit-independent/handoff-readers.js +81 -0
- package/dist/services/audit-independent/index.d.ts +6 -1
- package/dist/services/audit-independent/index.js +6 -1
- package/dist/services/audit-independent/judged-declaration-build.d.ts +48 -0
- package/dist/services/audit-independent/judged-declaration-build.js +73 -0
- package/dist/services/audit-independent/judged-declaration-check.d.ts +79 -0
- package/dist/services/audit-independent/judged-declaration-check.js +155 -0
- package/dist/services/audit-independent/judged-declaration.d.ts +94 -0
- package/dist/services/audit-independent/judged-declaration.js +218 -0
- package/dist/services/audit-independent/perf-audit-service.js +12 -14
- package/dist/services/audit-independent/security-audit-artifact.d.ts +28 -0
- package/dist/services/audit-independent/security-audit-artifact.js +90 -0
- package/dist/services/audit-independent/security-audit-service.d.ts +6 -53
- package/dist/services/audit-independent/security-audit-service.js +34 -178
- package/dist/services/capability-guard-runner/contracts/J05.js +60 -14
- package/dist/services/code/auto-compact-artifacts.d.ts +54 -0
- package/dist/services/code/auto-compact-artifacts.js +135 -0
- package/dist/services/code/auto-compact-attempt.d.ts +46 -0
- package/dist/services/code/auto-compact-attempt.js +88 -0
- package/dist/services/code/auto-compact-decision.d.ts +74 -0
- package/dist/services/code/auto-compact-decision.js +149 -0
- package/dist/services/code/auto-compact-dispatch-gate.d.ts +36 -0
- package/dist/services/code/auto-compact-dispatch-gate.js +86 -0
- package/dist/services/code/auto-compact-envelopes.d.ts +33 -0
- package/dist/services/code/auto-compact-envelopes.js +134 -0
- package/dist/services/code/auto-compact-history.d.ts +46 -0
- package/dist/services/code/auto-compact-history.js +17 -0
- package/dist/services/code/auto-compact-orchestrator.d.ts +11 -240
- package/dist/services/code/auto-compact-orchestrator.js +165 -686
- package/dist/services/code/auto-compact-run-types.d.ts +123 -0
- package/dist/services/code/auto-compact-run-types.js +1 -0
- package/dist/services/code/emit-handoff.d.ts +35 -1
- package/dist/services/code/emit-handoff.js +128 -7
- package/dist/services/code/step-08-gate.d.ts +28 -19
- package/dist/services/code/step-08-gate.js +92 -35
- package/dist/services/codegraph/codegraph-index-integrity.js +2 -0
- package/dist/services/config/config-coercion.d.ts +7 -0
- package/dist/services/config/config-coercion.js +156 -0
- package/dist/services/config/config-file-io.d.ts +11 -0
- package/dist/services/config/config-file-io.js +61 -0
- package/dist/services/config/config-get.d.ts +2 -0
- package/dist/services/config/config-get.js +36 -0
- package/dist/services/config/config-global-loader.d.ts +15 -0
- package/dist/services/config/config-global-loader.js +111 -0
- package/dist/services/config/config-nested-path.d.ts +3 -0
- package/dist/services/config/config-nested-path.js +53 -0
- package/dist/services/config/config-primitives.d.ts +16 -0
- package/dist/services/config/config-primitives.js +24 -0
- package/dist/services/config/config-service.d.ts +9 -33
- package/dist/services/config/config-service.js +16 -665
- package/dist/services/config/config-validation.d.ts +19 -0
- package/dist/services/config/config-validation.js +152 -0
- package/dist/services/config/config-workspace.d.ts +10 -0
- package/dist/services/config/config-workspace.js +158 -0
- package/dist/services/context/build-dispatch-system-prompt.d.ts +3 -3
- package/dist/services/context/build-dispatch-system-prompt.js +7 -7
- package/dist/services/context/collector.js +5 -1
- package/dist/services/dispatch/active-dispatch-index.d.ts +36 -0
- package/dist/services/dispatch/active-dispatch-index.js +118 -0
- package/dist/services/dispatch/batch-counter.js +1 -2
- package/dist/services/dispatch/dispatch-record-writer.d.ts +29 -16
- package/dist/services/dispatch/dispatch-record-writer.js +58 -100
- package/dist/services/dispatch/dispatch-sub-agent.js +1 -1
- package/dist/services/dispatch/karpathy-block.d.ts +55 -0
- package/dist/services/dispatch/karpathy-block.js +101 -0
- package/dist/services/dispatch/ledger-reaper.d.ts +80 -0
- package/dist/services/dispatch/ledger-reaper.js +131 -0
- package/dist/services/evidence/evidence-generator.js +15 -8
- package/dist/services/feedback/feedback-promotion-service.d.ts +8 -11
- package/dist/services/feedback/feedback-promotion-service.js +30 -35
- package/dist/services/feedback/promotion-artifact-json-evidence.d.ts +18 -0
- package/dist/services/feedback/promotion-artifact-missing.d.ts +22 -0
- package/dist/services/feedback/promotion-artifact-missing.js +63 -0
- package/dist/services/final-review/final-review-contract.d.ts +95 -4
- package/dist/services/final-review/final-review-contract.js +64 -0
- package/dist/services/final-review/final-review-delivery.d.ts +13 -0
- package/dist/services/final-review/final-review-delivery.js +26 -12
- package/dist/services/final-review/final-review-evidence-collect.js +8 -53
- package/dist/services/final-review/final-review-evidence-records.d.ts +21 -0
- package/dist/services/final-review/final-review-evidence-records.js +67 -0
- package/dist/services/final-review/final-review-evidence-sources.d.ts +22 -0
- package/dist/services/final-review/final-review-evidence-sources.js +28 -4
- package/dist/services/final-review/final-review-prompt.js +19 -6
- package/dist/services/final-review/final-review-runner.js +5 -0
- package/dist/services/final-review/final-review-service.d.ts +2 -2
- package/dist/services/final-review/index.d.ts +1 -1
- package/dist/services/final-review/pre-post-diff.d.ts +2 -75
- package/dist/services/final-review/pre-post-diff.js +60 -59
- package/dist/services/hooks/pre-tool-code-gate.d.ts +7 -1
- package/dist/services/hooks/pre-tool-code-gate.js +21 -2
- package/dist/services/hooks/worktree-authorization-gate.js +6 -31
- package/dist/services/hooks/worktree-refusal-messages.d.ts +74 -0
- package/dist/services/hooks/worktree-refusal-messages.js +102 -0
- package/dist/services/lint/eslint-runner-support.d.ts +1 -1
- package/dist/services/lint/eslint-runner-support.js +2 -1
- package/dist/services/lint/eslint-runner-types.d.ts +8 -0
- package/dist/services/lint/eslint-runner.js +17 -4
- package/dist/services/llm/anthropic-runner.js +24 -7
- package/dist/services/loop/loop-observability.d.ts +39 -0
- package/dist/services/loop/loop-observability.js +55 -0
- package/dist/services/loop/monotonic-guard.js +6 -9
- package/dist/services/loop/monotonic-runner.js +8 -7
- package/dist/services/loop/run-driver.js +18 -22
- package/dist/services/memory/project-memory-service/index/kind-dispatch.js +14 -1
- package/dist/services/memory/project-memory-service/index/project-memory-plan-exec.js +13 -2
- package/dist/services/memory/project-memory-service/index.d.ts +2 -2
- package/dist/services/memory/project-memory-service/index.js +1 -1
- package/dist/services/memory/project-memory-service/parsers/frontmatter-parse.d.ts +36 -0
- package/dist/services/memory/project-memory-service/parsers/frontmatter-parse.js +48 -2
- package/dist/services/memory/project-memory-service/parsers/markdown-pure.d.ts +23 -1
- package/dist/services/memory/project-memory-service/parsers/markdown-pure.js +37 -0
- package/dist/services/memory/project-memory-service/types.d.ts +32 -0
- package/dist/services/observability/observability-service.d.ts +7 -0
- package/dist/services/observability/observability-service.js +2 -1
- package/dist/services/prd/gate-evidence-derivation.d.ts +4 -3
- package/dist/services/prd/gate-evidence-derivation.js +4 -3
- package/dist/services/qa/bdd-test-style-verifier.js +22 -8
- package/dist/services/race/gate2-evaluator.d.ts +58 -0
- package/dist/services/race/gate2-evaluator.js +111 -0
- package/dist/services/race/gate2-policy.d.ts +17 -0
- package/dist/services/race/gate2-policy.js +31 -0
- package/dist/services/race/lane-phase.d.ts +19 -0
- package/dist/services/race/lane-phase.js +113 -0
- package/dist/services/race/pilot-gate-store.d.ts +67 -0
- package/dist/services/race/pilot-gate-store.js +227 -0
- package/dist/services/scan/file-size-baseline.d.ts +26 -0
- package/dist/services/scan/file-size-baseline.js +150 -0
- package/dist/services/scan/file-size-scan.d.ts +42 -3
- package/dist/services/scan/file-size-scan.js +58 -42
- package/dist/services/scan/type-sanity-service.js +13 -3
- package/dist/services/skill/resume-detector.js +3 -3
- package/dist/services/skills/hooks-codegate-superpowers.d.ts +5 -6
- package/dist/services/skills/hooks-codegate-superpowers.js +7 -8
- package/dist/services/skills/hooks-settings-deny-list.d.ts +61 -0
- package/dist/services/skills/hooks-settings-deny-list.js +173 -0
- package/dist/services/skills/hooks-settings-envelopes.d.ts +20 -0
- package/dist/services/skills/hooks-settings-envelopes.js +79 -0
- package/dist/services/skills/hooks-settings-file-shape.d.ts +43 -0
- package/dist/services/skills/hooks-settings-file-shape.js +207 -0
- package/dist/services/skills/hooks-settings-paths.d.ts +34 -0
- package/dist/services/skills/hooks-settings-paths.js +75 -0
- package/dist/services/skills/hooks-settings-read-installed.d.ts +39 -0
- package/dist/services/skills/hooks-settings-read-installed.js +60 -0
- package/dist/services/skills/hooks-settings-service.d.ts +13 -213
- package/dist/services/skills/hooks-settings-service.js +72 -658
- package/dist/services/skills/hooks-settings-types.d.ts +139 -0
- package/dist/services/skills/hooks-settings-types.js +1 -0
- package/dist/services/skills/presence-lease-order.d.ts +13 -0
- package/dist/services/skills/presence-lease-order.js +24 -0
- package/dist/services/skills/skill-conformance-service.js +1 -0
- package/dist/services/skills/skill-statusline-service.js +4 -7
- package/dist/services/slice/slice-check-service.js +8 -8
- package/dist/services/workflow/pipeline-verify-gate-support.js +2 -1
- package/dist/services/workflow/pipeline-verify-service.js +1 -1
- package/dist/services/workflow/workflow-skip-service.d.ts +0 -20
- package/dist/services/workflow/workflow-skip-service.js +3 -4
- package/dist/services/workspace/claude-settings-retirements.d.ts +54 -0
- package/dist/services/workspace/claude-settings-retirements.js +112 -0
- package/dist/services/workspace/claude-settings-template-merge.d.ts +109 -0
- package/dist/services/workspace/claude-settings-template-merge.js +223 -0
- package/dist/services/workspace/claude-settings-template.d.ts +79 -87
- package/dist/services/workspace/claude-settings-template.js +80 -235
- package/dist/services/workspace/migrate-1-4-1-service.js +3 -0
- package/dist/services/workspace/reconcile-service.js +0 -1
- package/dist/shared/incrementing-number.d.ts +10 -0
- package/dist/shared/incrementing-number.js +27 -0
- package/package.json +5 -5
- package/skills/bee/peaks-perf-audit/SKILL.md +1 -1
- package/skills/bee/peaks-prd/SKILL.md +1 -1
- package/skills/bee/peaks-qa/SKILL.md +1 -1
- package/skills/bee/peaks-qa/references/qa-sub-agent-dispatch.md +2 -2
- package/skills/bee/peaks-qa/references/qa-transition-gates.md +1 -1
- package/skills/bee/peaks-rd/SKILL.md +2 -2
- package/skills/bee/peaks-rd/references/rd-fanout-contracts.md +1 -1
- package/skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md +8 -4
- package/skills/bee/peaks-rd/references/rd-transition-gates.md +3 -3
- package/skills/bee/peaks-rd/references/v2-12-fanout-collapse.md +2 -2
- package/skills/bee/peaks-rd/references/writing-handoff-frontmatter.md +1 -1
- package/skills/bee/peaks-reviewer/SKILL.md +1 -1
- package/skills/bee/peaks-sc/SKILL.md +1 -1
- package/skills/bee/peaks-security-audit/SKILL.md +10 -2
- package/skills/bee/peaks-txt/SKILL.md +4 -3
- package/skills/bee/peaks-ui/SKILL.md +3 -3
- package/skills/peaks-audit/SKILL.md +29 -1
- package/skills/peaks-code/SKILL.md +5 -2
- package/skills/peaks-code/references/fast-lane-norm.md +42 -0
- package/skills/peaks-code/references/fast-mode.md +3 -2
- package/skills/peaks-code/references/local-artifact-workspace.md +3 -3
- package/skills/peaks-code/references/micro-cycle.md +3 -3
- package/skills/peaks-code/references/resume-detection.md +1 -1
- package/skills/peaks-code/references/runbook.md +12 -6
- package/skills/peaks-code/references/step-11-memory-sediment.md +4 -0
- package/skills/peaks-code/references/sub-agent-dispatch.md +1 -1
- package/skills/peaks-code/references/swarm-dispatch-contract.md +40 -16
- package/skills/peaks-code/references/workflow-gates-and-types.md +6 -6
- package/skills/peaks-code/references/worktree-governance.md +4 -4
- package/skills/peaks-content/SKILL.md +1 -1
- package/skills/peaks-doctor/SKILL.md +1 -1
- package/skills/peaks-final-review/SKILL.md +31 -11
- package/skills/peaks-ide/SKILL.md +1 -1
- package/skills/peaks-issue-fix-orchestrator/SKILL.md +1 -1
- package/skills/peaks-race-code/SKILL.md +185 -0
- package/skills/peaks-resume/SKILL.md +1 -1
- package/skills/peaks-slice-decompose/SKILL.md +1 -1
- package/skills/peaks-solo/SKILL.md +1 -1
- package/skills/peaks-sop/SKILL.md +1 -1
- package/skills/peaks-status/SKILL.md +1 -1
- package/skills/peaks-test/SKILL.md +7 -4
- package/dist/services/audit/enforcers/lint-peaks-skill-runtime.d.ts +0 -23
- package/dist/services/audit/enforcers/lint-peaks-skill-runtime.js +0 -64
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ModelProviderConfig, PeaksConfig } from './config-types.js';
|
|
2
|
+
export declare function isSensitiveConfigPath(path: string): boolean;
|
|
3
|
+
export declare function isLegacyConfigKey(path: string): boolean;
|
|
4
|
+
export declare function isProviderConfigPath(path: string): boolean;
|
|
5
|
+
export declare function isSecretKey(key: string): boolean;
|
|
6
|
+
export declare function isProviderBaseUrlPath(path: string): boolean;
|
|
7
|
+
export declare function validateProviderBaseUrl(value: unknown): void;
|
|
8
|
+
export declare function getProxyUrlCandidate(key: string, value: unknown): unknown;
|
|
9
|
+
export declare function isProxyConfigPath(path: string): boolean;
|
|
10
|
+
export declare function validateModelProviderConfig(providers: ModelProviderConfig): void;
|
|
11
|
+
export declare function validateProviderConfig(partial: Partial<PeaksConfig>): void;
|
|
12
|
+
export declare function isValidProxyUrl(value: string): boolean;
|
|
13
|
+
export declare function validateProxyUrl(value: unknown): void;
|
|
14
|
+
export declare function validateProxyConfig(partial: Partial<PeaksConfig>): void;
|
|
15
|
+
export declare function containsSensitiveConfigValue(value: unknown): boolean;
|
|
16
|
+
export type RedactedConfigValue = string | number | boolean | null | RedactedConfigValue[] | {
|
|
17
|
+
[key: string]: RedactedConfigValue;
|
|
18
|
+
};
|
|
19
|
+
export declare function redactConfigSecrets(value: unknown, path?: string): RedactedConfigValue;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config key/URL validators and the secret-redaction surface.
|
|
3
|
+
*
|
|
4
|
+
* Split out of `config-service.ts` (file-size cap campaign). The service
|
|
5
|
+
* re-exports every name declared here, so existing importers keep using
|
|
6
|
+
* `./config-service.js` unchanged.
|
|
7
|
+
*/
|
|
8
|
+
import { isRecord } from './config-primitives.js';
|
|
9
|
+
export function isSensitiveConfigPath(path) {
|
|
10
|
+
const normalized = path.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
11
|
+
return (normalized.includes('apikey') ||
|
|
12
|
+
normalized.includes('accesskey') ||
|
|
13
|
+
normalized.includes('privatekey') ||
|
|
14
|
+
normalized.includes('token') ||
|
|
15
|
+
normalized.includes('secret') ||
|
|
16
|
+
normalized.includes('password') ||
|
|
17
|
+
normalized.includes('bearer') ||
|
|
18
|
+
normalized.includes('credential') ||
|
|
19
|
+
normalized.includes('auth'));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 2.0.1 slim-config contract: `~/.peaks/config.json` only stores
|
|
23
|
+
* `version` + `ocr.llm.*` placeholders. The 1.x → 2.0 migration
|
|
24
|
+
* moved per-project fields (`language`, `model`, `economyMode`,
|
|
25
|
+
* `swarmMode`) to `<project>/.peaks/preferences.json` (per spec
|
|
26
|
+
* §10.4). `setConfig` rejects writes to those keys and points the
|
|
27
|
+
* user to the preferences path; tokens / providers / proxy still
|
|
28
|
+
* live in `~/.peaks/config.json` (the loader is tolerant of them
|
|
29
|
+
* but does not synthesise defaults for them anymore).
|
|
30
|
+
*/
|
|
31
|
+
const LEGACY_CONFIG_KEYS = new Set([
|
|
32
|
+
'language',
|
|
33
|
+
'model',
|
|
34
|
+
'economyMode',
|
|
35
|
+
'swarmMode'
|
|
36
|
+
]);
|
|
37
|
+
export function isLegacyConfigKey(path) {
|
|
38
|
+
const topLevel = path.split(/[.[].*/, 1)[0] ?? '';
|
|
39
|
+
return LEGACY_CONFIG_KEYS.has(topLevel);
|
|
40
|
+
}
|
|
41
|
+
export function isProviderConfigPath(path) {
|
|
42
|
+
return path === 'providers' || path.startsWith('providers.');
|
|
43
|
+
}
|
|
44
|
+
export function isSecretKey(key) {
|
|
45
|
+
return isSensitiveConfigPath(key);
|
|
46
|
+
}
|
|
47
|
+
function sanitizeBaseUrlForDisplay(value) {
|
|
48
|
+
try {
|
|
49
|
+
const url = new URL(value);
|
|
50
|
+
url.username = '';
|
|
51
|
+
url.password = '';
|
|
52
|
+
url.search = '';
|
|
53
|
+
url.hash = '';
|
|
54
|
+
return url.toString();
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return '[invalid-url-redacted]';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export function isProviderBaseUrlPath(path) {
|
|
61
|
+
return /^providers\.[^.]+\.baseUrl$/.test(path);
|
|
62
|
+
}
|
|
63
|
+
function isValidProviderBaseUrl(value) {
|
|
64
|
+
try {
|
|
65
|
+
const url = new URL(value);
|
|
66
|
+
return (url.protocol === 'https:' &&
|
|
67
|
+
url.username.length === 0 &&
|
|
68
|
+
url.password.length === 0 &&
|
|
69
|
+
url.search.length === 0 &&
|
|
70
|
+
url.hash.length === 0);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export function validateProviderBaseUrl(value) {
|
|
77
|
+
if (value !== undefined && (typeof value !== 'string' || !isValidProviderBaseUrl(value))) {
|
|
78
|
+
throw new Error('Provider base URL must be HTTPS without embedded credentials, query, or fragment');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export function getProxyUrlCandidate(key, value) {
|
|
82
|
+
if (key === 'proxy.httpProxy') {
|
|
83
|
+
return value;
|
|
84
|
+
}
|
|
85
|
+
if (key === 'proxy' && isRecord(value)) {
|
|
86
|
+
return value.httpProxy;
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
export function isProxyConfigPath(path) {
|
|
91
|
+
return path === 'proxy' || path.startsWith('proxy.');
|
|
92
|
+
}
|
|
93
|
+
export function validateModelProviderConfig(providers) {
|
|
94
|
+
for (const provider of Object.values(providers)) {
|
|
95
|
+
validateProviderBaseUrl(provider?.baseUrl);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export function validateProviderConfig(partial) {
|
|
99
|
+
validateModelProviderConfig(partial.providers ?? {});
|
|
100
|
+
}
|
|
101
|
+
export function isValidProxyUrl(value) {
|
|
102
|
+
try {
|
|
103
|
+
const url = new URL(value);
|
|
104
|
+
return ((url.protocol === 'http:' || url.protocol === 'https:') &&
|
|
105
|
+
url.username.length === 0 &&
|
|
106
|
+
url.password.length === 0 &&
|
|
107
|
+
url.pathname === '/' &&
|
|
108
|
+
url.search.length === 0 &&
|
|
109
|
+
url.hash.length === 0);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
export function validateProxyUrl(value) {
|
|
116
|
+
if (value !== undefined && (typeof value !== 'string' || !isValidProxyUrl(value))) {
|
|
117
|
+
throw new Error('Proxy URL must be an HTTP or HTTPS URL without embedded credentials');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export function validateProxyConfig(partial) {
|
|
121
|
+
validateProxyUrl(partial.proxy?.httpProxy);
|
|
122
|
+
}
|
|
123
|
+
export function containsSensitiveConfigValue(value) {
|
|
124
|
+
if (Array.isArray(value)) {
|
|
125
|
+
return value.some(containsSensitiveConfigValue);
|
|
126
|
+
}
|
|
127
|
+
if (value === null || typeof value !== 'object') {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
return Object.entries(value).some(([key, entry]) => isSecretKey(key) || containsSensitiveConfigValue(entry));
|
|
131
|
+
}
|
|
132
|
+
export function redactConfigSecrets(value, path = '') {
|
|
133
|
+
if (Array.isArray(value)) {
|
|
134
|
+
return value.map((item, index) => redactConfigSecrets(item, `${path}[${index}]`));
|
|
135
|
+
}
|
|
136
|
+
if (value === null || typeof value !== 'object') {
|
|
137
|
+
if (isProviderBaseUrlPath(path) && typeof value === 'string') {
|
|
138
|
+
return sanitizeBaseUrlForDisplay(value);
|
|
139
|
+
}
|
|
140
|
+
return value;
|
|
141
|
+
}
|
|
142
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => {
|
|
143
|
+
const nextPath = path ? `${path}.${key}` : key;
|
|
144
|
+
if (isSecretKey(key)) {
|
|
145
|
+
return [key, '***'];
|
|
146
|
+
}
|
|
147
|
+
if (isProviderBaseUrlPath(nextPath) && typeof entry === 'string') {
|
|
148
|
+
return [key, sanitizeBaseUrlForDisplay(entry)];
|
|
149
|
+
}
|
|
150
|
+
return [key, redactConfigSecrets(entry, nextPath)];
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ConfigLayer, WorkspaceConfig } from './config-types.js';
|
|
2
|
+
export declare function getWorkspaceConfig(workspaceId: string, _projectRoot?: string | null): WorkspaceConfig | null;
|
|
3
|
+
export declare function addWorkspace(workspace: WorkspaceConfig, layer?: ConfigLayer): void;
|
|
4
|
+
export declare function removeWorkspace(workspaceId: string, layer?: ConfigLayer): boolean;
|
|
5
|
+
export declare function setCurrentWorkspace(workspaceId: string, layer?: ConfigLayer): boolean;
|
|
6
|
+
export declare function getCurrentWorkspaceConfig(): WorkspaceConfig | null;
|
|
7
|
+
export declare function getWorkspaceConfigForPath(path?: string): WorkspaceConfig | null;
|
|
8
|
+
export declare function ensureWorkspaceConfigForPath(path?: string): WorkspaceConfig | null;
|
|
9
|
+
export declare function getWorkspaceConfigForCurrentPath(): WorkspaceConfig | null;
|
|
10
|
+
export declare function ensureWorkspaceConfigForCurrentPath(): WorkspaceConfig | null;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace registry: the raw `workspaces` / `currentWorkspace` fields and the artifact marker.
|
|
3
|
+
*
|
|
4
|
+
* Split out of `config-service.ts` (file-size cap campaign). The service
|
|
5
|
+
* re-exports every name declared here, so existing importers keep using
|
|
6
|
+
* `./config-service.js` unchanged.
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync } from 'node:fs';
|
|
9
|
+
import { dirname, isAbsolute, resolve } from 'node:path';
|
|
10
|
+
import { stablePath } from '../../shared/path-utils.js';
|
|
11
|
+
import { getUserConfigPath, isInsidePath, resolveProjectRootForConfig, validateArtifactWorkspaceMarkerPath, validateArtifactWorkspaceRoot, validateProjectBootstrapConfigPathForWrite, validateUserConfigPathForWrite, writeConfigFileSafely, writeProjectConfigFile, writeUserConfigFile } from './config-safety.js';
|
|
12
|
+
import { toWorkspaceConfigs } from './config-coercion.js';
|
|
13
|
+
import { ensureDir, getProjectWriteTarget, readJsonFile } from './config-file-io.js';
|
|
14
|
+
import { getConfig } from './config-get.js';
|
|
15
|
+
import { isRecord, isSafeConfigSegment } from './config-primitives.js';
|
|
16
|
+
function readRawWorkspaceData(layer) {
|
|
17
|
+
const config = getConfig({ layer });
|
|
18
|
+
return isRecord(config)
|
|
19
|
+
? {
|
|
20
|
+
currentWorkspace: typeof config.currentWorkspace === 'string' ? config.currentWorkspace : null,
|
|
21
|
+
workspaces: toWorkspaceConfigs(config.workspaces)
|
|
22
|
+
}
|
|
23
|
+
: { currentWorkspace: null, workspaces: [] };
|
|
24
|
+
}
|
|
25
|
+
function writeRawWorkspaceData(data, layer) {
|
|
26
|
+
const projectTarget = layer === 'project' ? getProjectWriteTarget() : null;
|
|
27
|
+
const targetPath = projectTarget?.configPath ?? getUserConfigPath();
|
|
28
|
+
ensureDir(dirname(targetPath));
|
|
29
|
+
const existing = projectTarget
|
|
30
|
+
? (readJsonFile(targetPath, () => validateProjectBootstrapConfigPathForWrite(projectTarget.projectRoot, targetPath)) ?? {})
|
|
31
|
+
: (readJsonFile(targetPath, () => validateUserConfigPathForWrite(targetPath)) ?? {});
|
|
32
|
+
const merged = { ...existing, ...data };
|
|
33
|
+
const content = JSON.stringify(merged, null, 2);
|
|
34
|
+
if (projectTarget) {
|
|
35
|
+
writeProjectConfigFile(projectTarget.projectRoot, targetPath, content);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
writeUserConfigFile(targetPath, content);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function readAllWorkspaces() {
|
|
42
|
+
const userData = readRawWorkspaceData('user');
|
|
43
|
+
const projectData = readRawWorkspaceData('project');
|
|
44
|
+
const mergedWorkspaces = new Map();
|
|
45
|
+
for (const w of userData.workspaces)
|
|
46
|
+
mergedWorkspaces.set(w.workspaceId, w);
|
|
47
|
+
for (const w of projectData.workspaces)
|
|
48
|
+
mergedWorkspaces.set(w.workspaceId, w);
|
|
49
|
+
return {
|
|
50
|
+
currentWorkspace: projectData.currentWorkspace ?? userData.currentWorkspace,
|
|
51
|
+
workspaces: [...mergedWorkspaces.values()]
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export function getWorkspaceConfig(workspaceId, _projectRoot) {
|
|
55
|
+
// Accepted for signature stability: the registry spans the user and project
|
|
56
|
+
// layers, so the id alone identifies the workspace.
|
|
57
|
+
void _projectRoot;
|
|
58
|
+
const { workspaces } = readAllWorkspaces();
|
|
59
|
+
return workspaces.find((w) => w.workspaceId === workspaceId) ?? null;
|
|
60
|
+
}
|
|
61
|
+
function readLayerConfig(layer) {
|
|
62
|
+
return readRawWorkspaceData(layer);
|
|
63
|
+
}
|
|
64
|
+
export function addWorkspace(workspace, layer = 'user') {
|
|
65
|
+
if (!isSafeConfigSegment(workspace.workspaceId)) {
|
|
66
|
+
throw new Error('Workspace id must only contain letters, numbers, dots, underscores, or hyphens and must not contain path traversal');
|
|
67
|
+
}
|
|
68
|
+
const config = readRawWorkspaceData(layer);
|
|
69
|
+
const workspaces = config.workspaces;
|
|
70
|
+
const existing = workspaces.findIndex((w) => w.workspaceId === workspace.workspaceId);
|
|
71
|
+
const updatedWorkspaces = existing >= 0
|
|
72
|
+
? workspaces.map((existingWorkspace) => existingWorkspace.workspaceId === workspace.workspaceId ? workspace : existingWorkspace)
|
|
73
|
+
: [...workspaces, workspace];
|
|
74
|
+
writeRawWorkspaceData({ workspaces: updatedWorkspaces }, layer);
|
|
75
|
+
}
|
|
76
|
+
export function removeWorkspace(workspaceId, layer = 'user') {
|
|
77
|
+
if (!isSafeConfigSegment(workspaceId))
|
|
78
|
+
return false;
|
|
79
|
+
const config = readRawWorkspaceData(layer);
|
|
80
|
+
const workspaces = config.workspaces;
|
|
81
|
+
const idx = workspaces.findIndex((w) => w.workspaceId === workspaceId);
|
|
82
|
+
if (idx < 0)
|
|
83
|
+
return false;
|
|
84
|
+
const updatedWorkspaces = workspaces.filter((w) => w.workspaceId !== workspaceId);
|
|
85
|
+
const currentWorkspace = config.currentWorkspace === workspaceId
|
|
86
|
+
? (updatedWorkspaces[0]?.workspaceId ?? null)
|
|
87
|
+
: (config.currentWorkspace ?? null);
|
|
88
|
+
writeRawWorkspaceData({ workspaces: updatedWorkspaces, currentWorkspace }, layer);
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
export function setCurrentWorkspace(workspaceId, layer = 'user') {
|
|
92
|
+
if (!isSafeConfigSegment(workspaceId))
|
|
93
|
+
return false;
|
|
94
|
+
const config = readRawWorkspaceData(layer);
|
|
95
|
+
const workspaces = config.workspaces;
|
|
96
|
+
const exists = workspaces.some((w) => w.workspaceId === workspaceId);
|
|
97
|
+
if (!exists)
|
|
98
|
+
return false;
|
|
99
|
+
writeRawWorkspaceData({ currentWorkspace: workspaceId }, layer);
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
export function getCurrentWorkspaceConfig() {
|
|
103
|
+
const { currentWorkspace, workspaces } = readAllWorkspaces();
|
|
104
|
+
if (!currentWorkspace)
|
|
105
|
+
return null;
|
|
106
|
+
return workspaces.find((w) => w.workspaceId === currentWorkspace) ?? null;
|
|
107
|
+
}
|
|
108
|
+
export function getWorkspaceConfigForPath(path = process.cwd()) {
|
|
109
|
+
const { workspaces } = readAllWorkspaces();
|
|
110
|
+
return findWorkspaceForPath(workspaces, path);
|
|
111
|
+
}
|
|
112
|
+
function findWorkspaceForPath(workspaces, path) {
|
|
113
|
+
const targetPath = stablePath(path);
|
|
114
|
+
const matches = workspaces.flatMap((workspace) => {
|
|
115
|
+
if (!isAbsolute(workspace.rootPath) || !existsSync(workspace.rootPath))
|
|
116
|
+
return [];
|
|
117
|
+
const rootPath = stablePath(workspace.rootPath);
|
|
118
|
+
return isInsidePath(targetPath, rootPath) ? [{ workspace, rootPath }] : [];
|
|
119
|
+
});
|
|
120
|
+
if (matches.length === 0)
|
|
121
|
+
return null;
|
|
122
|
+
return matches.reduce((best, match) => match.rootPath.length > best.rootPath.length ? match : best).workspace;
|
|
123
|
+
}
|
|
124
|
+
function getWorkspaceArtifactRoot(workspace) {
|
|
125
|
+
return workspace.artifactStorage?.localPath
|
|
126
|
+
? resolve(workspace.artifactStorage.localPath)
|
|
127
|
+
: resolve(workspace.rootPath, '.peaks', 'artifacts');
|
|
128
|
+
}
|
|
129
|
+
function ensureArtifactWorkspaceMarker(workspace) {
|
|
130
|
+
const artifactRoot = getWorkspaceArtifactRoot(workspace);
|
|
131
|
+
const peaksPath = resolve(artifactRoot, '.peaks');
|
|
132
|
+
const markerPath = resolve(peaksPath, 'config.json');
|
|
133
|
+
ensureDir(artifactRoot);
|
|
134
|
+
validateArtifactWorkspaceRoot(artifactRoot, workspace.rootPath);
|
|
135
|
+
ensureDir(peaksPath);
|
|
136
|
+
validateArtifactWorkspaceMarkerPath(artifactRoot, peaksPath, markerPath);
|
|
137
|
+
if (!existsSync(markerPath)) {
|
|
138
|
+
writeConfigFileSafely(markerPath, '{}\n', () => validateArtifactWorkspaceMarkerPath(artifactRoot, peaksPath, markerPath), 'Artifact workspace marker must stay inside the artifact workspace');
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export function ensureWorkspaceConfigForPath(path = process.cwd()) {
|
|
142
|
+
const projectRoot = resolveProjectRootForConfig(path);
|
|
143
|
+
if (!isAbsolute(projectRoot) || !existsSync(projectRoot))
|
|
144
|
+
return null;
|
|
145
|
+
const config = readLayerConfig('user');
|
|
146
|
+
const existingWorkspace = findWorkspaceForPath(config.workspaces, path);
|
|
147
|
+
if (existingWorkspace) {
|
|
148
|
+
ensureArtifactWorkspaceMarker(existingWorkspace);
|
|
149
|
+
return existingWorkspace;
|
|
150
|
+
}
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
export function getWorkspaceConfigForCurrentPath() {
|
|
154
|
+
return getWorkspaceConfigForPath(process.cwd());
|
|
155
|
+
}
|
|
156
|
+
export function ensureWorkspaceConfigForCurrentPath() {
|
|
157
|
+
return ensureWorkspaceConfigForPath(process.cwd());
|
|
158
|
+
}
|
|
@@ -95,10 +95,10 @@ export interface DispatchPromptInput {
|
|
|
95
95
|
* reuse the task body verbatim).
|
|
96
96
|
* trivially testable.
|
|
97
97
|
*
|
|
98
|
-
* fallback path is
|
|
99
|
-
*
|
|
98
|
+
* fallback path is the command the auth-grant CLI declares:
|
|
99
|
+
* `peaks worktree auth grant --operation <op> --reason <text>`.
|
|
100
100
|
*/
|
|
101
|
-
export declare const L1_WORKTREE_GOVERNANCE_BLOCK = "## Superpowers chain refusal (L1 worktree governance \u2014 locked 2026-07-29)\n\nYou MUST NOT follow the superpowers chain for worktree decisions:\n\n- superpowers:brainstorming \u2192 superpowers:writing-plans \u2192\n superpowers:subagent-driven-development \u2192 superpowers:using-git-worktrees\n\nThat chain ends with `git worktree add` (superpowers:using-git-worktrees SKILL.md line 96), which bypasses peaks-loop's L2 hook gate and L3 IDE `permissions.deny`. L3 denial is NOT sufficient \u2014 by then the chain has already taught raw `git worktree add`.\n\nFor worktree operations, use ONLY:\n\n- `peaks worktree spawn --rid <rid> --
|
|
101
|
+
export declare const L1_WORKTREE_GOVERNANCE_BLOCK = "## Superpowers chain refusal (L1 worktree governance \u2014 locked 2026-07-29)\n\nYou MUST NOT follow the superpowers chain for worktree decisions:\n\n- superpowers:brainstorming \u2192 superpowers:writing-plans \u2192\n superpowers:subagent-driven-development \u2192 superpowers:using-git-worktrees\n\nThat chain ends with `git worktree add` (superpowers:using-git-worktrees SKILL.md line 96), which bypasses peaks-loop's L2 hook gate and L3 IDE `permissions.deny`. L3 denial is NOT sufficient \u2014 by then the chain has already taught raw `git worktree add`.\n\nFor worktree operations, use ONLY:\n\n- `peaks worktree spawn --rid <rid> --role <role> --purpose <text>` (after rid-L2-extended ships)\n- until then: `peaks worktree auth grant --operation <op> --reason <text>` (`<op>`, e.g. `git-worktree` | `agent-isolation-worktree`)\n\nSuperpowers skills remain REFERENCE material for brainstorming / planning techniques, but MUST NOT be used as a workflow. peaks-rd's own PRD/RD artifacts (`.peaks/_runtime/<sessionId>/rd/requests/<rid>.md`) are authoritative.\n\nIf the upstream superpowers chain suggests raw `git worktree add`:\n\n1. STOP\n2. Re-author the plan as a peaks-rd artifact\n3. Continue with the `spawn` command above (or the auth-grant fallback)\n";
|
|
102
102
|
/**
|
|
103
103
|
* system prompt gains three lifecycle rules. The sub-agent must:
|
|
104
104
|
*
|
|
@@ -16,8 +16,8 @@ import { resolveCodegraphBlock } from './codegraph-unavailable-block.js';
|
|
|
16
16
|
* reuse the task body verbatim).
|
|
17
17
|
* trivially testable.
|
|
18
18
|
*
|
|
19
|
-
* fallback path is
|
|
20
|
-
*
|
|
19
|
+
* fallback path is the command the auth-grant CLI declares:
|
|
20
|
+
* `peaks worktree auth grant --operation <op> --reason <text>`.
|
|
21
21
|
*/
|
|
22
22
|
export const L1_WORKTREE_GOVERNANCE_BLOCK = `## Superpowers chain refusal (L1 worktree governance — locked 2026-07-29)
|
|
23
23
|
|
|
@@ -30,8 +30,8 @@ That chain ends with \`git worktree add\` (superpowers:using-git-worktrees SKILL
|
|
|
30
30
|
|
|
31
31
|
For worktree operations, use ONLY:
|
|
32
32
|
|
|
33
|
-
- \`peaks worktree spawn --rid <rid> --
|
|
34
|
-
- until then: \`peaks worktree auth grant --
|
|
33
|
+
- \`peaks worktree spawn --rid <rid> --role <role> --purpose <text>\` (after rid-L2-extended ships)
|
|
34
|
+
- until then: \`peaks worktree auth grant --operation <op> --reason <text>\` (\`<op>\`, e.g. \`git-worktree\` | \`agent-isolation-worktree\`)
|
|
35
35
|
|
|
36
36
|
Superpowers skills remain REFERENCE material for brainstorming / planning techniques, but MUST NOT be used as a workflow. peaks-rd's own PRD/RD artifacts (\`.peaks/_runtime/<sessionId>/rd/requests/<rid>.md\`) are authoritative.
|
|
37
37
|
|
|
@@ -39,7 +39,7 @@ If the upstream superpowers chain suggests raw \`git worktree add\`:
|
|
|
39
39
|
|
|
40
40
|
1. STOP
|
|
41
41
|
2. Re-author the plan as a peaks-rd artifact
|
|
42
|
-
3. Continue with \`
|
|
42
|
+
3. Continue with the \`spawn\` command above (or the auth-grant fallback)
|
|
43
43
|
`;
|
|
44
44
|
/**
|
|
45
45
|
* system prompt gains three lifecycle rules. The sub-agent must:
|
|
@@ -300,8 +300,8 @@ export const BINDING_RULE_TOKENS = [
|
|
|
300
300
|
'MUST NOT follow the superpowers chain',
|
|
301
301
|
'superpowers:using-git-worktrees',
|
|
302
302
|
'`git worktree add`',
|
|
303
|
-
'`peaks worktree spawn --rid <rid> --
|
|
304
|
-
'`peaks worktree auth grant --
|
|
303
|
+
'`peaks worktree spawn --rid <rid> --role <role> --purpose <text>`',
|
|
304
|
+
'`peaks worktree auth grant --operation <op> --reason <text>`',
|
|
305
305
|
'MUST NOT be used as a workflow',
|
|
306
306
|
'STOP',
|
|
307
307
|
'Re-author the plan as a peaks-rd artifact',
|
|
@@ -45,7 +45,11 @@ async function scanFiles(root, exclude) {
|
|
|
45
45
|
const s = await stat(full);
|
|
46
46
|
out.push({
|
|
47
47
|
path: rel,
|
|
48
|
-
|
|
48
|
+
// `rel`, not a second `relative()` call: the raw value is
|
|
49
|
+
// `\`-separated on win32 and `classifyKind` tests for `/__tests__/`,
|
|
50
|
+
// so the nested-test branch could never match on the platform it was
|
|
51
|
+
// written on. The normalised value is the one computed above.
|
|
52
|
+
kind: classifyKind(rel),
|
|
49
53
|
lines: 0, // computed lazily; full line count is expensive
|
|
50
54
|
hash: '' // computed lazily via content-hash-cache-pattern
|
|
51
55
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Active-dispatches index. Per-session JSON file at
|
|
3
|
+
* `.peaks/_sub_agents/<sid>/active-dispatches.json`. Map<recordPath,
|
|
4
|
+
* ActiveDispatchEntry>. Updated on dispatch + completion.
|
|
5
|
+
*/
|
|
6
|
+
export interface ActiveDispatchEntry {
|
|
7
|
+
readonly recordPath: string;
|
|
8
|
+
readonly requestId: string;
|
|
9
|
+
readonly role: string;
|
|
10
|
+
readonly batchId: string;
|
|
11
|
+
readonly createdAt: string;
|
|
12
|
+
readonly status: 'queued' | 'running' | 'finalizing' | 'done' | 'failed' | 'cancelled' | 'stale' | 'no-execution' | 'never-started' | 'unreadable';
|
|
13
|
+
}
|
|
14
|
+
export declare function activeDispatchIndexPath(projectRoot: string, sessionId: string): string;
|
|
15
|
+
export declare function registerActiveDispatch(input: {
|
|
16
|
+
projectRoot: string;
|
|
17
|
+
sessionId: string;
|
|
18
|
+
recordPath: string;
|
|
19
|
+
requestId: string;
|
|
20
|
+
role: string;
|
|
21
|
+
batchId: string;
|
|
22
|
+
now: () => Date;
|
|
23
|
+
}): void;
|
|
24
|
+
export declare function unregisterActiveDispatch(input: {
|
|
25
|
+
projectRoot: string;
|
|
26
|
+
sessionId: string;
|
|
27
|
+
recordPath: string;
|
|
28
|
+
status: ActiveDispatchEntry['status'];
|
|
29
|
+
}): void;
|
|
30
|
+
/**
|
|
31
|
+
* for a session. Returns the current map<recordPath, entry>. Used
|
|
32
|
+
* by the LLM-side runner to discover in-flight records on restart.
|
|
33
|
+
* Returns an empty map when the index file is missing or corrupt
|
|
34
|
+
* (the on-disk records directory is the next fallback).
|
|
35
|
+
*/
|
|
36
|
+
export declare function readActiveDispatchIndex(projectRoot: string, sessionId: string): Record<string, ActiveDispatchEntry>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-session active-dispatches index
|
|
3
|
+
* (`.peaks/_sub_agents/<sid>/active-dispatches.json`): its path, its
|
|
4
|
+
* `Map<recordPath, ActiveDispatchEntry>` shape, and its register / unregister /
|
|
5
|
+
* read operations. The POLICY that bounds it lives in `./ledger-reaper.ts`.
|
|
6
|
+
*
|
|
7
|
+
* Split out of `./dispatch-record-writer.ts`, which was already over its
|
|
8
|
+
* file-size cap: the writer keeps the on-disk RECORD format, this module owns
|
|
9
|
+
* the INDEX — the hint the LLM-side runner and the status line read
|
|
10
|
+
* (`readActiveLeaf` in `src/services/skills/skill-statusline-model.ts`). The
|
|
11
|
+
* moved functions are byte-identical to their previous bodies apart from the
|
|
12
|
+
* terminal-status chain, which became a lookup set; `dispatch-record-writer.ts`
|
|
13
|
+
* re-exports the two public names so no importer changed.
|
|
14
|
+
*/
|
|
15
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
16
|
+
import { dirname, resolve } from 'node:path';
|
|
17
|
+
export function activeDispatchIndexPath(projectRoot, sessionId) {
|
|
18
|
+
return resolve(projectRoot, '.peaks', '_sub_agents', sessionId, 'active-dispatches.json');
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Read the index file into a plain map. A missing or corrupt file yields the
|
|
22
|
+
* empty map: the on-disk record is the source of truth and a corrupt index is
|
|
23
|
+
* rebuilt from the records rather than trusted.
|
|
24
|
+
*/
|
|
25
|
+
function readIndexMap(indexPath) {
|
|
26
|
+
const index = {};
|
|
27
|
+
if (!existsSync(indexPath))
|
|
28
|
+
return index;
|
|
29
|
+
try {
|
|
30
|
+
const raw = readFileSync(indexPath, 'utf8');
|
|
31
|
+
const parsed = JSON.parse(raw);
|
|
32
|
+
if (typeof parsed === 'object' && parsed !== null) {
|
|
33
|
+
for (const [k, v] of Object.entries(parsed)) {
|
|
34
|
+
if (typeof v === 'object' && v !== null && 'recordPath' in v) {
|
|
35
|
+
index[k] = v;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
// Rebuilt from the empty map. `error` is held so the block is not an empty
|
|
42
|
+
// catch; the reason is that a corrupt index is not a fact worth reporting,
|
|
43
|
+
// only a reason to re-read the records.
|
|
44
|
+
void error;
|
|
45
|
+
}
|
|
46
|
+
return index;
|
|
47
|
+
}
|
|
48
|
+
export function registerActiveDispatch(input) {
|
|
49
|
+
const indexPath = activeDispatchIndexPath(input.projectRoot, input.sessionId);
|
|
50
|
+
const dir = dirname(indexPath);
|
|
51
|
+
if (!existsSync(dir)) {
|
|
52
|
+
mkdirSync(dir, { recursive: true });
|
|
53
|
+
}
|
|
54
|
+
const index = readIndexMap(indexPath);
|
|
55
|
+
index[input.recordPath] = {
|
|
56
|
+
recordPath: input.recordPath,
|
|
57
|
+
requestId: input.requestId,
|
|
58
|
+
role: input.role,
|
|
59
|
+
batchId: input.batchId,
|
|
60
|
+
createdAt: input.now().toISOString(),
|
|
61
|
+
status: 'queued'
|
|
62
|
+
};
|
|
63
|
+
const tmp = `${indexPath}.tmp-${process.pid}-${Date.now()}`;
|
|
64
|
+
writeFileSync(tmp, JSON.stringify(index, null, 2) + '\n', 'utf8');
|
|
65
|
+
renameSync(tmp, indexPath);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Statuses that mean the dispatch is over. The startup-timeout service writes
|
|
69
|
+
* the last two as terminal markers, and the finalize CLI writes the rest;
|
|
70
|
+
* unregister must remove the row on all of them.
|
|
71
|
+
*
|
|
72
|
+
* A set rather than a six-way `||` chain: the chain cost the function five
|
|
73
|
+
* branches for a lookup that is data, and pushed its complexity over the
|
|
74
|
+
* eslint ceiling on the way into this module.
|
|
75
|
+
*/
|
|
76
|
+
const TERMINAL_INDEX_STATUSES = new Set([
|
|
77
|
+
'done',
|
|
78
|
+
'failed',
|
|
79
|
+
'cancelled',
|
|
80
|
+
'no-execution',
|
|
81
|
+
'never-started',
|
|
82
|
+
'unreadable'
|
|
83
|
+
]);
|
|
84
|
+
export function unregisterActiveDispatch(input) {
|
|
85
|
+
const indexPath = activeDispatchIndexPath(input.projectRoot, input.sessionId);
|
|
86
|
+
if (!existsSync(indexPath))
|
|
87
|
+
return;
|
|
88
|
+
const index = readIndexMap(indexPath);
|
|
89
|
+
const existing = index[input.recordPath];
|
|
90
|
+
if (existing === undefined)
|
|
91
|
+
return;
|
|
92
|
+
if (TERMINAL_INDEX_STATUSES.has(input.status)) {
|
|
93
|
+
delete index[input.recordPath];
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
index[input.recordPath] = { ...existing, status: input.status };
|
|
97
|
+
}
|
|
98
|
+
const tmp = `${indexPath}.tmp-${process.pid}-${Date.now()}`;
|
|
99
|
+
writeFileSync(tmp, JSON.stringify(index, null, 2) + '\n', 'utf8');
|
|
100
|
+
renameSync(tmp, indexPath);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* for a session. Returns the current map<recordPath, entry>. Used
|
|
104
|
+
* by the LLM-side runner to discover in-flight records on restart.
|
|
105
|
+
* Returns an empty map when the index file is missing or corrupt
|
|
106
|
+
* (the on-disk records directory is the next fallback).
|
|
107
|
+
*/
|
|
108
|
+
export function readActiveDispatchIndex(projectRoot, sessionId) {
|
|
109
|
+
const indexPath = activeDispatchIndexPath(projectRoot, sessionId);
|
|
110
|
+
const index = readIndexMap(indexPath);
|
|
111
|
+
const out = {};
|
|
112
|
+
for (const [k, v] of Object.entries(index)) {
|
|
113
|
+
if ('role' in v) {
|
|
114
|
+
out[k] = v;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* that's your call". A warning is the right surface — let the LLM /
|
|
22
22
|
* human read the reason and decide.
|
|
23
23
|
*/
|
|
24
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
24
|
+
import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
25
25
|
import { dirname, resolve } from 'node:path';
|
|
26
26
|
import { withFileLockSync } from 'peaks-loop-shared-channel';
|
|
27
27
|
export const BATCH_LIMIT = 6;
|
|
@@ -91,7 +91,6 @@ export function resetBatch(projectRoot, sid, batchId) {
|
|
|
91
91
|
const path = batchCounterPath(projectRoot, sid, batchId);
|
|
92
92
|
if (existsSync(path)) {
|
|
93
93
|
try {
|
|
94
|
-
const { unlinkSync } = require('node:fs');
|
|
95
94
|
unlinkSync(path);
|
|
96
95
|
}
|
|
97
96
|
catch {
|
|
@@ -8,25 +8,38 @@ export declare function writeInitialDispatchRecord(input: WriteInitialDispatchIn
|
|
|
8
8
|
record: DispatchRecord;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Bound the dispatch ledger before a new record registers: index rows left
|
|
12
|
+
* `queued` past the bound, whose record is still `queued`, are finalized by the
|
|
13
|
+
* tooling rather than by a remembered `peaks sub-agent finalize` call (measured:
|
|
14
|
+
* 39/39, 2/2, 9/9, 23/23 rows across four sessions had never been finalized).
|
|
15
|
+
*
|
|
16
|
+
* The RECORD decides, not the index row. Nothing writes a mid-flight status into
|
|
17
|
+
* a row — `registerActiveDispatch` hardcodes `queued` and the only unregister
|
|
18
|
+
* caller deletes the row — so a row reads `queued` for a sub-agent that is
|
|
19
|
+
* heartbeating right now, and a row-keyed guard would reap a live dispatch.
|
|
20
|
+
* `no-execution` is terminal for the heartbeat pollers, so that would stop a
|
|
21
|
+
* watcher waiting on work that is still running.
|
|
22
|
+
*
|
|
23
|
+
* The clock passed in is the SAME one that stamps this dispatch's `createdAt`,
|
|
24
|
+
* so the bound is judged on one clock and a caller that injects a clock (every
|
|
25
|
+
* test, and any replay) sees a consistent frame.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* The record's own status, or `null` when the record file is absent. An
|
|
29
|
+
* unparseable file reports `unreadable` — a real terminal status — rather than
|
|
30
|
+
* `null`, so a caller can tell "no record here" from "a record I may not
|
|
31
|
+
* rewrite"; the reaper drops a row only for the first.
|
|
32
|
+
*
|
|
33
|
+
* Exported because the reaper takes it as its reader, so production and its
|
|
34
|
+
* tests judge on the same implementation rather than on two copies of it.
|
|
14
35
|
*/
|
|
15
|
-
export
|
|
16
|
-
readonly recordPath: string;
|
|
17
|
-
readonly requestId: string;
|
|
18
|
-
readonly role: string;
|
|
19
|
-
readonly batchId: string;
|
|
20
|
-
readonly createdAt: string;
|
|
21
|
-
readonly status: 'queued' | 'running' | 'finalizing' | 'done' | 'failed' | 'cancelled' | 'stale' | 'no-execution' | 'never-started' | 'unreadable';
|
|
22
|
-
}
|
|
36
|
+
export declare function readRecordStatus(recordPath: string): string | null;
|
|
23
37
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* (the on-disk records directory is the next fallback).
|
|
38
|
+
* The active-dispatches index lives in `./active-dispatch-index.ts` (split out
|
|
39
|
+
* to keep this file under its size cap). Re-exported here so every existing
|
|
40
|
+
* importer keeps its path.
|
|
28
41
|
*/
|
|
29
|
-
export
|
|
42
|
+
export { readActiveDispatchIndex, type ActiveDispatchEntry } from './active-dispatch-index.js';
|
|
30
43
|
export declare const DISPATCH_RECORD_TTL_DAYS = 30;
|
|
31
44
|
/**
|
|
32
45
|
* (older than DISPATCH_RECORD_TTL_DAYS or already GC'd)? Mirrors
|