@wildo-ai/saas-backend-lib 1.1.2 → 1.1.3

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 (853) hide show
  1. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.d.ts.map +1 -1
  2. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js +19 -1
  3. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js.map +1 -1
  4. package/dist/esm/base-classes/models/manual-controllers.backend.definition.d.ts.map +1 -1
  5. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js +4 -0
  6. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js.map +1 -1
  7. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts +35 -0
  8. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts.map +1 -0
  9. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js +111 -0
  10. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js.map +1 -0
  11. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts +50 -0
  12. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts.map +1 -0
  13. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js +199 -0
  14. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js.map +1 -0
  15. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts +111 -0
  16. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts.map +1 -1
  17. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js +140 -0
  18. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js.map +1 -1
  19. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts.map +1 -1
  20. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js +27 -6
  21. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
  22. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts +124 -13
  23. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts.map +1 -1
  24. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js +207 -21
  25. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js.map +1 -1
  26. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts +60 -8
  27. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts.map +1 -1
  28. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js +174 -26
  29. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js.map +1 -1
  30. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts +47 -4
  31. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts.map +1 -1
  32. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js +96 -29
  33. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js.map +1 -1
  34. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts +55 -0
  35. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts.map +1 -0
  36. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js +114 -0
  37. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js.map +1 -0
  38. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts +89 -14
  39. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts.map +1 -1
  40. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js +84 -11
  41. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js.map +1 -1
  42. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts.map +1 -1
  43. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js +9 -1
  44. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
  45. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +49 -0
  46. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts.map +1 -1
  47. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js +171 -18
  48. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js.map +1 -1
  49. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts.map +1 -1
  50. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js +23 -3
  51. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js.map +1 -1
  52. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts.map +1 -1
  53. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js +20 -0
  54. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
  55. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts +22 -0
  56. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts.map +1 -1
  57. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.js.map +1 -1
  58. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts.map +1 -1
  59. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js +4 -1
  60. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js.map +1 -1
  61. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts +11 -0
  62. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts.map +1 -1
  63. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js +39 -5
  64. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js.map +1 -1
  65. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts +181 -2
  66. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
  67. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +529 -41
  68. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
  69. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts +36 -3
  70. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts.map +1 -1
  71. package/dist/esm/base-classes/services/services/system-access.backend.service.js +70 -8
  72. package/dist/esm/base-classes/services/services/system-access.backend.service.js.map +1 -1
  73. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts +28 -0
  74. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts.map +1 -0
  75. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js +90 -0
  76. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js.map +1 -0
  77. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts +44 -0
  78. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts.map +1 -0
  79. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js +99 -0
  80. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js.map +1 -0
  81. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts +91 -0
  82. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts.map +1 -0
  83. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js +152 -0
  84. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js.map +1 -0
  85. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts +186 -0
  86. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts.map +1 -0
  87. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js +474 -0
  88. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js.map +1 -0
  89. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts +100 -0
  90. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts.map +1 -1
  91. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js +209 -6
  92. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js.map +1 -1
  93. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts +200 -4
  94. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts.map +1 -1
  95. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js +593 -64
  96. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js.map +1 -1
  97. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts +36 -0
  98. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts.map +1 -0
  99. package/dist/esm/billing/services/billing-adapter-registry.backend.js +83 -0
  100. package/dist/esm/billing/services/billing-adapter-registry.backend.js.map +1 -0
  101. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts +9 -0
  102. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts.map +1 -1
  103. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js +11 -1
  104. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js.map +1 -1
  105. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.d.ts.map +1 -1
  106. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js +48 -7
  107. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
  108. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts +38 -1
  109. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts.map +1 -1
  110. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js +67 -2
  111. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js.map +1 -1
  112. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts +30 -1
  113. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts.map +1 -1
  114. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js +43 -1
  115. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js.map +1 -1
  116. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts +11 -3
  117. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
  118. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js +30 -16
  119. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js.map +1 -1
  120. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.d.ts.map +1 -1
  121. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js +104 -25
  122. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js.map +1 -1
  123. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts +18 -1
  124. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts.map +1 -1
  125. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js +106 -2
  126. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js.map +1 -1
  127. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts +52 -0
  128. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +1 -0
  129. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js +74 -0
  130. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +1 -0
  131. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts +104 -11
  132. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts.map +1 -1
  133. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js +260 -26
  134. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js.map +1 -1
  135. package/dist/esm/billing/testing/mock-billing-provider.d.ts +30 -1
  136. package/dist/esm/billing/testing/mock-billing-provider.d.ts.map +1 -1
  137. package/dist/esm/billing/testing/mock-billing-provider.js +25 -0
  138. package/dist/esm/billing/testing/mock-billing-provider.js.map +1 -1
  139. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js +11 -4
  140. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js.map +1 -1
  141. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts +225 -13
  142. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts.map +1 -1
  143. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js +340 -62
  144. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js.map +1 -1
  145. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts +244 -7
  146. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts.map +1 -1
  147. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js +386 -5
  148. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
  149. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.d.ts.map +1 -1
  150. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js +7 -1
  151. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js.map +1 -1
  152. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts +6 -2
  153. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
  154. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js +31 -9
  155. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -1
  156. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts +42 -0
  157. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts.map +1 -1
  158. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js +57 -1
  159. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
  160. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts +110 -0
  161. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts.map +1 -0
  162. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js +192 -0
  163. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js.map +1 -0
  164. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.d.ts.map +1 -1
  165. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js +31 -0
  166. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
  167. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts +5 -0
  168. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts.map +1 -1
  169. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js +6 -0
  170. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js.map +1 -1
  171. package/dist/esm/config/models/app-config.backend.schemas.d.ts +142 -46
  172. package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
  173. package/dist/esm/config/models/app-config.backend.schemas.js +121 -12
  174. package/dist/esm/config/models/app-config.backend.schemas.js.map +1 -1
  175. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts +38 -15
  176. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts.map +1 -1
  177. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js +17 -2
  178. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js.map +1 -1
  179. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts +0 -1
  180. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts.map +1 -1
  181. package/dist/esm/config/services/app-configuration-loader.backend.service.js +68 -76
  182. package/dist/esm/config/services/app-configuration-loader.backend.service.js.map +1 -1
  183. package/dist/esm/config/services/app-configuration.backend.service.d.ts.map +1 -1
  184. package/dist/esm/config/services/app-configuration.backend.service.js +23 -1
  185. package/dist/esm/config/services/app-configuration.backend.service.js.map +1 -1
  186. package/dist/esm/config/services/app-configuration.backend.utils.d.ts +33 -0
  187. package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
  188. package/dist/esm/config/services/app-configuration.backend.utils.js +39 -1
  189. package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
  190. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts +25 -0
  191. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts.map +1 -1
  192. package/dist/esm/config/services/application-startup-config-validator.backend.service.js +41 -1
  193. package/dist/esm/config/services/application-startup-config-validator.backend.service.js.map +1 -1
  194. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.d.ts.map +1 -1
  195. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js +48 -0
  196. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js.map +1 -1
  197. package/dist/esm/errors/services/error-builder.backend.service.d.ts +13 -1
  198. package/dist/esm/errors/services/error-builder.backend.service.d.ts.map +1 -1
  199. package/dist/esm/errors/services/error-builder.backend.service.js +13 -1
  200. package/dist/esm/errors/services/error-builder.backend.service.js.map +1 -1
  201. package/dist/esm/errors/services/error-handler.backend.service.d.ts +70 -7
  202. package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
  203. package/dist/esm/errors/services/error-handler.backend.service.js +129 -8
  204. package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
  205. package/dist/esm/errors/services/rate-limit.backend.service.d.ts +66 -0
  206. package/dist/esm/errors/services/rate-limit.backend.service.d.ts.map +1 -1
  207. package/dist/esm/errors/services/rate-limit.backend.service.js +102 -25
  208. package/dist/esm/errors/services/rate-limit.backend.service.js.map +1 -1
  209. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts +5 -0
  210. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts.map +1 -1
  211. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js +25 -0
  212. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js.map +1 -1
  213. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts +33 -0
  214. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts.map +1 -1
  215. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js +40 -0
  216. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js.map +1 -1
  217. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts +59 -2
  218. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts.map +1 -1
  219. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js +52 -17
  220. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
  221. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts +4 -2
  222. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts.map +1 -1
  223. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.js.map +1 -1
  224. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts +256 -0
  225. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts.map +1 -0
  226. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js +333 -0
  227. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js.map +1 -0
  228. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts +56 -0
  229. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts.map +1 -0
  230. package/dist/esm/external-providers/operations/provider-operation-request.backend.js +211 -0
  231. package/dist/esm/external-providers/operations/provider-operation-request.backend.js.map +1 -0
  232. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts +45 -0
  233. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts.map +1 -0
  234. package/dist/esm/external-providers/operations/provider-request-signing.backend.js +216 -0
  235. package/dist/esm/external-providers/operations/provider-request-signing.backend.js.map +1 -0
  236. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts +56 -0
  237. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts.map +1 -0
  238. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js +78 -0
  239. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js.map +1 -0
  240. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts +1 -1
  241. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts.map +1 -1
  242. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js +2 -2
  243. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js.map +1 -1
  244. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts +89 -0
  245. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts.map +1 -0
  246. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js +164 -0
  247. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js.map +1 -0
  248. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts +26 -27
  249. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts.map +1 -1
  250. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js +50 -64
  251. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js.map +1 -1
  252. package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts.map +1 -1
  253. package/dist/esm/external-providers/services/document-extraction.backend.service.js +3 -3
  254. package/dist/esm/external-providers/services/document-extraction.backend.service.js.map +1 -1
  255. package/dist/esm/external-providers/services/embeddings.backend.service.d.ts.map +1 -1
  256. package/dist/esm/external-providers/services/embeddings.backend.service.js +4 -4
  257. package/dist/esm/external-providers/services/embeddings.backend.service.js.map +1 -1
  258. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +292 -7
  259. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
  260. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +533 -45
  261. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
  262. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts.map +1 -1
  263. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js +25 -2
  264. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js.map +1 -1
  265. package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
  266. package/dist/esm/files/controllers/file.controller.js +21 -13
  267. package/dist/esm/files/controllers/file.controller.js.map +1 -1
  268. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts.map +1 -1
  269. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js +39 -15
  270. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
  271. package/dist/esm/files/services/file-scanning.backend.service.d.ts +94 -9
  272. package/dist/esm/files/services/file-scanning.backend.service.d.ts.map +1 -1
  273. package/dist/esm/files/services/file-scanning.backend.service.js +197 -17
  274. package/dist/esm/files/services/file-scanning.backend.service.js.map +1 -1
  275. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts +60 -1
  276. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts.map +1 -1
  277. package/dist/esm/files/services/file-text-extraction.backend.service.js +167 -8
  278. package/dist/esm/files/services/file-text-extraction.backend.service.js.map +1 -1
  279. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts +53 -2
  280. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -1
  281. package/dist/esm/files/services/file-upload-grant.backend.service.js +127 -3
  282. package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -1
  283. package/dist/esm/files/services/files.backend.service.d.ts +68 -0
  284. package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
  285. package/dist/esm/files/services/files.backend.service.js +175 -5
  286. package/dist/esm/files/services/files.backend.service.js.map +1 -1
  287. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts +109 -0
  288. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts.map +1 -0
  289. package/dist/esm/files/storage/application-storage-key.backend.utils.js +123 -0
  290. package/dist/esm/files/storage/application-storage-key.backend.utils.js.map +1 -0
  291. package/dist/esm/files/storage/file-storage-provider.types.d.ts +16 -10
  292. package/dist/esm/files/storage/file-storage-provider.types.d.ts.map +1 -1
  293. package/dist/esm/files/storage/file-storage-provider.types.js.map +1 -1
  294. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts +67 -8
  295. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts.map +1 -1
  296. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js +101 -28
  297. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js.map +1 -1
  298. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.d.ts.map +1 -1
  299. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js +8 -55
  300. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js.map +1 -1
  301. package/dist/esm/files/utils/file-field-schema-path.backend.utils.d.ts.map +1 -1
  302. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js +20 -0
  303. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js.map +1 -1
  304. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts +86 -0
  305. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts.map +1 -0
  306. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js +288 -0
  307. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js.map +1 -0
  308. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts +15 -0
  309. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts.map +1 -1
  310. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js +76 -5
  311. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js.map +1 -1
  312. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.d.ts.map +1 -1
  313. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js +6 -1
  314. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js.map +1 -1
  315. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts +60 -0
  316. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts.map +1 -1
  317. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js +63 -0
  318. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js.map +1 -1
  319. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts +74 -0
  320. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts.map +1 -1
  321. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js +196 -40
  322. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
  323. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts +7 -1
  324. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts.map +1 -1
  325. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js +53 -1
  326. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js.map +1 -1
  327. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts +18 -0
  328. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts.map +1 -1
  329. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js +18 -0
  330. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js.map +1 -1
  331. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts +12 -7
  332. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts.map +1 -1
  333. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.js.map +1 -1
  334. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts +0 -13
  335. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts.map +1 -1
  336. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js +14 -22
  337. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js.map +1 -1
  338. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts +8 -3
  339. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts.map +1 -1
  340. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js +25 -15
  341. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js.map +1 -1
  342. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts +13 -1
  343. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts.map +1 -1
  344. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.js.map +1 -1
  345. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts +88 -8
  346. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts.map +1 -1
  347. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js +333 -31
  348. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js.map +1 -1
  349. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.d.ts.map +1 -1
  350. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js +4 -2
  351. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js.map +1 -1
  352. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts +113 -0
  353. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts.map +1 -0
  354. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js +62 -0
  355. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js.map +1 -0
  356. package/dist/esm/flows-actors/services/actors-system.backend.service.d.ts.map +1 -1
  357. package/dist/esm/flows-actors/services/actors-system.backend.service.js +0 -2
  358. package/dist/esm/flows-actors/services/actors-system.backend.service.js.map +1 -1
  359. package/dist/esm/flows-actors/services/agents.backend.service.d.ts +28 -1
  360. package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
  361. package/dist/esm/flows-actors/services/agents.backend.service.js +204 -18
  362. package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
  363. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts +5 -1
  364. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts.map +1 -1
  365. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js +79 -16
  366. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js.map +1 -1
  367. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts +34 -5
  368. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts.map +1 -1
  369. package/dist/esm/flows-actors/services/flows-actors-registry.service.js +154 -20
  370. package/dist/esm/flows-actors/services/flows-actors-registry.service.js.map +1 -1
  371. package/dist/esm/flows-actors/services/flows.backend.services.d.ts.map +1 -1
  372. package/dist/esm/flows-actors/services/flows.backend.services.js +27 -23
  373. package/dist/esm/flows-actors/services/flows.backend.services.js.map +1 -1
  374. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.d.ts.map +1 -1
  375. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js +7 -1
  376. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js.map +1 -1
  377. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts +90 -0
  378. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts.map +1 -0
  379. package/dist/esm/flows-actors/services/mcp-client.backend.service.js +368 -0
  380. package/dist/esm/flows-actors/services/mcp-client.backend.service.js.map +1 -0
  381. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts +9 -5
  382. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts.map +1 -1
  383. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js +12 -17
  384. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js.map +1 -1
  385. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
  386. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +8 -4
  387. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
  388. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts +0 -207
  389. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts.map +1 -1
  390. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js +8 -243
  391. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js.map +1 -1
  392. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.d.ts.map +1 -1
  393. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.js.map +1 -1
  394. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts +9 -14
  395. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts.map +1 -1
  396. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js +18 -89
  397. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js.map +1 -1
  398. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts +86 -0
  399. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts.map +1 -0
  400. package/dist/esm/guidance/services/progression-state-store.backend.service.js +155 -0
  401. package/dist/esm/guidance/services/progression-state-store.backend.service.js.map +1 -0
  402. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts +10 -0
  403. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts.map +1 -1
  404. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js +55 -5
  405. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js.map +1 -1
  406. package/dist/esm/index.d.ts +11 -4
  407. package/dist/esm/index.d.ts.map +1 -1
  408. package/dist/esm/index.js +31 -4
  409. package/dist/esm/index.js.map +1 -1
  410. package/dist/esm/inject/models/container.d.ts.map +1 -1
  411. package/dist/esm/inject/models/container.js +78 -10
  412. package/dist/esm/inject/models/container.js.map +1 -1
  413. package/dist/esm/inject/models/service-types.d.ts +17 -3
  414. package/dist/esm/inject/models/service-types.d.ts.map +1 -1
  415. package/dist/esm/inject/models/service-types.js +19 -3
  416. package/dist/esm/inject/models/service-types.js.map +1 -1
  417. package/dist/esm/mcp/controllers/mcp.controller.d.ts.map +1 -1
  418. package/dist/esm/mcp/controllers/mcp.controller.js +20 -0
  419. package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
  420. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts +56 -1
  421. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts.map +1 -1
  422. package/dist/esm/mcp/services/mcp-server.backend.service.js +107 -11
  423. package/dist/esm/mcp/services/mcp-server.backend.service.js.map +1 -1
  424. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts.map +1 -1
  425. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js +22 -0
  426. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
  427. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.d.ts.map +1 -1
  428. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js +49 -4
  429. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js.map +1 -1
  430. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts +66 -0
  431. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts.map +1 -0
  432. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js +199 -0
  433. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js.map +1 -0
  434. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts +149 -13
  435. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts.map +1 -1
  436. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js +411 -19
  437. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js.map +1 -1
  438. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts +11 -2
  439. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts.map +1 -1
  440. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.js.map +1 -1
  441. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts +28 -9
  442. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts.map +1 -1
  443. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js +30 -10
  444. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js.map +1 -1
  445. package/dist/esm/monitoring/logger/services/logger.service.d.ts +12 -0
  446. package/dist/esm/monitoring/logger/services/logger.service.d.ts.map +1 -1
  447. package/dist/esm/monitoring/logger/services/logger.service.js +52 -11
  448. package/dist/esm/monitoring/logger/services/logger.service.js.map +1 -1
  449. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts +62 -0
  450. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts.map +1 -0
  451. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js +78 -0
  452. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js.map +1 -0
  453. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts +309 -0
  454. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts.map +1 -0
  455. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js +385 -0
  456. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js.map +1 -0
  457. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts +1 -0
  458. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts.map +1 -1
  459. package/dist/esm/monitoring/observability/models/observability.backend.schemas.js.map +1 -1
  460. package/dist/esm/monitoring/observability/services/metrics.service.d.ts +21 -0
  461. package/dist/esm/monitoring/observability/services/metrics.service.d.ts.map +1 -1
  462. package/dist/esm/monitoring/observability/services/metrics.service.js +38 -0
  463. package/dist/esm/monitoring/observability/services/metrics.service.js.map +1 -1
  464. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts +0 -80
  465. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts.map +0 -1
  466. package/dist/esm/notifications/email/models/email-context-provider.interface.js +0 -25
  467. package/dist/esm/notifications/email/models/email-context-provider.interface.js.map +0 -1
  468. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts +0 -49
  469. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts.map +0 -1
  470. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js +0 -141
  471. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js.map +0 -1
  472. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts +0 -37
  473. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts.map +0 -1
  474. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js +0 -121
  475. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js.map +0 -1
  476. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts +66 -1
  477. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts.map +1 -1
  478. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js +105 -10
  479. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js.map +1 -1
  480. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts +0 -58
  481. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts.map +0 -1
  482. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js +0 -223
  483. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js.map +0 -1
  484. package/dist/esm/notifications/email/services/email-template-validator.backend.service.d.ts.map +1 -1
  485. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js +10 -1
  486. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js.map +1 -1
  487. package/dist/esm/notifications/email/services/email.backend.service.d.ts +60 -4
  488. package/dist/esm/notifications/email/services/email.backend.service.d.ts.map +1 -1
  489. package/dist/esm/notifications/email/services/email.backend.service.js +145 -43
  490. package/dist/esm/notifications/email/services/email.backend.service.js.map +1 -1
  491. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts +0 -1
  492. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts.map +1 -1
  493. package/dist/esm/notifications/email/utils/color-conversion.utils.js.map +1 -1
  494. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts +142 -21
  495. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts.map +1 -1
  496. package/dist/esm/notifications/services/notification-badge.backend.service.js +283 -58
  497. package/dist/esm/notifications/services/notification-badge.backend.service.js.map +1 -1
  498. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts +99 -13
  499. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
  500. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js +422 -66
  501. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
  502. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts +2 -2
  503. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts.map +1 -1
  504. package/dist/esm/notifications/sms/services/sms.backend.service.js +5 -5
  505. package/dist/esm/notifications/sms/services/sms.backend.service.js.map +1 -1
  506. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts +117 -5
  507. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts.map +1 -1
  508. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js +164 -6
  509. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js.map +1 -1
  510. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts +0 -6
  511. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  512. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js +46 -1
  513. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
  514. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts.map +1 -1
  515. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js +16 -6
  516. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js.map +1 -1
  517. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.d.ts.map +1 -1
  518. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js +12 -12
  519. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
  520. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts +16 -0
  521. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts.map +1 -1
  522. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js +18 -0
  523. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js.map +1 -1
  524. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.d.ts +2 -2
  525. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js +2 -2
  526. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js.map +1 -1
  527. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.d.ts.map +1 -1
  528. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js +63 -2
  529. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js.map +1 -1
  530. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts +66 -0
  531. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts.map +1 -0
  532. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js +257 -0
  533. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js.map +1 -0
  534. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts +12 -0
  535. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts.map +1 -0
  536. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js +47 -0
  537. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js.map +1 -0
  538. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts +87 -0
  539. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts.map +1 -0
  540. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js +1 -0
  541. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js.map +1 -0
  542. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts +31 -0
  543. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts.map +1 -0
  544. package/dist/esm/queue/adapters/queue-adapter.backend.options.js +13 -0
  545. package/dist/esm/queue/adapters/queue-adapter.backend.options.js.map +1 -0
  546. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts +19 -25
  547. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts.map +1 -1
  548. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js +33 -0
  549. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js.map +1 -1
  550. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts +2 -2
  551. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts.map +1 -1
  552. package/dist/esm/queue/domain-queue-consumer.backend.service.js +1 -4
  553. package/dist/esm/queue/domain-queue-consumer.backend.service.js.map +1 -1
  554. package/dist/esm/queue/job-consumer.backend.service.d.ts +2 -2
  555. package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
  556. package/dist/esm/queue/job-consumer.backend.service.js +1 -4
  557. package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
  558. package/dist/esm/queue/job-executor.backend.service.d.ts +2 -2
  559. package/dist/esm/queue/job-executor.backend.service.d.ts.map +1 -1
  560. package/dist/esm/queue/job-executor.backend.service.js +1 -4
  561. package/dist/esm/queue/job-executor.backend.service.js.map +1 -1
  562. package/dist/esm/queue/queue-monitoring.backend.service.d.ts +8 -4
  563. package/dist/esm/queue/queue-monitoring.backend.service.d.ts.map +1 -1
  564. package/dist/esm/queue/queue-monitoring.backend.service.js +25 -17
  565. package/dist/esm/queue/queue-monitoring.backend.service.js.map +1 -1
  566. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts +16 -1
  567. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts.map +1 -1
  568. package/dist/esm/queue/queue-worker-initializer.backend.service.js +16 -1
  569. package/dist/esm/queue/queue-worker-initializer.backend.service.js.map +1 -1
  570. package/dist/esm/queue/queue.backend.service.d.ts +3 -3
  571. package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
  572. package/dist/esm/queue/queue.backend.service.js +26 -4
  573. package/dist/esm/queue/queue.backend.service.js.map +1 -1
  574. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts +2 -2
  575. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts.map +1 -1
  576. package/dist/esm/queue/worker-shutdown-manager.backend.service.js +18 -3
  577. package/dist/esm/queue/worker-shutdown-manager.backend.service.js.map +1 -1
  578. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts +50 -25
  579. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts.map +1 -1
  580. package/dist/esm/rag/utils/rag-chunking.backend.utils.js +147 -39
  581. package/dist/esm/rag/utils/rag-chunking.backend.utils.js.map +1 -1
  582. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts +12 -3
  583. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts.map +1 -1
  584. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js +12 -3
  585. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js.map +1 -1
  586. package/dist/esm/requests/service/websocket.service.d.ts +9 -0
  587. package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
  588. package/dist/esm/requests/service/websocket.service.js +32 -8
  589. package/dist/esm/requests/service/websocket.service.js.map +1 -1
  590. package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map +1 -1
  591. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js +14 -2
  592. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
  593. package/dist/esm/resources/models/resources-operations.backend.definitions.d.ts.map +1 -1
  594. package/dist/esm/resources/models/resources-operations.backend.definitions.js +2 -0
  595. package/dist/esm/resources/models/resources-operations.backend.definitions.js.map +1 -1
  596. package/dist/esm/resources/models/resources-relationships.backend.definitions.d.ts.map +1 -1
  597. package/dist/esm/resources/models/resources-relationships.backend.definitions.js +14 -0
  598. package/dist/esm/resources/models/resources-relationships.backend.definitions.js.map +1 -1
  599. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts +2 -1
  600. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts.map +1 -1
  601. package/dist/esm/resources/models/resources-types.backend.schemas.js +8 -0
  602. package/dist/esm/resources/models/resources-types.backend.schemas.js.map +1 -1
  603. package/dist/esm/resources/services/resources-registry.backend.service.d.ts +60 -5
  604. package/dist/esm/resources/services/resources-registry.backend.service.d.ts.map +1 -1
  605. package/dist/esm/resources/services/resources-registry.backend.service.js +90 -6
  606. package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
  607. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts +36 -3
  608. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts.map +1 -1
  609. package/dist/esm/runtime/controllers/health-controller.backend.service.js +32 -10
  610. package/dist/esm/runtime/controllers/health-controller.backend.service.js.map +1 -1
  611. package/dist/esm/runtime/domain-module.backend.definitions.d.ts +24 -0
  612. package/dist/esm/runtime/domain-module.backend.definitions.d.ts.map +1 -1
  613. package/dist/esm/runtime/domain-module.backend.definitions.js +24 -0
  614. package/dist/esm/runtime/domain-module.backend.definitions.js.map +1 -1
  615. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts +51 -0
  616. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts.map +1 -1
  617. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.js.map +1 -1
  618. package/dist/esm/runtime/services/http-server.backend.service.d.ts +26 -0
  619. package/dist/esm/runtime/services/http-server.backend.service.d.ts.map +1 -1
  620. package/dist/esm/runtime/services/http-server.backend.service.js +181 -1
  621. package/dist/esm/runtime/services/http-server.backend.service.js.map +1 -1
  622. package/dist/esm/runtime/services/start-application.backend.service.d.ts +19 -1
  623. package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
  624. package/dist/esm/runtime/services/start-application.backend.service.js +261 -77
  625. package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
  626. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts +15 -0
  627. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts.map +1 -1
  628. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js +28 -0
  629. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js.map +1 -1
  630. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts +5 -1
  631. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts.map +1 -1
  632. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js +24 -4
  633. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js.map +1 -1
  634. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts.map +1 -1
  635. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js +29 -4
  636. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js.map +1 -1
  637. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts +114 -0
  638. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts.map +1 -1
  639. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js +354 -3
  640. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js.map +1 -1
  641. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts +1 -0
  642. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts.map +1 -1
  643. package/dist/esm/security/authentications/models/cimd.backend.schemas.js +22 -0
  644. package/dist/esm/security/authentications/models/cimd.backend.schemas.js.map +1 -1
  645. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts +15 -0
  646. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts.map +1 -1
  647. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.js.map +1 -1
  648. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts +0 -2
  649. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts.map +1 -1
  650. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js +23 -14
  651. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js.map +1 -1
  652. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts +0 -1
  653. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts.map +1 -1
  654. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js +15 -12
  655. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js.map +1 -1
  656. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts +113 -3
  657. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts.map +1 -1
  658. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js +207 -30
  659. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js.map +1 -1
  660. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts +95 -2
  661. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts.map +1 -1
  662. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js +153 -9
  663. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js.map +1 -1
  664. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts +190 -0
  665. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts.map +1 -1
  666. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js +377 -53
  667. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js.map +1 -1
  668. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts.map +1 -1
  669. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js +68 -1
  670. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js.map +1 -1
  671. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts +41 -0
  672. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts.map +1 -1
  673. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js +202 -23
  674. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js.map +1 -1
  675. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts.map +1 -1
  676. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js +42 -1
  677. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js.map +1 -1
  678. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts.map +1 -1
  679. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js +34 -4
  680. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js.map +1 -1
  681. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts +29 -5
  682. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts.map +1 -1
  683. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js +77 -5
  684. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js.map +1 -1
  685. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts +17 -1
  686. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts.map +1 -1
  687. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js +49 -17
  688. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
  689. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts +43 -1
  690. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts.map +1 -1
  691. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js +277 -97
  692. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js.map +1 -1
  693. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts +28 -5
  694. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts.map +1 -1
  695. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js +72 -12
  696. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js.map +1 -1
  697. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.d.ts.map +1 -1
  698. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js +3 -0
  699. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js.map +1 -1
  700. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts +28 -0
  701. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts.map +1 -0
  702. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js +283 -0
  703. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js.map +1 -0
  704. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts +4 -3
  705. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts.map +1 -1
  706. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js +4 -3
  707. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js.map +1 -1
  708. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts +35 -0
  709. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts.map +1 -1
  710. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js +111 -21
  711. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js.map +1 -1
  712. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts +14 -1
  713. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts.map +1 -1
  714. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js +49 -8
  715. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js.map +1 -1
  716. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.d.ts.map +1 -1
  717. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js +4 -0
  718. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js.map +1 -1
  719. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.d.ts.map +1 -1
  720. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js +6 -0
  721. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js.map +1 -1
  722. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts +37 -1
  723. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts.map +1 -1
  724. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js +51 -0
  725. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js.map +1 -1
  726. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts +41 -0
  727. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts.map +1 -1
  728. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js +45 -0
  729. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js.map +1 -1
  730. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts +116 -0
  731. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts.map +1 -0
  732. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js +162 -0
  733. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js.map +1 -0
  734. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts +20 -20
  735. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts.map +1 -1
  736. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js +27 -28
  737. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js.map +1 -1
  738. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.d.ts.map +1 -1
  739. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js +77 -3
  740. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js.map +1 -1
  741. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts +4 -0
  742. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts.map +1 -1
  743. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js +4 -0
  744. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js.map +1 -1
  745. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts +93 -0
  746. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts.map +1 -0
  747. package/dist/esm/security/authorizations/role-conferral.backend.utils.js +95 -0
  748. package/dist/esm/security/authorizations/role-conferral.backend.utils.js.map +1 -0
  749. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts +124 -1
  750. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts.map +1 -1
  751. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js +142 -5
  752. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js.map +1 -1
  753. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +74 -8
  754. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
  755. package/dist/esm/security/authorizations/services/authorizations.backend.service.js +175 -19
  756. package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
  757. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts +6 -14
  758. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts.map +1 -1
  759. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js +13 -22
  760. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js.map +1 -1
  761. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts +60 -0
  762. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts.map +1 -0
  763. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js +79 -0
  764. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js.map +1 -0
  765. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts +161 -0
  766. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts.map +1 -0
  767. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js +512 -0
  768. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js.map +1 -0
  769. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts +59 -0
  770. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts.map +1 -0
  771. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js +22 -0
  772. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js.map +1 -0
  773. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts +44 -0
  774. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts.map +1 -0
  775. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js +20 -0
  776. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js.map +1 -0
  777. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts +191 -0
  778. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts.map +1 -0
  779. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js +385 -0
  780. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js.map +1 -0
  781. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts +41 -0
  782. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
  783. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js +358 -0
  784. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js.map +1 -0
  785. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts +160 -0
  786. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts.map +1 -0
  787. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js +266 -0
  788. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js.map +1 -0
  789. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts +111 -0
  790. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts.map +1 -0
  791. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js +107 -0
  792. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js.map +1 -0
  793. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts +54 -0
  794. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts.map +1 -0
  795. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js +153 -0
  796. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js.map +1 -0
  797. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts +195 -0
  798. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts.map +1 -0
  799. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js +387 -0
  800. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js.map +1 -0
  801. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts +45 -0
  802. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
  803. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js +291 -0
  804. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js.map +1 -0
  805. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts +62 -0
  806. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts.map +1 -0
  807. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js +29 -0
  808. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js.map +1 -0
  809. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts +127 -0
  810. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts.map +1 -0
  811. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js +277 -0
  812. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js.map +1 -0
  813. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts +66 -0
  814. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts.map +1 -0
  815. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js +75 -0
  816. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js.map +1 -0
  817. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts +21 -3
  818. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts.map +1 -1
  819. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js +26 -16
  820. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
  821. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts +9 -4
  822. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts.map +1 -1
  823. package/dist/esm/security/credential-rotation-grace.backend.utils.js +9 -4
  824. package/dist/esm/security/credential-rotation-grace.backend.utils.js.map +1 -1
  825. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts +26 -0
  826. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts.map +1 -1
  827. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js +43 -0
  828. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js.map +1 -1
  829. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts +8 -1
  830. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts.map +1 -1
  831. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js +49 -0
  832. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js.map +1 -1
  833. package/dist/esm/security/scim/controllers/scim.backend.controller.d.ts.map +1 -1
  834. package/dist/esm/security/scim/controllers/scim.backend.controller.js +17 -5
  835. package/dist/esm/security/scim/controllers/scim.backend.controller.js.map +1 -1
  836. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts +67 -29
  837. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts.map +1 -1
  838. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js +47 -25
  839. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js.map +1 -1
  840. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts +10 -2
  841. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts.map +1 -1
  842. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js +10 -2
  843. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js.map +1 -1
  844. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts +143 -0
  845. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts.map +1 -0
  846. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js +258 -0
  847. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js.map +1 -0
  848. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts +39 -0
  849. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts.map +1 -0
  850. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js +159 -0
  851. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js.map +1 -0
  852. package/dist/tsconfig.build.tsbuildinfo +1 -1
  853. package/package.json +11 -9
@@ -6,6 +6,7 @@ import { ExecutionContext } from '../../runtime/models/execution-context.backend
6
6
  import { AuthorizationsBackendService } from '../../security/authorizations/services/authorizations.backend.service';
7
7
  import { ServicesRegistryHandlerBackendService } from '../../base-classes/services/services/services-registry-handler.backend.service';
8
8
  import { ResourcesRegistryBackendService } from '../../resources/services/resources-registry.backend.service';
9
+ import { RateLimitBackendService } from '../../errors/services/rate-limit.backend.service';
9
10
  import { McpToolAdapterBackendService } from '../../mcp/services/mcp-tool-adapter.backend.service';
10
11
  import { McpToolDescriptor, McpToolAdapterBuildOptions } from '../../mcp/models/mcp-tool.backend.schemas';
11
12
  /**
@@ -46,8 +47,9 @@ export declare class McpServerBackendService {
46
47
  protected readonly resourcesRegistry: ResourcesRegistryBackendService;
47
48
  protected readonly fileUploadGrantService: FileUploadGrantBackendService;
48
49
  protected readonly appConfigService: AppConfigurationService;
50
+ protected readonly rateLimitService: RateLimitBackendService;
49
51
  protected logDebug: (message: string, context?: Record<string, unknown>) => void;
50
- constructor(logger: LoggerService, errorBuilder: ErrorBuilderBackendService, toolAdapter: McpToolAdapterBackendService, authorizer: AuthorizationsBackendService, servicesHandler: ServicesRegistryHandlerBackendService, resourcesRegistry: ResourcesRegistryBackendService, fileUploadGrantService: FileUploadGrantBackendService, appConfigService: AppConfigurationService);
52
+ constructor(logger: LoggerService, errorBuilder: ErrorBuilderBackendService, toolAdapter: McpToolAdapterBackendService, authorizer: AuthorizationsBackendService, servicesHandler: ServicesRegistryHandlerBackendService, resourcesRegistry: ResourcesRegistryBackendService, fileUploadGrantService: FileUploadGrantBackendService, appConfigService: AppConfigurationService, rateLimitService: RateLimitBackendService);
51
53
  /**
52
54
  * Return the exposed tool descriptors for the caller's reachable scopes (`options.reachableScopes`).
53
55
  * PROGRESSIVE principal-awareness (C): a caller presenting a valid Bearer bound to this endpoint
@@ -69,6 +71,59 @@ export declare class McpServerBackendService {
69
71
  * @throws NOT_FOUND when the tool name does not map to an exposable operation.
70
72
  */
71
73
  callTool(toolName: string, args: unknown, executionContext: ExecutionContext<any>, options?: McpCallToolOptions): Promise<McpCallToolResult>;
74
+ /**
75
+ * Enforce the resolved operation's OWN `rateLimit?` policy on the tool plane.
76
+ *
77
+ * ## What was broken
78
+ *
79
+ * `rateLimit?` is authored on an `API_CALL` / `API_CALL_WITH_CALLBACK` variant and was enforced
80
+ * by exactly one consumer — `RateLimitBackendService.checkPolicyForVariant`, called from the
81
+ * resource controller's HTTP pre-flight. `callTool` dispatches the SAME operation through the
82
+ * SAME service pipeline while bypassing Express entirely, so the identical operation was
83
+ * throttled over REST and unthrottled as a tool. An application that declared a budget on an
84
+ * endpoint got one; an agent asked for the same endpoint by its tool name and got none.
85
+ *
86
+ * ## Subject: the CREDENTIAL, not the IP and not the tenant
87
+ *
88
+ * See {@link resolveDeclaredPolicySubjectKey} for the full argument. In short: the HTTP seam
89
+ * keys on the source IP because at its pre-flight moment no identity exists yet, so `5/min` has
90
+ * always meant "5/min per CLIENT". On this plane the client is the credential the agent
91
+ * presented — a server-verified field of the execution context, never anything the model
92
+ * supplied. Keying on the tenant instead would make the same authored number several times
93
+ * stricter here than over REST for any tenant running more than one agent.
94
+ *
95
+ * ## Scope: a SEPARATE bucket from the REST route, deliberately
96
+ *
97
+ * The key is namespaced `mcp:resource:<resource>:<operation>` rather than sharing the HTTP
98
+ * seam's `resource:<resource>:<operation>`. Sharing would be incoherent — the two seams count
99
+ * different SUBJECTS (an IP and a credential), so one bucket would mix two identity spaces and
100
+ * let a browser's traffic spend an agent's budget. Per-plane-per-client is the faithful
101
+ * extension of a policy that was already per-client rather than a global cap.
102
+ *
103
+ * ## Not applied to the derived upload-grant tool
104
+ *
105
+ * `callUploadGrantTool` MINTS a grant; it does not dispatch the parent operation. Charging the
106
+ * parent's budget there would spend two slots for one upload (mint + the upload itself, which
107
+ * traverses the real HTTP route and meets `checkPolicyForVariant`) while a REST client spends
108
+ * one — the declared number would mean something different depending on how the caller got the
109
+ * URL. It is left uncharged for that reason, not by omission.
110
+ *
111
+ * ## Postures
112
+ *
113
+ * - **No declared policy, or a non-HTTP variant** → no-op, zero Redis traffic. Mirrors
114
+ * `checkPolicyForVariant`'s two early returns exactly; the variant guard is defensive, since
115
+ * `resolveExposableOperation` only ever yields a URL-bearing default.
116
+ * - **Unkeyable subject** → not enforced, logged. Structurally unreachable: `callTool` is only
117
+ * reached post-authentication, and `ExecutionContext`'s own constructor rejects an
118
+ * authenticated principal carrying no identity field. It is not "unbounded" either — the
119
+ * transport's blanket per-principal cap is the backstop, and it declines on exactly the same
120
+ * input. Refusing a well-formed call here instead would invent an outage out of a branch that
121
+ * cannot happen.
122
+ * - **Limiter outage** → propagates, as it does over HTTP for the same declared policy. An
123
+ * authored budget must not quietly become "unlimited" on one plane while it is a 500 on the
124
+ * other.
125
+ */
126
+ private assertOperationRateLimitPolicy;
72
127
  /**
73
128
  * Execute a derived upload-grant tool (issue #312, D11).
74
129
  *
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-server.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/services/mcp-server.backend.service.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,6BAA6B,EAAE,MAAM,qEAAqE,CAAC;AACpH,OAAO,EAAE,uBAAuB,EAAE,MAAM,sEAAsE,CAAC;AAE/G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAC9G,OAAO,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAC;AACvG,OAAO,EAAE,4BAA4B,EAAE,MAAM,oFAAoF,CAAC;AAClI,OAAO,EAAE,qCAAqC,EAAE,MAAM,6FAA6F,CAAC;AAGpJ,OAAO,EAAE,+BAA+B,EAAE,MAAM,0EAA0E,CAAC;AAC3H,OAAO,EACL,4BAA4B,EAK7B,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAE3B,MAAM,wDAAwD,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AA0CD,qBACa,uBAAuB;IAIG,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,aAAa;IAC3B,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,0BAA0B;IAChE,SAAS,CAAC,QAAQ,CAAC,WAAW,EAA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B"}
@@ -11,7 +11,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
11
  return function (target, key) { decorator(target, key, paramIndex); }
12
12
  };
13
13
  import { injectable, inject } from 'inversify';
14
- import { ResourcesConfig_OperationPathUtils, CoreResourceOperation, ErrorType, ErrorCustomMessageReference, BackendApiType, MAIN_API_BASE_PATH, FileUploadGrantMintRequestSchema, ResourcesConfigOperationsUrlsBuilderUtils, } from '@wildo-ai/saas-models';
14
+ import { ResourceOperationVariantType, ResourcesConfig_OperationPathUtils, CoreResourceOperation, ErrorType, ErrorCustomMessageReference, BackendApiType, MAIN_API_BASE_PATH, FileUploadGrantMintRequestSchema, ResourcesConfigOperationsUrlsBuilderUtils, } from '@wildo-ai/saas-models';
15
15
  import { z } from 'zod';
16
16
  import { SAAS_SERVICE_TYPES } from '../../inject/models/service-types.js';
17
17
  import { FileUploadGrantBackendService } from '../../files/services/file-upload-grant.backend.service.js';
@@ -23,6 +23,8 @@ import { ServicesRegistryHandlerBackendService } from '../../base-classes/servic
23
23
  import { toResponseSafeToolOutput } from '../../base-classes/services/controllers/utils/operation-response-serializer.backend.utils.js';
24
24
  import { normalizeCollectionQueryRequestData } from '../../base-classes/services/controllers/controller-resource.backend.service.js';
25
25
  import { ResourcesRegistryBackendService } from '../../resources/services/resources-registry.backend.service.js';
26
+ import { RateLimitBackendService } from '../../errors/services/rate-limit.backend.service.js';
27
+ import { resolveDeclaredPolicySubjectKey } from '../../security/authentications/services/utils/external-turn-rate-limit.backend.utils.js';
26
28
  import { McpToolAdapterBackendService, mcpReachableScopesForPrincipal, mcpPrincipalForAuthenticatedCaller, resolveEffectiveMcpOperation, isCollectionQueryMcpOperation, } from '../../mcp/services/mcp-tool-adapter.backend.service.js';
27
29
  import { MCP_TOOL_NAME_SEPARATOR, } from '../../mcp/models/mcp-tool.backend.schemas.js';
28
30
  /**
@@ -37,14 +39,24 @@ import { MCP_TOOL_NAME_SEPARATOR, } from '../../mcp/models/mcp-tool.backend.sche
37
39
  *
38
40
  * - `listTools()` delegates to {@link McpToolAdapterBackendService}.
39
41
  * - `callTool()` resolves the target operation, RE-RUNS `authorizeInController`
40
- * against the caller's execution context (fail-closed), then invokes the
41
- * service pipeline DIRECTLY via {@link ServicesRegistryHandlerBackendService}
42
- * (never re-HTTP). The service pipeline enforces `requiredFeatures` /
43
- * `enabledCondition` downstream.
44
- * - KNOWN GAP (tracked — `.claude/plans/mcp-server-followups.md` Item 5): the
45
- * per-route HTTP rate-limit middleware is bypassed on this direct dispatch path,
46
- * so an operation's `rateLimit` policy is not yet enforced here. The planned fix
47
- * is a per-principal quota shared with the A2A dispatch surface.
42
+ * against the caller's execution context (fail-closed), enforces the operation's
43
+ * own declared `rateLimit` policy (see `assertOperationRateLimitPolicy`), then
44
+ * invokes the service pipeline DIRECTLY via
45
+ * {@link ServicesRegistryHandlerBackendService} (never re-HTTP). The service
46
+ * pipeline enforces `requiredFeatures` / `enabledCondition` downstream.
47
+ * - RATE LIMITING on this plane is now TWO guards, and they answer different questions:
48
+ * the transport applies the framework's blanket per-principal `tools/call` cap
49
+ * (`MCP_EXTERNAL_CALL_RATE_MAX`, an abuse throttle nobody declared, fails OPEN), and
50
+ * THIS service applies the operation's own AUTHORED `rateLimit` (a statement the
51
+ * application made about that endpoint, enforced identically to the HTTP seam). The
52
+ * second one lives here rather than in the transport for the same reason
53
+ * `authorizeInController` does: it is a property of the OPERATION, so a second
54
+ * transport backed by this core must inherit it rather than re-implement it.
55
+ * (Historical note: the block that stood here recorded the per-operation policy as a
56
+ * KNOWN GAP whose "planned fix is a per-principal quota shared with the A2A dispatch
57
+ * surface". That per-principal quota SHIPPED — `assertExternalTurnWithinRate`, used by
58
+ * both `MCPControllerBackendService` and `A2ABackendService` — and the comment was
59
+ * never updated, so it read as wholly open when only its per-operation half was.)
48
60
  * - Server-initiated streaming (SSE / notifications / progress) is intentionally
49
61
  * absent: every exposed operation is synchronous request/response, for which a
50
62
  * single JSON response is Streamable-HTTP-compliant (Item 1, deferred).
@@ -73,8 +85,9 @@ let McpServerBackendService = class McpServerBackendService {
73
85
  resourcesRegistry;
74
86
  fileUploadGrantService;
75
87
  appConfigService;
88
+ rateLimitService;
76
89
  logDebug;
77
- constructor(logger, errorBuilder, toolAdapter, authorizer, servicesHandler, resourcesRegistry, fileUploadGrantService, appConfigService) {
90
+ constructor(logger, errorBuilder, toolAdapter, authorizer, servicesHandler, resourcesRegistry, fileUploadGrantService, appConfigService, rateLimitService) {
78
91
  this.logger = logger;
79
92
  this.errorBuilder = errorBuilder;
80
93
  this.toolAdapter = toolAdapter;
@@ -83,6 +96,7 @@ let McpServerBackendService = class McpServerBackendService {
83
96
  this.resourcesRegistry = resourcesRegistry;
84
97
  this.fileUploadGrantService = fileUploadGrantService;
85
98
  this.appConfigService = appConfigService;
99
+ this.rateLimitService = rateLimitService;
86
100
  this.logDebug = this.logger.debugByType('McpServerBackendService');
87
101
  this.logger.setDebugTypeLogging('McpServerBackendService', false);
88
102
  }
@@ -141,6 +155,14 @@ let McpServerBackendService = class McpServerBackendService {
141
155
  // Fail-closed per-operation authorization: reads `operation.roles` +
142
156
  // `executionContext.initiatorRoles` / scope. Throws AUTHORIZATION on denial.
143
157
  await this.authorizer.authorizeInController(idOrIds, boundExecutionContext);
158
+ // The operation's OWN declared request budget. AFTER authorization on purpose: a caller who may
159
+ // not run the operation at all must be refused with AUTHORIZATION rather than told how much of a
160
+ // budget they have — and must not consume a slot of a budget that is not theirs, which would let
161
+ // an unauthorized caller exhaust an authorized one's quota. (The HTTP seam orders these the other
162
+ // way round because it has no choice: `checkPolicyForVariant` runs pre-flight, before the
163
+ // execution context that authorization needs even exists. Here the identity is already resolved,
164
+ // so the safer order is available and is taken.)
165
+ await this.assertOperationRateLimitPolicy(operation, boundExecutionContext);
144
166
  // Dispatch to the service layer directly (NOT re-HTTP). The service pipeline
145
167
  // enforces enabledCondition / requiredFeatures downstream.
146
168
  //
@@ -190,6 +212,77 @@ let McpServerBackendService = class McpServerBackendService {
190
212
  const safeResult = await toResponseSafeToolOutput(operation, result);
191
213
  return { toolName, result: safeResult };
192
214
  }
215
+ /**
216
+ * Enforce the resolved operation's OWN `rateLimit?` policy on the tool plane.
217
+ *
218
+ * ## What was broken
219
+ *
220
+ * `rateLimit?` is authored on an `API_CALL` / `API_CALL_WITH_CALLBACK` variant and was enforced
221
+ * by exactly one consumer — `RateLimitBackendService.checkPolicyForVariant`, called from the
222
+ * resource controller's HTTP pre-flight. `callTool` dispatches the SAME operation through the
223
+ * SAME service pipeline while bypassing Express entirely, so the identical operation was
224
+ * throttled over REST and unthrottled as a tool. An application that declared a budget on an
225
+ * endpoint got one; an agent asked for the same endpoint by its tool name and got none.
226
+ *
227
+ * ## Subject: the CREDENTIAL, not the IP and not the tenant
228
+ *
229
+ * See {@link resolveDeclaredPolicySubjectKey} for the full argument. In short: the HTTP seam
230
+ * keys on the source IP because at its pre-flight moment no identity exists yet, so `5/min` has
231
+ * always meant "5/min per CLIENT". On this plane the client is the credential the agent
232
+ * presented — a server-verified field of the execution context, never anything the model
233
+ * supplied. Keying on the tenant instead would make the same authored number several times
234
+ * stricter here than over REST for any tenant running more than one agent.
235
+ *
236
+ * ## Scope: a SEPARATE bucket from the REST route, deliberately
237
+ *
238
+ * The key is namespaced `mcp:resource:<resource>:<operation>` rather than sharing the HTTP
239
+ * seam's `resource:<resource>:<operation>`. Sharing would be incoherent — the two seams count
240
+ * different SUBJECTS (an IP and a credential), so one bucket would mix two identity spaces and
241
+ * let a browser's traffic spend an agent's budget. Per-plane-per-client is the faithful
242
+ * extension of a policy that was already per-client rather than a global cap.
243
+ *
244
+ * ## Not applied to the derived upload-grant tool
245
+ *
246
+ * `callUploadGrantTool` MINTS a grant; it does not dispatch the parent operation. Charging the
247
+ * parent's budget there would spend two slots for one upload (mint + the upload itself, which
248
+ * traverses the real HTTP route and meets `checkPolicyForVariant`) while a REST client spends
249
+ * one — the declared number would mean something different depending on how the caller got the
250
+ * URL. It is left uncharged for that reason, not by omission.
251
+ *
252
+ * ## Postures
253
+ *
254
+ * - **No declared policy, or a non-HTTP variant** → no-op, zero Redis traffic. Mirrors
255
+ * `checkPolicyForVariant`'s two early returns exactly; the variant guard is defensive, since
256
+ * `resolveExposableOperation` only ever yields a URL-bearing default.
257
+ * - **Unkeyable subject** → not enforced, logged. Structurally unreachable: `callTool` is only
258
+ * reached post-authentication, and `ExecutionContext`'s own constructor rejects an
259
+ * authenticated principal carrying no identity field. It is not "unbounded" either — the
260
+ * transport's blanket per-principal cap is the backstop, and it declines on exactly the same
261
+ * input. Refusing a well-formed call here instead would invent an outage out of a branch that
262
+ * cannot happen.
263
+ * - **Limiter outage** → propagates, as it does over HTTP for the same declared policy. An
264
+ * authored budget must not quietly become "unlimited" on one plane while it is a 500 on the
265
+ * other.
266
+ */
267
+ async assertOperationRateLimitPolicy(operation, boundExecutionContext) {
268
+ if (operation.variantType !== ResourceOperationVariantType.API_CALL
269
+ && operation.variantType !== ResourceOperationVariantType.API_CALL_WITH_CALLBACK) {
270
+ return;
271
+ }
272
+ const policy = operation.rateLimit;
273
+ if (!policy) {
274
+ return;
275
+ }
276
+ const subjectKey = resolveDeclaredPolicySubjectKey(boundExecutionContext.initiatorIds);
277
+ if (!subjectKey) {
278
+ this.logger.warn('[mcp] declared rateLimit not enforced — the authenticated caller carries no keyable identity', {
279
+ resourceIdentifier: String(operation.resourceIdentifier),
280
+ operationIdentifier: String(operation.operationIdentifier),
281
+ });
282
+ return;
283
+ }
284
+ await this.rateLimitService.checkPolicyForSubject(policy, `mcp:resource:${String(operation.resourceIdentifier)}:${String(operation.operationIdentifier)}`, subjectKey, boundExecutionContext.organizationId);
285
+ }
193
286
  /**
194
287
  * Execute a derived upload-grant tool (issue #312, D11).
195
288
  *
@@ -240,6 +333,7 @@ let McpServerBackendService = class McpServerBackendService {
240
333
  executionContext: boundExecutionContext,
241
334
  target: { resourceType, fieldName, operation: operationKind, resourceId },
242
335
  expiresInMinutes: parsedArgs.data.expiresInMinutes,
336
+ declared: { name: parsedArgs.data.name, mimeType: parsedArgs.data.mimeType, size: parsedArgs.data.size },
243
337
  uploadUrl: `${origin}${uploadPath}`,
244
338
  apiBaseUrl: `${origin}${MAIN_API_BASE_PATH}`,
245
339
  });
@@ -402,13 +496,15 @@ McpServerBackendService = __decorate([
402
496
  __param(5, inject(SAAS_SERVICE_TYPES.ResourceRegistryService)),
403
497
  __param(6, inject(SAAS_SERVICE_TYPES.FileUploadGrantService)),
404
498
  __param(7, inject(SAAS_SERVICE_TYPES.AppConfigService)),
499
+ __param(8, inject(SAAS_SERVICE_TYPES.RateLimitBackendService)),
405
500
  __metadata("design:paramtypes", [Function, ErrorBuilderBackendService,
406
501
  McpToolAdapterBackendService,
407
502
  AuthorizationsBackendService,
408
503
  ServicesRegistryHandlerBackendService,
409
504
  ResourcesRegistryBackendService,
410
505
  FileUploadGrantBackendService,
411
- AppConfigurationService])
506
+ AppConfigurationService,
507
+ RateLimitBackendService])
412
508
  ], McpServerBackendService);
413
509
  export { McpServerBackendService };
414
510
  //# sourceMappingURL=mcp-server.backend.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-server.backend.service.js","sourceRoot":"","sources":["../../../../../src/mcp/services/mcp-server.backend.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAGL,kCAAkC,EAClC,qBAAqB,EACrB,SAAS,EACT,2BAA2B,EAC3B,cAAc,EACd,kBAAkB,EAClB,gCAAgC,EAChC,yCAAyC,GAI1C,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,qEAAqE,CAAC;AACpH,OAAO,EAAE,uBAAuB,EAAE,MAAM,sEAAsE,CAAC;AAC/G,OAAO,EAAE,4BAA4B,EA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AAE,EAAE,OAAO,EAAE,4BAA4B,QAAQ,2BAA2B,uBAAuB,cAAc,EAAE,QAAQ,EAAE;aACrI,CAAC,CAAC;QACL,CAAC;QACD,OAAO;YACL,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAiB;YAC/D,mBAAmB,EAAE,QAAQ,CAAC,KAAK,CAAC,cAAc,GAAG,uBAAuB,CAAC,MAAM,CAAC;SACrF,CAAC;IACJ,CAAC;CACF,CAAA;AA5XY,uBAAuB;IADnC,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAC9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAA;IACzC,WAAA,MAAM,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,CAAA;IAChD,WAAA,MAAM,CAAC,kBAAkB,CAAC,8BAA8B,CAAC,CAAA;IACzD,WAAA,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAA;IAClD,WAAA,MAAM,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAA;IACjD,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;+CANqC,0BAA0B;QAChC,4BAA4B;QACtB,4BAA4B;QACd,qCAAqC;QAC1C,+BAA+B;QAC3B,6BAA6B;QACzC,uBAAuB;GAXhG,uBAAuB,CA4XnC","sourcesContent":["import { injectable, inject } from 'inversify';\nimport {\n ResourceType,\n ResourceConfiguration_OperationPath,\n ResourcesConfig_OperationPathUtils,\n CoreResourceOperation,\n ErrorType,\n ErrorCustomMessageReference,\n BackendApiType,\n MAIN_API_BASE_PATH,\n FileUploadGrantMintRequestSchema,\n ResourcesConfigOperationsUrlsBuilderUtils,\n type ResourcePrimaryScope,\n type ResourceConfiguration_Operation,\n type FileUploadGrantOperation,\n} from '@wildo-ai/saas-models';\nimport { z } from 'zod';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { FileUploadGrantBackendService } from '~wildo-backend-lib/files/services/file-upload-grant.backend.service';\nimport { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport { MCP_UPLOAD_GRANT_TOOL_MARKER } from '~wildo-backend-lib/mcp/models/mcp-tool.backend.schemas';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { AuthorizationsBackendService } from '~wildo-backend-lib/security/authorizations/services/authorizations.backend.service';\nimport { ServicesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/services/services-registry-handler.backend.service';\nimport { toResponseSafeToolOutput } from '~wildo-backend-lib/base-classes/services/controllers/utils/operation-response-serializer.backend.utils';\nimport { normalizeCollectionQueryRequestData } from '~wildo-backend-lib/base-classes/services/controllers/controller-resource.backend.service';\nimport { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport {\n McpToolAdapterBackendService,\n mcpReachableScopesForPrincipal,\n mcpPrincipalForAuthenticatedCaller,\n resolveEffectiveMcpOperation,\n isCollectionQueryMcpOperation,\n} from '~wildo-backend-lib/mcp/services/mcp-tool-adapter.backend.service';\nimport {\n McpToolDescriptor,\n McpToolAdapterBuildOptions,\n MCP_TOOL_NAME_SEPARATOR,\n} from '~wildo-backend-lib/mcp/models/mcp-tool.backend.schemas';\n\n/**\n * Per-call options for {@link McpServerBackendService.callTool}.\n */\nexport interface McpCallToolOptions {\n /**\n * Target resource id for resource-specific operations (READ / UPDATE / DELETE\n * and instance-scoped custom operations). Omit for collection operations\n * (CREATE / LIST / SEARCH / COUNT), which authorize on roles + parent scope only.\n */\n resourceId?: string;\n /**\n * The NAMED MCP server instance this call arrived on (R-2), or omitted for the default `/mcp`\n * server. MUST mirror the transport's route: the exposability gate below re-resolves the tool\n * against this instance, so a tool curated onto another server is NOT callable here even by name.\n */\n instanceRef?: string;\n}\n\n/**\n * Result of a successful `tools/call`. `result` is the operation output projected\n * through the operation's response DTO (backend-only/secret fields stripped, dates\n * JSON-normalized — see `callTool`), returned WITHOUT MCP `content` framing: the\n * `{ content: [...], isError }` envelope is applied by the transport\n * ({@link MCPControllerBackendService.handleToolsCall}). Keeping this service\n * transport-agnostic lets the same `callTool` back another transport unchanged.\n */\nexport interface McpCallToolResult {\n toolName: string;\n result: unknown;\n}\n\n/**\n * The MCP server core: lists resource-operation tools and executes them against\n * the SERVICE layer with per-call authorization. Transport-agnostic — the\n * JSON-RPC / Streamable-HTTP wire layer + OAuth 2.1 resource-server auth\n * (RFC 9728 metadata, RFC 8707 audience validation) live in\n * {@link MCPControllerBackendService}; this core carries no wire concern so the\n * same `listTools`/`callTool` can back another transport unchanged.\n *\n * # Boundaries\n *\n * - `listTools()` delegates to {@link McpToolAdapterBackendService}.\n * - `callTool()` resolves the target operation, RE-RUNS `authorizeInController`\n * against the caller's execution context (fail-closed), then invokes the\n * service pipeline DIRECTLY via {@link ServicesRegistryHandlerBackendService}\n * (never re-HTTP). The service pipeline enforces `requiredFeatures` /\n * `enabledCondition` downstream.\n * - KNOWN GAP (tracked — `.claude/plans/mcp-server-followups.md` Item 5): the\n * per-route HTTP rate-limit middleware is bypassed on this direct dispatch path,\n * so an operation's `rateLimit` policy is not yet enforced here. The planned fix\n * is a per-principal quota shared with the A2A dispatch surface.\n * - Server-initiated streaming (SSE / notifications / progress) is intentionally\n * absent: every exposed operation is synchronous request/response, for which a\n * single JSON response is Streamable-HTTP-compliant (Item 1, deferred).\n */\n/**\n * Operations whose RESULT is the paginated `{ data, pagination }` envelope, for OUTPUT.\n *\n * Deliberately NOT the same set as {@link isCollectionQueryOperation}: `COUNT` takes the collection\n * argument envelope but RETURNS A SCALAR, so asking the repository to wrap it would hand back a\n * shape its response DTO does not declare — trading one contract mismatch for another.\n *\n * Mirrors `needsPagination` in `ControllerResourceBackendService`, which is where this decision has\n * always been made for the HTTP surface. The two must agree: they select the shape the SAME response\n * DTO is asked to validate.\n */\nfunction isPaginationWrappedOperation(effectiveOperation: string): boolean {\n return effectiveOperation === CoreResourceOperation.LIST\n || effectiveOperation === CoreResourceOperation.SEARCH;\n}\n\n@injectable()\nexport class McpServerBackendService {\n protected logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) protected readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) protected readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.McpToolAdapter) protected readonly toolAdapter: McpToolAdapterBackendService,\n @inject(SAAS_SERVICE_TYPES.AuthorizationsService) protected readonly authorizer: AuthorizationsBackendService,\n @inject(SAAS_SERVICE_TYPES.ServicesRegistryHandlerService) protected readonly servicesHandler: ServicesRegistryHandlerBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService) protected readonly resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.FileUploadGrantService) protected readonly fileUploadGrantService: FileUploadGrantBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService) protected readonly appConfigService: AppConfigurationService,\n ) {\n this.logDebug = this.logger.debugByType('McpServerBackendService');\n this.logger.setDebugTypeLogging('McpServerBackendService', false);\n }\n\n /**\n * Return the exposed tool descriptors for the caller's reachable scopes (`options.reachableScopes`).\n * PROGRESSIVE principal-awareness (C): a caller presenting a valid Bearer bound to this endpoint\n * passes its principal's scopes, so a user-delegated caller additionally sees its USER_SELF tools.\n * Omitting the scopes yields the MACHINE catalog; an ANONYMOUS caller passes an EMPTY set and the\n * transport challenges it rather than serving the empty page. Authorization is still enforced\n * fail-closed at `callTool` time — the catalog is a discovery aid, never an authorization grant.\n */\n public listTools(options: McpToolAdapterBuildOptions = {}): McpToolDescriptor[] {\n return this.toolAdapter.buildToolDescriptors(options);\n }\n\n /**\n * Execute one tool: resolve → authorize (fail-closed) → dispatch to the service layer.\n *\n * @param toolName - `<resourceIdentifier>__<operationIdentifier>`.\n * @param args - the tool arguments (the operation request body).\n * @param executionContext - the caller's context (a machine principal for api-key\n * / client-credentials callers; a user-delegated context once OIDC lands).\n * @param options - per-call options ({@link McpCallToolOptions}).\n * @throws AUTHORIZATION when the principal is not permitted to run the operation.\n * @throws NOT_FOUND when the tool name does not map to an exposable operation.\n */\n public async callTool(\n toolName: string,\n args: unknown,\n executionContext: ExecutionContext<any>,\n options: McpCallToolOptions = {},\n ): Promise<McpCallToolResult> {\n const { resourceType, operationIdentifier } = this.parseToolName(toolName);\n\n // Single source of exposability truth: the adapter decides whether this resource+operation is a\n // valid, default URL-bearing tool REACHABLE BY THIS CALLER. Progressive principal-awareness — a\n // user-delegated principal (USER_REQUEST, carries a `userId`) reaches USER_SELF operations; a\n // machine principal reaches ORG/APP only. Rejecting here (before authorization) prevents a crafted\n // name from reaching a scope the caller cannot use (e.g. a machine hitting USER_SELF → always 403).\n // Derived from the SAME source `tools/list` filters on, so advertise ≡ callable per principal.\n // R-2: also gated on the server INSTANCE the call arrived on, so `(principal, instance)` together\n // decide callability — the same pair `tools/list` filters on.\n // Post-authentication by construction: `callTool` is only reached with a validated token.\n const reachableScopes = mcpReachableScopesForPrincipal(mcpPrincipalForAuthenticatedCaller(executionContext.isUserExecution()));\n\n // Issue #312, D11: a DERIVED upload-grant tool mints a grant instead of dispatching an operation.\n // It resolves its PARENT through the same adapter gate (exposure, instance, scope inherited), is\n // authorized exactly as the parent would be, then calls the ONE mint function the REST door calls.\n if (operationIdentifier.includes(MCP_UPLOAD_GRANT_TOOL_MARKER)) {\n return this.callUploadGrantTool(toolName, resourceType, operationIdentifier, args, executionContext, options, reachableScopes);\n }\n\n const operation = this.toolAdapter.resolveExposableOperation(resourceType, operationIdentifier, reachableScopes, options.instanceRef);\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.NOT_FOUND, executionContext, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_NOT_FOUND,\n context: { message: `MCP tool \"${toolName}\" does not map to an exposable resource operation`, toolName },\n });\n }\n\n // Bind the resolved operation onto the caller's context (preserves principal\n // identity + roles) so the authorizer and the service pipeline both see the\n // operation actually being executed.\n const boundExecutionContext = executionContext.withOperation(operation);\n\n const idOrIds = options.resourceId;\n\n // Fail-closed per-operation authorization: reads `operation.roles` +\n // `executionContext.initiatorRoles` / scope. Throws AUTHORIZATION on denial.\n await this.authorizer.authorizeInController(idOrIds, boundExecutionContext);\n\n // Dispatch to the service layer directly (NOT re-HTTP). The service pipeline\n // enforces enabledCondition / requiredFeatures downstream.\n //\n // Dispatch the EXACT operation we resolved + authorized + advertised (the URL-bearing default\n // from `resolveExposableOperation`), via `extractOperationPath`. We deliberately do NOT\n // re-resolve through `getServiceOperationPathDefault`: for a resource that declares BOTH a\n // URL-bearing default AND an INTERNAL_CALL default for the same operation identifier, that\n // helper PREFERS the INTERNAL_CALL variant — which would execute a different variant (different\n // `requestDto` validating `args`, different side effects / custom-impl) than the one\n // `authorizeInController` just checked and than the `inputSchema` advertised to the agent.\n // Using the resolved operation's own path mirrors how the HTTP controllers dispatch the URL\n // operation and keeps authorize ≡ advertise ≡ execute on one variant.\n const operationPath: ResourceConfiguration_OperationPath<any, any> = ResourcesConfig_OperationPathUtils.extractOperationPath(operation);\n\n const dispatchArgs = this.toDispatchArguments(operation, args, boundExecutionContext);\n\n this.logDebug('Executing MCP tool call', { toolName, resourceType, operationIdentifier, hasResourceId: idOrIds !== undefined });\n\n /**\n * Request the pagination WRAPPER for collection operations, exactly as the HTTP controller does.\n *\n * The repository's `list` returns a BARE ARRAY unless the caller asks for the envelope\n * (`options.paginated`), and the decision to ask is made in `ControllerResourceBackendService`:\n * `needsPagination = LIST || SEARCH` → `{ paginated: true }`. That is a CONTROLLER-tier\n * decision, and this path does not go through the controller — so `tools/call` dispatched a\n * paginated LIST without ever requesting pagination, the repository returned a bare array, and\n * the operation's RESPONSE DTO (which for a paginated list declares `{ data, pagination }`)\n * rejected it. Every paginated `*__list` tool answered `-32603` with\n * `expected array, received undefined` at `data`.\n *\n * Two things hid it. `*__search` was unaffected — the search path builds its own envelope — and\n * the one LIST that worked (`todosRelationships__list`) is UNPAGINATED, so a bare array is\n * exactly what its response DTO declares. So the failure looked resource-specific when it was\n * operation-wide.\n *\n * This is the OUTPUT half of the defect family the input normalisation already fixed on\n * 2026-08-01: \"the advertised contract is not the enforced contract\". `tools/list` advertises a\n * paginated collection envelope because the response DTO says so; the dispatch has to request\n * the shape that DTO describes, or the two tiers disagree about what the operation returns.\n */\n const needsPaginationWrapper = isPaginationWrappedOperation(this.resolveEffectiveOperation(operation));\n\n const result = await this.servicesHandler.doByOperationPath(\n operationPath,\n boundExecutionContext,\n idOrIds,\n dispatchArgs,\n needsPaginationWrapper ? { paginated: true } : undefined,\n );\n\n // Project the raw service result through the operation's RESPONSE DTO — the SAME\n // output-serialization boundary the HTTP controller (`sendResponse`) and the A2A tool\n // path use — BEFORE it crosses to the external MCP agent. `doByOperationPath` returns the\n // internal DTO, which still carries `.isBackendOnly()` / write-only-secret fields and raw\n // `Date`/`ObjectId` instances; returning it verbatim would leak backend-only/secret material\n // into the agent's model context. `toResponseSafeToolOutput` strips + JSON-normalizes so the\n // MCP tool result is byte-identical to what a REST client would receive.\n const safeResult = await toResponseSafeToolOutput(operation, result);\n\n return { toolName, result: safeResult };\n }\n\n /**\n * Execute a derived upload-grant tool (issue #312, D11).\n *\n * Authorization is the PARENT's: the caller's context is bound to the parent operation and\n * `authorizeInController` runs on it with the same `resourceId` the parent would take — so minting\n * requires exactly the authority uploading would, which is the invariant the REST door gets from\n * sharing the upload middleware. The upload URL is built from the parent's own route pattern with\n * the parameters the context and the call supply, and the API origin comes from CONFIGURATION,\n * never from a request header.\n */\n private async callUploadGrantTool(\n toolName: string,\n resourceType: ResourceType,\n operationPart: string,\n args: unknown,\n executionContext: ExecutionContext<any>,\n options: McpCallToolOptions,\n reachableScopes: ReadonlySet<ResourcePrimaryScope>,\n ): Promise<McpCallToolResult> {\n const derived = this.toolAdapter.resolveUploadGrantTool(resourceType, operationPart, reachableScopes, options.instanceRef);\n if (!derived) {\n throw this.errorBuilder.buildError(ErrorType.NOT_FOUND, executionContext, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_NOT_FOUND,\n context: { message: `MCP tool \"${toolName}\" does not map to an exposable upload-grant tool`, toolName },\n });\n }\n const { parentOperation, fieldName, operationKind } = derived;\n const boundExecutionContext = executionContext.withOperation(parentOperation);\n const resourceId = options.resourceId;\n if (operationKind === CoreResourceOperation.UPDATE && !resourceId) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, boundExecutionContext, {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: { message: 'An upload grant for an UPDATE requires the record id', toolName },\n });\n }\n\n // Same gate, same order, same arguments as the parent operation.\n await this.authorizer.authorizeInController(resourceId, boundExecutionContext);\n\n const parsedArgs = FileUploadGrantMintRequestSchema.safeParse(this.withoutInstanceId(args, resourceType));\n if (!parsedArgs.success) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, boundExecutionContext, {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: { toolName, errors: parsedArgs.error.issues.map((issue) => ({ path: issue.path.join('.'), message: issue.message })) },\n });\n }\n\n const apiPublicUrl = this.appConfigService.config.runtime?.endPoints?.[BackendApiType.MAIN_BACKEND_API]?.publicUrl;\n if (!apiPublicUrl) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, boundExecutionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: { message: `runtime.endPoints.${BackendApiType.MAIN_BACKEND_API}.publicUrl is required to mint a file upload grant` },\n });\n }\n const origin = apiPublicUrl.replace(/\\/+$/, '');\n // Scope ids come from the CALLER's context: binding an operation onto a context never changes who is calling.\n const uploadPath = this.resolveUploadRoutePath(parentOperation, resourceType, fieldName, operationKind, resourceId, executionContext);\n const grant = await this.fileUploadGrantService.mint({\n executionContext: boundExecutionContext,\n target: { resourceType, fieldName, operation: operationKind, resourceId },\n expiresInMinutes: parsedArgs.data.expiresInMinutes,\n uploadUrl: `${origin}${uploadPath}`,\n apiBaseUrl: `${origin}${MAIN_API_BASE_PATH}`,\n });\n this.logDebug('Executing MCP upload-grant tool call', { toolName, resourceType, fieldName, operationKind, hasResourceId: resourceId !== undefined });\n return { toolName, result: grant };\n }\n\n /** The tool arguments minus the resource's own id, which the transport already split out into `options.resourceId`. */\n private withoutInstanceId(args: unknown, resourceType: ResourceType): unknown {\n if (!args || typeof args !== 'object') return args ?? {};\n const selfField = this.resourcesRegistry.getAllResourceFieldIdentifiers()[resourceType];\n if (!selfField || !(selfField in (args as Record<string, unknown>))) return args;\n const { [selfField]: _dropped, ...rest } = args as Record<string, unknown>;\n return rest;\n }\n\n /**\n * The concrete upload-route PATH (mount prefix included) for one file field of the parent\n * operation, from the parent's own route patterns — the same builder the resource controller used\n * to REGISTER the route, so the grant's `uploadUrl` is a route that exists.\n *\n * A parent can carry several patterns (one per parent-resource combination); the one chosen is the\n * first whose every `{param}` the call can supply: the resource's own id from `resourceId`, and scope\n * / parent ids from the context's `initiatorIds`. Patterns are tried shortest first, so the\n * primary-scope form wins over a nested FK form the MCP call cannot address anyway.\n */\n private resolveUploadRoutePath(\n parentOperation: ResourceConfiguration_Operation<any, any, any>,\n resourceType: ResourceType,\n fieldName: string,\n operationKind: FileUploadGrantOperation,\n resourceId: string | undefined,\n executionContext: ExecutionContext<any>,\n ): string {\n const selfField = this.resourcesRegistry.getAllResourceFieldIdentifiers()[resourceType];\n const initiatorInfos = [...(('initiatorInfos' in parentOperation ? parentOperation.initiatorInfos : undefined) ?? [])]\n .sort((a, b) => (a.parameters?.length ?? 0) - (b.parameters?.length ?? 0));\n const supplied: Record<string, string | undefined> = {\n ...(executionContext.initiatorIds as Record<string, string | undefined> | undefined ?? {}),\n ...(selfField && resourceId ? { [selfField]: resourceId } : {}),\n };\n for (const info of initiatorInfos) {\n const route = ResourcesConfigOperationsUrlsBuilderUtils.buildFileUploadRouteForOperation({\n operationRouteUrl: info.url,\n operationParameters: info.parameters ?? [],\n targetResourceType: resourceType,\n targetResourceFieldIdentifier: selfField ?? 'id',\n fieldName,\n requiresTargetResourceId: operationKind === CoreResourceOperation.UPDATE,\n isFrontend: false,\n });\n let unresolved = false;\n const path = route.url.replace(/\\{([^}]+)\\}/g, (_m, param: string) => {\n const value = supplied[param];\n if (typeof value !== 'string' || value.length === 0) { unresolved = true; return `{${param}}`; }\n return encodeURIComponent(value);\n });\n if (!unresolved) return path;\n }\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: { message: 'No upload route of this operation can be addressed from the MCP call', resourceType, fieldName, operationKind, patterns: initiatorInfos.map((i) => i.url) },\n });\n }\n\n /**\n * Split `<resourceIdentifier>__<operationIdentifier>` on the FIRST double\n * underscore. Resource identifiers use single underscores only, so the first\n * `__` unambiguously delimits the resource from the operation.\n */\n /**\n * Bring the agent's raw `arguments` onto the SAME input contract the HTTP controller produces\n * before dispatch. Added 2026-08-01; until then `tools/call` passed `args` through untouched.\n *\n * Two distinct defects that fixed, both of the \"advertised contract is not the enforced\n * contract\" family:\n *\n * 1. **Collection tools silently ignored the agent's filter.** `tools/list` advertises an\n * `inputSchema` derived from the operation's `requestDto`, which for LIST / SEARCH is keyed\n * `{ filters, pagination, sorting }`. The service reads `{ filter, page, limit, sort,\n * searchQuery }`. The HTTP controller bridges the two; MCP did not, so an agent that\n * followed the schema it was given received the UNFILTERED collection while believing it was\n * filtered — the worst shape for an LLM caller, which then reasons over the wrong rows.\n * {@link normalizeCollectionQueryRequestData} is now the single authority both surfaces use,\n * and it accepts either vocabulary. It also carries the filter ALLOW-LIST, which matters\n * here: the repository's `sanitizeRequestFilter` returns the filter UNCHANGED when an\n * operation declares no `filterFields`, so for a surface with no strict DTO parse in front\n * of it this is the layer that stops an arbitrary key reaching the database.\n * 2. **The published request contract was not enforced.** Every other operation now gets the\n * controller's strict `requestDto.parse`, so a key the tool never advertised is dropped at\n * the boundary that advertised it, rather than three layers away. Writes were already safe —\n * the repository re-parses against the same DTO\n * (`repositories-registry-handler.backend.service.ts`) — but relying on a distant guard for\n * an external protocol surface is defence by coincidence: nothing tells a future refactor of\n * that method that MCP depends on it.\n *\n * Parse failures are deliberately NOT swallowed. An agent that sends a malformed argument should\n * be told, so the model can correct itself; silently dropping it teaches the model nothing and\n * leaves it reasoning about an operation it did not actually perform.\n */\n private toDispatchArguments(\n operation: {\n requestDto?: z.ZodTypeAny;\n resourceOperationLike?: unknown;\n operationIdentifier: unknown;\n resourceIdentifier: unknown;\n },\n args: unknown,\n executionContext: ExecutionContext<any>,\n ): unknown {\n const effectiveOperation = this.resolveEffectiveOperation(operation);\n const isCollectionOperation = isCollectionQueryMcpOperation(effectiveOperation);\n\n if (isCollectionOperation) {\n const rawArguments = (args && typeof args === 'object' && !Array.isArray(args))\n ? args as Record<string, unknown>\n : {};\n const resourceOperations = this.resourcesRegistry\n .getResourceConfiguration(operation.resourceIdentifier as ResourceType)\n .operations;\n return normalizeCollectionQueryRequestData(\n rawArguments,\n operation as never,\n effectiveOperation,\n resourceOperations as never,\n );\n }\n\n if (!operation.requestDto) return args;\n\n try {\n return operation.requestDto.parse(args);\n } catch (error) {\n if (error instanceof z.ZodError) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONTROLLER_RESOURCE_VALIDATION_FAILED,\n stack: error.stack,\n context: {\n message: 'MCP tool arguments do not satisfy the operation request contract advertised by tools/list',\n operationIdentifier: operation.operationIdentifier,\n zodIssues: error.issues,\n },\n });\n }\n throw error;\n }\n }\n\n /**\n * The operation this tool really performs — a custom operation declares what it behaves LIKE via\n * `resourceOperationLike`, and both the input normalisation and the output envelope must key on\n * the same answer. Derived once here because they previously derived it separately, and a\n * custom LIST-like operation that only one of them recognised would be normalised as a collection\n * on the way in and dispatched without pagination on the way out.\n */\n private resolveEffectiveOperation(operation: { resourceOperationLike?: unknown; operationIdentifier: unknown }): string {\n return resolveEffectiveMcpOperation(operation);\n }\n\n private parseToolName(toolName: string): { resourceType: ResourceType; operationIdentifier: string } {\n const separatorIndex = toolName.indexOf(MCP_TOOL_NAME_SEPARATOR);\n if (separatorIndex <= 0 || separatorIndex + MCP_TOOL_NAME_SEPARATOR.length >= toolName.length) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_NOT_FOUND,\n context: { message: `Malformed MCP tool name \"${toolName}\" — expected \"<resource>${MCP_TOOL_NAME_SEPARATOR}<operation>\"`, toolName },\n });\n }\n return {\n resourceType: toolName.slice(0, separatorIndex) as ResourceType,\n operationIdentifier: toolName.slice(separatorIndex + MCP_TOOL_NAME_SEPARATOR.length),\n };\n }\n}\n"]}
1
+ {"version":3,"file":"mcp-server.backend.service.js","sourceRoot":"","sources":["../../../../../src/mcp/services/mcp-server.backend.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAEL,4BAA4B,EAE5B,kCAAkC,EAClC,qBAAqB,EACrB,SAAS,EACT,2BAA2B,EAC3B,cAAc,EACd,kBAAkB,EAClB,gCAAgC,EAChC,yCAAyC,GAI1C,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,qEAAqE,CAAC;AACpH,OAAO,EAAE,uBAAuB,EAAE,MAAM,sEAAsE,CAAC;AAC/G,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;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ify';\nimport {\n ResourceType,\n ResourceOperationVariantType,\n ResourceConfiguration_OperationPath,\n ResourcesConfig_OperationPathUtils,\n CoreResourceOperation,\n ErrorType,\n ErrorCustomMessageReference,\n BackendApiType,\n MAIN_API_BASE_PATH,\n FileUploadGrantMintRequestSchema,\n ResourcesConfigOperationsUrlsBuilderUtils,\n type ResourcePrimaryScope,\n type ResourceConfiguration_Operation,\n type FileUploadGrantOperation,\n} from '@wildo-ai/saas-models';\nimport { z } from 'zod';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { FileUploadGrantBackendService } from '~wildo-backend-lib/files/services/file-upload-grant.backend.service';\nimport { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport { MCP_UPLOAD_GRANT_TOOL_MARKER } from '~wildo-backend-lib/mcp/models/mcp-tool.backend.schemas';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { AuthorizationsBackendService } from '~wildo-backend-lib/security/authorizations/services/authorizations.backend.service';\nimport { ServicesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/services/services-registry-handler.backend.service';\nimport { toResponseSafeToolOutput } from '~wildo-backend-lib/base-classes/services/controllers/utils/operation-response-serializer.backend.utils';\nimport { normalizeCollectionQueryRequestData } from '~wildo-backend-lib/base-classes/services/controllers/controller-resource.backend.service';\nimport { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { RateLimitBackendService } from '~wildo-backend-lib/errors/services/rate-limit.backend.service';\nimport { resolveDeclaredPolicySubjectKey } from '~wildo-backend-lib/security/authentications/services/utils/external-turn-rate-limit.backend.utils';\nimport {\n McpToolAdapterBackendService,\n mcpReachableScopesForPrincipal,\n mcpPrincipalForAuthenticatedCaller,\n resolveEffectiveMcpOperation,\n isCollectionQueryMcpOperation,\n} from '~wildo-backend-lib/mcp/services/mcp-tool-adapter.backend.service';\nimport {\n McpToolDescriptor,\n McpToolAdapterBuildOptions,\n MCP_TOOL_NAME_SEPARATOR,\n} from '~wildo-backend-lib/mcp/models/mcp-tool.backend.schemas';\n\n/**\n * Per-call options for {@link McpServerBackendService.callTool}.\n */\nexport interface McpCallToolOptions {\n /**\n * Target resource id for resource-specific operations (READ / UPDATE / DELETE\n * and instance-scoped custom operations). Omit for collection operations\n * (CREATE / LIST / SEARCH / COUNT), which authorize on roles + parent scope only.\n */\n resourceId?: string;\n /**\n * The NAMED MCP server instance this call arrived on (R-2), or omitted for the default `/mcp`\n * server. MUST mirror the transport's route: the exposability gate below re-resolves the tool\n * against this instance, so a tool curated onto another server is NOT callable here even by name.\n */\n instanceRef?: string;\n}\n\n/**\n * Result of a successful `tools/call`. `result` is the operation output projected\n * through the operation's response DTO (backend-only/secret fields stripped, dates\n * JSON-normalized — see `callTool`), returned WITHOUT MCP `content` framing: the\n * `{ content: [...], isError }` envelope is applied by the transport\n * ({@link MCPControllerBackendService.handleToolsCall}). Keeping this service\n * transport-agnostic lets the same `callTool` back another transport unchanged.\n */\nexport interface McpCallToolResult {\n toolName: string;\n result: unknown;\n}\n\n/**\n * The MCP server core: lists resource-operation tools and executes them against\n * the SERVICE layer with per-call authorization. Transport-agnostic — the\n * JSON-RPC / Streamable-HTTP wire layer + OAuth 2.1 resource-server auth\n * (RFC 9728 metadata, RFC 8707 audience validation) live in\n * {@link MCPControllerBackendService}; this core carries no wire concern so the\n * same `listTools`/`callTool` can back another transport unchanged.\n *\n * # Boundaries\n *\n * - `listTools()` delegates to {@link McpToolAdapterBackendService}.\n * - `callTool()` resolves the target operation, RE-RUNS `authorizeInController`\n * against the caller's execution context (fail-closed), enforces the operation's\n * own declared `rateLimit` policy (see `assertOperationRateLimitPolicy`), then\n * invokes the service pipeline DIRECTLY via\n * {@link ServicesRegistryHandlerBackendService} (never re-HTTP). The service\n * pipeline enforces `requiredFeatures` / `enabledCondition` downstream.\n * - RATE LIMITING on this plane is now TWO guards, and they answer different questions:\n * the transport applies the framework's blanket per-principal `tools/call` cap\n * (`MCP_EXTERNAL_CALL_RATE_MAX`, an abuse throttle nobody declared, fails OPEN), and\n * THIS service applies the operation's own AUTHORED `rateLimit` (a statement the\n * application made about that endpoint, enforced identically to the HTTP seam). The\n * second one lives here rather than in the transport for the same reason\n * `authorizeInController` does: it is a property of the OPERATION, so a second\n * transport backed by this core must inherit it rather than re-implement it.\n * (Historical note: the block that stood here recorded the per-operation policy as a\n * KNOWN GAP whose \"planned fix is a per-principal quota shared with the A2A dispatch\n * surface\". That per-principal quota SHIPPED — `assertExternalTurnWithinRate`, used by\n * both `MCPControllerBackendService` and `A2ABackendService` — and the comment was\n * never updated, so it read as wholly open when only its per-operation half was.)\n * - Server-initiated streaming (SSE / notifications / progress) is intentionally\n * absent: every exposed operation is synchronous request/response, for which a\n * single JSON response is Streamable-HTTP-compliant (Item 1, deferred).\n */\n/**\n * Operations whose RESULT is the paginated `{ data, pagination }` envelope, for OUTPUT.\n *\n * Deliberately NOT the same set as {@link isCollectionQueryOperation}: `COUNT` takes the collection\n * argument envelope but RETURNS A SCALAR, so asking the repository to wrap it would hand back a\n * shape its response DTO does not declare — trading one contract mismatch for another.\n *\n * Mirrors `needsPagination` in `ControllerResourceBackendService`, which is where this decision has\n * always been made for the HTTP surface. The two must agree: they select the shape the SAME response\n * DTO is asked to validate.\n */\nfunction isPaginationWrappedOperation(effectiveOperation: string): boolean {\n return effectiveOperation === CoreResourceOperation.LIST\n || effectiveOperation === CoreResourceOperation.SEARCH;\n}\n\n@injectable()\nexport class McpServerBackendService {\n protected logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) protected readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) protected readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.McpToolAdapter) protected readonly toolAdapter: McpToolAdapterBackendService,\n @inject(SAAS_SERVICE_TYPES.AuthorizationsService) protected readonly authorizer: AuthorizationsBackendService,\n @inject(SAAS_SERVICE_TYPES.ServicesRegistryHandlerService) protected readonly servicesHandler: ServicesRegistryHandlerBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService) protected readonly resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.FileUploadGrantService) protected readonly fileUploadGrantService: FileUploadGrantBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService) protected readonly appConfigService: AppConfigurationService,\n @inject(SAAS_SERVICE_TYPES.RateLimitBackendService) protected readonly rateLimitService: RateLimitBackendService,\n ) {\n this.logDebug = this.logger.debugByType('McpServerBackendService');\n this.logger.setDebugTypeLogging('McpServerBackendService', false);\n }\n\n /**\n * Return the exposed tool descriptors for the caller's reachable scopes (`options.reachableScopes`).\n * PROGRESSIVE principal-awareness (C): a caller presenting a valid Bearer bound to this endpoint\n * passes its principal's scopes, so a user-delegated caller additionally sees its USER_SELF tools.\n * Omitting the scopes yields the MACHINE catalog; an ANONYMOUS caller passes an EMPTY set and the\n * transport challenges it rather than serving the empty page. Authorization is still enforced\n * fail-closed at `callTool` time — the catalog is a discovery aid, never an authorization grant.\n */\n public listTools(options: McpToolAdapterBuildOptions = {}): McpToolDescriptor[] {\n return this.toolAdapter.buildToolDescriptors(options);\n }\n\n /**\n * Execute one tool: resolve → authorize (fail-closed) → dispatch to the service layer.\n *\n * @param toolName - `<resourceIdentifier>__<operationIdentifier>`.\n * @param args - the tool arguments (the operation request body).\n * @param executionContext - the caller's context (a machine principal for api-key\n * / client-credentials callers; a user-delegated context once OIDC lands).\n * @param options - per-call options ({@link McpCallToolOptions}).\n * @throws AUTHORIZATION when the principal is not permitted to run the operation.\n * @throws NOT_FOUND when the tool name does not map to an exposable operation.\n */\n public async callTool(\n toolName: string,\n args: unknown,\n executionContext: ExecutionContext<any>,\n options: McpCallToolOptions = {},\n ): Promise<McpCallToolResult> {\n const { resourceType, operationIdentifier } = this.parseToolName(toolName);\n\n // Single source of exposability truth: the adapter decides whether this resource+operation is a\n // valid, default URL-bearing tool REACHABLE BY THIS CALLER. Progressive principal-awareness — a\n // user-delegated principal (USER_REQUEST, carries a `userId`) reaches USER_SELF operations; a\n // machine principal reaches ORG/APP only. Rejecting here (before authorization) prevents a crafted\n // name from reaching a scope the caller cannot use (e.g. a machine hitting USER_SELF → always 403).\n // Derived from the SAME source `tools/list` filters on, so advertise ≡ callable per principal.\n // R-2: also gated on the server INSTANCE the call arrived on, so `(principal, instance)` together\n // decide callability — the same pair `tools/list` filters on.\n // Post-authentication by construction: `callTool` is only reached with a validated token.\n const reachableScopes = mcpReachableScopesForPrincipal(mcpPrincipalForAuthenticatedCaller(executionContext.isUserExecution()));\n\n // Issue #312, D11: a DERIVED upload-grant tool mints a grant instead of dispatching an operation.\n // It resolves its PARENT through the same adapter gate (exposure, instance, scope inherited), is\n // authorized exactly as the parent would be, then calls the ONE mint function the REST door calls.\n if (operationIdentifier.includes(MCP_UPLOAD_GRANT_TOOL_MARKER)) {\n return this.callUploadGrantTool(toolName, resourceType, operationIdentifier, args, executionContext, options, reachableScopes);\n }\n\n const operation = this.toolAdapter.resolveExposableOperation(resourceType, operationIdentifier, reachableScopes, options.instanceRef);\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.NOT_FOUND, executionContext, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_NOT_FOUND,\n context: { message: `MCP tool \"${toolName}\" does not map to an exposable resource operation`, toolName },\n });\n }\n\n // Bind the resolved operation onto the caller's context (preserves principal\n // identity + roles) so the authorizer and the service pipeline both see the\n // operation actually being executed.\n const boundExecutionContext = executionContext.withOperation(operation);\n\n const idOrIds = options.resourceId;\n\n // Fail-closed per-operation authorization: reads `operation.roles` +\n // `executionContext.initiatorRoles` / scope. Throws AUTHORIZATION on denial.\n await this.authorizer.authorizeInController(idOrIds, boundExecutionContext);\n\n // The operation's OWN declared request budget. AFTER authorization on purpose: a caller who may\n // not run the operation at all must be refused with AUTHORIZATION rather than told how much of a\n // budget they have — and must not consume a slot of a budget that is not theirs, which would let\n // an unauthorized caller exhaust an authorized one's quota. (The HTTP seam orders these the other\n // way round because it has no choice: `checkPolicyForVariant` runs pre-flight, before the\n // execution context that authorization needs even exists. Here the identity is already resolved,\n // so the safer order is available and is taken.)\n await this.assertOperationRateLimitPolicy(operation, boundExecutionContext);\n\n // Dispatch to the service layer directly (NOT re-HTTP). The service pipeline\n // enforces enabledCondition / requiredFeatures downstream.\n //\n // Dispatch the EXACT operation we resolved + authorized + advertised (the URL-bearing default\n // from `resolveExposableOperation`), via `extractOperationPath`. We deliberately do NOT\n // re-resolve through `getServiceOperationPathDefault`: for a resource that declares BOTH a\n // URL-bearing default AND an INTERNAL_CALL default for the same operation identifier, that\n // helper PREFERS the INTERNAL_CALL variant — which would execute a different variant (different\n // `requestDto` validating `args`, different side effects / custom-impl) than the one\n // `authorizeInController` just checked and than the `inputSchema` advertised to the agent.\n // Using the resolved operation's own path mirrors how the HTTP controllers dispatch the URL\n // operation and keeps authorize ≡ advertise ≡ execute on one variant.\n const operationPath: ResourceConfiguration_OperationPath<any, any> = ResourcesConfig_OperationPathUtils.extractOperationPath(operation);\n\n const dispatchArgs = this.toDispatchArguments(operation, args, boundExecutionContext);\n\n this.logDebug('Executing MCP tool call', { toolName, resourceType, operationIdentifier, hasResourceId: idOrIds !== undefined });\n\n /**\n * Request the pagination WRAPPER for collection operations, exactly as the HTTP controller does.\n *\n * The repository's `list` returns a BARE ARRAY unless the caller asks for the envelope\n * (`options.paginated`), and the decision to ask is made in `ControllerResourceBackendService`:\n * `needsPagination = LIST || SEARCH` → `{ paginated: true }`. That is a CONTROLLER-tier\n * decision, and this path does not go through the controller — so `tools/call` dispatched a\n * paginated LIST without ever requesting pagination, the repository returned a bare array, and\n * the operation's RESPONSE DTO (which for a paginated list declares `{ data, pagination }`)\n * rejected it. Every paginated `*__list` tool answered `-32603` with\n * `expected array, received undefined` at `data`.\n *\n * Two things hid it. `*__search` was unaffected — the search path builds its own envelope — and\n * the one LIST that worked (`todosRelationships__list`) is UNPAGINATED, so a bare array is\n * exactly what its response DTO declares. So the failure looked resource-specific when it was\n * operation-wide.\n *\n * This is the OUTPUT half of the defect family the input normalisation already fixed on\n * 2026-08-01: \"the advertised contract is not the enforced contract\". `tools/list` advertises a\n * paginated collection envelope because the response DTO says so; the dispatch has to request\n * the shape that DTO describes, or the two tiers disagree about what the operation returns.\n */\n const needsPaginationWrapper = isPaginationWrappedOperation(this.resolveEffectiveOperation(operation));\n\n const result = await this.servicesHandler.doByOperationPath(\n operationPath,\n boundExecutionContext,\n idOrIds,\n dispatchArgs,\n needsPaginationWrapper ? { paginated: true } : undefined,\n );\n\n // Project the raw service result through the operation's RESPONSE DTO — the SAME\n // output-serialization boundary the HTTP controller (`sendResponse`) and the A2A tool\n // path use — BEFORE it crosses to the external MCP agent. `doByOperationPath` returns the\n // internal DTO, which still carries `.isBackendOnly()` / write-only-secret fields and raw\n // `Date`/`ObjectId` instances; returning it verbatim would leak backend-only/secret material\n // into the agent's model context. `toResponseSafeToolOutput` strips + JSON-normalizes so the\n // MCP tool result is byte-identical to what a REST client would receive.\n const safeResult = await toResponseSafeToolOutput(operation, result);\n\n return { toolName, result: safeResult };\n }\n\n /**\n * Enforce the resolved operation's OWN `rateLimit?` policy on the tool plane.\n *\n * ## What was broken\n *\n * `rateLimit?` is authored on an `API_CALL` / `API_CALL_WITH_CALLBACK` variant and was enforced\n * by exactly one consumer — `RateLimitBackendService.checkPolicyForVariant`, called from the\n * resource controller's HTTP pre-flight. `callTool` dispatches the SAME operation through the\n * SAME service pipeline while bypassing Express entirely, so the identical operation was\n * throttled over REST and unthrottled as a tool. An application that declared a budget on an\n * endpoint got one; an agent asked for the same endpoint by its tool name and got none.\n *\n * ## Subject: the CREDENTIAL, not the IP and not the tenant\n *\n * See {@link resolveDeclaredPolicySubjectKey} for the full argument. In short: the HTTP seam\n * keys on the source IP because at its pre-flight moment no identity exists yet, so `5/min` has\n * always meant \"5/min per CLIENT\". On this plane the client is the credential the agent\n * presented — a server-verified field of the execution context, never anything the model\n * supplied. Keying on the tenant instead would make the same authored number several times\n * stricter here than over REST for any tenant running more than one agent.\n *\n * ## Scope: a SEPARATE bucket from the REST route, deliberately\n *\n * The key is namespaced `mcp:resource:<resource>:<operation>` rather than sharing the HTTP\n * seam's `resource:<resource>:<operation>`. Sharing would be incoherent — the two seams count\n * different SUBJECTS (an IP and a credential), so one bucket would mix two identity spaces and\n * let a browser's traffic spend an agent's budget. Per-plane-per-client is the faithful\n * extension of a policy that was already per-client rather than a global cap.\n *\n * ## Not applied to the derived upload-grant tool\n *\n * `callUploadGrantTool` MINTS a grant; it does not dispatch the parent operation. Charging the\n * parent's budget there would spend two slots for one upload (mint + the upload itself, which\n * traverses the real HTTP route and meets `checkPolicyForVariant`) while a REST client spends\n * one — the declared number would mean something different depending on how the caller got the\n * URL. It is left uncharged for that reason, not by omission.\n *\n * ## Postures\n *\n * - **No declared policy, or a non-HTTP variant** → no-op, zero Redis traffic. Mirrors\n * `checkPolicyForVariant`'s two early returns exactly; the variant guard is defensive, since\n * `resolveExposableOperation` only ever yields a URL-bearing default.\n * - **Unkeyable subject** → not enforced, logged. Structurally unreachable: `callTool` is only\n * reached post-authentication, and `ExecutionContext`'s own constructor rejects an\n * authenticated principal carrying no identity field. It is not \"unbounded\" either — the\n * transport's blanket per-principal cap is the backstop, and it declines on exactly the same\n * input. Refusing a well-formed call here instead would invent an outage out of a branch that\n * cannot happen.\n * - **Limiter outage** → propagates, as it does over HTTP for the same declared policy. An\n * authored budget must not quietly become \"unlimited\" on one plane while it is a 500 on the\n * other.\n */\n private async assertOperationRateLimitPolicy(\n operation: ResourceConfiguration_Operation<any, any, any>,\n boundExecutionContext: ExecutionContext<any>,\n ): Promise<void> {\n if (\n operation.variantType !== ResourceOperationVariantType.API_CALL\n && operation.variantType !== ResourceOperationVariantType.API_CALL_WITH_CALLBACK\n ) {\n return;\n }\n const policy = operation.rateLimit;\n if (!policy) {\n return;\n }\n\n const subjectKey = resolveDeclaredPolicySubjectKey(boundExecutionContext.initiatorIds);\n if (!subjectKey) {\n this.logger.warn('[mcp] declared rateLimit not enforced — the authenticated caller carries no keyable identity', {\n resourceIdentifier: String(operation.resourceIdentifier),\n operationIdentifier: String(operation.operationIdentifier),\n });\n return;\n }\n\n await this.rateLimitService.checkPolicyForSubject(\n policy,\n `mcp:resource:${String(operation.resourceIdentifier)}:${String(operation.operationIdentifier)}`,\n subjectKey,\n boundExecutionContext.organizationId,\n );\n }\n\n /**\n * Execute a derived upload-grant tool (issue #312, D11).\n *\n * Authorization is the PARENT's: the caller's context is bound to the parent operation and\n * `authorizeInController` runs on it with the same `resourceId` the parent would take — so minting\n * requires exactly the authority uploading would, which is the invariant the REST door gets from\n * sharing the upload middleware. The upload URL is built from the parent's own route pattern with\n * the parameters the context and the call supply, and the API origin comes from CONFIGURATION,\n * never from a request header.\n */\n private async callUploadGrantTool(\n toolName: string,\n resourceType: ResourceType,\n operationPart: string,\n args: unknown,\n executionContext: ExecutionContext<any>,\n options: McpCallToolOptions,\n reachableScopes: ReadonlySet<ResourcePrimaryScope>,\n ): Promise<McpCallToolResult> {\n const derived = this.toolAdapter.resolveUploadGrantTool(resourceType, operationPart, reachableScopes, options.instanceRef);\n if (!derived) {\n throw this.errorBuilder.buildError(ErrorType.NOT_FOUND, executionContext, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_NOT_FOUND,\n context: { message: `MCP tool \"${toolName}\" does not map to an exposable upload-grant tool`, toolName },\n });\n }\n const { parentOperation, fieldName, operationKind } = derived;\n const boundExecutionContext = executionContext.withOperation(parentOperation);\n const resourceId = options.resourceId;\n if (operationKind === CoreResourceOperation.UPDATE && !resourceId) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, boundExecutionContext, {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: { message: 'An upload grant for an UPDATE requires the record id', toolName },\n });\n }\n\n // Same gate, same order, same arguments as the parent operation.\n await this.authorizer.authorizeInController(resourceId, boundExecutionContext);\n\n const parsedArgs = FileUploadGrantMintRequestSchema.safeParse(this.withoutInstanceId(args, resourceType));\n if (!parsedArgs.success) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, boundExecutionContext, {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: { toolName, errors: parsedArgs.error.issues.map((issue) => ({ path: issue.path.join('.'), message: issue.message })) },\n });\n }\n\n const apiPublicUrl = this.appConfigService.config.runtime?.endPoints?.[BackendApiType.MAIN_BACKEND_API]?.publicUrl;\n if (!apiPublicUrl) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, boundExecutionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: { message: `runtime.endPoints.${BackendApiType.MAIN_BACKEND_API}.publicUrl is required to mint a file upload grant` },\n });\n }\n const origin = apiPublicUrl.replace(/\\/+$/, '');\n // Scope ids come from the CALLER's context: binding an operation onto a context never changes who is calling.\n const uploadPath = this.resolveUploadRoutePath(parentOperation, resourceType, fieldName, operationKind, resourceId, executionContext);\n const grant = await this.fileUploadGrantService.mint({\n executionContext: boundExecutionContext,\n target: { resourceType, fieldName, operation: operationKind, resourceId },\n expiresInMinutes: parsedArgs.data.expiresInMinutes,\n declared: { name: parsedArgs.data.name, mimeType: parsedArgs.data.mimeType, size: parsedArgs.data.size },\n uploadUrl: `${origin}${uploadPath}`,\n apiBaseUrl: `${origin}${MAIN_API_BASE_PATH}`,\n });\n this.logDebug('Executing MCP upload-grant tool call', { toolName, resourceType, fieldName, operationKind, hasResourceId: resourceId !== undefined });\n return { toolName, result: grant };\n }\n\n /** The tool arguments minus the resource's own id, which the transport already split out into `options.resourceId`. */\n private withoutInstanceId(args: unknown, resourceType: ResourceType): unknown {\n if (!args || typeof args !== 'object') return args ?? {};\n const selfField = this.resourcesRegistry.getAllResourceFieldIdentifiers()[resourceType];\n if (!selfField || !(selfField in (args as Record<string, unknown>))) return args;\n const { [selfField]: _dropped, ...rest } = args as Record<string, unknown>;\n return rest;\n }\n\n /**\n * The concrete upload-route PATH (mount prefix included) for one file field of the parent\n * operation, from the parent's own route patterns — the same builder the resource controller used\n * to REGISTER the route, so the grant's `uploadUrl` is a route that exists.\n *\n * A parent can carry several patterns (one per parent-resource combination); the one chosen is the\n * first whose every `{param}` the call can supply: the resource's own id from `resourceId`, and scope\n * / parent ids from the context's `initiatorIds`. Patterns are tried shortest first, so the\n * primary-scope form wins over a nested FK form the MCP call cannot address anyway.\n */\n private resolveUploadRoutePath(\n parentOperation: ResourceConfiguration_Operation<any, any, any>,\n resourceType: ResourceType,\n fieldName: string,\n operationKind: FileUploadGrantOperation,\n resourceId: string | undefined,\n executionContext: ExecutionContext<any>,\n ): string {\n const selfField = this.resourcesRegistry.getAllResourceFieldIdentifiers()[resourceType];\n const initiatorInfos = [...(('initiatorInfos' in parentOperation ? parentOperation.initiatorInfos : undefined) ?? [])]\n .sort((a, b) => (a.parameters?.length ?? 0) - (b.parameters?.length ?? 0));\n const supplied: Record<string, string | undefined> = {\n ...(executionContext.initiatorIds as Record<string, string | undefined> | undefined ?? {}),\n ...(selfField && resourceId ? { [selfField]: resourceId } : {}),\n };\n for (const info of initiatorInfos) {\n const route = ResourcesConfigOperationsUrlsBuilderUtils.buildFileUploadRouteForOperation({\n operationRouteUrl: info.url,\n operationParameters: info.parameters ?? [],\n targetResourceType: resourceType,\n targetResourceFieldIdentifier: selfField ?? 'id',\n fieldName,\n requiresTargetResourceId: operationKind === CoreResourceOperation.UPDATE,\n isFrontend: false,\n });\n let unresolved = false;\n const path = route.url.replace(/\\{([^}]+)\\}/g, (_m, param: string) => {\n const value = supplied[param];\n if (typeof value !== 'string' || value.length === 0) { unresolved = true; return `{${param}}`; }\n return encodeURIComponent(value);\n });\n if (!unresolved) return path;\n }\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: { message: 'No upload route of this operation can be addressed from the MCP call', resourceType, fieldName, operationKind, patterns: initiatorInfos.map((i) => i.url) },\n });\n }\n\n /**\n * Split `<resourceIdentifier>__<operationIdentifier>` on the FIRST double\n * underscore. Resource identifiers use single underscores only, so the first\n * `__` unambiguously delimits the resource from the operation.\n */\n /**\n * Bring the agent's raw `arguments` onto the SAME input contract the HTTP controller produces\n * before dispatch. Added 2026-08-01; until then `tools/call` passed `args` through untouched.\n *\n * Two distinct defects that fixed, both of the \"advertised contract is not the enforced\n * contract\" family:\n *\n * 1. **Collection tools silently ignored the agent's filter.** `tools/list` advertises an\n * `inputSchema` derived from the operation's `requestDto`, which for LIST / SEARCH is keyed\n * `{ filters, pagination, sorting }`. The service reads `{ filter, page, limit, sort,\n * searchQuery }`. The HTTP controller bridges the two; MCP did not, so an agent that\n * followed the schema it was given received the UNFILTERED collection while believing it was\n * filtered — the worst shape for an LLM caller, which then reasons over the wrong rows.\n * {@link normalizeCollectionQueryRequestData} is now the single authority both surfaces use,\n * and it accepts either vocabulary. It also carries the filter ALLOW-LIST, which matters\n * here: the repository's `sanitizeRequestFilter` returns the filter UNCHANGED when an\n * operation declares no `filterFields`, so for a surface with no strict DTO parse in front\n * of it this is the layer that stops an arbitrary key reaching the database.\n * 2. **The published request contract was not enforced.** Every other operation now gets the\n * controller's strict `requestDto.parse`, so a key the tool never advertised is dropped at\n * the boundary that advertised it, rather than three layers away. Writes were already safe —\n * the repository re-parses against the same DTO\n * (`repositories-registry-handler.backend.service.ts`) — but relying on a distant guard for\n * an external protocol surface is defence by coincidence: nothing tells a future refactor of\n * that method that MCP depends on it.\n *\n * Parse failures are deliberately NOT swallowed. An agent that sends a malformed argument should\n * be told, so the model can correct itself; silently dropping it teaches the model nothing and\n * leaves it reasoning about an operation it did not actually perform.\n */\n private toDispatchArguments(\n operation: {\n requestDto?: z.ZodTypeAny;\n resourceOperationLike?: unknown;\n operationIdentifier: unknown;\n resourceIdentifier: unknown;\n },\n args: unknown,\n executionContext: ExecutionContext<any>,\n ): unknown {\n const effectiveOperation = this.resolveEffectiveOperation(operation);\n const isCollectionOperation = isCollectionQueryMcpOperation(effectiveOperation);\n\n if (isCollectionOperation) {\n const rawArguments = (args && typeof args === 'object' && !Array.isArray(args))\n ? args as Record<string, unknown>\n : {};\n const resourceOperations = this.resourcesRegistry\n .getResourceConfiguration(operation.resourceIdentifier as ResourceType)\n .operations;\n return normalizeCollectionQueryRequestData(\n rawArguments,\n operation as never,\n effectiveOperation,\n resourceOperations as never,\n );\n }\n\n if (!operation.requestDto) return args;\n\n try {\n return operation.requestDto.parse(args);\n } catch (error) {\n if (error instanceof z.ZodError) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONTROLLER_RESOURCE_VALIDATION_FAILED,\n stack: error.stack,\n context: {\n message: 'MCP tool arguments do not satisfy the operation request contract advertised by tools/list',\n operationIdentifier: operation.operationIdentifier,\n zodIssues: error.issues,\n },\n });\n }\n throw error;\n }\n }\n\n /**\n * The operation this tool really performs — a custom operation declares what it behaves LIKE via\n * `resourceOperationLike`, and both the input normalisation and the output envelope must key on\n * the same answer. Derived once here because they previously derived it separately, and a\n * custom LIST-like operation that only one of them recognised would be normalised as a collection\n * on the way in and dispatched without pagination on the way out.\n */\n private resolveEffectiveOperation(operation: { resourceOperationLike?: unknown; operationIdentifier: unknown }): string {\n return resolveEffectiveMcpOperation(operation);\n }\n\n private parseToolName(toolName: string): { resourceType: ResourceType; operationIdentifier: string } {\n const separatorIndex = toolName.indexOf(MCP_TOOL_NAME_SEPARATOR);\n if (separatorIndex <= 0 || separatorIndex + MCP_TOOL_NAME_SEPARATOR.length >= toolName.length) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_NOT_FOUND,\n context: { message: `Malformed MCP tool name \"${toolName}\" — expected \"<resource>${MCP_TOOL_NAME_SEPARATOR}<operation>\"`, toolName },\n });\n }\n return {\n resourceType: toolName.slice(0, separatorIndex) as ResourceType,\n operationIdentifier: toolName.slice(separatorIndex + MCP_TOOL_NAME_SEPARATOR.length),\n };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-tool-adapter.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/services/mcp-tool-adapter.backend.service.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EAEZ,+BAA+B,EAC/B,oBAAoB,EASpB,KAAK,wBAAwB,EAC9B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,gCAAgC,EAAqB,MAAM,wEAAwE,CAAC;AAClJ,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,EAAE,+BAA+B,EAAE,MAAM,0EAA0E,CAAC;AAE3H,OAAO,EACL,iBAAiB,EAEjB,0BAA0B,EAO3B,MAAM,wDAAwD,CAAC;AAuDhE;;;;GAIG;AACH,oBAAY,kBAAkB;IAC5B,gCAAgC;IAChC,SAAS,cAAc;IACvB,0EAA0E;IAC1E,OAAO,YAAY;IACnB,sFAAsF;IACtF,cAAc,mBAAmB;CAClC;AAED;;;;;;GAMG;AACH;;;;;;;;GAQG;AACH,wBAAgB,kCAAkC,CAAC,eAAe,EAAE,OAAO,GAAG,kBAAkB,CAE/F;AAED,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,kBAAkB,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAS/G;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,EAAE;IAAE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAAC,mBAAmB,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAEjI;AAED;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAIjF;AAED;;;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;IAS/B,OAAO,CAAC,0BAA0B,CAAS;IAC3C;;;;OAIG;IACH,OAAO,CAAC,4BAA4B;IAMpC;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAS3B;;;;;OAKG;IACH,OAAO,CAAC,0BAA0B;IA+BlC;;;;;;;OAOG;IACH,sBAAsB,CACpB,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,WAAW,CAAC,oBAAoB,CAAC,EAClD,WAAW,CAAC,EAAE,MAAM,GACnB;QAAE,eAAe,EAAE,+BAA+B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,wBAAwB,CAAA;KAAE,GAAG,SAAS;IAa9I,qDAAqD;IACrD,OAAO,CAAC,aAAa;IAIrB;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,uBAAuB;IAoB/B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,gBAAgB;IAKxB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAW7B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,4BAA4B;IAsBpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,OAAO,CAAC,uBAAuB;IA8B/B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,gBAAgB;CAWzB"}
1
+ {"version":3,"file":"mcp-tool-adapter.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/services/mcp-tool-adapter.backend.service.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EAEZ,+BAA+B,EAC/B,oBAAoB,EASpB,KAAK,wBAAwB,EAC9B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,gCAAgC,EAAqB,MAAM,wEAAwE,CAAC;AAClJ,OAAO,KAAK,EAAE,aAAa,EAA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D;IACrD,OAAO,CAAC,aAAa;IAIrB;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,uBAAuB;IAoB/B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,gBAAgB;IAKxB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAW7B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,4BAA4B;IAsBpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,OAAO,CAAC,uBAAuB;IA8B/B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,gBAAgB;CAWzB"}
@@ -470,6 +470,23 @@ let McpToolAdapterBackendService = class McpToolAdapterBackendService {
470
470
  resourceType: config.resourceIdentifier,
471
471
  operationIdentifier,
472
472
  });
473
+ /*
474
+ * ## Coverage: unit tests only, accepted deliberately — 2026-09-08 (#467)
475
+ *
476
+ * NO application reaches this derivation. Neither dogfood exposes an MCP operation carrying a
477
+ * user-uploadable file field: the two file fields declared belong to `todo-lists` and
478
+ * `knowledge-documents`, neither MCP-exposed, and the only file field on an MCP-exposed
479
+ * resource is `todos.generatedSummaryPdf` — PDF-template generated, and therefore excluded
480
+ * from uploadable fields BY DESIGN. So the derivation below, `resolveUploadGrantTool` and the
481
+ * mint path are covered by unit tests only.
482
+ *
483
+ * Nothing is wrong; the shape that reaches this code simply does not exist in any application.
484
+ * Buying the proof would mean authoring an uploadable file field for the purpose of testing
485
+ * it, which proves the harness more than the product — weighed and accepted.
486
+ *
487
+ * **What would change the answer:** an MCP-exposed resource gaining a user-uploadable file
488
+ * field. That author is the first party to execute this path.
489
+ */
473
490
  // Issue #312, D11: one DERIVED upload-grant tool per user-uploadable file field of an exposed
474
491
  // CREATE / UPDATE. It inherits every gate the parent just passed (exposure, instance, scope) by
475
492
  // construction — it is emitted inside the parent's own iteration — and is resolved back through
@@ -544,6 +561,11 @@ File fields: ${lines.join(' ')}`;
544
561
  type: 'integer', minimum: 1, maximum: FILE_UPLOAD_GRANT_ABSOLUTE_MAX_MINUTES,
545
562
  description: `How long the link stays usable (default ${FILE_UPLOAD_GRANT_DEFAULT_MINUTES}, at most ${FILE_UPLOAD_GRANT_ABSOLUTE_MAX_MINUTES}).`,
546
563
  },
564
+ // Declaring the file up front lets the server refuse an impossible one BEFORE a link exists — the
565
+ // same facts the MCP File Objects proposal has a client declare when it asks to upload.
566
+ name: { type: 'string', maxLength: 255, description: 'The file name you intend to upload (used in the returned command).' },
567
+ mimeType: { type: 'string', maxLength: 255, description: `Declared MIME type; refused now if the field does not accept it (accepted: ${fileField.fileMetadata.allowedMimeTypes?.join(', ') || 'any'}).` },
568
+ size: { type: 'integer', minimum: 1, description: 'Declared size in bytes; refused now if above the field maximum.' },
547
569
  };
548
570
  const target = `the "${fileField.fieldName}" file of a ${String(resourceType)} record (${parentOperationIdentifier})`;
549
571
  return {