@8wave/ai-elements 0.114.0-beta.7 → 0.114.0

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 (162) hide show
  1. package/dist/_chunks/Agent-DK76k05_.js +566 -0
  2. package/dist/_chunks/Agent-DK76k05_.js.map +1 -0
  3. package/dist/_chunks/{PkStreamingMarkdown-C1sANAr5.js → PkStreamingMarkdown-BKxA6Ntl.js} +688 -672
  4. package/dist/_chunks/PkStreamingMarkdown-BKxA6Ntl.js.map +1 -0
  5. package/dist/_chunks/{PkToolRequestGeolocation-BbxYKt-9.js → PkToolRequestGeolocation-OF1PWhMw.js} +2 -2
  6. package/{dist-vue/_chunks/PkToolRequestGeolocation-9vfYNaQo.js.map → dist/_chunks/PkToolRequestGeolocation-OF1PWhMw.js.map} +1 -1
  7. package/dist/_chunks/{PkToolRequestOAuthConnection-CTp2w60F.js → PkToolRequestOAuthConnection-ChGMAKV7.js} +2 -2
  8. package/dist/_chunks/{PkToolRequestOAuthConnection-CTp2w60F.js.map → PkToolRequestOAuthConnection-ChGMAKV7.js.map} +1 -1
  9. package/dist/_chunks/{PkToolShowArtifact-BfTjxGOT.js → PkToolShowArtifact-CHxeuKEU.js} +2 -2
  10. package/dist/_chunks/{PkToolShowArtifact-BfTjxGOT.js.map → PkToolShowArtifact-CHxeuKEU.js.map} +1 -1
  11. package/dist/_chunks/PkToolShowComparison-8d6fAhRp.js +72 -0
  12. package/dist/_chunks/PkToolShowComparison-8d6fAhRp.js.map +1 -0
  13. package/dist/_chunks/{PkToolShowContactForm-PFpY9dIp.js → PkToolShowContactForm-DqVLVwqJ.js} +2 -2
  14. package/dist/_chunks/{PkToolShowContactForm-PFpY9dIp.js.map → PkToolShowContactForm-DqVLVwqJ.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowForm-CMtSN0oX.js → PkToolShowForm-YJQPYfEe.js} +5 -5
  16. package/dist/_chunks/{PkToolShowForm-CMtSN0oX.js.map → PkToolShowForm-YJQPYfEe.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowSources-C6cu66Ts.js → PkToolShowSources-VFoI0YS8.js} +3 -3
  18. package/dist/_chunks/{PkToolShowSources-C6cu66Ts.js.map → PkToolShowSources-VFoI0YS8.js.map} +1 -1
  19. package/dist/_chunks/{PkToolShowSuggestedReply-CFO8wV1b.js → PkToolShowSuggestedReply-Dl4x_nEJ.js} +2 -2
  20. package/dist/_chunks/{PkToolShowSuggestedReply-CFO8wV1b.js.map → PkToolShowSuggestedReply-Dl4x_nEJ.js.map} +1 -1
  21. package/dist/_chunks/{markdown-BRD-hDrH.js → markdown-BL7WANiX.js} +19 -12
  22. package/dist/_chunks/markdown-BL7WANiX.js.map +1 -0
  23. package/dist/ai-elements.es.js +3130 -2770
  24. package/dist/ai-elements.es.js.map +1 -1
  25. package/dist-vue/PkChatbot.js +1 -1
  26. package/dist-vue/PkChatbotAuth.js +1 -1
  27. package/dist-vue/PkChatbotEmptyState.js +1 -1
  28. package/dist-vue/PkChatbotInput.js +1 -1
  29. package/dist-vue/PkChatbotMessages.js +1 -1
  30. package/dist-vue/PkChatbotStepPayload.js +1 -1
  31. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  32. package/dist-vue/PkChatbotSteps.js +1 -1
  33. package/dist-vue/PkChatbotViewChat.js +1 -1
  34. package/dist-vue/PkChatbotViewConversations.js +1 -1
  35. package/dist-vue/PkChatbotViewFiles.js +1 -1
  36. package/dist-vue/PkChatbotViewProfile.js +1 -1
  37. package/dist-vue/_chunks/{Agent-BNlmK-uJ.js → Agent-tbKw8Mdt.js} +2 -2
  38. package/dist-vue/_chunks/{Agent-BNlmK-uJ.js.map → Agent-tbKw8Mdt.js.map} +1 -1
  39. package/dist-vue/_chunks/{Document-2X01-F4Z.js → Document-nCWwJC2h.js} +18 -11
  40. package/dist-vue/_chunks/Document-nCWwJC2h.js.map +1 -0
  41. package/dist-vue/_chunks/Media-_HfFLHGD.js.map +1 -1
  42. package/dist-vue/_chunks/{PkChatbot-HRayDr2d.js → PkChatbot-BMIs94QB.js} +8 -8
  43. package/dist-vue/_chunks/{PkChatbot-HRayDr2d.js.map → PkChatbot-BMIs94QB.js.map} +1 -1
  44. package/dist-vue/_chunks/PkChatbotAuth-jzoNJkmH.js +421 -0
  45. package/dist-vue/_chunks/PkChatbotAuth-jzoNJkmH.js.map +1 -0
  46. package/dist-vue/_chunks/{PkChatbotEmptyState-CPOcfoRC.js → PkChatbotEmptyState-Dicjr_Fv.js} +2 -2
  47. package/dist-vue/_chunks/{PkChatbotEmptyState-CPOcfoRC.js.map → PkChatbotEmptyState-Dicjr_Fv.js.map} +1 -1
  48. package/dist-vue/_chunks/{PkChatbotInput-pLJQIu7v.js → PkChatbotInput-DcLmOqA1.js} +2 -2
  49. package/dist-vue/_chunks/{PkChatbotInput-pLJQIu7v.js.map → PkChatbotInput-DcLmOqA1.js.map} +1 -1
  50. package/dist-vue/_chunks/{PkChatbotMessages-GZStJbx_.js → PkChatbotMessages-Bj7mjhqN.js} +258 -256
  51. package/dist-vue/_chunks/PkChatbotMessages-Bj7mjhqN.js.map +1 -0
  52. package/dist-vue/_chunks/{PkChatbotStepPayload-DU0W-eUp.js → PkChatbotStepPayload-rKaeDQDj.js} +2 -2
  53. package/dist-vue/_chunks/{PkChatbotStepPayload-DU0W-eUp.js.map → PkChatbotStepPayload-rKaeDQDj.js.map} +1 -1
  54. package/dist-vue/_chunks/{PkChatbotStepToolDetail-etlBryOg.js → PkChatbotStepToolDetail-5HdSV8Im.js} +3 -3
  55. package/dist-vue/_chunks/{PkChatbotStepToolDetail-etlBryOg.js.map → PkChatbotStepToolDetail-5HdSV8Im.js.map} +1 -1
  56. package/dist-vue/_chunks/PkChatbotSteps-CPPjwTJN.js +191 -0
  57. package/dist-vue/_chunks/PkChatbotSteps-CPPjwTJN.js.map +1 -0
  58. package/dist-vue/_chunks/{PkChatbotViewChat-DIfBWFoG.js → PkChatbotViewChat-CQ5WcZs8.js} +7 -7
  59. package/dist-vue/_chunks/{PkChatbotViewChat-DIfBWFoG.js.map → PkChatbotViewChat-CQ5WcZs8.js.map} +1 -1
  60. package/dist-vue/_chunks/{PkChatbotViewConversations-BCdolW0R.js → PkChatbotViewConversations-CHpN4vhm.js} +2 -2
  61. package/dist-vue/_chunks/{PkChatbotViewConversations-BCdolW0R.js.map → PkChatbotViewConversations-CHpN4vhm.js.map} +1 -1
  62. package/dist-vue/_chunks/{PkChatbotViewFiles-Cudao8ew.js → PkChatbotViewFiles-Bk9-K6Hw.js} +3 -3
  63. package/dist-vue/_chunks/{PkChatbotViewFiles-Cudao8ew.js.map → PkChatbotViewFiles-Bk9-K6Hw.js.map} +1 -1
  64. package/dist-vue/_chunks/{PkChatbotViewProfile-DDsKOkcC.js → PkChatbotViewProfile-CosaHA-g.js} +2 -2
  65. package/dist-vue/_chunks/{PkChatbotViewProfile-DDsKOkcC.js.map → PkChatbotViewProfile-CosaHA-g.js.map} +1 -1
  66. package/dist-vue/_chunks/{PkStreamingMarkdown-BloMJaIW.js → PkStreamingMarkdown-DYy79C1P.js} +214 -205
  67. package/dist-vue/_chunks/{PkStreamingMarkdown-BloMJaIW.js.map → PkStreamingMarkdown-DYy79C1P.js.map} +1 -1
  68. package/dist-vue/_chunks/{PkToolRequestGeolocation-9vfYNaQo.js → PkToolRequestGeolocation-BOVbaCzQ.js} +2 -2
  69. package/{dist/_chunks/PkToolRequestGeolocation-BbxYKt-9.js.map → dist-vue/_chunks/PkToolRequestGeolocation-BOVbaCzQ.js.map} +1 -1
  70. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BorR5NmZ.js → PkToolRequestOAuthConnection-DMvCGPuX.js} +2 -2
  71. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BorR5NmZ.js.map → PkToolRequestOAuthConnection-DMvCGPuX.js.map} +1 -1
  72. package/dist-vue/_chunks/{PkToolShowArtifact-BuMY7GNj.js → PkToolShowArtifact-DUOnFdfa.js} +2 -2
  73. package/dist-vue/_chunks/{PkToolShowArtifact-BuMY7GNj.js.map → PkToolShowArtifact-DUOnFdfa.js.map} +1 -1
  74. package/dist-vue/_chunks/PkToolShowComparison-DQs3E6-k.js +72 -0
  75. package/dist-vue/_chunks/PkToolShowComparison-DQs3E6-k.js.map +1 -0
  76. package/dist-vue/_chunks/{PkToolShowContactForm-0OQRqT8m.js → PkToolShowContactForm-1TFKvG_s.js} +2 -2
  77. package/dist-vue/_chunks/{PkToolShowContactForm-0OQRqT8m.js.map → PkToolShowContactForm-1TFKvG_s.js.map} +1 -1
  78. package/dist-vue/_chunks/{PkToolShowDiagram-BGL27iHG.js → PkToolShowDiagram-BziggKVa.js} +2 -2
  79. package/dist-vue/_chunks/{PkToolShowDiagram-BGL27iHG.js.map → PkToolShowDiagram-BziggKVa.js.map} +1 -1
  80. package/dist-vue/_chunks/{PkToolShowEmail-BJJpS69F.js → PkToolShowEmail-BDsBoETQ.js} +2 -2
  81. package/dist-vue/_chunks/{PkToolShowEmail-BJJpS69F.js.map → PkToolShowEmail-BDsBoETQ.js.map} +1 -1
  82. package/dist-vue/_chunks/{PkToolShowForm-DDcPpOZ8.js → PkToolShowForm-DwFKxMJd.js} +4 -4
  83. package/dist-vue/_chunks/{PkToolShowForm-DDcPpOZ8.js.map → PkToolShowForm-DwFKxMJd.js.map} +1 -1
  84. package/dist-vue/_chunks/{PkToolShowMessage-BFGynf3p.js → PkToolShowMessage-Dau3agUy.js} +2 -2
  85. package/dist-vue/_chunks/{PkToolShowMessage-BFGynf3p.js.map → PkToolShowMessage-Dau3agUy.js.map} +1 -1
  86. package/dist-vue/_chunks/{PkToolShowProductList-6t1Ir5CW.js → PkToolShowProductList-CsupMsuy.js} +2 -2
  87. package/dist-vue/_chunks/{PkToolShowProductList-6t1Ir5CW.js.map → PkToolShowProductList-CsupMsuy.js.map} +1 -1
  88. package/dist-vue/_chunks/{PkToolShowSources-cOF0ZxOj.js → PkToolShowSources-TzkNgwnr.js} +4 -4
  89. package/dist-vue/_chunks/{PkToolShowSources-cOF0ZxOj.js.map → PkToolShowSources-TzkNgwnr.js.map} +1 -1
  90. package/dist-vue/_chunks/{PkToolShowSuggestedReply-DA4NEjHB.js → PkToolShowSuggestedReply-qAWdCUhr.js} +2 -2
  91. package/dist-vue/_chunks/{PkToolShowSuggestedReply-DA4NEjHB.js.map → PkToolShowSuggestedReply-qAWdCUhr.js.map} +1 -1
  92. package/dist-vue/_chunks/{PkToolShowWebPages-OgaT1vYJ.js → PkToolShowWebPages-D4E3Xzg1.js} +2 -2
  93. package/dist-vue/_chunks/{PkToolShowWebPages-OgaT1vYJ.js.map → PkToolShowWebPages-D4E3Xzg1.js.map} +1 -1
  94. package/dist-vue/_chunks/{PkUrl-Cd69XP5z.js → PkUrl-Cu3qKl4G.js} +2 -2
  95. package/dist-vue/_chunks/{PkUrl-Cd69XP5z.js.map → PkUrl-Cu3qKl4G.js.map} +1 -1
  96. package/dist-vue/_chunks/{createChatbotApiClient-CaVLm5W9.js → createChatbotApiClient-BlWs282E.js} +137 -168
  97. package/dist-vue/_chunks/createChatbotApiClient-BlWs282E.js.map +1 -0
  98. package/dist-vue/_chunks/{useChatbotStore-BwrBZJCq.js → useChatbotStore-CMo47fnS.js} +3 -3
  99. package/dist-vue/_chunks/{useChatbotStore-BwrBZJCq.js.map → useChatbotStore-CMo47fnS.js.map} +1 -1
  100. package/dist-vue/_chunks/utils-B45A2ONa.js +184 -0
  101. package/dist-vue/_chunks/utils-B45A2ONa.js.map +1 -0
  102. package/dist-vue/api.js +1 -1
  103. package/dist-vue/apps/web-component/src/components/EmbeddedChatWidget.ce.d.ts +4 -4
  104. package/dist-vue/apps/web-component/src/composables/useChatbotAuth.d.ts +54 -8
  105. package/dist-vue/apps/web-component/src/composables/useChatbotAuthForm.d.ts +14 -0
  106. package/dist-vue/composables.js +530 -114
  107. package/dist-vue/composables.js.map +1 -1
  108. package/dist-vue/index.js +3363 -3239
  109. package/dist-vue/index.js.map +1 -1
  110. package/dist-vue/locales.js +44 -0
  111. package/dist-vue/packages/ability/src/index.d.ts +10 -14
  112. package/dist-vue/packages/auth/src/add-member-to-organization.d.ts +8 -2
  113. package/dist-vue/packages/auth/src/additional-fields.d.ts +48 -0
  114. package/dist-vue/packages/auth/src/organization-member-limit.d.ts +12 -0
  115. package/dist-vue/packages/auth/src/passkey-policy-client-plugin.d.ts +31 -0
  116. package/dist-vue/packages/auth/src/passkey-policy-plugin.d.ts +22 -0
  117. package/dist-vue/packages/auth/src/social-redirect-plugin.d.ts +18 -12
  118. package/dist-vue/packages/auth/src/two-factor-admin-plugin.d.ts +2 -0
  119. package/dist-vue/packages/auth/src/two-factor-policy-client-plugin.d.ts +163 -0
  120. package/dist-vue/packages/auth/src/two-factor-policy-plugin.d.ts +106 -0
  121. package/dist-vue/packages/components/src/PkQrCode.d.ts +14 -0
  122. package/dist-vue/packages/components/src/chat/PkChatbotAuth.d.ts +19 -0
  123. package/dist-vue/packages/components/src/chat/PkChatbotMessages.d.ts +8 -4
  124. package/dist-vue/packages/components/src/chat/PkChatbotSteps.d.ts +1 -0
  125. package/dist-vue/packages/components/src/chat/PkTurnEvaluation.d.ts +8 -0
  126. package/dist-vue/packages/components/src/chat/utils.d.ts +9 -0
  127. package/dist-vue/packages/components/src/index.d.ts +2 -1
  128. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +60 -0
  129. package/dist-vue/packages/models/src/schema/Chat.d.ts +42 -0
  130. package/dist-vue/packages/models/src/schema/Document.d.ts +17 -0
  131. package/dist-vue/packages/models/src/schema/DocumentFolder.d.ts +10 -0
  132. package/dist-vue/packages/models/src/schema/DocumentSyncSource.d.ts +71 -1
  133. package/dist-vue/packages/models/src/schema/Lead.d.ts +1 -1
  134. package/dist-vue/packages/models/src/schema/McpServer.d.ts +13 -0
  135. package/dist-vue/packages/models/src/schema/Media.d.ts +0 -1
  136. package/dist-vue/packages/models/src/schema/Member.d.ts +10 -0
  137. package/dist-vue/packages/models/src/schema/Notification.d.ts +31 -0
  138. package/dist-vue/packages/models/src/schema/Organization.d.ts +20 -0
  139. package/dist-vue/packages/models/src/schema/SignInSecurity.d.ts +168 -0
  140. package/dist-vue/packages/models/src/schema/User.d.ts +1 -0
  141. package/dist-vue/packages/models/src/schema/index.d.ts +1 -0
  142. package/dist-vue/style.css +1 -1
  143. package/package.json +1 -1
  144. package/dist/_chunks/Agent-DTLrWpzX.js +0 -460
  145. package/dist/_chunks/Agent-DTLrWpzX.js.map +0 -1
  146. package/dist/_chunks/Media-Cft7Pwrh.js +0 -108
  147. package/dist/_chunks/Media-Cft7Pwrh.js.map +0 -1
  148. package/dist/_chunks/PkStreamingMarkdown-C1sANAr5.js.map +0 -1
  149. package/dist/_chunks/PkToolShowComparison-BJ7QBXtf.js +0 -60
  150. package/dist/_chunks/PkToolShowComparison-BJ7QBXtf.js.map +0 -1
  151. package/dist/_chunks/markdown-BRD-hDrH.js.map +0 -1
  152. package/dist-vue/_chunks/Document-2X01-F4Z.js.map +0 -1
  153. package/dist-vue/_chunks/PkChatbotAuth-Bi508F1u.js +0 -349
  154. package/dist-vue/_chunks/PkChatbotAuth-Bi508F1u.js.map +0 -1
  155. package/dist-vue/_chunks/PkChatbotMessages-GZStJbx_.js.map +0 -1
  156. package/dist-vue/_chunks/PkChatbotSteps-Cl4pVtPJ.js +0 -190
  157. package/dist-vue/_chunks/PkChatbotSteps-Cl4pVtPJ.js.map +0 -1
  158. package/dist-vue/_chunks/PkToolShowComparison-BLn4pkno.js +0 -61
  159. package/dist-vue/_chunks/PkToolShowComparison-BLn4pkno.js.map +0 -1
  160. package/dist-vue/_chunks/createChatbotApiClient-CaVLm5W9.js.map +0 -1
  161. package/dist-vue/_chunks/utils-h4C7rRcu.js +0 -177
  162. package/dist-vue/_chunks/utils-h4C7rRcu.js.map +0 -1
@@ -305,6 +305,7 @@ var e = {
305
305
  toolApprovalBadge: "User confirm",
306
306
  calendarEvent: "Event",
307
307
  comparison: "Comparison",
308
+ recommended: "Recommended",
308
309
  contactUs: "Contact us",
309
310
  phone: "Phone number",
310
311
  diagram: "Diagram",
@@ -470,6 +471,18 @@ var e = {
470
471
  untitled: "Untitled file",
471
472
  exclude: "Remove file"
472
473
  },
474
+ twoFactor: {
475
+ challengeBackup: "Enter one of the backup codes you saved.",
476
+ challengeEmailSent: "We sent a 6-digit code to your email. It expires in 5 minutes.",
477
+ challengeApp: "Enter the 6-digit code from your authenticator app.",
478
+ challengeTitle: "Two-step verification",
479
+ backupCode: "Backup code",
480
+ code: "6-digit code",
481
+ verify: "Verify",
482
+ useBackupCode: "Use a backup code",
483
+ useApp: "Use the authenticator app",
484
+ sendAgain: "Send a new code"
485
+ },
473
486
  auth: {
474
487
  signInTitle: "Sign in to your account",
475
488
  signUpTitle: "Create your account",
@@ -527,6 +540,7 @@ var e = {
527
540
  showImageGallery: "Loading gallery...",
528
541
  showVideo: "Loading video...",
529
542
  showSuggestedReply: "Suggest a reply...",
543
+ disconnectOAuthConnection: "Disconnecting...",
530
544
  webSearch: "Searching the web...",
531
545
  tool: "Running a tool...",
532
546
  reasoning: "Reasoning...",
@@ -567,6 +581,14 @@ var e = {
567
581
  feelsLike: "Feels like",
568
582
  dailyForecast: "Daily forecast",
569
583
  airQuality: "Air quality"
584
+ },
585
+ turnEvaluation: {
586
+ cost: "Cost, not charged to the organization: {cost}",
587
+ title: "Evaluation after the reply",
588
+ modeHint: "Recorded after the reply, with no effect: nothing reads these probabilities yet.",
589
+ version: "Questions version {version}",
590
+ leadFailed: "The evaluation failed or did not answer within {budget} ms: nothing was recorded.",
591
+ probability: "Probability the evaluation model gives to the question: from 0.5 it leans towards yes"
570
592
  }
571
593
  }, t = {
572
594
  agentType: {
@@ -874,6 +896,7 @@ var e = {
874
896
  toolApprovalBadge: "Conferma utente",
875
897
  calendarEvent: "Evento",
876
898
  comparison: "Confronto",
899
+ recommended: "Consigliato",
877
900
  contactUs: "Contattaci",
878
901
  phone: "Telefono",
879
902
  diagram: "Diagramma",
@@ -1039,6 +1062,18 @@ var e = {
1039
1062
  untitled: "File senza nome",
1040
1063
  exclude: "Rimuovi file"
1041
1064
  },
1065
+ twoFactor: {
1066
+ challengeBackup: "Scrivi uno dei codici di recupero che hai salvato.",
1067
+ challengeEmailSent: "Ti abbiamo inviato un codice a 6 cifre via email. Scade fra 5 minuti.",
1068
+ challengeApp: "Scrivi il codice a 6 cifre della tua app di autenticazione.",
1069
+ challengeTitle: "Verifica in due passaggi",
1070
+ backupCode: "Codice di recupero",
1071
+ code: "Codice a 6 cifre",
1072
+ verify: "Verifica",
1073
+ useBackupCode: "Usa un codice di recupero",
1074
+ useApp: "Usa l'app di autenticazione",
1075
+ sendAgain: "Invia un nuovo codice"
1076
+ },
1042
1077
  auth: {
1043
1078
  signInTitle: "Accedi al tuo account",
1044
1079
  signUpTitle: "Crea il tuo account",
@@ -1096,6 +1131,7 @@ var e = {
1096
1131
  showImageGallery: "Caricamento galleria...",
1097
1132
  showVideo: "Caricamento video...",
1098
1133
  showSuggestedReply: "Suggerisco una risposta...",
1134
+ disconnectOAuthConnection: "Disconnessione in corso...",
1099
1135
  webSearch: "Ricerca sul web...",
1100
1136
  tool: "Esecuzione di un tool...",
1101
1137
  reasoning: "Ragionamento...",
@@ -1136,6 +1172,14 @@ var e = {
1136
1172
  feelsLike: "Percepita",
1137
1173
  dailyForecast: "Previsioni giornaliere",
1138
1174
  airQuality: "Qualità dell'aria"
1175
+ },
1176
+ turnEvaluation: {
1177
+ cost: "Costo, non addebitato all'organizzazione: {cost}",
1178
+ title: "Valutazione a fine turno",
1179
+ modeHint: "Registrata dopo la risposta, senza effetti: per ora nessuno legge queste probabilità.",
1180
+ version: "Versione delle domande: {version}",
1181
+ leadFailed: "La valutazione non è riuscita o non ha risposto entro {budget} ms: non è stato registrato niente.",
1182
+ probability: "Probabilità che il modello di valutazione dà alla domanda: da 0,5 in su propende per il sì"
1139
1183
  }
1140
1184
  };
1141
1185
  //#endregion
@@ -1,6 +1,5 @@
1
- import { MongoAbility, InferSubjects, ForcedSubject, Ability as PureAbility } from '@casl/ability';
1
+ import { MongoAbility, InferSubjects, ForcedSubject } from '@casl/ability';
2
2
  import { Action, Capability, Subject, Session } from './types';
3
- import { MongoQueryTopLevelOperators } from '@ucast/mongo2js';
4
3
  import { Statements, RoleInput, Role, ExactRoleStatements } from 'better-auth/plugins';
5
4
  export declare const OrganizationRoles: {
6
5
  readonly admin: "admin";
@@ -13,23 +12,20 @@ export declare const UserRoles: {
13
12
  readonly user: "user";
14
13
  };
15
14
  export type AbilitySubject = InferSubjects<'all' | Subject, true> | ForcedSubject<InferSubjects<'all' | Subject, true>>;
16
- type Ability = MongoAbility<[Action, AbilitySubject]>;
17
- export declare const ability: PureAbility<[Action, AbilitySubject], {
18
- [x: string]: any;
19
- [x: number]: any;
20
- [x: symbol]: any;
21
- } & MongoQueryTopLevelOperators<Record<PropertyKey, any>>>;
15
+ export type AppAbility = MongoAbility<[Action, AbilitySubject]>;
22
16
  export declare const isValidOrganizationRole: (role?: string | null) => role is keyof typeof OrganizationRoles;
23
17
  export declare const isValidUserRole: (role?: string | null) => role is keyof typeof UserRoles;
24
18
  export declare const getOrganizationRoleCapabilities: (currentSession?: Session | null) => Capability[];
25
19
  export declare const getUserRoleCapabilities: (currentSession?: Session | null) => Capability[];
26
20
  /**
27
- * Builds a standalone ability instance for a session, without touching the
28
- * shared singleton. Use for per-call checks outside the HTTP request flow
29
- * (e.g. MCP tool handlers).
21
+ * Builds the ability of one caller: the session's roles, or the guest rules
22
+ * when there is no session. Every call returns a new instance and this package
23
+ * keeps none: a server judges many callers at once, so an instance shared
24
+ * between them is judged by whoever wrote it last. The backend builds one per
25
+ * request (`request.ability`), the Platform MCP one per tool call, and the
26
+ * frontend keeps its own for the single user of the tab.
30
27
  */
31
- export declare const buildAbilityForSession: (currentSession?: Session | null) => Ability;
32
- export declare const updateAbilityFromSession: (currentSession?: Session | null) => void;
28
+ export declare const buildAbilityForSession: (currentSession?: Session | null) => AppAbility;
33
29
  export type PermissionMap = Partial<Record<Action, Subject>>;
34
30
  /**
35
31
  * Evaluates a route-style permission map ({ action: Subject }) against an
@@ -39,7 +35,7 @@ export type PermissionMap = Partial<Record<Action, Subject>>;
39
35
  * Single source of truth for both the HTTP preHandler and the Platform MCP
40
36
  * tool handlers.
41
37
  */
42
- export declare const findDeniedPermission: (abilityInstance: Pick<Ability, "can">, permissions: PermissionMap, payload?: unknown) => {
38
+ export declare const findDeniedPermission: (abilityInstance: Pick<AppAbility, "can">, permissions: PermissionMap, payload?: unknown) => {
43
39
  action: Action;
44
40
  subject: Subject;
45
41
  } | null;
@@ -1,5 +1,11 @@
1
1
  /**
2
2
  * Adds a user as member of an organization if not already present.
3
- * Shared by external-auth and organization-auto-join flows.
3
+ * Shared by external-auth and organization-auto-join flows. Only auto-join
4
+ * passes `respectMemberLimit`: the widget's external login must never fail
5
+ * because the organization is full. An automatic join does not take a seat
6
+ * an open invitation holds either, and a skipped one is not retried at the
7
+ * next sign-in: the person joins through an invitation once a seat is free.
4
8
  */
5
- export declare function addMemberToOrganizationIfNotExists(userId: string, organizationId: string, role?: string): Promise<boolean>;
9
+ export declare function addMemberToOrganizationIfNotExists(userId: string, organizationId: string, role?: string, { respectMemberLimit }?: {
10
+ respectMemberLimit?: boolean;
11
+ }): Promise<boolean>;
@@ -0,0 +1,48 @@
1
+ /** The columns the config adds to better-auth's session. */
2
+ export declare const sessionAdditionalFields: {
3
+ activeOrganizationId: {
4
+ type: "string";
5
+ };
6
+ impersonatedBy: {
7
+ type: "string";
8
+ };
9
+ organizationRole: {
10
+ type: "string";
11
+ };
12
+ hardExpiresAt: {
13
+ type: "date";
14
+ required: false;
15
+ input: false;
16
+ };
17
+ signedInWithPasskey: {
18
+ type: "boolean";
19
+ required: false;
20
+ input: false;
21
+ defaultValue: false;
22
+ };
23
+ };
24
+ /** The columns the config adds to better-auth's user. */
25
+ export declare const userAdditionalFields: {
26
+ media: {
27
+ type: "json";
28
+ required: false;
29
+ };
30
+ phoneNumber: {
31
+ type: "string";
32
+ required: false;
33
+ };
34
+ };
35
+ /**
36
+ * What `inferAdditionalFields` reads of the server options, for a client that
37
+ * must not load the config itself. The widget's type declarations are built
38
+ * from its imports, and the inferred type of the config, with the two-step
39
+ * verification and passkey plugins, is too long to serialize (TS7056).
40
+ */
41
+ export type AdditionalFieldsOptions = {
42
+ session: {
43
+ additionalFields: typeof sessionAdditionalFields;
44
+ };
45
+ user: {
46
+ additionalFields: typeof userAdditionalFields;
47
+ };
48
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Whether an organization already holds as many members as the limit the
3
+ * system panel set on it. An organization with no limit is never full.
4
+ * With `countPendingInvitations` an open invitation holds a seat until it is
5
+ * accepted or expires, so a new one cannot be sent for a seat another
6
+ * invitation already promised. The count runs outside the write that
7
+ * follows, like better-auth's own check: two joins racing for the last seat
8
+ * can both pass.
9
+ */
10
+ export declare function isOrganizationFull(organizationId: string, { countPendingInvitations, }?: {
11
+ countPendingInvitations?: boolean;
12
+ }): Promise<boolean>;
@@ -0,0 +1,31 @@
1
+ import { BetterFetch } from 'better-auth/client';
2
+ /**
3
+ * Client counterpart of the server `passkeyPolicy()` plugin, see
4
+ * docs/specs/two-factor-authentication.md, D10.
5
+ */
6
+ export declare function passkeyPolicyClient(): {
7
+ id: "passkey-policy";
8
+ getActions: ($fetch: BetterFetch) => {
9
+ passkeyPolicy: {
10
+ /** Lets the session add a passkey for the next five minutes. */
11
+ confirmPassword: (data: {
12
+ password: string;
13
+ }) => Promise<{
14
+ data: null;
15
+ error: {
16
+ message?: string | undefined;
17
+ status: number;
18
+ statusText: string;
19
+ };
20
+ } | {
21
+ data: {
22
+ status: boolean;
23
+ };
24
+ error: null;
25
+ }>;
26
+ };
27
+ };
28
+ pathMethods: {
29
+ '/passkey-policy/confirm-password': "POST";
30
+ };
31
+ };
@@ -0,0 +1,22 @@
1
+ import { BetterAuthPlugin } from 'better-auth';
2
+ /** Whether a session created on this route is opened with a passkey. */
3
+ export declare function isPasskeySessionPath(path: string | undefined): boolean;
4
+ /**
5
+ * Refuses a passkey that did not check who holds it (a PIN, a fingerprint, a
6
+ * face). With that check a passkey is two factors on its own, which is what
7
+ * lets it stand in for the password and the code; without it, it is a key
8
+ * anyone holding the device can use. better-auth leaves the check off.
9
+ */
10
+ export declare function requirePasskeyUserVerification(userVerified: boolean | undefined): void;
11
+ /**
12
+ * The confirmation that guards adding a passkey, the announcements of D7 for
13
+ * passkeys and the rate limit of the confirmation.
14
+ *
15
+ * A passkey signs in without the password and without the code, so adding
16
+ * one is as strong as setting the password: the session alone is not enough,
17
+ * since a stolen one would leave a way in that outlives it (there is no
18
+ * freshness window, see `freshAge` in packages/auth/src/index.ts). The
19
+ * password is asked again, or, for an account without one, a sign-in in the
20
+ * last ten minutes.
21
+ */
22
+ export declare function passkeyPolicy(): BetterAuthPlugin;
@@ -1,22 +1,28 @@
1
1
  import { BetterAuthPlugin } from 'better-auth';
2
2
  /**
3
- * Backs the widget social-login OAuth popup flow end to end.
3
+ * Whether `value` is exactly one of the trusted origins: a bare origin, listed
4
+ * as it is. better-auth matches its trusted origins as patterns, so an agent
5
+ * whose trusted origins hold `*` would let any page through; the CORS plugin
6
+ * (apps/backend/src/plugins/fastifyCors.ts) compares them exactly, and a widget
7
+ * whose host it refuses cannot run anyway.
8
+ */
9
+ export declare function isListedOrigin(value: string, trusted: string[]): boolean;
10
+ /**
11
+ * Backs the social sign-in that runs in a browser window on the backend origin.
4
12
  *
5
13
  * `socialRedirect` initiates the flow through a top-level GET navigation instead
6
14
  * of the default `POST /sign-in/social` XHR call. Better-auth's social sign-in
7
15
  * sets a signed `state` cookie that the OAuth callback verifies (CSRF
8
- * protection). When the flow is started from an XHR on a different origin (e.g.
9
- * the embeddable widget, or any cross-site context), that `Set-Cookie` is a
10
- * third-party cookie and modern browsers drop it, so the callback fails with
11
- * `state_mismatch`. By navigating the browser (popup or full page) directly to
16
+ * protection). When the flow is started from an XHR on a different origin, that
17
+ * `Set-Cookie` is a third-party cookie and modern browsers drop it, so the
18
+ * callback fails with `state_mismatch`. By navigating the browser directly to
12
19
  * this endpoint on the backend origin, the `state` cookie is set first-party and
13
- * survives, both in development and in production on customer domains. It mirrors
14
- * the redirect branch of core `signInSocial`, reusing `generateState` so the
15
- * stored state stays compatible with the standard OAuth callback.
20
+ * survives. It mirrors the redirect branch of core `signInSocial`, reusing
21
+ * `generateState` so the stored state stays compatible with the standard OAuth
22
+ * callback. The frontend uses it; the widget's popup uses `oauthPopup`, whose
23
+ * callback hands back the token of the session it just created, and only to the
24
+ * origin that started it.
16
25
  *
17
- * `widgetOAuthCallback` is the landing page the popup ends on after the OAuth
18
- * callback completes (it's the `callbackURL` passed to `socialRedirect`). It runs
19
- * on the backend origin so it can read the first-party session cookie and post the
20
- * Bearer token back to the widget opener.
26
+ * The before hook narrows the origin `oauthPopup` accepts to the listed ones.
21
27
  */
22
28
  export declare function socialRedirect(): BetterAuthPlugin;
@@ -0,0 +1,2 @@
1
+ import { BetterAuthPlugin } from 'better-auth';
2
+ export declare function twoFactorAdmin(): BetterAuthPlugin;
@@ -0,0 +1,163 @@
1
+ import { SignInSecurityState } from '../../models/src';
2
+ import { BetterFetch } from 'better-auth/client';
3
+ /**
4
+ * What `GET /two-factor-policy/user-security` answers to a system
5
+ * administrator, see docs/specs/two-factor-system-assistance.md (D3). Dates
6
+ * arrive as ISO strings.
7
+ */
8
+ export interface UserSignInSecurity {
9
+ state: SignInSecurityState;
10
+ factor: {
11
+ enabled: boolean;
12
+ method: 'totp' | 'otp' | null;
13
+ backupCodesRemaining: number | null;
14
+ /** Wrong codes in a row since the last right one. */
15
+ failedAttempts: number;
16
+ /** Set only while the pause after too many wrong codes lasts. */
17
+ lockedUntil: string | null;
18
+ };
19
+ passkeys: {
20
+ id: string;
21
+ name: string | null;
22
+ /** `multiDevice` when synced across the user's devices. */
23
+ deviceType: string;
24
+ backedUp: boolean;
25
+ createdAt: string | null;
26
+ }[];
27
+ trustedDevices: {
28
+ count: number;
29
+ lastExpiresAt: string | null;
30
+ };
31
+ hasPassword: boolean;
32
+ requiredBy: {
33
+ id: string;
34
+ name: string;
35
+ }[];
36
+ /** The latest changes, from the notices the user received. */
37
+ changes: {
38
+ action: string;
39
+ createdAt: string;
40
+ }[];
41
+ }
42
+ /** What `GET /two-factor-policy/status` answers. */
43
+ export interface TwoFactorStatus {
44
+ enabled: boolean;
45
+ /** `totp` for an authenticator app, `otp` for the code sent by email. */
46
+ method: 'totp' | 'otp' | null;
47
+ /** The second factor protects a password: without one it is not offered. */
48
+ hasPassword: boolean;
49
+ /** An organization of the user requires it and it is not set up yet. */
50
+ required: boolean;
51
+ /** The user's organizations that require it. */
52
+ requiredBy: {
53
+ id: string;
54
+ name: string;
55
+ }[];
56
+ /** Backup codes left, with an authenticator app; null otherwise. */
57
+ backupCodesRemaining: number | null;
58
+ /** Passkeys of the user: a session opened with one meets the policy. */
59
+ passkeys: number;
60
+ }
61
+ /**
62
+ * Client counterpart of the server `twoFactorPolicy()` and `twoFactorAdmin()`
63
+ * plugins, see docs/specs/two-factor-authentication.md and
64
+ * docs/specs/two-factor-system-assistance.md.
65
+ */
66
+ export declare function twoFactorPolicyClient(): {
67
+ id: "two-factor-policy";
68
+ getActions: ($fetch: BetterFetch) => {
69
+ twoFactorPolicy: {
70
+ status: () => Promise<{
71
+ data: null;
72
+ error: {
73
+ message?: string | undefined;
74
+ status: number;
75
+ statusText: string;
76
+ };
77
+ } | {
78
+ data: TwoFactorStatus;
79
+ error: null;
80
+ }>;
81
+ reset: (data: {
82
+ userId: string;
83
+ }) => Promise<{
84
+ data: null;
85
+ error: {
86
+ message?: string | undefined;
87
+ status: number;
88
+ statusText: string;
89
+ };
90
+ } | {
91
+ data: {
92
+ status: boolean;
93
+ };
94
+ error: null;
95
+ }>;
96
+ userSecurity: (query: {
97
+ userId: string;
98
+ }) => Promise<{
99
+ data: null;
100
+ error: {
101
+ message?: string | undefined;
102
+ status: number;
103
+ statusText: string;
104
+ };
105
+ } | {
106
+ data: UserSignInSecurity;
107
+ error: null;
108
+ }>;
109
+ unlock: (data: {
110
+ userId: string;
111
+ }) => Promise<{
112
+ data: null;
113
+ error: {
114
+ message?: string | undefined;
115
+ status: number;
116
+ statusText: string;
117
+ };
118
+ } | {
119
+ data: {
120
+ status: boolean;
121
+ };
122
+ error: null;
123
+ }>;
124
+ removePasskey: (data: {
125
+ userId: string;
126
+ passkeyId: string;
127
+ }) => Promise<{
128
+ data: null;
129
+ error: {
130
+ message?: string | undefined;
131
+ status: number;
132
+ statusText: string;
133
+ };
134
+ } | {
135
+ data: {
136
+ status: boolean;
137
+ };
138
+ error: null;
139
+ }>;
140
+ forgetTrustedDevices: (data: {
141
+ userId: string;
142
+ }) => Promise<{
143
+ data: null;
144
+ error: {
145
+ message?: string | undefined;
146
+ status: number;
147
+ statusText: string;
148
+ };
149
+ } | {
150
+ data: {
151
+ status: boolean;
152
+ };
153
+ error: null;
154
+ }>;
155
+ };
156
+ };
157
+ pathMethods: {
158
+ '/two-factor-policy/reset': "POST";
159
+ '/two-factor-policy/unlock': "POST";
160
+ '/two-factor-policy/remove-passkey': "POST";
161
+ '/two-factor-policy/forget-trusted-devices': "POST";
162
+ };
163
+ };
@@ -0,0 +1,106 @@
1
+ import { BetterAuthPlugin } from 'better-auth';
2
+ import { createAuthMiddleware } from 'better-auth/api';
3
+ import { symmetricDecrypt } from 'better-auth/crypto';
4
+ import { TwoFactorChange } from 'email';
5
+ /**
6
+ * Carries the challenge for a client that cannot hold the cookie: the widget,
7
+ * cross-origin and on bearer tokens (D4). The value is the signed cookie as
8
+ * the sign-in set it.
9
+ */
10
+ export declare const TWO_FACTOR_TOKEN_HEADER = "x-two-factor-token";
11
+ /** Time the code sent by email stays valid, in minutes. */
12
+ export declare const TWO_FACTOR_OTP_PERIOD_MINUTES = 5;
13
+ export type TwoFactorRow = {
14
+ id: string;
15
+ userId: string;
16
+ backupCodes: string;
17
+ verified?: boolean | null;
18
+ failedVerificationCount?: number | null;
19
+ lockedUntil?: Date | string | null;
20
+ };
21
+ type ChangedUser = {
22
+ id: string;
23
+ email: string;
24
+ name: string;
25
+ };
26
+ export type MiddlewareContext = Parameters<Parameters<typeof createAuthMiddleware>[0]>[0];
27
+ /**
28
+ * Tells the user that their second factor or their passkeys changed (D7, D10),
29
+ * by email and in the notification panel. Never throws: the change is already
30
+ * written.
31
+ */
32
+ export declare function announceTwoFactorChange(user: ChangedUser, change: TwoFactorChange): Promise<void>;
33
+ /**
34
+ * The verification rows that remember a device on which the user chose to
35
+ * skip the code: the `twoFactor` plugin names them `trust-device-<id>` and
36
+ * stores the user id as their value.
37
+ */
38
+ export declare function trustedDeviceWhere(userId: string): ({
39
+ field: string;
40
+ value: string;
41
+ operator?: undefined;
42
+ } | {
43
+ field: string;
44
+ operator: "starts_with";
45
+ value: string;
46
+ })[];
47
+ /**
48
+ * Forgets every device on which the user chose to skip the code. They are
49
+ * verification rows holding the user id: left in place, one would skip the
50
+ * code once the factor is on again, on a device that may be the lost one.
51
+ * The plugin itself forgets only the device the factor is turned off from.
52
+ */
53
+ export declare function forgetTrustedDevices(adapter: MiddlewareContext['context']['adapter'], userId: string): Promise<number>;
54
+ /**
55
+ * How many recovery codes the user has left, or null when it cannot be told.
56
+ * better-auth keeps them encrypted with its secret, so only the count leaves
57
+ * this function, never a code.
58
+ */
59
+ export declare function countBackupCodes(ctx: {
60
+ context: {
61
+ secretConfig: Parameters<typeof symmetricDecrypt>[0]['key'];
62
+ };
63
+ }, row: Pick<TwoFactorRow, 'backupCodes'>): Promise<number | null>;
64
+ type PolicyOrganization = {
65
+ requireTwoFactor?: boolean | null;
66
+ deleted?: boolean | null;
67
+ };
68
+ /**
69
+ * Whether the request has to stop for the organization policy (D6): the
70
+ * session of a member of an organization that requires a second factor, who
71
+ * signs in with a password and has none. `organizations` is what the caller
72
+ * already listed for the request, so the common case costs no query, or a
73
+ * loader that runs only once the cheap exemptions are past; the password
74
+ * check is cached, since most users have no second factor. Impersonation and
75
+ * anonymous sessions are exempt, and so is a deleted organization, which the
76
+ * status endpoint does not list either: counted here alone, it would bounce
77
+ * the user between the setup page and the app.
78
+ *
79
+ * A session opened with a passkey meets the policy (D10), and so does a user
80
+ * with a passkey where no session tells how they signed in: a Platform MCP
81
+ * token, whose authorization ran in a session the policy let through.
82
+ */
83
+ export declare function isTwoFactorSetupRequiredForSession(input: {
84
+ user: {
85
+ id: string;
86
+ twoFactorEnabled?: boolean | null;
87
+ isAnonymous?: boolean | null;
88
+ hasPasskey?: boolean;
89
+ };
90
+ session: {
91
+ impersonatedBy?: string | null;
92
+ signedInWithPasskey?: boolean | null;
93
+ };
94
+ organizations: readonly PolicyOrganization[] | (() => Promise<readonly PolicyOrganization[]>);
95
+ }): Promise<boolean>;
96
+ /**
97
+ * The status endpoint, the widget bridge and the announcements of
98
+ * docs/specs/two-factor-authentication.md. The administrator's endpoints are
99
+ * in two-factor-admin-plugin.ts.
100
+ *
101
+ * The endpoints live under `/two-factor-policy/` and not `/two-factor/` on
102
+ * purpose: the `twoFactor` plugin rate limits its prefix to three requests
103
+ * every ten seconds, which a profile page reading the status would hit.
104
+ */
105
+ export declare function twoFactorPolicy(): BetterAuthPlugin;
106
+ export {};
@@ -0,0 +1,14 @@
1
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ /**
3
+ * A QR code drawn as inline SVG, with `qrcode` loaded on first use. The
4
+ * code stays dark on a white ground whatever the theme: a scanner reads
5
+ * the contrast, and not every one reads it inverted.
6
+ */
7
+ type __VLS_Props = {
8
+ value: string;
9
+ /** What the code holds, for a screen reader. */
10
+ label: string;
11
+ };
12
+ declare const __VLS_export: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
@@ -4,6 +4,12 @@ type __VLS_Props = {
4
4
  branding?: AgentBranding;
5
5
  authMethods?: AuthMethods;
6
6
  loading?: boolean;
7
+ /**
8
+ * Set while an email sign-in waits for its second factor: the
9
+ * methods the account has (`totp`, `otp`). The code step replaces
10
+ * the forms until it is answered or cancelled.
11
+ */
12
+ twoFactorMethods?: string[];
7
13
  };
8
14
  type __VLS_ModelProps = {
9
15
  'errorMessage'?: string | undefined;
@@ -43,6 +49,12 @@ declare const __VLS_export: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, C
43
49
  email: string;
44
50
  }) => any;
45
51
  social: (provider: "google" | "microsoft") => any;
52
+ "verify-two-factor": (payload: {
53
+ kind: "totp" | "otp" | "backup";
54
+ code: string;
55
+ }) => any;
56
+ "send-two-factor-code": () => any;
57
+ "cancel-two-factor": () => any;
46
58
  }, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
47
59
  "onUpdate:errorMessage"?: ((message?: string | undefined) => any) | undefined;
48
60
  "onUpdate:success"?: ((value?: {
@@ -63,10 +75,17 @@ declare const __VLS_export: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, C
63
75
  email: string;
64
76
  }) => any) | undefined;
65
77
  onSocial?: ((provider: "google" | "microsoft") => any) | undefined;
78
+ "onVerify-two-factor"?: ((payload: {
79
+ kind: "totp" | "otp" | "backup";
80
+ code: string;
81
+ }) => any) | undefined;
82
+ "onSend-two-factor-code"?: (() => any) | undefined;
83
+ "onCancel-two-factor"?: (() => any) | undefined;
66
84
  }>, {
67
85
  branding: AgentBranding;
68
86
  authMethods: AuthMethods;
69
87
  loading: boolean;
88
+ twoFactorMethods: string[];
70
89
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
71
90
  declare const _default: typeof __VLS_export;
72
91
  export default _default;