@jini-ai/user-management 0.7.3-next.1 → 0.7.3-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (378) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +55 -2
  3. package/dist/admin/adapters/memory.js +4 -4
  4. package/dist/admin-http/auth/auth-request.d.ts +112 -0
  5. package/dist/admin-http/auth/auth-request.js +32 -0
  6. package/dist/admin-http/auth/boot-redemption.d.ts +9 -0
  7. package/dist/admin-http/auth/boot-redemption.js +17 -0
  8. package/dist/admin-http/auth/boot-session.d.ts +30 -0
  9. package/dist/admin-http/auth/boot-session.js +40 -0
  10. package/dist/admin-http/auth/current-user.d.ts +28 -0
  11. package/dist/admin-http/auth/current-user.js +34 -0
  12. package/dist/admin-http/auth/index.d.ts +17 -0
  13. package/dist/admin-http/auth/index.js +9 -0
  14. package/dist/admin-http/auth/local-boot-session.d.ts +9 -0
  15. package/dist/admin-http/auth/local-boot-session.js +30 -0
  16. package/dist/admin-http/auth/logout.d.ts +10 -0
  17. package/dist/admin-http/auth/logout.js +17 -0
  18. package/dist/admin-http/auth/mfa-login.d.ts +30 -0
  19. package/dist/admin-http/auth/mfa-login.js +43 -0
  20. package/dist/admin-http/auth/password-login.d.ts +35 -0
  21. package/dist/admin-http/auth/password-login.js +52 -0
  22. package/dist/admin-http/auth/password-status.d.ts +34 -0
  23. package/dist/admin-http/auth/password-status.js +42 -0
  24. package/dist/admin-http/http/api-keys.d.ts +45 -0
  25. package/dist/admin-http/http/api-keys.js +28 -0
  26. package/dist/admin-http/http/users.d.ts +71 -0
  27. package/dist/admin-http/http/users.js +42 -0
  28. package/dist/admin-http/owner/mfa-deps.d.ts +41 -0
  29. package/dist/admin-http/owner/mfa-deps.js +26 -0
  30. package/dist/admin-http/owner/mfa-routes.d.ts +72 -0
  31. package/dist/admin-http/owner/mfa-routes.js +105 -0
  32. package/dist/admin-http/owner/passkey-admission.d.ts +46 -0
  33. package/dist/admin-http/owner/passkey-admission.js +23 -0
  34. package/dist/admin-http/owner/passkey-route-deps.d.ts +53 -0
  35. package/dist/admin-http/owner/passkey-route-deps.js +33 -0
  36. package/dist/admin-http/owner/passkey-routes.d.ts +146 -0
  37. package/dist/admin-http/owner/passkey-routes.js +98 -0
  38. package/dist/admin-http/owner/recovery-routes.d.ts +71 -0
  39. package/dist/admin-http/owner/recovery-routes.js +112 -0
  40. package/dist/admin-http/routes/api-keys/create-principal.d.ts +26 -0
  41. package/dist/admin-http/routes/api-keys/create-principal.js +37 -0
  42. package/dist/admin-http/routes/api-keys/issue.d.ts +32 -0
  43. package/dist/admin-http/routes/api-keys/issue.js +38 -0
  44. package/dist/admin-http/routes/api-keys/revoke.d.ts +26 -0
  45. package/dist/admin-http/routes/api-keys/revoke.js +31 -0
  46. package/dist/admin-http/routes/api-keys/shared.d.ts +46 -0
  47. package/dist/admin-http/routes/api-keys/shared.js +38 -0
  48. package/dist/admin-http/routes/users/access-shared.d.ts +103 -0
  49. package/dist/admin-http/routes/users/access-shared.js +85 -0
  50. package/dist/admin-http/routes/users/assign-role.d.ts +24 -0
  51. package/dist/admin-http/routes/users/assign-role.js +30 -0
  52. package/dist/admin-http/routes/users/attach-policy.d.ts +25 -0
  53. package/dist/admin-http/routes/users/attach-policy.js +31 -0
  54. package/dist/admin-http/routes/users/create-policy.d.ts +19 -0
  55. package/dist/admin-http/routes/users/create-policy.js +28 -0
  56. package/dist/admin-http/routes/users/create-role.d.ts +15 -0
  57. package/dist/admin-http/routes/users/create-role.js +21 -0
  58. package/dist/admin-http/routes/users/create.d.ts +32 -0
  59. package/dist/admin-http/routes/users/create.js +67 -0
  60. package/dist/admin-http/routes/users/delete-policy.d.ts +16 -0
  61. package/dist/admin-http/routes/users/delete-policy.js +24 -0
  62. package/dist/admin-http/routes/users/delete-role.d.ts +16 -0
  63. package/dist/admin-http/routes/users/delete-role.js +24 -0
  64. package/dist/admin-http/routes/users/delete.d.ts +35 -0
  65. package/dist/admin-http/routes/users/delete.js +35 -0
  66. package/dist/admin-http/routes/users/disable.d.ts +31 -0
  67. package/dist/admin-http/routes/users/disable.js +38 -0
  68. package/dist/admin-http/routes/users/enable.d.ts +32 -0
  69. package/dist/admin-http/routes/users/enable.js +45 -0
  70. package/dist/admin-http/routes/users/list-policies.d.ts +18 -0
  71. package/dist/admin-http/routes/users/list-policies.js +20 -0
  72. package/dist/admin-http/routes/users/list-policy-permissions.d.ts +28 -0
  73. package/dist/admin-http/routes/users/list-policy-permissions.js +30 -0
  74. package/dist/admin-http/routes/users/list-roles.d.ts +18 -0
  75. package/dist/admin-http/routes/users/list-roles.js +20 -0
  76. package/dist/admin-http/routes/users/list.d.ts +40 -0
  77. package/dist/admin-http/routes/users/list.js +82 -0
  78. package/dist/admin-http/routes/users/remove-policy-permission.d.ts +48 -0
  79. package/dist/admin-http/routes/users/remove-policy-permission.js +62 -0
  80. package/dist/admin-http/routes/users/reset-password.d.ts +33 -0
  81. package/dist/admin-http/routes/users/reset-password.js +52 -0
  82. package/dist/admin-http/routes/users/shared.d.ts +124 -0
  83. package/dist/admin-http/routes/users/shared.js +93 -0
  84. package/dist/admin-http/routes/users/update-policy.d.ts +25 -0
  85. package/dist/admin-http/routes/users/update-policy.js +30 -0
  86. package/dist/admin-http/routes/users/update-role.d.ts +23 -0
  87. package/dist/admin-http/routes/users/update-role.js +29 -0
  88. package/dist/admin-http/routes/users/update.d.ts +35 -0
  89. package/dist/admin-http/routes/users/update.js +78 -0
  90. package/dist/admin-http/routes/users/write-policy-permission.d.ts +31 -0
  91. package/dist/admin-http/routes/users/write-policy-permission.js +45 -0
  92. package/dist/core/ports.d.ts +22 -3
  93. package/dist/core/types.d.ts +17 -5
  94. package/dist/core/types.js +12 -0
  95. package/dist/identity/api-key-secret.d.ts +68 -0
  96. package/dist/identity/api-key-secret.js +229 -0
  97. package/dist/identity/api-key-service.d.ts +144 -0
  98. package/dist/identity/api-key-service.js +389 -0
  99. package/dist/identity/api-key-types.d.ts +79 -0
  100. package/dist/identity/api-key-types.js +2 -0
  101. package/dist/identity/boot-session-token.d.ts +18 -0
  102. package/dist/identity/boot-session-token.js +92 -0
  103. package/dist/identity/builtin-role-grants.d.ts +120 -0
  104. package/dist/identity/builtin-role-grants.js +88 -0
  105. package/dist/identity/delete-user-service.d.ts +195 -0
  106. package/dist/identity/delete-user-service.js +275 -0
  107. package/dist/identity/owner-reset-env.d.ts +37 -0
  108. package/dist/identity/owner-reset-env.js +38 -0
  109. package/dist/identity/permission-grants.d.ts +31 -0
  110. package/dist/identity/permission-grants.js +12 -0
  111. package/dist/identity/permission-list-tool.d.ts +35 -0
  112. package/dist/identity/permission-list-tool.js +47 -0
  113. package/dist/identity/repo.authentication.d.ts +57 -0
  114. package/dist/identity/repo.authentication.js +153 -0
  115. package/dist/identity/repo.authorization.d.ts +82 -0
  116. package/dist/identity/repo.authorization.js +203 -0
  117. package/dist/identity/repo.d.ts +87 -0
  118. package/dist/identity/repo.js +167 -0
  119. package/dist/identity/repo.memory.d.ts +31 -0
  120. package/dist/identity/repo.memory.js +37 -0
  121. package/dist/identity/role-manage-permission.d.ts +34 -0
  122. package/dist/identity/role-manage-permission.js +39 -0
  123. package/dist/identity/site-key-permission.d.ts +66 -0
  124. package/dist/identity/site-key-permission.js +92 -0
  125. package/dist/identity/sql/kernel-user-purge.d.ts +19 -0
  126. package/dist/identity/sql/kernel-user-purge.js +34 -0
  127. package/dist/identity/sql/kernel-user-trash-store.d.ts +15 -0
  128. package/dist/identity/sql/kernel-user-trash-store.js +41 -0
  129. package/dist/identity/sql/user-trash-adapter.d.ts +87 -0
  130. package/dist/identity/sql/user-trash-adapter.js +124 -0
  131. package/dist/identity/tool-registrations.d.ts +100 -0
  132. package/dist/identity/tool-registrations.js +257 -0
  133. package/dist/identity/user-manage-permission.d.ts +8 -0
  134. package/dist/identity/user-manage-permission.js +8 -0
  135. package/dist/identity/user-purge-types.d.ts +85 -0
  136. package/dist/identity/user-purge-types.js +17 -0
  137. package/dist/identity/user-purge.d.ts +69 -0
  138. package/dist/identity/user-purge.js +46 -0
  139. package/dist/identity/username-change-ports.d.ts +15 -0
  140. package/dist/identity/username-change-ports.js +22 -0
  141. package/dist/mail/site/capture-clear.d.ts +58 -0
  142. package/dist/mail/site/capture-clear.js +21 -0
  143. package/dist/mail/status/agent-tools.d.ts +65 -0
  144. package/dist/mail/status/agent-tools.js +22 -0
  145. package/dist/mail/status/delivery-agent-tools.d.ts +206 -0
  146. package/dist/mail/status/delivery-agent-tools.js +63 -0
  147. package/dist/mail/status/delivery-tool-registrations.d.ts +216 -0
  148. package/dist/mail/status/delivery-tool-registrations.js +110 -0
  149. package/dist/mail/status/domain-deps.d.ts +25 -0
  150. package/dist/mail/status/domain-deps.js +23 -0
  151. package/dist/mail/status/permissions.d.ts +43 -0
  152. package/dist/mail/status/permissions.js +45 -0
  153. package/dist/mail/status/provider-agent-tools.d.ts +38 -0
  154. package/dist/mail/status/provider-agent-tools.js +17 -0
  155. package/dist/mail/status/provider-operations.d.ts +166 -0
  156. package/dist/mail/status/provider-operations.js +121 -0
  157. package/dist/mail/status/provider-tool-registrations.d.ts +65 -0
  158. package/dist/mail/status/provider-tool-registrations.js +106 -0
  159. package/dist/mail/status/tool-registrations.d.ts +152 -0
  160. package/dist/mail/status/tool-registrations.js +112 -0
  161. package/dist/member-login/credentials.d.ts +40 -0
  162. package/dist/member-login/credentials.js +26 -0
  163. package/dist/member-login/link-service.d.ts +66 -0
  164. package/dist/member-login/link-service.js +141 -0
  165. package/dist/member-login/oidc-login.d.ts +132 -0
  166. package/dist/member-login/oidc-login.js +206 -0
  167. package/dist/member-login/oidc-request.d.ts +80 -0
  168. package/dist/member-login/oidc-request.js +86 -0
  169. package/dist/member-login/providers.d.ts +79 -0
  170. package/dist/member-login/providers.js +41 -0
  171. package/dist/member-login/ready-providers.d.ts +17 -0
  172. package/dist/member-login/ready-providers.js +11 -0
  173. package/dist/member-login/unlink-identity.d.ts +26 -0
  174. package/dist/member-login/unlink-identity.js +59 -0
  175. package/dist/members/access-resolver.d.ts +107 -0
  176. package/dist/members/access-resolver.js +231 -0
  177. package/dist/members/agent-tools.d.ts +14 -0
  178. package/dist/members/agent-tools.js +139 -0
  179. package/dist/members/auth-mail.d.ts +27 -0
  180. package/dist/members/auth-mail.js +21 -0
  181. package/dist/members/capability-card.d.ts +18 -0
  182. package/dist/members/capability-card.js +27 -0
  183. package/dist/members/consent-service.d.ts +115 -0
  184. package/dist/members/consent-service.js +179 -0
  185. package/dist/members/member-admin-writes.d.ts +73 -0
  186. package/dist/members/member-admin-writes.js +149 -0
  187. package/dist/members/member-challenge-request.d.ts +59 -0
  188. package/dist/members/member-challenge-request.js +145 -0
  189. package/dist/members/member-challenge.d.ts +37 -0
  190. package/dist/members/member-challenge.js +84 -0
  191. package/dist/members/member-credentials.d.ts +35 -0
  192. package/dist/members/member-credentials.js +57 -0
  193. package/dist/members/member-sign-in.d.ts +44 -0
  194. package/dist/members/member-sign-in.js +130 -0
  195. package/dist/members/member-validation.d.ts +5 -0
  196. package/dist/members/member-validation.js +13 -0
  197. package/dist/members/password-auth.d.ts +55 -0
  198. package/dist/members/password-auth.js +177 -0
  199. package/dist/members/ports.d.ts +455 -0
  200. package/dist/members/ports.js +21 -0
  201. package/dist/members/public-member-auth-response.d.ts +68 -0
  202. package/dist/members/public-member-auth-response.js +45 -0
  203. package/dist/members/public-member-response.d.ts +25 -0
  204. package/dist/members/public-member-response.js +15 -0
  205. package/dist/members/repo.d.ts +199 -0
  206. package/dist/members/repo.js +324 -0
  207. package/dist/members/repo.memory.d.ts +276 -0
  208. package/dist/members/repo.memory.js +395 -0
  209. package/dist/members/repo.rows.d.ts +153 -0
  210. package/dist/members/repo.rows.js +250 -0
  211. package/dist/members/repo.sessions.d.ts +80 -0
  212. package/dist/members/repo.sessions.js +166 -0
  213. package/dist/members/repo.sql.d.ts +9 -0
  214. package/dist/members/repo.sql.js +11 -0
  215. package/dist/members/subscriber-directory.d.ts +85 -0
  216. package/dist/members/subscriber-directory.js +70 -0
  217. package/dist/members/tool-registrations.d.ts +143 -0
  218. package/dist/members/tool-registrations.js +247 -0
  219. package/dist/members/trash-member.d.ts +24 -0
  220. package/dist/members/trash-member.js +24 -0
  221. package/dist/members/types.d.ts +321 -0
  222. package/dist/members/types.js +34 -0
  223. package/dist/members/write-service.d.ts +17 -0
  224. package/dist/members/write-service.js +15 -0
  225. package/dist/newsletter/agent-tools.d.ts +20 -0
  226. package/dist/newsletter/agent-tools.js +236 -0
  227. package/dist/newsletter/campaign-write-service.d.ts +92 -0
  228. package/dist/newsletter/campaign-write-service.js +190 -0
  229. package/dist/newsletter/campaign.d.ts +53 -0
  230. package/dist/newsletter/campaign.js +95 -0
  231. package/dist/newsletter/confirmation.d.ts +75 -0
  232. package/dist/newsletter/confirmation.js +142 -0
  233. package/dist/newsletter/data-module-manifest.d.ts +68 -0
  234. package/dist/newsletter/data-module-manifest.js +126 -0
  235. package/dist/newsletter/delivery/tool-registrations.d.ts +67 -0
  236. package/dist/newsletter/delivery/tool-registrations.js +229 -0
  237. package/dist/newsletter/errors.d.ts +93 -0
  238. package/dist/newsletter/errors.js +93 -0
  239. package/dist/newsletter/hooks.d.ts +59 -0
  240. package/dist/newsletter/hooks.js +49 -0
  241. package/dist/newsletter/http-error-responses.d.ts +17 -0
  242. package/dist/newsletter/http-error-responses.js +96 -0
  243. package/dist/newsletter/launch-gate.d.ts +62 -0
  244. package/dist/newsletter/launch-gate.js +29 -0
  245. package/dist/newsletter/lists.d.ts +60 -0
  246. package/dist/newsletter/lists.js +83 -0
  247. package/dist/newsletter/ports.d.ts +278 -0
  248. package/dist/newsletter/ports.js +2 -0
  249. package/dist/newsletter/repo-sends.d.ts +82 -0
  250. package/dist/newsletter/repo-sends.js +178 -0
  251. package/dist/newsletter/repo-subscribers.d.ts +82 -0
  252. package/dist/newsletter/repo-subscribers.js +193 -0
  253. package/dist/newsletter/repo.d.ts +61 -0
  254. package/dist/newsletter/repo.js +147 -0
  255. package/dist/newsletter/repo.memory.d.ts +201 -0
  256. package/dist/newsletter/repo.memory.js +250 -0
  257. package/dist/newsletter/repo.rows.d.ts +221 -0
  258. package/dist/newsletter/repo.rows.js +260 -0
  259. package/dist/newsletter/send-pipeline.d.ts +236 -0
  260. package/dist/newsletter/send-pipeline.js +514 -0
  261. package/dist/newsletter/subscriptions.d.ts +87 -0
  262. package/dist/newsletter/subscriptions.js +119 -0
  263. package/dist/newsletter/tool-registrations.d.ts +89 -0
  264. package/dist/newsletter/tool-registrations.deps.d.ts +9 -0
  265. package/dist/newsletter/tool-registrations.deps.js +9 -0
  266. package/dist/newsletter/tool-registrations.js +133 -0
  267. package/dist/newsletter/tool-registrations.read.d.ts +76 -0
  268. package/dist/newsletter/tool-registrations.read.js +140 -0
  269. package/dist/newsletter/tool-registrations.write.d.ts +54 -0
  270. package/dist/newsletter/tool-registrations.write.js +229 -0
  271. package/dist/newsletter/types.d.ts +279 -0
  272. package/dist/newsletter/types.js +23 -0
  273. package/dist/newsletter/unsubscribe.d.ts +41 -0
  274. package/dist/newsletter/unsubscribe.js +100 -0
  275. package/dist/project-keys/attached-vault.d.ts +23 -0
  276. package/dist/project-keys/attached-vault.js +65 -0
  277. package/dist/project-keys/create-vault.d.ts +17 -0
  278. package/dist/project-keys/create-vault.js +29 -0
  279. package/dist/project-keys/service.d.ts +133 -0
  280. package/dist/project-keys/service.js +128 -0
  281. package/dist/project-keys/site-references.d.ts +30 -0
  282. package/dist/project-keys/site-references.js +63 -0
  283. package/dist/project-keys/site-sealer.d.ts +28 -0
  284. package/dist/project-keys/site-sealer.js +64 -0
  285. package/dist/project-keys/sql/attachments.d.ts +33 -0
  286. package/dist/project-keys/sql/attachments.js +55 -0
  287. package/dist/project-keys/tools.d.ts +86 -0
  288. package/dist/project-keys/tools.js +66 -0
  289. package/dist/public-http/routes/mail/feedback.d.ts +44 -0
  290. package/dist/public-http/routes/mail/feedback.js +17 -0
  291. package/dist/public-http/routes/newsletter/confirm.d.ts +38 -0
  292. package/dist/public-http/routes/newsletter/confirm.js +33 -0
  293. package/dist/public-http/routes/newsletter/page.d.ts +29 -0
  294. package/dist/public-http/routes/newsletter/page.js +34 -0
  295. package/dist/public-http/routes/newsletter/unsubscribe.d.ts +33 -0
  296. package/dist/public-http/routes/newsletter/unsubscribe.js +35 -0
  297. package/dist/react/auth/Passkeys.d.ts +2 -34
  298. package/dist/react/auth/RecoveryCodesCard.d.ts +27 -0
  299. package/dist/react/auth/RecoveryCodesCard.hooks.d.ts +67 -0
  300. package/dist/react/auth/RecoveryCodesCard.hooks.js +38 -0
  301. package/dist/react/auth/RecoveryCodesCard.js +56 -0
  302. package/dist/react/auth/TotpSettings.d.ts +2 -23
  303. package/dist/react/auth/local-owner-signin.d.ts +40 -0
  304. package/dist/react/auth/local-owner-signin.js +25 -0
  305. package/dist/react/auth/owner-mfa-api.d.ts +10 -0
  306. package/dist/react/auth/owner-mfa-api.js +17 -0
  307. package/dist/react/auth/owner-passkey-api.d.ts +11 -0
  308. package/dist/react/auth/owner-passkey-api.js +17 -0
  309. package/dist/react/auth/owner-recovery-api.d.ts +51 -0
  310. package/dist/react/auth/owner-recovery-api.js +29 -0
  311. package/dist/react/auth/owner-request.d.ts +7 -0
  312. package/dist/react/auth/owner-request.js +2 -0
  313. package/dist/react/index.d.ts +10 -0
  314. package/dist/react/index.js +6 -0
  315. package/dist/react/mail/Email.d.ts +20 -0
  316. package/dist/react/mail/Email.js +143 -0
  317. package/dist/react/mail/EmailProviderTab.d.ts +34 -0
  318. package/dist/react/mail/EmailProviderTab.js +132 -0
  319. package/dist/react/mail/EmailSegments.d.ts +24 -0
  320. package/dist/react/mail/EmailSegments.js +15 -0
  321. package/dist/react/mail/EmailTemplateEditor.d.ts +146 -0
  322. package/dist/react/mail/EmailTemplateEditor.js +116 -0
  323. package/dist/react/mail/email-view.types.d.ts +236 -0
  324. package/dist/react/mail/email-view.types.js +2 -0
  325. package/dist/react/members/Members.d.ts +5 -3
  326. package/dist/react/members/Members.js +3 -3
  327. package/dist/react/members/api/members-api.d.ts +37 -0
  328. package/dist/react/members/api/members-api.js +16 -0
  329. package/dist/react/members/hooks/use-members.hooks.js +2 -1
  330. package/dist/react/members/members-i18n.d.ts +23 -0
  331. package/dist/react/members/members-i18n.js +25 -0
  332. package/dist/react/members/members-i18n.locales-a.d.ts +4 -0
  333. package/dist/react/members/members-i18n.locales-a.js +294 -0
  334. package/dist/react/members/members-i18n.locales-b.d.ts +4 -0
  335. package/dist/react/members/members-i18n.locales-b.js +265 -0
  336. package/dist/react/models.d.ts +1 -49
  337. package/dist/react/ports.d.ts +3 -143
  338. package/dist/react/roles/api/roles-api.d.ts +74 -0
  339. package/dist/react/roles/api/roles-api.js +22 -0
  340. package/dist/react/testing.js +18 -9
  341. package/dist/react/users/UsersPanel.d.ts +30 -0
  342. package/dist/react/users/UsersPanel.hooks.d.ts +8 -0
  343. package/dist/react/users/UsersPanel.hooks.js +9 -0
  344. package/dist/react/users/UsersPanel.js +9 -0
  345. package/dist/react/users/api/users-api.d.ts +65 -0
  346. package/dist/react/users/api/users-api.js +46 -0
  347. package/dist/react/users/hooks/use-localized-users.hooks.d.ts +43 -0
  348. package/dist/react/users/hooks/use-localized-users.hooks.js +15 -0
  349. package/dist/react/users/hooks/use-users-state.hooks.d.ts +18 -18
  350. package/dist/react/users/password-reset-notice.d.ts +8 -0
  351. package/dist/react/users/password-reset-notice.js +36 -0
  352. package/dist/server/admin-crud-service.d.ts +4 -10
  353. package/dist/server/admin-crud-service.js +20 -6
  354. package/dist/server/agent-tool-registrations.js +20 -5
  355. package/dist/server/agent-tools.js +16 -3
  356. package/dist/server/auth-challenge.d.ts +1 -1
  357. package/dist/server/auth-service.js +2 -1
  358. package/dist/server/grant-service.d.ts +1 -0
  359. package/dist/server/grant-service.js +7 -4
  360. package/dist/server/mfa/passkey-service.d.ts +2 -2
  361. package/dist/server/mfa/passkey-service.js +1 -1
  362. package/dist/server/mfa/service.js +6 -4
  363. package/dist/server/repo.memory.d.ts +30 -2
  364. package/dist/server/repo.memory.js +58 -4
  365. package/dist/server/seed.js +3 -3
  366. package/dist/server/sql/assignments.d.ts +90 -0
  367. package/dist/server/sql/assignments.js +128 -0
  368. package/dist/server/sql/index.d.ts +6 -0
  369. package/dist/server/sql/index.js +5 -0
  370. package/dist/server/sql/kernel.d.ts +9 -0
  371. package/dist/server/sql/kernel.js +2 -0
  372. package/dist/server/sql/mfa.d.ts +36 -0
  373. package/dist/server/sql/mfa.js +51 -0
  374. package/dist/server/sql/passkeys.d.ts +25 -0
  375. package/dist/server/sql/passkeys.js +33 -0
  376. package/dist/server/sql/recovery-codes.d.ts +22 -0
  377. package/dist/server/sql/recovery-codes.js +32 -0
  378. package/package.json +910 -12
@@ -0,0 +1,63 @@
1
+ /** Email delivery visibility tools (email phases 4-5, 2026-10-22): what uses email, recent sends with
2
+ * provider feedback, the suppression list and its owner-only removal, feedback setup. Each calls the
3
+ * same shared operation as its admin route. */
4
+ export const mailDeliveryAgentToolCatalog = [{
5
+ name: "mail_get_readiness",
6
+ description: "Reports, per use of this site's email, whether it can send right now: sign-in links, subscription confirmations, form notifications and newsletter. Returns {checkedAt, uses: [{use, label, sendLane (interactive|notification), mailLane (transactional|bulk), state, reasons, sender, owner, formsConfigured?, evidence}]}. state is ready, blocked (reasons say why, e.g. sender_not_configured, durable_outbox_not_ready, origin_not_verified, consent_capability_unbound), disabled (e.g. newsletter sending switched off), not_configured (e.g. mail_delivery_unavailable, no_form_notifications) or unknown (that use's own check failed; other rows stand). evidence is the last observed send outcome {outcome, at} or null, separate from state: a passing test email does not make a blocked use ready. Uses each owning feature's own checks. Read-only. Requires admin.forms.manage.",
7
+ sideEffects: "none",
8
+ authorization: { permission: "admin.forms.manage" },
9
+ inputSchema: { type: "object", additionalProperties: false, properties: {} },
10
+ }, {
11
+ name: "mail_list_activity",
12
+ description: "Lists this site's recent email sends, newest first, 25 per page by default. Returns {access (full|masked), items: [{id?, recipient, use (sign_in|newsletter_confirmation|form_notification|newsletter|test|unknown), outcome, lane, providerId, providerMessageId?, errorCode, createdAt, updatedAt}], nextCursor, empty (none_recorded|no_matches|null)}. outcome is accepted (the provider took it; not proof of delivery), delivered, bounced or complained (from provider feedback), suppressed, deferred (rate limited), failed or unknown (the provider may have taken it; never resend blindly). With mail.activity.read recipients are full and each item has an id for mail_get_activity; with only admin.forms.manage recipients are masked and there are no ids. Never returns message bodies or sign-in links. Filter with outcome, use and recipient (exact address; needs mail.activity.read); pass nextCursor as cursor for the next page.",
13
+ sideEffects: "none",
14
+ authorization: { permission: "mail.activity.read" },
15
+ inputSchema: { type: "object", additionalProperties: false, properties: {
16
+ outcome: { type: "string", enum: ["accepted", "delivered", "bounced", "complained", "suppressed", "deferred", "failed", "unknown"] },
17
+ use: { type: "string", enum: ["sign_in", "newsletter_confirmation", "form_notification", "newsletter", "test", "unknown"] },
18
+ recipient: { type: "string", maxLength: 254, description: "One exact address." },
19
+ limit: { type: "integer", minimum: 1, maximum: 100, clamp: true, description: "Page size; default 25." },
20
+ cursor: { type: "string", description: "nextCursor from the previous page." },
21
+ } },
22
+ }, {
23
+ name: "mail_get_activity",
24
+ description: "Shows one email send from mail_list_activity with its provider feedback timeline: {activity: {id, recipient, use, outcome, lane, providerId, providerMessageId, errorCode, createdAt, updatedAt}, feedback: [{kind (delivered|bounced|complained), hardBounce, providerId, occurredAt, receivedAt}]}. An empty feedback list means none received yet, not that it was delivered. Never returns the message body or links. Requires mail.activity.read.",
25
+ sideEffects: "none",
26
+ authorization: { permission: "mail.activity.read" },
27
+ inputSchema: { type: "object", additionalProperties: false, required: ["activityId"], properties: { activityId: { type: "string", description: "An id from mail_list_activity." } } },
28
+ }, {
29
+ name: "mail_list_suppressions",
30
+ description: "Lists addresses this site will not email (the do-not-send list), newest first, 25 per page by default: {items: [{address, scope, reason, createdAt}], nextCursor, empty (none_recorded|no_matches|null)}. scope all blocks every email (hard bounces, manual blocks); scope bulk blocks only newsletters (complaints), so that person still gets sign-in links. reason is bounced, complained or manual. The list is kept per address, not per provider, so it survives a provider switch. Filter with search (part of an address), scope and reason; pass nextCursor as cursor for the next page. Requires mail.activity.read.",
31
+ sideEffects: "none",
32
+ authorization: { permission: "mail.activity.read" },
33
+ inputSchema: { type: "object", additionalProperties: false, properties: {
34
+ search: { type: "string", maxLength: 254, description: "Part of an address, e.g. a domain." },
35
+ scope: { type: "string", enum: ["all", "bulk"] },
36
+ reason: { type: "string", enum: ["bounced", "complained", "manual"] },
37
+ limit: { type: "integer", minimum: 1, maximum: 100, clamp: true, description: "Page size; default 25." },
38
+ cursor: { type: "string", description: "nextCursor from the previous page." },
39
+ } },
40
+ }, {
41
+ name: "mail_remove_suppression",
42
+ description: "Removes one address from the do-not-send list for one scope (all or bulk, as mail_list_suppressions shows it) so this site may email it again. Needs a written reason, which is recorded with who removed it and when. Shows the person a confirmation card every time (approval cannot be remembered), including why the address was blocked. Removal only lifts the block: it does not subscribe anyone or restore newsletter consent, and a complained or hard-bounced address can be blocked again by the provider's next report. Returns {removed, removal: {id, address, scope, suppressionReason, suppressedAt, removalReason, removedBy, removedAt}}. Requires mail.suppressions.manage (owner only by default).",
43
+ sideEffects: "mutates-durable-state",
44
+ authorization: { permission: "mail.suppressions.manage" },
45
+ inputSchema: { type: "object", additionalProperties: false, required: ["address", "scope", "reason"], properties: {
46
+ address: { type: "string", maxLength: 254, description: "The suppressed address." },
47
+ scope: { type: "string", enum: ["all", "bulk"] },
48
+ reason: { type: "string", minLength: 3, maxLength: 500, description: "Why this address may be mailed again; recorded." },
49
+ } },
50
+ }, {
51
+ name: "mail_clear_captured",
52
+ description: "Deletes every captured test email of this site (the emails the site kept instead of sending while sending was off or in test mode; they are also deleted automatically after 7 days). Shows the person a confirmation card with how many will be deleted every time (approval cannot be remembered). If new test emails arrive before the person confirms, nothing is deleted and they must be asked again. Sent-email records, delivery history and the do-not-send list are not touched. Returns {cleared: true, deleted}, or {cleared: false, empty: true} when there is nothing to clear. Requires mail.capture.clear (owner only).",
53
+ sideEffects: "mutates-durable-state",
54
+ authorization: { permission: "mail.capture.clear" },
55
+ inputSchema: { type: "object", additionalProperties: false, properties: {} },
56
+ }, {
57
+ name: "mail_get_feedback_setup",
58
+ description: "Shows whether each active mail provider reports deliveries, bounces and complaints back to this site, and what is still needed: {available, providers: [{providerId, label, lanes, supported, webhookPath, webhookUrl (paste into the provider; null until the site's address is verified), signingSecret {current, previous: {label, configured, updatedAt}} (presence only, never the secret; save one with credential_save under that label), lastVerifiedEvent {kind, receivedAt} | null, state (unsupported|secret_missing|no_events_yet|receiving)}]}. no_events_yet means set up but nothing received so far, which is not the same as working. Read-only. Requires admin.forms.manage.",
59
+ sideEffects: "none",
60
+ authorization: { permission: "admin.forms.manage" },
61
+ inputSchema: { type: "object", additionalProperties: false, properties: {} },
62
+ }];
63
+ //# sourceMappingURL=delivery-agent-tools.js.map
@@ -0,0 +1,216 @@
1
+ import type { MailActivityDeps, MailSuppressionDeps, MailActivityPosition, MailActivityFilter, MailSuppressionReason, MailActivityRepo, MailLaunchGateResult, MailSuppressionAdminRepo, MailSenderIdentityPort } from "@jini-ai/core/contracts/site/platform-mail";
2
+ import type { PositionalMailer as MailerPort, MailSuppressionScope } from "@jini-ai/core/contracts/mail";
3
+ import type { FormDefinitionRepoPort } from "@jini-ai/core/contracts/site/cms-forms";
4
+ import type { OriginRegistryPort } from "@jini-ai/core/contracts/server/verified-origin";
5
+ import type { MailProviderControl } from "./provider-operations.js";
6
+ interface MailActivityQuery {
7
+ limit: number;
8
+ before?: MailActivityPosition;
9
+ filter: MailActivityFilter;
10
+ }
11
+ interface MailSuppressionQuery {
12
+ limit: number;
13
+ before?: MailActivityPosition;
14
+ filter: {
15
+ search?: string;
16
+ scope?: MailSuppressionScope;
17
+ reason?: MailSuppressionReason;
18
+ };
19
+ }
20
+ interface MailSuppressionRemovalInput {
21
+ address: string;
22
+ scope: MailSuppressionScope;
23
+ reason: string;
24
+ }
25
+ interface MailSuppressionRemovalPlan extends MailSuppressionRemovalInput {
26
+ suppressionReason: MailSuppressionReason;
27
+ suppressedAt: string;
28
+ revision: string;
29
+ /** What removal does and does not mean, shown before the person confirms. */
30
+ warnings: string[];
31
+ }
32
+ interface MailFeedbackSetupDeps<TCredentialRepo = unknown> {
33
+ workspaceId: string;
34
+ mailProviderControl?: Pick<MailProviderControl, "describe">;
35
+ /** The host's credential store, handed back to {@link MailFeedbackSetupDeps.listCustomCredentials}. */
36
+ customCredentialSetRepo?: TCredentialRepo;
37
+ originRegistry?: Pick<OriginRegistryPort, "canonicalOrigin">;
38
+ mailSuppressionAdmin?: Pick<MailSuppressionAdminRepo, "lastFeedbackEvent">;
39
+ /** Host: safe summaries (label + update time, never a secret) of the saved credentials. */
40
+ listCustomCredentials(deps: {
41
+ repo: TCredentialRepo;
42
+ }, input: {
43
+ workspaceId: string;
44
+ }): Promise<readonly {
45
+ label: string;
46
+ updatedAt: string;
47
+ }[]>;
48
+ /** Host: the persisted current/previous signing-secret labels for a provider (product-prefixed). */
49
+ mailWebhookSecretLabels(required: {
50
+ providerLabel: string;
51
+ }): readonly [string, string];
52
+ }
53
+ interface MailUseLaunchGateDeps {
54
+ isSendingEnabled(workspaceId: string): Promise<boolean>;
55
+ /** `null` = unbound; the host gate checks presence only. */
56
+ consentCapability: unknown;
57
+ originRegistry: OriginRegistryPort;
58
+ mailer: MailerPort;
59
+ }
60
+ interface MailUseReadinessDeps {
61
+ workspaceId: string;
62
+ mailer: MailerPort;
63
+ mailSenderIdentity?: MailSenderIdentityPort;
64
+ mailLaneReady?: (required: {
65
+ lane: "transactional" | "bulk";
66
+ }) => Promise<boolean>;
67
+ /** The live gate's probe; absent, gated rows report `purpose_gate_unavailable` as unknown. */
68
+ mailPurposeGate?: MailPurposeGateProbe;
69
+ formDefinitionRepo?: Pick<FormDefinitionRepoPort, "list">;
70
+ /** Present only when Newsletter is installed; absent, its two rows are omitted. */
71
+ newsletterLaunchGate?: MailUseLaunchGateDeps;
72
+ /** Host: Newsletter's launch gate evaluator (the one its send path runs); absent, Newsletter's rows are `newsletter_gate_unavailable` unknown. */
73
+ evaluateNewsletterLaunchGate?(required: {
74
+ deps: MailUseLaunchGateDeps;
75
+ workspaceId: string;
76
+ isTestSend: boolean;
77
+ }): Promise<Pick<MailLaunchGateResult, "unmetPreconditions">>;
78
+ mailActivity?: Pick<MailActivityRepo, "list">;
79
+ nowIso?: () => string;
80
+ }
81
+ type MailUseReadinessHostDeps = Omit<MailUseReadinessDeps, "newsletterLaunchGate"> & {
82
+ originRegistry?: MailUseLaunchGateDeps["originRegistry"];
83
+ newsletterCampaignRepo?: unknown;
84
+ membersConsentCapability?: MailUseLaunchGateDeps["consentCapability"];
85
+ newsletterSendingEnabled?: MailUseLaunchGateDeps["isSendingEnabled"];
86
+ };
87
+ type MailPurposeGateProbe = (required: {
88
+ capabilityName: string;
89
+ lane: "interactive" | "notification";
90
+ }) => Promise<boolean>;
91
+ import { type AgentToolSideEffect, type ToolExecutionContext, type ToolRegistration } from "@jini-ai/core";
92
+ import type { AssistantSurfaceDeps } from "@jini-ai/core/contracts/site/daemon-surface-exchanges";
93
+ import type { ToolContributor } from "@jini-ai/core";
94
+ import type { HumanConfirmSpec } from "@jini-ai/core/contracts/site/human-confirm";
95
+ import type { HumanConfirmer, ToolHandler, ToolExecutionOptions } from "@jini-ai/core";
96
+ import { type MailHostActivityDeps } from "@jini-ai/user-management/mail/status/domain-deps";
97
+ import type { MailCaptureClearPlan, MailCaptureClearResult } from "@jini-ai/core/contracts/mail";
98
+ /**
99
+ * @file Assistant adapters for the delivery visibility operations (`./use-readiness.ts`,
100
+ * `./activity.ts`, `./suppressions.ts`, `./feedback-setup.ts`), the same ones the admin
101
+ * `system/mail-uses`, `system/mail-activity`, `system/mail-suppressions` and `system/mail-feedback`
102
+ * routes call. Kept apart from the status and provider slices so each evolves independently.
103
+ */
104
+ /** `contentKernel` holds `mail_capture` for `mail_clear_captured`; absent, that tool answers unavailable. */
105
+ export type MailDeliveryToolDeps = MailHostActivityDeps & MailUseReadinessHostDeps & MailFeedbackSetupDeps;
106
+ export declare const mailDeliveryDerivedRisk: ReadonlyMap<string, AgentToolSideEffect>;
107
+ /** A planned "clear all": the reviewed count and newest capture, the revision naming that exact set, and the clear bound to it. */
108
+ export interface CaptureClearPlan {
109
+ plan: MailCaptureClearPlan;
110
+ revision: string;
111
+ clear: () => Promise<MailCaptureClearResult>;
112
+ }
113
+ /**
114
+ * Plans "clear all" for this workspace as the caller, without deleting anything. Bound at the host
115
+ * (`server/runtime/composition/mail-capture-clear-planner.ts`), which owns the capture repo and the
116
+ * owner-grant check; only the approved run calls the plan's `clear`.
117
+ */
118
+ export type MailCaptureClearPlanner = (args: {
119
+ deps: MailDeliveryToolDeps;
120
+ ctx: ToolExecutionContext;
121
+ }, _optional?: Record<string, never>) => Promise<CaptureClearPlan>;
122
+ /** The host-bound collaborators the delivery tools need beyond their deps. */
123
+ export interface MailDeliveryToolCollaborators {
124
+ deps: {
125
+ getMailActivity(required: {
126
+ principalId: string;
127
+ activityId: {
128
+ idempotencyKey: string;
129
+ recipient: string;
130
+ };
131
+ deps: MailActivityDeps;
132
+ }): Promise<unknown>;
133
+ listMailActivity(required: {
134
+ principalId: string;
135
+ query: MailActivityQuery;
136
+ deps: MailActivityDeps;
137
+ }): Promise<unknown>;
138
+ listMailSuppressions(required: {
139
+ principalId: string;
140
+ query: MailSuppressionQuery;
141
+ deps: MailSuppressionDeps;
142
+ }): Promise<unknown>;
143
+ MailActivityForbiddenError: abstract new (...args: never[]) => Error;
144
+ MailActivityUnavailableError: abstract new (...args: never[]) => Error;
145
+ MailSuppressionsUnavailableError: abstract new (...args: never[]) => Error;
146
+ planMailSuppressionRemoval(required: {
147
+ principalId: string;
148
+ input: MailSuppressionRemovalInput;
149
+ deps: MailSuppressionDeps;
150
+ }): Promise<MailSuppressionRemovalPlan>;
151
+ readMailActivityId(required: {
152
+ value: unknown;
153
+ }): {
154
+ idempotencyKey: string;
155
+ recipient: string;
156
+ };
157
+ readMailActivityQuery(required: {
158
+ input: Record<string, unknown>;
159
+ }): MailActivityQuery;
160
+ readMailSuppressionQuery(required: {
161
+ input: Record<string, unknown>;
162
+ }): MailSuppressionQuery;
163
+ readMailSuppressionRemoval(required: {
164
+ input: Record<string, unknown>;
165
+ }): MailSuppressionRemovalInput;
166
+ runMailSuppressionRemoval(required: {
167
+ principalId: string;
168
+ plan: MailSuppressionRemovalPlan;
169
+ deps: MailSuppressionDeps;
170
+ }): Promise<unknown>;
171
+ readMailFeedbackSetup(deps: MailFeedbackSetupDeps): Promise<unknown>;
172
+ mailUseReadinessDepsFrom(deps: MailUseReadinessHostDeps): MailUseReadinessDeps;
173
+ readMailUseReadiness(deps: MailUseReadinessDeps): Promise<unknown>;
174
+ };
175
+ planCaptureClear: MailCaptureClearPlanner;
176
+ approvalToolHandler<TPrepared>(required: {
177
+ surfaces: AssistantSurfaceDeps;
178
+ prepare: (required: {
179
+ ctx: ToolExecutionContext;
180
+ }, optional: ToolExecutionOptions) => Promise<TPrepared>;
181
+ describe: (required: {
182
+ ctx: ToolExecutionContext;
183
+ prepared: TPrepared;
184
+ }) => HumanConfirmSpec | Promise<HumanConfirmSpec>;
185
+ run: (required: {
186
+ ctx: ToolExecutionContext;
187
+ prepared: TPrepared;
188
+ confirmer: HumanConfirmer;
189
+ choice?: string;
190
+ }, optional: ToolExecutionOptions) => Promise<unknown>;
191
+ }, optional?: {
192
+ flag?: string;
193
+ ask?: (required: {
194
+ prepared: TPrepared;
195
+ }) => boolean;
196
+ }): ToolHandler;
197
+ }
198
+ /**
199
+ * `mail_get_readiness`, `mail_list_activity`, `mail_get_activity`, `mail_list_suppressions`,
200
+ * `mail_remove_suppression` and `mail_clear_captured` (approval-gated, never remembered), `mail_get_feedback_setup`.
201
+ * @param deps - Site scope, authorization, the mail repos and the readiness/feedback inputs.
202
+ * @param surfaces - The authenticated card transport for the removal card.
203
+ * @param collaborators - `planCaptureClear`, the host-bound capture-clear planner.
204
+ * @returns The seven registrations.
205
+ * @throws {ToolInputError} For malformed input, a refusal or a missing activity record.
206
+ * @complexity One readiness pass or one activity read per call.
207
+ */
208
+ export declare function buildMailDeliveryRegistrations({ deps, surfaces, collaborators }: {
209
+ deps: MailDeliveryToolDeps;
210
+ surfaces: AssistantSurfaceDeps;
211
+ collaborators: MailDeliveryToolCollaborators;
212
+ }, _optional?: Record<string, never>): ToolRegistration[];
213
+ /** Registers the delivery visibility tools under their own contributor domain, with the host-bound capture-clear planner. */
214
+ export declare function contributeMailDeliveryTools(collaborators: MailDeliveryToolCollaborators, _optional?: Record<string, never>): ToolContributor<MailDeliveryToolDeps, AssistantSurfaceDeps>;
215
+ export {};
216
+ //# sourceMappingURL=delivery-tool-registrations.d.ts.map
@@ -0,0 +1,110 @@
1
+ import { toolMetadata } from "@jini-ai/core/tool-metadata/mail-status";
2
+ import { buildDomainRegistrations, indexCatalogById, requireInputRecord, ToolInputError } from "@jini-ai/core";
3
+ import { adaptLegacyAuthorize, ToolPermissionDeniedError as ForbiddenError, requireToolPermission } from "@jini-ai/core";
4
+ import { forbiddenRule, withModelFacingErrors } from "@jini-ai/core/model-facing-tool-errors";
5
+ import { mailDeliveryAgentToolCatalog } from "@jini-ai/user-management/mail/status/delivery-agent-tools";
6
+ import { mailDomainDepsFrom } from "@jini-ai/user-management/mail/status/domain-deps";
7
+ import { MAIL_STATUS_PERMISSION } from "@jini-ai/user-management/mail/status/permissions";
8
+ export const mailDeliveryDerivedRisk = new Map([
9
+ // -> owner checks (sender read, launch gate, form list, gate probe that sends nothing) + one activity row per use.
10
+ ["mail_get_readiness", "none"],
11
+ // -> one ledger page read joined with feedback.
12
+ ["mail_list_activity", "none"],
13
+ // -> one ledger row and its feedback events.
14
+ ["mail_get_activity", "none"],
15
+ // -> one suppression page read.
16
+ ["mail_list_suppressions", "none"],
17
+ // -> one suppression delete plus its audit row, after a fresh confirmation.
18
+ ["mail_remove_suppression", "mutates-durable-state"],
19
+ // -> one delete of this workspace's captured test emails, after a fresh confirmation of the count.
20
+ ["mail_clear_captured", "mutates-durable-state"],
21
+ // -> provider describe, credential list (labels only, no decrypt), origin read, inbox probe.
22
+ ["mail_get_feedback_setup", "none"],
23
+ ]);
24
+ /** The card: what was blocked and why, the recorded reason, and what removal does not mean. */
25
+ function removalCard({ prepared }) {
26
+ return { toolId: "mail_remove_suppression", errorCode: "MAIL", title: `Allow email to ${prepared.address} again?`,
27
+ details: [{ label: "Address", value: prepared.address }, { label: "Scope", value: prepared.scope === "all" ? "All email" : "Newsletters (bulk mail)" },
28
+ { label: "Blocked because", value: `${prepared.suppressionReason} (${prepared.suppressedAt})` }, { label: "Your reason (recorded)", value: prepared.reason }],
29
+ warning: prepared.warnings.join(" "), confirmLabel: "Remove from do-not-send list" };
30
+ }
31
+ /** The card: how many captured test emails go, and what is not touched. */
32
+ function captureClearCard({ prepared }) {
33
+ const { count, newestAt } = prepared.plan;
34
+ return { toolId: "mail_clear_captured", errorCode: "MAIL", title: `Delete ${count} captured test email${count === 1 ? "" : "s"}?`,
35
+ details: [{ label: "Test emails", value: String(count) }, { label: "Newest", value: newestAt ?? "-" }],
36
+ warning: "This cannot be undone. Sent-email records, delivery history and the do-not-send list are not touched.", confirmLabel: "Delete test emails" };
37
+ }
38
+ /** Deletes only when the count and newest capture still match the card the person approved; the plan is re-run at the write to catch a stale card. */
39
+ async function runCaptureClear({ deps, ctx, prepared, planCaptureClear }) {
40
+ const fresh = await planCaptureClear({ deps, ctx });
41
+ if (fresh.revision !== prepared.revision)
42
+ throw new ToolInputError({ message: "New test emails arrived after you were asked. Nothing was deleted; ask again to review the new count." });
43
+ if (fresh.plan.count === 0)
44
+ return { cleared: false, empty: true };
45
+ return fresh.clear();
46
+ }
47
+ function permission({ deps, ctx, name }, _optional = {}) {
48
+ return requireToolPermission({ authorize: adaptLegacyAuthorize({ authorize: deps.authorize }), workspaceId: deps.workspaceId, principalId: ctx.principal.id, permission: name }, { entityType: "mail" });
49
+ }
50
+ /**
51
+ * `mail_get_readiness`, `mail_list_activity`, `mail_get_activity`, `mail_list_suppressions`,
52
+ * `mail_remove_suppression` and `mail_clear_captured` (approval-gated, never remembered), `mail_get_feedback_setup`.
53
+ * @param deps - Site scope, authorization, the mail repos and the readiness/feedback inputs.
54
+ * @param surfaces - The authenticated card transport for the removal card.
55
+ * @param collaborators - `planCaptureClear`, the host-bound capture-clear planner.
56
+ * @returns The seven registrations.
57
+ * @throws {ToolInputError} For malformed input, a refusal or a missing activity record.
58
+ * @complexity One readiness pass or one activity read per call.
59
+ */
60
+ export function buildMailDeliveryRegistrations({ deps, surfaces, collaborators }, _optional = {}) {
61
+ const { planCaptureClear, approvalToolHandler } = collaborators;
62
+ const { getMailActivity, listMailActivity, listMailSuppressions, MailActivityForbiddenError, MailActivityUnavailableError, MailSuppressionsUnavailableError, planMailSuppressionRemoval, readMailActivityId, readMailActivityQuery, readMailSuppressionQuery, readMailSuppressionRemoval, runMailSuppressionRemoval, readMailFeedbackSetup, mailUseReadinessDepsFrom, readMailUseReadiness } = collaborators.deps;
63
+ return buildDomainRegistrations({ metadata: toolMetadata, domain: "system-mail-delivery", catalogModule: "features/mail-status/delivery-agent-tools.ts", catalog: indexCatalogById({ catalog: mailDeliveryAgentToolCatalog }), derivedRisk: mailDeliveryDerivedRisk, handlers: withModelFacingErrors({ handlers: {
64
+ mail_get_readiness: async (ctx) => {
65
+ requireInputRecord({ input: ctx.input });
66
+ await permission({ deps, ctx, name: MAIL_STATUS_PERMISSION });
67
+ return readMailUseReadiness(mailUseReadinessDepsFrom(deps));
68
+ },
69
+ mail_list_activity: async (ctx) => {
70
+ const query = readMailActivityQuery({ input: requireInputRecord({ input: ctx.input }) });
71
+ return listMailActivity({ ...{ principalId: ctx.principal.id, query }, deps: mailDomainDepsFrom({ deps }) });
72
+ },
73
+ mail_get_activity: async (ctx) => {
74
+ const activityId = readMailActivityId({ value: requireInputRecord({ input: ctx.input }).activityId });
75
+ const found = await getMailActivity({ ...{ principalId: ctx.principal.id, activityId }, deps: mailDomainDepsFrom({ deps }) });
76
+ if (!found)
77
+ throw new ToolInputError({ message: "No email send with that id exists on this site. List them with mail_list_activity." });
78
+ return found;
79
+ },
80
+ mail_list_suppressions: async (ctx) => listMailSuppressions({ ...{ principalId: ctx.principal.id, query: readMailSuppressionQuery({ input: requireInputRecord({ input: ctx.input }) }) }, deps: mailDomainDepsFrom({ deps }) }),
81
+ // No rememberKey: each removal lets mail reach someone who bounced or complained, so it always asks.
82
+ mail_remove_suppression: approvalToolHandler({ surfaces,
83
+ prepare: async ({ ctx }) => planMailSuppressionRemoval({ ...{ principalId: ctx.principal.id, input: readMailSuppressionRemoval({ input: requireInputRecord({ input: ctx.input }) }) }, deps: mailDomainDepsFrom({ deps }) }),
84
+ describe: removalCard,
85
+ // The card may sit open for minutes: the run re-checks the grant at the moment of the write.
86
+ run: async ({ ctx, prepared }) => runMailSuppressionRemoval({ ...{ principalId: ctx.principal.id, plan: prepared }, deps: mailDomainDepsFrom({ deps }) }),
87
+ }, { flag: "removed" }),
88
+ // No rememberKey: each clear permanently deletes test emails, so it always asks (unless there are none).
89
+ mail_clear_captured: approvalToolHandler({ surfaces,
90
+ prepare: async ({ ctx }) => { requireInputRecord({ input: ctx.input }); return planCaptureClear({ deps, ctx }); },
91
+ describe: captureClearCard,
92
+ run: async ({ ctx, prepared }) => runCaptureClear({ deps, ctx, prepared, planCaptureClear }),
93
+ }, { flag: "cleared", ask: ({ prepared }) => prepared.plan.count > 0 }),
94
+ mail_get_feedback_setup: async (ctx) => {
95
+ requireInputRecord({ input: ctx.input });
96
+ await permission({ deps, ctx, name: MAIL_STATUS_PERMISSION });
97
+ return readMailFeedbackSetup(deps);
98
+ },
99
+ }, rules: [
100
+ forbiddenRule({ domainPrefix: "MAIL_DELIVERY", error: ForbiddenError }),
101
+ { error: MailActivityForbiddenError, code: "MAIL_DELIVERY_FORBIDDEN" },
102
+ { error: MailActivityUnavailableError, code: "MAIL_DELIVERY_UNAVAILABLE" },
103
+ { error: MailSuppressionsUnavailableError, code: "MAIL_DELIVERY_UNAVAILABLE" },
104
+ ] }) });
105
+ }
106
+ /** Registers the delivery visibility tools under their own contributor domain, with the host-bound capture-clear planner. */
107
+ export function contributeMailDeliveryTools(collaborators, _optional = {}) {
108
+ return { domain: "system-mail-delivery", build: (deps, surfaces) => buildMailDeliveryRegistrations({ deps, surfaces, collaborators }), risk: mailDeliveryDerivedRisk };
109
+ }
110
+ //# sourceMappingURL=delivery-tool-registrations.js.map
@@ -0,0 +1,25 @@
1
+ import type { MailActivityDeps, MailSuppressionDeps } from "@jini-ai/core/contracts/site/platform-mail";
2
+ /**
3
+ * @file The host's binding of the activity and suppression operations in `@jini-ai/platform/mail`
4
+ * (email phases 4-5): behind `mail_list_activity`, `mail_get_activity`, `mail_list_suppressions`,
5
+ * `mail_remove_suppression` and the admin routes `system/mail-activity` and
6
+ * `system/mail-suppressions[/remove]`. Removal needs a fresh confirmation every time: the tool's
7
+ * card has no remember option and the route performs only with `confirmed: true`. The owner-only
8
+ * rule for removal is declared with the permission ids in `./permissions.ts`.
9
+ */
10
+ /** What the host's deps bag supplies to the activity and suppression operations. */
11
+ export type MailHostActivityDeps = Omit<MailActivityDeps, "permissions"> & Omit<MailSuppressionDeps, "permissions">;
12
+ /**
13
+ * Binds this site's permission ids to the host deps for ONE call of an activity or suppression
14
+ * operation. Read per call, never captured at registration: `ownerPrincipalId` and the repos are
15
+ * read from the bag at the moment of the call, exactly as the operations did before they took
16
+ * their permission ids as input.
17
+ *
18
+ * @param required.deps - The host deps bag (route deps in production).
19
+ * @returns The deps object the operations take.
20
+ * @complexity O(1).
21
+ */
22
+ export declare function mailDomainDepsFrom({ deps }: {
23
+ deps: MailHostActivityDeps;
24
+ }, _optional?: Record<string, never>): MailActivityDeps & MailSuppressionDeps;
25
+ //# sourceMappingURL=domain-deps.d.ts.map
@@ -0,0 +1,23 @@
1
+ import { MAIL_PERMISSION_IDS } from "./permissions.js";
2
+ /**
3
+ * Binds this site's permission ids to the host deps for ONE call of an activity or suppression
4
+ * operation. Read per call, never captured at registration: `ownerPrincipalId` and the repos are
5
+ * read from the bag at the moment of the call, exactly as the operations did before they took
6
+ * their permission ids as input.
7
+ *
8
+ * @param required.deps - The host deps bag (route deps in production).
9
+ * @returns The deps object the operations take.
10
+ * @complexity O(1).
11
+ */
12
+ export function mailDomainDepsFrom({ deps }, _optional = {}) {
13
+ return {
14
+ workspaceId: deps.workspaceId,
15
+ authorize: deps.authorize,
16
+ permissions: MAIL_PERMISSION_IDS,
17
+ // Absent stays absent (exact optional properties): the operations treat a missing repo as unavailable.
18
+ ...(deps.ownerPrincipalId === undefined ? {} : { ownerPrincipalId: deps.ownerPrincipalId }),
19
+ ...(deps.mailActivity === undefined ? {} : { mailActivity: deps.mailActivity }),
20
+ ...(deps.mailSuppressionAdmin === undefined ? {} : { mailSuppressionAdmin: deps.mailSuppressionAdmin }),
21
+ };
22
+ }
23
+ //# sourceMappingURL=domain-deps.js.map
@@ -0,0 +1,43 @@
1
+ /** The host's grant registry, as far as this registrar uses it: one built-in-role grant per call. */
2
+ type PermissionGrantRegistry = {
3
+ readonly roleGrants: {
4
+ register(grant: {
5
+ readonly role: string;
6
+ readonly permission: string;
7
+ readonly reason: string;
8
+ }): void;
9
+ };
10
+ };
11
+ /**
12
+ * @file The Email page's own permissions (email phases 4-5), declared at composition like
13
+ * `features/publish-content/permissions.ts`.
14
+ *
15
+ * - `mail.activity.read`: full recipient details of the send history (addresses, ids, message ids).
16
+ * The built-in `admin` role holds it, stated against the role so already-seeded workspaces gain
17
+ * it too (see `features/identity/builtin-role-grants.ts`). Without it, holders of the page's
18
+ * status permission see the same outcomes with masked recipients.
19
+ * - `mail.suppressions.manage`: removing an address from the do-not-send list. Owner decision
20
+ * (2026-10-22): owner-only, so it is deliberately granted to NO built-in role; the owner holds it
21
+ * through the `*` wildcard. Removal is owner only; the grant alone is not enough.
22
+ */
23
+ /** Full send-history details (`mail_list_activity`, `mail_get_activity`, `GET system/mail-activity`). */
24
+ export declare const MAIL_ACTIVITY_READ_PERMISSION = "mail.activity.read";
25
+ /** Suppression removal (`mail_remove_suppression`, `POST system/mail-suppressions/remove`). */
26
+ export declare const MAIL_SUPPRESSIONS_MANAGE_PERMISSION = "mail.suppressions.manage";
27
+ /** The Email page's existing status permission (status, uses, test send). Spelled once here. */
28
+ export declare const MAIL_STATUS_PERMISSION = "admin.forms.manage";
29
+ /** The three ids the activity and suppression operations are given by their host, by role. */
30
+ export declare const MAIL_PERMISSION_IDS: {
31
+ readonly activityRead: "mail.activity.read";
32
+ readonly status: "admin.forms.manage";
33
+ readonly suppressionsManage: "mail.suppressions.manage";
34
+ };
35
+ /**
36
+ * Register both catalog entries and the admin grant for `mail.activity.read`.
37
+ * @complexity O(1).
38
+ */
39
+ export declare function registerMailPermissionGrants(required: {
40
+ registry: PermissionGrantRegistry;
41
+ }, _optional?: Record<string, never>): void;
42
+ export {};
43
+ //# sourceMappingURL=permissions.d.ts.map
@@ -0,0 +1,45 @@
1
+ import { registerPermission } from "../../core/permissions.js";
2
+ // Clearing captured test emails: owner decision (2026-11-23, bt2-todos G7-7/848), owner-only like
3
+ // suppression removal, so no built-in role holds it. The id lives in core's neutral mail contract.
4
+ import { MAIL_CAPTURE_CLEAR_PERMISSION } from "@jini-ai/core/contracts/mail";
5
+ /**
6
+ * @file The Email page's own permissions (email phases 4-5), declared at composition like
7
+ * `features/publish-content/permissions.ts`.
8
+ *
9
+ * - `mail.activity.read`: full recipient details of the send history (addresses, ids, message ids).
10
+ * The built-in `admin` role holds it, stated against the role so already-seeded workspaces gain
11
+ * it too (see `features/identity/builtin-role-grants.ts`). Without it, holders of the page's
12
+ * status permission see the same outcomes with masked recipients.
13
+ * - `mail.suppressions.manage`: removing an address from the do-not-send list. Owner decision
14
+ * (2026-10-22): owner-only, so it is deliberately granted to NO built-in role; the owner holds it
15
+ * through the `*` wildcard. Removal is owner only; the grant alone is not enough.
16
+ */
17
+ /** Full send-history details (`mail_list_activity`, `mail_get_activity`, `GET system/mail-activity`). */
18
+ export const MAIL_ACTIVITY_READ_PERMISSION = "mail.activity.read";
19
+ /** Suppression removal (`mail_remove_suppression`, `POST system/mail-suppressions/remove`). */
20
+ export const MAIL_SUPPRESSIONS_MANAGE_PERMISSION = "mail.suppressions.manage";
21
+ /** The Email page's existing status permission (status, uses, test send). Spelled once here. */
22
+ export const MAIL_STATUS_PERMISSION = "admin.forms.manage";
23
+ /** The three ids the activity and suppression operations are given by their host, by role. */
24
+ export const MAIL_PERMISSION_IDS = {
25
+ activityRead: MAIL_ACTIVITY_READ_PERMISSION,
26
+ status: MAIL_STATUS_PERMISSION,
27
+ suppressionsManage: MAIL_SUPPRESSIONS_MANAGE_PERMISSION,
28
+ };
29
+ /**
30
+ * Register both catalog entries and the admin grant for `mail.activity.read`.
31
+ * @complexity O(1).
32
+ */
33
+ export function registerMailPermissionGrants(required, _optional = {}) {
34
+ registerPermission({ id: MAIL_ACTIVITY_READ_PERMISSION, owner: "mail", description: "See who this site emailed and each send's outcome and provider feedback." });
35
+ registerPermission({ id: MAIL_SUPPRESSIONS_MANAGE_PERMISSION, owner: "mail", description: "Remove an address from the do-not-send list (owner only; the grant alone is not enough)." });
36
+ registerPermission({ id: MAIL_CAPTURE_CLEAR_PERMISSION, owner: "mail", description: "Delete every captured test email of this site (owner only)." });
37
+ required.registry.roleGrants.register({
38
+ role: "admin",
39
+ permission: MAIL_ACTIVITY_READ_PERMISSION,
40
+ reason: "Email page phase 4 (2026-10-22): delegated site administrators diagnose delivery, which needs " +
41
+ "the recipient of each send. Stated against the built-in admin role so already-seeded workspaces " +
42
+ "gain it (seedIdentity early-returns once an owner exists). editor and viewer do not hold it.",
43
+ });
44
+ }
45
+ //# sourceMappingURL=permissions.js.map
@@ -0,0 +1,38 @@
1
+ /** Mail provider configuration tools (email phase 2, 2026-10-22). Both are read-only: configuring
2
+ * hands the secret entry to `credential_save`'s human form, and switching stays with the
3
+ * approval-gated `mail_set_provider` (`./agent-tools.ts`). */
4
+ export declare const mailProviderAgentToolCatalog: ({
5
+ name: string;
6
+ description: string;
7
+ sideEffects: "none";
8
+ authorization: {
9
+ permission: string;
10
+ };
11
+ inputSchema: {
12
+ type: string;
13
+ additionalProperties: boolean;
14
+ properties: {
15
+ providerId?: never;
16
+ };
17
+ required?: never;
18
+ };
19
+ } | {
20
+ name: string;
21
+ description: string;
22
+ sideEffects: "none";
23
+ authorization: {
24
+ permission: string;
25
+ };
26
+ inputSchema: {
27
+ type: string;
28
+ additionalProperties: boolean;
29
+ required: string[];
30
+ properties: {
31
+ providerId: {
32
+ type: string;
33
+ description: string;
34
+ };
35
+ };
36
+ };
37
+ })[];
38
+ //# sourceMappingURL=provider-agent-tools.d.ts.map
@@ -0,0 +1,17 @@
1
+ /** Mail provider configuration tools (email phase 2, 2026-10-22). Both are read-only: configuring
2
+ * hands the secret entry to `credential_save`'s human form, and switching stays with the
3
+ * approval-gated `mail_set_provider` (`./agent-tools.ts`). */
4
+ export const mailProviderAgentToolCatalog = [{
5
+ name: "mail_list_providers",
6
+ description: "Lists active mail adapters and discovers installed mail-provider plugins, including those switched off, without secrets: {setting: {transactional, bulk}, providers, refusals, availablePlugins?}. availablePlugins gives pluginId, description, enabled and MCP server ids from the local plugin inventory. A missing active adapter does not mean its plugin is absent. Read its setup with load_agent_plugin, then offer plugins_set_enabled with family agent-plugin if needed; enabling still requires approval. If the inventory is unavailable, use search_agent_plugin_local before claiming a provider is missing. Each provider has id, label, origin (core|plugin), hosted, lanes it currently sends for (empty = installed but not active), capabilities {feedback, domainVerification, rateLimit}, credential {required, saved, label, credentialId, updatedAt} (presence only, never the key), selectable plus refusal (why it cannot be switched to yet) and setup.fields (the fields its key form asks for: key, label, type, required, defaultValue, placeholder, help, helpUrl). refusals lists plugin providers that did not load. Use before mail_configure_provider or mail_set_provider. Requires admin.forms.manage.",
7
+ sideEffects: "none",
8
+ authorization: { permission: "admin.forms.manage" },
9
+ inputSchema: { type: "object", additionalProperties: false, properties: {} },
10
+ }, {
11
+ name: "mail_configure_provider",
12
+ description: "Prepares an installed mail provider's key WITHOUT making it the active provider. Reuses a saved key: when one exists, returns a note and no credentialSetup; do not open a replacement card unless the person explicitly asked to replace it. For a missing key, returns {activated: false, provider, credential: {action (create|rotate), label, category, baseUrl}, credentialSetup, followUps}; when credentialSetup is present, follow it by calling credential_save with credentialSetup's prefill, so the person types the key into the secure masked form (never ask for a key in chat and never put one in any tool argument), then run each followUps entry (for example a non-secret username the form does not collect). A saved or rotated key is used from the next email on. Switching to the provider is a separate step: mail_set_provider. Refuses providers that need no key. Requires custom-credentials.write.",
13
+ sideEffects: "none",
14
+ authorization: { permission: "custom-credentials.write" },
15
+ inputSchema: { type: "object", additionalProperties: false, required: ["providerId"], properties: { providerId: { type: "string", description: "An installed provider id from mail_list_providers." } } },
16
+ }];
17
+ //# sourceMappingURL=provider-agent-tools.js.map