@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
@@ -43,7 +43,14 @@ import { join } from 'node:path';
43
43
  * answer: an empty walk and an unchanged one are indistinguishable from their result
44
44
  * (`.claude/rules/negative-results-require-a-positive-probe.md`), so a caller must re-derive.
45
45
  */
46
- export function signDerivedInputs(roots, files = []) {
46
+ export function signDerivedInputs(roots, files = [],
47
+ /**
48
+ * Which files under `roots` count, by name. Omitted, every file does. A caller that knows which files its
49
+ * derivation actually READS passes this to skip the rest — the application-module generation signs only what Node
50
+ * imports from a compiled tree, not its `.d.ts` and `.map` siblings, which are two thirds of a backend's `dist`.
51
+ * Directory mtimes count regardless, so a rename or deletion of a skipped file still moves the signature.
52
+ */
53
+ options = {}) {
47
54
  try {
48
55
  let fileCount = 0;
49
56
  let newestMtimeMs = 0;
@@ -71,7 +78,7 @@ export function signDerivedInputs(roots, files = []) {
71
78
  const entryPath = join(directory, entry.name);
72
79
  if (entry.isDirectory())
73
80
  visit(entryPath);
74
- else
81
+ else if (options.includeFile === undefined || options.includeFile(entry.name))
75
82
  accumulate(entryPath);
76
83
  }
77
84
  };
@@ -1 +1 @@
1
- {"version":3,"file":"derived-input-signature.companion.utils.js","sourceRoot":"","sources":["../../../../../src/core/utils/derived-input-signature.companion.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAwB,EAAE,QAA2B,EAAE;IACvF,IAAI,CAAC;QACH,IAAI,SAAS,GAAG,CAAC,CAAC;QAClB,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,UAAU,GAAG,C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;QACpC,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,UAAU,CAAC,IAAI,CAAC;gBAAE,UAAU,CAAC,IAAI,CAAC,CAAC;QACzC,CAAC;QAED,IAAI,SAAS,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACjC,mGAAmG;QACnG,sEAAsE;QACtE,OAAO,GAAG,CAAC,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,cAAc,IAAI,aAAa,IAAI,UAAU,IAAI,UAAU,EAAE,CAAC;IAC1H,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import { existsSync, readdirSync, statSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * A cheap fingerprint of the files an expensive derivation READS, so the derivation is repeated only\n * when one of them changed.\n *\n * **Why this exists as one helper rather than at each site.** The companion has two derivations whose\n * cost dominates the creation board, and both re-derive from bytes that are usually identical to last\n * time — the specifications companion evaluation (1.2-2.9 s warm) and the schema-plan sync check\n * (8-9 s, a `wildo db diff --check` subprocess). Measured on `examples/wonder-todos`, 2026-09-18:\n * signing costs ~2-5 ms and ~17 ms respectively, so the ratio is roughly 500x and 470x. Two copies of\n * that technique would be two places for its subtle parts — the empty-walk refusal, the aggregate\n * choice — to drift apart.\n *\n * **Why a signature and never a TTL.** Both derivations exist to answer \"what is true of the working\n * tree RIGHT NOW\"; the specifications loader in particular carries `freshModuleCache: true` so a family\n * landed while the companion runs is visible without a restart (#170). A TTL can only be correct by\n * expiring, so it trades that guarantee away for up to its own length. A signature cannot: the inputs\n * move, the next call misses, the answer is re-derived.\n *\n * It aggregates rather than hashes content, because reading every byte would cost more than some of\n * the derivations it protects. File COUNT catches a deletion, newest mtime catches a write, and total\n * bytes plus the mtime sum catch a same-instant swap that preserves both. DIRECTORIES are counted\n * separately and their mtimes folded into both mtime aggregates, because a rename or a move keeps every\n * FILE aggregate — `plan.draft.ts` renamed to `index.ts` signed identically before and after (#1310,\n * sixth review F1), and a board asking whether a family file EXISTS is exactly what a rename changes —\n * while it always rewrites the mtime of the directory it happens in.\n *\n * No hash, deliberately: `application-creation-directive.md` forbids digests of any kind, and the\n * introspection source-state observer catches renames the same way, from directory mtimes. A reading\n * taken now and compared with one taken earlier in the same process stores nothing about the\n * application.\n *\n * One consequence, accepted: creating or deleting ANY entry directly inside a signed directory moves\n * its mtime — including entries the walk itself skips (a dot-file, an editor swap file, Vite's\n * `vite.config.ts.timestamp-*`, a new `node_modules`). That costs its caller one re-derivation and\n * never a wrong answer, which is the direction a cache key must err in.\n *\n * `node_modules` and `dist` are skipped BELOW a root and never when they ARE the root, so a caller may\n * legitimately sign a build output by naming it.\n *\n * Returns `null` when nothing could be read. That is a refusal to authorize a cache hit rather than an\n * answer: an empty walk and an unchanged one are indistinguishable from their result\n * (`.claude/rules/negative-results-require-a-positive-probe.md`), so a caller must re-derive.\n */\nexport function signDerivedInputs(roots: readonly string[], files: readonly string[] = []): string | null {\n try {\n let fileCount = 0;\n let newestMtimeMs = 0;\n let totalBytes = 0;\n let mtimeSumMs = 0;\n let directoryCount = 0;\n\n const accumulate = (filePath: string): void => {\n const stats = statSync(filePath);\n fileCount += 1;\n totalBytes += stats.size;\n mtimeSumMs += stats.mtimeMs;\n if (stats.mtimeMs > newestMtimeMs) newestMtimeMs = stats.mtimeMs;\n };\n\n const visit = (directory: string): void => {\n // The directory's own mtime: what a rename, a creation or a deletion inside it rewrites.\n const directoryMtimeMs = statSync(directory).mtimeMs;\n directoryCount += 1;\n mtimeSumMs += directoryMtimeMs;\n if (directoryMtimeMs > newestMtimeMs) newestMtimeMs = directoryMtimeMs;\n for (const entry of readdirSync(directory, { withFileTypes: true })) {\n if (entry.name === 'node_modules' || entry.name === 'dist' || entry.name.startsWith('.')) continue;\n const entryPath = join(directory, entry.name);\n if (entry.isDirectory()) visit(entryPath);\n else accumulate(entryPath);\n }\n };\n\n for (const root of roots) {\n if (existsSync(root)) visit(root);\n }\n for (const file of files) {\n if (existsSync(file)) accumulate(file);\n }\n\n if (fileCount === 0) return null;\n // The roots are part of the identity: a derivation that started reading a DIFFERENT tree must miss\n // even if the new tree happens to have the same shape as the old one.\n return `${[...roots, ...files].join('|')}::${fileCount}:${directoryCount}:${newestMtimeMs}:${totalBytes}:${mtimeSumMs}`;\n } catch {\n return null;\n }\n}\n"]}
1
+ {"version":3,"file":"derived-input-signature.companion.utils.js","sourceRoot":"","sources":["../../../../../src/core/utils/derived-input-signature.companion.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAwB,EACxB,QAA2B,EAAE;AAC7B;;;;;GAKG;AACH,UAAoE,EAAE;IAEtE,IAAI,CAAC;QACH,IAAI,SAAS,GAAG,CAAC,CAAC;QAClB,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,cAAc,GAAG,CAAC,CAAC;QAEvB,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAQ,EAAE;YAC5C,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACjC,SAAS,IAAI,CAAC,CAAC;YACf,UAAU,IAAI,KAAK,CAAC,IAAI,CAAC;YACzB,UAAU,IAAI,KAAK,CAAC,OAAO,CAAC;YAC5B,IAAI,KAAK,CAAC,OAAO,GAAG,aAAa;gBAAE,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC;QACnE,CAAC,CAAC;QAEF,MAAM,KAAK,GAAG,CAAC,SAAi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AC,KAAK,SAAS,IAAI,cAAc,IAAI,aAAa,IAAI,UAAU,IAAI,UAAU,EAAE,CAAC;IAC1H,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import { existsSync, readdirSync, statSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * A cheap fingerprint of the files an expensive derivation READS, so the derivation is repeated only\n * when one of them changed.\n *\n * **Why this exists as one helper rather than at each site.** The companion has two derivations whose\n * cost dominates the creation board, and both re-derive from bytes that are usually identical to last\n * time — the specifications companion evaluation (1.2-2.9 s warm) and the schema-plan sync check\n * (8-9 s, a `wildo db diff --check` subprocess). Measured on `examples/wonder-todos`, 2026-09-18:\n * signing costs ~2-5 ms and ~17 ms respectively, so the ratio is roughly 500x and 470x. Two copies of\n * that technique would be two places for its subtle parts — the empty-walk refusal, the aggregate\n * choice — to drift apart.\n *\n * **Why a signature and never a TTL.** Both derivations exist to answer \"what is true of the working\n * tree RIGHT NOW\"; the specifications loader in particular carries `freshModuleCache: true` so a family\n * landed while the companion runs is visible without a restart (#170). A TTL can only be correct by\n * expiring, so it trades that guarantee away for up to its own length. A signature cannot: the inputs\n * move, the next call misses, the answer is re-derived.\n *\n * It aggregates rather than hashes content, because reading every byte would cost more than some of\n * the derivations it protects. File COUNT catches a deletion, newest mtime catches a write, and total\n * bytes plus the mtime sum catch a same-instant swap that preserves both. DIRECTORIES are counted\n * separately and their mtimes folded into both mtime aggregates, because a rename or a move keeps every\n * FILE aggregate — `plan.draft.ts` renamed to `index.ts` signed identically before and after (#1310,\n * sixth review F1), and a board asking whether a family file EXISTS is exactly what a rename changes —\n * while it always rewrites the mtime of the directory it happens in.\n *\n * No hash, deliberately: `application-creation-directive.md` forbids digests of any kind, and the\n * introspection source-state observer catches renames the same way, from directory mtimes. A reading\n * taken now and compared with one taken earlier in the same process stores nothing about the\n * application.\n *\n * One consequence, accepted: creating or deleting ANY entry directly inside a signed directory moves\n * its mtime — including entries the walk itself skips (a dot-file, an editor swap file, Vite's\n * `vite.config.ts.timestamp-*`, a new `node_modules`). That costs its caller one re-derivation and\n * never a wrong answer, which is the direction a cache key must err in.\n *\n * `node_modules` and `dist` are skipped BELOW a root and never when they ARE the root, so a caller may\n * legitimately sign a build output by naming it.\n *\n * Returns `null` when nothing could be read. That is a refusal to authorize a cache hit rather than an\n * answer: an empty walk and an unchanged one are indistinguishable from their result\n * (`.claude/rules/negative-results-require-a-positive-probe.md`), so a caller must re-derive.\n */\nexport function signDerivedInputs(\n roots: readonly string[],\n files: readonly string[] = [],\n /**\n * Which files under `roots` count, by name. Omitted, every file does. A caller that knows which files its\n * derivation actually READS passes this to skip the rest — the application-module generation signs only what Node\n * imports from a compiled tree, not its `.d.ts` and `.map` siblings, which are two thirds of a backend's `dist`.\n * Directory mtimes count regardless, so a rename or deletion of a skipped file still moves the signature.\n */\n options: { readonly includeFile?: (fileName: string) => boolean } = {},\n): string | null {\n try {\n let fileCount = 0;\n let newestMtimeMs = 0;\n let totalBytes = 0;\n let mtimeSumMs = 0;\n let directoryCount = 0;\n\n const accumulate = (filePath: string): void => {\n const stats = statSync(filePath);\n fileCount += 1;\n totalBytes += stats.size;\n mtimeSumMs += stats.mtimeMs;\n if (stats.mtimeMs > newestMtimeMs) newestMtimeMs = stats.mtimeMs;\n };\n\n const visit = (directory: string): void => {\n // The directory's own mtime: what a rename, a creation or a deletion inside it rewrites.\n const directoryMtimeMs = statSync(directory).mtimeMs;\n directoryCount += 1;\n mtimeSumMs += directoryMtimeMs;\n if (directoryMtimeMs > newestMtimeMs) newestMtimeMs = directoryMtimeMs;\n for (const entry of readdirSync(directory, { withFileTypes: true })) {\n if (entry.name === 'node_modules' || entry.name === 'dist' || entry.name.startsWith('.')) continue;\n const entryPath = join(directory, entry.name);\n if (entry.isDirectory()) visit(entryPath);\n else if (options.includeFile === undefined || options.includeFile(entry.name)) accumulate(entryPath);\n }\n };\n\n for (const root of roots) {\n if (existsSync(root)) visit(root);\n }\n for (const file of files) {\n if (existsSync(file)) accumulate(file);\n }\n\n if (fileCount === 0) return null;\n // The roots are part of the identity: a derivation that started reading a DIFFERENT tree must miss\n // even if the new tree happens to have the same shape as the old one.\n return `${[...roots, ...files].join('|')}::${fileCount}:${directoryCount}:${newestMtimeMs}:${totalBytes}:${mtimeSumMs}`;\n } catch {\n return null;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"creation-conversation.actors-system.definitions.d.ts","sourceRoot":"","sources":["../../../../src/creation-conversation/creation-conversation.actors-system.definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAwB5E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,eAAO,MAAM,gCAAgC,sCAA6C,CAAC;AAC3F,eAAO,MAAM,+BAA+B,EAAG,yCAAkD,CAAC;AAElG,eAAO,MAAM,yBAAyB,EAAE,iBA8DvC,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,WAqB7C,CAAC;AAEF,eAAO,MAAM,8BAA8B;+CACD,WAAW;CACpD,CAAC"}
1
+ {"version":3,"file":"creation-conversation.actors-system.definitions.d.ts","sourceRoot":"","sources":["../../../../src/creation-conversation/creation-conversation.actors-system.definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAwB5E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,eAAO,MAAM,gCAAgC,sCAA6C,CAAC;AAC3F,eAAO,MAAM,+BAA+B,EAAG,yCAAkD,CAAC;AAElG,eAAO,MAAM,yBAAyB,EAAE,iBAgEvC,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,WAqB7C,CAAC;AAEF,eAAO,MAAM,8BAA8B;+CACD,WAAW;CACpD,CAAC"}
@@ -76,6 +76,8 @@ export const creationConversationAgent = {
76
76
  `If a run stopped on a question and the person answers it, call \`${WorkbenchCreationConversationTool.ANSWER_RUN_QUESTION}\` with the run id, the ROUND whose questions they answered (from the waiting runs in the state — the round whose questions match what they answered), and their answers, ref by ref; \`decline\` continues on a stated assumption, \`cancel\` abandons the run. If it answers that the run has asked again, read the state and put the NEW questions to the person.`,
77
77
  `To find something out from the public web, call \`${WorkbenchCreationConversationTool.RESEARCH}\` with one clear objective. It asks for approval first and takes minutes; say so.`,
78
78
  `A step that asks the person questions reads its answers from the DOSSIER. Before asking anything, call \`${WorkbenchCreationConversationTool.READ_DOSSIER}\` for that step: ask only what is still-needed, one question at a time, in the question's own words. When the person answers, file it at once with \`${WorkbenchCreationConversationTool.RECORD_ANSWER}\` — their words, never yours, and never an answer they did not give in this conversation. When nothing is still needed, the step can be started.`,
79
+ `Before the FIRST question of the first interview, if \`${WorkbenchCreationConversationTool.READ_DOSSIER}\` returns no \`interviewDepth\`, ask how detailed they want it: quick (only the essential questions — a quick interview asks the entries with \`askedInSimpleInterview\` — and the rest proposed for them to review) or detailed (every question). Record the choice with \`${WorkbenchCreationConversationTool.SET_INTERVIEW_DEPTH}\`; it holds for the whole application. In a quick interview, once the essential questions are answered, call \`${WorkbenchCreationConversationTool.PROPOSE_INTERVIEW_ANSWERS}\` with no question refs and show every proposal as one list for the person to keep or change, naming each one with \`regulatedDomain\` explicitly.`,
80
+ `When the person does not know an answer ("I don't know", "you decide"), do not press them: call \`${WorkbenchCreationConversationTool.PROPOSE_INTERVIEW_ANSWERS}\` for that question, show the proposal and its rationale, and ask whether to keep it. Kept as it is, file it with \`${WorkbenchCreationConversationTool.RECORD_ANSWER}\` and \`assumed: true\` with the rationale — it is recorded as an assumption, never as their answer. Changed, it is their answer. Name any proposal about regulated data or a regulated sector to them explicitly before it is kept. Never mark your own guess as assumed: only a proposal the tool returned.`,
79
81
  `When the person asks for a CHANGE to the application, turn it into ONE build task and call \`${WorkbenchCreationConversationTool.PROPOSE_BUILD_TASK}\`: the person reviews the task and approves it, changes it, or refuses — that is the confirmation, so do not describe the task in prose first. A task is added to the plan, not run. The person's choice comes back with the approval: if they chose to build it now, the workbench starts its coding run itself, so do not call the dispatch tool for that task and do not ask again; if they chose to keep it for later, stop there.`,
80
82
  `Before running a task, call \`${WorkbenchCreationConversationTool.DESCRIBE_TASK}\` and tell the person in one line what it costs — a coding-agent run of minutes, paid per token, with the context size the tool returns — then call \`${WorkbenchCreationConversationTool.DISPATCH_TASK}\`, which asks for their approval. Only a READY task runs; if it is not, say what it waits on. The run then shows as a card; read its outcome there.`,
81
83
  `When a run has finished and the person wants to keep what it wrote, call \`${WorkbenchCreationConversationTool.ACCEPT_TASK}\` (approved by them): it commits exactly the run's files and names any it refused. Never say a change is in place before that commit exists.`,
@@ -1 +1 @@
1
- {"version":3,"file":"creation-conversation.actors-system.definitions.js","sourceRoot":"","sources":["../../../../src/creation-conversation/creation-conversation.actors-system.definitions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,qCAAqC,EACrC,sCAAsC,EACtC,uCAAuC,EACvC,wBAAwB,EACxB,uBAAuB,GAExB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,0CAA0C,EAAE,iCAAiC,EAAE,MAAM,gCAAgC,CAAC;AAG/H;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,yFAAyF;AACzF,MAAM,CAAC,MAAM,gCAAgC,GAAG,0CAA0C,CAAC;AAC3F,MAAM,CAAC,MAAM,+BAA+B,GAAG,yCAAkD,CAAC;AAElG,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D,GAAG,EAAE,+BAA+B;IACpC,WAAW,EAAE,oBAAoB;IACjC,MAAM,EAAE,wBAAwB,CAAC,MAAM;IACvC,MAAM,EAAE;QACN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System_Kind,\n FlowActorSystem_Status,\n FlowActorSystem_Visibility,\n FlowsActors_Agent_Skill_Type,\n FlowsActors_Agent_Status,\n ResourceOperationRiskLevel,\n ResourcePrimaryScope,\n} from '@wildo-ai/saas-models';\nimport {\n LLMProvider_ChatCompletionInputSchema,\n LLMProvider_ChatCompletionOutputSchema,\n LLMProvider_OperationContext_BaseSchema,\n LLMProvider_OperationKey,\n LLM_Model_Applicability,\n type LLMProvider_OperationDefinitionBase,\n} from '@wildo-ai/external-connectors-models';\n\nimport { WORKBENCH_CREATION_CONVERSATION_SYSTEM_REF, WorkbenchCreationConversationTool } from '@wildo-ai/platform-core-shared';\n\n\n/**\n * The CREATION CONVERSATION — the actor system behind the workbench's chat (#1454, Step 4).\n *\n * ## What it is\n *\n * Paul, 2026-09-21: the workbench is \"primarily a chatbot\"; a free session is primordial. This is\n * the system that chat talks to: ONE agentic actor whose TOOLS are the typed operations the\n * companion already exposes — read where the application stands, read an artifact, run a playbook,\n * answer a run's question, research. It has no free-form write power, deliberately: the raw\n * coding-prompt door was closed at the first-activation hard cut and this does not reopen it.\n * Changing the application goes through a proposed build task the creator dispatches (Step 7).\n *\n * ## Where it runs\n *\n * On the ENGINE's conversational runtime (`ConversationalExecutionBackendService`), which the\n * companion already binds: threads persist as `userFlowActorExecutions` in the platform database,\n * turns stream over the engine's WebSocket, approvals are the engine's signed suspensions. The\n * engine learns nothing about application creation — this file is the application-creation side\n * naming a system, an agent and tools, exactly as an application's own module does.\n *\n * ## Why every tool that spends money asks first\n *\n * `requiresHumanApproval` on `run_playbook` and `research` is the standing constraint \"model-calling\n * runs need Paul's word\", made mechanical: the turn suspends, the creator sees the call (and may edit\n * its arguments), and nothing is spent until they approve.\n */\n/* The ref is SHARED vocabulary: the workbench declares its view on the same constant. */\nexport const CREATION_CONVERSATION_SYSTEM_REF = WORKBENCH_CREATION_CONVERSATION_SYSTEM_REF;\nexport const CREATION_CONVERSATION_AGENT_REF = 'application-creation.conversation.agent' as const;\n\nexport const creationConversationAgent: FlowsActors_Agent = {\n ref: CREATION_CONVERSATION_AGENT_REF,\n displayName: 'Creation assistant',\n status: FlowsActors_Agent_Status.ACTIVE,\n config: {\n providerRef: 'anthropic',\n /*\n * DEEP_JUDGMENT rather than a pinned model: a creation turn weighs what the application already\n * has against what the creator asks, and picks among typed actions. Resolved by the registry at\n * startup to the provider's current model for that applicability.\n */\n modelApplicability: LLM_Model_Applicability.DEEP_JUDGMENT,\n operationKey: LLMProvider_OperationKey.CHAT_COMPLETION,\n accessControl: [{ primaryScope: ResourcePrimaryScope.APPLICATION }],\n riskLevel: ResourceOperationRiskLevel.LOW,\n },\n operationDefinition: {\n operationKey: LLMProvider_OperationKey.CHAT_COMPLETION,\n providerRef: 'anthropic',\n inputSchema: LLMProvider_ChatCompletionInputSchema,\n outputSchema: LLMProvider_ChatCompletionOutputSchema,\n operationContextSchema: LLMProvider_OperationContext_BaseSchema,\n } satisfies LLMProvider_OperationDefinitionBase,\n promptSpec: {\n role:\n 'You are the creation assistant of the Wildo application-creation workbench. The person you talk '\n + 'to is CREATING a software application; you help them get it done. You read where the '\n + 'application stands, explain it in their words, and start the typed steps that move it — never '\n + 'by writing code or files yourself.',\n persona:\n 'You are direct, concrete and grounded in what the tools return. You never invent state: when '\n + 'the answer depends on the application, call the read tools first and answer from what they '\n + 'return. You never mention playbook phases, lanes or family identifiers; you speak of what the '\n + 'application is, the rules it plays by, whether it works, and whether it is ready for a real user. '\n + 'You never run anything the person did not ask for, and you say what a step will cost when it '\n + 'costs something.',\n skillType: FlowsActors_Agent_Skill_Type.CHAT,\n instructions: [\n 'Answer ONLY the current message, concisely. Do not restate what you already said in this conversation.',\n 'Call tools SILENTLY: never narrate your process. Return the answer, or the action you started.',\n `Before saying anything about what exists or is missing, call \\`${WorkbenchCreationConversationTool.READ_APPLICATION_STATE}\\`. It returns which specification families are landed, refused or missing, which playbooks can run now, and which build tasks are ready or landed.`,\n `To show or discuss a produced artifact, call \\`${WorkbenchCreationConversationTool.READ_ARTIFACT}\\` with its family id from the state; the workbench opens it beside the conversation.`,\n `To START a step, call \\`${WorkbenchCreationConversationTool.RUN_PLAYBOOK}\\` with the playbook ref from the state. It asks the person to approve first (that is the confirmation — do not ask in prose) and returns at once with a run id; the run then shows in the conversation as a card. Only ELIGIBLE playbooks may be started; if the one they want is not, say what it waits on.`,\n `When the person wants a step done SEPARATELY for one purpose (one segment, one area), call \\`${WorkbenchCreationConversationTool.OPEN_PLAYBOOK_INSTANCE}\\` with the playbook ref, a short kebab-case key and the purpose in their words; it asks for approval and records the decision. Then start that instance with \\`${WorkbenchCreationConversationTool.RUN_PLAYBOOK}\\` and its \\`instanceKey\\`. Never open an instance the person did not ask for.`,\n `When the person wants a FEATURE added once the application exists, open a line for it: call \\`${WorkbenchCreationConversationTool.OPEN_SECONDARY_LINE}\\` with the line \\`feature_development\\`, a short kebab-case key and the feature in their words; it asks for approval and records the decision. If the feature needs something this kind of application leaves out (a public website on an internal tool), pass the families it needs back as \\`neededFamilies\\`; never add one the person did not ask for. Then start it with \\`${WorkbenchCreationConversationTool.RUN_PLAYBOOK}\\` on the entry playbook it returns and that key. A line lands the feature as requirements first, then re-plans and builds it; a small change to existing code stays a build task. To say what is being worked on, call \\`${WorkbenchCreationConversationTool.READ_LINES}\\`. When the person says a line is done, or no longer wanted, close it with \\`${WorkbenchCreationConversationTool.CLOSE_SECONDARY_LINE}\\` (completed or abandoned); never close one they did not ask about. When the person wants something the application ALREADY holds made better (the requirements, the experience plan, the value proposition), that is a refinement, not a feature: open it with \\`${WorkbenchCreationConversationTool.OPEN_REFINEMENT_LINE}\\`, naming the families to refine, then run it the same way.`,\n `If a run stopped on a question and the person answers it, call \\`${WorkbenchCreationConversationTool.ANSWER_RUN_QUESTION}\\` with the run id, the ROUND whose questions they answered (from the waiting runs in the state — the round whose questions match what they answered), and their answers, ref by ref; \\`decline\\` continues on a stated assumption, \\`cancel\\` abandons the run. If it answers that the run has asked again, read the state and put the NEW questions to the person.`,\n `To find something out from the public web, call \\`${WorkbenchCreationConversationTool.RESEARCH}\\` with one clear objective. It asks for approval first and takes minutes; say so.`,\n `A step that asks the person questions reads its answers from the DOSSIER. Before asking anything, call \\`${WorkbenchCreationConversationTool.READ_DOSSIER}\\` for that step: ask only what is still-needed, one question at a time, in the question's own words. When the person answers, file it at once with \\`${WorkbenchCreationConversationTool.RECORD_ANSWER}\\` — their words, never yours, and never an answer they did not give in this conversation. When nothing is still needed, the step can be started.`,\n `When the person asks for a CHANGE to the application, turn it into ONE build task and call \\`${WorkbenchCreationConversationTool.PROPOSE_BUILD_TASK}\\`: the person reviews the task and approves it, changes it, or refuses — that is the confirmation, so do not describe the task in prose first. A task is added to the plan, not run. The person's choice comes back with the approval: if they chose to build it now, the workbench starts its coding run itself, so do not call the dispatch tool for that task and do not ask again; if they chose to keep it for later, stop there.`,\n `Before running a task, call \\`${WorkbenchCreationConversationTool.DESCRIBE_TASK}\\` and tell the person in one line what it costs — a coding-agent run of minutes, paid per token, with the context size the tool returns — then call \\`${WorkbenchCreationConversationTool.DISPATCH_TASK}\\`, which asks for their approval. Only a READY task runs; if it is not, say what it waits on. The run then shows as a card; read its outcome there.`,\n `When a run has finished and the person wants to keep what it wrote, call \\`${WorkbenchCreationConversationTool.ACCEPT_TASK}\\` (approved by them): it commits exactly the run's files and names any it refused. Never say a change is in place before that commit exists.`,\n 'You never write code or files yourself; a change reaches the application only through a build task and its coding run.',\n 'Never claim a run landed, succeeded or was refused: a run\\'s outcome is in its card and its detail, not in your words.',\n ],\n },\n capabilities: {\n tools: {\n functionRefs: [...Object.values(WorkbenchCreationConversationTool)],\n mcpRefs: [],\n },\n },\n createdAt: '2026-09-22T00:00:00.000Z',\n};\n\nexport const creationConversationActorSystem: ActorSystem = {\n ref: CREATION_CONVERSATION_SYSTEM_REF,\n displayName: 'Creation assistant',\n description: 'Create the application by talking to it.',\n kind: FlowActorSystem_Kind.ACTOR,\n status: FlowActorSystem_Status.ACTIVE,\n /* FRONTEND: the workbench lists it through `/flows-actors/frontend-info` and starts conversations with it. */\n visibility: FlowActorSystem_Visibility.FRONTEND,\n config: {\n timeout: 120_000,\n accessControl: [{ primaryScope: ResourcePrimaryScope.APPLICATION }],\n riskLevel: ResourceOperationRiskLevel.LOW,\n },\n actors: [{\n ref: 'assistant',\n displayName: 'Assistant',\n roleCategory: Actor_Role_Category.OPERATOR,\n executionMode: Actor_ExecutionMode.AGENTIC,\n agentRef: CREATION_CONVERSATION_AGENT_REF,\n }],\n createdAt: '2026-09-22T00:00:00.000Z',\n};\n\nexport const creationConversationFactoryMap = {\n [CREATION_CONVERSATION_SYSTEM_REF]: (): ActorSystem => creationConversationActorSystem,\n};\n"]}
1
+ {"version":3,"file":"creation-conversation.actors-system.definitions.js","sourceRoot":"","sources":["../../../../src/creation-conversation/creation-conversation.actors-system.definitions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,qCAAqC,EACrC,sCAAsC,EACtC,uCAAuC,EACvC,wBAAwB,EACxB,uBAAuB,GAExB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,0CAA0C,EAAE,iCAAiC,EAAE,MAAM,gCAAgC,CAAC;AAG/H;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,yFAAyF;AACzF,MAAM,CAAC,MAAM,gCAAgC,GAAG,0CAA0C,CAAC;AAC3F,MAAM,CAAC,MAAM,+BAA+B,GAAG,yCAAkD,CAAC;AAElG,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D,GAAG,EAAE,+BAA+B;IACpC,WAAW,EAAE,oBAAoB;IACjC,MAAM,EAAE,wBAAwB,CAAC,MAAM;IACvC,MAAM,EAAE;QACN,WAAW,EAAE,WAAW;QACxB;;;;WAIG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CAAC,EAAE,GAAgB,EAAE,CAAC,+BAA+B;CACvF,CAAC","sourcesContent":["import type { ActorSystem, FlowsActors_Agent } from '@wildo-ai/saas-models';\nimport {\n Actor_ExecutionMode,\n Actor_Role_Category,\n FlowActorSystem_Kind,\n FlowActorSystem_Status,\n FlowActorSystem_Visibility,\n FlowsActors_Agent_Skill_Type,\n FlowsActors_Agent_Status,\n ResourceOperationRiskLevel,\n ResourcePrimaryScope,\n} from '@wildo-ai/saas-models';\nimport {\n LLMProvider_ChatCompletionInputSchema,\n LLMProvider_ChatCompletionOutputSchema,\n LLMProvider_OperationContext_BaseSchema,\n LLMProvider_OperationKey,\n LLM_Model_Applicability,\n type LLMProvider_OperationDefinitionBase,\n} from '@wildo-ai/external-connectors-models';\n\nimport { WORKBENCH_CREATION_CONVERSATION_SYSTEM_REF, WorkbenchCreationConversationTool } from '@wildo-ai/platform-core-shared';\n\n\n/**\n * The CREATION CONVERSATION — the actor system behind the workbench's chat (#1454, Step 4).\n *\n * ## What it is\n *\n * Paul, 2026-09-21: the workbench is \"primarily a chatbot\"; a free session is primordial. This is\n * the system that chat talks to: ONE agentic actor whose TOOLS are the typed operations the\n * companion already exposes — read where the application stands, read an artifact, run a playbook,\n * answer a run's question, research. It has no free-form write power, deliberately: the raw\n * coding-prompt door was closed at the first-activation hard cut and this does not reopen it.\n * Changing the application goes through a proposed build task the creator dispatches (Step 7).\n *\n * ## Where it runs\n *\n * On the ENGINE's conversational runtime (`ConversationalExecutionBackendService`), which the\n * companion already binds: threads persist as `userFlowActorExecutions` in the platform database,\n * turns stream over the engine's WebSocket, approvals are the engine's signed suspensions. The\n * engine learns nothing about application creation — this file is the application-creation side\n * naming a system, an agent and tools, exactly as an application's own module does.\n *\n * ## Why every tool that spends money asks first\n *\n * `requiresHumanApproval` on `run_playbook` and `research` is the standing constraint \"model-calling\n * runs need Paul's word\", made mechanical: the turn suspends, the creator sees the call (and may edit\n * its arguments), and nothing is spent until they approve.\n */\n/* The ref is SHARED vocabulary: the workbench declares its view on the same constant. */\nexport const CREATION_CONVERSATION_SYSTEM_REF = WORKBENCH_CREATION_CONVERSATION_SYSTEM_REF;\nexport const CREATION_CONVERSATION_AGENT_REF = 'application-creation.conversation.agent' as const;\n\nexport const creationConversationAgent: FlowsActors_Agent = {\n ref: CREATION_CONVERSATION_AGENT_REF,\n displayName: 'Creation assistant',\n status: FlowsActors_Agent_Status.ACTIVE,\n config: {\n providerRef: 'anthropic',\n /*\n * DEEP_JUDGMENT rather than a pinned model: a creation turn weighs what the application already\n * has against what the creator asks, and picks among typed actions. Resolved by the registry at\n * startup to the provider's current model for that applicability.\n */\n modelApplicability: LLM_Model_Applicability.DEEP_JUDGMENT,\n operationKey: LLMProvider_OperationKey.CHAT_COMPLETION,\n accessControl: [{ primaryScope: ResourcePrimaryScope.APPLICATION }],\n riskLevel: ResourceOperationRiskLevel.LOW,\n },\n operationDefinition: {\n operationKey: LLMProvider_OperationKey.CHAT_COMPLETION,\n providerRef: 'anthropic',\n inputSchema: LLMProvider_ChatCompletionInputSchema,\n outputSchema: LLMProvider_ChatCompletionOutputSchema,\n operationContextSchema: LLMProvider_OperationContext_BaseSchema,\n } satisfies LLMProvider_OperationDefinitionBase,\n promptSpec: {\n role:\n 'You are the creation assistant of the Wildo application-creation workbench. The person you talk '\n + 'to is CREATING a software application; you help them get it done. You read where the '\n + 'application stands, explain it in their words, and start the typed steps that move it — never '\n + 'by writing code or files yourself.',\n persona:\n 'You are direct, concrete and grounded in what the tools return. You never invent state: when '\n + 'the answer depends on the application, call the read tools first and answer from what they '\n + 'return. You never mention playbook phases, lanes or family identifiers; you speak of what the '\n + 'application is, the rules it plays by, whether it works, and whether it is ready for a real user. '\n + 'You never run anything the person did not ask for, and you say what a step will cost when it '\n + 'costs something.',\n skillType: FlowsActors_Agent_Skill_Type.CHAT,\n instructions: [\n 'Answer ONLY the current message, concisely. Do not restate what you already said in this conversation.',\n 'Call tools SILENTLY: never narrate your process. Return the answer, or the action you started.',\n `Before saying anything about what exists or is missing, call \\`${WorkbenchCreationConversationTool.READ_APPLICATION_STATE}\\`. It returns which specification families are landed, refused or missing, which playbooks can run now, and which build tasks are ready or landed.`,\n `To show or discuss a produced artifact, call \\`${WorkbenchCreationConversationTool.READ_ARTIFACT}\\` with its family id from the state; the workbench opens it beside the conversation.`,\n `To START a step, call \\`${WorkbenchCreationConversationTool.RUN_PLAYBOOK}\\` with the playbook ref from the state. It asks the person to approve first (that is the confirmation — do not ask in prose) and returns at once with a run id; the run then shows in the conversation as a card. Only ELIGIBLE playbooks may be started; if the one they want is not, say what it waits on.`,\n `When the person wants a step done SEPARATELY for one purpose (one segment, one area), call \\`${WorkbenchCreationConversationTool.OPEN_PLAYBOOK_INSTANCE}\\` with the playbook ref, a short kebab-case key and the purpose in their words; it asks for approval and records the decision. Then start that instance with \\`${WorkbenchCreationConversationTool.RUN_PLAYBOOK}\\` and its \\`instanceKey\\`. Never open an instance the person did not ask for.`,\n `When the person wants a FEATURE added once the application exists, open a line for it: call \\`${WorkbenchCreationConversationTool.OPEN_SECONDARY_LINE}\\` with the line \\`feature_development\\`, a short kebab-case key and the feature in their words; it asks for approval and records the decision. If the feature needs something this kind of application leaves out (a public website on an internal tool), pass the families it needs back as \\`neededFamilies\\`; never add one the person did not ask for. Then start it with \\`${WorkbenchCreationConversationTool.RUN_PLAYBOOK}\\` on the entry playbook it returns and that key. A line lands the feature as requirements first, then re-plans and builds it; a small change to existing code stays a build task. To say what is being worked on, call \\`${WorkbenchCreationConversationTool.READ_LINES}\\`. When the person says a line is done, or no longer wanted, close it with \\`${WorkbenchCreationConversationTool.CLOSE_SECONDARY_LINE}\\` (completed or abandoned); never close one they did not ask about. When the person wants something the application ALREADY holds made better (the requirements, the experience plan, the value proposition), that is a refinement, not a feature: open it with \\`${WorkbenchCreationConversationTool.OPEN_REFINEMENT_LINE}\\`, naming the families to refine, then run it the same way.`,\n `If a run stopped on a question and the person answers it, call \\`${WorkbenchCreationConversationTool.ANSWER_RUN_QUESTION}\\` with the run id, the ROUND whose questions they answered (from the waiting runs in the state — the round whose questions match what they answered), and their answers, ref by ref; \\`decline\\` continues on a stated assumption, \\`cancel\\` abandons the run. If it answers that the run has asked again, read the state and put the NEW questions to the person.`,\n `To find something out from the public web, call \\`${WorkbenchCreationConversationTool.RESEARCH}\\` with one clear objective. It asks for approval first and takes minutes; say so.`,\n `A step that asks the person questions reads its answers from the DOSSIER. Before asking anything, call \\`${WorkbenchCreationConversationTool.READ_DOSSIER}\\` for that step: ask only what is still-needed, one question at a time, in the question's own words. When the person answers, file it at once with \\`${WorkbenchCreationConversationTool.RECORD_ANSWER}\\` — their words, never yours, and never an answer they did not give in this conversation. When nothing is still needed, the step can be started.`,\n `Before the FIRST question of the first interview, if \\`${WorkbenchCreationConversationTool.READ_DOSSIER}\\` returns no \\`interviewDepth\\`, ask how detailed they want it: quick (only the essential questions — a quick interview asks the entries with \\`askedInSimpleInterview\\` — and the rest proposed for them to review) or detailed (every question). Record the choice with \\`${WorkbenchCreationConversationTool.SET_INTERVIEW_DEPTH}\\`; it holds for the whole application. In a quick interview, once the essential questions are answered, call \\`${WorkbenchCreationConversationTool.PROPOSE_INTERVIEW_ANSWERS}\\` with no question refs and show every proposal as one list for the person to keep or change, naming each one with \\`regulatedDomain\\` explicitly.`,\n `When the person does not know an answer (\"I don't know\", \"you decide\"), do not press them: call \\`${WorkbenchCreationConversationTool.PROPOSE_INTERVIEW_ANSWERS}\\` for that question, show the proposal and its rationale, and ask whether to keep it. Kept as it is, file it with \\`${WorkbenchCreationConversationTool.RECORD_ANSWER}\\` and \\`assumed: true\\` with the rationale — it is recorded as an assumption, never as their answer. Changed, it is their answer. Name any proposal about regulated data or a regulated sector to them explicitly before it is kept. Never mark your own guess as assumed: only a proposal the tool returned.`,\n `When the person asks for a CHANGE to the application, turn it into ONE build task and call \\`${WorkbenchCreationConversationTool.PROPOSE_BUILD_TASK}\\`: the person reviews the task and approves it, changes it, or refuses — that is the confirmation, so do not describe the task in prose first. A task is added to the plan, not run. The person's choice comes back with the approval: if they chose to build it now, the workbench starts its coding run itself, so do not call the dispatch tool for that task and do not ask again; if they chose to keep it for later, stop there.`,\n `Before running a task, call \\`${WorkbenchCreationConversationTool.DESCRIBE_TASK}\\` and tell the person in one line what it costs — a coding-agent run of minutes, paid per token, with the context size the tool returns — then call \\`${WorkbenchCreationConversationTool.DISPATCH_TASK}\\`, which asks for their approval. Only a READY task runs; if it is not, say what it waits on. The run then shows as a card; read its outcome there.`,\n `When a run has finished and the person wants to keep what it wrote, call \\`${WorkbenchCreationConversationTool.ACCEPT_TASK}\\` (approved by them): it commits exactly the run's files and names any it refused. Never say a change is in place before that commit exists.`,\n 'You never write code or files yourself; a change reaches the application only through a build task and its coding run.',\n 'Never claim a run landed, succeeded or was refused: a run\\'s outcome is in its card and its detail, not in your words.',\n ],\n },\n capabilities: {\n tools: {\n functionRefs: [...Object.values(WorkbenchCreationConversationTool)],\n mcpRefs: [],\n },\n },\n createdAt: '2026-09-22T00:00:00.000Z',\n};\n\nexport const creationConversationActorSystem: ActorSystem = {\n ref: CREATION_CONVERSATION_SYSTEM_REF,\n displayName: 'Creation assistant',\n description: 'Create the application by talking to it.',\n kind: FlowActorSystem_Kind.ACTOR,\n status: FlowActorSystem_Status.ACTIVE,\n /* FRONTEND: the workbench lists it through `/flows-actors/frontend-info` and starts conversations with it. */\n visibility: FlowActorSystem_Visibility.FRONTEND,\n config: {\n timeout: 120_000,\n accessControl: [{ primaryScope: ResourcePrimaryScope.APPLICATION }],\n riskLevel: ResourceOperationRiskLevel.LOW,\n },\n actors: [{\n ref: 'assistant',\n displayName: 'Assistant',\n roleCategory: Actor_Role_Category.OPERATOR,\n executionMode: Actor_ExecutionMode.AGENTIC,\n agentRef: CREATION_CONVERSATION_AGENT_REF,\n }],\n createdAt: '2026-09-22T00:00:00.000Z',\n};\n\nexport const creationConversationFactoryMap = {\n [CREATION_CONVERSATION_SYSTEM_REF]: (): ActorSystem => creationConversationActorSystem,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"creation-conversation.function-tools.d.ts","sourceRoot":"","sources":["../../../../src/creation-conversation/creation-conversation.function-tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAgC,MAAM,4BAA4B,CAAC;AAqC7F;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC,CAAC;CAC5C;AA6BD,wBAAgB,sCAAsC,CAAC,QAAQ,EAAE,gCAAgC,GAAG,YAAY,EAAE,CAqdjH"}
1
+ {"version":3,"file":"creation-conversation.function-tools.d.ts","sourceRoot":"","sources":["../../../../src/creation-conversation/creation-conversation.function-tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAgC,MAAM,4BAA4B,CAAC;AAwC7F;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC,CAAC;CAC5C;AA6BD,wBAAgB,sCAAsC,CAAC,QAAQ,EAAE,gCAAgC,GAAG,YAAY,EAAE,CAqhBjH"}
@@ -1,14 +1,16 @@
1
1
  import { z } from 'zod';
2
- import { dispatchResourceOperationAsTool } from '@wildo-ai/saas-backend-lib';
2
+ import { dispatchResourceOperationAsTool, SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';
3
3
  import { CoreResourceOperation } from '@wildo-ai/saas-models';
4
4
  import { WorkbenchBuildPlanTasks_Operations, WorkbenchCreationConversationTool, WorkbenchDossierEntries_Operations, WorkbenchShared_ResourceType, sanitizeWorkbenchCreationPlaneIdentity, workbenchDossierEntryIdentity } from '@wildo-ai/platform-core-shared';
5
5
  import { getFrameworkKnowledgePlaybook } from '@wildo-ai/framework-knowledge';
6
6
  import { APPLICATION_SECONDARY_LINE_DEFINITIONS, ApplicationLineDeclarationState, ApplicationPlaybookInstanceClosureKind, ApplicationSecondaryLine, ApplicationSpecificationFamily, resolveApplicationLineDeclaration, resolveOpenSecondaryLines, } from '@wildo-ai/saas-specifications/application-creation';
7
7
  import { COMPANION_SERVICE_TYPES } from '../core/inject/models/service-types.js';
8
+ import { describeCreationLanePreflightRefusal, evaluateCreationLanePreflight } from '../meta-workflows/services/creation-lane-preflight.companion.service.js';
9
+ import { proposeInterviewAnswers } from '../meta-workflows/services/interview-answer-proposal.companion.js';
8
10
  import { PlaybookInstanceRefusedError, PlaybookInstanceTreeBusyError } from '../meta-workflows/services/playbook-instance.companion.service.js';
9
11
  import { DecisionRecordActor } from '../claude-cli/services/accepted-change-commit.companion.service.js';
10
12
  import { ApplicationBuildTaskNotReadyError } from '../meta-workflows/services/application-build-dispatch.companion.service.js';
11
- import { MetaWorkflow_ClarificationAction } from '@wildo-ai/saas-models/meta-workflows';
13
+ import { ApplicationInterviewDepth, MetaWorkflow_ClarificationAction } from '@wildo-ai/saas-models/meta-workflows';
12
14
  /**
13
15
  * The rows the WORKBENCH reads, read the same way — the resource's own LIST, dispatched AS THE
14
16
  * CALLER through the engine's tool seam (roles and any declared rate limit applied, like every
@@ -99,6 +101,14 @@ export function buildCreationConversationFunctionTools(services) {
99
101
  return { started: false, reason: 'unknown_playbook', playbookRef: args.playbookRef };
100
102
  if (!eligibility.eligible)
101
103
  return { started: false, reason: 'not_eligible', playbookRef: args.playbookRef, unmet: eligibility.unmet };
104
+ /*
105
+ * The creation preflight (#2229), asked of this companion's registry: a run whose provider calls would be refused
106
+ * is not started, and the refusal's sentence goes back to the assistant so it can tell the person what to fix.
107
+ */
108
+ const preflight = evaluateCreationLanePreflight(services.get(SAAS_SERVICE_TYPES.ExternalProvidersRegistryService));
109
+ if (preflight.length > 0) {
110
+ return { started: false, reason: 'preflight_refused', playbookRef: args.playbookRef, message: describeCreationLanePreflightRefusal(preflight) };
111
+ }
102
112
  /*
103
113
  * The run's own TRACE, opened here as the HTTP path opens one per request (#1454, gap 3). A run
104
114
  * started from a conversation carried none, so its card could not say what it had done or was
@@ -325,7 +335,8 @@ export function buildCreationConversationFunctionTools(services) {
325
335
  description: 'The dossier: every question a creation step asks the person, with their answer when they gave one '
326
336
  + '(standing from-you) or still-needed when they did not. Each entry names its playbookRef and questionRef. '
327
337
  + 'An opened instance of a step asks its questions again under its instanceKey (with what it was opened for); '
328
- + 'standing from-the-step means it runs on the step\'s own answer until the person gives it one. '
338
+ + 'standing from-the-step means it runs on the step\'s own answer until the person gives it one; '
339
+ + 'standing assumed means the person did not know and kept a proposed answer, which is worth revisiting. '
329
340
  + 'Call this before asking the person anything a step needs — if the dossier already holds it, do not ask again.',
330
341
  inputSchema: z.object({
331
342
  playbookRef: z.string().min(1).optional().describe('Only this playbook\'s questions, when the conversation is about one step.'),
@@ -341,7 +352,11 @@ export function buildCreationConversationFunctionTools(services) {
341
352
  ? rows.filter((row) => row.playbookRef === args.playbookRef || (Array.isArray(row.sharedWithPlaybookRefs) && row.sharedWithPlaybookRefs.includes(args.playbookRef)))
342
353
  : rows;
343
354
  /* `affectsFamilies` is what an answer reaches (#1454, Step 8) — the assistant says it before asking, as the interview does. */
344
- return { entries: selected.map((row) => pick(row, ['playbookRef', 'instanceKey', 'instancePurpose', 'questionRef', 'question', 'kind', 'options', 'standing', 'value', 'playbookEligible', 'affectsFamilies', 'sharedWithPlaybookRefs'])) };
355
+ /* #2129: how detailed the interviews are, what a quick one asks, what may be proposed, what is regulated. */
356
+ return {
357
+ interviewDepth: rows[0]?.interviewDepth ?? null,
358
+ entries: selected.map((row) => pick(row, ['playbookRef', 'instanceKey', 'instancePurpose', 'questionRef', 'question', 'kind', 'options', 'standing', 'value', 'playbookEligible', 'affectsFamilies', 'sharedWithPlaybookRefs', 'askedInSimpleInterview', 'proposable', 'regulatedDomain', 'assumptionRationale'])),
359
+ };
345
360
  },
346
361
  };
347
362
  const recordAnswer = {
@@ -354,6 +369,8 @@ export function buildCreationConversationFunctionTools(services) {
354
369
  questionRef: z.string().min(1),
355
370
  instanceKey: z.string().min(1).optional().describe('The instance the question is asked for, when the dossier entry names one; omit for the step itself.'),
356
371
  value: z.string().min(1).describe('The answer as the person gave it. For a yes/no question: yes or no.'),
372
+ assumed: z.boolean().optional().describe(`TRUE only when the value is a proposal from ${'`'}${WorkbenchCreationConversationTool.PROPOSE_INTERVIEW_ANSWERS}${'`'} that the person kept because they did not know. It is recorded as an assumption, never as their answer.`),
373
+ assumptionRationale: z.string().trim().min(1).optional().describe('Required with assumed: the rationale the proposal came with. An assumption without one is refused.'),
357
374
  }),
358
375
  /*
359
376
  * No approval: recording what the person just said costs nothing and is reversible (the file is
@@ -380,11 +397,54 @@ export function buildCreationConversationFunctionTools(services) {
380
397
  resourceType: WorkbenchShared_ResourceType.DOSSIER_ENTRIES,
381
398
  operationIdentifier: WorkbenchDossierEntries_Operations.ANSWER,
382
399
  recordId: rowId,
383
- data: { value: args.value },
400
+ data: {
401
+ value: args.value,
402
+ ...(args.assumed === true ? { assumed: true } : {}),
403
+ ...(args.assumed === true && args.assumptionRationale !== undefined ? { assumptionRationale: args.assumptionRationale } : {}),
404
+ },
384
405
  });
385
406
  return result;
386
407
  },
387
408
  };
409
+ const setInterviewDepth = {
410
+ functionRef: WorkbenchCreationConversationTool.SET_INTERVIEW_DEPTH,
411
+ description: 'Record how detailed this application\'s interviews are, as the person chose: simple (ask only the essential questions and '
412
+ + 'propose the rest for them to review) or detailed (ask every question). Recorded once for the whole application.',
413
+ inputSchema: z.object({ interviewDepth: z.enum(ApplicationInterviewDepth) }),
414
+ execute: async (args) => {
415
+ const dossier = services.get(COMPANION_SERVICE_TYPES.DossierService);
416
+ const recorded = await dossier.recordInterviewDepth(args.interviewDepth);
417
+ /* Every dossier row carries the depth and a quick interview asks fewer of them: the boards move, as on the other two doors. */
418
+ services.get(COMPANION_SERVICE_TYPES.CreationPlaneProjectionService).invalidateDerivedBoards();
419
+ return recorded;
420
+ },
421
+ };
422
+ /*
423
+ * "I don't know" (#2129): propose answers instead of pressing the person. One call to the same proposer the
424
+ * console uses, so a proposal reads the same in both; it writes nothing, and what the person keeps is filed
425
+ * through RECORD_ANSWER as an assumption.
426
+ */
427
+ const proposeInterviewAnswersTool = {
428
+ functionRef: WorkbenchCreationConversationTool.PROPOSE_INTERVIEW_ANSWERS,
429
+ description: 'Propose answers to a step\'s interview questions the person does not know, built from what they already said. '
430
+ + 'Writes nothing: show each proposal with its rationale and ask whether to keep it. Name the question refs, or omit them '
431
+ + 'to propose everything the application\'s interview depth does not ask (the review step of a short interview). '
432
+ + 'A question only the person may answer is refused.',
433
+ inputSchema: z.object({
434
+ playbookRef: z.string().min(1),
435
+ instanceKey: z.string().min(1).optional().describe('The instance the questions are asked for, when the dossier entry names one.'),
436
+ questionRefs: z.array(z.string().min(1)).optional(),
437
+ }),
438
+ execute: async (args) => {
439
+ const dossier = services.get(COMPANION_SERVICE_TYPES.DossierService);
440
+ const runs = services.get(COMPANION_SERVICE_TYPES.PlaybookRunService);
441
+ return proposeInterviewAnswers(runs.interviewAnswerProposalPorts(), {
442
+ playbookRef: args.playbookRef,
443
+ ...(args.instanceKey !== undefined ? { instanceKey: args.instanceKey } : {}),
444
+ ...(args.questionRefs !== undefined ? { questionRefs: args.questionRefs } : {}),
445
+ });
446
+ },
447
+ };
388
448
  /*
389
449
  * CHANGING THE APPLICATION from a session (#1454, Step 7) — four tools, one decision each:
390
450
  * propose a task (the person approves, and may change its arguments), see what running it means,
@@ -476,6 +536,6 @@ export function buildCreationConversationFunctionTools(services) {
476
536
  data: {},
477
537
  }),
478
538
  };
479
- return [readApplicationState, readArtifact, runPlaybook, openPlaybookInstance, openSecondaryLine, openRefinementLine, readLines, closeSecondaryLine, answerRunQuestion, research, readDossier, recordAnswer, proposeBuildTask, describeTask, dispatchTask, acceptTask];
539
+ return [readApplicationState, readArtifact, runPlaybook, openPlaybookInstance, openSecondaryLine, openRefinementLine, readLines, closeSecondaryLine, answerRunQuestion, research, readDossier, recordAnswer, setInterviewDepth, proposeInterviewAnswersTool, proposeBuildTask, describeTask, dispatchTask, acceptTask];
480
540
  }
481
541
  //# sourceMappingURL=creation-conversation.function-tools.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"creation-conversation.function-tools.js","sourceRoot":"","sources":["../../../../src/creation-conversation/creation-conversation.function-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,kCAAkC,EAAE,iCAAiC,EAAE,kCAAkC,EAAE,4BAA4B,EAAE,sCAAsC,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAChQ,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EACL,sCAAsC,EACtC,+BAA+B,EAC/B,sCAAsC,EACtC,wBAAwB,EACxB,8BAA8B,EAC9B,iCAAiC,EACjC,yBAAyB,GAC1B,MAAM,oDAAoD,CAAC;AAG5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EAAE,4BAA4B,EAAE,6BAA6B,EAAyC,MAAM,gEAAgE,CAAC;AACpL,OAAO,EAAE,mBAAmB,EAAE,MAAM,iEAAiE,CAAC;AACtG,OAAO,EAAE,iCAAiC,EAAiD,MAAM,yEAAyE,CAAC;AAG3K,OAAO,EAAE,gCAAgC,EAAE,MAAM,sCAAsC,CAAC;AAuBxF;;;;;;GAMG;AACH,KAAK,UAAU,qBAAqB,CAClC,OAAqC,EACrC,YAA0C;IAE1C,MAAM,MAAM,GAAG,MAAM,+BAA+B,CAAU;QAC5D,GAAG,EAAE,OAAO;QACZ,YAAY;QACZ,mBAAmB,EAAE,qBAAqB,CAAC,IAAI;KAChD,CAAC,CAAC;IACH,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC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Z,YAAY,EAAE,4BAA4B,CAAC,gBAAgB;YAC3D,mBAAmB,EAAE,kCAAkC,CAAC,MAAM;YAC9D,QAAQ,EAAE,sCAAsC,CAAC,IAAI,CAAC,OAAO,CAAC;YAC9D,IAAI,EAAE,EAAE;SACT,CAAC;KACH,CAAC;IAEF,OAAO,CAAC,oBAAoB,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,SAAS,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;AACzQ,CAAC","sourcesContent":["import { z } from 'zod';\nimport type { FunctionTool, FunctionToolExecutionContext } from '@wildo-ai/saas-backend-lib';\nimport { dispatchResourceOperationAsTool } from '@wildo-ai/saas-backend-lib';\nimport { CoreResourceOperation } from '@wildo-ai/saas-models';\nimport { WorkbenchBuildPlanTasks_Operations, WorkbenchCreationConversationTool, WorkbenchDossierEntries_Operations, WorkbenchShared_ResourceType, sanitizeWorkbenchCreationPlaneIdentity, workbenchDossierEntryIdentity } from '@wildo-ai/platform-core-shared';\nimport { getFrameworkKnowledgePlaybook } from '@wildo-ai/framework-knowledge';\nimport {\n APPLICATION_SECONDARY_LINE_DEFINITIONS,\n ApplicationLineDeclarationState,\n ApplicationPlaybookInstanceClosureKind,\n ApplicationSecondaryLine,\n ApplicationSpecificationFamily,\n resolveApplicationLineDeclaration,\n resolveOpenSecondaryLines,\n} from '@wildo-ai/saas-specifications/application-creation';\nimport type { DossierCompanionService } from '../meta-workflows/services/dossier.companion.service';\n\nimport { COMPANION_SERVICE_TYPES } from '../core/inject/models/service-types';\nimport type { PlaybookRunCompanionService } from '../meta-workflows/services/playbook-run.companion.service';\nimport { PlaybookInstanceRefusedError, PlaybookInstanceTreeBusyError, type PlaybookInstanceCompanionService } from '../meta-workflows/services/playbook-instance.companion.service';\nimport { DecisionRecordActor } from '../claude-cli/services/accepted-change-commit.companion.service';\nimport { ApplicationBuildTaskNotReadyError, type ApplicationBuildDispatchCompanionService } from '../meta-workflows/services/application-build-dispatch.companion.service';\nimport type { ResearchAgentDispatchCompanionService } from '../claude-cli/services/research-agent-dispatch.companion.service';\nimport type { CompanionTraceabilityService } from '../core/traceability/companion-traceability.service';\nimport { MetaWorkflow_ClarificationAction } from '@wildo-ai/saas-models/meta-workflows';\n\n/*\n * The tools of the creation assistant (#1454, Step 4) — every one a TYPED operation the companion\n * already exposes, reached IN-PROCESS. The assistant never crosses HTTP, so the two-gate problem\n * of the workbench client (a browser session for `/api/v1`, a 0600 file token for `/api/companion`)\n * does not arise: the tool holds the service.\n *\n * The refs are {@link WorkbenchCreationConversationTool} — shared, because the workbench words a\n * status line and an approval card per tool and cannot see this source. The agent's\n * `capabilities.tools.functionRefs` lists exactly that enum's values, so the declared refs and the\n * registered tools cannot drift.\n */\n\n/**\n * A lazy service getter rather than the services themselves: the tools are declared at startup\n * ASSEMBLY, before the container has resolved every companion service, and a tool only needs its\n * service when a turn calls it.\n */\nexport interface CreationConversationToolServices {\n readonly get: <T>(identifier: symbol) => T;\n}\n\n/**\n * The rows the WORKBENCH reads, read the same way — the resource's own LIST, dispatched AS THE\n * CALLER through the engine's tool seam (roles and any declared rate limit applied, like every\n * other tool) — so what the assistant says and what the page shows are one derivation. Trimmed by\n * the callers to what a turn needs: the model pays per token and a family's rendered document is\n * not a fact about its state.\n */\nasync function readCreationPlaneRows(\n context: FunctionToolExecutionContext,\n resourceType: WorkbenchShared_ResourceType,\n): Promise<readonly Record<string, unknown>[]> {\n const result = await dispatchResourceOperationAsTool<unknown>({\n ctx: context,\n resourceType,\n operationIdentifier: CoreResourceOperation.LIST,\n });\n if (Array.isArray(result)) return result as readonly Record<string, unknown>[];\n const data = (result as { data?: unknown })?.data;\n return Array.isArray(data) ? (data as readonly Record<string, unknown>[]) : [];\n}\n\nfunction pick<T extends Record<string, unknown>>(row: T, keys: readonly string[]): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const key of keys) if (key in row) out[key] = row[key];\n return out;\n}\n\nexport function buildCreationConversationFunctionTools(services: CreationConversationToolServices): FunctionTool[] {\n const readApplicationState: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.READ_APPLICATION_STATE,\n description:\n 'Where the application stands: every specification family with its state (landed_valid, landed_invalid, not_landed) '\n + 'and its concern; every playbook with whether it is eligible to run now, what it waits on, whether it interviews the '\n + 'creator first, and which of its outputs are stale; every build-plan task with its status (ready, landed, blocked); '\n + 'and every run WAITING on the person, with its run id, the round of questions it is on, and those questions. '\n + 'Call this before any statement about what exists or is missing.',\n inputSchema: z.object({}),\n execute: async (_args, context) => {\n const [artifacts, playbooks, tasks, waiting] = await Promise.all([\n readCreationPlaneRows(context, WorkbenchShared_ResourceType.SPECIFICATION_ARTIFACTS),\n readCreationPlaneRows(context, WorkbenchShared_ResourceType.PLAYBOOKS),\n readCreationPlaneRows(context, WorkbenchShared_ResourceType.BUILD_PLAN_TASKS),\n /*\n * Read on its OWN terms: the waiting runs failing to read must not take the rest of the state with\n * them, and must not read as \"nothing is waiting\" either (#1584 review F3).\n */\n readCreationPlaneRows(context, WorkbenchShared_ResourceType.WAITING_PLAYBOOK_RUNS).then(\n (rows) => ({ rows, readFailed: false as const }),\n () => ({ rows: [] as readonly Record<string, unknown>[], readFailed: true as const }),\n ),\n ]);\n return {\n families: artifacts.map((row) => pick(row, ['family', 'title', 'state', 'concern', 'errorCount', 'contentSummary'])),\n playbooks: playbooks.map((row) => pick(row, ['playbookRef', 'intent', 'eligible', 'unmet', 'requiresElicitation', 'staleOutputs', 'wouldReplace'])),\n buildTasks: tasks.map((row) => pick(row, ['taskRef', 'objective', 'status'])),\n /* What an answer names: the run AND its round, since a run asks again under the same id (#1584). */\n waitingRuns: waiting.rows.filter((row) => row.readable === true).map((row) => pick(row, ['runId', 'playbookRef', 'round', 'requests'])),\n /* A waiting run nobody can answer is still a stuck run the person should hear about — counted, never dropped. */\n unreadableWaitingRunCount: waiting.rows.filter((row) => row.readable !== true).length,\n ...(waiting.readFailed ? { waitingRunsUnavailable: 'The runs waiting on the person could not be read just now; do not say none are waiting.' } : {}),\n };\n },\n };\n\n const readArtifact: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.READ_ARTIFACT,\n description:\n 'One landed specification family, rendered as a document, by its family id (from the application state). '\n + 'Returns its document, its validator errors (issues) and warnings; the workbench opens it beside the conversation.',\n inputSchema: z.object({ family: z.string().min(1).describe('The family id, e.g. vision-brief, market-snapshot, domain-plan.') }),\n execute: async (args: { family: string }, context) => {\n const rows = await readCreationPlaneRows(context, WorkbenchShared_ResourceType.SPECIFICATION_ARTIFACTS);\n const row = rows.find((candidate) => candidate.family === args.family);\n if (!row) return { found: false, family: args.family };\n return { found: true, ...pick(row, ['family', 'title', 'state', 'document', 'issues', 'warnings', 'decisionRecord']) };\n },\n };\n\n const runPlaybook: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.RUN_PLAYBOOK,\n description:\n 'Start one playbook run in the background and return its run id at once. Costs model calls (one to three minutes, '\n + 'sometimes more) — the person is asked to approve before it starts. Only an eligible playbook can be started. '\n + 'The run then appears in the conversation as a card; its outcome is read there, never assumed.',\n inputSchema: z.object({\n playbookRef: z.string().min(1).describe('The playbook ref from the application state, e.g. top_down.vision-elicitation.'),\n instanceKey: z.string().optional().describe('The instance to run, when the step was opened as a separate instance for one purpose; omit for the step itself.'),\n creatorBrief: z.string().optional().describe('What the person said they want from this run, in their words, when they said something specific.'),\n }),\n /* Money: a run generates and judges. The engine suspends the turn until the person approves. */\n requiresHumanApproval: true,\n execute: async (args: { playbookRef: string; instanceKey?: string; creatorBrief?: string }, context) => {\n const playbookRun = services.get<PlaybookRunCompanionService>(COMPANION_SERVICE_TYPES.PlaybookRunService);\n const { playbooks } = await playbookRun.listPlaybookEligibility();\n const eligibility = playbooks.find((candidate) => candidate.playbookRef === args.playbookRef);\n if (!eligibility) return { started: false, reason: 'unknown_playbook', playbookRef: args.playbookRef };\n if (!eligibility.eligible) return { started: false, reason: 'not_eligible', playbookRef: args.playbookRef, unmet: eligibility.unmet };\n /*\n * The run's own TRACE, opened here as the HTTP path opens one per request (#1454, gap 3). A run\n * started from a conversation carried none, so its card could not say what it had done or was\n * doing, and its detail had no conversation to show — the two things a creator watching a run\n * reads. The session is in-memory until the run writes to it, as every session is.\n */\n const traceability = services.get<CompanionTraceabilityService>(COMPANION_SERVICE_TYPES.TraceabilityService);\n const session = traceability.createInternalSession({\n label: `creation conversation — ${args.playbookRef}`,\n ...(context.executionId ? { metadata: { conversationId: context.executionId } } : {}),\n });\n const submitted = await playbookRun.submitPlaybookRunDetached({\n playbookRef: args.playbookRef,\n // The INSTANCE (#1609); the run refuses one that was never opened, before any model call.\n ...(args.instanceKey ? { instanceKey: args.instanceKey } : {}),\n session,\n ...(args.creatorBrief ? { creatorBrief: args.creatorBrief } : {}),\n /* The thread this turn belongs to, so the run shows as a card of it. */\n ...(context.executionId ? { conversationId: context.executionId } : {}),\n // The signed-in person the assistant runs it for (#1751): a question the run asks is routed to them.\n ...(context.auth?.initiatorIds?.userId ? { requestedByUserId: context.auth.initiatorIds.userId } : {}),\n });\n return { started: true, runId: submitted.runId, playbookRef: submitted.playbookRef, note: submitted.note };\n },\n };\n\n const openPlaybookInstance: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.OPEN_PLAYBOOK_INSTANCE,\n description:\n 'Open a SEPARATE instance of a step for one purpose the person named: one market analysis per segment, one '\n + 'refinement per area. It is recorded as a decision about what the application builds and committed at once, so it '\n + 'asks the person to approve first. The step itself keeps running as before; the instance is then run with its key.',\n inputSchema: z.object({\n playbookRef: z.string().min(1).describe('The playbook ref from the application state.'),\n instanceKey: z.string().min(1).describe('A short kebab-case key for the instance, e.g. enterprise-segment.'),\n purpose: z.string().min(1).describe('What this instance is for, in the person\\'s words.'),\n }),\n /* A commit, and a decision about scope: the engine suspends the turn until the person approves. */\n requiresHumanApproval: true,\n execute: async (args: { playbookRef: string; instanceKey: string; purpose: string }) => {\n const instances = services.get<PlaybookInstanceCompanionService>(COMPANION_SERVICE_TYPES.PlaybookInstanceService);\n try {\n const opened = await instances.openInstance({ ...args, actor: DecisionRecordActor.AGENT });\n return { opened: true, instanceId: opened.instanceId, ...(opened.commitSha ? { commitSha: opened.commitSha } : {}), note: opened.note };\n } catch (error) {\n if (error instanceof PlaybookInstanceRefusedError || error instanceof PlaybookInstanceTreeBusyError) {\n return { opened: false, reason: error.message };\n }\n throw error;\n }\n },\n };\n\n /*\n * SECONDARY LINES (#1608). A line is an opened instance of its kind's entry composite, so opening one is\n * the instance door with the entry resolved from the kind: nothing records a line beside the activation.\n */\n const openSecondaryLine: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.OPEN_SECONDARY_LINE,\n description:\n 'Open a SECONDARY LINE beside the main line to develop one feature the person asked for, once the application exists. '\n + 'It is recorded as a decision about what the application builds and committed at once, so it asks the person to approve '\n + 'first. It starts nothing: run the returned entry playbook with the returned instance key. When the person asked for '\n + 'something the application\\'s kind leaves out (a public website on an internal tool), name the families the feature needs '\n + 'back in `neededFamilies`; only then, and only what the person asked for.',\n inputSchema: z.object({\n // A feature line only: a refinement line names what it refines, through its own tool.\n line: z.literal(ApplicationSecondaryLine.FEATURE_DEVELOPMENT).describe('The kind of line: feature_development.'),\n lineKey: z.string().min(1).describe('A short kebab-case key naming the line, e.g. invoicing.'),\n purpose: z.string().min(1).describe('The feature, in the person\\'s words.'),\n neededFamilies: z.array(z.enum(ApplicationSpecificationFamily)).optional()\n .describe('Families the main line does not apply that this feature needs, e.g. website-plan and market-snapshot for a public website.'),\n }),\n requiresHumanApproval: true,\n execute: async (args: { line: ApplicationSecondaryLine; lineKey: string; purpose: string; neededFamilies?: ApplicationSpecificationFamily[] }) => {\n const instances = services.get<PlaybookInstanceCompanionService>(COMPANION_SERVICE_TYPES.PlaybookInstanceService);\n const entryPlaybookRef = APPLICATION_SECONDARY_LINE_DEFINITIONS[args.line].entryPlaybookRef;\n try {\n const opened = await instances.openInstance({\n playbookRef: entryPlaybookRef, instanceKey: args.lineKey, purpose: args.purpose,\n ...(args.neededFamilies && args.neededFamilies.length > 0 ? { neededFamilies: args.neededFamilies } : {}),\n actor: DecisionRecordActor.AGENT,\n });\n return { opened: true, line: args.line, entryPlaybookRef, instanceKey: args.lineKey, instanceId: opened.instanceId, ...(opened.commitSha ? { commitSha: opened.commitSha } : {}) };\n } catch (error) {\n if (error instanceof PlaybookInstanceRefusedError || error instanceof PlaybookInstanceTreeBusyError) {\n return { opened: false, reason: error.message };\n }\n throw error;\n }\n },\n };\n\n const openRefinementLine: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.OPEN_REFINEMENT_LINE,\n description:\n 'Open a REFINEMENT line beside the main line, when the person wants something the application already holds made '\n + 'better: tighter requirements, a reworked experience plan, a sharper value proposition. It re-derives each named family '\n + 'from what it already says, guided by the purpose, then refreshes what that made out of date and builds it. Name the '\n + 'families in `refinedFamilies` from what the person asked for; the approval names them, so the person decides. A new '\n + 'feature is a feature line, not a refinement. It starts nothing: run the returned entry playbook with the returned key.',\n inputSchema: z.object({\n lineKey: z.string().min(1).describe('A short kebab-case key naming the line, e.g. onboarding.'),\n purpose: z.string().min(1).describe('What to improve, in the person\\'s words.'),\n refinedFamilies: z.array(z.enum(ApplicationSpecificationFamily)).min(1)\n .describe('The families to refine, e.g. requirements or experience-plan. The value proposition is part of market-snapshot.'),\n }),\n requiresHumanApproval: true,\n execute: async (args: { lineKey: string; purpose: string; refinedFamilies: ApplicationSpecificationFamily[] }) => {\n const instances = services.get<PlaybookInstanceCompanionService>(COMPANION_SERVICE_TYPES.PlaybookInstanceService);\n const entryPlaybookRef = APPLICATION_SECONDARY_LINE_DEFINITIONS[ApplicationSecondaryLine.REFINEMENT].entryPlaybookRef;\n try {\n const opened = await instances.openInstance({\n playbookRef: entryPlaybookRef, instanceKey: args.lineKey, purpose: args.purpose, refinedFamilies: args.refinedFamilies, actor: DecisionRecordActor.AGENT,\n });\n return {\n opened: true, line: ApplicationSecondaryLine.REFINEMENT, entryPlaybookRef, instanceKey: args.lineKey, instanceId: opened.instanceId,\n ...(opened.commitSha ? { commitSha: opened.commitSha } : {}),\n };\n } catch (error) {\n if (error instanceof PlaybookInstanceRefusedError || error instanceof PlaybookInstanceTreeBusyError) {\n return { opened: false, reason: error.message };\n }\n throw error;\n }\n },\n };\n\n const readLines: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.READ_LINES,\n description:\n 'The application\\'s main line (the kind of application it is), and the secondary lines open beside it, each with its '\n + 'instance key and what it is for.',\n inputSchema: z.object({}),\n execute: async () => {\n const creatorInputs = await services.get<DossierCompanionService>(COMPANION_SERVICE_TYPES.DossierService).readCreatorInputs();\n const declaration = resolveApplicationLineDeclaration(creatorInputs);\n return {\n mainLine: declaration.state === ApplicationLineDeclarationState.DECLARED ? declaration.line : null,\n mainLineState: declaration.state,\n secondaryLines: resolveOpenSecondaryLines(creatorInputs).map((line) => ({\n line: line.line,\n instanceKey: line.instanceKey,\n entryPlaybookRef: APPLICATION_SECONDARY_LINE_DEFINITIONS[line.line].entryPlaybookRef,\n purpose: line.purpose,\n neededFamilies: line.neededFamilies,\n refinedFamilies: line.refinedFamilies,\n })),\n };\n },\n };\n\n const closeSecondaryLine: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.CLOSE_SECONDARY_LINE,\n description:\n 'Close a secondary line the person says is done (completed) or no longer wanted (abandoned). It is recorded and committed, '\n + 'so it asks the person to approve first. What the line added stays; abandoning also cancels its runs that wait on the person.',\n inputSchema: z.object({\n line: z.enum(ApplicationSecondaryLine).describe('The kind of line, as the lines read returns it: feature_development or refinement.'),\n lineKey: z.string().min(1).describe('The line\\'s key, as the lines read returns it.'),\n outcome: z.enum(ApplicationPlaybookInstanceClosureKind).describe('completed, or abandoned.'),\n reason: z.string().min(1).optional().describe('Why, in the person\\'s words.'),\n }),\n requiresHumanApproval: true,\n execute: async (args: { line: ApplicationSecondaryLine; lineKey: string; outcome: ApplicationPlaybookInstanceClosureKind; reason?: string }) => {\n const instances = services.get<PlaybookInstanceCompanionService>(COMPANION_SERVICE_TYPES.PlaybookInstanceService);\n try {\n const closed = await instances.closeInstance({\n playbookRef: APPLICATION_SECONDARY_LINE_DEFINITIONS[args.line].entryPlaybookRef,\n instanceKey: args.lineKey,\n kind: args.outcome,\n ...(args.reason ? { reason: args.reason } : {}),\n actor: DecisionRecordActor.AGENT,\n });\n return { closed: true, ...closed };\n } catch (error) {\n if (error instanceof PlaybookInstanceRefusedError || error instanceof PlaybookInstanceTreeBusyError) {\n return { closed: false, reason: error.message };\n }\n throw error;\n }\n },\n };\n\n const answerRunQuestion: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.ANSWER_RUN_QUESTION,\n description:\n 'Answer a run that stopped on questions, and let it continue. `accept` with the answers (ref by ref, as the run '\n + 'asked them), `decline` to continue on the run\\'s stated assumption, or `cancel` to abandon the run. Name the '\n + '`round` whose questions the person answered: a run that has moved to a later round refuses it. Send only answers the '\n + 'person gave in this conversation: they are recorded as the person\\'s own decisions.',\n inputSchema: z.object({\n runId: z.string().min(1),\n round: z.number().int().min(1).describe('The round of questions answered, as the waiting run carries it.'),\n action: z.enum(MetaWorkflow_ClarificationAction),\n answers: z.array(z.object({ ref: z.string().min(1), answer: z.string().min(1) })).optional(),\n }),\n execute: async (args: { runId: string; round: number; action: MetaWorkflow_ClarificationAction; answers?: { ref: string; answer: string }[] }, context) => {\n const playbookRun = services.get<PlaybookRunCompanionService>(COMPANION_SERVICE_TYPES.PlaybookRunService);\n /*\n * WHO answered (#1658): the signed-in person the assistant relays for — the identity the workbench's\n * own resume door records, taken from the server-verified caller and never from the model's arguments.\n */\n const answeredByRef = context.auth?.initiatorIds?.userId;\n const outcome = await playbookRun.resumePlaybookRun({\n runId: args.runId, round: args.round, action: args.action,\n ...(args.answers ? { answers: args.answers } : {}),\n ...(answeredByRef ? { answeredByRef, actingUserId: answeredByRef } : {}),\n });\n /*\n * `status` only when the run SAYS one (#1781): cancelled, or stopped to ask again. A continuation\n * that concluded has none, and inventing a third value ('resumed') for it put a word into the\n * field its named vocabulary does not have.\n */\n return { runId: args.runId, action: args.action, ...('status' in outcome ? { status: outcome.status } : {}) };\n },\n };\n\n const research: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.RESEARCH,\n description:\n 'Find something out from the public web with a read-only research agent, given one clear objective. Takes minutes '\n + 'and costs model calls — the person is asked to approve first. Returns the evidence found and where it was recorded.',\n inputSchema: z.object({ objective: z.string().min(1).describe('What to find out, in one or two sentences.') }),\n requiresHumanApproval: true,\n execute: async (args: { objective: string }) => {\n const dispatch = services.get<ResearchAgentDispatchCompanionService>(COMPANION_SERVICE_TYPES.ResearchAgentDispatchService);\n const result = await dispatch.runResearchTask({ objective: args.objective });\n return { evidence: result.evidence, stopReason: result.stopReason, elapsedMs: result.elapsedMs, persistedEvidencePath: result.persistedEvidencePath };\n },\n };\n\n const readDossier: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.READ_DOSSIER,\n description:\n 'The dossier: every question a creation step asks the person, with their answer when they gave one '\n + '(standing from-you) or still-needed when they did not. Each entry names its playbookRef and questionRef. '\n + 'An opened instance of a step asks its questions again under its instanceKey (with what it was opened for); '\n + 'standing from-the-step means it runs on the step\\'s own answer until the person gives it one. '\n + 'Call this before asking the person anything a step needs — if the dossier already holds it, do not ask again.',\n inputSchema: z.object({\n playbookRef: z.string().min(1).optional().describe('Only this playbook\\'s questions, when the conversation is about one step.'),\n }),\n execute: async (args: { playbookRef?: string }, context) => {\n const rows = await readCreationPlaneRows(context, WorkbenchShared_ResourceType.DOSSIER_ENTRIES);\n /*\n * A step's questions include the decisions it SHARES with an earlier step: one row, at the owner\n * (#1454 review, A2). Without them the assistant saw nothing still needed for the fallback step,\n * started it, and had it refused on the shared question.\n */\n const selected = args.playbookRef\n ? rows.filter((row) => row.playbookRef === args.playbookRef || (Array.isArray(row.sharedWithPlaybookRefs) && row.sharedWithPlaybookRefs.includes(args.playbookRef)))\n : rows;\n /* `affectsFamilies` is what an answer reaches (#1454, Step 8) — the assistant says it before asking, as the interview does. */\n return { entries: selected.map((row) => pick(row, ['playbookRef', 'instanceKey', 'instancePurpose', 'questionRef', 'question', 'kind', 'options', 'standing', 'value', 'playbookEligible', 'affectsFamilies', 'sharedWithPlaybookRefs'])) };\n },\n };\n\n const recordAnswer: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.RECORD_ANSWER,\n description:\n 'File the person\\'s answer to one dossier question, in their words, so the step that asks it can run '\n + 'without asking again. Use the entry\\'s own playbookRef and questionRef, as the dossier returned them. Refuses a choice outside the question\\'s options or an ambiguous yes/no; the refusal '\n + 'says what to change. Returns the questions of that step still unanswered.',\n inputSchema: z.object({\n playbookRef: z.string().min(1),\n questionRef: z.string().min(1),\n instanceKey: z.string().min(1).optional().describe('The instance the question is asked for, when the dossier entry names one; omit for the step itself.'),\n value: z.string().min(1).describe('The answer as the person gave it. For a yes/no question: yes or no.'),\n }),\n /*\n * No approval: recording what the person just said costs nothing and is reversible (the file is\n * a working edit until committed). The one thing it must not do is invent — the instructions\n * forbid filing an answer the person did not give in this conversation.\n */\n execute: async (args: { playbookRef: string; questionRef: string; instanceKey?: string; value: string }, context) => {\n /*\n * A shared decision is ONE row, at its owner (#1454 review, A2): a fallback question with no\n * answer of its own has no row, so an answer addressed to it is filed on the owner's row — the\n * same rule the dossier's own answer operation applies.\n */\n let rowId = workbenchDossierEntryIdentity(args);\n const shared = (getFrameworkKnowledgePlaybook(args.playbookRef)?.playbook as { method?: { elicitation?: { questions?: { ref: string; sameDecisionAs?: { playbookRef: string; questionRef: string } }[] } } } | undefined)\n ?.method?.elicitation?.questions?.find((question) => question.ref === args.questionRef)?.sameDecisionAs;\n /* A shared decision is the step's own and is never asked per instance, so an instance's answer is never redirected. */\n if (shared && args.instanceKey === undefined) {\n const rows = await readCreationPlaneRows(context, WorkbenchShared_ResourceType.DOSSIER_ENTRIES);\n if (!rows.some((row) => row.workbenchDossierEntryId === rowId)) rowId = workbenchDossierEntryIdentity(shared);\n }\n const result = await dispatchResourceOperationAsTool<unknown>({\n ctx: context,\n resourceType: WorkbenchShared_ResourceType.DOSSIER_ENTRIES,\n operationIdentifier: WorkbenchDossierEntries_Operations.ANSWER,\n recordId: rowId,\n data: { value: args.value },\n });\n return result;\n },\n };\n\n /*\n * CHANGING THE APPLICATION from a session (#1454, Step 7) — four tools, one decision each:\n * propose a task (the person approves, and may change its arguments), see what running it means,\n * run it (money — approved separately), accept what it wrote (a commit — approved separately).\n * \"Keep it for later\" is proposing without dispatching, which is why they are not one tool.\n */\n const proposeBuildTask: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.PROPOSE_BUILD_TASK,\n description:\n 'Add ONE build task to the application\\'s plan, for a change the person asked for. The person is shown the task '\n + 'and approves it (or changes its arguments) before it is added — that is the confirmation. Adding does not run it. '\n + 'Name the target precisely: a RESOURCE_STAGE (moduleRef, resourceRef, stage SCHEMA|CONFIG|UI_BEHAVIOR|SPEC), a '\n + 'MODULE (moduleRef), a RELATIONSHIP (moduleRef, relationshipRef) or a SHELL_PLACEMENT (surface). Declare what the '\n + 'task produces so its landing can be proven. Returns the task ref and any advisory findings.',\n inputSchema: z.object({\n objective: z.string().min(1).describe('One sentence: what this task delivers, in the person\\'s terms.'),\n target: z.record(z.string(), z.unknown()).describe('The target, e.g. { kind: \"RESOURCE_STAGE\", moduleRef: \"todos\", resourceRef: \"todo\", stage: \"SCHEMA\" }.'),\n produces: z.array(z.record(z.string(), z.unknown())).describe('The artifacts this task is accountable for, e.g. [{ kind: \"RESOURCE_SCHEMA_FIELDS\", resourceRef: \"todo\", fieldRefs: [\"priority\"] }].'),\n functionalTopic: z.string().min(1).describe('The build phase this task belongs to, e.g. model_domain_graph, define_interaction_semantics, shape_user_experience.'),\n skillRefs: z.array(z.string().min(1)).min(1).describe('The installed skills that carry the how, e.g. [\"resource-add-field\"].'),\n prerequisiteTaskRefs: z.array(z.string().min(1)).optional().describe('Task refs from the state that must land first.'),\n taskRef: z.string().min(1).optional().describe('build-task-<slug>; derived from the objective when omitted.'),\n }),\n /* Approval here is the REVIEW of the task — the person sees and may change what will be added. */\n requiresHumanApproval: true,\n execute: async (args: Record<string, unknown>, context) => dispatchResourceOperationAsTool<unknown>({\n ctx: context,\n resourceType: WorkbenchShared_ResourceType.BUILD_PLAN_TASKS,\n operationIdentifier: WorkbenchBuildPlanTasks_Operations.ADD_TASK,\n data: args,\n }),\n };\n\n const describeTask: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.DESCRIBE_TASK,\n description:\n 'What running ONE build task would mean, without running it: where the coding agent may write, which checks it must '\n + 'pass, and roughly how much context it carries (in tokens). Refuses, naming why, when the task is not ready. Call '\n + 'this before asking the person to run a task, and tell them what it costs: a coding-agent run of minutes, paid per token.',\n inputSchema: z.object({ taskRef: z.string().min(1) }),\n execute: async (args: { taskRef: string }) => {\n const buildDispatch = services.get<ApplicationBuildDispatchCompanionService>(COMPANION_SERVICE_TYPES.ApplicationBuildDispatchService);\n try {\n const described = await buildDispatch.describeBuildTaskDispatch(args.taskRef);\n return {\n ready: true,\n taskRef: described.plan.taskRef,\n objective: described.plan.objective,\n allowedPathPrefixes: described.plan.allowedPathPrefixes,\n requiredChecks: described.plan.requiredChecks,\n installedSkillRefs: described.plan.installedSkillRefs,\n ...(described.contextTokens !== undefined ? { contextTokens: described.contextTokens } : {}),\n };\n } catch (error) {\n if (error instanceof ApplicationBuildTaskNotReadyError) {\n return { ready: false, taskRef: args.taskRef, standing: error.standing, unmetPrerequisiteTaskRefs: error.unmetPrerequisiteTaskRefs, reason: error.message };\n }\n throw error;\n }\n },\n };\n\n const dispatchTask: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.DISPATCH_TASK,\n description:\n 'Run ONE ready build task with the coding agent. Costs money (a coding-agent run of minutes, paid per token) — the '\n + 'person is asked to approve before it starts. Only a READY task can run; a landed or blocked one is refused with why. '\n + 'Returns at once once the run is admitted; the run then shows in the conversation as a card, and its outcome is read '\n + 'there, never assumed.',\n inputSchema: z.object({ taskRef: z.string().min(1).describe('The task ref from the state or from the proposal.') }),\n requiresHumanApproval: true,\n execute: async (args: { taskRef: string }, context) => dispatchResourceOperationAsTool<unknown>({\n ctx: context,\n resourceType: WorkbenchShared_ResourceType.BUILD_PLAN_TASKS,\n operationIdentifier: WorkbenchBuildPlanTasks_Operations.DISPATCH_TASK,\n recordId: sanitizeWorkbenchCreationPlaneIdentity(args.taskRef),\n /* The thread this turn belongs to, so the run shows as a card of it. */\n data: context.executionId ? { conversationId: context.executionId } : {},\n }),\n };\n\n const acceptTask: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.ACCEPT_TASK,\n description:\n 'Accept what a task\\'s latest finished coding run wrote: commit exactly those files, in one commit that names the task. '\n + 'The person is asked to approve first. Files carrying changes from before the run, or edited since, are refused by '\n + 'name and left out; say which. Only after the person has looked at the run\\'s outcome.',\n inputSchema: z.object({ taskRef: z.string().min(1) }),\n requiresHumanApproval: true,\n execute: async (args: { taskRef: string }, context) => dispatchResourceOperationAsTool<unknown>({\n ctx: context,\n resourceType: WorkbenchShared_ResourceType.BUILD_PLAN_TASKS,\n operationIdentifier: WorkbenchBuildPlanTasks_Operations.ACCEPT,\n recordId: sanitizeWorkbenchCreationPlaneIdentity(args.taskRef),\n data: {},\n }),\n };\n\n return [readApplicationState, readArtifact, runPlaybook, openPlaybookInstance, openSecondaryLine, openRefinementLine, readLines, closeSecondaryLine, answerRunQuestion, research, readDossier, recordAnswer, proposeBuildTask, describeTask, dispatchTask, acceptTask];\n}\n"]}
1
+ {"version":3,"file":"creation-conversation.function-tools.js","sourceRoot":"","sources":["../../../../src/creation-conversation/creation-conversation.function-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,+BAA+B,EAAE,kBAAkB,EAAgD,MAAM,4BAA4B,CAAC;AAC/I,OAA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AO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,qBAAqB,EAAE,IAAI;QAC3B,OAAO,EAAE,KAAK,EAAE,IAAyB,EAAE,OAAO,EAAE,EAAE,CAAC,+BAA+B,CAAU;YAC9F,GAAG,EAAE,OAAO;YACZ,YAAY,EAAE,4BAA4B,CAAC,gBAAgB;YAC3D,mBAAmB,EAAE,kCAAkC,CAAC,MAAM;YAC9D,QAAQ,EAAE,sCAAsC,CAAC,IAAI,CAAC,OAAO,CAAC;YAC9D,IAAI,EAAE,EAAE;SACT,CAAC;KACH,CAAC;IAEF,OAAO,CAAC,oBAAoB,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,SAAS,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;AACzT,CAAC","sourcesContent":["import { z } from 'zod';\nimport type { FunctionTool, FunctionToolExecutionContext } from '@wildo-ai/saas-backend-lib';\nimport { dispatchResourceOperationAsTool, SAAS_SERVICE_TYPES, type ExternalProvidersRegistryBackendService } from '@wildo-ai/saas-backend-lib';\nimport { CoreResourceOperation } from '@wildo-ai/saas-models';\nimport { WorkbenchBuildPlanTasks_Operations, WorkbenchCreationConversationTool, WorkbenchDossierEntries_Operations, WorkbenchShared_ResourceType, sanitizeWorkbenchCreationPlaneIdentity, workbenchDossierEntryIdentity } from '@wildo-ai/platform-core-shared';\nimport { getFrameworkKnowledgePlaybook } from '@wildo-ai/framework-knowledge';\nimport {\n APPLICATION_SECONDARY_LINE_DEFINITIONS,\n ApplicationLineDeclarationState,\n ApplicationPlaybookInstanceClosureKind,\n ApplicationSecondaryLine,\n ApplicationSpecificationFamily,\n resolveApplicationLineDeclaration,\n resolveOpenSecondaryLines,\n} from '@wildo-ai/saas-specifications/application-creation';\nimport type { DossierCompanionService } from '../meta-workflows/services/dossier.companion.service';\n\nimport { COMPANION_SERVICE_TYPES } from '../core/inject/models/service-types';\nimport type { PlaybookRunCompanionService } from '../meta-workflows/services/playbook-run.companion.service';\nimport { describeCreationLanePreflightRefusal, evaluateCreationLanePreflight } from '../meta-workflows/services/creation-lane-preflight.companion.service';\nimport { proposeInterviewAnswers } from '../meta-workflows/services/interview-answer-proposal.companion';\nimport type { CreationPlaneProjectionCompanionService } from '../core/introspection/resources/creation-plane-projection.companion.service';\nimport { PlaybookInstanceRefusedError, PlaybookInstanceTreeBusyError, type PlaybookInstanceCompanionService } from '../meta-workflows/services/playbook-instance.companion.service';\nimport { DecisionRecordActor } from '../claude-cli/services/accepted-change-commit.companion.service';\nimport { ApplicationBuildTaskNotReadyError, type ApplicationBuildDispatchCompanionService } from '../meta-workflows/services/application-build-dispatch.companion.service';\nimport type { ResearchAgentDispatchCompanionService } from '../claude-cli/services/research-agent-dispatch.companion.service';\nimport type { CompanionTraceabilityService } from '../core/traceability/companion-traceability.service';\nimport { ApplicationInterviewDepth, MetaWorkflow_ClarificationAction } from '@wildo-ai/saas-models/meta-workflows';\n\n/*\n * The tools of the creation assistant (#1454, Step 4) — every one a TYPED operation the companion\n * already exposes, reached IN-PROCESS. The assistant never crosses HTTP, so the two-gate problem\n * of the workbench client (a browser session for `/api/v1`, a 0600 file token for `/api/companion`)\n * does not arise: the tool holds the service.\n *\n * The refs are {@link WorkbenchCreationConversationTool} — shared, because the workbench words a\n * status line and an approval card per tool and cannot see this source. The agent's\n * `capabilities.tools.functionRefs` lists exactly that enum's values, so the declared refs and the\n * registered tools cannot drift.\n */\n\n/**\n * A lazy service getter rather than the services themselves: the tools are declared at startup\n * ASSEMBLY, before the container has resolved every companion service, and a tool only needs its\n * service when a turn calls it.\n */\nexport interface CreationConversationToolServices {\n readonly get: <T>(identifier: symbol) => T;\n}\n\n/**\n * The rows the WORKBENCH reads, read the same way — the resource's own LIST, dispatched AS THE\n * CALLER through the engine's tool seam (roles and any declared rate limit applied, like every\n * other tool) — so what the assistant says and what the page shows are one derivation. Trimmed by\n * the callers to what a turn needs: the model pays per token and a family's rendered document is\n * not a fact about its state.\n */\nasync function readCreationPlaneRows(\n context: FunctionToolExecutionContext,\n resourceType: WorkbenchShared_ResourceType,\n): Promise<readonly Record<string, unknown>[]> {\n const result = await dispatchResourceOperationAsTool<unknown>({\n ctx: context,\n resourceType,\n operationIdentifier: CoreResourceOperation.LIST,\n });\n if (Array.isArray(result)) return result as readonly Record<string, unknown>[];\n const data = (result as { data?: unknown })?.data;\n return Array.isArray(data) ? (data as readonly Record<string, unknown>[]) : [];\n}\n\nfunction pick<T extends Record<string, unknown>>(row: T, keys: readonly string[]): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const key of keys) if (key in row) out[key] = row[key];\n return out;\n}\n\nexport function buildCreationConversationFunctionTools(services: CreationConversationToolServices): FunctionTool[] {\n const readApplicationState: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.READ_APPLICATION_STATE,\n description:\n 'Where the application stands: every specification family with its state (landed_valid, landed_invalid, not_landed) '\n + 'and its concern; every playbook with whether it is eligible to run now, what it waits on, whether it interviews the '\n + 'creator first, and which of its outputs are stale; every build-plan task with its status (ready, landed, blocked); '\n + 'and every run WAITING on the person, with its run id, the round of questions it is on, and those questions. '\n + 'Call this before any statement about what exists or is missing.',\n inputSchema: z.object({}),\n execute: async (_args, context) => {\n const [artifacts, playbooks, tasks, waiting] = await Promise.all([\n readCreationPlaneRows(context, WorkbenchShared_ResourceType.SPECIFICATION_ARTIFACTS),\n readCreationPlaneRows(context, WorkbenchShared_ResourceType.PLAYBOOKS),\n readCreationPlaneRows(context, WorkbenchShared_ResourceType.BUILD_PLAN_TASKS),\n /*\n * Read on its OWN terms: the waiting runs failing to read must not take the rest of the state with\n * them, and must not read as \"nothing is waiting\" either (#1584 review F3).\n */\n readCreationPlaneRows(context, WorkbenchShared_ResourceType.WAITING_PLAYBOOK_RUNS).then(\n (rows) => ({ rows, readFailed: false as const }),\n () => ({ rows: [] as readonly Record<string, unknown>[], readFailed: true as const }),\n ),\n ]);\n return {\n families: artifacts.map((row) => pick(row, ['family', 'title', 'state', 'concern', 'errorCount', 'contentSummary'])),\n playbooks: playbooks.map((row) => pick(row, ['playbookRef', 'intent', 'eligible', 'unmet', 'requiresElicitation', 'staleOutputs', 'wouldReplace'])),\n buildTasks: tasks.map((row) => pick(row, ['taskRef', 'objective', 'status'])),\n /* What an answer names: the run AND its round, since a run asks again under the same id (#1584). */\n waitingRuns: waiting.rows.filter((row) => row.readable === true).map((row) => pick(row, ['runId', 'playbookRef', 'round', 'requests'])),\n /* A waiting run nobody can answer is still a stuck run the person should hear about — counted, never dropped. */\n unreadableWaitingRunCount: waiting.rows.filter((row) => row.readable !== true).length,\n ...(waiting.readFailed ? { waitingRunsUnavailable: 'The runs waiting on the person could not be read just now; do not say none are waiting.' } : {}),\n };\n },\n };\n\n const readArtifact: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.READ_ARTIFACT,\n description:\n 'One landed specification family, rendered as a document, by its family id (from the application state). '\n + 'Returns its document, its validator errors (issues) and warnings; the workbench opens it beside the conversation.',\n inputSchema: z.object({ family: z.string().min(1).describe('The family id, e.g. vision-brief, market-snapshot, domain-plan.') }),\n execute: async (args: { family: string }, context) => {\n const rows = await readCreationPlaneRows(context, WorkbenchShared_ResourceType.SPECIFICATION_ARTIFACTS);\n const row = rows.find((candidate) => candidate.family === args.family);\n if (!row) return { found: false, family: args.family };\n return { found: true, ...pick(row, ['family', 'title', 'state', 'document', 'issues', 'warnings', 'decisionRecord']) };\n },\n };\n\n const runPlaybook: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.RUN_PLAYBOOK,\n description:\n 'Start one playbook run in the background and return its run id at once. Costs model calls (one to three minutes, '\n + 'sometimes more) — the person is asked to approve before it starts. Only an eligible playbook can be started. '\n + 'The run then appears in the conversation as a card; its outcome is read there, never assumed.',\n inputSchema: z.object({\n playbookRef: z.string().min(1).describe('The playbook ref from the application state, e.g. top_down.vision-elicitation.'),\n instanceKey: z.string().optional().describe('The instance to run, when the step was opened as a separate instance for one purpose; omit for the step itself.'),\n creatorBrief: z.string().optional().describe('What the person said they want from this run, in their words, when they said something specific.'),\n }),\n /* Money: a run generates and judges. The engine suspends the turn until the person approves. */\n requiresHumanApproval: true,\n execute: async (args: { playbookRef: string; instanceKey?: string; creatorBrief?: string }, context) => {\n const playbookRun = services.get<PlaybookRunCompanionService>(COMPANION_SERVICE_TYPES.PlaybookRunService);\n const { playbooks } = await playbookRun.listPlaybookEligibility();\n const eligibility = playbooks.find((candidate) => candidate.playbookRef === args.playbookRef);\n if (!eligibility) return { started: false, reason: 'unknown_playbook', playbookRef: args.playbookRef };\n if (!eligibility.eligible) return { started: false, reason: 'not_eligible', playbookRef: args.playbookRef, unmet: eligibility.unmet };\n /*\n * The creation preflight (#2229), asked of this companion's registry: a run whose provider calls would be refused\n * is not started, and the refusal's sentence goes back to the assistant so it can tell the person what to fix.\n */\n const preflight = evaluateCreationLanePreflight(services.get<ExternalProvidersRegistryBackendService>(SAAS_SERVICE_TYPES.ExternalProvidersRegistryService));\n if (preflight.length > 0) {\n return { started: false, reason: 'preflight_refused', playbookRef: args.playbookRef, message: describeCreationLanePreflightRefusal(preflight) };\n }\n /*\n * The run's own TRACE, opened here as the HTTP path opens one per request (#1454, gap 3). A run\n * started from a conversation carried none, so its card could not say what it had done or was\n * doing, and its detail had no conversation to show — the two things a creator watching a run\n * reads. The session is in-memory until the run writes to it, as every session is.\n */\n const traceability = services.get<CompanionTraceabilityService>(COMPANION_SERVICE_TYPES.TraceabilityService);\n const session = traceability.createInternalSession({\n label: `creation conversation — ${args.playbookRef}`,\n ...(context.executionId ? { metadata: { conversationId: context.executionId } } : {}),\n });\n const submitted = await playbookRun.submitPlaybookRunDetached({\n playbookRef: args.playbookRef,\n // The INSTANCE (#1609); the run refuses one that was never opened, before any model call.\n ...(args.instanceKey ? { instanceKey: args.instanceKey } : {}),\n session,\n ...(args.creatorBrief ? { creatorBrief: args.creatorBrief } : {}),\n /* The thread this turn belongs to, so the run shows as a card of it. */\n ...(context.executionId ? { conversationId: context.executionId } : {}),\n // The signed-in person the assistant runs it for (#1751): a question the run asks is routed to them.\n ...(context.auth?.initiatorIds?.userId ? { requestedByUserId: context.auth.initiatorIds.userId } : {}),\n });\n return { started: true, runId: submitted.runId, playbookRef: submitted.playbookRef, note: submitted.note };\n },\n };\n\n const openPlaybookInstance: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.OPEN_PLAYBOOK_INSTANCE,\n description:\n 'Open a SEPARATE instance of a step for one purpose the person named: one market analysis per segment, one '\n + 'refinement per area. It is recorded as a decision about what the application builds and committed at once, so it '\n + 'asks the person to approve first. The step itself keeps running as before; the instance is then run with its key.',\n inputSchema: z.object({\n playbookRef: z.string().min(1).describe('The playbook ref from the application state.'),\n instanceKey: z.string().min(1).describe('A short kebab-case key for the instance, e.g. enterprise-segment.'),\n purpose: z.string().min(1).describe('What this instance is for, in the person\\'s words.'),\n }),\n /* A commit, and a decision about scope: the engine suspends the turn until the person approves. */\n requiresHumanApproval: true,\n execute: async (args: { playbookRef: string; instanceKey: string; purpose: string }) => {\n const instances = services.get<PlaybookInstanceCompanionService>(COMPANION_SERVICE_TYPES.PlaybookInstanceService);\n try {\n const opened = await instances.openInstance({ ...args, actor: DecisionRecordActor.AGENT });\n return { opened: true, instanceId: opened.instanceId, ...(opened.commitSha ? { commitSha: opened.commitSha } : {}), note: opened.note };\n } catch (error) {\n if (error instanceof PlaybookInstanceRefusedError || error instanceof PlaybookInstanceTreeBusyError) {\n return { opened: false, reason: error.message };\n }\n throw error;\n }\n },\n };\n\n /*\n * SECONDARY LINES (#1608). A line is an opened instance of its kind's entry composite, so opening one is\n * the instance door with the entry resolved from the kind: nothing records a line beside the activation.\n */\n const openSecondaryLine: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.OPEN_SECONDARY_LINE,\n description:\n 'Open a SECONDARY LINE beside the main line to develop one feature the person asked for, once the application exists. '\n + 'It is recorded as a decision about what the application builds and committed at once, so it asks the person to approve '\n + 'first. It starts nothing: run the returned entry playbook with the returned instance key. When the person asked for '\n + 'something the application\\'s kind leaves out (a public website on an internal tool), name the families the feature needs '\n + 'back in `neededFamilies`; only then, and only what the person asked for.',\n inputSchema: z.object({\n // A feature line only: a refinement line names what it refines, through its own tool.\n line: z.literal(ApplicationSecondaryLine.FEATURE_DEVELOPMENT).describe('The kind of line: feature_development.'),\n lineKey: z.string().min(1).describe('A short kebab-case key naming the line, e.g. invoicing.'),\n purpose: z.string().min(1).describe('The feature, in the person\\'s words.'),\n neededFamilies: z.array(z.enum(ApplicationSpecificationFamily)).optional()\n .describe('Families the main line does not apply that this feature needs, e.g. website-plan and market-snapshot for a public website.'),\n }),\n requiresHumanApproval: true,\n execute: async (args: { line: ApplicationSecondaryLine; lineKey: string; purpose: string; neededFamilies?: ApplicationSpecificationFamily[] }) => {\n const instances = services.get<PlaybookInstanceCompanionService>(COMPANION_SERVICE_TYPES.PlaybookInstanceService);\n const entryPlaybookRef = APPLICATION_SECONDARY_LINE_DEFINITIONS[args.line].entryPlaybookRef;\n try {\n const opened = await instances.openInstance({\n playbookRef: entryPlaybookRef, instanceKey: args.lineKey, purpose: args.purpose,\n ...(args.neededFamilies && args.neededFamilies.length > 0 ? { neededFamilies: args.neededFamilies } : {}),\n actor: DecisionRecordActor.AGENT,\n });\n return { opened: true, line: args.line, entryPlaybookRef, instanceKey: args.lineKey, instanceId: opened.instanceId, ...(opened.commitSha ? { commitSha: opened.commitSha } : {}) };\n } catch (error) {\n if (error instanceof PlaybookInstanceRefusedError || error instanceof PlaybookInstanceTreeBusyError) {\n return { opened: false, reason: error.message };\n }\n throw error;\n }\n },\n };\n\n const openRefinementLine: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.OPEN_REFINEMENT_LINE,\n description:\n 'Open a REFINEMENT line beside the main line, when the person wants something the application already holds made '\n + 'better: tighter requirements, a reworked experience plan, a sharper value proposition. It re-derives each named family '\n + 'from what it already says, guided by the purpose, then refreshes what that made out of date and builds it. Name the '\n + 'families in `refinedFamilies` from what the person asked for; the approval names them, so the person decides. A new '\n + 'feature is a feature line, not a refinement. It starts nothing: run the returned entry playbook with the returned key.',\n inputSchema: z.object({\n lineKey: z.string().min(1).describe('A short kebab-case key naming the line, e.g. onboarding.'),\n purpose: z.string().min(1).describe('What to improve, in the person\\'s words.'),\n refinedFamilies: z.array(z.enum(ApplicationSpecificationFamily)).min(1)\n .describe('The families to refine, e.g. requirements or experience-plan. The value proposition is part of market-snapshot.'),\n }),\n requiresHumanApproval: true,\n execute: async (args: { lineKey: string; purpose: string; refinedFamilies: ApplicationSpecificationFamily[] }) => {\n const instances = services.get<PlaybookInstanceCompanionService>(COMPANION_SERVICE_TYPES.PlaybookInstanceService);\n const entryPlaybookRef = APPLICATION_SECONDARY_LINE_DEFINITIONS[ApplicationSecondaryLine.REFINEMENT].entryPlaybookRef;\n try {\n const opened = await instances.openInstance({\n playbookRef: entryPlaybookRef, instanceKey: args.lineKey, purpose: args.purpose, refinedFamilies: args.refinedFamilies, actor: DecisionRecordActor.AGENT,\n });\n return {\n opened: true, line: ApplicationSecondaryLine.REFINEMENT, entryPlaybookRef, instanceKey: args.lineKey, instanceId: opened.instanceId,\n ...(opened.commitSha ? { commitSha: opened.commitSha } : {}),\n };\n } catch (error) {\n if (error instanceof PlaybookInstanceRefusedError || error instanceof PlaybookInstanceTreeBusyError) {\n return { opened: false, reason: error.message };\n }\n throw error;\n }\n },\n };\n\n const readLines: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.READ_LINES,\n description:\n 'The application\\'s main line (the kind of application it is), and the secondary lines open beside it, each with its '\n + 'instance key and what it is for.',\n inputSchema: z.object({}),\n execute: async () => {\n const creatorInputs = await services.get<DossierCompanionService>(COMPANION_SERVICE_TYPES.DossierService).readCreatorInputs();\n const declaration = resolveApplicationLineDeclaration(creatorInputs);\n return {\n mainLine: declaration.state === ApplicationLineDeclarationState.DECLARED ? declaration.line : null,\n mainLineState: declaration.state,\n secondaryLines: resolveOpenSecondaryLines(creatorInputs).map((line) => ({\n line: line.line,\n instanceKey: line.instanceKey,\n entryPlaybookRef: APPLICATION_SECONDARY_LINE_DEFINITIONS[line.line].entryPlaybookRef,\n purpose: line.purpose,\n neededFamilies: line.neededFamilies,\n refinedFamilies: line.refinedFamilies,\n })),\n };\n },\n };\n\n const closeSecondaryLine: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.CLOSE_SECONDARY_LINE,\n description:\n 'Close a secondary line the person says is done (completed) or no longer wanted (abandoned). It is recorded and committed, '\n + 'so it asks the person to approve first. What the line added stays; abandoning also cancels its runs that wait on the person.',\n inputSchema: z.object({\n line: z.enum(ApplicationSecondaryLine).describe('The kind of line, as the lines read returns it: feature_development or refinement.'),\n lineKey: z.string().min(1).describe('The line\\'s key, as the lines read returns it.'),\n outcome: z.enum(ApplicationPlaybookInstanceClosureKind).describe('completed, or abandoned.'),\n reason: z.string().min(1).optional().describe('Why, in the person\\'s words.'),\n }),\n requiresHumanApproval: true,\n execute: async (args: { line: ApplicationSecondaryLine; lineKey: string; outcome: ApplicationPlaybookInstanceClosureKind; reason?: string }) => {\n const instances = services.get<PlaybookInstanceCompanionService>(COMPANION_SERVICE_TYPES.PlaybookInstanceService);\n try {\n const closed = await instances.closeInstance({\n playbookRef: APPLICATION_SECONDARY_LINE_DEFINITIONS[args.line].entryPlaybookRef,\n instanceKey: args.lineKey,\n kind: args.outcome,\n ...(args.reason ? { reason: args.reason } : {}),\n actor: DecisionRecordActor.AGENT,\n });\n return { closed: true, ...closed };\n } catch (error) {\n if (error instanceof PlaybookInstanceRefusedError || error instanceof PlaybookInstanceTreeBusyError) {\n return { closed: false, reason: error.message };\n }\n throw error;\n }\n },\n };\n\n const answerRunQuestion: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.ANSWER_RUN_QUESTION,\n description:\n 'Answer a run that stopped on questions, and let it continue. `accept` with the answers (ref by ref, as the run '\n + 'asked them), `decline` to continue on the run\\'s stated assumption, or `cancel` to abandon the run. Name the '\n + '`round` whose questions the person answered: a run that has moved to a later round refuses it. Send only answers the '\n + 'person gave in this conversation: they are recorded as the person\\'s own decisions.',\n inputSchema: z.object({\n runId: z.string().min(1),\n round: z.number().int().min(1).describe('The round of questions answered, as the waiting run carries it.'),\n action: z.enum(MetaWorkflow_ClarificationAction),\n answers: z.array(z.object({ ref: z.string().min(1), answer: z.string().min(1) })).optional(),\n }),\n execute: async (args: { runId: string; round: number; action: MetaWorkflow_ClarificationAction; answers?: { ref: string; answer: string }[] }, context) => {\n const playbookRun = services.get<PlaybookRunCompanionService>(COMPANION_SERVICE_TYPES.PlaybookRunService);\n /*\n * WHO answered (#1658): the signed-in person the assistant relays for — the identity the workbench's\n * own resume door records, taken from the server-verified caller and never from the model's arguments.\n */\n const answeredByRef = context.auth?.initiatorIds?.userId;\n const outcome = await playbookRun.resumePlaybookRun({\n runId: args.runId, round: args.round, action: args.action,\n ...(args.answers ? { answers: args.answers } : {}),\n ...(answeredByRef ? { answeredByRef, actingUserId: answeredByRef } : {}),\n });\n /*\n * `status` only when the run SAYS one (#1781): cancelled, or stopped to ask again. A continuation\n * that concluded has none, and inventing a third value ('resumed') for it put a word into the\n * field its named vocabulary does not have.\n */\n return { runId: args.runId, action: args.action, ...('status' in outcome ? { status: outcome.status } : {}) };\n },\n };\n\n const research: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.RESEARCH,\n description:\n 'Find something out from the public web with a read-only research agent, given one clear objective. Takes minutes '\n + 'and costs model calls — the person is asked to approve first. Returns the evidence found and where it was recorded.',\n inputSchema: z.object({ objective: z.string().min(1).describe('What to find out, in one or two sentences.') }),\n requiresHumanApproval: true,\n execute: async (args: { objective: string }) => {\n const dispatch = services.get<ResearchAgentDispatchCompanionService>(COMPANION_SERVICE_TYPES.ResearchAgentDispatchService);\n const result = await dispatch.runResearchTask({ objective: args.objective });\n return { evidence: result.evidence, stopReason: result.stopReason, elapsedMs: result.elapsedMs, persistedEvidencePath: result.persistedEvidencePath };\n },\n };\n\n const readDossier: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.READ_DOSSIER,\n description:\n 'The dossier: every question a creation step asks the person, with their answer when they gave one '\n + '(standing from-you) or still-needed when they did not. Each entry names its playbookRef and questionRef. '\n + 'An opened instance of a step asks its questions again under its instanceKey (with what it was opened for); '\n + 'standing from-the-step means it runs on the step\\'s own answer until the person gives it one; '\n + 'standing assumed means the person did not know and kept a proposed answer, which is worth revisiting. '\n + 'Call this before asking the person anything a step needs — if the dossier already holds it, do not ask again.',\n inputSchema: z.object({\n playbookRef: z.string().min(1).optional().describe('Only this playbook\\'s questions, when the conversation is about one step.'),\n }),\n execute: async (args: { playbookRef?: string }, context) => {\n const rows = await readCreationPlaneRows(context, WorkbenchShared_ResourceType.DOSSIER_ENTRIES);\n /*\n * A step's questions include the decisions it SHARES with an earlier step: one row, at the owner\n * (#1454 review, A2). Without them the assistant saw nothing still needed for the fallback step,\n * started it, and had it refused on the shared question.\n */\n const selected = args.playbookRef\n ? rows.filter((row) => row.playbookRef === args.playbookRef || (Array.isArray(row.sharedWithPlaybookRefs) && row.sharedWithPlaybookRefs.includes(args.playbookRef)))\n : rows;\n /* `affectsFamilies` is what an answer reaches (#1454, Step 8) — the assistant says it before asking, as the interview does. */\n /* #2129: how detailed the interviews are, what a quick one asks, what may be proposed, what is regulated. */\n return {\n interviewDepth: rows[0]?.interviewDepth ?? null,\n entries: selected.map((row) => pick(row, ['playbookRef', 'instanceKey', 'instancePurpose', 'questionRef', 'question', 'kind', 'options', 'standing', 'value', 'playbookEligible', 'affectsFamilies', 'sharedWithPlaybookRefs', 'askedInSimpleInterview', 'proposable', 'regulatedDomain', 'assumptionRationale'])),\n };\n },\n };\n\n const recordAnswer: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.RECORD_ANSWER,\n description:\n 'File the person\\'s answer to one dossier question, in their words, so the step that asks it can run '\n + 'without asking again. Use the entry\\'s own playbookRef and questionRef, as the dossier returned them. Refuses a choice outside the question\\'s options or an ambiguous yes/no; the refusal '\n + 'says what to change. Returns the questions of that step still unanswered.',\n inputSchema: z.object({\n playbookRef: z.string().min(1),\n questionRef: z.string().min(1),\n instanceKey: z.string().min(1).optional().describe('The instance the question is asked for, when the dossier entry names one; omit for the step itself.'),\n value: z.string().min(1).describe('The answer as the person gave it. For a yes/no question: yes or no.'),\n assumed: z.boolean().optional().describe(\n `TRUE only when the value is a proposal from ${'`'}${WorkbenchCreationConversationTool.PROPOSE_INTERVIEW_ANSWERS}${'`'} that the person kept because they did not know. It is recorded as an assumption, never as their answer.`,\n ),\n assumptionRationale: z.string().trim().min(1).optional().describe('Required with assumed: the rationale the proposal came with. An assumption without one is refused.'),\n }),\n /*\n * No approval: recording what the person just said costs nothing and is reversible (the file is\n * a working edit until committed). The one thing it must not do is invent — the instructions\n * forbid filing an answer the person did not give in this conversation.\n */\n execute: async (args: { playbookRef: string; questionRef: string; instanceKey?: string; value: string; assumed?: boolean; assumptionRationale?: string }, context) => {\n /*\n * A shared decision is ONE row, at its owner (#1454 review, A2): a fallback question with no\n * answer of its own has no row, so an answer addressed to it is filed on the owner's row — the\n * same rule the dossier's own answer operation applies.\n */\n let rowId = workbenchDossierEntryIdentity(args);\n const shared = (getFrameworkKnowledgePlaybook(args.playbookRef)?.playbook as { method?: { elicitation?: { questions?: { ref: string; sameDecisionAs?: { playbookRef: string; questionRef: string } }[] } } } | undefined)\n ?.method?.elicitation?.questions?.find((question) => question.ref === args.questionRef)?.sameDecisionAs;\n /* A shared decision is the step's own and is never asked per instance, so an instance's answer is never redirected. */\n if (shared && args.instanceKey === undefined) {\n const rows = await readCreationPlaneRows(context, WorkbenchShared_ResourceType.DOSSIER_ENTRIES);\n if (!rows.some((row) => row.workbenchDossierEntryId === rowId)) rowId = workbenchDossierEntryIdentity(shared);\n }\n const result = await dispatchResourceOperationAsTool<unknown>({\n ctx: context,\n resourceType: WorkbenchShared_ResourceType.DOSSIER_ENTRIES,\n operationIdentifier: WorkbenchDossierEntries_Operations.ANSWER,\n recordId: rowId,\n data: {\n value: args.value,\n ...(args.assumed === true ? { assumed: true } : {}),\n ...(args.assumed === true && args.assumptionRationale !== undefined ? { assumptionRationale: args.assumptionRationale } : {}),\n },\n });\n return result;\n },\n };\n\n const setInterviewDepth: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.SET_INTERVIEW_DEPTH,\n description:\n 'Record how detailed this application\\'s interviews are, as the person chose: simple (ask only the essential questions and '\n + 'propose the rest for them to review) or detailed (ask every question). Recorded once for the whole application.',\n inputSchema: z.object({ interviewDepth: z.enum(ApplicationInterviewDepth) }),\n execute: async (args: { interviewDepth: ApplicationInterviewDepth }) => {\n const dossier = services.get<DossierCompanionService>(COMPANION_SERVICE_TYPES.DossierService);\n const recorded = await dossier.recordInterviewDepth(args.interviewDepth);\n /* Every dossier row carries the depth and a quick interview asks fewer of them: the boards move, as on the other two doors. */\n services.get<CreationPlaneProjectionCompanionService>(COMPANION_SERVICE_TYPES.CreationPlaneProjectionService).invalidateDerivedBoards();\n return recorded;\n },\n };\n\n /*\n * \"I don't know\" (#2129): propose answers instead of pressing the person. One call to the same proposer the\n * console uses, so a proposal reads the same in both; it writes nothing, and what the person keeps is filed\n * through RECORD_ANSWER as an assumption.\n */\n const proposeInterviewAnswersTool: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.PROPOSE_INTERVIEW_ANSWERS,\n description:\n 'Propose answers to a step\\'s interview questions the person does not know, built from what they already said. '\n + 'Writes nothing: show each proposal with its rationale and ask whether to keep it. Name the question refs, or omit them '\n + 'to propose everything the application\\'s interview depth does not ask (the review step of a short interview). '\n + 'A question only the person may answer is refused.',\n inputSchema: z.object({\n playbookRef: z.string().min(1),\n instanceKey: z.string().min(1).optional().describe('The instance the questions are asked for, when the dossier entry names one.'),\n questionRefs: z.array(z.string().min(1)).optional(),\n }),\n execute: async (args: { playbookRef: string; instanceKey?: string; questionRefs?: string[] }) => {\n const dossier = services.get<DossierCompanionService>(COMPANION_SERVICE_TYPES.DossierService);\n const runs = services.get<PlaybookRunCompanionService>(COMPANION_SERVICE_TYPES.PlaybookRunService);\n return proposeInterviewAnswers(runs.interviewAnswerProposalPorts(), {\n playbookRef: args.playbookRef,\n ...(args.instanceKey !== undefined ? { instanceKey: args.instanceKey } : {}),\n ...(args.questionRefs !== undefined ? { questionRefs: args.questionRefs } : {}),\n });\n },\n };\n\n /*\n * CHANGING THE APPLICATION from a session (#1454, Step 7) — four tools, one decision each:\n * propose a task (the person approves, and may change its arguments), see what running it means,\n * run it (money — approved separately), accept what it wrote (a commit — approved separately).\n * \"Keep it for later\" is proposing without dispatching, which is why they are not one tool.\n */\n const proposeBuildTask: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.PROPOSE_BUILD_TASK,\n description:\n 'Add ONE build task to the application\\'s plan, for a change the person asked for. The person is shown the task '\n + 'and approves it (or changes its arguments) before it is added — that is the confirmation. Adding does not run it. '\n + 'Name the target precisely: a RESOURCE_STAGE (moduleRef, resourceRef, stage SCHEMA|CONFIG|UI_BEHAVIOR|SPEC), a '\n + 'MODULE (moduleRef), a RELATIONSHIP (moduleRef, relationshipRef) or a SHELL_PLACEMENT (surface). Declare what the '\n + 'task produces so its landing can be proven. Returns the task ref and any advisory findings.',\n inputSchema: z.object({\n objective: z.string().min(1).describe('One sentence: what this task delivers, in the person\\'s terms.'),\n target: z.record(z.string(), z.unknown()).describe('The target, e.g. { kind: \"RESOURCE_STAGE\", moduleRef: \"todos\", resourceRef: \"todo\", stage: \"SCHEMA\" }.'),\n produces: z.array(z.record(z.string(), z.unknown())).describe('The artifacts this task is accountable for, e.g. [{ kind: \"RESOURCE_SCHEMA_FIELDS\", resourceRef: \"todo\", fieldRefs: [\"priority\"] }].'),\n functionalTopic: z.string().min(1).describe('The build phase this task belongs to, e.g. model_domain_graph, define_interaction_semantics, shape_user_experience.'),\n skillRefs: z.array(z.string().min(1)).min(1).describe('The installed skills that carry the how, e.g. [\"resource-add-field\"].'),\n prerequisiteTaskRefs: z.array(z.string().min(1)).optional().describe('Task refs from the state that must land first.'),\n taskRef: z.string().min(1).optional().describe('build-task-<slug>; derived from the objective when omitted.'),\n }),\n /* Approval here is the REVIEW of the task — the person sees and may change what will be added. */\n requiresHumanApproval: true,\n execute: async (args: Record<string, unknown>, context) => dispatchResourceOperationAsTool<unknown>({\n ctx: context,\n resourceType: WorkbenchShared_ResourceType.BUILD_PLAN_TASKS,\n operationIdentifier: WorkbenchBuildPlanTasks_Operations.ADD_TASK,\n data: args,\n }),\n };\n\n const describeTask: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.DESCRIBE_TASK,\n description:\n 'What running ONE build task would mean, without running it: where the coding agent may write, which checks it must '\n + 'pass, and roughly how much context it carries (in tokens). Refuses, naming why, when the task is not ready. Call '\n + 'this before asking the person to run a task, and tell them what it costs: a coding-agent run of minutes, paid per token.',\n inputSchema: z.object({ taskRef: z.string().min(1) }),\n execute: async (args: { taskRef: string }) => {\n const buildDispatch = services.get<ApplicationBuildDispatchCompanionService>(COMPANION_SERVICE_TYPES.ApplicationBuildDispatchService);\n try {\n const described = await buildDispatch.describeBuildTaskDispatch(args.taskRef);\n return {\n ready: true,\n taskRef: described.plan.taskRef,\n objective: described.plan.objective,\n allowedPathPrefixes: described.plan.allowedPathPrefixes,\n requiredChecks: described.plan.requiredChecks,\n installedSkillRefs: described.plan.installedSkillRefs,\n ...(described.contextTokens !== undefined ? { contextTokens: described.contextTokens } : {}),\n };\n } catch (error) {\n if (error instanceof ApplicationBuildTaskNotReadyError) {\n return { ready: false, taskRef: args.taskRef, standing: error.standing, unmetPrerequisiteTaskRefs: error.unmetPrerequisiteTaskRefs, reason: error.message };\n }\n throw error;\n }\n },\n };\n\n const dispatchTask: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.DISPATCH_TASK,\n description:\n 'Run ONE ready build task with the coding agent. Costs money (a coding-agent run of minutes, paid per token) — the '\n + 'person is asked to approve before it starts. Only a READY task can run; a landed or blocked one is refused with why. '\n + 'Returns at once once the run is admitted; the run then shows in the conversation as a card, and its outcome is read '\n + 'there, never assumed.',\n inputSchema: z.object({ taskRef: z.string().min(1).describe('The task ref from the state or from the proposal.') }),\n requiresHumanApproval: true,\n execute: async (args: { taskRef: string }, context) => dispatchResourceOperationAsTool<unknown>({\n ctx: context,\n resourceType: WorkbenchShared_ResourceType.BUILD_PLAN_TASKS,\n operationIdentifier: WorkbenchBuildPlanTasks_Operations.DISPATCH_TASK,\n recordId: sanitizeWorkbenchCreationPlaneIdentity(args.taskRef),\n /* The thread this turn belongs to, so the run shows as a card of it. */\n data: context.executionId ? { conversationId: context.executionId } : {},\n }),\n };\n\n const acceptTask: FunctionTool = {\n functionRef: WorkbenchCreationConversationTool.ACCEPT_TASK,\n description:\n 'Accept what a task\\'s latest finished coding run wrote: commit exactly those files, in one commit that names the task. '\n + 'The person is asked to approve first. Files carrying changes from before the run, or edited since, are refused by '\n + 'name and left out; say which. Only after the person has looked at the run\\'s outcome.',\n inputSchema: z.object({ taskRef: z.string().min(1) }),\n requiresHumanApproval: true,\n execute: async (args: { taskRef: string }, context) => dispatchResourceOperationAsTool<unknown>({\n ctx: context,\n resourceType: WorkbenchShared_ResourceType.BUILD_PLAN_TASKS,\n operationIdentifier: WorkbenchBuildPlanTasks_Operations.ACCEPT,\n recordId: sanitizeWorkbenchCreationPlaneIdentity(args.taskRef),\n data: {},\n }),\n };\n\n return [readApplicationState, readArtifact, runPlaybook, openPlaybookInstance, openSecondaryLine, openRefinementLine, readLines, closeSecondaryLine, answerRunQuestion, research, readDossier, recordAnswer, setInterviewDepth, proposeInterviewAnswersTool, proposeBuildTask, describeTask, dispatchTask, acceptTask];\n}\n"]}