@8wave/ai-elements 0.97.0-beta.2 → 0.97.0-beta.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 (34) hide show
  1. package/dist/ai-elements.es.js +8 -7
  2. package/dist/ai-elements.es.js.map +1 -1
  3. package/dist-vue/PkChatbot.js +1 -1
  4. package/dist-vue/PkChatbotViewChat.js +1 -1
  5. package/dist-vue/PkChatbotViewConversations.js +1 -1
  6. package/dist-vue/PkChatbotViewFiles.js +1 -1
  7. package/dist-vue/PkChatbotViewProfile.js +1 -1
  8. package/dist-vue/_chunks/{PkChatbot-C_eZTz6p.js → PkChatbot-A1jKttsQ.js} +6 -6
  9. package/dist-vue/_chunks/{PkChatbot-C_eZTz6p.js.map → PkChatbot-A1jKttsQ.js.map} +1 -1
  10. package/dist-vue/_chunks/{PkChatbotViewChat-DhoY_8n8.js → PkChatbotViewChat-Cc8bZfAr.js} +2 -2
  11. package/dist-vue/_chunks/{PkChatbotViewChat-DhoY_8n8.js.map → PkChatbotViewChat-Cc8bZfAr.js.map} +1 -1
  12. package/dist-vue/_chunks/{PkChatbotViewConversations-DS_k_sT_.js → PkChatbotViewConversations-BsfA4A7O.js} +2 -2
  13. package/dist-vue/_chunks/{PkChatbotViewConversations-DS_k_sT_.js.map → PkChatbotViewConversations-BsfA4A7O.js.map} +1 -1
  14. package/dist-vue/_chunks/{PkChatbotViewFiles-7dp8BlYW.js → PkChatbotViewFiles-C6aouWQh.js} +2 -2
  15. package/dist-vue/_chunks/{PkChatbotViewFiles-7dp8BlYW.js.map → PkChatbotViewFiles-C6aouWQh.js.map} +1 -1
  16. package/dist-vue/_chunks/{PkChatbotViewProfile-BdFkddeC.js → PkChatbotViewProfile-B_ZAXIrC.js} +2 -2
  17. package/dist-vue/_chunks/{PkChatbotViewProfile-BdFkddeC.js.map → PkChatbotViewProfile-B_ZAXIrC.js.map} +1 -1
  18. package/dist-vue/_chunks/{createChatbotApiClient-DvuGurzU.js → createChatbotApiClient-BHfNaVk8.js} +2 -1
  19. package/dist-vue/_chunks/createChatbotApiClient-BHfNaVk8.js.map +1 -0
  20. package/dist-vue/_chunks/{useChatbotStore-C7VyUKXU.js → useChatbotStore-bbenzuMe.js} +2 -2
  21. package/dist-vue/_chunks/{useChatbotStore-C7VyUKXU.js.map → useChatbotStore-bbenzuMe.js.map} +1 -1
  22. package/dist-vue/api.js +1 -1
  23. package/dist-vue/apps/web-component/src/composables/useChatbotAgent.d.ts +2 -0
  24. package/dist-vue/composables.js +2 -2
  25. package/dist-vue/index.js +359 -341
  26. package/dist-vue/index.js.map +1 -1
  27. package/dist-vue/locales.js +4 -0
  28. package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +5 -2
  29. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +6 -0
  30. package/dist-vue/packages/models/src/schema/Agent.d.ts +8 -0
  31. package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +2 -0
  32. package/dist-vue/packages/models/src/schema/SubAgent.d.ts +2 -0
  33. package/package.json +1 -1
  34. package/dist-vue/_chunks/createChatbotApiClient-DvuGurzU.js.map +0 -1
@@ -174,6 +174,7 @@ var e = {
174
174
  white: "White",
175
175
  black: "Black",
176
176
  smoothStream: "Smooth streaming",
177
+ interactiveLogin: "Show login/registration",
177
178
  floatingButtonPosition: "Button position",
178
179
  right: "Right",
179
180
  left: "Left",
@@ -329,6 +330,7 @@ var e = {
329
330
  useColorsForAgentHeader: "Color the agent header based on the main color.",
330
331
  smoothStream: "Smooths text streaming creating a more natural reading experience.",
331
332
  welcomePopup: "Show a welcome popup with the initial message before the chat is opened.",
333
+ interactiveLogin: "Lets anonymous users sign in from the chat. The external token stays active.",
332
334
  customCss: "CSS injected into the widget shadow DOM. Allows styling the chat interface from the outside.",
333
335
  dismissableNotice: "It will be hidden after the first message.",
334
336
  privacyPolicyNotice: "Displayed at the bottom of the contact form. Supports Markdown.",
@@ -641,6 +643,7 @@ var e = {
641
643
  white: "Bianco",
642
644
  black: "Nero",
643
645
  smoothStream: "Smooth streaming",
646
+ interactiveLogin: "Mostra login/registrazione",
644
647
  floatingButtonPosition: "Posizione bottone",
645
648
  right: "Destra",
646
649
  left: "Sinistra",
@@ -796,6 +799,7 @@ var e = {
796
799
  useColorsForAgentHeader: "Colora l'intestazione dell'agente in base al colore principale.",
797
800
  smoothStream: "Uniforma lo streaming del testo creando un'esperienza di lettura più naturale.",
798
801
  welcomePopup: "Mostra un popup di benvenuto con il messaggio iniziale prima che la chat venga aperta.",
802
+ interactiveLogin: "Permette agli utenti anonimi di accedere dalla chat. L'external token resta sempre attivo.",
799
803
  customCss: "CSS iniettato nello shadow DOM del widget. Permette di personalizzare l'interfaccia della chat dall'esterno.",
800
804
  dismissableNotice: "Verrà nascosto dopo il primo messaggio.",
801
805
  privacyPolicyNotice: "Visibile del modulo di contatto.",
@@ -36,6 +36,7 @@ type __VLS_ModelProps = {
36
36
  'textColor'?: 'auto' | 'white' | 'black';
37
37
  'useColorsForAgentHeader'?: boolean;
38
38
  'welcomePopup'?: boolean;
39
+ 'interactiveLogin'?: boolean;
39
40
  'floatingButtonPosition'?: 'left' | 'right';
40
41
  'maxMessageLength'?: number | undefined;
41
42
  'media'?: Media | undefined;
@@ -86,9 +87,9 @@ type __VLS_ModelProps = {
86
87
  };
87
88
  };
88
89
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
89
- declare var __VLS_583: {};
90
+ declare var __VLS_589: {};
90
91
  type __VLS_Slots = {} & {
91
- default?: (props: typeof __VLS_583) => any;
92
+ default?: (props: typeof __VLS_589) => any;
92
93
  };
93
94
  declare const __VLS_base: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
94
95
  "update:reasoning": (value: {
@@ -179,6 +180,7 @@ declare const __VLS_base: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, Com
179
180
  "update:textColor": (value: "auto" | "white" | "black") => any;
180
181
  "update:useColorsForAgentHeader": (value: boolean) => any;
181
182
  "update:welcomePopup": (value: boolean) => any;
183
+ "update:interactiveLogin": (value: boolean) => any;
182
184
  "update:floatingButtonPosition": (value: "left" | "right") => any;
183
185
  "update:maxMessageLength": (value: number | undefined) => any;
184
186
  "update:media": (value: {
@@ -386,6 +388,7 @@ declare const __VLS_base: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, Com
386
388
  "onUpdate:textColor"?: ((value: "auto" | "white" | "black") => any) | undefined;
387
389
  "onUpdate:useColorsForAgentHeader"?: ((value: boolean) => any) | undefined;
388
390
  "onUpdate:welcomePopup"?: ((value: boolean) => any) | undefined;
391
+ "onUpdate:interactiveLogin"?: ((value: boolean) => any) | undefined;
389
392
  "onUpdate:floatingButtonPosition"?: ((value: "left" | "right") => any) | undefined;
390
393
  "onUpdate:maxMessageLength"?: ((value: number | undefined) => any) | undefined;
391
394
  "onUpdate:media"?: ((value: {
@@ -21,6 +21,7 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
21
21
  mainColor: string;
22
22
  textColor: "auto" | "white" | "black";
23
23
  useColorsForAgentHeader: boolean;
24
+ interactiveLogin: boolean;
24
25
  welcomePopup: boolean;
25
26
  floatingButtonPosition: "left" | "right";
26
27
  widgetUrl: string;
@@ -113,6 +114,7 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
113
114
  mainColor: string;
114
115
  textColor: "auto" | "white" | "black";
115
116
  useColorsForAgentHeader: boolean;
117
+ interactiveLogin: boolean;
116
118
  welcomePopup: boolean;
117
119
  floatingButtonPosition: "left" | "right";
118
120
  widgetUrl: string;
@@ -1534,6 +1536,7 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
1534
1536
  mainColor: string;
1535
1537
  textColor: "auto" | "white" | "black";
1536
1538
  useColorsForAgentHeader: boolean;
1539
+ interactiveLogin: boolean;
1537
1540
  welcomePopup: boolean;
1538
1541
  floatingButtonPosition: "left" | "right";
1539
1542
  widgetUrl: string;
@@ -1626,6 +1629,7 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
1626
1629
  mainColor: string;
1627
1630
  textColor: "auto" | "white" | "black";
1628
1631
  useColorsForAgentHeader: boolean;
1632
+ interactiveLogin: boolean;
1629
1633
  welcomePopup: boolean;
1630
1634
  floatingButtonPosition: "left" | "right";
1631
1635
  widgetUrl: string;
@@ -3047,6 +3051,7 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
3047
3051
  mainColor: string;
3048
3052
  textColor: "auto" | "white" | "black";
3049
3053
  useColorsForAgentHeader: boolean;
3054
+ interactiveLogin: boolean;
3050
3055
  welcomePopup: boolean;
3051
3056
  floatingButtonPosition: "left" | "right";
3052
3057
  widgetUrl: string;
@@ -3139,6 +3144,7 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
3139
3144
  mainColor: string;
3140
3145
  textColor: "auto" | "white" | "black";
3141
3146
  useColorsForAgentHeader: boolean;
3147
+ interactiveLogin: boolean;
3142
3148
  welcomePopup: boolean;
3143
3149
  floatingButtonPosition: "left" | "right";
3144
3150
  widgetUrl: string;
@@ -608,6 +608,7 @@ export declare const AgentInterfaceSchema: z.ZodObject<{
608
608
  dismissableNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
609
609
  footerMessage: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
610
610
  privacyPolicyNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
611
+ interactiveLogin: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
611
612
  welcomePopup: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
612
613
  floatingButtonPosition: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
613
614
  left: "left";
@@ -828,6 +829,7 @@ export declare const AgentSettingsSchema: z.ZodObject<{
828
829
  dismissableNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
829
830
  footerMessage: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
830
831
  privacyPolicyNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
832
+ interactiveLogin: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
831
833
  welcomePopup: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
832
834
  floatingButtonPosition: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
833
835
  left: "left";
@@ -1132,6 +1134,7 @@ export declare const AgentDtoSchema: z.ZodObject<{
1132
1134
  dismissableNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
1133
1135
  footerMessage: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
1134
1136
  privacyPolicyNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
1137
+ interactiveLogin: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1135
1138
  welcomePopup: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1136
1139
  floatingButtonPosition: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
1137
1140
  left: "left";
@@ -1437,6 +1440,7 @@ export declare const AgentSchema: z.ZodLazy<z.ZodObject<{
1437
1440
  dismissableNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
1438
1441
  footerMessage: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
1439
1442
  privacyPolicyNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
1443
+ interactiveLogin: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1440
1444
  welcomePopup: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1441
1445
  floatingButtonPosition: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
1442
1446
  left: "left";
@@ -1672,6 +1676,7 @@ export declare const AgentPublicSchema: z.ZodObject<{
1672
1676
  dismissableNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
1673
1677
  footerMessage: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
1674
1678
  privacyPolicyNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
1679
+ interactiveLogin: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1675
1680
  welcomePopup: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1676
1681
  floatingButtonPosition: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
1677
1682
  left: "left";
@@ -1888,6 +1893,7 @@ export declare const AgentAccessGrantedSchema: z.ZodObject<{
1888
1893
  dismissableNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
1889
1894
  footerMessage: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
1890
1895
  privacyPolicyNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
1896
+ interactiveLogin: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1891
1897
  welcomePopup: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1892
1898
  floatingButtonPosition: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
1893
1899
  left: "left";
@@ -2064,6 +2070,7 @@ export declare const AgentAccessDecisionSchema: z.ZodDiscriminatedUnion<[z.ZodOb
2064
2070
  dismissableNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
2065
2071
  footerMessage: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
2066
2072
  privacyPolicyNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
2073
+ interactiveLogin: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2067
2074
  welcomePopup: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2068
2075
  floatingButtonPosition: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
2069
2076
  left: "left";
@@ -2245,6 +2252,7 @@ export declare const AgentAccessSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2245
2252
  dismissableNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
2246
2253
  footerMessage: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
2247
2254
  privacyPolicyNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
2255
+ interactiveLogin: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2248
2256
  welcomePopup: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2249
2257
  floatingButtonPosition: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
2250
2258
  left: "left";
@@ -216,6 +216,7 @@ export declare const ReasoningChatSchema: z.ZodObject<{
216
216
  dismissableNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
217
217
  footerMessage: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
218
218
  privacyPolicyNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
219
+ interactiveLogin: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
219
220
  welcomePopup: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
220
221
  floatingButtonPosition: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
221
222
  left: "left";
@@ -572,6 +573,7 @@ export declare const ReasoningChatSchema: z.ZodObject<{
572
573
  dismissableNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
573
574
  footerMessage: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
574
575
  privacyPolicyNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
576
+ interactiveLogin: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
575
577
  welcomePopup: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
576
578
  floatingButtonPosition: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
577
579
  left: "left";
@@ -216,6 +216,7 @@ export declare const SubAgentSchema: z.ZodObject<{
216
216
  dismissableNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
217
217
  footerMessage: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
218
218
  privacyPolicyNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
219
+ interactiveLogin: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
219
220
  welcomePopup: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
220
221
  floatingButtonPosition: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
221
222
  left: "left";
@@ -530,6 +531,7 @@ export declare const SubAgentSchema: z.ZodObject<{
530
531
  dismissableNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
531
532
  footerMessage: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
532
533
  privacyPolicyNotice: z.ZodOptional<z.ZodCodec<z.ZodUnknown, z.ZodRecord<z.ZodString, z.ZodString>>>;
534
+ interactiveLogin: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
533
535
  welcomePopup: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
534
536
  floatingButtonPosition: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
535
537
  left: "left";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8wave/ai-elements",
3
3
  "private": false,
4
- "version": "0.97.0-beta.2",
4
+ "version": "0.97.0-beta.3",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite --port 8082 --open --host",
@@ -1 +0,0 @@
1
- {"version":3,"file":"createChatbotApiClient-DvuGurzU.js","names":["c","l","d","f","s","n","e","t","i","r"],"sources":["../../../../packages/models/src/schema/Agent.ts","../../../../packages/models/src/schema/ConversationAnalysis.ts","../../../../packages/models/src/schema/Chat.ts","../../../../node_modules/.pnpm/@ucast+core@2.0.0/node_modules/@ucast/core/dist/esm/index.mjs","../../../../node_modules/.pnpm/@ucast+mongo@3.0.0/node_modules/@ucast/mongo/dist/esm/index.mjs","../../../../packages/ability/src/types.ts","../../../../packages/ability/src/roles/User.ts","../../../../packages/ability/src/index.ts","../../../../packages/composable/src/chatbot/api/createChatbotApiClient.ts"],"sourcesContent":["import * as z from 'zod'\nimport { zodQs, jsonSchemaField, decodeOnly } from '../utils'\nimport { LanguageModel } from './constants'\nimport { MediaSchema, MIME_TYPE_REGEX } from './Media'\n\nexport enum AgentStatus {\n Draft = 'draft',\n Active = 'active',\n Inactive = 'inactive',\n}\n\nexport enum AgentVisibility {\n Public = 'public',\n Private = 'private',\n Organization = 'organization',\n}\n\nexport enum AgentType {\n Chat = 'chat',\n Reasoning = 'reasoning',\n}\n\nexport enum AgentSearchMode {\n Semantic = 'semantic',\n Balanced = 'balanced',\n Keyword = 'keyword',\n}\n\n/**\n * Provider-specific reasoning configurations.\n *\n * Each provider has its own reasoning API:\n * - OpenAI (GPT-5, o-series): `reasoningEffort` + `reasoningSummary`\n * - Anthropic (Claude 4.6+): adaptive thinking with `effort` levels, or legacy `budgetTokens`\n * - Google (Gemini 3/3.1): `thinkingLevel`; Gemini 2.5: `thinkingBudget`\n * - DeepSeek: on/off thinking toggle\n *\n * Only the matching provider's config is used at runtime (based on model prefix).\n * Admins can pre-configure multiple providers for easy model switching.\n */\n\nexport const OpenAIReasoningSchema = z.object({\n reasoningEffort: z\n .enum(['none', 'low', 'medium', 'high', 'xhigh'])\n .optional(),\n reasoningSummary: z.enum(['auto', 'detailed', 'concise']).optional(),\n})\nexport type OpenAIReasoning = z.infer<typeof OpenAIReasoningSchema>\n\nexport const AnthropicReasoningSchema = z.object({\n type: z.enum(['adaptive', 'enabled', 'disabled']).optional(),\n effort: z.enum(['low', 'medium', 'high', 'xhigh', 'max']).optional(),\n display: z.enum(['summarized', 'omitted']).optional(),\n budgetTokens: z.number().int().positive().optional(),\n})\nexport type AnthropicReasoning = z.infer<typeof AnthropicReasoningSchema>\n\nexport const GoogleReasoningSchema = z.object({\n thinkingLevel: z.enum(['minimal', 'low', 'medium', 'high']).optional(),\n thinkingBudget: z.number().int().optional(),\n includeThoughts: z.boolean().optional(),\n})\nexport type GoogleReasoning = z.infer<typeof GoogleReasoningSchema>\n\nexport const DeepSeekReasoningSchema = z.object({\n type: z.enum(['enabled', 'disabled']).optional(),\n})\nexport type DeepSeekReasoning = z.infer<typeof DeepSeekReasoningSchema>\n\n/**\n * Migrates legacy format `{ effort: 'high', reasoningSummary: 'auto' }` to the new\n * per-provider format. Applied via preprocess so old DB data auto-migrates on parse.\n */\nconst AgentReasoningObjectSchema = z.object({\n openai: OpenAIReasoningSchema.optional(),\n anthropic: AnthropicReasoningSchema.optional(),\n google: GoogleReasoningSchema.optional(),\n deepseek: DeepSeekReasoningSchema.optional(),\n})\n\ntype AgentReasoningInput = z.input<typeof AgentReasoningObjectSchema>\n\nfunction migrateReasoningConfig(val: unknown): AgentReasoningInput {\n if (!val || typeof val !== 'object') {\n // Output validity is enforced by the codec's output schema at runtime.\n return val as AgentReasoningInput\n }\n const obj = val as Record<string, unknown>\n // Detect legacy format: has `effort` key with old enum values\n if (\n 'effort' in obj &&\n !(\n 'openai' in obj ||\n 'anthropic' in obj ||\n 'google' in obj ||\n 'deepseek' in obj\n )\n ) {\n const effort = obj.effort as string | undefined\n const reasoningSummary = obj.reasoningSummary as string | undefined\n const migrated: Record<string, unknown> = {}\n\n if (effort && effort !== 'off') {\n migrated.openai = {\n reasoningEffort: effort,\n ...(reasoningSummary ? { reasoningSummary } : {}),\n }\n migrated.anthropic = {\n type: 'adaptive' as const,\n effort: effort as 'low' | 'medium' | 'high',\n }\n migrated.google = {\n thinkingLevel: effort as 'low' | 'medium' | 'high',\n }\n migrated.deepseek = { type: 'enabled' as const }\n } else {\n migrated.openai = { reasoningEffort: 'none' }\n migrated.deepseek = { type: 'disabled' as const }\n }\n return migrated as AgentReasoningInput\n }\n return val as AgentReasoningInput\n}\n\n// Codec instead of z.preprocess: the legacy-format migration only runs on\n// decode, while encode (used by response serialization) is the identity.\n// `.optional()` wraps the codec (not the inner object) so a missing\n// `reasoning` key still parses, matching the old z.preprocess semantics.\nexport const AgentReasoningSchema = decodeOnly(\n z.unknown(),\n AgentReasoningObjectSchema,\n migrateReasoningConfig,\n).optional()\n\nexport type AgentReasoning = z.infer<typeof AgentReasoningSchema>\n\n/**\n * Whether reasoning is effectively enabled for the given model.\n *\n * Mirrors the runtime semantics of `getReasoningOptions` (backend):\n * only the provider config matching the model prefix is considered.\n * Note: for Anthropic with `display: 'omitted'` reasoning runs but no\n * reasoning parts are streamed to the client.\n */\nexport function isReasoningEnabled(\n model: string,\n reasoning: AgentReasoning | null | undefined,\n): boolean {\n if (!reasoning) {\n return false\n }\n\n const [provider = ''] = model.split('/')\n\n if (provider === 'openai') {\n const config = reasoning.openai\n return Boolean(\n config?.reasoningEffort && config.reasoningEffort !== 'none',\n )\n }\n\n if (provider === 'anthropic') {\n const config = reasoning.anthropic\n return Boolean(config && config.type !== 'disabled')\n }\n\n if (provider === 'google') {\n const config = reasoning.google\n if (!config || config.thinkingBudget === 0) {\n return false\n }\n return Boolean(\n (config.thinkingLevel && config.thinkingLevel !== 'minimal') ||\n config.thinkingBudget ||\n config.includeThoughts,\n )\n }\n\n if (provider === 'deepseek') {\n return reasoning.deepseek?.type === 'enabled'\n }\n\n return false\n}\n\nexport enum AgentBuiltInTool {\n Geocode = 'geocode',\n GetWeather = 'getWeather',\n ReadDocumentFile = 'readDocumentFile',\n RequestConfirm = 'requestConfirm',\n RequestGeolocation = 'requestGeolocation',\n RetrieveRevisedAnswers = 'retrieveRevisedAnswers',\n SearchInKnowledgeBase = 'searchInKnowledgeBase',\n SearchInUserFiles = 'searchInUserFiles',\n UserMemory = 'userMemory',\n RunWorker = 'runWorker',\n FetchTeamsChannelHistory = 'fetchTeamsChannelHistory',\n ShowArtifact = 'showArtifact',\n ShowCalendarEvent = 'showCalendarEvent',\n ShowComparison = 'showComparison',\n ShowContactForm = 'showContactForm',\n ShowDiagram = 'showDiagram',\n ShowEmail = 'showEmail',\n ShowImageGallery = 'showImageGallery',\n ShowLocation = 'showLocation',\n ShowMessage = 'showMessage',\n ShowForm = 'showForm',\n ShowProductList = 'showProductList',\n ShowQrCode = 'showQrCode',\n ShowSources = 'showSources',\n ShowSuggestedReply = 'showSuggestedReply',\n ShowVideo = 'showVideo',\n ShowWeather = 'showWeather',\n ShowWebPages = 'showWebPages',\n // deprecated tools - to be removed in favor of more specific tools above\n ShowMultipleChoice = 'showMultipleChoice',\n}\n\n/**\n * Returns true if the tool renders a UI element (card, form, list, etc.).\n * Used in `prepareStep` to prevent duplicate UI elements across streaming steps.\n */\nexport function isPresentationTool(toolName: string): boolean {\n return (\n toolName === AgentBuiltInTool.RequestConfirm ||\n toolName === AgentBuiltInTool.ShowArtifact ||\n toolName === AgentBuiltInTool.ShowCalendarEvent ||\n toolName === AgentBuiltInTool.ShowComparison ||\n toolName === AgentBuiltInTool.ShowContactForm ||\n toolName === AgentBuiltInTool.ShowDiagram ||\n toolName === AgentBuiltInTool.ShowEmail ||\n toolName === AgentBuiltInTool.ShowImageGallery ||\n toolName === AgentBuiltInTool.ShowLocation ||\n toolName === AgentBuiltInTool.ShowMessage ||\n toolName === AgentBuiltInTool.ShowForm ||\n toolName === AgentBuiltInTool.ShowMultipleChoice ||\n toolName === AgentBuiltInTool.ShowProductList ||\n toolName === AgentBuiltInTool.ShowQrCode ||\n toolName === AgentBuiltInTool.ShowSources ||\n toolName === AgentBuiltInTool.ShowSuggestedReply ||\n toolName === AgentBuiltInTool.ShowVideo ||\n toolName === AgentBuiltInTool.ShowWeather ||\n toolName === AgentBuiltInTool.ShowWebPages\n )\n}\n\n/**\n * Tools that render natively as cards on messaging platforms (Teams/WhatsApp).\n * Must mirror the coverage of the backend `platformToolRenderer` (the renderers\n * + the resumable confirm/form and the tappable suggested-reply). Tools not in\n * this set fall back to the model's plain-text reply on those channels.\n */\nexport const PLATFORM_RENDERED_TOOLS = new Set<string>([\n AgentBuiltInTool.RequestConfirm,\n AgentBuiltInTool.ShowArtifact,\n AgentBuiltInTool.ShowWeather,\n AgentBuiltInTool.ShowLocation,\n AgentBuiltInTool.ShowComparison,\n AgentBuiltInTool.ShowProductList,\n AgentBuiltInTool.ShowWebPages,\n AgentBuiltInTool.ShowImageGallery,\n AgentBuiltInTool.ShowVideo,\n AgentBuiltInTool.ShowSources,\n AgentBuiltInTool.ShowSuggestedReply,\n AgentBuiltInTool.ShowCalendarEvent,\n AgentBuiltInTool.ShowEmail,\n AgentBuiltInTool.ShowMessage,\n AgentBuiltInTool.ShowForm,\n])\n\n/** True if the tool renders natively on Teams/WhatsApp (not just web). */\nexport function isPlatformRenderedTool(toolName: string): boolean {\n return PLATFORM_RENDERED_TOOLS.has(toolName)\n}\n\nexport const AgentFormSettingsSchema = z.object({\n maxSteps: z.number().int().min(1).max(10).optional().default(5),\n maxOptionsPerStep: z.number().int().min(2).max(10).optional().default(5),\n})\nexport type AgentFormSettings = z.infer<typeof AgentFormSettingsSchema>\n\nexport const DEFAULT_MAX_STEP_COUNT = 10\nexport const DEFAULT_SUB_AGENT_MAX_STEP_COUNT = 6\nexport const DEFAULT_ENDPOINT_MAX_STEP_COUNT = 5\n\nexport enum WebSearchProvider {\n Perplexity = 'perplexity',\n Parallel = 'parallel',\n Native = 'native',\n}\n\nexport const PerplexitySearchConfigSchema = z.object({\n maxResults: z.number().int().min(1).max(20).optional(),\n maxTokens: z.number().int().positive().max(1_000_000).optional(),\n maxTokensPerPage: z.number().int().positive().optional(),\n country: z.string().max(2).optional(),\n searchLanguageFilter: z.array(z.string().max(5)).max(10).optional(),\n searchDomainFilter: z.array(z.string()).max(20).optional(),\n searchRecencyFilter: z.enum(['day', 'week', 'month', 'year']).optional(),\n})\nexport type PerplexitySearchConfig = z.infer<\n typeof PerplexitySearchConfigSchema\n>\n\nexport const ParallelSearchConfigSchema = z.object({\n mode: z.enum(['one-shot', 'agentic']).optional(),\n maxResults: z.number().int().min(1).max(20).optional(),\n sourcePolicy: z\n .object({\n includeDomains: z.array(z.string()).optional(),\n excludeDomains: z.array(z.string()).optional(),\n afterDate: z.string().optional(),\n })\n .optional(),\n excerpts: z\n .object({\n maxCharsPerResult: z.number().int().positive().optional(),\n maxCharsTotal: z.number().int().positive().optional(),\n })\n .optional(),\n fetchPolicy: z\n .object({\n maxAgeSeconds: z.number().int().positive().optional(),\n })\n .optional(),\n})\nexport type ParallelSearchConfig = z.infer<typeof ParallelSearchConfigSchema>\n\nexport const NativeWebSearchConfigSchema = z.object({\n openai: z.object({}).optional(),\n anthropic: z\n .object({\n maxUses: z.number().int().positive().optional(),\n allowedDomains: z.array(z.string()).optional(),\n blockedDomains: z.array(z.string()).optional(),\n userLocation: z\n .object({\n type: z.literal('approximate').optional(),\n country: z.string().optional(),\n region: z.string().optional(),\n city: z.string().optional(),\n timezone: z.string().optional(),\n })\n .optional(),\n })\n .optional(),\n google: z.object({}).optional(),\n})\nexport type NativeWebSearchConfig = z.infer<typeof NativeWebSearchConfigSchema>\n\nexport const AgentWebSearchSchema = z.object({\n enabled: z.boolean().default(false),\n provider: z\n .enum(WebSearchProvider)\n .optional()\n .default(WebSearchProvider.Native),\n perplexity: PerplexitySearchConfigSchema.optional(),\n parallel: ParallelSearchConfigSchema.optional(),\n native: NativeWebSearchConfigSchema.optional(),\n})\nexport type AgentWebSearch = z.infer<typeof AgentWebSearchSchema>\n\n// Cross-agent personalization sub-options. Default OFF = current agent-bound\n// behavior. Only meaningful when the parent tool (UserMemory / SearchInUserFiles)\n// is enabled in `disabled`.\nexport const AgentUserMemorySchema = z.object({\n // Read the user's memories across ALL their agents (aggregated), not just\n // this agent's. Writes stay per-agent (scope='agent').\n useAllUserKb: z.boolean().default(false),\n})\nexport type AgentUserMemory = z.infer<typeof AgentUserMemorySchema>\n\nexport const AgentUserFilesSchema = z.object({\n // Search ALL the user's files, not just those pinned to this agent\n // (or globally shared agent_id IS NULL).\n useAllUserFiles: z.boolean().default(false),\n})\nexport type AgentUserFiles = z.infer<typeof AgentUserFilesSchema>\n\nexport const AgentToolsSchema = z.object({\n // New agents start with user memory, user-files search and the generic\n // worker OFF (opt-in). Existing agents keep whatever `disabled` they stored.\n disabled: z\n .array(z.enum(AgentBuiltInTool))\n .default([\n AgentBuiltInTool.UserMemory,\n AgentBuiltInTool.SearchInUserFiles,\n AgentBuiltInTool.RunWorker,\n AgentBuiltInTool.FetchTeamsChannelHistory,\n ]),\n showForm: AgentFormSettingsSchema.optional().default(() =>\n AgentFormSettingsSchema.parse({}),\n ),\n webSearch: AgentWebSearchSchema.optional().default(() =>\n AgentWebSearchSchema.parse({}),\n ),\n userMemory: AgentUserMemorySchema.optional().default(() =>\n AgentUserMemorySchema.parse({}),\n ),\n userFiles: AgentUserFilesSchema.optional().default(() =>\n AgentUserFilesSchema.parse({}),\n ),\n})\nexport type AgentTools = z.infer<typeof AgentToolsSchema>\n\n/**\n * Ranking configuration schema for smart chunk retrieval.\n * Controls freshness boost, document priority, and MMR.\n * Semantic deduplication is always applied at sync time (not configurable per-agent).\n */\nexport const AgentRankingSchema = z\n .object({\n freshness: z\n .object({\n enabled: z.boolean().default(false),\n /** Half-life in seconds (1 day – 1 year) */\n scale: z\n .number()\n .int()\n .min(86400)\n .max(31536000)\n .default(7776000),\n /** Weight multiplier for freshness boost in formula */\n weight: z.number().min(0.05).max(0.5).default(0.1),\n })\n .prefault({}),\n priority: z\n .object({\n /** Always enabled by default — priority is per-document, not per-agent */\n enabled: z.boolean().default(true),\n })\n .prefault({}),\n mmr: z\n .object({\n enabled: z.boolean().default(false),\n /** Diversity tradeoff (0.0 = relevance only, 1.0 = diversity only) */\n diversity: z.number().min(0.0).max(1.0).default(0.3),\n /**\n * Candidates pre-selected before MMR. Capped at 100: in\n * balanced mode the RRF fusion of two 50-candidate prefetch\n * legs can never yield more, and each candidate carries its\n * dense vector (~12KB at 3072d) across the wire.\n */\n candidatesLimit: z.number().int().min(20).max(100).default(50),\n })\n .prefault({}),\n })\n .prefault({})\nexport type AgentRanking = z.infer<typeof AgentRankingSchema>\n\nexport const AgentModelSchema = z.object({\n prompt: z.string().optional(),\n temperature: z.number().min(0).max(2).optional().default(0.6),\n maxOutputTokens: z.number().positive().optional(),\n presencePenalty: z.number().min(-2).max(2).optional(),\n frequencyPenalty: z.number().min(-2).max(2).optional(),\n searchMode: z\n .enum(AgentSearchMode)\n .optional()\n .default(AgentSearchMode.Balanced),\n limit: z.number().positive().max(100).optional().default(10),\n maxStepCount: z\n .number()\n .int()\n .min(1)\n .max(40)\n .optional()\n .default(DEFAULT_MAX_STEP_COUNT),\n reasoning: AgentReasoningSchema,\n /** Smart ranking configuration (freshness, priority, MMR) */\n ranking: AgentRankingSchema.optional().default(() =>\n AgentRankingSchema.parse({}),\n ),\n})\nexport type AgentModel = z.infer<typeof AgentModelSchema>\n\nexport const LocalizedStringSchema = decodeOnly(\n z.unknown(),\n z.record(z.string(), z.string()),\n // Output validity is enforced by the codec's output schema at runtime.\n (val) =>\n (typeof val === 'string' ? { it: val } : val) as Record<string, string>,\n)\nexport type LocalizedString = z.infer<typeof LocalizedStringSchema>\n\nexport const DEFAULT_WIDGET_URL =\n 'https://cdn.jsdelivr.net/npm/@8wave/ai-elements/dist/ai-elements.es.js'\n\nexport enum AgentLoaderStrategy {\n InlineModule = 'inline-module',\n ScriptSrc = 'script-src',\n DynamicImport = 'dynamic-import',\n}\n\nexport enum AgentChannel {\n Frontoffice = 'frontoffice',\n App = 'app',\n Widget = 'widget',\n}\n\nexport const ALL_AGENT_CHANNELS = Object.values(AgentChannel) as AgentChannel[]\n\nexport const AgentInterfaceSchema = z.object({\n media: MediaSchema.optional(),\n logo: z.string().optional(),\n theme: z.enum(['light', 'dark', 'auto']).optional().default('auto'),\n mainColor: z\n .string()\n .regex(/^#[0-9A-Fa-f]{6}$/)\n .optional()\n .default('#000000'),\n textColor: z.enum(['auto', 'white', 'black']).optional().default('auto'),\n useColorsForAgentHeader: z.boolean().optional().default(false),\n initialMessage: LocalizedStringSchema.optional(),\n greeting: z.array(LocalizedStringSchema).min(1).max(10).optional(),\n messagePlaceholder: LocalizedStringSchema.optional(),\n dismissableNotice: LocalizedStringSchema.optional(),\n footerMessage: LocalizedStringSchema.optional(),\n privacyPolicyNotice: LocalizedStringSchema.optional(),\n welcomePopup: z.boolean().optional().default(false),\n floatingButtonPosition: z\n .enum(['left', 'right'])\n .optional()\n .default('right'),\n maxMessageLength: z.number().int().positive().optional(),\n widgetUrl: z.url().default(DEFAULT_WIDGET_URL),\n loadDelay: z.number().int().min(0).max(30000).optional().default(0),\n loaderStrategy: z\n .enum(AgentLoaderStrategy)\n .optional()\n .default(AgentLoaderStrategy.InlineModule),\n customCss: z.string().optional(),\n smoothStream: z.boolean().optional().default(false),\n /**\n * Show every agent step (reasoning, tool calls) as an expanded timeline\n * in the chat instead of the compact activity indicator. Only meaningful\n * when reasoning is enabled on the agent model.\n */\n showExtendedSteps: z.boolean().optional().default(false),\n})\nexport type AgentInterface = z.infer<typeof AgentInterfaceSchema>\n\nexport const CHAT_FILE_UPLOAD_DEFAULT_MIME_TYPES = [\n 'image/jpeg',\n 'image/png',\n 'image/gif',\n 'image/webp',\n 'application/pdf',\n 'text/plain',\n 'text/markdown',\n 'text/csv',\n] as const\n\nexport type ChatFileUploadMimeType =\n (typeof CHAT_FILE_UPLOAD_DEFAULT_MIME_TYPES)[number]\n\nexport const CHAT_FILE_UPLOAD_MAX_FILE_SIZE_BYTES = 104_857_600 // 100 MB\n\nexport const AgentFileUploadSchema = z.object({\n enabled: z.boolean().default(false),\n maxFileSizeBytes: z\n .number()\n .int()\n .positive()\n .max(CHAT_FILE_UPLOAD_MAX_FILE_SIZE_BYTES)\n .optional()\n .default(20_971_520),\n allowedMimeTypes: z\n .array(z.string().regex(MIME_TYPE_REGEX))\n .optional()\n .default([...CHAT_FILE_UPLOAD_DEFAULT_MIME_TYPES]),\n maxFilesPerMessage: z\n .number()\n .int()\n .positive()\n .max(10)\n .optional()\n .default(5),\n maxFilesPerChat: z.number().int().positive().max(50).optional().default(20),\n})\nexport type AgentFileUpload = z.infer<typeof AgentFileUploadSchema>\n\nexport const AgentGatewayOptionsSchema = z.object({\n zeroDataRetention: z.boolean().default(true),\n disallowPromptTraining: z.boolean().default(true),\n providerTimeoutMs: z.number().int().min(1000).max(789000).optional(),\n})\nexport type AgentGatewayOptions = z.infer<typeof AgentGatewayOptionsSchema>\n\nexport const AgentSettingsSchema = z.object({\n model: AgentModelSchema,\n interface: AgentInterfaceSchema,\n tools: AgentToolsSchema.optional().default(() =>\n AgentToolsSchema.parse({}),\n ),\n fileUpload: AgentFileUploadSchema.optional().default(() =>\n AgentFileUploadSchema.parse({}),\n ),\n gatewayOptions: AgentGatewayOptionsSchema.optional().default(() =>\n AgentGatewayOptionsSchema.parse({}),\n ),\n channels: z\n .array(z.enum(AgentChannel))\n .optional()\n .default(() => [...ALL_AGENT_CHANNELS]),\n /**\n * JSON Schema definition for the `externalContext` field accepted in chat\n * requests. Only top-level string-keyed properties that match this schema\n * will be forwarded to the LLM. When absent, all external context is\n * silently ignored (deny-by-default).\n */\n externalContextSchema: jsonSchemaField.optional(),\n})\nexport type AgentSettings = z.infer<typeof AgentSettingsSchema>\n\nexport const AgentSecuritySchema = z.object({\n rateLimits: z.object({\n minuteRateLimit: z.number().int().min(0).optional(),\n hourRateLimit: z.number().int().min(0).optional(),\n dayRateLimit: z.number().int().min(0).optional(),\n monthRateLimit: z.number().int().min(0).optional(),\n }),\n trustedOrigins: z\n .object({\n origins: z\n .array(z.url().or(z.literal('')))\n .overwrite((items) => {\n return items?.filter((item) => item?.trim())\n })\n .default([]),\n })\n .default({ origins: [] }),\n})\nexport type AgentSecurity = z.infer<typeof AgentSecuritySchema>\n\nexport const AgentDtoSchema = z.object({\n id: z.string().optional(),\n name: z.string(),\n prompt: z.string().optional(),\n model: z.string().default(LanguageModel.gpt52Chat),\n fallbackModels: z.array(z.string()).default([]),\n status: z.enum(AgentStatus).default(AgentStatus.Draft),\n visibility: z.enum(AgentVisibility).default(AgentVisibility.Organization),\n settings: AgentSettingsSchema,\n security: AgentSecuritySchema.nullish(),\n type: z.enum(AgentType).default(AgentType.Chat),\n organizationId: z.string(),\n})\n\nexport const AgentSchema = z.lazy(() =>\n z.object({\n id: z.string(),\n name: z.string(),\n prompt: z.string(),\n model: z.string(),\n fallbackModels: z.array(z.string()).nullable().default([]),\n status: z.enum(AgentStatus).default(AgentStatus.Draft),\n visibility: z\n .enum(AgentVisibility)\n .default(AgentVisibility.Organization),\n settings: AgentSettingsSchema,\n security: AgentSecuritySchema.nullable(),\n type: z.enum(AgentType).default(AgentType.Chat),\n organizationId: z.string(),\n createdAt: z.coerce.date(),\n createdBy: z.string(),\n updatedAt: z.coerce.date(),\n updatedBy: z.string(),\n deleted: z.boolean(),\n deletedAt: z.coerce.date().nullable(),\n deletedBy: z.string().nullable(),\n outOfBudget: z.boolean().optional().default(false),\n outOfBudgetReason: z.string().optional().default(''),\n }),\n)\n\n/* -------------------------------------------------------------------------- *\n * Agent exposure tiers\n *\n * The same agent is serialized at decreasing levels of detail depending on\n * who is asking. Each tier is a strict narrowing of the one above it:\n *\n * Agent Full internal entity — prompt, model, settings, security.\n * Never leaves the trusted (admin/backoffice) boundary.\n * AgentPublic Client view for a viewer who ALREADY HAS ACCESS. \"Public\"\n * means \"safe to expose to the client\", NOT \"visibility =\n * public\": a private/organization agent is still served as\n * AgentPublic once the viewer is authorized.\n * AgentBranding Minimal, safe subset shown to ANONYMOUS viewers on the\n * pre-login screen — just enough to render branded chrome.\n * AgentAccess Envelope returned by the `/access` endpoint: a discriminated\n * union on `requiresAuth` that resolves to either an\n * AgentPublic (access granted) or an AgentBranding (login\n * required), plus the available auth methods.\n * -------------------------------------------------------------------------- */\n\nexport const AgentPublicSchema = z.object({\n id: z.string(),\n name: z.string(),\n status: z.enum(AgentStatus),\n visibility: z.enum(AgentVisibility),\n organizationId: z.string(),\n interface: AgentInterfaceSchema,\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n capabilities: z.object({\n fileUpload: AgentFileUploadSchema,\n }),\n channels: z\n .array(z.enum(AgentChannel))\n .default(() => [...ALL_AGENT_CHANNELS]),\n})\n\n/**\n * Safe subset of `AgentInterface` exposed to anonymous users on the public\n * \"access\" endpoint to render a branded login screen. Mirrors the field names\n * of `AgentInterfaceSchema` (via `pick`) so consumers can read branding the\n * same way for both `AgentPublic.interface` and `AgentBranding.interface`.\n *\n * 🔒 NEVER add sensitive fields here (system prompt, models, tools, …).\n */\nexport const AgentBrandingInterfaceSchema = AgentInterfaceSchema.pick({\n logo: true,\n mainColor: true,\n textColor: true,\n theme: true,\n floatingButtonPosition: true,\n customCss: true,\n})\nexport type AgentBrandingInterface = z.infer<\n typeof AgentBrandingInterfaceSchema\n>\n\nexport const AgentBrandingSchema = AgentPublicSchema.pick({\n id: true,\n name: true,\n organizationId: true,\n}).extend({\n interface: AgentBrandingInterfaceSchema,\n})\nexport type AgentBranding = z.infer<typeof AgentBrandingSchema>\n\nexport const AuthMethodsSchema = z.object({\n emailPassword: z.boolean(),\n google: z.boolean(),\n microsoft: z.boolean(),\n})\nexport type AuthMethods = z.infer<typeof AuthMethodsSchema>\n\n/**\n * Access decision for an agent, WITHOUT the auth methods.\n *\n * Discriminated on `requiresAuth` so the two outcomes are mutually exclusive at\n * the type level — no caller has to null-check `agent`/`branding` by hand:\n * - `requiresAuth: false` → access granted, full `agent` is present.\n * - `requiresAuth: true` → login required, only `branding` is present.\n *\n * This is what the service returns; the controller layers `authMethods` on top\n * to produce {@link AgentAccessSchema}.\n */\nexport const AgentAccessGrantedSchema = z.object({\n requiresAuth: z.literal(false),\n agent: AgentPublicSchema,\n branding: z.null(),\n})\n\nexport const AgentAccessRequiresAuthSchema = z.object({\n requiresAuth: z.literal(true),\n agent: z.null(),\n branding: AgentBrandingSchema,\n})\n\nexport const AgentAccessDecisionSchema = z.discriminatedUnion('requiresAuth', [\n AgentAccessGrantedSchema,\n AgentAccessRequiresAuthSchema,\n])\nexport type AgentAccessDecision = z.infer<typeof AgentAccessDecisionSchema>\n\n/**\n * Full payload returned by the public `/access` endpoint: the\n * {@link AgentAccessDecisionSchema} plus the auth methods the client may offer\n * on the login screen.\n */\nexport const AgentAccessSchema = z.discriminatedUnion('requiresAuth', [\n AgentAccessGrantedSchema.extend({ authMethods: AuthMethodsSchema }),\n AgentAccessRequiresAuthSchema.extend({ authMethods: AuthMethodsSchema }),\n])\nexport type AgentAccess = z.infer<typeof AgentAccessSchema>\n\n/**\n * Per-member allowlist of `organization`-visibility agents. An empty `agentIds`\n * means \"no restriction\" — the member can use every organization agent (the\n * default). A non-empty list limits the member to those agents. Owners/admins\n * always bypass it. `id` is the member's user id, so the resource can be\n * cached/updated as a keyed entity by the frontend store. Used as both the GET\n * response and the PUT body of the backoffice `/members/:userId/agent-access`\n * endpoint.\n */\nexport const MemberAgentAccessSchema = z.object({\n id: z.uuid(),\n agentIds: z.array(z.uuid()),\n})\nexport type MemberAgentAccess = z.infer<typeof MemberAgentAccessSchema>\n\nexport const AgentsQuerystringSchema = z.object({\n ...zodQs.pagination(),\n ...zodQs.sort([\n 'id',\n 'updatedAt',\n 'createdAt',\n 'name',\n 'type',\n 'status',\n 'visibility',\n 'model',\n ]),\n ...zodQs.filters(['done', 'type']),\n ...zodQs.filter('id'),\n ...zodQs.fullText(),\n ...zodQs.ids(),\n})\n\nexport type AgentDto = z.infer<typeof AgentDtoSchema>\nexport type Agent = z.infer<typeof AgentSchema>\nexport type AgentPublic = z.infer<typeof AgentPublicSchema>\n\nexport type AgentQuerystring = z.infer<typeof AgentsQuerystringSchema>\n","import * as z from 'zod'\n\nexport enum AbuseCategory {\n Harassment = 'harassment',\n HateSpeech = 'hate_speech',\n SexualContent = 'sexual_content',\n SelfHarm = 'self_harm',\n Violence = 'violence',\n PromptInjection = 'prompt_injection',\n DataExtraction = 'data_extraction',\n Spam = 'spam',\n OffTopicPersistent = 'off_topic_persistent',\n Impersonation = 'impersonation',\n}\n\nexport enum AbuseConfidence {\n Low = 'low',\n Medium = 'medium',\n High = 'high',\n}\n\nexport enum LlmIssueCategory {\n Hallucination = 'hallucination',\n OffBrand = 'off_brand',\n DataLeak = 'data_leak',\n InappropriateTone = 'inappropriate_tone',\n RefusalLoop = 'refusal_loop',\n Repetition = 'repetition',\n}\n\nexport enum ConversationAnalysisTrigger {\n SummaryCycle = 'summary_cycle',\n AgentRequest = 'agent_request',\n Manual = 'manual',\n}\n\nexport enum UserEngagement {\n High = 'high',\n Medium = 'medium',\n Low = 'low',\n Disengaged = 'disengaged',\n}\n\nexport enum UserTone {\n Polite = 'polite',\n Neutral = 'neutral',\n Impatient = 'impatient',\n Aggressive = 'aggressive',\n Abusive = 'abusive',\n}\n\nexport enum Sentiment {\n Positive = 'positive',\n Neutral = 'neutral',\n Negative = 'negative',\n Frustrated = 'frustrated',\n Excited = 'excited',\n}\n\nexport enum SentimentTrend {\n Improving = 'improving',\n Stable = 'stable',\n Degrading = 'degrading',\n}\n\nexport const ConversationAnalysisSchema = z.object({\n // --- Metadata (set programmatically, not by the LLM) ---\n analyzedAt: z.coerce.date().describe('When the analysis was generated.'),\n analysisTrigger: z\n .enum(ConversationAnalysisTrigger)\n .describe('What triggered this analysis run.'),\n\n // --- Sentiment & Tone ---\n sentiment: z\n .enum(Sentiment)\n .describe('Overall user sentiment in the conversation.'),\n sentimentTrend: z\n .enum(SentimentTrend)\n .describe('How the user sentiment evolved during the conversation.'),\n userTone: z\n .enum(UserTone)\n .describe('Predominant tone of the user messages.'),\n\n // --- Language ---\n language: z\n .string()\n .max(10)\n .describe(\n 'ISO 639-1 language code of the conversation (e.g. \"en\", \"it\").',\n ),\n\n // --- Topics ---\n topics: z\n .array(z.string().max(100))\n .max(10)\n .describe('Main topics discussed, as short lowercase labels.'),\n\n // --- User Abuse Detection ---\n userAbuseDetected: z\n .boolean()\n .describe(\n 'Whether user abuse was detected. If false, userAbuseCategories MUST be empty.',\n ),\n userAbuseCategories: z\n .array(z.enum(AbuseCategory))\n .default([])\n .describe(\n 'Abuse categories detected. Non-empty only if userAbuseDetected is true.',\n ),\n userAbuseConfidence: z\n .enum(AbuseConfidence)\n .optional()\n .describe(\n 'Confidence level of the abuse detection. Set only if userAbuseDetected is true.',\n ),\n userAbuseSummary: z\n .string()\n .max(500)\n .optional()\n .describe(\n 'Brief description of the abusive behavior detected. Always write in English. Set only if userAbuseDetected is true.',\n ),\n\n // --- LLM Quality Issues ---\n llmIssueDetected: z\n .boolean()\n .describe(\n 'Whether an LLM quality issue was detected. If false, llmIssueCategories MUST be empty.',\n ),\n llmIssueCategories: z\n .array(z.enum(LlmIssueCategory))\n .default([])\n .describe(\n 'LLM issue categories detected. Non-empty only if llmIssueDetected is true.',\n ),\n llmIssueSummary: z\n .string()\n .max(500)\n .optional()\n .describe(\n 'Brief description of the LLM quality issue detected. Always write in English. Set only if llmIssueDetected is true.',\n ),\n\n // --- Engagement ---\n userEngagement: z\n .enum(UserEngagement)\n .describe('Level of user engagement in the conversation.'),\n conversationGoalMet: z\n .boolean()\n .optional()\n .describe(\n 'Whether the user seems to have achieved what they came for. Leave undefined if unclear.',\n ),\n\n // --- Risk Score ---\n riskScore: z\n .number()\n .int()\n .min(0)\n .max(100)\n .describe(\n 'Overall risk score (0 = safe, 100 = critical). Combination of abuse severity, persistence and escalation.',\n ),\n})\n\nexport type ConversationAnalysis = z.infer<typeof ConversationAnalysisSchema>\n","import * as z from 'zod'\nimport { zodQs } from '../utils'\nimport type { UIMessage, LanguageModelUsage } from 'ai'\nimport { ConversationAnalysisSchema } from './ConversationAnalysis'\nimport {\n AgentBuiltInTool,\n AgentGatewayOptionsSchema,\n AgentReasoningSchema,\n AgentWebSearchSchema,\n AgentSearchMode,\n AgentRankingSchema,\n} from './Agent'\nimport { MIME_TYPE_REGEX } from './Media'\nimport type { PlatformContext } from './Platform'\n\nexport const DeviceContextSchema = z.object({\n dateTime: z.string().optional(),\n timezone: z.string().optional(),\n language: z.string().optional(),\n languages: z.array(z.string()).optional(),\n url: z.string().optional(),\n pathname: z.string().optional(),\n pageTitle: z.string().optional(),\n referrer: z.string().optional(),\n screenWidth: z.number().optional(),\n screenHeight: z.number().optional(),\n viewportWidth: z.number().optional(),\n viewportHeight: z.number().optional(),\n devicePixelRatio: z.number().optional(),\n maxTouchPoints: z.number().optional(),\n hardwareConcurrency: z.number().optional(),\n deviceMemory: z.number().optional(),\n platform: z.string().optional(),\n connectionType: z.string().optional(),\n connectionEffectiveType: z.string().optional(),\n connectionDownlink: z.number().optional(),\n connectionRtt: z.number().optional(),\n saveData: z.boolean().optional(),\n darkMode: z.boolean().optional(),\n reducedMotion: z.boolean().optional(),\n historyLength: z.number().optional(),\n geolocationLatitude: z.number().optional(),\n geolocationLongitude: z.number().optional(),\n geolocationAccuracy: z.number().optional(),\n geolocationCity: z.string().optional(),\n})\n\nexport type DeviceContext = z.infer<typeof DeviceContextSchema>\n\nconst TextPartSchema = z.object({\n type: z.literal('text'),\n text: z.string(),\n})\n\nconst FilePartSchema = z.object({\n type: z.literal('file'),\n mediaType: z.string().regex(MIME_TYPE_REGEX),\n url: z.url(),\n filename: z.string().optional(),\n providerMetadata: z\n .record(z.string(), z.record(z.string(), z.unknown()))\n .optional(),\n})\n\nconst MessagePartSchema = z.discriminatedUnion('type', [\n TextPartSchema,\n FilePartSchema,\n])\n\nexport const ChatRequestSchema = z.object({\n id: z.string(),\n messages: z.array(\n z.object({\n id: z.string().optional(),\n role: z.enum(['assistant', 'user']),\n content: z.string(),\n parts: z.array(MessagePartSchema),\n createdAt: z.string().optional(),\n }),\n ),\n model: z.string().optional(),\n temperature: z.number().optional(),\n prompt: z.string().optional(),\n maxOutputTokens: z.number().positive().optional(),\n presencePenalty: z.number().min(-2).max(2).optional(),\n frequencyPenalty: z.number().min(-2).max(2).optional(),\n searchMode: z.enum(AgentSearchMode).optional(),\n limit: z.number().optional(),\n ranking: AgentRankingSchema.optional(),\n reasoning: AgentReasoningSchema,\n webSearch: AgentWebSearchSchema.optional(),\n maxStepCount: z.number().int().min(1).max(40).optional(),\n disabledTools: z.array(z.enum(AgentBuiltInTool)).optional(),\n fallbackModels: z.array(z.string()).optional(),\n gatewayOptions: AgentGatewayOptionsSchema.partial().optional(),\n deviceContext: DeviceContextSchema.optional(),\n externalContext: z.record(z.string(), z.unknown()).optional(),\n smoothStream: z.boolean().optional(),\n})\n\nexport type ChatRequest = z.infer<typeof ChatRequestSchema>\n\nexport enum BlockedReasonCode {\n SevereAbuse = 'severe_abuse',\n HighRiskScore = 'high_risk_score',\n RepeatedWarnings = 'repeated_warnings',\n}\n\nexport type ChatMetadata = {\n ipAddress: string\n origin: string\n userAgent: string\n}\n\nexport type ChatMessageActions =\n 'show-info' | 'revise' | 'regenerate' | 'upvote' | 'downvote' | 'feedback'\n\nexport type Chat = z.infer<typeof ChatSchema>\nexport type ChatsQuerystring = z.infer<typeof ChatsQuerystringSchema>\n\nexport type UIChatMessageDeviceContext = DeviceContext\n\nexport type UIChatMessageMetadata = {\n /** Unix timestamp (ms) when the stream started */\n createdAt?: number\n /** Unix timestamp (ms) when the stream finished */\n completedAt?: number\n /** Canonical model ID used for the request (e.g. `google/gemini-3-flash`) */\n model?: string\n /** Total tokens consumed across all steps */\n totalTokens?: number\n /** Per-tool-call durations in ms, keyed by tool call ID */\n partTimings?: Record<string, number>\n /** Client device context sent with the request */\n deviceContext?: UIChatMessageDeviceContext\n /** Platform channel context (WhatsApp/Teams), the device-context equivalent for platform turns */\n platformContext?: PlatformContext\n /** External context provided by the host application and validated server-side */\n externalContext?: Record<string, unknown>\n /** Provider that ultimately served the request (e.g. `vertex`, `openai`) */\n resolvedProvider?: string\n /** Actual model ID as exposed by the resolved provider (e.g. `gemini-3-flash-preview`) */\n resolvedModelId?: string\n /** Market cost of the request in USD, as a numeric string */\n cost?: string\n /** Number of model-level routing attempts made by the gateway */\n modelAttemptCount?: number\n /** Total number of provider-level attempts (includes retries across providers) */\n totalProviderAttemptCount?: number\n /** Whether Zero Data Retention was active for this request */\n zeroDataRetention?: boolean\n /** Whether the provider was instructed not to use the prompt for model training */\n disallowPromptTraining?: boolean\n /** Vercel AI Gateway generation ID, useful for tracing in the Vercel dashboard */\n generationId?: string\n /** Tokens served from the provider's prompt cache (e.g. Gemini context caching) */\n cachedTokens?: number\n /** Provider traffic tier (e.g. `PROVISIONED_THROUGHPUT`, `ON_DEMAND`) */\n trafficType?: string\n}\n\nexport type UIChatMessage = UIMessage & {\n metadata?: UIChatMessageMetadata\n}\n\nexport const ChatSchema = z.object({\n id: z.string(),\n messages: z.array(z.unknown()) as unknown as z.ZodType<UIChatMessage[]>,\n title: z.string().nullable(),\n summary: z.string().nullable(),\n messageCountAtLastSummary: z.string().nullable(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n metadata: z.record(z.string(), z.unknown()),\n totalCostInUSD: z.string(),\n usage: z.unknown() as unknown as z.ZodType<LanguageModelUsage>,\n agentId: z.string().nullable(),\n userId: z.string(),\n organizationId: z.string(),\n deleted: z.boolean(),\n deletedAt: z.coerce.date().nullable(),\n deletedBy: z.string().nullable(),\n conversationAnalysis: ConversationAnalysisSchema.nullable().optional(),\n blocked: z.boolean(),\n blockedAt: z.coerce.date().nullable(),\n blockedReasonCode: z.enum(BlockedReasonCode).nullable(),\n blockedReason: z.string().nullable(),\n warningCount: z.number(),\n lastMessageAt: z.coerce.date(),\n})\n\nexport const ChatsQuerystringSchema = z.object({\n ...zodQs.pagination(),\n ...zodQs.sort(['updatedAt', 'createdAt', 'lastMessageAt']),\n ...zodQs.filters(['agentId', 'userId']),\n ...zodQs.range('updatedAt'),\n ...zodQs.range('lastMessageAt'),\n ...zodQs.ids(),\n startDate: z.string().optional(),\n endDate: z.string().optional(),\n})\n\nexport const ChatsPublicSchema = z.object({\n id: z.string(),\n agentId: z.string().optional(),\n organizationId: z.string(),\n summary: z.string().optional(),\n title: z.string().optional(),\n userId: z.string(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n lastMessageAt: z.coerce.date(),\n messages: z.array(z.unknown()),\n blocked: z.boolean(),\n})\n\nexport type ChatPublic = z.infer<typeof ChatsPublicSchema>\n","var e=class{constructor(e,t){this.operator=e,this.value=t,Object.defineProperty(this,`_notes`,{writable:!0})}get notes(){return this._notes}addNote(e){this._notes=this._notes||[],this._notes.push(e)}},t=class extends e{},n=class extends t{constructor(e,t){if(!Array.isArray(t))throw Error(`\"${e}\" operator expects to receive an array of conditions`);super(e,t)}};const r=`__itself__`;var i=class extends e{constructor(e,t,n){super(e,n),this.field=t}};const a=new t(`__null__`,null),o=Object.hasOwn||((e,t)=>Object.prototype.hasOwnProperty.call(e,t));function s(e,t){return t instanceof n&&t.operator===e}function c(e,t){let r;for(let i=0,a=t.length;i<a;i++){let a=t[i];if(a instanceof n){if(a.operator!==e){r&&r.push(a);continue}if(a.value.length===0)continue;r||(r=t.slice(0,i));let n=a.value;for(let e=0,t=n.length;e<t;e++)r.push(n[e])}else r&&r.push(a)}return r||t}function l(e,t){if(t.length===1)return t[0];if(t.length===0)return new n(e,t);let r=c(e,t);return r.length===1?r[0]:(r.length,new n(e,r))}const u=e=>e,d=()=>Object.create(null),f=Object.defineProperty(d(),`__@type@__`,{value:`ignore value`});function p(e,t,n=!1){if(!e||e&&e.constructor!==Object)return!1;for(let r in e)if(o(e,r)&&o(t,r)&&(!n||e[r]!==f))return!0;return!1}function m(e){let t=[];for(let n in e)o(e,n)&&e[n]!==f&&t.push(n);return t}function h(e,t){t!==a&&e.push(t)}const g=e=>l(`and`,e),_=e=>l(`or`,e);function v(e,t){let n=e[t];if(typeof n!=`function`)throw Error(`Unable to interpret \"${String(t)}\" condition. Did you forget to register interpreter for it?`);return n}function y(e){return e.operator}function b(e,t){let n=t,r=n&&n.getInterpreterName||y,i;switch(n?n.numberOfArguments:0){case 1:i=(t=>v(e,r(t,n))(t,a));break;case 3:i=((t,i,o)=>v(e,r(t,n))(t,i,o,a));break;default:i=((t,i)=>v(e,r(t,n))(t,i,a));break}let a={...n,interpret:i};return a.interpret}const x={compound(e,t,r){let i=(Array.isArray(t)?t:[t]).map(e=>r.parse(e));return new n(e.name,i)},field(e,t,n){return new i(e.name,n.field,t)},document(e,n){return new t(e.name,n)}};var S=class{constructor(e,t=d()){this.parse=this.parse.bind(this),this._options={operatorToConditionName:t.operatorToConditionName||u,defaultOperatorName:t.defaultOperatorName||`eq`,mergeFinalConditions:t.mergeFinalConditions||g},this._instructions=Object.keys(e).reduce((t,n)=>(t[n]={name:this._options.operatorToConditionName(n),...e[n]},t),{}),this._fieldInstructionContext={...t.fieldContext,field:``,query:{},parse:this.parse,hasOperators:e=>p(e,this._instructions,t.useIgnoreValue)},this._documentInstructionContext={...t.documentContext,parse:this.parse,query:{}},this._objectKeys=t.useIgnoreValue?m:Object.keys}setParse(e){this.parse=e,this._fieldInstructionContext.parse=e,this._documentInstructionContext.parse=e}parseField(e,t,n,r){let i=this._instructions[t];if(!i)throw Error(`Unsupported operator \"${t}\"`);if(i.type!==`field`)throw Error(`Unexpected ${i.type} operator \"${t}\" at field level`);return this._fieldInstructionContext.field=e,this._fieldInstructionContext.query=r,this.parseInstruction(i,n,this._fieldInstructionContext)}parseInstruction(e,t,n){return typeof e.validate==`function`&&e.validate(e,t),(e.parse||x[e.type])(e,t,n)}parseFieldOperators(e,t){let n=[],r=this._objectKeys(t);for(let i=0,a=r.length;i<a;i++){let a=r[i];if(!this._instructions[a])throw Error(`Field query for \"${e}\" may contain only operators or a plain object as a value`);h(n,this.parseField(e,a,t[a],t))}return n}parse(e){let t=[],n=this._objectKeys(e);this._documentInstructionContext.query=e;for(let r=0,i=n.length;r<i;r++){let i=n[r],a=e[i],o=this._instructions[i];if(o){if(o.type!==`document`&&o.type!==`compound`)throw Error(`Cannot use parsing instruction for operator \"${i}\" in \"document\" context as it is supposed to be used in \"${o.type}\" context`);h(t,this.parseInstruction(o,a,this._documentInstructionContext))}else this._fieldInstructionContext.hasOperators(a)?t.push(...this.parseFieldOperators(i,a)):h(t,this.parseField(i,this._options.defaultOperatorName,a,e))}return this._options.mergeFinalConditions(t)}};function C(e,t){return(n,...r)=>{let i=e(n,...r),a=t.bind(null,i);return Object.defineProperty(a,`ast`,{value:i}),a}}export{n as CompoundCondition,e as Condition,t as DocumentCondition,i as FieldCondition,r as ITSELF,a as NULL_CONDITION,S as ObjectQueryParser,g as buildAnd,_ as buildOr,b as createInterpreter,C as createTranslatorFactory,x as defaultInstructionParsers,p as hasOperators,u as identity,f as ignoreValue,s as isCompound,d as object,l as optimizedCompoundCondition};\n//# sourceMappingURL=index.mjs.map","import{CompoundCondition as e,FieldCondition as t,ITSELF as n,NULL_CONDITION as r,ObjectQueryParser as i,buildAnd as a,defaultInstructionParsers as o,optimizedCompoundCondition as s}from\"@ucast/core\";var c=Object.defineProperty,l=((e,t)=>{let n={};for(var r in e)c(n,r,{get:e[r],enumerable:!0});return t||c(n,Symbol.toStringTag,{value:`Module`}),n})({$all:()=>y,$and:()=>u,$elemMatch:()=>h,$eq:()=>E,$exists:()=>x,$gt:()=>C,$gte:()=>S,$in:()=>_,$lt:()=>w,$lte:()=>T,$mod:()=>b,$ne:()=>D,$nin:()=>v,$nor:()=>f,$not:()=>m,$options:()=>k,$or:()=>d,$regex:()=>O,$size:()=>g,$where:()=>A});const u={type:`compound`,validate:M,parse(e,t,n){let r=p(e,t,n);return s(e.name,r)}},d=u,f={type:`compound`,validate:M,parse(t,n,r){let i=p(t,n,r);return new e(t.name,i)}};function p(e,t,n){let r=Array(t.length);for(let i=0;i<t.length;i++){let a=t[i];F(e,a,i),r[i]=n.parse(a)}return r}const m={type:`field`,validate(e,t){if(!(t&&(t instanceof RegExp||t.constructor===Object)))throw Error(`\"${e.name}\" expects to receive either regular expression or object of field operators`)},parse(n,r,i){let a=r instanceof RegExp?new t(`regex`,i.field,r):i.parse(r,i);return new e(n.name,[a])}},h={type:`field`,validate(e,t){if(!t||t.constructor!==Object)throw Error(`\"${e.name}\" expects to receive an object with nested query or field level operators`)},parse(e,r,{parse:i,field:a,hasOperators:o}){let s=o(r)?i(r,{field:n}):i(r);return new t(e.name,a,s)}},g={type:`field`,validate:P(`number`)},_={type:`field`,validate:j},v=_,y=_,b={type:`field`,validate(e,t){if(!Array.isArray(t)||t.length!==2)throw Error(`\"${e.name}\" expects an array with 2 numeric elements`)}},x={type:`field`,validate:P(`boolean`)},S={type:`field`,validate:N},C=S,w=C,T=C,E={type:`field`},D=E,O={type:`field`,validate(e,t){if(!(t instanceof RegExp)&&typeof t!=`string`)throw Error(`\"${e.name}\" expects value to be a regular expression or a string that represents regular expression`)},parse(e,n,r){let i=typeof n==`string`?new RegExp(n,r.query.$options||``):n;return new t(e.name,r.field,i)}},k={type:`field`,parse:()=>r},A={type:`document`,validate:P(`function`)};function j(e,t){if(!Array.isArray(t))throw Error(`\"${e.name}\" expects value to be an array`)}function M(e,t){if(j(e,t),!t.length)throw Error(`\"${e.name}\" expects to have at least one element in array`)}function N(e,t){if(!(typeof t==`string`||typeof t==`number`||t instanceof Date))throw Error(`\"${e.name}\" expects value to be comparable (i.e., string, number or date)`)}function P(e){return(t,n)=>{if(typeof n!==e)throw Error(`\"${t.name}\" expects value to be a \"${e}\"`)}}function F(e,t,n){let r=t;if(!r||r.constructor!==Object)throw Error(`\"${e.name}\" expects item at index ${n} to be an object`)}var I=class extends i{constructor(e){super(e,{defaultOperatorName:`$eq`,operatorToConditionName:e=>e.slice(1)})}parse(e,t){return t&&t.field?a(this.parseFieldOperators(t.field,e)):super.parse(e)}};const L=l;export{y as $all,u as $and,h as $elemMatch,E as $eq,x as $exists,C as $gt,S as $gte,_ as $in,w as $lt,T as $lte,b as $mod,D as $ne,v as $nin,f as $nor,m as $not,k as $options,d as $or,O as $regex,g as $size,A as $where,I as MongoQueryParser,L as allParsingInstructions,o as defaultParsers};\n//# sourceMappingURL=index.mjs.map","import type { MongoQuery } from '@ucast/mongo2js'\n\n// Minimal structural shape of the better-auth session consumed here.\n// Declared locally to avoid a workspace dependency cycle with `auth`\n// (auth depends on `ability` for its access-control config).\n// The full `auth` Session is structurally assignable to this type.\nexport type Session = {\n session: {\n activeOrganizationId?: string | null\n organizationRole?: string | null\n }\n user: {\n id?: string\n role?: string | null\n }\n}\n\nexport enum Audience {\n Backoffice = 'backoffice',\n Frontoffice = 'frontoffice',\n System = 'system',\n Public = 'public',\n}\n\nexport enum Subject {\n All = 'all',\n Todo = 'todo',\n User = 'user',\n Chat = 'chat',\n Agent = 'agent',\n SubAgent = 'subAgent',\n Document = 'document',\n AgentDocument = 'agent_document',\n AgentAnalytic = 'agent_analytic',\n McpServer = 'mcp_server',\n Media = 'media',\n RevisedAnswer = 'revised_answer',\n Organization = 'organization',\n Member = 'member',\n Lead = 'lead',\n MessageFeedback = 'message_feedback',\n Backoffice = 'backoffice',\n Frontoffice = 'frontoffice',\n System = 'system',\n Invitation = 'invitation',\n Crawler = 'crawler',\n ReasoningChat = 'reasoning_chat',\n TimeTrackerChat = 'time_tracker_chat',\n OrganizationExternalAuth = 'organization_external_auth',\n AgentEndpoint = 'agent_endpoint',\n AgentEndpointLog = 'agent_endpoint_log',\n AgentApiTool = 'agent_api_tool',\n DocumentFolder = 'document_folder',\n Integration = 'integration',\n Notification = 'notification',\n PlatformConnection = 'platform_connection',\n}\n\n// action\nexport type Action =\n | 'create'\n | 'read'\n | 'update'\n | 'delete'\n | 'manage'\n | 'impersonate'\n | 'invite'\n | 'access'\n | 'clone'\n | 'ban'\n | 'unban'\n | 'change-role'\n | 'resend'\n | 'cancel'\n | 'execute'\n | 'refill'\n\nexport type Capability = {\n action: Action\n subject: Subject\n fields?: string[]\n condition?: MongoQuery\n inverted?: boolean\n}\n\nexport type CapabilitiesFactory = (\n currentSession?: Session | null,\n) => Capability[]\n","import { AgentStatus } from 'models'\nimport type { CapabilitiesFactory } from '../types'\nimport { Subject } from '../types'\n\nconst GuestCapabilities: CapabilitiesFactory = (currentSession) => {\n if (!currentSession) {\n return []\n }\n return [\n // chats\n {\n subject: Subject.Chat,\n action: 'create',\n },\n {\n subject: Subject.Chat,\n action: 'read',\n condition: {\n createdBy: {\n $eq: currentSession.user?.id,\n },\n },\n },\n {\n subject: Subject.Chat,\n action: 'update',\n },\n {\n subject: Subject.Chat,\n action: 'delete',\n },\n // agents\n {\n subject: Subject.Agent,\n action: 'read',\n condition: {\n status: {\n $eq: AgentStatus.Active,\n },\n },\n },\n // feedbacks\n {\n subject: Subject.MessageFeedback,\n action: 'create',\n },\n {\n subject: Subject.MessageFeedback,\n action: 'read',\n condition: {\n createdBy: {\n $eq: currentSession.user?.id,\n },\n },\n },\n ]\n}\nexport default GuestCapabilities\n","import type { MongoAbility, InferSubjects, ForcedSubject } from '@casl/ability'\nimport type { MongoQuery } from '@ucast/mongo2js'\nimport { Action, Capability, Subject, type Session } from './types'\nimport { $or } from '@ucast/mongo2js'\nimport {\n AbilityBuilder,\n createMongoAbility,\n buildMongoQueryMatcher,\n Ability as PureAbility,\n createAliasResolver,\n FieldMatcher,\n subject as caslSubject,\n} from '@casl/ability'\nimport { organizationCapabilitiesByRole, userCapabilitiesByRole } from './roles'\nimport DefaultCapabilities from './roles/User'\nimport { createAccessControl } from 'better-auth/plugins'\nimport {\n adminAc,\n defaultStatements,\n memberAc,\n ownerAc,\n} from 'better-auth/plugins/organization/access'\n\nexport const OrganizationRoles = {\n admin: 'admin',\n owner: 'owner',\n member: 'member',\n user: 'user',\n} as const\n\nexport const UserRoles = {\n admin: 'admin',\n user: 'user',\n} as const\n\n// action alias\nconst resolveAction = createAliasResolver({\n modify: ['read', 'update', 'delete'],\n})\n\n// subject\nexport type AbilitySubject =\n | InferSubjects<'all' | Subject, true>\n | ForcedSubject<InferSubjects<'all' | Subject, true>>\ntype Ability = MongoAbility<[Action, AbilitySubject]>\n\n// matcher\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst conditionsMatcher = buildMongoQueryMatcher({ $or } as Record<string, any>)\nconst fieldMatcher: FieldMatcher = (fields) => (field) => fields.includes(field)\n\n// ability\nexport const ability = new PureAbility<[Action, AbilitySubject], MongoQuery>(\n DefaultCapabilities(),\n {\n conditionsMatcher,\n resolveAction,\n fieldMatcher,\n },\n)\n\nexport const isValidOrganizationRole = (\n role?: string | null,\n): role is keyof typeof OrganizationRoles => {\n if (!role) {\n return false\n }\n return role in OrganizationRoles\n}\n\nexport const isValidUserRole = (\n role?: string | null,\n): role is keyof typeof UserRoles => {\n if (!role) {\n return false\n }\n return role in UserRoles\n}\n\nexport const getOrganizationRoleCapabilities = (\n currentSession?: Session | null,\n): Capability[] => {\n const organizationRole = currentSession?.session?.organizationRole\n if (!isValidOrganizationRole(organizationRole)) {\n return DefaultCapabilities(currentSession)\n }\n const capabilities = organizationCapabilitiesByRole[organizationRole]\n if (typeof capabilities === 'function') {\n return capabilities(currentSession)\n }\n return capabilities\n}\n\nexport const getUserRoleCapabilities = (\n currentSession?: Session | null,\n): Capability[] => {\n const userRole = currentSession?.user?.role\n if (!isValidUserRole(userRole)) {\n return DefaultCapabilities(currentSession)\n }\n const capabilities = userCapabilitiesByRole[userRole]\n if (typeof capabilities === 'function') {\n return capabilities(currentSession)\n }\n return capabilities\n}\n\n/**\n * Builds a standalone ability instance for a session, without touching the\n * shared singleton. Use for per-call checks outside the HTTP request flow\n * (e.g. MCP tool handlers).\n */\nexport const buildAbilityForSession = (\n currentSession?: Session | null,\n): Ability => {\n const { can, build, cannot } = new AbilityBuilder<Ability>(\n createMongoAbility,\n )\n const organizationRoleCapabilities =\n getOrganizationRoleCapabilities(currentSession)\n const userRoleCapabilities = getUserRoleCapabilities(currentSession)\n const capabilities = [\n ...organizationRoleCapabilities,\n ...userRoleCapabilities,\n ]\n capabilities.forEach((capability) => {\n const { action, subject, fields, condition, inverted } = capability\n if (inverted) {\n cannot(action, subject, fields, condition)\n return\n }\n can(action, subject, fields, condition)\n })\n return build({\n conditionsMatcher,\n resolveAction,\n fieldMatcher,\n })\n}\n\nexport const updateAbilityFromSession = (currentSession?: Session | null) => {\n ability.update(buildAbilityForSession(currentSession).rules)\n}\n\nexport type PermissionMap = Partial<Record<Action, Subject>>\n\n/**\n * Evaluates a route-style permission map ({ action: Subject }) against an\n * ability instance. When `payload` is provided it is bound as subject\n * conditions, same as the HTTP route preHandler does with `request.body`.\n * Returns the first denied pair, or null when every check passes.\n * Single source of truth for both the HTTP preHandler and the Platform MCP\n * tool handlers.\n */\nexport const findDeniedPermission = (\n abilityInstance: Pick<Ability, 'can'>,\n permissions: PermissionMap,\n payload?: unknown,\n): { action: Action; subject: Subject } | null => {\n let action: Action\n for (action in permissions) {\n const actionSubject = permissions[action]\n if (!actionSubject) {\n continue\n }\n const target = payload\n ? caslSubject(\n actionSubject,\n payload as Record<PropertyKey, unknown>,\n )\n : actionSubject\n if (!abilityInstance.can(action, target)) {\n return { action, subject: actionSubject }\n }\n }\n return null\n}\n\nconst ac = createAccessControl(defaultStatements)\nconst adminRole = ac.newRole(adminAc.statements)\nconst ownerRole = ac.newRole(ownerAc.statements)\nconst memberRole = ac.newRole(memberAc.statements)\nconst userRole = ac.newRole(memberAc.statements)\n\nexport const betterAuthOrganizationSettings = {\n ac,\n roles: {\n owner: ownerRole,\n admin: adminRole,\n member: memberRole,\n user: userRole,\n },\n}\n\nexport * from './types'\nexport { subject } from '@casl/ability'\n","import { Audience } from 'ability'\nimport { ChatSchema, ChatsPublicSchema } from 'models'\nimport type {\n AgentAccess,\n Chat,\n MessageFeedback,\n AgentPublic,\n MediaSource,\n} from 'models'\nimport { addInitialSlash, removeTrailingSlash } from 'utils'\n\n// The chats endpoints respond with the full shape (frontoffice) or the\n// trimmed public one — same union the backend declares. Parsing coerces the\n// date fields (plain JSON strings otherwise); on mismatch keep the raw\n// payload instead of failing.\nconst ConversationSchema = ChatSchema.or(ChatsPublicSchema)\nfunction parseConversation(raw: unknown): Chat {\n const result = ConversationSchema.safeParse(raw)\n return (result.success ? result.data : raw) as Chat\n}\n\nexport interface ChatbotApiClientOptions {\n baseUrl: string\n basePath?: string\n headers?: () => Record<string, string> | undefined\n credentials?: RequestCredentials\n}\n\nexport interface SubmitFeedbackPayload {\n messageId: string\n chatId: string\n agentId: string\n vote?: 'upvote' | 'downvote'\n userQuestion: string\n assistantMessage: string\n comment?: string\n}\n\nexport interface SubmitLeadPayload {\n agentId: string\n chatId: string\n [key: string]: unknown\n}\n\n/** A file from the user's \"My files\" KB, as listed for a chat. */\nexport interface ChatbotFile {\n documentId: string\n name: string | null\n mimeType: string | null\n indexStatus: string\n createdAt: string\n}\n\nexport interface ChatbotApiClient {\n getConversations(\n agentId: string,\n userId: string | undefined,\n ): Promise<Chat[]>\n getChat(agentId: string, chatId: string): Promise<Chat | null>\n updateChatTitle(\n agentId: string,\n chatId: string,\n title: string,\n ): Promise<Chat>\n deleteChat(agentId: string, chatId: string): Promise<void>\n getMessageFeedbacks(chatId: string): Promise<MessageFeedback[]>\n submitMessageFeedback(\n payload: SubmitFeedbackPayload,\n ): Promise<MessageFeedback>\n submitLead(payload: SubmitLeadPayload): Promise<void>\n getAgent(orgSlug: string, agentId: string): Promise<AgentPublic>\n getAgentAccess(orgSlug: string, agentId: string): Promise<AgentAccess>\n getMediaUrl(agentId: string, chatId: string, storedFileName: string): string\n appendAuthToken(url: string): string\n uploadMedia(\n agentId: string,\n chatId: string,\n file: File,\n ): Promise<MediaSource>\n getChatEndpoint(agentId: string, type?: 'chat' | 'reasoning'): string\n expandSourceContext(\n agentId: string,\n documentId: string,\n chunkIndex: number,\n windowSize?: number,\n ): Promise<{ content: string }>\n downloadSourceDocument(\n agentId: string,\n documentId: string,\n ): Promise<{ downloadUrl: string; filename: string; mimeType: string }>\n reverseGeocode(\n lat: number,\n lon: number,\n lang?: string,\n ): Promise<string | undefined>\n forwardGeocode(\n query: string,\n lang?: string,\n ): Promise<\n { latitude: number; longitude: number; displayName: string } | undefined\n >\n getOAuthAuthorizeUrl(\n agentId: string,\n serverName: string,\n ): Promise<{ mcpServerId: string; authorizeUrl: string }>\n resolveShortUrls(hashes: string[]): Promise<Record<string, string>>\n getChatFiles(chatId: string): Promise<ChatbotFile[]>\n getChatFileDownloadUrl(documentId: string, inline?: boolean): string\n getChatFilePreviewUrl(documentId: string): string\n deleteChatFile(documentId: string): Promise<void>\n}\n\nexport function createChatbotApiClient(\n options: ChatbotApiClientOptions,\n): ChatbotApiClient {\n const basePath = options.basePath\n ? addInitialSlash(options.basePath)\n : `/api/v1/${Audience.Public}`\n\n const baseUrl = `${removeTrailingSlash(options.baseUrl)}${basePath}`\n\n // \"My files\" lives under the frontoffice audience, not the agent's base\n // (which may be public, backoffice, …) — derive it by swapping the trailing\n // audience segment of basePath for `frontoffice`.\n const frontofficeBase = `${removeTrailingSlash(options.baseUrl)}${basePath.replace(\n /\\/[^/]+$/,\n `/${Audience.Frontoffice}`,\n )}`\n\n async function request<T>(\n url: string,\n init?: RequestInit,\n responseType: 'json' | 'void' = 'json',\n ): Promise<T> {\n const response = await fetch(`${baseUrl}${url}`, {\n credentials: options.credentials ?? 'include',\n ...init,\n headers: {\n ...options.headers?.(),\n ...init?.headers,\n },\n })\n\n if (!response.ok) {\n throw new Error(\n `API error: ${response.status} ${response.statusText}`,\n )\n }\n\n if (responseType === 'void' || response.status === 204) {\n return undefined as T\n }\n\n return response.json() as Promise<T>\n }\n\n return {\n async getConversations(agentId, userId) {\n const userFilter = userId\n ? `&filter[userId]=${encodeURIComponent(userId)}`\n : ''\n const conversations = await request<unknown[]>(\n `/agents/${encodeURIComponent(agentId)}/chats?sort=-lastMessageAt&page[size]=100${userFilter}`,\n )\n return conversations.map(parseConversation)\n },\n\n async getChatFiles(chatId) {\n const response = await fetch(\n `${frontofficeBase}/me/documents?filter[chatId]=${encodeURIComponent(chatId)}&page[size]=100`,\n {\n credentials: options.credentials ?? 'include',\n headers: { ...options.headers?.() },\n },\n )\n if (!response.ok) {\n throw new Error(\n `API error: ${response.status} ${response.statusText}`,\n )\n }\n return (await response.json()) as ChatbotFile[]\n },\n\n getChatFileDownloadUrl(documentId, inline) {\n const suffix = inline ? '?inline=true' : ''\n // appendAuthToken carries a bearer in the query so <img>/<a>\n // subresources (which can't set an Authorization header) authorize\n // cross-origin in the embedded widget; no-op for cookie auth.\n return this.appendAuthToken(\n `${frontofficeBase}/me/documents/${encodeURIComponent(documentId)}/download${suffix}`,\n )\n },\n\n getChatFilePreviewUrl(documentId) {\n // Small resized preview blob for row thumbnails (see download\n // endpoint ?preview=true); auth token carried for cross-origin <img>.\n return this.appendAuthToken(\n `${frontofficeBase}/me/documents/${encodeURIComponent(documentId)}/download?preview=true`,\n )\n },\n\n async deleteChatFile(documentId) {\n const response = await fetch(\n `${frontofficeBase}/me/documents/${encodeURIComponent(documentId)}`,\n {\n method: 'DELETE',\n credentials: options.credentials ?? 'include',\n headers: { ...options.headers?.() },\n },\n )\n if (!response.ok) {\n throw new Error(\n `API error: ${response.status} ${response.statusText}`,\n )\n }\n },\n\n async getChat(agentId, chatId) {\n const result = await request<Chat | undefined>(\n `/agents/${encodeURIComponent(agentId)}/chats/${encodeURIComponent(chatId)}`,\n )\n return result ? parseConversation(result) : null\n },\n\n async updateChatTitle(agentId, chatId, title) {\n return parseConversation(\n await request<Chat>(\n `/agents/${encodeURIComponent(agentId)}/chats/${encodeURIComponent(chatId)}`,\n {\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ title }),\n },\n ),\n )\n },\n\n async deleteChat(agentId, chatId) {\n await request<void>(\n `/agents/${encodeURIComponent(agentId)}/chats/${encodeURIComponent(chatId)}`,\n { method: 'DELETE' },\n 'void',\n )\n },\n\n async getMessageFeedbacks(chatId) {\n return request<MessageFeedback[]>(\n `/message-feedbacks?filter[chatId]=${encodeURIComponent(chatId)}&page[size]=200`,\n )\n },\n\n async submitMessageFeedback(payload) {\n return request<MessageFeedback>('/message-feedbacks', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(payload),\n })\n },\n\n async submitLead(payload) {\n await request<void>(\n '/leads',\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(payload),\n },\n 'void',\n )\n },\n\n async getAgent(orgSlug, agentId) {\n return request<AgentPublic>(\n `/organizations/${encodeURIComponent(orgSlug)}/agents/${encodeURIComponent(agentId)}`,\n )\n },\n\n async getAgentAccess(orgSlug, agentId) {\n return request<AgentAccess>(\n `/organizations/${encodeURIComponent(orgSlug)}/agents/${encodeURIComponent(agentId)}/access`,\n )\n },\n\n async uploadMedia(agentId, chatId, file) {\n const formData = new FormData()\n formData.append('file', file)\n const response = await fetch(\n `${baseUrl}/agents/${encodeURIComponent(agentId)}/chats/${encodeURIComponent(chatId)}/media/upload`,\n {\n method: 'POST',\n credentials: options.credentials ?? 'include',\n // Do NOT set Content-Type — browser sets multipart/form-data with boundary automatically\n headers: options.headers?.(),\n body: formData,\n },\n )\n if (!response.ok) {\n const text = await response.text().catch(() => '')\n let title = `Upload failed: ${response.status}`\n try {\n title =\n (JSON.parse(text) as { title?: string }).title ?? title\n } catch {\n // ignore parse errors\n }\n throw new Error(title)\n }\n return response.json() as Promise<MediaSource>\n },\n\n getChatEndpoint(agentId, type = 'chat') {\n const path = type === 'reasoning' ? 'reasoning-chat' : 'chat'\n return `${baseUrl}/agents/${encodeURIComponent(agentId)}/${path}`\n },\n\n appendAuthToken(url) {\n const bearer = options\n .headers?.()\n ?.[`Authorization`]?.slice('Bearer '.length)\n if (!bearer) {\n return url\n }\n const separator = url.includes('?') ? '&' : '?'\n return `${url}${separator}token=${encodeURIComponent(bearer)}`\n },\n\n getMediaUrl(agentId, chatId, storedFileName) {\n const base = `${baseUrl}/agents/${encodeURIComponent(agentId)}/chats/${encodeURIComponent(chatId)}/media/${encodeURIComponent(storedFileName)}/view`\n return this.appendAuthToken(base)\n },\n\n async expandSourceContext(\n agentId,\n documentId,\n chunkIndex,\n windowSize = 2,\n ) {\n return request<{ content: string }>(\n `/agents/${encodeURIComponent(agentId)}/sources/expand-context`,\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n documentId,\n chunkIndex,\n windowSize,\n }),\n },\n )\n },\n\n async downloadSourceDocument(agentId, documentId) {\n return request<{\n downloadUrl: string\n filename: string\n mimeType: string\n }>(\n `/agents/${encodeURIComponent(agentId)}/sources/documents/${encodeURIComponent(documentId)}/download`,\n )\n },\n\n async reverseGeocode(lat, lon, lang) {\n const params = new URLSearchParams({\n lat: String(lat),\n lon: String(lon),\n })\n if (lang) {\n params.set('lang', lang)\n }\n try {\n const data = await request<{ displayName?: string }>(\n `/geocoder/reverse?${params}`,\n )\n return data.displayName\n } catch {\n return undefined\n }\n },\n\n async forwardGeocode(query, lang) {\n const params = new URLSearchParams({ q: query })\n if (lang) {\n params.set('lang', lang)\n }\n try {\n return await request<{\n latitude: number\n longitude: number\n displayName: string\n }>(`/geocoder/forward?${params}`)\n } catch {\n return undefined\n }\n },\n\n async getOAuthAuthorizeUrl(agentId, serverName) {\n const params = new URLSearchParams({ serverName })\n return request<{ mcpServerId: string; authorizeUrl: string }>(\n `/agents/${encodeURIComponent(agentId)}/mcp-oauth/authorize?${params}`,\n )\n },\n\n async resolveShortUrls(hashes) {\n // The redirect endpoint lives at `/api/r`, outside the JSON:API basePath\n const root = removeTrailingSlash(options.baseUrl)\n const response = await fetch(`${root}/api/r/resolve`, {\n method: 'POST',\n credentials: options.credentials ?? 'include',\n headers: {\n ...options.headers?.(),\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ hashes }),\n })\n if (!response.ok) {\n return {}\n }\n const data = (await response.json()) as {\n urls?: Record<string, string>\n }\n return data.urls ?? {}\n },\n }\n}\n"],"x_google_ignoreList":[3,4],"mappings":";;;;;;;;;AAKA,IAAY,IAAL,yBAAA,GAAA;QACH,EAAA,QAAA,SACA,EAAA,SAAA,UACA,EAAA,WAAA;AACJ,EAAA,CAAA,CAAA,GAEY,IAAL,yBAAA,GAAA;QACH,EAAA,SAAA,UACA,EAAA,UAAA,WACA,EAAA,eAAA;AACJ,EAAA,CAAA,CAAA,GAEY,IAAL,yBAAA,GAAA;QACH,EAAA,OAAA,QACA,EAAA,YAAA;AACJ,EAAA,CAAA,CAAA,GAEY,IAAL,yBAAA,GAAA;QACH,EAAA,WAAA,YACA,EAAA,WAAA,YACA,EAAA,UAAA;AACJ,EAAA,CAAA,CAAA,GAea,KAAwB,EAAS;CAC1C,iBAAiB,EACP;EAAC;EAAQ;EAAO;EAAU;EAAQ;CAAO,CAAC,CAAC,CAChD,SAAS;CACd,kBAAkB,EAAO;EAAC;EAAQ;EAAY;CAAS,CAAC,CAAC,CAAC,SAAS;AACvE,CAAC,GAGY,KAA2B,EAAS;CAC7C,MAAM,EAAO;EAAC;EAAY;EAAW;CAAU,CAAC,CAAC,CAAC,SAAS;CAC3D,QAAQ,EAAO;EAAC;EAAO;EAAU;EAAQ;EAAS;CAAK,CAAC,CAAC,CAAC,SAAS;CACnE,SAAS,EAAO,CAAC,cAAc,SAAS,CAAC,CAAC,CAAC,SAAS;CACpD,cAAc,E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