@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
@@ -14,13 +14,13 @@ import { MetaWorkflow_ContextSourceScreeningOutcome, MetaWorkflow_ContextSourceT
14
14
  import { readCompiledResearchInformedContent } from '@wildo-ai/framework-knowledge';
15
15
  import { existsSync, readdirSync } from 'node:fs';
16
16
  import { randomUUID } from 'node:crypto';
17
- import { mkdir, readFile, writeFile } from 'node:fs/promises';
17
+ import { mkdir, readFile, stat, writeFile } from 'node:fs/promises';
18
18
  import path, { join } from 'node:path';
19
19
  import { inject, injectable, optional } from 'inversify';
20
20
  import { AvailableLanguage } from '@wildo-ai/presets-components-models';
21
21
  import { ApplicationSchemaPlanObligation } from '../../core/config/application-schema-plan-obligation.companion.utils.js';
22
22
  import { experienceTaskSkillRefs, taskHasExperienceProduct } from './application-build-experience-skills.companion.service.js';
23
- import { buildWebsitePlanContextSource, citedRequirementRefsByWebsiteTask, deliveringTasksFor, deriveWebsiteClaimDelivery, deriveWebsiteTaskOrdering, describeWebsiteTaskCopySubjects, describeWebsiteTaskVisualSubjects, websiteTaskDemoResourceRef, websiteTaskSkillRefs, } from './application-build-website-context.companion.service.js';
23
+ import { buildWebsitePlanContextSource, citedRequirementRefsByWebsiteTask, deriveWebsiteClaimDelivery, deriveWebsiteClaimPrerequisites, deriveWebsiteTaskOrdering, describeWebsiteTaskCopySubjects, describeWebsiteTaskVisualSubjects, websiteTaskDemoResourceRef, websiteTaskSkillRefs, } from './application-build-website-context.companion.service.js';
24
24
  import { websiteDemoResourceFacts } from './website-demo-facts.models.js';
25
25
  import { collectWebsiteCopyDeclarations, currentWebsiteCopy, reviewWebsiteTaskCopy, } from './application-build-website-copy-review.companion.service.js';
26
26
  import { readWebsiteCopyReview, WebsiteCopyReviewOutcome } from '../models/website-copy-review.models.js';
@@ -34,8 +34,8 @@ import { assemblyRepairTaskRef, composeAssemblyRepairCodingContract, composeBuil
34
34
  import { SAAS_SERVICE_TYPES, describeCaughtError } from '@wildo-ai/saas-backend-lib';
35
35
  import { Actor_Task_Topics, FlowsActors_Status } from '@wildo-ai/saas-models';
36
36
  import { PER_SERVICE_WEBSITE_CONFIG_FILE_NAME, resolveStaticWebsiteServiceEntry } from '@wildo-ai/saas-website/config-loader';
37
- import { AcceptOrigin, ApplicationSpecificationFamily, BUILD_PLAN_TASK_GRAPH_HARD_FLOOR_CODES, BuildPlanResourceStage, BuildPlanTaskGraphSchema, BuildPlanTaskTargetKind, BuildPlanTaskProductKind, FrontendConfigSurface, DomainPlanTenancyModel, MetaWorkflow_FunctionalTopic, PlacementDisposition, PlacementPlanSchema, PlacementSurface, RoadmapSnapshotSchema, selectReadyBuildPlanTasks, validateBuildPlanTaskGraph, } from '@wildo-ai/saas-specifications/application-creation';
38
- import { relatedWorkspaceResources } from '../../core/introspection/workspace-element-index.companion.js';
37
+ import { AcceptOrigin, ApplicationSpecificationFamily, BUILD_PLAN_TASK_GRAPH_HARD_FLOOR_CODES, BuildPlanResourceStage, BuildPlanTaskGraphSchema, BuildPlanTaskTargetKind, BuildPlanTaskProductKind, FrontendConfigSurface, DomainPlanTenancyModel, MetaWorkflow_FunctionalTopic, PlacementDisposition, PlacementPlanSchema, PlacementSubjectKind, PlacementSurface, RoadmapSnapshotSchema, selectReadyBuildPlanTasks, validateBuildPlanTaskGraph, } from '@wildo-ai/saas-specifications/application-creation';
38
+ import { TARGET_NEIGHBOURHOOD_NOTE, neighbourhoodForCodingBrief, relatedWorkspaceResources } from '../../core/introspection/workspace-element-index.companion.js';
39
39
  import { BRIEF_INCOMPLETE_SOURCE_REF, BRIEF_PROVENANCE_UNAVAILABLE_SOURCE_REF, ThirdPartyBriefContent } from '../models/build-brief-content-trust.models.js';
40
40
  import { companionScreeningVerdicts, DERIVED_TEXT_UNSCREENED_NOTICE, DERIVED_TEXT_UNSCREENED_SOURCE_REF, screenRunOutputSection, screenThirdPartyBriefElements, unscreenedClassifierReason, WITHHELD_RUN_OUTPUT_NOTICE, } from './build-brief-third-party-screening.companion.js';
41
41
  import { loadEffectiveSystemOfRecordFacets, systemOfRecordInstancePartitionSupportOf } from './system-of-record-facet-library.companion.utils.js';
@@ -50,7 +50,7 @@ import { companionRestartDrain } from '../../core/runtime/restart-drain.companio
50
50
  import { getWorkspaceMutationLockPath, loadConfig, loadInfraEnvConfig, loadSaasConfig, readBuildParallelism, WildoEnvironment, withDedicatedFileLock } from '@wildo-ai/platform-config-lib';
51
51
  import { CodingRunConcurrency, failedVerificationBesideSiblings } from '../../claude-cli/models/concurrent-coding-runs.models.js';
52
52
  import { CodingAgentDispatchCompanionService, } from '../../claude-cli/services/coding-agent-dispatch.companion.service.js';
53
- import { ApplicationCodingTaskDisposition, ChangeSetFileChangeKind, CodingRunStart, deriveCodingRunStart, isApplicationCodingContractRefusal, readSettledRunFailureMessage, SETTLED_HEAD_OUTPUT_FIELD, } from '../../claude-cli/models/coding-agent-dispatch.models.js';
53
+ import { ApplicationCodingTaskDisposition, BUILD_TASK_SELF_DESCRIPTION_SOURCE_REF, ChangeSetFileChangeKind, CodingRunStart, deriveCodingRunStart, isApplicationCodingContractRefusal, readSettledRunFailureMessage, SETTLED_HEAD_OUTPUT_FIELD, } from '../../claude-cli/models/coding-agent-dispatch.models.js';
54
54
  import { GitChangeSetCompanionService } from '../../claude-cli/services/git-change-set.companion.service.js';
55
55
  import { readIsolatedVerificationRecheck } from '../../claude-cli/models/shared-tree-reconciliation.models.js';
56
56
  import { composeLandingSourceKey, LandingProjectionCache } from './application-build-landing-projection.companion.js';
@@ -64,13 +64,14 @@ import { CompanionExecutionsCompanionService } from '../../executions/services/c
64
64
  import { CompanionCreateActorExecutionRequestSchema, CompanionCreateActorTaskRequestSchema, CompanionExecutionsListQuerySchema, CompanionUpdateActorTaskRequestSchema } from '../../companion-api/companion-api.schemas.js';
65
65
  import { APPLICATION_CODING_SYSTEM_REF } from '../models/application-coding-agent.actors-system.definitions.js';
66
66
  import { isApplicationStartupFailure, readApplicationBootFailures, readUnavailableApplicationRuntimes, } from '../../core/runtime/application-runtime-liveness.companion.js';
67
+ import { CarriedVerificationReason } from '../models/carried-verification-failure.models.js';
67
68
  import { MAXIMUM_INTERFERENCE_REARMS, NothingToRearmError, readBuildTaskInterference, landedOverrideContextSource, readBuildTaskLandedOverride, readBuildTaskRearm, withBuildTaskRearm, } from '../models/build-task-rearm.models.js';
68
69
  import { APPLICATION_BUILD_GENERATION_STEP_ACTOR_REF, APPLICATION_BUILD_SYSTEM_REF } from '../models/application-build.actors-system.definitions.js';
69
70
  import { APPLICATION_BUILD_DECISIONS_DOOR_ACTOR_REF, APPLICATION_BUILD_DECISIONS_SYSTEM_REF } from '../models/application-build-decisions.actors-system.definitions.js';
70
71
  import { readRecordedPlaybookSpend } from '../models/playbook-run-record.models.js';
71
72
  import { ApplicationBuildGenerationStep, ApplicationBuildGenerationStepCompanionService, ApplicationBuildGenerationStepLandedKind, readDesignSystemConfigImportsBrandDesign, signSchemaPlanInputs, generationStepCheckReadsSpecifications, generationStepReadsSpecifications, GenerationStepFailureOwner, readGenerationStepFailureOwner, } from './application-build-generation-step.companion.service.js';
72
- import { INSTALLED_SKILL_INDEX_RELATIVE_PATH, readApplicationCapabilityFacts, sliceSkillIndexForTask } from './build-task-brief-application-facts.companion.js';
73
- import { resolveAssemblyRepairCodingPolicy, resolveBuildPlanTaskCodingPolicy, BuildPlanTaskLandedProbeKind, buildPlanTaskLandedProbePaths, declarationsAppearAt, findAgentWorkShortfalls, findConfigurationShortfalls, findSystemOfRecordDeclarationShortfalls, systemOfRecordPartitionUnanswerable, isConfigurationProvenProduct, unreadableResourceConfigurationFor, relativeImportedFiles, applicationConfigurationDeclarationsOf, flowsActorsIndexImportedFiles, labelFileDeclaresKeys, labelPacksDeclareKeyPrefix, launcherShellIdentities, placementSubjectShellIdentity, ProductDeclarationRelation, productDerivedSkillRefs, resourceSchemaFilePath, schemaSourceDeclaresPersonalData, targetDerivedSkillRefs, resolveBuildTaskLandedProbes, buildPlanTaskLandedProbeWritablePaths, resolveBuildTaskLandingAdvisories, buildTaskProducesBillingCatalogue, BACKEND_BILLING_SWITCH_FILE, resolveUndraftableDocumentRef, settingsDestinationShellIdentity, shellModuleContributionFile, shellSurfaceConfigFile, websiteLabelPackPath, websiteSectionLabelFragmentPath, } from './application-build-task-coding-policy.companion.service.js';
73
+ import { INSTALLED_SKILL_INDEX_RELATIVE_PATH, SKILL_INDEX_BRIEF_SOURCE_REF, readApplicationCapabilityFacts, sliceSkillIndexForTask } from './build-task-brief-application-facts.companion.js';
74
+ import { resolveAssemblyRepairCodingPolicy, resolveBuildPlanTaskCodingPolicy, resolveBuildPlanTaskExpectedWriteScope, BuildPlanTaskLandedProbeKind, buildPlanTaskLandedProbePaths, declarationsAppearAt, findAgentWorkShortfalls, findConfigurationShortfalls, findSystemOfRecordDeclarationShortfalls, systemOfRecordPartitionUnanswerable, isConfigurationProvenProduct, unreadableResourceConfigurationFor, relativeImportedFiles, applicationConfigurationDeclarationsOf, flowsActorsIndexImportedFiles, labelFileDeclaresKeys, labelPacksDeclareKeyPrefix, launcherShellIdentities, customViewComponentRealisesPlannedView, placementSubjectShellIdentity, ProductDeclarationRelation, productDerivedSkillRefs, resourceSchemaFilePath, schemaSourceDeclaresPersonalData, targetDerivedSkillRefs, resolveBuildTaskLandedProbes, buildPlanTaskLandedProbeWritablePaths, resolveBuildTaskLandingAdvisories, buildTaskProducesBillingCatalogue, BACKEND_BILLING_SWITCH_FILE, resolveUndraftableDocumentRef, settingsDestinationShellIdentity, shellModuleContributionFile, shellSurfaceConfigFile, websiteLabelPackPath, websiteSectionLabelFragmentPath, } from './application-build-task-coding-policy.companion.service.js';
74
75
  import { describeStaleFrontendLibrary, findStaleFrontendLibraryOutputs, readFrontendLibraryProgram } from './frontend-config-library-currency.companion.js';
75
76
  import { buildTaskDecisionsApplicationPath } from '../models/build-task-decisions-path.models.js';
76
77
  import { BuildTaskDecisionRefusedError, BuildTaskDecisionsStanding, resolveHonouredDecisionsBlob, followUpAwaitsReview, followUpsAwaitReviewUnder, parseBuildTaskDecisions, resolveClosedBuildTaskRefs, withBuildTaskDecision, } from './application-build-task-closure.companion.js';
@@ -446,6 +447,15 @@ export function projectBuildTaskAttempt(execution) {
446
447
  const carriedFailures = Array.isArray(output?.carriedVerificationDiagnoses)
447
448
  ? output.carriedVerificationDiagnoses.filter((entry) => typeof entry?.checkRef === 'string')
448
449
  : [];
450
+ const applicationFindings = Array.isArray(output?.applicationVerificationFindings)
451
+ ? output.applicationVerificationFindings
452
+ .filter((entry) => typeof entry?.checkRef === 'string' && typeof entry.finding === 'string')
453
+ .map((entry) => ({
454
+ checkRef: entry.checkRef,
455
+ finding: entry.finding,
456
+ writtenByTaskRefs: Array.isArray(entry.writtenByTaskRefs) ? entry.writtenByTaskRefs.map(String) : [],
457
+ }))
458
+ : [];
449
459
  const verification = Array.isArray(output?.verification)
450
460
  ? output.verification.filter((entry) => typeof entry?.checkRef === 'string')
451
461
  : [];
@@ -486,6 +496,7 @@ export function projectBuildTaskAttempt(execution) {
486
496
  ...(isolatedRecheck ? { isolatedRecheckPassed: isolatedRecheck.passed } : {}),
487
497
  ...(landedOverride ? { landedOverride } : {}),
488
498
  ...(carriedFailures.length > 0 ? { carriedFailures } : {}),
499
+ ...(applicationFindings.length > 0 ? { applicationFindings } : {}),
489
500
  ...(passedCheckRefs.length > 0 ? { passedCheckRefs } : {}),
490
501
  ...(typeof cost?.amount === 'number' && typeof cost.currency === 'string' ? { cost: { amount: cost.amount, currency: cost.currency } } : {}),
491
502
  ...(tokens ? { tokens } : {}),
@@ -656,7 +667,29 @@ export function deriveRepairsOwed(attemptsByTask) {
656
667
  for (const attempt of attempts) {
657
668
  for (const checkRef of attempt.passedCheckRefs ?? [])
658
669
  passes.push({ checkRef, at: attempt.startedAt });
659
- for (const carried of attempt.carriedFailures ?? []) {
670
+ /*
671
+ * A check charged for the run's own finding that ALSO met findings another writer caused (#3881 review F5): those are
672
+ * owed a repair too, with a diagnosis stating them, since nothing carried the check.
673
+ */
674
+ const carriedRefs = new Set((attempt.carriedFailures ?? []).map((carried) => carried.checkRef));
675
+ const chargedApplicationFindings = new Map();
676
+ for (const finding of attempt.applicationFindings ?? []) {
677
+ if (!carriedRefs.has(finding.checkRef))
678
+ chargedApplicationFindings.set(finding.checkRef, [...(chargedApplicationFindings.get(finding.checkRef) ?? []), finding]);
679
+ }
680
+ const owed = [
681
+ ...(attempt.carriedFailures ?? []),
682
+ ...[...chargedApplicationFindings].map(([checkRef, findings]) => ({
683
+ checkRef,
684
+ message: `findings about the application another writer caused: ${findings.map(({ finding }) => finding).join(' | ')}`,
685
+ outputTail: '',
686
+ offendingPaths: [],
687
+ producers: [],
688
+ carriedBecause: CarriedVerificationReason.FINDINGS_ANOTHER_WRITER_CAUSED,
689
+ applicationFindings: findings.map(({ finding, writtenByTaskRefs }) => ({ finding, writtenByTaskRefs })),
690
+ })),
691
+ ];
692
+ for (const carried of owed) {
660
693
  const entry = byCheck.get(carried.checkRef);
661
694
  if (entry === undefined) {
662
695
  byCheck.set(carried.checkRef, { firstSeenAt: attempt.startedAt, lastSeenAt: attempt.startedAt, affected: new Set([taskRef]), diagnosis: carried });
@@ -705,19 +738,46 @@ const CONCURRENT_ADMISSION_COMPILE_QUIET_MS = 30_000;
705
738
  function buildTaskProductWritePaths(task) {
706
739
  return resolveBuildTaskLandedProbes(task).flatMap((probe) => buildPlanTaskLandedProbeWritablePaths(probe));
707
740
  }
741
+ /**
742
+ * When an uncommitted path of the application last changed (#3933): its own modification time, or, when it is gone (a
743
+ * deletion, a rename's origin), the modification time of its nearest existing directory, which the removal updated.
744
+ * Never looks above the application root; `undefined` when nothing there can be read.
745
+ */
746
+ async function lastChangedAtMs(saasRoot, relativePath) {
747
+ const segments = relativePath.split('/').filter((segment) => segment.length > 0);
748
+ for (let depth = segments.length; depth >= 0; depth -= 1) {
749
+ try {
750
+ return (await stat(join(saasRoot, ...segments.slice(0, depth)))).mtimeMs;
751
+ }
752
+ catch {
753
+ // Gone: its directory's change time is the removal's.
754
+ }
755
+ }
756
+ return undefined;
757
+ }
708
758
  /** Whether two write sets may touch one file: an equal path, or a path under the other's directory. */
709
759
  export function productWritePathsMeet(left, right) {
710
760
  const covers = (path, other) => path === other || (path.endsWith('/') && other.startsWith(path));
711
761
  return left.some((path) => right.some((other) => covers(path, other) || covers(other, path)));
712
762
  }
713
763
  /**
714
- * Dispatches one wave call may make per slot before it returns and lets the next call continue (the playbook loop takes a
715
- * turn between waves). A wave returns only once its live runs have drained, so each wave costs the tail of its slowest run:
716
- * raised from 4 to 8 with #3204, once nothing but the isolated re-checks and the single-flight repairs waited on a drain
717
- * any more (progress reads the working tree; commits are checkpoints). Not unbounded: a drain is also the quiet moment the
718
- * runtime supervisor restarts the companion in, and a restart held past its ceiling kills the live runs.
764
+ * Dispatches one wave call may make per slot before it returns: the outer bound, no longer the loop's only turn (#3884). A
765
+ * wave returns only once its live runs have drained, so each drain costs the tail of its slowest run: on reference run
766
+ * 43691253927 every drain at the former 8 per slot held about 20 minutes with 0 to 5 sessions running. The loop now asks for
767
+ * a yield when a playbook the wave holds back needs the turn (`YIELD_REQUESTED`, honoured from
768
+ * {@link WAVE_DISPATCHES_BEFORE_A_YIELD_PER_DEGREE}), and a held restart stops the filling on its own (`RESTART_PENDING`).
769
+ *
770
+ * Not higher (review M2), for two costs that grow with a wave: a run that failed its checks beside its siblings may wait
771
+ * until the wave's END to be re-checked alone (`AWAITING_ISOLATED_RECHECK`), its dependents with it, when a live run keeps
772
+ * writing what its checks read (#3998 re-checks it earlier otherwise); and every dispatch entry of
773
+ * the wave's result carries the plan's ready and landed lists. Raised from 4 to 8 with #3204, and to 16 with #3884.
719
774
  */
720
- export const WAVE_DISPATCHES_PER_DEGREE = 8;
775
+ export const WAVE_DISPATCHES_PER_DEGREE = 16;
776
+ /**
777
+ * The dispatches per slot a wave starts before it honours a yield the loop asked for (#3884 review H2): the former cap, so a
778
+ * playbook the loop holds back but never chooses can shorten a wave to what it was before #3884, and no further.
779
+ */
780
+ export const WAVE_DISPATCHES_BEFORE_A_YIELD_PER_DEGREE = 8;
721
781
  /**
722
782
  * Every run of the wave that has ALSO settled by now, without waiting for one that has not (#3204).
723
783
  *
@@ -748,6 +808,12 @@ export var ApplicationBuildWaveStop;
748
808
  * termination rests on that pass-over; without it a step whose landing stays unmet would be selected again forever.
749
809
  */
750
810
  ApplicationBuildWaveStop["GENERATION_STEP_REPEATED"] = "generation-step-repeated";
811
+ /**
812
+ * The playbook loop asked the wave to yield (#3884): a playbook it holds back writes what the wave's lane writes, so the
813
+ * wave starts nothing more and drains, and that playbook runs at the wave's end. The yield the dispatch cap used to force
814
+ * every 8 dispatches per slot, whether or not anything was waiting.
815
+ */
816
+ ApplicationBuildWaveStop["YIELD_REQUESTED"] = "yield-requested";
751
817
  /** An admission was refused; the refusal is on the dispatch entry. */
752
818
  ApplicationBuildWaveStop["DISPATCH_REFUSED"] = "dispatch-refused";
753
819
  /**
@@ -793,6 +859,7 @@ export var ApplicationBuildWaveStop;
793
859
  */
794
860
  const SLOT_ABANDONING_STOPS = new Set([
795
861
  ApplicationBuildWaveStop.STOP_REQUESTED,
862
+ ApplicationBuildWaveStop.YIELD_REQUESTED,
796
863
  ApplicationBuildWaveStop.RESTART_PENDING,
797
864
  ApplicationBuildWaveStop.DISPATCH_REFUSED,
798
865
  ApplicationBuildWaveStop.VERIFICATION_TOOL_UNAVAILABLE,
@@ -872,7 +939,8 @@ export function describeBuildWaveHoldsForSelector(wave) {
872
939
  command: wave.verificationToolUnavailable.command,
873
940
  checkRef: wave.verificationToolUnavailable.checkRef,
874
941
  guidance: `${describeVerificationHostCause(wave.verificationToolUnavailable)} No coding turn is admitted until then. `
875
- + 'Stop selecting build waves: only a person repairing this lifts it, and nothing a later round does changes it.',
942
+ // Not "only a person lifts it": a compiled model catching up, or a re-ask once due, ends some holds on their own (run 43961156770).
943
+ + 'Stop selecting build waves: nothing a later round does changes it, and the hold ends as the sentence above says.',
876
944
  },
877
945
  } : {}),
878
946
  ...(wave.staleExpertCharters ? {
@@ -1409,6 +1477,12 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1409
1477
  lastBuildPreparation;
1410
1478
  /** When `wildo build stop` asked the running wave to stop (#3206); cleared when the wave ends. */
1411
1479
  buildWaveStopRequestedAt;
1480
+ /**
1481
+ * Why the playbook loop asked the running wave to YIELD (#3884), cleared when the wave ends: a playbook it holds back
1482
+ * because the wave's lane writes what it writes. Unlike a person's stop it holds nothing afterwards; the next wave fills
1483
+ * as usual once the held playbook has had its turn.
1484
+ */
1485
+ buildWaveYieldRequestedBecause;
1412
1486
  /**
1413
1487
  * The build HOLD a person's `wildo build stop` sets (#3206), kept after the wave it ended: while it is set no build
1414
1488
  * wave or task starts unless a person's door released it first ({@link releaseBuildStopHold}) — not the choreography
@@ -2520,6 +2594,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2520
2594
  finally {
2521
2595
  this.liveWaveStartedAt = undefined;
2522
2596
  this.buildWaveStopRequestedAt = undefined;
2597
+ this.buildWaveYieldRequestedBecause = undefined;
2523
2598
  this.openBuildPreparations?.clear();
2524
2599
  }
2525
2600
  }
@@ -2553,22 +2628,66 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2553
2628
  });
2554
2629
  return { stopping: true, heldSince: this.buildStopHeldSince, waveStartedAt: this.liveWaveStartedAt, requestedAt: this.buildWaveStopRequestedAt };
2555
2630
  }
2631
+ /**
2632
+ * Ask the build wave to yield (#3884): once it has dispatched {@link WAVE_DISPATCHES_BEFORE_A_YIELD_PER_DEGREE} per slot,
2633
+ * it starts nothing more, drains and returns, so a playbook the loop holds back because of it can run. Idempotent. A
2634
+ * request made before the wave starts applies to it; every request is cleared when a wave ends.
2635
+ */
2636
+ requestBuildWaveYield(because) {
2637
+ // Kept when no wave has started yet (review M1): the loop can ask between the lane's start and its wave's, and the
2638
+ // request then applies to that wave. Cleared when a wave ends, and asked again while the playbook is still held.
2639
+ if (this.buildWaveYieldRequestedBecause !== undefined)
2640
+ return;
2641
+ this.buildWaveYieldRequestedBecause = because;
2642
+ this.logger.info?.('The running build wave was asked to yield: it starts no new task and ends once its live runs settle', { because });
2643
+ }
2556
2644
  /** The generation steps held because their panel refused stale expert charters (#3204); empty when none is. */
2557
2645
  readStaleExpertChartersHold() {
2558
2646
  return [...this.staleExpertChartersHeld.values()];
2559
2647
  }
2560
- /** The staffing step derived the charters again (#3204): every held step is offered again. */
2561
- releaseStaleExpertChartersHold(why) {
2562
- if (this.staleExpertChartersHeld.size === 0)
2648
+ /**
2649
+ * The staffing step derived the charters again (#3204): the held steps are offered again. With `repaired`, only the holds
2650
+ * that staffing run read when it started (#4022): it runs beside the build now, so a step held while it ran was refused
2651
+ * on charters it may not have derived. That step stays held until a staffing run that read its hold releases it, or
2652
+ * until the charters are committed after its refusal ({@link staleExpertChartersCommittedSince}, read by the selector);
2653
+ * released that way early, it is refused again if still stale, and the new hold starts another staffing run. Without
2654
+ * `repaired`, every hold.
2655
+ */
2656
+ releaseStaleExpertChartersHold(why, repaired) {
2657
+ const released = repaired === undefined
2658
+ ? [...this.staleExpertChartersHeld.keys()]
2659
+ : repaired.filter((held) => this.staleExpertChartersHeld.get(held.taskRef)?.observedAt === held.observedAt).map((held) => held.taskRef);
2660
+ if (released.length === 0)
2563
2661
  return;
2564
- this.logger.info?.('Generation steps held on stale expert charters are offered again', { taskRefs: [...this.staleExpertChartersHeld.keys()], why });
2565
- this.staleExpertChartersHeld.clear();
2662
+ this.logger.info?.('Generation steps held on stale expert charters are offered again', { taskRefs: released, why });
2663
+ for (const taskRef of released)
2664
+ this.staleExpertChartersHeld.delete(taskRef);
2665
+ }
2666
+ /**
2667
+ * Called each time a generation step is held on stale expert charters (#4022), so the build-dispatch step can start the
2668
+ * staffing run the moment the hold is set, beside the wave, instead of after the wave has drained. Returns the
2669
+ * unsubscribe. A listener that throws is logged and never fails the hold.
2670
+ */
2671
+ onStaleExpertChartersHeld(listener) {
2672
+ const listeners = this.staleExpertChartersHoldListeners ??= new Set();
2673
+ listeners.add(listener);
2674
+ return () => { listeners.delete(listener); };
2566
2675
  }
2676
+ /** Created by the first subscription, so a service built without its constructor (a test) holds the same way. */
2677
+ staleExpertChartersHoldListeners;
2567
2678
  holdForStaleExpertCharters(taskRef, refusal) {
2568
2679
  this.staleExpertChartersHeld.set(taskRef, { ...refusal, taskRef, observedAt: new Date().toISOString() });
2569
2680
  this.logger.warn?.('A generation step\'s panel refused stale expert charters; the step is held and the rest of the plan proceeds', {
2570
2681
  taskRef, seats: refusal.staleSeats.map((seat) => seat.roleRef),
2571
2682
  });
2683
+ for (const listener of this.staleExpertChartersHoldListeners ?? []) {
2684
+ try {
2685
+ listener();
2686
+ }
2687
+ catch (error) {
2688
+ this.logger.warn?.('A listener for stale-charter holds failed; the hold stands', { taskRef, error: describeCaughtError(error) });
2689
+ }
2690
+ }
2572
2691
  }
2573
2692
  /**
2574
2693
  * Whether a held step's charters were committed since its refusal (#3204), which releases it: the staffing step landed
@@ -2788,6 +2907,31 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2788
2907
  const reservations = new Map();
2789
2908
  // The task each admitted run builds, so its reservation is released when the run settles.
2790
2909
  const reservedTaskOfRun = new Map();
2910
+ /*
2911
+ * Where each live run of the wave is expected to write (#3998), by run: what a failed sibling's isolated re-check asks
2912
+ * before running beside it. A run absent here (a repair, a task whose scope could not be derived) holds every re-check.
2913
+ * Passed LIVE to the re-check, so a run admitted while it runs is known by the time it is asked about.
2914
+ */
2915
+ const expectedWriteScopeOfRun = new Map();
2916
+ /*
2917
+ * The wave's runs that failed their checks and may be owed an isolated re-check (#3998), asked after every settlement
2918
+ * instead of only at the wave's end. The dispatch decides which are owed one (failed beside siblings, none recorded),
2919
+ * and which may run beside the runs still live; one it does not re-check now stays here for the next settlement.
2920
+ */
2921
+ const awaitingRecheckRunIds = new Set();
2922
+ let earlyRecheck;
2923
+ // The settlements counted when the batch in flight started (review F2): one that settles DURING it is asked about after it.
2924
+ let settlementsAtEarlyRecheck = 0;
2925
+ const startEarlyRechecks = () => {
2926
+ if (earlyRecheck !== undefined || awaitingRecheckRunIds.size === 0 || typeof this.dispatch.recheckIsolatedBesideLiveRuns !== 'function')
2927
+ return;
2928
+ settlementsAtEarlyRecheck = settlements;
2929
+ earlyRecheck = this.dispatch.recheckIsolatedBesideLiveRuns({ taskIds: [...awaitingRecheckRunIds], expectedWriteScopes: expectedWriteScopeOfRun })
2930
+ .catch((error) => {
2931
+ this.logger.warn('Could not re-check the wave\'s failed runs beside the live ones; the next settlement or the wave\'s end asks again', { error: describeCaughtError(error) });
2932
+ return { rechecked: new Map(), resolvedTaskIds: [] };
2933
+ });
2934
+ };
2791
2935
  /*
2792
2936
  * How many runs and steps have settled in this wave (#3883 review M1): a slot that finds nothing ready on a reading taken
2793
2937
  * before the latest settlement says nothing about what that settlement unlocked, so it does not hold the launcher back.
@@ -2801,6 +2945,14 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2801
2945
  // The first failure of a slot that is not "nothing ready": no more slots start, and the wave throws once what is live drains.
2802
2946
  let preparationFailure;
2803
2947
  const occupied = () => inFlight.size + generationInFlight.size + preparing.size;
2948
+ /*
2949
+ * A yield is honoured only once the wave has started a floor of dispatches (#3884 review H2): the loop asks for every
2950
+ * playbook the wave holds back, chosen or not, so without a floor a playbook the selector never picks would make every
2951
+ * wave yield at once. The floor is the former cap, so the worst case is the wave as it was.
2952
+ */
2953
+ const yieldFloor = degree * WAVE_DISPATCHES_BEFORE_A_YIELD_PER_DEGREE;
2954
+ const yieldIsDue = () => this.buildWaveYieldRequestedBecause !== undefined
2955
+ && dispatched.length + generationInFlight.size >= yieldFloor;
2804
2956
  /*
2805
2957
  * Wakes the drain when what it races GROWS (#3883): a run admitted, a step started, a slot launched. The drain races the
2806
2958
  * set it saw when it last looked, and the launcher can wait a whole landing derivation for a slot's selection, so a run
@@ -2843,6 +2995,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2843
2995
  return 'failed';
2844
2996
  if (this.buildWaveStopRequestedAt !== undefined)
2845
2997
  return ApplicationBuildWaveStop.STOP_REQUESTED;
2998
+ if (yieldIsDue())
2999
+ return ApplicationBuildWaveStop.YIELD_REQUESTED;
2846
3000
  const saasRoot = this.companionContext?.saasRoot;
2847
3001
  if (saasRoot !== undefined && companionRestartDrain.isRestartHeld(saasRoot))
2848
3002
  return ApplicationBuildWaveStop.RESTART_PENDING;
@@ -2937,6 +3091,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2937
3091
  raceSetGrew();
2938
3092
  handedOn = true;
2939
3093
  reservedTaskOfRun.set(taskId, prepared.plan.taskRef);
3094
+ if (prepared.expectedWriteScope !== undefined)
3095
+ expectedWriteScopeOfRun.set(taskId, prepared.expectedWriteScope);
2940
3096
  guardHeldReadingAgainst(prepared.plan.taskRef);
2941
3097
  }
2942
3098
  catch (error) {
@@ -2980,6 +3136,11 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2980
3136
  stoppedFillingBecause ??= ApplicationBuildWaveStop.STOP_REQUESTED;
2981
3137
  return;
2982
3138
  }
3139
+ // The loop needs the turn (#3884): a playbook it holds back writes what this wave's lane writes. Not before the floor.
3140
+ if (yieldIsDue()) {
3141
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.YIELD_REQUESTED;
3142
+ return;
3143
+ }
2983
3144
  // A restart the dev supervisor holds (#3204): start nothing more, so the live runs settle before it.
2984
3145
  const saasRoot = this.companionContext?.saasRoot;
2985
3146
  if (saasRoot !== undefined && companionRestartDrain.isRestartHeld(saasRoot)) {
@@ -3072,17 +3233,42 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3072
3233
  launcher = fill().finally(() => { launcher = undefined; });
3073
3234
  };
3074
3235
  launch();
3075
- while (inFlight.size > 0 || generationInFlight.size > 0 || preparing.size > 0 || launcher !== undefined) {
3236
+ while (inFlight.size > 0 || generationInFlight.size > 0 || preparing.size > 0 || launcher !== undefined || earlyRecheck !== undefined) {
3076
3237
  const first = await Promise.race([
3077
3238
  ...[...inFlight.values()].map((run) => run.then((settled) => ({ kind: 'coding', run: settled }))),
3078
3239
  ...[...generationInFlight.values()].map((step) => step.then((settled) => ({ kind: 'generation', step: settled }))),
3079
3240
  ...[...preparing.values()].map((slot) => slot.then(() => ({ kind: 'slot' }))),
3080
3241
  ...(launcher !== undefined ? [launcher.then(() => ({ kind: 'launcher' }))] : []),
3081
3242
  drainWake.then(() => ({ kind: 'grew' })),
3243
+ ...(earlyRecheck !== undefined ? [earlyRecheck.then((answer) => ({ kind: 'rechecked', answer }))] : []),
3082
3244
  ]);
3083
3245
  // The set grew, or the launcher ended: look again at what is live, without relaunching (see `launch`).
3084
3246
  if (first.kind === 'launcher' || first.kind === 'grew')
3085
3247
  continue;
3248
+ if (first.kind === 'rechecked') {
3249
+ earlyRecheck = undefined;
3250
+ // Recorded, or owed none (failed alone, recorded by a sharing episode's end): asked no more (review F4).
3251
+ for (const taskId of first.answer.resolvedTaskIds)
3252
+ awaitingRecheckRunIds.delete(taskId);
3253
+ /*
3254
+ * A recorded re-check moves the landing as a settlement does (#3998): a pass lands the task, a failure makes it
3255
+ * dispatchable again in THIS wave (before #3998, in the next). So the held reading is dropped and a slot that found
3256
+ * nothing ready looks again.
3257
+ */
3258
+ if (first.answer.rechecked.size > 0) {
3259
+ fillLanding.current = undefined;
3260
+ fillLanding.pending = undefined;
3261
+ nothingReady = false;
3262
+ launch();
3263
+ }
3264
+ /*
3265
+ * A run that was not re-checked waits for something to settle, the only thing that changes its answer; so one that
3266
+ * settled while the batch ran is asked about now, or the run it freed would wait for the NEXT settlement (review F2).
3267
+ */
3268
+ if (settlements !== settlementsAtEarlyRecheck)
3269
+ startEarlyRechecks();
3270
+ continue;
3271
+ }
3086
3272
  if (first.kind === 'slot') {
3087
3273
  launch();
3088
3274
  continue;
@@ -3103,10 +3289,13 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3103
3289
  reservedTaskOfRun.delete(run.taskId);
3104
3290
  settlements += 1;
3105
3291
  // The startup repair is reported as a repair, never as one of the wave's runs (#3880 review F9).
3292
+ expectedWriteScopeOfRun.delete(run.taskId);
3106
3293
  if (run.taskId === startupRepairInWave?.taskId)
3107
3294
  continue;
3108
3295
  outcomes.push(run.outcome);
3109
3296
  settledTaskIds.push(run.taskId);
3297
+ if (run.outcome?.disposition === ApplicationCodingTaskDisposition.VERIFICATION_FAILED)
3298
+ awaitingRecheckRunIds.add(run.taskId);
3110
3299
  }
3111
3300
  }
3112
3301
  for (const step of await takeAlreadySettled(generationInFlight))
@@ -3120,6 +3309,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3120
3309
  await repairStartBesideLiveRuns(notBooting);
3121
3310
  }
3122
3311
  }
3312
+ // Something settled: a failed run may now be re-checked beside what is still live (#3998).
3313
+ startEarlyRechecks();
3123
3314
  launch();
3124
3315
  }
3125
3316
  // Every slot has closed its preparation, so the wave's record of them is complete when it returns.
@@ -3609,8 +3800,12 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3609
3800
  }
3610
3801
  if (entry.reason === Workbench_BuildTaskStuckReason.LANDING_UNKNOWN) {
3611
3802
  return new ApplicationBuildTaskCompletedButUnlandedError(`${entry.landingUnknownCause ?? `Build step "${taskRef}" was not run: whether it has already landed could not be checked.`} `
3612
- + 'Running it now would either fail the same way or redo work that may already have landed, so it is not dispatched; '
3613
- + `it is offered again as soon as the check answers.${others}`, taskRef, priorTaskId, stuck, queue);
3803
+ /*
3804
+ * One wording for every holder (a generation step's landing check, a coding task's unread decisions, a coding task
3805
+ * whose verification checks could not be asked, run 43961156770): the stuck entry does not say which, reliably.
3806
+ */
3807
+ + 'Running it now would meet the same unanswered check, judge nothing, and may redo work that has already landed, so it '
3808
+ + `is not dispatched; it is offered again as soon as the check answers.${others}`, taskRef, priorTaskId, stuck, queue);
3614
3809
  }
3615
3810
  if (entry.reason === Workbench_BuildTaskStuckReason.FOLLOW_UP_AWAITING_REVIEW) {
3616
3811
  return new ApplicationBuildTaskCompletedButUnlandedError(`Build task "${taskRef}" is a follow-up the build derived from a reported gap, and under the ${this.autonomyPosture} posture a follow-up `
@@ -3624,7 +3819,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3624
3819
  }
3625
3820
  if (entry.reason === Workbench_BuildTaskStuckReason.AWAITING_ISOLATED_RECHECK) {
3626
3821
  return new ApplicationBuildTaskCompletedButUnlandedError(`Build task "${taskRef}" failed its checks while other runs of this wave were writing beside it, so the failure may be theirs. `
3627
- + `Running it again now would meet the same tree; the wave's end runs its checks alone, and a pass lands it. Nothing to do.${others}`, taskRef, priorTaskId, stuck, queue);
3822
+ + `Running it again now would meet the same tree; its checks run again alone once no live run writes what they read, at the latest when the wave ends, and a pass lands it. Nothing to do.${others}`, taskRef, priorTaskId, stuck, queue);
3628
3823
  }
3629
3824
  if (entry.reason === Workbench_BuildTaskStuckReason.RAN_THIS_WAVE) {
3630
3825
  return new ApplicationBuildTaskCompletedButUnlandedError(`Build step "${taskRef}" already ran in this wave and has not landed, so the wave does not run it again on the tree it just met. `
@@ -3697,7 +3892,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3697
3892
  if (!completed && identicalFailures < GENERATION_STEP_IDENTICAL_FAILURES_WITHHELD_AFTER)
3698
3893
  return null;
3699
3894
  const since = latest.settledAt ?? latest.startedAt;
3700
- if (!(await this.generationStepInputsUnmovedSince(candidate, since)))
3895
+ if (!(await this.generationStepInputsUnmovedSince(candidate, latest.startedAt)))
3701
3896
  return null;
3702
3897
  if (completed) {
3703
3898
  return {
@@ -3718,17 +3913,31 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3718
3913
  };
3719
3914
  }
3720
3915
  /**
3721
- * Whether nothing a generation step reads has moved since `since` (#3233, #3709): no commit since then, and no dirty path
3722
- * in the working tree, touched what the step READS (`resolveGenerationStepReadRoots`) outside what it writes itself. A
3723
- * step that names no read roots (an unknown step ref) reads every path outside its write scope, the rule before #3709.
3724
- * Until #3709 every step read that way, so any sibling's checkpoint released a held step: on reference run 42886943490
3725
- * a documentation publication failing on the engine's examples could run again after each frontend view landed.
3726
- * `false` when git cannot be read, so a step is never held on an unknown.
3916
+ * Whether nothing a generation step reads has moved since its latest run STARTED (#3233, #3709): no commit since then,
3917
+ * and no uncommitted path edited since then, touched what the step READS (`resolveGenerationStepReadRoots`) outside what
3918
+ * it writes itself. A step that names no read roots (an unknown step ref) reads every path outside its write scope, the
3919
+ * rule before #3709. Until #3709 every step read that way, so any sibling's checkpoint released a held step: on
3920
+ * reference run 42886943490 a documentation publication failing on the engine's examples could run again after each
3921
+ * frontend view landed. From the run's START, not its end: an input changed while the run was running may not have
3922
+ * been read by it.
3923
+ *
3924
+ * An uncommitted path is dated, because being dirty says nothing about WHEN it changed (`readLandingSourceState` leaves
3925
+ * that to its caller): by its modification time, or, when it is gone (a deletion, a rename's origin), by its nearest
3926
+ * existing directory's, which a removal updates. Until #3933 any dirty input released the step, and a live application
3927
+ * nearly always has one: on client creation run 44257782469 the documentation publication failed 117 times in a row on
3928
+ * one missing role specification and was never held. What released it was not observed, so a release now logs the path
3929
+ * that caused it.
3930
+ *
3931
+ * `false` when git, or the application root, cannot be read, so a step is never held on an unknown.
3727
3932
  */
3728
- async generationStepInputsUnmovedSince(candidate, since) {
3933
+ async generationStepInputsUnmovedSince(candidate, ranFrom) {
3729
3934
  if (typeof this.git.listPathsCommittedSince !== 'function' || typeof this.git.readLandingSourceState !== 'function')
3730
3935
  return false;
3731
- const [committed, tree] = await Promise.all([this.git.listPathsCommittedSince(since), this.git.readLandingSourceState()]);
3936
+ const ranFromMs = Date.parse(ranFrom);
3937
+ const saasRoot = this.companionContext?.saasRoot;
3938
+ if (Number.isNaN(ranFromMs) || saasRoot === undefined)
3939
+ return false;
3940
+ const [committed, tree] = await Promise.all([this.git.listPathsCommittedSince(ranFrom), this.git.readLandingSourceState()]);
3732
3941
  if (committed === undefined || tree === undefined)
3733
3942
  return false;
3734
3943
  const ownRoots = await this.generationSteps.resolveGenerationStepWritableRoots(candidate);
@@ -3737,7 +3946,23 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3737
3946
  : undefined;
3738
3947
  const under = (roots, path) => roots.some((root) => (root.endsWith('/') ? path.startsWith(root) : path === root));
3739
3948
  const isInput = (path) => !under(ownRoots, path) && (readRoots === undefined || under(readRoots, path));
3740
- return ![...committed, ...tree.changedPaths].some(isInput);
3949
+ const released = (relativePath, why) => {
3950
+ this.logger.info?.('A generation step that ran on unchanged inputs is offered again: one of its inputs moved', {
3951
+ taskRef: candidate.taskRef, path: relativePath, why, ranFrom,
3952
+ });
3953
+ return false;
3954
+ };
3955
+ const committedInput = committed.find(isInput);
3956
+ if (committedInput !== undefined)
3957
+ return released(committedInput, 'committed since the latest run started');
3958
+ for (const relativePath of tree.changedPaths.filter(isInput)) {
3959
+ const changedAtMs = await lastChangedAtMs(saasRoot, relativePath);
3960
+ if (changedAtMs === undefined)
3961
+ return released(relativePath, 'uncommitted, and neither it nor a directory above it can be read');
3962
+ if (changedAtMs >= ranFromMs)
3963
+ return released(relativePath, 'uncommitted, and changed since the latest run started');
3964
+ }
3965
+ return true;
3741
3966
  }
3742
3967
  /**
3743
3968
  * The build tasks whose LATEST coding run failed its own verification and was not cleared since (#3220): no re-arm, and
@@ -3949,7 +4174,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3949
4174
  }
3950
4175
  /*
3951
4176
  * Its latest run failed its checks beside siblings, in THIS wave (#3204): run again now, it would meet the same tree its
3952
- * siblings are still writing. The wave's end re-checks it alone (a pass lands it); the next wave offers it if that failed.
4177
+ * siblings are still writing. It is re-checked alone once no live run is expected to write what its checks read (#3998),
4178
+ * at the latest at the wave's end; a pass lands it, a failure offers it again (in this same wave once re-checked early).
4179
+ * Held until that re-check is RECORDED on the run, so a task whose re-check is pending, or was discarded because what it
4180
+ * read moved, is never dispatched again meanwhile.
3953
4181
  * Only within the wave that ran it: a run left unchecked by an earlier wave (a restart) is offered, alone or not, rather
3954
4182
  * than held for a re-check nothing would run.
3955
4183
  */
@@ -4103,6 +4331,28 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4103
4331
  reason: Workbench_BuildTaskStuckReason.ATTEMPTS_EXHAUSTED,
4104
4332
  };
4105
4333
  }
4334
+ /*
4335
+ * Its latest runs could not have their checks ASKED (run 43961156770). They never count against the budget above, so
4336
+ * this is what bounds a cause only this task meets: held as `landing_unknown`, since whether its work passes is not
4337
+ * known, until a check answers, the compiled model it named catches up, or the re-ask is due. No attempt is spent.
4338
+ */
4339
+ const unanswered = typeof this.dispatch.readRepeatedlyUnansweredVerification === 'function'
4340
+ ? await this.dispatch.readRepeatedlyUnansweredVerification(candidate.taskRef)
4341
+ : undefined;
4342
+ if (unanswered !== undefined) {
4343
+ return {
4344
+ taskRef: candidate.taskRef,
4345
+ priorTaskId: unanswered.priorTaskId,
4346
+ ...(unanswered.settledAt ? { completedAt: unanswered.settledAt } : {}),
4347
+ reason: Workbench_BuildTaskStuckReason.LANDING_UNKNOWN,
4348
+ landingUnknownCause: `Build task "${candidate.taskRef}" was not run: ${unanswered.checkRef} could not be asked on its last `
4349
+ + `${unanswered.consecutive} runs (latest: task ${unanswered.priorTaskId}), so whether its work passes is not known: ${unanswered.message} `
4350
+ + 'A check that could not be asked judged nothing, so no attempt was spent. Repair what the message names (it may be the '
4351
+ + 'environment, or a load-time error in the tree); the task is offered again as soon as the check '
4352
+ + `answers for any run or the compiled model it names catches up, and at the latest from ${unanswered.asksAgainAt}. `
4353
+ + `If the cause is already gone: wildo build rearm ${candidate.taskRef} --reason environment --note "<why>".`,
4354
+ };
4355
+ }
4106
4356
  return null;
4107
4357
  }
4108
4358
  /**
@@ -4465,7 +4715,15 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4465
4715
  landedTaskRefs: [...landedTaskRefs].sort(),
4466
4716
  unverifiableLandedTaskRefs: resolution.unverifiableLandedTaskRefs,
4467
4717
  };
4468
- return { kind: 'CODING', plan, contract, stuckTasks: stuck, ...(landedOverride ? { landedOverride } : {}) };
4718
+ let expectedWriteScope;
4719
+ try {
4720
+ expectedWriteScope = resolveBuildPlanTaskExpectedWriteScope(task);
4721
+ }
4722
+ catch {
4723
+ // Unknown: a run whose writes cannot be predicted holds every isolated re-check beside it (#3998).
4724
+ expectedWriteScope = undefined;
4725
+ }
4726
+ return { kind: 'CODING', plan, contract, stuckTasks: stuck, ...(expectedWriteScope !== undefined ? { expectedWriteScope } : {}), ...(landedOverride ? { landedOverride } : {}) };
4469
4727
  }
4470
4728
  /**
4471
4729
  * Which tasks have landed, read from GIT.
@@ -4556,9 +4814,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4556
4814
  }
4557
4815
  /*
4558
4816
  * A task being built right now is progress, not stuck: the plan is not blocked while a wave runs. So is a task
4559
- * waiting for a live run that writes its file (CONTENDED), or for its wave's end to re-check it alone
4560
- * (AWAITING_ISOLATED_RECHECK, #3204): each clears by itself. Counted as stuck, they read a busy build as not moving,
4561
- * which lifts the hold on code-only refreshes and lets the umbrella loop re-run upstream lanes mid-build.
4817
+ * waiting for a live run that writes its file (CONTENDED), or for its re-check alone, run once no live run writes
4818
+ * what it reads or at the wave's end (AWAITING_ISOLATED_RECHECK, #3204, #3998): each clears by itself. Counted as stuck, they read a busy build as not moving,
4819
+ * which closes the dispatch on "every ready task is stuck" and stops the loop forcing a wave. (It no longer lifts the
4820
+ * hold on code-only refreshes: that hold follows the build being unfinished, stuck or not, since #4015.)
4562
4821
  */
4563
4822
  if (entry === null || BUILD_TASK_REASONS_THAT_ARE_PROGRESS.has(entry.reason))
4564
4823
  return undefined;
@@ -5543,8 +5802,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
5543
5802
  const landedBeforeAnyRun = landed && !attemptsTruncated && !attempts.some(isCountedBuildTaskAttempt)
5544
5803
  ? { probedPaths: await this.resolveLandedEvidencePaths(task) } : undefined;
5545
5804
  // The follow-ups carrying this task's reports (#3204: an absorbed report is carried under another report's ref, whose
5546
- // FIRST prerequisite is that report's origin; the others are the follow-up before it on its target, #3227, and
5547
- // host-derived steps appended later).
5805
+ // FIRST prerequisite is that report's origin; the others are the owner its gaps were reported as (#3886) or its routed
5806
+ // scope's planned tasks (#3991), the follow-up before it on its target (#3227), and host-derived steps appended later).
5548
5807
  const followUpTaskRefs = plan.tasks
5549
5808
  .filter((candidate) => candidate.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX)
5550
5809
  && (candidate.prerequisiteTaskRefs[0] === task.taskRef || this.followUpOriginTaskRefs(candidate.taskRef)?.has(task.taskRef) === true))
@@ -6650,9 +6909,12 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6650
6909
  const carried = new Map();
6651
6910
  const carriedAudiences = new Map();
6652
6911
  const contributingPaths = new Map();
6912
+ // Per surface, the custom views its resource-operation launchers open, with the launcher's audience (#4012).
6913
+ const hostedCustomViews = new Map();
6653
6914
  for (const row of shell.surfaces) {
6654
6915
  const identities = new Set();
6655
6916
  const audiences = new Map();
6917
+ const hosted = [];
6656
6918
  for (const launcher of row.launchers) {
6657
6919
  // Every identity it answers to: the plan names a resource in the singular, the shell carries its type (#3204).
6658
6920
  const launcherIdentities = launcherShellIdentities(launcher);
@@ -6662,18 +6924,64 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6662
6924
  ...(launcher.requiredRoles === undefined ? {} : { item: launcher.requiredRoles }),
6663
6925
  ...(launcher.sectionRequiredRoles === undefined ? {} : { section: launcher.sectionRequiredRoles }),
6664
6926
  };
6927
+ if (launcher.hostedCustomView !== undefined)
6928
+ hosted.push({ component: launcher.hostedCustomView, layers });
6665
6929
  for (const identity of launcherIdentities) {
6666
6930
  identities.add(identity);
6667
6931
  audiences.set(identity, [...(audiences.get(identity) ?? []), layers]);
6668
6932
  }
6669
6933
  }
6670
6934
  carriedAudiences.set(row.surface, audiences);
6935
+ hostedCustomViews.set(row.surface, hosted);
6671
6936
  for (const destinationRef of row.destinationRefs)
6672
6937
  identities.add(settingsDestinationShellIdentity(destinationRef));
6673
6938
  carried.set(row.surface, identities);
6674
6939
  contributingPaths.set(row.surface, [shellSurfaceConfigFile(row.surface), ...row.contributingModuleIds.map(shellModuleContributionFile)]);
6675
6940
  }
6676
6941
  const expectations = derivePlacementPlanShellExpectations(plan.data);
6942
+ /*
6943
+ * A planned view the build realised as a resource operation's custom view (#4012, reference run 44052185141): the
6944
+ * experience plan's `view-enquiry-capture` is the enquiry CREATE's `customView`, and the shell reaches it only through
6945
+ * the `enquiry` / `create` launcher, which therefore CARRIES the placed view. No plan says which operation hosts it, so
6946
+ * the oracle reads the binding and this asks whether the bound component is the planned view, by the rule the custom
6947
+ * view's own build task lands by. Before this, the sidebar and command-menu placements ran 4–5 times each and could
6948
+ * never land.
6949
+ *
6950
+ * Only for views the plan PLACES on the surface. A view it DECLINES is not counted as carried by an operation launcher
6951
+ * the plan places: declining a view and placing the operation that renders it is a plan saying "reach it through the
6952
+ * operation", and reading that launcher as the declined view would leave the surface unlandable unless the agent
6953
+ * removed an entry the plan placed. A launcher realising the view brings its audience with it; a plan placing the
6954
+ * view and the operation hosting it on ONE surface with different roles asks for one entry shown to two audiences,
6955
+ * which no shell satisfies and the audience check reports.
6956
+ *
6957
+ * A component realises at most ONE planned view: the most specific of every view the plan names, placed or declined
6958
+ * (#4012 review R1). The rule matches the view's words at the START of the name, so `FollowUpsDueCustomView` would also
6959
+ * read as `view-follow-ups`; with both planned, it is the due-follow-ups view only, and the concept view still needs a
6960
+ * launcher of its own.
6961
+ */
6962
+ const plannedViewRefs = [...new Set(plan.data.decisions.flatMap(({ subject }) => (subject.kind === PlacementSubjectKind.APP_VIEW ? [subject.viewRef] : [])))];
6963
+ const realisedViewIdentity = (component) => {
6964
+ const realised = plannedViewRefs
6965
+ .filter((viewRef) => customViewComponentRealisesPlannedView(component, viewRef))
6966
+ .map((viewRef) => placementSubjectShellIdentity({ kind: PlacementSubjectKind.APP_VIEW, viewRef }))
6967
+ .sort((left, right) => right.length - left.length);
6968
+ return realised[0];
6969
+ };
6970
+ for (const [surface, entries] of expectations.placed) {
6971
+ const hosted = hostedCustomViews.get(surface) ?? [];
6972
+ if (hosted.length === 0)
6973
+ continue;
6974
+ const placedViews = new Set(entries.filter(({ decision }) => decision.subject.kind === PlacementSubjectKind.APP_VIEW).map(({ shellIdentity }) => shellIdentity));
6975
+ const identities = carried.get(surface);
6976
+ const audiences = carriedAudiences.get(surface);
6977
+ for (const { component, layers } of hosted) {
6978
+ const identity = realisedViewIdentity(component);
6979
+ if (identity === undefined || !placedViews.has(identity))
6980
+ continue;
6981
+ identities.add(identity);
6982
+ audiences.set(identity, [...(audiences.get(identity) ?? []), layers]);
6983
+ }
6984
+ }
6677
6985
  const placed = new Map([...expectations.placed].map(([surface, entries]) => [surface, entries.map((entry) => entry.shellIdentity)]));
6678
6986
  const placedAudiences = new Map([...expectations.placed].map(([surface, entries]) => [
6679
6987
  surface, new Map(entries.map((entry) => [entry.shellIdentity, entry.audience])),
@@ -6891,67 +7199,81 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6891
7199
  * after its page, so website tasks ran beside the module tasks serving their requirements, read IN_PROGRESS, and wrote
6892
7200
  * "coming soon" for features that shipped an hour later, with nothing ever rewriting them. So each website task gains
6893
7201
  * a prerequisite on every task delivering a requirement it cites (website and documentation tasks excluded), follow-ups
6894
- * included, as they are appended before this step.
7202
+ * included, as they are appended before this step. Which edges are admissible is {@link deriveWebsiteClaimPrerequisites}'s
7203
+ * (one edge at a time, refused only when it would close a cycle); this host adds the guard and the logging.
6895
7204
  *
6896
7205
  * A page waits on everything its sections cite, since its title and description summarize them, so one feature task
6897
7206
  * that stays stuck holds back the whole page and its sections (re-review R4). That is the plan-stuck path, by design.
6898
- *
6899
- * A delivering task that itself waits on a website task would close a cycle with the added edges. Each website task's
6900
- * edges are kept or dropped TOGETHER, re-checked against the schema and the semantic floors (PREREQUISITE_CYCLE among
6901
- * them), so one cycle costs only the tasks it involves (re-review R2), and each is named in a warning: an ordering
6902
- * preference is never the reason the plan cannot be read.
6903
7207
  */
6904
7208
  withHostDerivedWebsiteClaimPrerequisites(graph, companionExports) {
6905
7209
  const citedByTask = citedRequirementRefsByWebsiteTask(graph.tasks, companionExports);
6906
7210
  /*
6907
7211
  * Held per plan content (#3204): the plan is read on every selection, board and landing read, many times a second at a
6908
- * wave's end, and when the combined edges close a cycle the fallback below re-parses and re-validates the whole plan
6909
- * once per website task. On reference run 42621319676 that warned 68 times per read (3,196 lines in 40 minutes) beside
6910
- * the companion's event-loop stalls. The answer depends only on the tasks and on what each website task cites.
7212
+ * wave's end. On reference run 42621319676 re-validating it per website task on each read warned 68 times per read
7213
+ * (3,196 lines in 40 minutes) beside the companion's event-loop stalls. The answer depends only on the tasks and on
7214
+ * what each website task cites.
6911
7215
  */
6912
7216
  const memoKey = JSON.stringify({ tasks: graph.tasks, cited: [...citedByTask].sort(([left], [right]) => left.localeCompare(right)) });
6913
7217
  if (this.websiteClaimPrerequisitesMemo?.key === memoKey)
6914
7218
  return this.websiteClaimPrerequisitesMemo.graph;
6915
- const derived = this.deriveWebsiteClaimPrerequisites(graph, citedByTask);
7219
+ const derived = this.deriveGuardedWebsiteClaimPrerequisites(graph, citedByTask);
6916
7220
  this.websiteClaimPrerequisitesMemo = { key: memoKey, graph: derived };
6917
7221
  return derived;
6918
7222
  }
6919
7223
  websiteClaimPrerequisitesMemo;
6920
- deriveWebsiteClaimPrerequisites(graph, citedByTask) {
6921
- const additions = new Map();
6922
- for (const task of graph.tasks) {
6923
- const cited = citedByTask.get(task.taskRef) ?? [];
6924
- const delivering = cited.flatMap((requirementRef) => deliveringTasksFor(requirementRef, graph.tasks)).map((entry) => entry.taskRef);
6925
- const added = [...new Set(delivering)].filter((taskRef) => taskRef !== task.taskRef && !task.prerequisiteTaskRefs.includes(taskRef));
6926
- if (added.length > 0)
6927
- additions.set(task.taskRef, added);
6928
- }
6929
- if (additions.size === 0)
7224
+ /** The hard-floor findings of the host's plan already logged: each is named once per process, never once per read, as the refused-website-task warning was (17,402 lines on reference run 44052185141). */
7225
+ loggedHostPlanFloorFindings = new Set();
7226
+ /**
7227
+ * The claim edges, held to the plan's hard floors RELATIVE TO THE PLAN THEY ARE ADDED TO.
7228
+ *
7229
+ * The host's plan may already carry a hard-floor finding this step did not cause: a follow-up of a RELATIONSHIP task
7230
+ * keeps that target and declares no product (a follow-up never declares one: it lands on its run, see
7231
+ * `resolveLandedTaskRefs`), which `RELATIONSHIP_TARGET_DISAGREES_WITH_PRODUCTS` reports. The floors are the AUTHORED
7232
+ * plan's contract (`readAuthoredBuildPlan` holds the plan to them); that one guards the domain-coverage count, which
7233
+ * reads authored targets only. Until this guard compared against the plan it extends, the first such follow-up made every
7234
+ * website task's edges look invalid on every read (reference runs 44052185141 and 44255624884, 77 and 76 website tasks per
7235
+ * pass), so pages were built before the features they describe. Such a finding is named once, never held against an edge.
7236
+ *
7237
+ * Only a finding the edges INTRODUCE refuses them, and then all of them: the edge-by-edge derivation can introduce none
7238
+ * today (it adds no edge that closes a cycle, the only floor a website task's prerequisites reach), so this is the guard
7239
+ * for a floor added tomorrow, which costs the claim ordering and never the plan's readability.
7240
+ */
7241
+ deriveGuardedWebsiteClaimPrerequisites(graph, citedByTask) {
7242
+ const derivation = deriveWebsiteClaimPrerequisites(graph, citedByTask);
7243
+ for (const [taskRef, withheld] of derivation.withheldPlanned) {
7244
+ this.logger.warn?.(`Website task "${taskRef}" does not wait on planned task(s) that already wait on it, since waiting would close a cycle`, { withheld });
7245
+ }
7246
+ if (derivation.withheldFollowUps.size > 0) {
7247
+ this.logDebug('Website tasks do not wait on follow-ups that already wait on them (derived from them, from their sections, or chained after one)', { withheld: Object.fromEntries(derivation.withheldFollowUps) });
7248
+ }
7249
+ /*
7250
+ * Keyed by the whole finding, message included. A cycle finding's message is its DFS trail, which an added edge can
7251
+ * change, so a cycle already in the plan could read as introduced and cost every claim edge. Fail-safe, and not
7252
+ * reachable today: the authored plan holds the cycle floor and every host-derived task waits only on tasks before it.
7253
+ */
7254
+ const floorFindings = (candidate) => validateBuildPlanTaskGraph(candidate)
7255
+ .filter((finding) => BUILD_PLAN_TASK_GRAPH_HARD_FLOOR_CODES.includes(finding.code))
7256
+ .map((finding) => ({ key: `${finding.code}\u0000${finding.taskRef}\u0000${finding.message}`, finding }));
7257
+ const baseline = floorFindings(graph);
7258
+ const unlogged = baseline.filter(({ key }) => !this.loggedHostPlanFloorFindings.has(key));
7259
+ if (unlogged.length > 0) {
7260
+ for (const { key } of unlogged)
7261
+ this.loggedHostPlanFloorFindings.add(key);
7262
+ this.logger.warn?.('The build plan as this host derives it carries hard-floor finding(s) on tasks it did not author; the website claim edges are judged only on what they add', {
7263
+ findings: unlogged.map(({ finding }) => `${finding.code} ${finding.taskRef}: ${finding.message}`),
7264
+ });
7265
+ }
7266
+ if (derivation.added.size === 0)
7267
+ return graph;
7268
+ const baselineKeys = new Set(baseline.map(({ key }) => key));
7269
+ const introduced = floorFindings(derivation.graph).filter(({ key }) => !baselineKeys.has(key));
7270
+ if (introduced.length > 0) {
7271
+ this.logger.warn?.('Website tasks keep their authored prerequisites: the edges to what their claims cite would introduce hard-floor finding(s)', {
7272
+ findings: introduced.map(({ finding }) => `${finding.code} ${finding.taskRef}: ${finding.message}`),
7273
+ });
6930
7274
  return graph;
6931
- const withEdges = (current, edges) => BuildPlanTaskGraphSchema.safeParse({
6932
- ...current,
6933
- tasks: current.tasks.map((task) => {
6934
- const added = edges.get(task.taskRef);
6935
- return added === undefined ? task : { ...task, prerequisiteTaskRefs: [...task.prerequisiteTaskRefs, ...added] };
6936
- }),
6937
- });
6938
- const isValid = (candidate) => candidate.success
6939
- && !validateBuildPlanTaskGraph(candidate.data).some((finding) => BUILD_PLAN_TASK_GRAPH_HARD_FLOOR_CODES.includes(finding.code));
6940
- const all = withEdges(graph, additions);
6941
- if (isValid(all))
6942
- return all.data;
6943
- // Some task's edges close a cycle: add them task by task, keeping each set that leaves the plan valid.
6944
- let current = graph;
6945
- for (const [taskRef, added] of additions) {
6946
- const candidate = withEdges(current, new Map([[taskRef, added]]));
6947
- if (isValid(candidate)) {
6948
- current = candidate.data;
6949
- }
6950
- else {
6951
- this.logger.warn?.(`Website task "${taskRef}" keeps its authored prerequisites: waiting on the tasks its claims cite would make the plan invalid`, { wouldWaitOn: added });
6952
- }
6953
7275
  }
6954
- return current;
7276
+ return derivation.graph;
6955
7277
  }
6956
7278
  /**
6957
7279
  * The build plan as the DISPATCH HOST reads it: the authored graph, plus the `database-migrations`
@@ -8101,7 +8423,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
8101
8423
  const slice = sliceSkillIndexForTask(indexMarkdown, skillRefs);
8102
8424
  if (slice !== undefined) {
8103
8425
  sources.push({
8104
- sourceRef: 'application-creation:context/skill-index',
8426
+ sourceRef: SKILL_INDEX_BRIEF_SOURCE_REF,
8105
8427
  originRef: 'application-creation:origin/installed-skill-index',
8106
8428
  // Framework knowledge, compiled and installed by the framework.
8107
8429
  trust: MetaWorkflow_ContextSourceTrust.TRUSTED,
@@ -8231,6 +8553,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
8231
8553
  const resourceType = [...index.resources.keys()].find((candidate) => slugifyRegistryIdentifier(candidate) === resourceRef);
8232
8554
  const related = resourceType === undefined ? undefined : relatedWorkspaceResources(index, resourceType);
8233
8555
  if (related) {
8556
+ // Hub neighbours as stubs (#3891): their relationship lists grew the brief with their degree.
8557
+ const briefed = neighbourhoodForCodingBrief(related);
8234
8558
  sources.push({
8235
8559
  sourceRef: 'application-creation:context/target-resource-neighbourhood',
8236
8560
  originRef: 'application-creation:origin/application-domain-model',
@@ -8239,12 +8563,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
8239
8563
  content: {
8240
8564
  freshness: describeWorkspaceFreshness(freshness),
8241
8565
  target: resourceType,
8242
- edges: related.edges,
8243
- resources: related.resources,
8566
+ edges: briefed.edges,
8567
+ resources: briefed.resources,
8244
8568
  ...(related.unresolved.length > 0 ? { unresolvedNeighbours: related.unresolved } : {}),
8245
- note: 'The target resource as it EXISTS today, with its fields, operations and relationships, plus the '
8246
- + 'resources one hop away. Direction matters: `foreignKeyHolderResourceType` says which side carries the key. '
8247
- + 'Ask for more with `wildo context workspace get <resourceType>` or `wildo context workspace related <resourceType>`.',
8569
+ note: TARGET_NEIGHBOURHOOD_NOTE,
8248
8570
  },
8249
8571
  });
8250
8572
  }
@@ -8410,6 +8732,18 @@ export { ApplicationBuildDispatchCompanionService };
8410
8732
  export function previousAttemptContextSource(run) {
8411
8733
  const tail = (value) => typeof value === 'string' && value.length > 0 ? value.slice(-PREVIOUS_ATTEMPT_OUTPUT_TAIL_CHARS) : undefined;
8412
8734
  const verification = Array.isArray(run.output.verification) ? run.output.verification : [];
8735
+ /*
8736
+ * Findings about the APPLICATION that another writer caused (#3881), per check: the run was not charged with them, and
8737
+ * the retry is told so, so it fixes its own finding and leaves the others to the task that wrote them or to the
8738
+ * end-of-build repair. A check carried whole for them is marked too: it never failed this task.
8739
+ */
8740
+ const notThisTasks = new Map();
8741
+ for (const entry of Array.isArray(run.output.applicationVerificationFindings) ? run.output.applicationVerificationFindings : []) {
8742
+ const { checkRef, finding } = (typeof entry === 'object' && entry !== null ? entry : {});
8743
+ if (typeof checkRef === 'string' && typeof finding === 'string')
8744
+ notThisTasks.set(checkRef, [...(notThisTasks.get(checkRef) ?? []), finding]);
8745
+ }
8746
+ const carriedRefs = new Set(Array.isArray(run.output.carriedVerificationFailures) ? run.output.carriedVerificationFailures.map(String) : []);
8413
8747
  const failedChecks = verification
8414
8748
  .filter((entry) => typeof entry === 'object' && entry !== null)
8415
8749
  .filter((entry) => entry.outcome?.success === false)
@@ -8418,6 +8752,10 @@ export function previousAttemptContextSource(run) {
8418
8752
  ...(tail(entry.outcome?.message) ? { message: tail(entry.outcome?.message) } : {}),
8419
8753
  ...(tail(entry.outcome?.stdoutTail) ? { stdoutTail: tail(entry.outcome?.stdoutTail) } : {}),
8420
8754
  ...(tail(entry.outcome?.stderrTail) ? { stderrTail: tail(entry.outcome?.stderrTail) } : {}),
8755
+ ...(carriedRefs.has(String(entry.checkRef)) ? { notChargedToThisTask: true } : {}),
8756
+ ...(notThisTasks.has(String(entry.checkRef))
8757
+ ? { findingsNotThisTasks: notThisTasks.get(String(entry.checkRef)).map((finding) => finding.slice(0, PREVIOUS_ATTEMPT_OUTPUT_TAIL_CHARS)) }
8758
+ : {}),
8421
8759
  }));
8422
8760
  const rearm = readBuildTaskRearm(run.memory);
8423
8761
  // A coding run records its failure as `error`, a refusal as `failure` — one reader for both (#2390).
@@ -8442,7 +8780,11 @@ export function previousAttemptContextSource(run) {
8442
8780
  + 'required check could not be asked. Nothing about the approach was judged; start the work normally, '
8443
8781
  + 'and read what it had reached if that helps.'
8444
8782
  : 'This task was attempted before and FAILED. Read why before starting: repeating the same approach '
8445
- + 'will fail the same way. Fix what the failure names; do not work around a check.';
8783
+ + 'will fail the same way. Fix what the failure names; do not work around a check.'
8784
+ + (notThisTasks.size > 0
8785
+ ? ' A failed check\'s `findingsNotThisTasks` are about the application, caused by another task writing beside '
8786
+ + 'this one: they are not this task\'s to fix, and the build owes them a repair. Fix the other findings.'
8787
+ : '');
8446
8788
  return {
8447
8789
  sourceRef: 'application-creation:context/previous-attempt',
8448
8790
  originRef: 'application-creation:origin/dev-companion',
@@ -8502,7 +8844,7 @@ export function buildTaskSelfDescriptionContextSource(task, totalTasks,
8502
8844
  /** The skills the agent is told to author with — the task's own unless the host derived better (a website task). */
8503
8845
  skillRefs = task.skillRefs) {
8504
8846
  return {
8505
- sourceRef: 'application-creation:context/build-task',
8847
+ sourceRef: BUILD_TASK_SELF_DESCRIPTION_SOURCE_REF,
8506
8848
  originRef: 'application-creation:origin/build-plan',
8507
8849
  // The committed build plan, decomposed from the application's own specifications.
8508
8850
  trust: MetaWorkflow_ContextSourceTrust.TRUSTED,
@@ -8652,7 +8994,11 @@ export function buildShellPlacementPlanContextSource(surface, companionExports)
8652
8994
  + 'placed on it below and none of the declined subjects, and every file that surface is composed from is committed. '
8653
8995
  + 'The declarationRefs in `produces` name these decisions; they are never spelled in the tree, so writing them as text lands nothing. '
8654
8996
  + 'Roles are written per layer, exactly as listed: a group\'s `requiredRoles` as `runtimeAvailability.requiredRoles` on its '
8655
- + 'sidebar section, and an entry\'s own `requiredRoles` on the entry. A layer that lists none carries none.',
8997
+ + 'sidebar section, and an entry\'s own `requiredRoles` on the entry. A layer that lists none carries none. '
8998
+ // #4012: a planned view built as an operation's custom view has no launcher of its own.
8999
+ + 'A placed view built as a resource operation\'s `customView` is carried by a RESOURCE_OPERATION launcher for that '
9000
+ + 'operation, which the shell reports with the bound component as `hostedCustomView`, when the component\'s name starts '
9001
+ + 'with the view ref\'s words (`view-enquiry-capture` is carried by an entry hosting `EnquiryCaptureCustomView`).',
8656
9002
  ...(groupsOnThisSurface.length === 0 ? {} : { groupsOnThisSurface }),
8657
9003
  placedOnThisSurface: (expectations.placed.get(surface) ?? []).map(describe),
8658
9004
  declinedEverywhere: expectations.declined.map(describe),