sdd-agent-platform 0.4.2 → 0.5.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/README.md +34 -41
- package/node_modules/@sdd-agent-platform/core/dist/ai-tools.js +56 -73
- package/node_modules/@sdd-agent-platform/core/dist/ai-tools.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/ingestion.js +9 -64
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/ingestion.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-evidence.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-evidence.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-result.js +17 -26
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-result.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/config/init-project.d.ts +8 -7
- package/node_modules/@sdd-agent-platform/core/dist/config/init-project.js +8 -12
- package/node_modules/@sdd-agent-platform/core/dist/config/init-project.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/config/project-config.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/config/project-config.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/config/project-config.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.d.ts +3 -4
- package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.js +377 -411
- package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/context/build-package.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/context/build-package.js +18 -25
- package/node_modules/@sdd-agent-platform/core/dist/context/build-package.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/context/evidence-summary.js +8 -26
- package/node_modules/@sdd-agent-platform/core/dist/context/evidence-summary.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/context/log-worker.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/context/log-worker.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/context-offload/contracts.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/contracts.d.ts +6 -1
- package/node_modules/@sdd-agent-platform/core/dist/contracts.js +5 -0
- package/node_modules/@sdd-agent-platform/core/dist/contracts.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/delegation/model.d.ts +0 -3
- package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.d.ts +0 -3
- package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.js +4 -7
- package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/document-chain.js +3 -13
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/document-chain.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/local-run-index.js +1 -9
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/local-run-index.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/project.js +9 -9
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/project.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/registries.js +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/registries.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-evidence.js +4 -4
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-evidence.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-trust.js +24 -0
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-trust.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/runtime-contracts.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/runtime-contracts.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/doctor.js +43 -180
- package/node_modules/@sdd-agent-platform/core/dist/doctor/doctor.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/evidence/lookup.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/evidence/lookup.js +7 -14
- package/node_modules/@sdd-agent-platform/core/dist/evidence/lookup.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/evidence-runtime/coordination.js +110 -0
- package/node_modules/@sdd-agent-platform/core/dist/evidence-runtime/coordination.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/execution/background-executor.js +4 -4
- package/node_modules/@sdd-agent-platform/core/dist/execution/background-executor.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/execution/foreground-subagents.js +3 -3
- package/node_modules/@sdd-agent-platform/core/dist/execution/foreground-subagents.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/execution/host-invocation.js +85 -86
- package/node_modules/@sdd-agent-platform/core/dist/execution/host-invocation.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/execution/resident-worker.js +2 -3
- package/node_modules/@sdd-agent-platform/core/dist/execution/resident-worker.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/execution/stage-team-runtime.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/execution/stage-team-runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/governance/policy.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/governance/policy.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/governance/policy.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/instructions.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/instructions.js +31 -67
- package/node_modules/@sdd-agent-platform/core/dist/instructions.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/decision-gate.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/decision-gate.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.d.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.js +59 -85
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle-graph/contracts.d.ts +159 -0
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle-graph/contracts.js +7 -0
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle-graph/contracts.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle-graph/kernel.d.ts +16 -0
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle-graph/kernel.js +461 -0
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle-graph/kernel.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle-graph.d.ts +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle-graph.js +3 -0
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle-graph.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/orchestration/contracts.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.d.ts +2 -12
- package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.js +32 -80
- package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.d.ts +2 -5
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.js +27 -69
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-registry.js +118 -34
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-registry.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-runtime-static.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-runtime-static.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/capability-sources.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.js +8 -15
- package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/eval-learning-context.js +4 -4
- package/node_modules/@sdd-agent-platform/core/dist/registries/eval-learning-context.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/plan-scout-domains.d.ts +13 -0
- package/node_modules/@sdd-agent-platform/core/dist/registries/plan-scout-domains.js +76 -0
- package/node_modules/@sdd-agent-platform/core/dist/registries/plan-scout-domains.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/registries/query-status.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/registries/query-status.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/skill-capabilities.js +7 -7
- package/node_modules/@sdd-agent-platform/core/dist/registries/skill-capabilities.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/tool-capabilities.js +4 -4
- package/node_modules/@sdd-agent-platform/core/dist/registries/tool-capabilities.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/tool-plugins.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/registries/tool-plugins.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/worker-adapters.js +11 -11
- package/node_modules/@sdd-agent-platform/core/dist/registries/worker-adapters.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/workflow-gates.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/workflow-gates.js +21 -21
- package/node_modules/@sdd-agent-platform/core/dist/registries/workflow-gates.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/risk/consumer-diagnostics.js +2 -1
- package/node_modules/@sdd-agent-platform/core/dist/risk/consumer-diagnostics.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/risk/kernel.js +6 -6
- package/node_modules/@sdd-agent-platform/core/dist/risk/kernel.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/risk/legacy-adapters.js +11 -23
- package/node_modules/@sdd-agent-platform/core/dist/risk/legacy-adapters.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.d.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.js +18 -20
- package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime.d.ts +0 -2
- package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/routing.js +16 -48
- package/node_modules/@sdd-agent-platform/core/dist/router/routing.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/runtime-import.js +11 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/runtime-import.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/runtime-validation.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/router/runtime-validation.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.d.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.js +20 -28
- package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router.d.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/router.js +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/router.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.d.ts +6 -6
- package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.js +13 -124
- package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.d.ts +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.js +5 -7
- package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/model.d.ts +28 -28
- package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.d.ts +3 -2
- package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.js +15 -66
- package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/run-state.js +26 -36
- package/node_modules/@sdd-agent-platform/core/dist/run-state/run-state.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.d.ts +0 -4
- package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.js +5 -51
- package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state.d.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state.js +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/build.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/build.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/findings.js +7 -16
- package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/findings.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/model.d.ts +1 -2
- package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.d.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.js +1 -4
- package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/runtime-projection-p0.d.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/runtime-projection-p0.js +11 -0
- package/node_modules/@sdd-agent-platform/core/dist/runtime-projection-p0.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/artifact-depth.d.ts +14 -0
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/artifact-depth.js +179 -0
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/artifact-depth.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.d.ts +0 -2
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.js +10 -97
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.js +6 -8
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.d.ts +5 -2
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.js +85 -68
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-rendering.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-rendering.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/spec-entry.js +40 -0
- package/node_modules/@sdd-agent-platform/core/dist/spec-entry.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/spec-manager-contracts.d.ts +12 -0
- package/node_modules/@sdd-agent-platform/core/dist/spec-manager-contracts.js +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/spec-manager-contracts.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-artifacts.d.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/stage-artifacts.js +19 -26
- package/node_modules/@sdd-agent-platform/core/dist/stage-artifacts.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration-contracts.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration-contracts.js +3 -6
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration-contracts.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.d.ts +111 -263
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.js +1272 -1124
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/stage-runtime/runtime.js +5 -5
- package/node_modules/@sdd-agent-platform/core/dist/stage-runtime/runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/status/project-status.d.ts +1 -44
- package/node_modules/@sdd-agent-platform/core/dist/status/project-status.js +47 -170
- package/node_modules/@sdd-agent-platform/core/dist/status/project-status.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.js +73 -73
- package/node_modules/@sdd-agent-platform/core/dist/subagents/contracts.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/subagents/runtime.js +7 -7
- package/node_modules/@sdd-agent-platform/core/dist/subagents/runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.d.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.js +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.d.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.js +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/sync-back.d.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/sync-back.js +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/sync-back.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/task-execution-contract.d.ts +167 -0
- package/node_modules/@sdd-agent-platform/core/dist/task-execution-contract.js +377 -0
- package/node_modules/@sdd-agent-platform/core/dist/task-execution-contract.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/test-support/fixtures.js +329 -314
- package/node_modules/@sdd-agent-platform/core/dist/test-support/fixtures.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.d.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.js +53 -7
- package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/truth-reconciliation.js +9 -12
- package/node_modules/@sdd-agent-platform/core/dist/truth-reconciliation.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.d.ts +0 -48
- package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.js +1 -520
- package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.d.ts +5 -5
- package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.js +14 -14
- package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.d.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.js +111 -159
- package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/task-evidence-judgment.d.ts +49 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/task-evidence-judgment.js +521 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/task-evidence-judgment.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.js +21 -21
- package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.d.ts +0 -18
- package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.js +5 -27
- package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.js +45 -45
- package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification.d.ts +3 -3
- package/node_modules/@sdd-agent-platform/core/dist/verification.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/verification.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/work-units/contracts.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/evidence-packet.js +9 -227
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/evidence-packet.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/hard-checks.js +9 -50
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/hard-checks.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/policy.js +4 -42
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/policy.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/types.d.ts +2 -3
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.d.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.js +2 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/dependencies.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.d.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.js +23 -63
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.d.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.js +43 -65
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/package.json +5 -2
- package/node_modules/@sdd-agent-platform/core/src/ai-tools.test.ts +238 -185
- package/node_modules/@sdd-agent-platform/core/src/ai-tools.ts +56 -73
- package/node_modules/@sdd-agent-platform/core/src/artifacts/ingestion.test.ts +189 -227
- package/node_modules/@sdd-agent-platform/core/src/artifacts/ingestion.ts +222 -278
- package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-evidence.test.ts +28 -28
- package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-evidence.ts +301 -301
- package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-result.test.ts +181 -181
- package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-result.ts +231 -240
- package/node_modules/@sdd-agent-platform/core/src/artifacts/templates.ts +99 -99
- package/node_modules/@sdd-agent-platform/core/src/artifacts.ts +4 -4
- package/node_modules/@sdd-agent-platform/core/src/coding-facts/contracts.ts +79 -79
- package/node_modules/@sdd-agent-platform/core/src/coding-facts.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/config/init-project.test.ts +314 -318
- package/node_modules/@sdd-agent-platform/core/src/config/init-project.ts +128 -123
- package/node_modules/@sdd-agent-platform/core/src/config/project-config.ts +265 -265
- package/node_modules/@sdd-agent-platform/core/src/config/project-detection.ts +147 -147
- package/node_modules/@sdd-agent-platform/core/src/config/starter-documents.ts +400 -432
- package/node_modules/@sdd-agent-platform/core/src/context/budget.ts +30 -30
- package/node_modules/@sdd-agent-platform/core/src/context/build-package.ts +304 -311
- package/node_modules/@sdd-agent-platform/core/src/context/command-summary.ts +45 -45
- package/node_modules/@sdd-agent-platform/core/src/context/context-build.test.ts +188 -189
- package/node_modules/@sdd-agent-platform/core/src/context/evidence-summary.ts +144 -163
- package/node_modules/@sdd-agent-platform/core/src/context/log-worker.ts +48 -48
- package/node_modules/@sdd-agent-platform/core/src/context/source-refs.ts +41 -41
- package/node_modules/@sdd-agent-platform/core/src/context-offload/contracts.ts +47 -47
- package/node_modules/@sdd-agent-platform/core/src/context-offload/runtime.test.ts +71 -71
- package/node_modules/@sdd-agent-platform/core/src/context-offload/runtime.ts +178 -178
- package/node_modules/@sdd-agent-platform/core/src/context-offload.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/context.ts +6 -6
- package/node_modules/@sdd-agent-platform/core/src/contracts/issues.ts +13 -13
- package/node_modules/@sdd-agent-platform/core/src/contracts.test.ts +9 -9
- package/node_modules/@sdd-agent-platform/core/src/contracts.ts +121 -116
- package/node_modules/@sdd-agent-platform/core/src/delegation/delegation.test.ts +183 -183
- package/node_modules/@sdd-agent-platform/core/src/delegation/model.ts +23 -26
- package/node_modules/@sdd-agent-platform/core/src/delegation/queue.ts +58 -58
- package/node_modules/@sdd-agent-platform/core/src/delegation/run-state.ts +14 -14
- package/node_modules/@sdd-agent-platform/core/src/delegation/state-machine.ts +90 -90
- package/node_modules/@sdd-agent-platform/core/src/delegation/validation.ts +124 -127
- package/node_modules/@sdd-agent-platform/core/src/delegation.ts +26 -26
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/ai-entries.ts +28 -28
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/document-chain.ts +104 -112
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/local-run-index.ts +19 -27
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/project.ts +84 -84
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/registries.ts +252 -251
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/run-evidence.ts +330 -330
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/run-records.ts +79 -79
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/run-trust.ts +128 -107
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/runtime-contracts.ts +300 -300
- package/node_modules/@sdd-agent-platform/core/src/doctor/doctor.test.ts +628 -755
- package/node_modules/@sdd-agent-platform/core/src/doctor/doctor.ts +301 -453
- package/node_modules/@sdd-agent-platform/core/src/doctor/model.ts +13 -13
- package/node_modules/@sdd-agent-platform/core/src/doctor/summary.ts +11 -11
- package/node_modules/@sdd-agent-platform/core/src/doctor.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/evidence/lookup.ts +80 -88
- package/node_modules/@sdd-agent-platform/core/src/evidence-runtime/contracts.ts +48 -48
- package/node_modules/@sdd-agent-platform/core/src/evidence-runtime.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/execution/agent-execution-records.ts +195 -195
- package/node_modules/@sdd-agent-platform/core/src/execution/background-executor.test.ts +187 -235
- package/node_modules/@sdd-agent-platform/core/src/execution/background-executor.ts +305 -305
- package/node_modules/@sdd-agent-platform/core/src/execution/foreground-subagents.test.ts +97 -106
- package/node_modules/@sdd-agent-platform/core/src/execution/foreground-subagents.ts +453 -453
- package/node_modules/@sdd-agent-platform/core/src/execution/host-invocation.ts +225 -226
- package/node_modules/@sdd-agent-platform/core/src/execution/resident-worker.test.ts +132 -143
- package/node_modules/@sdd-agent-platform/core/src/execution/resident-worker.ts +436 -437
- package/node_modules/@sdd-agent-platform/core/src/execution/stage-team-runtime.test.ts +102 -102
- package/node_modules/@sdd-agent-platform/core/src/execution/stage-team-runtime.ts +271 -271
- package/node_modules/@sdd-agent-platform/core/src/execution/wave-executor.test.ts +111 -121
- package/node_modules/@sdd-agent-platform/core/src/execution/wave-executor.ts +231 -231
- package/node_modules/@sdd-agent-platform/core/src/execution.ts +5 -5
- package/node_modules/@sdd-agent-platform/core/src/governance/policy.test.ts +57 -65
- package/node_modules/@sdd-agent-platform/core/src/governance/policy.ts +175 -175
- package/node_modules/@sdd-agent-platform/core/src/governance.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/instructions.test.ts +80 -64
- package/node_modules/@sdd-agent-platform/core/src/instructions.ts +32 -68
- package/node_modules/@sdd-agent-platform/core/src/lifecycle/decision-gate.test.ts +174 -174
- package/node_modules/@sdd-agent-platform/core/src/lifecycle/decision-gate.ts +373 -373
- package/node_modules/@sdd-agent-platform/core/src/lifecycle/rendering.ts +29 -29
- package/node_modules/@sdd-agent-platform/core/src/lifecycle/risk-signals.ts +146 -146
- package/node_modules/@sdd-agent-platform/core/src/lifecycle/ship.test.ts +47 -47
- package/node_modules/@sdd-agent-platform/core/src/lifecycle/ship.ts +255 -280
- package/node_modules/@sdd-agent-platform/core/src/lifecycle-graph/contracts.ts +179 -0
- package/node_modules/@sdd-agent-platform/core/src/lifecycle-graph/kernel.ts +522 -0
- package/node_modules/@sdd-agent-platform/core/src/lifecycle-graph.ts +2 -0
- package/node_modules/@sdd-agent-platform/core/src/lifecycle.ts +4 -4
- package/node_modules/@sdd-agent-platform/core/src/orchestration/contracts.ts +50 -50
- package/node_modules/@sdd-agent-platform/core/src/orchestration/index.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/orchestration/runtime.ts +331 -394
- package/node_modules/@sdd-agent-platform/core/src/path-safety.test.ts +22 -22
- package/node_modules/@sdd-agent-platform/core/src/phase8-contracts.test.ts +243 -242
- package/node_modules/@sdd-agent-platform/core/src/phase8-projection-compat.test.ts +152 -153
- package/node_modules/@sdd-agent-platform/core/src/phase8-risk-kernel.test.ts +277 -277
- package/node_modules/@sdd-agent-platform/core/src/phase9-lifecycle-graph.test.ts +103 -0
- package/node_modules/@sdd-agent-platform/core/src/planning/task-graph.test.ts +88 -88
- package/node_modules/@sdd-agent-platform/core/src/planning/task-graph.ts +222 -222
- package/node_modules/@sdd-agent-platform/core/src/planning/wave-plan.test.ts +79 -79
- package/node_modules/@sdd-agent-platform/core/src/planning/wave-plan.ts +160 -160
- package/node_modules/@sdd-agent-platform/core/src/planning.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/registries/agent-capability-catalog.ts +426 -473
- package/node_modules/@sdd-agent-platform/core/src/registries/agent-registry.ts +230 -146
- package/node_modules/@sdd-agent-platform/core/src/registries/agent-runtime-static.ts +142 -142
- package/node_modules/@sdd-agent-platform/core/src/registries/capability-sources.ts +253 -253
- package/node_modules/@sdd-agent-platform/core/src/registries/command-team-runtime.ts +302 -309
- package/node_modules/@sdd-agent-platform/core/src/registries/eval-learning-context.ts +246 -246
- package/node_modules/@sdd-agent-platform/core/src/registries/plan-scout-domains.ts +89 -0
- package/node_modules/@sdd-agent-platform/core/src/registries/query-status.ts +119 -119
- package/node_modules/@sdd-agent-platform/core/src/registries/registries.test.ts +454 -445
- package/node_modules/@sdd-agent-platform/core/src/registries/skill-capabilities.ts +37 -37
- package/node_modules/@sdd-agent-platform/core/src/registries/tool-capabilities.ts +135 -135
- package/node_modules/@sdd-agent-platform/core/src/registries/tool-plugins.ts +132 -132
- package/node_modules/@sdd-agent-platform/core/src/registries/worker-adapters.ts +144 -144
- package/node_modules/@sdd-agent-platform/core/src/registries/workflow-gates.ts +111 -111
- package/node_modules/@sdd-agent-platform/core/src/registries.ts +42 -42
- package/node_modules/@sdd-agent-platform/core/src/risk/consumer-diagnostics.ts +98 -97
- package/node_modules/@sdd-agent-platform/core/src/risk/contracts.ts +63 -63
- package/node_modules/@sdd-agent-platform/core/src/risk/kernel.ts +233 -233
- package/node_modules/@sdd-agent-platform/core/src/risk/legacy-adapters.ts +251 -263
- package/node_modules/@sdd-agent-platform/core/src/risk/workflow-gates.ts +203 -205
- package/node_modules/@sdd-agent-platform/core/src/risk.ts +5 -5
- package/node_modules/@sdd-agent-platform/core/src/router/agent-runtime-config.ts +327 -327
- package/node_modules/@sdd-agent-platform/core/src/router/agent-runtime.ts +388 -390
- package/node_modules/@sdd-agent-platform/core/src/router/profile-resolution.ts +154 -154
- package/node_modules/@sdd-agent-platform/core/src/router/risk-policy.ts +33 -33
- package/node_modules/@sdd-agent-platform/core/src/router/route-cache.ts +100 -100
- package/node_modules/@sdd-agent-platform/core/src/router/route-projection.ts +356 -356
- package/node_modules/@sdd-agent-platform/core/src/router/route-sdd-task.test.ts +428 -665
- package/node_modules/@sdd-agent-platform/core/src/router/route-sdd-task.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/router/routing-rules.ts +73 -73
- package/node_modules/@sdd-agent-platform/core/src/router/routing.ts +189 -223
- package/node_modules/@sdd-agent-platform/core/src/router/runtime-import.ts +464 -453
- package/node_modules/@sdd-agent-platform/core/src/router/runtime-inspection.ts +124 -124
- package/node_modules/@sdd-agent-platform/core/src/router/runtime-registry.ts +123 -123
- package/node_modules/@sdd-agent-platform/core/src/router/runtime-validation.ts +277 -277
- package/node_modules/@sdd-agent-platform/core/src/router/stage-route-binding.ts +273 -279
- package/node_modules/@sdd-agent-platform/core/src/router/team-mode.ts +170 -170
- package/node_modules/@sdd-agent-platform/core/src/router.ts +5 -6
- package/node_modules/@sdd-agent-platform/core/src/run-state/artifacts.ts +126 -240
- package/node_modules/@sdd-agent-platform/core/src/run-state/events.ts +27 -27
- package/node_modules/@sdd-agent-platform/core/src/run-state/inspect-run.ts +172 -172
- package/node_modules/@sdd-agent-platform/core/src/run-state/invocation-ledger.ts +109 -109
- package/node_modules/@sdd-agent-platform/core/src/run-state/model.ts +252 -253
- package/node_modules/@sdd-agent-platform/core/src/run-state/run-index.test.ts +80 -52
- package/node_modules/@sdd-agent-platform/core/src/run-state/run-index.ts +301 -352
- package/node_modules/@sdd-agent-platform/core/src/run-state/run-state.test.ts +70 -118
- package/node_modules/@sdd-agent-platform/core/src/run-state/run-state.ts +406 -416
- package/node_modules/@sdd-agent-platform/core/src/run-state/task-evidence.ts +198 -252
- package/node_modules/@sdd-agent-platform/core/src/run-state/timing.ts +146 -146
- package/node_modules/@sdd-agent-platform/core/src/run-state.ts +8 -9
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/build.ts +60 -60
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/findings.ts +249 -256
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/model.ts +139 -140
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis.test.ts +65 -66
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/runtime-paths.ts +249 -253
- package/node_modules/@sdd-agent-platform/core/src/runtime-projection-p0.test.ts +101 -96
- package/node_modules/@sdd-agent-platform/core/src/runtime-projection-p0.ts +314 -292
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/artifact-depth.test.ts +380 -0
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/artifact-depth.ts +207 -0
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/context.ts +111 -111
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/document-hashes.ts +207 -306
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/run-binding.ts +95 -97
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-inspection.ts +39 -39
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-parser.test.ts +467 -523
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-parser.ts +738 -709
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-rendering.ts +81 -81
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs.ts +5 -5
- package/node_modules/@sdd-agent-platform/core/src/spec-manager-contracts.ts +13 -0
- package/node_modules/@sdd-agent-platform/core/src/stage-artifacts.ts +435 -450
- package/node_modules/@sdd-agent-platform/core/src/stage-collaboration-contracts.ts +316 -322
- package/node_modules/@sdd-agent-platform/core/src/stage-collaboration.test.ts +2963 -2902
- package/node_modules/@sdd-agent-platform/core/src/stage-collaboration.ts +5856 -5831
- package/node_modules/@sdd-agent-platform/core/src/stage-runtime/contracts.ts +40 -40
- package/node_modules/@sdd-agent-platform/core/src/stage-runtime/runtime.test.ts +209 -209
- package/node_modules/@sdd-agent-platform/core/src/stage-runtime/runtime.ts +360 -360
- package/node_modules/@sdd-agent-platform/core/src/stage-runtime.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/status/project-status.test.ts +288 -511
- package/node_modules/@sdd-agent-platform/core/src/status/project-status.ts +651 -851
- package/node_modules/@sdd-agent-platform/core/src/status.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/storage/json-io.ts +10 -10
- package/node_modules/@sdd-agent-platform/core/src/storage/runtime-store.test.ts +489 -681
- package/node_modules/@sdd-agent-platform/core/src/storage/runtime-store.ts +1981 -1981
- package/node_modules/@sdd-agent-platform/core/src/subagents/contracts.ts +45 -45
- package/node_modules/@sdd-agent-platform/core/src/subagents/runtime.test.ts +232 -232
- package/node_modules/@sdd-agent-platform/core/src/subagents/runtime.ts +307 -307
- package/node_modules/@sdd-agent-platform/core/src/subagents.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/task-execution-contract.test.ts +141 -0
- package/node_modules/@sdd-agent-platform/core/src/task-execution-contract.ts +566 -0
- package/node_modules/@sdd-agent-platform/core/src/task-risk-profile.ts +193 -193
- package/node_modules/@sdd-agent-platform/core/src/test-support/fixtures.ts +413 -398
- package/node_modules/@sdd-agent-platform/core/src/test-support/run-state.ts +102 -56
- package/node_modules/@sdd-agent-platform/core/src/test-support.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/truth-reconciliation.test.ts +72 -72
- package/node_modules/@sdd-agent-platform/core/src/truth-reconciliation.ts +9 -12
- package/node_modules/@sdd-agent-platform/core/src/verification/rendering.ts +137 -137
- package/node_modules/@sdd-agent-platform/core/src/verification/review-gate.test.ts +77 -84
- package/node_modules/@sdd-agent-platform/core/src/verification/review-gate.ts +77 -77
- package/node_modules/@sdd-agent-platform/core/src/verification/single-task-loop.ts +455 -506
- package/node_modules/@sdd-agent-platform/core/src/verification/{goal-verify.test.ts → task-evidence-judgment.test.ts} +261 -261
- package/node_modules/@sdd-agent-platform/core/src/verification/{goal-verify.ts → task-evidence-judgment.ts} +619 -619
- package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.ts +1190 -1190
- package/node_modules/@sdd-agent-platform/core/src/verification/validation-cache.ts +106 -106
- package/node_modules/@sdd-agent-platform/core/src/verification/validation-wave.ts +513 -556
- package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.ts +334 -334
- package/node_modules/@sdd-agent-platform/core/src/verification.ts +8 -8
- package/node_modules/@sdd-agent-platform/core/src/work-units/contracts.ts +26 -26
- package/node_modules/@sdd-agent-platform/core/src/work-units/runtime.test.ts +88 -88
- package/node_modules/@sdd-agent-platform/core/src/work-units/runtime.ts +112 -112
- package/node_modules/@sdd-agent-platform/core/src/work-units.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/evidence-packet.ts +190 -425
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/hard-checks.test.ts +169 -507
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/hard-checks.ts +136 -182
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/policy.test.ts +135 -174
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/policy.ts +153 -194
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/types.ts +111 -115
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/affected-file-conflicts.ts +95 -93
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/dependencies.test.ts +32 -32
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/dependencies.ts +114 -114
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/latest-eligible-run.ts +184 -224
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/migration-recovery.ts +158 -158
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/repair-contract.ts +77 -77
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve-task-run.ts +114 -114
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve.test.ts +969 -956
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve.ts +967 -992
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/runtime-projections.ts +712 -712
- package/node_modules/@sdd-agent-platform/core/src/workflow-state.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/worktree/isolation.ts +130 -130
- package/node_modules/@sdd-agent-platform/core/src/worktree/lifecycle.ts +269 -269
- package/node_modules/@sdd-agent-platform/core/src/worktree/worktree.test.ts +150 -150
- package/node_modules/@sdd-agent-platform/core/src/worktree.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/tsconfig.json +15 -15
- package/package.json +2 -2
- package/packages/cli/dist/args.js +2 -2
- package/packages/cli/dist/args.js.map +1 -1
- package/packages/cli/dist/commands/ai-tools.js +2 -13
- package/packages/cli/dist/commands/ai-tools.js.map +1 -1
- package/packages/cli/dist/commands/{verifies.d.ts → artifact.d.ts} +1 -1
- package/packages/cli/dist/commands/artifact.js +168 -0
- package/packages/cli/dist/commands/artifact.js.map +1 -0
- package/packages/cli/dist/commands/context.js +1 -1
- package/packages/cli/dist/commands/context.js.map +1 -1
- package/packages/cli/dist/commands/evidence.js.map +1 -0
- package/packages/cli/dist/commands/execution.js +127 -49
- package/packages/cli/dist/commands/execution.js.map +1 -1
- package/packages/cli/dist/commands/governance.js +1 -1
- package/packages/cli/dist/commands/governance.js.map +1 -1
- package/packages/cli/dist/commands/init.js +1 -6
- package/packages/cli/dist/commands/init.js.map +1 -1
- package/packages/cli/dist/commands/instructions.d.ts +1 -1
- package/packages/cli/dist/commands/instructions.js +15 -1
- package/packages/cli/dist/commands/instructions.js.map +1 -1
- package/packages/cli/dist/commands/registry/runtime.js +63 -40
- package/packages/cli/dist/commands/registry/runtime.js.map +1 -1
- package/packages/cli/dist/commands/run.js +13 -52
- package/packages/cli/dist/commands/run.js.map +1 -1
- package/packages/cli/dist/commands/stage-close.d.ts +60 -0
- package/packages/cli/dist/commands/stage-close.js +270 -41
- package/packages/cli/dist/commands/stage-close.js.map +1 -1
- package/packages/cli/dist/commands/status.js +9 -68
- package/packages/cli/dist/commands/status.js.map +1 -1
- package/packages/cli/dist/commands/tasks.js.map +1 -1
- package/packages/cli/dist/dispatch.js +6 -26
- package/packages/cli/dist/dispatch.js.map +1 -1
- package/packages/cli/dist/help.js +153 -159
- package/packages/cli/dist/help.js.map +1 -1
- package/packages/cli/dist/renderers/artifacts.d.ts +5 -0
- package/packages/cli/dist/renderers/artifacts.js +43 -0
- package/packages/cli/dist/renderers/artifacts.js.map +1 -0
- package/packages/cli/dist/renderers/doctor.js +1 -2
- package/packages/cli/dist/renderers/doctor.js.map +1 -1
- package/packages/cli/dist/renderers/execution.js +1 -1
- package/packages/cli/dist/renderers/execution.js.map +1 -1
- package/packages/cli/dist/renderers/json.d.ts +0 -1
- package/packages/cli/dist/renderers/json.js +0 -3
- package/packages/cli/dist/renderers/json.js.map +1 -1
- package/packages/cli/dist/renderers/registry-runtime.d.ts +1 -2
- package/packages/cli/dist/renderers/registry-runtime.js +0 -20
- package/packages/cli/dist/renderers/registry-runtime.js.map +1 -1
- package/packages/cli/dist/renderers/router.js +1 -1
- package/packages/cli/dist/renderers/router.js.map +1 -1
- package/packages/cli/dist/renderers/workflow.d.ts +53 -0
- package/packages/cli/dist/renderers/workflow.js +93 -34
- package/packages/cli/dist/renderers/workflow.js.map +1 -1
- package/packages/cli/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/cli/package.json +2 -2
- package/packages/core/dist/ai-tools.js +56 -73
- package/packages/core/dist/ai-tools.js.map +1 -1
- package/packages/core/dist/artifacts/ingestion.js +9 -64
- package/packages/core/dist/artifacts/ingestion.js.map +1 -1
- package/packages/core/dist/artifacts/sdd-evidence.js +1 -1
- package/packages/core/dist/artifacts/sdd-evidence.js.map +1 -1
- package/packages/core/dist/artifacts/sdd-result.js +17 -26
- package/packages/core/dist/artifacts/sdd-result.js.map +1 -1
- package/packages/core/dist/config/init-project.d.ts +8 -7
- package/packages/core/dist/config/init-project.js +8 -12
- package/packages/core/dist/config/init-project.js.map +1 -1
- package/packages/core/dist/config/project-config.d.ts +1 -1
- package/packages/core/dist/config/project-config.js +1 -1
- package/packages/core/dist/config/project-config.js.map +1 -1
- package/packages/core/dist/config/starter-documents.d.ts +3 -4
- package/packages/core/dist/config/starter-documents.js +377 -411
- package/packages/core/dist/config/starter-documents.js.map +1 -1
- package/packages/core/dist/context/build-package.d.ts +1 -1
- package/packages/core/dist/context/build-package.js +18 -25
- package/packages/core/dist/context/build-package.js.map +1 -1
- package/packages/core/dist/context/evidence-summary.js +8 -26
- package/packages/core/dist/context/evidence-summary.js.map +1 -1
- package/packages/core/dist/context/log-worker.js +2 -2
- package/packages/core/dist/context/log-worker.js.map +1 -1
- package/packages/core/dist/context-offload/contracts.d.ts +1 -1
- package/packages/core/dist/contracts.d.ts +6 -1
- package/packages/core/dist/contracts.js +5 -0
- package/packages/core/dist/contracts.js.map +1 -1
- package/packages/core/dist/delegation/model.d.ts +0 -3
- package/packages/core/dist/delegation/validation.d.ts +0 -3
- package/packages/core/dist/delegation/validation.js +4 -7
- package/packages/core/dist/delegation/validation.js.map +1 -1
- package/packages/core/dist/doctor/checks/document-chain.js +3 -13
- package/packages/core/dist/doctor/checks/document-chain.js.map +1 -1
- package/packages/core/dist/doctor/checks/local-run-index.js +1 -9
- package/packages/core/dist/doctor/checks/local-run-index.js.map +1 -1
- package/packages/core/dist/doctor/checks/project.js +9 -9
- package/packages/core/dist/doctor/checks/project.js.map +1 -1
- package/packages/core/dist/doctor/checks/registries.js +1 -0
- package/packages/core/dist/doctor/checks/registries.js.map +1 -1
- package/packages/core/dist/doctor/checks/run-evidence.js +4 -4
- package/packages/core/dist/doctor/checks/run-evidence.js.map +1 -1
- package/packages/core/dist/doctor/checks/run-trust.js +24 -0
- package/packages/core/dist/doctor/checks/run-trust.js.map +1 -1
- package/packages/core/dist/doctor/checks/runtime-contracts.js +2 -2
- package/packages/core/dist/doctor/checks/runtime-contracts.js.map +1 -1
- package/packages/core/dist/doctor/doctor.js +43 -180
- package/packages/core/dist/doctor/doctor.js.map +1 -1
- package/packages/core/dist/evidence/lookup.d.ts +1 -1
- package/packages/core/dist/evidence/lookup.js +7 -14
- package/packages/core/dist/evidence/lookup.js.map +1 -1
- package/packages/core/dist/evidence-runtime/coordination.js +110 -0
- package/packages/core/dist/evidence-runtime/coordination.js.map +1 -0
- package/packages/core/dist/execution/background-executor.js +4 -4
- package/packages/core/dist/execution/background-executor.js.map +1 -1
- package/packages/core/dist/execution/foreground-subagents.js +3 -3
- package/packages/core/dist/execution/foreground-subagents.js.map +1 -1
- package/packages/core/dist/execution/host-invocation.js +85 -86
- package/packages/core/dist/execution/host-invocation.js.map +1 -1
- package/packages/core/dist/execution/resident-worker.js +2 -3
- package/packages/core/dist/execution/resident-worker.js.map +1 -1
- package/packages/core/dist/execution/stage-team-runtime.js +2 -2
- package/packages/core/dist/execution/stage-team-runtime.js.map +1 -1
- package/packages/core/dist/governance/policy.d.ts +1 -1
- package/packages/core/dist/governance/policy.js +1 -1
- package/packages/core/dist/governance/policy.js.map +1 -1
- package/packages/core/dist/instructions.d.ts +1 -1
- package/packages/core/dist/instructions.js +31 -67
- package/packages/core/dist/instructions.js.map +1 -1
- package/packages/core/dist/lifecycle/decision-gate.js +1 -1
- package/packages/core/dist/lifecycle/decision-gate.js.map +1 -1
- package/packages/core/dist/lifecycle/ship.d.ts +0 -1
- package/packages/core/dist/lifecycle/ship.js +59 -85
- package/packages/core/dist/lifecycle/ship.js.map +1 -1
- package/packages/core/dist/lifecycle-graph/contracts.d.ts +159 -0
- package/packages/core/dist/lifecycle-graph/contracts.js +7 -0
- package/packages/core/dist/lifecycle-graph/contracts.js.map +1 -0
- package/packages/core/dist/lifecycle-graph/kernel.d.ts +16 -0
- package/packages/core/dist/lifecycle-graph/kernel.js +461 -0
- package/packages/core/dist/lifecycle-graph/kernel.js.map +1 -0
- package/packages/core/dist/lifecycle-graph.d.ts +2 -0
- package/packages/core/dist/lifecycle-graph.js +3 -0
- package/packages/core/dist/lifecycle-graph.js.map +1 -0
- package/packages/core/dist/orchestration/contracts.d.ts +1 -1
- package/packages/core/dist/orchestration/runtime.d.ts +2 -12
- package/packages/core/dist/orchestration/runtime.js +32 -80
- package/packages/core/dist/orchestration/runtime.js.map +1 -1
- package/packages/core/dist/registries/agent-capability-catalog.d.ts +2 -5
- package/packages/core/dist/registries/agent-capability-catalog.js +27 -69
- package/packages/core/dist/registries/agent-capability-catalog.js.map +1 -1
- package/packages/core/dist/registries/agent-registry.js +118 -34
- package/packages/core/dist/registries/agent-registry.js.map +1 -1
- package/packages/core/dist/registries/agent-runtime-static.js +1 -1
- package/packages/core/dist/registries/agent-runtime-static.js.map +1 -1
- package/packages/core/dist/registries/capability-sources.js +1 -1
- package/packages/core/dist/registries/command-team-runtime.d.ts +1 -1
- package/packages/core/dist/registries/command-team-runtime.js +8 -15
- package/packages/core/dist/registries/command-team-runtime.js.map +1 -1
- package/packages/core/dist/registries/eval-learning-context.js +4 -4
- package/packages/core/dist/registries/eval-learning-context.js.map +1 -1
- package/packages/core/dist/registries/plan-scout-domains.d.ts +13 -0
- package/packages/core/dist/registries/plan-scout-domains.js +76 -0
- package/packages/core/dist/registries/plan-scout-domains.js.map +1 -0
- package/packages/core/dist/registries/query-status.js +2 -2
- package/packages/core/dist/registries/query-status.js.map +1 -1
- package/packages/core/dist/registries/skill-capabilities.js +7 -7
- package/packages/core/dist/registries/skill-capabilities.js.map +1 -1
- package/packages/core/dist/registries/tool-capabilities.js +4 -4
- package/packages/core/dist/registries/tool-capabilities.js.map +1 -1
- package/packages/core/dist/registries/tool-plugins.js +2 -2
- package/packages/core/dist/registries/tool-plugins.js.map +1 -1
- package/packages/core/dist/registries/worker-adapters.js +11 -11
- package/packages/core/dist/registries/worker-adapters.js.map +1 -1
- package/packages/core/dist/registries/workflow-gates.d.ts +1 -1
- package/packages/core/dist/registries/workflow-gates.js +21 -21
- package/packages/core/dist/registries/workflow-gates.js.map +1 -1
- package/packages/core/dist/risk/consumer-diagnostics.js +2 -1
- package/packages/core/dist/risk/consumer-diagnostics.js.map +1 -1
- package/packages/core/dist/risk/kernel.js +6 -6
- package/packages/core/dist/risk/kernel.js.map +1 -1
- package/packages/core/dist/risk/legacy-adapters.js +11 -23
- package/packages/core/dist/risk/legacy-adapters.js.map +1 -1
- package/packages/core/dist/risk/workflow-gates.d.ts +2 -2
- package/packages/core/dist/risk/workflow-gates.js +18 -20
- package/packages/core/dist/risk/workflow-gates.js.map +1 -1
- package/packages/core/dist/router/agent-runtime.d.ts +0 -2
- package/packages/core/dist/router/route-projection.js +1 -1
- package/packages/core/dist/router/route-projection.js.map +1 -1
- package/packages/core/dist/router/routing.js +16 -48
- package/packages/core/dist/router/routing.js.map +1 -1
- package/packages/core/dist/router/runtime-import.js +11 -1
- package/packages/core/dist/router/runtime-import.js.map +1 -1
- package/packages/core/dist/router/runtime-validation.js +2 -2
- package/packages/core/dist/router/runtime-validation.js.map +1 -1
- package/packages/core/dist/router/stage-route-binding.d.ts +2 -2
- package/packages/core/dist/router/stage-route-binding.js +20 -28
- package/packages/core/dist/router/stage-route-binding.js.map +1 -1
- package/packages/core/dist/router.d.ts +0 -1
- package/packages/core/dist/router.js +0 -1
- package/packages/core/dist/router.js.map +1 -1
- package/packages/core/dist/run-state/artifacts.d.ts +6 -6
- package/packages/core/dist/run-state/artifacts.js +13 -124
- package/packages/core/dist/run-state/artifacts.js.map +1 -1
- package/packages/core/dist/run-state/inspect-run.d.ts +2 -0
- package/packages/core/dist/run-state/inspect-run.js +5 -7
- package/packages/core/dist/run-state/inspect-run.js.map +1 -1
- package/packages/core/dist/run-state/model.d.ts +28 -28
- package/packages/core/dist/run-state/run-index.d.ts +3 -2
- package/packages/core/dist/run-state/run-index.js +15 -66
- package/packages/core/dist/run-state/run-index.js.map +1 -1
- package/packages/core/dist/run-state/run-state.js +26 -36
- package/packages/core/dist/run-state/run-state.js.map +1 -1
- package/packages/core/dist/run-state/task-evidence.d.ts +0 -4
- package/packages/core/dist/run-state/task-evidence.js +5 -51
- package/packages/core/dist/run-state/task-evidence.js.map +1 -1
- package/packages/core/dist/run-state.d.ts +0 -1
- package/packages/core/dist/run-state.js +0 -1
- package/packages/core/dist/run-state.js.map +1 -1
- package/packages/core/dist/runtime-analysis/build.js +1 -1
- package/packages/core/dist/runtime-analysis/build.js.map +1 -1
- package/packages/core/dist/runtime-analysis/findings.js +7 -16
- package/packages/core/dist/runtime-analysis/findings.js.map +1 -1
- package/packages/core/dist/runtime-analysis/model.d.ts +1 -2
- package/packages/core/dist/runtime-paths.d.ts +0 -1
- package/packages/core/dist/runtime-paths.js +1 -4
- package/packages/core/dist/runtime-paths.js.map +1 -1
- package/packages/core/dist/runtime-projection-p0.d.ts +2 -2
- package/packages/core/dist/runtime-projection-p0.js +11 -0
- package/packages/core/dist/runtime-projection-p0.js.map +1 -1
- package/packages/core/dist/sdd-docs/artifact-depth.d.ts +14 -0
- package/packages/core/dist/sdd-docs/artifact-depth.js +179 -0
- package/packages/core/dist/sdd-docs/artifact-depth.js.map +1 -0
- package/packages/core/dist/sdd-docs/document-hashes.d.ts +0 -2
- package/packages/core/dist/sdd-docs/document-hashes.js +10 -97
- package/packages/core/dist/sdd-docs/document-hashes.js.map +1 -1
- package/packages/core/dist/sdd-docs/run-binding.d.ts +1 -1
- package/packages/core/dist/sdd-docs/run-binding.js +6 -8
- package/packages/core/dist/sdd-docs/run-binding.js.map +1 -1
- package/packages/core/dist/sdd-docs/task-parser.d.ts +5 -2
- package/packages/core/dist/sdd-docs/task-parser.js +85 -68
- package/packages/core/dist/sdd-docs/task-parser.js.map +1 -1
- package/packages/core/dist/sdd-docs/task-rendering.js +2 -2
- package/packages/core/dist/sdd-docs/task-rendering.js.map +1 -1
- package/packages/core/dist/spec-entry.js +40 -0
- package/packages/core/dist/spec-entry.js.map +1 -0
- package/packages/core/dist/spec-manager-contracts.d.ts +12 -0
- package/packages/core/dist/spec-manager-contracts.js +2 -0
- package/packages/core/dist/spec-manager-contracts.js.map +1 -0
- package/packages/core/dist/stage-artifacts.d.ts +2 -2
- package/packages/core/dist/stage-artifacts.js +19 -26
- package/packages/core/dist/stage-artifacts.js.map +1 -1
- package/packages/core/dist/stage-collaboration-contracts.d.ts +1 -1
- package/packages/core/dist/stage-collaboration-contracts.js +3 -6
- package/packages/core/dist/stage-collaboration-contracts.js.map +1 -1
- package/packages/core/dist/stage-collaboration.d.ts +111 -263
- package/packages/core/dist/stage-collaboration.js +1272 -1124
- package/packages/core/dist/stage-collaboration.js.map +1 -1
- package/packages/core/dist/stage-runtime/runtime.js +5 -5
- package/packages/core/dist/stage-runtime/runtime.js.map +1 -1
- package/packages/core/dist/status/project-status.d.ts +1 -44
- package/packages/core/dist/status/project-status.js +47 -170
- package/packages/core/dist/status/project-status.js.map +1 -1
- package/packages/core/dist/storage/runtime-store.js +73 -73
- package/packages/core/dist/subagents/contracts.d.ts +1 -1
- package/packages/core/dist/subagents/runtime.js +7 -7
- package/packages/core/dist/subagents/runtime.js.map +1 -1
- package/packages/core/dist/sync-back/apply.d.ts +1 -0
- package/packages/core/dist/sync-back/apply.js +2 -0
- package/packages/core/dist/sync-back/apply.js.map +1 -0
- package/packages/core/dist/sync-back/inspect.d.ts +1 -0
- package/packages/core/dist/sync-back/inspect.js +2 -0
- package/packages/core/dist/sync-back/inspect.js.map +1 -0
- package/packages/core/dist/sync-back.d.ts +1 -0
- package/packages/core/dist/sync-back.js +2 -0
- package/packages/core/dist/sync-back.js.map +1 -0
- package/packages/core/dist/task-execution-contract.d.ts +167 -0
- package/packages/core/dist/task-execution-contract.js +377 -0
- package/packages/core/dist/task-execution-contract.js.map +1 -0
- package/packages/core/dist/test-support/fixtures.js +329 -314
- package/packages/core/dist/test-support/fixtures.js.map +1 -1
- package/packages/core/dist/test-support/run-state.d.ts +1 -0
- package/packages/core/dist/test-support/run-state.js +53 -7
- package/packages/core/dist/test-support/run-state.js.map +1 -1
- package/packages/core/dist/truth-reconciliation.js +9 -12
- package/packages/core/dist/truth-reconciliation.js.map +1 -1
- package/packages/core/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/core/dist/verification/goal-verify.d.ts +0 -48
- package/packages/core/dist/verification/goal-verify.js +1 -520
- package/packages/core/dist/verification/goal-verify.js.map +1 -1
- package/packages/core/dist/verification/rendering.d.ts +5 -5
- package/packages/core/dist/verification/rendering.js +14 -14
- package/packages/core/dist/verification/rendering.js.map +1 -1
- package/packages/core/dist/verification/single-task-loop.d.ts +1 -0
- package/packages/core/dist/verification/single-task-loop.js +111 -159
- package/packages/core/dist/verification/single-task-loop.js.map +1 -1
- package/packages/core/dist/verification/task-evidence-judgment.d.ts +49 -0
- package/packages/core/dist/verification/task-evidence-judgment.js +521 -0
- package/packages/core/dist/verification/task-evidence-judgment.js.map +1 -0
- package/packages/core/dist/verification/test-runtime.js +21 -21
- package/packages/core/dist/verification/test-runtime.js.map +1 -1
- package/packages/core/dist/verification/validation-wave.d.ts +0 -18
- package/packages/core/dist/verification/validation-wave.js +5 -27
- package/packages/core/dist/verification/validation-wave.js.map +1 -1
- package/packages/core/dist/verification/verify-contract.js +45 -45
- package/packages/core/dist/verification/verify-contract.js.map +1 -1
- package/packages/core/dist/verification.d.ts +3 -3
- package/packages/core/dist/verification.js +2 -2
- package/packages/core/dist/verification.js.map +1 -1
- package/packages/core/dist/work-units/contracts.d.ts +1 -1
- package/packages/core/dist/workflow-gate/evidence-packet.js +9 -227
- package/packages/core/dist/workflow-gate/evidence-packet.js.map +1 -1
- package/packages/core/dist/workflow-gate/hard-checks.js +9 -50
- package/packages/core/dist/workflow-gate/hard-checks.js.map +1 -1
- package/packages/core/dist/workflow-gate/policy.js +4 -42
- package/packages/core/dist/workflow-gate/policy.js.map +1 -1
- package/packages/core/dist/workflow-gate/types.d.ts +2 -3
- package/packages/core/dist/workflow-state/affected-file-conflicts.d.ts +1 -0
- package/packages/core/dist/workflow-state/affected-file-conflicts.js +2 -1
- package/packages/core/dist/workflow-state/affected-file-conflicts.js.map +1 -1
- package/packages/core/dist/workflow-state/dependencies.js +1 -1
- package/packages/core/dist/workflow-state/latest-eligible-run.d.ts +1 -0
- package/packages/core/dist/workflow-state/latest-eligible-run.js +23 -63
- package/packages/core/dist/workflow-state/latest-eligible-run.js.map +1 -1
- package/packages/core/dist/workflow-state/resolve.d.ts +2 -2
- package/packages/core/dist/workflow-state/resolve.js +43 -65
- package/packages/core/dist/workflow-state/resolve.js.map +1 -1
- package/packages/core/package.json +5 -2
- package/tsconfig.build.json +6 -7
- package/node_modules/@sdd-agent-platform/core/src/verification/single-task-loop.test.ts +0 -269
- package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.test.ts +0 -492
- package/node_modules/@sdd-agent-platform/core/src/verification/validation-wave.test.ts +0 -383
- package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.test.ts +0 -188
- package/packages/cli/dist/commands/lifecycle.d.ts +0 -6
- package/packages/cli/dist/commands/lifecycle.js +0 -125
- package/packages/cli/dist/commands/lifecycle.js.map +0 -1
- package/packages/cli/dist/commands/test.d.ts +0 -6
- package/packages/cli/dist/commands/test.js +0 -373
- package/packages/cli/dist/commands/test.js.map +0 -1
- package/packages/cli/dist/commands/verifies.js +0 -87
- package/packages/cli/dist/commands/verifies.js.map +0 -1
- package/packages/cli/dist/commands/verify.d.ts +0 -6
- package/packages/cli/dist/commands/verify.js +0 -330
- package/packages/cli/dist/commands/verify.js.map +0 -1
|
@@ -1,851 +1,651 @@
|
|
|
1
|
-
import { execFile } from 'node:child_process';
|
|
2
|
-
import { stat } from 'node:fs/promises';
|
|
3
|
-
import { promisify } from 'node:util';
|
|
4
|
-
import type { ContextBranchSource, ContextResolverContract } from '../sdd-docs/context.js';
|
|
5
|
-
import type { SddTaskGap, SddTaskModel } from '../sdd-docs/task-parser.js';
|
|
6
|
-
import type { RunSummary } from '../run-state/model.js';
|
|
7
|
-
import { readRunEvents } from '../run-state/events.js';
|
|
8
|
-
import { readRunState } from '../run-state/run-state.js';
|
|
9
|
-
import { listAgentExecutionRecords, listTeamSessionRecords } from '../execution/agent-execution-records.js';
|
|
10
|
-
import { listResidentWorkerRuntimes } from '../execution/resident-worker.js';
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
};
|
|
177
|
-
taskRisk: TaskRiskSummary;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
if (
|
|
341
|
-
return
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
return
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
return
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
return
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
function
|
|
551
|
-
if (!
|
|
552
|
-
return
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
if (
|
|
558
|
-
return
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
return
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
diagnostic: evidence.filter((item) => item.class === 'diagnostic').length,
|
|
653
|
-
blocked: evidence.filter((item) => item.class === 'blocked').length
|
|
654
|
-
};
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
function releaseCriticalCapabilityGaps(tasks: SddTaskModel['tasks'], acceptedProfessionalEvidence: CapabilityEvidenceClassification[], releaseCriticalAdoptions: RuntimeCapabilityAdoptionRecord[]): ProfessionalCapabilityDomain[] {
|
|
658
|
-
const required = releaseCriticalDomainsForTasks(tasks);
|
|
659
|
-
const acceptedEvidenceDomains = new Set(acceptedProfessionalEvidence.map((item) => item.domainOrSourceId));
|
|
660
|
-
const adoptedDomains = new Set(releaseCriticalAdoptions.map((record) => record.capabilityDomain));
|
|
661
|
-
return required.filter((domain) => !acceptedEvidenceDomains.has(domain) && !adoptedDomains.has(domain));
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
function releaseCriticalCapabilityAdoptions(records: RuntimeCapabilityAdoptionRecord[]): RuntimeCapabilityAdoptionRecord[] {
|
|
665
|
-
return records.filter((record) => (record.status === 'adopted' || record.status === 'rejected')
|
|
666
|
-
&& record.reason.trim().length > 0
|
|
667
|
-
&& (record.finalAuthority === 'sdd_contract' || record.finalAuthority === 'sdd_gate')
|
|
668
|
-
&& isRequiredProfessionalDomain(record.capabilityDomain));
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
function capabilityAdoptionCounts(records: RuntimeCapabilityAdoptionRecord[], releaseCriticalAdoptions: RuntimeCapabilityAdoptionRecord[]): CapabilityHealthProjection['adoptions'] {
|
|
672
|
-
return {
|
|
673
|
-
adopted: records.filter((record) => record.status === 'adopted').length,
|
|
674
|
-
rejected: records.filter((record) => record.status === 'rejected').length,
|
|
675
|
-
unresolved: records.filter((record) => record.status === 'unresolved').length,
|
|
676
|
-
acceptedAuthority: records.filter((record) => record.finalAuthority === 'sdd_contract' || record.finalAuthority === 'sdd_gate').length,
|
|
677
|
-
releaseCriticalClosures: uniqueSorted(releaseCriticalAdoptions.map((record) => record.capabilityDomain).filter(isRequiredProfessionalDomain))
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
function releaseCriticalDomainsForTasks(tasks: SddTaskModel['tasks']): ProfessionalCapabilityDomain[] {
|
|
683
|
-
const domains = new Set<ProfessionalCapabilityDomain>();
|
|
684
|
-
for (const task of tasks) {
|
|
685
|
-
const text = [task.title ?? '', ...task.risk, ...task.affectedFiles, ...task.validation, ...task.acceptance, task.boundary ?? ''].join('\n').toLowerCase();
|
|
686
|
-
if (/security|auth|permission|secret|token|安全/.test(text)) {
|
|
687
|
-
domains.add('security-engineering');
|
|
688
|
-
}
|
|
689
|
-
if (/performance|latency|throughput|benchmark|capacity|性能/.test(text)) {
|
|
690
|
-
domains.add('performance-engineering');
|
|
691
|
-
}
|
|
692
|
-
if (/observability|logging|metrics|tracing|diagnostic|可观测/.test(text)) {
|
|
693
|
-
domains.add('observability-engineering');
|
|
694
|
-
}
|
|
695
|
-
if (/release|deploy|rollback|ci|ship|发布/.test(text)) {
|
|
696
|
-
domains.add('release-engineering');
|
|
697
|
-
}
|
|
698
|
-
if (/database|schema|migration|query|data|db|数据/.test(text)) {
|
|
699
|
-
domains.add('db-data-engineering');
|
|
700
|
-
}
|
|
701
|
-
if (/ui|ux|frontend|browser|figma|accessibility|交互|前端/.test(text)) {
|
|
702
|
-
domains.add(text.includes('frontend') || text.includes('browser') || text.includes('前端') ? 'frontend-engineering' : 'ui-ux-product-design');
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
return [...domains].sort((left, right) => left.localeCompare(right));
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
function isRequiredProfessionalDomain(domain: string): domain is ProfessionalCapabilityDomain {
|
|
709
|
-
return REQUIRED_PROFESSIONAL_CAPABILITY_DOMAINS.includes(domain as ProfessionalCapabilityDomain);
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
function noCapabilityEvidenceWarnings(noEvidence: boolean): string[] {
|
|
713
|
-
return noEvidence ? ['latest run has no capability evidence classification'] : [];
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
function capabilityHealthReasons(latestRunId: string | null, evidenceCount: number, blocked: boolean, warnings: number): string[] {
|
|
717
|
-
if (blocked) {
|
|
718
|
-
return ['Capability catalog, runtime source validation, or release-critical adoption has blocking issues.'];
|
|
719
|
-
}
|
|
720
|
-
if (latestRunId !== null && evidenceCount === 0) {
|
|
721
|
-
return ['Latest run has no recorded capability evidence classification.'];
|
|
722
|
-
}
|
|
723
|
-
if (warnings > 0) {
|
|
724
|
-
return ['Capability health has warnings; inspect status JSON for exact missing evidence or release-critical adoption state.'];
|
|
725
|
-
}
|
|
726
|
-
return ['Professional capability baseline, source policy, and release-critical adoption are visible.'];
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
730
|
-
return Boolean(value) && typeof value === 'object';
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
function uniqueSorted<T extends string>(values: T[]): T[] {
|
|
734
|
-
return [...new Set(values)].sort((left, right) => left.localeCompare(right));
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
async function inspectTokenRuntimeProjection(projectRoot: string): Promise<TokenRuntimeProjection> {
|
|
738
|
-
const projections = await listRuntimeProjections(projectRoot, ['context_build', 'team_runtime_decision']);
|
|
739
|
-
const contextPackages = projections.filter((projection) => projection.projectionType === 'context_build');
|
|
740
|
-
const teamRuntimeDecisions = projections.filter((projection) => projection.projectionType === 'team_runtime_decision');
|
|
741
|
-
const contextTokenEstimates = contextPackages.map((projection) => tokenEstimateFromContextBuildPayload(projection.payload)).filter((value): value is number => value !== null);
|
|
742
|
-
const teamTokenEstimates = teamRuntimeDecisions.map((projection) => tokenEstimateFromTeamRuntimePayload(projection.payload)).filter((value): value is number => value !== null);
|
|
743
|
-
const estimatedTokens = [...contextTokenEstimates, ...teamTokenEstimates].reduce((total, value) => total + value, 0);
|
|
744
|
-
const pressureReasons = [
|
|
745
|
-
...contextPackages.map((projection) => contextPressureReason(projection.payload)).filter((value): value is string => value !== null),
|
|
746
|
-
...teamRuntimeDecisions.map((projection) => teamPressureReason(projection.payload)).filter((value): value is string => value !== null)
|
|
747
|
-
];
|
|
748
|
-
|
|
749
|
-
return {
|
|
750
|
-
health: projections.length === 0 ? 'unknown' : pressureReasons.length > 0 ? 'pressure' : 'nominal',
|
|
751
|
-
estimatedTokens: projections.length === 0 ? null : estimatedTokens,
|
|
752
|
-
contextPackages: contextPackages.length,
|
|
753
|
-
teamRuntimeDecisions: teamRuntimeDecisions.length,
|
|
754
|
-
pressureReasons
|
|
755
|
-
};
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
function tokenEstimateFromContextBuildPayload(payload: unknown): number | null {
|
|
759
|
-
if (!payload || typeof payload !== 'object') {
|
|
760
|
-
return null;
|
|
761
|
-
}
|
|
762
|
-
const budget = (payload as { budget?: { estimatedTokens?: unknown } }).budget;
|
|
763
|
-
return typeof budget?.estimatedTokens === 'number' ? budget.estimatedTokens : null;
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
function tokenEstimateFromTeamRuntimePayload(payload: unknown): number | null {
|
|
767
|
-
if (!payload || typeof payload !== 'object') {
|
|
768
|
-
return null;
|
|
769
|
-
}
|
|
770
|
-
const decision = payload as { roleIds?: unknown; telemetryPolicy?: { contextBudget?: unknown } | null };
|
|
771
|
-
const roleCount = Array.isArray(decision.roleIds) ? decision.roleIds.length : 0;
|
|
772
|
-
const contextBudget = decision.telemetryPolicy?.contextBudget;
|
|
773
|
-
const perRole = contextBudget === 'medium' ? 3000 : contextBudget === 'small' ? 1200 : 600;
|
|
774
|
-
return roleCount * perRole;
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
function contextPressureReason(payload: unknown): string | null {
|
|
778
|
-
if (!payload || typeof payload !== 'object') {
|
|
779
|
-
return null;
|
|
780
|
-
}
|
|
781
|
-
const contextPackage = payload as { taskId?: unknown; profile?: unknown; budget?: { estimatedBytes?: unknown; maxBytes?: unknown } };
|
|
782
|
-
const estimatedBytes = contextPackage.budget?.estimatedBytes;
|
|
783
|
-
const maxBytes = contextPackage.budget?.maxBytes;
|
|
784
|
-
if (contextPackage.profile === 'brief') {
|
|
785
|
-
return null;
|
|
786
|
-
}
|
|
787
|
-
if (typeof estimatedBytes === 'number' && typeof maxBytes === 'number' && estimatedBytes >= maxBytes * 0.85) {
|
|
788
|
-
return `context_budget_pressure:${String(contextPackage.taskId ?? 'unknown')}`;
|
|
789
|
-
}
|
|
790
|
-
return null;
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
function teamPressureReason(payload: unknown): string | null {
|
|
794
|
-
if (!payload || typeof payload !== 'object') {
|
|
795
|
-
return null;
|
|
796
|
-
}
|
|
797
|
-
const decision = payload as { command?: unknown; mode?: unknown; roleIds?: unknown };
|
|
798
|
-
const roleCount = Array.isArray(decision.roleIds) ? decision.roleIds.length : 0;
|
|
799
|
-
if (decision.mode === 'team-required' || roleCount > 2) {
|
|
800
|
-
return `team_runtime_pressure:${String(decision.command ?? 'unknown')}`;
|
|
801
|
-
}
|
|
802
|
-
return null;
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
async function inspectRunEvidenceSummary(projectRoot: string, runId: string): Promise<RunEvidenceSummary> {
|
|
806
|
-
const [state, events, agentExecutions, teamSessions, workerRuntimeList] = await Promise.all([
|
|
807
|
-
readRunState(projectRoot, runId),
|
|
808
|
-
readRunEvents(projectRoot, runId),
|
|
809
|
-
listAgentExecutionRecords(projectRoot, runId),
|
|
810
|
-
listTeamSessionRecords(projectRoot, runId),
|
|
811
|
-
listResidentWorkerRuntimes(projectRoot, { runId })
|
|
812
|
-
]);
|
|
813
|
-
return {
|
|
814
|
-
agentExecutions: agentExecutions.length,
|
|
815
|
-
teamSessions: teamSessions.length,
|
|
816
|
-
artifactIngestions: Object.keys(state.artifactIngestions ?? {}).length,
|
|
817
|
-
workerRuntimes: workerRuntimeList.runtimes.length,
|
|
818
|
-
staleWorkerRuntimes: workerRuntimeList.staleRuntimes,
|
|
819
|
-
routePreflight: events.some((event) => event.event === 'agent_router_preflight'),
|
|
820
|
-
tasksChangedAfterRun: false,
|
|
821
|
-
tasksUpdatedAt: null,
|
|
822
|
-
runUpdatedAt: state.updatedAt ?? null
|
|
823
|
-
};
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
async function addTaskDocumentStalenessToRunEvidence(tasksPath: string, latestRun: RunSummary, evidence: RunEvidenceSummary): Promise<RunEvidenceSummary> {
|
|
827
|
-
try {
|
|
828
|
-
const tasksStat = await stat(tasksPath);
|
|
829
|
-
const runUpdatedAtMs = Date.parse(latestRun.updatedAt);
|
|
830
|
-
if (Number.isNaN(runUpdatedAtMs)) {
|
|
831
|
-
return { ...evidence, runUpdatedAt: latestRun.updatedAt };
|
|
832
|
-
}
|
|
833
|
-
return {
|
|
834
|
-
...evidence,
|
|
835
|
-
tasksChangedAfterRun: tasksStat.mtimeMs > runUpdatedAtMs,
|
|
836
|
-
tasksUpdatedAt: tasksStat.mtime.toISOString(),
|
|
837
|
-
runUpdatedAt: latestRun.updatedAt
|
|
838
|
-
};
|
|
839
|
-
} catch {
|
|
840
|
-
return { ...evidence, runUpdatedAt: latestRun.updatedAt };
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
async function getGitRoot(projectRoot: string): Promise<string | null> {
|
|
845
|
-
try {
|
|
846
|
-
const result = await execFileAsync('git', ['-C', projectRoot, 'rev-parse', '--show-toplevel']);
|
|
847
|
-
return result.stdout.trim();
|
|
848
|
-
} catch {
|
|
849
|
-
return null;
|
|
850
|
-
}
|
|
851
|
-
}
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { stat } from 'node:fs/promises';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
|
+
import type { ContextBranchSource, ContextResolverContract } from '../sdd-docs/context.js';
|
|
5
|
+
import type { SddTaskGap, SddTaskModel } from '../sdd-docs/task-parser.js';
|
|
6
|
+
import type { RunState, RunSummary } from '../run-state/model.js';
|
|
7
|
+
import { readRunEvents } from '../run-state/events.js';
|
|
8
|
+
import { readRunState } from '../run-state/run-state.js';
|
|
9
|
+
import { listAgentExecutionRecords, listTeamSessionRecords } from '../execution/agent-execution-records.js';
|
|
10
|
+
import { listResidentWorkerRuntimes } from '../execution/resident-worker.js';
|
|
11
|
+
import { resolveWorkflowState, type WorkflowLatestTaskRun, type WorkflowNextIntent } from '../workflow-state/resolve.js';
|
|
12
|
+
import type { WorkflowAffectedFileConflict } from '../workflow-state/affected-file-conflicts.js';
|
|
13
|
+
import type { WorkflowDependencyBlocker } from '../workflow-state/dependencies.js';
|
|
14
|
+
import type { LatestEligibleRunSelection } from '../workflow-state/latest-eligible-run.js';
|
|
15
|
+
import { buildTaskRiskProfile } from '../task-risk-profile.js';
|
|
16
|
+
import { listRuntimeProjections } from '../storage/runtime-store.js';
|
|
17
|
+
import { inspectLifecycleRiskDecisionForModel, type LifecycleRiskConsumerDiagnostic } from '../risk.js';
|
|
18
|
+
import { inspectWorkflowStageHandoff, type WorkflowStageHandoffDiagnostic } from '../stage-runtime.js';
|
|
19
|
+
import { inspectContextOffloadRuntime, type ContextRuntimeDiagnostic } from '../context-offload.js';
|
|
20
|
+
import { inspectSubagentDispatches, type SubagentDispatchDiagnostic } from '../subagents.js';
|
|
21
|
+
import { inspectAgentCapabilityCatalog, REQUIRED_PROFESSIONAL_CAPABILITY_DOMAINS, type AgentCapabilityDomain, type ProfessionalCapabilityDomain } from '../registries/agent-capability-catalog.js';
|
|
22
|
+
import { validateAgentSkillTeamRuntime } from '../router/runtime-validation.js';
|
|
23
|
+
import { listRuntimeDurableGaps, listRuntimeFanInEvidenceSets, listRuntimeLlmAdvisorAssessments, listRuntimeStageRoleResults, listRuntimeStageTeamSessions, listRuntimeTestRuns, listRuntimeWorkflowGateDecisions, type RuntimeDurableGapRecord } from '../storage/runtime-store.js';
|
|
24
|
+
import type { CapabilityEvidenceClassification } from '../evidence-runtime.js';
|
|
25
|
+
import type { WorkflowGateDecision, WorkflowGateDecisionKind } from '../workflow-gate/types.js';
|
|
26
|
+
|
|
27
|
+
const execFileAsync = promisify(execFile);
|
|
28
|
+
|
|
29
|
+
export interface RunEvidenceSummary {
|
|
30
|
+
agentExecutions: number;
|
|
31
|
+
teamSessions: number;
|
|
32
|
+
artifactIngestions: number;
|
|
33
|
+
workerRuntimes: number;
|
|
34
|
+
staleWorkerRuntimes: number;
|
|
35
|
+
routePreflight: boolean;
|
|
36
|
+
tasksChangedAfterRun: boolean;
|
|
37
|
+
tasksUpdatedAt: string | null;
|
|
38
|
+
runUpdatedAt: string | null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface TaskRiskSummary {
|
|
42
|
+
highRiskTasks: string[];
|
|
43
|
+
mediumRiskTasks: string[];
|
|
44
|
+
sourceBoundaryTasks: string[];
|
|
45
|
+
contextRiskTasks: string[];
|
|
46
|
+
tokenRiskTasks: string[];
|
|
47
|
+
performanceRiskTasks: string[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface TokenRuntimeProjection {
|
|
51
|
+
health: 'unknown' | 'nominal' | 'pressure';
|
|
52
|
+
estimatedTokens: number | null;
|
|
53
|
+
contextPackages: number;
|
|
54
|
+
teamRuntimeDecisions: number;
|
|
55
|
+
pressureReasons: string[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type CapabilityHealthStatus = 'absent' | 'pass' | 'warn' | 'blocked';
|
|
59
|
+
|
|
60
|
+
export interface CapabilityHealthProjection {
|
|
61
|
+
status: CapabilityHealthStatus;
|
|
62
|
+
requiredProfessionalDomains: ProfessionalCapabilityDomain[];
|
|
63
|
+
baselineDomains: ProfessionalCapabilityDomain[];
|
|
64
|
+
missingBaselineDomains: ProfessionalCapabilityDomain[];
|
|
65
|
+
materialPacks: number;
|
|
66
|
+
activeDomains: AgentCapabilityDomain[];
|
|
67
|
+
activePacks: string[];
|
|
68
|
+
sources: {
|
|
69
|
+
total: number;
|
|
70
|
+
quarantined: number;
|
|
71
|
+
denied: number;
|
|
72
|
+
futureAdapters: number;
|
|
73
|
+
};
|
|
74
|
+
evidence: {
|
|
75
|
+
accepted: number;
|
|
76
|
+
candidate: number;
|
|
77
|
+
quarantined: number;
|
|
78
|
+
diagnostic: number;
|
|
79
|
+
blocked: number;
|
|
80
|
+
};
|
|
81
|
+
warnings: string[];
|
|
82
|
+
releaseCriticalGaps: ProfessionalCapabilityDomain[];
|
|
83
|
+
reasons: string[];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface StageTeamHealthProjection {
|
|
87
|
+
sessions: number;
|
|
88
|
+
roleResults: number;
|
|
89
|
+
advisorAssessments: number;
|
|
90
|
+
fanInEvidenceSets: number;
|
|
91
|
+
highConcernAdvisors: number;
|
|
92
|
+
lifecycleProfiles: string[];
|
|
93
|
+
directProfileRequiresNoTeam: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface WorkflowGateHealthProjection {
|
|
97
|
+
decisions: number;
|
|
98
|
+
blocked: number;
|
|
99
|
+
warnings: number;
|
|
100
|
+
humanRequired: number;
|
|
101
|
+
latestDecision: WorkflowGateDecision | null;
|
|
102
|
+
statusesByKind: Partial<Record<WorkflowGateDecisionKind, WorkflowGateDecision['status']>>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface ProjectStatus {
|
|
106
|
+
branch: string;
|
|
107
|
+
workflowStatus: 'active' | 'not_started';
|
|
108
|
+
context: ContextResolverContract;
|
|
109
|
+
gitRoot: string | null;
|
|
110
|
+
documents: SddTaskModel['documents'];
|
|
111
|
+
tasks: {
|
|
112
|
+
total: number;
|
|
113
|
+
pending: number;
|
|
114
|
+
inProgress: number;
|
|
115
|
+
completed: number;
|
|
116
|
+
blocked: number;
|
|
117
|
+
deferred: number;
|
|
118
|
+
unknown: number;
|
|
119
|
+
gaps: number;
|
|
120
|
+
};
|
|
121
|
+
taskRisk: TaskRiskSummary;
|
|
122
|
+
latestRun: RunSummary | null;
|
|
123
|
+
latestRunsByTask: WorkflowLatestTaskRun[];
|
|
124
|
+
latestEligibleRunsByTask: LatestEligibleRunSelection[];
|
|
125
|
+
latestRunEvidence: RunEvidenceSummary | null;
|
|
126
|
+
latestRunStaleReasons: string[];
|
|
127
|
+
affectedFileConflicts: WorkflowAffectedFileConflict[];
|
|
128
|
+
dependencyBlockers: WorkflowDependencyBlocker[];
|
|
129
|
+
recommendedNextCommand: string;
|
|
130
|
+
nextIntent: WorkflowNextIntent;
|
|
131
|
+
tokenProjection: TokenRuntimeProjection;
|
|
132
|
+
contextRuntime: ContextRuntimeDiagnostic;
|
|
133
|
+
subagentDispatches: SubagentDispatchDiagnostic;
|
|
134
|
+
lifecycleRisk: LifecycleRiskConsumerDiagnostic;
|
|
135
|
+
capabilityHealth: CapabilityHealthProjection;
|
|
136
|
+
workflowHandoff: WorkflowStageHandoffDiagnostic;
|
|
137
|
+
gaps: SddTaskGap[];
|
|
138
|
+
durableGaps: RuntimeDurableGapRecord[];
|
|
139
|
+
stageTeamHealth: StageTeamHealthProjection;
|
|
140
|
+
workflowGateHealth: WorkflowGateHealthProjection;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface StatuslineProjection {
|
|
144
|
+
contract: 'sdd-statusline-projection-v1';
|
|
145
|
+
branch: string;
|
|
146
|
+
workflow: ProjectStatus['workflowStatus'];
|
|
147
|
+
taskHealth: 'empty' | 'active' | 'blocked' | 'complete';
|
|
148
|
+
runtimeHealth: 'none' | 'pass' | 'warn' | 'blocked';
|
|
149
|
+
testHealth: 'none' | 'pass' | 'warn' | 'blocked';
|
|
150
|
+
teamHealth: 'none' | 'active';
|
|
151
|
+
tokenHealth: 'unknown' | 'nominal' | 'pressure';
|
|
152
|
+
contextLoad: ProjectStatus['contextRuntime']['level'];
|
|
153
|
+
contextAction: ProjectStatus['contextRuntime']['action'];
|
|
154
|
+
subagentHealth: ProjectStatus['subagentDispatches']['status'];
|
|
155
|
+
evidenceHealth: 'none' | 'pass' | 'warn' | 'blocked';
|
|
156
|
+
capabilityHealth: ProjectStatus['capabilityHealth']['status'];
|
|
157
|
+
latestRunId: string | null;
|
|
158
|
+
counts: {
|
|
159
|
+
tasks: ProjectStatus['tasks'];
|
|
160
|
+
agentExecutions: number;
|
|
161
|
+
teamSessions: number;
|
|
162
|
+
workerRuntimes: number;
|
|
163
|
+
staleWorkerRuntimes: number;
|
|
164
|
+
artifactIngestions: number;
|
|
165
|
+
staleReasons: number;
|
|
166
|
+
affectedFileConflicts: number;
|
|
167
|
+
subagentDispatches: number;
|
|
168
|
+
blockingSubagents: number;
|
|
169
|
+
capabilityWarnings: number;
|
|
170
|
+
durableGaps: number;
|
|
171
|
+
stageTeamSessions: number;
|
|
172
|
+
stageRoleResults: number;
|
|
173
|
+
advisorAssessments: number;
|
|
174
|
+
fanInEvidenceSets: number;
|
|
175
|
+
workflowGateDecisions: number;
|
|
176
|
+
};
|
|
177
|
+
taskRisk: TaskRiskSummary;
|
|
178
|
+
next: string;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export async function getProjectStatus(projectRoot: string, options: { branch?: string | null; branchSource?: ContextBranchSource } = {}): Promise<ProjectStatus> {
|
|
182
|
+
const [workflow, gitRoot] = await Promise.all([resolveWorkflowState(projectRoot, options), getGitRoot(projectRoot)]);
|
|
183
|
+
const latestRun = workflow.latestRun;
|
|
184
|
+
const latestRunState = workflow.latestRunState;
|
|
185
|
+
const latestRunEvidence = latestRun ? await inspectRunEvidenceSummary(projectRoot, latestRun.runId) : null;
|
|
186
|
+
const enrichedLatestRunEvidence = latestRun && latestRunEvidence
|
|
187
|
+
? await addTaskDocumentStalenessToRunEvidence(workflow.model.tasksPath, latestRun, latestRunEvidence)
|
|
188
|
+
: latestRunEvidence;
|
|
189
|
+
const latestRunStaleReasons = latestRunState ? await runDocumentStaleReasons(projectRoot, latestRunState, workflow.model) : [];
|
|
190
|
+
const taskRisk = summarizeTaskRisk(workflow.model.tasks);
|
|
191
|
+
const tokenProjection = await inspectTokenRuntimeProjection(projectRoot);
|
|
192
|
+
const lifecycleRisk = await inspectLifecycleRiskDecisionForModel(projectRoot, workflow.branch, workflow.model);
|
|
193
|
+
const workflowHandoff = await inspectWorkflowStageHandoff(projectRoot, workflow.branch);
|
|
194
|
+
const contextRuntime = await inspectContextOffloadRuntime(projectRoot, workflow.branch);
|
|
195
|
+
const subagentDispatches = await inspectSubagentDispatches(projectRoot, workflow.branch);
|
|
196
|
+
const capabilityHealth = await inspectCapabilityHealth(projectRoot, latestRun?.runId ?? null, workflow.model.tasks);
|
|
197
|
+
const durableGaps = await listRuntimeDurableGaps(projectRoot, { partition: workflow.branch, status: 'open_terminal' });
|
|
198
|
+
const stageTeamHealth = await inspectStageTeamHealth(projectRoot, workflow.branch, latestRun?.runId ?? null);
|
|
199
|
+
const workflowGateHealth = await inspectWorkflowGateHealth(projectRoot, workflow.branch, latestRun?.runId ?? null);
|
|
200
|
+
|
|
201
|
+
return {
|
|
202
|
+
branch: workflow.branch,
|
|
203
|
+
workflowStatus: workflow.workflowStatus,
|
|
204
|
+
context: workflow.context,
|
|
205
|
+
gitRoot,
|
|
206
|
+
documents: workflow.documents,
|
|
207
|
+
tasks: workflow.taskCounts,
|
|
208
|
+
taskRisk,
|
|
209
|
+
latestRun,
|
|
210
|
+
latestRunsByTask: workflow.latestRunsByTask,
|
|
211
|
+
latestEligibleRunsByTask: workflow.latestEligibleRunsByTask,
|
|
212
|
+
latestRunEvidence: enrichedLatestRunEvidence,
|
|
213
|
+
latestRunStaleReasons,
|
|
214
|
+
affectedFileConflicts: workflow.affectedFileConflicts,
|
|
215
|
+
dependencyBlockers: workflow.dependencyBlockers,
|
|
216
|
+
recommendedNextCommand: workflow.recommendedNextCommand,
|
|
217
|
+
nextIntent: workflow.nextIntent,
|
|
218
|
+
tokenProjection,
|
|
219
|
+
contextRuntime,
|
|
220
|
+
subagentDispatches,
|
|
221
|
+
lifecycleRisk,
|
|
222
|
+
workflowHandoff,
|
|
223
|
+
capabilityHealth,
|
|
224
|
+
gaps: workflow.visibleGaps,
|
|
225
|
+
durableGaps,
|
|
226
|
+
stageTeamHealth,
|
|
227
|
+
workflowGateHealth
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export async function getStatuslineProjection(projectRoot: string, options: { branch?: string | null; branchSource?: ContextBranchSource } = {}): Promise<StatuslineProjection> {
|
|
232
|
+
return statuslineProjectionFromStatus(await getProjectStatus(projectRoot, options));
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export function statuslineProjectionFromStatus(status: ProjectStatus): StatuslineProjection {
|
|
236
|
+
const evidence = status.latestRunEvidence;
|
|
237
|
+
const runtimeHealth = status.latestRun
|
|
238
|
+
? status.latestRun.status === 'completed' && status.latestRun.validationStatus === 'pass' ? 'pass' : 'blocked'
|
|
239
|
+
: 'none';
|
|
240
|
+
const staleReasons = status.latestRunStaleReasons.length;
|
|
241
|
+
const affectedFileConflicts = status.affectedFileConflicts.length;
|
|
242
|
+
return {
|
|
243
|
+
contract: 'sdd-statusline-projection-v1',
|
|
244
|
+
branch: status.branch,
|
|
245
|
+
workflow: status.workflowStatus,
|
|
246
|
+
taskHealth: taskHealth(status),
|
|
247
|
+
runtimeHealth,
|
|
248
|
+
testHealth: testHealth(status),
|
|
249
|
+
teamHealth: (evidence?.teamSessions ?? 0) > 0 || status.stageTeamHealth.sessions > 0 || status.stageTeamHealth.roleResults > 0 ? 'active' : 'none',
|
|
250
|
+
tokenHealth: status.tokenProjection.health,
|
|
251
|
+
contextLoad: status.contextRuntime.level,
|
|
252
|
+
contextAction: status.contextRuntime.action,
|
|
253
|
+
subagentHealth: status.subagentDispatches.status,
|
|
254
|
+
evidenceHealth: evidenceHealth(status, runtimeHealth),
|
|
255
|
+
capabilityHealth: status.capabilityHealth.status,
|
|
256
|
+
latestRunId: status.latestRun?.runId ?? null,
|
|
257
|
+
counts: {
|
|
258
|
+
tasks: status.tasks,
|
|
259
|
+
agentExecutions: evidence?.agentExecutions ?? 0,
|
|
260
|
+
teamSessions: evidence?.teamSessions ?? 0,
|
|
261
|
+
workerRuntimes: evidence?.workerRuntimes ?? 0,
|
|
262
|
+
staleWorkerRuntimes: evidence?.staleWorkerRuntimes ?? 0,
|
|
263
|
+
artifactIngestions: evidence?.artifactIngestions ?? 0,
|
|
264
|
+
staleReasons,
|
|
265
|
+
affectedFileConflicts,
|
|
266
|
+
subagentDispatches: status.subagentDispatches.dispatches,
|
|
267
|
+
blockingSubagents: status.subagentDispatches.blockingOpen,
|
|
268
|
+
capabilityWarnings: status.capabilityHealth.warnings.length,
|
|
269
|
+
durableGaps: status.durableGaps.length,
|
|
270
|
+
stageTeamSessions: status.stageTeamHealth.sessions,
|
|
271
|
+
stageRoleResults: status.stageTeamHealth.roleResults,
|
|
272
|
+
advisorAssessments: status.stageTeamHealth.advisorAssessments,
|
|
273
|
+
fanInEvidenceSets: status.stageTeamHealth.fanInEvidenceSets,
|
|
274
|
+
workflowGateDecisions: status.workflowGateHealth.decisions
|
|
275
|
+
},
|
|
276
|
+
taskRisk: status.taskRisk,
|
|
277
|
+
next: status.recommendedNextCommand
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
async function inspectStageTeamHealth(projectRoot: string, partition: string, runId: string | null): Promise<StageTeamHealthProjection> {
|
|
282
|
+
const query = runId ? { partition, runId } : { partition };
|
|
283
|
+
const [sessions, roleResults, advisorAssessments, fanInEvidenceSets] = await Promise.all([
|
|
284
|
+
listRuntimeStageTeamSessions(projectRoot, query),
|
|
285
|
+
listRuntimeStageRoleResults(projectRoot, query),
|
|
286
|
+
listRuntimeLlmAdvisorAssessments(projectRoot, query),
|
|
287
|
+
listRuntimeFanInEvidenceSets(projectRoot, query)
|
|
288
|
+
]);
|
|
289
|
+
return {
|
|
290
|
+
sessions: sessions.length,
|
|
291
|
+
roleResults: roleResults.length,
|
|
292
|
+
advisorAssessments: advisorAssessments.length,
|
|
293
|
+
fanInEvidenceSets: fanInEvidenceSets.length,
|
|
294
|
+
highConcernAdvisors: advisorAssessments.filter((assessment) => assessment.concern === 'high').length,
|
|
295
|
+
lifecycleProfiles: [...new Set(sessions.map((session) => session.lifecycleProfile))].sort(),
|
|
296
|
+
directProfileRequiresNoTeam: !sessions.some((session) => session.lifecycleProfile === 'direct' && session.assignments.some((assignment) => assignment.required))
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
async function inspectWorkflowGateHealth(projectRoot: string, partition: string, runId: string | null): Promise<WorkflowGateHealthProjection> {
|
|
301
|
+
const query = runId ? { partition, runId } : { partition };
|
|
302
|
+
const decisions = await listRuntimeWorkflowGateDecisions(projectRoot, query);
|
|
303
|
+
const statusesByKind = Object.fromEntries(decisions.map((decision) => [decision.decisionKind, decision.status])) as WorkflowGateHealthProjection['statusesByKind'];
|
|
304
|
+
return {
|
|
305
|
+
decisions: decisions.length,
|
|
306
|
+
blocked: decisions.filter((decision) => decision.status === 'BLOCKED').length,
|
|
307
|
+
warnings: decisions.filter((decision) => decision.status === 'WARN').length,
|
|
308
|
+
humanRequired: decisions.filter((decision) => decision.humanRequired).length,
|
|
309
|
+
latestDecision: decisions[0] ?? null,
|
|
310
|
+
statusesByKind
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function summarizeTaskRisk(tasks: Array<Parameters<typeof buildTaskRiskProfile>[0]>): TaskRiskSummary {
|
|
315
|
+
const entries = tasks.map((task) => ({ taskId: task?.id ?? null, profile: buildTaskRiskProfile(task) }));
|
|
316
|
+
return {
|
|
317
|
+
highRiskTasks: entries.filter(({ profile }) => profile.riskLevel === 'high').map(({ taskId }) => taskId).filter((taskId): taskId is string => Boolean(taskId)).sort(),
|
|
318
|
+
mediumRiskTasks: entries.filter(({ profile }) => profile.riskLevel === 'medium').map(({ taskId }) => taskId).filter((taskId): taskId is string => Boolean(taskId)).sort(),
|
|
319
|
+
sourceBoundaryTasks: entries.filter(({ profile }) => profile.sourceBoundary).map(({ taskId }) => taskId).filter((taskId): taskId is string => Boolean(taskId)).sort(),
|
|
320
|
+
contextRiskTasks: entries.filter(({ profile }) => profile.contextRisk).map(({ taskId }) => taskId).filter((taskId): taskId is string => Boolean(taskId)).sort(),
|
|
321
|
+
tokenRiskTasks: entries.filter(({ profile }) => profile.tokenRisk).map(({ taskId }) => taskId).filter((taskId): taskId is string => Boolean(taskId)).sort(),
|
|
322
|
+
performanceRiskTasks: entries.filter(({ profile }) => profile.performanceRisk).map(({ taskId }) => taskId).filter((taskId): taskId is string => Boolean(taskId)).sort()
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function taskHealth(status: ProjectStatus): StatuslineProjection['taskHealth'] {
|
|
327
|
+
if (status.tasks.total === 0) {
|
|
328
|
+
return 'empty';
|
|
329
|
+
}
|
|
330
|
+
if (status.tasks.blocked > 0 || status.gaps.some((gap) => gap.severity === 'blocking') || status.durableGaps.some((gap) => gap.severity === 'blocking') || status.dependencyBlockers.length > 0) {
|
|
331
|
+
return 'blocked';
|
|
332
|
+
}
|
|
333
|
+
if (status.tasks.completed === status.tasks.total) {
|
|
334
|
+
return 'complete';
|
|
335
|
+
}
|
|
336
|
+
return 'active';
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function testHealth(status: ProjectStatus): StatuslineProjection['testHealth'] {
|
|
340
|
+
if (!status.latestRun) {
|
|
341
|
+
return 'none';
|
|
342
|
+
}
|
|
343
|
+
if (status.latestRun.validationStatus === 'pass') {
|
|
344
|
+
return 'pass';
|
|
345
|
+
}
|
|
346
|
+
if (status.latestRun.validationStatus === 'pass_with_gaps') {
|
|
347
|
+
return 'warn';
|
|
348
|
+
}
|
|
349
|
+
return 'blocked';
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function evidenceHealth(status: ProjectStatus, runtimeHealth: StatuslineProjection['runtimeHealth']): StatuslineProjection['evidenceHealth'] {
|
|
353
|
+
if (!status.latestRunEvidence) {
|
|
354
|
+
return 'none';
|
|
355
|
+
}
|
|
356
|
+
if (status.latestRunStaleReasons.length > 0 || status.affectedFileConflicts.length > 0 || status.latestRunEvidence.staleWorkerRuntimes > 0) {
|
|
357
|
+
return 'blocked';
|
|
358
|
+
}
|
|
359
|
+
if (runtimeHealth === 'blocked' || status.latestRunEvidence.tasksChangedAfterRun) {
|
|
360
|
+
return 'warn';
|
|
361
|
+
}
|
|
362
|
+
return 'pass';
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
async function inspectCapabilityHealth(projectRoot: string, latestRunId: string | null, tasks: SddTaskModel['tasks']): Promise<CapabilityHealthProjection> {
|
|
366
|
+
try {
|
|
367
|
+
const [catalog, runtimeValidation, testRuns] = await Promise.all([
|
|
368
|
+
inspectAgentCapabilityCatalog(projectRoot),
|
|
369
|
+
validateAgentSkillTeamRuntime(projectRoot),
|
|
370
|
+
latestRunId ? listRuntimeTestRuns(projectRoot, latestRunId) : Promise.resolve([])
|
|
371
|
+
]);
|
|
372
|
+
const baselineDomains = uniqueSorted(catalog.capabilities
|
|
373
|
+
.filter((capability) => capability.domainGroup === 'professional' && capability.provenance.sourceId === 'sdd_professional_baseline')
|
|
374
|
+
.map((capability) => capability.domain)) as ProfessionalCapabilityDomain[];
|
|
375
|
+
const missingBaselineDomains = REQUIRED_PROFESSIONAL_CAPABILITY_DOMAINS.filter((domain) => !baselineDomains.includes(domain));
|
|
376
|
+
const latestEvidence = capabilityEvidenceFromTestRuns(testRuns.map((run) => run.payload));
|
|
377
|
+
const acceptedProfessionalEvidence = latestEvidence.filter((item) => item.source === 'professional_capability' && item.class === 'accepted');
|
|
378
|
+
const activeDomains = uniqueSorted(acceptedProfessionalEvidence
|
|
379
|
+
.map((item) => item.domainOrSourceId)) as AgentCapabilityDomain[];
|
|
380
|
+
const activePacks = uniqueSorted(catalog.materialPacks
|
|
381
|
+
.filter((pack) => pack.domains.some((domain) => activeDomains.includes(domain)))
|
|
382
|
+
.map((pack) => pack.id));
|
|
383
|
+
const sources = runtimeValidation.inspection.capabilitySources;
|
|
384
|
+
const blocked = missingBaselineDomains.length > 0 || !runtimeValidation.valid;
|
|
385
|
+
const noEvidence = latestRunId !== null && latestEvidence.length === 0;
|
|
386
|
+
const releaseCriticalGaps = releaseCriticalCapabilityGaps(tasks, acceptedProfessionalEvidence);
|
|
387
|
+
const warnings = [
|
|
388
|
+
...missingBaselineDomains.map((domain) => `missing baseline professional domain ${domain}`),
|
|
389
|
+
...runtimeValidation.issues.map((issue) => issue.message),
|
|
390
|
+
...noCapabilityEvidenceWarnings(noEvidence),
|
|
391
|
+
...releaseCriticalGaps.map((domain) => `release-critical capability gap ${domain}`)
|
|
392
|
+
];
|
|
393
|
+
return {
|
|
394
|
+
status: blocked ? 'blocked' : warnings.length > 0 ? 'warn' : 'pass',
|
|
395
|
+
requiredProfessionalDomains: [...REQUIRED_PROFESSIONAL_CAPABILITY_DOMAINS],
|
|
396
|
+
baselineDomains,
|
|
397
|
+
missingBaselineDomains,
|
|
398
|
+
materialPacks: catalog.materialPacks.length,
|
|
399
|
+
activeDomains,
|
|
400
|
+
activePacks,
|
|
401
|
+
sources: {
|
|
402
|
+
total: sources.length,
|
|
403
|
+
quarantined: sources.filter((source) => source.quarantineRequired || source.quarantineStatus === 'quarantined').length,
|
|
404
|
+
denied: sources.filter((source) => source.quarantineStatus === 'denied').length,
|
|
405
|
+
futureAdapters: sources.filter((source) => source.hostCompatibility.some((item) => item.includes('future_adapter'))).length
|
|
406
|
+
},
|
|
407
|
+
evidence: capabilityEvidenceCounts(latestEvidence),
|
|
408
|
+
releaseCriticalGaps,
|
|
409
|
+
warnings: uniqueSorted(warnings),
|
|
410
|
+
reasons: capabilityHealthReasons(latestRunId, latestEvidence.length, blocked, warnings.length)
|
|
411
|
+
};
|
|
412
|
+
} catch (error) {
|
|
413
|
+
return {
|
|
414
|
+
status: 'absent',
|
|
415
|
+
requiredProfessionalDomains: [...REQUIRED_PROFESSIONAL_CAPABILITY_DOMAINS],
|
|
416
|
+
baselineDomains: [],
|
|
417
|
+
missingBaselineDomains: [],
|
|
418
|
+
materialPacks: 0,
|
|
419
|
+
activeDomains: [],
|
|
420
|
+
activePacks: [],
|
|
421
|
+
sources: { total: 0, quarantined: 0, denied: 0, futureAdapters: 0 },
|
|
422
|
+
evidence: { accepted: 0, candidate: 0, quarantined: 0, diagnostic: 0, blocked: 0 },
|
|
423
|
+
warnings: [],
|
|
424
|
+
releaseCriticalGaps: [],
|
|
425
|
+
reasons: [`capability health unavailable: ${error instanceof Error ? error.message : String(error)}`]
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function capabilityEvidenceFromTestRuns(payloads: unknown[]): CapabilityEvidenceClassification[] {
|
|
431
|
+
return payloads.flatMap((payload) => isRecord(payload) && Array.isArray(payload.capabilityEvidence)
|
|
432
|
+
? payload.capabilityEvidence.filter(isCapabilityEvidenceClassification)
|
|
433
|
+
: []);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function isCapabilityEvidenceClassification(value: unknown): value is CapabilityEvidenceClassification {
|
|
437
|
+
return isRecord(value)
|
|
438
|
+
&& (value.class === 'accepted' || value.class === 'candidate' || value.class === 'quarantined' || value.class === 'diagnostic' || value.class === 'blocked')
|
|
439
|
+
&& (value.source === 'professional_capability' || value.source === 'external_source' || value.source === 'runtime_diagnostic')
|
|
440
|
+
&& typeof value.domainOrSourceId === 'string';
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
function capabilityEvidenceCounts(evidence: CapabilityEvidenceClassification[]): CapabilityHealthProjection['evidence'] {
|
|
444
|
+
return {
|
|
445
|
+
accepted: evidence.filter((item) => item.class === 'accepted').length,
|
|
446
|
+
candidate: evidence.filter((item) => item.class === 'candidate').length,
|
|
447
|
+
quarantined: evidence.filter((item) => item.class === 'quarantined').length,
|
|
448
|
+
diagnostic: evidence.filter((item) => item.class === 'diagnostic').length,
|
|
449
|
+
blocked: evidence.filter((item) => item.class === 'blocked').length
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
function releaseCriticalCapabilityGaps(tasks: SddTaskModel['tasks'], acceptedProfessionalEvidence: CapabilityEvidenceClassification[]): ProfessionalCapabilityDomain[] {
|
|
454
|
+
const required = releaseCriticalDomainsForTasks(tasks);
|
|
455
|
+
const acceptedEvidenceDomains = new Set(acceptedProfessionalEvidence.map((item) => item.domainOrSourceId));
|
|
456
|
+
return required.filter((domain) => !acceptedEvidenceDomains.has(domain));
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function releaseCriticalDomainsForTasks(tasks: SddTaskModel['tasks']): ProfessionalCapabilityDomain[] {
|
|
460
|
+
const domains = new Set<ProfessionalCapabilityDomain>();
|
|
461
|
+
for (const task of tasks) {
|
|
462
|
+
const text = [task.title ?? '', ...task.risk, ...task.affectedFiles, ...task.validation, ...task.acceptance, task.boundary ?? ''].join('\n').toLowerCase();
|
|
463
|
+
if (/security|auth|permission|secret|token|安全/.test(text)) {
|
|
464
|
+
domains.add('security-engineering');
|
|
465
|
+
}
|
|
466
|
+
if (/performance|latency|throughput|benchmark|capacity|性能/.test(text)) {
|
|
467
|
+
domains.add('performance-engineering');
|
|
468
|
+
}
|
|
469
|
+
if (/observability|logging|metrics|tracing|diagnostic|可观测/.test(text)) {
|
|
470
|
+
domains.add('observability-engineering');
|
|
471
|
+
}
|
|
472
|
+
if (/release|deploy|rollback|ci|ship|发布/.test(text)) {
|
|
473
|
+
domains.add('release-engineering');
|
|
474
|
+
}
|
|
475
|
+
if (/database|schema|migration|query|data|db|数据/.test(text)) {
|
|
476
|
+
domains.add('db-data-engineering');
|
|
477
|
+
}
|
|
478
|
+
if (/ui|ux|frontend|browser|figma|accessibility|交互|前端/.test(text)) {
|
|
479
|
+
domains.add(text.includes('frontend') || text.includes('browser') || text.includes('前端') ? 'frontend-engineering' : 'ui-ux-product-design');
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return [...domains].sort((left, right) => left.localeCompare(right));
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
function noCapabilityEvidenceWarnings(noEvidence: boolean): string[] {
|
|
486
|
+
return noEvidence ? ['latest run has no capability evidence classification'] : [];
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function capabilityHealthReasons(latestRunId: string | null, evidenceCount: number, blocked: boolean, warnings: number): string[] {
|
|
490
|
+
if (blocked) {
|
|
491
|
+
return ['Capability catalog or runtime source validation has blocking issues.'];
|
|
492
|
+
}
|
|
493
|
+
if (latestRunId !== null && evidenceCount === 0) {
|
|
494
|
+
return ['Latest run has no recorded capability evidence classification.'];
|
|
495
|
+
}
|
|
496
|
+
if (warnings > 0) {
|
|
497
|
+
return ['Capability health has warnings; inspect status JSON for exact missing evidence or release-critical gaps.'];
|
|
498
|
+
}
|
|
499
|
+
return ['Professional capability baseline and source policy are visible.'];
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
503
|
+
return Boolean(value) && typeof value === 'object';
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
function uniqueSorted<T extends string>(values: T[]): T[] {
|
|
507
|
+
return [...new Set(values)].sort((left, right) => left.localeCompare(right));
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
async function inspectTokenRuntimeProjection(projectRoot: string): Promise<TokenRuntimeProjection> {
|
|
511
|
+
const projections = await listRuntimeProjections(projectRoot, ['context_build', 'team_runtime_decision']);
|
|
512
|
+
const contextPackages = projections.filter((projection) => projection.projectionType === 'context_build');
|
|
513
|
+
const teamRuntimeDecisions = projections.filter((projection) => projection.projectionType === 'team_runtime_decision');
|
|
514
|
+
const contextTokenEstimates = contextPackages.map((projection) => tokenEstimateFromContextBuildPayload(projection.payload)).filter((value): value is number => value !== null);
|
|
515
|
+
const teamTokenEstimates = teamRuntimeDecisions.map((projection) => tokenEstimateFromTeamRuntimePayload(projection.payload)).filter((value): value is number => value !== null);
|
|
516
|
+
const estimatedTokens = [...contextTokenEstimates, ...teamTokenEstimates].reduce((total, value) => total + value, 0);
|
|
517
|
+
const pressureReasons = [
|
|
518
|
+
...contextPackages.map((projection) => contextPressureReason(projection.payload)).filter((value): value is string => value !== null),
|
|
519
|
+
...teamRuntimeDecisions.map((projection) => teamPressureReason(projection.payload)).filter((value): value is string => value !== null)
|
|
520
|
+
];
|
|
521
|
+
|
|
522
|
+
return {
|
|
523
|
+
health: projections.length === 0 ? 'unknown' : pressureReasons.length > 0 ? 'pressure' : 'nominal',
|
|
524
|
+
estimatedTokens: projections.length === 0 ? null : estimatedTokens,
|
|
525
|
+
contextPackages: contextPackages.length,
|
|
526
|
+
teamRuntimeDecisions: teamRuntimeDecisions.length,
|
|
527
|
+
pressureReasons
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
function tokenEstimateFromContextBuildPayload(payload: unknown): number | null {
|
|
532
|
+
if (!payload || typeof payload !== 'object') {
|
|
533
|
+
return null;
|
|
534
|
+
}
|
|
535
|
+
const budget = (payload as { budget?: { estimatedTokens?: unknown } }).budget;
|
|
536
|
+
return typeof budget?.estimatedTokens === 'number' ? budget.estimatedTokens : null;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function tokenEstimateFromTeamRuntimePayload(payload: unknown): number | null {
|
|
540
|
+
if (!payload || typeof payload !== 'object') {
|
|
541
|
+
return null;
|
|
542
|
+
}
|
|
543
|
+
const decision = payload as { roleIds?: unknown; telemetryPolicy?: { contextBudget?: unknown } | null };
|
|
544
|
+
const roleCount = Array.isArray(decision.roleIds) ? decision.roleIds.length : 0;
|
|
545
|
+
const contextBudget = decision.telemetryPolicy?.contextBudget;
|
|
546
|
+
const perRole = contextBudget === 'medium' ? 3000 : contextBudget === 'small' ? 1200 : 600;
|
|
547
|
+
return roleCount * perRole;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function contextPressureReason(payload: unknown): string | null {
|
|
551
|
+
if (!payload || typeof payload !== 'object') {
|
|
552
|
+
return null;
|
|
553
|
+
}
|
|
554
|
+
const contextPackage = payload as { taskId?: unknown; profile?: unknown; budget?: { estimatedBytes?: unknown; maxBytes?: unknown } };
|
|
555
|
+
const estimatedBytes = contextPackage.budget?.estimatedBytes;
|
|
556
|
+
const maxBytes = contextPackage.budget?.maxBytes;
|
|
557
|
+
if (contextPackage.profile === 'brief') {
|
|
558
|
+
return null;
|
|
559
|
+
}
|
|
560
|
+
if (typeof estimatedBytes === 'number' && typeof maxBytes === 'number' && estimatedBytes >= maxBytes * 0.85) {
|
|
561
|
+
return `context_budget_pressure:${String(contextPackage.taskId ?? 'unknown')}`;
|
|
562
|
+
}
|
|
563
|
+
return null;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
function teamPressureReason(payload: unknown): string | null {
|
|
567
|
+
if (!payload || typeof payload !== 'object') {
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
570
|
+
const decision = payload as { command?: unknown; mode?: unknown; roleIds?: unknown };
|
|
571
|
+
const roleCount = Array.isArray(decision.roleIds) ? decision.roleIds.length : 0;
|
|
572
|
+
if (decision.mode === 'team-required' || roleCount > 2) {
|
|
573
|
+
return `team_runtime_pressure:${String(decision.command ?? 'unknown')}`;
|
|
574
|
+
}
|
|
575
|
+
return null;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
async function inspectRunEvidenceSummary(projectRoot: string, runId: string): Promise<RunEvidenceSummary> {
|
|
579
|
+
const [state, events, agentExecutions, teamSessions, workerRuntimeList] = await Promise.all([
|
|
580
|
+
readRunState(projectRoot, runId),
|
|
581
|
+
readRunEvents(projectRoot, runId),
|
|
582
|
+
listAgentExecutionRecords(projectRoot, runId),
|
|
583
|
+
listTeamSessionRecords(projectRoot, runId),
|
|
584
|
+
listResidentWorkerRuntimes(projectRoot, { runId })
|
|
585
|
+
]);
|
|
586
|
+
return {
|
|
587
|
+
agentExecutions: agentExecutions.length,
|
|
588
|
+
teamSessions: teamSessions.length,
|
|
589
|
+
artifactIngestions: Object.keys(state.artifactIngestions ?? {}).length,
|
|
590
|
+
workerRuntimes: workerRuntimeList.runtimes.length,
|
|
591
|
+
staleWorkerRuntimes: workerRuntimeList.staleRuntimes,
|
|
592
|
+
routePreflight: events.some((event) => event.event === 'agent_router_preflight'),
|
|
593
|
+
tasksChangedAfterRun: false,
|
|
594
|
+
tasksUpdatedAt: null,
|
|
595
|
+
runUpdatedAt: state.updatedAt ?? null
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
async function addTaskDocumentStalenessToRunEvidence(tasksPath: string, latestRun: RunSummary, evidence: RunEvidenceSummary): Promise<RunEvidenceSummary> {
|
|
600
|
+
try {
|
|
601
|
+
const tasksStat = await stat(tasksPath);
|
|
602
|
+
const runUpdatedAtMs = Date.parse(latestRun.updatedAt);
|
|
603
|
+
if (Number.isNaN(runUpdatedAtMs)) {
|
|
604
|
+
return { ...evidence, runUpdatedAt: latestRun.updatedAt };
|
|
605
|
+
}
|
|
606
|
+
return {
|
|
607
|
+
...evidence,
|
|
608
|
+
tasksChangedAfterRun: tasksStat.mtimeMs > runUpdatedAtMs,
|
|
609
|
+
tasksUpdatedAt: tasksStat.mtime.toISOString(),
|
|
610
|
+
runUpdatedAt: latestRun.updatedAt
|
|
611
|
+
};
|
|
612
|
+
} catch {
|
|
613
|
+
return { ...evidence, runUpdatedAt: latestRun.updatedAt };
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
async function getGitRoot(projectRoot: string): Promise<string | null> {
|
|
618
|
+
try {
|
|
619
|
+
const result = await execFileAsync('git', ['-C', projectRoot, 'rev-parse', '--show-toplevel']);
|
|
620
|
+
return result.stdout.trim();
|
|
621
|
+
} catch {
|
|
622
|
+
return null;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
async function runDocumentStaleReasons(_projectRoot: string, state: RunState, model: SddTaskModel): Promise<string[]> {
|
|
627
|
+
const reasons: string[] = [];
|
|
628
|
+
const snapshot = state.documentSnapshot;
|
|
629
|
+
if (!snapshot.specHash && !snapshot.planHash && !snapshot.tasksHash) {
|
|
630
|
+
reasons.push('Run has no document snapshot hashes; rerun execute before validation.');
|
|
631
|
+
}
|
|
632
|
+
appendDocumentHashMismatch(reasons, 'spec.md', snapshot.specHash, model.documents.specHash ?? null);
|
|
633
|
+
appendDocumentHashMismatch(reasons, 'plan.md', snapshot.planHash, model.documents.planHash ?? null);
|
|
634
|
+
appendDocumentHashMismatch(reasons, 'tasks.md', snapshot.tasksHash, model.documents.tasksHash ?? null);
|
|
635
|
+
if (model.documents.planStale) {
|
|
636
|
+
reasons.push('Current plan.md is stale against spec.md.');
|
|
637
|
+
}
|
|
638
|
+
if (model.documents.tasksStale) {
|
|
639
|
+
reasons.push('Current tasks.md is stale against plan.md or spec.md.');
|
|
640
|
+
}
|
|
641
|
+
return reasons;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
function appendDocumentHashMismatch(reasons: string[], documentName: string, expected: string | null, actual: string | null): void {
|
|
645
|
+
if (!expected && !actual) {
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
if (!expected || !actual || expected.replace(/^sha256:/, '') !== actual) {
|
|
649
|
+
reasons.push(`Run snapshot for ${documentName} is ${expected ?? 'missing'}, current hash is ${actual ?? 'missing'}.`);
|
|
650
|
+
}
|
|
651
|
+
}
|