@greatapps/greatagents-ui 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -628,7 +628,6 @@ import {
628
628
  DialogFooter,
629
629
  Button as Button2,
630
630
  Input as Input2,
631
- Textarea,
632
631
  Label
633
632
  } from "@greatapps/greatauth-ui/ui";
634
633
  import { Loader2 } from "lucide-react";
@@ -644,20 +643,17 @@ function AgentFormDialog({
644
643
  const createAgent = useCreateAgent(config);
645
644
  const updateAgent = useUpdateAgent(config);
646
645
  const [title, setTitle] = useState2("");
647
- const [prompt, setPrompt] = useState2("");
648
646
  const [photo, setPhoto] = useState2("");
649
647
  const [delayTyping, setDelayTyping] = useState2("");
650
648
  const [waitingTime, setWaitingTime] = useState2("");
651
649
  useEffect(() => {
652
650
  if (agent) {
653
651
  setTitle(agent.title);
654
- setPrompt(agent.prompt || "");
655
652
  setPhoto(agent.photo || "");
656
653
  setDelayTyping(agent.delay_typing != null ? String(agent.delay_typing) : "");
657
654
  setWaitingTime(agent.waiting_time != null ? String(agent.waiting_time) : "");
658
655
  } else {
659
656
  setTitle("");
660
- setPrompt("");
661
657
  setPhoto("");
662
658
  setDelayTyping("");
663
659
  setWaitingTime("");
@@ -670,7 +666,6 @@ function AgentFormDialog({
670
666
  const body = {
671
667
  title: title.trim()
672
668
  };
673
- if (prompt.trim()) body.prompt = prompt.trim();
674
669
  if (photo.trim()) body.photo = photo.trim();
675
670
  if (delayTyping.trim()) body.delay_typing = Number(delayTyping);
676
671
  if (waitingTime.trim()) body.waiting_time = Number(waitingTime);
@@ -719,20 +714,6 @@ function AgentFormDialog({
719
714
  }
720
715
  )
721
716
  ] }),
722
- /* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
723
- /* @__PURE__ */ jsx2(Label, { htmlFor: "agent-prompt", children: "Prompt do Sistema" }),
724
- /* @__PURE__ */ jsx2(
725
- Textarea,
726
- {
727
- id: "agent-prompt",
728
- value: prompt,
729
- onChange: (e) => setPrompt(e.target.value),
730
- placeholder: "Instru\xE7\xF5es para o agente AI...",
731
- rows: 6,
732
- disabled: isPending
733
- }
734
- )
735
- ] }),
736
717
  /* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-2 gap-4", children: [
737
718
  /* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
738
719
  /* @__PURE__ */ jsx2(Label, { htmlFor: "agent-delay", children: "Delay de Digita\xE7\xE3o (ms)" }),
@@ -983,7 +964,7 @@ import {
983
964
  PopoverContent,
984
965
  PopoverTrigger,
985
966
  Input as Input4,
986
- Textarea as Textarea2,
967
+ Textarea,
987
968
  Dialog as Dialog3,
988
969
  DialogContent as DialogContent3,
989
970
  DialogHeader as DialogHeader3,
@@ -1223,7 +1204,7 @@ function AgentToolsList({ agent, config }) {
1223
1204
  /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
1224
1205
  /* @__PURE__ */ jsx4(Label3, { children: "Instru\xE7\xF5es Personalizadas" }),
1225
1206
  /* @__PURE__ */ jsx4(
1226
- Textarea2,
1207
+ Textarea,
1227
1208
  {
1228
1209
  value: configInstructions,
1229
1210
  onChange: (e) => setConfigInstructions(e.target.value),
@@ -1289,7 +1270,7 @@ import {
1289
1270
  Button as Button5,
1290
1271
  Switch as Switch3,
1291
1272
  Skeleton as Skeleton2,
1292
- Textarea as Textarea3,
1273
+ Textarea as Textarea2,
1293
1274
  Label as Label4,
1294
1275
  Badge as Badge3,
1295
1276
  Dialog as Dialog4,
@@ -2012,7 +1993,7 @@ function AgentObjectivesList({ agent, config }) {
2012
1993
  /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
2013
1994
  /* @__PURE__ */ jsx6(Label4, { children: "Instru\xE7\xF5es do Objetivo" }),
2014
1995
  /* @__PURE__ */ jsx6(
2015
- Textarea3,
1996
+ Textarea2,
2016
1997
  {
2017
1998
  value: form.prompt,
2018
1999
  onChange: (e) => setForm((f) => ({ ...f, prompt: e.target.value })),
@@ -2141,15 +2122,27 @@ function AgentPromptEditor({ config, agent }) {
2141
2122
  const { data: objectivesData } = useObjectives(config, agent.id);
2142
2123
  const { data: agentToolsData } = useAgentTools(config, agent.id);
2143
2124
  const { data: toolsData } = useTools(config);
2125
+ const versions = versionsData?.data || [];
2126
+ const sortedVersions = [...versions].sort(
2127
+ (a, b) => new Date(b.datetime_add).getTime() - new Date(a.datetime_add).getTime()
2128
+ );
2129
+ const currentVersion = sortedVersions.find((v) => v.is_current) || sortedVersions[0] || null;
2130
+ const currentPromptContent = currentVersion?.prompt_content ?? "";
2144
2131
  const [trackedAgentId, setTrackedAgentId] = useState7(agent.id);
2145
- const [promptText, setPromptText] = useState7(agent.prompt || "");
2132
+ const [promptText, setPromptText] = useState7(currentPromptContent);
2133
+ const [promptInitialized, setPromptInitialized] = useState7(false);
2146
2134
  const [changeNotes, setChangeNotes] = useState7("");
2147
2135
  const [showPreview, setShowPreview] = useState7(false);
2148
2136
  const [compareVersionId, setCompareVersionId] = useState7(null);
2149
2137
  const textareaRef = useRef(null);
2138
+ if (!promptInitialized && currentPromptContent && !isLoading) {
2139
+ setPromptText(currentPromptContent);
2140
+ setPromptInitialized(true);
2141
+ }
2150
2142
  if (trackedAgentId !== agent.id) {
2151
2143
  setTrackedAgentId(agent.id);
2152
- setPromptText(agent.prompt || "");
2144
+ setPromptText(currentPromptContent);
2145
+ setPromptInitialized(!!currentPromptContent);
2153
2146
  setCompareVersionId(null);
2154
2147
  }
2155
2148
  const autoResize = useCallback3(() => {
@@ -2175,11 +2168,6 @@ function AgentPromptEditor({ config, agent }) {
2175
2168
  });
2176
2169
  }
2177
2170
  }
2178
- const versions = versionsData?.data || [];
2179
- const sortedVersions = [...versions].sort(
2180
- (a, b) => new Date(b.datetime_add).getTime() - new Date(a.datetime_add).getTime()
2181
- );
2182
- const currentVersion = sortedVersions.length > 0 ? sortedVersions[0] : null;
2183
2171
  const compareVersion = sortedVersions.find((v) => v.id === compareVersionId);
2184
2172
  const diffLines = currentVersion && compareVersion && compareVersion.id !== currentVersion.id ? computeDiff(compareVersion.prompt_content ?? "", currentVersion.prompt_content ?? "") : null;
2185
2173
  async function handleSave() {
@@ -2395,6 +2383,220 @@ function AgentPromptEditor({ config, agent }) {
2395
2383
  ] });
2396
2384
  }
2397
2385
 
2386
+ // src/components/conversations/agent-conversations-table.tsx
2387
+ import { useState as useState8 } from "react";
2388
+ import {
2389
+ Table,
2390
+ TableBody,
2391
+ TableCell,
2392
+ TableHead,
2393
+ TableHeader,
2394
+ TableRow,
2395
+ Skeleton as Skeleton5,
2396
+ Badge as Badge5
2397
+ } from "@greatapps/greatauth-ui/ui";
2398
+ import { MessageCircle, ExternalLink } from "lucide-react";
2399
+
2400
+ // src/components/conversations/conversation-view.tsx
2401
+ import { Skeleton as Skeleton4, Button as Button7 } from "@greatapps/greatauth-ui/ui";
2402
+ import { X, MessageSquare } from "lucide-react";
2403
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
2404
+ function formatDateTime(dateStr) {
2405
+ if (!dateStr) return "\u2014";
2406
+ return new Date(dateStr).toLocaleString("pt-BR");
2407
+ }
2408
+ function ConversationView({
2409
+ conversationId,
2410
+ onClose,
2411
+ contactsMap,
2412
+ config,
2413
+ renderChatLink
2414
+ }) {
2415
+ const { data: conversation, isLoading } = useConversation(config, conversationId);
2416
+ if (isLoading) {
2417
+ return /* @__PURE__ */ jsxs7("div", { className: "rounded-lg border bg-card p-4 space-y-3", children: [
2418
+ /* @__PURE__ */ jsx8(Skeleton4, { className: "h-6 w-48" }),
2419
+ /* @__PURE__ */ jsx8("div", { className: "grid grid-cols-2 gap-3", children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx8(Skeleton4, { className: "h-10 w-full" }, i)) })
2420
+ ] });
2421
+ }
2422
+ if (!conversation) {
2423
+ return /* @__PURE__ */ jsx8("div", { className: "rounded-lg border bg-card p-4", children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between", children: [
2424
+ /* @__PURE__ */ jsx8("p", { className: "text-sm text-muted-foreground", children: "Conversa n\xE3o encontrada." }),
2425
+ /* @__PURE__ */ jsx8(Button7, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx8(X, { className: "h-4 w-4" }) })
2426
+ ] }) });
2427
+ }
2428
+ return /* @__PURE__ */ jsxs7("div", { className: "rounded-lg border bg-card p-4 space-y-4", children: [
2429
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between", children: [
2430
+ /* @__PURE__ */ jsxs7("h3", { className: "font-semibold", children: [
2431
+ "Detalhes da conversa #",
2432
+ conversation.id
2433
+ ] }),
2434
+ /* @__PURE__ */ jsx8("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsx8(Button7, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx8(X, { className: "h-4 w-4" }) }) })
2435
+ ] }),
2436
+ conversation.id_external ? renderChatLink ? renderChatLink(conversation.id_external) : /* @__PURE__ */ jsx8(Button7, { variant: "outline", size: "sm", asChild: true, children: /* @__PURE__ */ jsxs7("a", { href: `/gchat/inbox/${conversation.id_external}`, children: [
2437
+ /* @__PURE__ */ jsx8(MessageSquare, { className: "mr-2 h-4 w-4" }),
2438
+ "Ver no Chat"
2439
+ ] }) }) : null,
2440
+ /* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-2 gap-x-6 gap-y-3 text-sm", children: [
2441
+ /* @__PURE__ */ jsxs7("div", { children: [
2442
+ /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Thread ID" }),
2443
+ /* @__PURE__ */ jsx8("p", { className: "font-mono text-xs mt-0.5", children: conversation.openai_thread_id || "\u2014" })
2444
+ ] }),
2445
+ /* @__PURE__ */ jsxs7("div", { children: [
2446
+ /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Contato" }),
2447
+ /* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: contactsMap?.get(conversation.id_contact) ?? conversation.id_contact })
2448
+ ] }),
2449
+ /* @__PURE__ */ jsxs7("div", { children: [
2450
+ /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Agente" }),
2451
+ /* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: conversation.id_agent ?? "\u2014" })
2452
+ ] }),
2453
+ /* @__PURE__ */ jsxs7("div", { children: [
2454
+ /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Mensagens" }),
2455
+ /* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: conversation.message_count ?? "\u2014" })
2456
+ ] }),
2457
+ /* @__PURE__ */ jsxs7("div", { children: [
2458
+ /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Tokens" }),
2459
+ /* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: conversation.usage_tokens ?? "\u2014" })
2460
+ ] }),
2461
+ /* @__PURE__ */ jsxs7("div", { children: [
2462
+ /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Rota\xE7\xF5es de Thread" }),
2463
+ /* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: conversation.rotation_count ?? "\u2014" })
2464
+ ] }),
2465
+ /* @__PURE__ */ jsxs7("div", { children: [
2466
+ /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Criado em" }),
2467
+ /* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: formatDateTime(conversation.datetime_add) })
2468
+ ] }),
2469
+ /* @__PURE__ */ jsxs7("div", { children: [
2470
+ /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Atualizado em" }),
2471
+ /* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: formatDateTime(conversation.datetime_alt) })
2472
+ ] })
2473
+ ] })
2474
+ ] });
2475
+ }
2476
+
2477
+ // src/components/conversations/agent-conversations-table.tsx
2478
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
2479
+ function formatRelativeDate(dateStr) {
2480
+ if (!dateStr) return "\u2014";
2481
+ const date = new Date(dateStr);
2482
+ const now = /* @__PURE__ */ new Date();
2483
+ const diffMs = now.getTime() - date.getTime();
2484
+ const diffMin = Math.floor(diffMs / 6e4);
2485
+ if (diffMin < 1) return "agora";
2486
+ if (diffMin < 60) return `${diffMin}m atr\xE1s`;
2487
+ const diffHours = Math.floor(diffMin / 60);
2488
+ if (diffHours < 24) return `${diffHours}h atr\xE1s`;
2489
+ const diffDays = Math.floor(diffHours / 24);
2490
+ if (diffDays < 30) return `${diffDays}d atr\xE1s`;
2491
+ return date.toLocaleDateString("pt-BR");
2492
+ }
2493
+ function AgentConversationsTable({
2494
+ conversations,
2495
+ isLoading,
2496
+ contactsMap,
2497
+ objectivesMap,
2498
+ config,
2499
+ renderChatLink
2500
+ }) {
2501
+ const [selectedId, setSelectedId] = useState8(null);
2502
+ if (isLoading) {
2503
+ return /* @__PURE__ */ jsx9("div", { className: "space-y-3", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx9(Skeleton5, { className: "h-12 w-full" }, i)) });
2504
+ }
2505
+ if (conversations.length === 0) {
2506
+ return /* @__PURE__ */ jsxs8("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
2507
+ /* @__PURE__ */ jsx9(MessageCircle, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
2508
+ /* @__PURE__ */ jsx9("p", { className: "text-sm text-muted-foreground", children: "Nenhuma conversa encontrada." })
2509
+ ] });
2510
+ }
2511
+ return /* @__PURE__ */ jsxs8("div", { className: "space-y-4", children: [
2512
+ /* @__PURE__ */ jsxs8(Table, { children: [
2513
+ /* @__PURE__ */ jsx9(TableHeader, { children: /* @__PURE__ */ jsxs8(TableRow, { children: [
2514
+ /* @__PURE__ */ jsx9(TableHead, { children: "ID" }),
2515
+ /* @__PURE__ */ jsx9(TableHead, { children: "Contato" }),
2516
+ /* @__PURE__ */ jsx9(TableHead, { children: "Objetivo" }),
2517
+ /* @__PURE__ */ jsx9(TableHead, { className: "text-right", children: "Mensagens" }),
2518
+ /* @__PURE__ */ jsx9(TableHead, { className: "text-right", children: "Tokens" }),
2519
+ /* @__PURE__ */ jsx9(TableHead, { children: "Criado em" }),
2520
+ /* @__PURE__ */ jsx9(TableHead, { children: "Atualizado em" }),
2521
+ /* @__PURE__ */ jsx9(TableHead, { className: "w-10" })
2522
+ ] }) }),
2523
+ /* @__PURE__ */ jsx9(TableBody, { children: conversations.map((conversation) => /* @__PURE__ */ jsxs8(
2524
+ TableRow,
2525
+ {
2526
+ className: "cursor-pointer",
2527
+ onClick: () => setSelectedId(
2528
+ selectedId === conversation.id ? null : conversation.id
2529
+ ),
2530
+ "data-state": selectedId === conversation.id ? "selected" : void 0,
2531
+ children: [
2532
+ /* @__PURE__ */ jsx9(TableCell, { className: "font-mono text-xs", children: conversation.id }),
2533
+ /* @__PURE__ */ jsx9(TableCell, { children: contactsMap?.get(conversation.id_contact) ?? conversation.id_contact }),
2534
+ /* @__PURE__ */ jsx9(TableCell, { children: conversation.id_objective && objectivesMap?.get(conversation.id_objective) ? /* @__PURE__ */ jsx9(Badge5, { variant: "secondary", className: "text-xs", children: objectivesMap.get(conversation.id_objective) }) : /* @__PURE__ */ jsx9("span", { className: "text-xs text-muted-foreground", children: "\u2014" }) }),
2535
+ /* @__PURE__ */ jsx9(TableCell, { className: "text-right", children: conversation.message_count ?? "\u2014" }),
2536
+ /* @__PURE__ */ jsx9(TableCell, { className: "text-right", children: conversation.usage_tokens ?? "\u2014" }),
2537
+ /* @__PURE__ */ jsx9(TableCell, { children: new Date(conversation.datetime_add).toLocaleDateString("pt-BR") }),
2538
+ /* @__PURE__ */ jsx9(TableCell, { children: formatRelativeDate(conversation.datetime_alt) }),
2539
+ /* @__PURE__ */ jsx9(TableCell, { children: conversation.id_external ? renderChatLink ? /* @__PURE__ */ jsx9("span", { onClick: (e) => e.stopPropagation(), children: renderChatLink(conversation.id_external) }) : /* @__PURE__ */ jsx9(
2540
+ "a",
2541
+ {
2542
+ href: `/gchat/inbox/${conversation.id_external}`,
2543
+ title: "Ver no Chat",
2544
+ onClick: (e) => e.stopPropagation(),
2545
+ className: "inline-flex items-center justify-center rounded-md p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",
2546
+ children: /* @__PURE__ */ jsx9(ExternalLink, { className: "h-4 w-4" })
2547
+ }
2548
+ ) : null })
2549
+ ]
2550
+ },
2551
+ conversation.id
2552
+ )) })
2553
+ ] }),
2554
+ selectedId && /* @__PURE__ */ jsx9(
2555
+ ConversationView,
2556
+ {
2557
+ conversationId: selectedId,
2558
+ onClose: () => setSelectedId(null),
2559
+ contactsMap,
2560
+ config,
2561
+ renderChatLink
2562
+ }
2563
+ )
2564
+ ] });
2565
+ }
2566
+
2567
+ // src/components/conversations/agent-conversations-panel.tsx
2568
+ import { jsx as jsx10 } from "react/jsx-runtime";
2569
+ function AgentConversationsPanel({
2570
+ agent,
2571
+ config,
2572
+ renderChatLink
2573
+ }) {
2574
+ const { data: conversationsData, isLoading } = useAgentConversations(
2575
+ config,
2576
+ agent.id
2577
+ );
2578
+ const { data: contactsData } = useGagentsContacts(config);
2579
+ const { data: objectivesData } = useObjectives(config, agent.id);
2580
+ const conversations = conversationsData?.data || [];
2581
+ const contactsMap = new Map(
2582
+ (contactsData?.data || []).map((c) => [c.id, c.name])
2583
+ );
2584
+ const objectivesMap = new Map(
2585
+ (objectivesData?.data || []).map((o) => [o.id, o.title])
2586
+ );
2587
+ return /* @__PURE__ */ jsx10("div", { className: "p-4", children: /* @__PURE__ */ jsx10(
2588
+ AgentConversationsTable,
2589
+ {
2590
+ conversations,
2591
+ isLoading,
2592
+ contactsMap,
2593
+ objectivesMap,
2594
+ config,
2595
+ renderChatLink
2596
+ }
2597
+ ) });
2598
+ }
2599
+
2398
2600
  // src/components/agents/agent-tabs.tsx
2399
2601
  import {
2400
2602
  Tabs,
@@ -2402,41 +2604,48 @@ import {
2402
2604
  TabsTrigger,
2403
2605
  TabsContent
2404
2606
  } from "@greatapps/greatauth-ui/ui";
2405
- import { Wrench as Wrench2, Target as Target2, FileText as FileText2, MessageCircle } from "lucide-react";
2406
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
2407
- function AgentTabs({ agent, config, renderConversationsTab }) {
2408
- return /* @__PURE__ */ jsxs7(Tabs, { defaultValue: "prompt", children: [
2409
- /* @__PURE__ */ jsxs7(TabsList, { children: [
2410
- /* @__PURE__ */ jsxs7(TabsTrigger, { value: "prompt", className: "flex items-center gap-1.5", children: [
2411
- /* @__PURE__ */ jsx8(FileText2, { className: "h-3.5 w-3.5" }),
2607
+ import { Wrench as Wrench2, Target as Target2, FileText as FileText2, MessageCircle as MessageCircle2 } from "lucide-react";
2608
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2609
+ function AgentTabs({ agent, config, renderChatLink }) {
2610
+ return /* @__PURE__ */ jsxs9(Tabs, { defaultValue: "prompt", children: [
2611
+ /* @__PURE__ */ jsxs9(TabsList, { children: [
2612
+ /* @__PURE__ */ jsxs9(TabsTrigger, { value: "prompt", className: "flex items-center gap-1.5", children: [
2613
+ /* @__PURE__ */ jsx11(FileText2, { className: "h-3.5 w-3.5" }),
2412
2614
  "Prompt"
2413
2615
  ] }),
2414
- /* @__PURE__ */ jsxs7(TabsTrigger, { value: "objetivos", className: "flex items-center gap-1.5", children: [
2415
- /* @__PURE__ */ jsx8(Target2, { className: "h-3.5 w-3.5" }),
2616
+ /* @__PURE__ */ jsxs9(TabsTrigger, { value: "objetivos", className: "flex items-center gap-1.5", children: [
2617
+ /* @__PURE__ */ jsx11(Target2, { className: "h-3.5 w-3.5" }),
2416
2618
  "Objetivos"
2417
2619
  ] }),
2418
- /* @__PURE__ */ jsxs7(TabsTrigger, { value: "ferramentas", className: "flex items-center gap-1.5", children: [
2419
- /* @__PURE__ */ jsx8(Wrench2, { className: "h-3.5 w-3.5" }),
2620
+ /* @__PURE__ */ jsxs9(TabsTrigger, { value: "ferramentas", className: "flex items-center gap-1.5", children: [
2621
+ /* @__PURE__ */ jsx11(Wrench2, { className: "h-3.5 w-3.5" }),
2420
2622
  "Ferramentas"
2421
2623
  ] }),
2422
- renderConversationsTab && /* @__PURE__ */ jsxs7(TabsTrigger, { value: "conversas", className: "flex items-center gap-1.5", children: [
2423
- /* @__PURE__ */ jsx8(MessageCircle, { className: "h-3.5 w-3.5" }),
2624
+ /* @__PURE__ */ jsxs9(TabsTrigger, { value: "conversas", className: "flex items-center gap-1.5", children: [
2625
+ /* @__PURE__ */ jsx11(MessageCircle2, { className: "h-3.5 w-3.5" }),
2424
2626
  "Conversas"
2425
2627
  ] })
2426
2628
  ] }),
2427
- /* @__PURE__ */ jsx8(TabsContent, { value: "prompt", className: "mt-4", children: /* @__PURE__ */ jsx8(AgentPromptEditor, { agent, config }) }),
2428
- /* @__PURE__ */ jsx8(TabsContent, { value: "objetivos", className: "mt-4", children: /* @__PURE__ */ jsx8(AgentObjectivesList, { agent, config }) }),
2429
- /* @__PURE__ */ jsx8(TabsContent, { value: "ferramentas", className: "mt-4", children: /* @__PURE__ */ jsx8(AgentToolsList, { agent, config }) }),
2430
- renderConversationsTab && /* @__PURE__ */ jsx8(TabsContent, { value: "conversas", className: "mt-4", children: renderConversationsTab(agent) })
2629
+ /* @__PURE__ */ jsx11(TabsContent, { value: "prompt", className: "mt-4", children: /* @__PURE__ */ jsx11(AgentPromptEditor, { agent, config }) }),
2630
+ /* @__PURE__ */ jsx11(TabsContent, { value: "objetivos", className: "mt-4", children: /* @__PURE__ */ jsx11(AgentObjectivesList, { agent, config }) }),
2631
+ /* @__PURE__ */ jsx11(TabsContent, { value: "ferramentas", className: "mt-4", children: /* @__PURE__ */ jsx11(AgentToolsList, { agent, config }) }),
2632
+ /* @__PURE__ */ jsx11(TabsContent, { value: "conversas", className: "mt-4", children: /* @__PURE__ */ jsx11(
2633
+ AgentConversationsPanel,
2634
+ {
2635
+ agent,
2636
+ config,
2637
+ renderChatLink
2638
+ }
2639
+ ) })
2431
2640
  ] });
2432
2641
  }
2433
2642
 
2434
2643
  // src/components/tools/tools-table.tsx
2435
- import { useMemo as useMemo4, useState as useState8 } from "react";
2644
+ import { useMemo as useMemo4, useState as useState9 } from "react";
2436
2645
  import { DataTable as DataTable2 } from "@greatapps/greatauth-ui";
2437
2646
  import {
2438
2647
  Input as Input7,
2439
- Badge as Badge5,
2648
+ Badge as Badge6,
2440
2649
  Tooltip as Tooltip2,
2441
2650
  TooltipTrigger as TooltipTrigger2,
2442
2651
  TooltipContent as TooltipContent2,
@@ -2448,44 +2657,44 @@ import {
2448
2657
  AlertDialogFooter as AlertDialogFooter4,
2449
2658
  AlertDialogHeader as AlertDialogHeader4,
2450
2659
  AlertDialogTitle as AlertDialogTitle4,
2451
- Button as Button7
2660
+ Button as Button8
2452
2661
  } from "@greatapps/greatauth-ui/ui";
2453
2662
  import { Pencil as Pencil3, Trash2 as Trash24, Search as Search2 } from "lucide-react";
2454
2663
  import { format as format2 } from "date-fns";
2455
2664
  import { ptBR as ptBR2 } from "date-fns/locale";
2456
2665
  import { toast as toast7 } from "sonner";
2457
- import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
2666
+ import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2458
2667
  function useColumns2(onEdit, onDelete) {
2459
2668
  return [
2460
2669
  {
2461
2670
  accessorKey: "name",
2462
2671
  header: "Nome",
2463
- cell: ({ row }) => /* @__PURE__ */ jsx9("span", { className: "font-medium", children: row.original.name }),
2672
+ cell: ({ row }) => /* @__PURE__ */ jsx12("span", { className: "font-medium", children: row.original.name }),
2464
2673
  sortingFn: (rowA, rowB) => rowA.original.name.toLowerCase().localeCompare(rowB.original.name.toLowerCase())
2465
2674
  },
2466
2675
  {
2467
2676
  accessorKey: "slug",
2468
2677
  header: "Slug",
2469
- cell: ({ row }) => /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground text-sm font-mono", children: row.original.slug || "\u2014" })
2678
+ cell: ({ row }) => /* @__PURE__ */ jsx12("span", { className: "text-muted-foreground text-sm font-mono", children: row.original.slug || "\u2014" })
2470
2679
  },
2471
2680
  {
2472
2681
  accessorKey: "type",
2473
2682
  header: "Tipo",
2474
- cell: ({ row }) => /* @__PURE__ */ jsx9(Badge5, { variant: "secondary", children: row.original.type })
2683
+ cell: ({ row }) => /* @__PURE__ */ jsx12(Badge6, { variant: "secondary", children: row.original.type })
2475
2684
  },
2476
2685
  {
2477
2686
  accessorKey: "description",
2478
2687
  header: "Descri\xE7\xE3o",
2479
2688
  cell: ({ row }) => {
2480
2689
  const desc = row.original.description;
2481
- if (!desc) return /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground text-sm", children: "\u2014" });
2482
- return /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground text-sm", children: desc.length > 50 ? `${desc.slice(0, 50)}...` : desc });
2690
+ if (!desc) return /* @__PURE__ */ jsx12("span", { className: "text-muted-foreground text-sm", children: "\u2014" });
2691
+ return /* @__PURE__ */ jsx12("span", { className: "text-muted-foreground text-sm", children: desc.length > 50 ? `${desc.slice(0, 50)}...` : desc });
2483
2692
  }
2484
2693
  },
2485
2694
  {
2486
2695
  accessorKey: "datetime_add",
2487
2696
  header: "Criado em",
2488
- cell: ({ row }) => /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground text-sm", children: format2(new Date(row.original.datetime_add), "dd/MM/yyyy", {
2697
+ cell: ({ row }) => /* @__PURE__ */ jsx12("span", { className: "text-muted-foreground text-sm", children: format2(new Date(row.original.datetime_add), "dd/MM/yyyy", {
2489
2698
  locale: ptBR2
2490
2699
  }) })
2491
2700
  },
@@ -2493,40 +2702,40 @@ function useColumns2(onEdit, onDelete) {
2493
2702
  id: "actions",
2494
2703
  size: 80,
2495
2704
  enableSorting: false,
2496
- cell: ({ row }) => /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1", children: [
2497
- /* @__PURE__ */ jsxs8(Tooltip2, { children: [
2498
- /* @__PURE__ */ jsx9(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx9(
2499
- Button7,
2705
+ cell: ({ row }) => /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
2706
+ /* @__PURE__ */ jsxs10(Tooltip2, { children: [
2707
+ /* @__PURE__ */ jsx12(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx12(
2708
+ Button8,
2500
2709
  {
2501
2710
  variant: "ghost",
2502
2711
  size: "icon",
2503
2712
  className: "h-8 w-8",
2504
2713
  onClick: () => onEdit(row.original),
2505
- children: /* @__PURE__ */ jsx9(Pencil3, { className: "h-4 w-4" })
2714
+ children: /* @__PURE__ */ jsx12(Pencil3, { className: "h-4 w-4" })
2506
2715
  }
2507
2716
  ) }),
2508
- /* @__PURE__ */ jsx9(TooltipContent2, { children: "Editar" })
2717
+ /* @__PURE__ */ jsx12(TooltipContent2, { children: "Editar" })
2509
2718
  ] }),
2510
- /* @__PURE__ */ jsxs8(Tooltip2, { children: [
2511
- /* @__PURE__ */ jsx9(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx9(
2512
- Button7,
2719
+ /* @__PURE__ */ jsxs10(Tooltip2, { children: [
2720
+ /* @__PURE__ */ jsx12(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx12(
2721
+ Button8,
2513
2722
  {
2514
2723
  variant: "ghost",
2515
2724
  size: "icon",
2516
2725
  className: "h-8 w-8 text-destructive hover:text-destructive",
2517
2726
  onClick: () => onDelete(row.original.id),
2518
- children: /* @__PURE__ */ jsx9(Trash24, { className: "h-4 w-4" })
2727
+ children: /* @__PURE__ */ jsx12(Trash24, { className: "h-4 w-4" })
2519
2728
  }
2520
2729
  ) }),
2521
- /* @__PURE__ */ jsx9(TooltipContent2, { children: "Excluir" })
2730
+ /* @__PURE__ */ jsx12(TooltipContent2, { children: "Excluir" })
2522
2731
  ] })
2523
2732
  ] })
2524
2733
  }
2525
2734
  ];
2526
2735
  }
2527
2736
  function ToolsTable({ onEdit, config }) {
2528
- const [search, setSearch] = useState8("");
2529
- const [page, setPage] = useState8(1);
2737
+ const [search, setSearch] = useState9("");
2738
+ const [page, setPage] = useState9(1);
2530
2739
  const queryParams = useMemo4(() => {
2531
2740
  const params = {
2532
2741
  limit: "15",
@@ -2539,7 +2748,7 @@ function ToolsTable({ onEdit, config }) {
2539
2748
  }, [search, page]);
2540
2749
  const { data, isLoading } = useTools(config, queryParams);
2541
2750
  const deleteTool = useDeleteTool(config);
2542
- const [deleteId, setDeleteId] = useState8(null);
2751
+ const [deleteId, setDeleteId] = useState9(null);
2543
2752
  const tools = data?.data || [];
2544
2753
  const total = data?.total || 0;
2545
2754
  const columns = useColumns2(
@@ -2560,10 +2769,10 @@ function ToolsTable({ onEdit, config }) {
2560
2769
  setSearch(value);
2561
2770
  setPage(1);
2562
2771
  }
2563
- return /* @__PURE__ */ jsxs8(Fragment2, { children: [
2564
- /* @__PURE__ */ jsx9("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs8("div", { className: "relative flex-1 max-w-md", children: [
2565
- /* @__PURE__ */ jsx9(Search2, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
2566
- /* @__PURE__ */ jsx9(
2772
+ return /* @__PURE__ */ jsxs10(Fragment2, { children: [
2773
+ /* @__PURE__ */ jsx12("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs10("div", { className: "relative flex-1 max-w-md", children: [
2774
+ /* @__PURE__ */ jsx12(Search2, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
2775
+ /* @__PURE__ */ jsx12(
2567
2776
  Input7,
2568
2777
  {
2569
2778
  placeholder: "Buscar ferramentas...",
@@ -2573,7 +2782,7 @@ function ToolsTable({ onEdit, config }) {
2573
2782
  }
2574
2783
  )
2575
2784
  ] }) }),
2576
- /* @__PURE__ */ jsx9(
2785
+ /* @__PURE__ */ jsx12(
2577
2786
  DataTable2,
2578
2787
  {
2579
2788
  columns,
@@ -2586,19 +2795,19 @@ function ToolsTable({ onEdit, config }) {
2586
2795
  pageSize: 15
2587
2796
  }
2588
2797
  ),
2589
- /* @__PURE__ */ jsx9(
2798
+ /* @__PURE__ */ jsx12(
2590
2799
  AlertDialog4,
2591
2800
  {
2592
2801
  open: !!deleteId,
2593
2802
  onOpenChange: (open) => !open && setDeleteId(null),
2594
- children: /* @__PURE__ */ jsxs8(AlertDialogContent4, { children: [
2595
- /* @__PURE__ */ jsxs8(AlertDialogHeader4, { children: [
2596
- /* @__PURE__ */ jsx9(AlertDialogTitle4, { children: "Excluir ferramenta?" }),
2597
- /* @__PURE__ */ jsx9(AlertDialogDescription4, { children: "Esta a\xE7\xE3o n\xE3o pode ser desfeita. A ferramenta ser\xE1 removida permanentemente." })
2803
+ children: /* @__PURE__ */ jsxs10(AlertDialogContent4, { children: [
2804
+ /* @__PURE__ */ jsxs10(AlertDialogHeader4, { children: [
2805
+ /* @__PURE__ */ jsx12(AlertDialogTitle4, { children: "Excluir ferramenta?" }),
2806
+ /* @__PURE__ */ jsx12(AlertDialogDescription4, { children: "Esta a\xE7\xE3o n\xE3o pode ser desfeita. A ferramenta ser\xE1 removida permanentemente." })
2598
2807
  ] }),
2599
- /* @__PURE__ */ jsxs8(AlertDialogFooter4, { children: [
2600
- /* @__PURE__ */ jsx9(AlertDialogCancel4, { variant: "outline", size: "default", children: "Cancelar" }),
2601
- /* @__PURE__ */ jsx9(
2808
+ /* @__PURE__ */ jsxs10(AlertDialogFooter4, { children: [
2809
+ /* @__PURE__ */ jsx12(AlertDialogCancel4, { variant: "outline", size: "default", children: "Cancelar" }),
2810
+ /* @__PURE__ */ jsx12(
2602
2811
  AlertDialogAction4,
2603
2812
  {
2604
2813
  variant: "default",
@@ -2616,16 +2825,16 @@ function ToolsTable({ onEdit, config }) {
2616
2825
  }
2617
2826
 
2618
2827
  // src/components/tools/tool-form-dialog.tsx
2619
- import { useState as useState9 } from "react";
2828
+ import { useState as useState10 } from "react";
2620
2829
  import {
2621
2830
  Dialog as Dialog5,
2622
2831
  DialogContent as DialogContent5,
2623
2832
  DialogHeader as DialogHeader5,
2624
2833
  DialogTitle as DialogTitle5,
2625
2834
  DialogFooter as DialogFooter5,
2626
- Button as Button8,
2835
+ Button as Button9,
2627
2836
  Input as Input8,
2628
- Textarea as Textarea4,
2837
+ Textarea as Textarea3,
2629
2838
  Label as Label5,
2630
2839
  Select as Select2,
2631
2840
  SelectContent as SelectContent2,
@@ -2635,7 +2844,7 @@ import {
2635
2844
  } from "@greatapps/greatauth-ui/ui";
2636
2845
  import { Loader2 as Loader24 } from "lucide-react";
2637
2846
  import { toast as toast8 } from "sonner";
2638
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
2847
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
2639
2848
  var TOOL_AUTH_TYPES = [
2640
2849
  { value: "none", label: "Nenhuma" },
2641
2850
  { value: "api_key", label: "API Key" },
@@ -2682,9 +2891,9 @@ function ToolFormDialog({
2682
2891
  const isEditing = !!tool;
2683
2892
  const createTool = useCreateTool(config);
2684
2893
  const updateTool = useUpdateTool(config);
2685
- const [form, setForm] = useState9(() => toolToFormState(tool));
2686
- const [slugManuallyEdited, setSlugManuallyEdited] = useState9(false);
2687
- const [lastResetKey, setLastResetKey] = useState9(
2894
+ const [form, setForm] = useState10(() => toolToFormState(tool));
2895
+ const [slugManuallyEdited, setSlugManuallyEdited] = useState10(false);
2896
+ const [lastResetKey, setLastResetKey] = useState10(
2688
2897
  () => `${tool?.id}-${open}`
2689
2898
  );
2690
2899
  const resetKey = `${tool?.id}-${open}`;
@@ -2745,12 +2954,12 @@ function ToolFormDialog({
2745
2954
  );
2746
2955
  }
2747
2956
  }
2748
- return /* @__PURE__ */ jsx10(Dialog5, { open, onOpenChange, children: /* @__PURE__ */ jsxs9(DialogContent5, { className: "sm:max-w-lg", children: [
2749
- /* @__PURE__ */ jsx10(DialogHeader5, { children: /* @__PURE__ */ jsx10(DialogTitle5, { children: isEditing ? "Editar Ferramenta" : "Nova Ferramenta" }) }),
2750
- /* @__PURE__ */ jsxs9("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
2751
- /* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
2752
- /* @__PURE__ */ jsx10(Label5, { htmlFor: "tool-name", children: "Nome *" }),
2753
- /* @__PURE__ */ jsx10(
2957
+ return /* @__PURE__ */ jsx13(Dialog5, { open, onOpenChange, children: /* @__PURE__ */ jsxs11(DialogContent5, { className: "sm:max-w-lg", children: [
2958
+ /* @__PURE__ */ jsx13(DialogHeader5, { children: /* @__PURE__ */ jsx13(DialogTitle5, { children: isEditing ? "Editar Ferramenta" : "Nova Ferramenta" }) }),
2959
+ /* @__PURE__ */ jsxs11("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
2960
+ /* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
2961
+ /* @__PURE__ */ jsx13(Label5, { htmlFor: "tool-name", children: "Nome *" }),
2962
+ /* @__PURE__ */ jsx13(
2754
2963
  Input8,
2755
2964
  {
2756
2965
  id: "tool-name",
@@ -2768,11 +2977,11 @@ function ToolFormDialog({
2768
2977
  disabled: isPending
2769
2978
  }
2770
2979
  ),
2771
- form.nameError && /* @__PURE__ */ jsx10("p", { className: "text-sm text-destructive", children: "Nome \xE9 obrigat\xF3rio" })
2980
+ form.nameError && /* @__PURE__ */ jsx13("p", { className: "text-sm text-destructive", children: "Nome \xE9 obrigat\xF3rio" })
2772
2981
  ] }),
2773
- /* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
2774
- /* @__PURE__ */ jsx10(Label5, { htmlFor: "tool-slug", children: "Slug (identificador \xFAnico) *" }),
2775
- /* @__PURE__ */ jsx10(
2982
+ /* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
2983
+ /* @__PURE__ */ jsx13(Label5, { htmlFor: "tool-slug", children: "Slug (identificador \xFAnico) *" }),
2984
+ /* @__PURE__ */ jsx13(
2776
2985
  Input8,
2777
2986
  {
2778
2987
  id: "tool-slug",
@@ -2789,12 +2998,12 @@ function ToolFormDialog({
2789
2998
  disabled: isPending
2790
2999
  }
2791
3000
  ),
2792
- /* @__PURE__ */ jsx10("p", { className: "text-xs text-muted-foreground", children: "Gerado automaticamente a partir do nome. Usado internamente para identificar a ferramenta." }),
2793
- form.slugError && /* @__PURE__ */ jsx10("p", { className: "text-sm text-destructive", children: "Slug \xE9 obrigat\xF3rio" })
3001
+ /* @__PURE__ */ jsx13("p", { className: "text-xs text-muted-foreground", children: "Gerado automaticamente a partir do nome. Usado internamente para identificar a ferramenta." }),
3002
+ form.slugError && /* @__PURE__ */ jsx13("p", { className: "text-sm text-destructive", children: "Slug \xE9 obrigat\xF3rio" })
2794
3003
  ] }),
2795
- /* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
2796
- /* @__PURE__ */ jsx10(Label5, { htmlFor: "tool-type", children: "Tipo de Autentica\xE7\xE3o *" }),
2797
- /* @__PURE__ */ jsxs9(
3004
+ /* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
3005
+ /* @__PURE__ */ jsx13(Label5, { htmlFor: "tool-type", children: "Tipo de Autentica\xE7\xE3o *" }),
3006
+ /* @__PURE__ */ jsxs11(
2798
3007
  Select2,
2799
3008
  {
2800
3009
  value: form.type,
@@ -2807,18 +3016,18 @@ function ToolFormDialog({
2807
3016
  },
2808
3017
  disabled: isPending,
2809
3018
  children: [
2810
- /* @__PURE__ */ jsx10(SelectTrigger2, { id: "tool-type", children: /* @__PURE__ */ jsx10(SelectValue2, { placeholder: "Selecione o tipo" }) }),
2811
- /* @__PURE__ */ jsx10(SelectContent2, { children: TOOL_AUTH_TYPES.map((t) => /* @__PURE__ */ jsx10(SelectItem2, { value: t.value, children: t.label }, t.value)) })
3019
+ /* @__PURE__ */ jsx13(SelectTrigger2, { id: "tool-type", children: /* @__PURE__ */ jsx13(SelectValue2, { placeholder: "Selecione o tipo" }) }),
3020
+ /* @__PURE__ */ jsx13(SelectContent2, { children: TOOL_AUTH_TYPES.map((t) => /* @__PURE__ */ jsx13(SelectItem2, { value: t.value, children: t.label }, t.value)) })
2812
3021
  ]
2813
3022
  }
2814
3023
  ),
2815
- /* @__PURE__ */ jsx10("p", { className: "text-xs text-muted-foreground", children: "Define se a ferramenta requer credenciais para funcionar." }),
2816
- form.typeError && /* @__PURE__ */ jsx10("p", { className: "text-sm text-destructive", children: "Tipo \xE9 obrigat\xF3rio" })
3024
+ /* @__PURE__ */ jsx13("p", { className: "text-xs text-muted-foreground", children: "Define se a ferramenta requer credenciais para funcionar." }),
3025
+ form.typeError && /* @__PURE__ */ jsx13("p", { className: "text-sm text-destructive", children: "Tipo \xE9 obrigat\xF3rio" })
2817
3026
  ] }),
2818
- /* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
2819
- /* @__PURE__ */ jsx10(Label5, { htmlFor: "tool-description", children: "Descri\xE7\xE3o" }),
2820
- /* @__PURE__ */ jsx10(
2821
- Textarea4,
3027
+ /* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
3028
+ /* @__PURE__ */ jsx13(Label5, { htmlFor: "tool-description", children: "Descri\xE7\xE3o" }),
3029
+ /* @__PURE__ */ jsx13(
3030
+ Textarea3,
2822
3031
  {
2823
3032
  id: "tool-description",
2824
3033
  value: form.description,
@@ -2829,10 +3038,10 @@ function ToolFormDialog({
2829
3038
  }
2830
3039
  )
2831
3040
  ] }),
2832
- /* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
2833
- /* @__PURE__ */ jsx10(Label5, { htmlFor: "tool-function-defs", children: "Defini\xE7\xF5es de Fun\xE7\xE3o (JSON)" }),
2834
- /* @__PURE__ */ jsx10(
2835
- Textarea4,
3041
+ /* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
3042
+ /* @__PURE__ */ jsx13(Label5, { htmlFor: "tool-function-defs", children: "Defini\xE7\xF5es de Fun\xE7\xE3o (JSON)" }),
3043
+ /* @__PURE__ */ jsx13(
3044
+ Textarea3,
2836
3045
  {
2837
3046
  id: "tool-function-defs",
2838
3047
  value: form.functionDefinitions,
@@ -2862,12 +3071,12 @@ function ToolFormDialog({
2862
3071
  disabled: isPending
2863
3072
  }
2864
3073
  ),
2865
- /* @__PURE__ */ jsx10("p", { className: "text-xs text-muted-foreground", children: "Array de defini\xE7\xF5es no formato OpenAI Function Calling." }),
2866
- form.jsonError && /* @__PURE__ */ jsx10("p", { className: "text-sm text-destructive", children: "JSON inv\xE1lido" })
3074
+ /* @__PURE__ */ jsx13("p", { className: "text-xs text-muted-foreground", children: "Array de defini\xE7\xF5es no formato OpenAI Function Calling." }),
3075
+ form.jsonError && /* @__PURE__ */ jsx13("p", { className: "text-sm text-destructive", children: "JSON inv\xE1lido" })
2867
3076
  ] }),
2868
- /* @__PURE__ */ jsxs9(DialogFooter5, { children: [
2869
- /* @__PURE__ */ jsx10(
2870
- Button8,
3077
+ /* @__PURE__ */ jsxs11(DialogFooter5, { children: [
3078
+ /* @__PURE__ */ jsx13(
3079
+ Button9,
2871
3080
  {
2872
3081
  type: "button",
2873
3082
  variant: "outline",
@@ -2876,8 +3085,8 @@ function ToolFormDialog({
2876
3085
  children: "Cancelar"
2877
3086
  }
2878
3087
  ),
2879
- /* @__PURE__ */ jsxs9(Button8, { type: "submit", disabled: isPending, children: [
2880
- isPending ? /* @__PURE__ */ jsx10(Loader24, { className: "mr-2 h-4 w-4 animate-spin" }) : null,
3088
+ /* @__PURE__ */ jsxs11(Button9, { type: "submit", disabled: isPending, children: [
3089
+ isPending ? /* @__PURE__ */ jsx13(Loader24, { className: "mr-2 h-4 w-4 animate-spin" }) : null,
2881
3090
  isEditing ? "Salvar" : "Criar"
2882
3091
  ] })
2883
3092
  ] })
@@ -2886,12 +3095,12 @@ function ToolFormDialog({
2886
3095
  }
2887
3096
 
2888
3097
  // src/components/tools/tool-credentials-form.tsx
2889
- import { useMemo as useMemo5, useState as useState10 } from "react";
3098
+ import { useMemo as useMemo5, useState as useState11 } from "react";
2890
3099
  import { DataTable as DataTable3 } from "@greatapps/greatauth-ui";
2891
3100
  import {
2892
3101
  Input as Input9,
2893
- Button as Button9,
2894
- Badge as Badge6,
3102
+ Button as Button10,
3103
+ Badge as Badge7,
2895
3104
  Tooltip as Tooltip3,
2896
3105
  TooltipTrigger as TooltipTrigger3,
2897
3106
  TooltipContent as TooltipContent3,
@@ -2918,7 +3127,7 @@ import { Trash2 as Trash25, Pencil as Pencil4, Link, Search as Search3 } from "l
2918
3127
  import { format as format3 } from "date-fns";
2919
3128
  import { ptBR as ptBR3 } from "date-fns/locale";
2920
3129
  import { toast as toast9 } from "sonner";
2921
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
3130
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2922
3131
  function formatDate2(dateStr) {
2923
3132
  if (!dateStr) return "Sem expira\xE7\xE3o";
2924
3133
  return format3(new Date(dateStr), "dd/MM/yyyy", { locale: ptBR3 });
@@ -2938,18 +3147,18 @@ function useColumns3(tools, onEdit, onConnect, onRemove) {
2938
3147
  {
2939
3148
  accessorKey: "label",
2940
3149
  header: "Label",
2941
- cell: ({ row }) => /* @__PURE__ */ jsx11("span", { className: "font-medium", children: row.original.label || "\u2014" })
3150
+ cell: ({ row }) => /* @__PURE__ */ jsx14("span", { className: "font-medium", children: row.original.label || "\u2014" })
2942
3151
  },
2943
3152
  {
2944
3153
  accessorKey: "id_tool",
2945
3154
  header: "Ferramenta",
2946
- cell: ({ row }) => /* @__PURE__ */ jsx11("span", { className: "text-sm", children: getToolName(row.original.id_tool) })
3155
+ cell: ({ row }) => /* @__PURE__ */ jsx14("span", { className: "text-sm", children: getToolName(row.original.id_tool) })
2947
3156
  },
2948
3157
  {
2949
3158
  accessorKey: "status",
2950
3159
  header: "Status",
2951
- cell: ({ row }) => /* @__PURE__ */ jsx11(
2952
- Badge6,
3160
+ cell: ({ row }) => /* @__PURE__ */ jsx14(
3161
+ Badge7,
2953
3162
  {
2954
3163
  variant: row.original.status === "active" ? "default" : "destructive",
2955
3164
  children: row.original.status === "active" ? "Ativo" : "Expirado"
@@ -2959,57 +3168,57 @@ function useColumns3(tools, onEdit, onConnect, onRemove) {
2959
3168
  {
2960
3169
  accessorKey: "expires_at",
2961
3170
  header: "Expira em",
2962
- cell: ({ row }) => /* @__PURE__ */ jsx11("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.expires_at) })
3171
+ cell: ({ row }) => /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.expires_at) })
2963
3172
  },
2964
3173
  {
2965
3174
  accessorKey: "datetime_add",
2966
3175
  header: "Criado em",
2967
- cell: ({ row }) => /* @__PURE__ */ jsx11("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.datetime_add) })
3176
+ cell: ({ row }) => /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.datetime_add) })
2968
3177
  },
2969
3178
  {
2970
3179
  id: "actions",
2971
3180
  header: "A\xE7\xF5es",
2972
3181
  size: 100,
2973
3182
  enableSorting: false,
2974
- cell: ({ row }) => /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
2975
- getToolType(row.original.id_tool) === "oauth2" && /* @__PURE__ */ jsxs10(Tooltip3, { children: [
2976
- /* @__PURE__ */ jsx11(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx11(
2977
- Button9,
3183
+ cell: ({ row }) => /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
3184
+ getToolType(row.original.id_tool) === "oauth2" && /* @__PURE__ */ jsxs12(Tooltip3, { children: [
3185
+ /* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14(
3186
+ Button10,
2978
3187
  {
2979
3188
  variant: "ghost",
2980
3189
  size: "icon",
2981
3190
  className: "h-8 w-8",
2982
3191
  disabled: true,
2983
- children: /* @__PURE__ */ jsx11(Link, { className: "h-4 w-4" })
3192
+ children: /* @__PURE__ */ jsx14(Link, { className: "h-4 w-4" })
2984
3193
  }
2985
3194
  ) }),
2986
- /* @__PURE__ */ jsx11(TooltipContent3, { children: "Em breve" })
3195
+ /* @__PURE__ */ jsx14(TooltipContent3, { children: "Em breve" })
2987
3196
  ] }),
2988
- /* @__PURE__ */ jsxs10(Tooltip3, { children: [
2989
- /* @__PURE__ */ jsx11(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx11(
2990
- Button9,
3197
+ /* @__PURE__ */ jsxs12(Tooltip3, { children: [
3198
+ /* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14(
3199
+ Button10,
2991
3200
  {
2992
3201
  variant: "ghost",
2993
3202
  size: "icon",
2994
3203
  className: "h-8 w-8",
2995
3204
  onClick: () => onEdit(row.original),
2996
- children: /* @__PURE__ */ jsx11(Pencil4, { className: "h-4 w-4" })
3205
+ children: /* @__PURE__ */ jsx14(Pencil4, { className: "h-4 w-4" })
2997
3206
  }
2998
3207
  ) }),
2999
- /* @__PURE__ */ jsx11(TooltipContent3, { children: "Editar" })
3208
+ /* @__PURE__ */ jsx14(TooltipContent3, { children: "Editar" })
3000
3209
  ] }),
3001
- /* @__PURE__ */ jsxs10(Tooltip3, { children: [
3002
- /* @__PURE__ */ jsx11(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx11(
3003
- Button9,
3210
+ /* @__PURE__ */ jsxs12(Tooltip3, { children: [
3211
+ /* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14(
3212
+ Button10,
3004
3213
  {
3005
3214
  variant: "ghost",
3006
3215
  size: "icon",
3007
3216
  className: "h-8 w-8 text-destructive hover:text-destructive",
3008
3217
  onClick: () => onRemove(row.original),
3009
- children: /* @__PURE__ */ jsx11(Trash25, { className: "h-4 w-4" })
3218
+ children: /* @__PURE__ */ jsx14(Trash25, { className: "h-4 w-4" })
3010
3219
  }
3011
3220
  ) }),
3012
- /* @__PURE__ */ jsx11(TooltipContent3, { children: "Remover" })
3221
+ /* @__PURE__ */ jsx14(TooltipContent3, { children: "Remover" })
3013
3222
  ] })
3014
3223
  ] })
3015
3224
  }
@@ -3028,25 +3237,25 @@ function ToolCredentialsForm({
3028
3237
  const deleteMutation = useDeleteToolCredential(config);
3029
3238
  const { data: toolsData } = useTools(config);
3030
3239
  const tools = toolsData?.data || [];
3031
- const [search, setSearch] = useState10("");
3032
- const [internalCreateOpen, setInternalCreateOpen] = useState10(false);
3240
+ const [search, setSearch] = useState11("");
3241
+ const [internalCreateOpen, setInternalCreateOpen] = useState11(false);
3033
3242
  const showCreateDialog = externalCreateOpen ?? internalCreateOpen;
3034
3243
  const setShowCreateDialog = onCreateOpenChange ?? setInternalCreateOpen;
3035
- const [createForm, setCreateForm] = useState10({
3244
+ const [createForm, setCreateForm] = useState11({
3036
3245
  id_tool: "",
3037
3246
  label: "",
3038
3247
  credentials_encrypted: "",
3039
3248
  expires_at: ""
3040
3249
  });
3041
- const [editTarget, setEditTarget] = useState10(null);
3042
- const [editForm, setEditForm] = useState10({
3250
+ const [editTarget, setEditTarget] = useState11(null);
3251
+ const [editForm, setEditForm] = useState11({
3043
3252
  id_tool: "",
3044
3253
  label: "",
3045
3254
  credentials_encrypted: "",
3046
3255
  expires_at: "",
3047
3256
  status: ""
3048
3257
  });
3049
- const [removeTarget, setRemoveTarget] = useState10(null);
3258
+ const [removeTarget, setRemoveTarget] = useState11(null);
3050
3259
  const filteredCredentials = useMemo5(() => {
3051
3260
  if (!search) return credentials;
3052
3261
  const term = search.toLowerCase();
@@ -3152,10 +3361,10 @@ function ToolCredentialsForm({
3152
3361
  const url = `${gagentsApiUrl}/v1/${language}/${idWl}/accounts/${config.accountId}/oauth/connect?id_tool=${cred.id_tool}`;
3153
3362
  window.open(url, "_blank");
3154
3363
  }
3155
- return /* @__PURE__ */ jsxs10("div", { className: "space-y-4", children: [
3156
- /* @__PURE__ */ jsx11("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs10("div", { className: "relative flex-1 max-w-md", children: [
3157
- /* @__PURE__ */ jsx11(Search3, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
3158
- /* @__PURE__ */ jsx11(
3364
+ return /* @__PURE__ */ jsxs12("div", { className: "space-y-4", children: [
3365
+ /* @__PURE__ */ jsx14("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs12("div", { className: "relative flex-1 max-w-md", children: [
3366
+ /* @__PURE__ */ jsx14(Search3, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
3367
+ /* @__PURE__ */ jsx14(
3159
3368
  Input9,
3160
3369
  {
3161
3370
  placeholder: "Buscar credenciais...",
@@ -3165,7 +3374,7 @@ function ToolCredentialsForm({
3165
3374
  }
3166
3375
  )
3167
3376
  ] }) }),
3168
- /* @__PURE__ */ jsx11(
3377
+ /* @__PURE__ */ jsx14(
3169
3378
  DataTable3,
3170
3379
  {
3171
3380
  columns,
@@ -3174,26 +3383,26 @@ function ToolCredentialsForm({
3174
3383
  emptyMessage: "Nenhuma credencial encontrada"
3175
3384
  }
3176
3385
  ),
3177
- /* @__PURE__ */ jsx11(Dialog6, { open: showCreateDialog, onOpenChange: setShowCreateDialog, children: /* @__PURE__ */ jsxs10(DialogContent6, { children: [
3178
- /* @__PURE__ */ jsx11(DialogHeader6, { children: /* @__PURE__ */ jsx11(DialogTitle6, { children: "Nova Credencial" }) }),
3179
- /* @__PURE__ */ jsxs10("div", { className: "space-y-4", children: [
3180
- /* @__PURE__ */ jsxs10("div", { children: [
3181
- /* @__PURE__ */ jsx11("label", { className: "mb-1 block text-sm font-medium", children: "Ferramenta *" }),
3182
- /* @__PURE__ */ jsxs10(
3386
+ /* @__PURE__ */ jsx14(Dialog6, { open: showCreateDialog, onOpenChange: setShowCreateDialog, children: /* @__PURE__ */ jsxs12(DialogContent6, { children: [
3387
+ /* @__PURE__ */ jsx14(DialogHeader6, { children: /* @__PURE__ */ jsx14(DialogTitle6, { children: "Nova Credencial" }) }),
3388
+ /* @__PURE__ */ jsxs12("div", { className: "space-y-4", children: [
3389
+ /* @__PURE__ */ jsxs12("div", { children: [
3390
+ /* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Ferramenta *" }),
3391
+ /* @__PURE__ */ jsxs12(
3183
3392
  Select3,
3184
3393
  {
3185
3394
  value: createForm.id_tool,
3186
3395
  onValueChange: (val) => setCreateForm((f) => ({ ...f, id_tool: val })),
3187
3396
  children: [
3188
- /* @__PURE__ */ jsx11(SelectTrigger3, { children: /* @__PURE__ */ jsx11(SelectValue3, { placeholder: "Selecione a ferramenta" }) }),
3189
- /* @__PURE__ */ jsx11(SelectContent3, { children: tools.map((tool) => /* @__PURE__ */ jsx11(SelectItem3, { value: String(tool.id), children: tool.name }, tool.id)) })
3397
+ /* @__PURE__ */ jsx14(SelectTrigger3, { children: /* @__PURE__ */ jsx14(SelectValue3, { placeholder: "Selecione a ferramenta" }) }),
3398
+ /* @__PURE__ */ jsx14(SelectContent3, { children: tools.map((tool) => /* @__PURE__ */ jsx14(SelectItem3, { value: String(tool.id), children: tool.name }, tool.id)) })
3190
3399
  ]
3191
3400
  }
3192
3401
  )
3193
3402
  ] }),
3194
- /* @__PURE__ */ jsxs10("div", { children: [
3195
- /* @__PURE__ */ jsx11("label", { className: "mb-1 block text-sm font-medium", children: "Label *" }),
3196
- /* @__PURE__ */ jsx11(
3403
+ /* @__PURE__ */ jsxs12("div", { children: [
3404
+ /* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Label *" }),
3405
+ /* @__PURE__ */ jsx14(
3197
3406
  Input9,
3198
3407
  {
3199
3408
  value: createForm.label,
@@ -3202,9 +3411,9 @@ function ToolCredentialsForm({
3202
3411
  }
3203
3412
  )
3204
3413
  ] }),
3205
- /* @__PURE__ */ jsxs10("div", { children: [
3206
- /* @__PURE__ */ jsx11("label", { className: "mb-1 block text-sm font-medium", children: "Credencial *" }),
3207
- /* @__PURE__ */ jsx11(
3414
+ /* @__PURE__ */ jsxs12("div", { children: [
3415
+ /* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Credencial *" }),
3416
+ /* @__PURE__ */ jsx14(
3208
3417
  Input9,
3209
3418
  {
3210
3419
  type: "password",
@@ -3217,9 +3426,9 @@ function ToolCredentialsForm({
3217
3426
  }
3218
3427
  )
3219
3428
  ] }),
3220
- /* @__PURE__ */ jsxs10("div", { children: [
3221
- /* @__PURE__ */ jsx11("label", { className: "mb-1 block text-sm font-medium", children: "Data de Expira\xE7\xE3o (opcional)" }),
3222
- /* @__PURE__ */ jsx11(
3429
+ /* @__PURE__ */ jsxs12("div", { children: [
3430
+ /* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Data de Expira\xE7\xE3o (opcional)" }),
3431
+ /* @__PURE__ */ jsx14(
3223
3432
  Input9,
3224
3433
  {
3225
3434
  type: "date",
@@ -3229,17 +3438,17 @@ function ToolCredentialsForm({
3229
3438
  )
3230
3439
  ] })
3231
3440
  ] }),
3232
- /* @__PURE__ */ jsxs10(DialogFooter6, { children: [
3233
- /* @__PURE__ */ jsx11(
3234
- Button9,
3441
+ /* @__PURE__ */ jsxs12(DialogFooter6, { children: [
3442
+ /* @__PURE__ */ jsx14(
3443
+ Button10,
3235
3444
  {
3236
3445
  variant: "outline",
3237
3446
  onClick: () => setShowCreateDialog(false),
3238
3447
  children: "Cancelar"
3239
3448
  }
3240
3449
  ),
3241
- /* @__PURE__ */ jsx11(
3242
- Button9,
3450
+ /* @__PURE__ */ jsx14(
3451
+ Button10,
3243
3452
  {
3244
3453
  onClick: handleCreate,
3245
3454
  disabled: !createForm.id_tool || !createForm.label.trim() || !createForm.credentials_encrypted.trim() || createMutation.isPending,
@@ -3248,31 +3457,31 @@ function ToolCredentialsForm({
3248
3457
  )
3249
3458
  ] })
3250
3459
  ] }) }),
3251
- /* @__PURE__ */ jsx11(
3460
+ /* @__PURE__ */ jsx14(
3252
3461
  Dialog6,
3253
3462
  {
3254
3463
  open: !!editTarget,
3255
3464
  onOpenChange: (open) => !open && setEditTarget(null),
3256
- children: /* @__PURE__ */ jsxs10(DialogContent6, { children: [
3257
- /* @__PURE__ */ jsx11(DialogHeader6, { children: /* @__PURE__ */ jsx11(DialogTitle6, { children: "Editar Credencial" }) }),
3258
- /* @__PURE__ */ jsxs10("div", { className: "space-y-4", children: [
3259
- /* @__PURE__ */ jsxs10("div", { children: [
3260
- /* @__PURE__ */ jsx11("label", { className: "mb-1 block text-sm font-medium", children: "Ferramenta *" }),
3261
- /* @__PURE__ */ jsxs10(
3465
+ children: /* @__PURE__ */ jsxs12(DialogContent6, { children: [
3466
+ /* @__PURE__ */ jsx14(DialogHeader6, { children: /* @__PURE__ */ jsx14(DialogTitle6, { children: "Editar Credencial" }) }),
3467
+ /* @__PURE__ */ jsxs12("div", { className: "space-y-4", children: [
3468
+ /* @__PURE__ */ jsxs12("div", { children: [
3469
+ /* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Ferramenta *" }),
3470
+ /* @__PURE__ */ jsxs12(
3262
3471
  Select3,
3263
3472
  {
3264
3473
  value: editForm.id_tool,
3265
3474
  onValueChange: (val) => setEditForm((f) => ({ ...f, id_tool: val })),
3266
3475
  children: [
3267
- /* @__PURE__ */ jsx11(SelectTrigger3, { children: /* @__PURE__ */ jsx11(SelectValue3, { placeholder: "Selecione a ferramenta" }) }),
3268
- /* @__PURE__ */ jsx11(SelectContent3, { children: tools.map((tool) => /* @__PURE__ */ jsx11(SelectItem3, { value: String(tool.id), children: tool.name }, tool.id)) })
3476
+ /* @__PURE__ */ jsx14(SelectTrigger3, { children: /* @__PURE__ */ jsx14(SelectValue3, { placeholder: "Selecione a ferramenta" }) }),
3477
+ /* @__PURE__ */ jsx14(SelectContent3, { children: tools.map((tool) => /* @__PURE__ */ jsx14(SelectItem3, { value: String(tool.id), children: tool.name }, tool.id)) })
3269
3478
  ]
3270
3479
  }
3271
3480
  )
3272
3481
  ] }),
3273
- /* @__PURE__ */ jsxs10("div", { children: [
3274
- /* @__PURE__ */ jsx11("label", { className: "mb-1 block text-sm font-medium", children: "Label" }),
3275
- /* @__PURE__ */ jsx11(
3482
+ /* @__PURE__ */ jsxs12("div", { children: [
3483
+ /* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Label" }),
3484
+ /* @__PURE__ */ jsx14(
3276
3485
  Input9,
3277
3486
  {
3278
3487
  value: editForm.label,
@@ -3281,9 +3490,9 @@ function ToolCredentialsForm({
3281
3490
  }
3282
3491
  )
3283
3492
  ] }),
3284
- /* @__PURE__ */ jsxs10("div", { children: [
3285
- /* @__PURE__ */ jsx11("label", { className: "mb-1 block text-sm font-medium", children: "Nova Credencial (vazio = manter atual)" }),
3286
- /* @__PURE__ */ jsx11(
3493
+ /* @__PURE__ */ jsxs12("div", { children: [
3494
+ /* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Nova Credencial (vazio = manter atual)" }),
3495
+ /* @__PURE__ */ jsx14(
3287
3496
  Input9,
3288
3497
  {
3289
3498
  type: "password",
@@ -3296,9 +3505,9 @@ function ToolCredentialsForm({
3296
3505
  }
3297
3506
  )
3298
3507
  ] }),
3299
- /* @__PURE__ */ jsxs10("div", { children: [
3300
- /* @__PURE__ */ jsx11("label", { className: "mb-1 block text-sm font-medium", children: "Data de Expira\xE7\xE3o" }),
3301
- /* @__PURE__ */ jsx11(
3508
+ /* @__PURE__ */ jsxs12("div", { children: [
3509
+ /* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Data de Expira\xE7\xE3o" }),
3510
+ /* @__PURE__ */ jsx14(
3302
3511
  Input9,
3303
3512
  {
3304
3513
  type: "date",
@@ -3307,9 +3516,9 @@ function ToolCredentialsForm({
3307
3516
  }
3308
3517
  )
3309
3518
  ] }),
3310
- /* @__PURE__ */ jsxs10("div", { children: [
3311
- /* @__PURE__ */ jsx11("label", { className: "mb-1 block text-sm font-medium", children: "Status" }),
3312
- /* @__PURE__ */ jsxs10(
3519
+ /* @__PURE__ */ jsxs12("div", { children: [
3520
+ /* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Status" }),
3521
+ /* @__PURE__ */ jsxs12(
3313
3522
  Select3,
3314
3523
  {
3315
3524
  value: editForm.status || void 0,
@@ -3318,20 +3527,20 @@ function ToolCredentialsForm({
3318
3527
  status: val
3319
3528
  })),
3320
3529
  children: [
3321
- /* @__PURE__ */ jsx11(SelectTrigger3, { children: /* @__PURE__ */ jsx11(SelectValue3, {}) }),
3322
- /* @__PURE__ */ jsxs10(SelectContent3, { children: [
3323
- /* @__PURE__ */ jsx11(SelectItem3, { value: "active", children: "Ativo" }),
3324
- /* @__PURE__ */ jsx11(SelectItem3, { value: "expired", children: "Expirado" })
3530
+ /* @__PURE__ */ jsx14(SelectTrigger3, { children: /* @__PURE__ */ jsx14(SelectValue3, {}) }),
3531
+ /* @__PURE__ */ jsxs12(SelectContent3, { children: [
3532
+ /* @__PURE__ */ jsx14(SelectItem3, { value: "active", children: "Ativo" }),
3533
+ /* @__PURE__ */ jsx14(SelectItem3, { value: "expired", children: "Expirado" })
3325
3534
  ] })
3326
3535
  ]
3327
3536
  }
3328
3537
  )
3329
3538
  ] })
3330
3539
  ] }),
3331
- /* @__PURE__ */ jsxs10(DialogFooter6, { children: [
3332
- /* @__PURE__ */ jsx11(Button9, { variant: "outline", onClick: () => setEditTarget(null), children: "Cancelar" }),
3333
- /* @__PURE__ */ jsx11(
3334
- Button9,
3540
+ /* @__PURE__ */ jsxs12(DialogFooter6, { children: [
3541
+ /* @__PURE__ */ jsx14(Button10, { variant: "outline", onClick: () => setEditTarget(null), children: "Cancelar" }),
3542
+ /* @__PURE__ */ jsx14(
3543
+ Button10,
3335
3544
  {
3336
3545
  onClick: handleSaveEdit,
3337
3546
  disabled: updateMutation.isPending,
@@ -3342,19 +3551,19 @@ function ToolCredentialsForm({
3342
3551
  ] })
3343
3552
  }
3344
3553
  ),
3345
- /* @__PURE__ */ jsx11(
3554
+ /* @__PURE__ */ jsx14(
3346
3555
  AlertDialog5,
3347
3556
  {
3348
3557
  open: !!removeTarget,
3349
3558
  onOpenChange: (open) => !open && setRemoveTarget(null),
3350
- children: /* @__PURE__ */ jsxs10(AlertDialogContent5, { children: [
3351
- /* @__PURE__ */ jsxs10(AlertDialogHeader5, { children: [
3352
- /* @__PURE__ */ jsx11(AlertDialogTitle5, { children: "Remover credencial?" }),
3353
- /* @__PURE__ */ jsx11(AlertDialogDescription5, { children: "A credencial ser\xE1 removida permanentemente." })
3559
+ children: /* @__PURE__ */ jsxs12(AlertDialogContent5, { children: [
3560
+ /* @__PURE__ */ jsxs12(AlertDialogHeader5, { children: [
3561
+ /* @__PURE__ */ jsx14(AlertDialogTitle5, { children: "Remover credencial?" }),
3562
+ /* @__PURE__ */ jsx14(AlertDialogDescription5, { children: "A credencial ser\xE1 removida permanentemente." })
3354
3563
  ] }),
3355
- /* @__PURE__ */ jsxs10(AlertDialogFooter5, { children: [
3356
- /* @__PURE__ */ jsx11(AlertDialogCancel5, { children: "Cancelar" }),
3357
- /* @__PURE__ */ jsx11(
3564
+ /* @__PURE__ */ jsxs12(AlertDialogFooter5, { children: [
3565
+ /* @__PURE__ */ jsx14(AlertDialogCancel5, { children: "Cancelar" }),
3566
+ /* @__PURE__ */ jsx14(
3358
3567
  AlertDialogAction5,
3359
3568
  {
3360
3569
  onClick: handleRemove,
@@ -3370,30 +3579,30 @@ function ToolCredentialsForm({
3370
3579
  }
3371
3580
 
3372
3581
  // src/pages/agents-page.tsx
3373
- import { useState as useState11 } from "react";
3374
- import { Button as Button10 } from "@greatapps/greatauth-ui/ui";
3582
+ import { useState as useState12 } from "react";
3583
+ import { Button as Button11 } from "@greatapps/greatauth-ui/ui";
3375
3584
  import { Plus as Plus3 } from "lucide-react";
3376
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
3585
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3377
3586
  function AgentsPage({
3378
3587
  config,
3379
3588
  onNavigateToAgent,
3380
3589
  title = "Agentes AI",
3381
3590
  subtitle = "Gerencie seus agentes de atendimento inteligente"
3382
3591
  }) {
3383
- const [createOpen, setCreateOpen] = useState11(false);
3384
- return /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-4 p-4", children: [
3385
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
3386
- /* @__PURE__ */ jsxs11("div", { children: [
3387
- /* @__PURE__ */ jsx12("h1", { className: "text-xl font-semibold", children: title }),
3388
- /* @__PURE__ */ jsx12("p", { className: "text-sm text-muted-foreground", children: subtitle })
3592
+ const [createOpen, setCreateOpen] = useState12(false);
3593
+ return /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-4 p-4", children: [
3594
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between", children: [
3595
+ /* @__PURE__ */ jsxs13("div", { children: [
3596
+ /* @__PURE__ */ jsx15("h1", { className: "text-xl font-semibold", children: title }),
3597
+ /* @__PURE__ */ jsx15("p", { className: "text-sm text-muted-foreground", children: subtitle })
3389
3598
  ] }),
3390
- /* @__PURE__ */ jsxs11(Button10, { onClick: () => setCreateOpen(true), size: "sm", children: [
3391
- /* @__PURE__ */ jsx12(Plus3, { className: "mr-2 h-4 w-4" }),
3599
+ /* @__PURE__ */ jsxs13(Button11, { onClick: () => setCreateOpen(true), size: "sm", children: [
3600
+ /* @__PURE__ */ jsx15(Plus3, { className: "mr-2 h-4 w-4" }),
3392
3601
  "Novo Agente"
3393
3602
  ] })
3394
3603
  ] }),
3395
- /* @__PURE__ */ jsx12(AgentsTable, { config, onNavigateToAgent }),
3396
- /* @__PURE__ */ jsx12(
3604
+ /* @__PURE__ */ jsx15(AgentsTable, { config, onNavigateToAgent }),
3605
+ /* @__PURE__ */ jsx15(
3397
3606
  AgentFormDialog,
3398
3607
  {
3399
3608
  config,
@@ -3405,54 +3614,54 @@ function AgentsPage({
3405
3614
  }
3406
3615
 
3407
3616
  // src/pages/agent-detail-page.tsx
3408
- import { useState as useState12 } from "react";
3409
- import { Badge as Badge7, Button as Button11, Skeleton as Skeleton4 } from "@greatapps/greatauth-ui/ui";
3617
+ import { useState as useState13 } from "react";
3618
+ import { Badge as Badge8, Button as Button12, Skeleton as Skeleton6 } from "@greatapps/greatauth-ui/ui";
3410
3619
  import { EntityAvatar as EntityAvatar2 } from "@greatapps/greatauth-ui";
3411
3620
  import { ArrowLeft, Pencil as Pencil5 } from "lucide-react";
3412
- import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
3621
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
3413
3622
  function AgentDetailPage({
3414
3623
  config,
3415
3624
  agentId,
3416
3625
  onBack,
3417
- renderConversationsTab
3626
+ renderChatLink
3418
3627
  }) {
3419
3628
  const { data: agent, isLoading } = useAgent(config, agentId);
3420
- const [editOpen, setEditOpen] = useState12(false);
3629
+ const [editOpen, setEditOpen] = useState13(false);
3421
3630
  if (isLoading) {
3422
- return /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-4 p-4", children: [
3423
- /* @__PURE__ */ jsx13(Skeleton4, { className: "h-4 w-32" }),
3424
- /* @__PURE__ */ jsx13(Skeleton4, { className: "h-8 w-48" }),
3425
- /* @__PURE__ */ jsx13(Skeleton4, { className: "h-10 w-full" }),
3426
- /* @__PURE__ */ jsx13(Skeleton4, { className: "h-64 w-full" })
3631
+ return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-4 p-4", children: [
3632
+ /* @__PURE__ */ jsx16(Skeleton6, { className: "h-4 w-32" }),
3633
+ /* @__PURE__ */ jsx16(Skeleton6, { className: "h-8 w-48" }),
3634
+ /* @__PURE__ */ jsx16(Skeleton6, { className: "h-10 w-full" }),
3635
+ /* @__PURE__ */ jsx16(Skeleton6, { className: "h-64 w-full" })
3427
3636
  ] });
3428
3637
  }
3429
3638
  if (!agent) {
3430
- return /* @__PURE__ */ jsxs12("div", { className: "flex flex-col items-center justify-center gap-2 p-8", children: [
3431
- /* @__PURE__ */ jsx13("p", { className: "text-muted-foreground", children: "Agente n\xE3o encontrado" }),
3432
- onBack && /* @__PURE__ */ jsxs12(Button11, { variant: "ghost", size: "sm", onClick: onBack, children: [
3433
- /* @__PURE__ */ jsx13(ArrowLeft, { className: "mr-2 h-4 w-4" }),
3639
+ return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center justify-center gap-2 p-8", children: [
3640
+ /* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "Agente n\xE3o encontrado" }),
3641
+ onBack && /* @__PURE__ */ jsxs14(Button12, { variant: "ghost", size: "sm", onClick: onBack, children: [
3642
+ /* @__PURE__ */ jsx16(ArrowLeft, { className: "mr-2 h-4 w-4" }),
3434
3643
  "Voltar para agentes"
3435
3644
  ] })
3436
3645
  ] });
3437
3646
  }
3438
- return /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-6 p-4", children: [
3439
- /* @__PURE__ */ jsx13("div", { className: "rounded-lg border p-4 md:p-6", children: /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-4 md:flex-row md:items-start md:gap-6", children: [
3440
- /* @__PURE__ */ jsxs12("div", { className: "flex items-start gap-3 flex-1", children: [
3441
- onBack && /* @__PURE__ */ jsx13(
3442
- Button11,
3647
+ return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-6 p-4", children: [
3648
+ /* @__PURE__ */ jsx16("div", { className: "rounded-lg border p-4 md:p-6", children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-4 md:flex-row md:items-start md:gap-6", children: [
3649
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-start gap-3 flex-1", children: [
3650
+ onBack && /* @__PURE__ */ jsx16(
3651
+ Button12,
3443
3652
  {
3444
3653
  variant: "ghost",
3445
3654
  size: "icon",
3446
3655
  className: "shrink-0 mt-1",
3447
3656
  onClick: onBack,
3448
- children: /* @__PURE__ */ jsx13(ArrowLeft, { className: "h-4 w-4" })
3657
+ children: /* @__PURE__ */ jsx16(ArrowLeft, { className: "h-4 w-4" })
3449
3658
  }
3450
3659
  ),
3451
- /* @__PURE__ */ jsx13(EntityAvatar2, { photo: agent.photo, name: agent.title, size: "xl" }),
3452
- /* @__PURE__ */ jsx13("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2 flex-wrap", children: [
3453
- /* @__PURE__ */ jsx13("h1", { className: "text-xl font-semibold", children: agent.title }),
3454
- /* @__PURE__ */ jsx13(
3455
- Badge7,
3660
+ /* @__PURE__ */ jsx16(EntityAvatar2, { photo: agent.photo, name: agent.title, size: "xl" }),
3661
+ /* @__PURE__ */ jsx16("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 flex-wrap", children: [
3662
+ /* @__PURE__ */ jsx16("h1", { className: "text-xl font-semibold", children: agent.title }),
3663
+ /* @__PURE__ */ jsx16(
3664
+ Badge8,
3456
3665
  {
3457
3666
  variant: agent.active ? "default" : "destructive",
3458
3667
  className: "text-xs",
@@ -3461,29 +3670,29 @@ function AgentDetailPage({
3461
3670
  )
3462
3671
  ] }) })
3463
3672
  ] }),
3464
- /* @__PURE__ */ jsxs12(
3465
- Button11,
3673
+ /* @__PURE__ */ jsxs14(
3674
+ Button12,
3466
3675
  {
3467
3676
  variant: "outline",
3468
3677
  size: "sm",
3469
3678
  className: "shrink-0 self-start",
3470
3679
  onClick: () => setEditOpen(true),
3471
3680
  children: [
3472
- /* @__PURE__ */ jsx13(Pencil5, { className: "mr-2 h-4 w-4" }),
3681
+ /* @__PURE__ */ jsx16(Pencil5, { className: "mr-2 h-4 w-4" }),
3473
3682
  "Editar"
3474
3683
  ]
3475
3684
  }
3476
3685
  )
3477
3686
  ] }) }),
3478
- /* @__PURE__ */ jsx13(
3687
+ /* @__PURE__ */ jsx16(
3479
3688
  AgentTabs,
3480
3689
  {
3481
3690
  agent,
3482
3691
  config,
3483
- renderConversationsTab
3692
+ renderChatLink
3484
3693
  }
3485
3694
  ),
3486
- editOpen && /* @__PURE__ */ jsx13(
3695
+ editOpen && /* @__PURE__ */ jsx16(
3487
3696
  AgentEditForm,
3488
3697
  {
3489
3698
  agent,
@@ -3497,30 +3706,30 @@ function AgentDetailPage({
3497
3706
  }
3498
3707
 
3499
3708
  // src/pages/tools-page.tsx
3500
- import { useState as useState13 } from "react";
3501
- import { Button as Button12 } from "@greatapps/greatauth-ui/ui";
3709
+ import { useState as useState14 } from "react";
3710
+ import { Button as Button13 } from "@greatapps/greatauth-ui/ui";
3502
3711
  import { Plus as Plus4 } from "lucide-react";
3503
- import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
3712
+ import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
3504
3713
  function ToolsPage({
3505
3714
  config,
3506
3715
  title = "Ferramentas",
3507
3716
  subtitle = "Gerencie as ferramentas dispon\xEDveis para seus agentes"
3508
3717
  }) {
3509
- const [createOpen, setCreateOpen] = useState13(false);
3510
- const [editTool, setEditTool] = useState13(void 0);
3511
- return /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-4 p-4", children: [
3512
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between", children: [
3513
- /* @__PURE__ */ jsxs13("div", { children: [
3514
- /* @__PURE__ */ jsx14("h1", { className: "text-xl font-semibold", children: title }),
3515
- /* @__PURE__ */ jsx14("p", { className: "text-sm text-muted-foreground", children: subtitle })
3718
+ const [createOpen, setCreateOpen] = useState14(false);
3719
+ const [editTool, setEditTool] = useState14(void 0);
3720
+ return /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-4 p-4", children: [
3721
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between", children: [
3722
+ /* @__PURE__ */ jsxs15("div", { children: [
3723
+ /* @__PURE__ */ jsx17("h1", { className: "text-xl font-semibold", children: title }),
3724
+ /* @__PURE__ */ jsx17("p", { className: "text-sm text-muted-foreground", children: subtitle })
3516
3725
  ] }),
3517
- /* @__PURE__ */ jsxs13(Button12, { onClick: () => setCreateOpen(true), size: "sm", children: [
3518
- /* @__PURE__ */ jsx14(Plus4, { className: "mr-2 h-4 w-4" }),
3726
+ /* @__PURE__ */ jsxs15(Button13, { onClick: () => setCreateOpen(true), size: "sm", children: [
3727
+ /* @__PURE__ */ jsx17(Plus4, { className: "mr-2 h-4 w-4" }),
3519
3728
  "Nova Ferramenta"
3520
3729
  ] })
3521
3730
  ] }),
3522
- /* @__PURE__ */ jsx14(ToolsTable, { config, onEdit: (tool) => setEditTool(tool) }),
3523
- /* @__PURE__ */ jsx14(
3731
+ /* @__PURE__ */ jsx17(ToolsTable, { config, onEdit: (tool) => setEditTool(tool) }),
3732
+ /* @__PURE__ */ jsx17(
3524
3733
  ToolFormDialog,
3525
3734
  {
3526
3735
  config,
@@ -3528,7 +3737,7 @@ function ToolsPage({
3528
3737
  onOpenChange: setCreateOpen
3529
3738
  }
3530
3739
  ),
3531
- /* @__PURE__ */ jsx14(
3740
+ /* @__PURE__ */ jsx17(
3532
3741
  ToolFormDialog,
3533
3742
  {
3534
3743
  config,
@@ -3541,10 +3750,10 @@ function ToolsPage({
3541
3750
  }
3542
3751
 
3543
3752
  // src/pages/credentials-page.tsx
3544
- import { useState as useState14 } from "react";
3545
- import { Button as Button13 } from "@greatapps/greatauth-ui/ui";
3753
+ import { useState as useState15 } from "react";
3754
+ import { Button as Button14 } from "@greatapps/greatauth-ui/ui";
3546
3755
  import { Plus as Plus5 } from "lucide-react";
3547
- import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
3756
+ import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
3548
3757
  function CredentialsPage({
3549
3758
  config,
3550
3759
  gagentsApiUrl,
@@ -3552,20 +3761,20 @@ function CredentialsPage({
3552
3761
  subtitle = "Gerencie as credenciais de autentica\xE7\xE3o das ferramentas"
3553
3762
  }) {
3554
3763
  const { data: credentialsData, isLoading: credentialsLoading } = useToolCredentials(config);
3555
- const [createOpen, setCreateOpen] = useState14(false);
3764
+ const [createOpen, setCreateOpen] = useState15(false);
3556
3765
  const credentials = credentialsData?.data || [];
3557
- return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-4 p-4", children: [
3558
- /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between", children: [
3559
- /* @__PURE__ */ jsxs14("div", { children: [
3560
- /* @__PURE__ */ jsx15("h1", { className: "text-xl font-semibold", children: title }),
3561
- /* @__PURE__ */ jsx15("p", { className: "text-sm text-muted-foreground", children: subtitle })
3766
+ return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-4 p-4", children: [
3767
+ /* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-between", children: [
3768
+ /* @__PURE__ */ jsxs16("div", { children: [
3769
+ /* @__PURE__ */ jsx18("h1", { className: "text-xl font-semibold", children: title }),
3770
+ /* @__PURE__ */ jsx18("p", { className: "text-sm text-muted-foreground", children: subtitle })
3562
3771
  ] }),
3563
- /* @__PURE__ */ jsxs14(Button13, { onClick: () => setCreateOpen(true), size: "sm", children: [
3564
- /* @__PURE__ */ jsx15(Plus5, { className: "mr-2 h-4 w-4" }),
3772
+ /* @__PURE__ */ jsxs16(Button14, { onClick: () => setCreateOpen(true), size: "sm", children: [
3773
+ /* @__PURE__ */ jsx18(Plus5, { className: "mr-2 h-4 w-4" }),
3565
3774
  "Nova Credencial"
3566
3775
  ] })
3567
3776
  ] }),
3568
- /* @__PURE__ */ jsx15(
3777
+ /* @__PURE__ */ jsx18(
3569
3778
  ToolCredentialsForm,
3570
3779
  {
3571
3780
  config,
@@ -3579,6 +3788,8 @@ function CredentialsPage({
3579
3788
  ] });
3580
3789
  }
3581
3790
  export {
3791
+ AgentConversationsPanel,
3792
+ AgentConversationsTable,
3582
3793
  AgentDetailPage,
3583
3794
  AgentEditForm,
3584
3795
  AgentFormDialog,
@@ -3588,6 +3799,7 @@ export {
3588
3799
  AgentToolsList,
3589
3800
  AgentsPage,
3590
3801
  AgentsTable,
3802
+ ConversationView,
3591
3803
  CredentialsPage,
3592
3804
  Sortable,
3593
3805
  SortableContent,