@wildo-ai/dev-companion 1.1.5 → 1.1.6

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 (596) hide show
  1. package/dist/esm/.tsbuildinfo +1 -1
  2. package/dist/esm/brand/models/logo-generation.actors-system.definitions.d.ts.map +1 -1
  3. package/dist/esm/brand/models/logo-generation.actors-system.definitions.js +0 -1
  4. package/dist/esm/brand/models/logo-generation.actors-system.definitions.js.map +1 -1
  5. package/dist/esm/brand/models/logo-judge.actors-system.definitions.d.ts.map +1 -1
  6. package/dist/esm/brand/models/logo-judge.actors-system.definitions.js +0 -1
  7. package/dist/esm/brand/models/logo-judge.actors-system.definitions.js.map +1 -1
  8. package/dist/esm/brand/services/brand-accept.companion.service.d.ts +8 -0
  9. package/dist/esm/brand/services/brand-accept.companion.service.d.ts.map +1 -1
  10. package/dist/esm/brand/services/brand-accept.companion.service.js +6 -0
  11. package/dist/esm/brand/services/brand-accept.companion.service.js.map +1 -1
  12. package/dist/esm/brand/services/brand-propagation.companion.utils.d.ts +21 -0
  13. package/dist/esm/brand/services/brand-propagation.companion.utils.d.ts.map +1 -0
  14. package/dist/esm/brand/services/brand-propagation.companion.utils.js +33 -0
  15. package/dist/esm/brand/services/brand-propagation.companion.utils.js.map +1 -0
  16. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +69 -1
  17. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts.map +1 -1
  18. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js +84 -3
  19. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
  20. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts +8 -4
  21. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts.map +1 -1
  22. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js +9 -5
  23. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js.map +1 -1
  24. package/dist/esm/claude-cli/models/parked-question-answerer.actors-system.definitions.js +1 -1
  25. package/dist/esm/claude-cli/models/parked-question-answerer.actors-system.definitions.js.map +1 -1
  26. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.d.ts +4 -0
  27. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.d.ts.map +1 -1
  28. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.js +25 -3
  29. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.js.map +1 -1
  30. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts +159 -11
  31. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts.map +1 -1
  32. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +424 -41
  33. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js.map +1 -1
  34. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +333 -60
  35. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
  36. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +1029 -185
  37. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
  38. package/dist/esm/claude-cli/services/coding-run-write-register.companion.service.d.ts +8 -2
  39. package/dist/esm/claude-cli/services/coding-run-write-register.companion.service.d.ts.map +1 -1
  40. package/dist/esm/claude-cli/services/coding-run-write-register.companion.service.js +8 -2
  41. package/dist/esm/claude-cli/services/coding-run-write-register.companion.service.js.map +1 -1
  42. package/dist/esm/claude-cli/services/in-flight-coding-runs.companion.d.ts +20 -0
  43. package/dist/esm/claude-cli/services/in-flight-coding-runs.companion.d.ts.map +1 -0
  44. package/dist/esm/claude-cli/services/in-flight-coding-runs.companion.js +29 -0
  45. package/dist/esm/claude-cli/services/in-flight-coding-runs.companion.js.map +1 -0
  46. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.d.ts +11 -0
  47. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.d.ts.map +1 -1
  48. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.js +60 -7
  49. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.js.map +1 -1
  50. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts +5 -4
  51. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts.map +1 -1
  52. package/dist/esm/claude-cli/services/research-evidence-store.companion.js +13 -4
  53. package/dist/esm/claude-cli/services/research-evidence-store.companion.js.map +1 -1
  54. package/dist/esm/companion-api/companion-api.schemas.d.ts +193 -2
  55. package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
  56. package/dist/esm/companion-api/companion-api.schemas.js +20 -1
  57. package/dist/esm/companion-api/companion-api.schemas.js.map +1 -1
  58. package/dist/esm/companion-api/companion-error-guidance.models.d.ts +25 -0
  59. package/dist/esm/companion-api/companion-error-guidance.models.d.ts.map +1 -0
  60. package/dist/esm/companion-api/companion-error-guidance.models.js +26 -0
  61. package/dist/esm/companion-api/companion-error-guidance.models.js.map +1 -0
  62. package/dist/esm/companion-api/controllers/companion-file-route-confinement.d.ts +44 -0
  63. package/dist/esm/companion-api/controllers/companion-file-route-confinement.d.ts.map +1 -0
  64. package/dist/esm/companion-api/controllers/companion-file-route-confinement.js +111 -0
  65. package/dist/esm/companion-api/controllers/companion-file-route-confinement.js.map +1 -0
  66. package/dist/esm/companion-api/controllers/companion-token-floor.policy.d.ts +6 -14
  67. package/dist/esm/companion-api/controllers/companion-token-floor.policy.d.ts.map +1 -1
  68. package/dist/esm/companion-api/controllers/companion-token-floor.policy.js +6 -14
  69. package/dist/esm/companion-api/controllers/companion-token-floor.policy.js.map +1 -1
  70. package/dist/esm/companion-api/controllers/companion-trace-exemptions.d.ts +12 -0
  71. package/dist/esm/companion-api/controllers/companion-trace-exemptions.d.ts.map +1 -0
  72. package/dist/esm/companion-api/controllers/companion-trace-exemptions.js +20 -0
  73. package/dist/esm/companion-api/controllers/companion-trace-exemptions.js.map +1 -0
  74. package/dist/esm/companion-api/controllers/companion.controller.d.ts +104 -14
  75. package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
  76. package/dist/esm/companion-api/controllers/companion.controller.js +516 -122
  77. package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
  78. package/dist/esm/core/catalogs/structured-data-catalog-audit.service.d.ts.map +1 -1
  79. package/dist/esm/core/catalogs/structured-data-catalog-audit.service.js +6 -38
  80. package/dist/esm/core/catalogs/structured-data-catalog-audit.service.js.map +1 -1
  81. package/dist/esm/core/config/primary-language.companion.utils.d.ts +13 -0
  82. package/dist/esm/core/config/primary-language.companion.utils.d.ts.map +1 -1
  83. package/dist/esm/core/config/primary-language.companion.utils.js +19 -0
  84. package/dist/esm/core/config/primary-language.companion.utils.js.map +1 -1
  85. package/dist/esm/core/context/companion-package-loaders.companion.js +1 -39
  86. package/dist/esm/core/context/companion-package-loaders.companion.js.map +1 -1
  87. package/dist/esm/core/inject/models/container.d.ts.map +1 -1
  88. package/dist/esm/core/inject/models/container.js +4 -0
  89. package/dist/esm/core/inject/models/container.js.map +1 -1
  90. package/dist/esm/core/inject/models/service-types.d.ts +4 -0
  91. package/dist/esm/core/inject/models/service-types.d.ts.map +1 -1
  92. package/dist/esm/core/inject/models/service-types.js +4 -0
  93. package/dist/esm/core/inject/models/service-types.js.map +1 -1
  94. package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.d.ts.map +1 -1
  95. package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.js +16 -0
  96. package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.js.map +1 -1
  97. package/dist/esm/core/introspection/models/companion-introspection.models.d.ts +1 -1
  98. package/dist/esm/core/introspection/models/companion-introspection.models.d.ts.map +1 -1
  99. package/dist/esm/core/introspection/models/companion-introspection.models.js +6 -0
  100. package/dist/esm/core/introspection/models/companion-introspection.models.js.map +1 -1
  101. package/dist/esm/core/introspection/resources/application-secrets.companion.d.ts +41 -0
  102. package/dist/esm/core/introspection/resources/application-secrets.companion.d.ts.map +1 -0
  103. package/dist/esm/core/introspection/resources/application-secrets.companion.js +155 -0
  104. package/dist/esm/core/introspection/resources/application-secrets.companion.js.map +1 -0
  105. package/dist/esm/core/introspection/resources/creation-console-answer.companion.d.ts +76 -0
  106. package/dist/esm/core/introspection/resources/creation-console-answer.companion.d.ts.map +1 -0
  107. package/dist/esm/core/introspection/resources/creation-console-answer.companion.js +197 -0
  108. package/dist/esm/core/introspection/resources/creation-console-answer.companion.js.map +1 -0
  109. package/dist/esm/core/introspection/resources/creation-console-projection.companion.d.ts +47 -0
  110. package/dist/esm/core/introspection/resources/creation-console-projection.companion.d.ts.map +1 -0
  111. package/dist/esm/core/introspection/resources/creation-console-projection.companion.js +199 -0
  112. package/dist/esm/core/introspection/resources/creation-console-projection.companion.js.map +1 -0
  113. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts +42 -0
  114. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts.map +1 -1
  115. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js +173 -22
  116. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js.map +1 -1
  117. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts +78 -90
  118. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -1
  119. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +288 -25
  120. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -1
  121. package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.d.ts +22 -36
  122. package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.d.ts.map +1 -1
  123. package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.js +49 -13
  124. package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.js.map +1 -1
  125. package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.d.ts +1 -1
  126. package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.d.ts.map +1 -1
  127. package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.js +10 -15
  128. package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.js.map +1 -1
  129. package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts +2 -0
  130. package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts.map +1 -1
  131. package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.js.map +1 -1
  132. package/dist/esm/core/introspection/subprocess/asset-noop-hooks.d.ts +4 -0
  133. package/dist/esm/core/introspection/subprocess/asset-noop-hooks.d.ts.map +1 -1
  134. package/dist/esm/core/introspection/subprocess/asset-noop-hooks.js.map +1 -1
  135. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.d.ts.map +1 -1
  136. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js +77 -9
  137. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js.map +1 -1
  138. package/dist/esm/core/introspection/subprocess/compliance-primary-facts.behavior.d.ts +45 -3
  139. package/dist/esm/core/introspection/subprocess/compliance-primary-facts.behavior.d.ts.map +1 -1
  140. package/dist/esm/core/introspection/subprocess/compliance-primary-facts.behavior.js +8 -1
  141. package/dist/esm/core/introspection/subprocess/compliance-primary-facts.behavior.js.map +1 -1
  142. package/dist/esm/core/introspection/subprocess/frontend-labels-needed-info.behavior.d.ts +3 -2
  143. package/dist/esm/core/introspection/subprocess/frontend-labels-needed-info.behavior.d.ts.map +1 -1
  144. package/dist/esm/core/introspection/subprocess/frontend-labels-needed-info.behavior.js +8 -3
  145. package/dist/esm/core/introspection/subprocess/frontend-labels-needed-info.behavior.js.map +1 -1
  146. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts +30 -1
  147. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts.map +1 -1
  148. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js +128 -20
  149. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js.map +1 -1
  150. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts +13 -0
  151. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts.map +1 -1
  152. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js +21 -17
  153. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js.map +1 -1
  154. package/dist/esm/core/runtime/companion-endpoint-record.d.ts +8 -0
  155. package/dist/esm/core/runtime/companion-endpoint-record.d.ts.map +1 -0
  156. package/dist/esm/core/runtime/companion-endpoint-record.js +23 -0
  157. package/dist/esm/core/runtime/companion-endpoint-record.js.map +1 -0
  158. package/dist/esm/core/runtime/companion-env-file.d.ts +30 -0
  159. package/dist/esm/core/runtime/companion-env-file.d.ts.map +1 -0
  160. package/dist/esm/core/runtime/companion-env-file.js +53 -0
  161. package/dist/esm/core/runtime/companion-env-file.js.map +1 -0
  162. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts +5 -0
  163. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts.map +1 -1
  164. package/dist/esm/core/runtime/dev-compile-quiet.companion.js +11 -0
  165. package/dist/esm/core/runtime/dev-compile-quiet.companion.js.map +1 -1
  166. package/dist/esm/core/runtime/in-flight-work-heartbeat.companion.d.ts +56 -0
  167. package/dist/esm/core/runtime/in-flight-work-heartbeat.companion.d.ts.map +1 -0
  168. package/dist/esm/core/runtime/in-flight-work-heartbeat.companion.js +97 -0
  169. package/dist/esm/core/runtime/in-flight-work-heartbeat.companion.js.map +1 -0
  170. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts +43 -3
  171. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
  172. package/dist/esm/core/runtime/services/start-companion-application.service.js +127 -22
  173. package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
  174. package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts +11 -1
  175. package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts.map +1 -1
  176. package/dist/esm/core/runtime/utils/companion-platform-config.companion.js +42 -19
  177. package/dist/esm/core/runtime/utils/companion-platform-config.companion.js.map +1 -1
  178. package/dist/esm/core/specifications/resource-specification-context.factory.d.ts.map +1 -1
  179. package/dist/esm/core/specifications/resource-specification-context.factory.js +10 -1
  180. package/dist/esm/core/specifications/resource-specification-context.factory.js.map +1 -1
  181. package/dist/esm/core/traceability/companion-traceability.models.d.ts +1 -7
  182. package/dist/esm/core/traceability/companion-traceability.models.d.ts.map +1 -1
  183. package/dist/esm/core/traceability/companion-traceability.models.js +3 -5
  184. package/dist/esm/core/traceability/companion-traceability.models.js.map +1 -1
  185. package/dist/esm/creation-conversation/creation-conversation.actors-system.definitions.d.ts.map +1 -1
  186. package/dist/esm/creation-conversation/creation-conversation.actors-system.definitions.js +15 -14
  187. package/dist/esm/creation-conversation/creation-conversation.actors-system.definitions.js.map +1 -1
  188. package/dist/esm/creation-conversation/creation-conversation.function-tools.d.ts +0 -23
  189. package/dist/esm/creation-conversation/creation-conversation.function-tools.d.ts.map +1 -1
  190. package/dist/esm/creation-conversation/creation-conversation.function-tools.js +251 -50
  191. package/dist/esm/creation-conversation/creation-conversation.function-tools.js.map +1 -1
  192. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.d.ts.map +1 -1
  193. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.js +0 -2
  194. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.js.map +1 -1
  195. package/dist/esm/deliberations/services/deliberation.companion.service.d.ts.map +1 -1
  196. package/dist/esm/deliberations/services/deliberation.companion.service.js +3 -2
  197. package/dist/esm/deliberations/services/deliberation.companion.service.js.map +1 -1
  198. package/dist/esm/email/models/email-template.actors-system.definitions.d.ts.map +1 -1
  199. package/dist/esm/email/models/email-template.actors-system.definitions.js +0 -1
  200. package/dist/esm/email/models/email-template.actors-system.definitions.js.map +1 -1
  201. package/dist/esm/email/services/email-template.companion.service.d.ts +5 -3
  202. package/dist/esm/email/services/email-template.companion.service.d.ts.map +1 -1
  203. package/dist/esm/email/services/email-template.companion.service.js +53 -255
  204. package/dist/esm/email/services/email-template.companion.service.js.map +1 -1
  205. package/dist/esm/email/utils/email-labels-file-source.utils.d.ts +12 -0
  206. package/dist/esm/email/utils/email-labels-file-source.utils.d.ts.map +1 -1
  207. package/dist/esm/email/utils/email-labels-file-source.utils.js +62 -3
  208. package/dist/esm/email/utils/email-labels-file-source.utils.js.map +1 -1
  209. package/dist/esm/email/utils/email-labels-tree.utils.d.ts +52 -0
  210. package/dist/esm/email/utils/email-labels-tree.utils.d.ts.map +1 -0
  211. package/dist/esm/email/utils/email-labels-tree.utils.js +261 -0
  212. package/dist/esm/email/utils/email-labels-tree.utils.js.map +1 -0
  213. package/dist/esm/executions/services/companion-actor-execution-persistence.adapter.d.ts +2 -0
  214. package/dist/esm/executions/services/companion-actor-execution-persistence.adapter.d.ts.map +1 -1
  215. package/dist/esm/executions/services/companion-actor-execution-persistence.adapter.js +21 -1
  216. package/dist/esm/executions/services/companion-actor-execution-persistence.adapter.js.map +1 -1
  217. package/dist/esm/executions/services/companion-executions.companion.service.d.ts +18 -1
  218. package/dist/esm/executions/services/companion-executions.companion.service.d.ts.map +1 -1
  219. package/dist/esm/executions/services/companion-executions.companion.service.js +187 -46
  220. package/dist/esm/executions/services/companion-executions.companion.service.js.map +1 -1
  221. package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.d.ts.map +1 -1
  222. package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.js +0 -1
  223. package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.js.map +1 -1
  224. package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.d.ts.map +1 -1
  225. package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.js +0 -1
  226. package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.js.map +1 -1
  227. package/dist/esm/expert-personas/services/expert-persona.companion.service.d.ts.map +1 -1
  228. package/dist/esm/expert-personas/services/expert-persona.companion.service.js +10 -0
  229. package/dist/esm/expert-personas/services/expert-persona.companion.service.js.map +1 -1
  230. package/dist/esm/i18n/components/APPLICATION_LEVEL_NOTIFICATION_CENTER.en.d.ts +1 -8
  231. package/dist/esm/i18n/components/APPLICATION_LEVEL_NOTIFICATION_CENTER.en.d.ts.map +1 -1
  232. package/dist/esm/i18n/components/APPLICATION_LEVEL_NOTIFICATION_CENTER.en.js +2 -9
  233. package/dist/esm/i18n/components/APPLICATION_LEVEL_NOTIFICATION_CENTER.en.js.map +1 -1
  234. package/dist/esm/i18n/components/APPLICATION_LEVEL_USER_DROPDOWN.en.d.ts +2 -0
  235. package/dist/esm/i18n/components/APPLICATION_LEVEL_USER_DROPDOWN.en.d.ts.map +1 -1
  236. package/dist/esm/i18n/components/APPLICATION_LEVEL_USER_DROPDOWN.en.js +3 -1
  237. package/dist/esm/i18n/components/APPLICATION_LEVEL_USER_DROPDOWN.en.js.map +1 -1
  238. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS.en.d.ts +32 -0
  239. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS.en.d.ts.map +1 -0
  240. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS.en.js +32 -0
  241. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS.en.js.map +1 -0
  242. package/dist/esm/i18n/components/APP_LAYOUTS_APPEARANCE_SETTINGS.en.d.ts +0 -1
  243. package/dist/esm/i18n/components/APP_LAYOUTS_APPEARANCE_SETTINGS.en.d.ts.map +1 -1
  244. package/dist/esm/i18n/components/APP_LAYOUTS_APPEARANCE_SETTINGS.en.js +0 -1
  245. package/dist/esm/i18n/components/APP_LAYOUTS_APPEARANCE_SETTINGS.en.js.map +1 -1
  246. package/dist/esm/i18n/components/APP_LAYOUTS_BILLING_SETTINGS.en.d.ts +0 -7
  247. package/dist/esm/i18n/components/APP_LAYOUTS_BILLING_SETTINGS.en.d.ts.map +1 -1
  248. package/dist/esm/i18n/components/APP_LAYOUTS_BILLING_SETTINGS.en.js +0 -7
  249. package/dist/esm/i18n/components/APP_LAYOUTS_BILLING_SETTINGS.en.js.map +1 -1
  250. package/dist/esm/i18n/components/APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS.en.d.ts +30 -4
  251. package/dist/esm/i18n/components/APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS.en.d.ts.map +1 -1
  252. package/dist/esm/i18n/components/APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS.en.js +31 -5
  253. package/dist/esm/i18n/components/APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS.en.js.map +1 -1
  254. package/dist/esm/i18n/components/APP_LAYOUTS_INVITATIONS_SETTINGS.en.d.ts +0 -2
  255. package/dist/esm/i18n/components/APP_LAYOUTS_INVITATIONS_SETTINGS.en.d.ts.map +1 -1
  256. package/dist/esm/i18n/components/APP_LAYOUTS_INVITATIONS_SETTINGS.en.js +0 -2
  257. package/dist/esm/i18n/components/APP_LAYOUTS_INVITATIONS_SETTINGS.en.js.map +1 -1
  258. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.d.ts +4 -0
  259. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.d.ts.map +1 -1
  260. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.js +5 -1
  261. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.js.map +1 -1
  262. package/dist/esm/i18n/components/APP_LAYOUTS_SECURITY_SETTINGS.en.d.ts +1 -15
  263. package/dist/esm/i18n/components/APP_LAYOUTS_SECURITY_SETTINGS.en.d.ts.map +1 -1
  264. package/dist/esm/i18n/components/APP_LAYOUTS_SECURITY_SETTINGS.en.js +1 -15
  265. package/dist/esm/i18n/components/APP_LAYOUTS_SECURITY_SETTINGS.en.js.map +1 -1
  266. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts +0 -3
  267. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts.map +1 -1
  268. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js +0 -3
  269. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js.map +1 -1
  270. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts +49 -16
  271. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts.map +1 -1
  272. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js +49 -16
  273. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js.map +1 -1
  274. package/dist/esm/i18n/components/LOW_LEVEL_AI_SYSTEM_CATALOG.en.d.ts +0 -5
  275. package/dist/esm/i18n/components/LOW_LEVEL_AI_SYSTEM_CATALOG.en.d.ts.map +1 -1
  276. package/dist/esm/i18n/components/LOW_LEVEL_AI_SYSTEM_CATALOG.en.js +0 -5
  277. package/dist/esm/i18n/components/LOW_LEVEL_AI_SYSTEM_CATALOG.en.js.map +1 -1
  278. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW.en.d.ts +3 -0
  279. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW.en.d.ts.map +1 -1
  280. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW.en.js +4 -1
  281. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW.en.js.map +1 -1
  282. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PRICING_TABLE.en.d.ts +7 -1
  283. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PRICING_TABLE.en.d.ts.map +1 -1
  284. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PRICING_TABLE.en.js +8 -2
  285. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PRICING_TABLE.en.js.map +1 -1
  286. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_USAGE_DASHBOARD.en.d.ts +1 -0
  287. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_USAGE_DASHBOARD.en.d.ts.map +1 -1
  288. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_USAGE_DASHBOARD.en.js +2 -1
  289. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_USAGE_DASHBOARD.en.js.map +1 -1
  290. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_FILE.en.d.ts +1 -0
  291. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_FILE.en.d.ts.map +1 -1
  292. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_FILE.en.js +2 -1
  293. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_FILE.en.js.map +1 -1
  294. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_NUMBER.en.d.ts +12 -0
  295. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_NUMBER.en.d.ts.map +1 -0
  296. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_NUMBER.en.js +12 -0
  297. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_NUMBER.en.js.map +1 -0
  298. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.d.ts +1 -0
  299. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.d.ts.map +1 -1
  300. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.js +2 -1
  301. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.js.map +1 -1
  302. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_ADDRESS.en.d.ts +10 -0
  303. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_ADDRESS.en.d.ts.map +1 -1
  304. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_ADDRESS.en.js +11 -1
  305. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_ADDRESS.en.js.map +1 -1
  306. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_FILE.en.d.ts +8 -0
  307. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_FILE.en.d.ts.map +1 -1
  308. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_FILE.en.js +9 -1
  309. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_FILE.en.js.map +1 -1
  310. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts +3 -0
  311. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts.map +1 -1
  312. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js +4 -1
  313. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js.map +1 -1
  314. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts +2 -1
  315. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts.map +1 -1
  316. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js +3 -2
  317. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js.map +1 -1
  318. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_BULK.en.d.ts +6 -0
  319. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_BULK.en.d.ts.map +1 -1
  320. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_BULK.en.js +7 -1
  321. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_BULK.en.js.map +1 -1
  322. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_ITEMS.en.d.ts +1 -0
  323. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_ITEMS.en.d.ts.map +1 -1
  324. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_ITEMS.en.js +2 -1
  325. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_ITEMS.en.js.map +1 -1
  326. package/dist/esm/i18n/components/progression_milestone_tracker.en.d.ts +0 -2
  327. package/dist/esm/i18n/components/progression_milestone_tracker.en.d.ts.map +1 -1
  328. package/dist/esm/i18n/components/progression_milestone_tracker.en.js +0 -2
  329. package/dist/esm/i18n/components/progression_milestone_tracker.en.js.map +1 -1
  330. package/dist/esm/i18n/composite_views/app.creation-conversation.en.d.ts +1 -0
  331. package/dist/esm/i18n/composite_views/app.creation-conversation.en.d.ts.map +1 -1
  332. package/dist/esm/i18n/composite_views/app.creation-conversation.en.js +123 -19
  333. package/dist/esm/i18n/composite_views/app.creation-conversation.en.js.map +1 -1
  334. package/dist/esm/i18n/composite_views/app.creation-dossier.en.d.ts.map +1 -1
  335. package/dist/esm/i18n/composite_views/app.creation-dossier.en.js +12 -0
  336. package/dist/esm/i18n/composite_views/app.creation-dossier.en.js.map +1 -1
  337. package/dist/esm/i18n/errors_guidance/errors-guidance.en.d.ts +25 -0
  338. package/dist/esm/i18n/errors_guidance/errors-guidance.en.d.ts.map +1 -0
  339. package/dist/esm/i18n/errors_guidance/errors-guidance.en.js +26 -0
  340. package/dist/esm/i18n/errors_guidance/errors-guidance.en.js.map +1 -0
  341. package/dist/esm/i18n/errors_messages/errors-messages.en.d.ts +26 -3
  342. package/dist/esm/i18n/errors_messages/errors-messages.en.d.ts.map +1 -1
  343. package/dist/esm/i18n/errors_messages/errors-messages.en.js +25 -3
  344. package/dist/esm/i18n/errors_messages/errors-messages.en.js.map +1 -1
  345. package/dist/esm/i18n/index.d.ts +10 -8
  346. package/dist/esm/i18n/index.d.ts.map +1 -1
  347. package/dist/esm/i18n/index.js +10 -8
  348. package/dist/esm/i18n/index.js.map +1 -1
  349. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.d.ts +10 -0
  350. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.d.ts.map +1 -1
  351. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.js +2 -0
  352. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.js.map +1 -1
  353. package/dist/esm/i18n/resources/workbenchApplicationSecrets.en.d.ts +97 -0
  354. package/dist/esm/i18n/resources/workbenchApplicationSecrets.en.d.ts.map +1 -0
  355. package/dist/esm/i18n/resources/workbenchApplicationSecrets.en.js +60 -0
  356. package/dist/esm/i18n/resources/workbenchApplicationSecrets.en.js.map +1 -0
  357. package/dist/esm/i18n/resources/workbenchAspects.en.d.ts.map +1 -1
  358. package/dist/esm/i18n/resources/workbenchAspects.en.js +6 -0
  359. package/dist/esm/i18n/resources/workbenchAspects.en.js.map +1 -1
  360. package/dist/esm/i18n/resources/workbenchBuildDispatches.en.d.ts +5 -0
  361. package/dist/esm/i18n/resources/workbenchBuildDispatches.en.d.ts.map +1 -1
  362. package/dist/esm/i18n/resources/workbenchBuildDispatches.en.js +1 -0
  363. package/dist/esm/i18n/resources/workbenchBuildDispatches.en.js.map +1 -1
  364. package/dist/esm/i18n/resources/workbenchCodingLaneStatus.en.d.ts +24 -0
  365. package/dist/esm/i18n/resources/workbenchCodingLaneStatus.en.d.ts.map +1 -1
  366. package/dist/esm/i18n/resources/workbenchCodingLaneStatus.en.js +8 -0
  367. package/dist/esm/i18n/resources/workbenchCodingLaneStatus.en.js.map +1 -1
  368. package/dist/esm/i18n/resources/workbenchDossierEntries.en.d.ts +30 -0
  369. package/dist/esm/i18n/resources/workbenchDossierEntries.en.d.ts.map +1 -1
  370. package/dist/esm/i18n/resources/workbenchDossierEntries.en.js +9 -0
  371. package/dist/esm/i18n/resources/workbenchDossierEntries.en.js.map +1 -1
  372. package/dist/esm/i18n/resources/workbenchGovernanceDocuments.en.d.ts +17 -4
  373. package/dist/esm/i18n/resources/workbenchGovernanceDocuments.en.d.ts.map +1 -1
  374. package/dist/esm/i18n/resources/workbenchGovernanceDocuments.en.js +32 -4
  375. package/dist/esm/i18n/resources/workbenchGovernanceDocuments.en.js.map +1 -1
  376. package/dist/esm/i18n/resources/workbenchParkedCodingQuestions.en.d.ts +8 -2
  377. package/dist/esm/i18n/resources/workbenchParkedCodingQuestions.en.d.ts.map +1 -1
  378. package/dist/esm/i18n/resources/workbenchParkedCodingQuestions.en.js +6 -2
  379. package/dist/esm/i18n/resources/workbenchParkedCodingQuestions.en.js.map +1 -1
  380. package/dist/esm/i18n/resources/workbenchPlaybookRuns.en.d.ts +18 -7
  381. package/dist/esm/i18n/resources/workbenchPlaybookRuns.en.d.ts.map +1 -1
  382. package/dist/esm/i18n/resources/workbenchPlaybookRuns.en.js +17 -7
  383. package/dist/esm/i18n/resources/workbenchPlaybookRuns.en.js.map +1 -1
  384. package/dist/esm/i18n/resources/workbenchPlaybooks.en.d.ts +28 -3
  385. package/dist/esm/i18n/resources/workbenchPlaybooks.en.d.ts.map +1 -1
  386. package/dist/esm/i18n/resources/workbenchPlaybooks.en.js +13 -3
  387. package/dist/esm/i18n/resources/workbenchPlaybooks.en.js.map +1 -1
  388. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.d.ts +3 -2
  389. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.d.ts.map +1 -1
  390. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.js +8 -2
  391. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.js.map +1 -1
  392. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +118 -8
  393. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
  394. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +42 -16
  395. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -1
  396. package/dist/esm/i18n/resources/workbenchWaitingPlaybookRuns.en.d.ts +12 -2
  397. package/dist/esm/i18n/resources/workbenchWaitingPlaybookRuns.en.d.ts.map +1 -1
  398. package/dist/esm/i18n/resources/workbenchWaitingPlaybookRuns.en.js +16 -2
  399. package/dist/esm/i18n/resources/workbenchWaitingPlaybookRuns.en.js.map +1 -1
  400. package/dist/esm/i18n/system_enums/application-creation.en.d.ts +10 -0
  401. package/dist/esm/i18n/system_enums/application-creation.en.d.ts.map +1 -1
  402. package/dist/esm/i18n/system_enums/application-creation.en.js +11 -0
  403. package/dist/esm/i18n/system_enums/application-creation.en.js.map +1 -1
  404. package/dist/esm/i18n/system_enums/processor-register.en.d.ts +6 -0
  405. package/dist/esm/i18n/system_enums/processor-register.en.d.ts.map +1 -1
  406. package/dist/esm/i18n/system_enums/processor-register.en.js +6 -0
  407. package/dist/esm/i18n/system_enums/processor-register.en.js.map +1 -1
  408. package/dist/esm/i18n/system_enums/workbench-dossier.en.d.ts +4 -1
  409. package/dist/esm/i18n/system_enums/workbench-dossier.en.d.ts.map +1 -1
  410. package/dist/esm/i18n/system_enums/workbench-dossier.en.js +5 -1
  411. package/dist/esm/i18n/system_enums/workbench-dossier.en.js.map +1 -1
  412. package/dist/esm/i18n/system_enums/workbench-secrets.en.d.ts +46 -0
  413. package/dist/esm/i18n/system_enums/workbench-secrets.en.d.ts.map +1 -0
  414. package/dist/esm/i18n/system_enums/workbench-secrets.en.js +46 -0
  415. package/dist/esm/i18n/system_enums/workbench-secrets.en.js.map +1 -0
  416. package/dist/esm/i18n/system_enums/workbench-specification-artifact.en.d.ts +8 -0
  417. package/dist/esm/i18n/system_enums/workbench-specification-artifact.en.d.ts.map +1 -1
  418. package/dist/esm/i18n/system_enums/workbench-specification-artifact.en.js +13 -0
  419. package/dist/esm/i18n/system_enums/workbench-specification-artifact.en.js.map +1 -1
  420. package/dist/esm/i18n-labelling/models/email-template-labelling-unit.models.d.ts +61 -0
  421. package/dist/esm/i18n-labelling/models/email-template-labelling-unit.models.d.ts.map +1 -0
  422. package/dist/esm/i18n-labelling/models/email-template-labelling-unit.models.js +22 -0
  423. package/dist/esm/i18n-labelling/models/email-template-labelling-unit.models.js.map +1 -0
  424. package/dist/esm/i18n-labelling/models/labelling-unit.models.d.ts +105 -24
  425. package/dist/esm/i18n-labelling/models/labelling-unit.models.d.ts.map +1 -1
  426. package/dist/esm/i18n-labelling/models/labelling-unit.models.js +55 -24
  427. package/dist/esm/i18n-labelling/models/labelling-unit.models.js.map +1 -1
  428. package/dist/esm/i18n-labelling/models/labelling.actors-system.definitions.d.ts.map +1 -1
  429. package/dist/esm/i18n-labelling/models/labelling.actors-system.definitions.js +0 -2
  430. package/dist/esm/i18n-labelling/models/labelling.actors-system.definitions.js.map +1 -1
  431. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.d.ts +48 -0
  432. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.d.ts.map +1 -0
  433. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js +145 -0
  434. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js.map +1 -0
  435. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.d.ts +70 -18
  436. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.d.ts.map +1 -1
  437. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js +330 -113
  438. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js.map +1 -1
  439. package/dist/esm/i18n-labelling/services/labelling-spec-context-loader.companion.service.d.ts +45 -0
  440. package/dist/esm/i18n-labelling/services/labelling-spec-context-loader.companion.service.d.ts.map +1 -1
  441. package/dist/esm/i18n-labelling/services/labelling-spec-context-loader.companion.service.js +208 -6
  442. package/dist/esm/i18n-labelling/services/labelling-spec-context-loader.companion.service.js.map +1 -1
  443. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.d.ts +11 -2
  444. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.d.ts.map +1 -1
  445. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.js +101 -18
  446. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.js.map +1 -1
  447. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.d.ts +64 -1
  448. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.d.ts.map +1 -1
  449. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.js +393 -70
  450. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.js.map +1 -1
  451. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts +9 -5
  452. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts.map +1 -1
  453. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js.map +1 -1
  454. package/dist/esm/i18n-labelling/utils/email-template-translation.utils.d.ts +54 -0
  455. package/dist/esm/i18n-labelling/utils/email-template-translation.utils.d.ts.map +1 -0
  456. package/dist/esm/i18n-labelling/utils/email-template-translation.utils.js +74 -0
  457. package/dist/esm/i18n-labelling/utils/email-template-translation.utils.js.map +1 -0
  458. package/dist/esm/i18n-labelling/utils/frontend-derived-label-keys.utils.d.ts +3 -3
  459. package/dist/esm/i18n-labelling/utils/frontend-derived-label-keys.utils.js.map +1 -1
  460. package/dist/esm/i18n-labelling/utils/incomplete-plan-refusal.utils.d.ts +24 -0
  461. package/dist/esm/i18n-labelling/utils/incomplete-plan-refusal.utils.d.ts.map +1 -0
  462. package/dist/esm/i18n-labelling/utils/incomplete-plan-refusal.utils.js +34 -0
  463. package/dist/esm/i18n-labelling/utils/incomplete-plan-refusal.utils.js.map +1 -0
  464. package/dist/esm/i18n-labelling/utils/orphan-label-artifacts.utils.d.ts.map +1 -1
  465. package/dist/esm/i18n-labelling/utils/orphan-label-artifacts.utils.js +5 -1
  466. package/dist/esm/i18n-labelling/utils/orphan-label-artifacts.utils.js.map +1 -1
  467. package/dist/esm/i18n-labelling/utils/provider-display-name-keys.utils.d.ts +76 -0
  468. package/dist/esm/i18n-labelling/utils/provider-display-name-keys.utils.d.ts.map +1 -0
  469. package/dist/esm/i18n-labelling/utils/provider-display-name-keys.utils.js +110 -0
  470. package/dist/esm/i18n-labelling/utils/provider-display-name-keys.utils.js.map +1 -0
  471. package/dist/esm/i18n-labelling/utils/resource-section-label-keys.utils.d.ts +17 -0
  472. package/dist/esm/i18n-labelling/utils/resource-section-label-keys.utils.d.ts.map +1 -0
  473. package/dist/esm/i18n-labelling/utils/resource-section-label-keys.utils.js +23 -0
  474. package/dist/esm/i18n-labelling/utils/resource-section-label-keys.utils.js.map +1 -0
  475. package/dist/esm/i18n-labelling/utils/schema-fields-extractor.utils.d.ts +36 -3
  476. package/dist/esm/i18n-labelling/utils/schema-fields-extractor.utils.d.ts.map +1 -1
  477. package/dist/esm/i18n-labelling/utils/schema-fields-extractor.utils.js +77 -5
  478. package/dist/esm/i18n-labelling/utils/schema-fields-extractor.utils.js.map +1 -1
  479. package/dist/esm/i18n-labelling/utils/system-of-record-display-name-keys.utils.d.ts +38 -0
  480. package/dist/esm/i18n-labelling/utils/system-of-record-display-name-keys.utils.d.ts.map +1 -0
  481. package/dist/esm/i18n-labelling/utils/system-of-record-display-name-keys.utils.js +66 -0
  482. package/dist/esm/i18n-labelling/utils/system-of-record-display-name-keys.utils.js.map +1 -0
  483. package/dist/esm/index.d.ts.map +1 -1
  484. package/dist/esm/index.js +9 -3
  485. package/dist/esm/index.js.map +1 -1
  486. package/dist/esm/meta-workflows/models/application-build.actors-system.definitions.d.ts.map +1 -1
  487. package/dist/esm/meta-workflows/models/application-build.actors-system.definitions.js +0 -1
  488. package/dist/esm/meta-workflows/models/application-build.actors-system.definitions.js.map +1 -1
  489. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts.map +1 -1
  490. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js +1 -3
  491. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js.map +1 -1
  492. package/dist/esm/meta-workflows/models/application-line-catalog.models.d.ts +11 -0
  493. package/dist/esm/meta-workflows/models/application-line-catalog.models.d.ts.map +1 -0
  494. package/dist/esm/meta-workflows/models/application-line-catalog.models.js +17 -0
  495. package/dist/esm/meta-workflows/models/application-line-catalog.models.js.map +1 -0
  496. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts.map +1 -1
  497. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js +0 -1
  498. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js.map +1 -1
  499. package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js +1 -1
  500. package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js.map +1 -1
  501. package/dist/esm/meta-workflows/models/composite-round-relaunch.models.d.ts +14 -0
  502. package/dist/esm/meta-workflows/models/composite-round-relaunch.models.d.ts.map +1 -1
  503. package/dist/esm/meta-workflows/models/composite-round-relaunch.models.js +18 -0
  504. package/dist/esm/meta-workflows/models/composite-round-relaunch.models.js.map +1 -1
  505. package/dist/esm/meta-workflows/models/human-decision-settler.models.d.ts +14 -0
  506. package/dist/esm/meta-workflows/models/human-decision-settler.models.d.ts.map +1 -0
  507. package/dist/esm/meta-workflows/models/human-decision-settler.models.js +18 -0
  508. package/dist/esm/meta-workflows/models/human-decision-settler.models.js.map +1 -0
  509. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.d.ts +31 -23
  510. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.d.ts.map +1 -1
  511. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.js +36 -5
  512. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.js.map +1 -1
  513. package/dist/esm/meta-workflows/models/meta-workflows.actors-system.definitions.d.ts.map +1 -1
  514. package/dist/esm/meta-workflows/models/meta-workflows.actors-system.definitions.js +1 -3
  515. package/dist/esm/meta-workflows/models/meta-workflows.actors-system.definitions.js.map +1 -1
  516. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.d.ts +19 -0
  517. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.d.ts.map +1 -1
  518. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.js +38 -6
  519. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.js.map +1 -1
  520. package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts +48 -3
  521. package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts.map +1 -1
  522. package/dist/esm/meta-workflows/models/playbook-run-record.models.js +61 -8
  523. package/dist/esm/meta-workflows/models/playbook-run-record.models.js.map +1 -1
  524. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.d.ts +15 -1
  525. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.d.ts.map +1 -1
  526. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.js +50 -5
  527. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.js.map +1 -1
  528. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +52 -9
  529. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  530. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +131 -59
  531. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  532. package/dist/esm/meta-workflows/services/application-build-experience-skills.companion.service.d.ts +19 -0
  533. package/dist/esm/meta-workflows/services/application-build-experience-skills.companion.service.d.ts.map +1 -0
  534. package/dist/esm/meta-workflows/services/application-build-experience-skills.companion.service.js +36 -0
  535. package/dist/esm/meta-workflows/services/application-build-experience-skills.companion.service.js.map +1 -0
  536. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +9 -0
  537. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
  538. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +41 -17
  539. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
  540. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +42 -2
  541. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
  542. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js +121 -4
  543. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
  544. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.d.ts +32 -0
  545. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.d.ts.map +1 -0
  546. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js +161 -0
  547. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js.map +1 -0
  548. package/dist/esm/meta-workflows/services/build-plan-authoring.companion.service.d.ts +2 -0
  549. package/dist/esm/meta-workflows/services/build-plan-authoring.companion.service.d.ts.map +1 -1
  550. package/dist/esm/meta-workflows/services/build-plan-authoring.companion.service.js +1 -0
  551. package/dist/esm/meta-workflows/services/build-plan-authoring.companion.service.js.map +1 -1
  552. package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.d.ts +3 -2
  553. package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.d.ts.map +1 -1
  554. package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.js +12 -3
  555. package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.js.map +1 -1
  556. package/dist/esm/meta-workflows/services/dossier.companion.service.d.ts +74 -1
  557. package/dist/esm/meta-workflows/services/dossier.companion.service.d.ts.map +1 -1
  558. package/dist/esm/meta-workflows/services/dossier.companion.service.js +227 -30
  559. package/dist/esm/meta-workflows/services/dossier.companion.service.js.map +1 -1
  560. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts +29 -2
  561. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts.map +1 -1
  562. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js +68 -5
  563. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js.map +1 -1
  564. package/dist/esm/meta-workflows/services/governed-document-texts.companion.d.ts +40 -0
  565. package/dist/esm/meta-workflows/services/governed-document-texts.companion.d.ts.map +1 -0
  566. package/dist/esm/meta-workflows/services/governed-document-texts.companion.js +91 -0
  567. package/dist/esm/meta-workflows/services/governed-document-texts.companion.js.map +1 -0
  568. package/dist/esm/meta-workflows/services/governed-documents-pdf.companion.d.ts +25 -0
  569. package/dist/esm/meta-workflows/services/governed-documents-pdf.companion.d.ts.map +1 -0
  570. package/dist/esm/meta-workflows/services/governed-documents-pdf.companion.js +40 -0
  571. package/dist/esm/meta-workflows/services/governed-documents-pdf.companion.js.map +1 -0
  572. package/dist/esm/meta-workflows/services/playbook-instance.companion.service.d.ts +90 -0
  573. package/dist/esm/meta-workflows/services/playbook-instance.companion.service.d.ts.map +1 -0
  574. package/dist/esm/meta-workflows/services/playbook-instance.companion.service.js +307 -0
  575. package/dist/esm/meta-workflows/services/playbook-instance.companion.service.js.map +1 -0
  576. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts +29 -0
  577. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts.map +1 -1
  578. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js +44 -4
  579. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js.map +1 -1
  580. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +360 -47
  581. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
  582. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +1424 -246
  583. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  584. package/package.json +17 -17
  585. package/dist/esm/__time-gov.probe.d.mts +0 -0
  586. package/dist/esm/__time-gov.probe.d.mts.map +0 -0
  587. package/dist/esm/__time-gov.probe.mjs.map +0 -0
  588. package/dist/esm/core/introspection/subprocess/family-aspects.behavior.head-parity.tmp.d.ts +0 -0
  589. package/dist/esm/core/introspection/subprocess/family-aspects.behavior.head-parity.tmp.d.ts.map +0 -0
  590. package/dist/esm/core/introspection/subprocess/family-aspects.behavior.head-parity.tmp.js.map +0 -0
  591. package/dist/esm/i18n/composite_views/app.creation-board.en.d.ts +0 -0
  592. package/dist/esm/i18n/composite_views/app.creation-board.en.d.ts.map +0 -0
  593. package/dist/esm/i18n/composite_views/app.creation-board.en.js.map +0 -0
  594. package/dist/esm/meta-workflows/services/creator-inputs.companion.service.d.ts +0 -0
  595. package/dist/esm/meta-workflows/services/creator-inputs.companion.service.d.ts.map +0 -0
  596. package/dist/esm/meta-workflows/services/creator-inputs.companion.service.js.map +0 -0
@@ -27,8 +27,14 @@ import { ChangeSetAttributionClass, ChangeSetFileChangeKind, type GitChangeSetCa
27
27
  *
28
28
  * Not an acceptance ledger. Acceptance is the commit (`.claude/rules/one-source-of-truth.md`); the
29
29
  * `acceptedCommitSha` stamped here after one is a CACHE of what `git log` already knows, kept so a
30
- * board can say "accepted" without asking git per row. Delete the directory and nothing is lost but
31
- * the ability to accept a run older than the deletion — which `git` still lets a person do by hand.
30
+ * board can say "accepted" without asking git per row.
31
+ *
32
+ * It is, however, the only evidence of WHICH runs may carry an uncommitted leftover (#1805): a commit of
33
+ * work several runs shared names every run whose record still holds the path, and restart recovery commits
34
+ * a lone interrupted run under its own name only when no other record may carry its files. Delete the
35
+ * directory and two things are lost: accepting a run older than the deletion (which `git` still lets a
36
+ * person do by hand), and those names — later commits then name fewer runs than may have written their
37
+ * files, and a lone interrupted run is taken for the sole writer of a leftover an earlier run left.
32
38
  */
33
39
  declare const CodingRunWriteFileSchema: z.ZodObject<{
34
40
  /** App-root-relative path. */
@@ -1 +1 @@
1
- {"version":3,"file":"coding-run-write-register.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/claude-cli/services/coding-run-write-register.companion.service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC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GAAG,OAAO,CAAC,oBAAoB,CAAC;IA6BpB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IAQ5E,wGAAwG;IAC3F,IAAI,IAAI,OAAO,CAAC,SAAS,oBAAoB,EAAE,CAAC;IAiB7D,6FAA6F;IAChF,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IAIhF,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;YAQzF,KAAK;IAKnB,OAAO,CAAC,wBAAwB;IAIhC,OAAO,CAAC,iBAAiB;CAK1B"}
1
+ {"version":3,"file":"coding-run-write-register.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/claude-cli/services/coding-run-write-register.companion.service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,KAAK,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAEtI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,QAAA,MAAM,wBAAwB;IAC5B,8BAA8B;;;;;IAK9B,6EAA6E;;IAE7E;;;;OAIG;;kBAEH,CAAC;AAEH,QAAA,MAAM,0BAA0B;IAC9B,uEAAuE;;IAEvE,+CAA+C;;;;;IAK/C,iHAAiH;;QAvBjH,8BAA8B;;;;;QAK9B,6EAA6E;;QAE7E;;;;WAIG;;;IAcH,kHAAkH;;;;kBAIlH,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAE1D;AAED,qBACa,sCAAsC;IAIZ,OAAO,CAAC,QAAQ,CAAC,MAAM;IACR,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAJrF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+D;gBAGlC,MAAM,EAAE,aAAa,EACN,gBAAgB,EAAE,gBAAgB;IAKvG;;;;;;OAMG;IACU,MAAM,CAAC,KAAK,EAAE;QACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;QACxC,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KAC3C,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA6BpB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IAQ5E,wGAAwG;IAC3F,IAAI,IAAI,OAAO,CAAC,SAAS,oBAAoB,EAAE,CAAC;IAiB7D,6FAA6F;IAChF,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IAIhF,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;YAQzF,KAAK;IAKnB,OAAO,CAAC,wBAAwB;IAIhC,OAAO,CAAC,iBAAiB;CAK1B"}
@@ -43,8 +43,14 @@ import { ChangeSetAttributionClass, ChangeSetFileChangeKind } from '../models/co
43
43
  *
44
44
  * Not an acceptance ledger. Acceptance is the commit (`.claude/rules/one-source-of-truth.md`); the
45
45
  * `acceptedCommitSha` stamped here after one is a CACHE of what `git log` already knows, kept so a
46
- * board can say "accepted" without asking git per row. Delete the directory and nothing is lost but
47
- * the ability to accept a run older than the deletion — which `git` still lets a person do by hand.
46
+ * board can say "accepted" without asking git per row.
47
+ *
48
+ * It is, however, the only evidence of WHICH runs may carry an uncommitted leftover (#1805): a commit of
49
+ * work several runs shared names every run whose record still holds the path, and restart recovery commits
50
+ * a lone interrupted run under its own name only when no other record may carry its files. Delete the
51
+ * directory and two things are lost: accepting a run older than the deletion (which `git` still lets a
52
+ * person do by hand), and those names — later commits then name fewer runs than may have written their
53
+ * files, and a lone interrupted run is taken for the sole writer of a leftover an earlier run left.
48
54
  */
49
55
  const CodingRunWriteFileSchema = z.strictObject({
50
56
  /** App-root-relative path. */
@@ -1 +1 @@
1
- {"version":3,"file":"coding-run-write-register.companion.service.js","sourceRoot":"","sources":["../../../../../src/claude-cli/services/coding-run-write-register.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAA4B,MAAM,wCAAwC,CAAC;AAEtI;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,wBAAwB,GAAG,CAAC,CAAC,YAAY,CAAC;IAC9C,8BAA8B;IAC9B,IAAI,EAAE,CAAC,CAA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,CAAC,IAAI,CAAC,wBAAwB,EAAE,EAAE,GAAG,MAAM,OAAO,CAAC,CAAC;IACtE,CAAC;CACF,CAAA;AAxGY,sCAAsC;IADlD,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;;GALxC,sCAAsC,CAwGlD","sourcesContent":["import { createHash } from 'node:crypto';\nimport { mkdir, readFile, readdir, writeFile } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { inject, injectable } from 'inversify';\nimport { z } from 'zod';\n\nimport type { LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { ChangeSetAttributionClass, ChangeSetFileChangeKind, type GitChangeSetCapture } from '../models/coding-agent-dispatch.models';\n\n/**\n * The CODING-RUN write register (#1454, Step 7) — which paths each coding run changed, as the\n * post-run change-set capture attributed them, with the bytes' hash right after the run.\n *\n * ## Why a second register beside the playbook one\n *\n * `PlaybookRunWriteRegisterCompanionService` records what the COMPANION wrote — it holds the exact\n * written bytes and the pre-image, because the companion is the writer and has both in hand. A coding\n * agent writes through its own process; what the companion has is the change-set CAPTURE — a\n * before/after snapshot with an attribution class per path — and that is what acceptance needs:\n * WHICH paths, whether each was the run's own (`RUN_EXCLUSIVE`, `APPEARED_DURING_RUN`) or carried\n * something else's hunks (`BASELINE_DIRTY_AMBIGUOUS`), and whether the bytes still are what the run\n * left. The two registers answer the same question (\"what did this run change?\") from two different\n * writers, and forcing them into one schema would make one of them lie about what it knows.\n *\n * ## Why the durable actor-task row is not enough\n *\n * The task's `changeSetSummary` is BOUNDED (`CHANGE_SET_SUMMARY_FILE_LIMIT`) and carries no content\n * hash: a run touching more files than the bound would be accepted short, silently. This record is\n * complete and hashed, and it costs one JSON file per run.\n *\n * ## What it is not\n *\n * Not an acceptance ledger. Acceptance is the commit (`.claude/rules/one-source-of-truth.md`); the\n * `acceptedCommitSha` stamped here after one is a CACHE of what `git log` already knows, kept so a\n * board can say \"accepted\" without asking git per row. Delete the directory and nothing is lost but\n * the ability to accept a run older than the deletion — which `git` still lets a person do by hand.\n */\n\nconst CodingRunWriteFileSchema = z.strictObject({\n /** App-root-relative path. */\n path: z.string().min(1),\n changeKind: z.enum(ChangeSetFileChangeKind),\n attribution: z.enum(ChangeSetAttributionClass),\n dirtyAtBaseline: z.boolean(),\n /** sha256 of the file's bytes right after the run; absent for a deletion. */\n contentSha256: z.string().min(1).optional(),\n /**\n * Present only for a run that shared the tree with others (#1528): whether the run has its OWN\n * evidence of writing this path (`collectRunClaimedPaths`). A wave's capture holds every sibling's\n * files, so for a concurrent run the capture alone cannot say whose a path is.\n */\n claimedByRun: z.boolean().optional(),\n});\n\nconst CodingRunWriteRecordSchema = z.strictObject({\n /** The durable actor-task id — this lane's handle for a coding run. */\n taskId: z.string().min(1),\n /** The build-plan task the run implemented. */\n taskRef: z.string().min(1),\n at: z.string().min(1),\n baselineHeadSha: z.string().min(1),\n postRunHeadSha: z.string().min(1),\n /** May be EMPTY: a run that wrote nothing is a fact worth recording, since \"nothing to accept\" is its answer. */\n files: z.array(CodingRunWriteFileSchema),\n /** TRUE when the run shared the tree with other runs (#1528): its own accept then commits only what it claims. */\n concurrent: z.literal(true).optional(),\n acceptedAt: z.string().min(1).optional(),\n acceptedCommitSha: z.string().min(1).optional(),\n});\nexport type CodingRunWriteRecord = z.infer<typeof CodingRunWriteRecordSchema>;\nexport type CodingRunWriteFile = z.infer<typeof CodingRunWriteFileSchema>;\n\nexport function sha256Hex(content: string | Buffer): string {\n return createHash('sha256').update(content).digest('hex');\n}\n\n@injectable()\nexport class CodingRunWriteRegisterCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n public constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n ) {\n this.logDebug = this.logger.debugByType('CodingRunWriteRegister');\n }\n\n /**\n * Record a concluded run's change set. Reads each surviving file's bytes NOW, so the hash names what\n * the run left rather than what a later edit made of it — the accept door compares against it.\n *\n * `claimedPaths` is given for a CONCURRENT run only, and marks which captured paths the run has\n * its own evidence of writing; a single-flight run held the tree alone, so its capture is its own.\n */\n public async record(input: {\n readonly taskId: string;\n readonly taskRef: string;\n readonly changeSet: GitChangeSetCapture;\n readonly claimedPaths?: readonly string[];\n }): Promise<CodingRunWriteRecord> {\n const claimed = input.claimedPaths === undefined ? undefined : new Set(input.claimedPaths);\n const files: CodingRunWriteFile[] = [];\n for (const entry of input.changeSet.files) {\n const deleted = entry.changeKind === ChangeSetFileChangeKind.DELETED;\n const bytes = deleted ? undefined : await readFile(path.resolve(this.companionContext.saasRoot, entry.path)).catch(() => undefined);\n files.push({\n path: entry.path,\n changeKind: entry.changeKind,\n attribution: entry.attribution,\n dirtyAtBaseline: entry.dirtyAtBaseline,\n ...(bytes !== undefined ? { contentSha256: sha256Hex(bytes) } : {}),\n ...(claimed !== undefined ? { claimedByRun: claimed.has(entry.path) } : {}),\n });\n }\n const record = CodingRunWriteRecordSchema.parse({\n taskId: input.taskId,\n taskRef: input.taskRef,\n at: input.changeSet.capturedAt,\n baselineHeadSha: input.changeSet.baselineHeadSha,\n postRunHeadSha: input.changeSet.postRunHeadSha,\n files,\n ...(claimed !== undefined ? { concurrent: true } : {}),\n });\n await this.write(record);\n this.logDebug('Recorded coding-run writes', { taskId: record.taskId, taskRef: record.taskRef, files: record.files.length });\n return record;\n }\n\n public async read(taskId: string): Promise<CodingRunWriteRecord | undefined> {\n const raw = await readFile(this.resolveRecordPath(taskId), 'utf8').catch((error: NodeJS.ErrnoException) => {\n if (error?.code === 'ENOENT') return undefined;\n throw error;\n });\n return raw === undefined ? undefined : CodingRunWriteRecordSchema.parse(JSON.parse(raw));\n }\n\n /** Newest first. An unreadable record is skipped, never fatal — one bad file must not hide the rest. */\n public async list(): Promise<readonly CodingRunWriteRecord[]> {\n const directory = this.resolveRegisterDirectory();\n const entries = await readdir(directory).catch((error: NodeJS.ErrnoException) => {\n if (error?.code === 'ENOENT') return [] as string[];\n throw error;\n });\n const records: CodingRunWriteRecord[] = [];\n for (const entry of entries.filter((name) => name.endsWith('.json'))) {\n try {\n records.push(CodingRunWriteRecordSchema.parse(JSON.parse(await readFile(path.join(directory, entry), 'utf8'))));\n } catch {\n this.logDebug('Skipping unreadable coding-run write record', { entry });\n }\n }\n return records.sort((left, right) => right.at.localeCompare(left.at));\n }\n\n /** The most recent run recorded for a build-plan task — the one \"accept this task\" means. */\n public async findLatestForTaskRef(taskRef: string): Promise<CodingRunWriteRecord | undefined> {\n return (await this.list()).find((record) => record.taskRef === taskRef);\n }\n\n public async markAccepted(taskId: string, commitSha: string, at: string): Promise<CodingRunWriteRecord> {\n const record = await this.read(taskId);\n if (!record) throw new Error(`No coding-run write record exists for task ${taskId}.`);\n const accepted = { ...record, acceptedAt: at, acceptedCommitSha: commitSha };\n await this.write(accepted);\n return accepted;\n }\n\n private async write(record: CodingRunWriteRecord): Promise<void> {\n await mkdir(this.resolveRegisterDirectory(), { recursive: true });\n await writeFile(this.resolveRecordPath(record.taskId), `${JSON.stringify(record, null, 2)}\\n`, 'utf8');\n }\n\n private resolveRegisterDirectory(): string {\n return path.resolve(this.companionContext.saasRoot, '.wildo-saas/state/meta-workflows/coding-run-writes');\n }\n\n private resolveRecordPath(taskId: string): string {\n // The taskId doubles as a file name; refuse anything path-shaped.\n if (!/^[a-zA-Z0-9._-]+$/.test(taskId)) throw new Error(`Task id \"${taskId}\" is not a valid record name.`);\n return path.join(this.resolveRegisterDirectory(), `${taskId}.json`);\n }\n}\n"]}
1
+ {"version":3,"file":"coding-run-write-register.companion.service.js","sourceRoot":"","sources":["../../../../../src/claude-cli/services/coding-run-write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;IAClB,CAAC;IAEO,KAAK,CAAC,KAAK,CAAC,MAA4B;QAC9C,MAAM,KAAK,CAAC,IAAI,CAAC,wBAAwB,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAClE,MAAM,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzG,CAAC;IAEO,wBAAwB;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,oDAAoD,CAAC,CAAC;IAC5G,CAAC;IAEO,iBAAiB,CAAC,MAAc;QACtC,kEAAkE;QAClE,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,YAAY,MAAM,+BAA+B,CAAC,CAAC;QAC1G,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE,EAAE,GAAG,MAAM,OAAO,CAAC,CAAC;IACtE,CAAC;CACF,CAAA;AAxGY,sCAAsC;IADlD,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;;GALxC,sCAAsC,CAwGlD","sourcesContent":["import { createHash } from 'node:crypto';\nimport { mkdir, readFile, readdir, writeFile } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { inject, injectable } from 'inversify';\nimport { z } from 'zod';\n\nimport type { LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { ChangeSetAttributionClass, ChangeSetFileChangeKind, type GitChangeSetCapture } from '../models/coding-agent-dispatch.models';\n\n/**\n * The CODING-RUN write register (#1454, Step 7) — which paths each coding run changed, as the\n * post-run change-set capture attributed them, with the bytes' hash right after the run.\n *\n * ## Why a second register beside the playbook one\n *\n * `PlaybookRunWriteRegisterCompanionService` records what the COMPANION wrote — it holds the exact\n * written bytes and the pre-image, because the companion is the writer and has both in hand. A coding\n * agent writes through its own process; what the companion has is the change-set CAPTURE — a\n * before/after snapshot with an attribution class per path — and that is what acceptance needs:\n * WHICH paths, whether each was the run's own (`RUN_EXCLUSIVE`, `APPEARED_DURING_RUN`) or carried\n * something else's hunks (`BASELINE_DIRTY_AMBIGUOUS`), and whether the bytes still are what the run\n * left. The two registers answer the same question (\"what did this run change?\") from two different\n * writers, and forcing them into one schema would make one of them lie about what it knows.\n *\n * ## Why the durable actor-task row is not enough\n *\n * The task's `changeSetSummary` is BOUNDED (`CHANGE_SET_SUMMARY_FILE_LIMIT`) and carries no content\n * hash: a run touching more files than the bound would be accepted short, silently. This record is\n * complete and hashed, and it costs one JSON file per run.\n *\n * ## What it is not\n *\n * Not an acceptance ledger. Acceptance is the commit (`.claude/rules/one-source-of-truth.md`); the\n * `acceptedCommitSha` stamped here after one is a CACHE of what `git log` already knows, kept so a\n * board can say \"accepted\" without asking git per row.\n *\n * It is, however, the only evidence of WHICH runs may carry an uncommitted leftover (#1805): a commit of\n * work several runs shared names every run whose record still holds the path, and restart recovery commits\n * a lone interrupted run under its own name only when no other record may carry its files. Delete the\n * directory and two things are lost: accepting a run older than the deletion (which `git` still lets a\n * person do by hand), and those names — later commits then name fewer runs than may have written their\n * files, and a lone interrupted run is taken for the sole writer of a leftover an earlier run left.\n */\n\nconst CodingRunWriteFileSchema = z.strictObject({\n /** App-root-relative path. */\n path: z.string().min(1),\n changeKind: z.enum(ChangeSetFileChangeKind),\n attribution: z.enum(ChangeSetAttributionClass),\n dirtyAtBaseline: z.boolean(),\n /** sha256 of the file's bytes right after the run; absent for a deletion. */\n contentSha256: z.string().min(1).optional(),\n /**\n * Present only for a run that shared the tree with others (#1528): whether the run has its OWN\n * evidence of writing this path (`collectRunClaimedPaths`). A wave's capture holds every sibling's\n * files, so for a concurrent run the capture alone cannot say whose a path is.\n */\n claimedByRun: z.boolean().optional(),\n});\n\nconst CodingRunWriteRecordSchema = z.strictObject({\n /** The durable actor-task id — this lane's handle for a coding run. */\n taskId: z.string().min(1),\n /** The build-plan task the run implemented. */\n taskRef: z.string().min(1),\n at: z.string().min(1),\n baselineHeadSha: z.string().min(1),\n postRunHeadSha: z.string().min(1),\n /** May be EMPTY: a run that wrote nothing is a fact worth recording, since \"nothing to accept\" is its answer. */\n files: z.array(CodingRunWriteFileSchema),\n /** TRUE when the run shared the tree with other runs (#1528): its own accept then commits only what it claims. */\n concurrent: z.literal(true).optional(),\n acceptedAt: z.string().min(1).optional(),\n acceptedCommitSha: z.string().min(1).optional(),\n});\nexport type CodingRunWriteRecord = z.infer<typeof CodingRunWriteRecordSchema>;\nexport type CodingRunWriteFile = z.infer<typeof CodingRunWriteFileSchema>;\n\nexport function sha256Hex(content: string | Buffer): string {\n return createHash('sha256').update(content).digest('hex');\n}\n\n@injectable()\nexport class CodingRunWriteRegisterCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n public constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n ) {\n this.logDebug = this.logger.debugByType('CodingRunWriteRegister');\n }\n\n /**\n * Record a concluded run's change set. Reads each surviving file's bytes NOW, so the hash names what\n * the run left rather than what a later edit made of it — the accept door compares against it.\n *\n * `claimedPaths` is given for a CONCURRENT run only, and marks which captured paths the run has\n * its own evidence of writing; a single-flight run held the tree alone, so its capture is its own.\n */\n public async record(input: {\n readonly taskId: string;\n readonly taskRef: string;\n readonly changeSet: GitChangeSetCapture;\n readonly claimedPaths?: readonly string[];\n }): Promise<CodingRunWriteRecord> {\n const claimed = input.claimedPaths === undefined ? undefined : new Set(input.claimedPaths);\n const files: CodingRunWriteFile[] = [];\n for (const entry of input.changeSet.files) {\n const deleted = entry.changeKind === ChangeSetFileChangeKind.DELETED;\n const bytes = deleted ? undefined : await readFile(path.resolve(this.companionContext.saasRoot, entry.path)).catch(() => undefined);\n files.push({\n path: entry.path,\n changeKind: entry.changeKind,\n attribution: entry.attribution,\n dirtyAtBaseline: entry.dirtyAtBaseline,\n ...(bytes !== undefined ? { contentSha256: sha256Hex(bytes) } : {}),\n ...(claimed !== undefined ? { claimedByRun: claimed.has(entry.path) } : {}),\n });\n }\n const record = CodingRunWriteRecordSchema.parse({\n taskId: input.taskId,\n taskRef: input.taskRef,\n at: input.changeSet.capturedAt,\n baselineHeadSha: input.changeSet.baselineHeadSha,\n postRunHeadSha: input.changeSet.postRunHeadSha,\n files,\n ...(claimed !== undefined ? { concurrent: true } : {}),\n });\n await this.write(record);\n this.logDebug('Recorded coding-run writes', { taskId: record.taskId, taskRef: record.taskRef, files: record.files.length });\n return record;\n }\n\n public async read(taskId: string): Promise<CodingRunWriteRecord | undefined> {\n const raw = await readFile(this.resolveRecordPath(taskId), 'utf8').catch((error: NodeJS.ErrnoException) => {\n if (error?.code === 'ENOENT') return undefined;\n throw error;\n });\n return raw === undefined ? undefined : CodingRunWriteRecordSchema.parse(JSON.parse(raw));\n }\n\n /** Newest first. An unreadable record is skipped, never fatal — one bad file must not hide the rest. */\n public async list(): Promise<readonly CodingRunWriteRecord[]> {\n const directory = this.resolveRegisterDirectory();\n const entries = await readdir(directory).catch((error: NodeJS.ErrnoException) => {\n if (error?.code === 'ENOENT') return [] as string[];\n throw error;\n });\n const records: CodingRunWriteRecord[] = [];\n for (const entry of entries.filter((name) => name.endsWith('.json'))) {\n try {\n records.push(CodingRunWriteRecordSchema.parse(JSON.parse(await readFile(path.join(directory, entry), 'utf8'))));\n } catch {\n this.logDebug('Skipping unreadable coding-run write record', { entry });\n }\n }\n return records.sort((left, right) => right.at.localeCompare(left.at));\n }\n\n /** The most recent run recorded for a build-plan task — the one \"accept this task\" means. */\n public async findLatestForTaskRef(taskRef: string): Promise<CodingRunWriteRecord | undefined> {\n return (await this.list()).find((record) => record.taskRef === taskRef);\n }\n\n public async markAccepted(taskId: string, commitSha: string, at: string): Promise<CodingRunWriteRecord> {\n const record = await this.read(taskId);\n if (!record) throw new Error(`No coding-run write record exists for task ${taskId}.`);\n const accepted = { ...record, acceptedAt: at, acceptedCommitSha: commitSha };\n await this.write(accepted);\n return accepted;\n }\n\n private async write(record: CodingRunWriteRecord): Promise<void> {\n await mkdir(this.resolveRegisterDirectory(), { recursive: true });\n await writeFile(this.resolveRecordPath(record.taskId), `${JSON.stringify(record, null, 2)}\\n`, 'utf8');\n }\n\n private resolveRegisterDirectory(): string {\n return path.resolve(this.companionContext.saasRoot, '.wildo-saas/state/meta-workflows/coding-run-writes');\n }\n\n private resolveRecordPath(taskId: string): string {\n // The taskId doubles as a file name; refuse anything path-shaped.\n if (!/^[a-zA-Z0-9._-]+$/.test(taskId)) throw new Error(`Task id \"${taskId}\" is not a valid record name.`);\n return path.join(this.resolveRegisterDirectory(), `${taskId}.json`);\n }\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import type { CompanionExecutionSessionContext } from '../../core/traceability/companion-traceability.models';
2
+ import type { CompanionExecutionsCompanionService } from '../../executions/services/companion-executions.companion.service';
3
+ /** One live coding run, as the actor plane records it. */
4
+ export interface InFlightCodingRun {
5
+ readonly executionId: string;
6
+ readonly taskRef: string | null;
7
+ readonly exclusiveSubject?: string;
8
+ readonly createdAt?: string;
9
+ }
10
+ /**
11
+ * The live coding runs — selected, admitted or running — read from the actor plane, so the answer holds
12
+ * across processes and restarts (#1528). A parked run is not live: its agent is closed.
13
+ *
14
+ * A function over the executions service rather than a method of the dispatch service, because the
15
+ * ACCEPT service needs the same answer (a person's accept must not commit while a worker writes the tree)
16
+ * and the dispatch service already depends on the accept service: reading it from there would be a cycle.
17
+ * One reader, so the dispatch's own "is anything running" and the accept guard cannot disagree.
18
+ */
19
+ export declare function listInFlightCodingRuns(executions: Pick<CompanionExecutionsCompanionService, 'listActorExecutions'>, sessionContext?: CompanionExecutionSessionContext): Promise<InFlightCodingRun[]>;
20
+ //# sourceMappingURL=in-flight-coding-runs.companion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-flight-coding-runs.companion.d.ts","sourceRoot":"","sources":["../../../../../src/claude-cli/services/in-flight-coding-runs.companion.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,uDAAuD,CAAC;AAC9G,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,kEAAkE,CAAC;AAG5H,0DAA0D;AAC1D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,IAAI,CAAC,mCAAmC,EAAE,qBAAqB,CAAC,EAC5E,cAAc,CAAC,EAAE,gCAAgC,GAChD,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAgB9B"}
@@ -0,0 +1,29 @@
1
+ import { FlowsActors_Status } from '@wildo-ai/saas-models';
2
+ import { CompanionExecutionsListQuerySchema } from '../../companion-api/companion-api.schemas.js';
3
+ import { APPLICATION_CODING_SYSTEM_REF } from '../../meta-workflows/models/application-coding-agent.actors-system.definitions.js';
4
+ /**
5
+ * The live coding runs — selected, admitted or running — read from the actor plane, so the answer holds
6
+ * across processes and restarts (#1528). A parked run is not live: its agent is closed.
7
+ *
8
+ * A function over the executions service rather than a method of the dispatch service, because the
9
+ * ACCEPT service needs the same answer (a person's accept must not commit while a worker writes the tree)
10
+ * and the dispatch service already depends on the accept service: reading it from there would be a cycle.
11
+ * One reader, so the dispatch's own "is anything running" and the accept guard cannot disagree.
12
+ */
13
+ export async function listInFlightCodingRuns(executions, sessionContext) {
14
+ const rows = (await Promise.all([FlowsActors_Status.PENDING, FlowsActors_Status.PROCESSING].map((status) => executions.listActorExecutions(CompanionExecutionsListQuerySchema.parse({ systemRef: APPLICATION_CODING_SYSTEM_REF, status, limit: 200 }), sessionContext)))).flat();
15
+ return rows.map((row) => {
16
+ const execution = row;
17
+ const input = execution.standaloneTasks?.[0]?.input;
18
+ const taskRef = typeof input === 'object' && input !== null && typeof input.taskRef === 'string'
19
+ ? input.taskRef
20
+ : null;
21
+ return {
22
+ executionId: String(execution._id),
23
+ taskRef,
24
+ ...(execution.exclusiveSubject ? { exclusiveSubject: execution.exclusiveSubject } : {}),
25
+ ...(execution.createdAt ? { createdAt: execution.createdAt } : {}),
26
+ };
27
+ });
28
+ }
29
+ //# sourceMappingURL=in-flight-coding-runs.companion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-flight-coding-runs.companion.js","sourceRoot":"","sources":["../../../../../src/claude-cli/services/in-flight-coding-runs.companion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,kCAAkC,EAAE,MAAM,2CAA2C,CAAC;AAG/F,OAAO,EAAE,6BAA6B,EAAE,MAAM,gFAAgF,CAAC;AAU/H;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,UAA4E,EAC5E,cAAiD;IAEjD,MAAM,IAAI,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACzG,UAAU,CAAC,mBAAmB,CAAC,kCAAkC,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,6BAA6B,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACvK,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACtB,MAAM,SAAS,GAAG,GAAqH,CAAC;QACxI,MAAM,KAAK,GAAG,SAAS,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC;QACpD,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAQ,KAA+B,CAAC,OAAO,KAAK,QAAQ;YACzH,CAAC,CAAE,KAA6B,CAAC,OAAO;YACxC,CAAC,CAAC,IAAI,CAAC;QACT,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC;YAClC,OAAO;YACP,GAAG,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,SAAS,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvF,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnE,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { FlowsActors_Status } from '@wildo-ai/saas-models';\n\nimport { CompanionExecutionsListQuerySchema } from '../../companion-api/companion-api.schemas';\nimport type { CompanionExecutionSessionContext } from '../../core/traceability/companion-traceability.models';\nimport type { CompanionExecutionsCompanionService } from '../../executions/services/companion-executions.companion.service';\nimport { APPLICATION_CODING_SYSTEM_REF } from '../../meta-workflows/models/application-coding-agent.actors-system.definitions';\n\n/** One live coding run, as the actor plane records it. */\nexport interface InFlightCodingRun {\n readonly executionId: string;\n readonly taskRef: string | null;\n readonly exclusiveSubject?: string;\n readonly createdAt?: string;\n}\n\n/**\n * The live coding runs — selected, admitted or running — read from the actor plane, so the answer holds\n * across processes and restarts (#1528). A parked run is not live: its agent is closed.\n *\n * A function over the executions service rather than a method of the dispatch service, because the\n * ACCEPT service needs the same answer (a person's accept must not commit while a worker writes the tree)\n * and the dispatch service already depends on the accept service: reading it from there would be a cycle.\n * One reader, so the dispatch's own \"is anything running\" and the accept guard cannot disagree.\n */\nexport async function listInFlightCodingRuns(\n executions: Pick<CompanionExecutionsCompanionService, 'listActorExecutions'>,\n sessionContext?: CompanionExecutionSessionContext,\n): Promise<InFlightCodingRun[]> {\n const rows = (await Promise.all([FlowsActors_Status.PENDING, FlowsActors_Status.PROCESSING].map((status) =>\n executions.listActorExecutions(CompanionExecutionsListQuerySchema.parse({ systemRef: APPLICATION_CODING_SYSTEM_REF, status, limit: 200 }), sessionContext)))).flat();\n return rows.map((row) => {\n const execution = row as { _id?: unknown; exclusiveSubject?: string; createdAt?: string; standaloneTasks?: Array<{ input?: unknown }> };\n const input = execution.standaloneTasks?.[0]?.input;\n const taskRef = typeof input === 'object' && input !== null && typeof (input as { taskRef?: unknown }).taskRef === 'string'\n ? (input as { taskRef: string }).taskRef\n : null;\n return {\n executionId: String(execution._id),\n taskRef,\n ...(execution.exclusiveSubject ? { exclusiveSubject: execution.exclusiveSubject } : {}),\n ...(execution.createdAt ? { createdAt: execution.createdAt } : {}),\n };\n });\n}\n"]}
@@ -58,6 +58,11 @@ export interface ResearchTaskRequest {
58
58
  * operator's ad-hoc question, which lands under `adhoc`.
59
59
  */
60
60
  readonly evidenceScope?: string;
61
+ /**
62
+ * A scope this task READS but never writes (#1609): the default instance's store when an instance
63
+ * researches, so application-wide facts are pooled while the instance's own findings stay its own.
64
+ */
65
+ readonly sharedEvidenceScope?: string;
61
66
  /** The playbook that asked, recorded in the persisted evidence frontmatter. */
62
67
  readonly playbookRef?: string;
63
68
  }
@@ -113,6 +118,11 @@ export declare class ResearchAgentDispatchCompanionService {
113
118
  private readonly companionContext;
114
119
  private readonly traceabilityService;
115
120
  private readonly logDebug;
121
+ /** Research tasks in flight in this process; several run at once in a breadth-first fan-out. */
122
+ private researchTasksInFlight;
123
+ /** The {@link RESEARCH_RUN_HEARTBEAT_RELATIVE_PATH} beat; built on first use (`Object.create` harnesses skip initializers). */
124
+ private researchRunHeartbeat;
125
+ private syncResearchRunHeartbeat;
116
126
  constructor(logger: LoggerService, errorBuilder: ErrorBuilderBackendService, agentsService: AgentsBackendService, companionContext: CompanionContext, traceabilityService: CompanionTraceabilityService);
117
127
  /**
118
128
  * Run one research objective and return what the agent found.
@@ -144,5 +154,6 @@ export declare class ResearchAgentDispatchCompanionService {
144
154
  * precisely so the join is a single named place rather than a convention.
145
155
  */
146
156
  runResearchTask(request: ResearchTaskRequest): Promise<ResearchTaskResult>;
157
+ private runResearchTaskCounted;
147
158
  }
148
159
  //# sourceMappingURL=research-agent-dispatch.companion.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"research-agent-dispatch.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/claude-cli/services/research-agent-dispatch.companion.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAIH,OAAO,EACL,0BAA0B,EAC1B,aAAa,EAEb,KAAK,oBAAoB,EAAuB,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAIL,sBAAsB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACvB,MAAM,sCAAsC,CAAC;AAI9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAG7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AAStG,wGAAwG;AACxG,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM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;;;;;;;OA4BG;IACU,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAiLxF"}
1
+ {"version":3,"file":"research-agent-dispatch.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/claude-cli/services/research-agent-dispatch.companion.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAKH,OAAO,EACL,0BAA0B,EAC1B,aAAa,EAEb,KAAK,oBAAoB,EAAuB,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAIL,sBAAsB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACvB,MAAM,sCAAsC,CAAC;AAI9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAK7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AAStG,wGAAwG;AACxG,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,+EAA+E;IAC/E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,sBAAsB,CAAC;IAC5C,QAAQ,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAC;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,yBAAyB,CAAC,qBAAqB,CAAC,CAAC;IAChF;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,EAAE,SAAS,MAAM,EAAE,CAAC;IAClD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,+FAA+F;IAC/F,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;CACxC;AAED,iIAAiI;AACjI,qBAAa,6BAA8B,SAAQ,KAAK;CAAG;AAE3D;;;;;;;;;;GAUG;AACH,oBAAY,kBAAkB;IAC5B,wGAAwG;IACxG,cAAc,4BAA4B;IAC1C,mGAAmG;IACnG,aAAa,2BAA2B;IACxC,8FAA8F;IAC9F,WAAW,yBAAyB;CACrC;AAuBD,qBACa,qCAAqC;IAsBX,OAAO,CAAC,QAAQ,CAAC,MAAM;IACV,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC5B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC7B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAC9B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IAzB3F,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+D;IAExF,gGAAgG;IAChG,OAAO,CAAC,qBAAqB,CAAK;IAElC,+HAA+H;IAC/H,OAAO,CAAC,oBAAoB,CAAoC;IAEhE,OAAO,CAAC,wBAAwB;gBAasB,MAAM,EAAE,aAAa,EACR,YAAY,EAAE,0BAA0B,EACvC,aAAa,EAAE,oBAAoB,EAClC,gBAAgB,EAAE,gBAAgB,EAC/B,mBAAmB,EAAE,4BAA4B;IAMzH;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACU,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAWzE,sBAAsB;CA6LrC"}
@@ -50,12 +50,15 @@ var __metadata = (this && this.__metadata) || function (k, v) {
50
50
  var __param = (this && this.__param) || function (paramIndex, decorator) {
51
51
  return function (target, key) { decorator(target, key, paramIndex); }
52
52
  };
53
+ import path from 'node:path';
53
54
  import { CodingSessionFrameRetention } from '../models/coding-session-frame-retention.js';
54
55
  import { inject, injectable } from 'inversify';
55
56
  import { ErrorBuilderBackendService, LoggerService, SAAS_SERVICE_TYPES, describeCaughtError } from '@wildo-ai/saas-backend-lib';
56
57
  import { CodingAgent_StopReason, } from '@wildo-ai/external-connectors-models';
57
58
  import { ErrorCustomMessageReference, ErrorType } from '@wildo-ai/saas-models';
58
59
  import { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types.js';
60
+ import { InFlightWorkHeartbeat } from '../../core/runtime/in-flight-work-heartbeat.companion.js';
61
+ import { join } from 'node:path';
59
62
  import { APPLICATION_RESEARCH_AGENT_REF } from '../../meta-workflows/models/application-research-agent.actors-system.definitions.js';
60
63
  import { CompanionTraceabilityLevel } from '../../core/traceability/companion-traceability.models.js';
61
64
  import { CompanionTraceabilityService } from '../../core/traceability/companion-traceability.service.js';
@@ -84,6 +87,25 @@ export var ResearchTraceEvent;
84
87
  /** The turn was cancelled or threw. Whatever reached the evidence store stands on its own. */
85
88
  ResearchTraceEvent["TASK_FAILED"] = "research.task-failed";
86
89
  })(ResearchTraceEvent || (ResearchTraceEvent = {}));
90
+ /**
91
+ * Where this process says "a research agent is running", app-root-relative. Beaten while any research
92
+ * task is in flight and removed when none is.
93
+ *
94
+ * A research agent is an ACP subprocess of the companion like a coding agent, so a supervisor restart
95
+ * kills it the same way — and it holds no workspace-mutation lock (deliberately; see
96
+ * `runResearchTask`) and is not in the coding lane's active-run set. Inside a playbook run the
97
+ * playbook-run heartbeat covered it; an operator's `POST /api/companion/research` or the creation
98
+ * conversation's research tool had nothing, found while closing the same gap for concurrent coding
99
+ * runs (2026-09-27). Its own file rather than the coding lane's, because two owners of one file would
100
+ * let one remove it while the other still runs.
101
+ *
102
+ * A COPY of `RESEARCH_RUN_HEARTBEAT_RELATIVE_PATH` in
103
+ * `scripts/dev-orchestrator/runtime-supervisor-lifecycle.mjs`, pinned equal by
104
+ * `scripts/__tests__/runtime-supervisor-workspace-mutation-hold.test.mjs`.
105
+ */
106
+ const RESEARCH_RUN_HEARTBEAT_RELATIVE_PATH = '.wildo-saas/state/research-run.heartbeat';
107
+ /** How often that file's mtime is refreshed; the supervisor judges it stale at three times this (`AGENT_RUN_HEARTBEAT_STALE_MS`). */
108
+ const RESEARCH_RUN_HEARTBEAT_INTERVAL_MS = 5_000;
87
109
  let ResearchAgentDispatchCompanionService = class ResearchAgentDispatchCompanionService {
88
110
  logger;
89
111
  errorBuilder;
@@ -91,6 +113,18 @@ let ResearchAgentDispatchCompanionService = class ResearchAgentDispatchCompanion
91
113
  companionContext;
92
114
  traceabilityService;
93
115
  logDebug;
116
+ /** Research tasks in flight in this process; several run at once in a breadth-first fan-out. */
117
+ researchTasksInFlight = 0;
118
+ /** The {@link RESEARCH_RUN_HEARTBEAT_RELATIVE_PATH} beat; built on first use (`Object.create` harnesses skip initializers). */
119
+ researchRunHeartbeat;
120
+ syncResearchRunHeartbeat() {
121
+ // No application root, nowhere to beat — a harness, never a running companion.
122
+ const saasRoot = this.companionContext?.saasRoot;
123
+ if (typeof saasRoot !== 'string')
124
+ return;
125
+ this.researchRunHeartbeat ??= new InFlightWorkHeartbeat(join(saasRoot, RESEARCH_RUN_HEARTBEAT_RELATIVE_PATH), RESEARCH_RUN_HEARTBEAT_INTERVAL_MS, (message, error) => this.logDebug?.(message, { error: String(error) }));
126
+ this.researchRunHeartbeat.sync((this.researchTasksInFlight ?? 0) > 0);
127
+ }
94
128
  constructor(logger, errorBuilder, agentsService, companionContext, traceabilityService) {
95
129
  this.logger = logger;
96
130
  this.errorBuilder = errorBuilder;
@@ -130,6 +164,17 @@ let ResearchAgentDispatchCompanionService = class ResearchAgentDispatchCompanion
130
164
  * precisely so the join is a single named place rather than a convention.
131
165
  */
132
166
  async runResearchTask(request) {
167
+ this.researchTasksInFlight = (this.researchTasksInFlight ?? 0) + 1;
168
+ this.syncResearchRunHeartbeat();
169
+ try {
170
+ return await this.runResearchTaskCounted(request);
171
+ }
172
+ finally {
173
+ this.researchTasksInFlight = Math.max(0, (this.researchTasksInFlight ?? 1) - 1);
174
+ this.syncResearchRunHeartbeat();
175
+ }
176
+ }
177
+ async runResearchTaskCounted(request) {
133
178
  const objective = request.objective.trim();
134
179
  if (objective.length === 0) {
135
180
  throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {
@@ -142,7 +187,10 @@ let ResearchAgentDispatchCompanionService = class ResearchAgentDispatchCompanion
142
187
  + 'a companion started before it existed needs a restart.');
143
188
  }
144
189
  const evidenceDirectory = resolveResearchEvidenceDirectory(this.companionContext.saasRoot, request.evidenceScope ?? 'adhoc');
145
- const promptWithStore = [objective, '', composeEvidenceStoreInstruction(evidenceDirectory)].join('\n');
190
+ const sharedEvidenceDirectory = request.sharedEvidenceScope !== undefined && request.sharedEvidenceScope !== request.evidenceScope
191
+ ? resolveResearchEvidenceDirectory(this.companionContext.saasRoot, request.sharedEvidenceScope)
192
+ : undefined;
193
+ const promptWithStore = [objective, '', composeEvidenceStoreInstruction(evidenceDirectory, sharedEvidenceDirectory)].join('\n');
146
194
  const invocation = {
147
195
  agentRef: APPLICATION_RESEARCH_AGENT_REF,
148
196
  initiator: {},
@@ -196,6 +244,11 @@ let ResearchAgentDispatchCompanionService = class ResearchAgentDispatchCompanion
196
244
  await traceEvent(ResearchTraceEvent.TASK_REQUESTED, request.playbookRef ? `Research for ${request.playbookRef}` : 'Research task', { ...(request.playbookRef ? { playbookRef: request.playbookRef } : {}), evidenceScope: request.evidenceScope ?? 'adhoc', objectiveLength: objective.length });
197
245
  await traceArtifact('research-objective.md', promptWithStore);
198
246
  const isPermittedEvidenceLocation = buildApplicationCodingTaskLocationPredicate(this.companionContext.saasRoot, [RESEARCH_EVIDENCE_RELATIVE_ROOT], []);
247
+ /*
248
+ * Writes go to THIS task's scope only (#1609): an instance's findings are its own, and the store it reads
249
+ * from the application as a whole is never written by an instance. Reading stays open across the store.
250
+ */
251
+ const isPermittedOwnScopeLocation = buildApplicationCodingTaskLocationPredicate(this.companionContext.saasRoot, [path.relative(this.companionContext.saasRoot, evidenceDirectory)], []);
199
252
  const response = await this.agentsService.invokeAgent(invocation, undefined, {
200
253
  workspaceRootPath: this.companionContext.saasRoot,
201
254
  /* What the agent FETCHED, retained for the record; bounded, and never able to fail the turn. */
@@ -204,15 +257,15 @@ let ResearchAgentDispatchCompanionService = class ResearchAgentDispatchCompanion
204
257
  frameRetention.accept(event);
205
258
  },
206
259
  /*
207
- * ONE writable island: the evidence store. The predicate is the SAME builder the coding lane
208
- * trusts (symlink-aware, boundary-matched), scoped to `specifications/research-evidence/` and
209
- * nothing else — so the agent can consolidate findings to disk as it researches (evidence
210
- * that survives an interrupted turn) and read prior rounds' files, while the rest of the
211
- * workspace stays refused. A web fetch declares no location and is unaffected. This replaced
260
+ * ONE writable island: this task's OWN scope directory of the evidence store, and reads across the
261
+ * whole store (`specifications/research-evidence/`). Both predicates are the SAME builder the coding
262
+ * lane trusts (symlink-aware, boundary-matched), so the agent can consolidate findings to disk as it
263
+ * researches (evidence that survives an interrupted turn) and read prior rounds' files and the
264
+ * application-wide store an instance shares (#1609), while the rest of the workspace stays refused. A web fetch declares no location and is unaffected. This replaced
212
265
  * the original refuse-every-path predicate on 2026-09-04, when three lost compliance runs
213
266
  * showed that evidence living only in run memory cannot be leveraged or recovered.
214
267
  */
215
- isPermittedCodingLocation: isPermittedEvidenceLocation,
268
+ isPermittedCodingLocation: isPermittedOwnScopeLocation,
216
269
  isPermittedCodingReadLocation: isPermittedEvidenceLocation,
217
270
  });
218
271
  const output = response.output;
@@ -1 +1 @@
1
- {"version":3,"file":"research-agent-dispatch.companion.service.js","sourceRoot":"","sources":["../../../../../src/claude-cli/services/research-agent-dispatch.companion.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;;;;;;;;;;;;;AAEH,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAC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qB;SACtB,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AA5NY,qCAAqC;IADjD,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAC9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAA;IAC/C,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;IAChD,WAAA,MAAM,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,CAAA;qCAJQ,aAAa;QACM,0BAA0B,oBAGd,4BAA4B;GAR9G,qCAAqC,CA4NjD","sourcesContent":["/**\n * Research dispatch — the evidence half of the ACP lane. Read-only toward the workspace, except\n * for its own evidence store.\n *\n * ## Why this is a SECOND WRAPPER and not a mode on the coding one\n *\n * The generic session runner (`runACPCodingSession`, engine) is already task-agnostic: command, cwd,\n * prompt, permission ceiling, a location predicate, an event sink. Everything that makes the coding\n * dispatch a CODING dispatch — the typed task contract, the git change-set capture, the mutation\n * scope, the single-flight lock — sits in that wrapper, and none of it applies to a run that mutates\n * nothing and returns text. So research is a sibling over the same runner rather than a branch\n * inside a service whose every other line is about attributing writes.\n *\n * ## The confinement, and it is TWO independent things\n *\n * 1. The `claude-code-acp-research` profile's `AUTO_ACCEPT_READS_AND_EDITS` ceiling admits the\n * protocol's non-mutating tool kinds (`read`, `search`, `fetch`, `think`) plus `edit`, and\n * nothing else: never `execute`, never the unclassified `other`. The ceilings are kind-SETS,\n * not nested ranks, so read the name carefully: `AUTO_ACCEPT_EDITS` admits ONLY the mutating\n * kinds and is precisely the inverse of what research needs. (The profile was `AUTO_ACCEPT_READS` until three lost\n * compliance runs showed evidence living only in run memory cannot be leveraged or recovered;\n * the edit admission exists solely so findings persist as they are gathered, and the first\n * attempt at it named `AUTO_ACCEPT_EDITS` and cost two rounds of a live run with every web\n * fetch refused.)\n * 2. This dispatch supplies a location predicate that admits ONLY the evidence store\n * (`specifications/research-evidence/`) and refuses every other path — built by the same\n * `buildApplicationCodingTaskLocationPredicate` the coding lane trusts. The runner applies it to\n * any permission request declaring locations, whatever its kind, and separately gates the\n * client-side read and write RPCs. So a web read (which declares no location) passes, an evidence-store\n * write passes, and any other filesystem read or write does not.\n *\n * Neither alone is the guarantee. The ceiling stops the kinds; the predicate stops the paths.\n *\n * ## Measured before it was built (2026-08-29)\n *\n * Under `PROMPT_ALWAYS` with every location refused, a live probe asking a public-web pricing\n * question had both `WebFetch` and `WebSearch` arrive as `toolKind: 'fetch'` and be refused; the\n * agent ended its turn declining to guess from memory. Re-run under `AUTO_ACCEPT_READS`, the same\n * probe fetched the page and returned the figure with its source URL, `reportedFileLocations: []`.\n */\n\nimport { CodingSessionFrameRetention } from '../models/coding-session-frame-retention';\nimport { inject, injectable } from 'inversify';\nimport {\n ErrorBuilderBackendService,\n LoggerService,\n SAAS_SERVICE_TYPES,\n type AgentsBackendService, describeCaughtError } from '@wildo-ai/saas-backend-lib';\nimport {\n CodingAgent_OperationContext_BaseSchema,\n CodingAgent_RunTaskInputSchema,\n CodingAgent_RunTaskOutputSchema,\n CodingAgent_StopReason,\n type CodingAgent_RunTaskOutput,\n type CodingAgent_Usage,\n} from '@wildo-ai/external-connectors-models';\nimport { ErrorCustomMessageReference, ErrorType, type FlowsActors_Agent_Invocation } from '@wildo-ai/saas-models';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { APPLICATION_RESEARCH_AGENT_REF } from '../../meta-workflows/models/application-research-agent.actors-system.definitions';\nimport { CompanionTraceabilityLevel, type CompanionExecutionSessionContext } from '../../core/traceability/companion-traceability.models';\nimport { CompanionTraceabilityService } from '../../core/traceability/companion-traceability.service';\nimport { buildApplicationCodingTaskLocationPredicate } from './coding-agent-dispatch.companion.service';\nimport {\n RESEARCH_EVIDENCE_RELATIVE_ROOT,\n composeEvidenceStoreInstruction,\n resolveResearchEvidenceDirectory,\n writeFinalEvidenceRecord,\n} from './research-evidence-store.companion';\n\n/** One research objective, composed by whatever is asking — a playbook, a choreography, an operator. */\nexport interface ResearchTaskRequest {\n /**\n * What to find out, in the requester's own words.\n *\n * Deliberately free text rather than a structured query: the objective is INVENTED per run and\n * adapted to what an earlier round found, which is the whole reason a research step is an agent\n * and not a search API. Code gates the KIND of work and its bounds; it never gates the content.\n */\n readonly objective: string;\n /**\n * Which investigation this task belongs to — normally the composite playbook ref. Names the\n * evidence-store directory every round of that investigation consolidates into. Absent for an\n * operator's ad-hoc question, which lands under `adhoc`.\n */\n readonly evidenceScope?: string;\n /** The playbook that asked, recorded in the persisted evidence frontmatter. */\n readonly playbookRef?: string;\n}\n\nexport interface ResearchTaskResult {\n /** The agent's final message — the evidence, in prose, with the sources it says it read. */\n readonly evidence: string;\n readonly stopReason: CodingAgent_StopReason;\n readonly usage?: CodingAgent_Usage;\n /**\n * Permission requests and client callback policy refusals, with their reasons.\n *\n * Carried because a research answer that looks thin has two very different causes — the agent\n * found little, or the ceiling refused the tool it needed — and they are indistinguishable from\n * the prose alone.\n */\n readonly deniedPermissionCount?: number;\n readonly permissionDecisions?: CodingAgent_RunTaskOutput['permissionDecisions'];\n /**\n * Paths reported by the adapter, copied without an independent filesystem audit or per-entry\n * validation. They describe its account of activity, not proof of authorship or evidence-store confinement.\n */\n readonly reportedFileLocations: readonly string[];\n readonly elapsedMs: number;\n /** Path returned by a successful backstop write; empty when best-effort persistence failed. */\n readonly persistedEvidencePath: string;\n}\n\n/** The research agent is not registered, or the profile it names is absent. Named so a transport answers 409 rather than 500. */\nexport class ResearchAgentUnavailableError extends Error {}\n\n/**\n * What one research task RECORDS, so it can be read after it ran (#1328).\n *\n * The lane recorded nothing until then — no row, no trace, no frames — only a debug log line and the\n * evidence file. \"What was fetched, what answered, what was refused\" could not be answered for any\n * research run that had ever happened, and three lost compliance runs (2026-09-04) were reconstructed\n * from the evidence store alone. Each task now writes ONE trace session of its own, which the\n * creation board lists on its timeline and draws as a conversation like any other trace.\n *\n * A closed vocabulary, because the board TONES an event by its type.\n */\nexport enum ResearchTraceEvent {\n /** The objective was handed to the research agent. The prompt is the step's `research-objective.md`. */\n TASK_REQUESTED = 'research.task-requested',\n /** The agent answered: stop reason, evidence size, how many fetches, every permission decision. */\n TASK_ANSWERED = 'research.task-answered',\n /** The turn was cancelled or threw. Whatever reached the evidence store stands on its own. */\n TASK_FAILED = 'research.task-failed',\n}\n\n@injectable()\nexport class ResearchAgentDispatchCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) private readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.AgentsBackendService) private readonly agentsService: AgentsBackendService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.TraceabilityService) private readonly traceabilityService: CompanionTraceabilityService,\n ) {\n this.logDebug = this.logger.debugByType('ResearchAgentDispatchCompanionService');\n this.logger.setDebugTypeLogging('ResearchAgentDispatchCompanionService', true);\n }\n\n /**\n * Run one research objective and return what the agent found.\n *\n * No lock, no change set, no reconciliation — a run that cannot mutate has nothing to attribute and\n * nothing to recover. Several research lanes may therefore run concurrently, which is what makes a\n * breadth-first fan-out possible at all.\n *\n * ## \"Cannot mutate\" is one island short, and the coding lane is where that was paid for\n *\n * This run CAN write, to exactly one place: its evidence store\n * (`specifications/research-evidence/`, admitted by the location predicate below). That store is\n * inside the application repository and is COMMITTABLE, so it is fully visible to the coding lane's\n * whole-worktree change-set capture — and a research turn overlapping a coding run therefore\n * appeared in that run's change set, at a path no coding task declares, i.e. as a false\n * `MUTATION_SCOPE_VIOLATION` that failed the coding run closed. Two live paths reach that overlap:\n * an operator's `POST /api/companion/research`, and a composite's `RESEARCH_AGENT` children, which\n * the choreography dispatches concurrently.\n *\n * The fix is on the coding side, where the misattribution happens —\n * `CONCURRENT_HOST_LANE_ROOTS` in `git-change-set.companion.service.ts` names this store as\n * lane-owned, so its writes are RECORDED in the change set and excluded from the scope decision.\n * Taking the workspace-mutation lock here was rejected and measured: that lock is acquired with\n * `retries: { retries: 0 }`, so it refuses rather than queues, and it would refuse two of every\n * three lanes of the fan-out this JSDoc exists to protect.\n *\n * So if this lane ever grows a SECOND writable island, the coding lane's list has to grow with it\n * in the same change. Nothing mechanical joins them — the predicate is one exported function\n * precisely so the join is a single named place rather than a convention.\n */\n public async runResearchTask(request: ResearchTaskRequest): Promise<ResearchTaskResult> {\n const objective = request.objective.trim();\n if (objective.length === 0) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: { message: 'A research task needs an objective; an empty one would spend a turn to learn nothing.' },\n });\n }\n if (this.agentsService.getAgent(APPLICATION_RESEARCH_AGENT_REF) === undefined) {\n throw new ResearchAgentUnavailableError(\n `The research agent \"${APPLICATION_RESEARCH_AGENT_REF}\" is not registered. It is registered at companion startup; `\n + 'a companion started before it existed needs a restart.',\n );\n }\n\n const evidenceDirectory = resolveResearchEvidenceDirectory(this.companionContext.saasRoot, request.evidenceScope ?? 'adhoc');\n const promptWithStore = [objective, '', composeEvidenceStoreInstruction(evidenceDirectory)].join('\\n');\n\n const invocation: FlowsActors_Agent_Invocation<\n typeof CodingAgent_RunTaskInputSchema,\n typeof CodingAgent_RunTaskOutputSchema,\n typeof CodingAgent_OperationContext_BaseSchema\n > = {\n agentRef: APPLICATION_RESEARCH_AGENT_REF,\n initiator: {},\n invocationContext: [],\n input: { prompt: promptWithStore },\n output: { finalMessage: '', stopReason: CodingAgent_StopReason.END_TURN },\n executionContext: { callTimestamp: new Date().toISOString() },\n artifactBindings: [],\n };\n\n const startedAtMs = Date.now();\n const startedAtIso = new Date(startedAtMs).toISOString();\n this.logDebug('Research task starting', { objectiveLength: objective.length, evidenceScope: request.evidenceScope });\n\n /*\n * The RECORD of this task (see `ResearchTraceEvent`). Best-effort from end to end: a trace is\n * evidence beside the research, and a sink that fails must never be why a research turn did.\n */\n let traceSession: CompanionExecutionSessionContext | undefined;\n let traceStep: ReturnType<CompanionTraceabilityService['createStep']> | undefined;\n const trace = async (write: () => Promise<void>): Promise<void> => {\n try { await write(); } catch (traceError) {\n this.logDebug('Research trace write failed; the research itself is unaffected', { failure: describeCaughtError(traceError) });\n }\n };\n const traceEvent = (type: ResearchTraceEvent, summary: string, payload: Record<string, unknown>): Promise<void> => trace(async () => {\n if (!traceSession) return;\n await this.traceabilityService.traceEvent({ session: traceSession, minimumLevel: CompanionTraceabilityLevel.DEBUG, type, summary, payload, ...(traceStep ? { step: traceStep } : {}) });\n });\n const traceArtifact = (fileName: string, content: unknown): Promise<void> => trace(async () => {\n if (!traceSession) return;\n await this.traceabilityService.writeArtifact({ session: traceSession, minimumLevel: CompanionTraceabilityLevel.DEBUG_VERBOSE, fileName, content, ...(traceStep ? { step: traceStep } : {}) });\n });\n await trace(async () => {\n traceSession = this.traceabilityService.createInternalSession({\n label: 'application-research-task',\n metadata: { ...(request.playbookRef ? { playbookRef: request.playbookRef } : {}), evidenceScope: request.evidenceScope ?? 'adhoc' },\n });\n if (traceSession) traceStep = this.traceabilityService.createStep(traceSession, { kind: 'research-agent-dispatch', label: 'application-research-task' });\n });\n /*\n * What the agent FETCHED and read, bounded the coding lane's way (one entry per call, head and\n * tail of a long run). Passages stay out: here the agent's messages ARE the evidence, stored as such.\n */\n const frameRetention = new CodingSessionFrameRetention({ retainPassages: false });\n let sessionEventCount = 0;\n await traceEvent(\n ResearchTraceEvent.TASK_REQUESTED,\n request.playbookRef ? `Research for ${request.playbookRef}` : 'Research task',\n { ...(request.playbookRef ? { playbookRef: request.playbookRef } : {}), evidenceScope: request.evidenceScope ?? 'adhoc', objectiveLength: objective.length },\n );\n await traceArtifact('research-objective.md', promptWithStore);\n\n const isPermittedEvidenceLocation = buildApplicationCodingTaskLocationPredicate(\n this.companionContext.saasRoot,\n [RESEARCH_EVIDENCE_RELATIVE_ROOT],\n [],\n );\n const response = await this.agentsService.invokeAgent(invocation, undefined, {\n workspaceRootPath: this.companionContext.saasRoot,\n /* What the agent FETCHED, retained for the record; bounded, and never able to fail the turn. */\n onCodingSessionEvent: (event) => {\n sessionEventCount += 1;\n frameRetention.accept(event);\n },\n /*\n * ONE writable island: the evidence store. The predicate is the SAME builder the coding lane\n * trusts (symlink-aware, boundary-matched), scoped to `specifications/research-evidence/` and\n * nothing else — so the agent can consolidate findings to disk as it researches (evidence\n * that survives an interrupted turn) and read prior rounds' files, while the rest of the\n * workspace stays refused. A web fetch declares no location and is unaffected. This replaced\n * the original refuse-every-path predicate on 2026-09-04, when three lost compliance runs\n * showed that evidence living only in run memory cannot be leveraged or recovered.\n */\n isPermittedCodingLocation: isPermittedEvidenceLocation,\n isPermittedCodingReadLocation: isPermittedEvidenceLocation,\n });\n\n const output = response.output as Partial<CodingAgent_RunTaskOutput> | undefined;\n const evidence = typeof output?.finalMessage === 'string' ? output.finalMessage : '';\n const stopReason = output?.stopReason ?? CodingAgent_StopReason.UNRECOGNISED;\n const elapsedMs = Date.now() - startedAtMs;\n\n /*\n * A CANCELLED turn is not a completed one and its partial prose is not evidence — the same\n * refusal the coding lane makes, for the same reason: a truncated answer reads exactly like a\n * short one. Checked BEFORE the backstop write, so a cancelled turn's partial FINAL MESSAGE is\n * never persisted as a completed record — whatever the agent already consolidated to the store\n * during the turn stands on its own, file by file, and is exactly what incremental persistence\n * is for.\n */\n if (stopReason === CodingAgent_StopReason.CANCELLED) {\n await traceEvent(ResearchTraceEvent.TASK_FAILED, 'Research task was cancelled', { stopReason, elapsedMs, sessionEventCount });\n if (frameRetention.frames().length > 0) await traceArtifact('research-frames.json', frameRetention.frames());\n throw new Error(`Research task was cancelled after ${elapsedMs}ms; its partial answer is not evidence.`);\n }\n\n // The companion-side backstop: the completed brief lands on disk with its provenance even when\n // the agent consolidated nothing itself. Best-effort by construction — a store write failing\n // must not turn a completed research turn into a failed one.\n let persistedEvidencePath = '';\n try {\n persistedEvidencePath = writeFinalEvidenceRecord({\n evidenceDirectoryAbsolutePath: evidenceDirectory,\n objective,\n evidence,\n stopReason,\n startedAtIso,\n elapsedMs,\n ...(request.playbookRef ? { playbookRef: request.playbookRef } : {}),\n });\n } catch (persistError) {\n this.logger.warn('Research evidence backstop write failed; the returned brief is the only copy', {\n evidenceDirectory,\n failure: describeCaughtError(persistError),\n });\n }\n\n const result: ResearchTaskResult = {\n evidence,\n stopReason,\n ...(((response.executionContext as { usage?: CodingAgent_Usage } | undefined)?.usage)\n ? { usage: (response.executionContext as { usage?: CodingAgent_Usage }).usage }\n : {}),\n ...(output?.deniedPermissionCount !== undefined ? { deniedPermissionCount: output.deniedPermissionCount } : {}),\n ...(output?.permissionDecisions !== undefined ? { permissionDecisions: output.permissionDecisions } : {}),\n reportedFileLocations: output?.reportedFileLocations ?? [],\n elapsedMs,\n persistedEvidencePath,\n };\n await traceEvent(ResearchTraceEvent.TASK_ANSWERED, `Research answered (${stopReason})`, {\n stopReason,\n elapsedMs,\n evidenceLength: evidence.length,\n sessionEventCount,\n /* A fetch is a tool call; updates to one call carry its id, so distinct ids are distinct fetches. */\n // Counted over every frame: read off the retained ones it stopped at the bound.\n fetchCount: frameRetention.toolCallCount,\n ...(output?.deniedPermissionCount !== undefined ? { deniedPermissionCount: output.deniedPermissionCount } : {}),\n ...(output?.permissionDecisions !== undefined ? { permissionDecisions: output.permissionDecisions } : {}),\n ...(persistedEvidencePath ? { persistedEvidencePath } : {}),\n });\n await traceArtifact('research-evidence.md', evidence);\n if (frameRetention.frames().length > 0) await traceArtifact('research-frames.json', frameRetention.frames());\n\n this.logDebug('Research task finished', {\n stopReason,\n elapsedMs,\n evidenceLength: evidence.length,\n deniedPermissionCount: result.deniedPermissionCount,\n reportedFileLocations: result.reportedFileLocations.length,\n persistedEvidencePath,\n });\n return result;\n }\n}\n"]}
1
+ {"version":3,"file":"research-agent-dispatch.companion.service.js","sourceRoot":"","sources":["../../../../../src/claude-cli/services/research-agent-dispatch.companion.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;;;;;;;;;;;;;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,kBAAkB,EACS,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAIL,sBAAsB,GAGvB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,SAAS,EAAqC,MAAM,uBAAuB,CAAC;AAElH,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uDAAuD,CAAC;AAC9F,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,8BAA8B,EAAE,MAAM,kFAAkF,CAAC;AAClI,OAAO,EAAE,0BAA0B,EAAyC,MAAM,uDAAuD,CAAC;AAC1I,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AACtG,OAAO,EAAE,2CAA2C,EAAE,MAAM,2CAA2C,CAAC;AACxG,OAAO,EACL,+BAA+B,EAC/B,+BAA+B,EAC/B,gCAAgC,EAChC,wBAAwB,GACzB,MAAM,qCAAqC,CAAC;AAmD7C,iIAAiI;AACjI,MAAM,OAAO,6BAA8B,SAAQ,KAAK;CAAG;AAE3D;;;;;;;;;;GAUG;AACH,MAAM,CAAN,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC5B,wGAAwG;IACxG,gEAA0C,CA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AA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;IAChD,WAAA,MAAM,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,CAAA;qCAJQ,aAAa;QACM,0BAA0B,oBAGd,4BAA4B;GA1B9G,qCAAqC,CAqQjD","sourcesContent":["/**\n * Research dispatch — the evidence half of the ACP lane. Read-only toward the workspace, except\n * for its own evidence store.\n *\n * ## Why this is a SECOND WRAPPER and not a mode on the coding one\n *\n * The generic session runner (`runACPCodingSession`, engine) is already task-agnostic: command, cwd,\n * prompt, permission ceiling, a location predicate, an event sink. Everything that makes the coding\n * dispatch a CODING dispatch — the typed task contract, the git change-set capture, the mutation\n * scope, the single-flight lock — sits in that wrapper, and none of it applies to a run that mutates\n * nothing and returns text. So research is a sibling over the same runner rather than a branch\n * inside a service whose every other line is about attributing writes.\n *\n * ## The confinement, and it is TWO independent things\n *\n * 1. The `claude-code-acp-research` profile's `AUTO_ACCEPT_READS_AND_EDITS` ceiling admits the\n * protocol's non-mutating tool kinds (`read`, `search`, `fetch`, `think`) plus `edit`, and\n * nothing else: never `execute`, never the unclassified `other`. The ceilings are kind-SETS,\n * not nested ranks, so read the name carefully: `AUTO_ACCEPT_EDITS` admits ONLY the mutating\n * kinds and is precisely the inverse of what research needs. (The profile was `AUTO_ACCEPT_READS` until three lost\n * compliance runs showed evidence living only in run memory cannot be leveraged or recovered;\n * the edit admission exists solely so findings persist as they are gathered, and the first\n * attempt at it named `AUTO_ACCEPT_EDITS` and cost two rounds of a live run with every web\n * fetch refused.)\n * 2. This dispatch supplies a location predicate that admits ONLY the evidence store\n * (`specifications/research-evidence/`) and refuses every other path — built by the same\n * `buildApplicationCodingTaskLocationPredicate` the coding lane trusts. The runner applies it to\n * any permission request declaring locations, whatever its kind, and separately gates the\n * client-side read and write RPCs. So a web read (which declares no location) passes, an evidence-store\n * write passes, and any other filesystem read or write does not.\n *\n * Neither alone is the guarantee. The ceiling stops the kinds; the predicate stops the paths.\n *\n * ## Measured before it was built (2026-08-29)\n *\n * Under `PROMPT_ALWAYS` with every location refused, a live probe asking a public-web pricing\n * question had both `WebFetch` and `WebSearch` arrive as `toolKind: 'fetch'` and be refused; the\n * agent ended its turn declining to guess from memory. Re-run under `AUTO_ACCEPT_READS`, the same\n * probe fetched the page and returned the figure with its source URL, `reportedFileLocations: []`.\n */\n\nimport path from 'node:path';\nimport { CodingSessionFrameRetention } from '../models/coding-session-frame-retention';\nimport { inject, injectable } from 'inversify';\nimport {\n ErrorBuilderBackendService,\n LoggerService,\n SAAS_SERVICE_TYPES,\n type AgentsBackendService, describeCaughtError } from '@wildo-ai/saas-backend-lib';\nimport {\n CodingAgent_OperationContext_BaseSchema,\n CodingAgent_RunTaskInputSchema,\n CodingAgent_RunTaskOutputSchema,\n CodingAgent_StopReason,\n type CodingAgent_RunTaskOutput,\n type CodingAgent_Usage,\n} from '@wildo-ai/external-connectors-models';\nimport { ErrorCustomMessageReference, ErrorType, type FlowsActors_Agent_Invocation } from '@wildo-ai/saas-models';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { InFlightWorkHeartbeat } from '../../core/runtime/in-flight-work-heartbeat.companion';\nimport { join } from 'node:path';\nimport { APPLICATION_RESEARCH_AGENT_REF } from '../../meta-workflows/models/application-research-agent.actors-system.definitions';\nimport { CompanionTraceabilityLevel, type CompanionExecutionSessionContext } from '../../core/traceability/companion-traceability.models';\nimport { CompanionTraceabilityService } from '../../core/traceability/companion-traceability.service';\nimport { buildApplicationCodingTaskLocationPredicate } from './coding-agent-dispatch.companion.service';\nimport {\n RESEARCH_EVIDENCE_RELATIVE_ROOT,\n composeEvidenceStoreInstruction,\n resolveResearchEvidenceDirectory,\n writeFinalEvidenceRecord,\n} from './research-evidence-store.companion';\n\n/** One research objective, composed by whatever is asking — a playbook, a choreography, an operator. */\nexport interface ResearchTaskRequest {\n /**\n * What to find out, in the requester's own words.\n *\n * Deliberately free text rather than a structured query: the objective is INVENTED per run and\n * adapted to what an earlier round found, which is the whole reason a research step is an agent\n * and not a search API. Code gates the KIND of work and its bounds; it never gates the content.\n */\n readonly objective: string;\n /**\n * Which investigation this task belongs to — normally the composite playbook ref. Names the\n * evidence-store directory every round of that investigation consolidates into. Absent for an\n * operator's ad-hoc question, which lands under `adhoc`.\n */\n readonly evidenceScope?: string;\n /**\n * A scope this task READS but never writes (#1609): the default instance's store when an instance\n * researches, so application-wide facts are pooled while the instance's own findings stay its own.\n */\n readonly sharedEvidenceScope?: string;\n /** The playbook that asked, recorded in the persisted evidence frontmatter. */\n readonly playbookRef?: string;\n}\n\nexport interface ResearchTaskResult {\n /** The agent's final message — the evidence, in prose, with the sources it says it read. */\n readonly evidence: string;\n readonly stopReason: CodingAgent_StopReason;\n readonly usage?: CodingAgent_Usage;\n /**\n * Permission requests and client callback policy refusals, with their reasons.\n *\n * Carried because a research answer that looks thin has two very different causes — the agent\n * found little, or the ceiling refused the tool it needed — and they are indistinguishable from\n * the prose alone.\n */\n readonly deniedPermissionCount?: number;\n readonly permissionDecisions?: CodingAgent_RunTaskOutput['permissionDecisions'];\n /**\n * Paths reported by the adapter, copied without an independent filesystem audit or per-entry\n * validation. They describe its account of activity, not proof of authorship or evidence-store confinement.\n */\n readonly reportedFileLocations: readonly string[];\n readonly elapsedMs: number;\n /** Path returned by a successful backstop write; empty when best-effort persistence failed. */\n readonly persistedEvidencePath: string;\n}\n\n/** The research agent is not registered, or the profile it names is absent. Named so a transport answers 409 rather than 500. */\nexport class ResearchAgentUnavailableError extends Error {}\n\n/**\n * What one research task RECORDS, so it can be read after it ran (#1328).\n *\n * The lane recorded nothing until then — no row, no trace, no frames — only a debug log line and the\n * evidence file. \"What was fetched, what answered, what was refused\" could not be answered for any\n * research run that had ever happened, and three lost compliance runs (2026-09-04) were reconstructed\n * from the evidence store alone. Each task now writes ONE trace session of its own, which the\n * creation board lists on its timeline and draws as a conversation like any other trace.\n *\n * A closed vocabulary, because the board TONES an event by its type.\n */\nexport enum ResearchTraceEvent {\n /** The objective was handed to the research agent. The prompt is the step's `research-objective.md`. */\n TASK_REQUESTED = 'research.task-requested',\n /** The agent answered: stop reason, evidence size, how many fetches, every permission decision. */\n TASK_ANSWERED = 'research.task-answered',\n /** The turn was cancelled or threw. Whatever reached the evidence store stands on its own. */\n TASK_FAILED = 'research.task-failed',\n}\n\n/**\n * Where this process says \"a research agent is running\", app-root-relative. Beaten while any research\n * task is in flight and removed when none is.\n *\n * A research agent is an ACP subprocess of the companion like a coding agent, so a supervisor restart\n * kills it the same way — and it holds no workspace-mutation lock (deliberately; see\n * `runResearchTask`) and is not in the coding lane's active-run set. Inside a playbook run the\n * playbook-run heartbeat covered it; an operator's `POST /api/companion/research` or the creation\n * conversation's research tool had nothing, found while closing the same gap for concurrent coding\n * runs (2026-09-27). Its own file rather than the coding lane's, because two owners of one file would\n * let one remove it while the other still runs.\n *\n * A COPY of `RESEARCH_RUN_HEARTBEAT_RELATIVE_PATH` in\n * `scripts/dev-orchestrator/runtime-supervisor-lifecycle.mjs`, pinned equal by\n * `scripts/__tests__/runtime-supervisor-workspace-mutation-hold.test.mjs`.\n */\nconst RESEARCH_RUN_HEARTBEAT_RELATIVE_PATH = '.wildo-saas/state/research-run.heartbeat';\n\n/** How often that file's mtime is refreshed; the supervisor judges it stale at three times this (`AGENT_RUN_HEARTBEAT_STALE_MS`). */\nconst RESEARCH_RUN_HEARTBEAT_INTERVAL_MS = 5_000;\n\n@injectable()\nexport class ResearchAgentDispatchCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n /** Research tasks in flight in this process; several run at once in a breadth-first fan-out. */\n private researchTasksInFlight = 0;\n\n /** The {@link RESEARCH_RUN_HEARTBEAT_RELATIVE_PATH} beat; built on first use (`Object.create` harnesses skip initializers). */\n private researchRunHeartbeat: InFlightWorkHeartbeat | undefined;\n\n private syncResearchRunHeartbeat(): void {\n // No application root, nowhere to beat — a harness, never a running companion.\n const saasRoot = this.companionContext?.saasRoot;\n if (typeof saasRoot !== 'string') return;\n this.researchRunHeartbeat ??= new InFlightWorkHeartbeat(\n join(saasRoot, RESEARCH_RUN_HEARTBEAT_RELATIVE_PATH),\n RESEARCH_RUN_HEARTBEAT_INTERVAL_MS,\n (message, error) => this.logDebug?.(message, { error: String(error) }),\n );\n this.researchRunHeartbeat.sync((this.researchTasksInFlight ?? 0) > 0);\n }\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) private readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.AgentsBackendService) private readonly agentsService: AgentsBackendService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.TraceabilityService) private readonly traceabilityService: CompanionTraceabilityService,\n ) {\n this.logDebug = this.logger.debugByType('ResearchAgentDispatchCompanionService');\n this.logger.setDebugTypeLogging('ResearchAgentDispatchCompanionService', true);\n }\n\n /**\n * Run one research objective and return what the agent found.\n *\n * No lock, no change set, no reconciliation — a run that cannot mutate has nothing to attribute and\n * nothing to recover. Several research lanes may therefore run concurrently, which is what makes a\n * breadth-first fan-out possible at all.\n *\n * ## \"Cannot mutate\" is one island short, and the coding lane is where that was paid for\n *\n * This run CAN write, to exactly one place: its evidence store\n * (`specifications/research-evidence/`, admitted by the location predicate below). That store is\n * inside the application repository and is COMMITTABLE, so it is fully visible to the coding lane's\n * whole-worktree change-set capture — and a research turn overlapping a coding run therefore\n * appeared in that run's change set, at a path no coding task declares, i.e. as a false\n * `MUTATION_SCOPE_VIOLATION` that failed the coding run closed. Two live paths reach that overlap:\n * an operator's `POST /api/companion/research`, and a composite's `RESEARCH_AGENT` children, which\n * the choreography dispatches concurrently.\n *\n * The fix is on the coding side, where the misattribution happens —\n * `CONCURRENT_HOST_LANE_ROOTS` in `git-change-set.companion.service.ts` names this store as\n * lane-owned, so its writes are RECORDED in the change set and excluded from the scope decision.\n * Taking the workspace-mutation lock here was rejected and measured: that lock is acquired with\n * `retries: { retries: 0 }`, so it refuses rather than queues, and it would refuse two of every\n * three lanes of the fan-out this JSDoc exists to protect.\n *\n * So if this lane ever grows a SECOND writable island, the coding lane's list has to grow with it\n * in the same change. Nothing mechanical joins them — the predicate is one exported function\n * precisely so the join is a single named place rather than a convention.\n */\n public async runResearchTask(request: ResearchTaskRequest): Promise<ResearchTaskResult> {\n this.researchTasksInFlight = (this.researchTasksInFlight ?? 0) + 1;\n this.syncResearchRunHeartbeat();\n try {\n return await this.runResearchTaskCounted(request);\n } finally {\n this.researchTasksInFlight = Math.max(0, (this.researchTasksInFlight ?? 1) - 1);\n this.syncResearchRunHeartbeat();\n }\n }\n\n private async runResearchTaskCounted(request: ResearchTaskRequest): Promise<ResearchTaskResult> {\n const objective = request.objective.trim();\n if (objective.length === 0) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: { message: 'A research task needs an objective; an empty one would spend a turn to learn nothing.' },\n });\n }\n if (this.agentsService.getAgent(APPLICATION_RESEARCH_AGENT_REF) === undefined) {\n throw new ResearchAgentUnavailableError(\n `The research agent \"${APPLICATION_RESEARCH_AGENT_REF}\" is not registered. It is registered at companion startup; `\n + 'a companion started before it existed needs a restart.',\n );\n }\n\n const evidenceDirectory = resolveResearchEvidenceDirectory(this.companionContext.saasRoot, request.evidenceScope ?? 'adhoc');\n const sharedEvidenceDirectory = request.sharedEvidenceScope !== undefined && request.sharedEvidenceScope !== request.evidenceScope\n ? resolveResearchEvidenceDirectory(this.companionContext.saasRoot, request.sharedEvidenceScope)\n : undefined;\n const promptWithStore = [objective, '', composeEvidenceStoreInstruction(evidenceDirectory, sharedEvidenceDirectory)].join('\\n');\n\n const invocation: FlowsActors_Agent_Invocation<\n typeof CodingAgent_RunTaskInputSchema,\n typeof CodingAgent_RunTaskOutputSchema,\n typeof CodingAgent_OperationContext_BaseSchema\n > = {\n agentRef: APPLICATION_RESEARCH_AGENT_REF,\n initiator: {},\n invocationContext: [],\n input: { prompt: promptWithStore },\n output: { finalMessage: '', stopReason: CodingAgent_StopReason.END_TURN },\n executionContext: { callTimestamp: new Date().toISOString() },\n artifactBindings: [],\n };\n\n const startedAtMs = Date.now();\n const startedAtIso = new Date(startedAtMs).toISOString();\n this.logDebug('Research task starting', { objectiveLength: objective.length, evidenceScope: request.evidenceScope });\n\n /*\n * The RECORD of this task (see `ResearchTraceEvent`). Best-effort from end to end: a trace is\n * evidence beside the research, and a sink that fails must never be why a research turn did.\n */\n let traceSession: CompanionExecutionSessionContext | undefined;\n let traceStep: ReturnType<CompanionTraceabilityService['createStep']> | undefined;\n const trace = async (write: () => Promise<void>): Promise<void> => {\n try { await write(); } catch (traceError) {\n this.logDebug('Research trace write failed; the research itself is unaffected', { failure: describeCaughtError(traceError) });\n }\n };\n const traceEvent = (type: ResearchTraceEvent, summary: string, payload: Record<string, unknown>): Promise<void> => trace(async () => {\n if (!traceSession) return;\n await this.traceabilityService.traceEvent({ session: traceSession, minimumLevel: CompanionTraceabilityLevel.DEBUG, type, summary, payload, ...(traceStep ? { step: traceStep } : {}) });\n });\n const traceArtifact = (fileName: string, content: unknown): Promise<void> => trace(async () => {\n if (!traceSession) return;\n await this.traceabilityService.writeArtifact({ session: traceSession, minimumLevel: CompanionTraceabilityLevel.DEBUG_VERBOSE, fileName, content, ...(traceStep ? { step: traceStep } : {}) });\n });\n await trace(async () => {\n traceSession = this.traceabilityService.createInternalSession({\n label: 'application-research-task',\n metadata: { ...(request.playbookRef ? { playbookRef: request.playbookRef } : {}), evidenceScope: request.evidenceScope ?? 'adhoc' },\n });\n if (traceSession) traceStep = this.traceabilityService.createStep(traceSession, { kind: 'research-agent-dispatch', label: 'application-research-task' });\n });\n /*\n * What the agent FETCHED and read, bounded the coding lane's way (one entry per call, head and\n * tail of a long run). Passages stay out: here the agent's messages ARE the evidence, stored as such.\n */\n const frameRetention = new CodingSessionFrameRetention({ retainPassages: false });\n let sessionEventCount = 0;\n await traceEvent(\n ResearchTraceEvent.TASK_REQUESTED,\n request.playbookRef ? `Research for ${request.playbookRef}` : 'Research task',\n { ...(request.playbookRef ? { playbookRef: request.playbookRef } : {}), evidenceScope: request.evidenceScope ?? 'adhoc', objectiveLength: objective.length },\n );\n await traceArtifact('research-objective.md', promptWithStore);\n\n const isPermittedEvidenceLocation = buildApplicationCodingTaskLocationPredicate(\n this.companionContext.saasRoot,\n [RESEARCH_EVIDENCE_RELATIVE_ROOT],\n [],\n );\n /*\n * Writes go to THIS task's scope only (#1609): an instance's findings are its own, and the store it reads\n * from the application as a whole is never written by an instance. Reading stays open across the store.\n */\n const isPermittedOwnScopeLocation = buildApplicationCodingTaskLocationPredicate(\n this.companionContext.saasRoot,\n [path.relative(this.companionContext.saasRoot, evidenceDirectory)],\n [],\n );\n const response = await this.agentsService.invokeAgent(invocation, undefined, {\n workspaceRootPath: this.companionContext.saasRoot,\n /* What the agent FETCHED, retained for the record; bounded, and never able to fail the turn. */\n onCodingSessionEvent: (event) => {\n sessionEventCount += 1;\n frameRetention.accept(event);\n },\n /*\n * ONE writable island: this task's OWN scope directory of the evidence store, and reads across the\n * whole store (`specifications/research-evidence/`). Both predicates are the SAME builder the coding\n * lane trusts (symlink-aware, boundary-matched), so the agent can consolidate findings to disk as it\n * researches (evidence that survives an interrupted turn) and read prior rounds' files and the\n * application-wide store an instance shares (#1609), while the rest of the workspace stays refused. A web fetch declares no location and is unaffected. This replaced\n * the original refuse-every-path predicate on 2026-09-04, when three lost compliance runs\n * showed that evidence living only in run memory cannot be leveraged or recovered.\n */\n isPermittedCodingLocation: isPermittedOwnScopeLocation,\n isPermittedCodingReadLocation: isPermittedEvidenceLocation,\n });\n\n const output = response.output as Partial<CodingAgent_RunTaskOutput> | undefined;\n const evidence = typeof output?.finalMessage === 'string' ? output.finalMessage : '';\n const stopReason = output?.stopReason ?? CodingAgent_StopReason.UNRECOGNISED;\n const elapsedMs = Date.now() - startedAtMs;\n\n /*\n * A CANCELLED turn is not a completed one and its partial prose is not evidence — the same\n * refusal the coding lane makes, for the same reason: a truncated answer reads exactly like a\n * short one. Checked BEFORE the backstop write, so a cancelled turn's partial FINAL MESSAGE is\n * never persisted as a completed record — whatever the agent already consolidated to the store\n * during the turn stands on its own, file by file, and is exactly what incremental persistence\n * is for.\n */\n if (stopReason === CodingAgent_StopReason.CANCELLED) {\n await traceEvent(ResearchTraceEvent.TASK_FAILED, 'Research task was cancelled', { stopReason, elapsedMs, sessionEventCount });\n if (frameRetention.frames().length > 0) await traceArtifact('research-frames.json', frameRetention.frames());\n throw new Error(`Research task was cancelled after ${elapsedMs}ms; its partial answer is not evidence.`);\n }\n\n // The companion-side backstop: the completed brief lands on disk with its provenance even when\n // the agent consolidated nothing itself. Best-effort by construction — a store write failing\n // must not turn a completed research turn into a failed one.\n let persistedEvidencePath = '';\n try {\n persistedEvidencePath = writeFinalEvidenceRecord({\n evidenceDirectoryAbsolutePath: evidenceDirectory,\n objective,\n evidence,\n stopReason,\n startedAtIso,\n elapsedMs,\n ...(request.playbookRef ? { playbookRef: request.playbookRef } : {}),\n });\n } catch (persistError) {\n this.logger.warn('Research evidence backstop write failed; the returned brief is the only copy', {\n evidenceDirectory,\n failure: describeCaughtError(persistError),\n });\n }\n\n const result: ResearchTaskResult = {\n evidence,\n stopReason,\n ...(((response.executionContext as { usage?: CodingAgent_Usage } | undefined)?.usage)\n ? { usage: (response.executionContext as { usage?: CodingAgent_Usage }).usage }\n : {}),\n ...(output?.deniedPermissionCount !== undefined ? { deniedPermissionCount: output.deniedPermissionCount } : {}),\n ...(output?.permissionDecisions !== undefined ? { permissionDecisions: output.permissionDecisions } : {}),\n reportedFileLocations: output?.reportedFileLocations ?? [],\n elapsedMs,\n persistedEvidencePath,\n };\n await traceEvent(ResearchTraceEvent.TASK_ANSWERED, `Research answered (${stopReason})`, {\n stopReason,\n elapsedMs,\n evidenceLength: evidence.length,\n sessionEventCount,\n /* A fetch is a tool call; updates to one call carry its id, so distinct ids are distinct fetches. */\n // Counted over every frame: read off the retained ones it stopped at the bound.\n fetchCount: frameRetention.toolCallCount,\n ...(output?.deniedPermissionCount !== undefined ? { deniedPermissionCount: output.deniedPermissionCount } : {}),\n ...(output?.permissionDecisions !== undefined ? { permissionDecisions: output.permissionDecisions } : {}),\n ...(persistedEvidencePath ? { persistedEvidencePath } : {}),\n });\n await traceArtifact('research-evidence.md', evidence);\n if (frameRetention.frames().length > 0) await traceArtifact('research-frames.json', frameRetention.frames());\n\n this.logDebug('Research task finished', {\n stopReason,\n elapsedMs,\n evidenceLength: evidence.length,\n deniedPermissionCount: result.deniedPermissionCount,\n reportedFileLocations: result.reportedFileLocations.length,\n persistedEvidencePath,\n });\n return result;\n }\n}\n"]}
@@ -22,9 +22,10 @@
22
22
  * ## Who writes
23
23
  *
24
24
  * TWO writers, layered:
25
- * 1. The research AGENT, incrementally, during its turn — the profile's location predicate admits
26
- * exactly this directory (built by the same `buildApplicationCodingTaskLocationPredicate` the
27
- * coding lane trusts), so a mid-turn death still leaves everything already consolidated.
25
+ * 1. The research AGENT, incrementally, during its turn — its WRITE predicate admits exactly its own
26
+ * scope's directory, and its READ predicate the whole store (both built by the same
27
+ * `buildApplicationCodingTaskLocationPredicate` the coding lane trusts), so a mid-turn death still
28
+ * leaves everything already consolidated, and no task writes another scope's evidence (#1609).
28
29
  * 2. The COMPANION, once per completed task — `writeFinalEvidenceRecord` persists the returned
29
30
  * brief with its provenance frontmatter, so a completed turn is on disk even if the agent wrote
30
31
  * nothing itself.
@@ -63,7 +64,7 @@ export declare function slugifyEvidenceScope(scope: string): string;
63
64
  * intact, which is why the instruction asks for the CATEGORY rather than forbidding the conclusion:
64
65
  * an agent told only "do not name X" tends to drop the finding along with the name.
65
66
  */
66
- export declare function composeEvidenceStoreInstruction(evidenceDirectoryAbsolutePath: string): string;
67
+ export declare function composeEvidenceStoreInstruction(evidenceDirectoryAbsolutePath: string, sharedEvidenceDirectoryAbsolutePath?: string): string;
67
68
  /** What the companion persists about one COMPLETED research task, beside whatever the agent wrote. */
68
69
  export interface FinalEvidenceRecordInput {
69
70
  readonly evidenceDirectoryAbsolutePath: string;
@@ -1 +1 @@
1
- {"version":3,"file":"research-evidence-store.companion.d.ts","sourceRoot":"","sources":["../../../../../src/claude-cli/services/research-evidence-store.companion.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,uGAAuG;AACvG,eAAO,MAAM,+BAA+B,qCAAqC,CAAC;AAElF;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAExF;AAED,iGAAiG;AACjG,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO1D;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,+BAA+B,CAAC,6BAA6B,EAAE,MAAM,GAAG,MAAM,CAS7F;AAED,sGAAsG;AACtG,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,6BAA6B,EAAE,MAAM,CAAC;IAC/C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,yFAAyF;IACzF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,wBAAwB,GAAG,MAAM,CAgChF"}
1
+ {"version":3,"file":"research-evidence-store.companion.d.ts","sourceRoot":"","sources":["../../../../../src/claude-cli/services/research-evidence-store.companion.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,uGAAuG;AACvG,eAAO,MAAM,+BAA+B,qCAAqC,CAAC;AAElF;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAExF;AAED,iGAAiG;AACjG,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO1D;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,+BAA+B,CAAC,6BAA6B,EAAE,MAAM,EAAE,mCAAmC,CAAC,EAAE,MAAM,GAAG,MAAM,CAiB3I;AAED,sGAAsG;AACtG,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,6BAA6B,EAAE,MAAM,CAAC;IAC/C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,yFAAyF;IACzF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,wBAAwB,GAAG,MAAM,CAgChF"}
@@ -24,9 +24,10 @@ import { join } from 'node:path';
24
24
  * ## Who writes
25
25
  *
26
26
  * TWO writers, layered:
27
- * 1. The research AGENT, incrementally, during its turn — the profile's location predicate admits
28
- * exactly this directory (built by the same `buildApplicationCodingTaskLocationPredicate` the
29
- * coding lane trusts), so a mid-turn death still leaves everything already consolidated.
27
+ * 1. The research AGENT, incrementally, during its turn — its WRITE predicate admits exactly its own
28
+ * scope's directory, and its READ predicate the whole store (both built by the same
29
+ * `buildApplicationCodingTaskLocationPredicate` the coding lane trusts), so a mid-turn death still
30
+ * leaves everything already consolidated, and no task writes another scope's evidence (#1609).
30
31
  * 2. The COMPANION, once per completed task — `writeFinalEvidenceRecord` persists the returned
31
32
  * brief with its provenance frontmatter, so a completed turn is on disk even if the agent wrote
32
33
  * nothing itself.
@@ -74,11 +75,19 @@ export function slugifyEvidenceScope(scope) {
74
75
  * intact, which is why the instruction asks for the CATEGORY rather than forbidding the conclusion:
75
76
  * an agent told only "do not name X" tends to drop the finding along with the name.
76
77
  */
77
- export function composeEvidenceStoreInstruction(evidenceDirectoryAbsolutePath) {
78
+ export function composeEvidenceStoreInstruction(evidenceDirectoryAbsolutePath, sharedEvidenceDirectoryAbsolutePath) {
78
79
  return [
79
80
  '# Evidence store (persist as you go)',
80
81
  `The directory \`${evidenceDirectoryAbsolutePath}\` is your evidence store — the ONLY location you may write to (every other path is refused).`,
81
82
  '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.',
83
+ /*
84
+ * An INSTANCE's research (#1609) keeps its own store, so one segment's or one feature's findings never
85
+ * mix into another's, and READS the default instance's, where facts true of the whole application
86
+ * (the market, the law) were gathered. Read-only: what this instance finds belongs to this instance.
87
+ */
88
+ ...(sharedEvidenceDirectoryAbsolutePath
89
+ ? [`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.`]
90
+ : []),
82
91
  '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.',
83
92
  '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.',
84
93
  'Your final message still reports the answer in full — the store is the durable record, not a substitute for answering.',