@docyrus/ui-pro-ai-assistant 0.8.0 → 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,
@@ -19678,7 +19860,7 @@ function ChatPanel({
19678
19860
  /* @__PURE__ */ jsxs("div", { className: "mt-2 flex flex-col", children: [
19679
19861
  renderAppContextChip(),
19680
19862
  renderChatError(),
19681
- renderInputArea(true)
19863
+ !consentRequired && renderInputArea(true)
19682
19864
  ] })
19683
19865
  ] }) }),
19684
19866
  recentSessions && recentSessions.length > 0 && !isLoadingAgent ? /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-3", children: [
@@ -19729,7 +19911,7 @@ function ChatPanel({
19729
19911
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col px-3 pb-3 pt-2", children: [
19730
19912
  renderAppContextChip(),
19731
19913
  renderChatError(),
19732
- renderInputArea()
19914
+ !consentRequired && renderInputArea()
19733
19915
  ] })
19734
19916
  ] });
19735
19917
  }
@@ -22469,7 +22651,7 @@ var buttonVariants = cva(
22469
22651
  }
22470
22652
  }
22471
22653
  );
22472
- var Button39 = withTooltip(({
22654
+ var Button40 = withTooltip(({
22473
22655
  active,
22474
22656
  asChild = false,
22475
22657
  children,
@@ -23077,7 +23259,7 @@ function AIMenu() {
23077
23259
  }
23078
23260
  ),
23079
23261
  /* @__PURE__ */ jsx(
23080
- Button39,
23262
+ Button40,
23081
23263
  {
23082
23264
  className: "no-focus-ring mt-1 shrink-0",
23083
23265
  disabled: !isLoading && input.trim().length === 0,
@@ -23951,7 +24133,7 @@ function Comment(props) {
23951
24133
  ] }),
23952
24134
  isMyComment && (hovering || dropdownOpen) && /* @__PURE__ */ jsxs("div", { className: "absolute top-0 right-0 flex space-x-1", children: [
23953
24135
  index === 0 && /* @__PURE__ */ jsx(
23954
- Button39,
24136
+ Button40,
23955
24137
  {
23956
24138
  className: "h-6 p-1 text-muted-foreground",
23957
24139
  onClick: onResolveComment,
@@ -24000,7 +24182,7 @@ function Comment(props) {
24000
24182
  ),
24001
24183
  isEditing && /* @__PURE__ */ jsxs("div", { className: "ml-auto flex shrink-0 gap-1", children: [
24002
24184
  /* @__PURE__ */ jsx(
24003
- Button39,
24185
+ Button40,
24004
24186
  {
24005
24187
  className: "size-[28px]",
24006
24188
  onClick: (e) => {
@@ -24013,7 +24195,7 @@ function Comment(props) {
24013
24195
  }
24014
24196
  ),
24015
24197
  /* @__PURE__ */ jsx(
24016
- Button39,
24198
+ Button40,
24017
24199
  {
24018
24200
  onClick: (e) => {
24019
24201
  e.stopPropagation();
@@ -24081,7 +24263,7 @@ function CommentMoreDropdown(props) {
24081
24263
  onOpenChange: setDropdownOpen,
24082
24264
  open: dropdownOpen,
24083
24265
  children: [
24084
- /* @__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" }) }) }),
24085
24267
  /* @__PURE__ */ jsx(
24086
24268
  DropdownMenuContent5,
24087
24269
  {
@@ -24253,7 +24435,7 @@ function CommentCreateForm({
24253
24435
  }
24254
24436
  ),
24255
24437
  /* @__PURE__ */ jsx(
24256
- Button39,
24438
+ Button40,
24257
24439
  {
24258
24440
  className: "absolute right-0 bottom-0 ml-auto shrink-0",
24259
24441
  disabled: commentContent.trim().length === 0,
@@ -24587,7 +24769,7 @@ function BlockSuggestionCard({
24587
24769
  )),
24588
24770
  hovering && /* @__PURE__ */ jsxs("div", { className: "absolute top-4 right-4 flex gap-2", children: [
24589
24771
  /* @__PURE__ */ jsx(
24590
- Button39,
24772
+ Button40,
24591
24773
  {
24592
24774
  variant: "ghost",
24593
24775
  className: "size-6 p-1 text-muted-foreground",
@@ -24596,7 +24778,7 @@ function BlockSuggestionCard({
24596
24778
  }
24597
24779
  ),
24598
24780
  /* @__PURE__ */ jsx(
24599
- Button39,
24781
+ Button40,
24600
24782
  {
24601
24783
  variant: "ghost",
24602
24784
  className: "size-6 p-1 text-muted-foreground",
@@ -25066,7 +25248,7 @@ var BlockCommentsContent = ({
25066
25248
  }
25067
25249
  ),
25068
25250
  totalCount > 0 && /* @__PURE__ */ jsx("div", { className: "relative left-0 size-0 select-none", children: /* @__PURE__ */ jsx(PopoverTrigger13, { asChild: true, children: /* @__PURE__ */ jsxs(
25069
- Button39,
25251
+ Button40,
25070
25252
  {
25071
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",
25072
25254
  contentEditable: false,
@@ -26982,7 +27164,7 @@ function BlockActionButton({
26982
27164
  const editor = useEditorRef();
26983
27165
  const element = useElement();
26984
27166
  return /* @__PURE__ */ jsx(
26985
- Button39,
27167
+ Button40,
26986
27168
  {
26987
27169
  className: cn(
26988
27170
  defaultStyles && "absolute top-1 right-1 opacity-0 transition-opacity group-hover:opacity-100",
@@ -27321,7 +27503,7 @@ function EmojiPickerSearchAndClear({
27321
27503
  }
27322
27504
  ),
27323
27505
  searchValue && /* @__PURE__ */ jsx(
27324
- Button39,
27506
+ Button40,
27325
27507
  {
27326
27508
  "aria-label": "Clear",
27327
27509
  className: cn(
@@ -27410,7 +27592,7 @@ function EmojiPickerNavigation({
27410
27592
  id: "emoji-nav",
27411
27593
  children: /* @__PURE__ */ jsxs("div", { className: "relative flex items-center", children: [
27412
27594
  emojiLibrary.getGrid().sections().map(({ id }) => /* @__PURE__ */ jsx(
27413
- Button39,
27595
+ Button40,
27414
27596
  {
27415
27597
  "aria-label": i18n.categories[id],
27416
27598
  className: cn(
@@ -27572,7 +27754,7 @@ function CalloutElement(props) {
27572
27754
  {
27573
27755
  ...emojiToolbarDropdownProps,
27574
27756
  control: /* @__PURE__ */ jsx(
27575
- Button39,
27757
+ Button40,
27576
27758
  {
27577
27759
  className: "size-6 select-none p-1 text-[18px] hover:bg-muted-foreground/15",
27578
27760
  contentEditable: false,
@@ -27811,7 +27993,7 @@ function CodeBlockElement2(props) {
27811
27993
  contentEditable: false,
27812
27994
  children: [
27813
27995
  /* @__PURE__ */ jsxs(
27814
- Button39,
27996
+ Button40,
27815
27997
  {
27816
27998
  className: "relative top-0 right-0 w-auto",
27817
27999
  onClick: () => {
@@ -27856,7 +28038,7 @@ function CodeBlockCombobox({ className }) {
27856
28038
  if (readOnly) return null;
27857
28039
  return /* @__PURE__ */ jsxs(Popover13, { onOpenChange: setOpen, open, children: [
27858
28040
  /* @__PURE__ */ jsx(PopoverTrigger13, { asChild: true, children: /* @__PURE__ */ jsxs(
27859
- Button39,
28041
+ Button40,
27860
28042
  {
27861
28043
  "aria-expanded": open,
27862
28044
  className: cn(
@@ -28217,7 +28399,7 @@ function Draggable(props) {
28217
28399
  ),
28218
28400
  children: [
28219
28401
  /* @__PURE__ */ jsx(
28220
- Button39,
28402
+ Button40,
28221
28403
  {
28222
28404
  className: "absolute right-0 h-6 w-6 p-0",
28223
28405
  "data-plate-prevent-deselect": true,
@@ -28404,7 +28586,7 @@ var DraggableInsertHandle = () => {
28404
28586
  const editor = useEditorRef();
28405
28587
  const element = useElement();
28406
28588
  return /* @__PURE__ */ jsx(
28407
- Button39,
28589
+ Button40,
28408
28590
  {
28409
28591
  className: "size-6 shrink-0 p-1",
28410
28592
  onClick: (event) => {
@@ -29635,7 +29817,7 @@ function EquationPopoverContent({
29635
29817
  ...props
29636
29818
  }
29637
29819
  ),
29638
- /* @__PURE__ */ jsxs(Button39, { className: "px-3", onClick: onClose, variant: "brand", children: [
29820
+ /* @__PURE__ */ jsxs(Button40, { className: "px-3", onClick: onClose, variant: "brand", children: [
29639
29821
  "Done ",
29640
29822
  /* @__PURE__ */ jsx(CornerDownLeftIcon, { className: "size-3.5" })
29641
29823
  ] })
@@ -30513,7 +30695,7 @@ function MediaPlaceholderPopover({ children }) {
30513
30695
  /* @__PURE__ */ jsx(TabsTrigger, { value: "password", children: "Embed link" })
30514
30696
  ] }),
30515
30697
  /* @__PURE__ */ jsxs(TabsContent, { className: "w-[300px] px-3 py-2", value: "account", children: [
30516
- /* @__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 }),
30517
30699
  /* @__PURE__ */ jsx("div", { className: "mt-3 text-muted-foreground text-xs", children: "The maximum size per file is 5MB" })
30518
30700
  ] }),
30519
30701
  /* @__PURE__ */ jsxs(
@@ -30531,7 +30713,7 @@ function MediaPlaceholderPopover({ children }) {
30531
30713
  }
30532
30714
  ),
30533
30715
  /* @__PURE__ */ jsx(
30534
- Button39,
30716
+ Button40,
30535
30717
  {
30536
30718
  className: "mt-2 w-full max-w-[300px]",
30537
30719
  onClick: () => onEmbed(embedValue),
@@ -30651,12 +30833,12 @@ function ImagePreview() {
30651
30833
  onClick: (e) => e.stopPropagation(),
30652
30834
  children: [
30653
30835
  !prevDisabled && !nextDisabled && /* @__PURE__ */ jsxs("div", { className: "flex rounded-sm bg-black/70", children: [
30654
- /* @__PURE__ */ jsx(Button39, { ...prevProps, disabled: prevDisabled, children: /* @__PURE__ */ jsx(ArrowLeftIcon, { className: "size-5" }) }),
30655
- /* @__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" }) })
30656
30838
  ] }),
30657
30839
  currentPreview && /* @__PURE__ */ jsxs("div", { className: "flex rounded-sm bg-black/70", children: [
30658
30840
  /* @__PURE__ */ jsx(
30659
- Button39,
30841
+ Button40,
30660
30842
  {
30661
30843
  ...zommOutProps,
30662
30844
  disabled: zoomOutDisabled,
@@ -30669,7 +30851,7 @@ function ImagePreview() {
30669
30851
  /* @__PURE__ */ jsx("div", { children: "%" })
30670
30852
  ] }),
30671
30853
  /* @__PURE__ */ jsx(
30672
- Button39,
30854
+ Button40,
30673
30855
  {
30674
30856
  ...zoomInProps,
30675
30857
  disabled: zoomInDisabled,
@@ -30678,7 +30860,7 @@ function ImagePreview() {
30678
30860
  }
30679
30861
  ),
30680
30862
  /* @__PURE__ */ jsx(
30681
- Button39,
30863
+ Button40,
30682
30864
  {
30683
30865
  onClick: () => {
30684
30866
  void downloadFile(currentPreview.url, currentPreview.id);
@@ -30687,7 +30869,7 @@ function ImagePreview() {
30687
30869
  children: /* @__PURE__ */ jsx(CircleArrowDown, { className: "size-4" })
30688
30870
  }
30689
30871
  ),
30690
- /* @__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" }) })
30691
30873
  ] })
30692
30874
  ]
30693
30875
  }
@@ -31327,7 +31509,7 @@ var TableElement2 = withHOC(
31327
31509
  "group-has-[tr:last-child:hover]/table:opacity-100 max-sm:group-has-[tr[data-selected]:last-child]/table:opacity-100"
31328
31510
  ),
31329
31511
  children: /* @__PURE__ */ jsx(
31330
- Button39,
31512
+ Button40,
31331
31513
  {
31332
31514
  className: "flex h-4 w-full grow items-center justify-center bg-muted",
31333
31515
  onClick: () => tf.insert.tableRow({ at: editor.api.findPath(element) }),
@@ -31349,7 +31531,7 @@ var TableElement2 = withHOC(
31349
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"
31350
31532
  ),
31351
31533
  children: /* @__PURE__ */ jsx(
31352
- Button39,
31534
+ Button40,
31353
31535
  {
31354
31536
  className: "flex h-full w-4 grow items-center justify-center bg-muted",
31355
31537
  onClick: () => tf.insert.tableColumn({
@@ -31373,7 +31555,7 @@ var TableElement2 = withHOC(
31373
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"
31374
31556
  ),
31375
31557
  children: /* @__PURE__ */ jsx(
31376
- Button39,
31558
+ Button40,
31377
31559
  {
31378
31560
  className: "flex size-4 items-center justify-center rounded-full bg-muted",
31379
31561
  onClick: () => {
@@ -31579,7 +31761,7 @@ function TocElement(props) {
31579
31761
  const { headingList } = state;
31580
31762
  return /* @__PURE__ */ jsxs(PlateElement, { ...props, className: "my-1", children: [
31581
31763
  /* @__PURE__ */ jsx("div", { contentEditable: false, children: headingList.length > 0 ? headingList.map((item) => /* @__PURE__ */ jsx(
31582
- Button39,
31764
+ Button40,
31583
31765
  {
31584
31766
  "aria-current": true,
31585
31767
  className: headingItemVariants({ depth: item.depth }),
@@ -32681,7 +32863,7 @@ function TocElementStatic(props) {
32681
32863
  const headingList = getHeadingList(editor);
32682
32864
  return /* @__PURE__ */ jsxs(SlateElement, { ...props, className: "mb-1 p-0", children: [
32683
32865
  /* @__PURE__ */ jsx("div", { children: headingList.length > 0 ? headingList.map((item) => /* @__PURE__ */ jsx(
32684
- Button39,
32866
+ Button40,
32685
32867
  {
32686
32868
  className: headingItemVariants2({ depth: item.depth }),
32687
32869
  variant: "ghost",
@@ -34589,6 +34771,7 @@ var AssistantView = ({ ref, ...props }) => {
34589
34771
  onClearAppContext: commonProps2.onClearAppContext,
34590
34772
  chatError: commonProps2.chatError,
34591
34773
  onDismissChatError: commonProps2.onDismissChatError,
34774
+ consentRequired: commonProps2.consentRequired,
34592
34775
  messagesClassName: "p-4"
34593
34776
  }
34594
34777
  );
@@ -34851,6 +35034,7 @@ var AssistantView = ({ ref, ...props }) => {
34851
35034
  onClearAppContext: commonProps.onClearAppContext,
34852
35035
  chatError: commonProps.chatError,
34853
35036
  onDismissChatError: commonProps.onDismissChatError,
35037
+ consentRequired: commonProps.consentRequired,
34854
35038
  onManageMemories: onTabChange ? () => onTabChange(4) : void 0,
34855
35039
  compactToolbar: !isFullscreen
34856
35040
  }
@@ -36446,7 +36630,9 @@ var DocyAssistant = ({
36446
36630
  agentDetailsForId,
36447
36631
  isLoadingAgentDetails,
36448
36632
  subagents,
36449
- agentTools
36633
+ agentTools,
36634
+ consentRequiredFor,
36635
+ setConsentRequiredFor
36450
36636
  } = useAssistantApi({
36451
36637
  tenantAiAgentId: activeAgentId,
36452
36638
  deploymentId,
@@ -36733,6 +36919,7 @@ var DocyAssistant = ({
36733
36919
  }, [activeTabId]);
36734
36920
  const handleSendMessage = async (e, options3, overrideText) => {
36735
36921
  e?.preventDefault();
36922
+ if (consentRequiredFor) return;
36736
36923
  if (isSendingRef.current) return;
36737
36924
  if (status === "submitted" || status === "streaming") return;
36738
36925
  const messageText = (overrideText ?? input).trim();
@@ -37051,6 +37238,7 @@ var DocyAssistant = ({
37051
37238
  onClearAppContext: clearAppContext,
37052
37239
  chatError,
37053
37240
  onDismissChatError: () => setChatError(null),
37241
+ consentRequired: !!consentRequiredFor,
37054
37242
  initialModelId,
37055
37243
  initialFeatures,
37056
37244
  enableMicrophone,
@@ -37444,6 +37632,17 @@ var DocyAssistant = ({
37444
37632
  dataSourceId: BASE_DATA_SOURCE_ID.thread,
37445
37633
  recordId: sessionState.selectedSessionId
37446
37634
  }
37635
+ ),
37636
+ /* @__PURE__ */ jsx(
37637
+ AgentConsentDialog,
37638
+ {
37639
+ pending: consentRequiredFor,
37640
+ onApproved: () => setConsentRequiredFor(null),
37641
+ onDeclined: () => {
37642
+ onClose?.();
37643
+ },
37644
+ t
37645
+ }
37447
37646
  )
37448
37647
  ] });
37449
37648
  if (isInlineMode) {