@wildo-ai/dev-companion 1.1.1 → 1.1.2

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 (224) hide show
  1. package/dist/esm/.tsbuildinfo +1 -1
  2. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +12 -1
  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 +11 -0
  5. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
  6. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +153 -1
  7. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
  8. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +419 -41
  9. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
  10. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.d.ts +25 -10
  11. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.d.ts.map +1 -1
  12. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.js +65 -24
  13. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.js.map +1 -1
  14. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts +86 -0
  15. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts.map +1 -0
  16. package/dist/esm/claude-cli/services/research-evidence-store.companion.js +127 -0
  17. package/dist/esm/claude-cli/services/research-evidence-store.companion.js.map +1 -0
  18. package/dist/esm/companion-api/companion-api.schemas.d.ts +59 -2
  19. package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
  20. package/dist/esm/companion-api/companion-api.schemas.js +60 -0
  21. package/dist/esm/companion-api/companion-api.schemas.js.map +1 -1
  22. package/dist/esm/companion-api/controllers/companion.controller.d.ts +63 -1
  23. package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
  24. package/dist/esm/companion-api/controllers/companion.controller.js +322 -21
  25. package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
  26. package/dist/esm/core/inject/models/container.d.ts.map +1 -1
  27. package/dist/esm/core/inject/models/container.js +11 -0
  28. package/dist/esm/core/inject/models/container.js.map +1 -1
  29. package/dist/esm/core/inject/models/service-types.d.ts +5 -0
  30. package/dist/esm/core/inject/models/service-types.d.ts.map +1 -1
  31. package/dist/esm/core/inject/models/service-types.js +5 -0
  32. package/dist/esm/core/inject/models/service-types.js.map +1 -1
  33. package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.d.ts.map +1 -1
  34. package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.js +81 -0
  35. package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.js.map +1 -1
  36. package/dist/esm/core/introspection/models/companion-introspection.models.d.ts +11 -1
  37. package/dist/esm/core/introspection/models/companion-introspection.models.d.ts.map +1 -1
  38. package/dist/esm/core/introspection/models/companion-introspection.models.js +39 -0
  39. package/dist/esm/core/introspection/models/companion-introspection.models.js.map +1 -1
  40. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts +8 -0
  41. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts.map +1 -0
  42. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js +317 -0
  43. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js.map +1 -0
  44. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts +45 -0
  45. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -0
  46. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +250 -0
  47. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -0
  48. package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.d.ts +123 -0
  49. package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.d.ts.map +1 -0
  50. package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.js +298 -0
  51. package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.js.map +1 -0
  52. package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.d.ts +78 -1
  53. package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.d.ts.map +1 -1
  54. package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.js +155 -6
  55. package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.js.map +1 -1
  56. package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts +131 -2
  57. package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts.map +1 -1
  58. package/dist/esm/core/introspection/services/companion-introspection.companion.service.js +259 -9
  59. package/dist/esm/core/introspection/services/companion-introspection.companion.service.js.map +1 -1
  60. package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.d.ts +243 -0
  61. package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.d.ts.map +1 -0
  62. package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.js +417 -0
  63. package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.js.map +1 -0
  64. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts +186 -0
  65. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts.map +1 -0
  66. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js +368 -0
  67. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js.map +1 -0
  68. package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.d.ts +101 -0
  69. package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.d.ts.map +1 -0
  70. package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.js +278 -0
  71. package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.js.map +1 -0
  72. package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts +365 -0
  73. package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts.map +1 -0
  74. package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.js +167 -0
  75. package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.js.map +1 -0
  76. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.d.ts.map +1 -1
  77. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js +332 -3
  78. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js.map +1 -1
  79. package/dist/esm/core/introspection/subprocess/family-aspects.behavior.d.ts +19 -0
  80. package/dist/esm/core/introspection/subprocess/family-aspects.behavior.d.ts.map +1 -0
  81. package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js +164 -0
  82. package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js.map +1 -0
  83. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts +3 -1
  84. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts.map +1 -1
  85. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js +36 -23
  86. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js.map +1 -1
  87. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts +51 -0
  88. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts.map +1 -0
  89. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js +391 -0
  90. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js.map +1 -0
  91. package/dist/esm/core/runtime/companion-startup-assembly.d.ts.map +1 -1
  92. package/dist/esm/core/runtime/companion-startup-assembly.js +5 -0
  93. package/dist/esm/core/runtime/companion-startup-assembly.js.map +1 -1
  94. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts +103 -0
  95. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts.map +1 -0
  96. package/dist/esm/core/runtime/dev-compile-quiet.companion.js +124 -0
  97. package/dist/esm/core/runtime/dev-compile-quiet.companion.js.map +1 -0
  98. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts +39 -2
  99. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
  100. package/dist/esm/core/runtime/services/start-companion-application.service.js +122 -11
  101. package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
  102. package/dist/esm/core/specifications/non-composite-view-specification-context.shared.d.ts +6 -0
  103. package/dist/esm/core/specifications/non-composite-view-specification-context.shared.d.ts.map +1 -1
  104. package/dist/esm/core/specifications/non-composite-view-specification-context.shared.js.map +1 -1
  105. package/dist/esm/core/specifications/specification-context-factory.shared.d.ts +23 -0
  106. package/dist/esm/core/specifications/specification-context-factory.shared.d.ts.map +1 -1
  107. package/dist/esm/core/specifications/specification-context-factory.shared.js +26 -4
  108. package/dist/esm/core/specifications/specification-context-factory.shared.js.map +1 -1
  109. package/dist/esm/executions/services/companion-executions.companion.service.d.ts +82 -3
  110. package/dist/esm/executions/services/companion-executions.companion.service.d.ts.map +1 -1
  111. package/dist/esm/executions/services/companion-executions.companion.service.js +126 -12
  112. package/dist/esm/executions/services/companion-executions.companion.service.js.map +1 -1
  113. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.d.ts +12 -0
  114. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.d.ts.map +1 -0
  115. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.js +12 -0
  116. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.js.map +1 -0
  117. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.d.ts +1 -1
  118. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.js +1 -1
  119. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.js.map +1 -1
  120. package/dist/esm/i18n/composite_views/app.creation-board.en.d.ts +13 -0
  121. package/dist/esm/i18n/composite_views/app.creation-board.en.d.ts.map +1 -0
  122. package/dist/esm/i18n/composite_views/app.creation-board.en.js +91 -0
  123. package/dist/esm/i18n/composite_views/app.creation-board.en.js.map +1 -0
  124. package/dist/esm/i18n/composite_views/app.domain-model.en.d.ts +38 -0
  125. package/dist/esm/i18n/composite_views/app.domain-model.en.d.ts.map +1 -0
  126. package/dist/esm/i18n/composite_views/app.domain-model.en.js +41 -0
  127. package/dist/esm/i18n/composite_views/app.domain-model.en.js.map +1 -0
  128. package/dist/esm/i18n/index.d.ts +3 -3
  129. package/dist/esm/i18n/index.js +3 -3
  130. package/dist/esm/i18n/index.js.map +1 -1
  131. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.d.ts +24 -0
  132. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.d.ts.map +1 -0
  133. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.js +20 -0
  134. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.js.map +1 -0
  135. package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.d.ts +31 -0
  136. package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.d.ts.map +1 -0
  137. package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.js +27 -0
  138. package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.js.map +1 -0
  139. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.d.ts +24 -0
  140. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.d.ts.map +1 -0
  141. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.js +20 -0
  142. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.js.map +1 -0
  143. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts +28 -0
  144. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts.map +1 -0
  145. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js +24 -0
  146. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js.map +1 -0
  147. package/dist/esm/i18n/resources/workbenchDomainResources.en.d.ts +138 -0
  148. package/dist/esm/i18n/resources/workbenchDomainResources.en.d.ts.map +1 -0
  149. package/dist/esm/i18n/resources/workbenchDomainResources.en.js +100 -0
  150. package/dist/esm/i18n/resources/workbenchDomainResources.en.js.map +1 -0
  151. package/dist/esm/i18n/resources/workbenchPlaybooks.en.d.ts +29 -0
  152. package/dist/esm/i18n/resources/workbenchPlaybooks.en.d.ts.map +1 -0
  153. package/dist/esm/i18n/resources/workbenchPlaybooks.en.js +25 -0
  154. package/dist/esm/i18n/resources/workbenchPlaybooks.en.js.map +1 -0
  155. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.d.ts +27 -0
  156. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.d.ts.map +1 -0
  157. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.js +23 -0
  158. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.js.map +1 -0
  159. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +806 -0
  160. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -0
  161. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +326 -0
  162. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -0
  163. package/dist/esm/i18n/resources/workbenchTraceSessions.en.d.ts +26 -0
  164. package/dist/esm/i18n/resources/workbenchTraceSessions.en.d.ts.map +1 -0
  165. package/dist/esm/i18n/resources/workbenchTraceSessions.en.js +22 -0
  166. package/dist/esm/i18n/resources/workbenchTraceSessions.en.js.map +1 -0
  167. package/dist/esm/i18n/system_enums/market.en.d.ts +202 -0
  168. package/dist/esm/i18n/system_enums/market.en.d.ts.map +1 -0
  169. package/dist/esm/i18n/system_enums/market.en.js +209 -0
  170. package/dist/esm/i18n/system_enums/market.en.js.map +1 -0
  171. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts +112 -2
  172. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts.map +1 -1
  173. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js +201 -34
  174. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js.map +1 -1
  175. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts +31 -3
  176. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts.map +1 -1
  177. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js +48 -12
  178. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js.map +1 -1
  179. package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.d.ts +36 -0
  180. package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.d.ts.map +1 -0
  181. package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js +75 -0
  182. package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js.map +1 -0
  183. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +105 -7
  184. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  185. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +298 -24
  186. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  187. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +46 -3
  188. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
  189. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +95 -2
  190. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
  191. package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.d.ts +9 -0
  192. package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.d.ts.map +1 -1
  193. package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.js +13 -0
  194. package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.js.map +1 -1
  195. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts +12 -0
  196. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts.map +1 -1
  197. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js +23 -0
  198. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js.map +1 -1
  199. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +120 -3
  200. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
  201. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +636 -81
  202. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  203. package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.d.ts +40 -0
  204. package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.d.ts.map +1 -1
  205. package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.js +63 -1
  206. package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.js.map +1 -1
  207. package/dist/esm/technical-doc/services/technical-doc.companion.service.d.ts +21 -0
  208. package/dist/esm/technical-doc/services/technical-doc.companion.service.d.ts.map +1 -1
  209. package/dist/esm/technical-doc/services/technical-doc.companion.service.js +86 -2
  210. package/dist/esm/technical-doc/services/technical-doc.companion.service.js.map +1 -1
  211. package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.d.ts +12 -1
  212. package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.d.ts.map +1 -1
  213. package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js +47 -1
  214. package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js.map +1 -1
  215. package/package.json +17 -17
  216. package/dist/esm/.builder.pid +0 -9
  217. package/dist/esm/i18n/resources/workbenchApplicationModules.en.d.ts +0 -36
  218. package/dist/esm/i18n/resources/workbenchApplicationModules.en.d.ts.map +0 -1
  219. package/dist/esm/i18n/resources/workbenchApplicationModules.en.js +0 -32
  220. package/dist/esm/i18n/resources/workbenchApplicationModules.en.js.map +0 -1
  221. package/dist/esm/i18n/resources/workbenchResourceRelationships.en.d.ts +0 -29
  222. package/dist/esm/i18n/resources/workbenchResourceRelationships.en.d.ts.map +0 -1
  223. package/dist/esm/i18n/resources/workbenchResourceRelationships.en.js +0 -25
  224. package/dist/esm/i18n/resources/workbenchResourceRelationships.en.js.map +0 -1
@@ -11,13 +11,17 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
11
  return function (target, key) { decorator(target, key, paramIndex); }
12
12
  };
13
13
  import { inject, injectable } from 'inversify';
14
- import { composeBuildTaskCodingContract, } from '@wildo-ai/application-creation-runtime';
14
+ import { WorkbenchBuildPlanTaskStatus } from '@wildo-ai/platform-core-shared';
15
+ import { composeBuildTaskCodingContract, slugifyRegistryIdentifier, } from '@wildo-ai/application-creation-runtime';
15
16
  import { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';
16
17
  import { MetaWorkflow_ContextSourceRole } from '@wildo-ai/saas-models/meta-workflows';
17
18
  import { BuildPlanTaskGraphSchema, BuildPlanTaskTargetKind, selectReadyBuildPlanTasks, validateBuildPlanTaskGraph, } from '@wildo-ai/saas-specifications/application-creation';
18
19
  import { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types.js';
20
+ import { CompanionIntrospectionService } from '../../core/introspection/services/companion-introspection.companion.service.js';
19
21
  import { loadSpecificationsCompanionExports } from '../../core/context/companion-package-loaders.companion.js';
20
- import { CodingAgentDispatchCompanionService } from '../../claude-cli/services/coding-agent-dispatch.companion.service.js';
22
+ import { waitForDevCompileQuiet } from '../../core/runtime/dev-compile-quiet.companion.js';
23
+ import { CodingAgentDispatchCompanionService, } from '../../claude-cli/services/coding-agent-dispatch.companion.service.js';
24
+ import { resolveApplicationCodingTaskVerificationPlans, } from '../../claude-cli/models/coding-agent-dispatch.models.js';
21
25
  import { GitChangeSetCompanionService } from '../../claude-cli/services/git-change-set.companion.service.js';
22
26
  import { ApplicationBuildGenerationStepCompanionService, } from './application-build-generation-step.companion.service.js';
23
27
  import { resolveBuildPlanTaskCodingPolicy, resolveBuildTaskLandedEvidencePaths, } from './application-build-task-coding-policy.companion.service.js';
@@ -64,13 +68,15 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
64
68
  dispatch;
65
69
  git;
66
70
  generationSteps;
71
+ introspection;
67
72
  logDebug;
68
- constructor(logger, companionContext, dispatch, git, generationSteps) {
73
+ constructor(logger, companionContext, dispatch, git, generationSteps, introspection) {
69
74
  this.logger = logger;
70
75
  this.companionContext = companionContext;
71
76
  this.dispatch = dispatch;
72
77
  this.git = git;
73
78
  this.generationSteps = generationSteps;
79
+ this.introspection = introspection;
74
80
  this.logDebug = this.logger.debugByType('ApplicationBuildDispatchCompanionService');
75
81
  }
76
82
  /** What the next run would be, without running it. Pure read — nothing is locked, created or started. */
@@ -82,6 +88,43 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
82
88
  * agent (bounded by its scope, locked, captured and verified); a companion generation step runs the
83
89
  * companion's own pipeline for that step. One route, two executors — the interleaving IS the build loop.
84
90
  */
91
+ /**
92
+ * The last few DETACHED dispatch outcomes, newest first — the observation channel the synchronous
93
+ * door lacked. Measured 2026-09-04: a 40+-minute i18n generation step outlived the HTTP request's
94
+ * 30-minute ceiling, the response died with the socket, and the only signals left were file
95
+ * mtimes and a lock file whose EXISTENCE turned out to mean nothing — the operator was blind for
96
+ * half the run. In-memory by design: the step's real product is files on disk (durable in git),
97
+ * and this record is the run's NARRATIVE, not its truth.
98
+ */
99
+ lastDetachedDispatches = [];
100
+ readDetachedDispatches() {
101
+ return [...this.lastDetachedDispatches];
102
+ }
103
+ /**
104
+ * Fire the next ready build task WITHOUT holding an HTTP request over it. Returns the selected
105
+ * plan immediately; the outcome lands in {@link readDetachedDispatches} and, for a coding task,
106
+ * in the durable actor-task row it already writes. The same single-flight properties hold — this
107
+ * is the same `dispatchNextBuildTask`, minus the requirement that a socket survive it.
108
+ */
109
+ submitBuildDispatchDetached(input = {}, session) {
110
+ return this.prepareNextBuildTask(input).then((prepared) => {
111
+ const record = {
112
+ taskRef: prepared.plan.taskRef,
113
+ startedAt: new Date().toISOString(),
114
+ };
115
+ this.lastDetachedDispatches.unshift(record);
116
+ this.lastDetachedDispatches.splice(5);
117
+ void this.dispatchNextBuildTask(input, session)
118
+ .then(() => { record.finishedAt = new Date().toISOString(); record.ok = true; })
119
+ .catch((error) => {
120
+ record.finishedAt = new Date().toISOString();
121
+ record.ok = false;
122
+ record.error = error instanceof Error ? error.message.slice(0, 400) : String(error).slice(0, 400);
123
+ this.logDebug('Detached build dispatch failed', { taskRef: record.taskRef, error: record.error });
124
+ });
125
+ return prepared.plan;
126
+ });
127
+ }
85
128
  async dispatchNextBuildTask(input = {}, session) {
86
129
  const prepared = await this.prepareNextBuildTask(input);
87
130
  if (prepared.kind === 'GENERATION_STEP') {
@@ -96,9 +139,75 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
96
139
  taskRef: prepared.plan.taskRef,
97
140
  allowedPathPrefixes: prepared.plan.allowedPathPrefixes,
98
141
  });
142
+ /*
143
+ * The churn gate, and deliberately NOT the retry (#265): a coding turn MUTATES the workspace, so
144
+ * a kill mid-turn leaves a change-set the attribution machinery must reconcile — re-dispatching
145
+ * blind on top of that is how two half-runs interleave. The gate raises the odds the turn never
146
+ * meets the respawn; a killed coding run stays what it is today, a visibly aborted task an
147
+ * operator re-dispatches deliberately.
148
+ */
149
+ await waitForDevCompileQuiet({
150
+ frameworkRepositoryRoot: this.companionContext.resolvedHomes.framework.repositoryRoot,
151
+ log: (message, context) => this.logDebug(message, { taskRef: prepared.plan.taskRef, ...context }),
152
+ });
99
153
  const admission = await this.dispatch.runApplicationCodingTask(prepared.contract);
100
154
  return { plan: prepared.plan, admission };
101
155
  }
156
+ /**
157
+ * Reconstruct the answerable state for a parked coding task whose IN-PROCESS
158
+ * state was lost to a companion restart, by RE-SELECTING it from the build plan.
159
+ *
160
+ * The durable row still names its build-plan `taskRef` and carries the persisted
161
+ * `suspension`; from those this re-composes the same bounded contract (mutation
162
+ * scope + verification plan come from the task and its coding policy, unchanged
163
+ * by a restart) against a DETERMINISTIC self-description context — the resume
164
+ * discards context anyway, since the agent's persisted session holds the real
165
+ * one. A fresh baseline is captured for the change-set the resume will produce.
166
+ *
167
+ * Returns `null` when the task cannot be answered this way: not a parked coding
168
+ * row, the agent does not support resume, the build task no longer exists, or it
169
+ * is not a coding target. The caller then refuses rather than starting an
170
+ * unrelated or unbounded run.
171
+ */
172
+ async reconstructParkedCodingTaskForResume(taskId, sessionContext) {
173
+ const meta = await this.dispatch.loadPersistedParkedCodingTask(taskId, sessionContext);
174
+ if (!meta || !meta.suspension.resumable)
175
+ return null;
176
+ const graph = await this.readBuildPlan();
177
+ const task = graph.tasks.find((entry) => entry.taskRef === meta.taskRef);
178
+ if (!task || task.target === undefined || task.target.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {
179
+ return null;
180
+ }
181
+ let contract;
182
+ try {
183
+ const boundary = resolveBuildPlanTaskCodingPolicy(task);
184
+ contract = composeBuildTaskCodingContract({
185
+ task,
186
+ boundary,
187
+ // The deterministic self-description only: a resume does not re-send the
188
+ // task prompt, so re-running the full live-query/introspection assembly
189
+ // would spend a model call to build context nothing reads.
190
+ contextSources: [this.buildTaskSelfDescriptionContextSource(task, graph.tasks.length)],
191
+ objectiveRef: 'application-creation:objective/build-plan',
192
+ maximumTokenBudget: DEFAULT_CONTEXT_TOKEN_BUDGET,
193
+ });
194
+ }
195
+ catch {
196
+ // A task that no longer composes to a bounded run (empty scope, no checks,
197
+ // wrong target) is not answerable — refuse rather than resume unbounded.
198
+ return null;
199
+ }
200
+ const verificationPlans = resolveApplicationCodingTaskVerificationPlans(contract.verificationIntent.requiredChecks);
201
+ const baseline = await this.git.captureWorktreeSnapshot();
202
+ return {
203
+ durableTask: meta.durableTask,
204
+ task: contract,
205
+ verificationPlans,
206
+ baseline,
207
+ suspension: meta.suspension,
208
+ parkedAt: new Date().toISOString(),
209
+ };
210
+ }
102
211
  async prepareNextBuildTask(input) {
103
212
  const graph = await this.readBuildPlan();
104
213
  const landedTaskRefs = await this.resolveLandedTaskRefs(graph.tasks);
@@ -139,7 +248,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
139
248
  const contract = composeBuildTaskCodingContract({
140
249
  task,
141
250
  boundary,
142
- contextSources: this.buildContextSources(task, graph.tasks.length),
251
+ contextSources: await this.buildContextSources(task, graph.tasks.length),
143
252
  objectiveRef: 'application-creation:objective/build-plan',
144
253
  maximumTokenBudget: input.maximumTokenBudget ?? DEFAULT_CONTEXT_TOKEN_BUDGET,
145
254
  });
@@ -184,6 +293,40 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
184
293
  const landed = await this.resolveLandedTaskRefs(plan.tasks);
185
294
  return { totalTasks: plan.tasks.length, landedTasks: landed.size };
186
295
  }
296
+ /**
297
+ * Every build-plan task in the DISPATCH view — the creation board's `workbenchBuildPlanTasks`
298
+ * rows (`workbench-creation-board-resources.md`, Phase 2).
299
+ *
300
+ * `status` is computed per read, never stored: `landed` = the task's evidence paths are all
301
+ * committed (the same resolution the dispatcher itself selects by), `ready` = every prerequisite
302
+ * landed and it has not, `blocked` = otherwise. Exactly one holds.
303
+ *
304
+ * An application with NO authored build plan answers ZERO TASKS rather than throwing: the plan
305
+ * file legitimately does not exist until build-decompose runs, so "nothing there yet" is the
306
+ * true answer. Absence is tested DIRECTLY (the exports carry no `buildPlanSpecification`) rather
307
+ * than by catching `ApplicationBuildPlanUnavailableError`, because `readBuildPlan` throws that
308
+ * SAME class for a plan that exists and fails schema or semantic validation — and flattening an
309
+ * invalid plan into an empty board would be "could not look" wearing "nothing there".
310
+ */
311
+ async describeBuildPlanBoard() {
312
+ const exports = await loadSpecificationsCompanionExports(this.companionContext);
313
+ const authored = exports.buildPlanSpecification;
314
+ if (authored === undefined || authored === null)
315
+ return [];
316
+ const plan = await this.readBuildPlan();
317
+ const landed = await this.resolveLandedTaskRefs(plan.tasks);
318
+ const ready = new Set(selectReadyBuildPlanTasks(plan, landed).map((task) => task.taskRef));
319
+ return plan.tasks.map((task) => ({
320
+ taskRef: task.taskRef,
321
+ objective: task.objective,
322
+ targetKind: String(task.target?.kind ?? ''),
323
+ functionalTopic: String(task.functionalTopic),
324
+ status: landed.has(task.taskRef) ? WorkbenchBuildPlanTaskStatus.LANDED
325
+ : ready.has(task.taskRef) ? WorkbenchBuildPlanTaskStatus.READY
326
+ : WorkbenchBuildPlanTaskStatus.BLOCKED,
327
+ prerequisiteTaskRefs: task.prerequisiteTaskRefs,
328
+ }));
329
+ }
187
330
  async resolveLandedTaskRefs(tasks) {
188
331
  const landed = new Set();
189
332
  for (const task of tasks) {
@@ -220,27 +363,156 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
220
363
  return parsed.data;
221
364
  }
222
365
  /**
223
- * What the run is allowed to see.
366
+ * What the run is allowed to see — the PUSH floor of the dispatch lane's context (issue #253).
367
+ *
368
+ * Widened 2026-09-02 from "the task itself and nothing else yet" to the lean mandatory core the
369
+ * epic's re-analysis decided, and deliberately no further: everything an agent might need beyond
370
+ * its target's blast radius is the PULL door's job (`wildo context …`, issue #252), which the
371
+ * `live-queries` source below points at. Anticipating everything here would be the planner trap
372
+ * (#254) re-entering through the push door. Everything is model-safe by construction — the
373
+ * application's own accepted build plan, its own live registry, its own domain plan — and the
374
+ * contract's composer re-asserts `SAFE_FOR_MODEL` on every source regardless.
375
+ *
376
+ * ## Failure posture: best-effort on the derived sources, deliberately
377
+ *
378
+ * The playbook lane's workspace-truth section fails CLOSED, because a tool-less planner with no
379
+ * workspace truth invents module ids. A CODING agent is the opposite case on both counts: it has
380
+ * tools (it can read the tree, and the door), so a missing derived source degrades speed rather
381
+ * than truth — while refusing the dispatch because a subprocess hiccuped would block the build on
382
+ * context the run could recover for itself. So: the TASK is always present, the derived sources
383
+ * are added when their reads succeed, and a failed read is a WARN naming what was omitted.
384
+ *
385
+ * ## No new cache, verified rather than assumed
386
+ *
387
+ * The re-analysis asked for the introspection read to be cached across a 55-task plan. It already
388
+ * is: `CompanionIntrospectionService.requestInfo` carries its own source-state derivation cache,
389
+ * keyed on the observed workspace state — asking again after nothing changed is a cache hit, and
390
+ * a landed task invalidates it by changing the sources it hashes. Adding a second cache here would
391
+ * be a copy that can only ever disagree.
392
+ */
393
+ /**
394
+ * The task's own DETERMINISTIC self-description — no introspection, no LLM.
224
395
  *
225
- * The task itself and its position in the graph, and nothing else yet. Everything here is model-safe by
226
- * construction — it is the application's own accepted build plan — and widening this is where introspected
227
- * application reality and the task's skill pointers arrive next.
396
+ * The first (and mandatory) context source of every coding task, extracted so
397
+ * a RESUME can rebuild a schema-valid contract without re-running the expensive
398
+ * live-query / module-introspection assembly whose output a resume discards
399
+ * anyway (the agent's session already holds the real context).
228
400
  */
229
- buildContextSources(task, totalTasks) {
230
- return [{
231
- sourceRef: 'application-creation:context/build-task',
232
- originRef: 'application-creation:origin/build-plan',
233
- role: MetaWorkflow_ContextSourceRole.MANDATORY,
234
- content: {
235
- taskRef: task.taskRef,
236
- objective: task.objective,
237
- target: task.target,
238
- functionalTopic: task.functionalTopic,
239
- skillRefs: task.skillRefs,
240
- prerequisiteTaskRefs: task.prerequisiteTaskRefs,
241
- positionInPlan: `one of ${totalTasks} tasks in the application's accepted build plan`,
242
- },
243
- }];
401
+ buildTaskSelfDescriptionContextSource(task, totalTasks) {
402
+ return {
403
+ sourceRef: 'application-creation:context/build-task',
404
+ originRef: 'application-creation:origin/build-plan',
405
+ role: MetaWorkflow_ContextSourceRole.MANDATORY,
406
+ content: {
407
+ taskRef: task.taskRef,
408
+ objective: task.objective,
409
+ target: task.target,
410
+ functionalTopic: task.functionalTopic,
411
+ skillRefs: task.skillRefs,
412
+ prerequisiteTaskRefs: task.prerequisiteTaskRefs,
413
+ positionInPlan: `one of ${totalTasks} tasks in the application's accepted build plan`,
414
+ },
415
+ };
416
+ }
417
+ async buildContextSources(task, totalTasks) {
418
+ const sources = [this.buildTaskSelfDescriptionContextSource(task, totalTasks)];
419
+ /*
420
+ * The DOOR MENU — tier-0 of the pull half: the live-query ids and the two commands that expand
421
+ * them. Ids only, not descriptions: `wildo context list` IS the descriptions, one command away,
422
+ * and rendering ~27 descriptions into every dispatch prompt would spend the budget this source
423
+ * exists to save. Read from the same catalog the CLI menu serves, so it cannot drift from what
424
+ * the companion actually answers.
425
+ */
426
+ const catalog = this.introspection.describeCatalog();
427
+ sources.push({
428
+ sourceRef: 'application-creation:context/live-queries',
429
+ originRef: 'application-creation:origin/dev-companion',
430
+ role: MetaWorkflow_ContextSourceRole.MANDATORY,
431
+ content: {
432
+ guidance: 'Live application state is one shell command away — prefer asking over re-deriving from the tree. '
433
+ + '`wildo context list` prints the menu with descriptions; `wildo context info <behaviorId>` runs one query; '
434
+ + '`wildo context journey` shows the creation journey; `wildo context coherence` the cross-family coherence report.',
435
+ behaviorIds: catalog.behaviors.map((behavior) => behavior.behaviorId),
436
+ },
437
+ });
438
+ const moduleRef = task.target && 'moduleRef' in task.target ? task.target.moduleRef : undefined;
439
+ const resourceRef = task.target && 'resourceRef' in task.target ? task.target.resourceRef : undefined;
440
+ // WORKSPACE TRUTH, sliced to the target: the target module's real resources and present schema
441
+ // fields, plus the exact list of every module id (counts stay exact — a slice that hid the
442
+ // population would under-report, and an agent that invents a module id dispatches a no-op).
443
+ try {
444
+ const backendServiceKey = Object.entries(this.companionContext.servicesByKey)
445
+ .find(([, service]) => !service.frontendType)?.[0];
446
+ if (backendServiceKey) {
447
+ const result = await this.introspection.requestInfo({ serviceKey: backendServiceKey, behavior: 'resources-registry' });
448
+ if (result.success) {
449
+ const snapshot = result.data;
450
+ const modules = snapshot.modules ?? [];
451
+ const targetModule = moduleRef === undefined
452
+ ? undefined
453
+ : modules.find((sharedModule) => slugifyRegistryIdentifier(sharedModule.moduleId) === moduleRef);
454
+ sources.push({
455
+ sourceRef: 'application-creation:context/workspace-truth',
456
+ originRef: 'application-creation:origin/resources-registry-introspection',
457
+ role: MetaWorkflow_ContextSourceRole.MANDATORY,
458
+ content: {
459
+ allModuleIds: modules.map((sharedModule) => sharedModule.moduleId),
460
+ ...(targetModule
461
+ ? {
462
+ targetModule: {
463
+ moduleId: targetModule.moduleId,
464
+ resources: targetModule.resourceTypes.map((resourceType) => ({
465
+ resourceType,
466
+ slugRef: slugifyRegistryIdentifier(resourceType),
467
+ presentSchemaFields: snapshot.resourceSchemaFields?.[resourceType] ?? [],
468
+ })),
469
+ },
470
+ }
471
+ : {}),
472
+ note: 'A resource listed here already EXISTS as a registered skeleton — its task is enrichment, not creation. '
473
+ + 'A domain-plan resource NOT listed here does not exist yet. Full registry: `wildo context info resources-registry`.',
474
+ },
475
+ });
476
+ }
477
+ else {
478
+ this.logDebug('Workspace-truth source omitted from the dispatch context (introspection failed)', { taskRef: task.taskRef });
479
+ }
480
+ }
481
+ }
482
+ catch (error) {
483
+ this.logger.warn('Workspace-truth source omitted from the dispatch context', { taskRef: task.taskRef, error: String(error) });
484
+ }
485
+ // THE DOMAIN-PLAN SLICE for the target: WHAT this task's objective enriches toward, in the
486
+ // application's own accepted words — the module semantics and, for a relationship task, the
487
+ // relationship drafts touching the target. Absent plan (older app, or foundation not run) is
488
+ // simply absent; nothing here invents a fallback.
489
+ try {
490
+ const exports = await loadSpecificationsCompanionExports(this.companionContext);
491
+ const domainPlan = exports.domainPlanSpecification;
492
+ const planModules = domainPlan?.modules ?? [];
493
+ const targetPlanModule = moduleRef === undefined
494
+ ? undefined
495
+ : planModules.find((planModule) => slugifyRegistryIdentifier(planModule.relatedModuleId) === moduleRef);
496
+ if (targetPlanModule) {
497
+ const moduleResourceSlugs = new Set([...(targetPlanModule.mainResources ?? []), ...(targetPlanModule.supportingResources ?? [])]
498
+ .map((resourceType) => slugifyRegistryIdentifier(resourceType)));
499
+ sources.push({
500
+ sourceRef: 'application-creation:context/domain-plan-slice',
501
+ originRef: 'application-creation:origin/domain-plan',
502
+ role: MetaWorkflow_ContextSourceRole.MANDATORY,
503
+ content: {
504
+ targetModule: targetPlanModule,
505
+ ...(resourceRef !== undefined ? { targetResourceRef: resourceRef } : {}),
506
+ relationshipsTouchingModule: (domainPlan?.relationships ?? []).filter((relationship) => moduleResourceSlugs.has(slugifyRegistryIdentifier(relationship.sourceResourceRef))
507
+ || moduleResourceSlugs.has(slugifyRegistryIdentifier(relationship.targetResourceRef))),
508
+ },
509
+ });
510
+ }
511
+ }
512
+ catch (error) {
513
+ this.logger.warn('Domain-plan slice omitted from the dispatch context', { taskRef: task.taskRef, error: String(error) });
514
+ }
515
+ return sources;
244
516
  }
245
517
  };
246
518
  ApplicationBuildDispatchCompanionService = __decorate([
@@ -250,9 +522,11 @@ ApplicationBuildDispatchCompanionService = __decorate([
250
522
  __param(2, inject(COMPANION_SERVICE_TYPES.CodingAgentDispatchService)),
251
523
  __param(3, inject(COMPANION_SERVICE_TYPES.GitChangeSetService)),
252
524
  __param(4, inject(COMPANION_SERVICE_TYPES.BuildGenerationStepService)),
525
+ __param(5, inject(COMPANION_SERVICE_TYPES.IntrospectionService)),
253
526
  __metadata("design:paramtypes", [Function, Object, CodingAgentDispatchCompanionService,
254
527
  GitChangeSetCompanionService,
255
- ApplicationBuildGenerationStepCompanionService])
528
+ ApplicationBuildGenerationStepCompanionService,
529
+ CompanionIntrospectionService])
256
530
  ], ApplicationBuildDispatchCompanionService);
257
531
  export { ApplicationBuildDispatchCompanionService };
258
532
  /** Context ceiling for one dispatch. Stated here because only the host knows what the agent can accept. */
@@ -1 +1 @@
1
- {"version":3,"file":"application-build-dispatch.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/application-build-dispatch.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EACL,8BAA8B,GAE/B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4B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ACzB,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;oBAC/C,cAAc,EAAE,UAAU,UAAU,iDAAiD;iBACtF;aACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA5MY,wCAAwC;IADpD,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;IAChD,WAAA,MAAM,CAAC,uBAAuB,CAAC,0BAA0B,CAAC,CAAA;IAC1D,WAAA,MAAM,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,CAAA;IACnD,WAAA,MAAM,CAAC,uBAAuB,CAAC,0BAA0B,CAAC,CAAA;uDAF4B,mCAAmC;QAC/C,4BAA4B;QACT,8CAA8C;GARnI,wCAAwC,CA4MpD;;AAED,2GAA2G;AAC3G,MAAM,4BAA4B,GAAG,OAAO,CAAC","sourcesContent":["import { inject, injectable } from 'inversify';\n\nimport {\n composeBuildTaskCodingContract,\n type BuildTaskContextSource,\n} from '@wildo-ai/application-creation-runtime';\nimport type { LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';\nimport { MetaWorkflow_ContextSourceRole } from '@wildo-ai/saas-models/meta-workflows';\nimport {\n BuildPlanTaskGraphSchema,\n BuildPlanTaskTargetKind,\n selectReadyBuildPlanTasks,\n validateBuildPlanTaskGraph,\n type ApplicationCodingTaskContract,\n type BuildPlanTask,\n} from '@wildo-ai/saas-specifications/application-creation';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { loadSpecificationsCompanionExports } from '../../core/context/companion-package-loaders.companion';\nimport { CodingAgentDispatchCompanionService } from '../../claude-cli/services/coding-agent-dispatch.companion.service';\nimport type { ApplicationCodingTaskRunAdmission } from '../../claude-cli/models/coding-agent-dispatch.models';\nimport { GitChangeSetCompanionService } from '../../claude-cli/services/git-change-set.companion.service';\nimport type { CompanionExecutionSessionContext } from '../../core/traceability/companion-traceability.models';\nimport {\n ApplicationBuildGenerationStepCompanionService,\n type ApplicationBuildGenerationStepRunResult,\n} from './application-build-generation-step.companion.service';\nimport {\n ApplicationBuildTaskNotACodingTaskError,\n resolveBuildPlanTaskCodingPolicy,\n resolveBuildTaskLandedEvidencePaths,\n} from './application-build-task-coding-policy.companion.service';\n\n/** No build plan, or nothing left to do. Named so the transport can say which. */\nexport class ApplicationBuildPlanUnavailableError extends Error {}\nexport class ApplicationBuildPlanExhaustedError extends Error {}\n\n/** What the next dispatch WOULD be. Returned unconfirmed, so a creator sees the scope before anything runs. */\nexport interface ApplicationBuildDispatchPlan {\n readonly taskRef: string;\n readonly objective: string;\n readonly targetKind: string;\n /**\n * Present exactly when the next task is a companion generation step. A build plan INTERLEAVES two\n * executors — coding tasks for a coding agent, and companion generation steps (labels, seeds, emails)\n * the companion runs itself — and this route serves BOTH: `dispatch-next` routes by the task's own\n * `target.kind`. (An earlier version refused generation steps by name; now that an executor exists,\n * the refusal would be a hole in the build lane, not a boundary.)\n */\n readonly generationStepRef?: string;\n readonly allowedPathPrefixes: readonly string[];\n readonly prohibitedPathPrefixes: readonly string[];\n readonly requiredChecks: readonly string[];\n readonly installedSkillRefs: readonly string[];\n readonly readyTaskRefs: readonly string[];\n readonly landedTaskRefs: readonly string[];\n}\n\n/**\n * One dispatched build task's outcome — exactly one of the two executor results is present, matching the\n * plan's `targetKind`. `admission` for a coding run; `generationStep` for a companion generation step.\n */\nexport interface ApplicationBuildDispatchResult {\n readonly plan: ApplicationBuildDispatchPlan;\n readonly admission?: ApplicationCodingTaskRunAdmission;\n readonly generationStep?: ApplicationBuildGenerationStepRunResult;\n}\n\n/**\n * Dispatch the next ready build-plan task to a coding agent.\n *\n * ## The chain, and who owns each link\n *\n * | link | owner |\n * |---|---|\n * | which tasks have landed | GIT — a task has landed when the files it produces are committed |\n * | which are READY | `selectReadyBuildPlanTasks` in `_core` — pure, prerequisite-closed |\n * | what a task may touch | `resolveBuildPlanTaskCodingPolicy` — the ONLY place a `target.kind` becomes paths |\n * | the contract | `composeBuildTaskCodingContract` in the runtime — pure, schema-pinned |\n * | the run | `CodingAgentDispatchCompanionService` — mutation lock, git baseline, change-set capture |\n *\n * Nothing in that chain is decided by a model. The agent is handed a task and a boundary; it does not\n * choose either.\n *\n * ## There is no confirmation flag, and that was a correction\n *\n * `dispatchNextBuildTask` ran only when the caller also passed `confirmWorkspaceMutation: true`. It was\n * removed the day it was written, because it protected nothing the mechanism does not already protect:\n * the scope is derived from the task's CLOSED `target.kind` and cannot be widened, the mutation lock\n * admits one workspace-mutating run at a time, the run is bracketed by a git baseline snapshot and a\n * change-set capture so every touched path is visible and revertible, the required checks gate the\n * result, and nothing is ACCEPTED until a human commits.\n *\n * A caller that posts to this route is asking for a coding run — that IS the route. Making them say so\n * twice is the acceptance ceremony this whole migration exists to remove, and a field that feels like a\n * control while enforcing nothing is the exact failure mode recorded in the plan's objective.\n *\n * What was genuinely useful in it — seeing the scope before committing to a run — is a READ, and lives at\n * `describeNextBuildTask` below.\n */\n@injectable()\nexport class ApplicationBuildDispatchCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n public constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.CodingAgentDispatchService) private readonly dispatch: CodingAgentDispatchCompanionService,\n @inject(COMPANION_SERVICE_TYPES.GitChangeSetService) private readonly git: GitChangeSetCompanionService,\n @inject(COMPANION_SERVICE_TYPES.BuildGenerationStepService) private readonly generationSteps: ApplicationBuildGenerationStepCompanionService,\n ) {\n this.logDebug = this.logger.debugByType('ApplicationBuildDispatchCompanionService');\n }\n\n /** What the next run would be, without running it. Pure read — nothing is locked, created or started. */\n public async describeNextBuildTask(input: { readonly maximumTokenBudget?: number } = {}): Promise<ApplicationBuildDispatchPlan> {\n return (await this.prepareNextBuildTask(input)).plan;\n }\n\n /**\n * Run the next ready build-plan task, routed by its own `target.kind`: a coding task goes to the coding\n * agent (bounded by its scope, locked, captured and verified); a companion generation step runs the\n * companion's own pipeline for that step. One route, two executors — the interleaving IS the build loop.\n */\n public async dispatchNextBuildTask(\n input: { readonly maximumTokenBudget?: number } = {},\n session?: CompanionExecutionSessionContext,\n ): Promise<ApplicationBuildDispatchResult> {\n const prepared = await this.prepareNextBuildTask(input);\n if (prepared.kind === 'GENERATION_STEP') {\n this.logDebug('Running a companion generation step', {\n taskRef: prepared.plan.taskRef,\n generationStepRef: prepared.plan.generationStepRef,\n });\n const generationStep = await this.generationSteps.executeGenerationStep(prepared.task, session);\n return { plan: prepared.plan, generationStep };\n }\n this.logDebug('Dispatching a build task to the coding agent', {\n taskRef: prepared.plan.taskRef,\n allowedPathPrefixes: prepared.plan.allowedPathPrefixes,\n });\n const admission = await this.dispatch.runApplicationCodingTask(prepared.contract as ApplicationCodingTaskContract);\n return { plan: prepared.plan, admission };\n }\n\n private async prepareNextBuildTask(input: {\n readonly maximumTokenBudget?: number;\n }): Promise<\n | { readonly kind: 'CODING'; readonly plan: ApplicationBuildDispatchPlan; readonly contract: ReturnType<typeof composeBuildTaskCodingContract> }\n | { readonly kind: 'GENERATION_STEP'; readonly plan: ApplicationBuildDispatchPlan; readonly task: BuildPlanTask }\n > {\n const graph = await this.readBuildPlan();\n const landedTaskRefs = await this.resolveLandedTaskRefs(graph.tasks);\n\n const ready = selectReadyBuildPlanTasks(graph, landedTaskRefs);\n if (ready.length === 0) {\n throw new ApplicationBuildPlanExhaustedError(\n `Every task in the build plan has landed, or none is ready: ${graph.tasks.length} task(s), `\n + `${landedTaskRefs.size} landed.`,\n );\n }\n /*\n * The FIRST ready task, in graph order — routed by its own `target.kind`, never reordered.\n *\n * Deliberately not a choice among the ready set: the graph already encodes the ordering its author\n * intended, and something picking among ready tasks would be a second scheduler disagreeing with the\n * first. (An earlier version skipped generation steps to find a coding task and refused when none\n * remained — correct while no executor existed, a hole in the lane once one did: the first authored\n * generation step parked the Wonder Todos build behind a named 409 forever.)\n */\n const task = ready[0]!;\n if (task.target?.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {\n const evidencePaths = await this.generationSteps.resolveGenerationStepEvidencePaths(task);\n const evidenceRoots = [...new Set(evidencePaths.map((evidencePath) => `${evidencePath.split('/').slice(0, -1).join('/')}/`))].sort();\n const plan: ApplicationBuildDispatchPlan = {\n taskRef: task.taskRef,\n objective: task.objective,\n targetKind: task.target.kind,\n generationStepRef: task.target.generationStepRef,\n allowedPathPrefixes: evidenceRoots,\n prohibitedPathPrefixes: [],\n // The pipelines validate their own output; skills are a coding agent's channel, not this executor's.\n requiredChecks: [],\n installedSkillRefs: [],\n readyTaskRefs: ready.map((entry) => entry.taskRef),\n landedTaskRefs: [...landedTaskRefs].sort(),\n };\n return { kind: 'GENERATION_STEP', plan, task };\n }\n const boundary = resolveBuildPlanTaskCodingPolicy(task as Parameters<typeof resolveBuildPlanTaskCodingPolicy>[0]);\n const contract = composeBuildTaskCodingContract({\n task,\n boundary,\n contextSources: this.buildContextSources(task, graph.tasks.length),\n objectiveRef: 'application-creation:objective/build-plan',\n maximumTokenBudget: input.maximumTokenBudget ?? DEFAULT_CONTEXT_TOKEN_BUDGET,\n });\n\n const plan: ApplicationBuildDispatchPlan = {\n taskRef: task.taskRef,\n objective: task.objective,\n targetKind: task.target!.kind,\n allowedPathPrefixes: contract.mutationScope.allowedPathPrefixes,\n prohibitedPathPrefixes: contract.mutationScope.prohibitedPathPrefixes,\n requiredChecks: contract.verificationIntent.requiredChecks,\n installedSkillRefs: contract.installedSkillRefs,\n readyTaskRefs: ready.map((entry) => entry.taskRef),\n landedTaskRefs: [...landedTaskRefs].sort(),\n };\n\n return { kind: 'CODING', plan, contract };\n }\n\n /**\n * Which tasks have landed, read from GIT.\n *\n * A task has landed when every file it PRODUCES is committed — tracked, and with HEAD, index and worktree\n * in agreement. Not \"the file exists\": an untracked or half-edited file is work in progress, and treating\n * it as landed would let the next task build on something nobody accepted.\n *\n * This replaced a replay of a journal stream that had no writer anywhere, so the answer was permanently\n * \"nothing has landed\" and the loop could never advance past its first task. Git also answers correctly\n * after a restart, on a fresh clone, and on the other side of a branch switch — none of which an\n * in-memory journal can.\n */\n /**\n * How far the current build plan's execution has progressed — the eligibility board's input for the\n * \"plan complete ⇒ re-decompose is sequencing, not a live option\" gate. `undefined` when the\n * application has no (valid) build plan: absence of a plan is not zero-of-zero progress.\n */\n public async resolveBuildExecutionProgress(): Promise<{ readonly totalTasks: number; readonly landedTasks: number } | undefined> {\n let plan: Awaited<ReturnType<typeof this.readBuildPlan>>;\n try {\n plan = await this.readBuildPlan();\n } catch {\n return undefined;\n }\n const landed = await this.resolveLandedTaskRefs(plan.tasks);\n return { totalTasks: plan.tasks.length, landedTasks: landed.size };\n }\n\n private async resolveLandedTaskRefs(tasks: readonly BuildPlanTask[]): Promise<ReadonlySet<string>> {\n const landed = new Set<string>();\n for (const task of tasks) {\n const evidencePaths = task.target?.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP\n // Planner-derived: the exact unit files the step's pipelines write (see that service's JSDoc for\n // why a directory prefix would be dishonest here).\n ? await this.generationSteps.resolveGenerationStepEvidencePaths(task)\n : resolveBuildTaskLandedEvidencePaths(task);\n if (evidencePaths.length === 0) continue;\n const committed = await Promise.all(evidencePaths.map((path) => this.git.isWorktreePathCommitted(path)));\n if (committed.every(Boolean)) landed.add(task.taskRef);\n }\n return landed;\n }\n\n /** The application's accepted build plan, validated before anything is selected from it. */\n private async readBuildPlan(): ReturnType<typeof BuildPlanTaskGraphSchema.parseAsync> {\n const exports = await loadSpecificationsCompanionExports(this.companionContext);\n const authored = (exports as unknown as Record<string, unknown>).buildPlanSpecification;\n if (authored === undefined || authored === null) {\n throw new ApplicationBuildPlanUnavailableError(\n 'This application has no build plan. Run the build-decompose playbook first.',\n );\n }\n const parsed = BuildPlanTaskGraphSchema.safeParse(authored);\n if (!parsed.success) {\n throw new ApplicationBuildPlanUnavailableError(\n `The application's build plan does not satisfy its schema: ${parsed.error.issues.slice(0, 3).map((issue) => `${issue.path.join('.')}: ${issue.message}`).join('; ')}`,\n );\n }\n // Semantic validation too, not just the shape: a graph with a dangling prerequisite would let\n // `selectReadyBuildPlanTasks` report a task ready whose dependency can never land.\n const findings = validateBuildPlanTaskGraph(parsed.data);\n if (findings.length > 0) {\n throw new ApplicationBuildPlanUnavailableError(\n `The application's build plan fails semantic validation: ${findings.slice(0, 3).map((finding) => finding.message).join('; ')}`,\n );\n }\n return parsed.data;\n }\n\n /**\n * What the run is allowed to see.\n *\n * The task itself and its position in the graph, and nothing else yet. Everything here is model-safe by\n * construction — it is the application's own accepted build plan — and widening this is where introspected\n * application reality and the task's skill pointers arrive next.\n */\n private buildContextSources(task: BuildPlanTask, totalTasks: number): readonly BuildTaskContextSource[] {\n return [{\n sourceRef: 'application-creation:context/build-task',\n originRef: 'application-creation:origin/build-plan',\n role: MetaWorkflow_ContextSourceRole.MANDATORY,\n content: {\n taskRef: task.taskRef,\n objective: task.objective,\n target: task.target,\n functionalTopic: task.functionalTopic,\n skillRefs: task.skillRefs,\n prerequisiteTaskRefs: task.prerequisiteTaskRefs,\n positionInPlan: `one of ${totalTasks} tasks in the application's accepted build plan`,\n },\n }];\n }\n}\n\n/** Context ceiling for one dispatch. Stated here because only the host knows what the agent can accept. */\nconst DEFAULT_CONTEXT_TOKEN_BUDGET = 120_000;\n"]}
1
+ {"version":3,"file":"application-build-dispatch.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/application-build-dispatch.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EACL,8BAA8B,EAC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AAiB,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;wBACxE,2BAA2B,EAAE,CAAC,UAAU,EAAE,aAAa,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CACrF,mBAAmB,CAAC,GAAG,CAAC,yBAAyB,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;+BAC/E,mBAAmB,CAAC,GAAG,CAAC,yBAAyB,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC,CAAC;qBACzF;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qDAAqD,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC3H,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAA;AA3fY,wCAAwC;IADpD,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;IAChD,WAAA,MAAM,CAAC,uBAAuB,CAAC,0BAA0B,CAAC,CAAA;IAC1D,WAAA,MAAM,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,CAAA;IACnD,WAAA,MAAM,CAAC,uBAAuB,CAAC,0BAA0B,CAAC,CAAA;IAC1D,WAAA,MAAM,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAA;uDAHkC,mCAAmC;QAC/C,4BAA4B;QACT,8CAA8C;QACtD,6BAA6B;GAT1G,wCAAwC,CA2fpD;;AAED,2GAA2G;AAC3G,MAAM,4BAA4B,GAAG,OAAO,CAAC","sourcesContent":["import { inject, injectable } from 'inversify';\nimport { WorkbenchBuildPlanTaskStatus } from '@wildo-ai/platform-core-shared';\n\nimport {\n composeBuildTaskCodingContract,\n slugifyRegistryIdentifier,\n type BuildTaskContextSource,\n} from '@wildo-ai/application-creation-runtime';\nimport type { LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';\nimport { MetaWorkflow_ContextSourceRole } from '@wildo-ai/saas-models/meta-workflows';\nimport {\n BuildPlanTaskGraphSchema,\n BuildPlanTaskTargetKind,\n selectReadyBuildPlanTasks,\n validateBuildPlanTaskGraph,\n type ApplicationCodingTaskContract,\n type BuildPlanTask,\n} from '@wildo-ai/saas-specifications/application-creation';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { CompanionIntrospectionService } from '../../core/introspection/services/companion-introspection.companion.service';\nimport { loadSpecificationsCompanionExports } from '../../core/context/companion-package-loaders.companion';\nimport { waitForDevCompileQuiet } from '../../core/runtime/dev-compile-quiet.companion';\nimport {\n CodingAgentDispatchCompanionService,\n type ParkedCodingSessionState,\n} from '../../claude-cli/services/coding-agent-dispatch.companion.service';\nimport {\n resolveApplicationCodingTaskVerificationPlans,\n type ApplicationCodingTaskRunAdmission,\n} from '../../claude-cli/models/coding-agent-dispatch.models';\nimport { GitChangeSetCompanionService } from '../../claude-cli/services/git-change-set.companion.service';\nimport type { CompanionExecutionSessionContext } from '../../core/traceability/companion-traceability.models';\nimport {\n ApplicationBuildGenerationStepCompanionService,\n type ApplicationBuildGenerationStepRunResult,\n} from './application-build-generation-step.companion.service';\nimport {\n ApplicationBuildTaskNotACodingTaskError,\n resolveBuildPlanTaskCodingPolicy,\n resolveBuildTaskLandedEvidencePaths,\n} from './application-build-task-coding-policy.companion.service';\n\n/** No build plan, or nothing left to do. Named so the transport can say which. */\n\nexport class ApplicationBuildPlanUnavailableError extends Error {}\nexport class ApplicationBuildPlanExhaustedError extends Error {}\n\n/** What the next dispatch WOULD be. Returned unconfirmed, so a creator sees the scope before anything runs. */\nexport interface ApplicationBuildDispatchPlan {\n readonly taskRef: string;\n readonly objective: string;\n readonly targetKind: string;\n /**\n * Present exactly when the next task is a companion generation step. A build plan INTERLEAVES two\n * executors — coding tasks for a coding agent, and companion generation steps (labels, seeds, emails)\n * the companion runs itself — and this route serves BOTH: `dispatch-next` routes by the task's own\n * `target.kind`. (An earlier version refused generation steps by name; now that an executor exists,\n * the refusal would be a hole in the build lane, not a boundary.)\n */\n readonly generationStepRef?: string;\n readonly allowedPathPrefixes: readonly string[];\n readonly prohibitedPathPrefixes: readonly string[];\n readonly requiredChecks: readonly string[];\n readonly installedSkillRefs: readonly string[];\n readonly readyTaskRefs: readonly string[];\n readonly landedTaskRefs: readonly string[];\n}\n\n/**\n * One dispatched build task's outcome — exactly one of the two executor results is present, matching the\n * plan's `targetKind`. `admission` for a coding run; `generationStep` for a companion generation step.\n */\nexport interface ApplicationBuildDispatchResult {\n readonly plan: ApplicationBuildDispatchPlan;\n readonly admission?: ApplicationCodingTaskRunAdmission;\n readonly generationStep?: ApplicationBuildGenerationStepRunResult;\n}\n\n/**\n * Dispatch the next ready build-plan task to a coding agent.\n *\n * ## The chain, and who owns each link\n *\n * | link | owner |\n * |---|---|\n * | which tasks have landed | GIT — a task has landed when the files it produces are committed |\n * | which are READY | `selectReadyBuildPlanTasks` in `_core` — pure, prerequisite-closed |\n * | what a task may touch | `resolveBuildPlanTaskCodingPolicy` — the ONLY place a `target.kind` becomes paths |\n * | the contract | `composeBuildTaskCodingContract` in the runtime — pure, schema-pinned |\n * | the run | `CodingAgentDispatchCompanionService` — mutation lock, git baseline, change-set capture |\n *\n * Nothing in that chain is decided by a model. The agent is handed a task and a boundary; it does not\n * choose either.\n *\n * ## There is no confirmation flag, and that was a correction\n *\n * `dispatchNextBuildTask` ran only when the caller also passed `confirmWorkspaceMutation: true`. It was\n * removed the day it was written, because it protected nothing the mechanism does not already protect:\n * the scope is derived from the task's CLOSED `target.kind` and cannot be widened, the mutation lock\n * admits one workspace-mutating run at a time, the run is bracketed by a git baseline snapshot and a\n * change-set capture so every touched path is visible and revertible, the required checks gate the\n * result, and nothing is ACCEPTED until a human commits.\n *\n * A caller that posts to this route is asking for a coding run — that IS the route. Making them say so\n * twice is the acceptance ceremony this whole migration exists to remove, and a field that feels like a\n * control while enforcing nothing is the exact failure mode recorded in the plan's objective.\n *\n * What was genuinely useful in it — seeing the scope before committing to a run — is a READ, and lives at\n * `describeNextBuildTask` below.\n */\n@injectable()\nexport class ApplicationBuildDispatchCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n public constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.CodingAgentDispatchService) private readonly dispatch: CodingAgentDispatchCompanionService,\n @inject(COMPANION_SERVICE_TYPES.GitChangeSetService) private readonly git: GitChangeSetCompanionService,\n @inject(COMPANION_SERVICE_TYPES.BuildGenerationStepService) private readonly generationSteps: ApplicationBuildGenerationStepCompanionService,\n @inject(COMPANION_SERVICE_TYPES.IntrospectionService) private readonly introspection: CompanionIntrospectionService,\n ) {\n this.logDebug = this.logger.debugByType('ApplicationBuildDispatchCompanionService');\n }\n\n /** What the next run would be, without running it. Pure read — nothing is locked, created or started. */\n public async describeNextBuildTask(input: { readonly maximumTokenBudget?: number } = {}): Promise<ApplicationBuildDispatchPlan> {\n return (await this.prepareNextBuildTask(input)).plan;\n }\n\n /**\n * Run the next ready build-plan task, routed by its own `target.kind`: a coding task goes to the coding\n * agent (bounded by its scope, locked, captured and verified); a companion generation step runs the\n * companion's own pipeline for that step. One route, two executors — the interleaving IS the build loop.\n */\n /**\n * The last few DETACHED dispatch outcomes, newest first — the observation channel the synchronous\n * door lacked. Measured 2026-09-04: a 40+-minute i18n generation step outlived the HTTP request's\n * 30-minute ceiling, the response died with the socket, and the only signals left were file\n * mtimes and a lock file whose EXISTENCE turned out to mean nothing — the operator was blind for\n * half the run. In-memory by design: the step's real product is files on disk (durable in git),\n * and this record is the run's NARRATIVE, not its truth.\n */\n private readonly lastDetachedDispatches: Array<{\n readonly taskRef: string;\n readonly startedAt: string;\n finishedAt?: string;\n ok?: boolean;\n error?: string;\n }> = [];\n\n public readDetachedDispatches(): readonly { taskRef: string; startedAt: string; finishedAt?: string; ok?: boolean; error?: string }[] {\n return [...this.lastDetachedDispatches];\n }\n\n /**\n * Fire the next ready build task WITHOUT holding an HTTP request over it. Returns the selected\n * plan immediately; the outcome lands in {@link readDetachedDispatches} and, for a coding task,\n * in the durable actor-task row it already writes. The same single-flight properties hold — this\n * is the same `dispatchNextBuildTask`, minus the requirement that a socket survive it.\n */\n public submitBuildDispatchDetached(\n input: { readonly maximumTokenBudget?: number } = {},\n session?: CompanionExecutionSessionContext,\n ): Promise<ApplicationBuildDispatchPlan> {\n return this.prepareNextBuildTask(input).then((prepared) => {\n const record: { taskRef: string; startedAt: string; finishedAt?: string; ok?: boolean; error?: string } = {\n taskRef: prepared.plan.taskRef,\n startedAt: new Date().toISOString(),\n };\n this.lastDetachedDispatches.unshift(record);\n this.lastDetachedDispatches.splice(5);\n void this.dispatchNextBuildTask(input, session)\n .then(() => { record.finishedAt = new Date().toISOString(); record.ok = true; })\n .catch((error) => {\n record.finishedAt = new Date().toISOString(); record.ok = false;\n record.error = error instanceof Error ? error.message.slice(0, 400) : String(error).slice(0, 400);\n this.logDebug('Detached build dispatch failed', { taskRef: record.taskRef, error: record.error });\n });\n return prepared.plan;\n });\n }\n\n public async dispatchNextBuildTask(\n input: { readonly maximumTokenBudget?: number } = {},\n session?: CompanionExecutionSessionContext,\n ): Promise<ApplicationBuildDispatchResult> {\n const prepared = await this.prepareNextBuildTask(input);\n if (prepared.kind === 'GENERATION_STEP') {\n this.logDebug('Running a companion generation step', {\n taskRef: prepared.plan.taskRef,\n generationStepRef: prepared.plan.generationStepRef,\n });\n const generationStep = await this.generationSteps.executeGenerationStep(prepared.task, session);\n return { plan: prepared.plan, generationStep };\n }\n this.logDebug('Dispatching a build task to the coding agent', {\n taskRef: prepared.plan.taskRef,\n allowedPathPrefixes: prepared.plan.allowedPathPrefixes,\n });\n /*\n * The churn gate, and deliberately NOT the retry (#265): a coding turn MUTATES the workspace, so\n * a kill mid-turn leaves a change-set the attribution machinery must reconcile — re-dispatching\n * blind on top of that is how two half-runs interleave. The gate raises the odds the turn never\n * meets the respawn; a killed coding run stays what it is today, a visibly aborted task an\n * operator re-dispatches deliberately.\n */\n await waitForDevCompileQuiet({\n frameworkRepositoryRoot: this.companionContext.resolvedHomes.framework.repositoryRoot,\n log: (message, context) => this.logDebug(message, { taskRef: prepared.plan.taskRef, ...context }),\n });\n const admission = await this.dispatch.runApplicationCodingTask(prepared.contract as ApplicationCodingTaskContract);\n return { plan: prepared.plan, admission };\n }\n\n /**\n * Reconstruct the answerable state for a parked coding task whose IN-PROCESS\n * state was lost to a companion restart, by RE-SELECTING it from the build plan.\n *\n * The durable row still names its build-plan `taskRef` and carries the persisted\n * `suspension`; from those this re-composes the same bounded contract (mutation\n * scope + verification plan come from the task and its coding policy, unchanged\n * by a restart) against a DETERMINISTIC self-description context — the resume\n * discards context anyway, since the agent's persisted session holds the real\n * one. A fresh baseline is captured for the change-set the resume will produce.\n *\n * Returns `null` when the task cannot be answered this way: not a parked coding\n * row, the agent does not support resume, the build task no longer exists, or it\n * is not a coding target. The caller then refuses rather than starting an\n * unrelated or unbounded run.\n */\n public async reconstructParkedCodingTaskForResume(\n taskId: string,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<ParkedCodingSessionState | null> {\n const meta = await this.dispatch.loadPersistedParkedCodingTask(taskId, sessionContext);\n if (!meta || !meta.suspension.resumable) return null;\n\n const graph = await this.readBuildPlan();\n const task = graph.tasks.find((entry) => entry.taskRef === meta.taskRef);\n if (!task || task.target === undefined || task.target.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {\n return null;\n }\n\n let contract: ApplicationCodingTaskContract;\n try {\n const boundary = resolveBuildPlanTaskCodingPolicy(task as Parameters<typeof resolveBuildPlanTaskCodingPolicy>[0]);\n contract = composeBuildTaskCodingContract({\n task,\n boundary,\n // The deterministic self-description only: a resume does not re-send the\n // task prompt, so re-running the full live-query/introspection assembly\n // would spend a model call to build context nothing reads.\n contextSources: [this.buildTaskSelfDescriptionContextSource(task, graph.tasks.length)],\n objectiveRef: 'application-creation:objective/build-plan',\n maximumTokenBudget: DEFAULT_CONTEXT_TOKEN_BUDGET,\n });\n } catch {\n // A task that no longer composes to a bounded run (empty scope, no checks,\n // wrong target) is not answerable — refuse rather than resume unbounded.\n return null;\n }\n\n const verificationPlans = resolveApplicationCodingTaskVerificationPlans(contract.verificationIntent.requiredChecks);\n const baseline = await this.git.captureWorktreeSnapshot();\n return {\n durableTask: meta.durableTask,\n task: contract,\n verificationPlans,\n baseline,\n suspension: meta.suspension,\n parkedAt: new Date().toISOString(),\n };\n }\n\n private async prepareNextBuildTask(input: {\n readonly maximumTokenBudget?: number;\n }): Promise<\n | { readonly kind: 'CODING'; readonly plan: ApplicationBuildDispatchPlan; readonly contract: ReturnType<typeof composeBuildTaskCodingContract> }\n | { readonly kind: 'GENERATION_STEP'; readonly plan: ApplicationBuildDispatchPlan; readonly task: BuildPlanTask }\n > {\n const graph = await this.readBuildPlan();\n const landedTaskRefs = await this.resolveLandedTaskRefs(graph.tasks);\n\n const ready = selectReadyBuildPlanTasks(graph, landedTaskRefs);\n if (ready.length === 0) {\n throw new ApplicationBuildPlanExhaustedError(\n `Every task in the build plan has landed, or none is ready: ${graph.tasks.length} task(s), `\n + `${landedTaskRefs.size} landed.`,\n );\n }\n /*\n * The FIRST ready task, in graph order — routed by its own `target.kind`, never reordered.\n *\n * Deliberately not a choice among the ready set: the graph already encodes the ordering its author\n * intended, and something picking among ready tasks would be a second scheduler disagreeing with the\n * first. (An earlier version skipped generation steps to find a coding task and refused when none\n * remained — correct while no executor existed, a hole in the lane once one did: the first authored\n * generation step parked the Wonder Todos build behind a named 409 forever.)\n */\n const task = ready[0]!;\n if (task.target?.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {\n const evidencePaths = await this.generationSteps.resolveGenerationStepEvidencePaths(task);\n const evidenceRoots = [...new Set(evidencePaths.map((evidencePath) => `${evidencePath.split('/').slice(0, -1).join('/')}/`))].sort();\n const plan: ApplicationBuildDispatchPlan = {\n taskRef: task.taskRef,\n objective: task.objective,\n targetKind: task.target.kind,\n generationStepRef: task.target.generationStepRef,\n allowedPathPrefixes: evidenceRoots,\n prohibitedPathPrefixes: [],\n // The pipelines validate their own output; skills are a coding agent's channel, not this executor's.\n requiredChecks: [],\n installedSkillRefs: [],\n readyTaskRefs: ready.map((entry) => entry.taskRef),\n landedTaskRefs: [...landedTaskRefs].sort(),\n };\n return { kind: 'GENERATION_STEP', plan, task };\n }\n const boundary = resolveBuildPlanTaskCodingPolicy(task as Parameters<typeof resolveBuildPlanTaskCodingPolicy>[0]);\n const contract = composeBuildTaskCodingContract({\n task,\n boundary,\n contextSources: await this.buildContextSources(task, graph.tasks.length),\n objectiveRef: 'application-creation:objective/build-plan',\n maximumTokenBudget: input.maximumTokenBudget ?? DEFAULT_CONTEXT_TOKEN_BUDGET,\n });\n\n const plan: ApplicationBuildDispatchPlan = {\n taskRef: task.taskRef,\n objective: task.objective,\n targetKind: task.target!.kind,\n allowedPathPrefixes: contract.mutationScope.allowedPathPrefixes,\n prohibitedPathPrefixes: contract.mutationScope.prohibitedPathPrefixes,\n requiredChecks: contract.verificationIntent.requiredChecks,\n installedSkillRefs: contract.installedSkillRefs,\n readyTaskRefs: ready.map((entry) => entry.taskRef),\n landedTaskRefs: [...landedTaskRefs].sort(),\n };\n\n return { kind: 'CODING', plan, contract };\n }\n\n /**\n * Which tasks have landed, read from GIT.\n *\n * A task has landed when every file it PRODUCES is committed — tracked, and with HEAD, index and worktree\n * in agreement. Not \"the file exists\": an untracked or half-edited file is work in progress, and treating\n * it as landed would let the next task build on something nobody accepted.\n *\n * This replaced a replay of a journal stream that had no writer anywhere, so the answer was permanently\n * \"nothing has landed\" and the loop could never advance past its first task. Git also answers correctly\n * after a restart, on a fresh clone, and on the other side of a branch switch — none of which an\n * in-memory journal can.\n */\n /**\n * How far the current build plan's execution has progressed — the eligibility board's input for the\n * \"plan complete ⇒ re-decompose is sequencing, not a live option\" gate. `undefined` when the\n * application has no (valid) build plan: absence of a plan is not zero-of-zero progress.\n */\n public async resolveBuildExecutionProgress(): Promise<{ readonly totalTasks: number; readonly landedTasks: number } | undefined> {\n let plan: Awaited<ReturnType<typeof this.readBuildPlan>>;\n try {\n plan = await this.readBuildPlan();\n } catch {\n return undefined;\n }\n const landed = await this.resolveLandedTaskRefs(plan.tasks);\n return { totalTasks: plan.tasks.length, landedTasks: landed.size };\n }\n\n /**\n * Every build-plan task in the DISPATCH view — the creation board's `workbenchBuildPlanTasks`\n * rows (`workbench-creation-board-resources.md`, Phase 2).\n *\n * `status` is computed per read, never stored: `landed` = the task's evidence paths are all\n * committed (the same resolution the dispatcher itself selects by), `ready` = every prerequisite\n * landed and it has not, `blocked` = otherwise. Exactly one holds.\n *\n * An application with NO authored build plan answers ZERO TASKS rather than throwing: the plan\n * file legitimately does not exist until build-decompose runs, so \"nothing there yet\" is the\n * true answer. Absence is tested DIRECTLY (the exports carry no `buildPlanSpecification`) rather\n * than by catching `ApplicationBuildPlanUnavailableError`, because `readBuildPlan` throws that\n * SAME class for a plan that exists and fails schema or semantic validation — and flattening an\n * invalid plan into an empty board would be \"could not look\" wearing \"nothing there\".\n */\n public async describeBuildPlanBoard(): Promise<readonly {\n readonly taskRef: string;\n readonly objective: string;\n readonly targetKind: string;\n readonly functionalTopic: string;\n readonly status: WorkbenchBuildPlanTaskStatus;\n readonly prerequisiteTaskRefs: readonly string[];\n }[]> {\n const exports = await loadSpecificationsCompanionExports(this.companionContext);\n const authored = (exports as unknown as Record<string, unknown>).buildPlanSpecification;\n if (authored === undefined || authored === null) return [];\n\n const plan = await this.readBuildPlan();\n const landed = await this.resolveLandedTaskRefs(plan.tasks);\n const ready = new Set(selectReadyBuildPlanTasks(plan, landed).map((task) => task.taskRef));\n return plan.tasks.map((task) => ({\n taskRef: task.taskRef,\n objective: task.objective,\n targetKind: String(task.target?.kind ?? ''),\n functionalTopic: String(task.functionalTopic),\n status: landed.has(task.taskRef) ? WorkbenchBuildPlanTaskStatus.LANDED\n : ready.has(task.taskRef) ? WorkbenchBuildPlanTaskStatus.READY\n : WorkbenchBuildPlanTaskStatus.BLOCKED,\n prerequisiteTaskRefs: task.prerequisiteTaskRefs,\n }));\n }\n\n private async resolveLandedTaskRefs(tasks: readonly BuildPlanTask[]): Promise<ReadonlySet<string>> {\n const landed = new Set<string>();\n for (const task of tasks) {\n const evidencePaths = task.target?.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP\n // Planner-derived: the exact unit files the step's pipelines write (see that service's JSDoc for\n // why a directory prefix would be dishonest here).\n ? await this.generationSteps.resolveGenerationStepEvidencePaths(task)\n : resolveBuildTaskLandedEvidencePaths(task);\n if (evidencePaths.length === 0) continue;\n const committed = await Promise.all(evidencePaths.map((path) => this.git.isWorktreePathCommitted(path)));\n if (committed.every(Boolean)) landed.add(task.taskRef);\n }\n return landed;\n }\n\n /** The application's accepted build plan, validated before anything is selected from it. */\n private async readBuildPlan(): ReturnType<typeof BuildPlanTaskGraphSchema.parseAsync> {\n const exports = await loadSpecificationsCompanionExports(this.companionContext);\n const authored = (exports as unknown as Record<string, unknown>).buildPlanSpecification;\n if (authored === undefined || authored === null) {\n throw new ApplicationBuildPlanUnavailableError(\n 'This application has no build plan. Run the build-decompose playbook first.',\n );\n }\n const parsed = BuildPlanTaskGraphSchema.safeParse(authored);\n if (!parsed.success) {\n throw new ApplicationBuildPlanUnavailableError(\n `The application's build plan does not satisfy its schema: ${parsed.error.issues.slice(0, 3).map((issue) => `${issue.path.join('.')}: ${issue.message}`).join('; ')}`,\n );\n }\n // Semantic validation too, not just the shape: a graph with a dangling prerequisite would let\n // `selectReadyBuildPlanTasks` report a task ready whose dependency can never land.\n const findings = validateBuildPlanTaskGraph(parsed.data);\n if (findings.length > 0) {\n throw new ApplicationBuildPlanUnavailableError(\n `The application's build plan fails semantic validation: ${findings.slice(0, 3).map((finding) => finding.message).join('; ')}`,\n );\n }\n return parsed.data;\n }\n\n /**\n * What the run is allowed to see — the PUSH floor of the dispatch lane's context (issue #253).\n *\n * Widened 2026-09-02 from \"the task itself and nothing else yet\" to the lean mandatory core the\n * epic's re-analysis decided, and deliberately no further: everything an agent might need beyond\n * its target's blast radius is the PULL door's job (`wildo context …`, issue #252), which the\n * `live-queries` source below points at. Anticipating everything here would be the planner trap\n * (#254) re-entering through the push door. Everything is model-safe by construction — the\n * application's own accepted build plan, its own live registry, its own domain plan — and the\n * contract's composer re-asserts `SAFE_FOR_MODEL` on every source regardless.\n *\n * ## Failure posture: best-effort on the derived sources, deliberately\n *\n * The playbook lane's workspace-truth section fails CLOSED, because a tool-less planner with no\n * workspace truth invents module ids. A CODING agent is the opposite case on both counts: it has\n * tools (it can read the tree, and the door), so a missing derived source degrades speed rather\n * than truth — while refusing the dispatch because a subprocess hiccuped would block the build on\n * context the run could recover for itself. So: the TASK is always present, the derived sources\n * are added when their reads succeed, and a failed read is a WARN naming what was omitted.\n *\n * ## No new cache, verified rather than assumed\n *\n * The re-analysis asked for the introspection read to be cached across a 55-task plan. It already\n * is: `CompanionIntrospectionService.requestInfo` carries its own source-state derivation cache,\n * keyed on the observed workspace state — asking again after nothing changed is a cache hit, and\n * a landed task invalidates it by changing the sources it hashes. Adding a second cache here would\n * be a copy that can only ever disagree.\n */\n /**\n * The task's own DETERMINISTIC self-description — no introspection, no LLM.\n *\n * The first (and mandatory) context source of every coding task, extracted so\n * a RESUME can rebuild a schema-valid contract without re-running the expensive\n * live-query / module-introspection assembly whose output a resume discards\n * anyway (the agent's session already holds the real context).\n */\n private buildTaskSelfDescriptionContextSource(task: BuildPlanTask, totalTasks: number): BuildTaskContextSource {\n return {\n sourceRef: 'application-creation:context/build-task',\n originRef: 'application-creation:origin/build-plan',\n role: MetaWorkflow_ContextSourceRole.MANDATORY,\n content: {\n taskRef: task.taskRef,\n objective: task.objective,\n target: task.target,\n functionalTopic: task.functionalTopic,\n skillRefs: task.skillRefs,\n prerequisiteTaskRefs: task.prerequisiteTaskRefs,\n positionInPlan: `one of ${totalTasks} tasks in the application's accepted build plan`,\n },\n };\n }\n\n private async buildContextSources(task: BuildPlanTask, totalTasks: number): Promise<readonly BuildTaskContextSource[]> {\n const sources: BuildTaskContextSource[] = [this.buildTaskSelfDescriptionContextSource(task, totalTasks)];\n\n /*\n * The DOOR MENU — tier-0 of the pull half: the live-query ids and the two commands that expand\n * them. Ids only, not descriptions: `wildo context list` IS the descriptions, one command away,\n * and rendering ~27 descriptions into every dispatch prompt would spend the budget this source\n * exists to save. Read from the same catalog the CLI menu serves, so it cannot drift from what\n * the companion actually answers.\n */\n const catalog = this.introspection.describeCatalog();\n sources.push({\n sourceRef: 'application-creation:context/live-queries',\n originRef: 'application-creation:origin/dev-companion',\n role: MetaWorkflow_ContextSourceRole.MANDATORY,\n content: {\n guidance: 'Live application state is one shell command away — prefer asking over re-deriving from the tree. '\n + '`wildo context list` prints the menu with descriptions; `wildo context info <behaviorId>` runs one query; '\n + '`wildo context journey` shows the creation journey; `wildo context coherence` the cross-family coherence report.',\n behaviorIds: catalog.behaviors.map((behavior) => behavior.behaviorId),\n },\n });\n\n const moduleRef = task.target && 'moduleRef' in task.target ? task.target.moduleRef : undefined;\n const resourceRef = task.target && 'resourceRef' in task.target ? task.target.resourceRef : undefined;\n\n // WORKSPACE TRUTH, sliced to the target: the target module's real resources and present schema\n // fields, plus the exact list of every module id (counts stay exact — a slice that hid the\n // population would under-report, and an agent that invents a module id dispatches a no-op).\n try {\n const backendServiceKey = Object.entries(this.companionContext.servicesByKey)\n .find(([, service]) => !service.frontendType)?.[0];\n if (backendServiceKey) {\n const result = await this.introspection.requestInfo({ serviceKey: backendServiceKey, behavior: 'resources-registry' });\n if (result.success) {\n const snapshot = result.data as {\n modules?: ReadonlyArray<{ moduleId: string; resourceTypes: readonly string[] }>;\n resourceSchemaFields?: Record<string, readonly string[]>;\n };\n const modules = snapshot.modules ?? [];\n const targetModule = moduleRef === undefined\n ? undefined\n : modules.find((sharedModule) => slugifyRegistryIdentifier(sharedModule.moduleId) === moduleRef);\n sources.push({\n sourceRef: 'application-creation:context/workspace-truth',\n originRef: 'application-creation:origin/resources-registry-introspection',\n role: MetaWorkflow_ContextSourceRole.MANDATORY,\n content: {\n allModuleIds: modules.map((sharedModule) => sharedModule.moduleId),\n ...(targetModule\n ? {\n targetModule: {\n moduleId: targetModule.moduleId,\n resources: targetModule.resourceTypes.map((resourceType) => ({\n resourceType,\n slugRef: slugifyRegistryIdentifier(resourceType),\n presentSchemaFields: snapshot.resourceSchemaFields?.[resourceType] ?? [],\n })),\n },\n }\n : {}),\n note: 'A resource listed here already EXISTS as a registered skeleton — its task is enrichment, not creation. '\n + 'A domain-plan resource NOT listed here does not exist yet. Full registry: `wildo context info resources-registry`.',\n },\n });\n } else {\n this.logDebug('Workspace-truth source omitted from the dispatch context (introspection failed)', { taskRef: task.taskRef });\n }\n }\n } catch (error) {\n this.logger.warn('Workspace-truth source omitted from the dispatch context', { taskRef: task.taskRef, error: String(error) });\n }\n\n // THE DOMAIN-PLAN SLICE for the target: WHAT this task's objective enriches toward, in the\n // application's own accepted words — the module semantics and, for a relationship task, the\n // relationship drafts touching the target. Absent plan (older app, or foundation not run) is\n // simply absent; nothing here invents a fallback.\n try {\n const exports = await loadSpecificationsCompanionExports(this.companionContext);\n const domainPlan = (exports as { domainPlanSpecification?: unknown }).domainPlanSpecification as {\n modules?: ReadonlyArray<{ relatedModuleId: string; mainResources?: readonly string[]; supportingResources?: readonly string[] }>;\n relationships?: ReadonlyArray<{ relationshipRef: string; sourceResourceRef: string; targetResourceRef: string }>;\n } | undefined;\n const planModules = domainPlan?.modules ?? [];\n const targetPlanModule = moduleRef === undefined\n ? undefined\n : planModules.find((planModule) => slugifyRegistryIdentifier(planModule.relatedModuleId) === moduleRef);\n if (targetPlanModule) {\n const moduleResourceSlugs = new Set(\n [...(targetPlanModule.mainResources ?? []), ...(targetPlanModule.supportingResources ?? [])]\n .map((resourceType) => slugifyRegistryIdentifier(resourceType)),\n );\n sources.push({\n sourceRef: 'application-creation:context/domain-plan-slice',\n originRef: 'application-creation:origin/domain-plan',\n role: MetaWorkflow_ContextSourceRole.MANDATORY,\n content: {\n targetModule: targetPlanModule,\n ...(resourceRef !== undefined ? { targetResourceRef: resourceRef } : {}),\n relationshipsTouchingModule: (domainPlan?.relationships ?? []).filter((relationship) =>\n moduleResourceSlugs.has(slugifyRegistryIdentifier(relationship.sourceResourceRef))\n || moduleResourceSlugs.has(slugifyRegistryIdentifier(relationship.targetResourceRef))),\n },\n });\n }\n } catch (error) {\n this.logger.warn('Domain-plan slice omitted from the dispatch context', { taskRef: task.taskRef, error: String(error) });\n }\n\n return sources;\n }\n}\n\n/** Context ceiling for one dispatch. Stated here because only the host knows what the agent can accept. */\nconst DEFAULT_CONTEXT_TOKEN_BUDGET = 120_000;\n"]}