@greatapps/greatagents-ui 0.3.6 → 0.3.7

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
@@ -1118,13 +1118,21 @@ function AgentEditForm({ config, agent, idAccount, open, onOpenChange }) {
1118
1118
  return /* @__PURE__ */ jsx3("div", { className: "max-w-lg pt-4", children: formContent });
1119
1119
  }
1120
1120
 
1121
- // src/components/agents/agent-tools-list.tsx
1122
- import { useState as useState4 } from "react";
1121
+ // src/components/agents/agent-objectives-list.tsx
1122
+ import { useState as useState5 } from "react";
1123
1123
  import {
1124
- Switch as Switch3,
1125
- Badge as Badge2,
1124
+ Input as Input4,
1126
1125
  Button as Button4,
1126
+ Switch as Switch3,
1127
1127
  Skeleton,
1128
+ Textarea,
1129
+ Label as Label3,
1130
+ Badge as Badge2,
1131
+ Dialog as Dialog3,
1132
+ DialogContent as DialogContent3,
1133
+ DialogHeader as DialogHeader3,
1134
+ DialogTitle as DialogTitle3,
1135
+ DialogFooter as DialogFooter3,
1128
1136
  AlertDialog as AlertDialog2,
1129
1137
  AlertDialogAction as AlertDialogAction2,
1130
1138
  AlertDialogCancel as AlertDialogCancel2,
@@ -1132,340 +1140,7 @@ import {
1132
1140
  AlertDialogDescription as AlertDialogDescription2,
1133
1141
  AlertDialogFooter as AlertDialogFooter2,
1134
1142
  AlertDialogHeader as AlertDialogHeader2,
1135
- AlertDialogTitle as AlertDialogTitle2,
1136
- Popover,
1137
- PopoverContent,
1138
- PopoverTrigger,
1139
- Input as Input4,
1140
- Textarea,
1141
- Dialog as Dialog3,
1142
- DialogContent as DialogContent3,
1143
- DialogHeader as DialogHeader3,
1144
- DialogTitle as DialogTitle3,
1145
- DialogFooter as DialogFooter3,
1146
- Label as Label3,
1147
- Select,
1148
- SelectContent,
1149
- SelectItem,
1150
- SelectTrigger,
1151
- SelectValue
1152
- } from "@greatapps/greatauth-ui/ui";
1153
- import {
1154
- Trash2 as Trash22,
1155
- Plus,
1156
- Wrench,
1157
- Settings2
1158
- } from "lucide-react";
1159
- import { toast as toast4 } from "sonner";
1160
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1161
- function AgentToolsList({ agent, config }) {
1162
- const { data: agentToolsData, isLoading } = useAgentTools(config, agent.id);
1163
- const { data: allToolsData } = useTools(config);
1164
- const addMutation = useAddAgentTool(config);
1165
- const removeMutation = useRemoveAgentTool(config);
1166
- const updateMutation = useUpdateAgentTool(config);
1167
- const [removeTarget, setRemoveTarget] = useState4(null);
1168
- const [addOpen, setAddOpen] = useState4(false);
1169
- const [search, setSearch] = useState4("");
1170
- const [configTarget, setConfigTarget] = useState4(null);
1171
- const [configInstructions, setConfigInstructions] = useState4("");
1172
- const [configCredentialId, setConfigCredentialId] = useState4("");
1173
- const { data: credentialsData } = useToolCredentials(config);
1174
- const allCredentials = credentialsData?.data || [];
1175
- const agentTools = agentToolsData?.data || [];
1176
- const allTools = allToolsData?.data || [];
1177
- const assignedToolIds = new Set(agentTools.map((at) => at.id_tool));
1178
- const availableTools = allTools.filter((t) => !assignedToolIds.has(t.id));
1179
- const filteredAvailable = availableTools.filter(
1180
- (t) => t.name.toLowerCase().includes(search.toLowerCase())
1181
- );
1182
- function getToolInfo(idTool) {
1183
- return allTools.find((t) => t.id === idTool);
1184
- }
1185
- async function handleToggleEnabled(agentTool, checked) {
1186
- try {
1187
- await updateMutation.mutateAsync({
1188
- idAgent: agent.id,
1189
- id: agentTool.id,
1190
- body: { enabled: checked }
1191
- });
1192
- toast4.success(checked ? "Ferramenta ativada" : "Ferramenta desativada");
1193
- } catch (err) {
1194
- toast4.error(
1195
- err instanceof Error ? err.message : "Erro ao alterar estado da ferramenta"
1196
- );
1197
- }
1198
- }
1199
- async function handleAdd(tool) {
1200
- try {
1201
- await addMutation.mutateAsync({
1202
- idAgent: agent.id,
1203
- body: { id_tool: tool.id }
1204
- });
1205
- toast4.success("Ferramenta adicionada");
1206
- setAddOpen(false);
1207
- setSearch("");
1208
- } catch (err) {
1209
- toast4.error(
1210
- err instanceof Error ? err.message : "Erro ao adicionar ferramenta"
1211
- );
1212
- }
1213
- }
1214
- async function handleRemove() {
1215
- if (!removeTarget) return;
1216
- try {
1217
- await removeMutation.mutateAsync({
1218
- idAgent: agent.id,
1219
- id: removeTarget.id
1220
- });
1221
- toast4.success("Ferramenta removida");
1222
- } catch (err) {
1223
- toast4.error(
1224
- err instanceof Error ? err.message : "Erro ao remover ferramenta"
1225
- );
1226
- } finally {
1227
- setRemoveTarget(null);
1228
- }
1229
- }
1230
- function openConfig(agentTool) {
1231
- setConfigTarget(agentTool);
1232
- setConfigInstructions(agentTool.custom_instructions || "");
1233
- setConfigCredentialId(agentTool.id_tool_credential ? String(agentTool.id_tool_credential) : "");
1234
- }
1235
- async function handleSaveConfig() {
1236
- if (!configTarget) return;
1237
- try {
1238
- const newCredentialId = configCredentialId ? parseInt(configCredentialId, 10) : null;
1239
- await updateMutation.mutateAsync({
1240
- idAgent: agent.id,
1241
- id: configTarget.id,
1242
- body: {
1243
- custom_instructions: configInstructions.trim() || null,
1244
- id_tool_credential: newCredentialId
1245
- }
1246
- });
1247
- toast4.success("Configura\xE7\xE3o atualizada");
1248
- setConfigTarget(null);
1249
- } catch (err) {
1250
- toast4.error(
1251
- err instanceof Error ? err.message : "Erro ao atualizar configura\xE7\xE3o"
1252
- );
1253
- }
1254
- }
1255
- if (isLoading) {
1256
- return /* @__PURE__ */ jsx4("div", { className: "space-y-3 p-4", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx4(Skeleton, { className: "h-14 w-full" }, i)) });
1257
- }
1258
- return /* @__PURE__ */ jsxs4("div", { className: "space-y-4 p-4", children: [
1259
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
1260
- /* @__PURE__ */ jsxs4("h3", { className: "text-sm font-medium text-muted-foreground", children: [
1261
- agentTools.length,
1262
- " ferramenta",
1263
- agentTools.length !== 1 ? "s" : "",
1264
- " associada",
1265
- agentTools.length !== 1 ? "s" : ""
1266
- ] }),
1267
- /* @__PURE__ */ jsxs4(Popover, { open: addOpen, onOpenChange: setAddOpen, children: [
1268
- /* @__PURE__ */ jsx4(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs4(Button4, { size: "sm", disabled: availableTools.length === 0, children: [
1269
- /* @__PURE__ */ jsx4(Plus, { className: "mr-2 h-4 w-4" }),
1270
- "Adicionar Ferramenta"
1271
- ] }) }),
1272
- /* @__PURE__ */ jsxs4(PopoverContent, { className: "w-72 p-0", align: "end", children: [
1273
- /* @__PURE__ */ jsx4("div", { className: "p-2", children: /* @__PURE__ */ jsx4(
1274
- Input4,
1275
- {
1276
- placeholder: "Buscar ferramenta\\u2026",
1277
- "aria-label": "Buscar ferramenta",
1278
- name: "search",
1279
- value: search,
1280
- onChange: (e) => setSearch(e.target.value),
1281
- className: "h-8"
1282
- }
1283
- ) }),
1284
- /* @__PURE__ */ jsx4("div", { className: "max-h-48 overflow-y-auto", children: filteredAvailable.length === 0 ? /* @__PURE__ */ jsx4("p", { className: "p-3 text-center text-sm text-muted-foreground", children: "Nenhuma ferramenta dispon\xEDvel" }) : filteredAvailable.map((tool) => /* @__PURE__ */ jsxs4(
1285
- "button",
1286
- {
1287
- type: "button",
1288
- className: "flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-accent",
1289
- onClick: () => handleAdd(tool),
1290
- disabled: addMutation.isPending,
1291
- children: [
1292
- /* @__PURE__ */ jsx4(Wrench, { className: "h-4 w-4 text-muted-foreground" }),
1293
- /* @__PURE__ */ jsx4("span", { className: "flex-1 font-medium", children: tool.name }),
1294
- /* @__PURE__ */ jsx4(Badge2, { variant: "secondary", className: "text-xs", children: tool.type })
1295
- ]
1296
- },
1297
- tool.id
1298
- )) })
1299
- ] })
1300
- ] })
1301
- ] }),
1302
- agentTools.length === 0 ? /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
1303
- /* @__PURE__ */ jsx4(Wrench, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
1304
- /* @__PURE__ */ jsx4("p", { className: "text-sm text-muted-foreground", children: "Nenhuma ferramenta associada. Clique em 'Adicionar Ferramenta' para come\xE7ar." })
1305
- ] }) : /* @__PURE__ */ jsx4("div", { className: "space-y-2", children: agentTools.map((agentTool) => {
1306
- const tool = getToolInfo(agentTool.id_tool);
1307
- return /* @__PURE__ */ jsxs4(
1308
- "div",
1309
- {
1310
- className: "flex items-center gap-3 rounded-lg border bg-card p-3",
1311
- children: [
1312
- /* @__PURE__ */ jsxs4("div", { className: "flex flex-1 flex-col gap-1 min-w-0", children: [
1313
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
1314
- /* @__PURE__ */ jsx4("span", { className: "truncate font-medium", children: tool?.name || `Ferramenta #${agentTool.id_tool}` }),
1315
- tool?.type && /* @__PURE__ */ jsx4(Badge2, { variant: "secondary", className: "shrink-0 text-xs", children: tool.type })
1316
- ] }),
1317
- agentTool.custom_instructions && /* @__PURE__ */ jsx4("p", { className: "truncate text-xs text-muted-foreground", children: agentTool.custom_instructions })
1318
- ] }),
1319
- /* @__PURE__ */ jsx4(
1320
- Switch3,
1321
- {
1322
- "aria-label": "Ativar/Desativar",
1323
- checked: agentTool.enabled,
1324
- onCheckedChange: (checked) => handleToggleEnabled(agentTool, checked),
1325
- disabled: updateMutation.isPending
1326
- }
1327
- ),
1328
- /* @__PURE__ */ jsx4(
1329
- Button4,
1330
- {
1331
- variant: "ghost",
1332
- size: "icon",
1333
- "aria-label": "Configurar",
1334
- className: "shrink-0 text-muted-foreground hover:text-foreground",
1335
- onClick: () => openConfig(agentTool),
1336
- title: "Configurar instru\xE7\xF5es",
1337
- children: /* @__PURE__ */ jsx4(Settings2, { className: "h-4 w-4" })
1338
- }
1339
- ),
1340
- /* @__PURE__ */ jsx4(
1341
- Button4,
1342
- {
1343
- variant: "ghost",
1344
- size: "icon",
1345
- "aria-label": "Remover",
1346
- className: "shrink-0 text-muted-foreground hover:text-destructive",
1347
- onClick: () => setRemoveTarget(agentTool),
1348
- children: /* @__PURE__ */ jsx4(Trash22, { className: "h-4 w-4" })
1349
- }
1350
- )
1351
- ]
1352
- },
1353
- agentTool.id
1354
- );
1355
- }) }),
1356
- /* @__PURE__ */ jsx4(
1357
- Dialog3,
1358
- {
1359
- open: !!configTarget,
1360
- onOpenChange: (open) => !open && setConfigTarget(null),
1361
- children: /* @__PURE__ */ jsxs4(DialogContent3, { className: "sm:max-w-lg", children: [
1362
- /* @__PURE__ */ jsx4(DialogHeader3, { children: /* @__PURE__ */ jsx4(DialogTitle3, { children: "Instru\xE7\xF5es da Ferramenta" }) }),
1363
- /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
1364
- configTarget && getToolInfo(configTarget.id_tool)?.type !== "none" && /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
1365
- /* @__PURE__ */ jsx4(Label3, { htmlFor: "tool-credential", children: "Credencial" }),
1366
- /* @__PURE__ */ jsxs4(
1367
- Select,
1368
- {
1369
- value: configCredentialId || void 0,
1370
- onValueChange: (val) => setConfigCredentialId(val === "__none__" ? "" : val),
1371
- children: [
1372
- /* @__PURE__ */ jsx4(SelectTrigger, { id: "tool-credential", children: /* @__PURE__ */ jsx4(SelectValue, { placeholder: "Selecione uma credencial (opcional)" }) }),
1373
- /* @__PURE__ */ jsxs4(SelectContent, { children: [
1374
- /* @__PURE__ */ jsx4(SelectItem, { value: "__none__", children: "Nenhuma (autom\xE1tico)" }),
1375
- allCredentials.filter((c) => configTarget && c.id_tool === configTarget.id_tool && c.status === "active").map((c) => /* @__PURE__ */ jsx4(SelectItem, { value: String(c.id), children: c.label || `Credencial #${c.id}` }, c.id))
1376
- ] })
1377
- ]
1378
- }
1379
- ),
1380
- /* @__PURE__ */ jsx4("p", { className: "text-xs text-muted-foreground", children: "Vincule uma credencial espec\xEDfica a esta ferramenta neste agente." })
1381
- ] }),
1382
- /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
1383
- /* @__PURE__ */ jsx4(Label3, { htmlFor: "tool-instructions", children: "Instru\xE7\xF5es Personalizadas" }),
1384
- /* @__PURE__ */ jsx4(
1385
- Textarea,
1386
- {
1387
- id: "tool-instructions",
1388
- name: "instructions",
1389
- value: configInstructions,
1390
- onChange: (e) => setConfigInstructions(e.target.value),
1391
- placeholder: "Instru\\u00e7\\u00f5es sobre como e quando o agente deve usar esta ferramenta\\u2026",
1392
- rows: 6
1393
- }
1394
- ),
1395
- /* @__PURE__ */ jsx4("p", { className: "text-xs text-muted-foreground", children: "Este texto \xE9 adicionado ao prompt do agente para orientar o uso da ferramenta." })
1396
- ] })
1397
- ] }),
1398
- /* @__PURE__ */ jsxs4(DialogFooter3, { children: [
1399
- /* @__PURE__ */ jsx4(
1400
- Button4,
1401
- {
1402
- variant: "outline",
1403
- onClick: () => setConfigTarget(null),
1404
- children: "Cancelar"
1405
- }
1406
- ),
1407
- /* @__PURE__ */ jsx4(
1408
- Button4,
1409
- {
1410
- onClick: handleSaveConfig,
1411
- disabled: updateMutation.isPending,
1412
- children: "Salvar"
1413
- }
1414
- )
1415
- ] })
1416
- ] })
1417
- }
1418
- ),
1419
- /* @__PURE__ */ jsx4(
1420
- AlertDialog2,
1421
- {
1422
- open: !!removeTarget,
1423
- onOpenChange: (open) => !open && setRemoveTarget(null),
1424
- children: /* @__PURE__ */ jsxs4(AlertDialogContent2, { children: [
1425
- /* @__PURE__ */ jsxs4(AlertDialogHeader2, { children: [
1426
- /* @__PURE__ */ jsx4(AlertDialogTitle2, { children: "Remover ferramenta?" }),
1427
- /* @__PURE__ */ jsx4(AlertDialogDescription2, { children: "A ferramenta ser\xE1 desassociada deste agente." })
1428
- ] }),
1429
- /* @__PURE__ */ jsxs4(AlertDialogFooter2, { children: [
1430
- /* @__PURE__ */ jsx4(AlertDialogCancel2, { children: "Cancelar" }),
1431
- /* @__PURE__ */ jsx4(
1432
- AlertDialogAction2,
1433
- {
1434
- onClick: handleRemove,
1435
- disabled: removeMutation.isPending,
1436
- children: "Remover"
1437
- }
1438
- )
1439
- ] })
1440
- ] })
1441
- }
1442
- )
1443
- ] });
1444
- }
1445
-
1446
- // src/components/agents/agent-objectives-list.tsx
1447
- import { useState as useState6 } from "react";
1448
- import {
1449
- Input as Input5,
1450
- Button as Button5,
1451
- Switch as Switch4,
1452
- Skeleton as Skeleton2,
1453
- Textarea as Textarea2,
1454
- Label as Label4,
1455
- Badge as Badge3,
1456
- Dialog as Dialog4,
1457
- DialogContent as DialogContent4,
1458
- DialogHeader as DialogHeader4,
1459
- DialogTitle as DialogTitle4,
1460
- DialogFooter as DialogFooter4,
1461
- AlertDialog as AlertDialog3,
1462
- AlertDialogAction as AlertDialogAction3,
1463
- AlertDialogCancel as AlertDialogCancel3,
1464
- AlertDialogContent as AlertDialogContent3,
1465
- AlertDialogDescription as AlertDialogDescription3,
1466
- AlertDialogFooter as AlertDialogFooter3,
1467
- AlertDialogHeader as AlertDialogHeader3,
1468
- AlertDialogTitle as AlertDialogTitle3
1143
+ AlertDialogTitle as AlertDialogTitle2
1469
1144
  } from "@greatapps/greatauth-ui/ui";
1470
1145
 
1471
1146
  // src/components/ui/sortable.tsx
@@ -1538,7 +1213,7 @@ function useComposedRefs(...refs) {
1538
1213
  }
1539
1214
 
1540
1215
  // src/components/ui/sortable.tsx
1541
- import { jsx as jsx5 } from "react/jsx-runtime";
1216
+ import { jsx as jsx4 } from "react/jsx-runtime";
1542
1217
  var orientationConfig = {
1543
1218
  vertical: {
1544
1219
  modifiers: [restrictToVerticalAxis, restrictToParentElement],
@@ -1723,11 +1398,11 @@ function Sortable(props) {
1723
1398
  flatCursor
1724
1399
  ]
1725
1400
  );
1726
- return /* @__PURE__ */ jsx5(
1401
+ return /* @__PURE__ */ jsx4(
1727
1402
  SortableRootContext.Provider,
1728
1403
  {
1729
1404
  value: contextValue,
1730
- children: /* @__PURE__ */ jsx5(
1405
+ children: /* @__PURE__ */ jsx4(
1731
1406
  DndContext,
1732
1407
  {
1733
1408
  collisionDetection: collisionDetection ?? config.collisionDetection,
@@ -1760,12 +1435,12 @@ function SortableContent(props) {
1760
1435
  } = props;
1761
1436
  const context = useSortableContext(CONTENT_NAME);
1762
1437
  const ContentPrimitive = asChild ? SlotPrimitive.Slot : "div";
1763
- return /* @__PURE__ */ jsx5(SortableContentContext.Provider, { value: true, children: /* @__PURE__ */ jsx5(
1438
+ return /* @__PURE__ */ jsx4(SortableContentContext.Provider, { value: true, children: /* @__PURE__ */ jsx4(
1764
1439
  SortableContext,
1765
1440
  {
1766
1441
  items: context.items,
1767
1442
  strategy: strategyProp ?? context.strategy,
1768
- children: withoutSlot ? children : /* @__PURE__ */ jsx5(
1443
+ children: withoutSlot ? children : /* @__PURE__ */ jsx4(
1769
1444
  ContentPrimitive,
1770
1445
  {
1771
1446
  "data-slot": "sortable-content",
@@ -1841,7 +1516,7 @@ function SortableItem(props) {
1841
1516
  [id, attributes, listeners, setActivatorNodeRef, isDragging, disabled]
1842
1517
  );
1843
1518
  const ItemPrimitive = asChild ? SlotPrimitive.Slot : "div";
1844
- return /* @__PURE__ */ jsx5(SortableItemContext.Provider, { value: itemContext, children: /* @__PURE__ */ jsx5(
1519
+ return /* @__PURE__ */ jsx4(SortableItemContext.Provider, { value: itemContext, children: /* @__PURE__ */ jsx4(
1845
1520
  ItemPrimitive,
1846
1521
  {
1847
1522
  id,
@@ -1878,7 +1553,7 @@ function SortableItemHandle(props) {
1878
1553
  itemContext.setActivatorNodeRef(node);
1879
1554
  });
1880
1555
  const HandlePrimitive = asChild ? SlotPrimitive.Slot : "button";
1881
- return /* @__PURE__ */ jsx5(
1556
+ return /* @__PURE__ */ jsx4(
1882
1557
  HandlePrimitive,
1883
1558
  {
1884
1559
  type: "button",
@@ -1917,14 +1592,14 @@ function SortableOverlay(props) {
1917
1592
  const container = containerProp ?? (mounted ? globalThis.document?.body : null);
1918
1593
  if (!container) return null;
1919
1594
  return ReactDOM.createPortal(
1920
- /* @__PURE__ */ jsx5(
1595
+ /* @__PURE__ */ jsx4(
1921
1596
  DragOverlay,
1922
1597
  {
1923
1598
  dropAnimation,
1924
1599
  modifiers: context.modifiers,
1925
1600
  className: cn(!context.flatCursor && "cursor-grabbing"),
1926
1601
  ...overlayProps,
1927
- children: /* @__PURE__ */ jsx5(SortableOverlayContext.Provider, { value: true, children: context.activeId ? typeof children === "function" ? children({ value: context.activeId }) : children : null })
1602
+ children: /* @__PURE__ */ jsx4(SortableOverlayContext.Provider, { value: true, children: context.activeId ? typeof children === "function" ? children({ value: context.activeId }) : children : null })
1928
1603
  }
1929
1604
  ),
1930
1605
  container
@@ -1932,9 +1607,9 @@ function SortableOverlay(props) {
1932
1607
  }
1933
1608
 
1934
1609
  // src/components/agents/agent-objectives-list.tsx
1935
- import { Trash2 as Trash23, Target, Pencil as Pencil2, Plus as Plus2, GripVertical } from "lucide-react";
1936
- import { toast as toast5 } from "sonner";
1937
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
1610
+ import { Trash2 as Trash22, Target, Pencil as Pencil2, Plus, GripVertical } from "lucide-react";
1611
+ import { toast as toast4 } from "sonner";
1612
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
1938
1613
  function slugify(text) {
1939
1614
  return text.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
1940
1615
  }
@@ -1944,11 +1619,11 @@ function AgentObjectivesList({ agent, config }) {
1944
1619
  const createMutation = useCreateObjective(config);
1945
1620
  const updateMutation = useUpdateObjective(config);
1946
1621
  const deleteMutation = useDeleteObjective(config);
1947
- const [formOpen, setFormOpen] = useState6(false);
1948
- const [editTarget, setEditTarget] = useState6(null);
1949
- const [form, setForm] = useState6(EMPTY_FORM);
1950
- const [slugManual, setSlugManual] = useState6(false);
1951
- const [removeTarget, setRemoveTarget] = useState6(null);
1622
+ const [formOpen, setFormOpen] = useState5(false);
1623
+ const [editTarget, setEditTarget] = useState5(null);
1624
+ const [form, setForm] = useState5(EMPTY_FORM);
1625
+ const [slugManual, setSlugManual] = useState5(false);
1626
+ const [removeTarget, setRemoveTarget] = useState5(null);
1952
1627
  const objectives = objectivesData?.data || [];
1953
1628
  const sortedObjectives = [...objectives].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
1954
1629
  async function handleReorder(newItems) {
@@ -1961,9 +1636,9 @@ function AgentObjectivesList({ agent, config }) {
1961
1636
  body: { order: item.order }
1962
1637
  });
1963
1638
  }
1964
- toast5.success("Ordem atualizada");
1639
+ toast4.success("Ordem atualizada");
1965
1640
  } catch {
1966
- toast5.error("Erro ao reordenar objetivos");
1641
+ toast4.error("Erro ao reordenar objetivos");
1967
1642
  }
1968
1643
  }
1969
1644
  function openCreate() {
@@ -1997,7 +1672,7 @@ function AgentObjectivesList({ agent, config }) {
1997
1672
  prompt: form.prompt.trim() || null
1998
1673
  }
1999
1674
  });
2000
- toast5.success("Objetivo atualizado");
1675
+ toast4.success("Objetivo atualizado");
2001
1676
  } else {
2002
1677
  await createMutation.mutateAsync({
2003
1678
  idAgent: agent.id,
@@ -2008,11 +1683,11 @@ function AgentObjectivesList({ agent, config }) {
2008
1683
  order: nextOrder
2009
1684
  }
2010
1685
  });
2011
- toast5.success("Objetivo criado");
1686
+ toast4.success("Objetivo criado");
2012
1687
  }
2013
1688
  setFormOpen(false);
2014
1689
  } catch (err) {
2015
- toast5.error(
1690
+ toast4.error(
2016
1691
  err instanceof Error ? err.message : editTarget ? "Erro ao atualizar objetivo" : "Erro ao criar objetivo"
2017
1692
  );
2018
1693
  }
@@ -2024,9 +1699,9 @@ function AgentObjectivesList({ agent, config }) {
2024
1699
  id: objective.id,
2025
1700
  body: { active: checked }
2026
1701
  });
2027
- toast5.success(checked ? "Objetivo ativado" : "Objetivo desativado");
1702
+ toast4.success(checked ? "Objetivo ativado" : "Objetivo desativado");
2028
1703
  } catch (err) {
2029
- toast5.error(
1704
+ toast4.error(
2030
1705
  err instanceof Error ? err.message : "Erro ao alterar estado do objetivo"
2031
1706
  );
2032
1707
  }
@@ -2038,9 +1713,9 @@ function AgentObjectivesList({ agent, config }) {
2038
1713
  idAgent: agent.id,
2039
1714
  id: removeTarget.id
2040
1715
  });
2041
- toast5.success("Objetivo removido");
1716
+ toast4.success("Objetivo removido");
2042
1717
  } catch (err) {
2043
- toast5.error(
1718
+ toast4.error(
2044
1719
  err instanceof Error ? err.message : "Erro ao remover o objetivo"
2045
1720
  );
2046
1721
  } finally {
@@ -2048,51 +1723,51 @@ function AgentObjectivesList({ agent, config }) {
2048
1723
  }
2049
1724
  }
2050
1725
  if (isLoading) {
2051
- return /* @__PURE__ */ jsx6("div", { className: "space-y-3 p-4", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx6(Skeleton2, { className: "h-14 w-full" }, i)) });
1726
+ return /* @__PURE__ */ jsx5("div", { className: "space-y-3 p-4", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx5(Skeleton, { className: "h-14 w-full" }, i)) });
2052
1727
  }
2053
- return /* @__PURE__ */ jsxs5("div", { className: "space-y-4 p-4", children: [
2054
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between", children: [
2055
- /* @__PURE__ */ jsxs5("div", { children: [
2056
- /* @__PURE__ */ jsxs5("h3", { className: "text-sm font-medium text-muted-foreground", children: [
1728
+ return /* @__PURE__ */ jsxs4("div", { className: "space-y-4 p-4", children: [
1729
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
1730
+ /* @__PURE__ */ jsxs4("div", { children: [
1731
+ /* @__PURE__ */ jsxs4("h3", { className: "text-sm font-medium text-muted-foreground", children: [
2057
1732
  sortedObjectives.length,
2058
1733
  " objetivo",
2059
1734
  sortedObjectives.length !== 1 ? "s" : "",
2060
1735
  " definido",
2061
1736
  sortedObjectives.length !== 1 ? "s" : ""
2062
1737
  ] }),
2063
- /* @__PURE__ */ jsx6("p", { className: "text-xs text-muted-foreground", children: "Objetivos s\xE3o modos de conversa que o agente ativa automaticamente conforme a inten\xE7\xE3o do utilizador." })
1738
+ /* @__PURE__ */ jsx5("p", { className: "text-xs text-muted-foreground", children: "Objetivos s\xE3o modos de conversa que o agente ativa automaticamente conforme a inten\xE7\xE3o do utilizador." })
2064
1739
  ] }),
2065
- /* @__PURE__ */ jsxs5(Button5, { onClick: openCreate, size: "sm", children: [
2066
- /* @__PURE__ */ jsx6(Plus2, { className: "mr-2 h-4 w-4" }),
1740
+ /* @__PURE__ */ jsxs4(Button4, { onClick: openCreate, size: "sm", children: [
1741
+ /* @__PURE__ */ jsx5(Plus, { className: "mr-2 h-4 w-4" }),
2067
1742
  "Novo Objetivo"
2068
1743
  ] })
2069
1744
  ] }),
2070
- sortedObjectives.length === 0 ? /* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
2071
- /* @__PURE__ */ jsx6(Target, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
2072
- /* @__PURE__ */ jsx6("p", { className: "text-sm text-muted-foreground", children: "Nenhum objetivo definido. Adicione objetivos para orientar o agente em diferentes contextos." })
2073
- ] }) : /* @__PURE__ */ jsxs5(
1745
+ sortedObjectives.length === 0 ? /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
1746
+ /* @__PURE__ */ jsx5(Target, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
1747
+ /* @__PURE__ */ jsx5("p", { className: "text-sm text-muted-foreground", children: "Nenhum objetivo definido. Adicione objetivos para orientar o agente em diferentes contextos." })
1748
+ ] }) : /* @__PURE__ */ jsxs4(
2074
1749
  Sortable,
2075
1750
  {
2076
1751
  value: sortedObjectives,
2077
1752
  onValueChange: handleReorder,
2078
1753
  getItemValue: (item) => item.id,
2079
1754
  children: [
2080
- /* @__PURE__ */ jsx6(SortableContent, { className: "space-y-2", children: sortedObjectives.map((objective) => /* @__PURE__ */ jsxs5(
1755
+ /* @__PURE__ */ jsx5(SortableContent, { className: "space-y-2", children: sortedObjectives.map((objective) => /* @__PURE__ */ jsxs4(
2081
1756
  SortableItem,
2082
1757
  {
2083
1758
  value: objective.id,
2084
1759
  className: "flex items-center gap-3 rounded-lg border bg-card p-3",
2085
1760
  children: [
2086
- /* @__PURE__ */ jsx6(SortableItemHandle, { className: "shrink-0 text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ jsx6(GripVertical, { "aria-hidden": "true", className: "h-5 w-5" }) }),
2087
- /* @__PURE__ */ jsxs5("div", { className: "flex flex-1 flex-col gap-1 min-w-0", children: [
2088
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
2089
- /* @__PURE__ */ jsx6("span", { className: "truncate font-medium", children: objective.title }),
2090
- objective.slug && /* @__PURE__ */ jsx6(Badge3, { variant: "secondary", className: "shrink-0 text-xs font-mono", children: objective.slug })
1761
+ /* @__PURE__ */ jsx5(SortableItemHandle, { className: "shrink-0 text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ jsx5(GripVertical, { "aria-hidden": "true", className: "h-5 w-5" }) }),
1762
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-1 flex-col gap-1 min-w-0", children: [
1763
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
1764
+ /* @__PURE__ */ jsx5("span", { className: "truncate font-medium", children: objective.title }),
1765
+ objective.slug && /* @__PURE__ */ jsx5(Badge2, { variant: "secondary", className: "shrink-0 text-xs font-mono", children: objective.slug })
2091
1766
  ] }),
2092
- objective.prompt && /* @__PURE__ */ jsx6("p", { className: "line-clamp-2 text-xs text-muted-foreground", children: objective.prompt })
1767
+ objective.prompt && /* @__PURE__ */ jsx5("p", { className: "line-clamp-2 text-xs text-muted-foreground", children: objective.prompt })
2093
1768
  ] }),
2094
- /* @__PURE__ */ jsx6(
2095
- Switch4,
1769
+ /* @__PURE__ */ jsx5(
1770
+ Switch3,
2096
1771
  {
2097
1772
  "aria-label": "Ativar/Desativar",
2098
1773
  checked: objective.active,
@@ -2100,49 +1775,49 @@ function AgentObjectivesList({ agent, config }) {
2100
1775
  disabled: updateMutation.isPending
2101
1776
  }
2102
1777
  ),
2103
- /* @__PURE__ */ jsx6(
2104
- Button5,
1778
+ /* @__PURE__ */ jsx5(
1779
+ Button4,
2105
1780
  {
2106
1781
  variant: "ghost",
2107
1782
  size: "icon",
2108
1783
  "aria-label": "Editar",
2109
1784
  className: "shrink-0 text-muted-foreground hover:text-foreground",
2110
1785
  onClick: () => openEdit(objective),
2111
- children: /* @__PURE__ */ jsx6(Pencil2, { className: "h-4 w-4" })
1786
+ children: /* @__PURE__ */ jsx5(Pencil2, { className: "h-4 w-4" })
2112
1787
  }
2113
1788
  ),
2114
- /* @__PURE__ */ jsx6(
2115
- Button5,
1789
+ /* @__PURE__ */ jsx5(
1790
+ Button4,
2116
1791
  {
2117
1792
  variant: "ghost",
2118
1793
  size: "icon",
2119
1794
  "aria-label": "Excluir",
2120
1795
  className: "shrink-0 text-muted-foreground hover:text-destructive",
2121
1796
  onClick: () => setRemoveTarget(objective),
2122
- children: /* @__PURE__ */ jsx6(Trash23, { className: "h-4 w-4" })
1797
+ children: /* @__PURE__ */ jsx5(Trash22, { className: "h-4 w-4" })
2123
1798
  }
2124
1799
  )
2125
1800
  ]
2126
1801
  },
2127
1802
  objective.id
2128
1803
  )) }),
2129
- /* @__PURE__ */ jsx6(SortableOverlay, { children: ({ value }) => {
1804
+ /* @__PURE__ */ jsx5(SortableOverlay, { children: ({ value }) => {
2130
1805
  const obj = sortedObjectives.find((o) => o.id === value);
2131
- return /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3 rounded-lg border bg-card p-3 shadow-lg", children: [
2132
- /* @__PURE__ */ jsx6(GripVertical, { "aria-hidden": "true", className: "h-5 w-5 text-muted-foreground" }),
2133
- /* @__PURE__ */ jsx6("span", { className: "font-medium", children: obj?.title })
1806
+ return /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3 rounded-lg border bg-card p-3 shadow-lg", children: [
1807
+ /* @__PURE__ */ jsx5(GripVertical, { "aria-hidden": "true", className: "h-5 w-5 text-muted-foreground" }),
1808
+ /* @__PURE__ */ jsx5("span", { className: "font-medium", children: obj?.title })
2134
1809
  ] });
2135
1810
  } })
2136
1811
  ]
2137
1812
  }
2138
1813
  ),
2139
- /* @__PURE__ */ jsx6(Dialog4, { open: formOpen, onOpenChange: setFormOpen, children: /* @__PURE__ */ jsxs5(DialogContent4, { className: "sm:max-w-lg", children: [
2140
- /* @__PURE__ */ jsx6(DialogHeader4, { children: /* @__PURE__ */ jsx6(DialogTitle4, { children: editTarget ? "Editar Objetivo" : "Novo Objetivo" }) }),
2141
- /* @__PURE__ */ jsxs5("div", { className: "space-y-4", children: [
2142
- /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
2143
- /* @__PURE__ */ jsx6(Label4, { htmlFor: "objective-title", children: "T\xEDtulo *" }),
2144
- /* @__PURE__ */ jsx6(
2145
- Input5,
1814
+ /* @__PURE__ */ jsx5(Dialog3, { open: formOpen, onOpenChange: setFormOpen, children: /* @__PURE__ */ jsxs4(DialogContent3, { className: "sm:max-w-lg", children: [
1815
+ /* @__PURE__ */ jsx5(DialogHeader3, { children: /* @__PURE__ */ jsx5(DialogTitle3, { children: editTarget ? "Editar Objetivo" : "Novo Objetivo" }) }),
1816
+ /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
1817
+ /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
1818
+ /* @__PURE__ */ jsx5(Label3, { htmlFor: "objective-title", children: "T\xEDtulo *" }),
1819
+ /* @__PURE__ */ jsx5(
1820
+ Input4,
2146
1821
  {
2147
1822
  id: "objective-title",
2148
1823
  name: "title",
@@ -2159,10 +1834,10 @@ function AgentObjectivesList({ agent, config }) {
2159
1834
  }
2160
1835
  )
2161
1836
  ] }),
2162
- /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
2163
- /* @__PURE__ */ jsx6(Label4, { htmlFor: "objective-slug", children: "Slug (identificador) *" }),
2164
- /* @__PURE__ */ jsx6(
2165
- Input5,
1837
+ /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
1838
+ /* @__PURE__ */ jsx5(Label3, { htmlFor: "objective-slug", children: "Slug (identificador) *" }),
1839
+ /* @__PURE__ */ jsx5(
1840
+ Input4,
2166
1841
  {
2167
1842
  id: "objective-slug",
2168
1843
  name: "slug",
@@ -2175,12 +1850,12 @@ function AgentObjectivesList({ agent, config }) {
2175
1850
  className: "font-mono"
2176
1851
  }
2177
1852
  ),
2178
- /* @__PURE__ */ jsx6("p", { className: "text-xs text-muted-foreground", children: "Gerado automaticamente. Usado pelo agente para identificar o objetivo." })
1853
+ /* @__PURE__ */ jsx5("p", { className: "text-xs text-muted-foreground", children: "Gerado automaticamente. Usado pelo agente para identificar o objetivo." })
2179
1854
  ] }),
2180
- /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
2181
- /* @__PURE__ */ jsx6(Label4, { htmlFor: "objective-prompt", children: "Instru\xE7\xF5es do Objetivo" }),
2182
- /* @__PURE__ */ jsx6(
2183
- Textarea2,
1855
+ /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
1856
+ /* @__PURE__ */ jsx5(Label3, { htmlFor: "objective-prompt", children: "Instru\xE7\xF5es do Objetivo" }),
1857
+ /* @__PURE__ */ jsx5(
1858
+ Textarea,
2184
1859
  {
2185
1860
  id: "objective-prompt",
2186
1861
  name: "prompt",
@@ -2190,20 +1865,20 @@ function AgentObjectivesList({ agent, config }) {
2190
1865
  rows: 8
2191
1866
  }
2192
1867
  ),
2193
- /* @__PURE__ */ jsx6("p", { className: "text-xs text-muted-foreground", children: "Estas instru\xE7\xF5es s\xE3o carregadas automaticamente quando o agente detecta que o utilizador precisa deste objetivo." })
1868
+ /* @__PURE__ */ jsx5("p", { className: "text-xs text-muted-foreground", children: "Estas instru\xE7\xF5es s\xE3o carregadas automaticamente quando o agente detecta que o utilizador precisa deste objetivo." })
2194
1869
  ] })
2195
1870
  ] }),
2196
- /* @__PURE__ */ jsxs5(DialogFooter4, { children: [
2197
- /* @__PURE__ */ jsx6(
2198
- Button5,
1871
+ /* @__PURE__ */ jsxs4(DialogFooter3, { children: [
1872
+ /* @__PURE__ */ jsx5(
1873
+ Button4,
2199
1874
  {
2200
1875
  variant: "outline",
2201
1876
  onClick: () => setFormOpen(false),
2202
1877
  children: "Cancelar"
2203
1878
  }
2204
1879
  ),
2205
- /* @__PURE__ */ jsx6(
2206
- Button5,
1880
+ /* @__PURE__ */ jsx5(
1881
+ Button4,
2207
1882
  {
2208
1883
  onClick: handleSubmit,
2209
1884
  disabled: !form.title.trim() || createMutation.isPending || updateMutation.isPending,
@@ -2212,20 +1887,20 @@ function AgentObjectivesList({ agent, config }) {
2212
1887
  )
2213
1888
  ] })
2214
1889
  ] }) }),
2215
- /* @__PURE__ */ jsx6(
2216
- AlertDialog3,
1890
+ /* @__PURE__ */ jsx5(
1891
+ AlertDialog2,
2217
1892
  {
2218
1893
  open: !!removeTarget,
2219
1894
  onOpenChange: (open) => !open && setRemoveTarget(null),
2220
- children: /* @__PURE__ */ jsxs5(AlertDialogContent3, { children: [
2221
- /* @__PURE__ */ jsxs5(AlertDialogHeader3, { children: [
2222
- /* @__PURE__ */ jsx6(AlertDialogTitle3, { children: "Remover objetivo?" }),
2223
- /* @__PURE__ */ jsx6(AlertDialogDescription3, { children: "O objetivo ser\xE1 removido permanentemente." })
1895
+ children: /* @__PURE__ */ jsxs4(AlertDialogContent2, { children: [
1896
+ /* @__PURE__ */ jsxs4(AlertDialogHeader2, { children: [
1897
+ /* @__PURE__ */ jsx5(AlertDialogTitle2, { children: "Remover objetivo?" }),
1898
+ /* @__PURE__ */ jsx5(AlertDialogDescription2, { children: "O objetivo ser\xE1 removido permanentemente." })
2224
1899
  ] }),
2225
- /* @__PURE__ */ jsxs5(AlertDialogFooter3, { children: [
2226
- /* @__PURE__ */ jsx6(AlertDialogCancel3, { children: "Cancelar" }),
2227
- /* @__PURE__ */ jsx6(
2228
- AlertDialogAction3,
1900
+ /* @__PURE__ */ jsxs4(AlertDialogFooter2, { children: [
1901
+ /* @__PURE__ */ jsx5(AlertDialogCancel2, { children: "Cancelar" }),
1902
+ /* @__PURE__ */ jsx5(
1903
+ AlertDialogAction2,
2229
1904
  {
2230
1905
  onClick: handleRemove,
2231
1906
  disabled: deleteMutation.isPending,
@@ -2240,11 +1915,11 @@ function AgentObjectivesList({ agent, config }) {
2240
1915
  }
2241
1916
 
2242
1917
  // src/components/agents/agent-prompt-editor.tsx
2243
- import { useState as useState7, useRef, useCallback as useCallback3, useEffect as useEffect3 } from "react";
2244
- import { Button as Button6, Input as Input6, Skeleton as Skeleton3, Badge as Badge4 } from "@greatapps/greatauth-ui/ui";
1918
+ import { useState as useState6, useRef, useCallback as useCallback3, useEffect as useEffect3 } from "react";
1919
+ import { Button as Button5, Input as Input5, Skeleton as Skeleton2, Badge as Badge3 } from "@greatapps/greatauth-ui/ui";
2245
1920
  import { FileText, Loader2 as Loader23, ChevronDown, ChevronUp, RotateCcw } from "lucide-react";
2246
- import { toast as toast6 } from "sonner";
2247
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1921
+ import { toast as toast5 } from "sonner";
1922
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
2248
1923
  function formatDate(dateStr) {
2249
1924
  const date = new Date(dateStr);
2250
1925
  return date.toLocaleDateString("pt-BR", {
@@ -2317,12 +1992,12 @@ function AgentPromptEditor({ config, agent }) {
2317
1992
  );
2318
1993
  const currentVersion = sortedVersions.find((v) => v.is_current) || sortedVersions[0] || null;
2319
1994
  const currentPromptContent = currentVersion?.prompt_content ?? "";
2320
- const [trackedAgentId, setTrackedAgentId] = useState7(agent.id);
2321
- const [promptText, setPromptText] = useState7(currentPromptContent);
2322
- const [promptInitialized, setPromptInitialized] = useState7(false);
2323
- const [changeNotes, setChangeNotes] = useState7("");
2324
- const [showPreview, setShowPreview] = useState7(false);
2325
- const [compareVersionId, setCompareVersionId] = useState7(null);
1995
+ const [trackedAgentId, setTrackedAgentId] = useState6(agent.id);
1996
+ const [promptText, setPromptText] = useState6(currentPromptContent);
1997
+ const [promptInitialized, setPromptInitialized] = useState6(false);
1998
+ const [changeNotes, setChangeNotes] = useState6("");
1999
+ const [showPreview, setShowPreview] = useState6(false);
2000
+ const [compareVersionId, setCompareVersionId] = useState6(null);
2326
2001
  const textareaRef = useRef(null);
2327
2002
  if (!promptInitialized && currentPromptContent && !isLoading) {
2328
2003
  setPromptText(currentPromptContent);
@@ -2369,15 +2044,15 @@ function AgentPromptEditor({ config, agent }) {
2369
2044
  try {
2370
2045
  await updateAgent.mutateAsync({ id: agent.id, body });
2371
2046
  setChangeNotes("");
2372
- toast6.success("Prompt salvo com sucesso");
2047
+ toast5.success("Prompt salvo com sucesso");
2373
2048
  } catch {
2374
- toast6.error("Erro ao salvar prompt");
2049
+ toast5.error("Erro ao salvar prompt");
2375
2050
  }
2376
2051
  }
2377
2052
  function handleRestore(version) {
2378
2053
  setPromptText(version.prompt_content ?? "");
2379
2054
  setChangeNotes(`Restaurado da v${version.version_number}`);
2380
- toast6.info("Prompt restaurado no editor. Clique em Salvar para confirmar.");
2055
+ toast5.info("Prompt restaurado no editor. Clique em Salvar para confirmar.");
2381
2056
  }
2382
2057
  const charCount = promptText.length;
2383
2058
  const tokenEstimate = Math.ceil(charCount / 4);
@@ -2386,12 +2061,12 @@ function AgentPromptEditor({ config, agent }) {
2386
2061
  const allTools = toolsData?.data || [];
2387
2062
  const previewText = buildPreview(promptText, objectives, agentTools, allTools);
2388
2063
  if (isLoading) {
2389
- return /* @__PURE__ */ jsx7("div", { className: "space-y-3 p-4", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx7(Skeleton3, { className: "h-14 w-full" }, i)) });
2064
+ return /* @__PURE__ */ jsx6("div", { className: "space-y-3 p-4", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx6(Skeleton2, { className: "h-14 w-full" }, i)) });
2390
2065
  }
2391
- return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-4 p-4 lg:flex-row", children: [
2392
- /* @__PURE__ */ jsxs6("div", { className: "min-w-0 flex-1 space-y-4", children: [
2393
- /* @__PURE__ */ jsxs6("div", { className: "space-y-2", children: [
2394
- /* @__PURE__ */ jsx7(
2066
+ return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-4 p-4 lg:flex-row", children: [
2067
+ /* @__PURE__ */ jsxs5("div", { className: "min-w-0 flex-1 space-y-4", children: [
2068
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
2069
+ /* @__PURE__ */ jsx6(
2395
2070
  "textarea",
2396
2071
  {
2397
2072
  ref: textareaRef,
@@ -2406,22 +2081,22 @@ function AgentPromptEditor({ config, agent }) {
2406
2081
  style: { minHeight: "300px" }
2407
2082
  }
2408
2083
  ),
2409
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-3 text-xs text-muted-foreground", children: [
2410
- /* @__PURE__ */ jsxs6("span", { className: "tabular-nums", children: [
2084
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3 text-xs text-muted-foreground", children: [
2085
+ /* @__PURE__ */ jsxs5("span", { className: "tabular-nums", children: [
2411
2086
  charCount.toLocaleString("pt-BR"),
2412
2087
  " caracteres"
2413
2088
  ] }),
2414
- /* @__PURE__ */ jsx7("span", { children: "\xB7" }),
2415
- /* @__PURE__ */ jsxs6("span", { className: "tabular-nums", children: [
2089
+ /* @__PURE__ */ jsx6("span", { children: "\xB7" }),
2090
+ /* @__PURE__ */ jsxs5("span", { className: "tabular-nums", children: [
2416
2091
  "~",
2417
2092
  tokenEstimate.toLocaleString("pt-BR"),
2418
2093
  " tokens"
2419
2094
  ] })
2420
2095
  ] })
2421
2096
  ] }),
2422
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-3", children: [
2423
- /* @__PURE__ */ jsx7(
2424
- Input6,
2097
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3", children: [
2098
+ /* @__PURE__ */ jsx6(
2099
+ Input5,
2425
2100
  {
2426
2101
  "aria-label": "Notas da altera\xE7\xE3o",
2427
2102
  name: "changeNotes",
@@ -2438,34 +2113,34 @@ function AgentPromptEditor({ config, agent }) {
2438
2113
  }
2439
2114
  }
2440
2115
  ),
2441
- /* @__PURE__ */ jsxs6(
2442
- Button6,
2116
+ /* @__PURE__ */ jsxs5(
2117
+ Button5,
2443
2118
  {
2444
2119
  onClick: handleSave,
2445
2120
  disabled: updateAgent.isPending || !promptText.trim(),
2446
2121
  children: [
2447
- updateAgent.isPending && /* @__PURE__ */ jsx7(Loader23, { className: "mr-2 h-4 w-4 animate-spin" }),
2122
+ updateAgent.isPending && /* @__PURE__ */ jsx6(Loader23, { className: "mr-2 h-4 w-4 animate-spin" }),
2448
2123
  "Salvar"
2449
2124
  ]
2450
2125
  }
2451
2126
  )
2452
2127
  ] }),
2453
- /* @__PURE__ */ jsxs6("div", { className: "rounded-lg border", children: [
2454
- /* @__PURE__ */ jsxs6(
2128
+ /* @__PURE__ */ jsxs5("div", { className: "rounded-lg border", children: [
2129
+ /* @__PURE__ */ jsxs5(
2455
2130
  "button",
2456
2131
  {
2457
2132
  type: "button",
2458
2133
  onClick: () => setShowPreview((prev) => !prev),
2459
2134
  className: "flex w-full items-center justify-between px-4 py-3 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",
2460
2135
  children: [
2461
- /* @__PURE__ */ jsx7("span", { children: "Preview do prompt final" }),
2462
- showPreview ? /* @__PURE__ */ jsx7(ChevronUp, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx7(ChevronDown, { className: "h-4 w-4" })
2136
+ /* @__PURE__ */ jsx6("span", { children: "Preview do prompt final" }),
2137
+ showPreview ? /* @__PURE__ */ jsx6(ChevronUp, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx6(ChevronDown, { className: "h-4 w-4" })
2463
2138
  ]
2464
2139
  }
2465
2140
  ),
2466
- showPreview && /* @__PURE__ */ jsx7("div", { className: "border-t px-4 py-3", children: /* @__PURE__ */ jsx7("pre", { className: "max-h-96 overflow-auto whitespace-pre-wrap font-mono text-sm leading-relaxed", children: previewText.split("\n").map((line, i) => {
2141
+ showPreview && /* @__PURE__ */ jsx6("div", { className: "border-t px-4 py-3", children: /* @__PURE__ */ jsx6("pre", { className: "max-h-96 overflow-auto whitespace-pre-wrap font-mono text-sm leading-relaxed", children: previewText.split("\n").map((line, i) => {
2467
2142
  const isSection = line.startsWith("[SKILLS DISPON\xCDVEIS]") || line.startsWith("[TOOLS DISPON\xCDVEIS]");
2468
- return /* @__PURE__ */ jsxs6(
2143
+ return /* @__PURE__ */ jsxs5(
2469
2144
  "span",
2470
2145
  {
2471
2146
  className: isSection ? "font-semibold text-muted-foreground" : "",
@@ -2478,17 +2153,17 @@ function AgentPromptEditor({ config, agent }) {
2478
2153
  );
2479
2154
  }) }) })
2480
2155
  ] }),
2481
- diffLines && compareVersion && currentVersion && /* @__PURE__ */ jsxs6("div", { children: [
2482
- /* @__PURE__ */ jsxs6("div", { className: "mb-2 flex items-center justify-between", children: [
2483
- /* @__PURE__ */ jsxs6("h3", { className: "text-sm font-medium text-muted-foreground", children: [
2156
+ diffLines && compareVersion && currentVersion && /* @__PURE__ */ jsxs5("div", { children: [
2157
+ /* @__PURE__ */ jsxs5("div", { className: "mb-2 flex items-center justify-between", children: [
2158
+ /* @__PURE__ */ jsxs5("h3", { className: "text-sm font-medium text-muted-foreground", children: [
2484
2159
  "Diferen\xE7as: v",
2485
2160
  compareVersion.version_number,
2486
2161
  " \u2192 v",
2487
2162
  currentVersion.version_number,
2488
2163
  " (actual)"
2489
2164
  ] }),
2490
- /* @__PURE__ */ jsx7(
2491
- Button6,
2165
+ /* @__PURE__ */ jsx6(
2166
+ Button5,
2492
2167
  {
2493
2168
  variant: "ghost",
2494
2169
  size: "sm",
@@ -2498,12 +2173,12 @@ function AgentPromptEditor({ config, agent }) {
2498
2173
  }
2499
2174
  )
2500
2175
  ] }),
2501
- /* @__PURE__ */ jsx7("div", { className: "max-h-64 overflow-auto rounded-lg border font-mono text-sm", children: diffLines.map((line, i) => /* @__PURE__ */ jsxs6(
2176
+ /* @__PURE__ */ jsx6("div", { className: "max-h-64 overflow-auto rounded-lg border font-mono text-sm", children: diffLines.map((line, i) => /* @__PURE__ */ jsxs5(
2502
2177
  "div",
2503
2178
  {
2504
2179
  className: `whitespace-pre-wrap px-3 py-0.5 ${line.type === "added" ? "bg-green-500/10 text-green-700 dark:text-green-400" : line.type === "removed" ? "bg-red-500/10 text-red-700 dark:text-red-400" : ""}`,
2505
2180
  children: [
2506
- /* @__PURE__ */ jsx7("span", { className: "mr-2 inline-block w-4 select-none text-muted-foreground", children: line.type === "added" ? "+" : line.type === "removed" ? "-" : " " }),
2181
+ /* @__PURE__ */ jsx6("span", { className: "mr-2 inline-block w-4 select-none text-muted-foreground", children: line.type === "added" ? "+" : line.type === "removed" ? "-" : " " }),
2507
2182
  line.line || " "
2508
2183
  ]
2509
2184
  },
@@ -2511,57 +2186,57 @@ function AgentPromptEditor({ config, agent }) {
2511
2186
  )) })
2512
2187
  ] })
2513
2188
  ] }),
2514
- /* @__PURE__ */ jsxs6("div", { className: "w-full space-y-2 lg:w-80 lg:shrink-0", children: [
2515
- /* @__PURE__ */ jsx7("h3", { className: "text-sm font-medium text-muted-foreground", children: "Hist\xF3rico de Vers\xF5es" }),
2516
- sortedVersions.length === 0 ? /* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
2517
- /* @__PURE__ */ jsx7(FileText, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
2518
- /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "Nenhuma vers\xE3o encontrada. Salve o prompt para criar a primeira vers\xE3o." })
2519
- ] }) : /* @__PURE__ */ jsx7("div", { className: "space-y-1", children: sortedVersions.map((version, idx) => {
2189
+ /* @__PURE__ */ jsxs5("div", { className: "w-full space-y-2 lg:w-80 lg:shrink-0", children: [
2190
+ /* @__PURE__ */ jsx6("h3", { className: "text-sm font-medium text-muted-foreground", children: "Hist\xF3rico de Vers\xF5es" }),
2191
+ sortedVersions.length === 0 ? /* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
2192
+ /* @__PURE__ */ jsx6(FileText, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
2193
+ /* @__PURE__ */ jsx6("p", { className: "text-sm text-muted-foreground", children: "Nenhuma vers\xE3o encontrada. Salve o prompt para criar a primeira vers\xE3o." })
2194
+ ] }) : /* @__PURE__ */ jsx6("div", { className: "space-y-1", children: sortedVersions.map((version, idx) => {
2520
2195
  const isCurrent = idx === 0;
2521
2196
  const isComparing = version.id === compareVersionId;
2522
- return /* @__PURE__ */ jsxs6(
2197
+ return /* @__PURE__ */ jsxs5(
2523
2198
  "div",
2524
2199
  {
2525
2200
  className: `rounded-lg border p-3 transition-colors ${isCurrent ? "border-primary bg-primary/5" : isComparing ? "border-muted-foreground/30 bg-muted/50" : ""}`,
2526
2201
  children: [
2527
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-2", children: [
2528
- /* @__PURE__ */ jsxs6("span", { className: "text-sm font-medium", children: [
2202
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-2", children: [
2203
+ /* @__PURE__ */ jsxs5("span", { className: "text-sm font-medium", children: [
2529
2204
  "v",
2530
2205
  version.version_number
2531
2206
  ] }),
2532
- isCurrent && /* @__PURE__ */ jsx7(Badge4, { variant: "default", className: "text-[10px] px-1.5 py-0", children: "Actual" })
2207
+ isCurrent && /* @__PURE__ */ jsx6(Badge3, { variant: "default", className: "text-[10px] px-1.5 py-0", children: "Actual" })
2533
2208
  ] }),
2534
- /* @__PURE__ */ jsx7("div", { className: "mt-1 text-xs text-muted-foreground", children: formatDate(version.datetime_add) }),
2535
- /* @__PURE__ */ jsxs6("div", { className: "mt-1 flex items-center gap-2 text-xs text-muted-foreground", children: [
2536
- /* @__PURE__ */ jsxs6("span", { children: [
2209
+ /* @__PURE__ */ jsx6("div", { className: "mt-1 text-xs text-muted-foreground", children: formatDate(version.datetime_add) }),
2210
+ /* @__PURE__ */ jsxs5("div", { className: "mt-1 flex items-center gap-2 text-xs text-muted-foreground", children: [
2211
+ /* @__PURE__ */ jsxs5("span", { children: [
2537
2212
  (version.prompt_content ?? "").length,
2538
2213
  " chars"
2539
2214
  ] }),
2540
- /* @__PURE__ */ jsx7("span", { children: "\xB7" }),
2541
- /* @__PURE__ */ jsx7("span", { className: "truncate font-mono", children: (version.prompt_hash ?? "").slice(0, 8) })
2215
+ /* @__PURE__ */ jsx6("span", { children: "\xB7" }),
2216
+ /* @__PURE__ */ jsx6("span", { className: "truncate font-mono", children: (version.prompt_hash ?? "").slice(0, 8) })
2542
2217
  ] }),
2543
- version.change_notes && /* @__PURE__ */ jsx7("div", { className: "mt-1.5 text-xs italic text-muted-foreground", children: version.change_notes }),
2544
- !isCurrent && /* @__PURE__ */ jsxs6("div", { className: "mt-2 flex items-center gap-3", children: [
2545
- /* @__PURE__ */ jsxs6(
2218
+ version.change_notes && /* @__PURE__ */ jsx6("div", { className: "mt-1.5 text-xs italic text-muted-foreground", children: version.change_notes }),
2219
+ !isCurrent && /* @__PURE__ */ jsxs5("div", { className: "mt-2 flex items-center gap-3", children: [
2220
+ /* @__PURE__ */ jsxs5(
2546
2221
  "button",
2547
2222
  {
2548
2223
  type: "button",
2549
2224
  onClick: () => setCompareVersionId(isComparing ? null : version.id),
2550
2225
  className: "flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",
2551
2226
  children: [
2552
- /* @__PURE__ */ jsx7(FileText, { "aria-hidden": "true", className: "h-3 w-3" }),
2227
+ /* @__PURE__ */ jsx6(FileText, { "aria-hidden": "true", className: "h-3 w-3" }),
2553
2228
  isComparing ? "Ocultar diff" : "Comparar"
2554
2229
  ]
2555
2230
  }
2556
2231
  ),
2557
- /* @__PURE__ */ jsxs6(
2232
+ /* @__PURE__ */ jsxs5(
2558
2233
  "button",
2559
2234
  {
2560
2235
  type: "button",
2561
2236
  onClick: () => handleRestore(version),
2562
2237
  className: "flex items-center gap-1 text-xs text-primary hover:underline",
2563
2238
  children: [
2564
- /* @__PURE__ */ jsx7(RotateCcw, { "aria-hidden": "true", className: "h-3 w-3" }),
2239
+ /* @__PURE__ */ jsx6(RotateCcw, { "aria-hidden": "true", className: "h-3 w-3" }),
2565
2240
  "Restaurar"
2566
2241
  ]
2567
2242
  }
@@ -2577,7 +2252,7 @@ function AgentPromptEditor({ config, agent }) {
2577
2252
  }
2578
2253
 
2579
2254
  // src/components/conversations/agent-conversations-table.tsx
2580
- import { useState as useState8 } from "react";
2255
+ import { useState as useState7 } from "react";
2581
2256
  import {
2582
2257
  Table,
2583
2258
  TableBody,
@@ -2585,15 +2260,15 @@ import {
2585
2260
  TableHead,
2586
2261
  TableHeader,
2587
2262
  TableRow,
2588
- Skeleton as Skeleton5,
2589
- Badge as Badge5
2263
+ Skeleton as Skeleton4,
2264
+ Badge as Badge4
2590
2265
  } from "@greatapps/greatauth-ui/ui";
2591
2266
  import { MessageCircle, ExternalLink } from "lucide-react";
2592
2267
 
2593
2268
  // src/components/conversations/conversation-view.tsx
2594
- import { Skeleton as Skeleton4, Button as Button7 } from "@greatapps/greatauth-ui/ui";
2269
+ import { Skeleton as Skeleton3, Button as Button6 } from "@greatapps/greatauth-ui/ui";
2595
2270
  import { X, MessageSquare } from "lucide-react";
2596
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
2271
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
2597
2272
  function formatDateTime(dateStr) {
2598
2273
  if (!dateStr) return "\u2014";
2599
2274
  return new Date(dateStr).toLocaleString("pt-BR");
@@ -2607,68 +2282,68 @@ function ConversationView({
2607
2282
  }) {
2608
2283
  const { data: conversation, isLoading } = useConversation(config, conversationId);
2609
2284
  if (isLoading) {
2610
- return /* @__PURE__ */ jsxs7("div", { className: "rounded-lg border bg-card p-4 space-y-3", children: [
2611
- /* @__PURE__ */ jsx8(Skeleton4, { className: "h-6 w-48" }),
2612
- /* @__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)) })
2285
+ return /* @__PURE__ */ jsxs6("div", { className: "rounded-lg border bg-card p-4 space-y-3", children: [
2286
+ /* @__PURE__ */ jsx7(Skeleton3, { className: "h-6 w-48" }),
2287
+ /* @__PURE__ */ jsx7("div", { className: "grid grid-cols-2 gap-3", children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx7(Skeleton3, { className: "h-10 w-full" }, i)) })
2613
2288
  ] });
2614
2289
  }
2615
2290
  if (!conversation) {
2616
- return /* @__PURE__ */ jsx8("div", { className: "rounded-lg border bg-card p-4", children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between", children: [
2617
- /* @__PURE__ */ jsx8("p", { className: "text-sm text-muted-foreground", children: "Conversa n\xE3o encontrada." }),
2618
- /* @__PURE__ */ jsx8(Button7, { variant: "ghost", size: "icon", "aria-label": "Fechar", onClick: onClose, children: /* @__PURE__ */ jsx8(X, { className: "h-4 w-4" }) })
2291
+ return /* @__PURE__ */ jsx7("div", { className: "rounded-lg border bg-card p-4", children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between", children: [
2292
+ /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "Conversa n\xE3o encontrada." }),
2293
+ /* @__PURE__ */ jsx7(Button6, { variant: "ghost", size: "icon", "aria-label": "Fechar", onClick: onClose, children: /* @__PURE__ */ jsx7(X, { className: "h-4 w-4" }) })
2619
2294
  ] }) });
2620
2295
  }
2621
- return /* @__PURE__ */ jsxs7("div", { className: "rounded-lg border bg-card p-4 space-y-4", children: [
2622
- /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between", children: [
2623
- /* @__PURE__ */ jsxs7("h3", { className: "font-semibold", children: [
2296
+ return /* @__PURE__ */ jsxs6("div", { className: "rounded-lg border bg-card p-4 space-y-4", children: [
2297
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between", children: [
2298
+ /* @__PURE__ */ jsxs6("h3", { className: "font-semibold", children: [
2624
2299
  "Detalhes da conversa #",
2625
2300
  conversation.id
2626
2301
  ] }),
2627
- /* @__PURE__ */ jsx8("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsx8(Button7, { variant: "ghost", size: "icon", "aria-label": "Fechar", onClick: onClose, children: /* @__PURE__ */ jsx8(X, { className: "h-4 w-4" }) }) })
2302
+ /* @__PURE__ */ jsx7("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsx7(Button6, { variant: "ghost", size: "icon", "aria-label": "Fechar", onClick: onClose, children: /* @__PURE__ */ jsx7(X, { className: "h-4 w-4" }) }) })
2628
2303
  ] }),
2629
- 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: [
2630
- /* @__PURE__ */ jsx8(MessageSquare, { className: "mr-2 h-4 w-4" }),
2304
+ conversation.id_external ? renderChatLink ? renderChatLink(conversation.id_external) : /* @__PURE__ */ jsx7(Button6, { variant: "outline", size: "sm", asChild: true, children: /* @__PURE__ */ jsxs6("a", { href: `/gchat/inbox/${conversation.id_external}`, children: [
2305
+ /* @__PURE__ */ jsx7(MessageSquare, { className: "mr-2 h-4 w-4" }),
2631
2306
  "Ver no Chat"
2632
2307
  ] }) }) : null,
2633
- /* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-2 gap-x-6 gap-y-3 text-sm", children: [
2634
- /* @__PURE__ */ jsxs7("div", { children: [
2635
- /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Thread ID" }),
2636
- /* @__PURE__ */ jsx8("p", { className: "font-mono text-xs mt-0.5", children: conversation.openai_thread_id || "\u2014" })
2308
+ /* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-2 gap-x-6 gap-y-3 text-sm", children: [
2309
+ /* @__PURE__ */ jsxs6("div", { children: [
2310
+ /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Thread ID" }),
2311
+ /* @__PURE__ */ jsx7("p", { className: "font-mono text-xs mt-0.5", children: conversation.openai_thread_id || "\u2014" })
2637
2312
  ] }),
2638
- /* @__PURE__ */ jsxs7("div", { children: [
2639
- /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Contato" }),
2640
- /* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: contactsMap?.get(conversation.id_contact) ?? conversation.id_contact })
2313
+ /* @__PURE__ */ jsxs6("div", { children: [
2314
+ /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Contato" }),
2315
+ /* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: contactsMap?.get(conversation.id_contact) ?? conversation.id_contact })
2641
2316
  ] }),
2642
- /* @__PURE__ */ jsxs7("div", { children: [
2643
- /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Agente" }),
2644
- /* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: conversation.id_agent ?? "\u2014" })
2317
+ /* @__PURE__ */ jsxs6("div", { children: [
2318
+ /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Agente" }),
2319
+ /* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: conversation.id_agent ?? "\u2014" })
2645
2320
  ] }),
2646
- /* @__PURE__ */ jsxs7("div", { children: [
2647
- /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Mensagens" }),
2648
- /* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: conversation.message_count ?? "\u2014" })
2321
+ /* @__PURE__ */ jsxs6("div", { children: [
2322
+ /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Mensagens" }),
2323
+ /* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: conversation.message_count ?? "\u2014" })
2649
2324
  ] }),
2650
- /* @__PURE__ */ jsxs7("div", { children: [
2651
- /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Tokens" }),
2652
- /* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: conversation.usage_tokens ?? "\u2014" })
2325
+ /* @__PURE__ */ jsxs6("div", { children: [
2326
+ /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Tokens" }),
2327
+ /* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: conversation.usage_tokens ?? "\u2014" })
2653
2328
  ] }),
2654
- /* @__PURE__ */ jsxs7("div", { children: [
2655
- /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Rota\xE7\xF5es de Thread" }),
2656
- /* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: conversation.rotation_count ?? "\u2014" })
2329
+ /* @__PURE__ */ jsxs6("div", { children: [
2330
+ /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Rota\xE7\xF5es de Thread" }),
2331
+ /* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: conversation.rotation_count ?? "\u2014" })
2657
2332
  ] }),
2658
- /* @__PURE__ */ jsxs7("div", { children: [
2659
- /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Criado em" }),
2660
- /* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: formatDateTime(conversation.datetime_add) })
2333
+ /* @__PURE__ */ jsxs6("div", { children: [
2334
+ /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Criado em" }),
2335
+ /* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: formatDateTime(conversation.datetime_add) })
2661
2336
  ] }),
2662
- /* @__PURE__ */ jsxs7("div", { children: [
2663
- /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Atualizado em" }),
2664
- /* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: formatDateTime(conversation.datetime_alt) })
2337
+ /* @__PURE__ */ jsxs6("div", { children: [
2338
+ /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Atualizado em" }),
2339
+ /* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: formatDateTime(conversation.datetime_alt) })
2665
2340
  ] })
2666
2341
  ] })
2667
2342
  ] });
2668
2343
  }
2669
2344
 
2670
2345
  // src/components/conversations/agent-conversations-table.tsx
2671
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
2346
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
2672
2347
  function formatRelativeDate(dateStr) {
2673
2348
  if (!dateStr) return "\u2014";
2674
2349
  const date = new Date(dateStr);
@@ -2691,29 +2366,29 @@ function AgentConversationsTable({
2691
2366
  config,
2692
2367
  renderChatLink
2693
2368
  }) {
2694
- const [selectedId, setSelectedId] = useState8(null);
2369
+ const [selectedId, setSelectedId] = useState7(null);
2695
2370
  if (isLoading) {
2696
- return /* @__PURE__ */ jsx9("div", { className: "space-y-3", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx9(Skeleton5, { className: "h-12 w-full" }, i)) });
2371
+ return /* @__PURE__ */ jsx8("div", { className: "space-y-3", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx8(Skeleton4, { className: "h-12 w-full" }, i)) });
2697
2372
  }
2698
2373
  if (conversations.length === 0) {
2699
- return /* @__PURE__ */ jsxs8("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
2700
- /* @__PURE__ */ jsx9(MessageCircle, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
2701
- /* @__PURE__ */ jsx9("p", { className: "text-sm text-muted-foreground", children: "Nenhuma conversa encontrada." })
2374
+ return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
2375
+ /* @__PURE__ */ jsx8(MessageCircle, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
2376
+ /* @__PURE__ */ jsx8("p", { className: "text-sm text-muted-foreground", children: "Nenhuma conversa encontrada." })
2702
2377
  ] });
2703
2378
  }
2704
- return /* @__PURE__ */ jsxs8("div", { className: "space-y-4", children: [
2705
- /* @__PURE__ */ jsxs8(Table, { children: [
2706
- /* @__PURE__ */ jsx9(TableHeader, { children: /* @__PURE__ */ jsxs8(TableRow, { children: [
2707
- /* @__PURE__ */ jsx9(TableHead, { children: "ID" }),
2708
- /* @__PURE__ */ jsx9(TableHead, { children: "Contato" }),
2709
- /* @__PURE__ */ jsx9(TableHead, { children: "Objetivo" }),
2710
- /* @__PURE__ */ jsx9(TableHead, { className: "text-right", children: "Mensagens" }),
2711
- /* @__PURE__ */ jsx9(TableHead, { className: "text-right", children: "Tokens" }),
2712
- /* @__PURE__ */ jsx9(TableHead, { children: "Criado em" }),
2713
- /* @__PURE__ */ jsx9(TableHead, { children: "Atualizado em" }),
2714
- /* @__PURE__ */ jsx9(TableHead, { className: "w-10" })
2379
+ return /* @__PURE__ */ jsxs7("div", { className: "space-y-4", children: [
2380
+ /* @__PURE__ */ jsxs7(Table, { children: [
2381
+ /* @__PURE__ */ jsx8(TableHeader, { children: /* @__PURE__ */ jsxs7(TableRow, { children: [
2382
+ /* @__PURE__ */ jsx8(TableHead, { children: "ID" }),
2383
+ /* @__PURE__ */ jsx8(TableHead, { children: "Contato" }),
2384
+ /* @__PURE__ */ jsx8(TableHead, { children: "Objetivo" }),
2385
+ /* @__PURE__ */ jsx8(TableHead, { className: "text-right", children: "Mensagens" }),
2386
+ /* @__PURE__ */ jsx8(TableHead, { className: "text-right", children: "Tokens" }),
2387
+ /* @__PURE__ */ jsx8(TableHead, { children: "Criado em" }),
2388
+ /* @__PURE__ */ jsx8(TableHead, { children: "Atualizado em" }),
2389
+ /* @__PURE__ */ jsx8(TableHead, { className: "w-10" })
2715
2390
  ] }) }),
2716
- /* @__PURE__ */ jsx9(TableBody, { children: conversations.map((conversation) => /* @__PURE__ */ jsxs8(
2391
+ /* @__PURE__ */ jsx8(TableBody, { children: conversations.map((conversation) => /* @__PURE__ */ jsxs7(
2717
2392
  TableRow,
2718
2393
  {
2719
2394
  className: "cursor-pointer",
@@ -2732,14 +2407,14 @@ function AgentConversationsTable({
2732
2407
  },
2733
2408
  "data-state": selectedId === conversation.id ? "selected" : void 0,
2734
2409
  children: [
2735
- /* @__PURE__ */ jsx9(TableCell, { className: "font-mono text-xs", children: conversation.id }),
2736
- /* @__PURE__ */ jsx9(TableCell, { children: contactsMap?.get(conversation.id_contact) ?? conversation.id_contact }),
2737
- /* @__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" }) }),
2738
- /* @__PURE__ */ jsx9(TableCell, { className: "text-right tabular-nums", children: conversation.message_count ?? "\u2014" }),
2739
- /* @__PURE__ */ jsx9(TableCell, { className: "text-right tabular-nums", children: conversation.usage_tokens ?? "\u2014" }),
2740
- /* @__PURE__ */ jsx9(TableCell, { children: new Date(conversation.datetime_add).toLocaleDateString("pt-BR") }),
2741
- /* @__PURE__ */ jsx9(TableCell, { children: formatRelativeDate(conversation.datetime_alt) }),
2742
- /* @__PURE__ */ jsx9(TableCell, { children: conversation.id_external ? renderChatLink ? /* @__PURE__ */ jsx9("span", { onClick: (e) => e.stopPropagation(), children: renderChatLink(conversation.id_external) }) : /* @__PURE__ */ jsx9(
2410
+ /* @__PURE__ */ jsx8(TableCell, { className: "font-mono text-xs", children: conversation.id }),
2411
+ /* @__PURE__ */ jsx8(TableCell, { children: contactsMap?.get(conversation.id_contact) ?? conversation.id_contact }),
2412
+ /* @__PURE__ */ jsx8(TableCell, { children: conversation.id_objective && objectivesMap?.get(conversation.id_objective) ? /* @__PURE__ */ jsx8(Badge4, { variant: "secondary", className: "text-xs", children: objectivesMap.get(conversation.id_objective) }) : /* @__PURE__ */ jsx8("span", { className: "text-xs text-muted-foreground", children: "\u2014" }) }),
2413
+ /* @__PURE__ */ jsx8(TableCell, { className: "text-right tabular-nums", children: conversation.message_count ?? "\u2014" }),
2414
+ /* @__PURE__ */ jsx8(TableCell, { className: "text-right tabular-nums", children: conversation.usage_tokens ?? "\u2014" }),
2415
+ /* @__PURE__ */ jsx8(TableCell, { children: new Date(conversation.datetime_add).toLocaleDateString("pt-BR") }),
2416
+ /* @__PURE__ */ jsx8(TableCell, { children: formatRelativeDate(conversation.datetime_alt) }),
2417
+ /* @__PURE__ */ jsx8(TableCell, { children: conversation.id_external ? renderChatLink ? /* @__PURE__ */ jsx8("span", { onClick: (e) => e.stopPropagation(), children: renderChatLink(conversation.id_external) }) : /* @__PURE__ */ jsx8(
2743
2418
  "a",
2744
2419
  {
2745
2420
  href: `/gchat/inbox/${conversation.id_external}`,
@@ -2747,7 +2422,7 @@ function AgentConversationsTable({
2747
2422
  "aria-label": "Ver no Chat",
2748
2423
  onClick: (e) => e.stopPropagation(),
2749
2424
  className: "inline-flex items-center justify-center rounded-md p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",
2750
- children: /* @__PURE__ */ jsx9(ExternalLink, { className: "h-4 w-4" })
2425
+ children: /* @__PURE__ */ jsx8(ExternalLink, { className: "h-4 w-4" })
2751
2426
  }
2752
2427
  ) : null })
2753
2428
  ]
@@ -2755,7 +2430,7 @@ function AgentConversationsTable({
2755
2430
  conversation.id
2756
2431
  )) })
2757
2432
  ] }),
2758
- selectedId && /* @__PURE__ */ jsx9(
2433
+ selectedId && /* @__PURE__ */ jsx8(
2759
2434
  ConversationView,
2760
2435
  {
2761
2436
  conversationId: selectedId,
@@ -2769,7 +2444,7 @@ function AgentConversationsTable({
2769
2444
  }
2770
2445
 
2771
2446
  // src/components/conversations/agent-conversations-panel.tsx
2772
- import { jsx as jsx10 } from "react/jsx-runtime";
2447
+ import { jsx as jsx9 } from "react/jsx-runtime";
2773
2448
  function AgentConversationsPanel({
2774
2449
  agent,
2775
2450
  config,
@@ -2788,7 +2463,7 @@ function AgentConversationsPanel({
2788
2463
  const objectivesMap = new Map(
2789
2464
  (objectivesData?.data || []).map((o) => [o.id, o.title])
2790
2465
  );
2791
- return /* @__PURE__ */ jsx10("div", { className: "p-4", children: /* @__PURE__ */ jsx10(
2466
+ return /* @__PURE__ */ jsx9("div", { className: "p-4", children: /* @__PURE__ */ jsx9(
2792
2467
  AgentConversationsTable,
2793
2468
  {
2794
2469
  conversations,
@@ -2802,27 +2477,27 @@ function AgentConversationsPanel({
2802
2477
  }
2803
2478
 
2804
2479
  // src/pages/agent-capabilities-page.tsx
2805
- import { useState as useState15, useCallback as useCallback6 } from "react";
2480
+ import { useState as useState14, useCallback as useCallback6 } from "react";
2806
2481
  import {
2807
2482
  Tabs,
2808
2483
  TabsList,
2809
2484
  TabsTrigger,
2810
2485
  TabsContent
2811
2486
  } from "@greatapps/greatauth-ui/ui";
2812
- import { Blocks, Plug as Plug3, Settings as Settings4 } from "lucide-react";
2487
+ import { Blocks, Plug as Plug3, Settings as Settings3 } from "lucide-react";
2813
2488
 
2814
2489
  // src/components/capabilities/capabilities-tab.tsx
2815
- import { useState as useState9, useCallback as useCallback4, useRef as useRef2, useEffect as useEffect4, useMemo as useMemo5 } from "react";
2490
+ import { useState as useState8, useCallback as useCallback4, useRef as useRef2, useEffect as useEffect4, useMemo as useMemo5 } from "react";
2816
2491
  import {
2817
2492
  Accordion,
2818
2493
  AccordionItem,
2819
2494
  AccordionTrigger,
2820
2495
  AccordionContent,
2821
- Switch as Switch5,
2496
+ Switch as Switch4,
2822
2497
  Checkbox,
2823
- Badge as Badge6,
2824
- Button as Button8,
2825
- Skeleton as Skeleton6
2498
+ Badge as Badge5,
2499
+ Button as Button7,
2500
+ Skeleton as Skeleton5
2826
2501
  } from "@greatapps/greatauth-ui/ui";
2827
2502
  import {
2828
2503
  Calendar,
@@ -2832,8 +2507,8 @@ import {
2832
2507
  Package,
2833
2508
  ChevronDown as ChevronDown2
2834
2509
  } from "lucide-react";
2835
- import { toast as toast7 } from "sonner";
2836
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2510
+ import { toast as toast6 } from "sonner";
2511
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
2837
2512
  var OPERATION_LABELS = {
2838
2513
  list: "Listar",
2839
2514
  view: "Visualizar",
@@ -2888,9 +2563,9 @@ function CapabilitiesTab({ config, agentId }) {
2888
2563
  const { data: registry, isLoading: isLoadingRegistry } = useCapabilities(config);
2889
2564
  const { data: agentCaps, isLoading: isLoadingAgent } = useAgentCapabilities(config, agentId);
2890
2565
  const updateMutation = useUpdateAgentCapabilities(config);
2891
- const [localState, setLocalState] = useState9(/* @__PURE__ */ new Map());
2892
- const [serverState, setServerState] = useState9(/* @__PURE__ */ new Map());
2893
- const [initialized, setInitialized] = useState9(false);
2566
+ const [localState, setLocalState] = useState8(/* @__PURE__ */ new Map());
2567
+ const [serverState, setServerState] = useState8(/* @__PURE__ */ new Map());
2568
+ const [initialized, setInitialized] = useState8(false);
2894
2569
  const debounceRef = useRef2(null);
2895
2570
  useEffect4(() => {
2896
2571
  if (agentCaps && !initialized) {
@@ -2917,11 +2592,11 @@ function CapabilitiesTab({ config, agentId }) {
2917
2592
  {
2918
2593
  onSuccess: () => {
2919
2594
  setServerState(cloneState(nextState));
2920
- toast7.success("Capacidades salvas");
2595
+ toast6.success("Capacidades salvas");
2921
2596
  },
2922
2597
  onError: () => {
2923
2598
  setLocalState(cloneState(serverState));
2924
- toast7.error("Erro ao salvar capacidades");
2599
+ toast6.error("Erro ao salvar capacidades");
2925
2600
  }
2926
2601
  }
2927
2602
  );
@@ -3000,11 +2675,11 @@ function CapabilitiesTab({ config, agentId }) {
3000
2675
  {
3001
2676
  onSuccess: () => {
3002
2677
  setServerState(cloneState(localState));
3003
- toast7.success("Capacidades salvas");
2678
+ toast6.success("Capacidades salvas");
3004
2679
  },
3005
2680
  onError: () => {
3006
2681
  setLocalState(cloneState(serverState));
3007
- toast7.error("Erro ao salvar capacidades");
2682
+ toast6.error("Erro ao salvar capacidades");
3008
2683
  }
3009
2684
  }
3010
2685
  );
@@ -3013,51 +2688,51 @@ function CapabilitiesTab({ config, agentId }) {
3013
2688
  return cat.modules.filter((m) => (localState.get(m.slug)?.size ?? 0) > 0).length;
3014
2689
  }
3015
2690
  if (isLoadingRegistry || isLoadingAgent) {
3016
- return /* @__PURE__ */ jsx11("div", { className: "space-y-3", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsx11(Skeleton6, { className: "h-14 w-full" }, i)) });
2691
+ return /* @__PURE__ */ jsx10("div", { className: "space-y-3", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsx10(Skeleton5, { className: "h-14 w-full" }, i)) });
3017
2692
  }
3018
2693
  if (!registry || !registry.categories.length) {
3019
- return /* @__PURE__ */ jsxs9("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [
3020
- /* @__PURE__ */ jsx11(Package, { className: "h-12 w-12 text-muted-foreground mb-3" }),
3021
- /* @__PURE__ */ jsx11("h3", { className: "text-base font-medium", children: "Nenhuma capacidade dispon\xEDvel" }),
3022
- /* @__PURE__ */ jsx11("p", { className: "text-sm text-muted-foreground mt-1 max-w-sm", children: "Este produto ainda n\xE3o possui capacidades registadas. As capacidades ser\xE3o adicionadas automaticamente quando o produto for configurado." })
2694
+ return /* @__PURE__ */ jsxs8("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [
2695
+ /* @__PURE__ */ jsx10(Package, { className: "h-12 w-12 text-muted-foreground mb-3" }),
2696
+ /* @__PURE__ */ jsx10("h3", { className: "text-base font-medium", children: "Nenhuma capacidade dispon\xEDvel" }),
2697
+ /* @__PURE__ */ jsx10("p", { className: "text-sm text-muted-foreground mt-1 max-w-sm", children: "Este produto ainda n\xE3o possui capacidades registadas. As capacidades ser\xE3o adicionadas automaticamente quando o produto for configurado." })
3023
2698
  ] });
3024
2699
  }
3025
- return /* @__PURE__ */ jsxs9("div", { className: "space-y-4", children: [
3026
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between", children: [
3027
- /* @__PURE__ */ jsxs9("div", { children: [
3028
- /* @__PURE__ */ jsx11("h3", { className: "text-sm font-medium", children: "Capacidades do agente" }),
3029
- /* @__PURE__ */ jsx11("p", { className: "text-xs text-muted-foreground mt-0.5", children: "Ative ou desative m\xF3dulos e opera\xE7\xF5es dispon\xEDveis para este agente." })
2700
+ return /* @__PURE__ */ jsxs8("div", { className: "space-y-4", children: [
2701
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between", children: [
2702
+ /* @__PURE__ */ jsxs8("div", { children: [
2703
+ /* @__PURE__ */ jsx10("h3", { className: "text-sm font-medium", children: "Capacidades do agente" }),
2704
+ /* @__PURE__ */ jsx10("p", { className: "text-xs text-muted-foreground mt-0.5", children: "Ative ou desative m\xF3dulos e opera\xE7\xF5es dispon\xEDveis para este agente." })
3030
2705
  ] }),
3031
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
3032
- /* @__PURE__ */ jsx11(Button8, { variant: "outline", size: "sm", onClick: enableAll, children: "Ativar tudo" }),
3033
- /* @__PURE__ */ jsx11(Button8, { variant: "outline", size: "sm", onClick: disableAll, children: "Desativar tudo" })
2706
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
2707
+ /* @__PURE__ */ jsx10(Button7, { variant: "outline", size: "sm", onClick: enableAll, children: "Ativar tudo" }),
2708
+ /* @__PURE__ */ jsx10(Button7, { variant: "outline", size: "sm", onClick: disableAll, children: "Desativar tudo" })
3034
2709
  ] })
3035
2710
  ] }),
3036
- /* @__PURE__ */ jsx11(Accordion, { type: "multiple", className: "space-y-2", children: registry.categories.map((cat) => {
2711
+ /* @__PURE__ */ jsx10(Accordion, { type: "multiple", className: "space-y-2", children: registry.categories.map((cat) => {
3037
2712
  const Icon = getCategoryIcon(cat.slug);
3038
2713
  const activeCount = countActiveModules(cat);
3039
2714
  const totalModules = cat.modules.length;
3040
- return /* @__PURE__ */ jsxs9(
2715
+ return /* @__PURE__ */ jsxs8(
3041
2716
  AccordionItem,
3042
2717
  {
3043
2718
  value: cat.slug,
3044
2719
  className: "border rounded-lg px-4",
3045
2720
  children: [
3046
- /* @__PURE__ */ jsx11(AccordionTrigger, { className: "hover:no-underline py-3", children: /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-3 flex-1", children: [
3047
- /* @__PURE__ */ jsx11(Icon, { className: "h-4 w-4 text-muted-foreground" }),
3048
- /* @__PURE__ */ jsx11("span", { className: "font-medium text-sm", children: cat.label }),
3049
- /* @__PURE__ */ jsxs9(Badge6, { variant: "secondary", className: "text-xs", children: [
2721
+ /* @__PURE__ */ jsx10(AccordionTrigger, { className: "hover:no-underline py-3", children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3 flex-1", children: [
2722
+ /* @__PURE__ */ jsx10(Icon, { className: "h-4 w-4 text-muted-foreground" }),
2723
+ /* @__PURE__ */ jsx10("span", { className: "font-medium text-sm", children: cat.label }),
2724
+ /* @__PURE__ */ jsxs8(Badge5, { variant: "secondary", className: "text-xs", children: [
3050
2725
  activeCount,
3051
2726
  " de ",
3052
2727
  totalModules,
3053
2728
  " m\xF3dulos ativos"
3054
2729
  ] })
3055
2730
  ] }) }),
3056
- /* @__PURE__ */ jsx11(AccordionContent, { className: "pb-3", children: /* @__PURE__ */ jsx11("div", { className: "space-y-1", children: cat.modules.map((mod) => {
2731
+ /* @__PURE__ */ jsx10(AccordionContent, { className: "pb-3 !h-auto", children: /* @__PURE__ */ jsx10("div", { className: "space-y-1", children: cat.modules.map((mod) => {
3057
2732
  const enabledOps = localState.get(mod.slug);
3058
2733
  const isModuleOn = (enabledOps?.size ?? 0) > 0;
3059
2734
  const allOpsEnabled = enabledOps?.size === mod.operations.length;
3060
- return /* @__PURE__ */ jsx11(
2735
+ return /* @__PURE__ */ jsx10(
3061
2736
  ModuleRow,
3062
2737
  {
3063
2738
  module: mod,
@@ -3075,12 +2750,12 @@ function CapabilitiesTab({ config, agentId }) {
3075
2750
  cat.slug
3076
2751
  );
3077
2752
  }) }),
3078
- hasChanges && /* @__PURE__ */ jsxs9("div", { className: "sticky bottom-0 bg-background border-t py-3 px-4 -mx-4 flex items-center justify-between", children: [
3079
- /* @__PURE__ */ jsx11("span", { className: "text-sm text-muted-foreground", children: "Voc\xEA tem altera\xE7\xF5es n\xE3o salvas." }),
3080
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
3081
- /* @__PURE__ */ jsx11(Button8, { variant: "outline", size: "sm", onClick: discard, children: "Descartar" }),
3082
- /* @__PURE__ */ jsx11(
3083
- Button8,
2753
+ hasChanges && /* @__PURE__ */ jsxs8("div", { className: "sticky bottom-0 bg-background border-t py-3 px-4 -mx-4 flex items-center justify-between", children: [
2754
+ /* @__PURE__ */ jsx10("span", { className: "text-sm text-muted-foreground", children: "Voc\xEA tem altera\xE7\xF5es n\xE3o salvas." }),
2755
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
2756
+ /* @__PURE__ */ jsx10(Button7, { variant: "outline", size: "sm", onClick: discard, children: "Descartar" }),
2757
+ /* @__PURE__ */ jsx10(
2758
+ Button7,
3084
2759
  {
3085
2760
  size: "sm",
3086
2761
  onClick: saveNow,
@@ -3099,10 +2774,10 @@ function ModuleRow({
3099
2774
  onToggleModule,
3100
2775
  onToggleOperation
3101
2776
  }) {
3102
- const [expanded, setExpanded] = useState9(false);
3103
- return /* @__PURE__ */ jsxs9("div", { className: "rounded-md border px-3 py-2", children: [
3104
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between", children: [
3105
- /* @__PURE__ */ jsxs9(
2777
+ const [expanded, setExpanded] = useState8(false);
2778
+ return /* @__PURE__ */ jsxs8("div", { className: "rounded-md border px-3 py-2", children: [
2779
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between", children: [
2780
+ /* @__PURE__ */ jsxs8(
3106
2781
  "button",
3107
2782
  {
3108
2783
  type: "button",
@@ -3111,18 +2786,18 @@ function ModuleRow({
3111
2786
  "aria-expanded": expanded,
3112
2787
  "aria-label": `Expandir ${mod.label}`,
3113
2788
  children: [
3114
- /* @__PURE__ */ jsx11(
2789
+ /* @__PURE__ */ jsx10(
3115
2790
  ChevronDown2,
3116
2791
  {
3117
2792
  className: `h-3.5 w-3.5 text-muted-foreground transition-transform ${expanded ? "rotate-0" : "-rotate-90"}`
3118
2793
  }
3119
2794
  ),
3120
- /* @__PURE__ */ jsx11("span", { className: "text-sm font-medium", children: mod.label }),
3121
- mod.description && /* @__PURE__ */ jsxs9("span", { className: "text-xs text-muted-foreground hidden sm:inline", children: [
2795
+ /* @__PURE__ */ jsx10("span", { className: "text-sm font-medium", children: mod.label }),
2796
+ mod.description && /* @__PURE__ */ jsxs8("span", { className: "text-xs text-muted-foreground hidden sm:inline", children: [
3122
2797
  "\u2014 ",
3123
2798
  mod.description
3124
2799
  ] }),
3125
- isOn && /* @__PURE__ */ jsxs9(Badge6, { variant: "secondary", className: "text-xs ml-1", children: [
2800
+ isOn && /* @__PURE__ */ jsxs8(Badge5, { variant: "secondary", className: "text-xs ml-1", children: [
3126
2801
  enabledOps.size,
3127
2802
  "/",
3128
2803
  mod.operations.length
@@ -3130,8 +2805,8 @@ function ModuleRow({
3130
2805
  ]
3131
2806
  }
3132
2807
  ),
3133
- /* @__PURE__ */ jsx11(
3134
- Switch5,
2808
+ /* @__PURE__ */ jsx10(
2809
+ Switch4,
3135
2810
  {
3136
2811
  checked: isOn,
3137
2812
  onCheckedChange: onToggleModule,
@@ -3139,14 +2814,14 @@ function ModuleRow({
3139
2814
  }
3140
2815
  )
3141
2816
  ] }),
3142
- expanded && /* @__PURE__ */ jsx11("div", { className: "mt-2 ml-6 flex flex-wrap gap-x-5 gap-y-1.5 pb-1", children: mod.operations.map((op) => {
2817
+ expanded && /* @__PURE__ */ jsx10("div", { className: "mt-2 ml-6 flex flex-wrap gap-x-5 gap-y-1.5 pb-1", children: mod.operations.map((op) => {
3143
2818
  const checked = enabledOps.has(op);
3144
- return /* @__PURE__ */ jsxs9(
2819
+ return /* @__PURE__ */ jsxs8(
3145
2820
  "label",
3146
2821
  {
3147
2822
  className: "flex items-center gap-1.5 text-sm cursor-pointer",
3148
2823
  children: [
3149
- /* @__PURE__ */ jsx11(
2824
+ /* @__PURE__ */ jsx10(
3150
2825
  Checkbox,
3151
2826
  {
3152
2827
  checked,
@@ -3154,7 +2829,7 @@ function ModuleRow({
3154
2829
  "aria-label": `${getOperationLabel(op)} em ${mod.label}`
3155
2830
  }
3156
2831
  ),
3157
- /* @__PURE__ */ jsx11("span", { className: checked ? "" : "text-muted-foreground", children: getOperationLabel(op) })
2832
+ /* @__PURE__ */ jsx10("span", { className: checked ? "" : "text-muted-foreground", children: getOperationLabel(op) })
3158
2833
  ]
3159
2834
  },
3160
2835
  op
@@ -3164,20 +2839,20 @@ function ModuleRow({
3164
2839
  }
3165
2840
 
3166
2841
  // src/components/capabilities/integration-card.tsx
3167
- import { Badge as Badge7, Button as Button9, Tooltip as Tooltip2, TooltipContent as TooltipContent2, TooltipTrigger as TooltipTrigger2 } from "@greatapps/greatauth-ui/ui";
2842
+ import { Badge as Badge6, Button as Button8, Tooltip as Tooltip2, TooltipContent as TooltipContent2, TooltipTrigger as TooltipTrigger2 } from "@greatapps/greatauth-ui/ui";
3168
2843
  import {
3169
2844
  CalendarSync,
3170
2845
  Plug,
3171
- Settings as Settings3,
2846
+ Settings as Settings2,
3172
2847
  RefreshCw,
3173
2848
  Users as Users2,
3174
2849
  Clock
3175
2850
  } from "lucide-react";
3176
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2851
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
3177
2852
  var ICON_MAP = {
3178
2853
  CalendarSync,
3179
2854
  Plug,
3180
- Settings: Settings3,
2855
+ Settings: Settings2,
3181
2856
  RefreshCw,
3182
2857
  Users: Users2,
3183
2858
  Clock
@@ -3221,7 +2896,7 @@ function IntegrationCard({ card, onConnect }) {
3221
2896
  const badge = STATE_BADGES[state];
3222
2897
  const actionLabel = getActionLabel(state);
3223
2898
  const isComingSoon = state === "coming_soon";
3224
- return /* @__PURE__ */ jsxs10(
2899
+ return /* @__PURE__ */ jsxs9(
3225
2900
  "div",
3226
2901
  {
3227
2902
  className: cn(
@@ -3240,24 +2915,24 @@ function IntegrationCard({ card, onConnect }) {
3240
2915
  }
3241
2916
  },
3242
2917
  children: [
3243
- /* @__PURE__ */ jsxs10("div", { className: "flex items-start justify-between gap-2", children: [
3244
- /* @__PURE__ */ jsx12("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: /* @__PURE__ */ jsx12(Icon, { className: "h-5 w-5" }) }),
3245
- /* @__PURE__ */ jsx12(Badge7, { variant: "outline", className: cn("text-xs", badge.className), children: badge.label })
2918
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-start justify-between gap-2", children: [
2919
+ /* @__PURE__ */ jsx11("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: /* @__PURE__ */ jsx11(Icon, { className: "h-5 w-5" }) }),
2920
+ /* @__PURE__ */ jsx11(Badge6, { variant: "outline", className: cn("text-xs", badge.className), children: badge.label })
3246
2921
  ] }),
3247
- /* @__PURE__ */ jsxs10("div", { className: "space-y-1", children: [
3248
- /* @__PURE__ */ jsx12("h3", { className: "text-sm font-semibold leading-tight", children: definition.name }),
3249
- /* @__PURE__ */ jsx12("p", { className: "text-xs text-muted-foreground leading-relaxed", children: definition.description })
2922
+ /* @__PURE__ */ jsxs9("div", { className: "space-y-1", children: [
2923
+ /* @__PURE__ */ jsx11("h3", { className: "text-sm font-semibold leading-tight", children: definition.name }),
2924
+ /* @__PURE__ */ jsx11("p", { className: "text-xs text-muted-foreground leading-relaxed", children: definition.description })
3250
2925
  ] }),
3251
- /* @__PURE__ */ jsxs10("div", { className: "mt-auto flex items-center justify-between gap-2 pt-1", children: [
3252
- sharedByAgentsCount > 0 ? /* @__PURE__ */ jsxs10(Tooltip2, { children: [
3253
- /* @__PURE__ */ jsx12(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs10("span", { className: "inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400", children: [
3254
- /* @__PURE__ */ jsx12(Users2, { className: "h-3.5 w-3.5" }),
2926
+ /* @__PURE__ */ jsxs9("div", { className: "mt-auto flex items-center justify-between gap-2 pt-1", children: [
2927
+ sharedByAgentsCount > 0 ? /* @__PURE__ */ jsxs9(Tooltip2, { children: [
2928
+ /* @__PURE__ */ jsx11(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs9("span", { className: "inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400", children: [
2929
+ /* @__PURE__ */ jsx11(Users2, { className: "h-3.5 w-3.5" }),
3255
2930
  "Compartilhada"
3256
2931
  ] }) }),
3257
- /* @__PURE__ */ jsx12(TooltipContent2, { children: "Esta credencial est\xE1 dispon\xEDvel para todos os agentes da conta" })
3258
- ] }) : /* @__PURE__ */ jsx12("span", {}),
3259
- !isComingSoon && /* @__PURE__ */ jsx12(
3260
- Button9,
2932
+ /* @__PURE__ */ jsx11(TooltipContent2, { children: "Esta credencial est\xE1 dispon\xEDvel para todos os agentes da conta" })
2933
+ ] }) : /* @__PURE__ */ jsx11("span", {}),
2934
+ !isComingSoon && /* @__PURE__ */ jsx11(
2935
+ Button8,
3261
2936
  {
3262
2937
  variant: state === "expired" ? "destructive" : "outline",
3263
2938
  size: "sm",
@@ -3277,7 +2952,7 @@ function IntegrationCard({ card, onConnect }) {
3277
2952
 
3278
2953
  // src/components/capabilities/integrations-tab.tsx
3279
2954
  import { Plug as Plug2, Loader2 as Loader24 } from "lucide-react";
3280
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
2955
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
3281
2956
  function IntegrationsTab({
3282
2957
  config,
3283
2958
  agentId,
@@ -3285,15 +2960,15 @@ function IntegrationsTab({
3285
2960
  }) {
3286
2961
  const { cards, isLoading } = useIntegrationState(config, agentId);
3287
2962
  if (isLoading) {
3288
- return /* @__PURE__ */ jsx13("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ jsx13(Loader24, { className: "h-6 w-6 animate-spin text-muted-foreground" }) });
2963
+ return /* @__PURE__ */ jsx12("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ jsx12(Loader24, { className: "h-6 w-6 animate-spin text-muted-foreground" }) });
3289
2964
  }
3290
2965
  if (cards.length === 0) {
3291
- return /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center justify-center gap-3 py-16 text-muted-foreground", children: [
3292
- /* @__PURE__ */ jsx13(Plug2, { className: "h-10 w-10" }),
3293
- /* @__PURE__ */ jsx13("p", { className: "text-sm", children: "Nenhuma integra\xE7\xE3o dispon\xEDvel" })
2966
+ return /* @__PURE__ */ jsxs10("div", { className: "flex flex-col items-center justify-center gap-3 py-16 text-muted-foreground", children: [
2967
+ /* @__PURE__ */ jsx12(Plug2, { className: "h-10 w-10" }),
2968
+ /* @__PURE__ */ jsx12("p", { className: "text-sm", children: "Nenhuma integra\xE7\xE3o dispon\xEDvel" })
3294
2969
  ] });
3295
2970
  }
3296
- return /* @__PURE__ */ jsx13("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3", children: cards.map((card) => /* @__PURE__ */ jsx13(
2971
+ return /* @__PURE__ */ jsx12("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3", children: cards.map((card) => /* @__PURE__ */ jsx12(
3297
2972
  IntegrationCard,
3298
2973
  {
3299
2974
  card,
@@ -3304,43 +2979,43 @@ function IntegrationsTab({
3304
2979
  }
3305
2980
 
3306
2981
  // src/components/capabilities/integration-wizard.tsx
3307
- import { useCallback as useCallback5, useEffect as useEffect5, useRef as useRef3, useState as useState10 } from "react";
2982
+ import { useCallback as useCallback5, useEffect as useEffect5, useRef as useRef3, useState as useState9 } from "react";
3308
2983
  import {
3309
- Dialog as Dialog5,
3310
- DialogContent as DialogContent5,
3311
- DialogFooter as DialogFooter5,
3312
- DialogHeader as DialogHeader5,
3313
- DialogTitle as DialogTitle5,
3314
- Button as Button11
2984
+ Dialog as Dialog4,
2985
+ DialogContent as DialogContent4,
2986
+ DialogFooter as DialogFooter4,
2987
+ DialogHeader as DialogHeader4,
2988
+ DialogTitle as DialogTitle4,
2989
+ Button as Button10
3315
2990
  } from "@greatapps/greatauth-ui/ui";
3316
2991
  import { Loader2 as Loader27, ChevronLeft, ChevronRight, Check as Check2 } from "lucide-react";
3317
- import { toast as toast8 } from "sonner";
2992
+ import { toast as toast7 } from "sonner";
3318
2993
 
3319
2994
  // src/components/capabilities/wizard-steps/info-step.tsx
3320
2995
  import { Check, Info } from "lucide-react";
3321
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2996
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
3322
2997
  function InfoStep({ integration, meta }) {
3323
- return /* @__PURE__ */ jsxs12("div", { className: "space-y-6", children: [
3324
- /* @__PURE__ */ jsxs12("div", { className: "flex items-start gap-4", children: [
3325
- meta.icon && /* @__PURE__ */ jsx14("div", { className: "flex h-12 w-12 shrink-0 items-center justify-center rounded-lg bg-muted", children: meta.icon }),
3326
- /* @__PURE__ */ jsxs12("div", { className: "space-y-1", children: [
3327
- /* @__PURE__ */ jsx14("h3", { className: "text-lg font-semibold", children: integration.name }),
3328
- /* @__PURE__ */ jsx14("p", { className: "text-sm text-muted-foreground", children: integration.description })
2998
+ return /* @__PURE__ */ jsxs11("div", { className: "space-y-6", children: [
2999
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-start gap-4", children: [
3000
+ meta.icon && /* @__PURE__ */ jsx13("div", { className: "flex h-12 w-12 shrink-0 items-center justify-center rounded-lg bg-muted", children: meta.icon }),
3001
+ /* @__PURE__ */ jsxs11("div", { className: "space-y-1", children: [
3002
+ /* @__PURE__ */ jsx13("h3", { className: "text-lg font-semibold", children: integration.name }),
3003
+ /* @__PURE__ */ jsx13("p", { className: "text-sm text-muted-foreground", children: integration.description })
3329
3004
  ] })
3330
3005
  ] }),
3331
- meta.capabilities.length > 0 && /* @__PURE__ */ jsxs12("div", { className: "space-y-3", children: [
3332
- /* @__PURE__ */ jsx14("h4", { className: "text-sm font-medium", children: "O que esta integra\xE7\xE3o permite:" }),
3333
- /* @__PURE__ */ jsx14("ul", { className: "space-y-2", children: meta.capabilities.map((cap, i) => /* @__PURE__ */ jsxs12("li", { className: "flex items-start gap-2 text-sm", children: [
3334
- /* @__PURE__ */ jsx14(
3006
+ meta.capabilities.length > 0 && /* @__PURE__ */ jsxs11("div", { className: "space-y-3", children: [
3007
+ /* @__PURE__ */ jsx13("h4", { className: "text-sm font-medium", children: "O que esta integra\xE7\xE3o permite:" }),
3008
+ /* @__PURE__ */ jsx13("ul", { className: "space-y-2", children: meta.capabilities.map((cap, i) => /* @__PURE__ */ jsxs11("li", { className: "flex items-start gap-2 text-sm", children: [
3009
+ /* @__PURE__ */ jsx13(
3335
3010
  Check,
3336
3011
  {
3337
3012
  "aria-hidden": "true",
3338
3013
  className: "mt-0.5 h-4 w-4 shrink-0 text-green-600"
3339
3014
  }
3340
3015
  ),
3341
- /* @__PURE__ */ jsxs12("div", { children: [
3342
- /* @__PURE__ */ jsx14("span", { className: "font-medium", children: cap.label }),
3343
- cap.description && /* @__PURE__ */ jsxs12("span", { className: "text-muted-foreground", children: [
3016
+ /* @__PURE__ */ jsxs11("div", { children: [
3017
+ /* @__PURE__ */ jsx13("span", { className: "font-medium", children: cap.label }),
3018
+ cap.description && /* @__PURE__ */ jsxs11("span", { className: "text-muted-foreground", children: [
3344
3019
  " ",
3345
3020
  "\u2014 ",
3346
3021
  cap.description
@@ -3348,21 +3023,21 @@ function InfoStep({ integration, meta }) {
3348
3023
  ] })
3349
3024
  ] }, i)) })
3350
3025
  ] }),
3351
- meta.requirements.length > 0 && /* @__PURE__ */ jsxs12("div", { className: "space-y-3", children: [
3352
- /* @__PURE__ */ jsx14("h4", { className: "text-sm font-medium", children: "Requisitos:" }),
3353
- /* @__PURE__ */ jsx14("ul", { className: "space-y-2", children: meta.requirements.map((req, i) => /* @__PURE__ */ jsxs12(
3026
+ meta.requirements.length > 0 && /* @__PURE__ */ jsxs11("div", { className: "space-y-3", children: [
3027
+ /* @__PURE__ */ jsx13("h4", { className: "text-sm font-medium", children: "Requisitos:" }),
3028
+ /* @__PURE__ */ jsx13("ul", { className: "space-y-2", children: meta.requirements.map((req, i) => /* @__PURE__ */ jsxs11(
3354
3029
  "li",
3355
3030
  {
3356
3031
  className: "flex items-start gap-2 text-sm text-muted-foreground",
3357
3032
  children: [
3358
- /* @__PURE__ */ jsx14(
3033
+ /* @__PURE__ */ jsx13(
3359
3034
  Info,
3360
3035
  {
3361
3036
  "aria-hidden": "true",
3362
3037
  className: "mt-0.5 h-4 w-4 shrink-0 text-blue-500"
3363
3038
  }
3364
3039
  ),
3365
- /* @__PURE__ */ jsx14("span", { children: req })
3040
+ /* @__PURE__ */ jsx13("span", { children: req })
3366
3041
  ]
3367
3042
  },
3368
3043
  i
@@ -3372,9 +3047,9 @@ function InfoStep({ integration, meta }) {
3372
3047
  }
3373
3048
 
3374
3049
  // src/components/capabilities/wizard-steps/credentials-step.tsx
3375
- import { CheckCircle2, Loader2 as Loader25, AlertCircle, Shield } from "lucide-react";
3376
- import { Button as Button10, Input as Input7, Label as Label5 } from "@greatapps/greatauth-ui/ui";
3377
- import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3050
+ import { CheckCircle2, Loader2 as Loader25, AlertCircle, Shield, Info as Info2 } from "lucide-react";
3051
+ import { Button as Button9, Input as Input6, Label as Label4, Tooltip as Tooltip3, TooltipTrigger as TooltipTrigger3, TooltipContent as TooltipContent3 } from "@greatapps/greatauth-ui/ui";
3052
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
3378
3053
  function CredentialsStep({
3379
3054
  integration,
3380
3055
  meta,
@@ -3383,10 +3058,11 @@ function CredentialsStep({
3383
3058
  apiKey,
3384
3059
  onApiKeyChange,
3385
3060
  onStartOAuth,
3386
- isReconnect = false
3061
+ isReconnect = false,
3062
+ oauthConfigured = false
3387
3063
  }) {
3388
3064
  if (integration.authType === "oauth2") {
3389
- return /* @__PURE__ */ jsx15(
3065
+ return /* @__PURE__ */ jsx14(
3390
3066
  OAuthCredentials,
3391
3067
  {
3392
3068
  integration,
@@ -3394,11 +3070,12 @@ function CredentialsStep({
3394
3070
  oauthStatus,
3395
3071
  oauthResult,
3396
3072
  onStartOAuth,
3397
- isReconnect
3073
+ isReconnect,
3074
+ oauthConfigured
3398
3075
  }
3399
3076
  );
3400
3077
  }
3401
- return /* @__PURE__ */ jsx15(ApiKeyCredentials, { apiKey, onApiKeyChange });
3078
+ return /* @__PURE__ */ jsx14(ApiKeyCredentials, { apiKey, onApiKeyChange });
3402
3079
  }
3403
3080
  function OAuthCredentials({
3404
3081
  integration,
@@ -3406,69 +3083,99 @@ function OAuthCredentials({
3406
3083
  oauthStatus,
3407
3084
  oauthResult,
3408
3085
  onStartOAuth,
3409
- isReconnect
3086
+ isReconnect,
3087
+ oauthConfigured
3410
3088
  }) {
3411
3089
  const providerLabel = meta.providerLabel || integration.name;
3412
- return /* @__PURE__ */ jsxs13("div", { className: "space-y-6", children: [
3413
- /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
3414
- /* @__PURE__ */ jsx15("h3", { className: "text-lg font-semibold", children: "Autentica\xE7\xE3o" }),
3415
- /* @__PURE__ */ jsx15("p", { className: "text-sm text-muted-foreground", children: isReconnect ? `Reconecte sua conta ${providerLabel} para renovar a autoriza\xE7\xE3o.` : `Conecte sua conta ${providerLabel} para permitir o acesso.` })
3090
+ return /* @__PURE__ */ jsxs12("div", { className: "space-y-6", children: [
3091
+ /* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
3092
+ /* @__PURE__ */ jsx14("h3", { className: "text-lg font-semibold", children: "Autentica\xE7\xE3o" }),
3093
+ /* @__PURE__ */ jsx14("p", { className: "text-sm text-muted-foreground", children: isReconnect ? `Reconecte sua conta ${providerLabel} para renovar a autoriza\xE7\xE3o.` : `Conecte sua conta ${providerLabel} para permitir o acesso.` })
3094
+ ] }),
3095
+ !oauthConfigured && oauthStatus === "idle" && /* @__PURE__ */ jsxs12("div", { className: "flex items-start gap-3 rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-900 dark:bg-amber-950/30", children: [
3096
+ /* @__PURE__ */ jsx14(
3097
+ Info2,
3098
+ {
3099
+ "aria-hidden": "true",
3100
+ className: "mt-0.5 h-5 w-5 shrink-0 text-amber-600 dark:text-amber-400"
3101
+ }
3102
+ ),
3103
+ /* @__PURE__ */ jsxs12("div", { className: "space-y-1", children: [
3104
+ /* @__PURE__ */ jsx14("p", { className: "text-sm font-medium text-amber-800 dark:text-amber-200", children: "Configura\xE7\xE3o necess\xE1ria" }),
3105
+ /* @__PURE__ */ jsxs12("p", { className: "text-xs text-amber-700 dark:text-amber-300", children: [
3106
+ "A integra\xE7\xE3o com ",
3107
+ providerLabel,
3108
+ " requer configura\xE7\xE3o pelo administrador do sistema. Entre em contato com o suporte para ativar esta funcionalidade."
3109
+ ] })
3110
+ ] })
3416
3111
  ] }),
3417
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-center gap-4 rounded-lg border p-6", children: [
3418
- oauthStatus === "idle" && /* @__PURE__ */ jsxs13(Button10, { onClick: onStartOAuth, size: "lg", className: "gap-2", children: [
3419
- meta.icon,
3420
- isReconnect ? `Reconectar com ${providerLabel}` : `Conectar com ${providerLabel}`
3112
+ /* @__PURE__ */ jsxs12("div", { className: "flex flex-col items-center gap-4 rounded-lg border p-6", children: [
3113
+ oauthStatus === "idle" && /* @__PURE__ */ jsxs12(Tooltip3, { children: [
3114
+ /* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14("span", { tabIndex: !oauthConfigured ? 0 : void 0, children: /* @__PURE__ */ jsxs12(
3115
+ Button9,
3116
+ {
3117
+ onClick: onStartOAuth,
3118
+ size: "lg",
3119
+ className: "gap-2",
3120
+ disabled: !oauthConfigured,
3121
+ children: [
3122
+ meta.icon,
3123
+ isReconnect ? `Reconectar com ${providerLabel}` : `Conectar com ${providerLabel}`
3124
+ ]
3125
+ }
3126
+ ) }) }),
3127
+ !oauthConfigured && /* @__PURE__ */ jsx14(TooltipContent3, { children: "Integra\xE7\xE3o OAuth ainda n\xE3o configurada no servidor" })
3421
3128
  ] }),
3422
- oauthStatus === "waiting" && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-center gap-3 text-center", children: [
3423
- /* @__PURE__ */ jsx15(
3129
+ oauthStatus === "waiting" && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col items-center gap-3 text-center", children: [
3130
+ /* @__PURE__ */ jsx14(
3424
3131
  Loader25,
3425
3132
  {
3426
3133
  "aria-hidden": "true",
3427
3134
  className: "h-8 w-8 animate-spin text-muted-foreground"
3428
3135
  }
3429
3136
  ),
3430
- /* @__PURE__ */ jsxs13("div", { children: [
3431
- /* @__PURE__ */ jsx15("p", { className: "text-sm font-medium", children: "Aguardando autoriza\xE7\xE3o..." }),
3432
- /* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground", children: "Complete o login na janela que foi aberta." })
3137
+ /* @__PURE__ */ jsxs12("div", { children: [
3138
+ /* @__PURE__ */ jsx14("p", { className: "text-sm font-medium", children: "Aguardando autoriza\xE7\xE3o..." }),
3139
+ /* @__PURE__ */ jsx14("p", { className: "text-xs text-muted-foreground", children: "Complete o login na janela que foi aberta." })
3433
3140
  ] })
3434
3141
  ] }),
3435
- oauthStatus === "success" && oauthResult && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-center gap-3 text-center", children: [
3436
- /* @__PURE__ */ jsx15(
3142
+ oauthStatus === "success" && oauthResult && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col items-center gap-3 text-center", children: [
3143
+ /* @__PURE__ */ jsx14(
3437
3144
  CheckCircle2,
3438
3145
  {
3439
3146
  "aria-hidden": "true",
3440
3147
  className: "h-8 w-8 text-green-600"
3441
3148
  }
3442
3149
  ),
3443
- /* @__PURE__ */ jsxs13("div", { children: [
3444
- /* @__PURE__ */ jsx15("p", { className: "text-sm font-medium text-green-700", children: "Conectado com sucesso!" }),
3445
- oauthResult.email && /* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground", children: oauthResult.email })
3150
+ /* @__PURE__ */ jsxs12("div", { children: [
3151
+ /* @__PURE__ */ jsx14("p", { className: "text-sm font-medium text-green-700", children: "Conectado com sucesso!" }),
3152
+ oauthResult.email && /* @__PURE__ */ jsx14("p", { className: "text-xs text-muted-foreground", children: oauthResult.email })
3446
3153
  ] })
3447
3154
  ] }),
3448
- oauthStatus === "error" && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-center gap-3 text-center", children: [
3449
- /* @__PURE__ */ jsx15(
3155
+ oauthStatus === "error" && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col items-center gap-3 text-center", children: [
3156
+ /* @__PURE__ */ jsx14(
3450
3157
  AlertCircle,
3451
3158
  {
3452
3159
  "aria-hidden": "true",
3453
3160
  className: "h-8 w-8 text-destructive"
3454
3161
  }
3455
3162
  ),
3456
- /* @__PURE__ */ jsxs13("div", { children: [
3457
- /* @__PURE__ */ jsx15("p", { className: "text-sm font-medium text-destructive", children: "Falha na conex\xE3o" }),
3458
- oauthResult?.error && /* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground", children: oauthResult.error })
3163
+ /* @__PURE__ */ jsxs12("div", { children: [
3164
+ /* @__PURE__ */ jsx14("p", { className: "text-sm font-medium text-destructive", children: "Falha na conex\xE3o" }),
3165
+ oauthResult?.error && /* @__PURE__ */ jsx14("p", { className: "text-xs text-muted-foreground", children: oauthResult.error })
3459
3166
  ] }),
3460
- /* @__PURE__ */ jsx15(Button10, { variant: "outline", onClick: onStartOAuth, size: "sm", children: "Tentar novamente" })
3167
+ /* @__PURE__ */ jsx14(Button9, { variant: "outline", onClick: onStartOAuth, size: "sm", children: "Tentar novamente" })
3461
3168
  ] })
3462
3169
  ] }),
3463
- /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2 rounded-md bg-muted/50 p-3", children: [
3464
- /* @__PURE__ */ jsx15(
3170
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-start gap-2 rounded-md bg-muted/50 p-3", children: [
3171
+ /* @__PURE__ */ jsx14(
3465
3172
  Shield,
3466
3173
  {
3467
3174
  "aria-hidden": "true",
3468
3175
  className: "mt-0.5 h-4 w-4 shrink-0 text-green-600"
3469
3176
  }
3470
3177
  ),
3471
- /* @__PURE__ */ jsxs13("p", { className: "text-xs text-muted-foreground", children: [
3178
+ /* @__PURE__ */ jsxs12("p", { className: "text-xs text-muted-foreground", children: [
3472
3179
  "Seus dados est\xE3o seguros. Usamos OAuth 2.0 para autentica\xE7\xE3o \u2014 nunca armazenamos sua senha. Voc\xEA pode revogar o acesso a qualquer momento nas configura\xE7\xF5es da sua conta ",
3473
3180
  providerLabel,
3474
3181
  "."
@@ -3480,15 +3187,15 @@ function ApiKeyCredentials({
3480
3187
  apiKey,
3481
3188
  onApiKeyChange
3482
3189
  }) {
3483
- return /* @__PURE__ */ jsxs13("div", { className: "space-y-6", children: [
3484
- /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
3485
- /* @__PURE__ */ jsx15("h3", { className: "text-lg font-semibold", children: "Autentica\xE7\xE3o" }),
3486
- /* @__PURE__ */ jsx15("p", { className: "text-sm text-muted-foreground", children: "Insira a chave de API para conectar a integra\xE7\xE3o." })
3190
+ return /* @__PURE__ */ jsxs12("div", { className: "space-y-6", children: [
3191
+ /* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
3192
+ /* @__PURE__ */ jsx14("h3", { className: "text-lg font-semibold", children: "Autentica\xE7\xE3o" }),
3193
+ /* @__PURE__ */ jsx14("p", { className: "text-sm text-muted-foreground", children: "Insira a chave de API para conectar a integra\xE7\xE3o." })
3487
3194
  ] }),
3488
- /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
3489
- /* @__PURE__ */ jsx15(Label5, { htmlFor: "integration-api-key", children: "Chave de API" }),
3490
- /* @__PURE__ */ jsx15(
3491
- Input7,
3195
+ /* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
3196
+ /* @__PURE__ */ jsx14(Label4, { htmlFor: "integration-api-key", children: "Chave de API" }),
3197
+ /* @__PURE__ */ jsx14(
3198
+ Input6,
3492
3199
  {
3493
3200
  id: "integration-api-key",
3494
3201
  type: "password",
@@ -3499,15 +3206,15 @@ function ApiKeyCredentials({
3499
3206
  }
3500
3207
  )
3501
3208
  ] }),
3502
- /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2 rounded-md bg-muted/50 p-3", children: [
3503
- /* @__PURE__ */ jsx15(
3209
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-start gap-2 rounded-md bg-muted/50 p-3", children: [
3210
+ /* @__PURE__ */ jsx14(
3504
3211
  Shield,
3505
3212
  {
3506
3213
  "aria-hidden": "true",
3507
3214
  className: "mt-0.5 h-4 w-4 shrink-0 text-green-600"
3508
3215
  }
3509
3216
  ),
3510
- /* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground", children: "Sua chave de API \xE9 armazenada de forma segura e encriptada. Nunca \xE9 exposta no frontend." })
3217
+ /* @__PURE__ */ jsx14("p", { className: "text-xs text-muted-foreground", children: "Sua chave de API \xE9 armazenada de forma segura e encriptada. Nunca \xE9 exposta no frontend." })
3511
3218
  ] })
3512
3219
  ] });
3513
3220
  }
@@ -3515,14 +3222,14 @@ function ApiKeyCredentials({
3515
3222
  // src/components/capabilities/wizard-steps/config-step.tsx
3516
3223
  import { Loader2 as Loader26 } from "lucide-react";
3517
3224
  import {
3518
- Label as Label6,
3519
- Select as Select2,
3520
- SelectContent as SelectContent2,
3521
- SelectItem as SelectItem2,
3522
- SelectTrigger as SelectTrigger2,
3523
- SelectValue as SelectValue2
3225
+ Label as Label5,
3226
+ Select,
3227
+ SelectContent,
3228
+ SelectItem,
3229
+ SelectTrigger,
3230
+ SelectValue
3524
3231
  } from "@greatapps/greatauth-ui/ui";
3525
- import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
3232
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3526
3233
  function ConfigStep({
3527
3234
  integration,
3528
3235
  options,
@@ -3534,27 +3241,27 @@ function ConfigStep({
3534
3241
  }) {
3535
3242
  const label = selectLabel || getDefaultLabel(integration.slug);
3536
3243
  const placeholder = selectPlaceholder || getDefaultPlaceholder(integration.slug);
3537
- return /* @__PURE__ */ jsxs14("div", { className: "space-y-6", children: [
3538
- /* @__PURE__ */ jsxs14("div", { className: "space-y-2", children: [
3539
- /* @__PURE__ */ jsx16("h3", { className: "text-lg font-semibold", children: "Configura\xE7\xE3o" }),
3540
- /* @__PURE__ */ jsx16("p", { className: "text-sm text-muted-foreground", children: "Configure as op\xE7\xF5es espec\xEDficas da integra\xE7\xE3o." })
3244
+ return /* @__PURE__ */ jsxs13("div", { className: "space-y-6", children: [
3245
+ /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
3246
+ /* @__PURE__ */ jsx15("h3", { className: "text-lg font-semibold", children: "Configura\xE7\xE3o" }),
3247
+ /* @__PURE__ */ jsx15("p", { className: "text-sm text-muted-foreground", children: "Configure as op\xE7\xF5es espec\xEDficas da integra\xE7\xE3o." })
3541
3248
  ] }),
3542
- isLoading ? /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center gap-3 py-8", children: [
3543
- /* @__PURE__ */ jsx16(
3249
+ isLoading ? /* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-center gap-3 py-8", children: [
3250
+ /* @__PURE__ */ jsx15(
3544
3251
  Loader26,
3545
3252
  {
3546
3253
  "aria-hidden": "true",
3547
3254
  className: "h-6 w-6 animate-spin text-muted-foreground"
3548
3255
  }
3549
3256
  ),
3550
- /* @__PURE__ */ jsx16("p", { className: "text-sm text-muted-foreground", children: "Carregando op\xE7\xF5es..." })
3551
- ] }) : options.length === 0 ? /* @__PURE__ */ jsx16("div", { className: "rounded-lg border border-dashed p-6 text-center", children: /* @__PURE__ */ jsx16("p", { className: "text-sm text-muted-foreground", children: "Nenhuma op\xE7\xE3o dispon\xEDvel. A configura\xE7\xE3o padr\xE3o ser\xE1 usada." }) }) : /* @__PURE__ */ jsxs14("div", { className: "space-y-2", children: [
3552
- /* @__PURE__ */ jsx16(Label6, { htmlFor: "integration-config-select", children: label }),
3553
- /* @__PURE__ */ jsxs14(Select2, { value: selectedValue, onValueChange, children: [
3554
- /* @__PURE__ */ jsx16(SelectTrigger2, { id: "integration-config-select", children: /* @__PURE__ */ jsx16(SelectValue2, { placeholder }) }),
3555
- /* @__PURE__ */ jsx16(SelectContent2, { children: options.map((opt) => /* @__PURE__ */ jsxs14(SelectItem2, { value: opt.id, children: [
3556
- /* @__PURE__ */ jsx16("span", { children: opt.label }),
3557
- opt.description && /* @__PURE__ */ jsxs14("span", { className: "ml-2 text-xs text-muted-foreground", children: [
3257
+ /* @__PURE__ */ jsx15("p", { className: "text-sm text-muted-foreground", children: "Carregando op\xE7\xF5es..." })
3258
+ ] }) : options.length === 0 ? /* @__PURE__ */ jsx15("div", { className: "rounded-lg border border-dashed p-6 text-center", children: /* @__PURE__ */ jsx15("p", { className: "text-sm text-muted-foreground", children: "Nenhuma op\xE7\xE3o dispon\xEDvel. A configura\xE7\xE3o padr\xE3o ser\xE1 usada." }) }) : /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
3259
+ /* @__PURE__ */ jsx15(Label5, { htmlFor: "integration-config-select", children: label }),
3260
+ /* @__PURE__ */ jsxs13(Select, { value: selectedValue, onValueChange, children: [
3261
+ /* @__PURE__ */ jsx15(SelectTrigger, { id: "integration-config-select", children: /* @__PURE__ */ jsx15(SelectValue, { placeholder }) }),
3262
+ /* @__PURE__ */ jsx15(SelectContent, { children: options.map((opt) => /* @__PURE__ */ jsxs13(SelectItem, { value: opt.id, children: [
3263
+ /* @__PURE__ */ jsx15("span", { children: opt.label }),
3264
+ opt.description && /* @__PURE__ */ jsxs13("span", { className: "ml-2 text-xs text-muted-foreground", children: [
3558
3265
  "(",
3559
3266
  opt.description,
3560
3267
  ")"
@@ -3583,8 +3290,8 @@ function getDefaultPlaceholder(slug) {
3583
3290
 
3584
3291
  // src/components/capabilities/wizard-steps/confirm-step.tsx
3585
3292
  import { CheckCircle2 as CheckCircle22 } from "lucide-react";
3586
- import { Label as Label7 } from "@greatapps/greatauth-ui/ui";
3587
- import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
3293
+ import { Label as Label6 } from "@greatapps/greatauth-ui/ui";
3294
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
3588
3295
  function ConfirmStep({
3589
3296
  integration,
3590
3297
  oauthResult,
@@ -3592,22 +3299,22 @@ function ConfirmStep({
3592
3299
  enableOnComplete,
3593
3300
  onEnableChange
3594
3301
  }) {
3595
- return /* @__PURE__ */ jsxs15("div", { className: "space-y-6", children: [
3596
- /* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
3597
- /* @__PURE__ */ jsx17("h3", { className: "text-lg font-semibold", children: "Confirma\xE7\xE3o" }),
3598
- /* @__PURE__ */ jsx17("p", { className: "text-sm text-muted-foreground", children: "Revise as configura\xE7\xF5es antes de concluir." })
3302
+ return /* @__PURE__ */ jsxs14("div", { className: "space-y-6", children: [
3303
+ /* @__PURE__ */ jsxs14("div", { className: "space-y-2", children: [
3304
+ /* @__PURE__ */ jsx16("h3", { className: "text-lg font-semibold", children: "Confirma\xE7\xE3o" }),
3305
+ /* @__PURE__ */ jsx16("p", { className: "text-sm text-muted-foreground", children: "Revise as configura\xE7\xF5es antes de concluir." })
3599
3306
  ] }),
3600
- /* @__PURE__ */ jsxs15("div", { className: "space-y-3 rounded-lg border p-4", children: [
3601
- /* @__PURE__ */ jsx17(SummaryRow, { label: "Integra\xE7\xE3o", value: integration.name }),
3602
- oauthResult?.email && /* @__PURE__ */ jsx17(SummaryRow, { label: "Conta conectada", value: oauthResult.email }),
3603
- selectedConfigOption && /* @__PURE__ */ jsx17(
3307
+ /* @__PURE__ */ jsxs14("div", { className: "space-y-3 rounded-lg border p-4", children: [
3308
+ /* @__PURE__ */ jsx16(SummaryRow, { label: "Integra\xE7\xE3o", value: integration.name }),
3309
+ oauthResult?.email && /* @__PURE__ */ jsx16(SummaryRow, { label: "Conta conectada", value: oauthResult.email }),
3310
+ selectedConfigOption && /* @__PURE__ */ jsx16(
3604
3311
  SummaryRow,
3605
3312
  {
3606
3313
  label: getConfigLabel(integration.slug),
3607
3314
  value: selectedConfigOption.label
3608
3315
  }
3609
3316
  ),
3610
- /* @__PURE__ */ jsx17(
3317
+ /* @__PURE__ */ jsx16(
3611
3318
  SummaryRow,
3612
3319
  {
3613
3320
  label: "Tipo de autentica\xE7\xE3o",
@@ -3615,12 +3322,12 @@ function ConfirmStep({
3615
3322
  }
3616
3323
  )
3617
3324
  ] }),
3618
- /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between rounded-lg border p-4", children: [
3619
- /* @__PURE__ */ jsxs15("div", { className: "space-y-0.5", children: [
3620
- /* @__PURE__ */ jsx17(Label7, { htmlFor: "enable-on-complete", className: "text-sm font-medium", children: "Ativar imediatamente" }),
3621
- /* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground", children: "A integra\xE7\xE3o ficar\xE1 ativa assim que concluir o assistente." })
3325
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between rounded-lg border p-4", children: [
3326
+ /* @__PURE__ */ jsxs14("div", { className: "space-y-0.5", children: [
3327
+ /* @__PURE__ */ jsx16(Label6, { htmlFor: "enable-on-complete", className: "text-sm font-medium", children: "Ativar imediatamente" }),
3328
+ /* @__PURE__ */ jsx16("p", { className: "text-xs text-muted-foreground", children: "A integra\xE7\xE3o ficar\xE1 ativa assim que concluir o assistente." })
3622
3329
  ] }),
3623
- /* @__PURE__ */ jsx17(
3330
+ /* @__PURE__ */ jsx16(
3624
3331
  "button",
3625
3332
  {
3626
3333
  id: "enable-on-complete",
@@ -3634,7 +3341,7 @@ function ConfirmStep({
3634
3341
  focus-visible:ring-ring focus-visible:ring-offset-2
3635
3342
  ${enableOnComplete ? "bg-primary" : "bg-muted"}
3636
3343
  `,
3637
- children: /* @__PURE__ */ jsx17(
3344
+ children: /* @__PURE__ */ jsx16(
3638
3345
  "span",
3639
3346
  {
3640
3347
  "aria-hidden": "true",
@@ -3648,22 +3355,22 @@ function ConfirmStep({
3648
3355
  }
3649
3356
  )
3650
3357
  ] }),
3651
- /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 rounded-md bg-green-50 p-3 dark:bg-green-950/20", children: [
3652
- /* @__PURE__ */ jsx17(
3358
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 rounded-md bg-green-50 p-3 dark:bg-green-950/20", children: [
3359
+ /* @__PURE__ */ jsx16(
3653
3360
  CheckCircle22,
3654
3361
  {
3655
3362
  "aria-hidden": "true",
3656
3363
  className: "h-4 w-4 shrink-0 text-green-600"
3657
3364
  }
3658
3365
  ),
3659
- /* @__PURE__ */ jsx17("p", { className: "text-xs text-green-700 dark:text-green-400", children: 'Tudo pronto! Clique em "Concluir" para finalizar a configura\xE7\xE3o.' })
3366
+ /* @__PURE__ */ jsx16("p", { className: "text-xs text-green-700 dark:text-green-400", children: 'Tudo pronto! Clique em "Concluir" para finalizar a configura\xE7\xE3o.' })
3660
3367
  ] })
3661
3368
  ] });
3662
3369
  }
3663
3370
  function SummaryRow({ label, value }) {
3664
- return /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between text-sm", children: [
3665
- /* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: label }),
3666
- /* @__PURE__ */ jsx17("span", { className: "font-medium", children: value })
3371
+ return /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between text-sm", children: [
3372
+ /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: label }),
3373
+ /* @__PURE__ */ jsx16("span", { className: "font-medium", children: value })
3667
3374
  ] });
3668
3375
  }
3669
3376
  function getConfigLabel(slug) {
@@ -3676,7 +3383,7 @@ function getConfigLabel(slug) {
3676
3383
  }
3677
3384
 
3678
3385
  // src/components/capabilities/integration-wizard.tsx
3679
- import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
3386
+ import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
3680
3387
  var STEPS = ["info", "credentials", "config", "confirm"];
3681
3388
  var STEP_LABELS = {
3682
3389
  info: "Informa\xE7\xE3o",
@@ -3698,18 +3405,18 @@ function IntegrationWizard({
3698
3405
  existingConfigValue
3699
3406
  }) {
3700
3407
  const isReconnect = !!existingCredentialId;
3701
- const [currentStep, setCurrentStep] = useState10("info");
3408
+ const [currentStep, setCurrentStep] = useState9("info");
3702
3409
  const currentIndex = STEPS.indexOf(currentStep);
3703
- const [oauthStatus, setOauthStatus] = useState10("idle");
3704
- const [oauthResult, setOauthResult] = useState10(null);
3410
+ const [oauthStatus, setOauthStatus] = useState9("idle");
3411
+ const [oauthResult, setOauthResult] = useState9(null);
3705
3412
  const popupRef = useRef3(null);
3706
3413
  const popupPollRef = useRef3(null);
3707
- const [apiKey, setApiKey] = useState10("");
3708
- const [configOptions, setConfigOptions] = useState10([]);
3709
- const [configLoading, setConfigLoading] = useState10(false);
3710
- const [selectedConfigValue, setSelectedConfigValue] = useState10("");
3711
- const [enableOnComplete, setEnableOnComplete] = useState10(true);
3712
- const [isSubmitting, setIsSubmitting] = useState10(false);
3414
+ const [apiKey, setApiKey] = useState9("");
3415
+ const [configOptions, setConfigOptions] = useState9([]);
3416
+ const [configLoading, setConfigLoading] = useState9(false);
3417
+ const [selectedConfigValue, setSelectedConfigValue] = useState9("");
3418
+ const [enableOnComplete, setEnableOnComplete] = useState9(true);
3419
+ const [isSubmitting, setIsSubmitting] = useState9(false);
3713
3420
  useEffect5(() => {
3714
3421
  return () => {
3715
3422
  if (popupPollRef.current) {
@@ -3860,11 +3567,11 @@ function IntegrationWizard({
3860
3567
  try {
3861
3568
  onComplete();
3862
3569
  onOpenChange(false);
3863
- toast8.success(
3570
+ toast7.success(
3864
3571
  `${integration.name} ${isReconnect ? "reconectado" : "configurado"} com sucesso!`
3865
3572
  );
3866
3573
  } catch {
3867
- toast8.error("Erro ao finalizar configura\xE7\xE3o");
3574
+ toast7.error("Erro ao finalizar configura\xE7\xE3o");
3868
3575
  } finally {
3869
3576
  setIsSubmitting(false);
3870
3577
  }
@@ -3872,18 +3579,18 @@ function IntegrationWizard({
3872
3579
  const selectedConfigOption = configOptions.find((o) => o.id === selectedConfigValue) || null;
3873
3580
  const isLastStep = currentStep === "confirm";
3874
3581
  const effectiveSteps = meta.hasConfigStep ? STEPS : STEPS.filter((s) => s !== "config");
3875
- return /* @__PURE__ */ jsx18(Dialog5, { open, onOpenChange, children: /* @__PURE__ */ jsxs16(DialogContent5, { className: "sm:max-w-lg", children: [
3876
- /* @__PURE__ */ jsx18(DialogHeader5, { children: /* @__PURE__ */ jsx18(DialogTitle5, { children: integration.name }) }),
3877
- /* @__PURE__ */ jsx18(StepIndicator, { steps: effectiveSteps, currentStep }),
3878
- /* @__PURE__ */ jsxs16("div", { className: "min-h-[280px] py-2", children: [
3879
- currentStep === "info" && /* @__PURE__ */ jsx18(
3582
+ return /* @__PURE__ */ jsx17(Dialog4, { open, onOpenChange, children: /* @__PURE__ */ jsxs15(DialogContent4, { className: "sm:max-w-lg", children: [
3583
+ /* @__PURE__ */ jsx17(DialogHeader4, { children: /* @__PURE__ */ jsx17(DialogTitle4, { children: integration.name }) }),
3584
+ /* @__PURE__ */ jsx17(StepIndicator, { steps: effectiveSteps, currentStep }),
3585
+ /* @__PURE__ */ jsxs15("div", { className: "min-h-[280px] py-2", children: [
3586
+ currentStep === "info" && /* @__PURE__ */ jsx17(
3880
3587
  InfoStep,
3881
3588
  {
3882
3589
  integration,
3883
3590
  meta
3884
3591
  }
3885
3592
  ),
3886
- currentStep === "credentials" && /* @__PURE__ */ jsx18(
3593
+ currentStep === "credentials" && /* @__PURE__ */ jsx17(
3887
3594
  CredentialsStep,
3888
3595
  {
3889
3596
  integration,
@@ -3896,7 +3603,7 @@ function IntegrationWizard({
3896
3603
  isReconnect
3897
3604
  }
3898
3605
  ),
3899
- currentStep === "config" && /* @__PURE__ */ jsx18(
3606
+ currentStep === "config" && /* @__PURE__ */ jsx17(
3900
3607
  ConfigStep,
3901
3608
  {
3902
3609
  integration,
@@ -3906,7 +3613,7 @@ function IntegrationWizard({
3906
3613
  onValueChange: setSelectedConfigValue
3907
3614
  }
3908
3615
  ),
3909
- currentStep === "confirm" && /* @__PURE__ */ jsx18(
3616
+ currentStep === "confirm" && /* @__PURE__ */ jsx17(
3910
3617
  ConfirmStep,
3911
3618
  {
3912
3619
  integration,
@@ -3917,48 +3624,48 @@ function IntegrationWizard({
3917
3624
  }
3918
3625
  )
3919
3626
  ] }),
3920
- /* @__PURE__ */ jsxs16(DialogFooter5, { className: "flex-row justify-between sm:justify-between", children: [
3921
- /* @__PURE__ */ jsx18("div", { children: currentStep === "info" ? /* @__PURE__ */ jsx18(
3922
- Button11,
3627
+ /* @__PURE__ */ jsxs15(DialogFooter4, { className: "flex-row justify-between sm:justify-between", children: [
3628
+ /* @__PURE__ */ jsx17("div", { children: currentStep === "info" ? /* @__PURE__ */ jsx17(
3629
+ Button10,
3923
3630
  {
3924
3631
  type: "button",
3925
3632
  variant: "outline",
3926
3633
  onClick: () => onOpenChange(false),
3927
3634
  children: "Cancelar"
3928
3635
  }
3929
- ) : /* @__PURE__ */ jsxs16(
3930
- Button11,
3636
+ ) : /* @__PURE__ */ jsxs15(
3637
+ Button10,
3931
3638
  {
3932
3639
  type: "button",
3933
3640
  variant: "outline",
3934
3641
  onClick: goPrev,
3935
3642
  className: "gap-1",
3936
3643
  children: [
3937
- /* @__PURE__ */ jsx18(ChevronLeft, { "aria-hidden": "true", className: "h-4 w-4" }),
3644
+ /* @__PURE__ */ jsx17(ChevronLeft, { "aria-hidden": "true", className: "h-4 w-4" }),
3938
3645
  "Voltar"
3939
3646
  ]
3940
3647
  }
3941
3648
  ) }),
3942
- /* @__PURE__ */ jsx18("div", { children: isLastStep ? /* @__PURE__ */ jsxs16(
3943
- Button11,
3649
+ /* @__PURE__ */ jsx17("div", { children: isLastStep ? /* @__PURE__ */ jsxs15(
3650
+ Button10,
3944
3651
  {
3945
3652
  type: "button",
3946
3653
  onClick: handleComplete,
3947
3654
  disabled: isSubmitting,
3948
3655
  className: "gap-1",
3949
3656
  children: [
3950
- isSubmitting ? /* @__PURE__ */ jsx18(
3657
+ isSubmitting ? /* @__PURE__ */ jsx17(
3951
3658
  Loader27,
3952
3659
  {
3953
3660
  "aria-hidden": "true",
3954
3661
  className: "h-4 w-4 animate-spin"
3955
3662
  }
3956
- ) : /* @__PURE__ */ jsx18(Check2, { "aria-hidden": "true", className: "h-4 w-4" }),
3663
+ ) : /* @__PURE__ */ jsx17(Check2, { "aria-hidden": "true", className: "h-4 w-4" }),
3957
3664
  "Concluir"
3958
3665
  ]
3959
3666
  }
3960
- ) : /* @__PURE__ */ jsxs16(
3961
- Button11,
3667
+ ) : /* @__PURE__ */ jsxs15(
3668
+ Button10,
3962
3669
  {
3963
3670
  type: "button",
3964
3671
  onClick: goNext,
@@ -3966,7 +3673,7 @@ function IntegrationWizard({
3966
3673
  className: "gap-1",
3967
3674
  children: [
3968
3675
  "Continuar",
3969
- /* @__PURE__ */ jsx18(ChevronRight, { "aria-hidden": "true", className: "h-4 w-4" })
3676
+ /* @__PURE__ */ jsx17(ChevronRight, { "aria-hidden": "true", className: "h-4 w-4" })
3970
3677
  ]
3971
3678
  }
3972
3679
  ) })
@@ -3978,7 +3685,7 @@ function StepIndicator({
3978
3685
  currentStep
3979
3686
  }) {
3980
3687
  const currentIndex = steps.indexOf(currentStep);
3981
- return /* @__PURE__ */ jsx18(
3688
+ return /* @__PURE__ */ jsx17(
3982
3689
  "div",
3983
3690
  {
3984
3691
  className: "flex items-center justify-center gap-1 py-2",
@@ -3987,8 +3694,8 @@ function StepIndicator({
3987
3694
  children: steps.map((step, i) => {
3988
3695
  const isCompleted = i < currentIndex;
3989
3696
  const isCurrent = step === currentStep;
3990
- return /* @__PURE__ */ jsxs16("div", { className: "flex items-center", role: "listitem", children: [
3991
- /* @__PURE__ */ jsx18(
3697
+ return /* @__PURE__ */ jsxs15("div", { className: "flex items-center", role: "listitem", children: [
3698
+ /* @__PURE__ */ jsx17(
3992
3699
  "div",
3993
3700
  {
3994
3701
  className: `
@@ -3998,10 +3705,10 @@ function StepIndicator({
3998
3705
  `,
3999
3706
  "aria-current": isCurrent ? "step" : void 0,
4000
3707
  "aria-label": `${STEP_LABELS[step]}${isCompleted ? " (conclu\xEDdo)" : isCurrent ? " (atual)" : ""}`,
4001
- children: isCompleted ? /* @__PURE__ */ jsx18(Check2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }) : i + 1
3708
+ children: isCompleted ? /* @__PURE__ */ jsx17(Check2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }) : i + 1
4002
3709
  }
4003
3710
  ),
4004
- /* @__PURE__ */ jsx18(
3711
+ /* @__PURE__ */ jsx17(
4005
3712
  "span",
4006
3713
  {
4007
3714
  className: `
@@ -4011,7 +3718,7 @@ function StepIndicator({
4011
3718
  children: STEP_LABELS[step]
4012
3719
  }
4013
3720
  ),
4014
- i < steps.length - 1 && /* @__PURE__ */ jsx18(
3721
+ i < steps.length - 1 && /* @__PURE__ */ jsx17(
4015
3722
  "div",
4016
3723
  {
4017
3724
  className: `
@@ -4027,63 +3734,63 @@ function StepIndicator({
4027
3734
  }
4028
3735
 
4029
3736
  // src/components/capabilities/advanced-tab.tsx
4030
- import { useState as useState14 } from "react";
3737
+ import { useState as useState13 } from "react";
4031
3738
 
4032
3739
  // src/components/tools/tools-table.tsx
4033
- import { useMemo as useMemo6, useState as useState11 } from "react";
3740
+ import { useMemo as useMemo6, useState as useState10 } from "react";
4034
3741
  import { DataTable as DataTable2 } from "@greatapps/greatauth-ui";
4035
3742
  import {
4036
- Input as Input8,
4037
- Badge as Badge8,
4038
- Tooltip as Tooltip3,
4039
- TooltipTrigger as TooltipTrigger3,
4040
- TooltipContent as TooltipContent3,
4041
- AlertDialog as AlertDialog4,
4042
- AlertDialogAction as AlertDialogAction4,
4043
- AlertDialogCancel as AlertDialogCancel4,
4044
- AlertDialogContent as AlertDialogContent4,
4045
- AlertDialogDescription as AlertDialogDescription4,
4046
- AlertDialogFooter as AlertDialogFooter4,
4047
- AlertDialogHeader as AlertDialogHeader4,
4048
- AlertDialogTitle as AlertDialogTitle4,
4049
- Button as Button12
3743
+ Input as Input7,
3744
+ Badge as Badge7,
3745
+ Tooltip as Tooltip4,
3746
+ TooltipTrigger as TooltipTrigger4,
3747
+ TooltipContent as TooltipContent4,
3748
+ AlertDialog as AlertDialog3,
3749
+ AlertDialogAction as AlertDialogAction3,
3750
+ AlertDialogCancel as AlertDialogCancel3,
3751
+ AlertDialogContent as AlertDialogContent3,
3752
+ AlertDialogDescription as AlertDialogDescription3,
3753
+ AlertDialogFooter as AlertDialogFooter3,
3754
+ AlertDialogHeader as AlertDialogHeader3,
3755
+ AlertDialogTitle as AlertDialogTitle3,
3756
+ Button as Button11
4050
3757
  } from "@greatapps/greatauth-ui/ui";
4051
- import { Pencil as Pencil3, Trash2 as Trash24, Search as Search2 } from "lucide-react";
3758
+ import { Pencil as Pencil3, Trash2 as Trash23, Search as Search2 } from "lucide-react";
4052
3759
  import { format as format2 } from "date-fns";
4053
3760
  import { ptBR as ptBR2 } from "date-fns/locale";
4054
- import { toast as toast9 } from "sonner";
4055
- import { Fragment as Fragment2, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
3761
+ import { toast as toast8 } from "sonner";
3762
+ import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
4056
3763
  function useColumns2(onEdit, onDelete) {
4057
3764
  return [
4058
3765
  {
4059
3766
  accessorKey: "name",
4060
3767
  header: "Nome",
4061
- cell: ({ row }) => /* @__PURE__ */ jsx19("span", { className: "font-medium", children: row.original.name }),
3768
+ cell: ({ row }) => /* @__PURE__ */ jsx18("span", { className: "font-medium", children: row.original.name }),
4062
3769
  sortingFn: (rowA, rowB) => rowA.original.name.toLowerCase().localeCompare(rowB.original.name.toLowerCase())
4063
3770
  },
4064
3771
  {
4065
3772
  accessorKey: "slug",
4066
3773
  header: "Slug",
4067
- cell: ({ row }) => /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground text-sm font-mono", children: row.original.slug || "\u2014" })
3774
+ cell: ({ row }) => /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground text-sm font-mono", children: row.original.slug || "\u2014" })
4068
3775
  },
4069
3776
  {
4070
3777
  accessorKey: "type",
4071
3778
  header: "Tipo",
4072
- cell: ({ row }) => /* @__PURE__ */ jsx19(Badge8, { variant: "secondary", children: row.original.type })
3779
+ cell: ({ row }) => /* @__PURE__ */ jsx18(Badge7, { variant: "secondary", children: row.original.type })
4073
3780
  },
4074
3781
  {
4075
3782
  accessorKey: "description",
4076
3783
  header: "Descri\xE7\xE3o",
4077
3784
  cell: ({ row }) => {
4078
3785
  const desc = row.original.description;
4079
- if (!desc) return /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground text-sm", children: "\u2014" });
4080
- return /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground text-sm", children: desc.length > 50 ? `${desc.slice(0, 50)}\u2026` : desc });
3786
+ if (!desc) return /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground text-sm", children: "\u2014" });
3787
+ return /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground text-sm", children: desc.length > 50 ? `${desc.slice(0, 50)}\u2026` : desc });
4081
3788
  }
4082
3789
  },
4083
3790
  {
4084
3791
  accessorKey: "datetime_add",
4085
3792
  header: "Criado em",
4086
- cell: ({ row }) => /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground text-sm", children: format2(new Date(row.original.datetime_add), "dd/MM/yyyy", {
3793
+ cell: ({ row }) => /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground text-sm", children: format2(new Date(row.original.datetime_add), "dd/MM/yyyy", {
4087
3794
  locale: ptBR2
4088
3795
  }) })
4089
3796
  },
@@ -4091,42 +3798,42 @@ function useColumns2(onEdit, onDelete) {
4091
3798
  id: "actions",
4092
3799
  size: 80,
4093
3800
  enableSorting: false,
4094
- cell: ({ row }) => /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
4095
- /* @__PURE__ */ jsxs17(Tooltip3, { children: [
4096
- /* @__PURE__ */ jsx19(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx19(
4097
- Button12,
3801
+ cell: ({ row }) => /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
3802
+ /* @__PURE__ */ jsxs16(Tooltip4, { children: [
3803
+ /* @__PURE__ */ jsx18(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx18(
3804
+ Button11,
4098
3805
  {
4099
3806
  variant: "ghost",
4100
3807
  size: "icon",
4101
3808
  className: "h-8 w-8",
4102
3809
  "aria-label": "Editar",
4103
3810
  onClick: () => onEdit(row.original),
4104
- children: /* @__PURE__ */ jsx19(Pencil3, { className: "h-4 w-4" })
3811
+ children: /* @__PURE__ */ jsx18(Pencil3, { className: "h-4 w-4" })
4105
3812
  }
4106
3813
  ) }),
4107
- /* @__PURE__ */ jsx19(TooltipContent3, { children: "Editar" })
3814
+ /* @__PURE__ */ jsx18(TooltipContent4, { children: "Editar" })
4108
3815
  ] }),
4109
- /* @__PURE__ */ jsxs17(Tooltip3, { children: [
4110
- /* @__PURE__ */ jsx19(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx19(
4111
- Button12,
3816
+ /* @__PURE__ */ jsxs16(Tooltip4, { children: [
3817
+ /* @__PURE__ */ jsx18(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx18(
3818
+ Button11,
4112
3819
  {
4113
3820
  variant: "ghost",
4114
3821
  size: "icon",
4115
3822
  className: "h-8 w-8 text-destructive hover:text-destructive",
4116
3823
  "aria-label": "Excluir",
4117
3824
  onClick: () => onDelete(row.original.id),
4118
- children: /* @__PURE__ */ jsx19(Trash24, { className: "h-4 w-4" })
3825
+ children: /* @__PURE__ */ jsx18(Trash23, { className: "h-4 w-4" })
4119
3826
  }
4120
3827
  ) }),
4121
- /* @__PURE__ */ jsx19(TooltipContent3, { children: "Excluir" })
3828
+ /* @__PURE__ */ jsx18(TooltipContent4, { children: "Excluir" })
4122
3829
  ] })
4123
3830
  ] })
4124
3831
  }
4125
3832
  ];
4126
3833
  }
4127
3834
  function ToolsTable({ onEdit, config }) {
4128
- const [search, setSearch] = useState11("");
4129
- const [page, setPage] = useState11(1);
3835
+ const [search, setSearch] = useState10("");
3836
+ const [page, setPage] = useState10(1);
4130
3837
  const queryParams = useMemo6(() => {
4131
3838
  const params = {
4132
3839
  limit: "15",
@@ -4139,9 +3846,10 @@ function ToolsTable({ onEdit, config }) {
4139
3846
  }, [search, page]);
4140
3847
  const { data, isLoading } = useTools(config, queryParams);
4141
3848
  const deleteTool = useDeleteTool(config);
4142
- const [deleteId, setDeleteId] = useState11(null);
4143
- const tools = data?.data || [];
4144
- const total = data?.total || 0;
3849
+ const [deleteId, setDeleteId] = useState10(null);
3850
+ const rawTools = data?.data || [];
3851
+ const tools = rawTools.filter((t) => !t.slug?.startsWith("gclinic_"));
3852
+ const total = tools.length;
4145
3853
  const columns = useColumns2(
4146
3854
  (tool) => onEdit(tool),
4147
3855
  (id) => setDeleteId(id)
@@ -4150,21 +3858,21 @@ function ToolsTable({ onEdit, config }) {
4150
3858
  if (!deleteId) return;
4151
3859
  deleteTool.mutate(deleteId, {
4152
3860
  onSuccess: () => {
4153
- toast9.success("Ferramenta exclu\xEDda");
3861
+ toast8.success("Ferramenta exclu\xEDda");
4154
3862
  setDeleteId(null);
4155
3863
  },
4156
- onError: () => toast9.error("Erro ao excluir ferramenta")
3864
+ onError: () => toast8.error("Erro ao excluir ferramenta")
4157
3865
  });
4158
3866
  }
4159
3867
  function handleSearchChange(value) {
4160
3868
  setSearch(value);
4161
3869
  setPage(1);
4162
3870
  }
4163
- return /* @__PURE__ */ jsxs17(Fragment2, { children: [
4164
- /* @__PURE__ */ jsx19("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs17("div", { className: "relative flex-1 max-w-md", children: [
4165
- /* @__PURE__ */ jsx19(Search2, { "aria-hidden": "true", className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
4166
- /* @__PURE__ */ jsx19(
4167
- Input8,
3871
+ return /* @__PURE__ */ jsxs16(Fragment2, { children: [
3872
+ /* @__PURE__ */ jsx18("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs16("div", { className: "relative flex-1 max-w-md", children: [
3873
+ /* @__PURE__ */ jsx18(Search2, { "aria-hidden": "true", className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
3874
+ /* @__PURE__ */ jsx18(
3875
+ Input7,
4168
3876
  {
4169
3877
  placeholder: "Buscar ferramentas\\u2026",
4170
3878
  "aria-label": "Buscar ferramentas",
@@ -4176,7 +3884,7 @@ function ToolsTable({ onEdit, config }) {
4176
3884
  }
4177
3885
  )
4178
3886
  ] }) }),
4179
- /* @__PURE__ */ jsx19(
3887
+ /* @__PURE__ */ jsx18(
4180
3888
  DataTable2,
4181
3889
  {
4182
3890
  columns,
@@ -4189,20 +3897,20 @@ function ToolsTable({ onEdit, config }) {
4189
3897
  pageSize: 15
4190
3898
  }
4191
3899
  ),
4192
- /* @__PURE__ */ jsx19(
4193
- AlertDialog4,
3900
+ /* @__PURE__ */ jsx18(
3901
+ AlertDialog3,
4194
3902
  {
4195
3903
  open: !!deleteId,
4196
3904
  onOpenChange: (open) => !open && setDeleteId(null),
4197
- children: /* @__PURE__ */ jsxs17(AlertDialogContent4, { children: [
4198
- /* @__PURE__ */ jsxs17(AlertDialogHeader4, { children: [
4199
- /* @__PURE__ */ jsx19(AlertDialogTitle4, { children: "Excluir ferramenta?" }),
4200
- /* @__PURE__ */ jsx19(AlertDialogDescription4, { children: "Esta a\xE7\xE3o n\xE3o pode ser desfeita. A ferramenta ser\xE1 removida permanentemente." })
3905
+ children: /* @__PURE__ */ jsxs16(AlertDialogContent3, { children: [
3906
+ /* @__PURE__ */ jsxs16(AlertDialogHeader3, { children: [
3907
+ /* @__PURE__ */ jsx18(AlertDialogTitle3, { children: "Excluir ferramenta?" }),
3908
+ /* @__PURE__ */ jsx18(AlertDialogDescription3, { children: "Esta a\xE7\xE3o n\xE3o pode ser desfeita. A ferramenta ser\xE1 removida permanentemente." })
4201
3909
  ] }),
4202
- /* @__PURE__ */ jsxs17(AlertDialogFooter4, { children: [
4203
- /* @__PURE__ */ jsx19(AlertDialogCancel4, { variant: "outline", size: "default", children: "Cancelar" }),
4204
- /* @__PURE__ */ jsx19(
4205
- AlertDialogAction4,
3910
+ /* @__PURE__ */ jsxs16(AlertDialogFooter3, { children: [
3911
+ /* @__PURE__ */ jsx18(AlertDialogCancel3, { variant: "outline", size: "default", children: "Cancelar" }),
3912
+ /* @__PURE__ */ jsx18(
3913
+ AlertDialogAction3,
4206
3914
  {
4207
3915
  variant: "default",
4208
3916
  size: "default",
@@ -4219,39 +3927,39 @@ function ToolsTable({ onEdit, config }) {
4219
3927
  }
4220
3928
 
4221
3929
  // src/components/tools/tool-credentials-form.tsx
4222
- import { useMemo as useMemo7, useState as useState12 } from "react";
3930
+ import { useMemo as useMemo7, useState as useState11 } from "react";
4223
3931
  import { DataTable as DataTable3 } from "@greatapps/greatauth-ui";
4224
3932
  import {
4225
- Input as Input9,
4226
- Button as Button13,
4227
- Badge as Badge9,
4228
- Tooltip as Tooltip4,
4229
- TooltipTrigger as TooltipTrigger4,
4230
- TooltipContent as TooltipContent4,
4231
- Dialog as Dialog6,
4232
- DialogContent as DialogContent6,
4233
- DialogHeader as DialogHeader6,
4234
- DialogTitle as DialogTitle6,
4235
- DialogFooter as DialogFooter6,
4236
- AlertDialog as AlertDialog5,
4237
- AlertDialogAction as AlertDialogAction5,
4238
- AlertDialogCancel as AlertDialogCancel5,
4239
- AlertDialogContent as AlertDialogContent5,
4240
- AlertDialogDescription as AlertDialogDescription5,
4241
- AlertDialogFooter as AlertDialogFooter5,
4242
- AlertDialogHeader as AlertDialogHeader5,
4243
- AlertDialogTitle as AlertDialogTitle5,
4244
- Select as Select3,
4245
- SelectContent as SelectContent3,
4246
- SelectItem as SelectItem3,
4247
- SelectTrigger as SelectTrigger3,
4248
- SelectValue as SelectValue3
3933
+ Input as Input8,
3934
+ Button as Button12,
3935
+ Badge as Badge8,
3936
+ Tooltip as Tooltip5,
3937
+ TooltipTrigger as TooltipTrigger5,
3938
+ TooltipContent as TooltipContent5,
3939
+ Dialog as Dialog5,
3940
+ DialogContent as DialogContent5,
3941
+ DialogHeader as DialogHeader5,
3942
+ DialogTitle as DialogTitle5,
3943
+ DialogFooter as DialogFooter5,
3944
+ AlertDialog as AlertDialog4,
3945
+ AlertDialogAction as AlertDialogAction4,
3946
+ AlertDialogCancel as AlertDialogCancel4,
3947
+ AlertDialogContent as AlertDialogContent4,
3948
+ AlertDialogDescription as AlertDialogDescription4,
3949
+ AlertDialogFooter as AlertDialogFooter4,
3950
+ AlertDialogHeader as AlertDialogHeader4,
3951
+ AlertDialogTitle as AlertDialogTitle4,
3952
+ Select as Select2,
3953
+ SelectContent as SelectContent2,
3954
+ SelectItem as SelectItem2,
3955
+ SelectTrigger as SelectTrigger2,
3956
+ SelectValue as SelectValue2
4249
3957
  } from "@greatapps/greatauth-ui/ui";
4250
- import { Trash2 as Trash25, Pencil as Pencil4, Link, Search as Search3 } from "lucide-react";
3958
+ import { Trash2 as Trash24, Pencil as Pencil4, Link, Search as Search3 } from "lucide-react";
4251
3959
  import { format as format3 } from "date-fns";
4252
3960
  import { ptBR as ptBR3 } from "date-fns/locale";
4253
- import { toast as toast10 } from "sonner";
4254
- import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
3961
+ import { toast as toast9 } from "sonner";
3962
+ import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
4255
3963
  function formatDate2(dateStr) {
4256
3964
  if (!dateStr) return "Sem expira\xE7\xE3o";
4257
3965
  return format3(new Date(dateStr), "dd/MM/yyyy", { locale: ptBR3 });
@@ -4271,18 +3979,18 @@ function useColumns3(tools, onEdit, onConnect, onRemove) {
4271
3979
  {
4272
3980
  accessorKey: "label",
4273
3981
  header: "Label",
4274
- cell: ({ row }) => /* @__PURE__ */ jsx20("span", { className: "font-medium", children: row.original.label || "\u2014" })
3982
+ cell: ({ row }) => /* @__PURE__ */ jsx19("span", { className: "font-medium", children: row.original.label || "\u2014" })
4275
3983
  },
4276
3984
  {
4277
3985
  accessorKey: "id_tool",
4278
3986
  header: "Ferramenta",
4279
- cell: ({ row }) => /* @__PURE__ */ jsx20("span", { className: "text-sm", children: getToolName(row.original.id_tool) })
3987
+ cell: ({ row }) => /* @__PURE__ */ jsx19("span", { className: "text-sm", children: getToolName(row.original.id_tool) })
4280
3988
  },
4281
3989
  {
4282
3990
  accessorKey: "status",
4283
3991
  header: "Status",
4284
- cell: ({ row }) => /* @__PURE__ */ jsx20(
4285
- Badge9,
3992
+ cell: ({ row }) => /* @__PURE__ */ jsx19(
3993
+ Badge8,
4286
3994
  {
4287
3995
  variant: row.original.status === "active" ? "default" : "destructive",
4288
3996
  children: row.original.status === "active" ? "Ativo" : "Expirado"
@@ -4292,60 +4000,60 @@ function useColumns3(tools, onEdit, onConnect, onRemove) {
4292
4000
  {
4293
4001
  accessorKey: "expires_at",
4294
4002
  header: "Expira em",
4295
- cell: ({ row }) => /* @__PURE__ */ jsx20("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.expires_at) })
4003
+ cell: ({ row }) => /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.expires_at) })
4296
4004
  },
4297
4005
  {
4298
4006
  accessorKey: "datetime_add",
4299
4007
  header: "Criado em",
4300
- cell: ({ row }) => /* @__PURE__ */ jsx20("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.datetime_add) })
4008
+ cell: ({ row }) => /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.datetime_add) })
4301
4009
  },
4302
4010
  {
4303
4011
  id: "actions",
4304
4012
  header: "A\xE7\xF5es",
4305
4013
  size: 100,
4306
4014
  enableSorting: false,
4307
- cell: ({ row }) => /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-1", children: [
4308
- getToolType(row.original.id_tool) === "oauth2" && /* @__PURE__ */ jsxs18(Tooltip4, { children: [
4309
- /* @__PURE__ */ jsx20(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx20(
4310
- Button13,
4015
+ cell: ({ row }) => /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
4016
+ getToolType(row.original.id_tool) === "oauth2" && /* @__PURE__ */ jsxs17(Tooltip5, { children: [
4017
+ /* @__PURE__ */ jsx19(TooltipTrigger5, { asChild: true, children: /* @__PURE__ */ jsx19(
4018
+ Button12,
4311
4019
  {
4312
4020
  variant: "ghost",
4313
4021
  size: "icon",
4314
4022
  className: "h-8 w-8",
4315
4023
  "aria-label": "Vincular",
4316
4024
  disabled: true,
4317
- children: /* @__PURE__ */ jsx20(Link, { className: "h-4 w-4" })
4025
+ children: /* @__PURE__ */ jsx19(Link, { className: "h-4 w-4" })
4318
4026
  }
4319
4027
  ) }),
4320
- /* @__PURE__ */ jsx20(TooltipContent4, { children: "Em breve" })
4028
+ /* @__PURE__ */ jsx19(TooltipContent5, { children: "Em breve" })
4321
4029
  ] }),
4322
- /* @__PURE__ */ jsxs18(Tooltip4, { children: [
4323
- /* @__PURE__ */ jsx20(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx20(
4324
- Button13,
4030
+ /* @__PURE__ */ jsxs17(Tooltip5, { children: [
4031
+ /* @__PURE__ */ jsx19(TooltipTrigger5, { asChild: true, children: /* @__PURE__ */ jsx19(
4032
+ Button12,
4325
4033
  {
4326
4034
  variant: "ghost",
4327
4035
  size: "icon",
4328
4036
  className: "h-8 w-8",
4329
4037
  "aria-label": "Editar",
4330
4038
  onClick: () => onEdit(row.original),
4331
- children: /* @__PURE__ */ jsx20(Pencil4, { className: "h-4 w-4" })
4039
+ children: /* @__PURE__ */ jsx19(Pencil4, { className: "h-4 w-4" })
4332
4040
  }
4333
4041
  ) }),
4334
- /* @__PURE__ */ jsx20(TooltipContent4, { children: "Editar" })
4042
+ /* @__PURE__ */ jsx19(TooltipContent5, { children: "Editar" })
4335
4043
  ] }),
4336
- /* @__PURE__ */ jsxs18(Tooltip4, { children: [
4337
- /* @__PURE__ */ jsx20(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx20(
4338
- Button13,
4044
+ /* @__PURE__ */ jsxs17(Tooltip5, { children: [
4045
+ /* @__PURE__ */ jsx19(TooltipTrigger5, { asChild: true, children: /* @__PURE__ */ jsx19(
4046
+ Button12,
4339
4047
  {
4340
4048
  variant: "ghost",
4341
4049
  size: "icon",
4342
4050
  className: "h-8 w-8 text-destructive hover:text-destructive",
4343
4051
  "aria-label": "Excluir",
4344
4052
  onClick: () => onRemove(row.original),
4345
- children: /* @__PURE__ */ jsx20(Trash25, { className: "h-4 w-4" })
4053
+ children: /* @__PURE__ */ jsx19(Trash24, { className: "h-4 w-4" })
4346
4054
  }
4347
4055
  ) }),
4348
- /* @__PURE__ */ jsx20(TooltipContent4, { children: "Remover" })
4056
+ /* @__PURE__ */ jsx19(TooltipContent5, { children: "Remover" })
4349
4057
  ] })
4350
4058
  ] })
4351
4059
  }
@@ -4363,34 +4071,43 @@ function ToolCredentialsForm({
4363
4071
  const updateMutation = useUpdateToolCredential(config);
4364
4072
  const deleteMutation = useDeleteToolCredential(config);
4365
4073
  const { data: toolsData } = useTools(config);
4366
- const tools = toolsData?.data || [];
4367
- const [search, setSearch] = useState12("");
4368
- const [internalCreateOpen, setInternalCreateOpen] = useState12(false);
4074
+ const tools = (toolsData?.data || []).filter((t) => !t.slug?.startsWith("gclinic_"));
4075
+ const [search, setSearch] = useState11("");
4076
+ const [internalCreateOpen, setInternalCreateOpen] = useState11(false);
4369
4077
  const showCreateDialog = externalCreateOpen ?? internalCreateOpen;
4370
4078
  const setShowCreateDialog = onCreateOpenChange ?? setInternalCreateOpen;
4371
- const [createForm, setCreateForm] = useState12({
4079
+ const [createForm, setCreateForm] = useState11({
4372
4080
  id_tool: "",
4373
4081
  label: "",
4374
4082
  credentials_encrypted: "",
4375
4083
  expires_at: ""
4376
4084
  });
4377
- const [editTarget, setEditTarget] = useState12(null);
4378
- const [editForm, setEditForm] = useState12({
4085
+ const [editTarget, setEditTarget] = useState11(null);
4086
+ const [editForm, setEditForm] = useState11({
4379
4087
  id_tool: "",
4380
4088
  label: "",
4381
4089
  credentials_encrypted: "",
4382
4090
  expires_at: "",
4383
4091
  status: ""
4384
4092
  });
4385
- const [removeTarget, setRemoveTarget] = useState12(null);
4093
+ const [removeTarget, setRemoveTarget] = useState11(null);
4094
+ const internalToolIds = useMemo7(() => {
4095
+ const allRawTools = toolsData?.data || [];
4096
+ return new Set(
4097
+ allRawTools.filter((t) => t.slug?.startsWith("gclinic_")).map((t) => t.id)
4098
+ );
4099
+ }, [toolsData]);
4386
4100
  const filteredCredentials = useMemo7(() => {
4387
- if (!search) return credentials;
4101
+ const visible = credentials.filter(
4102
+ (cred) => !cred.id_tool || !internalToolIds.has(cred.id_tool)
4103
+ );
4104
+ if (!search) return visible;
4388
4105
  const term = search.toLowerCase();
4389
- return credentials.filter((cred) => {
4106
+ return visible.filter((cred) => {
4390
4107
  const toolName = tools.find((t) => t.id === cred.id_tool)?.name || "";
4391
4108
  return (cred.label || "").toLowerCase().includes(term) || toolName.toLowerCase().includes(term);
4392
4109
  });
4393
- }, [credentials, search, tools]);
4110
+ }, [credentials, search, tools, internalToolIds]);
4394
4111
  const columns = useColumns3(
4395
4112
  tools,
4396
4113
  (cred) => startEdit(cred),
@@ -4408,14 +4125,14 @@ function ToolCredentialsForm({
4408
4125
  ...createForm.expires_at ? { expires_at: createForm.expires_at } : {}
4409
4126
  });
4410
4127
  if (result.status === 1) {
4411
- toast10.success("Credencial criada");
4128
+ toast9.success("Credencial criada");
4412
4129
  setShowCreateDialog(false);
4413
4130
  setCreateForm({ id_tool: "", label: "", credentials_encrypted: "", expires_at: "" });
4414
4131
  } else {
4415
- toast10.error(result.message || "Erro ao criar credencial");
4132
+ toast9.error(result.message || "Erro ao criar credencial");
4416
4133
  }
4417
4134
  } catch {
4418
- toast10.error("Erro ao criar credencial");
4135
+ toast9.error("Erro ao criar credencial");
4419
4136
  }
4420
4137
  }
4421
4138
  function startEdit(cred) {
@@ -4457,13 +4174,13 @@ function ToolCredentialsForm({
4457
4174
  body
4458
4175
  });
4459
4176
  if (result.status === 1) {
4460
- toast10.success("Credencial atualizada");
4177
+ toast9.success("Credencial atualizada");
4461
4178
  setEditTarget(null);
4462
4179
  } else {
4463
- toast10.error(result.message || "Erro ao atualizar credencial");
4180
+ toast9.error(result.message || "Erro ao atualizar credencial");
4464
4181
  }
4465
4182
  } catch {
4466
- toast10.error("Erro ao atualizar credencial");
4183
+ toast9.error("Erro ao atualizar credencial");
4467
4184
  }
4468
4185
  }
4469
4186
  async function handleRemove() {
@@ -4471,12 +4188,12 @@ function ToolCredentialsForm({
4471
4188
  try {
4472
4189
  const result = await deleteMutation.mutateAsync(removeTarget.id);
4473
4190
  if (result.status === 1) {
4474
- toast10.success("Credencial removida");
4191
+ toast9.success("Credencial removida");
4475
4192
  } else {
4476
- toast10.error(result.message || "Erro ao remover credencial");
4193
+ toast9.error(result.message || "Erro ao remover credencial");
4477
4194
  }
4478
4195
  } catch {
4479
- toast10.error("Erro ao remover credencial");
4196
+ toast9.error("Erro ao remover credencial");
4480
4197
  } finally {
4481
4198
  setRemoveTarget(null);
4482
4199
  }
@@ -4488,11 +4205,11 @@ function ToolCredentialsForm({
4488
4205
  const url = `${gagentsApiUrl}/v1/${language}/${idWl}/accounts/${config.accountId}/oauth/connect?id_tool=${cred.id_tool}`;
4489
4206
  window.open(url, "_blank");
4490
4207
  }
4491
- return /* @__PURE__ */ jsxs18("div", { className: "space-y-4", children: [
4492
- /* @__PURE__ */ jsx20("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs18("div", { className: "relative flex-1 max-w-md", children: [
4493
- /* @__PURE__ */ jsx20(Search3, { "aria-hidden": "true", className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
4494
- /* @__PURE__ */ jsx20(
4495
- Input9,
4208
+ return /* @__PURE__ */ jsxs17("div", { className: "space-y-4", children: [
4209
+ /* @__PURE__ */ jsx19("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs17("div", { className: "relative flex-1 max-w-md", children: [
4210
+ /* @__PURE__ */ jsx19(Search3, { "aria-hidden": "true", className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
4211
+ /* @__PURE__ */ jsx19(
4212
+ Input8,
4496
4213
  {
4497
4214
  placeholder: "Buscar credenciais\\u2026",
4498
4215
  "aria-label": "Buscar credenciais",
@@ -4504,7 +4221,7 @@ function ToolCredentialsForm({
4504
4221
  }
4505
4222
  )
4506
4223
  ] }) }),
4507
- /* @__PURE__ */ jsx20(
4224
+ /* @__PURE__ */ jsx19(
4508
4225
  DataTable3,
4509
4226
  {
4510
4227
  columns,
@@ -4513,27 +4230,27 @@ function ToolCredentialsForm({
4513
4230
  emptyMessage: "Nenhuma credencial encontrada"
4514
4231
  }
4515
4232
  ),
4516
- /* @__PURE__ */ jsx20(Dialog6, { open: showCreateDialog, onOpenChange: setShowCreateDialog, children: /* @__PURE__ */ jsxs18(DialogContent6, { children: [
4517
- /* @__PURE__ */ jsx20(DialogHeader6, { children: /* @__PURE__ */ jsx20(DialogTitle6, { children: "Nova Credencial" }) }),
4518
- /* @__PURE__ */ jsxs18("div", { className: "space-y-4", children: [
4519
- /* @__PURE__ */ jsxs18("div", { children: [
4520
- /* @__PURE__ */ jsx20("label", { htmlFor: "cred-tool", className: "mb-1 block text-sm font-medium", children: "Ferramenta *" }),
4521
- /* @__PURE__ */ jsxs18(
4522
- Select3,
4233
+ /* @__PURE__ */ jsx19(Dialog5, { open: showCreateDialog, onOpenChange: setShowCreateDialog, children: /* @__PURE__ */ jsxs17(DialogContent5, { children: [
4234
+ /* @__PURE__ */ jsx19(DialogHeader5, { children: /* @__PURE__ */ jsx19(DialogTitle5, { children: "Nova Credencial" }) }),
4235
+ /* @__PURE__ */ jsxs17("div", { className: "space-y-4", children: [
4236
+ /* @__PURE__ */ jsxs17("div", { children: [
4237
+ /* @__PURE__ */ jsx19("label", { htmlFor: "cred-tool", className: "mb-1 block text-sm font-medium", children: "Ferramenta *" }),
4238
+ /* @__PURE__ */ jsxs17(
4239
+ Select2,
4523
4240
  {
4524
4241
  value: createForm.id_tool,
4525
4242
  onValueChange: (val) => setCreateForm((f) => ({ ...f, id_tool: val })),
4526
4243
  children: [
4527
- /* @__PURE__ */ jsx20(SelectTrigger3, { id: "cred-tool", children: /* @__PURE__ */ jsx20(SelectValue3, { placeholder: "Selecione a ferramenta" }) }),
4528
- /* @__PURE__ */ jsx20(SelectContent3, { children: tools.map((tool) => /* @__PURE__ */ jsx20(SelectItem3, { value: String(tool.id), children: tool.name }, tool.id)) })
4244
+ /* @__PURE__ */ jsx19(SelectTrigger2, { id: "cred-tool", children: /* @__PURE__ */ jsx19(SelectValue2, { placeholder: "Selecione a ferramenta" }) }),
4245
+ /* @__PURE__ */ jsx19(SelectContent2, { children: tools.map((tool) => /* @__PURE__ */ jsx19(SelectItem2, { value: String(tool.id), children: tool.name }, tool.id)) })
4529
4246
  ]
4530
4247
  }
4531
4248
  )
4532
4249
  ] }),
4533
- /* @__PURE__ */ jsxs18("div", { children: [
4534
- /* @__PURE__ */ jsx20("label", { htmlFor: "cred-label", className: "mb-1 block text-sm font-medium", children: "Label *" }),
4535
- /* @__PURE__ */ jsx20(
4536
- Input9,
4250
+ /* @__PURE__ */ jsxs17("div", { children: [
4251
+ /* @__PURE__ */ jsx19("label", { htmlFor: "cred-label", className: "mb-1 block text-sm font-medium", children: "Label *" }),
4252
+ /* @__PURE__ */ jsx19(
4253
+ Input8,
4537
4254
  {
4538
4255
  id: "cred-label",
4539
4256
  name: "label",
@@ -4543,10 +4260,10 @@ function ToolCredentialsForm({
4543
4260
  }
4544
4261
  )
4545
4262
  ] }),
4546
- /* @__PURE__ */ jsxs18("div", { children: [
4547
- /* @__PURE__ */ jsx20("label", { htmlFor: "cred-credential", className: "mb-1 block text-sm font-medium", children: "Credencial *" }),
4548
- /* @__PURE__ */ jsx20(
4549
- Input9,
4263
+ /* @__PURE__ */ jsxs17("div", { children: [
4264
+ /* @__PURE__ */ jsx19("label", { htmlFor: "cred-credential", className: "mb-1 block text-sm font-medium", children: "Credencial *" }),
4265
+ /* @__PURE__ */ jsx19(
4266
+ Input8,
4550
4267
  {
4551
4268
  id: "cred-credential",
4552
4269
  name: "credential",
@@ -4561,10 +4278,10 @@ function ToolCredentialsForm({
4561
4278
  }
4562
4279
  )
4563
4280
  ] }),
4564
- /* @__PURE__ */ jsxs18("div", { children: [
4565
- /* @__PURE__ */ jsx20("label", { htmlFor: "cred-expires", className: "mb-1 block text-sm font-medium", children: "Data de Expira\xE7\xE3o (opcional)" }),
4566
- /* @__PURE__ */ jsx20(
4567
- Input9,
4281
+ /* @__PURE__ */ jsxs17("div", { children: [
4282
+ /* @__PURE__ */ jsx19("label", { htmlFor: "cred-expires", className: "mb-1 block text-sm font-medium", children: "Data de Expira\xE7\xE3o (opcional)" }),
4283
+ /* @__PURE__ */ jsx19(
4284
+ Input8,
4568
4285
  {
4569
4286
  id: "cred-expires",
4570
4287
  name: "expires",
@@ -4575,17 +4292,17 @@ function ToolCredentialsForm({
4575
4292
  )
4576
4293
  ] })
4577
4294
  ] }),
4578
- /* @__PURE__ */ jsxs18(DialogFooter6, { children: [
4579
- /* @__PURE__ */ jsx20(
4580
- Button13,
4295
+ /* @__PURE__ */ jsxs17(DialogFooter5, { children: [
4296
+ /* @__PURE__ */ jsx19(
4297
+ Button12,
4581
4298
  {
4582
4299
  variant: "outline",
4583
4300
  onClick: () => setShowCreateDialog(false),
4584
4301
  children: "Cancelar"
4585
4302
  }
4586
4303
  ),
4587
- /* @__PURE__ */ jsx20(
4588
- Button13,
4304
+ /* @__PURE__ */ jsx19(
4305
+ Button12,
4589
4306
  {
4590
4307
  onClick: handleCreate,
4591
4308
  disabled: !createForm.id_tool || !createForm.label.trim() || !createForm.credentials_encrypted.trim() || createMutation.isPending,
@@ -4594,32 +4311,32 @@ function ToolCredentialsForm({
4594
4311
  )
4595
4312
  ] })
4596
4313
  ] }) }),
4597
- /* @__PURE__ */ jsx20(
4598
- Dialog6,
4314
+ /* @__PURE__ */ jsx19(
4315
+ Dialog5,
4599
4316
  {
4600
4317
  open: !!editTarget,
4601
4318
  onOpenChange: (open) => !open && setEditTarget(null),
4602
- children: /* @__PURE__ */ jsxs18(DialogContent6, { children: [
4603
- /* @__PURE__ */ jsx20(DialogHeader6, { children: /* @__PURE__ */ jsx20(DialogTitle6, { children: "Editar Credencial" }) }),
4604
- /* @__PURE__ */ jsxs18("div", { className: "space-y-4", children: [
4605
- /* @__PURE__ */ jsxs18("div", { children: [
4606
- /* @__PURE__ */ jsx20("label", { htmlFor: "edit-cred-tool", className: "mb-1 block text-sm font-medium", children: "Ferramenta *" }),
4607
- /* @__PURE__ */ jsxs18(
4608
- Select3,
4319
+ children: /* @__PURE__ */ jsxs17(DialogContent5, { children: [
4320
+ /* @__PURE__ */ jsx19(DialogHeader5, { children: /* @__PURE__ */ jsx19(DialogTitle5, { children: "Editar Credencial" }) }),
4321
+ /* @__PURE__ */ jsxs17("div", { className: "space-y-4", children: [
4322
+ /* @__PURE__ */ jsxs17("div", { children: [
4323
+ /* @__PURE__ */ jsx19("label", { htmlFor: "edit-cred-tool", className: "mb-1 block text-sm font-medium", children: "Ferramenta *" }),
4324
+ /* @__PURE__ */ jsxs17(
4325
+ Select2,
4609
4326
  {
4610
4327
  value: editForm.id_tool,
4611
4328
  onValueChange: (val) => setEditForm((f) => ({ ...f, id_tool: val })),
4612
4329
  children: [
4613
- /* @__PURE__ */ jsx20(SelectTrigger3, { id: "edit-cred-tool", children: /* @__PURE__ */ jsx20(SelectValue3, { placeholder: "Selecione a ferramenta" }) }),
4614
- /* @__PURE__ */ jsx20(SelectContent3, { children: tools.map((tool) => /* @__PURE__ */ jsx20(SelectItem3, { value: String(tool.id), children: tool.name }, tool.id)) })
4330
+ /* @__PURE__ */ jsx19(SelectTrigger2, { id: "edit-cred-tool", children: /* @__PURE__ */ jsx19(SelectValue2, { placeholder: "Selecione a ferramenta" }) }),
4331
+ /* @__PURE__ */ jsx19(SelectContent2, { children: tools.map((tool) => /* @__PURE__ */ jsx19(SelectItem2, { value: String(tool.id), children: tool.name }, tool.id)) })
4615
4332
  ]
4616
4333
  }
4617
4334
  )
4618
4335
  ] }),
4619
- /* @__PURE__ */ jsxs18("div", { children: [
4620
- /* @__PURE__ */ jsx20("label", { htmlFor: "edit-cred-label", className: "mb-1 block text-sm font-medium", children: "Label" }),
4621
- /* @__PURE__ */ jsx20(
4622
- Input9,
4336
+ /* @__PURE__ */ jsxs17("div", { children: [
4337
+ /* @__PURE__ */ jsx19("label", { htmlFor: "edit-cred-label", className: "mb-1 block text-sm font-medium", children: "Label" }),
4338
+ /* @__PURE__ */ jsx19(
4339
+ Input8,
4623
4340
  {
4624
4341
  id: "edit-cred-label",
4625
4342
  name: "label",
@@ -4629,10 +4346,10 @@ function ToolCredentialsForm({
4629
4346
  }
4630
4347
  )
4631
4348
  ] }),
4632
- /* @__PURE__ */ jsxs18("div", { children: [
4633
- /* @__PURE__ */ jsx20("label", { htmlFor: "edit-cred-credential", className: "mb-1 block text-sm font-medium", children: "Nova Credencial (vazio = manter atual)" }),
4634
- /* @__PURE__ */ jsx20(
4635
- Input9,
4349
+ /* @__PURE__ */ jsxs17("div", { children: [
4350
+ /* @__PURE__ */ jsx19("label", { htmlFor: "edit-cred-credential", className: "mb-1 block text-sm font-medium", children: "Nova Credencial (vazio = manter atual)" }),
4351
+ /* @__PURE__ */ jsx19(
4352
+ Input8,
4636
4353
  {
4637
4354
  id: "edit-cred-credential",
4638
4355
  name: "credential",
@@ -4647,10 +4364,10 @@ function ToolCredentialsForm({
4647
4364
  }
4648
4365
  )
4649
4366
  ] }),
4650
- /* @__PURE__ */ jsxs18("div", { children: [
4651
- /* @__PURE__ */ jsx20("label", { htmlFor: "edit-cred-expires", className: "mb-1 block text-sm font-medium", children: "Data de Expira\xE7\xE3o" }),
4652
- /* @__PURE__ */ jsx20(
4653
- Input9,
4367
+ /* @__PURE__ */ jsxs17("div", { children: [
4368
+ /* @__PURE__ */ jsx19("label", { htmlFor: "edit-cred-expires", className: "mb-1 block text-sm font-medium", children: "Data de Expira\xE7\xE3o" }),
4369
+ /* @__PURE__ */ jsx19(
4370
+ Input8,
4654
4371
  {
4655
4372
  id: "edit-cred-expires",
4656
4373
  name: "expires",
@@ -4660,10 +4377,10 @@ function ToolCredentialsForm({
4660
4377
  }
4661
4378
  )
4662
4379
  ] }),
4663
- /* @__PURE__ */ jsxs18("div", { children: [
4664
- /* @__PURE__ */ jsx20("label", { htmlFor: "edit-cred-status", className: "mb-1 block text-sm font-medium", children: "Status" }),
4665
- /* @__PURE__ */ jsxs18(
4666
- Select3,
4380
+ /* @__PURE__ */ jsxs17("div", { children: [
4381
+ /* @__PURE__ */ jsx19("label", { htmlFor: "edit-cred-status", className: "mb-1 block text-sm font-medium", children: "Status" }),
4382
+ /* @__PURE__ */ jsxs17(
4383
+ Select2,
4667
4384
  {
4668
4385
  value: editForm.status || void 0,
4669
4386
  onValueChange: (val) => setEditForm((f) => ({
@@ -4671,20 +4388,20 @@ function ToolCredentialsForm({
4671
4388
  status: val
4672
4389
  })),
4673
4390
  children: [
4674
- /* @__PURE__ */ jsx20(SelectTrigger3, { id: "edit-cred-status", children: /* @__PURE__ */ jsx20(SelectValue3, {}) }),
4675
- /* @__PURE__ */ jsxs18(SelectContent3, { children: [
4676
- /* @__PURE__ */ jsx20(SelectItem3, { value: "active", children: "Ativo" }),
4677
- /* @__PURE__ */ jsx20(SelectItem3, { value: "expired", children: "Expirado" })
4391
+ /* @__PURE__ */ jsx19(SelectTrigger2, { id: "edit-cred-status", children: /* @__PURE__ */ jsx19(SelectValue2, {}) }),
4392
+ /* @__PURE__ */ jsxs17(SelectContent2, { children: [
4393
+ /* @__PURE__ */ jsx19(SelectItem2, { value: "active", children: "Ativo" }),
4394
+ /* @__PURE__ */ jsx19(SelectItem2, { value: "expired", children: "Expirado" })
4678
4395
  ] })
4679
4396
  ]
4680
4397
  }
4681
4398
  )
4682
4399
  ] })
4683
4400
  ] }),
4684
- /* @__PURE__ */ jsxs18(DialogFooter6, { children: [
4685
- /* @__PURE__ */ jsx20(Button13, { variant: "outline", onClick: () => setEditTarget(null), children: "Cancelar" }),
4686
- /* @__PURE__ */ jsx20(
4687
- Button13,
4401
+ /* @__PURE__ */ jsxs17(DialogFooter5, { children: [
4402
+ /* @__PURE__ */ jsx19(Button12, { variant: "outline", onClick: () => setEditTarget(null), children: "Cancelar" }),
4403
+ /* @__PURE__ */ jsx19(
4404
+ Button12,
4688
4405
  {
4689
4406
  onClick: handleSaveEdit,
4690
4407
  disabled: updateMutation.isPending,
@@ -4695,20 +4412,20 @@ function ToolCredentialsForm({
4695
4412
  ] })
4696
4413
  }
4697
4414
  ),
4698
- /* @__PURE__ */ jsx20(
4699
- AlertDialog5,
4415
+ /* @__PURE__ */ jsx19(
4416
+ AlertDialog4,
4700
4417
  {
4701
4418
  open: !!removeTarget,
4702
4419
  onOpenChange: (open) => !open && setRemoveTarget(null),
4703
- children: /* @__PURE__ */ jsxs18(AlertDialogContent5, { children: [
4704
- /* @__PURE__ */ jsxs18(AlertDialogHeader5, { children: [
4705
- /* @__PURE__ */ jsx20(AlertDialogTitle5, { children: "Remover credencial?" }),
4706
- /* @__PURE__ */ jsx20(AlertDialogDescription5, { children: "A credencial ser\xE1 removida permanentemente." })
4420
+ children: /* @__PURE__ */ jsxs17(AlertDialogContent4, { children: [
4421
+ /* @__PURE__ */ jsxs17(AlertDialogHeader4, { children: [
4422
+ /* @__PURE__ */ jsx19(AlertDialogTitle4, { children: "Remover credencial?" }),
4423
+ /* @__PURE__ */ jsx19(AlertDialogDescription4, { children: "A credencial ser\xE1 removida permanentemente." })
4707
4424
  ] }),
4708
- /* @__PURE__ */ jsxs18(AlertDialogFooter5, { children: [
4709
- /* @__PURE__ */ jsx20(AlertDialogCancel5, { children: "Cancelar" }),
4710
- /* @__PURE__ */ jsx20(
4711
- AlertDialogAction5,
4425
+ /* @__PURE__ */ jsxs17(AlertDialogFooter4, { children: [
4426
+ /* @__PURE__ */ jsx19(AlertDialogCancel4, { children: "Cancelar" }),
4427
+ /* @__PURE__ */ jsx19(
4428
+ AlertDialogAction4,
4712
4429
  {
4713
4430
  onClick: handleRemove,
4714
4431
  disabled: deleteMutation.isPending,
@@ -4723,26 +4440,26 @@ function ToolCredentialsForm({
4723
4440
  }
4724
4441
 
4725
4442
  // src/components/tools/tool-form-dialog.tsx
4726
- import { useState as useState13 } from "react";
4443
+ import { useState as useState12 } from "react";
4727
4444
  import {
4728
- Dialog as Dialog7,
4729
- DialogContent as DialogContent7,
4730
- DialogHeader as DialogHeader7,
4731
- DialogTitle as DialogTitle7,
4732
- DialogFooter as DialogFooter7,
4733
- Button as Button14,
4734
- Input as Input10,
4735
- Textarea as Textarea3,
4736
- Label as Label8,
4737
- Select as Select4,
4738
- SelectContent as SelectContent4,
4739
- SelectItem as SelectItem4,
4740
- SelectTrigger as SelectTrigger4,
4741
- SelectValue as SelectValue4
4445
+ Dialog as Dialog6,
4446
+ DialogContent as DialogContent6,
4447
+ DialogHeader as DialogHeader6,
4448
+ DialogTitle as DialogTitle6,
4449
+ DialogFooter as DialogFooter6,
4450
+ Button as Button13,
4451
+ Input as Input9,
4452
+ Textarea as Textarea2,
4453
+ Label as Label7,
4454
+ Select as Select3,
4455
+ SelectContent as SelectContent3,
4456
+ SelectItem as SelectItem3,
4457
+ SelectTrigger as SelectTrigger3,
4458
+ SelectValue as SelectValue3
4742
4459
  } from "@greatapps/greatauth-ui/ui";
4743
4460
  import { Loader2 as Loader28 } from "lucide-react";
4744
- import { toast as toast11 } from "sonner";
4745
- import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
4461
+ import { toast as toast10 } from "sonner";
4462
+ import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
4746
4463
  var TOOL_AUTH_TYPES = [
4747
4464
  { value: "none", label: "Nenhuma" },
4748
4465
  { value: "api_key", label: "API Key" },
@@ -4789,9 +4506,9 @@ function ToolFormDialog({
4789
4506
  const isEditing = !!tool;
4790
4507
  const createTool = useCreateTool(config);
4791
4508
  const updateTool = useUpdateTool(config);
4792
- const [form, setForm] = useState13(() => toolToFormState(tool));
4793
- const [slugManuallyEdited, setSlugManuallyEdited] = useState13(false);
4794
- const [lastResetKey, setLastResetKey] = useState13(
4509
+ const [form, setForm] = useState12(() => toolToFormState(tool));
4510
+ const [slugManuallyEdited, setSlugManuallyEdited] = useState12(false);
4511
+ const [lastResetKey, setLastResetKey] = useState12(
4795
4512
  () => `${tool?.id}-${open}`
4796
4513
  );
4797
4514
  const resetKey = `${tool?.id}-${open}`;
@@ -4838,27 +4555,27 @@ function ToolFormDialog({
4838
4555
  try {
4839
4556
  if (isEditing) {
4840
4557
  await updateTool.mutateAsync({ id: tool.id, body });
4841
- toast11.success("Ferramenta atualizada");
4558
+ toast10.success("Ferramenta atualizada");
4842
4559
  } else {
4843
4560
  await createTool.mutateAsync(
4844
4561
  body
4845
4562
  );
4846
- toast11.success("Ferramenta criada");
4563
+ toast10.success("Ferramenta criada");
4847
4564
  }
4848
4565
  onOpenChange(false);
4849
4566
  } catch (err) {
4850
- toast11.error(
4567
+ toast10.error(
4851
4568
  err instanceof Error ? err.message : isEditing ? "Erro ao atualizar ferramenta" : "Erro ao criar ferramenta"
4852
4569
  );
4853
4570
  }
4854
4571
  }
4855
- return /* @__PURE__ */ jsx21(Dialog7, { open, onOpenChange, children: /* @__PURE__ */ jsxs19(DialogContent7, { className: "sm:max-w-lg", children: [
4856
- /* @__PURE__ */ jsx21(DialogHeader7, { children: /* @__PURE__ */ jsx21(DialogTitle7, { children: isEditing ? "Editar Ferramenta" : "Nova Ferramenta" }) }),
4857
- /* @__PURE__ */ jsxs19("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
4858
- /* @__PURE__ */ jsxs19("div", { className: "space-y-2", children: [
4859
- /* @__PURE__ */ jsx21(Label8, { htmlFor: "tool-name", children: "Nome *" }),
4860
- /* @__PURE__ */ jsx21(
4861
- Input10,
4572
+ return /* @__PURE__ */ jsx20(Dialog6, { open, onOpenChange, children: /* @__PURE__ */ jsxs18(DialogContent6, { className: "sm:max-w-lg", children: [
4573
+ /* @__PURE__ */ jsx20(DialogHeader6, { children: /* @__PURE__ */ jsx20(DialogTitle6, { children: isEditing ? "Editar Ferramenta" : "Nova Ferramenta" }) }),
4574
+ /* @__PURE__ */ jsxs18("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
4575
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
4576
+ /* @__PURE__ */ jsx20(Label7, { htmlFor: "tool-name", children: "Nome *" }),
4577
+ /* @__PURE__ */ jsx20(
4578
+ Input9,
4862
4579
  {
4863
4580
  id: "tool-name",
4864
4581
  name: "name",
@@ -4876,12 +4593,12 @@ function ToolFormDialog({
4876
4593
  disabled: isPending
4877
4594
  }
4878
4595
  ),
4879
- form.nameError && /* @__PURE__ */ jsx21("p", { className: "text-sm text-destructive", children: "Nome \xE9 obrigat\xF3rio" })
4596
+ form.nameError && /* @__PURE__ */ jsx20("p", { className: "text-sm text-destructive", children: "Nome \xE9 obrigat\xF3rio" })
4880
4597
  ] }),
4881
- /* @__PURE__ */ jsxs19("div", { className: "space-y-2", children: [
4882
- /* @__PURE__ */ jsx21(Label8, { htmlFor: "tool-slug", children: "Slug (identificador \xFAnico) *" }),
4883
- /* @__PURE__ */ jsx21(
4884
- Input10,
4598
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
4599
+ /* @__PURE__ */ jsx20(Label7, { htmlFor: "tool-slug", children: "Slug (identificador \xFAnico) *" }),
4600
+ /* @__PURE__ */ jsx20(
4601
+ Input9,
4885
4602
  {
4886
4603
  id: "tool-slug",
4887
4604
  name: "slug",
@@ -4898,13 +4615,13 @@ function ToolFormDialog({
4898
4615
  disabled: isPending
4899
4616
  }
4900
4617
  ),
4901
- /* @__PURE__ */ jsx21("p", { className: "text-xs text-muted-foreground", children: "Gerado automaticamente a partir do nome. Usado internamente para identificar a ferramenta." }),
4902
- form.slugError && /* @__PURE__ */ jsx21("p", { className: "text-sm text-destructive", children: "Slug \xE9 obrigat\xF3rio" })
4618
+ /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: "Gerado automaticamente a partir do nome. Usado internamente para identificar a ferramenta." }),
4619
+ form.slugError && /* @__PURE__ */ jsx20("p", { className: "text-sm text-destructive", children: "Slug \xE9 obrigat\xF3rio" })
4903
4620
  ] }),
4904
- /* @__PURE__ */ jsxs19("div", { className: "space-y-2", children: [
4905
- /* @__PURE__ */ jsx21(Label8, { htmlFor: "tool-type", children: "Tipo de Autentica\xE7\xE3o *" }),
4906
- /* @__PURE__ */ jsxs19(
4907
- Select4,
4621
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
4622
+ /* @__PURE__ */ jsx20(Label7, { htmlFor: "tool-type", children: "Tipo de Autentica\xE7\xE3o *" }),
4623
+ /* @__PURE__ */ jsxs18(
4624
+ Select3,
4908
4625
  {
4909
4626
  value: form.type,
4910
4627
  onValueChange: (value) => {
@@ -4916,18 +4633,18 @@ function ToolFormDialog({
4916
4633
  },
4917
4634
  disabled: isPending,
4918
4635
  children: [
4919
- /* @__PURE__ */ jsx21(SelectTrigger4, { id: "tool-type", children: /* @__PURE__ */ jsx21(SelectValue4, { placeholder: "Selecione o tipo" }) }),
4920
- /* @__PURE__ */ jsx21(SelectContent4, { children: TOOL_AUTH_TYPES.map((t) => /* @__PURE__ */ jsx21(SelectItem4, { value: t.value, children: t.label }, t.value)) })
4636
+ /* @__PURE__ */ jsx20(SelectTrigger3, { id: "tool-type", children: /* @__PURE__ */ jsx20(SelectValue3, { placeholder: "Selecione o tipo" }) }),
4637
+ /* @__PURE__ */ jsx20(SelectContent3, { children: TOOL_AUTH_TYPES.map((t) => /* @__PURE__ */ jsx20(SelectItem3, { value: t.value, children: t.label }, t.value)) })
4921
4638
  ]
4922
4639
  }
4923
4640
  ),
4924
- /* @__PURE__ */ jsx21("p", { className: "text-xs text-muted-foreground", children: "Define se a ferramenta requer credenciais para funcionar." }),
4925
- form.typeError && /* @__PURE__ */ jsx21("p", { className: "text-sm text-destructive", children: "Tipo \xE9 obrigat\xF3rio" })
4641
+ /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: "Define se a ferramenta requer credenciais para funcionar." }),
4642
+ form.typeError && /* @__PURE__ */ jsx20("p", { className: "text-sm text-destructive", children: "Tipo \xE9 obrigat\xF3rio" })
4926
4643
  ] }),
4927
- /* @__PURE__ */ jsxs19("div", { className: "space-y-2", children: [
4928
- /* @__PURE__ */ jsx21(Label8, { htmlFor: "tool-description", children: "Descri\xE7\xE3o" }),
4929
- /* @__PURE__ */ jsx21(
4930
- Textarea3,
4644
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
4645
+ /* @__PURE__ */ jsx20(Label7, { htmlFor: "tool-description", children: "Descri\xE7\xE3o" }),
4646
+ /* @__PURE__ */ jsx20(
4647
+ Textarea2,
4931
4648
  {
4932
4649
  id: "tool-description",
4933
4650
  name: "description",
@@ -4939,10 +4656,10 @@ function ToolFormDialog({
4939
4656
  }
4940
4657
  )
4941
4658
  ] }),
4942
- /* @__PURE__ */ jsxs19("div", { className: "space-y-2", children: [
4943
- /* @__PURE__ */ jsx21(Label8, { htmlFor: "tool-function-defs", children: "Defini\xE7\xF5es de Fun\xE7\xE3o (JSON)" }),
4944
- /* @__PURE__ */ jsx21(
4945
- Textarea3,
4659
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
4660
+ /* @__PURE__ */ jsx20(Label7, { htmlFor: "tool-function-defs", children: "Defini\xE7\xF5es de Fun\xE7\xE3o (JSON)" }),
4661
+ /* @__PURE__ */ jsx20(
4662
+ Textarea2,
4946
4663
  {
4947
4664
  id: "tool-function-defs",
4948
4665
  name: "functionDefs",
@@ -4973,12 +4690,12 @@ function ToolFormDialog({
4973
4690
  disabled: isPending
4974
4691
  }
4975
4692
  ),
4976
- /* @__PURE__ */ jsx21("p", { className: "text-xs text-muted-foreground", children: "Array de defini\xE7\xF5es no formato OpenAI Function Calling." }),
4977
- form.jsonError && /* @__PURE__ */ jsx21("p", { className: "text-sm text-destructive", children: "JSON inv\xE1lido" })
4693
+ /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: "Array de defini\xE7\xF5es no formato OpenAI Function Calling." }),
4694
+ form.jsonError && /* @__PURE__ */ jsx20("p", { className: "text-sm text-destructive", children: "JSON inv\xE1lido" })
4978
4695
  ] }),
4979
- /* @__PURE__ */ jsxs19(DialogFooter7, { children: [
4980
- /* @__PURE__ */ jsx21(
4981
- Button14,
4696
+ /* @__PURE__ */ jsxs18(DialogFooter6, { children: [
4697
+ /* @__PURE__ */ jsx20(
4698
+ Button13,
4982
4699
  {
4983
4700
  type: "button",
4984
4701
  variant: "outline",
@@ -4987,8 +4704,8 @@ function ToolFormDialog({
4987
4704
  children: "Cancelar"
4988
4705
  }
4989
4706
  ),
4990
- /* @__PURE__ */ jsxs19(Button14, { type: "submit", disabled: isPending, children: [
4991
- isPending ? /* @__PURE__ */ jsx21(Loader28, { "aria-hidden": "true", className: "mr-2 h-4 w-4 animate-spin" }) : null,
4707
+ /* @__PURE__ */ jsxs18(Button13, { type: "submit", disabled: isPending, children: [
4708
+ isPending ? /* @__PURE__ */ jsx20(Loader28, { "aria-hidden": "true", className: "mr-2 h-4 w-4 animate-spin" }) : null,
4992
4709
  isEditing ? "Salvar" : "Criar"
4993
4710
  ] })
4994
4711
  ] })
@@ -4997,13 +4714,13 @@ function ToolFormDialog({
4997
4714
  }
4998
4715
 
4999
4716
  // src/components/capabilities/advanced-tab.tsx
5000
- import { Info as Info2 } from "lucide-react";
5001
- import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
4717
+ import { Info as Info3 } from "lucide-react";
4718
+ import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
5002
4719
  function AdvancedTab({ config, agentId, gagentsApiUrl }) {
5003
4720
  const { data: credentialsData, isLoading: isLoadingCredentials } = useToolCredentials(config);
5004
4721
  const credentials = credentialsData?.data ?? [];
5005
- const [editingTool, setEditingTool] = useState14(null);
5006
- const [showToolForm, setShowToolForm] = useState14(false);
4722
+ const [editingTool, setEditingTool] = useState13(null);
4723
+ const [showToolForm, setShowToolForm] = useState13(false);
5007
4724
  function handleEditTool(tool) {
5008
4725
  setEditingTool(tool);
5009
4726
  setShowToolForm(true);
@@ -5012,24 +4729,24 @@ function AdvancedTab({ config, agentId, gagentsApiUrl }) {
5012
4729
  setShowToolForm(open);
5013
4730
  if (!open) setEditingTool(null);
5014
4731
  }
5015
- return /* @__PURE__ */ jsxs20("div", { className: "space-y-8", children: [
5016
- /* @__PURE__ */ jsxs20("div", { className: "flex items-start gap-3 rounded-lg border border-blue-200 bg-blue-50 p-4 dark:border-blue-900 dark:bg-blue-950/30", children: [
5017
- /* @__PURE__ */ jsx22(Info2, { className: "mt-0.5 h-4 w-4 shrink-0 text-blue-600 dark:text-blue-400" }),
5018
- /* @__PURE__ */ jsxs20("p", { className: "text-sm text-blue-800 dark:text-blue-300", children: [
4732
+ return /* @__PURE__ */ jsxs19("div", { className: "space-y-8", children: [
4733
+ /* @__PURE__ */ jsxs19("div", { className: "flex items-start gap-3 rounded-lg border border-blue-200 bg-blue-50 p-4 dark:border-blue-900 dark:bg-blue-950/30", children: [
4734
+ /* @__PURE__ */ jsx21(Info3, { className: "mt-0.5 h-4 w-4 shrink-0 text-blue-600 dark:text-blue-400" }),
4735
+ /* @__PURE__ */ jsxs19("p", { className: "text-sm text-blue-800 dark:text-blue-300", children: [
5019
4736
  "Use as abas ",
5020
- /* @__PURE__ */ jsx22("strong", { children: "Capacidades" }),
4737
+ /* @__PURE__ */ jsx21("strong", { children: "Capacidades" }),
5021
4738
  " e ",
5022
- /* @__PURE__ */ jsx22("strong", { children: "Integra\xE7\xF5es" }),
4739
+ /* @__PURE__ */ jsx21("strong", { children: "Integra\xE7\xF5es" }),
5023
4740
  " para configura\xE7\xE3o simplificada. Esta aba oferece controlo manual avan\xE7ado sobre ferramentas e credenciais."
5024
4741
  ] })
5025
4742
  ] }),
5026
- /* @__PURE__ */ jsxs20("section", { className: "space-y-3", children: [
5027
- /* @__PURE__ */ jsx22("h3", { className: "text-sm font-medium", children: "Ferramentas" }),
5028
- /* @__PURE__ */ jsx22(ToolsTable, { onEdit: handleEditTool, config })
4743
+ /* @__PURE__ */ jsxs19("section", { className: "space-y-3", children: [
4744
+ /* @__PURE__ */ jsx21("h3", { className: "text-sm font-medium", children: "Ferramentas" }),
4745
+ /* @__PURE__ */ jsx21(ToolsTable, { onEdit: handleEditTool, config })
5029
4746
  ] }),
5030
- /* @__PURE__ */ jsxs20("section", { className: "space-y-3", children: [
5031
- /* @__PURE__ */ jsx22("h3", { className: "text-sm font-medium", children: "Credenciais" }),
5032
- /* @__PURE__ */ jsx22(
4747
+ /* @__PURE__ */ jsxs19("section", { className: "space-y-3", children: [
4748
+ /* @__PURE__ */ jsx21("h3", { className: "text-sm font-medium", children: "Credenciais" }),
4749
+ /* @__PURE__ */ jsx21(
5033
4750
  ToolCredentialsForm,
5034
4751
  {
5035
4752
  credentials,
@@ -5039,7 +4756,7 @@ function AdvancedTab({ config, agentId, gagentsApiUrl }) {
5039
4756
  }
5040
4757
  )
5041
4758
  ] }),
5042
- /* @__PURE__ */ jsx22(
4759
+ /* @__PURE__ */ jsx21(
5043
4760
  ToolFormDialog,
5044
4761
  {
5045
4762
  open: showToolForm,
@@ -5052,7 +4769,7 @@ function AdvancedTab({ config, agentId, gagentsApiUrl }) {
5052
4769
  }
5053
4770
 
5054
4771
  // src/pages/agent-capabilities-page.tsx
5055
- import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4772
+ import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
5056
4773
  function defaultResolveWizardMeta(card) {
5057
4774
  return {
5058
4775
  capabilities: [
@@ -5070,8 +4787,8 @@ function AgentCapabilitiesPage({
5070
4787
  loadConfigOptions,
5071
4788
  onWizardComplete
5072
4789
  }) {
5073
- const [wizardOpen, setWizardOpen] = useState15(false);
5074
- const [activeCard, setActiveCard] = useState15(null);
4790
+ const [wizardOpen, setWizardOpen] = useState14(false);
4791
+ const [activeCard, setActiveCard] = useState14(null);
5075
4792
  const handleConnect = useCallback6(
5076
4793
  (card) => {
5077
4794
  setActiveCard(card);
@@ -5089,28 +4806,28 @@ function AgentCapabilitiesPage({
5089
4806
  if (!open) setActiveCard(null);
5090
4807
  }, []);
5091
4808
  const wizardMeta = activeCard ? resolveWizardMeta(activeCard) : null;
5092
- return /* @__PURE__ */ jsxs21("div", { className: "space-y-4", children: [
5093
- /* @__PURE__ */ jsxs21("div", { children: [
5094
- /* @__PURE__ */ jsx23("h2", { className: "text-lg font-semibold", children: "Capacidades e Integra\xE7\xF5es" }),
5095
- /* @__PURE__ */ jsx23("p", { className: "text-sm text-muted-foreground", children: "Configure o que este agente pode fazer e quais servi\xE7os externos ele utiliza." })
4809
+ return /* @__PURE__ */ jsxs20("div", { className: "space-y-4", children: [
4810
+ /* @__PURE__ */ jsxs20("div", { children: [
4811
+ /* @__PURE__ */ jsx22("h2", { className: "text-lg font-semibold", children: "Capacidades e Integra\xE7\xF5es" }),
4812
+ /* @__PURE__ */ jsx22("p", { className: "text-sm text-muted-foreground", children: "Configure o que este agente pode fazer e quais servi\xE7os externos ele utiliza." })
5096
4813
  ] }),
5097
- /* @__PURE__ */ jsxs21(Tabs, { defaultValue: "capacidades", children: [
5098
- /* @__PURE__ */ jsxs21(TabsList, { children: [
5099
- /* @__PURE__ */ jsxs21(TabsTrigger, { value: "capacidades", className: "flex items-center gap-1.5", children: [
5100
- /* @__PURE__ */ jsx23(Blocks, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
4814
+ /* @__PURE__ */ jsxs20(Tabs, { defaultValue: "capacidades", children: [
4815
+ /* @__PURE__ */ jsxs20(TabsList, { children: [
4816
+ /* @__PURE__ */ jsxs20(TabsTrigger, { value: "capacidades", className: "flex items-center gap-1.5", children: [
4817
+ /* @__PURE__ */ jsx22(Blocks, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
5101
4818
  "Capacidades"
5102
4819
  ] }),
5103
- /* @__PURE__ */ jsxs21(TabsTrigger, { value: "integracoes", className: "flex items-center gap-1.5", children: [
5104
- /* @__PURE__ */ jsx23(Plug3, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
4820
+ /* @__PURE__ */ jsxs20(TabsTrigger, { value: "integracoes", className: "flex items-center gap-1.5", children: [
4821
+ /* @__PURE__ */ jsx22(Plug3, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
5105
4822
  "Integra\xE7\xF5es"
5106
4823
  ] }),
5107
- /* @__PURE__ */ jsxs21(TabsTrigger, { value: "avancado", className: "flex items-center gap-1.5", children: [
5108
- /* @__PURE__ */ jsx23(Settings4, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
4824
+ /* @__PURE__ */ jsxs20(TabsTrigger, { value: "avancado", className: "flex items-center gap-1.5", children: [
4825
+ /* @__PURE__ */ jsx22(Settings3, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
5109
4826
  "Avan\xE7ado"
5110
4827
  ] })
5111
4828
  ] }),
5112
- /* @__PURE__ */ jsx23(TabsContent, { value: "capacidades", className: "mt-4", children: /* @__PURE__ */ jsx23(CapabilitiesTab, { config, agentId }) }),
5113
- /* @__PURE__ */ jsx23(TabsContent, { value: "integracoes", className: "mt-4", children: /* @__PURE__ */ jsx23(
4829
+ /* @__PURE__ */ jsx22(TabsContent, { value: "capacidades", className: "mt-4", children: /* @__PURE__ */ jsx22(CapabilitiesTab, { config, agentId }) }),
4830
+ /* @__PURE__ */ jsx22(TabsContent, { value: "integracoes", className: "mt-4", children: /* @__PURE__ */ jsx22(
5114
4831
  IntegrationsTab,
5115
4832
  {
5116
4833
  config,
@@ -5118,7 +4835,7 @@ function AgentCapabilitiesPage({
5118
4835
  onConnect: handleConnect
5119
4836
  }
5120
4837
  ) }),
5121
- /* @__PURE__ */ jsx23(TabsContent, { value: "avancado", className: "mt-4", children: /* @__PURE__ */ jsx23(
4838
+ /* @__PURE__ */ jsx22(TabsContent, { value: "avancado", className: "mt-4", children: /* @__PURE__ */ jsx22(
5122
4839
  AdvancedTab,
5123
4840
  {
5124
4841
  config,
@@ -5127,7 +4844,7 @@ function AgentCapabilitiesPage({
5127
4844
  }
5128
4845
  ) })
5129
4846
  ] }),
5130
- activeCard && wizardMeta && /* @__PURE__ */ jsx23(
4847
+ activeCard && wizardMeta && /* @__PURE__ */ jsx22(
5131
4848
  IntegrationWizard,
5132
4849
  {
5133
4850
  open: wizardOpen,
@@ -5152,8 +4869,8 @@ import {
5152
4869
  TabsTrigger as TabsTrigger2,
5153
4870
  TabsContent as TabsContent2
5154
4871
  } from "@greatapps/greatauth-ui/ui";
5155
- import { Wrench as Wrench2, Target as Target2, FileText as FileText2, MessageCircle as MessageCircle2, Blocks as Blocks2 } from "lucide-react";
5156
- import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4872
+ import { Target as Target2, FileText as FileText2, MessageCircle as MessageCircle2, Blocks as Blocks2 } from "lucide-react";
4873
+ import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
5157
4874
  function AgentTabs({
5158
4875
  agent,
5159
4876
  config,
@@ -5164,33 +4881,28 @@ function AgentTabs({
5164
4881
  onWizardComplete
5165
4882
  }) {
5166
4883
  const apiUrl = gagentsApiUrl || config.baseUrl;
5167
- return /* @__PURE__ */ jsxs22(Tabs2, { defaultValue: "prompt", children: [
5168
- /* @__PURE__ */ jsxs22(TabsList2, { children: [
5169
- /* @__PURE__ */ jsxs22(TabsTrigger2, { value: "prompt", className: "flex items-center gap-1.5", children: [
5170
- /* @__PURE__ */ jsx24(FileText2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
4884
+ return /* @__PURE__ */ jsxs21(Tabs2, { defaultValue: "prompt", children: [
4885
+ /* @__PURE__ */ jsxs21(TabsList2, { children: [
4886
+ /* @__PURE__ */ jsxs21(TabsTrigger2, { value: "prompt", className: "flex items-center gap-1.5", children: [
4887
+ /* @__PURE__ */ jsx23(FileText2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
5171
4888
  "Prompt"
5172
4889
  ] }),
5173
- /* @__PURE__ */ jsxs22(TabsTrigger2, { value: "objetivos", className: "flex items-center gap-1.5", children: [
5174
- /* @__PURE__ */ jsx24(Target2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
4890
+ /* @__PURE__ */ jsxs21(TabsTrigger2, { value: "objetivos", className: "flex items-center gap-1.5", children: [
4891
+ /* @__PURE__ */ jsx23(Target2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
5175
4892
  "Objetivos"
5176
4893
  ] }),
5177
- /* @__PURE__ */ jsxs22(TabsTrigger2, { value: "ferramentas", className: "flex items-center gap-1.5", children: [
5178
- /* @__PURE__ */ jsx24(Wrench2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
5179
- "Ferramentas"
5180
- ] }),
5181
- /* @__PURE__ */ jsxs22(TabsTrigger2, { value: "capacidades", className: "flex items-center gap-1.5", children: [
5182
- /* @__PURE__ */ jsx24(Blocks2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
4894
+ /* @__PURE__ */ jsxs21(TabsTrigger2, { value: "capacidades", className: "flex items-center gap-1.5", children: [
4895
+ /* @__PURE__ */ jsx23(Blocks2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
5183
4896
  "Capacidades"
5184
4897
  ] }),
5185
- /* @__PURE__ */ jsxs22(TabsTrigger2, { value: "conversas", className: "flex items-center gap-1.5", children: [
5186
- /* @__PURE__ */ jsx24(MessageCircle2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
4898
+ /* @__PURE__ */ jsxs21(TabsTrigger2, { value: "conversas", className: "flex items-center gap-1.5", children: [
4899
+ /* @__PURE__ */ jsx23(MessageCircle2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
5187
4900
  "Conversas"
5188
4901
  ] })
5189
4902
  ] }),
5190
- /* @__PURE__ */ jsx24(TabsContent2, { value: "prompt", className: "mt-4", children: /* @__PURE__ */ jsx24(AgentPromptEditor, { agent, config }) }),
5191
- /* @__PURE__ */ jsx24(TabsContent2, { value: "objetivos", className: "mt-4", children: /* @__PURE__ */ jsx24(AgentObjectivesList, { agent, config }) }),
5192
- /* @__PURE__ */ jsx24(TabsContent2, { value: "ferramentas", className: "mt-4", children: /* @__PURE__ */ jsx24(AgentToolsList, { agent, config }) }),
5193
- /* @__PURE__ */ jsx24(TabsContent2, { value: "capacidades", className: "mt-4", children: /* @__PURE__ */ jsx24(
4903
+ /* @__PURE__ */ jsx23(TabsContent2, { value: "prompt", className: "mt-4", children: /* @__PURE__ */ jsx23(AgentPromptEditor, { agent, config }) }),
4904
+ /* @__PURE__ */ jsx23(TabsContent2, { value: "objetivos", className: "mt-4", children: /* @__PURE__ */ jsx23(AgentObjectivesList, { agent, config }) }),
4905
+ /* @__PURE__ */ jsx23(TabsContent2, { value: "capacidades", className: "mt-4", children: /* @__PURE__ */ jsx23(
5194
4906
  AgentCapabilitiesPage,
5195
4907
  {
5196
4908
  config,
@@ -5201,7 +4913,7 @@ function AgentTabs({
5201
4913
  onWizardComplete
5202
4914
  }
5203
4915
  ) }),
5204
- /* @__PURE__ */ jsx24(TabsContent2, { value: "conversas", className: "mt-4", children: /* @__PURE__ */ jsx24(
4916
+ /* @__PURE__ */ jsx23(TabsContent2, { value: "conversas", className: "mt-4", children: /* @__PURE__ */ jsx23(
5205
4917
  AgentConversationsPanel,
5206
4918
  {
5207
4919
  agent,
@@ -5212,6 +4924,335 @@ function AgentTabs({
5212
4924
  ] });
5213
4925
  }
5214
4926
 
4927
+ // src/components/agents/agent-tools-list.tsx
4928
+ import { useState as useState15 } from "react";
4929
+ import {
4930
+ Switch as Switch5,
4931
+ Badge as Badge9,
4932
+ Button as Button14,
4933
+ Skeleton as Skeleton6,
4934
+ AlertDialog as AlertDialog5,
4935
+ AlertDialogAction as AlertDialogAction5,
4936
+ AlertDialogCancel as AlertDialogCancel5,
4937
+ AlertDialogContent as AlertDialogContent5,
4938
+ AlertDialogDescription as AlertDialogDescription5,
4939
+ AlertDialogFooter as AlertDialogFooter5,
4940
+ AlertDialogHeader as AlertDialogHeader5,
4941
+ AlertDialogTitle as AlertDialogTitle5,
4942
+ Popover,
4943
+ PopoverContent,
4944
+ PopoverTrigger,
4945
+ Input as Input10,
4946
+ Textarea as Textarea3,
4947
+ Dialog as Dialog7,
4948
+ DialogContent as DialogContent7,
4949
+ DialogHeader as DialogHeader7,
4950
+ DialogTitle as DialogTitle7,
4951
+ DialogFooter as DialogFooter7,
4952
+ Label as Label8,
4953
+ Select as Select4,
4954
+ SelectContent as SelectContent4,
4955
+ SelectItem as SelectItem4,
4956
+ SelectTrigger as SelectTrigger4,
4957
+ SelectValue as SelectValue4
4958
+ } from "@greatapps/greatauth-ui/ui";
4959
+ import {
4960
+ Trash2 as Trash25,
4961
+ Plus as Plus2,
4962
+ Wrench,
4963
+ Settings2 as Settings22
4964
+ } from "lucide-react";
4965
+ import { toast as toast11 } from "sonner";
4966
+ import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4967
+ function AgentToolsList({ agent, config }) {
4968
+ const { data: agentToolsData, isLoading } = useAgentTools(config, agent.id);
4969
+ const { data: allToolsData } = useTools(config);
4970
+ const addMutation = useAddAgentTool(config);
4971
+ const removeMutation = useRemoveAgentTool(config);
4972
+ const updateMutation = useUpdateAgentTool(config);
4973
+ const [removeTarget, setRemoveTarget] = useState15(null);
4974
+ const [addOpen, setAddOpen] = useState15(false);
4975
+ const [search, setSearch] = useState15("");
4976
+ const [configTarget, setConfigTarget] = useState15(null);
4977
+ const [configInstructions, setConfigInstructions] = useState15("");
4978
+ const [configCredentialId, setConfigCredentialId] = useState15("");
4979
+ const { data: credentialsData } = useToolCredentials(config);
4980
+ const allCredentials = credentialsData?.data || [];
4981
+ const agentTools = agentToolsData?.data || [];
4982
+ const allTools = (allToolsData?.data || []).filter((t) => !t.slug?.startsWith("gclinic_"));
4983
+ const assignedToolIds = new Set(agentTools.map((at) => at.id_tool));
4984
+ const visibleAgentTools = agentTools.filter((at) => {
4985
+ const tool = allTools.find((t) => t.id === at.id_tool);
4986
+ return !tool || !tool.slug?.startsWith("gclinic_");
4987
+ });
4988
+ const availableTools = allTools.filter((t) => !assignedToolIds.has(t.id));
4989
+ const filteredAvailable = availableTools.filter(
4990
+ (t) => t.name.toLowerCase().includes(search.toLowerCase())
4991
+ );
4992
+ function getToolInfo(idTool) {
4993
+ return allTools.find((t) => t.id === idTool);
4994
+ }
4995
+ async function handleToggleEnabled(agentTool, checked) {
4996
+ try {
4997
+ await updateMutation.mutateAsync({
4998
+ idAgent: agent.id,
4999
+ id: agentTool.id,
5000
+ body: { enabled: checked }
5001
+ });
5002
+ toast11.success(checked ? "Ferramenta ativada" : "Ferramenta desativada");
5003
+ } catch (err) {
5004
+ toast11.error(
5005
+ err instanceof Error ? err.message : "Erro ao alterar estado da ferramenta"
5006
+ );
5007
+ }
5008
+ }
5009
+ async function handleAdd(tool) {
5010
+ try {
5011
+ await addMutation.mutateAsync({
5012
+ idAgent: agent.id,
5013
+ body: { id_tool: tool.id }
5014
+ });
5015
+ toast11.success("Ferramenta adicionada");
5016
+ setAddOpen(false);
5017
+ setSearch("");
5018
+ } catch (err) {
5019
+ toast11.error(
5020
+ err instanceof Error ? err.message : "Erro ao adicionar ferramenta"
5021
+ );
5022
+ }
5023
+ }
5024
+ async function handleRemove() {
5025
+ if (!removeTarget) return;
5026
+ try {
5027
+ await removeMutation.mutateAsync({
5028
+ idAgent: agent.id,
5029
+ id: removeTarget.id
5030
+ });
5031
+ toast11.success("Ferramenta removida");
5032
+ } catch (err) {
5033
+ toast11.error(
5034
+ err instanceof Error ? err.message : "Erro ao remover ferramenta"
5035
+ );
5036
+ } finally {
5037
+ setRemoveTarget(null);
5038
+ }
5039
+ }
5040
+ function openConfig(agentTool) {
5041
+ setConfigTarget(agentTool);
5042
+ setConfigInstructions(agentTool.custom_instructions || "");
5043
+ setConfigCredentialId(agentTool.id_tool_credential ? String(agentTool.id_tool_credential) : "");
5044
+ }
5045
+ async function handleSaveConfig() {
5046
+ if (!configTarget) return;
5047
+ try {
5048
+ const newCredentialId = configCredentialId ? parseInt(configCredentialId, 10) : null;
5049
+ await updateMutation.mutateAsync({
5050
+ idAgent: agent.id,
5051
+ id: configTarget.id,
5052
+ body: {
5053
+ custom_instructions: configInstructions.trim() || null,
5054
+ id_tool_credential: newCredentialId
5055
+ }
5056
+ });
5057
+ toast11.success("Configura\xE7\xE3o atualizada");
5058
+ setConfigTarget(null);
5059
+ } catch (err) {
5060
+ toast11.error(
5061
+ err instanceof Error ? err.message : "Erro ao atualizar configura\xE7\xE3o"
5062
+ );
5063
+ }
5064
+ }
5065
+ if (isLoading) {
5066
+ return /* @__PURE__ */ jsx24("div", { className: "space-y-3 p-4", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx24(Skeleton6, { className: "h-14 w-full" }, i)) });
5067
+ }
5068
+ return /* @__PURE__ */ jsxs22("div", { className: "space-y-4 p-4", children: [
5069
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between", children: [
5070
+ /* @__PURE__ */ jsxs22("h3", { className: "text-sm font-medium text-muted-foreground", children: [
5071
+ visibleAgentTools.length,
5072
+ " ferramenta",
5073
+ visibleAgentTools.length !== 1 ? "s" : "",
5074
+ " associada",
5075
+ visibleAgentTools.length !== 1 ? "s" : ""
5076
+ ] }),
5077
+ /* @__PURE__ */ jsxs22(Popover, { open: addOpen, onOpenChange: setAddOpen, children: [
5078
+ /* @__PURE__ */ jsx24(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs22(Button14, { size: "sm", disabled: availableTools.length === 0, children: [
5079
+ /* @__PURE__ */ jsx24(Plus2, { className: "mr-2 h-4 w-4" }),
5080
+ "Adicionar Ferramenta"
5081
+ ] }) }),
5082
+ /* @__PURE__ */ jsxs22(PopoverContent, { className: "w-72 p-0", align: "end", children: [
5083
+ /* @__PURE__ */ jsx24("div", { className: "p-2", children: /* @__PURE__ */ jsx24(
5084
+ Input10,
5085
+ {
5086
+ placeholder: "Buscar ferramenta\\u2026",
5087
+ "aria-label": "Buscar ferramenta",
5088
+ name: "search",
5089
+ value: search,
5090
+ onChange: (e) => setSearch(e.target.value),
5091
+ className: "h-8"
5092
+ }
5093
+ ) }),
5094
+ /* @__PURE__ */ jsx24("div", { className: "max-h-48 overflow-y-auto", children: filteredAvailable.length === 0 ? /* @__PURE__ */ jsx24("p", { className: "p-3 text-center text-sm text-muted-foreground", children: "Nenhuma ferramenta dispon\xEDvel" }) : filteredAvailable.map((tool) => /* @__PURE__ */ jsxs22(
5095
+ "button",
5096
+ {
5097
+ type: "button",
5098
+ className: "flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-accent",
5099
+ onClick: () => handleAdd(tool),
5100
+ disabled: addMutation.isPending,
5101
+ children: [
5102
+ /* @__PURE__ */ jsx24(Wrench, { className: "h-4 w-4 text-muted-foreground" }),
5103
+ /* @__PURE__ */ jsx24("span", { className: "flex-1 font-medium", children: tool.name }),
5104
+ /* @__PURE__ */ jsx24(Badge9, { variant: "secondary", className: "text-xs", children: tool.type })
5105
+ ]
5106
+ },
5107
+ tool.id
5108
+ )) })
5109
+ ] })
5110
+ ] })
5111
+ ] }),
5112
+ visibleAgentTools.length === 0 ? /* @__PURE__ */ jsxs22("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
5113
+ /* @__PURE__ */ jsx24(Wrench, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
5114
+ /* @__PURE__ */ jsx24("p", { className: "text-sm text-muted-foreground", children: "Nenhuma ferramenta associada. Clique em 'Adicionar Ferramenta' para come\xE7ar." })
5115
+ ] }) : /* @__PURE__ */ jsx24("div", { className: "space-y-2", children: visibleAgentTools.map((agentTool) => {
5116
+ const tool = getToolInfo(agentTool.id_tool);
5117
+ return /* @__PURE__ */ jsxs22(
5118
+ "div",
5119
+ {
5120
+ className: "flex items-center gap-3 rounded-lg border bg-card p-3",
5121
+ children: [
5122
+ /* @__PURE__ */ jsxs22("div", { className: "flex flex-1 flex-col gap-1 min-w-0", children: [
5123
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2", children: [
5124
+ /* @__PURE__ */ jsx24("span", { className: "truncate font-medium", children: tool?.name || `Ferramenta #${agentTool.id_tool}` }),
5125
+ tool?.type && /* @__PURE__ */ jsx24(Badge9, { variant: "secondary", className: "shrink-0 text-xs", children: tool.type })
5126
+ ] }),
5127
+ agentTool.custom_instructions && /* @__PURE__ */ jsx24("p", { className: "truncate text-xs text-muted-foreground", children: agentTool.custom_instructions })
5128
+ ] }),
5129
+ /* @__PURE__ */ jsx24(
5130
+ Switch5,
5131
+ {
5132
+ "aria-label": "Ativar/Desativar",
5133
+ checked: agentTool.enabled,
5134
+ onCheckedChange: (checked) => handleToggleEnabled(agentTool, checked),
5135
+ disabled: updateMutation.isPending
5136
+ }
5137
+ ),
5138
+ /* @__PURE__ */ jsx24(
5139
+ Button14,
5140
+ {
5141
+ variant: "ghost",
5142
+ size: "icon",
5143
+ "aria-label": "Configurar",
5144
+ className: "shrink-0 text-muted-foreground hover:text-foreground",
5145
+ onClick: () => openConfig(agentTool),
5146
+ title: "Configurar instru\xE7\xF5es",
5147
+ children: /* @__PURE__ */ jsx24(Settings22, { className: "h-4 w-4" })
5148
+ }
5149
+ ),
5150
+ /* @__PURE__ */ jsx24(
5151
+ Button14,
5152
+ {
5153
+ variant: "ghost",
5154
+ size: "icon",
5155
+ "aria-label": "Remover",
5156
+ className: "shrink-0 text-muted-foreground hover:text-destructive",
5157
+ onClick: () => setRemoveTarget(agentTool),
5158
+ children: /* @__PURE__ */ jsx24(Trash25, { className: "h-4 w-4" })
5159
+ }
5160
+ )
5161
+ ]
5162
+ },
5163
+ agentTool.id
5164
+ );
5165
+ }) }),
5166
+ /* @__PURE__ */ jsx24(
5167
+ Dialog7,
5168
+ {
5169
+ open: !!configTarget,
5170
+ onOpenChange: (open) => !open && setConfigTarget(null),
5171
+ children: /* @__PURE__ */ jsxs22(DialogContent7, { className: "sm:max-w-lg", children: [
5172
+ /* @__PURE__ */ jsx24(DialogHeader7, { children: /* @__PURE__ */ jsx24(DialogTitle7, { children: "Instru\xE7\xF5es da Ferramenta" }) }),
5173
+ /* @__PURE__ */ jsxs22("div", { className: "space-y-4", children: [
5174
+ configTarget && getToolInfo(configTarget.id_tool)?.type !== "none" && /* @__PURE__ */ jsxs22("div", { className: "space-y-2", children: [
5175
+ /* @__PURE__ */ jsx24(Label8, { htmlFor: "tool-credential", children: "Credencial" }),
5176
+ /* @__PURE__ */ jsxs22(
5177
+ Select4,
5178
+ {
5179
+ value: configCredentialId || void 0,
5180
+ onValueChange: (val) => setConfigCredentialId(val === "__none__" ? "" : val),
5181
+ children: [
5182
+ /* @__PURE__ */ jsx24(SelectTrigger4, { id: "tool-credential", children: /* @__PURE__ */ jsx24(SelectValue4, { placeholder: "Selecione uma credencial (opcional)" }) }),
5183
+ /* @__PURE__ */ jsxs22(SelectContent4, { children: [
5184
+ /* @__PURE__ */ jsx24(SelectItem4, { value: "__none__", children: "Nenhuma (autom\xE1tico)" }),
5185
+ allCredentials.filter((c) => configTarget && c.id_tool === configTarget.id_tool && c.status === "active").map((c) => /* @__PURE__ */ jsx24(SelectItem4, { value: String(c.id), children: c.label || `Credencial #${c.id}` }, c.id))
5186
+ ] })
5187
+ ]
5188
+ }
5189
+ ),
5190
+ /* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: "Vincule uma credencial espec\xEDfica a esta ferramenta neste agente." })
5191
+ ] }),
5192
+ /* @__PURE__ */ jsxs22("div", { className: "space-y-2", children: [
5193
+ /* @__PURE__ */ jsx24(Label8, { htmlFor: "tool-instructions", children: "Instru\xE7\xF5es Personalizadas" }),
5194
+ /* @__PURE__ */ jsx24(
5195
+ Textarea3,
5196
+ {
5197
+ id: "tool-instructions",
5198
+ name: "instructions",
5199
+ value: configInstructions,
5200
+ onChange: (e) => setConfigInstructions(e.target.value),
5201
+ placeholder: "Instru\\u00e7\\u00f5es sobre como e quando o agente deve usar esta ferramenta\\u2026",
5202
+ rows: 6
5203
+ }
5204
+ ),
5205
+ /* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: "Este texto \xE9 adicionado ao prompt do agente para orientar o uso da ferramenta." })
5206
+ ] })
5207
+ ] }),
5208
+ /* @__PURE__ */ jsxs22(DialogFooter7, { children: [
5209
+ /* @__PURE__ */ jsx24(
5210
+ Button14,
5211
+ {
5212
+ variant: "outline",
5213
+ onClick: () => setConfigTarget(null),
5214
+ children: "Cancelar"
5215
+ }
5216
+ ),
5217
+ /* @__PURE__ */ jsx24(
5218
+ Button14,
5219
+ {
5220
+ onClick: handleSaveConfig,
5221
+ disabled: updateMutation.isPending,
5222
+ children: "Salvar"
5223
+ }
5224
+ )
5225
+ ] })
5226
+ ] })
5227
+ }
5228
+ ),
5229
+ /* @__PURE__ */ jsx24(
5230
+ AlertDialog5,
5231
+ {
5232
+ open: !!removeTarget,
5233
+ onOpenChange: (open) => !open && setRemoveTarget(null),
5234
+ children: /* @__PURE__ */ jsxs22(AlertDialogContent5, { children: [
5235
+ /* @__PURE__ */ jsxs22(AlertDialogHeader5, { children: [
5236
+ /* @__PURE__ */ jsx24(AlertDialogTitle5, { children: "Remover ferramenta?" }),
5237
+ /* @__PURE__ */ jsx24(AlertDialogDescription5, { children: "A ferramenta ser\xE1 desassociada deste agente." })
5238
+ ] }),
5239
+ /* @__PURE__ */ jsxs22(AlertDialogFooter5, { children: [
5240
+ /* @__PURE__ */ jsx24(AlertDialogCancel5, { children: "Cancelar" }),
5241
+ /* @__PURE__ */ jsx24(
5242
+ AlertDialogAction5,
5243
+ {
5244
+ onClick: handleRemove,
5245
+ disabled: removeMutation.isPending,
5246
+ children: "Remover"
5247
+ }
5248
+ )
5249
+ ] })
5250
+ ] })
5251
+ }
5252
+ )
5253
+ ] });
5254
+ }
5255
+
5215
5256
  // src/pages/agents-page.tsx
5216
5257
  import { useState as useState16 } from "react";
5217
5258
  import { Button as Button15 } from "@greatapps/greatauth-ui/ui";
@@ -5433,7 +5474,7 @@ import {
5433
5474
  TabsList as TabsList3,
5434
5475
  TabsTrigger as TabsTrigger3
5435
5476
  } from "@greatapps/greatauth-ui/ui";
5436
- import { Plus as Plus6, Plug as Plug4, KeyRound, Info as Info3 } from "lucide-react";
5477
+ import { Plus as Plus6, Plug as Plug4, KeyRound, Info as Info4 } from "lucide-react";
5437
5478
  import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
5438
5479
  function useCredentialAgentSummary(credentials, tools, agents) {
5439
5480
  return useMemo8(() => {
@@ -5493,7 +5534,7 @@ function IntegrationsManagementPage({
5493
5534
  ) }),
5494
5535
  /* @__PURE__ */ jsxs27(TabsContent3, { value: "credentials", className: "mt-4", children: [
5495
5536
  !credentialsLoading && /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-4 rounded-lg border bg-muted/50 px-4 py-3 mb-4", children: [
5496
- /* @__PURE__ */ jsx29(Info3, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
5537
+ /* @__PURE__ */ jsx29(Info4, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
5497
5538
  /* @__PURE__ */ jsxs27("div", { className: "flex flex-wrap items-center gap-3 text-sm", children: [
5498
5539
  /* @__PURE__ */ jsxs27("span", { children: [
5499
5540
  /* @__PURE__ */ jsx29(Badge11, { variant: "secondary", className: "mr-1", children: summary.totalCredentials }),