peaks-loop 4.0.0-beta.9 → 4.0.1
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 +910 -141
- package/README-en.md +26 -7
- package/README.md +75 -6
- 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 +47 -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
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// src/services/compact-statusline/compact-statusline-service.ts
|
|
2
|
+
//
|
|
3
|
+
// Slice 2026-07-30-compact-visibility (slice 3/4). Pure helper
|
|
4
|
+
// for the 'peaks statusline compact' indicator. Reads
|
|
5
|
+
// .peaks/_runtime/<sessionId>/auto-compact-pending.json +
|
|
6
|
+
// compact-history.jsonl and decides the single-line text
|
|
7
|
+
// the LLM should embed in Claude Code's statusline.
|
|
8
|
+
//
|
|
9
|
+
// State machine:
|
|
10
|
+
// - pending: a 'block' intent is sitting in
|
|
11
|
+
// auto-compact-pending.json → 'compact pending (<ratio>)'
|
|
12
|
+
// - redLine: pending.redLine === true → 'REDLINE 0.95'
|
|
13
|
+
// - just-compacted: history has an event within the last
|
|
14
|
+
// 30 seconds → 'just compacted (<from>→<to>)'
|
|
15
|
+
// - idle: nothing recent → '--'
|
|
16
|
+
// - missing: no session binding or no orchestrator run yet
|
|
17
|
+
// → '' (empty)
|
|
18
|
+
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
19
|
+
import { join } from 'node:path';
|
|
20
|
+
const JUST_COMPACTED_WINDOW_MS = 30_000;
|
|
21
|
+
export function decideCompactStatusline(input) {
|
|
22
|
+
if (input.sessionId === null) {
|
|
23
|
+
return { kind: 'missing', label: '' };
|
|
24
|
+
}
|
|
25
|
+
const runtimeDir = join(input.projectRoot, '.peaks', '_runtime', input.sessionId);
|
|
26
|
+
const pendingPath = join(runtimeDir, 'txt', 'auto-compact-pending.json');
|
|
27
|
+
const historyPath = join(runtimeDir, 'compact-history.jsonl');
|
|
28
|
+
// Priority 1: a pending compact intent.
|
|
29
|
+
if (existsSync(pendingPath)) {
|
|
30
|
+
try {
|
|
31
|
+
const raw = readFileSync(pendingPath, 'utf8');
|
|
32
|
+
const parsed = JSON.parse(raw);
|
|
33
|
+
if (parsed.pending === true) {
|
|
34
|
+
if (parsed.redLine === true) {
|
|
35
|
+
return {
|
|
36
|
+
kind: 'red-line',
|
|
37
|
+
label: `REDLINE ${(parsed.ratio ?? 0).toFixed(2)}`,
|
|
38
|
+
detail: pendingPath,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
kind: 'pending',
|
|
43
|
+
label: `compact pending (${(parsed.ratio ?? 0).toFixed(2)})`,
|
|
44
|
+
detail: pendingPath,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch { /* fall through to history check */ }
|
|
49
|
+
}
|
|
50
|
+
// Priority 2: the most recent history event is within 30s.
|
|
51
|
+
if (existsSync(historyPath)) {
|
|
52
|
+
try {
|
|
53
|
+
const mtimeMs = statSync(historyPath).mtimeMs;
|
|
54
|
+
if (input.now - mtimeMs <= JUST_COMPACTED_WINDOW_MS) {
|
|
55
|
+
const raw = readFileSync(historyPath, 'utf8');
|
|
56
|
+
const lines = raw.split(/\r?\n/).filter((l) => l.length > 0);
|
|
57
|
+
const last = lines[lines.length - 1];
|
|
58
|
+
if (last !== undefined) {
|
|
59
|
+
const parsed = JSON.parse(last);
|
|
60
|
+
const from = (parsed.beforeRatio ?? 0).toFixed(2);
|
|
61
|
+
const to = (parsed.ok === false) ? 'failed' : '0.0?';
|
|
62
|
+
return {
|
|
63
|
+
kind: 'just-compacted',
|
|
64
|
+
label: parsed.redLine === true
|
|
65
|
+
? `just compacted (REDLINE ${from}→?)`
|
|
66
|
+
: `just compacted (${from}→${to})`,
|
|
67
|
+
detail: historyPath,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch { /* fall through to idle */ }
|
|
73
|
+
}
|
|
74
|
+
return { kind: 'idle', label: '--' };
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Plain-text render: just the label. The LLM embeds this in
|
|
78
|
+
* the Claude Code statusline. Pure: no side effects, no I/O
|
|
79
|
+
* beyond the two file reads.
|
|
80
|
+
*/
|
|
81
|
+
export function renderCompactStatusline(state) {
|
|
82
|
+
return state.label;
|
|
83
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConfigGetOptions, ConfigLayer, ConfigSetOptions, ConfigV2,
|
|
1
|
+
import type { ConfigGetOptions, ConfigLayer, ConfigSetOptions, ConfigV2, OcrAuthHeader, OcrConfig, OcrLlmConfig, PeaksConfig, TokenRef, WorkspaceConfig } from './config-types.js';
|
|
2
2
|
export { resolveProjectRootForConfig, resolveCanonicalProjectRoot } from './config-safety.js';
|
|
3
3
|
/**
|
|
4
4
|
* Load the slim 2.0 `~/.peaks/config.json` file. Returns the parsed
|
|
@@ -22,17 +22,6 @@ export type RedactedConfigValue = string | number | boolean | null | RedactedCon
|
|
|
22
22
|
[key: string]: RedactedConfigValue;
|
|
23
23
|
};
|
|
24
24
|
export declare function redactConfigSecrets(value: unknown, path?: string): RedactedConfigValue;
|
|
25
|
-
export type MiniMaxProviderStatus = {
|
|
26
|
-
provider: 'minimax';
|
|
27
|
-
configured: boolean;
|
|
28
|
-
baseUrlConfigured: boolean;
|
|
29
|
-
apiKeyConfigured: boolean;
|
|
30
|
-
storage: 'user-plaintext-v1';
|
|
31
|
-
nextActions: string[];
|
|
32
|
-
};
|
|
33
|
-
export declare function getMiniMaxProviderConfig(): MiniMaxProviderConfig;
|
|
34
|
-
export declare function getMiniMaxProviderStatus(): MiniMaxProviderStatus;
|
|
35
|
-
export declare function setMiniMaxProviderConfig(input: MiniMaxProviderConfig): MiniMaxProviderStatus;
|
|
36
25
|
/**
|
|
37
26
|
* Read the ocr LLM endpoint config from the user-layer
|
|
38
27
|
* `~/.peaks/config.json`. The user populates this themselves by
|
|
@@ -221,7 +221,6 @@ function sanitizeBaseUrlForDisplay(value) {
|
|
|
221
221
|
return '[invalid-url-redacted]';
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
const MINIMAX_API_HOST = 'api.minimaxi.com';
|
|
225
224
|
function isProviderBaseUrlPath(path) {
|
|
226
225
|
return /^providers\.[^.]+\.baseUrl$/.test(path);
|
|
227
226
|
}
|
|
@@ -234,37 +233,11 @@ function isValidProviderBaseUrl(value) {
|
|
|
234
233
|
return false;
|
|
235
234
|
}
|
|
236
235
|
}
|
|
237
|
-
function isValidMiniMaxBaseUrl(value) {
|
|
238
|
-
try {
|
|
239
|
-
const url = new URL(value);
|
|
240
|
-
return url.protocol === 'https:' && url.hostname === MINIMAX_API_HOST && url.username.length === 0 && url.password.length === 0 && url.search.length === 0 && url.hash.length === 0;
|
|
241
|
-
}
|
|
242
|
-
catch {
|
|
243
|
-
return false;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
function getMiniMaxBaseUrlCandidate(key, value) {
|
|
247
|
-
if (key === 'providers.minimax.baseUrl') {
|
|
248
|
-
return value;
|
|
249
|
-
}
|
|
250
|
-
if (key === 'providers.minimax' && value !== null && typeof value === 'object' && !Array.isArray(value)) {
|
|
251
|
-
return value.baseUrl;
|
|
252
|
-
}
|
|
253
|
-
if (key === 'providers' && value !== null && typeof value === 'object' && !Array.isArray(value)) {
|
|
254
|
-
return value.minimax?.baseUrl;
|
|
255
|
-
}
|
|
256
|
-
return undefined;
|
|
257
|
-
}
|
|
258
236
|
function validateProviderBaseUrl(value) {
|
|
259
237
|
if (value !== undefined && (typeof value !== 'string' || !isValidProviderBaseUrl(value))) {
|
|
260
238
|
throw new Error('Provider base URL must be HTTPS without embedded credentials, query, or fragment');
|
|
261
239
|
}
|
|
262
240
|
}
|
|
263
|
-
function validateMiniMaxBaseUrl(value) {
|
|
264
|
-
if (value !== undefined && (typeof value !== 'string' || !isValidMiniMaxBaseUrl(value))) {
|
|
265
|
-
throw new Error('MiniMax base URL must be the MiniMax HTTPS endpoint without embedded credentials');
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
241
|
function getProxyUrlCandidate(key, value) {
|
|
269
242
|
if (key === 'proxy.httpProxy') {
|
|
270
243
|
return value;
|
|
@@ -278,11 +251,8 @@ function isProxyConfigPath(path) {
|
|
|
278
251
|
return path === 'proxy' || path.startsWith('proxy.');
|
|
279
252
|
}
|
|
280
253
|
function validateModelProviderConfig(providers) {
|
|
281
|
-
validateMiniMaxBaseUrl(providers.minimax?.baseUrl);
|
|
282
254
|
for (const [providerId, provider] of Object.entries(providers)) {
|
|
283
|
-
|
|
284
|
-
validateProviderBaseUrl(provider?.baseUrl);
|
|
285
|
-
}
|
|
255
|
+
validateProviderBaseUrl(provider?.baseUrl);
|
|
286
256
|
}
|
|
287
257
|
}
|
|
288
258
|
function validateProviderConfig(partial) {
|
|
@@ -363,9 +333,6 @@ function toProviderModelConfig(value) {
|
|
|
363
333
|
...(typeof value.apiKey === 'string' ? { apiKey: value.apiKey } : {})
|
|
364
334
|
};
|
|
365
335
|
}
|
|
366
|
-
function toMiniMaxProviderConfig(value) {
|
|
367
|
-
return toProviderModelConfig(value);
|
|
368
|
-
}
|
|
369
336
|
const TOKEN_CONFIG_KEYS = new Set(['AnthropicApiKey', 'OpenAiApiKey', 'GitHubToken', 'GitLabToken']);
|
|
370
337
|
function toTokenRef(value) {
|
|
371
338
|
if (!isRecord(value))
|
|
@@ -445,41 +412,6 @@ export function redactConfigSecrets(value, path = '') {
|
|
|
445
412
|
return [key, redactConfigSecrets(entry, nextPath)];
|
|
446
413
|
}));
|
|
447
414
|
}
|
|
448
|
-
function createMiniMaxProviderStatus(config) {
|
|
449
|
-
const baseUrl = config.baseUrl?.trim();
|
|
450
|
-
const apiKey = config.apiKey?.trim();
|
|
451
|
-
const baseUrlConfigured = typeof baseUrl === 'string' && baseUrl.length > 0 && isValidMiniMaxBaseUrl(baseUrl);
|
|
452
|
-
const apiKeyConfigured = typeof apiKey === 'string' && apiKey.length > 0;
|
|
453
|
-
return {
|
|
454
|
-
provider: 'minimax',
|
|
455
|
-
configured: baseUrlConfigured && apiKeyConfigured,
|
|
456
|
-
baseUrlConfigured,
|
|
457
|
-
apiKeyConfigured,
|
|
458
|
-
storage: 'user-plaintext-v1',
|
|
459
|
-
nextActions: baseUrlConfigured && apiKeyConfigured ? [] : ['Export MINIMAX_API_KEY and rerun peaks config provider minimax set --base-url <url>']
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
export function getMiniMaxProviderConfig() {
|
|
463
|
-
return toMiniMaxProviderConfig(readUserJsonFile()?.providers?.minimax);
|
|
464
|
-
}
|
|
465
|
-
export function getMiniMaxProviderStatus() {
|
|
466
|
-
return createMiniMaxProviderStatus(getMiniMaxProviderConfig());
|
|
467
|
-
}
|
|
468
|
-
export function setMiniMaxProviderConfig(input) {
|
|
469
|
-
validateMiniMaxBaseUrl(input.baseUrl);
|
|
470
|
-
const userConfig = readUserJsonFile() ?? {};
|
|
471
|
-
const existingProviders = toModelProviderConfig(userConfig.providers);
|
|
472
|
-
const providers = {
|
|
473
|
-
...existingProviders,
|
|
474
|
-
minimax: {
|
|
475
|
-
...existingProviders.minimax,
|
|
476
|
-
...input
|
|
477
|
-
}
|
|
478
|
-
};
|
|
479
|
-
validateMiniMaxBaseUrl(providers.minimax?.baseUrl);
|
|
480
|
-
writeConfig({ providers }, 'user');
|
|
481
|
-
return createMiniMaxProviderStatus(providers.minimax ?? {});
|
|
482
|
-
}
|
|
483
415
|
const OCR_AUTH_HEADERS = new Set(['authorization', 'x-api-key', 'bearer']);
|
|
484
416
|
function toOcrLlmConfig(value) {
|
|
485
417
|
if (!isRecord(value))
|
|
@@ -552,7 +484,7 @@ function toPeaksConfig(value) {
|
|
|
552
484
|
return {
|
|
553
485
|
...(typeof value.version === 'string' ? { version: value.version } : {}),
|
|
554
486
|
...(typeof value.language === 'string' ? { language: value.language } : {}),
|
|
555
|
-
...(typeof value.model === 'string' && ['haiku', 'sonnet', 'opus'
|
|
487
|
+
...(typeof value.model === 'string' && ['haiku', 'sonnet', 'opus'].includes(value.model) ? { model: value.model } : {}),
|
|
556
488
|
...(typeof value.economyMode === 'boolean' ? { economyMode: value.economyMode } : {}),
|
|
557
489
|
...(typeof value.swarmMode === 'boolean' ? { swarmMode: value.swarmMode } : {}),
|
|
558
490
|
...(isRecord(value.tokens) ? { tokens: toTokenConfig(value.tokens) } : {}),
|
|
@@ -644,11 +576,10 @@ export function setConfig(options) {
|
|
|
644
576
|
if (layer === 'project' && (isProviderConfigPath(options.key) || isProxyConfigPath(options.key) || isSensitiveConfigPath(options.key) || containsSensitiveConfigValue(options.value))) {
|
|
645
577
|
throw new Error('Sensitive config keys must be stored in the user config layer');
|
|
646
578
|
}
|
|
647
|
-
validateMiniMaxBaseUrl(getMiniMaxBaseUrlCandidate(options.key, options.value));
|
|
648
579
|
if (options.key === 'providers') {
|
|
649
580
|
validateModelProviderConfig(toModelProviderConfig(options.value));
|
|
650
581
|
}
|
|
651
|
-
else if (options.key.startsWith('providers.')
|
|
582
|
+
else if (options.key.startsWith('providers.')) {
|
|
652
583
|
const providerId = getNestedPathParts(options.key)[1];
|
|
653
584
|
if (options.key === `providers.${providerId}`) {
|
|
654
585
|
validateModelProviderConfig({ [providerId]: toProviderModelConfig(options.value) });
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
export type ModelPreference = 'haiku' | 'sonnet' | 'opus'
|
|
2
|
-
export type ModelProviderId =
|
|
1
|
+
export type ModelPreference = 'haiku' | 'sonnet' | 'opus';
|
|
2
|
+
export type ModelProviderId = string;
|
|
3
3
|
export type ExecutionModelId = string;
|
|
4
4
|
export type ProviderModelConfig = {
|
|
5
5
|
model?: ExecutionModelId;
|
|
6
6
|
baseUrl?: string;
|
|
7
7
|
apiKey?: string;
|
|
8
8
|
};
|
|
9
|
-
export type MiniMaxProviderConfig = ProviderModelConfig;
|
|
10
9
|
export type ModelProviderConfig = {
|
|
11
|
-
minimax?: MiniMaxProviderConfig;
|
|
12
10
|
[providerId: string]: ProviderModelConfig | undefined;
|
|
13
11
|
};
|
|
14
12
|
export type ProxyConfig = {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* container-lease — pure-function lease store for `peaks container spawn`.
|
|
3
|
+
*
|
|
4
|
+
* Slice 2026-07-29-worktree-l2-extended Part 12 (L4 container
|
|
5
|
+
* runtime). Mirrors the design of `worktree-lease.ts` (Part 1):
|
|
6
|
+
* - Pure function module: every helper takes the lease
|
|
7
|
+
* directory path as an argument and returns structured data.
|
|
8
|
+
* Atomic filesystem writes happen at the call site (CLI
|
|
9
|
+
* command), keeping the helpers trivially testable.
|
|
10
|
+
* - Lifecycle states: active → released/expired/gc, irreversible
|
|
11
|
+
* once terminal.
|
|
12
|
+
* - The CLI in `src/cli/commands/container-commands.ts` writes
|
|
13
|
+
* the lease file and runs `docker run` / `docker rm`; the
|
|
14
|
+
* `peaks sub-agent dispatch --isolation container` command
|
|
15
|
+
* (Part 8) shells out to the spawn CLI and persists the
|
|
16
|
+
* leaseId on the dispatch record (v3 schema).
|
|
17
|
+
*
|
|
18
|
+
* Why a separate lease (not reusing the worktree one): the two
|
|
19
|
+
* isolation modes have different lifecycles, different runtime
|
|
20
|
+
* commands, and different env-var hooks for the PreToolUse
|
|
21
|
+
* gate. Reusing the worktree lease would have made the lease
|
|
22
|
+
* file schema bimodal (worktree-or-container in every field).
|
|
23
|
+
* Two thin modules is cleaner than one thick one.
|
|
24
|
+
*
|
|
25
|
+
* Note: container runtime is docker-only for Part 12. podman
|
|
26
|
+
* support (drop-in CLI-compatible for `run` / `rm` / `ps`) is
|
|
27
|
+
* a follow-up; the runtime-agnostic interface lives in
|
|
28
|
+
* container-runtime.ts (next slice).
|
|
29
|
+
*/
|
|
30
|
+
export declare const DEFAULT_TTL_BY_ROLE: Readonly<Record<string, number>>;
|
|
31
|
+
export declare const DEFAULT_TTL_MS: number | undefined;
|
|
32
|
+
export type ContainerLeaseStatus = 'active' | 'released' | 'expired' | 'gc';
|
|
33
|
+
export interface ContainerLease {
|
|
34
|
+
readonly leaseId: string;
|
|
35
|
+
/** The peaks request id (rid) that the lease was spawned for. */
|
|
36
|
+
readonly rid: string;
|
|
37
|
+
/** Sub-agent role (rd | qa | ui | sc | prd | general-purpose | ...). */
|
|
38
|
+
readonly role: string;
|
|
39
|
+
/** Absolute container working dir (mounted into the container). */
|
|
40
|
+
readonly path: string;
|
|
41
|
+
/** Docker image name (e.g. `node:22-slim`). */
|
|
42
|
+
readonly image: string;
|
|
43
|
+
/** Container id reported by `docker run`. */
|
|
44
|
+
readonly containerId: string;
|
|
45
|
+
/** Unix epoch ms when the lease was created. */
|
|
46
|
+
readonly createdAt: number;
|
|
47
|
+
/** Unix epoch ms when the lease expires. */
|
|
48
|
+
readonly expiresAt: number;
|
|
49
|
+
/** Operator-supplied purpose text (audit log). */
|
|
50
|
+
readonly purpose: string;
|
|
51
|
+
readonly status: ContainerLeaseStatus;
|
|
52
|
+
readonly consumedBySubAgents: ReadonlyArray<string>;
|
|
53
|
+
}
|
|
54
|
+
export type ContainerLeaseDraft = Omit<ContainerLease, 'status' | 'consumedBySubAgents'>;
|
|
55
|
+
export declare function containerLeaseStoreDir(sessionRuntimeDir: string): string;
|
|
56
|
+
export declare function containerLeaseFilePath(sessionRuntimeDir: string, leaseId: string): string;
|
|
57
|
+
/** Pure: generate a 16-hex lease id (8 random bytes, hex-encoded). */
|
|
58
|
+
export declare function generateContainerLeaseId(): string;
|
|
59
|
+
export declare function ttlForContainerRole(role: string): number;
|
|
60
|
+
export declare function finalizeContainerLease(draft: ContainerLeaseDraft): ContainerLease;
|
|
61
|
+
export declare function markContainerReleased(lease: ContainerLease): ContainerLease;
|
|
62
|
+
export declare function markContainerExpired(lease: ContainerLease): ContainerLease;
|
|
63
|
+
export declare function markContainerGc(lease: ContainerLease): ContainerLease;
|
|
64
|
+
export declare function recordContainerConsumption(lease: ContainerLease, subAgentId: string): ContainerLease;
|
|
65
|
+
export declare function isContainerLeaseActive(lease: ContainerLease, now?: number): boolean;
|
|
66
|
+
export declare function serializeContainerLease(lease: ContainerLease): string;
|
|
67
|
+
export declare function deserializeContainerLease(raw: string): ContainerLease;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* container-lease — pure-function lease store for `peaks container spawn`.
|
|
3
|
+
*
|
|
4
|
+
* Slice 2026-07-29-worktree-l2-extended Part 12 (L4 container
|
|
5
|
+
* runtime). Mirrors the design of `worktree-lease.ts` (Part 1):
|
|
6
|
+
* - Pure function module: every helper takes the lease
|
|
7
|
+
* directory path as an argument and returns structured data.
|
|
8
|
+
* Atomic filesystem writes happen at the call site (CLI
|
|
9
|
+
* command), keeping the helpers trivially testable.
|
|
10
|
+
* - Lifecycle states: active → released/expired/gc, irreversible
|
|
11
|
+
* once terminal.
|
|
12
|
+
* - The CLI in `src/cli/commands/container-commands.ts` writes
|
|
13
|
+
* the lease file and runs `docker run` / `docker rm`; the
|
|
14
|
+
* `peaks sub-agent dispatch --isolation container` command
|
|
15
|
+
* (Part 8) shells out to the spawn CLI and persists the
|
|
16
|
+
* leaseId on the dispatch record (v3 schema).
|
|
17
|
+
*
|
|
18
|
+
* Why a separate lease (not reusing the worktree one): the two
|
|
19
|
+
* isolation modes have different lifecycles, different runtime
|
|
20
|
+
* commands, and different env-var hooks for the PreToolUse
|
|
21
|
+
* gate. Reusing the worktree lease would have made the lease
|
|
22
|
+
* file schema bimodal (worktree-or-container in every field).
|
|
23
|
+
* Two thin modules is cleaner than one thick one.
|
|
24
|
+
*
|
|
25
|
+
* Note: container runtime is docker-only for Part 12. podman
|
|
26
|
+
* support (drop-in CLI-compatible for `run` / `rm` / `ps`) is
|
|
27
|
+
* a follow-up; the runtime-agnostic interface lives in
|
|
28
|
+
* container-runtime.ts (next slice).
|
|
29
|
+
*/
|
|
30
|
+
import { randomBytes } from 'node:crypto';
|
|
31
|
+
import { posix as path } from 'node:path';
|
|
32
|
+
export const DEFAULT_TTL_BY_ROLE = Object.freeze({
|
|
33
|
+
rd: 30 * 60 * 1_000,
|
|
34
|
+
qa: 15 * 60 * 1_000,
|
|
35
|
+
ui: 60 * 60 * 1_000,
|
|
36
|
+
sc: 30 * 60 * 1_000,
|
|
37
|
+
prd: 15 * 60 * 1_000,
|
|
38
|
+
general: 30 * 60 * 1_000
|
|
39
|
+
});
|
|
40
|
+
export const DEFAULT_TTL_MS = DEFAULT_TTL_BY_ROLE.rd;
|
|
41
|
+
export function containerLeaseStoreDir(sessionRuntimeDir) {
|
|
42
|
+
return joinPath(sessionRuntimeDir, 'container-leases');
|
|
43
|
+
}
|
|
44
|
+
export function containerLeaseFilePath(sessionRuntimeDir, leaseId) {
|
|
45
|
+
return joinPath(containerLeaseStoreDir(sessionRuntimeDir), `${leaseId}.json`);
|
|
46
|
+
}
|
|
47
|
+
/** Pure: generate a 16-hex lease id (8 random bytes, hex-encoded). */
|
|
48
|
+
export function generateContainerLeaseId() {
|
|
49
|
+
return randomBytes(8).toString('hex');
|
|
50
|
+
}
|
|
51
|
+
export function ttlForContainerRole(role) {
|
|
52
|
+
const normalized = role.toLowerCase();
|
|
53
|
+
const candidate = DEFAULT_TTL_BY_ROLE[normalized];
|
|
54
|
+
const fallback = DEFAULT_TTL_BY_ROLE['rd'] ?? 30 * 60 * 1_000;
|
|
55
|
+
return candidate ?? fallback;
|
|
56
|
+
}
|
|
57
|
+
export function finalizeContainerLease(draft) {
|
|
58
|
+
return {
|
|
59
|
+
...draft,
|
|
60
|
+
status: 'active',
|
|
61
|
+
consumedBySubAgents: []
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export function markContainerReleased(lease) {
|
|
65
|
+
return { ...lease, status: 'released' };
|
|
66
|
+
}
|
|
67
|
+
export function markContainerExpired(lease) {
|
|
68
|
+
return { ...lease, status: 'expired' };
|
|
69
|
+
}
|
|
70
|
+
export function markContainerGc(lease) {
|
|
71
|
+
return { ...lease, status: 'gc' };
|
|
72
|
+
}
|
|
73
|
+
export function recordContainerConsumption(lease, subAgentId) {
|
|
74
|
+
if (lease.consumedBySubAgents.includes(subAgentId))
|
|
75
|
+
return lease;
|
|
76
|
+
return { ...lease, consumedBySubAgents: [...lease.consumedBySubAgents, subAgentId] };
|
|
77
|
+
}
|
|
78
|
+
export function isContainerLeaseActive(lease, now = Date.now()) {
|
|
79
|
+
return lease.status === 'active' && lease.expiresAt > now;
|
|
80
|
+
}
|
|
81
|
+
export function serializeContainerLease(lease) {
|
|
82
|
+
return JSON.stringify(lease, null, 2) + '\n';
|
|
83
|
+
}
|
|
84
|
+
export function deserializeContainerLease(raw) {
|
|
85
|
+
const parsed = JSON.parse(raw);
|
|
86
|
+
if (typeof parsed !== 'object' || parsed === null) {
|
|
87
|
+
throw new Error('container lease file must contain a JSON object');
|
|
88
|
+
}
|
|
89
|
+
const obj = parsed;
|
|
90
|
+
if (typeof obj.leaseId !== 'string')
|
|
91
|
+
throw new Error('leaseId missing');
|
|
92
|
+
if (typeof obj.rid !== 'string')
|
|
93
|
+
throw new Error('rid missing');
|
|
94
|
+
if (typeof obj.role !== 'string')
|
|
95
|
+
throw new Error('role missing');
|
|
96
|
+
if (typeof obj.path !== 'string')
|
|
97
|
+
throw new Error('path missing');
|
|
98
|
+
if (typeof obj.image !== 'string')
|
|
99
|
+
throw new Error('image missing');
|
|
100
|
+
if (typeof obj.containerId !== 'string')
|
|
101
|
+
throw new Error('containerId missing');
|
|
102
|
+
if (typeof obj.createdAt !== 'number')
|
|
103
|
+
throw new Error('createdAt missing');
|
|
104
|
+
if (typeof obj.expiresAt !== 'number')
|
|
105
|
+
throw new Error('expiresAt missing');
|
|
106
|
+
if (typeof obj.purpose !== 'string')
|
|
107
|
+
throw new Error('purpose missing');
|
|
108
|
+
if (typeof obj.status !== 'string')
|
|
109
|
+
throw new Error('status missing');
|
|
110
|
+
if (!Array.isArray(obj.consumedBySubAgents))
|
|
111
|
+
throw new Error('consumedBySubAgents missing');
|
|
112
|
+
return {
|
|
113
|
+
leaseId: obj.leaseId,
|
|
114
|
+
rid: obj.rid,
|
|
115
|
+
role: obj.role,
|
|
116
|
+
path: obj.path,
|
|
117
|
+
image: obj.image,
|
|
118
|
+
containerId: obj.containerId,
|
|
119
|
+
createdAt: obj.createdAt,
|
|
120
|
+
expiresAt: obj.expiresAt,
|
|
121
|
+
purpose: obj.purpose,
|
|
122
|
+
status: obj.status,
|
|
123
|
+
consumedBySubAgents: obj.consumedBySubAgents
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function joinPath(...segments) {
|
|
127
|
+
if (segments.length === 0)
|
|
128
|
+
return '';
|
|
129
|
+
const normalized = segments.map((s) => s.replace(/\\/g, '/'));
|
|
130
|
+
let acc = normalized[0];
|
|
131
|
+
for (let i = 1; i < normalized.length; i++) {
|
|
132
|
+
acc = path.join(acc, normalized[i]);
|
|
133
|
+
}
|
|
134
|
+
return acc;
|
|
135
|
+
}
|
|
@@ -1,3 +1,37 @@
|
|
|
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
|
+
* - `ide-native` — peaks-loop writes the compact intent to
|
|
13
|
+
* the IDE's hook file (per
|
|
14
|
+
* `IdeSettingsLocation`). Used when the IDE
|
|
15
|
+
* requires a registered hook rather than a
|
|
16
|
+
* runtime command.
|
|
17
|
+
* - `llm-self-compress` — peaks-loop records the intent and
|
|
18
|
+
* returns `ok: true` with `pathway` echoed.
|
|
19
|
+
* The LLM does its own context summarization
|
|
20
|
+
* on the next turn. Always available; least
|
|
21
|
+
* precise fallback.
|
|
22
|
+
* - `noop` — adapter explicitly opted out. peaks-loop
|
|
23
|
+
* returns `ok: false` with `message: 'noop'`.
|
|
24
|
+
* Used by legacy / unverified adapters.
|
|
25
|
+
*
|
|
26
|
+
* rid-031 (2026-07-28): `shell-exec` pathway is DEPRECATED. The
|
|
27
|
+
* `case 'shell-exec':` branch remains reachable only to keep the
|
|
28
|
+
* 2 currently-passing tests in `tests/unit/context/auto-compact-main-target.test.ts:58`
|
|
29
|
+
* + `tests/unit/services/context/auto-compact-dispatcher-ide-native.test.ts:102`
|
|
30
|
+
* passing (they assert `pathway: 'shell-exec'`). Real callers must
|
|
31
|
+
* use `ide-native` (main session) or `llm-self-compress`. No host
|
|
32
|
+
* CLI spawn occurs; the case logs a deprecation warning and returns
|
|
33
|
+
* the same envelope shape.
|
|
34
|
+
*/
|
|
1
35
|
import type { CompactDispatchResult } from './auto-compact-types.js';
|
|
2
36
|
export type CompactTarget = 'main' | 'sub-agent';
|
|
3
37
|
export interface DispatchIdeCompactInput {
|
|
@@ -11,15 +45,16 @@ export interface DispatchIdeCompactInput {
|
|
|
11
45
|
* the compact should target. Default `'main'` — the orchestrator
|
|
12
46
|
* (peaks-code body) runs in the main-session Claude Code window and
|
|
13
47
|
* wants to compress *its* context, not a sub-agent's. Sub-agent
|
|
14
|
-
* shells that spawn their own `peaks
|
|
48
|
+
* shells that spawn their own `peaks compact auto` flow pass
|
|
15
49
|
* `'sub-agent'` to preserve the legacy shell-spawn behaviour.
|
|
16
50
|
*
|
|
17
51
|
* Behaviour matrix (claude-code MVP):
|
|
18
52
|
* - target='main' → llm-self-compress (write intent; main LLM
|
|
19
53
|
* fires `/compact` on its next turn).
|
|
20
|
-
* - target='sub-agent'→ shell-exec (
|
|
21
|
-
*
|
|
22
|
-
*
|
|
54
|
+
* - target='sub-agent'→ shell-exec stub (DEPRECATED — no host
|
|
55
|
+
* CLI spawn; returns envelope with
|
|
56
|
+
* `pathway: 'shell-exec'` for legacy
|
|
57
|
+
* contract only — see rid-031).
|
|
23
58
|
* Non-claude-code IDEs + target='main' return noop + warning.
|
|
24
59
|
*/
|
|
25
60
|
readonly target?: CompactTarget | undefined;
|
|
@@ -31,7 +66,7 @@ export interface DispatchIdeCompactInput {
|
|
|
31
66
|
* when the dispatch path completed without error — for
|
|
32
67
|
* `llm-self-compress` the LLM still has to do the actual summary,
|
|
33
68
|
* so the orchestrator MUST NOT treat `ok: true` as proof that the
|
|
34
|
-
* context actually shrunk; the next `peaks
|
|
69
|
+
* context actually shrunk; the next `peaks compact auto` probe
|
|
35
70
|
* confirms.
|
|
36
71
|
*/
|
|
37
72
|
export declare function dispatchIdeCompact(input: DispatchIdeCompactInput): Promise<CompactDispatchResult>;
|