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
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* - `dispatch-failed` — parent LLM threw before returning the audit envelope
|
|
40
40
|
* - `envelope-malformed` — parent LLM returned a value that fails `isSecurityAuditEnvelope`
|
|
41
41
|
*/
|
|
42
|
-
export type SecurityAuditDetectState = 'ready' | 'handoff-missing' | 'template-missing' | 'dispatch-failed' | 'envelope-malformed';
|
|
42
|
+
export type SecurityAuditDetectState = 'ready' | 'handoff-missing' | 'template-missing' | 'dispatch-failed' | 'envelope-malformed' | 'declaration-missing';
|
|
43
43
|
export interface SecurityAuditDetectResult {
|
|
44
44
|
readonly state: SecurityAuditDetectState;
|
|
45
45
|
readonly handoffPresent: boolean;
|
|
@@ -65,35 +65,6 @@ export interface SecurityAuditEnvelope {
|
|
|
65
65
|
* `isEccEnvelope` strict-shape pattern.
|
|
66
66
|
*/
|
|
67
67
|
export declare function isSecurityAuditEnvelope(value: unknown): value is SecurityAuditEnvelope;
|
|
68
|
-
/**
|
|
69
|
-
* Handoff frontmatter — minimal projection of peaks-prd v2.11.0 handoff
|
|
70
|
-
* frontmatter. We only need sha256 for verification; the rest of the
|
|
71
|
-
* handoff body is consumed by the parent LLM, not by this service.
|
|
72
|
-
*/
|
|
73
|
-
export interface HandoffFrontmatter {
|
|
74
|
-
readonly sha256: string;
|
|
75
|
-
readonly schemaVersion: number;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Read the peaks-prd handoff frontmatter + body, verify sha256 matches
|
|
79
|
-
* the body. Returns null on missing file or sha256 mismatch; otherwise
|
|
80
|
-
* returns the parsed frontmatter + body string.
|
|
81
|
-
*
|
|
82
|
-
* Defensive: we read frontmatter via a 1-line regex match, not via
|
|
83
|
-
* a YAML parser. The handoff service (`src/services/prd/handoff-service.ts`)
|
|
84
|
-
* is the canonical writer; we only consume its output here.
|
|
85
|
-
*/
|
|
86
|
-
export declare function readAndVerifyHandoff(handoffPath: string, projectRoot: string): {
|
|
87
|
-
frontmatter: HandoffFrontmatter;
|
|
88
|
-
body: string;
|
|
89
|
-
} | null;
|
|
90
|
-
/**
|
|
91
|
-
* Read the project-level security-template.md. Returns the body
|
|
92
|
-
* string (with frontmatter stripped) or null if the file is absent.
|
|
93
|
-
* Does NOT validate the template content; the parent LLM validates
|
|
94
|
-
* by reading.
|
|
95
|
-
*/
|
|
96
|
-
export declare function readSecurityTemplate(projectRoot: string): string | null;
|
|
97
68
|
/**
|
|
98
69
|
* 5-state detector. The parent skill inspects the state and either
|
|
99
70
|
* proceeds (when `ready`) or records a degradation note and falls
|
|
@@ -115,29 +86,6 @@ export declare function detectSecurityAudit(input: {
|
|
|
115
86
|
readonly dispatchError?: unknown;
|
|
116
87
|
readonly envelope?: unknown;
|
|
117
88
|
}): SecurityAuditDetectResult;
|
|
118
|
-
/**
|
|
119
|
-
* Render a SecurityAuditEnvelope to the canonical audit artifact body
|
|
120
|
-
* (markdown). Mirrors `adaptEccEnvelopeToRdCodeReview` in ecc-bridge.ts:
|
|
121
|
-
* produce a markdown body with all required sections, ready to write
|
|
122
|
-
* to `.peaks/_runtime/<sid>/audit/security-<rid>.md`.
|
|
123
|
-
*/
|
|
124
|
-
export declare function renderSecurityAuditArtifact(env: SecurityAuditEnvelope, opts: {
|
|
125
|
-
rid: string;
|
|
126
|
-
handoffHash: string;
|
|
127
|
-
generatedAt: string;
|
|
128
|
-
}): {
|
|
129
|
-
body: string;
|
|
130
|
-
violationsCount: number;
|
|
131
|
-
verdict: SecurityAuditVerdict;
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* Write the rendered audit artifact to
|
|
135
|
-
* `.peaks/_runtime/<sid>/audit/security-<rid>.md`.
|
|
136
|
-
*
|
|
137
|
-
* Atomic write (tmp + rename) to avoid partial writes on crash.
|
|
138
|
-
* Returns the absolute path on success.
|
|
139
|
-
*/
|
|
140
|
-
export declare function writeSecurityAuditArtifact(projectRoot: string, sessionId: string, rid: string, body: string): string;
|
|
141
89
|
/**
|
|
142
90
|
* Convenience: run `detectSecurityAudit` + `renderSecurityAuditArtifact`
|
|
143
91
|
* + `writeSecurityAuditArtifact` in one call.
|
|
@@ -150,6 +98,11 @@ export declare function runSecurityAudit(input: {
|
|
|
150
98
|
readonly sessionId: string;
|
|
151
99
|
readonly rid: string;
|
|
152
100
|
readonly generatedAt: string;
|
|
101
|
+
/** Project-relative paths this audit judged; written into the artifact as
|
|
102
|
+
* the declaration the transition gate reads back. Required — a path that
|
|
103
|
+
* cannot be hashed is refused, because a declaration naming a file that is
|
|
104
|
+
* not there cannot be checked later. */
|
|
105
|
+
readonly judgedPaths: readonly string[];
|
|
153
106
|
readonly dispatchError?: unknown;
|
|
154
107
|
readonly envelope?: unknown;
|
|
155
108
|
}): {
|
|
@@ -30,11 +30,13 @@
|
|
|
30
30
|
* - Output: `.peaks/_runtime/<sid>/audit/security-<rid>.md`
|
|
31
31
|
* - Schema: `.peaks/project-scan/audit-output-schema.md` (schemaVersion: 1)
|
|
32
32
|
*/
|
|
33
|
-
import { existsSync
|
|
34
|
-
import { join
|
|
35
|
-
import { createHash } from 'node:crypto';
|
|
36
|
-
import { REQUEST_ID_PATTERN } from '../artifacts/request-artifact-service.js';
|
|
33
|
+
import { existsSync } from 'node:fs';
|
|
34
|
+
import { join } from 'node:path';
|
|
37
35
|
import { resolveHandoffPath } from '../prd/handoff-service.js';
|
|
36
|
+
import { handoffMissingRefusal } from './handoff-missing-refusal.js';
|
|
37
|
+
import { renderSecurityAuditArtifact, writeSecurityAuditArtifact } from './security-audit-artifact.js';
|
|
38
|
+
import { declarationMissingDetect, renderJudgedDeclaration } from './judged-declaration.js';
|
|
39
|
+
import { buildJudgedDeclarationFor } from './judged-declaration-build.js';
|
|
38
40
|
/**
|
|
39
41
|
* Validate a raw value as a SecurityAuditEnvelope. Mirrors the
|
|
40
42
|
* `isEccEnvelope` strict-shape pattern.
|
|
@@ -75,70 +77,6 @@ export function isSecurityAuditEnvelope(value) {
|
|
|
75
77
|
}
|
|
76
78
|
return true;
|
|
77
79
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Read the peaks-prd handoff frontmatter + body, verify sha256 matches
|
|
80
|
-
* the body. Returns null on missing file or sha256 mismatch; otherwise
|
|
81
|
-
* returns the parsed frontmatter + body string.
|
|
82
|
-
*
|
|
83
|
-
* Defensive: we read frontmatter via a 1-line regex match, not via
|
|
84
|
-
* a YAML parser. The handoff service (`src/services/prd/handoff-service.ts`)
|
|
85
|
-
* is the canonical writer; we only consume its output here.
|
|
86
|
-
*/
|
|
87
|
-
export function readAndVerifyHandoff(handoffPath, projectRoot) {
|
|
88
|
-
if (!handoffPath || !isAbsolute(handoffPath)) {
|
|
89
|
-
const absolutePath = resolve(projectRoot, handoffPath);
|
|
90
|
-
if (!existsSync(absolutePath))
|
|
91
|
-
return null;
|
|
92
|
-
return readAndVerifyHandoff(absolutePath, projectRoot);
|
|
93
|
-
}
|
|
94
|
-
if (!existsSync(handoffPath))
|
|
95
|
-
return null;
|
|
96
|
-
let raw;
|
|
97
|
-
try {
|
|
98
|
-
raw = readFileSync(handoffPath, 'utf8');
|
|
99
|
-
}
|
|
100
|
-
catch {
|
|
101
|
-
// TODO(g2): legacy silent catch — grace: 1 minor release (v2.14.0)
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
// Frontmatter pattern: `---` line, then key: value pairs, then `---` line.
|
|
105
|
-
const match = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
106
|
-
if (match === null)
|
|
107
|
-
return null;
|
|
108
|
-
const frontmatterRaw = match[1];
|
|
109
|
-
const body = match[2];
|
|
110
|
-
const sha256Match = frontmatterRaw.match(/^sha256:\s*([a-f0-9]{64})\s*$/m);
|
|
111
|
-
const schemaVersionMatch = frontmatterRaw.match(/^schemaVersion:\s*(\d+)\s*$/m);
|
|
112
|
-
if (sha256Match === null || schemaVersionMatch === null)
|
|
113
|
-
return null;
|
|
114
|
-
const sha256Expected = sha256Match[1];
|
|
115
|
-
const schemaVersion = parseInt(schemaVersionMatch[1], 10);
|
|
116
|
-
const sha256Actual = createHash('sha256').update(body, 'utf8').digest('hex');
|
|
117
|
-
if (sha256Expected !== sha256Actual)
|
|
118
|
-
return null;
|
|
119
|
-
return {
|
|
120
|
-
frontmatter: { sha256: sha256Expected, schemaVersion },
|
|
121
|
-
body
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Read the project-level security-template.md. Returns the body
|
|
126
|
-
* string (with frontmatter stripped) or null if the file is absent.
|
|
127
|
-
* Does NOT validate the template content; the parent LLM validates
|
|
128
|
-
* by reading.
|
|
129
|
-
*/
|
|
130
|
-
export function readSecurityTemplate(projectRoot) {
|
|
131
|
-
const templatePath = join(projectRoot, '.peaks', 'project-scan', 'security-template.md');
|
|
132
|
-
if (!existsSync(templatePath))
|
|
133
|
-
return null;
|
|
134
|
-
try {
|
|
135
|
-
return readFileSync(templatePath, 'utf8');
|
|
136
|
-
}
|
|
137
|
-
catch {
|
|
138
|
-
// TODO(g2): legacy silent catch — grace: 1 minor release (v2.14.0)
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
80
|
/**
|
|
143
81
|
* 5-state detector. The parent skill inspects the state and either
|
|
144
82
|
* proceeds (when `ready`) or records a degradation note and falls
|
|
@@ -159,22 +97,20 @@ export function detectSecurityAudit(input) {
|
|
|
159
97
|
const templatePath = join(input.projectRoot, '.peaks', 'project-scan', 'security-template.md');
|
|
160
98
|
const templatePresent = existsSync(templatePath);
|
|
161
99
|
if (!handoffPresent) {
|
|
100
|
+
const refusal = handoffMissingRefusal({
|
|
101
|
+
role: 'security',
|
|
102
|
+
projectRoot: input.projectRoot,
|
|
103
|
+
sessionId: input.sessionId,
|
|
104
|
+
...(input.requestId !== undefined ? { requestId: input.requestId } : {}),
|
|
105
|
+
// Measured, not assumed: `detect` supplies no envelope at all.
|
|
106
|
+
envelopeValidated: input.envelope !== undefined && isSecurityAuditEnvelope(input.envelope)
|
|
107
|
+
});
|
|
162
108
|
return {
|
|
163
109
|
state: 'handoff-missing',
|
|
164
110
|
handoffPresent: false,
|
|
165
111
|
templatePresent,
|
|
166
|
-
warnings:
|
|
167
|
-
|
|
168
|
-
...(input.requestId === undefined
|
|
169
|
-
? [
|
|
170
|
-
"No --rid was supplied, so only the pre-rid-scoping `prd/handoff.md` could be probed. Pass --rid to resolve this slice's `prd/handoff-<rid>.md`."
|
|
171
|
-
]
|
|
172
|
-
: [])
|
|
173
|
-
],
|
|
174
|
-
nextActions: [
|
|
175
|
-
'Run peaks-prd handoff init to produce a sha256-locked handoff before running peaks security-audit.',
|
|
176
|
-
'Until the handoff exists, peaks-security-audit cannot start (gate fail).'
|
|
177
|
-
]
|
|
112
|
+
warnings: refusal.warnings,
|
|
113
|
+
nextActions: refusal.nextActions
|
|
178
114
|
};
|
|
179
115
|
}
|
|
180
116
|
if (!templatePresent) {
|
|
@@ -225,90 +161,6 @@ export function detectSecurityAudit(input) {
|
|
|
225
161
|
nextActions
|
|
226
162
|
};
|
|
227
163
|
}
|
|
228
|
-
/**
|
|
229
|
-
* Render a SecurityAuditEnvelope to the canonical audit artifact body
|
|
230
|
-
* (markdown). Mirrors `adaptEccEnvelopeToRdCodeReview` in ecc-bridge.ts:
|
|
231
|
-
* produce a markdown body with all required sections, ready to write
|
|
232
|
-
* to `.peaks/_runtime/<sid>/audit/security-<rid>.md`.
|
|
233
|
-
*/
|
|
234
|
-
export function renderSecurityAuditArtifact(env, opts) {
|
|
235
|
-
const counts = {};
|
|
236
|
-
for (const v of env.violations) {
|
|
237
|
-
counts[v.severity] = (counts[v.severity] ?? 0) + 1;
|
|
238
|
-
}
|
|
239
|
-
const criticalCount = counts['CRITICAL'] ?? 0;
|
|
240
|
-
const findingsBullets = env.violations.length === 0
|
|
241
|
-
? '- (none)'
|
|
242
|
-
: env.violations
|
|
243
|
-
.map((v) => `- [${v.severity}] ${v.dimension} @ ${v.file}:${v.line} — ${v.hint}`)
|
|
244
|
-
.join('\n');
|
|
245
|
-
const requiredFixes = buildRequiredFixes(env);
|
|
246
|
-
const body = [
|
|
247
|
-
'## Summary',
|
|
248
|
-
'',
|
|
249
|
-
env.summary,
|
|
250
|
-
'',
|
|
251
|
-
'## Threat model coverage',
|
|
252
|
-
'',
|
|
253
|
-
`audited at: ${opts.generatedAt}`,
|
|
254
|
-
`verdict: ${env.verdict}`,
|
|
255
|
-
`handoffHash: ${opts.handoffHash}`,
|
|
256
|
-
'',
|
|
257
|
-
'## Findings',
|
|
258
|
-
'',
|
|
259
|
-
findingsBullets,
|
|
260
|
-
'',
|
|
261
|
-
requiredFixes,
|
|
262
|
-
'## Verdict',
|
|
263
|
-
'',
|
|
264
|
-
`verdict: ${env.verdict}`,
|
|
265
|
-
`CRITICAL: ${criticalCount}`,
|
|
266
|
-
''
|
|
267
|
-
]
|
|
268
|
-
.filter((s) => s.length > 0)
|
|
269
|
-
.join('\n');
|
|
270
|
-
return {
|
|
271
|
-
body,
|
|
272
|
-
violationsCount: env.violations.length,
|
|
273
|
-
verdict: env.verdict
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
function buildRequiredFixes(env) {
|
|
277
|
-
const requiredFixes = env.violations.length === 0
|
|
278
|
-
? ''
|
|
279
|
-
: [
|
|
280
|
-
'## Required fixes',
|
|
281
|
-
'',
|
|
282
|
-
...env.violations.map((v) => `- [${v.severity}] ${v.file}:${v.line} — ${v.hint}`),
|
|
283
|
-
''
|
|
284
|
-
].join('\n');
|
|
285
|
-
return requiredFixes;
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Write the rendered audit artifact to
|
|
289
|
-
* `.peaks/_runtime/<sid>/audit/security-<rid>.md`.
|
|
290
|
-
*
|
|
291
|
-
* Atomic write (tmp + rename) to avoid partial writes on crash.
|
|
292
|
-
* Returns the absolute path on success.
|
|
293
|
-
*/
|
|
294
|
-
export function writeSecurityAuditArtifact(projectRoot, sessionId, rid, body) {
|
|
295
|
-
// The rid is a filename below, and the write is tmp+rename, so an
|
|
296
|
-
// unvalidated rid can OVERWRITE an arbitrary `.md` rather than merely create
|
|
297
|
-
// one. Guarded here (not only at the CLI boundary) so no caller can skip it.
|
|
298
|
-
if (!REQUEST_ID_PATTERN.test(rid)) {
|
|
299
|
-
throw new Error(`Invalid request id: ${rid} (expected letters, digits, dots, underscores, or dashes)`);
|
|
300
|
-
}
|
|
301
|
-
const targetDir = join(projectRoot, '.peaks', '_runtime', sessionId, 'audit');
|
|
302
|
-
mkdirSync(targetDir, { recursive: true });
|
|
303
|
-
const targetPath = join(targetDir, `security-${rid}.md`);
|
|
304
|
-
// tmp + rename for atomicity
|
|
305
|
-
const tmpPath = `${targetPath}.tmp`;
|
|
306
|
-
writeFileSync(tmpPath, body, 'utf8');
|
|
307
|
-
// Sync rename: on Windows, fs.renameSync overwrites if target exists (Node 22+)
|
|
308
|
-
const { renameSync } = require('node:fs');
|
|
309
|
-
renameSync(tmpPath, targetPath);
|
|
310
|
-
return targetPath;
|
|
311
|
-
}
|
|
312
164
|
/**
|
|
313
165
|
* Convenience: run `detectSecurityAudit` + `renderSecurityAuditArtifact`
|
|
314
166
|
* + `writeSecurityAuditArtifact` in one call.
|
|
@@ -324,24 +176,28 @@ export function runSecurityAudit(input) {
|
|
|
324
176
|
...(input.dispatchError !== undefined ? { dispatchError: input.dispatchError } : {}),
|
|
325
177
|
...(input.envelope !== undefined ? { envelope: input.envelope } : {})
|
|
326
178
|
});
|
|
327
|
-
|
|
328
|
-
|
|
179
|
+
// The stamp is built inside the producer, before anything is written, so a
|
|
180
|
+
// caller that reaches the service alone still cannot leave an unstamped
|
|
181
|
+
// artifact behind. Folding its failure into the probe's own verdict keeps the
|
|
182
|
+
// refusal on this function's single early-return rather than a second one.
|
|
183
|
+
const built = buildJudgedDeclarationFor(input);
|
|
184
|
+
// A probe that is already refusing keeps its own diagnosis: the declaration
|
|
185
|
+
// is what this run would write, not what stopped it earlier.
|
|
186
|
+
const probe = built.ok || detect.state !== 'ready' ? detect : declarationMissingDetect(detect, built);
|
|
187
|
+
if (probe.state !== 'ready' || input.envelope === undefined || !built.ok) {
|
|
188
|
+
return { detect: probe, artifactPath: null, violationsCount: 0, verdict: null };
|
|
329
189
|
}
|
|
330
|
-
//
|
|
190
|
+
// probe.state === 'ready' implies input.envelope passed isSecurityAuditEnvelope.
|
|
331
191
|
const env = input.envelope;
|
|
332
|
-
const
|
|
333
|
-
projectRoot: input.projectRoot,
|
|
334
|
-
sessionId: input.sessionId,
|
|
335
|
-
requestId: input.rid
|
|
336
|
-
});
|
|
337
|
-
const verified = handoffPath === null ? null : readAndVerifyHandoff(handoffPath, input.projectRoot);
|
|
338
|
-
const handoffHash = verified?.frontmatter.sha256 ?? 'unknown';
|
|
339
|
-
const rendered = renderSecurityAuditArtifact(env, {
|
|
192
|
+
const renderOpts = {
|
|
340
193
|
rid: input.rid,
|
|
341
|
-
handoffHash,
|
|
194
|
+
handoffHash: built.handoffHash,
|
|
342
195
|
generatedAt: input.generatedAt
|
|
343
|
-
}
|
|
344
|
-
const
|
|
196
|
+
};
|
|
197
|
+
const rendered = renderSecurityAuditArtifact(env, renderOpts);
|
|
198
|
+
const declared = built.declaration;
|
|
199
|
+
const body = `${rendered.body}\n${renderJudgedDeclaration(declared)}`;
|
|
200
|
+
const artifactPath = writeSecurityAuditArtifact(input.projectRoot, input.sessionId, input.rid, body);
|
|
345
201
|
return {
|
|
346
202
|
detect,
|
|
347
203
|
artifactPath,
|
|
@@ -12,27 +12,49 @@ const FOUR_DIMENSIONS = [
|
|
|
12
12
|
];
|
|
13
13
|
const FIFTH_DIMENSION = 'capability-consistency';
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* An oversized source that backs `dimension`, in whichever of the two states
|
|
16
|
+
* the allocator can leave it.
|
|
17
|
+
*
|
|
18
|
+
* F3 (review 2026-10-13) — this used to build the omitted shape behind an
|
|
19
|
+
* `as unknown as CollectedEvidence` cast that omitted `excerpt`, so a `found`
|
|
20
|
+
* over-cap source built here would have been reported as "no deliverable
|
|
21
|
+
* source" while a cap-sized head of it had been inlined. The cast is gone and
|
|
22
|
+
* `excerpt` is declared, so the state the report distinguishes cannot be
|
|
23
|
+
* expressed wrongly from this helper.
|
|
17
24
|
*/
|
|
18
|
-
function
|
|
25
|
+
function overCapSource(dimension, totalBytes, inlined) {
|
|
19
26
|
return {
|
|
20
27
|
source: {
|
|
21
28
|
key: `k-${dimension}`,
|
|
22
29
|
label: dimension,
|
|
23
30
|
segments: [`${dimension}.md`],
|
|
31
|
+
// The fixture deliberately fabricates dimension names (the fifth one is
|
|
32
|
+
// not a `DimensionKind`), so this ONE field is asserted, not inferred —
|
|
33
|
+
// the rest of the record is fully typed.
|
|
24
34
|
supports: [dimension],
|
|
25
35
|
delivery: { kind: 'whole' }
|
|
26
36
|
},
|
|
27
37
|
relativePath: `${dimension}.md`,
|
|
28
38
|
absolutePath: `/nonexistent/${dimension}.md`,
|
|
29
|
-
status: 'omitted',
|
|
39
|
+
status: inlined ? 'found' : 'omitted',
|
|
30
40
|
totalBytes,
|
|
31
|
-
includedBytes: 0,
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
includedBytes: inlined ? MAX_EVIDENCE_BYTES_PER_FILE : 0,
|
|
42
|
+
excerpt: inlined,
|
|
43
|
+
content: inlined ? 'x'.repeat(MAX_EVIDENCE_BYTES_PER_FILE) : '',
|
|
44
|
+
reason: inlined ? '' : 'over-cap'
|
|
34
45
|
};
|
|
35
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* One oversized, omitted source that backs `dimension`. `omitted` + over-cap +
|
|
49
|
+
* zero delivered bytes is the structural case: nothing can ever deliver it.
|
|
50
|
+
*/
|
|
51
|
+
function undeliverableSource(dimension, totalBytes) {
|
|
52
|
+
return overCapSource(dimension, totalBytes, false);
|
|
53
|
+
}
|
|
54
|
+
/** `dimension=excerpt|silent` per entry — what the report says ARRIVED. */
|
|
55
|
+
function excerptState(report) {
|
|
56
|
+
return report.map((r) => `${r.dimension}=${r.excerptDelivered ? 'excerpt' : 'silent'}`).join(',');
|
|
57
|
+
}
|
|
36
58
|
function reviewJson(dimensions) {
|
|
37
59
|
return JSON.stringify({
|
|
38
60
|
rid: 'J05-fixture',
|
|
@@ -112,22 +134,46 @@ function probeOutputBudget() {
|
|
|
112
134
|
}
|
|
113
135
|
return { floor, ceiling, badOverrideThrows };
|
|
114
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* The over-cap evidence states, as probes.
|
|
139
|
+
*
|
|
140
|
+
* F3 (review 2026-10-13) is the pair that matters: the SAME oversized source,
|
|
141
|
+
* once inlined and once not, has to be reported as two DIFFERENT things. Both
|
|
142
|
+
* are driven here so the report cannot answer "nothing arrived" about a source
|
|
143
|
+
* whose cap-sized head is in the reviewer's prompt.
|
|
144
|
+
*
|
|
145
|
+
* Extracted from `runJ05Contract` so that function stays inside the
|
|
146
|
+
* function-length rule.
|
|
147
|
+
*/
|
|
148
|
+
function overCapEvidenceProbes() {
|
|
149
|
+
const reported = undeliverableDimensions(FOUR_DIMENSIONS.map((d) => undeliverableSource(d, MAX_EVIDENCE_BYTES_PER_FILE + 1000)));
|
|
150
|
+
const dimensions = reported.map((r) => r.dimension);
|
|
151
|
+
const fifthOnly = undeliverableDimensions([
|
|
152
|
+
undeliverableSource(FIFTH_DIMENSION, MAX_EVIDENCE_BYTES_PER_FILE + 1000)
|
|
153
|
+
]);
|
|
154
|
+
const excerptOnly = undeliverableDimensions([
|
|
155
|
+
overCapSource(FOUR_DIMENSIONS[0], MAX_EVIDENCE_BYTES_PER_FILE + 1000, true)
|
|
156
|
+
]);
|
|
157
|
+
return [
|
|
158
|
+
probe(dimensions.length === FOUR_DIMENSIONS.length &&
|
|
159
|
+
FOUR_DIMENSIONS.every((d) => dimensions.includes(d)), `the canonical dimension set is exactly the four baseline dimensions (reported: ${dimensions.join(',') || 'none'})`),
|
|
160
|
+
probe(fifthOnly.length === 0, `the fifth dimension is not part of the required set (reported: ${fifthOnly.length})`),
|
|
161
|
+
probe(excerptOnly.length === 1 &&
|
|
162
|
+
excerptOnly[0]?.excerptDelivered === true &&
|
|
163
|
+
excerptOnly[0]?.sources[0]?.excerptBytes === MAX_EVIDENCE_BYTES_PER_FILE, `an over-cap source that WAS inlined is reported as an excerpt, not as nothing arrived (reported: ${excerptState(excerptOnly)})`),
|
|
164
|
+
probe(reported.length === FOUR_DIMENSIONS.length && reported.every((r) => !r.excerptDelivered), `an over-cap source that was NOT inlined is reported as nothing arrived (reported: ${excerptState(reported)})`)
|
|
165
|
+
];
|
|
166
|
+
}
|
|
115
167
|
export async function runJ05Contract(ctx) {
|
|
116
168
|
const row = requireBaselineRow(ctx);
|
|
117
169
|
const missing = missingSourceFiles(ctx, row);
|
|
118
170
|
const prepared = await probePrepareFinalReview();
|
|
119
|
-
const oversized = FOUR_DIMENSIONS.map((d) => undeliverableSource(d, MAX_EVIDENCE_BYTES_PER_FILE + 1000));
|
|
120
|
-
const reported = undeliverableDimensions(oversized).map((r) => r.dimension);
|
|
121
|
-
const fifthOnly = undeliverableDimensions([
|
|
122
|
-
undeliverableSource(FIFTH_DIMENSION, MAX_EVIDENCE_BYTES_PER_FILE + 1000)
|
|
123
|
-
]);
|
|
124
171
|
const { floor, ceiling, badOverrideThrows } = probeOutputBudget();
|
|
125
172
|
const result = combineProbes([
|
|
126
173
|
probe(missing.length === 0, `baseline sourceFiles present (${row.sourceFiles.length})`),
|
|
127
174
|
probe(prepared.rejected, `a three-dimension review is refused (${prepared.detail})`),
|
|
128
175
|
probe(prepared.accepted, `a four-dimension review is accepted (${prepared.detail})`),
|
|
129
|
-
|
|
130
|
-
probe(fifthOnly.length === 0, `the fifth dimension is not part of the required set (reported: ${fifthOnly.length})`),
|
|
176
|
+
...overCapEvidenceProbes(),
|
|
131
177
|
probe(MAX_EVIDENCE_BYTES_PER_FILE === 10240, `per-file evidence cap divides the total by four (${String(MAX_EVIDENCE_BYTES_PER_FILE)})`),
|
|
132
178
|
probe(floor === 15288 && ceiling === 32000, `output budget is clamped on both ends (${String(floor)} / ${String(ceiling)})`),
|
|
133
179
|
probe(badOverrideThrows, 'a non-integer budget override throws instead of falling back silently')
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type HarnessWindowSyncResult } from '../context/harness-window-config.js';
|
|
2
|
+
import type { ConvergencePlan } from '../context/auto-compact-types.js';
|
|
3
|
+
/**
|
|
4
|
+
* What the caller is told to do next. The harness-window notice rides along because
|
|
5
|
+
* the run also rewrites the harness's own settings, so it says so too: the user
|
|
6
|
+
* accepted that write on the condition 要告知, and a write only one of the two
|
|
7
|
+
* syncing commands reports is not a notice.
|
|
8
|
+
*/
|
|
9
|
+
export declare function compactNextActions(isRedLine: boolean, harnessWindow: HarnessWindowSyncResult | null): readonly string[];
|
|
10
|
+
/**
|
|
11
|
+
* Append a one-row convergence decision to the LLM-readable log.
|
|
12
|
+
* The LLM reads this on the post-compact turn to pick up exactly
|
|
13
|
+
* where it left off (vs. blindly trusting the IDE's compressed
|
|
14
|
+
* transcript).
|
|
15
|
+
*/
|
|
16
|
+
export declare function appendAutoDecisionLog(input: {
|
|
17
|
+
readonly projectRoot: string;
|
|
18
|
+
readonly sessionId: string;
|
|
19
|
+
readonly plan: ConvergencePlan;
|
|
20
|
+
}): void;
|
|
21
|
+
/**
|
|
22
|
+
* main-session compact intent so the main-session LLM picks it up on
|
|
23
|
+
* its next turn and fires `/compact` in-band. Without this file the
|
|
24
|
+
* orchestrator's "main-session compact" request is invisible to the
|
|
25
|
+
* main Claude Code window (defeats the whole point of auto-compact
|
|
26
|
+
* for the main context).
|
|
27
|
+
*
|
|
28
|
+
* The file is gitignored under `.peaks/_runtime/<sessionId>/txt/` and
|
|
29
|
+
* is one-shot: the LLM should `mv` it to `.consumed` after firing
|
|
30
|
+
* `/compact`. A re-run will overwrite.
|
|
31
|
+
*
|
|
32
|
+
* write survives, but nothing consumes the file, and its `nextAction` asks
|
|
33
|
+
* for a `/compact` the model cannot invoke (the Skill tool exposes only
|
|
34
|
+
* `/init` and `/security-review`; hooks can observe or veto, never initiate).
|
|
35
|
+
* Retained deliberately for the sibling A2 slice, which owns harness-side
|
|
36
|
+
* state re-injection. Not a capability peaks-loop has today.
|
|
37
|
+
*/
|
|
38
|
+
export declare function writeMainSessionCompactIntent(input: {
|
|
39
|
+
readonly projectRoot: string;
|
|
40
|
+
readonly sessionId: string;
|
|
41
|
+
readonly ratio: number;
|
|
42
|
+
readonly redLine: boolean;
|
|
43
|
+
readonly now: Date;
|
|
44
|
+
}): void;
|
|
45
|
+
/**
|
|
46
|
+
* Write a pre-compact checkpoint. The shape mirrors `peaks session
|
|
47
|
+
* checkpoint` so D7's post-compact-detect picks it up unchanged.
|
|
48
|
+
*/
|
|
49
|
+
export declare function writePreCompactCheckpoint(input: {
|
|
50
|
+
readonly projectRoot: string;
|
|
51
|
+
readonly sessionId: string;
|
|
52
|
+
readonly now: Date;
|
|
53
|
+
readonly redLine?: boolean;
|
|
54
|
+
}): string;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The files one auto-compact run writes: checkpoint, intent and decision log.
|
|
3
|
+
*
|
|
4
|
+
* Split out of `auto-compact-orchestrator.ts` (file-size cap campaign). The
|
|
5
|
+
* orchestrator re-exports every name declared here, so existing importers keep
|
|
6
|
+
* using `./auto-compact-orchestrator.js` unchanged.
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import { getSessionDir } from '../session/getSessionDir.js';
|
|
11
|
+
import { describeHarnessWindowSync } from '../context/harness-window-config.js';
|
|
12
|
+
/**
|
|
13
|
+
* What the caller is told to do next. The harness-window notice rides along because
|
|
14
|
+
* the run also rewrites the harness's own settings, so it says so too: the user
|
|
15
|
+
* accepted that write on the condition 要告知, and a write only one of the two
|
|
16
|
+
* syncing commands reports is not a notice.
|
|
17
|
+
*/
|
|
18
|
+
export function compactNextActions(isRedLine, harnessWindow) {
|
|
19
|
+
if (isRedLine) {
|
|
20
|
+
return [
|
|
21
|
+
'RED-LINE: harness compact requested — sub-agent dispatch is NOT blocked; keep working',
|
|
22
|
+
'Post-compact resume picks up the convergence plan from auto-decisions.md',
|
|
23
|
+
'Next `peaks code context-now` probe will confirm the ratio dropped; if it keeps climbing and the harness has not compacted, report that to the user and hand control back',
|
|
24
|
+
describeHarnessWindowSync(harnessWindow)
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
return [
|
|
28
|
+
'Pre-compact dispatched — IDE compact in progress (async)',
|
|
29
|
+
'Post-compact resume picks up the convergence plan from auto-decisions.md',
|
|
30
|
+
'Next `peaks code auto-compact` probe will confirm ratio dropped below 0.85',
|
|
31
|
+
describeHarnessWindowSync(harnessWindow)
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
const PRE_COMPACT_REASON = 'pre-compact-auto';
|
|
35
|
+
/**
|
|
36
|
+
* Append a one-row convergence decision to the LLM-readable log.
|
|
37
|
+
* The LLM reads this on the post-compact turn to pick up exactly
|
|
38
|
+
* where it left off (vs. blindly trusting the IDE's compressed
|
|
39
|
+
* transcript).
|
|
40
|
+
*/
|
|
41
|
+
export function appendAutoDecisionLog(input) {
|
|
42
|
+
// Repair R6: same hand-rolled join as `writePreCompactCheckpoint`. All four
|
|
43
|
+
// session-scoped paths in this file now go through the axis builder; none
|
|
44
|
+
// composes the join itself, so none can resolve outside the project root.
|
|
45
|
+
const dir = join(getSessionDir(input.projectRoot, input.sessionId), 'txt');
|
|
46
|
+
if (!existsSync(dir))
|
|
47
|
+
mkdirSync(dir, { recursive: true });
|
|
48
|
+
const logPath = join(dir, 'auto-decisions.md');
|
|
49
|
+
const row = [
|
|
50
|
+
'',
|
|
51
|
+
`## Auto-compact decision — ${input.plan.createdAt}`,
|
|
52
|
+
`- ratio: ${(input.plan.ratio * 100).toFixed(1)}%`,
|
|
53
|
+
`- checkpoint: ${input.plan.checkpointPath}`,
|
|
54
|
+
`- next-actions: ${input.plan.nextActions.join(' | ')}`,
|
|
55
|
+
`- resume-hint: ${input.plan.resumeHint}`,
|
|
56
|
+
''
|
|
57
|
+
].join('\n');
|
|
58
|
+
if (!existsSync(logPath)) {
|
|
59
|
+
writeFileSync(logPath, `# peaks-code auto-decisions log\n${row}`, 'utf8');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const existing = readFileSync(logPath, 'utf8');
|
|
63
|
+
writeFileSync(logPath, `${existing}${row}`, 'utf8');
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* main-session compact intent so the main-session LLM picks it up on
|
|
67
|
+
* its next turn and fires `/compact` in-band. Without this file the
|
|
68
|
+
* orchestrator's "main-session compact" request is invisible to the
|
|
69
|
+
* main Claude Code window (defeats the whole point of auto-compact
|
|
70
|
+
* for the main context).
|
|
71
|
+
*
|
|
72
|
+
* The file is gitignored under `.peaks/_runtime/<sessionId>/txt/` and
|
|
73
|
+
* is one-shot: the LLM should `mv` it to `.consumed` after firing
|
|
74
|
+
* `/compact`. A re-run will overwrite.
|
|
75
|
+
*
|
|
76
|
+
* write survives, but nothing consumes the file, and its `nextAction` asks
|
|
77
|
+
* for a `/compact` the model cannot invoke (the Skill tool exposes only
|
|
78
|
+
* `/init` and `/security-review`; hooks can observe or veto, never initiate).
|
|
79
|
+
* Retained deliberately for the sibling A2 slice, which owns harness-side
|
|
80
|
+
* state re-injection. Not a capability peaks-loop has today.
|
|
81
|
+
*/
|
|
82
|
+
export function writeMainSessionCompactIntent(input) {
|
|
83
|
+
const dir = join(getSessionDir(input.projectRoot, input.sessionId), 'txt');
|
|
84
|
+
if (!existsSync(dir))
|
|
85
|
+
mkdirSync(dir, { recursive: true });
|
|
86
|
+
const path = join(dir, 'auto-compact-pending.json');
|
|
87
|
+
const payload = {
|
|
88
|
+
schemaVersion: 1,
|
|
89
|
+
pending: true,
|
|
90
|
+
target: 'main',
|
|
91
|
+
requestedAt: input.now.toISOString(),
|
|
92
|
+
ratio: input.ratio,
|
|
93
|
+
redLine: input.redLine,
|
|
94
|
+
nextAction: 'next LLM turn MUST fire `/compact` then `mv .peaks/_runtime/<sid>/txt/auto-compact-pending.json .peaks/_runtime/<sid>/txt/auto-compact-pending.consumed.json`'
|
|
95
|
+
};
|
|
96
|
+
writeFileSync(path, JSON.stringify(payload, null, 2), 'utf8');
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Write a pre-compact checkpoint. The shape mirrors `peaks session
|
|
100
|
+
* checkpoint` so D7's post-compact-detect picks it up unchanged.
|
|
101
|
+
*/
|
|
102
|
+
export function writePreCompactCheckpoint(input) {
|
|
103
|
+
// Repair R6: this used to hand-roll the session join, which is the one shape
|
|
104
|
+
// `getSessionDir`'s own header records as NOT covered by the guard — an
|
|
105
|
+
// unsafe id resolved outside the project root and the checkpoint was written
|
|
106
|
+
// there. The gate above now refuses an unresolvable id before this point, but
|
|
107
|
+
// `--force` outranks that gate, so this join has to hold on its own.
|
|
108
|
+
const dir = join(getSessionDir(input.projectRoot, input.sessionId), 'checkpoints');
|
|
109
|
+
if (!existsSync(dir))
|
|
110
|
+
mkdirSync(dir, { recursive: true });
|
|
111
|
+
const prefix = input.redLine === true ? 'red-line-' : 'pre-compact-';
|
|
112
|
+
const filename = `${prefix}${input.now.toISOString().replace(/[:.]/g, '-')}.json`;
|
|
113
|
+
const path = join(dir, filename);
|
|
114
|
+
const content = {
|
|
115
|
+
schemaVersion: 1,
|
|
116
|
+
reason: input.redLine === true ? 'pre-compact-red-line' : PRE_COMPACT_REASON,
|
|
117
|
+
sessionId: input.sessionId,
|
|
118
|
+
createdAt: input.now.toISOString(),
|
|
119
|
+
// D7 reads `mode`, `currentPlan`, `openQuestions`, `recentDecisions`
|
|
120
|
+
// out of this JSON. We seed empty arrays; the post-compact LLM
|
|
121
|
+
// rehydrates from the auto-decisions log + open question list.
|
|
122
|
+
mode: 'full-auto',
|
|
123
|
+
currentPlan: input.redLine === true
|
|
124
|
+
? 'RED-LINE compact REQUESTED from the harness (not executed by peaks-loop); work continues'
|
|
125
|
+
: 'auto-compact in progress; resume from auto-decisions.md',
|
|
126
|
+
openQuestions: [],
|
|
127
|
+
recentDecisions: [],
|
|
128
|
+
recentArtifactPaths: [],
|
|
129
|
+
gitStatus: '',
|
|
130
|
+
skillsActive: ['peaks-code'],
|
|
131
|
+
todoState: []
|
|
132
|
+
};
|
|
133
|
+
writeFileSync(path, JSON.stringify(content, null, 2), 'utf8');
|
|
134
|
+
return path;
|
|
135
|
+
}
|