sdd-agent-platform 0.4.1 → 0.5.0
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 +24 -28
- package/node_modules/@sdd-agent-platform/core/dist/ai-tools.js +84 -103
- package/node_modules/@sdd-agent-platform/core/dist/ai-tools.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/config/init-project.d.ts +10 -6
- package/node_modules/@sdd-agent-platform/core/dist/config/init-project.js +7 -8
- 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 +3 -1
- package/node_modules/@sdd-agent-platform/core/dist/config/project-config.js +7 -3
- 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 +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.js +374 -421
- 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 +7 -19
- package/node_modules/@sdd-agent-platform/core/dist/context/build-package.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/contracts.d.ts +7 -1
- package/node_modules/@sdd-agent-platform/core/dist/contracts.js +6 -0
- package/node_modules/@sdd-agent-platform/core/dist/contracts.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/document-chain.js +2 -12
- 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/doctor.js +1 -18
- 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 +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/evidence/lookup.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/evidence-runtime/contracts.d.ts +0 -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/host-invocation.js +83 -83
- package/node_modules/@sdd-agent-platform/core/dist/instructions.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/instructions.js +37 -80
- package/node_modules/@sdd-agent-platform/core/dist/instructions.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.js +58 -68
- 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.js +21 -28
- package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-registry.js +124 -40
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-registry.js.map +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 +6 -13
- 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/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/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 +6 -6
- package/node_modules/@sdd-agent-platform/core/dist/registries/tool-capabilities.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 +18 -18
- 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/contracts.d.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/risk/kernel.js +7 -7
- 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 +12 -27
- 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.js +6 -6
- 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-config.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime-config.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/routing.js +2 -4
- 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.d.ts +28 -0
- package/node_modules/@sdd-agent-platform/core/dist/router/runtime-import.js +383 -0
- package/node_modules/@sdd-agent-platform/core/dist/router/runtime-import.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.d.ts +37 -0
- package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.js +227 -0
- package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/router.d.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/router.js +1 -0
- 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 +16 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.js +6 -0
- 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/model.d.ts +20 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state/run-state.js +7 -7
- 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 +1 -2
- package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.js +2 -9
- 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/timing.d.ts +8 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state/timing.js +131 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state/timing.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/build.js +1 -4
- 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 +0 -39
- 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 -17
- package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.d.ts +10 -0
- package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.js +65 -0
- 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 +64 -0
- package/node_modules/@sdd-agent-platform/core/dist/runtime-projection-p0.js +211 -0
- package/node_modules/@sdd-agent-platform/core/dist/runtime-projection-p0.js.map +1 -0
- 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/task-parser.d.ts +5 -1
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.js +60 -22
- 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 +55 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-artifacts.js +315 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-artifacts.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration-contracts.d.ts +55 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration-contracts.js +238 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration-contracts.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.d.ts +736 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.js +4018 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-runtime/runtime.js +8 -1
- 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.js +25 -1
- 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.d.ts +170 -18
- package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.js +597 -85
- package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.d.ts +1 -17
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.js +1 -242
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.d.ts +1 -110
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.js +1 -496
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sync-back.d.ts +1 -2
- package/node_modules/@sdd-agent-platform/core/dist/sync-back.js +1 -2
- package/node_modules/@sdd-agent-platform/core/dist/sync-back.js.map +1 -1
- 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 +31 -0
- 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.d.ts +44 -0
- package/node_modules/@sdd-agent-platform/core/dist/truth-reconciliation.js +135 -0
- package/node_modules/@sdd-agent-platform/core/dist/truth-reconciliation.js.map +1 -0
- 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 -49
- package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.js +1 -545
- 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 -7
- package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.js +15 -55
- 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.js +1 -40
- 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.d.ts +12 -2
- package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.js +247 -112
- 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-cache.d.ts +26 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/validation-cache.js +73 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/validation-cache.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.js +49 -72
- 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/workflow-gate/evidence-packet.js +2 -7
- 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 +0 -7
- 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 +2 -4
- 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 +3 -5
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.js +30 -4
- 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/migration-recovery.d.ts +40 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/migration-recovery.js +110 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/migration-recovery.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/repair-contract.d.ts +12 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/repair-contract.js +63 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/repair-contract.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve-task-run.d.ts +21 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve-task-run.js +95 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve-task-run.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.d.ts +55 -5
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.js +518 -36
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/runtime-projections.d.ts +228 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/runtime-projections.js +452 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/runtime-projections.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/package.json +6 -3
- package/node_modules/@sdd-agent-platform/core/src/ai-tools.test.ts +238 -137
- package/node_modules/@sdd-agent-platform/core/src/ai-tools.ts +84 -103
- package/node_modules/@sdd-agent-platform/core/src/artifacts/ingestion.test.ts +189 -189
- package/node_modules/@sdd-agent-platform/core/src/artifacts/ingestion.ts +222 -222
- 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 +302 -302
- 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 -231
- 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 -306
- package/node_modules/@sdd-agent-platform/core/src/config/init-project.ts +128 -120
- package/node_modules/@sdd-agent-platform/core/src/config/project-config.ts +265 -259
- 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 -445
- 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 +305 -317
- 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 -188
- package/node_modules/@sdd-agent-platform/core/src/context/evidence-summary.ts +144 -144
- 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 -115
- 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 -23
- 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 -124
- 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 +27 -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 -252
- 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 -128
- 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 +627 -657
- package/node_modules/@sdd-agent-platform/core/src/doctor/doctor.ts +301 -318
- 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 -80
- package/node_modules/@sdd-agent-platform/core/src/evidence-runtime/contracts.ts +48 -49
- 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 -187
- 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 -97
- 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 -225
- package/node_modules/@sdd-agent-platform/core/src/execution/resident-worker.test.ts +132 -132
- package/node_modules/@sdd-agent-platform/core/src/execution/resident-worker.ts +436 -436
- 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 -111
- 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 -57
- 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 -49
- package/node_modules/@sdd-agent-platform/core/src/instructions.ts +38 -81
- 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 -0
- package/node_modules/@sdd-agent-platform/core/src/lifecycle/ship.ts +255 -263
- 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 -342
- 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 -243
- 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 -426
- 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 -429
- 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 -266
- package/node_modules/@sdd-agent-platform/core/src/risk/workflow-gates.ts +203 -203
- 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 -388
- 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 -428
- 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 -191
- package/node_modules/@sdd-agent-platform/core/src/router/runtime-import.ts +464 -0
- 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 -0
- 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 -4
- package/node_modules/@sdd-agent-platform/core/src/run-state/artifacts.ts +126 -118
- 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 -230
- package/node_modules/@sdd-agent-platform/core/src/run-state/run-index.test.ts +52 -52
- package/node_modules/@sdd-agent-platform/core/src/run-state/run-index.ts +356 -356
- package/node_modules/@sdd-agent-platform/core/src/run-state/run-state.test.ts +70 -70
- package/node_modules/@sdd-agent-platform/core/src/run-state/run-state.ts +406 -406
- package/node_modules/@sdd-agent-platform/core/src/run-state/task-evidence.ts +198 -206
- package/node_modules/@sdd-agent-platform/core/src/run-state/timing.ts +146 -0
- package/node_modules/@sdd-agent-platform/core/src/run-state.ts +8 -8
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/build.ts +60 -63
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/findings.ts +257 -296
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/model.ts +140 -152
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis.test.ts +66 -68
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/runtime-paths.ts +253 -176
- package/node_modules/@sdd-agent-platform/core/src/runtime-projection-p0.test.ts +101 -0
- package/node_modules/@sdd-agent-platform/core/src/runtime-projection-p0.ts +314 -0
- 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 -207
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/run-binding.ts +95 -95
- 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 -401
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-parser.ts +738 -694
- 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 -0
- package/node_modules/@sdd-agent-platform/core/src/stage-collaboration-contracts.ts +316 -0
- package/node_modules/@sdd-agent-platform/core/src/stage-collaboration.test.ts +2964 -0
- package/node_modules/@sdd-agent-platform/core/src/stage-collaboration.ts +5856 -0
- 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 -352
- 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 -288
- package/node_modules/@sdd-agent-platform/core/src/status/project-status.ts +651 -625
- 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 -489
- package/node_modules/@sdd-agent-platform/core/src/storage/runtime-store.ts +1981 -1175
- 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 -70
- 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 -0
- package/node_modules/@sdd-agent-platform/core/src/truth-reconciliation.ts +174 -0
- package/node_modules/@sdd-agent-platform/core/src/verification/rendering.ts +137 -181
- package/node_modules/@sdd-agent-platform/core/src/verification/review-gate.test.ts +77 -77
- 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 -494
- package/node_modules/@sdd-agent-platform/core/src/verification/{goal-verify.test.ts → task-evidence-judgment.test.ts} +261 -335
- package/node_modules/@sdd-agent-platform/core/src/verification/{goal-verify.ts → task-evidence-judgment.ts} +619 -648
- package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.ts +1190 -1032
- package/node_modules/@sdd-agent-platform/core/src/verification/validation-cache.ts +106 -0
- package/node_modules/@sdd-agent-platform/core/src/verification/validation-wave.ts +513 -513
- package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.ts +334 -358
- 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 -196
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/hard-checks.test.ts +169 -171
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/hard-checks.ts +136 -143
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/policy.test.ts +135 -137
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/policy.ts +153 -155
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/types.ts +111 -114
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/affected-file-conflicts.ts +95 -95
- 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 -156
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/migration-recovery.ts +158 -0
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/repair-contract.ts +77 -0
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve-task-run.ts +114 -0
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve.test.ts +970 -464
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve.ts +967 -363
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/runtime-projections.ts +712 -0
- 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 +1 -1
- package/packages/cli/dist/args.js.map +1 -1
- 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 +126 -0
- package/packages/cli/dist/commands/execution.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 +70 -1
- package/packages/cli/dist/commands/registry/runtime.js.map +1 -1
- package/packages/cli/dist/commands/run.js +12 -1
- package/packages/cli/dist/commands/run.js.map +1 -1
- package/packages/cli/dist/commands/stage-close.d.ts +66 -0
- package/packages/cli/dist/commands/stage-close.js +524 -0
- package/packages/cli/dist/commands/stage-close.js.map +1 -0
- package/packages/cli/dist/commands/status.js +8 -1
- 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 -31
- package/packages/cli/dist/dispatch.js.map +1 -1
- package/packages/cli/dist/help.js +153 -158
- package/packages/cli/dist/help.js.map +1 -1
- package/packages/cli/dist/renderers/workflow.d.ts +51 -2
- package/packages/cli/dist/renderers/workflow.js.map +1 -1
- package/packages/cli/dist/skill-import-args.d.ts +10 -0
- package/packages/cli/dist/skill-import-args.js +47 -0
- package/packages/cli/dist/skill-import-args.js.map +1 -0
- package/packages/cli/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/cli/package.json +2 -2
- package/packages/core/dist/ai-tools.js +84 -103
- package/packages/core/dist/ai-tools.js.map +1 -1
- package/packages/core/dist/config/init-project.d.ts +10 -6
- package/packages/core/dist/config/init-project.js +7 -8
- package/packages/core/dist/config/init-project.js.map +1 -1
- package/packages/core/dist/config/project-config.d.ts +3 -1
- package/packages/core/dist/config/project-config.js +7 -3
- package/packages/core/dist/config/project-config.js.map +1 -1
- package/packages/core/dist/config/starter-documents.d.ts +0 -1
- package/packages/core/dist/config/starter-documents.js +374 -421
- 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 +7 -19
- package/packages/core/dist/context/build-package.js.map +1 -1
- package/packages/core/dist/contracts.d.ts +7 -1
- package/packages/core/dist/contracts.js +6 -0
- package/packages/core/dist/contracts.js.map +1 -1
- package/packages/core/dist/doctor/checks/document-chain.js +2 -12
- package/packages/core/dist/doctor/checks/document-chain.js.map +1 -1
- package/packages/core/dist/doctor/doctor.js +1 -18
- 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 +1 -1
- package/packages/core/dist/evidence/lookup.js.map +1 -1
- package/packages/core/dist/evidence-runtime/contracts.d.ts +0 -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/host-invocation.js +83 -83
- package/packages/core/dist/instructions.d.ts +1 -1
- package/packages/core/dist/instructions.js +37 -80
- package/packages/core/dist/instructions.js.map +1 -1
- package/packages/core/dist/lifecycle/ship.js +58 -68
- 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.js +21 -28
- package/packages/core/dist/orchestration/runtime.js.map +1 -1
- package/packages/core/dist/registries/agent-registry.js +124 -40
- package/packages/core/dist/registries/agent-registry.js.map +1 -1
- package/packages/core/dist/registries/command-team-runtime.d.ts +1 -1
- package/packages/core/dist/registries/command-team-runtime.js +6 -13
- package/packages/core/dist/registries/command-team-runtime.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/skill-capabilities.js +7 -7
- package/packages/core/dist/registries/skill-capabilities.js.map +1 -1
- package/packages/core/dist/registries/tool-capabilities.js +6 -6
- package/packages/core/dist/registries/tool-capabilities.js.map +1 -1
- package/packages/core/dist/registries/workflow-gates.d.ts +1 -1
- package/packages/core/dist/registries/workflow-gates.js +18 -18
- 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/contracts.d.ts +2 -2
- package/packages/core/dist/risk/kernel.js +7 -7
- package/packages/core/dist/risk/kernel.js.map +1 -1
- package/packages/core/dist/risk/legacy-adapters.js +12 -27
- package/packages/core/dist/risk/legacy-adapters.js.map +1 -1
- package/packages/core/dist/risk/workflow-gates.js +6 -6
- package/packages/core/dist/risk/workflow-gates.js.map +1 -1
- package/packages/core/dist/router/agent-runtime-config.js +1 -1
- package/packages/core/dist/router/agent-runtime-config.js.map +1 -1
- package/packages/core/dist/router/routing.js +2 -4
- package/packages/core/dist/router/routing.js.map +1 -1
- package/packages/core/dist/router/runtime-import.d.ts +28 -0
- package/packages/core/dist/router/runtime-import.js +383 -0
- package/packages/core/dist/router/runtime-import.js.map +1 -0
- package/packages/core/dist/router/stage-route-binding.d.ts +37 -0
- package/packages/core/dist/router/stage-route-binding.js +227 -0
- package/packages/core/dist/router/stage-route-binding.js.map +1 -0
- package/packages/core/dist/router.d.ts +1 -0
- package/packages/core/dist/router.js +1 -0
- package/packages/core/dist/router.js.map +1 -1
- package/packages/core/dist/run-state/artifacts.d.ts +16 -0
- package/packages/core/dist/run-state/artifacts.js +6 -0
- package/packages/core/dist/run-state/artifacts.js.map +1 -1
- package/packages/core/dist/run-state/model.d.ts +20 -0
- package/packages/core/dist/run-state/run-state.js +7 -7
- package/packages/core/dist/run-state/run-state.js.map +1 -1
- package/packages/core/dist/run-state/task-evidence.d.ts +1 -2
- package/packages/core/dist/run-state/task-evidence.js +2 -9
- package/packages/core/dist/run-state/task-evidence.js.map +1 -1
- package/packages/core/dist/run-state/timing.d.ts +8 -0
- package/packages/core/dist/run-state/timing.js +131 -0
- package/packages/core/dist/run-state/timing.js.map +1 -0
- package/packages/core/dist/runtime-analysis/build.js +1 -4
- package/packages/core/dist/runtime-analysis/build.js.map +1 -1
- package/packages/core/dist/runtime-analysis/findings.js +0 -39
- package/packages/core/dist/runtime-analysis/findings.js.map +1 -1
- package/packages/core/dist/runtime-analysis/model.d.ts +1 -17
- package/packages/core/dist/runtime-paths.d.ts +10 -0
- package/packages/core/dist/runtime-paths.js +65 -0
- package/packages/core/dist/runtime-paths.js.map +1 -1
- package/packages/core/dist/runtime-projection-p0.d.ts +64 -0
- package/packages/core/dist/runtime-projection-p0.js +211 -0
- package/packages/core/dist/runtime-projection-p0.js.map +1 -0
- 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/task-parser.d.ts +5 -1
- package/packages/core/dist/sdd-docs/task-parser.js +60 -22
- 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 +55 -0
- package/packages/core/dist/stage-artifacts.js +315 -0
- package/packages/core/dist/stage-artifacts.js.map +1 -0
- package/packages/core/dist/stage-collaboration-contracts.d.ts +55 -0
- package/packages/core/dist/stage-collaboration-contracts.js +238 -0
- package/packages/core/dist/stage-collaboration-contracts.js.map +1 -0
- package/packages/core/dist/stage-collaboration.d.ts +736 -0
- package/packages/core/dist/stage-collaboration.js +4018 -0
- package/packages/core/dist/stage-collaboration.js.map +1 -0
- package/packages/core/dist/stage-runtime/runtime.js +8 -1
- package/packages/core/dist/stage-runtime/runtime.js.map +1 -1
- package/packages/core/dist/status/project-status.js +25 -1
- package/packages/core/dist/status/project-status.js.map +1 -1
- package/packages/core/dist/storage/runtime-store.d.ts +170 -18
- package/packages/core/dist/storage/runtime-store.js +597 -85
- package/packages/core/dist/storage/runtime-store.js.map +1 -1
- package/packages/core/dist/sync-back/apply.d.ts +1 -17
- package/packages/core/dist/sync-back/apply.js +1 -242
- package/packages/core/dist/sync-back/apply.js.map +1 -1
- package/packages/core/dist/sync-back/inspect.d.ts +1 -110
- package/packages/core/dist/sync-back/inspect.js +1 -496
- package/packages/core/dist/sync-back/inspect.js.map +1 -1
- package/packages/core/dist/sync-back.d.ts +1 -2
- package/packages/core/dist/sync-back.js +1 -2
- package/packages/core/dist/sync-back.js.map +1 -1
- 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 +31 -0
- package/packages/core/dist/test-support/run-state.js.map +1 -1
- package/packages/core/dist/truth-reconciliation.d.ts +44 -0
- package/packages/core/dist/truth-reconciliation.js +135 -0
- package/packages/core/dist/truth-reconciliation.js.map +1 -0
- package/packages/core/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/core/dist/verification/goal-verify.d.ts +0 -49
- package/packages/core/dist/verification/goal-verify.js +1 -545
- package/packages/core/dist/verification/goal-verify.js.map +1 -1
- package/packages/core/dist/verification/rendering.d.ts +5 -7
- package/packages/core/dist/verification/rendering.js +15 -55
- package/packages/core/dist/verification/rendering.js.map +1 -1
- package/packages/core/dist/verification/single-task-loop.js +1 -40
- 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.d.ts +12 -2
- package/packages/core/dist/verification/test-runtime.js +247 -112
- package/packages/core/dist/verification/test-runtime.js.map +1 -1
- package/packages/core/dist/verification/validation-cache.d.ts +26 -0
- package/packages/core/dist/verification/validation-cache.js +73 -0
- package/packages/core/dist/verification/validation-cache.js.map +1 -0
- package/packages/core/dist/verification/verify-contract.d.ts +1 -1
- package/packages/core/dist/verification/verify-contract.js +49 -72
- 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/workflow-gate/evidence-packet.js +2 -7
- package/packages/core/dist/workflow-gate/evidence-packet.js.map +1 -1
- package/packages/core/dist/workflow-gate/hard-checks.js +0 -7
- package/packages/core/dist/workflow-gate/hard-checks.js.map +1 -1
- package/packages/core/dist/workflow-gate/policy.js +2 -4
- package/packages/core/dist/workflow-gate/policy.js.map +1 -1
- package/packages/core/dist/workflow-gate/types.d.ts +3 -5
- package/packages/core/dist/workflow-state/latest-eligible-run.js +30 -4
- package/packages/core/dist/workflow-state/latest-eligible-run.js.map +1 -1
- package/packages/core/dist/workflow-state/migration-recovery.d.ts +40 -0
- package/packages/core/dist/workflow-state/migration-recovery.js +110 -0
- package/packages/core/dist/workflow-state/migration-recovery.js.map +1 -0
- package/packages/core/dist/workflow-state/repair-contract.d.ts +12 -0
- package/packages/core/dist/workflow-state/repair-contract.js +63 -0
- package/packages/core/dist/workflow-state/repair-contract.js.map +1 -0
- package/packages/core/dist/workflow-state/resolve-task-run.d.ts +21 -0
- package/packages/core/dist/workflow-state/resolve-task-run.js +95 -0
- package/packages/core/dist/workflow-state/resolve-task-run.js.map +1 -0
- package/packages/core/dist/workflow-state/resolve.d.ts +55 -5
- package/packages/core/dist/workflow-state/resolve.js +518 -36
- package/packages/core/dist/workflow-state/resolve.js.map +1 -1
- package/packages/core/dist/workflow-state/runtime-projections.d.ts +228 -0
- package/packages/core/dist/workflow-state/runtime-projections.js +452 -0
- package/packages/core/dist/workflow-state/runtime-projections.js.map +1 -0
- package/packages/core/package.json +6 -3
- package/tsconfig.build.json +6 -7
- package/node_modules/@sdd-agent-platform/core/dist/doctor/render.d.ts +0 -2
- package/node_modules/@sdd-agent-platform/core/dist/doctor/render.js +0 -44
- package/node_modules/@sdd-agent-platform/core/dist/doctor/render.js.map +0 -1
- package/node_modules/@sdd-agent-platform/core/src/sync-back/apply.ts +0 -270
- package/node_modules/@sdd-agent-platform/core/src/sync-back/inspect.ts +0 -655
- package/node_modules/@sdd-agent-platform/core/src/sync-back/sync-back.test.ts +0 -569
- package/node_modules/@sdd-agent-platform/core/src/sync-back.ts +0 -2
- package/node_modules/@sdd-agent-platform/core/src/verification/single-task-loop.test.ts +0 -255
- package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.test.ts +0 -439
- package/node_modules/@sdd-agent-platform/core/src/verification/validation-wave.test.ts +0 -341
- package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.test.ts +0 -204
- package/packages/cli/dist/commands/lifecycle.d.ts +0 -6
- package/packages/cli/dist/commands/lifecycle.js +0 -112
- package/packages/cli/dist/commands/lifecycle.js.map +0 -1
- package/packages/cli/dist/commands/sync-back.d.ts +0 -6
- package/packages/cli/dist/commands/sync-back.js +0 -82
- package/packages/cli/dist/commands/sync-back.js.map +0 -1
- package/packages/cli/dist/commands/test.d.ts +0 -6
- package/packages/cli/dist/commands/test.js +0 -195
- package/packages/cli/dist/commands/test.js.map +0 -1
- package/packages/cli/dist/commands/verifies.d.ts +0 -6
- package/packages/cli/dist/commands/verifies.js +0 -85
- 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 -134
- package/packages/cli/dist/commands/verify.js.map +0 -1
- package/packages/core/dist/doctor/render.d.ts +0 -2
- package/packages/core/dist/doctor/render.js +0 -44
- package/packages/core/dist/doctor/render.js.map +0 -1
|
@@ -1,1032 +1,1190 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto';
|
|
2
|
-
import { spawn } from 'node:child_process';
|
|
3
|
-
import { appendEvent } from '../run-state/events.js';
|
|
4
|
-
import { appendInvocationLedgerEntry } from '../run-state/invocation-ledger.js';
|
|
5
|
-
import type { RunState, RunStateTaskRuntime } from '../run-state/model.js';
|
|
6
|
-
import { createRun, readRunState, writeRunState } from '../run-state/run-state.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import
|
|
25
|
-
import {
|
|
26
|
-
import
|
|
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
|
-
const
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
const
|
|
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
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
const
|
|
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
|
-
const
|
|
247
|
-
const
|
|
248
|
-
await
|
|
249
|
-
const
|
|
250
|
-
const
|
|
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
|
-
status,
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
taskId: options.taskId,
|
|
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
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
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
|
-
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
const
|
|
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
|
-
const
|
|
489
|
-
const
|
|
490
|
-
const
|
|
491
|
-
const
|
|
492
|
-
const
|
|
493
|
-
const
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
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
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
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
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
const
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
if (validationStatus
|
|
836
|
-
return
|
|
837
|
-
}
|
|
838
|
-
return
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
function
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
if (
|
|
937
|
-
return
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
return
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
function
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
return
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
function
|
|
1031
|
-
|
|
1032
|
-
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { appendEvent } from '../run-state/events.js';
|
|
4
|
+
import { appendArtifactHashLedgerEntry, appendInvocationLedgerEntry } from '../run-state/invocation-ledger.js';
|
|
5
|
+
import type { RunState, RunStateTaskRuntime } from '../run-state/model.js';
|
|
6
|
+
import { createRun, readAllRunStates, readRunState, writeRunState } from '../run-state/run-state.js';
|
|
7
|
+
import { recordRuntimeOnlyArtifact, recordStageEvidenceArtifact } from '../run-state/artifacts.js';
|
|
8
|
+
import { toBranchStageEvidenceRef } from '../runtime-paths.js';
|
|
9
|
+
import { resolveSddContext } from '../sdd-docs/context.js';
|
|
10
|
+
import { bindRunStateToTask } from '../sdd-docs/run-binding.js';
|
|
11
|
+
import { parseSddBranch, type SddTask, type SddTaskModel } from '../sdd-docs/task-parser.js';
|
|
12
|
+
import { inspectSddTask } from '../sdd-docs/task-inspection.js';
|
|
13
|
+
import { listRuntimeArtifactPayloads, readRuntimeValidationCacheEntry, recordRuntimeAcceptanceEvidenceMap, recordRuntimeDurableGap, recordRuntimeProjection, recordRuntimeTestRun, recordRuntimeTestStep, recordRuntimeValidationCacheEntry, recordRuntimeValidationCacheUse, recordRuntimeValidationEnvironmentSession, recordRuntimeValidationWaveRun, runtimeScopedId, updateRuntimeDurableGapStatus, type RuntimeValidationCacheEntryRecord } from '../storage/runtime-store.js';
|
|
14
|
+
import { ACCEPTANCE_POLICY_RULESET_VERSION, SDD_EVIDENCE_CONTRACT, SDD_EVIDENCE_VERSION, SDD_RESULT_CONTRACT, SDD_RESULT_VERSION, TEST_EVIDENCE_RUN_CONTRACT_VERSION, WORKFLOW_HANDOFF_CONTRACT_VERSION } from '../contracts.js';
|
|
15
|
+
import type { LifecycleRiskDecision } from '../risk/contracts.js';
|
|
16
|
+
import { inspectVerifyContract, type VerifyContractInspection } from './verify-contract.js';
|
|
17
|
+
import type { AcceptanceEvidenceCoverage, CapabilityEvidenceClassification, EvidenceCoverageStatus, TestEvidenceStatus, UnifiedTestEvidenceRun } from '../evidence-runtime.js';
|
|
18
|
+
import { ensureTaskOrchestration, inspectOrchestrationGate } from '../orchestration/runtime.js';
|
|
19
|
+
import { recordStageRunProjection, recordWorkflowHandoffProjection, validateWorkflowHandoff } from '../stage-runtime/runtime.js';
|
|
20
|
+
import type { StageRun, WorkflowHandoff } from '../stage-runtime/contracts.js';
|
|
21
|
+
import { evaluateTaskWorkflowGate, verifyContractBlockedGate, type ApprovalPolicy, type LifecycleRiskProfile, type LifecycleWorkflowGate } from '../risk.js';
|
|
22
|
+
import { validateSddResultArtifact } from '../artifacts/sdd-result.js';
|
|
23
|
+
import { dependencyBlockingReasonsForTask } from '../workflow-state/dependencies.js';
|
|
24
|
+
import { selectLatestEligibleRunsByTask } from '../workflow-state/latest-eligible-run.js';
|
|
25
|
+
import { latestRuntimeTaskStates } from '../workflow-state/resolve.js';
|
|
26
|
+
import { routeSddTask } from '../router/route-sdd-task.js';
|
|
27
|
+
import type { AgentCapabilityRouteDecision } from '../router/agent-runtime.js';
|
|
28
|
+
import { evaluateAndRecordWorkflowGateDecision } from '../workflow-gate/evidence-packet.js';
|
|
29
|
+
import type { WorkflowGateDecision, WorkflowGateStatus } from '../workflow-gate/types.js';
|
|
30
|
+
import { buildValidationCachePlan, type ValidationCacheUnsafeReason } from './validation-cache.js';
|
|
31
|
+
|
|
32
|
+
const DEFAULT_TEST_TIMEOUT_MS = 120_000;
|
|
33
|
+
const MAX_CAPTURE_BYTES = 256 * 1024;
|
|
34
|
+
|
|
35
|
+
export type SddTestStatus = 'PASS' | 'FAIL' | 'BLOCKED';
|
|
36
|
+
export type SddTestStepStatus = 'pass' | 'fail' | 'blocked';
|
|
37
|
+
|
|
38
|
+
export interface SddTestCommandInput {
|
|
39
|
+
command?: string;
|
|
40
|
+
argv?: string[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface SddTestCommandStep {
|
|
44
|
+
stepId: string;
|
|
45
|
+
command: string;
|
|
46
|
+
argv: string[] | null;
|
|
47
|
+
shell: boolean;
|
|
48
|
+
acceptanceRefs: string[];
|
|
49
|
+
status: SddTestStepStatus;
|
|
50
|
+
exitCode: number | null;
|
|
51
|
+
signal: string | null;
|
|
52
|
+
durationMs: number;
|
|
53
|
+
outputArtifact: string | null;
|
|
54
|
+
stdoutBytes: number;
|
|
55
|
+
stderrBytes: number;
|
|
56
|
+
truncated: boolean;
|
|
57
|
+
startedAt: string;
|
|
58
|
+
endedAt: string;
|
|
59
|
+
cwd: string;
|
|
60
|
+
stdoutDigest: string;
|
|
61
|
+
stderrDigest: string;
|
|
62
|
+
outputSummary: string;
|
|
63
|
+
cacheStatus: 'hit' | 'miss' | 'unsafe';
|
|
64
|
+
cacheKey: string | null;
|
|
65
|
+
cacheSourceTestRunId: string | null;
|
|
66
|
+
cacheUnsafeReasons: ValidationCacheUnsafeReason[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface NormalizedSddTestCommand {
|
|
70
|
+
command: string;
|
|
71
|
+
argv: string[] | null;
|
|
72
|
+
shell: boolean;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type VerifyContractAction = 'none' | 'created' | 'refreshed' | 'blocked';
|
|
76
|
+
|
|
77
|
+
type RuntimeTestJudgment = WorkflowGateStatus;
|
|
78
|
+
|
|
79
|
+
export interface SddTestResult {
|
|
80
|
+
contract: 'sdd-test-runtime-v1';
|
|
81
|
+
runId: string;
|
|
82
|
+
testRunId: string;
|
|
83
|
+
validationWaveRunId: string;
|
|
84
|
+
validationEnvironmentSessionId: string;
|
|
85
|
+
branch: string;
|
|
86
|
+
taskId: string;
|
|
87
|
+
status: SddTestStatus;
|
|
88
|
+
validationStatus: SddTestStatus;
|
|
89
|
+
workflowGateStatus: WorkflowGateStatus;
|
|
90
|
+
runtimeJudgment: RuntimeTestJudgment;
|
|
91
|
+
workflowGateDecision: WorkflowGateDecision;
|
|
92
|
+
verifyContractStatus: string;
|
|
93
|
+
verifyContractAction: VerifyContractAction;
|
|
94
|
+
lifecycleGate: LifecycleWorkflowGate;
|
|
95
|
+
lifecycleProfile: LifecycleRiskProfile | null;
|
|
96
|
+
approvalPolicy: ApprovalPolicy | null;
|
|
97
|
+
requiredStages: string[];
|
|
98
|
+
primaryReason: string;
|
|
99
|
+
commandStatus: TestEvidenceStatus;
|
|
100
|
+
evidenceCoverage: EvidenceCoverageStatus;
|
|
101
|
+
policyJudgment: TestEvidenceStatus;
|
|
102
|
+
acceptanceCoverage: AcceptanceEvidenceCoverage[];
|
|
103
|
+
capabilityEvidence: CapabilityEvidenceClassification[];
|
|
104
|
+
commands: string[];
|
|
105
|
+
steps: SddTestCommandStep[];
|
|
106
|
+
validationArtifact: string | null;
|
|
107
|
+
indexArtifact: string | null;
|
|
108
|
+
gaps: string[];
|
|
109
|
+
next: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface RunSddTestOptions {
|
|
113
|
+
taskId: string;
|
|
114
|
+
branch?: string | null;
|
|
115
|
+
runId?: string | null;
|
|
116
|
+
commands?: string[];
|
|
117
|
+
commandInputs?: SddTestCommandInput[];
|
|
118
|
+
timeoutMs?: number;
|
|
119
|
+
approved?: boolean;
|
|
120
|
+
validationWave?: { waveRunId: string; environmentSessionId: string; taskIds: string[]; acceptanceRefsByTask?: Record<string, string[]> };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export async function runSddTest(projectRoot: string, options: RunSddTestOptions): Promise<SddTestResult> {
|
|
124
|
+
const context = await resolveSddContext(projectRoot, { branch: options.branch ?? undefined, branchSource: options.branch ? 'cli_option' : undefined });
|
|
125
|
+
const model = await parseSddBranch(projectRoot, context.partition);
|
|
126
|
+
const inspected = inspectSddTask(model, options.taskId);
|
|
127
|
+
const task = inspected.task;
|
|
128
|
+
const verifyContract = await ensureVerifyContractForTest(projectRoot, context.partition);
|
|
129
|
+
const verifyInspection = verifyContract.inspection;
|
|
130
|
+
const initialState = options.runId ? await readRunState(projectRoot, options.runId) : await createRun(projectRoot);
|
|
131
|
+
const state = await bindRunStateToTask(projectRoot, initialState, context, model, task, options.taskId);
|
|
132
|
+
const testRunId = runtimeScopedId(state.runId, options.taskId, new Date().toISOString(), 'sdd-test');
|
|
133
|
+
const commandInputs = normalizeTestCommandInputs(options.commandInputs, options.commands, task?.validation ?? []);
|
|
134
|
+
const commands = commandInputs.map((input) => input.command);
|
|
135
|
+
const gaps: string[] = [];
|
|
136
|
+
const startedAt = new Date().toISOString();
|
|
137
|
+
const ownsValidationWave = !options.validationWave;
|
|
138
|
+
const validationWaveRunId = options.validationWave?.waveRunId ?? runtimeScopedId(context.partition, options.taskId, state.runId, testRunId, 'validation-wave');
|
|
139
|
+
const validationEnvironmentSessionId = options.validationWave?.environmentSessionId ?? runtimeScopedId(context.partition, validationWaveRunId, 'validation-env');
|
|
140
|
+
const validationWaveTaskIds = options.validationWave?.taskIds ?? [options.taskId];
|
|
141
|
+
const validationWaveAcceptanceRefs = options.validationWave?.acceptanceRefsByTask?.[options.taskId];
|
|
142
|
+
const validationWaveScopeAcceptanceRefs = [...new Set(Object.values(options.validationWave?.acceptanceRefsByTask ?? { [options.taskId]: task?.acceptanceRefs ?? [] }).flat())].sort();
|
|
143
|
+
if (ownsValidationWave) {
|
|
144
|
+
await recordRuntimeValidationEnvironmentSession(projectRoot, {
|
|
145
|
+
sessionId: validationEnvironmentSessionId,
|
|
146
|
+
partition: context.partition,
|
|
147
|
+
runId: state.runId,
|
|
148
|
+
waveRunId: validationWaveRunId,
|
|
149
|
+
status: 'active',
|
|
150
|
+
reuseKey: `${context.partition}:${options.taskId}`,
|
|
151
|
+
createdAt: startedAt,
|
|
152
|
+
updatedAt: startedAt,
|
|
153
|
+
payload: { contract: 'phase-8.17-validation-wave-runtime-v1', mode: 'single-task' }
|
|
154
|
+
});
|
|
155
|
+
await recordRuntimeValidationWaveRun(projectRoot, {
|
|
156
|
+
waveRunId: validationWaveRunId,
|
|
157
|
+
partition: context.partition,
|
|
158
|
+
runId: state.runId,
|
|
159
|
+
taskIds: validationWaveTaskIds,
|
|
160
|
+
status: 'RUNNING',
|
|
161
|
+
environmentSessionId: validationEnvironmentSessionId,
|
|
162
|
+
startedAt,
|
|
163
|
+
completedAt: startedAt,
|
|
164
|
+
payload: { contract: 'phase-8.17-validation-wave-runtime-v1', mode: 'single-task', taskId: options.taskId }
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
await appendEvent(projectRoot, state.runId, {
|
|
169
|
+
event: 'test_runtime_started',
|
|
170
|
+
runId: state.runId,
|
|
171
|
+
summary: `SDD test runtime started for ${options.taskId}`,
|
|
172
|
+
data: { taskId: options.taskId, branch: context.partition, testRunId, commands }
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
const states = await readAllRunStates(projectRoot);
|
|
176
|
+
const latestEligibleRunsByTask = selectLatestEligibleRunsByTask({ states, model, partition: context.partition, currentGitBranch: context.currentGitBranch });
|
|
177
|
+
const runtimeByTask = latestRuntimeTaskStates(latestEligibleRunsByTask, states);
|
|
178
|
+
|
|
179
|
+
if (!task) {
|
|
180
|
+
gaps.push(`Task ${options.taskId} was not found in specs/${context.partition}/tasks.md.`);
|
|
181
|
+
}
|
|
182
|
+
if (task) {
|
|
183
|
+
gaps.push(...inspected.gaps.filter((gap) => gap.severity === 'blocking').map((gap) => `${gap.field}: ${gap.message}`));
|
|
184
|
+
gaps.push(...dependencyBlockingReasonsForTask(model, options.taskId, { runtimeByTask }));
|
|
185
|
+
}
|
|
186
|
+
if (verifyContract.action === 'blocked') {
|
|
187
|
+
gaps.push(verifyContractBlocker(verifyInspection));
|
|
188
|
+
}
|
|
189
|
+
if (commands.length === 0) {
|
|
190
|
+
gaps.push(`Task ${options.taskId} has no validation commands.`);
|
|
191
|
+
}
|
|
192
|
+
const orchestration = await ensureTaskOrchestration(projectRoot, model, task, {
|
|
193
|
+
branch: context.partition,
|
|
194
|
+
runId: state.runId,
|
|
195
|
+
taskId: options.taskId,
|
|
196
|
+
agent: 'validator',
|
|
197
|
+
stage: 'execute',
|
|
198
|
+
status: 'active'
|
|
199
|
+
});
|
|
200
|
+
const orchestrationGate = await inspectOrchestrationGate(projectRoot, {
|
|
201
|
+
branch: context.partition,
|
|
202
|
+
runId: state.runId,
|
|
203
|
+
taskId: options.taskId,
|
|
204
|
+
target: 'execution',
|
|
205
|
+
riskDecision: orchestration.riskDecision,
|
|
206
|
+
stageRun: orchestration.stageRun,
|
|
207
|
+
contextLoadSignal: orchestration.contextLoadSignal,
|
|
208
|
+
contextOffloadDecision: orchestration.contextOffloadDecision
|
|
209
|
+
});
|
|
210
|
+
const reviewerCheckpointSatisfied = await hasReviewerCheckpoint(projectRoot, state, options.taskId);
|
|
211
|
+
const workflowGate = verifyContract.action === 'blocked'
|
|
212
|
+
? verifyContractBlockedGate(options.taskId)
|
|
213
|
+
: evaluateTaskWorkflowGate({ task, taskId: options.taskId, riskDecision: orchestration.riskDecision, approved: options.approved, reviewerCheckpointSatisfied });
|
|
214
|
+
if (workflowGate.blocksTest) {
|
|
215
|
+
gaps.push(workflowGate.primaryReason);
|
|
216
|
+
}
|
|
217
|
+
gaps.push(...orchestrationGate.blockingReasons);
|
|
218
|
+
|
|
219
|
+
await recordRuntimeTestRun(projectRoot, {
|
|
220
|
+
testRunId,
|
|
221
|
+
runId: state.runId,
|
|
222
|
+
partition: context.partition,
|
|
223
|
+
taskId: options.taskId,
|
|
224
|
+
status: 'RUNNING',
|
|
225
|
+
startedAt,
|
|
226
|
+
completedAt: startedAt,
|
|
227
|
+
payload: { verifyContractStatus: verifyInspection.status, verifyContractAction: verifyContract.action, lifecycleGate: workflowGate.lifecycleGate, lifecycleProfile: workflowGate.lifecycleProfile, approvalPolicy: workflowGate.approvalPolicy, requiredStages: workflowGate.requiredStages, primaryReason: workflowGate.primaryReason, commands, commandInputs, evidence: [], gaps }
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
const steps: SddTestCommandStep[] = [];
|
|
231
|
+
if (gaps.length === 0) {
|
|
232
|
+
for (const [index, commandInput] of commandInputs.entries()) {
|
|
233
|
+
const step = await runCommandStep(projectRoot, state.runId, context.partition, options.taskId, testRunId, index + 1, commandInput, acceptanceRefsForCommand(task, commandInput.command, validationWaveAcceptanceRefs), options.timeoutMs ?? DEFAULT_TEST_TIMEOUT_MS, model, task!, validationWaveTaskIds, validationWaveScopeAcceptanceRefs);
|
|
234
|
+
steps.push(step);
|
|
235
|
+
await appendEvent(projectRoot, state.runId, {
|
|
236
|
+
event: 'test_step_completed',
|
|
237
|
+
runId: state.runId,
|
|
238
|
+
summary: `SDD test step ${step.status}: ${step.command}`,
|
|
239
|
+
data: { taskId: options.taskId, testRunId, step }
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const commandStatus = deriveCommandStatus(gaps, steps);
|
|
245
|
+
const acceptanceCoverage = buildAcceptanceCoverage(task, steps, commandStatus, validationWaveAcceptanceRefs);
|
|
246
|
+
const evidenceCoverage = summarizeEvidenceCoverage(acceptanceCoverage);
|
|
247
|
+
const policyJudgment = derivePolicyJudgment(commandStatus, evidenceCoverage);
|
|
248
|
+
await recordAcceptanceEvidenceMaps(projectRoot, validationWaveRunId, testRunId, context.partition, state.runId, options.taskId, acceptanceCoverage);
|
|
249
|
+
const validationStatus = policyJudgment;
|
|
250
|
+
const capabilityRoute = task ? await routeSddTask(projectRoot, { taskId: options.taskId, branch: context.partition, approved: options.approved }) : null;
|
|
251
|
+
const capabilityEvidence = buildCapabilityEvidenceClassification(capabilityRoute?.capabilityDecision ?? null, steps);
|
|
252
|
+
const validationArtifact = task ? await writeValidationArtifact(projectRoot, state.runId, context.partition, task, validationStatus, steps, gaps, capabilityEvidence) : null;
|
|
253
|
+
const evidenceBeforeGate = runtimeEvidenceRefs(validationArtifact?.runRelativePath ?? null, steps);
|
|
254
|
+
await persistTestRunState(projectRoot, state, options.taskId, validationStatus, commands, evidenceBeforeGate, validationArtifact?.runRelativePath ?? null);
|
|
255
|
+
await resolveTestRuntimeDurableGap(projectRoot, context.partition, state.runId, options.taskId, validationStatus, gaps);
|
|
256
|
+
|
|
257
|
+
const gateDecision = (await evaluateAndRecordWorkflowGateDecision(projectRoot, {
|
|
258
|
+
branch: context.partition,
|
|
259
|
+
taskId: options.taskId,
|
|
260
|
+
runId: state.runId,
|
|
261
|
+
decisionKind: 'test'
|
|
262
|
+
})).decision;
|
|
263
|
+
const runtimeJudgment = gateDecision.status;
|
|
264
|
+
const status = finalStatusForTest(validationStatus, runtimeJudgment);
|
|
265
|
+
await recordTestRuntimeDurableGap(projectRoot, context.partition, state.runId, options.taskId, status, validationStatus, runtimeJudgment, gaps, evidenceBeforeGate);
|
|
266
|
+
const unifiedEvidence = buildUnifiedTestEvidenceRun(testRunId, context.partition, state.runId, options.taskId, commandStatus, evidenceCoverage, policyJudgment, status, runtimeJudgment, steps, acceptanceCoverage, capabilityEvidence, gaps, workflowGate.nextAction, gateDecision);
|
|
267
|
+
const completedAt = new Date().toISOString();
|
|
268
|
+
const evidence = runtimeEvidenceRefs(validationArtifact?.runRelativePath ?? null, steps);
|
|
269
|
+
|
|
270
|
+
await recordRuntimeTestRun(projectRoot, {
|
|
271
|
+
testRunId,
|
|
272
|
+
runId: state.runId,
|
|
273
|
+
partition: context.partition,
|
|
274
|
+
taskId: options.taskId,
|
|
275
|
+
status,
|
|
276
|
+
startedAt,
|
|
277
|
+
completedAt,
|
|
278
|
+
payload: { verifyContractStatus: verifyInspection.status, verifyContractAction: verifyContract.action, lifecycleGate: workflowGate.lifecycleGate, lifecycleProfile: workflowGate.lifecycleProfile, approvalPolicy: workflowGate.approvalPolicy, requiredStages: workflowGate.requiredStages, primaryReason: workflowGate.primaryReason, commandStatus, evidenceCoverage, policyJudgment, validationStatus, workflowGateStatus: gateDecision.status, runtimeJudgment, workflowGateDecision: gateDecision, acceptanceCoverage, capabilityEvidence, commands, commandInputs, evidence, gaps }
|
|
279
|
+
});
|
|
280
|
+
await recordRuntimeProjection(projectRoot, 'test_runtime', `${context.partition}:${options.taskId}:${state.runId}`, {
|
|
281
|
+
contract: 'sdd-test-runtime-v1',
|
|
282
|
+
testRunId,
|
|
283
|
+
runId: state.runId,
|
|
284
|
+
taskId: options.taskId,
|
|
285
|
+
status,
|
|
286
|
+
validationStatus,
|
|
287
|
+
workflowGateStatus: gateDecision.status,
|
|
288
|
+
runtimeJudgment,
|
|
289
|
+
lifecycleGate: workflowGate.lifecycleGate,
|
|
290
|
+
primaryReason: workflowGate.primaryReason,
|
|
291
|
+
evidence,
|
|
292
|
+
gaps
|
|
293
|
+
});
|
|
294
|
+
await recordRuntimeProjection(projectRoot, 'test_evidence_run', `${context.partition}:${options.taskId}:${state.runId}`, unifiedEvidence);
|
|
295
|
+
await recordTestWorkflowProjection(projectRoot, {
|
|
296
|
+
taskId: options.taskId,
|
|
297
|
+
stageRun: orchestration.stageRun,
|
|
298
|
+
status,
|
|
299
|
+
completedAt,
|
|
300
|
+
evidence,
|
|
301
|
+
gaps,
|
|
302
|
+
riskDecision: orchestration.riskDecision
|
|
303
|
+
});
|
|
304
|
+
await persistTestGateOutcome(projectRoot, state.runId, options.taskId, status, validationStatus, commands, evidence, validationArtifact?.runRelativePath ?? null, gateDecision);
|
|
305
|
+
if (ownsValidationWave) {
|
|
306
|
+
await recordRuntimeValidationWaveRun(projectRoot, {
|
|
307
|
+
waveRunId: validationWaveRunId,
|
|
308
|
+
partition: context.partition,
|
|
309
|
+
runId: state.runId,
|
|
310
|
+
taskIds: validationWaveTaskIds,
|
|
311
|
+
status,
|
|
312
|
+
environmentSessionId: validationEnvironmentSessionId,
|
|
313
|
+
startedAt,
|
|
314
|
+
completedAt,
|
|
315
|
+
payload: { contract: 'phase-8.17-validation-wave-runtime-v1', mode: 'single-task', taskId: options.taskId, testRunId, evidence, gaps, workflowGateDecision: gateDecision }
|
|
316
|
+
});
|
|
317
|
+
await recordRuntimeValidationEnvironmentSession(projectRoot, {
|
|
318
|
+
sessionId: validationEnvironmentSessionId,
|
|
319
|
+
partition: context.partition,
|
|
320
|
+
runId: state.runId,
|
|
321
|
+
waveRunId: validationWaveRunId,
|
|
322
|
+
status: status === 'PASS' ? 'completed' : status === 'FAIL' ? 'failed' : 'blocked',
|
|
323
|
+
reuseKey: `${context.partition}:${options.taskId}`,
|
|
324
|
+
createdAt: startedAt,
|
|
325
|
+
updatedAt: completedAt,
|
|
326
|
+
payload: { contract: 'phase-8.17-validation-wave-runtime-v1', mode: 'single-task', taskId: options.taskId, validationStatus, workflowGateStatus: gateDecision.status, status }
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
await appendEvent(projectRoot, state.runId, {
|
|
331
|
+
event: status === 'PASS' ? 'test_runtime_passed' : 'test_runtime_blocked',
|
|
332
|
+
runId: state.runId,
|
|
333
|
+
summary: `SDD test runtime ${status} for ${options.taskId}`,
|
|
334
|
+
data: { taskId: options.taskId, testRunId, status, validationStatus, evidence, gaps, gateDecisionId: gateDecision.decisionId, gateStatus: gateDecision.status }
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
return {
|
|
338
|
+
contract: 'sdd-test-runtime-v1',
|
|
339
|
+
runId: state.runId,
|
|
340
|
+
testRunId,
|
|
341
|
+
validationWaveRunId,
|
|
342
|
+
validationEnvironmentSessionId,
|
|
343
|
+
branch: context.partition,
|
|
344
|
+
taskId: options.taskId,
|
|
345
|
+
status,
|
|
346
|
+
validationStatus,
|
|
347
|
+
workflowGateStatus: gateDecision.status,
|
|
348
|
+
runtimeJudgment,
|
|
349
|
+
workflowGateDecision: gateDecision,
|
|
350
|
+
verifyContractStatus: verifyInspection.status,
|
|
351
|
+
verifyContractAction: verifyContract.action,
|
|
352
|
+
lifecycleGate: workflowGate.lifecycleGate,
|
|
353
|
+
lifecycleProfile: workflowGate.lifecycleProfile,
|
|
354
|
+
approvalPolicy: workflowGate.approvalPolicy,
|
|
355
|
+
requiredStages: workflowGate.requiredStages,
|
|
356
|
+
primaryReason: workflowGate.primaryReason,
|
|
357
|
+
commandStatus,
|
|
358
|
+
evidenceCoverage,
|
|
359
|
+
policyJudgment,
|
|
360
|
+
acceptanceCoverage,
|
|
361
|
+
capabilityEvidence,
|
|
362
|
+
commands,
|
|
363
|
+
steps,
|
|
364
|
+
validationArtifact: validationArtifact?.runRelativePath ?? null,
|
|
365
|
+
indexArtifact: null,
|
|
366
|
+
gaps,
|
|
367
|
+
next: nextForTestResult(status, runtimeJudgment, context.partition, options.taskId, workflowGate.nextAction, gateDecision)
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
async function recordAcceptanceEvidenceMaps(projectRoot: string, waveRunId: string, testRunId: string, partition: string, runId: string, taskId: string, acceptanceCoverage: AcceptanceEvidenceCoverage[]): Promise<void> {
|
|
372
|
+
const createdAt = new Date().toISOString();
|
|
373
|
+
for (const coverage of acceptanceCoverage) {
|
|
374
|
+
await recordRuntimeAcceptanceEvidenceMap(projectRoot, {
|
|
375
|
+
mapId: runtimeScopedId(waveRunId, testRunId, taskId, coverage.acceptanceRef),
|
|
376
|
+
waveRunId,
|
|
377
|
+
testRunId,
|
|
378
|
+
partition,
|
|
379
|
+
runId,
|
|
380
|
+
taskId,
|
|
381
|
+
acceptanceRef: coverage.acceptanceRef,
|
|
382
|
+
status: coverage.status,
|
|
383
|
+
evidenceRefs: coverage.evidenceRefs.map((ref) => ref.ref),
|
|
384
|
+
gaps: coverage.gaps,
|
|
385
|
+
createdAt,
|
|
386
|
+
payload: coverage
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
async function recordTestWorkflowProjection(projectRoot: string, input: { taskId: string; stageRun: StageRun; status: SddTestStatus; completedAt: string; evidence: string[]; gaps: string[]; riskDecision: LifecycleRiskDecision }): Promise<void> {
|
|
392
|
+
const outputRefs = input.evidence.map((ref) => ({ kind: 'artifact' as const, ref }));
|
|
393
|
+
const completedStage: StageRun = {
|
|
394
|
+
...input.stageRun,
|
|
395
|
+
status: input.status === 'PASS' ? 'completed' : input.status === 'FAIL' ? 'failed' : 'blocked',
|
|
396
|
+
outputRefs,
|
|
397
|
+
blockingReasons: input.status === 'PASS' ? [] : input.gaps.length > 0 ? input.gaps : [`SDD test ${input.status}.`],
|
|
398
|
+
updatedAt: input.completedAt
|
|
399
|
+
};
|
|
400
|
+
await recordStageRunProjection(projectRoot, completedStage);
|
|
401
|
+
|
|
402
|
+
const handoff: WorkflowHandoff = {
|
|
403
|
+
contract: WORKFLOW_HANDOFF_CONTRACT_VERSION,
|
|
404
|
+
id: `${completedStage.id}:handoff:ship`,
|
|
405
|
+
scope: completedStage.scope,
|
|
406
|
+
fromStage: 'execute',
|
|
407
|
+
toStage: 'ship',
|
|
408
|
+
fromAgent: 'validator',
|
|
409
|
+
toAgent: 'ship-manager',
|
|
410
|
+
status: input.status === 'PASS' ? 'proposed' : 'blocked',
|
|
411
|
+
outputRefs,
|
|
412
|
+
requiredInputRefs: [{ kind: 'task', ref: input.taskId }],
|
|
413
|
+
riskDecisionRef: input.stageRun.decisionRefs[0] ?? { kind: 'task', ref: input.taskId },
|
|
414
|
+
evidenceRefs: outputRefs,
|
|
415
|
+
openQuestions: [],
|
|
416
|
+
blockingGaps: input.status === 'PASS' ? [] : completedStage.blockingReasons,
|
|
417
|
+
createdAt: input.completedAt,
|
|
418
|
+
decidedAt: input.completedAt
|
|
419
|
+
};
|
|
420
|
+
const validation = validateWorkflowHandoff({ handoff, sourceStageRun: completedStage, lifecycleRiskDecision: input.riskDecision });
|
|
421
|
+
await recordWorkflowHandoffProjection(projectRoot, validation.valid ? handoff : { ...handoff, status: 'blocked', blockingGaps: validation.issues, decidedAt: input.completedAt });
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
async function ensureVerifyContractForTest(projectRoot: string, branch: string): Promise<{ inspection: VerifyContractInspection; action: VerifyContractAction }> {
|
|
426
|
+
const inspection = await inspectVerifyContract(projectRoot, { branch, branchSource: 'cli_option' });
|
|
427
|
+
return { inspection, action: inspection.status === 'PASS' ? 'none' : 'blocked' };
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function verifyContractBlocker(inspection: VerifyContractInspection): string {
|
|
431
|
+
const issueSummary = inspection.issues.map((issue) => `${issue.field}: ${issue.message}`).join(' ');
|
|
432
|
+
return `verify.md contract is ${inspection.status}; ${issueSummary || 'inspect verify.md before executing tests.'}`;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
async function hasReviewerCheckpoint(projectRoot: string, state: RunState, taskId: string): Promise<boolean> {
|
|
436
|
+
const artifactPaths = new Set(state.artifacts
|
|
437
|
+
.filter((artifact) => artifact.task === taskId && (artifact.agent === 'reviewer' || artifact.kind === 'review'))
|
|
438
|
+
.map((artifact) => artifact.path));
|
|
439
|
+
const branch = state.partition ?? state.gitBranch ?? 'unscoped';
|
|
440
|
+
const payloads = await listRuntimeArtifactPayloads(projectRoot, { runId: state.runId, taskId });
|
|
441
|
+
for (const payload of payloads) {
|
|
442
|
+
const fileName = payload.logicalRef.replace(/\\/g, '/').split('/').filter(Boolean).pop();
|
|
443
|
+
if (fileName && (payload.artifactRole === 'review' || /review/i.test(fileName))) {
|
|
444
|
+
artifactPaths.add(toBranchStageEvidenceRef(branch, 'execute', fileName));
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
for (const artifactPath of artifactPaths) {
|
|
449
|
+
const report = await validateSddResultArtifact(projectRoot, state.runId, artifactPath, { expectedTask: taskId, expectedAgent: 'reviewer' });
|
|
450
|
+
if (report.valid && report.result?.status === 'PASS') {
|
|
451
|
+
return true;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
return false;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
export function renderSddTestResult(result: SddTestResult): string {
|
|
459
|
+
return [
|
|
460
|
+
`SDD test ${result.taskId}`,
|
|
461
|
+
'',
|
|
462
|
+
resultSentenceForTest(result),
|
|
463
|
+
'',
|
|
464
|
+
'Decision:',
|
|
465
|
+
`- validation_status=${result.validationStatus}`,
|
|
466
|
+
`- workflow_gate_status=${result.workflowGateStatus}`,
|
|
467
|
+
`- workflow_gate_decision=${result.workflowGateDecision.decisionId}`,
|
|
468
|
+
'',
|
|
469
|
+
'Why:',
|
|
470
|
+
`- ${result.primaryReason}`,
|
|
471
|
+
`- capability_evidence=${capabilityEvidenceSummary(result.capabilityEvidence)}`,
|
|
472
|
+
'',
|
|
473
|
+
'Next:',
|
|
474
|
+
`- ${result.next}`
|
|
475
|
+
].join('\n');
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
async function runCommandStep(projectRoot: string, runId: string, branch: string, taskId: string, testRunId: string, sequence: number, commandInput: NormalizedSddTestCommand, acceptanceRefs: string[], timeoutMs: number, model: SddTaskModel, task: SddTask, validationScopeTaskIds: string[], validationScopeAcceptanceRefs: string[]): Promise<SddTestCommandStep> {
|
|
480
|
+
const cachePlan = buildValidationCachePlan({ branch, model, task, command: commandInput.command, argv: commandInput.argv, shell: commandInput.shell, validationScopeTaskIds, acceptanceRefs: validationScopeAcceptanceRefs });
|
|
481
|
+
const cached = cachePlan.eligible ? await readRuntimeValidationCacheEntry(projectRoot, { branchSlug: branch, cacheKey: cachePlan.cacheKey }) : null;
|
|
482
|
+
if (cached) {
|
|
483
|
+
return recordCachedCommandStep(projectRoot, runId, branch, taskId, testRunId, sequence, commandInput, acceptanceRefs, cachePlan.cacheKey, cached);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
const started = Date.now();
|
|
487
|
+
const startedAt = new Date(started).toISOString();
|
|
488
|
+
const executed = await executeCommand(projectRoot, commandInput, timeoutMs);
|
|
489
|
+
const ended = Date.now();
|
|
490
|
+
const endedAt = new Date(ended).toISOString();
|
|
491
|
+
const durationMs = ended - started;
|
|
492
|
+
const status: SddTestStepStatus = executed.timedOut || executed.error ? 'blocked' : executed.exitCode === 0 ? 'pass' : 'fail';
|
|
493
|
+
const stepId = `${testRunId}-${String(sequence).padStart(3, '0')}`;
|
|
494
|
+
const cacheStatus = cachePlan.eligible ? 'miss' : 'unsafe';
|
|
495
|
+
const shouldPersistOutputArtifact = shouldPersistCommandOutputArtifact(status, executed, cacheStatus, cachePlan.unsafeReasons);
|
|
496
|
+
const outputFileName = shouldPersistOutputArtifact ? `test-${taskId}-${String(sequence).padStart(3, '0')}.log` : null;
|
|
497
|
+
const outputRef = outputFileName ? toBranchStageEvidenceRef(branch, 'execute', outputFileName) : null;
|
|
498
|
+
const output = outputFileName ? renderCommandOutput(commandInput, status, executed, durationMs, cacheStatus, cachePlan.cacheKey, null, cachePlan.unsafeReasons) : null;
|
|
499
|
+
if (outputFileName && outputRef && output) {
|
|
500
|
+
await recordRuntimeOnlyArtifact(projectRoot, runId, outputFileName, output, { logicalRef: outputRef, branch, taskId, artifactRole: 'test-command-output' });
|
|
501
|
+
await appendArtifactHashLedgerEntry(projectRoot, {
|
|
502
|
+
runId,
|
|
503
|
+
taskId,
|
|
504
|
+
branch,
|
|
505
|
+
artifactPath: outputRef,
|
|
506
|
+
content: output,
|
|
507
|
+
status: 'recorded'
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
const stdoutDigest = hashDocumentContent(executed.stdout);
|
|
511
|
+
const stderrDigest = hashDocumentContent(executed.stderr);
|
|
512
|
+
const outputSummary = summarizeCommandOutput(executed);
|
|
513
|
+
await appendInvocationLedgerEntry(projectRoot, {
|
|
514
|
+
runId,
|
|
515
|
+
taskId,
|
|
516
|
+
branch,
|
|
517
|
+
kind: 'command',
|
|
518
|
+
ref: commandInput.command,
|
|
519
|
+
status,
|
|
520
|
+
artifactPath: outputRef,
|
|
521
|
+
outputHash: output ? hashDocumentContent(output) : null,
|
|
522
|
+
materialRefs: outputRef ? [outputRef] : [],
|
|
523
|
+
metadata: {
|
|
524
|
+
stepId,
|
|
525
|
+
source: 'sdd-test',
|
|
526
|
+
exitCode: executed.exitCode,
|
|
527
|
+
durationMs,
|
|
528
|
+
stdoutBytes: executed.stdoutBytes,
|
|
529
|
+
stderrBytes: executed.stderrBytes,
|
|
530
|
+
truncated: executed.truncated,
|
|
531
|
+
acceptanceRefs: acceptanceRefs.join(','),
|
|
532
|
+
shell: commandInput.shell,
|
|
533
|
+
argv: commandInput.argv ? JSON.stringify(commandInput.argv) : null,
|
|
534
|
+
stdoutDigest,
|
|
535
|
+
stderrDigest,
|
|
536
|
+
cacheKey: cachePlan.cacheKey,
|
|
537
|
+
cacheStatus,
|
|
538
|
+
cacheUnsafeReasons: cachePlan.unsafeReasons.join(',')
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
const step: SddTestCommandStep = {
|
|
542
|
+
stepId,
|
|
543
|
+
command: commandInput.command,
|
|
544
|
+
argv: commandInput.argv,
|
|
545
|
+
shell: commandInput.shell,
|
|
546
|
+
acceptanceRefs,
|
|
547
|
+
status,
|
|
548
|
+
exitCode: executed.exitCode,
|
|
549
|
+
signal: executed.signal,
|
|
550
|
+
durationMs,
|
|
551
|
+
outputArtifact: outputRef,
|
|
552
|
+
stdoutBytes: executed.stdoutBytes,
|
|
553
|
+
stderrBytes: executed.stderrBytes,
|
|
554
|
+
truncated: executed.truncated,
|
|
555
|
+
startedAt,
|
|
556
|
+
endedAt,
|
|
557
|
+
cwd: projectRoot,
|
|
558
|
+
stdoutDigest,
|
|
559
|
+
stderrDigest,
|
|
560
|
+
outputSummary,
|
|
561
|
+
cacheStatus,
|
|
562
|
+
cacheKey: cachePlan.cacheKey,
|
|
563
|
+
cacheSourceTestRunId: null,
|
|
564
|
+
cacheUnsafeReasons: cachePlan.unsafeReasons
|
|
565
|
+
};
|
|
566
|
+
await recordRuntimeTestStep(projectRoot, {
|
|
567
|
+
stepId,
|
|
568
|
+
testRunId,
|
|
569
|
+
runId,
|
|
570
|
+
taskId,
|
|
571
|
+
command: commandInput.command,
|
|
572
|
+
status,
|
|
573
|
+
exitCode: executed.exitCode,
|
|
574
|
+
durationMs,
|
|
575
|
+
outputArtifact: outputRef,
|
|
576
|
+
payload: step
|
|
577
|
+
});
|
|
578
|
+
if (status === 'pass' && cachePlan.eligible) {
|
|
579
|
+
const now = new Date().toISOString();
|
|
580
|
+
await recordRuntimeValidationCacheEntry(projectRoot, {
|
|
581
|
+
cacheKey: cachePlan.cacheKey,
|
|
582
|
+
branchSlug: branch,
|
|
583
|
+
command: commandInput.command,
|
|
584
|
+
status: 'valid',
|
|
585
|
+
sourceTestRunId: testRunId,
|
|
586
|
+
sourceRunId: runId,
|
|
587
|
+
sourceEvidenceSetId: null,
|
|
588
|
+
outputArtifact: outputRef,
|
|
589
|
+
stdoutDigest,
|
|
590
|
+
stderrDigest,
|
|
591
|
+
createdAt: now,
|
|
592
|
+
lastUsedAt: now,
|
|
593
|
+
payload: { cachePlan, step }
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
return step;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
async function recordCachedCommandStep(projectRoot: string, runId: string, branch: string, taskId: string, testRunId: string, sequence: number, commandInput: NormalizedSddTestCommand, acceptanceRefs: string[], cacheKey: string, cached: RuntimeValidationCacheEntryRecord): Promise<SddTestCommandStep> {
|
|
600
|
+
const now = new Date().toISOString();
|
|
601
|
+
const stepId = `${testRunId}-${String(sequence).padStart(3, '0')}`;
|
|
602
|
+
const step: SddTestCommandStep = {
|
|
603
|
+
stepId,
|
|
604
|
+
command: commandInput.command,
|
|
605
|
+
argv: commandInput.argv,
|
|
606
|
+
shell: commandInput.shell,
|
|
607
|
+
acceptanceRefs,
|
|
608
|
+
status: 'pass',
|
|
609
|
+
exitCode: 0,
|
|
610
|
+
signal: null,
|
|
611
|
+
durationMs: 0,
|
|
612
|
+
outputArtifact: null,
|
|
613
|
+
stdoutBytes: 0,
|
|
614
|
+
stderrBytes: 0,
|
|
615
|
+
truncated: false,
|
|
616
|
+
startedAt: now,
|
|
617
|
+
endedAt: now,
|
|
618
|
+
cwd: projectRoot,
|
|
619
|
+
stdoutDigest: cached.stdoutDigest,
|
|
620
|
+
stderrDigest: cached.stderrDigest,
|
|
621
|
+
outputSummary: `cache_hit source_test_run=${cached.sourceTestRunId} source_artifact=${cached.outputArtifact ?? 'none'}`,
|
|
622
|
+
cacheStatus: 'hit',
|
|
623
|
+
cacheKey,
|
|
624
|
+
cacheSourceTestRunId: cached.sourceTestRunId,
|
|
625
|
+
cacheUnsafeReasons: []
|
|
626
|
+
};
|
|
627
|
+
await appendInvocationLedgerEntry(projectRoot, {
|
|
628
|
+
runId,
|
|
629
|
+
taskId,
|
|
630
|
+
branch,
|
|
631
|
+
kind: 'command',
|
|
632
|
+
ref: commandInput.command,
|
|
633
|
+
status: 'pass',
|
|
634
|
+
artifactPath: null,
|
|
635
|
+
outputHash: null,
|
|
636
|
+
materialRefs: cached.outputArtifact ? [cached.outputArtifact] : [],
|
|
637
|
+
metadata: { source: 'sdd-test-cache', stepId, cacheKey, sourceTestRunId: cached.sourceTestRunId, sourceEvidenceSetId: cached.sourceEvidenceSetId, acceptanceRefs: acceptanceRefs.join(',') }
|
|
638
|
+
});
|
|
639
|
+
await recordRuntimeTestStep(projectRoot, {
|
|
640
|
+
stepId,
|
|
641
|
+
testRunId,
|
|
642
|
+
runId,
|
|
643
|
+
taskId,
|
|
644
|
+
command: commandInput.command,
|
|
645
|
+
status: 'pass',
|
|
646
|
+
exitCode: 0,
|
|
647
|
+
durationMs: 0,
|
|
648
|
+
outputArtifact: null,
|
|
649
|
+
payload: step
|
|
650
|
+
});
|
|
651
|
+
await recordRuntimeValidationCacheUse(projectRoot, {
|
|
652
|
+
useId: runtimeScopedId(cacheKey, testRunId, taskId, stepId),
|
|
653
|
+
cacheKey,
|
|
654
|
+
branchSlug: branch,
|
|
655
|
+
testRunId,
|
|
656
|
+
runId,
|
|
657
|
+
taskId,
|
|
658
|
+
sourceTestRunId: cached.sourceTestRunId,
|
|
659
|
+
sourceEvidenceSetId: cached.sourceEvidenceSetId,
|
|
660
|
+
reusedAt: now,
|
|
661
|
+
mappedTaskIds: [taskId],
|
|
662
|
+
reason: 'same validation cache key within compatible branch contract scope',
|
|
663
|
+
payload: { sourceRunId: cached.sourceRunId, sourceArtifact: cached.outputArtifact }
|
|
664
|
+
});
|
|
665
|
+
return step;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
function executeCommand(projectRoot: string, commandInput: NormalizedSddTestCommand, timeoutMs: number): Promise<{ exitCode: number | null; signal: string | null; stdout: string; stderr: string; stdoutBytes: number; stderrBytes: number; truncated: boolean; timedOut: boolean; error: string | null }> {
|
|
669
|
+
return new Promise((resolve) => {
|
|
670
|
+
const child = commandInput.argv
|
|
671
|
+
? spawn(commandInput.argv[0], commandInput.argv.slice(1), { cwd: projectRoot, shell: false, windowsHide: true, env: process.env })
|
|
672
|
+
: spawn(commandInput.command, { cwd: projectRoot, shell: true, windowsHide: true, env: process.env });
|
|
673
|
+
let stdout = '';
|
|
674
|
+
let stderr = '';
|
|
675
|
+
let stdoutBytes = 0;
|
|
676
|
+
let stderrBytes = 0;
|
|
677
|
+
let truncated = false;
|
|
678
|
+
let settled = false;
|
|
679
|
+
let timedOut = false;
|
|
680
|
+
const timer = setTimeout(() => {
|
|
681
|
+
timedOut = true;
|
|
682
|
+
child.kill();
|
|
683
|
+
}, timeoutMs);
|
|
684
|
+
const finish = (result: { exitCode: number | null; signal: string | null; error: string | null }) => {
|
|
685
|
+
if (settled) {
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
settled = true;
|
|
689
|
+
clearTimeout(timer);
|
|
690
|
+
resolve({ ...result, stdout, stderr, stdoutBytes, stderrBytes, truncated, timedOut });
|
|
691
|
+
};
|
|
692
|
+
child.stdout?.on('data', (chunk: Buffer) => {
|
|
693
|
+
stdoutBytes += chunk.length;
|
|
694
|
+
const next = chunk.toString('utf8');
|
|
695
|
+
if (Buffer.byteLength(stdout, 'utf8') < MAX_CAPTURE_BYTES) {
|
|
696
|
+
stdout += next;
|
|
697
|
+
} else {
|
|
698
|
+
truncated = true;
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
child.stderr?.on('data', (chunk: Buffer) => {
|
|
702
|
+
stderrBytes += chunk.length;
|
|
703
|
+
const next = chunk.toString('utf8');
|
|
704
|
+
if (Buffer.byteLength(stderr, 'utf8') < MAX_CAPTURE_BYTES) {
|
|
705
|
+
stderr += next;
|
|
706
|
+
} else {
|
|
707
|
+
truncated = true;
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
child.on('error', (error) => finish({ exitCode: null, signal: null, error: error.message }));
|
|
711
|
+
child.on('close', (code, signal) => finish({ exitCode: code, signal, error: null }));
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
async function writeValidationArtifact(projectRoot: string, runId: string, branch: string, task: SddTask, status: SddTestStatus, steps: SddTestCommandStep[], gaps: string[], _capabilityEvidence: CapabilityEvidenceClassification[]): Promise<{ absolutePath: string; runRelativePath: string }> {
|
|
716
|
+
const artifactPath = validationArtifactPath(task);
|
|
717
|
+
const stageEvidenceRef = toBranchStageEvidenceRef(branch, 'execute', artifactPath);
|
|
718
|
+
const resultStatus = status === 'PASS' ? 'PASS' : status === 'FAIL' ? 'FAIL' : 'BLOCKED';
|
|
719
|
+
const content = `# Test Validation ${task.id}\n\n\`\`\`sdd-result\ncontract: ${SDD_RESULT_CONTRACT}\nversion: ${SDD_RESULT_VERSION}\nagent: validator\ntask: ${task.id}\nstatus: ${resultStatus}\nartifacts:\n - ${stageEvidenceRef}\n\`\`\`\n\n## Test Runtime\n\n- status: ${status}\n- commands:\n${steps.length > 0 ? steps.map((step) => ` - [${step.status}] ${step.command}`).join('\n') : ' - none'}\n- gaps:\n${gaps.length > 0 ? gaps.map((gap) => ` - ${gap}`).join('\n') : ' - none'}\n\n## Acceptance Evidence\n\n${renderEvidenceBlocks(task, status, stageEvidenceRef, steps)}\n`;
|
|
720
|
+
const written = await recordStageEvidenceArtifact(projectRoot, runId, stageEvidenceRef, content, { taskId: task.id, artifactRole: 'test-validation' });
|
|
721
|
+
return { ...written, runRelativePath: stageEvidenceRef };
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
function validationArtifactPath(task: SddTask): string {
|
|
725
|
+
return `test-validation-${task.id}.md`;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
async function persistTestRunState(projectRoot: string, state: RunState, taskId: string, validationStatus: SddTestStatus, commands: string[], evidence: string[], validationArtifact: string | null): Promise<void> {
|
|
731
|
+
const latest = await readRunState(projectRoot, state.runId);
|
|
732
|
+
const knownArtifacts = new Set(latest.artifacts.map((artifact) => artifact.path));
|
|
733
|
+
const now = new Date().toISOString();
|
|
734
|
+
const nextArtifacts = evidence
|
|
735
|
+
.filter((artifactPath) => !knownArtifacts.has(artifactPath))
|
|
736
|
+
.map((artifactPath) => ({ path: artifactPath, kind: testArtifactKind(artifactPath), task: taskId, agent: 'test-runtime', createdAt: now }));
|
|
737
|
+
const existingTaskState = latest.tasks[taskId];
|
|
738
|
+
await writeRunState(projectRoot, {
|
|
739
|
+
...latest,
|
|
740
|
+
status: validationStatus === 'PASS' ? 'running' : validationStatus === 'FAIL' ? 'failed' : 'blocked',
|
|
741
|
+
phase: 'test',
|
|
742
|
+
currentTask: taskId,
|
|
743
|
+
tasks: {
|
|
744
|
+
...latest.tasks,
|
|
745
|
+
[taskId]: {
|
|
746
|
+
...baseRuntimeTaskState(existingTaskState),
|
|
747
|
+
status: validationStatus === 'PASS' ? 'validation_passed_pending_gate' : validationStatus === 'FAIL' ? 'validation_failed' : 'validation_blocked',
|
|
748
|
+
implementationStatus: existingTaskState?.implementationStatus ?? 'not_started',
|
|
749
|
+
verificationStatus: verificationStatusFromTest(validationStatus),
|
|
750
|
+
testStatus: validationStatus,
|
|
751
|
+
evidence
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
artifacts: [...latest.artifacts, ...nextArtifacts],
|
|
755
|
+
validation: {
|
|
756
|
+
status: validationStatus === 'PASS' ? 'pass' : validationStatus === 'FAIL' ? 'fail' : 'blocked',
|
|
757
|
+
commands,
|
|
758
|
+
evidence
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
async function persistTestGateOutcome(projectRoot: string, runId: string, taskId: string, status: SddTestStatus, validationStatus: SddTestStatus, commands: string[], evidence: string[], validationArtifact: string | null, gateDecision: WorkflowGateDecision): Promise<void> {
|
|
764
|
+
const latest = await readRunState(projectRoot, runId);
|
|
765
|
+
const knownArtifacts = new Set(latest.artifacts.map((artifact) => artifact.path));
|
|
766
|
+
const now = new Date().toISOString();
|
|
767
|
+
const nextArtifacts = evidence
|
|
768
|
+
.filter((artifactPath) => !knownArtifacts.has(artifactPath))
|
|
769
|
+
.map((artifactPath) => ({ path: artifactPath, kind: testArtifactKind(artifactPath), task: taskId, agent: 'test-runtime', createdAt: now }));
|
|
770
|
+
const existingTaskState = latest.tasks[taskId];
|
|
771
|
+
await writeRunState(projectRoot, {
|
|
772
|
+
...latest,
|
|
773
|
+
status: status === 'PASS' ? 'completed' : status === 'FAIL' ? 'failed' : 'blocked',
|
|
774
|
+
phase: 'test',
|
|
775
|
+
currentTask: taskId,
|
|
776
|
+
tasks: {
|
|
777
|
+
...latest.tasks,
|
|
778
|
+
[taskId]: {
|
|
779
|
+
...baseRuntimeTaskState(existingTaskState),
|
|
780
|
+
status: runtimeTaskStatusAfterGate(status, validationStatus),
|
|
781
|
+
implementationStatus: existingTaskState?.implementationStatus ?? 'not_started',
|
|
782
|
+
verificationStatus: verificationStatusFromTest(validationStatus),
|
|
783
|
+
testStatus: status,
|
|
784
|
+
validationStatus,
|
|
785
|
+
workflowGateStatus: gateDecision.status,
|
|
786
|
+
workflowGateDecisionId: gateDecision.decisionId,
|
|
787
|
+
evidence
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
artifacts: [...latest.artifacts, ...nextArtifacts],
|
|
791
|
+
validation: {
|
|
792
|
+
status: validationStatus === 'PASS' ? 'pass' : validationStatus === 'FAIL' ? 'fail' : 'blocked',
|
|
793
|
+
commands,
|
|
794
|
+
evidence
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
function testArtifactKind(artifactPath: string): string {
|
|
800
|
+
const fileName = artifactPath.split('/').pop() ?? artifactPath;
|
|
801
|
+
if (fileName.startsWith('test-validation-')) {
|
|
802
|
+
return 'test-validation';
|
|
803
|
+
}
|
|
804
|
+
return 'test';
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
function baseRuntimeTaskState(existing: RunStateTaskRuntime | undefined): RunStateTaskRuntime {
|
|
808
|
+
return {
|
|
809
|
+
status: existing?.status ?? 'not_started',
|
|
810
|
+
implementationStatus: existing?.implementationStatus ?? 'not_started',
|
|
811
|
+
verificationStatus: existing?.verificationStatus ?? 'not_run',
|
|
812
|
+
validationBatch: existing?.validationBatch ?? null,
|
|
813
|
+
validationTiming: existing?.validationTiming ?? 'task_end',
|
|
814
|
+
requiresVerifyBeforeNext: existing?.requiresVerifyBeforeNext ?? true,
|
|
815
|
+
gaps: existing?.gaps,
|
|
816
|
+
artifacts: existing?.artifacts,
|
|
817
|
+
testStatus: existing?.testStatus,
|
|
818
|
+
workflowGateStatus: existing?.workflowGateStatus,
|
|
819
|
+
workflowGateDecisionId: existing?.workflowGateDecisionId,
|
|
820
|
+
evidence: existing?.evidence
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
function verificationStatusFromTest(validationStatus: SddTestStatus): RunStateTaskRuntime['verificationStatus'] {
|
|
825
|
+
if (validationStatus === 'PASS') {
|
|
826
|
+
return 'pass';
|
|
827
|
+
}
|
|
828
|
+
return validationStatus === 'FAIL' ? 'failed' : 'blocked';
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
function runtimeTaskStatusAfterGate(status: SddTestStatus, validationStatus: SddTestStatus): string {
|
|
832
|
+
if (status === 'PASS') {
|
|
833
|
+
return 'implemented_verified';
|
|
834
|
+
}
|
|
835
|
+
if (validationStatus === 'PASS') {
|
|
836
|
+
return 'workflow_gate_blocked';
|
|
837
|
+
}
|
|
838
|
+
return validationStatus === 'FAIL' ? 'validation_failed' : 'validation_blocked';
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
function deriveCommandStatus(gaps: string[], steps: SddTestCommandStep[]): TestEvidenceStatus {
|
|
842
|
+
if (gaps.length > 0 || steps.some((step) => step.status === 'blocked')) {
|
|
843
|
+
return 'BLOCKED';
|
|
844
|
+
}
|
|
845
|
+
if (steps.some((step) => step.status === 'fail')) {
|
|
846
|
+
return 'FAIL';
|
|
847
|
+
}
|
|
848
|
+
return 'PASS';
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
function buildAcceptanceCoverage(task: SddTask | null, steps: SddTestCommandStep[], commandStatus: TestEvidenceStatus, acceptanceRefsOverride: string[] | undefined): AcceptanceEvidenceCoverage[] {
|
|
852
|
+
const acceptanceRefs = acceptanceRefsOverride && acceptanceRefsOverride.length > 0 ? [...new Set(acceptanceRefsOverride)] : task ? taskAcceptanceRefs(task) : [];
|
|
853
|
+
return acceptanceRefs.map((acceptanceRef) => {
|
|
854
|
+
const mappedSteps = steps.filter((step) => step.acceptanceRefs.includes(acceptanceRef));
|
|
855
|
+
const hasPassingEvidence = mappedSteps.some((step) => step.status === 'pass');
|
|
856
|
+
const hasFailingEvidence = mappedSteps.some((step) => step.status === 'fail' || step.status === 'blocked');
|
|
857
|
+
const status: EvidenceCoverageStatus = hasPassingEvidence && !hasFailingEvidence && commandStatus === 'PASS'
|
|
858
|
+
? 'complete'
|
|
859
|
+
: mappedSteps.length > 0
|
|
860
|
+
? 'partial'
|
|
861
|
+
: 'missing';
|
|
862
|
+
return {
|
|
863
|
+
acceptanceRef,
|
|
864
|
+
status,
|
|
865
|
+
evidenceRefs: mappedSteps.map(commandStepRuntimeRef),
|
|
866
|
+
gaps: status === 'complete' ? [] : [`Acceptance ${acceptanceRef} has no complete non-stale execute validation evidence.`]
|
|
867
|
+
};
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
function runtimeEvidenceRefs(validationArtifact: string | null, steps: SddTestCommandStep[]): string[] {
|
|
872
|
+
return [validationArtifact, ...steps.map((step) => step.outputArtifact)].filter((item): item is string => Boolean(item));
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
function commandStepRuntimeRef(step: SddTestCommandStep): { kind: 'command'; ref: string } {
|
|
876
|
+
return { kind: 'command', ref: step.stepId };
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
function artifactRuntimeRefs(ref: string | null): Array<{ kind: 'artifact'; ref: string }> {
|
|
880
|
+
return ref ? [{ kind: 'artifact', ref }] : [];
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
function summarizeEvidenceCoverage(acceptanceCoverage: AcceptanceEvidenceCoverage[]): EvidenceCoverageStatus {
|
|
884
|
+
if (acceptanceCoverage.length === 0) {
|
|
885
|
+
return 'missing';
|
|
886
|
+
}
|
|
887
|
+
if (acceptanceCoverage.every((coverage) => coverage.status === 'complete')) {
|
|
888
|
+
return 'complete';
|
|
889
|
+
}
|
|
890
|
+
if (acceptanceCoverage.some((coverage) => coverage.status === 'complete' || coverage.status === 'partial')) {
|
|
891
|
+
return 'partial';
|
|
892
|
+
}
|
|
893
|
+
return 'missing';
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
function derivePolicyJudgment(commandStatus: TestEvidenceStatus, evidenceCoverage: EvidenceCoverageStatus): SddTestStatus {
|
|
897
|
+
if (commandStatus === 'FAIL') {
|
|
898
|
+
return 'FAIL';
|
|
899
|
+
}
|
|
900
|
+
if (commandStatus === 'BLOCKED' || evidenceCoverage !== 'complete') {
|
|
901
|
+
return 'BLOCKED';
|
|
902
|
+
}
|
|
903
|
+
return 'PASS';
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
async function resolveTestRuntimeDurableGap(
|
|
907
|
+
projectRoot: string,
|
|
908
|
+
branch: string,
|
|
909
|
+
runId: string,
|
|
910
|
+
taskId: string,
|
|
911
|
+
validationStatus: SddTestStatus,
|
|
912
|
+
gaps: string[]
|
|
913
|
+
): Promise<void> {
|
|
914
|
+
if (validationStatus !== 'PASS' || gaps.length > 0) {
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
await updateRuntimeDurableGapStatus(projectRoot, {
|
|
918
|
+
gapId: testRuntimeGapId(branch, runId, taskId),
|
|
919
|
+
status: 'resolved',
|
|
920
|
+
source: 'gate_policy',
|
|
921
|
+
payload: { validationStatus, gaps }
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
async function recordTestRuntimeDurableGap(
|
|
926
|
+
projectRoot: string,
|
|
927
|
+
branch: string,
|
|
928
|
+
runId: string,
|
|
929
|
+
taskId: string,
|
|
930
|
+
status: SddTestStatus,
|
|
931
|
+
validationStatus: SddTestStatus,
|
|
932
|
+
runtimeJudgment: WorkflowGateStatus,
|
|
933
|
+
gaps: string[],
|
|
934
|
+
evidenceRefs: string[]
|
|
935
|
+
): Promise<void> {
|
|
936
|
+
if (status === 'PASS' && gaps.length === 0) {
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
const message = gaps[0] ?? (runtimeJudgment === 'PASS' ? `Validation status is ${validationStatus}.` : `Workflow gate status is ${runtimeJudgment}.`);
|
|
940
|
+
await recordRuntimeDurableGap(projectRoot, {
|
|
941
|
+
gapId: testRuntimeGapId(branch, runId, taskId),
|
|
942
|
+
partition: branch,
|
|
943
|
+
taskId,
|
|
944
|
+
runId,
|
|
945
|
+
stage: 'execute',
|
|
946
|
+
gate: 'execute',
|
|
947
|
+
source: 'runtime',
|
|
948
|
+
category: runtimeJudgment === 'PASS' ? 'validation' : 'workflow_gate',
|
|
949
|
+
severity: 'blocking',
|
|
950
|
+
status: 'open',
|
|
951
|
+
message,
|
|
952
|
+
recommendation: `Resolve execute runtime gaps for ${taskId}, then rerun ${testValidationUnitCommand(branch)}.`,
|
|
953
|
+
evidenceRefs,
|
|
954
|
+
proposalRefs: [],
|
|
955
|
+
sourceRefs: [],
|
|
956
|
+
payload: { status, validationStatus, runtimeJudgment, gaps }
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
function testRuntimeGapId(branch: string, _runId: string, taskId: string): string {
|
|
961
|
+
return runtimeScopedId(branch, taskId, 'test-runtime-gap');
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
function finalStatusForTest(validationStatus: SddTestStatus, runtimeJudgment: WorkflowGateStatus): SddTestStatus {
|
|
965
|
+
if (validationStatus !== 'PASS') {
|
|
966
|
+
return validationStatus;
|
|
967
|
+
}
|
|
968
|
+
return runtimeJudgment === 'PASS' || runtimeJudgment === 'WARN' ? 'PASS' : 'BLOCKED';
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
function buildUnifiedTestEvidenceRun(id: string, branch: string, runId: string, taskId: string, commandStatus: TestEvidenceStatus, evidenceCoverage: EvidenceCoverageStatus, policyJudgment: TestEvidenceStatus, status: SddTestStatus, runtimeJudgment: WorkflowGateStatus, steps: SddTestCommandStep[], acceptanceCoverage: AcceptanceEvidenceCoverage[], capabilityEvidence: CapabilityEvidenceClassification[], gaps: string[], gateNextAction: string | null, gateDecision: WorkflowGateDecision | null): UnifiedTestEvidenceRun {
|
|
972
|
+
return {
|
|
973
|
+
contract: TEST_EVIDENCE_RUN_CONTRACT_VERSION,
|
|
974
|
+
id,
|
|
975
|
+
scope: { branch, taskId, runId },
|
|
976
|
+
commandStatus,
|
|
977
|
+
evidenceCoverage,
|
|
978
|
+
policyJudgment,
|
|
979
|
+
commands: steps.map((step) => ({
|
|
980
|
+
command: step.command,
|
|
981
|
+
status: step.status === 'pass' ? 'PASS' : step.status === 'fail' ? 'FAIL' : 'BLOCKED',
|
|
982
|
+
outputRef: step.outputArtifact ? { kind: 'artifact', ref: step.outputArtifact } : undefined,
|
|
983
|
+
evidenceRefs: [commandStepRuntimeRef(step), ...artifactRuntimeRefs(step.outputArtifact)],
|
|
984
|
+
acceptanceRefs: step.acceptanceRefs,
|
|
985
|
+
startedAt: new Date(Date.now() - step.durationMs).toISOString(),
|
|
986
|
+
completedAt: new Date().toISOString()
|
|
987
|
+
})),
|
|
988
|
+
acceptanceCoverage,
|
|
989
|
+
capabilityEvidence,
|
|
990
|
+
gaps: [...gaps, ...acceptanceCoverage.flatMap((coverage) => coverage.gaps)],
|
|
991
|
+
next: nextForTestResult(status, runtimeJudgment, branch, taskId, gateNextAction, gateDecision),
|
|
992
|
+
generatedAt: new Date().toISOString()
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
function buildCapabilityEvidenceClassification(decision: AgentCapabilityRouteDecision | null, steps: SddTestCommandStep[]): CapabilityEvidenceClassification[] {
|
|
997
|
+
if (!decision) {
|
|
998
|
+
return [{
|
|
999
|
+
class: 'diagnostic',
|
|
1000
|
+
source: 'runtime_diagnostic',
|
|
1001
|
+
domainOrSourceId: 'capability-routing',
|
|
1002
|
+
evidenceRefs: [],
|
|
1003
|
+
acceptanceRefs: [],
|
|
1004
|
+
provenanceRefs: [],
|
|
1005
|
+
reason: 'Capability routing did not run; no capability output is accepted as test evidence.'
|
|
1006
|
+
}];
|
|
1007
|
+
}
|
|
1008
|
+
const acceptanceRefs = [...new Set(steps.flatMap((step) => step.acceptanceRefs))];
|
|
1009
|
+
const professionalEvidence = decision.selectedDomains.map((domain) => ({
|
|
1010
|
+
class: 'candidate' as const,
|
|
1011
|
+
source: 'professional_capability' as const,
|
|
1012
|
+
domainOrSourceId: domain.domain,
|
|
1013
|
+
evidenceRefs: [],
|
|
1014
|
+
acceptanceRefs,
|
|
1015
|
+
provenanceRefs: [{ kind: 'projection' as const, ref: `capability:${domain.capabilityId}` }],
|
|
1016
|
+
reason: `${domain.reason}; capability output is advisory candidate evidence until accepted by command evidence and policy refs.`
|
|
1017
|
+
}));
|
|
1018
|
+
const externalEvidence = decision.rejectedExternalSources.map((source) => ({
|
|
1019
|
+
class: capabilityClassForRejectedSource(source.quarantineStatus) as CapabilityEvidenceClassification['class'],
|
|
1020
|
+
source: 'external_source' as const,
|
|
1021
|
+
domainOrSourceId: source.sourceId,
|
|
1022
|
+
evidenceRefs: [],
|
|
1023
|
+
acceptanceRefs: [],
|
|
1024
|
+
provenanceRefs: [{ kind: 'external' as const, ref: source.sourceId }],
|
|
1025
|
+
reason: source.reason
|
|
1026
|
+
}));
|
|
1027
|
+
return [...professionalEvidence, ...externalEvidence];
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
function capabilityClassForRejectedSource(status: AgentCapabilityRouteDecision['rejectedExternalSources'][number]['quarantineStatus']): CapabilityEvidenceClassification['class'] {
|
|
1031
|
+
if (status === 'denied') {
|
|
1032
|
+
return 'blocked';
|
|
1033
|
+
}
|
|
1034
|
+
if (status === 'required' || status === 'quarantined') {
|
|
1035
|
+
return 'quarantined';
|
|
1036
|
+
}
|
|
1037
|
+
return 'diagnostic';
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
function capabilityEvidenceSummary(items: CapabilityEvidenceClassification[]): string {
|
|
1042
|
+
if (items.length === 0) {
|
|
1043
|
+
return 'none';
|
|
1044
|
+
}
|
|
1045
|
+
const counts = new Map<CapabilityEvidenceClassification['class'], number>();
|
|
1046
|
+
for (const item of items) {
|
|
1047
|
+
counts.set(item.class, (counts.get(item.class) ?? 0) + 1);
|
|
1048
|
+
}
|
|
1049
|
+
return [...counts.entries()].map(([kind, count]) => `${kind}:${count}`).join(',');
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
function nextForTestResult(status: SddTestStatus, runtimeJudgment: WorkflowGateStatus, branch: string, taskId: string, gateNextAction: string | null, gateDecision: WorkflowGateDecision | null): string {
|
|
1053
|
+
const inspectHint = `Inspect runtime test read model for ${taskId}`;
|
|
1054
|
+
if (status === 'PASS') {
|
|
1055
|
+
return `sdd execute close --branch ${branch} --compact-json`;
|
|
1056
|
+
}
|
|
1057
|
+
if (gateNextAction) {
|
|
1058
|
+
return gateNextAction;
|
|
1059
|
+
}
|
|
1060
|
+
if (runtimeJudgment === 'HUMAN_REQUIRED') {
|
|
1061
|
+
return gateDecision ? `Create a decision card for workflow gate ${gateDecision.decisionId}, then rerun ${testValidationUnitCommand(branch)}.` : `Create a decision card, then rerun ${testValidationUnitCommand(branch)}.`;
|
|
1062
|
+
}
|
|
1063
|
+
if (runtimeJudgment === 'WARN') {
|
|
1064
|
+
return gateDecision ? `Review workflow gate ${gateDecision.decisionId} warnings, then rerun ${testValidationUnitCommand(branch)} or proceed only with explicit review.` : `Review workflow gate warnings, then rerun ${testValidationUnitCommand(branch)}.`;
|
|
1065
|
+
}
|
|
1066
|
+
if (runtimeJudgment === 'ADVISORY_ONLY') {
|
|
1067
|
+
return `Inspect advisor assessments for ${taskId}; advisory output cannot satisfy the test gate.`;
|
|
1068
|
+
}
|
|
1069
|
+
if (status === 'FAIL') {
|
|
1070
|
+
return `${inspectHint}, fix failing validation commands, then rerun ${testValidationUnitCommand(branch)}.`;
|
|
1071
|
+
}
|
|
1072
|
+
return gateDecision ? `${inspectHint} and workflow gate ${gateDecision.decisionId}, resolve blockers, then rerun ${testValidationUnitCommand(branch)}.` : `${inspectHint}, fix command/evidence gaps, then rerun ${testValidationUnitCommand(branch)}.`;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
function testValidationUnitCommand(branch: string): string {
|
|
1077
|
+
return `sdd execute --branch ${branch} --json`;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
function resultSentenceForTest(result: SddTestResult): string {
|
|
1081
|
+
if (result.status === 'PASS') {
|
|
1082
|
+
return 'Validation and workflow gate passed; proceed to execute evidence judgment and truthAlignment before release readiness.';
|
|
1083
|
+
}
|
|
1084
|
+
if (result.validationStatus === 'PASS' && result.workflowGateStatus !== 'PASS') {
|
|
1085
|
+
return `Validation passed, but workflow gate returned ${result.workflowGateStatus}.`;
|
|
1086
|
+
}
|
|
1087
|
+
if (result.commandStatus === 'BLOCKED') {
|
|
1088
|
+
return 'Blocked before validation commands ran.';
|
|
1089
|
+
}
|
|
1090
|
+
return result.status === 'FAIL' ? 'Validation failed.' : 'Validation did not produce complete evidence.';
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
function renderEvidenceBlocks(task: SddTask, status: SddTestStatus, sourceArtifact: string, steps: SddTestCommandStep[]): string {
|
|
1094
|
+
const acceptances = task.acceptanceRefs.length > 0 ? task.acceptanceRefs : task.acceptance;
|
|
1095
|
+
if (acceptances.length === 0) {
|
|
1096
|
+
return 'No acceptance targets declared.';
|
|
1097
|
+
}
|
|
1098
|
+
const mappedEvidence = acceptances
|
|
1099
|
+
.map((acceptance) => ({ acceptance, steps: steps.filter((step) => step.acceptanceRefs.includes(acceptance)) }))
|
|
1100
|
+
.filter((item) => item.steps.length > 0);
|
|
1101
|
+
if (mappedEvidence.length === 0) {
|
|
1102
|
+
return 'No acceptance evidence emitted; validation commands are not explicitly mapped to acceptance refs.';
|
|
1103
|
+
}
|
|
1104
|
+
return mappedEvidence.map(({ acceptance, steps: mappedSteps }) => {
|
|
1105
|
+
const evidenceStatus = evidenceStatusForMappedSteps(status, mappedSteps);
|
|
1106
|
+
return `\`\`\`sdd-evidence\ncontract: ${SDD_EVIDENCE_CONTRACT}\nversion: ${SDD_EVIDENCE_VERSION}\ntask: ${task.id}\nacceptance: ${acceptance}\nstatus: ${evidenceStatus}\nclaim: Explicit validation mapping ${mappedSteps.map((step) => step.command).join(' && ')} produced ${evidenceStatus} for ${acceptance}.\nsource_artifact: ${sourceArtifact}\nevidence_refs:\n${mappedSteps.map(renderStepEvidenceRefs).join('\n')}\nprovenance_refs:\n - artifact:${sourceArtifact}\n${mappedSteps.map((step) => ` - command:${step.command}`).join('\n')}\npolicy_refs:\n - ${ACCEPTANCE_POLICY_RULESET_VERSION}:require-source-evidence\n - ${ACCEPTANCE_POLICY_RULESET_VERSION}:require-provenance\n - ${ACCEPTANCE_POLICY_RULESET_VERSION}:require-policy-rule\n\`\`\``;
|
|
1107
|
+
}).join('\n\n');
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
function normalizeTestCommandInputs(commandInputs: SddTestCommandInput[] | undefined, commands: string[] | undefined, taskValidation: string[]): NormalizedSddTestCommand[] {
|
|
1111
|
+
if (commandInputs && commandInputs.length > 0) {
|
|
1112
|
+
return commandInputs.map(normalizeTestCommandInput);
|
|
1113
|
+
}
|
|
1114
|
+
return (commands && commands.length > 0 ? commands : taskValidation).map((command) => ({ command, argv: null, shell: true }));
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
function normalizeTestCommandInput(input: SddTestCommandInput): NormalizedSddTestCommand {
|
|
1118
|
+
if (input.argv) {
|
|
1119
|
+
const argv = input.argv.filter((item) => item.length > 0);
|
|
1120
|
+
if (argv.length === 0) {
|
|
1121
|
+
throw new Error('Command argv input must include an executable.');
|
|
1122
|
+
}
|
|
1123
|
+
return { command: argv.join(' '), argv, shell: false };
|
|
1124
|
+
}
|
|
1125
|
+
if (input.command) {
|
|
1126
|
+
return { command: input.command, argv: null, shell: true };
|
|
1127
|
+
}
|
|
1128
|
+
throw new Error('Command input must include command or argv.');
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
function acceptanceRefsForCommand(task: SddTask | null, command: string, acceptanceRefsOverride: string[] | undefined): string[] {
|
|
1132
|
+
if (acceptanceRefsOverride && acceptanceRefsOverride.length > 0) {
|
|
1133
|
+
return [...new Set(acceptanceRefsOverride)];
|
|
1134
|
+
}
|
|
1135
|
+
return [...new Set((task?.validationCommands ?? [])
|
|
1136
|
+
.filter((entry) => entry.command === command)
|
|
1137
|
+
.flatMap((entry) => entry.acceptanceRefs))];
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
function taskAcceptanceRefs(task: SddTask): string[] {
|
|
1141
|
+
const refs = task.acceptanceRefs.length > 0 ? task.acceptanceRefs : task.acceptance;
|
|
1142
|
+
return [...new Set(refs)];
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
function evidenceStatusForMappedSteps(status: SddTestStatus, steps: SddTestCommandStep[]): SddTestStatus {
|
|
1146
|
+
if (steps.some((step) => step.status === 'fail')) {
|
|
1147
|
+
return 'FAIL';
|
|
1148
|
+
}
|
|
1149
|
+
if (status === 'BLOCKED' || steps.some((step) => step.status === 'blocked')) {
|
|
1150
|
+
return 'BLOCKED';
|
|
1151
|
+
}
|
|
1152
|
+
return 'PASS';
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
function renderCommandOutput(commandInput: NormalizedSddTestCommand, status: SddTestStepStatus, executed: { exitCode: number | null; signal: string | null; stdout: string; stderr: string; truncated: boolean; timedOut: boolean; error: string | null }, durationMs: number, cacheStatus: 'hit' | 'miss' | 'unsafe' = 'unsafe', cacheKey: string | null = null, cacheSourceTestRunId: string | null = null, cacheUnsafeReasons: ValidationCacheUnsafeReason[] = []): string {
|
|
1156
|
+
return `# Test Command Output\n\n- command: ${commandInput.command}\n- shell: ${commandInput.shell}\n- argv: ${commandInput.argv ? JSON.stringify(commandInput.argv) : 'none'}\n- status: ${status}\n- exit_code: ${executed.exitCode ?? 'none'}\n- signal: ${executed.signal ?? 'none'}\n- duration_ms: ${durationMs}\n- timed_out: ${executed.timedOut}\n- truncated: ${executed.truncated}\n- error: ${executed.error ?? 'none'}\n- cache_status: ${cacheStatus}\n- cache_key: ${cacheKey ?? 'none'}\n- cache_source_test_run: ${cacheSourceTestRunId ?? 'none'}\n- cache_unsafe_reasons: ${cacheUnsafeReasons.join(',') || 'none'}\n\n## stdout\n\n\`\`\`text\n${executed.stdout}\n\`\`\`\n\n## stderr\n\n\`\`\`text\n${executed.stderr}\n\`\`\`\n`;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
function shouldPersistCommandOutputArtifact(status: SddTestStepStatus, executed: { truncated: boolean; timedOut: boolean; error: string | null }, cacheStatus: 'hit' | 'miss' | 'unsafe', cacheUnsafeReasons: ValidationCacheUnsafeReason[]): boolean {
|
|
1160
|
+
return status !== 'pass' || executed.truncated || executed.timedOut || Boolean(executed.error) || cacheStatus === 'unsafe' || cacheUnsafeReasons.length > 0;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
function renderStepEvidenceRefs(step: SddTestCommandStep): string {
|
|
1164
|
+
const refs = [` - command:${step.stepId}`];
|
|
1165
|
+
if (step.outputArtifact) {
|
|
1166
|
+
refs.push(` - artifact:${step.outputArtifact}`);
|
|
1167
|
+
}
|
|
1168
|
+
return refs.join('\n');
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
|
|
1172
|
+
function summarizeCommandOutput(executed: { exitCode: number | null; signal: string | null; stdout: string; stderr: string; stdoutBytes: number; stderrBytes: number; truncated: boolean; timedOut: boolean; error: string | null }): string {
|
|
1173
|
+
const parts = [
|
|
1174
|
+
`exit=${executed.exitCode ?? 'none'}`,
|
|
1175
|
+
`signal=${executed.signal ?? 'none'}`,
|
|
1176
|
+
`stdout_bytes=${executed.stdoutBytes}`,
|
|
1177
|
+
`stderr_bytes=${executed.stderrBytes}`,
|
|
1178
|
+
`truncated=${executed.truncated}`,
|
|
1179
|
+
`timed_out=${executed.timedOut}`
|
|
1180
|
+
];
|
|
1181
|
+
if (executed.error) {
|
|
1182
|
+
parts.push(`error=${executed.error}`);
|
|
1183
|
+
}
|
|
1184
|
+
return parts.join(' ');
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
|
|
1188
|
+
function hashDocumentContent(raw: string): string {
|
|
1189
|
+
return createHash('sha256').update(raw.replace(/\r\n/g, '\n'), 'utf8').digest('hex');
|
|
1190
|
+
}
|