@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
@@ -17,26 +17,29 @@ import { ResearchAgentDispatchCompanionService } from '../../claude-cli/services
17
17
  import * as ApplicationCreationSpecs from '@wildo-ai/saas-specifications/application-creation';
18
18
  import { PLAYBOOK_STEP_SCHEMA_NAMESPACES } from '../models/playbook-step-schema-namespaces.models.js';
19
19
  import { inject, injectable } from 'inversify';
20
- import { AI_ENGINE_CAPABILITIES, AI_ENGINE_CAPABILITIES_IN_THE_CONTRACTED_SERVICE, ENGINE_CLIENT_STORAGE_ENTRIES, DataRetentionClass, ErasureRetentionMode, undeclaredAiUseCapabilities, undeclaredRetentionClasses, vendorHostedProviderRefs, uninventoriedClientStorageSurfaces, BillingConfigurationSchema, OperatorComplianceIdentityPart, outstandingOperatorComplianceIdentityParts, ApplicationOperatorComplianceIdentitySchema, ApplicationProviderComplianceChoicesSchema, ApplicationRetentionScheduleSchema, ApplicationOperatingJurisdictionsSchema, appAssertedProcessingRegions, ProviderDeploymentModel, engineCapabilityIsAuthoringOnly, EngineCapability, deriveNextReviewOn, ReviewCadence, } from '@wildo-ai/saas-models';
21
- import { ApplicationAuthoredDocumentFactSpecificationSchema, ApplicationDocumentFactSpecificationSchema, ApplicationProcessorRegisterSchema, classifyConfiguredProviderRecipients, computeApplicationDocumentFacts, overlayComputedDocumentFacts, ProcessorRegisterEntryKind, processorProcessingRegions, registerEstablishesNoProcessorRecipients, MetaWorkflow_ContextSource, collectComplianceDocumentFactAvailability, deriveComplianceRegimes, } from '@wildo-ai/saas-specifications/application-creation';
20
+ import { AI_ENGINE_CAPABILITIES, AI_ENGINE_CAPABILITIES_IN_THE_CONTRACTED_SERVICE, RecipientCategoriesNotDerivableReason, ENGINE_CLIENT_STORAGE_ENTRIES, DataRetentionClass, ErasureRetentionMode, ResourceRetentionBindingSchema, StatutoryRetentionGroundSchema, undeclaredAiUseCapabilities, undeclaredRetentionClasses, vendorHostedProviderRefs, uninventoriedClientStorageSurfaces, BillingConfigurationSchema, OperatorComplianceIdentityPart, outstandingOperatorComplianceIdentityParts, ApplicationOperatorComplianceIdentitySchema, ApplicationProviderComplianceChoicesSchema, ApplicationRetentionScheduleSchema, ApplicationOperatingJurisdictionsSchema, appAssertedProcessingRegions, establishedProviderComplianceProfile, PersonalDataCategory, ProviderComplianceChoiceAssessment, ProviderDeploymentModel, engineCapabilityIsAuthoringOnly, EngineCapability, deriveNextReviewOn, ReviewCadence, parseRetentionEnforcementEvidenceJson, } from '@wildo-ai/saas-models';
21
+ import { ApplicationAuthoredDocumentFactSpecificationSchema, ApplicationDocumentFactSpecificationSchema, ApplicationProcessorRegisterSchema, computeApplicationDocumentFacts, complianceFactStaleness, ComplianceFactCurrency, processorAgreementStanding, computeRecipientPopulation, joinRecipientPopulationToRegister, APPLICATION_PROVIDER_PACKAGE_MANIFEST_PATHSPEC, applicationProviderPackagesFromManifests, ProviderScopeKey, RecipientDataPathKind, RecipientPopulationClass, RecipientPopulationMemberKind, SystemOfRecordDataFlowKind, deriveRecipientDisclosures, systemOfRecordPersonalDataOriginsOf, systemOfRecordVendorsOf, typedClientSearchNeedles, typedClientSitesFromGrepLines, overlayComputedDocumentFacts, ProcessorRegisterEntryKind, processorProcessingRegions, registerEstablishesNoProcessorRecipients, MetaWorkflow_ContextSource, collectComplianceDocumentFactAvailability, deriveComplianceRegimes, ApplicationLineDeclarationState, } from '@wildo-ai/saas-specifications/application-creation';
22
22
  import { AssuranceEvidenceJudgementVerdict, AssuranceEvidenceRunKind, AssuranceEvidenceRunSchema, deriveCapabilitySignal, deriveMcpExposureSignal, derivePersonalDataSignals, deriveProviderHostingSignal, deriveRetentionSignal, } from '@wildo-ai/saas-specifications/assurance';
23
- import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
23
+ import { execFileSync } from 'node:child_process';
24
+ import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
25
+ import { readFile } from 'node:fs/promises';
24
26
  import { importLandedTypeScriptModule } from './landed-module-import.companion.js';
25
27
  import * as path from 'node:path';
26
28
  import { join } from 'node:path';
27
29
  import { loadDraftFamilyValues } from '../../core/context/draft-family-values.companion.js';
30
+ import { InFlightWorkHeartbeat } from '../../core/runtime/in-flight-work-heartbeat.companion.js';
28
31
  import { getFrameworkKnowledgePlaybook, listFrameworkKnowledgePlaybooks, listFrameworkKnowledgeSkillSummaries, readFrameworkKnowledgeSkillBody } from '@wildo-ai/framework-knowledge';
29
- import { MetaWorkflow_EvaluationTreatmentDefinitionSchema, MetaWorkflow_Executor, } from '@wildo-ai/saas-models/meta-workflows';
30
- import { APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS, composeElicitationSection, dispatchOutcomeStepRef, BUILD_DECOMPOSE_INPUT_FAMILIES, STANDARD_APPLICATION_SPECIFICATION_SEMANTIC_AUTHORITY, evaluatePlaybookCatalogEligibility, buildApplicationCoherenceReport, composeAssuranceDocumentBlueprintBrief, composeAssuranceDocumentFactObligationsBrief, renderAssuranceDocumentClaimGuardsForJudge, composeAssuranceEvidenceBrief, composeAuthoredDocumentFactsBrief, composeAssuranceProgramAuthorityBrief, composeApplicationRoleGraphBrief, deriveOneFamilyFreshness, resolveStepOutputSchema, runPlaybookChoreography, countCheckpointedRounds, describeStaleOutput, PlaybookLaneBoundaryDecision, collectPlaybookLaneBoundaries, isJudgeVerdictStepRef, buildPlaybookReviewGuide, evaluatePlaybookEligibility, getFamilyPackageRelativePath, resolvePlaybookOutputLandingTarget, getLandableArtifactFamilies, isPlaybookGenerationSuspension, renderApplicationCoherenceReport, renderDeclaredInputFamily, composeDeclaredInputWithheldAspects, composeMarketFitScoresSection, composeRiskSignalsSection, widenDeclaredInputAspects, collectConvenedExpertRoles, committedCharterRoleRefs, renderPlaybookReviewGuide, runPlaybookGeneration, DEFAULT_MAXIMUM_CLARIFICATION_ROUNDS, PlaybookClarificationAction, accumulateClarificationRequests, validateClarificationAnswers, composeClarificationAnswersSection, runPlaybookJudge, runPlaybookLoop, composeBillingCommercialModelBrief, composeOperatingJurisdictionCoverageBrief, projectPlaybookElicitationAsDecision, resolveElicitationAnswers, } from '@wildo-ai/application-creation-runtime';
32
+ import { MetaWorkflow_EvaluationTreatmentDefinitionSchema, MetaWorkflow_Executor, MetaWorkflow_ClarificationAction, } from '@wildo-ai/saas-models/meta-workflows';
33
+ import { APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS, composeElicitationSection, dispatchOutcomeStepRef, BUILD_DECOMPOSE_INPUT_FAMILIES, STANDARD_APPLICATION_SPECIFICATION_SEMANTIC_AUTHORITY, evaluatePlaybookCatalogEligibility, buildApplicationCoherenceReport, collectHeldDraftUndeclaredFactCitations, composeAssuranceDocumentBlueprintBrief, composeAssuranceDocumentFactObligationsBrief, renderAssuranceDocumentClaimGuardsForJudge, composeAssuranceEvidenceBrief, composeAuthoredDocumentFactsBrief, composeAssuranceProgramAuthorityBrief, composeApplicationRoleGraphBrief, deriveOneFamilyFreshness, resolveStepOutputSchema, runPlaybookChoreography, countCheckpointedRounds, describeStaleOutput, PlaybookLaneBoundaryDecision, collectPlaybookLaneBoundaries, isJudgeVerdictStepRef, buildPlaybookReviewGuide, evaluatePlaybookEligibility, applicationLineRefusalOf, getFamilyPackageRelativePath, resolvePlaybookOutputLandingTarget, getLandableArtifactFamilies, isPlaybookGenerationSuspension, renderApplicationCoherenceReport, renderDeclaredInputFamily, composeDeclaredInputWithheldAspects, composeMarketFitScoresSection, composeRiskSignalsSection, widenDeclaredInputAspects, collectConvenedExpertRoles, committedCharterRoleRefs, renderPlaybookReviewGuide, runPlaybookGeneration, readPlaybookOutputLandingBaselines, PlaybookOutputLandingConflictError, DEFAULT_MAXIMUM_CLARIFICATION_ROUNDS, accumulateClarificationRequests, validateClarificationAnswers, composeClarificationAnswersSection, runPlaybookJudge, runPlaybookLoop, composeBillingCommercialModelBrief, composeOperatingJurisdictionCoverageBrief, projectPlaybookElicitationAsDecision, readAnswersForPlaybookQuestions, resolveElicitationAnswers, buildCreatorInputAnsweredAtByPlaybook, resolveApplicationLineScope, collectFamiliesDeactivatedByDecisions, isFamilyNotApplicable, describeApplicationActiveSet, narrowRefinementRound, refinementDependencyMaps, } from '@wildo-ai/application-creation-runtime';
31
34
  // The provider REGISTRY, not the engine map: importing the package root runs its bootstrap, which
32
35
  // registers the engine specifications, and an application's own registered provider specifications
33
36
  // join the same registry — so one accessor covers both authorities.
34
37
  import { listRegisteredProviderSpecifications, getExpertRoleTemplate, ExpertShapingInputKind, } from '@wildo-ai/saas-specifications';
35
- import { isActorExecutionSubjectBusyError, describeCaughtError } from '@wildo-ai/saas-backend-lib';
38
+ import { actorExecutionSuspensionRef, isActorExecutionNotSuspendedError, isActorExecutionSubjectBusyError, describeCaughtError } from '@wildo-ai/saas-backend-lib';
36
39
  import { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';
37
- import { ApplicationSpecificationFamily, JourneyArtifactValidationState, MetaWorkflowPlaybookSchema, } from '@wildo-ai/saas-specifications/application-creation';
40
+ import { secondaryLineDefinitionOfEntry, ApplicationSpecificationFamily, JourneyArtifactValidationState, MetaWorkflowPlaybookSchema, playbookInstanceId, } from '@wildo-ai/saas-specifications/application-creation';
38
41
  import { describeStructuredValidationIssue, readCodingModelDestinations, readStructuredGenerationFailure, } from '@wildo-ai/external-connectors-models';
39
- import { readBuildParallelism } from '@wildo-ai/platform-config-lib';
42
+ import { readBuildParallelism, resolveProviderComplianceProfiles } from '@wildo-ai/platform-config-lib';
40
43
  import { StructuredDeliberationCompanionService } from '../../deliberations/services/structured-deliberation.companion.service.js';
41
44
  import { PlacementPlanSchema, collectRevertedPlacementRevisions, } from '@wildo-ai/saas-specifications/application-creation';
42
45
  import { ApplicationSchemaPlanObligation, assessApplicationSchemaPlanObligation, } from '../../core/config/application-schema-plan-obligation.companion.utils.js';
@@ -51,22 +54,27 @@ import { CAPABILITY_COMPOSITION_PLAYBOOK_REF, CapabilityCompositionExecutorCompa
51
54
  import { APPLICATION_MATURITY_PLAYBOOK_REF, ApplicationMaturityExecutorCompanionService, } from './application-maturity-executor.companion.service.js';
52
55
  import { ExpertPersonaCompanionService } from '../../expert-personas/services/expert-persona.companion.service.js';
53
56
  import { LOGO_PANEL_ROLE_REFS } from '../../brand/services/logo-deliberation.companion.service.js';
57
+ import { readCompiledApplicationLineCatalog } from '../models/application-line-catalog.models.js';
54
58
  import { CodingAgentDispatchCompanionService } from '../../claude-cli/services/coding-agent-dispatch.companion.service.js';
55
- import { PlaybookChoreographyCheckpointContextSchema, PlaybookRunCheckpointKind, PlaybookRunSuspensionCheckpointSchema, SuspendedPlaybookRunNotFoundError, projectPlaybookClarificationAsDecision, APPLICATION_CREATION_AUTONOMY_POSTURE, LaneBoundaryTreatment, laneBoundaryTreatmentFor, projectLaneBoundaryAsDecision, } from '../models/playbook-run-checkpoint.models.js';
56
- import { CompositeRoundRelaunchDecision, decideCompositeRoundRelaunch } from '../models/composite-round-relaunch.models.js';
57
- import { projectLastPlaybookLoop, projectPlaybookRunRecords, readPlaybookRunMeasurement, summarizePlaybookLoopResult, summarizePlaybookRunResult } from '../models/playbook-run-record.models.js';
59
+ import { PlaybookChoreographyCheckpointContextSchema, PlaybookRunCheckpointKind, PlaybookRunSuspensionCheckpointSchema, SuspendedPlaybookRunNotFoundError, SupersededPlaybookRunQuestionError, projectPlaybookClarificationAsDecision, APPLICATION_CREATION_AUTONOMY_POSTURE, LaneBoundaryTreatment, laneBoundaryTreatmentFor, projectLaneBoundaryAsDecision, } from '../models/playbook-run-checkpoint.models.js';
60
+ import { humanDecisionSettler } from '../models/human-decision-settler.models.js';
61
+ import { CompositeRoundRelaunchDecision, compositeRoundMayRelaunch, compositeRoundRelaunchReadsBuildProgress, decideCompositeRoundRelaunch, } from '../models/composite-round-relaunch.models.js';
62
+ import { findOverlappingRootRuns, projectLastPlaybookLoop, projectPlaybookRunRecords, readPlaybookRunMeasurement, summarizePlaybookLoopResult, summarizePlaybookRunResult } from '../models/playbook-run-record.models.js';
58
63
  import { PLAYBOOK_SPEND_NOT_OBSERVED, mergePlaybookSpend } from '@wildo-ai/application-creation-runtime';
59
64
  import { PlaybookSpendMeterCompanionService } from './playbook-spend-meter.companion.service.js';
60
65
  import { CompanionExecutionsListQuerySchema } from '../../companion-api/companion-api.schemas.js';
66
+ import { CompanionTraceabilityLevel } from '../../core/traceability/companion-traceability.models.js';
61
67
  import { CompanionTraceabilityService } from '../../core/traceability/companion-traceability.service.js';
62
68
  import { createPlaybookExecutionTrace } from './playbook-execution-trace.companion.service.js';
63
69
  import { loadBackendCompanionExports, loadSpecificationsCompanionExports } from '../../core/context/companion-package-loaders.companion.js';
64
70
  import { choreographyEndedByEnvironment, isInfrastructureShapedAgentFailure, waitForDevCompileQuiet, } from '../../core/runtime/dev-compile-quiet.companion.js';
65
- import { META_WORKFLOWS_CORRELATION_DOMAIN, MetaWorkflowsExclusiveSubject, META_WORKFLOWS_PLAYBOOK_LOOP_ACTOR_REF, META_WORKFLOWS_PLAYBOOK_RUN_ACTOR_REF, META_WORKFLOWS_STRUCTURED_ARTIFACT_GENERATOR_AGENT_REF, META_WORKFLOWS_SYSTEM_REF, META_WORKFLOW_TRACE_STEP_KIND } from '../models/meta-workflows-lane.models.js';
66
- import { Actor_Task_Topics, FlowsActors_Status } from '@wildo-ai/saas-models';
67
- import { WorkbenchTaskCorrelationRef } from '@wildo-ai/platform-core-shared';
71
+ import { META_WORKFLOWS_CORRELATION_DOMAIN, MetaWorkflowsExclusiveSubject, compositeExclusiveSubject, isCompositeExclusiveSubject, META_WORKFLOWS_PLAYBOOK_LOOP_ACTOR_REF, META_WORKFLOWS_PLAYBOOK_RUN_ACTOR_REF, META_WORKFLOWS_STRUCTURED_ARTIFACT_GENERATOR_AGENT_REF, META_WORKFLOWS_SYSTEM_REF, META_WORKFLOW_TRACE_STEP_KIND, PLAYBOOK_RUN_PHASE_TRACE_STEP_KIND } from '../models/meta-workflows-lane.models.js';
72
+ import { Actor_Task_Topics, AppFrontendType, FlowsActors_Status, HumanDecision_RequesterKind, HumanDecision_RouteKind } from '@wildo-ai/saas-models';
73
+ import { WorkbenchTaskCorrelationRef, Workbench_PlaybookRunOutcomeStatus } from '@wildo-ai/platform-core-shared';
68
74
  import { CompanionExecutionsCompanionService } from '../../executions/services/companion-executions.companion.service.js';
69
75
  import { BRIEF_ADEQUACY_JUDGE_AGENT_REF, BriefAdequacyVerdict, BriefAdequacyVerdictOutputSchema } from '../models/brief-adequacy.actors-system.definitions.js';
76
+ /** How much of a FAILED verification check's output a run result carries: the end, where compilers and crashes report. */
77
+ const VERIFICATION_CHECK_OUTPUT_TAIL_CHARS = 4000;
70
78
  /**
71
79
  * The runtime's checkpoint ↔ the row's context, RECURSIVELY (#1497).
72
80
  *
@@ -137,7 +145,7 @@ const FILE_ONLY_ARTIFACT_FAMILIES = Object.freeze(['domain-plan', 'build-plan'])
137
145
  */
138
146
  const SETTLED_CODING_RUN_JUDGE_SUBJECT = 'settled-coding-run';
139
147
  /**
140
- * Where this process says "a detached playbook run is still working", app-root-relative.
148
+ * Where this process says "a playbook run is still working", app-root-relative.
141
149
  *
142
150
  * The dev supervisor holds a restart while a coding run holds the workspace-mutation lock. That lock
143
151
  * belongs to the AGENT and is released the moment its turn ends — while the run itself keeps going:
@@ -147,14 +155,19 @@ const SETTLED_CODING_RUN_JUDGE_SUBJECT = 'settled-coding-run';
147
155
  * the tail, leaving the agent's files on disk with no recorded outcome and no verdict — the work kept,
148
156
  * the evidence lost.
149
157
  *
150
- * So the tail carries its own liveness signal, refreshed while any detached run is in flight and
158
+ * So the run carries its own liveness signal, refreshed while any playbook run is in flight —
159
+ * detached OR not (the second only since 2026-09-27; see `playbookExecutionsInFlight`) — and
151
160
  * removed when none is. A COPY of `PLAYBOOK_RUN_HEARTBEAT_RELATIVE_PATH` in
152
161
  * `scripts/dev-orchestrator/runtime-supervisor-lifecycle.mjs`, which cannot import this source.
162
+ *
163
+ * The coding agents a run dispatches carry a signal of their own (`CODING_RUN_HEARTBEAT_RELATIVE_PATH`
164
+ * in the coding-agent dispatch service), because a CONCURRENT coding run holds no lock at all.
153
165
  */
154
166
  const PLAYBOOK_RUN_HEARTBEAT_RELATIVE_PATH = '.wildo-saas/state/playbook-run.heartbeat';
155
167
  /**
156
- * How often that file's mtime is refreshed. The supervisor judges it stale at twice this, so a
157
- * companion that dies stops holding anything within one window rather than forever.
168
+ * How often that file's mtime is refreshed. The supervisor judges it stale at three times this
169
+ * (`PLAYBOOK_RUN_HEARTBEAT_STALE_MS`), so a companion that dies stops holding anything within a few
170
+ * seconds rather than forever.
158
171
  */
159
172
  const PLAYBOOK_RUN_HEARTBEAT_INTERVAL_MS = 5_000;
160
173
  /**
@@ -315,6 +328,15 @@ function draftedCandidateDocumentRefs(values) {
315
328
  */
316
329
  const ASSURANCE_REPOSITORY_RELATIVE_PATH = '.wildo-saas/state/assurance';
317
330
  const ASSURANCE_JUDGED_RUNS_DIRECTORY = 'judged-runs';
331
+ /**
332
+ * Where the assurance collector commits the retention-enforcement evidence (#1636): the engine-store measurement
333
+ * of `evidence-requirement:retention-window-declaration` C3. The writer's copy is `engineStoreMeasurementPath`
334
+ * in `scripts/assurance/collect-engine-store-evidence.mjs` — the WRITER's path is pinned by that script's
335
+ * self-test; this copy is not pinned by anything, and agreement is checked by eye. The same
336
+ * deliberate duplication as the two strings above, and a wrong path degrades the same way — the
337
+ * `retention-enforcement` fact stays absent and its clause is marked owed.
338
+ */
339
+ const ASSURANCE_RETENTION_ENFORCEMENT_MEASUREMENT_PATH = ['engine-store-measurements', 'WILDO.PRIVACY.STORAGE_LIMITATION', 'retention-window-declaration', 'C3.json'];
318
340
  const FILE_PRESENT_WITHOUT_VALUE = Object.freeze({ __artifactPresentWithoutValue: true });
319
341
  /**
320
342
  * The map the coherence report reads: accepted families PLUS landed drafts.
@@ -337,7 +359,7 @@ function renderComputedDocumentFactsForJudge(answers) {
337
359
  if (answers === undefined || answers.length === 0)
338
360
  return '';
339
361
  return [
340
- '# Facts the runtime COMPUTED from the application\'s declarations',
362
+ '# Facts the runtime COMPUTED from the application\'s declarations and its own records',
341
363
  'Not produced by this run and not under judgment. They are absent from the landed file on purpose: never ask for',
342
364
  'them to be declared. A landed fact that contradicts one of them is unsupported.',
343
365
  '',
@@ -350,6 +372,23 @@ export class UnknownPlaybookError extends Error {
350
372
  /** A READINESS precondition fails. There is no way past this one: its inputs are absent or invalid. */
351
373
  export class PlaybookNotReadyError extends Error {
352
374
  }
375
+ /**
376
+ * A run's output file changed after the run read it, so it landed nothing rather than replace that change
377
+ * (#1614). Carries the runs whose landing is on disk now, when the write register knows them, so the
378
+ * creator sees WHICH run overlapped this one. Named so the transport answers 409: the request was valid,
379
+ * the working tree moved under it, and running the playbook again is the repair.
380
+ */
381
+ export class PlaybookRunLandingConflictError extends Error {
382
+ conflicts;
383
+ overlappingRuns;
384
+ constructor(conflicts, overlappingRuns, runtimeMessage) {
385
+ super(overlappingRuns.length === 0
386
+ ? runtimeMessage
387
+ : `${runtimeMessage} Landed meanwhile by: ${overlappingRuns.map((run) => `${run.playbookRef} (run ${run.runId})`).join(', ')}.`);
388
+ this.conflicts = conflicts;
389
+ this.overlappingRuns = overlappingRuns;
390
+ }
391
+ }
353
392
  /**
354
393
  * A second concurrent run of a kind this companion admits only ONE of, over one working tree.
355
394
  *
@@ -364,18 +403,20 @@ export class PlaybookRunAlreadyInFlightError extends Error {
364
403
  export class PlaybookLoopAlreadyRunningError extends PlaybookRunAlreadyInFlightError {
365
404
  }
366
405
  /**
367
- * A second concurrent CHOREOGRAPHY was refused — one composite per companion. Transport answers 409.
406
+ * A second concurrent run of the same composite INSTANCE was refused (#1610). Transport answers 409.
368
407
  *
369
- * The refusal the checkpoint store has assumed since it was written and nobody enforced: it keys by
370
- * playbook REF (`playbook-choreography-checkpoint.companion.service.ts`, "a composite is single-flight
371
- * per application — so the ref IS the identity of the run in progress"), so a second run of the same
372
- * composite LOADS the live run's mid-flight checkpoint and resumes from it, both runs then write the
373
- * same file every iteration, and whichever concludes first `consume()`s it — deleting the other's only
374
- * resume point while it is still paying for iterations. Two DIFFERENT composites do not collide on the
375
- * file, and are refused for the loop's own recorded reason: two portfolios' writes interleaved over one
376
- * working tree with nothing relating them.
408
+ * Until #1610 this refused any second composite, one per application; a different composite, or another
409
+ * instance of the same one, now runs beside it (see `MetaWorkflowsExclusiveSubject.COMPOSITE`). What stays
410
+ * refused is the case below: a new run of an instance ADOPTS that instance's newest progress checkpoint
411
+ * (`adoptChoreographyCheckpoint`, read off the execution rows since #1360), so a second run beside a live one
412
+ * would take over its checkpoint mid-flight, both would then advance it, and whichever settled first would
413
+ * consume the other's only resume point while it was still paying for iterations. (Before #1360 the same
414
+ * collision was on a checkpoint FILE keyed by ref, whose store assumed a composite was single-flight per
415
+ * application and nothing enforced it.) Two DIFFERENT composites never shared a checkpoint; they were
416
+ * refused because two portfolios' writes met over one tree with nothing relating them, which since #1610 is
417
+ * answered by detection (#1614) and each run's record of the runs it overlapped, not by refusal.
377
418
  *
378
- * Refused by the ENGINE since #1361: a composite's execution is opened with the `composite`
419
+ * Refused by the ENGINE since #1361: a composite's execution is opened with its instance's
379
420
  * single-flight subject, the driver refuses a second one from the running ROWS, and this error is
380
421
  * that refusal re-worded with the holder named. It was an in-memory marker before — invisible to a
381
422
  * second process, forgotten by a restart, and clearable by a nested run's `finally`.
@@ -402,22 +443,206 @@ export class PlaybookChoreographyAlreadyRunningError extends PlaybookRunAlreadyI
402
443
  *
403
444
  * Named here rather than inlined because it decides whether a provider enters a customer-facing
404
445
  * document as a data recipient. It mirrors the `providers.scopes.companion` key of
405
- * `wildo.saas.config.ts`; the scope names are config object keys and have no enum today, so this is
406
- * the single place the companion's own name is written down for this decision. If a provider-scope
407
- * vocabulary is ever declared, this constant is what should derive from it.
446
+ * `wildo.saas.config.ts`, and derives from the provider-scope vocabulary `ProviderScopeKey` declared
447
+ * beside the recipient population (#1707), so the brief and the population cannot name it differently.
448
+ */
449
+ const AUTHORING_PROVIDER_SCOPE = ProviderScopeKey.COMPANION;
450
+ /**
451
+ * The provider packages this application owns (package name → ref), from `providers/<ref>/<facet>/package.json`
452
+ * in the working tree, untracked included (#2018). `undefined` when they could not be listed, so the scan
453
+ * reports itself UNSCANNED rather than reading "no owned package" as "nothing imports a provider".
454
+ */
455
+ function readApplicationProviderPackages(saasRoot) {
456
+ try {
457
+ const listed = execFileSync('git', ['ls-files', '--cached', '--others', '--exclude-standard', '--', APPLICATION_PROVIDER_PACKAGE_MANIFEST_PATHSPEC], {
458
+ cwd: saasRoot,
459
+ encoding: 'utf8',
460
+ stdio: ['ignore', 'pipe', 'ignore'],
461
+ }).split('\n').filter(Boolean);
462
+ return applicationProviderPackagesFromManifests(listed.map((manifestPath) => ({ path: manifestPath, content: readFileSync(join(saasRoot, manifestPath), 'utf8') })));
463
+ }
464
+ catch {
465
+ return undefined;
466
+ }
467
+ }
468
+ /**
469
+ * Where this application's source imports a provider package the application owns (#2018) — the code half of
470
+ * the recipient population's data-path axis (#1707).
471
+ *
472
+ * `git grep` over the WORKING TREE, untracked files included: the brief describes what is being built,
473
+ * while the evidence collector greps the committed HEAD. That is the only difference between the readers
474
+ * (this one, the CLI's `subject-data-recipients` generator, the collector); each hands its lines to
475
+ * `typedClientSitesFromGrepLines` with the same owned-package map, so they cannot disagree about what a
476
+ * line means. `undefined` when the scan could not run, which the population carries as an UNSCANNED code
477
+ * path rather than as "nothing imports it".
478
+ */
479
+ export function scanTypedClientSites(saasRoot) {
480
+ if (saasRoot === undefined)
481
+ return undefined;
482
+ const applicationProviderPackages = readApplicationProviderPackages(saasRoot);
483
+ if (applicationProviderPackages === undefined)
484
+ return undefined;
485
+ const needles = typedClientSearchNeedles(applicationProviderPackages).flatMap((needle) => ['-e', needle]);
486
+ // No owned provider package, nothing a typed client could be imported from: a scan that found none. Never run
487
+ // `git grep` with no `-e`: it would read the pathspec `.` as the PATTERN and return every line holding a dot.
488
+ if (needles.length === 0)
489
+ return [];
490
+ try {
491
+ const output = execFileSync('git', ['grep', '--untracked', '-n', '-F', ...needles, '--', '.'], {
492
+ cwd: saasRoot,
493
+ encoding: 'utf8',
494
+ stdio: ['ignore', 'pipe', 'ignore'],
495
+ maxBuffer: 16 * 1024 * 1024,
496
+ });
497
+ return typedClientSitesFromGrepLines(output.split('\n'), applicationProviderPackages);
498
+ }
499
+ catch (error) {
500
+ // `git grep` exits 1 when nothing matches: a scan that found none, not one that failed.
501
+ if (error.status === 1)
502
+ return [];
503
+ return undefined;
504
+ }
505
+ }
506
+ /**
507
+ * WHO receives this application's personal data — the one population the brief, the computed
508
+ * `recipients-and-processors` fact and the evidence collector all read (#1707).
509
+ *
510
+ * Replaces a local walk that read only `scopes.<key>.providers`, so every provider declared under
511
+ * `frontendServices.<service>`, `minions.<minion>` or `workers.<worker>` was invisible here, and that never
512
+ * saw a `systemsOfRecord` instance.
513
+ */
514
+ function recipientPopulationOf(saasConfig, saasRoot, providerComplianceProfiles) {
515
+ const config = (saasConfig ?? {});
516
+ const choices = ApplicationProviderComplianceChoicesSchema.safeParse(config.providerComplianceChoices);
517
+ return computeRecipientPopulation({
518
+ providers: config.providers,
519
+ systemsOfRecord: config.systemsOfRecord,
520
+ providerComplianceChoices: choices.success ? choices.data : undefined,
521
+ typedClientSites: scanTypedClientSites(saasRoot),
522
+ ...(providerComplianceProfiles === undefined ? {} : { providerComplianceProfiles }),
523
+ });
524
+ }
525
+ /**
526
+ * The engine providers' profiles as their SPECIFICATIONS mirror them — the fallback when discovery cannot be read.
527
+ * A specification restates its module's profile and is reconciled against it, so for an ENGINE ref the two are
528
+ * one authority; for a catalogue vendor the specification set says nothing, which is why this is only a fallback.
529
+ */
530
+ function engineSpecificationComplianceProfiles() {
531
+ const profiles = {};
532
+ for (const specification of listRegisteredProviderSpecifications())
533
+ profiles[specification.ref] = specification.complianceProfile;
534
+ return profiles;
535
+ }
536
+ /**
537
+ * The system-of-record flows the `compliance-primary-facts` introspection reports per resource (#1709), or `undefined`
538
+ * when they cannot be read faithfully — which every system-of-record recipient then reports as FLOWS_NOT_READ.
539
+ *
540
+ * Crossed a JSON boundary, and the only direction it may err in is "not read": ANY shape this companion does not
541
+ * recognise — a resource with no `systemOfRecordFlows` key (an introspection older than #1709), a flow whose system,
542
+ * kind, categories or uncategorized fields are not what the producer emits, a category outside this companion's
543
+ * vocabulary (an application built against a different engine) — makes the whole answer undefined. Dropping the one
544
+ * odd flow or field instead would present a shorter list as complete, which is the under-report this guards against.
545
+ */
546
+ function parseSystemOfRecordFlows(resources) {
547
+ const kinds = new Set(Object.values(SystemOfRecordDataFlowKind));
548
+ const categories = new Set(Object.values(PersonalDataCategory));
549
+ const flows = [];
550
+ for (const resource of resources) {
551
+ if (!Array.isArray(resource.systemOfRecordFlows))
552
+ return undefined;
553
+ for (const flow of resource.systemOfRecordFlows) {
554
+ if (typeof flow.system !== 'string' || typeof flow.kind !== 'string' || !kinds.has(flow.kind))
555
+ return undefined;
556
+ if (!Array.isArray(flow.categories) || flow.categories.some((category) => typeof category !== 'string' || !categories.has(category)))
557
+ return undefined;
558
+ if (!Array.isArray(flow.uncategorizedPersonalFields) || flow.uncategorizedPersonalFields.some((field) => typeof field !== 'string'))
559
+ return undefined;
560
+ // #1745 — the purposes the binding links. Absent (an introspection older than #1745) reads as not read, like any
561
+ // other unrecognised shape: an empty list would state "no purpose linked" about flows nobody read the links of.
562
+ if (!Array.isArray(flow.purposeRefs) || flow.purposeRefs.some((purposeRef) => typeof purposeRef !== 'string'))
563
+ return undefined;
564
+ flows.push({
565
+ system: flow.system,
566
+ resourceType: resource.resourceType,
567
+ kind: flow.kind,
568
+ categories: flow.categories,
569
+ uncategorizedPersonalFields: flow.uncategorizedPersonalFields,
570
+ purposeRefs: flow.purposeRefs,
571
+ });
572
+ }
573
+ }
574
+ return flows;
575
+ }
576
+ /** How each not-derivable reason reads in the brief. Total over the vocabulary, so a new reason cannot render blank. */
577
+ const NOT_DERIVABLE_EXPLANATIONS = {
578
+ [RecipientCategoriesNotDerivableReason.FLOW_UNDECLARED]: 'some path declares no field map (a typed client, a browser operation or unscanned code), so what it sends is not established',
579
+ [RecipientCategoriesNotDerivableReason.NO_RESOURCE_FLOW]: 'no resource binds or pipes this system of record, so nothing declares what reaches it',
580
+ [RecipientCategoriesNotDerivableReason.FLOWS_NOT_READ]: "the application's resource declarations could not be read, so what flows to it is not known",
581
+ [RecipientCategoriesNotDerivableReason.UNCATEGORIZED_PERSONAL_FIELDS]: 'some field that flows to it is personal by the application\'s own declaration and names no category',
582
+ };
583
+ /**
584
+ * WHAT each recipient receives and for which purpose (#1709) — which of the Art. 30(1)(c) categories reach which (d) recipient.
585
+ *
586
+ * A recipient whose flow declares no field map is rendered NOT DERIVABLE, never as receiving nothing: a typed client
587
+ * or a browser operation sends whatever the application's code passes it, and no declaration says what that is.
408
588
  */
409
- const AUTHORING_PROVIDER_SCOPE = 'companion';
589
+ function renderRecipientDisclosures(disclosures) {
590
+ if (disclosures.length === 0)
591
+ return [];
592
+ return [
593
+ '',
594
+ 'What each recipient RECEIVES, and for which purpose (derived from the flows the application declares):',
595
+ ...disclosures.map((disclosure) => {
596
+ const categories = disclosure.categories.length > 0 ? disclosure.categories.join(', ') : 'no declared category';
597
+ const reasons = disclosure.categoriesNotDerivable.map((reason) => NOT_DERIVABLE_EXPLANATIONS[reason]);
598
+ if (disclosure.categoriesAreAFloor)
599
+ reasons.push('free text a person wrote rides the call, and it can carry any other category');
600
+ const notDerivable = reasons.length === 0 ? '' : ` — and MORE MAY REACH IT: ${reasons.join('; ')}`;
601
+ const purposes = disclosure.purposes.length > 0
602
+ ? `; purpose: ${disclosure.purposes.map((purpose) => `${purpose.purpose} (${purpose.basis})`).join('; ')}`
603
+ : '; purpose: NOT LINKED — its compliance choice names no `purposeRefs`';
604
+ const broken = disclosure.purposeRefsNamingNoPurpose.length > 0
605
+ ? `; purpose refs naming no declared lawful basis: ${disclosure.purposeRefsNamingNoPurpose.map((ref) => `\`${ref}\``).join(', ')}`
606
+ : '';
607
+ return ` - \`${disclosure.ref}\` — ${categories}${notDerivable}${purposes}${broken}`;
608
+ }),
609
+ ' State only the categories listed. Where more may reach a recipient, say that what it receives is not fully',
610
+ ' established — never list nothing, and never guess the rest.',
611
+ ];
612
+ }
410
613
  /**
411
- * The providers bound to a RUNTIME scope — every scope but the build-time companion's.
614
+ * The population rendered by class, so a drafter sees WHY a declared vendor is or is not a recipient.
412
615
  *
413
- * One reading for both places that need it: the compliance section's recipient rendering and the
414
- * computed `recipients-and-processors` fact (#964). A provider under `companion` is reached by the tool
415
- * that builds the application and is never in the path of a user's data.
616
+ * The two non-recipient classes are rendered because omitting them would read as "not declared": a tenant's
617
+ * own vendor and a vendor nothing reaches are both true statements a notice may need, and neither may be
618
+ * published as the operator's recipient.
416
619
  */
417
- function runtimeScopedProviderRefsOf(providers) {
418
- return [...new Set(Object.entries(providers?.scopes ?? {})
419
- .filter(([scope]) => scope !== AUTHORING_PROVIDER_SCOPE)
420
- .flatMap(([, value]) => Object.keys(value?.providers ?? {})))].sort();
620
+ function renderRecipientPopulation(population) {
621
+ if (population.members.length === 0)
622
+ return [];
623
+ const describe = (populationClass) => population.members
624
+ .filter((member) => member.populationClass === populationClass)
625
+ .map((member) => ` - \`${member.ref}\`${member.kind === RecipientPopulationMemberKind.SYSTEM_OF_RECORD ? ' (system of record)' : ''}`
626
+ + (member.dataPaths.length > 0 ? ` — reached by ${member.dataPaths.map((dataPath) => dataPath.kind).join(', ')}` : ''));
627
+ const block = (populationClass, heading, guidance) => {
628
+ const lines = describe(populationClass);
629
+ return lines.length === 0 ? [] : [` ${heading} (${lines.length}):`, ...lines, ...guidance.map((line) => ` ${line}`)];
630
+ };
631
+ return [
632
+ '',
633
+ 'Who RECEIVES data, by whose account reaches them (computed from the configuration and the source):',
634
+ ...block(RecipientPopulationClass.OPERATOR_SUB_PROCESSOR, "OPERATOR SUB-PROCESSORS — reached with the application's own account", [
635
+ 'These are the operator\'s recipients. Each belongs in the processor register.',
636
+ ]),
637
+ ...block(RecipientPopulationClass.TENANT_RECIPIENT, "TENANT RECIPIENTS — reached only through a customer's or a person's own connected account", [
638
+ 'The customer\'s own vendor, reached at the customer\'s instruction. Do NOT name these as the operator\'s',
639
+ 'sub-processors; where it helps a reader, say that a customer may connect its own account with them.',
640
+ ]),
641
+ ...block(RecipientPopulationClass.OPERATOR_RUN, 'OPERATOR-RUN — declared self-hosted', []),
642
+ ...block(RecipientPopulationClass.DECLARED_WITHOUT_DATA_PATH, 'DECLARED, NO DATA PATH — configured, and nothing in the application reaches them', [
643
+ 'They receive nothing. Never name them as recipients.',
644
+ ]),
645
+ ];
421
646
  }
422
647
  /**
423
648
  * The next-review date an application's DECLARED `assuranceReviewCadence` schedules from this run's
@@ -492,16 +717,17 @@ function renderRetentionSchedule(schedule) {
492
717
  * register but no longer configured is reported too — a stale entry keeps a recipient in the notice
493
718
  * that receives nothing, which is the quieter of the two errors.
494
719
  */
495
- function renderProcessorRegister(configuredProviderRefs, register, choices) {
720
+ function renderProcessorRegister(population, register) {
496
721
  /*
497
722
  * A provider the operator declared SELF_HOSTED is not a recipient, so it cannot be an outstanding
498
723
  * DISCLOSURE either (wildo-ai/wildo-ai#208: `email-preview` renders mail to a log and calls no API). A
499
724
  * provider with NO choice stays in scope, because absence means nobody has answered.
500
725
  *
501
- * The rule lives in `classifyConfiguredProviderRecipients` since #964, because the computed
502
- * `recipients-and-processors` fact states the same classification and two copies could disagree.
726
+ * The rule lives in `joinRecipientPopulationToRegister` over `computeRecipientPopulation` (#964, #1707),
727
+ * because the computed `recipients-and-processors` fact and the evidence collector state the same
728
+ * classification and a second copy could disagree.
503
729
  */
504
- const { undeclaredProviderRefs: undeclared, staleProviderRefs: stale } = classifyConfiguredProviderRecipients(configuredProviderRefs, register, choices);
730
+ const { undeclaredProviderRefs: undeclared, staleProviderRefs: stale, registeredTenantRecipientRefs: registeredTenantRecipients, } = joinRecipientPopulationToRegister(population, register);
505
731
  const declared = register?.processors ?? [];
506
732
  return [
507
733
  '## Who else processes personal data',
@@ -529,10 +755,15 @@ function renderProcessorRegister(configuredProviderRefs, register, choices) {
529
755
  ])
530
756
  : ['(no processor identity is established for any provider)']),
531
757
  ...(undeclared.length > 0
532
- ? ['', `UNDECLARED (${undeclared.length}): ${undeclared.map((ref) => `\`${ref}\``).join(', ')} — configured, identity not established.`]
758
+ ? ['', `UNDECLARED (${undeclared.length}): ${undeclared.map((ref) => `\`${ref}\``).join(', ')} — configured, identity not established.`,
759
+ ...renderUndeclaredProcessorQuestions(population, undeclared)]
533
760
  : []),
534
761
  ...(stale.length > 0
535
- ? ['', `STALE (${stale.length}): ${stale.map((ref) => `\`${ref}\``).join(', ')} — declared in the register but NOT configured. Do not name these as recipients.`]
762
+ ? ['', `STALE (${stale.length}): ${stale.map((ref) => `\`${ref}\``).join(', ')} — declared in the register but no data path reaches them from this operator. Do not name these as recipients.`]
763
+ : []),
764
+ ...(registeredTenantRecipients.length > 0
765
+ ? ['', `REGISTERED TENANT RECIPIENTS (${registeredTenantRecipients.length}): ${registeredTenantRecipients.map((ref) => `\`${ref}\``).join(', ')} — `
766
+ + 'reached only through a customer\'s own connected account, so NOT the operator\'s sub-processor. Do not publish them as one.']
536
767
  : []),
537
768
  /*
538
769
  * WHERE personal data lands through processors — the derivable half of the transfer question
@@ -572,6 +803,41 @@ function renderProcessorRegister(configuredProviderRefs, register, choices) {
572
803
  ]),
573
804
  ];
574
805
  }
806
+ /**
807
+ * For each UNDECLARED processor, what its vendor OFFERS — the QUESTION the register entry answers (#1708, #1744).
808
+ *
809
+ * The provider's profile states possibilities (who can run it, where) and, where the catalogue researched them,
810
+ * SUGGESTED legal facts, each read from a named page on a named day. They are rendered as what to verify and copy
811
+ * into the operator's own register, never as the answer: the register header's rule is that the framework supplies
812
+ * the question and a sourced suggestion, and only the operator's commit adopts a fact (Paul's decision, 2026-09-25).
813
+ */
814
+ function renderUndeclaredProcessorQuestions(population, undeclared) {
815
+ if (!population.complianceProfilesRead)
816
+ return [];
817
+ const lines = undeclared.flatMap((ref) => {
818
+ const profile = population.members.find((member) => member.ref === ref)?.complianceProfile ?? null;
819
+ if (profile === null)
820
+ return [` - \`${ref}\` — the provider declares no profile; research who runs it and where.`];
821
+ const established = establishedProviderComplianceProfile(profile);
822
+ if (established === null)
823
+ return [` - \`${ref}\` — UNDETERMINED: nobody has researched who runs it or where it processes.`];
824
+ const read = (established.evidence ?? []).map((entry) => `${entry.source} (read ${entry.verifiedAt})`);
825
+ return [
826
+ ` - \`${ref}\` — offers ${established.deploymentModels.join(' or ')}`
827
+ + (established.processingRegions.length > 0 ? ` in ${established.processingRegions.map((region) => `\`${region}\``).join(', ')}` : '')
828
+ + (established.vendorLegalEntityName === undefined ? '' : `; SUGGESTED legal entity: ${established.vendorLegalEntityName}`)
829
+ + (established.subprocessorListUrl === undefined ? '' : `; sub-processors listed at ${established.subprocessorListUrl}`)
830
+ + (established.dataProcessingAgreementUrl === undefined ? '' : `; data processing agreement offered at ${established.dataProcessingAgreementUrl}`)
831
+ + (read.length > 0 ? `. Read from ${read.join(', ')}.` : ' (undated: the provider cites no source or date).'),
832
+ ];
833
+ });
834
+ return [
835
+ 'What each UNDECLARED vendor offers — the QUESTION its register entry answers. A suggested fact is what the',
836
+ 'framework READ on the date shown; it is not this operator\'s arrangement and must not be stated as one until the',
837
+ 'operator verifies it and commits it to the processor register.',
838
+ ...lines,
839
+ ];
840
+ }
575
841
  /**
576
842
  * Whether the AI this application enables DECIDES anything about a person.
577
843
  *
@@ -746,13 +1012,9 @@ function renderProviderComplianceChoices(runtimeScopedProviderRefs, choices) {
746
1012
  * "this provider declares no compliance profile at all" is a different gap with a different owner, and
747
1013
  * reporting it as an asserted REGION would misname it.
748
1014
  */
749
- function renderAppAssertedProcessingRegions(choices) {
1015
+ function renderAppAssertedProcessingRegions(choices, profilesByProviderRef) {
750
1016
  if (choices === undefined)
751
1017
  return [];
752
- const profilesByProviderRef = {};
753
- for (const specification of listRegisteredProviderSpecifications()) {
754
- profilesByProviderRef[specification.ref] = specification.complianceProfile;
755
- }
756
1018
  const asserted = appAssertedProcessingRegions({ choices, profilesByProviderRef });
757
1019
  if (asserted.length === 0)
758
1020
  return [];
@@ -760,7 +1022,7 @@ function renderAppAssertedProcessingRegions(choices) {
760
1022
  '',
761
1023
  ` APP-ASSERTED REGIONS (${asserted.length}) — the operator names a region the provider does not offer:`,
762
1024
  ...asserted.map(({ providerRef, region }) => {
763
- const offered = profilesByProviderRef[providerRef]?.processingRegions ?? [];
1025
+ const offered = establishedProviderComplianceProfile(profilesByProviderRef[providerRef])?.processingRegions ?? [];
764
1026
  return ` - \`${providerRef}\` — configured as \`${region}\`; the provider declares `
765
1027
  + (offered.length > 0 ? offered.map((entry) => `\`${entry}\``).join(', ') : 'no region at all');
766
1028
  }),
@@ -770,6 +1032,110 @@ function renderAppAssertedProcessingRegions(choices) {
770
1032
  ' module is stale. Establish which before stating the region in a notice.',
771
1033
  ];
772
1034
  }
1035
+ /**
1036
+ * What the providers' own compliance PROFILES say about the operator's choices, and what research is owed (#1708).
1037
+ *
1038
+ * The region divergence has its own block above; this renders the rest of the assessment, each as a DIFFERENT piece
1039
+ * of work: a deployment model the provider does not offer is a configuration error, an UNDETERMINED profile is a
1040
+ * vendor nobody has researched, and a provider with no profile at all is a module that states nothing. When the
1041
+ * profiles could not be read the section says so — "no gap" and "not checked" must not render identically.
1042
+ */
1043
+ function renderProviderComplianceProfileFindings(population, unreadableReason) {
1044
+ if (!population.complianceProfilesRead) {
1045
+ return population.operatorSubProcessorRefs.length === 0 ? [] : [
1046
+ '',
1047
+ ` PROVIDER PROFILES NOT READ${unreadableReason === undefined ? '' : ` (${unreadableReason})`}: the operator's choices were checked only`,
1048
+ ' against the engine providers\' own declarations, so a catalogue vendor\'s possibilities were not compared.',
1049
+ ];
1050
+ }
1051
+ const modelNotOffered = population.complianceChoiceAssessments.filter((entry) => entry.assessment === ProviderComplianceChoiceAssessment.DEPLOYMENT_MODEL_NOT_OFFERED);
1052
+ return [
1053
+ ...(modelNotOffered.length > 0
1054
+ ? [
1055
+ '',
1056
+ ` DEPLOYMENT MODEL NOT OFFERED (${modelNotOffered.length}) — the operator chose a model the provider does not declare:`,
1057
+ ...modelNotOffered.map((entry) => ` - \`${entry.providerRef}\` — configured \`${entry.choice.deploymentModel}\`; the provider offers `
1058
+ + (entry.offered?.deploymentModels.map((model) => `\`${model}\``).join(', ') ?? 'nothing'))
1059
+ ]
1060
+ : []),
1061
+ ...(population.operatorSubProcessorsWithUndeterminedProfile.length > 0
1062
+ ? [
1063
+ '',
1064
+ ` PROFILE UNDETERMINED (${population.operatorSubProcessorsWithUndeterminedProfile.length}): `
1065
+ + `${population.operatorSubProcessorsWithUndeterminedProfile.map((ref) => `\`${ref}\``).join(', ')}.`,
1066
+ ' In use, and nobody has researched who runs these vendors or where they process. Their region and',
1067
+ ' legal identity are outstanding — state that plainly; the operator establishes them on its register.',
1068
+ ]
1069
+ : []),
1070
+ ...(population.operatorSubProcessorsWithoutProfile.length > 0
1071
+ ? [
1072
+ '',
1073
+ ` NO PROFILE DECLARED (${population.operatorSubProcessorsWithoutProfile.length}): `
1074
+ + `${population.operatorSubProcessorsWithoutProfile.map((ref) => `\`${ref}\``).join(', ')}.`,
1075
+ ' The provider module states nothing about who runs it. Treat it exactly like UNDETERMINED above.',
1076
+ ]
1077
+ : []),
1078
+ ];
1079
+ }
1080
+ /**
1081
+ * Which compliance facts the operator relies on have outlived the interval its register declares (#1708).
1082
+ *
1083
+ * The register's own date is always stated, because "checked on X" is what a drafter needs whether or not it is
1084
+ * current. Vendor facts are named only when STALE or UNDATED — a line per current fact would train a drafter to skim —
1085
+ * and UNDATED ones are named, because a fact with no date must not read as a current one.
1086
+ */
1087
+ function renderComplianceFactStaleness(population, register, profilesByProviderRef, asOf) {
1088
+ if (register === undefined)
1089
+ return [];
1090
+ const report = complianceFactStaleness({ register, profilesByProviderRef, providerRefs: population.operatorSubProcessorRefs, asOf });
1091
+ const staleProfiles = report.providerProfiles.filter((entry) => entry.currency === ComplianceFactCurrency.STALE);
1092
+ return [
1093
+ '',
1094
+ 'How current the vendor facts are:',
1095
+ report.register.currency === ComplianceFactCurrency.UNDATED
1096
+ ? ' The processor register carries no verification date, so nobody can say how old its vendor facts are.'
1097
+ : ` The processor register was last verified on ${report.register.verifiedAt} (${report.register.ageDays} day(s) ago)`
1098
+ + (report.reverificationIntervalDays === null
1099
+ ? '; it declares no re-verification interval, so nothing is called stale.'
1100
+ : `; the application re-verifies every ${report.reverificationIntervalDays} day(s), so it is ${report.register.currency}.`),
1101
+ ...(staleProfiles.length > 0
1102
+ ? [` STALE vendor facts (${staleProfiles.length}): ${staleProfiles.map((entry) => `\`${entry.providerRef}\` (read ${entry.verifiedAt})`).join(', ')} — re-check each against the vendor's own page before relying on it.`]
1103
+ : []),
1104
+ ...(report.undatedProviderRefs.length > 0
1105
+ ? [` UNDATED vendor facts (${report.undatedProviderRefs.length}): ${report.undatedProviderRefs.map((ref) => `\`${ref}\``).join(', ')} — the provider states them without saying when or where they were read, so their age is unknown.`]
1106
+ : []),
1107
+ ];
1108
+ }
1109
+ /**
1110
+ * Which processors a recorded data processing agreement governs, and which it does not (#1709).
1111
+ *
1112
+ * Only the operator knows whether it is bound by a DPA, so the brief states what the register records and names what
1113
+ * it does not. An entry recorded as NOT_IN_PLACE is named apart from an unrecorded one: the first is a stated gap,
1114
+ * the second an open question, and a notice must not present either as a governed processor. Nothing when there is
1115
+ * no register — its absence is already stated with the population join.
1116
+ */
1117
+ function renderProcessorAgreementStanding(register) {
1118
+ if (register === undefined)
1119
+ return [];
1120
+ const standing = processorAgreementStanding(register);
1121
+ const recorded = standing.entries.filter((entry) => entry.dataProcessingAgreement !== null);
1122
+ return [
1123
+ '',
1124
+ 'Data processing agreements and vendor retention (the operator\'s own record):',
1125
+ recorded.length > 0
1126
+ ? ` Recorded: ${recorded.map((entry) => `\`${entry.ref}\` ${entry.dataProcessingAgreement}${entry.vendorRetention === null ? '' : ` — retention: ${entry.vendorRetention}`}`).join('; ')}.`
1127
+ : ' No processor on the register records a DPA.',
1128
+ ...(standing.agreementNotInPlaceRefs.length > 0
1129
+ ? [` NO DPA IN PLACE (${standing.agreementNotInPlaceRefs.length}): ${standing.agreementNotInPlaceRefs.map((ref) => `\`${ref}\``).join(', ')} — the operator states none governs this processing; do not describe it as governed.`]
1130
+ : []),
1131
+ ...(standing.agreementUnrecordedRefs.length > 0
1132
+ ? [` DPA NOT RECORDED (${standing.agreementUnrecordedRefs.length}): ${standing.agreementUnrecordedRefs.map((ref) => `\`${ref}\``).join(', ')} — nobody has recorded whether a DPA governs it.`]
1133
+ : []),
1134
+ ...(standing.vendorRetentionUnrecordedRefs.length > 0
1135
+ ? [` Vendor retention not recorded: ${standing.vendorRetentionUnrecordedRefs.map((ref) => `\`${ref}\``).join(', ')}.`]
1136
+ : []),
1137
+ ];
1138
+ }
773
1139
  /**
774
1140
  * WHERE a coding run sends the application's SOURCE CODE, per model (issue #308, joins 2 and 3).
775
1141
  *
@@ -993,34 +1359,114 @@ function renderClientStorage(frontendSurfaceKeys, inventory) {
993
1359
  * - a composite that ended by ENVIRONMENT returned, and is still one somebody should re-run: the
994
1360
  * engine settles it COMPLETED and KEEPS its progress checkpoint instead of consuming it.
995
1361
  */
1362
+ /**
1363
+ * Whether this run may start as the instance it names, and what that instance is for (#1609, #1608). Pure.
1364
+ *
1365
+ * - A ROOT run of an instance needs its activation, and reads its purpose from it. A child inherits its root's
1366
+ * key and has no activation of its own, so it is not asked, and its purpose arrives from its root: until
1367
+ * #1608 every child of an instance composite was refused here.
1368
+ * - A secondary line's entry composite IS the line, so it never runs as the default instance.
1369
+ */
1370
+ export function resolveInstanceRunPurpose(input) {
1371
+ if (input.nestedWithinChoreographyRef !== undefined)
1372
+ return input.instancePurpose;
1373
+ if (input.instanceKey === undefined) {
1374
+ const line = secondaryLineDefinitionOfEntry(input.playbookRef);
1375
+ if (line !== undefined) {
1376
+ throw new PlaybookNotReadyError(`"${input.playbookRef}" runs as a secondary line: open one with the purpose it serves (a key such as "invoicing" and what `
1377
+ + `it is for), then run that instance. The conversation tool ${line.namesRefinedFamilies ? 'creation_open_refinement_line' : 'creation_open_secondary_line'} opens one.`);
1378
+ }
1379
+ return input.instancePurpose;
1380
+ }
1381
+ const instanceId = playbookInstanceId(input.playbookRef, input.instanceKey);
1382
+ const activation = input.creatorInputs?.activations?.[instanceId];
1383
+ if (activation?.closure !== undefined) {
1384
+ throw new PlaybookNotReadyError(`"${instanceId}" was ${activation.closure.kind}, so it runs no more. Open a new instance under another key to resume the work.`);
1385
+ }
1386
+ if (activation === undefined) {
1387
+ throw new PlaybookNotReadyError(`"${instanceId}" is not an opened instance of "${input.playbookRef}". Open it first, with the purpose it serves `
1388
+ + '(the conversation tool creation_open_playbook_instance, or POST /api/companion/playbooks/:playbookRef/instances).');
1389
+ }
1390
+ // A refinement line's targets travel with its purpose, so every child's brief says what is being refined (#1608).
1391
+ return activation.refinedFamilies ? `${activation.purpose} (it refines: ${activation.refinedFamilies.join(', ')})` : activation.purpose;
1392
+ }
1393
+ /**
1394
+ * What an INSTANCE was opened for, as a section of the creator's facts (#1608). Written in the creator's own
1395
+ * words from the activation; the run never paraphrases it.
1396
+ */
1397
+ export function composeInstancePurposeSection(instanceId, purpose) {
1398
+ return [`# What this run is for`, '', `This run is "${instanceId}", opened for: ${purpose}`, 'Work on that, and leave what it does not concern as it is.'].join('\n');
1399
+ }
1400
+ /** The dispatching composite's section with the root instance's purpose after it, when there is one (#1608). */
1401
+ function withInstancePurposeSection(section, instanceKey, purpose) {
1402
+ if (purpose === undefined)
1403
+ return section;
1404
+ const purposeSection = composeInstancePurposeSection(instanceKey ?? 'the application', purpose);
1405
+ return section ? `${section}\n\n${purposeSection}` : purposeSection;
1406
+ }
1407
+ /**
1408
+ * The SELECTOR's goal for a composite run (#1608): its intent, then what the instance is for and the creator's
1409
+ * brief when there are any. Until #1608 the goal was the intent alone, so a brief given to a composite was
1410
+ * dropped without trace and a feature line's selector did not know which feature it was developing.
1411
+ */
1412
+ export function composeCompositeGoal(input) {
1413
+ return [
1414
+ input.intent,
1415
+ ...(input.instancePurpose !== undefined ? ['', `This run is an instance opened for: ${input.instancePurpose}`] : []),
1416
+ ...(input.creatorBrief ? ['', `The creator's brief for this run: ${input.creatorBrief}`] : []),
1417
+ ].join('\n');
1418
+ }
996
1419
  export function createPlaybookRunOptions(suspensionRequests,
997
1420
  /**
998
1421
  * What each returned result COST (#1507), registered against the result object by the executor that
999
1422
  * measured it — keyed like the suspension requests and for the same reason: the result is the
1000
1423
  * identity both readings share, and copying it to add a field would lose the suspension.
1001
1424
  */
1002
- runMeasurements) {
1425
+ runMeasurements,
1426
+ /** The root runs each settled value's run overlapped (#1610), registered against it like its measurement. */
1427
+ runOverlaps) {
1003
1428
  const measurementOf = (result) => (typeof result === 'object' && result !== null ? runMeasurements?.get(result) : undefined);
1429
+ const overlapsOf = (settled) => (typeof settled === 'object' && settled !== null ? runOverlaps?.get(settled) : undefined);
1004
1430
  return {
1005
1431
  suspendOn: (result) => {
1006
1432
  const request = typeof result === 'object' && result !== null ? suspensionRequests.get(result) ?? null : null;
1007
1433
  // The waiting task says what it is waiting FOR (#1362), so a reader that was not there — the
1008
1434
  // board after a restart — can tell a run that stopped to ask from one that finished.
1009
- return request ? { ...request, taskOutput: summarizePlaybookRunResult(result, measurementOf(result)) } : null;
1435
+ return request ? { ...request, taskOutput: summarizePlaybookRunResult(result, measurementOf(result), overlapsOf(result)) } : null;
1010
1436
  },
1011
1437
  // What the run DID, on its own row (#1362): accepted or not, and the judge's verdict. Until this
1012
1438
  // existed the row said only that the run ended, and the rest died with the process. And what it
1013
1439
  // took — its wall-clock and its spend (#1507).
1014
- concludeAs: (result) => ({ status: FlowsActors_Status.COMPLETED, taskOutput: summarizePlaybookRunResult(result, measurementOf(result)) }),
1440
+ concludeAs: (result) => ({ status: FlowsActors_Status.COMPLETED, taskOutput: summarizePlaybookRunResult(result, measurementOf(result), overlapsOf(result)) }),
1015
1441
  retainCheckpointOn: (result) => typeof result === 'object' && result !== null
1016
1442
  && result.resumableFromCheckpoint === true,
1017
1443
  // A run that spent and then THREW keeps its duration and spend beside the engine's failure (#1507).
1018
1444
  recordBesideFailure: (error) => {
1019
1445
  const measurement = typeof error === 'object' && error !== null ? runMeasurements?.get(error) : undefined;
1020
- return measurement ? { measurement } : null;
1446
+ const overlappedRuns = overlapsOf(error);
1447
+ const beside = { ...(measurement ? { measurement } : {}), ...(overlappedRuns && overlappedRuns.length > 0 ? { overlappedRuns } : {}) };
1448
+ return Object.keys(beside).length > 0 ? beside : null;
1021
1449
  },
1022
1450
  };
1023
1451
  }
1452
+ /**
1453
+ * One line for the selector: which children a verdict re-opened, and on what (#1499, #1627).
1454
+ * `top_down.phase-gate in top_down.definition: compliance-presence was GAP` names the lane the verdict
1455
+ * came through, because a sibling lane re-opened across lanes is otherwise told nothing about why.
1456
+ *
1457
+ * The judge's RATIONALE follows, because the criterion name alone does not say what to correct. The
1458
+ * selector writes the re-opened child's objective from this line, and that objective is all a nested
1459
+ * lane and its leaf receive — so without the rationale the conception lane was sent back to fix a
1460
+ * "conception-buildable GAP" with nothing naming the undeclared resource at fault (#1264).
1461
+ */
1462
+ export function describeReopenedChildren(reopened) {
1463
+ return reopened.map((entry) => {
1464
+ const source = entry.via === undefined ? entry.verdictOf : `${entry.verdictOf} in ${entry.via}`;
1465
+ const criterion = entry.criterionRef === undefined ? 'the overall verdict' : entry.criterionRef.replace(/^.*criterion\//, '');
1466
+ const why = entry.rationale === undefined ? '' : ` — the judge: "${entry.rationale}"`;
1467
+ return `${entry.playbookRef} (${source}: ${criterion} was ${entry.verdict}${why})`;
1468
+ }).join('; ');
1469
+ }
1024
1470
  let PlaybookRunCompanionService = class PlaybookRunCompanionService {
1025
1471
  static { PlaybookRunCompanionService_1 = this; }
1026
1472
  logger;
@@ -1087,17 +1533,56 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
1087
1533
  const playbook = playbooks.find((candidate) => candidate.ref === playbookRef);
1088
1534
  if (!playbook)
1089
1535
  throw new UnknownPlaybookError(`No compiled playbook is registered under "${playbookRef}".`);
1090
- return projectPlaybookElicitationAsDecision({ playbook, requestedAt: new Date().toISOString() });
1536
+ /*
1537
+ * Only what the dossier does not answer yet (#1454 review): the run reads the dossier, so a gate
1538
+ * that re-asked every question blank posted the blanks as overrides of answers already given.
1539
+ * `null` then means "nothing left to ask" and the run proceeds on the dossier's answers.
1540
+ */
1541
+ const state = await this.readArtifactState();
1542
+ const creatorInputs = state.artifactsByFamily.get(ApplicationSpecificationFamily.CREATOR_INPUTS);
1543
+ const answeredQuestionRefs = new Set(readAnswersForPlaybookQuestions(playbook, creatorInputs).map((answer) => answer.questionRef));
1544
+ return projectPlaybookElicitationAsDecision({ playbook, requestedAt: new Date().toISOString(), answeredQuestionRefs });
1091
1545
  }
1092
1546
  async listPlaybookEligibility() {
1093
1547
  // A catalog entry that does not satisfy its own contract is omitted rather than fatal — one malformed
1094
1548
  // playbook must not hide the fifteen that are fine.
1095
1549
  const [state, playbooks] = await Promise.all([this.readArtifactState(), this.readParsedCatalog()]);
1096
- return evaluatePlaybookCatalogEligibility({
1097
- playbooks,
1098
- state,
1099
- landableFamilies: this.resolveLandableFamilies(),
1100
- });
1550
+ return {
1551
+ ...evaluatePlaybookCatalogEligibility({
1552
+ playbooks,
1553
+ state,
1554
+ landableFamilies: this.resolveLandableFamilies(),
1555
+ }),
1556
+ applicationLine: state.applicationLine?.declaration ?? { state: ApplicationLineDeclarationState.UNDECLARED },
1557
+ applicationLineOrphans: this.describeApplicationLineOrphans(state.applicationLine, state.deactivatedFamilies),
1558
+ ...(state.applicationLine
1559
+ ? {
1560
+ activeSet: describeApplicationActiveSet({
1561
+ catalog: readCompiledApplicationLineCatalog(),
1562
+ scope: state.applicationLine,
1563
+ creatorInputs: state.artifactsByFamily.get(ApplicationSpecificationFamily.CREATOR_INPUTS),
1564
+ }),
1565
+ }
1566
+ : {}),
1567
+ };
1568
+ }
1569
+ /**
1570
+ * What the application's line no longer uses but the workspace still holds (#1604 review, finding 5):
1571
+ * families a file exists for that the line declares not applicable, and a materialized public website
1572
+ * when the website plan does not apply. REPORTED so the creator sees what a line change left behind;
1573
+ * never removed here, because a removed package cannot be restored and a family file is read again if
1574
+ * the line switches back. Removing either is an explicit task.
1575
+ */
1576
+ describeApplicationLineOrphans(scope, deactivatedFamilies = []) {
1577
+ const websitePlanSetAside = isFamilyNotApplicable(scope, ApplicationSpecificationFamily.WEBSITE_PLAN)
1578
+ || deactivatedFamilies.some((entry) => entry.family === ApplicationSpecificationFamily.WEBSITE_PLAN);
1579
+ const websiteServiceKeys = websitePlanSetAside
1580
+ ? Object.entries(this.companionContext.servicesByKey ?? {})
1581
+ .filter(([, service]) => service.frontendType === AppFrontendType.STATIC_WEBSITE)
1582
+ .map(([key]) => key)
1583
+ .sort()
1584
+ : [];
1585
+ return { landedFamilies: scope?.ignoredLandedFamilies ?? [], websiteServiceKeys, deactivatedFamilies };
1101
1586
  }
1102
1587
  /**
1103
1588
  * What the application currently contains, read from the working tree — the only state there is.
@@ -1132,7 +1617,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
1132
1617
  * than inferred — only the call path knows a child from a fresh operator request arriving
1133
1618
  * mid-run — and neither HTTP entry point spreads a request body into that input.
1134
1619
  */
1135
- const playbooks = await this.readParsedCatalog();
1620
+ const playbooks = await this.traceRunPhase(input.session, 'catalog', () => this.readParsedCatalog());
1136
1621
  /*
1137
1622
  * THE MARKED GATE, refused BEFORE the run rather than after it (#111).
1138
1623
  *
@@ -1160,7 +1645,8 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
1160
1645
  * progress", and the person restarting is usually the one who just watched a companion restart
1161
1646
  * eat their run.
1162
1647
  */
1163
- const resumeFrom = await this.adoptChoreographyCheckpoint(input.playbook.ref, input.runId, input.session);
1648
+ // Per INSTANCE (#1609): an instance adopts only its own interrupted progress, never another's of the same composite.
1649
+ const resumeFrom = await this.traceRunPhase(input.session, 'checkpoint-adoption', () => this.adoptChoreographyCheckpoint(input.playbook.ref, input.instanceKey, input.runId, input.session));
1164
1650
  /*
1165
1651
  * Every round this run INHERITED rather than ran — the root's and, recursively, each nested lane's in
1166
1652
  * flight (#1507). The meter only sees this process, so each is an unobserved part of the run's spend;
@@ -1179,12 +1665,14 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
1179
1665
  }
1180
1666
  const result = await runPlaybookChoreography({
1181
1667
  composite: input.playbook,
1182
- checkpoint: (snapshot) => this.saveChoreographyCheckpoint(input.runId, snapshot, input.session),
1668
+ checkpoint: (snapshot) => this.saveChoreographyCheckpoint(input.runId, snapshot, input.session, input.instanceKey),
1183
1669
  ...(resumeFrom ? { resumeFrom } : {}),
1184
- goal: input.playbook.intent,
1670
+ goal: composeCompositeGoal({ intent: input.playbook.intent, instancePurpose: input.instancePurpose, creatorBrief: input.creatorBrief }),
1185
1671
  playbooks,
1186
1672
  landableFamilies: this.resolveLandableFamilies(),
1187
- readArtifactState: () => this.readArtifactState(),
1673
+ readArtifactState: () => this.traceRunPhase(input.session, 'choreography-artifact-state', () => this.readArtifactState()),
1674
+ // Before the first tree read: a composite whose children its line runs none of stops here (#1639).
1675
+ readApplicationLineScope: () => this.traceRunPhase(input.session, 'application-line-scope', () => this.readApplicationLineScope()),
1188
1676
  // Every selection and child dispatch is measured, so the row records spend per iteration and per child (#1507).
1189
1677
  meter: this.spendMeter,
1190
1678
  /*
@@ -1195,12 +1683,21 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
1195
1683
  */
1196
1684
  proceedPastSequencing: true,
1197
1685
  runChild: async (playbookRef, objective, stepResults, dispatchingCompositeRef) => {
1198
- const parentElicitationSection = await this.composeDispatchingElicitationSection({
1686
+ const parentElicitationSection = withInstancePurposeSection(await this.composeDispatchingElicitationSection({
1199
1687
  dispatchingCompositeRef,
1200
1688
  ownRef: input.playbook.ref,
1201
1689
  inherited: input.parentElicitationSection,
1202
1690
  playbooks,
1203
- });
1691
+ ...(input.instanceKey ? { instanceKey: input.instanceKey } : {}),
1692
+ }), input.instanceKey, input.instancePurpose);
1693
+ /*
1694
+ * A child the dispatching composite declares ACTS ON THE APPLICATION (#1608) runs as the default
1695
+ * instance: it refreshes what the application holds once (the domain plan, the build), which an
1696
+ * instance may never replace. It still reads the instance's purpose, so it knows what it refreshes for.
1697
+ */
1698
+ const actsOnApplication = (playbooks.find((candidate) => candidate.ref === dispatchingCompositeRef)?.method?.choreography?.actsOnApplication ?? [])
1699
+ .includes(playbookRef);
1700
+ const childInstanceKey = actsOnApplication ? undefined : input.instanceKey;
1204
1701
  return this.runChoreographyChild({
1205
1702
  playbookRef,
1206
1703
  objective,
@@ -1214,7 +1711,14 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
1214
1711
  // composite consolidates into one evidence-store directory, which is what makes a
1215
1712
  // relaunch start from what earlier runs already established. The DISPATCHING one, so a
1216
1713
  // nested lane's evidence is found again by the next run of that lane whichever root invoked it.
1217
- evidenceScope: dispatchingCompositeRef,
1714
+ // Per INSTANCE (#1609): the default instance keeps the composite's ref as its scope, so evidence gathered
1715
+ // before instances existed is found where it always was; `<ref>@<key>` keeps a segment's evidence its own.
1716
+ evidenceScope: playbookInstanceId(dispatchingCompositeRef, childInstanceKey),
1717
+ // And READS the default instance's, explicitly: application-wide facts are pooled, an instance's findings are not.
1718
+ ...(childInstanceKey ? { sharedEvidenceScope: playbookInstanceId(dispatchingCompositeRef), instanceKey: childInstanceKey } : {}),
1719
+ ...(input.instancePurpose !== undefined ? { instancePurpose: input.instancePurpose } : {}),
1720
+ rootRunId: input.rootRunId,
1721
+ ...(input.requestedByUserId ? { requestedByUserId: input.requestedByUserId } : {}),
1218
1722
  ...(input.dryRun === true ? { dryRun: true } : {}),
1219
1723
  ...(input.session ? { session: input.session } : {}),
1220
1724
  });
@@ -1238,14 +1742,42 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
1238
1742
  if (!dispatching) {
1239
1743
  throw new UnknownPlaybookError(`The composite "${request.dispatchingCompositeRef}" selecting a round is not in the compiled catalog.`);
1240
1744
  }
1241
- const parentElicitationSection = await this.composeDispatchingElicitationSection({
1745
+ /*
1746
+ * A CLOSED instance stops at its next round (#1608). Nothing can stop a composite mid-round, and the
1747
+ * round boundary is where it decides what to do next anyway: the child already running finishes, and
1748
+ * nothing new starts. Asked of the root's activation only; a lane's instance has none of its own.
1749
+ */
1750
+ // The root instance's activation, read once per round: its closure, and a refinement's targets.
1751
+ const activation = input.instanceKey === undefined ? undefined : await this.readInstanceActivation(playbookInstanceId(input.playbook.ref, input.instanceKey));
1752
+ const closure = activation?.closure;
1753
+ if (closure !== undefined) {
1754
+ return { children: [], stopRationale: `This instance was ${closure.kind}${closure.reason ? `: ${closure.reason}` : ''}. It stops here.` };
1755
+ }
1756
+ /*
1757
+ * A REFINEMENT line's first move is fixed (#1608): while a family it names is not yet re-derived, its
1758
+ * own round offers only that family's producers. Asked of the line's own composite only; a lane it
1759
+ * dispatches (the build) chooses as it always does.
1760
+ */
1761
+ const eligible = request.dispatchingCompositeRef === input.playbook.ref && input.instanceKey !== undefined
1762
+ && secondaryLineDefinitionOfEntry(input.playbook.ref)?.namesRefinedFamilies === true
1763
+ ? narrowRefinementRound({
1764
+ eligible: request.eligible,
1765
+ history: request.history,
1766
+ targets: activation?.refinedFamilies ?? [],
1767
+ // Only the line's own children order its targets: a playbook it never runs must not (refinementDependencyMaps).
1768
+ ...refinementDependencyMaps(playbooks, input.playbook.ref),
1769
+ })
1770
+ : request.eligible;
1771
+ const parentElicitationSection = withInstancePurposeSection(await this.composeDispatchingElicitationSection({
1242
1772
  dispatchingCompositeRef: request.dispatchingCompositeRef,
1243
1773
  ownRef: input.playbook.ref,
1244
1774
  inherited: input.parentElicitationSection,
1245
1775
  playbooks,
1246
- });
1776
+ ...(input.instanceKey ? { instanceKey: input.instanceKey } : {}),
1777
+ }), input.instanceKey, input.instancePurpose);
1247
1778
  return this.selectChoreographyChildren({
1248
1779
  ...request,
1780
+ eligible,
1249
1781
  composite: dispatching,
1250
1782
  ...(parentElicitationSection ? { parentElicitationSection } : {}),
1251
1783
  });
@@ -1409,6 +1941,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
1409
1941
  const research = await this.researchDispatch.runResearchTask({
1410
1942
  objective: researchObjective,
1411
1943
  ...(input.evidenceScope ? { evidenceScope: input.evidenceScope } : {}),
1944
+ ...(input.sharedEvidenceScope ? { sharedEvidenceScope: input.sharedEvidenceScope } : {}),
1412
1945
  playbookRef: child.ref,
1413
1946
  });
1414
1947
  return { stepResults: new Map([[stepOutput.ref, research.evidence]]) };
@@ -1426,6 +1959,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
1426
1959
  const research = await this.researchDispatch.runResearchTask({
1427
1960
  objective: researchObjective,
1428
1961
  ...(input.evidenceScope ? { evidenceScope: input.evidenceScope } : {}),
1962
+ ...(input.sharedEvidenceScope ? { sharedEvidenceScope: input.sharedEvidenceScope } : {}),
1429
1963
  playbookRef: child.ref,
1430
1964
  });
1431
1965
  return { stepResults: new Map([[stepOutput.ref, research.evidence]]) };
@@ -1463,13 +1997,23 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
1463
1997
  }
1464
1998
  const run = await this.runPlaybook({
1465
1999
  playbookRef: input.playbookRef,
1466
- creatorBrief: input.objective,
2000
+ /*
2001
+ * The objective is the choreography SELECTOR's words for this child, never the creator's. It was
2002
+ * passed as `creatorBrief` until 2026-09-25, so it rendered under "# What this application is" and
2003
+ * reached the child's judge as creator input, the ground truth its groundedness criteria score
2004
+ * against: a machine's reasoning read back as a product decision (#1608 review).
2005
+ */
2006
+ selectionRationale: input.objective,
1467
2007
  stepResults: input.stepResults,
1468
2008
  // The ONE path by which a nested composite is admitted past the single-flight refusal. Set
1469
2009
  // unconditionally: it is inert for every child that is not itself a composite, and making it
1470
2010
  // conditional on the child's declaration would put the "is this a composite?" question in two
1471
2011
  // places, one of which cannot see the compiled catalog the other routes on.
1472
2012
  nestedWithinChoreographyRef: input.parentChoreographyRef,
2013
+ rootRunId: input.rootRunId,
2014
+ ...(input.requestedByUserId ? { requestedByUserId: input.requestedByUserId } : {}),
2015
+ ...(input.instancePurpose !== undefined ? { instancePurpose: input.instancePurpose } : {}),
2016
+ ...(input.instanceKey ? { instanceKey: input.instanceKey } : {}),
1473
2017
  ...(input.parentElicitationSection ? { parentElicitationSection: input.parentElicitationSection } : {}),
1474
2018
  ...(input.dryRun === true ? { dryRun: true } : {}),
1475
2019
  ...(input.session ? { session: input.session } : {}),
@@ -1592,12 +2136,81 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
1592
2136
  elicitation: lane.method.elicitation,
1593
2137
  answers: resolveElicitationAnswers({
1594
2138
  playbookRef: lane.ref,
2139
+ playbook: lane,
1595
2140
  creatorInputs: state.artifactsByFamily.get(ApplicationSpecificationFamily.CREATOR_INPUTS),
1596
2141
  overrides: undefined,
2142
+ ...(input.instanceKey ? { instanceKey: input.instanceKey } : {}),
1597
2143
  }),
1598
2144
  });
1599
2145
  return section === '' ? input.inherited : section;
1600
2146
  }
2147
+ /**
2148
+ * What ABANDONING an instance does to its runs (#1608): every run of it waiting on a person is WITHDRAWN, and
2149
+ * every interrupted progress checkpoint it left is consumed, so nothing resumes work nobody wants. A run in
2150
+ * flight is not stopped here; it stops at its next round, when its selector reads the closure.
2151
+ *
2152
+ * "Its runs" is the instance's key under the entry playbook or any playbook in the entry's tree: a composite's
2153
+ * children inherit its key and run under their own refs. Best-effort per run, and the answer says exactly
2154
+ * which runs were withdrawn and which checkpoints consumed.
2155
+ *
2156
+ * Withdrawn by the SYSTEM (`abortSuspendedActorExecution`), every one alike (#1751): the question outlived the
2157
+ * work an answer would continue. The person's decision is the closure itself, recorded with its actor in the
2158
+ * closure commit; the withdrawal follows from it. A CANCEL — "this person chose not to continue this run" —
2159
+ * would need a person, and a question ROUTED to its run's starter admits no one else: the cancel was refused,
2160
+ * recorded as a refused answer, and left the question waiting.
2161
+ */
2162
+ async abandonInstanceRuns(input) {
2163
+ const catalog = await this.readParsedCatalog();
2164
+ const tree = new Set();
2165
+ const pending = [input.playbookRef];
2166
+ while (pending.length > 0) {
2167
+ const ref = pending.pop();
2168
+ if (tree.has(ref))
2169
+ continue;
2170
+ tree.add(ref);
2171
+ pending.push(...(catalog.find((entry) => entry.ref === ref)?.method?.choreography?.admits ?? []));
2172
+ }
2173
+ const ofTheInstance = (context) => context.instanceKey === input.instanceKey && tree.has(context.playbookRef);
2174
+ const withdrawnRunIds = [];
2175
+ for (const row of await this.actorsSystem.listSuspendedActorExecutions(META_WORKFLOWS_SYSTEM_REF, input.session)) {
2176
+ const parsed = PlaybookRunSuspensionCheckpointSchema.safeParse(row.checkpoint?.context);
2177
+ if (!parsed.success || !ofTheInstance(parsed.data))
2178
+ continue;
2179
+ try {
2180
+ await this.actorsSystem.abortSuspendedActorExecution(row._id, { failure: { message: 'The instance this run belonged to was closed; its question was withdrawn.' } }, input.session);
2181
+ withdrawnRunIds.push(row._id);
2182
+ }
2183
+ catch (error) {
2184
+ this.logDebug('An abandoned instance\'s waiting run could not be withdrawn', { runId: row._id, error: describeCaughtError(error) });
2185
+ }
2186
+ }
2187
+ const consumedCheckpointRunIds = [];
2188
+ for (const entry of await this.readResumableChoreographies(input.session)) {
2189
+ if (!ofTheInstance(entry.context))
2190
+ continue;
2191
+ try {
2192
+ await this.actorsSystem.consumeActorExecutionCheckpoint(entry.executionId, input.session);
2193
+ consumedCheckpointRunIds.push(entry.executionId);
2194
+ }
2195
+ catch (error) {
2196
+ this.logDebug('An abandoned instance\'s checkpoint could not be consumed', { runId: entry.executionId, error: describeCaughtError(error) });
2197
+ }
2198
+ }
2199
+ return { withdrawnRunIds, consumedCheckpointRunIds };
2200
+ }
2201
+ /**
2202
+ * The families the application holds right now: those with content on record. A refinement line may only
2203
+ * name one of these (#1608), since it changes what exists.
2204
+ */
2205
+ async readLandedFamilies() {
2206
+ return new Set((await this.readArtifactState()).artifactsByFamily.keys());
2207
+ }
2208
+ /** An instance's activation, read fresh from the committed dossier: a person may close it mid-run (#1608). */
2209
+ async readInstanceActivation(instanceId) {
2210
+ const state = await this.readArtifactState();
2211
+ const creatorInputs = state.artifactsByFamily.get(ApplicationSpecificationFamily.CREATOR_INPUTS);
2212
+ return creatorInputs?.activations?.[instanceId];
2213
+ }
1601
2214
  /**
1602
2215
  * The declared inputs of a CHOREOGRAPHY CHILD, rendered (#1431).
1603
2216
  *
@@ -1819,7 +2432,16 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
1819
2432
  '# Rounds already run',
1820
2433
  ...request.history.flatMap((iteration) => iteration.children.map((child) => `- ${child.playbookRef} — asked: "${child.objective}"`
1821
2434
  + (child.reads ? ` — read: ${child.reads.length === 0 ? 'nothing' : child.reads.join(', ')}` : '')
1822
- + (child.failure ? ` — FAILED: ${child.failure}` : ''))),
2435
+ + (child.failure ? ` — FAILED: ${child.failure}` : '')
2436
+ + (child.reopened && child.reopened.length > 0 ? ` — RE-OPENED ${describeReopenedChildren(child.reopened)}` : ''))),
2437
+ /*
2438
+ * A re-opened child is a LOOP-BACK, not churn (#1499, #1627): it landed earlier in this run and a
2439
+ * verdict sent the run back to it. The criterion is the reason, and it is the one thing the
2440
+ * re-offered child cannot see for itself, so the objective has to carry it.
2441
+ */
2442
+ ...(request.history.some((iteration) => iteration.children.some((child) => (child.reopened?.length ?? 0) > 0))
2443
+ ? ['', 'A child marked RE-OPENED was sent back by the verdict named beside it. If you run it again, make its objective what the judge says is wrong — name the element it names, and ask for that correction, not a redo. The objective is all that child will be told.']
2444
+ : []),
1823
2445
  ]),
1824
2446
  ].join('\n');
1825
2447
  const generated = await this.buildGenerationPort().generate({ prompt, schema, label: 'choreography:select' });
@@ -1900,6 +2522,8 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
1900
2522
  playbookRef: input.playbookRef,
1901
2523
  treatment: treatment.data,
1902
2524
  landed: subjects,
2525
+ // Criteria assessing only families this application's line declares not applicable are dropped (#1604).
2526
+ ...(input.artifactState.applicationLine ? { notApplicableFamilies: input.artifactState.applicationLine.notApplicableFamilies } : {}),
1903
2527
  ...(coherenceSection !== '' ? { derivedContext: [coherenceSection] } : {}),
1904
2528
  model: this.buildGenerationPort(),
1905
2529
  ...(input.session ? { trace: this.buildTrace(input.session, `playbook-assess-${input.playbookRef}`) } : {}),
@@ -2177,6 +2801,25 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2177
2801
  },
2178
2802
  };
2179
2803
  }
2804
+ /**
2805
+ * Every declared provider's compliance profile, through discovery (#1708) — the same door `wildo config sync` reads,
2806
+ * so the brief sees the catalogue vendors' profiles without loading a provider module. BEST-EFFORT: an application
2807
+ * whose packages cannot be walked right now gets `profiles: undefined`, which the population reports as NOT READ
2808
+ * rather than as "no provider declares one".
2809
+ */
2810
+ async resolveDiscoveredProviderComplianceProfiles(saasConfig) {
2811
+ const saasRoot = this.companionContext?.saasRoot;
2812
+ if (saasRoot === undefined)
2813
+ return { unreadableReason: 'no application root is known' };
2814
+ try {
2815
+ const { profilesByProviderRef } = await resolveProviderComplianceProfiles({ saasRoot, saasConfig: (saasConfig ?? {}) });
2816
+ return { profiles: profilesByProviderRef };
2817
+ }
2818
+ catch (error) {
2819
+ this.logDebug('Provider discovery unavailable — compliance profiles not read', { error: String(error) });
2820
+ return { unreadableReason: 'provider discovery could not be read' };
2821
+ }
2822
+ }
2180
2823
  /**
2181
2824
  * The application's accepted processor register, read from its specifications companion exports.
2182
2825
  *
@@ -2287,53 +2930,118 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2287
2930
  const saasConfig = (this.companionContext?.saasConfig ?? {});
2288
2931
  const register = ApplicationProcessorRegisterSchema.safeParse(exports?.processorRegister);
2289
2932
  const identity = ApplicationOperatorComplianceIdentitySchema.safeParse(saasConfig.operatorComplianceIdentity);
2290
- const choices = ApplicationProviderComplianceChoicesSchema.safeParse(saasConfig.providerComplianceChoices);
2291
2933
  const schedule = saasConfig.dataRetention === undefined ? undefined : ApplicationRetentionScheduleSchema.safeParse(saasConfig.dataRetention);
2292
2934
  const jurisdictions = ApplicationOperatingJurisdictionsSchema.safeParse(saasConfig.operatingJurisdictions);
2935
+ const choices = ApplicationProviderComplianceChoicesSchema.safeParse(saasConfig.providerComplianceChoices);
2936
+ const recipientPopulation = recipientPopulationOf(saasConfig, this.companionContext?.saasRoot);
2937
+ // Only asked when an answer needs it: the retention facts (a schedule exists) or a system-of-record recipient,
2938
+ // whose received categories come from the resources bound or piped to it (#1709). ONE introspection call answers
2939
+ // every axis: what erasure does to each resource, which retention class binds it (#1613), and what flows where.
2940
+ const needsResourceDeclarations = schedule?.success === true
2941
+ || recipientPopulation.members.some((member) => member.kind === RecipientPopulationMemberKind.SYSTEM_OF_RECORD);
2942
+ const resourceDeclarations = needsResourceDeclarations ? await this.readResourceRetentionDeclarations() : undefined;
2293
2943
  return computeApplicationDocumentFacts({
2294
2944
  operatorComplianceIdentity: identity.success ? identity.data : undefined,
2295
2945
  processorRegister: register.success ? register.data : undefined,
2296
- runtimeScopedProviderRefs: runtimeScopedProviderRefsOf(saasConfig.providers),
2946
+ recipientPopulation,
2947
+ systemOfRecordFlows: resourceDeclarations?.systemOfRecordFlows,
2948
+ // #1745 — the vendor the source fact names beside each instance.
2949
+ systemOfRecordVendors: systemOfRecordVendorsOf(saasConfig.systemsOfRecord),
2950
+ // #1745 — the operator's statement of whether an instance's personal data can come from public sources.
2951
+ systemOfRecordPersonalDataOrigins: systemOfRecordPersonalDataOriginsOf(saasConfig.systemsOfRecord),
2297
2952
  providerComplianceChoices: choices.success ? choices.data : undefined,
2298
2953
  retentionSchedule: schedule?.success ? schedule.data : undefined,
2299
- // Only asked when a schedule exists: without one the retention fact answers nothing, so reading every
2300
- // resource's declarations would be a subprocess import spent on no answer.
2301
- resourceErasureTreatments: schedule?.success ? await this.readResourceErasureTreatments() : undefined,
2954
+ resourceErasureTreatments: schedule?.success ? resourceDeclarations?.resourceErasureTreatments : undefined,
2955
+ // Whenever the resources were read, not only under a schedule: the retention facts still need one (they answer
2956
+ // nothing without it), while the source fact (#1745) states whether a system-of-record copy is kept until erased
2957
+ // from the bindings alone.
2958
+ resourceRetentionBindings: resourceDeclarations?.resourceRetentionBindings,
2302
2959
  operatingJurisdictionSlugs: jurisdictions.success ? jurisdictions.data.jurisdictions.map((entry) => entry.jurisdictionSlug) : undefined,
2960
+ retentionEnforcementEvidence: this.readCommittedRetentionEnforcementEvidence(),
2303
2961
  });
2304
2962
  }
2305
2963
  /**
2306
- * Each resource's declared erasure treatment, engine and application alike — the TREATMENT half of the
2307
- * `retention-rules` fact (#454).
2964
+ * The retention-enforcement records the assurance collector last committed (#1636) — what the
2965
+ * `retention-enforcement` fact, the first RUNTIME_EVIDENCE fact, is computed from.
2966
+ *
2967
+ * Read from the application's assurance repository, never from the running backend: generation must not
2968
+ * depend on a live stack or hold its credential, and the evidence plane stays an observer the creation lane
2969
+ * only reads (`.claude/rules/application-creation-directive.md`). Absent or unreadable answers `undefined`,
2970
+ * so the fact is absent and its clause is marked owed — never "nothing enforced".
2971
+ */
2972
+ readCommittedRetentionEnforcementEvidence() {
2973
+ const saasRoot = this.companionContext?.saasRoot;
2974
+ // No application root (a host that constructed the service without one): nothing to read, so no evidence.
2975
+ if (typeof saasRoot !== 'string' || saasRoot.length === 0)
2976
+ return undefined;
2977
+ const measurementFile = join(saasRoot, ASSURANCE_REPOSITORY_RELATIVE_PATH, ...ASSURANCE_RETENTION_ENFORCEMENT_MEASUREMENT_PATH);
2978
+ if (!existsSync(measurementFile))
2979
+ return undefined;
2980
+ try {
2981
+ const evidence = parseRetentionEnforcementEvidenceJson(JSON.parse(readFileSync(measurementFile, 'utf8')).evidence);
2982
+ if (evidence === undefined)
2983
+ this.logDebug('Retention-enforcement evidence was committed and does not parse (retention-enforcement stays unanswered)', { measurementFile });
2984
+ return evidence;
2985
+ }
2986
+ catch (error) {
2987
+ this.logDebug('Retention-enforcement evidence could not be read (retention-enforcement stays unanswered)', { error: String(error) });
2988
+ return undefined;
2989
+ }
2990
+ }
2991
+ /**
2992
+ * Each resource's declared erasure treatment AND retention-class binding, engine and application alike —
2993
+ * the two halves of the `retention-rules` fact: what erasure does (#454) and how long rows are kept (#1613).
2308
2994
  *
2309
- * `undefined` when the resources cannot be read: no backend service, or a failed introspection. That is
2310
- * not "no resource declares a treatment", and the fact then answers nothing rather than a period alone.
2995
+ * Both `undefined` when the resources cannot be read: no backend service, or a failed introspection. That
2996
+ * is not "no resource declares anything", and the fact then answers nothing rather than a period alone.
2311
2997
  * The introspection is cached against the source tree, so the repeated reads this path makes are hits.
2312
2998
  */
2313
- async readResourceErasureTreatments() {
2999
+ async readResourceRetentionDeclarations() {
3000
+ const unreadable = { resourceErasureTreatments: undefined, resourceRetentionBindings: undefined, systemOfRecordFlows: undefined };
2314
3001
  const backendServiceKey = Object.entries(this.companionContext.servicesByKey)
2315
3002
  .find(([, service]) => !service.frontendType)?.[0];
2316
3003
  if (!backendServiceKey)
2317
- return undefined;
3004
+ return unreadable;
2318
3005
  try {
2319
3006
  const result = await this.introspection.requestInfo({ serviceKey: backendServiceKey, behavior: 'compliance-primary-facts' });
2320
3007
  if (!result.success)
2321
- return undefined;
3008
+ return unreadable;
2322
3009
  const resources = result.data.resources;
2323
3010
  if (resources === undefined)
2324
- return undefined;
3011
+ return unreadable;
2325
3012
  const modes = new Set(Object.values(ErasureRetentionMode));
2326
- return resources.map((resource) => ({
2327
- resourceType: resource.resourceType,
2328
- // Crossed a JSON boundary, so it is a string; admitted only when it is a member of the vocabulary.
2329
- ...(resource.erasureRetentionMode !== undefined && modes.has(resource.erasureRetentionMode)
2330
- ? { erasureRetentionMode: resource.erasureRetentionMode }
2331
- : {}),
2332
- }));
3013
+ return {
3014
+ resourceErasureTreatments: resources.map((resource) => ({
3015
+ resourceType: resource.resourceType,
3016
+ // Crossed a JSON boundary, so it is a string; admitted only when it is a member of the vocabulary.
3017
+ ...(resource.erasureRetentionMode !== undefined && modes.has(resource.erasureRetentionMode)
3018
+ ? { erasureRetentionMode: resource.erasureRetentionMode }
3019
+ : {}),
3020
+ // #1635 — the statute that keeps the rows through an erasure. Admitted only as a vocabulary member with a
3021
+ // non-empty rationale: a ground the notice cannot name the law for is not stated at all.
3022
+ ...(() => {
3023
+ const ground = StatutoryRetentionGroundSchema.safeParse(resource.statutoryRetention?.ground);
3024
+ const rationale = resource.statutoryRetention?.rationale;
3025
+ return ground.success && typeof rationale === 'string' && rationale.trim().length > 0
3026
+ ? { statutoryRetention: { ground: ground.data, rationale } }
3027
+ : {};
3028
+ })(),
3029
+ })),
3030
+ resourceRetentionBindings: resources.map((resource) => {
3031
+ // Crossed a JSON boundary too; admitted only when it parses as a binding.
3032
+ const binding = ResourceRetentionBindingSchema.safeParse(resource.retentionBinding);
3033
+ return {
3034
+ resourceType: resource.resourceType,
3035
+ ...(binding.success ? { retentionBinding: binding.data } : {}),
3036
+ declaresRowTtl: resource.declaresRowTtl === true,
3037
+ };
3038
+ }),
3039
+ systemOfRecordFlows: parseSystemOfRecordFlows(resources),
3040
+ };
2333
3041
  }
2334
3042
  catch (error) {
2335
- this.logDebug('Resource erasure treatments could not be read (retention-rules stays unanswered)', { error: String(error) });
2336
- return undefined;
3043
+ this.logDebug('Resource retention declarations could not be read (retention-rules stays unanswered)', { error: String(error) });
3044
+ return unreadable;
2337
3045
  }
2338
3046
  }
2339
3047
  /**
@@ -2351,7 +3059,9 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2351
3059
  documentFactsWithComputedOverlay(state) {
2352
3060
  const value = state.artifactsByFamily.get('document-facts');
2353
3061
  const answers = state.computedDocumentFactAnswers ?? [];
2354
- if (answers.length === 0 || value === undefined || value === null || value === FILE_PRESENT_WITHOUT_VALUE)
3062
+ // Overlaid even with NO answer (#1636 review): the overlay also drops any stored copy of a computed fact,
3063
+ // and a copy left in the read view is a claim nothing computed — a typed "ENFORCED" among them.
3064
+ if (value === undefined || value === null || value === FILE_PRESENT_WITHOUT_VALUE)
2355
3065
  return value;
2356
3066
  const parsed = ApplicationDocumentFactSpecificationSchema.safeParse(value);
2357
3067
  return parsed.success ? overlayComputedDocumentFacts(parsed.data, answers) : value;
@@ -2365,8 +3075,6 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2365
3075
  */
2366
3076
  withComputedDocumentFacts(input, state) {
2367
3077
  const answers = state.computedDocumentFactAnswers ?? [];
2368
- if (answers.length === 0)
2369
- return input;
2370
3078
  const overlaid = this.documentFactsWithComputedOverlay({ artifactsByFamily: input, computedDocumentFactAnswers: answers });
2371
3079
  if (overlaid !== undefined)
2372
3080
  input.set('document-facts', overlaid);
@@ -2409,6 +3117,30 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2409
3117
  }
2410
3118
  return set.candidates;
2411
3119
  }
3120
+ /**
3121
+ * The application's line scope from the creator's answers ALONE (#1639) — what
3122
+ * {@link readArtifactState} derives, without the git freshness, build-plan and document-fact reads
3123
+ * that make a full state cost minutes. Same inputs, same resolver: the dossier as the specification
3124
+ * companion exports carry it (the load is cached by tree signature, so the full read that may follow
3125
+ * does not pay for it twice), and the whole compiled catalog.
3126
+ *
3127
+ * A read that FAILS answers no scope, and the choreography decides the slow way. This is an
3128
+ * optimisation and must never be a new way for a run to fail: the loop's first tree read performs the
3129
+ * same load, so a genuine failure still surfaces — there, with that read's own context.
3130
+ */
3131
+ async readApplicationLineScope() {
3132
+ try {
3133
+ const exports = (await loadSpecificationsCompanionExports(this.companionContext));
3134
+ const field = APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS
3135
+ .find((binding) => binding.family === ApplicationSpecificationFamily.CREATOR_INPUTS)?.companionExportsField;
3136
+ const creatorInputs = (field === undefined ? undefined : exports[field] ?? undefined);
3137
+ return resolveApplicationLineScope({ catalog: readCompiledApplicationLineCatalog(), creatorInputs });
3138
+ }
3139
+ catch (error) {
3140
+ this.logDebug('The application line could not be read before the tree; the choreography reads it the slow way', { error: describeCaughtError(error) });
3141
+ return undefined;
3142
+ }
3143
+ }
2412
3144
  async readArtifactState() {
2413
3145
  const artifactsByFamily = new Map();
2414
3146
  const specificationsPackageRoot = this.companionContext.resolvedSpecifications?.packageRoot;
@@ -2443,28 +3175,54 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2443
3175
  * time it is asked.
2444
3176
  */
2445
3177
  const draftArtifactsByFamily = await this.readLandedDraftArtifacts(specificationsPackageRoot);
3178
+ /*
3179
+ * The application's main line (#1603). Supplied on EVERY state this host builds, because this state
3180
+ * is where every door that starts a playbook meets the line: the run route, the workbench dispatch,
3181
+ * the conversation tool, resume, the loop and each nested choreography level all ask eligibility on it.
3182
+ */
3183
+ const creatorInputs = artifactsByFamily.get(ApplicationSpecificationFamily.CREATOR_INPUTS);
3184
+ const catalog = await this.readParsedCatalog();
3185
+ // The line is walked over the WHOLE compiled catalog, structurally: a composite failing the full contract
3186
+ // must not take its subtree out of the line (see readCompiledApplicationLineCatalog).
3187
+ const applicationLine = resolveApplicationLineScope({ catalog: readCompiledApplicationLineCatalog(), creatorInputs });
3188
+ /*
3189
+ * A family the line declares not applicable is HIDDEN, even when a file for it exists (#1604): one left
3190
+ * by a previous line, or written by hand, is not truth about this application. Hidden here, BEFORE git
3191
+ * freshness and everything else is derived, so eligibility, briefs, staleness and the build all agree.
3192
+ * The file is never deleted: it records an earlier decision, and it comes back if the line switches back.
3193
+ */
3194
+ const ignoredLandedFamilies = [...applicationLine.notApplicableFamilies].filter((family) => artifactsByFamily.has(family)).sort();
3195
+ for (const family of applicationLine.notApplicableFamilies)
3196
+ artifactsByFamily.delete(family);
3197
+ /*
3198
+ * A family a DECISION has set aside (#1606): every playbook producing it is gated on a decision now
3199
+ * decided otherwise, e.g. a website plan whose composition since declined the website. Hidden like a
3200
+ * not-applicable family, for the same reason and before the same derivations; the file is kept, and is
3201
+ * visible again the moment the decision flips back.
3202
+ */
3203
+ const deactivatedFamilies = collectFamiliesDeactivatedByDecisions({ playbooks: catalog, artifactsByFamily });
3204
+ for (const entry of deactivatedFamilies)
3205
+ artifactsByFamily.delete(entry.family);
2446
3206
  const familyGitFreshness = await this.resolveFamilyGitFreshness([...artifactsByFamily.keys()]);
2447
3207
  const buildPlanExecution = artifactsByFamily.has('build-plan')
2448
3208
  ? await this.resolveBuildPlanExecutionState(familyGitFreshness)
2449
3209
  : undefined;
2450
3210
  const computedDocumentFactAnswers = await this.computeDocumentFactAnswers(exports);
2451
3211
  /*
2452
- * The creator's answers as an IMPLICIT INPUT of the playbooks they were given to (#1454, Step 8):
2453
- * per playbook, the latest `answeredAt` the landed dossier holds. Per answer rather than per file —
3212
+ * The creator's answers as an IMPLICIT INPUT of the playbooks that READ them (#1454, Step 8): per
3213
+ * playbook, the latest `answeredAt` among the answers it reads. Per answer rather than per file —
2454
3214
  * the dossier is one family for every interview, so its commit time would make a vision answer
2455
- * stale-flag the market snapshot. An unreadable instant is skipped: it cannot be shown to postdate
2456
- * anything, and a wrong "stale" is the direction that costs a run.
3215
+ * stale-flag the market snapshot. Per READING playbook rather than per recording one, through the
3216
+ * runtime's shared-decision resolution, so a decision answered once at its owner also dates the
3217
+ * step that asks it through `sameDecisionAs` (gap-4 review).
2457
3218
  */
2458
- const creatorInputAnsweredAtByPlaybook = new Map();
2459
- const creatorInputs = artifactsByFamily.get(ApplicationSpecificationFamily.CREATOR_INPUTS);
2460
- for (const answer of Array.isArray(creatorInputs?.answers) ? creatorInputs.answers : []) {
2461
- const answeredAt = Math.floor(Date.parse(answer.answeredAt) / 1000);
2462
- if (Number.isNaN(answeredAt))
2463
- continue;
2464
- creatorInputAnsweredAtByPlaybook.set(answer.playbookRef, Math.max(creatorInputAnsweredAtByPlaybook.get(answer.playbookRef) ?? 0, answeredAt));
2465
- }
3219
+ const creatorInputAnsweredAtByPlaybook = Array.isArray(creatorInputs?.answers) && creatorInputs.answers.length > 0
3220
+ ? buildCreatorInputAnsweredAtByPlaybook(catalog, creatorInputs)
3221
+ : new Map();
2466
3222
  return {
2467
3223
  artifactsByFamily,
3224
+ applicationLine: ignoredLandedFamilies.length > 0 ? { ...applicationLine, ignoredLandedFamilies } : applicationLine,
3225
+ ...(deactivatedFamilies.length > 0 ? { deactivatedFamilies } : {}),
2468
3226
  familyGitFreshness,
2469
3227
  ...(creatorInputAnsweredAtByPlaybook.size > 0 ? { creatorInputAnsweredAtByPlaybook } : {}),
2470
3228
  ...(draftArtifactsByFamily.size > 0 ? { draftArtifactsByFamily } : {}),
@@ -2611,6 +3369,11 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2611
3369
  * because choosing again from unchanged state would spend without progressing.
2612
3370
  */
2613
3371
  async runPlaybookLoop(input) {
3372
+ // The loop's OWN steps — the gate and the model's choice between iterations — are work a restart
3373
+ // kills too, not only its lanes; counted for its whole life like any run.
3374
+ return this.whileInFlight(() => this.runPlaybookLoopCounted(input));
3375
+ }
3376
+ async runPlaybookLoopCounted(input) {
2614
3377
  let loopFailureMeasurement;
2615
3378
  /** Rounds the loop's lanes inherited from checkpoints, fulfilled or failed — for the loop's own failure record (#1507). */
2616
3379
  const lanesInherited = { rounds: 0 };
@@ -2672,7 +3435,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2672
3435
  });
2673
3436
  }
2674
3437
  catch (error) {
2675
- throw await this.nameTheRunHoldingTheSubject(error, MetaWorkflowsExclusiveSubject.LOOP, input.session);
3438
+ throw await this.nameTheRunHoldingTheSubject(error, MetaWorkflowsExclusiveSubject.LOOP, MetaWorkflowsExclusiveSubject.LOOP, input.session);
2676
3439
  }
2677
3440
  }
2678
3441
  async executePlaybookLoop(input, lanesInherited = { rounds: 0 }) {
@@ -2830,9 +3593,18 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2830
3593
  */
2831
3594
  async staffExpertPanels(input) {
2832
3595
  const catalog = await this.readParsedCatalog();
3596
+ /*
3597
+ * Only the panels this application's line convenes (#1605): an internal tool runs no brand identity,
3598
+ * so it seats no art director, brand strategist or copy chief, and staffing them would spend a
3599
+ * derivation on roles nothing will ever convene.
3600
+ */
3601
+ const lineScope = input.artifactState.applicationLine;
2833
3602
  const roster = collectConvenedExpertRoles({
2834
- playbooks: catalog,
2835
- additionalConveners: [{ label: 'generation-step:logo', roleRefs: LOGO_PANEL_ROLE_REFS }],
3603
+ playbooks: lineScope ? catalog.filter((playbook) => lineScope.admittedPlaybookRefs.has(playbook.ref)) : catalog,
3604
+ // The logo step's panel shapes a mark from the BRAND, so a line where the brand does not apply convenes it never.
3605
+ additionalConveners: isFamilyNotApplicable(lineScope, ApplicationSpecificationFamily.BRAND_BRIEF)
3606
+ ? []
3607
+ : [{ label: 'generation-step:logo', roleRefs: LOGO_PANEL_ROLE_REFS }],
2836
3608
  });
2837
3609
  const committed = new Set(committedCharterRoleRefs(input.artifactState.artifactsByFamily.get(ApplicationSpecificationFamily.EXPERT_PERSONAS)));
2838
3610
  const alreadyCommitted = [];
@@ -2849,6 +3621,9 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2849
3621
  .filter((family) => {
2850
3622
  if (family === null)
2851
3623
  return false;
3624
+ // A family that does not apply to the line is not WAITED for (#1604): the derivation says so instead.
3625
+ if (isFamilyNotApplicable(input.artifactState.applicationLine, family))
3626
+ return false;
2852
3627
  // Present-but-unreadable (`FILE_PRESENT_WITHOUT_VALUE`) counts as MISSING: the derivation reads the
2853
3628
  // family's VALUE through introspection and would throw on a file-only presence — the same three-way
2854
3629
  // test the foundation branch makes on the domain plan.
@@ -2921,7 +3696,9 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2921
3696
  * ## Why the checkpoint, and not a held-open request
2922
3697
  *
2923
3698
  * A suspension can outlive its HTTP request — a creator answers when they get to it, not inside a
2924
- * socket timeout — so the run's inputs are written to disk and the request returns. This is the
3699
+ * socket timeout — so the run's inputs are saved as a checkpoint on its own execution row (the
3700
+ * engine's suspended actor execution, read back by `readSuspensionCheckpoint`) and the request
3701
+ * returns. This is the
2925
3702
  * shape LangGraph gives `interrupt()` (a checkpointer plus `Command(resume=…)`), Step Functions
2926
3703
  * gives `waitForTaskToken`, and Temporal gives signals: the wait is DURABLE state, never a blocked
2927
3704
  * thread.
@@ -2936,8 +3713,9 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2936
3713
  * ## The three actions, from MCP's elicitation vocabulary
2937
3714
  *
2938
3715
  * `ACCEPT` carries answers. `DECLINE` means "decide it yourself and say what you assumed" — the run
2939
- * proceeds with no further questions. `CANCEL` abandons it: the checkpoint is consumed and nothing
2940
- * runs. The three are distinct on purpose — a decline is a delegation, a cancel is a withdrawal,
3716
+ * proceeds with no further questions. `CANCEL` abandons it: the engine moves the waiting execution
3717
+ * to `CANCELLED` (`cancelSuspendedActorExecution`), so nothing runs and the round can no longer be
3718
+ * answered. The three are distinct on purpose — a decline is a delegation, a cancel is a withdrawal,
2941
3719
  * and collapsing them would make "I do not want to answer" indistinguishable from "stop".
2942
3720
  */
2943
3721
  async resumePlaybookRun(input) {
@@ -2947,13 +3725,41 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2947
3725
  * answerable. So the checkpoint is read and the answers validated first, and only then does the
2948
3726
  * engine move the rows and continue the run UNDER THE SAME ID.
2949
3727
  */
2950
- const checkpoint = await this.readSuspensionCheckpoint(input.runId, input.session);
2951
- if (input.action === PlaybookClarificationAction.CANCEL) {
2952
- await this.actorsSystem.cancelSuspendedActorExecution(input.runId, input.session);
2953
- return { status: 'cancelled', runId: input.runId, playbookRef: checkpoint.playbookRef };
3728
+ const { checkpoint, suspensionRef } = await this.readSuspensionCheckpoint(input.runId, input.session);
3729
+ /*
3730
+ * WHO first, before anything that describes the question (#1751 review F4, N1). The round in a
3731
+ * superseded refusal and the refs and options in a validation refusal describe it, so the ENGINE is
3732
+ * asked first whether this person may settle it: the same authorization a settle runs, recording a
3733
+ * refused attempt, and refusing it as it refuses an unknown run. Such a person's REFUSAL therefore
3734
+ * says nothing about the question. (The listings still show a waiting question to every viewer of
3735
+ * the board; this governs refusals only.) The engine decides again when the rows move.
3736
+ */
3737
+ await this.actorsSystem.authorizeSuspendedActorDecision(input.runId, input.actingUserId ? { actor: humanDecisionSettler(input.actingUserId) } : undefined, input.session).catch(() => { throw new SuspendedPlaybookRunNotFoundError(input.runId); });
3738
+ if (checkpoint.round !== input.round)
3739
+ throw new SupersededPlaybookRunQuestionError(input.runId, input.round, checkpoint.round);
3740
+ if (input.action === MetaWorkflow_ClarificationAction.CANCEL) {
3741
+ // Held to the round that was read, like a resume: a round asked since is refused, never withdrawn (#1584).
3742
+ await this.actorsSystem.cancelSuspendedActorExecution(input.runId, input.session, {
3743
+ expectedSuspensionRef: suspensionRef,
3744
+ // Who withdraws it (#1751): the engine refuses a routed question's withdrawal by anybody else.
3745
+ ...(input.actingUserId ? { decision: { actor: humanDecisionSettler(input.actingUserId) } } : {}),
3746
+ })
3747
+ .catch(async (error) => { throw await this.explainLateDecision(error, input); });
3748
+ return { status: Workbench_PlaybookRunOutcomeStatus.CANCELLED, runId: input.runId, playbookRef: checkpoint.playbookRef };
2954
3749
  }
2955
- const answers = input.action === PlaybookClarificationAction.ACCEPT
2956
- ? validateClarificationAnswers({ requests: checkpoint.requests, priorAnswers: checkpoint.priorAnswers, answers: input.answers ?? [] })
3750
+ /*
3751
+ * ACCEPT answers the whole round; DECLINE may carry the answers the creator DID give and delegates the
3752
+ * rest (#1658) — both validated by the same owner, so a partial decline cannot smuggle an answer the
3753
+ * round never asked or a choice outside its options.
3754
+ */
3755
+ const answers = input.action === MetaWorkflow_ClarificationAction.ACCEPT
3756
+ || (input.action === MetaWorkflow_ClarificationAction.DECLINE && (input.answers?.length ?? 0) > 0)
3757
+ ? validateClarificationAnswers({
3758
+ requests: checkpoint.requests,
3759
+ priorAnswers: checkpoint.priorAnswers,
3760
+ answers: (input.answers ?? []).map((answer) => (input.answeredByRef && !answer.answeredByRef ? { ...answer, answeredByRef: input.answeredByRef } : answer)),
3761
+ requireEveryQuestion: input.action === MetaWorkflow_ClarificationAction.ACCEPT,
3762
+ })
2957
3763
  : checkpoint.priorAnswers;
2958
3764
  /*
2959
3765
  * The leg that ran BEFORE the question (#1507). The engine replaces the task output when the
@@ -2979,8 +3785,12 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2979
3785
  }
2980
3786
  : recordedLeg;
2981
3787
  try {
2982
- return await this.actorsSystem.resumeActorExecution(input.runId, (opened) => this.executePlaybookRun({
3788
+ // Counted for the continuation's whole life, settle included: a resumed run is a run, and the
3789
+ // supervisor must hold a restart for it as for a fresh one.
3790
+ return await this.whileInFlight(() => this.actorsSystem.resumeActorExecution(input.runId, (opened) => this.executePlaybookRun({
2983
3791
  playbookRef: checkpoint.playbookRef,
3792
+ // The resume continues the SAME instance (#1609): its answers, its landing, its row.
3793
+ ...(checkpoint.instanceKey ? { instanceKey: checkpoint.instanceKey } : {}),
2984
3794
  clarification: {
2985
3795
  requests: checkpoint.requests,
2986
3796
  answers,
@@ -2990,6 +3800,8 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2990
3800
  ...(checkpoint.creatorBrief ? { creatorBrief: checkpoint.creatorBrief } : {}),
2991
3801
  ...(checkpoint.selectionRationale ? { selectionRationale: checkpoint.selectionRationale } : {}),
2992
3802
  ...(checkpoint.elicitationAnswers.length > 0 ? { elicitationAnswers: checkpoint.elicitationAnswers } : {}),
3803
+ // The run's starter, so a question the continuation asks is routed to them again (#1751).
3804
+ ...(checkpoint.requestedByUserId ? { requestedByUserId: checkpoint.requestedByUserId } : {}),
2993
3805
  ...(input.session ? { session: input.session } : {}),
2994
3806
  dryRun: checkpoint.dryRun || input.dryRun === true,
2995
3807
  runId: opened.executionId,
@@ -2999,6 +3811,23 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
2999
3811
  // that goes back to waiting carries what both legs spent (#1507), over the waiting record.
3000
3812
  {
3001
3813
  ...this.playbookRunOptions,
3814
+ // The suspension that was read: a round asked since then is refused before anything moves (#1584).
3815
+ expectedSuspensionRef: suspensionRef,
3816
+ /*
3817
+ * Who settles it and what they answered (#1751): checked against the question's route, and
3818
+ * recorded as the resolution on the status change whether the question was routed or not.
3819
+ */
3820
+ decision: {
3821
+ ...(input.actingUserId ? { actor: humanDecisionSettler(input.actingUserId) } : {}),
3822
+ answer: {
3823
+ decisionId: input.runId,
3824
+ optionRef: input.action,
3825
+ // This round's answers, as validated (a confirmation normalized), never an earlier round's.
3826
+ values: answers
3827
+ .filter((answer) => !checkpoint.priorAnswers.some((prior) => prior.ref === answer.ref))
3828
+ .map((answer) => ({ ref: answer.ref, value: answer.answer })),
3829
+ },
3830
+ },
3002
3831
  restoreSuspensionOnFailure: true,
3003
3832
  outputOnRestoredSuspension: (error) => {
3004
3833
  const measurement = this.measurementOfFailure(error, input.runId);
@@ -3010,31 +3839,52 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3010
3839
  // the engine clears it; the spend still reads PARTIAL for the leg that was not read.
3011
3840
  const waiting = typeof waitingOutput === 'object' && waitingOutput !== null
3012
3841
  ? waitingOutput
3013
- : summarizePlaybookRunResult({ status: 'awaiting_creator_input', accepted: false, dryRun: checkpoint.dryRun, family: checkpoint.family, round: checkpoint.round });
3842
+ : summarizePlaybookRunResult({ status: Workbench_PlaybookRunOutcomeStatus.AWAITING_CREATOR_INPUT, accepted: false, dryRun: checkpoint.dryRun, family: checkpoint.family, round: checkpoint.round });
3014
3843
  return { ...waiting, measurement };
3015
3844
  },
3016
- });
3845
+ }));
3846
+ }
3847
+ catch (error) {
3848
+ throw await this.explainLateDecision(error, input);
3017
3849
  }
3018
3850
  finally {
3019
3851
  this.failedRunMeasurements.delete(input.runId);
3020
3852
  }
3021
3853
  }
3854
+ /**
3855
+ * The engine refuses a decision on a run that moved between this service's read and its own
3856
+ * (`ACTOR_EXECUTION_NOT_SUSPENDED`, #1584 review F5). Said in the terms every door already answers:
3857
+ * the run asked again (409, superseded) or is no longer waiting (404). Any other error passes unchanged.
3858
+ */
3859
+ async explainLateDecision(error, input) {
3860
+ if (!isActorExecutionNotSuspendedError(error))
3861
+ return error;
3862
+ try {
3863
+ const { checkpoint } = await this.readSuspensionCheckpoint(input.runId, input.session);
3864
+ return checkpoint.round !== input.round
3865
+ ? new SupersededPlaybookRunQuestionError(input.runId, input.round, checkpoint.round)
3866
+ : new SuspendedPlaybookRunNotFoundError(input.runId);
3867
+ }
3868
+ catch {
3869
+ return new SuspendedPlaybookRunNotFoundError(input.runId);
3870
+ }
3871
+ }
3022
3872
  /**
3023
3873
  * The waiting run's resume inputs, parsed. "Not waiting" — no such row, a row that is not
3024
3874
  * suspended, or a checkpoint this version cannot read — is one answer to a resume, and it is 404.
3025
3875
  */
3026
3876
  async readSuspensionCheckpoint(runId, session) {
3027
- let context;
3877
+ let waiting;
3028
3878
  try {
3029
- context = (await this.actorsSystem.readSuspendedActorExecution(runId, session)).row.checkpoint?.context;
3879
+ waiting = await this.actorsSystem.readSuspendedActorExecution(runId, session);
3030
3880
  }
3031
3881
  catch {
3032
3882
  throw new SuspendedPlaybookRunNotFoundError(runId);
3033
3883
  }
3034
- const parsed = PlaybookRunSuspensionCheckpointSchema.safeParse(context);
3884
+ const parsed = PlaybookRunSuspensionCheckpointSchema.safeParse(waiting.row.checkpoint?.context);
3035
3885
  if (!parsed.success)
3036
3886
  throw new SuspendedPlaybookRunNotFoundError(runId);
3037
- return parsed.data;
3887
+ return { checkpoint: parsed.data, suspensionRef: actorExecutionSuspensionRef(waiting.suspension) };
3038
3888
  }
3039
3889
  /**
3040
3890
  * How the engine reads what a playbook run RETURNED: a run that stopped to ask registered its
@@ -3045,6 +3895,10 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3045
3895
  suspensionRequests = new WeakMap();
3046
3896
  /** Each measured result's wall-clock and spend (#1507) — see `createPlaybookRunOptions`. */
3047
3897
  runMeasurements = new WeakMap();
3898
+ /** The root runs each ROOT run's settled value overlapped (#1610) — read into its row summary like its measurement. */
3899
+ runOverlaps = new WeakMap();
3900
+ /** A FAILED root run's overlaps by run id, for a thrown value no WeakMap can key. Cleared when the run settles. */
3901
+ failedRunOverlaps = new Map();
3048
3902
  /** A FAILED run's measurement by run id (#1507) — for a thrown value no WeakMap can key. Cleared when the run settles. */
3049
3903
  failedRunMeasurements = new Map();
3050
3904
  /** Iterations a composite adopted from a checkpoint, by run id (#1507) — read by `executePlaybookRun` whatever the outcome. */
@@ -3064,12 +3918,18 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3064
3918
  return {
3065
3919
  ...this.playbookRunOptions,
3066
3920
  recordBesideFailure: (error) => {
3067
- const measurement = this.measurementOfFailure(error, runIdOf());
3068
- return measurement ? { measurement } : null;
3921
+ const runId = runIdOf();
3922
+ const measurement = this.measurementOfFailure(error, runId);
3923
+ const overlappedRuns = (typeof error === 'object' && error !== null ? this.runOverlaps.get(error) : undefined)
3924
+ ?? (runId !== undefined ? this.failedRunOverlaps.get(runId) : undefined);
3925
+ if (runId !== undefined)
3926
+ this.failedRunOverlaps.delete(runId);
3927
+ const beside = { ...(measurement ? { measurement } : {}), ...(overlappedRuns && overlappedRuns.length > 0 ? { overlappedRuns } : {}) };
3928
+ return Object.keys(beside).length > 0 ? beside : null;
3069
3929
  },
3070
3930
  };
3071
3931
  }
3072
- playbookRunOptions = createPlaybookRunOptions(this.suspensionRequests, this.runMeasurements);
3932
+ playbookRunOptions = createPlaybookRunOptions(this.suspensionRequests, this.runMeasurements, this.runOverlaps);
3073
3933
  /**
3074
3934
  * Every choreography that ENDED without concluding and left its progress on its execution row —
3075
3935
  * an orphan settled `ABORTED` at startup, a run that threw, or one that stopped for its environment.
@@ -3088,13 +3948,15 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3088
3948
  }
3089
3949
  async listInterruptedChoreographies() {
3090
3950
  try {
3091
- // One per composite: re-running a ref adopts its NEWEST checkpoint, so that is the one to name.
3951
+ // One per composite INSTANCE (#1609): re-running an instance adopts its NEWEST checkpoint, so that is the one to name.
3092
3952
  const newestByRef = new Map();
3093
3953
  for (const entry of await this.readResumableChoreographies()) {
3094
- if (newestByRef.has(entry.context.playbookRef))
3954
+ const instanceId = playbookInstanceId(entry.context.playbookRef, entry.context.instanceKey);
3955
+ if (newestByRef.has(instanceId))
3095
3956
  continue;
3096
- newestByRef.set(entry.context.playbookRef, {
3957
+ newestByRef.set(instanceId, {
3097
3958
  playbookRef: entry.context.playbookRef,
3959
+ ...(entry.context.instanceKey ? { instanceKey: entry.context.instanceKey } : {}),
3098
3960
  completedIterations: entry.context.completedIterations,
3099
3961
  stepRefs: entry.context.stepResults.map((step) => step.ref),
3100
3962
  checkpointedAt: entry.checkpointedAt,
@@ -3116,10 +3978,11 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3116
3978
  * from the row it came from, so at every instant exactly one row carries it — a host that dies
3117
3979
  * between the two leaves it on both, which a later adoption resolves by taking the newest.
3118
3980
  */
3119
- async adoptChoreographyCheckpoint(playbookRef, runId, session) {
3981
+ async adoptChoreographyCheckpoint(playbookRef, instanceKey, runId, session) {
3120
3982
  let source;
3121
3983
  try {
3122
- source = (await this.readResumableChoreographies(session)).find((entry) => entry.context.playbookRef === playbookRef && entry.executionId !== runId);
3984
+ source = (await this.readResumableChoreographies(session)).find((entry) => entry.context.playbookRef === playbookRef
3985
+ && entry.context.instanceKey === instanceKey && entry.executionId !== runId);
3123
3986
  if (!source)
3124
3987
  return null;
3125
3988
  await this.actorsSystem.saveActorExecutionCheckpoint(runId, source.context, session);
@@ -3139,11 +4002,13 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3139
4002
  * because its progress note could not be written would be strictly worse than one that merely
3140
4003
  * cannot resume.
3141
4004
  */
3142
- async saveChoreographyCheckpoint(runId, snapshot, session) {
4005
+ async saveChoreographyCheckpoint(runId, snapshot, session, instanceKey) {
3143
4006
  try {
3144
4007
  const context = PlaybookChoreographyCheckpointContextSchema.parse({
3145
4008
  kind: PlaybookRunCheckpointKind.CHOREOGRAPHY,
3146
4009
  ...choreographyProgressToContext(snapshot),
4010
+ // The INSTANCE whose progress this is (#1609), so only that instance adopts it.
4011
+ ...(instanceKey ? { instanceKey } : {}),
3147
4012
  });
3148
4013
  await this.actorsSystem.saveActorExecutionCheckpoint(runId, context, session);
3149
4014
  }
@@ -3183,6 +4048,11 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3183
4048
  * SAME id. There is no checkpoint file and no second handle.
3184
4049
  */
3185
4050
  async runPlaybook(input) {
4051
+ // In flight for its whole life, settle included, so the dev supervisor holds a restart for it
4052
+ // exactly as for a detached run.
4053
+ return this.whileInFlight(() => this.runPlaybookCounted(input));
4054
+ }
4055
+ async runPlaybookCounted(input) {
3186
4056
  let runId;
3187
4057
  try {
3188
4058
  return await this.actorsSystem.runActorExecution(this.buildActorExecutionRequest(input), (opened) => {
@@ -3191,11 +4061,12 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3191
4061
  }, this.playbookRunOptionsFor(() => runId));
3192
4062
  }
3193
4063
  catch (error) {
3194
- // Only a run that ASKED for the composite subject can have been refused it; anything else that
4064
+ // Only a run that ASKED for a composite subject can have been refused it; anything else that
3195
4065
  // surfaces here came from inside the run and keeps its own name.
3196
- if (this.resolveExclusiveSubject(input) === undefined)
4066
+ const subject = this.resolveExclusiveSubject(input);
4067
+ if (subject === undefined)
3197
4068
  throw error;
3198
- throw await this.nameTheRunHoldingTheSubject(error, MetaWorkflowsExclusiveSubject.COMPOSITE, input.session);
4069
+ throw await this.nameTheRunHoldingTheSubject(error, MetaWorkflowsExclusiveSubject.COMPOSITE, subject, input.session);
3199
4070
  }
3200
4071
  finally {
3201
4072
  if (runId !== undefined)
@@ -3203,8 +4074,8 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3203
4074
  }
3204
4075
  }
3205
4076
  /**
3206
- * Does this run hold the COMPOSITE single-flight subject? Exactly when the playbook DECLARES a
3207
- * choreography and the run is not nested inside another composite — see
4077
+ * The single-flight subject this run holds, if any: its composite INSTANCE's (#1610), exactly when the
4078
+ * playbook DECLARES a choreography and the run is not nested inside another composite — see
3208
4079
  * `MetaWorkflowsExclusiveSubject.COMPOSITE`. Read off the compiled catalog without parsing it: an
3209
4080
  * unknown or malformed playbook holds nothing here and is refused by name inside the run.
3210
4081
  */
@@ -3212,7 +4083,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3212
4083
  if (input.nestedWithinChoreographyRef !== undefined)
3213
4084
  return undefined;
3214
4085
  const compiled = getFrameworkKnowledgePlaybook(input.playbookRef)?.playbook;
3215
- return compiled?.method?.choreography ? MetaWorkflowsExclusiveSubject.COMPOSITE : undefined;
4086
+ return compiled?.method?.choreography ? compositeExclusiveSubject(input.playbookRef, input.instanceKey) : undefined;
3216
4087
  }
3217
4088
  /**
3218
4089
  * Turn the engine's single-flight refusal into THIS lane's typed one, naming the run that holds the
@@ -3222,7 +4093,9 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3222
4093
  * The transport maps both typed errors to 409. The holder is read from the rows, so the message is
3223
4094
  * as true after a restart or from a second process as it is inside the one that started the run.
3224
4095
  */
3225
- async nameTheRunHoldingTheSubject(error, subject, session) {
4096
+ async nameTheRunHoldingTheSubject(error, kind,
4097
+ /** The leased string: the kind for the loop, `composite:<instance id>` for a composite (#1610). */
4098
+ subject, session) {
3226
4099
  if (!isActorExecutionSubjectBusyError(error))
3227
4100
  return error;
3228
4101
  let held = 'a run this process could not read';
@@ -3233,7 +4106,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3233
4106
  const task = row.standaloneTasks[0];
3234
4107
  const playbookRef = task?.context?.correlation?.refs?.['playbookRef'];
3235
4108
  const goal = task?.input?.goal;
3236
- held = subject === MetaWorkflowsExclusiveSubject.LOOP
4109
+ held = kind === MetaWorkflowsExclusiveSubject.LOOP
3237
4110
  ? `goal "${typeof goal === 'string' ? goal : 'unknown'}", execution ${holder._id}, started ${row.createdAt}`
3238
4111
  : `playbook "${typeof playbookRef === 'string' ? playbookRef : 'unknown'}", execution ${holder._id}, started ${row.createdAt}`;
3239
4112
  }
@@ -3241,13 +4114,13 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3241
4114
  catch {
3242
4115
  // Naming the holder is a courtesy; the refusal stands without it.
3243
4116
  }
3244
- return subject === MetaWorkflowsExclusiveSubject.LOOP
4117
+ return kind === MetaWorkflowsExclusiveSubject.LOOP
3245
4118
  ? new PlaybookLoopAlreadyRunningError(`A playbook loop is already running (${held}). One loop per application: wait for it. A loop whose companion died is `
3246
4119
  + 'released when the companion next starts, which settles it ABORTED.')
3247
- : new PlaybookChoreographyAlreadyRunningError(`A composite is already running (${held}). One composite per application: two of them share this working tree, and a `
3248
- + 'second run of the same composite would adopt the first one\'s progress checkpoint mid-flight and continue a run that is '
3249
- + 'still going. Wait for it, or watch it with GET /api/companion/playbooks/runs. A composite whose companion died is '
3250
- + 'released when the companion next starts, which settles it ABORTED and keeps its checkpoint.');
4120
+ : new PlaybookChoreographyAlreadyRunningError(`This composite instance is already running (${held}). One run per instance: a second would adopt the first one's `
4121
+ + 'progress checkpoint mid-flight and continue a run that is still going. Wait for it, or run it as another instance '
4122
+ + '(open one for its own purpose), or watch it with GET /api/companion/playbooks/runs. A composite whose companion died '
4123
+ + 'is released when the companion next starts, which settles it ABORTED and keeps its checkpoint.');
3251
4124
  }
3252
4125
  /**
3253
4126
  * What the actor plane records about a playbook run: one task for the PROGRAMMATIC playbook-run
@@ -3262,14 +4135,24 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3262
4135
  actorRef: META_WORKFLOWS_PLAYBOOK_RUN_ACTOR_REF,
3263
4136
  ...(exclusiveSubject ? { exclusiveSubject } : {}),
3264
4137
  task: {
3265
- title: `Playbook run ${input.playbookRef}`,
3266
- description: `Meta-workflow playbook run of ${input.playbookRef}.`,
4138
+ title: `Playbook run ${playbookInstanceId(input.playbookRef, input.instanceKey)}`,
4139
+ description: `Meta-workflow playbook run of ${playbookInstanceId(input.playbookRef, input.instanceKey)}.`,
3267
4140
  topic: Actor_Task_Topics.METHOD_STEP,
3268
- input: { playbookRef: input.playbookRef, dryRun: input.dryRun === true },
4141
+ // The creator's brief is RECORDED (#1608): a composite once dropped it without trace, and a row that says what it was asked is how that shows.
4142
+ input: {
4143
+ playbookRef: input.playbookRef,
4144
+ ...(input.instanceKey ? { instanceKey: input.instanceKey } : {}),
4145
+ ...(input.creatorBrief ? { creatorBrief: input.creatorBrief } : {}),
4146
+ dryRun: input.dryRun === true,
4147
+ },
3269
4148
  correlation: {
3270
4149
  domain: META_WORKFLOWS_CORRELATION_DOMAIN,
3271
4150
  refs: {
3272
4151
  playbookRef: input.playbookRef,
4152
+ // The INSTANCE on the durable row (#1609): every read built from the rows tells instances apart by it.
4153
+ ...(input.instanceKey ? { instanceKey: input.instanceKey } : {}),
4154
+ // A CHILD names its tree's root (#1610), so the root's overlap record can leave its own children out.
4155
+ ...(input.rootRunId ? { rootRunId: input.rootRunId } : {}),
3273
4156
  ...(input.session ? { traceSessionId: input.session.sessionId } : {}),
3274
4157
  ...(input.conversationId ? { [WorkbenchTaskCorrelationRef.CONVERSATION]: input.conversationId } : {}),
3275
4158
  },
@@ -3307,6 +4190,10 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3307
4190
  * none — then that leg is an unobserved segment, so the total reads as a floor. Absent on a fresh run.
3308
4191
  */
3309
4192
  priorLeg) {
4193
+ // Counted here as well as at every entry, so a caller added later is covered while it executes.
4194
+ return this.whileInFlight(() => this.executePlaybookRunCounted(input, priorLeg));
4195
+ }
4196
+ async executePlaybookRunCounted(input, priorLeg) {
3310
4197
  const startedAtMs = Date.now();
3311
4198
  const measured = await this.spendMeter.measure(() => this.executePlaybookRunUnmeasured(input));
3312
4199
  /*
@@ -3329,6 +4216,16 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3329
4216
  const settledWith = measured.settled.status === 'rejected' ? measured.settled.reason : measured.settled.value;
3330
4217
  if (typeof settledWith === 'object' && settledWith !== null)
3331
4218
  this.runMeasurements.set(settledWith, measurement);
4219
+ // A ROOT run says which other root runs it shared the tree with (#1610); a child's root says it for the tree.
4220
+ if (input.rootRunId === undefined) {
4221
+ const overlaps = await this.readOverlappingRootRuns(input.runId, new Date(startedAtMs).toISOString(), input.session);
4222
+ if (overlaps.length > 0) {
4223
+ if (typeof settledWith === 'object' && settledWith !== null)
4224
+ this.runOverlaps.set(settledWith, overlaps);
4225
+ if (measured.settled.status === 'rejected')
4226
+ this.failedRunOverlaps.set(input.runId, overlaps);
4227
+ }
4228
+ }
3332
4229
  // By run id as well for a failure: a thrown value that is not an object cannot key the WeakMap, so the
3333
4230
  // run id is what carries its spend to the row (the call site clears the entry once the run has settled).
3334
4231
  if (measured.settled.status === 'rejected') {
@@ -3340,6 +4237,23 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3340
4237
  }
3341
4238
  return measured.settled.value;
3342
4239
  }
4240
+ /**
4241
+ * The other ROOT runs whose time on this application overlapped this one's (#1610), read from the rows
4242
+ * as it settles. Best-effort by design: it is a RECORD beside the run, and a plane that cannot be read
4243
+ * at that moment costs the record, never the run's own settle. A run RESUMED after a suspension reads
4244
+ * from its original row's creation, so its window covers both legs.
4245
+ */
4246
+ async readOverlappingRootRuns(runId, fallbackStartedAt, session) {
4247
+ try {
4248
+ const executions = await this.executions.listActorExecutions(CompanionExecutionsListQuerySchema.parse({ systemRef: META_WORKFLOWS_SYSTEM_REF, limit: 200 }), session);
4249
+ const startedAt = executions.find((execution) => execution._id === runId)?.createdAt ?? fallbackStartedAt;
4250
+ return findOverlappingRootRuns(executions, { runId, startedAt, endedAt: new Date().toISOString() });
4251
+ }
4252
+ catch (error) {
4253
+ this.logDebug('Could not read the runs this one overlapped; its row goes without the record', { runId, error: describeCaughtError(error) });
4254
+ return [];
4255
+ }
4256
+ }
3343
4257
  async executePlaybookRunUnmeasured(input) {
3344
4258
  /*
3345
4259
  * THE RUN's identity — the actor execution's own id, opened by the engine before this method is
@@ -3367,6 +4281,52 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3367
4281
  if (!specificationsPackageRoot) {
3368
4282
  throw new Error('No specifications package is declared in wildo.saas.config.ts; there is nowhere to land a playbook output.');
3369
4283
  }
4284
+ /*
4285
+ * The LINE first (#1639): a playbook the application's line does not run is refused by readiness
4286
+ * whatever the tree holds, so it is refused here from the creator's answers alone, before the
4287
+ * full-state read — measured at 66 s under load on another run — that such a playbook never needed.
4288
+ * The refusal names the line, the reason that decides, rather than every unmet gate the full board
4289
+ * would add. A line that cannot be read answers no scope, and the full check below decides as before.
4290
+ * Traced as 'own-line-check', apart from the choreography's per-lane 'application-line-scope'.
4291
+ */
4292
+ const lineScope = await this.traceRunPhase(input.session, 'own-line-check', () => this.readApplicationLineScope());
4293
+ const lineRefusal = lineScope === undefined
4294
+ ? undefined
4295
+ : applicationLineRefusalOf(evaluatePlaybookEligibility({
4296
+ playbook,
4297
+ state: { artifactsByFamily: new Map(), applicationLine: lineScope },
4298
+ landableFamilies: this.resolveLandableFamilies(),
4299
+ }));
4300
+ if (lineRefusal !== undefined) {
4301
+ throw new PlaybookNotReadyError(`"${input.playbookRef}" is not ready to run: ${lineRefusal.detail}`);
4302
+ }
4303
+ /*
4304
+ * The bytes each output file holds as this run READS (#1614), taken before the inputs so nothing that
4305
+ * lands while the model works can hide inside the window. The landing refuses to replace a file that
4306
+ * moved since, instead of silently discarding whoever moved it. Held in memory for this run only.
4307
+ */
4308
+ const readBaselines = await this.traceRunPhase(input.session, 'output-landing-baselines', () => readPlaybookOutputLandingBaselines({
4309
+ specificationsPackageRoot,
4310
+ constantPrefix: LANDED_CONSTANT_PREFIX,
4311
+ outputs: (playbook.outputs ?? []).map((output) => ({ family: output.family, schemaRef: output.schemaRef })),
4312
+ }));
4313
+ const artifactState = await this.traceRunPhase(input.session, 'artifact-state', () => this.readArtifactState());
4314
+ /*
4315
+ * An INSTANCE runs only once it was opened (#1609): the dossier's activation record is where its purpose
4316
+ * lives, and a run of an instance nobody opened would land work nobody could say what it is for.
4317
+ * Refused before any model is asked, by name, with the way to open it.
4318
+ */
4319
+ /*
4320
+ * Asked of the ROOT only: a composite's child inherits its root's instance key and has no activation of
4321
+ * its own, so asking it would refuse every child of an instance composite (it did, until #1608). The root
4322
+ * was asked, and its purpose travels down as `instancePurpose`.
4323
+ */
4324
+ const instancePurpose = resolveInstanceRunPurpose({
4325
+ ...input,
4326
+ creatorInputs: artifactState.artifactsByFamily.get(ApplicationSpecificationFamily.CREATOR_INPUTS),
4327
+ });
4328
+ /* What this instance is for, in the creator's words: rendered beside the interview's answers, which is where the creator's facts go. */
4329
+ const purposeSection = instancePurpose === undefined ? '' : composeInstancePurposeSection(playbookInstanceId(input.playbookRef, input.instanceKey), instancePurpose);
3370
4330
  /*
3371
4331
  * An explicit run answers only READINESS: a playbook whose inputs are absent or invalid would produce
3372
4332
  * content derived from nothing, so that still refuses. SEQUENCING is the methodology's ordering, and an
@@ -3374,7 +4334,6 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3374
4334
  * (`.claude/rules/application-creation-directive.md`). The loop keeps its full gate; the eligibility
3375
4335
  * board keeps reporting phase information.
3376
4336
  */
3377
- const artifactState = await this.readArtifactState();
3378
4337
  const eligibility = evaluatePlaybookEligibility({
3379
4338
  playbook,
3380
4339
  state: { ...artifactState, ...(input.stepResults ? { stepResults: input.stepResults } : {}) },
@@ -3394,8 +4353,11 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3394
4353
  */
3395
4354
  const elicitationAnswers = resolveElicitationAnswers({
3396
4355
  playbookRef: input.playbookRef,
4356
+ playbook,
3397
4357
  creatorInputs: artifactState.artifactsByFamily.get(ApplicationSpecificationFamily.CREATOR_INPUTS),
3398
4358
  overrides: input.elicitationAnswers,
4359
+ // This run's INSTANCE answers first, the default instance's for the rest (#1609).
4360
+ ...(input.instanceKey ? { instanceKey: input.instanceKey } : {}),
3399
4361
  });
3400
4362
  // Refuses a missing, unknown, duplicated or out-of-vocabulary answer — see its own header.
3401
4363
  const elicitationSection = composeElicitationSection({
@@ -3421,13 +4383,31 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3421
4383
  */
3422
4384
  return this.runChoreography({
3423
4385
  playbook,
4386
+ ...(input.requestedByUserId ? { requestedByUserId: input.requestedByUserId } : {}),
4387
+ ...(input.instanceKey ? { instanceKey: input.instanceKey } : {}),
4388
+ ...(instancePurpose !== undefined ? { instancePurpose } : {}),
4389
+ ...(input.creatorBrief ? { creatorBrief: input.creatorBrief } : {}),
3424
4390
  ...(elicitationSection ? { parentElicitationSection: elicitationSection } : {}),
3425
4391
  ...(input.nestedWithinChoreographyRef ? { nestedWithinChoreographyRef: input.nestedWithinChoreographyRef } : {}),
3426
4392
  ...(input.session ? { session: input.session } : {}),
3427
4393
  ...(input.dryRun === true ? { dryRun: true } : {}),
3428
4394
  runId,
4395
+ rootRunId: input.rootRunId ?? runId,
3429
4396
  });
3430
4397
  }
4398
+ /*
4399
+ * An INSTANCE (#1609) runs as a composite (handled above) or through the generation path below, which
4400
+ * lands into keyed sets only. Every other executor acts on state the application holds ONCE: the coding
4401
+ * lane builds the application, a deterministic or human step answers for all of it, and the foundation,
4402
+ * capability composition, maturity reading and expert staffing each derive one application-wide
4403
+ * family. An instance of one of those would be the same work under a second name, so it is refused.
4404
+ */
4405
+ if (input.instanceKey !== undefined && (playbook.executor === MetaWorkflow_Executor.CODING_AGENT
4406
+ || playbook.executor === MetaWorkflow_Executor.DETERMINISTIC_CLI
4407
+ || playbook.executor === MetaWorkflow_Executor.HUMAN
4408
+ || [EXPERT_PERSONAS_PLAYBOOK_REF, CAPABILITY_COMPOSITION_PLAYBOOK_REF, APPLICATION_MATURITY_PLAYBOOK_REF, FOUNDATION_PLAYBOOK_REF].includes(input.playbookRef))) {
4409
+ throw new PlaybookNotReadyError(`"${input.playbookRef}" acts on the application as a whole, so it has no instances; run it without an instance key.`);
4410
+ }
3431
4411
  /*
3432
4412
  * The CODING_AGENT tier (issue #119).
3433
4413
  *
@@ -3633,11 +4613,16 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3633
4613
  playbookRef: input.playbookRef,
3634
4614
  verified: true,
3635
4615
  checkRefs: [...checkRefs],
3636
- checks: verification.map(({ checkRef, outcome }) => ({
3637
- checkRef,
3638
- success: outcome.success,
3639
- message: outcome.message,
3640
- })),
4616
+ checks: verification.map(({ checkRef, outcome }) => {
4617
+ // stderr first: a compiler or a crashed node process reports its cause there; tsc prints to stdout.
4618
+ const output = [outcome.stderrTail, outcome.stdoutTail].map((tail) => tail.trim()).filter((tail) => tail.length > 0).join('\n').slice(-VERIFICATION_CHECK_OUTPUT_TAIL_CHARS);
4619
+ return {
4620
+ checkRef,
4621
+ success: outcome.success,
4622
+ message: outcome.message,
4623
+ ...(!outcome.success && output.length > 0 ? { output } : {}),
4624
+ };
4625
+ }),
3641
4626
  passed: verification.every(({ outcome }) => outcome.success),
3642
4627
  ...(infrastructureError ? { infrastructureError: String(infrastructureError) } : {}),
3643
4628
  // No acceptance in the run itself: acceptance is a later commit, a person's or the posture's (#1534).
@@ -3762,7 +4747,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3762
4747
  const composeGenerationOutputs = async (effective) => {
3763
4748
  const workspaceTruthSection = await this.composeWorkspaceTruthSection(effective);
3764
4749
  const compliancePrimaryFactsSection = await this.composeCompliancePrimaryFactsSection(effective);
3765
- const documentBlueprintSection = this.composeDocumentBlueprintSection(effective, existingComplianceDocumentCandidates);
4750
+ const documentBlueprintSection = this.composeDocumentBlueprintSection(effective, existingComplianceDocumentCandidates, this.resolveDeclaredDocumentFacts(artifactState).declaredDocumentFacts);
3766
4751
  const documentFactObligationsSection = this.composeDocumentFactObligationsSection(effective);
3767
4752
  const assuranceProgramAuthoritySection = this.composeAssuranceProgramAuthoritySection(effective, requiredDocumentSet.requiredDocumentSetInput);
3768
4753
  const applicationRoleGraphSection = await this.composeApplicationRoleGraphSection(effective);
@@ -3780,7 +4765,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3780
4765
  family: output.family,
3781
4766
  creatorBrief: input.creatorBrief,
3782
4767
  selectionRationale: input.selectionRationale,
3783
- elicitationSection,
4768
+ elicitationSection: [elicitationSection, purposeSection].filter((part) => part !== '').join('\n\n'),
3784
4769
  inputTruthSection: this.composeInputTruthSection(effective, artifactState),
3785
4770
  workspaceTruthSection,
3786
4771
  compliancePrimaryFactsSection,
@@ -3873,6 +4858,8 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3873
4858
  const enabledEngineCapabilities = this.readEnabledEngineCapabilities();
3874
4859
  const result = await runPlaybookGeneration({
3875
4860
  playbookRef: input.playbookRef,
4861
+ // The INSTANCE (#1609): refused before generation, and at landing, unless every output is a keyed set.
4862
+ ...(input.instanceKey ? { instanceKey: input.instanceKey } : {}),
3876
4863
  outputs,
3877
4864
  specificationsPackageRoot,
3878
4865
  /*
@@ -3917,6 +4904,12 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3917
4904
  * package, where nothing could have been read and the landing's refusal is the honest outcome.
3918
4905
  */
3919
4906
  ...(existingComplianceDocumentCandidates === undefined ? {} : { existingComplianceDocumentCandidates }),
4907
+ /*
4908
+ * And re-read at LANDING (#1614): another drafter may land its document while this one is in its
4909
+ * model, and merging into the set read above would drop it. The start-of-run set stays the brief's.
4910
+ */
4911
+ reloadExistingComplianceDocumentCandidates: () => this.readLandedComplianceDocumentCandidates(),
4912
+ readBaselines,
3920
4913
  // WHICH documents this application needs, so a draft naming one it does not need is refused at
3921
4914
  // the landing and retried in the generation loop. Same absent-vs-empty contract as the facts
3922
4915
  // above: an omitted key skips the check rather than refusing everything.
@@ -3937,10 +4930,15 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3937
4930
  // beside the artifact — an answer without its question reviews as nothing.
3938
4931
  ...(input.clarification ? { priorRequests: input.clarification.requests, priorAction: input.clarification.action } : {}),
3939
4932
  mayAsk: (input.clarification?.round ?? 0) < DEFAULT_MAXIMUM_CLARIFICATION_ROUNDS
3940
- && input.clarification?.action !== PlaybookClarificationAction.DECLINE,
4933
+ && input.clarification?.action !== MetaWorkflow_ClarificationAction.DECLINE,
3941
4934
  },
3942
4935
  }
3943
4936
  : {}),
4937
+ }).catch(async (error) => {
4938
+ // A landing refused because its file moved since this run read it (#1614): name who moved it.
4939
+ if (error instanceof PlaybookOutputLandingConflictError)
4940
+ throw await this.describeLandingConflict(error, specificationsPackageRoot);
4941
+ throw error;
3944
4942
  });
3945
4943
  /*
3946
4944
  * THE INTERRUPT. The run produced nothing — the check runs before the artifact call — so there is
@@ -3952,11 +4950,13 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3952
4950
  const checkpoint = {
3953
4951
  kind: PlaybookRunCheckpointKind.CLARIFICATION,
3954
4952
  playbookRef: input.playbookRef,
4953
+ ...(input.instanceKey ? { instanceKey: input.instanceKey } : {}),
3955
4954
  family: result.family,
3956
4955
  round,
3957
4956
  dryRun: input.dryRun === true,
3958
4957
  ...(input.creatorBrief ? { creatorBrief: input.creatorBrief } : {}),
3959
4958
  ...(input.selectionRationale ? { selectionRationale: input.selectionRationale } : {}),
4959
+ ...(input.requestedByUserId ? { requestedByUserId: input.requestedByUserId } : {}),
3960
4960
  elicitationAnswers: elicitationAnswers.map((answer) => ({ ...answer })),
3961
4961
  // Cumulative: this round's answers join every earlier round's, so the next check never
3962
4962
  // re-asks anything the creator has already settled.
@@ -3990,7 +4990,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
3990
4990
  * `AWAITING_APPROVAL`, and writes the decision and the checkpoint on the execution.
3991
4991
  */
3992
4992
  const suspended = {
3993
- status: 'awaiting_creator_input',
4993
+ status: Workbench_PlaybookRunOutcomeStatus.AWAITING_CREATOR_INPUT,
3994
4994
  runId,
3995
4995
  playbookRef: input.playbookRef,
3996
4996
  family: result.family,
@@ -4000,6 +5000,13 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
4000
5000
  this.suspensionRequests.set(suspended, {
4001
5001
  decision: projectPlaybookClarificationAsDecision({ runId, requestedAt: new Date().toISOString(), checkpoint }),
4002
5002
  checkpointContext: checkpoint,
5003
+ /*
5004
+ * ROUTED to the person who started the run, when a person did (#1751): the engine then admits a
5005
+ * settle only from them and records who decided. A run with no signed-in starter stays unrouted.
5006
+ */
5007
+ ...(input.requestedByUserId
5008
+ ? { route: { kind: HumanDecision_RouteKind.OWNER }, requester: { kind: HumanDecision_RequesterKind.USER, ref: input.requestedByUserId } }
5009
+ : {}),
4003
5010
  });
4004
5011
  return suspended;
4005
5012
  }
@@ -4078,6 +5085,8 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
4078
5085
  existedBefore: entry.existedBefore,
4079
5086
  ...(entry.previousContent !== undefined ? { previousContent: entry.previousContent } : {}),
4080
5087
  writtenContent: entry.renderedSource,
5088
+ // Whether this landing replaced only what the run read, or merged over another writer (#1614).
5089
+ concurrency: entry.concurrency,
4081
5090
  })),
4082
5091
  // The export-wiring edits (companion-exports slot + barrel) travel in the SAME record, so
4083
5092
  // reverting a run also unwires it — a reverted family must not leave a dangling import.
@@ -4139,6 +5148,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
4139
5148
  playbookRef: input.playbookRef,
4140
5149
  treatment: treatment.data,
4141
5150
  landed: result.landedValues,
5151
+ ...(artifactState.applicationLine ? { notApplicableFamilies: artifactState.applicationLine.notApplicableFamilies } : {}),
4142
5152
  ...(judgeEvidence && judgeEvidence.acceptedInputs.length > 0 ? { acceptedInputs: judgeEvidence.acceptedInputs } : {}),
4143
5153
  ...(judgeEvidence && judgeEvidence.derivedContext.length > 0 ? { derivedContext: judgeEvidence.derivedContext } : {}),
4144
5154
  /*
@@ -4234,7 +5244,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
4234
5244
  const reason = describeCaughtError(error);
4235
5245
  this.logDebug('Landing broke the application config load', { reason });
4236
5246
  return `This run's files are on disk, and the application can no longer be loaded with them: ${reason}`
4237
- + ' Nothing downstream will work until this is resolved — revert this run via POST /runs/writes/{runId}/revert,'
5247
+ + ' Nothing downstream will work until this is resolved — revert this run with `wildo creation revert <runId>` (the runId is in this response),'
4238
5248
  + ' or correct the family it names.';
4239
5249
  }
4240
5250
  }
@@ -4313,11 +5323,72 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
4313
5323
  this.logDebug('Judge evidence: drafted candidates unreadable, claim guards omitted', { error: String(error) });
4314
5324
  }
4315
5325
  }
5326
+ /*
5327
+ * The COHERENCE report, for a generation playbook that declares it (#1638). The assessing path hands
5328
+ * it to its judge (the 2026-09-02 fix above `runAssessmentPlaybook`); the generation path put it in
5329
+ * the brief and never in the judge's evidence, so a generator's judge asked whether the conception
5330
+ * it built on is sound could not see the arithmetic that answers it. Gated on the same declaration,
5331
+ * so nothing changes for a playbook that does not declare it.
5332
+ */
5333
+ const coherenceSection = this.composeCoherenceSection(playbook, state);
4316
5334
  return {
4317
5335
  acceptedInputs: inputTruthSection === '' ? [] : [inputTruthSection],
4318
- derivedContext: [assuranceProgramAuthoritySection, compliancePrimaryFactsSection, computedFactsSection, claimGuardsSection].filter((section) => section !== ''),
5336
+ derivedContext: [assuranceProgramAuthoritySection, compliancePrimaryFactsSection, computedFactsSection, claimGuardsSection, coherenceSection].filter((section) => section !== ''),
4319
5337
  };
4320
5338
  }
5339
+ /**
5340
+ * The runs whose landing is on disk where this run was refused (#1614): for each conflicted file, the
5341
+ * recorded run whose written bytes the file holds NOW. Read from the write register, which already keeps
5342
+ * every run's exact bytes; a file no recorded run wrote (a person's edit) names nobody.
5343
+ */
5344
+ async describeLandingConflict(error, specificationsPackageRoot) {
5345
+ const specificationsRelativeRoot = path.relative(this.companionContext.saasRoot, specificationsPackageRoot);
5346
+ let records = [];
5347
+ try {
5348
+ records = await this.writeRegister.list();
5349
+ }
5350
+ catch {
5351
+ // The register is a cache; without it the conflict is still refused, it just names nobody.
5352
+ }
5353
+ const overlapping = new Map();
5354
+ for (const conflict of error.conflicts) {
5355
+ const appRelativePath = path.posix.join(specificationsRelativeRoot, conflict.packageRelativePath);
5356
+ const current = await readFile(path.join(specificationsPackageRoot, conflict.packageRelativePath), 'utf8').catch(() => undefined);
5357
+ const writer = records.find((record) => record.files.some((file) => file.path === appRelativePath && file.writtenContent === current));
5358
+ if (writer)
5359
+ overlapping.set(writer.runId, { runId: writer.runId, playbookRef: writer.playbookRef });
5360
+ }
5361
+ return new PlaybookRunLandingConflictError(error.conflicts, [...overlapping.values()], error.message);
5362
+ }
5363
+ /**
5364
+ * Run one PHASE of a playbook run under its own trace step, with a `started` and a `completed` (or
5365
+ * `failed`) event carrying its duration (#1639).
5366
+ *
5367
+ * The phases this wraps are the reads a run makes BEFORE it does anything a trace already shows: the
5368
+ * artifact state (the whole compiled specifications package, git freshness per family, the build
5369
+ * plan's execution state) and a composite's build-progress baseline. On a loaded machine they took a
5370
+ * market-analysis dry run thirty-eight minutes with nothing in its trace session after the opening
5371
+ * actor-plane reads, which read exactly like a hang. The STARTED event is the point: a phase that never
5372
+ * returns is then visibly the one it is stuck in. Best-effort, as every trace write is.
5373
+ */
5374
+ async traceRunPhase(session, label, work) {
5375
+ if (!session)
5376
+ return work();
5377
+ const step = this.traceability.createStep(session, { kind: PLAYBOOK_RUN_PHASE_TRACE_STEP_KIND, label });
5378
+ const startedAt = Date.now();
5379
+ await this.traceability.traceEvent({ session, step, minimumLevel: CompanionTraceabilityLevel.DEBUG, type: 'playbook-run-phase-started', summary: `${label} started` });
5380
+ try {
5381
+ const result = await work();
5382
+ const durationMs = Date.now() - startedAt;
5383
+ await this.traceability.traceEvent({ session, step, minimumLevel: CompanionTraceabilityLevel.DEBUG, type: 'playbook-run-phase-completed', summary: `${label} took ${durationMs} ms`, payload: { label, durationMs } });
5384
+ return result;
5385
+ }
5386
+ catch (error) {
5387
+ const durationMs = Date.now() - startedAt;
5388
+ await this.traceability.traceEvent({ session, step, minimumLevel: CompanionTraceabilityLevel.DEBUG, type: 'playbook-run-phase-failed', summary: `${label} failed after ${durationMs} ms`, payload: { label, durationMs, error: describeCaughtError(error) } });
5389
+ throw error;
5390
+ }
5391
+ }
4321
5392
  /** One trace step per run, so a session with several runs keeps their artifacts apart. */
4322
5393
  buildTrace(session, kind) {
4323
5394
  return createPlaybookExecutionTrace({
@@ -4624,10 +5695,16 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
4624
5695
  * The drafts the application already holds, so the brief says which of the draftable documents
4625
5696
  * remain. `undefined` renders nothing about them — "not read" rather than "holds none".
4626
5697
  */
4627
- existingCandidates) {
5698
+ existingCandidates,
5699
+ /**
5700
+ * The fact availability the landing checks against, from `resolveDeclaredDocumentFacts`. It lets the brief
5701
+ * say which held draft cites facts that no longer exist: the landing checks only the document a run
5702
+ * writes, so a draft left behind by a facts regeneration is otherwise corrected only by chance (#2019).
5703
+ */
5704
+ declaredDocumentFacts) {
4628
5705
  if (!playbookDeclaresContextSource(playbook, MetaWorkflow_ContextSource.DOCUMENT_BLUEPRINT))
4629
5706
  return '';
4630
- return composeAssuranceDocumentBlueprintBrief(playbook?.method.draftableDocumentDefinitionRefs ?? [], existingCandidates?.map((candidate) => candidate.documentRef));
5707
+ return composeAssuranceDocumentBlueprintBrief(playbook?.method.draftableDocumentDefinitionRefs ?? [], existingCandidates?.map((candidate) => candidate.documentRef), existingCandidates === undefined ? undefined : collectHeldDraftUndeclaredFactCitations(existingCandidates, declaredDocumentFacts));
4631
5708
  }
4632
5709
  /**
4633
5710
  * The document facts a PERSON established, for a playbook that DRAFTS a governed document.
@@ -5031,7 +6108,21 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5031
6108
  .filter(([scope]) => predicate(scope))
5032
6109
  .flatMap(([, value]) => Object.values(value?.providers ?? {}))
5033
6110
  .flatMap((provider) => (provider?.engineCapabilities ?? [])));
5034
- const runtimeScopedCapabilities = capabilitiesOfferedByScope((scope) => scope !== AUTHORING_PROVIDER_SCOPE);
6111
+ /*
6112
+ * The RUNTIME half reads the recipient population's engine-capability paths rather than walking
6113
+ * `scopes.<key>.providers`: that walk never entered `frontendServices.<service>`, `minions.<minion>` or
6114
+ * `workers.<worker>`, so a capability a minion serves read as offered only by the companion (#1707).
6115
+ */
6116
+ // Every declared provider's compliance profile, from discovery (#1708). Unreadable → the population says
6117
+ // NOT READ, and the region report falls back to the engine specifications it always read.
6118
+ const discoveredProfiles = await this.resolveDiscoveredProviderComplianceProfiles(saasConfig);
6119
+ const recipientPopulation = recipientPopulationOf(saasConfig, this.companionContext?.saasRoot, discoveredProfiles.profiles);
6120
+ const complianceProfiles = { ...engineSpecificationComplianceProfiles(), ...(discoveredProfiles.profiles ?? {}) };
6121
+ const processorRegister = await this.resolveProcessorRegister();
6122
+ const runtimeScopedCapabilities = new Set(recipientPopulation.members
6123
+ .flatMap((member) => member.dataPaths)
6124
+ .filter((dataPath) => dataPath.kind === RecipientDataPathKind.ENGINE_CAPABILITY)
6125
+ .flatMap((dataPath) => dataPath.detail));
5035
6126
  const authoringScopedCapabilities = capabilitiesOfferedByScope((scope) => scope === AUTHORING_PROVIDER_SCOPE);
5036
6127
  const reachesContractedService = (capability) => {
5037
6128
  if (isAuthoringOnlyCapability(capability))
@@ -5077,7 +6168,9 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5077
6168
  * not have it).
5078
6169
  */
5079
6170
  const authoringScopedProviderRefs = [...new Set(configuredProviderScopes.filter((entry) => entry.scope === AUTHORING_PROVIDER_SCOPE).flatMap((entry) => entry.providerRefs))].sort();
5080
- const runtimeScopedProviderRefs = runtimeScopedProviderRefsOf(saasConfig.providers);
6171
+ const runtimeScopedProviderRefs = recipientPopulation.members
6172
+ .filter((member) => member.kind === RecipientPopulationMemberKind.CONFIGURED_PROVIDER)
6173
+ .map((member) => member.ref);
5081
6174
  const profileOnlyProviderRefs = Object.keys(saasConfig.providerConfigurations ?? {})
5082
6175
  .filter((providerRef) => !runtimeScopedProviderRefs.includes(providerRef) && !authoringScopedProviderRefs.includes(providerRef))
5083
6176
  .sort();
@@ -5195,14 +6288,28 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5195
6288
  'that a runtime actually sends them some.',
5196
6289
  ]
5197
6290
  : []),
5198
- ...renderProviderComplianceChoices(runtimeScopedProviderRefs, saasConfig.providerComplianceChoices),
5199
- ...renderAppAssertedProcessingRegions(saasConfig.providerComplianceChoices),
6291
+ ...renderRecipientPopulation(recipientPopulation),
6292
+ ...renderRecipientDisclosures(deriveRecipientDisclosures({
6293
+ population: recipientPopulation,
6294
+ // An unread snapshot is NOT an empty one: undefined makes a system-of-record recipient report FLOWS_NOT_READ.
6295
+ systemOfRecordFlows: snapshot.resources === undefined ? undefined : parseSystemOfRecordFlows(snapshot.resources),
6296
+ providerComplianceChoices: saasConfig.providerComplianceChoices,
6297
+ lawfulBases: ApplicationOperatorComplianceIdentitySchema.safeParse(saasConfig.operatorComplianceIdentity).data?.lawfulBases,
6298
+ })),
6299
+ // Who runs each member the OPERATOR answers for. A tenant's own vendor and a vendor nothing reaches
6300
+ // carry no operator deployment choice, so asking for one would be asking the wrong party.
6301
+ ...renderProviderComplianceChoices([...recipientPopulation.operatorSubProcessorRefs, ...recipientPopulation.operatorRunRefs], saasConfig.providerComplianceChoices),
6302
+ ...renderAppAssertedProcessingRegions(saasConfig.providerComplianceChoices, complianceProfiles),
6303
+ ...renderProviderComplianceProfileFindings(recipientPopulation, discoveredProfiles.unreadableReason),
5200
6304
  ...renderCodingModelDestinations(saasConfig.providerConfigurations),
5201
6305
  '',
5202
6306
  ...renderRetentionSchedule(saasConfig.dataRetention),
5203
6307
  '',
5204
- // Joined to the RUNTIME-SCOPED set: a profile with no runtime binding is not a recipient.
5205
- ...renderProcessorRegister(runtimeScopedProviderRefs, await this.resolveProcessorRegister(), saasConfig.providerComplianceChoices),
6308
+ // Joined to the recipient population: a profile with no runtime binding is not a recipient, and neither is a
6309
+ // declared vendor no data path reaches.
6310
+ ...renderProcessorRegister(recipientPopulation, processorRegister),
6311
+ ...renderComplianceFactStaleness(recipientPopulation, processorRegister, complianceProfiles, new Date().toISOString().slice(0, 10)),
6312
+ ...renderProcessorAgreementStanding(processorRegister),
5206
6313
  '',
5207
6314
  /*
5208
6315
  * The FULL declared set, not the runtime-filtered one. `renderAiUsePosture` performs its own
@@ -5482,8 +6589,18 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5482
6589
  */
5483
6590
  composeInputTruthSection(playbook, state) {
5484
6591
  const sections = [];
6592
+ const notApplicable = [];
5485
6593
  const valuesByFamily = this.decidedFamilyValues(state);
5486
6594
  for (const declaredInput of playbook.inputs ?? []) {
6595
+ /*
6596
+ * Said, never merely omitted (#1604). An absent input reads as "not written yet", and a model given
6597
+ * a requirements brief with no market invents the market it thinks is missing. A family the line
6598
+ * declares not applicable is an answer: this application has none, and none is owed.
6599
+ */
6600
+ if (isFamilyNotApplicable(state.applicationLine, declaredInput.family)) {
6601
+ notApplicable.push(declaredInput.family);
6602
+ continue;
6603
+ }
5487
6604
  const value = valuesByFamily[declaredInput.family];
5488
6605
  if (value === undefined || value === null)
5489
6606
  continue;
@@ -5491,14 +6608,20 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5491
6608
  // Absent = everything, which is what every playbook did before either existed.
5492
6609
  sections.push(`## Input family: ${declaredInput.family}\n${renderDeclaredInputFamily(declaredInput, value, valuesByFamily)}`);
5493
6610
  }
5494
- if (sections.length === 0)
6611
+ if (sections.length === 0 && notApplicable.length === 0)
5495
6612
  return '';
6613
+ const line = state.applicationLine?.declaration;
6614
+ const lineName = line?.state === ApplicationLineDeclarationState.DECLARED ? line.line : 'declared';
5496
6615
  return [
5497
6616
  '# Accepted application truth (derivation inputs)',
5498
6617
  'Derive the output FROM this content. It is the application\'s current authored truth for the',
5499
6618
  'declared input families — never contradict it, and never invent facts it does not support.',
5500
- '',
5501
- sections.join('\n\n'),
6619
+ ...(notApplicable.length > 0
6620
+ ? ['', `These input families do NOT APPLY to this application, which is created on the ${lineName} line: ${notApplicable.map((family) => `\`${family}\``).join(', ')}.`,
6621
+ 'The application has none and none is owed. Do not infer, invent or ask for their content, and leave',
6622
+ 'every reference into them empty (for example, requirements name no ICP when the market does not apply).']
6623
+ : []),
6624
+ ...(sections.length > 0 ? ['', sections.join('\n\n')] : []),
5502
6625
  ].join('\n');
5503
6626
  }
5504
6627
  /**
@@ -5552,6 +6675,14 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5552
6675
  * `WILDO_PLAYBOOK_MODEL_CALL_HOURLY_BREAKER` env override, and a companion restart (the counter is a
5553
6676
  * runtime cache — losing it costs nothing but the count).
5554
6677
  */
6678
+ /**
6679
+ * How many runs THIS process submitted and has not seen answer — the pulse's `runsInFlight` (#1657).
6680
+ * In-memory by design: the pulse must not read the actor plane, and a run another process holds is
6681
+ * the feed's to report.
6682
+ */
6683
+ countRunsInFlightInProcess() {
6684
+ return this.runningDetachedRuns.size;
6685
+ }
5555
6686
  /** What is running in this process, and what died leaving a resumable checkpoint. */
5556
6687
  async readRunsInFlight() {
5557
6688
  /*
@@ -5580,34 +6711,48 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5580
6711
  fromRows = { running: [...this.runningDetachedRuns.values()], settled: [...this.lastCompletedDetachedRuns.values()] };
5581
6712
  }
5582
6713
  /*
5583
- * `running` is the COMPOSITE holding the single-flight subject — read from its row since #1361,
5584
- * where it used to be an in-memory marker only the process driving the composite could see. It
6714
+ * `running` is every COMPOSITE holding a single-flight subject, read from its row since #1361, where
6715
+ * it used to be an in-memory marker only the process driving the composite could see. A LIST since
6716
+ * #1610: a secondary line's composite runs beside the main line's, one subject per instance. It
5585
6717
  * answers a different question from `runningDetached` ("what did I submit that has not answered
5586
- * yet"), so the composite is reported under it alone.
6718
+ * yet"), so a composite is reported under it alone.
5587
6719
  */
5588
- const composite = fromRows.running.find((run) => run.exclusiveSubject === MetaWorkflowsExclusiveSubject.COMPOSITE) ?? null;
6720
+ const composites = fromRows.running.filter((run) => isCompositeExclusiveSubject(run.exclusiveSubject));
5589
6721
  return {
5590
- running: composite ? { playbookRef: composite.playbookRef, startedAt: composite.startedAt } : null,
5591
- runningDetached: fromRows.running.filter((run) => run !== composite).map(({ exclusiveSubject: _subject, ...run }) => run),
6722
+ // With its run id and instance (#1609): "a composite running" names WHICH run, not only which playbook.
6723
+ running: composites.map((composite) => ({
6724
+ runId: composite.runId,
6725
+ playbookRef: composite.playbookRef,
6726
+ ...(composite.instanceKey ? { instanceKey: composite.instanceKey } : {}),
6727
+ startedAt: composite.startedAt,
6728
+ })),
6729
+ runningDetached: fromRows.running.filter((run) => !composites.includes(run)).map(({ exclusiveSubject: _subject, ...run }) => run),
5592
6730
  interrupted: await this.listInterruptedChoreographies(),
5593
6731
  lastCompleted: fromRows.settled,
5594
6732
  lastLoop,
5595
6733
  };
5596
6734
  }
5597
6735
  /**
5598
- * The most recent DETACHED run outcome per playbook ref — the read side of async submission (#265).
6736
+ * The most recent DETACHED run outcome per playbook INSTANCE — the read side of async submission (#265).
5599
6737
  *
5600
6738
  * In memory deliberately (one-source-of-truth Rule 5: a per-run cache; a restart costs the summary
5601
6739
  * and no fact — the artifacts are in the tree and the details in the traces). Bounded to one entry
5602
- * per ref, because the question this answers is "what happened to the run I submitted", not a
5603
- * history — the traces are the history.
6740
+ * per instance id (`<ref>` or `<ref>@<key>`, #1609), because the question this answers is "what happened
6741
+ * to the run I submitted", not a history — the traces are the history. Keyed by ref alone, a second
6742
+ * instance settling replaced the first one's outcome.
5604
6743
  */
5605
6744
  lastCompletedDetachedRuns = new Map();
5606
6745
  /**
5607
- * The detached runs THIS PROCESS is executing right now, keyed by playbook ref.
6746
+ * The detached runs THIS PROCESS is executing right now, keyed by RUN ID (#1609).
6747
+ *
6748
+ * It was keyed by playbook ref, and two runs of one playbook already overlapped before instances
6749
+ * existed (an ordinary run holds no single-flight subject): the second hid the first, the first's
6750
+ * settle deleted the second's entry, and with the map empty the run-tail heartbeat was REMOVED while
6751
+ * the second run still ran, so the supervisor could restart the companion under it. A run id is the one
6752
+ * key two runs can never share.
5608
6753
  *
5609
- * `running` beside it is the CHOREOGRAPHY single-flight marker and answers a different question — it
5610
- * is set by a composite while it drives its children, and an ordinary detached run never touches it.
6754
+ * `running` beside it lists the composites holding a single-flight subject and answers a different
6755
+ * question — a composite is in it while it drives its children, and an ordinary detached run never is.
5611
6756
  * So for every non-composite playbook the submission note's promise ("`running` while in flight") was
5612
6757
  * false: a caller polling a `bottom_up.build-dispatch` run saw `running: null` and an empty
5613
6758
  * `lastCompleted`, which is exactly what a run that was never submitted looks like.
@@ -5621,53 +6766,60 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5621
6766
  * absence from both fields now has a stated meaning in the note rather than being ambiguous.
5622
6767
  */
5623
6768
  runningDetachedRuns = new Map();
5624
- /** The interval refreshing {@link PLAYBOOK_RUN_HEARTBEAT_RELATIVE_PATH}; null when nothing is in flight. */
5625
- playbookRunHeartbeatTimer = null;
5626
6769
  /**
5627
- * Start or stop the run-tail heartbeat to match what is in flight.
6770
+ * How many playbook executions are in flight in this process, OTHER than the detached submissions
6771
+ * {@link runningDetachedRuns} already names: a synchronous `runPlaybook`, a resumed run, a loop, and
6772
+ * — unbypassably — every `executePlaybookRun`, whoever called it. Maintained only through
6773
+ * {@link whileInFlight}.
6774
+ *
6775
+ * A count, not a map: nothing reads them back, and a composite's children run nested inside the same
6776
+ * process, so the same ref may be in flight at several depths. It exists only so the heartbeat below
6777
+ * covers them. Until 2026-09-27 the heartbeat covered detached runs alone, and a synchronous
6778
+ * `bottom_up.build-dispatch` (the shape #1576's execution block submits) was invisible to the dev
6779
+ * supervisor, which restarted the companion under it; a resumed run was invisible the same way.
6780
+ */
6781
+ playbookExecutionsInFlight = 0;
6782
+ /**
6783
+ * Run `work` counted as in flight, so the dev supervisor holds a restart for its whole life.
5628
6784
  *
5629
- * Called on every change to `runningDetachedRuns`, so the file exists exactly while a detached run
5630
- * does. Best-effort throughout: a companion that cannot write this file must still run playbooks —
5631
- * the consequence is the supervisor restarting during a tail, which is what happened before the
5632
- * signal existed, never a refusal to work.
6785
+ * Used at the ENTRY points (whole life, including the settle that writes the run's record after the
6786
+ * work returns) AND inside `executePlaybookRun` itself, so a caller added later is covered while it
6787
+ * executes even if nobody remembers to wrap it. Nested counts are harmless: the file beats while the
6788
+ * count is above zero.
5633
6789
  */
5634
- syncPlaybookRunHeartbeat() {
5635
- const heartbeatPath = join(this.companionContext.saasRoot, PLAYBOOK_RUN_HEARTBEAT_RELATIVE_PATH);
5636
- const shouldBeat = this.runningDetachedRuns.size > 0;
5637
- /*
5638
- * TRUTHINESS, not `=== null`: a service built through `Object.create(prototype)` — which the tests
5639
- * and several harnesses do — never runs the field initializer, so the timer reads `undefined` and a
5640
- * null-check would silently never beat. The predicate must not depend on an initializer having run.
5641
- */
5642
- if (shouldBeat && !this.playbookRunHeartbeatTimer) {
5643
- const touch = () => {
5644
- try {
5645
- mkdirSync(path.dirname(heartbeatPath), { recursive: true });
5646
- writeFileSync(heartbeatPath, new Date().toISOString(), 'utf8');
5647
- }
5648
- catch (error) {
5649
- this.logDebug('Playbook-run heartbeat write failed (non-fatal)', { error: String(error) });
5650
- }
5651
- };
5652
- touch();
5653
- this.playbookRunHeartbeatTimer = setInterval(touch, PLAYBOOK_RUN_HEARTBEAT_INTERVAL_MS);
5654
- // Never keep the process alive for a heartbeat: it describes work, it is not work.
5655
- this.playbookRunHeartbeatTimer.unref?.();
5656
- return;
6790
+ async whileInFlight(work) {
6791
+ this.playbookExecutionsInFlight = (this.playbookExecutionsInFlight ?? 0) + 1;
6792
+ this.syncPlaybookRunHeartbeat();
6793
+ try {
6794
+ return await work();
5657
6795
  }
5658
- if (!shouldBeat && this.playbookRunHeartbeatTimer) {
5659
- clearInterval(this.playbookRunHeartbeatTimer);
5660
- this.playbookRunHeartbeatTimer = null;
5661
- // REMOVED rather than left to go stale: the supervisor would hold a restart for one more window
5662
- // over a run that has finished, and the file is the only thing saying otherwise.
5663
- try {
5664
- rmSync(heartbeatPath, { force: true });
5665
- }
5666
- catch (error) {
5667
- this.logDebug('Playbook-run heartbeat removal failed (non-fatal)', { error: String(error) });
5668
- }
6796
+ finally {
6797
+ this.playbookExecutionsInFlight = Math.max(0, (this.playbookExecutionsInFlight ?? 1) - 1);
6798
+ this.syncPlaybookRunHeartbeat();
5669
6799
  }
5670
6800
  }
6801
+ /** The {@link PLAYBOOK_RUN_HEARTBEAT_RELATIVE_PATH} beat; built on first use (see {@link syncPlaybookRunHeartbeat}). */
6802
+ playbookRunHeartbeat;
6803
+ /**
6804
+ * Start or stop the playbook-run heartbeat to match what is in flight: any detached submission, or
6805
+ * any execution counted by {@link whileInFlight}.
6806
+ *
6807
+ * Called on every change to either, so the file exists exactly while a run does. Best-effort
6808
+ * throughout — see {@link InFlightWorkHeartbeat}.
6809
+ *
6810
+ * The beat is built LAZILY rather than as a field initializer: a service built through
6811
+ * `Object.create(prototype)` — which the tests and several harnesses do — never runs initializers, so
6812
+ * an eagerly-built beat would read `undefined` and never start. Same reason `?? 0` and `?.size` below.
6813
+ */
6814
+ syncPlaybookRunHeartbeat() {
6815
+ // No application root, nowhere to beat — a harness, never a running companion. Skipping keeps the
6816
+ // heartbeat what it must be: something that can fail without failing the run it describes.
6817
+ const saasRoot = this.companionContext?.saasRoot;
6818
+ if (typeof saasRoot !== 'string')
6819
+ return;
6820
+ this.playbookRunHeartbeat ??= new InFlightWorkHeartbeat(join(saasRoot, PLAYBOOK_RUN_HEARTBEAT_RELATIVE_PATH), PLAYBOOK_RUN_HEARTBEAT_INTERVAL_MS, (message, error) => this.logDebug(message, { error: String(error) }));
6821
+ this.playbookRunHeartbeat.sync((this.runningDetachedRuns?.size ?? 0) > 0 || (this.playbookExecutionsInFlight ?? 0) > 0);
6822
+ }
5671
6823
  /**
5672
6824
  * Judge one SETTLED coding run against the dispatching playbook's own compiled treatment.
5673
6825
  *
@@ -5755,13 +6907,17 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5755
6907
  * Until 2026-09-20 this minted its own id and handed it in; a submission and its row now share one.
5756
6908
  */
5757
6909
  const opened = await this.actorsSystem.openActorExecution(this.buildActorExecutionRequest(input))
5758
- .catch(async (error) => { throw await this.nameTheRunHoldingTheSubject(error, MetaWorkflowsExclusiveSubject.COMPOSITE, input.session); });
6910
+ .catch(async (error) => {
6911
+ const subject = this.resolveExclusiveSubject(input);
6912
+ throw subject === undefined ? error : await this.nameTheRunHoldingTheSubject(error, MetaWorkflowsExclusiveSubject.COMPOSITE, subject, input.session);
6913
+ });
5759
6914
  const runId = opened.executionId;
5760
6915
  // Registered BEFORE the run is started, so a caller that polls immediately cannot see a gap in
5761
6916
  // which its own submission is reported nowhere.
5762
- this.runningDetachedRuns.set(input.playbookRef, {
6917
+ this.runningDetachedRuns.set(runId, {
5763
6918
  runId,
5764
6919
  playbookRef: input.playbookRef,
6920
+ ...(input.instanceKey ? { instanceKey: input.instanceKey } : {}),
5765
6921
  startedAt,
5766
6922
  ...(input.session ? { traceSessionId: input.session.sessionId } : {}),
5767
6923
  ...(input.conversationId ? { conversationId: input.conversationId } : {}),
@@ -5770,24 +6926,27 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5770
6926
  void this.actorsSystem
5771
6927
  .completeActorExecution(opened, async () => {
5772
6928
  // Where the build stood BEFORE the round, so its end can tell a round that moved from one that did not.
5773
- if (isComposite)
5774
- tasksLandedBefore = (await this.buildDispatch.resolveBuildExecutionProgress().catch(() => undefined))?.landedTasks;
6929
+ // Only where a relaunch could read it (#1639): a dry run or a posture that never relaunches pays nothing here.
6930
+ if (isComposite && compositeRoundMayRelaunch({ posture: APPLICATION_CREATION_AUTONOMY_POSTURE, dryRun: input.dryRun === true })) {
6931
+ tasksLandedBefore = (await this.traceRunPhase(input.session, 'build-progress-baseline', () => this.buildDispatch.resolveBuildExecutionProgress().catch(() => undefined)))?.landedTasks;
6932
+ }
5775
6933
  return this.executePlaybookRun({ ...input, runId });
5776
6934
  }, input.session, this.playbookRunOptionsFor(() => runId))
5777
6935
  .then(async (result) => {
5778
- this.runningDetachedRuns.delete(input.playbookRef);
6936
+ this.runningDetachedRuns.delete(runId);
5779
6937
  this.syncPlaybookRunHeartbeat();
5780
6938
  /*
5781
6939
  * A SUSPENSION is not a completion. The run stopped to ask and is waiting for a person; the
5782
6940
  * resume route carries its own handle, which is not this submission's `runId`.
5783
6941
  */
5784
6942
  const suspended = typeof result === 'object' && result !== null
5785
- && result.status === 'awaiting_creator_input'
6943
+ && result.status === Workbench_PlaybookRunOutcomeStatus.AWAITING_CREATOR_INPUT
5786
6944
  ? result
5787
6945
  : undefined;
5788
- this.lastCompletedDetachedRuns.set(input.playbookRef, {
6946
+ this.lastCompletedDetachedRuns.set(playbookInstanceId(input.playbookRef, input.instanceKey), {
5789
6947
  runId,
5790
6948
  playbookRef: input.playbookRef,
6949
+ ...(input.instanceKey ? { instanceKey: input.instanceKey } : {}),
5791
6950
  startedAt,
5792
6951
  finishedAt: new Date().toISOString(),
5793
6952
  ok: true,
@@ -5808,11 +6967,12 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5808
6967
  await this.continueCompositeChain(input, round, runId, tasksLandedBefore, result);
5809
6968
  })
5810
6969
  .catch((error) => {
5811
- this.runningDetachedRuns.delete(input.playbookRef);
6970
+ this.runningDetachedRuns.delete(runId);
5812
6971
  this.syncPlaybookRunHeartbeat();
5813
- this.lastCompletedDetachedRuns.set(input.playbookRef, {
6972
+ this.lastCompletedDetachedRuns.set(playbookInstanceId(input.playbookRef, input.instanceKey), {
5814
6973
  runId,
5815
6974
  playbookRef: input.playbookRef,
6975
+ ...(input.instanceKey ? { instanceKey: input.instanceKey } : {}),
5816
6976
  startedAt,
5817
6977
  finishedAt: new Date().toISOString(),
5818
6978
  ok: false,
@@ -5839,7 +6999,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5839
6999
  + 'read from the actor plane, so they survive a companion restart: a run the restart interrupted is in '
5840
7000
  + '`lastCompleted` with `ok: false` and says the host stopped. After a restart `result` carries the '
5841
7001
  + "run's summary (accepted, judge verdict) rather than the full envelope, which only the process that ran it holds. "
5842
- + '(`running` is the choreography single-flight marker and stays null for an ordinary run.)',
7002
+ + '(`running` lists the composites holding a single-flight subject, one per instance, and never names an ordinary run.)',
5843
7003
  };
5844
7004
  }
5845
7005
  /**
@@ -5847,7 +7007,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5847
7007
  *
5848
7008
  * Recorded either way on the run's settled record as `chain`, so "why did the build stop here" has an
5849
7009
  * answer on the same read that says it stopped. A relaunch is a new submission like any other — it
5850
- * opens its own execution, appears in `runningDetached`, and is refused by the composite single-flight
7010
+ * opens its own execution, appears in `runningDetached`, and is refused by its instance's single-flight
5851
7011
  * guard like a person's would be. Best-effort: nothing here may turn a settled run into a failed one.
5852
7012
  */
5853
7013
  async continueCompositeChain(input, round, runId, tasksLandedBefore, result) {
@@ -5855,7 +7015,13 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5855
7015
  if (composite?.choreographed !== true || composite.stoppedBecause === undefined)
5856
7016
  return;
5857
7017
  try {
5858
- const buildProgressAfter = await this.buildDispatch.resolveBuildExecutionProgress().catch(() => undefined);
7018
+ // Read only when the decision will: a round that concluded, chose to stop or found nothing eligible never looks (#1639).
7019
+ const readsProgress = compositeRoundRelaunchReadsBuildProgress({
7020
+ posture: APPLICATION_CREATION_AUTONOMY_POSTURE,
7021
+ dryRun: input.dryRun === true,
7022
+ stoppedBecause: composite.stoppedBecause,
7023
+ });
7024
+ const buildProgressAfter = readsProgress ? await this.buildDispatch.resolveBuildExecutionProgress().catch(() => undefined) : undefined;
5859
7025
  const decision = decideCompositeRoundRelaunch({
5860
7026
  posture: APPLICATION_CREATION_AUTONOMY_POSTURE,
5861
7027
  dryRun: input.dryRun === true,
@@ -5865,12 +7031,20 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5865
7031
  ...(tasksLandedBefore === undefined ? {} : { tasksLandedBefore }),
5866
7032
  ...(buildProgressAfter === undefined ? {} : { buildProgressAfter }),
5867
7033
  });
5868
- const record = this.lastCompletedDetachedRuns.get(input.playbookRef);
7034
+ const instanceId = playbookInstanceId(input.playbookRef, input.instanceKey);
7035
+ const record = this.lastCompletedDetachedRuns.get(instanceId);
5869
7036
  if (record?.runId === runId)
5870
- this.lastCompletedDetachedRuns.set(input.playbookRef, { ...record, chain: { round, decision } });
7037
+ this.lastCompletedDetachedRuns.set(instanceId, { ...record, chain: { round, decision } });
5871
7038
  this.logDebug('Composite round settled', { playbookRef: input.playbookRef, round, decision });
5872
7039
  if (decision !== CompositeRoundRelaunchDecision.RELAUNCH)
5873
7040
  return;
7041
+ /*
7042
+ * The subject is RELEASED between rounds and re-taken here, deliberately (#1610). Holding it across the
7043
+ * gap would need a lease with no run behind it, which a restart could strand. What can start in the gap
7044
+ * is only another run of the SAME instance (a different composite or instance never needed the lease):
7045
+ * that run is the same piece of work, so it continues the chain, and this relaunch is refused 409 and
7046
+ * logged below as the end of this chain. A person's run is never refused for a chain's sake.
7047
+ */
5874
7048
  await this.submitPlaybookRoundDetached(input, round + 1);
5875
7049
  }
5876
7050
  catch (error) {
@@ -5914,6 +7088,10 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
5914
7088
  dryRun: parsed.data.dryRun,
5915
7089
  // The checkpoint stays cumulative; an answer form needs only questions still outstanding.
5916
7090
  requests: parsed.data.requests.filter((request) => !answered.has(request.ref)),
7091
+ // Who alone may answer it (#1751), so a door with no person can say so instead of offering an answer.
7092
+ ...(row.suspension.route?.kind === HumanDecision_RouteKind.OWNER && row.suspension.requester?.kind === HumanDecision_RequesterKind.USER
7093
+ ? { routedToUserId: row.suspension.requester.ref }
7094
+ : {}),
5917
7095
  });
5918
7096
  }
5919
7097
  suspended.sort((left, right) => right.suspendedAt.localeCompare(left.suspendedAt));