sdd-agent-platform 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -28
- package/node_modules/@sdd-agent-platform/core/dist/ai-tools.js +67 -69
- package/node_modules/@sdd-agent-platform/core/dist/ai-tools.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/ingestion.js +64 -9
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/ingestion.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-evidence.js +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-evidence.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-result.js +26 -17
- package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-result.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/config/init-project.d.ts +3 -0
- package/node_modules/@sdd-agent-platform/core/dist/config/init-project.js +12 -9
- package/node_modules/@sdd-agent-platform/core/dist/config/init-project.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/config/project-config.d.ts +3 -1
- package/node_modules/@sdd-agent-platform/core/dist/config/project-config.js +7 -3
- package/node_modules/@sdd-agent-platform/core/dist/config/project-config.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.d.ts +4 -4
- package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.js +12 -25
- package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/context/build-package.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/context/build-package.js +1 -7
- package/node_modules/@sdd-agent-platform/core/dist/context/build-package.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/context/evidence-summary.js +26 -8
- package/node_modules/@sdd-agent-platform/core/dist/context/evidence-summary.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/context/log-worker.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/context/log-worker.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/context-offload/contracts.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/contracts.d.ts +2 -1
- package/node_modules/@sdd-agent-platform/core/dist/contracts.js +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/contracts.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/delegation/model.d.ts +3 -0
- package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.d.ts +3 -0
- package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.js +7 -4
- package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/document-chain.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/document-chain.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/project.js +8 -8
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/project.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/registries.js +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/registries.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-evidence.js +4 -4
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-evidence.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-trust.js +0 -24
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-trust.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/runtime-contracts.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/runtime-contracts.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/doctor/doctor.js +178 -58
- package/node_modules/@sdd-agent-platform/core/dist/doctor/doctor.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/evidence/lookup.js +14 -7
- package/node_modules/@sdd-agent-platform/core/dist/evidence/lookup.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/evidence-runtime/contracts.d.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/execution/background-executor.js +4 -4
- package/node_modules/@sdd-agent-platform/core/dist/execution/background-executor.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/execution/foreground-subagents.js +3 -3
- package/node_modules/@sdd-agent-platform/core/dist/execution/foreground-subagents.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/execution/host-invocation.js +5 -4
- package/node_modules/@sdd-agent-platform/core/dist/execution/host-invocation.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/execution/resident-worker.js +3 -2
- package/node_modules/@sdd-agent-platform/core/dist/execution/resident-worker.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/execution/stage-team-runtime.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/execution/stage-team-runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/governance/policy.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/governance/policy.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/governance/policy.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/instructions.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/instructions.js +54 -61
- package/node_modules/@sdd-agent-platform/core/dist/instructions.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/decision-gate.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/decision-gate.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.d.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.js +24 -8
- package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/orchestration/contracts.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.d.ts +12 -2
- package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.js +62 -21
- package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.d.ts +5 -2
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.js +69 -27
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-registry.js +15 -15
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-registry.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-runtime-static.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/agent-runtime-static.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/capability-sources.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.js +9 -9
- package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/eval-learning-context.js +4 -4
- package/node_modules/@sdd-agent-platform/core/dist/registries/eval-learning-context.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/query-status.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/registries/query-status.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/tool-capabilities.js +3 -3
- package/node_modules/@sdd-agent-platform/core/dist/registries/tool-capabilities.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/tool-plugins.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/registries/tool-plugins.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/worker-adapters.js +11 -11
- package/node_modules/@sdd-agent-platform/core/dist/registries/worker-adapters.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/registries/workflow-gates.js +12 -12
- package/node_modules/@sdd-agent-platform/core/dist/registries/workflow-gates.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/risk/contracts.d.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/risk/kernel.js +4 -4
- package/node_modules/@sdd-agent-platform/core/dist/risk/kernel.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/risk/legacy-adapters.js +4 -7
- package/node_modules/@sdd-agent-platform/core/dist/risk/legacy-adapters.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.d.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.js +19 -17
- package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime-config.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime-config.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime.d.ts +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/routing.js +45 -15
- package/node_modules/@sdd-agent-platform/core/dist/router/routing.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/runtime-import.d.ts +28 -0
- package/node_modules/@sdd-agent-platform/core/dist/router/runtime-import.js +373 -0
- package/node_modules/@sdd-agent-platform/core/dist/router/runtime-import.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/router/runtime-validation.js +2 -2
- package/node_modules/@sdd-agent-platform/core/dist/router/runtime-validation.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.d.ts +37 -0
- package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.js +235 -0
- package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/router.d.ts +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/router.js +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/router.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.d.ts +16 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.js +126 -9
- package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.d.ts +0 -2
- package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.js +7 -5
- package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/model.d.ts +28 -8
- package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.d.ts +0 -2
- package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.js +1 -3
- package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/run-state.js +37 -27
- package/node_modules/@sdd-agent-platform/core/dist/run-state/run-state.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.d.ts +5 -2
- package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.js +53 -14
- package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/run-state/timing.d.ts +8 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state/timing.js +131 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state/timing.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state.d.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state.js +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/run-state.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/build.js +0 -3
- package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/build.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/findings.js +5 -44
- package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/findings.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/model.d.ts +1 -17
- package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.d.ts +10 -0
- package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.js +65 -0
- package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/runtime-projection-p0.d.ts +64 -0
- package/node_modules/@sdd-agent-platform/core/dist/runtime-projection-p0.js +200 -0
- package/node_modules/@sdd-agent-platform/core/dist/runtime-projection-p0.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.d.ts +2 -0
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.js +97 -10
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.js +8 -6
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.d.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.js +55 -34
- package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/stage-artifacts.d.ts +55 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-artifacts.js +322 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-artifacts.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration-contracts.d.ts +55 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration-contracts.js +241 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration-contracts.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.d.ts +888 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.js +3870 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/stage-runtime/runtime.js +8 -1
- package/node_modules/@sdd-agent-platform/core/dist/stage-runtime/runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/status/project-status.d.ts +44 -1
- package/node_modules/@sdd-agent-platform/core/dist/status/project-status.js +170 -23
- package/node_modules/@sdd-agent-platform/core/dist/status/project-status.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.d.ts +170 -18
- package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.js +544 -32
- package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/subagents/contracts.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/subagents/runtime.js +7 -7
- package/node_modules/@sdd-agent-platform/core/dist/subagents/runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/test-support/fixtures.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.js +8 -23
- package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/truth-reconciliation.d.ts +44 -0
- package/node_modules/@sdd-agent-platform/core/dist/truth-reconciliation.js +138 -0
- package/node_modules/@sdd-agent-platform/core/dist/truth-reconciliation.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.d.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.js +28 -53
- package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.d.ts +0 -2
- package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.js +10 -50
- package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.d.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.js +159 -150
- package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.d.ts +12 -2
- package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.js +238 -103
- package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/validation-cache.d.ts +26 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/validation-cache.js +73 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/validation-cache.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.d.ts +18 -0
- package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.js +27 -5
- package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.js +9 -32
- package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/work-units/contracts.d.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/evidence-packet.js +228 -15
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/evidence-packet.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/hard-checks.js +49 -15
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/hard-checks.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/policy.js +42 -6
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/policy.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/types.d.ts +4 -5
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.d.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.js +1 -2
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/dependencies.js +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.d.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.js +72 -6
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/migration-recovery.d.ts +40 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/migration-recovery.js +110 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/migration-recovery.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/repair-contract.d.ts +12 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/repair-contract.js +63 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/repair-contract.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve-task-run.d.ts +21 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve-task-run.js +95 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve-task-run.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.d.ts +55 -5
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.js +538 -34
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.js.map +1 -1
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/runtime-projections.d.ts +228 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/runtime-projections.js +452 -0
- package/node_modules/@sdd-agent-platform/core/dist/workflow-state/runtime-projections.js.map +1 -0
- package/node_modules/@sdd-agent-platform/core/package.json +3 -3
- package/node_modules/@sdd-agent-platform/core/src/ai-tools.test.ts +49 -1
- package/node_modules/@sdd-agent-platform/core/src/ai-tools.ts +67 -69
- package/node_modules/@sdd-agent-platform/core/src/artifacts/ingestion.test.ts +38 -0
- package/node_modules/@sdd-agent-platform/core/src/artifacts/ingestion.ts +65 -9
- package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-evidence.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-result.test.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-result.ts +26 -17
- package/node_modules/@sdd-agent-platform/core/src/config/init-project.test.ts +43 -31
- package/node_modules/@sdd-agent-platform/core/src/config/init-project.ts +14 -11
- package/node_modules/@sdd-agent-platform/core/src/config/project-config.ts +10 -4
- package/node_modules/@sdd-agent-platform/core/src/config/starter-documents.ts +12 -25
- package/node_modules/@sdd-agent-platform/core/src/context/build-package.ts +2 -8
- package/node_modules/@sdd-agent-platform/core/src/context/context-build.test.ts +3 -2
- package/node_modules/@sdd-agent-platform/core/src/context/evidence-summary.ts +27 -8
- package/node_modules/@sdd-agent-platform/core/src/context/log-worker.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/context-offload/contracts.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/contracts.ts +2 -1
- package/node_modules/@sdd-agent-platform/core/src/delegation/model.ts +3 -0
- package/node_modules/@sdd-agent-platform/core/src/delegation/validation.ts +8 -5
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/document-chain.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/project.ts +8 -8
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/registries.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/run-evidence.ts +4 -4
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/run-trust.ts +0 -21
- package/node_modules/@sdd-agent-platform/core/src/doctor/checks/runtime-contracts.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/doctor/doctor.test.ts +143 -45
- package/node_modules/@sdd-agent-platform/core/src/doctor/doctor.ts +193 -58
- package/node_modules/@sdd-agent-platform/core/src/evidence/lookup.ts +15 -7
- package/node_modules/@sdd-agent-platform/core/src/evidence-runtime/contracts.ts +0 -1
- package/node_modules/@sdd-agent-platform/core/src/execution/background-executor.test.ts +50 -2
- package/node_modules/@sdd-agent-platform/core/src/execution/background-executor.ts +4 -4
- package/node_modules/@sdd-agent-platform/core/src/execution/foreground-subagents.test.ts +11 -2
- package/node_modules/@sdd-agent-platform/core/src/execution/foreground-subagents.ts +3 -3
- package/node_modules/@sdd-agent-platform/core/src/execution/host-invocation.ts +5 -4
- package/node_modules/@sdd-agent-platform/core/src/execution/resident-worker.test.ts +12 -1
- package/node_modules/@sdd-agent-platform/core/src/execution/resident-worker.ts +3 -2
- package/node_modules/@sdd-agent-platform/core/src/execution/stage-team-runtime.test.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/execution/stage-team-runtime.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/execution/wave-executor.test.ts +10 -0
- package/node_modules/@sdd-agent-platform/core/src/governance/policy.test.ts +8 -0
- package/node_modules/@sdd-agent-platform/core/src/governance/policy.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/instructions.test.ts +33 -18
- package/node_modules/@sdd-agent-platform/core/src/instructions.ts +55 -62
- package/node_modules/@sdd-agent-platform/core/src/lifecycle/decision-gate.test.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/lifecycle/decision-gate.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/lifecycle/ship.test.ts +47 -0
- package/node_modules/@sdd-agent-platform/core/src/lifecycle/ship.ts +25 -8
- package/node_modules/@sdd-agent-platform/core/src/orchestration/contracts.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/orchestration/runtime.ts +74 -22
- package/node_modules/@sdd-agent-platform/core/src/phase8-contracts.test.ts +2 -3
- package/node_modules/@sdd-agent-platform/core/src/phase8-risk-kernel.test.ts +3 -3
- package/node_modules/@sdd-agent-platform/core/src/registries/agent-capability-catalog.ts +82 -35
- package/node_modules/@sdd-agent-platform/core/src/registries/agent-registry.ts +15 -15
- package/node_modules/@sdd-agent-platform/core/src/registries/agent-runtime-static.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/registries/capability-sources.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/registries/command-team-runtime.ts +10 -10
- package/node_modules/@sdd-agent-platform/core/src/registries/eval-learning-context.ts +4 -4
- package/node_modules/@sdd-agent-platform/core/src/registries/query-status.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/registries/registries.test.ts +18 -2
- package/node_modules/@sdd-agent-platform/core/src/registries/tool-capabilities.ts +3 -3
- package/node_modules/@sdd-agent-platform/core/src/registries/tool-plugins.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/registries/worker-adapters.ts +11 -11
- package/node_modules/@sdd-agent-platform/core/src/registries/workflow-gates.ts +12 -12
- package/node_modules/@sdd-agent-platform/core/src/risk/contracts.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/risk/kernel.ts +4 -4
- package/node_modules/@sdd-agent-platform/core/src/risk/legacy-adapters.ts +4 -7
- package/node_modules/@sdd-agent-platform/core/src/risk/workflow-gates.ts +20 -18
- package/node_modules/@sdd-agent-platform/core/src/router/agent-runtime-config.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/router/agent-runtime.ts +2 -0
- package/node_modules/@sdd-agent-platform/core/src/router/route-projection.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/router/route-sdd-task.test.ts +241 -4
- package/node_modules/@sdd-agent-platform/core/src/router/routing.ts +47 -15
- package/node_modules/@sdd-agent-platform/core/src/router/runtime-import.ts +453 -0
- package/node_modules/@sdd-agent-platform/core/src/router/runtime-validation.ts +2 -2
- package/node_modules/@sdd-agent-platform/core/src/router/stage-route-binding.ts +279 -0
- package/node_modules/@sdd-agent-platform/core/src/router.ts +2 -0
- package/node_modules/@sdd-agent-platform/core/src/run-state/artifacts.ts +132 -10
- package/node_modules/@sdd-agent-platform/core/src/run-state/inspect-run.ts +7 -7
- package/node_modules/@sdd-agent-platform/core/src/run-state/model.ts +31 -8
- package/node_modules/@sdd-agent-platform/core/src/run-state/run-index.ts +1 -5
- package/node_modules/@sdd-agent-platform/core/src/run-state/run-state.test.ts +50 -2
- package/node_modules/@sdd-agent-platform/core/src/run-state/run-state.ts +39 -29
- package/node_modules/@sdd-agent-platform/core/src/run-state/task-evidence.ts +62 -16
- package/node_modules/@sdd-agent-platform/core/src/run-state/timing.ts +146 -0
- package/node_modules/@sdd-agent-platform/core/src/run-state.ts +1 -0
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/build.ts +0 -3
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/findings.ts +6 -46
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/model.ts +1 -13
- package/node_modules/@sdd-agent-platform/core/src/runtime-analysis.test.ts +0 -2
- package/node_modules/@sdd-agent-platform/core/src/runtime-paths.ts +77 -0
- package/node_modules/@sdd-agent-platform/core/src/runtime-projection-p0.test.ts +96 -0
- package/node_modules/@sdd-agent-platform/core/src/runtime-projection-p0.ts +292 -0
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/document-hashes.ts +109 -10
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/run-binding.ts +8 -6
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-parser.test.ts +123 -1
- package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-parser.ts +58 -43
- package/node_modules/@sdd-agent-platform/core/src/stage-artifacts.ts +450 -0
- package/node_modules/@sdd-agent-platform/core/src/stage-collaboration-contracts.ts +322 -0
- package/node_modules/@sdd-agent-platform/core/src/stage-collaboration.test.ts +2903 -0
- package/node_modules/@sdd-agent-platform/core/src/stage-collaboration.ts +5831 -0
- package/node_modules/@sdd-agent-platform/core/src/stage-runtime/runtime.test.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/stage-runtime/runtime.ts +9 -1
- package/node_modules/@sdd-agent-platform/core/src/status/project-status.test.ts +239 -16
- package/node_modules/@sdd-agent-platform/core/src/status/project-status.ts +249 -23
- package/node_modules/@sdd-agent-platform/core/src/storage/runtime-store.test.ts +196 -4
- package/node_modules/@sdd-agent-platform/core/src/storage/runtime-store.ts +860 -54
- package/node_modules/@sdd-agent-platform/core/src/subagents/contracts.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/subagents/runtime.test.ts +3 -3
- package/node_modules/@sdd-agent-platform/core/src/subagents/runtime.ts +7 -7
- package/node_modules/@sdd-agent-platform/core/src/test-support/fixtures.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/test-support/run-state.ts +9 -23
- package/node_modules/@sdd-agent-platform/core/src/truth-reconciliation.test.ts +72 -0
- package/node_modules/@sdd-agent-platform/core/src/truth-reconciliation.ts +177 -0
- package/node_modules/@sdd-agent-platform/core/src/verification/goal-verify.test.ts +13 -87
- package/node_modules/@sdd-agent-platform/core/src/verification/goal-verify.ts +27 -56
- package/node_modules/@sdd-agent-platform/core/src/verification/rendering.ts +10 -54
- package/node_modules/@sdd-agent-platform/core/src/verification/review-gate.test.ts +8 -1
- package/node_modules/@sdd-agent-platform/core/src/verification/single-task-loop.test.ts +93 -79
- package/node_modules/@sdd-agent-platform/core/src/verification/single-task-loop.ts +166 -154
- package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.test.ts +100 -47
- package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.ts +265 -107
- package/node_modules/@sdd-agent-platform/core/src/verification/validation-cache.ts +106 -0
- package/node_modules/@sdd-agent-platform/core/src/verification/validation-wave.test.ts +47 -5
- package/node_modules/@sdd-agent-platform/core/src/verification/validation-wave.ts +48 -5
- package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.test.ts +15 -31
- package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.ts +9 -33
- package/node_modules/@sdd-agent-platform/core/src/work-units/contracts.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/evidence-packet.ts +246 -17
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/hard-checks.test.ts +339 -3
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/hard-checks.ts +53 -14
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/policy.test.ts +45 -8
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/policy.ts +45 -6
- package/node_modules/@sdd-agent-platform/core/src/workflow-gate/types.ts +6 -5
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/affected-file-conflicts.ts +1 -3
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/dependencies.ts +1 -1
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/latest-eligible-run.ts +75 -7
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/migration-recovery.ts +158 -0
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/repair-contract.ts +77 -0
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve-task-run.ts +114 -0
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve.test.ts +518 -25
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve.ts +670 -41
- package/node_modules/@sdd-agent-platform/core/src/workflow-state/runtime-projections.ts +712 -0
- package/package.json +1 -1
- package/packages/cli/dist/args.js +2 -2
- package/packages/cli/dist/args.js.map +1 -1
- package/packages/cli/dist/commands/ai-tools.js +13 -2
- package/packages/cli/dist/commands/ai-tools.js.map +1 -1
- package/packages/cli/dist/commands/context.js +1 -1
- package/packages/cli/dist/commands/context.js.map +1 -1
- package/packages/cli/dist/commands/execution.js +49 -1
- package/packages/cli/dist/commands/execution.js.map +1 -1
- package/packages/cli/dist/commands/governance.js +1 -1
- package/packages/cli/dist/commands/governance.js.map +1 -1
- package/packages/cli/dist/commands/init.js +6 -1
- package/packages/cli/dist/commands/init.js.map +1 -1
- package/packages/cli/dist/commands/lifecycle.js +15 -2
- package/packages/cli/dist/commands/lifecycle.js.map +1 -1
- package/packages/cli/dist/commands/registry/runtime.js +48 -2
- package/packages/cli/dist/commands/registry/runtime.js.map +1 -1
- package/packages/cli/dist/commands/run.js +52 -2
- package/packages/cli/dist/commands/run.js.map +1 -1
- package/packages/cli/dist/commands/stage-close.d.ts +6 -0
- package/packages/cli/dist/commands/stage-close.js +295 -0
- package/packages/cli/dist/commands/stage-close.js.map +1 -0
- package/packages/cli/dist/commands/status.js +68 -2
- package/packages/cli/dist/commands/status.js.map +1 -1
- package/packages/cli/dist/commands/test.js +180 -2
- package/packages/cli/dist/commands/test.js.map +1 -1
- package/packages/cli/dist/commands/verifies.js +7 -5
- package/packages/cli/dist/commands/verifies.js.map +1 -1
- package/packages/cli/dist/commands/verify.js +222 -26
- package/packages/cli/dist/commands/verify.js.map +1 -1
- package/packages/cli/dist/dispatch.js +4 -9
- package/packages/cli/dist/dispatch.js.map +1 -1
- package/packages/cli/dist/help.js +27 -26
- package/packages/cli/dist/help.js.map +1 -1
- package/packages/cli/dist/renderers/doctor.js +1 -1
- package/packages/cli/dist/renderers/doctor.js.map +1 -1
- package/packages/cli/dist/renderers/execution.js +1 -1
- package/packages/cli/dist/renderers/execution.js.map +1 -1
- package/packages/cli/dist/renderers/json.d.ts +1 -0
- package/packages/cli/dist/renderers/json.js +3 -0
- package/packages/cli/dist/renderers/json.js.map +1 -1
- package/packages/cli/dist/renderers/registry-runtime.d.ts +2 -1
- package/packages/cli/dist/renderers/registry-runtime.js +20 -0
- package/packages/cli/dist/renderers/registry-runtime.js.map +1 -1
- package/packages/cli/dist/renderers/router.js +1 -1
- package/packages/cli/dist/renderers/router.js.map +1 -1
- package/packages/cli/dist/renderers/workflow.d.ts +0 -4
- package/packages/cli/dist/renderers/workflow.js +30 -89
- package/packages/cli/dist/renderers/workflow.js.map +1 -1
- package/packages/cli/dist/skill-import-args.d.ts +10 -0
- package/packages/cli/dist/skill-import-args.js +47 -0
- package/packages/cli/dist/skill-import-args.js.map +1 -0
- package/packages/cli/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/cli/package.json +2 -2
- package/packages/core/dist/ai-tools.js +67 -69
- package/packages/core/dist/ai-tools.js.map +1 -1
- package/packages/core/dist/artifacts/ingestion.js +64 -9
- package/packages/core/dist/artifacts/ingestion.js.map +1 -1
- package/packages/core/dist/artifacts/sdd-evidence.js +0 -1
- package/packages/core/dist/artifacts/sdd-evidence.js.map +1 -1
- package/packages/core/dist/artifacts/sdd-result.js +26 -17
- package/packages/core/dist/artifacts/sdd-result.js.map +1 -1
- package/packages/core/dist/config/init-project.d.ts +3 -0
- package/packages/core/dist/config/init-project.js +12 -9
- package/packages/core/dist/config/init-project.js.map +1 -1
- package/packages/core/dist/config/project-config.d.ts +3 -1
- package/packages/core/dist/config/project-config.js +7 -3
- package/packages/core/dist/config/project-config.js.map +1 -1
- package/packages/core/dist/config/starter-documents.d.ts +4 -4
- package/packages/core/dist/config/starter-documents.js +12 -25
- package/packages/core/dist/config/starter-documents.js.map +1 -1
- package/packages/core/dist/context/build-package.d.ts +1 -1
- package/packages/core/dist/context/build-package.js +1 -7
- package/packages/core/dist/context/build-package.js.map +1 -1
- package/packages/core/dist/context/evidence-summary.js +26 -8
- package/packages/core/dist/context/evidence-summary.js.map +1 -1
- package/packages/core/dist/context/log-worker.js +2 -2
- package/packages/core/dist/context/log-worker.js.map +1 -1
- package/packages/core/dist/context-offload/contracts.d.ts +1 -1
- package/packages/core/dist/contracts.d.ts +2 -1
- package/packages/core/dist/contracts.js +1 -0
- package/packages/core/dist/contracts.js.map +1 -1
- package/packages/core/dist/delegation/model.d.ts +3 -0
- package/packages/core/dist/delegation/validation.d.ts +3 -0
- package/packages/core/dist/delegation/validation.js +7 -4
- package/packages/core/dist/delegation/validation.js.map +1 -1
- package/packages/core/dist/doctor/checks/document-chain.js +1 -1
- package/packages/core/dist/doctor/checks/document-chain.js.map +1 -1
- package/packages/core/dist/doctor/checks/project.js +8 -8
- package/packages/core/dist/doctor/checks/project.js.map +1 -1
- package/packages/core/dist/doctor/checks/registries.js +0 -1
- package/packages/core/dist/doctor/checks/registries.js.map +1 -1
- package/packages/core/dist/doctor/checks/run-evidence.js +4 -4
- package/packages/core/dist/doctor/checks/run-evidence.js.map +1 -1
- package/packages/core/dist/doctor/checks/run-trust.js +0 -24
- package/packages/core/dist/doctor/checks/run-trust.js.map +1 -1
- package/packages/core/dist/doctor/checks/runtime-contracts.js +1 -1
- package/packages/core/dist/doctor/checks/runtime-contracts.js.map +1 -1
- package/packages/core/dist/doctor/doctor.js +178 -58
- package/packages/core/dist/doctor/doctor.js.map +1 -1
- package/packages/core/dist/evidence/lookup.js +14 -7
- package/packages/core/dist/evidence/lookup.js.map +1 -1
- package/packages/core/dist/evidence-runtime/contracts.d.ts +0 -1
- package/packages/core/dist/execution/background-executor.js +4 -4
- package/packages/core/dist/execution/background-executor.js.map +1 -1
- package/packages/core/dist/execution/foreground-subagents.js +3 -3
- package/packages/core/dist/execution/foreground-subagents.js.map +1 -1
- package/packages/core/dist/execution/host-invocation.js +5 -4
- package/packages/core/dist/execution/host-invocation.js.map +1 -1
- package/packages/core/dist/execution/resident-worker.js +3 -2
- package/packages/core/dist/execution/resident-worker.js.map +1 -1
- package/packages/core/dist/execution/stage-team-runtime.js +2 -2
- package/packages/core/dist/execution/stage-team-runtime.js.map +1 -1
- package/packages/core/dist/governance/policy.d.ts +1 -1
- package/packages/core/dist/governance/policy.js +1 -1
- package/packages/core/dist/governance/policy.js.map +1 -1
- package/packages/core/dist/instructions.d.ts +1 -1
- package/packages/core/dist/instructions.js +54 -61
- package/packages/core/dist/instructions.js.map +1 -1
- package/packages/core/dist/lifecycle/decision-gate.js +1 -1
- package/packages/core/dist/lifecycle/decision-gate.js.map +1 -1
- package/packages/core/dist/lifecycle/ship.d.ts +1 -0
- package/packages/core/dist/lifecycle/ship.js +24 -8
- package/packages/core/dist/lifecycle/ship.js.map +1 -1
- package/packages/core/dist/orchestration/contracts.d.ts +1 -1
- package/packages/core/dist/orchestration/runtime.d.ts +12 -2
- package/packages/core/dist/orchestration/runtime.js +62 -21
- package/packages/core/dist/orchestration/runtime.js.map +1 -1
- package/packages/core/dist/registries/agent-capability-catalog.d.ts +5 -2
- package/packages/core/dist/registries/agent-capability-catalog.js +69 -27
- package/packages/core/dist/registries/agent-capability-catalog.js.map +1 -1
- package/packages/core/dist/registries/agent-registry.js +15 -15
- package/packages/core/dist/registries/agent-registry.js.map +1 -1
- package/packages/core/dist/registries/agent-runtime-static.js +1 -1
- package/packages/core/dist/registries/agent-runtime-static.js.map +1 -1
- package/packages/core/dist/registries/capability-sources.js +1 -1
- package/packages/core/dist/registries/command-team-runtime.d.ts +1 -1
- package/packages/core/dist/registries/command-team-runtime.js +9 -9
- package/packages/core/dist/registries/command-team-runtime.js.map +1 -1
- package/packages/core/dist/registries/eval-learning-context.js +4 -4
- package/packages/core/dist/registries/eval-learning-context.js.map +1 -1
- package/packages/core/dist/registries/query-status.js +2 -2
- package/packages/core/dist/registries/query-status.js.map +1 -1
- package/packages/core/dist/registries/tool-capabilities.js +3 -3
- package/packages/core/dist/registries/tool-capabilities.js.map +1 -1
- package/packages/core/dist/registries/tool-plugins.js +2 -2
- package/packages/core/dist/registries/tool-plugins.js.map +1 -1
- package/packages/core/dist/registries/worker-adapters.js +11 -11
- package/packages/core/dist/registries/worker-adapters.js.map +1 -1
- package/packages/core/dist/registries/workflow-gates.js +12 -12
- package/packages/core/dist/registries/workflow-gates.js.map +1 -1
- package/packages/core/dist/risk/contracts.d.ts +2 -2
- package/packages/core/dist/risk/kernel.js +4 -4
- package/packages/core/dist/risk/kernel.js.map +1 -1
- package/packages/core/dist/risk/legacy-adapters.js +4 -7
- package/packages/core/dist/risk/legacy-adapters.js.map +1 -1
- package/packages/core/dist/risk/workflow-gates.d.ts +2 -2
- package/packages/core/dist/risk/workflow-gates.js +19 -17
- package/packages/core/dist/risk/workflow-gates.js.map +1 -1
- package/packages/core/dist/router/agent-runtime-config.js +1 -1
- package/packages/core/dist/router/agent-runtime-config.js.map +1 -1
- package/packages/core/dist/router/agent-runtime.d.ts +2 -0
- package/packages/core/dist/router/route-projection.js +1 -1
- package/packages/core/dist/router/route-projection.js.map +1 -1
- package/packages/core/dist/router/routing.js +45 -15
- package/packages/core/dist/router/routing.js.map +1 -1
- package/packages/core/dist/router/runtime-import.d.ts +28 -0
- package/packages/core/dist/router/runtime-import.js +373 -0
- package/packages/core/dist/router/runtime-import.js.map +1 -0
- package/packages/core/dist/router/runtime-validation.js +2 -2
- package/packages/core/dist/router/runtime-validation.js.map +1 -1
- package/packages/core/dist/router/stage-route-binding.d.ts +37 -0
- package/packages/core/dist/router/stage-route-binding.js +235 -0
- package/packages/core/dist/router/stage-route-binding.js.map +1 -0
- package/packages/core/dist/router.d.ts +2 -0
- package/packages/core/dist/router.js +2 -0
- package/packages/core/dist/router.js.map +1 -1
- package/packages/core/dist/run-state/artifacts.d.ts +16 -0
- package/packages/core/dist/run-state/artifacts.js +126 -9
- package/packages/core/dist/run-state/artifacts.js.map +1 -1
- package/packages/core/dist/run-state/inspect-run.d.ts +0 -2
- package/packages/core/dist/run-state/inspect-run.js +7 -5
- package/packages/core/dist/run-state/inspect-run.js.map +1 -1
- package/packages/core/dist/run-state/model.d.ts +28 -8
- package/packages/core/dist/run-state/run-index.d.ts +0 -2
- package/packages/core/dist/run-state/run-index.js +1 -3
- package/packages/core/dist/run-state/run-index.js.map +1 -1
- package/packages/core/dist/run-state/run-state.js +37 -27
- package/packages/core/dist/run-state/run-state.js.map +1 -1
- package/packages/core/dist/run-state/task-evidence.d.ts +5 -2
- package/packages/core/dist/run-state/task-evidence.js +53 -14
- package/packages/core/dist/run-state/task-evidence.js.map +1 -1
- package/packages/core/dist/run-state/timing.d.ts +8 -0
- package/packages/core/dist/run-state/timing.js +131 -0
- package/packages/core/dist/run-state/timing.js.map +1 -0
- package/packages/core/dist/run-state.d.ts +1 -0
- package/packages/core/dist/run-state.js +1 -0
- package/packages/core/dist/run-state.js.map +1 -1
- package/packages/core/dist/runtime-analysis/build.js +0 -3
- package/packages/core/dist/runtime-analysis/build.js.map +1 -1
- package/packages/core/dist/runtime-analysis/findings.js +5 -44
- package/packages/core/dist/runtime-analysis/findings.js.map +1 -1
- package/packages/core/dist/runtime-analysis/model.d.ts +1 -17
- package/packages/core/dist/runtime-paths.d.ts +10 -0
- package/packages/core/dist/runtime-paths.js +65 -0
- package/packages/core/dist/runtime-paths.js.map +1 -1
- package/packages/core/dist/runtime-projection-p0.d.ts +64 -0
- package/packages/core/dist/runtime-projection-p0.js +200 -0
- package/packages/core/dist/runtime-projection-p0.js.map +1 -0
- package/packages/core/dist/sdd-docs/document-hashes.d.ts +2 -0
- package/packages/core/dist/sdd-docs/document-hashes.js +97 -10
- package/packages/core/dist/sdd-docs/document-hashes.js.map +1 -1
- package/packages/core/dist/sdd-docs/run-binding.d.ts +1 -1
- package/packages/core/dist/sdd-docs/run-binding.js +8 -6
- package/packages/core/dist/sdd-docs/run-binding.js.map +1 -1
- package/packages/core/dist/sdd-docs/task-parser.d.ts +1 -0
- package/packages/core/dist/sdd-docs/task-parser.js +55 -34
- package/packages/core/dist/sdd-docs/task-parser.js.map +1 -1
- package/packages/core/dist/stage-artifacts.d.ts +55 -0
- package/packages/core/dist/stage-artifacts.js +322 -0
- package/packages/core/dist/stage-artifacts.js.map +1 -0
- package/packages/core/dist/stage-collaboration-contracts.d.ts +55 -0
- package/packages/core/dist/stage-collaboration-contracts.js +241 -0
- package/packages/core/dist/stage-collaboration-contracts.js.map +1 -0
- package/packages/core/dist/stage-collaboration.d.ts +888 -0
- package/packages/core/dist/stage-collaboration.js +3870 -0
- package/packages/core/dist/stage-collaboration.js.map +1 -0
- package/packages/core/dist/stage-runtime/runtime.js +8 -1
- package/packages/core/dist/stage-runtime/runtime.js.map +1 -1
- package/packages/core/dist/status/project-status.d.ts +44 -1
- package/packages/core/dist/status/project-status.js +170 -23
- package/packages/core/dist/status/project-status.js.map +1 -1
- package/packages/core/dist/storage/runtime-store.d.ts +170 -18
- package/packages/core/dist/storage/runtime-store.js +544 -32
- package/packages/core/dist/storage/runtime-store.js.map +1 -1
- package/packages/core/dist/subagents/contracts.d.ts +1 -1
- package/packages/core/dist/subagents/runtime.js +7 -7
- package/packages/core/dist/subagents/runtime.js.map +1 -1
- package/packages/core/dist/test-support/fixtures.js +1 -1
- package/packages/core/dist/test-support/run-state.d.ts +1 -1
- package/packages/core/dist/test-support/run-state.js +8 -23
- package/packages/core/dist/test-support/run-state.js.map +1 -1
- package/packages/core/dist/truth-reconciliation.d.ts +44 -0
- package/packages/core/dist/truth-reconciliation.js +138 -0
- package/packages/core/dist/truth-reconciliation.js.map +1 -0
- package/packages/core/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/core/dist/verification/goal-verify.d.ts +0 -1
- package/packages/core/dist/verification/goal-verify.js +28 -53
- package/packages/core/dist/verification/goal-verify.js.map +1 -1
- package/packages/core/dist/verification/rendering.d.ts +0 -2
- package/packages/core/dist/verification/rendering.js +10 -50
- package/packages/core/dist/verification/rendering.js.map +1 -1
- package/packages/core/dist/verification/single-task-loop.d.ts +0 -1
- package/packages/core/dist/verification/single-task-loop.js +159 -150
- package/packages/core/dist/verification/single-task-loop.js.map +1 -1
- package/packages/core/dist/verification/test-runtime.d.ts +12 -2
- package/packages/core/dist/verification/test-runtime.js +238 -103
- package/packages/core/dist/verification/test-runtime.js.map +1 -1
- package/packages/core/dist/verification/validation-cache.d.ts +26 -0
- package/packages/core/dist/verification/validation-cache.js +73 -0
- package/packages/core/dist/verification/validation-cache.js.map +1 -0
- package/packages/core/dist/verification/validation-wave.d.ts +18 -0
- package/packages/core/dist/verification/validation-wave.js +27 -5
- package/packages/core/dist/verification/validation-wave.js.map +1 -1
- package/packages/core/dist/verification/verify-contract.d.ts +1 -1
- package/packages/core/dist/verification/verify-contract.js +9 -32
- package/packages/core/dist/verification/verify-contract.js.map +1 -1
- package/packages/core/dist/work-units/contracts.d.ts +1 -1
- package/packages/core/dist/workflow-gate/evidence-packet.js +228 -15
- package/packages/core/dist/workflow-gate/evidence-packet.js.map +1 -1
- package/packages/core/dist/workflow-gate/hard-checks.js +49 -15
- package/packages/core/dist/workflow-gate/hard-checks.js.map +1 -1
- package/packages/core/dist/workflow-gate/policy.js +42 -6
- package/packages/core/dist/workflow-gate/policy.js.map +1 -1
- package/packages/core/dist/workflow-gate/types.d.ts +4 -5
- package/packages/core/dist/workflow-state/affected-file-conflicts.d.ts +0 -1
- package/packages/core/dist/workflow-state/affected-file-conflicts.js +1 -2
- package/packages/core/dist/workflow-state/affected-file-conflicts.js.map +1 -1
- package/packages/core/dist/workflow-state/dependencies.js +1 -1
- package/packages/core/dist/workflow-state/latest-eligible-run.d.ts +0 -1
- package/packages/core/dist/workflow-state/latest-eligible-run.js +72 -6
- package/packages/core/dist/workflow-state/latest-eligible-run.js.map +1 -1
- package/packages/core/dist/workflow-state/migration-recovery.d.ts +40 -0
- package/packages/core/dist/workflow-state/migration-recovery.js +110 -0
- package/packages/core/dist/workflow-state/migration-recovery.js.map +1 -0
- package/packages/core/dist/workflow-state/repair-contract.d.ts +12 -0
- package/packages/core/dist/workflow-state/repair-contract.js +63 -0
- package/packages/core/dist/workflow-state/repair-contract.js.map +1 -0
- package/packages/core/dist/workflow-state/resolve-task-run.d.ts +21 -0
- package/packages/core/dist/workflow-state/resolve-task-run.js +95 -0
- package/packages/core/dist/workflow-state/resolve-task-run.js.map +1 -0
- package/packages/core/dist/workflow-state/resolve.d.ts +55 -5
- package/packages/core/dist/workflow-state/resolve.js +538 -34
- package/packages/core/dist/workflow-state/resolve.js.map +1 -1
- package/packages/core/dist/workflow-state/runtime-projections.d.ts +228 -0
- package/packages/core/dist/workflow-state/runtime-projections.js +452 -0
- package/packages/core/dist/workflow-state/runtime-projections.js.map +1 -0
- package/packages/core/package.json +3 -3
- package/node_modules/@sdd-agent-platform/core/dist/doctor/render.d.ts +0 -2
- package/node_modules/@sdd-agent-platform/core/dist/doctor/render.js +0 -44
- package/node_modules/@sdd-agent-platform/core/dist/doctor/render.js.map +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.d.ts +0 -17
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.js +0 -243
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.js.map +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.d.ts +0 -110
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.js +0 -497
- package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.js.map +0 -1
- package/node_modules/@sdd-agent-platform/core/dist/sync-back.d.ts +0 -2
- package/node_modules/@sdd-agent-platform/core/dist/sync-back.js +0 -3
- package/node_modules/@sdd-agent-platform/core/dist/sync-back.js.map +0 -1
- package/node_modules/@sdd-agent-platform/core/src/sync-back/apply.ts +0 -270
- package/node_modules/@sdd-agent-platform/core/src/sync-back/inspect.ts +0 -655
- package/node_modules/@sdd-agent-platform/core/src/sync-back/sync-back.test.ts +0 -569
- package/node_modules/@sdd-agent-platform/core/src/sync-back.ts +0 -2
- package/packages/cli/dist/commands/artifact.d.ts +0 -6
- package/packages/cli/dist/commands/artifact.js +0 -168
- package/packages/cli/dist/commands/artifact.js.map +0 -1
- package/packages/cli/dist/commands/sync-back.d.ts +0 -6
- package/packages/cli/dist/commands/sync-back.js +0 -82
- package/packages/cli/dist/commands/sync-back.js.map +0 -1
- package/packages/cli/dist/renderers/artifacts.d.ts +0 -5
- package/packages/cli/dist/renderers/artifacts.js +0 -43
- package/packages/cli/dist/renderers/artifacts.js.map +0 -1
- package/packages/core/dist/doctor/render.d.ts +0 -2
- package/packages/core/dist/doctor/render.js +0 -44
- package/packages/core/dist/doctor/render.js.map +0 -1
- package/packages/core/dist/sync-back/apply.d.ts +0 -17
- package/packages/core/dist/sync-back/apply.js +0 -243
- package/packages/core/dist/sync-back/apply.js.map +0 -1
- package/packages/core/dist/sync-back/inspect.d.ts +0 -110
- package/packages/core/dist/sync-back/inspect.js +0 -497
- package/packages/core/dist/sync-back/inspect.js.map +0 -1
- package/packages/core/dist/sync-back.d.ts +0 -2
- package/packages/core/dist/sync-back.js +0 -3
- package/packages/core/dist/sync-back.js.map +0 -1
|
@@ -5,10 +5,8 @@ import type {
|
|
|
5
5
|
RuntimeAnalysisReport,
|
|
6
6
|
RuntimeAnalysisReportInput,
|
|
7
7
|
RuntimeAnalysisRunInspectionLike,
|
|
8
|
-
RuntimeAnalysisStatus
|
|
9
|
-
RuntimeAnalysisSyncBackLike
|
|
8
|
+
RuntimeAnalysisStatus
|
|
10
9
|
} from './model.js';
|
|
11
|
-
|
|
12
10
|
export function createRuntimeAnalysisReport(input: RuntimeAnalysisReportInput): RuntimeAnalysisReport {
|
|
13
11
|
const findings = buildRuntimeAnalysisFindings(input);
|
|
14
12
|
return {
|
|
@@ -30,7 +28,6 @@ export function createRuntimeAnalysisReport(input: RuntimeAnalysisReportInput):
|
|
|
30
28
|
runInspection: input.runInspection,
|
|
31
29
|
evidenceSummary: input.evidenceSummary,
|
|
32
30
|
contextPackage: input.contextPackage,
|
|
33
|
-
syncBack: input.syncBack,
|
|
34
31
|
findings
|
|
35
32
|
};
|
|
36
33
|
}
|
|
@@ -76,7 +73,7 @@ export function buildRuntimeAnalysisFindings(input: RuntimeAnalysisReportInput):
|
|
|
76
73
|
category: 'run',
|
|
77
74
|
source: input.status.latestRun?.runId ?? 'latest-run',
|
|
78
75
|
message: reason,
|
|
79
|
-
action: input.status.latestRun?.currentTask ? `sdd test task
|
|
76
|
+
action: input.status.latestRun?.currentTask ? `sdd test task-${input.status.latestRun.currentTask} --branch ${input.branch}` : undefined,
|
|
80
77
|
runId: input.status.latestRun?.runId ?? undefined,
|
|
81
78
|
taskId: input.status.latestRun?.currentTask ?? undefined
|
|
82
79
|
});
|
|
@@ -173,9 +170,6 @@ export function buildRuntimeAnalysisFindings(input: RuntimeAnalysisReportInput):
|
|
|
173
170
|
});
|
|
174
171
|
}
|
|
175
172
|
}
|
|
176
|
-
if (input.syncBack) {
|
|
177
|
-
addSyncBackFindings(input.syncBack, add);
|
|
178
|
-
}
|
|
179
173
|
for (const issue of input.inputIssues) {
|
|
180
174
|
add({
|
|
181
175
|
severity: 'warning',
|
|
@@ -209,18 +203,7 @@ function addRunInspectionFindings(run: RuntimeAnalysisRunInspectionLike, add: (f
|
|
|
209
203
|
category: 'run',
|
|
210
204
|
source: `${run.summary.runId}:validation`,
|
|
211
205
|
message: `Run validation status is ${run.validation.status}.`,
|
|
212
|
-
action: run.summary.currentTask ? `sdd test task
|
|
213
|
-
runId: run.summary.runId,
|
|
214
|
-
taskId: run.summary.currentTask ?? undefined
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
if (run.syncBack.status === 'proposed') {
|
|
218
|
-
add({
|
|
219
|
-
severity: 'warning',
|
|
220
|
-
category: 'sync_back',
|
|
221
|
-
source: `${run.summary.runId}:sync_back`,
|
|
222
|
-
message: 'Run has an unapplied sync-back proposal.',
|
|
223
|
-
action: run.summary.currentTask ? `sdd sync-back inspect --branch ${run.summary.partition ?? run.summary.gitBranch ?? 'master'} --task ${run.summary.currentTask}` : undefined,
|
|
206
|
+
action: run.summary.currentTask ? `sdd test task-${run.summary.currentTask} --branch ${run.summary.partition ?? run.summary.gitBranch ?? 'master'}` : undefined,
|
|
224
207
|
runId: run.summary.runId,
|
|
225
208
|
taskId: run.summary.currentTask ?? undefined
|
|
226
209
|
});
|
|
@@ -233,7 +216,7 @@ function addEvidenceSummaryFindings(summary: RuntimeAnalysisEvidenceSummaryLike,
|
|
|
233
216
|
category: 'evidence',
|
|
234
217
|
source: `evidence:${summary.runId}`,
|
|
235
218
|
message: 'Evidence summary is derived guidance only and cannot satisfy PASS evidence.',
|
|
236
|
-
action: summary.taskId ? `sdd test task
|
|
219
|
+
action: summary.taskId ? `sdd test task-${summary.taskId}` : undefined,
|
|
237
220
|
runId: summary.runId,
|
|
238
221
|
taskId: summary.taskId ?? undefined
|
|
239
222
|
});
|
|
@@ -243,7 +226,7 @@ function addEvidenceSummaryFindings(summary: RuntimeAnalysisEvidenceSummaryLike,
|
|
|
243
226
|
category: 'evidence',
|
|
244
227
|
source: `evidence:${summary.runId}`,
|
|
245
228
|
message: `Evidence projection has pass=${summary.passCount}, blocked=${summary.blockedCount}, fail=${summary.failCount}.`,
|
|
246
|
-
action: summary.taskId ? `sdd test task
|
|
229
|
+
action: summary.taskId ? `sdd test task-${summary.taskId}` : undefined,
|
|
247
230
|
runId: summary.runId,
|
|
248
231
|
taskId: summary.taskId ?? undefined
|
|
249
232
|
});
|
|
@@ -254,36 +237,13 @@ function addEvidenceSummaryFindings(summary: RuntimeAnalysisEvidenceSummaryLike,
|
|
|
254
237
|
category: 'evidence',
|
|
255
238
|
source: `evidence:${summary.runId}`,
|
|
256
239
|
message: `Evidence quality issues: ${summary.issueCodes.join(', ')}.`,
|
|
257
|
-
action: summary.taskId ? `sdd
|
|
240
|
+
action: summary.taskId ? `sdd test task-${summary.taskId}` : 'sdd status --compact-json',
|
|
258
241
|
runId: summary.runId,
|
|
259
242
|
taskId: summary.taskId ?? undefined
|
|
260
243
|
});
|
|
261
244
|
}
|
|
262
245
|
}
|
|
263
246
|
|
|
264
|
-
function addSyncBackFindings(syncBack: RuntimeAnalysisSyncBackLike, add: (finding: RuntimeAnalysisFinding) => void): void {
|
|
265
|
-
if (syncBack.status === 'ready') {
|
|
266
|
-
add({
|
|
267
|
-
severity: 'warning',
|
|
268
|
-
category: 'sync_back',
|
|
269
|
-
source: syncBack.targetTasksPath,
|
|
270
|
-
message: `Sync-back is ready for ${syncBack.taskId ?? 'unknown task'} but not applied.`,
|
|
271
|
-
action: `sdd sync-back apply ${syncBack.runId} --branch ${syncBack.branch} --task ${syncBack.taskId ?? '<task_id>'}${syncBack.applyPolicy.requiresApproval ? ' --approved' : ''}`,
|
|
272
|
-
runId: syncBack.runId,
|
|
273
|
-
taskId: syncBack.taskId ?? undefined
|
|
274
|
-
});
|
|
275
|
-
} else if (syncBack.status === 'blocked') {
|
|
276
|
-
add({
|
|
277
|
-
severity: 'blocking',
|
|
278
|
-
category: 'sync_back',
|
|
279
|
-
source: syncBack.targetTasksPath,
|
|
280
|
-
message: `Sync-back is blocked: ${syncBack.reasons.join('; ')}`,
|
|
281
|
-
action: `sdd sync-back inspect ${syncBack.runId} --branch ${syncBack.branch} --task ${syncBack.taskId ?? '<task_id>'}`,
|
|
282
|
-
runId: syncBack.runId,
|
|
283
|
-
taskId: syncBack.taskId ?? undefined
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
247
|
|
|
288
248
|
export function summarizeRuntimeAnalysisStatus(findings: RuntimeAnalysisFinding[]): RuntimeAnalysisStatus {
|
|
289
249
|
if (findings.some((finding) => finding.severity === 'blocking')) {
|
|
@@ -48,7 +48,6 @@ export interface RuntimeAnalysisRunInspectionLike {
|
|
|
48
48
|
summary: { runId: string; currentTask: string | null; partition: string | null; gitBranch: string | null };
|
|
49
49
|
state: { status: string };
|
|
50
50
|
validation: { status: string };
|
|
51
|
-
syncBack: { status: string };
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
export interface RuntimeAnalysisEvidenceSummaryLike {
|
|
@@ -71,19 +70,10 @@ export interface RuntimeAnalysisContextPackageLike {
|
|
|
71
70
|
nextCommands: string[];
|
|
72
71
|
}
|
|
73
72
|
|
|
74
|
-
export interface RuntimeAnalysisSyncBackLike {
|
|
75
|
-
runId: string;
|
|
76
|
-
branch: string;
|
|
77
|
-
taskId: string | null;
|
|
78
|
-
status: 'ready' | 'blocked' | 'applied';
|
|
79
|
-
reasons: string[];
|
|
80
|
-
targetTasksPath: string;
|
|
81
|
-
applyPolicy: { requiresApproval: boolean };
|
|
82
|
-
}
|
|
83
73
|
|
|
84
74
|
export type RuntimeAnalysisStatus = 'PASS' | 'WARN' | 'BLOCKED';
|
|
85
75
|
export type RuntimeAnalysisFindingSeverity = 'info' | 'warning' | 'blocking';
|
|
86
|
-
export type RuntimeAnalysisFindingCategory = 'workflow' | 'doctor' | 'run_index' | 'run' | 'evidence' | '
|
|
76
|
+
export type RuntimeAnalysisFindingCategory = 'workflow' | 'doctor' | 'run_index' | 'run' | 'evidence' | 'task_graph' | 'wave_plan' | 'context';
|
|
87
77
|
|
|
88
78
|
export interface RuntimeAnalysisOptions {
|
|
89
79
|
branch?: string | null;
|
|
@@ -124,7 +114,6 @@ export interface RuntimeAnalysisReportInput {
|
|
|
124
114
|
runInspection: RuntimeAnalysisRunInspectionLike | null;
|
|
125
115
|
evidenceSummary: RuntimeAnalysisEvidenceSummaryLike | null;
|
|
126
116
|
contextPackage: RuntimeAnalysisContextPackageLike | null;
|
|
127
|
-
syncBack: RuntimeAnalysisSyncBackLike | null;
|
|
128
117
|
inputIssues: RuntimeAnalysisInputIssue[];
|
|
129
118
|
}
|
|
130
119
|
|
|
@@ -147,6 +136,5 @@ export interface RuntimeAnalysisReport {
|
|
|
147
136
|
runInspection: RuntimeAnalysisRunInspectionLike | null;
|
|
148
137
|
evidenceSummary: RuntimeAnalysisEvidenceSummaryLike | null;
|
|
149
138
|
contextPackage: RuntimeAnalysisContextPackageLike | null;
|
|
150
|
-
syncBack: RuntimeAnalysisSyncBackLike | null;
|
|
151
139
|
findings: RuntimeAnalysisFinding[];
|
|
152
140
|
}
|
|
@@ -59,8 +59,6 @@ test('runtime analysis report composes workflow runtime evidence and non-authori
|
|
|
59
59
|
assert.equal(report.contextPackage?.taskId, 'T1');
|
|
60
60
|
assert.equal(report.contextPackage?.authoritative, false);
|
|
61
61
|
assert.equal(report.contextPackage?.usableForPass, false);
|
|
62
|
-
assert.equal(report.syncBack?.status, 'ready');
|
|
63
|
-
assert.equal(report.findings.some((finding) => finding.category === 'sync_back' && finding.action?.includes('sdd sync-back apply run-1 --branch feature --task T1')), true);
|
|
64
62
|
assert.equal(report.findings.some((finding) => finding.category === 'evidence' && finding.message.includes('cannot satisfy PASS evidence')), true);
|
|
65
63
|
} finally {
|
|
66
64
|
await rm(root, { recursive: true, force: true });
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { assertSafePathSegment, branchToSafePartition, normalizePortablePath } from './path-safety.js';
|
|
3
|
+
import type { SddStage } from './contracts.js';
|
|
3
4
|
|
|
4
5
|
export function getWorktreesDir(projectRoot: string): string {
|
|
5
6
|
return path.join(getSddDir(projectRoot), 'worktrees');
|
|
@@ -17,6 +18,64 @@ export function getRunsDir(projectRoot: string): string {
|
|
|
17
18
|
return path.join(getSddDir(projectRoot), 'runs');
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
export function getRunEvidenceRoot(projectRoot: string): string {
|
|
22
|
+
return getRunsDir(projectRoot);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function getBranchStageEvidenceDir(projectRoot: string, branch: string, stage: SddStage): string {
|
|
26
|
+
return path.join(getRunEvidenceRoot(projectRoot), branchToSafePartition(branch), assertKnownSddStage(stage));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function getBranchStageEvidencePath(projectRoot: string, branch: string, stage: SddStage, fileName: string): string {
|
|
30
|
+
return path.join(getBranchStageEvidenceDir(projectRoot, branch, stage), normalizeBranchStageEvidenceFileName(fileName));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function toBranchStageEvidenceRef(branch: string, stage: SddStage, fileName: string): string {
|
|
34
|
+
return `.sdd/runs/${branchToSafePartition(branch)}/${assertKnownSddStage(stage)}/${normalizeBranchStageEvidenceFileName(fileName)}`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function normalizeBranchStageEvidenceRef(value: string): string {
|
|
38
|
+
const normalized = normalizePortablePath(value);
|
|
39
|
+
if (path.isAbsolute(value) || !normalized.startsWith('.sdd/runs/')) {
|
|
40
|
+
throw new Error(`Stage evidence ref must start with .sdd/runs/: ${value}`);
|
|
41
|
+
}
|
|
42
|
+
const parts = normalized.split('/');
|
|
43
|
+
if (parts.length !== 5) {
|
|
44
|
+
throw new Error(`Stage evidence ref must be .sdd/runs/<branch>/<stage>/<file>: ${value}`);
|
|
45
|
+
}
|
|
46
|
+
assertSafePathSegment(parts[2], 'branch');
|
|
47
|
+
assertKnownSddStage(parts[3]);
|
|
48
|
+
normalizeBranchStageEvidenceFileName(parts[4]);
|
|
49
|
+
return parts.join('/');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function isBranchStageEvidenceRef(value: string): boolean {
|
|
53
|
+
try {
|
|
54
|
+
normalizeBranchStageEvidenceRef(value);
|
|
55
|
+
return true;
|
|
56
|
+
} catch {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function getBranchStageEvidencePathFromRef(projectRoot: string, ref: string): string {
|
|
62
|
+
return path.join(projectRoot, ...normalizeBranchStageEvidenceRef(ref).split('/'));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function normalizeStageEvidenceOrLegacyArtifactRef(value: string): string {
|
|
66
|
+
if (isBranchStageEvidenceRef(value)) {
|
|
67
|
+
return normalizeBranchStageEvidenceRef(value);
|
|
68
|
+
}
|
|
69
|
+
return getRunRelativeArtifactPath(toArtifactRootRelativePath(value));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function toEvidencePayloadFileName(value: string): string {
|
|
73
|
+
if (isBranchStageEvidenceRef(value)) {
|
|
74
|
+
return normalizeBranchStageEvidenceRef(value).split('/')[4];
|
|
75
|
+
}
|
|
76
|
+
return toArtifactRootRelativePath(value);
|
|
77
|
+
}
|
|
78
|
+
|
|
20
79
|
export function getLocalRunIndexPath(projectRoot: string): string {
|
|
21
80
|
return path.join(getSddDir(projectRoot), 'run-index.json');
|
|
22
81
|
}
|
|
@@ -174,3 +233,21 @@ export function normalizeEvidenceRootRelativePath(value: string): string {
|
|
|
174
233
|
}
|
|
175
234
|
return normalized;
|
|
176
235
|
}
|
|
236
|
+
|
|
237
|
+
function assertKnownSddStage(stage: string): SddStage {
|
|
238
|
+
if (!KNOWN_SDD_STAGES.includes(stage as SddStage)) {
|
|
239
|
+
throw new Error(`Unknown SDD stage: ${stage}`);
|
|
240
|
+
}
|
|
241
|
+
return stage as SddStage;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function normalizeBranchStageEvidenceFileName(fileName: string): string {
|
|
245
|
+
if (path.isAbsolute(fileName) || fileName.includes('/') || fileName.includes('\\') || fileName.includes('..')) {
|
|
246
|
+
throw new Error(`Stage evidence file name must be a single safe file name: ${fileName}`);
|
|
247
|
+
}
|
|
248
|
+
const normalized = normalizePortablePath(fileName);
|
|
249
|
+
assertSafePathSegment(normalized, 'stageEvidenceFileName');
|
|
250
|
+
return normalized;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const KNOWN_SDD_STAGES: SddStage[] = ['spec', 'plan', 'tasks', 'verifies', 'do', 'test', 'goal-verify', 'ship'];
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import test from 'node:test';
|
|
6
|
+
|
|
7
|
+
import { initProject } from './config/init-project.js';
|
|
8
|
+
import { hashDocumentContent } from './sdd-docs/document-hashes.js';
|
|
9
|
+
import {
|
|
10
|
+
RUNTIME_PROJECTION_P0_INVENTORY,
|
|
11
|
+
inspectRuntimeProjectionP0,
|
|
12
|
+
recordRuntimeRefHashRegistryProjection
|
|
13
|
+
} from './runtime-projection-p0.js';
|
|
14
|
+
|
|
15
|
+
const fixedTime = '2026-05-31T00:00:00.000Z';
|
|
16
|
+
|
|
17
|
+
test('Phase 9.19 P0 inventory keeps mutable runtime state in SQLite primitives', () => {
|
|
18
|
+
const byKey = new Map(RUNTIME_PROJECTION_P0_INVENTORY.map((item) => [item.key, item]));
|
|
19
|
+
|
|
20
|
+
assert.equal(RUNTIME_PROJECTION_P0_INVENTORY.length, 17);
|
|
21
|
+
assert.equal(byKey.get('lifecycleDecisions')?.primitive, 'projections:phase8_lifecycle_risk_decision');
|
|
22
|
+
assert.equal(byKey.get('stageRuns')?.primitive, 'projections:phase8_stage_run');
|
|
23
|
+
assert.equal(byKey.get('stageHandoffs')?.primitive, 'projections:phase8_workflow_handoff');
|
|
24
|
+
assert.equal(byKey.get('evidenceItems')?.storage, 'sqlite-ref-hash-only');
|
|
25
|
+
assert.equal(byKey.get('evidenceSets')?.storage, 'sqlite-ref-hash-only');
|
|
26
|
+
assert.equal(byKey.get('workflowCurrentState')?.primitive, 'projections:phase9_25_workflow_current_state');
|
|
27
|
+
assert.equal(byKey.get('workflowCurrentState')?.storage, 'sqlite-projection');
|
|
28
|
+
assert.equal(byKey.get('taskOrchestration')?.primitive, 'projections:phase9_26_task_orchestration');
|
|
29
|
+
assert.equal(byKey.get('validationUnits')?.primitive, 'projections:phase9_26_validation_unit');
|
|
30
|
+
assert.equal(byKey.get('truthAlignment')?.primitive, 'projections:phase9_12_truth_alignment');
|
|
31
|
+
assert.equal(byKey.get('nextIntent')?.storage, 'sqlite-projection');
|
|
32
|
+
assert.equal(byKey.get('nextIntent')?.primitive, 'projections:phase9_29_next_intent');
|
|
33
|
+
assert.equal(RUNTIME_PROJECTION_P0_INVENTORY.every((item) => item.writer === 'runtime'), true);
|
|
34
|
+
assert.equal(RUNTIME_PROJECTION_P0_INVENTORY.every((item) => item.markdownBodyAuthority === false), true);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('Phase 9.19 ref/hash registry is idempotent and reports stale refs without rewriting Markdown', async () => {
|
|
38
|
+
const root = await mkdtemp(path.join(tmpdir(), 'sdd-runtime-projection-p0-'));
|
|
39
|
+
try {
|
|
40
|
+
await initProject(root);
|
|
41
|
+
const artifactRef = '.sdd/runs/master/do/implementation-v1.md';
|
|
42
|
+
const artifactPath = path.join(root, artifactRef);
|
|
43
|
+
await mkdir(path.dirname(artifactPath), { recursive: true });
|
|
44
|
+
const artifact = [
|
|
45
|
+
'---',
|
|
46
|
+
'contract: sdd-do-implementation-v1',
|
|
47
|
+
'branch: master',
|
|
48
|
+
'stage: do',
|
|
49
|
+
'kind: implementation_evidence',
|
|
50
|
+
'producer: implementer',
|
|
51
|
+
'---',
|
|
52
|
+
'',
|
|
53
|
+
'Implementation evidence.'
|
|
54
|
+
].join('\n');
|
|
55
|
+
await writeFile(artifactPath, artifact, 'utf8');
|
|
56
|
+
const artifactHash = hashDocumentContent(artifact);
|
|
57
|
+
|
|
58
|
+
const first = await recordRuntimeRefHashRegistryProjection(root, {
|
|
59
|
+
branch: 'master',
|
|
60
|
+
refs: [{ kind: 'artifact', ref: artifactRef, hash: artifactHash }],
|
|
61
|
+
generatedAt: fixedTime
|
|
62
|
+
});
|
|
63
|
+
const second = await recordRuntimeRefHashRegistryProjection(root, {
|
|
64
|
+
branch: 'master',
|
|
65
|
+
refs: [{ kind: 'artifact', ref: artifactRef, hash: artifactHash }],
|
|
66
|
+
generatedAt: '2026-05-31T00:01:00.000Z'
|
|
67
|
+
});
|
|
68
|
+
const beforeInspectHash = hashDocumentContent(await readFile(artifactPath, 'utf8'));
|
|
69
|
+
const freshDiagnostic = await inspectRuntimeProjectionP0(root, 'master');
|
|
70
|
+
const afterInspectHash = hashDocumentContent(await readFile(artifactPath, 'utf8'));
|
|
71
|
+
|
|
72
|
+
assert.equal(first.status, 'created');
|
|
73
|
+
assert.equal(first.envelope.payload.status, 'fresh');
|
|
74
|
+
assert.equal(second.status, 'unchanged');
|
|
75
|
+
assert.equal(second.envelope.id, first.envelope.id);
|
|
76
|
+
assert.equal(freshDiagnostic.status, 'pass');
|
|
77
|
+
assert.equal(freshDiagnostic.refHashRegistry.status, 'fresh');
|
|
78
|
+
assert.equal(freshDiagnostic.refHashRegistry.envelopeStaleness, 'fresh');
|
|
79
|
+
assert.equal(beforeInspectHash, afterInspectHash);
|
|
80
|
+
|
|
81
|
+
const changedArtifact = `${artifact}\nChanged after registry.\n`;
|
|
82
|
+
await writeFile(artifactPath, changedArtifact, 'utf8');
|
|
83
|
+
const changedHashBeforeInspect = hashDocumentContent(await readFile(artifactPath, 'utf8'));
|
|
84
|
+
const staleDiagnostic = await inspectRuntimeProjectionP0(root, 'master');
|
|
85
|
+
const changedHashAfterInspect = hashDocumentContent(await readFile(artifactPath, 'utf8'));
|
|
86
|
+
|
|
87
|
+
assert.equal(staleDiagnostic.status, 'blocked');
|
|
88
|
+
assert.equal(staleDiagnostic.refHashRegistry.status, 'blocked');
|
|
89
|
+
assert.equal(staleDiagnostic.refHashRegistry.envelopeStaleness, 'stale');
|
|
90
|
+
assert.deepEqual(staleDiagnostic.refHashRegistry.staleRefs.map((ref) => ref.ref), [artifactRef]);
|
|
91
|
+
assert.match(staleDiagnostic.refHashRegistry.reasons[0], /hash is stale/);
|
|
92
|
+
assert.equal(changedHashBeforeInspect, changedHashAfterInspect);
|
|
93
|
+
} finally {
|
|
94
|
+
await rm(root, { recursive: true, force: true });
|
|
95
|
+
}
|
|
96
|
+
});
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
import type { RuntimeProjectionEnvelope, RuntimeProjectionStaleness, RuntimeRef } from './contracts.js';
|
|
6
|
+
import { branchToSafePartition, normalizePortablePath } from './path-safety.js';
|
|
7
|
+
import { hashDocumentContent } from './sdd-docs/document-hashes.js';
|
|
8
|
+
import { listRuntimeProjections, readRuntimeProjectionEnvelope, recordRuntimeProjectionEnvelope, runtimeProjectionStaleness, type RuntimeProjectionEnvelopeWriteResult } from './storage/runtime-store.js';
|
|
9
|
+
import {
|
|
10
|
+
NEXT_INTENT_PROJECTION_TYPE,
|
|
11
|
+
TASK_ORCHESTRATION_PROJECTION_TYPE,
|
|
12
|
+
VALIDATION_UNIT_PROJECTION_TYPE,
|
|
13
|
+
WORKFLOW_CURRENT_STATE_PROJECTION_TYPE
|
|
14
|
+
} from './workflow-state/runtime-projections.js';
|
|
15
|
+
|
|
16
|
+
export const RUNTIME_PROJECTION_P0_CONTRACT_VERSION = 'phase9.19-runtime-sqlite-contract-projection-p0-v1' as const;
|
|
17
|
+
export const RUNTIME_REF_HASH_REGISTRY_PROJECTION_TYPE = 'phase9_19_ref_hash_registry';
|
|
18
|
+
export const RUNTIME_REF_HASH_REGISTRY_PRODUCER_VERSION = 'phase9.19-ref-hash-registry-v1';
|
|
19
|
+
export const STAGE_ROUTE_BINDING_PROJECTION_TYPE = 'phase9_18_stage_route_binding';
|
|
20
|
+
export const STAGE_ROUTE_BINDING_PRODUCER_VERSION = 'phase9.18-stage-route-binding-v1';
|
|
21
|
+
export const TRUTH_RECONCILIATION_PROJECTION_TYPE = 'phase9_21_truth_reconciliation';
|
|
22
|
+
|
|
23
|
+
export type RuntimeProjectionP0Key =
|
|
24
|
+
| 'lifecycleDecisions'
|
|
25
|
+
| 'riskSignals'
|
|
26
|
+
| 'stageRuns'
|
|
27
|
+
| 'stageHandoffs'
|
|
28
|
+
| 'gates'
|
|
29
|
+
| 'gapBlockers'
|
|
30
|
+
| 'evidenceItems'
|
|
31
|
+
| 'evidenceSets'
|
|
32
|
+
| 'selectionPointers'
|
|
33
|
+
| 'workflowCurrentState'
|
|
34
|
+
| 'taskOrchestration'
|
|
35
|
+
| 'validationUnits'
|
|
36
|
+
| 'truthAlignment'
|
|
37
|
+
| 'truthReconciliation'
|
|
38
|
+
| 'stageRouteBindings'
|
|
39
|
+
| 'nextIntent'
|
|
40
|
+
| 'auditEvents';
|
|
41
|
+
|
|
42
|
+
export type RuntimeProjectionP0Storage = 'sqlite' | 'sqlite-ref-hash-only' | 'sqlite-projection';
|
|
43
|
+
export type RuntimeProjectionP0HealthStatus = 'pass' | 'warn' | 'blocked';
|
|
44
|
+
export type RuntimeRefFreshnessStatus = 'fresh' | 'stale' | 'missing' | 'unhashed' | 'unsafe' | 'not_file_backed';
|
|
45
|
+
|
|
46
|
+
export interface RuntimeProjectionP0InventoryItem {
|
|
47
|
+
key: RuntimeProjectionP0Key;
|
|
48
|
+
storage: RuntimeProjectionP0Storage;
|
|
49
|
+
primitive: string;
|
|
50
|
+
writer: 'runtime';
|
|
51
|
+
responsibility: string;
|
|
52
|
+
consumers: string[];
|
|
53
|
+
markdownBodyAuthority: false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface RuntimeRefFreshness {
|
|
57
|
+
ref: RuntimeRef;
|
|
58
|
+
normalizedRef: string;
|
|
59
|
+
expectedHash: string | null;
|
|
60
|
+
currentHash: string | null;
|
|
61
|
+
status: RuntimeRefFreshnessStatus;
|
|
62
|
+
reason: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface RuntimeRefHashRegistryProjection {
|
|
66
|
+
contract: typeof RUNTIME_PROJECTION_P0_CONTRACT_VERSION;
|
|
67
|
+
branch: string;
|
|
68
|
+
refs: RuntimeRefFreshness[];
|
|
69
|
+
status: 'fresh' | 'blocked';
|
|
70
|
+
staleRefs: RuntimeRef[];
|
|
71
|
+
reasons: string[];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface RuntimeProjectionP0Diagnostic {
|
|
75
|
+
contract: typeof RUNTIME_PROJECTION_P0_CONTRACT_VERSION;
|
|
76
|
+
branch: string;
|
|
77
|
+
status: RuntimeProjectionP0HealthStatus;
|
|
78
|
+
inventory: RuntimeProjectionP0InventoryItem[];
|
|
79
|
+
projectionCounts: Record<string, number>;
|
|
80
|
+
refHashRegistry: {
|
|
81
|
+
projectionType: typeof RUNTIME_REF_HASH_REGISTRY_PROJECTION_TYPE;
|
|
82
|
+
envelopeStaleness: RuntimeProjectionStaleness;
|
|
83
|
+
status: RuntimeRefHashRegistryProjection['status'] | 'missing';
|
|
84
|
+
staleRefs: RuntimeRef[];
|
|
85
|
+
reasons: string[];
|
|
86
|
+
};
|
|
87
|
+
reasons: string[];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const RUNTIME_PROJECTION_P0_INVENTORY: readonly RuntimeProjectionP0InventoryItem[] = [
|
|
91
|
+
inventoryItem('lifecycleDecisions', 'sqlite', 'projections:phase8_lifecycle_risk_decision', 'Lifecycle/risk authority created only by /sdd or /sdd:spec.', ['router', 'stage-close', 'status', 'doctor']),
|
|
92
|
+
inventoryItem('riskSignals', 'sqlite', 'projections:phase8_lifecycle_risk_decision', 'Risk signal snapshot and lifecycle policy output for routing and gates.', ['router', 'workflow-gate', 'status']),
|
|
93
|
+
inventoryItem('stageRuns', 'sqlite', 'projections:phase8_stage_run', 'Runtime-owned stage run state and terminal health.', ['status', 'stage-close', 'ship']),
|
|
94
|
+
inventoryItem('stageHandoffs', 'sqlite', 'projections:phase8_workflow_handoff', 'Runtime handoff packet between completed stages and next runtime stage.', ['status', 'stage-close']),
|
|
95
|
+
inventoryItem('gates', 'sqlite', 'workflow_gate_decisions', 'Hard gate decisions and policy outcomes.', ['workflow-gate', 'status', 'ship']),
|
|
96
|
+
inventoryItem('gapBlockers', 'sqlite', 'durable_gaps', 'Mutable gap/blocker lifecycle with runtime status authority.', ['doctor', 'status', 'stage-close']),
|
|
97
|
+
inventoryItem('evidenceItems', 'sqlite-ref-hash-only', 'stage_artifacts/artifact_payloads', 'Agent-authored Markdown evidence registered by ref, hash, contract, producer, and status.', ['workflow-gate', 'stage-close', 'doctor']),
|
|
98
|
+
inventoryItem('evidenceSets', 'sqlite-ref-hash-only', 'evidence_sets/evidence_set_items', 'Accepted evidence sets selected by refs and digests, not Markdown bodies.', ['workflow-gate', 'ship', 'status']),
|
|
99
|
+
inventoryItem('selectionPointers', 'sqlite', 'selection_pointers', 'Active accepted evidence pointer for downstream consumers.', ['workflow-gate', 'latest-eligible-run', 'ship']),
|
|
100
|
+
inventoryItem('workflowCurrentState', 'sqlite-projection', `projections:${WORKFLOW_CURRENT_STATE_PROJECTION_TYPE}`, 'Runtime-owned lifecycle, task, and validation-unit current state projection.', ['status', 'router', 'ai-tool-entry']),
|
|
101
|
+
inventoryItem('taskOrchestration', 'sqlite-projection', `projections:${TASK_ORCHESTRATION_PROJECTION_TYPE}`, 'Parsed task orchestration read model with task-level hashes, dependencies, validation unit binding, and capability signals.', ['status', 'do-manager', 'tasks-manager']),
|
|
102
|
+
inventoryItem('validationUnits', 'sqlite-projection', `projections:${VALIDATION_UNIT_PROJECTION_TYPE}`, 'Runtime validation-unit read model derived from verify contracts and task orchestration.', ['status', 'test-manager', 'workflow-gate']),
|
|
103
|
+
inventoryItem('truthAlignment', 'sqlite', 'projections:phase9_12_truth_alignment', 'Goal-verify truth alignment projection for ship readiness.', ['ship', 'status']),
|
|
104
|
+
inventoryItem('truthReconciliation', 'sqlite', `projections:${TRUTH_RECONCILIATION_PROJECTION_TYPE}`, 'Owner-stage reconciliation decision slot for minimal rerun frontier.', ['orchestrator', 'status', 'ship']),
|
|
105
|
+
inventoryItem('stageRouteBindings', 'sqlite', `projections:${STAGE_ROUTE_BINDING_PROJECTION_TYPE}`, 'Stage-local command input binding to an accepted runtime target.', ['router', 'status']),
|
|
106
|
+
inventoryItem('nextIntent', 'sqlite-projection', `projections:${NEXT_INTENT_PROJECTION_TYPE}`, 'Advisory runtime next-action read model; execution still checks readiness and gates.', ['status', 'ai-tool-entry']),
|
|
107
|
+
inventoryItem('auditEvents', 'sqlite', 'events/activities', 'Append-only runtime events and activity records for auditability.', ['doctor', 'run-inspect'])
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
export const RUNTIME_PROJECTION_P0_PROJECTION_TYPES = [
|
|
111
|
+
'phase8_lifecycle_risk_decision',
|
|
112
|
+
'phase8_stage_run',
|
|
113
|
+
'phase8_workflow_handoff',
|
|
114
|
+
'phase9_12_truth_alignment',
|
|
115
|
+
TRUTH_RECONCILIATION_PROJECTION_TYPE,
|
|
116
|
+
STAGE_ROUTE_BINDING_PROJECTION_TYPE,
|
|
117
|
+
WORKFLOW_CURRENT_STATE_PROJECTION_TYPE,
|
|
118
|
+
TASK_ORCHESTRATION_PROJECTION_TYPE,
|
|
119
|
+
VALIDATION_UNIT_PROJECTION_TYPE,
|
|
120
|
+
NEXT_INTENT_PROJECTION_TYPE,
|
|
121
|
+
RUNTIME_REF_HASH_REGISTRY_PROJECTION_TYPE
|
|
122
|
+
] as const;
|
|
123
|
+
|
|
124
|
+
export async function inspectRuntimeProjectionP0(projectRoot: string, branch: string): Promise<RuntimeProjectionP0Diagnostic> {
|
|
125
|
+
const partition = branchToSafePartition(branch);
|
|
126
|
+
const projections = await listRuntimeProjections(projectRoot, [...RUNTIME_PROJECTION_P0_PROJECTION_TYPES]);
|
|
127
|
+
const projectionCounts = Object.fromEntries(RUNTIME_PROJECTION_P0_PROJECTION_TYPES.map((projectionType) => [projectionType, projections.filter((projection) => projection.projectionType === projectionType).length]));
|
|
128
|
+
const envelope = await readRuntimeRefHashRegistryProjection(projectRoot, partition);
|
|
129
|
+
const refHashRegistry = await inspectRefHashRegistry(projectRoot, partition, envelope);
|
|
130
|
+
const status: RuntimeProjectionP0HealthStatus = refHashRegistry.status === 'blocked' ? 'blocked' : envelope ? 'pass' : 'warn';
|
|
131
|
+
const reasons = runtimeProjectionP0Reasons(status, refHashRegistry.reasons);
|
|
132
|
+
return {
|
|
133
|
+
contract: RUNTIME_PROJECTION_P0_CONTRACT_VERSION,
|
|
134
|
+
branch: partition,
|
|
135
|
+
status,
|
|
136
|
+
inventory: [...RUNTIME_PROJECTION_P0_INVENTORY],
|
|
137
|
+
projectionCounts,
|
|
138
|
+
refHashRegistry,
|
|
139
|
+
reasons
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export async function recordRuntimeRefHashRegistryProjection(projectRoot: string, input: { branch: string; refs: RuntimeRef[]; generatedAt?: string }): Promise<RuntimeProjectionEnvelopeWriteResult<RuntimeRefHashRegistryProjection>> {
|
|
144
|
+
const branch = branchToSafePartition(input.branch);
|
|
145
|
+
const refs = await inspectRuntimeRefFreshness(projectRoot, input.refs);
|
|
146
|
+
const staleRefs = refs.filter((ref) => blocksRefHashRegistry(ref.status)).map((ref) => ref.ref);
|
|
147
|
+
const projection: RuntimeRefHashRegistryProjection = {
|
|
148
|
+
contract: RUNTIME_PROJECTION_P0_CONTRACT_VERSION,
|
|
149
|
+
branch,
|
|
150
|
+
refs,
|
|
151
|
+
status: staleRefs.length === 0 ? 'fresh' : 'blocked',
|
|
152
|
+
staleRefs,
|
|
153
|
+
reasons: refHashRegistryReasons(staleRefs, refs)
|
|
154
|
+
};
|
|
155
|
+
return recordRuntimeProjectionEnvelope(projectRoot, {
|
|
156
|
+
projectionType: RUNTIME_REF_HASH_REGISTRY_PROJECTION_TYPE,
|
|
157
|
+
scopeKey: runtimeRefHashRegistryScopeKey(branch),
|
|
158
|
+
inputHash: runtimeProjectionStableHash(projection),
|
|
159
|
+
producer: 'phase9.19-runtime-projection-p0',
|
|
160
|
+
producerVersion: RUNTIME_REF_HASH_REGISTRY_PRODUCER_VERSION,
|
|
161
|
+
generatedAt: input.generatedAt,
|
|
162
|
+
payload: projection
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export async function readRuntimeRefHashRegistryProjection(projectRoot: string, branch: string): Promise<RuntimeProjectionEnvelope<RuntimeRefHashRegistryProjection> | null> {
|
|
167
|
+
return readRuntimeProjectionEnvelope(projectRoot, RUNTIME_REF_HASH_REGISTRY_PROJECTION_TYPE, runtimeRefHashRegistryScopeKey(branchToSafePartition(branch)));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export async function inspectRuntimeRefFreshness(projectRoot: string, refs: RuntimeRef[]): Promise<RuntimeRefFreshness[]> {
|
|
171
|
+
return Promise.all(refs.map((ref) => inspectRuntimeRef(projectRoot, ref)));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function runtimeRefHashRegistryScopeKey(branch: string): string {
|
|
175
|
+
return [branchToSafePartition(branch), 'ref-hash-registry'].join(':');
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function runtimeProjectionStableHash(value: unknown): string {
|
|
179
|
+
return createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
async function inspectRefHashRegistry(projectRoot: string, branch: string, envelope: RuntimeProjectionEnvelope<RuntimeRefHashRegistryProjection> | null): Promise<RuntimeProjectionP0Diagnostic['refHashRegistry']> {
|
|
183
|
+
if (!envelope) {
|
|
184
|
+
return {
|
|
185
|
+
projectionType: RUNTIME_REF_HASH_REGISTRY_PROJECTION_TYPE,
|
|
186
|
+
envelopeStaleness: 'unknown',
|
|
187
|
+
status: 'missing',
|
|
188
|
+
staleRefs: [],
|
|
189
|
+
reasons: ['Runtime ref/hash registry projection is missing; register accepted Markdown refs before relying on freshness diagnostics.']
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
const currentRefs = await inspectRuntimeRefFreshness(projectRoot, envelope.payload.refs.map((entry) => entry.ref));
|
|
193
|
+
const staleRefs = currentRefs.filter((ref) => blocksRefHashRegistry(ref.status)).map((ref) => ref.ref);
|
|
194
|
+
const currentProjection: RuntimeRefHashRegistryProjection = {
|
|
195
|
+
...envelope.payload,
|
|
196
|
+
refs: currentRefs,
|
|
197
|
+
status: staleRefs.length === 0 ? 'fresh' : 'blocked',
|
|
198
|
+
staleRefs,
|
|
199
|
+
reasons: refHashRegistryReasons(staleRefs, currentRefs)
|
|
200
|
+
};
|
|
201
|
+
return {
|
|
202
|
+
projectionType: RUNTIME_REF_HASH_REGISTRY_PROJECTION_TYPE,
|
|
203
|
+
envelopeStaleness: runtimeProjectionStaleness(envelope, {
|
|
204
|
+
inputHash: runtimeProjectionStableHash(currentProjection),
|
|
205
|
+
producerVersion: RUNTIME_REF_HASH_REGISTRY_PRODUCER_VERSION
|
|
206
|
+
}),
|
|
207
|
+
status: currentProjection.status,
|
|
208
|
+
staleRefs,
|
|
209
|
+
reasons: currentProjection.reasons
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
async function inspectRuntimeRef(projectRoot: string, ref: RuntimeRef): Promise<RuntimeRefFreshness> {
|
|
214
|
+
const normalizedRef = normalizePortablePath(ref.ref);
|
|
215
|
+
if (!isFileBackedRef(ref)) {
|
|
216
|
+
return freshness(ref, normalizedRef, null, null, 'not_file_backed', `Runtime ref kind ${ref.kind} is not file-backed.`);
|
|
217
|
+
}
|
|
218
|
+
if (!ref.hash) {
|
|
219
|
+
return freshness(ref, normalizedRef, null, null, 'unhashed', `File-backed ref ${ref.ref} has no expected hash.`);
|
|
220
|
+
}
|
|
221
|
+
const safePath = safeProjectRelativePath(projectRoot, normalizedRef);
|
|
222
|
+
if (!safePath) {
|
|
223
|
+
return freshness(ref, normalizedRef, ref.hash, null, 'unsafe', `File-backed ref ${ref.ref} is not a safe project-relative path.`);
|
|
224
|
+
}
|
|
225
|
+
try {
|
|
226
|
+
const currentHash = hashDocumentContent(await readFile(safePath, 'utf8'));
|
|
227
|
+
return hashMatches(ref.hash, currentHash)
|
|
228
|
+
? freshness(ref, normalizedRef, ref.hash, currentHash, 'fresh', `File-backed ref ${normalizedRef} is fresh.`)
|
|
229
|
+
: freshness(ref, normalizedRef, ref.hash, currentHash, 'stale', `File-backed ref ${normalizedRef} hash is stale: expected ${ref.hash}, actual ${currentHash}.`);
|
|
230
|
+
} catch (error) {
|
|
231
|
+
if (isMissingFileError(error)) {
|
|
232
|
+
return freshness(ref, normalizedRef, ref.hash, null, 'missing', `File-backed ref ${normalizedRef} is missing.`);
|
|
233
|
+
}
|
|
234
|
+
throw error;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function inventoryItem(key: RuntimeProjectionP0Key, storage: RuntimeProjectionP0Storage, primitive: string, responsibility: string, consumers: string[]): RuntimeProjectionP0InventoryItem {
|
|
239
|
+
return { key, storage, primitive, writer: 'runtime', responsibility, consumers, markdownBodyAuthority: false };
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function runtimeProjectionP0Reasons(status: RuntimeProjectionP0HealthStatus, refHashReasons: string[]): string[] {
|
|
243
|
+
if (status === 'blocked') {
|
|
244
|
+
return refHashReasons;
|
|
245
|
+
}
|
|
246
|
+
if (status === 'warn') {
|
|
247
|
+
return ['Runtime projection P0 inventory is available; ref/hash freshness registry has not been recorded yet.'];
|
|
248
|
+
}
|
|
249
|
+
return ['Runtime projection P0 inventory is available and registered file-backed refs are fresh.'];
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function refHashRegistryReasons(staleRefs: RuntimeRef[], refs: RuntimeRefFreshness[]): string[] {
|
|
253
|
+
if (staleRefs.length === 0) {
|
|
254
|
+
return ['Registered file-backed refs are fresh; non-file-backed refs remain metadata-only.'];
|
|
255
|
+
}
|
|
256
|
+
return refs.filter((ref) => blocksRefHashRegistry(ref.status)).map((ref) => ref.reason);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function blocksRefHashRegistry(status: RuntimeRefFreshnessStatus): boolean {
|
|
260
|
+
return status === 'stale' || status === 'missing' || status === 'unhashed' || status === 'unsafe';
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function isFileBackedRef(ref: RuntimeRef): boolean {
|
|
264
|
+
if (ref.kind === 'document' || ref.kind === 'artifact' || ref.kind === 'evidence') {
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
return /^(specs|runs)\//.test(normalizePortablePath(ref.ref));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function safeProjectRelativePath(projectRoot: string, normalizedRef: string): string | null {
|
|
271
|
+
if (path.isAbsolute(normalizedRef) || normalizedRef.startsWith('../') || normalizedRef === '..') {
|
|
272
|
+
return null;
|
|
273
|
+
}
|
|
274
|
+
const projectPath = path.resolve(projectRoot);
|
|
275
|
+
const absolutePath = path.resolve(projectPath, normalizedRef);
|
|
276
|
+
return absolutePath === projectPath || absolutePath.startsWith(`${projectPath}${path.sep}`) ? absolutePath : null;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function freshness(ref: RuntimeRef, normalizedRef: string, expectedHash: string | null, currentHash: string | null, status: RuntimeRefFreshnessStatus, reason: string): RuntimeRefFreshness {
|
|
280
|
+
return { ref: { ...ref, ref: normalizedRef }, normalizedRef, expectedHash, currentHash, status, reason };
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function hashMatches(expected: string, actual: string): boolean {
|
|
284
|
+
return expected.replace(/^sha256:/, '') === actual.replace(/^sha256:/, '');
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function isMissingFileError(error: unknown): boolean {
|
|
288
|
+
if (!error || typeof error !== 'object') {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
return 'code' in error && (error as { code?: unknown }).code === 'ENOENT';
|
|
292
|
+
}
|