@8wave/ai-elements 0.112.0 → 0.114.0-beta.15

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 (118) hide show
  1. package/dist/_chunks/Agent-D3ODaN3E.js +566 -0
  2. package/dist/_chunks/Agent-D3ODaN3E.js.map +1 -0
  3. package/dist/_chunks/{PkStreamingMarkdown-CRlRDGYl.js → PkStreamingMarkdown-CYOm47PX.js} +1276 -453
  4. package/dist/_chunks/PkStreamingMarkdown-CYOm47PX.js.map +1 -0
  5. package/dist/_chunks/{PkToolRequestGeolocation-BbxYKt-9.js → PkToolRequestGeolocation-BY7nXImb.js} +2 -2
  6. package/dist/_chunks/{PkToolRequestGeolocation-BbxYKt-9.js.map → PkToolRequestGeolocation-BY7nXImb.js.map} +1 -1
  7. package/dist/_chunks/{PkToolRequestOAuthConnection-CTp2w60F.js → PkToolRequestOAuthConnection-DFOTALFt.js} +2 -2
  8. package/dist/_chunks/{PkToolRequestOAuthConnection-CTp2w60F.js.map → PkToolRequestOAuthConnection-DFOTALFt.js.map} +1 -1
  9. package/dist/_chunks/{PkToolShowArtifact-CNnt82aH.js → PkToolShowArtifact-DzHRWoru.js} +2 -2
  10. package/dist/_chunks/{PkToolShowArtifact-CNnt82aH.js.map → PkToolShowArtifact-DzHRWoru.js.map} +1 -1
  11. package/dist/_chunks/{PkToolShowContactForm-D77gyjQG.js → PkToolShowContactForm-1J6_1AA2.js} +2 -2
  12. package/dist/_chunks/{PkToolShowContactForm-D77gyjQG.js.map → PkToolShowContactForm-1J6_1AA2.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowForm-DP4LLAk3.js → PkToolShowForm-DmQYj3v1.js} +5 -5
  14. package/dist/_chunks/{PkToolShowForm-DP4LLAk3.js.map → PkToolShowForm-DmQYj3v1.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowSources-Bwy0Ptmi.js → PkToolShowSources-BO8V5rlS.js} +3 -3
  16. package/dist/_chunks/{PkToolShowSources-Bwy0Ptmi.js.map → PkToolShowSources-BO8V5rlS.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowSuggestedReply-CFO8wV1b.js → PkToolShowSuggestedReply-CTWVG1Zk.js} +2 -2
  18. package/dist/_chunks/{PkToolShowSuggestedReply-CFO8wV1b.js.map → PkToolShowSuggestedReply-CTWVG1Zk.js.map} +1 -1
  19. package/dist/_chunks/{markdown-BRD-hDrH.js → markdown-JpLFzufn.js} +7 -7
  20. package/dist/_chunks/{markdown-BRD-hDrH.js.map → markdown-JpLFzufn.js.map} +1 -1
  21. package/dist/_chunks/url-validation-uLMZ5-AU.js.map +1 -1
  22. package/dist/ai-elements.es.js +2773 -2733
  23. package/dist/ai-elements.es.js.map +1 -1
  24. package/dist-vue/PkChatbot.js +1 -1
  25. package/dist-vue/PkChatbotEmptyState.js +1 -1
  26. package/dist-vue/PkChatbotInput.js +1 -1
  27. package/dist-vue/PkChatbotMessages.js +1 -1
  28. package/dist-vue/PkChatbotStepPayload.js +1 -1
  29. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  30. package/dist-vue/PkChatbotSteps.js +1 -1
  31. package/dist-vue/PkChatbotViewChat.js +1 -1
  32. package/dist-vue/PkChatbotViewConversations.js +1 -1
  33. package/dist-vue/PkChatbotViewFiles.js +1 -1
  34. package/dist-vue/PkChatbotViewProfile.js +1 -1
  35. package/dist-vue/_chunks/Media-_HfFLHGD.js.map +1 -1
  36. package/dist-vue/_chunks/{PkChatbot-C11EVHnI.js → PkChatbot-DZP40EZP.js} +8 -8
  37. package/dist-vue/_chunks/{PkChatbot-C11EVHnI.js.map → PkChatbot-DZP40EZP.js.map} +1 -1
  38. package/dist-vue/_chunks/{PkChatbotEmptyState-CacY4o02.js → PkChatbotEmptyState-DycCrfwz.js} +2 -2
  39. package/dist-vue/_chunks/{PkChatbotEmptyState-CacY4o02.js.map → PkChatbotEmptyState-DycCrfwz.js.map} +1 -1
  40. package/dist-vue/_chunks/{PkChatbotInput-Dkz3SNAk.js → PkChatbotInput-BCuqLdkT.js} +2 -2
  41. package/dist-vue/_chunks/{PkChatbotInput-Dkz3SNAk.js.map → PkChatbotInput-BCuqLdkT.js.map} +1 -1
  42. package/dist-vue/_chunks/PkChatbotMessages-PjKRDNYJ.js +776 -0
  43. package/dist-vue/_chunks/PkChatbotMessages-PjKRDNYJ.js.map +1 -0
  44. package/dist-vue/_chunks/{PkChatbotStepPayload-DU0W-eUp.js → PkChatbotStepPayload-CI98RiNv.js} +2 -2
  45. package/dist-vue/_chunks/{PkChatbotStepPayload-DU0W-eUp.js.map → PkChatbotStepPayload-CI98RiNv.js.map} +1 -1
  46. package/dist-vue/_chunks/{PkChatbotStepToolDetail-etlBryOg.js → PkChatbotStepToolDetail-B8zXJOdI.js} +3 -3
  47. package/dist-vue/_chunks/{PkChatbotStepToolDetail-etlBryOg.js.map → PkChatbotStepToolDetail-B8zXJOdI.js.map} +1 -1
  48. package/dist-vue/_chunks/PkChatbotSteps-CL27pMFS.js +190 -0
  49. package/dist-vue/_chunks/{PkChatbotSteps-jW07Q-4x.js.map → PkChatbotSteps-CL27pMFS.js.map} +1 -1
  50. package/dist-vue/_chunks/{PkChatbotViewChat-DJnjuhjt.js → PkChatbotViewChat-BZVcDXzL.js} +7 -7
  51. package/dist-vue/_chunks/{PkChatbotViewChat-DJnjuhjt.js.map → PkChatbotViewChat-BZVcDXzL.js.map} +1 -1
  52. package/dist-vue/_chunks/{PkChatbotViewConversations-BCdolW0R.js → PkChatbotViewConversations-Cx-mLdUE.js} +2 -2
  53. package/dist-vue/_chunks/{PkChatbotViewConversations-BCdolW0R.js.map → PkChatbotViewConversations-Cx-mLdUE.js.map} +1 -1
  54. package/dist-vue/_chunks/{PkChatbotViewFiles-Cudao8ew.js → PkChatbotViewFiles-DLIa-xG8.js} +2 -2
  55. package/dist-vue/_chunks/{PkChatbotViewFiles-Cudao8ew.js.map → PkChatbotViewFiles-DLIa-xG8.js.map} +1 -1
  56. package/dist-vue/_chunks/{PkChatbotViewProfile-DDsKOkcC.js → PkChatbotViewProfile-DEc9apXY.js} +2 -2
  57. package/dist-vue/_chunks/{PkChatbotViewProfile-DDsKOkcC.js.map → PkChatbotViewProfile-DEc9apXY.js.map} +1 -1
  58. package/dist-vue/_chunks/PkStreamingMarkdown-B2iju0WK.js +3245 -0
  59. package/dist-vue/_chunks/PkStreamingMarkdown-B2iju0WK.js.map +1 -0
  60. package/dist-vue/_chunks/{PkToolShowArtifact-BnwU7CV2.js → PkToolShowArtifact-C0J71YF6.js} +2 -2
  61. package/dist-vue/_chunks/{PkToolShowArtifact-BnwU7CV2.js.map → PkToolShowArtifact-C0J71YF6.js.map} +1 -1
  62. package/dist-vue/_chunks/{PkToolShowContactForm-_x_dbiHn.js → PkToolShowContactForm-De3Od9mC.js} +2 -2
  63. package/dist-vue/_chunks/{PkToolShowContactForm-_x_dbiHn.js.map → PkToolShowContactForm-De3Od9mC.js.map} +1 -1
  64. package/dist-vue/_chunks/{PkToolShowDiagram-RtkI_sKL.js → PkToolShowDiagram-DmY_hhAS.js} +2 -2
  65. package/dist-vue/_chunks/{PkToolShowDiagram-RtkI_sKL.js.map → PkToolShowDiagram-DmY_hhAS.js.map} +1 -1
  66. package/dist-vue/_chunks/{PkToolShowEmail-CRQjoJr1.js → PkToolShowEmail-D_Z15wCS.js} +2 -2
  67. package/dist-vue/_chunks/{PkToolShowEmail-CRQjoJr1.js.map → PkToolShowEmail-D_Z15wCS.js.map} +1 -1
  68. package/dist-vue/_chunks/{PkToolShowForm-IPAkJIXh.js → PkToolShowForm-DUGysIxj.js} +3 -3
  69. package/dist-vue/_chunks/{PkToolShowForm-IPAkJIXh.js.map → PkToolShowForm-DUGysIxj.js.map} +1 -1
  70. package/dist-vue/_chunks/{PkToolShowMessage-joTzAg9N.js → PkToolShowMessage-e5_EI5mV.js} +2 -2
  71. package/dist-vue/_chunks/{PkToolShowMessage-joTzAg9N.js.map → PkToolShowMessage-e5_EI5mV.js.map} +1 -1
  72. package/dist-vue/_chunks/{PkToolShowProductList-tOYjd2bq.js → PkToolShowProductList-B3X7Svyc.js} +2 -2
  73. package/dist-vue/_chunks/{PkToolShowProductList-tOYjd2bq.js.map → PkToolShowProductList-B3X7Svyc.js.map} +1 -1
  74. package/dist-vue/_chunks/{PkToolShowSources-gI947JOm.js → PkToolShowSources-BUjBSGc5.js} +3 -3
  75. package/dist-vue/_chunks/{PkToolShowSources-gI947JOm.js.map → PkToolShowSources-BUjBSGc5.js.map} +1 -1
  76. package/dist-vue/_chunks/{PkToolShowWebPages-D3Xy4iUs.js → PkToolShowWebPages-DEih8h5k.js} +2 -2
  77. package/dist-vue/_chunks/{PkToolShowWebPages-D3Xy4iUs.js.map → PkToolShowWebPages-DEih8h5k.js.map} +1 -1
  78. package/dist-vue/_chunks/{PkUrl-BgMBemSz.js → PkUrl-3NH9t-WA.js} +2 -2
  79. package/dist-vue/_chunks/{PkUrl-BgMBemSz.js.map → PkUrl-3NH9t-WA.js.map} +1 -1
  80. package/dist-vue/_chunks/{createChatbotApiClient-CaVLm5W9.js → createChatbotApiClient-DohvHshj.js} +115 -108
  81. package/dist-vue/_chunks/createChatbotApiClient-DohvHshj.js.map +1 -0
  82. package/dist-vue/_chunks/url-validation-uLMZ5-AU.js.map +1 -1
  83. package/dist-vue/_chunks/{useChatbotStore-BwrBZJCq.js → useChatbotStore-_10Jaf4z.js} +2 -2
  84. package/dist-vue/_chunks/{useChatbotStore-BwrBZJCq.js.map → useChatbotStore-_10Jaf4z.js.map} +1 -1
  85. package/dist-vue/_chunks/utils-BL4Ppr2R.js +184 -0
  86. package/dist-vue/_chunks/utils-BL4Ppr2R.js.map +1 -0
  87. package/dist-vue/api.js +1 -1
  88. package/dist-vue/apps/web-component/src/composables/useChatbotAuth.d.ts +1 -3
  89. package/dist-vue/composables.js +136 -95
  90. package/dist-vue/composables.js.map +1 -1
  91. package/dist-vue/index.js +3203 -3107
  92. package/dist-vue/index.js.map +1 -1
  93. package/dist-vue/locales.js +16 -0
  94. package/dist-vue/packages/auth/src/social-redirect-plugin.d.ts +18 -12
  95. package/dist-vue/packages/components/src/chat/PkTurnEvaluation.d.ts +8 -0
  96. package/dist-vue/packages/components/src/chat/markdownHtml.d.ts +20 -0
  97. package/dist-vue/packages/components/src/chat/utils.d.ts +9 -0
  98. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +60 -0
  99. package/dist-vue/packages/models/src/schema/AgentApiTool.d.ts +70 -0
  100. package/dist-vue/packages/models/src/schema/Chat.d.ts +42 -0
  101. package/dist-vue/packages/models/src/schema/Lead.d.ts +13 -0
  102. package/dist-vue/packages/models/src/schema/Media.d.ts +0 -1
  103. package/dist-vue/packages/models/src/schema/ModelProvider.d.ts +1 -1
  104. package/dist-vue/style.css +1 -1
  105. package/package.json +2 -1
  106. package/dist/_chunks/Agent-DTLrWpzX.js +0 -460
  107. package/dist/_chunks/Agent-DTLrWpzX.js.map +0 -1
  108. package/dist/_chunks/Media-Cft7Pwrh.js +0 -108
  109. package/dist/_chunks/Media-Cft7Pwrh.js.map +0 -1
  110. package/dist/_chunks/PkStreamingMarkdown-CRlRDGYl.js.map +0 -1
  111. package/dist-vue/_chunks/PkChatbotMessages-BD-vUak6.js +0 -776
  112. package/dist-vue/_chunks/PkChatbotMessages-BD-vUak6.js.map +0 -1
  113. package/dist-vue/_chunks/PkChatbotSteps-jW07Q-4x.js +0 -190
  114. package/dist-vue/_chunks/PkStreamingMarkdown-BoEpwaYQ.js +0 -2430
  115. package/dist-vue/_chunks/PkStreamingMarkdown-BoEpwaYQ.js.map +0 -1
  116. package/dist-vue/_chunks/createChatbotApiClient-CaVLm5W9.js.map +0 -1
  117. package/dist-vue/_chunks/utils-h4C7rRcu.js +0 -177
  118. package/dist-vue/_chunks/utils-h4C7rRcu.js.map +0 -1
@@ -567,6 +567,14 @@ var e = {
567
567
  feelsLike: "Feels like",
568
568
  dailyForecast: "Daily forecast",
569
569
  airQuality: "Air quality"
570
+ },
571
+ turnEvaluation: {
572
+ cost: "Cost, not charged to the organization: {cost}",
573
+ title: "Evaluation after the reply",
574
+ modeHint: "Recorded after the reply, with no effect: nothing reads these probabilities yet.",
575
+ version: "Questions version {version}",
576
+ leadFailed: "The evaluation failed or did not answer within {budget} ms: nothing was recorded.",
577
+ probability: "Probability the evaluation model gives to the question: from 0.5 it leans towards yes"
570
578
  }
571
579
  }, t = {
572
580
  agentType: {
@@ -1136,6 +1144,14 @@ var e = {
1136
1144
  feelsLike: "Percepita",
1137
1145
  dailyForecast: "Previsioni giornaliere",
1138
1146
  airQuality: "Qualità dell'aria"
1147
+ },
1148
+ turnEvaluation: {
1149
+ cost: "Costo, non addebitato all'organizzazione: {cost}",
1150
+ title: "Valutazione a fine turno",
1151
+ modeHint: "Registrata dopo la risposta, senza effetti: per ora nessuno legge queste probabilità.",
1152
+ version: "Versione delle domande: {version}",
1153
+ leadFailed: "La valutazione non è riuscita o non ha risposto entro {budget} ms: non è stato registrato niente.",
1154
+ probability: "Probabilità che il modello di valutazione dà alla domanda: da 0,5 in su propende per il sì"
1139
1155
  }
1140
1156
  };
1141
1157
  //#endregion
@@ -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,8 @@
1
+ import { UIChatMessage } from '../../../models/src';
2
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
3
+ type __VLS_Props = {
4
+ message: UIChatMessage;
5
+ };
6
+ declare const __VLS_export: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Escapes text for the inside of an HTML element.
3
+ */
4
+ export declare function escapeHtml(text: string): string;
5
+ /**
6
+ * The placeholder a formula waits in until KaTeX renders it. The formula is
7
+ * percent-encoded, not entity-encoded: the sanitizer drops an attribute whose
8
+ * value holds `]>` or `-->`, and a formula can (`[a,b]>0`). The encoding has
9
+ * no quote either, so the formula cannot close the attribute.
10
+ */
11
+ export declare function renderKatexPlaceholder(text: string, displayMode: boolean): string;
12
+ /**
13
+ * Cleans the HTML rendered from a markdown before it reaches `v-html`. The
14
+ * markdown is written by a model, and through the knowledge base, the tools and
15
+ * the pages it reads, by whoever wrote those; marked passes the HTML it finds
16
+ * through untouched, so a handler written in a document ran in the browser of
17
+ * whoever read the answer. Scripts, handlers, `javascript:` urls, styles and
18
+ * forms go, the formatting stays.
19
+ */
20
+ export declare function sanitizeMarkdownHtml(html: string): string;
@@ -7,6 +7,15 @@ export { isTextPart, isFilePart, isToolPart, isReasoningPart, hasPartText, hasTe
7
7
  * that should logically be a single block of text.
8
8
  */
9
9
  export declare function mergeConsecutiveTextParts(parts: UIMessage['parts']): UIMessage['parts'];
10
+ /**
11
+ * Drops a widget call refused for its arguments when a later call of the same
12
+ * widget in the message was drawn: the turn corrected it (the backend's
13
+ * `correctableInputRefusals`), and the refusal would sit next to the working
14
+ * widget, `showForm` drawing its render error above the form. A refusal with
15
+ * nothing drawn after it stays. Only the feed reads this: the steps timeline
16
+ * keeps every call, the refused one included.
17
+ */
18
+ export declare function dropCorrectedWidgetErrors(parts: UIMessage['parts']): UIMessage['parts'];
10
19
  export declare function isStreamingPart(part: UIMessage['parts'][number] | null | undefined): part is Extract<UIMessage['parts'][number], {
11
20
  streaming?: boolean;
12
21
  }>;
@@ -633,6 +633,16 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
633
633
  failed?: boolean | undefined;
634
634
  } | undefined;
635
635
  } | undefined;
636
+ turnEvaluation?: {
637
+ version: number;
638
+ mode: "shadow";
639
+ probabilities: Record<string, number>;
640
+ latencyMs: number;
641
+ budgetMs: number;
642
+ cost?: number | undefined;
643
+ inputTokens?: number | undefined;
644
+ failed?: true | undefined;
645
+ } | undefined;
636
646
  } | undefined;
637
647
  parts: ({
638
648
  type: "text";
@@ -1139,6 +1149,16 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
1139
1149
  failed?: boolean | undefined;
1140
1150
  } | undefined;
1141
1151
  } | undefined;
1152
+ turnEvaluation?: {
1153
+ version: number;
1154
+ mode: "shadow";
1155
+ probabilities: Record<string, number>;
1156
+ latencyMs: number;
1157
+ budgetMs: number;
1158
+ cost?: number | undefined;
1159
+ inputTokens?: number | undefined;
1160
+ failed?: true | undefined;
1161
+ } | undefined;
1142
1162
  } | undefined;
1143
1163
  parts: ({
1144
1164
  type: "text";
@@ -2343,6 +2363,16 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
2343
2363
  failed?: boolean | undefined;
2344
2364
  } | undefined;
2345
2365
  } | undefined;
2366
+ turnEvaluation?: {
2367
+ version: number;
2368
+ mode: "shadow";
2369
+ probabilities: Record<string, number>;
2370
+ latencyMs: number;
2371
+ budgetMs: number;
2372
+ cost?: number | undefined;
2373
+ inputTokens?: number | undefined;
2374
+ failed?: true | undefined;
2375
+ } | undefined;
2346
2376
  } | undefined;
2347
2377
  parts: ({
2348
2378
  type: "text";
@@ -2849,6 +2879,16 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
2849
2879
  failed?: boolean | undefined;
2850
2880
  } | undefined;
2851
2881
  } | undefined;
2882
+ turnEvaluation?: {
2883
+ version: number;
2884
+ mode: "shadow";
2885
+ probabilities: Record<string, number>;
2886
+ latencyMs: number;
2887
+ budgetMs: number;
2888
+ cost?: number | undefined;
2889
+ inputTokens?: number | undefined;
2890
+ failed?: true | undefined;
2891
+ } | undefined;
2852
2892
  } | undefined;
2853
2893
  parts: ({
2854
2894
  type: "text";
@@ -4053,6 +4093,16 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
4053
4093
  failed?: boolean | undefined;
4054
4094
  } | undefined;
4055
4095
  } | undefined;
4096
+ turnEvaluation?: {
4097
+ version: number;
4098
+ mode: "shadow";
4099
+ probabilities: Record<string, number>;
4100
+ latencyMs: number;
4101
+ budgetMs: number;
4102
+ cost?: number | undefined;
4103
+ inputTokens?: number | undefined;
4104
+ failed?: true | undefined;
4105
+ } | undefined;
4056
4106
  } | undefined;
4057
4107
  parts: ({
4058
4108
  type: "text";
@@ -4559,6 +4609,16 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
4559
4609
  failed?: boolean | undefined;
4560
4610
  } | undefined;
4561
4611
  } | undefined;
4612
+ turnEvaluation?: {
4613
+ version: number;
4614
+ mode: "shadow";
4615
+ probabilities: Record<string, number>;
4616
+ latencyMs: number;
4617
+ budgetMs: number;
4618
+ cost?: number | undefined;
4619
+ inputTokens?: number | undefined;
4620
+ failed?: true | undefined;
4621
+ } | undefined;
4562
4622
  } | undefined;
4563
4623
  parts: ({
4564
4624
  type: "text";
@@ -4,6 +4,59 @@ export declare enum AgentApiToolStatus {
4
4
  Active = "active",
5
5
  Inactive = "inactive"
6
6
  }
7
+ /**
8
+ * Where a secret parameter goes in the request. Never the path: a path
9
+ * parameter is filled by the model, and its value ends up in every log line
10
+ * that prints the URL.
11
+ */
12
+ export declare enum AgentApiToolSecretPosition {
13
+ Query = "query",
14
+ Body = "body"
15
+ }
16
+ /** The methods that send a JSON body, the only ones a `body` secret fits. */
17
+ export declare function isApiToolBodyMethod(method: HttpMethod | string): boolean;
18
+ /**
19
+ * A secret parameter as the API returns it: whether a value is stored, never
20
+ * the value, not even encrypted (the same contract as `hasApiKey` on the
21
+ * organization's model provider).
22
+ */
23
+ export declare const AgentApiToolSecretParameterSchema: z.ZodObject<{
24
+ name: z.ZodString;
25
+ position: z.ZodEnum<typeof AgentApiToolSecretPosition>;
26
+ hasValue: z.ZodBoolean;
27
+ }, z.core.$strip>;
28
+ /**
29
+ * A secret parameter as a save sends it. The form is never given the stored
30
+ * value, so it cannot send it back: on an update an empty or missing value
31
+ * keeps the one stored under the same name and position. A value that is
32
+ * needed and missing (any of them on a create) is refused by the service with
33
+ * a reason the interface translates, not here, where it would read as a bare
34
+ * validation error.
35
+ */
36
+ export declare const AgentApiToolSecretParameterDtoSchema: z.ZodObject<{
37
+ name: z.ZodString;
38
+ position: z.ZodEnum<typeof AgentApiToolSecretPosition>;
39
+ value: z.ZodOptional<z.ZodString>;
40
+ }, z.core.$strip>;
41
+ /**
42
+ * The public parameters whose name looks like a credential: `apikey`,
43
+ * `api_key`, `token`, `secret` or `password` as a word of the name, in any
44
+ * case and spelling (`apiKey`, `x-api-key`, `access_token`, `clientSecret`).
45
+ * The model fills them, so the value it is given ends up in the schema of
46
+ * every turn and in the input the turn keeps. A parameter already declared
47
+ * secret is not public and is left out.
48
+ */
49
+ export declare function credentialLikeParameters(inputSchema: Record<string, unknown> | null | undefined, secretNames?: Iterable<string>): string[];
50
+ /**
51
+ * A secret parameter as stored in `agent_api_tools.secret_parameters`, with
52
+ * `value` encrypted by `encryptSecret`. Backend only: it never reaches a
53
+ * response.
54
+ */
55
+ export type AgentApiToolStoredSecretParameter = {
56
+ name: string;
57
+ position: AgentApiToolSecretPosition;
58
+ value: string;
59
+ };
7
60
  export declare const AgentApiToolSchema: z.ZodObject<{
8
61
  id: z.ZodString;
9
62
  agentId: z.ZodString;
@@ -18,6 +71,11 @@ export declare const AgentApiToolSchema: z.ZodObject<{
18
71
  key: z.ZodString;
19
72
  value: z.ZodString;
20
73
  }, z.core.$strip>>>>>;
74
+ secretParameters: z.ZodDefault<z.ZodArray<z.ZodObject<{
75
+ name: z.ZodString;
76
+ position: z.ZodEnum<typeof AgentApiToolSecretPosition>;
77
+ hasValue: z.ZodBoolean;
78
+ }, z.core.$strip>>>;
21
79
  inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
22
80
  outputSchema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
23
81
  timeout: z.ZodDefault<z.ZodNumber>;
@@ -42,6 +100,11 @@ export declare const AgentApiToolCreateSchema: z.ZodObject<{
42
100
  key: z.ZodString;
43
101
  value: z.ZodString;
44
102
  }, z.core.$strip>>>>>;
103
+ secretParameters: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
104
+ name: z.ZodString;
105
+ position: z.ZodEnum<typeof AgentApiToolSecretPosition>;
106
+ value: z.ZodOptional<z.ZodString>;
107
+ }, z.core.$strip>>>>;
45
108
  inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
46
109
  outputSchema: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
47
110
  timeout: z.ZodOptional<z.ZodNumber>;
@@ -59,6 +122,11 @@ export declare const AgentApiToolUpdateSchema: z.ZodObject<{
59
122
  key: z.ZodString;
60
123
  value: z.ZodString;
61
124
  }, z.core.$strip>>>>>;
125
+ secretParameters: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
126
+ name: z.ZodString;
127
+ position: z.ZodEnum<typeof AgentApiToolSecretPosition>;
128
+ value: z.ZodOptional<z.ZodString>;
129
+ }, z.core.$strip>>>>;
62
130
  inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
63
131
  outputSchema: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
64
132
  timeout: z.ZodOptional<z.ZodNumber>;
@@ -81,4 +149,6 @@ export declare const AgentApiToolQuerystringSchema: z.ZodObject<{
81
149
  export type AgentApiTool = z.infer<typeof AgentApiToolSchema>;
82
150
  export type AgentApiToolCreate = z.infer<typeof AgentApiToolCreateSchema>;
83
151
  export type AgentApiToolUpdate = z.infer<typeof AgentApiToolUpdateSchema>;
152
+ export type AgentApiToolSecretParameter = z.infer<typeof AgentApiToolSecretParameterSchema>;
153
+ export type AgentApiToolSecretParameterDto = z.infer<typeof AgentApiToolSecretParameterDtoSchema>;
84
154
  export type AgentApiToolQuerystring = z.infer<typeof AgentApiToolQuerystringSchema>;
@@ -492,10 +492,52 @@ export type UIChatMessageMetadata = {
492
492
  * organization ({@link withoutToolCatalogue}).
493
493
  */
494
494
  toolCatalogue?: ToolCatalogueRecord;
495
+ /**
496
+ * The evaluation of the turn after the reply (spec post-turn-evaluation):
497
+ * a probability per question. Written after the answer, and removed from
498
+ * a public read ({@link withoutTurnEvaluation}).
499
+ */
500
+ turnEvaluation?: TurnEvaluationRecord;
501
+ };
502
+ /**
503
+ * The questions of the post-turn evaluation, in the order they are asked and
504
+ * listed. The backend's questions are typed against it, so the two cannot
505
+ * drift. A reader orders by this list and not by the record: jsonb keeps the
506
+ * keys of an object sorted by length, not in the order they were written.
507
+ */
508
+ export declare const TURN_EVALUATION_QUESTION_IDS: readonly ["durableFact", "abusive", "manipulation", "asksHuman", "missingInfo", "informationGap"];
509
+ export type TurnEvaluationQuestionId = (typeof TURN_EVALUATION_QUESTION_IDS)[number];
510
+ /**
511
+ * The evaluation model's answers on a finished turn (spec
512
+ * post-turn-evaluation, F1). Recorded in shadow only: nothing reads it yet.
513
+ */
514
+ export type TurnEvaluationRecord = {
515
+ /**
516
+ * The wording of the questions: a threshold holds only for the wording
517
+ * it was measured on, so a record says which one it answered.
518
+ */
519
+ version: number;
520
+ mode: 'shadow';
521
+ /** Probability per question, two decimals. Empty when the request failed. */
522
+ probabilities: Record<string, number>;
523
+ latencyMs: number;
524
+ budgetMs: number;
525
+ /** Market cost of the request in USD. */
526
+ cost?: number;
527
+ inputTokens?: number;
528
+ /** The request failed or ran past its budget: no answer was recorded. */
529
+ failed?: true;
495
530
  };
496
531
  export type UIChatMessage = UIMessage & {
497
532
  metadata?: UIChatMessageMetadata;
498
533
  };
534
+ /**
535
+ * The history without the turn evaluations, for a public read: a probability
536
+ * of abuse on a user must not reach the widget. Kept apart from
537
+ * {@link withoutToolCatalogue}, which the data export uses too, because
538
+ * whether the export includes this judgment is still to be decided.
539
+ */
540
+ export declare function withoutTurnEvaluation(messages: UIChatMessage[]): UIChatMessage[];
499
541
  /**
500
542
  * The history without the tool catalogue records, for a reader outside the
501
543
  * organization (a public chat read, the data export): a record names every
@@ -119,6 +119,18 @@ export declare const LeadCreateDtoSchema: z.ZodObject<{
119
119
  budget: z.ZodOptional<z.ZodString>;
120
120
  }, z.core.$strip>>;
121
121
  }, z.core.$strip>;
122
+ /**
123
+ * What the public lead route answers: the submission's own fields back, and
124
+ * nothing the server holds. The same answer whether the email was new, was
125
+ * the caller's, or already held another visitor's lead, so it cannot tell
126
+ * them apart.
127
+ */
128
+ export declare const LeadSubmissionSchema: z.ZodObject<{
129
+ name: z.ZodString;
130
+ chatId: z.ZodString;
131
+ agentId: z.ZodString;
132
+ email: z.ZodEmail;
133
+ }, z.core.$strip>;
122
134
  /**
123
135
  * Lead update schema for PUT endpoint (private/backoffice)
124
136
  */
@@ -200,5 +212,6 @@ export declare const LeadsQuerystringSchema: z.ZodObject<{
200
212
  */
201
213
  export type Lead = z.infer<typeof LeadSchema>;
202
214
  export type LeadCreateDto = z.infer<typeof LeadCreateDtoSchema>;
215
+ export type LeadSubmission = z.infer<typeof LeadSubmissionSchema>;
203
216
  export type LeadUpdateDto = z.infer<typeof LeadUpdateDtoSchema>;
204
217
  export type LeadsQuerystring = z.infer<typeof LeadsQuerystringSchema>;
@@ -2,7 +2,6 @@ import { z } from 'zod';
2
2
  export declare const MAX_FILE_SIZE: number;
3
3
  export declare const MIME_TYPE_REGEX: RegExp;
4
4
  export declare const SUPPORTED_IMAGE_TYPES: readonly ["image/jpeg", "image/png", "image/gif", "image/webp", "image/svg+xml"];
5
- export declare const SUPPORTED_DOCUMENT_TYPES: readonly ["application/pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "text/plain", "text/markdown"];
6
5
  export declare const SUPPORTED_VIDEO_TYPES: readonly ["video/mp4", "video/webm", "video/ogg"];
7
6
  export declare const SUPPORTED_AUDIO_TYPES: readonly ["audio/mpeg", "audio/wav", "audio/ogg"];
8
7
  export declare enum StoragePolicy {
@@ -109,7 +109,7 @@ export declare const EMBEDDING_MODEL_PAYLOAD_KEY = "embedding_model";
109
109
  *
110
110
  * gemini is the calibration the platform has run on; the OpenAI row was
111
111
  * measured on 2026-09-22 and accepted on 2026-09-24
112
- * (`docs/specs/organization-byok-embedding.md`, D2 and F0), to be checked on
112
+ * (`docs/specs/released/organization-byok-embedding.md`, D2 and F0), to be checked on
113
113
  * the customer's own knowledge base before it is activated for them.
114
114
  */
115
115
  export declare const DENSE_SIMILARITY_FLOORS: Record<EmbeddingFamily, {