@docyrus/ui-pro-ai-assistant 0.7.9 → 0.8.1

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.
package/dist/index.js CHANGED
@@ -11,13 +11,13 @@ import { Tabs as Tabs$1, TabsList as TabsList$1, TabsTrigger as TabsTrigger$1, T
11
11
  import { cn } from '@docyrus/ui-pro-shared/lib/utils';
12
12
  import { DefaultChatTransport, lastAssistantMessageIsCompleteWithToolCalls } from 'ai';
13
13
  import { Pencil, PilcrowIcon, Heading1Icon, Heading2Icon, Heading3Icon, SquareIcon, ListIcon, ListOrderedIcon, ChevronDownIcon, Code2Icon, QuoteIcon, LightbulbIcon, Columns3Icon, GripVertical, FileUpIcon, TableIcon, ImageIcon, FilmIcon, AudioLinesIcon, TableOfContentsIcon, RadicalIcon, RectangleVerticalIcon, CalendarIcon, PlusIcon, FileCodeIcon, MinusIcon, ChevronRightIcon, ListTree, PenToolIcon, Link2Icon, Check, X, Copy, FilesIcon, Link, Text, ExternalLink, Unlink, Bold, Italic, Underline, Strikethrough, Code2, MoreHorizontal, ArrowLeftIcon, ArrowRightIcon, Minus, Plus, CircleArrowDown, Minimize2, Trash2, FileUp, CheckCircle2, FileText, Loader2, Wrench, CornerDownLeftIcon, PencilLineIcon, MessageSquareTextIcon, MessagesSquareIcon, ArrowUpIcon, CheckIcon, CaptionsIcon, ZoomInIcon, CircleArrowDownIcon, MoveUpRightIcon, MoreHorizontalIcon, Eye, PlusCircle, HelpCircle, Maximize2, Download, FileSpreadsheet, ChevronDown, ChevronLeft, ChevronRight, CheckCircle, XCircle, Search, Globe, User, ArrowRight, MapPin, CalendarClock, List, RefreshCw, FilePlus, XIcon, CornerUpLeftIcon, AlbumIcon, FeatherIcon, ListMinusIcon, ListPlusIcon, ListEnd, Wand, LanguagesIcon, BadgeHelpIcon, PenLineIcon, SearchIcon, MusicIcon, CompassIcon, SmileIcon, LeafIcon, ClockIcon, AppleIcon, FlagIcon, StarIcon, DeleteIcon, AlignLeft, AlignCenter, AlignRight, RotateCcw, AlertTriangle, AlertCircle, ArrowUpDown, ArrowDownToLine, PenLine, PencilIcon, TrashIcon, FileIcon, Star, ChevronsUpDown, FolderIcon, MessageSquare, Hash, Table, CheckSquare, Calendar as Calendar$1, Clock, Phone, Mail, Send, RefreshCcw, Undo2, ChevronsUpDownIcon, ChevronsRight, ChevronsLeft, CalendarDays, RefreshCwIcon, PaintRoller, MessageSquareText, ArrowLeft, Boxes, Users, Bot, Brain, Lightbulb, BookOpen, PenTool, SlidersHorizontal, Wand2, Mic, Code, Trash, Edit, Share, FolderInput, Archive, Building2, ShieldCheck, PanelLeft, NotebookText, CirclePlus, MoreVertical, FileSearch, Microscope, Ruler, AudioLines, BrainCircuit, Circle, Zap, Upload, ThumbsUp, ThumbsDown, Sun, Shield, Settings, Play, Pause, Moon, Menu, Lock, Info, Image, Home, Heart, Folder, Filter, File as File$1, CreditCard, Cog, Cloud, ChevronUp, Bookmark, Bell, Plug, Inbox, LayoutGrid, FolderOpen, LayoutDashboard, Table2, WandSparklesIcon, ArrowUpToLineIcon, BoldIcon, ItalicIcon, UnderlineIcon, StrikethroughIcon, HighlighterIcon, Undo2Icon, Redo2Icon, ArrowDownToLineIcon, AlignLeftIcon, AlignCenterIcon, AlignRightIcon, AlignJustifyIcon, ListOrdered, ListTodoIcon, ListCollapseIcon, Grid3x3Icon, Combine, Ungroup, ArrowUp, ArrowDown, Trash2Icon, LinkIcon, WrapText, OutdentIcon, IndentIcon, EyeIcon, PenIcon } from 'lucide-react';
14
- import { Avatar, AvatarImage, AvatarFallback } from '@docyrus/ui-pro-shared/components/avatar';
15
- import { ScrollArea as ScrollArea$1 } from '@docyrus/ui-pro-shared/components/scroll-area';
14
+ import { Message, AIMessageAvatar, MessageContent, MessageActions, MessageAction, AIConversation, AIConversationContent, MessageResponse, AIConversationScrollButton, Tool, ToolHeader, ToolContent, ToolInput, ToolOutput, CodeBlock, CodeBlockCopyButton, resolveToolIcon, PromptInputButton, PromptInput, PromptInputTextarea, PromptInputFooter, PromptInputTools, PromptInputSubmit, usePromptInputAttachments } from '@docyrus/ui-pro-shared/ai';
16
15
  import { AsyncTokenManager, RestApiClient } from '@docyrus/api-client';
17
16
  import { TooltipProvider as TooltipProvider$1, Tooltip as Tooltip$2, TooltipTrigger as TooltipTrigger$1, TooltipContent as TooltipContent$1 } from '@docyrus/ui-pro-shared/components/tooltip';
18
17
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
18
+ import { Avatar, AvatarImage, AvatarFallback } from '@docyrus/ui-pro-shared/components/avatar';
19
+ import { ScrollArea as ScrollArea$1 } from '@docyrus/ui-pro-shared/components/scroll-area';
19
20
  import { createPortal } from 'react-dom';
20
- import { Message, AIMessageAvatar, MessageContent, MessageActions, MessageAction, AIConversation, AIConversationContent, MessageResponse, AIConversationScrollButton, Tool, ToolHeader, ToolContent, ToolInput, ToolOutput, CodeBlock, CodeBlockCopyButton, resolveToolIcon, PromptInputButton, PromptInput, PromptInputTextarea, PromptInputFooter, PromptInputTools, PromptInputSubmit, usePromptInputAttachments } from '@docyrus/ui-pro-shared/ai';
21
21
  import { Spinner } from '@docyrus/ui-pro-shared/components/spinner';
22
22
  import { DocyrusIcon } from '@docyrus/ui-pro-shared/docyrus-icon';
23
23
  import { Badge as Badge$1 } from '@docyrus/ui-pro-shared/components/badge';
@@ -283,6 +283,18 @@ import { useFilePicker } from 'use-file-picker';
283
283
 
284
284
  // src/i18n/locales/de.json
285
285
  var de_default = {
286
+ agentConsent: {
287
+ title: "Agent-Bedingungen & Vereinbarung",
288
+ body: "Durch die Nutzung dieses KI-Agenten erkennen Sie an, dass Ihre Unterhaltungen und die von Ihnen geteilten Daten von Docyrus und KI-Drittanbietern verarbeitet werden k\xF6nnen, um Antworten zu generieren. Teilen Sie keine sensiblen Informationen, die nicht verarbeitet werden sollen. Mit der Zustimmung zu diesen Bedingungen wird dieser Agent f\xFCr Ihre Organisation aktiviert.",
289
+ approve: "Zustimmen",
290
+ decline: "Ablehnen",
291
+ acceptedTitle: "Zustimmung erteilt",
292
+ acceptedBody: "Sie k\xF6nnen diesen Agenten jetzt verwenden.",
293
+ declinedTitle: "Zustimmung abgelehnt",
294
+ declinedBody: "Sie m\xFCssen den Bedingungen zustimmen, um diesen Agenten zu verwenden.",
295
+ acceptFailedTitle: "Zustimmung fehlgeschlagen",
296
+ acceptFailedBody: "Beim Erteilen der Zustimmung ist ein Fehler aufgetreten."
297
+ },
286
298
  common: {
287
299
  back: "Zur\xFCck",
288
300
  close: "Schlie\xDFen",
@@ -515,6 +527,18 @@ var de_default = {
515
527
 
516
528
  // src/i18n/locales/el.json
517
529
  var el_default = {
530
+ agentConsent: {
531
+ title: "\u038C\u03C1\u03BF\u03B9 & \u03A3\u03C5\u03BC\u03C6\u03C9\u03BD\u03AF\u03B1 Agent",
532
+ body: "\u03A7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03CE\u03BD\u03C4\u03B1\u03C2 \u03B1\u03C5\u03C4\u03CC\u03BD \u03C4\u03BF\u03BD \u03C0\u03C1\u03AC\u03BA\u03C4\u03BF\u03C1\u03B1 AI, \u03B1\u03BD\u03B1\u03B3\u03BD\u03C9\u03C1\u03AF\u03B6\u03B5\u03C4\u03B5 \u03CC\u03C4\u03B9 \u03BF\u03B9 \u03C3\u03C5\u03BD\u03BF\u03BC\u03B9\u03BB\u03AF\u03B5\u03C2 \u03C3\u03B1\u03C2 \u03BA\u03B1\u03B9 \u03C4\u03B1 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03B1 \u03C0\u03BF\u03C5 \u03BC\u03BF\u03B9\u03C1\u03AC\u03B6\u03B5\u03C3\u03C4\u03B5 \u03B5\u03BD\u03B4\u03AD\u03C7\u03B5\u03C4\u03B1\u03B9 \u03BD\u03B1 \u03C5\u03C0\u03BF\u03B2\u03BB\u03B7\u03B8\u03BF\u03CD\u03BD \u03C3\u03B5 \u03B5\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1 \u03B1\u03C0\u03CC \u03C4\u03BF Docyrus \u03BA\u03B1\u03B9 \u03C4\u03C1\u03AF\u03C4\u03BF\u03C5\u03C2 \u03C0\u03B1\u03C1\u03CC\u03C7\u03BF\u03C5\u03C2 AI \u03B3\u03B9\u03B1 \u03C4\u03B7 \u03B4\u03B7\u03BC\u03B9\u03BF\u03C5\u03C1\u03B3\u03AF\u03B1 \u03B1\u03C0\u03B1\u03BD\u03C4\u03AE\u03C3\u03B5\u03C9\u03BD. \u039C\u03B7\u03BD \u03BC\u03BF\u03B9\u03C1\u03AC\u03B6\u03B5\u03C3\u03C4\u03B5 \u03B5\u03C5\u03B1\u03AF\u03C3\u03B8\u03B7\u03C4\u03B5\u03C2 \u03C0\u03BB\u03B7\u03C1\u03BF\u03C6\u03BF\u03C1\u03AF\u03B5\u03C2 \u03C0\u03BF\u03C5 \u03B4\u03B5\u03BD \u03B8\u03AD\u03BB\u03B5\u03C4\u03B5 \u03BD\u03B1 \u03C5\u03C0\u03BF\u03B2\u03BB\u03B7\u03B8\u03BF\u03CD\u03BD \u03C3\u03B5 \u03B5\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1. \u0397 \u03B1\u03C0\u03BF\u03B4\u03BF\u03C7\u03AE \u03B1\u03C5\u03C4\u03CE\u03BD \u03C4\u03C9\u03BD \u03CC\u03C1\u03C9\u03BD \u03B5\u03BD\u03B5\u03C1\u03B3\u03BF\u03C0\u03BF\u03B9\u03B5\u03AF \u03B1\u03C5\u03C4\u03CC\u03BD \u03C4\u03BF\u03BD \u03C0\u03C1\u03AC\u03BA\u03C4\u03BF\u03C1\u03B1 \u03B3\u03B9\u03B1 \u03C4\u03BF\u03BD \u03BF\u03C1\u03B3\u03B1\u03BD\u03B9\u03C3\u03BC\u03CC \u03C3\u03B1\u03C2.",
533
+ approve: "\u0391\u03C0\u03BF\u03B4\u03BF\u03C7\u03AE",
534
+ decline: "\u0391\u03C0\u03CC\u03C1\u03C1\u03B9\u03C8\u03B7",
535
+ acceptedTitle: "\u0397 \u03C3\u03C5\u03B3\u03BA\u03B1\u03C4\u03AC\u03B8\u03B5\u03C3\u03B7 \u03AD\u03B3\u03B9\u03BD\u03B5 \u03B1\u03C0\u03BF\u03B4\u03B5\u03BA\u03C4\u03AE",
536
+ acceptedBody: "\u039C\u03C0\u03BF\u03C1\u03B5\u03AF\u03C4\u03B5 \u03C4\u03CE\u03C1\u03B1 \u03BD\u03B1 \u03C7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03AE\u03C3\u03B5\u03C4\u03B5 \u03B1\u03C5\u03C4\u03CC\u03BD \u03C4\u03BF\u03BD \u03C0\u03C1\u03AC\u03BA\u03C4\u03BF\u03C1\u03B1.",
537
+ declinedTitle: "\u0397 \u03C3\u03C5\u03B3\u03BA\u03B1\u03C4\u03AC\u03B8\u03B5\u03C3\u03B7 \u03B1\u03C0\u03BF\u03C1\u03C1\u03AF\u03C6\u03B8\u03B7\u03BA\u03B5",
538
+ declinedBody: "\u03A0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B1\u03C0\u03BF\u03B4\u03B5\u03C7\u03C4\u03B5\u03AF\u03C4\u03B5 \u03C4\u03BF\u03C5\u03C2 \u03CC\u03C1\u03BF\u03C5\u03C2 \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03C7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03AE\u03C3\u03B5\u03C4\u03B5 \u03B1\u03C5\u03C4\u03CC\u03BD \u03C4\u03BF\u03BD \u03C0\u03C1\u03AC\u03BA\u03C4\u03BF\u03C1\u03B1.",
539
+ acceptFailedTitle: "\u0391\u03C0\u03BF\u03C4\u03C5\u03C7\u03AF\u03B1 \u03B1\u03C0\u03BF\u03B4\u03BF\u03C7\u03AE\u03C2 \u03C3\u03C5\u03B3\u03BA\u03B1\u03C4\u03AC\u03B8\u03B5\u03C3\u03B7\u03C2",
540
+ acceptFailedBody: "\u03A0\u03B1\u03C1\u03BF\u03C5\u03C3\u03B9\u03AC\u03C3\u03C4\u03B7\u03BA\u03B5 \u03C3\u03C6\u03AC\u03BB\u03BC\u03B1 \u03BA\u03B1\u03C4\u03AC \u03C4\u03B7\u03BD \u03B1\u03C0\u03BF\u03B4\u03BF\u03C7\u03AE \u03C4\u03B7\u03C2 \u03C3\u03C5\u03B3\u03BA\u03B1\u03C4\u03AC\u03B8\u03B5\u03C3\u03B7\u03C2."
541
+ },
518
542
  common: {
519
543
  back: "\u03A0\u03AF\u03C3\u03C9",
520
544
  close: "\u039A\u03BB\u03B5\u03AF\u03C3\u03B9\u03BC\u03BF",
@@ -747,6 +771,18 @@ var el_default = {
747
771
 
748
772
  // src/i18n/locales/en.json
749
773
  var en_default = {
774
+ agentConsent: {
775
+ title: "Agent Terms & Agreement",
776
+ body: "By using this AI agent, you acknowledge that your conversations and the data you share may be processed by Docyrus and third-party AI providers to generate responses. Do not share sensitive information you do not want processed. Approving these terms enables this agent for your organization.",
777
+ approve: "Approve",
778
+ decline: "Decline",
779
+ acceptedTitle: "Consent Accepted",
780
+ acceptedBody: "You can now use this agent.",
781
+ declinedTitle: "Consent Declined",
782
+ declinedBody: "You must accept the terms to use this agent.",
783
+ acceptFailedTitle: "Failed to Accept Consent",
784
+ acceptFailedBody: "An error occurred while accepting consent."
785
+ },
750
786
  common: {
751
787
  back: "Back",
752
788
  close: "Close",
@@ -1007,6 +1043,18 @@ var en_default = {
1007
1043
 
1008
1044
  // src/i18n/locales/es.json
1009
1045
  var es_default = {
1046
+ agentConsent: {
1047
+ title: "T\xE9rminos y Acuerdo del Agente",
1048
+ body: "Al usar este agente de IA, reconoces que tus conversaciones y los datos que compartes pueden ser procesados por Docyrus y proveedores de IA externos para generar respuestas. No compartas informaci\xF3n sensible que no quieras que se procese. Aceptar estos t\xE9rminos habilita este agente para tu organizaci\xF3n.",
1049
+ approve: "Aprobar",
1050
+ decline: "Rechazar",
1051
+ acceptedTitle: "Consentimiento aceptado",
1052
+ acceptedBody: "Ahora puedes usar este agente.",
1053
+ declinedTitle: "Consentimiento rechazado",
1054
+ declinedBody: "Debes aceptar los t\xE9rminos para usar este agente.",
1055
+ acceptFailedTitle: "Error al aceptar el consentimiento",
1056
+ acceptFailedBody: "Se produjo un error al aceptar el consentimiento."
1057
+ },
1010
1058
  common: {
1011
1059
  back: "Atr\xE1s",
1012
1060
  close: "Cerrar",
@@ -1239,6 +1287,18 @@ var es_default = {
1239
1287
 
1240
1288
  // src/i18n/locales/fr.json
1241
1289
  var fr_default = {
1290
+ agentConsent: {
1291
+ title: "Conditions et accord de l'agent",
1292
+ body: "En utilisant cet agent IA, vous reconnaissez que vos conversations et les donn\xE9es que vous partagez peuvent \xEAtre trait\xE9es par Docyrus et des fournisseurs d'IA tiers pour g\xE9n\xE9rer des r\xE9ponses. Ne partagez pas d'informations sensibles que vous ne souhaitez pas voir trait\xE9es. L'acceptation de ces conditions active cet agent pour votre organisation.",
1293
+ approve: "Approuver",
1294
+ decline: "Refuser",
1295
+ acceptedTitle: "Consentement accept\xE9",
1296
+ acceptedBody: "Vous pouvez maintenant utiliser cet agent.",
1297
+ declinedTitle: "Consentement refus\xE9",
1298
+ declinedBody: "Vous devez accepter les conditions pour utiliser cet agent.",
1299
+ acceptFailedTitle: "\xC9chec de l'acceptation du consentement",
1300
+ acceptFailedBody: "Une erreur s'est produite lors de l'acceptation du consentement."
1301
+ },
1242
1302
  common: {
1243
1303
  back: "Retour",
1244
1304
  close: "Fermer",
@@ -1471,6 +1531,18 @@ var fr_default = {
1471
1531
 
1472
1532
  // src/i18n/locales/it.json
1473
1533
  var it_default = {
1534
+ agentConsent: {
1535
+ title: "Termini e accordo dell'agente",
1536
+ body: "Utilizzando questo agente IA, riconosci che le tue conversazioni e i dati che condividi possono essere elaborati da Docyrus e da fornitori di IA di terze parti per generare risposte. Non condividere informazioni sensibili che non vuoi vengano elaborate. L'accettazione di questi termini abilita questo agente per la tua organizzazione.",
1537
+ approve: "Approva",
1538
+ decline: "Rifiuta",
1539
+ acceptedTitle: "Consenso accettato",
1540
+ acceptedBody: "Ora puoi utilizzare questo agente.",
1541
+ declinedTitle: "Consenso rifiutato",
1542
+ declinedBody: "Devi accettare i termini per utilizzare questo agente.",
1543
+ acceptFailedTitle: "Accettazione del consenso non riuscita",
1544
+ acceptFailedBody: "Si \xE8 verificato un errore durante l'accettazione del consenso."
1545
+ },
1474
1546
  common: {
1475
1547
  back: "Indietro",
1476
1548
  close: "Chiudi",
@@ -1703,6 +1775,18 @@ var it_default = {
1703
1775
 
1704
1776
  // src/i18n/locales/pt.json
1705
1777
  var pt_default = {
1778
+ agentConsent: {
1779
+ title: "Termos e Acordo do Agente",
1780
+ body: "Ao usar este agente de IA, voc\xEA reconhece que suas conversas e os dados que compartilha podem ser processados pelo Docyrus e por provedores de IA terceiros para gerar respostas. N\xE3o compartilhe informa\xE7\xF5es sens\xEDveis que n\xE3o deseja que sejam processadas. Aprovar estes termos habilita este agente para a sua organiza\xE7\xE3o.",
1781
+ approve: "Aprovar",
1782
+ decline: "Recusar",
1783
+ acceptedTitle: "Consentimento aceito",
1784
+ acceptedBody: "Agora voc\xEA pode usar este agente.",
1785
+ declinedTitle: "Consentimento recusado",
1786
+ declinedBody: "Voc\xEA deve aceitar os termos para usar este agente.",
1787
+ acceptFailedTitle: "Falha ao aceitar o consentimento",
1788
+ acceptFailedBody: "Ocorreu um erro ao aceitar o consentimento."
1789
+ },
1706
1790
  common: {
1707
1791
  back: "Voltar",
1708
1792
  close: "Fechar",
@@ -1935,6 +2019,18 @@ var pt_default = {
1935
2019
 
1936
2020
  // src/i18n/locales/sl.json
1937
2021
  var sl_default = {
2022
+ agentConsent: {
2023
+ title: "Pogoji in soglasje agenta",
2024
+ body: "Z uporabo tega agenta UI potrjujete, da lahko Docyrus in tretji ponudniki UI obdelujejo va\u0161e pogovore in podatke, ki jih delite, za ustvarjanje odgovorov. Ne delite ob\u010Dutljivih informacij, za katere ne \u017Eelite, da se obdelajo. S sprejetjem teh pogojev omogo\u010Dite tega agenta za va\u0161o organizacijo.",
2025
+ approve: "Odobri",
2026
+ decline: "Zavrni",
2027
+ acceptedTitle: "Soglasje sprejeto",
2028
+ acceptedBody: "Zdaj lahko uporabljate tega agenta.",
2029
+ declinedTitle: "Soglasje zavrnjeno",
2030
+ declinedBody: "Za uporabo tega agenta morate sprejeti pogoje.",
2031
+ acceptFailedTitle: "Sprejem soglasja ni uspel",
2032
+ acceptFailedBody: "Pri sprejemanju soglasja je pri\u0161lo do napake."
2033
+ },
1938
2034
  common: {
1939
2035
  back: "Nazaj",
1940
2036
  close: "Zapri",
@@ -2655,6 +2751,83 @@ function useApiClient() {
2655
2751
  };
2656
2752
  }, [config3]);
2657
2753
  }
2754
+ var CONSENT_APPROVE_ROLE = "super_admin";
2755
+ function AgentConsentDialog({
2756
+ pending,
2757
+ onApproved,
2758
+ onDeclined,
2759
+ t
2760
+ }) {
2761
+ const apiClient = useApiClient();
2762
+ const { user } = useAssistantConfig();
2763
+ const [loading, setLoading] = useState(false);
2764
+ const canApprove = (user.roles ?? []).includes(CONSENT_APPROVE_ROLE);
2765
+ const acceptConsent = async () => {
2766
+ if (!pending) return;
2767
+ try {
2768
+ setLoading(true);
2769
+ const response = await apiClient.post(`/ai/agents/${pending.agentId}/consent`, {
2770
+ isAccepted: true,
2771
+ consentData: {
2772
+ acceptedAt: (/* @__PURE__ */ new Date()).toISOString(),
2773
+ deploymentId: pending.deploymentId
2774
+ }
2775
+ });
2776
+ if (!response.success) {
2777
+ throw new Error(response.error || "Failed to accept consent");
2778
+ }
2779
+ toast.success(t("agentConsent.acceptedTitle"), {
2780
+ description: t("agentConsent.acceptedBody")
2781
+ });
2782
+ onApproved();
2783
+ } catch (err) {
2784
+ console.warn("[AgentConsentDialog] failed to accept consent:", err);
2785
+ toast.error(t("agentConsent.acceptFailedTitle"), {
2786
+ description: t("agentConsent.acceptFailedBody")
2787
+ });
2788
+ } finally {
2789
+ setLoading(false);
2790
+ }
2791
+ };
2792
+ const declineConsent = () => {
2793
+ toast.info(t("agentConsent.declinedTitle"), {
2794
+ description: t("agentConsent.declinedBody")
2795
+ });
2796
+ onDeclined();
2797
+ };
2798
+ return /* @__PURE__ */ jsx(Dialog$1, { open: !!pending, children: /* @__PURE__ */ jsxs(
2799
+ DialogContent,
2800
+ {
2801
+ showCloseButton: false,
2802
+ onInteractOutside: (e) => e.preventDefault(),
2803
+ onEscapeKeyDown: (e) => e.preventDefault(),
2804
+ className: "z-[200] sm:max-w-lg",
2805
+ children: [
2806
+ /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: t("agentConsent.title") }) }),
2807
+ /* @__PURE__ */ jsx("div", { className: "max-h-[55vh] overflow-y-auto pr-1 text-sm", children: /* @__PURE__ */ jsx(MessageResponse, { children: t("agentConsent.body") }) }),
2808
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
2809
+ /* @__PURE__ */ jsx(
2810
+ Button,
2811
+ {
2812
+ variant: "outline",
2813
+ onClick: declineConsent,
2814
+ disabled: loading,
2815
+ children: t("agentConsent.decline")
2816
+ }
2817
+ ),
2818
+ /* @__PURE__ */ jsx(
2819
+ Button,
2820
+ {
2821
+ onClick: acceptConsent,
2822
+ disabled: !canApprove || loading,
2823
+ children: t("agentConsent.approve")
2824
+ }
2825
+ )
2826
+ ] })
2827
+ ]
2828
+ }
2829
+ ) });
2830
+ }
2658
2831
  var pickAvatar = (raw) => {
2659
2832
  const candidate = raw?.agentAvatar ?? raw?.avatar;
2660
2833
  if (!candidate) return void 0;
@@ -4082,6 +4255,7 @@ function useAssistantApi({
4082
4255
  const [isLoadingAgentDetails, setIsLoadingAgentDetails] = useState(!!tenantAiAgentId);
4083
4256
  const [subagents, setSubagents] = useState([]);
4084
4257
  const [agentTools, setAgentTools] = useState([]);
4258
+ const [consentRequiredFor, setConsentRequiredFor] = useState(null);
4085
4259
  const apiClientRef = useRef(apiClient);
4086
4260
  const fetchedAgentIdRef = useRef(null);
4087
4261
  apiClientRef.current = apiClient;
@@ -4095,6 +4269,7 @@ function useAssistantApi({
4095
4269
  setAgentDetailsForId(null);
4096
4270
  setSubagents([]);
4097
4271
  setAgentTools([]);
4272
+ setConsentRequiredFor(null);
4098
4273
  setIsLoadingAgentDetails(true);
4099
4274
  try {
4100
4275
  const response = await apiClientRef.current.get(endpoint);
@@ -4117,6 +4292,10 @@ function useAssistantApi({
4117
4292
  const rootTools = data.agent?.tools || [];
4118
4293
  const childTools = direct.flatMap((c) => c?.tools || []);
4119
4294
  setAgentTools([...rootTools, ...childTools]);
4295
+ const consentValue = data.agent?.consent;
4296
+ if (consentValue === false || consentValue === null) {
4297
+ setConsentRequiredFor({ agentId: data.agent?.id ?? effectiveId, deploymentId: data.id });
4298
+ }
4120
4299
  } else {
4121
4300
  setAgentDetails({ logo, name: title });
4122
4301
  setAgentDetailsForId(effectiveId);
@@ -4407,6 +4586,8 @@ function useAssistantApi({
4407
4586
  isLoadingAgentDetails,
4408
4587
  subagents,
4409
4588
  agentTools,
4589
+ consentRequiredFor,
4590
+ setConsentRequiredFor,
4410
4591
  fetchThreads,
4411
4592
  fetchProjectThreads: fetchProjectThreads2,
4412
4593
  loadThreadMessages: loadThreadMessages2,
@@ -19551,6 +19732,7 @@ function ChatPanel({
19551
19732
  welcomeMessage,
19552
19733
  isLoadingAgent,
19553
19734
  placeholder,
19735
+ consentRequired,
19554
19736
  footerText,
19555
19737
  supportFiles,
19556
19738
  supportWebSearch,
@@ -19584,8 +19766,26 @@ function ChatPanel({
19584
19766
  onManageMemories,
19585
19767
  appContext,
19586
19768
  onClearAppContext,
19587
- onForwardToAgent
19769
+ onForwardToAgent,
19770
+ chatError,
19771
+ onDismissChatError
19588
19772
  }) {
19773
+ const renderChatError = () => {
19774
+ if (!chatError) return null;
19775
+ return /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-start gap-2 self-stretch rounded-2xl border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-300", children: [
19776
+ /* @__PURE__ */ jsx("span", { className: "flex-1 whitespace-pre-wrap break-words", children: chatError }),
19777
+ /* @__PURE__ */ jsx(
19778
+ "button",
19779
+ {
19780
+ type: "button",
19781
+ "aria-label": "Dismiss error",
19782
+ onClick: onDismissChatError,
19783
+ className: "-mr-1 -mt-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-full text-red-700/70 hover:bg-red-100 hover:text-red-700 dark:text-red-300/70 dark:hover:bg-red-900/40 dark:hover:text-red-200",
19784
+ children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
19785
+ }
19786
+ )
19787
+ ] });
19788
+ };
19589
19789
  const renderAppContextChip = () => {
19590
19790
  if (!appContext) return null;
19591
19791
  return /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center gap-2 self-start rounded-full border bg-muted/50 px-2 py-1 text-xs text-foreground", children: [
@@ -19659,7 +19859,8 @@ function ChatPanel({
19659
19859
  /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground [&_h4]:text-foreground [&_*]:my-0 [&_*+*]:mt-2", children: welcomeMessage ? /* @__PURE__ */ jsx(MessageResponse, { children: welcomeMessage }) : /* @__PURE__ */ jsx("p", { children: description || "Your AI-powered assistant for all your document needs." }) }),
19660
19860
  /* @__PURE__ */ jsxs("div", { className: "mt-2 flex flex-col", children: [
19661
19861
  renderAppContextChip(),
19662
- renderInputArea(true)
19862
+ renderChatError(),
19863
+ !consentRequired && renderInputArea(true)
19663
19864
  ] })
19664
19865
  ] }) }),
19665
19866
  recentSessions && recentSessions.length > 0 && !isLoadingAgent ? /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-3", children: [
@@ -19709,7 +19910,8 @@ function ChatPanel({
19709
19910
  ),
19710
19911
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col px-3 pb-3 pt-2", children: [
19711
19912
  renderAppContextChip(),
19712
- renderInputArea()
19913
+ renderChatError(),
19914
+ !consentRequired && renderInputArea()
19713
19915
  ] })
19714
19916
  ] });
19715
19917
  }
@@ -22449,7 +22651,7 @@ var buttonVariants = cva(
22449
22651
  }
22450
22652
  }
22451
22653
  );
22452
- var Button39 = withTooltip(({
22654
+ var Button40 = withTooltip(({
22453
22655
  active,
22454
22656
  asChild = false,
22455
22657
  children,
@@ -23057,7 +23259,7 @@ function AIMenu() {
23057
23259
  }
23058
23260
  ),
23059
23261
  /* @__PURE__ */ jsx(
23060
- Button39,
23262
+ Button40,
23061
23263
  {
23062
23264
  className: "no-focus-ring mt-1 shrink-0",
23063
23265
  disabled: !isLoading && input.trim().length === 0,
@@ -23931,7 +24133,7 @@ function Comment(props) {
23931
24133
  ] }),
23932
24134
  isMyComment && (hovering || dropdownOpen) && /* @__PURE__ */ jsxs("div", { className: "absolute top-0 right-0 flex space-x-1", children: [
23933
24135
  index === 0 && /* @__PURE__ */ jsx(
23934
- Button39,
24136
+ Button40,
23935
24137
  {
23936
24138
  className: "h-6 p-1 text-muted-foreground",
23937
24139
  onClick: onResolveComment,
@@ -23980,7 +24182,7 @@ function Comment(props) {
23980
24182
  ),
23981
24183
  isEditing && /* @__PURE__ */ jsxs("div", { className: "ml-auto flex shrink-0 gap-1", children: [
23982
24184
  /* @__PURE__ */ jsx(
23983
- Button39,
24185
+ Button40,
23984
24186
  {
23985
24187
  className: "size-[28px]",
23986
24188
  onClick: (e) => {
@@ -23993,7 +24195,7 @@ function Comment(props) {
23993
24195
  }
23994
24196
  ),
23995
24197
  /* @__PURE__ */ jsx(
23996
- Button39,
24198
+ Button40,
23997
24199
  {
23998
24200
  onClick: (e) => {
23999
24201
  e.stopPropagation();
@@ -24061,7 +24263,7 @@ function CommentMoreDropdown(props) {
24061
24263
  onOpenChange: setDropdownOpen,
24062
24264
  open: dropdownOpen,
24063
24265
  children: [
24064
- /* @__PURE__ */ jsx(DropdownMenuTrigger5, { asChild: true, onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(Button39, { className: cn("h-6 p-1 text-muted-foreground"), variant: "ghost", children: /* @__PURE__ */ jsx(MoreHorizontalIcon, { className: "size-4" }) }) }),
24266
+ /* @__PURE__ */ jsx(DropdownMenuTrigger5, { asChild: true, onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(Button40, { className: cn("h-6 p-1 text-muted-foreground"), variant: "ghost", children: /* @__PURE__ */ jsx(MoreHorizontalIcon, { className: "size-4" }) }) }),
24065
24267
  /* @__PURE__ */ jsx(
24066
24268
  DropdownMenuContent5,
24067
24269
  {
@@ -24233,7 +24435,7 @@ function CommentCreateForm({
24233
24435
  }
24234
24436
  ),
24235
24437
  /* @__PURE__ */ jsx(
24236
- Button39,
24438
+ Button40,
24237
24439
  {
24238
24440
  className: "absolute right-0 bottom-0 ml-auto shrink-0",
24239
24441
  disabled: commentContent.trim().length === 0,
@@ -24567,7 +24769,7 @@ function BlockSuggestionCard({
24567
24769
  )),
24568
24770
  hovering && /* @__PURE__ */ jsxs("div", { className: "absolute top-4 right-4 flex gap-2", children: [
24569
24771
  /* @__PURE__ */ jsx(
24570
- Button39,
24772
+ Button40,
24571
24773
  {
24572
24774
  variant: "ghost",
24573
24775
  className: "size-6 p-1 text-muted-foreground",
@@ -24576,7 +24778,7 @@ function BlockSuggestionCard({
24576
24778
  }
24577
24779
  ),
24578
24780
  /* @__PURE__ */ jsx(
24579
- Button39,
24781
+ Button40,
24580
24782
  {
24581
24783
  variant: "ghost",
24582
24784
  className: "size-6 p-1 text-muted-foreground",
@@ -25046,7 +25248,7 @@ var BlockCommentsContent = ({
25046
25248
  }
25047
25249
  ),
25048
25250
  totalCount > 0 && /* @__PURE__ */ jsx("div", { className: "relative left-0 size-0 select-none", children: /* @__PURE__ */ jsx(PopoverTrigger13, { asChild: true, children: /* @__PURE__ */ jsxs(
25049
- Button39,
25251
+ Button40,
25050
25252
  {
25051
25253
  className: "mt-1 ml-1 flex h-6 gap-1 px-1.5 py-0 text-muted-foreground/80 hover:text-muted-foreground/80 data-[active=true]:bg-muted",
25052
25254
  contentEditable: false,
@@ -26962,7 +27164,7 @@ function BlockActionButton({
26962
27164
  const editor = useEditorRef();
26963
27165
  const element = useElement();
26964
27166
  return /* @__PURE__ */ jsx(
26965
- Button39,
27167
+ Button40,
26966
27168
  {
26967
27169
  className: cn(
26968
27170
  defaultStyles && "absolute top-1 right-1 opacity-0 transition-opacity group-hover:opacity-100",
@@ -27301,7 +27503,7 @@ function EmojiPickerSearchAndClear({
27301
27503
  }
27302
27504
  ),
27303
27505
  searchValue && /* @__PURE__ */ jsx(
27304
- Button39,
27506
+ Button40,
27305
27507
  {
27306
27508
  "aria-label": "Clear",
27307
27509
  className: cn(
@@ -27390,7 +27592,7 @@ function EmojiPickerNavigation({
27390
27592
  id: "emoji-nav",
27391
27593
  children: /* @__PURE__ */ jsxs("div", { className: "relative flex items-center", children: [
27392
27594
  emojiLibrary.getGrid().sections().map(({ id }) => /* @__PURE__ */ jsx(
27393
- Button39,
27595
+ Button40,
27394
27596
  {
27395
27597
  "aria-label": i18n.categories[id],
27396
27598
  className: cn(
@@ -27552,7 +27754,7 @@ function CalloutElement(props) {
27552
27754
  {
27553
27755
  ...emojiToolbarDropdownProps,
27554
27756
  control: /* @__PURE__ */ jsx(
27555
- Button39,
27757
+ Button40,
27556
27758
  {
27557
27759
  className: "size-6 select-none p-1 text-[18px] hover:bg-muted-foreground/15",
27558
27760
  contentEditable: false,
@@ -27791,7 +27993,7 @@ function CodeBlockElement2(props) {
27791
27993
  contentEditable: false,
27792
27994
  children: [
27793
27995
  /* @__PURE__ */ jsxs(
27794
- Button39,
27996
+ Button40,
27795
27997
  {
27796
27998
  className: "relative top-0 right-0 w-auto",
27797
27999
  onClick: () => {
@@ -27836,7 +28038,7 @@ function CodeBlockCombobox({ className }) {
27836
28038
  if (readOnly) return null;
27837
28039
  return /* @__PURE__ */ jsxs(Popover13, { onOpenChange: setOpen, open, children: [
27838
28040
  /* @__PURE__ */ jsx(PopoverTrigger13, { asChild: true, children: /* @__PURE__ */ jsxs(
27839
- Button39,
28041
+ Button40,
27840
28042
  {
27841
28043
  "aria-expanded": open,
27842
28044
  className: cn(
@@ -28197,7 +28399,7 @@ function Draggable(props) {
28197
28399
  ),
28198
28400
  children: [
28199
28401
  /* @__PURE__ */ jsx(
28200
- Button39,
28402
+ Button40,
28201
28403
  {
28202
28404
  className: "absolute right-0 h-6 w-6 p-0",
28203
28405
  "data-plate-prevent-deselect": true,
@@ -28384,7 +28586,7 @@ var DraggableInsertHandle = () => {
28384
28586
  const editor = useEditorRef();
28385
28587
  const element = useElement();
28386
28588
  return /* @__PURE__ */ jsx(
28387
- Button39,
28589
+ Button40,
28388
28590
  {
28389
28591
  className: "size-6 shrink-0 p-1",
28390
28592
  onClick: (event) => {
@@ -29615,7 +29817,7 @@ function EquationPopoverContent({
29615
29817
  ...props
29616
29818
  }
29617
29819
  ),
29618
- /* @__PURE__ */ jsxs(Button39, { className: "px-3", onClick: onClose, variant: "brand", children: [
29820
+ /* @__PURE__ */ jsxs(Button40, { className: "px-3", onClick: onClose, variant: "brand", children: [
29619
29821
  "Done ",
29620
29822
  /* @__PURE__ */ jsx(CornerDownLeftIcon, { className: "size-3.5" })
29621
29823
  ] })
@@ -30493,7 +30695,7 @@ function MediaPlaceholderPopover({ children }) {
30493
30695
  /* @__PURE__ */ jsx(TabsTrigger, { value: "password", children: "Embed link" })
30494
30696
  ] }),
30495
30697
  /* @__PURE__ */ jsxs(TabsContent, { className: "w-[300px] px-3 py-2", value: "account", children: [
30496
- /* @__PURE__ */ jsx(Button39, { className: "w-full", onClick: openFilePicker, variant: "brand", children: currentMedia.buttonText }),
30698
+ /* @__PURE__ */ jsx(Button40, { className: "w-full", onClick: openFilePicker, variant: "brand", children: currentMedia.buttonText }),
30497
30699
  /* @__PURE__ */ jsx("div", { className: "mt-3 text-muted-foreground text-xs", children: "The maximum size per file is 5MB" })
30498
30700
  ] }),
30499
30701
  /* @__PURE__ */ jsxs(
@@ -30511,7 +30713,7 @@ function MediaPlaceholderPopover({ children }) {
30511
30713
  }
30512
30714
  ),
30513
30715
  /* @__PURE__ */ jsx(
30514
- Button39,
30716
+ Button40,
30515
30717
  {
30516
30718
  className: "mt-2 w-full max-w-[300px]",
30517
30719
  onClick: () => onEmbed(embedValue),
@@ -30631,12 +30833,12 @@ function ImagePreview() {
30631
30833
  onClick: (e) => e.stopPropagation(),
30632
30834
  children: [
30633
30835
  !prevDisabled && !nextDisabled && /* @__PURE__ */ jsxs("div", { className: "flex rounded-sm bg-black/70", children: [
30634
- /* @__PURE__ */ jsx(Button39, { ...prevProps, disabled: prevDisabled, children: /* @__PURE__ */ jsx(ArrowLeftIcon, { className: "size-5" }) }),
30635
- /* @__PURE__ */ jsx(Button39, { ...nextProps, disabled: nextDisabled, children: /* @__PURE__ */ jsx(ArrowRightIcon, { className: "size-5" }) })
30836
+ /* @__PURE__ */ jsx(Button40, { ...prevProps, disabled: prevDisabled, children: /* @__PURE__ */ jsx(ArrowLeftIcon, { className: "size-5" }) }),
30837
+ /* @__PURE__ */ jsx(Button40, { ...nextProps, disabled: nextDisabled, children: /* @__PURE__ */ jsx(ArrowRightIcon, { className: "size-5" }) })
30636
30838
  ] }),
30637
30839
  currentPreview && /* @__PURE__ */ jsxs("div", { className: "flex rounded-sm bg-black/70", children: [
30638
30840
  /* @__PURE__ */ jsx(
30639
- Button39,
30841
+ Button40,
30640
30842
  {
30641
30843
  ...zommOutProps,
30642
30844
  disabled: zoomOutDisabled,
@@ -30649,7 +30851,7 @@ function ImagePreview() {
30649
30851
  /* @__PURE__ */ jsx("div", { children: "%" })
30650
30852
  ] }),
30651
30853
  /* @__PURE__ */ jsx(
30652
- Button39,
30854
+ Button40,
30653
30855
  {
30654
30856
  ...zoomInProps,
30655
30857
  disabled: zoomInDisabled,
@@ -30658,7 +30860,7 @@ function ImagePreview() {
30658
30860
  }
30659
30861
  ),
30660
30862
  /* @__PURE__ */ jsx(
30661
- Button39,
30863
+ Button40,
30662
30864
  {
30663
30865
  onClick: () => {
30664
30866
  void downloadFile(currentPreview.url, currentPreview.id);
@@ -30667,7 +30869,7 @@ function ImagePreview() {
30667
30869
  children: /* @__PURE__ */ jsx(CircleArrowDown, { className: "size-4" })
30668
30870
  }
30669
30871
  ),
30670
- /* @__PURE__ */ jsx(Button39, { ...closeProps, tooltip: "Close", children: /* @__PURE__ */ jsx(Minimize2, { className: "size-4" }) })
30872
+ /* @__PURE__ */ jsx(Button40, { ...closeProps, tooltip: "Close", children: /* @__PURE__ */ jsx(Minimize2, { className: "size-4" }) })
30671
30873
  ] })
30672
30874
  ]
30673
30875
  }
@@ -31307,7 +31509,7 @@ var TableElement2 = withHOC(
31307
31509
  "group-has-[tr:last-child:hover]/table:opacity-100 max-sm:group-has-[tr[data-selected]:last-child]/table:opacity-100"
31308
31510
  ),
31309
31511
  children: /* @__PURE__ */ jsx(
31310
- Button39,
31512
+ Button40,
31311
31513
  {
31312
31514
  className: "flex h-4 w-full grow items-center justify-center bg-muted",
31313
31515
  onClick: () => tf.insert.tableRow({ at: editor.api.findPath(element) }),
@@ -31329,7 +31531,7 @@ var TableElement2 = withHOC(
31329
31531
  "group-has-[td:last-child:hover,th:last-child:hover]/table:opacity-100 max-sm:group-has-[td[data-selected]:last-child,th[data-selected]:last-child]/table:opacity-100"
31330
31532
  ),
31331
31533
  children: /* @__PURE__ */ jsx(
31332
- Button39,
31534
+ Button40,
31333
31535
  {
31334
31536
  className: "flex h-full w-4 grow items-center justify-center bg-muted",
31335
31537
  onClick: () => tf.insert.tableColumn({
@@ -31353,7 +31555,7 @@ var TableElement2 = withHOC(
31353
31555
  "group-has-[td:last-child:hover,th:last-child:hover]/table:group-has-[tr:last-child:hover]/table:opacity-100 max-sm:group-has-[td[data-selected]:last-child,th[data-selected]:last-child]/table:group-has-[tr[data-selected]:last-child]/table:opacity-100"
31354
31556
  ),
31355
31557
  children: /* @__PURE__ */ jsx(
31356
- Button39,
31558
+ Button40,
31357
31559
  {
31358
31560
  className: "flex size-4 items-center justify-center rounded-full bg-muted",
31359
31561
  onClick: () => {
@@ -31559,7 +31761,7 @@ function TocElement(props) {
31559
31761
  const { headingList } = state;
31560
31762
  return /* @__PURE__ */ jsxs(PlateElement, { ...props, className: "my-1", children: [
31561
31763
  /* @__PURE__ */ jsx("div", { contentEditable: false, children: headingList.length > 0 ? headingList.map((item) => /* @__PURE__ */ jsx(
31562
- Button39,
31764
+ Button40,
31563
31765
  {
31564
31766
  "aria-current": true,
31565
31767
  className: headingItemVariants({ depth: item.depth }),
@@ -32661,7 +32863,7 @@ function TocElementStatic(props) {
32661
32863
  const headingList = getHeadingList(editor);
32662
32864
  return /* @__PURE__ */ jsxs(SlateElement, { ...props, className: "mb-1 p-0", children: [
32663
32865
  /* @__PURE__ */ jsx("div", { children: headingList.length > 0 ? headingList.map((item) => /* @__PURE__ */ jsx(
32664
- Button39,
32866
+ Button40,
32665
32867
  {
32666
32868
  className: headingItemVariants2({ depth: item.depth }),
32667
32869
  variant: "ghost",
@@ -34567,6 +34769,9 @@ var AssistantView = ({ ref, ...props }) => {
34567
34769
  agentTools: commonProps2.agentTools,
34568
34770
  appContext: commonProps2.appContext,
34569
34771
  onClearAppContext: commonProps2.onClearAppContext,
34772
+ chatError: commonProps2.chatError,
34773
+ onDismissChatError: commonProps2.onDismissChatError,
34774
+ consentRequired: commonProps2.consentRequired,
34570
34775
  messagesClassName: "p-4"
34571
34776
  }
34572
34777
  );
@@ -34827,6 +35032,9 @@ var AssistantView = ({ ref, ...props }) => {
34827
35032
  agentTools: commonProps.agentTools,
34828
35033
  appContext: commonProps.appContext,
34829
35034
  onClearAppContext: commonProps.onClearAppContext,
35035
+ chatError: commonProps.chatError,
35036
+ onDismissChatError: commonProps.onDismissChatError,
35037
+ consentRequired: commonProps.consentRequired,
34830
35038
  onManageMemories: onTabChange ? () => onTabChange(4) : void 0,
34831
35039
  compactToolbar: !isFullscreen
34832
35040
  }
@@ -36234,6 +36442,7 @@ var DocyAssistant = ({
36234
36442
  const { state: projectState, actions: projectActions } = useProjectState();
36235
36443
  const { state: worksState, actions: worksActions } = useWorksState();
36236
36444
  const [input, setInput] = useState(initialPrompt || "");
36445
+ const [chatError, setChatError] = useState(null);
36237
36446
  const [showWelcome, setShowWelcome] = useState(() => enableWelcomePage && tabs.length <= 1);
36238
36447
  const currentUserId = configUser.id;
36239
36448
  const [projectSearchQuery, setProjectSearchQuery] = useState("");
@@ -36356,6 +36565,8 @@ var DocyAssistant = ({
36356
36565
  },
36357
36566
  onError: (error) => {
36358
36567
  console.error("[AI] Chat error:", error);
36568
+ const errorText = error?.message || String(error) || "An unknown error occurred.";
36569
+ setChatError(errorText);
36359
36570
  },
36360
36571
  onToolCall: async ({ toolCall }) => {
36361
36572
  const name = toolCall?.toolName;
@@ -36419,7 +36630,9 @@ var DocyAssistant = ({
36419
36630
  agentDetailsForId,
36420
36631
  isLoadingAgentDetails,
36421
36632
  subagents,
36422
- agentTools
36633
+ agentTools,
36634
+ consentRequiredFor,
36635
+ setConsentRequiredFor
36423
36636
  } = useAssistantApi({
36424
36637
  tenantAiAgentId: activeAgentId,
36425
36638
  deploymentId,
@@ -36706,6 +36919,7 @@ var DocyAssistant = ({
36706
36919
  }, [activeTabId]);
36707
36920
  const handleSendMessage = async (e, options3, overrideText) => {
36708
36921
  e?.preventDefault();
36922
+ if (consentRequiredFor) return;
36709
36923
  if (isSendingRef.current) return;
36710
36924
  if (status === "submitted" || status === "streaming") return;
36711
36925
  const messageText = (overrideText ?? input).trim();
@@ -36713,6 +36927,7 @@ var DocyAssistant = ({
36713
36927
  isSendingRef.current = true;
36714
36928
  setInput("");
36715
36929
  setShowWelcome(false);
36930
+ setChatError(null);
36716
36931
  try {
36717
36932
  messageOptionsRef.current = options3;
36718
36933
  let currentThreadId = selectedSessionIdRef.current;
@@ -37021,6 +37236,9 @@ var DocyAssistant = ({
37021
37236
  agentTools: activeAgentMatchesDetails ? agentTools : [],
37022
37237
  appContext,
37023
37238
  onClearAppContext: clearAppContext,
37239
+ chatError,
37240
+ onDismissChatError: () => setChatError(null),
37241
+ consentRequired: !!consentRequiredFor,
37024
37242
  initialModelId,
37025
37243
  initialFeatures,
37026
37244
  enableMicrophone,
@@ -37414,6 +37632,17 @@ var DocyAssistant = ({
37414
37632
  dataSourceId: BASE_DATA_SOURCE_ID.thread,
37415
37633
  recordId: sessionState.selectedSessionId
37416
37634
  }
37635
+ ),
37636
+ /* @__PURE__ */ jsx(
37637
+ AgentConsentDialog,
37638
+ {
37639
+ pending: consentRequiredFor,
37640
+ onApproved: () => setConsentRequiredFor(null),
37641
+ onDeclined: () => {
37642
+ onClose?.();
37643
+ },
37644
+ t
37645
+ }
37417
37646
  )
37418
37647
  ] });
37419
37648
  if (isInlineMode) {