@wildo-ai/dev-companion 1.1.14 → 1.1.16

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 (191) hide show
  1. package/dist/esm/.tsbuildinfo +1 -1
  2. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +233 -6
  3. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts.map +1 -1
  4. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js +316 -13
  5. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
  6. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts +48 -2
  7. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts.map +1 -1
  8. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js +41 -3
  9. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js.map +1 -1
  10. package/dist/esm/claude-cli/models/isolated-recheck-interference.models.d.ts +68 -0
  11. package/dist/esm/claude-cli/models/isolated-recheck-interference.models.d.ts.map +1 -0
  12. package/dist/esm/claude-cli/models/isolated-recheck-interference.models.js +198 -0
  13. package/dist/esm/claude-cli/models/isolated-recheck-interference.models.js.map +1 -0
  14. package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.d.ts +6 -0
  15. package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.d.ts.map +1 -1
  16. package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.js.map +1 -1
  17. package/dist/esm/claude-cli/models/verification-tool-availability.models.d.ts +19 -5
  18. package/dist/esm/claude-cli/models/verification-tool-availability.models.d.ts.map +1 -1
  19. package/dist/esm/claude-cli/models/verification-tool-availability.models.js +17 -5
  20. package/dist/esm/claude-cli/models/verification-tool-availability.models.js.map +1 -1
  21. package/dist/esm/claude-cli/models/workspace-path-claims.models.d.ts +138 -0
  22. package/dist/esm/claude-cli/models/workspace-path-claims.models.d.ts.map +1 -0
  23. package/dist/esm/claude-cli/models/workspace-path-claims.models.js +204 -0
  24. package/dist/esm/claude-cli/models/workspace-path-claims.models.js.map +1 -0
  25. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts +36 -1
  26. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts.map +1 -1
  27. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +71 -16
  28. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js.map +1 -1
  29. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +234 -9
  30. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
  31. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +1073 -182
  32. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
  33. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts +14 -0
  34. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts.map +1 -1
  35. package/dist/esm/claude-cli/services/research-evidence-store.companion.js +35 -0
  36. package/dist/esm/claude-cli/services/research-evidence-store.companion.js.map +1 -1
  37. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.d.ts +36 -0
  38. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.d.ts.map +1 -0
  39. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.js +134 -0
  40. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.js.map +1 -0
  41. package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
  42. package/dist/esm/companion-api/controllers/companion.controller.js +7 -1
  43. package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
  44. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js +1 -1
  45. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js.map +1 -1
  46. package/dist/esm/core/introspection/services/translation-placement.companion.service.d.ts +3 -2
  47. package/dist/esm/core/introspection/services/translation-placement.companion.service.d.ts.map +1 -1
  48. package/dist/esm/core/introspection/services/translation-placement.companion.service.js.map +1 -1
  49. package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.d.ts +13 -0
  50. package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.d.ts.map +1 -1
  51. package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.js +98 -16
  52. package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.js.map +1 -1
  53. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.d.ts.map +1 -1
  54. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js +24 -14
  55. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js.map +1 -1
  56. package/dist/esm/core/introspection/workspace-element-index.companion.d.ts +42 -0
  57. package/dist/esm/core/introspection/workspace-element-index.companion.d.ts.map +1 -1
  58. package/dist/esm/core/introspection/workspace-element-index.companion.js +42 -0
  59. package/dist/esm/core/introspection/workspace-element-index.companion.js.map +1 -1
  60. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts +53 -0
  61. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts.map +1 -1
  62. package/dist/esm/core/runtime/dev-compile-quiet.companion.js +119 -2
  63. package/dist/esm/core/runtime/dev-compile-quiet.companion.js.map +1 -1
  64. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
  65. package/dist/esm/core/runtime/services/start-companion-application.service.js +13 -1
  66. package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
  67. package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts +2 -2
  68. package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts.map +1 -1
  69. package/dist/esm/core/runtime/utils/companion-platform-config.companion.js +6 -6
  70. package/dist/esm/core/runtime/utils/companion-platform-config.companion.js.map +1 -1
  71. package/dist/esm/email/services/email-template.companion.service.d.ts +5 -0
  72. package/dist/esm/email/services/email-template.companion.service.d.ts.map +1 -1
  73. package/dist/esm/email/services/email-template.companion.service.js +44 -11
  74. package/dist/esm/email/services/email-template.companion.service.js.map +1 -1
  75. package/dist/esm/email/utils/email-template-fs-discovery.utils.d.ts +26 -2
  76. package/dist/esm/email/utils/email-template-fs-discovery.utils.d.ts.map +1 -1
  77. package/dist/esm/email/utils/email-template-fs-discovery.utils.js +41 -2
  78. package/dist/esm/email/utils/email-template-fs-discovery.utils.js.map +1 -1
  79. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.d.ts +19 -0
  80. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.d.ts.map +1 -0
  81. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.js +171 -0
  82. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.js.map +1 -0
  83. package/dist/esm/email/utils/module-email-root.companion.utils.d.ts +75 -0
  84. package/dist/esm/email/utils/module-email-root.companion.utils.d.ts.map +1 -0
  85. package/dist/esm/email/utils/module-email-root.companion.utils.js +162 -0
  86. package/dist/esm/email/utils/module-email-root.companion.utils.js.map +1 -0
  87. package/dist/esm/expert-personas/services/expert-persona.companion.service.d.ts +21 -1
  88. package/dist/esm/expert-personas/services/expert-persona.companion.service.d.ts.map +1 -1
  89. package/dist/esm/expert-personas/services/expert-persona.companion.service.js +35 -3
  90. package/dist/esm/expert-personas/services/expert-persona.companion.service.js.map +1 -1
  91. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.d.ts +62 -0
  92. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.d.ts.map +1 -0
  93. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.js +62 -0
  94. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.js.map +1 -0
  95. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.d.ts +62 -0
  96. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.d.ts.map +1 -0
  97. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.js +62 -0
  98. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.js.map +1 -0
  99. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts +1 -0
  100. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts.map +1 -1
  101. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js +1 -0
  102. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js.map +1 -1
  103. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.d.ts +1 -0
  104. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.d.ts.map +1 -1
  105. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.js +1 -0
  106. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.js.map +1 -1
  107. package/dist/esm/i18n/resources/workbenchAspects.en.d.ts.map +1 -1
  108. package/dist/esm/i18n/resources/workbenchAspects.en.js +4 -0
  109. package/dist/esm/i18n/resources/workbenchAspects.en.js.map +1 -1
  110. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +35 -0
  111. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
  112. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +12 -0
  113. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -1
  114. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts +536 -531
  115. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts.map +1 -1
  116. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js +536 -531
  117. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js.map +1 -1
  118. package/dist/esm/i18n/system_enums/workbench-build.en.d.ts +3 -3
  119. package/dist/esm/i18n/system_enums/workbench-build.en.js +3 -3
  120. package/dist/esm/i18n/system_enums/workbench-build.en.js.map +1 -1
  121. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.d.ts.map +1 -1
  122. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js +7 -3
  123. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js.map +1 -1
  124. package/dist/esm/meta-workflows/models/carried-verification-failure.models.d.ts +23 -0
  125. package/dist/esm/meta-workflows/models/carried-verification-failure.models.d.ts.map +1 -1
  126. package/dist/esm/meta-workflows/models/carried-verification-failure.models.js +14 -0
  127. package/dist/esm/meta-workflows/models/carried-verification-failure.models.js.map +1 -1
  128. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.d.ts +21 -1
  129. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.d.ts.map +1 -1
  130. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js +117 -3
  131. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js.map +1 -1
  132. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.d.ts +5 -0
  133. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.d.ts.map +1 -1
  134. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.js +22 -1
  135. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.js.map +1 -1
  136. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +98 -24
  137. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  138. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +439 -93
  139. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  140. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts +21 -8
  141. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts.map +1 -1
  142. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js +74 -12
  143. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js.map +1 -1
  144. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +47 -1
  145. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
  146. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +98 -9
  147. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
  148. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +39 -3
  149. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
  150. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js +224 -48
  151. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
  152. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.d.ts +45 -0
  153. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.d.ts.map +1 -1
  154. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js +74 -0
  155. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js.map +1 -1
  156. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.d.ts +12 -0
  157. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.d.ts.map +1 -1
  158. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.js +30 -1
  159. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.js.map +1 -1
  160. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts.map +1 -1
  161. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js +21 -2
  162. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js.map +1 -1
  163. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +71 -5
  164. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
  165. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +219 -17
  166. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  167. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.d.ts +55 -1
  168. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.d.ts.map +1 -1
  169. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.js +157 -10
  170. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.js.map +1 -1
  171. package/dist/esm/meta-workflows/services/website-demo-facts.models.d.ts +19 -1
  172. package/dist/esm/meta-workflows/services/website-demo-facts.models.d.ts.map +1 -1
  173. package/dist/esm/meta-workflows/services/website-demo-facts.models.js +7 -5
  174. package/dist/esm/meta-workflows/services/website-demo-facts.models.js.map +1 -1
  175. package/dist/esm/module-layout/module-layout-convention.companion.d.ts +158 -0
  176. package/dist/esm/module-layout/module-layout-convention.companion.d.ts.map +1 -0
  177. package/dist/esm/module-layout/module-layout-convention.companion.js +272 -0
  178. package/dist/esm/module-layout/module-layout-convention.companion.js.map +1 -0
  179. package/dist/esm/module-layout/module-layout-inspection.companion.d.ts +42 -0
  180. package/dist/esm/module-layout/module-layout-inspection.companion.d.ts.map +1 -0
  181. package/dist/esm/module-layout/module-layout-inspection.companion.js +290 -0
  182. package/dist/esm/module-layout/module-layout-inspection.companion.js.map +1 -0
  183. package/dist/esm/module-layout/module-source-files.companion.d.ts +3 -0
  184. package/dist/esm/module-layout/module-source-files.companion.d.ts.map +1 -0
  185. package/dist/esm/module-layout/module-source-files.companion.js +45 -0
  186. package/dist/esm/module-layout/module-source-files.companion.js.map +1 -0
  187. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.d.ts +2 -0
  188. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.d.ts.map +1 -1
  189. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.js +3 -1
  190. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.js.map +1 -1
  191. package/package.json +17 -17
@@ -145,8 +145,10 @@ export interface DerivedFollowUp {
145
145
  */
146
146
  readonly targetKey: string;
147
147
  /**
148
- * What it waits on before the chain link: its first report's origin (`followUpOf` reads it), never every origin it
149
- * carries (#3204). {@link chainFollowUpAfter} appends the follow-up before it on its target.
148
+ * What it waits on before the chain link: its first report's origin (`followUpOf` reads it, so it stays FIRST), never
149
+ * every origin it carries (#3204); the owner its gaps were reported as (#3886); and, for a routed follow-up with no
150
+ * owner, the planned tasks of the scope it was routed to (#3991). {@link chainFollowUpAfter} appends the follow-up
151
+ * before it on its target.
150
152
  */
151
153
  readonly ownPrerequisiteTaskRefs: readonly string[];
152
154
  /**
@@ -196,8 +198,8 @@ export interface FollowUpDerivation {
196
198
  */
197
199
  export declare function deriveFollowUpTaskRef(originTaskRef: string, reportingRunTaskId: string): string;
198
200
  /**
199
- * A follow-up waiting on its first report's origin, on the planned task its gaps were reported as owned by (#3886, both in
200
- * `ownPrerequisiteTaskRefs`) and, when there is one, on the follow-up before it on its target. One function, so the
201
+ * A follow-up waiting on what it waits on by itself (`ownPrerequisiteTaskRefs`: its first report's origin, its gaps' owner
202
+ * (#3886) or its routed scope's planned tasks (#3991)) and, when there is one, on the follow-up before it on its target. One function, so the
201
203
  * dispatch host can re-link a follow-up after one it could not append (a name collision, a schema refusal): a chain
202
204
  * naming a task the plan does not hold would make the plan unreadable.
203
205
  */
@@ -226,11 +228,17 @@ export declare function targetKey(target: BuildPlanTask['target']): string;
226
228
  * the wave re-run each alone). Report order rather than plan order, so a new report always joins the TAIL: in plan
227
229
  * order, an origin earlier in the plan reporting later went to the head, made a running follow-up wait on it, and was
228
230
  * ready at once beside it (review of f077ae7db). A follow-up declares no product, so no interference check could see it.
229
- * - **It waits on its first report's origin only**: the chain already holds a target's later follow-ups behind the earlier
231
+ * - **Of the origins it carries, it waits on its first report's only**: the chain already holds a target's later follow-ups behind the earlier
230
232
  * ones, so waiting on every absorbed origin would hold all their gaps behind any one of them that never lands.
231
- * - **It does not wait on the other tasks serving its requirements**, only names them: a task that never lands would hold
232
- * it for ever. Waiting was weighed again for #3204 and would not have helped: on the reference run the sections reported
233
- * their gaps after most of the product tasks serving them had run.
233
+ * - **It does not wait on the other tasks serving its requirements across the plan**, only names them: a task that never
234
+ * lands would hold it for ever. Waiting was weighed again for #3204 and would not have helped: on that reference run the
235
+ * sections reported their gaps after most of the product tasks serving them had run.
236
+ * - **Except the tasks of the scope it was ROUTED to (#3991)**, when no owner was named. A routed follow-up writes their
237
+ * scope, so running before them does their work: on reference run 43876218697 a routed gap overtook the planned
238
+ * provider-binding task and did its whole job. Waiting on them costs only when one never lands, and then the gap is that
239
+ * task's and stays open under it; once they land, a run of theirs that states it met drops the gap (#3227). Absorbed
240
+ * reports add their scope's tasks too: they are the same scope. An OWNED gap waits on its named owner instead (#3886),
241
+ * so owners never wait on each other.
234
242
  *
235
243
  * ## A gap a later run STATED met is dropped; silence drops nothing
236
244
  *
@@ -262,6 +270,11 @@ export declare function deriveBuildPlanFollowUpTasks(input: {
262
270
  */
263
271
  readonly absorption?: FollowUpAbsorptionInputs;
264
272
  }): FollowUpDerivation;
273
+ /**
274
+ * Every planned task that waits, directly or through others, on one of `taskRefs` (#3999): the plan's later work on what
275
+ * they built. Follow-ups are never in it, so a follow-up waiting on these can close no cycle.
276
+ */
277
+ export declare function planTasksDownstreamOf(taskRefs: readonly string[], planTasks: readonly BuildPlanTask[]): ReadonlySet<string>;
265
278
  /**
266
279
  * The owner a report named for a gap, when the plan can honour it (#3886): a planned task (never a follow-up), not the
267
280
  * origin itself, that serves the very requirement. Anything else is ignored and the gap is an ordinary one.
@@ -1 +1 @@
1
- {"version":3,"file":"application-build-follow-up-derivation.companion.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/services/application-build-follow-up-derivation.companion.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,KAAK,aAAa,EAAE,MAAM,oDAAoD,CAAC;AAEjH,OAAO,KAAK,EAAE,+BAA+B,EAAE,iCAAiC,EAAE,MAAM,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a,EAAE,CAAC;IACzC,QAAQ,CAAC,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;CACzE,GAAG,SAAS,mBAAmB,EAAE,CA4CjC;AAED,mHAAmH;AACnH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,qGAAqG;IACrG,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yHAAyH;IACzH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,YAAY,CAAC,CAAC;IAC1E,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IACxE,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC9C,GAAG,SAAS,eAAe,EAAE,CAmB7B"}
1
+ {"version":3,"file":"application-build-follow-up-derivation.companion.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/services/application-build-follow-up-derivation.companion.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,KAAK,aAAa,EAAE,MAAM,oDAAoD,CAAC;AAEjH,OAAO,KAAK,EAAE,+BAA+B,EAAE,iCAAiC,EAAE,MAAM,sDAAsD,CAAC;AAG/I;;;;GAIG;AACH,eAAO,MAAM,sCAAsC,0BAA0B,CAAC;AAE9E,yEAAyE;AACzE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QA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AAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;CACzE,GAAG,SAAS,mBAAmB,EAAE,CA4CjC;AAED,mHAAmH;AACnH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,qGAAqG;IACrG,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yHAAyH;IACzH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,YAAY,CAAC,CAAC;IAC1E,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IACxE,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC9C,GAAG,SAAS,eAAe,EAAE,CAmB7B"}
@@ -177,8 +177,8 @@ export function deriveFollowUpTaskRef(originTaskRef, reportingRunTaskId) {
177
177
  return `${HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX}${origin}-${digest(reportingRunTaskId).slice(0, 6)}`;
178
178
  }
179
179
  /**
180
- * A follow-up waiting on its first report's origin, on the planned task its gaps were reported as owned by (#3886, both in
181
- * `ownPrerequisiteTaskRefs`) and, when there is one, on the follow-up before it on its target. One function, so the
180
+ * A follow-up waiting on what it waits on by itself (`ownPrerequisiteTaskRefs`: its first report's origin, its gaps' owner
181
+ * (#3886) or its routed scope's planned tasks (#3991)) and, when there is one, on the follow-up before it on its target. One function, so the
182
182
  * dispatch host can re-link a follow-up after one it could not append (a name collision, a schema refusal): a chain
183
183
  * naming a task the plan does not hold would make the plan unreadable.
184
184
  */
@@ -213,11 +213,17 @@ export function targetKey(target) {
213
213
  * the wave re-run each alone). Report order rather than plan order, so a new report always joins the TAIL: in plan
214
214
  * order, an origin earlier in the plan reporting later went to the head, made a running follow-up wait on it, and was
215
215
  * ready at once beside it (review of f077ae7db). A follow-up declares no product, so no interference check could see it.
216
- * - **It waits on its first report's origin only**: the chain already holds a target's later follow-ups behind the earlier
216
+ * - **Of the origins it carries, it waits on its first report's only**: the chain already holds a target's later follow-ups behind the earlier
217
217
  * ones, so waiting on every absorbed origin would hold all their gaps behind any one of them that never lands.
218
- * - **It does not wait on the other tasks serving its requirements**, only names them: a task that never lands would hold
219
- * it for ever. Waiting was weighed again for #3204 and would not have helped: on the reference run the sections reported
220
- * their gaps after most of the product tasks serving them had run.
218
+ * - **It does not wait on the other tasks serving its requirements across the plan**, only names them: a task that never
219
+ * lands would hold it for ever. Waiting was weighed again for #3204 and would not have helped: on that reference run the
220
+ * sections reported their gaps after most of the product tasks serving them had run.
221
+ * - **Except the tasks of the scope it was ROUTED to (#3991)**, when no owner was named. A routed follow-up writes their
222
+ * scope, so running before them does their work: on reference run 43876218697 a routed gap overtook the planned
223
+ * provider-binding task and did its whole job. Waiting on them costs only when one never lands, and then the gap is that
224
+ * task's and stays open under it; once they land, a run of theirs that states it met drops the gap (#3227). Absorbed
225
+ * reports add their scope's tasks too: they are the same scope. An OWNED gap waits on its named owner instead (#3886),
226
+ * so owners never wait on each other.
221
227
  *
222
228
  * ## A gap a later run STATED met is dropped; silence drops nothing
223
229
  *
@@ -399,6 +405,7 @@ export function deriveBuildPlanFollowUpTasks(input) {
399
405
  .filter((task) => !originRefs.includes(task.taskRef) && requirementRefs.some((ref) => task.servesRefs.includes(ref)))
400
406
  .map((task) => task.taskRef))];
401
407
  const builtBy = [...new Set(all.flatMap((group) => group.scope.servingTaskRefs))];
408
+ const downstreamOfOrigins = planTasksDownstreamOf(originRefs, planTasks);
402
409
  const describe = (groupGaps) => {
403
410
  const byRequirement = new Map();
404
411
  for (const gap of groupGaps)
@@ -409,36 +416,70 @@ export function deriveBuildPlanFollowUpTasks(input) {
409
416
  const own = contributions.filter(([group]) => group.scope.servingTaskRefs.length === 0);
410
417
  const presenters = [...new Set(routed.map(([group]) => group.origin.taskRef))];
411
418
  const reporters = [...new Set(own.map(([group]) => group.origin.taskRef))];
419
+ /*
420
+ * A ROUTED follow-up waits for the planned tasks whose scope it writes (#3991), as an owned one waits for its named
421
+ * owner (#3886). Measured on reference run 43876218697: a website page reported that the daily digest reached no
422
+ * inbox, the gap was routed to `build-task-brevo-provider-binding`'s scope while that task was still blocked, and the
423
+ * follow-up did the whole binding itself (installed the provider, bound it) ahead of the task planned for it.
424
+ *
425
+ * Narrower than what #3204 refused: not every task serving the requirement across the plan, only those whose own
426
+ * scope this follow-up writes, so the work it would do is exactly theirs. One that never lands leaves the gap open
427
+ * under it. Once they land, a run of theirs that states the requirement met drops the gap (#3227) at no run's cost.
428
+ */
429
+ /*
430
+ * An UNOWNED follow-up also waits for the planned tasks DOWNSTREAM of its origins that serve the same requirement
431
+ * (#3999). What a stage reports missing lies outside its own scope, and planned later work is what delivers it.
432
+ * Measured on reference run 43961156770: a communication schema reported its resource "not yet linked to its
433
+ * contact, customer…", and the follow-up wrote the module's relationships before the planned relationships task,
434
+ * whose prerequisites (the customer, contact and job configs) had not landed. Once they land, a run of theirs that
435
+ * states the requirement met drops the gap at no run's cost (#3227).
436
+ */
437
+ const downstreamServing = anchor.owner !== undefined ? [] : servingTasks.filter((ref) => downstreamOfOrigins.has(ref));
438
+ // Owned: the named owner (#3886), so one owner never holds another's gaps. Routed and unowned: the scope's tasks.
439
+ const ownPrerequisiteTaskRefs = [...new Set([anchor.origin.taskRef, ...(anchor.owner !== undefined ? [anchor.owner] : [...builtBy, ...downstreamServing])])];
412
440
  const objective = (routed.length > 0
413
441
  ? `${presenters.join(', ')} ${presenters.length > 1 ? 'present' : 'presents'} the product and reported that the product does not yet deliver: `
414
442
  + describe(routed.flatMap(([, contributed]) => contributed))
415
- + ` Build what is missing in this scope, where ${builtBy.join(', ')} built the requirement; a page cannot. `
443
+ // Only an UNOWNED routed follow-up waits for the scope's tasks, so only it may say they built it (#3991).
444
+ + (anchor.owner === undefined
445
+ ? ` Build what is missing in this scope, where ${builtBy.join(', ')} ${builtBy.length > 1 ? 'have' : 'has'} built the requirement; a page cannot. `
446
+ : ` Build what is missing in the scope of ${builtBy.join(', ')}; a page cannot. `)
416
447
  + 'If what is missing lies outside this scope, change nothing and report it. '
417
448
  : '')
418
449
  + (own.length > 0 ? `Meet what ${reporters.join(', ')} reported still unmet: ${describe(own.flatMap(([, contributed]) => contributed))} ` : '')
419
450
  + (contributions.length > 1 ? 'These reports were gathered into this one task because they concern this one scope: answer each. ' : '')
420
451
  + 'Read what is already built first: if a task that ran since has met one, change nothing for it and say so. '
421
452
  + (anchor.owner !== undefined ? `It was reported as ${anchor.owner}'s own work, so it runs once that task has landed: read what it built, and change nothing for a gap it met. ` : '')
422
- + (servingTasks.length > 0 ? `Other tasks serving them: ${servingTasks.join(', ')}; their work is theirs. ` : '')
453
+ // Every serving task it does not wait on: their work is theirs, whether or not it has run yet.
454
+ + (servingTasks.some((ref) => !ownPrerequisiteTaskRefs.includes(ref)) ? `Other tasks serving them: ${servingTasks.filter((ref) => !ownPrerequisiteTaskRefs.includes(ref)).join(', ')}; their work is theirs. ` : '')
423
455
  + (contributions.length > 1 ? 'Derived by the dispatch host from those runs\' closing reports.' : 'Derived by the dispatch host from that run\'s closing report.');
424
456
  return {
425
457
  task: {
426
458
  taskRef: anchor.taskRef,
427
459
  objective,
428
460
  target: anchor.scope.target,
461
+ /*
462
+ * No product, ever: a follow-up lands on its completed run (RAN-not-PROVEN), and declaring its origin's products
463
+ * would read it landed before it ran. A follow-up on a RELATIONSHIP target therefore carries
464
+ * RELATIONSHIP_TARGET_DISAGREES_WITH_PRODUCTS, a floor of the AUTHORED plan (it keeps the domain-coverage count,
465
+ * which reads authored targets, honest). Kept, decided 2026-11-18: lifting it to its MODULE would let it write the
466
+ * whole module beside the planned tasks that own it, and exempting a product-less task in the validator would let
467
+ * an AUTHORED relationship task count an edge it never proves. So a host check over the derived plan judges only
468
+ * the findings it introduces (`deriveGuardedWebsiteClaimPrerequisites` in the dispatch host).
469
+ */
429
470
  produces: [],
430
471
  functionalTopic: anchor.scope.functionalTopic,
431
472
  skillRefs: [...new Set(all.flatMap((group) => group.scope.skillRefs))],
432
- // Its first report's origin (`followUpOf` reads it), and the owner its gaps were reported as (#3886); the follow-up
433
- // before it on the same target is added by the chain.
434
- prerequisiteTaskRefs: [anchor.origin.taskRef, ...(anchor.owner !== undefined ? [anchor.owner] : [])],
473
+ // Its first report's origin (`followUpOf` reads it), then EITHER the owner its gaps were reported as (#3886) OR, when
474
+ // routed with no owner, the planned tasks of its scope (#3991); the follow-up before it on its target is added by the chain.
475
+ prerequisiteTaskRefs: ownPrerequisiteTaskRefs,
435
476
  // Only refs an origin serves: a free-text ref would be a dangling citation in the plan.
436
477
  servesRefs: requirementRefs.filter((ref) => all.some((group) => group.origin.servesRefs.includes(ref))),
437
478
  },
438
479
  gaps,
439
480
  // The CHAIN it belongs to (#3886): its target's, or its target's for one owner, so owners never wait on each other.
440
481
  targetKey: anchor.owner === undefined ? key : `${key}\u0000owner:${anchor.owner}`,
441
- ownPrerequisiteTaskRefs: [anchor.origin.taskRef, ...(anchor.owner !== undefined ? [anchor.owner] : [])],
482
+ ownPrerequisiteTaskRefs,
442
483
  };
443
484
  };
444
485
  const previousOnChain = new Map();
@@ -454,6 +495,27 @@ export function deriveBuildPlanFollowUpTasks(input) {
454
495
  }
455
496
  return assembleFollowUpDerivation(followUpsByTarget, notDerived);
456
497
  }
498
+ /**
499
+ * Every planned task that waits, directly or through others, on one of `taskRefs` (#3999): the plan's later work on what
500
+ * they built. Follow-ups are never in it, so a follow-up waiting on these can close no cycle.
501
+ */
502
+ export function planTasksDownstreamOf(taskRefs, planTasks) {
503
+ const downstream = new Set();
504
+ const reached = new Set(taskRefs);
505
+ for (let grew = true; grew;) {
506
+ grew = false;
507
+ for (const task of planTasks) {
508
+ if (reached.has(task.taskRef) || task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX))
509
+ continue;
510
+ if (task.prerequisiteTaskRefs.some((ref) => reached.has(ref))) {
511
+ reached.add(task.taskRef);
512
+ downstream.add(task.taskRef);
513
+ grew = true;
514
+ }
515
+ }
516
+ }
517
+ return downstream;
518
+ }
457
519
  /**
458
520
  * The owner a report named for a gap, when the plan can honour it (#3886): a planned task (never a follow-up), not the
459
521
  * origin itself, that serves the very requirement. Anything else is ignored and the gap is an ordinary one.
@@ -1 +1 @@
1
- {"version":3,"file":"application-build-follow-up-derivation.companion.js","sourceRoot":"","sources":["../../../../src/meta-workflows/services/application-build-follow-up-derivation.companion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,uBAAuB,EAAsB,MAAM,oDAAoD,CAAC;AAGjH,OAAO,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AAExG;;;;GAIG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,uBAAuB,CAAC;AAY9E;;;GAGG;AACH,MAAM,CAAN,IAAY,mBAWX;AAXD,WAAY,mBAAmB;IAC7B,wFAAwF;IACxF,4CAAqB,CAAA;IACrB;;;;OAIG;IACH,4CAAqB,CAAA;IACrB,+DAA+D;IAC/D,8CAAuB,CAAA;AACzB,CAAC,EAXW,mBAAmB,KAAnB,mBAAmB,QAW9B;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAmE;IAC1G,CAAC,uBAAuB,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC,QAAQ;IAC9D,CAAC,uBAAuB,CAAC,cAAc,CAAC,EAAE,mBAAmB,CAAC,QAAQ;IACtE,CAAC,uBAAuB,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAC,QAAQ;IACpE,CAAC,uBAAuB,CAAC,yBAAyB,CAAC,EA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a,EAAE,GAAG,CAAC,aAAa,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5G,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,sCAAsC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;YAAE,SAAS;QAC1H,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,IAAI,EAAE,EAAE,CAAC;YACzF,IAAI,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,aAAa,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3G,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { createHash } from 'node:crypto';\n\nimport { BuildPlanTaskTargetKind, type BuildPlanTask } from '@wildo-ai/saas-specifications/application-creation';\n\nimport type { ApplicationCodingMetRequirement, ApplicationCodingUnmetRequirement } from '../../claude-cli/models/coding-agent-dispatch.models';\nimport { resolveBuildTaskLandedProbes } from './application-build-task-coding-policy.companion.service';\n\n/**\n * The ref prefix of a FOLLOW-UP task the host derives when a completed coding run reports a requirement it could not\n * fully meet (#2496): `build-task-follow-up-<origin>-<token>`. A follow-up's own report derives nothing further, so\n * the chain is one step long; what it leaves unmet is shown on its record.\n */\nexport const HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX = 'build-task-follow-up-';\n\n/** What the derivation reads of a task's latest COMPLETED coding run. */\nexport interface FollowUpReportingRun {\n readonly runTaskId: string;\n readonly startedAt: string;\n readonly settledAt?: string;\n readonly unmetRequirements?: readonly ApplicationCodingUnmetRequirement[];\n /** What the run STATED is met, with where (#3227); absent states nothing. */\n readonly metRequirements?: readonly ApplicationCodingMetRequirement[];\n}\n\n/**\n * What a task's TARGET can do about a requirement it reports unmet (#3701), total over {@link BuildPlanTaskTargetKind}: a\n * kind added to the vocabulary does not compile until somebody says whether its follow-up can close a product gap.\n */\nexport enum FollowUpTargetReach {\n /** Its scope builds the product: a follow-up on it can close what the product lacks. */\n DELIVERS = 'DELIVERS',\n /**\n * Its scope PRESENTS the product (the marketing website, the technical documentation): it can describe a feature, and\n * never build one. A follow-up on it can only reword the page, which is how the reference run of 2026-11-10 landed 31\n * follow-ups with the features they reported still missing.\n */\n PRESENTS = 'PRESENTS',\n /** A companion generation step: no coding run ever runs it. */\n GENERATES = 'GENERATES',\n}\n\nexport const BUILD_TARGET_FOLLOW_UP_REACH: Readonly<Record<BuildPlanTaskTargetKind, FollowUpTargetReach>> = {\n [BuildPlanTaskTargetKind.MODULE]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.RESOURCE_STAGE]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.RELATIONSHIP]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP]: FollowUpTargetReach.GENERATES,\n [BuildPlanTaskTargetKind.SHELL_PLACEMENT]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.MODULE_FRONTEND]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.MODULE_BACKEND]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.APPLICATION_FRONTEND_CONFIG]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.WEBSITE]: FollowUpTargetReach.PRESENTS,\n [BuildPlanTaskTargetKind.TECHNICAL_DOCUMENTATION]: FollowUpTargetReach.PRESENTS,\n [BuildPlanTaskTargetKind.WORKER]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.MINION]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.PROVIDER_BINDING]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.BILLING_CATALOG]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.APPLICATION_ROLES]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.ORGANIZATION_MODEL]: FollowUpTargetReach.DELIVERS,\n};\n\n/**\n * The skill a follow-up lifted to a whole MODULE carries beside its serving tasks' skills: the MODULE kind's own reason to\n * exist is registering the module in every layer, and that is the skill that teaches it.\n */\nexport const MODULE_FOLLOW_UP_SKILL_REF = 'module-registration';\n\n/**\n * The scope that CLOSES a product gap on one serving task's target (#3701). Every module-scoped kind writes a subset of\n * its module's MODULE scope (the coding policy's own prefixes: a resource stage, a relationship file, a module's frontend\n * or backend layer), and only the MODULE scope reaches the module registries. A gap a presenting task reports can be\n * anywhere in the module, so it goes to the module; an application-wide target closes in its own scope.\n */\nexport function productClosingTarget(target: BuildPlanTask['target']): BuildPlanTask['target'] | undefined {\n switch (target.kind) {\n case BuildPlanTaskTargetKind.MODULE:\n case BuildPlanTaskTargetKind.RESOURCE_STAGE:\n case BuildPlanTaskTargetKind.RELATIONSHIP:\n case BuildPlanTaskTargetKind.MODULE_FRONTEND:\n case BuildPlanTaskTargetKind.MODULE_BACKEND:\n return { kind: BuildPlanTaskTargetKind.MODULE, moduleRef: target.moduleRef } as BuildPlanTask['target'];\n case BuildPlanTaskTargetKind.SHELL_PLACEMENT:\n case BuildPlanTaskTargetKind.APPLICATION_FRONTEND_CONFIG:\n case BuildPlanTaskTargetKind.WORKER:\n case BuildPlanTaskTargetKind.MINION:\n case BuildPlanTaskTargetKind.PROVIDER_BINDING:\n case BuildPlanTaskTargetKind.BILLING_CATALOG:\n case BuildPlanTaskTargetKind.APPLICATION_ROLES:\n case BuildPlanTaskTargetKind.ORGANIZATION_MODEL:\n return target;\n case BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP:\n case BuildPlanTaskTargetKind.WEBSITE:\n case BuildPlanTaskTargetKind.TECHNICAL_DOCUMENTATION:\n return undefined;\n default: {\n const unhandled: never = target;\n throw new Error(`Unhandled build-plan target ${JSON.stringify(unhandled)}.`);\n }\n }\n}\n\n/** Where one reported gap's follow-up runs: its target, the tasks it was derived from, and their skills and topic. */\nexport interface FollowUpClosingScope {\n readonly target: BuildPlanTask['target'];\n /** Empty when the follow-up stays on its origin's target; else the product tasks serving the requirement in this scope. */\n readonly servingTaskRefs: readonly string[];\n readonly skillRefs: readonly string[];\n readonly functionalTopic: BuildPlanTask['functionalTopic'];\n}\n\n/**\n * WHERE a gap one origin reported is closed (#3701), through the decomposer's own mapping from a requirement to the work\n * that delivers it: the plan's `servesRefs`.\n *\n * - An origin whose target DELIVERS the product closes its own gap: one scope, the origin's (unchanged since #2496).\n * - An origin that PRESENTS the product (a website section, a documentation chapter) reported that the product does not\n * do what the page describes. The gap goes to every product task serving the same requirement, lifted to the scope that\n * closes it ({@link productClosingTarget}), one scope per distinct target, in plan order. The reference run's\n * bid-records gap (\"not registered in the backend or frontend module registries\") was reported by a website section and\n * went back to that section; it now goes to the bid-records MODULE.\n * - A presenting origin whose requirement no product task serves is a requirement only pages deliver (a public case\n * study): it stays on the origin's target.\n */\nexport function resolveFollowUpClosingScopes(origin: BuildPlanTask, requirementRef: string, planTasks: readonly BuildPlanTask[]): readonly FollowUpClosingScope[] {\n const own: FollowUpClosingScope = { target: origin.target, servingTaskRefs: [], skillRefs: origin.skillRefs, functionalTopic: origin.functionalTopic };\n if (BUILD_TARGET_FOLLOW_UP_REACH[origin.target.kind] !== FollowUpTargetReach.PRESENTS) return [own];\n const scopes = new Map<string, { target: BuildPlanTask['target']; serving: BuildPlanTask[] }>();\n for (const task of planTasks) {\n if (task.taskRef === origin.taskRef || !task.servesRefs.includes(requirementRef)) continue;\n if (BUILD_TARGET_FOLLOW_UP_REACH[task.target.kind] !== FollowUpTargetReach.DELIVERS) continue;\n const target = productClosingTarget(task.target);\n if (target === undefined) continue;\n const key = targetKey(target);\n const entry = scopes.get(key) ?? { target, serving: [] };\n entry.serving.push(task);\n scopes.set(key, entry);\n }\n if (scopes.size === 0) return [own];\n return [...scopes.values()].map(({ target, serving }) => ({\n target,\n servingTaskRefs: serving.map((task) => task.taskRef),\n skillRefs: [...new Set([...(target.kind === BuildPlanTaskTargetKind.MODULE ? [MODULE_FOLLOW_UP_SKILL_REF] : []), ...serving.flatMap((task) => task.skillRefs)])],\n functionalTopic: serving[0]!.functionalTopic,\n }));\n}\n\n/** One gap one origin's run reported, as a follow-up carries it. */\nexport interface FollowUpGap {\n readonly originTaskRef: string;\n readonly reportingRunTaskId: string;\n readonly requirementRef: string;\n readonly missing: string;\n /** The planned task whose own work is missing, as the report named it (#3886): its follow-up waits for that task. */\n readonly ownedByTaskRef?: string;\n /** The decision a person must make first, as the report named it (#3886): no follow-up, the gap goes to ASKED. */\n readonly needsDecision?: string;\n}\n\n/** A reported gap the derivation did not turn into a follow-up, and why, so the log can say it. */\nexport interface FollowUpGapNotDerived extends FollowUpGap {\n readonly reason: FollowUpGapNotDerivedReason;\n /** For {@link FollowUpGapNotDerivedReason.MET_SINCE}: the run that stated it met, and where. */\n readonly metSince?: Omit<FollowUpGapMetSince, 'gap' | 'followUpTaskRef'>;\n}\n\n/** Why a reported gap derives no follow-up task (#2496). */\nexport enum FollowUpGapNotDerivedReason {\n /** The origin's target lands by its own probe (a shell placement), so a follow-up would read as landed without running. */\n TARGET_LANDS_BY_ITS_OWN_PROBE = 'TARGET_LANDS_BY_ITS_OWN_PROBE',\n /** The origin is a companion generation step, which no coding run ever runs. */\n GENERATION_STEP = 'GENERATION_STEP',\n /**\n * A LANDED later run of another task on the same target, serving the same requirement, STATED it met (#3227): its closing\n * report's `wildo-requirements-met` block names the requirement, with where. Measured on app-creation-test-007: six of\n * eleven follow-ups changed nothing, their workers saying another task had already met the gap, at about 20 minutes of\n * selection and a run each. Only that positive statement drops a gap; silence and a malformed block never do.\n */\n MET_SINCE = 'MET_SINCE',\n /**\n * The follow-up that would carry it could not join the plan (#3204): its ref already names a task, or the plan refused\n * it. Recorded so the gap still reads OPEN, with no follow-up, rather than falling out of every reading.\n */\n FOLLOW_UP_NOT_APPENDED = 'FOLLOW_UP_NOT_APPENDED',\n /**\n * The report said a PERSON must decide something first (#3886: `needsDecision`): no coding task can close it, so none is\n * derived. It stays OPEN, for the maturity reading and on the creation Home's ASKED section. On reference run 43691253927\n * six follow-up runs changed nothing for this reason (\"the creator must decide the RESOURCE_DATA retention period\").\n */\n AWAITS_DECISION = 'AWAITS_DECISION',\n}\n\n/** A reported gap a later run states is met (#3227): the candidate a host may drop, once it has checked the run landed. */\nexport interface FollowUpGapMetSince {\n readonly gap: FollowUpGap;\n /**\n * The follow-up the gap's own report would derive: a host keeps the gap when that follow-up was ever attempted (#2530),\n * and ALSO when the follow-up that carries it was (#3204: an absorbed gap is carried under another report's ref, so a\n * host asks {@link FollowUpDerivation.followUpTaskRefFor} as well).\n */\n readonly followUpTaskRef: string;\n /** The task whose run stated it met. */\n readonly metByTaskRef: string;\n /** That run: a host drops the gap only when the run LANDED (everything it wrote is committed). */\n readonly metByRunTaskId: string;\n /** Where the run said it is met. */\n readonly evidence: string;\n}\n\n/** The key one gap is addressed by: its origin, its reporting run and its requirement. */\nexport function followUpGapKey(gap: Pick<FollowUpGap, 'originTaskRef' | 'reportingRunTaskId' | 'requirementRef'>): string {\n return `${gap.originTaskRef}\\u0000${gap.reportingRunTaskId}\\u0000${gap.requirementRef}`;\n}\n\n/**\n * The reference a PERSON is shown for one report a derived follow-up covers (#3833): `<requirementRef>@<originTaskRef>/<run>`,\n * so `wildo build tasks` can list it and `wildo build close|approve --covers` can send back what was seen. It names the\n * same three parts as {@link followUpGapKey}, so two reports never share one. The requirement ref and the run id come\n * from a run's report and the plan, so each part is percent-encoded: the result never holds a comma (the CLI splits\n * `--covers` on commas), whitespace, or a separator of its own (`@`, `/`). A task ref is already a slug.\n */\nexport function followUpReportRefOf(gap: Pick<FollowUpGap, 'originTaskRef' | 'reportingRunTaskId' | 'requirementRef'>): string {\n return `${encodeURIComponent(gap.requirementRef)}@${encodeURIComponent(gap.originTaskRef)}/${encodeURIComponent(gap.reportingRunTaskId)}`;\n}\n\n/** One derived follow-up task, with every gap it answers. */\nexport interface DerivedFollowUp {\n /** The task, chained after the follow-up before it on its target (see {@link chainFollowUpAfter}). */\n readonly task: BuildPlanTask;\n readonly gaps: readonly FollowUpGap[];\n /**\n * Its CHAIN's identity: its target's, or its target's for one owner (#3886). The follow-ups sharing one are chained, in\n * the order their reports settled.\n */\n readonly targetKey: string;\n /**\n * What it waits on before the chain link: its first report's origin (`followUpOf` reads it), never every origin it\n * carries (#3204). {@link chainFollowUpAfter} appends the follow-up before it on its target.\n */\n readonly ownPrerequisiteTaskRefs: readonly string[];\n /**\n * The reports it absorbed, each as the follow-up it would be on its own (#3204): what the host appends instead when this\n * one cannot join the plan (its ref already names a task, the plan refuses it), so an absorbed report is never lost\n * with it. Empty when it carries only its own report.\n */\n readonly absorbed: readonly Omit<DerivedFollowUp, 'absorbed'>[];\n}\n\n/**\n * What the follow-ups the build already dispatched CARRIED (#3204): per dispatched follow-up ref, every gap key\n * ({@link followUpGapKey}) recorded on its runs at dispatch, read from the same derivation that wrote the objective the\n * run received. A ref absent from the map was never dispatched; a run that recorded no keys carried its own report only.\n */\nexport type FollowUpDispatchRecord = ReadonlyMap<string, ReadonlySet<string>>;\n\n/**\n * What decides which reports a follow-up absorbs (#3204). Both halves must be known; without either, nothing is absorbed\n * and every report keeps a follow-up of its own (the behaviour before absorption).\n */\nexport interface FollowUpAbsorptionInputs {\n readonly dispatched: FollowUpDispatchRecord;\n /**\n * Follow-ups a person decided on (closed, approved) or that a decision holds: FIXED, like a dispatched one, to their own\n * report and the gap keys the decision recorded (#3832: what the objective showed when the person decided). A decision\n * recorded before that field fixes the follow-up to its own report; what it had absorbed is carried again by the next\n * follow-up and shown again, never closed or released by a decision that may not have covered it.\n */\n readonly decided: FollowUpDispatchRecord;\n}\n\nexport interface FollowUpDerivation {\n readonly followUps: readonly DerivedFollowUp[];\n readonly notDerived: readonly FollowUpGapNotDerived[];\n /** The follow-up that carries one origin's reported requirement, when one does (the website claim delivery asks). */\n followUpTaskRefFor(originTaskRef: string, requirementRef: string): string | undefined;\n /** Whether one origin's reported requirement was dropped because a landed later run stated it met (#3227). */\n gapMetSince(originTaskRef: string, requirementRef: string): boolean;\n}\n\n/**\n * The follow-up ref of ONE origin's ONE reporting run: the origin, then a token of the run, so the same report derives the\n * same task on every read while a later run reporting again derives a NEW task (the old follow-up's completed run must not\n * land the new report at birth). Always a slug the graph schema accepts: an origin ref with no ASCII letter or digit is\n * named by a digest instead, so no agent-written string can make the plan unreadable.\n *\n * The requirement is not part of the ref (#3227): one run reporting two requirements is ONE follow-up. app-creation-test-007\n * ran `…job-config-…-building-customer-lifecycle-3d9049` and `…job-config-…-shared-office-field-customer-context-3d9049`,\n * the same task, from the same run, twice, both changing nothing.\n */\nexport function deriveFollowUpTaskRef(originTaskRef: string, reportingRunTaskId: string): string {\n const slug = (value: string) => value.toLowerCase().replace(/[^a-z0-9]+/gu, '-').replace(/^-+|-+$/gu, '');\n const digest = (value: string) => createHash('sha256').update(value).digest('hex');\n const origin = slug(originTaskRef.replace(/^build-task-/u, '')) || `t${digest(originTaskRef).slice(0, 8)}`;\n return `${HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX}${origin}-${digest(reportingRunTaskId).slice(0, 6)}`;\n}\n\n/**\n * A follow-up waiting on its first report's origin, on the planned task its gaps were reported as owned by (#3886, both in\n * `ownPrerequisiteTaskRefs`) and, when there is one, on the follow-up before it on its target. One function, so the\n * dispatch host can re-link a follow-up after one it could not append (a name collision, a schema refusal): a chain\n * naming a task the plan does not hold would make the plan unreadable.\n */\nexport function chainFollowUpAfter(followUp: Pick<DerivedFollowUp, 'task' | 'ownPrerequisiteTaskRefs'>, previousOnTarget: string | undefined): BuildPlanTask {\n const own = [...followUp.ownPrerequisiteTaskRefs];\n return { ...followUp.task, prerequisiteTaskRefs: previousOnTarget === undefined ? own : [...own, previousOnTarget] };\n}\n\n/** A target's identity: two tasks with equal targets write the same scope (#3227). */\nexport function targetKey(target: BuildPlanTask['target']): string {\n const entries = Object.entries(target as Record<string, unknown>).sort(([left], [right]) => left.localeCompare(right));\n return JSON.stringify(entries);\n}\n\n/**\n * The follow-up tasks the reported gaps derive (#2496, #3227). Pure: the dispatch host supplies the plan and each task's\n * latest completed run.\n *\n * ## One follow-up per target for what is not dispatched yet, chained per target\n *\n * - **Every requirement one run reported is folded into one follow-up** (#3227): one scope, one worker, one set of\n * checks, instead of the same task once per requirement.\n * - **A follow-up not dispatched yet absorbs every later report on its target** (#3204): one worker reads the scope once,\n * with every gap in front of it. The reference run of 2026-11-12 derived 225 follow-ups from website sections onto 24\n * modules (17 requirements, each re-reported by up to 7 sections and routed to every module serving it), and 173 changed\n * nothing. Absorption needs the dispatch record and the decisions (`absorption`); without them, one follow-up per report.\n * - **Its identity is its FIRST report's origin and run, and nothing else**, so it is STABLE: a later report joins it\n * rather than renaming it, and a follow-up the build is running, or has run, never leaves the plan because somebody\n * else reported (#2530). Once dispatched it is FIXED: it carries exactly the gaps recorded on its runs at dispatch,\n * which are the gaps its objective held, and a later report starts the next one. A follow-up a person closed or\n * approved is fixed too, to the gaps the decision recorded ({@link FollowUpAbsorptionInputs}, #3832).\n * - **Follow-ups on one target are chained IN THE ORDER THEIR REPORTS SETTLED** (then by origin ref), each waiting on the\n * one before it: they write one scope, and two of them at once would overwrite each other (the interference that made\n * the wave re-run each alone). Report order rather than plan order, so a new report always joins the TAIL: in plan\n * order, an origin earlier in the plan reporting later went to the head, made a running follow-up wait on it, and was\n * ready at once beside it (review of f077ae7db). A follow-up declares no product, so no interference check could see it.\n * - **It waits on its first report's origin only**: the chain already holds a target's later follow-ups behind the earlier\n * ones, so waiting on every absorbed origin would hold all their gaps behind any one of them that never lands.\n * - **It does not wait on the other tasks serving its requirements**, only names them: a task that never lands would hold\n * it for ever. Waiting was weighed again for #3204 and would not have helped: on the reference run the sections reported\n * their gaps after most of the product tasks serving them had run.\n *\n * ## A gap a later run STATED met is dropped; silence drops nothing\n *\n * Dropping on ABSENCE was tried and withdrawn (review of 5e3ab7d76): a missing block, a malformed one and a run that never\n * looked at the requirement all read the same, so it closed gaps nobody had closed. The worker contract now carries the\n * positive half, a `wildo-requirements-met` block, and a gap is dropped only when {@link collectFollowUpGapsMetSince} finds\n * a later run that states it and the host confirms that run LANDED and no follow-up carrying the gap was ever attempted\n * (`metSince`): neither its own report's nor one that absorbed it (#3204).\n * Every drop is in `notDerived`, with the run and its evidence, so the host logs it. The follow-up's own worker is still\n * told to read what was built since and change nothing when a gap is met.\n *\n * Unchanged: the chain is one step long (a follow-up's own report derives nothing), and an origin whose target lands by\n * its own probe or is a generation step derives nothing. A follow-up keeps its origin's target and skills, EXCEPT when the\n * origin only presents the product (#3701): its gaps go to the product scopes serving the requirement, see\n * {@link resolveFollowUpClosingScopes}.\n */\nexport function deriveBuildPlanFollowUpTasks(input: {\n readonly tasks: readonly BuildPlanTask[];\n readonly latestCompletedRuns: ReadonlyMap<string, FollowUpReportingRun>;\n /**\n * The gaps a host CONFIRMED met since (#3227), by {@link followUpGapKey}: candidates from\n * {@link collectFollowUpGapsMetSince} whose stating run landed and that no attempted follow-up carries (#3204). Absent drops\n * nothing, which is the reading when the host could not check.\n */\n readonly metSince?: ReadonlyMap<string, FollowUpGapMetSince>;\n /**\n * What the dispatched follow-ups carried and which are fixed by a decision (#3204): lets a follow-up not yet dispatched\n * absorb every later report on its target. Absent absorbs nothing, the reading when the host could not tell.\n */\n readonly absorption?: FollowUpAbsorptionInputs;\n}): FollowUpDerivation {\n const notDerived: FollowUpGapNotDerived[] = [];\n const reports: { readonly origin: BuildPlanTask; readonly run: FollowUpReportingRun; readonly gaps: readonly FollowUpGap[] }[] = [];\n const planTasks = input.tasks.filter((task) => !task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX));\n for (const origin of planTasks) {\n const run = input.latestCompletedRuns.get(origin.taskRef);\n const reported = run?.unmetRequirements ?? [];\n if (run === undefined || reported.length === 0) continue;\n const reportedGaps: FollowUpGap[] = reported.map((entry) => ({\n originTaskRef: origin.taskRef,\n reportingRunTaskId: run.runTaskId,\n requirementRef: entry.requirementRef,\n missing: entry.missing,\n ...(entry.ownedByTaskRef !== undefined ? { ownedByTaskRef: entry.ownedByTaskRef } : {}),\n ...(entry.needsDecision !== undefined ? { needsDecision: entry.needsDecision } : {}),\n }));\n if (origin.target.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {\n notDerived.push(...reportedGaps.map((gap) => ({ ...gap, reason: FollowUpGapNotDerivedReason.GENERATION_STEP })));\n continue;\n }\n if (resolveBuildTaskLandedProbes({ ...origin, produces: [] }).length > 0) {\n notDerived.push(...reportedGaps.map((gap) => ({ ...gap, reason: FollowUpGapNotDerivedReason.TARGET_LANDS_BY_ITS_OWN_PROBE })));\n continue;\n }\n // A gap a landed later run stated met, as the host confirmed (#3227): dropped, and named.\n const gaps = reportedGaps.filter((gap) => {\n const met = input.metSince?.get(followUpGapKey(gap));\n if (met === undefined) return true;\n notDerived.push({ ...gap, reason: FollowUpGapNotDerivedReason.MET_SINCE, metSince: { metByTaskRef: met.metByTaskRef, metByRunTaskId: met.metByRunTaskId, evidence: met.evidence } });\n return false;\n }).filter((gap) => {\n // A decision only a person can make (#3886): no coding task, and the gap stays open on ASKED.\n if (gap.needsDecision === undefined) return true;\n notDerived.push({ ...gap, reason: FollowUpGapNotDerivedReason.AWAITS_DECISION });\n return false;\n });\n if (gaps.length === 0) continue;\n reports.push({ origin, run, gaps });\n }\n // Report order: when the reporting run settled (its start when it recorded no settlement), then the origin's ref. A\n // timestamp that does not parse sorts last, never as 1970, so it cannot jump ahead of reports whose time is known.\n const reportedAt = (run: FollowUpReportingRun): number => {\n const at = Date.parse(run.settledAt ?? run.startedAt);\n return Number.isNaN(at) ? Number.POSITIVE_INFINITY : at;\n };\n const byReportedAt = (left: number, right: number): number => (left === right ? 0 : left < right ? -1 : 1);\n reports.sort((left, right) => byReportedAt(reportedAt(left.run), reportedAt(right.run)) || left.origin.taskRef.localeCompare(right.origin.taskRef));\n\n /*\n * Every report's gaps, per CLOSING SCOPE (#3701): the origin's own, unless the origin only presents the product, in\n * which case each product scope serving a reported requirement gets the gaps it can close. A routed group's ref adds its\n * scope to the run's token, so the same report keeps naming the same task.\n */\n interface ReportGroup {\n readonly origin: BuildPlanTask;\n readonly run: FollowUpReportingRun;\n readonly scope: FollowUpClosingScope;\n readonly gaps: FollowUpGap[];\n readonly taskRef: string;\n readonly settledAtMs: number;\n /** The planned task whose work its gaps are (#3886): the follow-up waits for it, and nothing else on the target waits on the follow-up. */\n readonly owner?: string;\n }\n /*\n * The owner a report named, when the plan can honour it (#3886): a planned task (never a follow-up), not the origin\n * itself, that serves the very requirement. Anything else is ignored and the gap is an ordinary one: a worker's free text\n * must never make a follow-up wait on a task that does not exist or does not do that work.\n */\n const honouredOwner = (gap: FollowUpGap, origin: BuildPlanTask): string | undefined => honouredFollowUpOwner(gap, origin, planTasks);\n const groupsByTarget = new Map<string, ReportGroup[]>();\n for (const { origin, run, gaps } of reports) {\n const byScope = new Map<string, ReportGroup>();\n for (const gap of gaps) {\n const owner = honouredOwner(gap, origin);\n for (const scope of resolveFollowUpClosingScopes(origin, gap.requirementRef, planTasks)) {\n const key = targetKey(scope.target);\n const routed = scope.servingTaskRefs.length > 0;\n // An owned gap is its own group, so waiting for its owner holds no other gap (#3886); unowned refs are unchanged.\n const groupKey = owner === undefined ? key : `${key}\\u0000owner:${owner}`;\n const group = byScope.get(groupKey) ?? {\n origin, run, scope, gaps: [],\n taskRef: owner !== undefined ? deriveFollowUpTaskRef(origin.taskRef, `${run.runTaskId}\\u0000${key}\\u0000owner:${owner}`)\n : routed ? deriveFollowUpTaskRef(origin.taskRef, `${run.runTaskId}\\u0000${key}`) : deriveFollowUpTaskRef(origin.taskRef, run.runTaskId),\n settledAtMs: reportedAt(run),\n ...(owner !== undefined ? { owner } : {}),\n };\n group.gaps.push(gap);\n byScope.set(groupKey, group);\n }\n }\n for (const group of byScope.values()) {\n const key = targetKey(group.scope.target);\n groupsByTarget.set(key, [...(groupsByTarget.get(key) ?? []), group]);\n }\n }\n\n /*\n * ONE follow-up per target for everything not yet dispatched (#3204). The reference run of 2026-11-12 derived 225\n * follow-ups from website sections on 24 module scopes: 17 requirements, each reported by up to 7 sections and routed\n * to every module serving it, all waiting at once, and 173 changed nothing.\n *\n * - A DISPATCHED follow-up carries its own report and exactly the gaps recorded on its runs (what its objective held).\n * - A DECIDED follow-up (a person closed or approved it, or a decision holds it) carries its own report and exactly the\n * gaps the decision recorded (#3832).\n * - Every other gap on the target goes to ONE pending follow-up: the first report not yet dispatched, under its own ref,\n * so it is never renamed (#2530). One worker reads the scope once, with every gap in front of it.\n *\n * Only the first report's origin is waited on: the chain already held every later follow-up on a target behind the\n * earlier ones, so waiting on each absorbed origin as well would hold the gaps of all of them behind any one.\n */\n const absorption = input.absorption;\n interface Member {\n readonly anchor: ReportGroup;\n /** The gaps it carries from other reports, by their report. */\n readonly carried: Map<ReportGroup, FollowUpGap[]>;\n }\n const followUpsByTarget: DerivedFollowUp[] = [];\n for (const [key, groups] of groupsByTarget) {\n const members: Member[] = [];\n const closedToAbsorption = (group: ReportGroup) => absorption === undefined || absorption.dispatched.has(group.taskRef) || absorption.decided.has(group.taskRef);\n const anchoredAlone = new Map<ReportGroup, Member>();\n for (const group of groups) {\n if (absorption === undefined || closedToAbsorption(group)) {\n const member: Member = { anchor: group, carried: new Map() };\n members.push(member);\n anchoredAlone.set(group, member);\n }\n }\n if (absorption !== undefined) {\n // What each dispatched or decided follow-up carried, from its records; never a gap whose own report is either.\n const claimedBy = new Map<string, Member>();\n for (const member of members) {\n const recorded = new Set([...(absorption.dispatched.get(member.anchor.taskRef) ?? []), ...(absorption.decided.get(member.anchor.taskRef) ?? [])]);\n for (const group of groups) {\n if (group === member.anchor || closedToAbsorption(group)) continue;\n for (const gap of group.gaps) {\n const gapKey = followUpGapKey(gap);\n if (!recorded.has(gapKey) || claimedBy.has(gapKey)) continue;\n claimedBy.set(gapKey, member);\n member.carried.set(group, [...(member.carried.get(group) ?? []), gap]);\n }\n }\n }\n // The decided anchors are already in the order their reports settled (pushed in report order above).\n // Everything else: the first pending report anchors, every later one joins it. Its follow-up goes LAST on its target,\n // after every dispatched or decided one, so a report that surfaced late never runs beside one already running.\n // One pending follow-up for the target's unowned gaps, and one per owner (#3886), so an owner holds only its own gaps.\n const pendingByOwner = new Map<string | undefined, Member>();\n for (const group of groups) {\n if (closedToAbsorption(group)) continue;\n const remaining = group.gaps.filter((gap) => !claimedBy.has(followUpGapKey(gap)));\n if (remaining.length === 0) continue;\n const pending = pendingByOwner.get(group.owner);\n if (pending === undefined) {\n const member: Member = { anchor: { ...group, gaps: remaining }, carried: new Map() };\n pendingByOwner.set(group.owner, member);\n members.push(member);\n } else {\n pending.carried.set(group, remaining);\n }\n }\n }\n /*\n * A follow-up waiting for its owner is on a CHAIN OF ITS OWN (#3886, review M1): it waits on the follow-up before it\n * for the same owner on this target, never on another owner's or on the target's unowned follow-ups, and none of them\n * waits on it. One chain per target would hold every gap behind any owner that never lands, #3204's objection one level\n * down. Two follow-ups on one scope still never RUN at once: the dispatch's selection takes one follow-up per scope at a\n * time (`followUpScopeBusy`), since they declare no product and nothing else could see them meet.\n */\n const build = (anchor: ReportGroup, contributions: readonly (readonly [ReportGroup, readonly FollowUpGap[]])[]): Omit<DerivedFollowUp, 'absorbed'> => {\n const all = contributions.map(([group]) => group);\n const gaps = contributions.flatMap(([, contributed]) => contributed);\n const requirementRefs = [...new Set(gaps.map((gap) => gap.requirementRef))];\n const originRefs = [...new Set(all.map((group) => group.origin.taskRef))];\n const servingTasks = [...new Set(planTasks\n .filter((task) => !originRefs.includes(task.taskRef) && requirementRefs.some((ref) => task.servesRefs.includes(ref)))\n .map((task) => task.taskRef))];\n const builtBy = [...new Set(all.flatMap((group) => group.scope.servingTaskRefs))];\n const describe = (groupGaps: readonly FollowUpGap[]) => {\n const byRequirement = new Map<string, Set<string>>();\n for (const gap of groupGaps) byRequirement.set(gap.requirementRef, (byRequirement.get(gap.requirementRef) ?? new Set()).add(gap.missing));\n return [...byRequirement].map(([ref, missing]) => `${ref}: ${[...missing].join(' / ')}`).join(' ');\n };\n const routed = contributions.filter(([group]) => group.scope.servingTaskRefs.length > 0);\n const own = contributions.filter(([group]) => group.scope.servingTaskRefs.length === 0);\n const presenters = [...new Set(routed.map(([group]) => group.origin.taskRef))];\n const reporters = [...new Set(own.map(([group]) => group.origin.taskRef))];\n const objective = (routed.length > 0\n ? `${presenters.join(', ')} ${presenters.length > 1 ? 'present' : 'presents'} the product and reported that the product does not yet deliver: `\n + describe(routed.flatMap(([, contributed]) => contributed))\n + ` Build what is missing in this scope, where ${builtBy.join(', ')} built the requirement; a page cannot. `\n + 'If what is missing lies outside this scope, change nothing and report it. '\n : '')\n + (own.length > 0 ? `Meet what ${reporters.join(', ')} reported still unmet: ${describe(own.flatMap(([, contributed]) => contributed))} ` : '')\n + (contributions.length > 1 ? 'These reports were gathered into this one task because they concern this one scope: answer each. ' : '')\n + 'Read what is already built first: if a task that ran since has met one, change nothing for it and say so. '\n + (anchor.owner !== undefined ? `It was reported as ${anchor.owner}'s own work, so it runs once that task has landed: read what it built, and change nothing for a gap it met. ` : '')\n + (servingTasks.length > 0 ? `Other tasks serving them: ${servingTasks.join(', ')}; their work is theirs. ` : '')\n + (contributions.length > 1 ? 'Derived by the dispatch host from those runs\\' closing reports.' : 'Derived by the dispatch host from that run\\'s closing report.');\n return {\n task: {\n taskRef: anchor.taskRef,\n objective,\n target: anchor.scope.target,\n produces: [],\n functionalTopic: anchor.scope.functionalTopic,\n skillRefs: [...new Set(all.flatMap((group) => group.scope.skillRefs))],\n // Its first report's origin (`followUpOf` reads it), and the owner its gaps were reported as (#3886); the follow-up\n // before it on the same target is added by the chain.\n prerequisiteTaskRefs: [anchor.origin.taskRef, ...(anchor.owner !== undefined ? [anchor.owner] : [])],\n // Only refs an origin serves: a free-text ref would be a dangling citation in the plan.\n servesRefs: requirementRefs.filter((ref) => all.some((group) => group.origin.servesRefs.includes(ref))),\n } as BuildPlanTask,\n gaps,\n // The CHAIN it belongs to (#3886): its target's, or its target's for one owner, so owners never wait on each other.\n targetKey: anchor.owner === undefined ? key : `${key}\\u0000owner:${anchor.owner}`,\n ownPrerequisiteTaskRefs: [anchor.origin.taskRef, ...(anchor.owner !== undefined ? [anchor.owner] : [])],\n };\n };\n const previousOnChain = new Map<string, string>();\n for (const { anchor, carried } of members) {\n const derived: DerivedFollowUp = {\n ...build(anchor, [[anchor, anchor.gaps], ...carried]),\n absorbed: [...carried].map(([group, contributed]) => build(group, [[group, contributed]])),\n };\n const task = chainFollowUpAfter(derived, previousOnChain.get(derived.targetKey));\n previousOnChain.set(derived.targetKey, task.taskRef);\n followUpsByTarget.push({ ...derived, task });\n }\n }\n return assembleFollowUpDerivation(followUpsByTarget, notDerived);\n}\n\n/**\n * The owner a report named for a gap, when the plan can honour it (#3886): a planned task (never a follow-up), not the\n * origin itself, that serves the very requirement. Anything else is ignored and the gap is an ordinary one.\n */\nexport function honouredFollowUpOwner(\n gap: Pick<FollowUpGap, 'requirementRef' | 'ownedByTaskRef'>,\n origin: BuildPlanTask,\n planTasks: readonly BuildPlanTask[],\n): string | undefined {\n if (gap.ownedByTaskRef === undefined) return undefined;\n const owner = planTasks.find((task) => task.taskRef === gap.ownedByTaskRef && !task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX));\n return owner !== undefined && owner.taskRef !== origin.taskRef && owner.servesRefs.includes(gap.requirementRef) ? owner.taskRef : undefined;\n}\n\n/**\n * A derivation's readers over a given set of follow-ups (#3204): what the plan holds, so a host that could not append one\n * (and appended the reports it absorbed instead) answers from what it appended, and no reader names a task the plan lacks.\n */\nexport function assembleFollowUpDerivation(followUps: readonly DerivedFollowUp[], notDerived: readonly FollowUpGapNotDerived[]): FollowUpDerivation {\n const refByOriginRequirement = new Map<string, string>();\n for (const followUp of followUps) {\n for (const gap of followUp.gaps) {\n const originRequirement = `${gap.originTaskRef}\\u0000${gap.requirementRef}`;\n if (!refByOriginRequirement.has(originRequirement)) refByOriginRequirement.set(originRequirement, followUp.task.taskRef);\n }\n }\n return {\n followUps,\n notDerived,\n followUpTaskRefFor: (originTaskRef, requirementRef) => refByOriginRequirement.get(`${originTaskRef}\\u0000${requirementRef}`),\n gapMetSince: (originTaskRef, requirementRef) => notDerived.some((gap) => gap.reason === FollowUpGapNotDerivedReason.MET_SINCE\n && gap.originTaskRef === originTaskRef && gap.requirementRef === requirementRef),\n };\n}\n\n/**\n * The reported gaps a LATER run states met (#3227), pure: the candidates a host may drop. For each gap an eligible origin\n * reported (one the derivation would turn into a follow-up), the first other task that\n *\n * - writes the SAME target (two tasks with equal targets write the same scope, so its statement is about the same surface),\n * - serves the same requirement,\n * - completed a run that STARTED after the reporting run settled (it read the tree the report described, or a later one),\n * - and whose run's `wildo-requirements-met` block names the requirement and its unmet block does not.\n *\n * EVERY such task is a candidate, in plan order, so a statement whose run has not landed does not hide one that has. A\n * gap's own follow-up is never its verifier: once it has run, it is attempted and keeps the gap anyway. The host must\n * still confirm that the stating run LANDED and that no follow-up carrying the gap (its own, or one that absorbed it,\n * #3204) was ever attempted before it passes a candidate on as\n * `metSince`; this function only finds who said so.\n */\nexport function collectFollowUpGapsMetSince(input: {\n readonly tasks: readonly BuildPlanTask[];\n readonly latestCompletedRuns: ReadonlyMap<string, FollowUpReportingRun>;\n}): readonly FollowUpGapMetSince[] {\n const candidates: FollowUpGapMetSince[] = [];\n const planTasks = input.tasks.filter((task) => !task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX));\n for (const origin of planTasks) {\n const run = input.latestCompletedRuns.get(origin.taskRef);\n if (run === undefined || (run.unmetRequirements ?? []).length === 0) continue;\n if (origin.target.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP || resolveBuildTaskLandedProbes({ ...origin, produces: [] }).length > 0) continue;\n const reportedAt = Date.parse(run.settledAt ?? run.startedAt);\n if (Number.isNaN(reportedAt)) continue;\n const followUpTaskRef = deriveFollowUpTaskRef(origin.taskRef, run.runTaskId);\n for (const entry of run.unmetRequirements ?? []) {\n /*\n * A statement counts from a task writing a scope that CLOSES the gap (#3701): the origin's own, or for a presenting\n * origin the product scopes its gap is routed to, where a task's target is read through the same lift.\n */\n const scopes = resolveFollowUpClosingScopes(origin, entry.requirementRef, planTasks);\n const closingKeys = new Set(scopes.map((scope) => targetKey(scope.target)));\n const routedRefs = new Set(scopes.filter((scope) => scope.servingTaskRefs.length > 0)\n .map((scope) => deriveFollowUpTaskRef(origin.taskRef, `${run.runTaskId}\\u0000${targetKey(scope.target)}`)));\n const routed = routedRefs.size > 0;\n // The follow-ups an owned gap derives (#3886, review LOW) are this report's own too: never a run that met it since.\n const owner = honouredFollowUpOwner(entry, origin, planTasks);\n const ownedRefs = new Set(owner === undefined ? [] : scopes.map((scope) => deriveFollowUpTaskRef(origin.taskRef, `${run.runTaskId}\\u0000${targetKey(scope.target)}\\u0000owner:${owner}`)));\n for (const task of input.tasks) {\n if (task.taskRef === origin.taskRef || task.taskRef === followUpTaskRef || routedRefs.has(task.taskRef) || ownedRefs.has(task.taskRef)) continue;\n const taskScope = routed ? productClosingTarget(task.target) : task.target;\n if (taskScope === undefined || !closingKeys.has(targetKey(taskScope)) || !task.servesRefs.includes(entry.requirementRef)) continue;\n const later = input.latestCompletedRuns.get(task.taskRef);\n if (later === undefined || !(Date.parse(later.startedAt) > reportedAt)) continue;\n if ((later.unmetRequirements ?? []).some((unmet) => unmet.requirementRef === entry.requirementRef)) continue;\n const met = (later.metRequirements ?? []).find((statement) => statement.requirementRef === entry.requirementRef);\n if (met === undefined) continue;\n candidates.push({\n gap: { originTaskRef: origin.taskRef, reportingRunTaskId: run.runTaskId, requirementRef: entry.requirementRef, missing: entry.missing },\n // A routed gap's first follow-up (#3701): the host keeps the gap when it was ever attempted.\n followUpTaskRef: routed ? [...routedRefs][0]! : followUpTaskRef,\n metByTaskRef: task.taskRef,\n metByRunTaskId: later.runTaskId,\n evidence: met.evidence,\n });\n }\n }\n }\n return candidates;\n}\n\n/** One reported gap still open, on one requirement (#2580): what the maturity reading caps the requirement for. */\nexport interface OpenReportedGap {\n readonly requirementRef: string;\n /** The task whose latest completed run reported it: an origin, or a follow-up still reporting it. */\n readonly originTaskRef: string;\n readonly missing: string;\n /** The follow-up derived to answer it, not landed yet. Absent when none was derived, or for a follow-up's own report. */\n readonly followUpTaskRef?: string;\n}\n\n/**\n * The reported gaps still OPEN (#2580), pure: a requirement carrying one is partly met, whatever probe found its file.\n *\n * - **A derived follow-up not landed yet**: every gap it carries is open, and names it.\n * - **A gap that derived no follow-up** because its target lands by its own probe or is a generation step: open, with no\n * follow-up, since nothing in the build will answer it. A gap a landed later run STATED met (`MET_SINCE`) is closed.\n * - **A LANDED follow-up whose own latest run still reports a requirement**: open, under the follow-up's ref. A follow-up's\n * report derives nothing further (the chain is one step long), so this is the only place it is still counted.\n *\n * A landed follow-up whose run reports nothing has closed its origin's gaps. Read from the same derivation that appends\n * the follow-ups to the plan, so the reading and the plan cannot disagree about which follow-up answers which gap.\n */\nexport function collectOpenReportedGaps(input: {\n readonly derivation: Pick<FollowUpDerivation, 'followUps' | 'notDerived'>;\n readonly tasks: readonly BuildPlanTask[];\n readonly latestCompletedRuns: ReadonlyMap<string, FollowUpReportingRun>;\n readonly landedTaskRefs: ReadonlySet<string>;\n}): readonly OpenReportedGap[] {\n const open: OpenReportedGap[] = [];\n for (const followUp of input.derivation.followUps) {\n if (input.landedTaskRefs.has(followUp.task.taskRef)) continue;\n for (const gap of followUp.gaps) {\n open.push({ requirementRef: gap.requirementRef, originTaskRef: gap.originTaskRef, missing: gap.missing, followUpTaskRef: followUp.task.taskRef });\n }\n }\n for (const gap of input.derivation.notDerived) {\n if (gap.reason === FollowUpGapNotDerivedReason.MET_SINCE) continue;\n open.push({ requirementRef: gap.requirementRef, originTaskRef: gap.originTaskRef, missing: gap.missing });\n }\n for (const task of input.tasks) {\n if (!task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX) || !input.landedTaskRefs.has(task.taskRef)) continue;\n for (const entry of input.latestCompletedRuns.get(task.taskRef)?.unmetRequirements ?? []) {\n open.push({ requirementRef: entry.requirementRef, originTaskRef: task.taskRef, missing: entry.missing });\n }\n }\n return open;\n}\n"]}
1
+ {"version":3,"file":"application-build-follow-up-derivation.companion.js","sourceRoot":"","sources":["../../../../src/meta-workflows/services/application-build-follow-up-derivation.companion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,uBAAuB,EAAsB,MAAM,oDAAoD,CAAC;AAGjH,OAAO,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AAExG;;;;GAIG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,uBAAuB,CAAC;AAY9E;;;GAGG;AACH,MAAM,CAAN,IAAY,mBAWX;AAXD,WAAY,mBAAmB;IAC7B,wFAAwF;IACxF,4CAAqB,CAAA;IACrB;;;;OAIG;IACH,4CAAqB,CAAA;IACrB,+DAA+D;IAC/D,8CAAuB,CAAA;AACzB,CAAC,EAXW,mBAAmB,KAAnB,mBAAmB,QAW9B;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAmE;IAC1G,CAAC,uBAAuB,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC,QAAQ;IAC9D,CAAC,uBAAuB,CAAC,cAAc,CAAC,EAAE,mBAAmB,CAAC,QAAQ;IACtE,CAAC,uBAAuB,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAC,QAAQ;IACpE,CAAC,uBAAuB,CAAC,yBAAyB,CAAC,EAAE,mBAAmB,CAAC,SAAS;IAClF,CAAC,uBAAu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AO,EAAE,CAAC,CAAC;QACpJ,CAAC;IACH,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QAC9C,IAAI,GAAG,CAAC,MAAM,KAAK,2BAA2B,CAAC,SAAS;YAAE,SAAS;QACnE,IAAI,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,GAAG,CAAC,cAAc,EAAE,aAAa,EAAE,GAAG,CAAC,aAAa,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5G,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,sCAAsC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;YAAE,SAAS;QAC1H,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,IAAI,EAAE,EAAE,CAAC;YACzF,IAAI,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,aAAa,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3G,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { createHash } from 'node:crypto';\n\nimport { BuildPlanTaskTargetKind, type BuildPlanTask } from '@wildo-ai/saas-specifications/application-creation';\n\nimport type { ApplicationCodingMetRequirement, ApplicationCodingUnmetRequirement } from '../../claude-cli/models/coding-agent-dispatch.models';\nimport { resolveBuildTaskLandedProbes } from './application-build-task-coding-policy.companion.service';\n\n/**\n * The ref prefix of a FOLLOW-UP task the host derives when a completed coding run reports a requirement it could not\n * fully meet (#2496): `build-task-follow-up-<origin>-<token>`. A follow-up's own report derives nothing further, so\n * the chain is one step long; what it leaves unmet is shown on its record.\n */\nexport const HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX = 'build-task-follow-up-';\n\n/** What the derivation reads of a task's latest COMPLETED coding run. */\nexport interface FollowUpReportingRun {\n readonly runTaskId: string;\n readonly startedAt: string;\n readonly settledAt?: string;\n readonly unmetRequirements?: readonly ApplicationCodingUnmetRequirement[];\n /** What the run STATED is met, with where (#3227); absent states nothing. */\n readonly metRequirements?: readonly ApplicationCodingMetRequirement[];\n}\n\n/**\n * What a task's TARGET can do about a requirement it reports unmet (#3701), total over {@link BuildPlanTaskTargetKind}: a\n * kind added to the vocabulary does not compile until somebody says whether its follow-up can close a product gap.\n */\nexport enum FollowUpTargetReach {\n /** Its scope builds the product: a follow-up on it can close what the product lacks. */\n DELIVERS = 'DELIVERS',\n /**\n * Its scope PRESENTS the product (the marketing website, the technical documentation): it can describe a feature, and\n * never build one. A follow-up on it can only reword the page, which is how the reference run of 2026-11-10 landed 31\n * follow-ups with the features they reported still missing.\n */\n PRESENTS = 'PRESENTS',\n /** A companion generation step: no coding run ever runs it. */\n GENERATES = 'GENERATES',\n}\n\nexport const BUILD_TARGET_FOLLOW_UP_REACH: Readonly<Record<BuildPlanTaskTargetKind, FollowUpTargetReach>> = {\n [BuildPlanTaskTargetKind.MODULE]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.RESOURCE_STAGE]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.RELATIONSHIP]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP]: FollowUpTargetReach.GENERATES,\n [BuildPlanTaskTargetKind.SHELL_PLACEMENT]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.MODULE_FRONTEND]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.MODULE_BACKEND]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.APPLICATION_FRONTEND_CONFIG]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.WEBSITE]: FollowUpTargetReach.PRESENTS,\n [BuildPlanTaskTargetKind.TECHNICAL_DOCUMENTATION]: FollowUpTargetReach.PRESENTS,\n [BuildPlanTaskTargetKind.WORKER]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.MINION]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.PROVIDER_BINDING]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.BILLING_CATALOG]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.APPLICATION_ROLES]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.ORGANIZATION_MODEL]: FollowUpTargetReach.DELIVERS,\n};\n\n/**\n * The skill a follow-up lifted to a whole MODULE carries beside its serving tasks' skills: the MODULE kind's own reason to\n * exist is registering the module in every layer, and that is the skill that teaches it.\n */\nexport const MODULE_FOLLOW_UP_SKILL_REF = 'module-registration';\n\n/**\n * The scope that CLOSES a product gap on one serving task's target (#3701). Every module-scoped kind writes a subset of\n * its module's MODULE scope (the coding policy's own prefixes: a resource stage, a relationship file, a module's frontend\n * or backend layer), and only the MODULE scope reaches the module registries. A gap a presenting task reports can be\n * anywhere in the module, so it goes to the module; an application-wide target closes in its own scope.\n */\nexport function productClosingTarget(target: BuildPlanTask['target']): BuildPlanTask['target'] | undefined {\n switch (target.kind) {\n case BuildPlanTaskTargetKind.MODULE:\n case BuildPlanTaskTargetKind.RESOURCE_STAGE:\n case BuildPlanTaskTargetKind.RELATIONSHIP:\n case BuildPlanTaskTargetKind.MODULE_FRONTEND:\n case BuildPlanTaskTargetKind.MODULE_BACKEND:\n return { kind: BuildPlanTaskTargetKind.MODULE, moduleRef: target.moduleRef } as BuildPlanTask['target'];\n case BuildPlanTaskTargetKind.SHELL_PLACEMENT:\n case BuildPlanTaskTargetKind.APPLICATION_FRONTEND_CONFIG:\n case BuildPlanTaskTargetKind.WORKER:\n case BuildPlanTaskTargetKind.MINION:\n case BuildPlanTaskTargetKind.PROVIDER_BINDING:\n case BuildPlanTaskTargetKind.BILLING_CATALOG:\n case BuildPlanTaskTargetKind.APPLICATION_ROLES:\n case BuildPlanTaskTargetKind.ORGANIZATION_MODEL:\n return target;\n case BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP:\n case BuildPlanTaskTargetKind.WEBSITE:\n case BuildPlanTaskTargetKind.TECHNICAL_DOCUMENTATION:\n return undefined;\n default: {\n const unhandled: never = target;\n throw new Error(`Unhandled build-plan target ${JSON.stringify(unhandled)}.`);\n }\n }\n}\n\n/** Where one reported gap's follow-up runs: its target, the tasks it was derived from, and their skills and topic. */\nexport interface FollowUpClosingScope {\n readonly target: BuildPlanTask['target'];\n /** Empty when the follow-up stays on its origin's target; else the product tasks serving the requirement in this scope. */\n readonly servingTaskRefs: readonly string[];\n readonly skillRefs: readonly string[];\n readonly functionalTopic: BuildPlanTask['functionalTopic'];\n}\n\n/**\n * WHERE a gap one origin reported is closed (#3701), through the decomposer's own mapping from a requirement to the work\n * that delivers it: the plan's `servesRefs`.\n *\n * - An origin whose target DELIVERS the product closes its own gap: one scope, the origin's (unchanged since #2496).\n * - An origin that PRESENTS the product (a website section, a documentation chapter) reported that the product does not\n * do what the page describes. The gap goes to every product task serving the same requirement, lifted to the scope that\n * closes it ({@link productClosingTarget}), one scope per distinct target, in plan order. The reference run's\n * bid-records gap (\"not registered in the backend or frontend module registries\") was reported by a website section and\n * went back to that section; it now goes to the bid-records MODULE.\n * - A presenting origin whose requirement no product task serves is a requirement only pages deliver (a public case\n * study): it stays on the origin's target.\n */\nexport function resolveFollowUpClosingScopes(origin: BuildPlanTask, requirementRef: string, planTasks: readonly BuildPlanTask[]): readonly FollowUpClosingScope[] {\n const own: FollowUpClosingScope = { target: origin.target, servingTaskRefs: [], skillRefs: origin.skillRefs, functionalTopic: origin.functionalTopic };\n if (BUILD_TARGET_FOLLOW_UP_REACH[origin.target.kind] !== FollowUpTargetReach.PRESENTS) return [own];\n const scopes = new Map<string, { target: BuildPlanTask['target']; serving: BuildPlanTask[] }>();\n for (const task of planTasks) {\n if (task.taskRef === origin.taskRef || !task.servesRefs.includes(requirementRef)) continue;\n if (BUILD_TARGET_FOLLOW_UP_REACH[task.target.kind] !== FollowUpTargetReach.DELIVERS) continue;\n const target = productClosingTarget(task.target);\n if (target === undefined) continue;\n const key = targetKey(target);\n const entry = scopes.get(key) ?? { target, serving: [] };\n entry.serving.push(task);\n scopes.set(key, entry);\n }\n if (scopes.size === 0) return [own];\n return [...scopes.values()].map(({ target, serving }) => ({\n target,\n servingTaskRefs: serving.map((task) => task.taskRef),\n skillRefs: [...new Set([...(target.kind === BuildPlanTaskTargetKind.MODULE ? [MODULE_FOLLOW_UP_SKILL_REF] : []), ...serving.flatMap((task) => task.skillRefs)])],\n functionalTopic: serving[0]!.functionalTopic,\n }));\n}\n\n/** One gap one origin's run reported, as a follow-up carries it. */\nexport interface FollowUpGap {\n readonly originTaskRef: string;\n readonly reportingRunTaskId: string;\n readonly requirementRef: string;\n readonly missing: string;\n /** The planned task whose own work is missing, as the report named it (#3886): its follow-up waits for that task. */\n readonly ownedByTaskRef?: string;\n /** The decision a person must make first, as the report named it (#3886): no follow-up, the gap goes to ASKED. */\n readonly needsDecision?: string;\n}\n\n/** A reported gap the derivation did not turn into a follow-up, and why, so the log can say it. */\nexport interface FollowUpGapNotDerived extends FollowUpGap {\n readonly reason: FollowUpGapNotDerivedReason;\n /** For {@link FollowUpGapNotDerivedReason.MET_SINCE}: the run that stated it met, and where. */\n readonly metSince?: Omit<FollowUpGapMetSince, 'gap' | 'followUpTaskRef'>;\n}\n\n/** Why a reported gap derives no follow-up task (#2496). */\nexport enum FollowUpGapNotDerivedReason {\n /** The origin's target lands by its own probe (a shell placement), so a follow-up would read as landed without running. */\n TARGET_LANDS_BY_ITS_OWN_PROBE = 'TARGET_LANDS_BY_ITS_OWN_PROBE',\n /** The origin is a companion generation step, which no coding run ever runs. */\n GENERATION_STEP = 'GENERATION_STEP',\n /**\n * A LANDED later run of another task on the same target, serving the same requirement, STATED it met (#3227): its closing\n * report's `wildo-requirements-met` block names the requirement, with where. Measured on app-creation-test-007: six of\n * eleven follow-ups changed nothing, their workers saying another task had already met the gap, at about 20 minutes of\n * selection and a run each. Only that positive statement drops a gap; silence and a malformed block never do.\n */\n MET_SINCE = 'MET_SINCE',\n /**\n * The follow-up that would carry it could not join the plan (#3204): its ref already names a task, or the plan refused\n * it. Recorded so the gap still reads OPEN, with no follow-up, rather than falling out of every reading.\n */\n FOLLOW_UP_NOT_APPENDED = 'FOLLOW_UP_NOT_APPENDED',\n /**\n * The report said a PERSON must decide something first (#3886: `needsDecision`): no coding task can close it, so none is\n * derived. It stays OPEN, for the maturity reading and on the creation Home's ASKED section. On reference run 43691253927\n * six follow-up runs changed nothing for this reason (\"the creator must decide the RESOURCE_DATA retention period\").\n */\n AWAITS_DECISION = 'AWAITS_DECISION',\n}\n\n/** A reported gap a later run states is met (#3227): the candidate a host may drop, once it has checked the run landed. */\nexport interface FollowUpGapMetSince {\n readonly gap: FollowUpGap;\n /**\n * The follow-up the gap's own report would derive: a host keeps the gap when that follow-up was ever attempted (#2530),\n * and ALSO when the follow-up that carries it was (#3204: an absorbed gap is carried under another report's ref, so a\n * host asks {@link FollowUpDerivation.followUpTaskRefFor} as well).\n */\n readonly followUpTaskRef: string;\n /** The task whose run stated it met. */\n readonly metByTaskRef: string;\n /** That run: a host drops the gap only when the run LANDED (everything it wrote is committed). */\n readonly metByRunTaskId: string;\n /** Where the run said it is met. */\n readonly evidence: string;\n}\n\n/** The key one gap is addressed by: its origin, its reporting run and its requirement. */\nexport function followUpGapKey(gap: Pick<FollowUpGap, 'originTaskRef' | 'reportingRunTaskId' | 'requirementRef'>): string {\n return `${gap.originTaskRef}\\u0000${gap.reportingRunTaskId}\\u0000${gap.requirementRef}`;\n}\n\n/**\n * The reference a PERSON is shown for one report a derived follow-up covers (#3833): `<requirementRef>@<originTaskRef>/<run>`,\n * so `wildo build tasks` can list it and `wildo build close|approve --covers` can send back what was seen. It names the\n * same three parts as {@link followUpGapKey}, so two reports never share one. The requirement ref and the run id come\n * from a run's report and the plan, so each part is percent-encoded: the result never holds a comma (the CLI splits\n * `--covers` on commas), whitespace, or a separator of its own (`@`, `/`). A task ref is already a slug.\n */\nexport function followUpReportRefOf(gap: Pick<FollowUpGap, 'originTaskRef' | 'reportingRunTaskId' | 'requirementRef'>): string {\n return `${encodeURIComponent(gap.requirementRef)}@${encodeURIComponent(gap.originTaskRef)}/${encodeURIComponent(gap.reportingRunTaskId)}`;\n}\n\n/** One derived follow-up task, with every gap it answers. */\nexport interface DerivedFollowUp {\n /** The task, chained after the follow-up before it on its target (see {@link chainFollowUpAfter}). */\n readonly task: BuildPlanTask;\n readonly gaps: readonly FollowUpGap[];\n /**\n * Its CHAIN's identity: its target's, or its target's for one owner (#3886). The follow-ups sharing one are chained, in\n * the order their reports settled.\n */\n readonly targetKey: string;\n /**\n * What it waits on before the chain link: its first report's origin (`followUpOf` reads it, so it stays FIRST), never\n * every origin it carries (#3204); the owner its gaps were reported as (#3886); and, for a routed follow-up with no\n * owner, the planned tasks of the scope it was routed to (#3991). {@link chainFollowUpAfter} appends the follow-up\n * before it on its target.\n */\n readonly ownPrerequisiteTaskRefs: readonly string[];\n /**\n * The reports it absorbed, each as the follow-up it would be on its own (#3204): what the host appends instead when this\n * one cannot join the plan (its ref already names a task, the plan refuses it), so an absorbed report is never lost\n * with it. Empty when it carries only its own report.\n */\n readonly absorbed: readonly Omit<DerivedFollowUp, 'absorbed'>[];\n}\n\n/**\n * What the follow-ups the build already dispatched CARRIED (#3204): per dispatched follow-up ref, every gap key\n * ({@link followUpGapKey}) recorded on its runs at dispatch, read from the same derivation that wrote the objective the\n * run received. A ref absent from the map was never dispatched; a run that recorded no keys carried its own report only.\n */\nexport type FollowUpDispatchRecord = ReadonlyMap<string, ReadonlySet<string>>;\n\n/**\n * What decides which reports a follow-up absorbs (#3204). Both halves must be known; without either, nothing is absorbed\n * and every report keeps a follow-up of its own (the behaviour before absorption).\n */\nexport interface FollowUpAbsorptionInputs {\n readonly dispatched: FollowUpDispatchRecord;\n /**\n * Follow-ups a person decided on (closed, approved) or that a decision holds: FIXED, like a dispatched one, to their own\n * report and the gap keys the decision recorded (#3832: what the objective showed when the person decided). A decision\n * recorded before that field fixes the follow-up to its own report; what it had absorbed is carried again by the next\n * follow-up and shown again, never closed or released by a decision that may not have covered it.\n */\n readonly decided: FollowUpDispatchRecord;\n}\n\nexport interface FollowUpDerivation {\n readonly followUps: readonly DerivedFollowUp[];\n readonly notDerived: readonly FollowUpGapNotDerived[];\n /** The follow-up that carries one origin's reported requirement, when one does (the website claim delivery asks). */\n followUpTaskRefFor(originTaskRef: string, requirementRef: string): string | undefined;\n /** Whether one origin's reported requirement was dropped because a landed later run stated it met (#3227). */\n gapMetSince(originTaskRef: string, requirementRef: string): boolean;\n}\n\n/**\n * The follow-up ref of ONE origin's ONE reporting run: the origin, then a token of the run, so the same report derives the\n * same task on every read while a later run reporting again derives a NEW task (the old follow-up's completed run must not\n * land the new report at birth). Always a slug the graph schema accepts: an origin ref with no ASCII letter or digit is\n * named by a digest instead, so no agent-written string can make the plan unreadable.\n *\n * The requirement is not part of the ref (#3227): one run reporting two requirements is ONE follow-up. app-creation-test-007\n * ran `…job-config-…-building-customer-lifecycle-3d9049` and `…job-config-…-shared-office-field-customer-context-3d9049`,\n * the same task, from the same run, twice, both changing nothing.\n */\nexport function deriveFollowUpTaskRef(originTaskRef: string, reportingRunTaskId: string): string {\n const slug = (value: string) => value.toLowerCase().replace(/[^a-z0-9]+/gu, '-').replace(/^-+|-+$/gu, '');\n const digest = (value: string) => createHash('sha256').update(value).digest('hex');\n const origin = slug(originTaskRef.replace(/^build-task-/u, '')) || `t${digest(originTaskRef).slice(0, 8)}`;\n return `${HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX}${origin}-${digest(reportingRunTaskId).slice(0, 6)}`;\n}\n\n/**\n * A follow-up waiting on what it waits on by itself (`ownPrerequisiteTaskRefs`: its first report's origin, its gaps' owner\n * (#3886) or its routed scope's planned tasks (#3991)) and, when there is one, on the follow-up before it on its target. One function, so the\n * dispatch host can re-link a follow-up after one it could not append (a name collision, a schema refusal): a chain\n * naming a task the plan does not hold would make the plan unreadable.\n */\nexport function chainFollowUpAfter(followUp: Pick<DerivedFollowUp, 'task' | 'ownPrerequisiteTaskRefs'>, previousOnTarget: string | undefined): BuildPlanTask {\n const own = [...followUp.ownPrerequisiteTaskRefs];\n return { ...followUp.task, prerequisiteTaskRefs: previousOnTarget === undefined ? own : [...own, previousOnTarget] };\n}\n\n/** A target's identity: two tasks with equal targets write the same scope (#3227). */\nexport function targetKey(target: BuildPlanTask['target']): string {\n const entries = Object.entries(target as Record<string, unknown>).sort(([left], [right]) => left.localeCompare(right));\n return JSON.stringify(entries);\n}\n\n/**\n * The follow-up tasks the reported gaps derive (#2496, #3227). Pure: the dispatch host supplies the plan and each task's\n * latest completed run.\n *\n * ## One follow-up per target for what is not dispatched yet, chained per target\n *\n * - **Every requirement one run reported is folded into one follow-up** (#3227): one scope, one worker, one set of\n * checks, instead of the same task once per requirement.\n * - **A follow-up not dispatched yet absorbs every later report on its target** (#3204): one worker reads the scope once,\n * with every gap in front of it. The reference run of 2026-11-12 derived 225 follow-ups from website sections onto 24\n * modules (17 requirements, each re-reported by up to 7 sections and routed to every module serving it), and 173 changed\n * nothing. Absorption needs the dispatch record and the decisions (`absorption`); without them, one follow-up per report.\n * - **Its identity is its FIRST report's origin and run, and nothing else**, so it is STABLE: a later report joins it\n * rather than renaming it, and a follow-up the build is running, or has run, never leaves the plan because somebody\n * else reported (#2530). Once dispatched it is FIXED: it carries exactly the gaps recorded on its runs at dispatch,\n * which are the gaps its objective held, and a later report starts the next one. A follow-up a person closed or\n * approved is fixed too, to the gaps the decision recorded ({@link FollowUpAbsorptionInputs}, #3832).\n * - **Follow-ups on one target are chained IN THE ORDER THEIR REPORTS SETTLED** (then by origin ref), each waiting on the\n * one before it: they write one scope, and two of them at once would overwrite each other (the interference that made\n * the wave re-run each alone). Report order rather than plan order, so a new report always joins the TAIL: in plan\n * order, an origin earlier in the plan reporting later went to the head, made a running follow-up wait on it, and was\n * ready at once beside it (review of f077ae7db). A follow-up declares no product, so no interference check could see it.\n * - **Of the origins it carries, it waits on its first report's only**: the chain already holds a target's later follow-ups behind the earlier\n * ones, so waiting on every absorbed origin would hold all their gaps behind any one of them that never lands.\n * - **It does not wait on the other tasks serving its requirements across the plan**, only names them: a task that never\n * lands would hold it for ever. Waiting was weighed again for #3204 and would not have helped: on that reference run the\n * sections reported their gaps after most of the product tasks serving them had run.\n * - **Except the tasks of the scope it was ROUTED to (#3991)**, when no owner was named. A routed follow-up writes their\n * scope, so running before them does their work: on reference run 43876218697 a routed gap overtook the planned\n * provider-binding task and did its whole job. Waiting on them costs only when one never lands, and then the gap is that\n * task's and stays open under it; once they land, a run of theirs that states it met drops the gap (#3227). Absorbed\n * reports add their scope's tasks too: they are the same scope. An OWNED gap waits on its named owner instead (#3886),\n * so owners never wait on each other.\n *\n * ## A gap a later run STATED met is dropped; silence drops nothing\n *\n * Dropping on ABSENCE was tried and withdrawn (review of 5e3ab7d76): a missing block, a malformed one and a run that never\n * looked at the requirement all read the same, so it closed gaps nobody had closed. The worker contract now carries the\n * positive half, a `wildo-requirements-met` block, and a gap is dropped only when {@link collectFollowUpGapsMetSince} finds\n * a later run that states it and the host confirms that run LANDED and no follow-up carrying the gap was ever attempted\n * (`metSince`): neither its own report's nor one that absorbed it (#3204).\n * Every drop is in `notDerived`, with the run and its evidence, so the host logs it. The follow-up's own worker is still\n * told to read what was built since and change nothing when a gap is met.\n *\n * Unchanged: the chain is one step long (a follow-up's own report derives nothing), and an origin whose target lands by\n * its own probe or is a generation step derives nothing. A follow-up keeps its origin's target and skills, EXCEPT when the\n * origin only presents the product (#3701): its gaps go to the product scopes serving the requirement, see\n * {@link resolveFollowUpClosingScopes}.\n */\nexport function deriveBuildPlanFollowUpTasks(input: {\n readonly tasks: readonly BuildPlanTask[];\n readonly latestCompletedRuns: ReadonlyMap<string, FollowUpReportingRun>;\n /**\n * The gaps a host CONFIRMED met since (#3227), by {@link followUpGapKey}: candidates from\n * {@link collectFollowUpGapsMetSince} whose stating run landed and that no attempted follow-up carries (#3204). Absent drops\n * nothing, which is the reading when the host could not check.\n */\n readonly metSince?: ReadonlyMap<string, FollowUpGapMetSince>;\n /**\n * What the dispatched follow-ups carried and which are fixed by a decision (#3204): lets a follow-up not yet dispatched\n * absorb every later report on its target. Absent absorbs nothing, the reading when the host could not tell.\n */\n readonly absorption?: FollowUpAbsorptionInputs;\n}): FollowUpDerivation {\n const notDerived: FollowUpGapNotDerived[] = [];\n const reports: { readonly origin: BuildPlanTask; readonly run: FollowUpReportingRun; readonly gaps: readonly FollowUpGap[] }[] = [];\n const planTasks = input.tasks.filter((task) => !task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX));\n for (const origin of planTasks) {\n const run = input.latestCompletedRuns.get(origin.taskRef);\n const reported = run?.unmetRequirements ?? [];\n if (run === undefined || reported.length === 0) continue;\n const reportedGaps: FollowUpGap[] = reported.map((entry) => ({\n originTaskRef: origin.taskRef,\n reportingRunTaskId: run.runTaskId,\n requirementRef: entry.requirementRef,\n missing: entry.missing,\n ...(entry.ownedByTaskRef !== undefined ? { ownedByTaskRef: entry.ownedByTaskRef } : {}),\n ...(entry.needsDecision !== undefined ? { needsDecision: entry.needsDecision } : {}),\n }));\n if (origin.target.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {\n notDerived.push(...reportedGaps.map((gap) => ({ ...gap, reason: FollowUpGapNotDerivedReason.GENERATION_STEP })));\n continue;\n }\n if (resolveBuildTaskLandedProbes({ ...origin, produces: [] }).length > 0) {\n notDerived.push(...reportedGaps.map((gap) => ({ ...gap, reason: FollowUpGapNotDerivedReason.TARGET_LANDS_BY_ITS_OWN_PROBE })));\n continue;\n }\n // A gap a landed later run stated met, as the host confirmed (#3227): dropped, and named.\n const gaps = reportedGaps.filter((gap) => {\n const met = input.metSince?.get(followUpGapKey(gap));\n if (met === undefined) return true;\n notDerived.push({ ...gap, reason: FollowUpGapNotDerivedReason.MET_SINCE, metSince: { metByTaskRef: met.metByTaskRef, metByRunTaskId: met.metByRunTaskId, evidence: met.evidence } });\n return false;\n }).filter((gap) => {\n // A decision only a person can make (#3886): no coding task, and the gap stays open on ASKED.\n if (gap.needsDecision === undefined) return true;\n notDerived.push({ ...gap, reason: FollowUpGapNotDerivedReason.AWAITS_DECISION });\n return false;\n });\n if (gaps.length === 0) continue;\n reports.push({ origin, run, gaps });\n }\n // Report order: when the reporting run settled (its start when it recorded no settlement), then the origin's ref. A\n // timestamp that does not parse sorts last, never as 1970, so it cannot jump ahead of reports whose time is known.\n const reportedAt = (run: FollowUpReportingRun): number => {\n const at = Date.parse(run.settledAt ?? run.startedAt);\n return Number.isNaN(at) ? Number.POSITIVE_INFINITY : at;\n };\n const byReportedAt = (left: number, right: number): number => (left === right ? 0 : left < right ? -1 : 1);\n reports.sort((left, right) => byReportedAt(reportedAt(left.run), reportedAt(right.run)) || left.origin.taskRef.localeCompare(right.origin.taskRef));\n\n /*\n * Every report's gaps, per CLOSING SCOPE (#3701): the origin's own, unless the origin only presents the product, in\n * which case each product scope serving a reported requirement gets the gaps it can close. A routed group's ref adds its\n * scope to the run's token, so the same report keeps naming the same task.\n */\n interface ReportGroup {\n readonly origin: BuildPlanTask;\n readonly run: FollowUpReportingRun;\n readonly scope: FollowUpClosingScope;\n readonly gaps: FollowUpGap[];\n readonly taskRef: string;\n readonly settledAtMs: number;\n /** The planned task whose work its gaps are (#3886): the follow-up waits for it, and nothing else on the target waits on the follow-up. */\n readonly owner?: string;\n }\n /*\n * The owner a report named, when the plan can honour it (#3886): a planned task (never a follow-up), not the origin\n * itself, that serves the very requirement. Anything else is ignored and the gap is an ordinary one: a worker's free text\n * must never make a follow-up wait on a task that does not exist or does not do that work.\n */\n const honouredOwner = (gap: FollowUpGap, origin: BuildPlanTask): string | undefined => honouredFollowUpOwner(gap, origin, planTasks);\n const groupsByTarget = new Map<string, ReportGroup[]>();\n for (const { origin, run, gaps } of reports) {\n const byScope = new Map<string, ReportGroup>();\n for (const gap of gaps) {\n const owner = honouredOwner(gap, origin);\n for (const scope of resolveFollowUpClosingScopes(origin, gap.requirementRef, planTasks)) {\n const key = targetKey(scope.target);\n const routed = scope.servingTaskRefs.length > 0;\n // An owned gap is its own group, so waiting for its owner holds no other gap (#3886); unowned refs are unchanged.\n const groupKey = owner === undefined ? key : `${key}\\u0000owner:${owner}`;\n const group = byScope.get(groupKey) ?? {\n origin, run, scope, gaps: [],\n taskRef: owner !== undefined ? deriveFollowUpTaskRef(origin.taskRef, `${run.runTaskId}\\u0000${key}\\u0000owner:${owner}`)\n : routed ? deriveFollowUpTaskRef(origin.taskRef, `${run.runTaskId}\\u0000${key}`) : deriveFollowUpTaskRef(origin.taskRef, run.runTaskId),\n settledAtMs: reportedAt(run),\n ...(owner !== undefined ? { owner } : {}),\n };\n group.gaps.push(gap);\n byScope.set(groupKey, group);\n }\n }\n for (const group of byScope.values()) {\n const key = targetKey(group.scope.target);\n groupsByTarget.set(key, [...(groupsByTarget.get(key) ?? []), group]);\n }\n }\n\n /*\n * ONE follow-up per target for everything not yet dispatched (#3204). The reference run of 2026-11-12 derived 225\n * follow-ups from website sections on 24 module scopes: 17 requirements, each reported by up to 7 sections and routed\n * to every module serving it, all waiting at once, and 173 changed nothing.\n *\n * - A DISPATCHED follow-up carries its own report and exactly the gaps recorded on its runs (what its objective held).\n * - A DECIDED follow-up (a person closed or approved it, or a decision holds it) carries its own report and exactly the\n * gaps the decision recorded (#3832).\n * - Every other gap on the target goes to ONE pending follow-up: the first report not yet dispatched, under its own ref,\n * so it is never renamed (#2530). One worker reads the scope once, with every gap in front of it.\n *\n * Only the first report's origin is waited on: the chain already held every later follow-up on a target behind the\n * earlier ones, so waiting on each absorbed origin as well would hold the gaps of all of them behind any one.\n */\n const absorption = input.absorption;\n interface Member {\n readonly anchor: ReportGroup;\n /** The gaps it carries from other reports, by their report. */\n readonly carried: Map<ReportGroup, FollowUpGap[]>;\n }\n const followUpsByTarget: DerivedFollowUp[] = [];\n for (const [key, groups] of groupsByTarget) {\n const members: Member[] = [];\n const closedToAbsorption = (group: ReportGroup) => absorption === undefined || absorption.dispatched.has(group.taskRef) || absorption.decided.has(group.taskRef);\n const anchoredAlone = new Map<ReportGroup, Member>();\n for (const group of groups) {\n if (absorption === undefined || closedToAbsorption(group)) {\n const member: Member = { anchor: group, carried: new Map() };\n members.push(member);\n anchoredAlone.set(group, member);\n }\n }\n if (absorption !== undefined) {\n // What each dispatched or decided follow-up carried, from its records; never a gap whose own report is either.\n const claimedBy = new Map<string, Member>();\n for (const member of members) {\n const recorded = new Set([...(absorption.dispatched.get(member.anchor.taskRef) ?? []), ...(absorption.decided.get(member.anchor.taskRef) ?? [])]);\n for (const group of groups) {\n if (group === member.anchor || closedToAbsorption(group)) continue;\n for (const gap of group.gaps) {\n const gapKey = followUpGapKey(gap);\n if (!recorded.has(gapKey) || claimedBy.has(gapKey)) continue;\n claimedBy.set(gapKey, member);\n member.carried.set(group, [...(member.carried.get(group) ?? []), gap]);\n }\n }\n }\n // The decided anchors are already in the order their reports settled (pushed in report order above).\n // Everything else: the first pending report anchors, every later one joins it. Its follow-up goes LAST on its target,\n // after every dispatched or decided one, so a report that surfaced late never runs beside one already running.\n // One pending follow-up for the target's unowned gaps, and one per owner (#3886), so an owner holds only its own gaps.\n const pendingByOwner = new Map<string | undefined, Member>();\n for (const group of groups) {\n if (closedToAbsorption(group)) continue;\n const remaining = group.gaps.filter((gap) => !claimedBy.has(followUpGapKey(gap)));\n if (remaining.length === 0) continue;\n const pending = pendingByOwner.get(group.owner);\n if (pending === undefined) {\n const member: Member = { anchor: { ...group, gaps: remaining }, carried: new Map() };\n pendingByOwner.set(group.owner, member);\n members.push(member);\n } else {\n pending.carried.set(group, remaining);\n }\n }\n }\n /*\n * A follow-up waiting for its owner is on a CHAIN OF ITS OWN (#3886, review M1): it waits on the follow-up before it\n * for the same owner on this target, never on another owner's or on the target's unowned follow-ups, and none of them\n * waits on it. One chain per target would hold every gap behind any owner that never lands, #3204's objection one level\n * down. Two follow-ups on one scope still never RUN at once: the dispatch's selection takes one follow-up per scope at a\n * time (`followUpScopeBusy`), since they declare no product and nothing else could see them meet.\n */\n const build = (anchor: ReportGroup, contributions: readonly (readonly [ReportGroup, readonly FollowUpGap[]])[]): Omit<DerivedFollowUp, 'absorbed'> => {\n const all = contributions.map(([group]) => group);\n const gaps = contributions.flatMap(([, contributed]) => contributed);\n const requirementRefs = [...new Set(gaps.map((gap) => gap.requirementRef))];\n const originRefs = [...new Set(all.map((group) => group.origin.taskRef))];\n const servingTasks = [...new Set(planTasks\n .filter((task) => !originRefs.includes(task.taskRef) && requirementRefs.some((ref) => task.servesRefs.includes(ref)))\n .map((task) => task.taskRef))];\n const builtBy = [...new Set(all.flatMap((group) => group.scope.servingTaskRefs))];\n const downstreamOfOrigins = planTasksDownstreamOf(originRefs, planTasks);\n const describe = (groupGaps: readonly FollowUpGap[]) => {\n const byRequirement = new Map<string, Set<string>>();\n for (const gap of groupGaps) byRequirement.set(gap.requirementRef, (byRequirement.get(gap.requirementRef) ?? new Set()).add(gap.missing));\n return [...byRequirement].map(([ref, missing]) => `${ref}: ${[...missing].join(' / ')}`).join(' ');\n };\n const routed = contributions.filter(([group]) => group.scope.servingTaskRefs.length > 0);\n const own = contributions.filter(([group]) => group.scope.servingTaskRefs.length === 0);\n const presenters = [...new Set(routed.map(([group]) => group.origin.taskRef))];\n const reporters = [...new Set(own.map(([group]) => group.origin.taskRef))];\n /*\n * A ROUTED follow-up waits for the planned tasks whose scope it writes (#3991), as an owned one waits for its named\n * owner (#3886). Measured on reference run 43876218697: a website page reported that the daily digest reached no\n * inbox, the gap was routed to `build-task-brevo-provider-binding`'s scope while that task was still blocked, and the\n * follow-up did the whole binding itself (installed the provider, bound it) ahead of the task planned for it.\n *\n * Narrower than what #3204 refused: not every task serving the requirement across the plan, only those whose own\n * scope this follow-up writes, so the work it would do is exactly theirs. One that never lands leaves the gap open\n * under it. Once they land, a run of theirs that states the requirement met drops the gap (#3227) at no run's cost.\n */\n /*\n * An UNOWNED follow-up also waits for the planned tasks DOWNSTREAM of its origins that serve the same requirement\n * (#3999). What a stage reports missing lies outside its own scope, and planned later work is what delivers it.\n * Measured on reference run 43961156770: a communication schema reported its resource \"not yet linked to its\n * contact, customer…\", and the follow-up wrote the module's relationships before the planned relationships task,\n * whose prerequisites (the customer, contact and job configs) had not landed. Once they land, a run of theirs that\n * states the requirement met drops the gap at no run's cost (#3227).\n */\n const downstreamServing = anchor.owner !== undefined ? [] : servingTasks.filter((ref) => downstreamOfOrigins.has(ref));\n // Owned: the named owner (#3886), so one owner never holds another's gaps. Routed and unowned: the scope's tasks.\n const ownPrerequisiteTaskRefs = [...new Set([anchor.origin.taskRef, ...(anchor.owner !== undefined ? [anchor.owner] : [...builtBy, ...downstreamServing])])];\n const objective = (routed.length > 0\n ? `${presenters.join(', ')} ${presenters.length > 1 ? 'present' : 'presents'} the product and reported that the product does not yet deliver: `\n + describe(routed.flatMap(([, contributed]) => contributed))\n // Only an UNOWNED routed follow-up waits for the scope's tasks, so only it may say they built it (#3991).\n + (anchor.owner === undefined\n ? ` Build what is missing in this scope, where ${builtBy.join(', ')} ${builtBy.length > 1 ? 'have' : 'has'} built the requirement; a page cannot. `\n : ` Build what is missing in the scope of ${builtBy.join(', ')}; a page cannot. `)\n + 'If what is missing lies outside this scope, change nothing and report it. '\n : '')\n + (own.length > 0 ? `Meet what ${reporters.join(', ')} reported still unmet: ${describe(own.flatMap(([, contributed]) => contributed))} ` : '')\n + (contributions.length > 1 ? 'These reports were gathered into this one task because they concern this one scope: answer each. ' : '')\n + 'Read what is already built first: if a task that ran since has met one, change nothing for it and say so. '\n + (anchor.owner !== undefined ? `It was reported as ${anchor.owner}'s own work, so it runs once that task has landed: read what it built, and change nothing for a gap it met. ` : '')\n // Every serving task it does not wait on: their work is theirs, whether or not it has run yet.\n + (servingTasks.some((ref) => !ownPrerequisiteTaskRefs.includes(ref)) ? `Other tasks serving them: ${servingTasks.filter((ref) => !ownPrerequisiteTaskRefs.includes(ref)).join(', ')}; their work is theirs. ` : '')\n + (contributions.length > 1 ? 'Derived by the dispatch host from those runs\\' closing reports.' : 'Derived by the dispatch host from that run\\'s closing report.');\n return {\n task: {\n taskRef: anchor.taskRef,\n objective,\n target: anchor.scope.target,\n /*\n * No product, ever: a follow-up lands on its completed run (RAN-not-PROVEN), and declaring its origin's products\n * would read it landed before it ran. A follow-up on a RELATIONSHIP target therefore carries\n * RELATIONSHIP_TARGET_DISAGREES_WITH_PRODUCTS, a floor of the AUTHORED plan (it keeps the domain-coverage count,\n * which reads authored targets, honest). Kept, decided 2026-11-18: lifting it to its MODULE would let it write the\n * whole module beside the planned tasks that own it, and exempting a product-less task in the validator would let\n * an AUTHORED relationship task count an edge it never proves. So a host check over the derived plan judges only\n * the findings it introduces (`deriveGuardedWebsiteClaimPrerequisites` in the dispatch host).\n */\n produces: [],\n functionalTopic: anchor.scope.functionalTopic,\n skillRefs: [...new Set(all.flatMap((group) => group.scope.skillRefs))],\n // Its first report's origin (`followUpOf` reads it), then EITHER the owner its gaps were reported as (#3886) OR, when\n // routed with no owner, the planned tasks of its scope (#3991); the follow-up before it on its target is added by the chain.\n prerequisiteTaskRefs: ownPrerequisiteTaskRefs,\n // Only refs an origin serves: a free-text ref would be a dangling citation in the plan.\n servesRefs: requirementRefs.filter((ref) => all.some((group) => group.origin.servesRefs.includes(ref))),\n } as BuildPlanTask,\n gaps,\n // The CHAIN it belongs to (#3886): its target's, or its target's for one owner, so owners never wait on each other.\n targetKey: anchor.owner === undefined ? key : `${key}\\u0000owner:${anchor.owner}`,\n ownPrerequisiteTaskRefs,\n };\n };\n const previousOnChain = new Map<string, string>();\n for (const { anchor, carried } of members) {\n const derived: DerivedFollowUp = {\n ...build(anchor, [[anchor, anchor.gaps], ...carried]),\n absorbed: [...carried].map(([group, contributed]) => build(group, [[group, contributed]])),\n };\n const task = chainFollowUpAfter(derived, previousOnChain.get(derived.targetKey));\n previousOnChain.set(derived.targetKey, task.taskRef);\n followUpsByTarget.push({ ...derived, task });\n }\n }\n return assembleFollowUpDerivation(followUpsByTarget, notDerived);\n}\n\n/**\n * Every planned task that waits, directly or through others, on one of `taskRefs` (#3999): the plan's later work on what\n * they built. Follow-ups are never in it, so a follow-up waiting on these can close no cycle.\n */\nexport function planTasksDownstreamOf(taskRefs: readonly string[], planTasks: readonly BuildPlanTask[]): ReadonlySet<string> {\n const downstream = new Set<string>();\n const reached = new Set(taskRefs);\n for (let grew = true; grew;) {\n grew = false;\n for (const task of planTasks) {\n if (reached.has(task.taskRef) || task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX)) continue;\n if (task.prerequisiteTaskRefs.some((ref) => reached.has(ref))) {\n reached.add(task.taskRef);\n downstream.add(task.taskRef);\n grew = true;\n }\n }\n }\n return downstream;\n}\n\n/**\n * The owner a report named for a gap, when the plan can honour it (#3886): a planned task (never a follow-up), not the\n * origin itself, that serves the very requirement. Anything else is ignored and the gap is an ordinary one.\n */\nexport function honouredFollowUpOwner(\n gap: Pick<FollowUpGap, 'requirementRef' | 'ownedByTaskRef'>,\n origin: BuildPlanTask,\n planTasks: readonly BuildPlanTask[],\n): string | undefined {\n if (gap.ownedByTaskRef === undefined) return undefined;\n const owner = planTasks.find((task) => task.taskRef === gap.ownedByTaskRef && !task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX));\n return owner !== undefined && owner.taskRef !== origin.taskRef && owner.servesRefs.includes(gap.requirementRef) ? owner.taskRef : undefined;\n}\n\n/**\n * A derivation's readers over a given set of follow-ups (#3204): what the plan holds, so a host that could not append one\n * (and appended the reports it absorbed instead) answers from what it appended, and no reader names a task the plan lacks.\n */\nexport function assembleFollowUpDerivation(followUps: readonly DerivedFollowUp[], notDerived: readonly FollowUpGapNotDerived[]): FollowUpDerivation {\n const refByOriginRequirement = new Map<string, string>();\n for (const followUp of followUps) {\n for (const gap of followUp.gaps) {\n const originRequirement = `${gap.originTaskRef}\\u0000${gap.requirementRef}`;\n if (!refByOriginRequirement.has(originRequirement)) refByOriginRequirement.set(originRequirement, followUp.task.taskRef);\n }\n }\n return {\n followUps,\n notDerived,\n followUpTaskRefFor: (originTaskRef, requirementRef) => refByOriginRequirement.get(`${originTaskRef}\\u0000${requirementRef}`),\n gapMetSince: (originTaskRef, requirementRef) => notDerived.some((gap) => gap.reason === FollowUpGapNotDerivedReason.MET_SINCE\n && gap.originTaskRef === originTaskRef && gap.requirementRef === requirementRef),\n };\n}\n\n/**\n * The reported gaps a LATER run states met (#3227), pure: the candidates a host may drop. For each gap an eligible origin\n * reported (one the derivation would turn into a follow-up), the first other task that\n *\n * - writes the SAME target (two tasks with equal targets write the same scope, so its statement is about the same surface),\n * - serves the same requirement,\n * - completed a run that STARTED after the reporting run settled (it read the tree the report described, or a later one),\n * - and whose run's `wildo-requirements-met` block names the requirement and its unmet block does not.\n *\n * EVERY such task is a candidate, in plan order, so a statement whose run has not landed does not hide one that has. A\n * gap's own follow-up is never its verifier: once it has run, it is attempted and keeps the gap anyway. The host must\n * still confirm that the stating run LANDED and that no follow-up carrying the gap (its own, or one that absorbed it,\n * #3204) was ever attempted before it passes a candidate on as\n * `metSince`; this function only finds who said so.\n */\nexport function collectFollowUpGapsMetSince(input: {\n readonly tasks: readonly BuildPlanTask[];\n readonly latestCompletedRuns: ReadonlyMap<string, FollowUpReportingRun>;\n}): readonly FollowUpGapMetSince[] {\n const candidates: FollowUpGapMetSince[] = [];\n const planTasks = input.tasks.filter((task) => !task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX));\n for (const origin of planTasks) {\n const run = input.latestCompletedRuns.get(origin.taskRef);\n if (run === undefined || (run.unmetRequirements ?? []).length === 0) continue;\n if (origin.target.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP || resolveBuildTaskLandedProbes({ ...origin, produces: [] }).length > 0) continue;\n const reportedAt = Date.parse(run.settledAt ?? run.startedAt);\n if (Number.isNaN(reportedAt)) continue;\n const followUpTaskRef = deriveFollowUpTaskRef(origin.taskRef, run.runTaskId);\n for (const entry of run.unmetRequirements ?? []) {\n /*\n * A statement counts from a task writing a scope that CLOSES the gap (#3701): the origin's own, or for a presenting\n * origin the product scopes its gap is routed to, where a task's target is read through the same lift.\n */\n const scopes = resolveFollowUpClosingScopes(origin, entry.requirementRef, planTasks);\n const closingKeys = new Set(scopes.map((scope) => targetKey(scope.target)));\n const routedRefs = new Set(scopes.filter((scope) => scope.servingTaskRefs.length > 0)\n .map((scope) => deriveFollowUpTaskRef(origin.taskRef, `${run.runTaskId}\\u0000${targetKey(scope.target)}`)));\n const routed = routedRefs.size > 0;\n // The follow-ups an owned gap derives (#3886, review LOW) are this report's own too: never a run that met it since.\n const owner = honouredFollowUpOwner(entry, origin, planTasks);\n const ownedRefs = new Set(owner === undefined ? [] : scopes.map((scope) => deriveFollowUpTaskRef(origin.taskRef, `${run.runTaskId}\\u0000${targetKey(scope.target)}\\u0000owner:${owner}`)));\n for (const task of input.tasks) {\n if (task.taskRef === origin.taskRef || task.taskRef === followUpTaskRef || routedRefs.has(task.taskRef) || ownedRefs.has(task.taskRef)) continue;\n const taskScope = routed ? productClosingTarget(task.target) : task.target;\n if (taskScope === undefined || !closingKeys.has(targetKey(taskScope)) || !task.servesRefs.includes(entry.requirementRef)) continue;\n const later = input.latestCompletedRuns.get(task.taskRef);\n if (later === undefined || !(Date.parse(later.startedAt) > reportedAt)) continue;\n if ((later.unmetRequirements ?? []).some((unmet) => unmet.requirementRef === entry.requirementRef)) continue;\n const met = (later.metRequirements ?? []).find((statement) => statement.requirementRef === entry.requirementRef);\n if (met === undefined) continue;\n candidates.push({\n gap: { originTaskRef: origin.taskRef, reportingRunTaskId: run.runTaskId, requirementRef: entry.requirementRef, missing: entry.missing },\n // A routed gap's first follow-up (#3701): the host keeps the gap when it was ever attempted.\n followUpTaskRef: routed ? [...routedRefs][0]! : followUpTaskRef,\n metByTaskRef: task.taskRef,\n metByRunTaskId: later.runTaskId,\n evidence: met.evidence,\n });\n }\n }\n }\n return candidates;\n}\n\n/** One reported gap still open, on one requirement (#2580): what the maturity reading caps the requirement for. */\nexport interface OpenReportedGap {\n readonly requirementRef: string;\n /** The task whose latest completed run reported it: an origin, or a follow-up still reporting it. */\n readonly originTaskRef: string;\n readonly missing: string;\n /** The follow-up derived to answer it, not landed yet. Absent when none was derived, or for a follow-up's own report. */\n readonly followUpTaskRef?: string;\n}\n\n/**\n * The reported gaps still OPEN (#2580), pure: a requirement carrying one is partly met, whatever probe found its file.\n *\n * - **A derived follow-up not landed yet**: every gap it carries is open, and names it.\n * - **A gap that derived no follow-up** because its target lands by its own probe or is a generation step: open, with no\n * follow-up, since nothing in the build will answer it. A gap a landed later run STATED met (`MET_SINCE`) is closed.\n * - **A LANDED follow-up whose own latest run still reports a requirement**: open, under the follow-up's ref. A follow-up's\n * report derives nothing further (the chain is one step long), so this is the only place it is still counted.\n *\n * A landed follow-up whose run reports nothing has closed its origin's gaps. Read from the same derivation that appends\n * the follow-ups to the plan, so the reading and the plan cannot disagree about which follow-up answers which gap.\n */\nexport function collectOpenReportedGaps(input: {\n readonly derivation: Pick<FollowUpDerivation, 'followUps' | 'notDerived'>;\n readonly tasks: readonly BuildPlanTask[];\n readonly latestCompletedRuns: ReadonlyMap<string, FollowUpReportingRun>;\n readonly landedTaskRefs: ReadonlySet<string>;\n}): readonly OpenReportedGap[] {\n const open: OpenReportedGap[] = [];\n for (const followUp of input.derivation.followUps) {\n if (input.landedTaskRefs.has(followUp.task.taskRef)) continue;\n for (const gap of followUp.gaps) {\n open.push({ requirementRef: gap.requirementRef, originTaskRef: gap.originTaskRef, missing: gap.missing, followUpTaskRef: followUp.task.taskRef });\n }\n }\n for (const gap of input.derivation.notDerived) {\n if (gap.reason === FollowUpGapNotDerivedReason.MET_SINCE) continue;\n open.push({ requirementRef: gap.requirementRef, originTaskRef: gap.originTaskRef, missing: gap.missing });\n }\n for (const task of input.tasks) {\n if (!task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX) || !input.landedTaskRefs.has(task.taskRef)) continue;\n for (const entry of input.latestCompletedRuns.get(task.taskRef)?.unmetRequirements ?? []) {\n open.push({ requirementRef: entry.requirementRef, originTaskRef: task.taskRef, missing: entry.missing });\n }\n }\n return open;\n}\n"]}