@tea-agent/loop-agent 0.1.0-fe-test.5 → 0.1.0-fe-test.6
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 +1 -1
- package/CHANGELOG.md +441 -2525
- package/README.md +19 -12
- package/dist/adapters/loop-agent.js +34 -0
- package/dist/application/dag/args.js +8 -0
- package/dist/application/dag/run-dag.js +5 -0
- package/dist/application/evaluation/budget.js +40 -1
- package/dist/application/evaluation/corpus-hash.js +10 -15
- package/dist/application/evaluation/corpus.js +2 -1
- package/dist/application/evaluation/frontend-browser-acceptance.js +77 -0
- package/dist/application/evaluation/frontend-corpus-browser-acceptance.js +175 -0
- package/dist/application/evaluation/frontend-gateway-evidence.js +226 -0
- package/dist/application/evaluation/frontend-pair-registration.js +143 -0
- package/dist/application/evaluation/frontend-paired-summary.js +150 -0
- package/dist/application/evaluation/frontend-run-observation.js +144 -0
- package/dist/application/evaluation/frontend-shared-evidence.js +105 -0
- package/dist/application/evaluation/types.js +45 -12
- package/dist/application/task-lifecycle/advance.js +64 -15
- package/dist/application/task-lifecycle/observe.js +69 -30
- package/dist/application/task-lifecycle/plan-transitions.js +5 -4
- package/dist/build-stamp.json +3 -3
- package/dist/cli/command-definitions.js +18 -5
- package/dist/cli/program.js +8 -5
- package/dist/cli/update/init-surface-notifier.js +2 -0
- package/dist/cli/update/policy.js +2 -0
- package/dist/commands/client-recovery.js +20 -55
- package/dist/commands/cursor-prompt.js +2 -0
- package/dist/commands/dag-approve.js +2 -0
- package/dist/commands/dag-final-verification.js +2 -0
- package/dist/commands/dag-init-hybrid.js +2 -0
- package/dist/commands/dag-reconcile-tasks.js +2 -0
- package/dist/commands/dag-reject.js +2 -0
- package/dist/commands/dag-report.js +2 -0
- package/dist/commands/dag-rerun.js +2 -0
- package/dist/commands/dag-resume.js +2 -0
- package/dist/commands/dag-workflow-compile.js +2 -0
- package/dist/commands/dag-workflow-plan.js +2 -0
- package/dist/commands/dag-workflow-validate.js +2 -0
- package/dist/commands/delegate.js +2 -0
- package/dist/commands/examples.js +2 -0
- package/dist/commands/import-prd.js +2 -0
- package/dist/commands/init-legacy-audit.js +330 -0
- package/dist/commands/init-model-catalog.js +2 -0
- package/dist/commands/init-upgrade.js +644 -104
- package/dist/commands/init.js +700 -338
- package/dist/commands/instructions.js +2 -0
- package/dist/commands/knowledge.js +2 -0
- package/dist/commands/loop-benchmark.js +2 -0
- package/dist/commands/operator-guide.js +99 -0
- package/dist/commands/operator.js +16 -3
- package/dist/commands/pi-prompt.js +2 -0
- package/dist/commands/pi-reuse-benchmark.js +2 -0
- package/dist/commands/promote-run.js +2 -0
- package/dist/commands/stats.js +1 -1
- package/dist/commands/study-init.js +2 -0
- package/dist/commands/task-advance.js +32 -0
- package/dist/commands/task-source-prepare.js +18 -2
- package/dist/commands/worktree-create.js +2 -0
- package/dist/commands/worktree-remove.js +2 -0
- package/dist/executors/dag-pi/guards.js +4 -0
- package/dist/executors/dag-pi/model-config.js +30 -0
- package/dist/executors/dag-pi/plan/fact-adoption.js +55 -0
- package/dist/executors/dag-pi/plan/facts.js +180 -0
- package/dist/executors/dag-pi/plan/finalize-tools.js +259 -0
- package/dist/executors/dag-pi/plan/ledger-contract.js +55 -0
- package/dist/executors/dag-pi/plan/record-tools.js +861 -0
- package/dist/executors/dag-pi/plan/schema.js +129 -0
- package/dist/executors/dag-pi/plan/tool-helpers.js +16 -0
- package/dist/executors/dag-pi/sessions/index.js +6 -0
- package/dist/executors/dag-pi/sessions/plan-batches.js +280 -0
- package/dist/executors/dag-pi/sessions/plan-prompts.js +367 -0
- package/dist/executors/dag-pi/sessions/scout-parallel.js +197 -0
- package/dist/executors/dag-pi/sessions/segmented-plan.js +1184 -0
- package/dist/executors/dag-pi/sessions/writer-evidence.js +60 -0
- package/dist/executors/dag-pi/tools/contract-tools.js +515 -0
- package/dist/executors/dag-pi/tools/design-terminal-tools.js +159 -0
- package/dist/executors/dag-pi/tools/plan-decision-tools.js +529 -0
- package/dist/executors/dag-pi/tools/review-terminal-tools.js +159 -0
- package/dist/executors/dag-pi/tools/scout-evidence-tools.js +270 -0
- package/dist/executors/dag-pi-executor.js +1516 -3181
- package/dist/executors/pi-executor.js +112 -4
- package/dist/executors/pi-sdk-executor.js +258 -44
- package/dist/executors/pi-writer-tool-policy.js +60 -4
- package/dist/executors/playwright-cli-launcher.js +31 -45
- package/dist/executors/shell-executor.js +313 -48
- package/dist/executors/shell-presets.js +1 -1
- package/dist/executors/shell-verification.js +3 -0
- package/dist/executors/shell-write-guard.js +77 -102
- package/dist/governance/exec-plans.js +16 -4
- package/dist/governance/harness.js +2 -7
- package/dist/governance/manifest-types.js +28 -9
- package/dist/governance/project-capability-scanner.js +263 -0
- package/dist/governance/project-config.js +96 -0
- package/dist/governance/resource-catalog.js +151 -0
- package/dist/infrastructure/console/app-data.js +12 -2
- package/dist/infrastructure/console/operation-store.js +48 -14
- package/dist/infrastructure/evaluation/corpus-store.js +37 -12
- package/dist/shared/artifacts-core.js +2 -0
- package/dist/shared/backend-dogfood-preflight.js +47 -0
- package/dist/shared/dag-failure-category.js +9 -0
- package/dist/shared/file-identity.js +23 -0
- package/dist/shared/frontend-execution-policy.js +23 -0
- package/dist/shared/git-progress.js +2 -0
- package/dist/shared/git-workspace-status.js +482 -0
- package/dist/shared/one-shot-prompt-args.js +2 -0
- package/dist/shared/operator/capabilities.js +185 -0
- package/dist/shared/package-metadata.js +29 -11
- package/dist/shared/path-safety.js +2 -2
- package/dist/shared/pi-context-pressure/extension.js +49 -16
- package/dist/shared/pi-context-pressure/index.js +1 -0
- package/dist/shared/pi-context-pressure/sift-bridge.js +1 -1
- package/dist/shared/pi-context-pressure/telemetry.js +4 -0
- package/dist/shared/pi-context-pressure/tool-result-pruner.js +98 -0
- package/dist/shared/pi-provider-recovery.js +182 -0
- package/dist/shared/pi-retry-settings.js +40 -0
- package/dist/shared/reference-context.js +2 -0
- package/dist/shared/update/npm-client.js +49 -1
- package/dist/shared/wizard-local-telemetry.js +51 -0
- package/dist/task/config-types.js +51 -2
- package/dist/task/contract/apply.js +36 -2
- package/dist/task/contract/project.js +22 -0
- package/dist/task/contract/recover.js +6 -0
- package/dist/task/contract/schema.js +12 -0
- package/dist/task/frontend-preflight.js +1 -1
- package/dist/task/source-prepare/artifact-meta.js +9 -2
- package/dist/task/source-prepare/build-draft.js +61 -0
- package/dist/task/source-prepare/fragment-inventory.js +4 -1
- package/dist/task/source-prepare/ledger-reconciliation.js +2 -2
- package/dist/task/source-prepare/ledger-review.js +6 -9
- package/dist/task/source-prepare/parse-intent.js +165 -14
- package/dist/task/source-prepare/path-policy.js +17 -7
- package/dist/task/source-prepare/prepare.js +6 -1
- package/dist/task/source-prepare/semantic-intake.js +33 -28
- package/dist/task/source-prepare/source-execution.js +65 -0
- package/dist/task/source-prepare/source-fidelity-pi.js +49 -17
- package/dist/task/source-prepare/source-provider-budget.js +290 -0
- package/dist/task/source-references.js +48 -23
- package/dist/task/task-demand-routing.js +5 -2
- package/dist/worker/cli.js +3 -5
- package/dist/worker/console/chat/assistant-content.js +5 -13
- package/dist/worker/console/chat/browser-automation.js +937 -0
- package/dist/worker/console/chat/browser-content.js +74 -0
- package/dist/worker/console/chat/browser-diagnostics.js +250 -0
- package/dist/worker/console/chat/browser-evaluation.js +58 -0
- package/dist/worker/console/chat/browser-operation-queue.js +19 -0
- package/dist/worker/console/chat/browser-pick.js +113 -0
- package/dist/worker/console/chat/browser-policy.js +113 -0
- package/dist/worker/console/chat/browser-routes.js +329 -0
- package/dist/worker/console/chat/browser-screenshot-result.js +47 -0
- package/dist/worker/console/chat/browser-storage.js +89 -0
- package/dist/worker/console/chat/chat-event-store.js +73 -18
- package/dist/worker/console/chat/context-insights.js +788 -0
- package/dist/worker/console/chat/conversation-nodes.js +383 -0
- package/dist/worker/console/chat/db-connections.js +854 -0
- package/dist/worker/console/chat/explore-tools.js +18 -2
- package/dist/worker/console/chat/pet/pet-affinity.js +169 -0
- package/dist/worker/console/chat/pet/pet-persist.js +109 -0
- package/dist/worker/console/chat/pet/pet-registry.js +142 -0
- package/dist/worker/console/chat/pet/pet-remarks.js +48 -0
- package/dist/worker/console/chat/pet/pet-routes.js +125 -0
- package/dist/worker/console/chat/pet/pet-service.js +262 -0
- package/dist/worker/console/chat/pet/pet-state.js +99 -0
- package/dist/worker/console/chat/pi-mode-loop-isolation.js +170 -0
- package/dist/worker/console/chat/pi-runtime/custom-tools/ask-user-question.js +44 -0
- package/dist/worker/console/chat/pi-runtime/custom-tools/browser-tools.js +135 -0
- package/dist/worker/console/chat/pi-runtime/custom-tools/explore-tools.js +202 -0
- package/dist/worker/console/chat/pi-runtime/custom-tools/goal-tools.js +79 -0
- package/dist/worker/console/chat/pi-runtime/custom-tools/operator-tools.js +94 -0
- package/dist/worker/console/chat/pi-runtime/custom-tools/scheduled-goal-tools.js +22 -0
- package/dist/worker/console/chat/pi-runtime/custom-tools/sql-tools.js +670 -0
- package/dist/worker/console/chat/pi-runtime/custom-tools/todo-write.js +38 -0
- package/dist/worker/console/chat/pi-runtime/inspection-types.js +28 -0
- package/dist/worker/console/chat/pi-runtime/inspection.js +439 -0
- package/dist/worker/console/chat/pi-runtime/progressive-tools.js +195 -0
- package/dist/worker/console/chat/pi-runtime/sdk-bindings.js +153 -0
- package/dist/worker/console/chat/pi-runtime/sdk-session.js +5 -0
- package/dist/worker/console/chat/pi-runtime.js +793 -1230
- package/dist/worker/console/chat/provider-error.js +0 -12
- package/dist/worker/console/chat/repo-browser.js +132 -6
- package/dist/worker/console/chat/repo-preview-kind.js +155 -0
- package/dist/worker/console/chat/resource-loader.js +4 -1
- package/dist/worker/console/chat/routes.js +861 -148
- package/dist/worker/console/chat/scheduled-goal-booking.js +59 -0
- package/dist/worker/console/chat/scheduled-goal-delivery.js +27 -0
- package/dist/worker/console/chat/scheduled-goal-request.js +198 -0
- package/dist/worker/console/chat/scm-routes.js +217 -0
- package/dist/worker/console/chat/scm-service.js +283 -0
- package/dist/worker/console/chat/scm-tools.js +111 -0
- package/dist/worker/console/chat/sdd-data-alignment.js +85 -41
- package/dist/worker/console/chat/session-catalog.js +32 -0
- package/dist/worker/console/chat/session-mode-view.js +49 -0
- package/dist/worker/console/chat/session-mode.js +224 -0
- package/dist/worker/console/chat/session-store.js +232 -32
- package/dist/worker/console/chat/shortcuts.js +13 -0
- package/dist/worker/console/chat/subagents/agent-tool.js +62 -0
- package/dist/worker/console/chat/subagents/explore-agent.js +169 -0
- package/dist/worker/console/chat/subagents/index.js +5 -0
- package/dist/worker/console/chat/subagents/orchestrator.js +273 -0
- package/dist/worker/console/chat/subagents/tool-policy.js +53 -0
- package/dist/worker/console/chat/subagents/types.js +13 -0
- package/dist/worker/console/chat/terminal-routes.js +216 -0
- package/dist/worker/console/chat/terminal-sessions.js +348 -0
- package/dist/worker/console/chat/terminal-tools.js +211 -0
- package/dist/worker/console/chat/timeline-message-order.js +22 -0
- package/dist/worker/console/chat/tool-preview.js +136 -0
- package/dist/worker/console/chat/tools.js +69 -1
- package/dist/worker/console/chat/turn-order.js +13 -0
- package/dist/worker/console/chat/turn-process.js +210 -36
- package/dist/worker/console/chat/user-turn-outline.js +19 -0
- package/dist/worker/console/console-shutdown.js +34 -0
- package/dist/worker/console/console-update-and-init.js +1 -19
- package/dist/worker/console/console-update-runtime.js +7 -22
- package/dist/worker/console/dag-confirmation.js +3 -0
- package/dist/worker/console/dag-execution-receipt.js +3 -0
- package/dist/worker/console/interview/tools.js +1 -0
- package/dist/worker/console/operator-actions.js +95 -4
- package/dist/worker/console/operator-user-error.js +28 -1
- package/dist/worker/console/pi-readiness.js +4 -4
- package/dist/worker/console/prd-intake-bridge.js +47 -1
- package/dist/worker/console/recovery-cta.js +14 -14
- package/dist/worker/console/routes.js +13 -0
- package/dist/worker/console/scheduled-goal-host.js +98 -0
- package/dist/worker/console/scheduled-goal-operation-adapter.js +127 -0
- package/dist/worker/console/server.js +33 -31
- package/dist/worker/console/static/app-icon.svg +39 -0
- package/dist/worker/console/static/assets/{abnfDiagram-N423BO3Z-BZogYNl1.js → abnfDiagram-N423BO3Z-DASc69AM.js} +1 -1
- package/dist/worker/console/static/assets/{arc-DcJTLe2v.js → arc-h09p-LAc.js} +1 -1
- package/dist/worker/console/static/assets/{architectureDiagram-T3A2C74G-B39EQQ9n.js → architectureDiagram-T3A2C74G-CZ3dtLkh.js} +1 -1
- package/dist/worker/console/static/assets/{blockDiagram-VBNYF7ZC-CitCGV56.js → blockDiagram-VBNYF7ZC-DMrRhMXG.js} +1 -1
- package/dist/worker/console/static/assets/{c4Diagram-5PPSVZJV-rvWuOHLG.js → c4Diagram-5PPSVZJV-DQxisHV6.js} +1 -1
- package/dist/worker/console/static/assets/channel-D1zgKZfg.js +1 -0
- package/dist/worker/console/static/assets/{chunk-2GRJ4B5K-DGXplIJs.js → chunk-2GRJ4B5K-CefVN9zh.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-2Q5K7J3B-ur9OqjPn.js → chunk-2Q5K7J3B-DmR1Koq2.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5RXB4S5H-D1KqU_Vi.js → chunk-5RXB4S5H-NlzrSW7L.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5VM5RSS4-BlVZrbtM.js → chunk-5VM5RSS4-DfelJv-0.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-6Q2QTUOP-BAzz3nQy.js → chunk-6Q2QTUOP-BK6RFy58.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-GF5L2VYU-CP_nYuCV.js → chunk-GF5L2VYU-BAeh9lz4.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-JWPE2WC7-CWvKQ80X.js → chunk-JWPE2WC7-ChPS5WzG.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-KBJHAD2P-CyUki8wp.js → chunk-KBJHAD2P-BoVe5IM6.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-RYQCIY6F-5NYzNKfY.js → chunk-RYQCIY6F-C4q_0Lw9.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-XXDRQBXY-DHdUgjS-.js → chunk-XXDRQBXY-Bb9TvjeY.js} +1 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-CXNNsY2M.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-CXNNsY2M.js +1 -0
- package/dist/worker/console/static/assets/{cose-bilkent-JH36ORCC-ANQ5g_t6.js → cose-bilkent-JH36ORCC-DmNnL8Ff.js} +1 -1
- package/dist/worker/console/static/assets/{cynefin-VYW2F7L2-CruT_4-0.js → cynefin-VYW2F7L2-Contvx58.js} +1 -1
- package/dist/worker/console/static/assets/{cynefinDiagram-MW4NZA55-rbFo77ID.js → cynefinDiagram-MW4NZA55-Cigq7cjk.js} +1 -1
- package/dist/worker/console/static/assets/{dagre-VZM6K2ZE-asstxBQs.js → dagre-VZM6K2ZE-dEbC0nxb.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-7IWD3JNH-DzTyBZwI.js → diagram-7IWD3JNH-CzIztESV.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-B4RE2ZJO-gw8ccH3B.js → diagram-B4RE2ZJO-Bo14zbaY.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-LBJQPF4R-B8RpZzOf.js → diagram-LBJQPF4R-C4xUyil6.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-Q27KOJAE-B1zJkCS9.js → diagram-Q27KOJAE-CaBY_uYa.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-UB23O5K3-B6JLWZmO.js → diagram-UB23O5K3-ClUXUeiu.js} +1 -1
- package/dist/worker/console/static/assets/{ebnfDiagram-BXEA7PRR-q2iZP-Ps.js → ebnfDiagram-BXEA7PRR-BbGCgjC6.js} +1 -1
- package/dist/worker/console/static/assets/{erDiagram-JOGREHBK-B3dbbktQ.js → erDiagram-JOGREHBK-Dr-AcwSl.js} +1 -1
- package/dist/worker/console/static/assets/{flowDiagram-UKHOOZJN-C-zc6-kB.js → flowDiagram-UKHOOZJN-BG8Gcfyc.js} +1 -1
- package/dist/worker/console/static/assets/{ganttDiagram-PKOTCBZU-BSolnot9.js → ganttDiagram-PKOTCBZU-CFVaPs5r.js} +1 -1
- package/dist/worker/console/static/assets/{gitGraphDiagram-DS77QQ5N-Bo8jGxTk.js → gitGraphDiagram-DS77QQ5N-ChJ8pm-O.js} +1 -1
- package/dist/worker/console/static/assets/index-B_5GhVIO.js +488 -0
- package/dist/worker/console/static/assets/index-C7YMBluX.css +1 -0
- package/dist/worker/console/static/assets/{infoDiagram-6WML65LV-DQaZqJOH.js → infoDiagram-6WML65LV-C5J9-uCZ.js} +1 -1
- package/dist/worker/console/static/assets/{ishikawaDiagram-WSZJBQD7-DsdX1WnE.js → ishikawaDiagram-WSZJBQD7-BcfjqzDv.js} +1 -1
- package/dist/worker/console/static/assets/{journeyDiagram-NVQOT4AX-CP5EYDZL.js → journeyDiagram-NVQOT4AX-BzzCO-rD.js} +1 -1
- package/dist/worker/console/static/assets/{kanban-definition-27J2QSJJ-DAm14Dr8.js → kanban-definition-27J2QSJJ-NCHUZ46h.js} +1 -1
- package/dist/worker/console/static/assets/{linear-gZECoLc5.js → linear-BKZlWCUU.js} +1 -1
- package/dist/worker/console/static/assets/{mermaid.core-BRJNIM6p.js → mermaid.core-DbTaQjFE.js} +5 -5
- package/dist/worker/console/static/assets/{mindmap-definition-FAOFIHXS-Cja3kLkR.js → mindmap-definition-FAOFIHXS-CroYl5xQ.js} +1 -1
- package/dist/worker/console/static/assets/{pegDiagram-VL7TDLO6-22ZGFisL.js → pegDiagram-VL7TDLO6-DgMBx-9k.js} +1 -1
- package/dist/worker/console/static/assets/{pieDiagram-7S7Q4E2Y-BXin0Y1o.js → pieDiagram-7S7Q4E2Y-CyWDmbq1.js} +1 -1
- package/dist/worker/console/static/assets/{quadrantDiagram-CIZ2JOQS-Cw6T69Yt.js → quadrantDiagram-CIZ2JOQS-BgGEOqSP.js} +1 -1
- package/dist/worker/console/static/assets/{railroadDiagram-AXF67PYL-C1-gTieN.js → railroadDiagram-AXF67PYL-BMZ7oeeV.js} +1 -1
- package/dist/worker/console/static/assets/{requirementDiagram-LRYGKXZP--H5N2iI1.js → requirementDiagram-LRYGKXZP-DxqyGhcc.js} +1 -1
- package/dist/worker/console/static/assets/{sankeyDiagram-W5VNT64P-CgWAPeRz.js → sankeyDiagram-W5VNT64P-DnSvNCG8.js} +1 -1
- package/dist/worker/console/static/assets/{sequenceDiagram-SI44F4Z6-CrKqzGvt.js → sequenceDiagram-SI44F4Z6-BiZh6f-R.js} +1 -1
- package/dist/worker/console/static/assets/{sizeCapture-X5ZJPWSS-BB3wG06K.js → sizeCapture-X5ZJPWSS-BKXSI8WB.js} +1 -1
- package/dist/worker/console/static/assets/{stateDiagram-OKZ733FA-DjsGgdgY.js → stateDiagram-OKZ733FA-CfSgoYFm.js} +1 -1
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-DgHi3vjb.js +1 -0
- package/dist/worker/console/static/assets/{swimlanes-SLNWSIFB-DYKEbvAR.js → swimlanes-SLNWSIFB-CyGADcHe.js} +2 -2
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-Bgvdt1Y0.js +8 -0
- package/dist/worker/console/static/assets/{timeline-definition-Z64GVDOM-eQOb5k9Y.js → timeline-definition-Z64GVDOM-HmPaSPOK.js} +1 -1
- package/dist/worker/console/static/assets/{vennDiagram-T6HMQDX7-B2-l9FIu.js → vennDiagram-T6HMQDX7-VA2VBbez.js} +1 -1
- package/dist/worker/console/static/assets/{wardleyDiagram-T6FBY63Y-BX2Cda3l.js → wardleyDiagram-T6FBY63Y-BxjiBPZa.js} +1 -1
- package/dist/worker/console/static/assets/{xychartDiagram-ELKLHX3M-D9S892ph.js → xychartDiagram-ELKLHX3M--hUY-qFj.js} +1 -1
- package/dist/worker/console/static/index.html +5 -2
- package/dist/worker/console/static/manifest.webmanifest +19 -0
- package/dist/worker/console/static/pets/ember/pet.json +167 -0
- package/dist/worker/console/static/pets/ember/spritesheet.png +0 -0
- package/dist/worker/console/static-src/app/console-types.js +9 -1
- package/dist/worker/console/static-src/chat-view-types.js +1 -1
- package/dist/worker/console/static-src/operator-chat/active-turn-tail.js +10 -0
- package/dist/worker/console/static-src/operator-chat/animation-frame-batcher.js +38 -0
- package/dist/worker/console/static-src/operator-chat/chat-link.js +114 -0
- package/dist/worker/console/static-src/operator-chat/chat-scroll-position.js +24 -0
- package/dist/worker/console/static-src/operator-chat/chat-sse-events.js +360 -14
- package/dist/worker/console/static-src/operator-chat/chat-stream-continuity.js +101 -0
- package/dist/worker/console/static-src/operator-chat/compaction-message.js +10 -2
- package/dist/worker/console/static-src/operator-chat/composer-session-ledger.js +192 -0
- package/dist/worker/console/static-src/operator-chat/context-insights-store.js +64 -0
- package/dist/worker/console/static-src/operator-chat/details-rail-surfaces.js +99 -0
- package/dist/worker/console/static-src/operator-chat/file-palette-nav.js +81 -0
- package/dist/worker/console/static-src/operator-chat/open-preview-in-browser.js +57 -9
- package/dist/worker/console/static-src/operator-chat/pending-user-message.js +66 -0
- package/dist/worker/console/static-src/operator-chat/process-label.js +63 -0
- package/dist/worker/console/static-src/operator-chat/slash-palette-nav.js +15 -5
- package/dist/worker/console/static-src/operator-chat/timeline-merge.js +29 -0
- package/dist/worker/console/static-src/operator-chat/tools-catalog.js +36 -8
- package/dist/worker/console/static-src/operator-chat/transcript-mode.js +21 -0
- package/dist/worker/console/static-src/operator-chat/turn-group-equality.js +16 -0
- package/dist/worker/console/static-src/operator-chat/turn-process-disclosure.js +18 -0
- package/dist/worker/console/static-src/operator-chat/turn-state-projection.js +166 -0
- package/dist/worker/console/static-src/operator-chat/turn-stream-controller.js +58 -2
- package/dist/worker/console/static-src/operator-chat/use-searchable-hidden.js +51 -0
- package/dist/worker/console/static-src/operator-chat/use-stat-dialog.js +95 -0
- package/dist/worker/console/static-src/operator-chat/useChatSessions.js +338 -93
- package/dist/worker/console/static-src/operator-chat/useChatStream.js +310 -106
- package/dist/worker/console/static-src/operator-chat/useChatThread.js +179 -75
- package/dist/worker/console/static-src/operator-chat/useComposer.js +281 -79
- package/dist/worker/console/static-src/operator-chat/useRepoBrowser.js +21 -3
- package/dist/worker/console/static-src/operator-chat/useRuntimeControls.js +36 -17
- package/dist/worker/console/static-src/operator-chat/useRuntimeSnapshot.js +18 -0
- package/dist/worker/console/static-src/operator-chat/useWorkspaceBrowserGate.js +4 -0
- package/dist/worker/console/static-src/operator-chat/user-turn-anchor-equality.js +21 -0
- package/dist/worker/console/static-src/prd-file-import.js +3 -1
- package/dist/worker/console/static-src/shell/console-update-reload.js +1 -1
- package/dist/worker/console/workspace-context.js +54 -1
- package/dist/worker/console/workspace-initialization.js +218 -0
- package/dist/worker/delivery/git-transaction.js +2 -0
- package/dist/worker/delivery/package.js +4 -1
- package/dist/worker/feature/fullstack-validate.js +2 -0
- package/dist/worker/loop-agent/loop-agent-client.js +8 -2
- package/dist/worker/materialize/harness-task-lineage.js +4 -2
- package/dist/worker/materialize/harness-task-materializer.js +4 -1
- package/dist/worker/metrics/projector.js +1 -1
- package/dist/worker/observability/event-store.js +4 -1
- package/dist/worker/observability/read-model.js +27 -3
- package/dist/worker/observe/node-context-insights.js +479 -0
- package/dist/worker/observe/node-transparency.js +103 -72
- package/dist/worker/observe/routes.js +24 -1
- package/dist/worker/observe/static/console-theme.css +178 -0
- package/dist/worker/observe/static/console-theme.js +74 -0
- package/dist/worker/observe/static/dag-inspector-humanize.js +3 -0
- package/dist/worker/observe/static/dom.js +20 -1
- package/dist/worker/observe/static/format-pool.d.ts +2 -0
- package/dist/worker/observe/static/format-pool.js +6 -0
- package/dist/worker/observe/static/format.js +7 -0
- package/dist/worker/observe/static/inspect-workspace.js +34 -7
- package/dist/worker/observe/static/inspector-submission.js +32 -0
- package/dist/worker/observe/static/kpi.js +1 -0
- package/dist/worker/observe/static/operator-chrome.css +85 -0
- package/dist/worker/observe/static/operator-chrome.js +13 -1
- package/dist/worker/observe/static/relations.js +2 -0
- package/dist/worker/observe/static/router.js +13 -0
- package/dist/worker/observe/static/run-processing.js +2 -0
- package/dist/worker/observe/static/shell-chrome.js +36 -3
- package/dist/worker/observe/static/state.js +35 -2
- package/dist/worker/observe/static/styles.css +263 -39
- package/dist/worker/observe/static/task-failure-labels.d.ts +4 -0
- package/dist/worker/observe/static/task-failure-labels.js +67 -0
- package/dist/worker/observe/static/task-history.js +12 -0
- package/dist/worker/observe/static/views/batch.js +6 -13
- package/dist/worker/observe/static/views/dag-graph.js +50 -3
- package/dist/worker/observe/static/views/dag-inspector.js +742 -268
- package/dist/worker/observe/static/views/dag-trajectory.js +3 -0
- package/dist/worker/observe/static/views/dag.d.ts +6 -0
- package/dist/worker/observe/static/views/dag.js +49 -11
- package/dist/worker/observe/static/views/dags.js +2 -0
- package/dist/worker/observe/static/views/dashboard.js +21 -12
- package/dist/worker/observe/static/views/failures.js +21 -11
- package/dist/worker/observe/static/views/feature.js +11 -29
- package/dist/worker/observe/static/views/pool.js +37 -28
- package/dist/worker/observe/static/views/run.js +48 -5
- package/dist/worker/observe/static/views/session-timeline.js +189 -240
- package/dist/worker/observe/static/views/task.js +81 -62
- package/dist/worker/outcomes/declared-artifacts.js +2 -0
- package/dist/worker/preflight.js +3 -0
- package/dist/worker/scheduler/scheduled-goal-dispatch.js +118 -0
- package/dist/worker/scheduler/scheduled-goal-evidence.js +230 -0
- package/dist/worker/scheduler/scheduled-goal-recovery.js +62 -0
- package/dist/worker/scheduler/scheduled-goal-store.js +709 -0
- package/dist/worker/scheduler/scheduled-goal-supervisor.js +132 -0
- package/dist/worker/scheduler/scheduled-goal-time.js +102 -0
- package/dist/worker/scheduler/scheduled-goal-types.js +95 -0
- package/dist/worker/task-spec/validate.js +4 -1
- package/dist/workflows/dag/backend-test-case-coverage-analysis.js +3 -1
- package/dist/workflows/dag/backend-test-layout.js +27 -7
- package/dist/workflows/dag/backend-test-markdown-workflow.js +9 -25
- package/dist/workflows/dag/backend-test-plan-protocol.js +82 -5
- package/dist/workflows/dag/backend-test-pytest-collection.js +4 -1
- package/dist/workflows/dag/budget-enforcement.js +82 -3
- package/dist/workflows/dag/checkpoint.js +686 -0
- package/dist/workflows/dag/dag-retry-schema.js +14 -0
- package/dist/workflows/dag/decision-envelope.js +2 -0
- package/dist/workflows/dag/dynamic-runtime/shared.js +2 -2
- package/dist/workflows/dag/final-verification.js +45 -10
- package/dist/workflows/dag/frontend-capacity.js +9 -0
- package/dist/workflows/dag/frontend-closeout.js +5 -1
- package/dist/workflows/dag/frontend-committed-facts.js +461 -0
- package/dist/workflows/dag/frontend-contract-facts.js +133 -0
- package/dist/workflows/dag/frontend-design-policy.js +107 -21
- package/dist/workflows/dag/frontend-durable-tools.js +225 -0
- package/dist/workflows/dag/frontend-execution-groups.js +24 -0
- package/dist/workflows/dag/frontend-implementation-contract.js +554 -26
- package/dist/workflows/dag/frontend-input-projection.js +76 -0
- package/dist/workflows/dag/frontend-plan-canary.js +103 -0
- package/dist/workflows/dag/frontend-plan-decision-contract.js +795 -0
- package/dist/workflows/dag/frontend-plan-progress.js +92 -0
- package/dist/workflows/dag/frontend-plan-recovery-policy.js +18 -0
- package/dist/workflows/dag/frontend-plan-render.js +21 -5
- package/dist/workflows/dag/frontend-provider-capability-matrix.js +8 -61
- package/dist/workflows/dag/frontend-recovery-controller.js +7 -7
- package/dist/workflows/dag/frontend-recovery-lineage.js +13 -0
- package/dist/workflows/dag/frontend-recovery-plan.js +10 -5
- package/dist/workflows/dag/frontend-recovery-run.js +148 -47
- package/dist/workflows/dag/frontend-repair-assertions.js +36 -0
- package/dist/workflows/dag/frontend-repair.js +79 -76
- package/dist/workflows/dag/frontend-review-context.js +71 -69
- package/dist/workflows/dag/frontend-review-scopes.js +237 -0
- package/dist/workflows/dag/frontend-risk.js +101 -12
- package/dist/workflows/dag/frontend-root-observation.js +261 -0
- package/dist/workflows/dag/frontend-session-budget.js +376 -0
- package/dist/workflows/dag/frontend-session-context.js +10 -0
- package/dist/workflows/dag/frontend-shape-facts.js +12 -2
- package/dist/workflows/dag/frontend-shape.js +27 -32
- package/dist/workflows/dag/frontend-test-case-checklist.js +12 -3
- package/dist/workflows/dag/frontend-test-case-generation-assessment.js +21 -2
- package/dist/workflows/dag/frontend-test-case-quality.js +3 -3
- package/dist/workflows/dag/frontend-test-environment-probe.js +0 -2
- package/dist/workflows/dag/frontend-test-execution-evidence.js +328 -0
- package/dist/workflows/dag/frontend-test-framework-adapters.js +309 -0
- package/dist/workflows/dag/frontend-test-layout.js +41 -12
- package/dist/workflows/dag/frontend-typed-event-store.js +57 -26
- package/dist/workflows/dag/frontend-verification-trace.js +65 -48
- package/dist/workflows/dag/frontend-writer-admission.js +6 -48
- package/dist/workflows/dag/frontend-writer-status.js +0 -23
- package/dist/workflows/dag/hybrid/sources.js +1831 -0
- package/dist/workflows/dag/hybrid/templates/backend-test.js +1822 -0
- package/dist/workflows/dag/hybrid/templates/frontend-test.js +807 -0
- package/dist/workflows/dag/hybrid/templates/frontend.js +1529 -0
- package/dist/workflows/dag/hybrid/templates/index.js +8 -0
- package/dist/workflows/dag/hybrid/templates/kg-bootstrap.js +449 -0
- package/dist/workflows/dag/hybrid/templates/knowledge-sync.js +495 -0
- package/dist/workflows/dag/hybrid/templates/shared.js +101 -0
- package/dist/workflows/dag/hybrid/templates/standard.js +265 -0
- package/dist/workflows/dag/hybrid/types.js +32 -0
- package/dist/workflows/dag/init-hybrid.js +57 -7167
- package/dist/workflows/dag/interrupt-request.js +2 -0
- package/dist/workflows/dag/lifecycle.js +11 -2
- package/dist/workflows/dag/node-execution.js +257 -247
- package/dist/workflows/dag/output-protocol.js +1 -0
- package/dist/workflows/dag/prompt.js +4 -0
- package/dist/workflows/dag/reconcile-run.js +2 -0
- package/dist/workflows/dag/repair-artifact.js +3 -1
- package/dist/workflows/dag/report.js +2 -0
- package/dist/workflows/dag/rerun-feedback.js +36 -4
- package/dist/workflows/dag/rerun-plan.js +106 -4
- package/dist/workflows/dag/rerun-run.js +7 -0
- package/dist/workflows/dag/rerun-task.js +75 -1
- package/dist/workflows/dag/retry-policy.js +34 -10
- package/dist/workflows/dag/runner-exit-diagnostics.js +125 -0
- package/dist/workflows/dag/runner.js +38 -1074
- package/dist/workflows/dag/scheduler.js +2 -4
- package/dist/workflows/dag/skill-instructions.js +102 -32
- package/dist/workflows/dag/skill-snapshot.js +3 -0
- package/dist/workflows/dag/skills.js +7 -7
- package/dist/workflows/dag/structured-output-repair.js +4 -1
- package/dist/workflows/dag/terminal-status.js +502 -0
- package/dist/workflows/dag/test-artifact-namespace.js +73 -0
- package/dist/workflows/dag/types.js +58 -7
- package/dist/workflows/dag/validate.js +38 -13
- package/dist/workflows/dag/workspace-checkpoint.js +79 -1
- package/dist/workflows/loop/benchmark.js +11 -8
- package/docs/README.md +2 -1
- package/docs/architecture/dag-execution.md +4 -4
- package/docs/architecture/runtime-boundaries.md +29 -23
- package/docs/governance/README.md +1 -0
- package/docs/governance/harness-methodology-verification.md +11 -0
- package/docs/init-surface.manifest.json +44 -295
- package/docs/operations/README.md +4 -0
- package/docs/templates/README.md +5 -5
- package/docs/templates/agent-dag.base.json +9 -9
- package/docs/templates/agent-dag.final-verification.json +6 -6
- package/docs/templates/agent-dag.schema.json +2 -2
- package/docs/templates/agent-dag.supervised-implementation.json +12 -12
- package/docs/templates/backend-test-dag.generate-pytest.prompt.md +3 -3
- package/docs/templates/backend-test-dag.json +708 -703
- package/docs/templates/backend-test-dag.review-cases.prompt.md +3 -3
- package/docs/templates/frontend-design-contract.md +4 -4
- package/docs/templates/frontend-implementation-contract.schema.json +99 -22
- package/docs/templates/frontend-implementation-dag.json +7 -7
- package/docs/templates/frontend-test-case-checklist.md +2 -2
- package/docs/templates/frontend-test-case.example.md +2 -0
- package/docs/templates/frontend-test-dag.generate-cases.prompt.md +1 -1
- package/docs/templates/frontend-test-dag.json +46 -37
- package/docs/templates/frontend-test-dag.retrieve-context.prompt.md +2 -2
- package/docs/templates/frontend-test-dag.retrospect.prompt.md +1 -1
- package/docs/templates/frontend-test-dag.review-cases.prompt.md +1 -1
- package/docs/templates/hybrid-dag.json +9 -9
- package/docs/templates/knowledge-sync-dag.json +8 -8
- package/harness.json +1 -1
- package/package.json +27 -8
- package/resource-catalog.v1.json +1981 -0
- package/resources/agent-bridge/loop-agent/SKILL.md +40 -0
- package/resources/init-history/legacy-surface.v1.json +33 -0
- package/skills/fe-test-ui-scout/SKILL.md +4 -4
- package/skills/fe-test-ui-scout/references/ledger-schema.md +1 -1
- package/skills/frontend-bounded-implement/references/code-standards.md +3 -3
- package/skills/frontend-contract/SKILL.md +2 -1
- package/skills/frontend-contract/references/contract-protocol.md +22 -4
- package/skills/frontend-design-review/SKILL.md +16 -18
- package/skills/frontend-design-review/references/review-checklist.md +3 -4
- package/skills/frontend-plan/SKILL.md +25 -3
- package/skills/frontend-plan/references/decision-contract.md +117 -8
- package/skills/frontend-plan/references/design-decisions.md +32 -0
- package/skills/frontend-review/SKILL.md +29 -36
- package/skills/frontend-review/references/review-findings.md +8 -3
- package/skills/frontend-scout/references/scout-evidence.md +4 -0
- package/skills/init-update/SKILL.md +34 -0
- package/skills/init-update/agents/openai.yaml +6 -0
- package/skills/loop-agent/references/command-reference.md +8 -0
- package/skills/loop-agent/references/hybrid-dag.md +1 -1
- package/skills/playwright-cli/SKILL.md +1 -1
- package/skills/playwright-cli-case-generator/SKILL.md +7 -5
- package/dist/commands/new-task.js +0 -5
- package/dist/commands/status.js +0 -57
- package/dist/commands/task-contract.js +0 -269
- package/dist/shared/prompts.js +0 -26
- package/dist/task/config.js +0 -2
- package/dist/task/contract/validate-draft.js +0 -106
- package/dist/task/goal.js +0 -3
- package/dist/task/index.js +0 -12
- package/dist/task/lifecycle.js +0 -1
- package/dist/task/operator/capabilities.js +0 -6
- package/dist/task/operator/envelope.js +0 -2
- package/dist/task/operator/index.js +0 -5
- package/dist/task/operator/registry.js +0 -2
- package/dist/task/paths.js +0 -1
- package/dist/task/source-state.js +0 -1
- package/dist/task/subagent-guidance.js +0 -1
- package/dist/worker/console/chat/sift-bridge.js +0 -1
- package/dist/worker/console/index.js +0 -20
- package/dist/worker/console/static/assets/channel-CXqdP5pW.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-D9C3agF7.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-D9C3agF7.js +0 -1
- package/dist/worker/console/static/assets/index-CAZ2fC_X.css +0 -1
- package/dist/worker/console/static/assets/index-DhfjOafu.js +0 -449
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-Tp7V0U4q.js +0 -1
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-DUZWZWi8.js +0 -8
- package/dist/worker/scheduler/index.js +0 -25
- package/dist/workflows/dag/facts.js +0 -4
- package/dist/workflows/dag/frontend-shadow-dual-write.js +0 -941
- package/dist/workflows/dag/index.js +0 -6
- package/dist/workflows/dynamic/index.js +0 -7
- /package/dist/{task/operator/types.js → executors/dag-pi/plan/session.js} +0 -0
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { reserveTaskSourceProviderRequest } from "../../task/source-prepare/source-provider-budget.js";
|
|
2
|
+
import { frontendPlanSemanticDigest } from "./frontend-plan-progress.js";
|
|
3
|
+
import { collectFrontendExecutionGroups } from "./frontend-execution-groups.js";
|
|
4
|
+
import { reserveDagProviderRequest } from "./budget-enforcement.js";
|
|
1
5
|
import { createHash } from "node:crypto";
|
|
2
6
|
import { existsSync } from "node:fs";
|
|
3
7
|
import { readFile } from "node:fs/promises";
|
|
@@ -13,7 +17,7 @@ import { buildDagNodePromptEnvelope, formatConvergenceFeedbackBlock, } from "./p
|
|
|
13
17
|
import { persistLongNodeOutputArtifacts } from "./upstream-artifacts.js";
|
|
14
18
|
import { materializeDeclaredArtifactFacts } from "./artifact-bindings.js";
|
|
15
19
|
import { buildOutputLimitRecoverySection, loadBackendTestWriterProgressForRetry, } from "./backend-test-writer-completeness.js";
|
|
16
|
-
import { computeBackoffDelayMs, isCanonicalFinalVerifyShellRetryCandidate, isRetryablePiFailureCategory, isSafeReadOnlyPiRetryCandidate, isTargetTemplateTransientRetryNode, isWriterEmptyDiffRetryCandidate, isWriterTransportRetryCandidate, projectFrontendNodeProtocolFailureReason, resolveFrontendPlanBackupRoute, resolveFrontendPlanRetryStep, VERIFY_SHELL_RETRY_POLICY, } from "./retry-policy.js";
|
|
20
|
+
import { computeBackoffDelayMs, isCanonicalFinalVerifyShellRetryCandidate, isProviderAvailabilityFailureCategory, isRetryablePiFailureCategory, isSafeReadOnlyPiRetryCandidate, isTargetTemplateTransientRetryNode, isWriterEmptyDiffRetryCandidate, isWriterTransportRetryCandidate, OUTPUT_LIMIT_RETRY_CATEGORY, projectFrontendNodeProtocolFailureReason, resolveFrontendPlanBackupRoute, resolveFrontendPlanRetryStep, VERIFY_SHELL_RETRY_POLICY, } from "./retry-policy.js";
|
|
17
21
|
import { applyNodeActivity, evaluateNodeLiveness, resolveLivenessPolicy, } from "./liveness-policy.js";
|
|
18
22
|
import { buildProtocolRetryInstruction, normalizeReviewVerdictAfterRetries, parseJsonReviewVerdict, validateOutputProtocol, } from "./output-protocol.js";
|
|
19
23
|
import { getStructuredContractValidator } from "./contract-output-registry.js";
|
|
@@ -21,6 +25,7 @@ import "./contract-validator-registrations.js";
|
|
|
21
25
|
import { computeNormalizedFailureFingerprint } from "./frontend-recovery-lineage.js";
|
|
22
26
|
import { parseLedgerJson } from "../../task/source-prepare/ledger.js";
|
|
23
27
|
import { readTypedEventStoreFromJsonl } from "./frontend-typed-event-store.js";
|
|
28
|
+
import { collectCanonicalStateFlowNames, extractRequiredDeliverablePaths, resolveFrontendContractRequirements, } from "./frontend-contract-facts.js";
|
|
24
29
|
import { allowedRepairReadPaths, auditRepairAttemptToolUse, buildStructuredOutputRepairPrompt, freezeStructuredOutputRepairContext, hasNonEmptyStructuredCandidate, isFrontendStructuredRepairSchemaId, isStructuredRepairableFailureCategory, persistStructuredAttemptRaw, sessionEventsByteLength, GOVERNANCE_BLOCKED_CATEGORY, STRUCTURED_REPAIR_EXHAUSTED_CATEGORY, } from "./structured-output-repair.js";
|
|
25
30
|
import { readFrontendCanonicalCandidate } from "./frontend-implementation-contract.js";
|
|
26
31
|
import { writeDagNodeJsonArtifact } from "../../infrastructure/harness/artifact-store.js";
|
|
@@ -256,6 +261,9 @@ function frontendPlanValidationRetryGuidance(reason) {
|
|
|
256
261
|
if (/verificationTargets.*uiStates|uiStates.*verificationTargets/i.test(reason)) {
|
|
257
262
|
guidance.push("For this retry, provide verificationTargets[].uiStates as an array; use [] when the target has no named UI state.");
|
|
258
263
|
}
|
|
264
|
+
if (/duplicate|already recorded/i.test(reason)) {
|
|
265
|
+
guidance.push("For this retry, re-commit the corrected entry with the same id and replace=true; the ledger compiles the latest submission as the full replacement. A duplicate receipt is a correction invitation, not a prohibition, and backfilling a cited fact's reverse reference in-node does not re-derive committed facts.");
|
|
266
|
+
}
|
|
259
267
|
return guidance;
|
|
260
268
|
}
|
|
261
269
|
function compactRetryText(text, maxChars) {
|
|
@@ -293,6 +301,12 @@ export function buildContextOverflowRetryPrompt(task, basePrompt) {
|
|
|
293
301
|
compactRetrySection(basePrompt, "task", COMPACT_RETRY_TASK_MAX_CHARS),
|
|
294
302
|
"</task>",
|
|
295
303
|
].join("\n"),
|
|
304
|
+
// Plan still needs the complete frozen obligations for ledger ownership
|
|
305
|
+
// and scoped projection. Its executor packs this block before dispatch;
|
|
306
|
+
// dropping or character-truncating it prevents safe progress recovery.
|
|
307
|
+
...(isFrontendPlanLadderTask(task)
|
|
308
|
+
? [basePrompt.match(/<frontend_plan_input>[\s\S]*?<\/frontend_plan_input>/)?.[0] ?? ""]
|
|
309
|
+
: []),
|
|
296
310
|
].join("\n\n");
|
|
297
311
|
}
|
|
298
312
|
function isFrontendPlanLadderTask(task) {
|
|
@@ -325,6 +339,8 @@ const FRONTEND_CONTRACT_RECORD_TOOL_NAMES_LOCAL = new Set([
|
|
|
325
339
|
"record_handoff_intent",
|
|
326
340
|
"record_open_question",
|
|
327
341
|
"record_split_proposal",
|
|
342
|
+
"record_ui_state",
|
|
343
|
+
"record_required_deliverables",
|
|
328
344
|
]);
|
|
329
345
|
async function countContractRecordSubmissions(runDir, nodeId) {
|
|
330
346
|
const eventsPath = path.join(runDir, nodeId, "session-events.jsonl");
|
|
@@ -360,41 +376,24 @@ async function countContractRecordSubmissions(runDir, nodeId) {
|
|
|
360
376
|
* `hasTerminalFact` reflects a committed `finalize_plan` terminal fact.
|
|
361
377
|
*/
|
|
362
378
|
async function readFrontendPlanCommittedSnapshot(runDir, nodeId) {
|
|
363
|
-
const
|
|
364
|
-
const
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
.sort()
|
|
369
|
-
.join("\n"))
|
|
370
|
-
.digest("hex");
|
|
371
|
-
const hasTerminalFact = committed.some((record) => record.fact.kind === "finalize_plan");
|
|
379
|
+
const decisions = await readTypedEventStoreFromJsonl(path.join(runDir, nodeId, "plan-decision-facts.jsonl"));
|
|
380
|
+
const records = decisions.some(r => r.phase === "committed") ? decisions : await readTypedEventStoreFromJsonl(path.join(runDir, nodeId, "plan-typed-facts.jsonl"));
|
|
381
|
+
const committed = records.filter(record => record.phase === "committed");
|
|
382
|
+
const digest = frontendPlanSemanticDigest(committed);
|
|
383
|
+
const hasTerminalFact = committed.some((record) => ["finalize_plan", "finalize_decision"].includes(String(record.fact.kind)));
|
|
372
384
|
return { digest, hasTerminalFact };
|
|
373
385
|
}
|
|
374
386
|
function planInputRecord(value) {
|
|
375
387
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
376
388
|
}
|
|
377
|
-
function planInputText(value,
|
|
378
|
-
|
|
379
|
-
return undefined;
|
|
380
|
-
const normalized = value.trim();
|
|
381
|
-
return normalized.length <= maxChars
|
|
382
|
-
? normalized
|
|
383
|
-
: `${normalized.slice(0, maxChars - 1)}…`;
|
|
389
|
+
function planInputText(value, _maxChars) {
|
|
390
|
+
return typeof value === "string" && value.trim().length ? value.trim() : undefined;
|
|
384
391
|
}
|
|
385
392
|
function planInputStrings(value) {
|
|
386
393
|
return Array.isArray(value)
|
|
387
394
|
? value.filter((item) => typeof item === "string")
|
|
388
395
|
: [];
|
|
389
396
|
}
|
|
390
|
-
/** Input bound for the planner evidence block; protects the model input budget. */
|
|
391
|
-
const FRONTEND_PLAN_INPUT_MAX_CHARS = 12_000;
|
|
392
|
-
const FRONTEND_PLAN_INPUT_CAP_LADDER = [
|
|
393
|
-
{ text: 240, array: 40 },
|
|
394
|
-
{ text: 120, array: 20 },
|
|
395
|
-
{ text: 60, array: 10 },
|
|
396
|
-
{ text: 24, array: 4 },
|
|
397
|
-
];
|
|
398
397
|
/**
|
|
399
398
|
* Frozen requirement→PRD citation map for the plan review checklist: lets the
|
|
400
399
|
* model declare sourceRequirementIds whose section/line match the component
|
|
@@ -440,78 +439,19 @@ async function resolveComponentSourceCitations(spec, cwd) {
|
|
|
440
439
|
return new Map();
|
|
441
440
|
}
|
|
442
441
|
}
|
|
443
|
-
/** Input bound for the contract node's compiled ledger block. */
|
|
444
|
-
const FRONTEND_CONTRACT_INPUT_MAX_CHARS = 12_000;
|
|
445
442
|
/**
|
|
446
|
-
* Render the contract node's complete
|
|
443
|
+
* Render the contract node's complete semantic ledger handoff. The
|
|
447
444
|
* source-fidelity ledger already extracted canonical requirements with source
|
|
448
445
|
* spans; the contract node confirms and commits them incrementally through
|
|
449
446
|
* record_requirement instead of re-reading the raw source (extreme-environment:
|
|
450
447
|
* a small output window cannot absorb a full source re-read).
|
|
451
448
|
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
449
|
+
* Whole obligations are retained here; the executor selects complete scopes
|
|
450
|
+
* before dispatch. References and conditions are never clipped.
|
|
454
451
|
*/
|
|
455
452
|
export function renderFrontendContractInputContext(input) {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
// sourceFragmentIds entirely, the model (correctly refusing to invent ids)
|
|
459
|
-
// committed empty bindings, and the plan compile failed the ledger-binding
|
|
460
|
-
// gate for every requirement. Bindings therefore bypass the cap ladder and
|
|
461
|
-
// every degradation level; only requirement TEXTS and fragment CONTEXT
|
|
462
|
-
// (path/headingPath) may degrade. Fragment context is rendered only for
|
|
463
|
-
// fragments actually referenced by a requirement and shrinks first.
|
|
464
|
-
const referencedFragmentIds = new Set(input.canonicalRequirements.flatMap((requirement) => planInputStrings(requirement.sourceFragmentIds)));
|
|
465
|
-
const referencedFragments = input.fragments.filter((fragment) => referencedFragmentIds.has(fragment.id));
|
|
466
|
-
const serializeAtCap = (cap) => JSON.stringify({
|
|
467
|
-
requirements: input.canonicalRequirements.map((requirement) => ({
|
|
468
|
-
id: requirement.id,
|
|
469
|
-
text: planInputText(requirement.text, cap.text),
|
|
470
|
-
sourceFragmentIds: planInputStrings(requirement.sourceFragmentIds),
|
|
471
|
-
})),
|
|
472
|
-
fragments: referencedFragments.map((fragment) => ({
|
|
473
|
-
id: fragment.id,
|
|
474
|
-
path: planInputText(fragment.path, 200),
|
|
475
|
-
headingPath: planInputText(fragment.headingPath, 120),
|
|
476
|
-
lineRange: fragment.lineRange,
|
|
477
|
-
})),
|
|
478
|
-
});
|
|
479
|
-
let serialized = serializeAtCap(FRONTEND_PLAN_INPUT_CAP_LADDER[0]);
|
|
480
|
-
for (const cap of FRONTEND_PLAN_INPUT_CAP_LADDER.slice(1)) {
|
|
481
|
-
if (serialized.length <= FRONTEND_CONTRACT_INPUT_MAX_CHARS)
|
|
482
|
-
break;
|
|
483
|
-
serialized = serializeAtCap(cap);
|
|
484
|
-
}
|
|
485
|
-
if (serialized.length > FRONTEND_CONTRACT_INPUT_MAX_CHARS) {
|
|
486
|
-
// Last resort: keep every requirement id AND its fragment bindings,
|
|
487
|
-
// degrade texts, and shrink referenced fragment context first (halve,
|
|
488
|
-
// then drop context fields, then drop the fragment list entirely).
|
|
489
|
-
// Requirement ids and sourceFragmentIds are never dropped.
|
|
490
|
-
let fragments = referencedFragments.map((fragment) => ({
|
|
491
|
-
id: fragment.id,
|
|
492
|
-
path: planInputText(fragment.path, 120),
|
|
493
|
-
}));
|
|
494
|
-
let requirements = input.canonicalRequirements.map((requirement) => {
|
|
495
|
-
const sourceFragmentIds = planInputStrings(requirement.sourceFragmentIds);
|
|
496
|
-
return {
|
|
497
|
-
id: requirement.id,
|
|
498
|
-
text: "(truncated)",
|
|
499
|
-
// Empty bindings carry no information; omit them so the payload
|
|
500
|
-
// stays inside the char bound when no requirement is bound.
|
|
501
|
-
...(sourceFragmentIds.length > 0 ? { sourceFragmentIds } : {}),
|
|
502
|
-
};
|
|
503
|
-
});
|
|
504
|
-
let bounded = JSON.stringify({ degraded: "requirement-texts-truncated", requirements, fragments });
|
|
505
|
-
while (bounded.length > FRONTEND_CONTRACT_INPUT_MAX_CHARS && fragments.length > 0) {
|
|
506
|
-
fragments = fragments.slice(0, Math.floor(fragments.length / 2));
|
|
507
|
-
bounded = JSON.stringify({
|
|
508
|
-
degraded: "requirement-texts-truncated",
|
|
509
|
-
requirements,
|
|
510
|
-
fragments,
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
serialized = bounded;
|
|
514
|
-
}
|
|
453
|
+
const referenced = new Set(input.canonicalRequirements.flatMap(r => r.sourceFragmentIds));
|
|
454
|
+
const serialized = JSON.stringify({ requirements: input.canonicalRequirements, fragments: input.fragments.filter(f => referenced.has(f.id)) });
|
|
515
455
|
return [
|
|
516
456
|
"<frontend_contract_input>",
|
|
517
457
|
"Canonical requirements extracted by the source-fidelity ledger, compiled by the runner. Treat them as the authoritative requirement inventory: confirm and commit each requirement through record_requirement (one per tool call); the ledger already binds source fragments, so do NOT re-read the raw source files.",
|
|
@@ -536,16 +476,13 @@ export async function buildFrontendContractInputContext(input) {
|
|
|
536
476
|
});
|
|
537
477
|
}
|
|
538
478
|
/**
|
|
539
|
-
* Render the planner's complete
|
|
479
|
+
* Render the planner's complete semantic evidence handoff from committed
|
|
540
480
|
* typed facts. It deliberately excludes upstream response prose and artifact
|
|
541
481
|
* paths: Contract and Scout have already established these facts, so Plan
|
|
542
482
|
* should decide and commit rather than spend another model turn reading them.
|
|
543
483
|
*
|
|
544
|
-
*
|
|
545
|
-
*
|
|
546
|
-
* fallback keeps every requirement id (with `text: "(truncated)"`) while
|
|
547
|
-
* declaring the degradation, so the planner records targeted evidence gaps
|
|
548
|
-
* instead of receiving a silently corrupted tail.
|
|
484
|
+
* Whole obligations are retained. Session packing and scoped projection happen
|
|
485
|
+
* in the executor before dispatch, without dropping text or source identities.
|
|
549
486
|
*/
|
|
550
487
|
export function renderFrontendPlanInputContext(input) {
|
|
551
488
|
const committedFacts = (records) => records.flatMap((record) => record.phase === "committed" && planInputRecord(record.fact)
|
|
@@ -553,8 +490,9 @@ export function renderFrontendPlanInputContext(input) {
|
|
|
553
490
|
: []);
|
|
554
491
|
const contractFacts = committedFacts(input.contractRecords);
|
|
555
492
|
const scoutFacts = committedFacts(input.scoutRecords);
|
|
556
|
-
const
|
|
557
|
-
|
|
493
|
+
const requirementFacts = resolveFrontendContractRequirements(contractFacts);
|
|
494
|
+
const requiredDeliverables = extractRequiredDeliverablePaths(contractFacts);
|
|
495
|
+
const requirements = requirementFacts
|
|
558
496
|
.map((fact) => ({
|
|
559
497
|
id: planInputText(fact.id, 80),
|
|
560
498
|
text: planInputText(fact.text),
|
|
@@ -580,97 +518,55 @@ export function renderFrontendPlanInputContext(input) {
|
|
|
580
518
|
paths: fact.paths,
|
|
581
519
|
conflicts: fact.conflicts,
|
|
582
520
|
}));
|
|
521
|
+
// Authoritative UI states (contract-declared): the source's UI-state table
|
|
522
|
+
// extracted by the contract node. The planner binds these ids instead of
|
|
523
|
+
// inventing list-visibility variants.
|
|
524
|
+
const declaredUiStates = contractFacts
|
|
525
|
+
.filter((fact) => fact.kind === "ui-state-declaration" && fact.origin === "contract")
|
|
526
|
+
.map((fact) => ({
|
|
527
|
+
id: planInputText(fact.id, 80),
|
|
528
|
+
trigger: planInputText(fact.trigger),
|
|
529
|
+
observableOutcome: planInputText(fact.observableOutcome),
|
|
530
|
+
}))
|
|
531
|
+
.filter((state) => state.id !== undefined);
|
|
532
|
+
// Replay registry edits and state-flow removals/additions in commit order.
|
|
533
|
+
const committedUxNames = collectCanonicalStateFlowNames(input.planRecords ?? [], true);
|
|
534
|
+
const committedUiStateNames = [...committedUxNames.uiStateNames];
|
|
535
|
+
const committedInteractionNames = [...committedUxNames.interactionNames];
|
|
583
536
|
// Reviewer-rubric scaffold: the design reviewer re-runs the design-policy
|
|
584
537
|
// checks on the committed facts, so publish the checklist to the producer.
|
|
585
538
|
// Requirements whose contract evidence expects behavioural verification are
|
|
586
539
|
// enumerated explicitly — those are the slots the reviewer finds missing
|
|
587
540
|
// when the plan models interactions ad hoc (r8/r9 findings).
|
|
588
|
-
const behaviorRequiredIds =
|
|
589
|
-
.filter((requirement) =>
|
|
590
|
-
const fact = contractFacts.find((candidate) => candidate.kind === "requirement" &&
|
|
591
|
-
candidate.origin === "contract" &&
|
|
592
|
-
candidate.id === requirement.id);
|
|
593
|
-
const evidence = fact?.evidence;
|
|
594
|
-
return evidence?.behavior === "required";
|
|
595
|
-
})
|
|
541
|
+
const behaviorRequiredIds = requirementFacts
|
|
542
|
+
.filter((requirement) => requirement.evidence.behavior === "required")
|
|
596
543
|
.map((requirement) => requirement.id);
|
|
597
|
-
const
|
|
598
|
-
requirements
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
})),
|
|
603
|
-
targetSurface: targetSurface.map((surface) => ({
|
|
604
|
-
completeness: planInputText(surface.completeness, 32),
|
|
605
|
-
entrypoint: planInputText(surface.entrypoint, cap.text),
|
|
606
|
-
routeOrMount: planInputText(surface.routeOrMount, cap.text),
|
|
607
|
-
implementationPaths: planInputStrings(surface.implementationPaths).slice(0, cap.array),
|
|
608
|
-
testPaths: planInputStrings(surface.testPaths).slice(0, cap.array),
|
|
609
|
-
dataSource: planInputText(surface.dataSource, cap.text),
|
|
610
|
-
allowedPathConflicts: planInputStrings(surface.allowedPathConflicts).slice(0, cap.array),
|
|
611
|
-
unresolvedPaths: planInputStrings(surface.unresolvedPaths).slice(0, cap.array),
|
|
612
|
-
})),
|
|
613
|
-
designEvidence: designEvidence.map((evidence) => ({
|
|
614
|
-
source: planInputText(evidence.source, cap.text),
|
|
615
|
-
paths: planInputStrings(evidence.paths).slice(0, cap.array),
|
|
616
|
-
conflicts: planInputStrings(evidence.conflicts).slice(0, cap.array),
|
|
617
|
-
})),
|
|
544
|
+
const serialized = JSON.stringify({
|
|
545
|
+
requirements, requiredDeliverables, targetSurface, designEvidence, declaredUiStates,
|
|
546
|
+
executionGroups: collectFrontendExecutionGroups(contractFacts.filter(f => f.kind === "requirement").map(f => ({ id: String(f.id), execution: f.execution }))),
|
|
547
|
+
constraints: contractFacts.filter(f => ["constraint", "open-question", "split-proposal", "handoff-intent"].includes(String(f.kind))),
|
|
548
|
+
committedUx: committedUiStateNames.length || committedInteractionNames.length ? { uiStateNames: committedUiStateNames, interactionNames: committedInteractionNames } : undefined,
|
|
618
549
|
});
|
|
619
|
-
let serialized = serializeAtCap(FRONTEND_PLAN_INPUT_CAP_LADDER[0]);
|
|
620
|
-
for (const cap of FRONTEND_PLAN_INPUT_CAP_LADDER.slice(1)) {
|
|
621
|
-
if (serialized.length <= FRONTEND_PLAN_INPUT_MAX_CHARS)
|
|
622
|
-
break;
|
|
623
|
-
serialized = serializeAtCap(cap);
|
|
624
|
-
}
|
|
625
|
-
if (serialized.length > FRONTEND_PLAN_INPUT_MAX_CHARS) {
|
|
626
|
-
// Last resort: keep every requirement id (ids are short and the plan
|
|
627
|
-
// prompt separately lists them) but drop their texts, shrink scout facts
|
|
628
|
-
// to the minimum, and declare the degradation instead of corrupting JSON.
|
|
629
|
-
let fallback = {
|
|
630
|
-
degraded: "requirement-texts-truncated",
|
|
631
|
-
requirements: requirements.map((requirement) => ({
|
|
632
|
-
id: requirement.id,
|
|
633
|
-
text: "(truncated)",
|
|
634
|
-
})),
|
|
635
|
-
targetSurface: targetSurface.map((surface) => ({
|
|
636
|
-
completeness: planInputText(surface.completeness, 32),
|
|
637
|
-
implementationPaths: planInputStrings(surface.implementationPaths).slice(0, FRONTEND_PLAN_INPUT_CAP_LADDER[3].array),
|
|
638
|
-
})),
|
|
639
|
-
designEvidence: [],
|
|
640
|
-
};
|
|
641
|
-
let bounded = JSON.stringify(fallback);
|
|
642
|
-
let keep = fallback.requirements.length;
|
|
643
|
-
while (bounded.length > FRONTEND_PLAN_INPUT_MAX_CHARS &&
|
|
644
|
-
keep > 0) {
|
|
645
|
-
keep = Math.max(0, Math.floor(keep / 2));
|
|
646
|
-
fallback = { ...fallback, requirements: fallback.requirements.slice(0, keep) };
|
|
647
|
-
bounded = JSON.stringify({
|
|
648
|
-
...fallback,
|
|
649
|
-
requirementIdsTruncated: keep < requirements.length,
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
serialized = bounded;
|
|
653
|
-
}
|
|
654
550
|
const checklistLines = [
|
|
655
|
-
"1.
|
|
656
|
-
"2. Every
|
|
657
|
-
"3. Every
|
|
658
|
-
"4.
|
|
551
|
+
"1. Record the GLOBAL UX vocabulary with record_state_registry BEFORE any record_state_flow: one stable behavior-domain name per state/interaction (e.g. planner-task-edit), never one name per AC number, and never a rename of an already-recorded concept. Coverage slices by AC; UX does not.",
|
|
552
|
+
"2. Every recorded interaction/uiState name must be in that registry, and uiState names must use the contract's declared authoritative ids (declaredUiStates below) when present.",
|
|
553
|
+
"3. Every interaction and every applicable UI state must be covered by a uiComponentChoices entry: its purpose equals the name, or the choice lists the name in covers (one choice may cover many ids). A reuse-existing decision without evidencePath is rejected; stylingStrategy alone covers nothing.",
|
|
554
|
+
"4. Every requirement marked (behavior) below needs modelled interactions plus at least one verification target that references it.",
|
|
659
555
|
"5. Verification targets may only reference UI states and requirements you actually recorded (the record_* tools reject unknown references).",
|
|
660
556
|
`Requirements requiring behavioural coverage: ${behaviorRequiredIds.length > 0 ? behaviorRequiredIds.join(", ") : "(none)"}`,
|
|
661
|
-
"6. A decision=new component must declare sourceRequirementIds and pass sourceFragmentId for the frozen PRD fragment whose section matches the component's purpose — the runtime validates that binding and derives specReference (path/section/line); the reviewer checks purpose↔citation consistency.",
|
|
557
|
+
"6. A decision=new component must declare sourceRequirementIds and pass sourceFragmentId for the frozen PRD fragment whose section matches the component's purpose — the runtime validates that binding and derives specReference (path/section/line); the reviewer checks purpose↔citation consistency. A decision=reuse-existing component must pass evidencePath pointing at the existing repo file that proves the reuse.",
|
|
662
558
|
...[...input.componentSourceCitations ?? []]
|
|
663
559
|
.filter(([id]) => behaviorRequiredIds.includes(id))
|
|
664
560
|
.flatMap(([id, citations]) => citations.map((citation) => ` ${id} + ${citation.fragmentId} → ${citation.section}${citation.line ? ` (line ${citation.line})` : ""}`)),
|
|
665
561
|
];
|
|
666
562
|
return [
|
|
667
563
|
"<frontend_plan_input>",
|
|
668
|
-
"Committed Contract/Scout facts, compiled by the runner. Treat them as the complete planning evidence.",
|
|
564
|
+
"Committed Contract/Scout facts, compiled by the runner. Treat them as the complete planning evidence. declaredUiStates are the authoritative UI states from the task source; committedUx (retry attempts) is the UX vocabulary already recorded — reuse those names, never re-invent them.",
|
|
669
565
|
serialized,
|
|
670
566
|
"Do not read upstream artifacts, task sources, or repository files. If this input cannot support a decision, record a genuine evidence gap.",
|
|
671
567
|
"</frontend_plan_input>",
|
|
672
568
|
"<plan_review_checklist>",
|
|
673
|
-
"
|
|
569
|
+
"Satisfy these checks in the committed facts before the runtime compiles and finalizes the Plan:",
|
|
674
570
|
...checklistLines,
|
|
675
571
|
"</plan_review_checklist>",
|
|
676
572
|
].join("\n");
|
|
@@ -692,6 +588,16 @@ export async function buildFrontendPlanInputContext(runDir, componentSourceCitat
|
|
|
692
588
|
// forbids reading anything.
|
|
693
589
|
throw new Error(`frontend-plan-input-unavailable: cannot read committed typed facts (${error instanceof Error ? error.message : String(error)})`);
|
|
694
590
|
}
|
|
591
|
+
// Retry-attempt continuity (UX slice visibility): the plan node's own
|
|
592
|
+
// committed facts are absent on the first attempt and present on retries;
|
|
593
|
+
// a missing file is normal there, not a broken pipeline.
|
|
594
|
+
let planRecords = [];
|
|
595
|
+
try {
|
|
596
|
+
planRecords = await readTypedEventStoreFromJsonl(path.join(runDir, "frontend-plan-pi", "plan-typed-facts.jsonl"));
|
|
597
|
+
}
|
|
598
|
+
catch {
|
|
599
|
+
planRecords = [];
|
|
600
|
+
}
|
|
695
601
|
const committedCount = [...contractRecords, ...scoutRecords].filter((record) => record.phase === "committed").length;
|
|
696
602
|
if (committedCount === 0) {
|
|
697
603
|
throw new Error(`frontend-plan-input-unavailable: no committed Contract/Scout facts in ${contractFactsPath} / ${scoutFactsPath}`);
|
|
@@ -699,12 +605,17 @@ export async function buildFrontendPlanInputContext(runDir, componentSourceCitat
|
|
|
699
605
|
return renderFrontendPlanInputContext({
|
|
700
606
|
contractRecords,
|
|
701
607
|
scoutRecords,
|
|
608
|
+
planRecords,
|
|
702
609
|
componentSourceCitations,
|
|
703
610
|
});
|
|
704
611
|
}
|
|
705
612
|
export function buildAttemptPrompt(task, basePrompt, attemptNumber, previousFailureCategory, previousProtocolReason, recoveryTargetPaths, recoveryDiagnostics, frontendPlanRetryStep) {
|
|
706
613
|
if (attemptNumber <= 1)
|
|
707
614
|
return basePrompt;
|
|
615
|
+
// Match the executor segmented Plan identity; custom nodes retain their terminal.
|
|
616
|
+
const planCompletion = task.id === FRONTEND_PLAN_NODE_ID
|
|
617
|
+
? "Stop after committing the required facts. The runtime compiles and finalizes the committed ledger automatically; only repair facts reported by its validation."
|
|
618
|
+
: "Then call finalize_plan exactly once.";
|
|
708
619
|
// Context overflow is a transport/session failure, not a plan-protocol
|
|
709
620
|
// failure. It must take precedence over the plan retry ladder so every
|
|
710
621
|
// retry, including a repeated plan overflow, starts from the compact
|
|
@@ -736,13 +647,97 @@ export function buildAttemptPrompt(task, basePrompt, attemptNumber, previousFail
|
|
|
736
647
|
"</retry_instruction>",
|
|
737
648
|
].join("\n");
|
|
738
649
|
}
|
|
650
|
+
// Repair-category guidance must outrank the retry ladder position: the
|
|
651
|
+
// ladder advances monotonically on transport failures (e.g. length →
|
|
652
|
+
// compact-terminal-first), and its "keep the committed ledger intact"
|
|
653
|
+
// instruction directly contradicts the repair action for invalid-output /
|
|
654
|
+
// truncated ledger facts (re-commit corrected record_* facts). When both
|
|
655
|
+
// apply, the model receives the repair instruction, not the rung script.
|
|
656
|
+
if (previousFailureCategory === "invalid-output" &&
|
|
657
|
+
task.structuredContractOutput &&
|
|
658
|
+
previousProtocolReason) {
|
|
659
|
+
// The frontend plan node's compile authority is the committed typed
|
|
660
|
+
// ledger, not a fenced JSON text artifact: its retry guidance must
|
|
661
|
+
// direct the model to re-commit corrected record_* facts and respect
|
|
662
|
+
// terminal ownership. The full-contract JSON guidance below applies
|
|
663
|
+
// only to nodes whose authority is still a text contract artifact.
|
|
664
|
+
if (task.structuredContractOutput.schemaId ===
|
|
665
|
+
"frontend-implementation-contract-plan-patch-v1") {
|
|
666
|
+
const splitGuidance = /write-set-too-large|split the task/.test(previousProtocolReason ?? "")
|
|
667
|
+
? [
|
|
668
|
+
"",
|
|
669
|
+
"The writeSet is too large for one implement node. Preserve the complete requirement and file coverage. This needs a Contract-level task split, not a Plan formatting repair. Report the write-set-too-large finding and the affected paths for the controller to resume Contract/split orchestration. Plan cannot change protected targets.files or call Contract-only tools; do not invent a split tool or discard required files.",
|
|
670
|
+
]
|
|
671
|
+
: [];
|
|
672
|
+
return [
|
|
673
|
+
basePrompt,
|
|
674
|
+
"",
|
|
675
|
+
"<retry_instruction>",
|
|
676
|
+
"Previous plan ledger facts failed canonical contract validation:",
|
|
677
|
+
previousProtocolReason,
|
|
678
|
+
"Fix the reported violations by re-committing corrected record_* facts. The committed typed ledger is the only compile authority.",
|
|
679
|
+
planCompletion,
|
|
680
|
+
"Do not emit a fenced JSON contract, protected skeleton fields, or an openspec-citations block; narrative JSON is not validated and wastes the output budget.",
|
|
681
|
+
...frontendPlanValidationRetryGuidance(previousProtocolReason),
|
|
682
|
+
...splitGuidance,
|
|
683
|
+
"</retry_instruction>",
|
|
684
|
+
].join("\n");
|
|
685
|
+
}
|
|
686
|
+
return [
|
|
687
|
+
basePrompt,
|
|
688
|
+
"",
|
|
689
|
+
"<retry_instruction>",
|
|
690
|
+
"Previous attempt produced an invalid frontend implementation contract:",
|
|
691
|
+
previousProtocolReason,
|
|
692
|
+
...frontendStructuredArtifactRetryGuidance(task.structuredContractOutput.schemaId),
|
|
693
|
+
"Fix every reported field violation: do not emit null for optional fields, do not misspell field names, and match the required types exactly.",
|
|
694
|
+
"</retry_instruction>",
|
|
695
|
+
].join("\n");
|
|
696
|
+
}
|
|
697
|
+
if (previousFailureCategory === "invalid-output" &&
|
|
698
|
+
task.id === "frontend-scout-pi") {
|
|
699
|
+
return [
|
|
700
|
+
basePrompt,
|
|
701
|
+
"",
|
|
702
|
+
"<retry_instruction>",
|
|
703
|
+
"The previous Scout attempt did not commit a complete, runtime-evidenced target surface.",
|
|
704
|
+
"Search the repository only as needed to establish the real entrypoint, implementation ownership, and applicable test path. Commit record_target_surface with completeness=complete and unresolvedPaths=[] only after at least one named target has fresh runtime evidence, unless the task source explicitly declares a greenfield target: in that case every future path must be source-declared by the runtime-enriched fact. If ownership truly cannot be established, record completeness=blocked with each unresolved path; do not make Plan discover it.",
|
|
705
|
+
"</retry_instruction>",
|
|
706
|
+
].join("\n");
|
|
707
|
+
}
|
|
708
|
+
if (previousFailureCategory === "structured-output-truncated" &&
|
|
709
|
+
task.structuredContractOutput) {
|
|
710
|
+
if (task.structuredContractOutput.schemaId ===
|
|
711
|
+
"frontend-implementation-contract-plan-patch-v1") {
|
|
712
|
+
return [
|
|
713
|
+
basePrompt,
|
|
714
|
+
"",
|
|
715
|
+
"<retry_instruction>",
|
|
716
|
+
"Previous attempt was truncated by the provider (stopReason=length) before the plan facts were fully committed.",
|
|
717
|
+
"Re-commit the missing record_* facts; the committed typed ledger is the only compile authority. Do NOT re-read contract/scout outputs or source files — use the facts already in context. Commit record_* facts one tool call per message.",
|
|
718
|
+
planCompletion,
|
|
719
|
+
"Do not emit a fenced JSON contract, protected skeleton fields, or an openspec-citations block; narrative JSON is not validated and wastes the output budget.",
|
|
720
|
+
"</retry_instruction>",
|
|
721
|
+
].join("\n");
|
|
722
|
+
}
|
|
723
|
+
return [
|
|
724
|
+
basePrompt,
|
|
725
|
+
"",
|
|
726
|
+
"<retry_instruction>",
|
|
727
|
+
"Previous attempt was truncated by the provider (stopReason=length) before the JSON contract was completed.",
|
|
728
|
+
...frontendStructuredArtifactRetryGuidance(task.structuredContractOutput.schemaId),
|
|
729
|
+
"The JSON artifact must be complete; omit evidence excerpts and duplicated upstream context.",
|
|
730
|
+
"</retry_instruction>",
|
|
731
|
+
].join("\n");
|
|
732
|
+
}
|
|
739
733
|
if (frontendPlanRetryStep === "compact-terminal-first") {
|
|
740
734
|
return [
|
|
741
735
|
basePrompt,
|
|
742
736
|
"",
|
|
743
737
|
"<retry_instruction>",
|
|
744
738
|
"Frontend plan retry ladder step: compact-terminal-first.",
|
|
745
|
-
"Do NOT rewrite the narrative. Only adopt already staged/quarantined fresh facts
|
|
739
|
+
"Do NOT rewrite the narrative. Only adopt already staged/quarantined fresh facts and fill the missing required facts.",
|
|
740
|
+
planCompletion,
|
|
746
741
|
"Keep the existing committed ledger intact; do not re-derive already committed facts.",
|
|
747
742
|
"</retry_instruction>",
|
|
748
743
|
].join("\n");
|
|
@@ -753,7 +748,8 @@ export function buildAttemptPrompt(task, basePrompt, attemptNumber, previousFail
|
|
|
753
748
|
"",
|
|
754
749
|
"<retry_instruction>",
|
|
755
750
|
"Frontend plan retry ladder step: bounded-tool-only.",
|
|
756
|
-
"Reduce reasoning and wall-clock time. Use only
|
|
751
|
+
"Reduce reasoning and wall-clock time. Use only the tools exposed for this session and only for the necessary missing facts.",
|
|
752
|
+
planCompletion,
|
|
757
753
|
"Do not expand scope or re-derive already committed facts.",
|
|
758
754
|
"</retry_instruction>",
|
|
759
755
|
].join("\n");
|
|
@@ -764,7 +760,8 @@ export function buildAttemptPrompt(task, basePrompt, attemptNumber, previousFail
|
|
|
764
760
|
"",
|
|
765
761
|
"<retry_instruction>",
|
|
766
762
|
"Frontend plan retry ladder step: backup-model.",
|
|
767
|
-
"A backup provider/model route was selected after repeated non-converging failures. Re-derive only the missing committed facts
|
|
763
|
+
"A backup provider/model route was selected after repeated non-converging failures. Re-derive only the missing committed facts; do not repeat the failed strategy.",
|
|
764
|
+
planCompletion,
|
|
768
765
|
"</retry_instruction>",
|
|
769
766
|
].join("\n");
|
|
770
767
|
}
|
|
@@ -803,87 +800,30 @@ export function buildAttemptPrompt(task, basePrompt, attemptNumber, previousFail
|
|
|
803
800
|
"",
|
|
804
801
|
"<retry_instruction>",
|
|
805
802
|
"Previous plan attempt issued too many read-only tool calls (read/grep/ls/find) and blew up the context window. Trust the upstream frontend-contract-pi typed requirement facts and frontend-scout-pi target surface already provided — do NOT re-read contract/scout stdout, PRD/source files, or component sources you already inspected.",
|
|
806
|
-
"Minimize discovery reads: only read what you genuinely need, once. Commit
|
|
803
|
+
"Minimize discovery reads: only read what you genuinely need, once. Commit the required record_* facts directly from the facts already in context (one tool call per message).",
|
|
804
|
+
planCompletion,
|
|
807
805
|
"</retry_instruction>",
|
|
808
806
|
].join("\n");
|
|
809
807
|
}
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
// finalize_plan. The legacy full-contract JSON guidance below applies
|
|
817
|
-
// only to nodes whose authority is still a text contract artifact.
|
|
818
|
-
if (task.structuredContractOutput.schemaId ===
|
|
819
|
-
"frontend-implementation-contract-plan-patch-v1") {
|
|
820
|
-
const splitGuidance = /write-set-too-large|split the task/.test(previousProtocolReason ?? "")
|
|
821
|
-
? [
|
|
822
|
-
"",
|
|
823
|
-
"The writeSet is too large for one implement node. Do NOT delete implementation files to squeeze under the limit — that drops required work. Split the task via record_split_proposal (or narrow targets.files to a genuine subset) so each implement node stays bounded; the full file set must remain covered across the split.",
|
|
824
|
-
]
|
|
825
|
-
: [];
|
|
826
|
-
return [
|
|
827
|
-
basePrompt,
|
|
828
|
-
"",
|
|
829
|
-
"<retry_instruction>",
|
|
830
|
-
"Previous plan ledger facts failed canonical contract validation:",
|
|
831
|
-
previousProtocolReason,
|
|
832
|
-
"Fix the reported violations by re-committing corrected record_* facts and calling finalize_plan exactly once. The committed typed ledger is the only compile authority.",
|
|
833
|
-
"Do not emit a fenced JSON contract, protected skeleton fields, or an openspec-citations block; narrative JSON is not validated and wastes the output budget.",
|
|
834
|
-
...frontendPlanValidationRetryGuidance(previousProtocolReason),
|
|
835
|
-
...splitGuidance,
|
|
836
|
-
"</retry_instruction>",
|
|
837
|
-
].join("\n");
|
|
838
|
-
}
|
|
808
|
+
// Generic output-limit fallback. Every branch above this one carries a
|
|
809
|
+
// more precise instruction for the same capacity signal (contract repair
|
|
810
|
+
// reasons, ladder rungs — compact-terminal-first is the reason-mandated
|
|
811
|
+
// rung for length-before-terminal —, protocol/review/read-burst repair),
|
|
812
|
+
// so output-limit must not shadow them.
|
|
813
|
+
if (previousFailureCategory === OUTPUT_LIMIT_RETRY_CATEGORY) {
|
|
839
814
|
return [
|
|
840
815
|
basePrompt,
|
|
841
816
|
"",
|
|
842
817
|
"<retry_instruction>",
|
|
843
|
-
"
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
"
|
|
847
|
-
"</retry_instruction>",
|
|
848
|
-
].join("\n");
|
|
849
|
-
}
|
|
850
|
-
if (previousFailureCategory === "invalid-output" &&
|
|
851
|
-
task.id === "frontend-scout-pi") {
|
|
852
|
-
return [
|
|
853
|
-
basePrompt,
|
|
854
|
-
"",
|
|
855
|
-
"<retry_instruction>",
|
|
856
|
-
"The previous Scout attempt did not commit a complete, runtime-evidenced target surface.",
|
|
857
|
-
"Search the repository only as needed to establish the real entrypoint, implementation ownership, and applicable test path. Commit record_target_surface with completeness=complete and unresolvedPaths=[] only after at least one named target has fresh runtime evidence, unless the task source explicitly declares a greenfield target: in that case every future path must be source-declared by the runtime-enriched fact. If ownership truly cannot be established, record completeness=blocked with each unresolved path; do not make Plan discover it.",
|
|
858
|
-
"</retry_instruction>",
|
|
859
|
-
].join("\n");
|
|
860
|
-
}
|
|
861
|
-
if (previousFailureCategory === "structured-output-truncated" &&
|
|
862
|
-
task.structuredContractOutput) {
|
|
863
|
-
if (task.structuredContractOutput.schemaId ===
|
|
864
|
-
"frontend-implementation-contract-plan-patch-v1") {
|
|
865
|
-
return [
|
|
866
|
-
basePrompt,
|
|
867
|
-
"",
|
|
868
|
-
"<retry_instruction>",
|
|
869
|
-
"Previous attempt was truncated by the provider (stopReason=length) before the plan facts were fully committed.",
|
|
870
|
-
"Re-commit the missing record_* facts and call finalize_plan exactly once; the committed typed ledger is the only compile authority. Do NOT re-read contract/scout outputs or source files — use the facts already in context. Commit record_* facts one tool call per message, then finalize_plan immediately.",
|
|
871
|
-
"Do not emit a fenced JSON contract, protected skeleton fields, or an openspec-citations block; narrative JSON is not validated and wastes the output budget.",
|
|
872
|
-
"</retry_instruction>",
|
|
873
|
-
].join("\n");
|
|
874
|
-
}
|
|
875
|
-
return [
|
|
876
|
-
basePrompt,
|
|
877
|
-
"",
|
|
878
|
-
"<retry_instruction>",
|
|
879
|
-
"Previous attempt was truncated by the provider (stopReason=length) before the JSON contract was completed.",
|
|
880
|
-
...frontendStructuredArtifactRetryGuidance(task.structuredContractOutput.schemaId),
|
|
881
|
-
"The JSON artifact must be complete; omit evidence excerpts and duplicated upstream context.",
|
|
818
|
+
"The previous turn ended with stopReason=length before the required output was complete. This is output-capacity truncation, not empty output.",
|
|
819
|
+
"Continue incrementally from already committed typed facts and current in-scope workspace files. Do not repeat completed discovery, decisions, facts, or writes.",
|
|
820
|
+
"Generate the smallest unfinished unit next, validate its required format immediately, repair any format error in this node, and only then continue to the next unfinished unit or terminal tool.",
|
|
821
|
+
"Keep prose minimal and finish the required terminal/output protocol as soon as the remaining work is valid.",
|
|
882
822
|
"</retry_instruction>",
|
|
883
823
|
].join("\n");
|
|
884
824
|
}
|
|
885
825
|
if (previousFailureCategory === "writer-empty-diff") {
|
|
886
|
-
const maxAttempts = task.retryPolicy?.maxAttempts ??
|
|
826
|
+
const maxAttempts = task.retryPolicy?.maxAttempts ?? 5;
|
|
887
827
|
// When a completeness progress exists for this writer, fold the concrete
|
|
888
828
|
// target paths into the empty-diff retry so the model does not guess and
|
|
889
829
|
// does not need to read a forbidden `.harness/**` evidence file.
|
|
@@ -911,7 +851,7 @@ export function buildAttemptPrompt(task, basePrompt, attemptNumber, previousFail
|
|
|
911
851
|
].join("\n");
|
|
912
852
|
}
|
|
913
853
|
if (previousFailureCategory === "incomplete-write-set") {
|
|
914
|
-
const maxAttempts = task.retryPolicy?.maxAttempts ??
|
|
854
|
+
const maxAttempts = task.retryPolicy?.maxAttempts ?? 5;
|
|
915
855
|
const bindingOnly = task.id?.startsWith("generate-backend-md-case-") === true &&
|
|
916
856
|
(recoveryTargetPaths?.length ?? 0) === 1 &&
|
|
917
857
|
Object.values(recoveryDiagnostics ?? {}).flat().some((detail) => /(?:unclassified Test Points|duplicate Test Point bindings)/i.test(detail));
|
|
@@ -985,7 +925,8 @@ export function buildAttemptPrompt(task, basePrompt, attemptNumber, previousFail
|
|
|
985
925
|
"",
|
|
986
926
|
"<retry_instruction>",
|
|
987
927
|
"Previous attempt exceeded the structured output size limit.",
|
|
988
|
-
"Re-commit corrected record_* facts
|
|
928
|
+
"Re-commit corrected record_* facts; the committed typed ledger is the only compile authority.",
|
|
929
|
+
planCompletion,
|
|
989
930
|
"Do not emit a fenced JSON contract, protected skeleton fields, or an openspec-citations block; narrative JSON is not validated and wastes the output budget.",
|
|
990
931
|
"</retry_instruction>",
|
|
991
932
|
].join("\n");
|
|
@@ -1143,6 +1084,8 @@ function validateRepairArtifactGateBeforeShell(input) {
|
|
|
1143
1084
|
if (!gate)
|
|
1144
1085
|
return;
|
|
1145
1086
|
const upstream = input.state.nodes[gate.fromNodeId];
|
|
1087
|
+
if (!upstream)
|
|
1088
|
+
return;
|
|
1146
1089
|
const parsed = parseSupervisorRepairArtifact(upstream);
|
|
1147
1090
|
if (!parsed.ok) {
|
|
1148
1091
|
throw new Error(`repair artifact gate failed: ${parsed.reason}`);
|
|
@@ -1519,6 +1462,20 @@ export async function executeDagNode(input) {
|
|
|
1519
1462
|
return;
|
|
1520
1463
|
}
|
|
1521
1464
|
}
|
|
1465
|
+
if (task.id === "frontend-scout-pi") {
|
|
1466
|
+
try {
|
|
1467
|
+
const { readTypedEventStoreFromJsonl } = await import("./frontend-typed-event-store.js");
|
|
1468
|
+
const facts = (await readTypedEventStoreFromJsonl(path.join(runDir, "frontend-contract-pi", "contract-typed-facts.jsonl"))).filter(r => r.phase === "committed").map(r => r.fact);
|
|
1469
|
+
const requirements = [...new Map(facts.filter(f => f.kind === "requirement").map(f => [String(f.id), f])).values()];
|
|
1470
|
+
if (!requirements.length)
|
|
1471
|
+
throw Error("FRONTEND_INPUT_MISSING: Scout needs committed Contract obligations");
|
|
1472
|
+
prompt += `\n<frontend_scout_input>\n${JSON.stringify({ requirements, sharedFacts: facts.filter(f => !["requirement", "contract-scope-completed", "contract-finalized"].includes(String(f.kind))) })}\n</frontend_scout_input>`;
|
|
1473
|
+
}
|
|
1474
|
+
catch (error) {
|
|
1475
|
+
await failBeforePrompt(error, "frontend-scout-input-unavailable");
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1522
1479
|
if (FRONTEND_WRITER_NODE_IDS.includes(nodeId)) {
|
|
1523
1480
|
// Design-review findings are not reliable in the provider's prose output
|
|
1524
1481
|
// (typed terminal nodes commonly return an empty assistant message). Inject
|
|
@@ -1605,6 +1562,7 @@ export async function executeDagNode(input) {
|
|
|
1605
1562
|
// evidence so a late best-effort write cannot recreate an archived run dir.
|
|
1606
1563
|
void input.persistState().catch(() => { });
|
|
1607
1564
|
};
|
|
1565
|
+
const scoutCompletedShards = task.id === "frontend-scout-pi" && isSafeReadOnlyPiRetryCandidate(task) ? new Map() : undefined;
|
|
1608
1566
|
let terminalResult;
|
|
1609
1567
|
let previousFailureCategory;
|
|
1610
1568
|
let previousProtocolReason;
|
|
@@ -1706,6 +1664,8 @@ export async function executeDagNode(input) {
|
|
|
1706
1664
|
attemptPrompt,
|
|
1707
1665
|
});
|
|
1708
1666
|
result = await executeNode({
|
|
1667
|
+
...(scoutCompletedShards ? { scoutCompletedShards } : {}),
|
|
1668
|
+
...(state.budgetLedger?.mode === "hard" && state.budgetLedger.limits.maxProviderRequests !== undefined ? { reserveProviderRequest: () => reserveDagProviderRequest({ state, nodeId, attempt: attemptNumber, persist: input.persistState, ...(spec.sourceProviderBudget ? { reserveTaskRequest: () => reserveTaskSourceProviderRequest({ repoRoot: cwd, taskId: spec.sourceProviderBudget.ledger.taskId, maxProviderRequests: spec.sourceProviderBudget.ledger.maxProviderRequests, expectedBudgetId: spec.sourceProviderBudget.ledger.budgetId, minimumReservedRequests: spec.sourceProviderBudget.ledger.reservedRequests }) } : {}) }) } : {}),
|
|
1709
1669
|
task,
|
|
1710
1670
|
cwd,
|
|
1711
1671
|
model,
|
|
@@ -1727,6 +1687,32 @@ export async function executeDagNode(input) {
|
|
|
1727
1687
|
durationMs: 0,
|
|
1728
1688
|
};
|
|
1729
1689
|
}
|
|
1690
|
+
// stopReason=length on top of a bare empty-output verdict is a provider
|
|
1691
|
+
// capacity signal, not a true empty response: reroute it through the
|
|
1692
|
+
// dedicated output-limit retry path while keeping the raw category for
|
|
1693
|
+
// diagnostics. Bare empty-output and transport aliases (network,
|
|
1694
|
+
// nonzero-exit, unknown) are rerouted — categories that already carry a
|
|
1695
|
+
// precise repair instruction (output-too-large, invalid-output,
|
|
1696
|
+
// protocol-invalid, structured-output-truncated via the validators below,
|
|
1697
|
+
// writer categories) keep their classification so their exact retry
|
|
1698
|
+
// guidance still reaches the model.
|
|
1699
|
+
if (task.executor === "pi" &&
|
|
1700
|
+
!result.ok &&
|
|
1701
|
+
result.stopReason === "length" &&
|
|
1702
|
+
(result.failureCategory === undefined ||
|
|
1703
|
+
["empty-output", "network", "nonzero-exit", "unknown"].includes(result.failureCategory))) {
|
|
1704
|
+
result = {
|
|
1705
|
+
...result,
|
|
1706
|
+
rawFailureCategory: result.rawFailureCategory ?? result.failureCategory,
|
|
1707
|
+
failureCategory: OUTPUT_LIMIT_RETRY_CATEGORY,
|
|
1708
|
+
stderr: [
|
|
1709
|
+
result.stderr,
|
|
1710
|
+
"output-limit: stopReason=length; preserve completed work and retry only the unfinished output",
|
|
1711
|
+
]
|
|
1712
|
+
.filter(Boolean)
|
|
1713
|
+
.join("\n"),
|
|
1714
|
+
};
|
|
1715
|
+
}
|
|
1730
1716
|
if (task.id === "generate-backend-md-plan-pi" &&
|
|
1731
1717
|
!result.ok &&
|
|
1732
1718
|
(result.failureCategory === "output-too-large" ||
|
|
@@ -1738,6 +1724,20 @@ export async function executeDagNode(input) {
|
|
|
1738
1724
|
? result.stderr.slice(markerIndex, markerIndex + 4_000).trim()
|
|
1739
1725
|
: `backend-test Markdown plan attempt failed with ${result.failureCategory}`;
|
|
1740
1726
|
}
|
|
1727
|
+
// Decision-path Plan bridge failures surface from the executor as
|
|
1728
|
+
// invalid-output (the derived relationship patch failed pre-validation),
|
|
1729
|
+
// NOT through the R1 structured self-check (which only runs when
|
|
1730
|
+
// result.ok). Capture the bridge diagnostics into previousProtocolReason
|
|
1731
|
+
// so the next attempt prompt tells the model exactly which decision facts
|
|
1732
|
+
// to repair instead of replaying the identical under-declared session.
|
|
1733
|
+
if (task.id === FRONTEND_PLAN_NODE_ID &&
|
|
1734
|
+
!result.ok &&
|
|
1735
|
+
result.failureCategory === "invalid-output" &&
|
|
1736
|
+
/frontend decision → relationship patch failed|frontend decision finalize failed/.test(result.stderr ?? "")) {
|
|
1737
|
+
previousProtocolReason = (result.stderr ?? "")
|
|
1738
|
+
.slice(-4_000)
|
|
1739
|
+
.trim();
|
|
1740
|
+
}
|
|
1741
1741
|
if (isFrontendStructuredRepairSchemaId(task.structuredContractOutput?.schemaId)) {
|
|
1742
1742
|
const rawText = canonicalNodeOutput(result);
|
|
1743
1743
|
if (rawText.trim().length > 0) {
|
|
@@ -1860,7 +1860,7 @@ export async function executeDagNode(input) {
|
|
|
1860
1860
|
!result.ok &&
|
|
1861
1861
|
retryPolicy !== undefined) {
|
|
1862
1862
|
const submissions = await countContractRecordSubmissions(runDir, nodeId);
|
|
1863
|
-
if (submissions === 0) {
|
|
1863
|
+
if (submissions === 0 && result.stopReason !== "length") {
|
|
1864
1864
|
result = {
|
|
1865
1865
|
...result,
|
|
1866
1866
|
failureCategory: "empty-output",
|
|
@@ -1906,7 +1906,7 @@ export async function executeDagNode(input) {
|
|
|
1906
1906
|
// reason, detect new committed facts, and escalate instead of re-running.
|
|
1907
1907
|
if (frontendPlanLadderEnabled && !result.ok) {
|
|
1908
1908
|
const afterSnapshot = await readFrontendPlanCommittedSnapshot(runDir, nodeId);
|
|
1909
|
-
const hasNewCommittedFact = beforeCommittedDigest !== undefined &&
|
|
1909
|
+
const hasNewCommittedFact = !result.stderr?.includes("FRONTEND_PLAN_NO_PROGRESS") && beforeCommittedDigest !== undefined &&
|
|
1910
1910
|
afterSnapshot.digest !== beforeCommittedDigest;
|
|
1911
1911
|
const protocolReason = projectFrontendNodeProtocolFailureReason({
|
|
1912
1912
|
failureCategory: result.failureCategory,
|
|
@@ -1930,13 +1930,23 @@ export async function executeDagNode(input) {
|
|
|
1930
1930
|
frontendPriorFingerprints.push(fingerprint);
|
|
1931
1931
|
frontendPlanRetryStep = nextStep;
|
|
1932
1932
|
if (nextStep === "unsupported-provider-capability") {
|
|
1933
|
+
// Reachability first: when the failed attempts never reached model
|
|
1934
|
+
// reasoning (gateway 5xx / rate limit / quota / network), the
|
|
1935
|
+
// ladder's fail-closed category would read as a capability mismatch
|
|
1936
|
+
// and send the diagnosis the wrong way. Keep the outage visible in
|
|
1937
|
+
// the node's category and explain why.
|
|
1938
|
+
const providerOutage = isProviderAvailabilityFailureCategory(result.failureCategory);
|
|
1933
1939
|
result = {
|
|
1934
1940
|
...result,
|
|
1935
1941
|
ok: false,
|
|
1936
|
-
failureCategory:
|
|
1942
|
+
failureCategory: providerOutage
|
|
1943
|
+
? "upstream-unavailable"
|
|
1944
|
+
: "unsupported-provider-capability",
|
|
1937
1945
|
stderr: [
|
|
1938
1946
|
result.stderr,
|
|
1939
|
-
|
|
1947
|
+
providerOutage
|
|
1948
|
+
? "frontend plan retry ladder: attempts failed on provider reachability (5xx / rate limit / quota / network), so this is an upstream outage, not a provider capability mismatch"
|
|
1949
|
+
: "frontend plan retry ladder: no compatible provider capability route for the protocol failure reason",
|
|
1940
1950
|
]
|
|
1941
1951
|
.filter(Boolean)
|
|
1942
1952
|
.join("\n"),
|