@wildo-ai/dev-companion 1.1.1 → 1.1.3

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 (212) 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 +408 -38
  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 +70 -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 +110 -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 +62 -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 +295 -19
  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 +243 -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 +370 -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 +40 -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 +126 -0
  82. package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js.map +1 -0
  83. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts +51 -0
  84. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts.map +1 -0
  85. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js +391 -0
  86. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js.map +1 -0
  87. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts +103 -0
  88. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts.map +1 -0
  89. package/dist/esm/core/runtime/dev-compile-quiet.companion.js +124 -0
  90. package/dist/esm/core/runtime/dev-compile-quiet.companion.js.map +1 -0
  91. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts +39 -2
  92. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
  93. package/dist/esm/core/runtime/services/start-companion-application.service.js +122 -11
  94. package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
  95. package/dist/esm/core/specifications/non-composite-view-specification-context.shared.d.ts +6 -0
  96. package/dist/esm/core/specifications/non-composite-view-specification-context.shared.d.ts.map +1 -1
  97. package/dist/esm/core/specifications/non-composite-view-specification-context.shared.js.map +1 -1
  98. package/dist/esm/core/specifications/specification-context-factory.shared.d.ts +23 -0
  99. package/dist/esm/core/specifications/specification-context-factory.shared.d.ts.map +1 -1
  100. package/dist/esm/core/specifications/specification-context-factory.shared.js +26 -4
  101. package/dist/esm/core/specifications/specification-context-factory.shared.js.map +1 -1
  102. package/dist/esm/executions/services/companion-executions.companion.service.d.ts.map +1 -1
  103. package/dist/esm/executions/services/companion-executions.companion.service.js +13 -8
  104. package/dist/esm/executions/services/companion-executions.companion.service.js.map +1 -1
  105. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.d.ts +12 -0
  106. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.d.ts.map +1 -0
  107. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.js +12 -0
  108. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.js.map +1 -0
  109. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.d.ts +1 -1
  110. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.js +1 -1
  111. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.js.map +1 -1
  112. package/dist/esm/i18n/composite_views/app.creation-board.en.d.ts +13 -0
  113. package/dist/esm/i18n/composite_views/app.creation-board.en.d.ts.map +1 -0
  114. package/dist/esm/i18n/composite_views/app.creation-board.en.js +91 -0
  115. package/dist/esm/i18n/composite_views/app.creation-board.en.js.map +1 -0
  116. package/dist/esm/i18n/composite_views/app.domain-model.en.d.ts +38 -0
  117. package/dist/esm/i18n/composite_views/app.domain-model.en.d.ts.map +1 -0
  118. package/dist/esm/i18n/composite_views/app.domain-model.en.js +41 -0
  119. package/dist/esm/i18n/composite_views/app.domain-model.en.js.map +1 -0
  120. package/dist/esm/i18n/index.d.ts +3 -3
  121. package/dist/esm/i18n/index.js +3 -3
  122. package/dist/esm/i18n/index.js.map +1 -1
  123. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.d.ts +24 -0
  124. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.d.ts.map +1 -0
  125. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.js +20 -0
  126. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.js.map +1 -0
  127. package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.d.ts +31 -0
  128. package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.d.ts.map +1 -0
  129. package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.js +27 -0
  130. package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.js.map +1 -0
  131. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.d.ts +24 -0
  132. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.d.ts.map +1 -0
  133. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.js +20 -0
  134. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.js.map +1 -0
  135. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts +28 -0
  136. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts.map +1 -0
  137. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js +24 -0
  138. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js.map +1 -0
  139. package/dist/esm/i18n/resources/workbenchDomainResources.en.d.ts +138 -0
  140. package/dist/esm/i18n/resources/workbenchDomainResources.en.d.ts.map +1 -0
  141. package/dist/esm/i18n/resources/workbenchDomainResources.en.js +100 -0
  142. package/dist/esm/i18n/resources/workbenchDomainResources.en.js.map +1 -0
  143. package/dist/esm/i18n/resources/workbenchPlaybooks.en.d.ts +29 -0
  144. package/dist/esm/i18n/resources/workbenchPlaybooks.en.d.ts.map +1 -0
  145. package/dist/esm/i18n/resources/workbenchPlaybooks.en.js +25 -0
  146. package/dist/esm/i18n/resources/workbenchPlaybooks.en.js.map +1 -0
  147. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.d.ts +27 -0
  148. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.d.ts.map +1 -0
  149. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.js +23 -0
  150. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.js.map +1 -0
  151. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +806 -0
  152. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -0
  153. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +326 -0
  154. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -0
  155. package/dist/esm/i18n/resources/workbenchTraceSessions.en.d.ts +26 -0
  156. package/dist/esm/i18n/resources/workbenchTraceSessions.en.d.ts.map +1 -0
  157. package/dist/esm/i18n/resources/workbenchTraceSessions.en.js +22 -0
  158. package/dist/esm/i18n/resources/workbenchTraceSessions.en.js.map +1 -0
  159. package/dist/esm/i18n/system_enums/market.en.d.ts +202 -0
  160. package/dist/esm/i18n/system_enums/market.en.d.ts.map +1 -0
  161. package/dist/esm/i18n/system_enums/market.en.js +209 -0
  162. package/dist/esm/i18n/system_enums/market.en.js.map +1 -0
  163. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts +31 -0
  164. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts.map +1 -1
  165. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js +91 -8
  166. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js.map +1 -1
  167. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts +4 -2
  168. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts.map +1 -1
  169. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js +10 -7
  170. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js.map +1 -1
  171. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +80 -7
  172. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  173. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +261 -24
  174. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  175. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +46 -3
  176. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
  177. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +95 -2
  178. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
  179. package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.d.ts +9 -0
  180. package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.d.ts.map +1 -1
  181. package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.js +13 -0
  182. package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.js.map +1 -1
  183. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts +12 -0
  184. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts.map +1 -1
  185. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js +23 -0
  186. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js.map +1 -1
  187. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +113 -1
  188. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
  189. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +517 -54
  190. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  191. package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.d.ts +40 -0
  192. package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.d.ts.map +1 -1
  193. package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.js +63 -1
  194. package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.js.map +1 -1
  195. package/dist/esm/technical-doc/services/technical-doc.companion.service.d.ts +21 -0
  196. package/dist/esm/technical-doc/services/technical-doc.companion.service.d.ts.map +1 -1
  197. package/dist/esm/technical-doc/services/technical-doc.companion.service.js +84 -2
  198. package/dist/esm/technical-doc/services/technical-doc.companion.service.js.map +1 -1
  199. package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.d.ts +10 -1
  200. package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.d.ts.map +1 -1
  201. package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js +10 -1
  202. package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js.map +1 -1
  203. package/package.json +17 -17
  204. package/dist/esm/.builder.pid +0 -9
  205. package/dist/esm/i18n/resources/workbenchApplicationModules.en.d.ts +0 -36
  206. package/dist/esm/i18n/resources/workbenchApplicationModules.en.d.ts.map +0 -1
  207. package/dist/esm/i18n/resources/workbenchApplicationModules.en.js +0 -32
  208. package/dist/esm/i18n/resources/workbenchApplicationModules.en.js.map +0 -1
  209. package/dist/esm/i18n/resources/workbenchResourceRelationships.en.d.ts +0 -29
  210. package/dist/esm/i18n/resources/workbenchResourceRelationships.en.d.ts.map +0 -1
  211. package/dist/esm/i18n/resources/workbenchResourceRelationships.en.js +0 -25
  212. package/dist/esm/i18n/resources/workbenchResourceRelationships.en.js.map +0 -1
@@ -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,4BAA4B,CAAC;AAChE,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,E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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,EAC9B,yBAAyB,GAE1B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,8BAA8B,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,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;AA3cY,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,CA2cpD;;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 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"]}
@@ -5,6 +5,8 @@ import { LabellingPlannerCompanionService } from '../../i18n-labelling/services/
5
5
  import { LabellizeOrchestratorCompanionService, type LabellizeRunResult } from '../../i18n-labelling/services/labellize-orchestrator.companion.service';
6
6
  import { TranslateOrchestratorCompanionService, type TranslateRunResult } from '../../i18n-labelling/services/translate-orchestrator.companion.service';
7
7
  import { EmailTemplateCompanionService, type GenerateEmailTemplatesResult, type TranslateEmailTemplateLabelsResult } from '../../email/services/email-template.companion.service';
8
+ import { LogoDeliberationCompanionService, type LogoDeliberationResult } from '../../brand/services/logo-deliberation.companion.service';
9
+ import { BrandAcceptCompanionService, type BrandAcceptResult } from '../../brand/services/brand-accept.companion.service';
8
10
  import type { CompanionExecutionSessionContext } from '../../core/traceability/companion-traceability.models';
9
11
  /**
10
12
  * The companion generation steps this host can EXECUTE.
@@ -24,7 +26,18 @@ import type { CompanionExecutionSessionContext } from '../../core/traceability/c
24
26
  */
25
27
  export declare enum ApplicationBuildGenerationStep {
26
28
  I18N_LABELS = "i18n-labels",
27
- EMAIL_TEMPLATES = "email-templates"
29
+ EMAIL_TEMPLATES = "email-templates",
30
+ /**
31
+ * The brand mark: an expert panel derives creative directions, images are generated, a vision
32
+ * judge scores them, and the winner is promoted into the specifications SSOT.
33
+ *
34
+ * Added under the rule this enum's docblock states — a value joins WHEN a pipeline exists to
35
+ * execute it. That pipeline was fully built and reachable only by a human issuing
36
+ * `POST /brand/{generate,deliberate,accept}-logo`, so an application could acquire a considered
37
+ * mark only if someone drove it by hand (issue #220). Hand-supplying a logo stays available and
38
+ * unchanged; what this adds is the journey's own path to one.
39
+ */
40
+ LOGO = "logo"
28
41
  }
29
42
  /** A build plan referenced a generation step this companion cannot execute. Named, so the plan author sees the vocabulary. */
30
43
  export declare class ApplicationBuildUnknownGenerationStepError extends Error {
@@ -50,8 +63,26 @@ export interface ApplicationBuildEmailTemplatesStepRunResult {
50
63
  /** The app-root-relative files this step is responsible for — the same paths the landed check reads. */
51
64
  readonly evidencePaths: readonly string[];
52
65
  }
66
+ /**
67
+ * What one executed logo step did.
68
+ *
69
+ * `deliberation`/`accept` are absent when the step was SKIPPED because the application already has
70
+ * an accepted mark — see the executor for why skipping is the incremental answer here rather than
71
+ * the freshness lock the text pipelines use.
72
+ */
73
+ export interface ApplicationBuildLogoStepRunResult {
74
+ readonly generationStepRef: ApplicationBuildGenerationStep.LOGO;
75
+ /** The expert-panel deliberation that derived directions, generated marks and picked a winner. */
76
+ readonly deliberation?: LogoDeliberationResult;
77
+ /** Promotion of that winner into `specifications/src/brand/` — images plus the rewritten SSOT. */
78
+ readonly accept?: BrandAcceptResult;
79
+ /** True when an accepted mark already existed and no model was called. */
80
+ readonly skippedBecauseAlreadyAccepted: boolean;
81
+ /** The app-root-relative files this step is responsible for — the same paths the landed check reads. */
82
+ readonly evidencePaths: readonly string[];
83
+ }
53
84
  /** One executed generation step's result, discriminated by the step it ran. */
54
- export type ApplicationBuildGenerationStepRunResult = ApplicationBuildI18nLabelsStepRunResult | ApplicationBuildEmailTemplatesStepRunResult;
85
+ export type ApplicationBuildGenerationStepRunResult = ApplicationBuildI18nLabelsStepRunResult | ApplicationBuildEmailTemplatesStepRunResult | ApplicationBuildLogoStepRunResult;
55
86
  /**
56
87
  * Execute companion-owned generation steps of a build plan, and answer which
57
88
  * files each step is responsible for.
@@ -84,8 +115,10 @@ export declare class ApplicationBuildGenerationStepCompanionService {
84
115
  private readonly labellize;
85
116
  private readonly translate;
86
117
  private readonly emailTemplates;
118
+ private readonly logoDeliberation;
119
+ private readonly brandAccept;
87
120
  private readonly logDebug;
88
- constructor(logger: LoggerService, appConfigService: AppConfigurationService, companionContext: CompanionContext, planner: LabellingPlannerCompanionService, labellize: LabellizeOrchestratorCompanionService, translate: TranslateOrchestratorCompanionService, emailTemplates: EmailTemplateCompanionService);
121
+ constructor(logger: LoggerService, appConfigService: AppConfigurationService, companionContext: CompanionContext, planner: LabellingPlannerCompanionService, labellize: LabellizeOrchestratorCompanionService, translate: TranslateOrchestratorCompanionService, emailTemplates: EmailTemplateCompanionService, logoDeliberation: LogoDeliberationCompanionService, brandAccept: BrandAcceptCompanionService);
89
122
  /**
90
123
  * The app-root-relative files this task's generation step is responsible
91
124
  * for. The landed check treats the task as landed when EVERY one of them is
@@ -99,6 +132,16 @@ export declare class ApplicationBuildGenerationStepCompanionService {
99
132
  * an already-satisfied step costs a plan read, not a model call.
100
133
  */
101
134
  executeGenerationStep(task: BuildPlanTask, session?: CompanionExecutionSessionContext): Promise<ApplicationBuildGenerationStepRunResult>;
135
+ /**
136
+ * Does this application already carry an accepted brand mark?
137
+ *
138
+ * Presence of the SSOT module is the whole test. It is written only by a promotion, so its
139
+ * existence means a winner was chosen — and its ABSENCE is what makes the step run. Reading the
140
+ * module's contents to count assets was considered and rejected: it would need the specifications
141
+ * package evaluated, which is a far heavier question than "has this step ever succeeded", and the
142
+ * landed check next door already keys on the same file.
143
+ */
144
+ private hasAcceptedBrandMark;
102
145
  private requireGenerationStepRef;
103
146
  /**
104
147
  * The locales this application ENABLES — `appPreferences.languages.enabledLanguages`,
@@ -1 +1 @@
1
- {"version":3,"file":"application-build-generation-step.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/application-build-generation-step.companion.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGzF,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,oDAAoD,CAAC;AAGjH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,EAAE,gCAAgC,EAAE,MAAM,mEAAmE,CAAC;AACrH,OAAO,EACL,qCAAqC,EACrC,KAAK,kBAAkB,EACxB,MAAM,wEAAwE,CAAC;AAChF,OAAO,EACL,qCAAqC,EACrC,KAAK,kBAAkB,EACxB,MAAM,wEAAwE,CAAC;AAChF,OAAO,EACL,6BAA6B,EAC7B,KAAK,4BAA4B,EACjC,KAAK,kCAAkC,EACxC,MAAM,uDAAuD,CAAC;AAC/D,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,uDAAuD,CAAC;AAE9G;;;;;;;;;;;;;;;GAeG;AACH,oBAAY,8BAA8B;IACxC,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;CACpC;AAED,8HAA8H;AAC9H,qBAAa,0CAA2C,SAAQ,KAAK;gBAChD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM;CAM9D;AAED,mFAAmF;AACnF,MAAM,WAAW,uCAAuC;IACtD,QAAQ,CAAC,iBAAiB,EAAE,8BAA8B,CAAC,WAAW,CAAC;IACvE,qGAAqG;IACrG,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,uGAAuG;IACvG,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC;IACxC,wGAAwG;IACxG,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C;AAED,uFAAuF;AACvF,MAAM,WAAW,2CAA2C;IAC1D,QAAQ,CAAC,iBAAiB,EAAE,8BAA8B,CAAC,eAA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service.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/application-build-generation-step.companion.service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGzF,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,oDAAoD,CAAC;AAGjH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,EAAE,gCAAgC,EAAE,MAAM,mEAAmE,CAAC;AACrH,OAAO,EACL,qCAAqC,EACrC,KAAK,kBAAkB,EACxB,MAAM,wEAAwE,CAAC;AAChF,OAAO,EACL,qCAAqC,EACrC,KAAK,kBAAkB,EACxB,MAAM,wEAAwE,CAAC;AAChF,OAAO,EACL,6BAA6B,EAC7B,KAAK,4BAA4B,EACjC,KAAK,kCAAkC,EACxC,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EACL,gCAAgC,EAChC,KAAK,sBAAsB,EAC5B,MAAM,0DAA0D,CAAC;AAClE,OAAO,EACL,2BAA2B,EAC3B,KAAK,iBAAiB,EACvB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,uDAAuD,CAAC;AAE9G;;;;;;;;;;;;;;;GAeG;AACH,oBAAY,8BAA8B;IACxC,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC;;;;;;;;;OASG;IACH,IAAI,SAAS;CACd;AAUD,8HAA8H;AAC9H,qBAAa,0CAA2C,SAAQ,KAAK;gBAChD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM;CAM9D;AAED,mFAAmF;AACnF,MAAM,WAAW,uCAAuC;IACtD,QAAQ,CAAC,iBAAiB,EAAE,8BAA8B,CAAC,WAAW,CAAC;IACvE,qGAAqG;IACrG,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,uGAAuG;IACvG,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB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ACtC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAXlF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+D;gBAGlC,MAAM,EAAE,aAAa,EACX,gBAAgB,EAAE,uBAAuB,EACpC,gBAAgB,EAAE,gBAAgB,EAC3B,OAAO,EAAE,gCAAgC,EACpC,SAAS,EAAE,qCAAqC,EAChD,SAAS,EAAE,qCAAqC,EACxD,cAAc,EAAE,6BAA6B,EAC1C,gBAAgB,EAAE,gCAAgC,EACvD,WAAW,EAAE,2BAA2B;IAK/G;;;;;OAKG;IACU,kCAAkC,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;IAiChG;;;;OAIG;IACU,qBAAqB,CAChC,IAAI,EAAE,aAAa,EACnB,OAAO,CAAC,EAAE,gCAAgC,GACzC,OAAO,CAAC,uCAAuC,CAAC;IA8EnD;;;;;;;;OAQG;YACW,oBAAoB;IAgBlC,OAAO,CAAC,wBAAwB;IAQhC;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAa7B,gHAAgH;IAChH,OAAO,CAAC,uBAAuB;CAOhC"}
@@ -11,6 +11,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
11
  return function (target, key) { decorator(target, key, paramIndex); }
12
12
  };
13
13
  import * as path from 'node:path';
14
+ import { stat } from 'node:fs/promises';
14
15
  import { inject, injectable } from 'inversify';
15
16
  import { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';
16
17
  import { AvailableLanguage } from '@wildo-ai/presets-components-models';
@@ -21,6 +22,8 @@ import { LabellingPlannerCompanionService } from '../../i18n-labelling/services/
21
22
  import { LabellizeOrchestratorCompanionService, } from '../../i18n-labelling/services/labellize-orchestrator.companion.service.js';
22
23
  import { TranslateOrchestratorCompanionService, } from '../../i18n-labelling/services/translate-orchestrator.companion.service.js';
23
24
  import { EmailTemplateCompanionService, } from '../../email/services/email-template.companion.service.js';
25
+ import { LogoDeliberationCompanionService, } from '../../brand/services/logo-deliberation.companion.service.js';
26
+ import { BrandAcceptCompanionService, } from '../../brand/services/brand-accept.companion.service.js';
24
27
  /**
25
28
  * The companion generation steps this host can EXECUTE.
26
29
  *
@@ -41,7 +44,25 @@ export var ApplicationBuildGenerationStep;
41
44
  (function (ApplicationBuildGenerationStep) {
42
45
  ApplicationBuildGenerationStep["I18N_LABELS"] = "i18n-labels";
43
46
  ApplicationBuildGenerationStep["EMAIL_TEMPLATES"] = "email-templates";
47
+ /**
48
+ * The brand mark: an expert panel derives creative directions, images are generated, a vision
49
+ * judge scores them, and the winner is promoted into the specifications SSOT.
50
+ *
51
+ * Added under the rule this enum's docblock states — a value joins WHEN a pipeline exists to
52
+ * execute it. That pipeline was fully built and reachable only by a human issuing
53
+ * `POST /brand/{generate,deliberate,accept}-logo`, so an application could acquire a considered
54
+ * mark only if someone drove it by hand (issue #220). Hand-supplying a logo stays available and
55
+ * unchanged; what this adds is the journey's own path to one.
56
+ */
57
+ ApplicationBuildGenerationStep["LOGO"] = "logo";
44
58
  })(ApplicationBuildGenerationStep || (ApplicationBuildGenerationStep = {}));
59
+ /**
60
+ * The SSOT module `brand-accept` rewrites when it promotes a winner.
61
+ *
62
+ * Restated here rather than imported because it is a module-private constant of the brand service;
63
+ * the two must agree, and the pin in this lane's tests is what says so.
64
+ */
65
+ const BRAND_RESOLVED_ASSETS_MODULE = 'resolved-assets.generated.ts';
45
66
  /** A build plan referenced a generation step this companion cannot execute. Named, so the plan author sees the vocabulary. */
46
67
  export class ApplicationBuildUnknownGenerationStepError extends Error {
47
68
  constructor(taskRef, generationStepRef) {
@@ -81,8 +102,10 @@ let ApplicationBuildGenerationStepCompanionService = class ApplicationBuildGener
81
102
  labellize;
82
103
  translate;
83
104
  emailTemplates;
105
+ logoDeliberation;
106
+ brandAccept;
84
107
  logDebug;
85
- constructor(logger, appConfigService, companionContext, planner, labellize, translate, emailTemplates) {
108
+ constructor(logger, appConfigService, companionContext, planner, labellize, translate, emailTemplates, logoDeliberation, brandAccept) {
86
109
  this.logger = logger;
87
110
  this.appConfigService = appConfigService;
88
111
  this.companionContext = companionContext;
@@ -90,6 +113,8 @@ let ApplicationBuildGenerationStepCompanionService = class ApplicationBuildGener
90
113
  this.labellize = labellize;
91
114
  this.translate = translate;
92
115
  this.emailTemplates = emailTemplates;
116
+ this.logoDeliberation = logoDeliberation;
117
+ this.brandAccept = brandAccept;
93
118
  this.logDebug = this.logger.debugByType('ApplicationBuildGenerationStep');
94
119
  }
95
120
  /**
@@ -110,6 +135,20 @@ let ApplicationBuildGenerationStepCompanionService = class ApplicationBuildGener
110
135
  case ApplicationBuildGenerationStep.EMAIL_TEMPLATES:
111
136
  // Placement is the email domain's authority; this lane only crosses it with the enabled locales.
112
137
  return this.emailTemplates.resolveExpectedArtifactRelativePaths(this.resolveEnabledLocales());
138
+ case ApplicationBuildGenerationStep.LOGO:
139
+ /*
140
+ * The SSOT MODULE alone, deliberately — not the asset images beside it.
141
+ *
142
+ * Evidence must be derivable BEFORE the step runs, and the image filenames cannot be: they
143
+ * are named after whichever mark the panel picks. The module can, and it is the honest
144
+ * marker either way — `brand-accept` writes it only when a winner is promoted, so it is
145
+ * absent on an application that has never accepted a logo and present exactly when one has.
146
+ *
147
+ * This is NOT the directory-prefix shortcut this class's docblock warns about. That check
148
+ * would pass on any app whose `specifications/` is committed at all; this file exists only
149
+ * as a consequence of the step's own work.
150
+ */
151
+ return [path.posix.join('specifications', 'src', 'brand', BRAND_RESOLVED_ASSETS_MODULE)];
113
152
  default:
114
153
  throw new ApplicationBuildUnknownGenerationStepError(task.taskRef, generationStepRef);
115
154
  }
@@ -160,10 +199,60 @@ let ApplicationBuildGenerationStepCompanionService = class ApplicationBuildGener
160
199
  evidencePaths: await this.resolveGenerationStepEvidencePaths(task),
161
200
  };
162
201
  }
202
+ case ApplicationBuildGenerationStep.LOGO: {
203
+ const evidencePaths = await this.resolveGenerationStepEvidencePaths(task);
204
+ /*
205
+ * Incremental, but by PRESENCE rather than by the freshness lock the text pipelines use.
206
+ *
207
+ * Those pipelines skip per UNIT, because a label is cheap and units come and go. A logo
208
+ * deliberation is a panel of three experts, N generated images and a vision judge — the
209
+ * most expensive step in this enum by a wide margin — and an application has exactly one
210
+ * accepted mark. So the honest unit of freshness is "is there an accepted mark", and the
211
+ * answer is the same file the landed check reads. Re-running a satisfied step costs a
212
+ * `stat`, not a model call.
213
+ *
214
+ * Replacing an existing mark stays a deliberate act through the brand routes; a build must
215
+ * never quietly redraw an application's identity because it ran again.
216
+ */
217
+ if (await this.hasAcceptedBrandMark()) {
218
+ this.logDebug('Skipping the logo generation step — an accepted mark already exists', {
219
+ taskRef: task.taskRef,
220
+ });
221
+ return { generationStepRef, skippedBecauseAlreadyAccepted: true, evidencePaths };
222
+ }
223
+ this.logDebug('Running the logo generation step', { taskRef: task.taskRef });
224
+ const deliberation = await this.logoDeliberation.run({});
225
+ /*
226
+ * `run` stages its winner as the standard single-candidate manifest `accept` expects, which
227
+ * is why the two compose with no adapter. Passing the ref explicitly rather than relying on
228
+ * that staging is the point at which this lane would otherwise trust an implicit hand-off.
229
+ */
230
+ const accept = await this.brandAccept.accept({ candidateRef: deliberation.staged.winnerRef });
231
+ return { generationStepRef, deliberation, accept, skippedBecauseAlreadyAccepted: false, evidencePaths };
232
+ }
163
233
  default:
164
234
  throw new ApplicationBuildUnknownGenerationStepError(task.taskRef, generationStepRef);
165
235
  }
166
236
  }
237
+ /**
238
+ * Does this application already carry an accepted brand mark?
239
+ *
240
+ * Presence of the SSOT module is the whole test. It is written only by a promotion, so its
241
+ * existence means a winner was chosen — and its ABSENCE is what makes the step run. Reading the
242
+ * module's contents to count assets was considered and rejected: it would need the specifications
243
+ * package evaluated, which is a far heavier question than "has this step ever succeeded", and the
244
+ * landed check next door already keys on the same file.
245
+ */
246
+ async hasAcceptedBrandMark() {
247
+ const ssotModulePath = path.resolve(this.companionContext.saasRoot, 'specifications', 'src', 'brand', BRAND_RESOLVED_ASSETS_MODULE);
248
+ try {
249
+ await stat(ssotModulePath);
250
+ return true;
251
+ }
252
+ catch {
253
+ return false;
254
+ }
255
+ }
167
256
  requireGenerationStepRef(task) {
168
257
  const target = task.target;
169
258
  if (target?.kind !== BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {
@@ -204,10 +293,14 @@ ApplicationBuildGenerationStepCompanionService = __decorate([
204
293
  __param(4, inject(COMPANION_SERVICE_TYPES.LabellizeOrchestratorService)),
205
294
  __param(5, inject(COMPANION_SERVICE_TYPES.TranslateOrchestratorService)),
206
295
  __param(6, inject(COMPANION_SERVICE_TYPES.EmailTemplateService)),
296
+ __param(7, inject(COMPANION_SERVICE_TYPES.LogoDeliberationService)),
297
+ __param(8, inject(COMPANION_SERVICE_TYPES.BrandAcceptService)),
207
298
  __metadata("design:paramtypes", [Function, Function, Object, LabellingPlannerCompanionService,
208
299
  LabellizeOrchestratorCompanionService,
209
300
  TranslateOrchestratorCompanionService,
210
- EmailTemplateCompanionService])
301
+ EmailTemplateCompanionService,
302
+ LogoDeliberationCompanionService,
303
+ BrandAcceptCompanionService])
211
304
  ], ApplicationBuildGenerationStepCompanionService);
212
305
  export { ApplicationBuildGenerationStepCompanionService };
213
306
  //# sourceMappingURL=application-build-generation-step.companion.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"application-build-generation-step.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/application-build-generation-step.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAsB,MAAM,oDAAoD,CAAC;AAEjH,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAA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AAC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,EAA+B,EAAE,CACtD,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,MAA2B,CAAC,CAAC;YAC3E,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,CAAC,GAAG,IAAI,GAAG,CAAoB,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,gHAAgH;IACxG,uBAAuB;QAC7B,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IACjE,CAAC;CACF,CAAA;AAjIY,8CAA8C;IAD1D,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAC3C,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;IAChD,WAAA,MAAM,CAAC,uBAAuB,CAAC,uBAAuB,CAAC,CAAA;IACvD,WAAA,MAAM,CAAC,uBAAuB,CAAC,4BAA4B,CAAC,CAAA;IAC5D,WAAA,MAAM,CAAC,uBAAuB,CAAC,4BAA4B,CAAC,CAAA;IAC5D,WAAA,MAAM,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAA;iEAH8B,gCAAgC;QACzB,qCAAqC;QACrC,qCAAqC;QACxC,6BAA6B;GAV3G,8CAA8C,CAiI1D","sourcesContent":["import * as path from 'node:path';\nimport { inject, injectable } from 'inversify';\n\nimport type { AppConfigurationService, LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';\nimport { AvailableLanguage } from '@wildo-ai/presets-components-models';\nimport { BuildPlanTaskTargetKind, type BuildPlanTask } 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 { getCompanionConfiguredPrimaryLanguage } from '../../core/config/primary-language.companion.utils';\nimport { LabellingPlannerCompanionService } from '../../i18n-labelling/services/labelling-planner.companion.service';\nimport {\n LabellizeOrchestratorCompanionService,\n type LabellizeRunResult,\n} from '../../i18n-labelling/services/labellize-orchestrator.companion.service';\nimport {\n TranslateOrchestratorCompanionService,\n type TranslateRunResult,\n} from '../../i18n-labelling/services/translate-orchestrator.companion.service';\nimport {\n EmailTemplateCompanionService,\n type GenerateEmailTemplatesResult,\n type TranslateEmailTemplateLabelsResult,\n} from '../../email/services/email-template.companion.service';\nimport type { CompanionExecutionSessionContext } from '../../core/traceability/companion-traceability.models';\n\n/**\n * The companion generation steps this host can EXECUTE.\n *\n * The values are the `generationStepRef` slugs a build plan authors on a\n * `COMPANION_GENERATION_STEP` target — the closed vocabulary this enum is the\n * named home of. A build plan may only reference steps that exist here: an\n * unknown ref refuses by name (below) instead of silently parking the build,\n * which is exactly how the first generation step ever authored\n * (`i18n-labels`) stalled the Wonder Todos build plan — the vocabulary\n * existed in `_core`, and nothing executed it.\n *\n * Seeds join this enum WHEN a seed-generation pipeline exists to execute —\n * adding the value without one would let a build plan dispatch a step that can\n * only fail; the unknown-ref refusal below is the honest answer until then.\n * The executor is the integration point, not a new lane per step.\n */\nexport enum ApplicationBuildGenerationStep {\n I18N_LABELS = 'i18n-labels',\n EMAIL_TEMPLATES = 'email-templates',\n}\n\n/** A build plan referenced a generation step this companion cannot execute. Named, so the plan author sees the vocabulary. */\nexport class ApplicationBuildUnknownGenerationStepError extends Error {\n public constructor(taskRef: string, generationStepRef: string) {\n super(\n `Build task ${taskRef} references generation step \"${generationStepRef}\", which this companion cannot execute. `\n + `Known steps: ${Object.values(ApplicationBuildGenerationStep).join(', ')}.`,\n );\n }\n}\n\n/** What one executed i18n-labels step did — the per-pipeline results, verbatim. */\nexport interface ApplicationBuildI18nLabelsStepRunResult {\n readonly generationStepRef: ApplicationBuildGenerationStep.I18N_LABELS;\n /** Primary-locale label generation (incremental — fresh units are skipped by the freshness lock). */\n readonly labellize: LabellizeRunResult;\n /** Translation into the other enabled locales; absent when the app enables only its primary locale. */\n readonly translate?: TranslateRunResult;\n /** The app-root-relative files this step is responsible for — the same paths the landed check reads. */\n readonly evidencePaths: readonly string[];\n}\n\n/** What one executed email-templates step did — the per-pipeline results, verbatim. */\nexport interface ApplicationBuildEmailTemplatesStepRunResult {\n readonly generationStepRef: ApplicationBuildGenerationStep.EMAIL_TEMPLATES;\n /** Primary-locale template + labels generation (incremental — existing template+labels pairs are skipped). */\n readonly emailGenerate: GenerateEmailTemplatesResult;\n /** Label translation into the other enabled locales; absent when the app enables only its primary locale. */\n readonly emailTranslate?: TranslateEmailTemplateLabelsResult;\n /** The app-root-relative files this step is responsible for — the same paths the landed check reads. */\n readonly evidencePaths: readonly string[];\n}\n\n/** One executed generation step's result, discriminated by the step it ran. */\nexport type ApplicationBuildGenerationStepRunResult =\n | ApplicationBuildI18nLabelsStepRunResult\n | ApplicationBuildEmailTemplatesStepRunResult;\n\n/**\n * Execute companion-owned generation steps of a build plan, and answer which\n * files each step is responsible for.\n *\n * A `COMPANION_GENERATION_STEP` is deterministic in its ROUTING and its\n * PLACEMENT — which pipeline runs and where the files land is decided by\n * code, never by a coding agent (`application-build-task-coding-policy`\n * refuses to compose a coding contract for one). The CONTENT may still come\n * from a model (labels are generated text), which is exactly the directive's\n * bucket-3 shape: a companion-owned generation step interleaved by the build\n * loop.\n *\n * ## Landed evidence, and why it is planner-derived\n *\n * The build lane's landed answer is GIT: a task has landed when the files it\n * produces are committed. A generation step's target carries only its\n * `generationStepRef` — no paths — so the file set must be DERIVED. For\n * `i18n-labels` it is the labelling planner's unit inventory crossed with the\n * app's enabled locales: exactly the files the pipelines write, re-derivable\n * after a restart, a fresh clone, or a branch switch. Deliberately NOT the\n * whole i18n directory: that is already committed on any app with history, and\n * a directory-prefix check would report the step landed without it ever\n * having run for the units it still owes.\n */\n@injectable()\nexport class ApplicationBuildGenerationStepCompanionService {\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(SAAS_SERVICE_TYPES.AppConfigService) private readonly appConfigService: AppConfigurationService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.LabellingPlannerService) private readonly planner: LabellingPlannerCompanionService,\n @inject(COMPANION_SERVICE_TYPES.LabellizeOrchestratorService) private readonly labellize: LabellizeOrchestratorCompanionService,\n @inject(COMPANION_SERVICE_TYPES.TranslateOrchestratorService) private readonly translate: TranslateOrchestratorCompanionService,\n @inject(COMPANION_SERVICE_TYPES.EmailTemplateService) private readonly emailTemplates: EmailTemplateCompanionService,\n ) {\n this.logDebug = this.logger.debugByType('ApplicationBuildGenerationStep');\n }\n\n /**\n * The app-root-relative files this task's generation step is responsible\n * for. The landed check treats the task as landed when EVERY one of them is\n * committed — same doctrine as every coding task, same reader\n * (`isWorktreePathCommitted`).\n */\n public async resolveGenerationStepEvidencePaths(task: BuildPlanTask): Promise<readonly string[]> {\n const generationStepRef = this.requireGenerationStepRef(task);\n switch (generationStepRef) {\n case ApplicationBuildGenerationStep.I18N_LABELS: {\n const i18nRoot = this.resolveI18nRelativeRoot();\n const locales = this.resolveEnabledLocales();\n const units = await this.planner.planAllUnits();\n return units.flatMap((unit) =>\n locales.map((locale) => path.posix.join(i18nRoot, unit.filePathHint.bucket, `${unit.filePathHint.slug}.${locale}.ts`)),\n );\n }\n case ApplicationBuildGenerationStep.EMAIL_TEMPLATES:\n // Placement is the email domain's authority; this lane only crosses it with the enabled locales.\n return this.emailTemplates.resolveExpectedArtifactRelativePaths(this.resolveEnabledLocales());\n default:\n throw new ApplicationBuildUnknownGenerationStepError(task.taskRef, generationStepRef);\n }\n }\n\n /**\n * Run the task's generation step. Incremental by construction: both\n * pipelines consult the freshness lock and skip fresh units, so re-running\n * an already-satisfied step costs a plan read, not a model call.\n */\n public async executeGenerationStep(\n task: BuildPlanTask,\n session?: CompanionExecutionSessionContext,\n ): Promise<ApplicationBuildGenerationStepRunResult> {\n const generationStepRef = this.requireGenerationStepRef(task);\n switch (generationStepRef) {\n case ApplicationBuildGenerationStep.I18N_LABELS: {\n const primaryLocale = getCompanionConfiguredPrimaryLanguage(this.appConfigService.config);\n const targetLocales = this.resolveEnabledLocales().filter((locale) => locale !== primaryLocale);\n this.logDebug('Running the i18n-labels generation step', {\n taskRef: task.taskRef,\n primaryLocale,\n targetLocales,\n });\n const labellizeResult = await this.labellize.labellize({}, session);\n const translateResult = targetLocales.length > 0\n ? await this.translate.translate({ targetLocales }, session)\n : undefined;\n return {\n generationStepRef,\n labellize: labellizeResult,\n ...(translateResult ? { translate: translateResult } : {}),\n evidencePaths: await this.resolveGenerationStepEvidencePaths(task),\n };\n }\n case ApplicationBuildGenerationStep.EMAIL_TEMPLATES: {\n const primaryLocale = getCompanionConfiguredPrimaryLanguage(this.appConfigService.config);\n const targetLocales = this.resolveEnabledLocales().filter((locale) => locale !== primaryLocale);\n this.logDebug('Running the email-templates generation step', {\n taskRef: task.taskRef,\n primaryLocale,\n targetLocales,\n });\n const emailGenerate = await this.emailTemplates.generateTemplates({}, session);\n const emailTranslate = targetLocales.length > 0\n ? await this.emailTemplates.translateEmailTemplateLabels({ targetLocales: [...targetLocales] }, session)\n : undefined;\n return {\n generationStepRef,\n emailGenerate,\n ...(emailTranslate ? { emailTranslate } : {}),\n evidencePaths: await this.resolveGenerationStepEvidencePaths(task),\n };\n }\n default:\n throw new ApplicationBuildUnknownGenerationStepError(task.taskRef, generationStepRef);\n }\n }\n\n private requireGenerationStepRef(task: BuildPlanTask): string {\n const target = task.target;\n if (target?.kind !== BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {\n throw new Error(`Build task ${task.taskRef} is not a companion generation step.`);\n }\n return target.generationStepRef;\n }\n\n /**\n * The locales this application ENABLES — `appPreferences.languages.enabledLanguages`,\n * always including the primary. This is the \"every configured locale\" the\n * build task's objective speaks of; an app that enables only its primary\n * locale gets no translate pass and no foreign-locale evidence.\n */\n private resolveEnabledLocales(): readonly AvailableLanguage[] {\n const config = this.appConfigService.config as {\n appPreferences?: { languages?: { defaultLanguage?: unknown; enabledLanguages?: unknown } };\n } | null | undefined;\n const primary = getCompanionConfiguredPrimaryLanguage(config);\n const declared = config?.appPreferences?.languages?.enabledLanguages;\n const enabled = Array.isArray(declared)\n ? declared.filter((locale): locale is AvailableLanguage =>\n Object.values(AvailableLanguage).includes(locale as AvailableLanguage))\n : [];\n return [...new Set<AvailableLanguage>([primary, ...enabled])];\n }\n\n /** `<backend service path>/src/engine/i18n`, app-root relative — the same tree the orchestrators write into. */\n private resolveI18nRelativeRoot(): string {\n const backendService = Object.values(this.companionContext.backendServices)[0];\n if (!backendService) {\n throw new Error('No backend service configured for per-unit i18n output.');\n }\n return path.posix.join(backendService.path, 'src/engine/i18n');\n }\n}\n"]}
1
+ {"version":3,"file":"application-build-generation-step.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/application-build-generation-step.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CA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AA8C;IAD1D,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAC3C,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;IAChD,WAAA,MAAM,CAAC,uBAAuB,CAAC,uBAAuB,CAAC,CAAA;IACvD,WAAA,MAAM,CAAC,uBAAuB,CAAC,4BAA4B,CAAC,CAAA;IAC5D,WAAA,MAAM,CAAC,uBAAuB,CAAC,4BAA4B,CAAC,CAAA;IAC5D,WAAA,MAAM,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAA;IACpD,WAAA,MAAM,CAAC,uBAAuB,CAAC,uBAAuB,CAAC,CAAA;IACvD,WAAA,MAAM,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,CAAA;iEALgC,gCAAgC;QACzB,qCAAqC;QACrC,qCAAqC;QACxC,6BAA6B;QACxB,gCAAgC;QAC1C,2BAA2B;GAZpG,8CAA8C,CA0M1D","sourcesContent":["import * as path from 'node:path';\nimport { stat } from 'node:fs/promises';\nimport { inject, injectable } from 'inversify';\n\nimport type { AppConfigurationService, LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';\nimport { AvailableLanguage } from '@wildo-ai/presets-components-models';\nimport { BuildPlanTaskTargetKind, type BuildPlanTask } 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 { getCompanionConfiguredPrimaryLanguage } from '../../core/config/primary-language.companion.utils';\nimport { LabellingPlannerCompanionService } from '../../i18n-labelling/services/labelling-planner.companion.service';\nimport {\n LabellizeOrchestratorCompanionService,\n type LabellizeRunResult,\n} from '../../i18n-labelling/services/labellize-orchestrator.companion.service';\nimport {\n TranslateOrchestratorCompanionService,\n type TranslateRunResult,\n} from '../../i18n-labelling/services/translate-orchestrator.companion.service';\nimport {\n EmailTemplateCompanionService,\n type GenerateEmailTemplatesResult,\n type TranslateEmailTemplateLabelsResult,\n} from '../../email/services/email-template.companion.service';\nimport {\n LogoDeliberationCompanionService,\n type LogoDeliberationResult,\n} from '../../brand/services/logo-deliberation.companion.service';\nimport {\n BrandAcceptCompanionService,\n type BrandAcceptResult,\n} from '../../brand/services/brand-accept.companion.service';\nimport type { CompanionExecutionSessionContext } from '../../core/traceability/companion-traceability.models';\n\n/**\n * The companion generation steps this host can EXECUTE.\n *\n * The values are the `generationStepRef` slugs a build plan authors on a\n * `COMPANION_GENERATION_STEP` target — the closed vocabulary this enum is the\n * named home of. A build plan may only reference steps that exist here: an\n * unknown ref refuses by name (below) instead of silently parking the build,\n * which is exactly how the first generation step ever authored\n * (`i18n-labels`) stalled the Wonder Todos build plan — the vocabulary\n * existed in `_core`, and nothing executed it.\n *\n * Seeds join this enum WHEN a seed-generation pipeline exists to execute —\n * adding the value without one would let a build plan dispatch a step that can\n * only fail; the unknown-ref refusal below is the honest answer until then.\n * The executor is the integration point, not a new lane per step.\n */\nexport enum ApplicationBuildGenerationStep {\n I18N_LABELS = 'i18n-labels',\n EMAIL_TEMPLATES = 'email-templates',\n /**\n * The brand mark: an expert panel derives creative directions, images are generated, a vision\n * judge scores them, and the winner is promoted into the specifications SSOT.\n *\n * Added under the rule this enum's docblock states — a value joins WHEN a pipeline exists to\n * execute it. That pipeline was fully built and reachable only by a human issuing\n * `POST /brand/{generate,deliberate,accept}-logo`, so an application could acquire a considered\n * mark only if someone drove it by hand (issue #220). Hand-supplying a logo stays available and\n * unchanged; what this adds is the journey's own path to one.\n */\n LOGO = 'logo',\n}\n\n/**\n * The SSOT module `brand-accept` rewrites when it promotes a winner.\n *\n * Restated here rather than imported because it is a module-private constant of the brand service;\n * the two must agree, and the pin in this lane's tests is what says so.\n */\nconst BRAND_RESOLVED_ASSETS_MODULE = 'resolved-assets.generated.ts';\n\n/** A build plan referenced a generation step this companion cannot execute. Named, so the plan author sees the vocabulary. */\nexport class ApplicationBuildUnknownGenerationStepError extends Error {\n public constructor(taskRef: string, generationStepRef: string) {\n super(\n `Build task ${taskRef} references generation step \"${generationStepRef}\", which this companion cannot execute. `\n + `Known steps: ${Object.values(ApplicationBuildGenerationStep).join(', ')}.`,\n );\n }\n}\n\n/** What one executed i18n-labels step did — the per-pipeline results, verbatim. */\nexport interface ApplicationBuildI18nLabelsStepRunResult {\n readonly generationStepRef: ApplicationBuildGenerationStep.I18N_LABELS;\n /** Primary-locale label generation (incremental — fresh units are skipped by the freshness lock). */\n readonly labellize: LabellizeRunResult;\n /** Translation into the other enabled locales; absent when the app enables only its primary locale. */\n readonly translate?: TranslateRunResult;\n /** The app-root-relative files this step is responsible for — the same paths the landed check reads. */\n readonly evidencePaths: readonly string[];\n}\n\n/** What one executed email-templates step did — the per-pipeline results, verbatim. */\nexport interface ApplicationBuildEmailTemplatesStepRunResult {\n readonly generationStepRef: ApplicationBuildGenerationStep.EMAIL_TEMPLATES;\n /** Primary-locale template + labels generation (incremental — existing template+labels pairs are skipped). */\n readonly emailGenerate: GenerateEmailTemplatesResult;\n /** Label translation into the other enabled locales; absent when the app enables only its primary locale. */\n readonly emailTranslate?: TranslateEmailTemplateLabelsResult;\n /** The app-root-relative files this step is responsible for — the same paths the landed check reads. */\n readonly evidencePaths: readonly string[];\n}\n\n/**\n * What one executed logo step did.\n *\n * `deliberation`/`accept` are absent when the step was SKIPPED because the application already has\n * an accepted mark — see the executor for why skipping is the incremental answer here rather than\n * the freshness lock the text pipelines use.\n */\nexport interface ApplicationBuildLogoStepRunResult {\n readonly generationStepRef: ApplicationBuildGenerationStep.LOGO;\n /** The expert-panel deliberation that derived directions, generated marks and picked a winner. */\n readonly deliberation?: LogoDeliberationResult;\n /** Promotion of that winner into `specifications/src/brand/` — images plus the rewritten SSOT. */\n readonly accept?: BrandAcceptResult;\n /** True when an accepted mark already existed and no model was called. */\n readonly skippedBecauseAlreadyAccepted: boolean;\n /** The app-root-relative files this step is responsible for — the same paths the landed check reads. */\n readonly evidencePaths: readonly string[];\n}\n\n/** One executed generation step's result, discriminated by the step it ran. */\nexport type ApplicationBuildGenerationStepRunResult =\n | ApplicationBuildI18nLabelsStepRunResult\n | ApplicationBuildEmailTemplatesStepRunResult\n | ApplicationBuildLogoStepRunResult;\n\n/**\n * Execute companion-owned generation steps of a build plan, and answer which\n * files each step is responsible for.\n *\n * A `COMPANION_GENERATION_STEP` is deterministic in its ROUTING and its\n * PLACEMENT — which pipeline runs and where the files land is decided by\n * code, never by a coding agent (`application-build-task-coding-policy`\n * refuses to compose a coding contract for one). The CONTENT may still come\n * from a model (labels are generated text), which is exactly the directive's\n * bucket-3 shape: a companion-owned generation step interleaved by the build\n * loop.\n *\n * ## Landed evidence, and why it is planner-derived\n *\n * The build lane's landed answer is GIT: a task has landed when the files it\n * produces are committed. A generation step's target carries only its\n * `generationStepRef` — no paths — so the file set must be DERIVED. For\n * `i18n-labels` it is the labelling planner's unit inventory crossed with the\n * app's enabled locales: exactly the files the pipelines write, re-derivable\n * after a restart, a fresh clone, or a branch switch. Deliberately NOT the\n * whole i18n directory: that is already committed on any app with history, and\n * a directory-prefix check would report the step landed without it ever\n * having run for the units it still owes.\n */\n@injectable()\nexport class ApplicationBuildGenerationStepCompanionService {\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(SAAS_SERVICE_TYPES.AppConfigService) private readonly appConfigService: AppConfigurationService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.LabellingPlannerService) private readonly planner: LabellingPlannerCompanionService,\n @inject(COMPANION_SERVICE_TYPES.LabellizeOrchestratorService) private readonly labellize: LabellizeOrchestratorCompanionService,\n @inject(COMPANION_SERVICE_TYPES.TranslateOrchestratorService) private readonly translate: TranslateOrchestratorCompanionService,\n @inject(COMPANION_SERVICE_TYPES.EmailTemplateService) private readonly emailTemplates: EmailTemplateCompanionService,\n @inject(COMPANION_SERVICE_TYPES.LogoDeliberationService) private readonly logoDeliberation: LogoDeliberationCompanionService,\n @inject(COMPANION_SERVICE_TYPES.BrandAcceptService) private readonly brandAccept: BrandAcceptCompanionService,\n ) {\n this.logDebug = this.logger.debugByType('ApplicationBuildGenerationStep');\n }\n\n /**\n * The app-root-relative files this task's generation step is responsible\n * for. The landed check treats the task as landed when EVERY one of them is\n * committed — same doctrine as every coding task, same reader\n * (`isWorktreePathCommitted`).\n */\n public async resolveGenerationStepEvidencePaths(task: BuildPlanTask): Promise<readonly string[]> {\n const generationStepRef = this.requireGenerationStepRef(task);\n switch (generationStepRef) {\n case ApplicationBuildGenerationStep.I18N_LABELS: {\n const i18nRoot = this.resolveI18nRelativeRoot();\n const locales = this.resolveEnabledLocales();\n const units = await this.planner.planAllUnits();\n return units.flatMap((unit) =>\n locales.map((locale) => path.posix.join(i18nRoot, unit.filePathHint.bucket, `${unit.filePathHint.slug}.${locale}.ts`)),\n );\n }\n case ApplicationBuildGenerationStep.EMAIL_TEMPLATES:\n // Placement is the email domain's authority; this lane only crosses it with the enabled locales.\n return this.emailTemplates.resolveExpectedArtifactRelativePaths(this.resolveEnabledLocales());\n case ApplicationBuildGenerationStep.LOGO:\n /*\n * The SSOT MODULE alone, deliberately — not the asset images beside it.\n *\n * Evidence must be derivable BEFORE the step runs, and the image filenames cannot be: they\n * are named after whichever mark the panel picks. The module can, and it is the honest\n * marker either way — `brand-accept` writes it only when a winner is promoted, so it is\n * absent on an application that has never accepted a logo and present exactly when one has.\n *\n * This is NOT the directory-prefix shortcut this class's docblock warns about. That check\n * would pass on any app whose `specifications/` is committed at all; this file exists only\n * as a consequence of the step's own work.\n */\n return [path.posix.join('specifications', 'src', 'brand', BRAND_RESOLVED_ASSETS_MODULE)];\n default:\n throw new ApplicationBuildUnknownGenerationStepError(task.taskRef, generationStepRef);\n }\n }\n\n /**\n * Run the task's generation step. Incremental by construction: both\n * pipelines consult the freshness lock and skip fresh units, so re-running\n * an already-satisfied step costs a plan read, not a model call.\n */\n public async executeGenerationStep(\n task: BuildPlanTask,\n session?: CompanionExecutionSessionContext,\n ): Promise<ApplicationBuildGenerationStepRunResult> {\n const generationStepRef = this.requireGenerationStepRef(task);\n switch (generationStepRef) {\n case ApplicationBuildGenerationStep.I18N_LABELS: {\n const primaryLocale = getCompanionConfiguredPrimaryLanguage(this.appConfigService.config);\n const targetLocales = this.resolveEnabledLocales().filter((locale) => locale !== primaryLocale);\n this.logDebug('Running the i18n-labels generation step', {\n taskRef: task.taskRef,\n primaryLocale,\n targetLocales,\n });\n const labellizeResult = await this.labellize.labellize({}, session);\n const translateResult = targetLocales.length > 0\n ? await this.translate.translate({ targetLocales }, session)\n : undefined;\n return {\n generationStepRef,\n labellize: labellizeResult,\n ...(translateResult ? { translate: translateResult } : {}),\n evidencePaths: await this.resolveGenerationStepEvidencePaths(task),\n };\n }\n case ApplicationBuildGenerationStep.EMAIL_TEMPLATES: {\n const primaryLocale = getCompanionConfiguredPrimaryLanguage(this.appConfigService.config);\n const targetLocales = this.resolveEnabledLocales().filter((locale) => locale !== primaryLocale);\n this.logDebug('Running the email-templates generation step', {\n taskRef: task.taskRef,\n primaryLocale,\n targetLocales,\n });\n const emailGenerate = await this.emailTemplates.generateTemplates({}, session);\n const emailTranslate = targetLocales.length > 0\n ? await this.emailTemplates.translateEmailTemplateLabels({ targetLocales: [...targetLocales] }, session)\n : undefined;\n return {\n generationStepRef,\n emailGenerate,\n ...(emailTranslate ? { emailTranslate } : {}),\n evidencePaths: await this.resolveGenerationStepEvidencePaths(task),\n };\n }\n case ApplicationBuildGenerationStep.LOGO: {\n const evidencePaths = await this.resolveGenerationStepEvidencePaths(task);\n /*\n * Incremental, but by PRESENCE rather than by the freshness lock the text pipelines use.\n *\n * Those pipelines skip per UNIT, because a label is cheap and units come and go. A logo\n * deliberation is a panel of three experts, N generated images and a vision judge — the\n * most expensive step in this enum by a wide margin — and an application has exactly one\n * accepted mark. So the honest unit of freshness is \"is there an accepted mark\", and the\n * answer is the same file the landed check reads. Re-running a satisfied step costs a\n * `stat`, not a model call.\n *\n * Replacing an existing mark stays a deliberate act through the brand routes; a build must\n * never quietly redraw an application's identity because it ran again.\n */\n if (await this.hasAcceptedBrandMark()) {\n this.logDebug('Skipping the logo generation step — an accepted mark already exists', {\n taskRef: task.taskRef,\n });\n return { generationStepRef, skippedBecauseAlreadyAccepted: true, evidencePaths };\n }\n\n this.logDebug('Running the logo generation step', { taskRef: task.taskRef });\n const deliberation = await this.logoDeliberation.run({});\n /*\n * `run` stages its winner as the standard single-candidate manifest `accept` expects, which\n * is why the two compose with no adapter. Passing the ref explicitly rather than relying on\n * that staging is the point at which this lane would otherwise trust an implicit hand-off.\n */\n const accept = await this.brandAccept.accept({ candidateRef: deliberation.staged.winnerRef });\n return { generationStepRef, deliberation, accept, skippedBecauseAlreadyAccepted: false, evidencePaths };\n }\n default:\n throw new ApplicationBuildUnknownGenerationStepError(task.taskRef, generationStepRef);\n }\n }\n\n /**\n * Does this application already carry an accepted brand mark?\n *\n * Presence of the SSOT module is the whole test. It is written only by a promotion, so its\n * existence means a winner was chosen — and its ABSENCE is what makes the step run. Reading the\n * module's contents to count assets was considered and rejected: it would need the specifications\n * package evaluated, which is a far heavier question than \"has this step ever succeeded\", and the\n * landed check next door already keys on the same file.\n */\n private async hasAcceptedBrandMark(): Promise<boolean> {\n const ssotModulePath = path.resolve(\n this.companionContext.saasRoot,\n 'specifications',\n 'src',\n 'brand',\n BRAND_RESOLVED_ASSETS_MODULE,\n );\n try {\n await stat(ssotModulePath);\n return true;\n } catch {\n return false;\n }\n }\n\n private requireGenerationStepRef(task: BuildPlanTask): string {\n const target = task.target;\n if (target?.kind !== BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {\n throw new Error(`Build task ${task.taskRef} is not a companion generation step.`);\n }\n return target.generationStepRef;\n }\n\n /**\n * The locales this application ENABLES — `appPreferences.languages.enabledLanguages`,\n * always including the primary. This is the \"every configured locale\" the\n * build task's objective speaks of; an app that enables only its primary\n * locale gets no translate pass and no foreign-locale evidence.\n */\n private resolveEnabledLocales(): readonly AvailableLanguage[] {\n const config = this.appConfigService.config as {\n appPreferences?: { languages?: { defaultLanguage?: unknown; enabledLanguages?: unknown } };\n } | null | undefined;\n const primary = getCompanionConfiguredPrimaryLanguage(config);\n const declared = config?.appPreferences?.languages?.enabledLanguages;\n const enabled = Array.isArray(declared)\n ? declared.filter((locale): locale is AvailableLanguage =>\n Object.values(AvailableLanguage).includes(locale as AvailableLanguage))\n : [];\n return [...new Set<AvailableLanguage>([primary, ...enabled])];\n }\n\n /** `<backend service path>/src/engine/i18n`, app-root relative — the same tree the orchestrators write into. */\n private resolveI18nRelativeRoot(): string {\n const backendService = Object.values(this.companionContext.backendServices)[0];\n if (!backendService) {\n throw new Error('No backend service configured for per-unit i18n output.');\n }\n return path.posix.join(backendService.path, 'src/engine/i18n');\n }\n}\n"]}
@@ -39,6 +39,15 @@ export declare class ExecutionTraceReadCompanionService {
39
39
  private readonly companionContext;
40
40
  constructor(companionContext: CompanionContext);
41
41
  listSessions(limit?: number): Promise<readonly ExecutionTraceSessionSummary[]>;
42
+ /**
43
+ * Every session DIRECTORY NAME, unbounded and cheap — one readdir, no per-session summarize.
44
+ *
45
+ * Exists for JOIN resolution (a write record's runId → its session by longest-prefix match):
46
+ * bounding that lookup with the display limit made records older than the newest N silently
47
+ * lose their trace link, which is a correctness question the display bound has no business
48
+ * answering (completion-review finding 11a).
49
+ */
50
+ listSessionIds(): Promise<readonly string[]>;
42
51
  readSession(sessionId: string): Promise<ExecutionTraceSession>;
43
52
  /** One artifact's body, by session and step and file name. The bodies are why the trace is worth keeping. */
44
53
  readArtifact(sessionId: string, stepDirName: string, fileName: string): Promise<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"execution-trace-read.companion.service.d.ts","sour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,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAe3E,6GAA6G;IAChG,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUpG,OAAO,CAAC,YAAY;YAIN,SAAS;YAkBT,UAAU;YAUV,SAAS;CAOxB"}
1
+ {"version":3,"file":"execution-trace-read.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/execution-trace-read.companion.service.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iGAAiG;IACjG,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,qBAAsB,SAAQ,4BAA4B;IACzE,QAAQ,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;CAC/C;AAED,qBAAa,2BAA4B,SAAQ,KAAK;CAAG;AAEzD;;;;;;;;;;GAUG;AACH,qBACa,kCAAkC;IAEO,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,gBAAgB;IAG1F,YAAY,CAAC,KAAK,SAAK,GAAG,OAAO,CAAC,SAAS,4BAA4B,EAAE,CAAC;IASvF;;;;;;;OAOG;IACU,cAAc,IAAI,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;IAM5C,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAe3E,6GAA6G;IAChG,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUpG,OAAO,CAAC,YAAY;YAIN,SAAS;YAkBT,UAAU;YAUV,SAAS;CAOxB"}
@@ -41,6 +41,19 @@ let ExecutionTraceReadCompanionService = class ExecutionTraceReadCompanionServic
41
41
  const summaries = await Promise.all(newestFirst.map((name) => this.summarize(root, name)));
42
42
  return summaries.filter((entry) => entry !== null);
43
43
  }
44
+ /**
45
+ * Every session DIRECTORY NAME, unbounded and cheap — one readdir, no per-session summarize.
46
+ *
47
+ * Exists for JOIN resolution (a write record's runId → its session by longest-prefix match):
48
+ * bounding that lookup with the display limit made records older than the newest N silently
49
+ * lose their trace link, which is a correctness question the display bound has no business
50
+ * answering (completion-review finding 11a).
51
+ */
52
+ async listSessionIds() {
53
+ const root = this.sessionsRoot();
54
+ const names = await readdir(root).catch(() => []);
55
+ return names.filter((name) => name.startsWith('dev-'));
56
+ }
44
57
  async readSession(sessionId) {
45
58
  const root = this.sessionsRoot();
46
59
  // A session id is a directory NAME. Anything with a separator is a traversal attempt, not a typo.