@wildo-ai/dev-companion 1.1.13 → 1.1.15

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 (363) hide show
  1. package/dist/esm/.tsbuildinfo +1 -1
  2. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +89 -1
  3. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts.map +1 -1
  4. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js +114 -9
  5. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
  6. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts +46 -1
  7. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts.map +1 -1
  8. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js +39 -2
  9. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js.map +1 -1
  10. package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.d.ts +6 -0
  11. package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.d.ts.map +1 -1
  12. package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.js.map +1 -1
  13. package/dist/esm/claude-cli/models/verification-tool-availability.models.d.ts +19 -5
  14. package/dist/esm/claude-cli/models/verification-tool-availability.models.d.ts.map +1 -1
  15. package/dist/esm/claude-cli/models/verification-tool-availability.models.js +17 -5
  16. package/dist/esm/claude-cli/models/verification-tool-availability.models.js.map +1 -1
  17. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts +16 -1
  18. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts.map +1 -1
  19. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +53 -6
  20. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js.map +1 -1
  21. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +145 -6
  22. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
  23. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +474 -47
  24. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
  25. package/dist/esm/claude-cli/services/git-change-set.companion.service.d.ts +6 -2
  26. package/dist/esm/claude-cli/services/git-change-set.companion.service.d.ts.map +1 -1
  27. package/dist/esm/claude-cli/services/git-change-set.companion.service.js +16 -39
  28. package/dist/esm/claude-cli/services/git-change-set.companion.service.js.map +1 -1
  29. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts +14 -0
  30. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts.map +1 -1
  31. package/dist/esm/claude-cli/services/research-evidence-store.companion.js +35 -0
  32. package/dist/esm/claude-cli/services/research-evidence-store.companion.js.map +1 -1
  33. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.d.ts +36 -0
  34. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.d.ts.map +1 -0
  35. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.js +134 -0
  36. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.js.map +1 -0
  37. package/dist/esm/code-compliance-check/check-raw-feature-id-literals.companion.js +31 -2
  38. package/dist/esm/code-compliance-check/check-raw-feature-id-literals.companion.js.map +1 -1
  39. package/dist/esm/companion-api/companion-api.schemas.d.ts +2 -0
  40. package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
  41. package/dist/esm/companion-api/companion-api.schemas.js +8 -0
  42. package/dist/esm/companion-api/companion-api.schemas.js.map +1 -1
  43. package/dist/esm/companion-api/controllers/companion.controller.d.ts +7 -0
  44. package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
  45. package/dist/esm/companion-api/controllers/companion.controller.js +26 -12
  46. package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
  47. package/dist/esm/companion-api/controllers/long-held-request.companion.d.ts +17 -0
  48. package/dist/esm/companion-api/controllers/long-held-request.companion.d.ts.map +1 -0
  49. package/dist/esm/companion-api/controllers/long-held-request.companion.js +33 -0
  50. package/dist/esm/companion-api/controllers/long-held-request.companion.js.map +1 -0
  51. package/dist/esm/core/introspection/resources/creation-home-projection.companion.d.ts +9 -0
  52. package/dist/esm/core/introspection/resources/creation-home-projection.companion.d.ts.map +1 -1
  53. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js +12 -0
  54. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js.map +1 -1
  55. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -1
  56. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +7 -1
  57. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -1
  58. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts +8 -20
  59. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts.map +1 -1
  60. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js +37 -142
  61. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js.map +1 -1
  62. package/dist/esm/core/introspection/services/introspection-source-walk.worker.d.ts +64 -0
  63. package/dist/esm/core/introspection/services/introspection-source-walk.worker.d.ts.map +1 -0
  64. package/dist/esm/core/introspection/services/introspection-source-walk.worker.js +304 -0
  65. package/dist/esm/core/introspection/services/introspection-source-walk.worker.js.map +1 -0
  66. package/dist/esm/core/introspection/services/translation-placement.companion.service.d.ts +3 -2
  67. package/dist/esm/core/introspection/services/translation-placement.companion.service.d.ts.map +1 -1
  68. package/dist/esm/core/introspection/services/translation-placement.companion.service.js.map +1 -1
  69. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.d.ts.map +1 -1
  70. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js +24 -14
  71. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js.map +1 -1
  72. package/dist/esm/core/introspection/workspace-element-index.companion.d.ts +42 -0
  73. package/dist/esm/core/introspection/workspace-element-index.companion.d.ts.map +1 -1
  74. package/dist/esm/core/introspection/workspace-element-index.companion.js +42 -0
  75. package/dist/esm/core/introspection/workspace-element-index.companion.js.map +1 -1
  76. package/dist/esm/core/runtime/companion-language-model-route.d.ts +16 -1
  77. package/dist/esm/core/runtime/companion-language-model-route.d.ts.map +1 -1
  78. package/dist/esm/core/runtime/companion-language-model-route.js +23 -1
  79. package/dist/esm/core/runtime/companion-language-model-route.js.map +1 -1
  80. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts +53 -0
  81. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts.map +1 -1
  82. package/dist/esm/core/runtime/dev-compile-quiet.companion.js +119 -2
  83. package/dist/esm/core/runtime/dev-compile-quiet.companion.js.map +1 -1
  84. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
  85. package/dist/esm/core/runtime/services/start-companion-application.service.js +16 -3
  86. package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
  87. package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts +2 -2
  88. package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts.map +1 -1
  89. package/dist/esm/core/runtime/utils/companion-platform-config.companion.js +6 -6
  90. package/dist/esm/core/runtime/utils/companion-platform-config.companion.js.map +1 -1
  91. package/dist/esm/core/utils/git-read-broker.companion.d.ts +62 -0
  92. package/dist/esm/core/utils/git-read-broker.companion.d.ts.map +1 -0
  93. package/dist/esm/core/utils/git-read-broker.companion.js +282 -0
  94. package/dist/esm/core/utils/git-read-broker.companion.js.map +1 -0
  95. package/dist/esm/core/utils/local-write-recording.companion.d.ts +8 -1
  96. package/dist/esm/core/utils/local-write-recording.companion.d.ts.map +1 -1
  97. package/dist/esm/core/utils/local-write-recording.companion.js +7 -23
  98. package/dist/esm/core/utils/local-write-recording.companion.js.map +1 -1
  99. package/dist/esm/email/services/email-template.companion.service.d.ts +5 -0
  100. package/dist/esm/email/services/email-template.companion.service.d.ts.map +1 -1
  101. package/dist/esm/email/services/email-template.companion.service.js +44 -11
  102. package/dist/esm/email/services/email-template.companion.service.js.map +1 -1
  103. package/dist/esm/email/utils/email-template-fs-discovery.utils.d.ts +26 -2
  104. package/dist/esm/email/utils/email-template-fs-discovery.utils.d.ts.map +1 -1
  105. package/dist/esm/email/utils/email-template-fs-discovery.utils.js +41 -2
  106. package/dist/esm/email/utils/email-template-fs-discovery.utils.js.map +1 -1
  107. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.d.ts +19 -0
  108. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.d.ts.map +1 -0
  109. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.js +171 -0
  110. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.js.map +1 -0
  111. package/dist/esm/email/utils/module-email-root.companion.utils.d.ts +75 -0
  112. package/dist/esm/email/utils/module-email-root.companion.utils.d.ts.map +1 -0
  113. package/dist/esm/email/utils/module-email-root.companion.utils.js +162 -0
  114. package/dist/esm/email/utils/module-email-root.companion.utils.js.map +1 -0
  115. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.d.ts +29 -0
  116. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.d.ts.map +1 -0
  117. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.js +29 -0
  118. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.js.map +1 -0
  119. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.d.ts +29 -0
  120. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.d.ts.map +1 -0
  121. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.js +29 -0
  122. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.js.map +1 -0
  123. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts +1 -0
  124. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts.map +1 -1
  125. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js +1 -0
  126. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js.map +1 -1
  127. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.d.ts +1 -0
  128. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.d.ts.map +1 -1
  129. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.js +1 -0
  130. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.js.map +1 -1
  131. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts +1 -0
  132. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts.map +1 -1
  133. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js +2 -1
  134. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js.map +1 -1
  135. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.d.ts +1 -0
  136. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.d.ts.map +1 -1
  137. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.js +2 -1
  138. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.js.map +1 -1
  139. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.d.ts +5 -2
  140. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.d.ts.map +1 -1
  141. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.js +5 -2
  142. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.js.map +1 -1
  143. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.d.ts +5 -2
  144. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.d.ts.map +1 -1
  145. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.js +5 -2
  146. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.js.map +1 -1
  147. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.d.ts +41 -0
  148. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.d.ts.map +1 -0
  149. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.js +41 -0
  150. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.js.map +1 -0
  151. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.d.ts +41 -0
  152. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.d.ts.map +1 -0
  153. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.js +41 -0
  154. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.js.map +1 -0
  155. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.d.ts +1 -0
  156. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.d.ts.map +1 -1
  157. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.js +2 -1
  158. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.js.map +1 -1
  159. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.d.ts +1 -0
  160. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.d.ts.map +1 -1
  161. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.js +2 -1
  162. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.js.map +1 -1
  163. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts +1 -0
  164. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts.map +1 -1
  165. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js +2 -1
  166. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js.map +1 -1
  167. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.d.ts +1 -0
  168. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.d.ts.map +1 -1
  169. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.js +2 -1
  170. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.js.map +1 -1
  171. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.d.ts +1 -0
  172. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.d.ts.map +1 -1
  173. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.js +2 -1
  174. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.js.map +1 -1
  175. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.d.ts +1 -0
  176. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.d.ts.map +1 -1
  177. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.js +2 -1
  178. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.js.map +1 -1
  179. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.d.ts +2 -0
  180. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.d.ts.map +1 -1
  181. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.js +3 -1
  182. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.js.map +1 -1
  183. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.d.ts +2 -0
  184. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.d.ts.map +1 -1
  185. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.js +3 -1
  186. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.js.map +1 -1
  187. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.d.ts +1 -1
  188. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.js +1 -1
  189. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.js.map +1 -1
  190. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.d.ts +1 -1
  191. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.js +1 -1
  192. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.js.map +1 -1
  193. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.d.ts +2 -0
  194. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.d.ts.map +1 -1
  195. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.js +3 -1
  196. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.js.map +1 -1
  197. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.d.ts +3 -1
  198. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.d.ts.map +1 -1
  199. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.js +4 -2
  200. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.js.map +1 -1
  201. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts +17 -0
  202. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts.map +1 -1
  203. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js +18 -1
  204. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js.map +1 -1
  205. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.d.ts +17 -0
  206. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.d.ts.map +1 -1
  207. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.js +18 -1
  208. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.js.map +1 -1
  209. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.d.ts +206 -195
  210. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.d.ts.map +1 -1
  211. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.js +206 -195
  212. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.js.map +1 -1
  213. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.d.ts +10 -0
  214. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.d.ts.map +1 -1
  215. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.js +12 -2
  216. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.js.map +1 -1
  217. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.d.ts +70 -0
  218. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.d.ts.map +1 -1
  219. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.js +70 -0
  220. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.js.map +1 -1
  221. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.d.ts +12 -2
  222. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.d.ts.map +1 -1
  223. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.js +12 -2
  224. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.js.map +1 -1
  225. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.d.ts +10 -0
  226. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.d.ts.map +1 -1
  227. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.js +10 -0
  228. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.js.map +1 -1
  229. package/dist/esm/i18n/resources/workbenchAspects.en.d.ts.map +1 -1
  230. package/dist/esm/i18n/resources/workbenchAspects.en.js +4 -0
  231. package/dist/esm/i18n/resources/workbenchAspects.en.js.map +1 -1
  232. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.d.ts +25 -20
  233. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.d.ts.map +1 -1
  234. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.js +25 -20
  235. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.js.map +1 -1
  236. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.d.ts +32 -32
  237. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.js +32 -32
  238. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.js.map +1 -1
  239. package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.d.ts +65 -65
  240. package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.js +65 -65
  241. package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.js.map +1 -1
  242. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.d.ts +20 -0
  243. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.d.ts.map +1 -1
  244. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.js +20 -0
  245. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.js.map +1 -1
  246. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.d.ts +12 -0
  247. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.d.ts.map +1 -1
  248. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.js +13 -1
  249. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.js.map +1 -1
  250. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +35 -0
  251. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
  252. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +12 -0
  253. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -1
  254. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts +536 -531
  255. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts.map +1 -1
  256. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js +536 -531
  257. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js.map +1 -1
  258. package/dist/esm/i18n/system_enums/application-creation.fr.d.ts +170 -170
  259. package/dist/esm/i18n/system_enums/application-creation.fr.js +170 -170
  260. package/dist/esm/i18n/system_enums/application-creation.fr.js.map +1 -1
  261. package/dist/esm/i18n/system_enums/flows-actors.fr.d.ts +22 -22
  262. package/dist/esm/i18n/system_enums/flows-actors.fr.js +22 -22
  263. package/dist/esm/i18n/system_enums/flows-actors.fr.js.map +1 -1
  264. package/dist/esm/i18n/system_enums/run-records.fr.d.ts +21 -21
  265. package/dist/esm/i18n/system_enums/run-records.fr.js +21 -21
  266. package/dist/esm/i18n/system_enums/run-records.fr.js.map +1 -1
  267. package/dist/esm/i18n/system_enums/workbench-build.en.d.ts +3 -2
  268. package/dist/esm/i18n/system_enums/workbench-build.en.d.ts.map +1 -1
  269. package/dist/esm/i18n/system_enums/workbench-build.en.js +3 -2
  270. package/dist/esm/i18n/system_enums/workbench-build.en.js.map +1 -1
  271. package/dist/esm/i18n/system_enums/workbench-build.fr.d.ts +37 -33
  272. package/dist/esm/i18n/system_enums/workbench-build.fr.d.ts.map +1 -1
  273. package/dist/esm/i18n/system_enums/workbench-build.fr.js +37 -33
  274. package/dist/esm/i18n/system_enums/workbench-build.fr.js.map +1 -1
  275. package/dist/esm/i18n/system_enums/workbench-creation-home.en.d.ts +1 -0
  276. package/dist/esm/i18n/system_enums/workbench-creation-home.en.d.ts.map +1 -1
  277. package/dist/esm/i18n/system_enums/workbench-creation-home.en.js +1 -0
  278. package/dist/esm/i18n/system_enums/workbench-creation-home.en.js.map +1 -1
  279. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.d.ts +18 -17
  280. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.d.ts.map +1 -1
  281. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.js +18 -17
  282. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.js.map +1 -1
  283. package/dist/esm/i18n/system_enums/workbench-dossier.fr.d.ts +7 -5
  284. package/dist/esm/i18n/system_enums/workbench-dossier.fr.d.ts.map +1 -1
  285. package/dist/esm/i18n/system_enums/workbench-dossier.fr.js +8 -6
  286. package/dist/esm/i18n/system_enums/workbench-dossier.fr.js.map +1 -1
  287. package/dist/esm/i18n/system_enums/workbench-secrets.fr.d.ts +12 -12
  288. package/dist/esm/i18n/system_enums/workbench-secrets.fr.js +12 -12
  289. package/dist/esm/i18n/system_enums/workbench-secrets.fr.js.map +1 -1
  290. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.d.ts +1 -0
  291. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.d.ts.map +1 -1
  292. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.js +2 -1
  293. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.js.map +1 -1
  294. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.d.ts.map +1 -1
  295. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js +7 -3
  296. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js.map +1 -1
  297. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.d.ts.map +1 -1
  298. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js +3 -4
  299. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js.map +1 -1
  300. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts +11 -0
  301. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts.map +1 -1
  302. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js +21 -0
  303. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js.map +1 -1
  304. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.d.ts +9 -0
  305. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.d.ts.map +1 -1
  306. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js +18 -2
  307. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js.map +1 -1
  308. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +153 -22
  309. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  310. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +970 -208
  311. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  312. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts +115 -13
  313. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts.map +1 -1
  314. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js +295 -56
  315. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js.map +1 -1
  316. package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.d.ts +3 -3
  317. package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.js +3 -3
  318. package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.js.map +1 -1
  319. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.d.ts +9 -0
  320. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.d.ts.map +1 -1
  321. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.js +19 -0
  322. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.js.map +1 -1
  323. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +1 -1
  324. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
  325. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js +48 -26
  326. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
  327. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.d.ts +12 -0
  328. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.d.ts.map +1 -1
  329. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.js +30 -1
  330. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.js.map +1 -1
  331. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.d.ts.map +1 -1
  332. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js +4 -5
  333. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js.map +1 -1
  334. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts.map +1 -1
  335. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js +12 -1
  336. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js.map +1 -1
  337. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts.map +1 -1
  338. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js +6 -3
  339. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js.map +1 -1
  340. package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.d.ts.map +1 -1
  341. package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.js +3 -5
  342. package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.js.map +1 -1
  343. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +8 -1
  344. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
  345. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +119 -25
  346. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  347. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.d.ts +55 -1
  348. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.d.ts.map +1 -1
  349. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.js +157 -10
  350. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.js.map +1 -1
  351. package/dist/esm/module-layout/module-layout-convention.companion.d.ts +158 -0
  352. package/dist/esm/module-layout/module-layout-convention.companion.d.ts.map +1 -0
  353. package/dist/esm/module-layout/module-layout-convention.companion.js +272 -0
  354. package/dist/esm/module-layout/module-layout-convention.companion.js.map +1 -0
  355. package/dist/esm/module-layout/module-layout-inspection.companion.d.ts +42 -0
  356. package/dist/esm/module-layout/module-layout-inspection.companion.d.ts.map +1 -0
  357. package/dist/esm/module-layout/module-layout-inspection.companion.js +290 -0
  358. package/dist/esm/module-layout/module-layout-inspection.companion.js.map +1 -0
  359. package/dist/esm/module-layout/module-source-files.companion.d.ts +3 -0
  360. package/dist/esm/module-layout/module-source-files.companion.d.ts.map +1 -0
  361. package/dist/esm/module-layout/module-source-files.companion.js +45 -0
  362. package/dist/esm/module-layout/module-source-files.companion.js.map +1 -0
  363. package/package.json +18 -18
@@ -142,6 +142,41 @@ export function writeFinalEvidenceRecord(input) {
142
142
  writeFileSync(filePath, body, 'utf8');
143
143
  return filePath;
144
144
  }
145
+ /**
146
+ * Every completed research turn of the application, read from the final evidence records under
147
+ * {@link RESEARCH_EVIDENCE_RELATIVE_ROOT} (`<scope>/<yyyy-mm-dd>-round-<n>.md`, written by {@link writeFinalEvidenceRecord}).
148
+ * The creation timeline reads them because a research turn writes no playbook-run row (#3896). A record without
149
+ * `startedAt` or `elapsedMs` is skipped; a missing root answers none. Throws only on an unreadable directory.
150
+ */
151
+ export function readResearchTurnRecords(saasRoot) {
152
+ const root = join(saasRoot, RESEARCH_EVIDENCE_RELATIVE_ROOT);
153
+ if (!existsSync(root))
154
+ return [];
155
+ const turns = [];
156
+ const visit = (directory, scope) => {
157
+ for (const entry of readdirSync(directory, { withFileTypes: true })) {
158
+ const fullPath = join(directory, entry.name);
159
+ if (entry.isDirectory()) {
160
+ visit(fullPath, scope === undefined ? entry.name : `${scope}/${entry.name}`);
161
+ continue;
162
+ }
163
+ if (!/^\d{4}-\d{2}-\d{2}-round-\d+\.md$/u.test(entry.name))
164
+ continue;
165
+ const frontmatter = /^---\n([\s\S]*?)\n---/u.exec(readFileSync(fullPath, 'utf8'))?.[1];
166
+ if (frontmatter === undefined)
167
+ continue;
168
+ const field = (name) => new RegExp(`^${name}: (.+)$`, 'mu').exec(frontmatter)?.[1]?.trim();
169
+ const startedAt = field('startedAt');
170
+ const elapsedMs = Number(field('elapsedMs'));
171
+ const playbookRef = field('playbookRef') ?? scope;
172
+ if (startedAt === undefined || Number.isNaN(Date.parse(startedAt)) || !Number.isFinite(elapsedMs) || playbookRef === undefined)
173
+ continue;
174
+ turns.push({ playbookRef, startedAt, elapsedMs });
175
+ }
176
+ };
177
+ visit(root, undefined);
178
+ return turns;
179
+ }
145
180
  /** The frontmatter line that says a research evidence file is the web's (#2846). */
146
181
  const CONTENT_TRUST_LINE = `contentTrust: ${MetaWorkflow_ContextSourceTrust.THIRD_PARTY}`;
147
182
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"research-evidence-store.companion.js","sourceRoot":"","sources":["../../../../src/claude-cli/services/research-evidence-store.companion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAA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eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC;IACjG,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { mkdirSync, writeFileSync, existsSync, readdirSync, readFileSync } from 'node:fs';\nimport { join, relative, sep } from 'node:path';\n\nimport { MetaWorkflow_ContextSourceTrust } from '@wildo-ai/saas-models/meta-workflows';\n\n/**\n * The research evidence store — where a research agent's findings become FILES.\n *\n * ## Why this exists (2026-09-04)\n *\n * Research evidence used to live in exactly one place: the run's in-memory step results, feeding\n * the next child's brief and dying with the run. Three consecutive compliance runs proved what that\n * costs — a 56-minute, 14-children evidence body lost to a quota cut, then two relaunches lost to\n * an expired login — and the run-level checkpoint only protects the SCHEDULING state, not the\n * knowledge. The store is the knowledge half: evidence lands on disk as it is gathered, survives\n * any death, and is READ BACK by later runs so they extend prior research instead of re-buying it.\n *\n * ## Where, and why it is COMMITTABLE\n *\n * `<application>/specifications/research-evidence/<scope>/` — inside the application repository,\n * outside `specifications/src/`, so it enters no TypeScript program and no family classification.\n * Committable on purpose: source-attributed research is knowledge the posture artifacts cite, and\n * \"delete it and re-run\" costs hours and a quota window — git is where things that must survive a\n * re-clone live (`one-source-of-truth.md`). Since #2419 a turn's evidence is RECORDED in the write register under the\n * root run of its tree, so `wildo creation accept <runId>` commits it; the record is accept-on-request-only, so the\n * posture's automatic commit never carries it: in the framework's dogfood applications this store sits inside\n * framework git, and unreviewed research has already tripped the assurance boundary gate there once.\n *\n * ## Who writes\n *\n * TWO writers, layered:\n * 1. The research AGENT, incrementally, during its turn — its WRITE predicate admits exactly its own\n * scope's directory, and its READ predicate the whole store (both built by the same\n * `buildApplicationCodingTaskLocationPredicate` the coding lane trusts), so a mid-turn death still\n * leaves everything already consolidated, and no task writes another scope's evidence (#1609).\n * 2. The COMPANION, once per completed task — `writeFinalEvidenceRecord` persists the returned\n * brief with its provenance frontmatter, so a completed turn is on disk even if the agent wrote\n * nothing itself.\n */\n\n/** Application-relative root of the store. Also the ONLY path prefix the research predicate admits. */\nexport const RESEARCH_EVIDENCE_RELATIVE_ROOT = 'specifications/research-evidence';\n\n/**\n * A scope names the investigation a set of evidence files belongs to — normally the composite\n * playbook ref (`top_down.compliance-analysis`), so every child of one choreography, across every\n * run of it, consolidates into one directory.\n */\nexport function resolveResearchEvidenceDirectory(saasRoot: string, scope: string): string {\n return join(saasRoot, RESEARCH_EVIDENCE_RELATIVE_ROOT, slugifyEvidenceScope(scope));\n}\n\n/** Directory-safe scope: lowercase, dots and separators to hyphens, nothing traversal-shaped. */\nexport function slugifyEvidenceScope(scope: string): string {\n const slug = scope\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .slice(0, 80);\n return slug.length > 0 ? slug : 'adhoc';\n}\n\n/**\n * The prompt block that turns \"you may write here\" into \"you consolidate here\".\n *\n * Appended to every research objective by the dispatch, never authored per playbook: the store is a\n * property of the LANE, and a convention restated per method drifts. The instruction is explicit\n * that the directory is the ONLY writable location — the predicate enforces it, but an agent told\n * the boundary spends its turn researching instead of discovering refusals.\n *\n * ## Why it also carries a SOURCE-NEUTRALITY clause (2026-09-04)\n *\n * A compliance researcher enumerating \"which regimes apply\" reaches for proprietary security\n * certification and attestation standards unprompted, alongside the public law that is the actual\n * subject. Public law is fine — statutes and regulations are quotable. The proprietary standards are\n * not: their control catalogues and identifiers are licensed material, and `CLAUDE.md` confines every\n * external framework name, identifier and mapping to a rights-classified boundary that this store is\n * not. `pnpm check:assurance-control-boundary` refuses them repository-wide against a baseline drained\n * to zero, so a dogfood application's committed store is a surface where they land in FRAMEWORK git.\n *\n * That is not hypothetical: Wonder CRM's first accepted evidence population carried six such names —\n * every one of them merely listing the standard as \"voluntary, not a legal obligation, never\n * researched\" — and reddened the gate on the shared branch. The finding survives its neutral phrasing\n * intact, which is why the instruction asks for the CATEGORY rather than forbidding the conclusion:\n * an agent told only \"do not name X\" tends to drop the finding along with the name.\n */\nexport function composeEvidenceStoreInstruction(evidenceDirectoryAbsolutePath: string, sharedEvidenceDirectoryAbsolutePath?: string): string {\n return [\n '# Evidence store (persist as you go)',\n `The directory \\`${evidenceDirectoryAbsolutePath}\\` is your evidence store — the ONLY location you may write to (every other path is refused).`,\n 'FIRST read what it already contains: earlier rounds consolidated their findings there. Extend that record; do not re-research or restate what a prior file already establishes with sources.',\n /*\n * An INSTANCE's research (#1609) keeps its own store, so one segment's or one feature's findings never\n * mix into another's, and READS the default instance's, where facts true of the whole application\n * (the market, the law) were gathered. Read-only: what this instance finds belongs to this instance.\n */\n ...(sharedEvidenceDirectoryAbsolutePath\n ? [`ALSO read \\`${sharedEvidenceDirectoryAbsolutePath}\\`: the evidence the application as a whole gathered for the same investigation. Rely on what it establishes and do not re-research it, but never write there; what you find for THIS purpose goes in your own store.`]\n : []),\n 'AS YOU RESEARCH, persist your findings into markdown files in that directory — one file per coherent topic, named `<topic-slug>.md`, updated in place as your understanding sharpens. Each finding carries its source URL beside it. Write incrementally: evidence on disk survives an interrupted turn; evidence only in your final message does not.',\n 'SOURCE NEUTRALITY: name public law freely (statutes, regulations, regulator guidance — quote and cite them). Do NOT name a proprietary security certification or attestation standard, or any of its control identifiers, in a file or in your final message: their catalogues are licensed material this store is not a rights-classified boundary for. Refer to that whole class as \"voluntary security-certification and attestation frameworks\" and state your finding about it in full — the conclusion is wanted, the proprietary name is not.',\n 'Your final message still reports the answer in full — the store is the durable record, not a substitute for answering.',\n ].join('\\n');\n}\n\n/** What the companion persists about one COMPLETED research task, beside whatever the agent wrote. */\nexport interface FinalEvidenceRecordInput {\n readonly evidenceDirectoryAbsolutePath: string;\n readonly objective: string;\n readonly evidence: string;\n readonly stopReason: string;\n readonly startedAtIso: string;\n readonly elapsedMs: number;\n /** The playbook that asked, when one did — an operator's ad-hoc `/research` has none. */\n readonly playbookRef?: string;\n}\n\n/**\n * Persist the final returned brief as a dated, provenance-stamped markdown record.\n *\n * Filename is `<yyyy-mm-dd>-round-<n>.md` where `n` disambiguates within a day — deliberately NOT\n * derived from the objective, whose first words are near-identical across rounds of one\n * investigation. Returns the absolute path written, so the caller can report it.\n */\nexport function writeFinalEvidenceRecord(input: FinalEvidenceRecordInput): string {\n mkdirSync(input.evidenceDirectoryAbsolutePath, { recursive: true });\n const day = input.startedAtIso.slice(0, 10);\n const existing = readdirSync(input.evidenceDirectoryAbsolutePath).filter((name) => name.startsWith(`${day}-round-`));\n let round = existing.length + 1;\n let filePath = join(input.evidenceDirectoryAbsolutePath, `${day}-round-${round}.md`);\n while (existsSync(filePath)) {\n round += 1;\n filePath = join(input.evidenceDirectoryAbsolutePath, `${day}-round-${round}.md`);\n }\n const frontmatter = [\n '---',\n `startedAt: ${input.startedAtIso}`,\n `elapsedMs: ${input.elapsedMs}`,\n `stopReason: ${input.stopReason}`,\n ...(input.playbookRef ? [`playbookRef: ${input.playbookRef}`] : []),\n /*\n * WHO WROTE IT (#2846): the evidence is the web's, condensed by a research agent, and a reader of the committed file\n * (an operator, a judge, a later research round) is told so in the record itself. The value is the brief's trust\n * vocabulary, so the file and a coding brief name the class identically.\n */\n `contentTrust: ${MetaWorkflow_ContextSourceTrust.THIRD_PARTY}`,\n '---',\n ].join('\\n');\n const body = [\n frontmatter,\n '',\n '## Objective',\n '',\n input.objective,\n '',\n '## Evidence',\n '',\n input.evidence,\n '',\n ].join('\\n');\n writeFileSync(filePath, body, 'utf8');\n return filePath;\n}\n\n/** The frontmatter line that says a research evidence file is the web's (#2846). */\nconst CONTENT_TRUST_LINE = `contentTrust: ${MetaWorkflow_ContextSourceTrust.THIRD_PARTY}`;\n\n/**\n * Stamp the markdown files a research turn wrote as THIRD_PARTY content (#2846 review M1, N7).\n *\n * The agent writes its own `<topic-slug>.md` files and is asked to cite sources; nothing made it say whose text the file\n * is, and an instruction is not a control. So the companion stamps them itself: a file with frontmatter gets (or has\n * corrected) its `contentTrust` line, a file without one gets a frontmatter block. A `contentTrust` line the file already\n * carries with another value is overwritten: text a research agent wrote cannot declare itself trusted.\n *\n * Only the files THIS turn created or changed are touched, read from the turn's own evidence diff (`before` is the\n * snapshot taken before the turn): a file an earlier round wrote, or a person edited since, is not this turn's to rewrite.\n * Idempotent. Returns the app-relative paths it changed.\n */\nexport function stampResearchEvidenceProvenance(saasRoot: string, evidenceDirectoryAbsolutePath: string, before: ReadonlyMap<string, string>): string[] {\n const stamped: string[] = [];\n for (const change of diffResearchEvidence(before, snapshotResearchEvidence(saasRoot, evidenceDirectoryAbsolutePath))) {\n if (!change.path.endsWith('.md')) continue;\n const next = withContentTrustStamp(change.writtenContent);\n if (next === change.writtenContent) continue;\n writeFileSync(join(saasRoot, ...change.path.split('/')), next, 'utf8');\n stamped.push(change.path);\n }\n return stamped;\n}\n\n/**\n * Whether the lines between two `---` markers are a FRONTMATTER block (YAML `key: value` entries, their indented\n * continuations and blank lines), and not two horizontal rules around ordinary markdown: a `# heading` or a sentence\n * between them is prose. A file that\n * opens on a `---` rule keeps it: the stamp then adds a frontmatter block above it rather than rewriting prose.\n */\nfunction isFrontmatterBlock(lines: readonly string[]): boolean {\n return lines.every((line) => line.trim().length === 0 || /^[A-Za-z0-9_-]+\\s*:/u.test(line) || /^\\s+\\S/u.test(line));\n}\n\n/**\n * The file's text with exactly one THIRD_PARTY `contentTrust` line in its frontmatter. Pure. Keeps the file's own line\n * endings: a CRLF file stays CRLF.\n */\nexport function withContentTrustStamp(content: string): string {\n const eol = /\\r\\n/u.test(content.slice(0, content.indexOf('\\n') + 1)) ? '\\r\\n' : '\\n';\n const frontmatter = /^---\\r?\\n(?:([\\s\\S]*?)\\r?\\n)?---(\\r?\\n|$)/u.exec(content);\n const lines = frontmatter === null || frontmatter[1] === undefined ? [] : frontmatter[1].split(/\\r?\\n/u);\n if (frontmatter === null || !isFrontmatterBlock(lines)) return `---${eol}${CONTENT_TRUST_LINE}${eol}---${eol}${eol}${content}`;\n const kept = lines.filter((line) => !/^\\s*contentTrust\\s*:/u.test(line));\n if (kept.length === lines.length - 1 && lines.includes(CONTENT_TRUST_LINE)) return content;\n const body = content.slice(frontmatter[0].length);\n return `---${eol}${[...kept, CONTENT_TRUST_LINE].join(eol)}${eol}---${frontmatter[2]}${body}`;\n}\n\n/**\n * Every file under an evidence directory, app-root-relative (POSIX), with its bytes. Empty when the directory does not\n * exist yet. Taken before and after a research turn so the turn's evidence can be recorded as a change (#2419).\n */\nexport function snapshotResearchEvidence(saasRoot: string, evidenceDirectoryAbsolutePath: string): Map<string, string> {\n const snapshot = new Map<string, string>();\n const walk = (directory: string): void => {\n if (!existsSync(directory)) return;\n for (const entry of readdirSync(directory, { withFileTypes: true })) {\n const absolutePath = join(directory, entry.name);\n if (entry.isDirectory()) walk(absolutePath);\n else if (entry.isFile()) snapshot.set(relative(saasRoot, absolutePath).split(sep).join('/'), readFileSync(absolutePath, 'utf8'));\n }\n };\n walk(evidenceDirectoryAbsolutePath);\n return snapshot;\n}\n\n/** The files a turn created or changed between two snapshots, with their pre-images. Deletions are not evidence. */\nexport function diffResearchEvidence(\n before: ReadonlyMap<string, string>,\n after: ReadonlyMap<string, string>,\n): Array<{ path: string; previousContent?: string; writtenContent: string }> {\n return [...after]\n .filter(([path, content]) => content.length > 0 && before.get(path) !== content)\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([path, writtenContent]) => {\n const previousContent = before.get(path);\n return { path, ...(previousContent !== undefined ? { previousContent } : {}), writtenContent };\n });\n}\n"]}
1
+ {"version":3,"file":"research-evidence-store.companion.js","sourceRoot":"","sources":["../../../../src/claude-cli/services/research-evidence-store.companion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAEvF;;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OAAO,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC;SAC/E,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;SACpD,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,EAAE;QAC9B,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC;IACjG,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { mkdirSync, writeFileSync, existsSync, readdirSync, readFileSync } from 'node:fs';\nimport { join, relative, sep } from 'node:path';\n\nimport { MetaWorkflow_ContextSourceTrust } from '@wildo-ai/saas-models/meta-workflows';\n\n/**\n * The research evidence store — where a research agent's findings become FILES.\n *\n * ## Why this exists (2026-09-04)\n *\n * Research evidence used to live in exactly one place: the run's in-memory step results, feeding\n * the next child's brief and dying with the run. Three consecutive compliance runs proved what that\n * costs — a 56-minute, 14-children evidence body lost to a quota cut, then two relaunches lost to\n * an expired login — and the run-level checkpoint only protects the SCHEDULING state, not the\n * knowledge. The store is the knowledge half: evidence lands on disk as it is gathered, survives\n * any death, and is READ BACK by later runs so they extend prior research instead of re-buying it.\n *\n * ## Where, and why it is COMMITTABLE\n *\n * `<application>/specifications/research-evidence/<scope>/` — inside the application repository,\n * outside `specifications/src/`, so it enters no TypeScript program and no family classification.\n * Committable on purpose: source-attributed research is knowledge the posture artifacts cite, and\n * \"delete it and re-run\" costs hours and a quota window — git is where things that must survive a\n * re-clone live (`one-source-of-truth.md`). Since #2419 a turn's evidence is RECORDED in the write register under the\n * root run of its tree, so `wildo creation accept <runId>` commits it; the record is accept-on-request-only, so the\n * posture's automatic commit never carries it: in the framework's dogfood applications this store sits inside\n * framework git, and unreviewed research has already tripped the assurance boundary gate there once.\n *\n * ## Who writes\n *\n * TWO writers, layered:\n * 1. The research AGENT, incrementally, during its turn — its WRITE predicate admits exactly its own\n * scope's directory, and its READ predicate the whole store (both built by the same\n * `buildApplicationCodingTaskLocationPredicate` the coding lane trusts), so a mid-turn death still\n * leaves everything already consolidated, and no task writes another scope's evidence (#1609).\n * 2. The COMPANION, once per completed task — `writeFinalEvidenceRecord` persists the returned\n * brief with its provenance frontmatter, so a completed turn is on disk even if the agent wrote\n * nothing itself.\n */\n\n/** Application-relative root of the store. Also the ONLY path prefix the research predicate admits. */\nexport const RESEARCH_EVIDENCE_RELATIVE_ROOT = 'specifications/research-evidence';\n\n/**\n * A scope names the investigation a set of evidence files belongs to — normally the composite\n * playbook ref (`top_down.compliance-analysis`), so every child of one choreography, across every\n * run of it, consolidates into one directory.\n */\nexport function resolveResearchEvidenceDirectory(saasRoot: string, scope: string): string {\n return join(saasRoot, RESEARCH_EVIDENCE_RELATIVE_ROOT, slugifyEvidenceScope(scope));\n}\n\n/** Directory-safe scope: lowercase, dots and separators to hyphens, nothing traversal-shaped. */\nexport function slugifyEvidenceScope(scope: string): string {\n const slug = scope\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .slice(0, 80);\n return slug.length > 0 ? slug : 'adhoc';\n}\n\n/**\n * The prompt block that turns \"you may write here\" into \"you consolidate here\".\n *\n * Appended to every research objective by the dispatch, never authored per playbook: the store is a\n * property of the LANE, and a convention restated per method drifts. The instruction is explicit\n * that the directory is the ONLY writable location — the predicate enforces it, but an agent told\n * the boundary spends its turn researching instead of discovering refusals.\n *\n * ## Why it also carries a SOURCE-NEUTRALITY clause (2026-09-04)\n *\n * A compliance researcher enumerating \"which regimes apply\" reaches for proprietary security\n * certification and attestation standards unprompted, alongside the public law that is the actual\n * subject. Public law is fine — statutes and regulations are quotable. The proprietary standards are\n * not: their control catalogues and identifiers are licensed material, and `CLAUDE.md` confines every\n * external framework name, identifier and mapping to a rights-classified boundary that this store is\n * not. `pnpm check:assurance-control-boundary` refuses them repository-wide against a baseline drained\n * to zero, so a dogfood application's committed store is a surface where they land in FRAMEWORK git.\n *\n * That is not hypothetical: Wonder CRM's first accepted evidence population carried six such names —\n * every one of them merely listing the standard as \"voluntary, not a legal obligation, never\n * researched\" — and reddened the gate on the shared branch. The finding survives its neutral phrasing\n * intact, which is why the instruction asks for the CATEGORY rather than forbidding the conclusion:\n * an agent told only \"do not name X\" tends to drop the finding along with the name.\n */\nexport function composeEvidenceStoreInstruction(evidenceDirectoryAbsolutePath: string, sharedEvidenceDirectoryAbsolutePath?: string): string {\n return [\n '# Evidence store (persist as you go)',\n `The directory \\`${evidenceDirectoryAbsolutePath}\\` is your evidence store — the ONLY location you may write to (every other path is refused).`,\n 'FIRST read what it already contains: earlier rounds consolidated their findings there. Extend that record; do not re-research or restate what a prior file already establishes with sources.',\n /*\n * An INSTANCE's research (#1609) keeps its own store, so one segment's or one feature's findings never\n * mix into another's, and READS the default instance's, where facts true of the whole application\n * (the market, the law) were gathered. Read-only: what this instance finds belongs to this instance.\n */\n ...(sharedEvidenceDirectoryAbsolutePath\n ? [`ALSO read \\`${sharedEvidenceDirectoryAbsolutePath}\\`: the evidence the application as a whole gathered for the same investigation. Rely on what it establishes and do not re-research it, but never write there; what you find for THIS purpose goes in your own store.`]\n : []),\n 'AS YOU RESEARCH, persist your findings into markdown files in that directory — one file per coherent topic, named `<topic-slug>.md`, updated in place as your understanding sharpens. Each finding carries its source URL beside it. Write incrementally: evidence on disk survives an interrupted turn; evidence only in your final message does not.',\n 'SOURCE NEUTRALITY: name public law freely (statutes, regulations, regulator guidance — quote and cite them). Do NOT name a proprietary security certification or attestation standard, or any of its control identifiers, in a file or in your final message: their catalogues are licensed material this store is not a rights-classified boundary for. Refer to that whole class as \"voluntary security-certification and attestation frameworks\" and state your finding about it in full — the conclusion is wanted, the proprietary name is not.',\n 'Your final message still reports the answer in full — the store is the durable record, not a substitute for answering.',\n ].join('\\n');\n}\n\n/** What the companion persists about one COMPLETED research task, beside whatever the agent wrote. */\nexport interface FinalEvidenceRecordInput {\n readonly evidenceDirectoryAbsolutePath: string;\n readonly objective: string;\n readonly evidence: string;\n readonly stopReason: string;\n readonly startedAtIso: string;\n readonly elapsedMs: number;\n /** The playbook that asked, when one did — an operator's ad-hoc `/research` has none. */\n readonly playbookRef?: string;\n}\n\n/**\n * Persist the final returned brief as a dated, provenance-stamped markdown record.\n *\n * Filename is `<yyyy-mm-dd>-round-<n>.md` where `n` disambiguates within a day — deliberately NOT\n * derived from the objective, whose first words are near-identical across rounds of one\n * investigation. Returns the absolute path written, so the caller can report it.\n */\nexport function writeFinalEvidenceRecord(input: FinalEvidenceRecordInput): string {\n mkdirSync(input.evidenceDirectoryAbsolutePath, { recursive: true });\n const day = input.startedAtIso.slice(0, 10);\n const existing = readdirSync(input.evidenceDirectoryAbsolutePath).filter((name) => name.startsWith(`${day}-round-`));\n let round = existing.length + 1;\n let filePath = join(input.evidenceDirectoryAbsolutePath, `${day}-round-${round}.md`);\n while (existsSync(filePath)) {\n round += 1;\n filePath = join(input.evidenceDirectoryAbsolutePath, `${day}-round-${round}.md`);\n }\n const frontmatter = [\n '---',\n `startedAt: ${input.startedAtIso}`,\n `elapsedMs: ${input.elapsedMs}`,\n `stopReason: ${input.stopReason}`,\n ...(input.playbookRef ? [`playbookRef: ${input.playbookRef}`] : []),\n /*\n * WHO WROTE IT (#2846): the evidence is the web's, condensed by a research agent, and a reader of the committed file\n * (an operator, a judge, a later research round) is told so in the record itself. The value is the brief's trust\n * vocabulary, so the file and a coding brief name the class identically.\n */\n `contentTrust: ${MetaWorkflow_ContextSourceTrust.THIRD_PARTY}`,\n '---',\n ].join('\\n');\n const body = [\n frontmatter,\n '',\n '## Objective',\n '',\n input.objective,\n '',\n '## Evidence',\n '',\n input.evidence,\n '',\n ].join('\\n');\n writeFileSync(filePath, body, 'utf8');\n return filePath;\n}\n\n/** One completed research turn, as its final evidence record states it (#3896). */\nexport interface ResearchTurnRecord {\n /** The playbook that asked; the record's own evidence scope (its directory) when the record names none. */\n readonly playbookRef: string;\n readonly startedAt: string;\n readonly elapsedMs: number;\n}\n\n/**\n * Every completed research turn of the application, read from the final evidence records under\n * {@link RESEARCH_EVIDENCE_RELATIVE_ROOT} (`<scope>/<yyyy-mm-dd>-round-<n>.md`, written by {@link writeFinalEvidenceRecord}).\n * The creation timeline reads them because a research turn writes no playbook-run row (#3896). A record without\n * `startedAt` or `elapsedMs` is skipped; a missing root answers none. Throws only on an unreadable directory.\n */\nexport function readResearchTurnRecords(saasRoot: string): readonly ResearchTurnRecord[] {\n const root = join(saasRoot, RESEARCH_EVIDENCE_RELATIVE_ROOT);\n if (!existsSync(root)) return [];\n const turns: ResearchTurnRecord[] = [];\n const visit = (directory: string, scope: string | undefined): void => {\n for (const entry of readdirSync(directory, { withFileTypes: true })) {\n const fullPath = join(directory, entry.name);\n if (entry.isDirectory()) {\n visit(fullPath, scope === undefined ? entry.name : `${scope}/${entry.name}`);\n continue;\n }\n if (!/^\\d{4}-\\d{2}-\\d{2}-round-\\d+\\.md$/u.test(entry.name)) continue;\n const frontmatter = /^---\\n([\\s\\S]*?)\\n---/u.exec(readFileSync(fullPath, 'utf8'))?.[1];\n if (frontmatter === undefined) continue;\n const field = (name: string) => new RegExp(`^${name}: (.+)$`, 'mu').exec(frontmatter)?.[1]?.trim();\n const startedAt = field('startedAt');\n const elapsedMs = Number(field('elapsedMs'));\n const playbookRef = field('playbookRef') ?? scope;\n if (startedAt === undefined || Number.isNaN(Date.parse(startedAt)) || !Number.isFinite(elapsedMs) || playbookRef === undefined) continue;\n turns.push({ playbookRef, startedAt, elapsedMs });\n }\n };\n visit(root, undefined);\n return turns;\n}\n\n/** The frontmatter line that says a research evidence file is the web's (#2846). */\nconst CONTENT_TRUST_LINE = `contentTrust: ${MetaWorkflow_ContextSourceTrust.THIRD_PARTY}`;\n\n/**\n * Stamp the markdown files a research turn wrote as THIRD_PARTY content (#2846 review M1, N7).\n *\n * The agent writes its own `<topic-slug>.md` files and is asked to cite sources; nothing made it say whose text the file\n * is, and an instruction is not a control. So the companion stamps them itself: a file with frontmatter gets (or has\n * corrected) its `contentTrust` line, a file without one gets a frontmatter block. A `contentTrust` line the file already\n * carries with another value is overwritten: text a research agent wrote cannot declare itself trusted.\n *\n * Only the files THIS turn created or changed are touched, read from the turn's own evidence diff (`before` is the\n * snapshot taken before the turn): a file an earlier round wrote, or a person edited since, is not this turn's to rewrite.\n * Idempotent. Returns the app-relative paths it changed.\n */\nexport function stampResearchEvidenceProvenance(saasRoot: string, evidenceDirectoryAbsolutePath: string, before: ReadonlyMap<string, string>): string[] {\n const stamped: string[] = [];\n for (const change of diffResearchEvidence(before, snapshotResearchEvidence(saasRoot, evidenceDirectoryAbsolutePath))) {\n if (!change.path.endsWith('.md')) continue;\n const next = withContentTrustStamp(change.writtenContent);\n if (next === change.writtenContent) continue;\n writeFileSync(join(saasRoot, ...change.path.split('/')), next, 'utf8');\n stamped.push(change.path);\n }\n return stamped;\n}\n\n/**\n * Whether the lines between two `---` markers are a FRONTMATTER block (YAML `key: value` entries, their indented\n * continuations and blank lines), and not two horizontal rules around ordinary markdown: a `# heading` or a sentence\n * between them is prose. A file that\n * opens on a `---` rule keeps it: the stamp then adds a frontmatter block above it rather than rewriting prose.\n */\nfunction isFrontmatterBlock(lines: readonly string[]): boolean {\n return lines.every((line) => line.trim().length === 0 || /^[A-Za-z0-9_-]+\\s*:/u.test(line) || /^\\s+\\S/u.test(line));\n}\n\n/**\n * The file's text with exactly one THIRD_PARTY `contentTrust` line in its frontmatter. Pure. Keeps the file's own line\n * endings: a CRLF file stays CRLF.\n */\nexport function withContentTrustStamp(content: string): string {\n const eol = /\\r\\n/u.test(content.slice(0, content.indexOf('\\n') + 1)) ? '\\r\\n' : '\\n';\n const frontmatter = /^---\\r?\\n(?:([\\s\\S]*?)\\r?\\n)?---(\\r?\\n|$)/u.exec(content);\n const lines = frontmatter === null || frontmatter[1] === undefined ? [] : frontmatter[1].split(/\\r?\\n/u);\n if (frontmatter === null || !isFrontmatterBlock(lines)) return `---${eol}${CONTENT_TRUST_LINE}${eol}---${eol}${eol}${content}`;\n const kept = lines.filter((line) => !/^\\s*contentTrust\\s*:/u.test(line));\n if (kept.length === lines.length - 1 && lines.includes(CONTENT_TRUST_LINE)) return content;\n const body = content.slice(frontmatter[0].length);\n return `---${eol}${[...kept, CONTENT_TRUST_LINE].join(eol)}${eol}---${frontmatter[2]}${body}`;\n}\n\n/**\n * Every file under an evidence directory, app-root-relative (POSIX), with its bytes. Empty when the directory does not\n * exist yet. Taken before and after a research turn so the turn's evidence can be recorded as a change (#2419).\n */\nexport function snapshotResearchEvidence(saasRoot: string, evidenceDirectoryAbsolutePath: string): Map<string, string> {\n const snapshot = new Map<string, string>();\n const walk = (directory: string): void => {\n if (!existsSync(directory)) return;\n for (const entry of readdirSync(directory, { withFileTypes: true })) {\n const absolutePath = join(directory, entry.name);\n if (entry.isDirectory()) walk(absolutePath);\n else if (entry.isFile()) snapshot.set(relative(saasRoot, absolutePath).split(sep).join('/'), readFileSync(absolutePath, 'utf8'));\n }\n };\n walk(evidenceDirectoryAbsolutePath);\n return snapshot;\n}\n\n/** The files a turn created or changed between two snapshots, with their pre-images. Deletions are not evidence. */\nexport function diffResearchEvidence(\n before: ReadonlyMap<string, string>,\n after: ReadonlyMap<string, string>,\n): Array<{ path: string; previousContent?: string; writtenContent: string }> {\n return [...after]\n .filter(([path, content]) => content.length > 0 && before.get(path) !== content)\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([path, writtenContent]) => {\n const previousContent = before.get(path);\n return { path, ...(previousContent !== undefined ? { previousContent } : {}), writtenContent };\n });\n}\n"]}
@@ -0,0 +1,36 @@
1
+ import type { CompanionContext } from '../../core/context/companion-context';
2
+ import { type GitChangeSetCapture, type GitChangeSetFileEntry } from '../models/coding-agent-dispatch.models';
3
+ /** Where an application keeps its provider packages: installed modules and authored ones alike (`providers/<ref>/`). */
4
+ export declare const APPLICATION_PROVIDER_PACKAGES_DIRECTORY = "providers";
5
+ /** One provider directory the run created that neither the lock nor the integration plan accounts for. */
6
+ export interface UnrecordedProviderDirectory {
7
+ readonly providerRef: string;
8
+ /** Application-relative, with its trailing slash: `providers/<ref>/`. */
9
+ readonly directory: string;
10
+ /** What the run wrote there, application-relative. */
11
+ readonly paths: readonly string[];
12
+ readonly advisory: string;
13
+ }
14
+ /**
15
+ * The provider directories the run CREATED, by ref, with the paths it wrote there. Pure over the change set; see the
16
+ * module's JSDoc for what counts as new.
17
+ */
18
+ export declare function findProviderDirectoriesCreatedByRun(files: readonly GitChangeSetFileEntry[]): ReadonlyMap<string, readonly string[]>;
19
+ /** The refs the lock records as installed module directories: the module ids and the files each entry lists. */
20
+ export declare function installedProviderRefsFromLockModules(installed: Readonly<Record<string, {
21
+ readonly moduleId: string;
22
+ readonly files: readonly string[];
23
+ }>>): ReadonlySet<string>;
24
+ /** The created directories neither recorded as installed nor named by a recorded unprovided need. Pure. */
25
+ export declare function selectUnrecordedProviderDirectories(input: {
26
+ readonly created: ReadonlyMap<string, readonly string[]>;
27
+ readonly installedRefs: ReadonlySet<string>;
28
+ readonly unprovidedNeedRefs: ReadonlySet<string>;
29
+ }): UnrecordedProviderDirectory[];
30
+ /**
31
+ * The advisory for a settled run's change set: reads the baseline commit and the lock and, only when the run created a
32
+ * provider directory neither accounts for, the integration plan. `undefined` when any of them could not be read, since an
33
+ * advisory that may be false is not one; an ABSENT plan reads as no recorded need, which is the case this exists for.
34
+ */
35
+ export declare function readUnrecordedProviderDirectories(companionContext: CompanionContext, changeSet: Pick<GitChangeSetCapture, 'files' | 'baselineHeadSha'>): Promise<readonly UnrecordedProviderDirectory[] | undefined>;
36
+ //# sourceMappingURL=unrecorded-provider-directories.companion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unrecorded-provider-directories.companion.d.ts","sourceRoot":"","sources":["../../../../src/claude-cli/services/unrecorded-provider-directories.companion.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,EAAwD,KAAK,mBAAmB,EAAE,KAAK,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAIpK,wHAAwH;AACxH,eAAO,MAAM,uCAAuC,cAAc,CAAC;AAEnE,0GAA0G;AAC1G,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAUD;;;GAGG;AACH,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,SAAS,qBAAqB,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAenI;AAED,gHAAgH;AAChH,wBAAgB,oCAAoC,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAY/K;AAED,2GAA2G;AAC3G,wBAAgB,mCAAmC,CAAC,KAAK,EAAE;IACzD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;IACzD,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAClD,GAAG,2BAA2B,EAAE,CAYhC;AAQD;;;;GAIG;AACH,wBAAsB,iCAAiC,CACrD,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,iBAAiB,CAAC,GAChE,OAAO,CAAC,SAAS,2BAA2B,EAAE,GAAG,SAAS,CAAC,CAyB7D"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * A provider a coding run AUTHORED that nothing decided to author (#3995 item 2): an ADVISORY on the run's result, never a
3
+ * refusal.
4
+ *
5
+ * App creation uses the providers the framework already has, and authors a new one only for a need the integration plan
6
+ * records with its reason (#3992, Paul 2026-11-16). The worker contract tells the agent so, and the build decomposition
7
+ * emits an authoring task only for such a need. Neither stops an agent from writing `providers/<ref>/` anyway, and nothing
8
+ * looked afterwards. This is the look: a NEW `providers/<ref>/` directory the run wrote, that the lock does not record as
9
+ * an installed module (`.wildo-saas/wildo-saas.lock.json` → `sections.modules.installed`, what `wildo registry add`
10
+ * writes) and that no `unprovidedNeeds` entry of the integration plan names.
11
+ *
12
+ * Why an advisory: a coding run produces a WORKING result and acceptance is the commit
13
+ * (`application-creation-directive.md`). The directory may be the start of a legitimate need nobody recorded yet, and the
14
+ * remedy (record the need, install the registry module instead, or remove the package) is a person's or a judge's. So it
15
+ * rides on the run's recorded scope assessment, which the run's reviewer and the `dispatch-outcome-sound` judge read.
16
+ *
17
+ * What counts as NEW: a directory the run added files to (`added` / `untracked`, clean at the baseline, written by this
18
+ * run rather than another writer), in which it changed no file that existed (`modified`, `deleted`, `renamed` mean the
19
+ * directory was already there), and which held no committed file at the run's baseline commit (`git ls-tree`), so an
20
+ * earlier-authored package the run only adds a file to is not new either. So an edit to an installed or earlier-authored
21
+ * provider is never flagged here: what an earlier run authored was reported on that run.
22
+ */
23
+ import { execFile } from 'node:child_process';
24
+ import { promisify } from 'node:util';
25
+ import { DEFAULT_REGISTRY_SECTION_SCHEMAS, readWildoSaasLock } from '@wildo-ai/platform-config-lib';
26
+ import { APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS } from '@wildo-ai/application-creation-runtime';
27
+ import { ApplicationSpecificationFamily, IntegrationPlanSchema } from '@wildo-ai/saas-specifications/application-creation';
28
+ import { loadSpecificationFamilyData } from '../../core/context/specification-family-data.companion.js';
29
+ import { ChangeSetFileChangeKind, isAttributedToAnotherWriter } from '../models/coding-agent-dispatch.models.js';
30
+ const execFileAsync = promisify(execFile);
31
+ /** Where an application keeps its provider packages: installed modules and authored ones alike (`providers/<ref>/`). */
32
+ export const APPLICATION_PROVIDER_PACKAGES_DIRECTORY = 'providers';
33
+ const NEW_FILE_KINDS = new Set([ChangeSetFileChangeKind.ADDED, ChangeSetFileChangeKind.UNTRACKED]);
34
+ /** The provider ref a path sits under (`providers/<ref>/…`), or `undefined` for any other path. */
35
+ function providerRefOf(path) {
36
+ const segments = path.replace(/\\/gu, '/').replace(/^\.\//u, '').split('/');
37
+ return segments.length >= 3 && segments[0] === APPLICATION_PROVIDER_PACKAGES_DIRECTORY && segments[1] !== '' ? segments[1] : undefined;
38
+ }
39
+ /**
40
+ * The provider directories the run CREATED, by ref, with the paths it wrote there. Pure over the change set; see the
41
+ * module's JSDoc for what counts as new.
42
+ */
43
+ export function findProviderDirectoriesCreatedByRun(files) {
44
+ const created = new Map();
45
+ const preExisting = new Set();
46
+ for (const entry of files) {
47
+ if (isAttributedToAnotherWriter(entry.attribution))
48
+ continue;
49
+ const ref = providerRefOf(entry.path);
50
+ if (ref === undefined)
51
+ continue;
52
+ if (NEW_FILE_KINDS.has(entry.changeKind) && !entry.dirtyAtBaseline) {
53
+ created.set(ref, [...(created.get(ref) ?? []), entry.path]);
54
+ }
55
+ else {
56
+ preExisting.add(ref);
57
+ }
58
+ }
59
+ for (const ref of preExisting)
60
+ created.delete(ref);
61
+ return created;
62
+ }
63
+ /** The refs the lock records as installed module directories: the module ids and the files each entry lists. */
64
+ export function installedProviderRefsFromLockModules(installed) {
65
+ const refs = new Set();
66
+ for (const entry of Object.values(installed)) {
67
+ // The module id is the directory (`providers/asana`), and every file the install wrote sits under it.
68
+ const [root, moduleRef] = entry.moduleId.split('/');
69
+ if (root === APPLICATION_PROVIDER_PACKAGES_DIRECTORY && moduleRef !== undefined && moduleRef !== '')
70
+ refs.add(moduleRef);
71
+ for (const path of entry.files) {
72
+ const ref = providerRefOf(path);
73
+ if (ref !== undefined)
74
+ refs.add(ref);
75
+ }
76
+ }
77
+ return refs;
78
+ }
79
+ /** The created directories neither recorded as installed nor named by a recorded unprovided need. Pure. */
80
+ export function selectUnrecordedProviderDirectories(input) {
81
+ return [...input.created.entries()]
82
+ .filter(([ref]) => !input.installedRefs.has(ref) && !input.unprovidedNeedRefs.has(ref))
83
+ .sort(([left], [right]) => left.localeCompare(right))
84
+ .map(([ref, paths]) => ({
85
+ providerRef: ref,
86
+ directory: `${APPLICATION_PROVIDER_PACKAGES_DIRECTORY}/${ref}/`,
87
+ paths: [...paths].sort(),
88
+ advisory: `The run created ${APPLICATION_PROVIDER_PACKAGES_DIRECTORY}/${ref}/, a provider package no installed module accounts for `
89
+ + `and no unprovidedNeeds entry of the integration plan names. A provider is authored only for a need nothing the framework `
90
+ + `has fills, recorded with why (#3992): record that need, install the registry module that fills it instead, or remove the package.`,
91
+ }));
92
+ }
93
+ /** Whether `providers/<ref>/` held a committed file at `commit`, read with `git ls-tree` from the application root. */
94
+ async function providerDirectoryCommittedAt(applicationRoot, commit, providerRef) {
95
+ const { stdout } = await execFileAsync('git', ['-C', applicationRoot, 'ls-tree', '--name-only', commit, '--', `${APPLICATION_PROVIDER_PACKAGES_DIRECTORY}/${providerRef}/`]);
96
+ return stdout.trim() !== '';
97
+ }
98
+ /**
99
+ * The advisory for a settled run's change set: reads the baseline commit and the lock and, only when the run created a
100
+ * provider directory neither accounts for, the integration plan. `undefined` when any of them could not be read, since an
101
+ * advisory that may be false is not one; an ABSENT plan reads as no recorded need, which is the case this exists for.
102
+ */
103
+ export async function readUnrecordedProviderDirectories(companionContext, changeSet) {
104
+ const createdByRun = findProviderDirectoriesCreatedByRun(changeSet.files);
105
+ if (createdByRun.size === 0)
106
+ return [];
107
+ // A directory with a committed file at the baseline existed before the run, whatever the run added to it.
108
+ const created = new Map();
109
+ for (const [ref, paths] of createdByRun) {
110
+ if (!(await providerDirectoryCommittedAt(companionContext.saasRoot, changeSet.baselineHeadSha, ref)))
111
+ created.set(ref, paths);
112
+ }
113
+ if (created.size === 0)
114
+ return [];
115
+ const envelope = await readWildoSaasLock({ saasRoot: companionContext.saasRoot, sectionSchemas: DEFAULT_REGISTRY_SECTION_SCHEMAS, createIfMissing: true });
116
+ const modules = envelope.sections.modules;
117
+ const installedRefs = installedProviderRefsFromLockModules(modules?.installed ?? {});
118
+ if ([...created.keys()].every((ref) => installedRefs.has(ref)))
119
+ return [];
120
+ const binding = APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS.find((entry) => entry.family === ApplicationSpecificationFamily.INTEGRATION_PLAN);
121
+ let unprovidedNeedRefs = new Set();
122
+ if (binding?.companionExportsField !== undefined && companionContext.resolvedSpecifications != null) {
123
+ const exports = await loadSpecificationFamilyData(companionContext);
124
+ const plan = exports[binding.companionExportsField];
125
+ if (plan !== undefined) {
126
+ const parsed = IntegrationPlanSchema.safeParse(plan);
127
+ if (!parsed.success)
128
+ return undefined;
129
+ unprovidedNeedRefs = new Set(parsed.data.unprovidedNeeds.map((need) => need.providerRef));
130
+ }
131
+ }
132
+ return selectUnrecordedProviderDirectories({ created, installedRefs, unprovidedNeedRefs });
133
+ }
134
+ //# sourceMappingURL=unrecorded-provider-directories.companion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unrecorded-provider-directories.companion.js","sourceRoot":"","sources":["../../../../src/claude-cli/services/unrecorded-provider-directories.companion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,QAAQ,EAAE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AAE,CAAC;IACxD,IAAI,OAAO,EAAE,qBAAqB,KAAK,SAAS,IAAI,gBAAgB,CAAC,sBAAsB,IAAI,IAAI,EAAE,CAAC;QACpG,MAAM,OAAO,GAAG,MAAM,2BAA2B,CAAC,gBAAgB,CAAuC,CAAC;QAC1G,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;QACpD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,MAAM,GAAG,qBAAqB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YACrD,IAAI,CAAC,MAAM,CAAC,OAAO;gBAAE,OAAO,SAAS,CAAC;YACtC,kBAAkB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;IACD,OAAO,mCAAmC,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC,CAAC;AAC7F,CAAC","sourcesContent":["/**\n * A provider a coding run AUTHORED that nothing decided to author (#3995 item 2): an ADVISORY on the run's result, never a\n * refusal.\n *\n * App creation uses the providers the framework already has, and authors a new one only for a need the integration plan\n * records with its reason (#3992, Paul 2026-11-16). The worker contract tells the agent so, and the build decomposition\n * emits an authoring task only for such a need. Neither stops an agent from writing `providers/<ref>/` anyway, and nothing\n * looked afterwards. This is the look: a NEW `providers/<ref>/` directory the run wrote, that the lock does not record as\n * an installed module (`.wildo-saas/wildo-saas.lock.json` → `sections.modules.installed`, what `wildo registry add`\n * writes) and that no `unprovidedNeeds` entry of the integration plan names.\n *\n * Why an advisory: a coding run produces a WORKING result and acceptance is the commit\n * (`application-creation-directive.md`). The directory may be the start of a legitimate need nobody recorded yet, and the\n * remedy (record the need, install the registry module instead, or remove the package) is a person's or a judge's. So it\n * rides on the run's recorded scope assessment, which the run's reviewer and the `dispatch-outcome-sound` judge read.\n *\n * What counts as NEW: a directory the run added files to (`added` / `untracked`, clean at the baseline, written by this\n * run rather than another writer), in which it changed no file that existed (`modified`, `deleted`, `renamed` mean the\n * directory was already there), and which held no committed file at the run's baseline commit (`git ls-tree`), so an\n * earlier-authored package the run only adds a file to is not new either. So an edit to an installed or earlier-authored\n * provider is never flagged here: what an earlier run authored was reported on that run.\n */\nimport { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\n\nimport { DEFAULT_REGISTRY_SECTION_SCHEMAS, readWildoSaasLock } from '@wildo-ai/platform-config-lib';\nimport { APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS } from '@wildo-ai/application-creation-runtime';\nimport { ApplicationSpecificationFamily, IntegrationPlanSchema } from '@wildo-ai/saas-specifications/application-creation';\n\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { loadSpecificationFamilyData } from '../../core/context/specification-family-data.companion';\nimport { ChangeSetFileChangeKind, isAttributedToAnotherWriter, type GitChangeSetCapture, type GitChangeSetFileEntry } from '../models/coding-agent-dispatch.models';\n\nconst execFileAsync = promisify(execFile);\n\n/** Where an application keeps its provider packages: installed modules and authored ones alike (`providers/<ref>/`). */\nexport const APPLICATION_PROVIDER_PACKAGES_DIRECTORY = 'providers';\n\n/** One provider directory the run created that neither the lock nor the integration plan accounts for. */\nexport interface UnrecordedProviderDirectory {\n readonly providerRef: string;\n /** Application-relative, with its trailing slash: `providers/<ref>/`. */\n readonly directory: string;\n /** What the run wrote there, application-relative. */\n readonly paths: readonly string[];\n readonly advisory: string;\n}\n\nconst NEW_FILE_KINDS: ReadonlySet<ChangeSetFileChangeKind> = new Set([ChangeSetFileChangeKind.ADDED, ChangeSetFileChangeKind.UNTRACKED]);\n\n/** The provider ref a path sits under (`providers/<ref>/…`), or `undefined` for any other path. */\nfunction providerRefOf(path: string): string | undefined {\n const segments = path.replace(/\\\\/gu, '/').replace(/^\\.\\//u, '').split('/');\n return segments.length >= 3 && segments[0] === APPLICATION_PROVIDER_PACKAGES_DIRECTORY && segments[1] !== '' ? segments[1] : undefined;\n}\n\n/**\n * The provider directories the run CREATED, by ref, with the paths it wrote there. Pure over the change set; see the\n * module's JSDoc for what counts as new.\n */\nexport function findProviderDirectoriesCreatedByRun(files: readonly GitChangeSetFileEntry[]): ReadonlyMap<string, readonly string[]> {\n const created = new Map<string, string[]>();\n const preExisting = new Set<string>();\n for (const entry of files) {\n if (isAttributedToAnotherWriter(entry.attribution)) continue;\n const ref = providerRefOf(entry.path);\n if (ref === undefined) continue;\n if (NEW_FILE_KINDS.has(entry.changeKind) && !entry.dirtyAtBaseline) {\n created.set(ref, [...(created.get(ref) ?? []), entry.path]);\n } else {\n preExisting.add(ref);\n }\n }\n for (const ref of preExisting) created.delete(ref);\n return created;\n}\n\n/** The refs the lock records as installed module directories: the module ids and the files each entry lists. */\nexport function installedProviderRefsFromLockModules(installed: Readonly<Record<string, { readonly moduleId: string; readonly files: readonly string[] }>>): ReadonlySet<string> {\n const refs = new Set<string>();\n for (const entry of Object.values(installed)) {\n // The module id is the directory (`providers/asana`), and every file the install wrote sits under it.\n const [root, moduleRef] = entry.moduleId.split('/');\n if (root === APPLICATION_PROVIDER_PACKAGES_DIRECTORY && moduleRef !== undefined && moduleRef !== '') refs.add(moduleRef);\n for (const path of entry.files) {\n const ref = providerRefOf(path);\n if (ref !== undefined) refs.add(ref);\n }\n }\n return refs;\n}\n\n/** The created directories neither recorded as installed nor named by a recorded unprovided need. Pure. */\nexport function selectUnrecordedProviderDirectories(input: {\n readonly created: ReadonlyMap<string, readonly string[]>;\n readonly installedRefs: ReadonlySet<string>;\n readonly unprovidedNeedRefs: ReadonlySet<string>;\n}): UnrecordedProviderDirectory[] {\n return [...input.created.entries()]\n .filter(([ref]) => !input.installedRefs.has(ref) && !input.unprovidedNeedRefs.has(ref))\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([ref, paths]) => ({\n providerRef: ref,\n directory: `${APPLICATION_PROVIDER_PACKAGES_DIRECTORY}/${ref}/`,\n paths: [...paths].sort(),\n advisory: `The run created ${APPLICATION_PROVIDER_PACKAGES_DIRECTORY}/${ref}/, a provider package no installed module accounts for `\n + `and no unprovidedNeeds entry of the integration plan names. A provider is authored only for a need nothing the framework `\n + `has fills, recorded with why (#3992): record that need, install the registry module that fills it instead, or remove the package.`,\n }));\n}\n\n/** Whether `providers/<ref>/` held a committed file at `commit`, read with `git ls-tree` from the application root. */\nasync function providerDirectoryCommittedAt(applicationRoot: string, commit: string, providerRef: string): Promise<boolean> {\n const { stdout } = await execFileAsync('git', ['-C', applicationRoot, 'ls-tree', '--name-only', commit, '--', `${APPLICATION_PROVIDER_PACKAGES_DIRECTORY}/${providerRef}/`]);\n return stdout.trim() !== '';\n}\n\n/**\n * The advisory for a settled run's change set: reads the baseline commit and the lock and, only when the run created a\n * provider directory neither accounts for, the integration plan. `undefined` when any of them could not be read, since an\n * advisory that may be false is not one; an ABSENT plan reads as no recorded need, which is the case this exists for.\n */\nexport async function readUnrecordedProviderDirectories(\n companionContext: CompanionContext,\n changeSet: Pick<GitChangeSetCapture, 'files' | 'baselineHeadSha'>,\n): Promise<readonly UnrecordedProviderDirectory[] | undefined> {\n const createdByRun = findProviderDirectoriesCreatedByRun(changeSet.files);\n if (createdByRun.size === 0) return [];\n // A directory with a committed file at the baseline existed before the run, whatever the run added to it.\n const created = new Map<string, readonly string[]>();\n for (const [ref, paths] of createdByRun) {\n if (!(await providerDirectoryCommittedAt(companionContext.saasRoot, changeSet.baselineHeadSha, ref))) created.set(ref, paths);\n }\n if (created.size === 0) return [];\n const envelope = await readWildoSaasLock({ saasRoot: companionContext.saasRoot, sectionSchemas: DEFAULT_REGISTRY_SECTION_SCHEMAS, createIfMissing: true });\n const modules = envelope.sections.modules as { installed?: Record<string, { moduleId: string; files: string[] }> } | undefined;\n const installedRefs = installedProviderRefsFromLockModules(modules?.installed ?? {});\n if ([...created.keys()].every((ref) => installedRefs.has(ref))) return [];\n const binding = APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS.find((entry) => entry.family === ApplicationSpecificationFamily.INTEGRATION_PLAN);\n let unprovidedNeedRefs: ReadonlySet<string> = new Set();\n if (binding?.companionExportsField !== undefined && companionContext.resolvedSpecifications != null) {\n const exports = await loadSpecificationFamilyData(companionContext) as unknown as Record<string, unknown>;\n const plan = exports[binding.companionExportsField];\n if (plan !== undefined) {\n const parsed = IntegrationPlanSchema.safeParse(plan);\n if (!parsed.success) return undefined;\n unprovidedNeedRefs = new Set(parsed.data.unprovidedNeeds.map((need) => need.providerRef));\n }\n }\n return selectUnrecordedProviderDirectories({ created, installedRefs, unprovidedNeedRefs });\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import { spawnSync } from 'node:child_process';
1
2
  import { existsSync, readdirSync, readFileSync } from 'node:fs';
2
3
  import { dirname, extname, join, relative, resolve } from 'node:path';
3
4
  import ts from 'typescript';
@@ -19,6 +20,10 @@ const IGNORED_DIRS = new Set([
19
20
  'dist',
20
21
  'node_modules',
21
22
  '_code_archive',
23
+ // Compile staging and runtime state a running dev watcher writes and swaps under the application's packages: never
24
+ // authored source, and a file can vanish between the walk and the read, which failed a local `pnpm build` (ENOENT on
25
+ // a staged `.d.ts`) while the stack was up.
26
+ '.wildo-runtime-signals',
22
27
  ]);
23
28
  const FEATURE_GATE_EXPORT = 'FeatureGate';
24
29
  const HOOK_EXPORTS = new Set([
@@ -99,6 +104,28 @@ function getScriptKind(filePath) {
99
104
  }
100
105
  return ts.ScriptKind.TS;
101
106
  }
107
+ /**
108
+ * The application's source files: what git does not ignore under the root, tracked or not yet added.
109
+ *
110
+ * Build outputs and runtime state (`dist`, the docs site's `build` and `.docusaurus`, `.astro`, a watcher's
111
+ * `.wildo-runtime-signals` staging) are all gitignored, and the check must never read them: a sibling package's build
112
+ * rewrites them while turbo runs this check beside it, and the finalization verifier's build failed on a docs-site asset
113
+ * deleted between the walk and the read (run 43808255505). A hand-kept list of output directories had already missed
114
+ * `build`, so the ignore rules the application keeps are the boundary. Outside a git checkout the directory walk stands in.
115
+ */
116
+ function listSourceFiles(scanRoot) {
117
+ const listed = spawnSync('git', ['ls-files', '--cached', '--others', '--exclude-standard', '-z'], { cwd: scanRoot, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
118
+ if (listed.status !== 0) {
119
+ const files = [];
120
+ walkSourceFiles(scanRoot, files);
121
+ return files;
122
+ }
123
+ return listed.stdout
124
+ .split('\0')
125
+ .filter((relativePath) => relativePath.length > 0 && !relativePath.split('/').some((segment) => IGNORED_DIRS.has(segment)))
126
+ .map((relativePath) => join(scanRoot, relativePath))
127
+ .filter((filePath) => isSourceFilePath(filePath) && existsSync(filePath));
128
+ }
102
129
  function walkSourceFiles(directoryPath, files) {
103
130
  for (const entry of readdirSync(directoryPath, { withFileTypes: true })) {
104
131
  if (entry.isDirectory()) {
@@ -400,6 +427,9 @@ function formatLocation(scanRoot, sourceFile, node) {
400
427
  return `${relative(scanRoot, sourceFile.fileName)}:${line + 1}:${character + 1}`;
401
428
  }
402
429
  function collectViolations(filePath, scanRoot) {
430
+ // A file listed a moment ago may be gone by now (an editor's swap, a generator rewriting it): it holds no call site.
431
+ if (!existsSync(filePath))
432
+ return [];
403
433
  const sourceFile = getParsedSourceFile(filePath);
404
434
  const trackedImports = collectTrackedImports(sourceFile);
405
435
  if (trackedImports.featureGateBindings.size === 0 &&
@@ -449,8 +479,7 @@ function collectViolations(filePath, scanRoot) {
449
479
  }
450
480
  async function main() {
451
481
  const scanRoot = resolveSaasRootFromCompanion();
452
- const files = [];
453
- walkSourceFiles(scanRoot, files);
482
+ const files = listSourceFiles(scanRoot);
454
483
  const violations = files.flatMap((filePath) => collectViolations(filePath, scanRoot));
455
484
  if (violations.length === 0) {
456
485
  console.log('No raw feature-id literal callsites detected.');
@@ -1 +1 @@
1
- {"version":3,"file":"check-raw-feature-id-literals.companion.js","sourceRoot":"","sources":["../../../src/code-compliance-check/check-raw-feature-id-literals.companion.ts"],"names":[],"mapp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,CAAC,CAAC;IAEjC,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IACtF,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;QAC7D,OAAO;IACT,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAC;IAC3E,OAAO,CAAC,KAAK,CAAC,gGAAgG,CAAC,CAAC;IAEhH,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,OAAO,CAAC,KAAK,CACX,KAAK,SAAS,CAAC,QAAQ,SAAS,SAAS,CAAC,OAAO,4BAA4B,SAAS,CAAC,gBAAgB,GAAG,CAC3G,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,0CAA0C,EAAE,KAAK,CAAC,CAAC;IACjE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC","sourcesContent":["import { existsSync, readdirSync, readFileSync } from 'node:fs';\nimport { dirname, extname, join, relative, resolve } from 'node:path';\nimport ts from 'typescript';\nimport { resolveHomes } from '@wildo-ai/platform-config-lib/resolve-homes';\n\nconst SOURCE_EXTENSIONS = new Set([\n '.ts',\n '.tsx',\n '.js',\n '.jsx',\n '.mts',\n '.cts',\n]);\n\nconst IGNORED_DIRS = new Set([\n '.cursor',\n '.git',\n '.next',\n '.turbo',\n 'coverage',\n 'dist',\n 'node_modules',\n '_code_archive',\n]);\n\nconst FEATURE_GATE_EXPORT = 'FeatureGate';\nconst HOOK_EXPORTS = new Set([\n 'useFeatureAvailability',\n 'useFeatureGate',\n]);\n\nconst FRAMEWORK_MODULE_PREFIXES = [\n '@wildo-ai/saas-frontend-lib',\n '~wildo-frontend-lib/core/features/',\n];\n\ninterface Violation {\n location: string;\n apiName: string;\n literalFeatureId: string;\n}\n\n/**\n * Provenance of an imported feature-gating binding, resolved from the import\n * specifier that brought it into the scanned file. Decides how the sweep\n * establishes that the binding ultimately comes from the framework.\n */\nenum ImportedBindingKind {\n /**\n * Imported directly from a framework module (one of\n * `FRAMEWORK_MODULE_PREFIXES`) — trusted as a framework export as-is.\n */\n FRAMEWORK = 'framework',\n /**\n * Imported from an app-local module; the export must be traced through that\n * module (`sourceFileExportsFrameworkBinding`) to a framework re-export\n * before the binding is trusted.\n */\n LOCAL = 'local',\n}\n\ninterface ImportedBinding {\n kind: ImportedBindingKind;\n exportName: string;\n filePath?: string;\n}\n\nconst parsedSourceFileCache = new Map<string, ts.SourceFile>();\nconst exportedFrameworkBindingCache = new Map<string, boolean>();\n\n/**\n * Resolve the SaaS app root for the compliance sweep from a single trusted\n * source: the `COMPANION_WORKSPACE_ROOT` environment variable.\n *\n * This script is a standalone companion command invoked by the package.json\n * `check:feature-id-literals` script, which sets `COMPANION_WORKSPACE_ROOT`\n * explicitly. It does not have access to the in-process `CompanionContext`,\n * so the env var is the bootstrap seed — but we deliberately refuse to fall\n * back to `INIT_CWD` or `process.cwd()` the way earlier revisions did:\n *\n * - Multiple candidate roots made it impossible to tell which one was actually\n * used if `resolveHomes()` happened to succeed for more than one.\n * - `INIT_CWD` and `process.cwd()` silently rediscover workspace state and\n * contradict the Phase 5 \"trust one root, resolve once\" contract.\n *\n * If the env var is missing or does not resolve to an app workspace, we fail\n * loudly rather than guessing.\n */\nfunction resolveSaasRootFromCompanion(): string {\n const companionRoot = process.env.COMPANION_WORKSPACE_ROOT;\n if (!companionRoot) {\n throw new Error(\n 'Companion compliance scripts must be invoked with COMPANION_WORKSPACE_ROOT set '\n + 'to the SaaS app root. The package.json \"check:feature-id-literals\" script is '\n + 'responsible for wiring this env var — fix the call site that spawned this '\n + 'process instead of re-introducing ad hoc cwd-based discovery here.',\n );\n }\n\n const declarationRoot = resolveHomes(companionRoot).app.declarationRoot;\n if (!declarationRoot) {\n throw new Error(\n `COMPANION_WORKSPACE_ROOT=\"${companionRoot}\" does not resolve to a SaaS app workspace. `\n + 'Ensure `wildo.saas.config.ts` exists at or above the provided directory.',\n );\n }\n\n return declarationRoot;\n}\n\nfunction shouldScanModule(moduleName: string): boolean {\n return FRAMEWORK_MODULE_PREFIXES.some((prefix) => (\n moduleName === prefix || moduleName.startsWith(prefix)\n ));\n}\n\nfunction isSourceFilePath(filePath: string): boolean {\n return SOURCE_EXTENSIONS.has(extname(filePath));\n}\n\nfunction getScriptKind(filePath: string): ts.ScriptKind {\n const extension = extname(filePath);\n\n if (extension === '.tsx') {\n return ts.ScriptKind.TSX;\n }\n\n if (extension === '.jsx') {\n return ts.ScriptKind.JSX;\n }\n\n return ts.ScriptKind.TS;\n}\n\nfunction walkSourceFiles(directoryPath: string, files: string[]): void {\n for (const entry of readdirSync(directoryPath, { withFileTypes: true })) {\n if (entry.isDirectory()) {\n if (!IGNORED_DIRS.has(entry.name)) {\n walkSourceFiles(join(directoryPath, entry.name), files);\n }\n\n continue;\n }\n\n const filePath = join(directoryPath, entry.name);\n if (isSourceFilePath(filePath)) {\n files.push(filePath);\n }\n }\n}\n\nfunction isImportedBinding(\n importClause: ts.ImportClause | undefined,\n exportedName: string,\n): string | null {\n if (!importClause?.namedBindings || !ts.isNamedImports(importClause.namedBindings)) {\n return null;\n }\n\n for (const element of importClause.namedBindings.elements) {\n const importedName = element.propertyName?.text ?? element.name.text;\n if (importedName === exportedName) {\n return element.name.text;\n }\n }\n\n return null;\n}\n\nfunction getParsedSourceFile(filePath: string): ts.SourceFile {\n const cached = parsedSourceFileCache.get(filePath);\n if (cached) {\n return cached;\n }\n\n const sourceText = readFileSync(filePath, 'utf8');\n const sourceFile = ts.createSourceFile(\n filePath,\n sourceText,\n ts.ScriptTarget.Latest,\n true,\n getScriptKind(filePath),\n );\n\n parsedSourceFileCache.set(filePath, sourceFile);\n return sourceFile;\n}\n\nfunction resolveLocalSourceModule(fromFilePath: string, moduleName: string): string | null {\n if (!moduleName.startsWith('.')) {\n return null;\n }\n\n const resolvedBasePath = resolve(dirname(fromFilePath), moduleName);\n const candidatePaths = [\n resolvedBasePath,\n ...Array.from(SOURCE_EXTENSIONS, (extension) => `${resolvedBasePath}${extension}`),\n ...Array.from(SOURCE_EXTENSIONS, (extension) => join(resolvedBasePath, `index${extension}`)),\n ];\n\n for (const candidatePath of candidatePaths) {\n if (existsSync(candidatePath)) {\n return candidatePath;\n }\n }\n\n return null;\n}\n\nfunction isTrackedFrameworkExport(exportName: string): boolean {\n return exportName === FEATURE_GATE_EXPORT || HOOK_EXPORTS.has(exportName);\n}\n\nfunction sourceFileExportsFrameworkBinding(\n filePath: string,\n exportName: string,\n visited = new Set<string>(),\n): boolean {\n if (!isTrackedFrameworkExport(exportName)) {\n return false;\n }\n\n const cacheKey = `${filePath}::${exportName}`;\n const cached = exportedFrameworkBindingCache.get(cacheKey);\n if (cached !== undefined) {\n return cached;\n }\n\n if (visited.has(cacheKey)) {\n return false;\n }\n\n visited.add(cacheKey);\n\n const sourceFile = getParsedSourceFile(filePath);\n const importedBindings = new Map<string, ImportedBinding>();\n\n for (const statement of sourceFile.statements) {\n if (!ts.isImportDeclaration(statement)) {\n continue;\n }\n\n const moduleName = ts.isStringLiteral(statement.moduleSpecifier)\n ? statement.moduleSpecifier.text\n : null;\n\n if (!moduleName) {\n continue;\n }\n\n const importClause = statement.importClause;\n if (!importClause?.namedBindings || !ts.isNamedImports(importClause.namedBindings)) {\n continue;\n }\n\n for (const element of importClause.namedBindings.elements) {\n const localName = element.name.text;\n const importedName = element.propertyName?.text ?? element.name.text;\n\n if (!isTrackedFrameworkExport(importedName)) {\n continue;\n }\n\n if (shouldScanModule(moduleName)) {\n importedBindings.set(localName, {\n kind: ImportedBindingKind.FRAMEWORK,\n exportName: importedName,\n });\n continue;\n }\n\n const resolvedModulePath = resolveLocalSourceModule(filePath, moduleName);\n if (resolvedModulePath) {\n importedBindings.set(localName, {\n kind: ImportedBindingKind.LOCAL,\n exportName: importedName,\n filePath: resolvedModulePath,\n });\n }\n }\n }\n\n let result = false;\n\n for (const statement of sourceFile.statements) {\n if (!ts.isExportDeclaration(statement)) {\n continue;\n }\n\n /*\n * An EXPORT declaration's `moduleSpecifier` is optional — `export { a, b };` with no `from`\n * clause has none — where an IMPORT declaration's is required, which is why the two sibling\n * loops in this file need no such guard. `ts.isStringLiteral` reads `.kind` off whatever it is\n * handed, so this would have thrown on the first re-export-less `export {}` in a scanned file.\n * It compiled because `strictNullChecks` was off (#352).\n */\n const moduleName = statement.moduleSpecifier !== undefined && ts.isStringLiteral(statement.moduleSpecifier)\n ? statement.moduleSpecifier.text\n : null;\n\n if (moduleName && shouldScanModule(moduleName)) {\n if (!statement.exportClause) {\n result = true;\n break;\n }\n\n if (!ts.isNamedExports(statement.exportClause)) {\n continue;\n }\n\n for (const element of statement.exportClause.elements) {\n const exportedName = element.name.text;\n const originalName = element.propertyName?.text ?? element.name.text;\n\n if (exportedName === exportName && isTrackedFrameworkExport(originalName)) {\n result = true;\n break;\n }\n }\n\n if (result) {\n break;\n }\n\n continue;\n }\n\n if (moduleName) {\n const resolvedModulePath = resolveLocalSourceModule(filePath, moduleName);\n if (!resolvedModulePath) {\n continue;\n }\n\n if (!statement.exportClause) {\n if (sourceFileExportsFrameworkBinding(resolvedModulePath, exportName, visited)) {\n result = true;\n break;\n }\n\n continue;\n }\n\n if (!ts.isNamedExports(statement.exportClause)) {\n continue;\n }\n\n for (const element of statement.exportClause.elements) {\n const exportedName = element.name.text;\n const originalName = element.propertyName?.text ?? element.name.text;\n\n if (\n exportedName === exportName &&\n sourceFileExportsFrameworkBinding(resolvedModulePath, originalName, visited)\n ) {\n result = true;\n break;\n }\n }\n\n if (result) {\n break;\n }\n\n continue;\n }\n\n if (!statement.exportClause || !ts.isNamedExports(statement.exportClause)) {\n continue;\n }\n\n for (const element of statement.exportClause.elements) {\n const exportedName = element.name.text;\n const localName = element.propertyName?.text ?? element.name.text;\n\n if (exportedName !== exportName) {\n continue;\n }\n\n const importedBinding = importedBindings.get(localName);\n if (!importedBinding) {\n continue;\n }\n\n if (importedBinding.kind === ImportedBindingKind.FRAMEWORK) {\n result = true;\n break;\n }\n\n if (\n importedBinding.kind === ImportedBindingKind.LOCAL &&\n sourceFileExportsFrameworkBinding(importedBinding.filePath!, importedBinding.exportName, visited)\n ) {\n result = true;\n break;\n }\n }\n\n if (result) {\n break;\n }\n }\n\n exportedFrameworkBindingCache.set(cacheKey, result);\n return result;\n}\n\nfunction collectTrackedImports(sourceFile: ts.SourceFile) {\n const featureGateBindings = new Set<string>();\n const hookBindings = new Set<string>();\n const namespaceBindings = new Set<string>();\n\n for (const statement of sourceFile.statements) {\n if (!ts.isImportDeclaration(statement)) {\n continue;\n }\n\n const moduleName = ts.isStringLiteral(statement.moduleSpecifier)\n ? statement.moduleSpecifier.text\n : null;\n\n if (!moduleName) {\n continue;\n }\n\n const importClause = statement.importClause;\n const isDirectFrameworkModule = shouldScanModule(moduleName);\n const resolvedLocalModulePath = isDirectFrameworkModule\n ? null\n : resolveLocalSourceModule(sourceFile.fileName, moduleName);\n\n const featureGateBinding = isImportedBinding(importClause, FEATURE_GATE_EXPORT);\n if (\n featureGateBinding &&\n (\n isDirectFrameworkModule ||\n (\n resolvedLocalModulePath &&\n sourceFileExportsFrameworkBinding(resolvedLocalModulePath, FEATURE_GATE_EXPORT)\n )\n )\n ) {\n featureGateBindings.add(featureGateBinding);\n }\n\n for (const hookExport of HOOK_EXPORTS) {\n const hookBinding = isImportedBinding(importClause, hookExport);\n if (\n hookBinding &&\n (\n isDirectFrameworkModule ||\n (\n resolvedLocalModulePath &&\n sourceFileExportsFrameworkBinding(resolvedLocalModulePath, hookExport)\n )\n )\n ) {\n hookBindings.add(hookBinding);\n }\n }\n\n if (\n importClause?.namedBindings &&\n ts.isNamespaceImport(importClause.namedBindings) &&\n (\n isDirectFrameworkModule ||\n (\n resolvedLocalModulePath &&\n (\n sourceFileExportsFrameworkBinding(resolvedLocalModulePath, FEATURE_GATE_EXPORT) ||\n Array.from(HOOK_EXPORTS).some((hookExport) => (\n sourceFileExportsFrameworkBinding(resolvedLocalModulePath, hookExport)\n ))\n )\n )\n )\n ) {\n namespaceBindings.add(importClause.namedBindings.name.text);\n }\n }\n\n return {\n featureGateBindings,\n hookBindings,\n namespaceBindings,\n };\n}\n\nfunction getLiteralStringFromExpression(expression: ts.Expression): string | null {\n if (\n ts.isStringLiteral(expression) ||\n ts.isNoSubstitutionTemplateLiteral(expression)\n ) {\n return expression.text;\n }\n\n return null;\n}\n\nfunction getLiteralStringFromJsxAttribute(initializer: ts.JsxAttributeValue | undefined): string | null {\n if (!initializer) {\n return null;\n }\n\n if (ts.isStringLiteral(initializer)) {\n return initializer.text;\n }\n\n if (ts.isJsxExpression(initializer) && initializer.expression) {\n return getLiteralStringFromExpression(initializer.expression);\n }\n\n return null;\n}\n\nfunction matchesTrackedHook(\n expression: ts.LeftHandSideExpression,\n trackedImports: ReturnType<typeof collectTrackedImports>,\n): string | null {\n if (ts.isIdentifier(expression)) {\n return trackedImports.hookBindings.has(expression.text) ? expression.text : null;\n }\n\n if (\n ts.isPropertyAccessExpression(expression) &&\n ts.isIdentifier(expression.expression) &&\n trackedImports.namespaceBindings.has(expression.expression.text) &&\n HOOK_EXPORTS.has(expression.name.text)\n ) {\n return `${expression.expression.text}.${expression.name.text}`;\n }\n\n return null;\n}\n\nfunction matchesTrackedFeatureGate(\n tagName: ts.JsxTagNameExpression,\n trackedImports: ReturnType<typeof collectTrackedImports>,\n): string | null {\n if (ts.isIdentifier(tagName)) {\n return trackedImports.featureGateBindings.has(tagName.text) ? tagName.text : null;\n }\n\n if (\n ts.isPropertyAccessExpression(tagName) &&\n ts.isIdentifier(tagName.expression) &&\n trackedImports.namespaceBindings.has(tagName.expression.text) &&\n tagName.name.text === FEATURE_GATE_EXPORT\n ) {\n return `${tagName.expression.text}.${tagName.name.text}`;\n }\n\n return null;\n}\n\nfunction formatLocation(scanRoot: string, sourceFile: ts.SourceFile, node: ts.Node): string {\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n return `${relative(scanRoot, sourceFile.fileName)}:${line + 1}:${character + 1}`;\n}\n\nfunction collectViolations(filePath: string, scanRoot: string): Violation[] {\n const sourceFile = getParsedSourceFile(filePath);\n const trackedImports = collectTrackedImports(sourceFile);\n\n if (\n trackedImports.featureGateBindings.size === 0 &&\n trackedImports.hookBindings.size === 0 &&\n trackedImports.namespaceBindings.size === 0\n ) {\n return [];\n }\n\n const violations: Violation[] = [];\n\n function visit(node: ts.Node): void {\n if (ts.isCallExpression(node)) {\n const matchedHook = matchesTrackedHook(node.expression, trackedImports);\n if (matchedHook && node.arguments.length > 0) {\n const literalFeatureId = getLiteralStringFromExpression(node.arguments[0]);\n if (literalFeatureId !== null) {\n violations.push({\n location: formatLocation(scanRoot, sourceFile, node.arguments[0]),\n apiName: matchedHook,\n literalFeatureId,\n });\n }\n }\n }\n\n if (ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node)) {\n const matchedFeatureGate = matchesTrackedFeatureGate(node.tagName, trackedImports);\n if (matchedFeatureGate) {\n for (const attribute of node.attributes.properties) {\n if (\n !ts.isJsxAttribute(attribute) ||\n !ts.isIdentifier(attribute.name) ||\n attribute.name.text !== 'featureId'\n ) {\n continue;\n }\n\n const literalFeatureId = getLiteralStringFromJsxAttribute(attribute.initializer);\n if (literalFeatureId !== null) {\n violations.push({\n location: formatLocation(scanRoot, sourceFile, attribute),\n apiName: matchedFeatureGate,\n literalFeatureId,\n });\n }\n }\n }\n }\n\n ts.forEachChild(node, visit);\n }\n\n visit(sourceFile);\n return violations;\n}\n\nasync function main(): Promise<void> {\n const scanRoot = resolveSaasRootFromCompanion();\n const files: string[] = [];\n\n walkSourceFiles(scanRoot, files);\n\n const violations = files.flatMap((filePath) => collectViolations(filePath, scanRoot));\n if (violations.length === 0) {\n console.log('No raw feature-id literal callsites detected.');\n return;\n }\n\n console.error('Raw feature-id literals are not allowed in app callsites.');\n console.error('Use companion-visible constants, exported app helpers, or registry-backed utilities instead.\\n');\n\n for (const violation of violations) {\n console.error(\n `- ${violation.location} uses ${violation.apiName} with inline feature id \"${violation.literalFeatureId}\"`,\n );\n }\n\n process.exitCode = 1;\n}\n\nmain().catch((error) => {\n console.error('Failed to check raw feature-id literals:', error);\n process.exit(1);\n});\n"]}
1
+ {"version":3,"file":"check-raw-feature-id-literals.companion.js","sourceRoot":"","sources":["../../../src/code-compliance-check/check-raw-feature-id-literals.companion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAE3E,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,SAAS;IACT,MAAM;IACN,OAAO;IACP,QAAQ;IACR,UAAU;IACV,MAAM;IACN,cAAc;IACd,eAAe;IACf,mHAAmH;IACnH,qHAAqH;IACrH,4CAA4C;IAC5C,wBAAwB;CACzB,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAC1C,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,wBAAwB;IACxB,gBAAgB;CACjB,CAAC,CAAC;AAE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dirname, extname, join, relative, resolve } from 'node:path';\nimport ts from 'typescript';\nimport { resolveHomes } from '@wildo-ai/platform-config-lib/resolve-homes';\n\nconst SOURCE_EXTENSIONS = new Set([\n '.ts',\n '.tsx',\n '.js',\n '.jsx',\n '.mts',\n '.cts',\n]);\n\nconst IGNORED_DIRS = new Set([\n '.cursor',\n '.git',\n '.next',\n '.turbo',\n 'coverage',\n 'dist',\n 'node_modules',\n '_code_archive',\n // Compile staging and runtime state a running dev watcher writes and swaps under the application's packages: never\n // authored source, and a file can vanish between the walk and the read, which failed a local `pnpm build` (ENOENT on\n // a staged `.d.ts`) while the stack was up.\n '.wildo-runtime-signals',\n]);\n\nconst FEATURE_GATE_EXPORT = 'FeatureGate';\nconst HOOK_EXPORTS = new Set([\n 'useFeatureAvailability',\n 'useFeatureGate',\n]);\n\nconst FRAMEWORK_MODULE_PREFIXES = [\n '@wildo-ai/saas-frontend-lib',\n '~wildo-frontend-lib/core/features/',\n];\n\ninterface Violation {\n location: string;\n apiName: string;\n literalFeatureId: string;\n}\n\n/**\n * Provenance of an imported feature-gating binding, resolved from the import\n * specifier that brought it into the scanned file. Decides how the sweep\n * establishes that the binding ultimately comes from the framework.\n */\nenum ImportedBindingKind {\n /**\n * Imported directly from a framework module (one of\n * `FRAMEWORK_MODULE_PREFIXES`) — trusted as a framework export as-is.\n */\n FRAMEWORK = 'framework',\n /**\n * Imported from an app-local module; the export must be traced through that\n * module (`sourceFileExportsFrameworkBinding`) to a framework re-export\n * before the binding is trusted.\n */\n LOCAL = 'local',\n}\n\ninterface ImportedBinding {\n kind: ImportedBindingKind;\n exportName: string;\n filePath?: string;\n}\n\nconst parsedSourceFileCache = new Map<string, ts.SourceFile>();\nconst exportedFrameworkBindingCache = new Map<string, boolean>();\n\n/**\n * Resolve the SaaS app root for the compliance sweep from a single trusted\n * source: the `COMPANION_WORKSPACE_ROOT` environment variable.\n *\n * This script is a standalone companion command invoked by the package.json\n * `check:feature-id-literals` script, which sets `COMPANION_WORKSPACE_ROOT`\n * explicitly. It does not have access to the in-process `CompanionContext`,\n * so the env var is the bootstrap seed — but we deliberately refuse to fall\n * back to `INIT_CWD` or `process.cwd()` the way earlier revisions did:\n *\n * - Multiple candidate roots made it impossible to tell which one was actually\n * used if `resolveHomes()` happened to succeed for more than one.\n * - `INIT_CWD` and `process.cwd()` silently rediscover workspace state and\n * contradict the Phase 5 \"trust one root, resolve once\" contract.\n *\n * If the env var is missing or does not resolve to an app workspace, we fail\n * loudly rather than guessing.\n */\nfunction resolveSaasRootFromCompanion(): string {\n const companionRoot = process.env.COMPANION_WORKSPACE_ROOT;\n if (!companionRoot) {\n throw new Error(\n 'Companion compliance scripts must be invoked with COMPANION_WORKSPACE_ROOT set '\n + 'to the SaaS app root. The package.json \"check:feature-id-literals\" script is '\n + 'responsible for wiring this env var — fix the call site that spawned this '\n + 'process instead of re-introducing ad hoc cwd-based discovery here.',\n );\n }\n\n const declarationRoot = resolveHomes(companionRoot).app.declarationRoot;\n if (!declarationRoot) {\n throw new Error(\n `COMPANION_WORKSPACE_ROOT=\"${companionRoot}\" does not resolve to a SaaS app workspace. `\n + 'Ensure `wildo.saas.config.ts` exists at or above the provided directory.',\n );\n }\n\n return declarationRoot;\n}\n\nfunction shouldScanModule(moduleName: string): boolean {\n return FRAMEWORK_MODULE_PREFIXES.some((prefix) => (\n moduleName === prefix || moduleName.startsWith(prefix)\n ));\n}\n\nfunction isSourceFilePath(filePath: string): boolean {\n return SOURCE_EXTENSIONS.has(extname(filePath));\n}\n\nfunction getScriptKind(filePath: string): ts.ScriptKind {\n const extension = extname(filePath);\n\n if (extension === '.tsx') {\n return ts.ScriptKind.TSX;\n }\n\n if (extension === '.jsx') {\n return ts.ScriptKind.JSX;\n }\n\n return ts.ScriptKind.TS;\n}\n\n/**\n * The application's source files: what git does not ignore under the root, tracked or not yet added.\n *\n * Build outputs and runtime state (`dist`, the docs site's `build` and `.docusaurus`, `.astro`, a watcher's\n * `.wildo-runtime-signals` staging) are all gitignored, and the check must never read them: a sibling package's build\n * rewrites them while turbo runs this check beside it, and the finalization verifier's build failed on a docs-site asset\n * deleted between the walk and the read (run 43808255505). A hand-kept list of output directories had already missed\n * `build`, so the ignore rules the application keeps are the boundary. Outside a git checkout the directory walk stands in.\n */\nfunction listSourceFiles(scanRoot: string): string[] {\n const listed = spawnSync('git', ['ls-files', '--cached', '--others', '--exclude-standard', '-z'], { cwd: scanRoot, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });\n if (listed.status !== 0) {\n const files: string[] = [];\n walkSourceFiles(scanRoot, files);\n return files;\n }\n return listed.stdout\n .split('\\0')\n .filter((relativePath) => relativePath.length > 0 && !relativePath.split('/').some((segment) => IGNORED_DIRS.has(segment)))\n .map((relativePath) => join(scanRoot, relativePath))\n .filter((filePath) => isSourceFilePath(filePath) && existsSync(filePath));\n}\n\nfunction walkSourceFiles(directoryPath: string, files: string[]): void {\n for (const entry of readdirSync(directoryPath, { withFileTypes: true })) {\n if (entry.isDirectory()) {\n if (!IGNORED_DIRS.has(entry.name)) {\n walkSourceFiles(join(directoryPath, entry.name), files);\n }\n\n continue;\n }\n\n const filePath = join(directoryPath, entry.name);\n if (isSourceFilePath(filePath)) {\n files.push(filePath);\n }\n }\n}\n\nfunction isImportedBinding(\n importClause: ts.ImportClause | undefined,\n exportedName: string,\n): string | null {\n if (!importClause?.namedBindings || !ts.isNamedImports(importClause.namedBindings)) {\n return null;\n }\n\n for (const element of importClause.namedBindings.elements) {\n const importedName = element.propertyName?.text ?? element.name.text;\n if (importedName === exportedName) {\n return element.name.text;\n }\n }\n\n return null;\n}\n\nfunction getParsedSourceFile(filePath: string): ts.SourceFile {\n const cached = parsedSourceFileCache.get(filePath);\n if (cached) {\n return cached;\n }\n\n const sourceText = readFileSync(filePath, 'utf8');\n const sourceFile = ts.createSourceFile(\n filePath,\n sourceText,\n ts.ScriptTarget.Latest,\n true,\n getScriptKind(filePath),\n );\n\n parsedSourceFileCache.set(filePath, sourceFile);\n return sourceFile;\n}\n\nfunction resolveLocalSourceModule(fromFilePath: string, moduleName: string): string | null {\n if (!moduleName.startsWith('.')) {\n return null;\n }\n\n const resolvedBasePath = resolve(dirname(fromFilePath), moduleName);\n const candidatePaths = [\n resolvedBasePath,\n ...Array.from(SOURCE_EXTENSIONS, (extension) => `${resolvedBasePath}${extension}`),\n ...Array.from(SOURCE_EXTENSIONS, (extension) => join(resolvedBasePath, `index${extension}`)),\n ];\n\n for (const candidatePath of candidatePaths) {\n if (existsSync(candidatePath)) {\n return candidatePath;\n }\n }\n\n return null;\n}\n\nfunction isTrackedFrameworkExport(exportName: string): boolean {\n return exportName === FEATURE_GATE_EXPORT || HOOK_EXPORTS.has(exportName);\n}\n\nfunction sourceFileExportsFrameworkBinding(\n filePath: string,\n exportName: string,\n visited = new Set<string>(),\n): boolean {\n if (!isTrackedFrameworkExport(exportName)) {\n return false;\n }\n\n const cacheKey = `${filePath}::${exportName}`;\n const cached = exportedFrameworkBindingCache.get(cacheKey);\n if (cached !== undefined) {\n return cached;\n }\n\n if (visited.has(cacheKey)) {\n return false;\n }\n\n visited.add(cacheKey);\n\n const sourceFile = getParsedSourceFile(filePath);\n const importedBindings = new Map<string, ImportedBinding>();\n\n for (const statement of sourceFile.statements) {\n if (!ts.isImportDeclaration(statement)) {\n continue;\n }\n\n const moduleName = ts.isStringLiteral(statement.moduleSpecifier)\n ? statement.moduleSpecifier.text\n : null;\n\n if (!moduleName) {\n continue;\n }\n\n const importClause = statement.importClause;\n if (!importClause?.namedBindings || !ts.isNamedImports(importClause.namedBindings)) {\n continue;\n }\n\n for (const element of importClause.namedBindings.elements) {\n const localName = element.name.text;\n const importedName = element.propertyName?.text ?? element.name.text;\n\n if (!isTrackedFrameworkExport(importedName)) {\n continue;\n }\n\n if (shouldScanModule(moduleName)) {\n importedBindings.set(localName, {\n kind: ImportedBindingKind.FRAMEWORK,\n exportName: importedName,\n });\n continue;\n }\n\n const resolvedModulePath = resolveLocalSourceModule(filePath, moduleName);\n if (resolvedModulePath) {\n importedBindings.set(localName, {\n kind: ImportedBindingKind.LOCAL,\n exportName: importedName,\n filePath: resolvedModulePath,\n });\n }\n }\n }\n\n let result = false;\n\n for (const statement of sourceFile.statements) {\n if (!ts.isExportDeclaration(statement)) {\n continue;\n }\n\n /*\n * An EXPORT declaration's `moduleSpecifier` is optional — `export { a, b };` with no `from`\n * clause has none — where an IMPORT declaration's is required, which is why the two sibling\n * loops in this file need no such guard. `ts.isStringLiteral` reads `.kind` off whatever it is\n * handed, so this would have thrown on the first re-export-less `export {}` in a scanned file.\n * It compiled because `strictNullChecks` was off (#352).\n */\n const moduleName = statement.moduleSpecifier !== undefined && ts.isStringLiteral(statement.moduleSpecifier)\n ? statement.moduleSpecifier.text\n : null;\n\n if (moduleName && shouldScanModule(moduleName)) {\n if (!statement.exportClause) {\n result = true;\n break;\n }\n\n if (!ts.isNamedExports(statement.exportClause)) {\n continue;\n }\n\n for (const element of statement.exportClause.elements) {\n const exportedName = element.name.text;\n const originalName = element.propertyName?.text ?? element.name.text;\n\n if (exportedName === exportName && isTrackedFrameworkExport(originalName)) {\n result = true;\n break;\n }\n }\n\n if (result) {\n break;\n }\n\n continue;\n }\n\n if (moduleName) {\n const resolvedModulePath = resolveLocalSourceModule(filePath, moduleName);\n if (!resolvedModulePath) {\n continue;\n }\n\n if (!statement.exportClause) {\n if (sourceFileExportsFrameworkBinding(resolvedModulePath, exportName, visited)) {\n result = true;\n break;\n }\n\n continue;\n }\n\n if (!ts.isNamedExports(statement.exportClause)) {\n continue;\n }\n\n for (const element of statement.exportClause.elements) {\n const exportedName = element.name.text;\n const originalName = element.propertyName?.text ?? element.name.text;\n\n if (\n exportedName === exportName &&\n sourceFileExportsFrameworkBinding(resolvedModulePath, originalName, visited)\n ) {\n result = true;\n break;\n }\n }\n\n if (result) {\n break;\n }\n\n continue;\n }\n\n if (!statement.exportClause || !ts.isNamedExports(statement.exportClause)) {\n continue;\n }\n\n for (const element of statement.exportClause.elements) {\n const exportedName = element.name.text;\n const localName = element.propertyName?.text ?? element.name.text;\n\n if (exportedName !== exportName) {\n continue;\n }\n\n const importedBinding = importedBindings.get(localName);\n if (!importedBinding) {\n continue;\n }\n\n if (importedBinding.kind === ImportedBindingKind.FRAMEWORK) {\n result = true;\n break;\n }\n\n if (\n importedBinding.kind === ImportedBindingKind.LOCAL &&\n sourceFileExportsFrameworkBinding(importedBinding.filePath!, importedBinding.exportName, visited)\n ) {\n result = true;\n break;\n }\n }\n\n if (result) {\n break;\n }\n }\n\n exportedFrameworkBindingCache.set(cacheKey, result);\n return result;\n}\n\nfunction collectTrackedImports(sourceFile: ts.SourceFile) {\n const featureGateBindings = new Set<string>();\n const hookBindings = new Set<string>();\n const namespaceBindings = new Set<string>();\n\n for (const statement of sourceFile.statements) {\n if (!ts.isImportDeclaration(statement)) {\n continue;\n }\n\n const moduleName = ts.isStringLiteral(statement.moduleSpecifier)\n ? statement.moduleSpecifier.text\n : null;\n\n if (!moduleName) {\n continue;\n }\n\n const importClause = statement.importClause;\n const isDirectFrameworkModule = shouldScanModule(moduleName);\n const resolvedLocalModulePath = isDirectFrameworkModule\n ? null\n : resolveLocalSourceModule(sourceFile.fileName, moduleName);\n\n const featureGateBinding = isImportedBinding(importClause, FEATURE_GATE_EXPORT);\n if (\n featureGateBinding &&\n (\n isDirectFrameworkModule ||\n (\n resolvedLocalModulePath &&\n sourceFileExportsFrameworkBinding(resolvedLocalModulePath, FEATURE_GATE_EXPORT)\n )\n )\n ) {\n featureGateBindings.add(featureGateBinding);\n }\n\n for (const hookExport of HOOK_EXPORTS) {\n const hookBinding = isImportedBinding(importClause, hookExport);\n if (\n hookBinding &&\n (\n isDirectFrameworkModule ||\n (\n resolvedLocalModulePath &&\n sourceFileExportsFrameworkBinding(resolvedLocalModulePath, hookExport)\n )\n )\n ) {\n hookBindings.add(hookBinding);\n }\n }\n\n if (\n importClause?.namedBindings &&\n ts.isNamespaceImport(importClause.namedBindings) &&\n (\n isDirectFrameworkModule ||\n (\n resolvedLocalModulePath &&\n (\n sourceFileExportsFrameworkBinding(resolvedLocalModulePath, FEATURE_GATE_EXPORT) ||\n Array.from(HOOK_EXPORTS).some((hookExport) => (\n sourceFileExportsFrameworkBinding(resolvedLocalModulePath, hookExport)\n ))\n )\n )\n )\n ) {\n namespaceBindings.add(importClause.namedBindings.name.text);\n }\n }\n\n return {\n featureGateBindings,\n hookBindings,\n namespaceBindings,\n };\n}\n\nfunction getLiteralStringFromExpression(expression: ts.Expression): string | null {\n if (\n ts.isStringLiteral(expression) ||\n ts.isNoSubstitutionTemplateLiteral(expression)\n ) {\n return expression.text;\n }\n\n return null;\n}\n\nfunction getLiteralStringFromJsxAttribute(initializer: ts.JsxAttributeValue | undefined): string | null {\n if (!initializer) {\n return null;\n }\n\n if (ts.isStringLiteral(initializer)) {\n return initializer.text;\n }\n\n if (ts.isJsxExpression(initializer) && initializer.expression) {\n return getLiteralStringFromExpression(initializer.expression);\n }\n\n return null;\n}\n\nfunction matchesTrackedHook(\n expression: ts.LeftHandSideExpression,\n trackedImports: ReturnType<typeof collectTrackedImports>,\n): string | null {\n if (ts.isIdentifier(expression)) {\n return trackedImports.hookBindings.has(expression.text) ? expression.text : null;\n }\n\n if (\n ts.isPropertyAccessExpression(expression) &&\n ts.isIdentifier(expression.expression) &&\n trackedImports.namespaceBindings.has(expression.expression.text) &&\n HOOK_EXPORTS.has(expression.name.text)\n ) {\n return `${expression.expression.text}.${expression.name.text}`;\n }\n\n return null;\n}\n\nfunction matchesTrackedFeatureGate(\n tagName: ts.JsxTagNameExpression,\n trackedImports: ReturnType<typeof collectTrackedImports>,\n): string | null {\n if (ts.isIdentifier(tagName)) {\n return trackedImports.featureGateBindings.has(tagName.text) ? tagName.text : null;\n }\n\n if (\n ts.isPropertyAccessExpression(tagName) &&\n ts.isIdentifier(tagName.expression) &&\n trackedImports.namespaceBindings.has(tagName.expression.text) &&\n tagName.name.text === FEATURE_GATE_EXPORT\n ) {\n return `${tagName.expression.text}.${tagName.name.text}`;\n }\n\n return null;\n}\n\nfunction formatLocation(scanRoot: string, sourceFile: ts.SourceFile, node: ts.Node): string {\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n return `${relative(scanRoot, sourceFile.fileName)}:${line + 1}:${character + 1}`;\n}\n\nfunction collectViolations(filePath: string, scanRoot: string): Violation[] {\n // A file listed a moment ago may be gone by now (an editor's swap, a generator rewriting it): it holds no call site.\n if (!existsSync(filePath)) return [];\n const sourceFile = getParsedSourceFile(filePath);\n const trackedImports = collectTrackedImports(sourceFile);\n\n if (\n trackedImports.featureGateBindings.size === 0 &&\n trackedImports.hookBindings.size === 0 &&\n trackedImports.namespaceBindings.size === 0\n ) {\n return [];\n }\n\n const violations: Violation[] = [];\n\n function visit(node: ts.Node): void {\n if (ts.isCallExpression(node)) {\n const matchedHook = matchesTrackedHook(node.expression, trackedImports);\n if (matchedHook && node.arguments.length > 0) {\n const literalFeatureId = getLiteralStringFromExpression(node.arguments[0]);\n if (literalFeatureId !== null) {\n violations.push({\n location: formatLocation(scanRoot, sourceFile, node.arguments[0]),\n apiName: matchedHook,\n literalFeatureId,\n });\n }\n }\n }\n\n if (ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node)) {\n const matchedFeatureGate = matchesTrackedFeatureGate(node.tagName, trackedImports);\n if (matchedFeatureGate) {\n for (const attribute of node.attributes.properties) {\n if (\n !ts.isJsxAttribute(attribute) ||\n !ts.isIdentifier(attribute.name) ||\n attribute.name.text !== 'featureId'\n ) {\n continue;\n }\n\n const literalFeatureId = getLiteralStringFromJsxAttribute(attribute.initializer);\n if (literalFeatureId !== null) {\n violations.push({\n location: formatLocation(scanRoot, sourceFile, attribute),\n apiName: matchedFeatureGate,\n literalFeatureId,\n });\n }\n }\n }\n }\n\n ts.forEachChild(node, visit);\n }\n\n visit(sourceFile);\n return violations;\n}\n\nasync function main(): Promise<void> {\n const scanRoot = resolveSaasRootFromCompanion();\n const files = listSourceFiles(scanRoot);\n\n const violations = files.flatMap((filePath) => collectViolations(filePath, scanRoot));\n if (violations.length === 0) {\n console.log('No raw feature-id literal callsites detected.');\n return;\n }\n\n console.error('Raw feature-id literals are not allowed in app callsites.');\n console.error('Use companion-visible constants, exported app helpers, or registry-backed utilities instead.\\n');\n\n for (const violation of violations) {\n console.error(\n `- ${violation.location} uses ${violation.apiName} with inline feature id \"${violation.literalFeatureId}\"`,\n );\n }\n\n process.exitCode = 1;\n}\n\nmain().catch((error) => {\n console.error('Failed to check raw feature-id literals:', error);\n process.exit(1);\n});\n"]}
@@ -2343,11 +2343,13 @@ export declare const CompanionCloseBuildTaskRequestSchema: z.ZodObject<{
2343
2343
  satisfiedBy: z.ZodOptional<z.ZodString>;
2344
2344
  declined: z.ZodOptional<z.ZodBoolean>;
2345
2345
  reason: z.ZodString;
2346
+ coveredReportRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
2346
2347
  }, z.core.$strict>;
2347
2348
  export type CompanionCloseBuildTaskRequest = z.infer<typeof CompanionCloseBuildTaskRequestSchema>;
2348
2349
  /** `POST /build/tasks/:taskRef/approve` (#3227): let a derived follow-up run, with what the person said, if anything. */
2349
2350
  export declare const CompanionApproveFollowUpTaskRequestSchema: z.ZodObject<{
2350
2351
  note: z.ZodOptional<z.ZodString>;
2352
+ coveredReportRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
2351
2353
  }, z.core.$strict>;
2352
2354
  export type CompanionApproveFollowUpTaskRequest = z.infer<typeof CompanionApproveFollowUpTaskRequestSchema>;
2353
2355
  /**