@wildo-ai/dev-companion 1.1.13 → 1.1.14

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 (256) hide show
  1. package/dist/esm/.tsbuildinfo +1 -1
  2. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +21 -0
  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 +37 -4
  5. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
  6. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts.map +1 -1
  7. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +9 -2
  8. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js.map +1 -1
  9. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +66 -0
  10. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
  11. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +183 -7
  12. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
  13. package/dist/esm/claude-cli/services/git-change-set.companion.service.d.ts +6 -2
  14. package/dist/esm/claude-cli/services/git-change-set.companion.service.d.ts.map +1 -1
  15. package/dist/esm/claude-cli/services/git-change-set.companion.service.js +16 -39
  16. package/dist/esm/claude-cli/services/git-change-set.companion.service.js.map +1 -1
  17. package/dist/esm/code-compliance-check/check-raw-feature-id-literals.companion.js +31 -2
  18. package/dist/esm/code-compliance-check/check-raw-feature-id-literals.companion.js.map +1 -1
  19. package/dist/esm/companion-api/companion-api.schemas.d.ts +2 -0
  20. package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
  21. package/dist/esm/companion-api/companion-api.schemas.js +8 -0
  22. package/dist/esm/companion-api/companion-api.schemas.js.map +1 -1
  23. package/dist/esm/companion-api/controllers/companion.controller.d.ts +7 -0
  24. package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
  25. package/dist/esm/companion-api/controllers/companion.controller.js +26 -12
  26. package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
  27. package/dist/esm/companion-api/controllers/long-held-request.companion.d.ts +17 -0
  28. package/dist/esm/companion-api/controllers/long-held-request.companion.d.ts.map +1 -0
  29. package/dist/esm/companion-api/controllers/long-held-request.companion.js +33 -0
  30. package/dist/esm/companion-api/controllers/long-held-request.companion.js.map +1 -0
  31. package/dist/esm/core/introspection/resources/creation-home-projection.companion.d.ts +9 -0
  32. package/dist/esm/core/introspection/resources/creation-home-projection.companion.d.ts.map +1 -1
  33. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js +12 -0
  34. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js.map +1 -1
  35. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -1
  36. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +7 -1
  37. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -1
  38. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts +8 -20
  39. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts.map +1 -1
  40. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js +37 -142
  41. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js.map +1 -1
  42. package/dist/esm/core/introspection/services/introspection-source-walk.worker.d.ts +64 -0
  43. package/dist/esm/core/introspection/services/introspection-source-walk.worker.d.ts.map +1 -0
  44. package/dist/esm/core/introspection/services/introspection-source-walk.worker.js +304 -0
  45. package/dist/esm/core/introspection/services/introspection-source-walk.worker.js.map +1 -0
  46. package/dist/esm/core/runtime/companion-language-model-route.d.ts +16 -1
  47. package/dist/esm/core/runtime/companion-language-model-route.d.ts.map +1 -1
  48. package/dist/esm/core/runtime/companion-language-model-route.js +23 -1
  49. package/dist/esm/core/runtime/companion-language-model-route.js.map +1 -1
  50. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
  51. package/dist/esm/core/runtime/services/start-companion-application.service.js +3 -2
  52. package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
  53. package/dist/esm/core/utils/git-read-broker.companion.d.ts +62 -0
  54. package/dist/esm/core/utils/git-read-broker.companion.d.ts.map +1 -0
  55. package/dist/esm/core/utils/git-read-broker.companion.js +282 -0
  56. package/dist/esm/core/utils/git-read-broker.companion.js.map +1 -0
  57. package/dist/esm/core/utils/local-write-recording.companion.d.ts +8 -1
  58. package/dist/esm/core/utils/local-write-recording.companion.d.ts.map +1 -1
  59. package/dist/esm/core/utils/local-write-recording.companion.js +7 -23
  60. package/dist/esm/core/utils/local-write-recording.companion.js.map +1 -1
  61. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.d.ts +29 -0
  62. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.d.ts.map +1 -0
  63. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.js +29 -0
  64. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.js.map +1 -0
  65. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.d.ts +29 -0
  66. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.d.ts.map +1 -0
  67. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.js +29 -0
  68. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.js.map +1 -0
  69. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts +1 -0
  70. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts.map +1 -1
  71. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js +2 -1
  72. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js.map +1 -1
  73. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.d.ts +1 -0
  74. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.d.ts.map +1 -1
  75. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.js +2 -1
  76. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.js.map +1 -1
  77. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.d.ts +5 -2
  78. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.d.ts.map +1 -1
  79. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.js +5 -2
  80. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.js.map +1 -1
  81. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.d.ts +5 -2
  82. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.d.ts.map +1 -1
  83. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.js +5 -2
  84. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.js.map +1 -1
  85. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.d.ts +41 -0
  86. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.d.ts.map +1 -0
  87. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.js +41 -0
  88. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.js.map +1 -0
  89. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.d.ts +41 -0
  90. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.d.ts.map +1 -0
  91. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.js +41 -0
  92. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.js.map +1 -0
  93. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.d.ts +1 -0
  94. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.d.ts.map +1 -1
  95. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.js +2 -1
  96. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.js.map +1 -1
  97. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.d.ts +1 -0
  98. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.d.ts.map +1 -1
  99. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.js +2 -1
  100. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.js.map +1 -1
  101. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts +1 -0
  102. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts.map +1 -1
  103. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js +2 -1
  104. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js.map +1 -1
  105. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.d.ts +1 -0
  106. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.d.ts.map +1 -1
  107. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.js +2 -1
  108. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.js.map +1 -1
  109. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.d.ts +1 -0
  110. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.d.ts.map +1 -1
  111. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.js +2 -1
  112. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.js.map +1 -1
  113. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.d.ts +1 -0
  114. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.d.ts.map +1 -1
  115. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.js +2 -1
  116. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.js.map +1 -1
  117. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.d.ts +2 -0
  118. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.d.ts.map +1 -1
  119. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.js +3 -1
  120. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.js.map +1 -1
  121. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.d.ts +2 -0
  122. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.d.ts.map +1 -1
  123. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.js +3 -1
  124. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.js.map +1 -1
  125. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.d.ts +1 -1
  126. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.js +1 -1
  127. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.js.map +1 -1
  128. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.d.ts +1 -1
  129. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.js +1 -1
  130. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.js.map +1 -1
  131. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.d.ts +2 -0
  132. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.d.ts.map +1 -1
  133. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.js +3 -1
  134. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.js.map +1 -1
  135. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.d.ts +3 -1
  136. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.d.ts.map +1 -1
  137. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.js +4 -2
  138. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.js.map +1 -1
  139. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts +17 -0
  140. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts.map +1 -1
  141. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js +18 -1
  142. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js.map +1 -1
  143. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.d.ts +17 -0
  144. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.d.ts.map +1 -1
  145. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.js +18 -1
  146. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.js.map +1 -1
  147. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.d.ts +206 -195
  148. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.d.ts.map +1 -1
  149. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.js +206 -195
  150. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.js.map +1 -1
  151. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.d.ts +10 -0
  152. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.d.ts.map +1 -1
  153. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.js +12 -2
  154. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.js.map +1 -1
  155. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.d.ts +70 -0
  156. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.d.ts.map +1 -1
  157. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.js +70 -0
  158. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.js.map +1 -1
  159. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.d.ts +12 -2
  160. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.d.ts.map +1 -1
  161. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.js +12 -2
  162. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.js.map +1 -1
  163. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.d.ts +10 -0
  164. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.d.ts.map +1 -1
  165. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.js +10 -0
  166. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.js.map +1 -1
  167. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.d.ts +25 -20
  168. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.d.ts.map +1 -1
  169. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.js +25 -20
  170. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.js.map +1 -1
  171. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.d.ts +32 -32
  172. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.js +32 -32
  173. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.js.map +1 -1
  174. package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.d.ts +65 -65
  175. package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.js +65 -65
  176. package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.js.map +1 -1
  177. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.d.ts +20 -0
  178. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.d.ts.map +1 -1
  179. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.js +20 -0
  180. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.js.map +1 -1
  181. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.d.ts +12 -0
  182. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.d.ts.map +1 -1
  183. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.js +13 -1
  184. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.js.map +1 -1
  185. package/dist/esm/i18n/system_enums/application-creation.fr.d.ts +170 -170
  186. package/dist/esm/i18n/system_enums/application-creation.fr.js +170 -170
  187. package/dist/esm/i18n/system_enums/application-creation.fr.js.map +1 -1
  188. package/dist/esm/i18n/system_enums/flows-actors.fr.d.ts +22 -22
  189. package/dist/esm/i18n/system_enums/flows-actors.fr.js +22 -22
  190. package/dist/esm/i18n/system_enums/flows-actors.fr.js.map +1 -1
  191. package/dist/esm/i18n/system_enums/run-records.fr.d.ts +21 -21
  192. package/dist/esm/i18n/system_enums/run-records.fr.js +21 -21
  193. package/dist/esm/i18n/system_enums/run-records.fr.js.map +1 -1
  194. package/dist/esm/i18n/system_enums/workbench-build.en.d.ts +1 -0
  195. package/dist/esm/i18n/system_enums/workbench-build.en.d.ts.map +1 -1
  196. package/dist/esm/i18n/system_enums/workbench-build.en.js +1 -0
  197. package/dist/esm/i18n/system_enums/workbench-build.en.js.map +1 -1
  198. package/dist/esm/i18n/system_enums/workbench-build.fr.d.ts +37 -33
  199. package/dist/esm/i18n/system_enums/workbench-build.fr.d.ts.map +1 -1
  200. package/dist/esm/i18n/system_enums/workbench-build.fr.js +37 -33
  201. package/dist/esm/i18n/system_enums/workbench-build.fr.js.map +1 -1
  202. package/dist/esm/i18n/system_enums/workbench-creation-home.en.d.ts +1 -0
  203. package/dist/esm/i18n/system_enums/workbench-creation-home.en.d.ts.map +1 -1
  204. package/dist/esm/i18n/system_enums/workbench-creation-home.en.js +1 -0
  205. package/dist/esm/i18n/system_enums/workbench-creation-home.en.js.map +1 -1
  206. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.d.ts +18 -17
  207. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.d.ts.map +1 -1
  208. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.js +18 -17
  209. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.js.map +1 -1
  210. package/dist/esm/i18n/system_enums/workbench-dossier.fr.d.ts +7 -5
  211. package/dist/esm/i18n/system_enums/workbench-dossier.fr.d.ts.map +1 -1
  212. package/dist/esm/i18n/system_enums/workbench-dossier.fr.js +8 -6
  213. package/dist/esm/i18n/system_enums/workbench-dossier.fr.js.map +1 -1
  214. package/dist/esm/i18n/system_enums/workbench-secrets.fr.d.ts +12 -12
  215. package/dist/esm/i18n/system_enums/workbench-secrets.fr.js +12 -12
  216. package/dist/esm/i18n/system_enums/workbench-secrets.fr.js.map +1 -1
  217. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.d.ts +1 -0
  218. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.d.ts.map +1 -1
  219. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.js +2 -1
  220. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.js.map +1 -1
  221. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.d.ts.map +1 -1
  222. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js +3 -4
  223. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js.map +1 -1
  224. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts +11 -0
  225. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts.map +1 -1
  226. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js +21 -0
  227. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js.map +1 -1
  228. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +120 -16
  229. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  230. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +875 -191
  231. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  232. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts +102 -13
  233. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts.map +1 -1
  234. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js +243 -57
  235. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js.map +1 -1
  236. package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.d.ts +3 -3
  237. package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.js +3 -3
  238. package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.js.map +1 -1
  239. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.d.ts +9 -0
  240. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.d.ts.map +1 -1
  241. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.js +19 -0
  242. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.js.map +1 -1
  243. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.d.ts.map +1 -1
  244. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js +4 -5
  245. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js.map +1 -1
  246. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts.map +1 -1
  247. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js +6 -3
  248. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js.map +1 -1
  249. package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.d.ts.map +1 -1
  250. package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.js +3 -5
  251. package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.js.map +1 -1
  252. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +1 -1
  253. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
  254. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +38 -21
  255. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  256. package/package.json +18 -18
@@ -0,0 +1,304 @@
1
+ import { existsSync, promises as fsPromises } from 'node:fs';
2
+ import { basename, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { isMainThread, parentPort, Worker, workerData } from 'node:worker_threads';
5
+ import { describeCaughtError } from '@wildo-ai/saas-models/public-runtime';
6
+ /**
7
+ * The source-state sweep's directory walk, run on a WORKER THREAD (companion event-loop stalls, #3204).
8
+ *
9
+ * `IntrospectionSourceStateObserver` decides WHICH roots to walk (the change feed, the held walks) and turns the result
10
+ * into a token; this module only walks. It used to walk on the companion's main thread, and during a build that was the
11
+ * largest single cost there: every observation re-walks the application's package roots (about 14,000 entries on the
12
+ * reference application), because the build moves them constantly, and the per-file `stat` calls, their promises and
13
+ * their `Stats` objects are main-thread work even though the reads themselves run on libuv's pool. A 90 s CPU profile of
14
+ * the reference run's companion (2026-11-14) put 11.6 s of the main thread inside the sweep's `stat` calls and 15 s in
15
+ * the sweep overall, while every workbench request waited behind it. On a worker the same walk costs the main thread one
16
+ * message each way.
17
+ *
18
+ * The walk is the same code either way: {@link walkSourceRoots} is what the worker runs and what the companion runs in
19
+ * process when no worker can be had (a test harness, a failed start, a worker that died), so the two cannot disagree
20
+ * about what a token means.
21
+ *
22
+ * This module imports NOTHING but Node built-ins, deliberately: from source (the companion under test, or run from its
23
+ * `.ts`) the worker is started on this file directly and Node strips its types, which resolves no extensionless
24
+ * relative import and no package. Its concurrency bounds therefore arrive with each request rather than by import, and
25
+ * nothing here may use non-erasable TypeScript (an `enum`, a parameter property).
26
+ */
27
+ /**
28
+ * Directory names never descended into.
29
+ *
30
+ * `node_modules` is skipped during the walk and reached only through the explicit `@wildo-ai/*`
31
+ * roots the observer resolves: descending into it from an application package would sweep the app's entire
32
+ * dependency graph (hundreds of thousands of files) to learn nothing the resolved engine roots do
33
+ * not already say.
34
+ */
35
+ const SKIPPED_DIRECTORY_NAMES = new Set(['node_modules', '.git']);
36
+ /**
37
+ * The compiler's private output, never descended into when it sits in a package's `.wildo-runtime-signals` (#3452).
38
+ *
39
+ * A compile writes here first and publishes into `dist` once the emit is final, and nothing a derivation imports resolves
40
+ * here: every package's `exports` name `dist`, and no link in any dogfood application points into staging (measured
41
+ * 2026-11-08 over `examples/`). So a staging write cannot change a derivation, and the publication that can moves `dist`
42
+ * and the accepted-generation manifest beside it, which are still walked. It was about 40 % of what a sweep stat'ed
43
+ * (5,440 of Wonder Todos' 13,484 `backend-api` files). The change source ignores the same subtree.
44
+ */
45
+ const COMPILE_STAGING_DIRECTORY_NAME = 'compile-staging';
46
+ const RUNTIME_SIGNALS_DIRECTORY_NAME = '.wildo-runtime-signals';
47
+ /** A counting semaphore for the file-stat bound. */
48
+ class StatPermits {
49
+ available;
50
+ waiting = [];
51
+ constructor(permits) {
52
+ this.available = permits;
53
+ }
54
+ async run(operation) {
55
+ if (this.available > 0) {
56
+ this.available -= 1;
57
+ }
58
+ else {
59
+ // A released permit is handed straight to the next waiter, so `available` never rises while
60
+ // anyone is waiting and no waiter can be overtaken by a later caller.
61
+ await new Promise((resolveWait) => this.waiting.push(resolveWait));
62
+ }
63
+ try {
64
+ return await operation();
65
+ }
66
+ finally {
67
+ const next = this.waiting.shift();
68
+ if (next)
69
+ next();
70
+ else
71
+ this.available += 1;
72
+ }
73
+ }
74
+ }
75
+ /**
76
+ * Walk the roots and return one accumulator per root. Never rejects for a root that cannot be read: it contributes
77
+ * nothing, and when it appears later it is a new directory, which moves the counts.
78
+ */
79
+ export async function walkSourceRoots(request) {
80
+ const accumulators = request.roots.map(() => ({ fileCount: 0, directoryCount: 0, maximumMtimeMs: 0 }));
81
+ const totals = {
82
+ entryCount: request.entryCountBefore,
83
+ exceededCeiling: false,
84
+ maximumEntries: request.maximumEntries,
85
+ statPermits: new StatPermits(request.fileStatConcurrency),
86
+ };
87
+ await walk(request.roots.map((directory, index) => ({ directory, accumulator: accumulators[index] })), totals, request.directoryConcurrency);
88
+ return { accumulators, entryCount: totals.entryCount, exceededCeiling: totals.exceededCeiling };
89
+ }
90
+ /**
91
+ * Breadth-of-tree walk with a fixed directory concurrency.
92
+ *
93
+ * A worker-pool built over the ROOT list was written first and was wrong: it sizes its pool from
94
+ * the number of roots, so a single-root application would walk its whole tree one directory at a
95
+ * time, and a worker that finds the queue momentarily empty cannot tell "finished" from "another
96
+ * worker is about to push children". The pump below sizes on IN-FLIGHT directories instead, which
97
+ * is the quantity the concurrency limit is actually about, and terminates on the only condition
98
+ * that means finished: nothing queued and nothing running.
99
+ */
100
+ async function walk(roots, totals, directoryConcurrency) {
101
+ const pending = [...roots];
102
+ let inFlightDirectories = 0;
103
+ return new Promise((resolveWalk) => {
104
+ const pump = () => {
105
+ while (!totals.exceededCeiling && inFlightDirectories < directoryConcurrency && pending.length > 0) {
106
+ const next = pending.pop();
107
+ inFlightDirectories += 1;
108
+ void visitDirectory(next, totals, pending).then(() => {
109
+ inFlightDirectories -= 1;
110
+ pump();
111
+ });
112
+ }
113
+ if (inFlightDirectories === 0 && (pending.length === 0 || totals.exceededCeiling)) {
114
+ resolveWalk();
115
+ }
116
+ };
117
+ pump();
118
+ });
119
+ }
120
+ /**
121
+ * Read one directory: count it, fold its own mtime in, stat its files, and queue its children.
122
+ *
123
+ * Never rejects. A directory that cannot be read (an unbuilt `dist`, a permission) contributes
124
+ * nothing and is not an error — when it appears later it is a new directory, which moves the
125
+ * counts and invalidates every cached derivation.
126
+ */
127
+ async function visitDirectory({ directory, accumulator }, totals, pending) {
128
+ let entries;
129
+ try {
130
+ entries = await fsPromises.readdir(directory, { withFileTypes: true });
131
+ }
132
+ catch {
133
+ return;
134
+ }
135
+ accumulator.directoryCount += 1;
136
+ totals.entryCount += 1;
137
+ try {
138
+ const directoryStats = await fsPromises.stat(directory);
139
+ if (directoryStats.mtimeMs > accumulator.maximumMtimeMs) {
140
+ accumulator.maximumMtimeMs = directoryStats.mtimeMs;
141
+ }
142
+ }
143
+ catch {
144
+ // Counted above regardless: the directory demonstrably exists, we just read it.
145
+ }
146
+ const fileStats = [];
147
+ const insideRuntimeSignals = basename(directory) === RUNTIME_SIGNALS_DIRECTORY_NAME;
148
+ for (const entry of entries) {
149
+ if (SKIPPED_DIRECTORY_NAMES.has(entry.name))
150
+ continue;
151
+ if (insideRuntimeSignals && entry.name === COMPILE_STAGING_DIRECTORY_NAME)
152
+ continue;
153
+ const entryPath = join(directory, entry.name);
154
+ if (entry.isDirectory()) {
155
+ pending.push({ directory: entryPath, accumulator });
156
+ continue;
157
+ }
158
+ if (!entry.isFile()) {
159
+ // A symlink is counted but never followed — following one inside a package tree can walk
160
+ // back out into a dependency graph. Retargeting one rewrites its directory entry, which
161
+ // moves the parent directory's mtime, so the change is still observed.
162
+ accumulator.fileCount += 1;
163
+ totals.entryCount += 1;
164
+ continue;
165
+ }
166
+ totals.entryCount += 1;
167
+ fileStats.push(totals.statPermits.run(() => fsPromises.stat(entryPath)).then((entryStats) => {
168
+ accumulator.fileCount += 1;
169
+ if (entryStats.mtimeMs > accumulator.maximumMtimeMs) {
170
+ accumulator.maximumMtimeMs = entryStats.mtimeMs;
171
+ }
172
+ }, () => {
173
+ accumulator.fileCount += 1;
174
+ }));
175
+ }
176
+ await Promise.all(fileStats);
177
+ if (totals.entryCount > totals.maximumEntries) {
178
+ totals.exceededCeiling = true;
179
+ }
180
+ }
181
+ /** Marks a thread started by {@link SourceWalkWorker}, so importing this module elsewhere starts nothing. */
182
+ const SOURCE_WALK_WORKER_KIND = 'wildo.introspection-source-walk';
183
+ // The worker side: answer each request with the same function the companion would run in process.
184
+ if (!isMainThread && parentPort !== null && workerData?.kind === SOURCE_WALK_WORKER_KIND) {
185
+ const port = parentPort;
186
+ port.on('message', (message) => {
187
+ walkSourceRoots(message.request).then((result) => port.postMessage({ id: message.id, result }), (error) => port.postMessage({ id: message.id, error: describeCaughtError(error) }));
188
+ });
189
+ }
190
+ /**
191
+ * The companion's side: one long-lived worker thread, started on first use and shared by every observer (two sweep the
192
+ * same roots). Unreferenced, so it never keeps the process alive.
193
+ *
194
+ * Fails toward the in-process walk, never toward a wrong token: a worker that cannot start, errors or exits fails its
195
+ * pending walks with a {@link SourceWalkWorkerUnavailableError}, the caller walks in process, and the next walk starts
196
+ * a fresh worker. After {@link MAXIMUM_WORKER_FAILURES} consecutive failures it stops trying for the life of the process,
197
+ * so a worker that can never start costs one failed start per walk at most a few times, not on every observation.
198
+ */
199
+ export class SourceWalkWorker {
200
+ worker;
201
+ nextId = 1;
202
+ consecutiveFailures = 0;
203
+ pending = new Map();
204
+ // A plain field, not a parameter property: this file runs under type stripping, which refuses non-erasable syntax.
205
+ options;
206
+ constructor(options = {}) {
207
+ this.options = options;
208
+ }
209
+ /** The walk, on the worker; rejects with {@link SourceWalkWorkerUnavailableError} when no worker can do it. */
210
+ walk(request) {
211
+ const worker = this.ensureWorker();
212
+ if (worker === undefined)
213
+ return Promise.reject(new SourceWalkWorkerUnavailableError('no source-walk worker is available'));
214
+ const id = this.nextId;
215
+ this.nextId += 1;
216
+ return new Promise((resolve, reject) => {
217
+ this.pending.set(id, { resolve, reject });
218
+ // Referenced only while a walk is pending, so a running walk is never cut short by the process idling out.
219
+ if (this.pending.size === 1)
220
+ worker.ref();
221
+ worker.postMessage({ id, request });
222
+ });
223
+ }
224
+ /** Whether the worker has been given up on for this process. For tests and logs. */
225
+ get disabled() {
226
+ return this.consecutiveFailures >= MAXIMUM_WORKER_FAILURES;
227
+ }
228
+ /** Stop the worker (tests). A walk it was doing fails as unavailable, so its caller walks in process. */
229
+ async close() {
230
+ const worker = this.worker;
231
+ if (worker === undefined)
232
+ return;
233
+ this.failPending(worker, 'the source-walk worker was closed');
234
+ await worker.terminate();
235
+ }
236
+ ensureWorker() {
237
+ if (this.worker !== undefined)
238
+ return this.worker;
239
+ if (this.disabled)
240
+ return undefined;
241
+ let worker;
242
+ try {
243
+ worker = new Worker(this.options.entryPath ?? resolveSourceWalkWorkerEntry(), { workerData: { kind: SOURCE_WALK_WORKER_KIND } });
244
+ }
245
+ catch {
246
+ this.consecutiveFailures += 1;
247
+ return undefined;
248
+ }
249
+ worker.unref();
250
+ worker.on('message', (message) => {
251
+ const waiter = this.pending.get(message.id);
252
+ if (waiter === undefined)
253
+ return;
254
+ this.pending.delete(message.id);
255
+ if (this.pending.size === 0)
256
+ worker.unref();
257
+ if (message.result !== undefined) {
258
+ this.consecutiveFailures = 0;
259
+ waiter.resolve(message.result);
260
+ }
261
+ else {
262
+ waiter.reject(new SourceWalkWorkerUnavailableError(message.error ?? 'the source-walk worker answered nothing'));
263
+ }
264
+ });
265
+ const fail = (reason) => {
266
+ if (this.worker !== worker)
267
+ return;
268
+ this.consecutiveFailures += 1;
269
+ this.failPending(worker, reason);
270
+ // A failure that is not an exit (an error, an unreadable answer) leaves the thread running: stop the one it forgot.
271
+ void worker.terminate().catch(() => undefined);
272
+ };
273
+ worker.on('error', (error) => fail(`the source-walk worker failed: ${error.message}`));
274
+ worker.on('exit', (code) => fail(`the source-walk worker exited (code ${code})`));
275
+ // An answer that cannot be deserialized would otherwise leave its walk pending for good.
276
+ worker.on('messageerror', (error) => fail(`the source-walk worker's answer could not be read: ${error.message}`));
277
+ this.worker = worker;
278
+ return worker;
279
+ }
280
+ /** Forget the worker and fail every walk it was doing as unavailable, so each is walked in process. */
281
+ failPending(worker, reason) {
282
+ if (this.worker !== worker)
283
+ return;
284
+ this.worker = undefined;
285
+ const waiters = [...this.pending.values()];
286
+ this.pending.clear();
287
+ for (const waiter of waiters)
288
+ waiter.reject(new SourceWalkWorkerUnavailableError(reason));
289
+ }
290
+ }
291
+ /** A walk the worker could not do; the caller walks in process instead. */
292
+ export class SourceWalkWorkerUnavailableError extends Error {
293
+ name = 'SourceWalkWorkerUnavailableError';
294
+ }
295
+ /** Consecutive worker failures after which the companion walks in process for the rest of its life. */
296
+ export const MAXIMUM_WORKER_FAILURES = 3;
297
+ /** This module's own file: the compiled `.js` in a build, the `.ts` when the companion runs from source. */
298
+ function resolveSourceWalkWorkerEntry() {
299
+ const own = fileURLToPath(import.meta.url);
300
+ if (existsSync(own))
301
+ return own;
302
+ throw new SourceWalkWorkerUnavailableError(`the source-walk worker entry ${own} does not exist`);
303
+ }
304
+ //# sourceMappingURL=introspection-source-walk.worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"introspection-source-walk.worker.js","sourceRoot":"","sources":["../../../../../src/core/introspection/services/introspection-source-walk.worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;;GAOG;AACH,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AAElE;;;;;;;;GAQG;AACH,MAAM,8BAA8B,GAAG,iBAAiB,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,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,KAAK,MAAM,MAAM,IAAI,OAAO;YAAE,MAAM,CAAC,MAAM,CAAC,IAAI,gCAAgC,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5F,CAAC;CACF;AAED,2EAA2E;AAC3E,MAAM,OAAO,gCAAiC,SAAQ,KAAK;IAChC,IAAI,GAAG,kCAAkC,CAAC;CACpE;AAED,uGAAuG;AACvG,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAEzC,4GAA4G;AAC5G,SAAS,4BAA4B;IACnC,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3C,IAAI,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IAChC,MAAM,IAAI,gCAAgC,CAAC,gCAAgC,GAAG,iBAAiB,CAAC,CAAC;AACnG,CAAC","sourcesContent":["import { existsSync, promises as fsPromises } from 'node:fs';\nimport { basename, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isMainThread, parentPort, Worker, workerData } from 'node:worker_threads';\nimport { describeCaughtError } from '@wildo-ai/saas-models/public-runtime';\n\n/**\n * The source-state sweep's directory walk, run on a WORKER THREAD (companion event-loop stalls, #3204).\n *\n * `IntrospectionSourceStateObserver` decides WHICH roots to walk (the change feed, the held walks) and turns the result\n * into a token; this module only walks. It used to walk on the companion's main thread, and during a build that was the\n * largest single cost there: every observation re-walks the application's package roots (about 14,000 entries on the\n * reference application), because the build moves them constantly, and the per-file `stat` calls, their promises and\n * their `Stats` objects are main-thread work even though the reads themselves run on libuv's pool. A 90 s CPU profile of\n * the reference run's companion (2026-11-14) put 11.6 s of the main thread inside the sweep's `stat` calls and 15 s in\n * the sweep overall, while every workbench request waited behind it. On a worker the same walk costs the main thread one\n * message each way.\n *\n * The walk is the same code either way: {@link walkSourceRoots} is what the worker runs and what the companion runs in\n * process when no worker can be had (a test harness, a failed start, a worker that died), so the two cannot disagree\n * about what a token means.\n *\n * This module imports NOTHING but Node built-ins, deliberately: from source (the companion under test, or run from its\n * `.ts`) the worker is started on this file directly and Node strips its types, which resolves no extensionless\n * relative import and no package. Its concurrency bounds therefore arrive with each request rather than by import, and\n * nothing here may use non-erasable TypeScript (an `enum`, a parameter property).\n */\n\n/**\n * Directory names never descended into.\n *\n * `node_modules` is skipped during the walk and reached only through the explicit `@wildo-ai/*`\n * roots the observer resolves: descending into it from an application package would sweep the app's entire\n * dependency graph (hundreds of thousands of files) to learn nothing the resolved engine roots do\n * not already say.\n */\nconst SKIPPED_DIRECTORY_NAMES = new Set(['node_modules', '.git']);\n\n/**\n * The compiler's private output, never descended into when it sits in a package's `.wildo-runtime-signals` (#3452).\n *\n * A compile writes here first and publishes into `dist` once the emit is final, and nothing a derivation imports resolves\n * here: every package's `exports` name `dist`, and no link in any dogfood application points into staging (measured\n * 2026-11-08 over `examples/`). So a staging write cannot change a derivation, and the publication that can moves `dist`\n * and the accepted-generation manifest beside it, which are still walked. It was about 40 % of what a sweep stat'ed\n * (5,440 of Wonder Todos' 13,484 `backend-api` files). The change source ignores the same subtree.\n */\nconst COMPILE_STAGING_DIRECTORY_NAME = 'compile-staging';\nconst RUNTIME_SIGNALS_DIRECTORY_NAME = '.wildo-runtime-signals';\n\n/** What one root's walk learned: the components of its token. */\nexport interface SourceWalkAccumulator {\n fileCount: number;\n directoryCount: number;\n maximumMtimeMs: number;\n}\n\n/** One walk: the roots, and the bounds the observer owns. */\nexport interface SourceWalkRequest {\n readonly roots: readonly string[];\n /** Entries the observation already counted (manifests, held roots), so the ceiling bounds the whole sweep. */\n readonly entryCountBefore: number;\n /** Past this the walk stops and reports `exceededCeiling`; see the observer's `MAXIMUM_OBSERVED_ENTRIES`. */\n readonly maximumEntries: number;\n /** `DIRECTORY_WALK_CONCURRENCY`, passed rather than imported (see the module comment). */\n readonly directoryConcurrency: number;\n /** `FILE_STAT_CONCURRENCY`, passed rather than imported (see the module comment). */\n readonly fileStatConcurrency: number;\n}\n\n/** {@link walkSourceRoots}'s answer: one accumulator per requested root, in request order. */\nexport interface SourceWalkResult {\n readonly accumulators: readonly SourceWalkAccumulator[];\n readonly entryCount: number;\n readonly exceededCeiling: boolean;\n}\n\n/** A directory still to visit, and the component its entries count towards. */\ninterface PendingDirectory {\n readonly directory: string;\n readonly accumulator: SourceWalkAccumulator;\n}\n\n/** The whole walk's running total, so the ceiling bounds the walk rather than any one root. */\ninterface WalkTotals {\n entryCount: number;\n exceededCeiling: boolean;\n readonly maximumEntries: number;\n /** Shared by every directory of the walk, so the bound is on the walk and not per directory. */\n readonly statPermits: StatPermits;\n}\n\n/** A counting semaphore for the file-stat bound. */\nclass StatPermits {\n private available: number;\n private readonly waiting: Array<() => void> = [];\n\n constructor(permits: number) {\n this.available = permits;\n }\n\n public async run<T>(operation: () => Promise<T>): Promise<T> {\n if (this.available > 0) {\n this.available -= 1;\n } else {\n // A released permit is handed straight to the next waiter, so `available` never rises while\n // anyone is waiting and no waiter can be overtaken by a later caller.\n await new Promise<void>((resolveWait) => this.waiting.push(resolveWait));\n }\n try {\n return await operation();\n } finally {\n const next = this.waiting.shift();\n if (next) next();\n else this.available += 1;\n }\n }\n}\n\n/**\n * Walk the roots and return one accumulator per root. Never rejects for a root that cannot be read: it contributes\n * nothing, and when it appears later it is a new directory, which moves the counts.\n */\nexport async function walkSourceRoots(request: SourceWalkRequest): Promise<SourceWalkResult> {\n const accumulators = request.roots.map((): SourceWalkAccumulator => ({ fileCount: 0, directoryCount: 0, maximumMtimeMs: 0 }));\n const totals: WalkTotals = {\n entryCount: request.entryCountBefore,\n exceededCeiling: false,\n maximumEntries: request.maximumEntries,\n statPermits: new StatPermits(request.fileStatConcurrency),\n };\n await walk(request.roots.map((directory, index) => ({ directory, accumulator: accumulators[index]! })), totals, request.directoryConcurrency);\n return { accumulators, entryCount: totals.entryCount, exceededCeiling: totals.exceededCeiling };\n}\n\n/**\n * Breadth-of-tree walk with a fixed directory concurrency.\n *\n * A worker-pool built over the ROOT list was written first and was wrong: it sizes its pool from\n * the number of roots, so a single-root application would walk its whole tree one directory at a\n * time, and a worker that finds the queue momentarily empty cannot tell \"finished\" from \"another\n * worker is about to push children\". The pump below sizes on IN-FLIGHT directories instead, which\n * is the quantity the concurrency limit is actually about, and terminates on the only condition\n * that means finished: nothing queued and nothing running.\n */\nasync function walk(roots: readonly PendingDirectory[], totals: WalkTotals, directoryConcurrency: number): Promise<void> {\n const pending: PendingDirectory[] = [...roots];\n let inFlightDirectories = 0;\n\n return new Promise<void>((resolveWalk) => {\n const pump = (): void => {\n while (!totals.exceededCeiling && inFlightDirectories < directoryConcurrency && pending.length > 0) {\n const next = pending.pop() as PendingDirectory;\n inFlightDirectories += 1;\n void visitDirectory(next, totals, pending).then(() => {\n inFlightDirectories -= 1;\n pump();\n });\n }\n\n if (inFlightDirectories === 0 && (pending.length === 0 || totals.exceededCeiling)) {\n resolveWalk();\n }\n };\n\n pump();\n });\n}\n\n/**\n * Read one directory: count it, fold its own mtime in, stat its files, and queue its children.\n *\n * Never rejects. A directory that cannot be read (an unbuilt `dist`, a permission) contributes\n * nothing and is not an error — when it appears later it is a new directory, which moves the\n * counts and invalidates every cached derivation.\n */\nasync function visitDirectory({ directory, accumulator }: PendingDirectory, totals: WalkTotals, pending: PendingDirectory[]): Promise<void> {\n let entries;\n try {\n entries = await fsPromises.readdir(directory, { withFileTypes: true });\n } catch {\n return;\n }\n\n accumulator.directoryCount += 1;\n totals.entryCount += 1;\n try {\n const directoryStats = await fsPromises.stat(directory);\n if (directoryStats.mtimeMs > accumulator.maximumMtimeMs) {\n accumulator.maximumMtimeMs = directoryStats.mtimeMs;\n }\n } catch {\n // Counted above regardless: the directory demonstrably exists, we just read it.\n }\n\n const fileStats: Promise<void>[] = [];\n const insideRuntimeSignals = basename(directory) === RUNTIME_SIGNALS_DIRECTORY_NAME;\n for (const entry of entries) {\n if (SKIPPED_DIRECTORY_NAMES.has(entry.name)) continue;\n if (insideRuntimeSignals && entry.name === COMPILE_STAGING_DIRECTORY_NAME) continue;\n const entryPath = join(directory, entry.name);\n if (entry.isDirectory()) {\n pending.push({ directory: entryPath, accumulator });\n continue;\n }\n if (!entry.isFile()) {\n // A symlink is counted but never followed — following one inside a package tree can walk\n // back out into a dependency graph. Retargeting one rewrites its directory entry, which\n // moves the parent directory's mtime, so the change is still observed.\n accumulator.fileCount += 1;\n totals.entryCount += 1;\n continue;\n }\n totals.entryCount += 1;\n fileStats.push(\n totals.statPermits.run(() => fsPromises.stat(entryPath)).then(\n (entryStats) => {\n accumulator.fileCount += 1;\n if (entryStats.mtimeMs > accumulator.maximumMtimeMs) {\n accumulator.maximumMtimeMs = entryStats.mtimeMs;\n }\n },\n () => {\n accumulator.fileCount += 1;\n },\n ),\n );\n }\n await Promise.all(fileStats);\n\n if (totals.entryCount > totals.maximumEntries) {\n totals.exceededCeiling = true;\n }\n}\n\n/** Marks a thread started by {@link SourceWalkWorker}, so importing this module elsewhere starts nothing. */\nconst SOURCE_WALK_WORKER_KIND = 'wildo.introspection-source-walk';\n\ninterface SourceWalkWorkerMessage {\n readonly id: number;\n readonly result?: SourceWalkResult;\n readonly error?: string;\n}\n\n// The worker side: answer each request with the same function the companion would run in process.\nif (!isMainThread && parentPort !== null && (workerData as { kind?: unknown } | undefined)?.kind === SOURCE_WALK_WORKER_KIND) {\n const port = parentPort;\n port.on('message', (message: { readonly id: number; readonly request: SourceWalkRequest }) => {\n walkSourceRoots(message.request).then(\n (result) => port.postMessage({ id: message.id, result } satisfies SourceWalkWorkerMessage),\n (error: unknown) => port.postMessage({ id: message.id, error: describeCaughtError(error) } satisfies SourceWalkWorkerMessage),\n );\n });\n}\n\n/**\n * The companion's side: one long-lived worker thread, started on first use and shared by every observer (two sweep the\n * same roots). Unreferenced, so it never keeps the process alive.\n *\n * Fails toward the in-process walk, never toward a wrong token: a worker that cannot start, errors or exits fails its\n * pending walks with a {@link SourceWalkWorkerUnavailableError}, the caller walks in process, and the next walk starts\n * a fresh worker. After {@link MAXIMUM_WORKER_FAILURES} consecutive failures it stops trying for the life of the process,\n * so a worker that can never start costs one failed start per walk at most a few times, not on every observation.\n */\nexport class SourceWalkWorker {\n private worker: Worker | undefined;\n private nextId = 1;\n private consecutiveFailures = 0;\n private readonly pending = new Map<number, { resolve: (result: SourceWalkResult) => void; reject: (error: Error) => void }>();\n // A plain field, not a parameter property: this file runs under type stripping, which refuses non-erasable syntax.\n private readonly options: { readonly entryPath?: string };\n\n public constructor(options: { readonly entryPath?: string } = {}) {\n this.options = options;\n }\n\n /** The walk, on the worker; rejects with {@link SourceWalkWorkerUnavailableError} when no worker can do it. */\n public walk(request: SourceWalkRequest): Promise<SourceWalkResult> {\n const worker = this.ensureWorker();\n if (worker === undefined) return Promise.reject(new SourceWalkWorkerUnavailableError('no source-walk worker is available'));\n const id = this.nextId;\n this.nextId += 1;\n return new Promise<SourceWalkResult>((resolve, reject) => {\n this.pending.set(id, { resolve, reject });\n // Referenced only while a walk is pending, so a running walk is never cut short by the process idling out.\n if (this.pending.size === 1) worker.ref();\n worker.postMessage({ id, request });\n });\n }\n\n /** Whether the worker has been given up on for this process. For tests and logs. */\n public get disabled(): boolean {\n return this.consecutiveFailures >= MAXIMUM_WORKER_FAILURES;\n }\n\n /** Stop the worker (tests). A walk it was doing fails as unavailable, so its caller walks in process. */\n public async close(): Promise<void> {\n const worker = this.worker;\n if (worker === undefined) return;\n this.failPending(worker, 'the source-walk worker was closed');\n await worker.terminate();\n }\n\n private ensureWorker(): Worker | undefined {\n if (this.worker !== undefined) return this.worker;\n if (this.disabled) return undefined;\n let worker: Worker;\n try {\n worker = new Worker(this.options.entryPath ?? resolveSourceWalkWorkerEntry(), { workerData: { kind: SOURCE_WALK_WORKER_KIND } });\n } catch {\n this.consecutiveFailures += 1;\n return undefined;\n }\n worker.unref();\n worker.on('message', (message: SourceWalkWorkerMessage) => {\n const waiter = this.pending.get(message.id);\n if (waiter === undefined) return;\n this.pending.delete(message.id);\n if (this.pending.size === 0) worker.unref();\n if (message.result !== undefined) {\n this.consecutiveFailures = 0;\n waiter.resolve(message.result);\n } else {\n waiter.reject(new SourceWalkWorkerUnavailableError(message.error ?? 'the source-walk worker answered nothing'));\n }\n });\n const fail = (reason: string): void => {\n if (this.worker !== worker) return;\n this.consecutiveFailures += 1;\n this.failPending(worker, reason);\n // A failure that is not an exit (an error, an unreadable answer) leaves the thread running: stop the one it forgot.\n void worker.terminate().catch(() => undefined);\n };\n worker.on('error', (error: Error) => fail(`the source-walk worker failed: ${error.message}`));\n worker.on('exit', (code: number) => fail(`the source-walk worker exited (code ${code})`));\n // An answer that cannot be deserialized would otherwise leave its walk pending for good.\n worker.on('messageerror', (error: Error) => fail(`the source-walk worker's answer could not be read: ${error.message}`));\n this.worker = worker;\n return worker;\n }\n\n /** Forget the worker and fail every walk it was doing as unavailable, so each is walked in process. */\n private failPending(worker: Worker, reason: string): void {\n if (this.worker !== worker) return;\n this.worker = undefined;\n const waiters = [...this.pending.values()];\n this.pending.clear();\n for (const waiter of waiters) waiter.reject(new SourceWalkWorkerUnavailableError(reason));\n }\n}\n\n/** A walk the worker could not do; the caller walks in process instead. */\nexport class SourceWalkWorkerUnavailableError extends Error {\n public override readonly name = 'SourceWalkWorkerUnavailableError';\n}\n\n/** Consecutive worker failures after which the companion walks in process for the rest of its life. */\nexport const MAXIMUM_WORKER_FAILURES = 3;\n\n/** This module's own file: the compiled `.js` in a build, the `.ts` when the companion runs from source. */\nfunction resolveSourceWalkWorkerEntry(): string {\n const own = fileURLToPath(import.meta.url);\n if (existsSync(own)) return own;\n throw new SourceWalkWorkerUnavailableError(`the source-walk worker entry ${own} does not exist`);\n}\n"]}
@@ -19,7 +19,22 @@ export declare enum CompanionLanguageModelTransport {
19
19
  }
20
20
  /** The model the companion's routed calls run on: Opus 5.5, the model its coding and research lane already uses. */
21
21
  export declare const COMPANION_LANGUAGE_MODEL_ROUTE_MODEL = LLM_Model.CLAUDE_OPUS_5_5;
22
+ /**
23
+ * Where this process says "a routed language-model call is running", app-root-relative. Beaten while any session of
24
+ * the route is open and removed when none is, so the dev supervisor holds a restart that would kill it (the label and
25
+ * translate runs hold no lock and are no playbook run, so nothing else said so).
26
+ *
27
+ * A COPY of `LANGUAGE_MODEL_RUN_HEARTBEAT_RELATIVE_PATH` in
28
+ * `scripts/dev-orchestrator/runtime-supervisor-lifecycle.mjs`, pinned equal by
29
+ * `scripts/__tests__/runtime-supervisor-workspace-mutation-hold.test.mjs`.
30
+ */
31
+ export declare const LANGUAGE_MODEL_RUN_HEARTBEAT_RELATIVE_PATH = ".wildo-saas/state/language-model-run.heartbeat";
32
+ /**
33
+ * The route's `onSessionsInFlightChange` for a companion rooted at `saasRoot`: the heartbeat file exists exactly while
34
+ * a routed session is open.
35
+ */
36
+ export declare function createLanguageModelRunHeartbeatReporter(saasRoot: string, reportFailure: (message: string, error: unknown) => void): (sessionsInFlight: number) => void;
22
37
  export declare function resolveCompanionLanguageModelTransport(environment?: NodeJS.ProcessEnv): CompanionLanguageModelTransport;
23
38
  /** The route the companion installs, or undefined when its calls stay on the API keys. */
24
- export declare function resolveCompanionLanguageModelRoute(environment?: NodeJS.ProcessEnv): LanguageModelAgentClientProtocolRoute | undefined;
39
+ export declare function resolveCompanionLanguageModelRoute(environment?: NodeJS.ProcessEnv, onSessionsInFlightChange?: (sessionsInFlight: number) => void): LanguageModelAgentClientProtocolRoute | undefined;
25
40
  //# sourceMappingURL=companion-language-model-route.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"companion-language-model-route.d.ts","sourceRoot":"","sources":["../../../../src/core/runtime/companion-language-model-route.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AAIxF;;;;;;;;;;GAUG;AACH,oBAAY,+BAA+B;IACzC,qFAAqF;IACrF,qBAAqB,QAAQ;IAC7B,gDAAgD;IAChD,GAAG,QAAQ;CACZ;AAED,oHAAoH;AACpH,eAAO,MAAM,oCAAoC,4BAA4B,CAAC;AAkB9E,wBAAgB,sCAAsC,CAAC,WAAW,GAAE,MAAM,CAAC,UAAwB,GAAG,+BAA+B,CAMpI;AAED,0FAA0F;AAC1F,wBAAgB,kCAAkC,CAAC,WAAW,GAAE,MAAM,CAAC,UAAwB,GAAG,qCAAqC,GAAG,SAAS,CAgBlJ"}
1
+ {"version":3,"file":"companion-language-model-route.d.ts","sourceRoot":"","sources":["../../../../src/core/runtime/companion-language-model-route.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AAKxF;;;;;;;;;;GAUG;AACH,oBAAY,+BAA+B;IACzC,qFAAqF;IACrF,qBAAqB,QAAQ;IAC7B,gDAAgD;IAChD,GAAG,QAAQ;CACZ;AAED,oHAAoH;AACpH,eAAO,MAAM,oCAAoC,4BAA4B,CAAC;AAkB9E;;;;;;;;GAQG;AACH,eAAO,MAAM,0CAA0C,mDAAmD,CAAC;AAK3G;;;GAGG;AACH,wBAAgB,uCAAuC,CACrD,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,GACvD,CAAC,gBAAgB,EAAE,MAAM,KAAK,IAAI,CAGpC;AAED,wBAAgB,sCAAsC,CAAC,WAAW,GAAE,MAAM,CAAC,UAAwB,GAAG,+BAA+B,CAMpI;AAED,0FAA0F;AAC1F,wBAAgB,kCAAkC,CAChD,WAAW,GAAE,MAAM,CAAC,UAAwB,EAC5C,wBAAwB,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,IAAI,GAC5D,qCAAqC,GAAG,SAAS,CAiBnD"}
@@ -2,6 +2,7 @@ import { tmpdir } from 'node:os';
2
2
  import { join } from 'node:path';
3
3
  import { LLM_Model } from '@wildo-ai/external-connectors-models';
4
4
  import { APPLICATION_CODING_AGENT_BINDINGS } from '../../meta-workflows/models/application-coding-agent.actors-system.definitions.js';
5
+ import { InFlightWorkHeartbeat } from './in-flight-work-heartbeat.companion.js';
5
6
  /**
6
7
  * Where the companion's language-model calls run (#3472): Claude Code over ACP, on Opus 5.5, by default.
7
8
  *
@@ -36,6 +37,26 @@ const DEFAULT_MAXIMUM_CONCURRENT_SESSIONS = 4;
36
37
  const CALL_TIMEOUT_MS = 60 * 60 * 1000;
37
38
  /** Refused submissions before a call reports its last refusal to the lane's own correction loop. */
38
39
  const MAXIMUM_SUBMISSIONS = 6;
40
+ /**
41
+ * Where this process says "a routed language-model call is running", app-root-relative. Beaten while any session of
42
+ * the route is open and removed when none is, so the dev supervisor holds a restart that would kill it (the label and
43
+ * translate runs hold no lock and are no playbook run, so nothing else said so).
44
+ *
45
+ * A COPY of `LANGUAGE_MODEL_RUN_HEARTBEAT_RELATIVE_PATH` in
46
+ * `scripts/dev-orchestrator/runtime-supervisor-lifecycle.mjs`, pinned equal by
47
+ * `scripts/__tests__/runtime-supervisor-workspace-mutation-hold.test.mjs`.
48
+ */
49
+ export const LANGUAGE_MODEL_RUN_HEARTBEAT_RELATIVE_PATH = '.wildo-saas/state/language-model-run.heartbeat';
50
+ /** How often that file's mtime is refreshed; the supervisor judges it stale at three times this (`AGENT_RUN_HEARTBEAT_STALE_MS`). */
51
+ const LANGUAGE_MODEL_RUN_HEARTBEAT_INTERVAL_MS = 5_000;
52
+ /**
53
+ * The route's `onSessionsInFlightChange` for a companion rooted at `saasRoot`: the heartbeat file exists exactly while
54
+ * a routed session is open.
55
+ */
56
+ export function createLanguageModelRunHeartbeatReporter(saasRoot, reportFailure) {
57
+ const heartbeat = new InFlightWorkHeartbeat(join(saasRoot, LANGUAGE_MODEL_RUN_HEARTBEAT_RELATIVE_PATH), LANGUAGE_MODEL_RUN_HEARTBEAT_INTERVAL_MS, reportFailure);
58
+ return (sessionsInFlight) => heartbeat.sync(sessionsInFlight > 0);
59
+ }
39
60
  export function resolveCompanionLanguageModelTransport(environment = process.env) {
40
61
  const declared = environment.WILDO_LANGUAGE_MODEL_TRANSPORT?.trim().toLowerCase();
41
62
  if (declared === undefined || declared === '')
@@ -47,7 +68,7 @@ export function resolveCompanionLanguageModelTransport(environment = process.env
47
68
  throw new Error(`WILDO_LANGUAGE_MODEL_TRANSPORT="${declared}" is neither "acp" nor "api".`);
48
69
  }
49
70
  /** The route the companion installs, or undefined when its calls stay on the API keys. */
50
- export function resolveCompanionLanguageModelRoute(environment = process.env) {
71
+ export function resolveCompanionLanguageModelRoute(environment = process.env, onSessionsInFlightChange) {
51
72
  if (resolveCompanionLanguageModelTransport(environment) === CompanionLanguageModelTransport.API)
52
73
  return undefined;
53
74
  const sessions = Number.parseInt(environment.WILDO_LANGUAGE_MODEL_SESSIONS ?? '', 10);
@@ -64,6 +85,7 @@ export function resolveCompanionLanguageModelRoute(environment = process.env) {
64
85
  maximumConcurrentSessions: Number.isInteger(sessions) && sessions > 0 ? sessions : DEFAULT_MAXIMUM_CONCURRENT_SESSIONS,
65
86
  callTimeoutMs: CALL_TIMEOUT_MS,
66
87
  maximumSubmissions: MAXIMUM_SUBMISSIONS,
88
+ ...(onSessionsInFlightChange ? { onSessionsInFlightChange } : {}),
67
89
  };
68
90
  }
69
91
  //# sourceMappingURL=companion-language-model-route.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"companion-language-model-route.js","sourceRoot":"","sources":["../../../../src/core/runtime/companion-language-model-route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,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AAE,OAAO,SAAS,CAAC;IAClH,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,6BAA6B,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IACtF,MAAM,OAAO,GAAG,iCAAiC,CAAC,SAAS,CAAC;IAC5D,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,qGAAqG,CAAC,CAAC;IAClJ,OAAO;QACL,cAAc,EAAE,OAAO,CAAC,WAAW;QACnC,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;QAChD,KAAK,EAAE,oCAAoC;QAC3C,kBAAkB,EAAE,oBAAoB;QACxC,2GAA2G;QAC3G,gBAAgB,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,+BAA+B,CAAC;QACjE,yBAAyB,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,mCAAmC;QACtH,aAAa,EAAE,eAAe;QAC9B,kBAAkB,EAAE,mBAAmB;KACxC,CAAC;AACJ,CAAC","sourcesContent":["import { tmpdir } from 'node:os';\nimport { join } from 'node:path';\n\nimport { LLM_Model } from '@wildo-ai/external-connectors-models';\nimport type { LanguageModelAgentClientProtocolRoute } from '@wildo-ai/saas-backend-lib';\n\nimport { APPLICATION_CODING_AGENT_BINDINGS } from '../../meta-workflows/models/application-coding-agent.actors-system.definitions';\n\n/**\n * Where the companion's language-model calls run (#3472): Claude Code over ACP, on Opus 5.5, by default.\n *\n * Decided by Paul, 2026-11-08, after the creation lane's cost on a metered Anthropic API key exploded: one reference\n * run made 177 calls for 7.3 M input and 1.9 M output tokens, all on the API, because the lane had been switched to\n * Claude through its API key rather than through the developer's own coding agent. The companion's text and structured\n * calls — every playbook generator, judge, panel and selector, labelling, e-mail templates — now run on the developer's\n * Claude Code login. Image generation stays on OpenAI's API (no ACP agent generates images).\n *\n * `WILDO_LANGUAGE_MODEL_TRANSPORT=api` keeps every call on the API keys, for a machine with no Claude Code login.\n */\nexport enum CompanionLanguageModelTransport {\n /** The developer's own coding agent, over the Agent Client Protocol. The default. */\n AGENT_CLIENT_PROTOCOL = 'acp',\n /** The providers' API keys, as before #3472. */\n API = 'api',\n}\n\n/** The model the companion's routed calls run on: Opus 5.5, the model its coding and research lane already uses. */\nexport const COMPANION_LANGUAGE_MODEL_ROUTE_MODEL = LLM_Model.CLAUDE_OPUS_5_5;\n\n/**\n * Agents on these providers are routed. Both, so a text call left on OpenAI does not keep spending its API key: the\n * route moves the transport and the model, never the prompt or the schema.\n */\nconst ROUTED_PROVIDER_REFS = ['anthropic', 'openai'] as const;\n\n/**\n * Concurrent sessions. Each one is an adapter process plus a Claude Code process; the lane runs up to three lanes,\n * and a deliberation fans out three candidates and a panel, so four keeps the lane moving without exhausting memory.\n */\nconst DEFAULT_MAXIMUM_CONCURRENT_SESSIONS = 4;\n/** One call, all its turns: the structured-generation total deadline the API path uses (#3204). */\nconst CALL_TIMEOUT_MS = 60 * 60 * 1000;\n/** Refused submissions before a call reports its last refusal to the lane's own correction loop. */\nconst MAXIMUM_SUBMISSIONS = 6;\n\nexport function resolveCompanionLanguageModelTransport(environment: NodeJS.ProcessEnv = process.env): CompanionLanguageModelTransport {\n const declared = environment.WILDO_LANGUAGE_MODEL_TRANSPORT?.trim().toLowerCase();\n if (declared === undefined || declared === '') return CompanionLanguageModelTransport.AGENT_CLIENT_PROTOCOL;\n if (declared === CompanionLanguageModelTransport.API) return CompanionLanguageModelTransport.API;\n if (declared === CompanionLanguageModelTransport.AGENT_CLIENT_PROTOCOL) return CompanionLanguageModelTransport.AGENT_CLIENT_PROTOCOL;\n throw new Error(`WILDO_LANGUAGE_MODEL_TRANSPORT=\"${declared}\" is neither \"acp\" nor \"api\".`);\n}\n\n/** The route the companion installs, or undefined when its calls stay on the API keys. */\nexport function resolveCompanionLanguageModelRoute(environment: NodeJS.ProcessEnv = process.env): LanguageModelAgentClientProtocolRoute | undefined {\n if (resolveCompanionLanguageModelTransport(environment) === CompanionLanguageModelTransport.API) return undefined;\n const sessions = Number.parseInt(environment.WILDO_LANGUAGE_MODEL_SESSIONS ?? '', 10);\n const binding = APPLICATION_CODING_AGENT_BINDINGS.anthropic;\n if (binding === undefined) throw new Error('The companion declares no anthropic coding-agent binding to route its language-model calls through.');\n return {\n acpProviderRef: binding.providerRef,\n executionProfileRef: binding.executionProfileRef,\n model: COMPANION_LANGUAGE_MODEL_ROUTE_MODEL,\n routedProviderRefs: ROUTED_PROVIDER_REFS,\n // Outside every application workspace, so a session can never read or write the application it writes FOR.\n scratchDirectory: join(tmpdir(), 'wildo-language-model-sessions'),\n maximumConcurrentSessions: Number.isInteger(sessions) && sessions > 0 ? sessions : DEFAULT_MAXIMUM_CONCURRENT_SESSIONS,\n callTimeoutMs: CALL_TIMEOUT_MS,\n maximumSubmissions: MAXIMUM_SUBMISSIONS,\n };\n}\n"]}
1
+ {"version":3,"file":"companion-language-model-route.js","sourceRoot":"","sources":["../../../../src/core/runtime/companion-language-model-route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAGjE,OAAO,EAAE,iCAAiC,EAAE,MAAM,gFAAgF,CAAC;AACnI,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E;;;;;;;;;;GAUG;AACH,MAAM,CAAN,IAAY,+BAKX;AALD,WAAY,+BAA+B;IACzC,qFAAqF;IACrF,gEAA6B,CAAA;IAC7B,gDAAgD;IAChD,8CAAW,CAAA;AACb,CAAC,EALW,+BAA+B,KAA/B,+BAA+B,QAK1C;AAED,oHAAoH;AACpH,MAAM,CAAC,MAAM,oCAAoC,GAAG,SAAS,CAAC,eAAe,CAAC;AAE9E;;;GAGG;AACH,MAAM,oBAAo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,wBAA6D;IAE7D,IAAI,sCAAsC,CAAC,WAAW,CAAC,KAAK,+BAA+B,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAClH,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,6BAA6B,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IACtF,MAAM,OAAO,GAAG,iCAAiC,CAAC,SAAS,CAAC;IAC5D,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,qGAAqG,CAAC,CAAC;IAClJ,OAAO;QACL,cAAc,EAAE,OAAO,CAAC,WAAW;QACnC,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;QAChD,KAAK,EAAE,oCAAoC;QAC3C,kBAAkB,EAAE,oBAAoB;QACxC,2GAA2G;QAC3G,gBAAgB,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,+BAA+B,CAAC;QACjE,yBAAyB,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,mCAAmC;QACtH,aAAa,EAAE,eAAe;QAC9B,kBAAkB,EAAE,mBAAmB;QACvC,GAAG,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,wBAAwB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClE,CAAC;AACJ,CAAC","sourcesContent":["import { tmpdir } from 'node:os';\nimport { join } from 'node:path';\n\nimport { LLM_Model } from '@wildo-ai/external-connectors-models';\nimport type { LanguageModelAgentClientProtocolRoute } from '@wildo-ai/saas-backend-lib';\n\nimport { APPLICATION_CODING_AGENT_BINDINGS } from '../../meta-workflows/models/application-coding-agent.actors-system.definitions';\nimport { InFlightWorkHeartbeat } from './in-flight-work-heartbeat.companion';\n\n/**\n * Where the companion's language-model calls run (#3472): Claude Code over ACP, on Opus 5.5, by default.\n *\n * Decided by Paul, 2026-11-08, after the creation lane's cost on a metered Anthropic API key exploded: one reference\n * run made 177 calls for 7.3 M input and 1.9 M output tokens, all on the API, because the lane had been switched to\n * Claude through its API key rather than through the developer's own coding agent. The companion's text and structured\n * calls — every playbook generator, judge, panel and selector, labelling, e-mail templates — now run on the developer's\n * Claude Code login. Image generation stays on OpenAI's API (no ACP agent generates images).\n *\n * `WILDO_LANGUAGE_MODEL_TRANSPORT=api` keeps every call on the API keys, for a machine with no Claude Code login.\n */\nexport enum CompanionLanguageModelTransport {\n /** The developer's own coding agent, over the Agent Client Protocol. The default. */\n AGENT_CLIENT_PROTOCOL = 'acp',\n /** The providers' API keys, as before #3472. */\n API = 'api',\n}\n\n/** The model the companion's routed calls run on: Opus 5.5, the model its coding and research lane already uses. */\nexport const COMPANION_LANGUAGE_MODEL_ROUTE_MODEL = LLM_Model.CLAUDE_OPUS_5_5;\n\n/**\n * Agents on these providers are routed. Both, so a text call left on OpenAI does not keep spending its API key: the\n * route moves the transport and the model, never the prompt or the schema.\n */\nconst ROUTED_PROVIDER_REFS = ['anthropic', 'openai'] as const;\n\n/**\n * Concurrent sessions. Each one is an adapter process plus a Claude Code process; the lane runs up to three lanes,\n * and a deliberation fans out three candidates and a panel, so four keeps the lane moving without exhausting memory.\n */\nconst DEFAULT_MAXIMUM_CONCURRENT_SESSIONS = 4;\n/** One call, all its turns: the structured-generation total deadline the API path uses (#3204). */\nconst CALL_TIMEOUT_MS = 60 * 60 * 1000;\n/** Refused submissions before a call reports its last refusal to the lane's own correction loop. */\nconst MAXIMUM_SUBMISSIONS = 6;\n\n/**\n * Where this process says \"a routed language-model call is running\", app-root-relative. Beaten while any session of\n * the route is open and removed when none is, so the dev supervisor holds a restart that would kill it (the label and\n * translate runs hold no lock and are no playbook run, so nothing else said so).\n *\n * A COPY of `LANGUAGE_MODEL_RUN_HEARTBEAT_RELATIVE_PATH` in\n * `scripts/dev-orchestrator/runtime-supervisor-lifecycle.mjs`, pinned equal by\n * `scripts/__tests__/runtime-supervisor-workspace-mutation-hold.test.mjs`.\n */\nexport const LANGUAGE_MODEL_RUN_HEARTBEAT_RELATIVE_PATH = '.wildo-saas/state/language-model-run.heartbeat';\n\n/** How often that file's mtime is refreshed; the supervisor judges it stale at three times this (`AGENT_RUN_HEARTBEAT_STALE_MS`). */\nconst LANGUAGE_MODEL_RUN_HEARTBEAT_INTERVAL_MS = 5_000;\n\n/**\n * The route's `onSessionsInFlightChange` for a companion rooted at `saasRoot`: the heartbeat file exists exactly while\n * a routed session is open.\n */\nexport function createLanguageModelRunHeartbeatReporter(\n saasRoot: string,\n reportFailure: (message: string, error: unknown) => void,\n): (sessionsInFlight: number) => void {\n const heartbeat = new InFlightWorkHeartbeat(join(saasRoot, LANGUAGE_MODEL_RUN_HEARTBEAT_RELATIVE_PATH), LANGUAGE_MODEL_RUN_HEARTBEAT_INTERVAL_MS, reportFailure);\n return (sessionsInFlight) => heartbeat.sync(sessionsInFlight > 0);\n}\n\nexport function resolveCompanionLanguageModelTransport(environment: NodeJS.ProcessEnv = process.env): CompanionLanguageModelTransport {\n const declared = environment.WILDO_LANGUAGE_MODEL_TRANSPORT?.trim().toLowerCase();\n if (declared === undefined || declared === '') return CompanionLanguageModelTransport.AGENT_CLIENT_PROTOCOL;\n if (declared === CompanionLanguageModelTransport.API) return CompanionLanguageModelTransport.API;\n if (declared === CompanionLanguageModelTransport.AGENT_CLIENT_PROTOCOL) return CompanionLanguageModelTransport.AGENT_CLIENT_PROTOCOL;\n throw new Error(`WILDO_LANGUAGE_MODEL_TRANSPORT=\"${declared}\" is neither \"acp\" nor \"api\".`);\n}\n\n/** The route the companion installs, or undefined when its calls stay on the API keys. */\nexport function resolveCompanionLanguageModelRoute(\n environment: NodeJS.ProcessEnv = process.env,\n onSessionsInFlightChange?: (sessionsInFlight: number) => void,\n): LanguageModelAgentClientProtocolRoute | undefined {\n if (resolveCompanionLanguageModelTransport(environment) === CompanionLanguageModelTransport.API) return undefined;\n const sessions = Number.parseInt(environment.WILDO_LANGUAGE_MODEL_SESSIONS ?? '', 10);\n const binding = APPLICATION_CODING_AGENT_BINDINGS.anthropic;\n if (binding === undefined) throw new Error('The companion declares no anthropic coding-agent binding to route its language-model calls through.');\n return {\n acpProviderRef: binding.providerRef,\n executionProfileRef: binding.executionProfileRef,\n model: COMPANION_LANGUAGE_MODEL_ROUTE_MODEL,\n routedProviderRefs: ROUTED_PROVIDER_REFS,\n // Outside every application workspace, so a session can never read or write the application it writes FOR.\n scratchDirectory: join(tmpdir(), 'wildo-language-model-sessions'),\n maximumConcurrentSessions: Number.isInteger(sessions) && sessions > 0 ? sessions : DEFAULT_MAXIMUM_CONCURRENT_SESSIONS,\n callTimeoutMs: CALL_TIMEOUT_MS,\n maximumSubmissions: MAXIMUM_SUBMISSIONS,\n ...(onSessionsInFlightChange ? { onSessionsInFlightChange } : {}),\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"start-companion-application.service.d.ts","sourceRoot":"","sources":["../../../../../src/core/runtime/services/start-companion-application.service.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,kBAAkB,EAClB,KAAK,oBAAoB,EACzB,KAAK,qCAAqC,EAE1C,wBAAwB,EACxB,cAAc,EACd,gCAAgC,EAChC,YAAY,EACZ,+BAA+B,EAC/B,uCAAuC,EACvC,2BAA2B,EAC3B,mCAAmC,EACnC,0BAA0B,EAC1B,wCAAwC,EACxC,+BAA+B,EAC/B,qCAAqC,EACrC,yCAAyC,EACzC,2DAA2D,EAK3D,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACpC,KAAK,gCAAgC,EACrC,KAAK,iCAAiC,EACtC,KAAK,aAAa,EAClB,KAAK,yCAAyC,EAE/C,MAAM,4BAA4B,CAAC;AAkBpC,OAAO,EAEL,KAAK,mCAAmC,EACzC,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAIlF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mDAAmD,CA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AC,0BAA0B;IAoBlC;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB;IAkBhC;;;;;;;;;;;;;OAaG;YACW,gCAAgC;IAuE9C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,uCAAuC,CAc7D;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,OAAO,CAAC,iCAAiC;IA8CzC;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qCAAqC,CAmB3D;YAEY,sCAAsC;YA8FtC,yBAAyB;IAMvC,+EAA+E;IACxE,mBAAmB,IAAI,OAAO;IAIrC;;;;OAIG;IACI,4BAA4B,IAAI,OAAO;IAIvC,aAAa,IAAI,MAAM,GAAG,IAAI;IAIrC;;;;;;;;;OASG;IACH,OAAO,CAAC,gCAAgC;IAkDxC,OAAO,CAAC,8BAA8B;IAWtC;;;;;;OAMG;IACH,OAAO,CAAC,kCAAkC;IAoC1C,4FAA4F;YAC9E,sBAAsB;CAiBrC"}
1
+ {"version":3,"file":"start-companion-application.service.d.ts","sourceRoot":"","sources":["../../../../../src/core/runtime/services/start-companion-application.service.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,kBAAkB,EAClB,KAAK,oBAAoB,EACzB,KAAK,qCAAqC,EAE1C,wBAAwB,EACxB,cAAc,EACd,gCAAgC,EAChC,YAAY,EACZ,+BAA+B,EAC/B,uCAAuC,EACvC,2BAA2B,EAC3B,mCAAmC,EACnC,0BAA0B,EAC1B,wCAAwC,EACxC,+BAA+B,EAC/B,qCAAqC,EACrC,yCAAyC,EACzC,2DAA2D,EAK3D,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACpC,KAAK,gCAAgC,EACrC,KAAK,iCAAiC,EACtC,KAAK,aAAa,EAClB,KAAK,yCAAyC,EAE/C,MAAM,4BAA4B,CA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lC,4BAA4B;IA6B1C;;;;;OAKG;IACH,OAAO,CAAC,2BAA2B;IAMnC;;;;OAIG;IACH,OAAO,CAAC,6BAA6B;IAMrC;;;;;;;;;;;;;;;;;;OAkBG;YACW,wBAAwB;IAatC;;;;;;;;;OASG;IACH,OAAO,CAAC,0BAA0B;IAoBlC;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB;IAkBhC;;;;;;;;;;;;;OAaG;YACW,gCAAgC;IAuE9C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,uCAAuC,CAc7D;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,OAAO,CAAC,iCAAiC;IA8CzC;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qCAAqC,CAmB3D;YAEY,sCAAsC;YA8FtC,yBAAyB;IAMvC,+EAA+E;IACxE,mBAAmB,IAAI,OAAO;IAIrC;;;;OAIG;IACI,4BAA4B,IAAI,OAAO;IAIvC,aAAa,IAAI,MAAM,GAAG,IAAI;IAIrC;;;;;;;;;OASG;IACH,OAAO,CAAC,gCAAgC;IAkDxC,OAAO,CAAC,8BAA8B;IAWtC;;;;;;OAMG;IACH,OAAO,CAAC,kCAAkC;IAoC1C,4FAA4F;YAC9E,sBAAsB;CAiBrC"}
@@ -14,7 +14,7 @@ var StartCompanionApplicationService_1;
14
14
  import { chmodSync, mkdirSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
15
15
  import { dirname, join } from 'node:path';
16
16
  import { COMPANION_MODEL_APPLICABILITY_PREFERENCE } from '../companion-model-preference.js';
17
- import { resolveCompanionLanguageModelRoute } from '../companion-language-model-route.js';
17
+ import { createLanguageModelRunHeartbeatReporter, resolveCompanionLanguageModelRoute } from '../companion-language-model-route.js';
18
18
  import { injectable, inject, optional } from 'inversify';
19
19
  import { I18nBackendService, SAAS_SERVICE_TYPES, HttpServerBackendService, MongoDBService, PostgreSQLDatabaseBackendService, RedisService, FileStorageRouterBackendService, ExternalProvidersRegistryBackendService, ObservabilityBackendService, WorkerShutdownManagerBackendService, FlowsActorsRegistryService, ControllersRegistryHandlerBackendService, ResourcesRegistryBackendService, ServicesRegistryHandlerBackendService, RepositoriesRegistryHandlerBackendService, ResourceOperationCustomImplementationRegistryBackendService, mergeBackendDomainModules, projectCaughtErrorLogFields, projectRetriedAttemptErrorLogFields, resolveBackendProviderRegistry, describeCaughtError, } from '@wildo-ai/saas-backend-lib';
20
20
  import { CoreResourceType, buildSharedSaaSModulesRegistry, ENGINE_RUNTIME_REQUIRED_RESOURCE_TYPES, } from '@wildo-ai/saas-models';
@@ -697,7 +697,8 @@ let StartCompanionApplicationService = class StartCompanionApplicationService {
697
697
  * every surface of the companion for a cost concern, and the error is what makes the cost visible.
698
698
  */
699
699
  installLanguageModelRoute() {
700
- const route = resolveCompanionLanguageModelRoute();
700
+ // The heartbeat that holds a supervisor restart while a routed call's agent is running (#3472, 2026-11-15).
701
+ const route = resolveCompanionLanguageModelRoute(process.env, createLanguageModelRunHeartbeatReporter(this.companionContext.saasRoot, (message, error) => this.logger.warn(message, { reason: describeCaughtError(error) })));
701
702
  if (route === undefined) {
702
703
  this.logger.info('Language-model calls stay on the API keys (WILDO_LANGUAGE_MODEL_TRANSPORT=api)');
703
704
  return;