@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,6 @@
|
|
|
1
|
+
import { readFileBoundarySafe } from "../../shared/path-safety.js";
|
|
2
|
+
import { capabilityBoundarySchema } from "../../task/config-types.js";
|
|
3
|
+
import { frontendExecutionSchema, collectFrontendExecutionGroups } from "./frontend-execution-groups.js";
|
|
1
4
|
import { createHash } from "node:crypto";
|
|
2
5
|
import { readFileSync } from "node:fs";
|
|
3
6
|
import { readFile, stat } from "node:fs/promises";
|
|
@@ -9,10 +12,12 @@ import { findPackageRoot } from "../../shared/package-metadata.js";
|
|
|
9
12
|
import { pathMatchesPattern } from "../../shared/git-progress.js";
|
|
10
13
|
import { resolveDagTaskSourcePath } from "../../task/dag-source-paths.js";
|
|
11
14
|
import { readTypedEventStoreFromJsonl } from "./frontend-typed-event-store.js";
|
|
15
|
+
import { extractRequiredDeliverablePaths } from "./frontend-contract-facts.js";
|
|
16
|
+
export { extractRequiredDeliverablePaths } from "./frontend-contract-facts.js";
|
|
12
17
|
// Cycle-safe value imports: the check functions are hoisted declarations used
|
|
13
18
|
// only at call time, so the contract module and the policy module can depend
|
|
14
19
|
// on each other without module-init ordering issues.
|
|
15
|
-
import { checkDependencies, checkTargetPaths, checkUiDesignCoverage, checkUiStateAttribution, } from "./frontend-design-policy.js";
|
|
20
|
+
import { checkDependencies, checkTargetPaths, checkUiDesignCoverage, checkUiStateAttribution, checkRequiredDeliverables, checkUxNameCollisions, } from "./frontend-design-policy.js";
|
|
16
21
|
import { isDagSourceBindingV2 } from "./types.js";
|
|
17
22
|
import { canonicalContractRel, classifyStructuredContractFailure, formatStructuredArtifactPointer, persistRuntimeSkeleton, } from "./structured-output-repair.js";
|
|
18
23
|
import { renderFrontendPlanMarkdown } from "./frontend-plan-render.js";
|
|
@@ -192,6 +197,20 @@ export function isRecognizedFrontendVerifyCommandText(command) {
|
|
|
192
197
|
/\b(tsc|eslint|typecheck|check-types)\b/i.test(command) ||
|
|
193
198
|
/\bscripts[\\/]+ci(?:-tests)?\.sh\b/i.test(command));
|
|
194
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Repo-level shell scripts whose name marks them as governance/static checks
|
|
202
|
+
* rather than test runners: `scripts/check-*.sh`, `scripts/ci.sh`,
|
|
203
|
+
* `scripts/ci-governance.sh` and friends. The behavior lane is test-observed
|
|
204
|
+
* at writer admission, so these must not be admitted there — they cannot emit
|
|
205
|
+
* a test report.
|
|
206
|
+
*
|
|
207
|
+
* A test word in the name still wins, because the test-semantics check runs
|
|
208
|
+
* earlier in `classifyFrontendVerifyCommandText`, so a real test script such as
|
|
209
|
+
* `scripts/run-tests.sh` or `scripts/check-tests.sh` is unaffected.
|
|
210
|
+
*/
|
|
211
|
+
const VERIFY_STATIC_SCRIPT_PATH_RE = /\bscripts[\\/]+(?:ci(?:-governance|-tests)?|check-[a-z0-9-]+)\.sh\b/i;
|
|
212
|
+
/** A shell script whose own name marks it as a test runner. */
|
|
213
|
+
const VERIFY_BEHAVIOR_SCRIPT_PATH_RE = /\bscripts[\\/]+[a-z0-9-]*(?:tests?|specs?|e2e)[a-z0-9-]*\.sh\b/i;
|
|
195
214
|
/**
|
|
196
215
|
* Classify a raw verification command text into the runtime-owned mode.
|
|
197
216
|
* Shared single implementation used by DAG generation (lane split) and
|
|
@@ -204,6 +223,14 @@ export function isRecognizedFrontendVerifyCommandText(command) {
|
|
|
204
223
|
* static scripts (`npm run check`, `check:types`) and leading binaries
|
|
205
224
|
* (`tsc`, `eslint`) stay static. Package-manager flags (`npm --prefix
|
|
206
225
|
* website run build`) are skipped when locating the script.
|
|
226
|
+
*
|
|
227
|
+
* Returns `undefined` for a command whose text carries no recognizable
|
|
228
|
+
* verification semantics. The previous fallback returned `"behavior"`, which
|
|
229
|
+
* silently pushed unknown commands into the strictest lane: the behavior lane
|
|
230
|
+
* is test-observed at writer admission, so a command that cannot emit a test
|
|
231
|
+
* report blocked admission deterministically with no way for the model to
|
|
232
|
+
* clear it. Callers must now decide explicitly instead of inheriting a lane
|
|
233
|
+
* from an unrecognized string.
|
|
207
234
|
*/
|
|
208
235
|
export function classifyFrontendVerifyCommandText(command) {
|
|
209
236
|
if (VERIFY_RUNNER_RE.test(command) || VERIFY_E2E_RE.test(command)) {
|
|
@@ -217,16 +244,24 @@ export function classifyFrontendVerifyCommandText(command) {
|
|
|
217
244
|
}
|
|
218
245
|
return segments.some((segment) => VERIFY_STATIC_SCRIPT_WORDS.has(segment))
|
|
219
246
|
? "static"
|
|
220
|
-
:
|
|
247
|
+
: undefined;
|
|
221
248
|
}
|
|
222
249
|
const head = command.trim().split(/\s+/, 1)[0] ?? "";
|
|
223
250
|
const binary = head.split(/[\\/]/).pop() ?? "";
|
|
251
|
+
// A test word in the invoked script's own name wins over the static
|
|
252
|
+
// governance pattern: `scripts/check-tests.sh` runs tests even though it
|
|
253
|
+
// starts with `check-`, so it must stay in the test-observed lane.
|
|
254
|
+
if (VERIFY_BEHAVIOR_SCRIPT_PATH_RE.test(command)) {
|
|
255
|
+
return "behavior";
|
|
256
|
+
}
|
|
224
257
|
if (/^(tsc|eslint|stylelint|lint|typecheck|check|build)$/i.test(binary) ||
|
|
225
258
|
/\b(tsc|eslint|typecheck|check-types)\b/i.test(command) ||
|
|
226
|
-
|
|
259
|
+
VERIFY_STATIC_SCRIPT_PATH_RE.test(command)) {
|
|
227
260
|
return "static";
|
|
228
261
|
}
|
|
229
|
-
|
|
262
|
+
// Unrecognized: no lane is inferred. Callers must require an operator
|
|
263
|
+
// declaration rather than defaulting into the test-observed behavior lane.
|
|
264
|
+
return undefined;
|
|
230
265
|
}
|
|
231
266
|
export function slugFrontendVerifyCommandId(label, taken) {
|
|
232
267
|
const slug = label
|
|
@@ -342,11 +377,11 @@ export async function deriveFrontendVerifyCommandDirectoryFromRun(runDir) {
|
|
|
342
377
|
}
|
|
343
378
|
/**
|
|
344
379
|
* A behavior verification target must bind a test file: the trace gate
|
|
345
|
-
*
|
|
346
|
-
*
|
|
380
|
+
* binds results by frozen command and executed test file, without requiring
|
|
381
|
+
* generated target ids in test titles. Enforced at the plan boundary and
|
|
347
382
|
* at materialization (path shape only — the writer may create the file).
|
|
348
383
|
*
|
|
349
|
-
* Only code files count
|
|
384
|
+
* Only code files count: fixtures and
|
|
350
385
|
* data files such as `test/fixtures/data.json` are rejected even under a
|
|
351
386
|
* test directory, as are helper/support/setup files (`cypress/fixtures/*`,
|
|
352
387
|
* `tests/support/*`, `setup.*`) that never carry describe/it/test titles.
|
|
@@ -440,6 +475,316 @@ async function deriveWriteSetFromRun(runDir) {
|
|
|
440
475
|
}
|
|
441
476
|
return [...writeSet];
|
|
442
477
|
}
|
|
478
|
+
/** Read the frozen task source paths from run.json sourceBinding so the plan
|
|
479
|
+
* precheck can require new/specified component choices to cite a traceable
|
|
480
|
+
* task source. Smoke r37/r38: specReference.path pointed at a to-be-implemented
|
|
481
|
+
* file or an AC id — a demand that only lived in review prose could never be
|
|
482
|
+
* closed by the plan retry ladder. The allowed set is enumerable here. */
|
|
483
|
+
async function deriveFrontendSourceBindingPathsFromRun(runDir) {
|
|
484
|
+
const specPath = path.join(runDir, "run.json");
|
|
485
|
+
let raw;
|
|
486
|
+
try {
|
|
487
|
+
raw = await readFile(specPath, "utf8");
|
|
488
|
+
}
|
|
489
|
+
catch {
|
|
490
|
+
return [];
|
|
491
|
+
}
|
|
492
|
+
let spec;
|
|
493
|
+
try {
|
|
494
|
+
spec = JSON.parse(raw);
|
|
495
|
+
}
|
|
496
|
+
catch {
|
|
497
|
+
return [];
|
|
498
|
+
}
|
|
499
|
+
const paths = [];
|
|
500
|
+
for (const source of spec.sourceBinding?.sources ?? []) {
|
|
501
|
+
if (source &&
|
|
502
|
+
typeof source === "object" &&
|
|
503
|
+
typeof source.path === "string" &&
|
|
504
|
+
(source.path).trim()) {
|
|
505
|
+
paths.push((source.path).trim());
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
return paths;
|
|
509
|
+
}
|
|
510
|
+
function stripSourcePathFragment(value) {
|
|
511
|
+
const hash = value.indexOf("#");
|
|
512
|
+
return (hash >= 0 ? value.slice(0, hash) : value).trim().replace(/\/$/, "");
|
|
513
|
+
}
|
|
514
|
+
/** decision=new/specified component choices must cite a frozen task source
|
|
515
|
+
* path (requirement/constraint), never a to-be-implemented file or a bare
|
|
516
|
+
* acceptance-criterion id. Absent sourceBinding paths (legacy fixtures) the
|
|
517
|
+
* check is skipped — generation always freezes them. */
|
|
518
|
+
function checkComponentChoiceSourceReferences(canonical, sourcePaths) {
|
|
519
|
+
const findings = [];
|
|
520
|
+
if (sourcePaths.length === 0)
|
|
521
|
+
return findings;
|
|
522
|
+
for (const choice of canonical.uiComponentChoices ?? []) {
|
|
523
|
+
if (choice.decision !== "new" && choice.decision !== "specified") {
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
526
|
+
const rawPath = choice.specReference?.path ?? "";
|
|
527
|
+
const normalized = stripSourcePathFragment(rawPath);
|
|
528
|
+
const traceable = normalized.length > 0 &&
|
|
529
|
+
sourcePaths.some((source) => stripSourcePathFragment(source) === normalized);
|
|
530
|
+
if (!traceable) {
|
|
531
|
+
findings.push({
|
|
532
|
+
code: "component-choice-source-reference-invalid",
|
|
533
|
+
message: `component choice "${choice.component}" (decision=${choice.decision}) must cite a frozen task source path as specReference.path; allowed: [${sourcePaths.join(", ")}]${rawPath ? ` — got "${rawPath}"` : " — missing"}`,
|
|
534
|
+
path: "uiComponentChoices",
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
return findings;
|
|
539
|
+
}
|
|
540
|
+
const CAPABILITY_BOUNDARY_MARKER = "测试能力边界(冻结)";
|
|
541
|
+
export async function deriveFrontendInteractionIdsFromRun(runDir) {
|
|
542
|
+
const specPath = path.join(runDir, "run.json");
|
|
543
|
+
let raw;
|
|
544
|
+
try {
|
|
545
|
+
raw = await readFile(specPath, "utf8");
|
|
546
|
+
}
|
|
547
|
+
catch {
|
|
548
|
+
return [];
|
|
549
|
+
}
|
|
550
|
+
let spec;
|
|
551
|
+
try {
|
|
552
|
+
spec = JSON.parse(raw);
|
|
553
|
+
}
|
|
554
|
+
catch {
|
|
555
|
+
return [];
|
|
556
|
+
}
|
|
557
|
+
for (const task of spec.tasks ?? []) {
|
|
558
|
+
const ids = task.shell?.frontendDesignPolicy?.interactionIds;
|
|
559
|
+
if (ids && ids.length > 0)
|
|
560
|
+
return ids.filter((id) => typeof id === "string" && id.trim());
|
|
561
|
+
}
|
|
562
|
+
return [];
|
|
563
|
+
}
|
|
564
|
+
function checkInteractionIdVocabulary(canonical, declaredIds) {
|
|
565
|
+
const findings = [];
|
|
566
|
+
if (declaredIds.length === 0)
|
|
567
|
+
return findings;
|
|
568
|
+
for (const interaction of canonical.interactions ?? []) {
|
|
569
|
+
if (!declaredIds.includes(interaction.name)) {
|
|
570
|
+
findings.push({
|
|
571
|
+
code: "interaction-name-not-declared",
|
|
572
|
+
message: `interaction "${interaction.name}" is not in the frozen interaction id vocabulary; allowed: [${declaredIds.join(", ")}] — retract the wrong record via record_data_flow {"interaction": "${interaction.name}", "retracted": true} or retract_data_flow, then record the declared id`,
|
|
573
|
+
path: "interactions",
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
return findings;
|
|
578
|
+
}
|
|
579
|
+
export async function deriveFrontendAllowedMockStrategiesFromRun(runDir) {
|
|
580
|
+
const specPath = path.join(runDir, "run.json");
|
|
581
|
+
let raw;
|
|
582
|
+
try {
|
|
583
|
+
raw = await readFile(specPath, "utf8");
|
|
584
|
+
}
|
|
585
|
+
catch {
|
|
586
|
+
return [];
|
|
587
|
+
}
|
|
588
|
+
let spec;
|
|
589
|
+
try {
|
|
590
|
+
spec = JSON.parse(raw);
|
|
591
|
+
}
|
|
592
|
+
catch {
|
|
593
|
+
return [];
|
|
594
|
+
}
|
|
595
|
+
for (const task of spec.tasks ?? []) {
|
|
596
|
+
const strategies = task.shell?.frontendDesignPolicy?.allowedMockStrategies;
|
|
597
|
+
if (strategies &&
|
|
598
|
+
strategies.length > 0 &&
|
|
599
|
+
strategies.every((s) => typeof s === "string" && s.trim())) {
|
|
600
|
+
return strategies;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
return [];
|
|
604
|
+
}
|
|
605
|
+
function checkMockApiStrategyAllowed(canonical, allowedStrategies) {
|
|
606
|
+
const findings = [];
|
|
607
|
+
if (allowedStrategies.length === 0)
|
|
608
|
+
return findings;
|
|
609
|
+
const strategy = canonical.mockApi?.strategy;
|
|
610
|
+
if (strategy && !allowedStrategies.includes(strategy)) {
|
|
611
|
+
const onlyNotNeeded = allowedStrategies.length === 1 && allowedStrategies[0] === "not-needed";
|
|
612
|
+
findings.push({
|
|
613
|
+
code: "mock-strategy-not-allowed",
|
|
614
|
+
message: `mockApi.strategy "${strategy}" is not in the frozen allowed strategies; allowed: [${allowedStrategies.join(", ")}] — re-record the api mock decision with an allowed strategy (relationship path: record_mock_api {"mockApi": {...}, "replace": true}; decision path: record_api_mock_boundary with the same boundary and a mode that maps to an allowed strategy)${onlyNotNeeded ? "; the run has no deterministic Mock verification capability, so keep strategy \"not-needed\" and preserve the real integration gap instead of inventing Mock evidence" : ""}`,
|
|
615
|
+
path: "mockApi",
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
return findings;
|
|
619
|
+
}
|
|
620
|
+
async function deriveFrontendCapabilityBoundaryFromRun(runDir) {
|
|
621
|
+
const specPath = path.join(runDir, "run.json");
|
|
622
|
+
let raw;
|
|
623
|
+
try {
|
|
624
|
+
raw = await readFile(specPath, "utf8");
|
|
625
|
+
}
|
|
626
|
+
catch (error) {
|
|
627
|
+
if (error.code === "ENOENT")
|
|
628
|
+
return undefined;
|
|
629
|
+
throw error;
|
|
630
|
+
}
|
|
631
|
+
let spec;
|
|
632
|
+
try {
|
|
633
|
+
spec = JSON.parse(raw);
|
|
634
|
+
}
|
|
635
|
+
catch {
|
|
636
|
+
throw new Error("capability-boundary-source-invalid: run.json is malformed");
|
|
637
|
+
}
|
|
638
|
+
for (const task of spec.tasks ?? []) {
|
|
639
|
+
const boundary = task.shell?.frontendDesignPolicy?.capabilityBoundary;
|
|
640
|
+
if (boundary !== undefined)
|
|
641
|
+
return capabilityBoundarySchema.parse(boundary);
|
|
642
|
+
}
|
|
643
|
+
return undefined;
|
|
644
|
+
}
|
|
645
|
+
/** Runtime composes the frozen capability boundary into dependencyPolicy —
|
|
646
|
+
* the planner never maintains it (smoke r42: the boundary lived in PRD prose,
|
|
647
|
+
* the plan omitted it twice, and recovery could not close a prose gap). */
|
|
648
|
+
export function composeDependencyPolicyWithBoundary(policy, boundary) {
|
|
649
|
+
if (!boundary)
|
|
650
|
+
return policy;
|
|
651
|
+
const frozen = capabilityBoundarySchema.parse(boundary);
|
|
652
|
+
// Replace only our explicit complete block; a prose mention never grants
|
|
653
|
+
// ownership of the author's following constraints.
|
|
654
|
+
const begin = "<!-- frontend-capability-boundary:start -->";
|
|
655
|
+
const end = "<!-- frontend-capability-boundary:end -->";
|
|
656
|
+
const source = policy ?? "";
|
|
657
|
+
const start = source.indexOf(begin);
|
|
658
|
+
const finish = start < 0 ? -1 : source.indexOf(end, start + begin.length);
|
|
659
|
+
const prefix = (finish < 0 ? source : source.slice(0, start) + source.slice(finish + end.length)).trim();
|
|
660
|
+
const parts = [
|
|
661
|
+
frozen.allowed?.length ? `仅可使用 ${frozen.allowed.join("、")}` : undefined,
|
|
662
|
+
frozen.forbidden?.length ? `禁止 ${frozen.forbidden.join("、")}` : undefined,
|
|
663
|
+
frozen.requiredClauses?.length ? `必须满足:${frozen.requiredClauses.join(";")}` : undefined,
|
|
664
|
+
].filter(Boolean);
|
|
665
|
+
const sentence = `${CAPABILITY_BOUNDARY_MARKER}:${parts.join(";")}。`;
|
|
666
|
+
const block = `${begin}\n${sentence}\n${end}`;
|
|
667
|
+
return prefix ? `${prefix}\n${block}` : block;
|
|
668
|
+
}
|
|
669
|
+
/** Read the generation-frozen requirement→file ownership from run.json
|
|
670
|
+
* (frontendDesignPolicy spec), bound to the canonical source identity. */
|
|
671
|
+
export async function deriveRequirementOwnershipFromRun(runDir, expectedBinding) {
|
|
672
|
+
const specPath = path.join(runDir, "run.json");
|
|
673
|
+
let raw;
|
|
674
|
+
try {
|
|
675
|
+
raw = await readFile(specPath, "utf8");
|
|
676
|
+
}
|
|
677
|
+
catch (error) {
|
|
678
|
+
if (error.code === "ENOENT" && (!expectedBinding || !isDagSourceBindingV2(expectedBinding)))
|
|
679
|
+
return [];
|
|
680
|
+
if (error.code === "ENOENT")
|
|
681
|
+
throw new Error("requirement-ownership-source-invalid: frozen run.json is missing");
|
|
682
|
+
throw error;
|
|
683
|
+
}
|
|
684
|
+
let spec;
|
|
685
|
+
try {
|
|
686
|
+
spec = JSON.parse(raw);
|
|
687
|
+
}
|
|
688
|
+
catch {
|
|
689
|
+
throw new Error("requirement-ownership-source-invalid: run.json is malformed");
|
|
690
|
+
}
|
|
691
|
+
const merged = new Map();
|
|
692
|
+
for (const task of spec.tasks ?? []) {
|
|
693
|
+
const raw = task.shell?.frontendDesignPolicy?.requirementOwnership;
|
|
694
|
+
if (raw === undefined)
|
|
695
|
+
continue;
|
|
696
|
+
const parsed = z.array(z.object({ requirementIds: z.array(z.string().min(1)).min(1), implementationFiles: z.array(z.string().min(1)).optional(), verificationFiles: z.array(z.string().min(1)).optional() }).strict()).safeParse(raw);
|
|
697
|
+
if (!parsed.success)
|
|
698
|
+
throw new Error("requirement-ownership-source-invalid: frozen requirementOwnership is malformed");
|
|
699
|
+
for (const entry of parsed.data) {
|
|
700
|
+
const key = [...(entry.requirementIds ?? [])].sort().join("|");
|
|
701
|
+
const previous = merged.get(key);
|
|
702
|
+
if (previous && serializeDeterministicJson(previous) !== serializeDeterministicJson(entry))
|
|
703
|
+
throw new Error("requirement-ownership-source-invalid: conflicting ownership declarations");
|
|
704
|
+
if (!previous)
|
|
705
|
+
merged.set(key, entry);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
if (merged.size && expectedBinding) {
|
|
709
|
+
if (!spec.sourceBinding || serializeDeterministicJson(spec.sourceBinding) !== serializeDeterministicJson(expectedBinding))
|
|
710
|
+
throw new Error("requirement-ownership-source-invalid: frozen source binding mismatch or missing");
|
|
711
|
+
}
|
|
712
|
+
return [...merged.values()];
|
|
713
|
+
}
|
|
714
|
+
/** Deterministic requirement→file ownership check. A requirement's
|
|
715
|
+
* implementation targets must live inside its declared implementationFiles,
|
|
716
|
+
* and every verification target bound to it must file under its declared
|
|
717
|
+
* verificationFiles. Unknown requirement ids are findings too: a typo in the
|
|
718
|
+
* declaration must fail the declaration, not deadlock the planner. */
|
|
719
|
+
function checkRequirementOwnership(canonical, ownership) {
|
|
720
|
+
const findings = [];
|
|
721
|
+
if (ownership.length === 0)
|
|
722
|
+
return findings;
|
|
723
|
+
const requirementById = new Map((canonical.requirements ?? []).map((requirement) => [requirement.id, requirement]));
|
|
724
|
+
const targetsByRequirement = new Map();
|
|
725
|
+
for (const target of canonical.verificationTargets ?? []) {
|
|
726
|
+
for (const id of target.requirementIds ?? []) {
|
|
727
|
+
if (!targetsByRequirement.has(id))
|
|
728
|
+
targetsByRequirement.set(id, new Set());
|
|
729
|
+
targetsByRequirement.get(id).add(target.file);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
const declaredRequirementIds = new Set();
|
|
733
|
+
for (const entry of ownership) {
|
|
734
|
+
for (const id of entry.requirementIds)
|
|
735
|
+
declaredRequirementIds.add(id);
|
|
736
|
+
}
|
|
737
|
+
for (const entry of ownership) {
|
|
738
|
+
for (const id of entry.requirementIds) {
|
|
739
|
+
if (!requirementById.has(id)) {
|
|
740
|
+
findings.push({
|
|
741
|
+
code: "requirement-ownership-unknown-requirement",
|
|
742
|
+
message: `requirementOwnership declares unknown requirement id "${id}"; frozen requirement ids: [${[...requirementById.keys()].join(", ")}]`,
|
|
743
|
+
path: "requirements",
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
for (const entry of ownership) {
|
|
749
|
+
const implementationFiles = entry.implementationFiles ?? [];
|
|
750
|
+
const verificationFiles = entry.verificationFiles ?? [];
|
|
751
|
+
for (const id of entry.requirementIds) {
|
|
752
|
+
const requirement = requirementById.get(id);
|
|
753
|
+
if (!requirement)
|
|
754
|
+
continue;
|
|
755
|
+
if (implementationFiles.length > 0) {
|
|
756
|
+
const allTargets = requirement.implementationTargets ?? [];
|
|
757
|
+
// A verification placement must have explicit verification
|
|
758
|
+
// ownership AND a bound verification target. File names alone
|
|
759
|
+
// never exempt implementation responsibility.
|
|
760
|
+
const verificationPlacements = new Set([...(targetsByRequirement.get(id) ?? [])].filter(file => verificationFiles.includes(file)));
|
|
761
|
+
const targets = allTargets.filter(file => !verificationPlacements.has(file) || implementationFiles.includes(file));
|
|
762
|
+
// implementationTargets retains actual placements. Existence-only
|
|
763
|
+
// deliverableTargets never subtract from this ownership claim.
|
|
764
|
+
const outside = targets.filter(file => !implementationFiles.includes(file));
|
|
765
|
+
if (outside.length > 0 || !targets.some(file => implementationFiles.includes(file))) {
|
|
766
|
+
findings.push({
|
|
767
|
+
code: "requirement-ownership-violated",
|
|
768
|
+
message: `requirement ${id} expects implementation within [${implementationFiles.join(", ")}] but plan maps [${targets.join(", ") || "none"}] — re-map the owning behavior group's module placement`,
|
|
769
|
+
path: "requirements",
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
if (verificationFiles.length > 0) {
|
|
774
|
+
const files = [...(targetsByRequirement.get(id) ?? [])];
|
|
775
|
+
const outside = files.filter((file) => !verificationFiles.includes(file));
|
|
776
|
+
if (outside.length > 0) {
|
|
777
|
+
findings.push({
|
|
778
|
+
code: "requirement-ownership-violated",
|
|
779
|
+
message: `requirement ${id} expects verification evidence within [${verificationFiles.join(", ")}] but verification targets bind [${files.join(", ") || "none"}]`,
|
|
780
|
+
path: "verificationTargets",
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
return findings;
|
|
787
|
+
}
|
|
443
788
|
export const FRONTEND_IMPLEMENTATION_CONTRACT_SCHEMA_ID = "frontend-implementation-contract-v1";
|
|
444
789
|
export const FRONTEND_IMPLEMENTATION_CONTRACT_PLAN_PATCH_SCHEMA_ID = "frontend-implementation-contract-plan-patch-v1";
|
|
445
790
|
export const FRONTEND_CONTRACT_REVIEW_INDEX_SCHEMA_ID = "frontend-contract-review-index-v1";
|
|
@@ -456,11 +801,11 @@ const FRONTEND_CONTRACT_REVIEW_GROUPS = [
|
|
|
456
801
|
},
|
|
457
802
|
{
|
|
458
803
|
id: "data-design",
|
|
459
|
-
fields: ["mockApi", "designEvidence", "dependencyPolicy", "realIntegrationGap"],
|
|
804
|
+
fields: ["mockApi", "designEvidence", "capabilityBoundary", "dependencyPolicy", "realIntegrationGap"],
|
|
460
805
|
},
|
|
461
806
|
{
|
|
462
807
|
id: "verification",
|
|
463
|
-
fields: ["verificationTargets", "evidenceGaps", "
|
|
808
|
+
fields: ["verificationTargets", "evidenceGaps", "residualRisks"],
|
|
464
809
|
},
|
|
465
810
|
];
|
|
466
811
|
const FRONTEND_CONTRACT_CAPACITY_WARNING_RATIO = 0.6;
|
|
@@ -600,12 +945,30 @@ const uiComponentChoiceSchema = z
|
|
|
600
945
|
decision: z.enum(["specified", "reuse-existing", "new"]),
|
|
601
946
|
specReference: uiComponentSpecReferenceSchema.nullable().optional(),
|
|
602
947
|
// Optional: the decision enum already carries the semantic (specified →
|
|
603
|
-
// specReference, new → task-source traceability, reuse-existing →
|
|
604
|
-
//
|
|
605
|
-
// Omit for reuse-existing to keep plan output small.
|
|
948
|
+
// specReference, new → task-source traceability, reuse-existing →
|
|
949
|
+
// evidencePath). Omit for reuse-existing to keep plan output small.
|
|
606
950
|
rationale: z.string().min(1).optional(),
|
|
951
|
+
// Multi-id coverage (dogfood r-plan-quality): ONE choice may cover many
|
|
952
|
+
// UI states/interactions explicitly instead of the old implicit
|
|
953
|
+
// "reuse-existing covers everything" wildcard.
|
|
954
|
+
covers: z.array(z.string().min(1)).optional(),
|
|
955
|
+
// reuse-existing evidence (dogfood dag-1788504923861-0f7b17a9: 18
|
|
956
|
+
// reuse-existing rows cited conventions in a not-yet-written
|
|
957
|
+
// src/planner.ts): a repo-relative path to the existing file that
|
|
958
|
+
// proves the reuse. Enforced by superRefine + fresh-existence checks.
|
|
959
|
+
evidencePath: safePath.optional(),
|
|
607
960
|
})
|
|
608
|
-
.strict()
|
|
961
|
+
.strict()
|
|
962
|
+
.superRefine((choice, ctx) => {
|
|
963
|
+
if (choice.decision === "reuse-existing" &&
|
|
964
|
+
!(choice.evidencePath && choice.evidencePath.trim().length > 0)) {
|
|
965
|
+
ctx.addIssue({
|
|
966
|
+
code: z.ZodIssueCode.custom,
|
|
967
|
+
path: ["evidencePath"],
|
|
968
|
+
message: "decision=reuse-existing requires evidencePath naming the existing repo file that proves the reuse; use decision=new for greenfield paths",
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
});
|
|
609
972
|
const uiComponentChoicesSchema = z.array(uiComponentChoiceSchema);
|
|
610
973
|
/**
|
|
611
974
|
* Normalize unstable model emissions before the strict schema sees them:
|
|
@@ -680,13 +1043,24 @@ export const frontendImplementationContractSchema = z
|
|
|
680
1043
|
files: z.array(safePath).min(1),
|
|
681
1044
|
routes: z.array(z.string().startsWith("/")).optional(),
|
|
682
1045
|
publicApiChanges: z.array(z.string().min(1)).optional(),
|
|
1046
|
+
// Runtime-owned deliverable contract (dogfood r-plan-quality):
|
|
1047
|
+
// explicit, source-bound file inventory committed by Contract.
|
|
1048
|
+
// The design-policy completeness gate checks ONLY these —
|
|
1049
|
+
// allowedPaths is a write boundary, not a coverage obligation.
|
|
1050
|
+
requiredDeliverables: z.array(safePath).optional(),
|
|
683
1051
|
})
|
|
684
1052
|
.strict(),
|
|
685
1053
|
requirements: z.array(z
|
|
686
1054
|
.object({
|
|
687
1055
|
id,
|
|
688
1056
|
expectedOutcome: z.string().min(1),
|
|
1057
|
+
execution: frontendExecutionSchema.optional(),
|
|
689
1058
|
implementationTargets: z.array(safePath),
|
|
1059
|
+
/** Contract-bound "files that must exist" (from the plan
|
|
1060
|
+
* relationship patch). Ownership-exempt: a deliverable is an
|
|
1061
|
+
* existence obligation, not an implementation-ownership claim
|
|
1062
|
+
* (smoke r55 regression). */
|
|
1063
|
+
deliverableTargets: z.array(safePath).optional(),
|
|
690
1064
|
verificationTargetIds: z.array(z.string().min(1)),
|
|
691
1065
|
evidenceGap: gap.optional(),
|
|
692
1066
|
// Source fidelity ledger binding (AC-005/AC-006): 每个 requirement
|
|
@@ -769,18 +1143,27 @@ export const frontendImplementationContractSchema = z
|
|
|
769
1143
|
uiStates: z.array(z.string().min(1)),
|
|
770
1144
|
// Display-only test scope; never read by control flow.
|
|
771
1145
|
scope: frontendVerificationScopeSchema.optional(),
|
|
1146
|
+
// Planned evidence strength, never proof of observed behavior.
|
|
1147
|
+
evidenceLevel: z.enum(["unit", "mounted", "real-integration"]).optional(),
|
|
1148
|
+
boundary: z.string().min(1).optional(),
|
|
772
1149
|
})
|
|
773
1150
|
.strict()).min(1),
|
|
774
1151
|
evidenceGaps: z.array(gap).optional(),
|
|
775
|
-
implementationSteps: z.array(z.string().min(1)).optional(),
|
|
776
1152
|
stylingStrategy: z.string().min(1).optional(),
|
|
777
1153
|
uiComponentChoices: uiComponentChoicesSchema.optional(),
|
|
1154
|
+
capabilityBoundary: capabilityBoundarySchema.optional(),
|
|
778
1155
|
dependencyPolicy: z.string().min(1).optional(),
|
|
779
1156
|
residualRisks: z.array(z.string().min(1)).optional(),
|
|
780
1157
|
realIntegrationGap: z.string().min(1).optional(),
|
|
781
1158
|
})
|
|
782
1159
|
.strict()
|
|
783
1160
|
.superRefine((value, ctx) => {
|
|
1161
|
+
try {
|
|
1162
|
+
collectFrontendExecutionGroups(value.requirements);
|
|
1163
|
+
}
|
|
1164
|
+
catch (error) {
|
|
1165
|
+
ctx.addIssue({ code: "custom", path: ["requirements"], message: String(error) });
|
|
1166
|
+
}
|
|
784
1167
|
const stableIdentities = [
|
|
785
1168
|
{
|
|
786
1169
|
path: "requirements",
|
|
@@ -843,6 +1226,27 @@ export const frontendImplementationContractSchema = z
|
|
|
843
1226
|
});
|
|
844
1227
|
}
|
|
845
1228
|
}
|
|
1229
|
+
// Behavior evidence must be anchored to be machine-traceable: a
|
|
1230
|
+
// behavior target that names no requirement and no UI state produces
|
|
1231
|
+
// coverage the trace gate and review cannot verify. Contracts that
|
|
1232
|
+
// declare no UI state and no interaction (pure-logic) are exempt from
|
|
1233
|
+
// the UI-state half — the schema allows `uiStates: []` there.
|
|
1234
|
+
if (target.mode === "behavior" && target.requirementIds.length === 0) {
|
|
1235
|
+
ctx.addIssue({
|
|
1236
|
+
code: "custom",
|
|
1237
|
+
message: `behavior verification target ${target.id} must reference at least one requirement`,
|
|
1238
|
+
path: ["verificationTargets"],
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
if (target.mode === "behavior" &&
|
|
1242
|
+
target.uiStates.length === 0 &&
|
|
1243
|
+
(value.uiStates.length > 0 || value.interactions.length > 0)) {
|
|
1244
|
+
ctx.addIssue({
|
|
1245
|
+
code: "custom",
|
|
1246
|
+
message: `behavior verification target ${target.id} must reference at least one declared UI state`,
|
|
1247
|
+
path: ["verificationTargets"],
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
846
1250
|
}
|
|
847
1251
|
for (const requirement of value.requirements) {
|
|
848
1252
|
if (!known.has(requirement.id))
|
|
@@ -1613,7 +2017,12 @@ export function compactFrontendImplementationContract(value) {
|
|
|
1613
2017
|
const targets = asRecord(record.targets);
|
|
1614
2018
|
if (targets) {
|
|
1615
2019
|
const compactTargets = { ...targets };
|
|
1616
|
-
for (const field of [
|
|
2020
|
+
for (const field of [
|
|
2021
|
+
"files",
|
|
2022
|
+
"routes",
|
|
2023
|
+
"publicApiChanges",
|
|
2024
|
+
"requiredDeliverables",
|
|
2025
|
+
]) {
|
|
1617
2026
|
if (Object.hasOwn(compactTargets, field)) {
|
|
1618
2027
|
compactTargets[field] = dedupeJsonArray(compactTargets[field]);
|
|
1619
2028
|
}
|
|
@@ -1622,6 +2031,7 @@ export function compactFrontendImplementationContract(value) {
|
|
|
1622
2031
|
}
|
|
1623
2032
|
compact.requirements = compactRecordArrayField(record.requirements, [
|
|
1624
2033
|
"implementationTargets",
|
|
2034
|
+
"deliverableTargets",
|
|
1625
2035
|
"verificationTargetIds",
|
|
1626
2036
|
"sourceFragmentIds",
|
|
1627
2037
|
"sourceRefs",
|
|
@@ -1657,7 +2067,7 @@ export function compactFrontendImplementationContract(value) {
|
|
|
1657
2067
|
conflicts: dedupeJsonArray(designEvidence.conflicts),
|
|
1658
2068
|
};
|
|
1659
2069
|
}
|
|
1660
|
-
for (const field of ["evidenceGaps", "
|
|
2070
|
+
for (const field of ["evidenceGaps", "residualRisks"]) {
|
|
1661
2071
|
if (Object.hasOwn(compact, field))
|
|
1662
2072
|
compact[field] = dedupeJsonArray(compact[field]);
|
|
1663
2073
|
}
|
|
@@ -1668,7 +2078,7 @@ function assertFrontendContractPathsSafe(value) {
|
|
|
1668
2078
|
const record = asRecord(value);
|
|
1669
2079
|
if (!record)
|
|
1670
2080
|
return;
|
|
1671
|
-
const pathFields = ["files", "file", "implementationTargets", "fixture", "consumer"];
|
|
2081
|
+
const pathFields = ["files", "file", "implementationTargets", "deliverableTargets", "fixture", "consumer"];
|
|
1672
2082
|
for (const [key, child] of Object.entries(record)) {
|
|
1673
2083
|
if (pathFields.includes(key) && Array.isArray(child)) {
|
|
1674
2084
|
for (const item of child) {
|
|
@@ -1962,6 +2372,8 @@ export function coerceFrontendImplementationContractInput(value, canonicalBindin
|
|
|
1962
2372
|
file,
|
|
1963
2373
|
symbol: asString(vt.symbol) || undefined,
|
|
1964
2374
|
...(scope ? { scope } : {}),
|
|
2375
|
+
...(vt.evidenceLevel !== undefined ? { evidenceLevel: vt.evidenceLevel } : {}),
|
|
2376
|
+
...(vt.boundary !== undefined ? { boundary: vt.boundary } : {}),
|
|
1965
2377
|
requirementIds: requirementIds.length > 0
|
|
1966
2378
|
? requirementIds
|
|
1967
2379
|
: [...canonicalBinding.requirementIds],
|
|
@@ -2012,6 +2424,10 @@ export function coerceFrontendImplementationContractInput(value, canonicalBindin
|
|
|
2012
2424
|
? { sourceFragmentIds: req.sourceFragmentIds }
|
|
2013
2425
|
: {}),
|
|
2014
2426
|
...(Array.isArray(req.sourceRefs) ? { sourceRefs: req.sourceRefs } : {}),
|
|
2427
|
+
...(Array.isArray(req.deliverableTargets)
|
|
2428
|
+
? { deliverableTargets: req.deliverableTargets }
|
|
2429
|
+
: {}),
|
|
2430
|
+
...(req.execution !== undefined ? { execution: req.execution } : {}),
|
|
2015
2431
|
};
|
|
2016
2432
|
// Do not mark free-form realIntegrationGap as blocking; defer to FE-TEST/FINAL-VERIFY.
|
|
2017
2433
|
if (gapText) {
|
|
@@ -2190,7 +2606,6 @@ export function coerceFrontendImplementationContractInput(value, canonicalBindin
|
|
|
2190
2606
|
},
|
|
2191
2607
|
verificationTargets,
|
|
2192
2608
|
evidenceGaps,
|
|
2193
|
-
implementationSteps: asStringArray(record.implementationSteps),
|
|
2194
2609
|
stylingStrategy: asString(record.stylingStrategy) || undefined,
|
|
2195
2610
|
dependencyPolicy: asString(record.dependencyPolicy) || undefined,
|
|
2196
2611
|
residualRisks: asStringArray(record.residualRisks),
|
|
@@ -2317,7 +2732,7 @@ export async function analyzeFrontendImplementationContract(input) {
|
|
|
2317
2732
|
record.commandLabel = entry.label;
|
|
2318
2733
|
const file = asString(record.file);
|
|
2319
2734
|
if (entry.mode === "behavior" && file && !isFrontendTestFilePath(file)) {
|
|
2320
|
-
fail("retryable-invalid", `invalid-output: verification-target-phase-mismatch: verification target "${vtId}" binds behavior command "${entry.label}" (${entry.commandId}) to non-test file "${file}"; behavior targets must bind a test file (__tests__/, tests?/, e2e/, cypress/, *.test.*, *.spec.*, *.cy.*) so
|
|
2735
|
+
fail("retryable-invalid", `invalid-output: verification-target-phase-mismatch: verification target "${vtId}" binds behavior command "${entry.label}" (${entry.commandId}) to non-test file "${file}"; behavior targets must bind a test file (__tests__/, tests?/, e2e/, cypress/, *.test.*, *.spec.*, *.cy.*) so verification can bind runner evidence to the declared test file`, candidateJsonSha256);
|
|
2321
2736
|
}
|
|
2322
2737
|
}
|
|
2323
2738
|
pushAction("resolve-verification-command-ids");
|
|
@@ -2388,7 +2803,10 @@ export async function analyzeFrontendImplementationContract(input) {
|
|
|
2388
2803
|
// field (r10/r11 design-review findings).
|
|
2389
2804
|
const referencedConcretePaths = [
|
|
2390
2805
|
...new Set([
|
|
2391
|
-
...result.data.requirements.flatMap(
|
|
2806
|
+
...result.data.requirements.flatMap(requirement => [
|
|
2807
|
+
...requirement.implementationTargets,
|
|
2808
|
+
...(requirement.deliverableTargets ?? []),
|
|
2809
|
+
]),
|
|
2392
2810
|
// Mock endpoint paths stay in the set: the zod refine validated
|
|
2393
2811
|
// them against the declared targets.files patterns, so the
|
|
2394
2812
|
// narrowing must keep covering them. Verification-target files
|
|
@@ -2398,12 +2816,25 @@ export async function analyzeFrontendImplementationContract(input) {
|
|
|
2398
2816
|
...(result.data.mockApi?.endpoints ?? []).flatMap((endpoint) => [endpoint.fixture, endpoint.consumer].filter((value) => typeof value === "string" && value.length > 0)),
|
|
2399
2817
|
].filter((value) => value.length > 0)),
|
|
2400
2818
|
].sort();
|
|
2819
|
+
const outsideDelivery = result.data.requirements.flatMap(requirement => requirement.deliverableTargets ?? []).filter(file => !parsedTargetFiles.some(pattern => pathMatchesPattern(file, pattern)));
|
|
2820
|
+
if (outsideDelivery.length)
|
|
2821
|
+
fail("blocked", `target-path-outside-write-set: deliverable paths [${outsideDelivery.join(", ")}] exceed frozen targets`, candidateJsonSha256);
|
|
2401
2822
|
if (referencedConcretePaths.length > 0) {
|
|
2402
2823
|
result.data.targets = {
|
|
2403
2824
|
...result.data.targets,
|
|
2404
2825
|
files: referencedConcretePaths,
|
|
2405
2826
|
};
|
|
2406
2827
|
}
|
|
2828
|
+
// Both Plan precheck and policy materialization consume this exact inventory.
|
|
2829
|
+
// Never trust a Plan patch or infer delivery obligations from prose.
|
|
2830
|
+
const contractRecords = await readTypedEventStoreFromJsonl(path.join(input.runDir, input.contractNodeId ?? "frontend-contract-pi", "contract-typed-facts.jsonl"));
|
|
2831
|
+
const requiredDeliverables = extractRequiredDeliverablePaths(contractRecords
|
|
2832
|
+
.filter((record) => record.phase === "committed")
|
|
2833
|
+
.map((record) => record.fact));
|
|
2834
|
+
delete result.data.targets.requiredDeliverables;
|
|
2835
|
+
if (requiredDeliverables.length > 0) {
|
|
2836
|
+
result.data.targets.requiredDeliverables = requiredDeliverables;
|
|
2837
|
+
}
|
|
2407
2838
|
const blockingGaps = [
|
|
2408
2839
|
...(result.data.evidenceGaps ?? []),
|
|
2409
2840
|
...result.data.requirements.flatMap((item) => item.evidenceGap ? [item.evidenceGap] : []),
|
|
@@ -2416,6 +2847,26 @@ export async function analyzeFrontendImplementationContract(input) {
|
|
|
2416
2847
|
if (!result.data.requirements.some((item) => item.id === requirementId) &&
|
|
2417
2848
|
!(result.data.evidenceGaps ?? []).some((item) => item.requirementId === requirementId))
|
|
2418
2849
|
fail("blocked", `frontend contract does not cover ${requirementId}`, candidateJsonSha256);
|
|
2850
|
+
// Both finalize prechecks and the final materializer enter this function.
|
|
2851
|
+
// Check the submitted placement before normalization can invent a fallback.
|
|
2852
|
+
const ownership = await deriveRequirementOwnershipFromRun(input.runDir, input.sourceBinding);
|
|
2853
|
+
for (const entry of ownership) {
|
|
2854
|
+
if (!entry.implementationFiles?.length)
|
|
2855
|
+
continue;
|
|
2856
|
+
for (const id of entry.requirementIds) {
|
|
2857
|
+
const original = asRecord(parsed)?.requirements?.find(item => asRecord(item)?.id === id);
|
|
2858
|
+
if (!original || asStringArray(asRecord(original)?.implementationTargets).length === 0)
|
|
2859
|
+
fail("retryable-invalid", `requirement-ownership-placement-missing: ${id} requires an explicit placement from its Plan facts`, candidateJsonSha256);
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
const ownershipFindings = checkRequirementOwnership(result.data, ownership);
|
|
2863
|
+
if (ownershipFindings.length)
|
|
2864
|
+
throw new PlanPolicyPrecheckFailure(ownershipFindings.map(f => `${f.code}: ${f.message}`).join("; "), ownershipFindings);
|
|
2865
|
+
const frozenBoundary = await deriveFrontendCapabilityBoundaryFromRun(input.runDir);
|
|
2866
|
+
delete result.data.capabilityBoundary;
|
|
2867
|
+
if (frozenBoundary)
|
|
2868
|
+
result.data.capabilityBoundary = frozenBoundary;
|
|
2869
|
+
result.data.dependencyPolicy = composeDependencyPolicyWithBoundary(result.data.dependencyPolicy, frozenBoundary);
|
|
2419
2870
|
return {
|
|
2420
2871
|
canonical: result.data,
|
|
2421
2872
|
candidateRawSha256,
|
|
@@ -2436,9 +2887,14 @@ function splitFrontendContractReviewGroup(canonical, fields) {
|
|
|
2436
2887
|
slices = [];
|
|
2437
2888
|
};
|
|
2438
2889
|
for (const field of fields) {
|
|
2439
|
-
if (!Object.hasOwn(canonical, field))
|
|
2440
|
-
continue;
|
|
2441
2890
|
const fieldValue = canonical[field];
|
|
2891
|
+
// Normalization keeps optional fields as present keys with an undefined
|
|
2892
|
+
// value; JSON serialization drops them, so a slice emitted here would
|
|
2893
|
+
// bind the section to a field the on-disk canonical never contains and
|
|
2894
|
+
// every reader (which re-parses the canonical from JSON) would fail to
|
|
2895
|
+
// resolve it.
|
|
2896
|
+
if (fieldValue === undefined)
|
|
2897
|
+
continue;
|
|
2442
2898
|
if (!Array.isArray(fieldValue)) {
|
|
2443
2899
|
const candidate = { ...data, [field]: fieldValue };
|
|
2444
2900
|
if (Object.keys(data).length > 0 &&
|
|
@@ -2607,10 +3063,12 @@ export async function writeFrontendImplementationContractArtifact(input) {
|
|
|
2607
3063
|
};
|
|
2608
3064
|
}
|
|
2609
3065
|
const FRONTEND_PLAN_PATCH_PROTECTED_PATHS = [
|
|
3066
|
+
"/capabilityBoundary",
|
|
2610
3067
|
"/schemaVersion",
|
|
2611
3068
|
"/sourceBinding",
|
|
2612
3069
|
"/riskLevel",
|
|
2613
3070
|
"/targets/files",
|
|
3071
|
+
"/targets/requiredDeliverables",
|
|
2614
3072
|
"/mockApi/productionDefaultOff",
|
|
2615
3073
|
];
|
|
2616
3074
|
const PLAN_LEDGER_FACT_KINDS_FOR_COMPILE = [
|
|
@@ -2652,18 +3110,36 @@ function frontendPlanPatchProtectedPathViolations(patch) {
|
|
|
2652
3110
|
if (!record)
|
|
2653
3111
|
return ["/"];
|
|
2654
3112
|
const violations = [];
|
|
2655
|
-
for (const key of ["schemaVersion", "sourceBinding", "riskLevel"]) {
|
|
3113
|
+
for (const key of ["schemaVersion", "sourceBinding", "riskLevel", "capabilityBoundary"]) {
|
|
2656
3114
|
if (Object.hasOwn(record, key))
|
|
2657
3115
|
violations.push(`/${key}`);
|
|
2658
3116
|
}
|
|
2659
3117
|
const targets = asRecord(record.targets);
|
|
2660
3118
|
if (targets && Object.hasOwn(targets, "files"))
|
|
2661
3119
|
violations.push("/targets/files");
|
|
3120
|
+
if (targets && Object.hasOwn(targets, "requiredDeliverables"))
|
|
3121
|
+
violations.push("/targets/requiredDeliverables");
|
|
2662
3122
|
const mockApi = asRecord(record.mockApi);
|
|
2663
3123
|
if (mockApi && Object.hasOwn(mockApi, "productionDefaultOff"))
|
|
2664
3124
|
violations.push("/mockApi/productionDefaultOff");
|
|
2665
3125
|
return violations;
|
|
2666
3126
|
}
|
|
3127
|
+
/** Read-only verification references do not grant writer permissions. */
|
|
3128
|
+
export async function collectExistingFrontendVerificationPaths(workspaceRoot, contract) {
|
|
3129
|
+
if (!workspaceRoot)
|
|
3130
|
+
return [];
|
|
3131
|
+
const existing = [];
|
|
3132
|
+
for (const target of contract.verificationTargets) {
|
|
3133
|
+
if (target.mode === "static" || existing.includes(target.file))
|
|
3134
|
+
continue;
|
|
3135
|
+
try {
|
|
3136
|
+
await readFileBoundarySafe({ boundaryRoot: workspaceRoot, targetPath: path.resolve(workspaceRoot, target.file), label: "frontend existing verification" });
|
|
3137
|
+
existing.push(target.file);
|
|
3138
|
+
}
|
|
3139
|
+
catch { /* Missing or unsafe files cannot bypass the write-set check. */ }
|
|
3140
|
+
}
|
|
3141
|
+
return existing;
|
|
3142
|
+
}
|
|
2667
3143
|
function workspaceRootFromDagRunDir(runDir) {
|
|
2668
3144
|
const absolute = path.resolve(runDir);
|
|
2669
3145
|
const segments = absolute.split(path.sep);
|
|
@@ -2804,6 +3280,27 @@ function assertVerificationSymbolShapes(contract) {
|
|
|
2804
3280
|
* (finalize_plan receipt) can synthesize fix suggestions instead of making
|
|
2805
3281
|
* the model re-derive them from prose.
|
|
2806
3282
|
*/
|
|
3283
|
+
/** Normalized-content sha256 of a parent run's canonical contract, used by the
|
|
3284
|
+
* recovery identical-plan guard. Both sides hash serializeDeterministicJson of
|
|
3285
|
+
* the parsed canonical, so on-disk formatting never changes the verdict.
|
|
3286
|
+
* Unreadable/missing parent contract → undefined (guard skipped). */
|
|
3287
|
+
export async function readParentCanonical(parentRunDir) {
|
|
3288
|
+
try {
|
|
3289
|
+
const raw = await readFile(path.join(parentRunDir, "contracts", "frontend-implementation-contract.json"), "utf8");
|
|
3290
|
+
return JSON.parse(raw);
|
|
3291
|
+
}
|
|
3292
|
+
catch {
|
|
3293
|
+
return undefined;
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3296
|
+
export async function parentCanonicalContentSha256(parentRunDir) {
|
|
3297
|
+
const canonical = await readParentCanonical(parentRunDir);
|
|
3298
|
+
if (!canonical)
|
|
3299
|
+
return undefined;
|
|
3300
|
+
return createHash("sha256")
|
|
3301
|
+
.update(serializeDeterministicJson(canonical))
|
|
3302
|
+
.digest("hex");
|
|
3303
|
+
}
|
|
2807
3304
|
export class PlanPolicyPrecheckFailure extends Error {
|
|
2808
3305
|
findings;
|
|
2809
3306
|
constructor(message, findings) {
|
|
@@ -2843,9 +3340,37 @@ export async function analyzeFrontendPlanPatchCandidate(input) {
|
|
|
2843
3340
|
const policyPreFindings = [
|
|
2844
3341
|
...checkUiDesignCoverage(analysis.canonical),
|
|
2845
3342
|
...checkUiStateAttribution(analysis.canonical),
|
|
3343
|
+
...checkRequiredDeliverables(analysis.canonical),
|
|
3344
|
+
...checkUxNameCollisions(analysis.canonical),
|
|
2846
3345
|
...checkDependencies(analysis.canonical, await deriveAllowedDependenciesFromRun(input.runDir)),
|
|
2847
|
-
...checkTargetPaths(analysis.canonical, await deriveWriteSetFromRun(input.runDir)),
|
|
3346
|
+
...checkTargetPaths(analysis.canonical, await deriveWriteSetFromRun(input.runDir), await collectExistingFrontendVerificationPaths(workspaceRootFromDagRunDir(input.runDir), analysis.canonical)),
|
|
3347
|
+
...checkComponentChoiceSourceReferences(analysis.canonical, await deriveFrontendSourceBindingPathsFromRun(input.runDir)),
|
|
3348
|
+
...checkInteractionIdVocabulary(analysis.canonical, await deriveFrontendInteractionIdsFromRun(input.runDir)),
|
|
3349
|
+
...checkMockApiStrategyAllowed(analysis.canonical, await deriveFrontendAllowedMockStrategiesFromRun(input.runDir)),
|
|
2848
3350
|
];
|
|
3351
|
+
// Front-load the static verification coverage gap (smoke r16-r20): when
|
|
3352
|
+
// the frozen command directory offers static entrypoints and no
|
|
3353
|
+
// verification target binds one, type-level/build constraints cannot be
|
|
3354
|
+
// proven. Surface the offered commands here so the plan retry ladder
|
|
3355
|
+
// records a static focus instead of the review flagging it post-hoc.
|
|
3356
|
+
// Every frozen static entry is a required check (smoke r27-r31): binding
|
|
3357
|
+
// only `verify-build` used to satisfy an "at least one" rule, after which
|
|
3358
|
+
// design review rejected the plan for the uncovered `verify-typecheck`
|
|
3359
|
+
// entry — a demand that reached the plan as prose and could never be
|
|
3360
|
+
// machine-checked. Coverage is enumerable, so it is enforced here.
|
|
3361
|
+
const verifyDirectory = await deriveFrontendVerifyCommandDirectoryFromRun(input.runDir);
|
|
3362
|
+
const staticCommands = verifyDirectory.filter((entry) => entry.mode === "static");
|
|
3363
|
+
if (staticCommands.length > 0) {
|
|
3364
|
+
const boundCommandIds = new Set(analysis.canonical.verificationTargets.map((target) => target.commandId));
|
|
3365
|
+
const uncovered = staticCommands.filter((entry) => !boundCommandIds.has(entry.commandId));
|
|
3366
|
+
if (uncovered.length > 0) {
|
|
3367
|
+
policyPreFindings.push({
|
|
3368
|
+
code: "static-verification-coverage-missing",
|
|
3369
|
+
message: `verification targets miss frozen static command(s): [${uncovered.map((entry) => `${entry.commandId} (${entry.label})`).join(", ")}]; the frozen directory offers: [${staticCommands.map((entry) => `${entry.commandId} (${entry.label})`).join(", ")}] — record record_verification_focus for every static commandId`,
|
|
3370
|
+
path: "verificationTargets",
|
|
3371
|
+
});
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
2849
3374
|
if (policyPreFindings.length > 0) {
|
|
2850
3375
|
const message = `frontend plan policy pre-check failed (fix these plan facts, then re-commit and finalize): ${policyPreFindings
|
|
2851
3376
|
.map((finding) => `${finding.code}: ${finding.message}`)
|
|
@@ -3061,9 +3586,11 @@ export async function buildContractFromCommittedFacts(input) {
|
|
|
3061
3586
|
}
|
|
3062
3587
|
// b. Committed contract terminal fact (contract-finalized).
|
|
3063
3588
|
const contractRecords = await readTypedEventStoreFromJsonl(path.join(input.runDir, contractNodeId, "contract-typed-facts.jsonl"));
|
|
3064
|
-
const
|
|
3589
|
+
const committedContractFacts = contractRecords
|
|
3065
3590
|
.filter((record) => record.phase === "committed")
|
|
3066
|
-
.map((record) => record.fact
|
|
3591
|
+
.map((record) => record.fact);
|
|
3592
|
+
const contractKinds = new Set(committedContractFacts
|
|
3593
|
+
.map((fact) => fact?.kind)
|
|
3067
3594
|
.filter((kind) => typeof kind === "string"));
|
|
3068
3595
|
if (!contractKinds.has("contract-finalized")) {
|
|
3069
3596
|
return {
|
|
@@ -3118,6 +3645,7 @@ export async function buildContractFromCommittedFacts(input) {
|
|
|
3118
3645
|
runDir: input.runDir,
|
|
3119
3646
|
rawContractText: serializeDeterministicJson(merged),
|
|
3120
3647
|
sourceBinding: input.sourceBinding,
|
|
3648
|
+
contractNodeId,
|
|
3121
3649
|
});
|
|
3122
3650
|
return {
|
|
3123
3651
|
ok: true,
|