@wildo-ai/dev-companion 1.1.3 → 1.1.4

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 (549) hide show
  1. package/dist/esm/.tsbuildinfo +1 -1
  2. package/dist/esm/__tests__/asset-noop.d.ts.map +1 -1
  3. package/dist/esm/__tests__/chdir-dogfood-app.setup.d.ts.map +1 -1
  4. package/dist/esm/__tests__/internal-test-view.d.ts.map +1 -1
  5. package/dist/esm/brand/models/logo-creative-brief.schemas.d.ts.map +1 -1
  6. package/dist/esm/brand/models/logo-generation.actors-system.definitions.d.ts.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 +9 -3
  9. package/dist/esm/brand/models/logo-judge.actors-system.definitions.js.map +1 -1
  10. package/dist/esm/brand/models/logo-judge.schemas.d.ts.map +1 -1
  11. package/dist/esm/brand/services/brand-accept.companion.service.d.ts +3 -24
  12. package/dist/esm/brand/services/brand-accept.companion.service.d.ts.map +1 -1
  13. package/dist/esm/brand/services/brand-accept.companion.service.js +10 -48
  14. package/dist/esm/brand/services/brand-accept.companion.service.js.map +1 -1
  15. package/dist/esm/brand/services/logo-deliberation.companion.service.d.ts.map +1 -1
  16. package/dist/esm/brand/services/logo-deliberation.companion.service.js +2 -8
  17. package/dist/esm/brand/services/logo-deliberation.companion.service.js.map +1 -1
  18. package/dist/esm/brand/services/logo-generation.companion.service.d.ts +6 -3
  19. package/dist/esm/brand/services/logo-generation.companion.service.d.ts.map +1 -1
  20. package/dist/esm/brand/services/logo-generation.companion.service.js +11 -12
  21. package/dist/esm/brand/services/logo-generation.companion.service.js.map +1 -1
  22. package/dist/esm/brand/utils/derived-brand-assets.d.ts +0 -1
  23. package/dist/esm/brand/utils/derived-brand-assets.d.ts.map +1 -1
  24. package/dist/esm/brand/utils/derived-brand-assets.js +1 -2
  25. package/dist/esm/brand/utils/derived-brand-assets.js.map +1 -1
  26. package/dist/esm/brand/utils/stage-brand-candidate.d.ts +7 -9
  27. package/dist/esm/brand/utils/stage-brand-candidate.d.ts.map +1 -1
  28. package/dist/esm/brand/utils/stage-brand-candidate.js +8 -11
  29. package/dist/esm/brand/utils/stage-brand-candidate.js.map +1 -1
  30. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +52 -2
  31. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts.map +1 -1
  32. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js +45 -0
  33. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
  34. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +45 -5
  35. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
  36. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +192 -13
  37. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
  38. package/dist/esm/claude-cli/services/git-change-set.companion.service.d.ts +12 -22
  39. package/dist/esm/claude-cli/services/git-change-set.companion.service.d.ts.map +1 -1
  40. package/dist/esm/claude-cli/services/git-change-set.companion.service.js +151 -82
  41. package/dist/esm/claude-cli/services/git-change-set.companion.service.js.map +1 -1
  42. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.d.ts +30 -4
  43. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.d.ts.map +1 -1
  44. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.js +30 -4
  45. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.js.map +1 -1
  46. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts +16 -0
  47. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts.map +1 -1
  48. package/dist/esm/claude-cli/services/research-evidence-store.companion.js +17 -0
  49. package/dist/esm/claude-cli/services/research-evidence-store.companion.js.map +1 -1
  50. package/dist/esm/code-compliance-check/check-label-placeholder-contract.companion.d.ts.map +1 -1
  51. package/dist/esm/code-compliance-check/check-raw-feature-id-literals.companion.d.ts.map +1 -1
  52. package/dist/esm/companion-api/companion-api.schemas.d.ts +57 -57
  53. package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
  54. package/dist/esm/companion-api/controllers/companion-i18n-api-contract.utils.d.ts.map +1 -1
  55. package/dist/esm/companion-api/controllers/companion-token-floor.policy.d.ts +90 -0
  56. package/dist/esm/companion-api/controllers/companion-token-floor.policy.d.ts.map +1 -0
  57. package/dist/esm/companion-api/controllers/companion-token-floor.policy.js +98 -0
  58. package/dist/esm/companion-api/controllers/companion-token-floor.policy.js.map +1 -0
  59. package/dist/esm/companion-api/controllers/companion.controller.d.ts +33 -5
  60. package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
  61. package/dist/esm/companion-api/controllers/companion.controller.js +150 -40
  62. package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
  63. package/dist/esm/core/auth/companion-auth-floor.companion.service.d.ts +8 -1
  64. package/dist/esm/core/auth/companion-auth-floor.companion.service.d.ts.map +1 -1
  65. package/dist/esm/core/auth/companion-auth-floor.companion.service.js +8 -1
  66. package/dist/esm/core/auth/companion-auth-floor.companion.service.js.map +1 -1
  67. package/dist/esm/core/catalogs/catalog-context.factory.d.ts.map +1 -1
  68. package/dist/esm/core/catalogs/catalog-context.factory.models.d.ts.map +1 -1
  69. package/dist/esm/core/catalogs/schema-org/aggregate-offer-catalog-context.factory.d.ts.map +1 -1
  70. package/dist/esm/core/catalogs/schema-org/aggregate-rating-catalog-context.factory.d.ts.map +1 -1
  71. package/dist/esm/core/catalogs/schema-org/article-catalog-context.factory.d.ts.map +1 -1
  72. package/dist/esm/core/catalogs/schema-org/blog-posting-catalog-context.factory.d.ts.map +1 -1
  73. package/dist/esm/core/catalogs/schema-org/breadcrumb-list-catalog-context.factory.d.ts.map +1 -1
  74. package/dist/esm/core/catalogs/schema-org/faq-page-catalog-context.factory.d.ts.map +1 -1
  75. package/dist/esm/core/catalogs/schema-org/offer-catalog-context.factory.d.ts.map +1 -1
  76. package/dist/esm/core/catalogs/schema-org/organization-catalog-context.factory.d.ts.map +1 -1
  77. package/dist/esm/core/catalogs/schema-org/product-catalog-context.factory.d.ts.map +1 -1
  78. package/dist/esm/core/catalogs/schema-org/review-catalog-context.factory.d.ts.map +1 -1
  79. package/dist/esm/core/catalogs/schema-org/schema-org-catalog-boundary.shared.d.ts +34 -0
  80. package/dist/esm/core/catalogs/schema-org/schema-org-catalog-boundary.shared.d.ts.map +1 -0
  81. package/dist/esm/core/catalogs/schema-org/schema-org-catalog-boundary.shared.js +65 -0
  82. package/dist/esm/core/catalogs/schema-org/schema-org-catalog-boundary.shared.js.map +1 -0
  83. package/dist/esm/core/catalogs/schema-org/schema-org-catalog-context.shared.d.ts +11 -1
  84. package/dist/esm/core/catalogs/schema-org/schema-org-catalog-context.shared.d.ts.map +1 -1
  85. package/dist/esm/core/catalogs/schema-org/schema-org-catalog-context.shared.js.map +1 -1
  86. package/dist/esm/core/catalogs/schema-org/software-application-catalog-context.factory.d.ts.map +1 -1
  87. package/dist/esm/core/catalogs/schema-org/website-catalog-context.factory.d.ts.map +1 -1
  88. package/dist/esm/core/catalogs/structured-data-catalog-audit.service.d.ts.map +1 -1
  89. package/dist/esm/core/catalogs/structured-data-catalog-audit.service.js +10 -2
  90. package/dist/esm/core/catalogs/structured-data-catalog-audit.service.js.map +1 -1
  91. package/dist/esm/core/config/primary-language.companion.utils.d.ts.map +1 -1
  92. package/dist/esm/core/context/companion-context.d.ts.map +1 -1
  93. package/dist/esm/core/context/companion-package-loaders.companion.d.ts.map +1 -1
  94. package/dist/esm/core/inject/models/container.d.ts.map +1 -1
  95. package/dist/esm/core/inject/models/container.js +0 -7
  96. package/dist/esm/core/inject/models/container.js.map +1 -1
  97. package/dist/esm/core/inject/models/service-types.d.ts +0 -1
  98. package/dist/esm/core/inject/models/service-types.d.ts.map +1 -1
  99. package/dist/esm/core/inject/models/service-types.js +0 -1
  100. package/dist/esm/core/inject/models/service-types.js.map +1 -1
  101. package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.d.ts.map +1 -1
  102. package/dist/esm/core/introspection/models/companion-introspection.models.d.ts.map +1 -1
  103. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts.map +1 -1
  104. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js +8 -4
  105. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js.map +1 -1
  106. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -1
  107. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +8 -1
  108. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -1
  109. package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.d.ts.map +1 -1
  110. package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.d.ts.map +1 -1
  111. package/dist/esm/core/introspection/services/companion-introspection-behavior-registry.companion.service.d.ts.map +1 -1
  112. package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts.map +1 -1
  113. package/dist/esm/core/introspection/services/companion-introspection.companion.service.js +42 -1
  114. package/dist/esm/core/introspection/services/companion-introspection.companion.service.js.map +1 -1
  115. package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.d.ts.map +1 -1
  116. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts.map +1 -1
  117. package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.d.ts.map +1 -1
  118. package/dist/esm/core/introspection/services/translation-placement.companion.service.d.ts.map +1 -1
  119. package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts +4 -9
  120. package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts.map +1 -1
  121. package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.js.map +1 -1
  122. package/dist/esm/core/introspection/subprocess/assertions.behavior.d.ts.map +1 -1
  123. package/dist/esm/core/introspection/subprocess/asset-noop-hooks.d.ts.map +1 -1
  124. package/dist/esm/core/introspection/subprocess/asset-noop-register.d.ts.map +1 -1
  125. package/dist/esm/core/introspection/subprocess/brand-prompt-renderer.d.ts.map +1 -1
  126. package/dist/esm/core/introspection/subprocess/chart-registration-refs.behavior.d.ts.map +1 -1
  127. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.d.ts.map +1 -1
  128. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js +3 -2
  129. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js.map +1 -1
  130. package/dist/esm/core/introspection/subprocess/companion-introspection-child.d.ts.map +1 -1
  131. package/dist/esm/core/introspection/subprocess/companion-introspection-module-exports.utils.d.ts.map +1 -1
  132. package/dist/esm/core/introspection/subprocess/compliance-primary-facts.behavior.d.ts +14 -5
  133. package/dist/esm/core/introspection/subprocess/compliance-primary-facts.behavior.d.ts.map +1 -1
  134. package/dist/esm/core/introspection/subprocess/compliance-primary-facts.behavior.js +14 -5
  135. package/dist/esm/core/introspection/subprocess/compliance-primary-facts.behavior.js.map +1 -1
  136. package/dist/esm/core/introspection/subprocess/definition-specifications.behavior.d.ts.map +1 -1
  137. package/dist/esm/core/introspection/subprocess/expert-persona-brief.renderer.d.ts.map +1 -1
  138. package/dist/esm/core/introspection/subprocess/family-aspects.behavior.d.ts +0 -21
  139. package/dist/esm/core/introspection/subprocess/family-aspects.behavior.d.ts.map +1 -1
  140. package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js +39 -1
  141. package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js.map +1 -1
  142. package/dist/esm/core/introspection/subprocess/frontend-labels-needed-info.behavior.d.ts.map +1 -1
  143. package/dist/esm/core/introspection/subprocess/market-context-block.builder.d.ts.map +1 -1
  144. package/dist/esm/core/introspection/subprocess/market-prompt-renderer.d.ts.map +1 -1
  145. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts +41 -2
  146. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts.map +1 -1
  147. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js +178 -41
  148. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js.map +1 -1
  149. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts.map +1 -1
  150. package/dist/esm/core/lock/wildo-saas-lock.companion.service.d.ts +23 -0
  151. package/dist/esm/core/lock/wildo-saas-lock.companion.service.d.ts.map +1 -1
  152. package/dist/esm/core/lock/wildo-saas-lock.companion.service.js +23 -0
  153. package/dist/esm/core/lock/wildo-saas-lock.companion.service.js.map +1 -1
  154. package/dist/esm/core/lock/wildo-saas-lock.models.d.ts.map +1 -1
  155. package/dist/esm/core/lock/wildo-saas-lock.schemas.d.ts +4 -4
  156. package/dist/esm/core/lock/wildo-saas-lock.schemas.d.ts.map +1 -1
  157. package/dist/esm/core/runtime/companion-startup-assembly.d.ts.map +1 -1
  158. package/dist/esm/core/runtime/companion-startup-assembly.js +5 -0
  159. package/dist/esm/core/runtime/companion-startup-assembly.js.map +1 -1
  160. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts.map +1 -1
  161. package/dist/esm/core/runtime/models/companion-runtime.models.d.ts.map +1 -1
  162. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts +16 -13
  163. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
  164. package/dist/esm/core/runtime/services/start-companion-application.service.js +70 -45
  165. package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
  166. package/dist/esm/core/runtime/utils/companion-local-signing-key.companion.d.ts.map +1 -1
  167. package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts.map +1 -1
  168. package/dist/esm/core/runtime/utils/companion-platform-config.companion.js +9 -2
  169. package/dist/esm/core/runtime/utils/companion-platform-config.companion.js.map +1 -1
  170. package/dist/esm/core/runtime/utils/companion-workbench-topology.d.ts.map +1 -1
  171. package/dist/esm/core/runtime/utils/platform-core-domain-modules.companion.d.ts.map +1 -1
  172. package/dist/esm/core/specifications/chart-view-specification-context.factory.d.ts.map +1 -1
  173. package/dist/esm/core/specifications/composite-view-specification-context.factory.d.ts.map +1 -1
  174. package/dist/esm/core/specifications/cross-registry-rendering.shared.d.ts.map +1 -1
  175. package/dist/esm/core/specifications/execution-view-specification-context.factory.d.ts.map +1 -1
  176. package/dist/esm/core/specifications/feature-specification-context.factory.d.ts.map +1 -1
  177. package/dist/esm/core/specifications/flows-actors-view-specification-context.factory.d.ts.map +1 -1
  178. package/dist/esm/core/specifications/frontend-component-specification-context.factory.d.ts.map +1 -1
  179. package/dist/esm/core/specifications/full-custom-view-specification-context.factory.d.ts.map +1 -1
  180. package/dist/esm/core/specifications/guidance-flow-specification-context.factory.d.ts.map +1 -1
  181. package/dist/esm/core/specifications/milestone-specification-context.factory.d.ts.map +1 -1
  182. package/dist/esm/core/specifications/non-composite-view-specification-context.shared.d.ts.map +1 -1
  183. package/dist/esm/core/specifications/onboarding-element-rendering.shared.d.ts.map +1 -1
  184. package/dist/esm/core/specifications/onboarding-view-specification-context.factory.d.ts.map +1 -1
  185. package/dist/esm/core/specifications/product-specification-context.factory.d.ts.map +1 -1
  186. package/dist/esm/core/specifications/resource-specification-context.factory.d.ts.map +1 -1
  187. package/dist/esm/core/specifications/role-specification-context.factory.d.ts.map +1 -1
  188. package/dist/esm/core/specifications/specification-context-factory.d.ts.map +1 -1
  189. package/dist/esm/core/specifications/specification-context-factory.models.d.ts.map +1 -1
  190. package/dist/esm/core/specifications/specification-context-factory.shared.d.ts.map +1 -1
  191. package/dist/esm/core/specifications/system-email-template-specification-context.factory.d.ts.map +1 -1
  192. package/dist/esm/core/specifications/templates/composite-view/composite-view-all-information.template.d.ts.map +1 -1
  193. package/dist/esm/core/specifications/templates/composite-view/composite-view-custom-implementation-context.template.d.ts.map +1 -1
  194. package/dist/esm/core/specifications/templates/composite-view/composite-view-development-usage-context.template.d.ts.map +1 -1
  195. package/dist/esm/core/specifications/templates/composite-view/composite-view-translation-context.template.d.ts.map +1 -1
  196. package/dist/esm/core/specifications/templates/feature/feature-all-information.template.d.ts.map +1 -1
  197. package/dist/esm/core/specifications/templates/feature/feature-custom-implementation-context.template.d.ts.map +1 -1
  198. package/dist/esm/core/specifications/templates/feature/feature-development-usage-context.template.d.ts.map +1 -1
  199. package/dist/esm/core/specifications/templates/feature/feature-translation-context.template.d.ts.map +1 -1
  200. package/dist/esm/core/specifications/templates/frontend-component/frontend-component-all-information.template.d.ts.map +1 -1
  201. package/dist/esm/core/specifications/templates/frontend-component/frontend-component-custom-implementation-context.template.d.ts.map +1 -1
  202. package/dist/esm/core/specifications/templates/frontend-component/frontend-component-development-usage-context.template.d.ts.map +1 -1
  203. package/dist/esm/core/specifications/templates/frontend-component/frontend-component-translation-context.template.d.ts.map +1 -1
  204. package/dist/esm/core/specifications/templates/guidance-flow-specification/guidance-flow-all-information.template.d.ts.map +1 -1
  205. package/dist/esm/core/specifications/templates/guidance-flow-specification/guidance-flow-custom-implementation-context.template.d.ts.map +1 -1
  206. package/dist/esm/core/specifications/templates/guidance-flow-specification/guidance-flow-development-usage-context.template.d.ts.map +1 -1
  207. package/dist/esm/core/specifications/templates/guidance-flow-specification/guidance-flow-translation-context.template.d.ts.map +1 -1
  208. package/dist/esm/core/specifications/templates/milestone/milestone-all-information.template.d.ts.map +1 -1
  209. package/dist/esm/core/specifications/templates/milestone/milestone-custom-implementation-context.template.d.ts.map +1 -1
  210. package/dist/esm/core/specifications/templates/milestone/milestone-development-usage-context.template.d.ts.map +1 -1
  211. package/dist/esm/core/specifications/templates/milestone/milestone-translation-context.template.d.ts.map +1 -1
  212. package/dist/esm/core/specifications/templates/non-composite-view/non-composite-view-all-information.template.d.ts.map +1 -1
  213. package/dist/esm/core/specifications/templates/non-composite-view/non-composite-view-custom-implementation-context.template.d.ts.map +1 -1
  214. package/dist/esm/core/specifications/templates/non-composite-view/non-composite-view-development-usage-context.template.d.ts.map +1 -1
  215. package/dist/esm/core/specifications/templates/non-composite-view/non-composite-view-translation-context.template.d.ts.map +1 -1
  216. package/dist/esm/core/specifications/templates/onboarding-view-specification/onboarding-view-all-information.template.d.ts.map +1 -1
  217. package/dist/esm/core/specifications/templates/onboarding-view-specification/onboarding-view-custom-implementation-context.template.d.ts.map +1 -1
  218. package/dist/esm/core/specifications/templates/onboarding-view-specification/onboarding-view-development-usage-context.template.d.ts.map +1 -1
  219. package/dist/esm/core/specifications/templates/onboarding-view-specification/onboarding-view-translation-context.template.d.ts.map +1 -1
  220. package/dist/esm/core/specifications/templates/product/product-all-information.template.d.ts.map +1 -1
  221. package/dist/esm/core/specifications/templates/product/product-custom-implementation-context.template.d.ts.map +1 -1
  222. package/dist/esm/core/specifications/templates/product/product-development-usage-context.template.d.ts.map +1 -1
  223. package/dist/esm/core/specifications/templates/product/product-translation-context.template.d.ts.map +1 -1
  224. package/dist/esm/core/specifications/templates/resource/resource-all-information.template.d.ts.map +1 -1
  225. package/dist/esm/core/specifications/templates/resource/resource-custom-implementation-context.template.d.ts.map +1 -1
  226. package/dist/esm/core/specifications/templates/resource/resource-development-usage-context.template.d.ts.map +1 -1
  227. package/dist/esm/core/specifications/templates/resource/resource-translation-context.template.d.ts.map +1 -1
  228. package/dist/esm/core/specifications/templates/role/role-all-information.template.d.ts.map +1 -1
  229. package/dist/esm/core/specifications/templates/role/role-custom-implementation-context.template.d.ts.map +1 -1
  230. package/dist/esm/core/specifications/templates/role/role-development-usage-context.template.d.ts.map +1 -1
  231. package/dist/esm/core/specifications/templates/role/role-translation-context.template.d.ts.map +1 -1
  232. package/dist/esm/core/specifications/templates/system-email-template/system-email-template-all-information.template.d.ts.map +1 -1
  233. package/dist/esm/core/specifications/templates/system-email-template/system-email-template-custom-implementation-context.template.d.ts.map +1 -1
  234. package/dist/esm/core/specifications/templates/system-email-template/system-email-template-development-usage-context.template.d.ts.map +1 -1
  235. package/dist/esm/core/specifications/templates/system-email-template/system-email-template-translation-context.template.d.ts.map +1 -1
  236. package/dist/esm/core/specifications/validate-resource-field-completeness.d.ts.map +1 -1
  237. package/dist/esm/core/traceability/companion-agent-call-trace-sink.companion.service.d.ts.map +1 -1
  238. package/dist/esm/core/traceability/companion-agent-call-trace-sink.companion.service.js +4 -4
  239. package/dist/esm/core/traceability/companion-agent-call-trace-sink.companion.service.js.map +1 -1
  240. package/dist/esm/core/traceability/companion-traceability.models.d.ts.map +1 -1
  241. package/dist/esm/core/traceability/companion-traceability.service.d.ts.map +1 -1
  242. package/dist/esm/core/utils/atomic-write.utils.d.ts.map +1 -1
  243. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.d.ts.map +1 -1
  244. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.js +13 -3
  245. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.js.map +1 -1
  246. package/dist/esm/deliberations/services/deliberation.companion.service.d.ts.map +1 -1
  247. package/dist/esm/deliberations/services/deliberation.companion.service.js +0 -5
  248. package/dist/esm/deliberations/services/deliberation.companion.service.js.map +1 -1
  249. package/dist/esm/deliberations/services/structured-deliberation.companion.service.d.ts.map +1 -1
  250. package/dist/esm/deliberations/services/structured-deliberation.companion.service.js +0 -2
  251. package/dist/esm/deliberations/services/structured-deliberation.companion.service.js.map +1 -1
  252. package/dist/esm/deliberations/utils/load-committed-expert-agents.d.ts.map +1 -1
  253. package/dist/esm/email/models/email-template.actors-system.definitions.d.ts.map +1 -1
  254. package/dist/esm/email/models/email-template.actors-system.definitions.js +4 -2
  255. package/dist/esm/email/models/email-template.actors-system.definitions.js.map +1 -1
  256. package/dist/esm/email/services/email-spec-context-loader.companion.service.d.ts +1 -1
  257. package/dist/esm/email/services/email-spec-context-loader.companion.service.d.ts.map +1 -1
  258. package/dist/esm/email/services/email-spec-context-loader.companion.service.js +1 -1
  259. package/dist/esm/email/services/email-spec-context-loader.companion.service.js.map +1 -1
  260. package/dist/esm/email/services/email-template.companion.service.d.ts.map +1 -1
  261. package/dist/esm/email/services/email-template.companion.service.js +23 -1
  262. package/dist/esm/email/services/email-template.companion.service.js.map +1 -1
  263. package/dist/esm/email/utils/email-labels-file-source.utils.d.ts.map +1 -1
  264. package/dist/esm/email/utils/email-template-fs-discovery.utils.d.ts.map +1 -1
  265. package/dist/esm/executions/services/companion-executions.companion.service.d.ts +82 -3
  266. package/dist/esm/executions/services/companion-executions.companion.service.d.ts.map +1 -1
  267. package/dist/esm/executions/services/companion-executions.companion.service.js +128 -6
  268. package/dist/esm/executions/services/companion-executions.companion.service.js.map +1 -1
  269. package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.d.ts.map +1 -1
  270. package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.js +7 -3
  271. package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.js.map +1 -1
  272. package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.d.ts.map +1 -1
  273. package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.js +11 -5
  274. package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.js.map +1 -1
  275. package/dist/esm/expert-personas/models/expert-persona-derivation.schemas.d.ts.map +1 -1
  276. package/dist/esm/expert-personas/services/expert-persona.companion.service.d.ts +9 -24
  277. package/dist/esm/expert-personas/services/expert-persona.companion.service.d.ts.map +1 -1
  278. package/dist/esm/expert-personas/services/expert-persona.companion.service.js +11 -60
  279. package/dist/esm/expert-personas/services/expert-persona.companion.service.js.map +1 -1
  280. package/dist/esm/i18n/components/APPLICATION_LEVEL_ACTIVITY_BAR.en.d.ts.map +1 -1
  281. package/dist/esm/i18n/components/APPLICATION_LEVEL_COMMAND_MENU.en.d.ts.map +1 -1
  282. package/dist/esm/i18n/components/APPLICATION_LEVEL_CONTROL_PANEL.en.d.ts.map +1 -1
  283. package/dist/esm/i18n/components/APPLICATION_LEVEL_MENUBAR.en.d.ts.map +1 -1
  284. package/dist/esm/i18n/components/APPLICATION_LEVEL_NAVIGATION_BACK.en.d.ts.map +1 -1
  285. package/dist/esm/i18n/components/APPLICATION_LEVEL_NOTIFICATION_CENTER.en.d.ts.map +1 -1
  286. package/dist/esm/i18n/components/APPLICATION_LEVEL_QUICK_ACTION_BUTTON.en.d.ts.map +1 -1
  287. package/dist/esm/i18n/components/APPLICATION_LEVEL_QUICK_SWITCHER.en.d.ts.map +1 -1
  288. package/dist/esm/i18n/components/APPLICATION_LEVEL_SIDEBAR.en.d.ts.map +1 -1
  289. package/dist/esm/i18n/components/APPLICATION_LEVEL_STATUS_BAR.en.d.ts.map +1 -1
  290. package/dist/esm/i18n/components/APPLICATION_LEVEL_TOOLBAR.en.d.ts.map +1 -1
  291. package/dist/esm/i18n/components/APPLICATION_LEVEL_USER_DROPDOWN.en.d.ts.map +1 -1
  292. package/dist/esm/i18n/components/APPLICATION_LEVEL_UTILITY_PANEL.en.d.ts.map +1 -1
  293. package/dist/esm/i18n/components/APP_LAYOUTS_APPEARANCE_SETTINGS.en.d.ts.map +1 -1
  294. package/dist/esm/i18n/components/APP_LAYOUTS_BILLING_SETTINGS.en.d.ts.map +1 -1
  295. package/dist/esm/i18n/components/APP_LAYOUTS_ERROR_BOUNDARY.en.d.ts.map +1 -1
  296. package/dist/esm/i18n/components/APP_LAYOUTS_HOME.en.d.ts.map +1 -1
  297. package/dist/esm/i18n/components/APP_LAYOUTS_INVITATIONS_SETTINGS.en.d.ts.map +1 -1
  298. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.d.ts.map +1 -1
  299. package/dist/esm/i18n/components/APP_LAYOUTS_ROUTER_ERROR_BOUNDARY.en.d.ts.map +1 -1
  300. package/dist/esm/i18n/components/APP_LAYOUTS_SECURITY_SETTINGS.en.d.ts.map +1 -1
  301. package/dist/esm/i18n/components/APP_LAYOUTS_SETTINGS_HUB.en.d.ts.map +1 -1
  302. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART.en.d.ts.map +1 -1
  303. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_WIDGET.en.d.ts.map +1 -1
  304. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_EXECUTION.en.d.ts.map +1 -1
  305. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_FLOWS_ACTORS.en.d.ts.map +1 -1
  306. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_NOT_FOUND.en.d.ts.map +1 -1
  307. package/dist/esm/i18n/components/LOW_LEVEL_ACTION_BAR.en.d.ts.map +1 -1
  308. package/dist/esm/i18n/components/LOW_LEVEL_AI_ACTOR.en.d.ts.map +1 -1
  309. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts.map +1 -1
  310. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts.map +1 -1
  311. package/dist/esm/i18n/components/LOW_LEVEL_AI_ARTIFACT.en.d.ts.map +1 -1
  312. package/dist/esm/i18n/components/LOW_LEVEL_AI_ARTIFACT_BROWSER.en.d.ts.map +1 -1
  313. package/dist/esm/i18n/components/LOW_LEVEL_AI_CHAIN_OF_THOUGHT.en.d.ts.map +1 -1
  314. package/dist/esm/i18n/components/LOW_LEVEL_AI_CODE_BLOCK.en.d.ts.map +1 -1
  315. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONFIRMATION.en.d.ts.map +1 -1
  316. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONTEXT.en.d.ts.map +1 -1
  317. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION.en.d.ts.map +1 -1
  318. package/dist/esm/i18n/components/LOW_LEVEL_AI_DECISION.en.d.ts.map +1 -1
  319. package/dist/esm/i18n/components/LOW_LEVEL_AI_EXECUTION_PLAN.en.d.ts.map +1 -1
  320. package/dist/esm/i18n/components/LOW_LEVEL_AI_EXECUTION_STREAM.en.d.ts.map +1 -1
  321. package/dist/esm/i18n/components/LOW_LEVEL_AI_FLOW_EXECUTION.en.d.ts.map +1 -1
  322. package/dist/esm/i18n/components/LOW_LEVEL_AI_FLOW_NODE.en.d.ts.map +1 -1
  323. package/dist/esm/i18n/components/LOW_LEVEL_AI_INLINE_CITATION.en.d.ts.map +1 -1
  324. package/dist/esm/i18n/components/LOW_LEVEL_AI_MESSAGE.en.d.ts.map +1 -1
  325. package/dist/esm/i18n/components/LOW_LEVEL_AI_MODEL_SELECTOR.en.d.ts.map +1 -1
  326. package/dist/esm/i18n/components/LOW_LEVEL_AI_OPEN_IN_CHAT.en.d.ts.map +1 -1
  327. package/dist/esm/i18n/components/LOW_LEVEL_AI_PLAN.en.d.ts.map +1 -1
  328. package/dist/esm/i18n/components/LOW_LEVEL_AI_PROMPT_INPUT.en.d.ts.map +1 -1
  329. package/dist/esm/i18n/components/LOW_LEVEL_AI_SYSTEM_CATALOG.en.d.ts.map +1 -1
  330. package/dist/esm/i18n/components/LOW_LEVEL_AI_TASK_DETAIL.en.d.ts.map +1 -1
  331. package/dist/esm/i18n/components/LOW_LEVEL_AI_TASK_MEMORY.en.d.ts.map +1 -1
  332. package/dist/esm/i18n/components/LOW_LEVEL_AI_WEB_PREVIEW.en.d.ts.map +1 -1
  333. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_INVOICE_HISTORY.en.d.ts.map +1 -1
  334. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PORTAL_LINK.en.d.ts.map +1 -1
  335. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PRICING_TABLE.en.d.ts.map +1 -1
  336. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_SUBSCRIPTION_STATUS.en.d.ts.map +1 -1
  337. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_USAGE_DASHBOARD.en.d.ts.map +1 -1
  338. package/dist/esm/i18n/components/LOW_LEVEL_BREADCRUMB.en.d.ts.map +1 -1
  339. package/dist/esm/i18n/components/LOW_LEVEL_BUTTON.en.d.ts.map +1 -1
  340. package/dist/esm/i18n/components/LOW_LEVEL_CAROUSEL.en.d.ts.map +1 -1
  341. package/dist/esm/i18n/components/LOW_LEVEL_CELEBRATION_OVERLAY.en.d.ts.map +1 -1
  342. package/dist/esm/i18n/components/LOW_LEVEL_COLOR_INPUT.en.d.ts.map +1 -1
  343. package/dist/esm/i18n/components/LOW_LEVEL_COMMAND.en.d.ts.map +1 -1
  344. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.d.ts.map +1 -1
  345. package/dist/esm/i18n/components/LOW_LEVEL_DIALOG.en.d.ts.map +1 -1
  346. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_BIGDECIMAL.en.d.ts.map +1 -1
  347. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_BOOLEAN.en.d.ts.map +1 -1
  348. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_CODE.en.d.ts.map +1 -1
  349. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_DURATION.en.d.ts.map +1 -1
  350. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_FILE.en.d.ts.map +1 -1
  351. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_FILE_AUDIO.en.d.ts.map +1 -1
  352. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_FILE_DOCUMENT.en.d.ts.map +1 -1
  353. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_FILE_GALLERY.en.d.ts.map +1 -1
  354. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_FILE_IMAGE.en.d.ts.map +1 -1
  355. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_FILE_VIDEO.en.d.ts.map +1 -1
  356. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_MONEY.en.d.ts.map +1 -1
  357. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_PHONE.en.d.ts.map +1 -1
  358. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_RANGE_BIGDECIMAL.en.d.ts.map +1 -1
  359. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_RANGE_MONEY.en.d.ts.map +1 -1
  360. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_RANGE_NUMBER.en.d.ts.map +1 -1
  361. package/dist/esm/i18n/components/LOW_LEVEL_DRAWER.en.d.ts.map +1 -1
  362. package/dist/esm/i18n/components/LOW_LEVEL_ERROR_DISPLAY.en.d.ts.map +1 -1
  363. package/dist/esm/i18n/components/LOW_LEVEL_FEATURE_LOCK_BADGE.en.d.ts.map +1 -1
  364. package/dist/esm/i18n/components/LOW_LEVEL_FEATURE_UNAVAILABLE_PROMPT.en.d.ts.map +1 -1
  365. package/dist/esm/i18n/components/LOW_LEVEL_FILE_UPLOAD.en.d.ts.map +1 -1
  366. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.d.ts.map +1 -1
  367. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_BOOLEAN.en.d.ts.map +1 -1
  368. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_CODE.en.d.ts.map +1 -1
  369. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_FILE.en.d.ts.map +1 -1
  370. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_PHONE.en.d.ts.map +1 -1
  371. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts.map +1 -1
  372. package/dist/esm/i18n/components/LOW_LEVEL_FORM_MESSAGE.en.d.ts.map +1 -1
  373. package/dist/esm/i18n/components/LOW_LEVEL_IMAGE_CROP.en.d.ts.map +1 -1
  374. package/dist/esm/i18n/components/LOW_LEVEL_LOADING_OVERLAY.en.d.ts.map +1 -1
  375. package/dist/esm/i18n/components/LOW_LEVEL_LOADING_SPINNER.en.d.ts.map +1 -1
  376. package/dist/esm/i18n/components/LOW_LEVEL_OPERATIONS_CONFIRM_CRITICAL.en.d.ts.map +1 -1
  377. package/dist/esm/i18n/components/LOW_LEVEL_OVERLAY_CONTAINER.en.d.ts.map +1 -1
  378. package/dist/esm/i18n/components/LOW_LEVEL_PAGINATION.en.d.ts.map +1 -1
  379. package/dist/esm/i18n/components/LOW_LEVEL_SELECT_MULTIPLE.en.d.ts.map +1 -1
  380. package/dist/esm/i18n/components/LOW_LEVEL_SHEET.en.d.ts.map +1 -1
  381. package/dist/esm/i18n/components/LOW_LEVEL_SIDEBAR.en.d.ts.map +1 -1
  382. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_AUTH_CALLBACK.en.d.ts.map +1 -1
  383. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED.en.d.ts.map +1 -1
  384. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT.en.d.ts +39 -0
  385. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT.en.d.ts.map +1 -0
  386. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT.en.js +39 -0
  387. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT.en.js.map +1 -0
  388. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY.en.d.ts.map +1 -1
  389. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.d.ts.map +1 -1
  390. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_OAUTH_CONSENT.en.d.ts.map +1 -1
  391. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT.en.d.ts.map +1 -1
  392. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM.en.d.ts.map +1 -1
  393. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_ONE_OFF_SESSION.en.d.ts.map +1 -1
  394. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.d.ts.map +1 -1
  395. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.d.ts.map +1 -1
  396. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL.en.d.ts.map +1 -1
  397. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_INVITATION.en.d.ts.map +1 -1
  398. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_PASSWORD_LOST.en.d.ts.map +1 -1
  399. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_REGISTER.en.d.ts.map +1 -1
  400. package/dist/esm/i18n/components/RESOURCES_FIELDS_RESOURCE_REFERENCE.en.d.ts.map +1 -1
  401. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_ACTION.en.d.ts.map +1 -1
  402. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_CONTAINER_NESTED.en.d.ts.map +1 -1
  403. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_CREATE.en.d.ts.map +1 -1
  404. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_DANGER_ZONE.en.d.ts.map +1 -1
  405. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.d.ts.map +1 -1
  406. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_HEADER.en.d.ts.map +1 -1
  407. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts.map +1 -1
  408. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_BULK.en.d.ts.map +1 -1
  409. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_ITEMS.en.d.ts.map +1 -1
  410. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_PAGINATION.en.d.ts.map +1 -1
  411. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_READ.en.d.ts.map +1 -1
  412. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_SEARCH.en.d.ts.map +1 -1
  413. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_UPDATE.en.d.ts.map +1 -1
  414. package/dist/esm/i18n/components/guidance_announcement.en.d.ts.map +1 -1
  415. package/dist/esm/i18n/components/guidance_banner.en.d.ts.map +1 -1
  416. package/dist/esm/i18n/components/guidance_card.en.d.ts.map +1 -1
  417. package/dist/esm/i18n/components/guidance_checklist.en.d.ts.map +1 -1
  418. package/dist/esm/i18n/components/guidance_checklist_item.en.d.ts.map +1 -1
  419. package/dist/esm/i18n/components/guidance_modal.en.d.ts.map +1 -1
  420. package/dist/esm/i18n/components/guidance_onboarding_view.en.d.ts.map +1 -1
  421. package/dist/esm/i18n/components/guidance_survey.en.d.ts.map +1 -1
  422. package/dist/esm/i18n/components/guidance_tooltip.en.d.ts.map +1 -1
  423. package/dist/esm/i18n/components/guidance_tour.en.d.ts.map +1 -1
  424. package/dist/esm/i18n/components/progression_achievement_badge.en.d.ts.map +1 -1
  425. package/dist/esm/i18n/components/progression_milestone_tracker.en.d.ts.map +1 -1
  426. package/dist/esm/i18n/composite_views/app.creation-board.en.d.ts.map +1 -1
  427. package/dist/esm/i18n/composite_views/app.domain-model.en.d.ts.map +1 -1
  428. package/dist/esm/i18n/index.d.ts.map +1 -1
  429. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.d.ts.map +1 -1
  430. package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.d.ts.map +1 -1
  431. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.d.ts.map +1 -1
  432. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts.map +1 -1
  433. package/dist/esm/i18n/resources/workbenchDomainResources.en.d.ts.map +1 -1
  434. package/dist/esm/i18n/resources/workbenchPlaybooks.en.d.ts.map +1 -1
  435. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.d.ts.map +1 -1
  436. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
  437. package/dist/esm/i18n/resources/workbenchTraceSessions.en.d.ts.map +1 -1
  438. package/dist/esm/i18n/system_enums/market.en.d.ts.map +1 -1
  439. package/dist/esm/i18n-labelling/models/labelling-unit.models.d.ts +58 -0
  440. package/dist/esm/i18n-labelling/models/labelling-unit.models.d.ts.map +1 -1
  441. package/dist/esm/i18n-labelling/models/labelling-unit.models.js +35 -0
  442. package/dist/esm/i18n-labelling/models/labelling-unit.models.js.map +1 -1
  443. package/dist/esm/i18n-labelling/models/labelling.actors-system.definitions.d.ts.map +1 -1
  444. package/dist/esm/i18n-labelling/models/labelling.actors-system.definitions.js +8 -3
  445. package/dist/esm/i18n-labelling/models/labelling.actors-system.definitions.js.map +1 -1
  446. package/dist/esm/i18n-labelling/services/component-labels-bootstrap.companion.service.d.ts.map +1 -1
  447. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.d.ts +55 -1
  448. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.d.ts.map +1 -1
  449. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js +178 -73
  450. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js.map +1 -1
  451. package/dist/esm/i18n-labelling/services/labelling-spec-context-loader.companion.service.d.ts +3 -3
  452. package/dist/esm/i18n-labelling/services/labelling-spec-context-loader.companion.service.d.ts.map +1 -1
  453. package/dist/esm/i18n-labelling/services/labelling-spec-context-loader.companion.service.js +16 -5
  454. package/dist/esm/i18n-labelling/services/labelling-spec-context-loader.companion.service.js.map +1 -1
  455. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.d.ts +35 -2
  456. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.d.ts.map +1 -1
  457. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.js +68 -29
  458. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.js.map +1 -1
  459. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.d.ts.map +1 -1
  460. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.js +126 -35
  461. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.js.map +1 -1
  462. package/dist/esm/i18n-labelling/utils/frontend-derived-label-keys.utils.d.ts.map +1 -1
  463. package/dist/esm/i18n-labelling/utils/guidance-keys.utils.d.ts.map +1 -1
  464. package/dist/esm/i18n-labelling/utils/label-file-source.utils.d.ts.map +1 -1
  465. package/dist/esm/i18n-labelling/utils/label-placeholder-drift.utils.d.ts +143 -0
  466. package/dist/esm/i18n-labelling/utils/label-placeholder-drift.utils.d.ts.map +1 -0
  467. package/dist/esm/i18n-labelling/utils/label-placeholder-drift.utils.js +179 -0
  468. package/dist/esm/i18n-labelling/utils/label-placeholder-drift.utils.js.map +1 -0
  469. package/dist/esm/i18n-labelling/utils/orphan-label-artifacts.utils.d.ts +154 -0
  470. package/dist/esm/i18n-labelling/utils/orphan-label-artifacts.utils.d.ts.map +1 -0
  471. package/dist/esm/i18n-labelling/utils/orphan-label-artifacts.utils.js +174 -0
  472. package/dist/esm/i18n-labelling/utils/orphan-label-artifacts.utils.js.map +1 -0
  473. package/dist/esm/i18n-labelling/utils/per-unit-file.utils.d.ts.map +1 -1
  474. package/dist/esm/i18n-labelling/utils/role-lifecycle-keys.utils.d.ts.map +1 -1
  475. package/dist/esm/i18n-labelling/utils/schema-fields-extractor.utils.d.ts +104 -0
  476. package/dist/esm/i18n-labelling/utils/schema-fields-extractor.utils.d.ts.map +1 -1
  477. package/dist/esm/i18n-labelling/utils/schema-fields-extractor.utils.js +163 -18
  478. package/dist/esm/i18n-labelling/utils/schema-fields-extractor.utils.js.map +1 -1
  479. package/dist/esm/i18n-labelling/utils/structured-chunk-completion.utils.d.ts.map +1 -1
  480. package/dist/esm/i18n-labelling/utils/translate-locale-contract.utils.d.ts.map +1 -1
  481. package/dist/esm/index.d.ts.map +1 -1
  482. package/dist/esm/market/services/market-generation.companion.service.d.ts.map +1 -1
  483. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts +82 -3
  484. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts.map +1 -1
  485. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js +210 -54
  486. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js.map +1 -1
  487. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts +27 -1
  488. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts.map +1 -1
  489. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js +38 -5
  490. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js.map +1 -1
  491. package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.d.ts +49 -0
  492. package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.d.ts.map +1 -0
  493. package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js +95 -0
  494. package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js.map +1 -0
  495. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.d.ts.map +1 -1
  496. package/dist/esm/meta-workflows/models/meta-workflows.actors-system.definitions.d.ts.map +1 -1
  497. package/dist/esm/meta-workflows/models/meta-workflows.actors-system.definitions.js +9 -4
  498. package/dist/esm/meta-workflows/models/meta-workflows.actors-system.definitions.js.map +1 -1
  499. package/dist/esm/meta-workflows/services/__tests__/application-build-task-coding.companion.test-fixtures.d.ts.map +1 -1
  500. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +25 -6
  501. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  502. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +82 -25
  503. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  504. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +83 -2
  505. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
  506. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +197 -4
  507. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
  508. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
  509. package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.d.ts.map +1 -1
  510. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts.map +1 -1
  511. package/dist/esm/meta-workflows/services/playbook-choreography-checkpoint.companion.service.d.ts.map +1 -1
  512. package/dist/esm/meta-workflows/services/playbook-execution-trace.companion.service.d.ts.map +1 -1
  513. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts.map +1 -1
  514. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +44 -3
  515. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
  516. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +346 -42
  517. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  518. package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.d.ts.map +1 -1
  519. package/dist/esm/technical-doc/services/technical-doc.companion.service.d.ts +117 -2
  520. package/dist/esm/technical-doc/services/technical-doc.companion.service.d.ts.map +1 -1
  521. package/dist/esm/technical-doc/services/technical-doc.companion.service.js +260 -69
  522. package/dist/esm/technical-doc/services/technical-doc.companion.service.js.map +1 -1
  523. package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.d.ts +7 -1
  524. package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.d.ts.map +1 -1
  525. package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js +179 -10
  526. package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js.map +1 -1
  527. package/dist/esm/technical-doc/services/technical-documentation-environment-identity.companion.service.d.ts.map +1 -1
  528. package/dist/esm/technical-doc/services/technical-documentation-pilot-assets.companion.service.d.ts.map +1 -1
  529. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.d.ts +2 -1
  530. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.d.ts.map +1 -1
  531. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.js +10 -2
  532. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.js.map +1 -1
  533. package/package.json +17 -17
  534. package/dist/esm/core/runtime/companion-startup-composition-fence.d.ts +0 -44
  535. package/dist/esm/core/runtime/companion-startup-composition-fence.d.ts.map +0 -1
  536. package/dist/esm/core/runtime/companion-startup-composition-fence.js +0 -85
  537. package/dist/esm/core/runtime/companion-startup-composition-fence.js.map +0 -1
  538. package/dist/esm/expert-personas/utils/canonical-json.d.ts +0 -25
  539. package/dist/esm/expert-personas/utils/canonical-json.d.ts.map +0 -1
  540. package/dist/esm/expert-personas/utils/canonical-json.js +0 -45
  541. package/dist/esm/expert-personas/utils/canonical-json.js.map +0 -1
  542. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW.en.d.ts +0 -19
  543. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW.en.d.ts.map +0 -1
  544. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW.en.js +0 -19
  545. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW.en.js.map +0 -1
  546. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PROMOTION_CODE_INPUT.en.d.ts +0 -17
  547. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PROMOTION_CODE_INPUT.en.d.ts.map +0 -1
  548. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PROMOTION_CODE_INPUT.en.js +0 -17
  549. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PROMOTION_CODE_INPUT.en.js.map +0 -1
@@ -26,6 +26,8 @@ import { CompanionTraceabilityLevel, } from '../../core/traceability/companion-t
26
26
  import { resolvePerUnitFilePath, readPerUnitLabels, writePerUnitLabels, } from '../utils/per-unit-file.utils.js';
27
27
  import { I18nUnitRunStatus } from '../models/labelling-unit.models.js';
28
28
  import { completeStructuredChunkKeys } from '../utils/structured-chunk-completion.utils.js';
29
+ import { detectDeclaredPlaceholderDrift } from '../utils/label-placeholder-drift.utils.js';
30
+ import { collectGeneratedLabelFiles, computeOrphanLabelArtifacts, describeOrphanLabelArtifacts, OrphanLabelArtifactsOutcome, } from '../utils/orphan-label-artifacts.utils.js';
29
31
  /**
30
32
  * Version tag for the labellize prompt's STYLE + AUDIENCE contract. Folded into
31
33
  * every unit's input fingerprint so a change to the style/audience rules — which
@@ -103,7 +105,8 @@ let LabellizeOrchestratorCompanionService = class LabellizeOrchestratorCompanion
103
105
  const primaryLocale = getCompanionConfiguredPrimaryLanguage(this.appConfigService.config);
104
106
  const localeDisplayName = LANGUAGE_INFO_MAP[primaryLocale]?.name ?? primaryLocale;
105
107
  const i18nRoot = this.resolveI18nRoot();
106
- const allUnits = await this.planner.planAllUnits();
108
+ const plan = await this.planner.planAllUnitsWithCompleteness();
109
+ const allUnits = plan.units;
107
110
  const filter = options.unitIdFilter ? new Set(options.unitIdFilter) : null;
108
111
  const units = filter ? allUnits.filter((u) => filter.has(u.id)) : allUnits;
109
112
  // Trace under the CALLER's session when provided — the controller threads
@@ -162,12 +165,30 @@ let LabellizeOrchestratorCompanionService = class LabellizeOrchestratorCompanion
162
165
  this.logger.error('Labellize unit failed', { unitId: unit.id, error: message });
163
166
  }
164
167
  }
168
+ // Stale-unit detection runs AFTER the loop and against `allUnits` — the
169
+ // UNFILTERED plan — so a partial (`unitIdFilter`) run never reads the units
170
+ // it was asked to skip as units that no longer exist. It is read-only: it
171
+ // walks the i18n root, compares `(bucket, slug)` against the plan, and
172
+ // reports. See `computeOrphanLabelArtifacts` for why it does not unlink.
173
+ const orphans = await this.collectOrphanReport({ i18nRoot, allUnits, plan });
174
+ const orphanSummary = describeOrphanLabelArtifacts(orphans);
175
+ if (orphans.outcome === OrphanLabelArtifactsOutcome.REPORTED
176
+ && orphans.orphanFiles.length + orphans.orphanLockUnitIds.length > 0) {
177
+ this.logger.warn(orphanSummary, {
178
+ orphanFiles: orphans.orphanFiles,
179
+ orphanLockUnitIds: orphans.orphanLockUnitIds,
180
+ i18nRoot,
181
+ });
182
+ }
183
+ else {
184
+ this.logDebug(orphanSummary, { outcome: orphans.outcome });
185
+ }
165
186
  await this.traceability.traceEvent({
166
187
  session: traceSession,
167
188
  minimumLevel: CompanionTraceabilityLevel.DEBUG,
168
189
  type: 'labellize-run-complete',
169
- summary: `Labellized ${units.length} unit(s): ${updated} updated, ${fresh} fresh, ${failed} failed`,
170
- payload: { primaryLocale, totalUnits: units.length, updated, fresh, failed },
190
+ summary: `Labellized ${units.length} unit(s): ${updated} updated, ${fresh} fresh, ${failed} failed. ${orphanSummary}`,
191
+ payload: { primaryLocale, totalUnits: units.length, updated, fresh, failed, orphans },
171
192
  });
172
193
  if (traceSession.traceabilityLevel !== CompanionTraceabilityLevel.NONE) {
173
194
  this.logger.info('Labellize trace session written', {
@@ -182,8 +203,44 @@ let LabellizeOrchestratorCompanionService = class LabellizeOrchestratorCompanion
182
203
  fresh,
183
204
  failed,
184
205
  details,
206
+ orphans,
185
207
  };
186
208
  }
209
+ /**
210
+ * Scan the i18n root and judge what belongs to no planned unit.
211
+ *
212
+ * Failure-tolerant on purpose. This is a DIAGNOSTIC bolted onto a generation
213
+ * run: an unreadable directory or an unreadable lock must degrade to "could
214
+ * not judge" and never fail a run whose labels were generated correctly. It
215
+ * degrades to the same suppressed outcome a partial plan produces, carrying
216
+ * the read failure as the reason, so a consumer cannot read the empty file
217
+ * list off a failed scan as "nothing is stale".
218
+ */
219
+ async collectOrphanReport(args) {
220
+ const { i18nRoot, allUnits, plan } = args;
221
+ try {
222
+ const existingFiles = await collectGeneratedLabelFiles(i18nRoot);
223
+ const section = await this.lockService.readI18nSection();
224
+ return computeOrphanLabelArtifacts({
225
+ plannedUnits: allUnits,
226
+ lockUnitIds: Object.keys(section?.units ?? {}),
227
+ existingFiles,
228
+ incompleteness: plan.incompleteness,
229
+ });
230
+ }
231
+ catch (err) {
232
+ const message = describeCaughtError(err);
233
+ this.logger.warn(`Stale-unit detection could not read the i18n state: ${message}`, { i18nRoot });
234
+ return {
235
+ outcome: OrphanLabelArtifactsOutcome.UNAVAILABLE_SCAN_FAILED,
236
+ incompleteness: plan.incompleteness,
237
+ orphanFiles: [],
238
+ orphanLockUnitIds: [],
239
+ scannedFileCount: 0,
240
+ scanFailure: message,
241
+ };
242
+ }
243
+ }
187
244
  async labellizeUnit(args) {
188
245
  const { unit, filePath, primaryLocale, localeDisplayName, forceRegenerate, traceSession } = args;
189
246
  const specContext = await unit.loadSpecContext();
@@ -499,33 +556,15 @@ let LabellizeOrchestratorCompanionService = class LabellizeOrchestratorCompanion
499
556
  * a key with no declared params is held to "must contain no placeholder", so
500
557
  * a plain-string label that drifts to `{value}` is caught too. Chunks from
501
558
  * buckets that don't thread declared params (no `keyParams`) are skipped.
502
- * Mirrors `interpolateLabelParams`' `\{(\w+)\}` token grammar so the check
503
- * matches exactly what the runtime will interpolate.
559
+ *
560
+ * The comparison itself lives in `label-placeholder-drift.utils` because the
561
+ * TRANSLATE orchestrator enforces the same invariant against a different
562
+ * expected set (the source string's tokens rather than declared params), and
563
+ * two hand-written copies of "the placeholders match" would eventually
564
+ * disagree — see that module's header.
504
565
  */
505
566
  detectPlaceholderDrift(chunk, generated) {
506
- const keyParams = chunk.keyParams;
507
- if (!keyParams)
508
- return [];
509
- const placeholderRegex = /\{(\w+)\}/g;
510
- const drifts = [];
511
- for (const key of chunk.keys) {
512
- const value = generated[key];
513
- if (typeof value !== 'string')
514
- continue;
515
- const declared = keyParams[key] ?? [];
516
- const declaredSet = new Set(declared);
517
- const emitted = new Set();
518
- placeholderRegex.lastIndex = 0;
519
- let m;
520
- while ((m = placeholderRegex.exec(value)) !== null)
521
- emitted.add(m[1]);
522
- const unexpected = [...emitted].filter((p) => !declaredSet.has(p));
523
- const missing = declared.filter((p) => !emitted.has(p));
524
- if (unexpected.length === 0 && missing.length === 0)
525
- continue;
526
- drifts.push({ key, declared: [...declared], emitted: [...emitted], unexpected, missing, value });
527
- }
528
- return drifts;
567
+ return detectDeclaredPlaceholderDrift({ keys: chunk.keys, keyParams: chunk.keyParams, generated });
529
568
  }
530
569
  async computeFileShaIfExists(filePath) {
531
570
  try {
@@ -617,7 +656,7 @@ let LabellizeOrchestratorCompanionService = class LabellizeOrchestratorCompanion
617
656
  if (priorDrift && priorDrift.length > 0) {
618
657
  lines.push('', '# Correction — your previous attempt used the wrong placeholders. Fix EXACTLY these keys:');
619
658
  for (const d of priorDrift) {
620
- const expected = d.declared.length ? d.declared.map((p) => `{${p}}`).join(' ') : 'no placeholders at all';
659
+ const expected = d.expected.length ? d.expected.map((p) => `{${p}}`).join(' ') : 'no placeholders at all';
621
660
  const fixes = [`use ${expected}`];
622
661
  if (d.unexpected.length)
623
662
  fixes.push(`remove ${d.unexpected.map((p) => `{${p}}`).join(' ')}`);
@@ -1 +1 @@
1
- {"version":3,"file":"labellize-orchestrator.companion.service.js","sourceRoot":"","sources":["../../../../../src/i18n-labelling/services/labellize-orchestrator.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EACL,kBAAkB,EAKlB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGL,mCAAmC,EACnC,+BAA+B,GAChC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,2BAA2B,EAC3B,SAAS,GAGV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAqB,aAAa,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC1G,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAAO,EAAE,gCAAgC,EAAE,M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pD,WAAA,MAAM,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,CAAA;qFAF+B,gCAAgC;QAC/B,6BAA6B;QAC7B,4BAA4B;GAZvG,qCAAqC,CAuuBjD","sourcesContent":["import * as fs from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { inject, injectable } from 'inversify';\nimport { z } from 'zod';\nimport {\n SAAS_SERVICE_TYPES,\n type AgentsBackendService,\n type AppConfigurationService,\n type LoggerService,\n type ErrorBuilderBackendService,\n describeCaughtError,\n} from '@wildo-ai/saas-backend-lib';\nimport {\n LLMProvider_GenerateStructuredInputSchema,\n LLMProvider_GenerateStructuredOutputSchema,\n describeStructuredGenerationFailure,\n readStructuredGenerationFailure,\n} from '@wildo-ai/external-connectors-models';\nimport {\n ErrorCustomMessageReference,\n ErrorType,\n type AgentTraceContext,\n type FlowsActors_Agent_Invocation,\n} from '@wildo-ai/saas-models';\nimport { AvailableLanguage, LabelAudience, LANGUAGE_INFO_MAP } from '@wildo-ai/presets-components-models';\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { LabellingPlannerCompanionService } from './labelling-planner.companion.service';\nimport { getCompanionConfiguredPrimaryLanguage } from '../../core/config/primary-language.companion.utils';\nimport { WildoSaasLockCompanionService } from '../../core/lock/wildo-saas-lock.companion.service';\nimport type { I18nLockUnitEntry } from '../../core/lock/wildo-saas-lock.models';\nimport { CompanionTraceabilityService } from '../../core/traceability/companion-traceability.service';\nimport {\n CompanionTraceabilityLevel,\n type CompanionExecutionSessionContext,\n type CompanionTraceStepContext,\n} from '../../core/traceability/companion-traceability.models';\nimport {\n resolvePerUnitFilePath,\n readPerUnitLabels,\n writePerUnitLabels,\n} from '../utils/per-unit-file.utils';\nimport { I18nUnitRunStatus, type LabellingUnit, type LabellingUnitChunk, type LabellingUnitSpecContext } from '../models/labelling-unit.models';\nimport { completeStructuredChunkKeys } from '../utils/structured-chunk-completion.utils';\n\nexport interface LabellizeOptions {\n /** Force re-generation even if the lock says the unit is fresh. */\n forceRegenerate?: boolean;\n /** Limit work to a subset of unit ids (for partial runs). */\n unitIdFilter?: string[];\n}\n\nexport interface LabellizeUnitResult {\n unitId: string;\n filePath: string;\n status: Exclude<I18nUnitRunStatus, I18nUnitRunStatus.SKIPPED>;\n error?: string;\n}\n\nexport interface LabellizeRunResult {\n primaryLocale: string;\n totalUnits: number;\n updated: number;\n fresh: number;\n failed: number;\n details: LabellizeUnitResult[];\n}\n\n/**\n * One label whose generated placeholders don't match its declared params.\n * `unexpected` = emitted but not declared (renders literally to the user);\n * `missing` = declared but never emitted (the runtime value silently won't show).\n */\ninterface PlaceholderDrift {\n key: string;\n declared: string[];\n emitted: string[];\n unexpected: string[];\n missing: string[];\n value: string;\n}\n\n/**\n * Version tag for the labellize prompt's STYLE + AUDIENCE contract. Folded into\n * every unit's input fingerprint so a change to the style/audience rules — which\n * touches no per-unit input — still invalidates the lock and re-labellizes on the\n * next non-forced run. Bump this whenever the `# Style` / `# Audience` block\n * changes. (Was the \"style edits need --force\" mechanism gap.)\n */\nconst LABELLIZE_PROMPT_STYLE_VERSION = '2026-06-18.audience-axis' as const;\n\n/**\n * Map a declared {@link LabelAudience} to the one-line reader/register\n * instruction rendered into the labellize prompt's `# Audience` block — the\n * single lever that shifts generated copy between product voice, operator\n * console voice, and developer/integrator voice.\n *\n * Boundary-tolerant by design: it accepts the raw `string | undefined` the\n * companion reads off a *built* resource spec (the value crosses the spec\n * boundary as a plain enum-valued string, never as the enum type itself). An\n * absent or unrecognized value resolves to END USER — the default register the\n * `# Style` rules already assume — so un-authored resources are unchanged.\n *\n * The `case` labels are {@link LabelAudience} enum members rather than string\n * literals: if the enum's underlying values are ever changed, a stale literal\n * would silently fall through to the end-user default and quietly kill the\n * admin/developer registers. Keying on the enum makes that class of drift a\n * compile-time concern instead of an invisible copy regression.\n */\nexport function describeLabelAudienceRegister(audience: string | undefined): string {\n switch (audience) {\n case LabelAudience.ADMIN:\n return 'ADMIN / operator (a back-office console). Voice: precise, operational, neutral — NOT casual consumer copy, yet still jargon-free for a non-developer (no \"DTO\"/\"entity\"/\"tenant\"). e.g. \"Suspend user\", \"Audit log\", \"Access status\".';\n case LabelAudience.DEVELOPER:\n return 'DEVELOPER / integrator. Voice: technical and precise — domain-technical terms are EXPECTED and correct here (token, endpoint, scope, webhook, API key, payload). Do not dumb them down into consumer copy.';\n case LabelAudience.END_USER:\n default:\n return 'a non-technical END USER. Voice: plain, friendly, conventional product copy — the default register.';\n }\n}\n\n/**\n * Orchestrator that drives primary-language label generation\n * unit-by-unit using the planner + spec loader + lock file.\n *\n * for each unit:\n * fingerprint = sha(sorted_keys + sorted_spec_hints)\n * if lock.unit.inputSha === fingerprint && !force:\n * status = fresh, skip agent call\n * else:\n * for each chunk:\n * send (keys, spec context, chunk schema) to agent\n * merge translated strings into per-unit file\n * write per-unit file\n * update lock entry (inputSha, primarySha, lastLabellizedAt)\n */\n@injectable()\nexport class LabellizeOrchestratorCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) private readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.AgentsBackendService) private readonly agentsService: AgentsBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService)\n private readonly appConfigService: AppConfigurationService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.LabellingPlannerService) private readonly planner: LabellingPlannerCompanionService,\n @inject(COMPANION_SERVICE_TYPES.WildoSaasLockService) private readonly lockService: WildoSaasLockCompanionService,\n @inject(COMPANION_SERVICE_TYPES.TraceabilityService) private readonly traceability: CompanionTraceabilityService,\n ) {\n this.logDebug = this.logger.debugByType('LabellizeOrchestrator');\n }\n\n public async labellize(\n options: LabellizeOptions = {},\n providedSession?: CompanionExecutionSessionContext,\n ): Promise<LabellizeRunResult> {\n const primaryLocale = getCompanionConfiguredPrimaryLanguage(this.appConfigService.config);\n const localeDisplayName = LANGUAGE_INFO_MAP[primaryLocale]?.name ?? primaryLocale;\n const i18nRoot = this.resolveI18nRoot();\n\n const allUnits = await this.planner.planAllUnits();\n const filter = options.unitIdFilter ? new Set(options.unitIdFilter) : null;\n const units = filter ? allUnits.filter((u) => filter.has(u.id)) : allUnits;\n\n // Trace under the CALLER's session when provided — the controller threads\n // its per-request `POST /labelling/labellize` session, so the unit steps\n // land in the session the user actually inspects (not a disconnected one).\n // Fall back to a self-owned `internal` session for direct/CLI/test callers.\n // At the default NONE level every trace call below is a gated no-op (output\n // byte-identical); set `WILDO_DEV_COMPANION_TRACEABILITY_LEVEL=DEBUG_VERBOSE`\n // and restart the companion to capture, per unit, the resolved spec context\n // + the exact prompt + the LLM response + token usage per label.\n const traceSession = providedSession ?? this.traceability.createInternalSession({\n label: 'labellize-run',\n metadata: {\n run: 'labellize',\n primaryLocale,\n forceRegenerate: options.forceRegenerate === true,\n unitIdFilter: options.unitIdFilter ?? null,\n totalUnits: units.length,\n },\n });\n\n const details: LabellizeUnitResult[] = [];\n let updated = 0;\n let fresh = 0;\n let failed = 0;\n\n for (const unit of units) {\n try {\n const filePath = resolvePerUnitFilePath({ i18nRoot, unit, localeCode: primaryLocale });\n const result = await this.labellizeUnit({\n unit,\n filePath,\n primaryLocale,\n localeDisplayName,\n forceRegenerate: options.forceRegenerate === true,\n traceSession,\n });\n details.push(result);\n if (result.status === I18nUnitRunStatus.FRESH) fresh++;\n else if (result.status === I18nUnitRunStatus.UPDATED) updated++;\n else failed++;\n } catch (err: unknown) {\n failed++;\n // `describeCaughtError`, NOT the inline `instanceof Error` ternary.\n // What this catch receives is the VALIDATION error built ~290 lines below\n // (\"Invalid structured output for unit … chunk …\"), and a WildoError_Backend\n // is a PLAIN OBJECT, not an `Error` — so the inline ternary took the\n // `String(...)` branch and every distinct labelling failure was reported to\n // the operator, identically, as the literal `[object Object]`. The real\n // reason was only ever visible by grepping the companion's own log for the\n // preceding `GENERATE_STRUCTURED` line.\n const message = describeCaughtError(err);\n details.push({ unitId: unit.id, filePath: '', status: I18nUnitRunStatus.FAILED, error: message });\n this.logger.error('Labellize unit failed', { unitId: unit.id, error: message });\n }\n }\n\n await this.traceability.traceEvent({\n session: traceSession,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: 'labellize-run-complete',\n summary: `Labellized ${units.length} unit(s): ${updated} updated, ${fresh} fresh, ${failed} failed`,\n payload: { primaryLocale, totalUnits: units.length, updated, fresh, failed },\n });\n if (traceSession.traceabilityLevel !== CompanionTraceabilityLevel.NONE) {\n this.logger.info('Labellize trace session written', {\n sessionId: traceSession.sessionId,\n sessionDir: traceSession.sessionDirPath,\n });\n }\n\n return {\n primaryLocale,\n totalUnits: units.length,\n updated,\n fresh,\n failed,\n details,\n };\n }\n\n private async labellizeUnit(args: {\n unit: LabellingUnit;\n filePath: string;\n primaryLocale: string;\n localeDisplayName: string;\n forceRegenerate: boolean;\n traceSession: CompanionExecutionSessionContext;\n }): Promise<LabellizeUnitResult> {\n const { unit, filePath, primaryLocale, localeDisplayName, forceRegenerate, traceSession } = args;\n\n const specContext = await unit.loadSpecContext();\n const allKeys = unit.chunks.flatMap((c) => c.keys);\n const inputFingerprint = this.computeInputFingerprint(unit, specContext, allKeys);\n\n // One trace step per unit; the spec context + every chunk prompt/response\n // land under it (in-memory until the first gated write materializes it).\n const step = this.traceability.createStep(traceSession, { kind: 'labellize-unit', label: unit.id });\n\n const section = await this.lockService.readI18nSection();\n const existing = section?.units[unit.id];\n\n if (!forceRegenerate && existing?.inputSha === inputFingerprint && existing?.primarySha) {\n // Verify the on-disk file still matches the recorded `primarySha`\n // before trusting the lock. A developer who hand-edits or deletes\n // the per-unit file out-of-band must NOT be silently skipped.\n const onDiskSha = await this.computeFileShaIfExists(filePath);\n if (onDiskSha === existing.primarySha) {\n this.logDebug('Unit fresh — skipping agent call', { unitId: unit.id });\n await this.traceability.traceEvent({\n session: traceSession,\n step,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: 'labellize-unit-fresh',\n summary: `Unit ${unit.id} fresh — no LLM call`,\n payload: { unitId: unit.id, keyCount: allKeys.length },\n });\n return { unitId: unit.id, filePath, status: I18nUnitRunStatus.FRESH };\n }\n this.logDebug('Unit lock says fresh but on-disk content drifted — re-labellizing', {\n unitId: unit.id,\n recordedPrimarySha: existing.primarySha,\n onDiskSha: onDiskSha ?? '<missing>',\n });\n }\n\n // The inspectable answer to \"what specification did this unit actually\n // receive?\" — written ONLY for units about to be sent to the LLM (fresh\n // units sent nothing). `hasSpecContext: false` is the signal that a unit\n // family ships keys-only today (the spec-enrichment follow-up's worklist).\n const declaredKeyParams: Record<string, readonly string[]> = {};\n for (const chunk of unit.chunks) {\n if (!chunk.keyParams) continue;\n for (const [k, p] of Object.entries(chunk.keyParams)) declaredKeyParams[k] = p;\n }\n await this.traceability.writeArtifact({\n session: traceSession,\n step,\n minimumLevel: CompanionTraceabilityLevel.DEBUG_VERBOSE,\n fileName: 'spec-context.json',\n content: {\n unitId: unit.id,\n category: unit.category,\n displayLabel: unit.displayLabel,\n hasSpecContext: specContext !== undefined,\n description: specContext?.description ?? null,\n hints: specContext?.hints ?? null,\n origin: specContext?.origin ?? null,\n declaredKeyParams,\n keyCount: allKeys.length,\n chunkCount: unit.chunks.length,\n },\n });\n\n const existingFlat = await readPerUnitLabels(filePath);\n\n const newFlat: Record<string, string> = { ...existingFlat };\n for (const chunk of unit.chunks) {\n const chunkResult = await this.labellizeChunk({\n unit,\n chunk,\n specContext,\n existingFlat: newFlat,\n traceSession,\n step,\n });\n Object.assign(newFlat, chunkResult);\n }\n\n // Drop any stale keys (present in file but no longer planned).\n const plannedSet = new Set(allKeys);\n for (const k of Object.keys(newFlat)) {\n if (!plannedSet.has(k)) delete newFlat[k];\n }\n\n const writtenContent = await writePerUnitLabels({\n filePath,\n localeCode: primaryLocale,\n localeDisplayName,\n isPrimaryLocale: true,\n flatEntries: newFlat,\n });\n\n const primarySha = this.lockService.hashString(writtenContent);\n const entry: I18nLockUnitEntry = {\n category: unit.category,\n displayLabel: unit.displayLabel,\n inputSha: inputFingerprint,\n primarySha,\n lastLabellizedAt: new Date().toISOString(),\n locales: existing?.locales ?? {},\n };\n\n // Mark every locale stale (their content needs re-translation).\n for (const localeCode of Object.keys(entry.locales)) {\n const prev = entry.locales[localeCode];\n entry.locales[localeCode] = {\n ...prev,\n status: 'stale',\n };\n }\n\n await this.lockService.upsertI18nUnit(unit.id, entry, primaryLocale, section?.trackedLocales ?? []);\n\n await this.traceability.traceEvent({\n session: traceSession,\n step,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: 'labellize-unit-complete',\n summary: `Unit ${unit.id} labellized (${allKeys.length} key(s), ${unit.chunks.length} chunk(s))`,\n payload: { unitId: unit.id, keyCount: allKeys.length, chunkCount: unit.chunks.length },\n });\n\n return { unitId: unit.id, filePath, status: I18nUnitRunStatus.UPDATED };\n }\n\n private async labellizeChunk(args: {\n unit: LabellingUnit;\n chunk: LabellingUnitChunk;\n specContext: LabellingUnitSpecContext | undefined;\n existingFlat: Record<string, string>;\n traceSession: CompanionExecutionSessionContext;\n step: CompanionTraceStepContext;\n }): Promise<Record<string, string>> {\n const { unit, chunk, specContext, traceSession, step } = args;\n\n const MAX_ATTEMPTS = 2;\n let result: Record<string, string> = {};\n let drift: PlaceholderDrift[] = [];\n\n // Generate → validate placeholders → retry-with-correction on drift. The\n // strong per-key seeding in the prompt makes drift rare; the retry self-\n // heals the occasional miss without dropping the whole unit. Both wrong-name\n // and missing placeholders are corrected this way.\n for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {\n const prompt = this.buildLabellizePrompt({\n unit,\n chunk,\n specContext,\n priorDrift: attempt > 1 ? drift : undefined,\n });\n // Correlate this chunk attempt so the engine AgentCallTraceSink writes the\n // prompt + output (+usage/latency) into THIS unit's step, keyed by\n // chunk+attempt (the attempt rides in the label). The caller keeps only its\n // DOMAIN signal — the assembled labels + placeholder drift the engine sink\n // can't produce.\n const traceContext: AgentTraceContext | undefined = traceSession && step\n ? {\n sessionRef: traceSession.sessionId,\n stepRef: step.stepId,\n label: `labellize.chunk-${chunk.chunkId}.attempt-${attempt}`,\n attributes: { unitId: unit.id, chunkId: chunk.chunkId, attempt, keyCount: chunk.keys.length },\n }\n : undefined;\n // Ask for the chunk, then re-ask for whatever the model omitted. A\n // non-strict provider can drop leaves from a large flat object without\n // any error signal, and the response schema now TOLERATES that (see\n // `LabellingUnitChunk.buildOutputSchema`) — so the gap has to be repaired\n // here rather than discarded with the whole unit.\n const completion = await completeStructuredChunkKeys({\n keys: chunk.keys,\n invoke: async ({ requestedKeys, omittedByPreviousPass, pass }) => {\n const passPrompt = pass === 1\n ? prompt\n : this.buildLabellizePrompt({ unit, chunk, specContext, requestedKeys, omittedKeys: omittedByPreviousPass });\n const passTraceContext: AgentTraceContext | undefined = traceContext\n ? {\n ...traceContext,\n label: `${traceContext.label}${pass === 1 ? '' : `.repair-${pass - 1}`}`,\n attributes: { ...traceContext.attributes, keyCount: requestedKeys.length, pass },\n }\n : undefined;\n const { parsed } = await this.invokeChunkAgent({\n unit,\n chunk,\n requestedKeys,\n prompt: passPrompt,\n traceContext: passTraceContext,\n });\n return parsed;\n },\n });\n\n if (completion.missingKeys.length > 0) {\n // The repair budget is spent and these keys never arrived. They are about\n // to fall back to the prior value or — with no prior file — to the raw\n // dotted key, which renders as garbage in the UI. Name them: this is the\n // only signal that distinguishes \"generated\" from \"gave up\".\n this.logger.error('Label keys still missing after repair passes — falling back', {\n unitId: unit.id,\n chunkId: chunk.chunkId,\n attempt,\n passes: completion.passes,\n missingKeys: completion.missingKeys,\n });\n } else if (completion.passes > 1) {\n this.logger.warn('Structured label response omitted keys — recovered by follow-up call(s)', {\n unitId: unit.id,\n chunkId: chunk.chunkId,\n attempt,\n passes: completion.passes,\n keyCount: chunk.keys.length,\n });\n }\n\n result = this.assembleChunkResult(chunk, completion.values, args.existingFlat);\n drift = this.detectPlaceholderDrift(chunk, result);\n\n // Caller-owned domain artifact: the ASSEMBLED labels + placeholder drift for\n // THIS attempt (the engine sink owns the raw prompt/output/usage record).\n await this.traceability.writeArtifact({\n session: traceSession,\n step,\n minimumLevel: CompanionTraceabilityLevel.DEBUG_VERBOSE,\n fileName: `chunk-${chunk.chunkId}.attempt-${attempt}.labels.json`,\n content: { object: result, drift },\n });\n await this.traceability.traceEvent({\n session: traceSession,\n step,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: 'labellize-chunk',\n summary: `Chunk ${chunk.chunkId} attempt ${attempt}: ${chunk.keys.length} key(s), ${drift.length} drift`,\n payload: {\n chunkId: chunk.chunkId,\n attempt,\n keyCount: chunk.keys.length,\n driftKeys: drift.map((d) => d.key),\n },\n });\n\n if (drift.length === 0) return result;\n this.logDebug('Placeholder drift detected — retrying chunk with correction', {\n unitId: unit.id,\n chunkId: chunk.chunkId,\n attempt,\n offenders: drift.map((d) => d.key),\n });\n }\n\n // Retries exhausted. Surface loudly with full detail. The best-effort\n // result is still returned (and written) so the drift is visible in BOTH\n // the log and the on-disk file — a loud, debuggable signal beats silently\n // dropping the whole unit or hiding the mismatch.\n this.logger.warn('Label placeholder drift persisted after retries', {\n unitId: unit.id,\n chunkId: chunk.chunkId,\n drift,\n });\n return result;\n }\n\n /**\n * Invoke the labelling agent for one chunk and return the parsed flat object.\n * The optional `traceContext` is threaded into `invokeAgent` so the engine\n * AgentCallTraceSink owns this call's prompt/output/usage/latency record — the\n * caller no longer reads `executionContext`. Throws if the structured output\n * is missing/malformed.\n */\n private async invokeChunkAgent(args: {\n unit: LabellingUnit;\n chunk: LabellingUnitChunk;\n /** The keys THIS physical call must return — the whole chunk, or the outstanding subset on a repair pass. */\n requestedKeys: readonly string[];\n prompt: string;\n traceContext?: AgentTraceContext;\n }): Promise<{ parsed: Record<string, unknown> }> {\n const { unit, chunk, requestedKeys, prompt, traceContext } = args;\n const schema = chunk.buildOutputSchema(requestedKeys);\n\n const invocation: FlowsActors_Agent_Invocation<\n typeof LLMProvider_GenerateStructuredInputSchema,\n typeof LLMProvider_GenerateStructuredOutputSchema,\n z.ZodSchema<Record<string, string | undefined>>\n > = {\n agentRef: 'labelling.translation.agent',\n initiator: {},\n invocationContext: [],\n input: { prompt, schema },\n output: { object: {} },\n executionContext: {},\n artifactBindings: [],\n };\n\n this.logDebug('Labellize chunk', {\n unitId: unit.id,\n chunkId: chunk.chunkId,\n keyCount: requestedKeys.length,\n });\n\n const response = await this.agentsService.invokeAgent(invocation, traceContext);\n const parsed = (response.output as { object?: Record<string, unknown> })?.object;\n if (!parsed || typeof parsed !== 'object') {\n // The engine now says WHY there is no object; carry it into the message an operator\n // actually sees. Without this the reason existed only in the companion's own log\n // (the preceding `GENERATE_STRUCTURED` line), so the CLI summary — the surface a\n // human reads — reported a bare \"invalid output\" for a truncated completion, a\n // refusal, and a schema the model half-filled, alike. `validationIssues` names the\n // exact paths that failed and is the single most useful half.\n const failure = readStructuredGenerationFailure(response.executionContext);\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_RESOURCE_VALIDATION_FAILED,\n context: {\n message: `Invalid structured output for unit ${unit.id} chunk ${chunk.chunkId}`\n + (failure ? ` — ${describeStructuredGenerationFailure(failure)}` : ''),\n ...(failure ? { structuredGenerationFailure: failure } : {}),\n },\n });\n }\n return { parsed };\n }\n\n /**\n * Assemble the chunk's flat result from the agent response, falling back to\n * the existing primary value (preserving prior good content) and finally the\n * raw key — so a partial agent response never silently destroys good labels.\n */\n private assembleChunkResult(\n chunk: LabellingUnitChunk,\n parsed: Record<string, unknown>,\n existingFlat: Record<string, string>,\n ): Record<string, string> {\n const result: Record<string, string> = {};\n for (const key of chunk.keys) {\n const value = parsed[key];\n if (typeof value === 'string' && value.length > 0) {\n result[key] = value;\n continue;\n }\n const fallback = existingFlat[key];\n result[key] = typeof fallback === 'string' && fallback.length > 0 ? fallback : key;\n }\n return result;\n }\n\n /**\n * Compare each generated label's emitted single-brace placeholders against\n * the key's DECLARED interpolation params. The runtime only substitutes\n * `{name}` when `name` is a passed param (see `interpolateLabelParams`), so:\n * - an emitted token outside the declared set renders literally (the\n * `{value}` / wrong-name drift), and\n * - a declared param that never appears means the value silently won't show\n * (the missing-placeholder drift).\n *\n * Runs over EVERY key in a param-validated chunk (`chunk.keyParams` present):\n * a key with no declared params is held to \"must contain no placeholder\", so\n * a plain-string label that drifts to `{value}` is caught too. Chunks from\n * buckets that don't thread declared params (no `keyParams`) are skipped.\n * Mirrors `interpolateLabelParams`' `\\{(\\w+)\\}` token grammar so the check\n * matches exactly what the runtime will interpolate.\n */\n private detectPlaceholderDrift(\n chunk: LabellingUnitChunk,\n generated: Record<string, string>,\n ): PlaceholderDrift[] {\n const keyParams = chunk.keyParams;\n if (!keyParams) return [];\n\n const placeholderRegex = /\\{(\\w+)\\}/g;\n const drifts: PlaceholderDrift[] = [];\n for (const key of chunk.keys) {\n const value = generated[key];\n if (typeof value !== 'string') continue;\n\n const declared = keyParams[key] ?? [];\n const declaredSet = new Set(declared);\n const emitted = new Set<string>();\n placeholderRegex.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = placeholderRegex.exec(value)) !== null) emitted.add(m[1]!);\n\n const unexpected = [...emitted].filter((p) => !declaredSet.has(p));\n const missing = declared.filter((p) => !emitted.has(p));\n if (unexpected.length === 0 && missing.length === 0) continue;\n drifts.push({ key, declared: [...declared], emitted: [...emitted], unexpected, missing, value });\n }\n return drifts;\n }\n\n private async computeFileShaIfExists(filePath: string): Promise<string | undefined> {\n try {\n const content = await fs.readFile(filePath, 'utf-8');\n return this.lockService.hashString(content);\n } catch (err: unknown) {\n if ((err as NodeJS.ErrnoException)?.code === 'ENOENT') return undefined;\n throw err;\n }\n }\n\n private buildLabellizePrompt(args: {\n unit: LabellingUnit;\n chunk: LabellingUnitChunk;\n specContext: LabellingUnitSpecContext | undefined;\n /** On a retry, the placeholder drift from the prior attempt — appended as an explicit per-key correction. */\n priorDrift?: PlaceholderDrift[];\n /**\n * The keys this call must return. Defaults to the whole chunk; the completion\n * repair loop passes the outstanding subset so a follow-up call is small.\n */\n requestedKeys?: readonly string[];\n /** Keys the previous pass was asked for and silently omitted — rendered as an explicit correction. */\n omittedKeys?: readonly string[];\n }): string {\n const { unit, chunk, specContext, priorDrift, omittedKeys } = args;\n const requestedKeys = args.requestedKeys ?? chunk.keys;\n const primaryLocale = getCompanionConfiguredPrimaryLanguage(this.appConfigService.config);\n const primaryLanguage = LANGUAGE_INFO_MAP[primaryLocale]?.name ?? primaryLocale;\n const keyParams = chunk.keyParams ?? {};\n // Placeholder rules are stated only when a key IN THIS CALL declares params —\n // a repair pass carrying three plain-text keys must not be told about tokens\n // that belong to keys it is not being asked for.\n const hasPlaceholders = requestedKeys.some((key) => (keyParams[key]?.length ?? 0) > 0);\n\n const lines: string[] = [\n `You are writing the user-facing interface text for one ${unit.category} (\"${unit.displayLabel}\") of a professional SaaS web app.`,\n `Return exactly one polished ${primaryLanguage} label for each key listed below — only these keys, each exactly once.`,\n ];\n\n // 1. Context: the lean spec for components / resource intent for resources.\n // Absent for app-agnostic buckets (enums, themes) — that's fine.\n if (specContext?.description) {\n lines.push('', '# Context', specContext.description.trim());\n }\n if (specContext?.hints && Object.keys(specContext.hints).length > 0) {\n lines.push('', '# Other context', JSON.stringify(specContext.hints));\n }\n\n // 1b. Audience — the declared READER of these labels (from the resource spec's\n // `audience`; per-key overrides ride beside individual keys below).\n // Calibrates VOICE. Absent → END USER (the default the style rules assume).\n lines.push('', \"# Audience — write in this reader's register\", describeLabelAudienceRegister(specContext?.audience));\n\n // 2. Keys, each annotated with its KIND, its authored PURPOSE, and its\n // placeholders (with each variable's MEANING) inline. Declared metadata\n // (`chunk.keyMeta`, authored in the component's `.labels.ts`) wins;\n // heuristic kind inference is the fallback for un-annotated keys. This one\n // block replaces the old 3× redundancy (registeredKeys hint + separate\n // placeholder list + schema restate).\n const keyMeta = chunk.keyMeta ?? {};\n lines.push('', '# Keys to label (kind · purpose · placeholders)');\n for (const key of requestedKeys) {\n const leaf = key.split('.').pop() ?? key;\n const meta = keyMeta[key];\n const kind = meta?.kind ?? this.inferLabelKind(leaf);\n const params = keyParams[key];\n const tokens = params && params.length > 0\n ? ` · placeholders: ${params.map((p) => {\n const m = meta?.paramMeanings?.[p];\n return m ? `{${p}} (${m})` : `{${p}}`;\n }).join(' ')}`\n : '';\n const purpose = meta?.purpose ? ` · ${meta.purpose}` : '';\n // Per-key audience OVERRIDE (rare) — only when it diverges from the unit's\n // `# Audience`; keeps the common case (whole-resource audience) uncluttered.\n const audienceOverride = meta?.audience && meta.audience !== specContext?.audience\n ? ` · audience: ${meta.audience}`\n : '';\n lines.push(` ${key} · ${kind}${purpose}${audienceOverride}${tokens}`);\n for (const note of meta?.notes ?? []) lines.push(` note: ${note}`);\n }\n\n // 3. Style contract — the per-key-kind + casing consistency lever the old\n // prompt entirely lacked.\n lines.push(\n '',\n '# Style — write the SHORTEST natural UI copy. The kind + purpose beside each key is CONTEXT to disambiguate; NEVER restate it in the label.',\n `- Casing: Title Case for \"heading\" keys ONLY. Every other kind uses ${primaryLanguage} sentence case — capitalize the first word and proper nouns only (\"Available credits\", not \"Available Credits\").`,\n '- Length by kind: heading ≤ 4 words (a NOUN PHRASE naming the surface or thing the user is viewing — \"Members\", \"API Keys\", \"Billing\" — NEVER an imperative verb: a heading is a place, not an action, so never \"List members\" / \"Load profile\" / \"View member\"); label ≤ 3 words; button 1–3 words (imperative verb — \"Save\", \"Add task\"); tooltip ≤ 5 words; placeholder ≤ 4 words; description ONE clause ≤ 8 words; empty-state one short line; message one plain sentence; aria one self-contained spoken phrase.',\n '- No trailing punctuation on heading / label / button / placeholder keys. description, empty-state, message and aria keys may end with a period.',\n '- BANNED filler — never use words like: comprehensive, seamless(ly), powerful, robust, intuitive, effortless, easily, simply, quickly, \"our … system\". Never add a location tail (\"in this view\", \"within this interface\", \"from the sidebar\") and never restate the component\\'s own name or section.',\n '- NEVER leak framework/internal jargon into user-facing copy: \"resource\", \"entity\", \"record\", \"object\", \"field\", \"operation\", \"DTO\" name INTERNAL concepts an end-user must never see — even when the purpose/context above uses those words. On a GENERIC surface (no concrete domain noun is named above), use a neutral end-user word (\"item\") or drop the noun entirely. Write \"New\", \"Filter\", \"Create your first item\" — NEVER \"Create New Resource\" / \"Filter Resources\".',\n '- The purpose/meaning beside each key is DEVELOPER context written about the data model — it may say \"owns this\", \"for isolation and scoping\", \"tenant\", \"identifier\", \"first inserted the row\", \"administrative … record\". NEVER echo that register: write in the READER\\'s voice (see # Audience) — what they do or see, never how the system stores it. \"Org tenant for isolation and scoping\" → \"Organization\"; \"User who first inserted the task\" → \"Created by\"; \"Administrative identity record used to manage access\" → \"Users\". Banned as label wording (every audience): data model, record, tenant, persistence, \"in the system\" — and, unless the audience is developer, also identifier/DTO.',\n '- RELATIONSHIPS are not identifiers. A field whose name ends in Id / Ref / UserId, or whose purpose says \"relationship to\" / \"references\" / \"belongs to\", points at another record the user sees BY NAME (the cell shows that record\\'s name, never a code). Label it as the relationship — \"Assignee\", \"Owner\", \"List\", \"Organization\" — strip the Id/Ref suffix and NEVER output the word \"ID\" or an identifier-style caption (\"… Id\", \"… reference\").',\n '- Use the conventional term users already know (Status, Priority, Save, Cancel, Search, Delete) over invented or over-qualified wording. Drop articles (\"the\"/\"a\") and qualifiers already implied by the context above.',\n '- \"aria\" keys are screen-reader phrases: self-contained and natural to read aloud — clarity wins over brevity for these only.',\n );\n\n // 4. Placeholder rules (strict). The runtime only substitutes `{name}` when\n // `name` is a passed param (see `interpolateLabelParams`), so a\n // wrong/invented token renders literally to the user — hence \"exactly\n // these\". The per-key tokens live in the keys block above.\n if (hasPlaceholders) {\n lines.push(\n '',\n '# Placeholders (strict)',\n '- A placeholder is a single-brace token like {current}. For each key, use EXACTLY the tokens listed beside it — same names, each exactly once, in a natural position. Never invent a generic token such as {value}.',\n '- Any key with no placeholders listed takes none: emit plain text with no { } tokens.',\n );\n } else {\n lines.push('', '# Placeholders', '- None of these keys take placeholders: emit plain text with no { } tokens.');\n }\n\n // 5a. Omission correction — the model silently dropped these keys from its\n // previous response. Naming them (rather than re-sending the whole chunk)\n // is what makes the repair pass reliable: it is a short, pointed request\n // against a model that has already produced the rest of this shape.\n if (omittedKeys && omittedKeys.length > 0) {\n lines.push(\n '',\n `# Correction — your previous response left out ${omittedKeys.length} key(s). They are the ONLY keys listed above. Return every one of them.`,\n );\n }\n\n // 5b. Retry correction — explicit per-key fixes from the prior attempt's drift.\n if (priorDrift && priorDrift.length > 0) {\n lines.push('', '# Correction — your previous attempt used the wrong placeholders. Fix EXACTLY these keys:');\n for (const d of priorDrift) {\n const expected = d.declared.length ? d.declared.map((p) => `{${p}}`).join(' ') : 'no placeholders at all';\n const fixes = [`use ${expected}`];\n if (d.unexpected.length) fixes.push(`remove ${d.unexpected.map((p) => `{${p}}`).join(' ')}`);\n if (d.missing.length) fixes.push(`add ${d.missing.map((p) => `{${p}}`).join(' ')}`);\n lines.push(` ${d.key}: ${fixes.join('; ')}`);\n }\n }\n\n lines.push('', 'Return a value for every key. Do not omit any field.');\n return lines.join('\\n');\n }\n\n /**\n * Classify a label key from its leaf name so the prompt can calibrate tone\n * and length. Heuristic but stable: `*aria*` → screen-reader phrase,\n * `*empty*` / `no<Capital>…` → empty state, `*title`/`heading`/`header` →\n * heading, everything else → a plain UI label.\n */\n private inferLabelKind(leaf: string): string {\n if (/aria/i.test(leaf)) return 'aria';\n if (/empty/i.test(leaf) || /^no[A-Z]/.test(leaf)) return 'empty-state';\n if (/title$/i.test(leaf) || /heading|header/i.test(leaf)) return 'heading';\n return 'label';\n }\n\n /**\n * Hash the inputs the LLM sees for this unit. `displayLabel` is part\n * of the prompt (see `buildSystemPrompt` / `buildUserMessage`), so\n * a rename like `OrgPasswordResetForm` → `OrgPasswordResetView` MUST\n * invalidate the lock and trigger a re-labellize — otherwise the\n * primary file would keep reflecting the old name forever.\n */\n private computeInputFingerprint(\n unit: LabellingUnit,\n specContext: LabellingUnitSpecContext | undefined,\n keys: string[],\n ): string {\n // Fold the declared interpolation params into the fingerprint so a change\n // to a label's param contract — including a newly-completed registration —\n // invalidates the lock and forces re-labellization. Otherwise the primary\n // file would keep a value whose placeholders no longer match what the\n // runtime passes (and `--force` would be the only way to refresh it).\n const declaredParams: Record<string, readonly string[]> = {};\n const declaredMeta: Record<string, unknown> = {};\n for (const chunk of unit.chunks) {\n if (chunk.keyParams) {\n for (const [k, p] of Object.entries(chunk.keyParams)) declaredParams[k] = p;\n }\n // Per-key semantic metadata (purpose / kind / param meanings / notes) is\n // fed verbatim into the prompt, so a change to it MUST invalidate the lock\n // and re-labellize — otherwise enriching a component's `.labels.ts` would\n // leave its primary file reflecting the pre-enrichment context.\n if (chunk.keyMeta) {\n for (const [k, m] of Object.entries(chunk.keyMeta)) declaredMeta[k] = m;\n }\n }\n const sortedKeyParams = Object.fromEntries(\n Object.keys(declaredParams)\n .sort()\n .map((k) => [k, [...declaredParams[k]!].sort()]),\n );\n const sortedKeyMeta = Object.fromEntries(\n Object.keys(declaredMeta).sort().map((k) => [k, declaredMeta[k]]),\n );\n return this.lockService.hashFingerprint({\n category: unit.category,\n displayLabel: unit.displayLabel,\n // Prompt style-contract version — folded in so a style-rule change (which\n // does NOT alter any per-unit input) still invalidates every lock and\n // re-labellizes without `--force`. Bump `LABELLIZE_PROMPT_STYLE_VERSION`\n // whenever the `# Style`/`# Audience` contract changes.\n promptStyleVersion: LABELLIZE_PROMPT_STYLE_VERSION,\n keys: [...keys].sort(),\n keyParams: sortedKeyParams,\n keyMeta: sortedKeyMeta,\n spec: specContext\n ? {\n description: specContext.description,\n hints: specContext.hints,\n // Audience change → re-labellize (voice differs) without `--force`.\n audience: specContext.audience,\n }\n : null,\n });\n }\n\n /**\n * Resolve the i18n root for the primary backend service: per-unit\n * files land under `<backend>/src/engine/i18n/<bucket>/<slug>.<locale>.ts`.\n *\n * The backend's engine i18n barrel walks this tree at module load via\n * `scanCustomLabelsDirectory` from `@wildo-ai/saas-backend-lib`. There\n * is no monolithic `labels.<locale>.ts` to write — per-unit files are\n * the runtime source of truth.\n */\n private resolveI18nRoot(): string {\n const backendService = Object.values(this.companionContext.backendServices)[0];\n if (!backendService) {\n throw this.errorBuilder.buildFromStandardError(\n new Error('No backend service configured for per-unit i18n output'),\n undefined,\n {\n customMessageReference: ErrorCustomMessageReference.INTERNAL,\n context: { operation: 'LabellizeOrchestrator.resolveI18nRoot' },\n },\n );\n }\n return path.resolve(this.companionContext.saasRoot, backendService.path, 'src/engine/i18n');\n }\n}\n"]}
1
+ {"version":3,"file":"labellize-orchestrator.companion.service.js","sourceRoot":"","sources":["../../../../src/i18n-labelling/services/labellize-orchestrator.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EACL,kBAAkB,EAKlB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGL,mCAAmC,EACnC,+BAA+B,GAChC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,2BAA2B,EAC3B,SAAS,GAGV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAqB,aAAa,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC1G,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,qCAAqC,EAAE,MAAM,oDAAoD,CAAC;AAC3G,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAElG,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD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CAAC;IAC9F,CAAC;CACF,CAAA;AAjxBY,qCAAqC;IADjD,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAC9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAA;IAC/C,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAE3C,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;IAChD,WAAA,MAAM,CAAC,uBAAuB,CAAC,uBAAuB,CAAC,CAAA;IACvD,WAAA,MAAM,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAA;IACpD,WAAA,MAAM,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,CAAA;qFAF+B,gCAAgC;QAC/B,6BAA6B;QAC7B,4BAA4B;GAZvG,qCAAqC,CAixBjD","sourcesContent":["import * as fs from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { inject, injectable } from 'inversify';\nimport { z } from 'zod';\nimport {\n SAAS_SERVICE_TYPES,\n type AgentsBackendService,\n type AppConfigurationService,\n type LoggerService,\n type ErrorBuilderBackendService,\n describeCaughtError,\n} from '@wildo-ai/saas-backend-lib';\nimport {\n LLMProvider_GenerateStructuredInputSchema,\n LLMProvider_GenerateStructuredOutputSchema,\n describeStructuredGenerationFailure,\n readStructuredGenerationFailure,\n} from '@wildo-ai/external-connectors-models';\nimport {\n ErrorCustomMessageReference,\n ErrorType,\n type AgentTraceContext,\n type FlowsActors_Agent_Invocation,\n} from '@wildo-ai/saas-models';\nimport { AvailableLanguage, LabelAudience, LANGUAGE_INFO_MAP } from '@wildo-ai/presets-components-models';\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { LabellingPlannerCompanionService } from './labelling-planner.companion.service';\nimport { getCompanionConfiguredPrimaryLanguage } from '../../core/config/primary-language.companion.utils';\nimport { WildoSaasLockCompanionService } from '../../core/lock/wildo-saas-lock.companion.service';\nimport type { I18nLockUnitEntry } from '../../core/lock/wildo-saas-lock.models';\nimport { CompanionTraceabilityService } from '../../core/traceability/companion-traceability.service';\nimport {\n CompanionTraceabilityLevel,\n type CompanionExecutionSessionContext,\n type CompanionTraceStepContext,\n} from '../../core/traceability/companion-traceability.models';\nimport {\n resolvePerUnitFilePath,\n readPerUnitLabels,\n writePerUnitLabels,\n} from '../utils/per-unit-file.utils';\nimport { I18nUnitRunStatus, type LabellingPlanResult, type LabellingUnit, type LabellingUnitChunk, type LabellingUnitSpecContext } from '../models/labelling-unit.models';\nimport { completeStructuredChunkKeys } from '../utils/structured-chunk-completion.utils';\nimport { detectDeclaredPlaceholderDrift, type PlaceholderDrift } from '../utils/label-placeholder-drift.utils';\nimport {\n collectGeneratedLabelFiles,\n computeOrphanLabelArtifacts,\n describeOrphanLabelArtifacts,\n OrphanLabelArtifactsOutcome,\n type OrphanLabelArtifactsReport,\n} from '../utils/orphan-label-artifacts.utils';\n\nexport interface LabellizeOptions {\n /** Force re-generation even if the lock says the unit is fresh. */\n forceRegenerate?: boolean;\n /** Limit work to a subset of unit ids (for partial runs). */\n unitIdFilter?: string[];\n}\n\nexport interface LabellizeUnitResult {\n unitId: string;\n filePath: string;\n status: Exclude<I18nUnitRunStatus, I18nUnitRunStatus.SKIPPED>;\n error?: string;\n}\n\nexport interface LabellizeRunResult {\n primaryLocale: string;\n totalUnits: number;\n updated: number;\n fresh: number;\n failed: number;\n details: LabellizeUnitResult[];\n /**\n * Generated files and lock rows left behind by units the application no\n * longer plans — a RENAMED or DELETED resource's labels and its lock entry.\n *\n * Reported, never removed. `computeOrphanLabelArtifacts`'s JSDoc carries the\n * full reasoning; the short version is that a run's planned set is not\n * provably total (a frontend introspection that could not run silently drops\n * four whole buckets), and a delete against a set that is merely INCOMPLETE\n * destroys live, expensively-generated copy. The report suppresses itself\n * whenever the plan declares itself degraded, so an empty `orphanFiles` from\n * a partial run is never mistaken for \"nothing is stale\" — read `outcome`.\n *\n * Computed against the UNFILTERED plan, so a `unitIdFilter` run still judges\n * against every unit the application has rather than against the subset the\n * caller asked to regenerate.\n */\n orphans: OrphanLabelArtifactsReport;\n}\n\n/**\n * Version tag for the labellize prompt's STYLE + AUDIENCE contract. Folded into\n * every unit's input fingerprint so a change to the style/audience rules — which\n * touches no per-unit input — still invalidates the lock and re-labellizes on the\n * next non-forced run. Bump this whenever the `# Style` / `# Audience` block\n * changes. (Was the \"style edits need --force\" mechanism gap.)\n */\nconst LABELLIZE_PROMPT_STYLE_VERSION = '2026-06-18.audience-axis' as const;\n\n/**\n * Map a declared {@link LabelAudience} to the one-line reader/register\n * instruction rendered into the labellize prompt's `# Audience` block — the\n * single lever that shifts generated copy between product voice, operator\n * console voice, and developer/integrator voice.\n *\n * Boundary-tolerant by design: it accepts the raw `string | undefined` the\n * companion reads off a *built* resource spec (the value crosses the spec\n * boundary as a plain enum-valued string, never as the enum type itself). An\n * absent or unrecognized value resolves to END USER — the default register the\n * `# Style` rules already assume — so un-authored resources are unchanged.\n *\n * The `case` labels are {@link LabelAudience} enum members rather than string\n * literals: if the enum's underlying values are ever changed, a stale literal\n * would silently fall through to the end-user default and quietly kill the\n * admin/developer registers. Keying on the enum makes that class of drift a\n * compile-time concern instead of an invisible copy regression.\n */\nexport function describeLabelAudienceRegister(audience: string | undefined): string {\n switch (audience) {\n case LabelAudience.ADMIN:\n return 'ADMIN / operator (a back-office console). Voice: precise, operational, neutral — NOT casual consumer copy, yet still jargon-free for a non-developer (no \"DTO\"/\"entity\"/\"tenant\"). e.g. \"Suspend user\", \"Audit log\", \"Access status\".';\n case LabelAudience.DEVELOPER:\n return 'DEVELOPER / integrator. Voice: technical and precise — domain-technical terms are EXPECTED and correct here (token, endpoint, scope, webhook, API key, payload). Do not dumb them down into consumer copy.';\n case LabelAudience.END_USER:\n default:\n return 'a non-technical END USER. Voice: plain, friendly, conventional product copy — the default register.';\n }\n}\n\n/**\n * Orchestrator that drives primary-language label generation\n * unit-by-unit using the planner + spec loader + lock file.\n *\n * for each unit:\n * fingerprint = sha(sorted_keys + sorted_spec_hints)\n * if lock.unit.inputSha === fingerprint && !force:\n * status = fresh, skip agent call\n * else:\n * for each chunk:\n * send (keys, spec context, chunk schema) to agent\n * merge translated strings into per-unit file\n * write per-unit file\n * update lock entry (inputSha, primarySha, lastLabellizedAt)\n */\n@injectable()\nexport class LabellizeOrchestratorCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) private readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.AgentsBackendService) private readonly agentsService: AgentsBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService)\n private readonly appConfigService: AppConfigurationService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.LabellingPlannerService) private readonly planner: LabellingPlannerCompanionService,\n @inject(COMPANION_SERVICE_TYPES.WildoSaasLockService) private readonly lockService: WildoSaasLockCompanionService,\n @inject(COMPANION_SERVICE_TYPES.TraceabilityService) private readonly traceability: CompanionTraceabilityService,\n ) {\n this.logDebug = this.logger.debugByType('LabellizeOrchestrator');\n }\n\n public async labellize(\n options: LabellizeOptions = {},\n providedSession?: CompanionExecutionSessionContext,\n ): Promise<LabellizeRunResult> {\n const primaryLocale = getCompanionConfiguredPrimaryLanguage(this.appConfigService.config);\n const localeDisplayName = LANGUAGE_INFO_MAP[primaryLocale]?.name ?? primaryLocale;\n const i18nRoot = this.resolveI18nRoot();\n\n const plan = await this.planner.planAllUnitsWithCompleteness();\n const allUnits = plan.units;\n const filter = options.unitIdFilter ? new Set(options.unitIdFilter) : null;\n const units = filter ? allUnits.filter((u) => filter.has(u.id)) : allUnits;\n\n // Trace under the CALLER's session when provided — the controller threads\n // its per-request `POST /labelling/labellize` session, so the unit steps\n // land in the session the user actually inspects (not a disconnected one).\n // Fall back to a self-owned `internal` session for direct/CLI/test callers.\n // At the default NONE level every trace call below is a gated no-op (output\n // byte-identical); set `WILDO_DEV_COMPANION_TRACEABILITY_LEVEL=DEBUG_VERBOSE`\n // and restart the companion to capture, per unit, the resolved spec context\n // + the exact prompt + the LLM response + token usage per label.\n const traceSession = providedSession ?? this.traceability.createInternalSession({\n label: 'labellize-run',\n metadata: {\n run: 'labellize',\n primaryLocale,\n forceRegenerate: options.forceRegenerate === true,\n unitIdFilter: options.unitIdFilter ?? null,\n totalUnits: units.length,\n },\n });\n\n const details: LabellizeUnitResult[] = [];\n let updated = 0;\n let fresh = 0;\n let failed = 0;\n\n for (const unit of units) {\n try {\n const filePath = resolvePerUnitFilePath({ i18nRoot, unit, localeCode: primaryLocale });\n const result = await this.labellizeUnit({\n unit,\n filePath,\n primaryLocale,\n localeDisplayName,\n forceRegenerate: options.forceRegenerate === true,\n traceSession,\n });\n details.push(result);\n if (result.status === I18nUnitRunStatus.FRESH) fresh++;\n else if (result.status === I18nUnitRunStatus.UPDATED) updated++;\n else failed++;\n } catch (err: unknown) {\n failed++;\n // `describeCaughtError`, NOT the inline `instanceof Error` ternary.\n // What this catch receives is the VALIDATION error built ~290 lines below\n // (\"Invalid structured output for unit … chunk …\"), and a WildoError_Backend\n // is a PLAIN OBJECT, not an `Error` — so the inline ternary took the\n // `String(...)` branch and every distinct labelling failure was reported to\n // the operator, identically, as the literal `[object Object]`. The real\n // reason was only ever visible by grepping the companion's own log for the\n // preceding `GENERATE_STRUCTURED` line.\n const message = describeCaughtError(err);\n details.push({ unitId: unit.id, filePath: '', status: I18nUnitRunStatus.FAILED, error: message });\n this.logger.error('Labellize unit failed', { unitId: unit.id, error: message });\n }\n }\n\n // Stale-unit detection runs AFTER the loop and against `allUnits` — the\n // UNFILTERED plan — so a partial (`unitIdFilter`) run never reads the units\n // it was asked to skip as units that no longer exist. It is read-only: it\n // walks the i18n root, compares `(bucket, slug)` against the plan, and\n // reports. See `computeOrphanLabelArtifacts` for why it does not unlink.\n const orphans = await this.collectOrphanReport({ i18nRoot, allUnits, plan });\n const orphanSummary = describeOrphanLabelArtifacts(orphans);\n if (orphans.outcome === OrphanLabelArtifactsOutcome.REPORTED\n && orphans.orphanFiles.length + orphans.orphanLockUnitIds.length > 0) {\n this.logger.warn(orphanSummary, {\n orphanFiles: orphans.orphanFiles,\n orphanLockUnitIds: orphans.orphanLockUnitIds,\n i18nRoot,\n });\n } else {\n this.logDebug(orphanSummary, { outcome: orphans.outcome });\n }\n\n await this.traceability.traceEvent({\n session: traceSession,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: 'labellize-run-complete',\n summary: `Labellized ${units.length} unit(s): ${updated} updated, ${fresh} fresh, ${failed} failed. ${orphanSummary}`,\n payload: { primaryLocale, totalUnits: units.length, updated, fresh, failed, orphans },\n });\n if (traceSession.traceabilityLevel !== CompanionTraceabilityLevel.NONE) {\n this.logger.info('Labellize trace session written', {\n sessionId: traceSession.sessionId,\n sessionDir: traceSession.sessionDirPath,\n });\n }\n\n return {\n primaryLocale,\n totalUnits: units.length,\n updated,\n fresh,\n failed,\n details,\n orphans,\n };\n }\n\n /**\n * Scan the i18n root and judge what belongs to no planned unit.\n *\n * Failure-tolerant on purpose. This is a DIAGNOSTIC bolted onto a generation\n * run: an unreadable directory or an unreadable lock must degrade to \"could\n * not judge\" and never fail a run whose labels were generated correctly. It\n * degrades to the same suppressed outcome a partial plan produces, carrying\n * the read failure as the reason, so a consumer cannot read the empty file\n * list off a failed scan as \"nothing is stale\".\n */\n private async collectOrphanReport(args: {\n i18nRoot: string;\n allUnits: readonly LabellingUnit[];\n plan: LabellingPlanResult;\n }): Promise<OrphanLabelArtifactsReport> {\n const { i18nRoot, allUnits, plan } = args;\n try {\n const existingFiles = await collectGeneratedLabelFiles(i18nRoot);\n const section = await this.lockService.readI18nSection();\n return computeOrphanLabelArtifacts({\n plannedUnits: allUnits,\n lockUnitIds: Object.keys(section?.units ?? {}),\n existingFiles,\n incompleteness: plan.incompleteness,\n });\n } catch (err: unknown) {\n const message = describeCaughtError(err);\n this.logger.warn(`Stale-unit detection could not read the i18n state: ${message}`, { i18nRoot });\n return {\n outcome: OrphanLabelArtifactsOutcome.UNAVAILABLE_SCAN_FAILED,\n incompleteness: plan.incompleteness,\n orphanFiles: [],\n orphanLockUnitIds: [],\n scannedFileCount: 0,\n scanFailure: message,\n };\n }\n }\n\n private async labellizeUnit(args: {\n unit: LabellingUnit;\n filePath: string;\n primaryLocale: string;\n localeDisplayName: string;\n forceRegenerate: boolean;\n traceSession: CompanionExecutionSessionContext;\n }): Promise<LabellizeUnitResult> {\n const { unit, filePath, primaryLocale, localeDisplayName, forceRegenerate, traceSession } = args;\n\n const specContext = await unit.loadSpecContext();\n const allKeys = unit.chunks.flatMap((c) => c.keys);\n const inputFingerprint = this.computeInputFingerprint(unit, specContext, allKeys);\n\n // One trace step per unit; the spec context + every chunk prompt/response\n // land under it (in-memory until the first gated write materializes it).\n const step = this.traceability.createStep(traceSession, { kind: 'labellize-unit', label: unit.id });\n\n const section = await this.lockService.readI18nSection();\n const existing = section?.units[unit.id];\n\n if (!forceRegenerate && existing?.inputSha === inputFingerprint && existing?.primarySha) {\n // Verify the on-disk file still matches the recorded `primarySha`\n // before trusting the lock. A developer who hand-edits or deletes\n // the per-unit file out-of-band must NOT be silently skipped.\n const onDiskSha = await this.computeFileShaIfExists(filePath);\n if (onDiskSha === existing.primarySha) {\n this.logDebug('Unit fresh — skipping agent call', { unitId: unit.id });\n await this.traceability.traceEvent({\n session: traceSession,\n step,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: 'labellize-unit-fresh',\n summary: `Unit ${unit.id} fresh — no LLM call`,\n payload: { unitId: unit.id, keyCount: allKeys.length },\n });\n return { unitId: unit.id, filePath, status: I18nUnitRunStatus.FRESH };\n }\n this.logDebug('Unit lock says fresh but on-disk content drifted — re-labellizing', {\n unitId: unit.id,\n recordedPrimarySha: existing.primarySha,\n onDiskSha: onDiskSha ?? '<missing>',\n });\n }\n\n // The inspectable answer to \"what specification did this unit actually\n // receive?\" — written ONLY for units about to be sent to the LLM (fresh\n // units sent nothing). `hasSpecContext: false` is the signal that a unit\n // family ships keys-only today (the spec-enrichment follow-up's worklist).\n const declaredKeyParams: Record<string, readonly string[]> = {};\n for (const chunk of unit.chunks) {\n if (!chunk.keyParams) continue;\n for (const [k, p] of Object.entries(chunk.keyParams)) declaredKeyParams[k] = p;\n }\n await this.traceability.writeArtifact({\n session: traceSession,\n step,\n minimumLevel: CompanionTraceabilityLevel.DEBUG_VERBOSE,\n fileName: 'spec-context.json',\n content: {\n unitId: unit.id,\n category: unit.category,\n displayLabel: unit.displayLabel,\n hasSpecContext: specContext !== undefined,\n description: specContext?.description ?? null,\n hints: specContext?.hints ?? null,\n origin: specContext?.origin ?? null,\n declaredKeyParams,\n keyCount: allKeys.length,\n chunkCount: unit.chunks.length,\n },\n });\n\n const existingFlat = await readPerUnitLabels(filePath);\n\n const newFlat: Record<string, string> = { ...existingFlat };\n for (const chunk of unit.chunks) {\n const chunkResult = await this.labellizeChunk({\n unit,\n chunk,\n specContext,\n existingFlat: newFlat,\n traceSession,\n step,\n });\n Object.assign(newFlat, chunkResult);\n }\n\n // Drop any stale keys (present in file but no longer planned).\n const plannedSet = new Set(allKeys);\n for (const k of Object.keys(newFlat)) {\n if (!plannedSet.has(k)) delete newFlat[k];\n }\n\n const writtenContent = await writePerUnitLabels({\n filePath,\n localeCode: primaryLocale,\n localeDisplayName,\n isPrimaryLocale: true,\n flatEntries: newFlat,\n });\n\n const primarySha = this.lockService.hashString(writtenContent);\n const entry: I18nLockUnitEntry = {\n category: unit.category,\n displayLabel: unit.displayLabel,\n inputSha: inputFingerprint,\n primarySha,\n lastLabellizedAt: new Date().toISOString(),\n locales: existing?.locales ?? {},\n };\n\n // Mark every locale stale (their content needs re-translation).\n for (const localeCode of Object.keys(entry.locales)) {\n const prev = entry.locales[localeCode];\n entry.locales[localeCode] = {\n ...prev,\n status: 'stale',\n };\n }\n\n await this.lockService.upsertI18nUnit(unit.id, entry, primaryLocale, section?.trackedLocales ?? []);\n\n await this.traceability.traceEvent({\n session: traceSession,\n step,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: 'labellize-unit-complete',\n summary: `Unit ${unit.id} labellized (${allKeys.length} key(s), ${unit.chunks.length} chunk(s))`,\n payload: { unitId: unit.id, keyCount: allKeys.length, chunkCount: unit.chunks.length },\n });\n\n return { unitId: unit.id, filePath, status: I18nUnitRunStatus.UPDATED };\n }\n\n private async labellizeChunk(args: {\n unit: LabellingUnit;\n chunk: LabellingUnitChunk;\n specContext: LabellingUnitSpecContext | undefined;\n existingFlat: Record<string, string>;\n traceSession: CompanionExecutionSessionContext;\n step: CompanionTraceStepContext;\n }): Promise<Record<string, string>> {\n const { unit, chunk, specContext, traceSession, step } = args;\n\n const MAX_ATTEMPTS = 2;\n let result: Record<string, string> = {};\n let drift: PlaceholderDrift[] = [];\n\n // Generate → validate placeholders → retry-with-correction on drift. The\n // strong per-key seeding in the prompt makes drift rare; the retry self-\n // heals the occasional miss without dropping the whole unit. Both wrong-name\n // and missing placeholders are corrected this way.\n for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {\n const prompt = this.buildLabellizePrompt({\n unit,\n chunk,\n specContext,\n priorDrift: attempt > 1 ? drift : undefined,\n });\n // Correlate this chunk attempt so the engine AgentCallTraceSink writes the\n // prompt + output (+usage/latency) into THIS unit's step, keyed by\n // chunk+attempt (the attempt rides in the label). The caller keeps only its\n // DOMAIN signal — the assembled labels + placeholder drift the engine sink\n // can't produce.\n const traceContext: AgentTraceContext | undefined = traceSession && step\n ? {\n sessionRef: traceSession.sessionId,\n stepRef: step.stepId,\n label: `labellize.chunk-${chunk.chunkId}.attempt-${attempt}`,\n attributes: { unitId: unit.id, chunkId: chunk.chunkId, attempt, keyCount: chunk.keys.length },\n }\n : undefined;\n // Ask for the chunk, then re-ask for whatever the model omitted. A\n // non-strict provider can drop leaves from a large flat object without\n // any error signal, and the response schema now TOLERATES that (see\n // `LabellingUnitChunk.buildOutputSchema`) — so the gap has to be repaired\n // here rather than discarded with the whole unit.\n const completion = await completeStructuredChunkKeys({\n keys: chunk.keys,\n invoke: async ({ requestedKeys, omittedByPreviousPass, pass }) => {\n const passPrompt = pass === 1\n ? prompt\n : this.buildLabellizePrompt({ unit, chunk, specContext, requestedKeys, omittedKeys: omittedByPreviousPass });\n const passTraceContext: AgentTraceContext | undefined = traceContext\n ? {\n ...traceContext,\n label: `${traceContext.label}${pass === 1 ? '' : `.repair-${pass - 1}`}`,\n attributes: { ...traceContext.attributes, keyCount: requestedKeys.length, pass },\n }\n : undefined;\n const { parsed } = await this.invokeChunkAgent({\n unit,\n chunk,\n requestedKeys,\n prompt: passPrompt,\n traceContext: passTraceContext,\n });\n return parsed;\n },\n });\n\n if (completion.missingKeys.length > 0) {\n // The repair budget is spent and these keys never arrived. They are about\n // to fall back to the prior value or — with no prior file — to the raw\n // dotted key, which renders as garbage in the UI. Name them: this is the\n // only signal that distinguishes \"generated\" from \"gave up\".\n this.logger.error('Label keys still missing after repair passes — falling back', {\n unitId: unit.id,\n chunkId: chunk.chunkId,\n attempt,\n passes: completion.passes,\n missingKeys: completion.missingKeys,\n });\n } else if (completion.passes > 1) {\n this.logger.warn('Structured label response omitted keys — recovered by follow-up call(s)', {\n unitId: unit.id,\n chunkId: chunk.chunkId,\n attempt,\n passes: completion.passes,\n keyCount: chunk.keys.length,\n });\n }\n\n result = this.assembleChunkResult(chunk, completion.values, args.existingFlat);\n drift = this.detectPlaceholderDrift(chunk, result);\n\n // Caller-owned domain artifact: the ASSEMBLED labels + placeholder drift for\n // THIS attempt (the engine sink owns the raw prompt/output/usage record).\n await this.traceability.writeArtifact({\n session: traceSession,\n step,\n minimumLevel: CompanionTraceabilityLevel.DEBUG_VERBOSE,\n fileName: `chunk-${chunk.chunkId}.attempt-${attempt}.labels.json`,\n content: { object: result, drift },\n });\n await this.traceability.traceEvent({\n session: traceSession,\n step,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: 'labellize-chunk',\n summary: `Chunk ${chunk.chunkId} attempt ${attempt}: ${chunk.keys.length} key(s), ${drift.length} drift`,\n payload: {\n chunkId: chunk.chunkId,\n attempt,\n keyCount: chunk.keys.length,\n driftKeys: drift.map((d) => d.key),\n },\n });\n\n if (drift.length === 0) return result;\n this.logDebug('Placeholder drift detected — retrying chunk with correction', {\n unitId: unit.id,\n chunkId: chunk.chunkId,\n attempt,\n offenders: drift.map((d) => d.key),\n });\n }\n\n // Retries exhausted. Surface loudly with full detail. The best-effort\n // result is still returned (and written) so the drift is visible in BOTH\n // the log and the on-disk file — a loud, debuggable signal beats silently\n // dropping the whole unit or hiding the mismatch.\n this.logger.warn('Label placeholder drift persisted after retries', {\n unitId: unit.id,\n chunkId: chunk.chunkId,\n drift,\n });\n return result;\n }\n\n /**\n * Invoke the labelling agent for one chunk and return the parsed flat object.\n * The optional `traceContext` is threaded into `invokeAgent` so the engine\n * AgentCallTraceSink owns this call's prompt/output/usage/latency record — the\n * caller no longer reads `executionContext`. Throws if the structured output\n * is missing/malformed.\n */\n private async invokeChunkAgent(args: {\n unit: LabellingUnit;\n chunk: LabellingUnitChunk;\n /** The keys THIS physical call must return — the whole chunk, or the outstanding subset on a repair pass. */\n requestedKeys: readonly string[];\n prompt: string;\n traceContext?: AgentTraceContext;\n }): Promise<{ parsed: Record<string, unknown> }> {\n const { unit, chunk, requestedKeys, prompt, traceContext } = args;\n const schema = chunk.buildOutputSchema(requestedKeys);\n\n const invocation: FlowsActors_Agent_Invocation<\n typeof LLMProvider_GenerateStructuredInputSchema,\n typeof LLMProvider_GenerateStructuredOutputSchema,\n z.ZodSchema<Record<string, string | undefined>>\n > = {\n agentRef: 'labelling.translation.agent',\n initiator: {},\n invocationContext: [],\n input: { prompt, schema },\n output: { object: {} },\n executionContext: {},\n artifactBindings: [],\n };\n\n this.logDebug('Labellize chunk', {\n unitId: unit.id,\n chunkId: chunk.chunkId,\n keyCount: requestedKeys.length,\n });\n\n const response = await this.agentsService.invokeAgent(invocation, traceContext);\n const parsed = (response.output as { object?: Record<string, unknown> })?.object;\n if (!parsed || typeof parsed !== 'object') {\n // The engine now says WHY there is no object; carry it into the message an operator\n // actually sees. Without this the reason existed only in the companion's own log\n // (the preceding `GENERATE_STRUCTURED` line), so the CLI summary — the surface a\n // human reads — reported a bare \"invalid output\" for a truncated completion, a\n // refusal, and a schema the model half-filled, alike. `validationIssues` names the\n // exact paths that failed and is the single most useful half.\n const failure = readStructuredGenerationFailure(response.executionContext);\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_RESOURCE_VALIDATION_FAILED,\n context: {\n message: `Invalid structured output for unit ${unit.id} chunk ${chunk.chunkId}`\n + (failure ? ` — ${describeStructuredGenerationFailure(failure)}` : ''),\n ...(failure ? { structuredGenerationFailure: failure } : {}),\n },\n });\n }\n return { parsed };\n }\n\n /**\n * Assemble the chunk's flat result from the agent response, falling back to\n * the existing primary value (preserving prior good content) and finally the\n * raw key — so a partial agent response never silently destroys good labels.\n */\n private assembleChunkResult(\n chunk: LabellingUnitChunk,\n parsed: Record<string, unknown>,\n existingFlat: Record<string, string>,\n ): Record<string, string> {\n const result: Record<string, string> = {};\n for (const key of chunk.keys) {\n const value = parsed[key];\n if (typeof value === 'string' && value.length > 0) {\n result[key] = value;\n continue;\n }\n const fallback = existingFlat[key];\n result[key] = typeof fallback === 'string' && fallback.length > 0 ? fallback : key;\n }\n return result;\n }\n\n /**\n * Compare each generated label's emitted single-brace placeholders against\n * the key's DECLARED interpolation params. The runtime only substitutes\n * `{name}` when `name` is a passed param (see `interpolateLabelParams`), so:\n * - an emitted token outside the declared set renders literally (the\n * `{value}` / wrong-name drift), and\n * - a declared param that never appears means the value silently won't show\n * (the missing-placeholder drift).\n *\n * Runs over EVERY key in a param-validated chunk (`chunk.keyParams` present):\n * a key with no declared params is held to \"must contain no placeholder\", so\n * a plain-string label that drifts to `{value}` is caught too. Chunks from\n * buckets that don't thread declared params (no `keyParams`) are skipped.\n *\n * The comparison itself lives in `label-placeholder-drift.utils` because the\n * TRANSLATE orchestrator enforces the same invariant against a different\n * expected set (the source string's tokens rather than declared params), and\n * two hand-written copies of \"the placeholders match\" would eventually\n * disagree — see that module's header.\n */\n private detectPlaceholderDrift(\n chunk: LabellingUnitChunk,\n generated: Record<string, string>,\n ): PlaceholderDrift[] {\n return detectDeclaredPlaceholderDrift({ keys: chunk.keys, keyParams: chunk.keyParams, generated });\n }\n\n private async computeFileShaIfExists(filePath: string): Promise<string | undefined> {\n try {\n const content = await fs.readFile(filePath, 'utf-8');\n return this.lockService.hashString(content);\n } catch (err: unknown) {\n if ((err as NodeJS.ErrnoException)?.code === 'ENOENT') return undefined;\n throw err;\n }\n }\n\n private buildLabellizePrompt(args: {\n unit: LabellingUnit;\n chunk: LabellingUnitChunk;\n specContext: LabellingUnitSpecContext | undefined;\n /** On a retry, the placeholder drift from the prior attempt — appended as an explicit per-key correction. */\n priorDrift?: PlaceholderDrift[];\n /**\n * The keys this call must return. Defaults to the whole chunk; the completion\n * repair loop passes the outstanding subset so a follow-up call is small.\n */\n requestedKeys?: readonly string[];\n /** Keys the previous pass was asked for and silently omitted — rendered as an explicit correction. */\n omittedKeys?: readonly string[];\n }): string {\n const { unit, chunk, specContext, priorDrift, omittedKeys } = args;\n const requestedKeys = args.requestedKeys ?? chunk.keys;\n const primaryLocale = getCompanionConfiguredPrimaryLanguage(this.appConfigService.config);\n const primaryLanguage = LANGUAGE_INFO_MAP[primaryLocale]?.name ?? primaryLocale;\n const keyParams = chunk.keyParams ?? {};\n // Placeholder rules are stated only when a key IN THIS CALL declares params —\n // a repair pass carrying three plain-text keys must not be told about tokens\n // that belong to keys it is not being asked for.\n const hasPlaceholders = requestedKeys.some((key) => (keyParams[key]?.length ?? 0) > 0);\n\n const lines: string[] = [\n `You are writing the user-facing interface text for one ${unit.category} (\"${unit.displayLabel}\") of a professional SaaS web app.`,\n `Return exactly one polished ${primaryLanguage} label for each key listed below — only these keys, each exactly once.`,\n ];\n\n // 1. Context: the lean spec for components / resource intent for resources.\n // Absent for app-agnostic buckets (enums, themes) — that's fine.\n if (specContext?.description) {\n lines.push('', '# Context', specContext.description.trim());\n }\n if (specContext?.hints && Object.keys(specContext.hints).length > 0) {\n lines.push('', '# Other context', JSON.stringify(specContext.hints));\n }\n\n // 1b. Audience — the declared READER of these labels (from the resource spec's\n // `audience`; per-key overrides ride beside individual keys below).\n // Calibrates VOICE. Absent → END USER (the default the style rules assume).\n lines.push('', \"# Audience — write in this reader's register\", describeLabelAudienceRegister(specContext?.audience));\n\n // 2. Keys, each annotated with its KIND, its authored PURPOSE, and its\n // placeholders (with each variable's MEANING) inline. Declared metadata\n // (`chunk.keyMeta`, authored in the component's `.labels.ts`) wins;\n // heuristic kind inference is the fallback for un-annotated keys. This one\n // block replaces the old 3× redundancy (registeredKeys hint + separate\n // placeholder list + schema restate).\n const keyMeta = chunk.keyMeta ?? {};\n lines.push('', '# Keys to label (kind · purpose · placeholders)');\n for (const key of requestedKeys) {\n const leaf = key.split('.').pop() ?? key;\n const meta = keyMeta[key];\n const kind = meta?.kind ?? this.inferLabelKind(leaf);\n const params = keyParams[key];\n const tokens = params && params.length > 0\n ? ` · placeholders: ${params.map((p) => {\n const m = meta?.paramMeanings?.[p];\n return m ? `{${p}} (${m})` : `{${p}}`;\n }).join(' ')}`\n : '';\n const purpose = meta?.purpose ? ` · ${meta.purpose}` : '';\n // Per-key audience OVERRIDE (rare) — only when it diverges from the unit's\n // `# Audience`; keeps the common case (whole-resource audience) uncluttered.\n const audienceOverride = meta?.audience && meta.audience !== specContext?.audience\n ? ` · audience: ${meta.audience}`\n : '';\n lines.push(` ${key} · ${kind}${purpose}${audienceOverride}${tokens}`);\n for (const note of meta?.notes ?? []) lines.push(` note: ${note}`);\n }\n\n // 3. Style contract — the per-key-kind + casing consistency lever the old\n // prompt entirely lacked.\n lines.push(\n '',\n '# Style — write the SHORTEST natural UI copy. The kind + purpose beside each key is CONTEXT to disambiguate; NEVER restate it in the label.',\n `- Casing: Title Case for \"heading\" keys ONLY. Every other kind uses ${primaryLanguage} sentence case — capitalize the first word and proper nouns only (\"Available credits\", not \"Available Credits\").`,\n '- Length by kind: heading ≤ 4 words (a NOUN PHRASE naming the surface or thing the user is viewing — \"Members\", \"API Keys\", \"Billing\" — NEVER an imperative verb: a heading is a place, not an action, so never \"List members\" / \"Load profile\" / \"View member\"); label ≤ 3 words; button 1–3 words (imperative verb — \"Save\", \"Add task\"); tooltip ≤ 5 words; placeholder ≤ 4 words; description ONE clause ≤ 8 words; empty-state one short line; message one plain sentence; aria one self-contained spoken phrase.',\n '- No trailing punctuation on heading / label / button / placeholder keys. description, empty-state, message and aria keys may end with a period.',\n '- BANNED filler — never use words like: comprehensive, seamless(ly), powerful, robust, intuitive, effortless, easily, simply, quickly, \"our … system\". Never add a location tail (\"in this view\", \"within this interface\", \"from the sidebar\") and never restate the component\\'s own name or section.',\n '- NEVER leak framework/internal jargon into user-facing copy: \"resource\", \"entity\", \"record\", \"object\", \"field\", \"operation\", \"DTO\" name INTERNAL concepts an end-user must never see — even when the purpose/context above uses those words. On a GENERIC surface (no concrete domain noun is named above), use a neutral end-user word (\"item\") or drop the noun entirely. Write \"New\", \"Filter\", \"Create your first item\" — NEVER \"Create New Resource\" / \"Filter Resources\".',\n '- The purpose/meaning beside each key is DEVELOPER context written about the data model — it may say \"owns this\", \"for isolation and scoping\", \"tenant\", \"identifier\", \"first inserted the row\", \"administrative … record\". NEVER echo that register: write in the READER\\'s voice (see # Audience) — what they do or see, never how the system stores it. \"Org tenant for isolation and scoping\" → \"Organization\"; \"User who first inserted the task\" → \"Created by\"; \"Administrative identity record used to manage access\" → \"Users\". Banned as label wording (every audience): data model, record, tenant, persistence, \"in the system\" — and, unless the audience is developer, also identifier/DTO.',\n '- RELATIONSHIPS are not identifiers. A field whose name ends in Id / Ref / UserId, or whose purpose says \"relationship to\" / \"references\" / \"belongs to\", points at another record the user sees BY NAME (the cell shows that record\\'s name, never a code). Label it as the relationship — \"Assignee\", \"Owner\", \"List\", \"Organization\" — strip the Id/Ref suffix and NEVER output the word \"ID\" or an identifier-style caption (\"… Id\", \"… reference\").',\n '- Use the conventional term users already know (Status, Priority, Save, Cancel, Search, Delete) over invented or over-qualified wording. Drop articles (\"the\"/\"a\") and qualifiers already implied by the context above.',\n '- \"aria\" keys are screen-reader phrases: self-contained and natural to read aloud — clarity wins over brevity for these only.',\n );\n\n // 4. Placeholder rules (strict). The runtime only substitutes `{name}` when\n // `name` is a passed param (see `interpolateLabelParams`), so a\n // wrong/invented token renders literally to the user — hence \"exactly\n // these\". The per-key tokens live in the keys block above.\n if (hasPlaceholders) {\n lines.push(\n '',\n '# Placeholders (strict)',\n '- A placeholder is a single-brace token like {current}. For each key, use EXACTLY the tokens listed beside it — same names, each exactly once, in a natural position. Never invent a generic token such as {value}.',\n '- Any key with no placeholders listed takes none: emit plain text with no { } tokens.',\n );\n } else {\n lines.push('', '# Placeholders', '- None of these keys take placeholders: emit plain text with no { } tokens.');\n }\n\n // 5a. Omission correction — the model silently dropped these keys from its\n // previous response. Naming them (rather than re-sending the whole chunk)\n // is what makes the repair pass reliable: it is a short, pointed request\n // against a model that has already produced the rest of this shape.\n if (omittedKeys && omittedKeys.length > 0) {\n lines.push(\n '',\n `# Correction — your previous response left out ${omittedKeys.length} key(s). They are the ONLY keys listed above. Return every one of them.`,\n );\n }\n\n // 5b. Retry correction — explicit per-key fixes from the prior attempt's drift.\n if (priorDrift && priorDrift.length > 0) {\n lines.push('', '# Correction — your previous attempt used the wrong placeholders. Fix EXACTLY these keys:');\n for (const d of priorDrift) {\n const expected = d.expected.length ? d.expected.map((p) => `{${p}}`).join(' ') : 'no placeholders at all';\n const fixes = [`use ${expected}`];\n if (d.unexpected.length) fixes.push(`remove ${d.unexpected.map((p) => `{${p}}`).join(' ')}`);\n if (d.missing.length) fixes.push(`add ${d.missing.map((p) => `{${p}}`).join(' ')}`);\n lines.push(` ${d.key}: ${fixes.join('; ')}`);\n }\n }\n\n lines.push('', 'Return a value for every key. Do not omit any field.');\n return lines.join('\\n');\n }\n\n /**\n * Classify a label key from its leaf name so the prompt can calibrate tone\n * and length. Heuristic but stable: `*aria*` → screen-reader phrase,\n * `*empty*` / `no<Capital>…` → empty state, `*title`/`heading`/`header` →\n * heading, everything else → a plain UI label.\n */\n private inferLabelKind(leaf: string): string {\n if (/aria/i.test(leaf)) return 'aria';\n if (/empty/i.test(leaf) || /^no[A-Z]/.test(leaf)) return 'empty-state';\n if (/title$/i.test(leaf) || /heading|header/i.test(leaf)) return 'heading';\n return 'label';\n }\n\n /**\n * Hash the inputs the LLM sees for this unit. `displayLabel` is part\n * of the prompt (see `buildSystemPrompt` / `buildUserMessage`), so\n * a rename like `OrgPasswordResetForm` → `OrgPasswordResetView` MUST\n * invalidate the lock and trigger a re-labellize — otherwise the\n * primary file would keep reflecting the old name forever.\n */\n private computeInputFingerprint(\n unit: LabellingUnit,\n specContext: LabellingUnitSpecContext | undefined,\n keys: string[],\n ): string {\n // Fold the declared interpolation params into the fingerprint so a change\n // to a label's param contract — including a newly-completed registration —\n // invalidates the lock and forces re-labellization. Otherwise the primary\n // file would keep a value whose placeholders no longer match what the\n // runtime passes (and `--force` would be the only way to refresh it).\n const declaredParams: Record<string, readonly string[]> = {};\n const declaredMeta: Record<string, unknown> = {};\n for (const chunk of unit.chunks) {\n if (chunk.keyParams) {\n for (const [k, p] of Object.entries(chunk.keyParams)) declaredParams[k] = p;\n }\n // Per-key semantic metadata (purpose / kind / param meanings / notes) is\n // fed verbatim into the prompt, so a change to it MUST invalidate the lock\n // and re-labellize — otherwise enriching a component's `.labels.ts` would\n // leave its primary file reflecting the pre-enrichment context.\n if (chunk.keyMeta) {\n for (const [k, m] of Object.entries(chunk.keyMeta)) declaredMeta[k] = m;\n }\n }\n const sortedKeyParams = Object.fromEntries(\n Object.keys(declaredParams)\n .sort()\n .map((k) => [k, [...declaredParams[k]!].sort()]),\n );\n const sortedKeyMeta = Object.fromEntries(\n Object.keys(declaredMeta).sort().map((k) => [k, declaredMeta[k]]),\n );\n return this.lockService.hashFingerprint({\n category: unit.category,\n displayLabel: unit.displayLabel,\n // Prompt style-contract version — folded in so a style-rule change (which\n // does NOT alter any per-unit input) still invalidates every lock and\n // re-labellizes without `--force`. Bump `LABELLIZE_PROMPT_STYLE_VERSION`\n // whenever the `# Style`/`# Audience` contract changes.\n promptStyleVersion: LABELLIZE_PROMPT_STYLE_VERSION,\n keys: [...keys].sort(),\n keyParams: sortedKeyParams,\n keyMeta: sortedKeyMeta,\n spec: specContext\n ? {\n description: specContext.description,\n hints: specContext.hints,\n // Audience change → re-labellize (voice differs) without `--force`.\n audience: specContext.audience,\n }\n : null,\n });\n }\n\n /**\n * Resolve the i18n root for the primary backend service: per-unit\n * files land under `<backend>/src/engine/i18n/<bucket>/<slug>.<locale>.ts`.\n *\n * The backend's engine i18n barrel walks this tree at module load via\n * `scanCustomLabelsDirectory` from `@wildo-ai/saas-backend-lib`. There\n * is no monolithic `labels.<locale>.ts` to write — per-unit files are\n * the runtime source of truth.\n */\n private resolveI18nRoot(): string {\n const backendService = Object.values(this.companionContext.backendServices)[0];\n if (!backendService) {\n throw this.errorBuilder.buildFromStandardError(\n new Error('No backend service configured for per-unit i18n output'),\n undefined,\n {\n customMessageReference: ErrorCustomMessageReference.INTERNAL,\n context: { operation: 'LabellizeOrchestrator.resolveI18nRoot' },\n },\n );\n }\n return path.resolve(this.companionContext.saasRoot, backendService.path, 'src/engine/i18n');\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"translate-orchestrator.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/i18n-labelling/services/translate-orchestrator.companion.service.ts"],"names":[],"mappings":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Y;IAC5B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE/E,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACiB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAXpF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+D;gBAGlC,MAAM,EAAE,aAAa,EACR,YAAY,EAAE,0BAA0B,EACvC,aAAa,EAAE,oBAAoB,EAEpF,gBAAgB,EAAE,uBAAuB,EACS,gBAAgB,EAAE,gBAAgB,EAC3B,OAAO,EAAE,gCAAgC,EAC5C,WAAW,EAAE,6BAA6B,EAC3C,YAAY,EAAE,4BAA4B;IAKrG,SAAS,CACpB,OAAO,EAAE,gBAAgB,EACzB,eAAe,CAAC,EAAE,gCAAgC,GACjD,OAAO,CAAC,kBAAkB,CAAC;YAqIhB,sBAAsB;YA6KtB,cAAc;IAgB5B;;;;;;;OAOG;IACH,OAAO,CAAC,oBAAoB;IA2F5B;;;OAGG;YACW,yBAAyB;IA8CvC;;;;;;OAMG;YACW,kBAAkB;YAkGlB,sBAAsB;IAUpC,OAAO,CAAC,eAAe;CAcxB"}
1
+ {"version":3,"file":"translate-orchestrator.companion.service.d.ts","sourceRoot":"","sources":["../../../../src/i18n-labelling/services/translate-orchestrator.companion.service.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EAClB,KAAK,0BAA0B,EAEhC,MAAM,4BAA4B,CAAC;AAapC,OAAO,EAAE,iBAAiB,EAAqB,MAAM,qCAAqC,CAAC;AAE3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAEzF,OAAO,EAAE,6BAA6B,EAAE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