@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
@@ -1,4 +1,5 @@
1
1
  import type { CompanionContext } from '../../context/companion-context';
2
+ import { SourceWalkWorker, type SourceWalkRequest, type SourceWalkResult } from './introspection-source-walk.worker';
2
3
  /** Forget every held root walk. For tests. */
3
4
  export declare function forgetHeldSourceRootWalks(): void;
4
5
  /**
@@ -47,6 +48,8 @@ export interface IntrospectionSourceStateComponents {
47
48
  readonly shared: string;
48
49
  readonly byApplicationRoot: ReadonlyMap<string, string>;
49
50
  }
51
+ /** Walk on `worker`, or in process when no worker can (a harness, a failed start, a dead worker). Exported for tests. */
52
+ export declare function walkWithInProcessFallback(worker: SourceWalkWorker, request: SourceWalkRequest): Promise<SourceWalkResult>;
50
53
  /**
51
54
  * Observes the state of every source tree an introspection derivation can read, as one comparable
52
55
  * token.
@@ -130,7 +133,11 @@ export declare class IntrospectionSourceStateObserver {
130
133
  private readonly companionContext;
131
134
  private observationSequence;
132
135
  private inFlight;
133
- constructor(companionContext: Pick<CompanionContext, 'saasRoot' | 'companionHome' | 'servicesByKey' | 'resolvedLibraries' | 'resolvedSpecifications'>);
136
+ /** The walk: on the process's worker thread by default (#3204); a test may substitute one. */
137
+ private readonly walkRoots;
138
+ constructor(companionContext: Pick<CompanionContext, 'saasRoot' | 'companionHome' | 'servicesByKey' | 'resolvedLibraries' | 'resolvedSpecifications'>, options?: {
139
+ readonly walkRoots?: (request: SourceWalkRequest) => Promise<SourceWalkResult>;
140
+ });
134
141
  /**
135
142
  * Take a reading of the source trees, reusing an in-flight one ONLY when that reading started at
136
143
  * or after the caller's own arrival.
@@ -215,25 +222,6 @@ export declare class IntrospectionSourceStateObserver {
215
222
  * token unique and every cache read a miss.
216
223
  */
217
224
  private observeApplicationRootManifests;
218
- /**
219
- * Breadth-of-tree walk with a fixed directory concurrency.
220
- *
221
- * A worker-pool built over the ROOT list was written first and was wrong: it sizes its pool from
222
- * the number of roots, so a single-root application would walk its whole tree one directory at a
223
- * time, and a worker that finds the queue momentarily empty cannot tell "finished" from "another
224
- * worker is about to push children". The pump below sizes on IN-FLIGHT directories instead, which
225
- * is the quantity the concurrency limit is actually about, and terminates on the only condition
226
- * that means finished: nothing queued and nothing running.
227
- */
228
- private walk;
229
- /**
230
- * Read one directory: count it, fold its own mtime in, stat its files, and queue its children.
231
- *
232
- * Never rejects. A directory that cannot be read (an unbuilt `dist`, a permission) contributes
233
- * nothing and is not an error — when it appears later it is a new directory, which moves the
234
- * counts and invalidates every cached derivation.
235
- */
236
- private visitDirectory;
237
225
  }
238
226
  /**
239
227
  * Every APPLICATION package an introspection derivation can import: each declared service, each
@@ -1 +1 @@
1
- {"version":3,"file":"introspection-source-state.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/core/introspection/services/introspection-source-state.companion.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAgCxE,8CAA8C;AAC9C,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD;AAcD;;GAEG;AACH,MAAM,WAAW,mCAAmC;IAClD;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,4FAA4F;IAC5F,UAAU,EAA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QAAQ,CAAC,uBAAuB,EAAE,SAAS,MAAM,EAAE,CAAC;KACrD,CAAC;IAwDF;;;;;;;;;;;;;OAaG;YACW,+BAA+B;IAwB7C;;;;;;;;;OASG;YACW,IAAI;IA4BlB;;;;;;OAMG;YACW,cAAc;CA8D7B;AAED;;;;;;;GAOG;AACH,wBAAgB,0CAA0C,CACxD,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,eAAe,GAAG,mBAAmB,GAAG,wBAAwB,CAAC,GACtH,SAAS,MAAM,EAAE,CAYnB;AAED;;;GAGG;AACH,oBAAY,8BAA8B;IACxC;;;;;OAKG;IACH,iBAAiB,sBAAsB;IACvC;;;;OAIG;IACH,aAAa,kBAAkB;IAC/B;;;;OAIG;IACH,YAAY,iBAAiB;CAC9B;AAQD;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,8BAA8B,CAM/G;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,mCAAmC,CACvD,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAC,CA0C9D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAK3G"}
1
+ {"version":3,"file":"introspection-source-state.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/core/introspection/services/introspection-source-state.companion.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGxE,OAAO,EAAE,gBAAgB,EAAqD,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAQxK,8CAA8C;AAC9C,wBAAgB,yBAAyB,IAAI,IAAI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gB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAK3G"}
@@ -1,28 +1,9 @@
1
1
  import { promises as fsPromises } from 'node:fs';
2
- import { basename, join, resolve, sep } from 'node:path';
2
+ import { join, resolve, sep } from 'node:path';
3
3
  import { readApplicationPnpmSettings } from '@wildo-ai/platform-config-lib';
4
4
  import { activeDerivedInputChangeFeed } from '../../utils/derived-input-change-feed.companion.utils.js';
5
5
  import { DIRECTORY_WALK_CONCURRENCY, FILE_STAT_CONCURRENCY } from './introspection-source-state.concurrency.companion.js';
6
- /**
7
- * Directory names never descended into.
8
- *
9
- * `node_modules` is skipped during the walk and reached only through the explicit `@wildo-ai/*`
10
- * roots below: descending into it from an application package would sweep the app's entire
11
- * dependency graph (hundreds of thousands of files) to learn nothing the resolved engine roots do
12
- * not already say.
13
- */
14
- const SKIPPED_DIRECTORY_NAMES = new Set(['node_modules', '.git']);
15
- /**
16
- * The compiler's private output, never descended into when it sits in a package's `.wildo-runtime-signals` (#3452).
17
- *
18
- * A compile writes here first and publishes into `dist` once the emit is final, and nothing a derivation imports resolves
19
- * here: every package's `exports` name `dist`, and no link in any dogfood application points into staging (measured
20
- * 2026-11-08 over `examples/`). So a staging write cannot change a derivation, and the publication that can moves `dist`
21
- * and the accepted-generation manifest beside it, which are still walked. It was about 40 % of what a sweep stat'ed
22
- * (5,440 of Wonder Todos' 13,484 `backend-api` files). The change source ignores the same subtree.
23
- */
24
- const COMPILE_STAGING_DIRECTORY_NAME = 'compile-staging';
25
- const RUNTIME_SIGNALS_DIRECTORY_NAME = '.wildo-runtime-signals';
6
+ import { SourceWalkWorker, SourceWalkWorkerUnavailableError, walkSourceRoots } from './introspection-source-walk.worker.js';
26
7
  /**
27
8
  * A root's last walk, reused while the change feed vouches that no event touched the root since (#3452). Module-level
28
9
  * because two observers (the derivation state's and the watcher's) sweep the same roots.
@@ -43,34 +24,26 @@ export function forgetHeldSourceRootWalks() {
43
24
  * moving when the source does.
44
25
  */
45
26
  const MAXIMUM_OBSERVED_ENTRIES = 250_000;
46
- /** A counting semaphore for {@link FILE_STAT_CONCURRENCY}. */
47
- class StatPermits {
48
- available;
49
- waiting = [];
50
- constructor(permits) {
51
- this.available = permits;
27
+ /**
28
+ * The process's source-walk worker (#3204): the walk runs off the main thread, shared by every observer. See
29
+ * `introspection-source-walk.worker.ts` for why, and for the in-process fallback.
30
+ */
31
+ const sourceWalkWorker = new SourceWalkWorker();
32
+ /** Walk on `worker`, or in process when no worker can (a harness, a failed start, a dead worker). Exported for tests. */
33
+ export async function walkWithInProcessFallback(worker, request) {
34
+ try {
35
+ return await worker.walk(request);
52
36
  }
53
- async run(operation) {
54
- if (this.available > 0) {
55
- this.available -= 1;
56
- }
57
- else {
58
- // A released permit is handed straight to the next waiter, so `available` never rises while
59
- // anyone is waiting and no waiter can be overtaken by a later caller.
60
- await new Promise((resolveWait) => this.waiting.push(resolveWait));
61
- }
62
- try {
63
- return await operation();
64
- }
65
- finally {
66
- const next = this.waiting.shift();
67
- if (next)
68
- next();
69
- else
70
- this.available += 1;
71
- }
37
+ catch (error) {
38
+ if (!(error instanceof SourceWalkWorkerUnavailableError))
39
+ throw error;
40
+ return walkSourceRoots(request);
72
41
  }
73
42
  }
43
+ /** The observer's default walk: the process's worker, with the in-process fallback. */
44
+ function walkOffMainThread(request) {
45
+ return walkWithInProcessFallback(sourceWalkWorker, request);
46
+ }
74
47
  function emptyAccumulator() {
75
48
  return { fileCount: 0, directoryCount: 0, maximumMtimeMs: 0 };
76
49
  }
@@ -160,8 +133,11 @@ export class IntrospectionSourceStateObserver {
160
133
  companionContext;
161
134
  observationSequence = 0;
162
135
  inFlight = null;
163
- constructor(companionContext) {
136
+ /** The walk: on the process's worker thread by default (#3204); a test may substitute one. */
137
+ walkRoots;
138
+ constructor(companionContext, options = {}) {
164
139
  this.companionContext = companionContext;
140
+ this.walkRoots = options.walkRoots ?? walkOffMainThread;
165
141
  }
166
142
  /**
167
143
  * Take a reading of the source trees, reusing an in-flight one ONLY when that reading started at
@@ -232,7 +208,7 @@ export class IntrospectionSourceStateObserver {
232
208
  const byApplicationRoot = new Map(applicationRoots.map((root) => [root, emptyAccumulator()]));
233
209
  const shared = emptyAccumulator();
234
210
  const sharedFrameworkRoots = [...new Set(frameworkRoots)].filter((root) => !byApplicationRoot.has(root));
235
- const totals = { entryCount: 0, exceededCeiling: false, statPermits: new StatPermits(FILE_STAT_CONCURRENCY) };
211
+ const totals = { entryCount: 0, exceededCeiling: false };
236
212
  await this.observeApplicationRootManifests(shared, totals);
237
213
  /*
238
214
  * Each root is walked only when the change feed cannot vouch that nothing under it moved since its last walk (#3452).
@@ -256,7 +232,19 @@ export class IntrospectionSourceStateObserver {
256
232
  walkedGenerations.set(root, generation);
257
233
  toWalk.push({ directory: root, accumulator });
258
234
  }
259
- await this.walk(toWalk, totals);
235
+ // Off the main thread (#3204): the walk was the largest single cost on the companion's event loop during a build.
236
+ if (toWalk.length > 0) {
237
+ const walked = await this.walkRoots({
238
+ roots: toWalk.map((pending) => pending.directory),
239
+ entryCountBefore: totals.entryCount,
240
+ maximumEntries: MAXIMUM_OBSERVED_ENTRIES,
241
+ directoryConcurrency: DIRECTORY_WALK_CONCURRENCY,
242
+ fileStatConcurrency: FILE_STAT_CONCURRENCY,
243
+ });
244
+ walked.accumulators.forEach((accumulator, index) => Object.assign(toWalk[index].accumulator, accumulator));
245
+ totals.entryCount = walked.entryCount;
246
+ totals.exceededCeiling = walked.exceededCeiling;
247
+ }
260
248
  for (const accumulator of frameworkAccumulators.values()) {
261
249
  shared.fileCount += accumulator.fileCount;
262
250
  shared.directoryCount += accumulator.directoryCount;
@@ -400,99 +388,6 @@ export class IntrospectionSourceStateObserver {
400
388
  }
401
389
  }));
402
390
  }
403
- /**
404
- * Breadth-of-tree walk with a fixed directory concurrency.
405
- *
406
- * A worker-pool built over the ROOT list was written first and was wrong: it sizes its pool from
407
- * the number of roots, so a single-root application would walk its whole tree one directory at a
408
- * time, and a worker that finds the queue momentarily empty cannot tell "finished" from "another
409
- * worker is about to push children". The pump below sizes on IN-FLIGHT directories instead, which
410
- * is the quantity the concurrency limit is actually about, and terminates on the only condition
411
- * that means finished: nothing queued and nothing running.
412
- */
413
- async walk(roots, totals) {
414
- const pending = [...roots];
415
- let inFlightDirectories = 0;
416
- return new Promise((resolveWalk) => {
417
- const pump = () => {
418
- while (!totals.exceededCeiling
419
- && inFlightDirectories < DIRECTORY_WALK_CONCURRENCY
420
- && pending.length > 0) {
421
- const next = pending.pop();
422
- inFlightDirectories += 1;
423
- void this.visitDirectory(next, totals, pending).then(() => {
424
- inFlightDirectories -= 1;
425
- pump();
426
- });
427
- }
428
- if (inFlightDirectories === 0 && (pending.length === 0 || totals.exceededCeiling)) {
429
- resolveWalk();
430
- }
431
- };
432
- pump();
433
- });
434
- }
435
- /**
436
- * Read one directory: count it, fold its own mtime in, stat its files, and queue its children.
437
- *
438
- * Never rejects. A directory that cannot be read (an unbuilt `dist`, a permission) contributes
439
- * nothing and is not an error — when it appears later it is a new directory, which moves the
440
- * counts and invalidates every cached derivation.
441
- */
442
- async visitDirectory({ directory, accumulator }, totals, pending) {
443
- let entries;
444
- try {
445
- entries = await fsPromises.readdir(directory, { withFileTypes: true });
446
- }
447
- catch {
448
- return;
449
- }
450
- accumulator.directoryCount += 1;
451
- totals.entryCount += 1;
452
- try {
453
- const directoryStats = await fsPromises.stat(directory);
454
- if (directoryStats.mtimeMs > accumulator.maximumMtimeMs) {
455
- accumulator.maximumMtimeMs = directoryStats.mtimeMs;
456
- }
457
- }
458
- catch {
459
- // Counted above regardless: the directory demonstrably exists, we just read it.
460
- }
461
- const fileStats = [];
462
- const insideRuntimeSignals = basename(directory) === RUNTIME_SIGNALS_DIRECTORY_NAME;
463
- for (const entry of entries) {
464
- if (SKIPPED_DIRECTORY_NAMES.has(entry.name))
465
- continue;
466
- if (insideRuntimeSignals && entry.name === COMPILE_STAGING_DIRECTORY_NAME)
467
- continue;
468
- const entryPath = join(directory, entry.name);
469
- if (entry.isDirectory()) {
470
- pending.push({ directory: entryPath, accumulator });
471
- continue;
472
- }
473
- if (!entry.isFile()) {
474
- // A symlink is counted but never followed — following one inside a package tree can walk
475
- // back out into a dependency graph. Retargeting one rewrites its directory entry, which
476
- // moves the parent directory's mtime, so the change is still observed.
477
- accumulator.fileCount += 1;
478
- totals.entryCount += 1;
479
- continue;
480
- }
481
- totals.entryCount += 1;
482
- fileStats.push(totals.statPermits.run(() => fsPromises.stat(entryPath)).then((entryStats) => {
483
- accumulator.fileCount += 1;
484
- if (entryStats.mtimeMs > accumulator.maximumMtimeMs) {
485
- accumulator.maximumMtimeMs = entryStats.mtimeMs;
486
- }
487
- }, () => {
488
- accumulator.fileCount += 1;
489
- }));
490
- }
491
- await Promise.all(fileStats);
492
- if (totals.entryCount > MAXIMUM_OBSERVED_ENTRIES) {
493
- totals.exceededCeiling = true;
494
- }
495
- }
496
391
  }
497
392
  /**
498
393
  * Every APPLICATION package an introspection derivation can import: each declared service, each
@@ -1 +1 @@
1
- {"version":3,"file":"introspection-source-state.companion.service.js","sourceRoot":"","sources":["../../../../../src/core/introspection/services/introspection-source-state.companion.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAC;AACrG,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAEvH;;;;;;;GAOG;AACH,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AAElE;;;;;;;;GAQG;AACH,MAAM,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AAa,CAAC,MAAM,CAAC,CAAC,CAAC;AAChG,CAAC;AAED,KAAK,UAAU,mBAAmB,CAAC,WAAmB;IACpD,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,MAAM,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;QACzG,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,0FAA0F;QAC1F,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["import { promises as fsPromises } from 'node:fs';\nimport { basename, join, resolve, sep } from 'node:path';\nimport { readApplicationPnpmSettings } from '@wildo-ai/platform-config-lib';\nimport type { CompanionContext } from '../../context/companion-context';\nimport { activeDerivedInputChangeFeed } from '../../utils/derived-input-change-feed.companion.utils';\nimport { DIRECTORY_WALK_CONCURRENCY, FILE_STAT_CONCURRENCY } from './introspection-source-state.concurrency.companion';\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 below: 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/**\n * A root's last walk, reused while the change feed vouches that no event touched the root since (#3452). Module-level\n * because two observers (the derivation state's and the watcher's) sweep the same roots.\n */\nconst heldRootWalks = new Map<string, { readonly generation: number; readonly accumulator: Readonly<SweepAccumulator> }>();\n\n/** Forget every held root walk. For tests. */\nexport function forgetHeldSourceRootWalks(): void {\n heldRootWalks.clear();\n}\n\n/**\n * A ceiling on how much this observer will walk before it gives up on caching.\n *\n * Chosen ~10x above the measured 26k-entry dogfood application, so it can only be reached by a\n * pathological root (a `dist` holding a build cache, an application that vendored something large).\n * Crossing it does not disable the walk half-way and report a plausible number — it returns\n * `bounded: false`, which the caller MUST read as \"do not cache this derivation\". Failing toward\n * re-deriving is the only safe direction here: an under-observed token is a cache key that stops\n * moving when the source does.\n */\nconst MAXIMUM_OBSERVED_ENTRIES = 250_000;\n\n/**\n * What a completed sweep learned about the source that feeds an introspection derivation.\n */\nexport interface IntrospectionSourceStateObservation {\n /**\n * The comparable value. Two observations with the same token describe the same source tree; a\n * different token means SOMETHING moved. Which derivations that voids is decided per derivation from\n * {@link components} — only those whose inputs moved (#2245); one whose inputs are unknown compares\n * on this whole token.\n */\n token: string;\n /**\n * `false` when the sweep hit {@link MAXIMUM_OBSERVED_ENTRIES}. The token is then deliberately\n * unique per observation, so a caller that ignores this flag still re-derives rather than serving\n * a stale answer.\n */\n bounded: boolean;\n /** Wall-clock cost of the sweep, for the debug line that explains a cache hit's latency. */\n durationMs: number;\n /** Number of roots actually walked (a root that does not exist yet is not one). */\n observedRootCount: number;\n /**\n * Framework roots resolved to an installed release and identified by their resolved path rather than\n * walked (#2395). Reported so an operator can see why `observedEntryCount` excludes them.\n */\n installedFrameworkRootCount: number;\n /** Files plus directories visited. Reported so an operator can see why a sweep is slow. */\n observedEntryCount: number;\n /** The instant the sweep STARTED, which is the instant the token describes. */\n startedAt: number;\n /**\n * The same reading, broken down so a caller can tell WHICH tree moved (#2245). Present only when\n * {@link bounded}: an unbounded sweep says nothing reliable about any part of the tree.\n *\n * `shared` covers what every derivation reads — the application root's own manifests and every\n * `@wildo-ai/*` framework root. `byApplicationRoot` holds one token per application package root\n * (keyed by its absolute path), so a write inside `technical-doc` moves that root's token and no\n * other. {@link token} still moves whenever any component does.\n */\n components?: IntrospectionSourceStateComponents;\n}\n\n/** {@link IntrospectionSourceStateObservation.components}. */\nexport interface IntrospectionSourceStateComponents {\n readonly shared: string;\n readonly byApplicationRoot: ReadonlyMap<string, string>;\n}\n\ninterface SweepAccumulator {\n fileCount: number;\n directoryCount: number;\n maximumMtimeMs: number;\n}\n\n/** A directory still to visit, and the component its entries count towards. */\ninterface PendingDirectory {\n readonly directory: string;\n readonly accumulator: SweepAccumulator;\n}\n\n/** The whole sweep's running total, so the ceiling bounds the walk rather than any one root. */\ninterface SweepTotals {\n entryCount: number;\n exceededCeiling: boolean;\n /** Shared by every directory of the sweep, so the bound is on the sweep and not per directory. */\n readonly statPermits: StatPermits;\n}\n\n/** A counting semaphore for {@link FILE_STAT_CONCURRENCY}. */\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\nfunction emptyAccumulator(): SweepAccumulator {\n return { fileCount: 0, directoryCount: 0, maximumMtimeMs: 0 };\n}\n\nfunction describeAccumulator(accumulator: SweepAccumulator): string {\n return `files:${accumulator.fileCount}|dirs:${accumulator.directoryCount}|mtime:${accumulator.maximumMtimeMs}`;\n}\n\n/**\n * Observes the state of every source tree an introspection derivation can read, as one comparable\n * token.\n *\n * ## Why a token rather than a watcher\n *\n * The companion's file watcher (`IntrospectionSourceWatcherCompanionService`) is best-effort —\n * `fs.watch` can go deaf with no error, and can drop events — so it only says WHEN to look; this observer\n * says WHETHER anything moved. A full sweep answers that on demand, costs ~125-250 ms against the largest\n * dogfood applications, and cannot miss an event because it does not observe events at all — it observes\n * the tree. Since #3452 an ordinary reading reuses the walk of each root the watcher's change feed vouches\n * has not moved, which CAN trail a missed event (until the watcher's clock, its canary, or its next event);\n * a caller that must not take that risk asks for `trustChangeFeed: false` and gets a full sweep. (This\n * paragraph said \"the companion has no file watcher\" until 2026-09-24; the watcher was added on top of the\n * observer, not instead of it.)\n *\n * ## Why mtimes rather than content\n *\n * `.claude/rules/application-creation-directive.md` forbids digests, of any kind, for any purpose,\n * and `.claude/rules/one-source-of-truth.md` Rule 0 refuses anything that is not branchable on git.\n * A content hash compared against a stored one is exactly the second-source-of-truth shape both\n * rules exist to keep out. An mtime observation stores nothing about the application: it is a\n * reading taken now, compared against a reading taken earlier in the same process, and deleting it\n * costs a re-derivation and nothing else.\n *\n * ## What the token is made of, and what each part catches\n *\n * | Component | Catches |\n * |---|---|\n * | maximum file/directory mtime | a file written in place (the ordinary edit, and every `tsc` emit) |\n * | file count | a file added or deleted |\n * | directory count | a directory added or deleted |\n * | directory mtimes, in the maximum | a RENAME, which preserves the file's own mtime and would otherwise be invisible while the file count stayed equal |\n *\n * Directory mtimes are the non-obvious member and they are load-bearing: without them,\n * `mv a.ts b.ts` moves neither the count nor any file mtime, and the cache would keep answering\n * from the pre-rename derivation for as long as nothing else in the tree moved.\n *\n * The one mutation this cannot see is an mtime pushed BACKWARD in place on a file that is not the\n * newest in the tree (`touch -t 200001010000 <file>` on an already-old file). Nothing in a dev loop\n * does that; a real editor, `tsc`, `git checkout` and pnpm's hard-link relink all move an mtime\n * forward or move a directory. Recorded rather than papered over, because a reader who assumes the\n * token is total would be assuming something false.\n *\n * ## Which trees, and why the engine ones are in there\n *\n * An application resolving `@wildo-ai/*` through `file:` links — every dogfood app does — changes\n * its derivation when the engine is rebuilt, with no application file touched. The engine bytes the\n * child actually imports are the ones pnpm hard-linked into the app's store, NOT the ones in\n * `engine/<package>/dist`, and the two are reconciled at supervised (re)start rather than continuously. So\n * the framework signal has to be the injected snapshot itself. `.wildo-runtime-signals/dev-compile-status.json`\n * was considered and rejected for exactly this: it is a LEADING indicator, moving when the engine\n * compiles and therefore possibly before the bytes this process would import have changed — which\n * would let a derivation be cached against a token that has already advanced past it, and never\n * re-derived when the injection finally lands.\n *\n * For an application consuming published `@wildo-ai/*` releases the same roots are immutable between\n * installs, and they are NOT walked (#2395). This said the sweep \"costs a little and proves the same\n * thing\", measured on an idle machine. On app-creation-test-005 the installed releases were 17,560 of\n * ~21,800 swept entries (80 %), and under a build wave one sweep took up to 162 s, each of those stats\n * queued on the threadpool every other file read in this process shares. A release is now identified\n * by its resolved store path, which moves when an install changes its version or peers\n * ({@link FrameworkPackageResolutionMode}). The linked case above is unchanged: those roots are walked.\n *\n * ## What it costs, and one narrowing that was measured and REJECTED\n *\n * 176–225 ms against `examples/wonder-crm` (23 roots, 27,050 entries), versus a 3.1–4.2 s cold\n * import of that application's specifications package alone. So a cache hit is ~15x cheaper than\n * the cheapest possible miss.\n *\n * Skipping `*.d.ts` and `*.map` would roughly halve it — they are **55 %** of the swept files\n * (8,830 maps + 4,417 declarations of 24,243) and neither can change a runtime derivation. It was\n * rejected anyway: the saving is ~90 ms nobody can perceive, and it would buy that with an\n * assumption about what a future behavior may read. No behavior under `introspection/subprocess/`\n * imports `node:fs` at all today — every one of them is a pure function of the imported module\n * graph — but that is a fact about today, and the direction to be wrong in here is toward\n * re-deriving. Recorded so the next reader does not re-derive the numbers before reaching the same\n * conclusion.\n */\nexport class IntrospectionSourceStateObserver {\n private readonly companionContext: Pick<CompanionContext, 'saasRoot' | 'companionHome' | 'servicesByKey' | 'resolvedLibraries' | 'resolvedSpecifications'>;\n private observationSequence = 0;\n private inFlight: { startedAt: number; trustsChangeFeed: boolean; observation: Promise<IntrospectionSourceStateObservation> } | null = null;\n\n constructor(\n companionContext: Pick<CompanionContext, 'saasRoot' | 'companionHome' | 'servicesByKey' | 'resolvedLibraries' | 'resolvedSpecifications'>,\n ) {\n this.companionContext = companionContext;\n }\n\n /**\n * Take a reading of the source trees, reusing an in-flight one ONLY when that reading started at\n * or after the caller's own arrival.\n *\n * The condition is the whole point of the coalescing. A sweep takes ~125 ms; a request arriving\n * 100 ms into someone else's sweep and adopting its token would be answered from a picture of the\n * world taken 100 ms before it asked — a window in which the operator could have saved a file. So\n * a late arrival waits for the running sweep to finish and takes a fresh one, which is slower and\n * correct, while genuinely concurrent callers share one walk, which is what the coalescing is for.\n */\n public async observe(\n requestedAt: number = Date.now(),\n /**\n * `trustChangeFeed: false` walks every root whatever the change feed says (#3452 second review H1). For a caller that\n * must not trust the watcher: a read asked to be verified against the source (`verifyAgainstSource`), which exists\n * precisely because the watcher can miss an event, and per-read observation, which runs when no watcher is trusted.\n * A walk that ignored the feed may serve a caller that trusts it; never the other way round.\n */\n options: { readonly trustChangeFeed?: boolean } = {},\n ): Promise<IntrospectionSourceStateObservation> {\n const trustsChangeFeed = options.trustChangeFeed !== false;\n const current = this.inFlight;\n if (current !== null && current.startedAt >= requestedAt && (trustsChangeFeed || !current.trustsChangeFeed)) {\n return current.observation;\n }\n\n if (current !== null) {\n // Let the running sweep finish before starting another; two concurrent walks of the same\n // trees would only contend for the same file descriptors.\n await current.observation.catch(() => undefined);\n return this.observe(requestedAt, options);\n }\n\n const startedAt = Date.now();\n const observation = this.runObservation(startedAt, trustsChangeFeed).finally(() => {\n if (this.inFlight?.startedAt === startedAt) {\n this.inFlight = null;\n }\n });\n this.inFlight = { startedAt, trustsChangeFeed, observation };\n return observation;\n }\n\n /**\n * Sweep every tree whose bytes can reach a derivation, de-duplicated by resolved real path.\n *\n * Two families, and the second is the one a reader would not think of:\n *\n * 1. The APPLICATION package roots — every declared service, every resolved library, and the\n * specifications package. Whole roots rather than `src/` alone, because\n * `resolvePackageCompanionEntryPath` prefers a package's built `./companion` export when it\n * exists, so the child commonly imports `dist/`, not source. Sweeping both means neither\n * resolution mode has a blind spot.\n * 2. The FRAMEWORK packages, reached by reading each of those roots' (and the companion home's)\n * `node_modules/@wildo-ai` scope directory and resolving each link to its real path. Reading\n * the scope directory rather than listing package names keeps this from becoming a second\n * enumeration of the engine's package set that could drift from the real one.\n *\n * The application root itself is NOT walked recursively — its interesting children are already in\n * family 1, and descending it would pull in `.wildo-saas` (the companion's own dist plus the\n * runtime-signal files that churn on a heartbeat, which would make every token unique and every\n * cache read a miss).\n *\n * Each application root is accumulated into its OWN component, so a caller can tell which package\n * moved (#2245); the framework roots and the root manifests form the shared component.\n */\n private async runObservation(startedAt: number, trustsChangeFeed: boolean): Promise<IntrospectionSourceStateObservation> {\n const { applicationRoots, frameworkRoots, installedFrameworkRoots } = await this.resolveObservedRootPopulations();\n // Each application root is observed on its own; the framework roots, and the application root's\n // manifests, share one component because every derivation reads them (#2245). A root that is both\n // is counted once, as an application root.\n const byApplicationRoot = new Map(applicationRoots.map((root) => [root, emptyAccumulator()] as const));\n const shared = emptyAccumulator();\n const sharedFrameworkRoots = [...new Set(frameworkRoots)].filter((root) => !byApplicationRoot.has(root));\n const totals: SweepTotals = { entryCount: 0, exceededCeiling: false, statPermits: new StatPermits(FILE_STAT_CONCURRENCY) };\n\n await this.observeApplicationRootManifests(shared, totals);\n /*\n * Each root is walked only when the change feed cannot vouch that nothing under it moved since its last walk (#3452).\n * A framework root gets an accumulator of its own and is folded into the shared one afterwards: counts add and the\n * newest mtime wins, so the shared token is the one a single combined walk would give.\n */\n // A walk that ignores the feed still REFRESHES the held walks it takes, so the next trusting reading reuses them.\n const feed = activeDerivedInputChangeFeed();\n const frameworkAccumulators = new Map(sharedFrameworkRoots.map((root) => [root, emptyAccumulator()] as const));\n const toWalk: PendingDirectory[] = [];\n const walkedGenerations = new Map<string, number>();\n for (const [root, accumulator] of [...byApplicationRoot.entries(), ...frameworkAccumulators.entries()]) {\n const generation = feed?.generationOf([root]);\n const held = heldRootWalks.get(root);\n if (trustsChangeFeed && generation !== undefined && held?.generation === generation) {\n Object.assign(accumulator, held.accumulator);\n totals.entryCount += held.accumulator.fileCount + held.accumulator.directoryCount;\n continue;\n }\n if (generation !== undefined) walkedGenerations.set(root, generation);\n toWalk.push({ directory: root, accumulator });\n }\n await this.walk(toWalk, totals);\n for (const accumulator of frameworkAccumulators.values()) {\n shared.fileCount += accumulator.fileCount;\n shared.directoryCount += accumulator.directoryCount;\n if (accumulator.maximumMtimeMs > shared.maximumMtimeMs) shared.maximumMtimeMs = accumulator.maximumMtimeMs;\n }\n if (!totals.exceededCeiling) {\n for (const [root, generation] of walkedGenerations) {\n const accumulator = byApplicationRoot.get(root) ?? frameworkAccumulators.get(root);\n if (accumulator !== undefined) heldRootWalks.set(root, { generation, accumulator: { ...accumulator } });\n }\n }\n\n this.observationSequence += 1;\n const bounded = !totals.exceededCeiling;\n const observedRootCount = byApplicationRoot.size + sharedFrameworkRoots.length;\n // An installed release is identified by WHERE it resolves, never by walking it (#2395): pnpm's store\n // key carries the version and the peer resolution, so a reinstall that changes either moves this.\n const installedToken = [...installedFrameworkRoots].sort().join(',');\n const sharedToken = `roots:${observedRootCount}|${describeAccumulator(shared)}|installed:${installedToken}`;\n const rootTokens = new Map([...byApplicationRoot.entries()].map(([root, accumulator]) => [root, describeAccumulator(accumulator)] as const));\n const token = bounded\n ? [sharedToken, ...[...rootTokens.entries()].sort(([left], [right]) => left.localeCompare(right)).map(([root, rootToken]) => `${root}=${rootToken}`)].join('||')\n : `unbounded:${this.observationSequence}`;\n\n return {\n token,\n bounded,\n durationMs: Date.now() - startedAt,\n observedRootCount,\n installedFrameworkRootCount: installedFrameworkRoots.length,\n observedEntryCount: totals.entryCount,\n startedAt,\n ...(bounded ? { components: { shared: sharedToken, byApplicationRoot: rootTokens } } : {}),\n };\n }\n\n /**\n * The two ROOT populations a derivation reads from, kept apart because a watcher treats them\n * differently.\n *\n * An APPLICATION root is a package the operator edits: its `src` moves first and its `dist` moves\n * second, and only the second changes what a derivation imports —\n * `resolvePackageCompanionEntryPath` resolves the package's `exports['./companion']`, which is\n * `./dist/esm/companion-exports.js` on every application package. A FRAMEWORK root is the injected\n * `@wildo-ai/*` copy in the application's own store: dist-only bytes, hard-linked at supervised\n * (re)start, carrying no runtime-signal files of its own.\n *\n * Exposed so the watcher and the sweep observe one population rather than two enumerations that\n * agree only until one side gains an entry.\n */\n public async resolveObservedRootPopulations(): Promise<{\n readonly applicationRoots: readonly string[];\n /** Framework roots whose bytes can move during a session, so they are walked and watched. */\n readonly frameworkRoots: readonly string[];\n /**\n * Framework roots resolved to an INSTALLED RELEASE in the application's own store (#2395). Their\n * bytes move only when an install changes the resolution, and that changes their resolved path, so\n * they are identified by that path and neither walked nor watched.\n */\n readonly installedFrameworkRoots: readonly string[];\n }> {\n const applicationRoots = resolveIntrospectedApplicationPackageRoots(this.companionContext);\n\n const frameworkScopeOwners = [\n ...applicationRoots,\n this.companionContext.saasRoot,\n this.companionContext.companionHome,\n ];\n const packageNameByRoot = new Map<string, string>();\n for (const owner of frameworkScopeOwners) {\n const scopeDirectory = join(owner, 'node_modules', '@wildo-ai');\n let scopeEntries: string[];\n try {\n scopeEntries = await fsPromises.readdir(scopeDirectory);\n } catch {\n continue;\n }\n for (const scopeEntry of scopeEntries) {\n try {\n packageNameByRoot.set(await fsPromises.realpath(join(scopeDirectory, scopeEntry)), `@wildo-ai/${scopeEntry}`);\n } catch {\n // A dangling link contributes nothing to observe; its disappearance shows up as a\n // directory-mtime change on the scope directory's owner instead.\n }\n }\n }\n\n const resolutionModeByName = await readFrameworkPackageResolutionModes(this.companionContext.saasRoot, frameworkScopeOwners);\n // Resolved like the roots it is compared with: an application root reached through a symlink (macOS\n // `/var` → `/private/var`) would otherwise put every real path outside its own store, and nothing\n // would ever be recognised as installed.\n let applicationStore: string | undefined;\n try {\n applicationStore = (await fsPromises.realpath(join(this.companionContext.saasRoot, 'node_modules', '.pnpm'))) + sep;\n } catch {\n applicationStore = undefined;\n }\n const frameworkRoots: string[] = [];\n const installedFrameworkRoots: string[] = [];\n for (const [root, packageName] of packageNameByRoot) {\n // Two independent witnesses, and a package that fails either is walked, the direction that cannot\n // go stale. The DECLARATION says a release was asked for. The STORE KEY says what pnpm actually\n // installed: a release lives under `<store>/@wildo-ai+<name>@<version>…`, while a `file:`-injected\n // copy lives in the same store under `@wildo-ai+<name>@file+…`. The location alone would not tell\n // those apart (an earlier version of this check relied on it and did not protect the injected copy:\n // review of #2395, M2), so a misread declaration (an override this reader cannot see, a selector key)\n // can no longer turn an injected engine copy into one that is never re-observed.\n const installedRelease = resolutionModeByName.get(packageName) === FrameworkPackageResolutionMode.INSTALLED_RELEASE\n && applicationStore !== undefined\n && isReleaseStoreLocation(root, applicationStore, packageName);\n (installedRelease ? installedFrameworkRoots : frameworkRoots).push(root);\n }\n\n return { applicationRoots: [...applicationRoots], frameworkRoots, installedFrameworkRoots };\n }\n\n /**\n * Fold the application root's own top-level FILES in, without descending it.\n *\n * These are `pnpm-lock.yaml`, `package.json`, `pnpm-workspace.yaml` (where the overrides live, #2808) and\n * `wildo.saas.config.ts` — the manifests that\n * decide which third-party bytes the child imports. Without them there is a narrow but real hole:\n * an install that moves a non-`@wildo-ai` dependency changes a derivation while touching nothing\n * inside a package root, because the walk enters `node_modules` only through the resolved\n * `@wildo-ai` scope. The lockfile moves on every such install, so one shallow read closes it.\n *\n * The root is NOT descended, because doing so would pull in `.wildo-saas` — the companion's own\n * dist and the runtime-signal files that are rewritten on a heartbeat, which would make every\n * token unique and every cache read a miss.\n */\n private async observeApplicationRootManifests(accumulator: SweepAccumulator, totals: SweepTotals): Promise<void> {\n let entries;\n try {\n entries = await fsPromises.readdir(this.companionContext.saasRoot, { withFileTypes: true });\n } catch {\n return;\n }\n\n await Promise.all(entries.map(async (entry) => {\n if (!entry.isFile()) return;\n accumulator.fileCount += 1;\n totals.entryCount += 1;\n try {\n const entryStats = await fsPromises.stat(join(this.companionContext.saasRoot, entry.name));\n if (entryStats.mtimeMs > accumulator.maximumMtimeMs) {\n accumulator.maximumMtimeMs = entryStats.mtimeMs;\n }\n } catch {\n // Counted above; a file that vanished between readdir and stat is itself a change, and the\n // count will differ on the next observation.\n }\n }));\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 */\n private async walk(roots: readonly PendingDirectory[], totals: SweepTotals): Promise<void> {\n const pending: PendingDirectory[] = [...roots];\n let inFlightDirectories = 0;\n\n return new Promise<void>((resolveWalk) => {\n const pump = (): void => {\n while (\n !totals.exceededCeiling\n && inFlightDirectories < DIRECTORY_WALK_CONCURRENCY\n && pending.length > 0\n ) {\n const next = pending.pop() as PendingDirectory;\n inFlightDirectories += 1;\n void this.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 */\n private async visitDirectory(\n { directory, accumulator }: PendingDirectory,\n totals: SweepTotals,\n pending: PendingDirectory[],\n ): 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 > MAXIMUM_OBSERVED_ENTRIES) {\n totals.exceededCeiling = true;\n }\n }\n}\n\n/**\n * Every APPLICATION package an introspection derivation can import: each declared service, each\n * resolved library, and the specifications package.\n *\n * ONE enumeration, shared by this observer and by the creation-plane projection's input signature\n * (#1310, seventh review G1), because both answer the same question — \"which built trees can move an\n * introspection result?\" — and two lists of one population agree only until one gains an entry.\n */\nexport function resolveIntrospectedApplicationPackageRoots(\n companionContext: Pick<CompanionContext, 'saasRoot' | 'servicesByKey' | 'resolvedLibraries' | 'resolvedSpecifications'>,\n): readonly string[] {\n const applicationRoots = new Set<string>();\n for (const serviceDefinition of Object.values(companionContext.servicesByKey)) {\n applicationRoots.add(resolve(companionContext.saasRoot, serviceDefinition.path));\n }\n for (const resolvedLibrary of Object.values(companionContext.resolvedLibraries)) {\n applicationRoots.add(resolvedLibrary.packageRoot);\n }\n if (companionContext.resolvedSpecifications) {\n applicationRoots.add(companionContext.resolvedSpecifications.packageRoot);\n }\n return [...applicationRoots];\n}\n\n/**\n * How an application resolves one `@wildo-ai/*` package, which decides whether its bytes can move while\n * the companion runs (#2395).\n */\nexport enum FrameworkPackageResolutionMode {\n /**\n * A published version, installed into the application's own pnpm store. Its bytes change only when an\n * install changes the resolution, and pnpm's store key carries the version and the peer resolution, so\n * that also changes where it resolves. An application created with `wildo init` against released\n * packages resolves every framework package this way.\n */\n INSTALLED_RELEASE = 'installed-release',\n /**\n * A link to a framework checkout (`file:`, `link:`, `workspace:`, `portal:`). The dogfood applications\n * resolve this way, and their injected copy is re-linked at supervised restart without the lockfile or\n * any manifest moving, so only its bytes can say it changed.\n */\n LINKED_SOURCE = 'linked-source',\n /**\n * Nothing settles it: an open range like `*` with no override, an alias, a URL, or no declaration\n * found. Treated as linked, because the cost of walking a tree that cannot move is time, and the cost\n * of not walking one that can is a stale answer.\n */\n UNDETERMINED = 'undetermined',\n}\n\n/** pnpm's protocols for a dependency that points into a directory rather than at a published version. */\nconst LINKED_SPECIFIER_PROTOCOLS = ['file:', 'link:', 'workspace:', 'portal:'] as const;\n\n/** One exact version or one single-comparator range over one (`1.1.9`, `^1.1.9`, `>=1.1.9`). */\nconst SINGLE_RELEASE_SPECIFIER = /^(?:[~^]|[<>]=?|=)?v?\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/;\n\n/**\n * Classify one dependency specifier for a framework package (#2395).\n *\n * Deliberately narrow on the release side: only a specifier that names one version (or one comparator\n * over one) counts. Anything open — `*`, `latest`, `1.x`, a `||` union — could be satisfied by a link the\n * override machinery chose, so it is UNDETERMINED and walked.\n */\nexport function classifyFrameworkPackageSpecifier(specifier: string | undefined): FrameworkPackageResolutionMode {\n if (specifier === undefined) return FrameworkPackageResolutionMode.UNDETERMINED;\n const trimmed = specifier.trim();\n if (LINKED_SPECIFIER_PROTOCOLS.some((protocol) => trimmed.startsWith(protocol))) return FrameworkPackageResolutionMode.LINKED_SOURCE;\n if (SINGLE_RELEASE_SPECIFIER.test(trimmed)) return FrameworkPackageResolutionMode.INSTALLED_RELEASE;\n return FrameworkPackageResolutionMode.UNDETERMINED;\n}\n\n/**\n * The resolution mode of every `@wildo-ai/*` package the application's manifests mention (#2395).\n *\n * The application's effective overrides decide first (#2808: `pnpm-workspace.yaml`, or `package.json` → `pnpm` in an\n * application that has not moved them, read through the shared pnpm-settings helper), because an override rewrites the specifier\n * of every workspace member and every transitive edge: that is how every application here pins its\n * framework (the dogfood ones to `file:` paths, a created one to a release). Without an override, the\n * owners' own declarations decide together: any link makes the package LINKED_SOURCE, all-release makes\n * it INSTALLED_RELEASE, anything else is UNDETERMINED.\n *\n * Read from the declarations rather than the lockfile because they are where the decision is written. The\n * lockfile records the same decision. Selector keys (`@wildo-ai/x@1`) and parent-scoped ones\n * (`a>@wildo-ai/x`) are not read. Such a package is decided by its\n * owners' declarations, which can therefore be wrong. That is why the caller also requires the STORE KEY to\n * name a version (`isReleaseStoreLocation`): a linked copy is walked however its declaration was misread.\n */\nexport async function readFrameworkPackageResolutionModes(\n saasRoot: string,\n ownerRoots: readonly string[],\n): Promise<ReadonlyMap<string, FrameworkPackageResolutionMode>> {\n const rootManifest = await readPackageManifest(saasRoot);\n let overrides: Record<string, unknown>;\n try {\n overrides = readApplicationPnpmSettings(saasRoot).overrides ?? {};\n } catch {\n // A settings file pnpm itself would refuse decides nothing here; the owners' declarations and the store key still do.\n overrides = {};\n }\n\n const declaredModes = new Map<string, FrameworkPackageResolutionMode[]>();\n for (const owner of new Set([saasRoot, ...ownerRoots])) {\n const manifest = owner === saasRoot ? rootManifest : await readPackageManifest(owner);\n if (manifest === undefined) continue;\n for (const field of ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'] as const) {\n const declared = manifest[field];\n if (!isRecord(declared)) continue;\n for (const [name, specifier] of Object.entries(declared)) {\n if (!name.startsWith('@wildo-ai/') || typeof specifier !== 'string') continue;\n declaredModes.set(name, [...(declaredModes.get(name) ?? []), classifyFrameworkPackageSpecifier(specifier)]);\n }\n }\n }\n\n const modes = new Map<string, FrameworkPackageResolutionMode>();\n for (const name of new Set([...Object.keys(overrides), ...declaredModes.keys()])) {\n if (!name.startsWith('@wildo-ai/')) continue;\n const override = overrides[name];\n if (typeof override === 'string') {\n modes.set(name, classifyFrameworkPackageSpecifier(override));\n continue;\n }\n const declared = declaredModes.get(name) ?? [];\n if (declared.includes(FrameworkPackageResolutionMode.LINKED_SOURCE)) {\n modes.set(name, FrameworkPackageResolutionMode.LINKED_SOURCE);\n } else if (declared.length > 0 && declared.every((mode) => mode === FrameworkPackageResolutionMode.INSTALLED_RELEASE)) {\n modes.set(name, FrameworkPackageResolutionMode.INSTALLED_RELEASE);\n } else {\n modes.set(name, FrameworkPackageResolutionMode.UNDETERMINED);\n }\n }\n return modes;\n}\n\n/**\n * Whether `root` is a RELEASE in the application's pnpm store: `<store><@wildo-ai+name>@<digit>…/…`.\n *\n * pnpm names a store entry `<scope>+<name>@<version>` for a registry install and `<scope>+<name>@file+…`\n * (or `link+…`) for one injected from a directory, so the character after the `@` separates them. A\n * patched release (`…@1.1.9_patch_hash=…`) and a peer suffix (`…@1.1.9_zod@4.3.6`) still start with the\n * version.\n *\n * Bytes inside a release are treated as immutable between installs. Hand-editing an installed release's\n * `dist` to debug something is therefore not seen until the companion restarts; edit the source and\n * reinstall, or relink it with `file:`, instead.\n */\nexport function isReleaseStoreLocation(root: string, applicationStore: string, packageName: string): boolean {\n if (!root.startsWith(applicationStore)) return false;\n const storeKey = root.slice(applicationStore.length).split(sep)[0] ?? '';\n const releasePrefix = `${packageName.replace('/', '+')}@`;\n return storeKey.startsWith(releasePrefix) && /^\\d/.test(storeKey.slice(releasePrefix.length));\n}\n\nasync function readPackageManifest(packageRoot: string): Promise<Record<string, unknown> | undefined> {\n try {\n const parsed: unknown = JSON.parse(await fsPromises.readFile(join(packageRoot, 'package.json'), 'utf8'));\n return isRecord(parsed) ? parsed : undefined;\n } catch {\n // An unreadable manifest decides nothing; every package it would have named stays walked.\n return undefined;\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n"]}
1
+ {"version":3,"file":"introspection-source-state.companion.service.js","sourceRoot":"","sources":["../../../../../src/core/introspection/services/introspection-source-state.companion.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAC;AACrG,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AACvH,OAAO,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,eAAe,EAAiD,MAAM,oCAAoC,CAAC;AAExK;;;GAGG;AACH,MAAM,aAAa,GAAG,IAAI,GAAG,EAA6F,CAAC;AAE3H,8CAA8C;AAC9C,MAAM,UAAU,yBAAyB;IACvC,aAAa,CAAC,KAAK,EAAE,CAAC;AACxB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,wBAAwB,GAAG,OAAO,CAAC;AAoEzC;;;GAGG;AACH,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAEhD,yHAAyH;AACzH,MAAM,CAAC,KAAK,UA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,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["import { promises as fsPromises } from 'node:fs';\nimport { join, resolve, sep } from 'node:path';\nimport { readApplicationPnpmSettings } from '@wildo-ai/platform-config-lib';\nimport type { CompanionContext } from '../../context/companion-context';\nimport { activeDerivedInputChangeFeed } from '../../utils/derived-input-change-feed.companion.utils';\nimport { DIRECTORY_WALK_CONCURRENCY, FILE_STAT_CONCURRENCY } from './introspection-source-state.concurrency.companion';\nimport { SourceWalkWorker, SourceWalkWorkerUnavailableError, walkSourceRoots, type SourceWalkRequest, type SourceWalkResult } from './introspection-source-walk.worker';\n\n/**\n * A root's last walk, reused while the change feed vouches that no event touched the root since (#3452). Module-level\n * because two observers (the derivation state's and the watcher's) sweep the same roots.\n */\nconst heldRootWalks = new Map<string, { readonly generation: number; readonly accumulator: Readonly<SweepAccumulator> }>();\n\n/** Forget every held root walk. For tests. */\nexport function forgetHeldSourceRootWalks(): void {\n heldRootWalks.clear();\n}\n\n/**\n * A ceiling on how much this observer will walk before it gives up on caching.\n *\n * Chosen ~10x above the measured 26k-entry dogfood application, so it can only be reached by a\n * pathological root (a `dist` holding a build cache, an application that vendored something large).\n * Crossing it does not disable the walk half-way and report a plausible number — it returns\n * `bounded: false`, which the caller MUST read as \"do not cache this derivation\". Failing toward\n * re-deriving is the only safe direction here: an under-observed token is a cache key that stops\n * moving when the source does.\n */\nconst MAXIMUM_OBSERVED_ENTRIES = 250_000;\n\n/**\n * What a completed sweep learned about the source that feeds an introspection derivation.\n */\nexport interface IntrospectionSourceStateObservation {\n /**\n * The comparable value. Two observations with the same token describe the same source tree; a\n * different token means SOMETHING moved. Which derivations that voids is decided per derivation from\n * {@link components} — only those whose inputs moved (#2245); one whose inputs are unknown compares\n * on this whole token.\n */\n token: string;\n /**\n * `false` when the sweep hit {@link MAXIMUM_OBSERVED_ENTRIES}. The token is then deliberately\n * unique per observation, so a caller that ignores this flag still re-derives rather than serving\n * a stale answer.\n */\n bounded: boolean;\n /** Wall-clock cost of the sweep, for the debug line that explains a cache hit's latency. */\n durationMs: number;\n /** Number of roots actually walked (a root that does not exist yet is not one). */\n observedRootCount: number;\n /**\n * Framework roots resolved to an installed release and identified by their resolved path rather than\n * walked (#2395). Reported so an operator can see why `observedEntryCount` excludes them.\n */\n installedFrameworkRootCount: number;\n /** Files plus directories visited. Reported so an operator can see why a sweep is slow. */\n observedEntryCount: number;\n /** The instant the sweep STARTED, which is the instant the token describes. */\n startedAt: number;\n /**\n * The same reading, broken down so a caller can tell WHICH tree moved (#2245). Present only when\n * {@link bounded}: an unbounded sweep says nothing reliable about any part of the tree.\n *\n * `shared` covers what every derivation reads — the application root's own manifests and every\n * `@wildo-ai/*` framework root. `byApplicationRoot` holds one token per application package root\n * (keyed by its absolute path), so a write inside `technical-doc` moves that root's token and no\n * other. {@link token} still moves whenever any component does.\n */\n components?: IntrospectionSourceStateComponents;\n}\n\n/** {@link IntrospectionSourceStateObservation.components}. */\nexport interface IntrospectionSourceStateComponents {\n readonly shared: string;\n readonly byApplicationRoot: ReadonlyMap<string, string>;\n}\n\ninterface SweepAccumulator {\n fileCount: number;\n directoryCount: number;\n maximumMtimeMs: number;\n}\n\n/** A root still to walk, and the component its entries count towards. */\ninterface PendingDirectory {\n readonly directory: string;\n readonly accumulator: SweepAccumulator;\n}\n\n/** The whole sweep's running total, so the ceiling bounds the walk rather than any one root. */\ninterface SweepTotals {\n entryCount: number;\n exceededCeiling: boolean;\n}\n\n/**\n * The process's source-walk worker (#3204): the walk runs off the main thread, shared by every observer. See\n * `introspection-source-walk.worker.ts` for why, and for the in-process fallback.\n */\nconst sourceWalkWorker = new SourceWalkWorker();\n\n/** Walk on `worker`, or in process when no worker can (a harness, a failed start, a dead worker). Exported for tests. */\nexport async function walkWithInProcessFallback(worker: SourceWalkWorker, request: SourceWalkRequest): Promise<SourceWalkResult> {\n try {\n return await worker.walk(request);\n } catch (error) {\n if (!(error instanceof SourceWalkWorkerUnavailableError)) throw error;\n return walkSourceRoots(request);\n }\n}\n\n/** The observer's default walk: the process's worker, with the in-process fallback. */\nfunction walkOffMainThread(request: SourceWalkRequest): Promise<SourceWalkResult> {\n return walkWithInProcessFallback(sourceWalkWorker, request);\n}\n\nfunction emptyAccumulator(): SweepAccumulator {\n return { fileCount: 0, directoryCount: 0, maximumMtimeMs: 0 };\n}\n\nfunction describeAccumulator(accumulator: SweepAccumulator): string {\n return `files:${accumulator.fileCount}|dirs:${accumulator.directoryCount}|mtime:${accumulator.maximumMtimeMs}`;\n}\n\n/**\n * Observes the state of every source tree an introspection derivation can read, as one comparable\n * token.\n *\n * ## Why a token rather than a watcher\n *\n * The companion's file watcher (`IntrospectionSourceWatcherCompanionService`) is best-effort —\n * `fs.watch` can go deaf with no error, and can drop events — so it only says WHEN to look; this observer\n * says WHETHER anything moved. A full sweep answers that on demand, costs ~125-250 ms against the largest\n * dogfood applications, and cannot miss an event because it does not observe events at all — it observes\n * the tree. Since #3452 an ordinary reading reuses the walk of each root the watcher's change feed vouches\n * has not moved, which CAN trail a missed event (until the watcher's clock, its canary, or its next event);\n * a caller that must not take that risk asks for `trustChangeFeed: false` and gets a full sweep. (This\n * paragraph said \"the companion has no file watcher\" until 2026-09-24; the watcher was added on top of the\n * observer, not instead of it.)\n *\n * ## Why mtimes rather than content\n *\n * `.claude/rules/application-creation-directive.md` forbids digests, of any kind, for any purpose,\n * and `.claude/rules/one-source-of-truth.md` Rule 0 refuses anything that is not branchable on git.\n * A content hash compared against a stored one is exactly the second-source-of-truth shape both\n * rules exist to keep out. An mtime observation stores nothing about the application: it is a\n * reading taken now, compared against a reading taken earlier in the same process, and deleting it\n * costs a re-derivation and nothing else.\n *\n * ## What the token is made of, and what each part catches\n *\n * | Component | Catches |\n * |---|---|\n * | maximum file/directory mtime | a file written in place (the ordinary edit, and every `tsc` emit) |\n * | file count | a file added or deleted |\n * | directory count | a directory added or deleted |\n * | directory mtimes, in the maximum | a RENAME, which preserves the file's own mtime and would otherwise be invisible while the file count stayed equal |\n *\n * Directory mtimes are the non-obvious member and they are load-bearing: without them,\n * `mv a.ts b.ts` moves neither the count nor any file mtime, and the cache would keep answering\n * from the pre-rename derivation for as long as nothing else in the tree moved.\n *\n * The one mutation this cannot see is an mtime pushed BACKWARD in place on a file that is not the\n * newest in the tree (`touch -t 200001010000 <file>` on an already-old file). Nothing in a dev loop\n * does that; a real editor, `tsc`, `git checkout` and pnpm's hard-link relink all move an mtime\n * forward or move a directory. Recorded rather than papered over, because a reader who assumes the\n * token is total would be assuming something false.\n *\n * ## Which trees, and why the engine ones are in there\n *\n * An application resolving `@wildo-ai/*` through `file:` links — every dogfood app does — changes\n * its derivation when the engine is rebuilt, with no application file touched. The engine bytes the\n * child actually imports are the ones pnpm hard-linked into the app's store, NOT the ones in\n * `engine/<package>/dist`, and the two are reconciled at supervised (re)start rather than continuously. So\n * the framework signal has to be the injected snapshot itself. `.wildo-runtime-signals/dev-compile-status.json`\n * was considered and rejected for exactly this: it is a LEADING indicator, moving when the engine\n * compiles and therefore possibly before the bytes this process would import have changed — which\n * would let a derivation be cached against a token that has already advanced past it, and never\n * re-derived when the injection finally lands.\n *\n * For an application consuming published `@wildo-ai/*` releases the same roots are immutable between\n * installs, and they are NOT walked (#2395). This said the sweep \"costs a little and proves the same\n * thing\", measured on an idle machine. On app-creation-test-005 the installed releases were 17,560 of\n * ~21,800 swept entries (80 %), and under a build wave one sweep took up to 162 s, each of those stats\n * queued on the threadpool every other file read in this process shares. A release is now identified\n * by its resolved store path, which moves when an install changes its version or peers\n * ({@link FrameworkPackageResolutionMode}). The linked case above is unchanged: those roots are walked.\n *\n * ## What it costs, and one narrowing that was measured and REJECTED\n *\n * 176–225 ms against `examples/wonder-crm` (23 roots, 27,050 entries), versus a 3.1–4.2 s cold\n * import of that application's specifications package alone. So a cache hit is ~15x cheaper than\n * the cheapest possible miss.\n *\n * Skipping `*.d.ts` and `*.map` would roughly halve it — they are **55 %** of the swept files\n * (8,830 maps + 4,417 declarations of 24,243) and neither can change a runtime derivation. It was\n * rejected anyway: the saving is ~90 ms nobody can perceive, and it would buy that with an\n * assumption about what a future behavior may read. No behavior under `introspection/subprocess/`\n * imports `node:fs` at all today — every one of them is a pure function of the imported module\n * graph — but that is a fact about today, and the direction to be wrong in here is toward\n * re-deriving. Recorded so the next reader does not re-derive the numbers before reaching the same\n * conclusion.\n */\nexport class IntrospectionSourceStateObserver {\n private readonly companionContext: Pick<CompanionContext, 'saasRoot' | 'companionHome' | 'servicesByKey' | 'resolvedLibraries' | 'resolvedSpecifications'>;\n private observationSequence = 0;\n private inFlight: { startedAt: number; trustsChangeFeed: boolean; observation: Promise<IntrospectionSourceStateObservation> } | null = null;\n\n /** The walk: on the process's worker thread by default (#3204); a test may substitute one. */\n private readonly walkRoots: (request: SourceWalkRequest) => Promise<SourceWalkResult>;\n\n constructor(\n companionContext: Pick<CompanionContext, 'saasRoot' | 'companionHome' | 'servicesByKey' | 'resolvedLibraries' | 'resolvedSpecifications'>,\n options: { readonly walkRoots?: (request: SourceWalkRequest) => Promise<SourceWalkResult> } = {},\n ) {\n this.companionContext = companionContext;\n this.walkRoots = options.walkRoots ?? walkOffMainThread;\n }\n\n /**\n * Take a reading of the source trees, reusing an in-flight one ONLY when that reading started at\n * or after the caller's own arrival.\n *\n * The condition is the whole point of the coalescing. A sweep takes ~125 ms; a request arriving\n * 100 ms into someone else's sweep and adopting its token would be answered from a picture of the\n * world taken 100 ms before it asked — a window in which the operator could have saved a file. So\n * a late arrival waits for the running sweep to finish and takes a fresh one, which is slower and\n * correct, while genuinely concurrent callers share one walk, which is what the coalescing is for.\n */\n public async observe(\n requestedAt: number = Date.now(),\n /**\n * `trustChangeFeed: false` walks every root whatever the change feed says (#3452 second review H1). For a caller that\n * must not trust the watcher: a read asked to be verified against the source (`verifyAgainstSource`), which exists\n * precisely because the watcher can miss an event, and per-read observation, which runs when no watcher is trusted.\n * A walk that ignored the feed may serve a caller that trusts it; never the other way round.\n */\n options: { readonly trustChangeFeed?: boolean } = {},\n ): Promise<IntrospectionSourceStateObservation> {\n const trustsChangeFeed = options.trustChangeFeed !== false;\n const current = this.inFlight;\n if (current !== null && current.startedAt >= requestedAt && (trustsChangeFeed || !current.trustsChangeFeed)) {\n return current.observation;\n }\n\n if (current !== null) {\n // Let the running sweep finish before starting another; two concurrent walks of the same\n // trees would only contend for the same file descriptors.\n await current.observation.catch(() => undefined);\n return this.observe(requestedAt, options);\n }\n\n const startedAt = Date.now();\n const observation = this.runObservation(startedAt, trustsChangeFeed).finally(() => {\n if (this.inFlight?.startedAt === startedAt) {\n this.inFlight = null;\n }\n });\n this.inFlight = { startedAt, trustsChangeFeed, observation };\n return observation;\n }\n\n /**\n * Sweep every tree whose bytes can reach a derivation, de-duplicated by resolved real path.\n *\n * Two families, and the second is the one a reader would not think of:\n *\n * 1. The APPLICATION package roots — every declared service, every resolved library, and the\n * specifications package. Whole roots rather than `src/` alone, because\n * `resolvePackageCompanionEntryPath` prefers a package's built `./companion` export when it\n * exists, so the child commonly imports `dist/`, not source. Sweeping both means neither\n * resolution mode has a blind spot.\n * 2. The FRAMEWORK packages, reached by reading each of those roots' (and the companion home's)\n * `node_modules/@wildo-ai` scope directory and resolving each link to its real path. Reading\n * the scope directory rather than listing package names keeps this from becoming a second\n * enumeration of the engine's package set that could drift from the real one.\n *\n * The application root itself is NOT walked recursively — its interesting children are already in\n * family 1, and descending it would pull in `.wildo-saas` (the companion's own dist plus the\n * runtime-signal files that churn on a heartbeat, which would make every token unique and every\n * cache read a miss).\n *\n * Each application root is accumulated into its OWN component, so a caller can tell which package\n * moved (#2245); the framework roots and the root manifests form the shared component.\n */\n private async runObservation(startedAt: number, trustsChangeFeed: boolean): Promise<IntrospectionSourceStateObservation> {\n const { applicationRoots, frameworkRoots, installedFrameworkRoots } = await this.resolveObservedRootPopulations();\n // Each application root is observed on its own; the framework roots, and the application root's\n // manifests, share one component because every derivation reads them (#2245). A root that is both\n // is counted once, as an application root.\n const byApplicationRoot = new Map(applicationRoots.map((root) => [root, emptyAccumulator()] as const));\n const shared = emptyAccumulator();\n const sharedFrameworkRoots = [...new Set(frameworkRoots)].filter((root) => !byApplicationRoot.has(root));\n const totals: SweepTotals = { entryCount: 0, exceededCeiling: false };\n\n await this.observeApplicationRootManifests(shared, totals);\n /*\n * Each root is walked only when the change feed cannot vouch that nothing under it moved since its last walk (#3452).\n * A framework root gets an accumulator of its own and is folded into the shared one afterwards: counts add and the\n * newest mtime wins, so the shared token is the one a single combined walk would give.\n */\n // A walk that ignores the feed still REFRESHES the held walks it takes, so the next trusting reading reuses them.\n const feed = activeDerivedInputChangeFeed();\n const frameworkAccumulators = new Map(sharedFrameworkRoots.map((root) => [root, emptyAccumulator()] as const));\n const toWalk: PendingDirectory[] = [];\n const walkedGenerations = new Map<string, number>();\n for (const [root, accumulator] of [...byApplicationRoot.entries(), ...frameworkAccumulators.entries()]) {\n const generation = feed?.generationOf([root]);\n const held = heldRootWalks.get(root);\n if (trustsChangeFeed && generation !== undefined && held?.generation === generation) {\n Object.assign(accumulator, held.accumulator);\n totals.entryCount += held.accumulator.fileCount + held.accumulator.directoryCount;\n continue;\n }\n if (generation !== undefined) walkedGenerations.set(root, generation);\n toWalk.push({ directory: root, accumulator });\n }\n // Off the main thread (#3204): the walk was the largest single cost on the companion's event loop during a build.\n if (toWalk.length > 0) {\n const walked = await this.walkRoots({\n roots: toWalk.map((pending) => pending.directory),\n entryCountBefore: totals.entryCount,\n maximumEntries: MAXIMUM_OBSERVED_ENTRIES,\n directoryConcurrency: DIRECTORY_WALK_CONCURRENCY,\n fileStatConcurrency: FILE_STAT_CONCURRENCY,\n });\n walked.accumulators.forEach((accumulator, index) => Object.assign(toWalk[index]!.accumulator, accumulator));\n totals.entryCount = walked.entryCount;\n totals.exceededCeiling = walked.exceededCeiling;\n }\n for (const accumulator of frameworkAccumulators.values()) {\n shared.fileCount += accumulator.fileCount;\n shared.directoryCount += accumulator.directoryCount;\n if (accumulator.maximumMtimeMs > shared.maximumMtimeMs) shared.maximumMtimeMs = accumulator.maximumMtimeMs;\n }\n if (!totals.exceededCeiling) {\n for (const [root, generation] of walkedGenerations) {\n const accumulator = byApplicationRoot.get(root) ?? frameworkAccumulators.get(root);\n if (accumulator !== undefined) heldRootWalks.set(root, { generation, accumulator: { ...accumulator } });\n }\n }\n\n this.observationSequence += 1;\n const bounded = !totals.exceededCeiling;\n const observedRootCount = byApplicationRoot.size + sharedFrameworkRoots.length;\n // An installed release is identified by WHERE it resolves, never by walking it (#2395): pnpm's store\n // key carries the version and the peer resolution, so a reinstall that changes either moves this.\n const installedToken = [...installedFrameworkRoots].sort().join(',');\n const sharedToken = `roots:${observedRootCount}|${describeAccumulator(shared)}|installed:${installedToken}`;\n const rootTokens = new Map([...byApplicationRoot.entries()].map(([root, accumulator]) => [root, describeAccumulator(accumulator)] as const));\n const token = bounded\n ? [sharedToken, ...[...rootTokens.entries()].sort(([left], [right]) => left.localeCompare(right)).map(([root, rootToken]) => `${root}=${rootToken}`)].join('||')\n : `unbounded:${this.observationSequence}`;\n\n return {\n token,\n bounded,\n durationMs: Date.now() - startedAt,\n observedRootCount,\n installedFrameworkRootCount: installedFrameworkRoots.length,\n observedEntryCount: totals.entryCount,\n startedAt,\n ...(bounded ? { components: { shared: sharedToken, byApplicationRoot: rootTokens } } : {}),\n };\n }\n\n /**\n * The two ROOT populations a derivation reads from, kept apart because a watcher treats them\n * differently.\n *\n * An APPLICATION root is a package the operator edits: its `src` moves first and its `dist` moves\n * second, and only the second changes what a derivation imports —\n * `resolvePackageCompanionEntryPath` resolves the package's `exports['./companion']`, which is\n * `./dist/esm/companion-exports.js` on every application package. A FRAMEWORK root is the injected\n * `@wildo-ai/*` copy in the application's own store: dist-only bytes, hard-linked at supervised\n * (re)start, carrying no runtime-signal files of its own.\n *\n * Exposed so the watcher and the sweep observe one population rather than two enumerations that\n * agree only until one side gains an entry.\n */\n public async resolveObservedRootPopulations(): Promise<{\n readonly applicationRoots: readonly string[];\n /** Framework roots whose bytes can move during a session, so they are walked and watched. */\n readonly frameworkRoots: readonly string[];\n /**\n * Framework roots resolved to an INSTALLED RELEASE in the application's own store (#2395). Their\n * bytes move only when an install changes the resolution, and that changes their resolved path, so\n * they are identified by that path and neither walked nor watched.\n */\n readonly installedFrameworkRoots: readonly string[];\n }> {\n const applicationRoots = resolveIntrospectedApplicationPackageRoots(this.companionContext);\n\n const frameworkScopeOwners = [\n ...applicationRoots,\n this.companionContext.saasRoot,\n this.companionContext.companionHome,\n ];\n const packageNameByRoot = new Map<string, string>();\n for (const owner of frameworkScopeOwners) {\n const scopeDirectory = join(owner, 'node_modules', '@wildo-ai');\n let scopeEntries: string[];\n try {\n scopeEntries = await fsPromises.readdir(scopeDirectory);\n } catch {\n continue;\n }\n for (const scopeEntry of scopeEntries) {\n try {\n packageNameByRoot.set(await fsPromises.realpath(join(scopeDirectory, scopeEntry)), `@wildo-ai/${scopeEntry}`);\n } catch {\n // A dangling link contributes nothing to observe; its disappearance shows up as a\n // directory-mtime change on the scope directory's owner instead.\n }\n }\n }\n\n const resolutionModeByName = await readFrameworkPackageResolutionModes(this.companionContext.saasRoot, frameworkScopeOwners);\n // Resolved like the roots it is compared with: an application root reached through a symlink (macOS\n // `/var` → `/private/var`) would otherwise put every real path outside its own store, and nothing\n // would ever be recognised as installed.\n let applicationStore: string | undefined;\n try {\n applicationStore = (await fsPromises.realpath(join(this.companionContext.saasRoot, 'node_modules', '.pnpm'))) + sep;\n } catch {\n applicationStore = undefined;\n }\n const frameworkRoots: string[] = [];\n const installedFrameworkRoots: string[] = [];\n for (const [root, packageName] of packageNameByRoot) {\n // Two independent witnesses, and a package that fails either is walked, the direction that cannot\n // go stale. The DECLARATION says a release was asked for. The STORE KEY says what pnpm actually\n // installed: a release lives under `<store>/@wildo-ai+<name>@<version>…`, while a `file:`-injected\n // copy lives in the same store under `@wildo-ai+<name>@file+…`. The location alone would not tell\n // those apart (an earlier version of this check relied on it and did not protect the injected copy:\n // review of #2395, M2), so a misread declaration (an override this reader cannot see, a selector key)\n // can no longer turn an injected engine copy into one that is never re-observed.\n const installedRelease = resolutionModeByName.get(packageName) === FrameworkPackageResolutionMode.INSTALLED_RELEASE\n && applicationStore !== undefined\n && isReleaseStoreLocation(root, applicationStore, packageName);\n (installedRelease ? installedFrameworkRoots : frameworkRoots).push(root);\n }\n\n return { applicationRoots: [...applicationRoots], frameworkRoots, installedFrameworkRoots };\n }\n\n /**\n * Fold the application root's own top-level FILES in, without descending it.\n *\n * These are `pnpm-lock.yaml`, `package.json`, `pnpm-workspace.yaml` (where the overrides live, #2808) and\n * `wildo.saas.config.ts` — the manifests that\n * decide which third-party bytes the child imports. Without them there is a narrow but real hole:\n * an install that moves a non-`@wildo-ai` dependency changes a derivation while touching nothing\n * inside a package root, because the walk enters `node_modules` only through the resolved\n * `@wildo-ai` scope. The lockfile moves on every such install, so one shallow read closes it.\n *\n * The root is NOT descended, because doing so would pull in `.wildo-saas` — the companion's own\n * dist and the runtime-signal files that are rewritten on a heartbeat, which would make every\n * token unique and every cache read a miss.\n */\n private async observeApplicationRootManifests(accumulator: SweepAccumulator, totals: SweepTotals): Promise<void> {\n let entries;\n try {\n entries = await fsPromises.readdir(this.companionContext.saasRoot, { withFileTypes: true });\n } catch {\n return;\n }\n\n await Promise.all(entries.map(async (entry) => {\n if (!entry.isFile()) return;\n accumulator.fileCount += 1;\n totals.entryCount += 1;\n try {\n const entryStats = await fsPromises.stat(join(this.companionContext.saasRoot, entry.name));\n if (entryStats.mtimeMs > accumulator.maximumMtimeMs) {\n accumulator.maximumMtimeMs = entryStats.mtimeMs;\n }\n } catch {\n // Counted above; a file that vanished between readdir and stat is itself a change, and the\n // count will differ on the next observation.\n }\n }));\n }\n}\n\n/**\n * Every APPLICATION package an introspection derivation can import: each declared service, each\n * resolved library, and the specifications package.\n *\n * ONE enumeration, shared by this observer and by the creation-plane projection's input signature\n * (#1310, seventh review G1), because both answer the same question — \"which built trees can move an\n * introspection result?\" — and two lists of one population agree only until one gains an entry.\n */\nexport function resolveIntrospectedApplicationPackageRoots(\n companionContext: Pick<CompanionContext, 'saasRoot' | 'servicesByKey' | 'resolvedLibraries' | 'resolvedSpecifications'>,\n): readonly string[] {\n const applicationRoots = new Set<string>();\n for (const serviceDefinition of Object.values(companionContext.servicesByKey)) {\n applicationRoots.add(resolve(companionContext.saasRoot, serviceDefinition.path));\n }\n for (const resolvedLibrary of Object.values(companionContext.resolvedLibraries)) {\n applicationRoots.add(resolvedLibrary.packageRoot);\n }\n if (companionContext.resolvedSpecifications) {\n applicationRoots.add(companionContext.resolvedSpecifications.packageRoot);\n }\n return [...applicationRoots];\n}\n\n/**\n * How an application resolves one `@wildo-ai/*` package, which decides whether its bytes can move while\n * the companion runs (#2395).\n */\nexport enum FrameworkPackageResolutionMode {\n /**\n * A published version, installed into the application's own pnpm store. Its bytes change only when an\n * install changes the resolution, and pnpm's store key carries the version and the peer resolution, so\n * that also changes where it resolves. An application created with `wildo init` against released\n * packages resolves every framework package this way.\n */\n INSTALLED_RELEASE = 'installed-release',\n /**\n * A link to a framework checkout (`file:`, `link:`, `workspace:`, `portal:`). The dogfood applications\n * resolve this way, and their injected copy is re-linked at supervised restart without the lockfile or\n * any manifest moving, so only its bytes can say it changed.\n */\n LINKED_SOURCE = 'linked-source',\n /**\n * Nothing settles it: an open range like `*` with no override, an alias, a URL, or no declaration\n * found. Treated as linked, because the cost of walking a tree that cannot move is time, and the cost\n * of not walking one that can is a stale answer.\n */\n UNDETERMINED = 'undetermined',\n}\n\n/** pnpm's protocols for a dependency that points into a directory rather than at a published version. */\nconst LINKED_SPECIFIER_PROTOCOLS = ['file:', 'link:', 'workspace:', 'portal:'] as const;\n\n/** One exact version or one single-comparator range over one (`1.1.9`, `^1.1.9`, `>=1.1.9`). */\nconst SINGLE_RELEASE_SPECIFIER = /^(?:[~^]|[<>]=?|=)?v?\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/;\n\n/**\n * Classify one dependency specifier for a framework package (#2395).\n *\n * Deliberately narrow on the release side: only a specifier that names one version (or one comparator\n * over one) counts. Anything open — `*`, `latest`, `1.x`, a `||` union — could be satisfied by a link the\n * override machinery chose, so it is UNDETERMINED and walked.\n */\nexport function classifyFrameworkPackageSpecifier(specifier: string | undefined): FrameworkPackageResolutionMode {\n if (specifier === undefined) return FrameworkPackageResolutionMode.UNDETERMINED;\n const trimmed = specifier.trim();\n if (LINKED_SPECIFIER_PROTOCOLS.some((protocol) => trimmed.startsWith(protocol))) return FrameworkPackageResolutionMode.LINKED_SOURCE;\n if (SINGLE_RELEASE_SPECIFIER.test(trimmed)) return FrameworkPackageResolutionMode.INSTALLED_RELEASE;\n return FrameworkPackageResolutionMode.UNDETERMINED;\n}\n\n/**\n * The resolution mode of every `@wildo-ai/*` package the application's manifests mention (#2395).\n *\n * The application's effective overrides decide first (#2808: `pnpm-workspace.yaml`, or `package.json` → `pnpm` in an\n * application that has not moved them, read through the shared pnpm-settings helper), because an override rewrites the specifier\n * of every workspace member and every transitive edge: that is how every application here pins its\n * framework (the dogfood ones to `file:` paths, a created one to a release). Without an override, the\n * owners' own declarations decide together: any link makes the package LINKED_SOURCE, all-release makes\n * it INSTALLED_RELEASE, anything else is UNDETERMINED.\n *\n * Read from the declarations rather than the lockfile because they are where the decision is written. The\n * lockfile records the same decision. Selector keys (`@wildo-ai/x@1`) and parent-scoped ones\n * (`a>@wildo-ai/x`) are not read. Such a package is decided by its\n * owners' declarations, which can therefore be wrong. That is why the caller also requires the STORE KEY to\n * name a version (`isReleaseStoreLocation`): a linked copy is walked however its declaration was misread.\n */\nexport async function readFrameworkPackageResolutionModes(\n saasRoot: string,\n ownerRoots: readonly string[],\n): Promise<ReadonlyMap<string, FrameworkPackageResolutionMode>> {\n const rootManifest = await readPackageManifest(saasRoot);\n let overrides: Record<string, unknown>;\n try {\n overrides = readApplicationPnpmSettings(saasRoot).overrides ?? {};\n } catch {\n // A settings file pnpm itself would refuse decides nothing here; the owners' declarations and the store key still do.\n overrides = {};\n }\n\n const declaredModes = new Map<string, FrameworkPackageResolutionMode[]>();\n for (const owner of new Set([saasRoot, ...ownerRoots])) {\n const manifest = owner === saasRoot ? rootManifest : await readPackageManifest(owner);\n if (manifest === undefined) continue;\n for (const field of ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'] as const) {\n const declared = manifest[field];\n if (!isRecord(declared)) continue;\n for (const [name, specifier] of Object.entries(declared)) {\n if (!name.startsWith('@wildo-ai/') || typeof specifier !== 'string') continue;\n declaredModes.set(name, [...(declaredModes.get(name) ?? []), classifyFrameworkPackageSpecifier(specifier)]);\n }\n }\n }\n\n const modes = new Map<string, FrameworkPackageResolutionMode>();\n for (const name of new Set([...Object.keys(overrides), ...declaredModes.keys()])) {\n if (!name.startsWith('@wildo-ai/')) continue;\n const override = overrides[name];\n if (typeof override === 'string') {\n modes.set(name, classifyFrameworkPackageSpecifier(override));\n continue;\n }\n const declared = declaredModes.get(name) ?? [];\n if (declared.includes(FrameworkPackageResolutionMode.LINKED_SOURCE)) {\n modes.set(name, FrameworkPackageResolutionMode.LINKED_SOURCE);\n } else if (declared.length > 0 && declared.every((mode) => mode === FrameworkPackageResolutionMode.INSTALLED_RELEASE)) {\n modes.set(name, FrameworkPackageResolutionMode.INSTALLED_RELEASE);\n } else {\n modes.set(name, FrameworkPackageResolutionMode.UNDETERMINED);\n }\n }\n return modes;\n}\n\n/**\n * Whether `root` is a RELEASE in the application's pnpm store: `<store><@wildo-ai+name>@<digit>…/…`.\n *\n * pnpm names a store entry `<scope>+<name>@<version>` for a registry install and `<scope>+<name>@file+…`\n * (or `link+…`) for one injected from a directory, so the character after the `@` separates them. A\n * patched release (`…@1.1.9_patch_hash=…`) and a peer suffix (`…@1.1.9_zod@4.3.6`) still start with the\n * version.\n *\n * Bytes inside a release are treated as immutable between installs. Hand-editing an installed release's\n * `dist` to debug something is therefore not seen until the companion restarts; edit the source and\n * reinstall, or relink it with `file:`, instead.\n */\nexport function isReleaseStoreLocation(root: string, applicationStore: string, packageName: string): boolean {\n if (!root.startsWith(applicationStore)) return false;\n const storeKey = root.slice(applicationStore.length).split(sep)[0] ?? '';\n const releasePrefix = `${packageName.replace('/', '+')}@`;\n return storeKey.startsWith(releasePrefix) && /^\\d/.test(storeKey.slice(releasePrefix.length));\n}\n\nasync function readPackageManifest(packageRoot: string): Promise<Record<string, unknown> | undefined> {\n try {\n const parsed: unknown = JSON.parse(await fsPromises.readFile(join(packageRoot, 'package.json'), 'utf8'));\n return isRecord(parsed) ? parsed : undefined;\n } catch {\n // An unreadable manifest decides nothing; every package it would have named stays walked.\n return undefined;\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n"]}
@@ -0,0 +1,64 @@
1
+ /** What one root's walk learned: the components of its token. */
2
+ export interface SourceWalkAccumulator {
3
+ fileCount: number;
4
+ directoryCount: number;
5
+ maximumMtimeMs: number;
6
+ }
7
+ /** One walk: the roots, and the bounds the observer owns. */
8
+ export interface SourceWalkRequest {
9
+ readonly roots: readonly string[];
10
+ /** Entries the observation already counted (manifests, held roots), so the ceiling bounds the whole sweep. */
11
+ readonly entryCountBefore: number;
12
+ /** Past this the walk stops and reports `exceededCeiling`; see the observer's `MAXIMUM_OBSERVED_ENTRIES`. */
13
+ readonly maximumEntries: number;
14
+ /** `DIRECTORY_WALK_CONCURRENCY`, passed rather than imported (see the module comment). */
15
+ readonly directoryConcurrency: number;
16
+ /** `FILE_STAT_CONCURRENCY`, passed rather than imported (see the module comment). */
17
+ readonly fileStatConcurrency: number;
18
+ }
19
+ /** {@link walkSourceRoots}'s answer: one accumulator per requested root, in request order. */
20
+ export interface SourceWalkResult {
21
+ readonly accumulators: readonly SourceWalkAccumulator[];
22
+ readonly entryCount: number;
23
+ readonly exceededCeiling: boolean;
24
+ }
25
+ /**
26
+ * Walk the roots and return one accumulator per root. Never rejects for a root that cannot be read: it contributes
27
+ * nothing, and when it appears later it is a new directory, which moves the counts.
28
+ */
29
+ export declare function walkSourceRoots(request: SourceWalkRequest): Promise<SourceWalkResult>;
30
+ /**
31
+ * The companion's side: one long-lived worker thread, started on first use and shared by every observer (two sweep the
32
+ * same roots). Unreferenced, so it never keeps the process alive.
33
+ *
34
+ * Fails toward the in-process walk, never toward a wrong token: a worker that cannot start, errors or exits fails its
35
+ * pending walks with a {@link SourceWalkWorkerUnavailableError}, the caller walks in process, and the next walk starts
36
+ * a fresh worker. After {@link MAXIMUM_WORKER_FAILURES} consecutive failures it stops trying for the life of the process,
37
+ * so a worker that can never start costs one failed start per walk at most a few times, not on every observation.
38
+ */
39
+ export declare class SourceWalkWorker {
40
+ private worker;
41
+ private nextId;
42
+ private consecutiveFailures;
43
+ private readonly pending;
44
+ private readonly options;
45
+ constructor(options?: {
46
+ readonly entryPath?: string;
47
+ });
48
+ /** The walk, on the worker; rejects with {@link SourceWalkWorkerUnavailableError} when no worker can do it. */
49
+ walk(request: SourceWalkRequest): Promise<SourceWalkResult>;
50
+ /** Whether the worker has been given up on for this process. For tests and logs. */
51
+ get disabled(): boolean;
52
+ /** Stop the worker (tests). A walk it was doing fails as unavailable, so its caller walks in process. */
53
+ close(): Promise<void>;
54
+ private ensureWorker;
55
+ /** Forget the worker and fail every walk it was doing as unavailable, so each is walked in process. */
56
+ private failPending;
57
+ }
58
+ /** A walk the worker could not do; the caller walks in process instead. */
59
+ export declare class SourceWalkWorkerUnavailableError extends Error {
60
+ readonly name = "SourceWalkWorkerUnavailableError";
61
+ }
62
+ /** Consecutive worker failures after which the companion walks in process for the rest of its life. */
63
+ export declare const MAXIMUM_WORKER_FAILURES = 3;
64
+ //# sourceMappingURL=introspection-source-walk.worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"introspection-source-walk.worker.d.ts","sourceRoot":"","sources":["../../../../../src/core/introspection/services/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