sdd-agent-platform 0.4.0 → 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 +36 -39
- package/node_modules/@sdd-agent-platform/core/dist/ai-tools.js +72 -71
- 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 +13 -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 +16 -20
- 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 +4 -1
- package/node_modules/@sdd-agent-platform/core/dist/contracts.js +3 -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 +7 -7
- 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 +277 -3
- package/node_modules/@sdd-agent-platform/core/dist/doctor/doctor.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/evidence/lookup.d.ts +23 -0
- package/node_modules/@sdd-agent-platform/core/dist/evidence/lookup.js +61 -0
- package/node_modules/@sdd-agent-platform/core/dist/evidence/lookup.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/evidence-runtime/contracts.d.ts +11 -1
- package/node_modules/@sdd-agent-platform/core/dist/execution/agent-execution-records.js +15 -8
- package/node_modules/@sdd-agent-platform/core/dist/execution/agent-execution-records.js.map +1 -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 +16 -7
- 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.d.ts +112 -0
- package/node_modules/@sdd-agent-platform/core/dist/execution/stage-team-runtime.js +145 -0
- package/node_modules/@sdd-agent-platform/core/dist/execution/stage-team-runtime.js.map +1 -0
- 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 +59 -66
- 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 +3 -0
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.js +55 -19
- 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 +20 -2
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.js +218 -18
- 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 +17 -17
- 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.d.ts +10 -0
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-runtime-static.js +32 -2
- 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.d.ts +2 -17
- package/node_modules/@sdd-agent-platform/core/dist/registries/capability-sources.js +222 -10
- package/node_modules/@sdd-agent-platform/core/dist/registries/capability-sources.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.js +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 +28 -13
- 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 +61 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.d.ts +3 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.js +192 -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 +73 -17
- 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-inspection.js +11 -4
- package/node_modules/@sdd-agent-platform/core/dist/router/runtime-inspection.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/runtime-validation.js +31 -3
- 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 +168 -18
- 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/events.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/run-state/events.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.d.ts +3 -3
- package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.js +22 -54
- 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/invocation-ledger.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/run-state/invocation-ledger.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/model.d.ts +53 -9
- 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 +51 -34
- 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 +65 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.js +169 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.js.map +1 -0
- 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 +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state.js +2 -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 +20 -0
- package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.js +109 -14
- 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/context.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/context.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.d.ts +6 -0
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.js +276 -0
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.js.map +1 -0
- 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 +15 -4
- 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 +21 -0
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.js +139 -38
- 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 +105 -1
- package/node_modules/@sdd-agent-platform/core/dist/status/project-status.js +343 -8
- 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 +348 -3
- package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.js +1017 -8
- 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 +21 -0
- package/node_modules/@sdd-agent-platform/core/dist/test-support/fixtures.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.js +19 -20
- 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 +44 -37
- 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 +19 -49
- package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/review-gate.d.ts +22 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/review-gate.js +53 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/review-gate.js.map +1 -0
- 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 +213 -111
- 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 +28 -3
- package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.js +546 -125
- 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 +76 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.js +450 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.d.ts +3 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.js +105 -30
- package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification.d.ts +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification.js +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/work-units/contracts.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/evidence-packet.d.ts +24 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/evidence-packet.js +395 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/evidence-packet.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/hard-checks.d.ts +4 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/hard-checks.js +164 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/hard-checks.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/policy.d.ts +4 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/policy.js +182 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/policy.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/types.d.ts +88 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/types.js +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/types.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.js +17 -3
- 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.d.ts +8 -4
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/dependencies.js +25 -11
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/dependencies.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.d.ts +37 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.js +188 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.js.map +1 -0
- 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 +80 -3
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.js +674 -41
- 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/dist/workflow-state.d.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state.js +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state.js.map +1 -1
- 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 +72 -71
- 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 +52 -6
- 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 +44 -29
- package/node_modules/@sdd-agent-platform/core/src/config/init-project.ts +15 -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 +17 -20
- 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 +4 -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 +7 -7
- 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 +217 -7
- package/node_modules/@sdd-agent-platform/core/src/doctor/doctor.ts +301 -3
- package/node_modules/@sdd-agent-platform/core/src/evidence/lookup.ts +88 -0
- package/node_modules/@sdd-agent-platform/core/src/evidence-runtime/contracts.ts +12 -1
- package/node_modules/@sdd-agent-platform/core/src/execution/agent-execution-records.ts +16 -11
- package/node_modules/@sdd-agent-platform/core/src/execution/background-executor.test.ts +57 -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 +17 -1
- package/node_modules/@sdd-agent-platform/core/src/execution/resident-worker.ts +16 -7
- package/node_modules/@sdd-agent-platform/core/src/execution/stage-team-runtime.test.ts +102 -0
- package/node_modules/@sdd-agent-platform/core/src/execution/stage-team-runtime.ts +271 -0
- package/node_modules/@sdd-agent-platform/core/src/execution/wave-executor.test.ts +14 -0
- package/node_modules/@sdd-agent-platform/core/src/governance/policy.test.ts +10 -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 +34 -13
- package/node_modules/@sdd-agent-platform/core/src/instructions.ts +60 -67
- 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 +58 -19
- 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 +3 -3
- package/node_modules/@sdd-agent-platform/core/src/phase8-risk-kernel.test.ts +8 -3
- package/node_modules/@sdd-agent-platform/core/src/planning/task-graph.test.ts +2 -0
- package/node_modules/@sdd-agent-platform/core/src/planning/wave-plan.test.ts +3 -0
- package/node_modules/@sdd-agent-platform/core/src/registries/agent-capability-catalog.ts +319 -20
- package/node_modules/@sdd-agent-platform/core/src/registries/agent-registry.ts +17 -17
- package/node_modules/@sdd-agent-platform/core/src/registries/agent-runtime-static.ts +42 -2
- package/node_modules/@sdd-agent-platform/core/src/registries/capability-sources.ts +238 -15
- 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 +45 -4
- 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 +32 -13
- package/node_modules/@sdd-agent-platform/core/src/router/agent-runtime.ts +68 -1
- package/node_modules/@sdd-agent-platform/core/src/router/route-projection.ts +212 -1
- package/node_modules/@sdd-agent-platform/core/src/router/route-sdd-task.test.ts +391 -6
- package/node_modules/@sdd-agent-platform/core/src/router/routing.ts +78 -17
- package/node_modules/@sdd-agent-platform/core/src/router/runtime-import.ts +453 -0
- package/node_modules/@sdd-agent-platform/core/src/router/runtime-inspection.ts +11 -4
- package/node_modules/@sdd-agent-platform/core/src/router/runtime-validation.ts +32 -3
- 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 +173 -18
- package/node_modules/@sdd-agent-platform/core/src/run-state/events.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/run-state/inspect-run.ts +24 -59
- package/node_modules/@sdd-agent-platform/core/src/run-state/invocation-ledger.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/run-state/model.ts +59 -9
- 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 +53 -2
- package/node_modules/@sdd-agent-platform/core/src/run-state/run-state.ts +55 -41
- package/node_modules/@sdd-agent-platform/core/src/run-state/task-evidence.ts +252 -0
- 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 +2 -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 +131 -14
- 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/context.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/document-hashes.ts +306 -0
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/run-binding.ts +15 -4
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-parser.test.ts +261 -0
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-parser.ts +169 -41
- 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 +497 -8
- package/node_modules/@sdd-agent-platform/core/src/storage/runtime-store.test.ts +560 -4
- package/node_modules/@sdd-agent-platform/core/src/storage/runtime-store.ts +1510 -9
- 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 +21 -0
- package/node_modules/@sdd-agent-platform/core/src/test-support/run-state.ts +20 -20
- 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 +46 -42
- package/node_modules/@sdd-agent-platform/core/src/verification/rendering.ts +18 -52
- package/node_modules/@sdd-agent-platform/core/src/verification/review-gate.test.ts +84 -0
- package/node_modules/@sdd-agent-platform/core/src/verification/review-gate.ts +77 -0
- package/node_modules/@sdd-agent-platform/core/src/verification/single-task-loop.test.ts +138 -64
- package/node_modules/@sdd-agent-platform/core/src/verification/single-task-loop.ts +226 -116
- package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.test.ts +148 -48
- package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.ts +619 -136
- 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 +383 -0
- package/node_modules/@sdd-agent-platform/core/src/verification/validation-wave.ts +556 -0
- package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.test.ts +131 -8
- package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.ts +117 -30
- package/node_modules/@sdd-agent-platform/core/src/verification.ts +2 -0
- 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 +425 -0
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/hard-checks.test.ts +507 -0
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/hard-checks.ts +182 -0
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/policy.test.ts +174 -0
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/policy.ts +194 -0
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/types.ts +115 -0
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/affected-file-conflicts.ts +19 -4
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/dependencies.test.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/dependencies.ts +33 -11
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/latest-eligible-run.ts +224 -0
- 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 +851 -9
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve.ts +862 -45
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/runtime-projections.ts +712 -0
- package/node_modules/@sdd-agent-platform/core/src/workflow-state.ts +1 -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 +70 -4
- package/packages/cli/dist/commands/status.js.map +1 -1
- package/packages/cli/dist/commands/tasks.js +4 -4
- package/packages/cli/dist/commands/tasks.js.map +1 -1
- package/packages/cli/dist/commands/test.js +272 -5
- package/packages/cli/dist/commands/test.js.map +1 -1
- package/packages/cli/dist/commands/verifies.js +9 -5
- package/packages/cli/dist/commands/verifies.js.map +1 -1
- package/packages/cli/dist/commands/verify.js +257 -20
- 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 +42 -27
- 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 +27 -2
- package/packages/cli/dist/renderers/registry-runtime.js.map +1 -1
- package/packages/cli/dist/renderers/router.js +5 -3
- 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 +46 -84
- 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 +72 -71
- 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 +13 -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 +16 -20
- 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 +4 -1
- package/packages/core/dist/contracts.js +3 -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 +7 -7
- 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 +277 -3
- package/packages/core/dist/doctor/doctor.js.map +1 -1
- package/packages/core/dist/evidence/lookup.d.ts +23 -0
- package/packages/core/dist/evidence/lookup.js +61 -0
- package/packages/core/dist/evidence/lookup.js.map +1 -0
- package/packages/core/dist/evidence-runtime/contracts.d.ts +11 -1
- package/packages/core/dist/execution/agent-execution-records.js +15 -8
- package/packages/core/dist/execution/agent-execution-records.js.map +1 -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 +16 -7
- package/packages/core/dist/execution/resident-worker.js.map +1 -1
- package/packages/core/dist/execution/stage-team-runtime.d.ts +112 -0
- package/packages/core/dist/execution/stage-team-runtime.js +145 -0
- package/packages/core/dist/execution/stage-team-runtime.js.map +1 -0
- 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 +59 -66
- 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 +3 -0
- package/packages/core/dist/lifecycle/ship.js +55 -19
- 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 +20 -2
- package/packages/core/dist/registries/agent-capability-catalog.js +218 -18
- package/packages/core/dist/registries/agent-capability-catalog.js.map +1 -1
- package/packages/core/dist/registries/agent-registry.js +17 -17
- package/packages/core/dist/registries/agent-registry.js.map +1 -1
- package/packages/core/dist/registries/agent-runtime-static.d.ts +10 -0
- package/packages/core/dist/registries/agent-runtime-static.js +32 -2
- package/packages/core/dist/registries/agent-runtime-static.js.map +1 -1
- package/packages/core/dist/registries/capability-sources.d.ts +2 -17
- package/packages/core/dist/registries/capability-sources.js +222 -10
- package/packages/core/dist/registries/capability-sources.js.map +1 -1
- package/packages/core/dist/registries/command-team-runtime.d.ts +1 -1
- package/packages/core/dist/registries/command-team-runtime.js +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 +28 -13
- package/packages/core/dist/router/agent-runtime-config.js.map +1 -1
- package/packages/core/dist/router/agent-runtime.d.ts +61 -1
- package/packages/core/dist/router/route-projection.d.ts +3 -1
- package/packages/core/dist/router/route-projection.js +192 -1
- package/packages/core/dist/router/route-projection.js.map +1 -1
- package/packages/core/dist/router/routing.js +73 -17
- 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-inspection.js +11 -4
- package/packages/core/dist/router/runtime-inspection.js.map +1 -1
- package/packages/core/dist/router/runtime-validation.js +31 -3
- 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 +168 -18
- package/packages/core/dist/run-state/artifacts.js.map +1 -1
- package/packages/core/dist/run-state/events.js +2 -2
- package/packages/core/dist/run-state/events.js.map +1 -1
- package/packages/core/dist/run-state/inspect-run.d.ts +3 -3
- package/packages/core/dist/run-state/inspect-run.js +22 -54
- package/packages/core/dist/run-state/inspect-run.js.map +1 -1
- package/packages/core/dist/run-state/invocation-ledger.js +2 -2
- package/packages/core/dist/run-state/invocation-ledger.js.map +1 -1
- package/packages/core/dist/run-state/model.d.ts +53 -9
- 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 +51 -34
- package/packages/core/dist/run-state/run-state.js.map +1 -1
- package/packages/core/dist/run-state/task-evidence.d.ts +65 -0
- package/packages/core/dist/run-state/task-evidence.js +169 -0
- package/packages/core/dist/run-state/task-evidence.js.map +1 -0
- 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 +2 -0
- package/packages/core/dist/run-state.js +2 -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 +20 -0
- package/packages/core/dist/runtime-paths.js +109 -14
- 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/context.js +1 -1
- package/packages/core/dist/sdd-docs/context.js.map +1 -1
- package/packages/core/dist/sdd-docs/document-hashes.d.ts +6 -0
- package/packages/core/dist/sdd-docs/document-hashes.js +276 -0
- package/packages/core/dist/sdd-docs/document-hashes.js.map +1 -0
- package/packages/core/dist/sdd-docs/run-binding.d.ts +1 -1
- package/packages/core/dist/sdd-docs/run-binding.js +15 -4
- package/packages/core/dist/sdd-docs/run-binding.js.map +1 -1
- package/packages/core/dist/sdd-docs/task-parser.d.ts +21 -0
- package/packages/core/dist/sdd-docs/task-parser.js +139 -38
- 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 +105 -1
- package/packages/core/dist/status/project-status.js +343 -8
- package/packages/core/dist/status/project-status.js.map +1 -1
- package/packages/core/dist/storage/runtime-store.d.ts +348 -3
- package/packages/core/dist/storage/runtime-store.js +1017 -8
- 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 +21 -0
- package/packages/core/dist/test-support/fixtures.js.map +1 -1
- package/packages/core/dist/test-support/run-state.d.ts +1 -1
- package/packages/core/dist/test-support/run-state.js +19 -20
- 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 +44 -37
- 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 +19 -49
- package/packages/core/dist/verification/rendering.js.map +1 -1
- package/packages/core/dist/verification/review-gate.d.ts +22 -0
- package/packages/core/dist/verification/review-gate.js +53 -0
- package/packages/core/dist/verification/review-gate.js.map +1 -0
- package/packages/core/dist/verification/single-task-loop.d.ts +0 -1
- package/packages/core/dist/verification/single-task-loop.js +213 -111
- package/packages/core/dist/verification/single-task-loop.js.map +1 -1
- package/packages/core/dist/verification/test-runtime.d.ts +28 -3
- package/packages/core/dist/verification/test-runtime.js +546 -125
- 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 +76 -0
- package/packages/core/dist/verification/validation-wave.js +450 -0
- package/packages/core/dist/verification/validation-wave.js.map +1 -0
- package/packages/core/dist/verification/verify-contract.d.ts +3 -1
- package/packages/core/dist/verification/verify-contract.js +105 -30
- package/packages/core/dist/verification/verify-contract.js.map +1 -1
- package/packages/core/dist/verification.d.ts +2 -0
- package/packages/core/dist/verification.js +2 -0
- package/packages/core/dist/verification.js.map +1 -1
- package/packages/core/dist/work-units/contracts.d.ts +1 -1
- package/packages/core/dist/workflow-gate/evidence-packet.d.ts +24 -0
- package/packages/core/dist/workflow-gate/evidence-packet.js +395 -0
- package/packages/core/dist/workflow-gate/evidence-packet.js.map +1 -0
- package/packages/core/dist/workflow-gate/hard-checks.d.ts +4 -0
- package/packages/core/dist/workflow-gate/hard-checks.js +164 -0
- package/packages/core/dist/workflow-gate/hard-checks.js.map +1 -0
- package/packages/core/dist/workflow-gate/policy.d.ts +4 -0
- package/packages/core/dist/workflow-gate/policy.js +182 -0
- package/packages/core/dist/workflow-gate/policy.js.map +1 -0
- package/packages/core/dist/workflow-gate/types.d.ts +88 -0
- package/packages/core/dist/workflow-gate/types.js +2 -0
- package/packages/core/dist/workflow-gate/types.js.map +1 -0
- package/packages/core/dist/workflow-state/affected-file-conflicts.d.ts +1 -1
- package/packages/core/dist/workflow-state/affected-file-conflicts.js +17 -3
- package/packages/core/dist/workflow-state/affected-file-conflicts.js.map +1 -1
- package/packages/core/dist/workflow-state/dependencies.d.ts +8 -4
- package/packages/core/dist/workflow-state/dependencies.js +25 -11
- package/packages/core/dist/workflow-state/dependencies.js.map +1 -1
- package/packages/core/dist/workflow-state/latest-eligible-run.d.ts +37 -0
- package/packages/core/dist/workflow-state/latest-eligible-run.js +188 -0
- package/packages/core/dist/workflow-state/latest-eligible-run.js.map +1 -0
- 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 +80 -3
- package/packages/core/dist/workflow-state/resolve.js +674 -41
- 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/dist/workflow-state.d.ts +1 -0
- package/packages/core/dist/workflow-state.js +1 -0
- package/packages/core/dist/workflow-state.js.map +1 -1
- 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 -221
- 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 -91
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.js +0 -395
- 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 -248
- package/node_modules/@sdd-agent-platform/core/src/sync-back/inspect.ts +0 -522
- package/node_modules/@sdd-agent-platform/core/src/sync-back/sync-back.test.ts +0 -446
- 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 -221
- package/packages/core/dist/sync-back/apply.js.map +0 -1
- package/packages/core/dist/sync-back/inspect.d.ts +0 -91
- package/packages/core/dist/sync-back/inspect.js +0 -395
- 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
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import type { WorkflowGateEvidencePacket, WorkflowGateHardCheck } from './types.js';
|
|
2
|
+
|
|
3
|
+
type WorkflowGateHardCheckInput = Omit<WorkflowGateEvidencePacket, 'hardChecks'>;
|
|
4
|
+
|
|
5
|
+
export function evaluateWorkflowGateHardChecks(packet: WorkflowGateHardCheckInput): WorkflowGateHardCheck[] {
|
|
6
|
+
return [
|
|
7
|
+
...runtimeHealthChecks(packet),
|
|
8
|
+
...documentChecks(packet),
|
|
9
|
+
...latestEligibleChecks(packet),
|
|
10
|
+
...dependencyChecks(packet),
|
|
11
|
+
...affectedFileChecks(packet),
|
|
12
|
+
...durableGapChecks(packet),
|
|
13
|
+
...artifactChecks(packet),
|
|
14
|
+
...authorityChecks(packet)
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function runtimeHealthChecks(packet: WorkflowGateHardCheckInput): WorkflowGateHardCheck[] {
|
|
19
|
+
if (packet.runtimeHealth.status === 'ok') {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
return [blocked('schema_health_unavailable', packet.partition, `Runtime store health is unavailable: ${packet.runtimeHealth.issues.join('; ') || 'unknown issue'}.`, 'Repair runtime.sqlite schema or rerun after runtime storage is available.', packet.runtimeHealth.issues)];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function documentChecks(packet: WorkflowGateHardCheckInput): WorkflowGateHardCheck[] {
|
|
26
|
+
const checks: WorkflowGateHardCheck[] = [];
|
|
27
|
+
const docs = packet.documents;
|
|
28
|
+
const missing = [
|
|
29
|
+
['spec.md', docs.specExists],
|
|
30
|
+
['plan.md', docs.planExists],
|
|
31
|
+
['tasks.md', docs.tasksExists],
|
|
32
|
+
['verify.md', docs.verifyExists]
|
|
33
|
+
].filter(([, exists]) => !exists).map(([name]) => String(name));
|
|
34
|
+
if (missing.length > 0) {
|
|
35
|
+
checks.push(blocked('missing_documents', packet.partition, `Missing workflow documents: ${missing.join(', ')}.`, 'Run the missing SDD document stages before gate evaluation.', missing));
|
|
36
|
+
}
|
|
37
|
+
const stale = [
|
|
38
|
+
['plan.md', docs.planStale],
|
|
39
|
+
['tasks.md', docs.tasksStale],
|
|
40
|
+
['verify.md', docs.verifyStale]
|
|
41
|
+
].filter(([, value]) => value === true).map(([name]) => String(name));
|
|
42
|
+
if (stale.length > 0) {
|
|
43
|
+
checks.push(blocked('stale_documents', packet.partition, `Stale workflow documents: ${stale.join(', ')}.`, 'Refresh the stale stage contract before continuing.', stale));
|
|
44
|
+
}
|
|
45
|
+
return checks;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function latestEligibleChecks(packet: WorkflowGateHardCheckInput): WorkflowGateHardCheck[] {
|
|
49
|
+
if (packet.decisionKind === 'test' && packet.workflowScope.runIds.length > 0) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
const scopedSelections = packet.latestEligibleSelections ?? [];
|
|
53
|
+
const selections = scopedSelections.length > 0 ? scopedSelections : (packet.latestEligibleSelection ? [packet.latestEligibleSelection] : []);
|
|
54
|
+
if (selections.length === 0) {
|
|
55
|
+
return [warning('latest_eligible_missing', packet.partition, 'No latest eligible selection is available.', 'Create a run or inspect task evidence before applying gate decisions.', [])];
|
|
56
|
+
}
|
|
57
|
+
return selections.flatMap((selection) => {
|
|
58
|
+
if (!selection.selected && selection.candidates.length > 0) {
|
|
59
|
+
return [blocked('run_rejected', packet.partition, `No default-eligible run for ${selection.taskId}; rejected candidates=${selection.rejected.length}.`, 'Inspect rejected latest-eligible candidates and resolve their reasons.', selection.rejected.map((candidate) => candidate.runId))];
|
|
60
|
+
}
|
|
61
|
+
if (!selection.selected) {
|
|
62
|
+
return [warning('latest_eligible_missing', packet.partition, `No run candidates found for ${selection.taskId}.`, 'Run implementation or validation before expecting gate PASS.', [])];
|
|
63
|
+
}
|
|
64
|
+
const selected = selection.selected;
|
|
65
|
+
if (selected.runStatus === 'blocked' || selected.runStatus === 'failed' || selected.runStatus === 'archived') {
|
|
66
|
+
return [blocked('blocked_failed_or_archived_run', packet.partition, `Selected run ${selected.runId} is ${selected.runStatus}.`, 'Use a non-blocked completed run before continuing.', [selected.runId])];
|
|
67
|
+
}
|
|
68
|
+
if (!selected.eligibleForDefaultApply || selected.compatibility === 'strict_stale' || selected.compatibility === 'incompatible') {
|
|
69
|
+
return [blocked('run_rejected', packet.partition, `Selected run ${selected.runId} is not eligible: ${selected.reasons.join('; ') || selected.compatibility}.`, 'Resolve run eligibility before continuing.', [selected.runId])];
|
|
70
|
+
}
|
|
71
|
+
if (selected.validationStatus === 'fail' || selected.validationStatus === 'blocked') {
|
|
72
|
+
return [blocked('validation_failure', packet.partition, `Selected run validation is ${selected.validationStatus}.`, 'Rerun validation and collect passing evidence.', [selected.runId])];
|
|
73
|
+
}
|
|
74
|
+
return [];
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function dependencyChecks(packet: WorkflowGateHardCheckInput): WorkflowGateHardCheck[] {
|
|
79
|
+
return packet.dependencyBlockers.map((blocker) => blocked('dependency_blocker', packet.partition, blocker.reason, `Inspect dependency ${blocker.dependencyId} before continuing.`, [blocker.taskId, blocker.dependencyId]));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function affectedFileChecks(packet: WorkflowGateHardCheckInput): WorkflowGateHardCheck[] {
|
|
83
|
+
return packet.affectedFileConflicts.map((conflict) => blocked('affected_file_conflict', packet.partition, `Affected file ${conflict.file} is active in run ${conflict.runId}.`, 'Resolve active run conflict before applying changes.', [conflict.file, conflict.runId]));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function durableGapChecks(packet: WorkflowGateHardCheckInput): WorkflowGateHardCheck[] {
|
|
87
|
+
return packet.durableGaps
|
|
88
|
+
.filter((gap) => gap.status === 'open' || gap.status === 'acknowledged')
|
|
89
|
+
.filter((gap) => gap.severity === 'blocking')
|
|
90
|
+
.map((gap) => blocked('durable_gap_blocking', packet.partition, gap.message, gap.recommendation ?? 'Resolve the blocking durable gap before continuing.', [gap.gapId, ...gap.evidenceRefs]));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function artifactChecks(packet: WorkflowGateHardCheckInput): WorkflowGateHardCheck[] {
|
|
94
|
+
const checks: WorkflowGateHardCheck[] = [];
|
|
95
|
+
if (packet.selectedEvidence.source === 'legacy_active_payloads' || packet.selectedEvidence.source === 'candidate_payloads') {
|
|
96
|
+
checks.push(blocked('missing_evidence_selection', packet.partition, `Gate evidence resolved from ${packet.selectedEvidence.source} instead of an accepted selection pointer.`, 'Create or refresh the runtime accepted evidence set before gate PASS.', packet.selectedEvidence.payloads.map((payload) => payload.payloadId)));
|
|
97
|
+
}
|
|
98
|
+
if (packet.selectedEvidence.source === 'none' || packet.selectedEvidence.payloads.length === 0) {
|
|
99
|
+
checks.push(blocked('missing_evidence_selection', packet.partition, 'No runtime-selected evidence payloads are available for this gate.', 'Collect evidence and create a runtime accepted evidence selection before gate PASS.', packet.requiredArtifactRefs));
|
|
100
|
+
}
|
|
101
|
+
const nonConsumable = packet.selectedEvidence.payloads.filter((payload) => !isConsumablePayloadStatus(payload.status));
|
|
102
|
+
for (const payload of nonConsumable) {
|
|
103
|
+
checks.push(blocked('non_consumable_evidence', packet.partition, `Evidence ${payload.logicalRef} is ${payload.status} and cannot satisfy gate authority.`, 'Select accepted or current candidate evidence; keep rejected, superseded, quarantined, stale, partial, and active-attempt refs for audit only.', [payload.payloadId, payload.logicalRef, payload.status]));
|
|
104
|
+
}
|
|
105
|
+
const nonPrimary = packet.selectedEvidence.payloads.filter((payload) => isConsumablePayloadStatus(payload.status) && !isPrimaryGateEvidencePayload(payload));
|
|
106
|
+
for (const payload of nonPrimary) {
|
|
107
|
+
checks.push(warning('non_primary_evidence', packet.partition, `Evidence ${payload.logicalRef} has role ${payload.artifactRole} and cannot satisfy primary gate authority.`, 'Use selected primary stage evidence for gate obligations; keep diagnostic, derived, legacy, and reasoning refs outside primary evidence.', [payload.payloadId, payload.logicalRef, payload.artifactRole]));
|
|
108
|
+
}
|
|
109
|
+
const available = new Set(consumableEvidenceRefs(packet));
|
|
110
|
+
checks.push(...packet.requiredArtifactRefs
|
|
111
|
+
.filter((ref) => !available.has(ref))
|
|
112
|
+
.map((ref) => blocked('missing_required_artifact', packet.partition, `Required artifact ${ref} is missing from selected gate evidence.`, 'Collect required artifacts and include them in the accepted evidence selection before gate PASS.', [ref])));
|
|
113
|
+
for (const payload of packet.artifactPayloadHealth) {
|
|
114
|
+
if (payload.status === 'missing') {
|
|
115
|
+
checks.push(blocked('missing_payload', packet.partition, `Artifact payload ${payload.logicalRef} is missing at ${payload.physicalPayloadPath}.`, 'Restore the immutable payload or regenerate current evidence before gate PASS.', [payload.payloadId, payload.logicalRef, payload.physicalPayloadPath]));
|
|
116
|
+
} else if (payload.status === 'digest_drift') {
|
|
117
|
+
checks.push(blocked('digest_drift', packet.partition, `Artifact payload ${payload.logicalRef} digest drifted: expected ${payload.expectedDigest} actual ${payload.actualDigest}.`, 'Treat the payload as tampered or stale; regenerate accepted evidence before gate PASS.', [payload.payloadId, payload.logicalRef, payload.physicalPayloadPath]));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return checks;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function consumableEvidenceRefs(packet: WorkflowGateHardCheckInput): string[] {
|
|
124
|
+
if (packet.selectedEvidence.source === 'selection_pointer') {
|
|
125
|
+
if (packet.selectedEvidence.evidenceSet?.status !== 'accepted') {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
return activePayloadRefs(packet);
|
|
129
|
+
}
|
|
130
|
+
if (packet.selectedEvidence.source === 'candidate_payloads') {
|
|
131
|
+
return activePayloadRefs(packet);
|
|
132
|
+
}
|
|
133
|
+
return [];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function activePayloadRefs(packet: WorkflowGateHardCheckInput): string[] {
|
|
137
|
+
return packet.selectedEvidence.payloads.filter((payload) => isConsumablePayloadStatus(payload.status) && isPrimaryGateEvidencePayload(payload)).map((payload) => payload.logicalRef);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function isConsumablePayloadStatus(status: string): boolean {
|
|
141
|
+
return status === 'active';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function isPrimaryGateEvidencePayload(payload: WorkflowGateHardCheckInput['selectedEvidence']['payloads'][number]): boolean {
|
|
145
|
+
const ref = payload.logicalRef.replace(/\\/g, '/').toLowerCase();
|
|
146
|
+
const role = payload.artifactRole.toLowerCase();
|
|
147
|
+
if (ref.startsWith('runs/') || ref.startsWith('artifacts/') || ref.includes('/evidence/artifacts/')) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
if (ref.includes('/test-index-') || ref.endsWith('.log')) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
return !/(command-output|test-index|diagnostic|derived|cache|profile|summary|context-package|acceptance-coverage|review|manager|handoff|collaboration)/.test(role);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
function authorityChecks(packet: WorkflowGateHardCheckInput): WorkflowGateHardCheck[] {
|
|
158
|
+
const checks: WorkflowGateHardCheck[] = [];
|
|
159
|
+
for (const fanIn of packet.fanInEvidenceSets) {
|
|
160
|
+
if (fanIn.gateInputOnly !== true) {
|
|
161
|
+
checks.push(blocked('authority_violation', packet.partition, `Fan-in evidence set ${fanIn.fanInId} is not gate-input-only.`, 'Regenerate fan-in evidence as non-final gate input.', [fanIn.fanInId]));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
for (const advisor of packet.advisorAssessments) {
|
|
165
|
+
if (advisor.advisoryOnly !== true) {
|
|
166
|
+
checks.push(blocked('authority_violation', packet.partition, `Advisor assessment ${advisor.assessmentId} is not advisory-only.`, 'Discard or regenerate advisor assessment as advisory-only.', [advisor.assessmentId]));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return checks;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function blocked(code: WorkflowGateHardCheck['code'], scope: string, message: string, recovery: string, refs: string[]): WorkflowGateHardCheck {
|
|
173
|
+
return { code, severity: 'blocked', scope, message, recovery, refs: sortedUnique(refs) };
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function warning(code: WorkflowGateHardCheck['code'], scope: string, message: string, recovery: string, refs: string[]): WorkflowGateHardCheck {
|
|
177
|
+
return { code, severity: 'warning', scope, message, recovery, refs: sortedUnique(refs) };
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function sortedUnique(values: string[]): string[] {
|
|
181
|
+
return [...new Set(values.filter(Boolean))].sort();
|
|
182
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
|
|
4
|
+
import { WORKFLOW_GATE_RUNTIME_CONTRACT_VERSION, STAGE_TEAM_RUNTIME_CONTRACT_VERSION } from '../contracts.js';
|
|
5
|
+
import { synthesizeWorkflowGateDecision } from './policy.js';
|
|
6
|
+
import type { WorkflowGateEvidencePacket } from './types.js';
|
|
7
|
+
|
|
8
|
+
const generatedAt = '2026-01-01T00:00:00.000Z';
|
|
9
|
+
|
|
10
|
+
test('workflow gate policy keeps hard blocks monotonic over advisor concerns', () => {
|
|
11
|
+
const decision = synthesizeWorkflowGateDecision(packet({
|
|
12
|
+
hardChecks: [{
|
|
13
|
+
code: 'validation_failure',
|
|
14
|
+
severity: 'blocked',
|
|
15
|
+
scope: 'feature',
|
|
16
|
+
message: 'Selected run validation failed.',
|
|
17
|
+
recovery: 'Rerun validation.',
|
|
18
|
+
refs: ['run-001']
|
|
19
|
+
}],
|
|
20
|
+
advisorAssessments: [advisor('none')]
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
assert.equal(decision.status, 'BLOCKED');
|
|
24
|
+
assert.equal(decision.decidedBy, 'runtime_policy');
|
|
25
|
+
assert.deepEqual(decision.forbiddenNextActions, ['ship', 'truth-alignment-approval', 'mark-task-complete', 'stage-pass']);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('workflow gate policy requires a human for high-concern ship advisors', () => {
|
|
29
|
+
const decision = synthesizeWorkflowGateDecision(packet({ advisorAssessments: [advisor('high')] }));
|
|
30
|
+
|
|
31
|
+
assert.equal(decision.status, 'HUMAN_REQUIRED');
|
|
32
|
+
assert.equal(decision.humanRequired, true);
|
|
33
|
+
assert.deepEqual(decision.allowedNextActions, ['create-decision-card', 'inspect-evidence']);
|
|
34
|
+
assert.equal(decision.forbiddenNextActions.includes('satisfy-with-subagent-output'), true);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('workflow gate policy treats advisor-only stage transitions without canonical evidence as advisory only', () => {
|
|
38
|
+
const decision = synthesizeWorkflowGateDecision(packet({
|
|
39
|
+
decisionKind: 'stage_transition',
|
|
40
|
+
advisorAssessments: [advisor('low')],
|
|
41
|
+
canonicalEvidenceRefs: []
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
assert.equal(decision.status, 'ADVISORY_ONLY');
|
|
45
|
+
assert.deepEqual(decision.allowedNextActions, ['inspect-advisor-assessments']);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('workflow gate policy escalates invalid advisors and warns on low confidence', () => {
|
|
49
|
+
const invalid = synthesizeWorkflowGateDecision(packet({ advisorAssessments: [advisor('low', { validity: 'invalid' })] }));
|
|
50
|
+
const lowConfidence = synthesizeWorkflowGateDecision(packet({ advisorAssessments: [advisor('low', { confidence: 'low' })] }));
|
|
51
|
+
|
|
52
|
+
assert.equal(invalid.status, 'HUMAN_REQUIRED');
|
|
53
|
+
assert.equal(invalid.advisorSummary.invalidCount, 1);
|
|
54
|
+
assert.equal(lowConfidence.status, 'WARN');
|
|
55
|
+
assert.equal(lowConfidence.advisorSummary.lowConfidenceCount, 1);
|
|
56
|
+
assert.deepEqual(lowConfidence.allowedNextActions, ['inspect-evidence']);
|
|
57
|
+
assert.deepEqual(lowConfidence.forbiddenNextActions, ['ship', 'truth-alignment-approval', 'mark-task-complete', 'stage-pass']);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('workflow gate policy hashes selected evidence and carries gate binding', () => {
|
|
61
|
+
const selectedPayload = selectedEvidencePayload('artifacts/validation-T1.md', 'digest-validation');
|
|
62
|
+
const decision = synthesizeWorkflowGateDecision(packet({
|
|
63
|
+
canonicalEvidenceRefs: ['artifacts/validation-T1.md'],
|
|
64
|
+
selectedEvidence: { source: 'candidate_payloads', evidenceSet: null, pointer: null, payloads: [selectedPayload] },
|
|
65
|
+
fanInEvidenceSets: [{
|
|
66
|
+
contract: STAGE_TEAM_RUNTIME_CONTRACT_VERSION,
|
|
67
|
+
fanInId: 'fanin-001',
|
|
68
|
+
partition: 'feature',
|
|
69
|
+
runId: 'run-001',
|
|
70
|
+
taskId: 'T1',
|
|
71
|
+
stage: 'test',
|
|
72
|
+
roleResultIds: [],
|
|
73
|
+
durableGapIds: [],
|
|
74
|
+
proposalRefs: [],
|
|
75
|
+
advisorAssessmentIds: [],
|
|
76
|
+
evidenceRefs: ['artifacts/review-T1.md'],
|
|
77
|
+
canonicalEvidenceRefs: ['artifacts/review-T1.md'],
|
|
78
|
+
gateInputOnly: true,
|
|
79
|
+
createdAt: generatedAt,
|
|
80
|
+
payload: {}
|
|
81
|
+
}]
|
|
82
|
+
}));
|
|
83
|
+
|
|
84
|
+
assert.match(decision.decisionId, /^gate-[a-f0-9]{16}$/);
|
|
85
|
+
assert.equal(decision.status, 'PASS');
|
|
86
|
+
assert.deepEqual(decision.evidenceRefs, ['artifacts/validation-T1.md']);
|
|
87
|
+
assert.deepEqual(decision.payload, {
|
|
88
|
+
contract: WORKFLOW_GATE_RUNTIME_CONTRACT_VERSION,
|
|
89
|
+
packetId: 'packet-001',
|
|
90
|
+
workflowScope: { waveRunId: null, taskIds: ['T1'], runIds: ['run-001'], evidenceRefs: [] },
|
|
91
|
+
evidenceBinding: {
|
|
92
|
+
contract: 'sdd-gate-evidence-binding-v1',
|
|
93
|
+
branch: 'feature',
|
|
94
|
+
gate: 'ship',
|
|
95
|
+
selectionPointerRef: null,
|
|
96
|
+
acceptedEvidenceSetRef: null,
|
|
97
|
+
source: 'candidate_payloads',
|
|
98
|
+
selectedRefs: [{ payloadId: selectedPayload.payloadId, logicalRef: selectedPayload.logicalRef, digest: selectedPayload.digest, status: selectedPayload.status }],
|
|
99
|
+
blockedRefs: [],
|
|
100
|
+
selectionReasons: [],
|
|
101
|
+
decision: 'pass',
|
|
102
|
+
reasons: []
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
function packet(overrides: Partial<WorkflowGateEvidencePacket> = {}): WorkflowGateEvidencePacket {
|
|
108
|
+
return {
|
|
109
|
+
packetId: 'packet-001',
|
|
110
|
+
generatedAt,
|
|
111
|
+
decisionKind: 'ship',
|
|
112
|
+
partition: 'feature',
|
|
113
|
+
taskId: 'T1',
|
|
114
|
+
runId: 'run-001',
|
|
115
|
+
documents: {} as WorkflowGateEvidencePacket['documents'],
|
|
116
|
+
latestEligibleSelection: null,
|
|
117
|
+
latestEligibleSelections: [],
|
|
118
|
+
workflowScope: { waveRunId: null, taskIds: ['T1'], runIds: ['run-001'], evidenceRefs: [] },
|
|
119
|
+
runtimeHealth: { status: 'ok', issues: [] },
|
|
120
|
+
durableGaps: [],
|
|
121
|
+
dependencyBlockers: [],
|
|
122
|
+
affectedFileConflicts: [],
|
|
123
|
+
fanInEvidenceSets: [],
|
|
124
|
+
advisorAssessments: [],
|
|
125
|
+
selectedEvidence: { source: 'none', evidenceSet: null, pointer: null, payloads: [] },
|
|
126
|
+
canonicalEvidenceRefs: [],
|
|
127
|
+
requiredArtifactRefs: [],
|
|
128
|
+
artifactPayloadHealth: [],
|
|
129
|
+
hardChecks: [],
|
|
130
|
+
...overrides
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function selectedEvidencePayload(logicalRef: string, digest: string): WorkflowGateEvidencePacket['selectedEvidence']['payloads'][number] {
|
|
135
|
+
return {
|
|
136
|
+
payloadId: `payload-${digest}`,
|
|
137
|
+
runId: 'run-001',
|
|
138
|
+
sourceRunId: 'run-001',
|
|
139
|
+
branchSlug: 'feature',
|
|
140
|
+
taskId: 'T1',
|
|
141
|
+
logicalRef,
|
|
142
|
+
physicalPayloadPath: logicalRef,
|
|
143
|
+
artifactRole: 'validation',
|
|
144
|
+
digest,
|
|
145
|
+
sequence: 1,
|
|
146
|
+
status: 'active',
|
|
147
|
+
supersedes: null,
|
|
148
|
+
createdAt: generatedAt,
|
|
149
|
+
payload: {}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function advisor(concern: WorkflowGateEvidencePacket['advisorAssessments'][number]['concern'], overrides: Partial<WorkflowGateEvidencePacket['advisorAssessments'][number]> = {}): WorkflowGateEvidencePacket['advisorAssessments'][number] {
|
|
154
|
+
return {
|
|
155
|
+
contract: STAGE_TEAM_RUNTIME_CONTRACT_VERSION,
|
|
156
|
+
assessmentId: `advisor-${concern}`,
|
|
157
|
+
sessionId: null,
|
|
158
|
+
partition: 'feature',
|
|
159
|
+
runId: 'run-001',
|
|
160
|
+
taskId: 'T1',
|
|
161
|
+
kind: 'evidence_sufficiency',
|
|
162
|
+
concern,
|
|
163
|
+
validity: 'valid',
|
|
164
|
+
confidence: 'high',
|
|
165
|
+
advisoryOnly: true,
|
|
166
|
+
summary: `${concern} concern`,
|
|
167
|
+
evidenceRefs: [],
|
|
168
|
+
durableGapIds: [],
|
|
169
|
+
proposalRefs: [],
|
|
170
|
+
createdAt: generatedAt,
|
|
171
|
+
...overrides,
|
|
172
|
+
payload: {}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { WORKFLOW_GATE_RUNTIME_CONTRACT_VERSION } from '../contracts.js';
|
|
3
|
+
import type { WorkflowGateAdvisorSummary, WorkflowGateDecision, WorkflowGateEvidencePacket, WorkflowGateHardCheck, WorkflowGateStatus } from './types.js';
|
|
4
|
+
|
|
5
|
+
export function synthesizeWorkflowGateDecision(packet: WorkflowGateEvidencePacket): WorkflowGateDecision {
|
|
6
|
+
const hardBlocks = packet.hardChecks.filter((check) => check.severity === 'blocked');
|
|
7
|
+
const warnings = packet.hardChecks.filter((check) => check.severity === 'warning');
|
|
8
|
+
const advisorSummary = summarizeAdvisors(packet);
|
|
9
|
+
const status = decideStatus(hardBlocks, warnings, advisorSummary, packet);
|
|
10
|
+
const humanRequired = status === 'HUMAN_REQUIRED';
|
|
11
|
+
const allowedNextActions = allowedActions(status, packet);
|
|
12
|
+
const forbiddenNextActions = forbiddenActions(status, packet);
|
|
13
|
+
return {
|
|
14
|
+
decisionId: `gate-${inputHash(packet).slice(0, 16)}`,
|
|
15
|
+
inputHash: inputHash(packet),
|
|
16
|
+
generatedAt: new Date().toISOString(),
|
|
17
|
+
partition: packet.partition,
|
|
18
|
+
taskId: packet.taskId,
|
|
19
|
+
runId: packet.runId,
|
|
20
|
+
decisionKind: packet.decisionKind,
|
|
21
|
+
status,
|
|
22
|
+
decidedBy: 'runtime_policy',
|
|
23
|
+
hardBlocks,
|
|
24
|
+
warnings,
|
|
25
|
+
advisorSummary,
|
|
26
|
+
allowedNextActions,
|
|
27
|
+
forbiddenNextActions,
|
|
28
|
+
humanRequired,
|
|
29
|
+
reasons: decisionReasons(status, hardBlocks, warnings, advisorSummary),
|
|
30
|
+
evidenceRefs: sortedUnique(selectedEvidenceRefs(packet)),
|
|
31
|
+
payload: {
|
|
32
|
+
contract: WORKFLOW_GATE_RUNTIME_CONTRACT_VERSION,
|
|
33
|
+
packetId: packet.packetId,
|
|
34
|
+
workflowScope: packet.workflowScope,
|
|
35
|
+
evidenceBinding: gateEvidenceBinding(packet)
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function summarizeAdvisors(packet: WorkflowGateEvidencePacket): WorkflowGateAdvisorSummary {
|
|
41
|
+
const highConcernCount = packet.advisorAssessments.filter((assessment) => assessment.concern === 'high').length;
|
|
42
|
+
const mediumConcernCount = packet.advisorAssessments.filter((assessment) => assessment.concern === 'medium').length;
|
|
43
|
+
const invalidCount = packet.advisorAssessments.filter((assessment) => assessment.advisoryOnly !== true || assessment.validity === 'invalid').length;
|
|
44
|
+
const lowConfidenceCount = packet.advisorAssessments.filter((assessment) => assessment.confidence === 'low').length;
|
|
45
|
+
return {
|
|
46
|
+
status: invalidCount > 0 ? 'invalid' : highConcernCount > 0 ? 'high_concern' : mediumConcernCount > 0 || lowConfidenceCount > 0 ? 'medium_concern' : packet.advisorAssessments.length > 0 ? 'low_concern' : 'none',
|
|
47
|
+
highConcernCount,
|
|
48
|
+
mediumConcernCount,
|
|
49
|
+
invalidCount,
|
|
50
|
+
lowConfidenceCount,
|
|
51
|
+
summaries: packet.advisorAssessments.map((assessment) => assessment.summary).filter(Boolean).sort()
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function inputHash(packet: WorkflowGateEvidencePacket): string {
|
|
56
|
+
return createHash('sha256').update(stableJson({
|
|
57
|
+
decisionKind: packet.decisionKind,
|
|
58
|
+
partition: packet.partition,
|
|
59
|
+
taskId: packet.taskId,
|
|
60
|
+
runId: packet.runId,
|
|
61
|
+
documents: packet.documents,
|
|
62
|
+
selection: packet.latestEligibleSelection,
|
|
63
|
+
selections: packet.latestEligibleSelections,
|
|
64
|
+
workflowScope: packet.workflowScope,
|
|
65
|
+
runtimeHealth: packet.runtimeHealth,
|
|
66
|
+
durableGaps: packet.durableGaps,
|
|
67
|
+
dependencyBlockers: packet.dependencyBlockers,
|
|
68
|
+
affectedFileConflicts: packet.affectedFileConflicts,
|
|
69
|
+
fanInEvidenceSets: packet.fanInEvidenceSets,
|
|
70
|
+
advisorAssessments: packet.advisorAssessments,
|
|
71
|
+
selectedEvidence: {
|
|
72
|
+
source: packet.selectedEvidence.source,
|
|
73
|
+
evidenceSetId: packet.selectedEvidence.evidenceSet?.evidenceSetId ?? null,
|
|
74
|
+
selectedEvidenceSetId: packet.selectedEvidence.pointer?.selectedEvidenceSetId ?? null,
|
|
75
|
+
payloads: packet.selectedEvidence.payloads.map((payload) => ({ payloadId: payload.payloadId, logicalRef: payload.logicalRef, digest: payload.digest, status: payload.status }))
|
|
76
|
+
},
|
|
77
|
+
canonicalEvidenceRefs: packet.canonicalEvidenceRefs,
|
|
78
|
+
requiredArtifactRefs: packet.requiredArtifactRefs,
|
|
79
|
+
artifactPayloadHealth: packet.artifactPayloadHealth,
|
|
80
|
+
hardChecks: packet.hardChecks
|
|
81
|
+
}), 'utf8').digest('hex');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function decideStatus(hardBlocks: WorkflowGateHardCheck[], warnings: WorkflowGateHardCheck[], advisorSummary: WorkflowGateAdvisorSummary, packet: WorkflowGateEvidencePacket): WorkflowGateStatus {
|
|
85
|
+
if (hardBlocks.length > 0) {
|
|
86
|
+
return 'BLOCKED';
|
|
87
|
+
}
|
|
88
|
+
if (advisorSummary.status === 'invalid') {
|
|
89
|
+
return 'HUMAN_REQUIRED';
|
|
90
|
+
}
|
|
91
|
+
if (advisorSummary.status === 'high_concern') {
|
|
92
|
+
return 'HUMAN_REQUIRED';
|
|
93
|
+
}
|
|
94
|
+
if (warnings.length > 0 || advisorSummary.status === 'medium_concern') {
|
|
95
|
+
return 'WARN';
|
|
96
|
+
}
|
|
97
|
+
if (packet.decisionKind === 'stage_transition' && packet.advisorAssessments.length > 0 && packet.canonicalEvidenceRefs.length === 0) {
|
|
98
|
+
return 'ADVISORY_ONLY';
|
|
99
|
+
}
|
|
100
|
+
return 'PASS';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function allowedActions(status: WorkflowGateStatus, packet: WorkflowGateEvidencePacket): string[] {
|
|
104
|
+
if (status === 'PASS') {
|
|
105
|
+
return packet.decisionKind === 'ship' ? ['ship'] : ['continue'];
|
|
106
|
+
}
|
|
107
|
+
if (status === 'WARN') {
|
|
108
|
+
return ['inspect-evidence'];
|
|
109
|
+
}
|
|
110
|
+
if (status === 'HUMAN_REQUIRED') {
|
|
111
|
+
return ['create-decision-card', 'inspect-evidence'];
|
|
112
|
+
}
|
|
113
|
+
if (status === 'ADVISORY_ONLY') {
|
|
114
|
+
return ['inspect-advisor-assessments'];
|
|
115
|
+
}
|
|
116
|
+
return ['inspect-blockers', 'recover'];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function forbiddenActions(status: WorkflowGateStatus, packet: WorkflowGateEvidencePacket): string[] {
|
|
120
|
+
if (status === 'BLOCKED') {
|
|
121
|
+
return ['ship', 'truth-alignment-approval', 'mark-task-complete', 'stage-pass'];
|
|
122
|
+
}
|
|
123
|
+
if (status === 'HUMAN_REQUIRED') {
|
|
124
|
+
return ['satisfy-with-role-result', 'satisfy-with-subagent-output'];
|
|
125
|
+
}
|
|
126
|
+
if (status === 'ADVISORY_ONLY') {
|
|
127
|
+
return ['treat-advisor-as-pass'];
|
|
128
|
+
}
|
|
129
|
+
return status === 'WARN' ? ['ship', 'truth-alignment-approval', 'mark-task-complete', 'stage-pass'] : packet.decisionKind === 'ship' ? [] : ['skip-evidence-recording'];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function decisionReasons(status: WorkflowGateStatus, hardBlocks: WorkflowGateHardCheck[], warnings: WorkflowGateHardCheck[], advisorSummary: WorkflowGateAdvisorSummary): string[] {
|
|
133
|
+
if (hardBlocks.length > 0) {
|
|
134
|
+
return hardBlocks.map((check) => `${check.code}: ${check.message}`);
|
|
135
|
+
}
|
|
136
|
+
if (status === 'HUMAN_REQUIRED') {
|
|
137
|
+
return [`advisor=${advisorSummary.status}; human decision required because role/subagent outputs cannot satisfy this gate.`];
|
|
138
|
+
}
|
|
139
|
+
if (warnings.length > 0) {
|
|
140
|
+
return warnings.map((check) => `${check.code}: ${check.message}`);
|
|
141
|
+
}
|
|
142
|
+
if (advisorSummary.status === 'medium_concern' || advisorSummary.status === 'high_concern') {
|
|
143
|
+
return [`advisor=${advisorSummary.status}`];
|
|
144
|
+
}
|
|
145
|
+
return [`runtime_policy produced ${status}`];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function selectedEvidenceRefs(packet: WorkflowGateEvidencePacket): string[] {
|
|
149
|
+
return packet.selectedEvidence.payloads.map((payload) => payload.logicalRef);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function gateEvidenceBinding(packet: WorkflowGateEvidencePacket): Record<string, unknown> {
|
|
153
|
+
const selectedRefs = packet.selectedEvidence.payloads.map((payload) => ({
|
|
154
|
+
payloadId: payload.payloadId,
|
|
155
|
+
logicalRef: payload.logicalRef,
|
|
156
|
+
digest: payload.digest,
|
|
157
|
+
status: payload.status
|
|
158
|
+
}));
|
|
159
|
+
return {
|
|
160
|
+
contract: 'sdd-gate-evidence-binding-v1',
|
|
161
|
+
branch: packet.partition,
|
|
162
|
+
gate: packet.decisionKind,
|
|
163
|
+
selectionPointerRef: packet.selectedEvidence.pointer ? `selection:${packet.selectedEvidence.pointer.scopeKind}:${packet.selectedEvidence.pointer.scopeId}` : null,
|
|
164
|
+
acceptedEvidenceSetRef: packet.selectedEvidence.evidenceSet?.evidenceSetId ?? null,
|
|
165
|
+
source: packet.selectedEvidence.source,
|
|
166
|
+
selectedRefs,
|
|
167
|
+
blockedRefs: packet.hardChecks.flatMap((check) => check.refs),
|
|
168
|
+
selectionReasons: sortedUnique([packet.selectedEvidence.pointer?.reason ?? '', ...evidenceSetSelectionReasons(packet.selectedEvidence.evidenceSet?.payload)]),
|
|
169
|
+
decision: packet.hardChecks.some((check) => check.severity === 'blocked') ? 'blocked' : 'pass',
|
|
170
|
+
reasons: packet.hardChecks.map((check) => `${check.code}: ${check.message}`)
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function evidenceSetSelectionReasons(payload: unknown): string[] {
|
|
175
|
+
if (!payload || typeof payload !== 'object') {
|
|
176
|
+
return [];
|
|
177
|
+
}
|
|
178
|
+
const reasons = (payload as { selectionReasons?: unknown }).selectionReasons;
|
|
179
|
+
return Array.isArray(reasons) ? reasons.filter((reason): reason is string => typeof reason === 'string') : [];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function sortedUnique(values: string[]): string[] {
|
|
183
|
+
return [...new Set(values.filter(Boolean))].sort();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function stableJson(value: unknown): string {
|
|
187
|
+
if (Array.isArray(value)) {
|
|
188
|
+
return `[${value.map(stableJson).join(',')}]`;
|
|
189
|
+
}
|
|
190
|
+
if (value && typeof value === 'object') {
|
|
191
|
+
return `{${Object.entries(value as Record<string, unknown>).sort(([left], [right]) => left.localeCompare(right)).map(([key, item]) => `${JSON.stringify(key)}:${stableJson(item)}`).join(',')}}`;
|
|
192
|
+
}
|
|
193
|
+
return JSON.stringify(value);
|
|
194
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { FanInEvidenceSetRecord, LlmAdvisorAssessmentRecord } from '../execution/stage-team-runtime.js';
|
|
2
|
+
import type { RuntimeDurableGapRecord, RuntimeResolvedEvidenceSelection } from '../storage/runtime-store.js';
|
|
3
|
+
import type { LatestEligibleRunSelection } from '../workflow-state/latest-eligible-run.js';
|
|
4
|
+
import type { WorkflowDependencyBlocker } from '../workflow-state/dependencies.js';
|
|
5
|
+
import type { WorkflowAffectedFileConflict } from '../workflow-state/affected-file-conflicts.js';
|
|
6
|
+
import type { SddTaskModel } from '../sdd-docs/task-parser.js';
|
|
7
|
+
|
|
8
|
+
export type WorkflowGateStatus = 'PASS' | 'WARN' | 'BLOCKED' | 'HUMAN_REQUIRED' | 'ADVISORY_ONLY';
|
|
9
|
+
export type WorkflowGateHardCheckSeverity = 'info' | 'warning' | 'blocked';
|
|
10
|
+
export type WorkflowGateAdvisorSummaryStatus = 'none' | 'low_concern' | 'medium_concern' | 'high_concern' | 'invalid';
|
|
11
|
+
export type WorkflowGateDecisionKind = 'test' | 'validation_wave' | 'review_gate' | 'ship' | 'stage_transition';
|
|
12
|
+
|
|
13
|
+
export type WorkflowGateHardCheckCode =
|
|
14
|
+
| 'schema_health_unavailable'
|
|
15
|
+
| 'missing_documents'
|
|
16
|
+
| 'stale_documents'
|
|
17
|
+
| 'contract_hash_mismatch'
|
|
18
|
+
| 'run_rejected'
|
|
19
|
+
| 'blocked_failed_or_archived_run'
|
|
20
|
+
| 'latest_eligible_missing'
|
|
21
|
+
| 'missing_payload'
|
|
22
|
+
| 'digest_drift'
|
|
23
|
+
| 'missing_required_artifact'
|
|
24
|
+
| 'missing_evidence_selection'
|
|
25
|
+
| 'non_consumable_evidence'
|
|
26
|
+
| 'non_primary_evidence'
|
|
27
|
+
| 'validation_failure'
|
|
28
|
+
| 'dependency_blocker'
|
|
29
|
+
| 'authority_violation'
|
|
30
|
+
| 'affected_file_conflict'
|
|
31
|
+
| 'durable_gap_blocking';
|
|
32
|
+
|
|
33
|
+
export interface WorkflowGateHardCheck {
|
|
34
|
+
code: WorkflowGateHardCheckCode;
|
|
35
|
+
severity: WorkflowGateHardCheckSeverity;
|
|
36
|
+
scope: string;
|
|
37
|
+
message: string;
|
|
38
|
+
recovery: string;
|
|
39
|
+
refs: string[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface WorkflowGateArtifactPayloadHealth {
|
|
43
|
+
payloadId: string;
|
|
44
|
+
logicalRef: string;
|
|
45
|
+
physicalPayloadPath: string;
|
|
46
|
+
expectedDigest: string;
|
|
47
|
+
actualDigest: string | null;
|
|
48
|
+
status: 'ok' | 'missing' | 'digest_drift';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface WorkflowGateRuntimeHealth {
|
|
52
|
+
status: 'ok' | 'unavailable';
|
|
53
|
+
issues: string[];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface WorkflowGateScope {
|
|
57
|
+
waveRunId: string | null;
|
|
58
|
+
taskIds: string[];
|
|
59
|
+
runIds: string[];
|
|
60
|
+
evidenceRefs: string[];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface WorkflowGateEvidencePacket {
|
|
64
|
+
packetId: string;
|
|
65
|
+
generatedAt: string;
|
|
66
|
+
decisionKind: WorkflowGateDecisionKind;
|
|
67
|
+
partition: string;
|
|
68
|
+
taskId: string | null;
|
|
69
|
+
runId: string | null;
|
|
70
|
+
documents: SddTaskModel['documents'];
|
|
71
|
+
latestEligibleSelection: LatestEligibleRunSelection | null;
|
|
72
|
+
latestEligibleSelections: LatestEligibleRunSelection[];
|
|
73
|
+
workflowScope: WorkflowGateScope;
|
|
74
|
+
runtimeHealth: WorkflowGateRuntimeHealth;
|
|
75
|
+
durableGaps: RuntimeDurableGapRecord[];
|
|
76
|
+
dependencyBlockers: WorkflowDependencyBlocker[];
|
|
77
|
+
affectedFileConflicts: WorkflowAffectedFileConflict[];
|
|
78
|
+
fanInEvidenceSets: FanInEvidenceSetRecord[];
|
|
79
|
+
advisorAssessments: LlmAdvisorAssessmentRecord[];
|
|
80
|
+
selectedEvidence: RuntimeResolvedEvidenceSelection;
|
|
81
|
+
canonicalEvidenceRefs: string[];
|
|
82
|
+
requiredArtifactRefs: string[];
|
|
83
|
+
artifactPayloadHealth: WorkflowGateArtifactPayloadHealth[];
|
|
84
|
+
hardChecks: WorkflowGateHardCheck[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface WorkflowGateAdvisorSummary {
|
|
88
|
+
status: WorkflowGateAdvisorSummaryStatus;
|
|
89
|
+
highConcernCount: number;
|
|
90
|
+
mediumConcernCount: number;
|
|
91
|
+
invalidCount: number;
|
|
92
|
+
lowConfidenceCount: number;
|
|
93
|
+
summaries: string[];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface WorkflowGateDecision {
|
|
97
|
+
decisionId: string;
|
|
98
|
+
inputHash: string;
|
|
99
|
+
generatedAt: string;
|
|
100
|
+
partition: string;
|
|
101
|
+
taskId: string | null;
|
|
102
|
+
runId: string | null;
|
|
103
|
+
decisionKind: WorkflowGateDecisionKind;
|
|
104
|
+
status: WorkflowGateStatus;
|
|
105
|
+
decidedBy: 'runtime_policy';
|
|
106
|
+
hardBlocks: WorkflowGateHardCheck[];
|
|
107
|
+
warnings: WorkflowGateHardCheck[];
|
|
108
|
+
advisorSummary: WorkflowGateAdvisorSummary;
|
|
109
|
+
allowedNextActions: string[];
|
|
110
|
+
forbiddenNextActions: string[];
|
|
111
|
+
humanRequired: boolean;
|
|
112
|
+
reasons: string[];
|
|
113
|
+
evidenceRefs: string[];
|
|
114
|
+
payload: unknown;
|
|
115
|
+
}
|