@wildo-ai/dev-companion 1.1.8 → 1.1.9

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 (325) hide show
  1. package/bin/companion-supervisor.d.mts +33 -0
  2. package/bin/companion-supervisor.mjs +174 -0
  3. package/bin/wildo-dev-companion-supervised.mjs +16 -0
  4. package/dist/esm/brand/models/logo-generation.actors-system.definitions.d.ts.map +1 -1
  5. package/dist/esm/brand/models/logo-generation.actors-system.definitions.js +8 -2
  6. package/dist/esm/brand/models/logo-generation.actors-system.definitions.js.map +1 -1
  7. package/dist/esm/brand/models/logo-judge.actors-system.definitions.d.ts.map +1 -1
  8. package/dist/esm/brand/models/logo-judge.actors-system.definitions.js +8 -2
  9. package/dist/esm/brand/models/logo-judge.actors-system.definitions.js.map +1 -1
  10. package/dist/esm/brand/services/brand-accept.companion.service.d.ts +1 -1
  11. package/dist/esm/brand/services/brand-accept.companion.service.d.ts.map +1 -1
  12. package/dist/esm/brand/services/brand-accept.companion.service.js +9 -11
  13. package/dist/esm/brand/services/brand-accept.companion.service.js.map +1 -1
  14. package/dist/esm/claude-cli/models/application-coding-run-checkpoint.models.d.ts +21 -0
  15. package/dist/esm/claude-cli/models/application-coding-run-checkpoint.models.d.ts.map +1 -1
  16. package/dist/esm/claude-cli/models/application-coding-run-checkpoint.models.js +33 -1
  17. package/dist/esm/claude-cli/models/application-coding-run-checkpoint.models.js.map +1 -1
  18. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +41 -2
  19. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts.map +1 -1
  20. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js +43 -1
  21. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
  22. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts +57 -1
  23. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts.map +1 -1
  24. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +75 -1
  25. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js.map +1 -1
  26. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +90 -5
  27. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
  28. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +242 -22
  29. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
  30. package/dist/esm/companion-api/companion-api.schemas.d.ts +23 -2
  31. package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
  32. package/dist/esm/companion-api/companion-api.schemas.js +13 -2
  33. package/dist/esm/companion-api/companion-api.schemas.js.map +1 -1
  34. package/dist/esm/companion-api/controllers/companion.controller.d.ts +63 -7
  35. package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
  36. package/dist/esm/companion-api/controllers/companion.controller.js +315 -39
  37. package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
  38. package/dist/esm/core/config/primary-language.companion.utils.d.ts +5 -4
  39. package/dist/esm/core/config/primary-language.companion.utils.d.ts.map +1 -1
  40. package/dist/esm/core/config/primary-language.companion.utils.js +5 -4
  41. package/dist/esm/core/config/primary-language.companion.utils.js.map +1 -1
  42. package/dist/esm/core/context/application-module-generations.companion.d.ts +103 -0
  43. package/dist/esm/core/context/application-module-generations.companion.d.ts.map +1 -0
  44. package/dist/esm/core/context/application-module-generations.companion.js +313 -0
  45. package/dist/esm/core/context/application-module-generations.companion.js.map +1 -0
  46. package/dist/esm/core/context/companion-package-loaders.companion.d.ts +19 -19
  47. package/dist/esm/core/context/companion-package-loaders.companion.d.ts.map +1 -1
  48. package/dist/esm/core/context/companion-package-loaders.companion.js +52 -40
  49. package/dist/esm/core/context/companion-package-loaders.companion.js.map +1 -1
  50. package/dist/esm/core/inject/models/container.d.ts.map +1 -1
  51. package/dist/esm/core/inject/models/container.js +4 -0
  52. package/dist/esm/core/inject/models/container.js.map +1 -1
  53. package/dist/esm/core/inject/models/service-types.d.ts +4 -0
  54. package/dist/esm/core/inject/models/service-types.d.ts.map +1 -1
  55. package/dist/esm/core/inject/models/service-types.js +4 -0
  56. package/dist/esm/core/inject/models/service-types.js.map +1 -1
  57. package/dist/esm/core/introspection/resources/creation-console-answer.companion.d.ts +15 -1
  58. package/dist/esm/core/introspection/resources/creation-console-answer.companion.d.ts.map +1 -1
  59. package/dist/esm/core/introspection/resources/creation-console-answer.companion.js +38 -3
  60. package/dist/esm/core/introspection/resources/creation-console-answer.companion.js.map +1 -1
  61. package/dist/esm/core/introspection/resources/creation-console-projection.companion.d.ts +21 -0
  62. package/dist/esm/core/introspection/resources/creation-console-projection.companion.d.ts.map +1 -1
  63. package/dist/esm/core/introspection/resources/creation-console-projection.companion.js +64 -25
  64. package/dist/esm/core/introspection/resources/creation-console-projection.companion.js.map +1 -1
  65. package/dist/esm/core/introspection/resources/creation-home-projection.companion.d.ts.map +1 -1
  66. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js +2 -0
  67. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js.map +1 -1
  68. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts +0 -28
  69. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts.map +1 -1
  70. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js +192 -19
  71. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js.map +1 -1
  72. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -1
  73. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +27 -5
  74. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -1
  75. package/dist/esm/core/introspection/resources/launch-blockers.companion.d.ts +47 -0
  76. package/dist/esm/core/introspection/resources/launch-blockers.companion.d.ts.map +1 -0
  77. package/dist/esm/core/introspection/resources/launch-blockers.companion.js +98 -0
  78. package/dist/esm/core/introspection/resources/launch-blockers.companion.js.map +1 -0
  79. package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts +6 -1
  80. package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts.map +1 -1
  81. package/dist/esm/core/introspection/services/companion-introspection.companion.service.js +20 -1
  82. package/dist/esm/core/introspection/services/companion-introspection.companion.service.js.map +1 -1
  83. package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.d.ts +34 -8
  84. package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.d.ts.map +1 -1
  85. package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.js +61 -12
  86. package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.js.map +1 -1
  87. package/dist/esm/core/introspection/services/introspection-input-closure.companion.d.ts +44 -0
  88. package/dist/esm/core/introspection/services/introspection-input-closure.companion.d.ts.map +1 -0
  89. package/dist/esm/core/introspection/services/introspection-input-closure.companion.js +104 -0
  90. package/dist/esm/core/introspection/services/introspection-input-closure.companion.js.map +1 -0
  91. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts +41 -22
  92. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts.map +1 -1
  93. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js +64 -47
  94. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js.map +1 -1
  95. package/dist/esm/core/introspection/subprocess/expert-persona-brief.renderer.d.ts +7 -1
  96. package/dist/esm/core/introspection/subprocess/expert-persona-brief.renderer.d.ts.map +1 -1
  97. package/dist/esm/core/introspection/subprocess/expert-persona-brief.renderer.js +13 -4
  98. package/dist/esm/core/introspection/subprocess/expert-persona-brief.renderer.js.map +1 -1
  99. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts.map +1 -1
  100. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js +7 -0
  101. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js.map +1 -1
  102. package/dist/esm/core/lock/wildo-saas-lock.schemas.d.ts +4 -4
  103. package/dist/esm/core/runtime/companion-env-file.d.ts +39 -9
  104. package/dist/esm/core/runtime/companion-env-file.d.ts.map +1 -1
  105. package/dist/esm/core/runtime/companion-env-file.js +75 -16
  106. package/dist/esm/core/runtime/companion-env-file.js.map +1 -1
  107. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts +7 -3
  108. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
  109. package/dist/esm/core/runtime/services/start-companion-application.service.js +29 -11
  110. package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
  111. package/dist/esm/core/utils/bounded-concurrency.utils.d.ts +17 -0
  112. package/dist/esm/core/utils/bounded-concurrency.utils.d.ts.map +1 -0
  113. package/dist/esm/core/utils/bounded-concurrency.utils.js +37 -0
  114. package/dist/esm/core/utils/bounded-concurrency.utils.js.map +1 -0
  115. package/dist/esm/core/utils/derived-input-signature.companion.utils.d.ts +10 -1
  116. package/dist/esm/core/utils/derived-input-signature.companion.utils.d.ts.map +1 -1
  117. package/dist/esm/core/utils/derived-input-signature.companion.utils.js +9 -2
  118. package/dist/esm/core/utils/derived-input-signature.companion.utils.js.map +1 -1
  119. package/dist/esm/creation-conversation/creation-conversation.actors-system.definitions.d.ts.map +1 -1
  120. package/dist/esm/creation-conversation/creation-conversation.actors-system.definitions.js +2 -0
  121. package/dist/esm/creation-conversation/creation-conversation.actors-system.definitions.js.map +1 -1
  122. package/dist/esm/creation-conversation/creation-conversation.function-tools.d.ts.map +1 -1
  123. package/dist/esm/creation-conversation/creation-conversation.function-tools.js +66 -6
  124. package/dist/esm/creation-conversation/creation-conversation.function-tools.js.map +1 -1
  125. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.d.ts +0 -17
  126. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.d.ts.map +1 -1
  127. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.js +10 -4
  128. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.js.map +1 -1
  129. package/dist/esm/email/services/email-template.companion.service.d.ts +6 -1
  130. package/dist/esm/email/services/email-template.companion.service.d.ts.map +1 -1
  131. package/dist/esm/email/services/email-template.companion.service.js +4 -1
  132. package/dist/esm/email/services/email-template.companion.service.js.map +1 -1
  133. package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.d.ts.map +1 -1
  134. package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.js +8 -2
  135. package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.js.map +1 -1
  136. package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.d.ts.map +1 -1
  137. package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.js +8 -2
  138. package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.js.map +1 -1
  139. package/dist/esm/expert-personas/services/expert-persona.companion.service.d.ts.map +1 -1
  140. package/dist/esm/expert-personas/services/expert-persona.companion.service.js +7 -7
  141. package/dist/esm/expert-personas/services/expert-persona.companion.service.js.map +1 -1
  142. package/dist/esm/i18n/composite_views/app.creation-conversation.en.d.ts.map +1 -1
  143. package/dist/esm/i18n/composite_views/app.creation-conversation.en.js +41 -1
  144. package/dist/esm/i18n/composite_views/app.creation-conversation.en.js.map +1 -1
  145. package/dist/esm/i18n/resources/workbenchAspects.en.d.ts.map +1 -1
  146. package/dist/esm/i18n/resources/workbenchAspects.en.js +7 -0
  147. package/dist/esm/i18n/resources/workbenchAspects.en.js.map +1 -1
  148. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.en.d.ts +5 -0
  149. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.en.d.ts.map +1 -1
  150. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.en.js +5 -0
  151. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.en.js.map +1 -1
  152. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts +1 -1
  153. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts.map +1 -1
  154. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js +2 -1
  155. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js.map +1 -1
  156. package/dist/esm/i18n/resources/workbenchDossierEntries.en.d.ts +46 -0
  157. package/dist/esm/i18n/resources/workbenchDossierEntries.en.d.ts.map +1 -1
  158. package/dist/esm/i18n/resources/workbenchDossierEntries.en.js +12 -0
  159. package/dist/esm/i18n/resources/workbenchDossierEntries.en.js.map +1 -1
  160. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +266 -0
  161. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
  162. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +91 -5
  163. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -1
  164. package/dist/esm/i18n/system_enums/application-creation.en.d.ts +41 -0
  165. package/dist/esm/i18n/system_enums/application-creation.en.d.ts.map +1 -1
  166. package/dist/esm/i18n/system_enums/application-creation.en.js +45 -1
  167. package/dist/esm/i18n/system_enums/application-creation.en.js.map +1 -1
  168. package/dist/esm/i18n/system_enums/localization.en.d.ts +82 -0
  169. package/dist/esm/i18n/system_enums/localization.en.d.ts.map +1 -0
  170. package/dist/esm/i18n/system_enums/localization.en.js +82 -0
  171. package/dist/esm/i18n/system_enums/localization.en.js.map +1 -0
  172. package/dist/esm/i18n/system_enums/risk-register.en.d.ts +1 -0
  173. package/dist/esm/i18n/system_enums/risk-register.en.d.ts.map +1 -1
  174. package/dist/esm/i18n/system_enums/risk-register.en.js +1 -0
  175. package/dist/esm/i18n/system_enums/risk-register.en.js.map +1 -1
  176. package/dist/esm/i18n/system_enums/workbench-dossier.en.d.ts +10 -0
  177. package/dist/esm/i18n/system_enums/workbench-dossier.en.d.ts.map +1 -1
  178. package/dist/esm/i18n/system_enums/workbench-dossier.en.js +13 -0
  179. package/dist/esm/i18n/system_enums/workbench-dossier.en.js.map +1 -1
  180. package/dist/esm/i18n-labelling/models/labelling-progress.models.d.ts +43 -0
  181. package/dist/esm/i18n-labelling/models/labelling-progress.models.d.ts.map +1 -0
  182. package/dist/esm/i18n-labelling/models/labelling-progress.models.js +34 -0
  183. package/dist/esm/i18n-labelling/models/labelling-progress.models.js.map +1 -0
  184. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.d.ts +8 -0
  185. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.d.ts.map +1 -1
  186. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.js +97 -56
  187. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.js.map +1 -1
  188. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.d.ts +18 -0
  189. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.d.ts.map +1 -1
  190. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.js +269 -153
  191. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.js.map +1 -1
  192. package/dist/esm/i18n-labelling/utils/labelling-concurrency.utils.d.ts +41 -0
  193. package/dist/esm/i18n-labelling/utils/labelling-concurrency.utils.d.ts.map +1 -0
  194. package/dist/esm/i18n-labelling/utils/labelling-concurrency.utils.js +47 -0
  195. package/dist/esm/i18n-labelling/utils/labelling-concurrency.utils.js.map +1 -0
  196. package/dist/esm/i18n-labelling/utils/per-unit-file.utils.d.ts +12 -0
  197. package/dist/esm/i18n-labelling/utils/per-unit-file.utils.d.ts.map +1 -1
  198. package/dist/esm/i18n-labelling/utils/per-unit-file.utils.js +10 -2
  199. package/dist/esm/i18n-labelling/utils/per-unit-file.utils.js.map +1 -1
  200. package/dist/esm/i18n-labelling/utils/staged-label-file-writer.utils.d.ts +89 -0
  201. package/dist/esm/i18n-labelling/utils/staged-label-file-writer.utils.d.ts.map +1 -0
  202. package/dist/esm/i18n-labelling/utils/staged-label-file-writer.utils.js +229 -0
  203. package/dist/esm/i18n-labelling/utils/staged-label-file-writer.utils.js.map +1 -0
  204. package/dist/esm/meta-workflows/models/build-task-rearm.models.d.ts +67 -1
  205. package/dist/esm/meta-workflows/models/build-task-rearm.models.d.ts.map +1 -1
  206. package/dist/esm/meta-workflows/models/build-task-rearm.models.js +64 -0
  207. package/dist/esm/meta-workflows/models/build-task-rearm.models.js.map +1 -1
  208. package/dist/esm/meta-workflows/models/creation-intervention.models.d.ts +308 -0
  209. package/dist/esm/meta-workflows/models/creation-intervention.models.d.ts.map +1 -0
  210. package/dist/esm/meta-workflows/models/creation-intervention.models.js +365 -0
  211. package/dist/esm/meta-workflows/models/creation-intervention.models.js.map +1 -0
  212. package/dist/esm/meta-workflows/models/generation-step-progress.models.d.ts +61 -0
  213. package/dist/esm/meta-workflows/models/generation-step-progress.models.d.ts.map +1 -0
  214. package/dist/esm/meta-workflows/models/generation-step-progress.models.js +58 -0
  215. package/dist/esm/meta-workflows/models/generation-step-progress.models.js.map +1 -0
  216. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.d.ts +10 -6
  217. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.d.ts.map +1 -1
  218. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.js +11 -6
  219. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.js.map +1 -1
  220. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.d.ts +3 -0
  221. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.d.ts.map +1 -1
  222. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.js +8 -1
  223. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.js.map +1 -1
  224. package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts +26 -0
  225. package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts.map +1 -1
  226. package/dist/esm/meta-workflows/models/playbook-run-record.models.js +66 -10
  227. package/dist/esm/meta-workflows/models/playbook-run-record.models.js.map +1 -1
  228. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.d.ts +13 -0
  229. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.d.ts.map +1 -0
  230. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.js +33 -0
  231. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.js.map +1 -0
  232. package/dist/esm/meta-workflows/services/application-assembly-repair.companion.utils.d.ts +145 -0
  233. package/dist/esm/meta-workflows/services/application-assembly-repair.companion.utils.d.ts.map +1 -0
  234. package/dist/esm/meta-workflows/services/application-assembly-repair.companion.utils.js +179 -0
  235. package/dist/esm/meta-workflows/services/application-assembly-repair.companion.utils.js.map +1 -0
  236. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +376 -17
  237. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  238. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +805 -39
  239. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  240. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +93 -7
  241. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
  242. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +142 -25
  243. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
  244. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +120 -3
  245. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
  246. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js +325 -16
  247. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
  248. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.d.ts.map +1 -1
  249. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js +15 -6
  250. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js.map +1 -1
  251. package/dist/esm/meta-workflows/services/application-maturity-executor.companion.service.d.ts.map +1 -1
  252. package/dist/esm/meta-workflows/services/application-maturity-executor.companion.service.js +10 -11
  253. package/dist/esm/meta-workflows/services/application-maturity-executor.companion.service.js.map +1 -1
  254. package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.d.ts.map +1 -1
  255. package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.js +10 -11
  256. package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.js.map +1 -1
  257. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.d.ts +82 -0
  258. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.d.ts.map +1 -0
  259. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js +291 -0
  260. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js.map +1 -0
  261. package/dist/esm/meta-workflows/services/creation-lane-preflight.companion.service.d.ts +60 -0
  262. package/dist/esm/meta-workflows/services/creation-lane-preflight.companion.service.d.ts.map +1 -0
  263. package/dist/esm/meta-workflows/services/creation-lane-preflight.companion.service.js +66 -0
  264. package/dist/esm/meta-workflows/services/creation-lane-preflight.companion.service.js.map +1 -0
  265. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts +53 -0
  266. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts.map +1 -0
  267. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js +164 -0
  268. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js.map +1 -0
  269. package/dist/esm/meta-workflows/services/dossier-write-queue.companion.utils.d.ts +37 -0
  270. package/dist/esm/meta-workflows/services/dossier-write-queue.companion.utils.d.ts.map +1 -0
  271. package/dist/esm/meta-workflows/services/dossier-write-queue.companion.utils.js +52 -0
  272. package/dist/esm/meta-workflows/services/dossier-write-queue.companion.utils.js.map +1 -0
  273. package/dist/esm/meta-workflows/services/dossier.companion.service.d.ts +74 -14
  274. package/dist/esm/meta-workflows/services/dossier.companion.service.d.ts.map +1 -1
  275. package/dist/esm/meta-workflows/services/dossier.companion.service.js +180 -28
  276. package/dist/esm/meta-workflows/services/dossier.companion.service.js.map +1 -1
  277. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts +2 -3
  278. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts.map +1 -1
  279. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js +2 -8
  280. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js.map +1 -1
  281. package/dist/esm/meta-workflows/services/interview-answer-proposal.companion.d.ts +67 -0
  282. package/dist/esm/meta-workflows/services/interview-answer-proposal.companion.d.ts.map +1 -0
  283. package/dist/esm/meta-workflows/services/interview-answer-proposal.companion.js +64 -0
  284. package/dist/esm/meta-workflows/services/interview-answer-proposal.companion.js.map +1 -0
  285. package/dist/esm/meta-workflows/services/playbook-instance.companion.service.d.ts.map +1 -1
  286. package/dist/esm/meta-workflows/services/playbook-instance.companion.service.js +11 -3
  287. package/dist/esm/meta-workflows/services/playbook-instance.companion.service.js.map +1 -1
  288. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts +92 -4
  289. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts.map +1 -1
  290. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js +328 -7
  291. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js.map +1 -1
  292. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +105 -6
  293. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
  294. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +309 -39
  295. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  296. package/dist/esm/meta-workflows/services/playbook-spend-meter.companion.service.d.ts +62 -1
  297. package/dist/esm/meta-workflows/services/playbook-spend-meter.companion.service.d.ts.map +1 -1
  298. package/dist/esm/meta-workflows/services/playbook-spend-meter.companion.service.js +152 -2
  299. package/dist/esm/meta-workflows/services/playbook-spend-meter.companion.service.js.map +1 -1
  300. package/package.json +22 -18
  301. package/dist/esm/.tsbuildinfo +0 -1
  302. package/dist/esm/__tests__/asset-noop.d.ts +0 -3
  303. package/dist/esm/__tests__/asset-noop.d.ts.map +0 -1
  304. package/dist/esm/__tests__/asset-noop.js +0 -2
  305. package/dist/esm/__tests__/asset-noop.js.map +0 -1
  306. package/dist/esm/__tests__/chdir-dogfood-app.setup.d.ts +0 -2
  307. package/dist/esm/__tests__/chdir-dogfood-app.setup.d.ts.map +0 -1
  308. package/dist/esm/__tests__/chdir-dogfood-app.setup.js +0 -44
  309. package/dist/esm/__tests__/chdir-dogfood-app.setup.js.map +0 -1
  310. package/dist/esm/__tests__/internal-test-view.d.ts +0 -39
  311. package/dist/esm/__tests__/internal-test-view.d.ts.map +0 -1
  312. package/dist/esm/__tests__/internal-test-view.js +0 -2
  313. package/dist/esm/__tests__/internal-test-view.js.map +0 -1
  314. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.d.ts +0 -50
  315. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.d.ts.map +0 -1
  316. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.js +0 -157
  317. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.js.map +0 -1
  318. package/dist/esm/meta-workflows/services/__tests__/application-build-task-coding.companion.test-fixtures.d.ts +0 -8
  319. package/dist/esm/meta-workflows/services/__tests__/application-build-task-coding.companion.test-fixtures.d.ts.map +0 -1
  320. package/dist/esm/meta-workflows/services/__tests__/application-build-task-coding.companion.test-fixtures.js +0 -43
  321. package/dist/esm/meta-workflows/services/__tests__/application-build-task-coding.companion.test-fixtures.js.map +0 -1
  322. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.d.ts +0 -79
  323. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.d.ts.map +0 -1
  324. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.js +0 -193
  325. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.js.map +0 -1
@@ -18,7 +18,7 @@ import { ApplicationSchemaPlanObligation } from '../../core/config/application-s
18
18
  import { experienceTaskSkillRefs, taskHasExperienceProduct } from './application-build-experience-skills.companion.service.js';
19
19
  import { buildWebsitePlanContextSource, websiteTaskSkillRefs } from './application-build-website-context.companion.service.js';
20
20
  import { WORKBENCH_TASK_CORRELATION_DOMAIN, Workbench_BuildDispatchPhase, Workbench_BuildTaskStuckReason, WorkbenchBuildPlanTaskStatus, WorkbenchTaskCorrelationRef, sanitizeWorkbenchCreationPlaneIdentity, } from '@wildo-ai/platform-core-shared';
21
- import { composeBuildTaskCodingContract, slugifyRegistryIdentifier, decidedFamilyValuesFromCompanionExports, indexDecidedAspects, } from '@wildo-ai/application-creation-runtime';
21
+ import { assemblyRepairTaskRef, composeAssemblyRepairCodingContract, composeBuildTaskCodingContract, slugifyRegistryIdentifier, decidedFamilyValuesFromCompanionExports, indexDecidedAspects, mergePlaybookSpend, PlaybookSpendMeasurement, } from '@wildo-ai/application-creation-runtime';
22
22
  import { SAAS_SERVICE_TYPES, describeCaughtError } from '@wildo-ai/saas-backend-lib';
23
23
  import { Actor_Task_Topics, FlowsActors_Status } from '@wildo-ai/saas-models';
24
24
  import { BUILD_PLAN_TASK_GRAPH_HARD_FLOOR_CODES, BuildPlanResourceStage, BuildPlanTaskGraphSchema, BuildPlanTaskTargetKind, BuildPlanTaskProductKind, MetaWorkflow_FunctionalTopic, PlacementDisposition, PlacementPlanSchema, selectReadyBuildPlanTasks, validateBuildPlanTaskGraph, } from '@wildo-ai/saas-specifications/application-creation';
@@ -37,16 +37,21 @@ import { CompanionExecutionsCompanionService } from '../../executions/services/c
37
37
  import { CompanionExecutionsListQuerySchema } from '../../companion-api/companion-api.schemas.js';
38
38
  import { APPLICATION_CODING_SYSTEM_REF } from '../models/application-coding-agent.actors-system.definitions.js';
39
39
  import { readUnavailableApplicationRuntimes } from '../../core/runtime/application-runtime-liveness.companion.js';
40
- import { NothingToRearmError, readBuildTaskRearm, } from '../models/build-task-rearm.models.js';
40
+ import { BuildTaskRearmReason, MAXIMUM_INTERFERENCE_REARMS, OPERATOR_BUILD_TASK_REARM_REASONS, NothingToRearmError, readBuildTaskInterference, readBuildTaskLandedOverride, readBuildTaskRearm, } from '../models/build-task-rearm.models.js';
41
41
  import { APPLICATION_BUILD_GENERATION_STEP_ACTOR_REF, APPLICATION_BUILD_SYSTEM_REF } from '../models/application-build.actors-system.definitions.js';
42
+ import { readRecordedPlaybookSpend } from '../models/playbook-run-record.models.js';
42
43
  import { ApplicationBuildGenerationStep, ApplicationBuildGenerationStepCompanionService, ApplicationBuildGenerationStepLandedKind, SchemaPlanSyncState, } from './application-build-generation-step.companion.service.js';
43
- import { resolveBuildPlanTaskCodingPolicy, BuildPlanTaskLandedProbeKind, buildPlanTaskLandedProbePaths, declarationsAppearAt, launcherShellIdentity, placementSubjectShellIdentity, productDerivedSkillRefs, resolveBuildTaskLandedProbes, resolveUndraftableDocumentRef, settingsDestinationShellIdentity, shellModuleContributionFile, shellSurfaceConfigFile, } from './application-build-task-coding-policy.companion.service.js';
44
+ import { resolveAssemblyRepairCodingPolicy, resolveBuildPlanTaskCodingPolicy, BuildPlanTaskLandedProbeKind, buildPlanTaskLandedProbePaths, declarationsAppearAt, labelPacksDeclareKeyPrefix, launcherShellIdentity, placementSubjectShellIdentity, productDerivedSkillRefs, resolveBuildTaskLandedProbes, resolveUndraftableDocumentRef, settingsDestinationShellIdentity, shellModuleContributionFile, shellSurfaceConfigFile, } from './application-build-task-coding-policy.companion.service.js';
45
+ import { resolveApplicationAssemblyCheckRefs } from './application-assembly-checks.companion.utils.js';
46
+ import { ASSEMBLY_FAILURE_CONTEXT_SOURCE_REF, ASSEMBLY_REPAIR_GUIDANCE, ASSEMBLY_REPAIR_TARGET_KIND, MAXIMUM_ASSEMBLY_REPAIRS_PER_CHECK, assemblyRepairAttemptsThisRound, describeWithheldAssemblyRepairs, isAssemblyRepairTaskRef, readGivenAssemblyFailure, selectAssemblyRepair, } from './application-assembly-repair.companion.utils.js';
44
47
  /** No build plan, or nothing left to do. Named so the transport can say which. */
45
48
  export class ApplicationBuildPlanUnavailableError extends Error {
46
49
  }
47
50
  export class ApplicationBuildPlanExhaustedError extends Error {
48
51
  taskCount;
49
52
  landedCount;
53
+ landedTaskRefs;
54
+ assembly;
50
55
  /**
51
56
  * The counts, carried STRUCTURALLY rather than only inside the sentence.
52
57
  *
@@ -54,16 +59,47 @@ export class ApplicationBuildPlanExhaustedError extends Error {
54
59
  * fields the only copy lived in prose the reader would have had to parse. A board that parses
55
60
  * another component's error message is a board that breaks when somebody improves the wording.
56
61
  */
57
- constructor(message, taskCount, landedCount) {
62
+ constructor(message, taskCount, landedCount,
63
+ /** WHICH tasks landed — so a finished plan can still say which of them no run of their own produced (#2217). */
64
+ landedTaskRefs = [],
65
+ /**
66
+ * Whether the application the finished plan built ASSEMBLES (#2222) — set by a dispatch door, which is where
67
+ * "the build is finished" is claimed; absent from the cheap read door, which never runs a compiler.
68
+ */
69
+ assembly) {
58
70
  super(message);
59
71
  this.taskCount = taskCount;
60
72
  this.landedCount = landedCount;
73
+ this.landedTaskRefs = landedTaskRefs;
74
+ this.assembly = assembly;
61
75
  }
62
76
  }
63
77
  /** The ref of the `database-migrations` step the dispatch host derives when a plan owes it and omits it (#1027). */
64
78
  export const HOST_DERIVED_DATABASE_MIGRATIONS_TASK_REF = 'build-task-database-migrations';
65
79
  /** The ref of the `documentation-publication` step the host derives for a plan that authors chapters (#1273). */
66
80
  export const HOST_DERIVED_DOCUMENTATION_PUBLICATION_TASK_REF = 'build-task-documentation-publication';
81
+ /** The ref of the `i18n-translations` step the host derives after a plan's labels step, for a multi-locale application (#2204). */
82
+ export const HOST_DERIVED_I18N_TRANSLATIONS_TASK_REF = 'build-task-i18n-translations';
83
+ /**
84
+ * The tokens a run's recorded usage carries, or `undefined` when it carries none. Read by SHAPE: the row
85
+ * crossed a JSON boundary, and `CodingAgent_Usage` makes every field optional.
86
+ */
87
+ export function readCodingRunReportedTokens(usage) {
88
+ if (typeof usage !== 'object' || usage === null)
89
+ return undefined;
90
+ const bag = usage;
91
+ const count = (key) => (typeof bag[key] === 'number' && Number.isFinite(bag[key]) && bag[key] >= 0 ? bag[key] : undefined);
92
+ const dimensions = {
93
+ inputTokens: count('inputTokens'),
94
+ outputTokens: count('outputTokens'),
95
+ cacheReadTokens: count('cachedReadTokens'),
96
+ cacheWriteTokens: count('cachedWriteTokens'),
97
+ };
98
+ const reported = Object.values(dimensions).filter((value) => value !== undefined);
99
+ const totalTokens = count('totalTokens') ?? (reported.length > 0 ? reported.reduce((sum, value) => sum + value, 0) : undefined);
100
+ const tokens = Object.fromEntries(Object.entries({ ...dimensions, totalTokens }).filter((entry) => entry[1] !== undefined));
101
+ return Object.keys(tokens).length > 0 ? tokens : undefined;
102
+ }
67
103
  /**
68
104
  * Whether an attempt COUNTS as one of the task's: everything but a host refusal. A refusal of the task's
69
105
  * own contract counts although nothing ran, because the attempt budget counts it (#1581).
@@ -88,6 +124,8 @@ function projectBuildTaskAttempt(execution) {
88
124
  return null;
89
125
  const output = task.output;
90
126
  const rearm = readBuildTaskRearm(task.memory);
127
+ const landedOverride = readBuildTaskLandedOverride(task.input);
128
+ const interference = readBuildTaskInterference(task.memory);
91
129
  const carriedFailures = Array.isArray(output?.carriedVerificationDiagnoses)
92
130
  ? output.carriedVerificationDiagnoses.filter((entry) => typeof entry?.checkRef === 'string')
93
131
  : [];
@@ -100,6 +138,7 @@ function projectBuildTaskAttempt(execution) {
100
138
  .filter((entry) => entry.outcome?.success === false && !carriedRefs.has(String(entry.checkRef)))
101
139
  .map((entry) => String(entry.checkRef));
102
140
  const cost = output?.usage?.cost;
141
+ const tokens = readCodingRunReportedTokens(output?.usage);
103
142
  const stats = output?.changeSetSummary?.stats;
104
143
  const count = (value) => (typeof value === 'number' && Number.isFinite(value) ? value : 0);
105
144
  const outOfScopePaths = Array.isArray(output?.scopeAssessment?.outOfScopePaths)
@@ -109,15 +148,24 @@ function projectBuildTaskAttempt(execution) {
109
148
  taskRef,
110
149
  attempt: {
111
150
  runTaskId: String(task._id),
151
+ ...(execution.systemRef === APPLICATION_BUILD_SYSTEM_REF ? { generationStep: true } : {}),
152
+ ...(() => {
153
+ if (execution.systemRef !== APPLICATION_BUILD_SYSTEM_REF)
154
+ return {};
155
+ const generationStepSpend = readRecordedPlaybookSpend(task.output?.spend);
156
+ return generationStepSpend ? { generationStepSpend } : {};
157
+ })(),
112
158
  startedAt: execution.createdAt,
113
159
  ...(execution.finishedAt ? { settledAt: execution.finishedAt } : {}),
114
160
  status: execution.status,
115
161
  ...(typeof output?.disposition === 'string' ? { disposition: output.disposition } : {}),
116
162
  ...(typeof output?.failure?.message === 'string' ? { error: output.failure.message } : {}),
117
163
  ...(rearm ? { rearm } : {}),
164
+ ...(landedOverride ? { landedOverride } : {}),
118
165
  ...(carriedFailures.length > 0 ? { carriedFailures } : {}),
119
166
  ...(passedCheckRefs.length > 0 ? { passedCheckRefs } : {}),
120
167
  ...(typeof cost?.amount === 'number' && typeof cost.currency === 'string' ? { cost: { amount: cost.amount, currency: cost.currency } } : {}),
168
+ ...(tokens ? { tokens } : {}),
121
169
  ...(failedCheckRefs.length > 0 ? { failedCheckRefs } : {}),
122
170
  ...(typeof output?.agentStopReason === 'string' ? { agentStopReason: output.agentStopReason } : {}),
123
171
  ...(typeof output?.deniedPermissionCount === 'number' ? { deniedPermissionCount: output.deniedPermissionCount } : {}),
@@ -130,6 +178,7 @@ function projectBuildTaskAttempt(execution) {
130
178
  },
131
179
  } : {}),
132
180
  ...(output?.interferenceSuspected === true ? { interferenceSuspected: true } : {}),
181
+ ...(interference ? { interference } : {}),
133
182
  ...(typeof output?.failureAttribution === 'string' ? { failureAttribution: output.failureAttribution } : {}),
134
183
  ...refusalMarks(deriveCodingRunStart({ status: execution.status, ...(task.startedAt ? { startedAt: task.startedAt } : {}), ...(output ? { output } : {}) })),
135
184
  },
@@ -151,16 +200,42 @@ function refusalMarks(start) {
151
200
  * report none, and those attempts are not in the totals — which are then a floor, and say so, rather
152
201
  * than quietly reading an unpriced attempt as free. An attempt still running has no cost yet and is not
153
202
  * counted.
203
+ *
204
+ * `totalTokens` / `cacheReadTokens` (#2232) sum what the runs REPORTED, present only when at least one did.
205
+ * Generation steps are left out of every figure here: they are no agent runs and report neither.
206
+ * Tokens are reported where a cost may not be (an agent priced by subscription, a provider that prices
207
+ * nothing), so they are the figure that says a run worked when its cost is unknown.
154
208
  */
155
209
  export function deriveBuildSpend(records) {
156
210
  const total = {};
157
211
  const onTasksNotLanded = {};
158
212
  let attemptsWithoutReportedCost = 0;
213
+ const tokens = {};
214
+ const generationSpends = [];
215
+ let generationSteps = 0;
216
+ let generationStepsWithoutRecordedSpend = 0;
159
217
  for (const record of records) {
160
218
  for (const attempt of record.attempts) {
161
219
  // A run that never started could report no cost: it is not an unpriced attempt (#1581).
162
220
  if (attempt.ranNothing === true)
163
221
  continue;
222
+ // A generation step is no agent run: its model calls are its own figure, never an unpriced coding run (#2232).
223
+ if (attempt.generationStep === true) {
224
+ if (attempt.settledAt === undefined)
225
+ continue;
226
+ generationSteps += 1;
227
+ // A step no meter observed recorded nothing either: counted apart, never merged in as spending nothing.
228
+ if (attempt.generationStepSpend && attempt.generationStepSpend.measurement !== PlaybookSpendMeasurement.NOT_OBSERVED)
229
+ generationSpends.push(attempt.generationStepSpend);
230
+ else
231
+ generationStepsWithoutRecordedSpend += 1;
232
+ continue;
233
+ }
234
+ for (const key of ['totalTokens', 'cacheReadTokens']) {
235
+ const value = attempt.tokens?.[key];
236
+ if (value !== undefined)
237
+ tokens[key] = (tokens[key] ?? 0) + value;
238
+ }
164
239
  if (!attempt.cost) {
165
240
  if (attempt.settledAt !== undefined)
166
241
  attemptsWithoutReportedCost += 1;
@@ -173,7 +248,18 @@ export function deriveBuildSpend(records) {
173
248
  }
174
249
  }
175
250
  const cents = (sums) => Object.fromEntries(Object.entries(sums).map(([currency, amount]) => [currency, Math.round(amount * 100) / 100]));
176
- return { total: cents(total), onTasksNotLanded: cents(onTasksNotLanded), attemptsWithoutReportedCost };
251
+ return {
252
+ total: cents(total),
253
+ onTasksNotLanded: cents(onTasksNotLanded),
254
+ attemptsWithoutReportedCost,
255
+ ...tokens,
256
+ ...(generationSteps > 0 ? { generationSteps: {
257
+ steps: generationSteps,
258
+ stepsWithoutRecordedSpend: generationStepsWithoutRecordedSpend,
259
+ // Absent when no step recorded one: an empty merge would read "measured, 0 calls" beside steps that recorded nothing.
260
+ ...(generationSpends.length > 0 ? { spend: mergePlaybookSpend(generationSpends) } : {}),
261
+ } } : {}),
262
+ };
177
263
  }
178
264
  /**
179
265
  * The reds owed a repair, from every attempt's record (#1529). Pure over the attempts, so what counts as
@@ -214,6 +300,14 @@ export function deriveRepairsOwed(attemptsByTask) {
214
300
  }))
215
301
  .sort((left, right) => left.firstSeenAt.localeCompare(right.firstSeenAt));
216
302
  }
303
+ /**
304
+ * The stuck reasons a landed override passes (#2217): a COMPLETED earlier run, with or without its writes
305
+ * committed — that run is the landing the operator says is wrong. Every other reason still refuses the task.
306
+ */
307
+ const LANDED_OVERRIDE_RELEASES = new Set([
308
+ Workbench_BuildTaskStuckReason.COMPLETED_UNLANDED,
309
+ Workbench_BuildTaskStuckReason.COMPLETED_AWAITING_COMMIT,
310
+ ]);
217
311
  /** How long a CONCURRENT admission waits for the compile watchers before starting anyway (#1528). */
218
312
  const CONCURRENT_ADMISSION_COMPILE_QUIET_MS = 30_000;
219
313
  /** Dispatches one wave call may make per slot before it returns and lets the next call continue. */
@@ -270,6 +364,22 @@ export var ApplicationBuildWaveStop;
270
364
  * terminal state. Conflating them would let an operator read a money-burning loop as "the build is
271
365
  * finished".
272
366
  */
367
+ /**
368
+ * A build wave was asked for while one is already running in this companion (#2208 review M1).
369
+ *
370
+ * A second wave would double the width the person set, and it would break the first wave's end: that wave
371
+ * commits what its runs left and re-runs interfered tasks ALONE "now that nothing is writing", which is false
372
+ * while a second wave's runs are live. Refused as a CONFLICT — nothing is wrong with the request, the
373
+ * companion's state forbids it — and the remedy is to wait for the running wave, whose feed line ends it.
374
+ */
375
+ export class ApplicationBuildWaveInFlightError extends Error {
376
+ startedAt;
377
+ constructor(startedAt) {
378
+ super(`A build wave is already running (started ${startedAt}). Follow it with \`wildo creation feed --follow\`; `
379
+ + 'start the next one once it has ended — it takes the tasks that are ready then.');
380
+ this.startedAt = startedAt;
381
+ }
382
+ }
273
383
  export class ApplicationBuildTaskCompletedButUnlandedError extends Error {
274
384
  taskRef;
275
385
  priorTaskId;
@@ -403,7 +513,13 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
403
513
  actorsSystem;
404
514
  executions;
405
515
  logDebug;
406
- constructor(logger, companionContext, dispatch, git, generationSteps, introspection, actorsSystem, executions) {
516
+ /**
517
+ * When the wave running in this companion started; `undefined` when none is (#2208 review M1). One process
518
+ * owns every wave — the console, a lane child and an explicit playbook run all reach {@link dispatchBuildWave}
519
+ * here — so an in-process marker is the whole population, and a restart (which ends every run) clears it.
520
+ */
521
+ liveWaveStartedAt;
522
+ constructor(logger, companionContext, dispatch, git, generationSteps, introspection, actorsSystem, executions, acceptedChangeCommit) {
407
523
  this.logger = logger;
408
524
  this.companionContext = companionContext;
409
525
  this.dispatch = dispatch;
@@ -413,6 +529,43 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
413
529
  this.actorsSystem = actorsSystem;
414
530
  this.executions = executions;
415
531
  this.logDebug = this.logger.debugByType('ApplicationBuildDispatchCompanionService');
532
+ acceptedChangeCommit?.registerConcurrentRunProductWitness({
533
+ pathsLackingOwnProduct: (taskRef, candidatePaths) => this.pathsLackingOwnProduct(taskRef, candidatePaths),
534
+ });
535
+ }
536
+ /**
537
+ * Of the paths a concurrent run is about to commit under its task's name, the ones a landing probe of that
538
+ * task names and that do NOT carry the task's declared product (#2209) — read from the tree AS THE COMMIT
539
+ * WOULD LEAVE IT, by the very predicate landing uses ({@link isLandedProbeSatisfied}), so the accept and the
540
+ * landing check cannot disagree about whether the commit holds the product.
541
+ *
542
+ * Only probes naming one of the paths are asked: a probe about another file says nothing about this
543
+ * commit. SHELL probes are not asked here: the shell they read is composed from many files and resolved
544
+ * from the live tree by introspection, so it cannot be read "as this commit leaves it", and a shell-placement
545
+ * run's own files are its configuration rather than a list several runs append to. A task the plan no
546
+ * longer holds declares nothing to check. A plan that cannot be read throws: the accept then commits
547
+ * nothing under the run's name, and the wave reconciliation takes the files as writer unknown.
548
+ */
549
+ async pathsLackingOwnProduct(taskRef, candidatePaths) {
550
+ const graph = await this.readBuildPlan();
551
+ const task = graph.tasks.find((candidate) => candidate.taskRef === taskRef);
552
+ if (!task)
553
+ return [];
554
+ const committing = new Set(candidatePaths);
555
+ const prospective = this.createProspectiveCommitReader(committing);
556
+ const lacking = new Set();
557
+ for (const probe of resolveBuildTaskLandedProbes(task)) {
558
+ if (isShellProbe(probe))
559
+ continue;
560
+ const named = landedProbePaths(probe).filter((path) => committing.has(path));
561
+ if (named.length === 0)
562
+ continue;
563
+ if (await this.isLandedProbeSatisfied(probe, prospective))
564
+ continue;
565
+ for (const path of named)
566
+ lacking.add(path);
567
+ }
568
+ return [...lacking].sort();
416
569
  }
417
570
  /**
418
571
  * The application workspace's top-level entries — the raw material of a coding run's mutation
@@ -461,6 +614,16 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
461
614
  async describeNextBuildTask() {
462
615
  return (await this.prepareNextBuildTask()).plan;
463
616
  }
617
+ /**
618
+ * The same read for a caller that is about to RUN the build (#2208): the one a build wave asks before it
619
+ * is submitted. It refuses exactly as the one-task door refuses — including an exhausted plan's assembly
620
+ * verdict (#2222), which {@link describeNextBuildTask} leaves out because a dry run has nothing to check.
621
+ * Without it, `wildo build run` at a parallelism above one answered "every task landed" with no word on
622
+ * whether the application builds, which is the claim #2222 exists to qualify.
623
+ */
624
+ async describeNextBuildTaskBeforeRunning() {
625
+ return (await this.prepareNextBuildTaskOrQualifyExhaustion()).plan;
626
+ }
464
627
  /**
465
628
  * The same read, for a caller that must be able to render "there is nothing left".
466
629
  *
@@ -471,13 +634,42 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
471
634
  * read can tell.
472
635
  */
473
636
  async describeNextBuildTaskOrExhaustion() {
637
+ // The landed refs come back WITH the answer, never parked on the instance: two reads interleave at every await
638
+ // (see `LandedTaskResolution`), and one would qualify its answer with the other's set.
639
+ const { description, landedTaskRefs } = await this.describeNextBuildTaskOrExhaustionUnqualified();
640
+ if (landedTaskRefs.length === 0)
641
+ return description;
642
+ const { started, truncated } = await this.listBuildTaskRefsWithAStartedRun();
643
+ // A truncated history cannot say a task NEVER ran: the claim is withheld rather than made on a partial page.
644
+ if (truncated)
645
+ return description;
646
+ return { ...description, landedBeforeAnyRunTaskRefs: landedTaskRefs.filter((taskRef) => !started.has(taskRef)) };
647
+ }
648
+ /**
649
+ * Every build task with at least one run that STARTED — the population a landing can be "its own" against. A
650
+ * dispatch refused before it started is not one (#1581). Read from the same actor rows and the same page cap as
651
+ * the build record, so the two surfaces cannot disagree about which tasks ran.
652
+ */
653
+ async listBuildTaskRefsWithAStartedRun() {
654
+ const listed = await Promise.all([APPLICATION_CODING_SYSTEM_REF, APPLICATION_BUILD_SYSTEM_REF].map((systemRef) => this.executions.listActorExecutions(CompanionExecutionsListQuerySchema.parse({ systemRef, limit: BUILD_TASK_ATTEMPT_PAGE_CAP }))));
655
+ const started = new Set();
656
+ for (const projected of listed.flat().map(projectBuildTaskAttempt)) {
657
+ if (projected !== null && isCountedBuildTaskAttempt(projected.attempt))
658
+ started.add(projected.taskRef);
659
+ }
660
+ return { started, truncated: listed.some((page) => page.length >= BUILD_TASK_ATTEMPT_PAGE_CAP) };
661
+ }
662
+ async describeNextBuildTaskOrExhaustionUnqualified() {
474
663
  try {
475
664
  const prepared = await this.prepareNextBuildTask();
476
- return { plan: prepared.plan, stuckTasks: prepared.stuckTasks };
665
+ return { description: { plan: prepared.plan, stuckTasks: prepared.stuckTasks }, landedTaskRefs: prepared.plan.landedTaskRefs };
477
666
  }
478
667
  catch (error) {
479
668
  if (error instanceof ApplicationBuildPlanExhaustedError) {
480
- return { plan: null, exhausted: { taskCount: error.taskCount, landedCount: error.landedCount }, stuckTasks: [] };
669
+ return {
670
+ description: { plan: null, exhausted: { taskCount: error.taskCount, landedCount: error.landedCount }, stuckTasks: [] },
671
+ landedTaskRefs: error.landedTaskRefs,
672
+ };
481
673
  }
482
674
  /*
483
675
  * Every ready task is stuck — an ANSWER, for the same reason exhaustion is (#1451). It used to
@@ -486,7 +678,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
486
678
  * still throw it: there, the caller asked to run something and nothing can run.
487
679
  */
488
680
  if (error instanceof ApplicationBuildTaskCompletedButUnlandedError) {
489
- return { plan: null, stuckQueue: error.queue, stuckTasks: error.stuckTasks };
681
+ return { description: { plan: null, stuckQueue: error.queue, stuckTasks: error.stuckTasks }, landedTaskRefs: error.queue.landedTaskRefs };
490
682
  }
491
683
  throw error;
492
684
  }
@@ -548,9 +740,11 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
548
740
  * {@link dispatchBuildTask} refuses it.
549
741
  */
550
742
  selection) {
551
- return this.prepareNextBuildTask(selection).then(async (prepared) => {
552
- const opened = await this.openPreparedBuildTask(prepared, session);
553
- void this.executePreparedBuildTask(prepared, session, undefined, CodingRunConcurrency.SINGLE_FLIGHT, opened).catch((error) => {
743
+ return this.prepareNextBuildTaskOrQualifyExhaustion(selection).then(async (prepared) => {
744
+ // The override rides the run's row only when it was exercised, so a run's record never claims one it did not use.
745
+ const origin = prepared.landedOverride ? { landedOverride: prepared.landedOverride } : undefined;
746
+ const opened = await this.openPreparedBuildTask(prepared, session, origin);
747
+ void this.executePreparedBuildTask(prepared, session, origin, CodingRunConcurrency.SINGLE_FLIGHT, opened).catch((error) => {
554
748
  // The failure is ON THE ACTOR PLANE already, with this message: a coding dispatch refused
555
749
  // before admission settled ABORTED (FAILED when its own contract was invalid, #1581), a
556
750
  // generation step that threw settled FAILED. Logged because a detached run has no caller.
@@ -568,7 +762,181 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
568
762
  * the same rows, because the record is a property of a DISPATCH and not of the door that asked.
569
763
  */
570
764
  async dispatchNextBuildTask(session) {
571
- return this.executePreparedBuildTask(await this.prepareNextBuildTask(), session);
765
+ return this.executePreparedBuildTask(await this.prepareNextBuildTaskOrQualifyExhaustion(), session);
766
+ }
767
+ /**
768
+ * {@link prepareNextBuildTask} for a DISPATCH door (#2222): when nothing is left to run, the refusal says whether
769
+ * the application those tasks built assembles. The dispatch doors are where "the build is finished" is claimed —
770
+ * `wildo build run` with nothing ready, the loop's next step — so that is where the claim is checked. The read
771
+ * door (`describeNextBuildTaskOrExhaustion`) stays a read: it runs on every board poll and never spawns a compiler.
772
+ *
773
+ * And when it does NOT assemble, the next work is a REPAIR of the first failing check (#2283), within the bounds
774
+ * {@link selectAssemblyRepair} keeps, rather than a refusal a person has to act on. Only for the NEXT-task door: a
775
+ * caller that named a task asked about that task, and is refused with the verdict as before. While a repair runs,
776
+ * the door refuses rather than asking the checks again under it: the repair is writing the tree they read.
777
+ */
778
+ async prepareNextBuildTaskOrQualifyExhaustion(selection) {
779
+ try {
780
+ return await this.prepareNextBuildTask(selection);
781
+ }
782
+ catch (error) {
783
+ if (!(error instanceof ApplicationBuildPlanExhaustedError) || error.assembly !== undefined)
784
+ throw error;
785
+ // Either door: a check asked while a repair writes the tree reports on a tree in mid-edit.
786
+ const liveRepair = await this.findLiveAssemblyRepair();
787
+ if (liveRepair !== undefined) {
788
+ throw new ApplicationBuildPlanExhaustedError(`${error.message} The assembly repair ${liveRepair} is running; ask again once it settles.`, error.taskCount, error.landedCount, error.landedTaskRefs);
789
+ }
790
+ if (selection !== undefined)
791
+ throw await this.qualifyExhaustion(error);
792
+ const assessed = await this.assessAssembly();
793
+ const repair = await this.prepareAssemblyRepair(assessed, error);
794
+ if (repair.prepared !== undefined)
795
+ return repair.prepared;
796
+ throw this.exhaustedWithAssembly(error, assessed, repair.withheld);
797
+ }
798
+ }
799
+ async qualifyExhaustion(error) {
800
+ return this.exhaustedWithAssembly(error, await this.assessAssembly(), []);
801
+ }
802
+ /**
803
+ * Ask every assembly check (#2222). `failed[].detail` is the longer tail a repair is given (#2283); the verdict
804
+ * keeps the five-line excerpt it always showed.
805
+ */
806
+ async assessAssembly() {
807
+ const checkRefs = resolveApplicationAssemblyCheckRefs(this.companionContext.saasRoot);
808
+ const { verification, infrastructureError, unrunCheckRefs } = await this.dispatch.runApplicationVerificationChecks(checkRefs);
809
+ // A check that never RAN is not a verdict about the application (#2222 review): it is kept out of `failed`.
810
+ const unrun = new Set(unrunCheckRefs ?? []);
811
+ const failed = verification
812
+ .filter(({ checkRef, outcome }) => !outcome.success && !unrun.has(checkRef))
813
+ .map(({ checkRef, outcome }) => {
814
+ // tsc prints its diagnostics to stdout, so stdout first; stderr when a crash left nothing there.
815
+ const tail = [outcome.stdoutTail, outcome.stderrTail].map((entry) => entry.trim()).find((entry) => entry.length > 0) ?? '';
816
+ return { checkRef, output: tail.split('\n').slice(0, 5).join('\n') || outcome.message, detail: tail || outcome.message };
817
+ });
818
+ const couldNotRun = unrun.size > 0 || infrastructureError
819
+ ? `${[...unrun].join(', ') || 'a check'}: ${infrastructureError ? describeCaughtError(infrastructureError) : 'did not run'}`
820
+ : undefined;
821
+ return { checkRefs, failed, ...(couldNotRun !== undefined ? { couldNotRun } : {}) };
822
+ }
823
+ exhaustedWithAssembly(error, assessed, withheld) {
824
+ const { checkRefs, couldNotRun } = assessed;
825
+ const assembly = this.toAssemblyVerdict(assessed, withheld);
826
+ const { failed } = assembly;
827
+ const unanswered = couldNotRun !== undefined ? `\nNot answered (the check could not run, which says nothing about the application): ${couldNotRun}` : '';
828
+ const verdict = assembly.passed
829
+ ? ` The application assembles: ${checkRefs.length} check(s) passed.`
830
+ : failed.length > 0
831
+ ? ` But the application does NOT assemble — the plan's tasks landed and the program they make does not build: `
832
+ + failed.map((entry) => `${entry.checkRef}:\n${entry.output}`).join('\n')
833
+ + '\nFix the failing package (or re-run the task that owns it), then ask again.' + describeWithheldAssemblyRepairs(withheld) + unanswered
834
+ : ` Whether the application assembles could not be checked: ${couldNotRun}`;
835
+ return new ApplicationBuildPlanExhaustedError(`${error.message}${verdict}`, error.taskCount, error.landedCount, error.landedTaskRefs, assembly);
836
+ }
837
+ toAssemblyVerdict(assessed, withheld) {
838
+ const failed = assessed.failed.map(({ checkRef, output }) => ({ checkRef, output }));
839
+ return {
840
+ passed: failed.length === 0 && assessed.couldNotRun === undefined,
841
+ checkRefs: assessed.checkRefs,
842
+ failed,
843
+ ...(assessed.couldNotRun !== undefined ? { couldNotRun: assessed.couldNotRun } : {}),
844
+ ...(withheld.length > 0 ? { repairsWithheld: withheld } : {}),
845
+ };
846
+ }
847
+ /** The taskRef of a live assembly repair, or `undefined`. A plane that cannot be read answers `undefined`: the admission still refuses a second run. */
848
+ async findLiveAssemblyRepair() {
849
+ try {
850
+ return (await this.dispatch.listInFlightCodingRuns()).map((run) => run.taskRef).find((taskRef) => taskRef !== null && isAssemblyRepairTaskRef(taskRef));
851
+ }
852
+ catch (error) {
853
+ this.logDebug('Could not list the live coding runs before asking the assembly checks', { error: describeCaughtError(error) });
854
+ return undefined;
855
+ }
856
+ }
857
+ /**
858
+ * The repair the failing checks are owed now, prepared exactly as a coding task is (#2283), or the checks it is
859
+ * withheld from. See `application-assembly-repair.companion.utils.ts` for the bounds, and
860
+ * `composeAssemblyRepairCodingContract` for why a repair is not a build-plan task.
861
+ *
862
+ * The run history that bounds it is the build's own execution rows, where each repair records the check and the
863
+ * failure it was given (`assemblyRepair` on the row input). If they cannot be read, nothing is repaired: a bound that
864
+ * cannot be measured is not spent on a guess, and the refusal still names the failing checks.
865
+ *
866
+ * A repair's context is the failure and its previous failed attempt, nothing else. It gets no skill and no live-query
867
+ * menu, unlike a build task: a build task's skills come from what it builds, and a repair builds nothing new, it
868
+ * makes a named check pass, and the check's own output is the most specific brief there is. Revisit if repairs are
869
+ * measured failing for want of knowledge they would have had.
870
+ */
871
+ async prepareAssemblyRepair(assessed, exhausted) {
872
+ if (assessed.failed.length === 0)
873
+ return { withheld: [] };
874
+ let runs;
875
+ try {
876
+ runs = await this.listBuildDispatchRuns();
877
+ }
878
+ catch (error) {
879
+ this.logger.warn('Could not read the build\'s runs; no assembly repair is dispatched', { error: describeCaughtError(error) });
880
+ return { withheld: [] };
881
+ }
882
+ const workspaceEntries = this.readApplicationWorkspaceEntries();
883
+ const decision = selectAssemblyRepair(assessed.failed, assemblyRepairAttemptsThisRound(runs), (checkRef) => resolveAssemblyRepairCodingPolicy(checkRef, workspaceEntries).requiredCheckRefs);
884
+ if (decision.repair === undefined)
885
+ return { withheld: decision.withheld };
886
+ const failure = assessed.failed.find((entry) => entry.checkRef === decision.repair.checkRef);
887
+ const content = {
888
+ checkRef: failure.checkRef,
889
+ output: failure.output,
890
+ ...(failure.detail !== failure.output ? { detail: failure.detail } : {}),
891
+ guidance: ASSEMBLY_REPAIR_GUIDANCE,
892
+ };
893
+ const contextSources = [{ sourceRef: ASSEMBLY_FAILURE_CONTEXT_SOURCE_REF, originRef: 'application-creation:origin/dev-companion', content }];
894
+ const boundary = resolveAssemblyRepairCodingPolicy(failure.checkRef, workspaceEntries);
895
+ const taskRef = assemblyRepairTaskRef(failure.checkRef);
896
+ // The previous repair of this check that FAILED, as a retry of a build task is shown its (#1536). Best-effort.
897
+ try {
898
+ const [latest] = await this.dispatch.listAttributableFailedRunsForBuildTask(taskRef, undefined, { includeRearmed: true });
899
+ if (latest !== undefined)
900
+ contextSources.push(previousAttemptContextSource(latest));
901
+ }
902
+ catch (error) {
903
+ this.logDebug('Previous-repair source omitted from the repair context', { taskRef, error: describeCaughtError(error) });
904
+ }
905
+ const contract = composeAssemblyRepairCodingContract({
906
+ checkRef: failure.checkRef,
907
+ boundary,
908
+ contextSources,
909
+ objectiveRef: 'application-creation:objective/build-plan',
910
+ });
911
+ // Owed, not yet dispatched: the read before a wave asks this too, and dispatches nothing.
912
+ this.logger.warn('The finished build plan does not assemble; a repair of the first failing check is owed', {
913
+ checkRef: failure.checkRef, taskRef, withheld: decision.withheld, maximumRepairsPerCheck: MAXIMUM_ASSEMBLY_REPAIRS_PER_CHECK,
914
+ });
915
+ const plan = {
916
+ taskRef,
917
+ // The failure's first line rides the objective, so the advisory judge grades the repair against what it was given.
918
+ objective: `Every build-plan task landed and ${failure.checkRef} fails: repair the application so that it passes. `
919
+ + `It printed: ${failure.output.split('\n')[0] ?? ''}`,
920
+ targetKind: ASSEMBLY_REPAIR_TARGET_KIND,
921
+ produces: [],
922
+ allowedPathPrefixes: contract.mutationScope.allowedPathPrefixes,
923
+ prohibitedPathPrefixes: contract.mutationScope.prohibitedPathPrefixes,
924
+ requiredChecks: contract.verificationIntent.requiredChecks,
925
+ installedSkillRefs: contract.installedSkillRefs,
926
+ readyTaskRefs: [],
927
+ landedTaskRefs: exhausted.landedTaskRefs,
928
+ unverifiableLandedTaskRefs: [],
929
+ };
930
+ return { prepared: { kind: 'CODING', plan, contract, stuckTasks: [] }, withheld: decision.withheld };
931
+ }
932
+ /** The build's dispatch rows, coding runs and generation steps, as {@link assemblyRepairAttemptsThisRound} reads them. */
933
+ async listBuildDispatchRuns() {
934
+ const listed = await Promise.all([APPLICATION_CODING_SYSTEM_REF, APPLICATION_BUILD_SYSTEM_REF].map((systemRef) => this.executions.listActorExecutions(CompanionExecutionsListQuerySchema.parse({ systemRef, limit: BUILD_TASK_ATTEMPT_PAGE_CAP }))));
935
+ return listed.flat().flatMap((execution) => {
936
+ const task = execution.standaloneTasks[0];
937
+ const taskRef = task?.input?.taskRef;
938
+ return typeof taskRef === 'string' ? [{ taskRef, startedAt: execution.createdAt, status: execution.status, input: task.input }] : [];
939
+ });
572
940
  }
573
941
  /**
574
942
  * Run THIS task (#1454, Step 7). Admitted only when it is READY: the same selection as
@@ -627,6 +995,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
627
995
  taskRef: prepared.plan.taskRef,
628
996
  generationStepRef: prepared.plan.generationStepRef ?? null,
629
997
  ...(origin?.conversationId ? { conversationId: origin.conversationId } : {}),
998
+ ...(origin?.landedOverride ? { landedOverride: origin.landedOverride } : {}),
630
999
  },
631
1000
  // The same cross-plane join a coding task carries, so the board matches either kind of
632
1001
  // dispatch to its build-plan row by one key.
@@ -673,13 +1042,21 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
673
1042
  taskRef: prepared.plan.taskRef,
674
1043
  taskId: opened.taskId,
675
1044
  execute: () => this.generationSteps.executeGenerationStep(prepared.task, session),
1045
+ // Its claims when a concurrent wave shares the tree (#2240): the roots derived from its evidence paths.
1046
+ ownedPathPrefixes: prepared.plan.allowedPathPrefixes,
676
1047
  ...(session ? { sessionContext: session } : {}),
677
1048
  }), session, {
678
1049
  // The step's PRODUCT is files on disk; the row names them so a reader need not re-derive where to look.
1050
+ // And what its model calls spent (#2232): the build's cost is incomplete without its generation steps.
679
1051
  concludeAs: (result) => ({
680
1052
  status: FlowsActors_Status.COMPLETED,
681
- taskOutput: { generationStepRef: result.generationStepRef, evidencePaths: result.evidencePaths },
1053
+ taskOutput: { generationStepRef: result.generationStepRef, evidencePaths: result.evidencePaths, spend: result.spend },
682
1054
  }),
1055
+ // A failed run spent money too — also when the step itself succeeded and what followed it threw.
1056
+ recordBesideFailure: () => {
1057
+ const spend = this.generationSteps.spentByGenerationStep(prepared.task);
1058
+ return spend ? { spend } : null;
1059
+ },
683
1060
  }).finally(() => this.dispatch.announceRunStateChanged());
684
1061
  return { plan: prepared.plan, generationStep };
685
1062
  }
@@ -761,18 +1138,39 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
761
1138
  * parallel Claude Code sessions do every day. What is prevented is only a task being built twice at
762
1139
  * once (the per-task subject and the IN_FLIGHT skip). What is REPAIRED is at the end: once every run
763
1140
  * has settled, {@link CodingAgentDispatchCompanionService.reconcileWaveAcceptance} commits what the
764
- * runs' own accepts left, as one change naming every run whose writes it may carry (#1805). What is
765
- * OBSERVED is on each run's row
766
- * (`concurrency`, `interferenceSuspected`).
1141
+ * runs' own accepts left, as one change naming every run whose writes it may carry (#1805); then
1142
+ * {@link repairInterferedTasks} re-runs, ALONE, each task whose completed run lost its product to a
1143
+ * sibling (#2210). What is OBSERVED is on each run's row (`concurrency`, `interferenceSuspected`, and the
1144
+ * `interference` memory entry).
767
1145
  *
768
1146
  * Bounded per call: at most {@link WAVE_DISPATCHES_PER_DEGREE} dispatches per slot, and a generation
769
1147
  * step at most once — a step whose landing stays unmet would otherwise be re-selected forever. The
770
- * next call continues from wherever the build stands.
1148
+ * interference re-runs are outside that cap, bounded per task by `MAXIMUM_INTERFERENCE_REARMS` and at most
1149
+ * one per completed run of this wave. The next call continues from wherever the build stands.
771
1150
  *
772
1151
  * With a degree of 1 this is one single-flight dispatch awaited to its outcome: exactly the lane as
773
1152
  * it was.
774
1153
  */
775
1154
  async dispatchBuildWave(session) {
1155
+ this.assertNoBuildWaveInFlight();
1156
+ this.liveWaveStartedAt = new Date().toISOString();
1157
+ try {
1158
+ return await this.runBuildWave(session);
1159
+ }
1160
+ finally {
1161
+ this.liveWaveStartedAt = undefined;
1162
+ }
1163
+ }
1164
+ /**
1165
+ * Refuse while a build wave runs in this companion (#2208 review M1) — the check a caller makes BEFORE it
1166
+ * submits a detached wave, so the refusal reaches it now rather than as a failed run in the feed. The marker
1167
+ * spans the whole wave, including its end-of-wave commit and repair, when no coding run may be live.
1168
+ */
1169
+ assertNoBuildWaveInFlight() {
1170
+ if (this.liveWaveStartedAt !== undefined)
1171
+ throw new ApplicationBuildWaveInFlightError(this.liveWaveStartedAt);
1172
+ }
1173
+ async runBuildWave(session) {
776
1174
  const degree = readBuildParallelism(this.companionContext.saasRoot);
777
1175
  const mode = degree > 1 ? CodingRunConcurrency.CONCURRENT : CodingRunConcurrency.SINGLE_FLIGHT;
778
1176
  const maximumDispatches = degree * WAVE_DISPATCHES_PER_DEGREE;
@@ -844,7 +1242,196 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
844
1242
  const reconciliation = mode === CodingRunConcurrency.CONCURRENT && settledTaskIds.length > 0
845
1243
  ? await this.dispatch.reconcileWaveAcceptance({ startedAt, taskIds: settledTaskIds })
846
1244
  : [];
847
- return { degree, mode, dispatched, outcomes, reconciliation, stoppedFillingBecause };
1245
+ /*
1246
+ * And the repair reconciliation cannot make (#2210): a run that COMPLETED but whose product a sibling
1247
+ * overwrote. Its file is now committed, holding the siblings' work and not its own, so no commit can
1248
+ * bring it back; only running the task again can. Asked after the reconciliation, so landing reads the
1249
+ * tree every run's work has reached.
1250
+ */
1251
+ const interferenceRepairs = mode === CodingRunConcurrency.CONCURRENT
1252
+ ? await this.repairInterferedTasks(outcomes, session)
1253
+ : [];
1254
+ /*
1255
+ * #2222: a wave that ran out of ready work may have FINISHED the plan. Asked after the reconciliation and the
1256
+ * repairs, so it reads the tree every run's work reached — and only on NOTHING_READY, the one stop that can mean
1257
+ * "done" (a cap, a refusal or a repeated step leaves work behind).
1258
+ */
1259
+ const { assembly, repairs: assemblyRepairs } = stoppedFillingBecause === ApplicationBuildWaveStop.NOTHING_READY
1260
+ ? await this.assemblyIfPlanExhausted(session)
1261
+ : { assembly: undefined, repairs: [] };
1262
+ return {
1263
+ degree, mode, dispatched, outcomes, reconciliation, interferenceRepairs, stoppedFillingBecause,
1264
+ ...(assembly ? { assembly } : {}),
1265
+ ...(assemblyRepairs.length > 0 ? { assemblyRepairs } : {}),
1266
+ };
1267
+ }
1268
+ /**
1269
+ * The assembly verdict when no task is ready because every one landed; absent when work remains or is stuck.
1270
+ *
1271
+ * When the finished plan does not assemble, the wave REPAIRS it here (#2283): it asks the next-task door, which
1272
+ * answers with a repair of the first failing check while one is owed, runs that repair ALONE, waits for it, and
1273
+ * asks again, until the door answers with a verdict. The door's per-check bounds end the loop; the ceiling below
1274
+ * only guards against a repair that never counts, one the host keeps refusing before it starts.
1275
+ */
1276
+ async assemblyIfPlanExhausted(session) {
1277
+ const repairs = [];
1278
+ const ceiling = MAXIMUM_ASSEMBLY_REPAIRS_PER_CHECK * resolveApplicationAssemblyCheckRefs(this.companionContext.saasRoot).length;
1279
+ for (;;) {
1280
+ let prepared;
1281
+ try {
1282
+ prepared = await this.prepareNextBuildTaskOrQualifyExhaustion();
1283
+ }
1284
+ catch (error) {
1285
+ return { ...(error instanceof ApplicationBuildPlanExhaustedError && error.assembly ? { assembly: error.assembly } : {}), repairs };
1286
+ }
1287
+ // A ready task means the plan is not finished after all, so there is no verdict to give.
1288
+ if (!isAssemblyRepairTaskRef(prepared.plan.taskRef))
1289
+ return { repairs };
1290
+ // Past the ceiling the repair is not run, and the wave still says whether the application assembles (#2283 review F2).
1291
+ if (repairs.length >= ceiling)
1292
+ return { assembly: this.toAssemblyVerdict(await this.assessAssembly(), []), repairs };
1293
+ const checkRef = prepared.kind === 'CODING' ? readGivenAssemblyFailure(prepared.contract)?.checkRef ?? prepared.plan.taskRef : prepared.plan.taskRef;
1294
+ try {
1295
+ const dispatched = await this.executePreparedBuildTask(prepared, session);
1296
+ const outcome = dispatched.admission ? await this.awaitCodingRunOutcome(dispatched.admission.taskId, session) : null;
1297
+ repairs.push({ checkRef, taskRef: prepared.plan.taskRef, outcome });
1298
+ }
1299
+ catch (error) {
1300
+ // The repair could not run (a held worktree, a refused admission); the plan is still finished, so the wave still answers.
1301
+ this.logger.warn('An assembly repair could not be run at the end of the wave', { checkRef, error: describeCaughtError(error) });
1302
+ return { assembly: this.toAssemblyVerdict(await this.assessAssembly(), []), repairs };
1303
+ }
1304
+ }
1305
+ }
1306
+ /**
1307
+ * DETECT and REPAIR a product a sibling overwrote (#2210) — the half of the parallel wave's
1308
+ * detect-and-repair decision (Paul, 2026-09-24, recorded in `concurrent-coding-runs.models.ts`) that only
1309
+ * covered FAILED runs until then. A run that succeeded and then lost its write was reported
1310
+ * `completed_unlanded` ("fix what it declares, or the work") and waited for a person, although nothing in
1311
+ * the task was wrong. Measured on `app-creation-test-004` (2026-10-01, degree 5): two of five chapters were
1312
+ * lost from one chapters index, and both landed only when a person re-ran each task alone.
1313
+ *
1314
+ * A completed run counts as interfered when, all three:
1315
+ * - its task has not landed, and its declared product is missing from the WORKING tree too (present there
1316
+ * it was merely left uncommitted, which re-running would not fix);
1317
+ * - another run of the wave overlapped it in time (`describeCodingRunOverlap`, computed now that every
1318
+ * window is closed);
1319
+ * - one of the files read by the task's UNMET probes (the missing product's files, never a satisfied
1320
+ * product's) was changed by that overlapping run too.
1321
+ * Suspected, never proven, like `interferenceSuspected` on a failed run: the wave sees that a sibling wrote
1322
+ * the product's file during the run, not which line it replaced.
1323
+ *
1324
+ * The repair re-arms the task with `INTERFERED_BY_CONCURRENT_RUN` and runs it again SINGLE-FLIGHT, at once:
1325
+ * the concurrent runs have all settled, so the re-run edits the file as it now stands and nothing can
1326
+ * overwrite it. It is not prevention — the wave still runs every task concurrently, as decided — it is the
1327
+ * repair, made where the evidence is. Bounded by {@link MAXIMUM_INTERFERENCE_REARMS} per task. Sequential,
1328
+ * because the re-runs are single-flight.
1329
+ */
1330
+ async repairInterferedTasks(outcomes, session) {
1331
+ const completed = outcomes.filter((outcome) => outcome?.succeeded === true && outcome.taskRef !== null);
1332
+ if (completed.length === 0)
1333
+ return [];
1334
+ /*
1335
+ * Best-effort, like every repair here: the wave's runs are settled and reconciled already, and a detection
1336
+ * that cannot read the plan must not turn that result into a thrown wave. Logged, so a silent miss is not
1337
+ * the outcome; the task then reads `completed_unlanded`, as it did before #2210.
1338
+ */
1339
+ let graph;
1340
+ try {
1341
+ graph = await this.readBuildPlan();
1342
+ }
1343
+ catch (error) {
1344
+ this.logger.warn('Could not look for completed runs a sibling interfered with at the end of the wave', { error: describeCaughtError(error) });
1345
+ return [];
1346
+ }
1347
+ const repairs = [];
1348
+ for (const run of completed) {
1349
+ try {
1350
+ /*
1351
+ * Landing and the working tree are read again for EACH run: a previous run's single-flight re-run has
1352
+ * rewritten the shared file since, and a reading taken before it would judge this run on stale text.
1353
+ */
1354
+ const landed = (await this.resolveLandedTaskRefs(graph.tasks)).landed;
1355
+ const repair = await this.repairIfInterfered(run, graph, landed, this.createWorktreeReader(), session);
1356
+ if (repair)
1357
+ repairs.push(repair);
1358
+ }
1359
+ catch (error) {
1360
+ this.logger.warn('Could not repair a completed run a sibling may have interfered with', { taskRef: run.taskRef, runTaskId: run.taskId, error: describeCaughtError(error) });
1361
+ }
1362
+ }
1363
+ return repairs;
1364
+ }
1365
+ /** One run of {@link repairInterferedTasks}: `undefined` when it was not interfered with. */
1366
+ async repairIfInterfered(run, graph, landed, worktree, session) {
1367
+ if (landed.has(run.taskRef))
1368
+ return undefined;
1369
+ const task = graph.tasks.find((candidate) => candidate.taskRef === run.taskRef);
1370
+ if (!task)
1371
+ return undefined;
1372
+ const probes = resolveBuildTaskLandedProbes(task).filter((probe) => !isShellProbe(probe));
1373
+ if (probes.length === 0)
1374
+ return undefined;
1375
+ const presentInWorktree = await Promise.all(probes.map((probe) => this.isLandedProbeSatisfied(probe, worktree)));
1376
+ if (presentInWorktree.every(Boolean))
1377
+ return undefined;
1378
+ const overlap = this.dispatch.describeCodingRunOverlap(run.taskId);
1379
+ if (!overlap)
1380
+ return undefined;
1381
+ // Only the MISSING product's files: a satisfied probe on a file a sibling also touched says nothing about why
1382
+ // another probe of the task is unmet, and counting it would blame a sibling for the task's own omission.
1383
+ const productPaths = new Set(probes.filter((_, index) => !presentInWorktree[index]).flatMap(landedProbePaths));
1384
+ const contendedProductPaths = overlap.contendedPaths.filter((path) => productPaths.has(path));
1385
+ if (contendedProductPaths.length === 0)
1386
+ return undefined;
1387
+ const previousRequeues = (await this.dispatch.listCompletedRunsForBuildTask(run.taskRef, session))
1388
+ .filter((candidate) => candidate.taskId !== run.taskId && candidate.interference?.requeued === true).length;
1389
+ const detected = { overlappingTaskRefs: overlap.overlappingTaskRefs, contendedProductPaths, detectedAt: new Date().toISOString() };
1390
+ if (previousRequeues >= MAXIMUM_INTERFERENCE_REARMS) {
1391
+ const interference = { ...detected, requeued: false };
1392
+ await this.dispatch.recordBuildTaskInterference(run.taskRef, run.taskId, interference, session);
1393
+ this.logger.warn('A completed run lost its product to a concurrent sibling again, and the interference re-runs are spent; the task waits for a person', {
1394
+ taskRef: run.taskRef, runTaskId: run.taskId, previousRequeues, ...interference,
1395
+ });
1396
+ return { taskRef: run.taskRef, runTaskId: run.taskId, interference };
1397
+ }
1398
+ /*
1399
+ * Re-armed FIRST, recorded after, so `requeued` states what happened: a re-arm that throws leaves a record
1400
+ * saying the task was NOT requeued, which neither spends the bound nor tells `why` the wave re-ran it.
1401
+ */
1402
+ let requeued = true;
1403
+ let rearmError;
1404
+ try {
1405
+ await this.dispatch.rearmBuildTask(run.taskRef, {
1406
+ reason: BuildTaskRearmReason.INTERFERED_BY_CONCURRENT_RUN,
1407
+ note: `Concurrent run(s) ${detected.overlappingTaskRefs.join(', ')} changed ${contendedProductPaths.join(', ')} during this run, and the product this task declares is missing from it (suspected interference); the build wave re-runs it alone.`,
1408
+ }, session);
1409
+ }
1410
+ catch (error) {
1411
+ requeued = false;
1412
+ rearmError = describeCaughtError(error);
1413
+ }
1414
+ const interference = { ...detected, requeued };
1415
+ await this.dispatch.recordBuildTaskInterference(run.taskRef, run.taskId, interference, session);
1416
+ if (!requeued) {
1417
+ this.logger.warn('A completed run lost its product to a concurrent sibling, and its task could not be re-armed; it waits for a person', {
1418
+ taskRef: run.taskRef, runTaskId: run.taskId, error: rearmError, ...interference,
1419
+ });
1420
+ return { taskRef: run.taskRef, runTaskId: run.taskId, interference, rerun: { error: rearmError } };
1421
+ }
1422
+ this.logger.warn('A completed run lost its product to a concurrent sibling; re-running its task alone', {
1423
+ taskRef: run.taskRef, runTaskId: run.taskId, ...interference,
1424
+ });
1425
+ let rerun;
1426
+ try {
1427
+ const dispatched = await this.dispatchBuildTask(run.taskRef, session);
1428
+ const rerunTaskId = dispatched.admission?.taskId;
1429
+ rerun = { dispatch: dispatched, outcome: rerunTaskId ? await this.awaitCodingRunOutcome(rerunTaskId, session) : null };
1430
+ }
1431
+ catch (error) {
1432
+ rerun = { error: describeCaughtError(error) };
1433
+ }
1434
+ return { taskRef: run.taskRef, runTaskId: run.taskId, interference, rerun };
848
1435
  }
849
1436
  /**
850
1437
  * Wait for one admitted coding run to SETTLE, then report what it actually did.
@@ -1032,19 +1619,33 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1032
1619
  const resolution = await this.resolveLandedTaskRefs(graph.tasks);
1033
1620
  const landedTaskRefs = resolution.landed;
1034
1621
  const ready = selectReadyBuildPlanTasks(graph, landedTaskRefs);
1622
+ /*
1623
+ * A task the probe calls LANDED, run anyway because the operator says the landing is wrong (#2217). Only a
1624
+ * landed task whose prerequisites have all landed: the override answers "this landing is false", never "skip
1625
+ * the graph". Readiness is otherwise unchanged, and the override is exercised only when it is needed — a
1626
+ * `despiteLanded` on a task that is simply ready runs it as an ordinary dispatch and records nothing.
1627
+ */
1628
+ let forced;
1035
1629
  if (selection !== undefined && !ready.some((candidate) => candidate.taskRef === selection.taskRef)) {
1036
1630
  const named = graph.tasks.find((candidate) => candidate.taskRef === selection.taskRef);
1037
1631
  const standing = named === undefined ? ApplicationBuildTaskStanding.UNKNOWN
1038
1632
  : landedTaskRefs.has(named.taskRef) ? ApplicationBuildTaskStanding.LANDED
1039
1633
  : ApplicationBuildTaskStanding.BLOCKED;
1040
1634
  const unmet = named === undefined ? [] : named.prerequisiteTaskRefs.filter((prerequisite) => !landedTaskRefs.has(prerequisite));
1041
- throw new ApplicationBuildTaskNotReadyError(standing === ApplicationBuildTaskStanding.UNKNOWN ? `The build plan holds no task "${selection.taskRef}".`
1042
- : standing === ApplicationBuildTaskStanding.LANDED ? `Task ${selection.taskRef} has already landed.`
1043
- : `Task ${selection.taskRef} is not ready: it waits on ${unmet.join(', ')}.`, selection.taskRef, standing, unmet);
1635
+ if (standing === ApplicationBuildTaskStanding.LANDED && selection.despiteLanded !== undefined && unmet.length === 0) {
1636
+ forced = named;
1637
+ }
1638
+ else {
1639
+ throw new ApplicationBuildTaskNotReadyError(standing === ApplicationBuildTaskStanding.UNKNOWN ? `The build plan holds no task "${selection.taskRef}".`
1640
+ : standing === ApplicationBuildTaskStanding.LANDED
1641
+ ? `Task ${selection.taskRef} has already landed: its landing probe finds its product committed. If that landing is wrong, `
1642
+ + `run it anyway, saying why: wildo build run ${selection.taskRef} --despite-landed --reason <${OPERATOR_BUILD_TASK_REARM_REASONS.join('|')}> --note "<why>".`
1643
+ : `Task ${selection.taskRef} is not ready: it waits on ${unmet.join(', ')}.`, selection.taskRef, standing, unmet);
1644
+ }
1044
1645
  }
1045
- if (ready.length === 0) {
1646
+ if (ready.length === 0 && forced === undefined) {
1046
1647
  throw new ApplicationBuildPlanExhaustedError(`Every task in the build plan has landed, or none is ready: ${graph.tasks.length} task(s), `
1047
- + `${landedTaskRefs.size} landed.`, graph.tasks.length, landedTaskRefs.size);
1648
+ + `${landedTaskRefs.size} landed.`, graph.tasks.length, landedTaskRefs.size, [...landedTaskRefs].sort());
1048
1649
  }
1049
1650
  /*
1050
1651
  * The FIRST ready task, in graph order — routed by its own `target.kind`, never reordered.
@@ -1074,7 +1675,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1074
1675
  const stuck = [];
1075
1676
  let selected;
1076
1677
  let unanswerableGenerationStep;
1077
- const candidates = selection === undefined ? ready : ready.filter((candidate) => candidate.taskRef === selection.taskRef);
1678
+ const candidates = forced !== undefined ? [forced]
1679
+ : selection === undefined ? ready : ready.filter((candidate) => candidate.taskRef === selection.taskRef);
1078
1680
  // Read ONCE per selection: a wave selects repeatedly over a wide ready set (#1528).
1079
1681
  const inFlightTaskRefs = new Set((await this.dispatch.listInFlightCodingRuns()).flatMap((run) => (run.taskRef ? [run.taskRef] : [])));
1080
1682
  for (const candidate of candidates) {
@@ -1099,7 +1701,12 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1099
1701
  break;
1100
1702
  }
1101
1703
  const stuckEntry = await this.classifyStuckBuildTask(candidate, inFlightTaskRefs);
1102
- if (stuckEntry !== null) {
1704
+ /*
1705
+ * A forced task's earlier COMPLETED run is the very landing the operator overrides, so it does not hold the
1706
+ * task. A live run, a parked session or an undraftable document still does: forcing past those would start
1707
+ * a second agent, abandon a persisted conversation, or spend a turn on a product no run can make.
1708
+ */
1709
+ if (stuckEntry !== null && !(candidate === forced && LANDED_OVERRIDE_RELEASES.has(stuckEntry.reason))) {
1103
1710
  stuck.push(stuckEntry);
1104
1711
  continue;
1105
1712
  }
@@ -1156,7 +1763,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1156
1763
  landedTaskRefs: [...landedTaskRefs].sort(),
1157
1764
  unverifiableLandedTaskRefs: resolution.unverifiableLandedTaskRefs,
1158
1765
  };
1159
- return { kind: 'GENERATION_STEP', plan, task, stuckTasks: stuck };
1766
+ return { kind: 'GENERATION_STEP', plan, task, stuckTasks: stuck, ...(task === forced && selection?.despiteLanded ? { landedOverride: selection.despiteLanded } : {}) };
1160
1767
  }
1161
1768
  const boundary = resolveBuildPlanTaskCodingPolicy(task, this.readApplicationWorkspaceEntries());
1162
1769
  const contract = await this.composeTaskCodingContract(task, boundary, graph.tasks.length);
@@ -1173,7 +1780,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1173
1780
  landedTaskRefs: [...landedTaskRefs].sort(),
1174
1781
  unverifiableLandedTaskRefs: resolution.unverifiableLandedTaskRefs,
1175
1782
  };
1176
- return { kind: 'CODING', plan, contract, stuckTasks: stuck };
1783
+ return { kind: 'CODING', plan, contract, stuckTasks: stuck, ...(task === forced && selection?.despiteLanded ? { landedOverride: selection.despiteLanded } : {}) };
1177
1784
  }
1178
1785
  /**
1179
1786
  * Which tasks have landed, read from GIT.
@@ -1299,6 +1906,22 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1299
1906
  }
1300
1907
  return this.dispatch.rearmBuildTask(taskRef, request, session);
1301
1908
  }
1909
+ /**
1910
+ * Where a task's landing was found: its probes' paths, or a generation step's evidence paths. Empty for a probe
1911
+ * that names no fixed file (a shell surface, a schema-plan state) — the record then says "found" without a place
1912
+ * rather than inventing one.
1913
+ */
1914
+ async resolveLandedEvidencePaths(task) {
1915
+ if (task.target?.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {
1916
+ const condition = await this.generationSteps.resolveGenerationStepLandedCondition(task);
1917
+ return condition.kind === ApplicationBuildGenerationStepLandedKind.COMMITTED_PATHS ? [...condition.paths] : [];
1918
+ }
1919
+ // Only the paths that ARE committed: a label probe reads one candidate per language, and naming the dozens
1920
+ // that do not exist would say the product was found in files that are not there.
1921
+ const candidates = [...new Set(resolveBuildTaskLandedProbes(task).flatMap(landedProbePaths))];
1922
+ const committed = await this.git.selectCommittedPaths(candidates);
1923
+ return candidates.filter((path) => committed.has(path));
1924
+ }
1302
1925
  async describeBuildTaskRecords(session) {
1303
1926
  if (!(await this.hasAuthoredBuildPlan()))
1304
1927
  return undefined;
@@ -1338,6 +1961,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1338
1961
  if (condition.kind === ApplicationBuildGenerationStepLandedKind.SCHEMA_PLAN_IN_SYNC) {
1339
1962
  schemaPlanSyncState = await this.generationSteps.readSchemaPlanSyncState();
1340
1963
  }
1964
+ else if (condition.kind === ApplicationBuildGenerationStepLandedKind.NOT_OWED) {
1965
+ // Unreachable while NOT_OWED always lands, and stated rather than read as "no unmet probe".
1966
+ unmetProbes = [];
1967
+ }
1341
1968
  else {
1342
1969
  unmetProbes = [];
1343
1970
  for (const path of condition.paths) {
@@ -1363,6 +1990,12 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1363
1990
  }
1364
1991
  const waitingOn = status === WorkbenchBuildPlanTaskStatus.BLOCKED
1365
1992
  ? task.prerequisiteTaskRefs.filter((prerequisite) => !resolution.landed.has(prerequisite)) : undefined;
1993
+ // A refused dispatch started nothing, so it does not make the landing the task's own (#1581). Never asserted
1994
+ // on a TRUNCATED listing: an early task's runs may be the ones the page cap dropped, and "never run" would be
1995
+ // false — and an invitation to pay for a re-run (#2217 review).
1996
+ const progress = isGenerationStep ? this.generationSteps.readGenerationStepProgress(task.taskRef) : undefined;
1997
+ const landedBeforeAnyRun = landed && !attemptsTruncated && !attempts.some(isCountedBuildTaskAttempt)
1998
+ ? { probedPaths: await this.resolveLandedEvidencePaths(task) } : undefined;
1366
1999
  records.push({
1367
2000
  taskRef: task.taskRef,
1368
2001
  targetKind: String(task.target?.kind ?? ''),
@@ -1373,6 +2006,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1373
2006
  ...(schemaPlanSyncState !== undefined ? { schemaPlanSyncState } : {}),
1374
2007
  ...(waitingOn !== undefined ? { waitingOn } : {}),
1375
2008
  ...(landed && unverifiable.has(task.taskRef) ? { unverifiable: true } : {}),
2009
+ ...(landedBeforeAnyRun !== undefined ? { landedBeforeAnyRun } : {}),
2010
+ ...(progress !== undefined ? { progress } : {}),
1376
2011
  });
1377
2012
  }
1378
2013
  const stuckByReason = Object.fromEntries(Object.values(Workbench_BuildTaskStuckReason).map((reason) => [reason, records.filter((record) => record.stuck?.reason === reason).length]));
@@ -1385,6 +2020,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1385
2020
  summary: {
1386
2021
  taskCount: records.length,
1387
2022
  landed: records.length - notLanded.length,
2023
+ landedBeforeAnyRun: records.filter((record) => record.landedBeforeAnyRun !== undefined).length,
1388
2024
  blocked: records.filter((record) => record.status === WorkbenchBuildPlanTaskStatus.BLOCKED).length,
1389
2025
  readyNeverAttempted: records.filter((record) => record.status === WorkbenchBuildPlanTaskStatus.READY && started(record).length === 0).length,
1390
2026
  readyToRetry: records.filter((record) => record.status === WorkbenchBuildPlanTaskStatus.READY && started(record).length > 0 && !record.stuck).length,
@@ -1397,6 +2033,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1397
2033
  degree: readBuildParallelism(this.companionContext.saasRoot),
1398
2034
  overlappingAttempts: records.reduce((total, record) => total + record.attempts.filter((attempt) => attempt.concurrency !== undefined).length, 0),
1399
2035
  interferenceSuspectedAttempts: records.reduce((total, record) => total + record.attempts.filter((attempt) => attempt.interferenceSuspected === true).length, 0),
2036
+ interferedCompletedAttempts: records.reduce((total, record) => total + record.attempts.filter((attempt) => attempt.interference !== undefined).length, 0),
1400
2037
  contendedPaths: [...new Set(records.flatMap((record) => record.attempts.flatMap((attempt) => attempt.concurrency?.contendedPaths ?? [])))].sort(),
1401
2038
  },
1402
2039
  },
@@ -1468,7 +2105,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1468
2105
  *
1469
2106
  * Generation-step conditions ARE gathered, by resolving them once into a map the loop then reads.
1470
2107
  * "They are few, and they still resolve per path" was true of the TASKS and wrong about the
1471
- * PATHS: the i18n step's evidence is `planner units x enabled locales`, so three generation-step
2108
+ * PATHS: the i18n steps' evidence is `planner units x their locales`, so three generation-step
1472
2109
  * tasks expanded to seventeen `status --porcelain` spawns per resolution — measured at the spawn
1473
2110
  * site 2026-09-22, where they were the largest source left after the probe paths were batched.
1474
2111
  * Resolving the condition here rather than inside the loop is what lets them join the same batch
@@ -1524,6 +2161,12 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1524
2161
  unanswerable.add(task.taskRef);
1525
2162
  continue;
1526
2163
  }
2164
+ // The application owes this step nothing (a translation step on a one-locale app): landed, or it
2165
+ // would sit at the head of the queue forever on an evidence list that is empty by construction.
2166
+ if (condition.kind === ApplicationBuildGenerationStepLandedKind.NOT_OWED) {
2167
+ landed.add(task.taskRef);
2168
+ continue;
2169
+ }
1527
2170
  if (condition.paths.length === 0)
1528
2171
  continue;
1529
2172
  const committedPaths = await Promise.all(condition.paths.map((path) => committedTree.isCommitted(path)));
@@ -1605,6 +2248,22 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1605
2248
  shellWitness: this.memoizedShellWitness(),
1606
2249
  };
1607
2250
  }
2251
+ /**
2252
+ * The tree as a pathspec commit of `committing` would leave it (#2209): those paths as they stand on disk
2253
+ * (`commitPaths` takes each whole working file), every other path as HEAD has it. Behind the reader shape
2254
+ * landing asks, so the accept asks exactly landing's question of the commit it is about to make.
2255
+ */
2256
+ createProspectiveCommitReader(committing) {
2257
+ const worktree = this.createWorktreeReader();
2258
+ const committed = this.createCommittedTreeReader();
2259
+ return {
2260
+ isCommitted: (path) => (committing.has(path) ? worktree.isCommitted(path) : committed.isCommitted(path)),
2261
+ readText: (path) => (committing.has(path) ? worktree.readText(path) : committed.readText(path)),
2262
+ primeCommitted: (paths) => committed.primeCommitted(paths.filter((path) => !committing.has(path))),
2263
+ primeTexts: (paths) => committed.primeTexts(paths.filter((path) => !committing.has(path))),
2264
+ shellWitness: committed.shellWitness,
2265
+ };
2266
+ }
1608
2267
  /** A fresh {@link CommittedTreeReader} for one landing resolution; never shared across resolutions. */
1609
2268
  createCommittedTreeReader() {
1610
2269
  const committed = new Map();
@@ -1652,11 +2311,13 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1652
2311
  *
1653
2312
  * A declaration is matched as a WHOLE WORD, not as a substring. `deal.schemas.ts` carries prose
1654
2313
  * naming its own build tasks, so a bare `includes` would find `pipelineStageId` inside a comment
1655
- * that merely mentions it and report a task landed on its own documentation. Whole-word matching
1656
- * still counts a mention in a comment — an AST question is the sound version and needs the
1657
- * introspection subprocess — so this errs toward LANDED only for a file that names the symbol
1658
- * without declaring it, and never for the scaffold shapes that produced #597, where the symbol is
1659
- * absent entirely.
2314
+ * that merely mentions it and report a task landed on its own documentation. A TypeScript or
2315
+ * JavaScript file is read with its comments blanked first (#2216), because whole-word matching alone
2316
+ * counted a mention in a comment: a page task wrote every section ref of its plan into its sections
2317
+ * file's header, and 18 section tasks of `app-creation-test-004` read landed with no section written.
2318
+ * A STRING mention still counts — an AST question is the sound version and needs the introspection
2319
+ * subprocess — so this errs toward LANDED only for a file that names the symbol in code without
2320
+ * declaring it, and never for the scaffold shapes that produced #597, where the symbol is absent.
1660
2321
  */
1661
2322
  /** A once-per-reader memo of {@link resolveShellWitness}, so a landing resolution introspects at most once. */
1662
2323
  memoizedShellWitness() {
@@ -1766,19 +2427,24 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1766
2427
  return tree.isCommitted(probe.path);
1767
2428
  case BuildPlanTaskLandedProbeKind.COMMITTED_FILE_DECLARES: {
1768
2429
  const text = await tree.readText(probe.path);
1769
- if (text === undefined)
2430
+ if (typeof text !== 'string')
1770
2431
  return false;
1771
2432
  /*
1772
2433
  * The probe's SITE says whether the declarations are a set or a relation, and where a relation
1773
2434
  * must sit (#1539). A relation read as a set reports a missing edge as landed (#1273 — six of
1774
2435
  * eleven relationship tasks).
1775
2436
  */
1776
- return declarationsAppearAt(text, probe.declarations, probe.site);
2437
+ // The PATH rides along so a script source is read with its comments blanked (#2216): prose naming a
2438
+ // product is not the product.
2439
+ return declarationsAppearAt(text, probe.declarations, probe.site, probe.path);
1777
2440
  }
1778
2441
  case BuildPlanTaskLandedProbeKind.ANY_COMMITTED_FILE_DECLARES: {
1779
2442
  const texts = await Promise.all(probe.paths.map((path) => tree.readText(path)));
1780
- return texts.some((text) => text !== undefined && declarationsAppearAt(text, probe.declarations, probe.site));
2443
+ return texts.some((text, index) => typeof text === 'string' && declarationsAppearAt(text, probe.declarations, probe.site, probe.paths[index]));
1781
2444
  }
2445
+ // #2216: a section's words, in every committed locale pack.
2446
+ case BuildPlanTaskLandedProbeKind.COMMITTED_LABEL_PACKS_DECLARE:
2447
+ return labelPacksDeclareKeyPrefix(await Promise.all(probe.paths.map((path) => tree.readText(path))), probe.keyPrefix);
1782
2448
  case BuildPlanTaskLandedProbeKind.SHELL_SURFACE_CARRIES_PLAN:
1783
2449
  case BuildPlanTaskLandedProbeKind.SHELL_CARRIES_A_PLACEMENT:
1784
2450
  return (await this.explainShellProbe(probe, tree)).satisfied;
@@ -1831,7 +2497,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1831
2497
  if (blocking.length > 0) {
1832
2498
  throw new ApplicationBuildPlanUnavailableError(`The application's build plan fails semantic validation: ${blocking.slice(0, 3).map((finding) => finding.message).join('; ')}`);
1833
2499
  }
1834
- return this.withHostDerivedDocumentationPublicationStep(await this.withHostDerivedMigrationStep(parsed.data));
2500
+ return this.withHostDerivedTranslationStep(this.withHostDerivedDocumentationPublicationStep(await this.withHostDerivedMigrationStep(parsed.data)));
1835
2501
  }
1836
2502
  /**
1837
2503
  * The build plan as the DISPATCH HOST reads it: the authored graph, plus the `database-migrations`
@@ -1883,6 +2549,65 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1883
2549
  * clean plan generates nothing" — true of a clean plan, false of an unanswerable one, where offering
1884
2550
  * it first made every dispatch fail and stopped the whole plan (review, 2026-09-13).
1885
2551
  */
2552
+ /**
2553
+ * A plan that generates labels, for an application that enables more than one locale, owes a step
2554
+ * that TRANSLATES them (#2204).
2555
+ *
2556
+ * Translation used to be the second half of `i18n-labels`, so the graph had no node for "the labels
2557
+ * exist" separate from "every locale is translated", and every step that needed only the first
2558
+ * waited for the second. Measured on app-creation-test-004 (2026-10-01): the primary-locale labels
2559
+ * existed within minutes, translation into four locales ran for hours, and the documentation portal
2560
+ * — which reads primary-locale labels only — stayed dark the whole time.
2561
+ *
2562
+ * Derived rather than authored, for the reason {@link withHostDerivedMigrationStep} is: the
2563
+ * obligation follows from what the application declares (a second enabled locale) and from the plan
2564
+ * carrying a labels step, not from a decision the plan makes. A plan that authors its own
2565
+ * `i18n-translations` step gets none derived.
2566
+ *
2567
+ * - **Its only prerequisite is the labels step**, since translation reads the primary-locale files.
2568
+ * - **Nothing is made to depend on it.** The website and the application read their label files at
2569
+ * run time, so a translation landing needs no republish, and the portal is single-locale (#1993).
2570
+ * - **A one-locale application gets nothing**: the step would have no evidence paths, and an empty
2571
+ * list never lands, so it would sit at the head of the queue forever.
2572
+ */
2573
+ withHostDerivedTranslationStep(graph) {
2574
+ const isGenerationStep = (task, step) => task.target?.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP && task.target.generationStepRef === step;
2575
+ if (graph.tasks.some((task) => isGenerationStep(task, ApplicationBuildGenerationStep.I18N_TRANSLATIONS)))
2576
+ return graph;
2577
+ const labelStepRefs = graph.tasks
2578
+ .filter((task) => isGenerationStep(task, ApplicationBuildGenerationStep.I18N_LABELS))
2579
+ .map((task) => task.taskRef);
2580
+ if (labelStepRefs.length === 0)
2581
+ return graph;
2582
+ if (this.generationSteps.resolveTranslationTargetLocales().length === 0)
2583
+ return graph;
2584
+ if (graph.tasks.some((task) => task.taskRef === HOST_DERIVED_I18N_TRANSLATIONS_TASK_REF)) {
2585
+ // Same refusal as the other derived steps: a duplicate ref is rejected by the graph schema.
2586
+ this.logger.warn?.(`The build plan owes an i18n-translations step, but "${HOST_DERIVED_I18N_TRANSLATIONS_TASK_REF}" already names another task; not deriving it.`);
2587
+ return graph;
2588
+ }
2589
+ return BuildPlanTaskGraphSchema.parse({
2590
+ ...graph,
2591
+ tasks: [
2592
+ ...graph.tasks,
2593
+ {
2594
+ taskRef: HOST_DERIVED_I18N_TRANSLATIONS_TASK_REF,
2595
+ objective: 'Translate the application\'s labels into every enabled locale other than the primary one. '
2596
+ + 'Derived by the dispatch host because the build plan generates primary-locale labels and the application '
2597
+ + 'enables further locales.',
2598
+ target: {
2599
+ kind: BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP,
2600
+ generationStepRef: ApplicationBuildGenerationStep.I18N_TRANSLATIONS,
2601
+ },
2602
+ produces: [],
2603
+ functionalTopic: MetaWorkflow_FunctionalTopic.ASSEMBLE_VERIFY_AND_ITERATE,
2604
+ skillRefs: ['i18n-translation-rerun'],
2605
+ prerequisiteTaskRefs: labelStepRefs,
2606
+ servesRefs: [],
2607
+ },
2608
+ ],
2609
+ });
2610
+ }
1886
2611
  /**
1887
2612
  * A plan that authors documentation CHAPTERS owes a step that PUBLISHES them.
1888
2613
  *
@@ -1911,6 +2636,11 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1911
2636
  *
1912
2637
  * Both are read off the graph, so a plan with no labels step simply contributes no such edge
1913
2638
  * rather than acquiring a dangling one.
2639
+ *
2640
+ * `i18n-labels` means the PRIMARY locale only. Translation is the separate `i18n-translations` step
2641
+ * ({@link withHostDerivedTranslationStep}), and publication deliberately has no edge to it: the
2642
+ * portal reads primary-locale labels and nothing else, so waiting on translation only kept it dark
2643
+ * for hours (#2204).
1914
2644
  */
1915
2645
  withHostDerivedDocumentationPublicationStep(graph) {
1916
2646
  const authorsPublicationStep = graph.tasks.some((task) => task.target?.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP
@@ -2090,6 +2820,21 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2090
2820
  catch (error) {
2091
2821
  this.logDebug('Previous-attempt source omitted from the dispatch context', { taskRef: task.taskRef, error: String(error) });
2092
2822
  }
2823
+ /*
2824
+ * WHAT HAPPENED TO THE LAST COMPLETED ATTEMPT, when a sibling overwrote its product (#2210). The re-run
2825
+ * meets a shared file that now holds other tasks' entries and not its own; told nothing, an agent may
2826
+ * "restore" the file to what it wrote last time and remove theirs. Only the LATEST completed run is
2827
+ * read, so a task that has since completed cleanly is not told about an old collision. Best-effort.
2828
+ */
2829
+ try {
2830
+ const [latestCompleted] = [...(await this.dispatch.listCompletedRunsForBuildTask(task.taskRef))]
2831
+ .sort((left, right) => (right.completedAt ?? '').localeCompare(left.completedAt ?? ''));
2832
+ if (latestCompleted?.interference !== undefined)
2833
+ sources.push(interferedAttemptContextSource(latestCompleted.taskId, latestCompleted.interference));
2834
+ }
2835
+ catch (error) {
2836
+ this.logDebug('Interfered-attempt source omitted from the dispatch context', { taskRef: task.taskRef, error: String(error) });
2837
+ }
2093
2838
  /*
2094
2839
  * The DOOR MENU — tier-0 of the pull half: the live-query ids and the two commands that expand
2095
2840
  * them. Ids only, not descriptions: `wildo context list` IS the descriptions, one command away,
@@ -2292,10 +3037,11 @@ ApplicationBuildDispatchCompanionService = __decorate([
2292
3037
  __param(5, inject(COMPANION_SERVICE_TYPES.IntrospectionService)),
2293
3038
  __param(6, inject(SAAS_SERVICE_TYPES.ActorsSystemBackendService)),
2294
3039
  __param(7, inject(COMPANION_SERVICE_TYPES.ExecutionsService)),
3040
+ __param(8, inject(COMPANION_SERVICE_TYPES.AcceptedChangeCommitService)),
2295
3041
  __metadata("design:paramtypes", [Function, Object, CodingAgentDispatchCompanionService,
2296
3042
  GitChangeSetCompanionService,
2297
3043
  ApplicationBuildGenerationStepCompanionService,
2298
- CompanionIntrospectionService, Function, CompanionExecutionsCompanionService])
3044
+ CompanionIntrospectionService, Function, CompanionExecutionsCompanionService, Function])
2299
3045
  ], ApplicationBuildDispatchCompanionService);
2300
3046
  export { ApplicationBuildDispatchCompanionService };
2301
3047
  /**
@@ -2353,6 +3099,26 @@ export function previousAttemptContextSource(run) {
2353
3099
  },
2354
3100
  };
2355
3101
  }
3102
+ /**
3103
+ * The previous COMPLETED attempt lost its product to a concurrent run (#2210). Pure, so what the re-run is
3104
+ * told can be pinned without composing a dispatch.
3105
+ */
3106
+ export function interferedAttemptContextSource(runTaskId, interference) {
3107
+ return {
3108
+ sourceRef: 'application-creation:context/interfered-attempt',
3109
+ originRef: 'application-creation:origin/dev-companion',
3110
+ content: {
3111
+ guidance: 'The previous attempt of this task COMPLETED, but other tasks running at the same time edited the same '
3112
+ + 'file(s) and its product was overwritten before it was committed. Nothing about the approach was judged. '
3113
+ + 'The files below are SHARED: open them as they stand now, add this task\'s product beside what the other '
3114
+ + 'tasks put there, and do not remove or rewrite entries this task did not author.',
3115
+ runTaskId,
3116
+ sharedFiles: interference.contendedProductPaths,
3117
+ concurrentTasks: interference.overlappingTaskRefs,
3118
+ detectedAt: interference.detectedAt,
3119
+ },
3120
+ };
3121
+ }
2356
3122
  /**
2357
3123
  * The task's own DETERMINISTIC self-description — no introspection, no LLM.
2358
3124
  *