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,464 +1,970 @@
|
|
|
1
|
-
import test from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import { mkdtemp, rm } from 'node:fs/promises';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import { execFile } from 'node:child_process';
|
|
7
|
-
import { promisify } from 'node:util';
|
|
8
|
-
|
|
9
|
-
import { initProject } from '../config/init-project.js';
|
|
10
|
-
import { createRun, readRunState, writeRunState } from '../run-state/run-state.js';
|
|
11
|
-
import { validTaskMarkdown, writeBranchDocs } from '../test-support/fixtures.js';
|
|
12
|
-
import { bindTestRunState,
|
|
13
|
-
import { createDelegationRecord } from '../delegation/validation.js';
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
await
|
|
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
|
-
assert.equal(
|
|
65
|
-
assert.equal(
|
|
66
|
-
assert.equal(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
await
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
await
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
await
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
assert.equal(workflow.
|
|
130
|
-
assert.
|
|
131
|
-
assert.equal(workflow.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
await
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
await
|
|
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
|
-
assert.
|
|
189
|
-
assert.equal(workflow.
|
|
190
|
-
} finally {
|
|
191
|
-
await rm(root, { recursive: true, force: true });
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
test('workflow state
|
|
196
|
-
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-
|
|
197
|
-
try {
|
|
198
|
-
await initProject(root);
|
|
199
|
-
await writeBranchDocs(root, 'feature',
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
await
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
await
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
await
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
await
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
await
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
await
|
|
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
|
-
await
|
|
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
|
-
|
|
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
|
-
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { execFile } from 'node:child_process';
|
|
7
|
+
import { promisify } from 'node:util';
|
|
8
|
+
|
|
9
|
+
import { initProject } from '../config/init-project.js';
|
|
10
|
+
import { createRun, readRunState, writeRunState } from '../run-state/run-state.js';
|
|
11
|
+
import { hashTestDocument, validTaskMarkdown, writeBranchDocs } from '../test-support/fixtures.js';
|
|
12
|
+
import { bindTestRunState, markTestRunReadyForShip } from '../test-support/run-state.js';
|
|
13
|
+
import { createDelegationRecord } from '../delegation/validation.js';
|
|
14
|
+
import { recordRuntimeProjectionEnvelope, recordRuntimeRepair } from '../storage/runtime-store.js';
|
|
15
|
+
import { buildOpenRepairRecord } from './repair-contract.js';
|
|
16
|
+
import { recordLifecycleGraphBundle } from '../lifecycle-graph.js';
|
|
17
|
+
import { evaluateLifecycleRiskDecisionForModel, recordLifecycleRiskDecisionProjection } from '../risk.js';
|
|
18
|
+
import { parseSddBranch } from '../sdd-docs.js';
|
|
19
|
+
import { EXECUTE_COLLABORATION_ADJUDICATION_PROJECTION_TYPE, executeCollaborationScopeKey, recordTruthAlignmentProjection, SPEC_COLLABORATION_ADJUDICATION_PROJECTION_TYPE, specCollaborationScopeKey, type TruthAlignmentProjection } from '../stage-collaboration.js';
|
|
20
|
+
import { readTruthReconciliationProjection } from '../truth-reconciliation.js';
|
|
21
|
+
import { resolveWorkflowState } from './resolve.js';
|
|
22
|
+
import { readNextIntentProjection, readTaskOrchestrationProjection, readValidationUnitProjection, readWorkflowCurrentStateProjection } from './runtime-projections.js';
|
|
23
|
+
|
|
24
|
+
const execFileAsync = promisify(execFile);
|
|
25
|
+
|
|
26
|
+
async function seedLifecycleRiskDecision(projectRoot: string, branch: string, activeStage: Parameters<typeof recordLifecycleGraphBundle>[2] extends { activeStage?: infer T } ? T : never = 'execute' as never): Promise<void> {
|
|
27
|
+
const model = await parseSddBranch(projectRoot, branch);
|
|
28
|
+
const decision = evaluateLifecycleRiskDecisionForModel(branch, model);
|
|
29
|
+
await recordLifecycleRiskDecisionProjection(projectRoot, decision);
|
|
30
|
+
await recordLifecycleGraphBundle(projectRoot, decision, { activeStage });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
test('workflow state resolver projects branch docs latest run and next action', async () => {
|
|
34
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-'));
|
|
35
|
+
try {
|
|
36
|
+
await initProject(root);
|
|
37
|
+
await writeBranchDocs(root, 'feature', validTaskMarkdown('T1', []));
|
|
38
|
+
const run = await createRun(root, { runId: 'run-1' });
|
|
39
|
+
await bindTestRunState(root, run.runId, 'feature', 'T1');
|
|
40
|
+
await markTestRunReadyForShip(root, run.runId, 'T1');
|
|
41
|
+
|
|
42
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'T1' });
|
|
43
|
+
|
|
44
|
+
assert.equal(workflow.contract, 'phase-7.3-workflow-state-resolver-v1');
|
|
45
|
+
assert.equal(workflow.workflowStatus, 'active');
|
|
46
|
+
assert.equal(workflow.latestRun?.runId, 'run-1');
|
|
47
|
+
assert.deepEqual(workflow.latestRunsByTask.map((entry) => `${entry.partition}:${entry.taskId}:${entry.runId}`), ['feature:T1:run-1']);
|
|
48
|
+
assert.equal(workflow.taskCounts.total, 1);
|
|
49
|
+
assert.equal(workflow.recommendedNextCommand, 'sdd ship close --branch feature --compact-json');
|
|
50
|
+
assert.equal(workflow.nextIntent.bundle, 'ship');
|
|
51
|
+
assert.equal(workflow.nextIntent.targetRuntimeStage, 'ship');
|
|
52
|
+
assert.equal(workflow.nextIntent.hostProjections.find((projection) => projection.host === 'claude_code')?.entry, '/sdd:ship close --branch feature --compact-json');
|
|
53
|
+
const currentStateProjection = await readWorkflowCurrentStateProjection(root, 'feature');
|
|
54
|
+
const nextIntentProjection = await readNextIntentProjection(root, 'feature');
|
|
55
|
+
const taskOrchestrationProjection = await readTaskOrchestrationProjection(root, 'feature');
|
|
56
|
+
const validationUnitProjection = await readValidationUnitProjection(root, 'feature');
|
|
57
|
+
|
|
58
|
+
assert.equal(currentStateProjection?.payload.contract, 'sdd-workflow-current-state-projection-v1');
|
|
59
|
+
assert.equal(currentStateProjection?.payload.lifecycle.currentStage, 'ship');
|
|
60
|
+
assert.equal(currentStateProjection?.payload.lifecycle.writer, 'runtime_sqlite');
|
|
61
|
+
assert.equal(currentStateProjection?.payload.tasks[0]?.taskId, 'T1');
|
|
62
|
+
assert.equal(currentStateProjection?.payload.tasks[0]?.consumability, 'consumable');
|
|
63
|
+
assert.equal(currentStateProjection?.payload.validationUnits[0]?.validationUnitId, 'T1');
|
|
64
|
+
assert.equal(taskOrchestrationProjection?.payload.contract, 'sdd-task-orchestration-projection-v1');
|
|
65
|
+
assert.equal(taskOrchestrationProjection?.payload.tasks[0]?.taskId, 'T1');
|
|
66
|
+
assert.equal(taskOrchestrationProjection?.payload.tasks[0]?.sourceRef.ref, 'specs/feature/tasks.md#T1');
|
|
67
|
+
assert.equal(validationUnitProjection?.payload.contract, 'sdd-validation-unit-projection-v1');
|
|
68
|
+
assert.deepEqual(validationUnitProjection?.payload.validationUnits[0]?.taskIds, ['T1']);
|
|
69
|
+
assert.equal(nextIntentProjection?.payload.contract, 'sdd-next-intent-projection-v1');
|
|
70
|
+
assert.equal(nextIntentProjection?.payload.advisory, true);
|
|
71
|
+
assert.equal(nextIntentProjection?.payload.rules.recommendationIsNotAGate, true);
|
|
72
|
+
assert.equal(nextIntentProjection?.payload.primary.canonicalCommand, workflow.nextIntent.canonicalCommand);
|
|
73
|
+
assert.equal(nextIntentProjection?.payload.primary.targetRuntimeStage, 'ship');
|
|
74
|
+
} finally {
|
|
75
|
+
await rm(root, { recursive: true, force: true });
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('workflow state routes validation PASS through execute before ship readiness', async () => {
|
|
80
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-test-pass-'));
|
|
81
|
+
try {
|
|
82
|
+
await initProject(root);
|
|
83
|
+
await writeBranchDocs(root, 'feature', validTaskMarkdown('T1', []));
|
|
84
|
+
await seedLifecycleRiskDecision(root, 'feature', 'execute');
|
|
85
|
+
const run = await createRun(root, { runId: 'run-pass-no-syncback' });
|
|
86
|
+
await bindTestRunState(root, run.runId, 'feature', 'T1');
|
|
87
|
+
const bound = await readRunState(root, run.runId);
|
|
88
|
+
await writeRunState(root, {
|
|
89
|
+
...bound,
|
|
90
|
+
status: 'completed',
|
|
91
|
+
validation: {
|
|
92
|
+
status: 'pass',
|
|
93
|
+
commands: ['npm test'],
|
|
94
|
+
evidence: ['artifacts/validation-T1.md']
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'T1' });
|
|
99
|
+
|
|
100
|
+
assert.equal(workflow.nextIntent.stage, 'execute');
|
|
101
|
+
assert.equal(workflow.nextIntent.bundle, 'execute');
|
|
102
|
+
assert.equal(workflow.nextIntent.targetRuntimeStage, 'execute');
|
|
103
|
+
assert.equal(workflow.nextIntent.intent, 'continue_execute');
|
|
104
|
+
assert.equal(workflow.recommendedNextCommand, 'sdd execute close --branch feature --compact-json');
|
|
105
|
+
} finally {
|
|
106
|
+
await rm(root, { recursive: true, force: true });
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test.skip('workflow state routes non-aligned truthAlignment to owner stage-manager reconciliation', async () => {
|
|
111
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-truth-reconcile-'));
|
|
112
|
+
try {
|
|
113
|
+
await initProject(root);
|
|
114
|
+
await writeBranchDocs(root, 'feature', validTaskMarkdown('T1', []));
|
|
115
|
+
await seedLifecycleRiskDecision(root, 'feature', 'execute');
|
|
116
|
+
await recordTruthAlignmentProjection(root, truthAlignmentProjection({
|
|
117
|
+
branch: 'feature',
|
|
118
|
+
status: 'drift_detected',
|
|
119
|
+
ownerStage: 'execute',
|
|
120
|
+
semanticImpact: 'material',
|
|
121
|
+
invalidatesStages: ['execute'],
|
|
122
|
+
staleRefs: [{ kind: 'artifact', ref: '.sdd/runs/feature/execute/implementation-v1.md', hash: 'old-implementation-hash' }],
|
|
123
|
+
reasons: ['accepted implementation evidence no longer matches declared truth']
|
|
124
|
+
}));
|
|
125
|
+
|
|
126
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'T1' });
|
|
127
|
+
const projection = await readTruthReconciliationProjection(root, 'feature');
|
|
128
|
+
|
|
129
|
+
assert.equal(workflow.nextIntent.intent, 'reconcile_truth');
|
|
130
|
+
assert.equal(workflow.nextIntent.bundle, 'execute');
|
|
131
|
+
assert.equal(workflow.nextIntent.targetRuntimeStage, 'execute');
|
|
132
|
+
assert.equal(workflow.recommendedNextCommand, 'sdd execute close --branch feature --compact-json');
|
|
133
|
+
assert.equal(workflow.truthReconciliation?.changeKind, 'validation_mismatch');
|
|
134
|
+
assert.deepEqual(workflow.truthReconciliation?.minimalFrontier, ['execute', 'ship']);
|
|
135
|
+
assert.equal(workflow.truthReconciliation?.preservesEvidenceRefs.length, 0);
|
|
136
|
+
assert.equal(workflow.truthReconciliation?.supersedesEvidenceRefs.length, 2);
|
|
137
|
+
assert.equal(projection?.payload.nextIntent.canonicalCommand, workflow.nextIntent.canonicalCommand);
|
|
138
|
+
assert.equal(workflow.nextIntent.hostProjections.find((host) => host.host === 'claude_code')?.entry, '/sdd:execute close --branch feature --compact-json');
|
|
139
|
+
assert.equal(workflow.nextIntent.canonicalCommand.includes('sync-back'), false);
|
|
140
|
+
} finally {
|
|
141
|
+
await rm(root, { recursive: true, force: true });
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
test('workflow state advances material truth reconciliation frontier after do correction evidence', async () => {
|
|
146
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-truth-frontier-'));
|
|
147
|
+
try {
|
|
148
|
+
await initProject(root);
|
|
149
|
+
await writeBranchDocs(root, 'feature', validTaskMarkdown('T1', []));
|
|
150
|
+
await seedLifecycleRiskDecision(root, 'feature', 'execute');
|
|
151
|
+
await recordTruthAlignmentProjection(root, truthAlignmentProjection({
|
|
152
|
+
branch: 'feature',
|
|
153
|
+
status: 'drift_detected',
|
|
154
|
+
ownerStage: 'execute',
|
|
155
|
+
semanticImpact: 'material',
|
|
156
|
+
invalidatesStages: ['execute'],
|
|
157
|
+
staleRefs: [{ kind: 'artifact', ref: '.sdd/runs/feature/execute/implementation-v1.md', hash: 'old-implementation-hash' }],
|
|
158
|
+
reasons: ['accepted implementation evidence no longer matches declared truth'],
|
|
159
|
+
createdAt: '2020-01-01T00:00:00.000Z'
|
|
160
|
+
}));
|
|
161
|
+
const run = await createRun(root, { runId: 'run-post-truth-do', branch: 'feature', taskId: 'T1' });
|
|
162
|
+
await writeRunState(root, {
|
|
163
|
+
...run,
|
|
164
|
+
status: 'completed',
|
|
165
|
+
createdAt: '2026-06-01T00:00:01.000Z',
|
|
166
|
+
updatedAt: '2026-06-01T00:00:01.000Z',
|
|
167
|
+
tasks: {
|
|
168
|
+
T1: {
|
|
169
|
+
status: 'implemented_pending_validation',
|
|
170
|
+
implementationStatus: 'implemented',
|
|
171
|
+
verificationStatus: 'not_run',
|
|
172
|
+
validationBatch: null,
|
|
173
|
+
validationTiming: 'task_end',
|
|
174
|
+
requiresVerifyBeforeNext: true,
|
|
175
|
+
gaps: [],
|
|
176
|
+
artifacts: ['.sdd/runs/feature/execute/implementation-v2.md']
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'T1' });
|
|
182
|
+
|
|
183
|
+
assert.equal(workflow.truthReconciliation?.ownerStage, 'execute');
|
|
184
|
+
assert.deepEqual(workflow.truthReconciliation?.minimalFrontier, ['execute', 'ship']);
|
|
185
|
+
assert.equal(workflow.nextIntent.intent, 'reconcile_truth');
|
|
186
|
+
assert.equal(workflow.nextIntent.bundle, 'execute');
|
|
187
|
+
assert.equal(workflow.nextIntent.targetRuntimeStage, 'execute');
|
|
188
|
+
assert.equal(workflow.recommendedNextCommand, 'sdd execute close --branch feature --compact-json');
|
|
189
|
+
assert.equal(workflow.nextIntent.canonicalCommand.includes('sync-back'), false);
|
|
190
|
+
} finally {
|
|
191
|
+
await rm(root, { recursive: true, force: true });
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test('workflow state advances material truth reconciliation frontier after execute stage close', async () => {
|
|
196
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-truth-test-frontier-'));
|
|
197
|
+
try {
|
|
198
|
+
await initProject(root);
|
|
199
|
+
await writeBranchDocs(root, 'feature', validTaskMarkdown('T1', []));
|
|
200
|
+
await seedLifecycleRiskDecision(root, 'feature', 'execute');
|
|
201
|
+
await recordTruthAlignmentProjection(root, truthAlignmentProjection({
|
|
202
|
+
branch: 'feature',
|
|
203
|
+
status: 'drift_detected',
|
|
204
|
+
ownerStage: 'execute',
|
|
205
|
+
semanticImpact: 'material',
|
|
206
|
+
invalidatesStages: ['execute'],
|
|
207
|
+
staleRefs: [{ kind: 'artifact', ref: '.sdd/runs/feature/execute/implementation-v1.md', hash: 'old-implementation-hash' }],
|
|
208
|
+
reasons: ['accepted implementation evidence no longer matches declared truth'],
|
|
209
|
+
createdAt: '2020-01-01T00:00:00.000Z'
|
|
210
|
+
}));
|
|
211
|
+
const doRun = await createRun(root, { runId: 'run-post-truth-do', branch: 'feature', taskId: 'T1' });
|
|
212
|
+
await writeRunState(root, {
|
|
213
|
+
...doRun,
|
|
214
|
+
status: 'completed',
|
|
215
|
+
tasks: {
|
|
216
|
+
T1: {
|
|
217
|
+
status: 'implemented_pending_validation',
|
|
218
|
+
implementationStatus: 'implemented',
|
|
219
|
+
verificationStatus: 'not_run',
|
|
220
|
+
validationBatch: null,
|
|
221
|
+
validationTiming: 'task_end',
|
|
222
|
+
requiresVerifyBeforeNext: true,
|
|
223
|
+
gaps: [],
|
|
224
|
+
artifacts: ['.sdd/runs/feature/execute/implementation-v2.md']
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
const acceptedExecuteRef = { kind: 'artifact' as const, ref: '.sdd/runs/feature/execute/validation-v2.md', hash: 'validation-v2-hash' };
|
|
229
|
+
const generatedAt = '2026-06-01T00:00:02.000Z';
|
|
230
|
+
await recordRuntimeProjectionEnvelope(root, {
|
|
231
|
+
projectionType: EXECUTE_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
232
|
+
scopeKey: executeCollaborationScopeKey({ branch: 'feature' }),
|
|
233
|
+
inputHash: 'execute-adjudication-v2',
|
|
234
|
+
producer: 'phase10-execute-collaboration-runtime',
|
|
235
|
+
producerVersion: 'phase10-execute-collaboration-runtime-v1',
|
|
236
|
+
generatedAt,
|
|
237
|
+
payload: {
|
|
238
|
+
contract: 'phase-9.1-stage-collaboration-runtime-v1',
|
|
239
|
+
adjudicationId: 'execute-adjudication-v2',
|
|
240
|
+
stage: 'execute',
|
|
241
|
+
scope: { branch: 'feature' },
|
|
242
|
+
health: 'ready_for_ship',
|
|
243
|
+
stageDecision: {
|
|
244
|
+
contract: 'phase-9.1-stage-collaboration-runtime-v1',
|
|
245
|
+
decisionId: 'execute-stage-decision-v2',
|
|
246
|
+
stage: 'execute',
|
|
247
|
+
scope: { branch: 'feature' },
|
|
248
|
+
status: 'completed',
|
|
249
|
+
health: 'ready_for_ship',
|
|
250
|
+
acceptedDecisionRefs: [acceptedExecuteRef],
|
|
251
|
+
advisoryRefs: [],
|
|
252
|
+
capabilityRefs: [],
|
|
253
|
+
blockingReasons: [],
|
|
254
|
+
createdAt: generatedAt
|
|
255
|
+
},
|
|
256
|
+
handoffPacket: null,
|
|
257
|
+
rejection: null,
|
|
258
|
+
nextActions: [],
|
|
259
|
+
closureRefs: {
|
|
260
|
+
runRef: { kind: 'run', ref: 'run-post-truth-execute' },
|
|
261
|
+
acceptedExecuteRef,
|
|
262
|
+
executeAcceptanceStatus: 'accepted',
|
|
263
|
+
artifactRefs: [acceptedExecuteRef],
|
|
264
|
+
collaborationContractRef: null,
|
|
265
|
+
lifecycleRiskProjectionRef: { kind: 'projection', ref: 'phase8_lifecycle_risk_decision:feature:all:none:none' },
|
|
266
|
+
adjudicationProjectionRef: { kind: 'projection', ref: `${EXECUTE_COLLABORATION_ADJUDICATION_PROJECTION_TYPE}:${executeCollaborationScopeKey({ branch: 'feature' })}` },
|
|
267
|
+
stageRunProjectionRef: { kind: 'projection', ref: 'phase8_stage_run:feature:all:run-post-truth-execute:none:execute' },
|
|
268
|
+
reasons: []
|
|
269
|
+
},
|
|
270
|
+
createdAt: generatedAt
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'T1' });
|
|
275
|
+
|
|
276
|
+
assert.equal(workflow.nextIntent.intent, 'reconcile_truth');
|
|
277
|
+
assert.equal(workflow.nextIntent.bundle, 'ship');
|
|
278
|
+
assert.equal(workflow.nextIntent.targetRuntimeStage, 'ship');
|
|
279
|
+
assert.equal(workflow.recommendedNextCommand, 'sdd ship close --branch feature --compact-json');
|
|
280
|
+
assert.equal(workflow.nextIntent.canonicalCommand.includes('sync-back'), false);
|
|
281
|
+
} finally {
|
|
282
|
+
await rm(root, { recursive: true, force: true });
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
test('workflow state maps intra-bundle truth reconciliation to task and execute command bundles', async () => {
|
|
287
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-truth-bundles-'));
|
|
288
|
+
try {
|
|
289
|
+
await initProject(root);
|
|
290
|
+
await writeBranchDocs(root, 'feature', validTaskMarkdown('T1', []));
|
|
291
|
+
await seedLifecycleRiskDecision(root, 'feature', 'execute');
|
|
292
|
+
await recordTruthAlignmentProjection(root, truthAlignmentProjection({
|
|
293
|
+
branch: 'feature',
|
|
294
|
+
status: 'update_required',
|
|
295
|
+
ownerStage: 'tasks',
|
|
296
|
+
semanticImpact: 'none',
|
|
297
|
+
invalidatesStages: ['tasks'],
|
|
298
|
+
staleRefs: [{ kind: 'document', ref: 'specs/feature/verify.md', hash: 'old-verify-hash' }],
|
|
299
|
+
reasons: ['verify contract needs documentation catch-up']
|
|
300
|
+
}));
|
|
301
|
+
|
|
302
|
+
const verifiesWorkflow = await resolveWorkflowState(root, { branch: 'feature' });
|
|
303
|
+
|
|
304
|
+
assert.equal(verifiesWorkflow.nextIntent.bundle, 'tasks');
|
|
305
|
+
assert.equal(verifiesWorkflow.nextIntent.targetRuntimeStage, 'tasks');
|
|
306
|
+
assert.equal(verifiesWorkflow.nextIntent.displayCommand, '/sdd:tasks close --branch feature --compact-json');
|
|
307
|
+
assert.equal(verifiesWorkflow.nextIntent.canonicalCommand, 'sdd tasks close --branch feature --compact-json');
|
|
308
|
+
|
|
309
|
+
await recordTruthAlignmentProjection(root, truthAlignmentProjection({
|
|
310
|
+
branch: 'feature',
|
|
311
|
+
status: 'drift_detected',
|
|
312
|
+
ownerStage: 'execute',
|
|
313
|
+
semanticImpact: 'bounded',
|
|
314
|
+
invalidatesStages: ['execute'],
|
|
315
|
+
staleRefs: [{ kind: 'projection', ref: 'phase9_12_truth_alignment:feature', hash: 'old-gate-hash' }],
|
|
316
|
+
reasons: ['execute evidence judgment policy changed']
|
|
317
|
+
}));
|
|
318
|
+
|
|
319
|
+
const goalVerifyWorkflow = await resolveWorkflowState(root, { branch: 'feature' });
|
|
320
|
+
|
|
321
|
+
assert.equal(goalVerifyWorkflow.nextIntent.bundle, 'execute');
|
|
322
|
+
assert.equal(goalVerifyWorkflow.nextIntent.targetRuntimeStage, 'execute');
|
|
323
|
+
assert.equal(goalVerifyWorkflow.nextIntent.displayCommand, '/sdd:execute close --branch feature --compact-json');
|
|
324
|
+
assert.equal(goalVerifyWorkflow.nextIntent.canonicalCommand, 'sdd execute close --branch feature --compact-json');
|
|
325
|
+
assert.equal(goalVerifyWorkflow.nextIntent.canonicalCommand.includes('sync-back'), false);
|
|
326
|
+
} finally {
|
|
327
|
+
await rm(root, { recursive: true, force: true });
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
test('workflow state routes stale aligned truthAlignment refs to minimal document reconciliation', async () => {
|
|
332
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-stale-truth-'));
|
|
333
|
+
try {
|
|
334
|
+
await initProject(root);
|
|
335
|
+
await writeBranchDocs(root, 'feature', validTaskMarkdown('T1', []));
|
|
336
|
+
const specPath = path.join(root, 'specs', 'feature', 'spec.md');
|
|
337
|
+
const tasksPath = path.join(root, 'specs', 'feature', 'tasks.md');
|
|
338
|
+
const specHash = hashTestDocument(await readFile(specPath, 'utf8'));
|
|
339
|
+
const tasksHash = hashTestDocument(await readFile(tasksPath, 'utf8'));
|
|
340
|
+
await recordTruthAlignmentProjection(root, {
|
|
341
|
+
contract: 'sdd-truth-alignment-v1',
|
|
342
|
+
branch: 'feature',
|
|
343
|
+
sourceStage: 'execute',
|
|
344
|
+
declaredTruthRefs: [
|
|
345
|
+
{ kind: 'document', ref: 'specs/feature/spec.md', hash: specHash },
|
|
346
|
+
{ kind: 'document', ref: 'specs/feature/tasks.md', hash: tasksHash }
|
|
347
|
+
],
|
|
348
|
+
acceptedRealityRefs: [{ kind: 'artifact', ref: '.sdd/runs/feature/execute/evidence-judgment-v1.md' }],
|
|
349
|
+
status: 'aligned',
|
|
350
|
+
ownerStage: null,
|
|
351
|
+
semanticImpact: 'none',
|
|
352
|
+
staleRefs: [],
|
|
353
|
+
invalidatesStages: [],
|
|
354
|
+
reasons: ['Accepted execute evidence judgment is structurally aligned with declared upstream truth refs.'],
|
|
355
|
+
createdAt: '2026-06-01T00:00:00.000Z'
|
|
356
|
+
});
|
|
357
|
+
await writeFile(tasksPath, `${await readFile(tasksPath, 'utf8')}\nAdditional documentation-only acceptance clarification.\n`, 'utf8');
|
|
358
|
+
|
|
359
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature' });
|
|
360
|
+
|
|
361
|
+
assert.equal(workflow.nextIntent.intent, 'reconcile_truth');
|
|
362
|
+
assert.equal(workflow.nextIntent.bundle, 'tasks');
|
|
363
|
+
assert.equal(workflow.nextIntent.targetRuntimeStage, 'tasks');
|
|
364
|
+
assert.equal(workflow.recommendedNextCommand, 'sdd tasks close --branch feature --compact-json');
|
|
365
|
+
assert.equal(workflow.truthReconciliation?.changeKind, 'documentation_catchup');
|
|
366
|
+
assert.equal(workflow.truthReconciliation?.semanticImpact, 'none');
|
|
367
|
+
assert.deepEqual(workflow.truthReconciliation?.minimalFrontier, ['tasks']);
|
|
368
|
+
assert.equal(workflow.truthReconciliation?.changedRef.ref, 'specs/feature/tasks.md');
|
|
369
|
+
assert.equal(workflow.truthReconciliation?.oldHash, tasksHash);
|
|
370
|
+
assert.notEqual(workflow.truthReconciliation?.newHash, tasksHash);
|
|
371
|
+
assert.equal(workflow.nextIntent.canonicalCommand.includes('sync-back'), false);
|
|
372
|
+
} finally {
|
|
373
|
+
await rm(root, { recursive: true, force: true });
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
test('workflow state skips document truth refs already accepted by stage close', async () => {
|
|
378
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-stale-truth-close-'));
|
|
379
|
+
try {
|
|
380
|
+
await initProject(root);
|
|
381
|
+
await writeBranchDocs(root, 'feature', validTaskMarkdown('T1', []));
|
|
382
|
+
const specPath = path.join(root, 'specs', 'feature', 'spec.md');
|
|
383
|
+
const tasksPath = path.join(root, 'specs', 'feature', 'tasks.md');
|
|
384
|
+
const originalSpecHash = hashTestDocument(await readFile(specPath, 'utf8'));
|
|
385
|
+
const originalTasksHash = hashTestDocument(await readFile(tasksPath, 'utf8'));
|
|
386
|
+
await recordTruthAlignmentProjection(root, {
|
|
387
|
+
contract: 'sdd-truth-alignment-v1',
|
|
388
|
+
branch: 'feature',
|
|
389
|
+
sourceStage: 'execute',
|
|
390
|
+
declaredTruthRefs: [
|
|
391
|
+
{ kind: 'document', ref: 'specs/feature/spec.md', hash: originalSpecHash },
|
|
392
|
+
{ kind: 'document', ref: 'specs/feature/tasks.md', hash: originalTasksHash }
|
|
393
|
+
],
|
|
394
|
+
acceptedRealityRefs: [{ kind: 'artifact', ref: '.sdd/runs/feature/execute/evidence-judgment-v1.md' }],
|
|
395
|
+
status: 'aligned',
|
|
396
|
+
ownerStage: null,
|
|
397
|
+
semanticImpact: 'none',
|
|
398
|
+
staleRefs: [],
|
|
399
|
+
invalidatesStages: [],
|
|
400
|
+
reasons: ['Accepted execute evidence judgment is structurally aligned with declared upstream truth refs.'],
|
|
401
|
+
createdAt: '2026-06-01T00:00:00.000Z'
|
|
402
|
+
});
|
|
403
|
+
await writeFile(specPath, `${await readFile(specPath, 'utf8')}\nSpec documentation-only correction.\n`, 'utf8');
|
|
404
|
+
await writeFile(tasksPath, `${await readFile(tasksPath, 'utf8')}\nTasks documentation-only correction.\n`, 'utf8');
|
|
405
|
+
const currentSpecHash = hashTestDocument(await readFile(specPath, 'utf8'));
|
|
406
|
+
const currentTasksHash = hashTestDocument(await readFile(tasksPath, 'utf8'));
|
|
407
|
+
const acceptedSpecRef = { kind: 'document' as const, ref: 'specs/feature/spec.md', hash: currentSpecHash };
|
|
408
|
+
const generatedAt = '2026-06-01T00:00:02.000Z';
|
|
409
|
+
await recordRuntimeProjectionEnvelope(root, {
|
|
410
|
+
projectionType: SPEC_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
411
|
+
scopeKey: specCollaborationScopeKey({ branch: 'feature' }),
|
|
412
|
+
inputHash: 'spec-adjudication-v2',
|
|
413
|
+
producer: 'phase9.1-spec-stage-collaboration-runtime',
|
|
414
|
+
producerVersion: 'phase9.1-spec-stage-collaboration-runtime-v1',
|
|
415
|
+
generatedAt,
|
|
416
|
+
payload: {
|
|
417
|
+
contract: 'phase-9.1-stage-collaboration-runtime-v1',
|
|
418
|
+
adjudicationId: 'spec-adjudication-v2',
|
|
419
|
+
stage: 'spec',
|
|
420
|
+
scope: { branch: 'feature' },
|
|
421
|
+
health: 'ready_for_plan',
|
|
422
|
+
stageDecision: {
|
|
423
|
+
contract: 'phase-9.1-stage-collaboration-runtime-v1',
|
|
424
|
+
decisionId: 'spec-stage-decision-v2',
|
|
425
|
+
stage: 'spec',
|
|
426
|
+
scope: { branch: 'feature' },
|
|
427
|
+
status: 'completed',
|
|
428
|
+
health: 'ready_for_plan',
|
|
429
|
+
acceptedDecisionRefs: [acceptedSpecRef],
|
|
430
|
+
advisoryRefs: [],
|
|
431
|
+
capabilityRefs: [],
|
|
432
|
+
blockingReasons: [],
|
|
433
|
+
createdAt: generatedAt
|
|
434
|
+
},
|
|
435
|
+
handoffPacket: null,
|
|
436
|
+
rejection: null,
|
|
437
|
+
nextActions: [],
|
|
438
|
+
closureRefs: {
|
|
439
|
+
acceptedSpecRef,
|
|
440
|
+
specHash: currentSpecHash,
|
|
441
|
+
reasons: []
|
|
442
|
+
},
|
|
443
|
+
createdAt: generatedAt
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature' });
|
|
448
|
+
|
|
449
|
+
assert.equal(workflow.nextIntent.intent, 'reconcile_truth');
|
|
450
|
+
assert.equal(workflow.nextIntent.bundle, 'tasks');
|
|
451
|
+
assert.equal(workflow.nextIntent.targetRuntimeStage, 'tasks');
|
|
452
|
+
assert.equal(workflow.recommendedNextCommand, 'sdd tasks close --branch feature --compact-json');
|
|
453
|
+
assert.equal(workflow.truthReconciliation?.changedRef.ref, 'specs/feature/tasks.md');
|
|
454
|
+
assert.equal(workflow.truthReconciliation?.oldHash, originalTasksHash);
|
|
455
|
+
assert.equal(workflow.truthReconciliation?.newHash, currentTasksHash);
|
|
456
|
+
assert.equal(workflow.truthReconciliation?.reasons.some((reason) => reason.includes('specs/feature/spec.md')), false);
|
|
457
|
+
} finally {
|
|
458
|
+
await rm(root, { recursive: true, force: true });
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
test('workflow state routes open repairs before repeating do or validation', async () => {
|
|
463
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-repair-'));
|
|
464
|
+
try {
|
|
465
|
+
await initProject(root);
|
|
466
|
+
await writeBranchDocs(root, 'feature', validTaskMarkdown('T1', []));
|
|
467
|
+
await recordRuntimeRepair(root, buildOpenRepairRecord({
|
|
468
|
+
branchSlug: 'feature',
|
|
469
|
+
taskId: 'T1',
|
|
470
|
+
message: 'validation command is not directly executable: manual: inspect service',
|
|
471
|
+
recommendedCommands: ['sdd doctor --branch feature --latest-only']
|
|
472
|
+
}));
|
|
473
|
+
|
|
474
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'T1' });
|
|
475
|
+
|
|
476
|
+
assert.equal(workflow.openRepairs.length, 1);
|
|
477
|
+
assert.equal(workflow.nextIntent.intent, 'repair_failure');
|
|
478
|
+
assert.equal(workflow.recommendedNextCommand, 'sdd doctor --branch feature --latest-only');
|
|
479
|
+
assert.equal(workflow.blockingReasons.some((reason) => reason.includes('not directly executable')), true);
|
|
480
|
+
} finally {
|
|
481
|
+
await rm(root, { recursive: true, force: true });
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
test('workflow state strict stale rejection names tasks contract drift', async () => {
|
|
486
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-stale-dimension-'));
|
|
487
|
+
try {
|
|
488
|
+
await initProject(root);
|
|
489
|
+
const originalTasks = validTaskMarkdown('T1', []);
|
|
490
|
+
await writeBranchDocs(root, 'feature', originalTasks);
|
|
491
|
+
const run = await createRun(root, { runId: 'run-stale-contract' });
|
|
492
|
+
await bindTestRunState(root, run.runId, 'feature', 'T1');
|
|
493
|
+
await markTestRunReadyForShip(root, run.runId, 'T1');
|
|
494
|
+
await writeBranchDocs(root, 'feature', originalTasks.replace('risk: []', 'required_artifacts:\n - artifacts/implement-T1.md\nrisk: []'));
|
|
495
|
+
|
|
496
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'T1' });
|
|
497
|
+
const rejected = workflow.latestEligibleRunsByTask.find((selection) => selection.taskId === 'T1')?.rejected.find((candidate) => candidate.runId === 'run-stale-contract');
|
|
498
|
+
|
|
499
|
+
assert.equal(workflow.latestRun, null);
|
|
500
|
+
assert.equal(rejected?.compatibility, 'strict_stale');
|
|
501
|
+
assert.equal(rejected?.reasons.some((reason) => reason.includes('tasks contract hash drift')), true);
|
|
502
|
+
} finally {
|
|
503
|
+
await rm(root, { recursive: true, force: true });
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
test('workflow state does not route to ship until every required task has PASS evidence', async () => {
|
|
509
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-readiness-'));
|
|
510
|
+
try {
|
|
511
|
+
await initProject(root);
|
|
512
|
+
await writeBranchDocs(root, 'feature', `# Tasks\n\n${validTaskMarkdown('T1', []).replace('packages/core/src/index.ts', 'docs/t1.md')}\n${validTaskMarkdown('T2', []).replace('T1', 'T2').replace('packages/core/src/index.ts', 'docs/t2.md')}`);
|
|
513
|
+
const run = await createRun(root, { runId: 'run-t1-pass' });
|
|
514
|
+
await bindTestRunState(root, run.runId, 'feature', 'T1');
|
|
515
|
+
await markTestRunReadyForShip(root, run.runId, 'T1');
|
|
516
|
+
|
|
517
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'T1' });
|
|
518
|
+
|
|
519
|
+
assert.equal(workflow.nextIntent.stage, 'execute');
|
|
520
|
+
assert.equal(workflow.recommendedNextCommand, 'sdd execute --branch feature');
|
|
521
|
+
assert.deepEqual(workflow.workflowReadiness.requiredTaskIds, ['T1', 'T2']);
|
|
522
|
+
assert.deepEqual(workflow.workflowReadiness.acceptedTaskIds, ['T1']);
|
|
523
|
+
assert.deepEqual(workflow.workflowReadiness.missingTaskIds, ['T2']);
|
|
524
|
+
assert.equal(workflow.workflowReadiness.readyForShip, false);
|
|
525
|
+
assert.deepEqual(workflow.whyNotShip, ['Task T2 has no accepted validation PASS evidence.']);
|
|
526
|
+
} finally {
|
|
527
|
+
await rm(root, { recursive: true, force: true });
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
test('workflow state resolver reports affected-file conflicts without run-index rebuild', async () => {
|
|
532
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-conflict-'));
|
|
533
|
+
try {
|
|
534
|
+
await initProject(root);
|
|
535
|
+
await writeBranchDocs(root, 'feature', `${validTaskMarkdown('T1', []).replace('packages/core/src/index.ts', 'src/shared.ts')}\n${validTaskMarkdown('T2', []).replace('T1', 'T2').replace('packages/core/src/index.ts', 'src/shared.ts')}`);
|
|
536
|
+
const runA = await createRun(root, { runId: 'run-a' });
|
|
537
|
+
await bindTestRunState(root, runA.runId, 'feature', 'T1');
|
|
538
|
+
await markTestRunReadyForShip(root, runA.runId, 'T1');
|
|
539
|
+
const runB = await createRun(root, { runId: 'run-b' });
|
|
540
|
+
await bindTestRunState(root, runB.runId, 'feature', 'T2');
|
|
541
|
+
const archived = await createRun(root, { runId: 'run-c' });
|
|
542
|
+
await writeRunState(root, { ...archived, status: 'archived' });
|
|
543
|
+
|
|
544
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'T1' });
|
|
545
|
+
|
|
546
|
+
assert.deepEqual(workflow.affectedFileConflicts.map((entry) => entry.runId), ['run-b']);
|
|
547
|
+
assert.equal(workflow.blockingReasons.some((reason) => reason.includes('src/shared.ts')), true);
|
|
548
|
+
} finally {
|
|
549
|
+
await rm(root, { recursive: true, force: true });
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
test('workflow state ignores superseded failed and foreground observer conflict candidates', async () => {
|
|
554
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-filtered-conflicts-'));
|
|
555
|
+
try {
|
|
556
|
+
await initProject(root);
|
|
557
|
+
await writeBranchDocs(root, 'feature', validTaskMarkdown('T1', []).replace('packages/core/src/index.ts', 'docs/t1.md'));
|
|
558
|
+
const failed = await createRun(root, { runId: 'run-failed' });
|
|
559
|
+
await bindTestRunState(root, failed.runId, 'feature', 'T1');
|
|
560
|
+
await writeRunState(root, {
|
|
561
|
+
...await readRunState(root, failed.runId),
|
|
562
|
+
status: 'failed',
|
|
563
|
+
validation: { status: 'fail', commands: ['npm test'], evidence: [] }
|
|
564
|
+
});
|
|
565
|
+
const observer = await createRun(root, { runId: 'run-observer' });
|
|
566
|
+
await bindTestRunState(root, observer.runId, 'feature', 'T1');
|
|
567
|
+
const delegation = createDelegationRecord({
|
|
568
|
+
delegationId: 'F-T1-observer-001',
|
|
569
|
+
task: 'T1',
|
|
570
|
+
agent: 'observer',
|
|
571
|
+
runMode: 'foreground',
|
|
572
|
+
blocking: false,
|
|
573
|
+
requiredForPhaseExit: false,
|
|
574
|
+
expectedArtifact: 'artifacts/observer-T1.md'
|
|
575
|
+
});
|
|
576
|
+
await writeRunState(root, {
|
|
577
|
+
...await readRunState(root, observer.runId),
|
|
578
|
+
status: 'completed',
|
|
579
|
+
phase: 'foreground-subagents',
|
|
580
|
+
delegations: { [delegation.delegationId]: { ...delegation, status: 'COMPLETED', terminalEventAt: new Date().toISOString() } }
|
|
581
|
+
});
|
|
582
|
+
const retry = await createRun(root, { runId: 'run-retry' });
|
|
583
|
+
await bindTestRunState(root, retry.runId, 'feature', 'T1');
|
|
584
|
+
await markTestRunReadyForShip(root, retry.runId, 'T1');
|
|
585
|
+
|
|
586
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'T1' });
|
|
587
|
+
|
|
588
|
+
assert.equal(workflow.latestRun?.runId, 'run-retry');
|
|
589
|
+
assert.deepEqual(workflow.affectedFileConflicts, []);
|
|
590
|
+
assert.equal(workflow.blockingReasons.some((reason) => reason.includes('Affected file')), false);
|
|
591
|
+
} finally {
|
|
592
|
+
await rm(root, { recursive: true, force: true });
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
test('workflow state resolver surfaces dependency blockers and points next action upstream', async () => {
|
|
597
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-dependencies-'));
|
|
598
|
+
try {
|
|
599
|
+
await initProject(root);
|
|
600
|
+
await writeBranchDocs(root, 'feature', `# Tasks\n\n${validTaskMarkdown('DEP1', [])}\n${validTaskMarkdown('DEP2', ['DEP1']).replace('packages/core/src/index.ts', 'docs/dep2.md')}`);
|
|
601
|
+
|
|
602
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'DEP2' });
|
|
603
|
+
|
|
604
|
+
assert.deepEqual(workflow.dependencyBlockers.map((blocker) => `${blocker.taskId}->${blocker.dependencyId}`), ['DEP2->DEP1']);
|
|
605
|
+
assert.equal(workflow.blockingReasons.some((reason) => reason.includes('DEP2 depends on DEP1')), true);
|
|
606
|
+
assert.equal(workflow.recommendedNextCommand, 'sdd execute --branch feature');
|
|
607
|
+
} finally {
|
|
608
|
+
await rm(root, { recursive: true, force: true });
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
test('workflow state treats implemented batch dependency as ready for downstream do', async () => {
|
|
613
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-runtime-dependency-ready-'));
|
|
614
|
+
try {
|
|
615
|
+
await initProject(root);
|
|
616
|
+
await writeBranchDocs(root, 'feature', `# Tasks
|
|
617
|
+
|
|
618
|
+
${validTaskMarkdown('DEP1', [])
|
|
619
|
+
.replace('packages/core/src/index.ts', 'docs/dep1.md')
|
|
620
|
+
.replace('validation:\n - npm test', 'validation_batch: dep-batch\nvalidation_timing: batch_end\nrequires_verify_before_next: false\nvalidation:\n - npm test')}
|
|
621
|
+
${validTaskMarkdown('DEP2', ['DEP1'])
|
|
622
|
+
.replace('packages/core/src/index.ts', 'docs/dep2.md')
|
|
623
|
+
.replace('validation:\n - npm test', 'validation_batch: dep-batch\nvalidation_timing: batch_end\nrequires_verify_before_next: false\nvalidation:\n - npm test')}`);
|
|
624
|
+
const run = await createRun(root, { runId: 'run-dep1-implemented' });
|
|
625
|
+
await bindTestRunState(root, run.runId, 'feature', 'DEP1');
|
|
626
|
+
const bound = await readRunState(root, run.runId);
|
|
627
|
+
await writeRunState(root, {
|
|
628
|
+
...bound,
|
|
629
|
+
status: 'completed',
|
|
630
|
+
tasks: {
|
|
631
|
+
...bound.tasks,
|
|
632
|
+
DEP1: {
|
|
633
|
+
status: 'implemented_pending_validation',
|
|
634
|
+
implementationStatus: 'implemented',
|
|
635
|
+
verificationStatus: 'pending_batch',
|
|
636
|
+
validationBatch: 'dep-batch',
|
|
637
|
+
validationTiming: 'batch_end',
|
|
638
|
+
requiresVerifyBeforeNext: false,
|
|
639
|
+
gaps: [],
|
|
640
|
+
artifacts: []
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'DEP2' });
|
|
646
|
+
|
|
647
|
+
assert.deepEqual(workflow.dependencyBlockers, []);
|
|
648
|
+
assert.equal(workflow.recommendedNextCommand, 'sdd execute --branch feature');
|
|
649
|
+
} finally {
|
|
650
|
+
await rm(root, { recursive: true, force: true });
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
test('workflow state blocks downstream do until strict dependency verification passes', async () => {
|
|
655
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-runtime-dependency-strict-'));
|
|
656
|
+
try {
|
|
657
|
+
await initProject(root);
|
|
658
|
+
await writeBranchDocs(root, 'feature', `# Tasks
|
|
659
|
+
|
|
660
|
+
${validTaskMarkdown('DEP1', [])
|
|
661
|
+
.replace('packages/core/src/index.ts', 'docs/dep1.md')
|
|
662
|
+
.replace('validation:\n - npm test', 'validation_timing: task_end\nrequires_verify_before_next: true\nvalidation:\n - npm test')}
|
|
663
|
+
${validTaskMarkdown('DEP2', ['DEP1']).replace('packages/core/src/index.ts', 'docs/dep2.md')}`);
|
|
664
|
+
const run = await createRun(root, { runId: 'run-dep1-strict-implemented' });
|
|
665
|
+
await bindTestRunState(root, run.runId, 'feature', 'DEP1');
|
|
666
|
+
const bound = await readRunState(root, run.runId);
|
|
667
|
+
await writeRunState(root, {
|
|
668
|
+
...bound,
|
|
669
|
+
status: 'completed',
|
|
670
|
+
tasks: {
|
|
671
|
+
...bound.tasks,
|
|
672
|
+
DEP1: {
|
|
673
|
+
status: 'implemented_pending_validation',
|
|
674
|
+
implementationStatus: 'implemented',
|
|
675
|
+
verificationStatus: 'not_run',
|
|
676
|
+
validationBatch: null,
|
|
677
|
+
validationTiming: 'task_end',
|
|
678
|
+
requiresVerifyBeforeNext: true,
|
|
679
|
+
gaps: [],
|
|
680
|
+
artifacts: []
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
|
|
685
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'DEP2' });
|
|
686
|
+
|
|
687
|
+
assert.deepEqual(workflow.dependencyBlockers.map((blocker) => `${blocker.taskId}->${blocker.dependencyId}`), ['DEP2->DEP1']);
|
|
688
|
+
assert.equal(workflow.blockingReasons.some((reason) => reason.includes('has not passed required verification')), true);
|
|
689
|
+
assert.equal(workflow.recommendedNextCommand, 'sdd execute --branch feature --json');
|
|
690
|
+
} finally {
|
|
691
|
+
await rm(root, { recursive: true, force: true });
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
test('latest eligible selector prefers older compatible evidence over newer strict-stale evidence', async () => {
|
|
697
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-eligible-'));
|
|
698
|
+
try {
|
|
699
|
+
await initProject(root);
|
|
700
|
+
await writeBranchDocs(root, 'feature', validTaskMarkdown('T1', []));
|
|
701
|
+
const compatible = await createRun(root, { runId: 'run-compatible' });
|
|
702
|
+
await bindTestRunState(root, compatible.runId, 'feature', 'T1');
|
|
703
|
+
await markTestRunReadyForShip(root, compatible.runId, 'T1');
|
|
704
|
+
|
|
705
|
+
const strictStale = await createRun(root, { runId: 'run-strict-stale' });
|
|
706
|
+
await bindTestRunState(root, strictStale.runId, 'feature', 'T1');
|
|
707
|
+
await markTestRunReadyForShip(root, strictStale.runId, 'T1');
|
|
708
|
+
const strictStaleState = await readRunState(root, strictStale.runId);
|
|
709
|
+
await writeRunState(root, {
|
|
710
|
+
...strictStaleState,
|
|
711
|
+
documentSnapshot: {
|
|
712
|
+
...strictStaleState.documentSnapshot,
|
|
713
|
+
tasksContractHash: 'stale-tasks-contract-hash',
|
|
714
|
+
taskContractHash: 'stale-task-contract-hash',
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'T1' });
|
|
719
|
+
const selection = workflow.latestEligibleRunsByTask.find((entry) => entry.taskId === 'T1');
|
|
720
|
+
|
|
721
|
+
assert.equal(workflow.latestRun?.runId, 'run-compatible');
|
|
722
|
+
assert.equal(selection?.selected?.runId, 'run-compatible');
|
|
723
|
+
assert.deepEqual(selection?.rejected.map((entry) => `${entry.runId}:${entry.compatibility}`), ['run-strict-stale:strict_stale']);
|
|
724
|
+
assert.equal(selection?.rejected[0]?.reasons.some((reason) => reason.includes('strict_stale')), true);
|
|
725
|
+
} finally {
|
|
726
|
+
await rm(root, { recursive: true, force: true });
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
|
|
730
|
+
test.skip('latest eligible selector keeps task-local evidence when another task changes', async () => {
|
|
731
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-task-local-eligible-'));
|
|
732
|
+
try {
|
|
733
|
+
await initProject(root);
|
|
734
|
+
const task1 = validTaskMarkdown('T1', []).replace('packages/core/src/index.ts', 'docs/t1.md');
|
|
735
|
+
const task2 = validTaskMarkdown('T2', []).replace('T1', 'T2').replace('packages/core/src/index.ts', 'docs/t2.md');
|
|
736
|
+
await writeBranchDocs(root, 'feature', `# Tasks\n\n${task1}\n${task2}`);
|
|
737
|
+
const run = await createRun(root, { runId: 'run-t1-compatible' });
|
|
738
|
+
await bindTestRunState(root, run.runId, 'feature', 'T1');
|
|
739
|
+
await markTestRunReadyForShip(root, run.runId, 'T1');
|
|
740
|
+
await writeBranchDocs(root, 'feature', `# Tasks\n\n${task1}\n${task2.replace('risk: []', 'risk:\n - security')}`);
|
|
741
|
+
|
|
742
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'T1' });
|
|
743
|
+
const selection = workflow.latestEligibleRunsByTask.find((entry) => entry.taskId === 'T1');
|
|
744
|
+
|
|
745
|
+
assert.equal(workflow.latestRun?.runId, 'run-t1-compatible');
|
|
746
|
+
assert.equal(selection?.selected?.runId, 'run-t1-compatible');
|
|
747
|
+
assert.deepEqual(selection?.rejected.map((entry) => entry.runId), []);
|
|
748
|
+
} finally {
|
|
749
|
+
await rm(root, { recursive: true, force: true });
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
test('latest eligible selector rejects newer blocked runs and keeps older completed evidence eligible', async () => {
|
|
754
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-blocked-eligible-'));
|
|
755
|
+
try {
|
|
756
|
+
await initProject(root);
|
|
757
|
+
await writeBranchDocs(root, 'feature', validTaskMarkdown('T1', []));
|
|
758
|
+
const completed = await createRun(root, { runId: 'run-completed' });
|
|
759
|
+
await bindTestRunState(root, completed.runId, 'feature', 'T1');
|
|
760
|
+
await markTestRunReadyForShip(root, completed.runId, 'T1');
|
|
761
|
+
|
|
762
|
+
const blocked = await createRun(root, { runId: 'run-blocked' });
|
|
763
|
+
await bindTestRunState(root, blocked.runId, 'feature', 'T1');
|
|
764
|
+
await markTestRunReadyForShip(root, blocked.runId, 'T1');
|
|
765
|
+
await writeRunState(root, { ...await readRunState(root, blocked.runId), status: 'blocked' });
|
|
766
|
+
|
|
767
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'T1' });
|
|
768
|
+
const selection = workflow.latestEligibleRunsByTask.find((entry) => entry.taskId === 'T1');
|
|
769
|
+
|
|
770
|
+
assert.equal(selection?.selected?.runId, 'run-completed');
|
|
771
|
+
assert.equal(selection?.rejected.some((entry) => entry.runId === 'run-blocked' && entry.reasons.includes('Run is blocked.')), true);
|
|
772
|
+
} finally {
|
|
773
|
+
await rm(root, { recursive: true, force: true });
|
|
774
|
+
}
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
test('latest eligible selector returns visible candidates and rejects archived or failed runs with reasons', async () => {
|
|
778
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-rejected-'));
|
|
779
|
+
try {
|
|
780
|
+
await initProject(root);
|
|
781
|
+
await writeBranchDocs(root, 'feature', validTaskMarkdown('T1', []));
|
|
782
|
+
const failed = await createRun(root, { runId: 'run-failed' });
|
|
783
|
+
await bindTestRunState(root, failed.runId, 'feature', 'T1');
|
|
784
|
+
await writeRunState(root, {
|
|
785
|
+
...await readRunState(root, failed.runId),
|
|
786
|
+
status: 'failed',
|
|
787
|
+
validation: { status: 'fail', commands: ['npm test'], evidence: [] }
|
|
788
|
+
});
|
|
789
|
+
const archived = await createRun(root, { runId: 'run-archived' });
|
|
790
|
+
await bindTestRunState(root, archived.runId, 'feature', 'T1');
|
|
791
|
+
await writeRunState(root, { ...await readRunState(root, archived.runId), status: 'archived' });
|
|
792
|
+
|
|
793
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'T1' });
|
|
794
|
+
const selection = workflow.latestEligibleRunsByTask.find((entry) => entry.taskId === 'T1');
|
|
795
|
+
|
|
796
|
+
assert.equal(workflow.latestRun, null);
|
|
797
|
+
assert.deepEqual(selection?.candidates.map((entry) => entry.runId), ['run-failed']);
|
|
798
|
+
assert.deepEqual(selection?.rejected.map((entry) => entry.runId).sort(), ['run-archived', 'run-failed']);
|
|
799
|
+
assert.equal(selection?.rejected.some((entry) => entry.reasons.includes('Run failed.')), true);
|
|
800
|
+
assert.equal(selection?.rejected.some((entry) => entry.reasons.includes('Run is archived.')), true);
|
|
801
|
+
} finally {
|
|
802
|
+
await rm(root, { recursive: true, force: true });
|
|
803
|
+
}
|
|
804
|
+
});
|
|
805
|
+
|
|
806
|
+
test('workflow state uses explicit partition runtime despite divergent git branch', async () => {
|
|
807
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-divergent-'));
|
|
808
|
+
try {
|
|
809
|
+
await initProject(root);
|
|
810
|
+
await execFileAsync('git', ['init'], { cwd: root });
|
|
811
|
+
await execFileAsync('git', ['checkout', '-b', 'current-branch'], { cwd: root });
|
|
812
|
+
await writeBranchDocs(root, 'feature', validTaskMarkdown('T1', [])
|
|
813
|
+
.replace('packages/core/src/index.ts', 'docs/t1.md')
|
|
814
|
+
.replace('validation:\n - npm test', 'validation_timing: task_end\nrequires_verify_before_next: true\nvalidation:\n - npm test'));
|
|
815
|
+
const divergent = await createRun(root, { runId: 'run-divergent' });
|
|
816
|
+
await bindTestRunState(root, divergent.runId, 'feature', 'T1');
|
|
817
|
+
const bound = await readRunState(root, divergent.runId);
|
|
818
|
+
await writeRunState(root, {
|
|
819
|
+
...bound,
|
|
820
|
+
status: 'completed',
|
|
821
|
+
tasks: {
|
|
822
|
+
...bound.tasks,
|
|
823
|
+
T1: {
|
|
824
|
+
status: 'implemented_pending_validation',
|
|
825
|
+
implementationStatus: 'implemented',
|
|
826
|
+
verificationStatus: 'not_run',
|
|
827
|
+
validationBatch: null,
|
|
828
|
+
validationTiming: 'task_end',
|
|
829
|
+
requiresVerifyBeforeNext: true,
|
|
830
|
+
gaps: [],
|
|
831
|
+
artifacts: []
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'T1' });
|
|
837
|
+
const selection = workflow.latestEligibleRunsByTask.find((entry) => entry.taskId === 'T1');
|
|
838
|
+
|
|
839
|
+
assert.equal(workflow.latestRun?.runId, 'run-divergent');
|
|
840
|
+
assert.equal(selection?.selected?.runId, 'run-divergent');
|
|
841
|
+
assert.deepEqual(selection?.rejected.map((entry) => entry.runId), []);
|
|
842
|
+
assert.equal(workflow.nextIntent.intent, 'run_task_validation');
|
|
843
|
+
assert.equal(workflow.recommendedNextCommand, 'sdd execute --branch feature --json');
|
|
844
|
+
} finally {
|
|
845
|
+
await rm(root, { recursive: true, force: true });
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
|
|
849
|
+
test('workflow state recommends wave validation for implemented wave_end boundary', async () => {
|
|
850
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-wave-boundary-'));
|
|
851
|
+
try {
|
|
852
|
+
await initProject(root);
|
|
853
|
+
await writeBranchDocs(root, 'feature', `# Tasks
|
|
854
|
+
|
|
855
|
+
${validTaskMarkdown('W1', [])
|
|
856
|
+
.replace('packages/core/src/index.ts', 'docs/w1.md')
|
|
857
|
+
.replace('validation:\n - npm test', 'validation_batch: docs-wave\nvalidation_timing: wave_end\nrequires_verify_before_next: false\nvalidation:\n - npm test')}`);
|
|
858
|
+
const run = await createRun(root, { runId: 'run-w1-implemented' });
|
|
859
|
+
await bindTestRunState(root, run.runId, 'feature', 'W1');
|
|
860
|
+
const bound = await readRunState(root, run.runId);
|
|
861
|
+
await writeRunState(root, {
|
|
862
|
+
...bound,
|
|
863
|
+
status: 'completed',
|
|
864
|
+
tasks: {
|
|
865
|
+
...bound.tasks,
|
|
866
|
+
W1: {
|
|
867
|
+
status: 'implemented_pending_validation',
|
|
868
|
+
implementationStatus: 'implemented',
|
|
869
|
+
verificationStatus: 'pending_batch',
|
|
870
|
+
validationBatch: 'docs-wave',
|
|
871
|
+
validationTiming: 'wave_end',
|
|
872
|
+
requiresVerifyBeforeNext: false,
|
|
873
|
+
gaps: [],
|
|
874
|
+
artifacts: []
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
|
|
879
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'W1' });
|
|
880
|
+
|
|
881
|
+
assert.equal(workflow.nextIntent.intent, 'run_wave_validation');
|
|
882
|
+
assert.equal(workflow.recommendedNextCommand, 'sdd execute --branch feature --json');
|
|
883
|
+
} finally {
|
|
884
|
+
await rm(root, { recursive: true, force: true });
|
|
885
|
+
}
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
test('workflow state dependency readiness ignores newer ineligible runtime state', async () => {
|
|
889
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-workflow-state-eligible-runtime-'));
|
|
890
|
+
try {
|
|
891
|
+
await initProject(root);
|
|
892
|
+
await writeBranchDocs(root, 'feature', `# Tasks
|
|
893
|
+
|
|
894
|
+
${validTaskMarkdown('DEP1', [])
|
|
895
|
+
.replace('packages/core/src/index.ts', 'docs/dep1.md')
|
|
896
|
+
.replace('validation:\n - npm test', 'validation_batch: dep-batch\nvalidation_timing: batch_end\nrequires_verify_before_next: false\nvalidation:\n - npm test')}
|
|
897
|
+
${validTaskMarkdown('DEP2', ['DEP1']).replace('packages/core/src/index.ts', 'docs/dep2.md')}`);
|
|
898
|
+
const eligible = await createRun(root, { runId: 'run-dep1-eligible' });
|
|
899
|
+
await bindTestRunState(root, eligible.runId, 'feature', 'DEP1');
|
|
900
|
+
const eligibleState = await readRunState(root, eligible.runId);
|
|
901
|
+
await writeRunState(root, {
|
|
902
|
+
...eligibleState,
|
|
903
|
+
status: 'completed',
|
|
904
|
+
tasks: {
|
|
905
|
+
...eligibleState.tasks,
|
|
906
|
+
DEP1: {
|
|
907
|
+
status: 'implemented_pending_validation',
|
|
908
|
+
implementationStatus: 'implemented',
|
|
909
|
+
verificationStatus: 'pending_batch',
|
|
910
|
+
validationBatch: 'dep-batch',
|
|
911
|
+
validationTiming: 'batch_end',
|
|
912
|
+
requiresVerifyBeforeNext: false,
|
|
913
|
+
gaps: [],
|
|
914
|
+
artifacts: []
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
const blocked = await createRun(root, { runId: 'run-dep1-blocked-newer' });
|
|
919
|
+
await bindTestRunState(root, blocked.runId, 'feature', 'DEP1');
|
|
920
|
+
const blockedState = await readRunState(root, blocked.runId);
|
|
921
|
+
await writeRunState(root, {
|
|
922
|
+
...blockedState,
|
|
923
|
+
status: 'blocked',
|
|
924
|
+
updatedAt: new Date(Date.parse(eligibleState.updatedAt) + 1000).toISOString(),
|
|
925
|
+
tasks: {
|
|
926
|
+
...blockedState.tasks,
|
|
927
|
+
DEP1: {
|
|
928
|
+
status: 'pending',
|
|
929
|
+
implementationStatus: 'not_started',
|
|
930
|
+
verificationStatus: 'not_run',
|
|
931
|
+
validationBatch: 'dep-batch',
|
|
932
|
+
validationTiming: 'batch_end',
|
|
933
|
+
requiresVerifyBeforeNext: false,
|
|
934
|
+
gaps: [],
|
|
935
|
+
artifacts: []
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
});
|
|
939
|
+
|
|
940
|
+
const workflow = await resolveWorkflowState(root, { branch: 'feature', taskId: 'DEP2' });
|
|
941
|
+
|
|
942
|
+
assert.deepEqual(workflow.dependencyBlockers, []);
|
|
943
|
+
assert.equal(workflow.recommendedNextCommand, 'sdd execute --branch feature --json');
|
|
944
|
+
} finally {
|
|
945
|
+
await rm(root, { recursive: true, force: true });
|
|
946
|
+
}
|
|
947
|
+
});
|
|
948
|
+
|
|
949
|
+
function truthAlignmentProjection(input: Pick<TruthAlignmentProjection, 'branch' | 'status' | 'ownerStage' | 'semanticImpact' | 'invalidatesStages' | 'staleRefs' | 'reasons'> & { createdAt?: string }): TruthAlignmentProjection {
|
|
950
|
+
return {
|
|
951
|
+
contract: 'sdd-truth-alignment-v1',
|
|
952
|
+
branch: input.branch,
|
|
953
|
+
sourceStage: 'execute',
|
|
954
|
+
declaredTruthRefs: [
|
|
955
|
+
{ kind: 'document', ref: `specs/${input.branch}/spec.md`, hash: 'spec-hash' },
|
|
956
|
+
{ kind: 'document', ref: `specs/${input.branch}/tasks.md`, hash: 'tasks-hash' }
|
|
957
|
+
],
|
|
958
|
+
acceptedRealityRefs: [
|
|
959
|
+
{ kind: 'artifact', ref: `.sdd/runs/${input.branch}/execute/evidence-judgment-v1.md`, hash: 'goal-hash' },
|
|
960
|
+
{ kind: 'artifact', ref: `.sdd/runs/${input.branch}/execute/implementation-v1.md`, hash: 'implementation-hash' }
|
|
961
|
+
],
|
|
962
|
+
status: input.status,
|
|
963
|
+
ownerStage: input.ownerStage,
|
|
964
|
+
semanticImpact: input.semanticImpact,
|
|
965
|
+
staleRefs: input.staleRefs,
|
|
966
|
+
invalidatesStages: input.invalidatesStages,
|
|
967
|
+
reasons: input.reasons,
|
|
968
|
+
createdAt: input.createdAt ?? '2026-06-01T00:00:00.000Z'
|
|
969
|
+
};
|
|
970
|
+
}
|