peaks-loop 4.0.0-beta.9 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +572 -234
- package/README-en.md +67 -30
- package/README.md +67 -30
- package/agents/karpathy-reviewer.md +33 -0
- package/bin/peaks.js +0 -0
- package/dist/cli/cli-helpers.d.ts +31 -6
- package/dist/cli/cli-helpers.js +48 -25
- package/dist/cli/commands/_register.d.ts +3 -0
- package/dist/cli/commands/_register.js +139 -0
- package/dist/cli/commands/_super.d.ts +10 -0
- package/dist/cli/commands/_super.js +97 -0
- package/dist/cli/commands/adapter-commands-s2a.js +1 -1
- package/dist/cli/commands/asset-commands.js +33 -16
- package/dist/cli/commands/audit-commands.js +2 -2
- package/dist/cli/commands/autonomous-swarm-commands.d.ts +12 -0
- package/dist/cli/commands/autonomous-swarm-commands.js +120 -0
- package/dist/cli/commands/bee-commands.js +1 -1
- package/dist/cli/commands/capability-commands.js +1 -1
- package/dist/cli/commands/capability-worker-config-sc-commands.js +0 -2
- package/dist/cli/commands/changeset-commands.d.ts +13 -0
- package/dist/cli/commands/changeset-commands.js +46 -0
- package/dist/cli/commands/code-commands.d.ts +11 -1
- package/dist/cli/commands/code-commands.js +19 -699
- package/dist/cli/commands/code-job-shape-commands.d.ts +9 -0
- package/dist/cli/commands/code-job-shape-commands.js +164 -0
- package/dist/cli/commands/code-mode-gate-commands.d.ts +9 -0
- package/dist/cli/commands/code-mode-gate-commands.js +223 -0
- package/dist/cli/commands/code-review-commands.js +2 -2
- package/dist/cli/commands/code-run-command.d.ts +12 -0
- package/dist/cli/commands/code-run-command.js +68 -0
- package/dist/cli/commands/code-runtime-commands.d.ts +11 -0
- package/dist/cli/commands/code-runtime-commands.js +391 -0
- package/dist/cli/commands/codegraph-commands.js +1 -1
- package/dist/cli/commands/compact-command.js +53 -1
- package/dist/cli/commands/complexity-commands.js +1 -1
- package/dist/cli/commands/config-commands.js +4 -75
- package/dist/cli/commands/container-commands.d.ts +28 -0
- package/dist/cli/commands/container-commands.js +221 -0
- package/dist/cli/commands/context-commands.js +3 -2
- package/dist/cli/commands/core/artifacts-command.js +1 -1
- package/dist/cli/commands/core/binding-commands.js +1 -1
- package/dist/cli/commands/core/doctor-command.js +63 -3
- package/dist/cli/commands/core/memory-command.js +1 -1
- package/dist/cli/commands/core/profile-command.js +1 -1
- package/dist/cli/commands/core/proxy-command.js +1 -1
- package/dist/cli/commands/core/session-command.js +9 -7
- package/dist/cli/commands/core/skill-command.js +7 -4
- package/dist/cli/commands/core/standards-command.js +1 -1
- package/dist/cli/commands/cron-commands.d.ts +57 -0
- package/dist/cli/commands/cron-commands.js +257 -0
- package/dist/cli/commands/cron-scheduler-commands.d.ts +47 -0
- package/dist/cli/commands/cron-scheduler-commands.js +284 -0
- package/dist/cli/commands/dashboard-commands.d.ts +4 -0
- package/dist/cli/commands/dashboard-commands.js +10 -0
- package/dist/cli/commands/dashboard-long-run.d.ts +25 -0
- package/dist/cli/commands/dashboard-long-run.js +122 -0
- package/dist/cli/commands/dashboard-summary.d.ts +12 -0
- package/dist/cli/commands/dashboard-summary.js +58 -0
- package/dist/cli/commands/dispatch-commands.d.ts +0 -7
- package/dist/cli/commands/dispatch-commands.js +372 -8
- package/dist/cli/commands/dispatch-from-dag.js +4 -1
- package/dist/cli/commands/doc-commands.js +1 -1
- package/dist/cli/commands/ecc-commands.d.ts +30 -0
- package/dist/cli/commands/ecc-commands.js +119 -0
- package/dist/cli/commands/evolution-commands.js +1 -1
- package/dist/cli/commands/feedback-commands.js +1 -1
- package/dist/cli/commands/final-review-commands.js +1 -1
- package/dist/cli/commands/fixture-commands.js +1 -1
- package/dist/cli/commands/fork-commands.js +1 -1
- package/dist/cli/commands/gate-commands.js +128 -6
- package/dist/cli/commands/governance-classify-contract-commands.d.ts +21 -0
- package/dist/cli/commands/governance-classify-contract-commands.js +273 -0
- package/dist/cli/commands/heartbeat-commands.js +76 -5
- package/dist/cli/commands/heartbeat-watch-command.d.ts +31 -0
- package/dist/cli/commands/heartbeat-watch-command.js +146 -0
- package/dist/cli/commands/hook-handle.js +1 -1
- package/dist/cli/commands/hooks-commands.js +126 -10
- package/dist/cli/commands/ide-commands.js +1 -1
- package/dist/cli/commands/impact-commands.js +1 -1
- package/dist/cli/commands/job-commands.js +34 -1
- package/dist/cli/commands/lease-metrics-commands.d.ts +67 -0
- package/dist/cli/commands/lease-metrics-commands.js +231 -0
- package/dist/cli/commands/lease-stats-commands.d.ts +65 -0
- package/dist/cli/commands/lease-stats-commands.js +107 -0
- package/dist/cli/commands/legacy-commands.js +1 -1
- package/dist/cli/commands/log-commands.js +1 -1
- package/dist/cli/commands/loop-commands.js +1 -1
- package/dist/cli/commands/loop-eval-commands.js +1 -1
- package/dist/cli/commands/memory-commands.js +1 -1
- package/dist/cli/commands/migrate-1-4-1-command.js +1 -1
- package/dist/cli/commands/migrate-v2-10-to-v2-11-command.js +1 -1
- package/dist/cli/commands/mut-commands.d.ts +1 -1
- package/dist/cli/commands/mut-commands.js +1 -5
- package/dist/cli/commands/observability-commands.js +1 -1
- package/dist/cli/commands/openspec-commands.js +65 -4
- package/dist/cli/commands/perf-audit-commands.js +3 -3
- package/dist/cli/commands/perf-commands.js +1 -1
- package/dist/cli/commands/polyrepo-commands.js +1 -1
- package/dist/cli/commands/prd-blocks-commands.js +1 -1
- package/dist/cli/commands/prd-commands.js +4 -2
- package/dist/cli/commands/preferences-commands.js +23 -3
- package/dist/cli/commands/project-commands.js +1 -1
- package/dist/cli/commands/qa-business-review-commands.js +1 -1
- package/dist/cli/commands/qa-commands.d.ts +1 -1
- package/dist/cli/commands/qa-commands.js +39 -3
- package/dist/cli/commands/release-commands.d.ts +15 -0
- package/dist/cli/commands/release-commands.js +113 -21
- package/dist/cli/commands/request-commands.js +1 -1
- package/dist/cli/commands/retrospective-commands.js +1 -1
- package/dist/cli/commands/reviewer-commands.js +1 -1
- package/dist/cli/commands/role-commands.js +1 -1
- package/dist/cli/commands/runtime-commands-helpers.d.ts +7 -0
- package/dist/cli/commands/runtime-commands-helpers.js +24 -0
- package/dist/cli/commands/runtime-commands.js +1 -2
- package/dist/cli/commands/sc-commands.js +4 -2
- package/dist/cli/commands/scan-commands.js +1 -1
- package/dist/cli/commands/security-audit-commands.js +3 -3
- package/dist/cli/commands/sediment-commands.js +10 -1
- package/dist/cli/commands/session-24h-mode.d.ts +26 -0
- package/dist/cli/commands/session-24h-mode.js +196 -0
- package/dist/cli/commands/share-commands.d.ts +19 -0
- package/dist/cli/commands/share-commands.js +121 -2
- package/dist/cli/commands/skill-conformance-commands.js +1 -1
- package/dist/cli/commands/skill-loop-engineering-readiness-commands.js +1 -1
- package/dist/cli/commands/skill-search-commands.js +4 -1
- package/dist/cli/commands/slice-commands.js +1 -1
- package/dist/cli/commands/slice-integrate-commands.js +1 -1
- package/dist/cli/commands/slice-review-commands.js +1 -1
- package/dist/cli/commands/smoke-commands.js +1 -1
- package/dist/cli/commands/sop-commands.js +1 -1
- package/dist/cli/commands/spill-demo-command.d.ts +7 -0
- package/dist/cli/commands/spill-demo-command.js +29 -0
- package/dist/cli/commands/statusline-commands.d.ts +12 -0
- package/dist/cli/commands/statusline-commands.js +79 -17
- package/dist/cli/commands/sub-agent-commands.js +2 -1
- package/dist/cli/commands/sub-agent-shared.d.ts +10 -0
- package/dist/cli/commands/sub-agent-shared.js +24 -1
- package/dist/cli/commands/swarm-commands.d.ts +13 -0
- package/dist/cli/commands/swarm-commands.js +77 -0
- package/dist/cli/commands/tech-commands.d.ts +64 -0
- package/dist/cli/commands/tech-commands.js +195 -0
- package/dist/cli/commands/understand-commands.js +1 -1
- package/dist/cli/commands/upgrade-commands.d.ts +2 -0
- package/dist/cli/commands/upgrade-commands.js +40 -5
- package/dist/cli/commands/user-touchpoint-commands.js +1 -1
- package/dist/cli/commands/verdict-aggregate-command.js +1 -1
- package/dist/cli/commands/vm-commands.d.ts +31 -0
- package/dist/cli/commands/vm-commands.js +274 -0
- package/dist/cli/commands/workflow-commands.js +24 -1
- package/dist/cli/commands/workflow-plan-commands.js +1 -1
- package/dist/cli/commands/workspace/init-command.js +1 -1
- package/dist/cli/commands/workspace/migrate-command.js +1 -1
- package/dist/cli/commands/workspace/reconcile-command.js +1 -1
- package/dist/cli/commands/worktree-auth-commands.d.ts +29 -0
- package/dist/cli/commands/worktree-auth-commands.js +652 -0
- package/dist/cli/index.js +58 -13
- package/dist/cli/program.d.ts +2 -2
- package/dist/cli/program.js +86 -281
- package/dist/services/24h-mode/decider.d.ts +103 -0
- package/dist/services/24h-mode/decider.js +144 -0
- package/dist/services/24h-mode/index.d.ts +12 -0
- package/dist/services/24h-mode/index.js +12 -0
- package/dist/services/24h-mode/state.d.ts +48 -0
- package/dist/services/24h-mode/state.js +51 -0
- package/dist/services/24h-mode/store.d.ts +27 -0
- package/dist/services/24h-mode/store.js +119 -0
- package/dist/services/artifacts/artifact-prerequisites.js +1 -1
- package/dist/services/artifacts/request-artifact-service.js +1 -1
- package/dist/services/artifacts/workspace-service.js +1 -1
- package/dist/services/audit/enforcers/lint-bee-runtime-contract.d.ts +25 -0
- package/dist/services/audit/enforcers/lint-bee-runtime-contract.js +91 -0
- package/dist/services/audit/enforcers/lint-peaks-code-runtime.d.ts +16 -0
- package/dist/services/audit/enforcers/lint-peaks-code-runtime.js +31 -0
- package/dist/services/audit/enforcers/lint-peaks-skill-runtime.d.ts +23 -0
- package/dist/services/audit/enforcers/lint-peaks-skill-runtime.js +59 -0
- package/dist/services/audit/enforcers/lint-peaks-ui-sc-txt-runtime.d.ts +28 -0
- package/dist/services/audit/enforcers/lint-peaks-ui-sc-txt-runtime.js +86 -0
- package/dist/services/audit/enforcers/lint-prd-artifact-handoff.d.ts +16 -0
- package/dist/services/audit/enforcers/lint-prd-artifact-handoff.js +41 -0
- package/dist/services/audit/enforcers/lint-prd-source-snapshot.d.ts +27 -0
- package/dist/services/audit/enforcers/lint-prd-source-snapshot.js +47 -0
- package/dist/services/audit/enforcers/lint-qa-gateguard-and-runtime.d.ts +19 -0
- package/dist/services/audit/enforcers/lint-qa-gateguard-and-runtime.js +47 -0
- package/dist/services/audit/enforcers/lint-rd-handoff-coverage.d.ts +18 -0
- package/dist/services/audit/enforcers/lint-rd-handoff-coverage.js +70 -0
- package/dist/services/audit/enforcers/lint-skill-presence-mandatory.d.ts +25 -0
- package/dist/services/audit/enforcers/lint-skill-presence-mandatory.js +53 -0
- package/dist/services/audit/red-line-catalog-p2-a.d.ts +0 -6
- package/dist/services/audit/red-line-catalog-p2-a.js +230 -1
- package/dist/services/audit/static-service.d.ts +32 -25
- package/dist/services/audit/static-service.js +30 -109
- package/dist/services/audit-independent/index.d.ts +2 -0
- package/dist/services/audit-independent/index.js +2 -0
- package/dist/services/autonomous-swarm/autonomous-swarm-service.d.ts +127 -0
- package/dist/services/autonomous-swarm/autonomous-swarm-service.js +446 -0
- package/dist/services/changeset/changeset-check-service.d.ts +22 -0
- package/dist/services/changeset/changeset-check-service.js +47 -0
- package/dist/services/code/auto-compact-modes.d.ts +30 -0
- package/dist/services/code/auto-compact-modes.js +38 -0
- package/dist/services/code/auto-compact-orchestrator.d.ts +43 -5
- package/dist/services/code/auto-compact-orchestrator.js +101 -21
- package/dist/services/code/dag-orchestrator.d.ts +30 -1
- package/dist/services/code/dag-orchestrator.js +106 -1
- package/dist/services/code/status-line-renderer.d.ts +2 -0
- package/dist/services/code/status-line-renderer.js +21 -3
- package/dist/services/code-review/ocr-service.d.ts +1 -1
- package/dist/services/code-review/ocr-service.js +6 -3
- package/dist/services/compact-history/compact-history-service.d.ts +41 -0
- package/dist/services/compact-history/compact-history-service.js +62 -0
- package/dist/services/compact-statusline/compact-statusline-service.d.ts +16 -0
- package/dist/services/compact-statusline/compact-statusline-service.js +83 -0
- package/dist/services/config/config-service.d.ts +1 -12
- package/dist/services/config/config-service.js +3 -72
- package/dist/services/config/config-types.d.ts +2 -4
- package/dist/services/config/config-types.js +1 -1
- package/dist/services/container/container-lease.d.ts +67 -0
- package/dist/services/container/container-lease.js +135 -0
- package/dist/services/context/auto-compact-dispatcher.d.ts +40 -5
- package/dist/services/context/auto-compact-dispatcher.js +32 -102
- package/dist/services/context/auto-compact-reader.js +1 -1
- package/dist/services/context/auto-compact-types.d.ts +27 -2
- package/dist/services/context/auto-compact-types.js +8 -1
- package/dist/services/context/build-dispatch-system-prompt.d.ts +75 -0
- package/dist/services/context/build-dispatch-system-prompt.js +117 -0
- package/dist/services/context/collector.d.ts +2 -2
- package/dist/services/context/context-builder.d.ts +4 -4
- package/dist/services/context/context-schema.d.ts +48 -48
- package/dist/services/context/ide-detect.d.ts +4 -0
- package/dist/services/context/ide-detect.js +24 -0
- package/dist/services/context/main-session-monitor.d.ts +1 -4
- package/dist/services/context/main-session-monitor.js +1 -24
- package/dist/services/context/memory-index-reader.d.ts +8 -0
- package/dist/services/context/memory-index-reader.js +57 -0
- package/dist/services/context/memory-lru-cache.d.ts +12 -0
- package/dist/services/context/memory-lru-cache.js +60 -0
- package/dist/services/context/memory-preflight-config.d.ts +19 -0
- package/dist/services/context/memory-preflight-config.js +25 -0
- package/dist/services/context/memory-preflight-service.d.ts +19 -0
- package/dist/services/context/memory-preflight-service.js +120 -0
- package/dist/services/context/spillover-store.d.ts +23 -0
- package/dist/services/context/spillover-store.js +155 -0
- package/dist/services/context/spillover-types.d.ts +18 -0
- package/dist/services/context/spillover-types.js +1 -0
- package/dist/services/crystallization/crystallization-service.d.ts +22 -5
- package/dist/services/crystallization/crystallization-service.js +8 -14
- package/dist/services/crystallization/crystallization-types.d.ts +6 -6
- package/dist/services/crystallization/evidence-brief-builder.d.ts +1 -1
- package/dist/services/crystallization/index.d.ts +13 -0
- package/dist/services/crystallization/index.js +13 -0
- package/dist/services/dashboard/project-dashboard-service.js +2 -2
- package/dist/services/dispatch/await-batch.d.ts +70 -0
- package/dist/services/dispatch/await-batch.js +272 -0
- package/dist/services/dispatch/batch-counter.js +1 -1
- package/dist/services/dispatch/dispatch-record-writer.d.ts +126 -4
- package/dist/services/dispatch/dispatch-record-writer.js +239 -9
- package/dist/services/dispatch/slice-dag.d.ts +46 -0
- package/dist/services/dispatch/slice-dag.js +6 -0
- package/dist/services/dispatch/stage-enum.d.ts +27 -0
- package/dist/services/dispatch/stage-enum.js +48 -0
- package/dist/services/dispatch/startup-timeout.d.ts +86 -0
- package/dist/services/dispatch/startup-timeout.js +97 -0
- package/dist/services/dispatch/sub-agent-dispatcher.js +40 -89
- package/dist/services/dispatch/test-tool-detection.d.ts +25 -1
- package/dist/services/dispatch/test-tool-detection.js +80 -0
- package/dist/services/doctor/doctor-service/checks/check-id-schema.d.ts +18 -0
- package/dist/services/doctor/doctor-service/checks/check-id-schema.js +64 -0
- package/dist/services/doctor/doctor-service/checks/codegraph-capability.d.ts +14 -0
- package/dist/services/doctor/doctor-service/checks/codegraph-capability.js +69 -0
- package/dist/services/doctor/doctor-service/checks/dist-source-version.d.ts +32 -0
- package/dist/services/doctor/doctor-service/checks/dist-source-version.js +110 -0
- package/dist/services/doctor/doctor-service/checks/gateguard-conflict.d.ts +24 -0
- package/dist/services/doctor/doctor-service/checks/gateguard-conflict.js +164 -0
- package/dist/services/doctor/doctor-service/checks/l3-memory-health.d.ts +16 -0
- package/dist/services/doctor/doctor-service/checks/l3-memory-health.js +57 -0
- package/dist/services/doctor/doctor-service/checks/l3-orphan-sessions.d.ts +19 -0
- package/dist/services/doctor/doctor-service/checks/l3-orphan-sessions.js +66 -0
- package/dist/services/doctor/doctor-service/checks/schema-validity.d.ts +10 -0
- package/dist/services/doctor/doctor-service/checks/schema-validity.js +33 -0
- package/dist/services/doctor/doctor-service/checks/skill-apply-note.d.ts +20 -0
- package/dist/services/doctor/doctor-service/checks/skill-apply-note.js +85 -0
- package/dist/services/doctor/doctor-service/checks/skill-existence.d.ts +13 -0
- package/dist/services/doctor/doctor-service/checks/skill-existence.js +30 -0
- package/dist/services/doctor/doctor-service/checks/skill-name-match.d.ts +10 -0
- package/dist/services/doctor/doctor-service/checks/skill-name-match.js +25 -0
- package/dist/services/doctor/doctor-service/checks/skill-parse.d.ts +10 -0
- package/dist/services/doctor/doctor-service/checks/skill-parse.js +19 -0
- package/dist/services/doctor/doctor-service/checks/skill-presence.d.ts +21 -0
- package/dist/services/doctor/doctor-service/checks/skill-presence.js +75 -0
- package/dist/services/doctor/doctor-service/checks/skill-runbook.d.ts +14 -0
- package/dist/services/doctor/doctor-service/checks/skill-runbook.js +47 -0
- package/dist/services/doctor/doctor-service/checks/statusline-install.d.ts +14 -0
- package/dist/services/doctor/doctor-service/checks/statusline-install.js +32 -0
- package/dist/services/doctor/doctor-service/checks/statusline-runtime.d.ts +13 -0
- package/dist/services/doctor/doctor-service/checks/statusline-runtime.js +30 -0
- package/dist/services/doctor/doctor-service/checks/user-config.d.ts +11 -0
- package/dist/services/doctor/doctor-service/checks/user-config.js +27 -0
- package/dist/services/doctor/doctor-service/checks/workspace-init.d.ts +16 -0
- package/dist/services/doctor/doctor-service/checks/workspace-init.js +34 -0
- package/dist/services/doctor/doctor-service/checks/workspace-layout.d.ts +33 -0
- package/dist/services/doctor/doctor-service/checks/workspace-layout.js +180 -0
- package/dist/services/doctor/doctor-service/index.d.ts +48 -0
- package/dist/services/doctor/doctor-service/index.js +254 -0
- package/dist/services/doctor/doctor-service/plugin-registry.d.ts +41 -0
- package/dist/services/doctor/doctor-service/plugin-registry.js +77 -0
- package/dist/services/doctor/doctor-service/report/final-summary.d.ts +20 -0
- package/dist/services/doctor/doctor-service/report/final-summary.js +29 -0
- package/dist/services/doctor/doctor-service/types.d.ts +245 -0
- package/dist/services/doctor/doctor-service/types.js +15 -0
- package/dist/services/doctor/doctor-service.d.ts +15 -146
- package/dist/services/doctor/doctor-service.js +22 -926
- package/dist/services/doctor/index.d.ts +22 -0
- package/dist/services/doctor/index.js +22 -0
- package/dist/services/env/shell-probe.d.ts +71 -0
- package/dist/services/env/shell-probe.js +161 -0
- package/dist/services/evolution/evolution-types.d.ts +39 -39
- package/dist/services/final-review/final-review-service.d.ts +11 -1
- package/dist/services/final-review/index.d.ts +2 -0
- package/dist/services/final-review/index.js +1 -0
- package/dist/services/hooks/auto-compact-hook-install.d.ts +4 -5
- package/dist/services/hooks/auto-compact-hook-install.js +4 -5
- package/dist/services/hooks/worktree-authorization-gate.d.ts +205 -0
- package/dist/services/hooks/worktree-authorization-gate.js +492 -0
- package/dist/services/ide/adapters/claude-code-adapter.js +2 -2
- package/dist/services/ide/adapters/qoder-adapter.d.ts +25 -0
- package/dist/services/ide/adapters/qoder-adapter.js +57 -0
- package/dist/services/ide/adapters/tongyi-lingma-adapter.d.ts +16 -0
- package/dist/services/ide/adapters/tongyi-lingma-adapter.js +45 -0
- package/dist/services/ide/ide-registry.js +6 -0
- package/dist/services/ide/ide-types.d.ts +1 -1
- package/dist/services/job/job-types.d.ts +56 -56
- package/dist/services/job-snapshot/index.d.ts +8 -0
- package/dist/services/job-snapshot/index.js +7 -0
- package/dist/services/{job/job-resource-snapshot.d.ts → job-snapshot/snapshot.d.ts} +1 -1
- package/dist/services/job-snapshot/types.d.ts +7 -0
- package/dist/services/job-snapshot/types.js +1 -0
- package/dist/services/karpathy-cost/karpathy-cost-check-service.d.ts +67 -0
- package/dist/services/karpathy-cost/karpathy-cost-check-service.js +108 -0
- package/dist/services/log/retention.d.ts +16 -0
- package/dist/services/log/retention.js +17 -0
- package/dist/services/loop/loop-bee-relation-types.d.ts +6 -6
- package/dist/services/loop/loop-release-types.d.ts +24 -24
- package/dist/services/loop/monotonic-runner.d.ts +17 -11
- package/dist/services/loop/monotonic-runner.js +118 -79
- package/dist/services/memory/project-memory-service/index/kind-dispatch.d.ts +8 -0
- package/dist/services/memory/project-memory-service/index/kind-dispatch.js +253 -0
- package/dist/services/memory/project-memory-service/index/ranking.d.ts +6 -0
- package/dist/services/memory/project-memory-service/index/ranking.js +171 -0
- package/dist/services/memory/project-memory-service/index/search.d.ts +34 -0
- package/dist/services/memory/project-memory-service/index/search.js +194 -0
- package/dist/services/memory/project-memory-service/index.d.ts +9 -0
- package/dist/services/memory/project-memory-service/index.js +24 -0
- package/dist/services/memory/project-memory-service/parsers/frontmatter.d.ts +9 -0
- package/dist/services/memory/project-memory-service/parsers/frontmatter.js +106 -0
- package/dist/services/memory/project-memory-service/parsers/markdown-pure.d.ts +7 -0
- package/dist/services/memory/project-memory-service/parsers/markdown-pure.js +96 -0
- package/dist/services/memory/project-memory-service/store/atomic-write.d.ts +5 -0
- package/dist/services/memory/project-memory-service/store/atomic-write.js +56 -0
- package/dist/services/memory/project-memory-service/store/paths.d.ts +8 -0
- package/dist/services/memory/project-memory-service/store/paths.js +116 -0
- package/dist/services/memory/project-memory-service/types.d.ts +128 -0
- package/dist/services/memory/project-memory-service/types.js +9 -0
- package/dist/services/memory/project-memory-service.d.ts +1 -167
- package/dist/services/memory/project-memory-service.js +19 -816
- package/dist/services/migrate-skill-name/schema.d.ts +2 -2
- package/dist/services/observability/aggregation.d.ts +27 -0
- package/dist/services/observability/aggregation.js +72 -0
- package/dist/services/observability/observability-service.d.ts +73 -7
- package/dist/services/observability/observability-service.js +87 -1
- package/dist/services/openspec/artifact-boundary.d.ts +138 -0
- package/dist/services/openspec/artifact-boundary.js +150 -0
- package/dist/services/openspec/coverage-evidence-reader.d.ts +191 -0
- package/dist/services/openspec/coverage-evidence-reader.js +386 -0
- package/dist/services/openspec/openspec-archive-service.d.ts +70 -0
- package/dist/services/openspec/openspec-archive-service.js +320 -8
- package/dist/services/openspec/openspec-bridge-service.js +1 -1
- package/dist/services/openspec/openspec-init-service.js +1 -1
- package/dist/services/openspec/openspec-propose-from-doctor-service.js +1 -1
- package/dist/services/openspec/openspec-render-service.js +7 -4
- package/dist/services/openspec/openspec-scan-service.js +1 -1
- package/dist/services/openspec/openspec-validate-service.js +5 -4
- package/dist/services/preferences/preferences-service.js +10 -0
- package/dist/services/preferences/preferences-types.d.ts +13 -0
- package/dist/services/preferences/preferences-types.js +11 -0
- package/dist/services/qa/screenshot-archive-service.d.ts +51 -0
- package/dist/services/qa/screenshot-archive-service.js +134 -0
- package/dist/services/rd/rd-service.js +10 -11
- package/dist/services/rd/types.d.ts +32 -32
- package/dist/services/rd-swarm/rd-swarm-service.d.ts +60 -0
- package/dist/services/rd-swarm/rd-swarm-service.js +93 -0
- package/dist/services/recommendations/capability-seed-items.js +0 -1
- package/dist/services/recommendations/capability-seed-mappings.js +0 -1
- package/dist/services/recommendations/capability-seed-sources.js +0 -1
- package/dist/services/release/version-precheck-service.d.ts +51 -0
- package/dist/services/release/version-precheck-service.js +257 -0
- package/dist/services/scan/acceptance-coverage-service.js +1 -1
- package/dist/services/scan/archetype-service.js +1 -1
- package/dist/services/scan/existing-system-service.js +1 -1
- package/dist/services/scan/libraries-service.js +1 -1
- package/dist/services/sediment/json-schema.d.ts +40 -40
- package/dist/services/share/bundle-types.d.ts +12 -12
- package/dist/services/share/run-state-contract.d.ts +2 -2
- package/dist/services/skill/skill-search-service.d.ts +12 -7
- package/dist/services/skill/skill-search-service.js +8 -4
- package/dist/services/skillhub/migrations/001-initial.sql +71 -0
- package/dist/services/skillhub/migrations/002-loop-release.sql +32 -0
- package/dist/services/skillhub/migrations/003-loop-bee-relation.sql +35 -0
- package/dist/services/skillhub/migrations/004-loop-bee-extension.sql +65 -0
- package/dist/services/skillhub/migrations/005-evolution-evaluation.sql +81 -0
- package/dist/services/skillhub/migrations/006-crystallization-event.sql +92 -0
- package/dist/services/skills/hooks-settings-service.d.ts +75 -0
- package/dist/services/skills/hooks-settings-service.js +230 -2
- package/dist/services/skills/skill-registry.d.ts +1 -0
- package/dist/services/skills/skill-registry.js +6 -4
- package/dist/services/skills/skill-runbook-service.js +1 -1
- package/dist/services/slice/slice-check-service.js +1 -1
- package/dist/services/standards/main-session-monitor-ban-hook.d.ts +14 -0
- package/dist/services/standards/main-session-monitor-ban-hook.js +19 -0
- package/dist/services/standards/missing-standards-detector.d.ts +25 -0
- package/dist/services/standards/missing-standards-detector.js +43 -12
- package/dist/services/tech/tech-change-id-service.d.ts +82 -0
- package/dist/services/tech/tech-change-id-service.js +117 -0
- package/dist/services/understand/understand-hybrid-service.js +1 -1
- package/dist/services/understand/understand-scan-service.js +2 -2
- package/dist/services/upgrade/upgrade-service.js +4 -3
- package/dist/services/verdict/envelopes.d.ts +2 -2
- package/dist/services/verdict/envelopes.js +2 -2
- package/dist/services/verdict/verdict-aggregator.d.ts +3 -3
- package/dist/services/vm/vm-lease.d.ts +40 -0
- package/dist/services/vm/vm-lease.js +137 -0
- package/dist/services/workflow/autonomous-resume-writer.js +1 -1
- package/dist/services/workflow/pipeline-verify-gate-support.d.ts +47 -0
- package/dist/services/workflow/pipeline-verify-gate-support.js +194 -0
- package/dist/services/workflow/pipeline-verify-service.d.ts +17 -81
- package/dist/services/workflow/pipeline-verify-service.js +42 -218
- package/dist/services/workflow/pipeline-verify-types.d.ts +90 -0
- package/dist/services/workflow/pipeline-verify-types.js +10 -0
- package/dist/services/workflow/plan-reader.d.ts +1 -1
- package/dist/services/workflow/plan-reader.js +1 -1
- package/dist/services/workflow/plan-refresher.d.ts +1 -1
- package/dist/services/workflow/plan-refresher.js +1 -1
- package/dist/services/workflow/plan-trigger-detector.d.ts +1 -1
- package/dist/services/workflow/plan-trigger-detector.js +1 -1
- package/dist/services/workflow/workflow-autonomous-resume-helpers.d.ts +1 -1
- package/dist/services/workflow/workflow-autonomous-service.d.ts +2 -98
- package/dist/services/workflow/workflow-autonomous-types.d.ts +114 -0
- package/dist/services/workflow/workflow-autonomous-types.js +21 -0
- package/dist/services/workflow/workflow-router-service.js +18 -16
- package/dist/services/workflow/workflow-spec-lint.d.ts +13 -0
- package/dist/services/workflow/workflow-spec-lint.js +75 -0
- package/dist/services/workflow/workflow-spec-types.d.ts +100 -0
- package/dist/services/workflow/workflow-spec-types.js +13 -0
- package/dist/services/workflow/workflow-spec-yaml.d.ts +17 -0
- package/dist/services/workflow/workflow-spec-yaml.js +88 -0
- package/dist/services/workflow/workflow-spec.d.ts +11 -91
- package/dist/services/workflow/workflow-spec.js +16 -145
- package/dist/services/workspace/migrate-service.js +1 -1
- package/dist/services/workspace/workspace-service.js +1 -1
- package/dist/services/worktree/worktree-lease.d.ts +170 -0
- package/dist/services/worktree/worktree-lease.js +242 -0
- package/package.json +91 -51
- package/scripts/clean-dist.mjs +31 -1
- package/scripts/copy-templates.mjs +16 -0
- package/scripts/sync-version.mjs +53 -2
- package/skills/bee/peaks-perf-audit/SKILL.md +17 -0
- package/skills/bee/peaks-prd/SKILL.md +16 -0
- package/skills/bee/peaks-prd/test-prompts.json +12 -0
- package/skills/bee/peaks-qa/SKILL.md +16 -1
- package/skills/bee/peaks-qa/references/qa-sub-agent-dispatch.md +22 -0
- package/skills/bee/peaks-qa/test-prompts.json +12 -0
- package/skills/bee/peaks-rd/SKILL.md +29 -20
- package/skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md +39 -0
- package/skills/bee/peaks-rd/test-prompts.json +12 -0
- package/skills/bee/peaks-reviewer/SKILL.md +17 -0
- package/skills/bee/peaks-sc/SKILL.md +16 -0
- package/skills/bee/peaks-security-audit/SKILL.md +17 -0
- package/skills/bee/peaks-txt/SKILL.md +16 -0
- package/skills/bee/peaks-txt/test-prompts.json +12 -0
- package/skills/bee/peaks-ui/SKILL.md +49 -43
- package/skills/bee/peaks-ui/test-prompts.json +12 -0
- package/skills/peaks-code/SKILL.md +54 -109
- package/skills/peaks-code/references/boundaries.md +15 -1
- package/skills/peaks-code/references/cron-scheduler-deployment.md +313 -0
- package/skills/peaks-code/references/external-skill-invocation.md +27 -0
- package/skills/peaks-code/references/lease-dashboard.html +224 -0
- package/skills/peaks-code/references/lease-stats.sample.json +26 -0
- package/skills/peaks-code/references/peaks-worktree-l2-enforcers.md +208 -0
- package/skills/peaks-code/references/periodic-checkpoint.md +4 -4
- package/skills/peaks-code/references/runbook.md +63 -1
- package/skills/peaks-code/references/startup-sequence.md +110 -0
- package/skills/peaks-code/references/step-0-8-gate.md +1 -1
- package/skills/peaks-code/references/sub-agent-dispatch.md +92 -1
- package/skills/peaks-code/references/worktree-governance.md +123 -0
- package/skills/peaks-code/test-prompts.json +12 -0
- package/skills/peaks-doctor/SKILL.md +1 -1
- package/skills/peaks-ide/SKILL.md +1 -1
- package/skills/peaks-solo/SKILL.md +21 -0
- package/skills/peaks-solo/references/triage-decision-table.md +6 -0
- package/skills/peaks-sop/test-prompts.json +17 -0
- package/dist/cli/commands/agent-commands.d.ts +0 -20
- package/dist/cli/commands/agent-commands.js +0 -48
- package/dist/cli/commands/classify-classify-commands.d.ts +0 -19
- package/dist/cli/commands/classify-classify-commands.js +0 -151
- package/dist/cli/commands/contract-commands.d.ts +0 -26
- package/dist/cli/commands/contract-commands.js +0 -114
- package/dist/cli/commands/session-auto-compact-hook-command.d.ts +0 -37
- package/dist/cli/commands/session-auto-compact-hook-command.js +0 -127
- package/dist/cli/commands/worker-commands.d.ts +0 -3
- package/dist/cli/commands/worker-commands.js +0 -52
- package/dist/services/agent/ecc-agent-service.d.ts +0 -47
- package/dist/services/agent/ecc-agent-service.js +0 -143
- package/dist/services/config/provider-service.d.ts +0 -48
- package/dist/services/config/provider-service.js +0 -143
- package/dist/services/context/dispatch-context-guard.d.ts +0 -27
- package/dist/services/context/dispatch-context-guard.js +0 -192
- package/dist/services/context/shared-channel.d.ts +0 -93
- package/dist/services/context/shared-channel.js +0 -308
- package/dist/services/filesystem/file-lock.d.ts +0 -11
- package/dist/services/filesystem/file-lock.js +0 -152
- package/dist/services/mut/assert-scanner.d.ts +0 -6
- package/dist/services/mut/assert-scanner.js +0 -116
- package/dist/services/mut/index.d.ts +0 -8
- package/dist/services/mut/index.js +0 -7
- package/dist/services/mut/mut-runner.d.ts +0 -39
- package/dist/services/mut/mut-runner.js +0 -29
- package/dist/services/mut/production-stryker.d.ts +0 -2
- package/dist/services/mut/production-stryker.js +0 -75
- package/dist/services/mut/report-builder.d.ts +0 -11
- package/dist/services/mut/report-builder.js +0 -110
- package/dist/services/mut/report-loader.d.ts +0 -31
- package/dist/services/mut/report-loader.js +0 -78
- package/dist/services/mut/thresholds.d.ts +0 -21
- package/dist/services/mut/thresholds.js +0 -22
- package/dist/services/mut/types.d.ts +0 -336
- package/dist/services/mut/types.js +0 -59
- package/dist/services/providers/minimax-provider-service.d.ts +0 -24
- package/dist/services/providers/minimax-provider-service.js +0 -143
- package/dist/services/providers/minimax-worker-service.d.ts +0 -21
- package/dist/services/providers/minimax-worker-service.js +0 -83
- package/dist/shared/fs.d.ts +0 -4
- package/dist/shared/fs.js +0 -26
- package/dist/shared/paths.d.ts +0 -6
- package/dist/shared/paths.js +0 -50
- package/dist/shared/result.d.ts +0 -22
- package/dist/shared/result.js +0 -46
- package/dist/shared/version.d.ts +0 -1
- package/dist/shared/version.js +0 -1
- package/examples/video-demo/README.md +0 -142
- package/examples/video-demo/out/en-closing-960.png +0 -0
- package/examples/video-demo/out/zh-closing-960.png +0 -0
- package/examples/video-demo/preview/peaks-loop-demo-en.mp4 +0 -0
- package/examples/video-demo/preview/peaks-loop-demo.mp4 +0 -0
- /package/dist/services/{job/job-resource-snapshot.js → job-snapshot/snapshot.js} +0 -0
|
@@ -1,35 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* AC-3 — IDE-aware compact dispatcher.
|
|
3
|
-
*
|
|
4
|
-
* Reads the active IDE's `IdeAdapter.compact` profile and dispatches
|
|
5
|
-
* compact via the adapter-declared pathway. No hard-coded IDE names
|
|
6
|
-
* — Claude Code is the MVP that fills `compact`; other adapters
|
|
7
|
-
* register their own `compact` profile as L2-dogfood verifies
|
|
8
|
-
* each IDE's actual compact surface.
|
|
9
|
-
*
|
|
10
|
-
* Pathway dispatch:
|
|
11
|
-
*
|
|
12
|
-
* - `shell-exec` — peaks-loop spawns the adapter's
|
|
13
|
-
* `compactCommand` via `child_process.spawn`.
|
|
14
|
-
* Works for any IDE that accepts a slash
|
|
15
|
-
* command via a shell-spawnable entry point
|
|
16
|
-
* (Claude Code MVP: `/compact`).
|
|
17
|
-
* - `ide-native` — peaks-loop writes the compact intent to
|
|
18
|
-
* the IDE's hook file (per
|
|
19
|
-
* `IdeSettingsLocation`). Used when the IDE
|
|
20
|
-
* requires a registered hook rather than a
|
|
21
|
-
* runtime command.
|
|
22
|
-
* - `llm-self-compress` — peaks-loop records the intent and
|
|
23
|
-
* returns `ok: true` with `pathway` echoed.
|
|
24
|
-
* The LLM does its own context summarization
|
|
25
|
-
* on the next turn. Always available; least
|
|
26
|
-
* precise fallback.
|
|
27
|
-
* - `noop` — adapter explicitly opted out. peaks-loop
|
|
28
|
-
* returns `ok: false` with `message: 'noop'`.
|
|
29
|
-
* Used by legacy / unverified adapters.
|
|
30
|
-
*/
|
|
31
|
-
import { spawn } from 'node:child_process';
|
|
32
|
-
import { detectIdeFromEnv } from './main-session-monitor.js';
|
|
1
|
+
import { detectIdeFromEnv } from './ide-detect.js';
|
|
33
2
|
import { getAdapter } from '../ide/ide-registry.js';
|
|
34
3
|
/**
|
|
35
4
|
* Dispatch compact via the active IDE's registered pathway.
|
|
@@ -38,7 +7,7 @@ import { getAdapter } from '../ide/ide-registry.js';
|
|
|
38
7
|
* when the dispatch path completed without error — for
|
|
39
8
|
* `llm-self-compress` the LLM still has to do the actual summary,
|
|
40
9
|
* so the orchestrator MUST NOT treat `ok: true` as proof that the
|
|
41
|
-
* context actually shrunk; the next `peaks
|
|
10
|
+
* context actually shrunk; the next `peaks compact auto` probe
|
|
42
11
|
* confirms.
|
|
43
12
|
*/
|
|
44
13
|
export async function dispatchIdeCompact(input) {
|
|
@@ -83,9 +52,14 @@ export async function dispatchIdeCompact(input) {
|
|
|
83
52
|
const pathway = profile.compactPathway;
|
|
84
53
|
switch (pathway) {
|
|
85
54
|
case 'shell-exec':
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
//
|
|
55
|
+
// rid-031 (2026-07-28): `shell-exec` pathway is DEPRECATED.
|
|
56
|
+
// No host CLI spawn occurs. The case marker is preserved so
|
|
57
|
+
// 2 currently-passing tests in
|
|
58
|
+
// tests/unit/context/auto-compact-main-target.test.ts:58
|
|
59
|
+
// tests/unit/services/context/auto-compact-dispatcher-ide-native.test.ts:102
|
|
60
|
+
// continue to assert `pathway: 'shell-exec'`. Real callers must
|
|
61
|
+
// use `ide-native` (main session) or `llm-self-compress`.
|
|
62
|
+
console.warn(`compact: shell-exec pathway is deprecated on adapter '${ideId}' (target='${target}'); no host CLI spawn — use ide-native instead.`);
|
|
89
63
|
if (target === 'main') {
|
|
90
64
|
return {
|
|
91
65
|
ok: true,
|
|
@@ -94,15 +68,16 @@ export async function dispatchIdeCompact(input) {
|
|
|
94
68
|
message: `Main-session target on shell-exec adapter '${ideId}': deferring to in-band /compact (next LLM turn); writing intent record.`
|
|
95
69
|
};
|
|
96
70
|
}
|
|
97
|
-
return
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
71
|
+
return {
|
|
72
|
+
ok: true,
|
|
73
|
+
ide: ideId,
|
|
74
|
+
pathway: 'shell-exec',
|
|
75
|
+
message: `shell-exec pathway is deprecated; no host CLI spawn for command '${profile.compactCommand}'. Use ide-native for main-session runner.`
|
|
76
|
+
};
|
|
102
77
|
case 'ide-native':
|
|
103
78
|
// Slice 2026-07-02-auto-compact-zero-pause: write the auto-compact
|
|
104
79
|
// PreToolUse hook into `.claude/settings.local.json`. The hook
|
|
105
|
-
// command (`peaks
|
|
80
|
+
// command (`peaks compact auto`) reads
|
|
106
81
|
// `CLAUDE_CONTEXT_USAGE_PERCENT` on every subsequent Bash/Task
|
|
107
82
|
// tool call from the runner and, at ratio ≥ 0.95, in-band spawns
|
|
108
83
|
// `claude --compact` against the CURRENT runner (not a child
|
|
@@ -116,14 +91,22 @@ export async function dispatchIdeCompact(input) {
|
|
|
116
91
|
// child claude process and the sub-agent's own runner doesn't
|
|
117
92
|
// get a PreToolUse hook installed in the wrong place.
|
|
118
93
|
if (target === 'sub-agent') {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
94
|
+
// rid-031 (2026-07-28): legacy shell-spawn fallback is
|
|
95
|
+
// DEPRECATED. No host CLI spawn occurs. The envelope is
|
|
96
|
+
// returned with `pathway: 'shell-exec'` to preserve the
|
|
97
|
+
// contract asserted by
|
|
98
|
+
// tests/unit/services/context/auto-compact-dispatcher-ide-native.test.ts:102
|
|
99
|
+
// (sub-agent shells historically relied on this path).
|
|
100
|
+
console.warn(`compact: sub-agent shell-exec fallback is deprecated on adapter '${ideId}'; no host CLI spawn for '${profile.compactCommand}'.`);
|
|
101
|
+
return {
|
|
102
|
+
ok: true,
|
|
103
|
+
ide: ideId,
|
|
104
|
+
pathway: 'shell-exec',
|
|
105
|
+
message: `shell-exec fallback is deprecated; no host CLI spawn for command '${profile.compactCommand}'.`
|
|
106
|
+
};
|
|
124
107
|
}
|
|
125
108
|
// Lazy install: we only get here when the caller explicitly
|
|
126
|
-
// invokes `peaks
|
|
109
|
+
// invokes `peaks compact auto --execute`, so the user has
|
|
127
110
|
// already opted in. No zero-touch surprise on workspace init.
|
|
128
111
|
return await dispatchIdeNativeHook({
|
|
129
112
|
projectRoot: input.projectRoot,
|
|
@@ -155,66 +138,13 @@ export async function dispatchIdeCompact(input) {
|
|
|
155
138
|
};
|
|
156
139
|
}
|
|
157
140
|
}
|
|
158
|
-
/**
|
|
159
|
-
* Spawn the adapter's `compactCommand` via child_process. Returns
|
|
160
|
-
* the dispatch envelope with `pathway: 'shell-exec'`.
|
|
161
|
-
*
|
|
162
|
-
* MVP: Claude Code registers `compactCommand: '/compact'` and
|
|
163
|
-
* `compactPathway: 'shell-exec'`. We spawn via `sh -c` so the
|
|
164
|
-
* slash-command resolves inside the runner's shell session.
|
|
165
|
-
*
|
|
166
|
-
* For other IDEs that adopt `shell-exec` in the future, the
|
|
167
|
-
* `compactCommand` field drives whatever shell-spawnable token
|
|
168
|
-
* the IDE accepts (e.g. trae's compact-token).
|
|
169
|
-
*/
|
|
170
|
-
function dispatchShellExec(input) {
|
|
171
|
-
return new Promise((resolve) => {
|
|
172
|
-
const child = spawn('sh', ['-c', input.command], {
|
|
173
|
-
stdio: 'ignore',
|
|
174
|
-
// Detach so the IDE's runner picks up the slash command.
|
|
175
|
-
detached: true,
|
|
176
|
-
env: process.env
|
|
177
|
-
});
|
|
178
|
-
child.unref();
|
|
179
|
-
const timer = setTimeout(() => {
|
|
180
|
-
// Don't kill — the IDE runner keeps the command alive in
|
|
181
|
-
// its own session; we just stop waiting.
|
|
182
|
-
resolve({
|
|
183
|
-
ok: true,
|
|
184
|
-
ide: input.ideId,
|
|
185
|
-
pathway: 'shell-exec',
|
|
186
|
-
message: `Compact command '${input.command}' dispatched (timeout=${input.timeoutMs}ms); IDE runner should pick it up.`
|
|
187
|
-
});
|
|
188
|
-
}, input.timeoutMs);
|
|
189
|
-
child.on('error', (err) => {
|
|
190
|
-
clearTimeout(timer);
|
|
191
|
-
resolve({
|
|
192
|
-
ok: false,
|
|
193
|
-
ide: input.ideId,
|
|
194
|
-
pathway: 'shell-exec',
|
|
195
|
-
message: `Failed to spawn compact command '${input.command}': ${err.message}`
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
child.on('spawn', () => {
|
|
199
|
-
// Spawn succeeded — return immediately; the IDE runner
|
|
200
|
-
// continues processing the slash command in its own session.
|
|
201
|
-
clearTimeout(timer);
|
|
202
|
-
resolve({
|
|
203
|
-
ok: true,
|
|
204
|
-
ide: input.ideId,
|
|
205
|
-
pathway: 'shell-exec',
|
|
206
|
-
message: `Compact command '${input.command}' spawned successfully.`
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
141
|
/**
|
|
212
142
|
* Slice 2026-07-02-auto-compact-zero-pause: implement the
|
|
213
143
|
* `ide-native` pathway. Writes the auto-compact PreToolUse hook
|
|
214
144
|
* into `.claude/settings.local.json` (idempotent; the install
|
|
215
145
|
* service is a no-op if the hook is already present). On the next
|
|
216
146
|
* Bash/Task tool call from the runner, the hook fires
|
|
217
|
-
* `peaks
|
|
147
|
+
* `peaks compact auto` which in-band spawns
|
|
218
148
|
* `claude --compact` against the CURRENT runner session.
|
|
219
149
|
*
|
|
220
150
|
* Returns `ok: true, pathway: 'ide-native'` regardless of install
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
26
26
|
import { homedir } from 'node:os';
|
|
27
27
|
import { join } from 'node:path';
|
|
28
|
-
import { detectIdeFromEnv } from './
|
|
28
|
+
import { detectIdeFromEnv } from './ide-detect.js';
|
|
29
29
|
import { getAdapter } from '../ide/ide-registry.js';
|
|
30
30
|
/**
|
|
31
31
|
* Read env-var-based context percentage. Returns `null` when the env
|
|
@@ -31,9 +31,10 @@
|
|
|
31
31
|
* alive.
|
|
32
32
|
*/
|
|
33
33
|
export declare const AUTO_COMPACT_SOFT_WARN_RATIO = 0.5;
|
|
34
|
+
export declare const AUTO_COMPACT_AUTO_FIRE_RATIO = 0.8;
|
|
34
35
|
export declare const AUTO_COMPACT_PRE_COMPACT_RATIO = 0.85;
|
|
35
36
|
export declare const AUTO_COMPACT_RED_LINE_RATIO = 0.95;
|
|
36
|
-
export declare const AUTO_COMPACT_THRESHOLD_RATIO = 0.
|
|
37
|
+
export declare const AUTO_COMPACT_THRESHOLD_RATIO = 0.8;
|
|
37
38
|
/** Single source of truth for "what should we do at ratio X?" */
|
|
38
39
|
export type CompactTrigger = {
|
|
39
40
|
kind: 'none';
|
|
@@ -42,7 +43,24 @@ export type CompactTrigger = {
|
|
|
42
43
|
ratio: number;
|
|
43
44
|
message: string;
|
|
44
45
|
}
|
|
45
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Part 22: auto-fire zone (0.80 ≤ ratio < 0.85). peaks-loop
|
|
48
|
+
* preempts and runs `peaks compact auto --execute` itself
|
|
49
|
+
* without LLM involvement. The LLM is not asked to "decide";
|
|
50
|
+
* the toolkit is applied synchronously.
|
|
51
|
+
*/
|
|
52
|
+
| {
|
|
53
|
+
kind: 'auto-fire';
|
|
54
|
+
ratio: number;
|
|
55
|
+
message: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Pre-compact zone (0.85 ≤ ratio < 0.95): LLM-runner can still
|
|
59
|
+
* pre-empt the compact for one in-flight sub-agent or one
|
|
60
|
+
* todo row, but peaks-loop flags this as the last safe
|
|
61
|
+
* window. Kept for backward compat; in practice peaks-loop
|
|
62
|
+
* auto-fired at 0.80 already.
|
|
63
|
+
*/
|
|
46
64
|
| {
|
|
47
65
|
kind: 'pre-compact';
|
|
48
66
|
ratio: number;
|
|
@@ -114,6 +132,13 @@ export type AutoCompactResult = {
|
|
|
114
132
|
* `/compact` in a child process (legacy behaviour).
|
|
115
133
|
*/
|
|
116
134
|
readonly target?: 'main' | 'sub-agent';
|
|
135
|
+
/**
|
|
136
|
+
* Slice 2026-07-28 (rid-027): which mode's threshold table
|
|
137
|
+
* was used. Defaults to `'standard'` (0.85/0.95). `'partial'`
|
|
138
|
+
* (0.70/0.85) is selected when 24h mode is active or the
|
|
139
|
+
* caller passes `--mode partial`.
|
|
140
|
+
*/
|
|
141
|
+
readonly mode?: 'standard' | 'partial';
|
|
117
142
|
readonly redLineGated?: boolean;
|
|
118
143
|
};
|
|
119
144
|
};
|
|
@@ -31,6 +31,13 @@
|
|
|
31
31
|
* alive.
|
|
32
32
|
*/
|
|
33
33
|
export const AUTO_COMPACT_SOFT_WARN_RATIO = 0.5;
|
|
34
|
+
// Part 22: auto-fire threshold (was 0.85 pre-compact zone where
|
|
35
|
+
// the LLM had to decide; LLM misjudged 0.85–0.95 and only fired
|
|
36
|
+
// at 0.95, which let the LLM time the run anyway). Lowered to
|
|
37
|
+
// 0.80 so peaks-loop auto-fires compact without LLM involvement
|
|
38
|
+
// — the LLM keeps working, peaks-loop preempts when ratio crosses
|
|
39
|
+
// the new threshold.
|
|
40
|
+
export const AUTO_COMPACT_AUTO_FIRE_RATIO = 0.80;
|
|
34
41
|
export const AUTO_COMPACT_PRE_COMPACT_RATIO = 0.85;
|
|
35
42
|
export const AUTO_COMPACT_RED_LINE_RATIO = 0.95;
|
|
36
|
-
export const AUTO_COMPACT_THRESHOLD_RATIO =
|
|
43
|
+
export const AUTO_COMPACT_THRESHOLD_RATIO = AUTO_COMPACT_AUTO_FIRE_RATIO;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* buildDispatchSystemPrompt — pure-function prompt composer for sub-agent dispatch.
|
|
3
|
+
*
|
|
4
|
+
* Slice 2026-07-22-orchestrator-memory-preflight (Task 5). The orchestrator
|
|
5
|
+
* dispatch flow (`src/cli/commands/dispatch-commands.ts`) calls
|
|
6
|
+
* `MemoryPreflightService.fetchBlock` and feeds the result into this builder
|
|
7
|
+
* so the memory block, when available, is prepended BEFORE the task brief.
|
|
8
|
+
*
|
|
9
|
+
* Keeping the builder a pure function (no IO) makes the three acceptance
|
|
10
|
+
* cases easy to test in isolation:
|
|
11
|
+
* 1. returns the original prompt (sans memory block) when unavailable
|
|
12
|
+
* 2. prepends the memory block when available
|
|
13
|
+
* 3. never pushes the memory block below the task brief
|
|
14
|
+
*/
|
|
15
|
+
import type { MemoryPreflightResult } from './memory-preflight-service.js';
|
|
16
|
+
import type { ContextPercentProbe } from './auto-compact-types.js';
|
|
17
|
+
export interface DispatchPromptInput {
|
|
18
|
+
taskTitle: string;
|
|
19
|
+
taskBody: string;
|
|
20
|
+
memoryBlock: MemoryPreflightResult;
|
|
21
|
+
/**
|
|
22
|
+
* Slice 2026-07-29-context-evaluation-accuracy: the live
|
|
23
|
+
* context-fill probe. When provided, the composer prepends
|
|
24
|
+
* a `## Context window` block with the authoritative ratio so
|
|
25
|
+
* the dispatched sub-agent does NOT estimate context from
|
|
26
|
+
* message length. The ratio comes from the IDE adapter's
|
|
27
|
+
* `compact` env-var / statusline (token-counted), NOT from
|
|
28
|
+
* a byte-counted estimate.
|
|
29
|
+
*/
|
|
30
|
+
contextProbe?: ContextPercentProbe | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Slice 2026-07-29-worktree-l1: Layer 1 of the 3-layer worktree governance
|
|
34
|
+
* defence. The block below is prepended to every sub-agent dispatch system
|
|
35
|
+
* prompt so the LLM sees the superpowers-chain refusal BEFORE any task
|
|
36
|
+
* content. The block mirrors the prose in
|
|
37
|
+
* `skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md` (and the
|
|
38
|
+
* corresponding peaks-qa / peaks-ui templates); all 4 surfaces MUST stay
|
|
39
|
+
* in lockstep — drift between them is the failure mode this slice closes.
|
|
40
|
+
*
|
|
41
|
+
* Why this lives here (and not just in markdown):
|
|
42
|
+
* - The dispatch composer is the ONE place every dispatch prompt passes
|
|
43
|
+
* through. Adding the block here guarantees coverage even when the
|
|
44
|
+
* orchestrator synthesizes a prompt without reading the per-role
|
|
45
|
+
* template (the orchestrator may run peaks-rd on a different rid and
|
|
46
|
+
* reuse the task body verbatim).
|
|
47
|
+
* - Pure-function design (slice 2026-07-22) makes the appended block
|
|
48
|
+
* trivially testable.
|
|
49
|
+
*
|
|
50
|
+
* Fallback note: until rid-L2-extended ships `peaks worktree spawn`, the
|
|
51
|
+
* fallback path is `peaks worktree auth grant --rid <id> --reason <text>
|
|
52
|
+
* --ttl <5m>` (already shipped). Update the prose once `spawn` lands.
|
|
53
|
+
*/
|
|
54
|
+
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\nThis chain ends with `git worktree add` (superpowers:using-git-worktrees SKILL.md line 96). It bypasses peaks-loop's L2 hook gate and L3 IDE `permissions.deny`. Even when L3 denies the terminal Skill, the chain has already taught you to use raw `git worktree add`, so L3 is not sufficient.\n\nFor worktree operations, use ONLY:\n\n- `peaks worktree spawn --rid <rid> --ttl <duration> --purpose <text>` (after rid-L2-extended ships)\n- until then: `peaks worktree auth grant --rid <id> --reason <text> --ttl <5m>`\n\nThe superpowers skills remain available as 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 `peaks worktree spawn` (or the auth-grant fallback)\n";
|
|
55
|
+
/**
|
|
56
|
+
* Compose the system-prompt body that the dispatch site prepends to
|
|
57
|
+
* `formatTestToolDetection()\n\n`.
|
|
58
|
+
*
|
|
59
|
+
* Byte-identical degradation contract (slice 2026-07-22-orchestrator-memory-preflight
|
|
60
|
+
* controller brief): when the memory block is unavailable, the caller does
|
|
61
|
+
* `formatTestToolDetection()\n\n${taskBody}` — i.e. the final prompt is exactly
|
|
62
|
+
* `${formatTestToolDetection()}\n\n${taskBody}`. Today's pre-change behavior
|
|
63
|
+
* produced the same string from `src/cli/commands/dispatch-commands.ts:220`,
|
|
64
|
+
* so the unavailable branch MUST return `taskBody` (NOT a `# title\n\n` wrap).
|
|
65
|
+
*
|
|
66
|
+
* Available branch prepends the memory block before the `## Task` heading so
|
|
67
|
+
* `## Project memory …` always sits above the task brief (never pushed below
|
|
68
|
+
* it).
|
|
69
|
+
*
|
|
70
|
+
* Slice 2026-07-29-worktree-l1: every branch prepends the L1 worktree
|
|
71
|
+
* governance block BEFORE the memory block / task body. The block is the
|
|
72
|
+
* first thing the dispatched sub-agent sees, so the superpowers-chain
|
|
73
|
+
* refusal is in scope before any task-specific prose arrives.
|
|
74
|
+
*/
|
|
75
|
+
export declare function buildDispatchSystemPrompt(input: DispatchPromptInput): string;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slice 2026-07-29-worktree-l1: Layer 1 of the 3-layer worktree governance
|
|
3
|
+
* defence. The block below is prepended to every sub-agent dispatch system
|
|
4
|
+
* prompt so the LLM sees the superpowers-chain refusal BEFORE any task
|
|
5
|
+
* content. The block mirrors the prose in
|
|
6
|
+
* `skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md` (and the
|
|
7
|
+
* corresponding peaks-qa / peaks-ui templates); all 4 surfaces MUST stay
|
|
8
|
+
* in lockstep — drift between them is the failure mode this slice closes.
|
|
9
|
+
*
|
|
10
|
+
* Why this lives here (and not just in markdown):
|
|
11
|
+
* - The dispatch composer is the ONE place every dispatch prompt passes
|
|
12
|
+
* through. Adding the block here guarantees coverage even when the
|
|
13
|
+
* orchestrator synthesizes a prompt without reading the per-role
|
|
14
|
+
* template (the orchestrator may run peaks-rd on a different rid and
|
|
15
|
+
* reuse the task body verbatim).
|
|
16
|
+
* - Pure-function design (slice 2026-07-22) makes the appended block
|
|
17
|
+
* trivially testable.
|
|
18
|
+
*
|
|
19
|
+
* Fallback note: until rid-L2-extended ships `peaks worktree spawn`, the
|
|
20
|
+
* fallback path is `peaks worktree auth grant --rid <id> --reason <text>
|
|
21
|
+
* --ttl <5m>` (already shipped). Update the prose once `spawn` lands.
|
|
22
|
+
*/
|
|
23
|
+
export const L1_WORKTREE_GOVERNANCE_BLOCK = `## Superpowers chain refusal (L1 worktree governance — locked 2026-07-29)
|
|
24
|
+
|
|
25
|
+
You MUST NOT follow the superpowers chain for worktree decisions:
|
|
26
|
+
|
|
27
|
+
- superpowers:brainstorming → superpowers:writing-plans →
|
|
28
|
+
superpowers:subagent-driven-development → superpowers:using-git-worktrees
|
|
29
|
+
|
|
30
|
+
This chain ends with \`git worktree add\` (superpowers:using-git-worktrees SKILL.md line 96). It bypasses peaks-loop's L2 hook gate and L3 IDE \`permissions.deny\`. Even when L3 denies the terminal Skill, the chain has already taught you to use raw \`git worktree add\`, so L3 is not sufficient.
|
|
31
|
+
|
|
32
|
+
For worktree operations, use ONLY:
|
|
33
|
+
|
|
34
|
+
- \`peaks worktree spawn --rid <rid> --ttl <duration> --purpose <text>\` (after rid-L2-extended ships)
|
|
35
|
+
- until then: \`peaks worktree auth grant --rid <id> --reason <text> --ttl <5m>\`
|
|
36
|
+
|
|
37
|
+
The superpowers skills remain available as 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.
|
|
38
|
+
|
|
39
|
+
If the upstream superpowers chain suggests raw \`git worktree add\`:
|
|
40
|
+
|
|
41
|
+
1. STOP
|
|
42
|
+
2. Re-author the plan as a peaks-rd artifact
|
|
43
|
+
3. Continue with \`peaks worktree spawn\` (or the auth-grant fallback)
|
|
44
|
+
`;
|
|
45
|
+
/**
|
|
46
|
+
* Compose the system-prompt body that the dispatch site prepends to
|
|
47
|
+
* `formatTestToolDetection()\n\n`.
|
|
48
|
+
*
|
|
49
|
+
* Byte-identical degradation contract (slice 2026-07-22-orchestrator-memory-preflight
|
|
50
|
+
* controller brief): when the memory block is unavailable, the caller does
|
|
51
|
+
* `formatTestToolDetection()\n\n${taskBody}` — i.e. the final prompt is exactly
|
|
52
|
+
* `${formatTestToolDetection()}\n\n${taskBody}`. Today's pre-change behavior
|
|
53
|
+
* produced the same string from `src/cli/commands/dispatch-commands.ts:220`,
|
|
54
|
+
* so the unavailable branch MUST return `taskBody` (NOT a `# title\n\n` wrap).
|
|
55
|
+
*
|
|
56
|
+
* Available branch prepends the memory block before the `## Task` heading so
|
|
57
|
+
* `## Project memory …` always sits above the task brief (never pushed below
|
|
58
|
+
* it).
|
|
59
|
+
*
|
|
60
|
+
* Slice 2026-07-29-worktree-l1: every branch prepends the L1 worktree
|
|
61
|
+
* governance block BEFORE the memory block / task body. The block is the
|
|
62
|
+
* first thing the dispatched sub-agent sees, so the superpowers-chain
|
|
63
|
+
* refusal is in scope before any task-specific prose arrives.
|
|
64
|
+
*/
|
|
65
|
+
export function buildDispatchSystemPrompt(input) {
|
|
66
|
+
const { taskBody, memoryBlock, contextProbe } = input;
|
|
67
|
+
const contextBlock = renderContextBlock(contextProbe ?? null);
|
|
68
|
+
if (memoryBlock.available === true && typeof memoryBlock.block === 'string') {
|
|
69
|
+
return `${L1_WORKTREE_GOVERNANCE_BLOCK}\n${contextBlock}${memoryBlock.block}\n## Task\n${taskBody}\n`;
|
|
70
|
+
}
|
|
71
|
+
return `${L1_WORKTREE_GOVERNANCE_BLOCK}\n${contextBlock}${taskBody}`;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Slice 2026-07-29-context-evaluation-accuracy: emit a
|
|
75
|
+
* `## Context window` block with the authoritative ratio so the
|
|
76
|
+
* dispatched sub-agent does not estimate from message length.
|
|
77
|
+
*
|
|
78
|
+
* The probe is a token-counted value (from the IDE adapter's
|
|
79
|
+
* `compact` env-var or statusline). The block also includes a
|
|
80
|
+
* hard rule: "do not estimate context yourself; trust this
|
|
81
|
+
* number" — the LLM's char/4 estimate diverges from peaks'
|
|
82
|
+
* token-counted value by 2-4x, and trusting the LLM's
|
|
83
|
+
* self-estimate causes false-positive "context too low" reports
|
|
84
|
+
* at 60%+ free.
|
|
85
|
+
*
|
|
86
|
+
* When the probe is null (e.g. the orchestrator did not run
|
|
87
|
+
* the context probe before dispatch), the block instructs
|
|
88
|
+
* the sub-agent to call `peaks code context-now` itself
|
|
89
|
+
* before declaring context pressure.
|
|
90
|
+
*/
|
|
91
|
+
function renderContextBlock(probe) {
|
|
92
|
+
if (probe !== null && probe !== undefined) {
|
|
93
|
+
const usedPct = (probe.ratio * 100).toFixed(1);
|
|
94
|
+
const freePct = ((1 - probe.ratio) * 100).toFixed(1);
|
|
95
|
+
const action = probe.ratio >= 0.95
|
|
96
|
+
? 'RED-LINE — call `peaks compact auto --execute` immediately.'
|
|
97
|
+
: probe.ratio >= 0.85
|
|
98
|
+
? 'pre-compact zone — consider running `peaks compact auto --execute` proactively.'
|
|
99
|
+
: probe.ratio >= 0.5
|
|
100
|
+
? 'soft-warn zone — continue working; the next dispatch will re-check.'
|
|
101
|
+
: 'plenty of room — continue without compacting.';
|
|
102
|
+
return `## Context window (authoritative — do NOT estimate yourself)
|
|
103
|
+
|
|
104
|
+
Your context is **${usedPct}% used** (${freePct}% free) as measured by the IDE adapter's token-counted statusline (source: \`${probe.source}\`, IDE: \`${probe.ide}\`). This number is the SAME value \`peaks code context-now\` returns — trust it; do not derive a percentage from your message length or any other heuristic (char/4 estimates diverge from token counts by 2-4x and have caused false "context too low" reports at ${freePct}%+ free).
|
|
105
|
+
|
|
106
|
+
**Action:** ${action}
|
|
107
|
+
|
|
108
|
+
If you are tempted to declare "context pressure" or "context too low" to the parent, FIRST re-run \`peaks code context-now\` and compare its \`ratio\` field to the number above. Only report context pressure if \`peaks code context-now\` returns \`verdict: red-line\` or \`action: auto-compact-now\`.
|
|
109
|
+
|
|
110
|
+
`;
|
|
111
|
+
}
|
|
112
|
+
return `## Context window (no probe available)
|
|
113
|
+
|
|
114
|
+
The orchestrator did not capture a context-fill probe before this dispatch. If you need to evaluate context pressure, run \`peaks code context-now --project <root>\` and trust its \`ratio\` field. Do not estimate from message length.
|
|
115
|
+
|
|
116
|
+
`;
|
|
117
|
+
}
|
|
@@ -8,12 +8,12 @@ declare const CollectInputSchema: z.ZodObject<{
|
|
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
|
9
9
|
project: string;
|
|
10
10
|
goal: string;
|
|
11
|
-
depsMode: "
|
|
11
|
+
depsMode: "latest" | "locked";
|
|
12
12
|
out?: string | undefined;
|
|
13
13
|
}, {
|
|
14
14
|
project: string;
|
|
15
15
|
goal: string;
|
|
16
|
-
depsMode: "
|
|
16
|
+
depsMode: "latest" | "locked";
|
|
17
17
|
out?: string | undefined;
|
|
18
18
|
}>;
|
|
19
19
|
export type CollectInput = z.infer<typeof CollectInputSchema>;
|
|
@@ -11,17 +11,17 @@ declare const BuildInputSchema: z.ZodObject<{
|
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
12
|
project: string;
|
|
13
13
|
goal: string;
|
|
14
|
-
depsMode: "locked" | "latest";
|
|
15
|
-
out: string;
|
|
16
14
|
audience: "all" | "peaks-rd" | "peaks-qa" | "peaks-mut";
|
|
15
|
+
depsMode: "latest" | "locked";
|
|
16
|
+
out: string;
|
|
17
17
|
docBudgetTokens: number;
|
|
18
18
|
fetcher: (...args: unknown[]) => unknown;
|
|
19
19
|
}, {
|
|
20
20
|
project: string;
|
|
21
21
|
goal: string;
|
|
22
|
-
depsMode: "locked" | "latest";
|
|
23
|
-
out: string;
|
|
24
22
|
audience: "all" | "peaks-rd" | "peaks-qa" | "peaks-mut";
|
|
23
|
+
depsMode: "latest" | "locked";
|
|
24
|
+
out: string;
|
|
25
25
|
fetcher: (...args: unknown[]) => unknown;
|
|
26
26
|
docBudgetTokens?: number | undefined;
|
|
27
27
|
}>;
|