@wildo-ai/dev-companion 1.1.8 → 1.1.9

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 (325) hide show
  1. package/bin/companion-supervisor.d.mts +33 -0
  2. package/bin/companion-supervisor.mjs +174 -0
  3. package/bin/wildo-dev-companion-supervised.mjs +16 -0
  4. package/dist/esm/brand/models/logo-generation.actors-system.definitions.d.ts.map +1 -1
  5. package/dist/esm/brand/models/logo-generation.actors-system.definitions.js +8 -2
  6. package/dist/esm/brand/models/logo-generation.actors-system.definitions.js.map +1 -1
  7. package/dist/esm/brand/models/logo-judge.actors-system.definitions.d.ts.map +1 -1
  8. package/dist/esm/brand/models/logo-judge.actors-system.definitions.js +8 -2
  9. package/dist/esm/brand/models/logo-judge.actors-system.definitions.js.map +1 -1
  10. package/dist/esm/brand/services/brand-accept.companion.service.d.ts +1 -1
  11. package/dist/esm/brand/services/brand-accept.companion.service.d.ts.map +1 -1
  12. package/dist/esm/brand/services/brand-accept.companion.service.js +9 -11
  13. package/dist/esm/brand/services/brand-accept.companion.service.js.map +1 -1
  14. package/dist/esm/claude-cli/models/application-coding-run-checkpoint.models.d.ts +21 -0
  15. package/dist/esm/claude-cli/models/application-coding-run-checkpoint.models.d.ts.map +1 -1
  16. package/dist/esm/claude-cli/models/application-coding-run-checkpoint.models.js +33 -1
  17. package/dist/esm/claude-cli/models/application-coding-run-checkpoint.models.js.map +1 -1
  18. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +41 -2
  19. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts.map +1 -1
  20. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js +43 -1
  21. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
  22. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts +57 -1
  23. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts.map +1 -1
  24. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +75 -1
  25. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js.map +1 -1
  26. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +90 -5
  27. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
  28. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +242 -22
  29. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
  30. package/dist/esm/companion-api/companion-api.schemas.d.ts +23 -2
  31. package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
  32. package/dist/esm/companion-api/companion-api.schemas.js +13 -2
  33. package/dist/esm/companion-api/companion-api.schemas.js.map +1 -1
  34. package/dist/esm/companion-api/controllers/companion.controller.d.ts +63 -7
  35. package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
  36. package/dist/esm/companion-api/controllers/companion.controller.js +315 -39
  37. package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
  38. package/dist/esm/core/config/primary-language.companion.utils.d.ts +5 -4
  39. package/dist/esm/core/config/primary-language.companion.utils.d.ts.map +1 -1
  40. package/dist/esm/core/config/primary-language.companion.utils.js +5 -4
  41. package/dist/esm/core/config/primary-language.companion.utils.js.map +1 -1
  42. package/dist/esm/core/context/application-module-generations.companion.d.ts +103 -0
  43. package/dist/esm/core/context/application-module-generations.companion.d.ts.map +1 -0
  44. package/dist/esm/core/context/application-module-generations.companion.js +313 -0
  45. package/dist/esm/core/context/application-module-generations.companion.js.map +1 -0
  46. package/dist/esm/core/context/companion-package-loaders.companion.d.ts +19 -19
  47. package/dist/esm/core/context/companion-package-loaders.companion.d.ts.map +1 -1
  48. package/dist/esm/core/context/companion-package-loaders.companion.js +52 -40
  49. package/dist/esm/core/context/companion-package-loaders.companion.js.map +1 -1
  50. package/dist/esm/core/inject/models/container.d.ts.map +1 -1
  51. package/dist/esm/core/inject/models/container.js +4 -0
  52. package/dist/esm/core/inject/models/container.js.map +1 -1
  53. package/dist/esm/core/inject/models/service-types.d.ts +4 -0
  54. package/dist/esm/core/inject/models/service-types.d.ts.map +1 -1
  55. package/dist/esm/core/inject/models/service-types.js +4 -0
  56. package/dist/esm/core/inject/models/service-types.js.map +1 -1
  57. package/dist/esm/core/introspection/resources/creation-console-answer.companion.d.ts +15 -1
  58. package/dist/esm/core/introspection/resources/creation-console-answer.companion.d.ts.map +1 -1
  59. package/dist/esm/core/introspection/resources/creation-console-answer.companion.js +38 -3
  60. package/dist/esm/core/introspection/resources/creation-console-answer.companion.js.map +1 -1
  61. package/dist/esm/core/introspection/resources/creation-console-projection.companion.d.ts +21 -0
  62. package/dist/esm/core/introspection/resources/creation-console-projection.companion.d.ts.map +1 -1
  63. package/dist/esm/core/introspection/resources/creation-console-projection.companion.js +64 -25
  64. package/dist/esm/core/introspection/resources/creation-console-projection.companion.js.map +1 -1
  65. package/dist/esm/core/introspection/resources/creation-home-projection.companion.d.ts.map +1 -1
  66. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js +2 -0
  67. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js.map +1 -1
  68. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts +0 -28
  69. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts.map +1 -1
  70. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js +192 -19
  71. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js.map +1 -1
  72. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -1
  73. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +27 -5
  74. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -1
  75. package/dist/esm/core/introspection/resources/launch-blockers.companion.d.ts +47 -0
  76. package/dist/esm/core/introspection/resources/launch-blockers.companion.d.ts.map +1 -0
  77. package/dist/esm/core/introspection/resources/launch-blockers.companion.js +98 -0
  78. package/dist/esm/core/introspection/resources/launch-blockers.companion.js.map +1 -0
  79. package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts +6 -1
  80. package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts.map +1 -1
  81. package/dist/esm/core/introspection/services/companion-introspection.companion.service.js +20 -1
  82. package/dist/esm/core/introspection/services/companion-introspection.companion.service.js.map +1 -1
  83. package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.d.ts +34 -8
  84. package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.d.ts.map +1 -1
  85. package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.js +61 -12
  86. package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.js.map +1 -1
  87. package/dist/esm/core/introspection/services/introspection-input-closure.companion.d.ts +44 -0
  88. package/dist/esm/core/introspection/services/introspection-input-closure.companion.d.ts.map +1 -0
  89. package/dist/esm/core/introspection/services/introspection-input-closure.companion.js +104 -0
  90. package/dist/esm/core/introspection/services/introspection-input-closure.companion.js.map +1 -0
  91. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts +41 -22
  92. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts.map +1 -1
  93. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js +64 -47
  94. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js.map +1 -1
  95. package/dist/esm/core/introspection/subprocess/expert-persona-brief.renderer.d.ts +7 -1
  96. package/dist/esm/core/introspection/subprocess/expert-persona-brief.renderer.d.ts.map +1 -1
  97. package/dist/esm/core/introspection/subprocess/expert-persona-brief.renderer.js +13 -4
  98. package/dist/esm/core/introspection/subprocess/expert-persona-brief.renderer.js.map +1 -1
  99. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts.map +1 -1
  100. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js +7 -0
  101. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js.map +1 -1
  102. package/dist/esm/core/lock/wildo-saas-lock.schemas.d.ts +4 -4
  103. package/dist/esm/core/runtime/companion-env-file.d.ts +39 -9
  104. package/dist/esm/core/runtime/companion-env-file.d.ts.map +1 -1
  105. package/dist/esm/core/runtime/companion-env-file.js +75 -16
  106. package/dist/esm/core/runtime/companion-env-file.js.map +1 -1
  107. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts +7 -3
  108. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
  109. package/dist/esm/core/runtime/services/start-companion-application.service.js +29 -11
  110. package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
  111. package/dist/esm/core/utils/bounded-concurrency.utils.d.ts +17 -0
  112. package/dist/esm/core/utils/bounded-concurrency.utils.d.ts.map +1 -0
  113. package/dist/esm/core/utils/bounded-concurrency.utils.js +37 -0
  114. package/dist/esm/core/utils/bounded-concurrency.utils.js.map +1 -0
  115. package/dist/esm/core/utils/derived-input-signature.companion.utils.d.ts +10 -1
  116. package/dist/esm/core/utils/derived-input-signature.companion.utils.d.ts.map +1 -1
  117. package/dist/esm/core/utils/derived-input-signature.companion.utils.js +9 -2
  118. package/dist/esm/core/utils/derived-input-signature.companion.utils.js.map +1 -1
  119. package/dist/esm/creation-conversation/creation-conversation.actors-system.definitions.d.ts.map +1 -1
  120. package/dist/esm/creation-conversation/creation-conversation.actors-system.definitions.js +2 -0
  121. package/dist/esm/creation-conversation/creation-conversation.actors-system.definitions.js.map +1 -1
  122. package/dist/esm/creation-conversation/creation-conversation.function-tools.d.ts.map +1 -1
  123. package/dist/esm/creation-conversation/creation-conversation.function-tools.js +66 -6
  124. package/dist/esm/creation-conversation/creation-conversation.function-tools.js.map +1 -1
  125. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.d.ts +0 -17
  126. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.d.ts.map +1 -1
  127. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.js +10 -4
  128. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.js.map +1 -1
  129. package/dist/esm/email/services/email-template.companion.service.d.ts +6 -1
  130. package/dist/esm/email/services/email-template.companion.service.d.ts.map +1 -1
  131. package/dist/esm/email/services/email-template.companion.service.js +4 -1
  132. package/dist/esm/email/services/email-template.companion.service.js.map +1 -1
  133. package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.d.ts.map +1 -1
  134. package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.js +8 -2
  135. package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.js.map +1 -1
  136. package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.d.ts.map +1 -1
  137. package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.js +8 -2
  138. package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.js.map +1 -1
  139. package/dist/esm/expert-personas/services/expert-persona.companion.service.d.ts.map +1 -1
  140. package/dist/esm/expert-personas/services/expert-persona.companion.service.js +7 -7
  141. package/dist/esm/expert-personas/services/expert-persona.companion.service.js.map +1 -1
  142. package/dist/esm/i18n/composite_views/app.creation-conversation.en.d.ts.map +1 -1
  143. package/dist/esm/i18n/composite_views/app.creation-conversation.en.js +41 -1
  144. package/dist/esm/i18n/composite_views/app.creation-conversation.en.js.map +1 -1
  145. package/dist/esm/i18n/resources/workbenchAspects.en.d.ts.map +1 -1
  146. package/dist/esm/i18n/resources/workbenchAspects.en.js +7 -0
  147. package/dist/esm/i18n/resources/workbenchAspects.en.js.map +1 -1
  148. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.en.d.ts +5 -0
  149. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.en.d.ts.map +1 -1
  150. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.en.js +5 -0
  151. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.en.js.map +1 -1
  152. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts +1 -1
  153. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts.map +1 -1
  154. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js +2 -1
  155. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js.map +1 -1
  156. package/dist/esm/i18n/resources/workbenchDossierEntries.en.d.ts +46 -0
  157. package/dist/esm/i18n/resources/workbenchDossierEntries.en.d.ts.map +1 -1
  158. package/dist/esm/i18n/resources/workbenchDossierEntries.en.js +12 -0
  159. package/dist/esm/i18n/resources/workbenchDossierEntries.en.js.map +1 -1
  160. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +266 -0
  161. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
  162. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +91 -5
  163. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -1
  164. package/dist/esm/i18n/system_enums/application-creation.en.d.ts +41 -0
  165. package/dist/esm/i18n/system_enums/application-creation.en.d.ts.map +1 -1
  166. package/dist/esm/i18n/system_enums/application-creation.en.js +45 -1
  167. package/dist/esm/i18n/system_enums/application-creation.en.js.map +1 -1
  168. package/dist/esm/i18n/system_enums/localization.en.d.ts +82 -0
  169. package/dist/esm/i18n/system_enums/localization.en.d.ts.map +1 -0
  170. package/dist/esm/i18n/system_enums/localization.en.js +82 -0
  171. package/dist/esm/i18n/system_enums/localization.en.js.map +1 -0
  172. package/dist/esm/i18n/system_enums/risk-register.en.d.ts +1 -0
  173. package/dist/esm/i18n/system_enums/risk-register.en.d.ts.map +1 -1
  174. package/dist/esm/i18n/system_enums/risk-register.en.js +1 -0
  175. package/dist/esm/i18n/system_enums/risk-register.en.js.map +1 -1
  176. package/dist/esm/i18n/system_enums/workbench-dossier.en.d.ts +10 -0
  177. package/dist/esm/i18n/system_enums/workbench-dossier.en.d.ts.map +1 -1
  178. package/dist/esm/i18n/system_enums/workbench-dossier.en.js +13 -0
  179. package/dist/esm/i18n/system_enums/workbench-dossier.en.js.map +1 -1
  180. package/dist/esm/i18n-labelling/models/labelling-progress.models.d.ts +43 -0
  181. package/dist/esm/i18n-labelling/models/labelling-progress.models.d.ts.map +1 -0
  182. package/dist/esm/i18n-labelling/models/labelling-progress.models.js +34 -0
  183. package/dist/esm/i18n-labelling/models/labelling-progress.models.js.map +1 -0
  184. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.d.ts +8 -0
  185. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.d.ts.map +1 -1
  186. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.js +97 -56
  187. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.js.map +1 -1
  188. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.d.ts +18 -0
  189. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.d.ts.map +1 -1
  190. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.js +269 -153
  191. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.js.map +1 -1
  192. package/dist/esm/i18n-labelling/utils/labelling-concurrency.utils.d.ts +41 -0
  193. package/dist/esm/i18n-labelling/utils/labelling-concurrency.utils.d.ts.map +1 -0
  194. package/dist/esm/i18n-labelling/utils/labelling-concurrency.utils.js +47 -0
  195. package/dist/esm/i18n-labelling/utils/labelling-concurrency.utils.js.map +1 -0
  196. package/dist/esm/i18n-labelling/utils/per-unit-file.utils.d.ts +12 -0
  197. package/dist/esm/i18n-labelling/utils/per-unit-file.utils.d.ts.map +1 -1
  198. package/dist/esm/i18n-labelling/utils/per-unit-file.utils.js +10 -2
  199. package/dist/esm/i18n-labelling/utils/per-unit-file.utils.js.map +1 -1
  200. package/dist/esm/i18n-labelling/utils/staged-label-file-writer.utils.d.ts +89 -0
  201. package/dist/esm/i18n-labelling/utils/staged-label-file-writer.utils.d.ts.map +1 -0
  202. package/dist/esm/i18n-labelling/utils/staged-label-file-writer.utils.js +229 -0
  203. package/dist/esm/i18n-labelling/utils/staged-label-file-writer.utils.js.map +1 -0
  204. package/dist/esm/meta-workflows/models/build-task-rearm.models.d.ts +67 -1
  205. package/dist/esm/meta-workflows/models/build-task-rearm.models.d.ts.map +1 -1
  206. package/dist/esm/meta-workflows/models/build-task-rearm.models.js +64 -0
  207. package/dist/esm/meta-workflows/models/build-task-rearm.models.js.map +1 -1
  208. package/dist/esm/meta-workflows/models/creation-intervention.models.d.ts +308 -0
  209. package/dist/esm/meta-workflows/models/creation-intervention.models.d.ts.map +1 -0
  210. package/dist/esm/meta-workflows/models/creation-intervention.models.js +365 -0
  211. package/dist/esm/meta-workflows/models/creation-intervention.models.js.map +1 -0
  212. package/dist/esm/meta-workflows/models/generation-step-progress.models.d.ts +61 -0
  213. package/dist/esm/meta-workflows/models/generation-step-progress.models.d.ts.map +1 -0
  214. package/dist/esm/meta-workflows/models/generation-step-progress.models.js +58 -0
  215. package/dist/esm/meta-workflows/models/generation-step-progress.models.js.map +1 -0
  216. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.d.ts +10 -6
  217. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.d.ts.map +1 -1
  218. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.js +11 -6
  219. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.js.map +1 -1
  220. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.d.ts +3 -0
  221. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.d.ts.map +1 -1
  222. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.js +8 -1
  223. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.js.map +1 -1
  224. package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts +26 -0
  225. package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts.map +1 -1
  226. package/dist/esm/meta-workflows/models/playbook-run-record.models.js +66 -10
  227. package/dist/esm/meta-workflows/models/playbook-run-record.models.js.map +1 -1
  228. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.d.ts +13 -0
  229. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.d.ts.map +1 -0
  230. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.js +33 -0
  231. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.js.map +1 -0
  232. package/dist/esm/meta-workflows/services/application-assembly-repair.companion.utils.d.ts +145 -0
  233. package/dist/esm/meta-workflows/services/application-assembly-repair.companion.utils.d.ts.map +1 -0
  234. package/dist/esm/meta-workflows/services/application-assembly-repair.companion.utils.js +179 -0
  235. package/dist/esm/meta-workflows/services/application-assembly-repair.companion.utils.js.map +1 -0
  236. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +376 -17
  237. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  238. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +805 -39
  239. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  240. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +93 -7
  241. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
  242. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +142 -25
  243. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
  244. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +120 -3
  245. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
  246. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js +325 -16
  247. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
  248. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.d.ts.map +1 -1
  249. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js +15 -6
  250. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js.map +1 -1
  251. package/dist/esm/meta-workflows/services/application-maturity-executor.companion.service.d.ts.map +1 -1
  252. package/dist/esm/meta-workflows/services/application-maturity-executor.companion.service.js +10 -11
  253. package/dist/esm/meta-workflows/services/application-maturity-executor.companion.service.js.map +1 -1
  254. package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.d.ts.map +1 -1
  255. package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.js +10 -11
  256. package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.js.map +1 -1
  257. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.d.ts +82 -0
  258. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.d.ts.map +1 -0
  259. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js +291 -0
  260. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js.map +1 -0
  261. package/dist/esm/meta-workflows/services/creation-lane-preflight.companion.service.d.ts +60 -0
  262. package/dist/esm/meta-workflows/services/creation-lane-preflight.companion.service.d.ts.map +1 -0
  263. package/dist/esm/meta-workflows/services/creation-lane-preflight.companion.service.js +66 -0
  264. package/dist/esm/meta-workflows/services/creation-lane-preflight.companion.service.js.map +1 -0
  265. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts +53 -0
  266. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts.map +1 -0
  267. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js +164 -0
  268. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js.map +1 -0
  269. package/dist/esm/meta-workflows/services/dossier-write-queue.companion.utils.d.ts +37 -0
  270. package/dist/esm/meta-workflows/services/dossier-write-queue.companion.utils.d.ts.map +1 -0
  271. package/dist/esm/meta-workflows/services/dossier-write-queue.companion.utils.js +52 -0
  272. package/dist/esm/meta-workflows/services/dossier-write-queue.companion.utils.js.map +1 -0
  273. package/dist/esm/meta-workflows/services/dossier.companion.service.d.ts +74 -14
  274. package/dist/esm/meta-workflows/services/dossier.companion.service.d.ts.map +1 -1
  275. package/dist/esm/meta-workflows/services/dossier.companion.service.js +180 -28
  276. package/dist/esm/meta-workflows/services/dossier.companion.service.js.map +1 -1
  277. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts +2 -3
  278. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts.map +1 -1
  279. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js +2 -8
  280. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js.map +1 -1
  281. package/dist/esm/meta-workflows/services/interview-answer-proposal.companion.d.ts +67 -0
  282. package/dist/esm/meta-workflows/services/interview-answer-proposal.companion.d.ts.map +1 -0
  283. package/dist/esm/meta-workflows/services/interview-answer-proposal.companion.js +64 -0
  284. package/dist/esm/meta-workflows/services/interview-answer-proposal.companion.js.map +1 -0
  285. package/dist/esm/meta-workflows/services/playbook-instance.companion.service.d.ts.map +1 -1
  286. package/dist/esm/meta-workflows/services/playbook-instance.companion.service.js +11 -3
  287. package/dist/esm/meta-workflows/services/playbook-instance.companion.service.js.map +1 -1
  288. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts +92 -4
  289. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts.map +1 -1
  290. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js +328 -7
  291. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js.map +1 -1
  292. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +105 -6
  293. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
  294. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +309 -39
  295. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  296. package/dist/esm/meta-workflows/services/playbook-spend-meter.companion.service.d.ts +62 -1
  297. package/dist/esm/meta-workflows/services/playbook-spend-meter.companion.service.d.ts.map +1 -1
  298. package/dist/esm/meta-workflows/services/playbook-spend-meter.companion.service.js +152 -2
  299. package/dist/esm/meta-workflows/services/playbook-spend-meter.companion.service.js.map +1 -1
  300. package/package.json +22 -18
  301. package/dist/esm/.tsbuildinfo +0 -1
  302. package/dist/esm/__tests__/asset-noop.d.ts +0 -3
  303. package/dist/esm/__tests__/asset-noop.d.ts.map +0 -1
  304. package/dist/esm/__tests__/asset-noop.js +0 -2
  305. package/dist/esm/__tests__/asset-noop.js.map +0 -1
  306. package/dist/esm/__tests__/chdir-dogfood-app.setup.d.ts +0 -2
  307. package/dist/esm/__tests__/chdir-dogfood-app.setup.d.ts.map +0 -1
  308. package/dist/esm/__tests__/chdir-dogfood-app.setup.js +0 -44
  309. package/dist/esm/__tests__/chdir-dogfood-app.setup.js.map +0 -1
  310. package/dist/esm/__tests__/internal-test-view.d.ts +0 -39
  311. package/dist/esm/__tests__/internal-test-view.d.ts.map +0 -1
  312. package/dist/esm/__tests__/internal-test-view.js +0 -2
  313. package/dist/esm/__tests__/internal-test-view.js.map +0 -1
  314. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.d.ts +0 -50
  315. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.d.ts.map +0 -1
  316. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.js +0 -157
  317. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.js.map +0 -1
  318. package/dist/esm/meta-workflows/services/__tests__/application-build-task-coding.companion.test-fixtures.d.ts +0 -8
  319. package/dist/esm/meta-workflows/services/__tests__/application-build-task-coding.companion.test-fixtures.d.ts.map +0 -1
  320. package/dist/esm/meta-workflows/services/__tests__/application-build-task-coding.companion.test-fixtures.js +0 -43
  321. package/dist/esm/meta-workflows/services/__tests__/application-build-task-coding.companion.test-fixtures.js.map +0 -1
  322. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.d.ts +0 -79
  323. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.d.ts.map +0 -1
  324. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.js +0 -193
  325. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.js.map +0 -1
@@ -16,12 +16,15 @@ import { inject, injectable } from 'inversify';
16
16
  import { getFrameworkKnowledgePlaybook, listFrameworkKnowledgePlaybooks } from '@wildo-ai/framework-knowledge';
17
17
  import { ApplicationAuthoredDocumentFactSpecificationSchema, ApplicationCreatorInputsSchema, ApplicationDocumentFactSpecificationSchema, ApplicationSpecificationFamily, ApplicationSpecificationFamilySemanticSchemaRef, MetaWorkflowPlaybookSchema, creatorInputAnswerKey, } from '@wildo-ai/saas-specifications/application-creation';
18
18
  import { createInitialAssuranceDocumentAuthorityCatalog, selectAssuranceDocumentBlueprintForDocumentRef, } from '@wildo-ai/saas-specifications/assurance';
19
- import { PlaybookElicitationError, deriveAffectedFamilies, landCreatorInputAnswer, resolveApplicationLineScope, resolvePlaybookOutputLandingTarget, unansweredElicitationQuestionRefs, } from '@wildo-ai/application-creation-runtime';
19
+ import { WorkbenchDossierEntryOptionsState } from '@wildo-ai/platform-core-shared';
20
+ import { isElicitationQuestionAskedInSimpleInterview, isElicitationQuestionProposable, isRegulatedDomainElicitationQuestion } from '@wildo-ai/saas-models/meta-workflows';
21
+ import { PlaybookElicitationError, createCompanionExportsFamilyReader, deriveAffectedFamilies, materializeElicitationOptions, landCreatorInputAnswer, landInterviewDepth, resolveApplicationLineScope, resolvePlaybookOutputLandingTarget, unansweredElicitationQuestionRefs, } from '@wildo-ai/application-creation-runtime';
20
22
  import { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';
21
23
  import { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types.js';
22
24
  import { importLandedTypeScriptModule } from './landed-module-import.companion.js';
23
25
  import { loadSpecificationsCompanionExports } from '../../core/context/companion-package-loaders.companion.js';
24
26
  import { selectCurrentGovernedDocumentTexts } from './governed-document-texts.companion.js';
27
+ import { serializeDossierWrite } from './dossier-write-queue.companion.utils.js';
25
28
  import { readCompiledApplicationLineCatalog } from '../models/application-line-catalog.models.js';
26
29
  /**
27
30
  * THE DOSSIER's companion service (#1454, Steps 5–6): what the creator was asked — by a playbook
@@ -37,12 +40,17 @@ import { readCompiledApplicationLineCatalog } from '../models/application-line-c
37
40
  *
38
41
  * ## One writer, and it lands a family
39
42
  *
40
- * {@link recordAnswer} is the only way an answer enters the dossier — the resource operation and
41
- * the assistant's `record_answer` tool both arrive here. It validates the answer against the
42
- * question's kind with the SAME function a run applies when it reads the answer back, merges it
43
- * into the dossier by key, and lands the family file. It does not commit: a landed dossier is a
43
+ * An answer enters the dossier by two doors only, and both land it through the same private
44
+ * `landAnswer`: {@link recordAnswer}, where the resource operation and the assistant's `record_answer`
45
+ * tool both arrive, and {@link fileStillNeededAnswers}, for what a run's gate collected. It
46
+ * validates the answer against the question's kind with the SAME function a run applies when it
47
+ * reads the answer back, merges it into the dossier by key, and lands the family file. It does not commit: a landed dossier is a
44
48
  * working edit until a human commits it (`.claude/rules/one-source-of-truth.md`, rules 2 and 3).
45
49
  *
50
+ * Every write here is a read-modify-write of that one file, so every write goes through
51
+ * {@link serializeDossierWrite}: two overlapping saves would otherwise both build on the same read, and
52
+ * the second would erase the first one's change (#2179).
53
+ *
46
54
  * ## An answer to a question no playbook asks any more is REPORTED, not dropped
47
55
  *
48
56
  * The catalog moves. A committed answer whose question was renamed or retired stays in the file
@@ -52,6 +60,18 @@ import { readCompiledApplicationLineCatalog } from '../models/application-line-c
52
60
  */
53
61
  /** The constant prefix every landed family uses — neutral by contract (#65), never the application's name. */
54
62
  const LANDED_CONSTANT_PREFIX = 'application';
63
+ /**
64
+ * One question's interview disposition (#2129) — what a surface needs to run a simple interview. Read
65
+ * through the shared predicates, never re-derived, so the dossier page, the workbench interview and the
66
+ * console queue select the same questions.
67
+ */
68
+ function interviewQuestionDisposition(question) {
69
+ return {
70
+ askedInSimpleInterview: isElicitationQuestionAskedInSimpleInterview(question),
71
+ proposable: isElicitationQuestionProposable(question),
72
+ regulatedDomain: isRegulatedDomainElicitationQuestion(question),
73
+ };
74
+ }
55
75
  let DossierCompanionService = class DossierCompanionService {
56
76
  logger;
57
77
  companionContext;
@@ -199,9 +219,35 @@ let DossierCompanionService = class DossierCompanionService {
199
219
  const claimed = new Set();
200
220
  const knownPlaybookRefs = new Set();
201
221
  /* The whole parsed catalog first: what an answer affects is a question about every OTHER playbook. */
222
+ /*
223
+ * COMPUTED options resolved once for the whole listing (the brand-name choice is computed from the landed
224
+ * screening): a row shows exactly the options its answer will be checked against. A question whose source
225
+ * has not landed lists no options — its playbook is not eligible yet, so it is not asked now either.
226
+ */
227
+ const optionReads = await this.readElicitationOptionSources();
228
+ const unavailableOptionsByPlaybook = new Map();
202
229
  const catalog = listFrameworkKnowledgePlaybooks()
203
230
  .map((summary) => this.readParsedPlaybook(summary.ref))
204
- .filter((playbook) => playbook !== undefined);
231
+ .filter((playbook) => playbook !== undefined)
232
+ .map((playbook) => {
233
+ const materialized = materializeElicitationOptions(playbook, optionReads);
234
+ unavailableOptionsByPlaybook.set(playbook.ref, materialized.unavailableOptions);
235
+ return materialized.playbook;
236
+ });
237
+ /*
238
+ * The state of a question's options, and the answer as it may still be READ: an answer to a computed
239
+ * CHOICE that is no longer among its options would be refused by the run, so it is not carried as the
240
+ * answer — the row reads as still needed and says why.
241
+ */
242
+ const optionsOf = (playbook, question, answer) => {
243
+ if (question.optionsFrom === undefined)
244
+ return { optionsState: WorkbenchDossierEntryOptionsState.AVAILABLE, answer };
245
+ if (unavailableOptionsByPlaybook.get(playbook.ref)?.has(question.ref))
246
+ return { optionsState: WorkbenchDossierEntryOptionsState.NOT_YET_AVAILABLE, answer };
247
+ if (answer !== undefined && !(question.options ?? []).includes(answer.value))
248
+ return { optionsState: WorkbenchDossierEntryOptionsState.ANSWER_NO_LONGER_OFFERED, answer: undefined };
249
+ return { optionsState: WorkbenchDossierEntryOptionsState.AVAILABLE, answer };
250
+ };
205
251
  /*
206
252
  * Which fallback steps READ each owner's decision — the owner row carries them. A fallback holding
207
253
  * an answer of its own reads THAT answer (`readAnswersForPlaybookQuestions`: an own answer wins),
@@ -253,14 +299,17 @@ let DossierCompanionService = class DossierCompanionService {
253
299
  */
254
300
  if (question.sameDecisionAs !== undefined && !answersByKey.has(key))
255
301
  return;
302
+ const options = optionsOf(playbook, question, answersByKey.get(key));
256
303
  entries.push({
257
304
  playbookRef: playbook.ref,
258
305
  questionRef: question.ref,
259
306
  question: question.question,
260
307
  kind: String(question.kind),
261
308
  options: [...(question.options ?? [])],
309
+ optionsState: options.optionsState,
262
310
  position,
263
- answer: answersByKey.get(key),
311
+ answer: options.answer,
312
+ ...interviewQuestionDisposition(question),
264
313
  affectsFamilies,
265
314
  subjectFamily,
266
315
  sharedWithPlaybookRefs: sharedWith.get(key) ?? [],
@@ -285,6 +334,7 @@ let DossierCompanionService = class DossierCompanionService {
285
334
  */
286
335
  if (activation.closure !== undefined)
287
336
  return;
337
+ const options = optionsOf(playbook, question, answersByKey.get(key));
288
338
  entries.push({
289
339
  playbookRef: playbook.ref,
290
340
  instanceKey: activation.instanceKey,
@@ -293,8 +343,10 @@ let DossierCompanionService = class DossierCompanionService {
293
343
  question: question.question,
294
344
  kind: String(question.kind),
295
345
  options: [...(question.options ?? [])],
346
+ optionsState: options.optionsState,
296
347
  position,
297
- answer: answersByKey.get(key),
348
+ answer: options.answer,
349
+ ...interviewQuestionDisposition(question),
298
350
  ...(answersByKey.has(key) ? {} : withStepAnswer(answersByKey.get(creatorInputAnswerKey(playbook.ref, question.ref)))),
299
351
  affectsFamilies,
300
352
  subjectFamily,
@@ -306,14 +358,25 @@ let DossierCompanionService = class DossierCompanionService {
306
358
  const orphaned = (creatorInputs?.answers ?? [])
307
359
  .filter((answer) => !claimed.has(creatorInputAnswerKey(answer.playbookRef, answer.questionRef, answer.instanceKey)))
308
360
  .map((answer) => ({ answer, reason: knownPlaybookRefs.has(answer.playbookRef) ? 'unknown_question' : 'unknown_playbook' }));
309
- return { entries, orphaned };
361
+ return { entries, orphaned, interviewDepth: creatorInputs?.interviewDepth };
310
362
  }
311
363
  /**
312
364
  * Record one answer. Refuses — by name, as a `PlaybookElicitationError` the dispatch translates to
313
365
  * a 400 — an unknown playbook, a question the playbook does not ask, a CHOICE outside its options
314
- * or an ambiguous CONFIRM. Everything else lands.
366
+ * or an ambiguous CONFIRM. Everything else lands, one dossier write at a time (#2179).
315
367
  */
316
368
  async recordAnswer(input) {
369
+ const specificationsPackageRoot = this.companionContext.resolvedSpecifications?.packageRoot;
370
+ // No package: `landAnswer` refuses with its own message, and there is nothing to serialize.
371
+ if (!specificationsPackageRoot)
372
+ return this.landAnswer(input);
373
+ return serializeDossierWrite(specificationsPackageRoot, () => this.landAnswer(input));
374
+ }
375
+ /**
376
+ * {@link recordAnswer} without taking the dossier write queue: the caller must already hold it. The queue
377
+ * is not re-entrant, so a method that files several answers takes it once and lands each through here.
378
+ */
379
+ async landAnswer(input) {
317
380
  const specificationsPackageRoot = this.companionContext.resolvedSpecifications?.packageRoot;
318
381
  if (!specificationsPackageRoot) {
319
382
  throw new Error('No specifications package is declared in wildo.saas.config.ts; there is nowhere to land the dossier.');
@@ -344,15 +407,29 @@ let DossierCompanionService = class DossierCompanionService {
344
407
  throw new PlaybookElicitationError(`"${input.questionRef}" of "${input.playbookRef}" shares its decision with "${shared?.playbookRef}", which is no longer a compiled playbook.`);
345
408
  }
346
409
  const questionRef = shared ? shared.questionRef : input.questionRef;
410
+ /*
411
+ * Computed options are resolved HERE, against the families landed now, so a computed CHOICE is checked
412
+ * against the list the person was shown. A source with nothing to offer is refused with its own reason
413
+ * (e.g. "no brand-name screening has landed yet") rather than as an answer outside an empty list.
414
+ */
415
+ const computesOptions = playbook.method?.elicitation?.questions?.find((question) => question.ref === questionRef)?.optionsFrom !== undefined;
416
+ const materialized = computesOptions
417
+ ? materializeElicitationOptions(playbook, await this.readElicitationOptionSources())
418
+ : { playbook, unavailableOptions: new Map() };
419
+ const unavailable = materialized.unavailableOptions.get(questionRef);
420
+ if (unavailable !== undefined)
421
+ throw new PlaybookElicitationError(`"${questionRef}" of "${playbook.ref}" cannot be answered yet: ${unavailable}`);
347
422
  const landed = await landCreatorInputAnswer({
348
423
  specificationsPackageRoot,
349
424
  constantPrefix: LANDED_CONSTANT_PREFIX,
350
- playbook,
425
+ playbook: materialized.playbook,
351
426
  current,
352
427
  questionRef,
353
428
  ...(input.instanceKey !== undefined ? { instanceKey: input.instanceKey } : {}),
354
429
  value: input.value,
355
430
  answeredByRef: input.answeredByRef,
431
+ ...(input.standing !== undefined ? { standing: input.standing } : {}),
432
+ ...(input.assumptionRationale !== undefined ? { assumptionRationale: input.assumptionRationale } : {}),
356
433
  answeredAt: new Date().toISOString(),
357
434
  ...(input.dryRun === true ? { dryRun: true } : {}),
358
435
  });
@@ -373,7 +450,7 @@ let DossierCompanionService = class DossierCompanionService {
373
450
  }
374
451
  /**
375
452
  * FILE what a step's Run gate collected (#1454 review, LOW): each answer to a question the dossier
376
- * does NOT answer for that step yet is recorded through {@link recordAnswer} — the same validation,
453
+ * does NOT answer for that step yet is landed as {@link recordAnswer} lands it (`landAnswer`) — the same validation,
377
454
  * the same shared-decision filing, the same provenance — so the next run does not ask again and the
378
455
  * dossier stops saying "still needed" about a step that ran.
379
456
  *
@@ -382,28 +459,103 @@ let DossierCompanionService = class DossierCompanionService {
382
459
  * rewrite a decision the creator made elsewhere, so an answered question's override stays an
383
460
  * override. A blank answer is not an answer and is left to the run, which names what is missing.
384
461
  *
385
- * Sequential on purpose: each `recordAnswer` re-reads the dossier it merges into, so two answers
386
- * filed in parallel would each land a file missing the other.
462
+ * Sequential on purpose: each answer re-reads the dossier it merges into, so two answers filed in
463
+ * parallel would each land a file missing the other.
464
+ *
465
+ * The whole filing holds the dossier write queue ONCE (#2179), the "still needed" read included. Taken
466
+ * per answer instead, a person's answer could land between that read and the filing, and the gate's
467
+ * answer would then overwrite a decision the creator had just made: the override this method exists
468
+ * never to file.
387
469
  */
388
470
  async fileStillNeededAnswers(input) {
389
471
  const playbook = this.readParsedPlaybook(input.playbookRef);
390
472
  if (!playbook)
391
473
  return [];
392
- const stillNeeded = new Set(unansweredElicitationQuestionRefs(playbook, await this.readCreatorInputs(), input.instanceKey));
393
- const filed = [];
394
- for (const answer of input.answers) {
395
- if (!stillNeeded.has(answer.questionRef) || answer.answer.trim().length === 0)
396
- continue;
397
- await this.recordAnswer({
398
- playbookRef: input.playbookRef,
399
- questionRef: answer.questionRef,
400
- value: answer.answer,
401
- answeredByRef: input.answeredByRef,
402
- ...(input.instanceKey !== undefined ? { instanceKey: input.instanceKey } : {}),
403
- });
404
- filed.push(answer.questionRef);
474
+ const file = async () => {
475
+ const stillNeeded = new Set(unansweredElicitationQuestionRefs(playbook, await this.readCreatorInputs(), input.instanceKey));
476
+ const filed = [];
477
+ for (const answer of input.answers) {
478
+ if (!stillNeeded.has(answer.questionRef) || answer.answer.trim().length === 0)
479
+ continue;
480
+ await this.landAnswer({
481
+ playbookRef: input.playbookRef,
482
+ questionRef: answer.questionRef,
483
+ value: answer.answer,
484
+ answeredByRef: input.answeredByRef,
485
+ ...(input.instanceKey !== undefined ? { instanceKey: input.instanceKey } : {}),
486
+ });
487
+ filed.push(answer.questionRef);
488
+ }
489
+ return filed;
490
+ };
491
+ const specificationsPackageRoot = this.companionContext.resolvedSpecifications?.packageRoot;
492
+ return specificationsPackageRoot ? serializeDossierWrite(specificationsPackageRoot, file) : file();
493
+ }
494
+ /** The landed families a computed interview option is resolved from, read through the companion-exports aggregate. */
495
+ async readElicitationOptionSources() {
496
+ try {
497
+ return createCompanionExportsFamilyReader((await loadSpecificationsCompanionExports(this.companionContext)));
405
498
  }
406
- return filed;
499
+ catch (error) {
500
+ /*
501
+ * An aggregate that cannot be loaded reads as NOTHING LANDED, like every other family this service reads:
502
+ * a computed question then offers no options and cannot be answered (it is refused with its reason), and
503
+ * the rest of the dossier still lists. Throwing here would take the whole dossier down over one question.
504
+ */
505
+ this.logDebug('The specifications aggregate could not be loaded; computed interview options read as unavailable', { error: String(error) });
506
+ return createCompanionExportsFamilyReader(undefined);
507
+ }
508
+ }
509
+ /**
510
+ * Record how deep this application's interviews go (#2129). A working edit in the dossier, like an answer,
511
+ * and queued like one (#2179).
512
+ */
513
+ async recordInterviewDepth(interviewDepth) {
514
+ const specificationsPackageRoot = this.companionContext.resolvedSpecifications?.packageRoot;
515
+ if (!specificationsPackageRoot) {
516
+ throw new Error('No specifications package is declared in wildo.saas.config.ts; there is nowhere to land the dossier.');
517
+ }
518
+ const landed = await serializeDossierWrite(specificationsPackageRoot, async () => landInterviewDepth({
519
+ specificationsPackageRoot,
520
+ constantPrefix: LANDED_CONSTANT_PREFIX,
521
+ current: await this.readCreatorInputs(),
522
+ interviewDepth,
523
+ }));
524
+ this.logDebug('Interview depth recorded', { interviewDepth, packageRelativePath: landed.packageRelativePath });
525
+ return { interviewDepth, packageRelativePath: landed.packageRelativePath };
526
+ }
527
+ /**
528
+ * One playbook as an answer to it is checked: parsed from the compiled catalog, with its COMPUTED options
529
+ * resolved against what has landed now — the list a person is shown and a proposal must choose from
530
+ * (#2129). `undefined` when the catalog holds no such playbook.
531
+ */
532
+ async readAnswerablePlaybook(playbookRef) {
533
+ const playbook = this.readParsedPlaybook(playbookRef);
534
+ if (!playbook)
535
+ return undefined;
536
+ const computesOptions = (playbook.method?.elicitation?.questions ?? []).some((question) => question.optionsFrom !== undefined);
537
+ return computesOptions ? materializeElicitationOptions(playbook, await this.readElicitationOptionSources()).playbook : playbook;
538
+ }
539
+ /**
540
+ * Each interview question's depth and whether it may be proposed (#2129), keyed `<playbookRef>#<questionRef>`
541
+ * — what the console queue tells a surface so it can run a simple interview. Computed options are resolved
542
+ * first, so a computed CHOICE with nothing to offer yet reads as not proposable.
543
+ */
544
+ async readInterviewQuestionDispositions() {
545
+ const dispositions = new Map();
546
+ for (const listed of this.listInterviewPlaybooks()) {
547
+ const playbook = (await this.readAnswerablePlaybook(listed.ref)) ?? listed;
548
+ for (const question of playbook.method?.elicitation?.questions ?? []) {
549
+ dispositions.set(`${playbook.ref}#${question.ref}`, interviewQuestionDisposition(question));
550
+ }
551
+ }
552
+ return dispositions;
553
+ }
554
+ /** Every compiled playbook that declares an interview — the question texts a proposal reads the dossier through. */
555
+ listInterviewPlaybooks() {
556
+ return listFrameworkKnowledgePlaybooks()
557
+ .map((entry) => this.readParsedPlaybook(entry.ref))
558
+ .filter((playbook) => (playbook?.method?.elicitation?.questions?.length ?? 0) > 0);
407
559
  }
408
560
  /** A catalog entry that does not satisfy its own contract is skipped, never fatal — one malformed playbook must not hide the rest. */
409
561
  readParsedPlaybook(playbookRef) {
@@ -1 +1 @@
1
- {"version":3,"file":"dossier.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/dossier.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAC/G,OAAO,EACL,kDAAkD,EAClD,8BAA8B,EAC9B,0CAA0C,EAC1C,8BAA8B,EAC9B,+CAA+C,EAC/C,0BAA0B,EAC1B,qBAAqB,GAQtB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EACL,8CAA8C,EAC9C,8CAA8C,GAE/C,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,EAC3B,kCAAkC,EAClC,iCAAiC,GAClC,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAEhF,OAAO,EAA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,GAAG,0BAA0B,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACvE,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAClD,CAAC;CACF,CAAA;AAnXY,uBAAuB;IADnC,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;;GALxC,uBAAuB,CAmXnC;;AAED,6EAA6E;AAC7E,SAAS,cAAc,CAAC,MAAiD;IACvE,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC;AACnE,CAAC","sourcesContent":["import { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { inject, injectable } from 'inversify';\nimport { getFrameworkKnowledgePlaybook, listFrameworkKnowledgePlaybooks } from '@wildo-ai/framework-knowledge';\nimport {\n ApplicationAuthoredDocumentFactSpecificationSchema,\n ApplicationCreatorInputsSchema,\n ApplicationDocumentFactSpecificationSchema,\n ApplicationSpecificationFamily,\n ApplicationSpecificationFamilySemanticSchemaRef,\n MetaWorkflowPlaybookSchema,\n creatorInputAnswerKey,\n type ApplicationAuthoredDocumentFactSpecification,\n type ApplicationComplianceDocumentCandidateSet,\n type ApplicationCreatorInputAnswer,\n type ApplicationCreatorInputs,\n type ApplicationDocumentFactSpecification,\n type ComplianceDocumentCandidate,\n type MetaWorkflowPlaybook,\n} from '@wildo-ai/saas-specifications/application-creation';\nimport {\n createInitialAssuranceDocumentAuthorityCatalog,\n selectAssuranceDocumentBlueprintForDocumentRef,\n type AssuranceDocumentPublicationVariant,\n} from '@wildo-ai/saas-specifications/assurance';\nimport type { GovernedDocumentPublicDocument, GovernedDocumentRelease } from '@wildo-ai/saas-models';\nimport {\n PlaybookElicitationError,\n deriveAffectedFamilies,\n landCreatorInputAnswer,\n resolveApplicationLineScope,\n resolvePlaybookOutputLandingTarget,\n unansweredElicitationQuestionRefs,\n} from '@wildo-ai/application-creation-runtime';\nimport type { LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport { importLandedTypeScriptModule } from './landed-module-import.companion';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { loadSpecificationsCompanionExports } from '../../core/context/companion-package-loaders.companion';\nimport { selectCurrentGovernedDocumentTexts } from './governed-document-texts.companion';\nimport { readCompiledApplicationLineCatalog } from '../models/application-line-catalog.models';\n\n/**\n * THE DOSSIER's companion service (#1454, Steps 5–6): what the creator was asked — by a playbook\n * interview or by a governed document — what they said, and the one door for saying more.\n *\n * ## Two sources, one join\n *\n * The QUESTIONS are the compiled playbook catalog's — every `method.elicitation.questions` entry of\n * every playbook that declares one. The ANSWERS are the `creator-inputs` family, read through the\n * application's companion-exports aggregate like every other landed family. Neither alone is what\n * a person reads, so {@link listDossierEntries} is the join: one entry per declared question,\n * carrying the answer when there is one and `STILL_NEEDED` when there is not.\n *\n * ## One writer, and it lands a family\n *\n * {@link recordAnswer} is the only way an answer enters the dossier — the resource operation and\n * the assistant's `record_answer` tool both arrive here. It validates the answer against the\n * question's kind with the SAME function a run applies when it reads the answer back, merges it\n * into the dossier by key, and lands the family file. It does not commit: a landed dossier is a\n * working edit until a human commits it (`.claude/rules/one-source-of-truth.md`, rules 2 and 3).\n *\n * ## An answer to a question no playbook asks any more is REPORTED, not dropped\n *\n * The catalog moves. A committed answer whose question was renamed or retired stays in the file\n * and is listed as ORPHANED here, so the person who gave it can see it went nowhere — deleting it\n * silently would be a regeneration destroying a human decision, the defect the two document-facts\n * families exist to prevent.\n */\n\n/** The constant prefix every landed family uses — neutral by contract (#65), never the application's name. */\nconst LANDED_CONSTANT_PREFIX = 'application';\n\n/** One question of the catalog, with the creator's answer when there is one. */\nexport interface DossierEntry {\n readonly playbookRef: string;\n /** The playbook INSTANCE this row asks for (#1609); absent on the default instance's rows. */\n readonly instanceKey?: string;\n /** What that instance was opened FOR, as its activation records it; absent on the default instance's rows. */\n readonly instancePurpose?: string;\n readonly questionRef: string;\n readonly question: string;\n readonly kind: string;\n readonly options: readonly string[];\n readonly position: number;\n readonly answer: ApplicationCreatorInputAnswer | undefined;\n /**\n * On an instance's row with no answer of its own: the step's own answer, which the instance runs on\n * until it is given one (#1609). Absent on the default instance's rows, and whenever `answer` is set.\n */\n readonly answerFromTheStep?: ApplicationCreatorInputAnswer;\n /**\n * Every family this answer feeds — what the asking playbook produces and everything downstream of\n * it — so \"changing this affects: …\" is on the row before anyone saves (#1454, Step 8). Derived\n * from the catalog's declared inputs and outputs; empty for a playbook that produces nothing.\n */\n readonly affectsFamilies: readonly string[];\n /**\n * The family whose SUBJECT this question belongs to (#1454, gap 4): what the asking step itself\n * produces; for a composite that produces nothing directly, what the steps it admits produce; and\n * only then the first family its answer reaches. The last is a downstream family — a compliance\n * interview reaches the vision by way of the build — so it is the fallback, never the first choice.\n */\n readonly subjectFamily: string | undefined;\n /**\n * The OTHER steps that READ this decision through a `sameDecisionAs` fallback (#1454 review) — every\n * such step without an answer of its own. The decision is ONE row, at its owner; those steps'\n * interviews show and answer this row, so a creator is asked once. A fallback that holds its own\n * (legacy) answer reads that answer instead, and is listed on its own row, not here.\n */\n readonly sharedWithPlaybookRefs: readonly string[];\n}\n\n/** A committed answer whose question the catalog no longer declares. */\nexport interface OrphanedDossierAnswer {\n readonly answer: ApplicationCreatorInputAnswer;\n /** `unknown_playbook` when the playbook itself is gone, `unknown_question` when only the question is. */\n readonly reason: 'unknown_playbook' | 'unknown_question';\n}\n\nexport interface DossierListing {\n readonly entries: readonly DossierEntry[];\n readonly orphaned: readonly OrphanedDossierAnswer[];\n}\n\nexport interface RecordAnswerResult {\n readonly answer: ApplicationCreatorInputAnswer;\n readonly packageRelativePath: string;\n /** The asking playbook's questions still unanswered after this one — empty means it can run. */\n readonly unansweredQuestionRefs: readonly string[];\n readonly dryRun: boolean;\n}\n\n@injectable()\nexport class DossierCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n public constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n ) {\n this.logDebug = this.logger.debugByType('DossierCompanionService');\n }\n\n /**\n * The dossier as LANDED — the family read through the companion-exports aggregate, re-parsed\n * because a person may have edited the file by hand. A file that does not parse is reported as\n * absent with a debug line rather than thrown: the dossier being unreadable must not take the\n * eligibility board down with it, and the artifact list reports the family as invalid on its own.\n */\n public async readCreatorInputs(): Promise<ApplicationCreatorInputs | undefined> {\n const exports = await loadSpecificationsCompanionExports(this.companionContext);\n const raw = (exports as { creatorInputs?: unknown }).creatorInputs;\n if (raw === undefined || raw === null) return undefined;\n const parsed = ApplicationCreatorInputsSchema.safeParse(raw);\n if (!parsed.success) {\n this.logDebug('The landed creator-inputs family does not satisfy its schema; reading the dossier as empty', {\n issue: parsed.error.issues[0]?.message,\n });\n return undefined;\n }\n return parsed.data;\n }\n\n /**\n * The AUTHORED governed-document facts as landed (#1454, Step 6) — the governance half of the\n * dossier, read through the same aggregate as the interview half and re-parsed for the same\n * reason. What a governance landing merges INTO, and what decides a question's standing.\n */\n public async readAuthoredDocumentFacts(): Promise<ApplicationAuthoredDocumentFactSpecification | undefined> {\n const exports = await loadSpecificationsCompanionExports(this.companionContext);\n const raw = (exports as { authoredDocumentFactSpecification?: unknown }).authoredDocumentFactSpecification;\n if (raw === undefined || raw === null) return undefined;\n const parsed = ApplicationAuthoredDocumentFactSpecificationSchema.safeParse(raw);\n if (!parsed.success) {\n this.logDebug('The landed document-facts-authored family does not satisfy its schema; reading the governance facts as empty', {\n issue: parsed.error.issues[0]?.message,\n });\n return undefined;\n }\n return parsed.data;\n }\n\n /**\n * The governed-document facts the PRODUCT established, as landed by the document-facts step\n * (#1454, gap 4) — what the dossier shows as \"read from the product\". Re-parsed like its siblings:\n * a landed file that no longer satisfies its schema reads as nothing read yet, never as an answer.\n */\n public async readDerivedDocumentFacts(): Promise<ApplicationDocumentFactSpecification | undefined> {\n const exports = await loadSpecificationsCompanionExports(this.companionContext);\n const raw = (exports as { documentFactSpecification?: unknown }).documentFactSpecification;\n if (raw === undefined || raw === null) return undefined;\n const parsed = ApplicationDocumentFactSpecificationSchema.safeParse(raw);\n if (!parsed.success) {\n this.logDebug('The landed document-facts family does not satisfy its schema; reading the product facts as unread', {\n issue: parsed.error.issues[0]?.message,\n });\n return undefined;\n }\n return parsed.data;\n }\n\n /**\n * The governed documents the creator ASKED FOR — those with a landed draft — as definition refs.\n *\n * Read off the landed candidate-set FILE the way the run service reads it (the family has no\n * companion-exports slot: a draft is not accepted truth), and joined to definitions through the\n * catalog's own `document:` → `document-definition:` rule. An open fact of a drafted document is\n * asked of the person now; one of an undrafted document is merely not told yet.\n */\n public async listDraftedGovernedDocumentDefinitionRefs(): Promise<ReadonlySet<string>> {\n let drafts: readonly ComplianceDocumentCandidate[];\n try {\n drafts = await this.readLandedGovernedDocumentDrafts();\n } catch (error) {\n // An unreadable draft set is the artifact list's finding; here it reads as \"nothing drafted\", never as a throw on every dossier read.\n this.logDebug('The landed draft set could not be read; treating no document as drafted', { error: String(error) });\n return new Set();\n }\n const catalog = createInitialAssuranceDocumentAuthorityCatalog();\n const refs = new Set<string>();\n for (const candidate of drafts) {\n const selection = selectAssuranceDocumentBlueprintForDocumentRef(catalog, candidate.documentRef);\n if (selection) refs.add(selection.definition.identity.definitionRef);\n }\n return refs;\n }\n\n /**\n * Every governed document's CURRENT text, keyed by definition ref (#1645): its release, else its\n * latest draft — see {@link selectCurrentGovernedDocumentTexts}. What the workbench prints when the\n * creator asks for all their documents as one PDF.\n *\n * Unlike {@link listDraftedGovernedDocumentDefinitionRefs}, an unreadable draft set THROWS here. That\n * method answers a question a dossier can survive not knowing; this one produces a file a person hands\n * to a reviewer, and printing every document as \"not composed yet\" because the drafts could not be\n * read would be a false document.\n */\n public async readCurrentGovernedDocumentTexts(at: Date): Promise<ReadonlyMap<string, GovernedDocumentPublicDocument>> {\n const exports = (await loadSpecificationsCompanionExports(this.companionContext)) as {\n documentReleaseSet?: { releases?: readonly GovernedDocumentRelease[] };\n documentPublicationSpecification?: { variants?: readonly AssuranceDocumentPublicationVariant[] };\n } | undefined;\n const catalog = createInitialAssuranceDocumentAuthorityCatalog();\n return selectCurrentGovernedDocumentTexts({\n releases: exports?.documentReleaseSet?.releases ?? [],\n drafts: await this.readLandedGovernedDocumentDrafts(),\n definitionRefOfDraft: (draft) => selectAssuranceDocumentBlueprintForDocumentRef(catalog, draft.documentRef)?.definition.identity.definitionRef,\n publishedVariants: exports?.documentPublicationSpecification?.variants ?? [],\n at: at.toISOString(),\n });\n }\n\n /**\n * The drafts in the landed candidate-set FILE, read the way the run service reads it (the family has\n * no companion-exports slot: a draft is not accepted truth). No file is no drafts; a file that cannot\n * be loaded THROWS — each caller decides what not knowing means for it.\n */\n private async readLandedGovernedDocumentDrafts(): Promise<readonly ComplianceDocumentCandidate[]> {\n const specificationsPackageRoot = this.companionContext.resolvedSpecifications?.packageRoot;\n if (specificationsPackageRoot === undefined) return [];\n const target = resolvePlaybookOutputLandingTarget({\n family: ApplicationSpecificationFamily.COMPLIANCE_DOCUMENT_CANDIDATE_SET,\n schemaRef: ApplicationSpecificationFamilySemanticSchemaRef.COMPLIANCE_DOCUMENT_CANDIDATE_SET,\n constantPrefix: LANDED_CONSTANT_PREFIX,\n });\n const modulePath = join(specificationsPackageRoot, target.packageRelativePath);\n if (!existsSync(modulePath)) return [];\n const loaded = await importLandedTypeScriptModule(modulePath, import.meta.url);\n const set = loaded[target.exportedConstantName] as ApplicationComplianceDocumentCandidateSet | undefined;\n return set?.candidates ?? [];\n }\n\n /** Every declared interview question across the catalog, joined with the dossier's answers. */\n public async listDossierEntries(): Promise<DossierListing> {\n const creatorInputs = await this.readCreatorInputs();\n const answersByKey = new Map<string, ApplicationCreatorInputAnswer>();\n // Keyed WITH the instance (#1609): an instance's answer never takes the default instance's place.\n for (const answer of creatorInputs?.answers ?? []) answersByKey.set(creatorInputAnswerKey(answer.playbookRef, answer.questionRef, answer.instanceKey), answer);\n\n const entries: DossierEntry[] = [];\n const claimed = new Set<string>();\n const knownPlaybookRefs = new Set<string>();\n /* The whole parsed catalog first: what an answer affects is a question about every OTHER playbook. */\n const catalog = listFrameworkKnowledgePlaybooks()\n .map((summary) => this.readParsedPlaybook(summary.ref))\n .filter((playbook): playbook is MetaWorkflowPlaybook => playbook !== undefined);\n /*\n * Which fallback steps READ each owner's decision — the owner row carries them. A fallback holding\n * an answer of its own reads THAT answer (`readAnswersForPlaybookQuestions`: an own answer wins),\n * so it is not listed here: its interview shows its own row alone, and the owner's row neither\n * appears in that interview nor dates that step's result (#1454 review, LOW).\n */\n const sharedWith = new Map<string, string[]>();\n for (const playbook of catalog) {\n for (const question of playbook.method?.elicitation?.questions ?? []) {\n if (!question.sameDecisionAs) continue;\n if (answersByKey.has(creatorInputAnswerKey(playbook.ref, question.ref))) continue;\n const ownerKey = creatorInputAnswerKey(question.sameDecisionAs.playbookRef, question.sameDecisionAs.questionRef);\n sharedWith.set(ownerKey, [...(sharedWith.get(ownerKey) ?? []), playbook.ref]);\n }\n }\n /*\n * Only the questions of the playbooks this application's LINE runs (#1605): an internal tool is never\n * asked for its pricing tiers or its brand. An answer to a question outside the line is KEPT, neither\n * listed nor reported orphaned: it records a previous line's decision and returns if the line does.\n */\n const lineScope = resolveApplicationLineScope({ catalog: readCompiledApplicationLineCatalog(), creatorInputs });\n for (const playbook of catalog) {\n knownPlaybookRefs.add(playbook.ref);\n const questions = playbook.method?.elicitation?.questions ?? [];\n if (!lineScope.admittedPlaybookRefs.has(playbook.ref)) {\n for (const question of questions) claimed.add(creatorInputAnswerKey(playbook.ref, question.ref));\n continue;\n }\n const affectsFamilies = questions.length > 0 ? deriveAffectedFamilies(playbook.ref, catalog) : [];\n const ownFamily = playbook.outputs?.[0]?.family;\n const admittedFamily = (playbook.method?.choreography?.admits ?? [])\n .map((ref) => catalog.find((candidate) => candidate.ref === ref)?.outputs?.[0]?.family)\n .find((family): family is string => typeof family === 'string');\n const subjectFamily = ownFamily ?? admittedFamily ?? affectsFamilies[0];\n questions.forEach((question, position) => {\n const key = creatorInputAnswerKey(playbook.ref, question.ref);\n claimed.add(key);\n /*\n * A question that asks the SAME DECISION as another step's (#1454, gap 4 and its two reviews)\n * is ONE row, at the step that owns it. The owner's row names this step in\n * `sharedWithPlaybookRefs`, so this step's interview shows and answers THAT row (and\n * `recordAnswer` files an answer to the fallback under the owner), which is what keeps one\n * decision from being asked twice or answered two ways. The fallback's own row is listed only\n * when it carries an answer of its own — a legacy answer that wins for this step, and so must\n * be visible and changeable rather than overriding the owner's from nowhere.\n */\n if (question.sameDecisionAs !== undefined && !answersByKey.has(key)) return;\n entries.push({\n playbookRef: playbook.ref,\n questionRef: question.ref,\n question: question.question,\n kind: String(question.kind),\n options: [...(question.options ?? [])],\n position,\n answer: answersByKey.get(key),\n affectsFamilies,\n subjectFamily,\n sharedWithPlaybookRefs: sharedWith.get(key) ?? [],\n });\n });\n /*\n * Each OPENED INSTANCE of this playbook (#1609) asks its questions again, on its own rows: its answer\n * wins for that instance, and a question it leaves unanswered reads the default instance's row. A\n * shared decision is the default instance's and is not repeated per instance.\n */\n for (const activation of Object.values(creatorInputs?.activations ?? {})) {\n if (activation.playbookRef !== playbook.ref) continue;\n questions.forEach((question, position) => {\n if (question.sameDecisionAs !== undefined) return;\n const key = creatorInputAnswerKey(playbook.ref, question.ref, activation.instanceKey);\n claimed.add(key);\n /*\n * A CLOSED instance (#1608) asks nothing any more, so it has no rows. Its answers are still claimed:\n * they answered a real question of a real instance, and reporting them as orphaned would say otherwise.\n */\n if (activation.closure !== undefined) return;\n entries.push({\n playbookRef: playbook.ref,\n instanceKey: activation.instanceKey,\n instancePurpose: activation.purpose,\n questionRef: question.ref,\n question: question.question,\n kind: String(question.kind),\n options: [...(question.options ?? [])],\n position,\n answer: answersByKey.get(key),\n ...(answersByKey.has(key) ? {} : withStepAnswer(answersByKey.get(creatorInputAnswerKey(playbook.ref, question.ref)))),\n affectsFamilies,\n subjectFamily,\n sharedWithPlaybookRefs: [],\n });\n });\n }\n }\n const orphaned: OrphanedDossierAnswer[] = (creatorInputs?.answers ?? [])\n .filter((answer) => !claimed.has(creatorInputAnswerKey(answer.playbookRef, answer.questionRef, answer.instanceKey)))\n .map((answer) => ({ answer, reason: knownPlaybookRefs.has(answer.playbookRef) ? 'unknown_question' : 'unknown_playbook' }));\n return { entries, orphaned };\n }\n\n /**\n * Record one answer. Refuses — by name, as a `PlaybookElicitationError` the dispatch translates to\n * a 400 — an unknown playbook, a question the playbook does not ask, a CHOICE outside its options\n * or an ambiguous CONFIRM. Everything else lands.\n */\n public async recordAnswer(input: {\n readonly playbookRef: string;\n /** The INSTANCE the answer is for (#1609); it must be opened, and a shared decision is never redirected for it. */\n readonly instanceKey?: string;\n readonly questionRef: string;\n readonly value: string;\n readonly answeredByRef: string;\n readonly dryRun?: boolean;\n }): Promise<RecordAnswerResult> {\n const specificationsPackageRoot = this.companionContext.resolvedSpecifications?.packageRoot;\n if (!specificationsPackageRoot) {\n throw new Error('No specifications package is declared in wildo.saas.config.ts; there is nowhere to land the dossier.');\n }\n const askingPlaybook = this.readParsedPlaybook(input.playbookRef);\n if (!askingPlaybook) {\n throw new PlaybookElicitationError(`No compiled playbook is registered under \"${input.playbookRef}\", so nothing asks \"${input.questionRef}\".`);\n }\n /*\n * An answer to a question that shares its decision with another step is filed under the OWNER\n * (#1454 review): one decision, one answer, whichever step asked it. The owner is resolved from\n * the catalog, never from the caller, and refused like any unknown playbook if it has gone.\n */\n const current = await this.readCreatorInputs();\n /*\n * ...UNLESS the fallback already holds an answer of its own (a legacy answer, listed on its own\n * row). That answer wins for its step, so a change made on that row must change THAT answer —\n * redirected to the owner, the save reported success while the step kept reading the old value\n * (third review, A1).\n */\n const declared = askingPlaybook.method?.elicitation?.questions?.find((question) => question.ref === input.questionRef)?.sameDecisionAs;\n const holdsOwnAnswer = (current?.answers ?? []).some((answer) => answer.playbookRef === input.playbookRef && answer.questionRef === input.questionRef\n && answer.instanceKey === input.instanceKey);\n // A shared decision is the DEFAULT instance's (#1609): an instance's answer stays its own.\n const shared = declared !== undefined && !holdsOwnAnswer && input.instanceKey === undefined ? declared : undefined;\n const playbook = shared ? this.readParsedPlaybook(shared.playbookRef) : askingPlaybook;\n if (!playbook) {\n throw new PlaybookElicitationError(`\"${input.questionRef}\" of \"${input.playbookRef}\" shares its decision with \"${shared?.playbookRef}\", which is no longer a compiled playbook.`);\n }\n const questionRef = shared ? shared.questionRef : input.questionRef;\n const landed = await landCreatorInputAnswer({\n specificationsPackageRoot,\n constantPrefix: LANDED_CONSTANT_PREFIX,\n playbook,\n current,\n questionRef,\n ...(input.instanceKey !== undefined ? { instanceKey: input.instanceKey } : {}),\n value: input.value,\n answeredByRef: input.answeredByRef,\n answeredAt: new Date().toISOString(),\n ...(input.dryRun === true ? { dryRun: true } : {}),\n });\n this.logDebug('Dossier answer recorded', {\n playbookRef: playbook.ref,\n questionRef,\n askedBy: input.playbookRef,\n packageRelativePath: landed.packageRelativePath,\n dryRun: input.dryRun === true,\n });\n return {\n answer: landed.answer,\n packageRelativePath: landed.packageRelativePath,\n /* What the step that ASKED still needs — the owner's answer now counts for it through the shared decision. */\n unansweredQuestionRefs: unansweredElicitationQuestionRefs(askingPlaybook, landed.creatorInputs),\n dryRun: input.dryRun === true,\n };\n }\n\n /**\n * FILE what a step's Run gate collected (#1454 review, LOW): each answer to a question the dossier\n * does NOT answer for that step yet is recorded through {@link recordAnswer} — the same validation,\n * the same shared-decision filing, the same provenance — so the next run does not ask again and the\n * dossier stops saying \"still needed\" about a step that ran.\n *\n * Only the STILL-NEEDED ones. The run route's `elicitationAnswers` is also a per-run OVERRIDE of an\n * answer the dossier holds (Step 5: \"request answers override\"); filing an override would silently\n * rewrite a decision the creator made elsewhere, so an answered question's override stays an\n * override. A blank answer is not an answer and is left to the run, which names what is missing.\n *\n * Sequential on purpose: each `recordAnswer` re-reads the dossier it merges into, so two answers\n * filed in parallel would each land a file missing the other.\n */\n public async fileStillNeededAnswers(input: {\n readonly playbookRef: string;\n /** The instance the run is for (#1609): its pre-answers are filed as THAT instance's answers. */\n readonly instanceKey?: string;\n readonly answers: readonly { readonly questionRef: string; readonly answer: string }[];\n readonly answeredByRef: string;\n }): Promise<readonly string[]> {\n const playbook = this.readParsedPlaybook(input.playbookRef);\n if (!playbook) return [];\n const stillNeeded = new Set(unansweredElicitationQuestionRefs(playbook, await this.readCreatorInputs(), input.instanceKey));\n const filed: string[] = [];\n for (const answer of input.answers) {\n if (!stillNeeded.has(answer.questionRef) || answer.answer.trim().length === 0) continue;\n await this.recordAnswer({\n playbookRef: input.playbookRef,\n questionRef: answer.questionRef,\n value: answer.answer,\n answeredByRef: input.answeredByRef,\n ...(input.instanceKey !== undefined ? { instanceKey: input.instanceKey } : {}),\n });\n filed.push(answer.questionRef);\n }\n return filed;\n }\n\n /** A catalog entry that does not satisfy its own contract is skipped, never fatal — one malformed playbook must not hide the rest. */\n private readParsedPlaybook(playbookRef: string): MetaWorkflowPlaybook | undefined {\n const hydrated = getFrameworkKnowledgePlaybook(playbookRef);\n if (!hydrated) return undefined;\n const parsed = MetaWorkflowPlaybookSchema.safeParse(hydrated.playbook);\n return parsed.success ? parsed.data : undefined;\n }\n}\n\n/** Spread onto an instance's row: the step's own answer, when it has one. */\nfunction withStepAnswer(answer: ApplicationCreatorInputAnswer | undefined): { readonly answerFromTheStep?: ApplicationCreatorInputAnswer } {\n return answer === undefined ? {} : { answerFromTheStep: answer };\n}\n"]}
1
+ {"version":3,"file":"dossier.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/dossier.companion.service.ts"],"names":[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C;YAC9F,CAAC;QACH,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,oHAAoH;IAC7G,sBAAsB;QAC3B,OAAO,+BAA+B,EAAE;aACrC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aAClD,MAAM,CAAC,CAAC,QAAQ,EAAoC,EAAE,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACzH,CAAC;IAED,sIAAsI;IAC9H,kBAAkB,CAAC,WAAmB;QAC5C,MAAM,QAAQ,GAAG,6BAA6B,CAAC,WAAW,CAAC,CAAC;QAC5D,IAAI,CAAC,QAAQ;YAAE,OAAO,SAAS,CAAC;QAChC,MAAM,MAAM,GAAG,0BAA0B,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACvE,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAClD,CAAC;CACF,CAAA;AA9eY,uBAAuB;IADnC,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;;GALxC,uBAAuB,CA8enC;;AAED,6EAA6E;AAC7E,SAAS,cAAc,CAAC,MAAiD;IACvE,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC;AACnE,CAAC","sourcesContent":["import { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { inject, injectable } from 'inversify';\nimport { getFrameworkKnowledgePlaybook, listFrameworkKnowledgePlaybooks } from '@wildo-ai/framework-knowledge';\nimport {\n ApplicationAuthoredDocumentFactSpecificationSchema,\n ApplicationCreatorInputsSchema,\n ApplicationDocumentFactSpecificationSchema,\n ApplicationSpecificationFamily,\n ApplicationSpecificationFamilySemanticSchemaRef,\n MetaWorkflowPlaybookSchema,\n creatorInputAnswerKey,\n type ApplicationCreatorInputAnswerStanding,\n type ApplicationAuthoredDocumentFactSpecification,\n type ApplicationComplianceDocumentCandidateSet,\n type ApplicationCreatorInputAnswer,\n type ApplicationCreatorInputs,\n type ApplicationDocumentFactSpecification,\n type ComplianceDocumentCandidate,\n type MetaWorkflowPlaybook,\n} from '@wildo-ai/saas-specifications/application-creation';\nimport {\n createInitialAssuranceDocumentAuthorityCatalog,\n selectAssuranceDocumentBlueprintForDocumentRef,\n type AssuranceDocumentPublicationVariant,\n} from '@wildo-ai/saas-specifications/assurance';\nimport type { GovernedDocumentPublicDocument, GovernedDocumentRelease } from '@wildo-ai/saas-models';\nimport { WorkbenchDossierEntryOptionsState } from '@wildo-ai/platform-core-shared';\nimport { isElicitationQuestionAskedInSimpleInterview, isElicitationQuestionProposable, isRegulatedDomainElicitationQuestion, type ApplicationInterviewDepth } from '@wildo-ai/saas-models/meta-workflows';\nimport {\n PlaybookElicitationError,\n createCompanionExportsFamilyReader,\n deriveAffectedFamilies,\n materializeElicitationOptions,\n type ElicitationOptionsSourceReads,\n landCreatorInputAnswer,\n landInterviewDepth,\n resolveApplicationLineScope,\n resolvePlaybookOutputLandingTarget,\n unansweredElicitationQuestionRefs,\n} from '@wildo-ai/application-creation-runtime';\nimport type { LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport { importLandedTypeScriptModule } from './landed-module-import.companion';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { loadSpecificationsCompanionExports } from '../../core/context/companion-package-loaders.companion';\nimport type { InterviewQuestionDisposition } from '../../core/introspection/resources/creation-console-projection.companion';\nimport { selectCurrentGovernedDocumentTexts } from './governed-document-texts.companion';\nimport { serializeDossierWrite } from './dossier-write-queue.companion.utils';\nimport { readCompiledApplicationLineCatalog } from '../models/application-line-catalog.models';\n\n/**\n * THE DOSSIER's companion service (#1454, Steps 5–6): what the creator was asked — by a playbook\n * interview or by a governed document — what they said, and the one door for saying more.\n *\n * ## Two sources, one join\n *\n * The QUESTIONS are the compiled playbook catalog's — every `method.elicitation.questions` entry of\n * every playbook that declares one. The ANSWERS are the `creator-inputs` family, read through the\n * application's companion-exports aggregate like every other landed family. Neither alone is what\n * a person reads, so {@link listDossierEntries} is the join: one entry per declared question,\n * carrying the answer when there is one and `STILL_NEEDED` when there is not.\n *\n * ## One writer, and it lands a family\n *\n * An answer enters the dossier by two doors only, and both land it through the same private\n * `landAnswer`: {@link recordAnswer}, where the resource operation and the assistant's `record_answer`\n * tool both arrive, and {@link fileStillNeededAnswers}, for what a run's gate collected. It\n * validates the answer against the question's kind with the SAME function a run applies when it\n * reads the answer back, merges it into the dossier by key, and lands the family file. It does not commit: a landed dossier is a\n * working edit until a human commits it (`.claude/rules/one-source-of-truth.md`, rules 2 and 3).\n *\n * Every write here is a read-modify-write of that one file, so every write goes through\n * {@link serializeDossierWrite}: two overlapping saves would otherwise both build on the same read, and\n * the second would erase the first one's change (#2179).\n *\n * ## An answer to a question no playbook asks any more is REPORTED, not dropped\n *\n * The catalog moves. A committed answer whose question was renamed or retired stays in the file\n * and is listed as ORPHANED here, so the person who gave it can see it went nowhere — deleting it\n * silently would be a regeneration destroying a human decision, the defect the two document-facts\n * families exist to prevent.\n */\n\n/** The constant prefix every landed family uses — neutral by contract (#65), never the application's name. */\nconst LANDED_CONSTANT_PREFIX = 'application';\n\n/** One question of the catalog, with the creator's answer when there is one. */\nexport interface DossierEntry {\n readonly playbookRef: string;\n /** The playbook INSTANCE this row asks for (#1609); absent on the default instance's rows. */\n readonly instanceKey?: string;\n /** What that instance was opened FOR, as its activation records it; absent on the default instance's rows. */\n readonly instancePurpose?: string;\n readonly questionRef: string;\n readonly question: string;\n readonly kind: string;\n readonly options: readonly string[];\n /**\n * Whether the options can be offered now — `NOT_YET_AVAILABLE` for a computed CHOICE whose source has not\n * landed or offers nothing, `ANSWER_NO_LONGER_OFFERED` when the recorded answer is not among the computed\n * options any more (it is then not carried as `answer`, so the question reads as still needed).\n */\n readonly optionsState: WorkbenchDossierEntryOptionsState;\n readonly position: number;\n readonly answer: ApplicationCreatorInputAnswer | undefined;\n /**\n * On an instance's row with no answer of its own: the step's own answer, which the instance runs on\n * until it is given one (#1609). Absent on the default instance's rows, and whenever `answer` is set.\n */\n readonly answerFromTheStep?: ApplicationCreatorInputAnswer;\n /**\n * Every family this answer feeds — what the asking playbook produces and everything downstream of\n * it — so \"changing this affects: …\" is on the row before anyone saves (#1454, Step 8). Derived\n * from the catalog's declared inputs and outputs; empty for a playbook that produces nothing.\n */\n readonly affectsFamilies: readonly string[];\n /**\n * The family whose SUBJECT this question belongs to (#1454, gap 4): what the asking step itself\n * produces; for a composite that produces nothing directly, what the steps it admits produce; and\n * only then the first family its answer reaches. The last is a downstream family — a compliance\n * interview reaches the vision by way of the build — so it is the fallback, never the first choice.\n */\n readonly subjectFamily: string | undefined;\n /**\n * The OTHER steps that READ this decision through a `sameDecisionAs` fallback (#1454 review) — every\n * such step without an answer of its own. The decision is ONE row, at its owner; those steps'\n * interviews show and answer this row, so a creator is asked once. A fallback that holds its own\n * (legacy) answer reads that answer instead, and is listed on its own row, not here.\n */\n readonly sharedWithPlaybookRefs: readonly string[];\n /** Whether a SIMPLE interview asks it of the person (#2129); otherwise it is proposed (reviewed, or assumed unattended). */\n readonly askedInSimpleInterview: boolean;\n /** Whether an answer may be proposed when the person does not know (#2129). */\n readonly proposable: boolean;\n /** It concerns a regulated domain (#2129): a proposal is named to the person before it is kept. */\n readonly regulatedDomain: boolean;\n}\n\n/**\n * One question's interview disposition (#2129) — what a surface needs to run a simple interview. Read\n * through the shared predicates, never re-derived, so the dossier page, the workbench interview and the\n * console queue select the same questions.\n */\nfunction interviewQuestionDisposition(question: NonNullable<NonNullable<MetaWorkflowPlaybook['method']>['elicitation']>['questions'][number]): InterviewQuestionDisposition {\n return {\n askedInSimpleInterview: isElicitationQuestionAskedInSimpleInterview(question),\n proposable: isElicitationQuestionProposable(question),\n regulatedDomain: isRegulatedDomainElicitationQuestion(question),\n };\n}\n\n/** A committed answer whose question the catalog no longer declares. */\nexport interface OrphanedDossierAnswer {\n readonly answer: ApplicationCreatorInputAnswer;\n /** `unknown_playbook` when the playbook itself is gone, `unknown_question` when only the question is. */\n readonly reason: 'unknown_playbook' | 'unknown_question';\n}\n\nexport interface DossierListing {\n readonly entries: readonly DossierEntry[];\n readonly orphaned: readonly OrphanedDossierAnswer[];\n /** How deep this application's interviews go (#2129); undefined until the person chooses. */\n readonly interviewDepth: ApplicationInterviewDepth | undefined;\n}\n\n/**\n * One answer to record. Named, rather than derived from the private `landAnswer`'s parameter, so the public\n * {@link DossierCompanionService.recordAnswer} keeps its type in emitted declarations (#2179 review).\n */\nexport interface RecordAnswerInput {\n readonly playbookRef: string;\n /** The INSTANCE the answer is for (#1609); it must be opened, and a shared decision is never redirected for it. */\n readonly instanceKey?: string;\n readonly questionRef: string;\n readonly value: string;\n readonly answeredByRef: string;\n /** ASSUMED for a proposed answer the person let stand or an unattended round recorded (#2129); refused for a question only they may answer. */\n readonly standing?: ApplicationCreatorInputAnswerStanding;\n /** The proposer's reason, stored with an ASSUMED answer. */\n readonly assumptionRationale?: string;\n readonly dryRun?: boolean;\n}\n\nexport interface RecordAnswerResult {\n readonly answer: ApplicationCreatorInputAnswer;\n readonly packageRelativePath: string;\n /** The asking playbook's questions still unanswered after this one — empty means it can run. */\n readonly unansweredQuestionRefs: readonly string[];\n readonly dryRun: boolean;\n}\n\n@injectable()\nexport class DossierCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n public constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n ) {\n this.logDebug = this.logger.debugByType('DossierCompanionService');\n }\n\n /**\n * The dossier as LANDED — the family read through the companion-exports aggregate, re-parsed\n * because a person may have edited the file by hand. A file that does not parse is reported as\n * absent with a debug line rather than thrown: the dossier being unreadable must not take the\n * eligibility board down with it, and the artifact list reports the family as invalid on its own.\n */\n public async readCreatorInputs(): Promise<ApplicationCreatorInputs | undefined> {\n const exports = await loadSpecificationsCompanionExports(this.companionContext);\n const raw = (exports as { creatorInputs?: unknown }).creatorInputs;\n if (raw === undefined || raw === null) return undefined;\n const parsed = ApplicationCreatorInputsSchema.safeParse(raw);\n if (!parsed.success) {\n this.logDebug('The landed creator-inputs family does not satisfy its schema; reading the dossier as empty', {\n issue: parsed.error.issues[0]?.message,\n });\n return undefined;\n }\n return parsed.data;\n }\n\n /**\n * The AUTHORED governed-document facts as landed (#1454, Step 6) — the governance half of the\n * dossier, read through the same aggregate as the interview half and re-parsed for the same\n * reason. What a governance landing merges INTO, and what decides a question's standing.\n */\n public async readAuthoredDocumentFacts(): Promise<ApplicationAuthoredDocumentFactSpecification | undefined> {\n const exports = await loadSpecificationsCompanionExports(this.companionContext);\n const raw = (exports as { authoredDocumentFactSpecification?: unknown }).authoredDocumentFactSpecification;\n if (raw === undefined || raw === null) return undefined;\n const parsed = ApplicationAuthoredDocumentFactSpecificationSchema.safeParse(raw);\n if (!parsed.success) {\n this.logDebug('The landed document-facts-authored family does not satisfy its schema; reading the governance facts as empty', {\n issue: parsed.error.issues[0]?.message,\n });\n return undefined;\n }\n return parsed.data;\n }\n\n /**\n * The governed-document facts the PRODUCT established, as landed by the document-facts step\n * (#1454, gap 4) — what the dossier shows as \"read from the product\". Re-parsed like its siblings:\n * a landed file that no longer satisfies its schema reads as nothing read yet, never as an answer.\n */\n public async readDerivedDocumentFacts(): Promise<ApplicationDocumentFactSpecification | undefined> {\n const exports = await loadSpecificationsCompanionExports(this.companionContext);\n const raw = (exports as { documentFactSpecification?: unknown }).documentFactSpecification;\n if (raw === undefined || raw === null) return undefined;\n const parsed = ApplicationDocumentFactSpecificationSchema.safeParse(raw);\n if (!parsed.success) {\n this.logDebug('The landed document-facts family does not satisfy its schema; reading the product facts as unread', {\n issue: parsed.error.issues[0]?.message,\n });\n return undefined;\n }\n return parsed.data;\n }\n\n /**\n * The governed documents the creator ASKED FOR — those with a landed draft — as definition refs.\n *\n * Read off the landed candidate-set FILE the way the run service reads it (the family has no\n * companion-exports slot: a draft is not accepted truth), and joined to definitions through the\n * catalog's own `document:` → `document-definition:` rule. An open fact of a drafted document is\n * asked of the person now; one of an undrafted document is merely not told yet.\n */\n public async listDraftedGovernedDocumentDefinitionRefs(): Promise<ReadonlySet<string>> {\n let drafts: readonly ComplianceDocumentCandidate[];\n try {\n drafts = await this.readLandedGovernedDocumentDrafts();\n } catch (error) {\n // An unreadable draft set is the artifact list's finding; here it reads as \"nothing drafted\", never as a throw on every dossier read.\n this.logDebug('The landed draft set could not be read; treating no document as drafted', { error: String(error) });\n return new Set();\n }\n const catalog = createInitialAssuranceDocumentAuthorityCatalog();\n const refs = new Set<string>();\n for (const candidate of drafts) {\n const selection = selectAssuranceDocumentBlueprintForDocumentRef(catalog, candidate.documentRef);\n if (selection) refs.add(selection.definition.identity.definitionRef);\n }\n return refs;\n }\n\n /**\n * Every governed document's CURRENT text, keyed by definition ref (#1645): its release, else its\n * latest draft — see {@link selectCurrentGovernedDocumentTexts}. What the workbench prints when the\n * creator asks for all their documents as one PDF.\n *\n * Unlike {@link listDraftedGovernedDocumentDefinitionRefs}, an unreadable draft set THROWS here. That\n * method answers a question a dossier can survive not knowing; this one produces a file a person hands\n * to a reviewer, and printing every document as \"not composed yet\" because the drafts could not be\n * read would be a false document.\n */\n public async readCurrentGovernedDocumentTexts(at: Date): Promise<ReadonlyMap<string, GovernedDocumentPublicDocument>> {\n const exports = (await loadSpecificationsCompanionExports(this.companionContext)) as {\n documentReleaseSet?: { releases?: readonly GovernedDocumentRelease[] };\n documentPublicationSpecification?: { variants?: readonly AssuranceDocumentPublicationVariant[] };\n } | undefined;\n const catalog = createInitialAssuranceDocumentAuthorityCatalog();\n return selectCurrentGovernedDocumentTexts({\n releases: exports?.documentReleaseSet?.releases ?? [],\n drafts: await this.readLandedGovernedDocumentDrafts(),\n definitionRefOfDraft: (draft) => selectAssuranceDocumentBlueprintForDocumentRef(catalog, draft.documentRef)?.definition.identity.definitionRef,\n publishedVariants: exports?.documentPublicationSpecification?.variants ?? [],\n at: at.toISOString(),\n });\n }\n\n /**\n * The drafts in the landed candidate-set FILE, read the way the run service reads it (the family has\n * no companion-exports slot: a draft is not accepted truth). No file is no drafts; a file that cannot\n * be loaded THROWS — each caller decides what not knowing means for it.\n */\n private async readLandedGovernedDocumentDrafts(): Promise<readonly ComplianceDocumentCandidate[]> {\n const specificationsPackageRoot = this.companionContext.resolvedSpecifications?.packageRoot;\n if (specificationsPackageRoot === undefined) return [];\n const target = resolvePlaybookOutputLandingTarget({\n family: ApplicationSpecificationFamily.COMPLIANCE_DOCUMENT_CANDIDATE_SET,\n schemaRef: ApplicationSpecificationFamilySemanticSchemaRef.COMPLIANCE_DOCUMENT_CANDIDATE_SET,\n constantPrefix: LANDED_CONSTANT_PREFIX,\n });\n const modulePath = join(specificationsPackageRoot, target.packageRelativePath);\n if (!existsSync(modulePath)) return [];\n const loaded = await importLandedTypeScriptModule(modulePath, import.meta.url);\n const set = loaded[target.exportedConstantName] as ApplicationComplianceDocumentCandidateSet | undefined;\n return set?.candidates ?? [];\n }\n\n /** Every declared interview question across the catalog, joined with the dossier's answers. */\n public async listDossierEntries(): Promise<DossierListing> {\n const creatorInputs = await this.readCreatorInputs();\n const answersByKey = new Map<string, ApplicationCreatorInputAnswer>();\n // Keyed WITH the instance (#1609): an instance's answer never takes the default instance's place.\n for (const answer of creatorInputs?.answers ?? []) answersByKey.set(creatorInputAnswerKey(answer.playbookRef, answer.questionRef, answer.instanceKey), answer);\n\n const entries: DossierEntry[] = [];\n const claimed = new Set<string>();\n const knownPlaybookRefs = new Set<string>();\n /* The whole parsed catalog first: what an answer affects is a question about every OTHER playbook. */\n /*\n * COMPUTED options resolved once for the whole listing (the brand-name choice is computed from the landed\n * screening): a row shows exactly the options its answer will be checked against. A question whose source\n * has not landed lists no options — its playbook is not eligible yet, so it is not asked now either.\n */\n const optionReads = await this.readElicitationOptionSources();\n const unavailableOptionsByPlaybook = new Map<string, ReadonlyMap<string, string>>();\n const catalog = listFrameworkKnowledgePlaybooks()\n .map((summary) => this.readParsedPlaybook(summary.ref))\n .filter((playbook): playbook is MetaWorkflowPlaybook => playbook !== undefined)\n .map((playbook) => {\n const materialized = materializeElicitationOptions(playbook, optionReads);\n unavailableOptionsByPlaybook.set(playbook.ref, materialized.unavailableOptions);\n return materialized.playbook;\n });\n /*\n * The state of a question's options, and the answer as it may still be READ: an answer to a computed\n * CHOICE that is no longer among its options would be refused by the run, so it is not carried as the\n * answer — the row reads as still needed and says why.\n */\n const optionsOf = (playbook: MetaWorkflowPlaybook, question: { readonly ref: string; readonly optionsFrom?: unknown; readonly options?: readonly string[] }, answer: ApplicationCreatorInputAnswer | undefined): { readonly optionsState: WorkbenchDossierEntryOptionsState; readonly answer: ApplicationCreatorInputAnswer | undefined } => {\n if (question.optionsFrom === undefined) return { optionsState: WorkbenchDossierEntryOptionsState.AVAILABLE, answer };\n if (unavailableOptionsByPlaybook.get(playbook.ref)?.has(question.ref)) return { optionsState: WorkbenchDossierEntryOptionsState.NOT_YET_AVAILABLE, answer };\n if (answer !== undefined && !(question.options ?? []).includes(answer.value)) return { optionsState: WorkbenchDossierEntryOptionsState.ANSWER_NO_LONGER_OFFERED, answer: undefined };\n return { optionsState: WorkbenchDossierEntryOptionsState.AVAILABLE, answer };\n };\n /*\n * Which fallback steps READ each owner's decision — the owner row carries them. A fallback holding\n * an answer of its own reads THAT answer (`readAnswersForPlaybookQuestions`: an own answer wins),\n * so it is not listed here: its interview shows its own row alone, and the owner's row neither\n * appears in that interview nor dates that step's result (#1454 review, LOW).\n */\n const sharedWith = new Map<string, string[]>();\n for (const playbook of catalog) {\n for (const question of playbook.method?.elicitation?.questions ?? []) {\n if (!question.sameDecisionAs) continue;\n if (answersByKey.has(creatorInputAnswerKey(playbook.ref, question.ref))) continue;\n const ownerKey = creatorInputAnswerKey(question.sameDecisionAs.playbookRef, question.sameDecisionAs.questionRef);\n sharedWith.set(ownerKey, [...(sharedWith.get(ownerKey) ?? []), playbook.ref]);\n }\n }\n /*\n * Only the questions of the playbooks this application's LINE runs (#1605): an internal tool is never\n * asked for its pricing tiers or its brand. An answer to a question outside the line is KEPT, neither\n * listed nor reported orphaned: it records a previous line's decision and returns if the line does.\n */\n const lineScope = resolveApplicationLineScope({ catalog: readCompiledApplicationLineCatalog(), creatorInputs });\n for (const playbook of catalog) {\n knownPlaybookRefs.add(playbook.ref);\n const questions = playbook.method?.elicitation?.questions ?? [];\n if (!lineScope.admittedPlaybookRefs.has(playbook.ref)) {\n for (const question of questions) claimed.add(creatorInputAnswerKey(playbook.ref, question.ref));\n continue;\n }\n const affectsFamilies = questions.length > 0 ? deriveAffectedFamilies(playbook.ref, catalog) : [];\n const ownFamily = playbook.outputs?.[0]?.family;\n const admittedFamily = (playbook.method?.choreography?.admits ?? [])\n .map((ref) => catalog.find((candidate) => candidate.ref === ref)?.outputs?.[0]?.family)\n .find((family): family is string => typeof family === 'string');\n const subjectFamily = ownFamily ?? admittedFamily ?? affectsFamilies[0];\n questions.forEach((question, position) => {\n const key = creatorInputAnswerKey(playbook.ref, question.ref);\n claimed.add(key);\n /*\n * A question that asks the SAME DECISION as another step's (#1454, gap 4 and its two reviews)\n * is ONE row, at the step that owns it. The owner's row names this step in\n * `sharedWithPlaybookRefs`, so this step's interview shows and answers THAT row (and\n * `recordAnswer` files an answer to the fallback under the owner), which is what keeps one\n * decision from being asked twice or answered two ways. The fallback's own row is listed only\n * when it carries an answer of its own — a legacy answer that wins for this step, and so must\n * be visible and changeable rather than overriding the owner's from nowhere.\n */\n if (question.sameDecisionAs !== undefined && !answersByKey.has(key)) return;\n const options = optionsOf(playbook, question, answersByKey.get(key));\n entries.push({\n playbookRef: playbook.ref,\n questionRef: question.ref,\n question: question.question,\n kind: String(question.kind),\n options: [...(question.options ?? [])],\n optionsState: options.optionsState,\n position,\n answer: options.answer,\n ...interviewQuestionDisposition(question),\n affectsFamilies,\n subjectFamily,\n sharedWithPlaybookRefs: sharedWith.get(key) ?? [],\n });\n });\n /*\n * Each OPENED INSTANCE of this playbook (#1609) asks its questions again, on its own rows: its answer\n * wins for that instance, and a question it leaves unanswered reads the default instance's row. A\n * shared decision is the default instance's and is not repeated per instance.\n */\n for (const activation of Object.values(creatorInputs?.activations ?? {})) {\n if (activation.playbookRef !== playbook.ref) continue;\n questions.forEach((question, position) => {\n if (question.sameDecisionAs !== undefined) return;\n const key = creatorInputAnswerKey(playbook.ref, question.ref, activation.instanceKey);\n claimed.add(key);\n /*\n * A CLOSED instance (#1608) asks nothing any more, so it has no rows. Its answers are still claimed:\n * they answered a real question of a real instance, and reporting them as orphaned would say otherwise.\n */\n if (activation.closure !== undefined) return;\n const options = optionsOf(playbook, question, answersByKey.get(key));\n entries.push({\n playbookRef: playbook.ref,\n instanceKey: activation.instanceKey,\n instancePurpose: activation.purpose,\n questionRef: question.ref,\n question: question.question,\n kind: String(question.kind),\n options: [...(question.options ?? [])],\n optionsState: options.optionsState,\n position,\n answer: options.answer,\n ...interviewQuestionDisposition(question),\n ...(answersByKey.has(key) ? {} : withStepAnswer(answersByKey.get(creatorInputAnswerKey(playbook.ref, question.ref)))),\n affectsFamilies,\n subjectFamily,\n sharedWithPlaybookRefs: [],\n });\n });\n }\n }\n const orphaned: OrphanedDossierAnswer[] = (creatorInputs?.answers ?? [])\n .filter((answer) => !claimed.has(creatorInputAnswerKey(answer.playbookRef, answer.questionRef, answer.instanceKey)))\n .map((answer) => ({ answer, reason: knownPlaybookRefs.has(answer.playbookRef) ? 'unknown_question' : 'unknown_playbook' }));\n return { entries, orphaned, interviewDepth: creatorInputs?.interviewDepth };\n }\n\n /**\n * Record one answer. Refuses — by name, as a `PlaybookElicitationError` the dispatch translates to\n * a 400 — an unknown playbook, a question the playbook does not ask, a CHOICE outside its options\n * or an ambiguous CONFIRM. Everything else lands, one dossier write at a time (#2179).\n */\n public async recordAnswer(input: RecordAnswerInput): Promise<RecordAnswerResult> {\n const specificationsPackageRoot = this.companionContext.resolvedSpecifications?.packageRoot;\n // No package: `landAnswer` refuses with its own message, and there is nothing to serialize.\n if (!specificationsPackageRoot) return this.landAnswer(input);\n return serializeDossierWrite(specificationsPackageRoot, () => this.landAnswer(input));\n }\n\n /**\n * {@link recordAnswer} without taking the dossier write queue: the caller must already hold it. The queue\n * is not re-entrant, so a method that files several answers takes it once and lands each through here.\n */\n private async landAnswer(input: RecordAnswerInput): Promise<RecordAnswerResult> {\n const specificationsPackageRoot = this.companionContext.resolvedSpecifications?.packageRoot;\n if (!specificationsPackageRoot) {\n throw new Error('No specifications package is declared in wildo.saas.config.ts; there is nowhere to land the dossier.');\n }\n const askingPlaybook = this.readParsedPlaybook(input.playbookRef);\n if (!askingPlaybook) {\n throw new PlaybookElicitationError(`No compiled playbook is registered under \"${input.playbookRef}\", so nothing asks \"${input.questionRef}\".`);\n }\n /*\n * An answer to a question that shares its decision with another step is filed under the OWNER\n * (#1454 review): one decision, one answer, whichever step asked it. The owner is resolved from\n * the catalog, never from the caller, and refused like any unknown playbook if it has gone.\n */\n const current = await this.readCreatorInputs();\n /*\n * ...UNLESS the fallback already holds an answer of its own (a legacy answer, listed on its own\n * row). That answer wins for its step, so a change made on that row must change THAT answer —\n * redirected to the owner, the save reported success while the step kept reading the old value\n * (third review, A1).\n */\n const declared = askingPlaybook.method?.elicitation?.questions?.find((question) => question.ref === input.questionRef)?.sameDecisionAs;\n const holdsOwnAnswer = (current?.answers ?? []).some((answer) => answer.playbookRef === input.playbookRef && answer.questionRef === input.questionRef\n && answer.instanceKey === input.instanceKey);\n // A shared decision is the DEFAULT instance's (#1609): an instance's answer stays its own.\n const shared = declared !== undefined && !holdsOwnAnswer && input.instanceKey === undefined ? declared : undefined;\n const playbook = shared ? this.readParsedPlaybook(shared.playbookRef) : askingPlaybook;\n if (!playbook) {\n throw new PlaybookElicitationError(`\"${input.questionRef}\" of \"${input.playbookRef}\" shares its decision with \"${shared?.playbookRef}\", which is no longer a compiled playbook.`);\n }\n const questionRef = shared ? shared.questionRef : input.questionRef;\n /*\n * Computed options are resolved HERE, against the families landed now, so a computed CHOICE is checked\n * against the list the person was shown. A source with nothing to offer is refused with its own reason\n * (e.g. \"no brand-name screening has landed yet\") rather than as an answer outside an empty list.\n */\n const computesOptions = playbook.method?.elicitation?.questions?.find((question) => question.ref === questionRef)?.optionsFrom !== undefined;\n const materialized = computesOptions\n ? materializeElicitationOptions(playbook, await this.readElicitationOptionSources())\n : { playbook, unavailableOptions: new Map<string, string>() };\n const unavailable = materialized.unavailableOptions.get(questionRef);\n if (unavailable !== undefined) throw new PlaybookElicitationError(`\"${questionRef}\" of \"${playbook.ref}\" cannot be answered yet: ${unavailable}`);\n const landed = await landCreatorInputAnswer({\n specificationsPackageRoot,\n constantPrefix: LANDED_CONSTANT_PREFIX,\n playbook: materialized.playbook,\n current,\n questionRef,\n ...(input.instanceKey !== undefined ? { instanceKey: input.instanceKey } : {}),\n value: input.value,\n answeredByRef: input.answeredByRef,\n ...(input.standing !== undefined ? { standing: input.standing } : {}),\n ...(input.assumptionRationale !== undefined ? { assumptionRationale: input.assumptionRationale } : {}),\n answeredAt: new Date().toISOString(),\n ...(input.dryRun === true ? { dryRun: true } : {}),\n });\n this.logDebug('Dossier answer recorded', {\n playbookRef: playbook.ref,\n questionRef,\n askedBy: input.playbookRef,\n packageRelativePath: landed.packageRelativePath,\n dryRun: input.dryRun === true,\n });\n return {\n answer: landed.answer,\n packageRelativePath: landed.packageRelativePath,\n /* What the step that ASKED still needs — the owner's answer now counts for it through the shared decision. */\n unansweredQuestionRefs: unansweredElicitationQuestionRefs(askingPlaybook, landed.creatorInputs),\n dryRun: input.dryRun === true,\n };\n }\n\n /**\n * FILE what a step's Run gate collected (#1454 review, LOW): each answer to a question the dossier\n * does NOT answer for that step yet is landed as {@link recordAnswer} lands it (`landAnswer`) — the same validation,\n * the same shared-decision filing, the same provenance — so the next run does not ask again and the\n * dossier stops saying \"still needed\" about a step that ran.\n *\n * Only the STILL-NEEDED ones. The run route's `elicitationAnswers` is also a per-run OVERRIDE of an\n * answer the dossier holds (Step 5: \"request answers override\"); filing an override would silently\n * rewrite a decision the creator made elsewhere, so an answered question's override stays an\n * override. A blank answer is not an answer and is left to the run, which names what is missing.\n *\n * Sequential on purpose: each answer re-reads the dossier it merges into, so two answers filed in\n * parallel would each land a file missing the other.\n *\n * The whole filing holds the dossier write queue ONCE (#2179), the \"still needed\" read included. Taken\n * per answer instead, a person's answer could land between that read and the filing, and the gate's\n * answer would then overwrite a decision the creator had just made: the override this method exists\n * never to file.\n */\n public async fileStillNeededAnswers(input: {\n readonly playbookRef: string;\n /** The instance the run is for (#1609): its pre-answers are filed as THAT instance's answers. */\n readonly instanceKey?: string;\n readonly answers: readonly { readonly questionRef: string; readonly answer: string }[];\n readonly answeredByRef: string;\n }): Promise<readonly string[]> {\n const playbook = this.readParsedPlaybook(input.playbookRef);\n if (!playbook) return [];\n const file = async (): Promise<readonly string[]> => {\n const stillNeeded = new Set(unansweredElicitationQuestionRefs(playbook, await this.readCreatorInputs(), input.instanceKey));\n const filed: string[] = [];\n for (const answer of input.answers) {\n if (!stillNeeded.has(answer.questionRef) || answer.answer.trim().length === 0) continue;\n await this.landAnswer({\n playbookRef: input.playbookRef,\n questionRef: answer.questionRef,\n value: answer.answer,\n answeredByRef: input.answeredByRef,\n ...(input.instanceKey !== undefined ? { instanceKey: input.instanceKey } : {}),\n });\n filed.push(answer.questionRef);\n }\n return filed;\n };\n const specificationsPackageRoot = this.companionContext.resolvedSpecifications?.packageRoot;\n return specificationsPackageRoot ? serializeDossierWrite(specificationsPackageRoot, file) : file();\n }\n\n /** The landed families a computed interview option is resolved from, read through the companion-exports aggregate. */\n private async readElicitationOptionSources(): Promise<ElicitationOptionsSourceReads> {\n try {\n return createCompanionExportsFamilyReader((await loadSpecificationsCompanionExports(this.companionContext)) as unknown as Readonly<Record<string, unknown>>);\n } catch (error) {\n /*\n * An aggregate that cannot be loaded reads as NOTHING LANDED, like every other family this service reads:\n * a computed question then offers no options and cannot be answered (it is refused with its reason), and\n * the rest of the dossier still lists. Throwing here would take the whole dossier down over one question.\n */\n this.logDebug('The specifications aggregate could not be loaded; computed interview options read as unavailable', { error: String(error) });\n return createCompanionExportsFamilyReader(undefined);\n }\n }\n\n /**\n * Record how deep this application's interviews go (#2129). A working edit in the dossier, like an answer,\n * and queued like one (#2179).\n */\n public async recordInterviewDepth(interviewDepth: ApplicationInterviewDepth): Promise<{ readonly interviewDepth: ApplicationInterviewDepth; readonly packageRelativePath: string }> {\n const specificationsPackageRoot = this.companionContext.resolvedSpecifications?.packageRoot;\n if (!specificationsPackageRoot) {\n throw new Error('No specifications package is declared in wildo.saas.config.ts; there is nowhere to land the dossier.');\n }\n const landed = await serializeDossierWrite(specificationsPackageRoot, async () => landInterviewDepth({\n specificationsPackageRoot,\n constantPrefix: LANDED_CONSTANT_PREFIX,\n current: await this.readCreatorInputs(),\n interviewDepth,\n }));\n this.logDebug('Interview depth recorded', { interviewDepth, packageRelativePath: landed.packageRelativePath });\n return { interviewDepth, packageRelativePath: landed.packageRelativePath };\n }\n\n /**\n * One playbook as an answer to it is checked: parsed from the compiled catalog, with its COMPUTED options\n * resolved against what has landed now — the list a person is shown and a proposal must choose from\n * (#2129). `undefined` when the catalog holds no such playbook.\n */\n public async readAnswerablePlaybook(playbookRef: string): Promise<MetaWorkflowPlaybook | undefined> {\n const playbook = this.readParsedPlaybook(playbookRef);\n if (!playbook) return undefined;\n const computesOptions = (playbook.method?.elicitation?.questions ?? []).some((question) => question.optionsFrom !== undefined);\n return computesOptions ? materializeElicitationOptions(playbook, await this.readElicitationOptionSources()).playbook : playbook;\n }\n\n /**\n * Each interview question's depth and whether it may be proposed (#2129), keyed `<playbookRef>#<questionRef>`\n * — what the console queue tells a surface so it can run a simple interview. Computed options are resolved\n * first, so a computed CHOICE with nothing to offer yet reads as not proposable.\n */\n public async readInterviewQuestionDispositions(): Promise<ReadonlyMap<string, InterviewQuestionDisposition>> {\n const dispositions = new Map<string, InterviewQuestionDisposition>();\n for (const listed of this.listInterviewPlaybooks()) {\n const playbook = (await this.readAnswerablePlaybook(listed.ref)) ?? listed;\n for (const question of playbook.method?.elicitation?.questions ?? []) {\n dispositions.set(`${playbook.ref}#${question.ref}`, interviewQuestionDisposition(question));\n }\n }\n return dispositions;\n }\n\n /** Every compiled playbook that declares an interview — the question texts a proposal reads the dossier through. */\n public listInterviewPlaybooks(): readonly MetaWorkflowPlaybook[] {\n return listFrameworkKnowledgePlaybooks()\n .map((entry) => this.readParsedPlaybook(entry.ref))\n .filter((playbook): playbook is MetaWorkflowPlaybook => (playbook?.method?.elicitation?.questions?.length ?? 0) > 0);\n }\n\n /** A catalog entry that does not satisfy its own contract is skipped, never fatal — one malformed playbook must not hide the rest. */\n private readParsedPlaybook(playbookRef: string): MetaWorkflowPlaybook | undefined {\n const hydrated = getFrameworkKnowledgePlaybook(playbookRef);\n if (!hydrated) return undefined;\n const parsed = MetaWorkflowPlaybookSchema.safeParse(hydrated.playbook);\n return parsed.success ? parsed.data : undefined;\n }\n}\n\n/** Spread onto an instance's row: the step's own answer, when it has one. */\nfunction withStepAnswer(answer: ApplicationCreatorInputAnswer | undefined): { readonly answerFromTheStep?: ApplicationCreatorInputAnswer } {\n return answer === undefined ? {} : { answerFromTheStep: answer };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { CompositionScenarioRef } from '@wildo-ai/saas-specifications/application-creation';
2
- import type { AppConfigurationService, LoggerService } from '@wildo-ai/saas-backend-lib';
2
+ import type { LoggerService } from '@wildo-ai/saas-backend-lib';
3
3
  import { type CompanionBrandPropagation } from '../../brand/services/brand-propagation.companion.utils';
4
4
  import { type EngineCapability } from '@wildo-ai/saas-models';
5
5
  import { FoundationPrimaryScope, type FoundationCapabilityBasis, type FoundationBackgroundExecutionOutcome, type FoundationCompositionScenarioOutcome, type FoundationHostFacts } from '@wildo-ai/application-creation-runtime';
@@ -225,9 +225,8 @@ export declare function alreadyComposedWitness(invocation: {
225
225
  export declare class FoundationExecutorCompanionService {
226
226
  private readonly logger;
227
227
  private readonly companionContext;
228
- private readonly appConfigService;
229
228
  private readonly logDebug;
230
- constructor(logger: LoggerService, companionContext: CompanionContext, appConfigService: AppConfigurationService);
229
+ constructor(logger: LoggerService, companionContext: CompanionContext);
231
230
  execute(input: {
232
231
  /** The landed domain-plan VALUE (the run service resolves it from artifact state). */
233
232
  readonly domainPlan: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"foundation-executor.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/foundation-executor.companion.service.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,sBAAsB,EAIvB,MAAM,oDAAoD,CAAC;AAE5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEzF,OAAO,EAA0B,KAAK,yBAAyB,EAAE,MAAM,wDAAwD,CAAC;AAChI,OAAO,EAA0G,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGtK,OAAO,EAOL,sBAAsB,EAQtB,KAAK,yBAAyB,EAC9B,KAAK,oCAAoC,EACzC,KAAK,oCAAoC,EACzC,KAAK,mBAAmB,EAIzB,MAAM,wCAAwC,CAAC;AAGhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAG7E;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,mGAAmG;IACnG,QAAQ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AQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE,EAClH,eAAe,EAAE,MAAM,GACtB,MAAM,GAAG,IAAI,CAIf;AAED,qBACa,kCAAkC;IAIR,OAAO,CAAC,QAAQ,CAAC,MAAM;IACR,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IALhF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+D;gBAGlC,MAAM,EAAE,aAAa,EACN,gBAAgB,EAAE,gBAAgB,EACvC,gBAAgB,EAAE,uBAAuB;IAK5F,OAAO,CAAC,KAAK,EAAE;QAC1B,sFAAsF;QACtF,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;QAC7B;;;WAGG;QACH,QAAQ,CAAC,kBAAkB,EAAE,aAAa,CAAC;YAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACtG,oDAAoD;QACpD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;KAC3B,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAmOtC;;;;;;;OAOG;YACW,gBAAgB;IAqC9B;;;;;;;;;;;;;;;;;;OAkBG;IACH;;;;;;OAMG;IACH,OAAO,CAAC,2BAA2B;YAqBrB,qBAAqB;IAcnC,OAAO,CAAC,eAAe;IA6CvB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,wBAAwB;IAWhC;;;OAGG;IACH,OAAO,CAAC,eAAe;IAKvB;;;;;OAKG;IACH,OAAO,CAAC,yBAAyB;CAUlC"}
1
+ {"version":3,"file":"foundation-executor.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/foundation-executor.companion.service.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,sBAAsB,EAIvB,M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