sdd-agent-platform 0.4.1 → 0.4.2
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 +30 -28
- package/node_modules/@sdd-agent-platform/core/dist/ai-tools.js +67 -69
- package/node_modules/@sdd-agent-platform/core/dist/ai-tools.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/ingestion.js +64 -9
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/ingestion.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-evidence.js +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-evidence.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-result.js +26 -17
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-result.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/config/init-project.d.ts +3 -0
- package/node_modules/@sdd-agent-platform/core/dist/config/init-project.js +12 -9
- 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 +4 -4
- package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.js +12 -25
- 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 +1 -7
- package/node_modules/@sdd-agent-platform/core/dist/context/build-package.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/context/evidence-summary.js +26 -8
- package/node_modules/@sdd-agent-platform/core/dist/context/evidence-summary.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/context/log-worker.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/context/log-worker.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/context-offload/contracts.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/contracts.d.ts +2 -1
- package/node_modules/@sdd-agent-platform/core/dist/contracts.js +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/contracts.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/delegation/model.d.ts +3 -0
- package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.d.ts +3 -0
- package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.js +7 -4
- package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/document-chain.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/document-chain.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/project.js +8 -8
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/project.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/registries.js +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/registries.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-evidence.js +4 -4
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-evidence.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-trust.js +0 -24
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-trust.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/runtime-contracts.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/runtime-contracts.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/doctor.js +178 -58
- package/node_modules/@sdd-agent-platform/core/dist/doctor/doctor.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/evidence/lookup.js +14 -7
- 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/execution/background-executor.js +4 -4
- package/node_modules/@sdd-agent-platform/core/dist/execution/background-executor.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/execution/foreground-subagents.js +3 -3
- package/node_modules/@sdd-agent-platform/core/dist/execution/foreground-subagents.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/execution/host-invocation.js +5 -4
- package/node_modules/@sdd-agent-platform/core/dist/execution/host-invocation.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/execution/resident-worker.js +3 -2
- package/node_modules/@sdd-agent-platform/core/dist/execution/resident-worker.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/execution/stage-team-runtime.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/execution/stage-team-runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/governance/policy.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/governance/policy.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/governance/policy.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/instructions.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/instructions.js +54 -61
- package/node_modules/@sdd-agent-platform/core/dist/instructions.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/decision-gate.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/decision-gate.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.d.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.js +24 -8
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/orchestration/contracts.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.d.ts +12 -2
- package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.js +62 -21
- package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.d.ts +5 -2
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.js +69 -27
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-registry.js +15 -15
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-registry.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-runtime-static.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-runtime-static.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/capability-sources.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.js +9 -9
- package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/eval-learning-context.js +4 -4
- package/node_modules/@sdd-agent-platform/core/dist/registries/eval-learning-context.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/query-status.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/registries/query-status.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/tool-capabilities.js +3 -3
- package/node_modules/@sdd-agent-platform/core/dist/registries/tool-capabilities.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/tool-plugins.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/registries/tool-plugins.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/worker-adapters.js +11 -11
- package/node_modules/@sdd-agent-platform/core/dist/registries/worker-adapters.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/workflow-gates.js +12 -12
- package/node_modules/@sdd-agent-platform/core/dist/registries/workflow-gates.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 +4 -4
- 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 +4 -7
- package/node_modules/@sdd-agent-platform/core/dist/risk/legacy-adapters.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.d.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.js +19 -17
- 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/agent-runtime.d.ts +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/routing.js +45 -15
- 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 +373 -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/runtime-validation.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/router/runtime-validation.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.d.ts +37 -0
- package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.js +235 -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 +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/router.js +2 -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 +126 -9
- package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.d.ts +0 -2
- package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.js +7 -5
- package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/model.d.ts +28 -8
- package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.d.ts +0 -2
- package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.js +1 -3
- package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/run-state.js +37 -27
- 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 +5 -2
- package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.js +53 -14
- 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/run-state.d.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state.js +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/build.js +0 -3
- 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 +5 -44
- 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 +200 -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/document-hashes.d.ts +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.js +97 -10
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.js +8 -6
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.d.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.js +55 -34
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.js.map +1 -1
- 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 +322 -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 +241 -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 +888 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.js +3870 -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.d.ts +44 -1
- package/node_modules/@sdd-agent-platform/core/dist/status/project-status.js +170 -23
- 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 +544 -32
- package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/subagents/contracts.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/subagents/runtime.js +7 -7
- package/node_modules/@sdd-agent-platform/core/dist/subagents/runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/test-support/fixtures.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.js +8 -23
- 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 +138 -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 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.js +28 -53
- 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 +0 -2
- package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.js +10 -50
- package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.d.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.js +159 -150
- 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/test-runtime.d.ts +12 -2
- package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.js +238 -103
- 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/validation-wave.d.ts +18 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.js +27 -5
- package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.js +9 -32
- package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/work-units/contracts.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/evidence-packet.js +228 -15
- 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 +49 -15
- 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 +42 -6
- 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 +4 -5
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.d.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.js +1 -2
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/dependencies.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.d.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.js +72 -6
- 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 +538 -34
- 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 +3 -3
- package/node_modules/@sdd-agent-platform/core/src/ai-tools.test.ts +49 -1
- package/node_modules/@sdd-agent-platform/core/src/ai-tools.ts +67 -69
- package/node_modules/@sdd-agent-platform/core/src/artifacts/ingestion.test.ts +38 -0
- package/node_modules/@sdd-agent-platform/core/src/artifacts/ingestion.ts +65 -9
- package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-evidence.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-result.test.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-result.ts +26 -17
- package/node_modules/@sdd-agent-platform/core/src/config/init-project.test.ts +43 -31
- package/node_modules/@sdd-agent-platform/core/src/config/init-project.ts +14 -11
- package/node_modules/@sdd-agent-platform/core/src/config/project-config.ts +10 -4
- package/node_modules/@sdd-agent-platform/core/src/config/starter-documents.ts +12 -25
- package/node_modules/@sdd-agent-platform/core/src/context/build-package.ts +2 -8
- package/node_modules/@sdd-agent-platform/core/src/context/context-build.test.ts +3 -2
- package/node_modules/@sdd-agent-platform/core/src/context/evidence-summary.ts +27 -8
- package/node_modules/@sdd-agent-platform/core/src/context/log-worker.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/context-offload/contracts.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/contracts.ts +2 -1
- package/node_modules/@sdd-agent-platform/core/src/delegation/model.ts +3 -0
- package/node_modules/@sdd-agent-platform/core/src/delegation/validation.ts +8 -5
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/document-chain.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/project.ts +8 -8
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/registries.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/run-evidence.ts +4 -4
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/run-trust.ts +0 -21
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/runtime-contracts.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/doctor/doctor.test.ts +143 -45
- package/node_modules/@sdd-agent-platform/core/src/doctor/doctor.ts +193 -58
- package/node_modules/@sdd-agent-platform/core/src/evidence/lookup.ts +15 -7
- package/node_modules/@sdd-agent-platform/core/src/evidence-runtime/contracts.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/src/execution/background-executor.test.ts +50 -2
- package/node_modules/@sdd-agent-platform/core/src/execution/background-executor.ts +4 -4
- package/node_modules/@sdd-agent-platform/core/src/execution/foreground-subagents.test.ts +11 -2
- package/node_modules/@sdd-agent-platform/core/src/execution/foreground-subagents.ts +3 -3
- package/node_modules/@sdd-agent-platform/core/src/execution/host-invocation.ts +5 -4
- package/node_modules/@sdd-agent-platform/core/src/execution/resident-worker.test.ts +12 -1
- package/node_modules/@sdd-agent-platform/core/src/execution/resident-worker.ts +3 -2
- package/node_modules/@sdd-agent-platform/core/src/execution/stage-team-runtime.test.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/execution/stage-team-runtime.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/execution/wave-executor.test.ts +10 -0
- package/node_modules/@sdd-agent-platform/core/src/governance/policy.test.ts +8 -0
- package/node_modules/@sdd-agent-platform/core/src/governance/policy.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/instructions.test.ts +33 -18
- package/node_modules/@sdd-agent-platform/core/src/instructions.ts +55 -62
- package/node_modules/@sdd-agent-platform/core/src/lifecycle/decision-gate.test.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/lifecycle/decision-gate.ts +1 -1
- 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 +25 -8
- package/node_modules/@sdd-agent-platform/core/src/orchestration/contracts.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/orchestration/runtime.ts +74 -22
- package/node_modules/@sdd-agent-platform/core/src/phase8-contracts.test.ts +2 -3
- package/node_modules/@sdd-agent-platform/core/src/phase8-risk-kernel.test.ts +3 -3
- package/node_modules/@sdd-agent-platform/core/src/registries/agent-capability-catalog.ts +82 -35
- package/node_modules/@sdd-agent-platform/core/src/registries/agent-registry.ts +15 -15
- package/node_modules/@sdd-agent-platform/core/src/registries/agent-runtime-static.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/registries/capability-sources.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/registries/command-team-runtime.ts +10 -10
- package/node_modules/@sdd-agent-platform/core/src/registries/eval-learning-context.ts +4 -4
- package/node_modules/@sdd-agent-platform/core/src/registries/query-status.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/registries/registries.test.ts +18 -2
- package/node_modules/@sdd-agent-platform/core/src/registries/tool-capabilities.ts +3 -3
- package/node_modules/@sdd-agent-platform/core/src/registries/tool-plugins.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/registries/worker-adapters.ts +11 -11
- package/node_modules/@sdd-agent-platform/core/src/registries/workflow-gates.ts +12 -12
- package/node_modules/@sdd-agent-platform/core/src/risk/contracts.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/risk/kernel.ts +4 -4
- package/node_modules/@sdd-agent-platform/core/src/risk/legacy-adapters.ts +4 -7
- package/node_modules/@sdd-agent-platform/core/src/risk/workflow-gates.ts +20 -18
- package/node_modules/@sdd-agent-platform/core/src/router/agent-runtime-config.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/router/agent-runtime.ts +2 -0
- package/node_modules/@sdd-agent-platform/core/src/router/route-projection.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/router/route-sdd-task.test.ts +241 -4
- package/node_modules/@sdd-agent-platform/core/src/router/routing.ts +47 -15
- package/node_modules/@sdd-agent-platform/core/src/router/runtime-import.ts +453 -0
- package/node_modules/@sdd-agent-platform/core/src/router/runtime-validation.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/router/stage-route-binding.ts +279 -0
- package/node_modules/@sdd-agent-platform/core/src/router.ts +2 -0
- package/node_modules/@sdd-agent-platform/core/src/run-state/artifacts.ts +132 -10
- package/node_modules/@sdd-agent-platform/core/src/run-state/inspect-run.ts +7 -7
- package/node_modules/@sdd-agent-platform/core/src/run-state/model.ts +31 -8
- package/node_modules/@sdd-agent-platform/core/src/run-state/run-index.ts +1 -5
- package/node_modules/@sdd-agent-platform/core/src/run-state/run-state.test.ts +50 -2
- package/node_modules/@sdd-agent-platform/core/src/run-state/run-state.ts +39 -29
- package/node_modules/@sdd-agent-platform/core/src/run-state/task-evidence.ts +62 -16
- 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 +1 -0
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/build.ts +0 -3
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/findings.ts +6 -46
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/model.ts +1 -13
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis.test.ts +0 -2
- package/node_modules/@sdd-agent-platform/core/src/runtime-paths.ts +77 -0
- package/node_modules/@sdd-agent-platform/core/src/runtime-projection-p0.test.ts +96 -0
- package/node_modules/@sdd-agent-platform/core/src/runtime-projection-p0.ts +292 -0
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/document-hashes.ts +109 -10
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/run-binding.ts +8 -6
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-parser.test.ts +123 -1
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-parser.ts +58 -43
- package/node_modules/@sdd-agent-platform/core/src/stage-artifacts.ts +450 -0
- package/node_modules/@sdd-agent-platform/core/src/stage-collaboration-contracts.ts +322 -0
- package/node_modules/@sdd-agent-platform/core/src/stage-collaboration.test.ts +2903 -0
- package/node_modules/@sdd-agent-platform/core/src/stage-collaboration.ts +5831 -0
- package/node_modules/@sdd-agent-platform/core/src/stage-runtime/runtime.test.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/stage-runtime/runtime.ts +9 -1
- package/node_modules/@sdd-agent-platform/core/src/status/project-status.test.ts +239 -16
- package/node_modules/@sdd-agent-platform/core/src/status/project-status.ts +249 -23
- package/node_modules/@sdd-agent-platform/core/src/storage/runtime-store.test.ts +196 -4
- package/node_modules/@sdd-agent-platform/core/src/storage/runtime-store.ts +860 -54
- package/node_modules/@sdd-agent-platform/core/src/subagents/contracts.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/subagents/runtime.test.ts +3 -3
- package/node_modules/@sdd-agent-platform/core/src/subagents/runtime.ts +7 -7
- package/node_modules/@sdd-agent-platform/core/src/test-support/fixtures.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/test-support/run-state.ts +9 -23
- 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 +177 -0
- package/node_modules/@sdd-agent-platform/core/src/verification/goal-verify.test.ts +13 -87
- package/node_modules/@sdd-agent-platform/core/src/verification/goal-verify.ts +27 -56
- package/node_modules/@sdd-agent-platform/core/src/verification/rendering.ts +10 -54
- package/node_modules/@sdd-agent-platform/core/src/verification/review-gate.test.ts +8 -1
- package/node_modules/@sdd-agent-platform/core/src/verification/single-task-loop.test.ts +93 -79
- package/node_modules/@sdd-agent-platform/core/src/verification/single-task-loop.ts +166 -154
- package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.test.ts +100 -47
- package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.ts +265 -107
- 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.test.ts +47 -5
- package/node_modules/@sdd-agent-platform/core/src/verification/validation-wave.ts +48 -5
- package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.test.ts +15 -31
- package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.ts +9 -33
- package/node_modules/@sdd-agent-platform/core/src/work-units/contracts.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/evidence-packet.ts +246 -17
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/hard-checks.test.ts +339 -3
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/hard-checks.ts +53 -14
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/policy.test.ts +45 -8
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/policy.ts +45 -6
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/types.ts +6 -5
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/affected-file-conflicts.ts +1 -3
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/dependencies.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/latest-eligible-run.ts +75 -7
- 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 +518 -25
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve.ts +670 -41
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/runtime-projections.ts +712 -0
- package/package.json +1 -1
- package/packages/cli/dist/args.js +2 -2
- package/packages/cli/dist/args.js.map +1 -1
- package/packages/cli/dist/commands/ai-tools.js +13 -2
- package/packages/cli/dist/commands/ai-tools.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/execution.js +49 -1
- package/packages/cli/dist/commands/execution.js.map +1 -1
- package/packages/cli/dist/commands/governance.js +1 -1
- package/packages/cli/dist/commands/governance.js.map +1 -1
- package/packages/cli/dist/commands/init.js +6 -1
- package/packages/cli/dist/commands/init.js.map +1 -1
- package/packages/cli/dist/commands/lifecycle.js +15 -2
- package/packages/cli/dist/commands/lifecycle.js.map +1 -1
- package/packages/cli/dist/commands/registry/runtime.js +48 -2
- package/packages/cli/dist/commands/registry/runtime.js.map +1 -1
- package/packages/cli/dist/commands/run.js +52 -2
- package/packages/cli/dist/commands/run.js.map +1 -1
- package/packages/cli/dist/commands/stage-close.d.ts +6 -0
- package/packages/cli/dist/commands/stage-close.js +295 -0
- package/packages/cli/dist/commands/stage-close.js.map +1 -0
- package/packages/cli/dist/commands/status.js +68 -2
- package/packages/cli/dist/commands/status.js.map +1 -1
- package/packages/cli/dist/commands/test.js +180 -2
- package/packages/cli/dist/commands/test.js.map +1 -1
- package/packages/cli/dist/commands/verifies.js +7 -5
- package/packages/cli/dist/commands/verifies.js.map +1 -1
- package/packages/cli/dist/commands/verify.js +222 -26
- package/packages/cli/dist/commands/verify.js.map +1 -1
- package/packages/cli/dist/dispatch.js +4 -9
- package/packages/cli/dist/dispatch.js.map +1 -1
- package/packages/cli/dist/help.js +27 -26
- package/packages/cli/dist/help.js.map +1 -1
- package/packages/cli/dist/renderers/doctor.js +1 -1
- package/packages/cli/dist/renderers/doctor.js.map +1 -1
- package/packages/cli/dist/renderers/execution.js +1 -1
- package/packages/cli/dist/renderers/execution.js.map +1 -1
- package/packages/cli/dist/renderers/json.d.ts +1 -0
- package/packages/cli/dist/renderers/json.js +3 -0
- package/packages/cli/dist/renderers/json.js.map +1 -1
- package/packages/cli/dist/renderers/registry-runtime.d.ts +2 -1
- package/packages/cli/dist/renderers/registry-runtime.js +20 -0
- package/packages/cli/dist/renderers/registry-runtime.js.map +1 -1
- package/packages/cli/dist/renderers/router.js +1 -1
- package/packages/cli/dist/renderers/router.js.map +1 -1
- package/packages/cli/dist/renderers/workflow.d.ts +0 -4
- package/packages/cli/dist/renderers/workflow.js +30 -89
- 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 +67 -69
- package/packages/core/dist/ai-tools.js.map +1 -1
- package/packages/core/dist/artifacts/ingestion.js +64 -9
- package/packages/core/dist/artifacts/ingestion.js.map +1 -1
- package/packages/core/dist/artifacts/sdd-evidence.js +0 -1
- package/packages/core/dist/artifacts/sdd-evidence.js.map +1 -1
- package/packages/core/dist/artifacts/sdd-result.js +26 -17
- package/packages/core/dist/artifacts/sdd-result.js.map +1 -1
- package/packages/core/dist/config/init-project.d.ts +3 -0
- package/packages/core/dist/config/init-project.js +12 -9
- 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 +4 -4
- package/packages/core/dist/config/starter-documents.js +12 -25
- 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 +1 -7
- package/packages/core/dist/context/build-package.js.map +1 -1
- package/packages/core/dist/context/evidence-summary.js +26 -8
- package/packages/core/dist/context/evidence-summary.js.map +1 -1
- package/packages/core/dist/context/log-worker.js +2 -2
- package/packages/core/dist/context/log-worker.js.map +1 -1
- package/packages/core/dist/context-offload/contracts.d.ts +1 -1
- package/packages/core/dist/contracts.d.ts +2 -1
- package/packages/core/dist/contracts.js +1 -0
- package/packages/core/dist/contracts.js.map +1 -1
- package/packages/core/dist/delegation/model.d.ts +3 -0
- package/packages/core/dist/delegation/validation.d.ts +3 -0
- package/packages/core/dist/delegation/validation.js +7 -4
- package/packages/core/dist/delegation/validation.js.map +1 -1
- package/packages/core/dist/doctor/checks/document-chain.js +1 -1
- package/packages/core/dist/doctor/checks/document-chain.js.map +1 -1
- package/packages/core/dist/doctor/checks/project.js +8 -8
- package/packages/core/dist/doctor/checks/project.js.map +1 -1
- package/packages/core/dist/doctor/checks/registries.js +0 -1
- package/packages/core/dist/doctor/checks/registries.js.map +1 -1
- package/packages/core/dist/doctor/checks/run-evidence.js +4 -4
- package/packages/core/dist/doctor/checks/run-evidence.js.map +1 -1
- package/packages/core/dist/doctor/checks/run-trust.js +0 -24
- package/packages/core/dist/doctor/checks/run-trust.js.map +1 -1
- package/packages/core/dist/doctor/checks/runtime-contracts.js +1 -1
- package/packages/core/dist/doctor/checks/runtime-contracts.js.map +1 -1
- package/packages/core/dist/doctor/doctor.js +178 -58
- package/packages/core/dist/doctor/doctor.js.map +1 -1
- package/packages/core/dist/evidence/lookup.js +14 -7
- 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/execution/background-executor.js +4 -4
- package/packages/core/dist/execution/background-executor.js.map +1 -1
- package/packages/core/dist/execution/foreground-subagents.js +3 -3
- package/packages/core/dist/execution/foreground-subagents.js.map +1 -1
- package/packages/core/dist/execution/host-invocation.js +5 -4
- package/packages/core/dist/execution/host-invocation.js.map +1 -1
- package/packages/core/dist/execution/resident-worker.js +3 -2
- package/packages/core/dist/execution/resident-worker.js.map +1 -1
- package/packages/core/dist/execution/stage-team-runtime.js +2 -2
- package/packages/core/dist/execution/stage-team-runtime.js.map +1 -1
- package/packages/core/dist/governance/policy.d.ts +1 -1
- package/packages/core/dist/governance/policy.js +1 -1
- package/packages/core/dist/governance/policy.js.map +1 -1
- package/packages/core/dist/instructions.d.ts +1 -1
- package/packages/core/dist/instructions.js +54 -61
- package/packages/core/dist/instructions.js.map +1 -1
- package/packages/core/dist/lifecycle/decision-gate.js +1 -1
- package/packages/core/dist/lifecycle/decision-gate.js.map +1 -1
- package/packages/core/dist/lifecycle/ship.d.ts +1 -0
- package/packages/core/dist/lifecycle/ship.js +24 -8
- package/packages/core/dist/lifecycle/ship.js.map +1 -1
- package/packages/core/dist/orchestration/contracts.d.ts +1 -1
- package/packages/core/dist/orchestration/runtime.d.ts +12 -2
- package/packages/core/dist/orchestration/runtime.js +62 -21
- package/packages/core/dist/orchestration/runtime.js.map +1 -1
- package/packages/core/dist/registries/agent-capability-catalog.d.ts +5 -2
- package/packages/core/dist/registries/agent-capability-catalog.js +69 -27
- package/packages/core/dist/registries/agent-capability-catalog.js.map +1 -1
- package/packages/core/dist/registries/agent-registry.js +15 -15
- package/packages/core/dist/registries/agent-registry.js.map +1 -1
- package/packages/core/dist/registries/agent-runtime-static.js +1 -1
- package/packages/core/dist/registries/agent-runtime-static.js.map +1 -1
- package/packages/core/dist/registries/capability-sources.js +1 -1
- package/packages/core/dist/registries/command-team-runtime.d.ts +1 -1
- package/packages/core/dist/registries/command-team-runtime.js +9 -9
- package/packages/core/dist/registries/command-team-runtime.js.map +1 -1
- package/packages/core/dist/registries/eval-learning-context.js +4 -4
- package/packages/core/dist/registries/eval-learning-context.js.map +1 -1
- package/packages/core/dist/registries/query-status.js +2 -2
- package/packages/core/dist/registries/query-status.js.map +1 -1
- package/packages/core/dist/registries/tool-capabilities.js +3 -3
- package/packages/core/dist/registries/tool-capabilities.js.map +1 -1
- package/packages/core/dist/registries/tool-plugins.js +2 -2
- package/packages/core/dist/registries/tool-plugins.js.map +1 -1
- package/packages/core/dist/registries/worker-adapters.js +11 -11
- package/packages/core/dist/registries/worker-adapters.js.map +1 -1
- package/packages/core/dist/registries/workflow-gates.js +12 -12
- package/packages/core/dist/registries/workflow-gates.js.map +1 -1
- package/packages/core/dist/risk/contracts.d.ts +2 -2
- package/packages/core/dist/risk/kernel.js +4 -4
- package/packages/core/dist/risk/kernel.js.map +1 -1
- package/packages/core/dist/risk/legacy-adapters.js +4 -7
- package/packages/core/dist/risk/legacy-adapters.js.map +1 -1
- package/packages/core/dist/risk/workflow-gates.d.ts +2 -2
- package/packages/core/dist/risk/workflow-gates.js +19 -17
- 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/agent-runtime.d.ts +2 -0
- package/packages/core/dist/router/route-projection.js +1 -1
- package/packages/core/dist/router/route-projection.js.map +1 -1
- package/packages/core/dist/router/routing.js +45 -15
- 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 +373 -0
- package/packages/core/dist/router/runtime-import.js.map +1 -0
- package/packages/core/dist/router/runtime-validation.js +2 -2
- package/packages/core/dist/router/runtime-validation.js.map +1 -1
- package/packages/core/dist/router/stage-route-binding.d.ts +37 -0
- package/packages/core/dist/router/stage-route-binding.js +235 -0
- package/packages/core/dist/router/stage-route-binding.js.map +1 -0
- package/packages/core/dist/router.d.ts +2 -0
- package/packages/core/dist/router.js +2 -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 +126 -9
- package/packages/core/dist/run-state/artifacts.js.map +1 -1
- package/packages/core/dist/run-state/inspect-run.d.ts +0 -2
- package/packages/core/dist/run-state/inspect-run.js +7 -5
- package/packages/core/dist/run-state/inspect-run.js.map +1 -1
- package/packages/core/dist/run-state/model.d.ts +28 -8
- package/packages/core/dist/run-state/run-index.d.ts +0 -2
- package/packages/core/dist/run-state/run-index.js +1 -3
- package/packages/core/dist/run-state/run-index.js.map +1 -1
- package/packages/core/dist/run-state/run-state.js +37 -27
- package/packages/core/dist/run-state/run-state.js.map +1 -1
- package/packages/core/dist/run-state/task-evidence.d.ts +5 -2
- package/packages/core/dist/run-state/task-evidence.js +53 -14
- 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/run-state.d.ts +1 -0
- package/packages/core/dist/run-state.js +1 -0
- package/packages/core/dist/run-state.js.map +1 -1
- package/packages/core/dist/runtime-analysis/build.js +0 -3
- package/packages/core/dist/runtime-analysis/build.js.map +1 -1
- package/packages/core/dist/runtime-analysis/findings.js +5 -44
- 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 +200 -0
- package/packages/core/dist/runtime-projection-p0.js.map +1 -0
- package/packages/core/dist/sdd-docs/document-hashes.d.ts +2 -0
- package/packages/core/dist/sdd-docs/document-hashes.js +97 -10
- package/packages/core/dist/sdd-docs/document-hashes.js.map +1 -1
- package/packages/core/dist/sdd-docs/run-binding.d.ts +1 -1
- package/packages/core/dist/sdd-docs/run-binding.js +8 -6
- package/packages/core/dist/sdd-docs/run-binding.js.map +1 -1
- package/packages/core/dist/sdd-docs/task-parser.d.ts +1 -0
- package/packages/core/dist/sdd-docs/task-parser.js +55 -34
- package/packages/core/dist/sdd-docs/task-parser.js.map +1 -1
- package/packages/core/dist/stage-artifacts.d.ts +55 -0
- package/packages/core/dist/stage-artifacts.js +322 -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 +241 -0
- package/packages/core/dist/stage-collaboration-contracts.js.map +1 -0
- package/packages/core/dist/stage-collaboration.d.ts +888 -0
- package/packages/core/dist/stage-collaboration.js +3870 -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.d.ts +44 -1
- package/packages/core/dist/status/project-status.js +170 -23
- 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 +544 -32
- package/packages/core/dist/storage/runtime-store.js.map +1 -1
- package/packages/core/dist/subagents/contracts.d.ts +1 -1
- package/packages/core/dist/subagents/runtime.js +7 -7
- package/packages/core/dist/subagents/runtime.js.map +1 -1
- package/packages/core/dist/test-support/fixtures.js +1 -1
- package/packages/core/dist/test-support/run-state.d.ts +1 -1
- package/packages/core/dist/test-support/run-state.js +8 -23
- 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 +138 -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 -1
- package/packages/core/dist/verification/goal-verify.js +28 -53
- package/packages/core/dist/verification/goal-verify.js.map +1 -1
- package/packages/core/dist/verification/rendering.d.ts +0 -2
- package/packages/core/dist/verification/rendering.js +10 -50
- package/packages/core/dist/verification/rendering.js.map +1 -1
- package/packages/core/dist/verification/single-task-loop.d.ts +0 -1
- package/packages/core/dist/verification/single-task-loop.js +159 -150
- package/packages/core/dist/verification/single-task-loop.js.map +1 -1
- package/packages/core/dist/verification/test-runtime.d.ts +12 -2
- package/packages/core/dist/verification/test-runtime.js +238 -103
- 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/validation-wave.d.ts +18 -0
- package/packages/core/dist/verification/validation-wave.js +27 -5
- package/packages/core/dist/verification/validation-wave.js.map +1 -1
- package/packages/core/dist/verification/verify-contract.d.ts +1 -1
- package/packages/core/dist/verification/verify-contract.js +9 -32
- package/packages/core/dist/verification/verify-contract.js.map +1 -1
- package/packages/core/dist/work-units/contracts.d.ts +1 -1
- package/packages/core/dist/workflow-gate/evidence-packet.js +228 -15
- package/packages/core/dist/workflow-gate/evidence-packet.js.map +1 -1
- package/packages/core/dist/workflow-gate/hard-checks.js +49 -15
- package/packages/core/dist/workflow-gate/hard-checks.js.map +1 -1
- package/packages/core/dist/workflow-gate/policy.js +42 -6
- package/packages/core/dist/workflow-gate/policy.js.map +1 -1
- package/packages/core/dist/workflow-gate/types.d.ts +4 -5
- package/packages/core/dist/workflow-state/affected-file-conflicts.d.ts +0 -1
- package/packages/core/dist/workflow-state/affected-file-conflicts.js +1 -2
- package/packages/core/dist/workflow-state/affected-file-conflicts.js.map +1 -1
- package/packages/core/dist/workflow-state/dependencies.js +1 -1
- package/packages/core/dist/workflow-state/latest-eligible-run.d.ts +0 -1
- package/packages/core/dist/workflow-state/latest-eligible-run.js +72 -6
- 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 +538 -34
- 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 +3 -3
- 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/dist/sync-back/apply.d.ts +0 -17
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.js +0 -243
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.js.map +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.d.ts +0 -110
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.js +0 -497
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.js.map +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/sync-back.d.ts +0 -2
- package/node_modules/@sdd-agent-platform/core/dist/sync-back.js +0 -3
- package/node_modules/@sdd-agent-platform/core/dist/sync-back.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/packages/cli/dist/commands/artifact.d.ts +0 -6
- package/packages/cli/dist/commands/artifact.js +0 -168
- package/packages/cli/dist/commands/artifact.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/renderers/artifacts.d.ts +0 -5
- package/packages/cli/dist/renderers/artifacts.js +0 -43
- package/packages/cli/dist/renderers/artifacts.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
- package/packages/core/dist/sync-back/apply.d.ts +0 -17
- package/packages/core/dist/sync-back/apply.js +0 -243
- package/packages/core/dist/sync-back/apply.js.map +0 -1
- package/packages/core/dist/sync-back/inspect.d.ts +0 -110
- package/packages/core/dist/sync-back/inspect.js +0 -497
- package/packages/core/dist/sync-back/inspect.js.map +0 -1
- package/packages/core/dist/sync-back.d.ts +0 -2
- package/packages/core/dist/sync-back.js +0 -3
- package/packages/core/dist/sync-back.js.map +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { WORKFLOW_STATE_RESOLVER_CONTRACT_VERSION, type RuntimeProjectionEnvelope, type RuntimeRef, type SddStage } from '../contracts.js';
|
|
4
|
+
import { listRuntimeProjections, listRuntimeRepairs, recordRuntimeProjection, type RuntimeRepairRecord } from '../storage/runtime-store.js';
|
|
3
5
|
import type { RunState, RunStateTaskRuntime, RunSummary } from '../run-state/model.js';
|
|
4
6
|
import { affectedFileConflictsForSelectedRun, type WorkflowAffectedFileConflict } from './affected-file-conflicts.js';
|
|
5
7
|
import { readAllRunStates, summarizeRunState } from '../run-state/run-state.js';
|
|
@@ -7,6 +9,22 @@ import { resolveSddContext, type ContextBranchSource, type ContextResolverContra
|
|
|
7
9
|
import { parseSddBranch, type SddTask, type SddTaskGap, type SddTaskModel } from '../sdd-docs/task-parser.js';
|
|
8
10
|
import { dependencyBlockingReasonsForTask, workflowDependencyBlockers, type WorkflowDependencyBlocker } from './dependencies.js';
|
|
9
11
|
import { selectLatestEligibleRunsByTask, type DocumentCompatibilityClass, type LatestEligibleRunSelection } from './latest-eligible-run.js';
|
|
12
|
+
import {
|
|
13
|
+
DO_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
14
|
+
GOAL_VERIFY_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
15
|
+
PLAN_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
16
|
+
readTruthAlignmentProjection,
|
|
17
|
+
SHIP_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
18
|
+
SPEC_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
19
|
+
TASKS_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
20
|
+
TEST_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
21
|
+
VERIFIES_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
22
|
+
type TruthAlignmentProjection
|
|
23
|
+
} from '../stage-collaboration.js';
|
|
24
|
+
import { buildTruthReconciliationDecision, minimalReworkFrontier, recordTruthReconciliationDecision, truthDriftClassForAlignment, truthReconciliationOwnerStage, type TruthReconciliationDecision } from '../truth-reconciliation.js';
|
|
25
|
+
import { normalizePortablePath } from '../path-safety.js';
|
|
26
|
+
import { hashDocumentContent } from '../sdd-docs/document-hashes.js';
|
|
27
|
+
import { recordWorkflowRuntimeProjections } from './runtime-projections.js';
|
|
10
28
|
|
|
11
29
|
export interface WorkflowTaskCounts {
|
|
12
30
|
total: number;
|
|
@@ -26,7 +44,6 @@ export interface WorkflowLatestTaskRun {
|
|
|
26
44
|
runId: string;
|
|
27
45
|
runStatus: RunState['status'];
|
|
28
46
|
validationStatus: RunState['validation']['status'];
|
|
29
|
-
syncBackStatus: RunState['syncBack']['status'];
|
|
30
47
|
affectedFiles: string[];
|
|
31
48
|
updatedAt: string;
|
|
32
49
|
compatibility: DocumentCompatibilityClass;
|
|
@@ -36,8 +53,42 @@ export interface WorkflowLatestTaskRun {
|
|
|
36
53
|
|
|
37
54
|
export type WorkflowCommandSemantics = 'inspection_navigation' | 'gate_execution';
|
|
38
55
|
export type WorkflowHostProjectionStatus = 'active' | 'future' | 'unsupported';
|
|
39
|
-
export type
|
|
40
|
-
export type
|
|
56
|
+
export type SddCommandBundle = 'spec' | 'plan' | 'tasks' | 'do' | 'test' | 'ship';
|
|
57
|
+
export type BundleResumeMode = 'start' | 'resume' | 'repair' | 'reconcile';
|
|
58
|
+
export type WorkflowNextStage = SddCommandBundle;
|
|
59
|
+
export type WorkflowNextIntentKind = 'start_spec' | 'resolve_task_gaps' | 'inspect_dependency' | 'workflow_complete' | 'ship_readiness' | 'inspect_task' | 'list_tasks' | 'continue_do' | 'run_task_validation' | 'run_batch_validation' | 'run_wave_validation' | 'run_verifies' | 'run_goal_verify' | 'repair_failure' | 'reconcile_truth';
|
|
60
|
+
|
|
61
|
+
export const COMMAND_BUNDLES: Record<SddCommandBundle, readonly SddStage[]> = {
|
|
62
|
+
spec: ['spec'],
|
|
63
|
+
plan: ['plan'],
|
|
64
|
+
tasks: ['tasks', 'verifies'],
|
|
65
|
+
do: ['do'],
|
|
66
|
+
test: ['test', 'goal-verify'],
|
|
67
|
+
ship: ['ship']
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export interface CommandBundlePlan {
|
|
71
|
+
contract: 'sdd-command-bundle-plan-v1';
|
|
72
|
+
branch: string;
|
|
73
|
+
bundle: SddCommandBundle;
|
|
74
|
+
stages: SddStage[];
|
|
75
|
+
targetRuntimeStage: SddStage;
|
|
76
|
+
resumeMode: BundleResumeMode;
|
|
77
|
+
canonicalCommand: string;
|
|
78
|
+
displayCommand: string;
|
|
79
|
+
canAutoAdvanceWithinBundle: boolean;
|
|
80
|
+
autoAdvanceTo: SddStage | null;
|
|
81
|
+
stopReasons: string[];
|
|
82
|
+
evidenceSurface: string[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface WorkflowReadinessSummary {
|
|
86
|
+
requiredTaskIds: string[];
|
|
87
|
+
acceptedTaskIds: string[];
|
|
88
|
+
missingTaskIds: string[];
|
|
89
|
+
readyForShip: boolean;
|
|
90
|
+
whyNotShip: string[];
|
|
91
|
+
}
|
|
41
92
|
|
|
42
93
|
export interface WorkflowHostCommandProjection {
|
|
43
94
|
host: 'claude_code' | 'codex' | 'opencode';
|
|
@@ -50,11 +101,20 @@ export interface WorkflowHostCommandProjection {
|
|
|
50
101
|
|
|
51
102
|
export interface WorkflowNextIntent {
|
|
52
103
|
stage: WorkflowNextStage;
|
|
104
|
+
bundle: SddCommandBundle;
|
|
105
|
+
targetRuntimeStage: SddStage;
|
|
106
|
+
resumeMode: BundleResumeMode;
|
|
53
107
|
intent: WorkflowNextIntentKind;
|
|
54
108
|
canonicalCommand: string;
|
|
109
|
+
displayCommand: string;
|
|
55
110
|
commandSemantics: WorkflowCommandSemantics;
|
|
56
111
|
evidenceRequirement: string;
|
|
57
112
|
blockingReason: string | null;
|
|
113
|
+
canAutoAdvanceWithinBundle: boolean;
|
|
114
|
+
autoAdvanceTo: SddStage | null;
|
|
115
|
+
stopReasons: string[];
|
|
116
|
+
evidenceSurface: string[];
|
|
117
|
+
commandBundle: CommandBundlePlan;
|
|
58
118
|
hostProjections: WorkflowHostCommandProjection[];
|
|
59
119
|
}
|
|
60
120
|
|
|
@@ -76,14 +136,18 @@ export interface WorkflowStateResolution {
|
|
|
76
136
|
affectedFileConflicts: WorkflowAffectedFileConflict[];
|
|
77
137
|
blockingReasons: string[];
|
|
78
138
|
dependencyBlockers: WorkflowDependencyBlocker[];
|
|
139
|
+
openRepairs: RuntimeRepairRecord[];
|
|
140
|
+
workflowReadiness: WorkflowReadinessSummary;
|
|
141
|
+
whyNotShip: string[];
|
|
79
142
|
recommendedNextCommand: string;
|
|
80
143
|
nextIntent: WorkflowNextIntent;
|
|
144
|
+
truthReconciliation: TruthReconciliationDecision | null;
|
|
81
145
|
}
|
|
82
146
|
|
|
83
147
|
export async function resolveWorkflowState(projectRoot: string, options: { branch?: string | null; branchSource?: ContextBranchSource; taskId?: string | null } = {}): Promise<WorkflowStateResolution> {
|
|
84
148
|
const context = await resolveSddContext(projectRoot, options);
|
|
85
149
|
const branch = context.partition;
|
|
86
|
-
const [model, states] = await Promise.all([parseSddBranch(projectRoot, branch), readAllRunStates(projectRoot)]);
|
|
150
|
+
const [model, states, openRepairs, truthAlignmentEnvelope] = await Promise.all([parseSddBranch(projectRoot, branch), readAllRunStates(projectRoot), listRuntimeRepairs(projectRoot, { branchSlug: branch, status: 'open' }), readTruthAlignmentProjection(projectRoot, { branch })]);
|
|
87
151
|
const visibleGaps = workflowIsActive(model) ? model.gaps : [];
|
|
88
152
|
const latestEligibleRunsByTask = selectLatestEligibleRunsByTask({ states, model, partition: branch, currentGitBranch: context.currentGitBranch });
|
|
89
153
|
const latestRunsByTask = selectedLatestTaskRuns(latestEligibleRunsByTask);
|
|
@@ -94,10 +158,13 @@ export async function resolveWorkflowState(projectRoot: string, options: { branc
|
|
|
94
158
|
const affectedFileConflicts = latestRunState ? affectedFileConflictsForSelectedRun(states, latestRunState) : [];
|
|
95
159
|
const runtimeByTask = latestRuntimeTaskStates(latestEligibleRunsByTask, states);
|
|
96
160
|
const dependencyBlockers = workflowDependencyBlockers(model, { runtimeByTask });
|
|
97
|
-
const
|
|
161
|
+
const readiness = workflowReadinessSummary(model, latestRunsByTask);
|
|
162
|
+
const generatedAt = new Date().toISOString();
|
|
163
|
+
const blockingReasons = [...blockingWorkflowReasons(visibleGaps, affectedFileConflicts, dependencyBlockers), ...openRepairs.map(formatOpenRepairReason)];
|
|
164
|
+
const truthReconciliation = await resolveTruthReconciliationDecision(projectRoot, branch, truthAlignmentEnvelope?.payload ?? null, generatedAt, { states, model });
|
|
98
165
|
const resolution: WorkflowStateResolution = {
|
|
99
166
|
contract: WORKFLOW_STATE_RESOLVER_CONTRACT_VERSION,
|
|
100
|
-
generatedAt
|
|
167
|
+
generatedAt,
|
|
101
168
|
branch,
|
|
102
169
|
workflowStatus: workflowIsActive(model) ? 'active' : 'not_started',
|
|
103
170
|
context,
|
|
@@ -111,13 +178,18 @@ export async function resolveWorkflowState(projectRoot: string, options: { branc
|
|
|
111
178
|
latestEligibleRunsByTask,
|
|
112
179
|
affectedFileConflicts,
|
|
113
180
|
dependencyBlockers,
|
|
181
|
+
openRepairs,
|
|
114
182
|
blockingReasons,
|
|
115
|
-
|
|
183
|
+
workflowReadiness: readiness,
|
|
184
|
+
whyNotShip: readiness.whyNotShip,
|
|
185
|
+
nextIntent: recommendedWorkflowNextIntent(context, model, latestRunsByTask, visibleGaps, dependencyBlockers, runtimeByTask, readiness, openRepairs, truthReconciliation),
|
|
186
|
+
truthReconciliation,
|
|
116
187
|
recommendedNextCommand: ''
|
|
117
188
|
};
|
|
118
189
|
resolution.recommendedNextCommand = resolution.nextIntent.canonicalCommand;
|
|
119
190
|
try {
|
|
120
191
|
await recordRuntimeProjection(projectRoot, 'workflow_state', branch, projectWorkflowStateProjection(resolution));
|
|
192
|
+
await recordWorkflowRuntimeProjections(projectRoot, resolution);
|
|
121
193
|
} catch {
|
|
122
194
|
// Projection writes are rebuildable and must not block workflow resolution.
|
|
123
195
|
}
|
|
@@ -151,7 +223,6 @@ function selectedLatestTaskRuns(selections: LatestEligibleRunSelection[]): Workf
|
|
|
151
223
|
runId: candidate.runId,
|
|
152
224
|
runStatus: candidate.runStatus,
|
|
153
225
|
validationStatus: candidate.validationStatus,
|
|
154
|
-
syncBackStatus: candidate.syncBackStatus,
|
|
155
226
|
affectedFiles: candidate.affectedFiles,
|
|
156
227
|
updatedAt: candidate.updatedAt,
|
|
157
228
|
compatibility: candidate.compatibility,
|
|
@@ -173,13 +244,399 @@ function blockingWorkflowReasons(gaps: SddTaskGap[], conflicts: WorkflowAffected
|
|
|
173
244
|
return reasons;
|
|
174
245
|
}
|
|
175
246
|
|
|
247
|
+
async function resolveTruthReconciliationDecision(projectRoot: string, branch: string, truthAlignment: TruthAlignmentProjection | null, generatedAt: string, progress: { states: RunState[]; model: SddTaskModel }): Promise<TruthReconciliationDecision | null> {
|
|
248
|
+
if (!truthAlignment) {
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
const freshness = await refreshAlignedTruthAlignmentFreshness(projectRoot, branch, truthAlignment);
|
|
252
|
+
if (freshness.truthAlignment.status === 'aligned') {
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
const changeKind = truthDriftClassForAlignment(freshness.truthAlignment);
|
|
256
|
+
const ownerStage = truthReconciliationOwnerStage(changeKind, freshness.truthAlignment.ownerStage);
|
|
257
|
+
const minimalFrontier = minimalReworkFrontier({ ownerStage, semanticImpact: freshness.truthAlignment.semanticImpact, invalidatesStages: freshness.truthAlignment.invalidatesStages });
|
|
258
|
+
const targetStage = await activeTruthReconciliationStage(projectRoot, minimalFrontier, freshness.truthAlignment, progress);
|
|
259
|
+
const nextIntent = truthReconciliationNextIntent(branch, targetStage, freshness.truthAlignment.reasons);
|
|
260
|
+
const decision = buildTruthReconciliationDecision({
|
|
261
|
+
truthAlignment: freshness.truthAlignment,
|
|
262
|
+
nextIntent,
|
|
263
|
+
changeKind,
|
|
264
|
+
changedRef: freshness.changedRef,
|
|
265
|
+
oldHash: freshness.oldHash,
|
|
266
|
+
newHash: freshness.newHash
|
|
267
|
+
});
|
|
268
|
+
await recordTruthReconciliationDecision(projectRoot, decision, generatedAt);
|
|
269
|
+
return decision;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
interface TruthAlignmentFreshness {
|
|
273
|
+
truthAlignment: TruthAlignmentProjection;
|
|
274
|
+
changedRef?: RuntimeRef;
|
|
275
|
+
oldHash?: string;
|
|
276
|
+
newHash?: string;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
async function refreshAlignedTruthAlignmentFreshness(projectRoot: string, branch: string, truthAlignment: TruthAlignmentProjection): Promise<TruthAlignmentFreshness> {
|
|
280
|
+
if (truthAlignment.status !== 'aligned') {
|
|
281
|
+
return { truthAlignment };
|
|
282
|
+
}
|
|
283
|
+
const staleRefs: Array<{ ref: RuntimeRef; currentHash: string }> = [];
|
|
284
|
+
for (const ref of [...truthAlignment.declaredTruthRefs, ...truthAlignment.acceptedRealityRefs]) {
|
|
285
|
+
if (!ref.hash || ref.kind === 'projection' || ref.kind === 'run') {
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
const currentHash = await currentTruthRefHash(projectRoot, ref);
|
|
289
|
+
if (currentHash !== ref.hash) {
|
|
290
|
+
staleRefs.push({ ref, currentHash });
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
const unresolvedStaleRefs = await unresolvedStaleTruthRefs(projectRoot, branch, truthAlignment, staleRefs);
|
|
294
|
+
const firstStaleRef = unresolvedStaleRefs[0];
|
|
295
|
+
if (!firstStaleRef) {
|
|
296
|
+
return { truthAlignment };
|
|
297
|
+
}
|
|
298
|
+
const ownerStage = ownerStageForTruthRef(branch, firstStaleRef.ref) ?? truthAlignment.ownerStage ?? 'ship';
|
|
299
|
+
const semanticImpact = semanticImpactForTruthRef(branch, firstStaleRef.ref);
|
|
300
|
+
const reasons = [
|
|
301
|
+
...truthAlignment.reasons,
|
|
302
|
+
...unresolvedStaleRefs.map((entry) => `TruthAlignment ref hash is stale for ${entry.ref.ref}: expected ${entry.ref.hash ?? 'unknown'}, actual ${entry.currentHash}.`)
|
|
303
|
+
];
|
|
304
|
+
return {
|
|
305
|
+
truthAlignment: {
|
|
306
|
+
...truthAlignment,
|
|
307
|
+
status: 'update_required',
|
|
308
|
+
ownerStage,
|
|
309
|
+
semanticImpact,
|
|
310
|
+
staleRefs: uniqueRuntimeRefs([...truthAlignment.staleRefs, ...unresolvedStaleRefs.map((entry) => entry.ref)]),
|
|
311
|
+
invalidatesStages: uniqueStages([...truthAlignment.invalidatesStages, ownerStage]),
|
|
312
|
+
reasons: uniqueStrings(reasons)
|
|
313
|
+
},
|
|
314
|
+
changedRef: firstStaleRef.ref,
|
|
315
|
+
oldHash: firstStaleRef.ref.hash,
|
|
316
|
+
newHash: firstStaleRef.currentHash
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
async function unresolvedStaleTruthRefs(projectRoot: string, branch: string, truthAlignment: TruthAlignmentProjection, staleRefs: Array<{ ref: RuntimeRef; currentHash: string }>): Promise<Array<{ ref: RuntimeRef; currentHash: string }>> {
|
|
321
|
+
const unresolved: Array<{ ref: RuntimeRef; currentHash: string }> = [];
|
|
322
|
+
for (const entry of staleRefs) {
|
|
323
|
+
if (!await staleTruthRefReconciledAfterAlignment(projectRoot, branch, truthAlignment, entry)) {
|
|
324
|
+
unresolved.push(entry);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return unresolved;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
async function staleTruthRefReconciledAfterAlignment(projectRoot: string, branch: string, truthAlignment: TruthAlignmentProjection, entry: { ref: RuntimeRef; currentHash: string }): Promise<boolean> {
|
|
331
|
+
const stage = ownerStageForTruthRef(branch, entry.ref);
|
|
332
|
+
return stage ? await stageCloseAcceptedTruthRefAfterTruthAlignment(projectRoot, truthAlignment, stage, entry.ref, entry.currentHash) : false;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
async function activeTruthReconciliationStage(projectRoot: string, frontier: SddStage[], truthAlignment: TruthAlignmentProjection, progress: { states: RunState[]; model: SddTaskModel }): Promise<SddStage> {
|
|
336
|
+
for (const stage of frontier) {
|
|
337
|
+
if (!await truthReconciliationStageCompleted(projectRoot, stage, truthAlignment, progress)) {
|
|
338
|
+
return stage;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return frontier[frontier.length - 1] ?? truthAlignment.ownerStage ?? 'ship';
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
async function truthReconciliationStageCompleted(projectRoot: string, stage: SddStage, truthAlignment: TruthAlignmentProjection, progress: { states: RunState[]; model: SddTaskModel }): Promise<boolean> {
|
|
345
|
+
if (await stageCloseCompletedAfterTruthAlignment(projectRoot, truthAlignment, stage)) {
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
348
|
+
const taskIds = reconciliationTaskIds(truthAlignment, progress);
|
|
349
|
+
if (stage === 'do') {
|
|
350
|
+
return taskIds.every((taskId) => progress.states.some((state) => stateAfterTruthAlignment(state, truthAlignment) && stateTaskImplemented(state.tasks[taskId])));
|
|
351
|
+
}
|
|
352
|
+
if (stage === 'test') {
|
|
353
|
+
return taskIds.every((taskId) => progress.states.some((state) => stateAfterTruthAlignment(state, truthAlignment) && stateTaskValidationPassed(state.tasks[taskId], state)));
|
|
354
|
+
}
|
|
355
|
+
if (stage === 'goal-verify') {
|
|
356
|
+
return truthAlignment.status === 'aligned';
|
|
357
|
+
}
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
function reconciliationTaskIds(truthAlignment: TruthAlignmentProjection, progress: { states: RunState[]; model: SddTaskModel }): string[] {
|
|
362
|
+
const requiredIds = requiredTaskIds(progress.model);
|
|
363
|
+
const requiredIdSet = new Set(requiredIds);
|
|
364
|
+
const targetRefs = new Set([...truthAlignment.staleRefs, ...truthAlignment.acceptedRealityRefs].map((ref) => normalizePortablePath(ref.ref)).filter(Boolean));
|
|
365
|
+
const taskIds = new Set<string>();
|
|
366
|
+
for (const state of progress.states) {
|
|
367
|
+
if (state.partition && state.partition !== truthAlignment.branch) {
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
if (!stateReferencesAnyRef(state, targetRefs)) {
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
for (const taskId of stateTaskIds(state)) {
|
|
374
|
+
if (requiredIdSet.has(taskId)) {
|
|
375
|
+
taskIds.add(taskId);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
const scopedTaskIds = [...taskIds].sort();
|
|
380
|
+
return scopedTaskIds.length > 0 ? scopedTaskIds : requiredIds;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function stateReferencesAnyRef(state: RunState, targetRefs: Set<string>): boolean {
|
|
384
|
+
if (targetRefs.size === 0) {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
const refs = [
|
|
388
|
+
...state.artifacts.map((artifact) => artifact.path),
|
|
389
|
+
...Object.values(state.tasks).flatMap((runtime) => [...(runtime.artifacts ?? []), ...(runtime.evidence ?? [])])
|
|
390
|
+
];
|
|
391
|
+
return refs.some((ref) => refMatchesTarget(ref, targetRefs));
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function refMatchesTarget(ref: string, targetRefs: Set<string>): boolean {
|
|
395
|
+
const normalized = normalizePortablePath(ref);
|
|
396
|
+
return Boolean(normalized && [...targetRefs].some((target) => normalized === target || normalized.endsWith(`/${target}`) || target.endsWith(`/${normalized}`)));
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function stateTaskIds(state: RunState): string[] {
|
|
400
|
+
return [...new Set([state.taskId, state.currentTask, ...Object.keys(state.tasks)].filter((taskId): taskId is string => typeof taskId === 'string' && taskId.length > 0))];
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
async function stageCloseCompletedAfterTruthAlignment(projectRoot: string, truthAlignment: TruthAlignmentProjection, stage: SddStage): Promise<boolean> {
|
|
404
|
+
const projectionType = stageAdjudicationProjectionType(stage);
|
|
405
|
+
if (!projectionType) {
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
const projections = await listRuntimeProjections(projectRoot, [projectionType]);
|
|
409
|
+
return projections
|
|
410
|
+
.map((projection) => projection.payload as RuntimeProjectionEnvelope<StageCloseAdjudicationProjection>)
|
|
411
|
+
.some((envelope) => stageAdjudicationCompletedAfterTruthAlignment(envelope, truthAlignment, stage));
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
interface StageCloseAdjudicationProjection {
|
|
415
|
+
stage?: SddStage;
|
|
416
|
+
scope?: { branch?: string };
|
|
417
|
+
health?: string | null;
|
|
418
|
+
stageDecision?: { status?: string | null; health?: string | null; acceptedDecisionRefs?: RuntimeRef[] };
|
|
419
|
+
closureRefs?: Record<string, unknown>;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
function stageAdjudicationProjectionType(stage: SddStage): string | null {
|
|
423
|
+
const projectionTypes: Record<SddStage, string> = {
|
|
424
|
+
spec: SPEC_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
425
|
+
plan: PLAN_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
426
|
+
tasks: TASKS_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
427
|
+
verifies: VERIFIES_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
428
|
+
do: DO_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
429
|
+
test: TEST_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
430
|
+
'goal-verify': GOAL_VERIFY_COLLABORATION_ADJUDICATION_PROJECTION_TYPE,
|
|
431
|
+
ship: SHIP_COLLABORATION_ADJUDICATION_PROJECTION_TYPE
|
|
432
|
+
};
|
|
433
|
+
return projectionTypes[stage] ?? null;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
async function stageCloseAcceptedTruthRefAfterTruthAlignment(projectRoot: string, truthAlignment: TruthAlignmentProjection, stage: SddStage, staleRef: RuntimeRef, currentHash: string): Promise<boolean> {
|
|
437
|
+
const projectionType = stageAdjudicationProjectionType(stage);
|
|
438
|
+
if (!projectionType) {
|
|
439
|
+
return false;
|
|
440
|
+
}
|
|
441
|
+
const projections = await listRuntimeProjections(projectRoot, [projectionType]);
|
|
442
|
+
return projections
|
|
443
|
+
.map((projection) => projection.payload as RuntimeProjectionEnvelope<StageCloseAdjudicationProjection>)
|
|
444
|
+
.some((envelope) => stageAdjudicationCompletedAfterTruthAlignment(envelope, truthAlignment, stage)
|
|
445
|
+
&& acceptedStageRefs(envelope.payload).some((acceptedRef) => acceptedTruthRefMatchesCurrent(acceptedRef, staleRef, currentHash)));
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function acceptedTruthRefMatchesCurrent(acceptedRef: RuntimeRef, staleRef: RuntimeRef, currentHash: string): boolean {
|
|
449
|
+
return acceptedRef.kind === staleRef.kind
|
|
450
|
+
&& normalizePortablePath(acceptedRef.ref) === normalizePortablePath(staleRef.ref)
|
|
451
|
+
&& acceptedRef.hash === currentHash;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function stageAdjudicationCompletedAfterTruthAlignment(envelope: RuntimeProjectionEnvelope<StageCloseAdjudicationProjection>, truthAlignment: TruthAlignmentProjection, stage: SddStage): boolean {
|
|
455
|
+
const expectedHealth = expectedStageCloseHealth(stage);
|
|
456
|
+
return envelope.payload?.scope?.branch === truthAlignment.branch
|
|
457
|
+
&& envelope.payload.stage === stage
|
|
458
|
+
&& Date.parse(envelope.generatedAt) > Date.parse(truthAlignment.createdAt)
|
|
459
|
+
&& envelope.payload.stageDecision?.status === 'completed'
|
|
460
|
+
&& (envelope.payload.health === expectedHealth || envelope.payload.stageDecision?.health === expectedHealth)
|
|
461
|
+
&& acceptedStageRefs(envelope.payload).some((ref) => ownerStageForTruthRef(truthAlignment.branch, ref) === stage);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
function expectedStageCloseHealth(stage: SddStage): string {
|
|
465
|
+
const expectedHealth: Record<SddStage, string> = {
|
|
466
|
+
spec: 'ready_for_plan',
|
|
467
|
+
plan: 'ready_for_tasks',
|
|
468
|
+
tasks: 'ready_for_verifies',
|
|
469
|
+
verifies: 'ready_for_do',
|
|
470
|
+
do: 'ready_for_test',
|
|
471
|
+
test: 'ready_for_goal_verify',
|
|
472
|
+
'goal-verify': 'ready_for_ship',
|
|
473
|
+
ship: 'ship_ready'
|
|
474
|
+
};
|
|
475
|
+
return expectedHealth[stage];
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function acceptedStageRefs(adjudication: StageCloseAdjudicationProjection): RuntimeRef[] {
|
|
479
|
+
const refs = Array.isArray(adjudication.stageDecision?.acceptedDecisionRefs) ? adjudication.stageDecision.acceptedDecisionRefs : [];
|
|
480
|
+
const closureRefs = adjudication.closureRefs ?? {};
|
|
481
|
+
const closureRefKeys = [
|
|
482
|
+
'acceptedSpecRef',
|
|
483
|
+
'acceptedPlanRef',
|
|
484
|
+
'acceptedTasksRef',
|
|
485
|
+
'acceptedVerifyRef',
|
|
486
|
+
'acceptedImplementationRef',
|
|
487
|
+
'acceptedTestEvidenceRef',
|
|
488
|
+
'acceptedGoalVerificationRef',
|
|
489
|
+
'acceptedShipReadinessRef'
|
|
490
|
+
];
|
|
491
|
+
return [
|
|
492
|
+
...refs,
|
|
493
|
+
...closureRefKeys.map((key) => runtimeRefFromUnknown(closureRefs[key]))
|
|
494
|
+
].filter((ref): ref is RuntimeRef => ref !== null);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
function runtimeRefFromUnknown(value: unknown): RuntimeRef | null {
|
|
498
|
+
if (!value || typeof value !== 'object') {
|
|
499
|
+
return null;
|
|
500
|
+
}
|
|
501
|
+
const candidate = value as Partial<RuntimeRef>;
|
|
502
|
+
if (typeof candidate.kind !== 'string' || typeof candidate.ref !== 'string') {
|
|
503
|
+
return null;
|
|
504
|
+
}
|
|
505
|
+
return {
|
|
506
|
+
kind: candidate.kind as RuntimeRef['kind'],
|
|
507
|
+
ref: candidate.ref,
|
|
508
|
+
hash: typeof candidate.hash === 'string' ? candidate.hash : undefined
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
function requiredTaskIds(model: SddTaskModel): string[] {
|
|
513
|
+
return model.tasks.filter((task) => task.status !== 'deferred').map((task) => task.id);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
function stateAfterTruthAlignment(state: RunState, truthAlignment: TruthAlignmentProjection): boolean {
|
|
517
|
+
return Date.parse(state.updatedAt) > Date.parse(truthAlignment.createdAt);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
function stateTaskImplemented(runtime: RunStateTaskRuntime | undefined): boolean {
|
|
521
|
+
return runtimeTaskImplemented(runtime);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
function stateTaskValidationPassed(runtime: RunStateTaskRuntime | undefined, state: RunState): boolean {
|
|
525
|
+
return runtime?.verificationStatus === 'pass' || runtime?.status === 'implemented_verified' || state.validation.status === 'pass';
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
async function currentTruthRefHash(projectRoot: string, ref: RuntimeRef): Promise<string> {
|
|
529
|
+
const normalized = normalizePortablePath(ref.ref);
|
|
530
|
+
if (!normalized || normalized === '.' || normalized === '..' || normalized.includes('..') || path.isAbsolute(ref.ref)) {
|
|
531
|
+
return 'unsafe-ref';
|
|
532
|
+
}
|
|
533
|
+
const projectPath = path.resolve(projectRoot);
|
|
534
|
+
const filePath = path.resolve(projectPath, normalized);
|
|
535
|
+
if (!filePath.startsWith(`${projectPath}${path.sep}`)) {
|
|
536
|
+
return 'escaped-ref';
|
|
537
|
+
}
|
|
538
|
+
try {
|
|
539
|
+
return hashDocumentContent(await readFile(filePath, 'utf8'));
|
|
540
|
+
} catch {
|
|
541
|
+
return 'missing-ref';
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
function ownerStageForTruthRef(branch: string, ref: RuntimeRef): SddStage | null {
|
|
546
|
+
const normalized = normalizePortablePath(ref.ref);
|
|
547
|
+
if (!normalized) {
|
|
548
|
+
return null;
|
|
549
|
+
}
|
|
550
|
+
if (normalized === `specs/${branch}/spec.md`) {
|
|
551
|
+
return 'spec';
|
|
552
|
+
}
|
|
553
|
+
if (normalized === `specs/${branch}/plan.md`) {
|
|
554
|
+
return 'plan';
|
|
555
|
+
}
|
|
556
|
+
if (normalized === `specs/${branch}/tasks.md`) {
|
|
557
|
+
return 'tasks';
|
|
558
|
+
}
|
|
559
|
+
if (normalized === `specs/${branch}/verify.md`) {
|
|
560
|
+
return 'verifies';
|
|
561
|
+
}
|
|
562
|
+
if (normalized === `specs/${branch}/release.md`) {
|
|
563
|
+
return 'ship';
|
|
564
|
+
}
|
|
565
|
+
const runStage = normalized.match(new RegExp(`^\\.sdd/runs/${escapeRegExp(branch)}/([^/]+)/`))?.[1];
|
|
566
|
+
return runStage && isSddStage(runStage) ? runStage : null;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
function semanticImpactForTruthRef(branch: string, ref: RuntimeRef): TruthAlignmentProjection['semanticImpact'] {
|
|
570
|
+
const ownerStage = ownerStageForTruthRef(branch, ref);
|
|
571
|
+
return ref.kind === 'document' || ownerStage === 'spec' || ownerStage === 'plan' || ownerStage === 'tasks' || ownerStage === 'verifies' ? 'none' : 'material';
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
function uniqueRuntimeRefs(refs: RuntimeRef[]): RuntimeRef[] {
|
|
575
|
+
const seen = new Set<string>();
|
|
576
|
+
const result: RuntimeRef[] = [];
|
|
577
|
+
for (const ref of refs) {
|
|
578
|
+
const key = `${ref.kind}:${ref.ref}:${ref.hash ?? ''}`;
|
|
579
|
+
if (!seen.has(key)) {
|
|
580
|
+
seen.add(key);
|
|
581
|
+
result.push(ref);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return result;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
function uniqueStages(stages: SddStage[]): SddStage[] {
|
|
588
|
+
return ['spec', 'plan', 'tasks', 'verifies', 'do', 'test', 'goal-verify', 'ship'].filter((stage): stage is SddStage => stages.includes(stage as SddStage));
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
function uniqueStrings(values: string[]): string[] {
|
|
592
|
+
return [...new Set(values)];
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
function escapeRegExp(value: string): string {
|
|
596
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
function truthReconciliationNextIntent(branch: string, ownerStage: SddStage, reasons: string[]): WorkflowNextIntent {
|
|
600
|
+
const bundle = commandBundleForRuntimeStage(ownerStage);
|
|
601
|
+
return workflowNextIntent(bundle, 'reconcile_truth', truthReconciliationCommand(branch, ownerStage), `Reconcile truth drift in ${ownerStage}-manager before downstream ship readiness.`, reasons.join('; ') || 'truthAlignment requires reconciliation', {
|
|
602
|
+
targetRuntimeStage: ownerStage,
|
|
603
|
+
resumeMode: 'reconcile',
|
|
604
|
+
canAutoAdvanceWithinBundle: ownerStage === 'verifies' || ownerStage === 'goal-verify',
|
|
605
|
+
evidenceSurface: [...evidenceSurfaceForRuntimeStage(ownerStage), 'truthReconciliation projection']
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function truthReconciliationCommand(branch: string, ownerStage: SddStage): string {
|
|
610
|
+
if (ownerStage === 'do') {
|
|
611
|
+
return `sdd do task <task_id> --branch ${branch}`;
|
|
612
|
+
}
|
|
613
|
+
return stageCloseCommandForRuntimeStage(branch, ownerStage);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
function stageCloseCommandForRuntimeStage(branch: string, stage: SddStage): string {
|
|
617
|
+
if (stage === 'verifies') {
|
|
618
|
+
return `sdd tasks close --branch ${branch} --target verifies --compact-json`;
|
|
619
|
+
}
|
|
620
|
+
if (stage === 'goal-verify') {
|
|
621
|
+
return `sdd test close --branch ${branch} --target goal-verify --compact-json`;
|
|
622
|
+
}
|
|
623
|
+
return `sdd ${stage} close --branch ${branch} --compact-json`;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
function formatOpenRepairReason(repair: RuntimeRepairRecord): string {
|
|
627
|
+
return `Open ${repair.repairType} ${repair.repairId}: ${repair.blockers.join('; ')}`;
|
|
628
|
+
}
|
|
629
|
+
|
|
176
630
|
function recommendedWorkflowNextIntent(
|
|
177
631
|
context: ContextResolverContract,
|
|
178
632
|
model: SddTaskModel,
|
|
179
633
|
latestRunsByTask: WorkflowLatestTaskRun[],
|
|
180
634
|
gaps: SddTaskGap[],
|
|
181
635
|
dependencyBlockers: WorkflowDependencyBlocker[],
|
|
182
|
-
runtimeByTask: Map<string, RunStateTaskRuntime
|
|
636
|
+
runtimeByTask: Map<string, RunStateTaskRuntime>,
|
|
637
|
+
readiness: WorkflowReadinessSummary,
|
|
638
|
+
openRepairs: RuntimeRepairRecord[],
|
|
639
|
+
truthReconciliation: TruthReconciliationDecision | null
|
|
183
640
|
): WorkflowNextIntent {
|
|
184
641
|
if (!workflowIsActive(model)) {
|
|
185
642
|
return workflowNextIntent('spec', 'start_spec', `sdd spec --branch ${context.partition}`, 'Start the spec stage before planning or task execution.', null);
|
|
@@ -188,22 +645,38 @@ function recommendedWorkflowNextIntent(
|
|
|
188
645
|
if (blockingGap) {
|
|
189
646
|
return workflowNextIntent('tasks', 'resolve_task_gaps', `sdd tasks gaps --branch ${context.partition}`, 'Resolve blocking task document gaps before execution evidence can be trusted.', `${blockingGap.field}: ${blockingGap.message}`);
|
|
190
647
|
}
|
|
648
|
+
const openRepair = openRepairs[0];
|
|
649
|
+
if (openRepair) {
|
|
650
|
+
return workflowNextIntent('test', 'repair_failure', openRepair.recommendedCommands[0] ?? `sdd doctor --branch ${context.partition} --latest-only`, openRepair.requiredEvidence.join('; ') || 'Resolve the open repair with new accepted evidence or a fresh gate PASS.', formatOpenRepairReason(openRepair));
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
if (truthReconciliation) {
|
|
654
|
+
return truthReconciliation.nextIntent;
|
|
655
|
+
}
|
|
191
656
|
|
|
192
657
|
const strictTask = model.tasks.find((task) => needsTaskValidation(task, runtimeByTask.get(task.id)));
|
|
193
658
|
if (strictTask) {
|
|
194
|
-
return workflowNextIntent('test', 'run_task_validation',
|
|
659
|
+
return workflowNextIntent('test', 'run_task_validation', validationUnitCommand(context.partition, validationUnitIdForTask(strictTask)), 'Validate this verify.md validation unit before more implementation proceeds.', null);
|
|
195
660
|
}
|
|
196
661
|
|
|
197
662
|
const readyBoundary = readyValidationBoundary(model, runtimeByTask);
|
|
198
663
|
if (readyBoundary?.kind === 'batch') {
|
|
199
|
-
return workflowNextIntent('test', 'run_batch_validation',
|
|
664
|
+
return workflowNextIntent('test', 'run_batch_validation', validationUnitCommand(context.partition, readyBoundary.id), `Validate accumulated implementation evidence for validation unit ${readyBoundary.id}.`, null);
|
|
200
665
|
}
|
|
201
666
|
if (readyBoundary?.kind === 'wave') {
|
|
202
|
-
return workflowNextIntent('test', 'run_wave_validation',
|
|
667
|
+
return workflowNextIntent('test', 'run_wave_validation', validationUnitCommand(context.partition, readyBoundary.id), `Validate accumulated implementation evidence for validation unit ${readyBoundary.id}.`, null);
|
|
203
668
|
}
|
|
204
669
|
|
|
205
|
-
if (
|
|
206
|
-
|
|
670
|
+
if (readiness.readyForShip) {
|
|
671
|
+
if (goalVerificationPassedForShip(model, runtimeByTask)) {
|
|
672
|
+
return workflowNextIntent('ship', 'ship_readiness', `sdd ship close --branch ${context.partition} --compact-json`, 'Goal verification passed; close ship readiness with ship-stage evidence.', null);
|
|
673
|
+
}
|
|
674
|
+
return workflowNextIntent('test', 'run_goal_verify', stageCloseCommandForRuntimeStage(context.partition, 'goal-verify'), 'Close goal verification inside the /sdd:test bundle and compute truthAlignment before ship readiness can run.', null, {
|
|
675
|
+
targetRuntimeStage: 'goal-verify',
|
|
676
|
+
resumeMode: 'resume',
|
|
677
|
+
canAutoAdvanceWithinBundle: true,
|
|
678
|
+
evidenceSurface: ['.sdd/runs/<branch>/goal-verify/*.md', 'truthAlignment projection']
|
|
679
|
+
});
|
|
207
680
|
}
|
|
208
681
|
|
|
209
682
|
const nextTask = model.tasks.find((task) => task.status === 'pending' && !runtimeTaskImplemented(runtimeByTask.get(task.id)) && dependencyBlockingReasonsForTask(model, task.id, { runtimeByTask }).length === 0);
|
|
@@ -222,7 +695,7 @@ function recommendedWorkflowNextIntent(
|
|
|
222
695
|
: workflowNextIntent('tasks', 'list_tasks', `sdd tasks list --branch ${context.partition}`, 'Inspect task state and decide whether to continue or ship.', null);
|
|
223
696
|
}
|
|
224
697
|
|
|
225
|
-
function latestRuntimeTaskStates(selections: LatestEligibleRunSelection[], states: RunState[]): Map<string, RunStateTaskRuntime> {
|
|
698
|
+
export function latestRuntimeTaskStates(selections: LatestEligibleRunSelection[], states: RunState[]): Map<string, RunStateTaskRuntime> {
|
|
226
699
|
const stateByRunId = new Map(states.map((state) => [state.runId, state]));
|
|
227
700
|
const result = new Map<string, RunStateTaskRuntime>();
|
|
228
701
|
for (const selection of selections) {
|
|
@@ -242,18 +715,21 @@ function needsTaskValidation(task: SddTask, runtime: RunStateTaskRuntime | undef
|
|
|
242
715
|
return Boolean(runtimeTaskImplemented(runtime) && runtime?.verificationStatus !== 'pass' && (task.requiresVerifyBeforeNext || task.validationTiming === 'task_end'));
|
|
243
716
|
}
|
|
244
717
|
|
|
245
|
-
function
|
|
718
|
+
function validationUnitIdForTask(task: SddTask): string {
|
|
719
|
+
return task.validationBatch ?? `task-${task.id}`;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
function readyValidationBoundary(model: SddTaskModel, runtimeByTask: Map<string, RunStateTaskRuntime>): { kind: 'batch'; id: string } | { kind: 'wave'; id: string } | null {
|
|
246
724
|
const batchGroups = new Map<string, SddTask[]>();
|
|
247
|
-
const waveGroups = new Map<string,
|
|
725
|
+
const waveGroups = new Map<string, SddTask[]>();
|
|
248
726
|
for (const task of model.tasks) {
|
|
249
727
|
if (task.validationTiming === 'batch_end' && task.validationBatch) {
|
|
250
728
|
batchGroups.set(task.validationBatch, [...(batchGroups.get(task.validationBatch) ?? []), task]);
|
|
251
729
|
}
|
|
252
730
|
if (task.validationTiming === 'wave_end') {
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
group.tasks.push(task);
|
|
256
|
-
waveGroups.set(key, group);
|
|
731
|
+
const id = validationUnitIdForTask(task);
|
|
732
|
+
waveGroups.set(id, [...(waveGroups.get(id) ?? []), task]);
|
|
257
733
|
}
|
|
258
734
|
}
|
|
259
735
|
for (const [id, tasks] of batchGroups) {
|
|
@@ -261,9 +737,9 @@ function readyValidationBoundary(model: SddTaskModel, runtimeByTask: Map<string,
|
|
|
261
737
|
return { kind: 'batch', id };
|
|
262
738
|
}
|
|
263
739
|
}
|
|
264
|
-
for (const
|
|
265
|
-
if (validationBoundaryReady(
|
|
266
|
-
return { kind: 'wave',
|
|
740
|
+
for (const [id, tasks] of waveGroups) {
|
|
741
|
+
if (validationBoundaryReady(tasks, runtimeByTask)) {
|
|
742
|
+
return { kind: 'wave', id };
|
|
267
743
|
}
|
|
268
744
|
}
|
|
269
745
|
return null;
|
|
@@ -282,35 +758,161 @@ function latestEligibleRunReadyForShip(run: WorkflowLatestTaskRun): boolean {
|
|
|
282
758
|
return run.runStatus === 'completed' && run.validationStatus === 'pass';
|
|
283
759
|
}
|
|
284
760
|
|
|
285
|
-
function
|
|
286
|
-
|
|
761
|
+
function goalVerificationPassedForShip(model: SddTaskModel, runtimeByTask: Map<string, RunStateTaskRuntime>): boolean {
|
|
762
|
+
const requiredTasks = model.tasks.filter((task) => task.status !== 'deferred');
|
|
763
|
+
return requiredTasks.length > 0 && requiredTasks.every((task) => {
|
|
764
|
+
const runtime = runtimeByTask.get(task.id);
|
|
765
|
+
return runtime?.verifyStatus === 'PASS' || runtime?.status === 'implemented_verified';
|
|
766
|
+
});
|
|
287
767
|
}
|
|
288
768
|
|
|
769
|
+
function workflowReadinessSummary(model: SddTaskModel, latestRunsByTask: WorkflowLatestTaskRun[]): WorkflowReadinessSummary {
|
|
770
|
+
const requiredTaskIds = model.tasks.filter((task) => task.status !== 'deferred').map((task) => task.id).sort();
|
|
771
|
+
const acceptedTaskIds = requiredTaskIds.filter((taskId) => latestRunsByTask.some((run) => run.taskId === taskId && latestEligibleRunReadyForShip(run))).sort();
|
|
772
|
+
const missingTaskIds = requiredTaskIds.filter((taskId) => !acceptedTaskIds.includes(taskId));
|
|
773
|
+
return {
|
|
774
|
+
requiredTaskIds,
|
|
775
|
+
acceptedTaskIds,
|
|
776
|
+
missingTaskIds,
|
|
777
|
+
readyForShip: requiredTaskIds.length > 0 && missingTaskIds.length === 0,
|
|
778
|
+
whyNotShip: missingTaskIds.length === 0 ? [] : missingTaskIds.map((taskId) => `Task ${taskId} has no accepted validation PASS evidence.`)
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
function validationUnitCommand(branch: string, validationUnitId: string): string {
|
|
783
|
+
return `sdd test ${validationUnitId} --branch ${branch}`;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
export interface WorkflowNextIntentOptions {
|
|
788
|
+
targetRuntimeStage?: SddStage;
|
|
789
|
+
resumeMode?: BundleResumeMode;
|
|
790
|
+
displayCommand?: string;
|
|
791
|
+
canAutoAdvanceWithinBundle?: boolean;
|
|
792
|
+
autoAdvanceTo?: SddStage | null;
|
|
793
|
+
stopReasons?: string[];
|
|
794
|
+
evidenceSurface?: string[];
|
|
795
|
+
}
|
|
289
796
|
|
|
290
|
-
function workflowNextIntent(
|
|
797
|
+
export function workflowNextIntent(
|
|
291
798
|
stage: WorkflowNextStage,
|
|
292
799
|
intent: WorkflowNextIntentKind,
|
|
293
800
|
canonicalCommand: string,
|
|
294
801
|
evidenceRequirement: string,
|
|
295
|
-
blockingReason: string | null
|
|
802
|
+
blockingReason: string | null,
|
|
803
|
+
options: WorkflowNextIntentOptions = {}
|
|
296
804
|
): WorkflowNextIntent {
|
|
805
|
+
const targetRuntimeStage = options.targetRuntimeStage ?? runtimeStageForCommand(canonicalCommand, stage);
|
|
806
|
+
const bundle = commandBundleForRuntimeStage(targetRuntimeStage);
|
|
807
|
+
const stages = [...COMMAND_BUNDLES[bundle]];
|
|
808
|
+
const autoAdvanceTo = options.autoAdvanceTo ?? null;
|
|
809
|
+
const canAutoAdvanceWithinBundle = options.canAutoAdvanceWithinBundle ?? Boolean(autoAdvanceTo && stages.includes(autoAdvanceTo));
|
|
810
|
+
const displayCommand = options.displayCommand ?? commandBundleDisplayCommand(bundle, targetRuntimeStage, canonicalCommand);
|
|
811
|
+
const stopReasons = options.stopReasons ?? [];
|
|
812
|
+
const evidenceSurface = options.evidenceSurface ?? evidenceSurfaceForRuntimeStage(targetRuntimeStage);
|
|
813
|
+
const resumeMode = options.resumeMode ?? defaultResumeMode(intent, targetRuntimeStage);
|
|
814
|
+
const commandBundle: CommandBundlePlan = {
|
|
815
|
+
contract: 'sdd-command-bundle-plan-v1',
|
|
816
|
+
branch: branchFromCommand(canonicalCommand),
|
|
817
|
+
bundle,
|
|
818
|
+
stages,
|
|
819
|
+
targetRuntimeStage,
|
|
820
|
+
resumeMode,
|
|
821
|
+
canonicalCommand,
|
|
822
|
+
displayCommand,
|
|
823
|
+
canAutoAdvanceWithinBundle,
|
|
824
|
+
autoAdvanceTo,
|
|
825
|
+
stopReasons,
|
|
826
|
+
evidenceSurface
|
|
827
|
+
};
|
|
297
828
|
return {
|
|
298
|
-
stage,
|
|
829
|
+
stage: bundle,
|
|
830
|
+
bundle,
|
|
831
|
+
targetRuntimeStage,
|
|
832
|
+
resumeMode,
|
|
299
833
|
intent,
|
|
300
834
|
canonicalCommand,
|
|
301
|
-
|
|
835
|
+
displayCommand,
|
|
836
|
+
commandSemantics: commandSemanticsForTarget(bundle, targetRuntimeStage, canonicalCommand),
|
|
302
837
|
evidenceRequirement,
|
|
303
838
|
blockingReason,
|
|
304
|
-
|
|
839
|
+
canAutoAdvanceWithinBundle,
|
|
840
|
+
autoAdvanceTo,
|
|
841
|
+
stopReasons,
|
|
842
|
+
evidenceSurface,
|
|
843
|
+
commandBundle,
|
|
844
|
+
hostProjections: hostCommandProjections(commandBundle)
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
export function commandBundleForRuntimeStage(stage: SddStage): SddCommandBundle {
|
|
849
|
+
if (stage === 'verifies') {
|
|
850
|
+
return 'tasks';
|
|
851
|
+
}
|
|
852
|
+
if (stage === 'goal-verify') {
|
|
853
|
+
return 'test';
|
|
854
|
+
}
|
|
855
|
+
return stage;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
function runtimeStageForCommand(canonicalCommand: string, fallbackBundle: SddCommandBundle): SddStage {
|
|
859
|
+
const command = canonicalCommand.replace(/^sdd\s+/, '').split(/\s+/)[0];
|
|
860
|
+
return isSddStage(command) ? command : COMMAND_BUNDLES[fallbackBundle][0];
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
function isSddStage(value: string): value is SddStage {
|
|
864
|
+
return value === 'spec' || value === 'plan' || value === 'tasks' || value === 'verifies' || value === 'do' || value === 'test' || value === 'goal-verify' || value === 'ship';
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
function defaultResumeMode(intent: WorkflowNextIntentKind, targetRuntimeStage: SddStage): BundleResumeMode {
|
|
868
|
+
if (intent === 'repair_failure') {
|
|
869
|
+
return 'repair';
|
|
870
|
+
}
|
|
871
|
+
if (intent === 'run_goal_verify' || targetRuntimeStage === 'verifies' || targetRuntimeStage === 'goal-verify') {
|
|
872
|
+
return 'resume';
|
|
873
|
+
}
|
|
874
|
+
return 'start';
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
function commandSemanticsForTarget(bundle: SddCommandBundle, targetRuntimeStage: SddStage, canonicalCommand: string): WorkflowCommandSemantics {
|
|
878
|
+
if (/^sdd\s+status\b/.test(canonicalCommand)) {
|
|
879
|
+
return 'inspection_navigation';
|
|
880
|
+
}
|
|
881
|
+
return bundle === 'do' || bundle === 'test' || bundle === 'ship' || /\sclose\b/.test(canonicalCommand) || targetRuntimeStage === 'verifies' || targetRuntimeStage === 'goal-verify'
|
|
882
|
+
? 'gate_execution'
|
|
883
|
+
: 'inspection_navigation';
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
function evidenceSurfaceForRuntimeStage(stage: SddStage): string[] {
|
|
887
|
+
const surfaces: Partial<Record<SddStage, string[]>> = {
|
|
888
|
+
spec: ['specs/<branch>/spec.md', '.sdd/runs/<branch>/spec/*.md'],
|
|
889
|
+
plan: ['specs/<branch>/plan.md', '.sdd/runs/<branch>/plan/*.md'],
|
|
890
|
+
tasks: ['specs/<branch>/tasks.md', '.sdd/runs/<branch>/tasks/*.md'],
|
|
891
|
+
verifies: ['specs/<branch>/verify.md', '.sdd/runs/<branch>/verifies/*.md'],
|
|
892
|
+
do: ['.sdd/runs/<branch>/do/*.md'],
|
|
893
|
+
test: ['.sdd/runs/<branch>/test/*.md'],
|
|
894
|
+
'goal-verify': ['.sdd/runs/<branch>/goal-verify/*.md', 'truthAlignment projection'],
|
|
895
|
+
ship: ['.sdd/runs/<branch>/ship/*.md', 'truthAlignment projection']
|
|
305
896
|
};
|
|
897
|
+
return surfaces[stage] ?? [`.sdd/runs/<branch>/${stage}/*.md`];
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
function branchFromCommand(canonicalCommand: string): string {
|
|
901
|
+
const tokens = canonicalCommand.split(/\s+/);
|
|
902
|
+
const branchIndex = tokens.indexOf('--branch');
|
|
903
|
+
return branchIndex >= 0 ? tokens[branchIndex + 1] ?? '<branch>' : '<branch>';
|
|
306
904
|
}
|
|
307
905
|
|
|
308
|
-
function
|
|
906
|
+
function commandBundleDisplayCommand(bundle: SddCommandBundle, targetRuntimeStage: SddStage, canonicalCommand: string): string {
|
|
907
|
+
return claudeCodeSlashEntry({ bundle, targetRuntimeStage, canonicalCommand });
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
function hostCommandProjections(commandBundle: CommandBundlePlan): WorkflowHostCommandProjection[] {
|
|
309
911
|
return [
|
|
310
912
|
{
|
|
311
913
|
host: 'claude_code',
|
|
312
914
|
status: 'active',
|
|
313
|
-
entry: claudeCodeSlashEntry(
|
|
915
|
+
entry: claudeCodeSlashEntry(commandBundle),
|
|
314
916
|
projectionSurfaces: ['slash command', 'skill', 'settings/hooks/statusline metadata'],
|
|
315
917
|
permissionProjection: 'Claude Code permission mode/tool prompts remain host enforcement, not SDD lifecycle truth.',
|
|
316
918
|
reason: 'Claude Code supports slash/skill/statusline projections; the canonical CLI command remains the portable source of workflow intent.'
|
|
@@ -326,7 +928,7 @@ function hostCommandProjections(canonicalCommand: string): WorkflowHostCommandPr
|
|
|
326
928
|
{
|
|
327
929
|
host: 'opencode',
|
|
328
930
|
status: 'active',
|
|
329
|
-
entry: opencodeCommandEntry(
|
|
931
|
+
entry: opencodeCommandEntry(commandBundle),
|
|
330
932
|
projectionSurfaces: ['opencode.json/jsonc', '.opencode/commands', '.opencode/agents', '.opencode/skills', 'permissions'],
|
|
331
933
|
permissionProjection: 'OpenCode allow/ask/deny permissions can project SDD tool policy; SDD artifacts remain authoritative evidence.',
|
|
332
934
|
reason: 'OpenCode documents project commands, agents, skills, and permissions suitable for host-specific projection.'
|
|
@@ -334,13 +936,36 @@ function hostCommandProjections(canonicalCommand: string): WorkflowHostCommandPr
|
|
|
334
936
|
];
|
|
335
937
|
}
|
|
336
938
|
|
|
337
|
-
function claudeCodeSlashEntry(
|
|
338
|
-
|
|
339
|
-
|
|
939
|
+
function claudeCodeSlashEntry(commandBundle: Pick<CommandBundlePlan, 'bundle' | 'targetRuntimeStage' | 'canonicalCommand'>): string {
|
|
940
|
+
return projectedCommandEntry('/sdd:', commandBundle, ':');
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
function opencodeCommandEntry(commandBundle: Pick<CommandBundlePlan, 'bundle' | 'targetRuntimeStage' | 'canonicalCommand'>): string {
|
|
944
|
+
return projectedCommandEntry('/sdd ', commandBundle, ' ');
|
|
340
945
|
}
|
|
341
946
|
|
|
342
|
-
function
|
|
343
|
-
|
|
947
|
+
function projectedCommandEntry(prefix: string, commandBundle: Pick<CommandBundlePlan, 'bundle' | 'targetRuntimeStage' | 'canonicalCommand'>, separator: ':' | ' '): string {
|
|
948
|
+
const tokens = commandBundle.canonicalCommand.replace(/^sdd\s+/, '').split(/\s+/).filter(Boolean);
|
|
949
|
+
const [command, ...rest] = tokens;
|
|
950
|
+
if (!command || !isSddStage(command)) {
|
|
951
|
+
return `/sdd ${tokens.join(' ')}`;
|
|
952
|
+
}
|
|
953
|
+
const target = commandBundle.targetRuntimeStage === commandBundle.bundle ? '' : ` target=${commandBundle.targetRuntimeStage}`;
|
|
954
|
+
const tailTokens = stripTargetOption(rest);
|
|
955
|
+
const head = separator === ':' ? `${prefix}${commandBundle.bundle}` : `${prefix}${commandBundle.bundle}`;
|
|
956
|
+
return `${head}${target}${tailTokens.length > 0 ? ` ${tailTokens.join(' ')}` : ''}`;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
function stripTargetOption(tokens: string[]): string[] {
|
|
960
|
+
const result: string[] = [];
|
|
961
|
+
for (let index = 0; index < tokens.length; index += 1) {
|
|
962
|
+
if (tokens[index] === '--target') {
|
|
963
|
+
index += 1;
|
|
964
|
+
continue;
|
|
965
|
+
}
|
|
966
|
+
result.push(tokens[index]);
|
|
967
|
+
}
|
|
968
|
+
return result;
|
|
344
969
|
}
|
|
345
970
|
|
|
346
971
|
function projectWorkflowStateProjection(resolution: WorkflowStateResolution): unknown {
|
|
@@ -356,8 +981,12 @@ function projectWorkflowStateProjection(resolution: WorkflowStateResolution): un
|
|
|
356
981
|
latestEligibleRunsByTask: resolution.latestEligibleRunsByTask,
|
|
357
982
|
affectedFileConflicts: resolution.affectedFileConflicts,
|
|
358
983
|
dependencyBlockers: resolution.dependencyBlockers,
|
|
984
|
+
openRepairs: resolution.openRepairs,
|
|
359
985
|
blockingReasons: resolution.blockingReasons,
|
|
986
|
+
workflowReadiness: resolution.workflowReadiness,
|
|
987
|
+
whyNotShip: resolution.whyNotShip,
|
|
360
988
|
nextIntent: resolution.nextIntent,
|
|
989
|
+
truthReconciliation: resolution.truthReconciliation,
|
|
361
990
|
recommendedNextCommand: resolution.recommendedNextCommand
|
|
362
991
|
};
|
|
363
992
|
}
|