@tea-agent/loop-agent 0.1.0-fe-test.2 → 0.1.0-fe-test.4
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 +6 -3
- package/CHANGELOG.md +607 -93
- package/README.md +11 -5
- package/bin/loop-agent.js +7 -3
- package/dist/adapters/context-transfer/optional-pi-handoff.js +31 -0
- package/dist/adapters/context-transfer/pi-session.js +61 -0
- package/dist/application/dag/generate-task-dag.js +90 -21
- package/dist/application/dag/run-dag.js +41 -0
- package/dist/application/task-lifecycle/advance.js +40 -5
- package/dist/application/task-lifecycle/observe.js +171 -17
- package/dist/application/task-lifecycle/plan-transitions.js +42 -7
- package/dist/application/task-lifecycle/recommendations.js +13 -2
- package/dist/build-stamp.json +3 -3
- package/dist/cli/command-definitions.js +44 -10
- package/dist/cli/program.js +82 -6
- package/dist/cli/update/notifier.js +2 -2
- package/dist/cli/update/runtime-activity.js +1 -29
- package/dist/cli.js +2 -1
- package/dist/commands/client-recovery.js +11 -36
- package/dist/commands/dag-artifact.js +284 -0
- package/dist/commands/dag-context.js +184 -0
- package/dist/commands/dag-follow-up.js +138 -0
- package/dist/commands/dag-rerun-task.js +2 -0
- package/dist/commands/dag-rerun.js +261 -2
- package/dist/commands/init-model-catalog.js +486 -0
- package/dist/commands/init-upgrade.js +265 -97
- package/dist/commands/init.js +455 -28
- package/dist/commands/inspect-next.js +8 -0
- package/dist/commands/task-advance.js +73 -1
- package/dist/commands/task-source-prepare.js +5 -0
- package/dist/commands/task-status.js +1 -0
- package/dist/executors/dag-pi-executor.js +4321 -231
- package/dist/executors/pi-event-serializer.js +42 -1
- package/dist/executors/pi-executor.js +70 -6
- package/dist/executors/pi-extension-resolver.js +245 -0
- package/dist/executors/pi-playwright-cli-tool.js +74 -28
- package/dist/executors/pi-read-budget-policy.js +239 -0
- package/dist/executors/pi-sdk-executor.js +263 -59
- package/dist/executors/pi-writer-tool-policy.js +57 -1
- package/dist/executors/shell-executor.js +1443 -240
- package/dist/executors/shell-write-guard.js +14 -0
- package/dist/executors/workspace-write-snapshot.js +68 -0
- package/dist/governance/checks.js +1 -0
- package/dist/{worker → infrastructure}/console/app-data.js +4 -0
- package/dist/infrastructure/console/artifact-revision-store.js +430 -0
- package/dist/infrastructure/console/context-export-store.js +160 -0
- package/dist/infrastructure/console/dir-lock.js +132 -0
- package/dist/infrastructure/console/operation-store.js +417 -0
- package/dist/infrastructure/harness/artifact-store.js +10 -1
- package/dist/infrastructure/harness/atomic-write.js +35 -2
- package/dist/shared/context-transfer/artifact-revision.js +172 -0
- package/dist/shared/context-transfer.js +418 -0
- package/dist/shared/dag-failure-category.js +150 -0
- package/dist/shared/dag-prompt-override.js +27 -0
- package/dist/shared/openspec-spec.js +70 -4
- package/dist/shared/operator/capabilities.js +65 -4
- package/dist/shared/operator/safe-run-summary.js +1 -0
- package/dist/shared/path-safety.js +93 -0
- package/dist/shared/pi-context-pressure/checkpoint.js +116 -0
- package/dist/shared/pi-context-pressure/compaction-policy.js +151 -0
- package/dist/shared/pi-context-pressure/env.js +58 -0
- package/dist/shared/pi-context-pressure/extension.js +100 -0
- package/dist/shared/pi-context-pressure/index.js +7 -0
- package/dist/shared/pi-context-pressure/overflow.js +252 -0
- package/dist/shared/pi-context-pressure/sift-bridge.js +386 -0
- package/dist/shared/pi-context-pressure/telemetry.js +51 -0
- package/dist/shared/playwright-cli-command-policy.js +15 -0
- package/dist/shared/preview.js +28 -4
- package/dist/shared/update/console-notifier.js +100 -0
- package/dist/{cli → shared}/update/npm-client.js +70 -15
- package/dist/{cli → shared}/update/state.js +41 -13
- package/dist/task/config-types.js +125 -6
- package/dist/task/contract/adopt.js +4 -0
- package/dist/task/contract/apply.js +11 -1
- package/dist/task/contract/constants.js +3 -0
- package/dist/task/contract/diff.js +26 -0
- package/dist/task/contract/hash.js +3 -0
- package/dist/task/contract/import-revision.js +4 -0
- package/dist/task/contract/observe.js +25 -4
- package/dist/task/contract/paths.js +2 -1
- package/dist/task/contract/project.js +23 -1
- package/dist/task/contract/schema.js +9 -1
- package/dist/task/contract/transaction.js +12 -0
- package/dist/task/frontend-project-capability.js +203 -20
- package/dist/task/runtime.js +5 -2
- package/dist/task/source-prepare/build-draft.js +18 -3
- package/dist/task/source-prepare/completeness.js +188 -0
- package/dist/task/source-prepare/fragment-inventory.js +513 -0
- package/dist/task/source-prepare/index.js +3 -0
- package/dist/task/source-prepare/ledger-reconciliation.js +127 -0
- package/dist/task/source-prepare/ledger-review.js +214 -0
- package/dist/task/source-prepare/ledger.js +545 -0
- package/dist/task/source-prepare/parse-intent.js +24 -4
- package/dist/task/source-prepare/prepare.js +368 -2
- package/dist/task/source-prepare/semantic-intake.js +25 -5
- package/dist/task/source-prepare/source-fidelity-pi.js +384 -0
- package/dist/task/source-prepare/types.js +22 -0
- package/dist/task/source-references.js +22 -1
- package/dist/task/task-demand-routing.js +3 -0
- package/dist/worker/cli.js +18 -2
- package/dist/worker/console/chat/assistant-content.js +7 -0
- package/dist/worker/console/chat/chat-event-store.js +159 -18
- package/dist/worker/console/chat/chat-ui-policy.js +4 -2
- package/dist/worker/console/chat/context-panel.js +7 -0
- package/dist/worker/console/chat/deferred-turn.js +103 -0
- package/dist/worker/console/chat/goal-round-driver.js +72 -0
- package/dist/worker/console/chat/goals.js +300 -0
- package/dist/worker/console/chat/model-resolver.js +7 -4
- package/dist/worker/console/chat/operation-card.js +8 -1
- package/dist/worker/console/chat/pi-console-config.js +81 -10
- package/dist/worker/console/chat/pi-runtime.js +868 -30
- package/dist/worker/console/chat/provider-error.js +99 -0
- package/dist/worker/console/chat/repo-browser.js +101 -12
- package/dist/worker/console/chat/resource-preferences-store.js +1 -1
- package/dist/worker/console/chat/routes.js +1451 -145
- package/dist/worker/console/chat/sdd-data-alignment.js +222 -0
- package/dist/worker/console/chat/semantic-activity.js +25 -24
- package/dist/worker/console/chat/session-catalog.js +50 -0
- package/dist/worker/console/chat/session-stats.js +275 -0
- package/dist/worker/console/chat/session-store.js +348 -76
- package/dist/worker/console/chat/shortcuts.js +26 -3
- package/dist/worker/console/chat/sift-bridge.js +1 -0
- package/dist/worker/console/chat/todos.js +115 -0
- package/dist/worker/console/chat/tool-preview.js +42 -0
- package/dist/worker/console/chat/turn-process.js +185 -112
- package/dist/worker/console/chat/user-questions.js +266 -0
- package/dist/worker/console/chat/workspace-landing.js +79 -0
- package/dist/worker/console/console-handoff.js +82 -0
- package/dist/worker/console/console-update-and-init.js +115 -0
- package/dist/worker/console/console-update-runtime.js +84 -0
- package/dist/worker/console/context-transfer-diagnostics.js +198 -0
- package/dist/worker/console/dag-confirmation.js +1 -1
- package/dist/worker/console/dag-execution-receipt.js +54 -3
- package/dist/worker/console/doctor.js +1 -1
- package/dist/worker/console/draft-store.js +50 -1
- package/dist/worker/console/frontend-human-decision-adapter.js +19 -0
- package/dist/worker/console/frontend-split-operation-adapter.js +20 -0
- package/dist/worker/console/human-gate-token.js +1 -1
- package/dist/worker/console/index.js +6 -3
- package/dist/worker/console/inspect-split.js +18 -0
- package/dist/worker/console/interview/assessment.js +1 -1
- package/dist/worker/console/interview/session.js +1 -1
- package/dist/worker/console/native-directory-picker.js +13 -0
- package/dist/worker/console/operation-run-facts.js +19 -3
- package/dist/worker/console/operation-runner.js +45 -4
- package/dist/worker/console/operation-sse.js +1 -1
- package/dist/worker/console/operation-wait.js +1 -1
- package/dist/worker/console/operator-actions.js +534 -15
- package/dist/worker/console/operator-selection.js +6 -2
- package/dist/worker/console/operator-surface-health.js +2 -1
- package/dist/worker/console/operator-user-error.js +171 -2
- package/dist/worker/console/pi-plugins.catalog.json +73658 -0
- package/dist/worker/console/pi-plugins.js +238 -0
- package/dist/worker/console/pi-readiness.js +7 -6
- package/dist/worker/console/prd-intake-bridge.js +13 -0
- package/dist/worker/console/recovery-cta.js +4 -4
- package/dist/worker/console/recovery-error-copy.js +4 -4
- package/dist/worker/console/routes.js +1231 -10
- package/dist/worker/console/security.js +102 -13
- package/dist/worker/console/server.js +762 -159
- package/dist/worker/console/static/assets/{abnfDiagram-N423BO3Z-BmOEx0gA.js → abnfDiagram-N423BO3Z-BZogYNl1.js} +1 -1
- package/dist/worker/console/static/assets/{arc-BGiVVe8b.js → arc-DcJTLe2v.js} +1 -1
- package/dist/worker/console/static/assets/{architectureDiagram-T3A2C74G-nDdu4rgJ.js → architectureDiagram-T3A2C74G-B39EQQ9n.js} +1 -1
- package/dist/worker/console/static/assets/{blockDiagram-VBNYF7ZC-Bb5u0BWf.js → blockDiagram-VBNYF7ZC-CitCGV56.js} +1 -1
- package/dist/worker/console/static/assets/{c4Diagram-5PPSVZJV-BlhC0j94.js → c4Diagram-5PPSVZJV-rvWuOHLG.js} +1 -1
- package/dist/worker/console/static/assets/channel-CXqdP5pW.js +1 -0
- package/dist/worker/console/static/assets/{chunk-2GRJ4B5K-Ai8_qQXI.js → chunk-2GRJ4B5K-DGXplIJs.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-2Q5K7J3B-B9gyCjqX.js → chunk-2Q5K7J3B-ur9OqjPn.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5RXB4S5H-Bzbj3zGH.js → chunk-5RXB4S5H-D1KqU_Vi.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5VM5RSS4-BT415PvT.js → chunk-5VM5RSS4-BlVZrbtM.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-6Q2QTUOP-D_A5_5QL.js → chunk-6Q2QTUOP-BAzz3nQy.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-GF5L2VYU-srJkaP3f.js → chunk-GF5L2VYU-CP_nYuCV.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-JWPE2WC7-UYGvEP4l.js → chunk-JWPE2WC7-CWvKQ80X.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-KBJHAD2P-B8luBrrz.js → chunk-KBJHAD2P-CyUki8wp.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-RYQCIY6F-DN7wXZSq.js → chunk-RYQCIY6F-5NYzNKfY.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-XXDRQBXY-DXKyMuKS.js → chunk-XXDRQBXY-DHdUgjS-.js} +1 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-D9C3agF7.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-D9C3agF7.js +1 -0
- package/dist/worker/console/static/assets/{cose-bilkent-JH36ORCC-dqvoynXj.js → cose-bilkent-JH36ORCC-ANQ5g_t6.js} +1 -1
- package/dist/worker/console/static/assets/{cynefin-VYW2F7L2--PcyL34A.js → cynefin-VYW2F7L2-CruT_4-0.js} +1 -1
- package/dist/worker/console/static/assets/{cynefinDiagram-MW4NZA55-DvWs_hTY.js → cynefinDiagram-MW4NZA55-rbFo77ID.js} +1 -1
- package/dist/worker/console/static/assets/{dagre-VZM6K2ZE-DxeIxbyO.js → dagre-VZM6K2ZE-asstxBQs.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-7IWD3JNH-DPCG61Of.js → diagram-7IWD3JNH-DzTyBZwI.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-B4RE2ZJO-CmuU50-U.js → diagram-B4RE2ZJO-gw8ccH3B.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-LBJQPF4R-B61XLD_v.js → diagram-LBJQPF4R-B8RpZzOf.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-Q27KOJAE-BB7HTRRY.js → diagram-Q27KOJAE-B1zJkCS9.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-UB23O5K3-DvkboAIp.js → diagram-UB23O5K3-B6JLWZmO.js} +1 -1
- package/dist/worker/console/static/assets/{ebnfDiagram-BXEA7PRR-BdJ_y1fL.js → ebnfDiagram-BXEA7PRR-q2iZP-Ps.js} +1 -1
- package/dist/worker/console/static/assets/{erDiagram-JOGREHBK-9bUBZTRi.js → erDiagram-JOGREHBK-B3dbbktQ.js} +1 -1
- package/dist/worker/console/static/assets/{flowDiagram-UKHOOZJN-Dw4L4RBa.js → flowDiagram-UKHOOZJN-C-zc6-kB.js} +1 -1
- package/dist/worker/console/static/assets/{ganttDiagram-PKOTCBZU-Jr82N_QP.js → ganttDiagram-PKOTCBZU-BSolnot9.js} +1 -1
- package/dist/worker/console/static/assets/{gitGraphDiagram-DS77QQ5N-DAz9wFLr.js → gitGraphDiagram-DS77QQ5N-Bo8jGxTk.js} +1 -1
- package/dist/worker/console/static/assets/index-CAZ2fC_X.css +1 -0
- package/dist/worker/console/static/assets/index-DhfjOafu.js +449 -0
- package/dist/worker/console/static/assets/{infoDiagram-6WML65LV-CBB5Np7y.js → infoDiagram-6WML65LV-DQaZqJOH.js} +1 -1
- package/dist/worker/console/static/assets/{ishikawaDiagram-WSZJBQD7-D8IOp94y.js → ishikawaDiagram-WSZJBQD7-DsdX1WnE.js} +1 -1
- package/dist/worker/console/static/assets/{journeyDiagram-NVQOT4AX-Dgd3AHGG.js → journeyDiagram-NVQOT4AX-CP5EYDZL.js} +1 -1
- package/dist/worker/console/static/assets/{kanban-definition-27J2QSJJ-BmYOxLE9.js → kanban-definition-27J2QSJJ-DAm14Dr8.js} +1 -1
- package/dist/worker/console/static/assets/{linear-DfYTEF6J.js → linear-gZECoLc5.js} +1 -1
- package/dist/worker/console/static/assets/{mermaid.core-BjuFPRqa.js → mermaid.core-BRJNIM6p.js} +5 -5
- package/dist/worker/console/static/assets/{mindmap-definition-FAOFIHXS-CLyUViGd.js → mindmap-definition-FAOFIHXS-Cja3kLkR.js} +1 -1
- package/dist/worker/console/static/assets/{pegDiagram-VL7TDLO6-BvX2Di4-.js → pegDiagram-VL7TDLO6-22ZGFisL.js} +1 -1
- package/dist/worker/console/static/assets/{pieDiagram-7S7Q4E2Y-BFj0_OLv.js → pieDiagram-7S7Q4E2Y-BXin0Y1o.js} +1 -1
- package/dist/worker/console/static/assets/{quadrantDiagram-CIZ2JOQS-BIUrD_hx.js → quadrantDiagram-CIZ2JOQS-Cw6T69Yt.js} +1 -1
- package/dist/worker/console/static/assets/{railroadDiagram-AXF67PYL-CHBB48fj.js → railroadDiagram-AXF67PYL-C1-gTieN.js} +1 -1
- package/dist/worker/console/static/assets/{requirementDiagram-LRYGKXZP-sJrYw2Sf.js → requirementDiagram-LRYGKXZP--H5N2iI1.js} +1 -1
- package/dist/worker/console/static/assets/{sankeyDiagram-W5VNT64P-BzHH6fPR.js → sankeyDiagram-W5VNT64P-CgWAPeRz.js} +1 -1
- package/dist/worker/console/static/assets/{sequenceDiagram-SI44F4Z6-7QCnelCt.js → sequenceDiagram-SI44F4Z6-CrKqzGvt.js} +1 -1
- package/dist/worker/console/static/assets/{sizeCapture-X5ZJPWSS-sDYSxn72.js → sizeCapture-X5ZJPWSS-BB3wG06K.js} +1 -1
- package/dist/worker/console/static/assets/{stateDiagram-OKZ733FA-XpiUdwzm.js → stateDiagram-OKZ733FA-DjsGgdgY.js} +1 -1
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-Tp7V0U4q.js +1 -0
- package/dist/worker/console/static/assets/{swimlanes-SLNWSIFB-DvqgNPzD.js → swimlanes-SLNWSIFB-DYKEbvAR.js} +2 -2
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-DUZWZWi8.js +8 -0
- package/dist/worker/console/static/assets/{timeline-definition-Z64GVDOM-2TyOYNx0.js → timeline-definition-Z64GVDOM-eQOb5k9Y.js} +1 -1
- package/dist/worker/console/static/assets/{vennDiagram-T6HMQDX7-B-nM6wM2.js → vennDiagram-T6HMQDX7-B2-l9FIu.js} +1 -1
- package/dist/worker/console/static/assets/{wardleyDiagram-T6FBY63Y-B86wPdbr.js → wardleyDiagram-T6FBY63Y-BX2Cda3l.js} +1 -1
- package/dist/worker/console/static/assets/{xychartDiagram-ELKLHX3M-Dr1C4AQz.js → xychartDiagram-ELKLHX3M-D9S892ph.js} +1 -1
- package/dist/worker/console/static/index.html +7 -2
- package/dist/worker/console/static-src/active-run-badge.js +17 -0
- package/dist/worker/console/static-src/app/console-types.js +68 -4
- package/dist/worker/console/static-src/app/useConsoleShell.js +30 -12
- package/dist/worker/console/static-src/app/useOperatorActions.js +43 -7
- package/dist/worker/console/static-src/app/useRecoveryActions.js +2 -2
- package/dist/worker/console/static-src/app/useRecoveryConsole.js +45 -10
- package/dist/worker/console/static-src/app/useRunProgress.js +54 -0
- package/dist/worker/console/static-src/app/useTaskWizard.js +74 -2
- package/dist/worker/console/static-src/night/useNightBoard.js +8 -5
- package/dist/worker/console/static-src/operator-chat/cards/failure-category-advice.js +25 -0
- package/dist/worker/console/static-src/operator-chat/chat-sse-events.js +264 -13
- package/dist/worker/console/static-src/operator-chat/compaction-message.js +113 -0
- package/dist/worker/console/static-src/operator-chat/dag-progress-link.js +22 -0
- package/dist/worker/console/static-src/operator-chat/details-dag-actions.js +122 -0
- package/dist/worker/console/static-src/operator-chat/input-history.js +78 -0
- package/dist/worker/console/static-src/operator-chat/mutation-gate.js +1 -1
- package/dist/worker/console/static-src/operator-chat/open-preview-in-browser.js +338 -0
- package/dist/worker/console/static-src/operator-chat/refs.js +3 -0
- package/dist/worker/console/static-src/operator-chat/runtime-selection-labels.js +27 -0
- package/dist/worker/console/static-src/operator-chat/runtime-snapshot-store.js +10 -0
- package/dist/worker/console/static-src/operator-chat/spatial-overlay.js +1 -2
- package/dist/worker/console/static-src/operator-chat/turn-stream-controller.js +33 -1
- package/dist/worker/console/static-src/operator-chat/turn-submission.js +55 -0
- package/dist/worker/console/static-src/operator-chat/useChatSessions.js +448 -109
- package/dist/worker/console/static-src/operator-chat/useChatStream.js +344 -27
- package/dist/worker/console/static-src/operator-chat/useChatThread.js +323 -11
- package/dist/worker/console/static-src/operator-chat/useComposer.js +45 -4
- package/dist/worker/console/static-src/operator-chat/useRepoBrowser.js +97 -13
- package/dist/worker/console/static-src/operator-chat/useRuntimeControls.js +57 -9
- package/dist/worker/console/static-src/operator-chat/useRuntimeSnapshot.js +8 -2
- package/dist/worker/console/static-src/operator-chat/useWorkspaceBrowserGate.js +4 -0
- package/dist/worker/console/static-src/operator-chat/workspace-layout-mode.js +3 -3
- package/dist/worker/console/static-src/operator-chat/workspace-reorder.js +18 -0
- package/dist/worker/console/static-src/pages/tasks/run-id-resolution.js +79 -0
- package/dist/worker/console/static-src/pages/tasks/run-ownership-verify.js +23 -0
- package/dist/worker/console/static-src/pages/tasks/run-panel-progress.js +216 -0
- package/dist/worker/console/static-src/shell/console-update-reload.js +52 -0
- package/dist/worker/console/static-src/shell/useWorkspaces.js +415 -0
- package/dist/worker/console/static-src/shell/workspace-route.js +356 -0
- package/dist/worker/console/workspace-context.js +399 -0
- package/dist/worker/console/workspace-registry.js +487 -0
- package/dist/worker/continuation/worker-continuation.js +278 -0
- package/dist/worker/loop-agent/loop-agent-client.js +7 -3
- package/dist/worker/materialize/frontend-split-task-materializer.js +72 -0
- package/dist/worker/materialize/harness-task-lineage.js +5 -2
- package/dist/worker/observability/init-runtime-activity.js +26 -0
- package/dist/worker/observability/read-model.js +26 -0
- package/dist/worker/observe/health.js +1 -1
- package/dist/worker/observe/node-input.js +160 -3
- package/dist/worker/observe/node-process.js +377 -0
- package/dist/worker/observe/node-transparency.js +572 -0
- package/dist/worker/observe/routes.js +278 -3
- package/dist/worker/observe/server.js +4 -0
- package/dist/worker/observe/shell-handler-keys.js +34 -0
- package/dist/worker/observe/static/api.js +154 -4
- package/dist/worker/observe/static/app.js +18 -70
- package/dist/worker/observe/static/constants.js +26 -19
- package/dist/worker/observe/static/dag-context-reason-labels.d.ts +9 -0
- package/dist/worker/observe/static/dag-context-reason-labels.js +139 -0
- package/dist/worker/observe/static/dag-helpers.js +4 -2
- package/dist/worker/observe/static/dag-history-labels.js +5 -0
- package/dist/worker/observe/static/dag-inspector-humanize.d.ts +16 -0
- package/dist/worker/observe/static/dag-inspector-humanize.js +339 -0
- package/dist/worker/observe/static/dag-node-purpose.d.ts +6 -0
- package/dist/worker/observe/static/dag-node-purpose.js +208 -0
- package/dist/worker/observe/static/format.js +60 -0
- package/dist/worker/observe/static/index.html +10 -5
- package/dist/worker/observe/static/inspect-bootstrap.d.ts +8 -0
- package/dist/worker/observe/static/inspect-bootstrap.js +57 -0
- package/dist/worker/observe/static/inspect-workspace.js +374 -0
- package/dist/worker/observe/static/kpi.js +2 -2
- package/dist/worker/observe/static/markdown-render.js +20 -1
- package/dist/worker/observe/static/operator-chrome.css +168 -24
- package/dist/worker/observe/static/operator-chrome.d.ts +30 -5
- package/dist/worker/observe/static/operator-chrome.js +354 -101
- package/dist/worker/observe/static/prompt-restart-candidates.d.ts +18 -0
- package/dist/worker/observe/static/prompt-restart-candidates.js +38 -0
- package/dist/worker/observe/static/relations.js +7 -7
- package/dist/worker/observe/static/router.d.ts +57 -0
- package/dist/worker/observe/static/router.js +67 -1
- package/dist/worker/observe/static/run-processing.js +4 -2
- package/dist/worker/observe/static/shell-chrome.js +2 -2
- package/dist/worker/observe/static/state.d.ts +50 -0
- package/dist/worker/observe/static/state.js +191 -1
- package/dist/worker/observe/static/styles.css +1720 -86
- package/dist/worker/observe/static/views/dag-graph.js +5 -3
- package/dist/worker/observe/static/views/dag-inspector.js +2601 -188
- package/dist/worker/observe/static/views/dag.d.ts +13 -0
- package/dist/worker/observe/static/views/dag.js +39 -18
- package/dist/worker/observe/static/views/dags.js +10 -6
- package/dist/worker/observe/static/views/dashboard.js +18 -8
- package/dist/worker/observe/static/views/failures.js +5 -2
- package/dist/worker/observe/static/views/night.js +2 -2
- package/dist/worker/observe/static/views/pool.js +8 -2
- package/dist/worker/observe/static/views/run.js +15 -4
- package/dist/worker/observe/static/views/session-timeline.js +386 -25
- package/dist/worker/observe/static/views/task.js +63 -3
- package/dist/worker/outcomes/adapters.js +19 -0
- package/dist/worker/outcomes/types.js +1 -0
- package/dist/worker/pool/attempt-lease.js +97 -66
- package/dist/worker/pool/begin-attempt-with-lease.js +1 -0
- package/dist/worker/pool/reconcile.js +46 -1
- package/dist/worker/pool/run-store.js +2 -0
- package/dist/worker/pool/state-projection.js +2 -0
- package/dist/worker/task-spec/workflow-routing.js +8 -3
- package/dist/workflows/dag/artifact-bindings.js +149 -0
- package/dist/workflows/dag/artifact-revision-schema-registry.js +31 -0
- package/dist/workflows/dag/backend-test-case-coverage-analysis.js +470 -31
- package/dist/workflows/dag/backend-test-markdown-workflow.js +189 -2
- package/dist/workflows/dag/backend-test-plan-protocol.js +210 -0
- package/dist/workflows/dag/backend-test-pytest-collection.js +168 -16
- package/dist/workflows/dag/backend-test-result-contract.js +5 -1
- package/dist/workflows/dag/backend-test-scenario-param.js +506 -73
- package/dist/workflows/dag/backend-test-scenario-partitions.js +135 -2
- package/dist/workflows/dag/backend-test-writer-completeness.js +131 -28
- package/dist/workflows/dag/budget-enforcement.js +10 -0
- package/dist/workflows/dag/context-receipt.js +305 -0
- package/dist/workflows/dag/context-transfer/context-bundle.js +423 -0
- package/dist/workflows/dag/context-transfer/operator-actions.js +61 -0
- package/dist/workflows/dag/context-transfer/renderers.js +93 -0
- package/dist/workflows/dag/contract-output-registry.js +15 -0
- package/dist/workflows/dag/contract-validator-registrations.js +1 -2
- package/dist/workflows/dag/convergence/controller.js +141 -0
- package/dist/workflows/dag/dag-retry-schema.js +138 -0
- package/dist/workflows/dag/dynamic-runtime/loop-until.js +1 -1
- package/dist/workflows/dag/dynamic-runtime/map.js +2 -1
- package/dist/workflows/dag/failure-category.js +7 -116
- package/dist/workflows/dag/frontend-closeout.js +221 -0
- package/dist/workflows/dag/frontend-design-policy.js +400 -0
- package/dist/workflows/dag/frontend-human-decision.js +182 -0
- package/dist/workflows/dag/frontend-implementation-contract.js +1377 -141
- package/dist/workflows/dag/frontend-plan-render.js +26 -1
- package/dist/workflows/dag/frontend-prewrite-gate.js +376 -318
- package/dist/workflows/dag/frontend-provider-capability-matrix.js +159 -0
- package/dist/workflows/dag/frontend-recovery-capsule.js +455 -0
- package/dist/workflows/dag/frontend-recovery-controller.js +226 -0
- package/dist/workflows/dag/frontend-recovery-lineage.js +178 -0
- package/dist/workflows/dag/frontend-recovery-plan.js +21 -10
- package/dist/workflows/dag/frontend-recovery-run.js +166 -34
- package/dist/workflows/dag/frontend-repair.js +7 -424
- package/dist/workflows/dag/frontend-review-context.js +348 -20
- package/dist/workflows/dag/frontend-review-findings.js +270 -0
- package/dist/workflows/dag/frontend-risk.js +15 -2
- package/dist/workflows/dag/frontend-shadow-dual-write.js +941 -0
- package/dist/workflows/dag/frontend-shape-capsule-store.js +191 -0
- package/dist/workflows/dag/frontend-shape-facts.js +419 -0
- package/dist/workflows/dag/frontend-shape.js +435 -0
- package/dist/workflows/dag/frontend-source-fidelity-ledger.js +108 -0
- package/dist/workflows/dag/frontend-split-application-service.js +203 -0
- package/dist/workflows/dag/frontend-split-orchestrator.js +899 -0
- package/dist/workflows/dag/frontend-test-case-checklist.js +53 -5
- package/dist/workflows/dag/frontend-test-case-manifest.js +11 -4
- package/dist/workflows/dag/frontend-test-case-quality.js +11 -16
- package/dist/workflows/dag/frontend-test-environment-probe.js +230 -0
- package/dist/workflows/dag/frontend-test-html-report.js +3 -1
- package/dist/workflows/dag/frontend-test-l5-report.js +3 -1
- package/dist/workflows/dag/frontend-test-layout.js +159 -0
- package/dist/workflows/dag/frontend-test-markdown.js +61 -0
- package/dist/workflows/dag/frontend-test-rerun-candidates.js +103 -0
- package/dist/workflows/dag/frontend-test-result-contract.js +188 -42
- package/dist/workflows/dag/frontend-test-standard-scenarios.js +70 -0
- package/dist/workflows/dag/frontend-typed-event-store.js +452 -0
- package/dist/workflows/dag/frontend-typed-event-transaction.js +180 -0
- package/dist/workflows/dag/frontend-verification-trace.js +281 -29
- package/dist/workflows/dag/frontend-worktree-diff.js +250 -17
- package/dist/workflows/dag/frontend-writer-admission.js +319 -0
- package/dist/workflows/dag/frontend-writer-rollback.js +32 -0
- package/dist/workflows/dag/frontend-writer-status.js +256 -0
- package/dist/workflows/dag/init-hybrid.js +1675 -721
- package/dist/workflows/dag/interrupt-request.js +10 -3
- package/dist/workflows/dag/lifecycle.js +3 -3
- package/dist/workflows/dag/node-execution.js +1141 -32
- package/dist/workflows/dag/path-safety.js +1 -0
- package/dist/workflows/dag/prompt.js +158 -7
- package/dist/workflows/dag/recovery-lease.js +170 -0
- package/dist/workflows/dag/report.js +37 -1
- package/dist/workflows/dag/rerun-feedback.js +526 -0
- package/dist/workflows/dag/rerun-plan.js +790 -28
- package/dist/workflows/dag/rerun-run.js +700 -21
- package/dist/workflows/dag/rerun-task.js +311 -14
- package/dist/workflows/dag/retry-policy.js +336 -101
- package/dist/workflows/dag/runner.js +596 -121
- package/dist/workflows/dag/scheduler.js +133 -20
- package/dist/workflows/dag/skill-snapshot.js +17 -0
- package/dist/workflows/dag/structured-output-repair.js +712 -0
- package/dist/workflows/dag/types.js +585 -31
- package/dist/workflows/dag/validate.js +93 -32
- package/docs/README.md +2 -0
- package/docs/architecture/evolution.md +45 -0
- package/docs/architecture/runtime-boundaries.md +8 -7
- package/docs/architecture/worker-and-feature.md +1 -1
- package/docs/examples/README.md +5 -0
- package/docs/init-surface.manifest.json +36 -12
- package/docs/operations/README.md +1 -1
- package/docs/operations/local-development-environment.md +22 -5
- package/docs/skills/vetted-skill-registry.md +16 -0
- package/docs/templates/README.md +4 -2
- package/docs/templates/agent-dag-report.schema.json +8 -2
- package/docs/templates/agent-dag.schema.json +95 -1
- package/docs/templates/backend-test-dag.json +278 -244
- package/docs/templates/frontend-implementation-contract.schema.json +684 -24
- package/docs/templates/frontend-implementation-dag.json +89 -0
- package/docs/templates/frontend-test-case-checklist.md +2 -2
- package/docs/templates/frontend-test-dag.json +8 -10
- package/docs/templates/frontend-test-dag.retrieve-context.prompt.md +1 -1
- package/docs/templates/init-managed-agents.md +13 -3
- package/docs/templates/product-line/task.yaml +1 -1
- package/docs/templates/spec-registry.schema.json +45 -0
- package/harness.json +2 -2
- package/package.json +19 -5
- package/scripts/next-info.mjs +356 -0
- package/scripts/next-publish-gate.mjs +238 -0
- package/scripts/release-source-binding.mjs +251 -0
- package/skills/analyze-product-requirements/SKILL.md +8 -5
- package/skills/analyze-product-requirements/references/acceptance-criteria.md +1 -1
- package/skills/analyze-product-requirements/references/clarification-and-knowledge.md +10 -6
- package/skills/analyze-product-requirements/references/example.md +50 -0
- package/skills/analyze-product-requirements/references/forward-test-cases.md +11 -7
- package/skills/analyze-product-requirements/references/kb-integration.md +5 -5
- package/skills/analyze-product-requirements/references/product-analysis-schema.md +8 -4
- package/skills/analyze-product-requirements/references/product-requirement-schema.md +2 -2
- package/skills/analyze-product-requirements/references/requirement-clarification-schema.md +1 -1
- package/skills/analyze-product-requirements/scripts/test-validators.mjs +11 -1
- package/skills/analyze-product-requirements/scripts/validate-product-analysis.mjs +20 -1
- package/skills/analyze-product-requirements/scripts/validate-requirement-clarification.mjs +9 -0
- package/skills/codebase-scout/SKILL.md +1 -1
- package/skills/fe-test-ui-scout/SKILL.md +65 -0
- package/skills/fe-test-ui-scout/references/ledger-schema.md +62 -0
- package/skills/fe-test-ui-scout/references/recon-protocol.md +54 -0
- package/skills/frontend-bounded-implement/SKILL.md +15 -14
- package/skills/frontend-bounded-implement/references/code-standards.md +19 -0
- package/skills/frontend-contract/SKILL.md +23 -0
- package/skills/frontend-contract/references/contract-protocol.md +34 -0
- package/skills/frontend-design-review/SKILL.md +22 -41
- package/skills/frontend-plan/SKILL.md +26 -0
- package/skills/frontend-plan/references/decision-contract.md +37 -0
- package/skills/frontend-plan/references/design-decisions.md +17 -0
- package/skills/frontend-review/SKILL.md +20 -15
- package/skills/frontend-review/references/review-findings.md +6 -7
- package/skills/frontend-scout/SKILL.md +25 -0
- package/skills/frontend-scout/references/design-evidence.md +16 -0
- package/skills/frontend-scout/references/scout-evidence.md +23 -0
- package/skills/frontend-verification/SKILL.md +1 -1
- package/skills/improve-codebase-architecture/SKILL.md +81 -0
- package/skills/improve-codebase-architecture/deepening.md +37 -0
- package/skills/improve-codebase-architecture/html-report.md +123 -0
- package/skills/improve-codebase-architecture/interface-design.md +44 -0
- package/skills/improve-codebase-architecture/language.md +53 -0
- package/skills/loop-agent/references/command-reference.md +32 -4
- package/skills/loop-agent/references/hybrid-dag.md +9 -2
- package/skills/playwright-cli/SKILL.md +23 -1
- package/skills/playwright-cli-case-generator/SKILL.md +50 -13
- package/dist/worker/console/operation-store.js +0 -169
- package/dist/worker/console/static/assets/channel-Tl-FkUqr.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-BaehtRk4.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-BaehtRk4.js +0 -1
- package/dist/worker/console/static/assets/index-B7Y-0g3J.css +0 -1
- package/dist/worker/console/static/assets/index-DkCrqaYg.js +0 -325
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-eEhq2A8Y.js +0 -1
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-la8AC7fo.js +0 -8
- package/dist/worker/console/static-src/operator-chat/activity-rail-presentation.js +0 -73
- package/dist/worker/console/static-src/operator-chat/useActivityRailTransition.js +0 -59
- package/skills/frontend-implementation/SKILL.md +0 -52
- package/skills/frontend-implementation/references/code-standards.md +0 -33
- package/skills/frontend-implementation/references/design-spec.md +0 -56
- package/skills/frontend-implementation/references/node-contracts.md +0 -31
- /package/dist/{worker → infrastructure}/console/repo-fingerprint.js +0 -0
|
@@ -21,6 +21,17 @@ const REVIEW_VERDICT_NODE_ID = "review-verdict-recovery-pi";
|
|
|
21
21
|
const INITIAL_REVIEW_NODE_ID = "initial-review-pi";
|
|
22
22
|
const INITIAL_REVIEW_GATE_NODE_ID = "initial-review-gate-shell";
|
|
23
23
|
const INITIAL_REVIEW_PASS_NODE_ID = "initial-review-pass-shell";
|
|
24
|
+
/**
|
|
25
|
+
* Standard-dag governance verify chain ids. When the convergence chain
|
|
26
|
+
* observes the governance standard gate, a legitimate verify-pi
|
|
27
|
+
* `request-revision` re-enters a bounded implement-repair loop instead of
|
|
28
|
+
* terminating the run at the gate, mirroring the review-chain re-entry
|
|
29
|
+
* semantics (AC3/AC4). Protocol/provider/safety failures on verify-pi keep
|
|
30
|
+
* failing closed; only a safe `request-revision` drives code repair here.
|
|
31
|
+
*/
|
|
32
|
+
const GOVERNANCE_VERIFY_GATE_NODE_ID = "governance-standard-gate-shell";
|
|
33
|
+
const GOVERNANCE_VERIFY_NODE_ID = "verify-pi";
|
|
34
|
+
const GOVERNANCE_VERIFY_WRITER_NODE_ID = "implement-pi";
|
|
24
35
|
// Automatic code repair is authorized only for an ordinary command/test
|
|
25
36
|
// failure. Unknown, protocol, validation, provider, safety, governance, and
|
|
26
37
|
// human-decision categories all fail closed instead of reaching a writer.
|
|
@@ -57,6 +68,15 @@ export async function runConvergencePassController(input) {
|
|
|
57
68
|
}
|
|
58
69
|
const chain = getConvergenceChain(input.spec);
|
|
59
70
|
const observesReview = chain.includes(REVIEW_GATE_NODE_ID);
|
|
71
|
+
const observesGovernanceVerify = chain.includes(GOVERNANCE_VERIFY_GATE_NODE_ID);
|
|
72
|
+
// Standard-dag governance verify convergence: verify-pi drives a bounded
|
|
73
|
+
// implement-repair loop on `request-revision`. This shape has no
|
|
74
|
+
// hard-verify/review nodes; dispatch before the legacy hard-verify logic so
|
|
75
|
+
// the standard governance DAG never falls into `unsupported-dag-shape`/
|
|
76
|
+
// `non-retry-failure` dead ends.
|
|
77
|
+
if (observesGovernanceVerify && !observesReview) {
|
|
78
|
+
return handleGovernanceVerifyConvergence(input);
|
|
79
|
+
}
|
|
60
80
|
if (input.tasksById.has(INITIAL_REVIEW_NODE_ID)) {
|
|
61
81
|
const initialReview = input.state.nodes[INITIAL_REVIEW_NODE_ID];
|
|
62
82
|
const initialGate = input.state.nodes[INITIAL_REVIEW_GATE_NODE_ID];
|
|
@@ -397,6 +417,127 @@ async function handleReviewRequestRevision(input, reviewGate) {
|
|
|
397
417
|
function getConvergenceChain(spec) {
|
|
398
418
|
return spec.convergence?.chainNodeIds ?? DEFAULT_CONVERGENCE_CHAIN_NODE_IDS;
|
|
399
419
|
}
|
|
420
|
+
/**
|
|
421
|
+
* Legitimate governance verify revision: verify-pi finished and emitted
|
|
422
|
+
* `request-revision`. No secondary verdict-recovery node exists on the
|
|
423
|
+
* standard dag, so the single verify-pi verdict plus a non-transport failure
|
|
424
|
+
* category is the legitimacy bar (protocol-invalid/invalid-output/timeout on
|
|
425
|
+
* verify-pi fail closed instead of driving repair).
|
|
426
|
+
*/
|
|
427
|
+
function isLegitimateGovernanceVerifyRevision(state) {
|
|
428
|
+
const verifyNode = state.nodes[GOVERNANCE_VERIFY_NODE_ID];
|
|
429
|
+
return (verifyNode?.status === "FINISHED" &&
|
|
430
|
+
parseProcessVerdict(verifyNode) === "request-revision");
|
|
431
|
+
}
|
|
432
|
+
function isLegitimateGovernanceVerifyPass(state) {
|
|
433
|
+
const verifyNode = state.nodes[GOVERNANCE_VERIFY_NODE_ID];
|
|
434
|
+
return (verifyNode?.status === "FINISHED" &&
|
|
435
|
+
parseProcessVerdict(verifyNode) === "pass");
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Standard-dag governance verify convergence loop. Terminal pass when
|
|
439
|
+
* verify-pi passes; bounded re-entry (reset implement-pi + verify chain) when
|
|
440
|
+
* verify-pi legitimately requests revision. The reset lets the next
|
|
441
|
+
* implement-pi pass consume the prior verify findings through the structured
|
|
442
|
+
* convergence feedback block (node-execution injects it for implementer
|
|
443
|
+
* roles), so `already-satisfied` no-ops are explicitly contradicted by the
|
|
444
|
+
* preserved verify-pi evidence refs.
|
|
445
|
+
*/
|
|
446
|
+
async function handleGovernanceVerifyConvergence(input) {
|
|
447
|
+
const convergence = input.state.convergence;
|
|
448
|
+
const currentPass = convergence.currentPass || 1;
|
|
449
|
+
const verifyNode = input.state.nodes[GOVERNANCE_VERIFY_NODE_ID];
|
|
450
|
+
const verifyShell = input.state.nodes["verify-shell"];
|
|
451
|
+
// Hard verify commands failed: not a governance verdict issue. Without a
|
|
452
|
+
// supervised repair chain, this stays terminal so the failure-aware
|
|
453
|
+
// closeout reports it truthfully.
|
|
454
|
+
if (verifyShell?.status === "ERROR") {
|
|
455
|
+
const passRecord = await buildConvergencePassRecord({
|
|
456
|
+
pass: currentPass,
|
|
457
|
+
status: "terminal",
|
|
458
|
+
reason: "hard-verify-failed",
|
|
459
|
+
state: input.state,
|
|
460
|
+
runDir: input.runDir,
|
|
461
|
+
spec: input.spec,
|
|
462
|
+
});
|
|
463
|
+
convergence.passHistory.push(passRecord);
|
|
464
|
+
convergence.terminalReason = "hard-verify-failed";
|
|
465
|
+
await input.persistState();
|
|
466
|
+
return { retry: false };
|
|
467
|
+
}
|
|
468
|
+
if (isLegitimateGovernanceVerifyPass(input.state)) {
|
|
469
|
+
convergence.terminalReason = "hard-verify-pass";
|
|
470
|
+
await appendConvergenceKnowledgePattern({
|
|
471
|
+
cwd: input.cwd,
|
|
472
|
+
state: input.state,
|
|
473
|
+
});
|
|
474
|
+
return { retry: false };
|
|
475
|
+
}
|
|
476
|
+
const verifyFailureCategory = verifyNode?.failureCategory;
|
|
477
|
+
const legitimateRevision = isLegitimateGovernanceVerifyRevision(input.state);
|
|
478
|
+
if (!legitimateRevision ||
|
|
479
|
+
(verifyFailureCategory &&
|
|
480
|
+
REVIEW_SOURCE_NON_RETRY_FAILURES.has(verifyFailureCategory))) {
|
|
481
|
+
const passRecord = await buildConvergencePassRecord({
|
|
482
|
+
pass: currentPass,
|
|
483
|
+
status: "terminal",
|
|
484
|
+
reason: "non-retry-failure",
|
|
485
|
+
state: input.state,
|
|
486
|
+
runDir: input.runDir,
|
|
487
|
+
spec: input.spec,
|
|
488
|
+
});
|
|
489
|
+
convergence.passHistory.push(passRecord);
|
|
490
|
+
convergence.terminalReason = "non-retry-failure";
|
|
491
|
+
await input.persistState();
|
|
492
|
+
return { retry: false };
|
|
493
|
+
}
|
|
494
|
+
const passRecord = await buildConvergencePassRecord({
|
|
495
|
+
pass: currentPass,
|
|
496
|
+
status: "retrying",
|
|
497
|
+
reason: "verify-request-revision",
|
|
498
|
+
state: input.state,
|
|
499
|
+
runDir: input.runDir,
|
|
500
|
+
spec: input.spec,
|
|
501
|
+
});
|
|
502
|
+
if (currentPass >= convergence.maxPasses) {
|
|
503
|
+
passRecord.status = "terminal";
|
|
504
|
+
passRecord.reason = "max-passes";
|
|
505
|
+
convergence.passHistory.push(passRecord);
|
|
506
|
+
convergence.terminalReason = "max-passes";
|
|
507
|
+
await input.persistState();
|
|
508
|
+
return { retry: false };
|
|
509
|
+
}
|
|
510
|
+
convergence.passHistory.push(passRecord);
|
|
511
|
+
convergence.currentPass = currentPass + 1;
|
|
512
|
+
// Reset the writer plus the governance verify chain: the next implement-pi
|
|
513
|
+
// pass must consume the preserved verify-pi findings (injected as
|
|
514
|
+
// convergence feedback) instead of returning already-satisfied.
|
|
515
|
+
for (const id of collectGovernanceVerifyResetIds(input.spec)) {
|
|
516
|
+
const task = input.tasksById.get(id);
|
|
517
|
+
if (!task)
|
|
518
|
+
continue;
|
|
519
|
+
input.state.nodes[id] = freshNodeRecord(task);
|
|
520
|
+
}
|
|
521
|
+
await input.persistState();
|
|
522
|
+
return { retry: true };
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Reset set for the governance verify loop: the exclusive writer and the
|
|
526
|
+
* verify chain closure (verify-shell, verify-pi, governance gate, and every
|
|
527
|
+
* transitive descendant so closeout re-adjudicates from fresh evidence).
|
|
528
|
+
*/
|
|
529
|
+
function collectGovernanceVerifyResetIds(spec) {
|
|
530
|
+
const resetIds = new Set([
|
|
531
|
+
GOVERNANCE_VERIFY_WRITER_NODE_ID,
|
|
532
|
+
"verify-shell",
|
|
533
|
+
GOVERNANCE_VERIFY_NODE_ID,
|
|
534
|
+
GOVERNANCE_VERIFY_GATE_NODE_ID,
|
|
535
|
+
]);
|
|
536
|
+
for (const id of collectTransitiveDescendantTaskIds(spec, GOVERNANCE_VERIFY_GATE_NODE_ID)) {
|
|
537
|
+
resetIds.add(id);
|
|
538
|
+
}
|
|
539
|
+
return resetIds;
|
|
540
|
+
}
|
|
400
541
|
function hasConvergenceChain(tasksById, spec) {
|
|
401
542
|
const chain = getConvergenceChain(spec);
|
|
402
543
|
return chain.every((id) => tasksById.has(id));
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Leaf module for the retry-policy schema surface: failure-category constants,
|
|
4
|
+
* the zod retry-policy schema, and the target-template transient retry profile
|
|
5
|
+
* literal.
|
|
6
|
+
*
|
|
7
|
+
* `types.ts` reads `dagRetryPolicySchema` / `TARGET_TEMPLATE_TRANSIENT_RETRY_PROFILE`
|
|
8
|
+
* during its own module initialization, and the retry-policy module transitively
|
|
9
|
+
* reaches `types.ts` (retry-policy → frontend-recovery-capsule →
|
|
10
|
+
* frontend-recovery-lineage → frontend-implementation-contract → types). With
|
|
11
|
+
* these definitions living in retry-policy itself, a run whose entry module is
|
|
12
|
+
* retry-policy (e.g. test/dag-node-retry.test.ts) evaluates `types.ts` while
|
|
13
|
+
* retry-policy is still initializing and reads an undefined
|
|
14
|
+
* `dagRetryPolicySchema`. Keeping this module a leaf (zod is its only import)
|
|
15
|
+
* makes the cycle resolve order-independently; retry-policy re-exports
|
|
16
|
+
* everything for source compatibility.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Failure categories that are safe to auto-retry for read-only Pi nodes.
|
|
20
|
+
*
|
|
21
|
+
* These are failures with no repository write side-effects: model connection
|
|
22
|
+
* interruption, provider rate-limiting, temporary provider unavailability,
|
|
23
|
+
* request timeout, or a settled read-only turn with no assistant text.
|
|
24
|
+
*
|
|
25
|
+
* `quota` is intentionally NOT included: a quota exhaustion is an account
|
|
26
|
+
* billing/plan state, not a transient rate limit, and retrying immediately
|
|
27
|
+
* will not help and may waste budget.
|
|
28
|
+
*/
|
|
29
|
+
export const DEFAULT_DAG_RETRY_CATEGORIES = [
|
|
30
|
+
"timeout",
|
|
31
|
+
"network",
|
|
32
|
+
"rate-limit",
|
|
33
|
+
"unavailable",
|
|
34
|
+
"empty-output",
|
|
35
|
+
];
|
|
36
|
+
export const STRUCTURED_OUTPUT_RETRY_CATEGORY = "output-too-large";
|
|
37
|
+
export const PROTOCOL_INVALID_RETRY_CATEGORY = "protocol-invalid";
|
|
38
|
+
/** Recoverable model artifact/schema formatting failure on read-only structured nodes. */
|
|
39
|
+
export const STRUCTURED_ARTIFACT_INVALID_RETRY_CATEGORY = "invalid-output";
|
|
40
|
+
/** Provider stopReason=length truncated the response before the JSON contract completed. */
|
|
41
|
+
export const STRUCTURED_OUTPUT_TRUNCATED_RETRY_CATEGORY = "structured-output-truncated";
|
|
42
|
+
/**
|
|
43
|
+
* The review node emitted a verdict in response text (e.g. "VERDICT: pass")
|
|
44
|
+
* but never committed the authoritative typed terminal tool call
|
|
45
|
+
* (approve_review / request_review_changes). Read-only and safe to retry with
|
|
46
|
+
* a corrected instruction; the typed terminal is the only authority.
|
|
47
|
+
*/
|
|
48
|
+
export const REVIEW_TERMINAL_MISSING_RETRY_CATEGORY = "review-terminal-missing";
|
|
49
|
+
/**
|
|
50
|
+
* The plan node issued too many read-only tool calls (read/grep/ls/find),
|
|
51
|
+
* blowing up the context window and eventually a 400 request-too-large. The
|
|
52
|
+
* plan should trust upstream typed facts instead of re-reading contract/scout
|
|
53
|
+
* outputs and source files repeatedly. Read-only and safe to retry with a
|
|
54
|
+
* reduced-reading instruction.
|
|
55
|
+
*/
|
|
56
|
+
export const READ_BURST_RETRY_CATEGORY = "read-burst";
|
|
57
|
+
/**
|
|
58
|
+
* Provider returned a context-overflow error (400 request-too-large / context
|
|
59
|
+
* window exceeded). The SDK compacts and auto-retries once internally; when it
|
|
60
|
+
* still surfaces, the executor classifies this so retry policies and reports
|
|
61
|
+
* treat it as overflow (not empty-output) and can retry with a compacted
|
|
62
|
+
* session / fresh context.
|
|
63
|
+
*/
|
|
64
|
+
export const CONTEXT_OVERFLOW_RETRY_CATEGORY = "context-overflow";
|
|
65
|
+
/** Retry only a proven no-op from an explicitly opt-in bounded Pi writer. */
|
|
66
|
+
export const WRITER_EMPTY_DIFF_RETRY_CATEGORY = "writer-empty-diff";
|
|
67
|
+
/** Retry when a backend-test writer finished but Completeness Gate found missing/broken targets. */
|
|
68
|
+
export const INCOMPLETE_WRITE_SET_RETRY_CATEGORY = "incomplete-write-set";
|
|
69
|
+
/**
|
|
70
|
+
* Provider/transport stall or absolute timeout on a Pi exclusive writer that
|
|
71
|
+
* left zero attributed workspace writes and zero write-tool calls. Safe to
|
|
72
|
+
* retry once because the attempt was a pure provider flake (no side effects).
|
|
73
|
+
* Partial writes keep the original `timeout` category and do NOT retry.
|
|
74
|
+
*/
|
|
75
|
+
export const WRITER_CLEAN_TIMEOUT_RETRY_CATEGORY = "writer-clean-timeout";
|
|
76
|
+
export const STRUCTURED_REQUIRED_DAG_RETRY_CATEGORIES = [
|
|
77
|
+
...DEFAULT_DAG_RETRY_CATEGORIES,
|
|
78
|
+
STRUCTURED_OUTPUT_RETRY_CATEGORY,
|
|
79
|
+
STRUCTURED_ARTIFACT_INVALID_RETRY_CATEGORY,
|
|
80
|
+
STRUCTURED_OUTPUT_TRUNCATED_RETRY_CATEGORY,
|
|
81
|
+
];
|
|
82
|
+
/** Categories allowed on nodes that declare a machine-readable outputProtocol. */
|
|
83
|
+
export const PROTOCOL_AWARE_DAG_RETRY_CATEGORIES = [
|
|
84
|
+
...DEFAULT_DAG_RETRY_CATEGORIES,
|
|
85
|
+
PROTOCOL_INVALID_RETRY_CATEGORY,
|
|
86
|
+
STRUCTURED_ARTIFACT_INVALID_RETRY_CATEGORY,
|
|
87
|
+
];
|
|
88
|
+
export const ALL_DAG_RETRY_CATEGORIES = [
|
|
89
|
+
...DEFAULT_DAG_RETRY_CATEGORIES,
|
|
90
|
+
STRUCTURED_OUTPUT_RETRY_CATEGORY,
|
|
91
|
+
PROTOCOL_INVALID_RETRY_CATEGORY,
|
|
92
|
+
STRUCTURED_ARTIFACT_INVALID_RETRY_CATEGORY,
|
|
93
|
+
STRUCTURED_OUTPUT_TRUNCATED_RETRY_CATEGORY,
|
|
94
|
+
WRITER_EMPTY_DIFF_RETRY_CATEGORY,
|
|
95
|
+
INCOMPLETE_WRITE_SET_RETRY_CATEGORY,
|
|
96
|
+
WRITER_CLEAN_TIMEOUT_RETRY_CATEGORY,
|
|
97
|
+
REVIEW_TERMINAL_MISSING_RETRY_CATEGORY,
|
|
98
|
+
READ_BURST_RETRY_CATEGORY,
|
|
99
|
+
CONTEXT_OVERFLOW_RETRY_CATEGORY,
|
|
100
|
+
];
|
|
101
|
+
export const dagRetryCategorySchema = z.enum(ALL_DAG_RETRY_CATEGORIES);
|
|
102
|
+
export const dagRetryBackoffSchema = z.enum(["exponential"]);
|
|
103
|
+
/**
|
|
104
|
+
* Opt-in retry policy for a DagTask. Generated for safe read-only Pi nodes,
|
|
105
|
+
* except the single validation-gated writer-empty-diff policy. Validation
|
|
106
|
+
* rejects all other writers, dynamic, shell, static, and decision-gate nodes.
|
|
107
|
+
*/
|
|
108
|
+
export const dagRetryPolicySchema = z
|
|
109
|
+
.object({
|
|
110
|
+
/**
|
|
111
|
+
* Total number of attempts (including the first try). Must be 1..5.
|
|
112
|
+
* A value of 1 disables retry (one attempt, no retry).
|
|
113
|
+
*/
|
|
114
|
+
maxAttempts: z.number().int().positive().max(5),
|
|
115
|
+
backoff: dagRetryBackoffSchema.default("exponential"),
|
|
116
|
+
/** Initial delay before the second attempt, in milliseconds. */
|
|
117
|
+
initialDelayMs: z.number().int().nonnegative().default(2000),
|
|
118
|
+
/** Upper bound on a single backoff delay, in milliseconds. */
|
|
119
|
+
maxDelayMs: z.number().int().nonnegative().default(30000),
|
|
120
|
+
/**
|
|
121
|
+
* Explicit set of failure categories eligible for retry. Defaults to
|
|
122
|
+
* {@link DEFAULT_DAG_RETRY_CATEGORIES}. `quota` and other categories
|
|
123
|
+
* are never retried.
|
|
124
|
+
*/
|
|
125
|
+
retryCategories: z
|
|
126
|
+
.array(dagRetryCategorySchema)
|
|
127
|
+
.default([...DEFAULT_DAG_RETRY_CATEGORIES]),
|
|
128
|
+
})
|
|
129
|
+
.superRefine((policy, ctx) => {
|
|
130
|
+
if (policy.maxDelayMs < policy.initialDelayMs) {
|
|
131
|
+
ctx.addIssue({
|
|
132
|
+
code: z.ZodIssueCode.custom,
|
|
133
|
+
message: "retryPolicy.maxDelayMs must be >= retryPolicy.initialDelayMs",
|
|
134
|
+
path: ["maxDelayMs"],
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
export const TARGET_TEMPLATE_TRANSIENT_RETRY_PROFILE = "standard-reviewed-supervised-v1";
|
|
@@ -76,7 +76,7 @@ export async function executeDynamicLoopUntil(input) {
|
|
|
76
76
|
bodyIdMap,
|
|
77
77
|
}));
|
|
78
78
|
for (const child of children) {
|
|
79
|
-
assertValidMaterializedDagTask(child);
|
|
79
|
+
assertValidMaterializedDagTask(child, input.spec);
|
|
80
80
|
if (!input.tasksById.has(child.id)) {
|
|
81
81
|
input.tasksById.set(child.id, child);
|
|
82
82
|
input.spec.tasks.push(child);
|
|
@@ -26,6 +26,7 @@ export function buildExpandedChildTask(input) {
|
|
|
26
26
|
allowedPaths: renderDynamicPatternList(child.allowedPaths, item, index, expansion.itemName) ?? [],
|
|
27
27
|
forbiddenPaths: renderDynamicPatternList(child.forbiddenPaths, item, index, expansion.itemName) ?? [],
|
|
28
28
|
writeSet: renderDynamicPatternList(child.writeSet, item, index, expansion.itemName),
|
|
29
|
+
readSet: renderDynamicPatternList(child.readSet, item, index, expansion.itemName),
|
|
29
30
|
outputContract: child.outputContract,
|
|
30
31
|
writerOutcomePolicy: child.writerOutcomePolicy,
|
|
31
32
|
writeGuardPolicy: child.writeGuardPolicy,
|
|
@@ -176,7 +177,7 @@ export async function executeDynamicMapExpansion(input) {
|
|
|
176
177
|
nodeId,
|
|
177
178
|
}));
|
|
178
179
|
for (const child of children) {
|
|
179
|
-
assertValidMaterializedDagTask(child);
|
|
180
|
+
assertValidMaterializedDagTask(child, input.spec);
|
|
180
181
|
}
|
|
181
182
|
const writeSetConflicts = collectDynamicChildWriteSetConflicts(children);
|
|
182
183
|
if (writeSetConflicts.length > 0) {
|
|
@@ -1,118 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"human-required",
|
|
10
|
-
"human-rejected",
|
|
11
|
-
"shell-command",
|
|
12
|
-
"static-error",
|
|
13
|
-
"decision-envelope",
|
|
14
|
-
"skipped",
|
|
15
|
-
"unknown",
|
|
16
|
-
]);
|
|
2
|
+
import { DAG_NORMALIZED_FAILURE_CATEGORY_VALUES } from "../../shared/dag-failure-category.js";
|
|
3
|
+
// The pure classification core lives in src/shared/dag-failure-category.ts so
|
|
4
|
+
// the Operator Console projection can normalize raw CLI categories without
|
|
5
|
+
// importing the workflows kernel (console/workflows boundary test). This
|
|
6
|
+
// module keeps the schema surface for the DAG kernel's existing consumers.
|
|
7
|
+
export { isDagFailureCategory, normalizeDagFailureCategory, } from "../../shared/dag-failure-category.js";
|
|
8
|
+
export const dagNormalizedFailureCategorySchema = z.enum(DAG_NORMALIZED_FAILURE_CATEGORY_VALUES);
|
|
17
9
|
export const DAG_NORMALIZED_FAILURE_CATEGORIES = dagNormalizedFailureCategorySchema.options;
|
|
18
|
-
const RAW_TO_NORMALIZED = {
|
|
19
|
-
success: "success",
|
|
20
|
-
"write-guard": "write-guard",
|
|
21
|
-
timeout: "timeout",
|
|
22
|
-
// Clean implementer stall with zero writes — still a timeout class for report,
|
|
23
|
-
// but retryable under WRITER_TRANSPORT_RETRY_POLICY.
|
|
24
|
-
"writer-clean-timeout": "timeout",
|
|
25
|
-
"missing-api-key": "auth",
|
|
26
|
-
auth: "auth",
|
|
27
|
-
"human-rejected": "human-rejected",
|
|
28
|
-
"human-required": "human-required",
|
|
29
|
-
"decision-envelope-invalid": "decision-envelope",
|
|
30
|
-
"nonzero-exit": "shell-command",
|
|
31
|
-
"spawn-error": "shell-command",
|
|
32
|
-
"static-error": "static-error",
|
|
33
|
-
"invalid-output": "validation",
|
|
34
|
-
"path-violation": "validation",
|
|
35
|
-
"empty-output": "validation",
|
|
36
|
-
"verify-failure": "validation",
|
|
37
|
-
"test-failure": "validation",
|
|
38
|
-
"verification-plan-stale": "validation",
|
|
39
|
-
network: "executor",
|
|
40
|
-
quota: "executor",
|
|
41
|
-
"rate-limit": "executor",
|
|
42
|
-
unavailable: "executor",
|
|
43
|
-
unknown: "unknown",
|
|
44
|
-
};
|
|
45
|
-
function isFinishedStatus(status) {
|
|
46
|
-
return status === "FINISHED" || status === "finished";
|
|
47
|
-
}
|
|
48
|
-
function isInProgressStatus(status) {
|
|
49
|
-
return (status === "PENDING" ||
|
|
50
|
-
status === "RUNNING" ||
|
|
51
|
-
status === "pending" ||
|
|
52
|
-
status === "running");
|
|
53
|
-
}
|
|
54
|
-
function isFailureStatus(status) {
|
|
55
|
-
return (status === "ERROR" ||
|
|
56
|
-
status === "failed" ||
|
|
57
|
-
status === "partial_failed");
|
|
58
|
-
}
|
|
59
|
-
function mapRawCategory(raw) {
|
|
60
|
-
const direct = RAW_TO_NORMALIZED[raw];
|
|
61
|
-
if (direct)
|
|
62
|
-
return direct;
|
|
63
|
-
const lower = raw.toLowerCase();
|
|
64
|
-
if (lower.includes("timeout"))
|
|
65
|
-
return "timeout";
|
|
66
|
-
if (lower.includes("validation") ||
|
|
67
|
-
lower.includes("invalid") ||
|
|
68
|
-
lower.includes("verification-plan-stale") ||
|
|
69
|
-
lower.includes("plan-stale"))
|
|
70
|
-
return "validation";
|
|
71
|
-
if (lower.includes("auth") || lower.includes("api-key"))
|
|
72
|
-
return "auth";
|
|
73
|
-
if (lower.includes("write-guard") || lower.includes("write_guard"))
|
|
74
|
-
return "write-guard";
|
|
75
|
-
if (lower.includes("decision-envelope") || lower.includes("decision_envelope"))
|
|
76
|
-
return "decision-envelope";
|
|
77
|
-
if (lower.includes("human-rejected"))
|
|
78
|
-
return "human-rejected";
|
|
79
|
-
if (lower.includes("human-required"))
|
|
80
|
-
return "human-required";
|
|
81
|
-
if (lower.includes("static-error"))
|
|
82
|
-
return "static-error";
|
|
83
|
-
if (lower.includes("nonzero-exit") ||
|
|
84
|
-
lower.includes("spawn-error") ||
|
|
85
|
-
lower.includes("shell"))
|
|
86
|
-
return "shell-command";
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
export function isDagFailureCategory(value) {
|
|
90
|
-
return DAG_NORMALIZED_FAILURE_CATEGORIES.includes(value);
|
|
91
|
-
}
|
|
92
|
-
export function normalizeDagFailureCategory(raw, status) {
|
|
93
|
-
if (status === "SKIPPED") {
|
|
94
|
-
return "skipped";
|
|
95
|
-
}
|
|
96
|
-
if (raw !== undefined) {
|
|
97
|
-
const mapped = mapRawCategory(raw);
|
|
98
|
-
if (mapped) {
|
|
99
|
-
if (mapped === "success") {
|
|
100
|
-
return isFinishedStatus(status) ? "success" : "unknown";
|
|
101
|
-
}
|
|
102
|
-
return mapped;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (raw === undefined && isFinishedStatus(status)) {
|
|
106
|
-
return "success";
|
|
107
|
-
}
|
|
108
|
-
if (isInProgressStatus(status)) {
|
|
109
|
-
return "unknown";
|
|
110
|
-
}
|
|
111
|
-
if (isFailureStatus(status)) {
|
|
112
|
-
return "unknown";
|
|
113
|
-
}
|
|
114
|
-
if (raw === "success" && isFinishedStatus(status)) {
|
|
115
|
-
return "success";
|
|
116
|
-
}
|
|
117
|
-
return "unknown";
|
|
118
|
-
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export { buildFrontendShapeTransitionCapsule, computeFrontendShapeSourceDigest, evaluateFrontendShapeEscalation, FRONTEND_SHAPE_NODE_COUNTS, frontendShapeTransitionCapsuleSchema, frontendShapeTransitionReshapeCapsuleSchema, frontendShapeTransitionSplitCapsuleSchema, parseFrontendShapeTransitionCapsule, resolveFrontendTaskShape, } from "./frontend-shape.js";
|
|
3
|
+
/**
|
|
4
|
+
* Deterministic frontend closeout facts + renderer (M7).
|
|
5
|
+
*
|
|
6
|
+
* The functions here are pure (no I/O, no model, no side effects). The closeout
|
|
7
|
+
* renderer reads only committed facts, never model summaries or node prose, so
|
|
8
|
+
* a weak conclusion (failed / not-run / baseline-debt / mock-backed / pending)
|
|
9
|
+
* can never be rewritten into a stronger one (passed / real-integrated).
|
|
10
|
+
*
|
|
11
|
+
* Canonical shape routing and transition capsules live in `frontend-shape.ts`
|
|
12
|
+
* and are re-exported here for callers that also consume closeout contracts.
|
|
13
|
+
*/
|
|
14
|
+
export const FRONTEND_CLOSEOUT_FACTS_SCHEMA_ID = "frontend-closeout-facts-v1";
|
|
15
|
+
/* ------------------------------------------------------------------ *
|
|
16
|
+
* Enums + facts schema *
|
|
17
|
+
* ------------------------------------------------------------------ */
|
|
18
|
+
export const frontendCoverageStatusSchema = z.enum([
|
|
19
|
+
"passed",
|
|
20
|
+
"failed",
|
|
21
|
+
"not-run",
|
|
22
|
+
"blocked",
|
|
23
|
+
"unavailable",
|
|
24
|
+
]);
|
|
25
|
+
export const frontendLintStatusSchema = z.enum([
|
|
26
|
+
"passed",
|
|
27
|
+
"baseline-debt",
|
|
28
|
+
"failed",
|
|
29
|
+
"unavailable",
|
|
30
|
+
]);
|
|
31
|
+
export const frontendIntegrationFactsSchema = z.enum([
|
|
32
|
+
"real-api",
|
|
33
|
+
"mock-backed",
|
|
34
|
+
"local-no-remote",
|
|
35
|
+
"unavailable",
|
|
36
|
+
]);
|
|
37
|
+
export const frontendCloseoutFactsSchema = z
|
|
38
|
+
.object({
|
|
39
|
+
schemaVersion: z.literal(1),
|
|
40
|
+
schemaId: z.literal(FRONTEND_CLOSEOUT_FACTS_SCHEMA_ID),
|
|
41
|
+
coverageMatrix: z.array(z
|
|
42
|
+
.object({
|
|
43
|
+
verificationTargetId: z.string().min(1),
|
|
44
|
+
status: frontendCoverageStatusSchema,
|
|
45
|
+
})
|
|
46
|
+
.strict()),
|
|
47
|
+
lintStatus: frontendLintStatusSchema,
|
|
48
|
+
integrationFacts: frontendIntegrationFactsSchema,
|
|
49
|
+
reviewApproval: z
|
|
50
|
+
.object({
|
|
51
|
+
typedVerdict: z
|
|
52
|
+
.enum(["approve_review", "request_review_changes"])
|
|
53
|
+
.nullable(),
|
|
54
|
+
legacyVerdict: z.enum(["pass", "request-revision"]).nullable(),
|
|
55
|
+
match: z.boolean(),
|
|
56
|
+
})
|
|
57
|
+
.strict(),
|
|
58
|
+
cumulativeDiff: z
|
|
59
|
+
.object({
|
|
60
|
+
cumulativeDigest: z.string().min(1),
|
|
61
|
+
empty: z.boolean(),
|
|
62
|
+
})
|
|
63
|
+
.strict(),
|
|
64
|
+
notRun: z
|
|
65
|
+
.object({
|
|
66
|
+
browser: z.literal("not-run"),
|
|
67
|
+
visual: z.literal("not-run"),
|
|
68
|
+
})
|
|
69
|
+
.strict(),
|
|
70
|
+
pendingRealIntegration: z.boolean(),
|
|
71
|
+
residualRisks: z.array(z.string().min(1)).optional(),
|
|
72
|
+
evidenceGaps: z.array(z.string().min(1)).optional(),
|
|
73
|
+
})
|
|
74
|
+
.strict();
|
|
75
|
+
/* ------------------------------------------------------------------ *
|
|
76
|
+
* FrontendTestHandoff (A+B AC-010) *
|
|
77
|
+
* ------------------------------------------------------------------ */
|
|
78
|
+
export const FRONTEND_TEST_HANDOFF_SCHEMA_ID = "frontend-test-handoff-v1";
|
|
79
|
+
/**
|
|
80
|
+
* A+B (AC-010): deterministic frontend-test handoff. Bound to the task id,
|
|
81
|
+
* source digest, and candidate hash; browser/visual/runtime-a11y are always
|
|
82
|
+
* `not-run` and the handoff is always `deferred-to-frontend-test`, so a weak
|
|
83
|
+
* closeout can never block implementation and can never be rewritten as
|
|
84
|
+
* passed.
|
|
85
|
+
*/
|
|
86
|
+
export const frontendTestHandoffSchema = z
|
|
87
|
+
.object({
|
|
88
|
+
schemaVersion: z.literal(1),
|
|
89
|
+
schemaId: z.literal(FRONTEND_TEST_HANDOFF_SCHEMA_ID),
|
|
90
|
+
taskId: z.string().min(1),
|
|
91
|
+
sourceDigest: z.string().regex(/^[a-f0-9]{64}$/),
|
|
92
|
+
candidateHash: z.string().regex(/^[a-f0-9]{64}$/),
|
|
93
|
+
executionStatus: z.literal("not-run"),
|
|
94
|
+
handoffStatus: z.literal("deferred-to-frontend-test"),
|
|
95
|
+
nonBlocking: z.literal(true),
|
|
96
|
+
})
|
|
97
|
+
.strict();
|
|
98
|
+
export function buildFrontendTestHandoff(input) {
|
|
99
|
+
return frontendTestHandoffSchema.parse({
|
|
100
|
+
schemaVersion: 1,
|
|
101
|
+
schemaId: FRONTEND_TEST_HANDOFF_SCHEMA_ID,
|
|
102
|
+
taskId: input.taskId,
|
|
103
|
+
sourceDigest: input.sourceDigest,
|
|
104
|
+
candidateHash: input.candidateHash,
|
|
105
|
+
executionStatus: "not-run",
|
|
106
|
+
handoffStatus: "deferred-to-frontend-test",
|
|
107
|
+
nonBlocking: true,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Deterministic, fail-closed mapping from structured evidence to integration
|
|
112
|
+
* facts. Never reads model text. `real-api` is the only value that may report
|
|
113
|
+
* real integration, and it requires both real passed evidence and satisfied
|
|
114
|
+
* required verification evidence. Anything else downgrades to pending.
|
|
115
|
+
*/
|
|
116
|
+
export function deriveFrontendIntegrationFacts(input) {
|
|
117
|
+
const requiredEvidenceSatisfied = input.verificationTargets.length > 0 &&
|
|
118
|
+
input.verificationTargets.every((target) => target.status === "ok");
|
|
119
|
+
if (input.realApiEvidence.present &&
|
|
120
|
+
input.realApiEvidence.passed &&
|
|
121
|
+
requiredEvidenceSatisfied) {
|
|
122
|
+
return "real-api";
|
|
123
|
+
}
|
|
124
|
+
// Required evidence not satisfied → never report real-integrated or
|
|
125
|
+
// mock/locally-validated; evidence is unavailable.
|
|
126
|
+
if (!requiredEvidenceSatisfied) {
|
|
127
|
+
return "unavailable";
|
|
128
|
+
}
|
|
129
|
+
if (input.mockStrategy !== "not-needed" && input.mockEvidenceBound) {
|
|
130
|
+
return "mock-backed";
|
|
131
|
+
}
|
|
132
|
+
if (input.mockStrategy === "not-needed" && !input.realApiEvidence.present) {
|
|
133
|
+
return "local-no-remote";
|
|
134
|
+
}
|
|
135
|
+
return "unavailable";
|
|
136
|
+
}
|
|
137
|
+
/* ------------------------------------------------------------------ *
|
|
138
|
+
* Deterministic closeout renderer *
|
|
139
|
+
* ------------------------------------------------------------------ */
|
|
140
|
+
function bulletList(items) {
|
|
141
|
+
if (!items || items.length === 0)
|
|
142
|
+
return "";
|
|
143
|
+
return items.map((item) => `- ${item}`).join("\n");
|
|
144
|
+
}
|
|
145
|
+
function coverageLines(facts) {
|
|
146
|
+
const lines = facts.coverageMatrix.map((entry) => `- ${entry.verificationTargetId}: ${entry.status}`);
|
|
147
|
+
return lines.length > 0 ? lines.join("\n") : "_(none)_";
|
|
148
|
+
}
|
|
149
|
+
function frontendStatus(facts) {
|
|
150
|
+
switch (facts.integrationFacts) {
|
|
151
|
+
case "real-api":
|
|
152
|
+
return "Frontend status: real-integrated";
|
|
153
|
+
case "mock-backed":
|
|
154
|
+
return "Frontend status: mock-validated";
|
|
155
|
+
case "local-no-remote":
|
|
156
|
+
return "Frontend status: locally-validated";
|
|
157
|
+
case "unavailable":
|
|
158
|
+
return "Frontend status: unverified";
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function integrationStatus(facts) {
|
|
162
|
+
return facts.integrationFacts === "real-api"
|
|
163
|
+
? "Real integration: validated"
|
|
164
|
+
: `Real integration: pending (${facts.integrationFacts})`;
|
|
165
|
+
}
|
|
166
|
+
function reviewApprovalLines(facts) {
|
|
167
|
+
const { typedVerdict, legacyVerdict, match } = facts.reviewApproval;
|
|
168
|
+
return [
|
|
169
|
+
`typed: ${typedVerdict ?? "none"}`,
|
|
170
|
+
`legacy: ${legacyVerdict ?? "none"}`,
|
|
171
|
+
`match: ${match}`,
|
|
172
|
+
].join("\n");
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Render a deterministic closeout Markdown document from committed facts only.
|
|
176
|
+
* The same facts always render byte-identical output; weak statuses are
|
|
177
|
+
* emitted verbatim and never promoted to `passed` / real-integrated.
|
|
178
|
+
*/
|
|
179
|
+
export function renderFrontendCloseout(facts) {
|
|
180
|
+
const lintLine = facts.lintStatus === "baseline-debt"
|
|
181
|
+
? `${facts.lintStatus} (explicit debt; not passed)`
|
|
182
|
+
: facts.lintStatus;
|
|
183
|
+
return [
|
|
184
|
+
"# Frontend Closeout",
|
|
185
|
+
"",
|
|
186
|
+
"## Coverage Matrix",
|
|
187
|
+
coverageLines(facts),
|
|
188
|
+
"",
|
|
189
|
+
"## Lint Status",
|
|
190
|
+
lintLine,
|
|
191
|
+
"",
|
|
192
|
+
"## Integration Facts",
|
|
193
|
+
facts.integrationFacts,
|
|
194
|
+
"",
|
|
195
|
+
"## Frontend Status",
|
|
196
|
+
frontendStatus(facts),
|
|
197
|
+
"",
|
|
198
|
+
"## Real Integration Status",
|
|
199
|
+
integrationStatus(facts),
|
|
200
|
+
"",
|
|
201
|
+
"## Real Integration Pending",
|
|
202
|
+
facts.pendingRealIntegration ? "yes" : "no",
|
|
203
|
+
"",
|
|
204
|
+
"## Review Approval",
|
|
205
|
+
reviewApprovalLines(facts),
|
|
206
|
+
"",
|
|
207
|
+
"## Cumulative Diff",
|
|
208
|
+
`digest: ${facts.cumulativeDiff.cumulativeDigest}`,
|
|
209
|
+
`empty: ${facts.cumulativeDiff.empty}`,
|
|
210
|
+
"",
|
|
211
|
+
"## Browser / Visual",
|
|
212
|
+
`Browser: ${facts.notRun.browser}`,
|
|
213
|
+
`Visual: ${facts.notRun.visual}`,
|
|
214
|
+
"",
|
|
215
|
+
"## Residual Risks",
|
|
216
|
+
bulletList(facts.residualRisks) || "_(none)_",
|
|
217
|
+
"",
|
|
218
|
+
"## Evidence Gaps",
|
|
219
|
+
bulletList(facts.evidenceGaps) || "_(none)_",
|
|
220
|
+
].join("\n") + "\n";
|
|
221
|
+
}
|