@wildo-ai/saas-backend-lib 1.1.12 → 1.1.13

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 (226) hide show
  1. package/dist/esm/base-classes/models/manual-controllers.backend.definition.d.ts.map +1 -1
  2. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js +2 -0
  3. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js.map +1 -1
  4. package/dist/esm/base-classes/services/repositories/stored-field-omission.backend.d.ts +4 -0
  5. package/dist/esm/base-classes/services/repositories/stored-field-omission.backend.d.ts.map +1 -1
  6. package/dist/esm/base-classes/services/repositories/stored-field-omission.backend.js +20 -5
  7. package/dist/esm/base-classes/services/repositories/stored-field-omission.backend.js.map +1 -1
  8. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-registry.backend.service.d.ts +3 -0
  9. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-registry.backend.service.d.ts.map +1 -1
  10. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-registry.backend.service.js +10 -1
  11. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-registry.backend.service.js.map +1 -1
  12. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation.factory.backend.d.ts +22 -0
  13. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation.factory.backend.d.ts.map +1 -1
  14. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation.factory.backend.js +25 -1
  15. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation.factory.backend.js.map +1 -1
  16. package/dist/esm/base-classes/services/services/resource-operation-transaction-persistence.backend.utils.d.ts +38 -3
  17. package/dist/esm/base-classes/services/services/resource-operation-transaction-persistence.backend.utils.d.ts.map +1 -1
  18. package/dist/esm/base-classes/services/services/resource-operation-transaction-persistence.backend.utils.js +68 -5
  19. package/dist/esm/base-classes/services/services/resource-operation-transaction-persistence.backend.utils.js.map +1 -1
  20. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts +2 -2
  21. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts.map +1 -1
  22. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js +6 -3
  23. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js.map +1 -1
  24. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts +83 -0
  25. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
  26. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +217 -14
  27. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
  28. package/dist/esm/compliance/approval-seals/approval-seal-currency.backend.d.ts +32 -0
  29. package/dist/esm/compliance/approval-seals/approval-seal-currency.backend.d.ts.map +1 -0
  30. package/dist/esm/compliance/approval-seals/approval-seal-currency.backend.js +36 -0
  31. package/dist/esm/compliance/approval-seals/approval-seal-currency.backend.js.map +1 -0
  32. package/dist/esm/compliance/approval-seals/approval-seal-on-record.backend.d.ts +38 -0
  33. package/dist/esm/compliance/approval-seals/approval-seal-on-record.backend.d.ts.map +1 -0
  34. package/dist/esm/compliance/approval-seals/approval-seal-on-record.backend.js +83 -0
  35. package/dist/esm/compliance/approval-seals/approval-seal-on-record.backend.js.map +1 -0
  36. package/dist/esm/compliance/approval-seals/approval-seal-presentation-read.backend.d.ts +36 -0
  37. package/dist/esm/compliance/approval-seals/approval-seal-presentation-read.backend.d.ts.map +1 -0
  38. package/dist/esm/compliance/approval-seals/approval-seal-presentation-read.backend.js +51 -0
  39. package/dist/esm/compliance/approval-seals/approval-seal-presentation-read.backend.js.map +1 -0
  40. package/dist/esm/compliance/approval-seals/approval-seal-relay-store.backend.d.ts +46 -0
  41. package/dist/esm/compliance/approval-seals/approval-seal-relay-store.backend.d.ts.map +1 -1
  42. package/dist/esm/compliance/approval-seals/approval-seal-relay-store.backend.js +68 -0
  43. package/dist/esm/compliance/approval-seals/approval-seal-relay-store.backend.js.map +1 -1
  44. package/dist/esm/compliance/approval-seals/approval-seal-store.backend.d.ts +27 -0
  45. package/dist/esm/compliance/approval-seals/approval-seal-store.backend.d.ts.map +1 -1
  46. package/dist/esm/compliance/approval-seals/approval-seal-store.backend.js +42 -3
  47. package/dist/esm/compliance/approval-seals/approval-seal-store.backend.js.map +1 -1
  48. package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.contracts.d.ts +26 -1
  49. package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.contracts.d.ts.map +1 -1
  50. package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.contracts.js +10 -0
  51. package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.contracts.js.map +1 -1
  52. package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.controller.d.ts +10 -1
  53. package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.controller.d.ts.map +1 -1
  54. package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.controller.js +60 -28
  55. package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.controller.js.map +1 -1
  56. package/dist/esm/compliance/approval-seals/approval-seals-on-record.backend.controller.d.ts +90 -0
  57. package/dist/esm/compliance/approval-seals/approval-seals-on-record.backend.controller.d.ts.map +1 -0
  58. package/dist/esm/compliance/approval-seals/approval-seals-on-record.backend.controller.js +373 -0
  59. package/dist/esm/compliance/approval-seals/approval-seals-on-record.backend.controller.js.map +1 -0
  60. package/dist/esm/compliance/approval-seals/decision-presentation.backend.d.ts +29 -2
  61. package/dist/esm/compliance/approval-seals/decision-presentation.backend.d.ts.map +1 -1
  62. package/dist/esm/compliance/approval-seals/decision-presentation.backend.js +40 -3
  63. package/dist/esm/compliance/approval-seals/decision-presentation.backend.js.map +1 -1
  64. package/dist/esm/compliance/electronic-signatures/pdf-signature-structure.backend.d.ts.map +1 -1
  65. package/dist/esm/compliance/electronic-signatures/pdf-signature-structure.backend.js +34 -6
  66. package/dist/esm/compliance/electronic-signatures/pdf-signature-structure.backend.js.map +1 -1
  67. package/dist/esm/compliance/electronic-signatures/signature-request-evidence-files.backend.d.ts +30 -6
  68. package/dist/esm/compliance/electronic-signatures/signature-request-evidence-files.backend.d.ts.map +1 -1
  69. package/dist/esm/compliance/electronic-signatures/signature-request-evidence-files.backend.js +67 -22
  70. package/dist/esm/compliance/electronic-signatures/signature-request-evidence-files.backend.js.map +1 -1
  71. package/dist/esm/compliance/electronic-signatures/signature-request-poll.batch.backend.service.d.ts.map +1 -1
  72. package/dist/esm/compliance/electronic-signatures/signature-request-poll.batch.backend.service.js +18 -1
  73. package/dist/esm/compliance/electronic-signatures/signature-request-poll.batch.backend.service.js.map +1 -1
  74. package/dist/esm/compliance/electronic-signatures/signature-requests.backend.service.d.ts +66 -1
  75. package/dist/esm/compliance/electronic-signatures/signature-requests.backend.service.d.ts.map +1 -1
  76. package/dist/esm/compliance/electronic-signatures/signature-requests.backend.service.js +161 -14
  77. package/dist/esm/compliance/electronic-signatures/signature-requests.backend.service.js.map +1 -1
  78. package/dist/esm/compliance/electronic-signatures/signed-document-validation.backend.d.ts +47 -0
  79. package/dist/esm/compliance/electronic-signatures/signed-document-validation.backend.d.ts.map +1 -1
  80. package/dist/esm/compliance/electronic-signatures/signed-document-validation.backend.js.map +1 -1
  81. package/dist/esm/external-providers/services/content-safety.backend.service.d.ts +27 -2
  82. package/dist/esm/external-providers/services/content-safety.backend.service.d.ts.map +1 -1
  83. package/dist/esm/external-providers/services/content-safety.backend.service.js +46 -1
  84. package/dist/esm/external-providers/services/content-safety.backend.service.js.map +1 -1
  85. package/dist/esm/external-providers/services/embeddings.backend.service.d.ts.map +1 -1
  86. package/dist/esm/external-providers/services/embeddings.backend.service.js +2 -0
  87. package/dist/esm/external-providers/services/embeddings.backend.service.js.map +1 -1
  88. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +11 -0
  89. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
  90. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +23 -0
  91. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
  92. package/dist/esm/external-providers/services/provider-service-account-token.backend.d.ts +19 -1
  93. package/dist/esm/external-providers/services/provider-service-account-token.backend.d.ts.map +1 -1
  94. package/dist/esm/external-providers/services/provider-service-account-token.backend.js +41 -1
  95. package/dist/esm/external-providers/services/provider-service-account-token.backend.js.map +1 -1
  96. package/dist/esm/files/utils/file-parent-read-context.backend.d.ts +27 -2
  97. package/dist/esm/files/utils/file-parent-read-context.backend.d.ts.map +1 -1
  98. package/dist/esm/files/utils/file-parent-read-context.backend.js +23 -4
  99. package/dist/esm/files/utils/file-parent-read-context.backend.js.map +1 -1
  100. package/dist/esm/flows-actors/content-guardrails/classifier-availability.backend.utils.d.ts +26 -0
  101. package/dist/esm/flows-actors/content-guardrails/classifier-availability.backend.utils.d.ts.map +1 -1
  102. package/dist/esm/flows-actors/content-guardrails/classifier-availability.backend.utils.js +100 -8
  103. package/dist/esm/flows-actors/content-guardrails/classifier-availability.backend.utils.js.map +1 -1
  104. package/dist/esm/flows-actors/content-guardrails/record-owner-policy.backend.d.ts +3 -1
  105. package/dist/esm/flows-actors/content-guardrails/record-owner-policy.backend.d.ts.map +1 -1
  106. package/dist/esm/flows-actors/content-guardrails/record-owner-policy.backend.js +8 -2
  107. package/dist/esm/flows-actors/content-guardrails/record-owner-policy.backend.js.map +1 -1
  108. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts +43 -0
  109. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts.map +1 -1
  110. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js +37 -0
  111. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js.map +1 -1
  112. package/dist/esm/flows-actors/services/agent-work-decisions.backend.service.d.ts +7 -0
  113. package/dist/esm/flows-actors/services/agent-work-decisions.backend.service.d.ts.map +1 -1
  114. package/dist/esm/flows-actors/services/agent-work-decisions.backend.service.js +8 -3
  115. package/dist/esm/flows-actors/services/agent-work-decisions.backend.service.js.map +1 -1
  116. package/dist/esm/flows-actors/services/agents.backend.service.d.ts +31 -6
  117. package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
  118. package/dist/esm/flows-actors/services/agents.backend.service.js +78 -30
  119. package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
  120. package/dist/esm/flows-actors/services/autonomous-agent-turn.backend.service.d.ts.map +1 -1
  121. package/dist/esm/flows-actors/services/autonomous-agent-turn.backend.service.js +4 -0
  122. package/dist/esm/flows-actors/services/autonomous-agent-turn.backend.service.js.map +1 -1
  123. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts +28 -2
  124. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts.map +1 -1
  125. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js +132 -22
  126. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js.map +1 -1
  127. package/dist/esm/flows-actors/services/flow-actor-executions.custom-impl.backend.service.d.ts.map +1 -1
  128. package/dist/esm/flows-actors/services/flow-actor-executions.custom-impl.backend.service.js +12 -8
  129. package/dist/esm/flows-actors/services/flow-actor-executions.custom-impl.backend.service.js.map +1 -1
  130. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts +5 -0
  131. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts.map +1 -1
  132. package/dist/esm/flows-actors/services/flows-actors-registry.service.js +18 -2
  133. package/dist/esm/flows-actors/services/flows-actors-registry.service.js.map +1 -1
  134. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts +33 -0
  135. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
  136. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +58 -0
  137. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
  138. package/dist/esm/inbound/services/inbound-delivery-dispatch.backend.service.d.ts +12 -1
  139. package/dist/esm/inbound/services/inbound-delivery-dispatch.backend.service.d.ts.map +1 -1
  140. package/dist/esm/inbound/services/inbound-delivery-dispatch.backend.service.js +23 -4
  141. package/dist/esm/inbound/services/inbound-delivery-dispatch.backend.service.js.map +1 -1
  142. package/dist/esm/inbound/services/inbound-delivery-receiver.backend.service.d.ts +12 -1
  143. package/dist/esm/inbound/services/inbound-delivery-receiver.backend.service.d.ts.map +1 -1
  144. package/dist/esm/inbound/services/inbound-delivery-receiver.backend.service.js +55 -17
  145. package/dist/esm/inbound/services/inbound-delivery-receiver.backend.service.js.map +1 -1
  146. package/dist/esm/inbound/services/inbound-delivery-store.backend.service.d.ts +22 -1
  147. package/dist/esm/inbound/services/inbound-delivery-store.backend.service.d.ts.map +1 -1
  148. package/dist/esm/inbound/services/inbound-delivery-store.backend.service.js +52 -9
  149. package/dist/esm/inbound/services/inbound-delivery-store.backend.service.js.map +1 -1
  150. package/dist/esm/inbound/services/inbound-delivery-stored-body.backend.service.d.ts +79 -0
  151. package/dist/esm/inbound/services/inbound-delivery-stored-body.backend.service.d.ts.map +1 -0
  152. package/dist/esm/inbound/services/inbound-delivery-stored-body.backend.service.js +211 -0
  153. package/dist/esm/inbound/services/inbound-delivery-stored-body.backend.service.js.map +1 -0
  154. package/dist/esm/inbound/services/inbound-delivery-subject-erasure-severance.backend.d.ts +2 -2
  155. package/dist/esm/inbound/services/inbound-delivery-subject-erasure-severance.backend.d.ts.map +1 -1
  156. package/dist/esm/inbound/services/inbound-delivery-subject-erasure-severance.backend.js +9 -1
  157. package/dist/esm/inbound/services/inbound-delivery-subject-erasure-severance.backend.js.map +1 -1
  158. package/dist/esm/index.d.ts +1 -0
  159. package/dist/esm/index.d.ts.map +1 -1
  160. package/dist/esm/index.js +1 -0
  161. package/dist/esm/index.js.map +1 -1
  162. package/dist/esm/inject/models/container.d.ts.map +1 -1
  163. package/dist/esm/inject/models/container.js +6 -0
  164. package/dist/esm/inject/models/container.js.map +1 -1
  165. package/dist/esm/inject/models/service-types.d.ts +5 -0
  166. package/dist/esm/inject/models/service-types.d.ts.map +1 -1
  167. package/dist/esm/inject/models/service-types.js +3 -0
  168. package/dist/esm/inject/models/service-types.js.map +1 -1
  169. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts +5 -0
  170. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts.map +1 -1
  171. package/dist/esm/monitoring/observability/models/observability.backend.schemas.js.map +1 -1
  172. package/dist/esm/monitoring/observability/services/metrics.service.d.ts +34 -1
  173. package/dist/esm/monitoring/observability/services/metrics.service.d.ts.map +1 -1
  174. package/dist/esm/monitoring/observability/services/metrics.service.js +49 -0
  175. package/dist/esm/monitoring/observability/services/metrics.service.js.map +1 -1
  176. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts +6 -1
  177. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts.map +1 -1
  178. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js +15 -4
  179. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js.map +1 -1
  180. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.custom-impl.backend.service.d.ts.map +1 -1
  181. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.custom-impl.backend.service.js +3 -1
  182. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.custom-impl.backend.service.js.map +1 -1
  183. package/dist/esm/runtime/services/http-server.backend.service.d.ts +3 -1
  184. package/dist/esm/runtime/services/http-server.backend.service.d.ts.map +1 -1
  185. package/dist/esm/runtime/services/http-server.backend.service.js +11 -3
  186. package/dist/esm/runtime/services/http-server.backend.service.js.map +1 -1
  187. package/dist/esm/runtime/services/utils/inbound-endpoint-raw-body.backend.utils.d.ts +22 -0
  188. package/dist/esm/runtime/services/utils/inbound-endpoint-raw-body.backend.utils.d.ts.map +1 -1
  189. package/dist/esm/runtime/services/utils/inbound-endpoint-raw-body.backend.utils.js +54 -0
  190. package/dist/esm/runtime/services/utils/inbound-endpoint-raw-body.backend.utils.js.map +1 -1
  191. package/dist/esm/security/authentications/services/auth-methods/auth-password-reset.backend.service.d.ts +51 -0
  192. package/dist/esm/security/authentications/services/auth-methods/auth-password-reset.backend.service.d.ts.map +1 -1
  193. package/dist/esm/security/authentications/services/auth-methods/auth-password-reset.backend.service.js +87 -15
  194. package/dist/esm/security/authentications/services/auth-methods/auth-password-reset.backend.service.js.map +1 -1
  195. package/dist/esm/security/authentications/services/custom-impls/siem-delivery-dlq.custom-impl.backend.service.d.ts.map +1 -1
  196. package/dist/esm/security/authentications/services/custom-impls/siem-delivery-dlq.custom-impl.backend.service.js +5 -2
  197. package/dist/esm/security/authentications/services/custom-impls/siem-delivery-dlq.custom-impl.backend.service.js.map +1 -1
  198. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts.map +1 -1
  199. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js +65 -24
  200. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js.map +1 -1
  201. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts +64 -1
  202. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts.map +1 -1
  203. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js +84 -2
  204. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js.map +1 -1
  205. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts +14 -0
  206. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts.map +1 -1
  207. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js +13 -5
  208. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js.map +1 -1
  209. package/dist/esm/users/services/anonymous-consent.custom-impl.backend.service.d.ts.map +1 -1
  210. package/dist/esm/users/services/anonymous-consent.custom-impl.backend.service.js +6 -2
  211. package/dist/esm/users/services/anonymous-consent.custom-impl.backend.service.js.map +1 -1
  212. package/dist/esm/users/services/user-force-password-reset.custom-impl.backend.service.d.ts +7 -0
  213. package/dist/esm/users/services/user-force-password-reset.custom-impl.backend.service.d.ts.map +1 -1
  214. package/dist/esm/users/services/user-force-password-reset.custom-impl.backend.service.js +65 -20
  215. package/dist/esm/users/services/user-force-password-reset.custom-impl.backend.service.js.map +1 -1
  216. package/dist/esm/users/services/user-role-administration.custom-impl.backend.service.d.ts.map +1 -1
  217. package/dist/esm/users/services/user-role-administration.custom-impl.backend.service.js +11 -4
  218. package/dist/esm/users/services/user-role-administration.custom-impl.backend.service.js.map +1 -1
  219. package/dist/esm/users/services/user-self-custom-implementations.backend.d.ts.map +1 -1
  220. package/dist/esm/users/services/user-self-custom-implementations.backend.js +4 -2
  221. package/dist/esm/users/services/user-self-custom-implementations.backend.js.map +1 -1
  222. package/dist/esm/users/services/user-super-admin-floor.custom-impl.backend.service.d.ts.map +1 -1
  223. package/dist/esm/users/services/user-super-admin-floor.custom-impl.backend.service.js +16 -0
  224. package/dist/esm/users/services/user-super-admin-floor.custom-impl.backend.service.js.map +1 -1
  225. package/dist/tsconfig.build.tsbuildinfo +1 -1
  226. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"record-owner-policy.backend.js","sourceRoot":"","sources":["../../../../src/flows-actors/content-guardrails/record-owner-policy.backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,OAAO,EACL,wBAAwB,EACxB,yCAAyC,EACzC,yBAAyB,EACzB,uBAAuB,EAEvB,aAAa,EACb,+BAA+B,GAGhC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAG9G,OAAO,EAAE,UAAU,EAA6B,MAAM,oFAAoF,CAAC;AAC3I,OAAO,EAAE,kCA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,oCAAoC,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QACnF,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,qIAAqI,CAAC,CAAC;QAC5J,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mHAAmH;QACnH,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,uHAAuH,EACvI,2BAA2B,CAAC,KAAK,CAAC,CAAC,CAAC;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,uHAAuH;AACvH,SAAS,oCAAoC,CAAC,OAAqC;IACjF,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,OAAO,CAAC,YAAY,WAAW,CAAC,CAAC,CAAC,uBAAuB,CAAC;IAC7G,OAAO,SAAS,OAAO,CAAC,WAAW,KAAK,OAAO,kFAAkF;UAC7H,8GAA8G;UAC9G,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,kFAAkF;UAClH,6GAA6G;UAC7G,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,sGAAsG,CAAC,CAAC,CAAC,QAAQ,CAAC;UAC1I,0GAA0G,CAAC;AACjH,CAAC","sourcesContent":["/**\n * #2877 — a record a guarded tool returns is treated under the agent policy of the ORGANIZATION THAT OWNS IT, tightened\n * over the call's own.\n *\n * The call's guardrails come from the organizations the call works for (`agent-policy.backend.ts`). That covers every\n * row a tenant-scoped turn can read, and none of the rows a turn working for NO organization reads: an application-scope\n * caller (an operator's agent, an application-scoped autonomous agent) reading an organization's records through an\n * application-level read tool sent them under the agent's own declaration only, and an organization that asked for its\n * records to reach a model only as placeholders was not honoured there.\n *\n * Decided by this repository's principles rather than asked:\n * - **The policy is the owner's.** The application has no content policy of its own to fall back on: the application agent\n * policy (`applicationAgentPolicies`) records suspensions only, and the agent's declaration IS the application's\n * content decision, already applied to every call. So no application-level policy was being skipped; what was missing\n * is the owning organization's.\n * - **Per row, at the model boundary.** One read can return rows of several organizations, so the treatment is chosen per\n * row. Rows of the organizations the call already works for are treated as before; only the others are looked up.\n * - **Tighten-only.** A row is treated under the stricter of the call's treatment and its owner's\n * (`isStricterPersonalDataTreatment`); an owner policy can never loosen the call.\n * - **Fail closed.** An owner policy that cannot be read is treated as asking for every guardrail at its strictest\n * (`UNREADABLE_OWNER_TIGHTENING`). Output that is not a record at all, from an organization-owned resource on tools\n * acting in no organization, is withheld whole. Tools acting IN an organization (an acting tenant) read only that\n * tenant's rows, so a row naming no owner there is treated by the call's guard as before.\n *\n * **Whose row it is, when the row does not say (#3369).** Measured before this was written: the engine's read and write\n * tools return the response DTO of the operation they dispatch, and every organization-owned core resource's default\n * READ / LIST / SEARCH / CREATE / UPDATE keeps `organizationId` (581 operations carry it; the 177 that do not are deletes,\n * counts, custom answers and summary variants, which no engine tool dispatches). So the rows that name no owner are the\n * application's hand-written tools that return the fields they need (`{ todoId, title }`). The owner is derived, in order:\n * 1. the row's own scope field (`organizationNamedByRecord`): `organizationId`, the organization row's `_id`;\n * 2. the row's `_id`, when a dispatch of this call returned that row (`ToolCallRecordOwners.ownerOfRecord`);\n * 3. the organizations the call's dispatches reached, for a tool whose every access is a dispatch\n * (`UnattributedRowOwnership.OBSERVED_DISPATCHES`) and whose dispatches' results each named their owners\n * (`ToolCallRecordOwners.complete`): its true owner is one of them, so the strictest of their policies is never looser\n * than its own, and exact when they are one. A dispatch whose result names no owner (a custom operation's answer, a\n * count) leaves the set incomplete, and the row falls to 4;\n * 4. otherwise nothing can say, and the row is treated under the strictest policy (`UNREADABLE_OWNER_TIGHTENING`) and\n * counted on the call's operation record (`rowsOwnerNotDerived`). Startup names every tool in that position\n * (`reportToolsWhoseRowOwnersCannotBeDerived`).\n * Rejected: the caller's memberships as the possible owners, which #3364 used. A caller with none (an operator at\n * application scope) had no possible owner, and a read under a platform-access grant reaches outside them, so the real\n * owner's policy was missed in exactly the cases this module exists for. Also rejected: every guardrail at its strictest\n * for every row naming no owner (#3364 review F1), which would leave an application-scope agent using such a tool unable\n * to answer where no classifier is configured; it now applies only where the owner cannot be derived, and startup says\n * which tools those are. A retrieval result names no owner either; its search is confined to the caller's organizations\n * (`resolveRetrievalOrganizationIds`), so they are its possible owners (`RETRIEVAL_NARROWING`).\n * - **No placeholder an unguarded call cannot put back.** A call whose agent declares no treatment was built without\n * re-identification (its tools accept no placeholder, its stream restores none), so a row needing a treatment there is\n * treated `REMOVE` even when its owner asked for `TOKENIZE`. Stricter than asked, never looser. Such a call's writes\n * refuse a withheld marker (`argumentsAToolRunsWith`), including after an approval pause.\n *\n * **The reply is moderated under the strictest output policy of every organization whose rows reached the model in the\n * turn, and the turn's own (#3364 step 3).** Output moderation judges what the model WRITES, not a row, so it cannot be\n * applied per row; but a reply drawn from an organization's records is that organization's content as much as the turn's.\n * The owners' policies are recorded as the rows enter (`rowsReachedModelFrom`), the call's guard is tightened (lower\n * severity wins, per category), and every later model step is judged under it. Rejected: moderating under the turn's\n * policy only, which is what applied before, so an operator's agent could write about an organization's records anything\n * that organization asked its agents never to write. Also rejected: a per-row category list attached to the reply, which\n * nothing can apply, since a reply cannot be split back into the rows it came from. An unreadable owner counts as asking\n * for every category at its lowest severity (fail closed), and a classifier that cannot judge what is asked withholds\n * the reply (`OUTPUT_NOT_MODERATED`).\n *\n * **Machine readers keep an owner's placeholders when the owner asked (#3364 step 2).** A placeholder minted for a row whose\n * owner set `machineReadersKeepPlaceholders` is marked (`keptFromMachineReaders`), and a turn read by a machine (A2A,\n * autonomous) never gets that value back, even when the agent re-identifies for machine readers. The person whose turn\n * it is still reads it. The mark is per value and never removed, so when owners disagree the stricter answer holds.\n *\n * **Prompt-injection screening is decided per row too (#3364 step 1).** A row whose owner switched screening on is screened before\n * the model reads it, even when the call screens nothing: the rows that need it are screened together, in one request,\n * and replaced by the withheld notice when the screen does not find them clean. A call that screens its results screens\n * every row already. An owner whose policy cannot be read is treated as screening (fail closed), and a classifier that\n * cannot serve withholds the rows (`NOT_SCREENED`).\n */\nimport {\n FlowsActors_Agent_Status,\n FlowsActors_PromptInjectionScreeningScope,\n FunctionToolAuthorityKind,\n isLLMAgentConfiguration,\n type FlowsActors_Agent,\n RedactionType,\n isStricterPersonalDataTreatment,\n type FlowsActors_AgentContentGuardrailsTightening,\n type FlowsActors_PersonalDataModelTreatment,\n} from '@wildo-ai/saas-models';\nimport { ContentSafety_HarmCategory, ContentSafety_HarmSeverity } from '@wildo-ai/external-connectors-models';\n\nimport type { AgentPolicyLookup } from '~wildo-backend-lib/flows-actors/content-guardrails/agent-policy.backend';\nimport { recordIdOf, type ToolCallRecordOwners } from '~wildo-backend-lib/flows-actors/content-guardrails/tool-call-record-owners.backend';\nimport { FunctionToolPersonalDataOutputKind, type FunctionTool } from '~wildo-backend-lib/flows-actors/models/function-tools.backend.definitions';\nimport type { PersonalDataGuard } from '~wildo-backend-lib/flows-actors/content-guardrails/personal-data-guard.backend.utils';\nimport { treatRecordsResult } from '~wildo-backend-lib/flows-actors/content-guardrails/personal-data-guard.backend.utils';\nimport type { ToolResultScreen } from '~wildo-backend-lib/flows-actors/content-guardrails/tool-result-screen.backend.utils';\nimport { projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\n\n/** What treating a result by its rows' owners needs from the call. */\nexport interface RecordOwnerPolicyContext {\n /** The organizations whose policies the call already applies (its scope). Their rows are treated by the call's guard. */\n readonly coveredOrganizationIds: readonly string[];\n /**\n * The organization the call's tools act in (`auth.initiatorIds.organizationId`), which confines what they read. Absent\n * when they act in none: an application-scope caller, whose reads can reach any organization its authority admits.\n */\n readonly actingOrganizationId?: string;\n /** Reads the agent policies of organizations outside the call's scope. */\n readonly readPolicies: (organizationIds: readonly string[]) => Promise<AgentPolicyLookup>;\n /** Whether a resource's rows belong to an organization (its primary scope is ORGANIZATIONS). */\n readonly isOrganizationOwned: (resourceType: string) => boolean;\n /**\n * The organization owning one row of an organization-owned resource: its scope field (`organizationId`), or its own id\n * when the resource IS the organization (the scope root). `undefined` when the row does not say.\n */\n readonly ownerOf: (resourceType: string, record: unknown) => string | undefined;\n /**\n * The guard that treats a row needing it when the call has none: created once per call, over the call's table, and\n * recorded on the call like a declared one. Its treatment is `REMOVE`.\n */\n readonly ownerGuard: () => PersonalDataGuard;\n /**\n * The organizations whose rows a tool acting with the caller's authority can return: the acting tenant when there is\n * one, else the caller's organization-wide memberships (`resolveCallerOrganizationIds`). The set retrieval narrows to\n * (`resolveRetrievalOrganizationIds`), which is what a tool treating its own unattributed output is judged against.\n */\n readonly possibleOwnerOrganizationIds: () => readonly string[];\n /**\n * #3369: `rows` rows of one call's result named no organization and nothing could derive whose they were, so they were\n * treated under the strictest policy. Recorded on the call's operation record. Must not throw.\n */\n readonly rowsOwnerNotDerived: (call: RecordOwnerToolCall, rows: number) => void;\n /**\n * The screen that screens rows whose owner asked when the call itself screens nothing (#3364): created once per call,\n * recording each withholding as the call's own screen does. When no classifier can serve, it answers `NOT_SCREENED`.\n */\n readonly ownerScreen: () => ToolResultScreen;\n /**\n * #3364 step 3: told the policies of the organizations whose rows reached the model (beyond the call's own), as they\n * enter, so the reply can be judged under the strictest of them and the call's own. Must not throw.\n */\n readonly rowsReachedModelFrom: (tightenings: readonly FlowsActors_AgentContentGuardrailsTightening[]) => void;\n}\n\n/**\n * How the owner of a result row that names none can be known, from the tool's declaration (#3369). See the module header.\n */\nexport enum UnattributedRowOwnership {\n /**\n * Every access is `dispatchResourceOperationAsTool` (`PRINCIPAL_RESOURCE_OPERATION`), which records the owners of the rows\n * it returns: the row is one of theirs, provided every result named its owners (`ToolCallRecordOwners.complete`).\n */\n OBSERVED_DISPATCHES = 'observed_dispatches',\n /** The engine's retrieval tool: its search is confined to the caller's organizations, which are the possible owners. */\n RETRIEVAL_NARROWING = 'retrieval_narrowing',\n /** The tool declares that its rows carry `organizationId` (`rowsNameTheirOrganization`). A row that does not is not derivable. */\n ROWS_NAME_THEIR_ORGANIZATION = 'rows_name_their_organization',\n /** Nothing the engine sees can say: such a row is treated under the strictest policy. */\n NOT_DERIVABLE = 'not_derivable',\n}\n\n/**\n * How `tool`'s rows that name no organization are attributed (#3369). One reading of the declaration, shared by the\n * runtime and the startup report, so the two cannot disagree.\n */\nexport function unattributedRowOwnershipOf(tool: Pick<FunctionTool, 'authority' | 'retrievalSources' | 'personalDataOutput'>): UnattributedRowOwnership {\n if (tool.retrievalSources !== undefined && tool.retrievalSources.length > 0) return UnattributedRowOwnership.RETRIEVAL_NARROWING;\n if (tool.authority?.kind === FunctionToolAuthorityKind.PRINCIPAL_RESOURCE_OPERATION) return UnattributedRowOwnership.OBSERVED_DISPATCHES;\n if (tool.personalDataOutput?.kind === FunctionToolPersonalDataOutputKind.RECORDS_OF_RESOURCE && tool.personalDataOutput.rowsNameTheirOrganization === true) {\n return UnattributedRowOwnership.ROWS_NAME_THEIR_ORGANIZATION;\n }\n return UnattributedRowOwnership.NOT_DERIVABLE;\n}\n\n/** The tool call a result came from, and whether the call screens every result itself. */\nexport interface RecordOwnerToolCall {\n readonly toolCallId: string;\n readonly toolName: string;\n /** The call's own screen covers this result (its agent screens, and the result is not the person's own words). */\n readonly callScreensResult: boolean;\n /** #3369: how the owner of a row naming none is known, from the tool's declaration (`unattributedRowOwnershipOf`). */\n readonly unattributedRows: UnattributedRowOwnership;\n /** #3369: what the call's dispatches reached, when its `execute` was observed (`observingRecordOwners`). */\n readonly observedOwners?: ToolCallRecordOwners;\n}\n\n/**\n * The tightening an owner whose policy cannot be read is treated as asking for (fail closed): every guardrail at its\n * strictest. Also what a row whose owner cannot be derived is treated under (#3369).\n */\nexport const UNREADABLE_OWNER_TIGHTENING: FlowsActors_AgentContentGuardrailsTightening = Object.freeze({\n personalDataTreatment: RedactionType.REMOVE,\n promptInjectionScreening: FlowsActors_PromptInjectionScreeningScope.THIRD_PARTY_CONTENT,\n machineReadersKeepPlaceholders: true,\n outputModeration: Object.values(ContentSafety_HarmCategory).map((category) => ({ category, blockAtOrAbove: ContentSafety_HarmSeverity.LOW })),\n});\n\n/** The rows of a records result: `{ data: [...] }` or one record; `undefined` for anything else. */\nfunction recordsOf(output: unknown): unknown[] | undefined {\n if (output === null || output === undefined) return undefined;\n if (typeof output === 'object' && !Array.isArray(output) && Array.isArray((output as { data?: unknown }).data)) return (output as { data: unknown[] }).data;\n return typeof output === 'object' && !Array.isArray(output) ? [output] : undefined;\n}\n\n/** What each listed owner's policy tightens: its row (none = nothing), or {@link UNREADABLE_OWNER_TIGHTENING} when unreadable. */\nasync function ownerTightenings(owners: readonly string[], context: RecordOwnerPolicyContext): Promise<Map<string, FlowsActors_AgentContentGuardrailsTightening | undefined>> {\n const asked = new Map<string, FlowsActors_AgentContentGuardrailsTightening | undefined>();\n if (owners.length === 0) return asked;\n const lookup = await context.readPolicies(owners);\n for (const owner of owners) {\n asked.set(owner, lookup.unreadable !== undefined\n ? UNREADABLE_OWNER_TIGHTENING\n : lookup.policies.find((candidate) => (candidate as { organizationId?: string }).organizationId === owner));\n }\n return asked;\n}\n\n/**\n * The strictest of several organizations' tightenings, for a row that may be any of theirs (#3369): the strongest\n * treatment, placeholders kept from machine readers when any asks, screening when any screens, and every moderation entry\n * (the call's guard keeps the lower severity per category). `undefined` when none asks for anything.\n */\nfunction strictestOf(tightenings: readonly FlowsActors_AgentContentGuardrailsTightening[]): FlowsActors_AgentContentGuardrailsTightening | undefined {\n let treatment: FlowsActors_PersonalDataModelTreatment | undefined;\n for (const tightening of tightenings) {\n const candidate = tightening.personalDataTreatment ?? undefined;\n if (isStricterPersonalDataTreatment(candidate, treatment)) treatment = candidate;\n }\n const screening = tightenings.find((tightening) => tightening.promptInjectionScreening)?.promptInjectionScreening;\n const keep = tightenings.some((tightening) => tightening.machineReadersKeepPlaceholders === true);\n const moderation = tightenings.flatMap((tightening) => tightening.outputModeration ?? []);\n const strictest: FlowsActors_AgentContentGuardrailsTightening = {\n ...(treatment ? { personalDataTreatment: treatment } : {}),\n ...(screening ? { promptInjectionScreening: screening } : {}),\n ...(keep ? { machineReadersKeepPlaceholders: true } : {}),\n ...(moderation.length > 0 ? { outputModeration: moderation } : {}),\n };\n return Object.keys(strictest).length > 0 ? strictest : undefined;\n}\n\n/** What a result whose rows name no owner is treated under, and whether its owners were derived at all. */\ninterface UnattributedTreatment {\n /** The strictest of its possible owners' policies beyond the call's own; `undefined` when none asks for more. */\n readonly tightening: FlowsActors_AgentContentGuardrailsTightening | undefined;\n /** False when nothing could say whose it is: `tightening` is then {@link UNREADABLE_OWNER_TIGHTENING}. */\n readonly derived: boolean;\n}\n\n/**\n * The organizations a result naming no owner can belong to (#3369), from what the call observed and the tool declares;\n * `undefined` when nothing can say. Tools acting in an organization read only that tenant's rows.\n */\nfunction possibleOwnersOf(context: RecordOwnerPolicyContext, call: RecordOwnerToolCall): readonly string[] | undefined {\n if (context.actingOrganizationId !== undefined) return [context.actingOrganizationId];\n switch (call.unattributedRows) {\n // Complete only when every organization-owned result the call's dispatches returned named its owners.\n case UnattributedRowOwnership.OBSERVED_DISPATCHES: return call.observedOwners?.complete === true ? call.observedOwners.organizations() : undefined;\n case UnattributedRowOwnership.RETRIEVAL_NARROWING: return context.possibleOwnerOrganizationIds();\n case UnattributedRowOwnership.ROWS_NAME_THEIR_ORGANIZATION:\n case UnattributedRowOwnership.NOT_DERIVABLE:\n return undefined;\n }\n}\n\n/**\n * What an UNATTRIBUTED row (an organization-owned resource's row naming no owner, and none known for its id) is treated\n * under (#3369): the strictest policy of the organizations it can belong to (`possibleOwnersOf`) beyond those the call\n * covers, or every guardrail at its strictest when nothing can say. `requireOwners` says whether an empty possible set is\n * underivable (a row of an organization-owned resource is somebody's) or simply nobody's (a tool-treated result that\n * reached no organization's rows).\n */\nasync function unattributedTreatment(context: RecordOwnerPolicyContext, call: RecordOwnerToolCall, requireOwners: boolean): Promise<UnattributedTreatment> {\n const possible = possibleOwnersOf(context, call);\n if (possible === undefined || (requireOwners && possible.length === 0)) return { tightening: UNREADABLE_OWNER_TIGHTENING, derived: false };\n const covered = new Set(context.coveredOrganizationIds);\n const owners = [...new Set(possible)].filter((owner) => !covered.has(owner)).sort();\n const asked = [...(await ownerTightenings(owners, context)).values()].filter((policy): policy is FlowsActors_AgentContentGuardrailsTightening => policy !== undefined);\n return { tightening: strictestOf(asked), derived: true };\n}\n\n/**\n * The model-side rows at `indices`, screened together through the owner screen (#3364): unchanged when clean, each\n * replaced by the withheld notice otherwise. One request for all of them, so a page of rows costs one screening.\n */\nasync function screenOwnerRows(\n rows: unknown[], indices: readonly number[], context: RecordOwnerPolicyContext, call: RecordOwnerToolCall,\n): Promise<{ readonly rows: unknown[]; readonly withheld: ReadonlySet<number> }> {\n if (indices.length === 0) return { rows, withheld: new Set() };\n // The real tool call id: the owner screen is its own instance and a result goes through one screen or the other, so the\n // verdict, the audit row and the operation record all name the call the result belongs to.\n // Withheld is the screen's own answer, never inferred from the output (#3364 review R2): a clean string result is `text`\n // too, and a record could even hold a notice's words.\n const { output, withheld } = await context.ownerScreen().screened(call.toolCallId, call.toolName, indices.map((index) => rows[index]));\n if (!withheld) return { rows, withheld: new Set() };\n const screened = [...rows];\n for (const index of indices) screened[index] = output.value;\n return { rows: screened, withheld: new Set(indices) };\n}\n\n/**\n * The result of a tool returning records of `resourceType`, as the model may read it: each row under the stricter of the\n * call's treatment (`callGuard`, absent for an unguarded call) and the treatment its owning organization asked for,\n * with its placeholders kept from machine readers when the owner asked, and screened when the owner screens and the call\n * does not (#3364). Side effect: tells `context.rowsReachedModelFrom` the owners of the rows that reached the model, so\n * the call's moderation is tightened. Equal to `treatRecordsResult` when every row's owner is one the call works for, and\n * to `output` itself on an unguarded call whose rows need nothing.\n */\nexport async function treatRecordsResultByOwner(\n output: unknown,\n resourceType: string,\n callGuard: PersonalDataGuard | undefined,\n context: RecordOwnerPolicyContext,\n call: RecordOwnerToolCall,\n): Promise<unknown> {\n const callOnly = () => (callGuard ? treatRecordsResult(output, callGuard, resourceType) : output);\n if (output === null || output === undefined || !context.isOrganizationOwned(resourceType)) return callOnly();\n const actsInNoOrganization = context.actingOrganizationId === undefined;\n const records = recordsOf(output);\n if (!records) {\n // Not a record and not `{ data: [...] }`: its rows cannot be attributed. A guarded call withholds it whole already;\n // an unguarded one acting in no organization does too, since nobody can say whose rows they are.\n // Withheld whole, it carries nothing a screen would read.\n return callGuard ? callOnly() : (actsInNoOrganization ? context.ownerGuard().withholdWhole() : output);\n }\n\n const covered = new Set(context.coveredOrganizationIds);\n // #3369: the row's own scope field, else the owner a dispatch of this call recorded for the row's id.\n const ownerOfRow = (record: unknown): string | undefined => {\n const named = context.ownerOf(resourceType, record);\n if (named !== undefined) return named;\n const id = recordIdOf(record);\n return id === undefined ? undefined : call.observedOwners?.ownerOfRecord(resourceType, id);\n };\n const owners = records.map(ownerOfRow);\n const uncovered = [...new Set(owners.filter((owner): owner is string => owner !== undefined && !covered.has(owner)))].sort();\n const unattributedRows = actsInNoOrganization ? owners.filter((owner) => owner === undefined).length : 0;\n if (uncovered.length === 0 && unattributedRows === 0) return callOnly();\n\n const asked = await ownerTightenings(uncovered, context);\n const unattributed = unattributedRows > 0 ? await unattributedTreatment(context, call, true) : undefined;\n if (unattributed && !unattributed.derived) context.rowsOwnerNotDerived(call, unattributedRows);\n /** What the row's owner asks beyond the call: `undefined` for a row of an organization the call already works for. */\n const tighteningOf = (record: unknown, index: number): FlowsActors_AgentContentGuardrailsTightening | undefined => {\n const owner = owners[index];\n // A row naming no owner read by tools acting in no organization: the strictest of whoever it can belong to.\n if (owner === undefined) return actsInNoOrganization ? unattributed?.tightening : undefined;\n return covered.has(owner) ? undefined : asked.get(owner);\n };\n\n const treatRow = (record: unknown, index: number): unknown => {\n const tightening = tighteningOf(record, index);\n const treatment: FlowsActors_PersonalDataModelTreatment | undefined = tightening?.personalDataTreatment ?? undefined;\n // #3364 step 2: a placeholder minted for this row is kept from machine readers when its owner asked.\n const keptFromMachineReaders = tightening?.machineReadersKeepPlaceholders === true;\n if (treatment === undefined) {\n return callGuard ? callGuard.treatRecord(record, callGuard.personalFieldsOf(resourceType), undefined, callGuard.treatment, keptFromMachineReaders) : record;\n }\n // An unguarded call puts no placeholder back, so it withholds instead (see the module header).\n const guard = callGuard ?? context.ownerGuard();\n return guard.treatRecord(record, guard.personalFieldsOf(resourceType), undefined, callGuard ? treatment : RedactionType.REMOVE, keptFromMachineReaders);\n };\n\n // Screened after the treatment, so a classifier reads placeholders, never values (as the call's own screen does).\n const screenIndices = call.callScreensResult ? [] : records.map((record, index) => (tighteningOf(record, index)?.promptInjectionScreening ? index : -1)).filter((index) => index >= 0);\n const { rows: treated, withheld } = await screenOwnerRows(records.map(treatRow), screenIndices, context, call);\n\n // #3364 step 3: the rows that reached the model (a row only stripped of personal fields did; one replaced by the\n // screen's notice did not), so their owners' moderation applies to the reply from the next step on.\n context.rowsReachedModelFrom(records\n .map((record, index) => (withheld.has(index) ? undefined : tighteningOf(record, index)))\n .filter((tightening): tightening is FlowsActors_AgentContentGuardrailsTightening => tightening !== undefined));\n\n if (!Array.isArray(output) && Array.isArray((output as { data?: unknown }).data)) {\n return { ...(output as object), data: treated };\n }\n return treated[0];\n}\n\n/**\n * The result of a tool that treats its own output (`TREATED_BY_TOOL`, retrieval), whose rows do not say which organization\n * owns them: on an unguarded call, treated through `treat` and the call's owner guard when any organization it can belong\n * to (`possibleOwnersOf`) and the call does not already cover asked for a treatment (the strictest of several possible\n * owners is never looser than the actual one). Unreadable is treated as asking (fail closed), and a tool whose possible\n * owners nothing can say is treated under the strictest policy, counted as one result (#3369). A guarded call is treated by its own\n * guard, as before: the retrieval tool's treatment withholds a personal passage whole under any treatment. Screened\n * whole when a possible owner screens and the call does not; when it reached the model, tells\n * `context.rowsReachedModelFrom` every possible owner's policy (#3364).\n */\nexport async function treatToolTreatedResultByPossibleOwners(\n output: unknown,\n treat: (output: unknown, guard: PersonalDataGuard) => unknown,\n callGuard: PersonalDataGuard | undefined,\n context: RecordOwnerPolicyContext,\n call: RecordOwnerToolCall,\n): Promise<unknown> {\n // #3369: its possible owners from what the call observed and the tool declares; strictest when nothing can say.\n const { tightening, derived } = await unattributedTreatment(context, call, false);\n if (!derived) context.rowsOwnerNotDerived(call, 1);\n const tightenings = tightening ? [tightening] : [];\n const treated = callGuard\n ? treat(output, callGuard)\n : tightenings.some((tightening) => tightening.personalDataTreatment) ? treat(output, context.ownerGuard()) : output;\n // Its rows name no owner, so the whole result is screened when any possible owner asked.\n if (!call.callScreensResult && tightenings.some((tightening) => tightening.promptInjectionScreening)) {\n const { output, withheld } = await context.ownerScreen().screened(call.toolCallId, call.toolName, treated);\n // Withheld whole: nothing of it reached the model, so nothing tightens the reply.\n if (withheld) return output.value;\n }\n // #3364 step 3: its rows name no owner, so every possible owner's moderation applies to the reply.\n context.rowsReachedModelFrom(tightenings);\n return treated;\n}\n\n/** One tool whose returned rows' owners the engine cannot derive (#3369), and the agents offered it. */\nexport interface ToolWithUnderivableRowOwners {\n readonly functionRef: string;\n /** The records it returns, for a `RECORDS_OF_RESOURCE` tool; absent for a tool that treats its own output. */\n readonly resourceType?: string;\n /** The ACTIVE language-model agents offered it, sorted. */\n readonly agentRefs: readonly string[];\n}\n\n/**\n * The boot report (#3369): every tool offered to an ACTIVE language-model agent whose result rows of an\n * organization-owned resource the engine cannot attribute when they name no organization (`NOT_DERIVABLE` in\n * `unattributedRowOwnershipOf`). One WARN per tool, naming it, its resource, the agents offered it, what happens to such\n * a row, and the remedy. Returns the findings; NEVER throws, because a diagnostic must never be why startup fails (the\n * remedy is an edit to the tool, and every other tool runs as before).\n *\n * Total over what is registered: it reads the agents, their tools and each tool's resource scope live, so a tool or a\n * resource added tomorrow is reported by the same run. Not reported, because their owners are derived: an\n * application-owned resource (no organization's policy applies), a tool whose every access is a dispatch (each records\n * its rows' owners), the engine's retrieval tool (its search is confined to the caller's organizations), and a tool\n * declaring `rowsNameTheirOrganization` (each row is checked at run time). A dispatching tool is attributed only as far\n * as its dispatches' results name their owners, which no declaration says in advance: one whose operation answers\n * without them (a custom operation's answer) is treated under the strictest policy and counted on the operation record\n * at run time, not here. A WARN, not a refusal: the rows are still\n * treated, under the strictest policy, and an agent acting IN an organization never meets the case.\n */\nexport function reportToolsWhoseRowOwnersCannotBeDerived(input: {\n /** The registered agents. A function, so a registry that cannot be read is reported here rather than thrown at startup. */\n readonly readAgents: () => readonly FlowsActors_Agent[];\n readonly readFunctionTool: (functionRef: string) => FunctionTool | undefined;\n /** Whether a resource's rows belong to an organization; an unregistered resource counts as one (fail closed). */\n readonly isOrganizationOwned: (resourceType: string) => boolean;\n readonly logger: Pick<LoggerService, 'warn' | 'debug'>;\n}): ToolWithUnderivableRowOwners[] {\n try {\n const offeredTo = new Map<string, Set<string>>();\n for (const agent of input.readAgents()) {\n if (agent.status !== FlowsActors_Agent_Status.ACTIVE || !isLLMAgentConfiguration(agent.config)) continue;\n for (const functionRef of agent.capabilities?.tools?.functionRefs ?? []) {\n offeredTo.set(functionRef, (offeredTo.get(functionRef) ?? new Set()).add(agent.ref));\n }\n }\n const findings: ToolWithUnderivableRowOwners[] = [];\n for (const [functionRef, agents] of [...offeredTo.entries()].sort(([a], [b]) => a.localeCompare(b))) {\n const tool = input.readFunctionTool(functionRef);\n const output = tool?.personalDataOutput;\n if (!tool || !output || output.kind === FunctionToolPersonalDataOutputKind.NOT_FROM_RECORDS) continue;\n if (output.kind === FunctionToolPersonalDataOutputKind.RECORDS_OF_RESOURCE && !input.isOrganizationOwned(output.resourceType)) continue;\n if (unattributedRowOwnershipOf(tool) !== UnattributedRowOwnership.NOT_DERIVABLE) continue;\n const resourceType = output.kind === FunctionToolPersonalDataOutputKind.RECORDS_OF_RESOURCE ? output.resourceType : undefined;\n const finding: ToolWithUnderivableRowOwners = { functionRef, ...(resourceType ? { resourceType } : {}), agentRefs: [...agents].sort() };\n findings.push(finding);\n input.logger.warn(describeToolWithUnderivableRowOwners(finding), { ...finding });\n }\n if (findings.length === 0) {\n input.logger.debug('Every agent tool returning records of an organization-owned resource names, or lets the engine derive, the organization of each row');\n }\n return findings;\n } catch (error) {\n // WARN, not debug: a report that did not run says nothing, and silence here reads as \"every row owner is derived\".\n input.logger.warn('The tool row-owner report could not run, so tools whose rows are treated under the strictest policy may be unreported',\n projectCaughtErrorLogFields(error));\n return [];\n }\n}\n\n/** The WARN line for one tool: what it returns, what happens to a row naming no organization, and the two remedies. */\nfunction describeToolWithUnderivableRowOwners(finding: ToolWithUnderivableRowOwners): string {\n const returns = finding.resourceType ? `returns \"${finding.resourceType}\" records` : 'treats its own output';\n return `Tool '${finding.functionRef}' ${returns} and reaches them without dispatchResourceOperationAsTool, so the engine cannot `\n + `tell whose a returned row is when the row names no organization. Read by an agent acting in no organization `\n + `(${finding.agentRefs.join(', ')}), such a row reaches the model under the strictest agent policy (personal data `\n + `withheld, screened, its reply moderated in every category), and is counted on the call's operation record. `\n + (finding.resourceType ? `Return each row's organizationId and declare personalDataOutput.rowsNameTheirOrganization, or reach ` : 'Reach ')\n + `the rows through dispatchResourceOperationAsTool and declare the PRINCIPAL_RESOURCE_OPERATION authority.`;\n}\n"]}
1
+ {"version":3,"file":"record-owner-policy.backend.js","sourceRoot":"","sources":["../../../../src/flows-actors/content-guardrails/record-owner-policy.backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,OAAO,EACL,wBAAwB,EACxB,yCAAyC,EACzC,yBAAyB,EACzB,uBAAuB,EAEvB,aAAa,EACb,+BAA+B,GAGhC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAG9G,OAAO,EAAE,UAAU,EAA6B,MAAM,oFAAoF,CAAC;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* #2877 — a record a guarded tool returns is treated under the agent policy of the ORGANIZATION THAT OWNS IT, tightened\n * over the call's own.\n *\n * The call's guardrails come from the organizations the call works for (`agent-policy.backend.ts`). That covers every\n * row a tenant-scoped turn can read, and none of the rows a turn working for NO organization reads: an application-scope\n * caller (an operator's agent, an application-scoped autonomous agent) reading an organization's records through an\n * application-level read tool sent them under the agent's own declaration only, and an organization that asked for its\n * records to reach a model only as placeholders was not honoured there.\n *\n * Decided by this repository's principles rather than asked:\n * - **The policy is the owner's.** The application has no content policy of its own to fall back on: the application agent\n * policy (`applicationAgentPolicies`) records suspensions only, and the agent's declaration IS the application's\n * content decision, already applied to every call. So no application-level policy was being skipped; what was missing\n * is the owning organization's.\n * - **Per row, at the model boundary.** One read can return rows of several organizations, so the treatment is chosen per\n * row. Rows of the organizations the call already works for are treated as before; only the others are looked up.\n * - **Tighten-only.** A row is treated under the stricter of the call's treatment and its owner's\n * (`isStricterPersonalDataTreatment`); an owner policy can never loosen the call.\n * - **Fail closed.** An owner policy that cannot be read is treated as asking for every guardrail at its strictest\n * (`UNREADABLE_OWNER_TIGHTENING`). Output that is not a record at all, from an organization-owned resource on tools\n * acting in no organization, is withheld whole. Tools acting IN an organization (an acting tenant) read only that\n * tenant's rows, so a row naming no owner there is treated by the call's guard as before.\n *\n * **Whose row it is, when the row does not say (#3369).** Measured before this was written: the engine's read and write\n * tools return the response DTO of the operation they dispatch, and every organization-owned core resource's default\n * READ / LIST / SEARCH / CREATE / UPDATE keeps `organizationId` (581 operations carry it; the 177 that do not are deletes,\n * counts, custom answers and summary variants, which no engine tool dispatches). So the rows that name no owner are the\n * application's hand-written tools that return the fields they need (`{ todoId, title }`). The owner is derived, in order:\n * 1. the row's own scope field (`organizationNamedByRecord`): `organizationId`, the organization row's `_id`;\n * 2. the row's `_id`, when a dispatch of this call returned that row (`ToolCallRecordOwners.ownerOfRecord`);\n * 3. the organizations the call's dispatches reached, for a tool whose every access is a dispatch\n * (`UnattributedRowOwnership.OBSERVED_DISPATCHES`) and whose dispatches' results each named their owners\n * (`ToolCallRecordOwners.complete`): its true owner is one of them, so the strictest of their policies is never looser\n * than its own, and exact when they are one. A dispatch whose result names no owner (a custom operation's answer, a\n * count) leaves the set incomplete, and the row falls to 4;\n * 4. otherwise nothing can say, and the row is treated under the strictest policy (`UNREADABLE_OWNER_TIGHTENING`) and\n * counted on the call's operation record (`rowsOwnerNotDerived`). Startup names every tool in that position\n * (`reportToolsWhoseRowOwnersCannotBeDerived`).\n * Rejected: the caller's memberships as the possible owners, which #3364 used. A caller with none (an operator at\n * application scope) had no possible owner, and a read under a platform-access grant reaches outside them, so the real\n * owner's policy was missed in exactly the cases this module exists for. Also rejected: every guardrail at its strictest\n * for every row naming no owner (#3364 review F1), which would leave an application-scope agent using such a tool unable\n * to answer where no classifier is configured; it now applies only where the owner cannot be derived, and startup says\n * which tools those are. A retrieval result names no owner either; its search is confined to the caller's organizations\n * (`resolveRetrievalOrganizationIds`), so they are its possible owners (`RETRIEVAL_NARROWING`).\n * - **No placeholder an unguarded call cannot put back.** A call whose agent declares no treatment was built without\n * re-identification (its tools accept no placeholder, its stream restores none), so a row needing a treatment there is\n * treated `REMOVE` even when its owner asked for `TOKENIZE`. Stricter than asked, never looser. Such a call's writes\n * refuse a withheld marker (`argumentsAToolRunsWith`), including after an approval pause.\n *\n * **The reply is moderated under the strictest output policy of every organization whose rows reached the model in the\n * turn, and the turn's own (#3364 step 3).** Output moderation judges what the model WRITES, not a row, so it cannot be\n * applied per row; but a reply drawn from an organization's records is that organization's content as much as the turn's.\n * The owners' policies are recorded as the rows enter (`rowsReachedModelFrom`), the call's guard is tightened (lower\n * severity wins, per category), and every later model step is judged under it. Rejected: moderating under the turn's\n * policy only, which is what applied before, so an operator's agent could write about an organization's records anything\n * that organization asked its agents never to write. Also rejected: a per-row category list attached to the reply, which\n * nothing can apply, since a reply cannot be split back into the rows it came from. An unreadable owner counts as asking\n * for every category at its lowest severity (fail closed), and a classifier that cannot judge what is asked withholds\n * the reply (`OUTPUT_NOT_MODERATED`).\n *\n * **Machine readers keep an owner's placeholders when the owner asked (#3364 step 2).** A placeholder minted for a row whose\n * owner set `machineReadersKeepPlaceholders` is marked (`keptFromMachineReaders`), and a turn read by a machine (A2A,\n * autonomous) never gets that value back, even when the agent re-identifies for machine readers. The person whose turn\n * it is still reads it. The mark is per value and never removed, so when owners disagree the stricter answer holds.\n *\n * **Prompt-injection screening is decided per row too (#3364 step 1).** A row whose owner switched screening on is screened before\n * the model reads it, even when the call screens nothing: the rows that need it are screened together, in one request,\n * and replaced by the withheld notice when the screen does not find them clean. A call that screens its results screens\n * every row already. An owner whose policy cannot be read is treated as screening (fail closed), and a classifier that\n * cannot serve withholds the rows (`NOT_SCREENED`).\n */\nimport {\n FlowsActors_Agent_Status,\n FlowsActors_PromptInjectionScreeningScope,\n FunctionToolAuthorityKind,\n isLLMAgentConfiguration,\n type FlowsActors_Agent,\n RedactionType,\n isStricterPersonalDataTreatment,\n type FlowsActors_AgentContentGuardrailsTightening,\n type FlowsActors_PersonalDataModelTreatment,\n} from '@wildo-ai/saas-models';\nimport { ContentSafety_HarmCategory, ContentSafety_HarmSeverity } from '@wildo-ai/external-connectors-models';\n\nimport type { AgentPolicyLookup } from '~wildo-backend-lib/flows-actors/content-guardrails/agent-policy.backend';\nimport { recordIdOf, type ToolCallRecordOwners } from '~wildo-backend-lib/flows-actors/content-guardrails/tool-call-record-owners.backend';\nimport { FunctionToolPersonalDataOutputKind, type FunctionTool } from '~wildo-backend-lib/flows-actors/models/function-tools.backend.definitions';\nimport type { PersonalDataGuard } from '~wildo-backend-lib/flows-actors/content-guardrails/personal-data-guard.backend.utils';\nimport { treatRecordsResult } from '~wildo-backend-lib/flows-actors/content-guardrails/personal-data-guard.backend.utils';\nimport type { ToolResultScreen } from '~wildo-backend-lib/flows-actors/content-guardrails/tool-result-screen.backend.utils';\nimport { projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\n\n/** What treating a result by its rows' owners needs from the call. */\nexport interface RecordOwnerPolicyContext {\n /** The organizations whose policies the call already applies (its scope). Their rows are treated by the call's guard. */\n readonly coveredOrganizationIds: readonly string[];\n /**\n * The organization the call's tools act in (`auth.initiatorIds.organizationId`), which confines what they read. Absent\n * when they act in none: an application-scope caller, whose reads can reach any organization its authority admits.\n */\n readonly actingOrganizationId?: string;\n /** Reads the agent policies of organizations outside the call's scope. */\n readonly readPolicies: (organizationIds: readonly string[]) => Promise<AgentPolicyLookup>;\n /** Whether a resource's rows belong to an organization (its primary scope is ORGANIZATIONS). */\n readonly isOrganizationOwned: (resourceType: string) => boolean;\n /**\n * The organization owning one row of an organization-owned resource: its scope field (`organizationId`), or its own id\n * when the resource IS the organization (the scope root). `undefined` when the row does not say.\n */\n readonly ownerOf: (resourceType: string, record: unknown) => string | undefined;\n /**\n * The guard that treats a row needing it when the call has none: created once per call, over the call's table, and\n * recorded on the call like a declared one. Its treatment is `REMOVE`.\n */\n readonly ownerGuard: () => PersonalDataGuard;\n /**\n * The organizations whose rows a tool acting with the caller's authority can return: the acting tenant when there is\n * one, else the caller's organization-wide memberships (`resolveCallerOrganizationIds`). The set retrieval narrows to\n * (`resolveRetrievalOrganizationIds`), which is what a tool treating its own unattributed output is judged against.\n */\n readonly possibleOwnerOrganizationIds: () => readonly string[];\n /**\n * #3369: `rows` rows of one call's result named no organization and nothing could derive whose they were, so they were\n * treated under the strictest policy. Recorded on the call's operation record. Must not throw.\n */\n readonly rowsOwnerNotDerived: (call: RecordOwnerToolCall, rows: number) => void;\n /**\n * The screen that screens rows whose owner asked when the call itself screens nothing (#3364): created once per call,\n * recording each withholding as the call's own screen does. When no classifier can serve, it answers `NOT_SCREENED`.\n * `undefined` where the environment declares its agents run unguarded and no classifier offers screening: the rows then\n * reach the model unscreened, as the call's own results do there.\n */\n readonly ownerScreen: () => ToolResultScreen | undefined;\n /**\n * #3364 step 3: told the policies of the organizations whose rows reached the model (beyond the call's own), as they\n * enter, so the reply can be judged under the strictest of them and the call's own. Must not throw.\n */\n readonly rowsReachedModelFrom: (tightenings: readonly FlowsActors_AgentContentGuardrailsTightening[]) => void;\n}\n\n/**\n * How the owner of a result row that names none can be known, from the tool's declaration (#3369). See the module header.\n */\nexport enum UnattributedRowOwnership {\n /**\n * Every access is `dispatchResourceOperationAsTool` (`PRINCIPAL_RESOURCE_OPERATION`), which records the owners of the rows\n * it returns: the row is one of theirs, provided every result named its owners (`ToolCallRecordOwners.complete`).\n */\n OBSERVED_DISPATCHES = 'observed_dispatches',\n /** The engine's retrieval tool: its search is confined to the caller's organizations, which are the possible owners. */\n RETRIEVAL_NARROWING = 'retrieval_narrowing',\n /** The tool declares that its rows carry `organizationId` (`rowsNameTheirOrganization`). A row that does not is not derivable. */\n ROWS_NAME_THEIR_ORGANIZATION = 'rows_name_their_organization',\n /** Nothing the engine sees can say: such a row is treated under the strictest policy. */\n NOT_DERIVABLE = 'not_derivable',\n}\n\n/**\n * How `tool`'s rows that name no organization are attributed (#3369). One reading of the declaration, shared by the\n * runtime and the startup report, so the two cannot disagree.\n */\nexport function unattributedRowOwnershipOf(tool: Pick<FunctionTool, 'authority' | 'retrievalSources' | 'personalDataOutput'>): UnattributedRowOwnership {\n if (tool.retrievalSources !== undefined && tool.retrievalSources.length > 0) return UnattributedRowOwnership.RETRIEVAL_NARROWING;\n if (tool.authority?.kind === FunctionToolAuthorityKind.PRINCIPAL_RESOURCE_OPERATION) return UnattributedRowOwnership.OBSERVED_DISPATCHES;\n if (tool.personalDataOutput?.kind === FunctionToolPersonalDataOutputKind.RECORDS_OF_RESOURCE && tool.personalDataOutput.rowsNameTheirOrganization === true) {\n return UnattributedRowOwnership.ROWS_NAME_THEIR_ORGANIZATION;\n }\n return UnattributedRowOwnership.NOT_DERIVABLE;\n}\n\n/** The tool call a result came from, and whether the call screens every result itself. */\nexport interface RecordOwnerToolCall {\n readonly toolCallId: string;\n readonly toolName: string;\n /** The call's own screen covers this result (its agent screens, and the result is not the person's own words). */\n readonly callScreensResult: boolean;\n /** #3369: how the owner of a row naming none is known, from the tool's declaration (`unattributedRowOwnershipOf`). */\n readonly unattributedRows: UnattributedRowOwnership;\n /** #3369: what the call's dispatches reached, when its `execute` was observed (`observingRecordOwners`). */\n readonly observedOwners?: ToolCallRecordOwners;\n}\n\n/**\n * The tightening an owner whose policy cannot be read is treated as asking for (fail closed): every guardrail at its\n * strictest. Also what a row whose owner cannot be derived is treated under (#3369).\n */\nexport const UNREADABLE_OWNER_TIGHTENING: FlowsActors_AgentContentGuardrailsTightening = Object.freeze({\n personalDataTreatment: RedactionType.REMOVE,\n promptInjectionScreening: FlowsActors_PromptInjectionScreeningScope.THIRD_PARTY_CONTENT,\n machineReadersKeepPlaceholders: true,\n outputModeration: Object.values(ContentSafety_HarmCategory).map((category) => ({ category, blockAtOrAbove: ContentSafety_HarmSeverity.LOW })),\n});\n\n/** The rows of a records result: `{ data: [...] }` or one record; `undefined` for anything else. */\nfunction recordsOf(output: unknown): unknown[] | undefined {\n if (output === null || output === undefined) return undefined;\n if (typeof output === 'object' && !Array.isArray(output) && Array.isArray((output as { data?: unknown }).data)) return (output as { data: unknown[] }).data;\n return typeof output === 'object' && !Array.isArray(output) ? [output] : undefined;\n}\n\n/** What each listed owner's policy tightens: its row (none = nothing), or {@link UNREADABLE_OWNER_TIGHTENING} when unreadable. */\nasync function ownerTightenings(owners: readonly string[], context: RecordOwnerPolicyContext): Promise<Map<string, FlowsActors_AgentContentGuardrailsTightening | undefined>> {\n const asked = new Map<string, FlowsActors_AgentContentGuardrailsTightening | undefined>();\n if (owners.length === 0) return asked;\n const lookup = await context.readPolicies(owners);\n for (const owner of owners) {\n asked.set(owner, lookup.unreadable !== undefined\n ? UNREADABLE_OWNER_TIGHTENING\n : lookup.policies.find((candidate) => (candidate as { organizationId?: string }).organizationId === owner));\n }\n return asked;\n}\n\n/**\n * The strictest of several organizations' tightenings, for a row that may be any of theirs (#3369): the strongest\n * treatment, placeholders kept from machine readers when any asks, screening when any screens, and every moderation entry\n * (the call's guard keeps the lower severity per category). `undefined` when none asks for anything.\n */\nfunction strictestOf(tightenings: readonly FlowsActors_AgentContentGuardrailsTightening[]): FlowsActors_AgentContentGuardrailsTightening | undefined {\n let treatment: FlowsActors_PersonalDataModelTreatment | undefined;\n for (const tightening of tightenings) {\n const candidate = tightening.personalDataTreatment ?? undefined;\n if (isStricterPersonalDataTreatment(candidate, treatment)) treatment = candidate;\n }\n const screening = tightenings.find((tightening) => tightening.promptInjectionScreening)?.promptInjectionScreening;\n const keep = tightenings.some((tightening) => tightening.machineReadersKeepPlaceholders === true);\n const moderation = tightenings.flatMap((tightening) => tightening.outputModeration ?? []);\n const strictest: FlowsActors_AgentContentGuardrailsTightening = {\n ...(treatment ? { personalDataTreatment: treatment } : {}),\n ...(screening ? { promptInjectionScreening: screening } : {}),\n ...(keep ? { machineReadersKeepPlaceholders: true } : {}),\n ...(moderation.length > 0 ? { outputModeration: moderation } : {}),\n };\n return Object.keys(strictest).length > 0 ? strictest : undefined;\n}\n\n/** What a result whose rows name no owner is treated under, and whether its owners were derived at all. */\ninterface UnattributedTreatment {\n /** The strictest of its possible owners' policies beyond the call's own; `undefined` when none asks for more. */\n readonly tightening: FlowsActors_AgentContentGuardrailsTightening | undefined;\n /** False when nothing could say whose it is: `tightening` is then {@link UNREADABLE_OWNER_TIGHTENING}. */\n readonly derived: boolean;\n}\n\n/**\n * The organizations a result naming no owner can belong to (#3369), from what the call observed and the tool declares;\n * `undefined` when nothing can say. Tools acting in an organization read only that tenant's rows.\n */\nfunction possibleOwnersOf(context: RecordOwnerPolicyContext, call: RecordOwnerToolCall): readonly string[] | undefined {\n if (context.actingOrganizationId !== undefined) return [context.actingOrganizationId];\n switch (call.unattributedRows) {\n // Complete only when every organization-owned result the call's dispatches returned named its owners.\n case UnattributedRowOwnership.OBSERVED_DISPATCHES: return call.observedOwners?.complete === true ? call.observedOwners.organizations() : undefined;\n case UnattributedRowOwnership.RETRIEVAL_NARROWING: return context.possibleOwnerOrganizationIds();\n case UnattributedRowOwnership.ROWS_NAME_THEIR_ORGANIZATION:\n case UnattributedRowOwnership.NOT_DERIVABLE:\n return undefined;\n }\n}\n\n/**\n * What an UNATTRIBUTED row (an organization-owned resource's row naming no owner, and none known for its id) is treated\n * under (#3369): the strictest policy of the organizations it can belong to (`possibleOwnersOf`) beyond those the call\n * covers, or every guardrail at its strictest when nothing can say. `requireOwners` says whether an empty possible set is\n * underivable (a row of an organization-owned resource is somebody's) or simply nobody's (a tool-treated result that\n * reached no organization's rows).\n */\nasync function unattributedTreatment(context: RecordOwnerPolicyContext, call: RecordOwnerToolCall, requireOwners: boolean): Promise<UnattributedTreatment> {\n const possible = possibleOwnersOf(context, call);\n if (possible === undefined || (requireOwners && possible.length === 0)) return { tightening: UNREADABLE_OWNER_TIGHTENING, derived: false };\n const covered = new Set(context.coveredOrganizationIds);\n const owners = [...new Set(possible)].filter((owner) => !covered.has(owner)).sort();\n const asked = [...(await ownerTightenings(owners, context)).values()].filter((policy): policy is FlowsActors_AgentContentGuardrailsTightening => policy !== undefined);\n return { tightening: strictestOf(asked), derived: true };\n}\n\n/**\n * The model-side rows at `indices`, screened together through the owner screen (#3364): unchanged when clean, each\n * replaced by the withheld notice otherwise. One request for all of them, so a page of rows costs one screening.\n */\nasync function screenOwnerRows(\n rows: unknown[], indices: readonly number[], context: RecordOwnerPolicyContext, call: RecordOwnerToolCall,\n): Promise<{ readonly rows: unknown[]; readonly withheld: ReadonlySet<number> }> {\n if (indices.length === 0) return { rows, withheld: new Set() };\n // The real tool call id: the owner screen is its own instance and a result goes through one screen or the other, so the\n // verdict, the audit row and the operation record all name the call the result belongs to.\n // Withheld is the screen's own answer, never inferred from the output (#3364 review R2): a clean string result is `text`\n // too, and a record could even hold a notice's words.\n const screen = context.ownerScreen();\n if (screen === undefined) return { rows, withheld: new Set() };\n const { output, withheld } = await screen.screened(call.toolCallId, call.toolName, indices.map((index) => rows[index]));\n if (!withheld) return { rows, withheld: new Set() };\n const screened = [...rows];\n for (const index of indices) screened[index] = output.value;\n return { rows: screened, withheld: new Set(indices) };\n}\n\n/**\n * The result of a tool returning records of `resourceType`, as the model may read it: each row under the stricter of the\n * call's treatment (`callGuard`, absent for an unguarded call) and the treatment its owning organization asked for,\n * with its placeholders kept from machine readers when the owner asked, and screened when the owner screens and the call\n * does not (#3364). Side effect: tells `context.rowsReachedModelFrom` the owners of the rows that reached the model, so\n * the call's moderation is tightened. Equal to `treatRecordsResult` when every row's owner is one the call works for, and\n * to `output` itself on an unguarded call whose rows need nothing.\n */\nexport async function treatRecordsResultByOwner(\n output: unknown,\n resourceType: string,\n callGuard: PersonalDataGuard | undefined,\n context: RecordOwnerPolicyContext,\n call: RecordOwnerToolCall,\n): Promise<unknown> {\n const callOnly = () => (callGuard ? treatRecordsResult(output, callGuard, resourceType) : output);\n if (output === null || output === undefined || !context.isOrganizationOwned(resourceType)) return callOnly();\n const actsInNoOrganization = context.actingOrganizationId === undefined;\n const records = recordsOf(output);\n if (!records) {\n // Not a record and not `{ data: [...] }`: its rows cannot be attributed. A guarded call withholds it whole already;\n // an unguarded one acting in no organization does too, since nobody can say whose rows they are.\n // Withheld whole, it carries nothing a screen would read.\n return callGuard ? callOnly() : (actsInNoOrganization ? context.ownerGuard().withholdWhole() : output);\n }\n\n const covered = new Set(context.coveredOrganizationIds);\n // #3369: the row's own scope field, else the owner a dispatch of this call recorded for the row's id.\n const ownerOfRow = (record: unknown): string | undefined => {\n const named = context.ownerOf(resourceType, record);\n if (named !== undefined) return named;\n const id = recordIdOf(record);\n return id === undefined ? undefined : call.observedOwners?.ownerOfRecord(resourceType, id);\n };\n const owners = records.map(ownerOfRow);\n const uncovered = [...new Set(owners.filter((owner): owner is string => owner !== undefined && !covered.has(owner)))].sort();\n const unattributedRows = actsInNoOrganization ? owners.filter((owner) => owner === undefined).length : 0;\n if (uncovered.length === 0 && unattributedRows === 0) return callOnly();\n\n const asked = await ownerTightenings(uncovered, context);\n const unattributed = unattributedRows > 0 ? await unattributedTreatment(context, call, true) : undefined;\n if (unattributed && !unattributed.derived) context.rowsOwnerNotDerived(call, unattributedRows);\n /** What the row's owner asks beyond the call: `undefined` for a row of an organization the call already works for. */\n const tighteningOf = (record: unknown, index: number): FlowsActors_AgentContentGuardrailsTightening | undefined => {\n const owner = owners[index];\n // A row naming no owner read by tools acting in no organization: the strictest of whoever it can belong to.\n if (owner === undefined) return actsInNoOrganization ? unattributed?.tightening : undefined;\n return covered.has(owner) ? undefined : asked.get(owner);\n };\n\n const treatRow = (record: unknown, index: number): unknown => {\n const tightening = tighteningOf(record, index);\n const treatment: FlowsActors_PersonalDataModelTreatment | undefined = tightening?.personalDataTreatment ?? undefined;\n // #3364 step 2: a placeholder minted for this row is kept from machine readers when its owner asked.\n const keptFromMachineReaders = tightening?.machineReadersKeepPlaceholders === true;\n if (treatment === undefined) {\n return callGuard ? callGuard.treatRecord(record, callGuard.personalFieldsOf(resourceType), undefined, callGuard.treatment, keptFromMachineReaders) : record;\n }\n // An unguarded call puts no placeholder back, so it withholds instead (see the module header).\n const guard = callGuard ?? context.ownerGuard();\n return guard.treatRecord(record, guard.personalFieldsOf(resourceType), undefined, callGuard ? treatment : RedactionType.REMOVE, keptFromMachineReaders);\n };\n\n // Screened after the treatment, so a classifier reads placeholders, never values (as the call's own screen does).\n const screenIndices = call.callScreensResult ? [] : records.map((record, index) => (tighteningOf(record, index)?.promptInjectionScreening ? index : -1)).filter((index) => index >= 0);\n const { rows: treated, withheld } = await screenOwnerRows(records.map(treatRow), screenIndices, context, call);\n\n // #3364 step 3: the rows that reached the model (a row only stripped of personal fields did; one replaced by the\n // screen's notice did not), so their owners' moderation applies to the reply from the next step on.\n context.rowsReachedModelFrom(records\n .map((record, index) => (withheld.has(index) ? undefined : tighteningOf(record, index)))\n .filter((tightening): tightening is FlowsActors_AgentContentGuardrailsTightening => tightening !== undefined));\n\n if (!Array.isArray(output) && Array.isArray((output as { data?: unknown }).data)) {\n return { ...(output as object), data: treated };\n }\n return treated[0];\n}\n\n/**\n * The result of a tool that treats its own output (`TREATED_BY_TOOL`, retrieval), whose rows do not say which organization\n * owns them: on an unguarded call, treated through `treat` and the call's owner guard when any organization it can belong\n * to (`possibleOwnersOf`) and the call does not already cover asked for a treatment (the strictest of several possible\n * owners is never looser than the actual one). Unreadable is treated as asking (fail closed), and a tool whose possible\n * owners nothing can say is treated under the strictest policy, counted as one result (#3369). A guarded call is treated by its own\n * guard, as before: the retrieval tool's treatment withholds a personal passage whole under any treatment. Screened\n * whole when a possible owner screens and the call does not; when it reached the model, tells\n * `context.rowsReachedModelFrom` every possible owner's policy (#3364).\n */\nexport async function treatToolTreatedResultByPossibleOwners(\n output: unknown,\n treat: (output: unknown, guard: PersonalDataGuard) => unknown,\n callGuard: PersonalDataGuard | undefined,\n context: RecordOwnerPolicyContext,\n call: RecordOwnerToolCall,\n): Promise<unknown> {\n // #3369: its possible owners from what the call observed and the tool declares; strictest when nothing can say.\n const { tightening, derived } = await unattributedTreatment(context, call, false);\n if (!derived) context.rowsOwnerNotDerived(call, 1);\n const tightenings = tightening ? [tightening] : [];\n const treated = callGuard\n ? treat(output, callGuard)\n : tightenings.some((tightening) => tightening.personalDataTreatment) ? treat(output, context.ownerGuard()) : output;\n // Its rows name no owner, so the whole result is screened when any possible owner asked.\n if (!call.callScreensResult && tightenings.some((tightening) => tightening.promptInjectionScreening)) {\n const screen = context.ownerScreen();\n const { output, withheld } = screen === undefined\n ? { output: { value: treated }, withheld: false }\n : await screen.screened(call.toolCallId, call.toolName, treated);\n // Withheld whole: nothing of it reached the model, so nothing tightens the reply.\n if (withheld) return output.value;\n }\n // #3364 step 3: its rows name no owner, so every possible owner's moderation applies to the reply.\n context.rowsReachedModelFrom(tightenings);\n return treated;\n}\n\n/** One tool whose returned rows' owners the engine cannot derive (#3369), and the agents offered it. */\nexport interface ToolWithUnderivableRowOwners {\n readonly functionRef: string;\n /** The records it returns, for a `RECORDS_OF_RESOURCE` tool; absent for a tool that treats its own output. */\n readonly resourceType?: string;\n /** The ACTIVE language-model agents offered it, sorted. */\n readonly agentRefs: readonly string[];\n}\n\n/**\n * The boot report (#3369): every tool offered to an ACTIVE language-model agent whose result rows of an\n * organization-owned resource the engine cannot attribute when they name no organization (`NOT_DERIVABLE` in\n * `unattributedRowOwnershipOf`). One WARN per tool, naming it, its resource, the agents offered it, what happens to such\n * a row, and the remedy. Returns the findings; NEVER throws, because a diagnostic must never be why startup fails (the\n * remedy is an edit to the tool, and every other tool runs as before).\n *\n * Total over what is registered: it reads the agents, their tools and each tool's resource scope live, so a tool or a\n * resource added tomorrow is reported by the same run. Not reported, because their owners are derived: an\n * application-owned resource (no organization's policy applies), a tool whose every access is a dispatch (each records\n * its rows' owners), the engine's retrieval tool (its search is confined to the caller's organizations), and a tool\n * declaring `rowsNameTheirOrganization` (each row is checked at run time). A dispatching tool is attributed only as far\n * as its dispatches' results name their owners, which no declaration says in advance: one whose operation answers\n * without them (a custom operation's answer) is treated under the strictest policy and counted on the operation record\n * at run time, not here. A WARN, not a refusal: the rows are still\n * treated, under the strictest policy, and an agent acting IN an organization never meets the case.\n */\nexport function reportToolsWhoseRowOwnersCannotBeDerived(input: {\n /** The registered agents. A function, so a registry that cannot be read is reported here rather than thrown at startup. */\n readonly readAgents: () => readonly FlowsActors_Agent[];\n readonly readFunctionTool: (functionRef: string) => FunctionTool | undefined;\n /** Whether a resource's rows belong to an organization; an unregistered resource counts as one (fail closed). */\n readonly isOrganizationOwned: (resourceType: string) => boolean;\n readonly logger: Pick<LoggerService, 'warn' | 'debug'>;\n}): ToolWithUnderivableRowOwners[] {\n try {\n const offeredTo = new Map<string, Set<string>>();\n for (const agent of input.readAgents()) {\n if (agent.status !== FlowsActors_Agent_Status.ACTIVE || !isLLMAgentConfiguration(agent.config)) continue;\n for (const functionRef of agent.capabilities?.tools?.functionRefs ?? []) {\n offeredTo.set(functionRef, (offeredTo.get(functionRef) ?? new Set()).add(agent.ref));\n }\n }\n const findings: ToolWithUnderivableRowOwners[] = [];\n for (const [functionRef, agents] of [...offeredTo.entries()].sort(([a], [b]) => a.localeCompare(b))) {\n const tool = input.readFunctionTool(functionRef);\n const output = tool?.personalDataOutput;\n if (!tool || !output || output.kind === FunctionToolPersonalDataOutputKind.NOT_FROM_RECORDS) continue;\n if (output.kind === FunctionToolPersonalDataOutputKind.RECORDS_OF_RESOURCE && !input.isOrganizationOwned(output.resourceType)) continue;\n if (unattributedRowOwnershipOf(tool) !== UnattributedRowOwnership.NOT_DERIVABLE) continue;\n const resourceType = output.kind === FunctionToolPersonalDataOutputKind.RECORDS_OF_RESOURCE ? output.resourceType : undefined;\n const finding: ToolWithUnderivableRowOwners = { functionRef, ...(resourceType ? { resourceType } : {}), agentRefs: [...agents].sort() };\n findings.push(finding);\n input.logger.warn(describeToolWithUnderivableRowOwners(finding), { ...finding });\n }\n if (findings.length === 0) {\n input.logger.debug('Every agent tool returning records of an organization-owned resource names, or lets the engine derive, the organization of each row');\n }\n return findings;\n } catch (error) {\n // WARN, not debug: a report that did not run says nothing, and silence here reads as \"every row owner is derived\".\n input.logger.warn('The tool row-owner report could not run, so tools whose rows are treated under the strictest policy may be unreported',\n projectCaughtErrorLogFields(error));\n return [];\n }\n}\n\n/** The WARN line for one tool: what it returns, what happens to a row naming no organization, and the two remedies. */\nfunction describeToolWithUnderivableRowOwners(finding: ToolWithUnderivableRowOwners): string {\n const returns = finding.resourceType ? `returns \"${finding.resourceType}\" records` : 'treats its own output';\n return `Tool '${finding.functionRef}' ${returns} and reaches them without dispatchResourceOperationAsTool, so the engine cannot `\n + `tell whose a returned row is when the row names no organization. Read by an agent acting in no organization `\n + `(${finding.agentRefs.join(', ')}), such a row reaches the model under the strictest agent policy (personal data `\n + `withheld, screened, its reply moderated in every category), and is counted on the call's operation record. `\n + (finding.resourceType ? `Return each row's organizationId and declare personalDataOutput.rowsNameTheirOrganization, or reach ` : 'Reach ')\n + `the rows through dispatchResourceOperationAsTool and declare the PRINCIPAL_RESOURCE_OPERATION authority.`;\n}\n"]}
@@ -358,6 +358,42 @@ export interface FunctionTool {
358
358
  * has no top-level string argument of that name. A tool without it is unaffected.
359
359
  */
360
360
  deliverableFileArgument?: string;
361
+ /**
362
+ * The fields of the row the call acts on that the approval COVERS (#2914): the record's SEALED FIELD SET. Declare it
363
+ * on an approval-gated tool whose approval is a statement about a record's values (a month's figures signed off, an
364
+ * invoice's amounts approved), so that whether the approval still holds can be answered later:
365
+ *
366
+ * - the decision's card shows these values of the row named by `argumentsResource.rowIdArgument`, read as the system
367
+ * when the card is built, so the person approves what they read; a card read before one of them changed is refused
368
+ * as stale;
369
+ * - the approval's seal commits to them inside its presentation, and the currency check
370
+ * (`approvalSealSubjectCurrencyOf`, the operator door `POST /internal/admin/approval-seals/currency`, and
371
+ * `wildo seal verify --subject-record`) compares them with the record as it is: CURRENT right after the approval,
372
+ * NO_LONGER_CURRENT once one of them changes.
373
+ *
374
+ * Name only what the approval is ABOUT. Never a lifecycle or approval field (a status, `updatedAt`, the column the
375
+ * approved call writes the seal's id or the signer into): the approved call's own write would otherwise make its own
376
+ * seal look stale. A row of another organization than the decision's, or one that cannot be read, is shown and sealed
377
+ * with no record values, and so is an answer given on a chat card: no notice card shows the row, so its SENT seal
378
+ * claims none of it (its currency reads NO_SEALED_FIELD_SET).
379
+ *
380
+ * Registration refuses it on a tool that is not approval-gated, on a question tool, without
381
+ * `argumentsResource.rowIdArgument`, and when it names no field, a field twice, or a field the resource's main schema
382
+ * does not declare (checked when the resource is registered).
383
+ */
384
+ sealedRecordFields?: readonly string[];
385
+ /**
386
+ * An approval of this tool on a row REPLACES the latest earlier approval of this tool on the same row (#2914): its seal
387
+ * names that earlier seal as the one it supersedes, as a decision answered again supersedes its own earlier seal. For a
388
+ * decision that is taken again on the same record after the record was reopened (a month signed off, reopened and
389
+ * signed off again): the two are different decisions, and without this the second seal names no predecessor, so a
390
+ * verifier sees two approvals of one record and nothing saying which one stands.
391
+ *
392
+ * Only the latest seal of the same source, the same record (`argumentsResource.rowIdArgument`) and the same tool is
393
+ * superseded, never an approval made through another tool on that row; a decision answered again still supersedes its
394
+ * own earlier answer first. Requires an approval gate and `argumentsResource.rowIdArgument`.
395
+ */
396
+ approvalReplacesEarlierApprovalOfRow?: boolean;
361
397
  /**
362
398
  * The electronic signature the file deliverable needs once the person approved it (#2293): after the approval's seal is
363
399
  * SEALED, the engine sends the approved file (`deliverableFileArgument`, bound by its hash) to the vendor selected for
@@ -808,6 +844,13 @@ export declare function functionToolElectronicSignatureDeclarationProblems(tool:
808
844
  * (after `bindToResources`), so the argument the engine binds is the one the model is offered.
809
845
  */
810
846
  export declare function functionToolDeliverableDeclarationProblems(tool: Pick<FunctionTool, 'functionRef' | 'deliverableFileArgument' | 'inputSchema' | 'requiresHumanApproval' | 'humanApproval' | 'asksThePerson'>): string[];
847
+ /**
848
+ * What is wrong with a tool's record-approval declarations (`sealedRecordFields`, `approvalReplacesEarlierApprovalOfRow`,
849
+ * #2914), one sentence per problem with its remedy; empty when they are sound or absent. `declaredFieldsOf` answers the
850
+ * fields the resource's main schema declares, or undefined when the resource is not registered (its fields are then not
851
+ * checked here: a field the row does not hold is shown and sealed as absent).
852
+ */
853
+ export declare function functionToolRecordApprovalDeclarationProblems(tool: Pick<FunctionTool, 'functionRef' | 'sealedRecordFields' | 'approvalReplacesEarlierApprovalOfRow' | 'argumentsResource' | 'requiresHumanApproval' | 'humanApproval' | 'asksThePerson'>, declaredFieldsOf?: (resourceType: string) => readonly string[] | undefined): string[];
811
854
  /**
812
855
  * The name a `functionRef` is exposed to the model under.
813
856
  *
@@ -1 +1 @@
1
- {"version":3,"file":"function-tools.backend.definitions.d.ts","sourceRoot":"","sources":["../../../../src/flows-actors/models/function-tools.backend.definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,KAAK,sCAAsC,EAC3C,KAAK,kCAAkC,EACvC,qBAA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IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACjG,YAAY,CAmLd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,qBAAqB,CAAC,MAAM,GAAG,qBAAqB,CAAC,MAAM,EAC/D,OAAO,EAAE;IACP,WAAW,EAAE,CAAC,CAAC,UAAU,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;OAQG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,0FAA0F;IAC1F,aAAa,CAAC,EAAE,8BAA8B,CAAC;CAChD,GACA,YAAY,CA4Ed"}
1
+ {"version":3,"file":"function-tools.backend.definitions.d.ts","sourceRoot":"","sources":["../../../../src/flows-actors/models/function-tools.backend.definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,KAAK,sCAAsC,EAC3C,KAAK,kCAAkC,EACvC,qBAAqB,EAMrB,KAAK,YAAY,EACjB,KAAK,+BAA+B,EAKpC,KAAK,0BAA0B,EAC/B,uBAAuB,EAEvB,KAAK,gCAAgC,EACrC,qBAAqB,EACrB,0BAA0B,EAC1B,0BAA0B,EAE1B,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EAKpC,KAAK,WAAW,EAUhB,KAAK,wBAAwB,EAC7B,2BAA2B,EAC3B,wBAAwB,EACxB,sBAAsB,EAIvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,yBAAyB,EAAE,MAAM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B,CAC9B,YAAY,EAAE,YAAY,EAC1B,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACjG,YAAY,CAmLd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,qBAAqB,CAAC,MAAM,GAAG,qBAAqB,CAAC,MAAM,EAC/D,OAAO,EAAE;IACP,WAAW,EAAE,CAAC,CAAC,UAAU,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;OAQG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,0FAA0F;IAC1F,aAAa,CAAC,EAAE,8BAA8B,CAAC;CAChD,GACA,YAAY,CA4Ed"}
@@ -378,6 +378,43 @@ export function functionToolDeliverableDeclarationProblems(tool) {
378
378
  }
379
379
  return problems;
380
380
  }
381
+ /**
382
+ * What is wrong with a tool's record-approval declarations (`sealedRecordFields`, `approvalReplacesEarlierApprovalOfRow`,
383
+ * #2914), one sentence per problem with its remedy; empty when they are sound or absent. `declaredFieldsOf` answers the
384
+ * fields the resource's main schema declares, or undefined when the resource is not registered (its fields are then not
385
+ * checked here: a field the row does not hold is shown and sealed as absent).
386
+ */
387
+ export function functionToolRecordApprovalDeclarationProblems(tool, declaredFieldsOf) {
388
+ const fields = tool.sealedRecordFields;
389
+ const replaces = tool.approvalReplacesEarlierApprovalOfRow === true;
390
+ if (fields === undefined && !replaces)
391
+ return [];
392
+ const problems = [];
393
+ const named = `Function tool "${tool.functionRef}" declares ${fields !== undefined ? 'sealedRecordFields' : 'approvalReplacesEarlierApprovalOfRow'}`;
394
+ if (!tool.humanApproval && !tool.requiresHumanApproval) {
395
+ problems.push(`${named} and is not approval-gated: it describes what an approval covers, so gate it (humanApproval or requiresHumanApproval).`);
396
+ }
397
+ if (tool.asksThePerson)
398
+ problems.push(`${named} and asks the person: a question approves no record.`);
399
+ if (!tool.argumentsResource?.rowIdArgument) {
400
+ problems.push(`${named} without argumentsResource.rowIdArgument: name the argument holding the id of the row the approval is about.`);
401
+ }
402
+ if (fields !== undefined) {
403
+ if (!Array.isArray(fields) || fields.length === 0 || fields.some((field) => typeof field !== 'string' || field.trim().length === 0)) {
404
+ problems.push(`${named}, which names no field: list the fields of the row the approval covers.`);
405
+ }
406
+ else {
407
+ const duplicated = fields.filter((field, index) => fields.indexOf(field) !== index);
408
+ if (duplicated.length > 0)
409
+ problems.push(`${named}, which names ${[...new Set(duplicated)].join(', ')} more than once.`);
410
+ const declared = tool.argumentsResource ? declaredFieldsOf?.(tool.argumentsResource.resourceType) : undefined;
411
+ const unknown = declared ? fields.filter((field) => !declared.includes(field)) : [];
412
+ if (unknown.length > 0)
413
+ problems.push(`${named}, naming ${unknown.join(', ')}, which ${tool.argumentsResource.resourceType} does not declare.`);
414
+ }
415
+ }
416
+ return problems;
417
+ }
381
418
  /** Whether an argument schema is a string once its optional, nullable and default wrappers are removed. */
382
419
  function isStringArgumentSchema(schema) {
383
420
  let current = schema;