@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.
Files changed (552) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +441 -2525
  3. package/README.md +19 -12
  4. package/dist/adapters/loop-agent.js +34 -0
  5. package/dist/application/dag/args.js +8 -0
  6. package/dist/application/dag/run-dag.js +5 -0
  7. package/dist/application/evaluation/budget.js +40 -1
  8. package/dist/application/evaluation/corpus-hash.js +10 -15
  9. package/dist/application/evaluation/corpus.js +2 -1
  10. package/dist/application/evaluation/frontend-browser-acceptance.js +77 -0
  11. package/dist/application/evaluation/frontend-corpus-browser-acceptance.js +175 -0
  12. package/dist/application/evaluation/frontend-gateway-evidence.js +226 -0
  13. package/dist/application/evaluation/frontend-pair-registration.js +143 -0
  14. package/dist/application/evaluation/frontend-paired-summary.js +150 -0
  15. package/dist/application/evaluation/frontend-run-observation.js +144 -0
  16. package/dist/application/evaluation/frontend-shared-evidence.js +105 -0
  17. package/dist/application/evaluation/types.js +45 -12
  18. package/dist/application/task-lifecycle/advance.js +64 -15
  19. package/dist/application/task-lifecycle/observe.js +69 -30
  20. package/dist/application/task-lifecycle/plan-transitions.js +5 -4
  21. package/dist/build-stamp.json +3 -3
  22. package/dist/cli/command-definitions.js +18 -5
  23. package/dist/cli/program.js +8 -5
  24. package/dist/cli/update/init-surface-notifier.js +2 -0
  25. package/dist/cli/update/policy.js +2 -0
  26. package/dist/commands/client-recovery.js +20 -55
  27. package/dist/commands/cursor-prompt.js +2 -0
  28. package/dist/commands/dag-approve.js +2 -0
  29. package/dist/commands/dag-final-verification.js +2 -0
  30. package/dist/commands/dag-init-hybrid.js +2 -0
  31. package/dist/commands/dag-reconcile-tasks.js +2 -0
  32. package/dist/commands/dag-reject.js +2 -0
  33. package/dist/commands/dag-report.js +2 -0
  34. package/dist/commands/dag-rerun.js +2 -0
  35. package/dist/commands/dag-resume.js +2 -0
  36. package/dist/commands/dag-workflow-compile.js +2 -0
  37. package/dist/commands/dag-workflow-plan.js +2 -0
  38. package/dist/commands/dag-workflow-validate.js +2 -0
  39. package/dist/commands/delegate.js +2 -0
  40. package/dist/commands/examples.js +2 -0
  41. package/dist/commands/import-prd.js +2 -0
  42. package/dist/commands/init-legacy-audit.js +330 -0
  43. package/dist/commands/init-model-catalog.js +2 -0
  44. package/dist/commands/init-upgrade.js +644 -104
  45. package/dist/commands/init.js +700 -338
  46. package/dist/commands/instructions.js +2 -0
  47. package/dist/commands/knowledge.js +2 -0
  48. package/dist/commands/loop-benchmark.js +2 -0
  49. package/dist/commands/operator-guide.js +99 -0
  50. package/dist/commands/operator.js +16 -3
  51. package/dist/commands/pi-prompt.js +2 -0
  52. package/dist/commands/pi-reuse-benchmark.js +2 -0
  53. package/dist/commands/promote-run.js +2 -0
  54. package/dist/commands/stats.js +1 -1
  55. package/dist/commands/study-init.js +2 -0
  56. package/dist/commands/task-advance.js +32 -0
  57. package/dist/commands/task-source-prepare.js +18 -2
  58. package/dist/commands/worktree-create.js +2 -0
  59. package/dist/commands/worktree-remove.js +2 -0
  60. package/dist/executors/dag-pi/guards.js +4 -0
  61. package/dist/executors/dag-pi/model-config.js +30 -0
  62. package/dist/executors/dag-pi/plan/fact-adoption.js +55 -0
  63. package/dist/executors/dag-pi/plan/facts.js +180 -0
  64. package/dist/executors/dag-pi/plan/finalize-tools.js +259 -0
  65. package/dist/executors/dag-pi/plan/ledger-contract.js +55 -0
  66. package/dist/executors/dag-pi/plan/record-tools.js +861 -0
  67. package/dist/executors/dag-pi/plan/schema.js +129 -0
  68. package/dist/executors/dag-pi/plan/tool-helpers.js +16 -0
  69. package/dist/executors/dag-pi/sessions/index.js +6 -0
  70. package/dist/executors/dag-pi/sessions/plan-batches.js +280 -0
  71. package/dist/executors/dag-pi/sessions/plan-prompts.js +367 -0
  72. package/dist/executors/dag-pi/sessions/scout-parallel.js +197 -0
  73. package/dist/executors/dag-pi/sessions/segmented-plan.js +1184 -0
  74. package/dist/executors/dag-pi/sessions/writer-evidence.js +60 -0
  75. package/dist/executors/dag-pi/tools/contract-tools.js +515 -0
  76. package/dist/executors/dag-pi/tools/design-terminal-tools.js +159 -0
  77. package/dist/executors/dag-pi/tools/plan-decision-tools.js +529 -0
  78. package/dist/executors/dag-pi/tools/review-terminal-tools.js +159 -0
  79. package/dist/executors/dag-pi/tools/scout-evidence-tools.js +270 -0
  80. package/dist/executors/dag-pi-executor.js +1516 -3181
  81. package/dist/executors/pi-executor.js +112 -4
  82. package/dist/executors/pi-sdk-executor.js +258 -44
  83. package/dist/executors/pi-writer-tool-policy.js +60 -4
  84. package/dist/executors/playwright-cli-launcher.js +31 -45
  85. package/dist/executors/shell-executor.js +313 -48
  86. package/dist/executors/shell-presets.js +1 -1
  87. package/dist/executors/shell-verification.js +3 -0
  88. package/dist/executors/shell-write-guard.js +77 -102
  89. package/dist/governance/exec-plans.js +16 -4
  90. package/dist/governance/harness.js +2 -7
  91. package/dist/governance/manifest-types.js +28 -9
  92. package/dist/governance/project-capability-scanner.js +263 -0
  93. package/dist/governance/project-config.js +96 -0
  94. package/dist/governance/resource-catalog.js +151 -0
  95. package/dist/infrastructure/console/app-data.js +12 -2
  96. package/dist/infrastructure/console/operation-store.js +48 -14
  97. package/dist/infrastructure/evaluation/corpus-store.js +37 -12
  98. package/dist/shared/artifacts-core.js +2 -0
  99. package/dist/shared/backend-dogfood-preflight.js +47 -0
  100. package/dist/shared/dag-failure-category.js +9 -0
  101. package/dist/shared/file-identity.js +23 -0
  102. package/dist/shared/frontend-execution-policy.js +23 -0
  103. package/dist/shared/git-progress.js +2 -0
  104. package/dist/shared/git-workspace-status.js +482 -0
  105. package/dist/shared/one-shot-prompt-args.js +2 -0
  106. package/dist/shared/operator/capabilities.js +185 -0
  107. package/dist/shared/package-metadata.js +29 -11
  108. package/dist/shared/path-safety.js +2 -2
  109. package/dist/shared/pi-context-pressure/extension.js +49 -16
  110. package/dist/shared/pi-context-pressure/index.js +1 -0
  111. package/dist/shared/pi-context-pressure/sift-bridge.js +1 -1
  112. package/dist/shared/pi-context-pressure/telemetry.js +4 -0
  113. package/dist/shared/pi-context-pressure/tool-result-pruner.js +98 -0
  114. package/dist/shared/pi-provider-recovery.js +182 -0
  115. package/dist/shared/pi-retry-settings.js +40 -0
  116. package/dist/shared/reference-context.js +2 -0
  117. package/dist/shared/update/npm-client.js +49 -1
  118. package/dist/shared/wizard-local-telemetry.js +51 -0
  119. package/dist/task/config-types.js +51 -2
  120. package/dist/task/contract/apply.js +36 -2
  121. package/dist/task/contract/project.js +22 -0
  122. package/dist/task/contract/recover.js +6 -0
  123. package/dist/task/contract/schema.js +12 -0
  124. package/dist/task/frontend-preflight.js +1 -1
  125. package/dist/task/source-prepare/artifact-meta.js +9 -2
  126. package/dist/task/source-prepare/build-draft.js +61 -0
  127. package/dist/task/source-prepare/fragment-inventory.js +4 -1
  128. package/dist/task/source-prepare/ledger-reconciliation.js +2 -2
  129. package/dist/task/source-prepare/ledger-review.js +6 -9
  130. package/dist/task/source-prepare/parse-intent.js +165 -14
  131. package/dist/task/source-prepare/path-policy.js +17 -7
  132. package/dist/task/source-prepare/prepare.js +6 -1
  133. package/dist/task/source-prepare/semantic-intake.js +33 -28
  134. package/dist/task/source-prepare/source-execution.js +65 -0
  135. package/dist/task/source-prepare/source-fidelity-pi.js +49 -17
  136. package/dist/task/source-prepare/source-provider-budget.js +290 -0
  137. package/dist/task/source-references.js +48 -23
  138. package/dist/task/task-demand-routing.js +5 -2
  139. package/dist/worker/cli.js +3 -5
  140. package/dist/worker/console/chat/assistant-content.js +5 -13
  141. package/dist/worker/console/chat/browser-automation.js +937 -0
  142. package/dist/worker/console/chat/browser-content.js +74 -0
  143. package/dist/worker/console/chat/browser-diagnostics.js +250 -0
  144. package/dist/worker/console/chat/browser-evaluation.js +58 -0
  145. package/dist/worker/console/chat/browser-operation-queue.js +19 -0
  146. package/dist/worker/console/chat/browser-pick.js +113 -0
  147. package/dist/worker/console/chat/browser-policy.js +113 -0
  148. package/dist/worker/console/chat/browser-routes.js +329 -0
  149. package/dist/worker/console/chat/browser-screenshot-result.js +47 -0
  150. package/dist/worker/console/chat/browser-storage.js +89 -0
  151. package/dist/worker/console/chat/chat-event-store.js +73 -18
  152. package/dist/worker/console/chat/context-insights.js +788 -0
  153. package/dist/worker/console/chat/conversation-nodes.js +383 -0
  154. package/dist/worker/console/chat/db-connections.js +854 -0
  155. package/dist/worker/console/chat/explore-tools.js +18 -2
  156. package/dist/worker/console/chat/pet/pet-affinity.js +169 -0
  157. package/dist/worker/console/chat/pet/pet-persist.js +109 -0
  158. package/dist/worker/console/chat/pet/pet-registry.js +142 -0
  159. package/dist/worker/console/chat/pet/pet-remarks.js +48 -0
  160. package/dist/worker/console/chat/pet/pet-routes.js +125 -0
  161. package/dist/worker/console/chat/pet/pet-service.js +262 -0
  162. package/dist/worker/console/chat/pet/pet-state.js +99 -0
  163. package/dist/worker/console/chat/pi-mode-loop-isolation.js +170 -0
  164. package/dist/worker/console/chat/pi-runtime/custom-tools/ask-user-question.js +44 -0
  165. package/dist/worker/console/chat/pi-runtime/custom-tools/browser-tools.js +135 -0
  166. package/dist/worker/console/chat/pi-runtime/custom-tools/explore-tools.js +202 -0
  167. package/dist/worker/console/chat/pi-runtime/custom-tools/goal-tools.js +79 -0
  168. package/dist/worker/console/chat/pi-runtime/custom-tools/operator-tools.js +94 -0
  169. package/dist/worker/console/chat/pi-runtime/custom-tools/scheduled-goal-tools.js +22 -0
  170. package/dist/worker/console/chat/pi-runtime/custom-tools/sql-tools.js +670 -0
  171. package/dist/worker/console/chat/pi-runtime/custom-tools/todo-write.js +38 -0
  172. package/dist/worker/console/chat/pi-runtime/inspection-types.js +28 -0
  173. package/dist/worker/console/chat/pi-runtime/inspection.js +439 -0
  174. package/dist/worker/console/chat/pi-runtime/progressive-tools.js +195 -0
  175. package/dist/worker/console/chat/pi-runtime/sdk-bindings.js +153 -0
  176. package/dist/worker/console/chat/pi-runtime/sdk-session.js +5 -0
  177. package/dist/worker/console/chat/pi-runtime.js +793 -1230
  178. package/dist/worker/console/chat/provider-error.js +0 -12
  179. package/dist/worker/console/chat/repo-browser.js +132 -6
  180. package/dist/worker/console/chat/repo-preview-kind.js +155 -0
  181. package/dist/worker/console/chat/resource-loader.js +4 -1
  182. package/dist/worker/console/chat/routes.js +861 -148
  183. package/dist/worker/console/chat/scheduled-goal-booking.js +59 -0
  184. package/dist/worker/console/chat/scheduled-goal-delivery.js +27 -0
  185. package/dist/worker/console/chat/scheduled-goal-request.js +198 -0
  186. package/dist/worker/console/chat/scm-routes.js +217 -0
  187. package/dist/worker/console/chat/scm-service.js +283 -0
  188. package/dist/worker/console/chat/scm-tools.js +111 -0
  189. package/dist/worker/console/chat/sdd-data-alignment.js +85 -41
  190. package/dist/worker/console/chat/session-catalog.js +32 -0
  191. package/dist/worker/console/chat/session-mode-view.js +49 -0
  192. package/dist/worker/console/chat/session-mode.js +224 -0
  193. package/dist/worker/console/chat/session-store.js +232 -32
  194. package/dist/worker/console/chat/shortcuts.js +13 -0
  195. package/dist/worker/console/chat/subagents/agent-tool.js +62 -0
  196. package/dist/worker/console/chat/subagents/explore-agent.js +169 -0
  197. package/dist/worker/console/chat/subagents/index.js +5 -0
  198. package/dist/worker/console/chat/subagents/orchestrator.js +273 -0
  199. package/dist/worker/console/chat/subagents/tool-policy.js +53 -0
  200. package/dist/worker/console/chat/subagents/types.js +13 -0
  201. package/dist/worker/console/chat/terminal-routes.js +216 -0
  202. package/dist/worker/console/chat/terminal-sessions.js +348 -0
  203. package/dist/worker/console/chat/terminal-tools.js +211 -0
  204. package/dist/worker/console/chat/timeline-message-order.js +22 -0
  205. package/dist/worker/console/chat/tool-preview.js +136 -0
  206. package/dist/worker/console/chat/tools.js +69 -1
  207. package/dist/worker/console/chat/turn-order.js +13 -0
  208. package/dist/worker/console/chat/turn-process.js +210 -36
  209. package/dist/worker/console/chat/user-turn-outline.js +19 -0
  210. package/dist/worker/console/console-shutdown.js +34 -0
  211. package/dist/worker/console/console-update-and-init.js +1 -19
  212. package/dist/worker/console/console-update-runtime.js +7 -22
  213. package/dist/worker/console/dag-confirmation.js +3 -0
  214. package/dist/worker/console/dag-execution-receipt.js +3 -0
  215. package/dist/worker/console/interview/tools.js +1 -0
  216. package/dist/worker/console/operator-actions.js +95 -4
  217. package/dist/worker/console/operator-user-error.js +28 -1
  218. package/dist/worker/console/pi-readiness.js +4 -4
  219. package/dist/worker/console/prd-intake-bridge.js +47 -1
  220. package/dist/worker/console/recovery-cta.js +14 -14
  221. package/dist/worker/console/routes.js +13 -0
  222. package/dist/worker/console/scheduled-goal-host.js +98 -0
  223. package/dist/worker/console/scheduled-goal-operation-adapter.js +127 -0
  224. package/dist/worker/console/server.js +33 -31
  225. package/dist/worker/console/static/app-icon.svg +39 -0
  226. package/dist/worker/console/static/assets/{abnfDiagram-N423BO3Z-BZogYNl1.js → abnfDiagram-N423BO3Z-DASc69AM.js} +1 -1
  227. package/dist/worker/console/static/assets/{arc-DcJTLe2v.js → arc-h09p-LAc.js} +1 -1
  228. package/dist/worker/console/static/assets/{architectureDiagram-T3A2C74G-B39EQQ9n.js → architectureDiagram-T3A2C74G-CZ3dtLkh.js} +1 -1
  229. package/dist/worker/console/static/assets/{blockDiagram-VBNYF7ZC-CitCGV56.js → blockDiagram-VBNYF7ZC-DMrRhMXG.js} +1 -1
  230. package/dist/worker/console/static/assets/{c4Diagram-5PPSVZJV-rvWuOHLG.js → c4Diagram-5PPSVZJV-DQxisHV6.js} +1 -1
  231. package/dist/worker/console/static/assets/channel-D1zgKZfg.js +1 -0
  232. package/dist/worker/console/static/assets/{chunk-2GRJ4B5K-DGXplIJs.js → chunk-2GRJ4B5K-CefVN9zh.js} +1 -1
  233. package/dist/worker/console/static/assets/{chunk-2Q5K7J3B-ur9OqjPn.js → chunk-2Q5K7J3B-DmR1Koq2.js} +1 -1
  234. package/dist/worker/console/static/assets/{chunk-5RXB4S5H-D1KqU_Vi.js → chunk-5RXB4S5H-NlzrSW7L.js} +1 -1
  235. package/dist/worker/console/static/assets/{chunk-5VM5RSS4-BlVZrbtM.js → chunk-5VM5RSS4-DfelJv-0.js} +1 -1
  236. package/dist/worker/console/static/assets/{chunk-6Q2QTUOP-BAzz3nQy.js → chunk-6Q2QTUOP-BK6RFy58.js} +1 -1
  237. package/dist/worker/console/static/assets/{chunk-GF5L2VYU-CP_nYuCV.js → chunk-GF5L2VYU-BAeh9lz4.js} +1 -1
  238. package/dist/worker/console/static/assets/{chunk-JWPE2WC7-CWvKQ80X.js → chunk-JWPE2WC7-ChPS5WzG.js} +1 -1
  239. package/dist/worker/console/static/assets/{chunk-KBJHAD2P-CyUki8wp.js → chunk-KBJHAD2P-BoVe5IM6.js} +1 -1
  240. package/dist/worker/console/static/assets/{chunk-RYQCIY6F-5NYzNKfY.js → chunk-RYQCIY6F-C4q_0Lw9.js} +1 -1
  241. package/dist/worker/console/static/assets/{chunk-XXDRQBXY-DHdUgjS-.js → chunk-XXDRQBXY-Bb9TvjeY.js} +1 -1
  242. package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-CXNNsY2M.js +1 -0
  243. package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-CXNNsY2M.js +1 -0
  244. package/dist/worker/console/static/assets/{cose-bilkent-JH36ORCC-ANQ5g_t6.js → cose-bilkent-JH36ORCC-DmNnL8Ff.js} +1 -1
  245. package/dist/worker/console/static/assets/{cynefin-VYW2F7L2-CruT_4-0.js → cynefin-VYW2F7L2-Contvx58.js} +1 -1
  246. package/dist/worker/console/static/assets/{cynefinDiagram-MW4NZA55-rbFo77ID.js → cynefinDiagram-MW4NZA55-Cigq7cjk.js} +1 -1
  247. package/dist/worker/console/static/assets/{dagre-VZM6K2ZE-asstxBQs.js → dagre-VZM6K2ZE-dEbC0nxb.js} +1 -1
  248. package/dist/worker/console/static/assets/{diagram-7IWD3JNH-DzTyBZwI.js → diagram-7IWD3JNH-CzIztESV.js} +1 -1
  249. package/dist/worker/console/static/assets/{diagram-B4RE2ZJO-gw8ccH3B.js → diagram-B4RE2ZJO-Bo14zbaY.js} +1 -1
  250. package/dist/worker/console/static/assets/{diagram-LBJQPF4R-B8RpZzOf.js → diagram-LBJQPF4R-C4xUyil6.js} +1 -1
  251. package/dist/worker/console/static/assets/{diagram-Q27KOJAE-B1zJkCS9.js → diagram-Q27KOJAE-CaBY_uYa.js} +1 -1
  252. package/dist/worker/console/static/assets/{diagram-UB23O5K3-B6JLWZmO.js → diagram-UB23O5K3-ClUXUeiu.js} +1 -1
  253. package/dist/worker/console/static/assets/{ebnfDiagram-BXEA7PRR-q2iZP-Ps.js → ebnfDiagram-BXEA7PRR-BbGCgjC6.js} +1 -1
  254. package/dist/worker/console/static/assets/{erDiagram-JOGREHBK-B3dbbktQ.js → erDiagram-JOGREHBK-Dr-AcwSl.js} +1 -1
  255. package/dist/worker/console/static/assets/{flowDiagram-UKHOOZJN-C-zc6-kB.js → flowDiagram-UKHOOZJN-BG8Gcfyc.js} +1 -1
  256. package/dist/worker/console/static/assets/{ganttDiagram-PKOTCBZU-BSolnot9.js → ganttDiagram-PKOTCBZU-CFVaPs5r.js} +1 -1
  257. package/dist/worker/console/static/assets/{gitGraphDiagram-DS77QQ5N-Bo8jGxTk.js → gitGraphDiagram-DS77QQ5N-ChJ8pm-O.js} +1 -1
  258. package/dist/worker/console/static/assets/index-B_5GhVIO.js +488 -0
  259. package/dist/worker/console/static/assets/index-C7YMBluX.css +1 -0
  260. package/dist/worker/console/static/assets/{infoDiagram-6WML65LV-DQaZqJOH.js → infoDiagram-6WML65LV-C5J9-uCZ.js} +1 -1
  261. package/dist/worker/console/static/assets/{ishikawaDiagram-WSZJBQD7-DsdX1WnE.js → ishikawaDiagram-WSZJBQD7-BcfjqzDv.js} +1 -1
  262. package/dist/worker/console/static/assets/{journeyDiagram-NVQOT4AX-CP5EYDZL.js → journeyDiagram-NVQOT4AX-BzzCO-rD.js} +1 -1
  263. package/dist/worker/console/static/assets/{kanban-definition-27J2QSJJ-DAm14Dr8.js → kanban-definition-27J2QSJJ-NCHUZ46h.js} +1 -1
  264. package/dist/worker/console/static/assets/{linear-gZECoLc5.js → linear-BKZlWCUU.js} +1 -1
  265. package/dist/worker/console/static/assets/{mermaid.core-BRJNIM6p.js → mermaid.core-DbTaQjFE.js} +5 -5
  266. package/dist/worker/console/static/assets/{mindmap-definition-FAOFIHXS-Cja3kLkR.js → mindmap-definition-FAOFIHXS-CroYl5xQ.js} +1 -1
  267. package/dist/worker/console/static/assets/{pegDiagram-VL7TDLO6-22ZGFisL.js → pegDiagram-VL7TDLO6-DgMBx-9k.js} +1 -1
  268. package/dist/worker/console/static/assets/{pieDiagram-7S7Q4E2Y-BXin0Y1o.js → pieDiagram-7S7Q4E2Y-CyWDmbq1.js} +1 -1
  269. package/dist/worker/console/static/assets/{quadrantDiagram-CIZ2JOQS-Cw6T69Yt.js → quadrantDiagram-CIZ2JOQS-BgGEOqSP.js} +1 -1
  270. package/dist/worker/console/static/assets/{railroadDiagram-AXF67PYL-C1-gTieN.js → railroadDiagram-AXF67PYL-BMZ7oeeV.js} +1 -1
  271. package/dist/worker/console/static/assets/{requirementDiagram-LRYGKXZP--H5N2iI1.js → requirementDiagram-LRYGKXZP-DxqyGhcc.js} +1 -1
  272. package/dist/worker/console/static/assets/{sankeyDiagram-W5VNT64P-CgWAPeRz.js → sankeyDiagram-W5VNT64P-DnSvNCG8.js} +1 -1
  273. package/dist/worker/console/static/assets/{sequenceDiagram-SI44F4Z6-CrKqzGvt.js → sequenceDiagram-SI44F4Z6-BiZh6f-R.js} +1 -1
  274. package/dist/worker/console/static/assets/{sizeCapture-X5ZJPWSS-BB3wG06K.js → sizeCapture-X5ZJPWSS-BKXSI8WB.js} +1 -1
  275. package/dist/worker/console/static/assets/{stateDiagram-OKZ733FA-DjsGgdgY.js → stateDiagram-OKZ733FA-CfSgoYFm.js} +1 -1
  276. package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-DgHi3vjb.js +1 -0
  277. package/dist/worker/console/static/assets/{swimlanes-SLNWSIFB-DYKEbvAR.js → swimlanes-SLNWSIFB-CyGADcHe.js} +2 -2
  278. package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-Bgvdt1Y0.js +8 -0
  279. package/dist/worker/console/static/assets/{timeline-definition-Z64GVDOM-eQOb5k9Y.js → timeline-definition-Z64GVDOM-HmPaSPOK.js} +1 -1
  280. package/dist/worker/console/static/assets/{vennDiagram-T6HMQDX7-B2-l9FIu.js → vennDiagram-T6HMQDX7-VA2VBbez.js} +1 -1
  281. package/dist/worker/console/static/assets/{wardleyDiagram-T6FBY63Y-BX2Cda3l.js → wardleyDiagram-T6FBY63Y-BxjiBPZa.js} +1 -1
  282. package/dist/worker/console/static/assets/{xychartDiagram-ELKLHX3M-D9S892ph.js → xychartDiagram-ELKLHX3M--hUY-qFj.js} +1 -1
  283. package/dist/worker/console/static/index.html +5 -2
  284. package/dist/worker/console/static/manifest.webmanifest +19 -0
  285. package/dist/worker/console/static/pets/ember/pet.json +167 -0
  286. package/dist/worker/console/static/pets/ember/spritesheet.png +0 -0
  287. package/dist/worker/console/static-src/app/console-types.js +9 -1
  288. package/dist/worker/console/static-src/chat-view-types.js +1 -1
  289. package/dist/worker/console/static-src/operator-chat/active-turn-tail.js +10 -0
  290. package/dist/worker/console/static-src/operator-chat/animation-frame-batcher.js +38 -0
  291. package/dist/worker/console/static-src/operator-chat/chat-link.js +114 -0
  292. package/dist/worker/console/static-src/operator-chat/chat-scroll-position.js +24 -0
  293. package/dist/worker/console/static-src/operator-chat/chat-sse-events.js +360 -14
  294. package/dist/worker/console/static-src/operator-chat/chat-stream-continuity.js +101 -0
  295. package/dist/worker/console/static-src/operator-chat/compaction-message.js +10 -2
  296. package/dist/worker/console/static-src/operator-chat/composer-session-ledger.js +192 -0
  297. package/dist/worker/console/static-src/operator-chat/context-insights-store.js +64 -0
  298. package/dist/worker/console/static-src/operator-chat/details-rail-surfaces.js +99 -0
  299. package/dist/worker/console/static-src/operator-chat/file-palette-nav.js +81 -0
  300. package/dist/worker/console/static-src/operator-chat/open-preview-in-browser.js +57 -9
  301. package/dist/worker/console/static-src/operator-chat/pending-user-message.js +66 -0
  302. package/dist/worker/console/static-src/operator-chat/process-label.js +63 -0
  303. package/dist/worker/console/static-src/operator-chat/slash-palette-nav.js +15 -5
  304. package/dist/worker/console/static-src/operator-chat/timeline-merge.js +29 -0
  305. package/dist/worker/console/static-src/operator-chat/tools-catalog.js +36 -8
  306. package/dist/worker/console/static-src/operator-chat/transcript-mode.js +21 -0
  307. package/dist/worker/console/static-src/operator-chat/turn-group-equality.js +16 -0
  308. package/dist/worker/console/static-src/operator-chat/turn-process-disclosure.js +18 -0
  309. package/dist/worker/console/static-src/operator-chat/turn-state-projection.js +166 -0
  310. package/dist/worker/console/static-src/operator-chat/turn-stream-controller.js +58 -2
  311. package/dist/worker/console/static-src/operator-chat/use-searchable-hidden.js +51 -0
  312. package/dist/worker/console/static-src/operator-chat/use-stat-dialog.js +95 -0
  313. package/dist/worker/console/static-src/operator-chat/useChatSessions.js +338 -93
  314. package/dist/worker/console/static-src/operator-chat/useChatStream.js +310 -106
  315. package/dist/worker/console/static-src/operator-chat/useChatThread.js +179 -75
  316. package/dist/worker/console/static-src/operator-chat/useComposer.js +281 -79
  317. package/dist/worker/console/static-src/operator-chat/useRepoBrowser.js +21 -3
  318. package/dist/worker/console/static-src/operator-chat/useRuntimeControls.js +36 -17
  319. package/dist/worker/console/static-src/operator-chat/useRuntimeSnapshot.js +18 -0
  320. package/dist/worker/console/static-src/operator-chat/useWorkspaceBrowserGate.js +4 -0
  321. package/dist/worker/console/static-src/operator-chat/user-turn-anchor-equality.js +21 -0
  322. package/dist/worker/console/static-src/prd-file-import.js +3 -1
  323. package/dist/worker/console/static-src/shell/console-update-reload.js +1 -1
  324. package/dist/worker/console/workspace-context.js +54 -1
  325. package/dist/worker/console/workspace-initialization.js +218 -0
  326. package/dist/worker/delivery/git-transaction.js +2 -0
  327. package/dist/worker/delivery/package.js +4 -1
  328. package/dist/worker/feature/fullstack-validate.js +2 -0
  329. package/dist/worker/loop-agent/loop-agent-client.js +8 -2
  330. package/dist/worker/materialize/harness-task-lineage.js +4 -2
  331. package/dist/worker/materialize/harness-task-materializer.js +4 -1
  332. package/dist/worker/metrics/projector.js +1 -1
  333. package/dist/worker/observability/event-store.js +4 -1
  334. package/dist/worker/observability/read-model.js +27 -3
  335. package/dist/worker/observe/node-context-insights.js +479 -0
  336. package/dist/worker/observe/node-transparency.js +103 -72
  337. package/dist/worker/observe/routes.js +24 -1
  338. package/dist/worker/observe/static/console-theme.css +178 -0
  339. package/dist/worker/observe/static/console-theme.js +74 -0
  340. package/dist/worker/observe/static/dag-inspector-humanize.js +3 -0
  341. package/dist/worker/observe/static/dom.js +20 -1
  342. package/dist/worker/observe/static/format-pool.d.ts +2 -0
  343. package/dist/worker/observe/static/format-pool.js +6 -0
  344. package/dist/worker/observe/static/format.js +7 -0
  345. package/dist/worker/observe/static/inspect-workspace.js +34 -7
  346. package/dist/worker/observe/static/inspector-submission.js +32 -0
  347. package/dist/worker/observe/static/kpi.js +1 -0
  348. package/dist/worker/observe/static/operator-chrome.css +85 -0
  349. package/dist/worker/observe/static/operator-chrome.js +13 -1
  350. package/dist/worker/observe/static/relations.js +2 -0
  351. package/dist/worker/observe/static/router.js +13 -0
  352. package/dist/worker/observe/static/run-processing.js +2 -0
  353. package/dist/worker/observe/static/shell-chrome.js +36 -3
  354. package/dist/worker/observe/static/state.js +35 -2
  355. package/dist/worker/observe/static/styles.css +263 -39
  356. package/dist/worker/observe/static/task-failure-labels.d.ts +4 -0
  357. package/dist/worker/observe/static/task-failure-labels.js +67 -0
  358. package/dist/worker/observe/static/task-history.js +12 -0
  359. package/dist/worker/observe/static/views/batch.js +6 -13
  360. package/dist/worker/observe/static/views/dag-graph.js +50 -3
  361. package/dist/worker/observe/static/views/dag-inspector.js +742 -268
  362. package/dist/worker/observe/static/views/dag-trajectory.js +3 -0
  363. package/dist/worker/observe/static/views/dag.d.ts +6 -0
  364. package/dist/worker/observe/static/views/dag.js +49 -11
  365. package/dist/worker/observe/static/views/dags.js +2 -0
  366. package/dist/worker/observe/static/views/dashboard.js +21 -12
  367. package/dist/worker/observe/static/views/failures.js +21 -11
  368. package/dist/worker/observe/static/views/feature.js +11 -29
  369. package/dist/worker/observe/static/views/pool.js +37 -28
  370. package/dist/worker/observe/static/views/run.js +48 -5
  371. package/dist/worker/observe/static/views/session-timeline.js +189 -240
  372. package/dist/worker/observe/static/views/task.js +81 -62
  373. package/dist/worker/outcomes/declared-artifacts.js +2 -0
  374. package/dist/worker/preflight.js +3 -0
  375. package/dist/worker/scheduler/scheduled-goal-dispatch.js +118 -0
  376. package/dist/worker/scheduler/scheduled-goal-evidence.js +230 -0
  377. package/dist/worker/scheduler/scheduled-goal-recovery.js +62 -0
  378. package/dist/worker/scheduler/scheduled-goal-store.js +709 -0
  379. package/dist/worker/scheduler/scheduled-goal-supervisor.js +132 -0
  380. package/dist/worker/scheduler/scheduled-goal-time.js +102 -0
  381. package/dist/worker/scheduler/scheduled-goal-types.js +95 -0
  382. package/dist/worker/task-spec/validate.js +4 -1
  383. package/dist/workflows/dag/backend-test-case-coverage-analysis.js +3 -1
  384. package/dist/workflows/dag/backend-test-layout.js +27 -7
  385. package/dist/workflows/dag/backend-test-markdown-workflow.js +9 -25
  386. package/dist/workflows/dag/backend-test-plan-protocol.js +82 -5
  387. package/dist/workflows/dag/backend-test-pytest-collection.js +4 -1
  388. package/dist/workflows/dag/budget-enforcement.js +82 -3
  389. package/dist/workflows/dag/checkpoint.js +686 -0
  390. package/dist/workflows/dag/dag-retry-schema.js +14 -0
  391. package/dist/workflows/dag/decision-envelope.js +2 -0
  392. package/dist/workflows/dag/dynamic-runtime/shared.js +2 -2
  393. package/dist/workflows/dag/final-verification.js +45 -10
  394. package/dist/workflows/dag/frontend-capacity.js +9 -0
  395. package/dist/workflows/dag/frontend-closeout.js +5 -1
  396. package/dist/workflows/dag/frontend-committed-facts.js +461 -0
  397. package/dist/workflows/dag/frontend-contract-facts.js +133 -0
  398. package/dist/workflows/dag/frontend-design-policy.js +107 -21
  399. package/dist/workflows/dag/frontend-durable-tools.js +225 -0
  400. package/dist/workflows/dag/frontend-execution-groups.js +24 -0
  401. package/dist/workflows/dag/frontend-implementation-contract.js +554 -26
  402. package/dist/workflows/dag/frontend-input-projection.js +76 -0
  403. package/dist/workflows/dag/frontend-plan-canary.js +103 -0
  404. package/dist/workflows/dag/frontend-plan-decision-contract.js +795 -0
  405. package/dist/workflows/dag/frontend-plan-progress.js +92 -0
  406. package/dist/workflows/dag/frontend-plan-recovery-policy.js +18 -0
  407. package/dist/workflows/dag/frontend-plan-render.js +21 -5
  408. package/dist/workflows/dag/frontend-provider-capability-matrix.js +8 -61
  409. package/dist/workflows/dag/frontend-recovery-controller.js +7 -7
  410. package/dist/workflows/dag/frontend-recovery-lineage.js +13 -0
  411. package/dist/workflows/dag/frontend-recovery-plan.js +10 -5
  412. package/dist/workflows/dag/frontend-recovery-run.js +148 -47
  413. package/dist/workflows/dag/frontend-repair-assertions.js +36 -0
  414. package/dist/workflows/dag/frontend-repair.js +79 -76
  415. package/dist/workflows/dag/frontend-review-context.js +71 -69
  416. package/dist/workflows/dag/frontend-review-scopes.js +237 -0
  417. package/dist/workflows/dag/frontend-risk.js +101 -12
  418. package/dist/workflows/dag/frontend-root-observation.js +261 -0
  419. package/dist/workflows/dag/frontend-session-budget.js +376 -0
  420. package/dist/workflows/dag/frontend-session-context.js +10 -0
  421. package/dist/workflows/dag/frontend-shape-facts.js +12 -2
  422. package/dist/workflows/dag/frontend-shape.js +27 -32
  423. package/dist/workflows/dag/frontend-test-case-checklist.js +12 -3
  424. package/dist/workflows/dag/frontend-test-case-generation-assessment.js +21 -2
  425. package/dist/workflows/dag/frontend-test-case-quality.js +3 -3
  426. package/dist/workflows/dag/frontend-test-environment-probe.js +0 -2
  427. package/dist/workflows/dag/frontend-test-execution-evidence.js +328 -0
  428. package/dist/workflows/dag/frontend-test-framework-adapters.js +309 -0
  429. package/dist/workflows/dag/frontend-test-layout.js +41 -12
  430. package/dist/workflows/dag/frontend-typed-event-store.js +57 -26
  431. package/dist/workflows/dag/frontend-verification-trace.js +65 -48
  432. package/dist/workflows/dag/frontend-writer-admission.js +6 -48
  433. package/dist/workflows/dag/frontend-writer-status.js +0 -23
  434. package/dist/workflows/dag/hybrid/sources.js +1831 -0
  435. package/dist/workflows/dag/hybrid/templates/backend-test.js +1822 -0
  436. package/dist/workflows/dag/hybrid/templates/frontend-test.js +807 -0
  437. package/dist/workflows/dag/hybrid/templates/frontend.js +1529 -0
  438. package/dist/workflows/dag/hybrid/templates/index.js +8 -0
  439. package/dist/workflows/dag/hybrid/templates/kg-bootstrap.js +449 -0
  440. package/dist/workflows/dag/hybrid/templates/knowledge-sync.js +495 -0
  441. package/dist/workflows/dag/hybrid/templates/shared.js +101 -0
  442. package/dist/workflows/dag/hybrid/templates/standard.js +265 -0
  443. package/dist/workflows/dag/hybrid/types.js +32 -0
  444. package/dist/workflows/dag/init-hybrid.js +57 -7167
  445. package/dist/workflows/dag/interrupt-request.js +2 -0
  446. package/dist/workflows/dag/lifecycle.js +11 -2
  447. package/dist/workflows/dag/node-execution.js +257 -247
  448. package/dist/workflows/dag/output-protocol.js +1 -0
  449. package/dist/workflows/dag/prompt.js +4 -0
  450. package/dist/workflows/dag/reconcile-run.js +2 -0
  451. package/dist/workflows/dag/repair-artifact.js +3 -1
  452. package/dist/workflows/dag/report.js +2 -0
  453. package/dist/workflows/dag/rerun-feedback.js +36 -4
  454. package/dist/workflows/dag/rerun-plan.js +106 -4
  455. package/dist/workflows/dag/rerun-run.js +7 -0
  456. package/dist/workflows/dag/rerun-task.js +75 -1
  457. package/dist/workflows/dag/retry-policy.js +34 -10
  458. package/dist/workflows/dag/runner-exit-diagnostics.js +125 -0
  459. package/dist/workflows/dag/runner.js +38 -1074
  460. package/dist/workflows/dag/scheduler.js +2 -4
  461. package/dist/workflows/dag/skill-instructions.js +102 -32
  462. package/dist/workflows/dag/skill-snapshot.js +3 -0
  463. package/dist/workflows/dag/skills.js +7 -7
  464. package/dist/workflows/dag/structured-output-repair.js +4 -1
  465. package/dist/workflows/dag/terminal-status.js +502 -0
  466. package/dist/workflows/dag/test-artifact-namespace.js +73 -0
  467. package/dist/workflows/dag/types.js +58 -7
  468. package/dist/workflows/dag/validate.js +38 -13
  469. package/dist/workflows/dag/workspace-checkpoint.js +79 -1
  470. package/dist/workflows/loop/benchmark.js +11 -8
  471. package/docs/README.md +2 -1
  472. package/docs/architecture/dag-execution.md +4 -4
  473. package/docs/architecture/runtime-boundaries.md +29 -23
  474. package/docs/governance/README.md +1 -0
  475. package/docs/governance/harness-methodology-verification.md +11 -0
  476. package/docs/init-surface.manifest.json +44 -295
  477. package/docs/operations/README.md +4 -0
  478. package/docs/templates/README.md +5 -5
  479. package/docs/templates/agent-dag.base.json +9 -9
  480. package/docs/templates/agent-dag.final-verification.json +6 -6
  481. package/docs/templates/agent-dag.schema.json +2 -2
  482. package/docs/templates/agent-dag.supervised-implementation.json +12 -12
  483. package/docs/templates/backend-test-dag.generate-pytest.prompt.md +3 -3
  484. package/docs/templates/backend-test-dag.json +708 -703
  485. package/docs/templates/backend-test-dag.review-cases.prompt.md +3 -3
  486. package/docs/templates/frontend-design-contract.md +4 -4
  487. package/docs/templates/frontend-implementation-contract.schema.json +99 -22
  488. package/docs/templates/frontend-implementation-dag.json +7 -7
  489. package/docs/templates/frontend-test-case-checklist.md +2 -2
  490. package/docs/templates/frontend-test-case.example.md +2 -0
  491. package/docs/templates/frontend-test-dag.generate-cases.prompt.md +1 -1
  492. package/docs/templates/frontend-test-dag.json +46 -37
  493. package/docs/templates/frontend-test-dag.retrieve-context.prompt.md +2 -2
  494. package/docs/templates/frontend-test-dag.retrospect.prompt.md +1 -1
  495. package/docs/templates/frontend-test-dag.review-cases.prompt.md +1 -1
  496. package/docs/templates/hybrid-dag.json +9 -9
  497. package/docs/templates/knowledge-sync-dag.json +8 -8
  498. package/harness.json +1 -1
  499. package/package.json +27 -8
  500. package/resource-catalog.v1.json +1981 -0
  501. package/resources/agent-bridge/loop-agent/SKILL.md +40 -0
  502. package/resources/init-history/legacy-surface.v1.json +33 -0
  503. package/skills/fe-test-ui-scout/SKILL.md +4 -4
  504. package/skills/fe-test-ui-scout/references/ledger-schema.md +1 -1
  505. package/skills/frontend-bounded-implement/references/code-standards.md +3 -3
  506. package/skills/frontend-contract/SKILL.md +2 -1
  507. package/skills/frontend-contract/references/contract-protocol.md +22 -4
  508. package/skills/frontend-design-review/SKILL.md +16 -18
  509. package/skills/frontend-design-review/references/review-checklist.md +3 -4
  510. package/skills/frontend-plan/SKILL.md +25 -3
  511. package/skills/frontend-plan/references/decision-contract.md +117 -8
  512. package/skills/frontend-plan/references/design-decisions.md +32 -0
  513. package/skills/frontend-review/SKILL.md +29 -36
  514. package/skills/frontend-review/references/review-findings.md +8 -3
  515. package/skills/frontend-scout/references/scout-evidence.md +4 -0
  516. package/skills/init-update/SKILL.md +34 -0
  517. package/skills/init-update/agents/openai.yaml +6 -0
  518. package/skills/loop-agent/references/command-reference.md +8 -0
  519. package/skills/loop-agent/references/hybrid-dag.md +1 -1
  520. package/skills/playwright-cli/SKILL.md +1 -1
  521. package/skills/playwright-cli-case-generator/SKILL.md +7 -5
  522. package/dist/commands/new-task.js +0 -5
  523. package/dist/commands/status.js +0 -57
  524. package/dist/commands/task-contract.js +0 -269
  525. package/dist/shared/prompts.js +0 -26
  526. package/dist/task/config.js +0 -2
  527. package/dist/task/contract/validate-draft.js +0 -106
  528. package/dist/task/goal.js +0 -3
  529. package/dist/task/index.js +0 -12
  530. package/dist/task/lifecycle.js +0 -1
  531. package/dist/task/operator/capabilities.js +0 -6
  532. package/dist/task/operator/envelope.js +0 -2
  533. package/dist/task/operator/index.js +0 -5
  534. package/dist/task/operator/registry.js +0 -2
  535. package/dist/task/paths.js +0 -1
  536. package/dist/task/source-state.js +0 -1
  537. package/dist/task/subagent-guidance.js +0 -1
  538. package/dist/worker/console/chat/sift-bridge.js +0 -1
  539. package/dist/worker/console/index.js +0 -20
  540. package/dist/worker/console/static/assets/channel-CXqdP5pW.js +0 -1
  541. package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-D9C3agF7.js +0 -1
  542. package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-D9C3agF7.js +0 -1
  543. package/dist/worker/console/static/assets/index-CAZ2fC_X.css +0 -1
  544. package/dist/worker/console/static/assets/index-DhfjOafu.js +0 -449
  545. package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-Tp7V0U4q.js +0 -1
  546. package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-DUZWZWi8.js +0 -8
  547. package/dist/worker/scheduler/index.js +0 -25
  548. package/dist/workflows/dag/facts.js +0 -4
  549. package/dist/workflows/dag/frontend-shadow-dual-write.js +0 -941
  550. package/dist/workflows/dag/index.js +0 -6
  551. package/dist/workflows/dynamic/index.js +0 -7
  552. /package/dist/{task/operator/types.js → executors/dag-pi/plan/session.js} +0 -0
@@ -1,4 +1,5 @@
1
1
  import path from "node:path";
2
+ import { canonicalTestArtifactRoot, } from "./test-artifact-namespace.js";
2
3
  /**
3
4
  * Frontend-test artifact layout (configurable testRoot).
4
5
  *
@@ -6,14 +7,16 @@ import path from "node:path";
6
7
  * frozen on the spec for the whole run. Writers, gates, Playwright fences
7
8
  * and TaskSpec allowedPaths all derive from this single object.
8
9
  *
9
- * Default layout keeps the historical frozen contract:
10
- * testcase/frontend/rag/**
11
- * testcase/frontend/cases/**
12
- * testcase/frontend/evidence/**
13
- * testcase/frontend/reports/**
14
- * testcase/frontend/fixtures/**
10
+ * Default layout (since 2026-09-17) lives under the shared runtime namespace:
11
+ * .harness/testcase/frontend/rag/**
12
+ * .harness/testcase/frontend/cases/**
13
+ * .harness/testcase/frontend/evidence/**
14
+ * .harness/testcase/frontend/reports/**
15
+ * .harness/testcase/frontend/fixtures/**
15
16
  */
16
- export const FRONTEND_TEST_DEFAULT_TEST_ROOT = "testcase/frontend";
17
+ export const FRONTEND_TEST_DEFAULT_TEST_ROOT = canonicalTestArtifactRoot("frontend-test");
18
+ /** Historical pre-2026-09-17 default root, kept for text rewrites only. */
19
+ export const FRONTEND_TEST_LEGACY_DEFAULT_TEST_ROOT = "testcase/frontend";
17
20
  const FORBIDDEN_TEST_ROOT_PREFIXES = [
18
21
  "src",
19
22
  "app",
@@ -59,6 +62,10 @@ function normalizeRelPosix(value, label) {
59
62
  return segments.join("/");
60
63
  }
61
64
  function assertTestRootAllowed(testRoot) {
65
+ // D3: the canonical harness test-artifact root is the ONLY hidden-root
66
+ // exception. Every other hidden or forbidden top segment stays rejected.
67
+ if (testRoot === FRONTEND_TEST_DEFAULT_TEST_ROOT)
68
+ return;
62
69
  const topSegment = testRoot.split("/")[0];
63
70
  if (FORBIDDEN_TEST_ROOT_PREFIXES.some((forbidden) => topSegment === forbidden || topSegment.startsWith(`${forbidden}.`))) {
64
71
  throw new Error(`frontendTest.testRoot must not target production/governance trees: ${testRoot}`);
@@ -67,14 +74,25 @@ function assertTestRootAllowed(testRoot) {
67
74
  throw new Error(`frontendTest.testRoot must not target hidden directories: ${testRoot}`);
68
75
  }
69
76
  }
77
+ function resolveTestRootInput(raw, canonical) {
78
+ // D3: only the EXACT canonical harness test-artifact root may be a hidden
79
+ // path. Compare after trimming + stripping trailing slashes so
80
+ // `.harness/testcase/frontend/` matches, but every other hidden spelling
81
+ // falls through to the fail-closed normalizer below.
82
+ const trimmed = raw.trim().replace(/\/+$/, "");
83
+ if (trimmed === canonical)
84
+ return canonical;
85
+ return normalizeRelPosix(raw, "testRoot");
86
+ }
70
87
  /**
71
88
  * Resolve the frozen frontend-test artifact layout from task config.
72
- * Throws on unsafe or ambiguous configuration (fail-closed).
89
+ * Roots of the form `.harness/testcase/frontend` are accepted only as the
90
+ * exact canonical default; all other hidden roots fail closed (D3).
73
91
  */
74
92
  export function resolveFrontendTestLayout(config) {
75
93
  const testRoot = config?.testRoot === undefined || config?.testRoot === null
76
94
  ? FRONTEND_TEST_DEFAULT_TEST_ROOT
77
- : normalizeRelPosix(config.testRoot, "testRoot");
95
+ : resolveTestRootInput(config.testRoot, FRONTEND_TEST_DEFAULT_TEST_ROOT);
78
96
  assertTestRootAllowed(testRoot);
79
97
  const isDefault = testRoot === FRONTEND_TEST_DEFAULT_TEST_ROOT;
80
98
  return {
@@ -98,10 +116,16 @@ export function frontendTestLayoutFromSpec(spec) {
98
116
  return resolveFrontendTestLayout({ testRoot: frozen.testRoot });
99
117
  }
100
118
  const DEFAULT_PREFIX = `${FRONTEND_TEST_DEFAULT_TEST_ROOT}/`;
119
+ const LEGACY_DEFAULT_PREFIX = `${FRONTEND_TEST_LEGACY_DEFAULT_TEST_ROOT}/`;
101
120
  /**
102
- * Longest-prefix rewrite of historical `testcase/frontend/` paths.
103
- * No-op when layout.isDefault so default DAGs stay byte-identical.
104
- * Never replaces the short token `testcase/` (would collide with backend-test).
121
+ * Longest-prefix rewrite of frontend test-root paths in template text.
122
+ *
123
+ * No-op when layout.isDefault (default DAGs stay byte-identical to their
124
+ * templates, which already use the canonical `.harness/testcase/frontend`
125
+ * root). Custom roots rewrite BOTH the canonical default prefix and the
126
+ * historical `testcase/frontend/` prefix, so legacy templates and frozen
127
+ * specs converge onto the configured root. Never replaces the short token
128
+ * `testcase/` alone (would collide with backend-test).
105
129
  */
106
130
  export function applyFrontendTestLayoutToText(text, layout) {
107
131
  if (layout.isDefault)
@@ -119,6 +143,11 @@ export function applyFrontendTestLayoutToText(text, layout) {
119
143
  i += DEFAULT_PREFIX.length;
120
144
  continue;
121
145
  }
146
+ if (text.startsWith(LEGACY_DEFAULT_PREFIX, i)) {
147
+ output += replacement;
148
+ i += LEGACY_DEFAULT_PREFIX.length;
149
+ continue;
150
+ }
122
151
  output += text[i];
123
152
  i += 1;
124
153
  }
@@ -1,3 +1,4 @@
1
+ import { sanitizeRepairAssertions } from "./frontend-repair-assertions.js";
1
2
  import { readFile } from "node:fs/promises";
2
3
  import { z } from "zod";
3
4
  import { sha256OfCanonicalJson } from "../../task/contract/hash.js";
@@ -31,18 +32,11 @@ export const TYPED_EVENT_FACT_KINDS = [
31
32
  "provider-ended-without-terminal",
32
33
  "read-only-fact-channel",
33
34
  ];
34
- /**
35
- * M2 shadow-only fact catalog (AC-001 shadow dual write). These facts are
36
- * audit-only observations derived from the authoritative text/JSON outputs of
37
- * the frontend-contract-pi / frontend-scout-pi / frontend-plan-pi nodes. They
38
- * are never branch-control signals and never participate in writer admission.
39
- *
40
- * Kept deliberately separate from `TYPED_EVENT_FACT_KINDS`: widening the shadow
41
- * catalog must never widen the provider capability matrix (which stays frozen
42
- * at its seven kinds). `target-surface` is shared by the scout and plan
43
- * origins, so the union of the two catalogs is 12 unique kinds.
44
- */
45
- export const SHADOW_FACT_KINDS = [
35
+ /** Frontend DAG decision facts. These are committed runtime facts, not a
36
+ * secondary text channel; Policy, Admission and Plan compilation read them
37
+ * directly. Kept separate from provider capability facts so the provider
38
+ * matrix remains frozen. */
39
+ export const FRONTEND_DAG_FACT_KINDS = [
46
40
  "requirement",
47
41
  "constraint",
48
42
  "open-question",
@@ -56,11 +50,26 @@ export const SHADOW_FACT_KINDS = [
56
50
  "design-deviation",
57
51
  "dependency",
58
52
  ];
53
+ /** Experimental decision Plan fact catalog. The decision tools emit semantic
54
+ * decisions (module placement, reuse, state ownership, Mock boundary, behavior
55
+ * verification focus); `data-flow` and `dependency` reuse the DAG catalog above.
56
+ * Kept as a dedicated catalog so widening the decision surface never widens the
57
+ * frozen provider / event / review / design catalogs. */
58
+ export const FRONTEND_DECISION_FACT_KINDS = [
59
+ "module-placement",
60
+ "reuse-decision",
61
+ "state-ownership",
62
+ "api-mock-boundary",
63
+ "verification-focus",
64
+ ];
65
+ /** Terminal fact for the experimental decision Plan path. Kept separate from the
66
+ * decision fact catalog so it never gets collected as a decision entry. */
67
+ export const DECISION_TERMINAL_FACT_KINDS = ["finalize_decision"];
59
68
  /**
60
69
  * M5 review terminal fact catalog (AC-001). These two committed typed tools are
61
70
  * the authoritative terminal verdict of `frontend-review-pi`. They are kept in
62
71
  * a dedicated catalog so widening the review terminal surface never widens the
63
- * frozen 7/7/12 provider/shadow/event catalogs.
72
+ * frozen provider/event catalogs.
64
73
  */
65
74
  export const REVIEW_TERMINAL_FACT_KINDS = [
66
75
  "approve_review",
@@ -72,7 +81,7 @@ export const REVIEW_TERMINAL_FACT_KINDS = [
72
81
  * `approve_design` / `request_design_changes` instead of the legacy first-line
73
82
  * `VERDICT: pass|request-revision` text protocol. Kept in a dedicated catalog
74
83
  * so widening the design terminal surface never widens the frozen provider /
75
- * shadow / event / review catalogs.
84
+ * event / review catalogs.
76
85
  */
77
86
  export const DESIGN_TERMINAL_FACT_KINDS = [
78
87
  "approve_design",
@@ -84,7 +93,7 @@ export const DESIGN_TERMINAL_FACT_KINDS = [
84
93
  * open-question/split-proposal facts plus the `contract-finalized` terminal
85
94
  * fact carrying the terminal disposition (`ready | ready-with-assumptions |
86
95
  * blocked` + optional `blockingOwner`). Kept in a dedicated catalog so
87
- * widening the contract surface never widens the frozen provider / shadow /
96
+ * widening the contract surface never widens the frozen provider /
88
97
  * event / review / design catalogs.
89
98
  */
90
99
  export const CONTRACT_FACT_KINDS = [
@@ -95,6 +104,8 @@ export const CONTRACT_FACT_KINDS = [
95
104
  "open-question",
96
105
  "split-proposal",
97
106
  "openspec-selection",
107
+ "ui-state-declaration",
108
+ "required-deliverables",
98
109
  "contract-finalized",
99
110
  ];
100
111
  export const CONTRACT_TERMINAL_FACT_KINDS = ["contract-finalized"];
@@ -124,7 +135,9 @@ export const PLAN_RECORD_FACT_KINDS = [
124
135
  "plan-requirement",
125
136
  "plan-verification-target",
126
137
  "plan-evidence-gap",
138
+ "state-registry",
127
139
  ];
140
+ export const INCREMENTAL_DETAIL_FACT_KINDS = ["mock-endpoint", "review-finding", "design-finding", "contract-scope-completed", "plan-group-coverage", "scout-scope", "review-scope-completed", "design-scope-completed"];
128
141
  /**
129
142
  * A+B (AC-009): typed issue category shared by review and design change
130
143
  * requests. The five-value enum replaces free-form issueCategory strings.
@@ -138,8 +151,8 @@ export const FRONTEND_ISSUE_CATEGORY_VALUES = [
138
151
  ];
139
152
  export const frontendIssueCategorySchema = z.enum(FRONTEND_ISSUE_CATEGORY_VALUES);
140
153
  /** Runtime control facts committed at frontend shape boundaries. Kept outside
141
- * the frozen provider/shadow catalogs so adding control authority cannot widen
142
- * either legacy capability surface. */
154
+ * the frozen provider catalog so adding control authority cannot widen that
155
+ * capability surface. */
143
156
  export const FRONTEND_SHAPE_FACT_KINDS = ["frontend-shape"];
144
157
  export const typedEventPhaseSchema = z.enum([
145
158
  "staged",
@@ -149,19 +162,22 @@ export const typedEventPhaseSchema = z.enum([
149
162
  const ALL_TYPED_EVENT_FACT_KIND_VALUES = [
150
163
  ...new Set([
151
164
  ...TYPED_EVENT_FACT_KINDS,
152
- ...SHADOW_FACT_KINDS,
165
+ ...FRONTEND_DAG_FACT_KINDS,
166
+ ...FRONTEND_DECISION_FACT_KINDS,
167
+ ...DECISION_TERMINAL_FACT_KINDS,
153
168
  ...REVIEW_TERMINAL_FACT_KINDS,
154
169
  ...DESIGN_TERMINAL_FACT_KINDS,
155
170
  ...FRONTEND_SHAPE_FACT_KINDS,
156
171
  ...CONTRACT_FACT_KINDS,
157
172
  ...PLAN_TERMINAL_FACT_KINDS,
158
173
  ...PLAN_RECORD_FACT_KINDS,
174
+ ...INCREMENTAL_DETAIL_FACT_KINDS,
159
175
  ]),
160
176
  ];
161
177
  export const typedEventFactKindSchema = z.enum(ALL_TYPED_EVENT_FACT_KIND_VALUES);
162
178
  /** A typed event fact is a `kind`-discriminated record. The schema stays
163
179
  * permissive beyond `kind` (arbitrary JSON-safe payload) so provider/model
164
- * shadow facts can carry their own fields, but `kind` is always validated. */
180
+ * provider facts can carry their own fields, but `kind` is always validated. */
165
181
  export const typedEventFactSchema = z
166
182
  .record(z.unknown())
167
183
  .superRefine((value, ctx) => {
@@ -173,8 +189,7 @@ export const typedEventFactSchema = z
173
189
  });
174
190
  }
175
191
  });
176
- /** A single review finding shared by both typed terminal verdicts. Mirrors the
177
- * legacy JSON review finding shape so typed↔JSON equivalence stays total. */
192
+ /** A single review finding shared by both typed terminal verdicts. */
178
193
  export const reviewFindingSchema = z
179
194
  .object({
180
195
  severity: z.enum(["Critical", "Important", "Minor", "Info"]),
@@ -182,11 +197,19 @@ export const reviewFindingSchema = z
182
197
  line: z.number().int().positive().optional(),
183
198
  issue: z.string().min(1),
184
199
  requiredChange: z.string().min(1).optional(),
200
+ repairAssertions: z.unknown().optional(),
201
+ repairAssertionDiagnostics: z.array(z.string()).optional(),
185
202
  })
186
- .strict();
203
+ .strict().transform(finding => {
204
+ const { repairAssertions, ...base } = finding;
205
+ if (repairAssertions === undefined)
206
+ return base;
207
+ const sanitized = sanitizeRepairAssertions(repairAssertions);
208
+ const diagnostics = [...(finding.repairAssertionDiagnostics ?? []), ...sanitized.diagnostics];
209
+ return { ...finding, repairAssertions: sanitized.assertions, ...(diagnostics.length ? { repairAssertionDiagnostics: [...new Set(diagnostics)] } : {}) };
210
+ });
187
211
  /** `approve_review` terminal fact payload. Approval may carry informational
188
- * findings (Minor/Info) but never Critical/Important — the same rule the legacy
189
- * JSON verdict applies to `verdict: "pass"`. */
212
+ * findings (Minor/Info) but never Critical/Important. */
190
213
  export const approveReviewFactSchema = z
191
214
  .object({
192
215
  kind: z.literal("approve_review"),
@@ -216,8 +239,7 @@ export const requestReviewChangesFactSchema = z
216
239
  })
217
240
  .strict();
218
241
  /** `approve_design` terminal fact payload. Approval may carry informational
219
- * findings (Minor/Info) but never Critical/Important — the same rule the legacy
220
- * text protocol applies to `VERDICT: pass`. */
242
+ * findings (Minor/Info) but never Critical/Important. */
221
243
  export const approveDesignFactSchema = z
222
244
  .object({
223
245
  kind: z.literal("approve_design"),
@@ -258,6 +280,15 @@ export const typedEventRecordSchema = z
258
280
  revision: z.number().int().nonnegative(),
259
281
  recordedAt: z.string().min(1),
260
282
  quarantineReason: z.string().min(1).optional(),
283
+ submission: z.object({
284
+ version: z.literal(1),
285
+ bindingSha256: z.string().regex(/^[a-f0-9]{64}$/),
286
+ tool: z.string(),
287
+ callId: z.string(),
288
+ identity: z.string(),
289
+ paramsSha256: z.string().regex(/^[a-f0-9]{64}$/),
290
+ receipt: z.record(z.unknown()).optional(),
291
+ }).strict().optional(),
261
292
  })
262
293
  .strict()
263
294
  .superRefine((value, ctx) => {
@@ -152,6 +152,7 @@ export function extractFrontendTestTitles(content) {
152
152
  const tokens = lexFrontendTestSource(content);
153
153
  const titles = [];
154
154
  const configurationModifiers = new Set(["each", "runIf", "skipIf"]);
155
+ const nonExecutingModifiers = new Set(["skip", "todo", "fails"]);
155
156
  function closingParenIndex(openIndex) {
156
157
  let depth = 0;
157
158
  for (let cursor = openIndex; cursor < tokens.length; cursor += 1) {
@@ -169,6 +170,8 @@ export function extractFrontendTestTitles(content) {
169
170
  }
170
171
  for (let index = 0; index < tokens.length; index += 1) {
171
172
  const token = tokens[index];
173
+ if (token === undefined)
174
+ continue;
172
175
  if (token?.type !== "identifier" ||
173
176
  !["describe", "it", "test"].includes(token.value) ||
174
177
  (tokens[index - 1]?.type === "punctuation" &&
@@ -177,12 +180,22 @@ export function extractFrontendTestTitles(content) {
177
180
  }
178
181
  let cursor = index + 1;
179
182
  let hasConfigurationModifier = false;
183
+ let hasNonExecutingModifier = false;
184
+ let conditionalModifier;
180
185
  while (tokens[cursor]?.type === "punctuation" &&
181
186
  tokens[cursor]?.value === "." &&
182
187
  tokens[cursor + 1]?.type === "identifier") {
183
- if (tokens[cursor + 1]?.type === "identifier" &&
184
- configurationModifiers.has(tokens[cursor + 1].value)) {
188
+ const modifier = tokens[cursor + 1];
189
+ if (modifier === undefined)
190
+ break;
191
+ if (configurationModifiers.has(modifier.value)) {
185
192
  hasConfigurationModifier = true;
193
+ if (["runIf", "skipIf"].includes(modifier.value)) {
194
+ conditionalModifier = modifier.value;
195
+ }
196
+ }
197
+ if (nonExecutingModifiers.has(modifier.value)) {
198
+ hasNonExecutingModifier = true;
186
199
  }
187
200
  cursor += 2;
188
201
  }
@@ -191,6 +204,13 @@ export function extractFrontendTestTitles(content) {
191
204
  continue;
192
205
  }
193
206
  if (hasConfigurationModifier) {
207
+ if (conditionalModifier && tokens[cursor + 1]?.type === "identifier" &&
208
+ tokens[cursor + 2]?.value === ")") {
209
+ const condition = tokens[cursor + 1].value;
210
+ if ((conditionalModifier === "runIf" && condition === "false") ||
211
+ (conditionalModifier === "skipIf" && condition === "true"))
212
+ hasNonExecutingModifier = true;
213
+ }
194
214
  const close = closingParenIndex(cursor);
195
215
  if (close === null ||
196
216
  tokens[close + 1]?.type !== "punctuation" ||
@@ -199,54 +219,28 @@ export function extractFrontendTestTitles(content) {
199
219
  }
200
220
  cursor = close + 1;
201
221
  }
202
- if (tokens[cursor + 1]?.type !== "string")
222
+ if (hasNonExecutingModifier) {
223
+ // A skipped suite also skips every nested test title in its body.
224
+ index = closingParenIndex(cursor) ?? tokens.length;
203
225
  continue;
204
- titles.push(tokens[cursor + 1].value);
226
+ }
227
+ const titleToken = tokens[cursor + 1];
228
+ if (titleToken?.type !== "string")
229
+ continue;
230
+ titles.push(titleToken.value);
205
231
  }
206
232
  return titles;
207
233
  }
208
- function traceKeyMatchesTitle(traceKey, title) {
209
- const escaped = traceKey.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
210
- return new RegExp(`(?:^|[^A-Za-z0-9_-])${escaped}(?:$|[^A-Za-z0-9_-])`).test(title);
211
- }
212
- function formatObservedTestTitles(titles) {
213
- if (titles.length === 0)
214
- return "(none)";
215
- const limit = 8;
216
- const preview = titles
217
- .slice(0, limit)
218
- .map((title) => title.length > 120 ? `${title.slice(0, 117)}...` : title)
219
- .join(" | ");
220
- return titles.length > limit
221
- ? `${preview} | ... (${titles.length - limit} more)`
222
- : preview;
223
- }
224
234
  async function evaluateTargetFileTrace(input) {
225
235
  const fileIssues = await assertFileAndSymbol({
226
236
  workspaceRoot: input.workspaceRoot,
227
237
  file: input.target.file,
228
238
  });
229
- if (fileIssues.length || input.target.mode === "static") {
230
- return { issues: fileIssues };
231
- }
232
- const absolute = path.resolve(input.workspaceRoot, input.target.file);
233
- const content = await readFile(absolute, "utf8");
234
- const observedTestTitles = extractFrontendTestTitles(content);
235
- if (observedTestTitles.some((title) => traceKeyMatchesTitle(input.target.id, title))) {
236
- return { issues: [], observedTestTitles };
237
- }
238
- const observed = formatObservedTestTitles(observedTestTitles);
239
- return {
240
- issues: [
241
- `trace key not found in test title: ${input.target.id} in ${input.target.file}; observed test titles: ${observed}`,
242
- ],
243
- observedTestTitles,
244
- };
239
+ return { issues: fileIssues };
245
240
  }
246
241
  /**
247
- * Lightweight writer-boundary check. It validates file existence and stable
248
- * behavior trace tokens only; frozen commands remain the final trace gate's
249
- * responsibility after command execution.
242
+ * Lightweight writer-boundary check. It validates declared file existence;
243
+ * frozen commands remain the final trace gate's responsibility after execution.
250
244
  */
251
245
  export async function evaluateFrontendWriterTracePreflight(input) {
252
246
  const targets = [];
@@ -265,8 +259,11 @@ export async function evaluateFrontendWriterTracePreflight(input) {
265
259
  commandLabel: target.commandLabel,
266
260
  file: target.file,
267
261
  ...(target.symbol ? { symbol: target.symbol } : {}),
268
- ...(target.mode !== "static" ? { traceKey: target.id } : {}),
269
262
  status: fileTrace.issues.length ? "failed" : "ok",
263
+ evidence: fileTrace.issues.length ? "unavailable" : "file-exists",
264
+ plannedEvidenceLevel: target.evidenceLevel ?? "unknown",
265
+ ...(target.boundary ? { boundary: target.boundary } : {}),
266
+ behaviorCoverage: "unconfirmed",
270
267
  matchedNodeIds: [],
271
268
  issues: fileTrace.issues,
272
269
  });
@@ -276,8 +273,8 @@ export async function evaluateFrontendWriterTracePreflight(input) {
276
273
  /**
277
274
  * Pure verification-target evaluation shared by the trace gate and the repair
278
275
  * assess gate. It derives, for each contract verification target, whether the
279
- * target bound to frozen evidence (commandLabel owners), and whether the file
280
- * and stable behavior-target id exist in a real test title. It performs no
276
+ * target bound to frozen evidence (commandLabel owners), whether its file exists,
277
+ * and whether the declared test file was exercised by the observed runner. It performs no
281
278
  * writes and throws nothing: failures are returned as `hardIssues` plus
282
279
  * per-target `status`.
283
280
  */
@@ -302,6 +299,18 @@ export async function evaluateVerificationTargets(input) {
302
299
  target,
303
300
  });
304
301
  issues.push(...fileTrace.issues);
302
+ const executed = input.executedTests?.get(target.commandLabel);
303
+ if (target.mode !== "static" && executed === undefined) {
304
+ issues.push(`test execution report unavailable for behavior target: ${target.id}`);
305
+ }
306
+ else if (target.mode !== "static" && executed !== undefined) {
307
+ // safePath permits "./" prefixes; reporter files are cwd-relative.
308
+ const targetFile = path.posix.normalize(target.file.replace(/\\/g, "/"));
309
+ const matching = executed.filter((test) => test.file === targetFile);
310
+ if (matching.length === 0 || matching.some((test) => test.status !== "passed")) {
311
+ issues.push(`behavior target was not fully executed and passed: ${target.id} in ${target.file}`);
312
+ }
313
+ }
305
314
  const status = issues.length ? "failed" : "ok";
306
315
  if (issues.length)
307
316
  hardIssues.push(...issues.map((i) => `${target.id}: ${i}`));
@@ -311,8 +320,13 @@ export async function evaluateVerificationTargets(input) {
311
320
  commandLabel: target.commandLabel,
312
321
  file: target.file,
313
322
  symbol: target.symbol,
314
- ...(target.mode !== "static" ? { traceKey: target.id } : {}),
315
323
  status,
324
+ evidence: issues.length
325
+ ? "unavailable"
326
+ : target.mode === "static" ? "command-execution" : "test-file-execution",
327
+ plannedEvidenceLevel: target.evidenceLevel ?? "unknown",
328
+ ...(target.boundary ? { boundary: target.boundary } : {}),
329
+ behaviorCoverage: "unconfirmed",
316
330
  matchedNodeIds: owners ?? [],
317
331
  issues,
318
332
  });
@@ -322,16 +336,16 @@ export async function evaluateVerificationTargets(input) {
322
336
  /**
323
337
  * Legacy deterministic symbol resolvability check retained by canonical
324
338
  * normalization (`dropUnresolvedVerificationSymbols`). New plan tools do not
325
- * expose symbol and runtime trace binding uses the stable target id. This
339
+ * expose symbol and runtime trace binding uses the command and test file. This
326
340
  * helper still handles old `all describe blocks`, `describe('title')`, and
327
341
  * slash-delimited labels so existing run artifacts normalize consistently.
328
342
  */
329
343
  export function verificationSymbolMatchesContent(symbol, content) {
330
344
  if (symbol.trim().toLowerCase() === "all describe blocks")
331
345
  return content.includes("describe(");
346
+ const separatorHead = symbol.split(/[((]/, 1)[0];
332
347
  const symbols = symbol.includes(" / ")
333
- ? symbol
334
- .split(/[((]/, 1)[0]
348
+ ? (separatorHead ?? symbol)
335
349
  .split("/")
336
350
  .map((item) => item.trim())
337
351
  .filter(Boolean)
@@ -431,7 +445,7 @@ export async function runFrontendVerificationTraceGate(input) {
431
445
  const mockCommandLabels = input.evidence?.mock?.commandLabels ?? [];
432
446
  const mockCommandNodeId = input.evidence?.mock?.nodeId;
433
447
  const mockCommandTexts = input.evidence?.mock?.commandTexts ?? [];
434
- if (input.evidence && contract.mockApi.strategy !== "not-needed" && mockCommandLabels.length === 0) {
448
+ if (input.evidence && contract.verificationTargets.some((target) => target.mode === "behavior") && contract.mockApi.strategy !== "not-needed" && mockCommandLabels.length === 0) {
435
449
  throw new Error("trace: selected Mock strategy requires successful Mock verification commands");
436
450
  }
437
451
  if (input.evidence) {
@@ -473,6 +487,7 @@ export async function runFrontendVerificationTraceGate(input) {
473
487
  contract,
474
488
  labelOwners,
475
489
  workspaceRoot: input.workspaceRoot,
490
+ executedTests: input.evidence?.behavior.executedTests,
476
491
  });
477
492
  if (hardIssues.length) {
478
493
  throw new Error(`trace: ${hardIssues.join("; ")}`);
@@ -483,6 +498,7 @@ export async function runFrontendVerificationTraceGate(input) {
483
498
  contractSchemaId: FRONTEND_IMPLEMENTATION_CONTRACT_SCHEMA_ID,
484
499
  browserStatus: "not-run",
485
500
  visualStatus: "not-run",
501
+ testExecutionEvidence: input.evidence?.behavior.testExecutionEvidence ?? [],
486
502
  targets,
487
503
  mockStrategy: contract.mockApi.strategy,
488
504
  mockCommandLabels,
@@ -504,6 +520,7 @@ export async function runFrontendVerificationTraceGate(input) {
504
520
  mockCommandNodeId: result.mockCommandNodeId,
505
521
  mockCommandTexts: result.mockCommandTexts,
506
522
  targets: result.targets,
523
+ testExecutionEvidence: result.testExecutionEvidence,
507
524
  }, null, 2)}\n`, "utf8");
508
525
  result.artifactPath = artifactPath;
509
526
  }
@@ -518,7 +535,7 @@ export function formatFrontendVerificationTraceStdout(result) {
518
535
  `Browser: ${result.browserStatus}`,
519
536
  `Visual: ${result.visualStatus}`,
520
537
  `Targets: ${result.targets.length}`,
521
- ...result.targets.map((target) => `- ${target.id}: ${target.status} label=${JSON.stringify(target.commandLabel)} file=${target.file}`),
538
+ ...result.targets.map((target) => `- ${target.id}: execution=${target.status} evidence=${target.evidence} behavior-coverage=${target.behaviorCoverage} label=${JSON.stringify(target.commandLabel)} file=${target.file}`),
522
539
  ];
523
540
  if (result.artifactPath) {
524
541
  lines.push(`Artifact: ${result.artifactPath}`);
@@ -22,9 +22,8 @@ export const frontendWriterAdmissionClassificationSchema = z.enum([
22
22
  "requires-human-approval",
23
23
  "blocked",
24
24
  "stale",
25
- // Legacy artifacts remain parseable for diagnostics, but `admitted` is never
26
- // accepted by the runtime authorization gate. Canonical producers always
27
- // emit one of the four values above.
25
+ // `admitted` is retained only as an invalidated input value; the runtime
26
+ // authorization gate accepts only the four canonical classifications above.
28
27
  "admitted",
29
28
  ]);
30
29
  /** A+B (AC-006): Micro topology uses `requirement-to-target-and-evidence`
@@ -50,6 +49,7 @@ export const frontendAdmissionCoverageSchema = z.discriminatedUnion("coverageId"
50
49
  ]);
51
50
  /** Failure-source values shared with frontend recovery planning (M8). */
52
51
  export const frontendAdmissionFailureSourceSchema = z.enum([
52
+ "frontend-contract-pi",
53
53
  "frontend-plan-pi",
54
54
  "frontend-design-policy-shell",
55
55
  "frontend-writer-admission-shell",
@@ -59,8 +59,7 @@ export const frontendAdmissionFailureSourceSchema = z.enum([
59
59
  /**
60
60
  * Deterministic artifact schema for `contracts/frontend-writer-admission-result.json`.
61
61
  * Scheduler admission gate and frontend recovery planning read this artifact
62
- * (fail-closed); it replaces the legacy frontend-prewrite-result-v1 as the
63
- * write authorization source.
62
+ * (fail-closed); it is the write authorization source for new runs.
64
63
  */
65
64
  export const frontendWriterAdmissionResultV1Schema = z
66
65
  .object({
@@ -164,7 +163,7 @@ export function deriveWriteSet(contract, options) {
164
163
  const candidates = [
165
164
  ...contract.targets.files,
166
165
  ...contract.verificationTargets
167
- .filter((target) => target.mode !== "static")
166
+ .filter((target) => target.mode !== "static" && !options?.existingVerificationPaths?.includes(target.file))
168
167
  .map((target) => target.file),
169
168
  ];
170
169
  // Expand glob entries (e.g. `src/**` inherited from the skeleton) against
@@ -250,6 +249,7 @@ export function deriveFrontendWriterAdmissionShell(input) {
250
249
  }
251
250
  const derived = deriveWriteSet(input.contract, {
252
251
  workspaceFiles: input.workspaceFiles,
252
+ existingVerificationPaths: input.existingVerificationPaths,
253
253
  });
254
254
  findings.push(...derived.findings);
255
255
  const baseline = freezeBaseline(input.baseline);
@@ -275,45 +275,3 @@ export function deriveFrontendWriterAdmissionShell(input) {
275
275
  };
276
276
  return result;
277
277
  }
278
- function normalizeNewVerdict(classification) {
279
- return classification === "accepted" ||
280
- classification === "requires-human-approval" ||
281
- classification === "admitted"
282
- ? "accepted"
283
- : "blocked";
284
- }
285
- function normalizeLegacyVerdict(classification) {
286
- return classification === "accepted" || classification === "accepted-normalized"
287
- ? "accepted"
288
- : "blocked";
289
- }
290
- export function compareAdmissionToLegacyGate(input) {
291
- const newVerdict = normalizeNewVerdict(input.newClassification);
292
- const legacyVerdict = normalizeLegacyVerdict(input.legacyClassification);
293
- return {
294
- newClassification: input.newClassification,
295
- legacyClassification: input.legacyClassification,
296
- newVerdict,
297
- legacyVerdict,
298
- match: newVerdict === legacyVerdict,
299
- };
300
- }
301
- /** Render a stable, deterministically ordered mismatch list for the evaluation
302
- * set. Input order is irrelevant: rows are sorted by a canonical key. */
303
- export function renderAdmissionShadowDiff(results) {
304
- const indexed = results.map((result, index) => ({ ...result, index }));
305
- const sorted = indexed.sort((a, b) => {
306
- const keyA = `${a.legacyClassification}|${a.newClassification}`;
307
- const keyB = `${b.legacyClassification}|${b.newClassification}`;
308
- if (keyA !== keyB)
309
- return keyA < keyB ? -1 : 1;
310
- return a.index - b.index;
311
- });
312
- const mismatches = sorted.filter((row) => !row.match);
313
- const lines = [
314
- "## Admission Shadow Diff",
315
- `${sorted.length} comparisons, ${mismatches.length} mismatches`,
316
- ...sorted.map((row) => `- ${row.legacyClassification} -> ${row.newClassification}: legacy=${row.legacyVerdict} new=${row.newVerdict}${row.match ? " match" : " MISMATCH"}`),
317
- ];
318
- return lines.join("\n");
319
- }
@@ -161,26 +161,6 @@ export function buildFrontendMicroLoopCheckpoint(input) {
161
161
  writeAttempts: input.facts.writeAttempts,
162
162
  };
163
163
  }
164
- /**
165
- * Shadow comparison between the fact-derived status and the legacy
166
- * `IMPLEMENTATION_OUTCOME:` first-line parse. Never used to decide ok/fail —
167
- * only persisted for the M4 shadow evaluation.
168
- */
169
- export function compareFactStatusToLegacyOutcome(factStatus, legacyOutcome) {
170
- const factVerdict = factStatus === "changed" || factStatus === "already-satisfied"
171
- ? "ok"
172
- : "fail";
173
- const legacyVerdict = legacyOutcome === "changed" || legacyOutcome === "already-satisfied"
174
- ? "ok"
175
- : "fail";
176
- return {
177
- factStatus,
178
- legacyOutcome,
179
- factVerdict,
180
- legacyVerdict,
181
- match: factVerdict === legacyVerdict,
182
- };
183
- }
184
164
  /**
185
165
  * Pure session-event scanner: count write-tool events from the persisted
186
166
  * session-events.jsonl content. Fail-closed: an unparseable line never counts
@@ -249,8 +229,5 @@ export async function collectFrontendWriterFacts(input) {
249
229
  wallTimeMs: input.wallTimeMs ?? 0,
250
230
  rounds: input.rounds ?? 1,
251
231
  writeAttempts: input.writeAttempts ?? 1,
252
- ...(input.firstLineText !== undefined
253
- ? { firstLineText: input.firstLineText }
254
- : {}),
255
232
  };
256
233
  }