@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
@@ -29,7 +29,14 @@
29
29
  */
30
30
  import { ErrorBuilderBackendService, LoggerService, type AppConfigurationService } from '@wildo-ai/saas-backend-lib';
31
31
  import type { CompanionContext } from '../context/companion-context';
32
- /** Header carrying the local companion token on mutating requests. */
32
+ /**
33
+ * Header carrying the local companion token on mutating requests.
34
+ *
35
+ * Its CLIENT twin is `COMPANION_TOKEN_HEADER` in
36
+ * `platform/factory/wildo-cli/src/services/companion/companion-local-token.utils.ts`. Two copies,
37
+ * because the CLI and the companion share no package — so the string is a wire contract between them
38
+ * and is named at both ends rather than at neither.
39
+ */
33
40
  export declare const COMPANION_TOKEN_HEADER = "x-wildo-companion-token";
34
41
  /** Token file name under `<saasRoot>/.wildo-saas/state/`. */
35
42
  export declare const COMPANION_TOKEN_FILE_NAME = "companion.token";
@@ -1 +1 @@
1
- {"version":3,"file":"companion-auth-floor.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/core/auth/companion-auth-floor.companion.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAOH,OAAO,EACL,0BAA0B,EAC1B,aAAa,EAEb,KAAK,uBAAuB,EAC7B,MAAM,4BAA4B,CAAC;AAQpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAEhE,6DAA6D;AAC7D,eAAO,MAAM,yBAAyB,oBAAoB,CAAC;AAE3D,qBACa,kCAAkC;IAM3C,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAE7B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAEjC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAXnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+D;IACxF,OAAO,CAAC,mBAAmB,CAAuB;gBAI/B,MAAM,EAAE,aAAa,EAErB,YAAY,EAAE,0BAA0B,EAExC,gBAAgB,EAAE,uBAAuB,EAEzC,gBAAgB,EAAE,gBAAgB;IAKrD;;;;OAIG;IACU,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtD;;;;;;;OAOG;IACI,yBAAyB,IAAI,MAAM;IAwB1C;;;OAGG;IACI,sBAAsB,IAAI,IAAI;IAqBrC;;;;;;OAMG;IACU,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAc3C,gBAAgB,IAAI,MAAM;IAOjC;;;OAGG;IACI,YAAY,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO;IAOhE;;;OAGG;IACI,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC,0BAA0B,CAAC,YAAY,CAAC,CAAC;CAWxG"}
1
+ {"version":3,"file":"companion-auth-floor.companion.service.d.ts","sourceRoot":"","sources":["../../../../src/core/auth/companion-auth-floor.companion.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAOH,OAAO,EACL,0BAA0B,EAC1B,aAAa,EAEb,KAAK,uBAAuB,EAC7B,MAAM,4BAA4B,CAAC;AAQpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAEhE,6DAA6D;AAC7D,eAAO,MAAM,yBAAyB,oBAAoB,CAAC;AAE3D,qBACa,kCAAkC;IAM3C,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAE7B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAEjC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAXnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+D;IACxF,OAAO,CAAC,mBAAmB,CAAuB;gBAI/B,MAAM,EAAE,aAAa,EAErB,YAAY,EAAE,0BAA0B,EAExC,gBAAgB,EAAE,uBAAuB,EAEzC,gBAAgB,EAAE,gBAAgB;IAKrD;;;;OAIG;IACU,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtD;;;;;;;OAOG;IACI,yBAAyB,IAAI,MAAM;IAwB1C;;;OAGG;IACI,sBAAsB,IAAI,IAAI;IAqBrC;;;;;;OAMG;IACU,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAc3C,gBAAgB,IAAI,MAAM;IAOjC;;;OAGG;IACI,YAAY,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO;IAOhE;;;OAGG;IACI,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC,0BAA0B,CAAC,YAAY,CAAC,CAAC;CAWxG"}
@@ -47,7 +47,14 @@ import { ErrorBuilderBackendService, LoggerService, SAAS_SERVICE_TYPES, } from '
47
47
  import { ErrorCustomMessageReference, ErrorType, } from '@wildo-ai/saas-models';
48
48
  import { resolveAppLayout } from '@wildo-ai/platform-config-lib';
49
49
  import { COMPANION_SERVICE_TYPES } from '../inject/models/service-types.js';
50
- /** Header carrying the local companion token on mutating requests. */
50
+ /**
51
+ * Header carrying the local companion token on mutating requests.
52
+ *
53
+ * Its CLIENT twin is `COMPANION_TOKEN_HEADER` in
54
+ * `platform/factory/wildo-cli/src/services/companion/companion-local-token.utils.ts`. Two copies,
55
+ * because the CLI and the companion share no package — so the string is a wire contract between them
56
+ * and is named at both ends rather than at neither.
57
+ */
51
58
  export const COMPANION_TOKEN_HEADER = 'x-wildo-companion-token';
52
59
  /** Token file name under `<saasRoot>/.wildo-saas/state/`. */
53
60
  export const COMPANION_TOKEN_FILE_NAME = 'companion.token';
@@ -1 +1 @@
1
- {"version":3,"file":"companion-auth-floor.companion.service.js","sourceRoot":"","sources":["../../../../../src/core/auth/companion-auth-floor.companion.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;;;;;;;;;;;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,IAA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AI,sBAAsB,kDAAkD;sBAC5E,IAAI,IAAI,CAAC,gBAAgB,EAAE,oBAAoB;aACpD;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA1IY,kCAAkC;IAD9C,UAAU,EAAE;IAMR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAEjC,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAE9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAE3C,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;qCALxB,aAAa;QAEP,0BAA0B;GARhD,kCAAkC,CA0I9C;;AAED,SAAS,cAAc,CAAC,IAAY;IAClC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACrE,IAAI,UAAU,KAAK,WAAW,IAAI,UAAU,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IACpE,IAAI,qBAAqB,CAAC,IAAI,CAAC,UAAU,CAAC;QAAE,OAAO,IAAI,CAAC;IACxD,IAAI,UAAU,CAAC,UAAU,CAAC,aAAa,CAAC;QAAE,OAAO,IAAI,CAAC;IACtD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;AAC7D,CAAC","sourcesContent":["/**\n * Companion API auth floor (meta-workflows P-29 — the master-plan F-6\n * commitment, restored by the 2026-07-02 adversarial review).\n *\n * The companion historically ran with NO authentication (DD-6: local\n * service, HTTP only). That posture ends the moment the API grows\n * endpoints that spend money or run code — the coding-agent dispatch\n * endpoint (Step 4) is the first. This service is the floor:\n *\n * (a) **Loopback-bind invariant** — the engine HTTP server defaults to\n * `host='localhost'`, but that is an accident of the default and is\n * env-overridable (`process.env.HOST`). Startup ASSERTS the resolved\n * host is loopback and fails closed otherwise. There is deliberately\n * NO override env in v1.\n * (b) **Local token** — startup writes a random token to\n * `<saasRoot>/.wildo-saas/state/companion.token` (mode 0600).\n * Mutating new endpoints (dispatch; later journey approve/run)\n * require it via the `X-Wildo-Companion-Token` header. Read-only\n * routes stay open (DD-6 posture unchanged for them).\n *\n * # Known limitation (P-35)\n *\n * The token is MACHINE-LOCAL: same-uid processes — including a dispatched\n * coding-agent run — can read the token file. It proves \"local operator\n * or process acting with local file access\", NOT human presence. The\n * recursion cap on dispatch is therefore enforced structurally by the\n * single-flight workspace-mutation lock, not by the token. Revisit when\n * journeys leave the single-developer machine.\n */\n\nimport { randomBytes, createHash, timingSafeEqual } from 'node:crypto';\nimport { promises as fs } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { inject, injectable } from 'inversify';\nimport {\n ErrorBuilderBackendService,\n LoggerService,\n SAAS_SERVICE_TYPES,\n type AppConfigurationService,\n} from '@wildo-ai/saas-backend-lib';\nimport {\n ErrorCustomMessageReference,\n ErrorType,\n} from '@wildo-ai/saas-models';\nimport { resolveAppLayout } from '@wildo-ai/platform-config-lib';\n\nimport { COMPANION_SERVICE_TYPES } from '../inject/models/service-types';\nimport type { CompanionContext } from '../context/companion-context';\n\n/** Header carrying the local companion token on mutating requests. */\nexport const COMPANION_TOKEN_HEADER = 'x-wildo-companion-token';\n\n/** Token file name under `<saasRoot>/.wildo-saas/state/`. */\nexport const COMPANION_TOKEN_FILE_NAME = 'companion.token';\n\n@injectable()\nexport class CompanionAuthFloorCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n private expectedTokenDigest: Buffer | null = null;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger)\n private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService)\n private readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService)\n private readonly appConfigService: AppConfigurationService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext)\n private readonly companionContext: CompanionContext,\n ) {\n this.logDebug = this.logger.debugByType('CompanionAuthFloorCompanionService');\n }\n\n /**\n * Startup hook — MUST run after the app config is hydrated and BEFORE\n * the HTTP server starts listening. Fails closed: a non-loopback\n * resolved host throws and aborts companion startup.\n */\n public async enforceStartupInvariants(): Promise<void> {\n this.assertLoopbackHttpHost();\n await this.ensureCompanionToken();\n }\n\n /**\n * Replicates the engine HTTP server's host resolution\n * (`http-server.backend.service.ts > startServer`): hostname of the\n * service's `runtime.endPoints[serviceName].internalUrl` (default\n * `localhost`), then `process.env.HOST` override. Kept in lockstep by\n * the auth-floor unit tests — if the engine resolution changes, this\n * must follow.\n */\n public resolveConfiguredHttpHost(): string {\n let host = 'localhost';\n\n const serviceName = this.appConfigService.serviceName;\n const endpointString: string | undefined = serviceName\n ? (this.appConfigService.config as unknown as {\n runtime?: { endPoints?: Record<string, { internalUrl?: string }> };\n })?.runtime?.endPoints?.[serviceName]?.internalUrl\n : undefined;\n\n try {\n const urlString = endpointString && endpointString.includes('://')\n ? endpointString\n : `http://${endpointString || 'localhost:4000'}`;\n const url = new URL(urlString);\n host = url.hostname || host;\n } catch {\n // Malformed endpoint string — same silent fallback as the engine.\n }\n\n if (process.env.HOST) host = process.env.HOST;\n return host;\n }\n\n /**\n * Fail-closed loopback assertion (P-29a). `0.0.0.0` / `::` /\n * LAN addresses all refuse startup — there is NO override env in v1.\n */\n public assertLoopbackHttpHost(): void {\n const host = this.resolveConfiguredHttpHost();\n if (isLoopbackHost(host)) {\n this.logDebug('Companion HTTP host is loopback', { host });\n return;\n }\n\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n message:\n `Companion refuses to start: resolved HTTP host '${host}' is not loopback. `\n + `The companion API now hosts endpoints that spend money and execute code `\n + `(coding-agent dispatch), so it must never bind beyond this machine (P-29). `\n + `Fix the authored devCompanion.host (infrastructure/<env> config) and/or the `\n + `HOST env var to 'localhost' / '127.0.0.1'. There is no override in v1.`,\n resolvedHost: host,\n },\n });\n }\n\n /**\n * Write a fresh random token to\n * `<saasRoot>/.wildo-saas/state/companion.token` (0600) and keep its\n * digest in memory for request validation. A new token is minted on\n * every companion boot — clients read the file per call, so rotation\n * is free.\n */\n public async ensureCompanionToken(): Promise<void> {\n const tokenFilePath = this.getTokenFilePath();\n const token = randomBytes(32).toString('hex');\n\n await fs.mkdir(join(tokenFilePath, '..'), { recursive: true });\n await fs.writeFile(tokenFilePath, `${token}\\n`, { encoding: 'utf8', mode: 0o600 });\n // `writeFile` only applies `mode` at creation — force it for\n // pre-existing files from earlier boots.\n await fs.chmod(tokenFilePath, 0o600);\n\n this.expectedTokenDigest = sha256Digest(token);\n this.logDebug('Companion token written', { tokenFilePath });\n }\n\n public getTokenFilePath(): string {\n return join(\n resolveAppLayout(this.companionContext.saasRoot).stateHome,\n COMPANION_TOKEN_FILE_NAME,\n );\n }\n\n /**\n * Constant-time token check (digest comparison sidesteps length leaks).\n * Returns false when the floor was never initialized — fail closed.\n */\n public isValidToken(presentedToken: string | undefined): boolean {\n if (!presentedToken || !this.expectedTokenDigest) {\n return false;\n }\n return timingSafeEqual(sha256Digest(presentedToken.trim()), this.expectedTokenDigest);\n }\n\n /**\n * Build the 401 used by the token middleware on mutating routes.\n * Centralized here so the message stays consistent across endpoints.\n */\n public buildUnauthorizedError(routeLabel: string): ReturnType<ErrorBuilderBackendService['buildError']> {\n return this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION,\n context: {\n message:\n `'${routeLabel}' is a mutating companion endpoint and requires the `\n + `'${COMPANION_TOKEN_HEADER}' header (P-29 auth floor). Read the token from `\n + `'${this.getTokenFilePath()}' on this machine.`,\n },\n });\n }\n}\n\nfunction isLoopbackHost(host: string): boolean {\n const normalized = host.trim().toLowerCase().replace(/^\\[|\\]$/g, '');\n if (normalized === 'localhost' || normalized === '::1') return true;\n if (/^127(\\.\\d{1,3}){3}$/.test(normalized)) return true;\n if (normalized.startsWith('::ffff:127.')) return true;\n return false;\n}\n\nfunction sha256Digest(value: string): Buffer {\n return createHash('sha256').update(value, 'utf8').digest();\n}\n"]}
1
+ {"version":3,"file":"companion-auth-floor.companion.service.js","sourceRoot":"","sources":["../../../../src/core/auth/companion-auth-floor.companion.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;;;;;;;;;;;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,kBAAkB,GAEnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,2BAA2B,EAC3B,SAAS,GACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAGzE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;AAEhE,6DAA6D;AAC7D,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAGpD,IAAM,kCAAkC,GAAxC,MAAM,kCAAkC;IAM1B;IAEA;IAEA;IAEA;IAXF,QAAQ,CAA+D;IAChF,mBAAmB,GAAkB,IAAI,CAAC;IAElD,YAEmB,MAAqB,EAErB,YAAwC,EAExC,gBAAyC,EAEzC,gBAAkC;QANlC,WAAM,GAAN,MAAM,CAAe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AC,UAAU,CAAC;QAAE,OAAO,IAAI,CAAC;IACxD,IAAI,UAAU,CAAC,UAAU,CAAC,aAAa,CAAC;QAAE,OAAO,IAAI,CAAC;IACtD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;AAC7D,CAAC","sourcesContent":["/**\n * Companion API auth floor (meta-workflows P-29 — the master-plan F-6\n * commitment, restored by the 2026-07-02 adversarial review).\n *\n * The companion historically ran with NO authentication (DD-6: local\n * service, HTTP only). That posture ends the moment the API grows\n * endpoints that spend money or run code — the coding-agent dispatch\n * endpoint (Step 4) is the first. This service is the floor:\n *\n * (a) **Loopback-bind invariant** — the engine HTTP server defaults to\n * `host='localhost'`, but that is an accident of the default and is\n * env-overridable (`process.env.HOST`). Startup ASSERTS the resolved\n * host is loopback and fails closed otherwise. There is deliberately\n * NO override env in v1.\n * (b) **Local token** — startup writes a random token to\n * `<saasRoot>/.wildo-saas/state/companion.token` (mode 0600).\n * Mutating new endpoints (dispatch; later journey approve/run)\n * require it via the `X-Wildo-Companion-Token` header. Read-only\n * routes stay open (DD-6 posture unchanged for them).\n *\n * # Known limitation (P-35)\n *\n * The token is MACHINE-LOCAL: same-uid processes — including a dispatched\n * coding-agent run — can read the token file. It proves \"local operator\n * or process acting with local file access\", NOT human presence. The\n * recursion cap on dispatch is therefore enforced structurally by the\n * single-flight workspace-mutation lock, not by the token. Revisit when\n * journeys leave the single-developer machine.\n */\n\nimport { randomBytes, createHash, timingSafeEqual } from 'node:crypto';\nimport { promises as fs } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { inject, injectable } from 'inversify';\nimport {\n ErrorBuilderBackendService,\n LoggerService,\n SAAS_SERVICE_TYPES,\n type AppConfigurationService,\n} from '@wildo-ai/saas-backend-lib';\nimport {\n ErrorCustomMessageReference,\n ErrorType,\n} from '@wildo-ai/saas-models';\nimport { resolveAppLayout } from '@wildo-ai/platform-config-lib';\n\nimport { COMPANION_SERVICE_TYPES } from '../inject/models/service-types';\nimport type { CompanionContext } from '../context/companion-context';\n\n/**\n * Header carrying the local companion token on mutating requests.\n *\n * Its CLIENT twin is `COMPANION_TOKEN_HEADER` in\n * `platform/factory/wildo-cli/src/services/companion/companion-local-token.utils.ts`. Two copies,\n * because the CLI and the companion share no package — so the string is a wire contract between them\n * and is named at both ends rather than at neither.\n */\nexport const COMPANION_TOKEN_HEADER = 'x-wildo-companion-token';\n\n/** Token file name under `<saasRoot>/.wildo-saas/state/`. */\nexport const COMPANION_TOKEN_FILE_NAME = 'companion.token';\n\n@injectable()\nexport class CompanionAuthFloorCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n private expectedTokenDigest: Buffer | null = null;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger)\n private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService)\n private readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService)\n private readonly appConfigService: AppConfigurationService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext)\n private readonly companionContext: CompanionContext,\n ) {\n this.logDebug = this.logger.debugByType('CompanionAuthFloorCompanionService');\n }\n\n /**\n * Startup hook — MUST run after the app config is hydrated and BEFORE\n * the HTTP server starts listening. Fails closed: a non-loopback\n * resolved host throws and aborts companion startup.\n */\n public async enforceStartupInvariants(): Promise<void> {\n this.assertLoopbackHttpHost();\n await this.ensureCompanionToken();\n }\n\n /**\n * Replicates the engine HTTP server's host resolution\n * (`http-server.backend.service.ts > startServer`): hostname of the\n * service's `runtime.endPoints[serviceName].internalUrl` (default\n * `localhost`), then `process.env.HOST` override. Kept in lockstep by\n * the auth-floor unit tests — if the engine resolution changes, this\n * must follow.\n */\n public resolveConfiguredHttpHost(): string {\n let host = 'localhost';\n\n const serviceName = this.appConfigService.serviceName;\n const endpointString: string | undefined = serviceName\n ? (this.appConfigService.config as unknown as {\n runtime?: { endPoints?: Record<string, { internalUrl?: string }> };\n })?.runtime?.endPoints?.[serviceName]?.internalUrl\n : undefined;\n\n try {\n const urlString = endpointString && endpointString.includes('://')\n ? endpointString\n : `http://${endpointString || 'localhost:4000'}`;\n const url = new URL(urlString);\n host = url.hostname || host;\n } catch {\n // Malformed endpoint string — same silent fallback as the engine.\n }\n\n if (process.env.HOST) host = process.env.HOST;\n return host;\n }\n\n /**\n * Fail-closed loopback assertion (P-29a). `0.0.0.0` / `::` /\n * LAN addresses all refuse startup — there is NO override env in v1.\n */\n public assertLoopbackHttpHost(): void {\n const host = this.resolveConfiguredHttpHost();\n if (isLoopbackHost(host)) {\n this.logDebug('Companion HTTP host is loopback', { host });\n return;\n }\n\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n message:\n `Companion refuses to start: resolved HTTP host '${host}' is not loopback. `\n + `The companion API now hosts endpoints that spend money and execute code `\n + `(coding-agent dispatch), so it must never bind beyond this machine (P-29). `\n + `Fix the authored devCompanion.host (infrastructure/<env> config) and/or the `\n + `HOST env var to 'localhost' / '127.0.0.1'. There is no override in v1.`,\n resolvedHost: host,\n },\n });\n }\n\n /**\n * Write a fresh random token to\n * `<saasRoot>/.wildo-saas/state/companion.token` (0600) and keep its\n * digest in memory for request validation. A new token is minted on\n * every companion boot — clients read the file per call, so rotation\n * is free.\n */\n public async ensureCompanionToken(): Promise<void> {\n const tokenFilePath = this.getTokenFilePath();\n const token = randomBytes(32).toString('hex');\n\n await fs.mkdir(join(tokenFilePath, '..'), { recursive: true });\n await fs.writeFile(tokenFilePath, `${token}\\n`, { encoding: 'utf8', mode: 0o600 });\n // `writeFile` only applies `mode` at creation — force it for\n // pre-existing files from earlier boots.\n await fs.chmod(tokenFilePath, 0o600);\n\n this.expectedTokenDigest = sha256Digest(token);\n this.logDebug('Companion token written', { tokenFilePath });\n }\n\n public getTokenFilePath(): string {\n return join(\n resolveAppLayout(this.companionContext.saasRoot).stateHome,\n COMPANION_TOKEN_FILE_NAME,\n );\n }\n\n /**\n * Constant-time token check (digest comparison sidesteps length leaks).\n * Returns false when the floor was never initialized — fail closed.\n */\n public isValidToken(presentedToken: string | undefined): boolean {\n if (!presentedToken || !this.expectedTokenDigest) {\n return false;\n }\n return timingSafeEqual(sha256Digest(presentedToken.trim()), this.expectedTokenDigest);\n }\n\n /**\n * Build the 401 used by the token middleware on mutating routes.\n * Centralized here so the message stays consistent across endpoints.\n */\n public buildUnauthorizedError(routeLabel: string): ReturnType<ErrorBuilderBackendService['buildError']> {\n return this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION,\n context: {\n message:\n `'${routeLabel}' is a mutating companion endpoint and requires the `\n + `'${COMPANION_TOKEN_HEADER}' header (P-29 auth floor). Read the token from `\n + `'${this.getTokenFilePath()}' on this machine.`,\n },\n });\n }\n}\n\nfunction isLoopbackHost(host: string): boolean {\n const normalized = host.trim().toLowerCase().replace(/^\\[|\\]$/g, '');\n if (normalized === 'localhost' || normalized === '::1') return true;\n if (/^127(\\.\\d{1,3}){3}$/.test(normalized)) return true;\n if (normalized.startsWith('::ffff:127.')) return true;\n return false;\n}\n\nfunction sha256Digest(value: string): Buffer {\n return createHash('sha256').update(value, 'utf8').digest();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAY5E,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,gDAAgD,CAAC;AAGvG,MAAM,WAAW,kCAAkC;IACjD,UAAU,EAAE,wBAAwB,CAAC,UAAU,CAAC;IAChD,KAAK,EAAE,gCAAgC,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,kCAAkC,GACxC,0BAA0B,CAwC5B"}
1
+ {"version":3,"file":"catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../src/core/catalogs/catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAY5E,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,gDAAgD,CAAC;AAGvG,MAAM,WAAW,kCAAkC;IACjD,UAAU,EAAE,wBAAwB,CAAC,UAAU,CAAC;IAChD,KAAK,EAAE,gCAAgC,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,kCAAkC,GACxC,0BAA0B,CAwC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"catalog-context.factory.models.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/catalog-context.factory.models.ts"],"names":[],"mappings":"AAAA,oBAAY,wBAAwB;IAClC,UAAU,eAAe;CAC1B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,wBAAwB,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB"}
1
+ {"version":3,"file":"catalog-context.factory.models.d.ts","sourceRoot":"","sources":["../../../../src/core/catalogs/catalog-context.factory.models.ts"],"names":[],"mappings":"AAAA,oBAAY,wBAAwB;IAClC,UAAU,eAAe;CAC1B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,wBAAwB,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB"}
@@ -1 +1 @@
1
- {"version":3,"file":"aggregate-offer-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../../src/core/catalogs/schema-org/aggregate-offer-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,gBAAgB,CAAA;CAAE,GACtE,0BAA0B,CAE5B"}
1
+ {"version":3,"file":"aggregate-offer-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/aggregate-offer-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,gBAAgB,CAAA;CAAE,GACtE,0BAA0B,CAE5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"aggregate-rating-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../../src/core/catalogs/schema-org/aggregate-rating-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,iBAAiB,CAAA;CAAE,GACvE,0BAA0B,CAE5B"}
1
+ {"version":3,"file":"aggregate-rating-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/aggregate-rating-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,iBAAiB,CAAA;CAAE,GACvE,0BAA0B,CAE5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"article-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../../src/core/catalogs/schema-org/article-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GAC/D,0BAA0B,CAE5B"}
1
+ {"version":3,"file":"article-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/article-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GAC/D,0BAA0B,CAE5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"blog-posting-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../../src/core/catalogs/schema-org/blog-posting-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,aAAa,CAAA;CAAE,GACnE,0BAA0B,CAE5B"}
1
+ {"version":3,"file":"blog-posting-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/blog-posting-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,aAAa,CAAA;CAAE,GACnE,0BAA0B,CAE5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"breadcrumb-list-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../../src/core/catalogs/schema-org/breadcrumb-list-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,gBAAgB,CAAA;CAAE,GACtE,0BAA0B,CAE5B"}
1
+ {"version":3,"file":"breadcrumb-list-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/breadcrumb-list-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,gBAAgB,CAAA;CAAE,GACtE,0BAA0B,CAE5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"faq-page-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../../src/core/catalogs/schema-org/faq-page-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GAC/D,0BAA0B,CAE5B"}
1
+ {"version":3,"file":"faq-page-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/faq-page-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GAC/D,0BAA0B,CAE5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"offer-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../../src/core/catalogs/schema-org/offer-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAC7D,0BAA0B,CAE5B"}
1
+ {"version":3,"file":"offer-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/offer-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAC7D,0BAA0B,CAE5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"organization-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../../src/core/catalogs/schema-org/organization-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,cAAc,CAAA;CAAE,GACpE,0BAA0B,CAE5B"}
1
+ {"version":3,"file":"organization-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/organization-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,cAAc,CAAA;CAAE,GACpE,0BAA0B,CAE5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"product-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../../src/core/catalogs/schema-org/product-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GAC/D,0BAA0B,CAE5B"}
1
+ {"version":3,"file":"product-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/product-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GAC/D,0BAA0B,CAE5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"review-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../../src/core/catalogs/schema-org/review-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,GAC9D,0BAA0B,CAE5B"}
1
+ {"version":3,"file":"review-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/review-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,GAC9D,0BAA0B,CAE5B"}
@@ -0,0 +1,34 @@
1
+ import type { SchemaOrgCatalogContextEntryLike } from './schema-org-catalog-context.shared';
2
+ /**
3
+ * The single place a Schema.org catalog crosses from the application's specifications package
4
+ * into the companion's renderer.
5
+ *
6
+ * ## Why this exists
7
+ *
8
+ * The catalog arrives from a DYNAMIC IMPORT of the application's specifications package, so the
9
+ * compiler knows nothing about it. Both consumers previously typed that boundary with a locally
10
+ * declared minimum (`{ '@type': string }`) and then bridged the gap to the renderer with
11
+ *
12
+ * ```ts
13
+ * entry: entry as Parameters<typeof renderCatalogEntryContextPart>[0]['entry'],
14
+ * ```
15
+ *
16
+ * which asserts — never checks — that an unvalidated runtime value has the twelve fields the
17
+ * renderer will read. The schema built for exactly this job was going unused, and its own docstring
18
+ * says why that is the wrong trade: *"the module-load validation is the cheapest possible signal
19
+ * that catches every shape drift the TypeScript compiler can't."*
20
+ *
21
+ * So the assertion is replaced by a parse. After it, the renderer's input type is EARNED rather
22
+ * than claimed, and a malformed entry names itself instead of surfacing later as an undefined
23
+ * field inside rendered markdown.
24
+ *
25
+ * ## One helper, deliberately
26
+ *
27
+ * There are two crossings — the structured-data audit service and the introspection subprocess
28
+ * handler — and they had byte-identical casts. Validating at one and not the other would leave the
29
+ * second asserting the same unvalidated boundary, which is the defect shape
30
+ * `.claude/rules/invariant-call-site-enumeration.md` exists to prevent. The parse lives here so
31
+ * neither call site can express the boundary its own way.
32
+ */
33
+ export declare function parseSchemaOrgCatalogEntries(catalog: readonly unknown[], sourceDescription: string): readonly SchemaOrgCatalogContextEntryLike[];
34
+ //# sourceMappingURL=schema-org-catalog-boundary.shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-org-catalog-boundary.shared.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/schema-org-catalog-boundary.shared.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AAE5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,SAAS,OAAO,EAAE,EAC3B,iBAAiB,EAAE,MAAM,GACxB,SAAS,gCAAgC,EAAE,CAmC7C"}
@@ -0,0 +1,65 @@
1
+ import { SchemaOrgCatalogEntryBaseSchema } from '@wildo-ai/saas-specifications';
2
+ /**
3
+ * The single place a Schema.org catalog crosses from the application's specifications package
4
+ * into the companion's renderer.
5
+ *
6
+ * ## Why this exists
7
+ *
8
+ * The catalog arrives from a DYNAMIC IMPORT of the application's specifications package, so the
9
+ * compiler knows nothing about it. Both consumers previously typed that boundary with a locally
10
+ * declared minimum (`{ '@type': string }`) and then bridged the gap to the renderer with
11
+ *
12
+ * ```ts
13
+ * entry: entry as Parameters<typeof renderCatalogEntryContextPart>[0]['entry'],
14
+ * ```
15
+ *
16
+ * which asserts — never checks — that an unvalidated runtime value has the twelve fields the
17
+ * renderer will read. The schema built for exactly this job was going unused, and its own docstring
18
+ * says why that is the wrong trade: *"the module-load validation is the cheapest possible signal
19
+ * that catches every shape drift the TypeScript compiler can't."*
20
+ *
21
+ * So the assertion is replaced by a parse. After it, the renderer's input type is EARNED rather
22
+ * than claimed, and a malformed entry names itself instead of surfacing later as an undefined
23
+ * field inside rendered markdown.
24
+ *
25
+ * ## One helper, deliberately
26
+ *
27
+ * There are two crossings — the structured-data audit service and the introspection subprocess
28
+ * handler — and they had byte-identical casts. Validating at one and not the other would leave the
29
+ * second asserting the same unvalidated boundary, which is the defect shape
30
+ * `.claude/rules/invariant-call-site-enumeration.md` exists to prevent. The parse lives here so
31
+ * neither call site can express the boundary its own way.
32
+ */
33
+ export function parseSchemaOrgCatalogEntries(catalog, sourceDescription) {
34
+ return catalog.map((entry, index) => {
35
+ const parsed = SchemaOrgCatalogEntryBaseSchema.safeParse(entry);
36
+ if (!parsed.success) {
37
+ /*
38
+ * Name the offending entry by its `@type` when the value carries a readable one, and fall
39
+ * back to its index when it does not — a catalog whose entry is not even an object is
40
+ * exactly the case where "which entry?" is hardest to answer from the Zod issues alone.
41
+ */
42
+ const declaredType = typeof entry === 'object' && entry !== null && typeof entry['@type'] === 'string'
43
+ ? `@type="${entry['@type']}"`
44
+ : `index ${index}`;
45
+ throw new Error(`Schema.org catalog entry ${declaredType} from ${sourceDescription} does not satisfy `
46
+ + `SchemaOrgCatalogEntryBaseSchema: ${parsed.error.issues.map((issue) => `${issue.path.join('.') || '<root>'}: ${issue.message}`).join('; ')}`);
47
+ }
48
+ /*
49
+ * `SchemaOrgCatalogEntryBase` types `@type` as the WHOLE `SchemaOrgEntityKind` union, while the
50
+ * renderer's input is the same shape DISTRIBUTED over that union — one member per kind. The two
51
+ * describe an identical set of values, and TypeScript cannot derive one from the other, so a
52
+ * single narrowing is unavoidable.
53
+ *
54
+ * It sits HERE, one line after a successful parse of every field the renderer reads, rather
55
+ * than at each consumer where it asserted an unchecked value. That is the whole difference this
56
+ * change makes: the narrowing is now backed by a runtime check instead of standing in for one.
57
+ *
58
+ * The distribution is not cosmetic — it is what makes the renderer's `const unhandledEntry:
59
+ * never = input.entry` exhaustiveness check compile, so a thirteenth entity kind added to
60
+ * `SchemaOrgEntityKindSchema` becomes a build error rather than a runtime throw.
61
+ */
62
+ return parsed.data;
63
+ });
64
+ }
65
+ //# sourceMappingURL=schema-org-catalog-boundary.shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-org-catalog-boundary.shared.js","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/schema-org-catalog-boundary.shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAIhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,4BAA4B,CAC1C,OAA2B,EAC3B,iBAAyB;IAEzB,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAClC,MAAM,MAAM,GAAG,+BAA+B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAChE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB;;;;eAIG;YACH,MAAM,YAAY,GAChB,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAQ,KAA+B,CAAC,OAAO,CAAC,KAAK,QAAQ;gBAC1G,CAAC,CAAC,UAAW,KAA6B,CAAC,OAAO,CAAC,GAAG;gBACtD,CAAC,CAAC,SAAS,KAAK,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CACb,4BAA4B,YAAY,SAAS,iBAAiB,oBAAoB;kBAClF,oCAAoC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACjJ,CAAC;QACJ,CAAC;QAED;;;;;;;;;;;;;WAaG;QACH,OAAO,MAAM,CAAC,IAAwC,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { SchemaOrgCatalogEntryBaseSchema } from '@wildo-ai/saas-specifications';\n\nimport type { SchemaOrgCatalogContextEntryLike } from './schema-org-catalog-context.shared';\n\n/**\n * The single place a Schema.org catalog crosses from the application's specifications package\n * into the companion's renderer.\n *\n * ## Why this exists\n *\n * The catalog arrives from a DYNAMIC IMPORT of the application's specifications package, so the\n * compiler knows nothing about it. Both consumers previously typed that boundary with a locally\n * declared minimum (`{ '@type': string }`) and then bridged the gap to the renderer with\n *\n * ```ts\n * entry: entry as Parameters<typeof renderCatalogEntryContextPart>[0]['entry'],\n * ```\n *\n * which asserts — never checks — that an unvalidated runtime value has the twelve fields the\n * renderer will read. The schema built for exactly this job was going unused, and its own docstring\n * says why that is the wrong trade: *\"the module-load validation is the cheapest possible signal\n * that catches every shape drift the TypeScript compiler can't.\"*\n *\n * So the assertion is replaced by a parse. After it, the renderer's input type is EARNED rather\n * than claimed, and a malformed entry names itself instead of surfacing later as an undefined\n * field inside rendered markdown.\n *\n * ## One helper, deliberately\n *\n * There are two crossings — the structured-data audit service and the introspection subprocess\n * handler — and they had byte-identical casts. Validating at one and not the other would leave the\n * second asserting the same unvalidated boundary, which is the defect shape\n * `.claude/rules/invariant-call-site-enumeration.md` exists to prevent. The parse lives here so\n * neither call site can express the boundary its own way.\n */\nexport function parseSchemaOrgCatalogEntries(\n catalog: readonly unknown[],\n sourceDescription: string,\n): readonly SchemaOrgCatalogContextEntryLike[] {\n return catalog.map((entry, index) => {\n const parsed = SchemaOrgCatalogEntryBaseSchema.safeParse(entry);\n if (!parsed.success) {\n /*\n * Name the offending entry by its `@type` when the value carries a readable one, and fall\n * back to its index when it does not — a catalog whose entry is not even an object is\n * exactly the case where \"which entry?\" is hardest to answer from the Zod issues alone.\n */\n const declaredType =\n typeof entry === 'object' && entry !== null && typeof (entry as { '@type'?: unknown })['@type'] === 'string'\n ? `@type=\"${(entry as { '@type': string })['@type']}\"`\n : `index ${index}`;\n throw new Error(\n `Schema.org catalog entry ${declaredType} from ${sourceDescription} does not satisfy `\n + `SchemaOrgCatalogEntryBaseSchema: ${parsed.error.issues.map((issue) => `${issue.path.join('.') || '<root>'}: ${issue.message}`).join('; ')}`,\n );\n }\n\n /*\n * `SchemaOrgCatalogEntryBase` types `@type` as the WHOLE `SchemaOrgEntityKind` union, while the\n * renderer's input is the same shape DISTRIBUTED over that union — one member per kind. The two\n * describe an identical set of values, and TypeScript cannot derive one from the other, so a\n * single narrowing is unavoidable.\n *\n * It sits HERE, one line after a successful parse of every field the renderer reads, rather\n * than at each consumer where it asserted an unchecked value. That is the whole difference this\n * change makes: the narrowing is now backed by a runtime check instead of standing in for one.\n *\n * The distribution is not cosmetic — it is what makes the renderer's `const unhandledEntry:\n * never = input.entry` exhaustiveness check compile, so a thirteenth entity kind added to\n * `SchemaOrgEntityKindSchema` becomes a build error rather than a runtime throw.\n */\n return parsed.data as SchemaOrgCatalogContextEntryLike;\n });\n}\n"]}
@@ -1,5 +1,15 @@
1
+ import type { SchemaOrgEntityKind } from '@wildo-ai/saas-specifications';
1
2
  import type { CatalogMarkdownContextPart } from '../catalog-context.factory.models';
2
- export type SchemaOrgCatalogContextEntryKind = 'Article' | 'BlogPosting' | 'FAQPage' | 'Product' | 'Offer' | 'AggregateOffer' | 'Organization' | 'BreadcrumbList' | 'Review' | 'AggregateRating' | 'WebSite' | 'SoftwareApplication';
3
+ /**
4
+ * The renderer's entity vocabulary IS the engine's, never a copy of it.
5
+ *
6
+ * This restated all twelve members by hand, which is the shape `CLAUDE.md` forbids under "closed
7
+ * semantic vocabularies must have one named runtime source". The cost was not duplication for its
8
+ * own sake: a thirteenth member added to `SchemaOrgEntityKindSchema` compiled on the engine side
9
+ * and was silently unrenderable here, with nothing to report it. Deriving makes that a build error
10
+ * in the renderer's exhaustive switch instead.
11
+ */
12
+ export type SchemaOrgCatalogContextEntryKind = SchemaOrgEntityKind;
3
13
  interface SchemaOrgCatalogContextEntryBaseLike {
4
14
  schemaOrgUrl: string;
5
15
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"schema-org-catalog-context.shared.d.ts","sourceRoot":"","sources":["../../../../../../src/core/catalogs/schema-org/schema-org-catalog-context.shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAQpF,MAAM,MAAM,gCAAgC,GACxC,SAAS,GACT,aAAa,GACb,SAAS,GACT,SAAS,GACT,OAAO,GACP,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,QAAQ,GACR,iBAAiB,GACjB,SAAS,GACT,qBAAqB,CAAC;AAE1B,UAAU,oCAAoC;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,gBAAgB,EAAE,SAAS;QACzB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,eAAe,EAAE,MAAM,CAAC;KACzB,EAAE,CAAC;CACL;AAED,MAAM,MAAM,gCAAgC,GAAG;KAC5C,KAAK,IAAI,gCAAgC,GAAG,oCAAoC,GAAG;QAClF,OAAO,EAAE,KAAK,CAAC;KAChB;CACF,CAAC,gCAAgC,CAAC,CAAC;AAEpC,MAAM,MAAM,mCAAmC,GAAG,OAAO,CACvD,gCAAgC,EAChC;IAAE,OAAO,EAAE,qBAAqB,CAAA;CAAE,CACnC,CAAC;AAkWF;;;;;;GAMG;AACH,wBAAgB,sCAAsC,CAAC,MAAM,SAAS,gCAAgC,EACpG,KAAK,EAAE,MAAM,GACZ,0BAA0B,CAkC5B"}
1
+ {"version":3,"file":"schema-org-catalog-context.shared.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/schema-org-catalog-context.shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAQpF;;;;;;;;GAQG;AACH,MAAM,MAAM,gCAAgC,GAAG,mBAAmB,CAAC;AAEnE,UAAU,oCAAoC;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,gBAAgB,EAAE,SAAS;QACzB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,eAAe,EAAE,MAAM,CAAC;KACzB,EAAE,CAAC;CACL;AAED,MAAM,MAAM,gCAAgC,GAAG;KAC5C,KAAK,IAAI,gCAAgC,GAAG,oCAAoC,GAAG;QAClF,OAAO,EAAE,KAAK,CAAC;KAChB;CACF,CAAC,gCAAgC,CAAC,CAAC;AAEpC,MAAM,MAAM,mCAAmC,GAAG,OAAO,CACvD,gCAAgC,EAChC;IAAE,OAAO,EAAE,qBAAqB,CAAA;CAAE,CACnC,CAAC;AAkWF;;;;;;GAMG;AACH,wBAAgB,sCAAsC,CAAC,MAAM,SAAS,gCAAgC,EACpG,KAAK,EAAE,MAAM,GACZ,0BAA0B,CAkC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"schema-org-catalog-context.shared.js","sourceRoot":"","sources":["../../../../../../src/core/catalogs/schema-org/schema-org-catalog-context.shared.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,OAAO,EACL,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,2DAA2D,CAAC;AA+DnE,MAAM,mCAAmC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgD3C,CAAC;AAEF,MAAM,6BAA6B,GAAG,uBAAuB,CAC3D,mCAAmC,CACpC,CAAC;AAEF,MAAM,+BAA+B,GAAqD;IACxF,OAAO,EAAE,8EAA8E;IACvF,WAAW,EAAE,8EAA8E;IAC3F,OAAO,EAAE,8EAA8E;IACvF,OAAO,EAAE,sFAAsF;IAC/F,KAAK,EAAE,sFAAsF;IAC7F,cAAc,EAAE,sFAAsF;IACtG,YAAY,EAAE,4FAA4F;IAC1G,cAAc,EAAE,iFAAiF;IACjG,MAAM,EAAE,sFAAsF;IAC9F,eAAe,EAAE,sFAAsF;IACvG,OAAO,EAAE,4FAA4F;IACrG,mBAAmB,EAAE,4FAA4F;CAClH,CAAC;AAEF,MAAM,4BAA4B,GAA+E;IAC/G,OAAO,EAAE;QACP,OAAO,EACL,iIAAiI;QACnI,SAAS,EACP,0IAA0I;QAC5I,iBAAiB,EAAE;YACjB,6FAA6F;YAC7F,kFAAkF;YAClF,uFAAuF;SACxF;QACD,oBAAoB,EAAE;YACpB,gHAAgH;YAChH,iFAAiF;SAClF;QACD,sBAAsB,EAAE,+BAA+B,CAAC,OAAO;KAChE;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B,CAAC,KAAK,CAAC,CAAC,CACvE,CAAC;IAEF,OAAO;QACL,UAAU,EAAE,wBAAwB,CAAC,UAAU;QAC/C,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC;QACzB,KAAK;QACL,QAAQ,EAAE,6BAA6B,CAAC;YACtC,KAAK;YACL,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,sBAAsB,EAAE,SAAS,CAAC,sBAAsB;YACxD,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,SAAS,EAAE,SAAS,CAAC,SAAS;YAC9B,iBAAiB,EAAE,mBAAmB,CAAC,CAAC,GAAG,SAAS,CAAC,iBAAiB,CAAC,CAAC,IAAI,EAAE;YAC9E,oBAAoB,EAAE,mBAAmB,CAAC,CAAC,GAAG,SAAS,CAAC,oBAAoB,CAAC,CAAC,IAAI,EAAE;YACpF,kBAAkB,EAAE,kBAAkB,IAAI,EAAE;YAC5C,kBAAkB;YAClB,oBAAoB;YACpB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;SACzC,CAAC;KACH,CAAC;AACJ,CAAC","sourcesContent":["import type { CatalogMarkdownContextPart } from '../catalog-context.factory.models';\nimport { CatalogContextVocabulary } from '../catalog-context.factory.models';\nimport type { MarkdownListItem } from '../../specifications/specification-context-factory.shared';\nimport {\n compileMarkdownTemplate,\n toMarkdownListItems,\n} from '../../specifications/specification-context-factory.shared';\n\nexport type SchemaOrgCatalogContextEntryKind =\n | 'Article'\n | 'BlogPosting'\n | 'FAQPage'\n | 'Product'\n | 'Offer'\n | 'AggregateOffer'\n | 'Organization'\n | 'BreadcrumbList'\n | 'Review'\n | 'AggregateRating'\n | 'WebSite'\n | 'SoftwareApplication';\n\ninterface SchemaOrgCatalogContextEntryBaseLike {\n schemaOrgUrl: string;\n description: string;\n developmentNotes?: string;\n requiredFields: readonly string[];\n optionalFields: readonly string[];\n deprecatedFields: readonly {\n field: string;\n replacedBy: string | null;\n deprecatedSince: string;\n }[];\n}\n\nexport type SchemaOrgCatalogContextEntryLike = {\n [TKind in SchemaOrgCatalogContextEntryKind]: SchemaOrgCatalogContextEntryBaseLike & {\n '@type': TKind;\n };\n}[SchemaOrgCatalogContextEntryKind];\n\nexport type SoftwareApplicationCatalogEntryLike = Extract<\n SchemaOrgCatalogContextEntryLike,\n { '@type': 'SoftwareApplication' }\n>;\n\ninterface SchemaOrgCatalogContextNarrative {\n useWhen: string;\n avoidWhen: string;\n whatEarnsItsPlace: readonly string[];\n whatIsNotInThisBlock: readonly string[];\n googleDocumentationUrl: string;\n}\n\ninterface SchemaOrgCatalogContextTemplateModel {\n title: string;\n description: string;\n schemaOrgUrl: string;\n googleDocumentationUrl: string;\n useWhen: string;\n avoidWhen: string;\n whatEarnsItsPlace: MarkdownListItem[];\n whatIsNotInThisBlock: MarkdownListItem[];\n requiredFieldLines: MarkdownListItem[];\n optionalFieldLines?: MarkdownListItem[];\n deprecatedFieldLines?: MarkdownListItem[];\n developmentNotes?: string;\n}\n\nconst SCHEMA_ORG_CATALOG_CONTEXT_TEMPLATE = `# {{title}}\n\n## Purpose\n{{description}}\n\n## Use when\n{{useWhen}}\n\n## Avoid when\n{{avoidWhen}}\n\n## What earns its place\n{{#each whatEarnsItsPlace}}\n- {{text}}\n{{/each}}\n\n## What is NOT in this block\n{{#each whatIsNotInThisBlock}}\n- {{text}}\n{{/each}}\n\n## Required fields\n{{#each requiredFieldLines}}\n- {{text}}\n{{/each}}\n\n{{#if optionalFieldLines}}\n## Optional fields worth adding\n{{#each optionalFieldLines}}\n- {{text}}\n{{/each}}\n\n{{/if}}\n{{#if deprecatedFieldLines}}\n## Deprecated fields to avoid\n{{#each deprecatedFieldLines}}\n- {{text}}\n{{/each}}\n\n{{/if}}\n{{#if developmentNotes}}\n## Wildo development notes\n{{developmentNotes}}\n\n{{/if}}\n## References\n- Schema.org reference: [{{schemaOrgUrl}}]({{schemaOrgUrl}})\n- Google structured-data guidance: [{{googleDocumentationUrl}}]({{googleDocumentationUrl}})\n`;\n\nconst renderSchemaOrgCatalogContext = compileMarkdownTemplate<SchemaOrgCatalogContextTemplateModel>(\n SCHEMA_ORG_CATALOG_CONTEXT_TEMPLATE,\n);\n\nconst GOOGLE_STRUCTURED_DATA_DOC_URLS: Record<SchemaOrgCatalogContextEntryKind, string> = {\n Article: 'https://developers.google.com/search/docs/appearance/structured-data/article',\n BlogPosting: 'https://developers.google.com/search/docs/appearance/structured-data/article',\n FAQPage: 'https://developers.google.com/search/docs/appearance/structured-data/faqpage',\n Product: 'https://developers.google.com/search/docs/appearance/structured-data/product-snippet',\n Offer: 'https://developers.google.com/search/docs/appearance/structured-data/product-snippet',\n AggregateOffer: 'https://developers.google.com/search/docs/appearance/structured-data/product-snippet',\n Organization: 'https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data',\n BreadcrumbList: 'https://developers.google.com/search/docs/appearance/structured-data/breadcrumb',\n Review: 'https://developers.google.com/search/docs/appearance/structured-data/product-snippet',\n AggregateRating: 'https://developers.google.com/search/docs/appearance/structured-data/product-snippet',\n WebSite: 'https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data',\n SoftwareApplication: 'https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data',\n};\n\nconst SCHEMA_ORG_ENTITY_NARRATIVES: Record<SchemaOrgCatalogContextEntryKind, SchemaOrgCatalogContextNarrative> = {\n Article: {\n useWhen:\n 'Use `Article` for evergreen editorial content or knowledge pages whose primary job is to explain something clearly and durably.',\n avoidWhen:\n 'Do not use it for dated blog feed entries, FAQ sections, pricing surfaces, or generic landing pages that are really selling the product.',\n whatEarnsItsPlace: [\n 'The page reads like editorial content a search engine or answer engine could cite directly.',\n 'The visible headline, publish date, and author identity are all real and stable.',\n 'The entity helps clarify that the page is content-first rather than conversion-first.',\n ],\n whatIsNotInThisBlock: [\n 'Campaign landing-page copy that should instead stay a `WebSite`, `Organization`, or product-marketing surface.',\n 'Synthetic dates or placeholder author strings added only to satisfy the schema.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.Article,\n },\n BlogPosting: {\n useWhen:\n 'Use `BlogPosting` for dated blog posts, release notes, or opinion pieces that live in the blog lane of the website.',\n avoidWhen:\n 'Do not use it for evergreen marketing pages or docs-style content that is not actually part of the blog chronology.',\n whatEarnsItsPlace: [\n 'The page belongs to a real blog or news stream with a publish date.',\n 'The headline and summary match the visible post content.',\n 'The post is a citation-worthy content unit, not just a teaser paragraph.',\n ],\n whatIsNotInThisBlock: [\n 'Homepage hero copy, CTA prose, or synthetic “post” wrappers around marketing content.',\n 'Deprecated date fields such as `dateCreated` when `datePublished` is the truthful field.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.BlogPosting,\n },\n FAQPage: {\n useWhen:\n 'Use `FAQPage` when the page renders a real, visible list of recurring questions with direct answers.',\n avoidWhen:\n 'Do not use it for a single inline question, for hidden answers not rendered to the visitor, or for support-chat style interactions.',\n whatEarnsItsPlace: [\n 'The page exposes question/answer pairs users actually see.',\n 'Each answer is concise, direct, and stable enough to be cited.',\n 'The Q/A registry is the same source of truth for rendered HTML and JSON-LD.',\n ],\n whatIsNotInThisBlock: [\n 'Invented questions the page does not answer visibly.',\n 'Placeholder answers like “contact support” repeated across every entry.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.FAQPage,\n },\n Product: {\n useWhen:\n 'Use `Product` when the page is selling or describing a concrete product offer that benefits from a canonical commercial identity.',\n avoidWhen:\n 'Do not use it for generic company pages, pure editorial content, or comparison copy with no actual purchasable product behind it.',\n whatEarnsItsPlace: [\n 'The page names the product clearly and describes it in human-visible copy.',\n 'The entity grounds any child `Offer` or `AggregateOffer` payloads.',\n 'The product identity is stable enough that reviews/ratings/offers can point at it.',\n ],\n whatIsNotInThisBlock: [\n 'Invisible “products” invented only to satisfy pricing rich results.',\n 'A generic company description that should instead be `Organization`.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.Product,\n },\n Offer: {\n useWhen:\n 'Use `Offer` for one concrete purchasable plan or commercial offer with a real visible price.',\n avoidWhen:\n 'Do not use it when the page is showing only a price range across multiple tiers; use `AggregateOffer` for that case instead.',\n whatEarnsItsPlace: [\n 'The page shows one concrete price and currency.',\n 'The visitor can clearly understand what is being offered.',\n 'The offer is stable enough for answer engines to cite without guessing.',\n ],\n whatIsNotInThisBlock: [\n 'Undocumented internal plans or negotiated-only prices with no public signal.',\n 'Transient promo logic the page does not actually surface.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.Offer,\n },\n AggregateOffer: {\n useWhen:\n 'Use `AggregateOffer` for tiered pricing or price-range surfaces where the page summarizes several concrete offers.',\n avoidWhen:\n 'Do not use it for a single plan price or when the page does not actually expose a meaningful range/count of offers.',\n whatEarnsItsPlace: [\n 'The page compares several real offers or tiers.',\n 'The low/high price range is visible and truthful.',\n 'The aggregate helps answer engines cite the pricing surface without enumerating every child offer.',\n ],\n whatIsNotInThisBlock: [\n 'A guessed price range stitched from internal sales knowledge.',\n 'Offer counts that include hidden or deprecated tiers.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.AggregateOffer,\n },\n Organization: {\n useWhen:\n 'Use `Organization` to identify the company or publisher behind the site or content.',\n avoidWhen:\n 'Do not use it repeatedly on every arbitrary section or as a substitute for product, review, or article entities.',\n whatEarnsItsPlace: [\n 'The page needs to ground who is publishing or offering the thing.',\n 'The company name and canonical URL are stable.',\n 'Optional details like logo, sameAs, or contactPoint are supported by public evidence.',\n ],\n whatIsNotInThisBlock: [\n 'Section-local customer logos or testimonials; those belong in `Review`/`AggregateRating` or in plain HTML.',\n 'Private internal contact data or unverifiable company metadata.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.Organization,\n },\n BreadcrumbList: {\n useWhen:\n 'Use `BreadcrumbList` when the page has a real public navigation hierarchy the visitor can follow from broader to narrower pages.',\n avoidWhen:\n 'Do not use it on flat landing pages with no meaningful breadcrumb trail or on synthetic hierarchies that are not rendered.',\n whatEarnsItsPlace: [\n 'The breadcrumb order mirrors the visible navigation path.',\n 'Each breadcrumb item points at a real public URL.',\n 'The hierarchy helps search engines understand page position in the site.',\n ],\n whatIsNotInThisBlock: [\n 'Analytics-only navigation states or hidden internal taxonomy nodes.',\n 'A fabricated breadcrumb chain added solely for SEO.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.BreadcrumbList,\n },\n Review: {\n useWhen:\n 'Use `Review` for one concrete testimonial or review-like statement with a real reviewer and a real thing being reviewed.',\n avoidWhen:\n 'Do not use it for anonymous praise with no attributable author or for aggregate “trusted by” logo walls that are not actually reviews.',\n whatEarnsItsPlace: [\n 'The quote/testimonial is visible on the page.',\n 'The reviewed entity is explicit.',\n 'If a rating exists, it is grounded in the visible review evidence.',\n ],\n whatIsNotInThisBlock: [\n 'Sales-deck quotes the page does not publish.',\n 'A bundle of many testimonials masquerading as one review.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.Review,\n },\n AggregateRating: {\n useWhen:\n 'Use `AggregateRating` when the page surfaces a real averaged score with a supporting count.',\n avoidWhen:\n 'Do not use it when the page only shows selected testimonials or when the score/count cannot be justified publicly.',\n whatEarnsItsPlace: [\n 'A real rating value and review count are visible or otherwise publicly supportable.',\n 'The aggregate points at the entity being rated.',\n 'The rating meaning is stable enough to survive citation.',\n ],\n whatIsNotInThisBlock: [\n 'Invented averages or mixed review sources with no coherent denominator.',\n 'A rating count copied from an off-site platform that the page does not actually claim.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.AggregateRating,\n },\n WebSite: {\n useWhen:\n 'Use `WebSite` to identify the site itself, typically once on the homepage or top-level identity surface.',\n avoidWhen:\n 'Do not attach it to every inner page section or use it as a substitute for `Organization` or `WebPage`-like semantics.',\n whatEarnsItsPlace: [\n 'The site needs a canonical identity anchor with name and URL.',\n 'The homepage or site-level hero is the natural place to emit it.',\n 'The entity helps answer engines understand the site as a coherent destination.',\n ],\n whatIsNotInThisBlock: [\n 'Per-section copy blocks that do not represent the website itself.',\n 'Duplicate site identities repeated across every page without reason.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.WebSite,\n },\n SoftwareApplication: {\n useWhen:\n 'Use `SoftwareApplication` when the marketed thing is genuinely a software product and the page is grounding that product identity.',\n avoidWhen:\n 'Do not use it for generic company pages or for apps that are not the primary thing the marketing site is selling.',\n whatEarnsItsPlace: [\n 'The page markets a real software product, not just a company or service wrapper.',\n 'The visible copy supports the application category and supported platforms.',\n 'The entity can link naturally to offers, ratings, screenshots, or feature lists.',\n ],\n whatIsNotInThisBlock: [\n 'Internal tools or implementation details the public marketing site does not sell.',\n 'Platform claims the product cannot actually support.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.SoftwareApplication,\n },\n};\n\nconst FIELD_GUIDANCE_BY_NAME: Record<string, string> = {\n name: 'Mirror the visible entity name on the page; do not invent a second marketing identity.',\n url: 'Use the canonical public URL for the entity or page, never an API or asset path.',\n description:\n 'Keep this aligned with the visible explanatory copy so answer engines do not see a different story from users.',\n headline: 'Match the real visible heading; headline drift is a silent credibility bug.',\n datePublished: 'Use the true publication date, not a guessed or synthetic timestamp.',\n dateModified: 'Only emit this when you can keep it truthful over time.',\n author: 'Point to a real person or organization, not a placeholder or internal handle.',\n image: 'Prefer a stable public image URL that matches the rendered content.',\n publisher: 'Name the real publishing organization behind the content.',\n inLanguage: 'Use the active locale in a standards-compliant language tag.',\n mainEntity: 'Each entry must correspond to a real visible question/answer pair on the page.',\n price: 'Mirror the visible price exactly.',\n priceCurrency: 'Use the ISO currency code that matches the rendered price.',\n lowPrice: 'Set this to the lowest real offer visible in the range.',\n highPrice: 'Use this only when the upper bound is visible and meaningful.',\n offerCount: 'Count only the real public offers summarized by the page.',\n offers: 'Reference concrete child offers only when the page truly renders them.',\n availability: 'Use a spec-valid availability value the page can justify publicly.',\n validFrom: 'Reserve this for time-bounded offers with a real start date.',\n validThrough: 'Reserve this for time-bounded offers with a real end date.',\n priceValidUntil: 'Use only when the visible price has a real expiry date.',\n reviewBody: 'Use the visible testimonial/review copy or a faithful equivalent.',\n itemReviewed: 'Reference the exact product/service/entity being reviewed or rated.',\n reviewRating: 'Keep the rating semantics explicit and consistent with the rendered scale.',\n ratingValue: 'Use the actual visible aggregate value.',\n reviewCount: 'Count only the reviews the aggregate truthfully summarizes.',\n bestRating: 'Emit this when the scale is not obvious from context.',\n worstRating: 'Emit this when the scale is not obvious from context.',\n itemListElement: 'Preserve the visible breadcrumb order from root to leaf.',\n logo: 'Prefer a stable public logo URL the crawler can fetch.',\n sameAs: 'List only public profile URLs that genuinely identify the same organization.',\n foundingDate: 'Use the real public founding date, not an approximate vintage.',\n address: 'Only include a public-facing address that the business stands behind.',\n contactPoint: 'Expose only sanctioned public contact channels.',\n potentialAction: 'Use this only for actions the page genuinely offers today.',\n applicationCategory:\n 'Choose a truthful Schema.org category that matches how the product is marketed.',\n operatingSystem: 'List the real supported platforms or operating-system family.',\n aggregateRating: 'Only emit when the page also supports the rating claim with evidence.',\n screenshot: 'Use a stable public screenshot URL that represents the current product.',\n softwareVersion: 'Emit only when the public version is stable and maintained.',\n downloadUrl: 'Use the public install/download destination, not an internal artifact.',\n featureList: 'List durable marketed capabilities, not transient roadmap promises.',\n};\n\nfunction buildFieldGuidanceLine(field: string, requirementLabel: string): string {\n const guidance =\n FIELD_GUIDANCE_BY_NAME[field] ??\n 'Keep the value truthful, public-facing, and aligned with what the page visibly claims.';\n return `\\`${field}\\` — ${requirementLabel}. ${guidance}`;\n}\n\nfunction buildDeprecatedFieldLine(field: {\n field: string;\n replacedBy: string | null;\n deprecatedSince: string;\n}): string {\n const replacementText = field.replacedBy\n ? `Prefer \\`${field.replacedBy}\\` instead.`\n : 'Remove it unless the vocabulary still explicitly requires it.';\n return `\\`${field.field}\\` — deprecated since ${field.deprecatedSince}. ${replacementText}`;\n}\n\n/**\n * Shared renderer used by all per-`@type` catalog-context factories.\n *\n * We keep one wrapper file per entity so imports stay grep-able and the\n * dispatcher remains explicit, but the markdown shape itself must stay\n * uniform across every entity or the AI guidance quality drifts.\n */\nexport function renderSchemaOrgCatalogEntryContextPart<TEntry extends SchemaOrgCatalogContextEntryLike>(\n entry: TEntry,\n): CatalogMarkdownContextPart {\n const narrative = SCHEMA_ORG_ENTITY_NARRATIVES[entry['@type']];\n const title = `Schema.org catalog context: ${entry['@type']}`;\n const requiredFieldLines = toMarkdownListItems(\n entry.requiredFields.map((field) => buildFieldGuidanceLine(field, 'required by the catalog')),\n );\n const optionalFieldLines = toMarkdownListItems(\n entry.optionalFields.map((field) =>\n buildFieldGuidanceLine(field, 'optional but useful when the page can support it'),\n ),\n );\n const deprecatedFieldLines = toMarkdownListItems(\n entry.deprecatedFields.map((field) => buildDeprecatedFieldLine(field)),\n );\n\n return {\n vocabulary: CatalogContextVocabulary.SCHEMA_ORG,\n entryType: entry['@type'],\n title,\n markdown: renderSchemaOrgCatalogContext({\n title,\n description: entry.description,\n schemaOrgUrl: entry.schemaOrgUrl,\n googleDocumentationUrl: narrative.googleDocumentationUrl,\n useWhen: narrative.useWhen,\n avoidWhen: narrative.avoidWhen,\n whatEarnsItsPlace: toMarkdownListItems([...narrative.whatEarnsItsPlace]) ?? [],\n whatIsNotInThisBlock: toMarkdownListItems([...narrative.whatIsNotInThisBlock]) ?? [],\n requiredFieldLines: requiredFieldLines ?? [],\n optionalFieldLines,\n deprecatedFieldLines,\n developmentNotes: entry.developmentNotes,\n }),\n };\n}\n"]}
1
+ {"version":3,"file":"schema-org-catalog-context.shared.js","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/schema-org-catalog-context.shared.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,OAAO,EACL,uBAA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AAE,mBAAmB,CAAC,CAAC,GAAG,SAAS,CAAC,iBAAiB,CAAC,CAAC,IAAI,EAAE;YAC9E,oBAAoB,EAAE,mBAAmB,CAAC,CAAC,GAAG,SAAS,CAAC,oBAAoB,CAAC,CAAC,IAAI,EAAE;YACpF,kBAAkB,EAAE,kBAAkB,IAAI,EAAE;YAC5C,kBAAkB;YAClB,oBAAoB;YACpB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;SACzC,CAAC;KACH,CAAC;AACJ,CAAC","sourcesContent":["import type { SchemaOrgEntityKind } from '@wildo-ai/saas-specifications';\n\nimport type { CatalogMarkdownContextPart } from '../catalog-context.factory.models';\nimport { CatalogContextVocabulary } from '../catalog-context.factory.models';\nimport type { MarkdownListItem } from '../../specifications/specification-context-factory.shared';\nimport {\n compileMarkdownTemplate,\n toMarkdownListItems,\n} from '../../specifications/specification-context-factory.shared';\n\n/**\n * The renderer's entity vocabulary IS the engine's, never a copy of it.\n *\n * This restated all twelve members by hand, which is the shape `CLAUDE.md` forbids under \"closed\n * semantic vocabularies must have one named runtime source\". The cost was not duplication for its\n * own sake: a thirteenth member added to `SchemaOrgEntityKindSchema` compiled on the engine side\n * and was silently unrenderable here, with nothing to report it. Deriving makes that a build error\n * in the renderer's exhaustive switch instead.\n */\nexport type SchemaOrgCatalogContextEntryKind = SchemaOrgEntityKind;\n\ninterface SchemaOrgCatalogContextEntryBaseLike {\n schemaOrgUrl: string;\n description: string;\n developmentNotes?: string;\n requiredFields: readonly string[];\n optionalFields: readonly string[];\n deprecatedFields: readonly {\n field: string;\n replacedBy: string | null;\n deprecatedSince: string;\n }[];\n}\n\nexport type SchemaOrgCatalogContextEntryLike = {\n [TKind in SchemaOrgCatalogContextEntryKind]: SchemaOrgCatalogContextEntryBaseLike & {\n '@type': TKind;\n };\n}[SchemaOrgCatalogContextEntryKind];\n\nexport type SoftwareApplicationCatalogEntryLike = Extract<\n SchemaOrgCatalogContextEntryLike,\n { '@type': 'SoftwareApplication' }\n>;\n\ninterface SchemaOrgCatalogContextNarrative {\n useWhen: string;\n avoidWhen: string;\n whatEarnsItsPlace: readonly string[];\n whatIsNotInThisBlock: readonly string[];\n googleDocumentationUrl: string;\n}\n\ninterface SchemaOrgCatalogContextTemplateModel {\n title: string;\n description: string;\n schemaOrgUrl: string;\n googleDocumentationUrl: string;\n useWhen: string;\n avoidWhen: string;\n whatEarnsItsPlace: MarkdownListItem[];\n whatIsNotInThisBlock: MarkdownListItem[];\n requiredFieldLines: MarkdownListItem[];\n optionalFieldLines?: MarkdownListItem[];\n deprecatedFieldLines?: MarkdownListItem[];\n developmentNotes?: string;\n}\n\nconst SCHEMA_ORG_CATALOG_CONTEXT_TEMPLATE = `# {{title}}\n\n## Purpose\n{{description}}\n\n## Use when\n{{useWhen}}\n\n## Avoid when\n{{avoidWhen}}\n\n## What earns its place\n{{#each whatEarnsItsPlace}}\n- {{text}}\n{{/each}}\n\n## What is NOT in this block\n{{#each whatIsNotInThisBlock}}\n- {{text}}\n{{/each}}\n\n## Required fields\n{{#each requiredFieldLines}}\n- {{text}}\n{{/each}}\n\n{{#if optionalFieldLines}}\n## Optional fields worth adding\n{{#each optionalFieldLines}}\n- {{text}}\n{{/each}}\n\n{{/if}}\n{{#if deprecatedFieldLines}}\n## Deprecated fields to avoid\n{{#each deprecatedFieldLines}}\n- {{text}}\n{{/each}}\n\n{{/if}}\n{{#if developmentNotes}}\n## Wildo development notes\n{{developmentNotes}}\n\n{{/if}}\n## References\n- Schema.org reference: [{{schemaOrgUrl}}]({{schemaOrgUrl}})\n- Google structured-data guidance: [{{googleDocumentationUrl}}]({{googleDocumentationUrl}})\n`;\n\nconst renderSchemaOrgCatalogContext = compileMarkdownTemplate<SchemaOrgCatalogContextTemplateModel>(\n SCHEMA_ORG_CATALOG_CONTEXT_TEMPLATE,\n);\n\nconst GOOGLE_STRUCTURED_DATA_DOC_URLS: Record<SchemaOrgCatalogContextEntryKind, string> = {\n Article: 'https://developers.google.com/search/docs/appearance/structured-data/article',\n BlogPosting: 'https://developers.google.com/search/docs/appearance/structured-data/article',\n FAQPage: 'https://developers.google.com/search/docs/appearance/structured-data/faqpage',\n Product: 'https://developers.google.com/search/docs/appearance/structured-data/product-snippet',\n Offer: 'https://developers.google.com/search/docs/appearance/structured-data/product-snippet',\n AggregateOffer: 'https://developers.google.com/search/docs/appearance/structured-data/product-snippet',\n Organization: 'https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data',\n BreadcrumbList: 'https://developers.google.com/search/docs/appearance/structured-data/breadcrumb',\n Review: 'https://developers.google.com/search/docs/appearance/structured-data/product-snippet',\n AggregateRating: 'https://developers.google.com/search/docs/appearance/structured-data/product-snippet',\n WebSite: 'https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data',\n SoftwareApplication: 'https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data',\n};\n\nconst SCHEMA_ORG_ENTITY_NARRATIVES: Record<SchemaOrgCatalogContextEntryKind, SchemaOrgCatalogContextNarrative> = {\n Article: {\n useWhen:\n 'Use `Article` for evergreen editorial content or knowledge pages whose primary job is to explain something clearly and durably.',\n avoidWhen:\n 'Do not use it for dated blog feed entries, FAQ sections, pricing surfaces, or generic landing pages that are really selling the product.',\n whatEarnsItsPlace: [\n 'The page reads like editorial content a search engine or answer engine could cite directly.',\n 'The visible headline, publish date, and author identity are all real and stable.',\n 'The entity helps clarify that the page is content-first rather than conversion-first.',\n ],\n whatIsNotInThisBlock: [\n 'Campaign landing-page copy that should instead stay a `WebSite`, `Organization`, or product-marketing surface.',\n 'Synthetic dates or placeholder author strings added only to satisfy the schema.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.Article,\n },\n BlogPosting: {\n useWhen:\n 'Use `BlogPosting` for dated blog posts, release notes, or opinion pieces that live in the blog lane of the website.',\n avoidWhen:\n 'Do not use it for evergreen marketing pages or docs-style content that is not actually part of the blog chronology.',\n whatEarnsItsPlace: [\n 'The page belongs to a real blog or news stream with a publish date.',\n 'The headline and summary match the visible post content.',\n 'The post is a citation-worthy content unit, not just a teaser paragraph.',\n ],\n whatIsNotInThisBlock: [\n 'Homepage hero copy, CTA prose, or synthetic “post” wrappers around marketing content.',\n 'Deprecated date fields such as `dateCreated` when `datePublished` is the truthful field.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.BlogPosting,\n },\n FAQPage: {\n useWhen:\n 'Use `FAQPage` when the page renders a real, visible list of recurring questions with direct answers.',\n avoidWhen:\n 'Do not use it for a single inline question, for hidden answers not rendered to the visitor, or for support-chat style interactions.',\n whatEarnsItsPlace: [\n 'The page exposes question/answer pairs users actually see.',\n 'Each answer is concise, direct, and stable enough to be cited.',\n 'The Q/A registry is the same source of truth for rendered HTML and JSON-LD.',\n ],\n whatIsNotInThisBlock: [\n 'Invented questions the page does not answer visibly.',\n 'Placeholder answers like “contact support” repeated across every entry.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.FAQPage,\n },\n Product: {\n useWhen:\n 'Use `Product` when the page is selling or describing a concrete product offer that benefits from a canonical commercial identity.',\n avoidWhen:\n 'Do not use it for generic company pages, pure editorial content, or comparison copy with no actual purchasable product behind it.',\n whatEarnsItsPlace: [\n 'The page names the product clearly and describes it in human-visible copy.',\n 'The entity grounds any child `Offer` or `AggregateOffer` payloads.',\n 'The product identity is stable enough that reviews/ratings/offers can point at it.',\n ],\n whatIsNotInThisBlock: [\n 'Invisible “products” invented only to satisfy pricing rich results.',\n 'A generic company description that should instead be `Organization`.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.Product,\n },\n Offer: {\n useWhen:\n 'Use `Offer` for one concrete purchasable plan or commercial offer with a real visible price.',\n avoidWhen:\n 'Do not use it when the page is showing only a price range across multiple tiers; use `AggregateOffer` for that case instead.',\n whatEarnsItsPlace: [\n 'The page shows one concrete price and currency.',\n 'The visitor can clearly understand what is being offered.',\n 'The offer is stable enough for answer engines to cite without guessing.',\n ],\n whatIsNotInThisBlock: [\n 'Undocumented internal plans or negotiated-only prices with no public signal.',\n 'Transient promo logic the page does not actually surface.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.Offer,\n },\n AggregateOffer: {\n useWhen:\n 'Use `AggregateOffer` for tiered pricing or price-range surfaces where the page summarizes several concrete offers.',\n avoidWhen:\n 'Do not use it for a single plan price or when the page does not actually expose a meaningful range/count of offers.',\n whatEarnsItsPlace: [\n 'The page compares several real offers or tiers.',\n 'The low/high price range is visible and truthful.',\n 'The aggregate helps answer engines cite the pricing surface without enumerating every child offer.',\n ],\n whatIsNotInThisBlock: [\n 'A guessed price range stitched from internal sales knowledge.',\n 'Offer counts that include hidden or deprecated tiers.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.AggregateOffer,\n },\n Organization: {\n useWhen:\n 'Use `Organization` to identify the company or publisher behind the site or content.',\n avoidWhen:\n 'Do not use it repeatedly on every arbitrary section or as a substitute for product, review, or article entities.',\n whatEarnsItsPlace: [\n 'The page needs to ground who is publishing or offering the thing.',\n 'The company name and canonical URL are stable.',\n 'Optional details like logo, sameAs, or contactPoint are supported by public evidence.',\n ],\n whatIsNotInThisBlock: [\n 'Section-local customer logos or testimonials; those belong in `Review`/`AggregateRating` or in plain HTML.',\n 'Private internal contact data or unverifiable company metadata.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.Organization,\n },\n BreadcrumbList: {\n useWhen:\n 'Use `BreadcrumbList` when the page has a real public navigation hierarchy the visitor can follow from broader to narrower pages.',\n avoidWhen:\n 'Do not use it on flat landing pages with no meaningful breadcrumb trail or on synthetic hierarchies that are not rendered.',\n whatEarnsItsPlace: [\n 'The breadcrumb order mirrors the visible navigation path.',\n 'Each breadcrumb item points at a real public URL.',\n 'The hierarchy helps search engines understand page position in the site.',\n ],\n whatIsNotInThisBlock: [\n 'Analytics-only navigation states or hidden internal taxonomy nodes.',\n 'A fabricated breadcrumb chain added solely for SEO.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.BreadcrumbList,\n },\n Review: {\n useWhen:\n 'Use `Review` for one concrete testimonial or review-like statement with a real reviewer and a real thing being reviewed.',\n avoidWhen:\n 'Do not use it for anonymous praise with no attributable author or for aggregate “trusted by” logo walls that are not actually reviews.',\n whatEarnsItsPlace: [\n 'The quote/testimonial is visible on the page.',\n 'The reviewed entity is explicit.',\n 'If a rating exists, it is grounded in the visible review evidence.',\n ],\n whatIsNotInThisBlock: [\n 'Sales-deck quotes the page does not publish.',\n 'A bundle of many testimonials masquerading as one review.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.Review,\n },\n AggregateRating: {\n useWhen:\n 'Use `AggregateRating` when the page surfaces a real averaged score with a supporting count.',\n avoidWhen:\n 'Do not use it when the page only shows selected testimonials or when the score/count cannot be justified publicly.',\n whatEarnsItsPlace: [\n 'A real rating value and review count are visible or otherwise publicly supportable.',\n 'The aggregate points at the entity being rated.',\n 'The rating meaning is stable enough to survive citation.',\n ],\n whatIsNotInThisBlock: [\n 'Invented averages or mixed review sources with no coherent denominator.',\n 'A rating count copied from an off-site platform that the page does not actually claim.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.AggregateRating,\n },\n WebSite: {\n useWhen:\n 'Use `WebSite` to identify the site itself, typically once on the homepage or top-level identity surface.',\n avoidWhen:\n 'Do not attach it to every inner page section or use it as a substitute for `Organization` or `WebPage`-like semantics.',\n whatEarnsItsPlace: [\n 'The site needs a canonical identity anchor with name and URL.',\n 'The homepage or site-level hero is the natural place to emit it.',\n 'The entity helps answer engines understand the site as a coherent destination.',\n ],\n whatIsNotInThisBlock: [\n 'Per-section copy blocks that do not represent the website itself.',\n 'Duplicate site identities repeated across every page without reason.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.WebSite,\n },\n SoftwareApplication: {\n useWhen:\n 'Use `SoftwareApplication` when the marketed thing is genuinely a software product and the page is grounding that product identity.',\n avoidWhen:\n 'Do not use it for generic company pages or for apps that are not the primary thing the marketing site is selling.',\n whatEarnsItsPlace: [\n 'The page markets a real software product, not just a company or service wrapper.',\n 'The visible copy supports the application category and supported platforms.',\n 'The entity can link naturally to offers, ratings, screenshots, or feature lists.',\n ],\n whatIsNotInThisBlock: [\n 'Internal tools or implementation details the public marketing site does not sell.',\n 'Platform claims the product cannot actually support.',\n ],\n googleDocumentationUrl: GOOGLE_STRUCTURED_DATA_DOC_URLS.SoftwareApplication,\n },\n};\n\nconst FIELD_GUIDANCE_BY_NAME: Record<string, string> = {\n name: 'Mirror the visible entity name on the page; do not invent a second marketing identity.',\n url: 'Use the canonical public URL for the entity or page, never an API or asset path.',\n description:\n 'Keep this aligned with the visible explanatory copy so answer engines do not see a different story from users.',\n headline: 'Match the real visible heading; headline drift is a silent credibility bug.',\n datePublished: 'Use the true publication date, not a guessed or synthetic timestamp.',\n dateModified: 'Only emit this when you can keep it truthful over time.',\n author: 'Point to a real person or organization, not a placeholder or internal handle.',\n image: 'Prefer a stable public image URL that matches the rendered content.',\n publisher: 'Name the real publishing organization behind the content.',\n inLanguage: 'Use the active locale in a standards-compliant language tag.',\n mainEntity: 'Each entry must correspond to a real visible question/answer pair on the page.',\n price: 'Mirror the visible price exactly.',\n priceCurrency: 'Use the ISO currency code that matches the rendered price.',\n lowPrice: 'Set this to the lowest real offer visible in the range.',\n highPrice: 'Use this only when the upper bound is visible and meaningful.',\n offerCount: 'Count only the real public offers summarized by the page.',\n offers: 'Reference concrete child offers only when the page truly renders them.',\n availability: 'Use a spec-valid availability value the page can justify publicly.',\n validFrom: 'Reserve this for time-bounded offers with a real start date.',\n validThrough: 'Reserve this for time-bounded offers with a real end date.',\n priceValidUntil: 'Use only when the visible price has a real expiry date.',\n reviewBody: 'Use the visible testimonial/review copy or a faithful equivalent.',\n itemReviewed: 'Reference the exact product/service/entity being reviewed or rated.',\n reviewRating: 'Keep the rating semantics explicit and consistent with the rendered scale.',\n ratingValue: 'Use the actual visible aggregate value.',\n reviewCount: 'Count only the reviews the aggregate truthfully summarizes.',\n bestRating: 'Emit this when the scale is not obvious from context.',\n worstRating: 'Emit this when the scale is not obvious from context.',\n itemListElement: 'Preserve the visible breadcrumb order from root to leaf.',\n logo: 'Prefer a stable public logo URL the crawler can fetch.',\n sameAs: 'List only public profile URLs that genuinely identify the same organization.',\n foundingDate: 'Use the real public founding date, not an approximate vintage.',\n address: 'Only include a public-facing address that the business stands behind.',\n contactPoint: 'Expose only sanctioned public contact channels.',\n potentialAction: 'Use this only for actions the page genuinely offers today.',\n applicationCategory:\n 'Choose a truthful Schema.org category that matches how the product is marketed.',\n operatingSystem: 'List the real supported platforms or operating-system family.',\n aggregateRating: 'Only emit when the page also supports the rating claim with evidence.',\n screenshot: 'Use a stable public screenshot URL that represents the current product.',\n softwareVersion: 'Emit only when the public version is stable and maintained.',\n downloadUrl: 'Use the public install/download destination, not an internal artifact.',\n featureList: 'List durable marketed capabilities, not transient roadmap promises.',\n};\n\nfunction buildFieldGuidanceLine(field: string, requirementLabel: string): string {\n const guidance =\n FIELD_GUIDANCE_BY_NAME[field] ??\n 'Keep the value truthful, public-facing, and aligned with what the page visibly claims.';\n return `\\`${field}\\` — ${requirementLabel}. ${guidance}`;\n}\n\nfunction buildDeprecatedFieldLine(field: {\n field: string;\n replacedBy: string | null;\n deprecatedSince: string;\n}): string {\n const replacementText = field.replacedBy\n ? `Prefer \\`${field.replacedBy}\\` instead.`\n : 'Remove it unless the vocabulary still explicitly requires it.';\n return `\\`${field.field}\\` — deprecated since ${field.deprecatedSince}. ${replacementText}`;\n}\n\n/**\n * Shared renderer used by all per-`@type` catalog-context factories.\n *\n * We keep one wrapper file per entity so imports stay grep-able and the\n * dispatcher remains explicit, but the markdown shape itself must stay\n * uniform across every entity or the AI guidance quality drifts.\n */\nexport function renderSchemaOrgCatalogEntryContextPart<TEntry extends SchemaOrgCatalogContextEntryLike>(\n entry: TEntry,\n): CatalogMarkdownContextPart {\n const narrative = SCHEMA_ORG_ENTITY_NARRATIVES[entry['@type']];\n const title = `Schema.org catalog context: ${entry['@type']}`;\n const requiredFieldLines = toMarkdownListItems(\n entry.requiredFields.map((field) => buildFieldGuidanceLine(field, 'required by the catalog')),\n );\n const optionalFieldLines = toMarkdownListItems(\n entry.optionalFields.map((field) =>\n buildFieldGuidanceLine(field, 'optional but useful when the page can support it'),\n ),\n );\n const deprecatedFieldLines = toMarkdownListItems(\n entry.deprecatedFields.map((field) => buildDeprecatedFieldLine(field)),\n );\n\n return {\n vocabulary: CatalogContextVocabulary.SCHEMA_ORG,\n entryType: entry['@type'],\n title,\n markdown: renderSchemaOrgCatalogContext({\n title,\n description: entry.description,\n schemaOrgUrl: entry.schemaOrgUrl,\n googleDocumentationUrl: narrative.googleDocumentationUrl,\n useWhen: narrative.useWhen,\n avoidWhen: narrative.avoidWhen,\n whatEarnsItsPlace: toMarkdownListItems([...narrative.whatEarnsItsPlace]) ?? [],\n whatIsNotInThisBlock: toMarkdownListItems([...narrative.whatIsNotInThisBlock]) ?? [],\n requiredFieldLines: requiredFieldLines ?? [],\n optionalFieldLines,\n deprecatedFieldLines,\n developmentNotes: entry.developmentNotes,\n }),\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"software-application-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../../src/core/catalogs/schema-org/software-application-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,qCAAqC,CAAC;AAG/F,wBAAgB,2CAA2C,CACzD,KAAK,EAAE,mCAAmC,GACzC,0BAA0B,CAE5B"}
1
+ {"version":3,"file":"software-application-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/software-application-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,qCAAqC,CAAC;AAG/F,wBAAgB,2CAA2C,CACzD,KAAK,EAAE,mCAAmC,GACzC,0BAA0B,CAE5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"website-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../../src/core/catalogs/schema-org/website-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GAC/D,0BAA0B,CAE5B"}
1
+ {"version":3,"file":"website-catalog-context.factory.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/schema-org/website-catalog-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,gCAAgC,GAAG;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GAC/D,0BAA0B,CAE5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"structured-data-catalog-audit.service.d.ts","sourceRoot":"","sources":["../../../../../src/core/catalogs/structured-data-catalog-audit.service.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,kCAAkC,EAExC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAInF,MAAM,WAAW,gCAAgC;IAC/C,MAAM,EAAE,kCAAkC,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,SAAS,0BAA0B,EAAE,CAAC;CAC5D;AAeD,qBAAa,iCAAiC;WAC/B,KAAK,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,gCAAgC,CAAC;mBAqH5E,sCAAsC;CAI5D"}
1
+ {"version":3,"file":"structured-data-catalog-audit.service.d.ts","sourceRoot":"","sources":["../../../../src/core/catalogs/structured-data-catalog-audit.service.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,kCAAkC,EAExC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAKnF,MAAM,WAAW,gCAAgC;IAC/C,MAAM,EAAE,kCAAkC,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,SAAS,0BAA0B,EAAE,CAAC;CAC5D;AAWD,qBAAa,iCAAiC;WAC/B,KAAK,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,gCAAgC,CAAC;mBA+H5E,sCAAsC;CAI5D"}
@@ -5,6 +5,7 @@ import { tsImport } from 'tsx/esm/api';
5
5
  import { loadSpecificationsCompanionExports } from '../context/companion-package-loaders.companion.js';
6
6
  import { CatalogContextVocabulary } from './catalog-context.factory.models.js';
7
7
  import { renderCatalogEntryContextPart } from './catalog-context.factory.js';
8
+ import { parseSchemaOrgCatalogEntries } from './schema-org/schema-org-catalog-boundary.shared.js';
8
9
  export class StructuredDataCatalogAuditService {
9
10
  static async audit(companionContext) {
10
11
  await registerStaticAssetImportNoop();
@@ -64,11 +65,18 @@ export class StructuredDataCatalogAuditService {
64
65
  sections: [...sectionsByRef.values()],
65
66
  pagePayloads,
66
67
  });
67
- const catalogContextParts = dedupeCatalogEntriesByTypeLastWins(schemaOrgCatalog).map((entry) => {
68
+ /*
69
+ * Parsed for the RENDERER only. `reconcileStructuredDataAgainstCatalog` above keeps receiving the
70
+ * raw array on purpose: the schema applies `.default()` to `recommendOptionals` and
71
+ * `deprecatedFields`, so parsed entries are not byte-identical to authored ones, and changing
72
+ * what reconciliation sees is a separate decision from fixing this boundary.
73
+ */
74
+ const catalogEntries = parseSchemaOrgCatalogEntries(schemaOrgCatalog, "the application's specifications package (catalogSpecifications.schemaOrg)");
75
+ const catalogContextParts = dedupeCatalogEntriesByTypeLastWins(catalogEntries).map((entry) => {
68
76
  try {
69
77
  return renderCatalogEntryContextPart({
70
78
  vocabulary: CatalogContextVocabulary.SCHEMA_ORG,
71
- entry: entry,
79
+ entry,
72
80
  });
73
81
  }
74
82
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"structured-data-catalog-audit.service.js","sourceRoot":"","sources":["../../../../../src/core/catalogs/structured-data-catalog-audit.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AASvC,OAAO,EAAE,kCAAkC,EAAE,MAAM,gDAAgD,CAAC;AAEpG,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAsB1E,MAAM,OAAO,iCAAiC;IAC5C,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAkC;QACnD,MAAM,6BAA6B,EAAE,CAAC;QAEtC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAC1E,CAAC,O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CAAC;IACpC,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED,IAAI,+BAA+B,GAAG,KAAK,CAAC;AAE5C,KAAK,UAAU,uBAAuB,CAAyB,QAAgB;IAC7E,OAAO,MAAM,QAAQ,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAY,CAAC;AAC7E,CAAC;AAED,KAAK,UAAU,6BAA6B;IAC1C,IAAI,+BAA+B,EAAE,CAAC;QACpC,OAAO;IACT,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;GAqBlB,CAAC;IAEF,QAAQ,CAAC,wBAAwB,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IACnE,+BAA+B,GAAG,IAAI,CAAC;AACzC,CAAC","sourcesContent":["import { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { AppFrontendType } from '@wildo-ai/platform-config-lib';\nimport { tsImport } from 'tsx/esm/api';\nimport {\n type StructuredDataPageManifestLike,\n type StructuredDataPagePayloadLike,\n type StructuredDataReconciliationResult,\n type StructuredDataSectionDefinitionLike,\n} from '@wildo-ai/saas-website';\n\nimport type { CompanionContext } from '../context/companion-context';\nimport { loadSpecificationsCompanionExports } from '../context/companion-package-loaders.companion';\nimport type { CatalogMarkdownContextPart } from './catalog-context.factory.models';\nimport { CatalogContextVocabulary } from './catalog-context.factory.models';\nimport { renderCatalogEntryContextPart } from './catalog-context.factory';\n\nexport interface StructuredDataCatalogAuditReport {\n result: StructuredDataReconciliationResult;\n pageCount: number;\n sectionCount: number;\n catalogContextParts: readonly CatalogMarkdownContextPart[];\n}\n\ninterface StructuredDataReconciliationModule {\n reconcileStructuredDataAgainstCatalog: (options: {\n catalog: readonly unknown[];\n pages: readonly StructuredDataPageManifestLike[];\n sections: readonly StructuredDataSectionDefinitionLike[];\n pagePayloads?: readonly StructuredDataPagePayloadLike[];\n }) => StructuredDataReconciliationResult;\n}\n\ninterface SchemaOrgCatalogEntryLike {\n '@type': string;\n}\n\nexport class StructuredDataCatalogAuditService {\n static async audit(companionContext: CompanionContext): Promise<StructuredDataCatalogAuditReport> {\n await registerStaticAssetImportNoop();\n\n const websiteService = Object.values(companionContext.frontendServices).find(\n (service) => service.frontendType === AppFrontendType.STATIC_WEBSITE,\n );\n if (!websiteService) {\n throw new Error(\n 'No STATIC_WEBSITE service is declared in wildo.saas.config.ts, so structured-data website audit cannot run.',\n );\n }\n\n const specificationsCompanionExports = await loadSpecificationsCompanionExports(companionContext);\n const schemaOrgCatalog = (\n specificationsCompanionExports as {\n catalogSpecifications?: { schemaOrg?: readonly SchemaOrgCatalogEntryLike[] };\n }\n ).catalogSpecifications?.schemaOrg;\n if (!schemaOrgCatalog) {\n throw new Error(\n 'Specifications companion exports are missing `catalogSpecifications.schemaOrg`. Wire the merged Schema.org catalog before running companion reconciliation.',\n );\n }\n\n const websiteSourceRoot = join(companionContext.saasRoot, websiteService.path, 'src');\n const { reconcileStructuredDataAgainstCatalog } =\n await StructuredDataCatalogAuditService.loadStructuredDataReconciliationModule();\n const websiteRootModule = await loadWebsiteSourceModule<{\n WEBSITE_ROOT_CONFIG?: { pageManifests: readonly StructuredDataPageManifestLike[] };\n }>(join(websiteSourceRoot, 'website-root.config.ts'));\n const sectionsModule = await loadWebsiteSourceModule<{\n WEBSITE_SECTIONS?: readonly StructuredDataSectionDefinitionLike[];\n resolveSectionsForManifest?: (\n manifest: StructuredDataPageManifestLike,\n ) => readonly StructuredDataSectionDefinitionLike[];\n }>(join(websiteSourceRoot, 'sections', 'index.ts'));\n const pagePayloadsModulePath = join(websiteSourceRoot, 'structured-data', 'page-payloads.ts');\n const pagePayloadsModule = existsSync(pagePayloadsModulePath)\n ? await loadWebsiteSourceModule<{\n resolveStructuredDataPagePayloadsForManifest?: (\n manifest: StructuredDataPageManifestLike,\n ) => readonly StructuredDataPagePayloadLike[] | Promise<readonly StructuredDataPagePayloadLike[]>;\n }>(pagePayloadsModulePath)\n : {};\n\n const pageManifests = websiteRootModule.WEBSITE_ROOT_CONFIG?.pageManifests;\n if (!pageManifests) {\n throw new Error(\n `Website root config not exported from ${join(websiteService.path, 'src', 'website-root.config.ts')}. Expected a named WEBSITE_ROOT_CONFIG export.`,\n );\n }\n const staticSections = sectionsModule.WEBSITE_SECTIONS;\n if (!sectionsModule.resolveSectionsForManifest && !staticSections) {\n throw new Error(\n `Website sections registry must export either WEBSITE_SECTIONS or resolveSectionsForManifest() in ${join(websiteService.path, 'src', 'sections', 'index.ts')}.`,\n );\n }\n\n const sectionsByRef = new Map<string, StructuredDataSectionDefinitionLike>();\n for (const section of staticSections ?? []) {\n sectionsByRef.set(String(section.sectionRef), section);\n }\n if (sectionsModule.resolveSectionsForManifest) {\n for (const manifest of pageManifests) {\n let resolvedSections: readonly StructuredDataSectionDefinitionLike[];\n try {\n resolvedSections = sectionsModule.resolveSectionsForManifest(manifest);\n } catch (error) {\n throw new Error(\n `Website sections resolver failed for page \"${manifest.ref}\" (${manifest.routePath}). ` +\n 'Fix resolveSectionsForManifest() before running structured-data companion reconciliation.',\n { cause: error },\n );\n }\n for (const section of resolvedSections) {\n sectionsByRef.set(String(section.sectionRef), section);\n }\n }\n }\n const pagePayloads: StructuredDataPagePayloadLike[] = [];\n if (pagePayloadsModule.resolveStructuredDataPagePayloadsForManifest) {\n for (const manifest of pageManifests) {\n pagePayloads.push(\n ...(await pagePayloadsModule.resolveStructuredDataPagePayloadsForManifest(manifest)),\n );\n }\n }\n\n const result = reconcileStructuredDataAgainstCatalog({\n catalog: schemaOrgCatalog,\n pages: pageManifests,\n sections: [...sectionsByRef.values()],\n pagePayloads,\n });\n const catalogContextParts = dedupeCatalogEntriesByTypeLastWins(schemaOrgCatalog).map((entry) => {\n try {\n return renderCatalogEntryContextPart({\n vocabulary: CatalogContextVocabulary.SCHEMA_ORG,\n entry: entry as Parameters<typeof renderCatalogEntryContextPart>[0]['entry'],\n });\n } catch (error) {\n throw new Error(\n `No catalog-context renderer is available for Schema.org @type=\"${entry['@type']}\". ` +\n 'Add a schema-org catalog-context factory before exposing this catalog entry to the companion.',\n { cause: error },\n );\n }\n });\n\n return {\n result,\n pageCount: pageManifests.length,\n sectionCount: sectionsByRef.size,\n catalogContextParts,\n };\n }\n\n private static async loadStructuredDataReconciliationModule(): Promise<StructuredDataReconciliationModule> {\n const packageModule = await import('@wildo-ai/saas-website');\n return packageModule as StructuredDataReconciliationModule;\n }\n}\n\nfunction dedupeCatalogEntriesByTypeLastWins<TEntry extends { '@type': string }>(\n entries: readonly TEntry[],\n): TEntry[] {\n const byType = new Map<string, TEntry>();\n for (const entry of entries) {\n byType.set(entry['@type'], entry);\n }\n return [...byType.values()];\n}\n\nlet staticAssetImportNoopRegistered = false;\n\nasync function loadWebsiteSourceModule<TModule extends object>(filePath: string): Promise<TModule> {\n return await tsImport(filePath, { parentURL: import.meta.url }) as TModule;\n}\n\nasync function registerStaticAssetImportNoop(): Promise<void> {\n if (staticAssetImportNoopRegistered) {\n return;\n }\n\n const { register } = await import('node:module');\n const hookSource = `\n const ASSET_RE = /\\\\.(css|scss|less|sass|svg|png|jpe?g|gif|webp|ico|avif|woff2?|eot|ttf|otf)(\\\\?.*)?$/;\n export function resolve(specifier, context, nextResolve) {\n if (ASSET_RE.test(specifier)) {\n return {\n shortCircuit: true,\n url: new URL(specifier, context.parentURL ?? 'file:///').href,\n };\n }\n return nextResolve(specifier, context);\n }\n export function load(url, context, nextLoad) {\n if (ASSET_RE.test(url)) {\n return {\n shortCircuit: true,\n format: 'module',\n source: 'export default \"\";\\\\n',\n };\n }\n return nextLoad(url, context);\n }\n `;\n\n register(`data:text/javascript,${encodeURIComponent(hookSource)}`);\n staticAssetImportNoopRegistered = true;\n}\n"]}
1
+ {"version":3,"file":"structured-data-catalog-audit.service.js","s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GAAG;;;;;;;;;;;;;;;;;;;;;GAqBlB,CAAC;IAEF,QAAQ,CAAC,wBAAwB,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IACnE,+BAA+B,GAAG,IAAI,CAAC;AACzC,CAAC","sourcesContent":["import { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { AppFrontendType } from '@wildo-ai/platform-config-lib';\nimport { tsImport } from 'tsx/esm/api';\nimport {\n type StructuredDataPageManifestLike,\n type StructuredDataPagePayloadLike,\n type StructuredDataReconciliationResult,\n type StructuredDataSectionDefinitionLike,\n} from '@wildo-ai/saas-website';\n\nimport type { CompanionContext } from '../context/companion-context';\nimport { loadSpecificationsCompanionExports } from '../context/companion-package-loaders.companion';\nimport type { CatalogMarkdownContextPart } from './catalog-context.factory.models';\nimport { CatalogContextVocabulary } from './catalog-context.factory.models';\nimport { renderCatalogEntryContextPart } from './catalog-context.factory';\nimport { parseSchemaOrgCatalogEntries } from './schema-org/schema-org-catalog-boundary.shared';\n\nexport interface StructuredDataCatalogAuditReport {\n result: StructuredDataReconciliationResult;\n pageCount: number;\n sectionCount: number;\n catalogContextParts: readonly CatalogMarkdownContextPart[];\n}\n\ninterface StructuredDataReconciliationModule {\n reconcileStructuredDataAgainstCatalog: (options: {\n catalog: readonly unknown[];\n pages: readonly StructuredDataPageManifestLike[];\n sections: readonly StructuredDataSectionDefinitionLike[];\n pagePayloads?: readonly StructuredDataPagePayloadLike[];\n }) => StructuredDataReconciliationResult;\n}\n\nexport class StructuredDataCatalogAuditService {\n static async audit(companionContext: CompanionContext): Promise<StructuredDataCatalogAuditReport> {\n await registerStaticAssetImportNoop();\n\n const websiteService = Object.values(companionContext.frontendServices).find(\n (service) => service.frontendType === AppFrontendType.STATIC_WEBSITE,\n );\n if (!websiteService) {\n throw new Error(\n 'No STATIC_WEBSITE service is declared in wildo.saas.config.ts, so structured-data website audit cannot run.',\n );\n }\n\n const specificationsCompanionExports = await loadSpecificationsCompanionExports(companionContext);\n const schemaOrgCatalog = (\n specificationsCompanionExports as {\n catalogSpecifications?: { schemaOrg?: readonly unknown[] };\n }\n ).catalogSpecifications?.schemaOrg;\n if (!schemaOrgCatalog) {\n throw new Error(\n 'Specifications companion exports are missing `catalogSpecifications.schemaOrg`. Wire the merged Schema.org catalog before running companion reconciliation.',\n );\n }\n\n const websiteSourceRoot = join(companionContext.saasRoot, websiteService.path, 'src');\n const { reconcileStructuredDataAgainstCatalog } =\n await StructuredDataCatalogAuditService.loadStructuredDataReconciliationModule();\n const websiteRootModule = await loadWebsiteSourceModule<{\n WEBSITE_ROOT_CONFIG?: { pageManifests: readonly StructuredDataPageManifestLike[] };\n }>(join(websiteSourceRoot, 'website-root.config.ts'));\n const sectionsModule = await loadWebsiteSourceModule<{\n WEBSITE_SECTIONS?: readonly StructuredDataSectionDefinitionLike[];\n resolveSectionsForManifest?: (\n manifest: StructuredDataPageManifestLike,\n ) => readonly StructuredDataSectionDefinitionLike[];\n }>(join(websiteSourceRoot, 'sections', 'index.ts'));\n const pagePayloadsModulePath = join(websiteSourceRoot, 'structured-data', 'page-payloads.ts');\n const pagePayloadsModule = existsSync(pagePayloadsModulePath)\n ? await loadWebsiteSourceModule<{\n resolveStructuredDataPagePayloadsForManifest?: (\n manifest: StructuredDataPageManifestLike,\n ) => readonly StructuredDataPagePayloadLike[] | Promise<readonly StructuredDataPagePayloadLike[]>;\n }>(pagePayloadsModulePath)\n : {};\n\n const pageManifests = websiteRootModule.WEBSITE_ROOT_CONFIG?.pageManifests;\n if (!pageManifests) {\n throw new Error(\n `Website root config not exported from ${join(websiteService.path, 'src', 'website-root.config.ts')}. Expected a named WEBSITE_ROOT_CONFIG export.`,\n );\n }\n const staticSections = sectionsModule.WEBSITE_SECTIONS;\n if (!sectionsModule.resolveSectionsForManifest && !staticSections) {\n throw new Error(\n `Website sections registry must export either WEBSITE_SECTIONS or resolveSectionsForManifest() in ${join(websiteService.path, 'src', 'sections', 'index.ts')}.`,\n );\n }\n\n const sectionsByRef = new Map<string, StructuredDataSectionDefinitionLike>();\n for (const section of staticSections ?? []) {\n sectionsByRef.set(String(section.sectionRef), section);\n }\n if (sectionsModule.resolveSectionsForManifest) {\n for (const manifest of pageManifests) {\n let resolvedSections: readonly StructuredDataSectionDefinitionLike[];\n try {\n resolvedSections = sectionsModule.resolveSectionsForManifest(manifest);\n } catch (error) {\n throw new Error(\n `Website sections resolver failed for page \"${manifest.ref}\" (${manifest.routePath}). ` +\n 'Fix resolveSectionsForManifest() before running structured-data companion reconciliation.',\n { cause: error },\n );\n }\n for (const section of resolvedSections) {\n sectionsByRef.set(String(section.sectionRef), section);\n }\n }\n }\n const pagePayloads: StructuredDataPagePayloadLike[] = [];\n if (pagePayloadsModule.resolveStructuredDataPagePayloadsForManifest) {\n for (const manifest of pageManifests) {\n pagePayloads.push(\n ...(await pagePayloadsModule.resolveStructuredDataPagePayloadsForManifest(manifest)),\n );\n }\n }\n\n const result = reconcileStructuredDataAgainstCatalog({\n catalog: schemaOrgCatalog,\n pages: pageManifests,\n sections: [...sectionsByRef.values()],\n pagePayloads,\n });\n /*\n * Parsed for the RENDERER only. `reconcileStructuredDataAgainstCatalog` above keeps receiving the\n * raw array on purpose: the schema applies `.default()` to `recommendOptionals` and\n * `deprecatedFields`, so parsed entries are not byte-identical to authored ones, and changing\n * what reconciliation sees is a separate decision from fixing this boundary.\n */\n const catalogEntries = parseSchemaOrgCatalogEntries(\n schemaOrgCatalog,\n \"the application's specifications package (catalogSpecifications.schemaOrg)\",\n );\n const catalogContextParts = dedupeCatalogEntriesByTypeLastWins(catalogEntries).map((entry) => {\n try {\n return renderCatalogEntryContextPart({\n vocabulary: CatalogContextVocabulary.SCHEMA_ORG,\n entry,\n });\n } catch (error) {\n throw new Error(\n `No catalog-context renderer is available for Schema.org @type=\"${entry['@type']}\". ` +\n 'Add a schema-org catalog-context factory before exposing this catalog entry to the companion.',\n { cause: error },\n );\n }\n });\n\n return {\n result,\n pageCount: pageManifests.length,\n sectionCount: sectionsByRef.size,\n catalogContextParts,\n };\n }\n\n private static async loadStructuredDataReconciliationModule(): Promise<StructuredDataReconciliationModule> {\n const packageModule = await import('@wildo-ai/saas-website');\n return packageModule as StructuredDataReconciliationModule;\n }\n}\n\nfunction dedupeCatalogEntriesByTypeLastWins<TEntry extends { '@type': string }>(\n entries: readonly TEntry[],\n): TEntry[] {\n const byType = new Map<string, TEntry>();\n for (const entry of entries) {\n byType.set(entry['@type'], entry);\n }\n return [...byType.values()];\n}\n\nlet staticAssetImportNoopRegistered = false;\n\nasync function loadWebsiteSourceModule<TModule extends object>(filePath: string): Promise<TModule> {\n return await tsImport(filePath, { parentURL: import.meta.url }) as TModule;\n}\n\nasync function registerStaticAssetImportNoop(): Promise<void> {\n if (staticAssetImportNoopRegistered) {\n return;\n }\n\n const { register } = await import('node:module');\n const hookSource = `\n const ASSET_RE = /\\\\.(css|scss|less|sass|svg|png|jpe?g|gif|webp|ico|avif|woff2?|eot|ttf|otf)(\\\\?.*)?$/;\n export function resolve(specifier, context, nextResolve) {\n if (ASSET_RE.test(specifier)) {\n return {\n shortCircuit: true,\n url: new URL(specifier, context.parentURL ?? 'file:///').href,\n };\n }\n return nextResolve(specifier, context);\n }\n export function load(url, context, nextLoad) {\n if (ASSET_RE.test(url)) {\n return {\n shortCircuit: true,\n format: 'module',\n source: 'export default \"\";\\\\n',\n };\n }\n return nextLoad(url, context);\n }\n `;\n\n register(`data:text/javascript,${encodeURIComponent(hookSource)}`);\n staticAssetImportNoopRegistered = true;\n}\n"]}