@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
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { parseJsonReviewVerdict } from "./output-protocol.js";
|
|
5
|
+
import { FRONTEND_DESIGN_REVIEW_NODE_ID, FRONTEND_REVIEW_NODE_ID, readCommittedDesignRequestFact, readCommittedReviewRequestFact, } from "./frontend-review-findings.js";
|
|
6
|
+
import { readTypedEventStoreFromJsonl } from "./frontend-typed-event-store.js";
|
|
7
|
+
export const MAX_RERUN_FEEDBACK_CHARS = 12_000;
|
|
8
|
+
const RERUN_FEEDBACK_TRUNCATION_MARKER = "\n\n...[上一轮反馈已按长度上限截断]...\n\n";
|
|
9
|
+
const MAX_EVIDENCE_REFS = 8;
|
|
10
|
+
function sha256(value) {
|
|
11
|
+
return createHash("sha256").update(value).digest("hex");
|
|
12
|
+
}
|
|
13
|
+
function withDigest(payload) {
|
|
14
|
+
return {
|
|
15
|
+
...payload,
|
|
16
|
+
digest: sha256(JSON.stringify(payload)),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function sourceBindingHash(spec) {
|
|
20
|
+
return spec.sourceBinding
|
|
21
|
+
? sha256(JSON.stringify(spec.sourceBinding))
|
|
22
|
+
: undefined;
|
|
23
|
+
}
|
|
24
|
+
function canonicalNodeOutput(node) {
|
|
25
|
+
const assistantText = node?.assistantText?.trim();
|
|
26
|
+
return assistantText || node?.stdout?.trim() || "";
|
|
27
|
+
}
|
|
28
|
+
function requestRevision(text) {
|
|
29
|
+
const jsonVerdict = parseJsonReviewVerdict(text);
|
|
30
|
+
if (jsonVerdict.ok)
|
|
31
|
+
return jsonVerdict.verdict === "request-revision";
|
|
32
|
+
return text
|
|
33
|
+
.split(/\r?\n/)
|
|
34
|
+
.some((line) => {
|
|
35
|
+
const trimmed = line.trim();
|
|
36
|
+
const emphasized = trimmed.match(/^\*{1,3}\s*(VERDICT:[^*]+?)\s*\*{1,3}$/);
|
|
37
|
+
return (emphasized?.[1] ?? trimmed).trim() === "VERDICT: request-revision";
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Deterministically render a typed `request_review_changes` fact into feedback
|
|
42
|
+
* text. Unlike the legacy text channel (VERDICT: request-revision), the
|
|
43
|
+
* frontend review terminal is a committed typed fact; the findings are the
|
|
44
|
+
* actionable body the next round must consume.
|
|
45
|
+
*/
|
|
46
|
+
export function formatTypedReviewRequestFeedback(fact) {
|
|
47
|
+
const lines = [];
|
|
48
|
+
lines.push(`frontend review committed request_review_changes (issueCategory=${typeof fact.issueCategory === "string" ? fact.issueCategory : "unknown"})`);
|
|
49
|
+
if (Array.isArray(fact.findings) && fact.findings.length > 0) {
|
|
50
|
+
lines.push("review findings:");
|
|
51
|
+
for (const finding of fact.findings) {
|
|
52
|
+
if (!finding || typeof finding !== "object")
|
|
53
|
+
continue;
|
|
54
|
+
const record = finding;
|
|
55
|
+
const severity = typeof record.severity === "string" ? record.severity : "";
|
|
56
|
+
const issue = typeof record.issue === "string" ? record.issue : "";
|
|
57
|
+
const location = [
|
|
58
|
+
typeof record.file === "string" ? record.file : "",
|
|
59
|
+
typeof record.line === "number" ? String(record.line) : "",
|
|
60
|
+
]
|
|
61
|
+
.filter(Boolean)
|
|
62
|
+
.join(":");
|
|
63
|
+
const prefix = location ? `[${location}] ` : "";
|
|
64
|
+
const requiredChange = typeof record.requiredChange === "string" &&
|
|
65
|
+
record.requiredChange.length > 0
|
|
66
|
+
? ` (requiredChange: ${record.requiredChange})`
|
|
67
|
+
: "";
|
|
68
|
+
lines.push(`- ${prefix}${severity}: ${issue}${requiredChange}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (Array.isArray(fact.evidenceRefs) && fact.evidenceRefs.length > 0) {
|
|
72
|
+
lines.push(`evidenceRefs: ${fact.evidenceRefs
|
|
73
|
+
.filter((ref) => typeof ref === "string")
|
|
74
|
+
.join(", ")}`);
|
|
75
|
+
}
|
|
76
|
+
return lines.join("\n");
|
|
77
|
+
}
|
|
78
|
+
function pathInside(root, candidate) {
|
|
79
|
+
const relative = path.relative(root, candidate);
|
|
80
|
+
return (relative === "" ||
|
|
81
|
+
(!relative.startsWith(`..${path.sep}`) && relative !== ".." && !path.isAbsolute(relative)));
|
|
82
|
+
}
|
|
83
|
+
function safeRepositoryRelativePath(repoRoot, runDir, rawPath, fallback) {
|
|
84
|
+
let evidencePath = path.resolve(runDir, fallback);
|
|
85
|
+
if (rawPath) {
|
|
86
|
+
const absolute = path.isAbsolute(rawPath)
|
|
87
|
+
? path.normalize(rawPath)
|
|
88
|
+
: path.resolve(runDir, rawPath);
|
|
89
|
+
if (pathInside(runDir, absolute)) {
|
|
90
|
+
evidencePath = absolute;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (pathInside(repoRoot, evidencePath)) {
|
|
94
|
+
return path.relative(repoRoot, evidencePath).replaceAll(path.sep, "/");
|
|
95
|
+
}
|
|
96
|
+
return path.relative(runDir, evidencePath).replaceAll(path.sep, "/");
|
|
97
|
+
}
|
|
98
|
+
function nodeRecordCandidates(runDir, pass, ref, nodeId) {
|
|
99
|
+
const values = [
|
|
100
|
+
ref?.preservedNodeRecordPath,
|
|
101
|
+
pass ? path.join("convergence", `pass-${pass.pass}`, `${nodeId}.json`) : undefined,
|
|
102
|
+
`${nodeId}.json`,
|
|
103
|
+
].filter((value) => Boolean(value));
|
|
104
|
+
const resolved = values
|
|
105
|
+
.map((value) => (path.isAbsolute(value) ? path.normalize(value) : path.resolve(runDir, value)))
|
|
106
|
+
.filter((value) => pathInside(runDir, value));
|
|
107
|
+
return [...new Set(resolved)];
|
|
108
|
+
}
|
|
109
|
+
async function readNodeRecord(runDir, pass, ref, nodeId, fallback) {
|
|
110
|
+
for (const candidate of nodeRecordCandidates(runDir, pass, ref, nodeId)) {
|
|
111
|
+
try {
|
|
112
|
+
const parsed = JSON.parse(await readFile(candidate, "utf8"));
|
|
113
|
+
if (parsed && typeof parsed === "object")
|
|
114
|
+
return parsed;
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
// Try the next canonical/preserved candidate, then the state projection.
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return fallback;
|
|
121
|
+
}
|
|
122
|
+
function feedbackSourceCandidates(pass, state) {
|
|
123
|
+
const preferred = [];
|
|
124
|
+
if (pass?.reason.includes("verify"))
|
|
125
|
+
preferred.push("verify-pi");
|
|
126
|
+
if (pass?.reviewVerdict === "request-revision") {
|
|
127
|
+
preferred.push("review-verdict-recovery-pi", "review-pi");
|
|
128
|
+
}
|
|
129
|
+
preferred.push("verify-pi", "review-verdict-recovery-pi", "review-pi", "process-supervisor-pi");
|
|
130
|
+
preferred.push(...(pass?.artifactRefs.map((ref) => ref.nodeId) ?? []));
|
|
131
|
+
preferred.push(...Object.keys(state.nodes));
|
|
132
|
+
return [...new Set(preferred)];
|
|
133
|
+
}
|
|
134
|
+
function scrubAndBoundFeedbackText(value, runDir, cwd) {
|
|
135
|
+
let text = value
|
|
136
|
+
.replaceAll(runDir, "<parent-run-dir>")
|
|
137
|
+
.replaceAll(runDir.replaceAll("\\", "/"), "<parent-run-dir>")
|
|
138
|
+
.replaceAll(cwd, "<repo-root>")
|
|
139
|
+
.replaceAll(cwd.replaceAll("\\", "/"), "<repo-root>")
|
|
140
|
+
.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g, "")
|
|
141
|
+
.trim();
|
|
142
|
+
if (!text) {
|
|
143
|
+
return "上一轮验证节点返回 request-revision,但详细反馈正文不可用;请读取证据引用并重新核对当前代码。";
|
|
144
|
+
}
|
|
145
|
+
if (text.length <= MAX_RERUN_FEEDBACK_CHARS)
|
|
146
|
+
return text;
|
|
147
|
+
const remaining = MAX_RERUN_FEEDBACK_CHARS - RERUN_FEEDBACK_TRUNCATION_MARKER.length;
|
|
148
|
+
const prefixLength = Math.floor(remaining * 0.7);
|
|
149
|
+
const suffixLength = remaining - prefixLength;
|
|
150
|
+
text = `${text.slice(0, prefixLength)}${RERUN_FEEDBACK_TRUNCATION_MARKER}${text.slice(-suffixLength)}`;
|
|
151
|
+
return text;
|
|
152
|
+
}
|
|
153
|
+
function evidenceRefs(repoRoot, runDir, pass, sourceNodeId) {
|
|
154
|
+
const refs = pass?.artifactRefs ?? [];
|
|
155
|
+
const relevant = refs.filter((ref) => ref.nodeId === sourceNodeId ||
|
|
156
|
+
/(?:verify|review|supervisor|repair|gate)/i.test(ref.nodeId));
|
|
157
|
+
const selected = relevant.length > 0 ? relevant : refs;
|
|
158
|
+
const result = selected.slice(0, MAX_EVIDENCE_REFS).map((ref) => ({
|
|
159
|
+
nodeId: ref.nodeId,
|
|
160
|
+
preservedNodeRecordPath: safeRepositoryRelativePath(repoRoot, runDir, ref.preservedNodeRecordPath, path.join("convergence", `pass-${pass?.pass ?? 1}`, `${ref.nodeId}.json`)),
|
|
161
|
+
}));
|
|
162
|
+
if (result.length === 0) {
|
|
163
|
+
result.push({
|
|
164
|
+
nodeId: sourceNodeId,
|
|
165
|
+
preservedNodeRecordPath: safeRepositoryRelativePath(repoRoot, runDir, undefined, `${sourceNodeId}.json`),
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
return result;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Read the committed frontend review request fact (typed terminal channel).
|
|
172
|
+
* Returns { nodeId, fact } when the review node committed `request_review_changes`.
|
|
173
|
+
*/
|
|
174
|
+
async function readTypedReviewRequestFact(runDir) {
|
|
175
|
+
const fact = await readCommittedReviewRequestFact({ runDir });
|
|
176
|
+
if (!fact)
|
|
177
|
+
return undefined;
|
|
178
|
+
return {
|
|
179
|
+
nodeId: FRONTEND_REVIEW_NODE_ID,
|
|
180
|
+
fact: {
|
|
181
|
+
issueCategory: fact.issueCategory,
|
|
182
|
+
evidenceRefs: fact.evidenceRefs,
|
|
183
|
+
findings: fact.findings,
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Read the committed frontend design request fact (typed terminal channel).
|
|
189
|
+
* Returns { nodeId, fact } when the design review node committed
|
|
190
|
+
* `request_design_changes` — the design analog of request_review_changes.
|
|
191
|
+
*/
|
|
192
|
+
async function readTypedDesignRequestFact(runDir) {
|
|
193
|
+
const fact = await readCommittedDesignRequestFact({ runDir });
|
|
194
|
+
if (!fact)
|
|
195
|
+
return undefined;
|
|
196
|
+
return {
|
|
197
|
+
nodeId: FRONTEND_DESIGN_REVIEW_NODE_ID,
|
|
198
|
+
fact: {
|
|
199
|
+
issueCategory: fact.issueCategory,
|
|
200
|
+
evidenceRefs: fact.evidenceRefs,
|
|
201
|
+
findings: fact.findings,
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
const RERUN_FEEDBACK_LINEAGE_MAX_DEPTH = 5;
|
|
206
|
+
const RERUN_FEEDBACK_LINEAGE_LIFECYCLES = [
|
|
207
|
+
"active",
|
|
208
|
+
"paused",
|
|
209
|
+
"completed",
|
|
210
|
+
];
|
|
211
|
+
function safeLineageRunId(value) {
|
|
212
|
+
if (typeof value !== "string" || !value || value !== value.trim())
|
|
213
|
+
return undefined;
|
|
214
|
+
if (value === "." ||
|
|
215
|
+
value === ".." ||
|
|
216
|
+
value.includes("/") ||
|
|
217
|
+
value.includes("\\") ||
|
|
218
|
+
value.includes("\0"))
|
|
219
|
+
return undefined;
|
|
220
|
+
return value;
|
|
221
|
+
}
|
|
222
|
+
async function readCommittedTerminalKind(input) {
|
|
223
|
+
try {
|
|
224
|
+
const records = await readTypedEventStoreFromJsonl(path.join(input.runDir, input.nodeId, input.factsFile));
|
|
225
|
+
for (const record of records) {
|
|
226
|
+
if (record.phase !== "committed")
|
|
227
|
+
continue;
|
|
228
|
+
const kind = record.fact.kind;
|
|
229
|
+
if (typeof kind === "string" && input.kinds.includes(kind))
|
|
230
|
+
return kind;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
// A missing/unreadable terminal store means this run did not establish a
|
|
235
|
+
// usable resolution barrier; lineage lookup may continue.
|
|
236
|
+
}
|
|
237
|
+
return undefined;
|
|
238
|
+
}
|
|
239
|
+
async function readReviewTerminalKind(runDir) {
|
|
240
|
+
return readCommittedTerminalKind({
|
|
241
|
+
runDir,
|
|
242
|
+
nodeId: FRONTEND_REVIEW_NODE_ID,
|
|
243
|
+
factsFile: "review-typed-facts.jsonl",
|
|
244
|
+
kinds: ["request_review_changes", "approve_review"],
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
async function readDesignTerminalKind(runDir) {
|
|
248
|
+
return readCommittedTerminalKind({
|
|
249
|
+
runDir,
|
|
250
|
+
nodeId: FRONTEND_DESIGN_REVIEW_NODE_ID,
|
|
251
|
+
factsFile: "design-typed-facts.jsonl",
|
|
252
|
+
kinds: ["request_design_changes", "approve_design"],
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Walk the rerun-task lineage chain (`<runDir>/.runtime/rerun-task-lineage.json`
|
|
257
|
+
* → parentRunId) looking for the nearest ancestor run with a committed review
|
|
258
|
+
* or design request fact. A nearer final-review approval resolves all older
|
|
259
|
+
* findings; a nearer design approval resolves older design findings while
|
|
260
|
+
* still allowing an older final-review request to survive. Bounded depth;
|
|
261
|
+
* unsafe ids, mismatched state identities, cycles, and unreadable lineage
|
|
262
|
+
* files terminate the walk with undefined.
|
|
263
|
+
*/
|
|
264
|
+
async function readAncestorTypedRequestFact(runDir) {
|
|
265
|
+
let currentRunDir = runDir;
|
|
266
|
+
let currentRunId;
|
|
267
|
+
let designResolved = false;
|
|
268
|
+
const dagRunsRoot = path.resolve(runDir, "..", "..");
|
|
269
|
+
const visitedRunDirs = new Set([path.resolve(runDir)]);
|
|
270
|
+
for (let depth = 0; depth <= RERUN_FEEDBACK_LINEAGE_MAX_DEPTH; depth += 1) {
|
|
271
|
+
const reviewTerminalKind = await readReviewTerminalKind(currentRunDir);
|
|
272
|
+
if (currentRunId && reviewTerminalKind === "request_review_changes") {
|
|
273
|
+
const fact = await readTypedReviewRequestFact(currentRunDir);
|
|
274
|
+
if (fact)
|
|
275
|
+
return { ...fact, parentRunId: currentRunId };
|
|
276
|
+
}
|
|
277
|
+
if (reviewTerminalKind === "approve_review")
|
|
278
|
+
return undefined;
|
|
279
|
+
const designTerminalKind = await readDesignTerminalKind(currentRunDir);
|
|
280
|
+
if (currentRunId &&
|
|
281
|
+
!designResolved &&
|
|
282
|
+
designTerminalKind === "request_design_changes") {
|
|
283
|
+
const fact = await readTypedDesignRequestFact(currentRunDir);
|
|
284
|
+
if (fact)
|
|
285
|
+
return { ...fact, parentRunId: currentRunId };
|
|
286
|
+
}
|
|
287
|
+
if (designTerminalKind === "approve_design")
|
|
288
|
+
designResolved = true;
|
|
289
|
+
if (depth === RERUN_FEEDBACK_LINEAGE_MAX_DEPTH)
|
|
290
|
+
return undefined;
|
|
291
|
+
let parentRunId;
|
|
292
|
+
try {
|
|
293
|
+
const lineage = JSON.parse(await readFile(path.join(currentRunDir, ".runtime", "rerun-task-lineage.json"), "utf8"));
|
|
294
|
+
parentRunId = safeLineageRunId(lineage.parentRunId);
|
|
295
|
+
}
|
|
296
|
+
catch {
|
|
297
|
+
return undefined;
|
|
298
|
+
}
|
|
299
|
+
if (!parentRunId)
|
|
300
|
+
return undefined;
|
|
301
|
+
let ancestorRunDir;
|
|
302
|
+
for (const lifecycle of RERUN_FEEDBACK_LINEAGE_LIFECYCLES) {
|
|
303
|
+
const candidate = path.join(dagRunsRoot, lifecycle, parentRunId);
|
|
304
|
+
try {
|
|
305
|
+
const ancestorState = JSON.parse(await readFile(path.join(candidate, "state.json"), "utf8"));
|
|
306
|
+
if (ancestorState.runId === parentRunId) {
|
|
307
|
+
ancestorRunDir = candidate;
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
catch {
|
|
312
|
+
// try next lifecycle
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (!ancestorRunDir)
|
|
316
|
+
return undefined;
|
|
317
|
+
const resolvedAncestorRunDir = path.resolve(ancestorRunDir);
|
|
318
|
+
if (visitedRunDirs.has(resolvedAncestorRunDir))
|
|
319
|
+
return undefined;
|
|
320
|
+
visitedRunDirs.add(resolvedAncestorRunDir);
|
|
321
|
+
currentRunDir = ancestorRunDir;
|
|
322
|
+
currentRunId = parentRunId;
|
|
323
|
+
}
|
|
324
|
+
return undefined;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Derive only the latest unresolved verify/review feedback from canonical
|
|
328
|
+
* parent-run facts. Provider-only failures intentionally return undefined.
|
|
329
|
+
*/
|
|
330
|
+
export async function deriveDagRerunFeedback(input) {
|
|
331
|
+
const pass = input.state.convergence?.passHistory.at(-1);
|
|
332
|
+
let sourceNodeId;
|
|
333
|
+
let sourceNode;
|
|
334
|
+
for (const nodeId of feedbackSourceCandidates(pass, input.state)) {
|
|
335
|
+
const ref = pass?.artifactRefs.find((candidate) => candidate.nodeId === nodeId);
|
|
336
|
+
const node = await readNodeRecord(input.runDir, pass, ref, nodeId, input.state.nodes[nodeId]);
|
|
337
|
+
if (requestRevision(canonicalNodeOutput(node))) {
|
|
338
|
+
sourceNodeId = nodeId;
|
|
339
|
+
sourceNode = node;
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if (!sourceNodeId || !sourceNode) {
|
|
344
|
+
// Typed terminal channel: the frontend review/design review commit their
|
|
345
|
+
// verdicts as typed facts (request_review_changes / request_design_changes)
|
|
346
|
+
// instead of VERDICT text, and the frontend DAG has no convergence
|
|
347
|
+
// passHistory. Fall back to reading the typed event stores so findings
|
|
348
|
+
// still flow into the next round as unresolved feedback. Prefer review;
|
|
349
|
+
// if absent, fall through to the design review (a design rejection also
|
|
350
|
+
// carries actionable findings the next plan round must consume). When
|
|
351
|
+
// the direct parent has neither because it failed before review, walk the
|
|
352
|
+
// rerun-task lineage chain — chained
|
|
353
|
+
// reruns otherwise lose the grandparent's code-review findings and the
|
|
354
|
+
// reviewer re-flags them as "unresolved previous-round feedback" (r18).
|
|
355
|
+
// A committed approval is a resolution barrier and prevents older
|
|
356
|
+
// findings from being resurrected.
|
|
357
|
+
const typedFact = (await readTypedReviewRequestFact(input.runDir)) ??
|
|
358
|
+
(await readTypedDesignRequestFact(input.runDir)) ??
|
|
359
|
+
(await readAncestorTypedRequestFact(input.runDir));
|
|
360
|
+
if (typedFact) {
|
|
361
|
+
const parentSourceBindingHash = sourceBindingHash(input.spec);
|
|
362
|
+
return withDigest({
|
|
363
|
+
schemaVersion: 1,
|
|
364
|
+
kind: "unresolved-terminal-feedback",
|
|
365
|
+
parentRunId: "parentRunId" in typedFact &&
|
|
366
|
+
typeof typedFact.parentRunId === "string"
|
|
367
|
+
? typedFact.parentRunId
|
|
368
|
+
: input.parentRunId,
|
|
369
|
+
taskId: input.taskId,
|
|
370
|
+
sourceNodeId: typedFact.nodeId,
|
|
371
|
+
verdict: "request-revision",
|
|
372
|
+
failureCategory: typedFact.nodeId === FRONTEND_REVIEW_NODE_ID
|
|
373
|
+
? "review-request-changes"
|
|
374
|
+
: "design-request-changes",
|
|
375
|
+
feedbackText: scrubAndBoundFeedbackText(formatTypedReviewRequestFeedback(typedFact.fact), input.runDir, input.state.cwd),
|
|
376
|
+
evidenceRefs: [
|
|
377
|
+
{
|
|
378
|
+
nodeId: typedFact.nodeId,
|
|
379
|
+
preservedNodeRecordPath: `${typedFact.nodeId}.json`,
|
|
380
|
+
},
|
|
381
|
+
],
|
|
382
|
+
attemptSummary: {
|
|
383
|
+
completedPasses: 1,
|
|
384
|
+
maxPasses: 1,
|
|
385
|
+
...(input.state.terminalReason
|
|
386
|
+
? { terminalReason: input.state.terminalReason }
|
|
387
|
+
: {}),
|
|
388
|
+
},
|
|
389
|
+
binding: {
|
|
390
|
+
...(parentSourceBindingHash
|
|
391
|
+
? { sourceCanonicalHash: parentSourceBindingHash }
|
|
392
|
+
: {}),
|
|
393
|
+
...(input.spec.taskContractBinding?.canonicalHash
|
|
394
|
+
? {
|
|
395
|
+
taskContractCanonicalHash: input.spec.taskContractBinding.canonicalHash,
|
|
396
|
+
}
|
|
397
|
+
: {}),
|
|
398
|
+
status: "unknown",
|
|
399
|
+
},
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
// Preserve actionable writer failures even when the run stopped before a
|
|
403
|
+
// final review node could commit typed findings. This is especially
|
|
404
|
+
// important for provider length exhaustion: the next run must see the
|
|
405
|
+
// stop reason/tool statistics instead of repeating the same prompt.
|
|
406
|
+
const writerNodeId = ["frontend-implement-pi", "implement-pi"].find((nodeId) => {
|
|
407
|
+
const node = input.state.nodes[nodeId];
|
|
408
|
+
return (node?.status === "ERROR" &&
|
|
409
|
+
[
|
|
410
|
+
"empty-output",
|
|
411
|
+
"invalid-output",
|
|
412
|
+
"writer-thinking-exhausted",
|
|
413
|
+
"writer-budget-exhausted",
|
|
414
|
+
"incomplete-write-set",
|
|
415
|
+
"partial-success-with-context-overflow",
|
|
416
|
+
].includes(node.failureCategory ?? ""));
|
|
417
|
+
});
|
|
418
|
+
if (writerNodeId) {
|
|
419
|
+
const writerNode = await readNodeRecord(input.runDir, pass, undefined, writerNodeId, input.state.nodes[writerNodeId]);
|
|
420
|
+
if (writerNode) {
|
|
421
|
+
const writerFeedback = [
|
|
422
|
+
`writer failure category: ${writerNode.failureCategory ?? "unknown"}`,
|
|
423
|
+
writerNode.stopReason ? `provider stopReason: ${writerNode.stopReason}` : "",
|
|
424
|
+
typeof writerNode.writeToolCallCount === "number"
|
|
425
|
+
? `write tool calls: ${writerNode.writeToolCallCount}`
|
|
426
|
+
: "",
|
|
427
|
+
writerNode.stderr?.trim() ?? "",
|
|
428
|
+
canonicalNodeOutput(writerNode),
|
|
429
|
+
]
|
|
430
|
+
.filter(Boolean)
|
|
431
|
+
.join("\n\n");
|
|
432
|
+
const parentSourceBindingHash = sourceBindingHash(input.spec);
|
|
433
|
+
return withDigest({
|
|
434
|
+
schemaVersion: 1,
|
|
435
|
+
kind: "unresolved-terminal-feedback",
|
|
436
|
+
parentRunId: input.parentRunId,
|
|
437
|
+
taskId: input.taskId,
|
|
438
|
+
sourceNodeId: writerNodeId,
|
|
439
|
+
verdict: "request-revision",
|
|
440
|
+
failureCategory: writerNode.failureCategory,
|
|
441
|
+
feedbackText: scrubAndBoundFeedbackText(writerFeedback, input.runDir, input.state.cwd),
|
|
442
|
+
evidenceRefs: [
|
|
443
|
+
{
|
|
444
|
+
nodeId: writerNodeId,
|
|
445
|
+
preservedNodeRecordPath: `${writerNodeId}.json`,
|
|
446
|
+
},
|
|
447
|
+
],
|
|
448
|
+
attemptSummary: { completedPasses: 1, maxPasses: 1 },
|
|
449
|
+
binding: {
|
|
450
|
+
...(parentSourceBindingHash
|
|
451
|
+
? { sourceCanonicalHash: parentSourceBindingHash }
|
|
452
|
+
: {}),
|
|
453
|
+
...(input.spec.taskContractBinding?.canonicalHash
|
|
454
|
+
? { taskContractCanonicalHash: input.spec.taskContractBinding.canonicalHash }
|
|
455
|
+
: {}),
|
|
456
|
+
status: "unknown",
|
|
457
|
+
},
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
return undefined;
|
|
462
|
+
}
|
|
463
|
+
const completedPasses = pass?.pass ?? Math.max(1, input.state.convergence?.currentPass ?? 1);
|
|
464
|
+
const maxPasses = Math.max(completedPasses, input.state.convergence?.maxPasses ?? 1);
|
|
465
|
+
const parentSourceBindingHash = sourceBindingHash(input.spec);
|
|
466
|
+
return withDigest({
|
|
467
|
+
schemaVersion: 1,
|
|
468
|
+
kind: "unresolved-terminal-feedback",
|
|
469
|
+
parentRunId: input.parentRunId,
|
|
470
|
+
taskId: input.taskId,
|
|
471
|
+
sourceNodeId,
|
|
472
|
+
verdict: "request-revision",
|
|
473
|
+
...(sourceNode.failureCategory
|
|
474
|
+
? { failureCategory: sourceNode.failureCategory }
|
|
475
|
+
: {}),
|
|
476
|
+
feedbackText: scrubAndBoundFeedbackText(canonicalNodeOutput(sourceNode), input.runDir, input.state.cwd),
|
|
477
|
+
evidenceRefs: evidenceRefs(input.state.cwd, input.runDir, pass, sourceNodeId),
|
|
478
|
+
attemptSummary: {
|
|
479
|
+
completedPasses,
|
|
480
|
+
maxPasses,
|
|
481
|
+
...(input.state.convergence?.terminalReason
|
|
482
|
+
? { terminalReason: input.state.convergence.terminalReason }
|
|
483
|
+
: input.state.terminalReason
|
|
484
|
+
? { terminalReason: input.state.terminalReason }
|
|
485
|
+
: {}),
|
|
486
|
+
},
|
|
487
|
+
binding: {
|
|
488
|
+
...(parentSourceBindingHash
|
|
489
|
+
? { sourceCanonicalHash: parentSourceBindingHash }
|
|
490
|
+
: {}),
|
|
491
|
+
...(input.spec.taskContractBinding?.canonicalHash
|
|
492
|
+
? {
|
|
493
|
+
taskContractCanonicalHash: input.spec.taskContractBinding.canonicalHash,
|
|
494
|
+
}
|
|
495
|
+
: {}),
|
|
496
|
+
status: "unknown",
|
|
497
|
+
},
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
/** Bind parent feedback to the newly generated live task snapshot. */
|
|
501
|
+
export function bindDagRerunFeedback(feedback, currentSpec) {
|
|
502
|
+
const comparisons = [];
|
|
503
|
+
const currentSourceHash = sourceBindingHash(currentSpec);
|
|
504
|
+
if (feedback.binding.sourceCanonicalHash) {
|
|
505
|
+
comparisons.push(currentSourceHash !== undefined &&
|
|
506
|
+
feedback.binding.sourceCanonicalHash === currentSourceHash);
|
|
507
|
+
}
|
|
508
|
+
if (feedback.binding.taskContractCanonicalHash) {
|
|
509
|
+
comparisons.push(currentSpec.taskContractBinding?.canonicalHash !== undefined &&
|
|
510
|
+
feedback.binding.taskContractCanonicalHash ===
|
|
511
|
+
currentSpec.taskContractBinding.canonicalHash);
|
|
512
|
+
}
|
|
513
|
+
const status = comparisons.some((same) => !same)
|
|
514
|
+
? "changed"
|
|
515
|
+
: comparisons.length > 0
|
|
516
|
+
? "exact"
|
|
517
|
+
: "unknown";
|
|
518
|
+
const { digest: _digest, ...payload } = feedback;
|
|
519
|
+
return withDigest({
|
|
520
|
+
...payload,
|
|
521
|
+
binding: {
|
|
522
|
+
...feedback.binding,
|
|
523
|
+
status,
|
|
524
|
+
},
|
|
525
|
+
});
|
|
526
|
+
}
|