@tea-agent/loop-agent 0.1.0-fe-test.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +114 -0
- package/CHANGELOG.md +2283 -0
- package/README.md +177 -0
- package/bin/agent-worker.js +22 -0
- package/bin/loop-agent.js +57 -0
- package/dist/adapters/aimax.js +91 -0
- package/dist/adapters/context.js +32 -0
- package/dist/adapters/index.js +29 -0
- package/dist/adapters/loop-agent.js +192 -0
- package/dist/adapters/types.js +1 -0
- package/dist/application/context-usage/skill-resolution-stats.js +263 -0
- package/dist/application/dag/args.js +486 -0
- package/dist/application/dag/generate-task-dag.js +408 -0
- package/dist/application/dag/report-dag.js +14 -0
- package/dist/application/dag/run-dag.js +109 -0
- package/dist/application/dag/validate-dag.js +166 -0
- package/dist/application/evaluation/alias.js +184 -0
- package/dist/application/evaluation/budget.js +192 -0
- package/dist/application/evaluation/campaign-hash.js +47 -0
- package/dist/application/evaluation/campaign-matrix.js +372 -0
- package/dist/application/evaluation/campaign-scorecard.js +135 -0
- package/dist/application/evaluation/campaign.js +370 -0
- package/dist/application/evaluation/candidate-hash.js +75 -0
- package/dist/application/evaluation/candidate.js +69 -0
- package/dist/application/evaluation/corpus-hash.js +38 -0
- package/dist/application/evaluation/corpus.js +56 -0
- package/dist/application/evaluation/experiment.js +294 -0
- package/dist/application/evaluation/ignition.js +198 -0
- package/dist/application/evaluation/integrity-audit.js +162 -0
- package/dist/application/evaluation/outer-loop.js +132 -0
- package/dist/application/evaluation/pi-cell-executor.js +39 -0
- package/dist/application/evaluation/private-verifier.js +46 -0
- package/dist/application/evaluation/promotion-policy.js +151 -0
- package/dist/application/evaluation/proposer.js +98 -0
- package/dist/application/evaluation/replay.js +289 -0
- package/dist/application/evaluation/types.js +652 -0
- package/dist/application/loop/run-action.js +19 -0
- package/dist/application/task-lifecycle/advance.js +1204 -0
- package/dist/application/task-lifecycle/gates.js +130 -0
- package/dist/application/task-lifecycle/index.js +7 -0
- package/dist/application/task-lifecycle/observe.js +424 -0
- package/dist/application/task-lifecycle/plan-transitions.js +251 -0
- package/dist/application/task-lifecycle/recommendations.js +180 -0
- package/dist/application/task-lifecycle/record.js +73 -0
- package/dist/application/task-lifecycle/types.js +1 -0
- package/dist/build-stamp.json +6 -0
- package/dist/cli/catalog.js +24 -0
- package/dist/cli/command-definitions.js +659 -0
- package/dist/cli/help.js +56 -0
- package/dist/cli/index.js +5 -0
- package/dist/cli/program.js +647 -0
- package/dist/cli/router.js +13 -0
- package/dist/cli/update/init-surface-notifier.js +167 -0
- package/dist/cli/update/notifier.js +117 -0
- package/dist/cli/update/npm-client.js +151 -0
- package/dist/cli/update/policy.js +92 -0
- package/dist/cli/update/runtime-activity.js +29 -0
- package/dist/cli/update/state.js +68 -0
- package/dist/cli-governance/active-residue-check.js +38 -0
- package/dist/cli.js +57 -0
- package/dist/commands/client-recovery.js +1373 -0
- package/dist/commands/closeout.js +13 -0
- package/dist/commands/coverage-audit.js +14 -0
- package/dist/commands/coverage-report.js +50 -0
- package/dist/commands/cursor-prompt.js +182 -0
- package/dist/commands/dag-approve.js +142 -0
- package/dist/commands/dag-final-verification.js +76 -0
- package/dist/commands/dag-init-hybrid.js +57 -0
- package/dist/commands/dag-reconcile-run.js +5 -0
- package/dist/commands/dag-reconcile-tasks.js +51 -0
- package/dist/commands/dag-reject.js +91 -0
- package/dist/commands/dag-report.js +76 -0
- package/dist/commands/dag-request-interrupt.js +20 -0
- package/dist/commands/dag-rerun-task.js +19 -0
- package/dist/commands/dag-rerun.js +111 -0
- package/dist/commands/dag-resume.js +35 -0
- package/dist/commands/dag-run-task.js +12 -0
- package/dist/commands/dag-validate.js +20 -0
- package/dist/commands/dag-workflow-compile.js +91 -0
- package/dist/commands/dag-workflow-plan.js +130 -0
- package/dist/commands/dag-workflow-validate.js +66 -0
- package/dist/commands/delegate.js +130 -0
- package/dist/commands/docs-archive.js +5 -0
- package/dist/commands/docs-audit.js +6 -0
- package/dist/commands/doctor.js +283 -0
- package/dist/commands/eval.js +1398 -0
- package/dist/commands/examples.js +90 -0
- package/dist/commands/goal.js +92 -0
- package/dist/commands/handoff-check.js +5 -0
- package/dist/commands/harvest.js +44 -0
- package/dist/commands/import-prd.js +81 -0
- package/dist/commands/init-upgrade.js +3085 -0
- package/dist/commands/init.js +3630 -0
- package/dist/commands/inspect.js +11 -0
- package/dist/commands/instructions.js +223 -0
- package/dist/commands/knowledge.js +162 -0
- package/dist/commands/loop-benchmark.js +72 -0
- package/dist/commands/loop.js +251 -0
- package/dist/commands/new-task.js +5 -0
- package/dist/commands/operator.js +44 -0
- package/dist/commands/pi-prompt.js +174 -0
- package/dist/commands/pi-reuse-benchmark.js +153 -0
- package/dist/commands/plan-list.js +5 -0
- package/dist/commands/plan.js +50 -0
- package/dist/commands/promote-run.js +29 -0
- package/dist/commands/reference-index.js +16 -0
- package/dist/commands/run-dag-progress.js +123 -0
- package/dist/commands/run-dag.js +22 -0
- package/dist/commands/spine.js +38 -0
- package/dist/commands/stats.js +113 -0
- package/dist/commands/status.js +57 -0
- package/dist/commands/study-init.js +192 -0
- package/dist/commands/task-advance.js +366 -0
- package/dist/commands/task-contract.js +269 -0
- package/dist/commands/task-source-prepare.js +479 -0
- package/dist/commands/task-status.js +133 -0
- package/dist/commands/workflow.js +259 -0
- package/dist/commands/worktree-create.js +31 -0
- package/dist/commands/worktree-list.js +5 -0
- package/dist/commands/worktree-remove.js +26 -0
- package/dist/executors/config-core.js +5 -0
- package/dist/executors/config.js +2 -0
- package/dist/executors/dag-pi-executor.js +1277 -0
- package/dist/executors/dag-static-executor.js +42 -0
- package/dist/executors/dag.js +3 -0
- package/dist/executors/index.js +6 -0
- package/dist/executors/model-routing.js +71 -0
- package/dist/executors/pi-defaults.js +9 -0
- package/dist/executors/pi-event-serializer.js +65 -0
- package/dist/executors/pi-executor.js +981 -0
- package/dist/executors/pi-playwright-cli-tool.js +1006 -0
- package/dist/executors/pi-prompt-transport.js +198 -0
- package/dist/executors/pi-reuse-benchmark.js +316 -0
- package/dist/executors/pi-runtime-reuse.js +29 -0
- package/dist/executors/pi-sdk-executor.js +722 -0
- package/dist/executors/pi-sdk.js +1 -0
- package/dist/executors/pi-writer-tool-policy.js +266 -0
- package/dist/executors/pi.js +3 -0
- package/dist/executors/playwright-cli-launcher.js +63 -0
- package/dist/executors/process-tree.js +33 -0
- package/dist/executors/shell-executor.js +3055 -0
- package/dist/executors/shell-presets.js +99 -0
- package/dist/executors/shell-verification.js +262 -0
- package/dist/executors/shell-write-guard.js +543 -0
- package/dist/executors/shell.js +3 -0
- package/dist/executors/static.js +1 -0
- package/dist/governance/checks.js +437 -0
- package/dist/governance/document-index-closure.js +164 -0
- package/dist/governance/exec-plans.js +549 -0
- package/dist/governance/harness.js +9 -0
- package/dist/governance/index.js +3 -0
- package/dist/governance/manifest-types.js +254 -0
- package/dist/governance/manifest.js +2 -0
- package/dist/governance/path-guard.js +69 -0
- package/dist/governance/path-guards.js +2 -0
- package/dist/governance/profiles.js +3 -0
- package/dist/governance/requirement-coverage.js +425 -0
- package/dist/governance/skill-safety.js +135 -0
- package/dist/governance/spine-audit.js +155 -0
- package/dist/infrastructure/evaluation/alias-store.js +199 -0
- package/dist/infrastructure/evaluation/campaign-store.js +154 -0
- package/dist/infrastructure/evaluation/candidate-store.js +439 -0
- package/dist/infrastructure/evaluation/corpus-store.js +181 -0
- package/dist/infrastructure/evaluation/experiment-store.js +124 -0
- package/dist/infrastructure/evaluation/ignition-store.js +82 -0
- package/dist/infrastructure/evaluation/private-verifier-store.js +145 -0
- package/dist/infrastructure/evaluation/proposer-store.js +78 -0
- package/dist/infrastructure/evaluation/store.js +40 -0
- package/dist/infrastructure/harness/active-residue-policy.js +73 -0
- package/dist/infrastructure/harness/artifact-store.js +72 -0
- package/dist/infrastructure/harness/atomic-write.js +50 -0
- package/dist/infrastructure/harness/completed-facts-guard.js +40 -0
- package/dist/infrastructure/harness/loop-action-store.js +20 -0
- package/dist/infrastructure/harness/loop-store.js +41 -0
- package/dist/infrastructure/harness/one-shot-run-store.js +94 -0
- package/dist/infrastructure/harness/task-store.js +108 -0
- package/dist/records/closeout.js +2 -0
- package/dist/records/harvest.js +215 -0
- package/dist/records/index.js +3 -0
- package/dist/records/one-shot-runs.js +386 -0
- package/dist/records/promotion.js +200 -0
- package/dist/shared/artifacts-core.js +107 -0
- package/dist/shared/artifacts.js +2 -0
- package/dist/shared/context-files.js +32 -0
- package/dist/shared/context.js +2 -0
- package/dist/shared/copy-dir.js +17 -0
- package/dist/shared/git-progress.js +172 -0
- package/dist/shared/index.js +5 -0
- package/dist/shared/logger.js +17 -0
- package/dist/shared/one-shot-prompt-args.js +98 -0
- package/dist/shared/openspec-spec.js +125 -0
- package/dist/shared/operator/capabilities.js +2659 -0
- package/dist/shared/operator/command-lifecycle.js +94 -0
- package/dist/shared/operator/envelope.js +59 -0
- package/dist/shared/operator/index.js +5 -0
- package/dist/shared/operator/registry.js +38 -0
- package/dist/shared/operator/types.js +5 -0
- package/dist/shared/output-truncation.js +37 -0
- package/dist/shared/package-metadata.js +530 -0
- package/dist/shared/path-refs.js +31 -0
- package/dist/shared/pi-retry-settings.js +23 -0
- package/dist/shared/playwright-cli-command-policy.js +41 -0
- package/dist/shared/preview.js +39 -0
- package/dist/shared/prompts.js +26 -0
- package/dist/shared/reference-context.js +264 -0
- package/dist/shared/resilient-git.js +133 -0
- package/dist/shared/runtime-activity.js +6 -0
- package/dist/shared/timeout-policy.js +24 -0
- package/dist/shared/timeout.js +1 -0
- package/dist/shared/types.js +5 -0
- package/dist/sidecars/cursor-prompt/executor.js +428 -0
- package/dist/sidecars/cursor-prompt/index.js +3 -0
- package/dist/sidecars/cursor-prompt/stream.js +121 -0
- package/dist/task/config-types.js +235 -0
- package/dist/task/config.js +2 -0
- package/dist/task/contract/adopt.js +166 -0
- package/dist/task/contract/apply.js +326 -0
- package/dist/task/contract/canonicalize.js +60 -0
- package/dist/task/contract/constants.js +30 -0
- package/dist/task/contract/diff.js +177 -0
- package/dist/task/contract/hash.js +42 -0
- package/dist/task/contract/import-revision.js +96 -0
- package/dist/task/contract/index.js +17 -0
- package/dist/task/contract/journal.js +155 -0
- package/dist/task/contract/lock.js +153 -0
- package/dist/task/contract/observe.js +296 -0
- package/dist/task/contract/paths.js +19 -0
- package/dist/task/contract/project.js +185 -0
- package/dist/task/contract/recover.js +312 -0
- package/dist/task/contract/request-ledger.js +37 -0
- package/dist/task/contract/schema.js +153 -0
- package/dist/task/contract/transaction.js +160 -0
- package/dist/task/contract/types.js +1 -0
- package/dist/task/contract/validate-draft.js +106 -0
- package/dist/task/dag-source-paths.js +50 -0
- package/dist/task/delegate.js +208 -0
- package/dist/task/frontend-preflight.js +131 -0
- package/dist/task/frontend-project-capability.js +570 -0
- package/dist/task/goal-audit.js +51 -0
- package/dist/task/goal-policy.js +8 -0
- package/dist/task/goal.js +3 -0
- package/dist/task/ids.js +1 -0
- package/dist/task/index.js +12 -0
- package/dist/task/lifecycle.js +1 -0
- package/dist/task/operator/capabilities.js +6 -0
- package/dist/task/operator/envelope.js +2 -0
- package/dist/task/operator/index.js +5 -0
- package/dist/task/operator/registry.js +2 -0
- package/dist/task/operator/types.js +1 -0
- package/dist/task/paths.js +1 -0
- package/dist/task/read-model.js +140 -0
- package/dist/task/runtime.js +708 -0
- package/dist/task/source-prepare/artifact-meta.js +137 -0
- package/dist/task/source-prepare/build-draft.js +232 -0
- package/dist/task/source-prepare/completeness.js +248 -0
- package/dist/task/source-prepare/index.js +10 -0
- package/dist/task/source-prepare/parse-intent.js +496 -0
- package/dist/task/source-prepare/path-policy.js +197 -0
- package/dist/task/source-prepare/placeholder-paths.js +77 -0
- package/dist/task/source-prepare/prepare.js +920 -0
- package/dist/task/source-prepare/reference-integrity.js +290 -0
- package/dist/task/source-prepare/semantic-intake.js +717 -0
- package/dist/task/source-prepare/types.js +7 -0
- package/dist/task/source-references.js +228 -0
- package/dist/task/source-state.js +1 -0
- package/dist/task/state.js +41 -0
- package/dist/task/subagent-guidance.js +1 -0
- package/dist/task/task-demand-routing.js +443 -0
- package/dist/task/workflow-state-types.js +92 -0
- package/dist/task/worktree-cleanup.js +140 -0
- package/dist/task/worktree.js +388 -0
- package/dist/verification/maven/cache.js +142 -0
- package/dist/verification/maven/index.js +120 -0
- package/dist/verification/maven/plan-commands.js +421 -0
- package/dist/verification/maven/pom-static.js +136 -0
- package/dist/verification/maven/scope-resolve.js +153 -0
- package/dist/verification/maven/stale.js +130 -0
- package/dist/verification/maven/types.js +23 -0
- package/dist/verification/maven/workspace-graph.js +322 -0
- package/dist/worker/cli.js +957 -0
- package/dist/worker/closeout/apply.js +73 -0
- package/dist/worker/closeout/preview.js +30 -0
- package/dist/worker/console/app-data.js +316 -0
- package/dist/worker/console/chat/artifact-card.js +30 -0
- package/dist/worker/console/chat/assistant-content.js +121 -0
- package/dist/worker/console/chat/chat-event-store.js +981 -0
- package/dist/worker/console/chat/chat-ui-policy.js +25 -0
- package/dist/worker/console/chat/compaction-errors.js +64 -0
- package/dist/worker/console/chat/composer-draft-store.js +45 -0
- package/dist/worker/console/chat/context-panel.js +54 -0
- package/dist/worker/console/chat/contract-apply-receipt-store.js +174 -0
- package/dist/worker/console/chat/explore-tools.js +299 -0
- package/dist/worker/console/chat/human-gate-card.js +45 -0
- package/dist/worker/console/chat/interview-adapter.js +149 -0
- package/dist/worker/console/chat/mcp-inventory.js +221 -0
- package/dist/worker/console/chat/model-resolver.js +215 -0
- package/dist/worker/console/chat/operation-card.js +92 -0
- package/dist/worker/console/chat/pi-console-config.js +376 -0
- package/dist/worker/console/chat/pi-runtime.js +2446 -0
- package/dist/worker/console/chat/repo-browser.js +140 -0
- package/dist/worker/console/chat/repo-walk.js +125 -0
- package/dist/worker/console/chat/resource-loader.js +59 -0
- package/dist/worker/console/chat/resource-preferences-store.js +152 -0
- package/dist/worker/console/chat/routes.js +3137 -0
- package/dist/worker/console/chat/runtime-context.js +102 -0
- package/dist/worker/console/chat/runtime-selection.js +96 -0
- package/dist/worker/console/chat/semantic-activity.js +489 -0
- package/dist/worker/console/chat/session-store.js +484 -0
- package/dist/worker/console/chat/shortcuts.js +217 -0
- package/dist/worker/console/chat/tool-adapter.js +131 -0
- package/dist/worker/console/chat/tool-preview.js +247 -0
- package/dist/worker/console/chat/tools.js +212 -0
- package/dist/worker/console/chat/turn-execution-registry.js +82 -0
- package/dist/worker/console/chat/turn-process.js +346 -0
- package/dist/worker/console/chat/usage.js +165 -0
- package/dist/worker/console/chat/workspace-landing.js +103 -0
- package/dist/worker/console/dag-confirmation.js +347 -0
- package/dist/worker/console/dag-execution-receipt.js +393 -0
- package/dist/worker/console/doctor.js +230 -0
- package/dist/worker/console/draft-store.js +158 -0
- package/dist/worker/console/harness-pi-model-matrix.js +137 -0
- package/dist/worker/console/human-gate-token.js +130 -0
- package/dist/worker/console/index.js +17 -0
- package/dist/worker/console/inspect-split.js +82 -0
- package/dist/worker/console/interview/assessment.js +67 -0
- package/dist/worker/console/interview/grill-me.js +277 -0
- package/dist/worker/console/interview/session.js +100 -0
- package/dist/worker/console/interview/tools.js +109 -0
- package/dist/worker/console/loopback.js +16 -0
- package/dist/worker/console/mutation-gate-receipt-store.js +184 -0
- package/dist/worker/console/night-aux-ticker.js +146 -0
- package/dist/worker/console/observe-health-match.js +179 -0
- package/dist/worker/console/observe-link.js +42 -0
- package/dist/worker/console/open-browser.js +134 -0
- package/dist/worker/console/operation-run-facts.js +190 -0
- package/dist/worker/console/operation-runner.js +353 -0
- package/dist/worker/console/operation-sse.js +184 -0
- package/dist/worker/console/operation-store.js +169 -0
- package/dist/worker/console/operation-wait.js +355 -0
- package/dist/worker/console/operator-actions.js +3768 -0
- package/dist/worker/console/operator-selection.js +105 -0
- package/dist/worker/console/operator-surface-health.js +24 -0
- package/dist/worker/console/operator-user-error.js +45 -0
- package/dist/worker/console/pi-readiness.js +288 -0
- package/dist/worker/console/prd-identity.js +102 -0
- package/dist/worker/console/prd-intake-bridge.js +441 -0
- package/dist/worker/console/prd-reference-discovery.js +124 -0
- package/dist/worker/console/recovery-cta.js +320 -0
- package/dist/worker/console/recovery-error-copy.js +198 -0
- package/dist/worker/console/recovery-selection.js +107 -0
- package/dist/worker/console/repo-fingerprint.js +35 -0
- package/dist/worker/console/resolve-dag-run-for-task.js +115 -0
- package/dist/worker/console/resource-loader.js +95 -0
- package/dist/worker/console/routes.js +475 -0
- package/dist/worker/console/security.js +170 -0
- package/dist/worker/console/server.js +357 -0
- package/dist/worker/console/sibling-controller.js +33 -0
- package/dist/worker/console/static/assets/abnfDiagram-N423BO3Z-BmOEx0gA.js +1 -0
- package/dist/worker/console/static/assets/arc-BGiVVe8b.js +1 -0
- package/dist/worker/console/static/assets/architectureDiagram-T3A2C74G-nDdu4rgJ.js +36 -0
- package/dist/worker/console/static/assets/blockDiagram-VBNYF7ZC-Bb5u0BWf.js +132 -0
- package/dist/worker/console/static/assets/c4Diagram-5PPSVZJV-BlhC0j94.js +10 -0
- package/dist/worker/console/static/assets/channel-Tl-FkUqr.js +1 -0
- package/dist/worker/console/static/assets/chunk-2GRJ4B5K-Ai8_qQXI.js +1 -0
- package/dist/worker/console/static/assets/chunk-2Q5K7J3B-B9gyCjqX.js +1 -0
- package/dist/worker/console/static/assets/chunk-5RXB4S5H-Bzbj3zGH.js +231 -0
- package/dist/worker/console/static/assets/chunk-5VM5RSS4-BT415PvT.js +15 -0
- package/dist/worker/console/static/assets/chunk-6Q2QTUOP-D_A5_5QL.js +88 -0
- package/dist/worker/console/static/assets/chunk-GF5L2VYU-srJkaP3f.js +206 -0
- package/dist/worker/console/static/assets/chunk-JWPE2WC7-UYGvEP4l.js +1 -0
- package/dist/worker/console/static/assets/chunk-KBJHAD2P-B8luBrrz.js +1 -0
- package/dist/worker/console/static/assets/chunk-RYQCIY6F-DN7wXZSq.js +1 -0
- package/dist/worker/console/static/assets/chunk-XXDRQBXY-DXKyMuKS.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-BaehtRk4.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-BaehtRk4.js +1 -0
- package/dist/worker/console/static/assets/cose-bilkent-JH36ORCC-dqvoynXj.js +1 -0
- package/dist/worker/console/static/assets/cynefin-VYW2F7L2--PcyL34A.js +166 -0
- package/dist/worker/console/static/assets/cynefinDiagram-MW4NZA55-DvWs_hTY.js +62 -0
- package/dist/worker/console/static/assets/cytoscape.esm-yzknjiTM.js +321 -0
- package/dist/worker/console/static/assets/dagre-VZM6K2ZE-DxeIxbyO.js +4 -0
- package/dist/worker/console/static/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/worker/console/static/assets/diagram-7IWD3JNH-DPCG61Of.js +30 -0
- package/dist/worker/console/static/assets/diagram-B4RE2ZJO-CmuU50-U.js +3 -0
- package/dist/worker/console/static/assets/diagram-LBJQPF4R-B61XLD_v.js +24 -0
- package/dist/worker/console/static/assets/diagram-Q27KOJAE-BB7HTRRY.js +24 -0
- package/dist/worker/console/static/assets/diagram-UB23O5K3-DvkboAIp.js +41 -0
- package/dist/worker/console/static/assets/ebnfDiagram-BXEA7PRR-BdJ_y1fL.js +1 -0
- package/dist/worker/console/static/assets/erDiagram-JOGREHBK-9bUBZTRi.js +85 -0
- package/dist/worker/console/static/assets/flowDiagram-UKHOOZJN-Dw4L4RBa.js +156 -0
- package/dist/worker/console/static/assets/ganttDiagram-PKOTCBZU-Jr82N_QP.js +292 -0
- package/dist/worker/console/static/assets/gitGraphDiagram-DS77QQ5N-DAz9wFLr.js +106 -0
- package/dist/worker/console/static/assets/graph-DOmOIIwC.js +1 -0
- package/dist/worker/console/static/assets/index-B7Y-0g3J.css +1 -0
- package/dist/worker/console/static/assets/index-DkCrqaYg.js +325 -0
- package/dist/worker/console/static/assets/infoDiagram-6WML65LV-CBB5Np7y.js +2 -0
- package/dist/worker/console/static/assets/init-Gi6I4Gst.js +1 -0
- package/dist/worker/console/static/assets/ishikawaDiagram-WSZJBQD7-D8IOp94y.js +70 -0
- package/dist/worker/console/static/assets/journeyDiagram-NVQOT4AX-Dgd3AHGG.js +139 -0
- package/dist/worker/console/static/assets/kanban-definition-27J2QSJJ-BmYOxLE9.js +89 -0
- package/dist/worker/console/static/assets/layout-D-LzfAck.js +1 -0
- package/dist/worker/console/static/assets/linear-DfYTEF6J.js +1 -0
- package/dist/worker/console/static/assets/map-DxJ2ADlA.js +1 -0
- package/dist/worker/console/static/assets/mermaid.core-BjuFPRqa.js +308 -0
- package/dist/worker/console/static/assets/mindmap-definition-FAOFIHXS-CLyUViGd.js +96 -0
- package/dist/worker/console/static/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/worker/console/static/assets/pegDiagram-VL7TDLO6-BvX2Di4-.js +1 -0
- package/dist/worker/console/static/assets/pieDiagram-7S7Q4E2Y-BFj0_OLv.js +39 -0
- package/dist/worker/console/static/assets/quadrantDiagram-CIZ2JOQS-BIUrD_hx.js +7 -0
- package/dist/worker/console/static/assets/railroadDiagram-AXF67PYL-CHBB48fj.js +1 -0
- package/dist/worker/console/static/assets/requirementDiagram-LRYGKXZP-sJrYw2Sf.js +84 -0
- package/dist/worker/console/static/assets/sankeyDiagram-W5VNT64P-BzHH6fPR.js +40 -0
- package/dist/worker/console/static/assets/sequenceDiagram-SI44F4Z6-7QCnelCt.js +162 -0
- package/dist/worker/console/static/assets/sizeCapture-X5ZJPWSS-sDYSxn72.js +1 -0
- package/dist/worker/console/static/assets/stateDiagram-OKZ733FA-XpiUdwzm.js +1 -0
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-eEhq2A8Y.js +1 -0
- package/dist/worker/console/static/assets/swimlanes-SLNWSIFB-DvqgNPzD.js +2 -0
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-la8AC7fo.js +8 -0
- package/dist/worker/console/static/assets/timeline-definition-Z64GVDOM-2TyOYNx0.js +120 -0
- package/dist/worker/console/static/assets/vennDiagram-T6HMQDX7-B-nM6wM2.js +34 -0
- package/dist/worker/console/static/assets/wardleyDiagram-T6FBY63Y-B86wPdbr.js +78 -0
- package/dist/worker/console/static/assets/xychartDiagram-ELKLHX3M-Dr1C4AQz.js +7 -0
- package/dist/worker/console/static/favicon.svg +37 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/worker/console/static/index.html +15 -0
- package/dist/worker/console/static-src/app/console-types.js +184 -0
- package/dist/worker/console/static-src/app/useConsoleShell.js +101 -0
- package/dist/worker/console/static-src/app/useOperatorActions.js +324 -0
- package/dist/worker/console/static-src/app/usePrdImport.js +172 -0
- package/dist/worker/console/static-src/app/useRecoveryActions.js +289 -0
- package/dist/worker/console/static-src/app/useRecoveryConsole.js +425 -0
- package/dist/worker/console/static-src/app/useTaskWizard.js +296 -0
- package/dist/worker/console/static-src/chat-markdown-security.js +38 -0
- package/dist/worker/console/static-src/chat-view-types.js +2 -0
- package/dist/worker/console/static-src/night/night-types.js +24 -0
- package/dist/worker/console/static-src/night/useNightBoard.js +94 -0
- package/dist/worker/console/static-src/night/useNightWizard.js +171 -0
- package/dist/worker/console/static-src/night-prepare-result.js +118 -0
- package/dist/worker/console/static-src/operator-chat/activity-journey.js +125 -0
- package/dist/worker/console/static-src/operator-chat/activity-rail-presentation.js +73 -0
- package/dist/worker/console/static-src/operator-chat/activity-references.js +20 -0
- package/dist/worker/console/static-src/operator-chat/chat-sse-events.js +420 -0
- package/dist/worker/console/static-src/operator-chat/format.js +71 -0
- package/dist/worker/console/static-src/operator-chat/landing-density.js +23 -0
- package/dist/worker/console/static-src/operator-chat/mutation-gate.js +45 -0
- package/dist/worker/console/static-src/operator-chat/refs.js +86 -0
- package/dist/worker/console/static-src/operator-chat/resource-auto-invocation.js +91 -0
- package/dist/worker/console/static-src/operator-chat/resource-diagnostics.js +204 -0
- package/dist/worker/console/static-src/operator-chat/runtime-snapshot-store.js +257 -0
- package/dist/worker/console/static-src/operator-chat/session-title-watcher.js +128 -0
- package/dist/worker/console/static-src/operator-chat/sidebar-split.js +90 -0
- package/dist/worker/console/static-src/operator-chat/slash-palette-layout.js +24 -0
- package/dist/worker/console/static-src/operator-chat/slash-palette-nav.js +141 -0
- package/dist/worker/console/static-src/operator-chat/spatial-overlay.js +38 -0
- package/dist/worker/console/static-src/operator-chat/tools-catalog.js +77 -0
- package/dist/worker/console/static-src/operator-chat/turn-stream-controller.js +690 -0
- package/dist/worker/console/static-src/operator-chat/turn-submission.js +158 -0
- package/dist/worker/console/static-src/operator-chat/types.js +1 -0
- package/dist/worker/console/static-src/operator-chat/useActivityRailTransition.js +59 -0
- package/dist/worker/console/static-src/operator-chat/useChatSessions.js +495 -0
- package/dist/worker/console/static-src/operator-chat/useChatStream.js +780 -0
- package/dist/worker/console/static-src/operator-chat/useChatThread.js +280 -0
- package/dist/worker/console/static-src/operator-chat/useComposer.js +257 -0
- package/dist/worker/console/static-src/operator-chat/useInterview.js +108 -0
- package/dist/worker/console/static-src/operator-chat/useOverlayFocus.js +84 -0
- package/dist/worker/console/static-src/operator-chat/useRepoBrowser.js +148 -0
- package/dist/worker/console/static-src/operator-chat/useRuntimeControls.js +358 -0
- package/dist/worker/console/static-src/operator-chat/useRuntimeSnapshot.js +196 -0
- package/dist/worker/console/static-src/operator-chat/useWorkspaceLayout.js +58 -0
- package/dist/worker/console/static-src/operator-chat/workspace-layout-mode.js +35 -0
- package/dist/worker/console/static-src/prd-file-import.js +218 -0
- package/dist/worker/console/vite.config.js +27 -0
- package/dist/worker/console/workflow-kinds.js +46 -0
- package/dist/worker/delivery/final-verification.js +302 -0
- package/dist/worker/delivery/git-transaction.js +497 -0
- package/dist/worker/delivery/package.js +537 -0
- package/dist/worker/delivery/verification-bundle.js +544 -0
- package/dist/worker/feature/acceptance-policy.js +227 -0
- package/dist/worker/feature/advance.js +301 -0
- package/dist/worker/feature/decision-loader.js +99 -0
- package/dist/worker/feature/discover.js +14 -0
- package/dist/worker/feature/doctor.js +223 -0
- package/dist/worker/feature/fullstack-validate.js +337 -0
- package/dist/worker/feature/next-action.js +140 -0
- package/dist/worker/feature/profile-schema.js +47 -0
- package/dist/worker/feature/ready-plan-projection.js +82 -0
- package/dist/worker/feature/reducer.js +137 -0
- package/dist/worker/feature/review.js +678 -0
- package/dist/worker/feature/run.js +390 -0
- package/dist/worker/feature/scaffold.js +812 -0
- package/dist/worker/feature/types.js +1 -0
- package/dist/worker/follow-up/approve.js +273 -0
- package/dist/worker/follow-up/factory.js +234 -0
- package/dist/worker/follow-up/paths.js +25 -0
- package/dist/worker/follow-up/policy.js +26 -0
- package/dist/worker/follow-up/schema.js +93 -0
- package/dist/worker/follow-up/store.js +96 -0
- package/dist/worker/loop-agent/command-result.js +1 -0
- package/dist/worker/loop-agent/controller-protocol.js +143 -0
- package/dist/worker/loop-agent/loop-agent-client.js +489 -0
- package/dist/worker/loop-agent/parse-json.js +14 -0
- package/dist/worker/materialize/harness-task-lifecycle-probe.js +126 -0
- package/dist/worker/materialize/harness-task-lineage.js +220 -0
- package/dist/worker/materialize/harness-task-materializer.js +648 -0
- package/dist/worker/metrics/projector.js +139 -0
- package/dist/worker/observability/dag-execution-trajectory.js +591 -0
- package/dist/worker/observability/event-history.js +216 -0
- package/dist/worker/observability/event-store.js +83 -0
- package/dist/worker/observability/events.js +79 -0
- package/dist/worker/observability/interrupt-eligibility.js +264 -0
- package/dist/worker/observability/progress-composite.js +34 -0
- package/dist/worker/observability/read-model.js +2499 -0
- package/dist/worker/observability/snapshot-store.js +43 -0
- package/dist/worker/observability/types.js +1 -0
- package/dist/worker/observe/dag-node-execution-output.js +180 -0
- package/dist/worker/observe/dag-run-artifacts.js +90 -0
- package/dist/worker/observe/health.js +58 -0
- package/dist/worker/observe/night-jobs.js +104 -0
- package/dist/worker/observe/node-input.js +441 -0
- package/dist/worker/observe/paths.js +174 -0
- package/dist/worker/observe/routes.js +1077 -0
- package/dist/worker/observe/server.js +117 -0
- package/dist/worker/observe/spec-evidence.js +398 -0
- package/dist/worker/observe/static/api.js +117 -0
- package/dist/worker/observe/static/app.js +169 -0
- package/dist/worker/observe/static/constants.js +182 -0
- package/dist/worker/observe/static/copy.js +67 -0
- package/dist/worker/observe/static/custom-select.js +567 -0
- package/dist/worker/observe/static/dag-edge-routing.js +368 -0
- package/dist/worker/observe/static/dag-helpers.js +161 -0
- package/dist/worker/observe/static/dag-history-labels.js +95 -0
- package/dist/worker/observe/static/dag-layout.d.ts +36 -0
- package/dist/worker/observe/static/dag-layout.js +163 -0
- package/dist/worker/observe/static/dag-model.js +145 -0
- package/dist/worker/observe/static/dom.js +220 -0
- package/dist/worker/observe/static/favicon.svg +37 -0
- package/dist/worker/observe/static/format-pool.d.ts +71 -0
- package/dist/worker/observe/static/format-pool.js +153 -0
- package/dist/worker/observe/static/format.js +347 -0
- package/dist/worker/observe/static/index.html +409 -0
- package/dist/worker/observe/static/kpi.js +78 -0
- package/dist/worker/observe/static/markdown-render.js +124 -0
- package/dist/worker/observe/static/operator-chrome.css +517 -0
- package/dist/worker/observe/static/operator-chrome.d.ts +83 -0
- package/dist/worker/observe/static/operator-chrome.js +623 -0
- package/dist/worker/observe/static/relations.js +133 -0
- package/dist/worker/observe/static/router.js +156 -0
- package/dist/worker/observe/static/run-processing.js +148 -0
- package/dist/worker/observe/static/shell-chrome.js +65 -0
- package/dist/worker/observe/static/state.js +496 -0
- package/dist/worker/observe/static/styles.css +3567 -0
- package/dist/worker/observe/static/views/batch.js +227 -0
- package/dist/worker/observe/static/views/dag-graph.js +508 -0
- package/dist/worker/observe/static/views/dag-inspector.js +1722 -0
- package/dist/worker/observe/static/views/dag-trajectory.js +313 -0
- package/dist/worker/observe/static/views/dag.js +483 -0
- package/dist/worker/observe/static/views/dags.js +877 -0
- package/dist/worker/observe/static/views/dashboard.js +747 -0
- package/dist/worker/observe/static/views/failures.js +143 -0
- package/dist/worker/observe/static/views/feature.js +492 -0
- package/dist/worker/observe/static/views/night.js +201 -0
- package/dist/worker/observe/static/views/pool.js +708 -0
- package/dist/worker/observe/static/views/run.js +453 -0
- package/dist/worker/observe/static/views/session-timeline.js +771 -0
- package/dist/worker/observe/static/views/shell.js +7 -0
- package/dist/worker/observe/static/views/task.js +315 -0
- package/dist/worker/observe/static/views/timeline.js +163 -0
- package/dist/worker/outcomes/adapters.js +153 -0
- package/dist/worker/outcomes/declared-artifacts.js +103 -0
- package/dist/worker/outcomes/evidence-tokens.js +29 -0
- package/dist/worker/outcomes/gate.js +40 -0
- package/dist/worker/outcomes/projector.js +227 -0
- package/dist/worker/outcomes/registry.js +1 -0
- package/dist/worker/outcomes/store.js +131 -0
- package/dist/worker/outcomes/types.js +79 -0
- package/dist/worker/pool/attempt-identity.js +41 -0
- package/dist/worker/pool/attempt-lease.js +184 -0
- package/dist/worker/pool/attempt-transition.js +210 -0
- package/dist/worker/pool/begin-attempt-with-lease.js +26 -0
- package/dist/worker/pool/begin-attempt.js +35 -0
- package/dist/worker/pool/doctor.js +165 -0
- package/dist/worker/pool/failure-routing.js +182 -0
- package/dist/worker/pool/migrate-state.js +303 -0
- package/dist/worker/pool/reconcile.js +285 -0
- package/dist/worker/pool/recovery-decision.js +163 -0
- package/dist/worker/pool/run-owner-store.js +126 -0
- package/dist/worker/pool/run-store.js +360 -0
- package/dist/worker/pool/runtime-reconcile-inventory.js +127 -0
- package/dist/worker/pool/state-projection.js +57 -0
- package/dist/worker/pool/types.js +17 -0
- package/dist/worker/pool/validation.js +144 -0
- package/dist/worker/preflight.js +157 -0
- package/dist/worker/profile-mapping.js +76 -0
- package/dist/worker/progress-reporter.js +63 -0
- package/dist/worker/report/morning-report.js +155 -0
- package/dist/worker/repos/repo-resolver.js +23 -0
- package/dist/worker/run-task/execute-prepared-task.js +178 -0
- package/dist/worker/run-task/run-task.js +912 -0
- package/dist/worker/runner/run-ready.js +561 -0
- package/dist/worker/runner/single-task-attempt.js +176 -0
- package/dist/worker/scheduler/admission.js +547 -0
- package/dist/worker/scheduler/auto-followup.js +99 -0
- package/dist/worker/scheduler/cli.js +644 -0
- package/dist/worker/scheduler/clock-install/darwin-launchd.js +238 -0
- package/dist/worker/scheduler/clock-install/linux-systemd-user.js +224 -0
- package/dist/worker/scheduler/clock-install/types.js +1 -0
- package/dist/worker/scheduler/clock-install/win32-schtasks.js +227 -0
- package/dist/worker/scheduler/clock-install.js +284 -0
- package/dist/worker/scheduler/clock.js +420 -0
- package/dist/worker/scheduler/dispatcher.js +503 -0
- package/dist/worker/scheduler/doctor.js +431 -0
- package/dist/worker/scheduler/evidence.js +170 -0
- package/dist/worker/scheduler/git-base.js +90 -0
- package/dist/worker/scheduler/index.js +25 -0
- package/dist/worker/scheduler/lease.js +114 -0
- package/dist/worker/scheduler/lifecycle.js +348 -0
- package/dist/worker/scheduler/lock.js +80 -0
- package/dist/worker/scheduler/morning-window.js +191 -0
- package/dist/worker/scheduler/night-git-finalizer.js +114 -0
- package/dist/worker/scheduler/night-harvest.js +412 -0
- package/dist/worker/scheduler/paths.js +92 -0
- package/dist/worker/scheduler/prepared-attempt-recovery.js +471 -0
- package/dist/worker/scheduler/recovery.js +277 -0
- package/dist/worker/scheduler/reservation.js +146 -0
- package/dist/worker/scheduler/retry.js +199 -0
- package/dist/worker/scheduler/scheduler-loop.js +272 -0
- package/dist/worker/scheduler/store.js +275 -0
- package/dist/worker/scheduler/traceability.js +54 -0
- package/dist/worker/scheduler/trigger.js +258 -0
- package/dist/worker/scheduler/types.js +369 -0
- package/dist/worker/scheduler/workspace-adapter.js +128 -0
- package/dist/worker/task-graph/acceptance-schema.js +40 -0
- package/dist/worker/task-graph/ready-planner.js +267 -0
- package/dist/worker/task-graph/ready-queue.js +23 -0
- package/dist/worker/task-graph/task-graph-schema.js +59 -0
- package/dist/worker/task-graph/types.js +1 -0
- package/dist/worker/task-graph/validate.js +293 -0
- package/dist/worker/task-spec/complexity-mapping.js +8 -0
- package/dist/worker/task-spec/schema.js +125 -0
- package/dist/worker/task-spec/types.js +1 -0
- package/dist/worker/task-spec/validate.js +391 -0
- package/dist/worker/task-spec/workflow-routing.js +149 -0
- package/dist/workflows/dag/authoring.js +8 -0
- package/dist/workflows/dag/authority-surface.js +138 -0
- package/dist/workflows/dag/backend-test-analysis-contract.js +507 -0
- package/dist/workflows/dag/backend-test-case-coverage-analysis.js +1985 -0
- package/dist/workflows/dag/backend-test-case-manifest.js +638 -0
- package/dist/workflows/dag/backend-test-classification-contract.js +38 -0
- package/dist/workflows/dag/backend-test-contract-envelope.js +205 -0
- package/dist/workflows/dag/backend-test-coverage-contract.js +202 -0
- package/dist/workflows/dag/backend-test-execution-contract.js +715 -0
- package/dist/workflows/dag/backend-test-gap-fill.js +205 -0
- package/dist/workflows/dag/backend-test-intake-context.js +178 -0
- package/dist/workflows/dag/backend-test-layout.js +133 -0
- package/dist/workflows/dag/backend-test-markdown-workflow.js +1984 -0
- package/dist/workflows/dag/backend-test-module-stem.js +26 -0
- package/dist/workflows/dag/backend-test-pytest-collection.js +859 -0
- package/dist/workflows/dag/backend-test-result-contract.js +1030 -0
- package/dist/workflows/dag/backend-test-scenario-param.js +1670 -0
- package/dist/workflows/dag/backend-test-scenario-partitions.js +249 -0
- package/dist/workflows/dag/backend-test-semantic-review-contract.js +36 -0
- package/dist/workflows/dag/backend-test-stability-contract.js +57 -0
- package/dist/workflows/dag/backend-test-writer-completeness.js +1058 -0
- package/dist/workflows/dag/budget-enforcement.js +67 -0
- package/dist/workflows/dag/canvas-observer.js +474 -0
- package/dist/workflows/dag/context-policy.js +137 -0
- package/dist/workflows/dag/contract-output-registry.js +14 -0
- package/dist/workflows/dag/contract-validator-registrations.js +10 -0
- package/dist/workflows/dag/controller-identity.js +104 -0
- package/dist/workflows/dag/convergence/controller.js +596 -0
- package/dist/workflows/dag/decision-envelope.js +557 -0
- package/dist/workflows/dag/decision-evidence.js +153 -0
- package/dist/workflows/dag/decision-gates.js +1 -0
- package/dist/workflows/dag/dynamic-runtime/condition.js +48 -0
- package/dist/workflows/dag/dynamic-runtime/loop-until.js +161 -0
- package/dist/workflows/dag/dynamic-runtime/map.js +435 -0
- package/dist/workflows/dag/dynamic-runtime/reduction.js +72 -0
- package/dist/workflows/dag/dynamic-runtime/shared.js +203 -0
- package/dist/workflows/dag/event-observer.js +132 -0
- package/dist/workflows/dag/executor-registry.js +23 -0
- package/dist/workflows/dag/facts.js +4 -0
- package/dist/workflows/dag/failure-category.js +118 -0
- package/dist/workflows/dag/failure-routing.js +105 -0
- package/dist/workflows/dag/final-verification.js +180 -0
- package/dist/workflows/dag/frontend-implementation-contract.js +1911 -0
- package/dist/workflows/dag/frontend-lint-baseline.js +474 -0
- package/dist/workflows/dag/frontend-plan-render.js +90 -0
- package/dist/workflows/dag/frontend-prewrite-gate.js +1011 -0
- package/dist/workflows/dag/frontend-project-capability.js +1 -0
- package/dist/workflows/dag/frontend-recovery-plan.js +73 -0
- package/dist/workflows/dag/frontend-recovery-root-manifest.js +123 -0
- package/dist/workflows/dag/frontend-recovery-run.js +539 -0
- package/dist/workflows/dag/frontend-repair.js +541 -0
- package/dist/workflows/dag/frontend-review-context.js +116 -0
- package/dist/workflows/dag/frontend-risk.js +161 -0
- package/dist/workflows/dag/frontend-test-case-checklist.js +343 -0
- package/dist/workflows/dag/frontend-test-case-manifest.js +104 -0
- package/dist/workflows/dag/frontend-test-case-quality.js +105 -0
- package/dist/workflows/dag/frontend-test-html-report.js +174 -0
- package/dist/workflows/dag/frontend-test-l5-report.js +177 -0
- package/dist/workflows/dag/frontend-test-result-contract.js +487 -0
- package/dist/workflows/dag/frontend-verification-trace.js +275 -0
- package/dist/workflows/dag/frontend-worktree-diff.js +201 -0
- package/dist/workflows/dag/frontend-writer-recovery.js +106 -0
- package/dist/workflows/dag/frontend-writer-rollback.js +821 -0
- package/dist/workflows/dag/governance-constants.js +5 -0
- package/dist/workflows/dag/governance-profile.js +413 -0
- package/dist/workflows/dag/index.js +6 -0
- package/dist/workflows/dag/init-hybrid.js +7345 -0
- package/dist/workflows/dag/interrupt-request.js +559 -0
- package/dist/workflows/dag/knowledge-curator.js +165 -0
- package/dist/workflows/dag/l5-report-metrics.js +33 -0
- package/dist/workflows/dag/lifecycle.js +855 -0
- package/dist/workflows/dag/liveness-policy.js +251 -0
- package/dist/workflows/dag/node-execution.js +1081 -0
- package/dist/workflows/dag/observer-compose.js +52 -0
- package/dist/workflows/dag/output-protocol.js +356 -0
- package/dist/workflows/dag/project-governance-context.js +514 -0
- package/dist/workflows/dag/prompt-source.js +88 -0
- package/dist/workflows/dag/prompt.js +348 -0
- package/dist/workflows/dag/reconcile-run.js +145 -0
- package/dist/workflows/dag/reconcile-tasks.js +404 -0
- package/dist/workflows/dag/recovery-recommendation.js +329 -0
- package/dist/workflows/dag/repair-artifact.js +363 -0
- package/dist/workflows/dag/report.js +1229 -0
- package/dist/workflows/dag/rerun-plan.js +614 -0
- package/dist/workflows/dag/rerun-run.js +556 -0
- package/dist/workflows/dag/rerun-task.js +370 -0
- package/dist/workflows/dag/retry-policy.js +263 -0
- package/dist/workflows/dag/run-store.js +41 -0
- package/dist/workflows/dag/runner.js +1069 -0
- package/dist/workflows/dag/runtime-contract.js +87 -0
- package/dist/workflows/dag/runtime.js +5 -0
- package/dist/workflows/dag/scheduler.js +497 -0
- package/dist/workflows/dag/sdd-embedded.js +128 -0
- package/dist/workflows/dag/skill-instructions.js +478 -0
- package/dist/workflows/dag/skill-snapshot.js +553 -0
- package/dist/workflows/dag/skills.js +41 -0
- package/dist/workflows/dag/spec.js +3 -0
- package/dist/workflows/dag/task-contract-binding.js +138 -0
- package/dist/workflows/dag/task-demand-routing.js +1 -0
- package/dist/workflows/dag/topo.js +30 -0
- package/dist/workflows/dag/types.js +1145 -0
- package/dist/workflows/dag/upstream-artifacts.js +98 -0
- package/dist/workflows/dag/validate.js +998 -0
- package/dist/workflows/dag/workspace-checkpoint.js +186 -0
- package/dist/workflows/dynamic/artifacts.js +65 -0
- package/dist/workflows/dynamic/compile.js +371 -0
- package/dist/workflows/dynamic/compileTypes.js +1 -0
- package/dist/workflows/dynamic/errors.js +5 -0
- package/dist/workflows/dynamic/index.js +7 -0
- package/dist/workflows/dynamic/profiles.js +156 -0
- package/dist/workflows/dynamic/spec.js +115 -0
- package/dist/workflows/dynamic/validate.js +275 -0
- package/dist/workflows/loop/actions/dag-action.js +129 -0
- package/dist/workflows/loop/actions/pi-review.js +267 -0
- package/dist/workflows/loop/actions/shared.js +157 -0
- package/dist/workflows/loop/actions/shell-verify.js +82 -0
- package/dist/workflows/loop/actions/types.js +1 -0
- package/dist/workflows/loop/actions/workflow-action.js +255 -0
- package/dist/workflows/loop/actions.js +160 -0
- package/dist/workflows/loop/benchmark.js +510 -0
- package/dist/workflows/loop/closeout.js +135 -0
- package/dist/workflows/loop/context.js +47 -0
- package/dist/workflows/loop/events.js +26 -0
- package/dist/workflows/loop/hash.js +32 -0
- package/dist/workflows/loop/index.js +8 -0
- package/dist/workflows/loop/paths.js +17 -0
- package/dist/workflows/loop/policy/auto-policy.js +112 -0
- package/dist/workflows/loop/policy/path-patterns.js +13 -0
- package/dist/workflows/loop/rounds.js +81 -0
- package/dist/workflows/loop/signals.js +52 -0
- package/dist/workflows/loop/state.js +116 -0
- package/dist/workflows/loop/templates.js +54 -0
- package/dist/workflows/loop/types.js +28 -0
- package/docs/README.md +82 -0
- package/docs/architecture/README.md +35 -0
- package/docs/architecture/dag-execution.md +165 -0
- package/docs/architecture/evolution.md +108 -0
- package/docs/architecture/facts-and-state.md +74 -0
- package/docs/architecture/runtime-boundaries.md +226 -0
- package/docs/architecture/system-overview.md +100 -0
- package/docs/architecture/worker-and-feature.md +122 -0
- package/docs/governance/README.md +18 -0
- package/docs/governance/harness-methodology-debugging.md +177 -0
- package/docs/governance/harness-methodology-tdd.md +130 -0
- package/docs/governance/harness-methodology-verification.md +27 -0
- package/docs/init-surface.manifest.json +358 -0
- package/docs/operations/README.md +15 -0
- package/docs/operations/local-development-environment.md +77 -0
- package/docs/skills/README.md +7 -0
- package/docs/skills/vetted-skill-registry.md +49 -0
- package/docs/templates/README.md +67 -0
- package/docs/templates/adr.md +60 -0
- package/docs/templates/agent-dag-authority-surface-audit.prompt.md +94 -0
- package/docs/templates/agent-dag-decision-envelope.schema.json +213 -0
- package/docs/templates/agent-dag-decision-gate-dogfood-report.md +117 -0
- package/docs/templates/agent-dag-decision-gate.prompt.md +246 -0
- package/docs/templates/agent-dag-process-supervisor.prompt.md +98 -0
- package/docs/templates/agent-dag-report.schema.json +473 -0
- package/docs/templates/agent-dag-review-verdict.prompt.md +68 -0
- package/docs/templates/agent-dag.base.json +190 -0
- package/docs/templates/agent-dag.final-verification.json +185 -0
- package/docs/templates/agent-dag.schema.json +590 -0
- package/docs/templates/agent-dag.supervised-implementation.json +640 -0
- package/docs/templates/agent-worker-production-readiness-checklist.md +47 -0
- package/docs/templates/backend-test-analysis.schema.json +37 -0
- package/docs/templates/backend-test-case-manifest.schema.json +223 -0
- package/docs/templates/backend-test-dag.classify.prompt.md +75 -0
- package/docs/templates/backend-test-dag.generate-pytest.prompt.md +41 -0
- package/docs/templates/backend-test-dag.json +671 -0
- package/docs/templates/backend-test-dag.retrospect.prompt.md +165 -0
- package/docs/templates/backend-test-dag.review-cases.prompt.md +36 -0
- package/docs/templates/backend-test-execution.schema.json +138 -0
- package/docs/templates/backend-test-result.schema.json +99 -0
- package/docs/templates/branch-merge-report.md +115 -0
- package/docs/templates/evaluation/agents-map-slim-v1.candidate.json +9 -0
- package/docs/templates/evaluation/agents-map-slim-v1.md +87 -0
- package/docs/templates/evaluation/agents-map-verbose-v0.candidate.json +9 -0
- package/docs/templates/evaluation/agents-map-verbose-v0.md +153 -0
- package/docs/templates/evaluation/campaign-budget-v1.json +12 -0
- package/docs/templates/evaluation/campaign-dogfood-v0.json +24 -0
- package/docs/templates/evaluation/campaign-evidence-v1.json +44 -0
- package/docs/templates/evaluation/context-policy-baseline-v1.json +17 -0
- package/docs/templates/evaluation/context-policy-role-specialized-v1.json +28 -0
- package/docs/templates/evaluation/corpus-dogfood-v0.manifest.json +118 -0
- package/docs/templates/evaluation/matrix-dag-dry-run-v1.json +21 -0
- package/docs/templates/evaluation/matrix-fixture-v1.json +10 -0
- package/docs/templates/evaluation/private-verifier-dogfood-v0.json +16 -0
- package/docs/templates/exec-plan.md +66 -0
- package/docs/templates/feature-spec.md +53 -0
- package/docs/templates/frontend-design-contract.md +68 -0
- package/docs/templates/frontend-eval/fixtures/failures/01-type-build-error.md +17 -0
- package/docs/templates/frontend-eval/fixtures/failures/02-unit-component-test-fail.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/03-fixture-schema-drift.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/04-missing-loading-empty-error-state.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/05-forbidden-write-writeset-expansion.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/06-unapproved-dependency-add.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/07-mock-production-on.md +21 -0
- package/docs/templates/frontend-eval/fixtures/functional/01-simple-component-style.md +29 -0
- package/docs/templates/frontend-eval/fixtures/functional/02-form-validation.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/03-list-detail-page.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/04-api-mock.md +29 -0
- package/docs/templates/frontend-eval/fixtures/functional/05-permission-auth-gated-ui.md +27 -0
- package/docs/templates/frontend-eval/fixtures/functional/06-ssr-server-client-boundary.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/07-shared-public-component-api.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/08-pure-local-no-remote.md +27 -0
- package/docs/templates/frontend-eval/metrics.md +138 -0
- package/docs/templates/frontend-eval/smoke-targets.md +53 -0
- package/docs/templates/frontend-implementation-contract.schema.json +35 -0
- package/docs/templates/frontend-task-constraints.md +62 -0
- package/docs/templates/frontend-task-requirement.md +104 -0
- package/docs/templates/frontend-test-case-checklist.md +44 -0
- package/docs/templates/frontend-test-case.example.md +143 -0
- package/docs/templates/frontend-test-dag.generate-cases.prompt.md +63 -0
- package/docs/templates/frontend-test-dag.json +409 -0
- package/docs/templates/frontend-test-dag.retrieve-context.prompt.md +21 -0
- package/docs/templates/frontend-test-dag.retrospect.prompt.md +5 -0
- package/docs/templates/frontend-test-dag.review-cases.prompt.md +5 -0
- package/docs/templates/frontend-test-dag.review-execution.prompt.md +3 -0
- package/docs/templates/frontend-test-standard-scenarios.v1.json +159 -0
- package/docs/templates/harness.schema.json +351 -0
- package/docs/templates/hybrid-dag.json +188 -0
- package/docs/templates/init-evolution-review.md +35 -0
- package/docs/templates/init-managed-agents.md +157 -0
- package/docs/templates/interactive-ui-round2-experiment.md +66 -0
- package/docs/templates/knowledge-graph-bootstrap-dag.json +118 -0
- package/docs/templates/knowledge-sync-dag.json +178 -0
- package/docs/templates/knowledge-sync-draft.schema.json +71 -0
- package/docs/templates/product-line/AGENTS.md +9 -0
- package/docs/templates/product-line/README.md +42 -0
- package/docs/templates/product-line/acceptance.yaml +23 -0
- package/docs/templates/product-line/closeout.yaml +9 -0
- package/docs/templates/product-line/design.md +13 -0
- package/docs/templates/product-line/feature-scaffold-batch.example.yaml +31 -0
- package/docs/templates/product-line/feature.yaml +11 -0
- package/docs/templates/product-line/links.md +10 -0
- package/docs/templates/product-line/requirement.md +17 -0
- package/docs/templates/product-line/scaffold-samples/README.md +36 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/acceptance.yaml +16 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/design.md +14 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/feature.yaml +14 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/requirement.md +6 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/tasks/BE-IMPL-001.yaml +83 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/tasks/task-graph.yaml +14 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/acceptance.yaml +18 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/design.md +18 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/feature.yaml +14 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/requirement.md +6 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/tasks/BE-IMPL-001.yaml +84 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/tasks/CONTRACT-001.yaml +84 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/tasks/FE-IMPL-001.yaml +86 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/tasks/task-graph.yaml +40 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/acceptance.yaml +16 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/design.md +14 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/feature.yaml +14 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/requirement.md +6 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/tasks/FE-IMPL-001.yaml +85 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/tasks/task-graph.yaml +14 -0
- package/docs/templates/product-line/task-graph.yaml +23 -0
- package/docs/templates/product-line/task.yaml +68 -0
- package/docs/templates/product-line/test-plan.md +7 -0
- package/docs/templates/production-readiness-checklist.md +57 -0
- package/docs/templates/progress-log.md +27 -0
- package/docs/templates/project-start-checklist.md +9 -0
- package/docs/templates/qa-report.md +48 -0
- package/docs/templates/sprint-contract.md +29 -0
- package/docs/templates/worker-dogfood-evidence.md +80 -0
- package/docs/templates/worker-dogfood-setup.md +68 -0
- package/examples/decision-gate-agent-dag.json +177 -0
- package/examples/example-dag.json +46 -0
- package/examples/hybrid-loop-agent-dag.json +189 -0
- package/examples/l5-report-coms-process-definition.html +322 -0
- package/examples/l5-report-demo.html +79 -0
- package/harness.json +90 -0
- package/package.json +98 -0
- package/scripts/kb-bootstrap-init-skeleton.sh +241 -0
- package/scripts/kb-graph-incremental-prepare.mjs +386 -0
- package/scripts/kb-graph-materialize.mjs +105 -0
- package/scripts/kb-graph-promote.mjs +164 -0
- package/scripts/kb-query.mjs +554 -0
- package/skills/agent-worker/SKILL.md +48 -0
- package/skills/agent-worker/references/agent-worker-operator.md +159 -0
- package/skills/ai-engineering-context/SKILL.md +48 -0
- package/skills/analyze-product-dependencies/SKILL.md +108 -0
- package/skills/analyze-product-dependencies/references/api-documentation-schema.md +35 -0
- package/skills/analyze-product-dependencies/references/dependency-analysis-schema.md +38 -0
- package/skills/analyze-product-dependencies/references/example.md +76 -0
- package/skills/analyze-product-dependencies/references/forward-test-cases.md +110 -0
- package/skills/analyze-product-dependencies/references/input-contract.md +34 -0
- package/skills/analyze-product-dependencies/references/kb-integration.md +64 -0
- package/skills/analyze-product-dependencies/references/scouting-rules.md +76 -0
- package/skills/analyze-product-dependencies/scripts/test-validators.mjs +460 -0
- package/skills/analyze-product-dependencies/scripts/validate-api-documentation.mjs +194 -0
- package/skills/analyze-product-dependencies/scripts/validate-dependency-analysis.mjs +200 -0
- package/skills/analyze-product-dependencies/scripts/validate-product-requirement-input.mjs +90 -0
- package/skills/analyze-product-dependencies/scripts/validation-helpers.mjs +138 -0
- package/skills/analyze-product-requirements/SKILL.md +145 -0
- package/skills/analyze-product-requirements/references/acceptance-criteria.md +87 -0
- package/skills/analyze-product-requirements/references/clarification-and-knowledge.md +70 -0
- package/skills/analyze-product-requirements/references/example.md +104 -0
- package/skills/analyze-product-requirements/references/forward-test-cases.md +144 -0
- package/skills/analyze-product-requirements/references/kb-integration.md +56 -0
- package/skills/analyze-product-requirements/references/product-analysis-schema.md +41 -0
- package/skills/analyze-product-requirements/references/product-requirement-schema.md +42 -0
- package/skills/analyze-product-requirements/references/requirement-clarification-schema.md +66 -0
- package/skills/analyze-product-requirements/scripts/compute-source-identity.mjs +35 -0
- package/skills/analyze-product-requirements/scripts/test-validators.mjs +501 -0
- package/skills/analyze-product-requirements/scripts/validate-product-analysis.mjs +100 -0
- package/skills/analyze-product-requirements/scripts/validate-product-requirement.mjs +109 -0
- package/skills/analyze-product-requirements/scripts/validate-requirement-clarification.mjs +109 -0
- package/skills/analyze-product-requirements/scripts/validation-helpers.mjs +175 -0
- package/skills/browser-tools/SKILL.md +196 -0
- package/skills/browser-tools/browser-content.js +103 -0
- package/skills/browser-tools/browser-cookies.js +35 -0
- package/skills/browser-tools/browser-eval.js +53 -0
- package/skills/browser-tools/browser-hn-scraper.js +108 -0
- package/skills/browser-tools/browser-nav.js +44 -0
- package/skills/browser-tools/browser-pick.js +162 -0
- package/skills/browser-tools/browser-screenshot.js +34 -0
- package/skills/browser-tools/browser-start.js +86 -0
- package/skills/browser-tools/package-lock.json +2556 -0
- package/skills/browser-tools/package.json +19 -0
- package/skills/code-review-core/SKILL.md +20 -0
- package/skills/codebase-scout/SKILL.md +19 -0
- package/skills/frontend-bounded-implement/SKILL.md +53 -0
- package/skills/frontend-design-review/SKILL.md +79 -0
- package/skills/frontend-design-review/references/review-checklist.md +43 -0
- package/skills/frontend-implementation/SKILL.md +52 -0
- package/skills/frontend-implementation/references/code-standards.md +33 -0
- package/skills/frontend-implementation/references/design-spec.md +56 -0
- package/skills/frontend-implementation/references/node-contracts.md +31 -0
- package/skills/frontend-review/SKILL.md +55 -0
- package/skills/frontend-review/references/review-findings.md +50 -0
- package/skills/frontend-verification/SKILL.md +61 -0
- package/skills/frontend-verification/references/verification-checklist.md +48 -0
- package/skills/grill-me/SKILL.md +10 -0
- package/skills/grill-with-docs/SKILL.md +80 -0
- package/skills/grill-with-docs/adr-format.md +58 -0
- package/skills/grill-with-docs/context-format.md +52 -0
- package/skills/init-capability-evolution/SKILL.md +70 -0
- package/skills/local-jacoco-coverage/SKILL.md +281 -0
- package/skills/local-jacoco-coverage/references/requirement-to-source-mapping.md +85 -0
- package/skills/local-jacoco-coverage/references/runtime-alignment.md +106 -0
- package/skills/local-jacoco-coverage/scripts/run-coverage-analysis.sh +148 -0
- package/skills/local-jacoco-coverage/scripts/start-jacoco-agent.sh +110 -0
- package/skills/loop-agent/SKILL.md +68 -0
- package/skills/loop-agent/references/README.md +67 -0
- package/skills/loop-agent/references/command-reference.md +645 -0
- package/skills/loop-agent/references/docs-converge.md +126 -0
- package/skills/loop-agent/references/harness-policy.md +289 -0
- package/skills/loop-agent/references/hybrid-dag.md +245 -0
- package/skills/loop-agent/references/learned/README.md +21 -0
- package/skills/loop-agent/references/long-running-loop.md +57 -0
- package/skills/loop-agent/references/model-routing.md +45 -0
- package/skills/loop-agent/references/multi-worktree.md +54 -0
- package/skills/loop-agent/references/one-shot-runs.md +84 -0
- package/skills/loop-agent/references/orchestrator-and-interventions.md +175 -0
- package/skills/loop-agent/references/pi-prompt.md +23 -0
- package/skills/loop-agent/references/pi-subagent-assisted-mode.md +84 -0
- package/skills/loop-agent/references/post-implementation-and-patterns.md +54 -0
- package/skills/loop-agent/references/source-and-plan-practice.md +169 -0
- package/skills/loop-agent/references/task-workflow.md +104 -0
- package/skills/loop-agent/references/verification-and-failure-handling.md +148 -0
- package/skills/playwright-cli/SKILL.md +93 -0
- package/skills/playwright-cli/references/element-attributes.md +23 -0
- package/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/skills/playwright-cli/references/request-mocking.md +87 -0
- package/skills/playwright-cli/references/running-code.md +241 -0
- package/skills/playwright-cli/references/session-management.md +225 -0
- package/skills/playwright-cli/references/storage-state.md +275 -0
- package/skills/playwright-cli/references/test-generation.md +433 -0
- package/skills/playwright-cli/references/tracing.md +5 -0
- package/skills/playwright-cli/references/video-recording.md +5 -0
- package/skills/playwright-cli-case-generator/SKILL.md +108 -0
- package/skills/requesting-code-review/SKILL.md +101 -0
- package/skills/requesting-code-review/code-reviewer.md +168 -0
- package/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/skills/systematic-debugging/SKILL.md +312 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +63 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/systematic-debugging/test-academic.md +14 -0
- package/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/test-driven-development/SKILL.md +27 -0
- package/skills/using-git-worktrees/SKILL.md +215 -0
- package/skills/verification-before-completion/SKILL.md +154 -0
- package/skills/webapp-testing/SKILL.md +19 -0
|
@@ -0,0 +1,1229 @@
|
|
|
1
|
+
import { access, readFile, readdir } from "node:fs/promises";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { resolveCliPath } from "../../shared/path-refs.js";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { repairArtifactSchema } from "./repair-artifact.js";
|
|
7
|
+
import { dagRunDirExists, getDagRunDir, isDagExecutionLifecycle, locateDagRun, readDagRunSpec, readDagRunState, } from "./lifecycle.js";
|
|
8
|
+
export const DAG_CLOSEOUT_DRAFT_DISCLAIMER = "> **Advisory only.** Derived from completed run facts. Canonical source remains `dag report --json` and `.harness/dag-runs/completed/<run-id>/`. Do not treat this draft as authoritative.";
|
|
9
|
+
import { dagNormalizedFailureCategorySchema, normalizeDagFailureCategory, } from "./failure-category.js";
|
|
10
|
+
import { dagProductLineFailureCategoryValues, routeDagFailure, } from "./failure-routing.js";
|
|
11
|
+
import { DAG_RECOVERY_ACTIONS, planDagRecovery, recommendFollowUpForFailureCategory, } from "./recovery-recommendation.js";
|
|
12
|
+
import { dagNodeExecutorSchema, dagNodeStatusSchema, LEGACY_TOP_LEVEL_MODELS_ERROR, parseDagSpec, resolveModelForTask, } from "./types.js";
|
|
13
|
+
import { checkRuntimeContractCompatible, DAG_CONTROLLER_CAPABILITIES, } from "./runtime-contract.js";
|
|
14
|
+
export const DAG_REPORT_SCHEMA_VERSION = 1;
|
|
15
|
+
export const DAG_REPORT_SCHEMA_RELATIVE_PATH = "docs/templates/agent-dag-report.schema.json";
|
|
16
|
+
const dagRunLifecycleSchema = z.enum(["active", "paused", "completed"]);
|
|
17
|
+
const dagRunStatusSchema = z.enum([
|
|
18
|
+
"pending",
|
|
19
|
+
"running",
|
|
20
|
+
"finished",
|
|
21
|
+
"partial_failed",
|
|
22
|
+
"failed",
|
|
23
|
+
"paused",
|
|
24
|
+
"superseded",
|
|
25
|
+
"abandoned",
|
|
26
|
+
]);
|
|
27
|
+
const dagRecoveryActionSchema = z.enum(DAG_RECOVERY_ACTIONS);
|
|
28
|
+
const dagProductLineFailureCategorySchema = z.enum(dagProductLineFailureCategoryValues);
|
|
29
|
+
const dagArtifactRefSchema = z
|
|
30
|
+
.object({
|
|
31
|
+
path: z.string(),
|
|
32
|
+
exists: z.boolean(),
|
|
33
|
+
})
|
|
34
|
+
.strict();
|
|
35
|
+
const dagRecoveryRecommendationSchema = z
|
|
36
|
+
.object({
|
|
37
|
+
action: dagRecoveryActionSchema,
|
|
38
|
+
summary: z.string(),
|
|
39
|
+
reason: z.string(),
|
|
40
|
+
humanRequired: z.boolean(),
|
|
41
|
+
autoRetryEligible: z.boolean(),
|
|
42
|
+
commandHint: z.string().optional(),
|
|
43
|
+
})
|
|
44
|
+
.strict();
|
|
45
|
+
const dagReportPrimaryFailureSchema = z
|
|
46
|
+
.object({
|
|
47
|
+
scope: z.enum(["node", "run"]),
|
|
48
|
+
nodeId: z.string().optional(),
|
|
49
|
+
nodeStatus: dagNodeStatusSchema.optional(),
|
|
50
|
+
failureCategory: z.string().optional(),
|
|
51
|
+
normalizedFailureCategory: dagNormalizedFailureCategorySchema.optional(),
|
|
52
|
+
productLineFailureCategory: dagProductLineFailureCategorySchema.optional(),
|
|
53
|
+
recommendedFollowUp: z.string().optional(),
|
|
54
|
+
})
|
|
55
|
+
.strict();
|
|
56
|
+
const dagReportDownstreamSkippedNodeSchema = z
|
|
57
|
+
.object({
|
|
58
|
+
nodeId: z.string(),
|
|
59
|
+
failureCategory: z.string().optional(),
|
|
60
|
+
normalizedFailureCategory: dagNormalizedFailureCategorySchema.optional(),
|
|
61
|
+
productLineFailureCategory: dagProductLineFailureCategorySchema.optional(),
|
|
62
|
+
recommendedFollowUp: z.string().optional(),
|
|
63
|
+
})
|
|
64
|
+
.strict();
|
|
65
|
+
const dagConvergencePassArtifactRefSchema = z
|
|
66
|
+
.object({
|
|
67
|
+
nodeId: z.string(),
|
|
68
|
+
status: dagNodeStatusSchema,
|
|
69
|
+
failureCategory: z.string().optional(),
|
|
70
|
+
nodeRecordPath: z.string().optional(),
|
|
71
|
+
stdoutArtifactPath: z.string().optional(),
|
|
72
|
+
assistantArtifactPath: z.string().optional(),
|
|
73
|
+
preservedNodeRecordPath: z.string().optional(),
|
|
74
|
+
preservedNodeDir: z.string().optional(),
|
|
75
|
+
})
|
|
76
|
+
.strict();
|
|
77
|
+
const dagConvergencePassReportSchema = z
|
|
78
|
+
.object({
|
|
79
|
+
pass: z.number().int().positive(),
|
|
80
|
+
startedAt: z.string().optional(),
|
|
81
|
+
finishedAt: z.string(),
|
|
82
|
+
status: z.enum(["retrying", "terminal", "paused"]),
|
|
83
|
+
reason: z.string(),
|
|
84
|
+
hardVerifyStatus: dagNodeStatusSchema.optional(),
|
|
85
|
+
hardVerifyFailureCategory: z.string().optional(),
|
|
86
|
+
processVerdict: z.enum(["pass", "request-revision", "unknown"]).optional(),
|
|
87
|
+
repairArtifact: repairArtifactSchema.optional(),
|
|
88
|
+
verifyPhase: z.enum(["intermediate", "final"]).optional(),
|
|
89
|
+
verifyQuota: z.enum(["1", "3", "full"]).optional(),
|
|
90
|
+
verifyCommandCount: z.number().int().nonnegative().optional(),
|
|
91
|
+
verifyCommandLabels: z.array(z.string()).optional(),
|
|
92
|
+
shellSuccessCount: z.number().int().nonnegative().optional(),
|
|
93
|
+
artifactRefs: z.array(dagConvergencePassArtifactRefSchema),
|
|
94
|
+
})
|
|
95
|
+
.strict();
|
|
96
|
+
const dagConvergenceReportSchema = z
|
|
97
|
+
.object({
|
|
98
|
+
enabled: z.boolean(),
|
|
99
|
+
maxPasses: z.number().int().positive(),
|
|
100
|
+
currentPass: z.number().int().positive(),
|
|
101
|
+
terminalReason: z.string().optional(),
|
|
102
|
+
passHistory: z.array(dagConvergencePassReportSchema),
|
|
103
|
+
})
|
|
104
|
+
.strict();
|
|
105
|
+
const dagNodeDecisionEnvelopeSchema = z
|
|
106
|
+
.object({
|
|
107
|
+
parseOk: z.boolean(),
|
|
108
|
+
decision: z.string().optional(),
|
|
109
|
+
requiresHuman: z.boolean().optional(),
|
|
110
|
+
nextAction: z.string().optional(),
|
|
111
|
+
riskLevel: z.string().optional(),
|
|
112
|
+
source: z.enum(["assistantText", "resultSummaryFallback"]).optional(),
|
|
113
|
+
errors: z.array(z.string()).optional(),
|
|
114
|
+
})
|
|
115
|
+
.passthrough();
|
|
116
|
+
const dagNodeArtifactsReportSchema = z
|
|
117
|
+
.object({
|
|
118
|
+
resultSummary: dagArtifactRefSchema,
|
|
119
|
+
promptRedacted: dagArtifactRefSchema,
|
|
120
|
+
skills: dagArtifactRefSchema,
|
|
121
|
+
nodeRecord: dagArtifactRefSchema,
|
|
122
|
+
decisionEnvelope: dagArtifactRefSchema,
|
|
123
|
+
decisionEnvelopeValidation: dagArtifactRefSchema,
|
|
124
|
+
humanEscalationJson: dagArtifactRefSchema,
|
|
125
|
+
humanEscalationMd: dagArtifactRefSchema,
|
|
126
|
+
humanApproval: dagArtifactRefSchema,
|
|
127
|
+
humanRejection: dagArtifactRefSchema,
|
|
128
|
+
})
|
|
129
|
+
.strict();
|
|
130
|
+
const dagNodeReportRowSchema = z
|
|
131
|
+
.object({
|
|
132
|
+
nodeId: z.string(),
|
|
133
|
+
rank: z.number().int().nonnegative(),
|
|
134
|
+
order: z.number().int().nonnegative(),
|
|
135
|
+
executor: dagNodeExecutorSchema,
|
|
136
|
+
model: z.string().optional(),
|
|
137
|
+
status: dagNodeStatusSchema,
|
|
138
|
+
durationMs: z.number().nonnegative().optional(),
|
|
139
|
+
tokensUsed: z.number().nonnegative().optional(),
|
|
140
|
+
failureCategory: z.string().optional(),
|
|
141
|
+
normalizedFailureCategory: dagNormalizedFailureCategorySchema.optional(),
|
|
142
|
+
productLineFailureCategory: dagProductLineFailureCategorySchema.optional(),
|
|
143
|
+
recommendedFollowUp: z.string().optional(),
|
|
144
|
+
recommendedFollowUpCategory: z
|
|
145
|
+
.enum(["repair", "revision", "retry", "restart", "diagnosis"])
|
|
146
|
+
.optional(),
|
|
147
|
+
recommendedFollowUpReason: z.string().optional(),
|
|
148
|
+
recoveryRecommendation: dagRecoveryRecommendationSchema.optional(),
|
|
149
|
+
backend: z.enum(["sdk", "cli"]).optional(),
|
|
150
|
+
sdkAttempted: z.boolean().optional(),
|
|
151
|
+
startedAt: z.string().optional(),
|
|
152
|
+
finishedAt: z.string().optional(),
|
|
153
|
+
decisionEnvelope: dagNodeDecisionEnvelopeSchema.optional(),
|
|
154
|
+
artifacts: dagNodeArtifactsReportSchema,
|
|
155
|
+
structuredArtifactPath: z.string().min(1).optional(),
|
|
156
|
+
structuredArtifactSha256: z.string().regex(/^[a-f0-9]{64}$/).optional(),
|
|
157
|
+
structuredArtifactSchemaId: z.string().min(1).optional(),
|
|
158
|
+
})
|
|
159
|
+
.strict();
|
|
160
|
+
const dagRunReportEntrySchema = z
|
|
161
|
+
.object({
|
|
162
|
+
runId: z.string().min(1),
|
|
163
|
+
title: z.string(),
|
|
164
|
+
lifecycle: dagRunLifecycleSchema,
|
|
165
|
+
status: dagRunStatusSchema,
|
|
166
|
+
runDir: z.string().min(1),
|
|
167
|
+
startedAt: z.string().min(1),
|
|
168
|
+
finishedAt: z.string().optional(),
|
|
169
|
+
failureCategory: z.string().optional(),
|
|
170
|
+
normalizedFailureCategory: dagNormalizedFailureCategorySchema.optional(),
|
|
171
|
+
productLineFailureCategory: dagProductLineFailureCategorySchema.optional(),
|
|
172
|
+
recommendedFollowUp: z.string().optional(),
|
|
173
|
+
recommendedFollowUpCategory: z
|
|
174
|
+
.enum(["repair", "revision", "retry", "restart", "diagnosis"])
|
|
175
|
+
.optional(),
|
|
176
|
+
recommendedFollowUpReason: z.string().optional(),
|
|
177
|
+
recoveryRecommendation: dagRecoveryRecommendationSchema.optional(),
|
|
178
|
+
primaryFailure: dagReportPrimaryFailureSchema,
|
|
179
|
+
primaryRecovery: dagRecoveryRecommendationSchema,
|
|
180
|
+
downstreamSkippedNodes: z.array(dagReportDownstreamSkippedNodeSchema),
|
|
181
|
+
convergence: dagConvergenceReportSchema.optional(),
|
|
182
|
+
pausedByNodeId: z.string().optional(),
|
|
183
|
+
pauseReason: z.string().optional(),
|
|
184
|
+
controllerIdentity: z
|
|
185
|
+
.object({
|
|
186
|
+
status: z.enum(["pinned", "legacy-unpinned"]),
|
|
187
|
+
capturedAt: z.string().min(1),
|
|
188
|
+
packageName: z.string().optional(),
|
|
189
|
+
packageVersion: z.string().optional(),
|
|
190
|
+
packageFingerprint: z.string().optional(),
|
|
191
|
+
binarySha256: z.string().optional(),
|
|
192
|
+
runtimeContractCompatibility: z.enum([
|
|
193
|
+
"compatible",
|
|
194
|
+
"incompatible",
|
|
195
|
+
"legacy-unspecified",
|
|
196
|
+
]),
|
|
197
|
+
runtimeContractReason: z.string().optional(),
|
|
198
|
+
})
|
|
199
|
+
.optional(),
|
|
200
|
+
evaluationAssociation: z.discriminatedUnion("status", [
|
|
201
|
+
z.object({ status: z.literal("absent-legacy") }).strict(),
|
|
202
|
+
z
|
|
203
|
+
.object({
|
|
204
|
+
status: z.literal("present"),
|
|
205
|
+
campaignId: z.string().min(1),
|
|
206
|
+
candidateId: z.string().min(1),
|
|
207
|
+
bundleHash: z.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
208
|
+
seed: z.number().int().nonnegative(),
|
|
209
|
+
split: z.enum(["public", "private", "held_out"]).optional(),
|
|
210
|
+
taskRef: z.string().min(1).optional(),
|
|
211
|
+
})
|
|
212
|
+
.strict(),
|
|
213
|
+
]),
|
|
214
|
+
executorJsonl: dagArtifactRefSchema,
|
|
215
|
+
nodes: z.array(dagNodeReportRowSchema),
|
|
216
|
+
})
|
|
217
|
+
.strict();
|
|
218
|
+
export const dagReportJsonSchema = z
|
|
219
|
+
.object({
|
|
220
|
+
schemaVersion: z.literal(DAG_REPORT_SCHEMA_VERSION),
|
|
221
|
+
runs: z.array(dagRunReportEntrySchema),
|
|
222
|
+
})
|
|
223
|
+
.strict();
|
|
224
|
+
export function serializeDagReportJson(report) {
|
|
225
|
+
return {
|
|
226
|
+
schemaVersion: DAG_REPORT_SCHEMA_VERSION,
|
|
227
|
+
runs: report.runs,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
export function validateDagReportJson(value) {
|
|
231
|
+
const parsed = dagReportJsonSchema.safeParse(value);
|
|
232
|
+
if (parsed.success) {
|
|
233
|
+
return { ok: true, report: parsed.data };
|
|
234
|
+
}
|
|
235
|
+
return {
|
|
236
|
+
ok: false,
|
|
237
|
+
errors: parsed.error.issues.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`),
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
export const DAG_REPORT_LIFECYCLE_ORDER = [
|
|
241
|
+
"active",
|
|
242
|
+
"paused",
|
|
243
|
+
"completed",
|
|
244
|
+
];
|
|
245
|
+
export const DAG_PAUSED_LATEST_REPORT_PRESET = {
|
|
246
|
+
lifecycle: "paused",
|
|
247
|
+
latest: true,
|
|
248
|
+
};
|
|
249
|
+
export { DAG_RECOVERY_ACTIONS };
|
|
250
|
+
export async function probeArtifact(filePath) {
|
|
251
|
+
try {
|
|
252
|
+
await access(filePath);
|
|
253
|
+
return { path: filePath, exists: true };
|
|
254
|
+
}
|
|
255
|
+
catch {
|
|
256
|
+
return { path: filePath, exists: false };
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
export async function buildNodeArtifactsReport(runDir, nodeId) {
|
|
260
|
+
const nodeDir = path.join(runDir, nodeId);
|
|
261
|
+
const artifact = (name) => probeArtifact(path.join(nodeDir, name));
|
|
262
|
+
return {
|
|
263
|
+
resultSummary: await artifact("result.summary.md"),
|
|
264
|
+
promptRedacted: await artifact("prompt.redacted.md"),
|
|
265
|
+
skills: await artifact("skills.json"),
|
|
266
|
+
nodeRecord: await probeArtifact(path.join(runDir, `${nodeId}.json`)),
|
|
267
|
+
decisionEnvelope: await artifact("decision.envelope.json"),
|
|
268
|
+
decisionEnvelopeValidation: await artifact("decision.envelope.validation.json"),
|
|
269
|
+
humanEscalationJson: await artifact("human-escalation.json"),
|
|
270
|
+
humanEscalationMd: await artifact("human-escalation.md"),
|
|
271
|
+
humanApproval: await artifact("human-approval.json"),
|
|
272
|
+
humanRejection: await artifact("human-rejection.json"),
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function taskById(spec) {
|
|
276
|
+
return new Map(spec.tasks.map((task) => [task.id, task]));
|
|
277
|
+
}
|
|
278
|
+
function isFailedRunStatus(status) {
|
|
279
|
+
return status === "failed" || status === "partial_failed";
|
|
280
|
+
}
|
|
281
|
+
function isActionableNodeForRecovery(node) {
|
|
282
|
+
return (node.status === "ERROR" ||
|
|
283
|
+
node.status === "SKIPPED" ||
|
|
284
|
+
(node.failureCategory !== undefined && node.failureCategory !== "success"));
|
|
285
|
+
}
|
|
286
|
+
function findPrimaryActionableNodeForRecovery(nodes) {
|
|
287
|
+
return (nodes.find((node) => node.status === "ERROR") ??
|
|
288
|
+
nodes.find(isActionableNodeForRecovery));
|
|
289
|
+
}
|
|
290
|
+
function resolvePrimaryFailureNode(run) {
|
|
291
|
+
if (run.pausedByNodeId) {
|
|
292
|
+
return run.nodes.find((node) => node.nodeId === run.pausedByNodeId);
|
|
293
|
+
}
|
|
294
|
+
if (isFailedRunStatus(run.status)) {
|
|
295
|
+
return findPrimaryActionableNodeForRecovery(run.nodes);
|
|
296
|
+
}
|
|
297
|
+
return undefined;
|
|
298
|
+
}
|
|
299
|
+
function buildPrimaryFailure(run, primaryNode) {
|
|
300
|
+
if (primaryNode) {
|
|
301
|
+
return {
|
|
302
|
+
scope: "node",
|
|
303
|
+
nodeId: primaryNode.nodeId,
|
|
304
|
+
nodeStatus: primaryNode.status,
|
|
305
|
+
failureCategory: primaryNode.failureCategory,
|
|
306
|
+
normalizedFailureCategory: primaryNode.normalizedFailureCategory,
|
|
307
|
+
productLineFailureCategory: primaryNode.productLineFailureCategory,
|
|
308
|
+
recommendedFollowUp: primaryNode.recommendedFollowUp,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
return {
|
|
312
|
+
scope: "run",
|
|
313
|
+
failureCategory: run.failureCategory,
|
|
314
|
+
normalizedFailureCategory: run.normalizedFailureCategory,
|
|
315
|
+
...routeDagFailure({
|
|
316
|
+
rawFailureCategory: run.failureCategory,
|
|
317
|
+
normalizedFailureCategory: run.normalizedFailureCategory,
|
|
318
|
+
}),
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
function resolvePrimaryRecovery(run, primaryNode) {
|
|
322
|
+
if (run.recoveryRecommendation) {
|
|
323
|
+
return run.recoveryRecommendation;
|
|
324
|
+
}
|
|
325
|
+
if (primaryNode?.recoveryRecommendation) {
|
|
326
|
+
return primaryNode.recoveryRecommendation;
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
action: "none",
|
|
330
|
+
summary: "No recovery needed.",
|
|
331
|
+
reason: `${run.runId} finished without a derived recovery recommendation.`,
|
|
332
|
+
humanRequired: false,
|
|
333
|
+
autoRetryEligible: false,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
function summarizeControllerIdentityForReport(ref, spec) {
|
|
337
|
+
if (!ref)
|
|
338
|
+
return {};
|
|
339
|
+
const compatibility = spec.runtimeContract
|
|
340
|
+
? checkRuntimeContractCompatible(spec.runtimeContract, {
|
|
341
|
+
...DAG_CONTROLLER_CAPABILITIES,
|
|
342
|
+
...(ref.packageVersion
|
|
343
|
+
? { controllerVersion: ref.packageVersion }
|
|
344
|
+
: {}),
|
|
345
|
+
})
|
|
346
|
+
: { ok: true };
|
|
347
|
+
return {
|
|
348
|
+
controllerIdentity: {
|
|
349
|
+
status: ref.status,
|
|
350
|
+
capturedAt: ref.capturedAt,
|
|
351
|
+
...(ref.packageName ? { packageName: ref.packageName } : {}),
|
|
352
|
+
...(ref.packageVersion ? { packageVersion: ref.packageVersion } : {}),
|
|
353
|
+
...(ref.packageFingerprint
|
|
354
|
+
? { packageFingerprint: ref.packageFingerprint }
|
|
355
|
+
: {}),
|
|
356
|
+
...(ref.binarySha256 ? { binarySha256: ref.binarySha256 } : {}),
|
|
357
|
+
runtimeContractCompatibility: spec.runtimeContract
|
|
358
|
+
? compatibility.ok
|
|
359
|
+
? "compatible"
|
|
360
|
+
: "incompatible"
|
|
361
|
+
: "legacy-unspecified",
|
|
362
|
+
...(!compatibility.ok
|
|
363
|
+
? { runtimeContractReason: compatibility.reason }
|
|
364
|
+
: {}),
|
|
365
|
+
},
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
function collectTransitiveDescendantNodeIds(spec, rootNodeId) {
|
|
369
|
+
const childrenByParent = new Map();
|
|
370
|
+
for (const task of spec.tasks) {
|
|
371
|
+
for (const parent of task.depends_on) {
|
|
372
|
+
const children = childrenByParent.get(parent) ?? [];
|
|
373
|
+
children.push(task.id);
|
|
374
|
+
childrenByParent.set(parent, children);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
const descendants = new Set();
|
|
378
|
+
const queue = [...(childrenByParent.get(rootNodeId) ?? [])];
|
|
379
|
+
while (queue.length > 0) {
|
|
380
|
+
const nodeId = queue.shift();
|
|
381
|
+
if (descendants.has(nodeId))
|
|
382
|
+
continue;
|
|
383
|
+
descendants.add(nodeId);
|
|
384
|
+
queue.push(...(childrenByParent.get(nodeId) ?? []));
|
|
385
|
+
}
|
|
386
|
+
return descendants;
|
|
387
|
+
}
|
|
388
|
+
function collectDownstreamSkippedNodes(nodes, spec, primaryNode) {
|
|
389
|
+
const skippedNodes = nodes.filter((node) => node.status === "SKIPPED");
|
|
390
|
+
const downstream = primaryNode
|
|
391
|
+
? skippedNodes.filter((node) => collectTransitiveDescendantNodeIds(spec, primaryNode.nodeId).has(node.nodeId))
|
|
392
|
+
: skippedNodes;
|
|
393
|
+
return downstream.map((node) => ({
|
|
394
|
+
nodeId: node.nodeId,
|
|
395
|
+
failureCategory: node.failureCategory,
|
|
396
|
+
normalizedFailureCategory: node.normalizedFailureCategory,
|
|
397
|
+
productLineFailureCategory: node.productLineFailureCategory,
|
|
398
|
+
recommendedFollowUp: node.recommendedFollowUp,
|
|
399
|
+
}));
|
|
400
|
+
}
|
|
401
|
+
function isFailedReportRun(run) {
|
|
402
|
+
return (run.status === "failed" ||
|
|
403
|
+
run.status === "partial_failed" ||
|
|
404
|
+
run.status === "paused" ||
|
|
405
|
+
(run.primaryRecovery.action !== "none" &&
|
|
406
|
+
run.primaryRecovery.action !== "monitor"));
|
|
407
|
+
}
|
|
408
|
+
export function filterDagReportRuns(runs, options) {
|
|
409
|
+
let filtered = runs;
|
|
410
|
+
if (options.failedOnly) {
|
|
411
|
+
filtered = filtered.filter(isFailedReportRun);
|
|
412
|
+
}
|
|
413
|
+
if (options.action) {
|
|
414
|
+
filtered = filtered.filter((run) => run.primaryRecovery.action === options.action);
|
|
415
|
+
}
|
|
416
|
+
if (options.latest && filtered.length > 0) {
|
|
417
|
+
const latest = [...filtered].sort((left, right) => {
|
|
418
|
+
const startedCompare = left.startedAt.localeCompare(right.startedAt);
|
|
419
|
+
if (startedCompare !== 0)
|
|
420
|
+
return startedCompare;
|
|
421
|
+
return left.runId.localeCompare(right.runId);
|
|
422
|
+
});
|
|
423
|
+
return [latest[latest.length - 1]];
|
|
424
|
+
}
|
|
425
|
+
return filtered;
|
|
426
|
+
}
|
|
427
|
+
export async function buildDagRunReportEntry(input) {
|
|
428
|
+
const tasks = taskById(input.spec);
|
|
429
|
+
const nodes = [];
|
|
430
|
+
for (let rank = 0; rank < input.state.ranks.length; rank += 1) {
|
|
431
|
+
const rankNodes = input.state.ranks[rank] ?? [];
|
|
432
|
+
for (let order = 0; order < rankNodes.length; order += 1) {
|
|
433
|
+
const nodeId = rankNodes[order];
|
|
434
|
+
const node = input.state.nodes[nodeId];
|
|
435
|
+
if (!node)
|
|
436
|
+
continue;
|
|
437
|
+
const task = tasks.get(nodeId);
|
|
438
|
+
const normalizedFailureCategory = normalizeDagFailureCategory(node.failureCategory, node.status);
|
|
439
|
+
const failureRouting = routeDagFailure({
|
|
440
|
+
rawFailureCategory: node.failureCategory,
|
|
441
|
+
normalizedFailureCategory,
|
|
442
|
+
nodeId,
|
|
443
|
+
executor: node.executor,
|
|
444
|
+
skippedReason: node.skippedReason,
|
|
445
|
+
});
|
|
446
|
+
const followUp = node.status === "ERROR" || node.status === "SKIPPED"
|
|
447
|
+
? recommendFollowUpForFailureCategory(node.failureCategory)
|
|
448
|
+
: undefined;
|
|
449
|
+
nodes.push({
|
|
450
|
+
nodeId,
|
|
451
|
+
rank,
|
|
452
|
+
order,
|
|
453
|
+
executor: node.executor,
|
|
454
|
+
model: task
|
|
455
|
+
? resolveModelForTask(task, input.spec.executorModels)
|
|
456
|
+
: undefined,
|
|
457
|
+
status: node.status,
|
|
458
|
+
durationMs: node.durationMs,
|
|
459
|
+
tokensUsed: node.tokensUsed,
|
|
460
|
+
failureCategory: node.failureCategory,
|
|
461
|
+
normalizedFailureCategory,
|
|
462
|
+
...failureRouting,
|
|
463
|
+
...(followUp
|
|
464
|
+
? {
|
|
465
|
+
recommendedFollowUpCategory: followUp.nextStepCategory,
|
|
466
|
+
recommendedFollowUpReason: followUp.reason,
|
|
467
|
+
}
|
|
468
|
+
: {}),
|
|
469
|
+
recoveryRecommendation: planDagRecovery({
|
|
470
|
+
status: node.status,
|
|
471
|
+
normalizedFailureCategory,
|
|
472
|
+
failureCategory: node.failureCategory,
|
|
473
|
+
nodeId,
|
|
474
|
+
runId: input.state.runId,
|
|
475
|
+
lifecycle: input.lifecycle,
|
|
476
|
+
runStatus: input.state.status,
|
|
477
|
+
}),
|
|
478
|
+
backend: node.backend,
|
|
479
|
+
sdkAttempted: node.sdkAttempted,
|
|
480
|
+
startedAt: node.startedAt,
|
|
481
|
+
finishedAt: node.finishedAt,
|
|
482
|
+
decisionEnvelope: node.decisionEnvelope,
|
|
483
|
+
artifacts: await buildNodeArtifactsReport(input.runDir, nodeId),
|
|
484
|
+
...(node.structuredArtifactPath
|
|
485
|
+
? { structuredArtifactPath: node.structuredArtifactPath }
|
|
486
|
+
: {}),
|
|
487
|
+
...(node.structuredArtifactSha256
|
|
488
|
+
? { structuredArtifactSha256: node.structuredArtifactSha256 }
|
|
489
|
+
: {}),
|
|
490
|
+
...(node.structuredArtifactSchemaId
|
|
491
|
+
? { structuredArtifactSchemaId: node.structuredArtifactSchemaId }
|
|
492
|
+
: {}),
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
const normalizedFailureCategory = normalizeDagFailureCategory(input.state.failureCategory, input.state.status);
|
|
497
|
+
const pausedNode = input.state.pausedByNodeId
|
|
498
|
+
? input.state.nodes[input.state.pausedByNodeId]
|
|
499
|
+
: undefined;
|
|
500
|
+
const firstActionableNode = isFailedRunStatus(input.state.status)
|
|
501
|
+
? findPrimaryActionableNodeForRecovery(nodes)
|
|
502
|
+
: undefined;
|
|
503
|
+
const runRecoverySource = pausedNode
|
|
504
|
+
? {
|
|
505
|
+
status: input.state.status,
|
|
506
|
+
normalizedFailureCategory: normalizeDagFailureCategory(pausedNode.failureCategory, pausedNode.status),
|
|
507
|
+
failureCategory: pausedNode.failureCategory,
|
|
508
|
+
nodeId: input.state.pausedByNodeId,
|
|
509
|
+
skippedReason: pausedNode.skippedReason,
|
|
510
|
+
}
|
|
511
|
+
: firstActionableNode
|
|
512
|
+
? {
|
|
513
|
+
status: firstActionableNode.status,
|
|
514
|
+
normalizedFailureCategory: firstActionableNode.normalizedFailureCategory ??
|
|
515
|
+
normalizeDagFailureCategory(firstActionableNode.failureCategory, firstActionableNode.status),
|
|
516
|
+
failureCategory: firstActionableNode.failureCategory,
|
|
517
|
+
nodeId: firstActionableNode.nodeId,
|
|
518
|
+
skippedReason: input.state.nodes[firstActionableNode.nodeId]?.skippedReason,
|
|
519
|
+
}
|
|
520
|
+
: {
|
|
521
|
+
status: input.state.status,
|
|
522
|
+
normalizedFailureCategory,
|
|
523
|
+
failureCategory: input.state.failureCategory,
|
|
524
|
+
};
|
|
525
|
+
const recoveryRecommendation = planDagRecovery({
|
|
526
|
+
...runRecoverySource,
|
|
527
|
+
runId: input.state.runId,
|
|
528
|
+
lifecycle: input.lifecycle,
|
|
529
|
+
runStatus: input.state.status,
|
|
530
|
+
});
|
|
531
|
+
const runFailureRouting = routeDagFailure({
|
|
532
|
+
rawFailureCategory: runRecoverySource.failureCategory,
|
|
533
|
+
normalizedFailureCategory: runRecoverySource.normalizedFailureCategory,
|
|
534
|
+
nodeId: "nodeId" in runRecoverySource ? runRecoverySource.nodeId : undefined,
|
|
535
|
+
skippedReason: "skippedReason" in runRecoverySource
|
|
536
|
+
? runRecoverySource.skippedReason
|
|
537
|
+
: undefined,
|
|
538
|
+
});
|
|
539
|
+
const runFollowUp = input.state.status === "failed" ||
|
|
540
|
+
input.state.status === "partial_failed"
|
|
541
|
+
? recommendFollowUpForFailureCategory(input.state.failureCategory)
|
|
542
|
+
: undefined;
|
|
543
|
+
const partialEntry = {
|
|
544
|
+
runId: input.state.runId,
|
|
545
|
+
title: input.state.title,
|
|
546
|
+
lifecycle: input.lifecycle,
|
|
547
|
+
status: input.state.status,
|
|
548
|
+
runDir: input.runDir,
|
|
549
|
+
startedAt: input.state.startedAt,
|
|
550
|
+
finishedAt: input.state.finishedAt,
|
|
551
|
+
failureCategory: input.state.failureCategory,
|
|
552
|
+
normalizedFailureCategory,
|
|
553
|
+
...runFailureRouting,
|
|
554
|
+
...(runFollowUp
|
|
555
|
+
? {
|
|
556
|
+
recommendedFollowUpCategory: runFollowUp.nextStepCategory,
|
|
557
|
+
recommendedFollowUpReason: runFollowUp.reason,
|
|
558
|
+
}
|
|
559
|
+
: {}),
|
|
560
|
+
recoveryRecommendation,
|
|
561
|
+
pausedByNodeId: input.state.pausedByNodeId,
|
|
562
|
+
pauseReason: input.state.pauseReason,
|
|
563
|
+
...summarizeControllerIdentityForReport(input.state.controllerIdentityRef, input.spec),
|
|
564
|
+
evaluationAssociation: input.state.evaluation
|
|
565
|
+
? { status: "present", ...input.state.evaluation }
|
|
566
|
+
: { status: "absent-legacy" },
|
|
567
|
+
nodes,
|
|
568
|
+
};
|
|
569
|
+
const primaryNode = resolvePrimaryFailureNode(partialEntry);
|
|
570
|
+
return {
|
|
571
|
+
...partialEntry,
|
|
572
|
+
primaryFailure: buildPrimaryFailure(partialEntry, primaryNode),
|
|
573
|
+
primaryRecovery: resolvePrimaryRecovery(partialEntry, primaryNode),
|
|
574
|
+
downstreamSkippedNodes: collectDownstreamSkippedNodes(nodes, input.spec, primaryNode),
|
|
575
|
+
convergence: input.state.convergence,
|
|
576
|
+
executorJsonl: await probeArtifact(path.join(input.runDir, "executor.jsonl")),
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
async function readDagRunSpecForReport(runDir) {
|
|
580
|
+
try {
|
|
581
|
+
return await readDagRunSpec(runDir);
|
|
582
|
+
}
|
|
583
|
+
catch (err) {
|
|
584
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
585
|
+
if (!message.includes(LEGACY_TOP_LEVEL_MODELS_ERROR)) {
|
|
586
|
+
throw err;
|
|
587
|
+
}
|
|
588
|
+
const raw = JSON.parse(await readFile(path.join(runDir, "run.json"), "utf-8"));
|
|
589
|
+
delete raw.models;
|
|
590
|
+
return parseDagSpec(raw);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
async function readLocatedRun(located) {
|
|
594
|
+
const [state, spec] = await Promise.all([
|
|
595
|
+
readDagRunState(located.runDir),
|
|
596
|
+
readDagRunSpecForReport(located.runDir),
|
|
597
|
+
]);
|
|
598
|
+
return buildDagRunReportEntry({
|
|
599
|
+
runDir: located.runDir,
|
|
600
|
+
lifecycle: located.lifecycle,
|
|
601
|
+
state,
|
|
602
|
+
spec,
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
async function listRunsInLifecycle(repoRoot, lifecycle) {
|
|
606
|
+
const lifecycleDir = getDagRunDir(repoRoot, lifecycle, "");
|
|
607
|
+
try {
|
|
608
|
+
await access(lifecycleDir);
|
|
609
|
+
}
|
|
610
|
+
catch {
|
|
611
|
+
return [];
|
|
612
|
+
}
|
|
613
|
+
const entries = await readdir(lifecycleDir, { withFileTypes: true });
|
|
614
|
+
const located = [];
|
|
615
|
+
for (const entry of entries) {
|
|
616
|
+
if (!entry.isDirectory())
|
|
617
|
+
continue;
|
|
618
|
+
const runDir = path.join(lifecycleDir, entry.name);
|
|
619
|
+
const statePath = path.join(runDir, "state.json");
|
|
620
|
+
try {
|
|
621
|
+
await access(statePath);
|
|
622
|
+
}
|
|
623
|
+
catch {
|
|
624
|
+
continue;
|
|
625
|
+
}
|
|
626
|
+
located.push({
|
|
627
|
+
lifecycle,
|
|
628
|
+
runDir,
|
|
629
|
+
runId: entry.name,
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
return located;
|
|
633
|
+
}
|
|
634
|
+
async function sortLocatedRuns(located) {
|
|
635
|
+
const withStartedAt = await Promise.all(located.map(async (entry) => {
|
|
636
|
+
try {
|
|
637
|
+
const state = await readDagRunState(entry.runDir);
|
|
638
|
+
return { entry, startedAt: state.startedAt };
|
|
639
|
+
}
|
|
640
|
+
catch {
|
|
641
|
+
return { entry, startedAt: "" };
|
|
642
|
+
}
|
|
643
|
+
}));
|
|
644
|
+
return withStartedAt
|
|
645
|
+
.sort((left, right) => {
|
|
646
|
+
const startedCompare = left.startedAt.localeCompare(right.startedAt);
|
|
647
|
+
if (startedCompare !== 0)
|
|
648
|
+
return startedCompare;
|
|
649
|
+
return left.entry.runId.localeCompare(right.entry.runId);
|
|
650
|
+
})
|
|
651
|
+
.map((item) => item.entry);
|
|
652
|
+
}
|
|
653
|
+
export async function listLocatedDagRuns(repoRoot, filter = "all") {
|
|
654
|
+
const lifecycles = filter === "all" ? DAG_REPORT_LIFECYCLE_ORDER : [filter];
|
|
655
|
+
const located = [];
|
|
656
|
+
for (const lifecycle of lifecycles) {
|
|
657
|
+
const runs = await listRunsInLifecycle(repoRoot, lifecycle);
|
|
658
|
+
located.push(...(await sortLocatedRuns(runs)));
|
|
659
|
+
}
|
|
660
|
+
return located;
|
|
661
|
+
}
|
|
662
|
+
async function locateRunForReport(repoRoot, runId, filter) {
|
|
663
|
+
if (filter === "all") {
|
|
664
|
+
const located = await locateDagRun(repoRoot, runId);
|
|
665
|
+
if (!located) {
|
|
666
|
+
throw new Error(`dag run not found: ${runId}`);
|
|
667
|
+
}
|
|
668
|
+
if (!isDagExecutionLifecycle(located.lifecycle)) {
|
|
669
|
+
throw new Error(`dag run not found: ${runId}`);
|
|
670
|
+
}
|
|
671
|
+
return {
|
|
672
|
+
lifecycle: located.lifecycle,
|
|
673
|
+
runDir: located.runDir,
|
|
674
|
+
runId,
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
const runDir = getDagRunDir(repoRoot, filter, runId);
|
|
678
|
+
if (!(await dagRunDirExists(runDir))) {
|
|
679
|
+
throw new Error(`dag run not found: ${runId}`);
|
|
680
|
+
}
|
|
681
|
+
return { lifecycle: filter, runDir, runId };
|
|
682
|
+
}
|
|
683
|
+
export async function buildDagReport(options) {
|
|
684
|
+
const filter = options.lifecycle ?? "all";
|
|
685
|
+
const located = options.runId
|
|
686
|
+
? [await locateRunForReport(options.repoRoot, options.runId, filter)]
|
|
687
|
+
: await listLocatedDagRuns(options.repoRoot, filter);
|
|
688
|
+
const runs = await Promise.all(located.map((entry) => readLocatedRun(entry)));
|
|
689
|
+
return {
|
|
690
|
+
runs: filterDagReportRuns(runs, {
|
|
691
|
+
failedOnly: options.failedOnly,
|
|
692
|
+
latest: options.latest,
|
|
693
|
+
action: options.action,
|
|
694
|
+
}),
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
function formatDuration(durationMs) {
|
|
698
|
+
if (durationMs === undefined)
|
|
699
|
+
return "-";
|
|
700
|
+
if (durationMs < 1000)
|
|
701
|
+
return `${durationMs}ms`;
|
|
702
|
+
return `${(durationMs / 1000).toFixed(1)}s`;
|
|
703
|
+
}
|
|
704
|
+
function formatTokens(tokensUsed) {
|
|
705
|
+
return tokensUsed === undefined ? "-" : String(tokensUsed);
|
|
706
|
+
}
|
|
707
|
+
function formatArtifactFlags(artifacts) {
|
|
708
|
+
const flags = [];
|
|
709
|
+
if (artifacts.resultSummary.exists)
|
|
710
|
+
flags.push("summary");
|
|
711
|
+
if (artifacts.promptRedacted.exists)
|
|
712
|
+
flags.push("prompt");
|
|
713
|
+
if (artifacts.skills.exists)
|
|
714
|
+
flags.push("skills");
|
|
715
|
+
if (artifacts.nodeRecord.exists)
|
|
716
|
+
flags.push("node-json");
|
|
717
|
+
if (artifacts.decisionEnvelope.exists)
|
|
718
|
+
flags.push("decision");
|
|
719
|
+
if (artifacts.decisionEnvelopeValidation.exists)
|
|
720
|
+
flags.push("decision-validation");
|
|
721
|
+
if (artifacts.humanEscalationJson.exists)
|
|
722
|
+
flags.push("escalation-json");
|
|
723
|
+
if (artifacts.humanEscalationMd.exists)
|
|
724
|
+
flags.push("escalation-md");
|
|
725
|
+
if (artifacts.humanApproval.exists)
|
|
726
|
+
flags.push("approval");
|
|
727
|
+
if (artifacts.humanRejection.exists)
|
|
728
|
+
flags.push("rejection");
|
|
729
|
+
return flags.length > 0 ? flags.join(",") : "-";
|
|
730
|
+
}
|
|
731
|
+
function formatTimestamp(value) {
|
|
732
|
+
return value ?? "—";
|
|
733
|
+
}
|
|
734
|
+
function formatRunDuration(startedAt, finishedAt) {
|
|
735
|
+
if (!finishedAt)
|
|
736
|
+
return "—";
|
|
737
|
+
const started = Date.parse(startedAt);
|
|
738
|
+
const finished = Date.parse(finishedAt);
|
|
739
|
+
if (!Number.isFinite(started) || !Number.isFinite(finished))
|
|
740
|
+
return "—";
|
|
741
|
+
return formatDuration(Math.max(0, finished - started));
|
|
742
|
+
}
|
|
743
|
+
function summarizeNodeStatuses(nodes) {
|
|
744
|
+
const total = nodes.length;
|
|
745
|
+
const finished = nodes.filter((node) => node.status === "FINISHED").length;
|
|
746
|
+
const failed = nodes.filter((node) => node.status === "ERROR").length;
|
|
747
|
+
const skipped = nodes.filter((node) => node.status === "SKIPPED").length;
|
|
748
|
+
const pending = nodes.filter((node) => node.status === "PENDING").length;
|
|
749
|
+
return `${total} total / ${finished} finished / ${failed} failed / ${skipped} skipped / ${pending} pending`;
|
|
750
|
+
}
|
|
751
|
+
function hasArtifact(artifacts) {
|
|
752
|
+
return Object.values(artifacts).some((artifact) => artifact.exists);
|
|
753
|
+
}
|
|
754
|
+
function failureRows(run) {
|
|
755
|
+
return run.nodes.filter((node) => node.status === "ERROR" ||
|
|
756
|
+
(node.failureCategory !== undefined &&
|
|
757
|
+
node.failureCategory !== "success"));
|
|
758
|
+
}
|
|
759
|
+
function formatFailureCategoryLabel(node) {
|
|
760
|
+
const raw = node.failureCategory ?? node.status;
|
|
761
|
+
const normalized = node.normalizedFailureCategory;
|
|
762
|
+
if (normalized && normalized !== raw) {
|
|
763
|
+
return `${raw} (normalized: ${normalized})`;
|
|
764
|
+
}
|
|
765
|
+
return String(raw);
|
|
766
|
+
}
|
|
767
|
+
function primaryRecoveryRecommendation(run) {
|
|
768
|
+
return run.primaryRecovery;
|
|
769
|
+
}
|
|
770
|
+
function suggestedNextAction(run) {
|
|
771
|
+
const humanNodes = run.nodes.filter((node) => node.decisionEnvelope?.requiresHuman === true);
|
|
772
|
+
const humanSuffix = humanNodes.length > 0
|
|
773
|
+
? ` Human escalation detected for ${humanNodes.map((node) => node.nodeId).join(", ")}.`
|
|
774
|
+
: "";
|
|
775
|
+
const recommendation = primaryRecoveryRecommendation(run);
|
|
776
|
+
if (recommendation.action !== "none") {
|
|
777
|
+
const pausedHint = run.status === "paused" && run.pausedByNodeId
|
|
778
|
+
? ` Paused at node ${run.pausedByNodeId}.`
|
|
779
|
+
: "";
|
|
780
|
+
const failedHint = run.primaryFailure.scope === "node" && run.primaryFailure.nodeId
|
|
781
|
+
? ` Primary node: ${run.primaryFailure.nodeId}.`
|
|
782
|
+
: "";
|
|
783
|
+
return `${recommendation.summary} [${recommendation.action}]${pausedHint}${failedHint}${humanSuffix}`;
|
|
784
|
+
}
|
|
785
|
+
return `Run complete. Review result summaries.${humanSuffix}`;
|
|
786
|
+
}
|
|
787
|
+
function formatPrimaryFailureSection(run) {
|
|
788
|
+
const failure = run.primaryFailure;
|
|
789
|
+
if (failure.scope === "node" && failure.nodeId) {
|
|
790
|
+
return [
|
|
791
|
+
`- **Node**: ${failure.nodeId} (${failure.nodeStatus ?? "unknown"})`,
|
|
792
|
+
`- **Category (raw/normalized)**: ${failure.failureCategory ?? "-"} / ${failure.normalizedFailureCategory ?? "-"}`,
|
|
793
|
+
`- **Product-line category**: ${failure.productLineFailureCategory ?? "-"}`,
|
|
794
|
+
`- **Recommended follow-up**: ${failure.recommendedFollowUp ?? "-"}`,
|
|
795
|
+
];
|
|
796
|
+
}
|
|
797
|
+
return [
|
|
798
|
+
`- **Scope**: run`,
|
|
799
|
+
`- **Category (raw/normalized)**: ${failure.failureCategory ?? "-"} / ${failure.normalizedFailureCategory ?? "-"}`,
|
|
800
|
+
`- **Product-line category**: ${failure.productLineFailureCategory ?? "-"}`,
|
|
801
|
+
`- **Recommended follow-up**: ${failure.recommendedFollowUp ?? "-"}`,
|
|
802
|
+
];
|
|
803
|
+
}
|
|
804
|
+
function formatPrimaryRecoverySection(run) {
|
|
805
|
+
const rec = run.primaryRecovery;
|
|
806
|
+
return [
|
|
807
|
+
`- **Action**: \`${rec.action}\``,
|
|
808
|
+
`- **Summary**: ${rec.summary}`,
|
|
809
|
+
`- **Reason**: ${rec.reason}`,
|
|
810
|
+
`- **Human Required**: ${rec.humanRequired}`,
|
|
811
|
+
`- **Auto Retry Eligible**: ${rec.autoRetryEligible}`,
|
|
812
|
+
rec.commandHint ? `- **Command Hint**: ${rec.commandHint}` : undefined,
|
|
813
|
+
].filter((line) => line !== undefined);
|
|
814
|
+
}
|
|
815
|
+
function formatDownstreamSkippedSection(run) {
|
|
816
|
+
if (run.downstreamSkippedNodes.length === 0) {
|
|
817
|
+
return ["No blocked downstream or skipped nodes."];
|
|
818
|
+
}
|
|
819
|
+
return run.downstreamSkippedNodes.map((node) => `- **${node.nodeId}**: ${node.failureCategory ?? "-"} (normalized: ${node.normalizedFailureCategory ?? "-"})`);
|
|
820
|
+
}
|
|
821
|
+
function formatConvergenceSummary(run) {
|
|
822
|
+
if (!run.convergence)
|
|
823
|
+
return [];
|
|
824
|
+
const convergence = run.convergence;
|
|
825
|
+
const lines = [
|
|
826
|
+
`- convergence: enabled=${convergence.enabled}, pass=${convergence.currentPass}/${convergence.maxPasses}, terminal=${convergence.terminalReason ?? "-"}`,
|
|
827
|
+
];
|
|
828
|
+
for (const pass of convergence.passHistory) {
|
|
829
|
+
const verifySummary = pass.verifyPhase ||
|
|
830
|
+
pass.verifyQuota ||
|
|
831
|
+
pass.verifyCommandCount !== undefined
|
|
832
|
+
? `, verify=${pass.verifyPhase ?? "-"} quota=${pass.verifyQuota ?? "-"} commands=${pass.verifyCommandCount ?? "-"}`
|
|
833
|
+
: "";
|
|
834
|
+
lines.push(`- pass ${pass.pass}: ${pass.status}, reason=${pass.reason}, hardVerify=${pass.hardVerifyStatus ?? "-"}(${pass.hardVerifyFailureCategory ?? "-"})${verifySummary}, artifacts=${pass.artifactRefs.length}`);
|
|
835
|
+
}
|
|
836
|
+
return lines;
|
|
837
|
+
}
|
|
838
|
+
function formatRecommendedOperatorAction(run) {
|
|
839
|
+
const rec = run.primaryRecovery;
|
|
840
|
+
if (rec.action === "none" || rec.action === "monitor") {
|
|
841
|
+
return [
|
|
842
|
+
"No operator recovery action required; review run artifacts as needed.",
|
|
843
|
+
];
|
|
844
|
+
}
|
|
845
|
+
const lines = [`${rec.summary} [${rec.action}]`];
|
|
846
|
+
if (rec.commandHint) {
|
|
847
|
+
lines.push(`Hint: ${rec.commandHint}`);
|
|
848
|
+
}
|
|
849
|
+
if (rec.humanRequired) {
|
|
850
|
+
lines.push("Human input is required before proceeding.");
|
|
851
|
+
}
|
|
852
|
+
return lines.map((line) => `- ${line}`);
|
|
853
|
+
}
|
|
854
|
+
function formatRecoveryPlanSection(run) {
|
|
855
|
+
return [
|
|
856
|
+
"### Primary Failure",
|
|
857
|
+
...formatPrimaryFailureSection(run),
|
|
858
|
+
"",
|
|
859
|
+
"### Recovery Action",
|
|
860
|
+
...formatPrimaryRecoverySection(run),
|
|
861
|
+
"",
|
|
862
|
+
"### Blocked Downstream / Skipped Nodes",
|
|
863
|
+
...formatDownstreamSkippedSection(run),
|
|
864
|
+
"",
|
|
865
|
+
"### Recommended Operator Action",
|
|
866
|
+
...formatRecommendedOperatorAction(run),
|
|
867
|
+
];
|
|
868
|
+
}
|
|
869
|
+
export function formatDagReportMarkdown(report) {
|
|
870
|
+
if (report.runs.length === 0) {
|
|
871
|
+
return "No DAG runs matched the report filter.\n";
|
|
872
|
+
}
|
|
873
|
+
const sections = report.runs.map((run) => {
|
|
874
|
+
const header = [
|
|
875
|
+
`## ${run.runId}`,
|
|
876
|
+
"",
|
|
877
|
+
`- lifecycle: ${run.lifecycle}`,
|
|
878
|
+
`- status: ${run.status}`,
|
|
879
|
+
`- title: ${run.title}`,
|
|
880
|
+
`- runDir: ${run.runDir}`,
|
|
881
|
+
`- startedAt: ${run.startedAt}`,
|
|
882
|
+
`- finishedAt: ${run.finishedAt ?? "-"}`,
|
|
883
|
+
...(run.evaluationAssociation.status === "present"
|
|
884
|
+
? [
|
|
885
|
+
`- evaluationAssociation: present`,
|
|
886
|
+
`- campaignId: ${run.evaluationAssociation.campaignId}`,
|
|
887
|
+
`- candidateId: ${run.evaluationAssociation.candidateId}`,
|
|
888
|
+
`- bundleHash: ${run.evaluationAssociation.bundleHash}`,
|
|
889
|
+
`- seed: ${run.evaluationAssociation.seed}`,
|
|
890
|
+
...(run.evaluationAssociation.split
|
|
891
|
+
? [`- split: ${run.evaluationAssociation.split}`]
|
|
892
|
+
: []),
|
|
893
|
+
...(run.evaluationAssociation.taskRef
|
|
894
|
+
? [`- taskRef: ${run.evaluationAssociation.taskRef}`]
|
|
895
|
+
: []),
|
|
896
|
+
]
|
|
897
|
+
: ["- evaluationAssociation: absent/legacy"]),
|
|
898
|
+
`- executorJsonl: ${run.executorJsonl.path} (${run.executorJsonl.exists ? "exists" : "missing"})`,
|
|
899
|
+
...formatConvergenceSummary(run),
|
|
900
|
+
"",
|
|
901
|
+
"| rank | order | node | executor | model | status | duration | tokens | failure | normalized | action | backend | sdk | artifacts |",
|
|
902
|
+
"| ---: | ----: | --- | --- | --- | --- | --- | ---: | --- | --- | --- | --- | --- | --- |",
|
|
903
|
+
];
|
|
904
|
+
for (const node of run.nodes) {
|
|
905
|
+
header.push(`| ${node.rank} | ${node.order} | ${node.nodeId} | ${node.executor} | ${node.model ?? "-"} | ${node.status} | ${formatDuration(node.durationMs)} | ${formatTokens(node.tokensUsed)} | ${node.failureCategory ?? "-"} | ${node.normalizedFailureCategory ?? "-"} | ${node.recoveryRecommendation?.action ?? "-"} | ${node.backend ?? "-"} | ${node.sdkAttempted === undefined ? "-" : node.sdkAttempted ? "yes" : "no"} | ${formatArtifactFlags(node.artifacts)} |`);
|
|
906
|
+
}
|
|
907
|
+
header.push("");
|
|
908
|
+
return header.join("\n");
|
|
909
|
+
});
|
|
910
|
+
return ["# DAG Run Report", "", ...sections].join("\n");
|
|
911
|
+
}
|
|
912
|
+
function formatFailureSection(run) {
|
|
913
|
+
const failures = failureRows(run);
|
|
914
|
+
if (failures.length === 0)
|
|
915
|
+
return ["No failed nodes."];
|
|
916
|
+
return failures.map((node) => {
|
|
917
|
+
const decision = node.decisionEnvelope;
|
|
918
|
+
const decisionText = decision
|
|
919
|
+
? ` decision=${decision.decision ?? "-"}, risk=${decision.riskLevel ?? "-"}, requiresHuman=${decision.requiresHuman === undefined ? "-" : String(decision.requiresHuman)}`
|
|
920
|
+
: "";
|
|
921
|
+
return `- **${node.nodeId}**: ${formatFailureCategoryLabel(node)} (${formatDuration(node.durationMs)})${decisionText}`;
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
function formatArtifactsSection(run) {
|
|
925
|
+
const rows = run.nodes
|
|
926
|
+
.filter((node) => hasArtifact(node.artifacts))
|
|
927
|
+
.map((node) => `- **${node.nodeId}**: ${formatArtifactFlags(node.artifacts)}`);
|
|
928
|
+
return rows.length > 0 ? rows : ["No node artifacts found."];
|
|
929
|
+
}
|
|
930
|
+
export function formatDagReportHandoffMarkdown(report) {
|
|
931
|
+
if (report.runs.length === 0) {
|
|
932
|
+
return "# Agent DAG Handoff Report\n\nNo DAG runs matched the report filter.\n";
|
|
933
|
+
}
|
|
934
|
+
const sections = report.runs.map((run) => {
|
|
935
|
+
const lines = [
|
|
936
|
+
`# Agent DAG Handoff Report: ${run.runId}`,
|
|
937
|
+
"",
|
|
938
|
+
"## Summary",
|
|
939
|
+
`- **Title**: ${run.title}`,
|
|
940
|
+
`- **Run ID**: ${run.runId}`,
|
|
941
|
+
`- **Lifecycle**: ${run.lifecycle}`,
|
|
942
|
+
`- **Status**: ${run.status}`,
|
|
943
|
+
run.failureCategory
|
|
944
|
+
? `- **Failure (raw/normalized)**: ${run.failureCategory} / ${run.normalizedFailureCategory ?? "-"}`
|
|
945
|
+
: undefined,
|
|
946
|
+
`- **Started**: ${formatTimestamp(run.startedAt)}`,
|
|
947
|
+
`- **Finished**: ${formatTimestamp(run.finishedAt)}`,
|
|
948
|
+
`- **Duration**: ${formatRunDuration(run.startedAt, run.finishedAt)}`,
|
|
949
|
+
`- **Nodes**: ${summarizeNodeStatuses(run.nodes)}`,
|
|
950
|
+
`- **Run Dir**: ${run.runDir}`,
|
|
951
|
+
...formatConvergenceSummary(run),
|
|
952
|
+
"",
|
|
953
|
+
"## Node Timeline",
|
|
954
|
+
];
|
|
955
|
+
for (const node of run.nodes) {
|
|
956
|
+
lines.push(`### ${node.nodeId}`, `- **Rank/Order**: ${node.rank}/${node.order}`, `- **Status**: ${node.status}`, node.failureCategory
|
|
957
|
+
? `- **Failure (raw/normalized)**: ${node.failureCategory} / ${node.normalizedFailureCategory ?? "-"}`
|
|
958
|
+
: "", `- **Executor**: ${node.executor}${node.backend ? ` (backend: ${node.backend})` : ""}`, `- **Model**: ${node.model ?? "—"}`, `- **Duration**: ${formatDuration(node.durationMs)}`, `- **Tokens**: ${formatTokens(node.tokensUsed)}`, `- **Started**: ${formatTimestamp(node.startedAt)}`, `- **Finished**: ${formatTimestamp(node.finishedAt)}`, "");
|
|
959
|
+
}
|
|
960
|
+
lines.push("## Failures", ...formatFailureSection(run), "", "## Recovery Plan", ...formatRecoveryPlanSection(run), "", "## Operator Next Steps", ...formatRecommendedOperatorAction(run), "", "## Artifacts", ...formatArtifactsSection(run), "", "## Suggested Next Action", `- ${suggestedNextAction(run)}`, "");
|
|
961
|
+
return lines
|
|
962
|
+
.filter((line) => line !== undefined)
|
|
963
|
+
.join("\n");
|
|
964
|
+
});
|
|
965
|
+
return sections.join("\n---\n");
|
|
966
|
+
}
|
|
967
|
+
export function resolveCloseoutDraftOutputPath(repoRoot, outputPath) {
|
|
968
|
+
return resolveCliPath(outputPath, repoRoot);
|
|
969
|
+
}
|
|
970
|
+
export function defaultCloseoutDraftOutputPath(runId) {
|
|
971
|
+
return path.join(os.tmpdir(), `${runId}-closeout-draft.md`);
|
|
972
|
+
}
|
|
973
|
+
export function assertCloseoutDraftOutputPathAllowed(repoRoot, outputPath) {
|
|
974
|
+
const resolved = resolveCloseoutDraftOutputPath(repoRoot, outputPath);
|
|
975
|
+
const harnessRoot = path.resolve(repoRoot, ".harness");
|
|
976
|
+
const dagRunsRoot = path.resolve(repoRoot, ".harness", "dag-runs");
|
|
977
|
+
const underHarness = resolved === harnessRoot ||
|
|
978
|
+
resolved.startsWith(`${harnessRoot}${path.sep}`);
|
|
979
|
+
if (!underHarness) {
|
|
980
|
+
return;
|
|
981
|
+
}
|
|
982
|
+
const underDagRuns = resolved === dagRunsRoot ||
|
|
983
|
+
resolved.startsWith(`${dagRunsRoot}${path.sep}`);
|
|
984
|
+
if (underDagRuns) {
|
|
985
|
+
throw new Error(`closeout draft output must not target .harness/dag-runs: ${outputPath}`);
|
|
986
|
+
}
|
|
987
|
+
throw new Error(`closeout draft output must not target .harness: ${outputPath}`);
|
|
988
|
+
}
|
|
989
|
+
function formatCloseoutNodeStatusTable(run) {
|
|
990
|
+
const lines = [
|
|
991
|
+
"| rank | node | executor | status | failure | normalized | duration |",
|
|
992
|
+
"| ---: | --- | --- | --- | --- | --- | --- |",
|
|
993
|
+
];
|
|
994
|
+
for (const node of run.nodes) {
|
|
995
|
+
lines.push(`| ${node.rank} | ${node.nodeId} | ${node.executor} | ${node.status} | ${node.failureCategory ?? "-"} | ${node.normalizedFailureCategory ?? "-"} | ${formatDuration(node.durationMs)} |`);
|
|
996
|
+
}
|
|
997
|
+
return lines;
|
|
998
|
+
}
|
|
999
|
+
function formatCloseoutArtifactRefs(artifacts) {
|
|
1000
|
+
const refs = [];
|
|
1001
|
+
if (artifacts.resultSummary.exists)
|
|
1002
|
+
refs.push(`summary:${artifacts.resultSummary.path}`);
|
|
1003
|
+
if (artifacts.nodeRecord.exists)
|
|
1004
|
+
refs.push(`node-json:${artifacts.nodeRecord.path}`);
|
|
1005
|
+
if (artifacts.decisionEnvelope.exists)
|
|
1006
|
+
refs.push(`decision:${artifacts.decisionEnvelope.path}`);
|
|
1007
|
+
if (artifacts.decisionEnvelopeValidation.exists)
|
|
1008
|
+
refs.push(`decision-validation:${artifacts.decisionEnvelopeValidation.path}`);
|
|
1009
|
+
if (artifacts.humanEscalationJson.exists)
|
|
1010
|
+
refs.push(`escalation-json:${artifacts.humanEscalationJson.path}`);
|
|
1011
|
+
if (artifacts.humanEscalationMd.exists)
|
|
1012
|
+
refs.push(`escalation-md:${artifacts.humanEscalationMd.path}`);
|
|
1013
|
+
if (artifacts.humanApproval.exists)
|
|
1014
|
+
refs.push(`approval:${artifacts.humanApproval.path}`);
|
|
1015
|
+
if (artifacts.humanRejection.exists)
|
|
1016
|
+
refs.push(`rejection:${artifacts.humanRejection.path}`);
|
|
1017
|
+
return refs.length > 0 ? refs.join(", ") : "-";
|
|
1018
|
+
}
|
|
1019
|
+
function formatCloseoutVerificationEvidence(run) {
|
|
1020
|
+
const verificationNodes = run.nodes.filter((node) => node.executor === "shell" ||
|
|
1021
|
+
node.nodeId.includes("verify") ||
|
|
1022
|
+
node.nodeId.includes("gate"));
|
|
1023
|
+
const targets = verificationNodes.length > 0
|
|
1024
|
+
? verificationNodes
|
|
1025
|
+
: run.nodes.filter((node) => node.status !== "PENDING");
|
|
1026
|
+
if (targets.length === 0) {
|
|
1027
|
+
return ["No verification evidence nodes found."];
|
|
1028
|
+
}
|
|
1029
|
+
return targets.map((node) => {
|
|
1030
|
+
const artifacts = formatArtifactFlags(node.artifacts);
|
|
1031
|
+
const artifactRefs = formatCloseoutArtifactRefs(node.artifacts);
|
|
1032
|
+
const exitHint = node.failureCategory && node.failureCategory !== "success"
|
|
1033
|
+
? `exit/failure=${node.failureCategory}`
|
|
1034
|
+
: "exit=0";
|
|
1035
|
+
return `- **${node.nodeId}** (${node.executor}): status=${node.status}, ${exitHint}, normalized=${node.normalizedFailureCategory ?? "-"}, artifacts=${artifacts}, artifactRefs=${artifactRefs}`;
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
function formatCloseoutPrimaryFailureSection(run) {
|
|
1039
|
+
const failure = run.primaryFailure;
|
|
1040
|
+
if (failure.scope === "node" && failure.nodeId) {
|
|
1041
|
+
return [
|
|
1042
|
+
`- **Scope**: node`,
|
|
1043
|
+
`- **Node**: ${failure.nodeId} (${failure.nodeStatus ?? "unknown"})`,
|
|
1044
|
+
`- **Category (raw/normalized)**: ${failure.failureCategory ?? "-"} / ${failure.normalizedFailureCategory ?? "-"}`,
|
|
1045
|
+
`- **Product-line category**: ${failure.productLineFailureCategory ?? "-"}`,
|
|
1046
|
+
`- **Recommended follow-up**: ${failure.recommendedFollowUp ?? "-"}`,
|
|
1047
|
+
];
|
|
1048
|
+
}
|
|
1049
|
+
if (run.primaryRecovery.action === "none" &&
|
|
1050
|
+
run.status === "finished" &&
|
|
1051
|
+
!failure.failureCategory) {
|
|
1052
|
+
return ["No primary failure detected."];
|
|
1053
|
+
}
|
|
1054
|
+
return [
|
|
1055
|
+
`- **Scope**: ${failure.scope}`,
|
|
1056
|
+
`- **Category (raw/normalized)**: ${failure.failureCategory ?? "-"} / ${failure.normalizedFailureCategory ?? "-"}`,
|
|
1057
|
+
`- **Product-line category**: ${failure.productLineFailureCategory ?? "-"}`,
|
|
1058
|
+
`- **Recommended follow-up**: ${failure.recommendedFollowUp ?? "-"}`,
|
|
1059
|
+
];
|
|
1060
|
+
}
|
|
1061
|
+
function formatCloseoutRecoverySection(run) {
|
|
1062
|
+
const rec = run.primaryRecovery;
|
|
1063
|
+
return [
|
|
1064
|
+
`- **Action**: \`${rec.action}\``,
|
|
1065
|
+
`- **Summary**: ${rec.summary}`,
|
|
1066
|
+
`- **Reason**: ${rec.reason}`,
|
|
1067
|
+
rec.commandHint ? `- **Command Hint**: ${rec.commandHint}` : undefined,
|
|
1068
|
+
].filter((line) => line !== undefined);
|
|
1069
|
+
}
|
|
1070
|
+
function formatSuggestedReportSection(run) {
|
|
1071
|
+
const statusLabel = run.status === "finished" ? "completed successfully" : run.status;
|
|
1072
|
+
return [
|
|
1073
|
+
`- **Title**: ${run.title} (${run.runId})`,
|
|
1074
|
+
`- **Outcome**: Run ${statusLabel} with ${summarizeNodeStatuses(run.nodes)}.`,
|
|
1075
|
+
`- **Primary recovery**: ${run.primaryRecovery.summary} [\`${run.primaryRecovery.action}\`]`,
|
|
1076
|
+
`- **Canonical facts**: \`dag report --run-id ${run.runId} --lifecycle completed --json\``,
|
|
1077
|
+
`- **Run dir**: ${run.runDir}`,
|
|
1078
|
+
];
|
|
1079
|
+
}
|
|
1080
|
+
function formatSuggestedProgressSection(run) {
|
|
1081
|
+
return [
|
|
1082
|
+
`- Mark milestone complete for run \`${run.runId}\` (${run.title}).`,
|
|
1083
|
+
`- Status: ${run.status}; lifecycle: ${run.lifecycle}.`,
|
|
1084
|
+
`- Node summary: ${summarizeNodeStatuses(run.nodes)}.`,
|
|
1085
|
+
run.finishedAt
|
|
1086
|
+
? `- Finished at: ${run.finishedAt}.`
|
|
1087
|
+
: "- Finished at: (not recorded).",
|
|
1088
|
+
];
|
|
1089
|
+
}
|
|
1090
|
+
function formatSuggestedHandoffSection(run) {
|
|
1091
|
+
return [
|
|
1092
|
+
`- Next operator action: ${suggestedNextAction(run)}`,
|
|
1093
|
+
`- Review artifacts under \`${run.runDir}\` before publishing docs.`,
|
|
1094
|
+
`- Re-validate with \`dag report --run-id ${run.runId} --lifecycle completed --markdown\`.`,
|
|
1095
|
+
];
|
|
1096
|
+
}
|
|
1097
|
+
function formatRemainingRisksSection(run) {
|
|
1098
|
+
const risks = [];
|
|
1099
|
+
if (run.status !== "finished") {
|
|
1100
|
+
risks.push(`- Run status is \`${run.status}\`; confirm recovery before archiving.`);
|
|
1101
|
+
}
|
|
1102
|
+
if (run.primaryRecovery.humanRequired) {
|
|
1103
|
+
risks.push("- Human input is still required per recovery recommendation.");
|
|
1104
|
+
}
|
|
1105
|
+
if (run.downstreamSkippedNodes.length > 0) {
|
|
1106
|
+
risks.push(`- Downstream skipped nodes: ${run.downstreamSkippedNodes.map((node) => node.nodeId).join(", ")}.`);
|
|
1107
|
+
}
|
|
1108
|
+
const failedNodes = failureRows(run);
|
|
1109
|
+
if (failedNodes.length > 0) {
|
|
1110
|
+
risks.push(`- Failed nodes remain in facts: ${failedNodes.map((node) => node.nodeId).join(", ")}.`);
|
|
1111
|
+
}
|
|
1112
|
+
if (risks.length === 0) {
|
|
1113
|
+
risks.push("- No outstanding risks derived from run facts.");
|
|
1114
|
+
}
|
|
1115
|
+
risks.push("- This draft is advisory; edit before committing to `docs/reports/` or `docs/progress/`.");
|
|
1116
|
+
return risks;
|
|
1117
|
+
}
|
|
1118
|
+
export function formatDagCloseoutDraftMarkdown(run) {
|
|
1119
|
+
if (isFailedReportRun(run)) {
|
|
1120
|
+
const lines = [
|
|
1121
|
+
`# Failure Handoff: ${run.runId}`,
|
|
1122
|
+
"",
|
|
1123
|
+
DAG_CLOSEOUT_DRAFT_DISCLAIMER,
|
|
1124
|
+
"",
|
|
1125
|
+
"## What failed",
|
|
1126
|
+
...formatCloseoutPrimaryFailureSection(run),
|
|
1127
|
+
"",
|
|
1128
|
+
"## Evidence",
|
|
1129
|
+
...formatCloseoutVerificationEvidence(run),
|
|
1130
|
+
"",
|
|
1131
|
+
"## Classification",
|
|
1132
|
+
`- raw_failure_category: ${run.primaryFailure.failureCategory ?? "-"}`,
|
|
1133
|
+
`- dag_normalized_failure_category: ${run.primaryFailure.normalizedFailureCategory ?? "-"}`,
|
|
1134
|
+
`- product_line_failure_category: ${run.primaryFailure.productLineFailureCategory ?? "-"}`,
|
|
1135
|
+
`- recommended_follow_up: ${run.primaryFailure.recommendedFollowUp ?? "-"}`,
|
|
1136
|
+
"",
|
|
1137
|
+
"## Recommended follow-up",
|
|
1138
|
+
...formatCloseoutRecoverySection(run),
|
|
1139
|
+
"",
|
|
1140
|
+
"## Safe retry conditions",
|
|
1141
|
+
`- Retry only after completing \`${run.primaryFailure.recommendedFollowUp ?? run.primaryRecovery.action}\` and preserving the original DAG run facts.`,
|
|
1142
|
+
"- Do not rewrite `.harness/dag-runs/completed/**`; create a new run or task artifact for follow-up evidence.",
|
|
1143
|
+
"",
|
|
1144
|
+
"## Human decision needed",
|
|
1145
|
+
run.primaryRecovery.humanRequired
|
|
1146
|
+
? "- Yes. Human review is required before retry or promotion."
|
|
1147
|
+
: "- No required human gate was derived, but review the failure evidence before retry.",
|
|
1148
|
+
"",
|
|
1149
|
+
];
|
|
1150
|
+
return lines.join("\n");
|
|
1151
|
+
}
|
|
1152
|
+
const lines = [
|
|
1153
|
+
`# DAG Closeout Draft: ${run.runId}`,
|
|
1154
|
+
"",
|
|
1155
|
+
DAG_CLOSEOUT_DRAFT_DISCLAIMER,
|
|
1156
|
+
"",
|
|
1157
|
+
"## Run Summary",
|
|
1158
|
+
`- **Run ID**: ${run.runId}`,
|
|
1159
|
+
`- **Title**: ${run.title}`,
|
|
1160
|
+
`- **Lifecycle**: ${run.lifecycle}`,
|
|
1161
|
+
`- **Status**: ${run.status}`,
|
|
1162
|
+
`- **Started**: ${formatTimestamp(run.startedAt)}`,
|
|
1163
|
+
`- **Finished**: ${formatTimestamp(run.finishedAt)}`,
|
|
1164
|
+
`- **Duration**: ${formatRunDuration(run.startedAt, run.finishedAt)}`,
|
|
1165
|
+
`- **Nodes**: ${summarizeNodeStatuses(run.nodes)}`,
|
|
1166
|
+
`- **Run Dir**: ${run.runDir}`,
|
|
1167
|
+
"",
|
|
1168
|
+
"## Primary Failure & Recovery",
|
|
1169
|
+
...formatCloseoutPrimaryFailureSection(run),
|
|
1170
|
+
"",
|
|
1171
|
+
"### Recovery Recommendation",
|
|
1172
|
+
...formatCloseoutRecoverySection(run),
|
|
1173
|
+
"",
|
|
1174
|
+
"## Node Status Summary",
|
|
1175
|
+
...formatCloseoutNodeStatusTable(run),
|
|
1176
|
+
"",
|
|
1177
|
+
"## Verification Evidence",
|
|
1178
|
+
...formatCloseoutVerificationEvidence(run),
|
|
1179
|
+
"",
|
|
1180
|
+
"## Suggested Report Section",
|
|
1181
|
+
...formatSuggestedReportSection(run),
|
|
1182
|
+
"",
|
|
1183
|
+
"## Suggested Progress Section",
|
|
1184
|
+
...formatSuggestedProgressSection(run),
|
|
1185
|
+
"",
|
|
1186
|
+
"## Suggested Handoff Section",
|
|
1187
|
+
...formatSuggestedHandoffSection(run),
|
|
1188
|
+
"",
|
|
1189
|
+
"## Remaining Risks & Next Steps",
|
|
1190
|
+
...formatRemainingRisksSection(run),
|
|
1191
|
+
"",
|
|
1192
|
+
];
|
|
1193
|
+
return lines.join("\n");
|
|
1194
|
+
}
|
|
1195
|
+
export async function buildDagCloseoutDraft(options) {
|
|
1196
|
+
if (options.runId) {
|
|
1197
|
+
const located = await locateDagRun(options.repoRoot, options.runId);
|
|
1198
|
+
if (!located) {
|
|
1199
|
+
throw new Error(`dag run not found: ${options.runId}`);
|
|
1200
|
+
}
|
|
1201
|
+
if (located.lifecycle !== "completed") {
|
|
1202
|
+
throw new Error(`closeout draft requires a completed run; found lifecycle=${located.lifecycle} for run ${options.runId}`);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
const report = await buildDagReport({
|
|
1206
|
+
repoRoot: options.repoRoot,
|
|
1207
|
+
runId: options.runId,
|
|
1208
|
+
lifecycle: "completed",
|
|
1209
|
+
latest: options.runId === undefined,
|
|
1210
|
+
});
|
|
1211
|
+
if (report.runs.length === 0) {
|
|
1212
|
+
if (options.runId) {
|
|
1213
|
+
throw new Error(`dag run not found: ${options.runId}`);
|
|
1214
|
+
}
|
|
1215
|
+
throw new Error("no completed DAG runs found");
|
|
1216
|
+
}
|
|
1217
|
+
const run = report.runs[0];
|
|
1218
|
+
if (run.lifecycle !== "completed") {
|
|
1219
|
+
throw new Error(`closeout draft requires a completed run; found lifecycle=${run.lifecycle} for run ${run.runId}`);
|
|
1220
|
+
}
|
|
1221
|
+
const markdown = formatDagCloseoutDraftMarkdown(run);
|
|
1222
|
+
const outputPath = resolveCloseoutDraftOutputPath(options.repoRoot, options.outputPath ?? defaultCloseoutDraftOutputPath(run.runId));
|
|
1223
|
+
assertCloseoutDraftOutputPathAllowed(options.repoRoot, outputPath);
|
|
1224
|
+
return {
|
|
1225
|
+
run,
|
|
1226
|
+
markdown,
|
|
1227
|
+
outputPath,
|
|
1228
|
+
};
|
|
1229
|
+
}
|