@greatapps/greatagents-ui 0.3.21 → 0.3.22

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
@@ -1143,10 +1143,10 @@ function AgentEditForm({ config, agent, idAccount, open, onOpenChange }) {
1143
1143
  }
1144
1144
 
1145
1145
  // src/components/agents/agent-objectives-list.tsx
1146
- import { useState as useState5 } from "react";
1146
+ import { useState as useState6 } from "react";
1147
1147
  import {
1148
- Input as Input4,
1149
- Button as Button4,
1148
+ Input as Input5,
1149
+ Button as Button5,
1150
1150
  Switch as Switch3,
1151
1151
  Skeleton,
1152
1152
  Textarea,
@@ -1630,39 +1630,163 @@ function SortableOverlay(props) {
1630
1630
  );
1631
1631
  }
1632
1632
 
1633
+ // src/components/agents/conversation-flow-editor.tsx
1634
+ import { useCallback as useCallback3, useRef, useState as useState5 } from "react";
1635
+ import { Button as Button4, Input as Input4 } from "@greatapps/greatauth-ui/ui";
1636
+ import { GripVertical, Plus, Trash2 as Trash22 } from "lucide-react";
1637
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
1638
+ function renumber(steps) {
1639
+ return steps.map((s, i) => ({ ...s, order: i + 1 }));
1640
+ }
1641
+ function stripKeys(steps) {
1642
+ return steps.map(({ _key, ...rest }) => rest);
1643
+ }
1644
+ function ConversationFlowEditor({
1645
+ steps,
1646
+ onChange
1647
+ }) {
1648
+ const nextKey = useRef(steps.length + 1);
1649
+ const [internal, setInternal] = useState5(
1650
+ () => steps.map((s, i) => ({ ...s, _key: i + 1 }))
1651
+ );
1652
+ const sync = useCallback3(
1653
+ (next) => {
1654
+ const renumbered = renumber(next).map((s, i) => ({
1655
+ ...s,
1656
+ _key: next[i]._key
1657
+ }));
1658
+ setInternal(renumbered);
1659
+ onChange(stripKeys(renumbered));
1660
+ },
1661
+ [onChange]
1662
+ );
1663
+ function handleAdd() {
1664
+ nextKey.current += 1;
1665
+ const newStep = {
1666
+ order: internal.length + 1,
1667
+ instruction: "",
1668
+ example: null,
1669
+ _key: nextKey.current
1670
+ };
1671
+ sync([...internal, newStep]);
1672
+ }
1673
+ function handleRemove(key) {
1674
+ sync(internal.filter((s) => s._key !== key));
1675
+ }
1676
+ function handleFieldChange(key, field, value) {
1677
+ const next = internal.map((s) => {
1678
+ if (s._key !== key) return s;
1679
+ if (field === "example") {
1680
+ return { ...s, example: value || null };
1681
+ }
1682
+ return { ...s, [field]: value };
1683
+ });
1684
+ sync(next);
1685
+ }
1686
+ function handleReorder(newItems) {
1687
+ sync(newItems);
1688
+ }
1689
+ return /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
1690
+ internal.length === 0 ? /* @__PURE__ */ jsx5("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: /* @__PURE__ */ jsx5("p", { className: "text-sm text-muted-foreground", children: "Nenhuma etapa definida. Adicione a primeira etapa do fluxo de conversa." }) }) : /* @__PURE__ */ jsxs4(
1691
+ Sortable,
1692
+ {
1693
+ value: internal,
1694
+ onValueChange: handleReorder,
1695
+ getItemValue: (item) => item._key,
1696
+ children: [
1697
+ /* @__PURE__ */ jsx5(SortableContent, { className: "space-y-2", children: internal.map((step) => /* @__PURE__ */ jsxs4(
1698
+ SortableItem,
1699
+ {
1700
+ value: step._key,
1701
+ className: "flex items-center gap-2 rounded-lg border bg-card p-2",
1702
+ children: [
1703
+ /* @__PURE__ */ jsx5(SortableItemHandle, { className: "shrink-0 cursor-grab text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ jsx5(GripVertical, { "aria-hidden": "true", className: "h-4 w-4" }) }),
1704
+ /* @__PURE__ */ jsxs4("span", { className: "shrink-0 text-xs font-medium text-muted-foreground tabular-nums w-6 text-right", children: [
1705
+ step.order,
1706
+ "."
1707
+ ] }),
1708
+ /* @__PURE__ */ jsx5(
1709
+ Input4,
1710
+ {
1711
+ value: step.instruction,
1712
+ onChange: (e) => handleFieldChange(step._key, "instruction", e.target.value),
1713
+ placeholder: "Instru\xE7\xE3o (obrigat\xF3rio)",
1714
+ className: "flex-1 min-w-0",
1715
+ required: true
1716
+ }
1717
+ ),
1718
+ /* @__PURE__ */ jsx5(
1719
+ Input4,
1720
+ {
1721
+ value: step.example ?? "",
1722
+ onChange: (e) => handleFieldChange(step._key, "example", e.target.value),
1723
+ placeholder: "Exemplo (opcional)",
1724
+ className: "flex-1 min-w-0"
1725
+ }
1726
+ ),
1727
+ /* @__PURE__ */ jsx5(
1728
+ Button4,
1729
+ {
1730
+ type: "button",
1731
+ variant: "ghost",
1732
+ size: "icon",
1733
+ "aria-label": "Remover etapa",
1734
+ className: cn(
1735
+ "shrink-0 text-muted-foreground hover:text-destructive"
1736
+ ),
1737
+ onClick: () => handleRemove(step._key),
1738
+ children: /* @__PURE__ */ jsx5(Trash22, { className: "h-4 w-4" })
1739
+ }
1740
+ )
1741
+ ]
1742
+ },
1743
+ step._key
1744
+ )) }),
1745
+ /* @__PURE__ */ jsx5(SortableOverlay, { children: ({ value }) => {
1746
+ const step = internal.find((s) => s._key === value);
1747
+ return /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 rounded-lg border bg-card p-2 shadow-lg", children: [
1748
+ /* @__PURE__ */ jsx5(
1749
+ GripVertical,
1750
+ {
1751
+ "aria-hidden": "true",
1752
+ className: "h-4 w-4 text-muted-foreground"
1753
+ }
1754
+ ),
1755
+ /* @__PURE__ */ jsxs4("span", { className: "text-xs font-medium text-muted-foreground", children: [
1756
+ step?.order,
1757
+ "."
1758
+ ] }),
1759
+ /* @__PURE__ */ jsx5("span", { className: "text-sm truncate", children: step?.instruction || "Etapa sem instru\xE7\xE3o" })
1760
+ ] });
1761
+ } })
1762
+ ]
1763
+ }
1764
+ ),
1765
+ /* @__PURE__ */ jsxs4(Button4, { type: "button", variant: "outline", size: "sm", onClick: handleAdd, children: [
1766
+ /* @__PURE__ */ jsx5(Plus, { className: "mr-2 h-4 w-4" }),
1767
+ "Adicionar etapa"
1768
+ ] })
1769
+ ] });
1770
+ }
1771
+
1633
1772
  // src/components/agents/agent-objectives-list.tsx
1634
- import { Trash2 as Trash22, Target, Pencil as Pencil2, Plus, GripVertical } from "lucide-react";
1773
+ import { Trash2 as Trash23, Target, Pencil as Pencil2, Plus as Plus2, GripVertical as GripVertical2 } from "lucide-react";
1635
1774
  import { toast as toast4 } from "sonner";
1636
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
1775
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
1637
1776
  function slugify(text) {
1638
1777
  return text.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
1639
1778
  }
1640
- var EMPTY_FORM = { title: "", slug: "", instruction: "", prompt: "" };
1641
- function splitPrompt(prompt) {
1642
- if (!prompt) return { instruction: "", body: "" };
1643
- const idx = prompt.indexOf("\n");
1644
- if (idx === -1) return { instruction: prompt.trim(), body: "" };
1645
- return { instruction: prompt.slice(0, idx).trim(), body: prompt.slice(idx + 1).trim() };
1646
- }
1647
- function mergePrompt(instruction, body) {
1648
- const i = instruction.trim();
1649
- const b = body.trim();
1650
- if (!i && !b) return "";
1651
- if (!b) return i;
1652
- if (!i) return b;
1653
- return `${i}
1654
- ${b}`;
1655
- }
1779
+ var EMPTY_FORM = { title: "", slug: "", instruction: "", description: "", conversation_flow: [], rules: "" };
1656
1780
  function AgentObjectivesList({ agent, config }) {
1657
1781
  const { data: objectivesData, isLoading } = useObjectives(config, agent.id);
1658
1782
  const createMutation = useCreateObjective(config);
1659
1783
  const updateMutation = useUpdateObjective(config);
1660
1784
  const deleteMutation = useDeleteObjective(config);
1661
- const [formOpen, setFormOpen] = useState5(false);
1662
- const [editTarget, setEditTarget] = useState5(null);
1663
- const [form, setForm] = useState5(EMPTY_FORM);
1664
- const [slugManual, setSlugManual] = useState5(false);
1665
- const [removeTarget, setRemoveTarget] = useState5(null);
1785
+ const [formOpen, setFormOpen] = useState6(false);
1786
+ const [editTarget, setEditTarget] = useState6(null);
1787
+ const [form, setForm] = useState6(EMPTY_FORM);
1788
+ const [slugManual, setSlugManual] = useState6(false);
1789
+ const [removeTarget, setRemoveTarget] = useState6(null);
1666
1790
  const objectives = objectivesData?.data || [];
1667
1791
  const sortedObjectives = [...objectives].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
1668
1792
  async function handleReorder(newItems) {
@@ -1688,12 +1812,20 @@ function AgentObjectivesList({ agent, config }) {
1688
1812
  }
1689
1813
  function openEdit(objective) {
1690
1814
  setEditTarget(objective);
1691
- const { instruction, body } = splitPrompt(objective.prompt);
1815
+ let parsedFlow = [];
1816
+ if (objective.conversation_flow) {
1817
+ try {
1818
+ parsedFlow = JSON.parse(objective.conversation_flow);
1819
+ } catch {
1820
+ }
1821
+ }
1692
1822
  setForm({
1693
1823
  title: objective.title,
1694
1824
  slug: objective.slug || "",
1695
- instruction,
1696
- prompt: body
1825
+ instruction: objective.instruction || "",
1826
+ description: objective.description || "",
1827
+ conversation_flow: parsedFlow,
1828
+ rules: objective.rules || ""
1697
1829
  });
1698
1830
  setSlugManual(true);
1699
1831
  setFormOpen(true);
@@ -1701,29 +1833,27 @@ function AgentObjectivesList({ agent, config }) {
1701
1833
  async function handleSubmit() {
1702
1834
  if (!form.title.trim()) return;
1703
1835
  const effectiveSlug = form.slug.trim() || slugify(form.title);
1704
- const mergedPrompt = mergePrompt(form.instruction, form.prompt) || null;
1705
1836
  const nextOrder = sortedObjectives.length > 0 ? Math.max(...sortedObjectives.map((o) => o.order)) + 1 : 1;
1706
1837
  try {
1838
+ const bodyFields = {
1839
+ title: form.title.trim(),
1840
+ slug: effectiveSlug,
1841
+ instruction: form.instruction.trim() || null,
1842
+ description: form.description.trim() || null,
1843
+ conversation_flow: form.conversation_flow.length > 0 ? JSON.stringify(form.conversation_flow) : null,
1844
+ rules: form.rules.trim() || null
1845
+ };
1707
1846
  if (editTarget) {
1708
1847
  await updateMutation.mutateAsync({
1709
1848
  idAgent: agent.id,
1710
1849
  id: editTarget.id,
1711
- body: {
1712
- title: form.title.trim(),
1713
- slug: effectiveSlug,
1714
- prompt: mergedPrompt
1715
- }
1850
+ body: bodyFields
1716
1851
  });
1717
1852
  toast4.success("Objetivo atualizado");
1718
1853
  } else {
1719
1854
  await createMutation.mutateAsync({
1720
1855
  idAgent: agent.id,
1721
- body: {
1722
- title: form.title.trim(),
1723
- slug: effectiveSlug,
1724
- prompt: mergedPrompt,
1725
- order: nextOrder
1726
- }
1856
+ body: { ...bodyFields, order: nextOrder }
1727
1857
  });
1728
1858
  toast4.success("Objetivo criado");
1729
1859
  }
@@ -1765,59 +1895,56 @@ function AgentObjectivesList({ agent, config }) {
1765
1895
  }
1766
1896
  }
1767
1897
  if (isLoading) {
1768
- 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)) });
1898
+ return /* @__PURE__ */ jsx6("div", { className: "space-y-3 p-4", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx6(Skeleton, { className: "h-14 w-full" }, i)) });
1769
1899
  }
1770
- return /* @__PURE__ */ jsxs4("div", { className: "space-y-4 p-4", children: [
1771
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
1772
- /* @__PURE__ */ jsxs4("div", { children: [
1773
- /* @__PURE__ */ jsxs4("h3", { className: "text-sm font-medium text-muted-foreground", children: [
1900
+ return /* @__PURE__ */ jsxs5("div", { className: "space-y-4 p-4", children: [
1901
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between", children: [
1902
+ /* @__PURE__ */ jsxs5("div", { children: [
1903
+ /* @__PURE__ */ jsxs5("h3", { className: "text-sm font-medium text-muted-foreground", children: [
1774
1904
  sortedObjectives.length,
1775
1905
  " objetivo",
1776
1906
  sortedObjectives.length !== 1 ? "s" : "",
1777
1907
  " definido",
1778
1908
  sortedObjectives.length !== 1 ? "s" : ""
1779
1909
  ] }),
1780
- /* @__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." })
1910
+ /* @__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." })
1781
1911
  ] }),
1782
- /* @__PURE__ */ jsxs4(Button4, { onClick: openCreate, size: "sm", children: [
1783
- /* @__PURE__ */ jsx5(Plus, { className: "mr-2 h-4 w-4" }),
1912
+ /* @__PURE__ */ jsxs5(Button5, { onClick: openCreate, size: "sm", children: [
1913
+ /* @__PURE__ */ jsx6(Plus2, { className: "mr-2 h-4 w-4" }),
1784
1914
  "Novo Objetivo"
1785
1915
  ] })
1786
1916
  ] }),
1787
- sortedObjectives.length === 0 ? /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
1788
- /* @__PURE__ */ jsx5(Target, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
1789
- /* @__PURE__ */ jsx5("p", { className: "text-sm text-muted-foreground", children: "Nenhum objetivo definido. Adicione objetivos para orientar o agente em diferentes contextos." })
1790
- ] }) : /* @__PURE__ */ jsxs4(
1917
+ sortedObjectives.length === 0 ? /* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
1918
+ /* @__PURE__ */ jsx6(Target, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
1919
+ /* @__PURE__ */ jsx6("p", { className: "text-sm text-muted-foreground", children: "Nenhum objetivo definido. Adicione objetivos para orientar o agente em diferentes contextos." })
1920
+ ] }) : /* @__PURE__ */ jsxs5(
1791
1921
  Sortable,
1792
1922
  {
1793
1923
  value: sortedObjectives,
1794
1924
  onValueChange: handleReorder,
1795
1925
  getItemValue: (item) => item.id,
1796
1926
  children: [
1797
- /* @__PURE__ */ jsx5(SortableContent, { className: "space-y-2", children: sortedObjectives.map((objective) => /* @__PURE__ */ jsxs4(
1927
+ /* @__PURE__ */ jsx6(SortableContent, { className: "space-y-2", children: sortedObjectives.map((objective) => /* @__PURE__ */ jsxs5(
1798
1928
  SortableItem,
1799
1929
  {
1800
1930
  value: objective.id,
1801
1931
  className: "flex items-center gap-3 rounded-lg border bg-card p-3",
1802
1932
  children: [
1803
- /* @__PURE__ */ jsx5(SortableItemHandle, { className: "shrink-0 text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ jsx5(GripVertical, { "aria-hidden": "true", className: "h-5 w-5" }) }),
1804
- /* @__PURE__ */ jsxs4("div", { className: "flex flex-1 flex-col gap-1 min-w-0", children: [
1805
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
1806
- /* @__PURE__ */ jsx5("span", { className: "truncate font-medium", children: objective.title }),
1807
- objective.slug && /* @__PURE__ */ jsx5(Badge2, { variant: "secondary", className: "shrink-0 text-xs font-mono", children: objective.slug })
1933
+ /* @__PURE__ */ jsx6(SortableItemHandle, { className: "shrink-0 text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ jsx6(GripVertical2, { "aria-hidden": "true", className: "h-5 w-5" }) }),
1934
+ /* @__PURE__ */ jsxs5("div", { className: "flex flex-1 flex-col gap-1 min-w-0", children: [
1935
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
1936
+ /* @__PURE__ */ jsx6("span", { className: "truncate font-medium", children: objective.title }),
1937
+ objective.slug && /* @__PURE__ */ jsx6(Badge2, { variant: "secondary", className: "shrink-0 text-xs font-mono", children: objective.slug })
1808
1938
  ] }),
1809
- objective.prompt && (() => {
1810
- const { instruction, body } = splitPrompt(objective.prompt);
1811
- return /* @__PURE__ */ jsxs4("div", { className: "space-y-0.5", children: [
1812
- instruction && /* @__PURE__ */ jsxs4("p", { className: "text-xs font-medium text-muted-foreground", children: [
1813
- "Quando: ",
1814
- instruction
1815
- ] }),
1816
- body && /* @__PURE__ */ jsx5("p", { className: "line-clamp-1 text-xs text-muted-foreground", children: body })
1817
- ] });
1818
- })()
1939
+ (objective.instruction || objective.description) && /* @__PURE__ */ jsxs5("div", { className: "space-y-0.5", children: [
1940
+ objective.instruction && /* @__PURE__ */ jsxs5("p", { className: "text-xs font-medium text-muted-foreground", children: [
1941
+ "Quando: ",
1942
+ objective.instruction
1943
+ ] }),
1944
+ objective.description && /* @__PURE__ */ jsx6("p", { className: "line-clamp-1 text-xs text-muted-foreground", children: objective.description })
1945
+ ] })
1819
1946
  ] }),
1820
- /* @__PURE__ */ jsx5(
1947
+ /* @__PURE__ */ jsx6(
1821
1948
  Switch3,
1822
1949
  {
1823
1950
  "aria-label": "Ativar/Desativar",
@@ -1826,49 +1953,49 @@ function AgentObjectivesList({ agent, config }) {
1826
1953
  disabled: updateMutation.isPending
1827
1954
  }
1828
1955
  ),
1829
- /* @__PURE__ */ jsx5(
1830
- Button4,
1956
+ /* @__PURE__ */ jsx6(
1957
+ Button5,
1831
1958
  {
1832
1959
  variant: "ghost",
1833
1960
  size: "icon",
1834
1961
  "aria-label": "Editar",
1835
1962
  className: "shrink-0 text-muted-foreground hover:text-foreground",
1836
1963
  onClick: () => openEdit(objective),
1837
- children: /* @__PURE__ */ jsx5(Pencil2, { className: "h-4 w-4" })
1964
+ children: /* @__PURE__ */ jsx6(Pencil2, { className: "h-4 w-4" })
1838
1965
  }
1839
1966
  ),
1840
- /* @__PURE__ */ jsx5(
1841
- Button4,
1967
+ /* @__PURE__ */ jsx6(
1968
+ Button5,
1842
1969
  {
1843
1970
  variant: "ghost",
1844
1971
  size: "icon",
1845
1972
  "aria-label": "Excluir",
1846
1973
  className: "shrink-0 text-muted-foreground hover:text-destructive",
1847
1974
  onClick: () => setRemoveTarget(objective),
1848
- children: /* @__PURE__ */ jsx5(Trash22, { className: "h-4 w-4" })
1975
+ children: /* @__PURE__ */ jsx6(Trash23, { className: "h-4 w-4" })
1849
1976
  }
1850
1977
  )
1851
1978
  ]
1852
1979
  },
1853
1980
  objective.id
1854
1981
  )) }),
1855
- /* @__PURE__ */ jsx5(SortableOverlay, { children: ({ value }) => {
1982
+ /* @__PURE__ */ jsx6(SortableOverlay, { children: ({ value }) => {
1856
1983
  const obj = sortedObjectives.find((o) => o.id === value);
1857
- return /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3 rounded-lg border bg-card p-3 shadow-lg", children: [
1858
- /* @__PURE__ */ jsx5(GripVertical, { "aria-hidden": "true", className: "h-5 w-5 text-muted-foreground" }),
1859
- /* @__PURE__ */ jsx5("span", { className: "font-medium", children: obj?.title })
1984
+ return /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3 rounded-lg border bg-card p-3 shadow-lg", children: [
1985
+ /* @__PURE__ */ jsx6(GripVertical2, { "aria-hidden": "true", className: "h-5 w-5 text-muted-foreground" }),
1986
+ /* @__PURE__ */ jsx6("span", { className: "font-medium", children: obj?.title })
1860
1987
  ] });
1861
1988
  } })
1862
1989
  ]
1863
1990
  }
1864
1991
  ),
1865
- /* @__PURE__ */ jsx5(Dialog3, { open: formOpen, onOpenChange: setFormOpen, children: /* @__PURE__ */ jsxs4(DialogContent3, { className: "sm:max-w-lg", children: [
1866
- /* @__PURE__ */ jsx5(DialogHeader3, { children: /* @__PURE__ */ jsx5(DialogTitle3, { children: editTarget ? "Editar Objetivo" : "Novo Objetivo" }) }),
1867
- /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
1868
- /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
1869
- /* @__PURE__ */ jsx5(Label3, { htmlFor: "objective-title", children: "T\xEDtulo *" }),
1870
- /* @__PURE__ */ jsx5(
1871
- Input4,
1992
+ /* @__PURE__ */ jsx6(Dialog3, { open: formOpen, onOpenChange: setFormOpen, children: /* @__PURE__ */ jsxs5(DialogContent3, { className: "sm:max-w-lg", children: [
1993
+ /* @__PURE__ */ jsx6(DialogHeader3, { children: /* @__PURE__ */ jsx6(DialogTitle3, { children: editTarget ? "Editar Objetivo" : "Novo Objetivo" }) }),
1994
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-4", children: [
1995
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
1996
+ /* @__PURE__ */ jsx6(Label3, { htmlFor: "objective-title", children: "T\xEDtulo *" }),
1997
+ /* @__PURE__ */ jsx6(
1998
+ Input5,
1872
1999
  {
1873
2000
  id: "objective-title",
1874
2001
  name: "title",
@@ -1885,10 +2012,10 @@ function AgentObjectivesList({ agent, config }) {
1885
2012
  }
1886
2013
  )
1887
2014
  ] }),
1888
- /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
1889
- /* @__PURE__ */ jsx5(Label3, { htmlFor: "objective-slug", children: "Slug (identificador) *" }),
1890
- /* @__PURE__ */ jsx5(
1891
- Input4,
2015
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
2016
+ /* @__PURE__ */ jsx6(Label3, { htmlFor: "objective-slug", children: "Slug (identificador) *" }),
2017
+ /* @__PURE__ */ jsx6(
2018
+ Input5,
1892
2019
  {
1893
2020
  id: "objective-slug",
1894
2021
  name: "slug",
@@ -1901,12 +2028,12 @@ function AgentObjectivesList({ agent, config }) {
1901
2028
  className: "font-mono"
1902
2029
  }
1903
2030
  ),
1904
- /* @__PURE__ */ jsx5("p", { className: "text-xs text-muted-foreground", children: "Gerado automaticamente. Usado pelo agente para identificar o objetivo." })
2031
+ /* @__PURE__ */ jsx6("p", { className: "text-xs text-muted-foreground", children: "Gerado automaticamente. Usado pelo agente para identificar o objetivo." })
1905
2032
  ] }),
1906
- /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
1907
- /* @__PURE__ */ jsx5(Label3, { htmlFor: "objective-instruction", children: "Quando ativar (instru\xE7\xE3o curta) *" }),
1908
- /* @__PURE__ */ jsx5(
1909
- Input4,
2033
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
2034
+ /* @__PURE__ */ jsx6(Label3, { htmlFor: "objective-instruction", children: "Quando ativar (instru\xE7\xE3o curta) *" }),
2035
+ /* @__PURE__ */ jsx6(
2036
+ Input5,
1910
2037
  {
1911
2038
  id: "objective-instruction",
1912
2039
  name: "instruction",
@@ -1915,35 +2042,61 @@ function AgentObjectivesList({ agent, config }) {
1915
2042
  placeholder: "Ex: Quando o utilizador quer agendar uma consulta"
1916
2043
  }
1917
2044
  ),
1918
- /* @__PURE__ */ jsx5("p", { className: "text-xs text-muted-foreground", children: "Instru\xE7\xE3o curta que diz ao agente QUANDO ativar este objetivo. Aparece na sec\xE7\xE3o [SKILLS] do prompt." })
2045
+ /* @__PURE__ */ jsx6("p", { className: "text-xs text-muted-foreground", children: "Instru\xE7\xE3o curta que diz ao agente QUANDO ativar este objetivo. Aparece na sec\xE7\xE3o [OBJETIVOS] do prompt." })
2046
+ ] }),
2047
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
2048
+ /* @__PURE__ */ jsx6(Label3, { htmlFor: "objective-description", children: "Descri\xE7\xE3o" }),
2049
+ /* @__PURE__ */ jsx6(
2050
+ Textarea,
2051
+ {
2052
+ id: "objective-description",
2053
+ name: "description",
2054
+ value: form.description,
2055
+ onChange: (e) => setForm((f) => ({ ...f, description: e.target.value })),
2056
+ placeholder: "Descreva o prop\xF3sito deste objectivo...",
2057
+ rows: 3
2058
+ }
2059
+ ),
2060
+ /* @__PURE__ */ jsx6("p", { className: "text-xs text-muted-foreground", children: "Miss\xE3o e prop\xF3sito deste objectivo \u2014 o que o agente deve alcan\xE7ar." })
2061
+ ] }),
2062
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
2063
+ /* @__PURE__ */ jsx6(Label3, { children: "Fluxo de Conversa" }),
2064
+ /* @__PURE__ */ jsx6(
2065
+ ConversationFlowEditor,
2066
+ {
2067
+ steps: form.conversation_flow,
2068
+ onChange: (steps) => setForm((f) => ({ ...f, conversation_flow: steps }))
2069
+ }
2070
+ ),
2071
+ /* @__PURE__ */ jsx6("p", { className: "text-xs text-muted-foreground", children: "Etapas que o agente segue quando este objectivo \xE9 activado." })
1919
2072
  ] }),
1920
- /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
1921
- /* @__PURE__ */ jsx5(Label3, { htmlFor: "objective-prompt", children: "Instru\xE7\xF5es detalhadas" }),
1922
- /* @__PURE__ */ jsx5(
2073
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
2074
+ /* @__PURE__ */ jsx6(Label3, { htmlFor: "objective-rules", children: "Regras" }),
2075
+ /* @__PURE__ */ jsx6(
1923
2076
  Textarea,
1924
2077
  {
1925
- id: "objective-prompt",
1926
- name: "prompt",
1927
- value: form.prompt,
1928
- onChange: (e) => setForm((f) => ({ ...f, prompt: e.target.value })),
1929
- placeholder: "Instru\xE7\xF5es detalhadas que o agente seguir\xE1 quando este objetivo for ativado...",
1930
- rows: 6
2078
+ id: "objective-rules",
2079
+ name: "rules",
2080
+ value: form.rules,
2081
+ onChange: (e) => setForm((f) => ({ ...f, rules: e.target.value })),
2082
+ placeholder: "Regras espec\xEDficas deste objectivo...",
2083
+ rows: 3
1931
2084
  }
1932
2085
  ),
1933
- /* @__PURE__ */ jsx5("p", { className: "text-xs text-muted-foreground", children: "Passos, regras e contexto detalhado para o agente seguir quando este objetivo est\xE1 ativo." })
2086
+ /* @__PURE__ */ jsx6("p", { className: "text-xs text-muted-foreground", children: "Restri\xE7\xF5es e limites espec\xEDficos quando este objectivo est\xE1 activo." })
1934
2087
  ] })
1935
2088
  ] }),
1936
- /* @__PURE__ */ jsxs4(DialogFooter3, { children: [
1937
- /* @__PURE__ */ jsx5(
1938
- Button4,
2089
+ /* @__PURE__ */ jsxs5(DialogFooter3, { children: [
2090
+ /* @__PURE__ */ jsx6(
2091
+ Button5,
1939
2092
  {
1940
2093
  variant: "outline",
1941
2094
  onClick: () => setFormOpen(false),
1942
2095
  children: "Cancelar"
1943
2096
  }
1944
2097
  ),
1945
- /* @__PURE__ */ jsx5(
1946
- Button4,
2098
+ /* @__PURE__ */ jsx6(
2099
+ Button5,
1947
2100
  {
1948
2101
  onClick: handleSubmit,
1949
2102
  disabled: !form.title.trim() || createMutation.isPending || updateMutation.isPending,
@@ -1952,19 +2105,19 @@ function AgentObjectivesList({ agent, config }) {
1952
2105
  )
1953
2106
  ] })
1954
2107
  ] }) }),
1955
- /* @__PURE__ */ jsx5(
2108
+ /* @__PURE__ */ jsx6(
1956
2109
  AlertDialog2,
1957
2110
  {
1958
2111
  open: !!removeTarget,
1959
2112
  onOpenChange: (open) => !open && setRemoveTarget(null),
1960
- children: /* @__PURE__ */ jsxs4(AlertDialogContent2, { children: [
1961
- /* @__PURE__ */ jsxs4(AlertDialogHeader2, { children: [
1962
- /* @__PURE__ */ jsx5(AlertDialogTitle2, { children: "Remover objetivo?" }),
1963
- /* @__PURE__ */ jsx5(AlertDialogDescription2, { children: "O objetivo ser\xE1 removido permanentemente." })
2113
+ children: /* @__PURE__ */ jsxs5(AlertDialogContent2, { children: [
2114
+ /* @__PURE__ */ jsxs5(AlertDialogHeader2, { children: [
2115
+ /* @__PURE__ */ jsx6(AlertDialogTitle2, { children: "Remover objetivo?" }),
2116
+ /* @__PURE__ */ jsx6(AlertDialogDescription2, { children: "O objetivo ser\xE1 removido permanentemente." })
1964
2117
  ] }),
1965
- /* @__PURE__ */ jsxs4(AlertDialogFooter2, { children: [
1966
- /* @__PURE__ */ jsx5(AlertDialogCancel2, { children: "Cancelar" }),
1967
- /* @__PURE__ */ jsx5(
2118
+ /* @__PURE__ */ jsxs5(AlertDialogFooter2, { children: [
2119
+ /* @__PURE__ */ jsx6(AlertDialogCancel2, { children: "Cancelar" }),
2120
+ /* @__PURE__ */ jsx6(
1968
2121
  AlertDialogAction2,
1969
2122
  {
1970
2123
  onClick: handleRemove,
@@ -1979,12 +2132,263 @@ function AgentObjectivesList({ agent, config }) {
1979
2132
  ] });
1980
2133
  }
1981
2134
 
1982
- // src/components/agents/agent-prompt-editor.tsx
1983
- import { useState as useState6, useRef, useCallback as useCallback3, useEffect as useEffect3 } from "react";
1984
- import { Button as Button5, Input as Input5, Skeleton as Skeleton2, Badge as Badge3 } from "@greatapps/greatauth-ui/ui";
1985
- import { FileText, Loader2 as Loader23, ChevronDown, ChevronUp, RotateCcw } from "lucide-react";
2135
+ // src/components/agents/agent-definition-editor.tsx
2136
+ import { useState as useState7, useRef as useRef2, useCallback as useCallback4, useEffect as useEffect3 } from "react";
2137
+ import { Button as Button6, Input as Input6, Label as Label4 } from "@greatapps/greatauth-ui/ui";
2138
+ import { Loader2 as Loader23 } from "lucide-react";
1986
2139
  import { toast as toast5 } from "sonner";
1987
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
2140
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
2141
+ var SECTIONS = [
2142
+ {
2143
+ key: "identity",
2144
+ label: "Identidade",
2145
+ helper: "Descreva quem \xE9 o agente, o seu nome e personalidade",
2146
+ required: true,
2147
+ field: "identity",
2148
+ type: "textarea"
2149
+ },
2150
+ {
2151
+ key: "mission",
2152
+ label: "Miss\xE3o",
2153
+ helper: "Qual \xE9 a miss\xE3o principal deste agente",
2154
+ required: true,
2155
+ field: "mission",
2156
+ type: "textarea"
2157
+ },
2158
+ {
2159
+ key: "tone_style_format",
2160
+ label: "Tom, Estilo & Formato",
2161
+ helper: "Defina como o agente comunica e formata as respostas",
2162
+ required: false,
2163
+ field: "tone_style_format",
2164
+ type: "textarea"
2165
+ },
2166
+ {
2167
+ key: "rules",
2168
+ label: "Regras",
2169
+ helper: "Limites, restri\xE7\xF5es e comportamentos obrigat\xF3rios",
2170
+ required: false,
2171
+ field: "rules",
2172
+ type: "textarea"
2173
+ },
2174
+ {
2175
+ key: "conversation_flow",
2176
+ label: "Fluxo de Conversa",
2177
+ helper: "Etapas que o agente segue no in\xEDcio de cada conversa",
2178
+ required: false,
2179
+ field: "conversation_flow",
2180
+ type: "conversation_flow"
2181
+ },
2182
+ {
2183
+ key: "context",
2184
+ label: "Contexto",
2185
+ helper: "Informa\xE7\xF5es adicionais que o agente deve saber",
2186
+ required: false,
2187
+ field: "context",
2188
+ type: "textarea"
2189
+ }
2190
+ ];
2191
+ function parseConversationFlow(raw) {
2192
+ if (!raw) return [];
2193
+ try {
2194
+ const parsed = JSON.parse(raw);
2195
+ if (Array.isArray(parsed)) return parsed;
2196
+ return [];
2197
+ } catch {
2198
+ return [];
2199
+ }
2200
+ }
2201
+ function computeTotals(fields, steps) {
2202
+ const textChars = Object.values(fields).reduce((sum, v) => sum + v.length, 0);
2203
+ const flowChars = JSON.stringify(steps).length;
2204
+ const total = textChars + flowChars;
2205
+ return { chars: total, tokens: Math.ceil(total / 4) };
2206
+ }
2207
+ function AutoTextarea({
2208
+ value,
2209
+ onChange,
2210
+ disabled,
2211
+ placeholder,
2212
+ ariaLabel
2213
+ }) {
2214
+ const ref = useRef2(null);
2215
+ const autoResize = useCallback4(() => {
2216
+ const el = ref.current;
2217
+ if (!el) return;
2218
+ el.style.height = "auto";
2219
+ el.style.height = `${Math.max(120, el.scrollHeight)}px`;
2220
+ }, []);
2221
+ useEffect3(() => {
2222
+ autoResize();
2223
+ }, [value, autoResize]);
2224
+ function handleKeyDown(e) {
2225
+ if (e.key === "Tab") {
2226
+ e.preventDefault();
2227
+ const el = e.currentTarget;
2228
+ const start = el.selectionStart;
2229
+ const end = el.selectionEnd;
2230
+ const newValue = el.value.substring(0, start) + " " + el.value.substring(end);
2231
+ onChange(newValue);
2232
+ requestAnimationFrame(() => {
2233
+ el.selectionStart = el.selectionEnd = start + 2;
2234
+ });
2235
+ }
2236
+ }
2237
+ return /* @__PURE__ */ jsx7(
2238
+ "textarea",
2239
+ {
2240
+ ref,
2241
+ "aria-label": ariaLabel,
2242
+ value,
2243
+ onChange: (e) => onChange(e.target.value),
2244
+ onKeyDown: handleKeyDown,
2245
+ placeholder,
2246
+ disabled,
2247
+ className: "w-full resize-none rounded-lg border bg-background p-3 text-sm leading-relaxed focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50",
2248
+ style: { minHeight: "120px" }
2249
+ }
2250
+ );
2251
+ }
2252
+ function AgentDefinitionEditor({ agent, config }) {
2253
+ const updateAgent = useUpdateAgent(config);
2254
+ const [trackedAgentId, setTrackedAgentId] = useState7(agent.id);
2255
+ const [fields, setFields] = useState7(() => ({
2256
+ identity: agent.identity ?? "",
2257
+ mission: agent.mission ?? "",
2258
+ tone_style_format: agent.tone_style_format ?? "",
2259
+ rules: agent.rules ?? "",
2260
+ context: agent.context ?? ""
2261
+ }));
2262
+ const [conversationFlowSteps, setConversationFlowSteps] = useState7(
2263
+ () => parseConversationFlow(agent.conversation_flow)
2264
+ );
2265
+ const [changeNotes, setChangeNotes] = useState7("");
2266
+ if (trackedAgentId !== agent.id) {
2267
+ setTrackedAgentId(agent.id);
2268
+ setFields({
2269
+ identity: agent.identity ?? "",
2270
+ mission: agent.mission ?? "",
2271
+ tone_style_format: agent.tone_style_format ?? "",
2272
+ rules: agent.rules ?? "",
2273
+ context: agent.context ?? ""
2274
+ });
2275
+ setConversationFlowSteps(parseConversationFlow(agent.conversation_flow));
2276
+ setChangeNotes("");
2277
+ }
2278
+ function updateField(key, value) {
2279
+ setFields((prev) => ({ ...prev, [key]: value }));
2280
+ }
2281
+ const { chars, tokens } = computeTotals(fields, conversationFlowSteps);
2282
+ async function handleSave() {
2283
+ if (!fields.identity.trim() || !fields.mission.trim()) {
2284
+ toast5.error("Identidade e Miss\xE3o s\xE3o campos obrigat\xF3rios");
2285
+ return;
2286
+ }
2287
+ const body = {
2288
+ identity: fields.identity.trim(),
2289
+ mission: fields.mission.trim(),
2290
+ tone_style_format: fields.tone_style_format.trim() || null,
2291
+ rules: fields.rules.trim() || null,
2292
+ conversation_flow: conversationFlowSteps.length > 0 ? JSON.stringify(conversationFlowSteps) : null,
2293
+ context: fields.context.trim() || null
2294
+ };
2295
+ if (changeNotes.trim()) {
2296
+ body.change_notes = changeNotes.trim();
2297
+ }
2298
+ try {
2299
+ await updateAgent.mutateAsync({ id: agent.id, body });
2300
+ setChangeNotes("");
2301
+ toast5.success("Defini\xE7\xE3o do agente salva com sucesso");
2302
+ } catch {
2303
+ toast5.error("Erro ao salvar defini\xE7\xE3o do agente");
2304
+ }
2305
+ }
2306
+ return /* @__PURE__ */ jsxs6("div", { className: "space-y-6 p-4", children: [
2307
+ SECTIONS.map((section) => /* @__PURE__ */ jsxs6("div", { className: "space-y-2", children: [
2308
+ /* @__PURE__ */ jsxs6(Label4, { className: "text-sm font-medium", children: [
2309
+ section.label,
2310
+ section.required && /* @__PURE__ */ jsx7("span", { className: "ml-0.5 text-destructive", children: "*" })
2311
+ ] }),
2312
+ /* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: section.helper }),
2313
+ section.type === "textarea" ? /* @__PURE__ */ jsx7(
2314
+ AutoTextarea,
2315
+ {
2316
+ value: fields[section.key] ?? "",
2317
+ onChange: (v) => updateField(section.key, v),
2318
+ disabled: updateAgent.isPending,
2319
+ placeholder: `${section.label}...`,
2320
+ ariaLabel: section.label
2321
+ }
2322
+ ) : /* @__PURE__ */ jsx7(
2323
+ ConversationFlowEditor,
2324
+ {
2325
+ steps: conversationFlowSteps,
2326
+ onChange: setConversationFlowSteps,
2327
+ disabled: updateAgent.isPending
2328
+ }
2329
+ )
2330
+ ] }, section.key)),
2331
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-3 text-xs text-muted-foreground", children: [
2332
+ /* @__PURE__ */ jsxs6("span", { className: "tabular-nums", children: [
2333
+ chars.toLocaleString("pt-BR"),
2334
+ " caracteres"
2335
+ ] }),
2336
+ /* @__PURE__ */ jsx7("span", { children: "\xB7" }),
2337
+ /* @__PURE__ */ jsxs6("span", { className: "tabular-nums", children: [
2338
+ "~",
2339
+ tokens.toLocaleString("pt-BR"),
2340
+ " tokens"
2341
+ ] })
2342
+ ] }),
2343
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-3", children: [
2344
+ /* @__PURE__ */ jsx7(
2345
+ Input6,
2346
+ {
2347
+ "aria-label": "Notas da altera\xE7\xE3o",
2348
+ name: "changeNotes",
2349
+ value: changeNotes,
2350
+ onChange: (e) => setChangeNotes(e.target.value),
2351
+ placeholder: "O que mudou? (opcional)",
2352
+ disabled: updateAgent.isPending,
2353
+ className: "flex-1",
2354
+ onKeyDown: (e) => {
2355
+ if (e.key === "Enter") {
2356
+ e.preventDefault();
2357
+ handleSave();
2358
+ }
2359
+ }
2360
+ }
2361
+ ),
2362
+ /* @__PURE__ */ jsxs6(
2363
+ Button6,
2364
+ {
2365
+ onClick: handleSave,
2366
+ disabled: updateAgent.isPending || !fields.identity.trim() || !fields.mission.trim(),
2367
+ children: [
2368
+ updateAgent.isPending && /* @__PURE__ */ jsx7(Loader23, { className: "mr-2 h-4 w-4 animate-spin" }),
2369
+ "Salvar"
2370
+ ]
2371
+ }
2372
+ )
2373
+ ] })
2374
+ ] });
2375
+ }
2376
+
2377
+ // src/components/agents/agent-revision-tab.tsx
2378
+ import { useState as useState8, useMemo as useMemo5 } from "react";
2379
+ import {
2380
+ Button as Button7,
2381
+ Badge as Badge3,
2382
+ Skeleton as Skeleton2,
2383
+ Dialog as Dialog4,
2384
+ DialogContent as DialogContent4,
2385
+ DialogHeader as DialogHeader4,
2386
+ DialogTitle as DialogTitle4
2387
+ } from "@greatapps/greatauth-ui/ui";
2388
+ import { FileText, RotateCcw, X, AlertTriangle } from "lucide-react";
2389
+ import { toast as toast6 } from "sonner";
2390
+ import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
2391
+ var STRUCTURED_MARKERS = ["[IDENTIDADE]", "[MISS\xC3O]", "[TOM, ESTILO & FORMATO]"];
1988
2392
  function formatDate(dateStr) {
1989
2393
  const date = new Date(dateStr);
1990
2394
  return date.toLocaleDateString("pt-BR", {
@@ -2016,214 +2420,95 @@ function computeDiff(oldText, newText) {
2016
2420
  }
2017
2421
  return result;
2018
2422
  }
2019
- function buildPreview(promptText, objectives, agentTools, allTools) {
2020
- let preview = promptText;
2021
- const activeObjectives = objectives.filter((o) => o.active && o.slug);
2022
- const enabledAgentTools = agentTools.filter((at) => at.enabled);
2023
- const toolMap = new Map(allTools.map((t) => [t.id, t]));
2024
- if (activeObjectives.length > 0) {
2025
- preview += "\n\n[SKILLS]";
2026
- for (const obj of activeObjectives) {
2027
- preview += `
2028
- - ${obj.slug}: ${obj.title}`;
2029
- if (obj.prompt) {
2030
- const firstLine = obj.prompt.split("\n")[0].trim();
2031
- if (firstLine) preview += ` \u2014 ${firstLine}`;
2032
- }
2033
- }
2423
+ function formatConversationFlow(raw) {
2424
+ if (!raw) return "";
2425
+ try {
2426
+ const steps = JSON.parse(raw);
2427
+ if (!Array.isArray(steps) || steps.length === 0) return "";
2428
+ return steps.sort((a, b) => a.order - b.order).map((s) => {
2429
+ let line = `${s.order}. ${s.instruction}`;
2430
+ if (s.example) line += `
2431
+ Exemplo: ${s.example}`;
2432
+ return line;
2433
+ }).join("\n");
2434
+ } catch {
2435
+ return raw;
2034
2436
  }
2035
- const toolBindings = enabledAgentTools.map((at) => ({ at, tool: toolMap.get(at.id_tool) })).filter((x) => !!x.tool);
2036
- const seenToolIds = /* @__PURE__ */ new Set();
2037
- const dedupedBindings = toolBindings.filter(({ at }) => {
2038
- if (seenToolIds.has(at.id_tool)) return false;
2039
- seenToolIds.add(at.id_tool);
2040
- return true;
2041
- });
2042
- if (dedupedBindings.length > 0) {
2043
- preview += "\n\n[TOOLS]";
2044
- for (const { at, tool } of dedupedBindings) {
2045
- if (at.custom_instructions) {
2046
- preview += `
2047
-
2048
- ${at.custom_instructions}`;
2049
- } else {
2050
- preview += `
2051
-
2052
- ### ${tool.name} (${tool.slug})`;
2053
- if (tool.description) preview += `
2054
- ${tool.description}`;
2055
- }
2056
- }
2437
+ }
2438
+ function buildAssembledPrompt(agent) {
2439
+ const sections = [];
2440
+ if (agent.identity?.trim()) {
2441
+ sections.push(`[IDENTIDADE]
2442
+ ${agent.identity.trim()}`);
2443
+ }
2444
+ if (agent.mission?.trim()) {
2445
+ sections.push(`[MISS\xC3O]
2446
+ ${agent.mission.trim()}`);
2447
+ }
2448
+ if (agent.tone_style_format?.trim()) {
2449
+ sections.push(`[TOM, ESTILO & FORMATO]
2450
+ ${agent.tone_style_format.trim()}`);
2451
+ }
2452
+ if (agent.rules?.trim()) {
2453
+ sections.push(`[REGRAS]
2454
+ ${agent.rules.trim()}`);
2057
2455
  }
2058
- return preview;
2456
+ const flowFormatted = formatConversationFlow(agent.conversation_flow);
2457
+ if (flowFormatted) {
2458
+ sections.push(`[FLUXO DE CONVERSA]
2459
+ ${flowFormatted}`);
2460
+ }
2461
+ if (agent.context?.trim()) {
2462
+ sections.push(`[CONTEXTO]
2463
+ ${agent.context.trim()}`);
2464
+ }
2465
+ return sections.join("\n\n");
2059
2466
  }
2060
- function AgentPromptEditor({ config, agent }) {
2467
+ function isLegacyVersion(version) {
2468
+ const content = version.prompt_content ?? "";
2469
+ return !STRUCTURED_MARKERS.some((marker) => content.includes(marker));
2470
+ }
2471
+ function AgentRevisionTab({ agent, config }) {
2061
2472
  const { data: versionsData, isLoading } = usePromptVersions(config, agent.id);
2062
- const updateAgent = useUpdateAgent(config);
2063
- const { data: objectivesData } = useObjectives(config, agent.id);
2064
- const { data: agentToolsData } = useAgentTools(config, agent.id);
2065
- const { data: toolsData } = useTools(config);
2473
+ const [compareVersionId, setCompareVersionId] = useState8(null);
2474
+ const [legacyModalVersion, setLegacyModalVersion] = useState8(null);
2066
2475
  const versions = versionsData?.data || [];
2067
2476
  const sortedVersions = [...versions].sort(
2068
2477
  (a, b) => new Date(b.datetime_add).getTime() - new Date(a.datetime_add).getTime()
2069
2478
  );
2070
2479
  const currentVersion = sortedVersions.find((v) => v.is_current) || sortedVersions[0] || null;
2071
- const currentPromptContent = currentVersion?.prompt_content ?? "";
2072
- const [trackedAgentId, setTrackedAgentId] = useState6(agent.id);
2073
- const [promptText, setPromptText] = useState6(currentPromptContent);
2074
- const [promptInitialized, setPromptInitialized] = useState6(false);
2075
- const [changeNotes, setChangeNotes] = useState6("");
2076
- const [showPreview, setShowPreview] = useState6(false);
2077
- const [compareVersionId, setCompareVersionId] = useState6(null);
2078
- const textareaRef = useRef(null);
2079
- if (!promptInitialized && currentPromptContent && !isLoading) {
2080
- setPromptText(currentPromptContent);
2081
- setPromptInitialized(true);
2082
- }
2083
- if (trackedAgentId !== agent.id) {
2084
- setTrackedAgentId(agent.id);
2085
- setPromptText(currentPromptContent);
2086
- setPromptInitialized(!!currentPromptContent);
2087
- setCompareVersionId(null);
2088
- }
2089
- const autoResize = useCallback3(() => {
2090
- const el = textareaRef.current;
2091
- if (!el) return;
2092
- el.style.height = "auto";
2093
- el.style.height = `${Math.max(300, el.scrollHeight)}px`;
2094
- }, []);
2095
- useEffect3(() => {
2096
- autoResize();
2097
- }, [promptText, autoResize]);
2098
- function handleKeyDown(e) {
2099
- if (e.key === "Tab") {
2100
- e.preventDefault();
2101
- const el = e.currentTarget;
2102
- const start = el.selectionStart;
2103
- const end = el.selectionEnd;
2104
- const value = el.value;
2105
- const newValue = value.substring(0, start) + " " + value.substring(end);
2106
- setPromptText(newValue);
2107
- requestAnimationFrame(() => {
2108
- el.selectionStart = el.selectionEnd = start + 2;
2109
- });
2110
- }
2111
- }
2480
+ const assembledPrompt = useMemo5(() => buildAssembledPrompt(agent), [
2481
+ agent.identity,
2482
+ agent.mission,
2483
+ agent.tone_style_format,
2484
+ agent.rules,
2485
+ agent.conversation_flow,
2486
+ agent.context
2487
+ ]);
2488
+ const charCount = assembledPrompt.length;
2489
+ const tokenEstimate = Math.ceil(charCount / 4);
2112
2490
  const compareVersion = sortedVersions.find((v) => v.id === compareVersionId);
2113
2491
  const diffLines = currentVersion && compareVersion && compareVersion.id !== currentVersion.id ? computeDiff(compareVersion.prompt_content ?? "", currentVersion.prompt_content ?? "") : null;
2114
- async function handleSave() {
2115
- const body = {
2116
- prompt: promptText.trim()
2117
- };
2118
- if (changeNotes.trim()) {
2119
- body.change_notes = changeNotes.trim();
2120
- }
2121
- try {
2122
- await updateAgent.mutateAsync({ id: agent.id, body });
2123
- setChangeNotes("");
2124
- toast5.success("Prompt salvo com sucesso");
2125
- } catch {
2126
- toast5.error("Erro ao salvar prompt");
2127
- }
2128
- }
2129
2492
  function handleRestore(version) {
2130
- setPromptText(version.prompt_content ?? "");
2131
- setChangeNotes(`Restaurado da v${version.version_number}`);
2132
- toast5.info("Prompt restaurado no editor. Clique em Salvar para confirmar.");
2493
+ if (isLegacyVersion(version)) {
2494
+ setLegacyModalVersion(version);
2495
+ } else {
2496
+ toast6.info("Restaurar vers\xE3o estruturada \u2014 funcionalidade em desenvolvimento");
2497
+ }
2133
2498
  }
2134
- const charCount = promptText.length;
2135
- const tokenEstimate = Math.ceil(charCount / 4);
2136
- const objectives = objectivesData?.data || [];
2137
- const agentTools = agentToolsData?.data || [];
2138
- const allTools = toolsData?.data || [];
2139
- const previewText = buildPreview(promptText, objectives, agentTools, allTools);
2140
2499
  if (isLoading) {
2141
- 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)) });
2500
+ return /* @__PURE__ */ jsx8("div", { className: "space-y-3 p-4", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx8(Skeleton2, { className: "h-14 w-full" }, i)) });
2142
2501
  }
2143
- return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-4 p-4 lg:flex-row", children: [
2144
- /* @__PURE__ */ jsxs5("div", { className: "min-w-0 flex-1 space-y-4", children: [
2145
- /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
2146
- /* @__PURE__ */ jsx6(
2147
- "textarea",
2148
- {
2149
- ref: textareaRef,
2150
- "aria-label": "Prompt do sistema",
2151
- name: "prompt",
2152
- value: promptText,
2153
- onChange: (e) => setPromptText(e.target.value),
2154
- onKeyDown: handleKeyDown,
2155
- placeholder: "Escreva o prompt do sistema aqui\\u2026",
2156
- disabled: updateAgent.isPending,
2157
- className: "w-full resize-none rounded-lg border bg-background p-3 font-mono text-sm leading-relaxed focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50",
2158
- style: { minHeight: "300px" }
2159
- }
2160
- ),
2161
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3 text-xs text-muted-foreground", children: [
2162
- /* @__PURE__ */ jsxs5("span", { className: "tabular-nums", children: [
2163
- charCount.toLocaleString("pt-BR"),
2164
- " caracteres"
2165
- ] }),
2166
- /* @__PURE__ */ jsx6("span", { children: "\xB7" }),
2167
- /* @__PURE__ */ jsxs5("span", { className: "tabular-nums", children: [
2168
- "~",
2169
- tokenEstimate.toLocaleString("pt-BR"),
2170
- " tokens"
2171
- ] })
2172
- ] })
2173
- ] }),
2174
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3", children: [
2175
- /* @__PURE__ */ jsx6(
2176
- Input5,
2177
- {
2178
- "aria-label": "Notas da altera\xE7\xE3o",
2179
- name: "changeNotes",
2180
- value: changeNotes,
2181
- onChange: (e) => setChangeNotes(e.target.value),
2182
- placeholder: "O que mudou? (opcional)",
2183
- disabled: updateAgent.isPending,
2184
- className: "flex-1",
2185
- onKeyDown: (e) => {
2186
- if (e.key === "Enter") {
2187
- e.preventDefault();
2188
- handleSave();
2189
- }
2190
- }
2191
- }
2192
- ),
2193
- /* @__PURE__ */ jsxs5(
2194
- Button5,
2195
- {
2196
- onClick: handleSave,
2197
- disabled: updateAgent.isPending || !promptText.trim(),
2198
- children: [
2199
- updateAgent.isPending && /* @__PURE__ */ jsx6(Loader23, { className: "mr-2 h-4 w-4 animate-spin" }),
2200
- "Salvar"
2201
- ]
2202
- }
2203
- )
2204
- ] }),
2205
- /* @__PURE__ */ jsxs5("div", { className: "rounded-lg border", children: [
2206
- /* @__PURE__ */ jsxs5(
2207
- "button",
2208
- {
2209
- type: "button",
2210
- onClick: () => setShowPreview((prev) => !prev),
2211
- className: "flex w-full items-center justify-between px-4 py-3 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",
2212
- children: [
2213
- /* @__PURE__ */ jsx6("span", { children: "Preview do prompt final" }),
2214
- showPreview ? /* @__PURE__ */ jsx6(ChevronUp, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx6(ChevronDown, { className: "h-4 w-4" })
2215
- ]
2216
- }
2217
- ),
2218
- 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) => {
2219
- const isTopSection = line.startsWith("[TOOLS]") || line.startsWith("[SKILLS]");
2220
- const isH2 = line.startsWith("## ");
2221
- const isH3 = line.startsWith("### ");
2222
- const cls = isTopSection ? "font-bold text-foreground" : isH2 ? "font-semibold text-muted-foreground" : isH3 ? "font-medium text-muted-foreground" : "";
2223
- return /* @__PURE__ */ jsxs5(
2502
+ return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-4 p-4 lg:flex-row", children: [
2503
+ /* @__PURE__ */ jsxs7("div", { className: "min-w-0 flex-1 space-y-4", children: [
2504
+ /* @__PURE__ */ jsxs7("div", { className: "space-y-2", children: [
2505
+ /* @__PURE__ */ jsx8("h3", { className: "text-sm font-medium text-muted-foreground", children: "Preview do Prompt Montado" }),
2506
+ /* @__PURE__ */ jsx8("div", { className: "rounded-lg border", children: /* @__PURE__ */ jsx8("pre", { className: "max-h-[32rem] overflow-auto whitespace-pre-wrap p-4 font-mono text-sm leading-relaxed", children: assembledPrompt ? assembledPrompt.split("\n").map((line, i) => {
2507
+ const isSectionHeader = /^\[.+\]$/.test(line.trim());
2508
+ return /* @__PURE__ */ jsxs7(
2224
2509
  "span",
2225
2510
  {
2226
- className: cls,
2511
+ className: isSectionHeader ? "font-bold text-foreground" : "",
2227
2512
  children: [
2228
2513
  line,
2229
2514
  "\n"
@@ -2231,34 +2516,49 @@ function AgentPromptEditor({ config, agent }) {
2231
2516
  },
2232
2517
  i
2233
2518
  );
2234
- }) }) })
2519
+ }) : /* @__PURE__ */ jsx8("span", { className: "italic text-muted-foreground", children: "Nenhum campo estruturado preenchido." }) }) }),
2520
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-3 text-xs text-muted-foreground", children: [
2521
+ /* @__PURE__ */ jsxs7("span", { className: "tabular-nums", children: [
2522
+ charCount.toLocaleString("pt-BR"),
2523
+ " caracteres"
2524
+ ] }),
2525
+ /* @__PURE__ */ jsx8("span", { children: "\xB7" }),
2526
+ /* @__PURE__ */ jsxs7("span", { className: "tabular-nums", children: [
2527
+ "~",
2528
+ tokenEstimate.toLocaleString("pt-BR"),
2529
+ " tokens"
2530
+ ] })
2531
+ ] })
2235
2532
  ] }),
2236
- diffLines && compareVersion && currentVersion && /* @__PURE__ */ jsxs5("div", { children: [
2237
- /* @__PURE__ */ jsxs5("div", { className: "mb-2 flex items-center justify-between", children: [
2238
- /* @__PURE__ */ jsxs5("h3", { className: "text-sm font-medium text-muted-foreground", children: [
2533
+ diffLines && compareVersion && currentVersion && /* @__PURE__ */ jsxs7("div", { children: [
2534
+ /* @__PURE__ */ jsxs7("div", { className: "mb-2 flex items-center justify-between", children: [
2535
+ /* @__PURE__ */ jsxs7("h3", { className: "text-sm font-medium text-muted-foreground", children: [
2239
2536
  "Diferen\xE7as: v",
2240
2537
  compareVersion.version_number,
2241
2538
  " \u2192 v",
2242
2539
  currentVersion.version_number,
2243
2540
  " (actual)"
2244
2541
  ] }),
2245
- /* @__PURE__ */ jsx6(
2246
- Button5,
2542
+ /* @__PURE__ */ jsxs7(
2543
+ Button7,
2247
2544
  {
2248
2545
  variant: "ghost",
2249
2546
  size: "sm",
2250
2547
  onClick: () => setCompareVersionId(null),
2251
2548
  className: "text-xs",
2252
- children: "Fechar"
2549
+ children: [
2550
+ /* @__PURE__ */ jsx8(X, { className: "mr-1 h-3 w-3" }),
2551
+ "Fechar"
2552
+ ]
2253
2553
  }
2254
2554
  )
2255
2555
  ] }),
2256
- /* @__PURE__ */ jsx6("div", { className: "max-h-64 overflow-auto rounded-lg border font-mono text-sm", children: diffLines.map((line, i) => /* @__PURE__ */ jsxs5(
2556
+ /* @__PURE__ */ jsx8("div", { className: "max-h-64 overflow-auto rounded-lg border font-mono text-sm", children: diffLines.map((line, i) => /* @__PURE__ */ jsxs7(
2257
2557
  "div",
2258
2558
  {
2259
2559
  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" : ""}`,
2260
2560
  children: [
2261
- /* @__PURE__ */ jsx6("span", { className: "mr-2 inline-block w-4 select-none text-muted-foreground", children: line.type === "added" ? "+" : line.type === "removed" ? "-" : " " }),
2561
+ /* @__PURE__ */ jsx8("span", { className: "mr-2 inline-block w-4 select-none text-muted-foreground", children: line.type === "added" ? "+" : line.type === "removed" ? "-" : " " }),
2262
2562
  line.line || " "
2263
2563
  ]
2264
2564
  },
@@ -2266,57 +2566,57 @@ function AgentPromptEditor({ config, agent }) {
2266
2566
  )) })
2267
2567
  ] })
2268
2568
  ] }),
2269
- /* @__PURE__ */ jsxs5("div", { className: "w-full space-y-2 lg:w-80 lg:shrink-0", children: [
2270
- /* @__PURE__ */ jsx6("h3", { className: "text-sm font-medium text-muted-foreground", children: "Hist\xF3rico de Vers\xF5es" }),
2271
- sortedVersions.length === 0 ? /* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
2272
- /* @__PURE__ */ jsx6(FileText, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
2273
- /* @__PURE__ */ jsx6("p", { className: "text-sm text-muted-foreground", children: "Nenhuma vers\xE3o encontrada. Salve o prompt para criar a primeira vers\xE3o." })
2274
- ] }) : /* @__PURE__ */ jsx6("div", { className: "space-y-1", children: sortedVersions.map((version, idx) => {
2275
- const isCurrent = idx === 0;
2569
+ /* @__PURE__ */ jsxs7("div", { className: "w-full space-y-2 lg:w-80 lg:shrink-0", children: [
2570
+ /* @__PURE__ */ jsx8("h3", { className: "text-sm font-medium text-muted-foreground", children: "Hist\xF3rico de Vers\xF5es" }),
2571
+ sortedVersions.length === 0 ? /* @__PURE__ */ jsxs7("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
2572
+ /* @__PURE__ */ jsx8(FileText, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
2573
+ /* @__PURE__ */ jsx8("p", { className: "text-sm text-muted-foreground", children: "Nenhuma vers\xE3o encontrada." })
2574
+ ] }) : /* @__PURE__ */ jsx8("div", { className: "space-y-1", children: sortedVersions.map((version) => {
2575
+ const isCurrent = currentVersion?.id === version.id;
2276
2576
  const isComparing = version.id === compareVersionId;
2277
- return /* @__PURE__ */ jsxs5(
2577
+ return /* @__PURE__ */ jsxs7(
2278
2578
  "div",
2279
2579
  {
2280
2580
  className: `rounded-lg border p-3 transition-colors ${isCurrent ? "border-primary bg-primary/5" : isComparing ? "border-muted-foreground/30 bg-muted/50" : ""}`,
2281
2581
  children: [
2282
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-2", children: [
2283
- /* @__PURE__ */ jsxs5("span", { className: "text-sm font-medium", children: [
2582
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between gap-2", children: [
2583
+ /* @__PURE__ */ jsxs7("span", { className: "text-sm font-medium", children: [
2284
2584
  "v",
2285
2585
  version.version_number
2286
2586
  ] }),
2287
- isCurrent && /* @__PURE__ */ jsx6(Badge3, { variant: "default", className: "text-[10px] px-1.5 py-0", children: "Actual" })
2587
+ isCurrent && /* @__PURE__ */ jsx8(Badge3, { variant: "default", className: "text-[10px] px-1.5 py-0", children: "Actual" })
2288
2588
  ] }),
2289
- /* @__PURE__ */ jsx6("div", { className: "mt-1 text-xs text-muted-foreground", children: formatDate(version.datetime_add) }),
2290
- /* @__PURE__ */ jsxs5("div", { className: "mt-1 flex items-center gap-2 text-xs text-muted-foreground", children: [
2291
- /* @__PURE__ */ jsxs5("span", { children: [
2589
+ /* @__PURE__ */ jsx8("div", { className: "mt-1 text-xs text-muted-foreground", children: formatDate(version.datetime_add) }),
2590
+ /* @__PURE__ */ jsxs7("div", { className: "mt-1 flex items-center gap-2 text-xs text-muted-foreground", children: [
2591
+ /* @__PURE__ */ jsxs7("span", { children: [
2292
2592
  (version.prompt_content ?? "").length,
2293
2593
  " chars"
2294
2594
  ] }),
2295
- /* @__PURE__ */ jsx6("span", { children: "\xB7" }),
2296
- /* @__PURE__ */ jsx6("span", { className: "truncate font-mono", children: (version.prompt_hash ?? "").slice(0, 8) })
2595
+ /* @__PURE__ */ jsx8("span", { children: "\xB7" }),
2596
+ /* @__PURE__ */ jsx8("span", { className: "truncate font-mono", children: (version.prompt_hash ?? "").slice(0, 8) })
2297
2597
  ] }),
2298
- version.change_notes && /* @__PURE__ */ jsx6("div", { className: "mt-1.5 text-xs italic text-muted-foreground", children: version.change_notes }),
2299
- !isCurrent && /* @__PURE__ */ jsxs5("div", { className: "mt-2 flex items-center gap-3", children: [
2300
- /* @__PURE__ */ jsxs5(
2598
+ version.change_notes && /* @__PURE__ */ jsx8("div", { className: "mt-1.5 text-xs italic text-muted-foreground", children: version.change_notes }),
2599
+ !isCurrent && /* @__PURE__ */ jsxs7("div", { className: "mt-2 flex items-center gap-3", children: [
2600
+ /* @__PURE__ */ jsxs7(
2301
2601
  "button",
2302
2602
  {
2303
2603
  type: "button",
2304
2604
  onClick: () => setCompareVersionId(isComparing ? null : version.id),
2305
2605
  className: "flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",
2306
2606
  children: [
2307
- /* @__PURE__ */ jsx6(FileText, { "aria-hidden": "true", className: "h-3 w-3" }),
2607
+ /* @__PURE__ */ jsx8(FileText, { "aria-hidden": "true", className: "h-3 w-3" }),
2308
2608
  isComparing ? "Ocultar diff" : "Comparar"
2309
2609
  ]
2310
2610
  }
2311
2611
  ),
2312
- /* @__PURE__ */ jsxs5(
2612
+ /* @__PURE__ */ jsxs7(
2313
2613
  "button",
2314
2614
  {
2315
2615
  type: "button",
2316
2616
  onClick: () => handleRestore(version),
2317
2617
  className: "flex items-center gap-1 text-xs text-primary hover:underline",
2318
2618
  children: [
2319
- /* @__PURE__ */ jsx6(RotateCcw, { "aria-hidden": "true", className: "h-3 w-3" }),
2619
+ /* @__PURE__ */ jsx8(RotateCcw, { "aria-hidden": "true", className: "h-3 w-3" }),
2320
2620
  "Restaurar"
2321
2621
  ]
2322
2622
  }
@@ -2327,12 +2627,43 @@ function AgentPromptEditor({ config, agent }) {
2327
2627
  version.id
2328
2628
  );
2329
2629
  }) })
2330
- ] })
2630
+ ] }),
2631
+ /* @__PURE__ */ jsx8(
2632
+ Dialog4,
2633
+ {
2634
+ open: !!legacyModalVersion,
2635
+ onOpenChange: (open) => {
2636
+ if (!open) setLegacyModalVersion(null);
2637
+ },
2638
+ children: /* @__PURE__ */ jsxs7(DialogContent4, { className: "max-w-2xl", children: [
2639
+ /* @__PURE__ */ jsx8(DialogHeader4, { children: /* @__PURE__ */ jsxs7(DialogTitle4, { className: "flex items-center gap-2", children: [
2640
+ /* @__PURE__ */ jsx8(AlertTriangle, { className: "h-5 w-5 text-amber-500" }),
2641
+ "Vers\xE3o Legada \u2014 v",
2642
+ legacyModalVersion?.version_number
2643
+ ] }) }),
2644
+ /* @__PURE__ */ jsxs7("div", { className: "space-y-3", children: [
2645
+ /* @__PURE__ */ jsx8("div", { className: "rounded-lg border border-amber-500/30 bg-amber-500/5 p-3", children: /* @__PURE__ */ jsx8("p", { className: "text-sm text-amber-700 dark:text-amber-400", children: "Esta vers\xE3o foi criada antes da reestrutura\xE7\xE3o e n\xE3o pode ser restaurada nos campos estruturados." }) }),
2646
+ /* @__PURE__ */ jsx8("div", { className: "max-h-96 overflow-auto rounded-lg border p-4", children: /* @__PURE__ */ jsx8("pre", { className: "whitespace-pre-wrap font-mono text-sm leading-relaxed", children: legacyModalVersion?.prompt_content ?? "" }) }),
2647
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-3 text-xs text-muted-foreground", children: [
2648
+ /* @__PURE__ */ jsxs7("span", { children: [
2649
+ (legacyModalVersion?.prompt_content ?? "").length.toLocaleString("pt-BR"),
2650
+ " caracteres"
2651
+ ] }),
2652
+ legacyModalVersion?.change_notes && /* @__PURE__ */ jsxs7(Fragment2, { children: [
2653
+ /* @__PURE__ */ jsx8("span", { children: "\xB7" }),
2654
+ /* @__PURE__ */ jsx8("span", { className: "italic", children: legacyModalVersion.change_notes })
2655
+ ] })
2656
+ ] })
2657
+ ] }),
2658
+ /* @__PURE__ */ jsx8("div", { className: "flex justify-end pt-2", children: /* @__PURE__ */ jsx8(Button7, { variant: "outline", onClick: () => setLegacyModalVersion(null), children: "Fechar" }) })
2659
+ ] })
2660
+ }
2661
+ )
2331
2662
  ] });
2332
2663
  }
2333
2664
 
2334
2665
  // src/components/conversations/agent-conversations-table.tsx
2335
- import { useState as useState7 } from "react";
2666
+ import { useState as useState9 } from "react";
2336
2667
  import {
2337
2668
  Table,
2338
2669
  TableBody,
@@ -2346,9 +2677,9 @@ import {
2346
2677
  import { MessageCircle, ExternalLink } from "lucide-react";
2347
2678
 
2348
2679
  // src/components/conversations/conversation-view.tsx
2349
- import { Skeleton as Skeleton3, Button as Button6 } from "@greatapps/greatauth-ui/ui";
2350
- import { X, MessageSquare } from "lucide-react";
2351
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
2680
+ import { Skeleton as Skeleton3, Button as Button8 } from "@greatapps/greatauth-ui/ui";
2681
+ import { X as X2, MessageSquare } from "lucide-react";
2682
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
2352
2683
  function formatDateTime(dateStr) {
2353
2684
  if (!dateStr) return "\u2014";
2354
2685
  return new Date(dateStr).toLocaleString("pt-BR");
@@ -2362,68 +2693,68 @@ function ConversationView({
2362
2693
  }) {
2363
2694
  const { data: conversation, isLoading } = useConversation(config, conversationId);
2364
2695
  if (isLoading) {
2365
- return /* @__PURE__ */ jsxs6("div", { className: "rounded-lg border bg-card p-4 space-y-3", children: [
2366
- /* @__PURE__ */ jsx7(Skeleton3, { className: "h-6 w-48" }),
2367
- /* @__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)) })
2696
+ return /* @__PURE__ */ jsxs8("div", { className: "rounded-lg border bg-card p-4 space-y-3", children: [
2697
+ /* @__PURE__ */ jsx9(Skeleton3, { className: "h-6 w-48" }),
2698
+ /* @__PURE__ */ jsx9("div", { className: "grid grid-cols-2 gap-3", children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx9(Skeleton3, { className: "h-10 w-full" }, i)) })
2368
2699
  ] });
2369
2700
  }
2370
2701
  if (!conversation) {
2371
- return /* @__PURE__ */ jsx7("div", { className: "rounded-lg border bg-card p-4", children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between", children: [
2372
- /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "Conversa n\xE3o encontrada." }),
2373
- /* @__PURE__ */ jsx7(Button6, { variant: "ghost", size: "icon", "aria-label": "Fechar", onClick: onClose, children: /* @__PURE__ */ jsx7(X, { className: "h-4 w-4" }) })
2702
+ return /* @__PURE__ */ jsx9("div", { className: "rounded-lg border bg-card p-4", children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between", children: [
2703
+ /* @__PURE__ */ jsx9("p", { className: "text-sm text-muted-foreground", children: "Conversa n\xE3o encontrada." }),
2704
+ /* @__PURE__ */ jsx9(Button8, { variant: "ghost", size: "icon", "aria-label": "Fechar", onClick: onClose, children: /* @__PURE__ */ jsx9(X2, { className: "h-4 w-4" }) })
2374
2705
  ] }) });
2375
2706
  }
2376
- return /* @__PURE__ */ jsxs6("div", { className: "rounded-lg border bg-card p-4 space-y-4", children: [
2377
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between", children: [
2378
- /* @__PURE__ */ jsxs6("h3", { className: "font-semibold", children: [
2707
+ return /* @__PURE__ */ jsxs8("div", { className: "rounded-lg border bg-card p-4 space-y-4", children: [
2708
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between", children: [
2709
+ /* @__PURE__ */ jsxs8("h3", { className: "font-semibold", children: [
2379
2710
  "Detalhes da conversa #",
2380
2711
  conversation.id
2381
2712
  ] }),
2382
- /* @__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" }) }) })
2713
+ /* @__PURE__ */ jsx9("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsx9(Button8, { variant: "ghost", size: "icon", "aria-label": "Fechar", onClick: onClose, children: /* @__PURE__ */ jsx9(X2, { className: "h-4 w-4" }) }) })
2383
2714
  ] }),
2384
- 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: [
2385
- /* @__PURE__ */ jsx7(MessageSquare, { className: "mr-2 h-4 w-4" }),
2715
+ conversation.id_external ? renderChatLink ? renderChatLink(conversation.id_external) : /* @__PURE__ */ jsx9(Button8, { variant: "outline", size: "sm", asChild: true, children: /* @__PURE__ */ jsxs8("a", { href: `/gchat/inbox/${conversation.id_external}`, children: [
2716
+ /* @__PURE__ */ jsx9(MessageSquare, { className: "mr-2 h-4 w-4" }),
2386
2717
  "Ver no Chat"
2387
2718
  ] }) }) : null,
2388
- /* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-2 gap-x-6 gap-y-3 text-sm", children: [
2389
- /* @__PURE__ */ jsxs6("div", { children: [
2390
- /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Thread ID" }),
2391
- /* @__PURE__ */ jsx7("p", { className: "font-mono text-xs mt-0.5", children: conversation.openai_thread_id || "\u2014" })
2719
+ /* @__PURE__ */ jsxs8("div", { className: "grid grid-cols-2 gap-x-6 gap-y-3 text-sm", children: [
2720
+ /* @__PURE__ */ jsxs8("div", { children: [
2721
+ /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: "Thread ID" }),
2722
+ /* @__PURE__ */ jsx9("p", { className: "font-mono text-xs mt-0.5", children: conversation.openai_thread_id || "\u2014" })
2392
2723
  ] }),
2393
- /* @__PURE__ */ jsxs6("div", { children: [
2394
- /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Contato" }),
2395
- /* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: contactsMap?.get(conversation.id_contact) ?? conversation.id_contact })
2724
+ /* @__PURE__ */ jsxs8("div", { children: [
2725
+ /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: "Contato" }),
2726
+ /* @__PURE__ */ jsx9("p", { className: "mt-0.5", children: contactsMap?.get(conversation.id_contact) ?? conversation.id_contact })
2396
2727
  ] }),
2397
- /* @__PURE__ */ jsxs6("div", { children: [
2398
- /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Agente" }),
2399
- /* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: conversation.id_agent ?? "\u2014" })
2728
+ /* @__PURE__ */ jsxs8("div", { children: [
2729
+ /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: "Agente" }),
2730
+ /* @__PURE__ */ jsx9("p", { className: "mt-0.5", children: conversation.id_agent ?? "\u2014" })
2400
2731
  ] }),
2401
- /* @__PURE__ */ jsxs6("div", { children: [
2402
- /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Mensagens" }),
2403
- /* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: conversation.message_count ?? "\u2014" })
2732
+ /* @__PURE__ */ jsxs8("div", { children: [
2733
+ /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: "Mensagens" }),
2734
+ /* @__PURE__ */ jsx9("p", { className: "mt-0.5", children: conversation.message_count ?? "\u2014" })
2404
2735
  ] }),
2405
- /* @__PURE__ */ jsxs6("div", { children: [
2406
- /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Tokens" }),
2407
- /* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: conversation.usage_tokens ?? "\u2014" })
2736
+ /* @__PURE__ */ jsxs8("div", { children: [
2737
+ /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: "Tokens" }),
2738
+ /* @__PURE__ */ jsx9("p", { className: "mt-0.5", children: conversation.usage_tokens ?? "\u2014" })
2408
2739
  ] }),
2409
- /* @__PURE__ */ jsxs6("div", { children: [
2410
- /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Rota\xE7\xF5es de Thread" }),
2411
- /* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: conversation.rotation_count ?? "\u2014" })
2740
+ /* @__PURE__ */ jsxs8("div", { children: [
2741
+ /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: "Rota\xE7\xF5es de Thread" }),
2742
+ /* @__PURE__ */ jsx9("p", { className: "mt-0.5", children: conversation.rotation_count ?? "\u2014" })
2412
2743
  ] }),
2413
- /* @__PURE__ */ jsxs6("div", { children: [
2414
- /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Criado em" }),
2415
- /* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: formatDateTime(conversation.datetime_add) })
2744
+ /* @__PURE__ */ jsxs8("div", { children: [
2745
+ /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: "Criado em" }),
2746
+ /* @__PURE__ */ jsx9("p", { className: "mt-0.5", children: formatDateTime(conversation.datetime_add) })
2416
2747
  ] }),
2417
- /* @__PURE__ */ jsxs6("div", { children: [
2418
- /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Atualizado em" }),
2419
- /* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: formatDateTime(conversation.datetime_alt) })
2748
+ /* @__PURE__ */ jsxs8("div", { children: [
2749
+ /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: "Atualizado em" }),
2750
+ /* @__PURE__ */ jsx9("p", { className: "mt-0.5", children: formatDateTime(conversation.datetime_alt) })
2420
2751
  ] })
2421
2752
  ] })
2422
2753
  ] });
2423
2754
  }
2424
2755
 
2425
2756
  // src/components/conversations/agent-conversations-table.tsx
2426
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
2757
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
2427
2758
  function formatRelativeDate(dateStr) {
2428
2759
  if (!dateStr) return "\u2014";
2429
2760
  const date = new Date(dateStr);
@@ -2446,29 +2777,29 @@ function AgentConversationsTable({
2446
2777
  config,
2447
2778
  renderChatLink
2448
2779
  }) {
2449
- const [selectedId, setSelectedId] = useState7(null);
2780
+ const [selectedId, setSelectedId] = useState9(null);
2450
2781
  if (isLoading) {
2451
- return /* @__PURE__ */ jsx8("div", { className: "space-y-3", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx8(Skeleton4, { className: "h-12 w-full" }, i)) });
2782
+ return /* @__PURE__ */ jsx10("div", { className: "space-y-3", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx10(Skeleton4, { className: "h-12 w-full" }, i)) });
2452
2783
  }
2453
2784
  if (conversations.length === 0) {
2454
- return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
2455
- /* @__PURE__ */ jsx8(MessageCircle, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
2456
- /* @__PURE__ */ jsx8("p", { className: "text-sm text-muted-foreground", children: "Nenhuma conversa encontrada." })
2785
+ return /* @__PURE__ */ jsxs9("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
2786
+ /* @__PURE__ */ jsx10(MessageCircle, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
2787
+ /* @__PURE__ */ jsx10("p", { className: "text-sm text-muted-foreground", children: "Nenhuma conversa encontrada." })
2457
2788
  ] });
2458
2789
  }
2459
- return /* @__PURE__ */ jsxs7("div", { className: "space-y-4", children: [
2460
- /* @__PURE__ */ jsxs7(Table, { children: [
2461
- /* @__PURE__ */ jsx8(TableHeader, { children: /* @__PURE__ */ jsxs7(TableRow, { children: [
2462
- /* @__PURE__ */ jsx8(TableHead, { children: "ID" }),
2463
- /* @__PURE__ */ jsx8(TableHead, { children: "Contato" }),
2464
- /* @__PURE__ */ jsx8(TableHead, { children: "Objetivo" }),
2465
- /* @__PURE__ */ jsx8(TableHead, { className: "text-right", children: "Mensagens" }),
2466
- /* @__PURE__ */ jsx8(TableHead, { className: "text-right", children: "Tokens" }),
2467
- /* @__PURE__ */ jsx8(TableHead, { children: "Criado em" }),
2468
- /* @__PURE__ */ jsx8(TableHead, { children: "Atualizado em" }),
2469
- /* @__PURE__ */ jsx8(TableHead, { className: "w-10" })
2790
+ return /* @__PURE__ */ jsxs9("div", { className: "space-y-4", children: [
2791
+ /* @__PURE__ */ jsxs9(Table, { children: [
2792
+ /* @__PURE__ */ jsx10(TableHeader, { children: /* @__PURE__ */ jsxs9(TableRow, { children: [
2793
+ /* @__PURE__ */ jsx10(TableHead, { children: "ID" }),
2794
+ /* @__PURE__ */ jsx10(TableHead, { children: "Contato" }),
2795
+ /* @__PURE__ */ jsx10(TableHead, { children: "Objetivo" }),
2796
+ /* @__PURE__ */ jsx10(TableHead, { className: "text-right", children: "Mensagens" }),
2797
+ /* @__PURE__ */ jsx10(TableHead, { className: "text-right", children: "Tokens" }),
2798
+ /* @__PURE__ */ jsx10(TableHead, { children: "Criado em" }),
2799
+ /* @__PURE__ */ jsx10(TableHead, { children: "Atualizado em" }),
2800
+ /* @__PURE__ */ jsx10(TableHead, { className: "w-10" })
2470
2801
  ] }) }),
2471
- /* @__PURE__ */ jsx8(TableBody, { children: conversations.map((conversation) => /* @__PURE__ */ jsxs7(
2802
+ /* @__PURE__ */ jsx10(TableBody, { children: conversations.map((conversation) => /* @__PURE__ */ jsxs9(
2472
2803
  TableRow,
2473
2804
  {
2474
2805
  className: "cursor-pointer",
@@ -2487,14 +2818,14 @@ function AgentConversationsTable({
2487
2818
  },
2488
2819
  "data-state": selectedId === conversation.id ? "selected" : void 0,
2489
2820
  children: [
2490
- /* @__PURE__ */ jsx8(TableCell, { className: "font-mono text-xs", children: conversation.id }),
2491
- /* @__PURE__ */ jsx8(TableCell, { children: contactsMap?.get(conversation.id_contact) ?? conversation.id_contact }),
2492
- /* @__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" }) }),
2493
- /* @__PURE__ */ jsx8(TableCell, { className: "text-right tabular-nums", children: conversation.message_count ?? "\u2014" }),
2494
- /* @__PURE__ */ jsx8(TableCell, { className: "text-right tabular-nums", children: conversation.usage_tokens ?? "\u2014" }),
2495
- /* @__PURE__ */ jsx8(TableCell, { children: new Date(conversation.datetime_add).toLocaleDateString("pt-BR") }),
2496
- /* @__PURE__ */ jsx8(TableCell, { children: formatRelativeDate(conversation.datetime_alt) }),
2497
- /* @__PURE__ */ jsx8(TableCell, { children: conversation.id_external ? renderChatLink ? /* @__PURE__ */ jsx8("span", { onClick: (e) => e.stopPropagation(), children: renderChatLink(conversation.id_external) }) : /* @__PURE__ */ jsx8(
2821
+ /* @__PURE__ */ jsx10(TableCell, { className: "font-mono text-xs", children: conversation.id }),
2822
+ /* @__PURE__ */ jsx10(TableCell, { children: contactsMap?.get(conversation.id_contact) ?? conversation.id_contact }),
2823
+ /* @__PURE__ */ jsx10(TableCell, { children: conversation.id_objective && objectivesMap?.get(conversation.id_objective) ? /* @__PURE__ */ jsx10(Badge4, { variant: "secondary", className: "text-xs", children: objectivesMap.get(conversation.id_objective) }) : /* @__PURE__ */ jsx10("span", { className: "text-xs text-muted-foreground", children: "\u2014" }) }),
2824
+ /* @__PURE__ */ jsx10(TableCell, { className: "text-right tabular-nums", children: conversation.message_count ?? "\u2014" }),
2825
+ /* @__PURE__ */ jsx10(TableCell, { className: "text-right tabular-nums", children: conversation.usage_tokens ?? "\u2014" }),
2826
+ /* @__PURE__ */ jsx10(TableCell, { children: new Date(conversation.datetime_add).toLocaleDateString("pt-BR") }),
2827
+ /* @__PURE__ */ jsx10(TableCell, { children: formatRelativeDate(conversation.datetime_alt) }),
2828
+ /* @__PURE__ */ jsx10(TableCell, { children: conversation.id_external ? renderChatLink ? /* @__PURE__ */ jsx10("span", { onClick: (e) => e.stopPropagation(), children: renderChatLink(conversation.id_external) }) : /* @__PURE__ */ jsx10(
2498
2829
  "a",
2499
2830
  {
2500
2831
  href: `/gchat/inbox/${conversation.id_external}`,
@@ -2502,7 +2833,7 @@ function AgentConversationsTable({
2502
2833
  "aria-label": "Ver no Chat",
2503
2834
  onClick: (e) => e.stopPropagation(),
2504
2835
  className: "inline-flex items-center justify-center rounded-md p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",
2505
- children: /* @__PURE__ */ jsx8(ExternalLink, { className: "h-4 w-4" })
2836
+ children: /* @__PURE__ */ jsx10(ExternalLink, { className: "h-4 w-4" })
2506
2837
  }
2507
2838
  ) : null })
2508
2839
  ]
@@ -2510,7 +2841,7 @@ function AgentConversationsTable({
2510
2841
  conversation.id
2511
2842
  )) })
2512
2843
  ] }),
2513
- selectedId && /* @__PURE__ */ jsx8(
2844
+ selectedId && /* @__PURE__ */ jsx10(
2514
2845
  ConversationView,
2515
2846
  {
2516
2847
  conversationId: selectedId,
@@ -2524,7 +2855,7 @@ function AgentConversationsTable({
2524
2855
  }
2525
2856
 
2526
2857
  // src/components/conversations/agent-conversations-panel.tsx
2527
- import { jsx as jsx9 } from "react/jsx-runtime";
2858
+ import { jsx as jsx11 } from "react/jsx-runtime";
2528
2859
  function AgentConversationsPanel({
2529
2860
  agent,
2530
2861
  config,
@@ -2543,7 +2874,7 @@ function AgentConversationsPanel({
2543
2874
  const objectivesMap = new Map(
2544
2875
  (objectivesData?.data || []).map((o) => [o.id, o.title])
2545
2876
  );
2546
- return /* @__PURE__ */ jsx9("div", { className: "p-4", children: /* @__PURE__ */ jsx9(
2877
+ return /* @__PURE__ */ jsx11("div", { className: "p-4", children: /* @__PURE__ */ jsx11(
2547
2878
  AgentConversationsTable,
2548
2879
  {
2549
2880
  conversations,
@@ -2557,7 +2888,7 @@ function AgentConversationsPanel({
2557
2888
  }
2558
2889
 
2559
2890
  // src/components/capabilities/capabilities-tab.tsx
2560
- import { useState as useState8, useCallback as useCallback4, useEffect as useEffect4, useMemo as useMemo5 } from "react";
2891
+ import { useState as useState10, useCallback as useCallback5, useEffect as useEffect4, useMemo as useMemo6 } from "react";
2561
2892
  import {
2562
2893
  Accordion,
2563
2894
  AccordionItem,
@@ -2566,7 +2897,7 @@ import {
2566
2897
  Switch as Switch4,
2567
2898
  Checkbox,
2568
2899
  Badge as Badge5,
2569
- Button as Button7,
2900
+ Button as Button9,
2570
2901
  Skeleton as Skeleton5
2571
2902
  } from "@greatapps/greatauth-ui/ui";
2572
2903
  import {
@@ -2575,12 +2906,12 @@ import {
2575
2906
  Settings,
2576
2907
  HeartHandshake,
2577
2908
  Package,
2578
- ChevronDown as ChevronDown2,
2909
+ ChevronDown,
2579
2910
  Loader2 as Loader24,
2580
2911
  Pencil as Pencil3
2581
2912
  } from "lucide-react";
2582
- import { toast as toast6 } from "sonner";
2583
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
2913
+ import { toast as toast7 } from "sonner";
2914
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2584
2915
  var OPERATION_LABELS = {
2585
2916
  list: "Buscar",
2586
2917
  view: "Visualizar",
@@ -2701,11 +3032,11 @@ function CapabilitiesTab({ config, agentId }) {
2701
3032
  const { data: registry, isLoading: isLoadingRegistry } = useCapabilities(config);
2702
3033
  const { data: agentCaps, isLoading: isLoadingAgent } = useAgentCapabilities(config, agentId);
2703
3034
  const updateMutation = useUpdateAgentCapabilities(config);
2704
- const [localState, setLocalState] = useState8(/* @__PURE__ */ new Map());
2705
- const [serverState, setServerState] = useState8(/* @__PURE__ */ new Map());
2706
- const [localInstructions, setLocalInstructions] = useState8(/* @__PURE__ */ new Map());
2707
- const [serverInstructions, setServerInstructions] = useState8(/* @__PURE__ */ new Map());
2708
- const [initialized, setInitialized] = useState8(false);
3035
+ const [localState, setLocalState] = useState10(/* @__PURE__ */ new Map());
3036
+ const [serverState, setServerState] = useState10(/* @__PURE__ */ new Map());
3037
+ const [localInstructions, setLocalInstructions] = useState10(/* @__PURE__ */ new Map());
3038
+ const [serverInstructions, setServerInstructions] = useState10(/* @__PURE__ */ new Map());
3039
+ const [initialized, setInitialized] = useState10(false);
2709
3040
  useEffect4(() => {
2710
3041
  if (agentCaps && !initialized) {
2711
3042
  const state = buildStateFromAgent(agentCaps);
@@ -2720,17 +3051,17 @@ function CapabilitiesTab({ config, agentId }) {
2720
3051
  useEffect4(() => {
2721
3052
  setInitialized(false);
2722
3053
  }, [agentId]);
2723
- const hasChanges = useMemo5(
3054
+ const hasChanges = useMemo6(
2724
3055
  () => initialized && (!statesEqual(localState, serverState) || !instructionsEqual(localInstructions, serverInstructions, localState)),
2725
3056
  [localState, serverState, localInstructions, serverInstructions, initialized]
2726
3057
  );
2727
- const updateState = useCallback4(
3058
+ const updateState = useCallback5(
2728
3059
  (updater) => {
2729
3060
  setLocalState((prev) => updater(prev));
2730
3061
  },
2731
3062
  []
2732
3063
  );
2733
- const toggleModule = useCallback4(
3064
+ const toggleModule = useCallback5(
2734
3065
  (mod, enabled) => {
2735
3066
  updateState((prev) => {
2736
3067
  const next = cloneState(prev);
@@ -2744,7 +3075,7 @@ function CapabilitiesTab({ config, agentId }) {
2744
3075
  },
2745
3076
  [updateState]
2746
3077
  );
2747
- const toggleOperation = useCallback4(
3078
+ const toggleOperation = useCallback5(
2748
3079
  (mod, opSlug, enabled) => {
2749
3080
  updateState((prev) => {
2750
3081
  const next = cloneState(prev);
@@ -2764,7 +3095,7 @@ function CapabilitiesTab({ config, agentId }) {
2764
3095
  },
2765
3096
  [updateState]
2766
3097
  );
2767
- const updateOperationInstruction = useCallback4(
3098
+ const updateOperationInstruction = useCallback5(
2768
3099
  (moduleSlug, opSlug, instruction) => {
2769
3100
  setLocalInstructions((prev) => {
2770
3101
  const next = cloneInstructions(prev);
@@ -2776,7 +3107,7 @@ function CapabilitiesTab({ config, agentId }) {
2776
3107
  },
2777
3108
  []
2778
3109
  );
2779
- const enableAll = useCallback4(() => {
3110
+ const enableAll = useCallback5(() => {
2780
3111
  if (!registry) return;
2781
3112
  updateState(() => {
2782
3113
  const next = /* @__PURE__ */ new Map();
@@ -2788,14 +3119,14 @@ function CapabilitiesTab({ config, agentId }) {
2788
3119
  return next;
2789
3120
  });
2790
3121
  }, [registry, updateState]);
2791
- const disableAll = useCallback4(() => {
3122
+ const disableAll = useCallback5(() => {
2792
3123
  updateState(() => /* @__PURE__ */ new Map());
2793
3124
  }, [updateState]);
2794
- const discard = useCallback4(() => {
3125
+ const discard = useCallback5(() => {
2795
3126
  setLocalState(cloneState(serverState));
2796
3127
  setLocalInstructions(cloneInstructions(serverInstructions));
2797
3128
  }, [serverState, serverInstructions]);
2798
- const saveNow = useCallback4(() => {
3129
+ const saveNow = useCallback5(() => {
2799
3130
  const payload = stateToPayload(localState, localInstructions);
2800
3131
  updateMutation.mutate(
2801
3132
  { agentId, payload },
@@ -2803,12 +3134,12 @@ function CapabilitiesTab({ config, agentId }) {
2803
3134
  onSuccess: () => {
2804
3135
  setServerState(cloneState(localState));
2805
3136
  setServerInstructions(cloneInstructions(localInstructions));
2806
- toast6.success("Capacidades salvas");
3137
+ toast7.success("Capacidades salvas");
2807
3138
  },
2808
3139
  onError: () => {
2809
3140
  setLocalState(cloneState(serverState));
2810
3141
  setLocalInstructions(cloneInstructions(serverInstructions));
2811
- toast6.error("Erro ao salvar capacidades");
3142
+ toast7.error("Erro ao salvar capacidades");
2812
3143
  }
2813
3144
  }
2814
3145
  );
@@ -2817,52 +3148,52 @@ function CapabilitiesTab({ config, agentId }) {
2817
3148
  return cat.modules.filter((m) => (localState.get(m.slug)?.size ?? 0) > 0).length;
2818
3149
  }
2819
3150
  if (isLoadingRegistry || isLoadingAgent) {
2820
- return /* @__PURE__ */ jsx10("div", { className: "space-y-3", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsx10(Skeleton5, { className: "h-14 w-full" }, i)) });
3151
+ return /* @__PURE__ */ jsx12("div", { className: "space-y-3", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsx12(Skeleton5, { className: "h-14 w-full" }, i)) });
2821
3152
  }
2822
3153
  if (!registry || !registry.categories.length) {
2823
- return /* @__PURE__ */ jsxs8("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [
2824
- /* @__PURE__ */ jsx10(Package, { className: "h-12 w-12 text-muted-foreground mb-3" }),
2825
- /* @__PURE__ */ jsx10("h3", { className: "text-base font-medium", children: "Nenhuma capacidade dispon\xEDvel" }),
2826
- /* @__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." })
3154
+ return /* @__PURE__ */ jsxs10("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [
3155
+ /* @__PURE__ */ jsx12(Package, { className: "h-12 w-12 text-muted-foreground mb-3" }),
3156
+ /* @__PURE__ */ jsx12("h3", { className: "text-base font-medium", children: "Nenhuma capacidade dispon\xEDvel" }),
3157
+ /* @__PURE__ */ jsx12("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." })
2827
3158
  ] });
2828
3159
  }
2829
- return /* @__PURE__ */ jsxs8("div", { className: "space-y-4", children: [
2830
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between", children: [
2831
- /* @__PURE__ */ jsxs8("div", { children: [
2832
- /* @__PURE__ */ jsx10("h3", { className: "text-sm font-medium", children: "Capacidades do agente" }),
2833
- /* @__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." })
3160
+ return /* @__PURE__ */ jsxs10("div", { className: "space-y-4", children: [
3161
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
3162
+ /* @__PURE__ */ jsxs10("div", { children: [
3163
+ /* @__PURE__ */ jsx12("h3", { className: "text-sm font-medium", children: "Capacidades do agente" }),
3164
+ /* @__PURE__ */ jsx12("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." })
2834
3165
  ] }),
2835
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
2836
- /* @__PURE__ */ jsx10(Button7, { variant: "outline", size: "sm", onClick: enableAll, children: "Ativar tudo" }),
2837
- /* @__PURE__ */ jsx10(Button7, { variant: "outline", size: "sm", onClick: disableAll, children: "Desativar tudo" })
3166
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
3167
+ /* @__PURE__ */ jsx12(Button9, { variant: "outline", size: "sm", onClick: enableAll, children: "Ativar tudo" }),
3168
+ /* @__PURE__ */ jsx12(Button9, { variant: "outline", size: "sm", onClick: disableAll, children: "Desativar tudo" })
2838
3169
  ] })
2839
3170
  ] }),
2840
- /* @__PURE__ */ jsx10(Accordion, { type: "multiple", className: "space-y-2", children: registry.categories.map((cat) => {
3171
+ /* @__PURE__ */ jsx12(Accordion, { type: "multiple", className: "space-y-2", children: registry.categories.map((cat) => {
2841
3172
  const Icon = getCategoryIcon(cat.slug);
2842
3173
  const activeCount = countActiveModules(cat);
2843
3174
  const totalModules = cat.modules.length;
2844
- return /* @__PURE__ */ jsxs8(
3175
+ return /* @__PURE__ */ jsxs10(
2845
3176
  AccordionItem,
2846
3177
  {
2847
3178
  value: cat.slug,
2848
3179
  className: "border rounded-lg px-4",
2849
3180
  children: [
2850
- /* @__PURE__ */ jsx10(AccordionTrigger, { className: "hover:no-underline py-3", children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3 flex-1", children: [
2851
- /* @__PURE__ */ jsx10(Icon, { className: "h-4 w-4 text-muted-foreground" }),
2852
- /* @__PURE__ */ jsx10("span", { className: "font-medium text-sm", children: cat.label }),
2853
- /* @__PURE__ */ jsxs8(Badge5, { variant: "secondary", className: "text-xs", children: [
3181
+ /* @__PURE__ */ jsx12(AccordionTrigger, { className: "hover:no-underline py-3", children: /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-3 flex-1", children: [
3182
+ /* @__PURE__ */ jsx12(Icon, { className: "h-4 w-4 text-muted-foreground" }),
3183
+ /* @__PURE__ */ jsx12("span", { className: "font-medium text-sm", children: cat.label }),
3184
+ /* @__PURE__ */ jsxs10(Badge5, { variant: "secondary", className: "text-xs", children: [
2854
3185
  activeCount,
2855
3186
  " de ",
2856
3187
  totalModules,
2857
3188
  " m\xF3dulos ativos"
2858
3189
  ] })
2859
3190
  ] }) }),
2860
- /* @__PURE__ */ jsx10(AccordionContent, { className: "pb-3 !h-auto", children: /* @__PURE__ */ jsx10("div", { className: "space-y-1", children: cat.modules.map((mod) => {
3191
+ /* @__PURE__ */ jsx12(AccordionContent, { className: "pb-3 !h-auto", children: /* @__PURE__ */ jsx12("div", { className: "space-y-1", children: cat.modules.map((mod) => {
2861
3192
  const enabledOps = localState.get(mod.slug);
2862
3193
  const isModuleOn = (enabledOps?.size ?? 0) > 0;
2863
3194
  const allOpsEnabled = enabledOps?.size === mod.operations.length;
2864
3195
  const modInstructions = localInstructions.get(mod.slug) ?? {};
2865
- return /* @__PURE__ */ jsx10(
3196
+ return /* @__PURE__ */ jsx12(
2866
3197
  ModuleRow,
2867
3198
  {
2868
3199
  module: mod,
@@ -2882,12 +3213,12 @@ function CapabilitiesTab({ config, agentId }) {
2882
3213
  cat.slug
2883
3214
  );
2884
3215
  }) }),
2885
- hasChanges && /* @__PURE__ */ jsxs8("div", { className: "sticky bottom-0 z-10 flex items-center justify-between gap-2 rounded-lg border bg-background p-3 shadow-sm", children: [
2886
- /* @__PURE__ */ jsx10("p", { className: "text-sm text-muted-foreground", children: "Voc\xEA tem altera\xE7\xF5es n\xE3o salvas." }),
2887
- /* @__PURE__ */ jsxs8("div", { className: "flex gap-2", children: [
2888
- /* @__PURE__ */ jsx10(Button7, { variant: "ghost", size: "sm", onClick: discard, disabled: updateMutation.isPending, children: "Descartar" }),
2889
- /* @__PURE__ */ jsxs8(Button7, { size: "sm", onClick: saveNow, disabled: updateMutation.isPending, children: [
2890
- updateMutation.isPending && /* @__PURE__ */ jsx10(Loader24, { className: "mr-2 h-4 w-4 animate-spin" }),
3216
+ hasChanges && /* @__PURE__ */ jsxs10("div", { className: "sticky bottom-0 z-10 flex items-center justify-between gap-2 rounded-lg border bg-background p-3 shadow-sm", children: [
3217
+ /* @__PURE__ */ jsx12("p", { className: "text-sm text-muted-foreground", children: "Voc\xEA tem altera\xE7\xF5es n\xE3o salvas." }),
3218
+ /* @__PURE__ */ jsxs10("div", { className: "flex gap-2", children: [
3219
+ /* @__PURE__ */ jsx12(Button9, { variant: "ghost", size: "sm", onClick: discard, disabled: updateMutation.isPending, children: "Descartar" }),
3220
+ /* @__PURE__ */ jsxs10(Button9, { size: "sm", onClick: saveNow, disabled: updateMutation.isPending, children: [
3221
+ updateMutation.isPending && /* @__PURE__ */ jsx12(Loader24, { className: "mr-2 h-4 w-4 animate-spin" }),
2891
3222
  "Salvar"
2892
3223
  ] })
2893
3224
  ] })
@@ -2903,11 +3234,11 @@ function ModuleRow({
2903
3234
  onToggleOperation,
2904
3235
  onUpdateInstruction
2905
3236
  }) {
2906
- const [expanded, setExpanded] = useState8(false);
2907
- const [editingOp, setEditingOp] = useState8(null);
2908
- return /* @__PURE__ */ jsxs8("div", { className: "rounded-md border px-3 py-2", children: [
2909
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between", children: [
2910
- /* @__PURE__ */ jsxs8(
3237
+ const [expanded, setExpanded] = useState10(false);
3238
+ const [editingOp, setEditingOp] = useState10(null);
3239
+ return /* @__PURE__ */ jsxs10("div", { className: "rounded-md border px-3 py-2", children: [
3240
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
3241
+ /* @__PURE__ */ jsxs10(
2911
3242
  "button",
2912
3243
  {
2913
3244
  type: "button",
@@ -2916,18 +3247,18 @@ function ModuleRow({
2916
3247
  "aria-expanded": expanded,
2917
3248
  "aria-label": `Expandir ${mod.label}`,
2918
3249
  children: [
2919
- /* @__PURE__ */ jsx10(
2920
- ChevronDown2,
3250
+ /* @__PURE__ */ jsx12(
3251
+ ChevronDown,
2921
3252
  {
2922
3253
  className: `h-3.5 w-3.5 text-muted-foreground transition-transform ${expanded ? "rotate-0" : "-rotate-90"}`
2923
3254
  }
2924
3255
  ),
2925
- /* @__PURE__ */ jsx10("span", { className: "text-sm font-medium", children: mod.label }),
2926
- mod.description && /* @__PURE__ */ jsxs8("span", { className: "text-xs text-muted-foreground hidden sm:inline", children: [
3256
+ /* @__PURE__ */ jsx12("span", { className: "text-sm font-medium", children: mod.label }),
3257
+ mod.description && /* @__PURE__ */ jsxs10("span", { className: "text-xs text-muted-foreground hidden sm:inline", children: [
2927
3258
  "\u2014 ",
2928
3259
  mod.description
2929
3260
  ] }),
2930
- isOn && /* @__PURE__ */ jsxs8(Badge5, { variant: "secondary", className: "text-xs ml-1", children: [
3261
+ isOn && /* @__PURE__ */ jsxs10(Badge5, { variant: "secondary", className: "text-xs ml-1", children: [
2931
3262
  enabledOps.size,
2932
3263
  "/",
2933
3264
  mod.operations.length
@@ -2935,7 +3266,7 @@ function ModuleRow({
2935
3266
  ]
2936
3267
  }
2937
3268
  ),
2938
- /* @__PURE__ */ jsx10(
3269
+ /* @__PURE__ */ jsx12(
2939
3270
  Switch4,
2940
3271
  {
2941
3272
  checked: isOn,
@@ -2944,14 +3275,14 @@ function ModuleRow({
2944
3275
  }
2945
3276
  )
2946
3277
  ] }),
2947
- expanded && /* @__PURE__ */ jsx10("div", { className: "mt-2 ml-6 space-y-1.5 pb-1", children: mod.operations.map((op) => {
3278
+ expanded && /* @__PURE__ */ jsx12("div", { className: "mt-2 ml-6 space-y-1.5 pb-1", children: mod.operations.map((op) => {
2948
3279
  const checked = enabledOps.has(op);
2949
3280
  const fnSlug = getOperationFunctionSlug(op, mod.slug);
2950
3281
  const isEditing = editingOp === op;
2951
3282
  const currentInstruction = instructions[op] ?? getDefaultInstruction(op, mod.label);
2952
- return /* @__PURE__ */ jsxs8("div", { className: "space-y-1", children: [
2953
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1.5", children: [
2954
- /* @__PURE__ */ jsx10(
3283
+ return /* @__PURE__ */ jsxs10("div", { className: "space-y-1", children: [
3284
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1.5", children: [
3285
+ /* @__PURE__ */ jsx12(
2955
3286
  Checkbox,
2956
3287
  {
2957
3288
  checked,
@@ -2959,24 +3290,24 @@ function ModuleRow({
2959
3290
  "aria-label": `${getOperationLabel(op)} em ${mod.label}`
2960
3291
  }
2961
3292
  ),
2962
- /* @__PURE__ */ jsx10("span", { className: cn("text-sm", checked ? "" : "text-muted-foreground"), children: getOperationLabel(op) }),
2963
- /* @__PURE__ */ jsxs8("span", { className: "text-xs text-muted-foreground", children: [
3293
+ /* @__PURE__ */ jsx12("span", { className: cn("text-sm", checked ? "" : "text-muted-foreground"), children: getOperationLabel(op) }),
3294
+ /* @__PURE__ */ jsxs10("span", { className: "text-xs text-muted-foreground", children: [
2964
3295
  "(",
2965
3296
  fnSlug,
2966
3297
  ")"
2967
3298
  ] }),
2968
- /* @__PURE__ */ jsx10(
3299
+ /* @__PURE__ */ jsx12(
2969
3300
  "button",
2970
3301
  {
2971
3302
  type: "button",
2972
3303
  className: "p-0.5 rounded hover:bg-muted/50 transition-colors ml-auto",
2973
3304
  onClick: () => setEditingOp(isEditing ? null : op),
2974
3305
  "aria-label": `Editar instru\xE7\xF5es de ${getOperationLabel(op)}`,
2975
- children: /* @__PURE__ */ jsx10(Pencil3, { className: "h-3 w-3 text-muted-foreground" })
3306
+ children: /* @__PURE__ */ jsx12(Pencil3, { className: "h-3 w-3 text-muted-foreground" })
2976
3307
  }
2977
3308
  )
2978
3309
  ] }),
2979
- isEditing && /* @__PURE__ */ jsx10("div", { className: "ml-5", children: /* @__PURE__ */ jsx10(
3310
+ isEditing && /* @__PURE__ */ jsx12("div", { className: "ml-5", children: /* @__PURE__ */ jsx12(
2980
3311
  "textarea",
2981
3312
  {
2982
3313
  className: "w-full rounded-md border bg-background px-3 py-2 text-sm resize-y min-h-[56px] focus:outline-none focus:ring-1 focus:ring-ring",
@@ -2992,12 +3323,12 @@ function ModuleRow({
2992
3323
  }
2993
3324
 
2994
3325
  // src/components/capabilities/integrations-tab.tsx
2995
- import { useCallback as useCallback5, useState as useState9, useEffect as useEffect5, useMemo as useMemo6 } from "react";
2996
- import { Switch as Switch5, Tooltip as Tooltip2, TooltipContent as TooltipContent2, TooltipTrigger as TooltipTrigger2, Checkbox as Checkbox2, Button as Button8 } from "@greatapps/greatauth-ui/ui";
2997
- import { Plug, Loader2 as Loader25, ChevronDown as ChevronDown3, Pencil as Pencil4 } from "lucide-react";
2998
- import { toast as toast7 } from "sonner";
3326
+ import { useCallback as useCallback6, useState as useState11, useEffect as useEffect5, useMemo as useMemo7 } from "react";
3327
+ import { Switch as Switch5, Tooltip as Tooltip2, TooltipContent as TooltipContent2, TooltipTrigger as TooltipTrigger2, Checkbox as Checkbox2, Button as Button10 } from "@greatapps/greatauth-ui/ui";
3328
+ import { Plug, Loader2 as Loader25, ChevronDown as ChevronDown2, Pencil as Pencil4 } from "lucide-react";
3329
+ import { toast as toast8 } from "sonner";
2999
3330
  import { CalendarSync } from "lucide-react";
3000
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
3331
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
3001
3332
  var ICON_MAP = {
3002
3333
  CalendarSync,
3003
3334
  Plug
@@ -3040,12 +3371,12 @@ function IntegrationsTab({
3040
3371
  const createTool = useCreateTool(config);
3041
3372
  const agentTools = agentToolsData?.data ?? [];
3042
3373
  const allTools = toolsData?.data ?? [];
3043
- const [localState, setLocalState] = useState9({});
3044
- const [serverState, setServerState] = useState9({});
3045
- const [initialized, setInitialized] = useState9(false);
3046
- const [isSaving, setIsSaving] = useState9(false);
3047
- const [editingFunction, setEditingFunction] = useState9(null);
3048
- const [expandedCards, setExpandedCards] = useState9(/* @__PURE__ */ new Set());
3374
+ const [localState, setLocalState] = useState11({});
3375
+ const [serverState, setServerState] = useState11({});
3376
+ const [initialized, setInitialized] = useState11(false);
3377
+ const [isSaving, setIsSaving] = useState11(false);
3378
+ const [editingFunction, setEditingFunction] = useState11(null);
3379
+ const [expandedCards, setExpandedCards] = useState11(/* @__PURE__ */ new Set());
3049
3380
  const connectedCards = cards.filter(
3050
3381
  (c) => !c.isAddNew && (c.state === "connected" || c.state === "expired")
3051
3382
  );
@@ -3082,7 +3413,7 @@ function IntegrationsTab({
3082
3413
  setServerState(JSON.parse(JSON.stringify(state, (_k, v) => v instanceof Set ? [...v] : v)));
3083
3414
  setInitialized(true);
3084
3415
  }, [connectedCards, agentTools, initialized]);
3085
- const hasChanges = useMemo6(() => {
3416
+ const hasChanges = useMemo7(() => {
3086
3417
  if (!initialized) return false;
3087
3418
  const localKeys = Object.keys(localState);
3088
3419
  for (const slug of localKeys) {
@@ -3101,7 +3432,7 @@ function IntegrationsTab({
3101
3432
  }
3102
3433
  return false;
3103
3434
  }, [localState, serverState, initialized]);
3104
- const handleToggle = useCallback5(
3435
+ const handleToggle = useCallback6(
3105
3436
  (card, checked) => {
3106
3437
  const slug = card.definition.slug;
3107
3438
  setLocalState((prev) => ({
@@ -3117,7 +3448,7 @@ function IntegrationsTab({
3117
3448
  },
3118
3449
  []
3119
3450
  );
3120
- const handleToggleFunction = useCallback5(
3451
+ const handleToggleFunction = useCallback6(
3121
3452
  (slug, fnSlug, checked) => {
3122
3453
  setLocalState((prev) => {
3123
3454
  const current = prev[slug];
@@ -3130,7 +3461,7 @@ function IntegrationsTab({
3130
3461
  },
3131
3462
  []
3132
3463
  );
3133
- const handleUpdateInstruction = useCallback5(
3464
+ const handleUpdateInstruction = useCallback6(
3134
3465
  (slug, fnSlug, instruction) => {
3135
3466
  setLocalState((prev) => {
3136
3467
  const current = prev[slug];
@@ -3146,7 +3477,7 @@ function IntegrationsTab({
3146
3477
  },
3147
3478
  []
3148
3479
  );
3149
- const saveNow = useCallback5(async () => {
3480
+ const saveNow = useCallback6(async () => {
3150
3481
  setIsSaving(true);
3151
3482
  try {
3152
3483
  for (const slug of Object.keys(localState)) {
@@ -3202,14 +3533,14 @@ function IntegrationsTab({
3202
3533
  }
3203
3534
  }
3204
3535
  setServerState(JSON.parse(JSON.stringify(localState, (_k, v) => v instanceof Set ? [...v] : v)));
3205
- toast7.success("Integra\xE7\xF5es salvas");
3536
+ toast8.success("Integra\xE7\xF5es salvas");
3206
3537
  } catch {
3207
- toast7.error("Erro ao salvar integra\xE7\xF5es");
3538
+ toast8.error("Erro ao salvar integra\xE7\xF5es");
3208
3539
  } finally {
3209
3540
  setIsSaving(false);
3210
3541
  }
3211
3542
  }, [localState, serverState, connectedCards, allTools, agentTools, agentId, addAgentTool, removeAgentTool, updateAgentTool, createTool]);
3212
- const discard = useCallback5(() => {
3543
+ const discard = useCallback6(() => {
3213
3544
  const restored = {};
3214
3545
  for (const [slug, entry] of Object.entries(serverState)) {
3215
3546
  restored[slug] = {
@@ -3220,18 +3551,18 @@ function IntegrationsTab({
3220
3551
  setLocalState(restored);
3221
3552
  }, [serverState]);
3222
3553
  if (isLoading || agentToolsLoading) {
3223
- return /* @__PURE__ */ jsx11("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ jsx11(Loader25, { className: "h-6 w-6 animate-spin text-muted-foreground" }) });
3554
+ return /* @__PURE__ */ jsx13("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ jsx13(Loader25, { className: "h-6 w-6 animate-spin text-muted-foreground" }) });
3224
3555
  }
3225
3556
  if (connectedCards.length === 0) {
3226
- return /* @__PURE__ */ jsxs9("div", { className: "flex flex-col items-center justify-center gap-3 py-16 text-muted-foreground", children: [
3227
- /* @__PURE__ */ jsx11(Plug, { className: "h-10 w-10" }),
3228
- /* @__PURE__ */ jsx11("p", { className: "text-sm font-medium", children: "Nenhuma integra\xE7\xE3o conectada" }),
3229
- /* @__PURE__ */ jsx11("p", { className: "text-xs text-center max-w-sm", children: "Conecte integra\xE7\xF5es na p\xE1gina de Integra\xE7\xF5es da conta para que possam ser ativadas neste agente." })
3557
+ return /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center justify-center gap-3 py-16 text-muted-foreground", children: [
3558
+ /* @__PURE__ */ jsx13(Plug, { className: "h-10 w-10" }),
3559
+ /* @__PURE__ */ jsx13("p", { className: "text-sm font-medium", children: "Nenhuma integra\xE7\xE3o conectada" }),
3560
+ /* @__PURE__ */ jsx13("p", { className: "text-xs text-center max-w-sm", children: "Conecte integra\xE7\xF5es na p\xE1gina de Integra\xE7\xF5es da conta para que possam ser ativadas neste agente." })
3230
3561
  ] });
3231
3562
  }
3232
- return /* @__PURE__ */ jsxs9("div", { className: "space-y-4", children: [
3233
- /* @__PURE__ */ jsx11("p", { className: "text-xs text-muted-foreground", children: "Ative ou desative as integra\xE7\xF5es conectadas na conta para este agente." }),
3234
- /* @__PURE__ */ jsx11("div", { className: "grid grid-cols-1 gap-3", children: connectedCards.map((card) => {
3563
+ return /* @__PURE__ */ jsxs11("div", { className: "space-y-4", children: [
3564
+ /* @__PURE__ */ jsx13("p", { className: "text-xs text-muted-foreground", children: "Ative ou desative as integra\xE7\xF5es conectadas na conta para este agente." }),
3565
+ /* @__PURE__ */ jsx13("div", { className: "grid grid-cols-1 gap-3", children: connectedCards.map((card) => {
3235
3566
  const Icon = resolveIcon(card.definition.icon);
3236
3567
  const integrationSlug = card.definition.slug;
3237
3568
  const local = localState[integrationSlug];
@@ -3240,7 +3571,7 @@ function IntegrationsTab({
3240
3571
  const isExpanded = expandedCards.has(integrationSlug);
3241
3572
  const selected = local?.selectedFunctions ?? /* @__PURE__ */ new Set();
3242
3573
  const instructions = local?.functionInstructions ?? {};
3243
- return /* @__PURE__ */ jsxs9(
3574
+ return /* @__PURE__ */ jsxs11(
3244
3575
  "div",
3245
3576
  {
3246
3577
  className: cn(
@@ -3248,17 +3579,17 @@ function IntegrationsTab({
3248
3579
  isLinked ? "border-primary/30 shadow-sm" : "opacity-75"
3249
3580
  ),
3250
3581
  children: [
3251
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-3 p-4", children: [
3252
- /* @__PURE__ */ jsx11("div", { className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: /* @__PURE__ */ jsx11(Icon, { className: "h-4.5 w-4.5" }) }),
3253
- /* @__PURE__ */ jsxs9("div", { className: "flex-1 min-w-0", children: [
3254
- /* @__PURE__ */ jsx11("h4", { className: "text-sm font-medium leading-tight truncate", children: card.definition.name }),
3255
- card.accountLabel && /* @__PURE__ */ jsxs9(Tooltip2, { children: [
3256
- /* @__PURE__ */ jsx11(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx11("p", { className: "text-xs text-muted-foreground truncate", title: card.accountLabel, children: card.accountLabel }) }),
3257
- /* @__PURE__ */ jsx11(TooltipContent2, { children: card.accountLabel })
3582
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-3 p-4", children: [
3583
+ /* @__PURE__ */ jsx13("div", { className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: /* @__PURE__ */ jsx13(Icon, { className: "h-4.5 w-4.5" }) }),
3584
+ /* @__PURE__ */ jsxs11("div", { className: "flex-1 min-w-0", children: [
3585
+ /* @__PURE__ */ jsx13("h4", { className: "text-sm font-medium leading-tight truncate", children: card.definition.name }),
3586
+ card.accountLabel && /* @__PURE__ */ jsxs11(Tooltip2, { children: [
3587
+ /* @__PURE__ */ jsx13(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx13("p", { className: "text-xs text-muted-foreground truncate", title: card.accountLabel, children: card.accountLabel }) }),
3588
+ /* @__PURE__ */ jsx13(TooltipContent2, { children: card.accountLabel })
3258
3589
  ] }),
3259
- card.state === "expired" && /* @__PURE__ */ jsx11("p", { className: "text-xs text-amber-600 dark:text-amber-400", children: "Expirado" })
3590
+ card.state === "expired" && /* @__PURE__ */ jsx13("p", { className: "text-xs text-amber-600 dark:text-amber-400", children: "Expirado" })
3260
3591
  ] }),
3261
- isLinked && fns && /* @__PURE__ */ jsx11(
3592
+ isLinked && fns && /* @__PURE__ */ jsx13(
3262
3593
  "button",
3263
3594
  {
3264
3595
  type: "button",
@@ -3273,8 +3604,8 @@ function IntegrationsTab({
3273
3604
  return next;
3274
3605
  }),
3275
3606
  "aria-label": "Expandir fun\xE7\xF5es",
3276
- children: /* @__PURE__ */ jsx11(
3277
- ChevronDown3,
3607
+ children: /* @__PURE__ */ jsx13(
3608
+ ChevronDown2,
3278
3609
  {
3279
3610
  className: cn(
3280
3611
  "h-4 w-4 text-muted-foreground transition-transform",
@@ -3284,7 +3615,7 @@ function IntegrationsTab({
3284
3615
  )
3285
3616
  }
3286
3617
  ),
3287
- /* @__PURE__ */ jsx11(
3618
+ /* @__PURE__ */ jsx13(
3288
3619
  Switch5,
3289
3620
  {
3290
3621
  checked: isLinked,
@@ -3294,15 +3625,15 @@ function IntegrationsTab({
3294
3625
  }
3295
3626
  )
3296
3627
  ] }),
3297
- isLinked && fns && isExpanded && /* @__PURE__ */ jsxs9("div", { className: "border-t px-4 py-3 space-y-2", children: [
3298
- /* @__PURE__ */ jsx11("p", { className: "text-xs text-muted-foreground mb-2", children: "Selecione as fun\xE7\xF5es dispon\xEDveis para o agente:" }),
3628
+ isLinked && fns && isExpanded && /* @__PURE__ */ jsxs11("div", { className: "border-t px-4 py-3 space-y-2", children: [
3629
+ /* @__PURE__ */ jsx13("p", { className: "text-xs text-muted-foreground mb-2", children: "Selecione as fun\xE7\xF5es dispon\xEDveis para o agente:" }),
3299
3630
  fns.map((fn) => {
3300
3631
  const isSelected = selected.has(fn.slug);
3301
3632
  const isEditing = editingFunction === `${integrationSlug}:${fn.slug}`;
3302
3633
  const currentInstruction = instructions[fn.slug] ?? fn.defaultInstructions;
3303
- return /* @__PURE__ */ jsxs9("div", { className: "space-y-1", children: [
3304
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
3305
- /* @__PURE__ */ jsx11(
3634
+ return /* @__PURE__ */ jsxs11("div", { className: "space-y-1", children: [
3635
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
3636
+ /* @__PURE__ */ jsx13(
3306
3637
  Checkbox2,
3307
3638
  {
3308
3639
  checked: isSelected,
@@ -3310,15 +3641,15 @@ function IntegrationsTab({
3310
3641
  "aria-label": fn.label
3311
3642
  }
3312
3643
  ),
3313
- /* @__PURE__ */ jsxs9("div", { className: "flex-1 min-w-0", children: [
3314
- /* @__PURE__ */ jsx11("span", { className: cn("text-sm", isSelected ? "" : "text-muted-foreground"), children: fn.label }),
3315
- /* @__PURE__ */ jsxs9("span", { className: "text-xs text-muted-foreground ml-1.5", children: [
3644
+ /* @__PURE__ */ jsxs11("div", { className: "flex-1 min-w-0", children: [
3645
+ /* @__PURE__ */ jsx13("span", { className: cn("text-sm", isSelected ? "" : "text-muted-foreground"), children: fn.label }),
3646
+ /* @__PURE__ */ jsxs11("span", { className: "text-xs text-muted-foreground ml-1.5", children: [
3316
3647
  "(",
3317
3648
  fn.slug,
3318
3649
  ")"
3319
3650
  ] })
3320
3651
  ] }),
3321
- /* @__PURE__ */ jsx11(
3652
+ /* @__PURE__ */ jsx13(
3322
3653
  "button",
3323
3654
  {
3324
3655
  type: "button",
@@ -3327,11 +3658,11 @@ function IntegrationsTab({
3327
3658
  isEditing ? null : `${integrationSlug}:${fn.slug}`
3328
3659
  ),
3329
3660
  "aria-label": `Editar instru\xE7\xF5es de ${fn.label}`,
3330
- children: /* @__PURE__ */ jsx11(Pencil4, { className: "h-3 w-3 text-muted-foreground" })
3661
+ children: /* @__PURE__ */ jsx13(Pencil4, { className: "h-3 w-3 text-muted-foreground" })
3331
3662
  }
3332
3663
  )
3333
3664
  ] }),
3334
- isEditing && /* @__PURE__ */ jsx11("div", { className: "ml-6", children: /* @__PURE__ */ jsx11(
3665
+ isEditing && /* @__PURE__ */ jsx13("div", { className: "ml-6", children: /* @__PURE__ */ jsx13(
3335
3666
  "textarea",
3336
3667
  {
3337
3668
  className: "w-full rounded-md border bg-background px-3 py-2 text-sm resize-y min-h-[60px] focus:outline-none focus:ring-1 focus:ring-ring",
@@ -3349,12 +3680,12 @@ function IntegrationsTab({
3349
3680
  `${integrationSlug}-cred-${card.credentialId}`
3350
3681
  );
3351
3682
  }) }),
3352
- hasChanges && /* @__PURE__ */ jsxs9("div", { className: "sticky bottom-0 z-10 flex items-center justify-between gap-2 rounded-lg border bg-background p-3 shadow-sm", children: [
3353
- /* @__PURE__ */ jsx11("p", { className: "text-sm text-muted-foreground", children: "Voc\xEA tem altera\xE7\xF5es n\xE3o salvas." }),
3354
- /* @__PURE__ */ jsxs9("div", { className: "flex gap-2", children: [
3355
- /* @__PURE__ */ jsx11(Button8, { variant: "ghost", size: "sm", onClick: discard, disabled: isSaving, children: "Descartar" }),
3356
- /* @__PURE__ */ jsxs9(Button8, { size: "sm", onClick: saveNow, disabled: isSaving, children: [
3357
- isSaving && /* @__PURE__ */ jsx11(Loader25, { className: "mr-2 h-4 w-4 animate-spin" }),
3683
+ hasChanges && /* @__PURE__ */ jsxs11("div", { className: "sticky bottom-0 z-10 flex items-center justify-between gap-2 rounded-lg border bg-background p-3 shadow-sm", children: [
3684
+ /* @__PURE__ */ jsx13("p", { className: "text-sm text-muted-foreground", children: "Voc\xEA tem altera\xE7\xF5es n\xE3o salvas." }),
3685
+ /* @__PURE__ */ jsxs11("div", { className: "flex gap-2", children: [
3686
+ /* @__PURE__ */ jsx13(Button10, { variant: "ghost", size: "sm", onClick: discard, disabled: isSaving, children: "Descartar" }),
3687
+ /* @__PURE__ */ jsxs11(Button10, { size: "sm", onClick: saveNow, disabled: isSaving, children: [
3688
+ isSaving && /* @__PURE__ */ jsx13(Loader25, { className: "mr-2 h-4 w-4 animate-spin" }),
3358
3689
  "Salvar"
3359
3690
  ] })
3360
3691
  ] })
@@ -3369,57 +3700,62 @@ import {
3369
3700
  TabsTrigger,
3370
3701
  TabsContent
3371
3702
  } from "@greatapps/greatauth-ui/ui";
3372
- import { Target as Target2, FileText as FileText2, MessageCircle as MessageCircle2, Blocks, Plug as Plug2 } from "lucide-react";
3373
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
3703
+ import { Target as Target2, Settings2, MessageCircle as MessageCircle2, Blocks, Plug as Plug2, History } from "lucide-react";
3704
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
3374
3705
  function AgentTabs({
3375
3706
  agent,
3376
3707
  config,
3377
3708
  renderChatLink
3378
3709
  }) {
3379
- return /* @__PURE__ */ jsxs10(Tabs, { defaultValue: "prompt", children: [
3380
- /* @__PURE__ */ jsxs10(TabsList, { children: [
3381
- /* @__PURE__ */ jsxs10(TabsTrigger, { value: "prompt", className: "flex items-center gap-1.5", children: [
3382
- /* @__PURE__ */ jsx12(FileText2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
3383
- "Prompt"
3710
+ return /* @__PURE__ */ jsxs12(Tabs, { defaultValue: "definicao", children: [
3711
+ /* @__PURE__ */ jsxs12(TabsList, { children: [
3712
+ /* @__PURE__ */ jsxs12(TabsTrigger, { value: "definicao", className: "flex items-center gap-1.5", children: [
3713
+ /* @__PURE__ */ jsx14(Settings2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
3714
+ "Defini\xE7\xE3o"
3384
3715
  ] }),
3385
- /* @__PURE__ */ jsxs10(TabsTrigger, { value: "objetivos", className: "flex items-center gap-1.5", children: [
3386
- /* @__PURE__ */ jsx12(Target2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
3716
+ /* @__PURE__ */ jsxs12(TabsTrigger, { value: "objetivos", className: "flex items-center gap-1.5", children: [
3717
+ /* @__PURE__ */ jsx14(Target2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
3387
3718
  "Objetivos"
3388
3719
  ] }),
3389
- /* @__PURE__ */ jsxs10(TabsTrigger, { value: "capacidades", className: "flex items-center gap-1.5", children: [
3390
- /* @__PURE__ */ jsx12(Blocks, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
3720
+ /* @__PURE__ */ jsxs12(TabsTrigger, { value: "capacidades", className: "flex items-center gap-1.5", children: [
3721
+ /* @__PURE__ */ jsx14(Blocks, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
3391
3722
  "Capacidades"
3392
3723
  ] }),
3393
- /* @__PURE__ */ jsxs10(TabsTrigger, { value: "integracoes", className: "flex items-center gap-1.5", children: [
3394
- /* @__PURE__ */ jsx12(Plug2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
3724
+ /* @__PURE__ */ jsxs12(TabsTrigger, { value: "integracoes", className: "flex items-center gap-1.5", children: [
3725
+ /* @__PURE__ */ jsx14(Plug2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
3395
3726
  "Integra\xE7\xF5es"
3396
3727
  ] }),
3397
- /* @__PURE__ */ jsxs10(TabsTrigger, { value: "conversas", className: "flex items-center gap-1.5", children: [
3398
- /* @__PURE__ */ jsx12(MessageCircle2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
3728
+ /* @__PURE__ */ jsxs12(TabsTrigger, { value: "conversas", className: "flex items-center gap-1.5", children: [
3729
+ /* @__PURE__ */ jsx14(MessageCircle2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
3399
3730
  "Conversas"
3731
+ ] }),
3732
+ /* @__PURE__ */ jsxs12(TabsTrigger, { value: "revisao", className: "flex items-center gap-1.5", children: [
3733
+ /* @__PURE__ */ jsx14(History, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
3734
+ "Revis\xE3o"
3400
3735
  ] })
3401
3736
  ] }),
3402
- /* @__PURE__ */ jsx12(TabsContent, { value: "prompt", className: "mt-4", children: /* @__PURE__ */ jsx12(AgentPromptEditor, { agent, config }) }),
3403
- /* @__PURE__ */ jsx12(TabsContent, { value: "objetivos", className: "mt-4", children: /* @__PURE__ */ jsx12(AgentObjectivesList, { agent, config }) }),
3404
- /* @__PURE__ */ jsx12(TabsContent, { value: "capacidades", className: "mt-4", children: /* @__PURE__ */ jsx12(CapabilitiesTab, { config, agentId: agent.id }) }),
3405
- /* @__PURE__ */ jsx12(TabsContent, { value: "integracoes", className: "mt-4", children: /* @__PURE__ */ jsx12(IntegrationsTab, { config, agentId: agent.id }) }),
3406
- /* @__PURE__ */ jsx12(TabsContent, { value: "conversas", className: "mt-4", children: /* @__PURE__ */ jsx12(
3737
+ /* @__PURE__ */ jsx14(TabsContent, { value: "definicao", className: "mt-4", children: /* @__PURE__ */ jsx14(AgentDefinitionEditor, { agent, config }) }),
3738
+ /* @__PURE__ */ jsx14(TabsContent, { value: "objetivos", className: "mt-4", children: /* @__PURE__ */ jsx14(AgentObjectivesList, { agent, config }) }),
3739
+ /* @__PURE__ */ jsx14(TabsContent, { value: "capacidades", className: "mt-4", children: /* @__PURE__ */ jsx14(CapabilitiesTab, { config, agentId: agent.id }) }),
3740
+ /* @__PURE__ */ jsx14(TabsContent, { value: "integracoes", className: "mt-4", children: /* @__PURE__ */ jsx14(IntegrationsTab, { config, agentId: agent.id }) }),
3741
+ /* @__PURE__ */ jsx14(TabsContent, { value: "conversas", className: "mt-4", children: /* @__PURE__ */ jsx14(
3407
3742
  AgentConversationsPanel,
3408
3743
  {
3409
3744
  agent,
3410
3745
  config,
3411
3746
  renderChatLink
3412
3747
  }
3413
- ) })
3748
+ ) }),
3749
+ /* @__PURE__ */ jsx14(TabsContent, { value: "revisao", className: "mt-4", children: /* @__PURE__ */ jsx14(AgentRevisionTab, { agent, config }) })
3414
3750
  ] });
3415
3751
  }
3416
3752
 
3417
3753
  // src/components/agents/agent-tools-list.tsx
3418
- import { useState as useState10 } from "react";
3754
+ import { useState as useState12 } from "react";
3419
3755
  import {
3420
3756
  Switch as Switch6,
3421
3757
  Badge as Badge6,
3422
- Button as Button9,
3758
+ Button as Button11,
3423
3759
  Skeleton as Skeleton6,
3424
3760
  AlertDialog as AlertDialog3,
3425
3761
  AlertDialogAction as AlertDialogAction3,
@@ -3432,14 +3768,14 @@ import {
3432
3768
  Popover,
3433
3769
  PopoverContent,
3434
3770
  PopoverTrigger,
3435
- Input as Input6,
3771
+ Input as Input7,
3436
3772
  Textarea as Textarea2,
3437
- Dialog as Dialog4,
3438
- DialogContent as DialogContent4,
3439
- DialogHeader as DialogHeader4,
3440
- DialogTitle as DialogTitle4,
3773
+ Dialog as Dialog5,
3774
+ DialogContent as DialogContent5,
3775
+ DialogHeader as DialogHeader5,
3776
+ DialogTitle as DialogTitle5,
3441
3777
  DialogFooter as DialogFooter4,
3442
- Label as Label4,
3778
+ Label as Label5,
3443
3779
  Select,
3444
3780
  SelectContent,
3445
3781
  SelectItem,
@@ -3447,25 +3783,25 @@ import {
3447
3783
  SelectValue
3448
3784
  } from "@greatapps/greatauth-ui/ui";
3449
3785
  import {
3450
- Trash2 as Trash23,
3451
- Plus as Plus2,
3786
+ Trash2 as Trash24,
3787
+ Plus as Plus3,
3452
3788
  Wrench,
3453
- Settings2
3789
+ Settings2 as Settings22
3454
3790
  } from "lucide-react";
3455
- import { toast as toast8 } from "sonner";
3456
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
3791
+ import { toast as toast9 } from "sonner";
3792
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3457
3793
  function AgentToolsList({ agent, config }) {
3458
3794
  const { data: agentToolsData, isLoading } = useAgentTools(config, agent.id);
3459
3795
  const { data: allToolsData } = useTools(config);
3460
3796
  const addMutation = useAddAgentTool(config);
3461
3797
  const removeMutation = useRemoveAgentTool(config);
3462
3798
  const updateMutation = useUpdateAgentTool(config);
3463
- const [removeTarget, setRemoveTarget] = useState10(null);
3464
- const [addOpen, setAddOpen] = useState10(false);
3465
- const [search, setSearch] = useState10("");
3466
- const [configTarget, setConfigTarget] = useState10(null);
3467
- const [configInstructions, setConfigInstructions] = useState10("");
3468
- const [configCredentialId, setConfigCredentialId] = useState10("");
3799
+ const [removeTarget, setRemoveTarget] = useState12(null);
3800
+ const [addOpen, setAddOpen] = useState12(false);
3801
+ const [search, setSearch] = useState12("");
3802
+ const [configTarget, setConfigTarget] = useState12(null);
3803
+ const [configInstructions, setConfigInstructions] = useState12("");
3804
+ const [configCredentialId, setConfigCredentialId] = useState12("");
3469
3805
  const { data: credentialsData } = useToolCredentials(config);
3470
3806
  const allCredentials = credentialsData?.data || [];
3471
3807
  const agentTools = agentToolsData?.data || [];
@@ -3489,9 +3825,9 @@ function AgentToolsList({ agent, config }) {
3489
3825
  id: agentTool.id,
3490
3826
  body: { enabled: checked }
3491
3827
  });
3492
- toast8.success(checked ? "Ferramenta ativada" : "Ferramenta desativada");
3828
+ toast9.success(checked ? "Ferramenta ativada" : "Ferramenta desativada");
3493
3829
  } catch (err) {
3494
- toast8.error(
3830
+ toast9.error(
3495
3831
  err instanceof Error ? err.message : "Erro ao alterar estado da ferramenta"
3496
3832
  );
3497
3833
  }
@@ -3502,11 +3838,11 @@ function AgentToolsList({ agent, config }) {
3502
3838
  idAgent: agent.id,
3503
3839
  body: { id_tool: tool.id }
3504
3840
  });
3505
- toast8.success("Ferramenta adicionada");
3841
+ toast9.success("Ferramenta adicionada");
3506
3842
  setAddOpen(false);
3507
3843
  setSearch("");
3508
3844
  } catch (err) {
3509
- toast8.error(
3845
+ toast9.error(
3510
3846
  err instanceof Error ? err.message : "Erro ao adicionar ferramenta"
3511
3847
  );
3512
3848
  }
@@ -3518,9 +3854,9 @@ function AgentToolsList({ agent, config }) {
3518
3854
  idAgent: agent.id,
3519
3855
  id: removeTarget.id
3520
3856
  });
3521
- toast8.success("Ferramenta removida");
3857
+ toast9.success("Ferramenta removida");
3522
3858
  } catch (err) {
3523
- toast8.error(
3859
+ toast9.error(
3524
3860
  err instanceof Error ? err.message : "Erro ao remover ferramenta"
3525
3861
  );
3526
3862
  } finally {
@@ -3544,34 +3880,34 @@ function AgentToolsList({ agent, config }) {
3544
3880
  id_tool_credential: newCredentialId
3545
3881
  }
3546
3882
  });
3547
- toast8.success("Configura\xE7\xE3o atualizada");
3883
+ toast9.success("Configura\xE7\xE3o atualizada");
3548
3884
  setConfigTarget(null);
3549
3885
  } catch (err) {
3550
- toast8.error(
3886
+ toast9.error(
3551
3887
  err instanceof Error ? err.message : "Erro ao atualizar configura\xE7\xE3o"
3552
3888
  );
3553
3889
  }
3554
3890
  }
3555
3891
  if (isLoading) {
3556
- return /* @__PURE__ */ jsx13("div", { className: "space-y-3 p-4", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx13(Skeleton6, { className: "h-14 w-full" }, i)) });
3892
+ return /* @__PURE__ */ jsx15("div", { className: "space-y-3 p-4", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx15(Skeleton6, { className: "h-14 w-full" }, i)) });
3557
3893
  }
3558
- return /* @__PURE__ */ jsxs11("div", { className: "space-y-4 p-4", children: [
3559
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
3560
- /* @__PURE__ */ jsxs11("h3", { className: "text-sm font-medium text-muted-foreground", children: [
3894
+ return /* @__PURE__ */ jsxs13("div", { className: "space-y-4 p-4", children: [
3895
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between", children: [
3896
+ /* @__PURE__ */ jsxs13("h3", { className: "text-sm font-medium text-muted-foreground", children: [
3561
3897
  visibleAgentTools.length,
3562
3898
  " ferramenta",
3563
3899
  visibleAgentTools.length !== 1 ? "s" : "",
3564
3900
  " associada",
3565
3901
  visibleAgentTools.length !== 1 ? "s" : ""
3566
3902
  ] }),
3567
- /* @__PURE__ */ jsxs11(Popover, { open: addOpen, onOpenChange: setAddOpen, children: [
3568
- /* @__PURE__ */ jsx13(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(Button9, { size: "sm", disabled: availableTools.length === 0, children: [
3569
- /* @__PURE__ */ jsx13(Plus2, { className: "mr-2 h-4 w-4" }),
3903
+ /* @__PURE__ */ jsxs13(Popover, { open: addOpen, onOpenChange: setAddOpen, children: [
3904
+ /* @__PURE__ */ jsx15(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs13(Button11, { size: "sm", disabled: availableTools.length === 0, children: [
3905
+ /* @__PURE__ */ jsx15(Plus3, { className: "mr-2 h-4 w-4" }),
3570
3906
  "Adicionar Ferramenta"
3571
3907
  ] }) }),
3572
- /* @__PURE__ */ jsxs11(PopoverContent, { className: "w-72 p-0", align: "end", children: [
3573
- /* @__PURE__ */ jsx13("div", { className: "p-2", children: /* @__PURE__ */ jsx13(
3574
- Input6,
3908
+ /* @__PURE__ */ jsxs13(PopoverContent, { className: "w-72 p-0", align: "end", children: [
3909
+ /* @__PURE__ */ jsx15("div", { className: "p-2", children: /* @__PURE__ */ jsx15(
3910
+ Input7,
3575
3911
  {
3576
3912
  placeholder: "Buscar ferramenta\\u2026",
3577
3913
  "aria-label": "Buscar ferramenta",
@@ -3581,7 +3917,7 @@ function AgentToolsList({ agent, config }) {
3581
3917
  className: "h-8"
3582
3918
  }
3583
3919
  ) }),
3584
- /* @__PURE__ */ jsx13("div", { className: "max-h-48 overflow-y-auto", children: filteredAvailable.length === 0 ? /* @__PURE__ */ jsx13("p", { className: "p-3 text-center text-sm text-muted-foreground", children: "Nenhuma ferramenta dispon\xEDvel" }) : filteredAvailable.map((tool) => /* @__PURE__ */ jsxs11(
3920
+ /* @__PURE__ */ jsx15("div", { className: "max-h-48 overflow-y-auto", children: filteredAvailable.length === 0 ? /* @__PURE__ */ jsx15("p", { className: "p-3 text-center text-sm text-muted-foreground", children: "Nenhuma ferramenta dispon\xEDvel" }) : filteredAvailable.map((tool) => /* @__PURE__ */ jsxs13(
3585
3921
  "button",
3586
3922
  {
3587
3923
  type: "button",
@@ -3589,9 +3925,9 @@ function AgentToolsList({ agent, config }) {
3589
3925
  onClick: () => handleAdd(tool),
3590
3926
  disabled: addMutation.isPending,
3591
3927
  children: [
3592
- /* @__PURE__ */ jsx13(Wrench, { className: "h-4 w-4 text-muted-foreground" }),
3593
- /* @__PURE__ */ jsx13("span", { className: "flex-1 font-medium", children: tool.name }),
3594
- /* @__PURE__ */ jsx13(Badge6, { variant: "secondary", className: "text-xs", children: tool.type })
3928
+ /* @__PURE__ */ jsx15(Wrench, { className: "h-4 w-4 text-muted-foreground" }),
3929
+ /* @__PURE__ */ jsx15("span", { className: "flex-1 font-medium", children: tool.name }),
3930
+ /* @__PURE__ */ jsx15(Badge6, { variant: "secondary", className: "text-xs", children: tool.type })
3595
3931
  ]
3596
3932
  },
3597
3933
  tool.id
@@ -3599,24 +3935,24 @@ function AgentToolsList({ agent, config }) {
3599
3935
  ] })
3600
3936
  ] })
3601
3937
  ] }),
3602
- visibleAgentTools.length === 0 ? /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
3603
- /* @__PURE__ */ jsx13(Wrench, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
3604
- /* @__PURE__ */ jsx13("p", { className: "text-sm text-muted-foreground", children: "Nenhuma ferramenta associada. Clique em 'Adicionar Ferramenta' para come\xE7ar." })
3605
- ] }) : /* @__PURE__ */ jsx13("div", { className: "space-y-2", children: visibleAgentTools.map((agentTool) => {
3938
+ visibleAgentTools.length === 0 ? /* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
3939
+ /* @__PURE__ */ jsx15(Wrench, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
3940
+ /* @__PURE__ */ jsx15("p", { className: "text-sm text-muted-foreground", children: "Nenhuma ferramenta associada. Clique em 'Adicionar Ferramenta' para come\xE7ar." })
3941
+ ] }) : /* @__PURE__ */ jsx15("div", { className: "space-y-2", children: visibleAgentTools.map((agentTool) => {
3606
3942
  const tool = getToolInfo(agentTool.id_tool);
3607
- return /* @__PURE__ */ jsxs11(
3943
+ return /* @__PURE__ */ jsxs13(
3608
3944
  "div",
3609
3945
  {
3610
3946
  className: "flex items-center gap-3 rounded-lg border bg-card p-3",
3611
3947
  children: [
3612
- /* @__PURE__ */ jsxs11("div", { className: "flex flex-1 flex-col gap-1 min-w-0", children: [
3613
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
3614
- /* @__PURE__ */ jsx13("span", { className: "truncate font-medium", children: tool?.name || `Ferramenta #${agentTool.id_tool}` }),
3615
- tool?.type && /* @__PURE__ */ jsx13(Badge6, { variant: "secondary", className: "shrink-0 text-xs", children: tool.type })
3948
+ /* @__PURE__ */ jsxs13("div", { className: "flex flex-1 flex-col gap-1 min-w-0", children: [
3949
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
3950
+ /* @__PURE__ */ jsx15("span", { className: "truncate font-medium", children: tool?.name || `Ferramenta #${agentTool.id_tool}` }),
3951
+ tool?.type && /* @__PURE__ */ jsx15(Badge6, { variant: "secondary", className: "shrink-0 text-xs", children: tool.type })
3616
3952
  ] }),
3617
- agentTool.custom_instructions && /* @__PURE__ */ jsx13("p", { className: "truncate text-xs text-muted-foreground", children: agentTool.custom_instructions })
3953
+ agentTool.custom_instructions && /* @__PURE__ */ jsx15("p", { className: "truncate text-xs text-muted-foreground", children: agentTool.custom_instructions })
3618
3954
  ] }),
3619
- /* @__PURE__ */ jsx13(
3955
+ /* @__PURE__ */ jsx15(
3620
3956
  Switch6,
3621
3957
  {
3622
3958
  "aria-label": "Ativar/Desativar",
@@ -3625,8 +3961,8 @@ function AgentToolsList({ agent, config }) {
3625
3961
  disabled: updateMutation.isPending
3626
3962
  }
3627
3963
  ),
3628
- /* @__PURE__ */ jsx13(
3629
- Button9,
3964
+ /* @__PURE__ */ jsx15(
3965
+ Button11,
3630
3966
  {
3631
3967
  variant: "ghost",
3632
3968
  size: "icon",
@@ -3634,18 +3970,18 @@ function AgentToolsList({ agent, config }) {
3634
3970
  className: "shrink-0 text-muted-foreground hover:text-foreground",
3635
3971
  onClick: () => openConfig(agentTool),
3636
3972
  title: "Configurar instru\xE7\xF5es",
3637
- children: /* @__PURE__ */ jsx13(Settings2, { className: "h-4 w-4" })
3973
+ children: /* @__PURE__ */ jsx15(Settings22, { className: "h-4 w-4" })
3638
3974
  }
3639
3975
  ),
3640
- /* @__PURE__ */ jsx13(
3641
- Button9,
3976
+ /* @__PURE__ */ jsx15(
3977
+ Button11,
3642
3978
  {
3643
3979
  variant: "ghost",
3644
3980
  size: "icon",
3645
3981
  "aria-label": "Remover",
3646
3982
  className: "shrink-0 text-muted-foreground hover:text-destructive",
3647
3983
  onClick: () => setRemoveTarget(agentTool),
3648
- children: /* @__PURE__ */ jsx13(Trash23, { className: "h-4 w-4" })
3984
+ children: /* @__PURE__ */ jsx15(Trash24, { className: "h-4 w-4" })
3649
3985
  }
3650
3986
  )
3651
3987
  ]
@@ -3653,35 +3989,35 @@ function AgentToolsList({ agent, config }) {
3653
3989
  agentTool.id
3654
3990
  );
3655
3991
  }) }),
3656
- /* @__PURE__ */ jsx13(
3657
- Dialog4,
3992
+ /* @__PURE__ */ jsx15(
3993
+ Dialog5,
3658
3994
  {
3659
3995
  open: !!configTarget,
3660
3996
  onOpenChange: (open) => !open && setConfigTarget(null),
3661
- children: /* @__PURE__ */ jsxs11(DialogContent4, { className: "sm:max-w-lg", children: [
3662
- /* @__PURE__ */ jsx13(DialogHeader4, { children: /* @__PURE__ */ jsx13(DialogTitle4, { children: "Instru\xE7\xF5es da Ferramenta" }) }),
3663
- /* @__PURE__ */ jsxs11("div", { className: "space-y-4", children: [
3664
- configTarget && getToolInfo(configTarget.id_tool)?.type !== "none" && /* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
3665
- /* @__PURE__ */ jsx13(Label4, { htmlFor: "tool-credential", children: "Credencial" }),
3666
- /* @__PURE__ */ jsxs11(
3997
+ children: /* @__PURE__ */ jsxs13(DialogContent5, { className: "sm:max-w-lg", children: [
3998
+ /* @__PURE__ */ jsx15(DialogHeader5, { children: /* @__PURE__ */ jsx15(DialogTitle5, { children: "Instru\xE7\xF5es da Ferramenta" }) }),
3999
+ /* @__PURE__ */ jsxs13("div", { className: "space-y-4", children: [
4000
+ configTarget && getToolInfo(configTarget.id_tool)?.type !== "none" && /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
4001
+ /* @__PURE__ */ jsx15(Label5, { htmlFor: "tool-credential", children: "Credencial" }),
4002
+ /* @__PURE__ */ jsxs13(
3667
4003
  Select,
3668
4004
  {
3669
4005
  value: configCredentialId || void 0,
3670
4006
  onValueChange: (val) => setConfigCredentialId(val === "__none__" ? "" : val),
3671
4007
  children: [
3672
- /* @__PURE__ */ jsx13(SelectTrigger, { id: "tool-credential", children: /* @__PURE__ */ jsx13(SelectValue, { placeholder: "Selecione uma credencial (opcional)" }) }),
3673
- /* @__PURE__ */ jsxs11(SelectContent, { children: [
3674
- /* @__PURE__ */ jsx13(SelectItem, { value: "__none__", children: "Nenhuma (autom\xE1tico)" }),
3675
- allCredentials.filter((c) => configTarget && c.id_tool === configTarget.id_tool && c.status === "active").map((c) => /* @__PURE__ */ jsx13(SelectItem, { value: String(c.id), children: c.label || `Credencial #${c.id}` }, c.id))
4008
+ /* @__PURE__ */ jsx15(SelectTrigger, { id: "tool-credential", children: /* @__PURE__ */ jsx15(SelectValue, { placeholder: "Selecione uma credencial (opcional)" }) }),
4009
+ /* @__PURE__ */ jsxs13(SelectContent, { children: [
4010
+ /* @__PURE__ */ jsx15(SelectItem, { value: "__none__", children: "Nenhuma (autom\xE1tico)" }),
4011
+ allCredentials.filter((c) => configTarget && c.id_tool === configTarget.id_tool && c.status === "active").map((c) => /* @__PURE__ */ jsx15(SelectItem, { value: String(c.id), children: c.label || `Credencial #${c.id}` }, c.id))
3676
4012
  ] })
3677
4013
  ]
3678
4014
  }
3679
4015
  ),
3680
- /* @__PURE__ */ jsx13("p", { className: "text-xs text-muted-foreground", children: "Vincule uma credencial espec\xEDfica a esta ferramenta neste agente." })
4016
+ /* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground", children: "Vincule uma credencial espec\xEDfica a esta ferramenta neste agente." })
3681
4017
  ] }),
3682
- /* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
3683
- /* @__PURE__ */ jsx13(Label4, { htmlFor: "tool-instructions", children: "Instru\xE7\xF5es Personalizadas" }),
3684
- /* @__PURE__ */ jsx13(
4018
+ /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
4019
+ /* @__PURE__ */ jsx15(Label5, { htmlFor: "tool-instructions", children: "Instru\xE7\xF5es Personalizadas" }),
4020
+ /* @__PURE__ */ jsx15(
3685
4021
  Textarea2,
3686
4022
  {
3687
4023
  id: "tool-instructions",
@@ -3692,20 +4028,20 @@ function AgentToolsList({ agent, config }) {
3692
4028
  rows: 6
3693
4029
  }
3694
4030
  ),
3695
- /* @__PURE__ */ jsx13("p", { className: "text-xs text-muted-foreground", children: "Este texto \xE9 adicionado ao prompt do agente para orientar o uso da ferramenta." })
4031
+ /* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground", children: "Este texto \xE9 adicionado ao prompt do agente para orientar o uso da ferramenta." })
3696
4032
  ] })
3697
4033
  ] }),
3698
- /* @__PURE__ */ jsxs11(DialogFooter4, { children: [
3699
- /* @__PURE__ */ jsx13(
3700
- Button9,
4034
+ /* @__PURE__ */ jsxs13(DialogFooter4, { children: [
4035
+ /* @__PURE__ */ jsx15(
4036
+ Button11,
3701
4037
  {
3702
4038
  variant: "outline",
3703
4039
  onClick: () => setConfigTarget(null),
3704
4040
  children: "Cancelar"
3705
4041
  }
3706
4042
  ),
3707
- /* @__PURE__ */ jsx13(
3708
- Button9,
4043
+ /* @__PURE__ */ jsx15(
4044
+ Button11,
3709
4045
  {
3710
4046
  onClick: handleSaveConfig,
3711
4047
  disabled: updateMutation.isPending,
@@ -3716,19 +4052,19 @@ function AgentToolsList({ agent, config }) {
3716
4052
  ] })
3717
4053
  }
3718
4054
  ),
3719
- /* @__PURE__ */ jsx13(
4055
+ /* @__PURE__ */ jsx15(
3720
4056
  AlertDialog3,
3721
4057
  {
3722
4058
  open: !!removeTarget,
3723
4059
  onOpenChange: (open) => !open && setRemoveTarget(null),
3724
- children: /* @__PURE__ */ jsxs11(AlertDialogContent3, { children: [
3725
- /* @__PURE__ */ jsxs11(AlertDialogHeader3, { children: [
3726
- /* @__PURE__ */ jsx13(AlertDialogTitle3, { children: "Remover ferramenta?" }),
3727
- /* @__PURE__ */ jsx13(AlertDialogDescription3, { children: "A ferramenta ser\xE1 desassociada deste agente." })
4060
+ children: /* @__PURE__ */ jsxs13(AlertDialogContent3, { children: [
4061
+ /* @__PURE__ */ jsxs13(AlertDialogHeader3, { children: [
4062
+ /* @__PURE__ */ jsx15(AlertDialogTitle3, { children: "Remover ferramenta?" }),
4063
+ /* @__PURE__ */ jsx15(AlertDialogDescription3, { children: "A ferramenta ser\xE1 desassociada deste agente." })
3728
4064
  ] }),
3729
- /* @__PURE__ */ jsxs11(AlertDialogFooter3, { children: [
3730
- /* @__PURE__ */ jsx13(AlertDialogCancel3, { children: "Cancelar" }),
3731
- /* @__PURE__ */ jsx13(
4065
+ /* @__PURE__ */ jsxs13(AlertDialogFooter3, { children: [
4066
+ /* @__PURE__ */ jsx15(AlertDialogCancel3, { children: "Cancelar" }),
4067
+ /* @__PURE__ */ jsx15(
3732
4068
  AlertDialogAction3,
3733
4069
  {
3734
4070
  onClick: handleRemove,
@@ -3744,10 +4080,10 @@ function AgentToolsList({ agent, config }) {
3744
4080
  }
3745
4081
 
3746
4082
  // src/components/tools/tools-table.tsx
3747
- import { useMemo as useMemo7, useState as useState11 } from "react";
4083
+ import { useMemo as useMemo8, useState as useState13 } from "react";
3748
4084
  import { DataTable as DataTable2 } from "@greatapps/greatauth-ui";
3749
4085
  import {
3750
- Input as Input7,
4086
+ Input as Input8,
3751
4087
  Badge as Badge7,
3752
4088
  Tooltip as Tooltip3,
3753
4089
  TooltipTrigger as TooltipTrigger3,
@@ -3760,44 +4096,44 @@ import {
3760
4096
  AlertDialogFooter as AlertDialogFooter4,
3761
4097
  AlertDialogHeader as AlertDialogHeader4,
3762
4098
  AlertDialogTitle as AlertDialogTitle4,
3763
- Button as Button10
4099
+ Button as Button12
3764
4100
  } from "@greatapps/greatauth-ui/ui";
3765
- import { Pencil as Pencil5, Trash2 as Trash24, Search as Search2 } from "lucide-react";
4101
+ import { Pencil as Pencil5, Trash2 as Trash25, Search as Search2 } from "lucide-react";
3766
4102
  import { format as format2 } from "date-fns";
3767
4103
  import { ptBR as ptBR2 } from "date-fns/locale";
3768
- import { toast as toast9 } from "sonner";
3769
- import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
4104
+ import { toast as toast10 } from "sonner";
4105
+ import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
3770
4106
  function useColumns2(onEdit, onDelete) {
3771
4107
  return [
3772
4108
  {
3773
4109
  accessorKey: "name",
3774
4110
  header: "Nome",
3775
- cell: ({ row }) => /* @__PURE__ */ jsx14("span", { className: "font-medium", children: row.original.name }),
4111
+ cell: ({ row }) => /* @__PURE__ */ jsx16("span", { className: "font-medium", children: row.original.name }),
3776
4112
  sortingFn: (rowA, rowB) => rowA.original.name.toLowerCase().localeCompare(rowB.original.name.toLowerCase())
3777
4113
  },
3778
4114
  {
3779
4115
  accessorKey: "slug",
3780
4116
  header: "Slug",
3781
- cell: ({ row }) => /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground text-sm font-mono", children: row.original.slug || "\u2014" })
4117
+ cell: ({ row }) => /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground text-sm font-mono", children: row.original.slug || "\u2014" })
3782
4118
  },
3783
4119
  {
3784
4120
  accessorKey: "type",
3785
4121
  header: "Tipo",
3786
- cell: ({ row }) => /* @__PURE__ */ jsx14(Badge7, { variant: "secondary", children: row.original.type })
4122
+ cell: ({ row }) => /* @__PURE__ */ jsx16(Badge7, { variant: "secondary", children: row.original.type })
3787
4123
  },
3788
4124
  {
3789
4125
  accessorKey: "description",
3790
4126
  header: "Descri\xE7\xE3o",
3791
4127
  cell: ({ row }) => {
3792
4128
  const desc = row.original.description;
3793
- if (!desc) return /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground text-sm", children: "\u2014" });
3794
- return /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground text-sm", children: desc.length > 50 ? `${desc.slice(0, 50)}\u2026` : desc });
4129
+ if (!desc) return /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground text-sm", children: "\u2014" });
4130
+ return /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground text-sm", children: desc.length > 50 ? `${desc.slice(0, 50)}\u2026` : desc });
3795
4131
  }
3796
4132
  },
3797
4133
  {
3798
4134
  accessorKey: "datetime_add",
3799
4135
  header: "Criado em",
3800
- cell: ({ row }) => /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground text-sm", children: format2(new Date(row.original.datetime_add), "dd/MM/yyyy", {
4136
+ cell: ({ row }) => /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground text-sm", children: format2(new Date(row.original.datetime_add), "dd/MM/yyyy", {
3801
4137
  locale: ptBR2
3802
4138
  }) })
3803
4139
  },
@@ -3805,43 +4141,43 @@ function useColumns2(onEdit, onDelete) {
3805
4141
  id: "actions",
3806
4142
  size: 80,
3807
4143
  enableSorting: false,
3808
- cell: ({ row }) => /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
3809
- /* @__PURE__ */ jsxs12(Tooltip3, { children: [
3810
- /* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14(
3811
- Button10,
4144
+ cell: ({ row }) => /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1", children: [
4145
+ /* @__PURE__ */ jsxs14(Tooltip3, { children: [
4146
+ /* @__PURE__ */ jsx16(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx16(
4147
+ Button12,
3812
4148
  {
3813
4149
  variant: "ghost",
3814
4150
  size: "icon",
3815
4151
  className: "h-8 w-8",
3816
4152
  "aria-label": "Editar",
3817
4153
  onClick: () => onEdit(row.original),
3818
- children: /* @__PURE__ */ jsx14(Pencil5, { className: "h-4 w-4" })
4154
+ children: /* @__PURE__ */ jsx16(Pencil5, { className: "h-4 w-4" })
3819
4155
  }
3820
4156
  ) }),
3821
- /* @__PURE__ */ jsx14(TooltipContent3, { children: "Editar" })
4157
+ /* @__PURE__ */ jsx16(TooltipContent3, { children: "Editar" })
3822
4158
  ] }),
3823
- /* @__PURE__ */ jsxs12(Tooltip3, { children: [
3824
- /* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14(
3825
- Button10,
4159
+ /* @__PURE__ */ jsxs14(Tooltip3, { children: [
4160
+ /* @__PURE__ */ jsx16(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx16(
4161
+ Button12,
3826
4162
  {
3827
4163
  variant: "ghost",
3828
4164
  size: "icon",
3829
4165
  className: "h-8 w-8 text-destructive hover:text-destructive",
3830
4166
  "aria-label": "Excluir",
3831
4167
  onClick: () => onDelete(row.original.id),
3832
- children: /* @__PURE__ */ jsx14(Trash24, { className: "h-4 w-4" })
4168
+ children: /* @__PURE__ */ jsx16(Trash25, { className: "h-4 w-4" })
3833
4169
  }
3834
4170
  ) }),
3835
- /* @__PURE__ */ jsx14(TooltipContent3, { children: "Excluir" })
4171
+ /* @__PURE__ */ jsx16(TooltipContent3, { children: "Excluir" })
3836
4172
  ] })
3837
4173
  ] })
3838
4174
  }
3839
4175
  ];
3840
4176
  }
3841
4177
  function ToolsTable({ onEdit, config }) {
3842
- const [search, setSearch] = useState11("");
3843
- const [page, setPage] = useState11(1);
3844
- const queryParams = useMemo7(() => {
4178
+ const [search, setSearch] = useState13("");
4179
+ const [page, setPage] = useState13(1);
4180
+ const queryParams = useMemo8(() => {
3845
4181
  const params = {
3846
4182
  limit: "15",
3847
4183
  page: String(page)
@@ -3853,7 +4189,7 @@ function ToolsTable({ onEdit, config }) {
3853
4189
  }, [search, page]);
3854
4190
  const { data, isLoading } = useTools(config, queryParams);
3855
4191
  const deleteTool = useDeleteTool(config);
3856
- const [deleteId, setDeleteId] = useState11(null);
4192
+ const [deleteId, setDeleteId] = useState13(null);
3857
4193
  const rawTools = data?.data || [];
3858
4194
  const tools = rawTools.filter((t) => !t.slug?.startsWith("gclinic_"));
3859
4195
  const total = tools.length;
@@ -3865,21 +4201,21 @@ function ToolsTable({ onEdit, config }) {
3865
4201
  if (!deleteId) return;
3866
4202
  deleteTool.mutate(deleteId, {
3867
4203
  onSuccess: () => {
3868
- toast9.success("Ferramenta exclu\xEDda");
4204
+ toast10.success("Ferramenta exclu\xEDda");
3869
4205
  setDeleteId(null);
3870
4206
  },
3871
- onError: () => toast9.error("Erro ao excluir ferramenta")
4207
+ onError: () => toast10.error("Erro ao excluir ferramenta")
3872
4208
  });
3873
4209
  }
3874
4210
  function handleSearchChange(value) {
3875
4211
  setSearch(value);
3876
4212
  setPage(1);
3877
4213
  }
3878
- return /* @__PURE__ */ jsxs12(Fragment2, { children: [
3879
- /* @__PURE__ */ jsx14("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs12("div", { className: "relative flex-1 max-w-md", children: [
3880
- /* @__PURE__ */ jsx14(Search2, { "aria-hidden": "true", className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
3881
- /* @__PURE__ */ jsx14(
3882
- Input7,
4214
+ return /* @__PURE__ */ jsxs14(Fragment3, { children: [
4215
+ /* @__PURE__ */ jsx16("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs14("div", { className: "relative flex-1 max-w-md", children: [
4216
+ /* @__PURE__ */ jsx16(Search2, { "aria-hidden": "true", className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
4217
+ /* @__PURE__ */ jsx16(
4218
+ Input8,
3883
4219
  {
3884
4220
  placeholder: "Buscar ferramentas\\u2026",
3885
4221
  "aria-label": "Buscar ferramentas",
@@ -3891,7 +4227,7 @@ function ToolsTable({ onEdit, config }) {
3891
4227
  }
3892
4228
  )
3893
4229
  ] }) }),
3894
- /* @__PURE__ */ jsx14(
4230
+ /* @__PURE__ */ jsx16(
3895
4231
  DataTable2,
3896
4232
  {
3897
4233
  columns,
@@ -3904,19 +4240,19 @@ function ToolsTable({ onEdit, config }) {
3904
4240
  pageSize: 15
3905
4241
  }
3906
4242
  ),
3907
- /* @__PURE__ */ jsx14(
4243
+ /* @__PURE__ */ jsx16(
3908
4244
  AlertDialog4,
3909
4245
  {
3910
4246
  open: !!deleteId,
3911
4247
  onOpenChange: (open) => !open && setDeleteId(null),
3912
- children: /* @__PURE__ */ jsxs12(AlertDialogContent4, { children: [
3913
- /* @__PURE__ */ jsxs12(AlertDialogHeader4, { children: [
3914
- /* @__PURE__ */ jsx14(AlertDialogTitle4, { children: "Excluir ferramenta?" }),
3915
- /* @__PURE__ */ jsx14(AlertDialogDescription4, { children: "Esta a\xE7\xE3o n\xE3o pode ser desfeita. A ferramenta ser\xE1 removida permanentemente." })
4248
+ children: /* @__PURE__ */ jsxs14(AlertDialogContent4, { children: [
4249
+ /* @__PURE__ */ jsxs14(AlertDialogHeader4, { children: [
4250
+ /* @__PURE__ */ jsx16(AlertDialogTitle4, { children: "Excluir ferramenta?" }),
4251
+ /* @__PURE__ */ jsx16(AlertDialogDescription4, { children: "Esta a\xE7\xE3o n\xE3o pode ser desfeita. A ferramenta ser\xE1 removida permanentemente." })
3916
4252
  ] }),
3917
- /* @__PURE__ */ jsxs12(AlertDialogFooter4, { children: [
3918
- /* @__PURE__ */ jsx14(AlertDialogCancel4, { variant: "outline", size: "default", children: "Cancelar" }),
3919
- /* @__PURE__ */ jsx14(
4253
+ /* @__PURE__ */ jsxs14(AlertDialogFooter4, { children: [
4254
+ /* @__PURE__ */ jsx16(AlertDialogCancel4, { variant: "outline", size: "default", children: "Cancelar" }),
4255
+ /* @__PURE__ */ jsx16(
3920
4256
  AlertDialogAction4,
3921
4257
  {
3922
4258
  variant: "default",
@@ -3934,17 +4270,17 @@ function ToolsTable({ onEdit, config }) {
3934
4270
  }
3935
4271
 
3936
4272
  // src/components/tools/tool-form-dialog.tsx
3937
- import { useState as useState12 } from "react";
4273
+ import { useState as useState14 } from "react";
3938
4274
  import {
3939
- Dialog as Dialog5,
3940
- DialogContent as DialogContent5,
3941
- DialogHeader as DialogHeader5,
3942
- DialogTitle as DialogTitle5,
4275
+ Dialog as Dialog6,
4276
+ DialogContent as DialogContent6,
4277
+ DialogHeader as DialogHeader6,
4278
+ DialogTitle as DialogTitle6,
3943
4279
  DialogFooter as DialogFooter5,
3944
- Button as Button11,
3945
- Input as Input8,
4280
+ Button as Button13,
4281
+ Input as Input9,
3946
4282
  Textarea as Textarea3,
3947
- Label as Label5,
4283
+ Label as Label6,
3948
4284
  Select as Select2,
3949
4285
  SelectContent as SelectContent2,
3950
4286
  SelectItem as SelectItem2,
@@ -3952,8 +4288,8 @@ import {
3952
4288
  SelectValue as SelectValue2
3953
4289
  } from "@greatapps/greatauth-ui/ui";
3954
4290
  import { Loader2 as Loader26 } from "lucide-react";
3955
- import { toast as toast10 } from "sonner";
3956
- import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
4291
+ import { toast as toast11 } from "sonner";
4292
+ import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
3957
4293
  var TOOL_AUTH_TYPES = [
3958
4294
  { value: "none", label: "Nenhuma" },
3959
4295
  { value: "api_key", label: "API Key" },
@@ -4000,9 +4336,9 @@ function ToolFormDialog({
4000
4336
  const isEditing = !!tool;
4001
4337
  const createTool = useCreateTool(config);
4002
4338
  const updateTool = useUpdateTool(config);
4003
- const [form, setForm] = useState12(() => toolToFormState(tool));
4004
- const [slugManuallyEdited, setSlugManuallyEdited] = useState12(false);
4005
- const [lastResetKey, setLastResetKey] = useState12(
4339
+ const [form, setForm] = useState14(() => toolToFormState(tool));
4340
+ const [slugManuallyEdited, setSlugManuallyEdited] = useState14(false);
4341
+ const [lastResetKey, setLastResetKey] = useState14(
4006
4342
  () => `${tool?.id}-${open}`
4007
4343
  );
4008
4344
  const resetKey = `${tool?.id}-${open}`;
@@ -4049,27 +4385,27 @@ function ToolFormDialog({
4049
4385
  try {
4050
4386
  if (isEditing) {
4051
4387
  await updateTool.mutateAsync({ id: tool.id, body });
4052
- toast10.success("Ferramenta atualizada");
4388
+ toast11.success("Ferramenta atualizada");
4053
4389
  } else {
4054
4390
  await createTool.mutateAsync(
4055
4391
  body
4056
4392
  );
4057
- toast10.success("Ferramenta criada");
4393
+ toast11.success("Ferramenta criada");
4058
4394
  }
4059
4395
  onOpenChange(false);
4060
4396
  } catch (err) {
4061
- toast10.error(
4397
+ toast11.error(
4062
4398
  err instanceof Error ? err.message : isEditing ? "Erro ao atualizar ferramenta" : "Erro ao criar ferramenta"
4063
4399
  );
4064
4400
  }
4065
4401
  }
4066
- return /* @__PURE__ */ jsx15(Dialog5, { open, onOpenChange, children: /* @__PURE__ */ jsxs13(DialogContent5, { className: "sm:max-w-lg", children: [
4067
- /* @__PURE__ */ jsx15(DialogHeader5, { children: /* @__PURE__ */ jsx15(DialogTitle5, { children: isEditing ? "Editar Ferramenta" : "Nova Ferramenta" }) }),
4068
- /* @__PURE__ */ jsxs13("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
4069
- /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
4070
- /* @__PURE__ */ jsx15(Label5, { htmlFor: "tool-name", children: "Nome *" }),
4071
- /* @__PURE__ */ jsx15(
4072
- Input8,
4402
+ return /* @__PURE__ */ jsx17(Dialog6, { open, onOpenChange, children: /* @__PURE__ */ jsxs15(DialogContent6, { className: "sm:max-w-lg", children: [
4403
+ /* @__PURE__ */ jsx17(DialogHeader6, { children: /* @__PURE__ */ jsx17(DialogTitle6, { children: isEditing ? "Editar Ferramenta" : "Nova Ferramenta" }) }),
4404
+ /* @__PURE__ */ jsxs15("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
4405
+ /* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
4406
+ /* @__PURE__ */ jsx17(Label6, { htmlFor: "tool-name", children: "Nome *" }),
4407
+ /* @__PURE__ */ jsx17(
4408
+ Input9,
4073
4409
  {
4074
4410
  id: "tool-name",
4075
4411
  name: "name",
@@ -4087,12 +4423,12 @@ function ToolFormDialog({
4087
4423
  disabled: isPending
4088
4424
  }
4089
4425
  ),
4090
- form.nameError && /* @__PURE__ */ jsx15("p", { className: "text-sm text-destructive", children: "Nome \xE9 obrigat\xF3rio" })
4426
+ form.nameError && /* @__PURE__ */ jsx17("p", { className: "text-sm text-destructive", children: "Nome \xE9 obrigat\xF3rio" })
4091
4427
  ] }),
4092
- /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
4093
- /* @__PURE__ */ jsx15(Label5, { htmlFor: "tool-slug", children: "Slug (identificador \xFAnico) *" }),
4094
- /* @__PURE__ */ jsx15(
4095
- Input8,
4428
+ /* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
4429
+ /* @__PURE__ */ jsx17(Label6, { htmlFor: "tool-slug", children: "Slug (identificador \xFAnico) *" }),
4430
+ /* @__PURE__ */ jsx17(
4431
+ Input9,
4096
4432
  {
4097
4433
  id: "tool-slug",
4098
4434
  name: "slug",
@@ -4109,12 +4445,12 @@ function ToolFormDialog({
4109
4445
  disabled: isPending
4110
4446
  }
4111
4447
  ),
4112
- /* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground", children: "Gerado automaticamente a partir do nome. Usado internamente para identificar a ferramenta." }),
4113
- form.slugError && /* @__PURE__ */ jsx15("p", { className: "text-sm text-destructive", children: "Slug \xE9 obrigat\xF3rio" })
4448
+ /* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground", children: "Gerado automaticamente a partir do nome. Usado internamente para identificar a ferramenta." }),
4449
+ form.slugError && /* @__PURE__ */ jsx17("p", { className: "text-sm text-destructive", children: "Slug \xE9 obrigat\xF3rio" })
4114
4450
  ] }),
4115
- /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
4116
- /* @__PURE__ */ jsx15(Label5, { htmlFor: "tool-type", children: "Tipo de Autentica\xE7\xE3o *" }),
4117
- /* @__PURE__ */ jsxs13(
4451
+ /* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
4452
+ /* @__PURE__ */ jsx17(Label6, { htmlFor: "tool-type", children: "Tipo de Autentica\xE7\xE3o *" }),
4453
+ /* @__PURE__ */ jsxs15(
4118
4454
  Select2,
4119
4455
  {
4120
4456
  value: form.type,
@@ -4127,17 +4463,17 @@ function ToolFormDialog({
4127
4463
  },
4128
4464
  disabled: isPending,
4129
4465
  children: [
4130
- /* @__PURE__ */ jsx15(SelectTrigger2, { id: "tool-type", children: /* @__PURE__ */ jsx15(SelectValue2, { placeholder: "Selecione o tipo" }) }),
4131
- /* @__PURE__ */ jsx15(SelectContent2, { children: TOOL_AUTH_TYPES.map((t) => /* @__PURE__ */ jsx15(SelectItem2, { value: t.value, children: t.label }, t.value)) })
4466
+ /* @__PURE__ */ jsx17(SelectTrigger2, { id: "tool-type", children: /* @__PURE__ */ jsx17(SelectValue2, { placeholder: "Selecione o tipo" }) }),
4467
+ /* @__PURE__ */ jsx17(SelectContent2, { children: TOOL_AUTH_TYPES.map((t) => /* @__PURE__ */ jsx17(SelectItem2, { value: t.value, children: t.label }, t.value)) })
4132
4468
  ]
4133
4469
  }
4134
4470
  ),
4135
- /* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground", children: "Define se a ferramenta requer credenciais para funcionar." }),
4136
- form.typeError && /* @__PURE__ */ jsx15("p", { className: "text-sm text-destructive", children: "Tipo \xE9 obrigat\xF3rio" })
4471
+ /* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground", children: "Define se a ferramenta requer credenciais para funcionar." }),
4472
+ form.typeError && /* @__PURE__ */ jsx17("p", { className: "text-sm text-destructive", children: "Tipo \xE9 obrigat\xF3rio" })
4137
4473
  ] }),
4138
- /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
4139
- /* @__PURE__ */ jsx15(Label5, { htmlFor: "tool-description", children: "Descri\xE7\xE3o" }),
4140
- /* @__PURE__ */ jsx15(
4474
+ /* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
4475
+ /* @__PURE__ */ jsx17(Label6, { htmlFor: "tool-description", children: "Descri\xE7\xE3o" }),
4476
+ /* @__PURE__ */ jsx17(
4141
4477
  Textarea3,
4142
4478
  {
4143
4479
  id: "tool-description",
@@ -4150,9 +4486,9 @@ function ToolFormDialog({
4150
4486
  }
4151
4487
  )
4152
4488
  ] }),
4153
- /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
4154
- /* @__PURE__ */ jsx15(Label5, { htmlFor: "tool-function-defs", children: "Defini\xE7\xF5es de Fun\xE7\xE3o (JSON)" }),
4155
- /* @__PURE__ */ jsx15(
4489
+ /* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
4490
+ /* @__PURE__ */ jsx17(Label6, { htmlFor: "tool-function-defs", children: "Defini\xE7\xF5es de Fun\xE7\xE3o (JSON)" }),
4491
+ /* @__PURE__ */ jsx17(
4156
4492
  Textarea3,
4157
4493
  {
4158
4494
  id: "tool-function-defs",
@@ -4184,12 +4520,12 @@ function ToolFormDialog({
4184
4520
  disabled: isPending
4185
4521
  }
4186
4522
  ),
4187
- /* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground", children: "Array de defini\xE7\xF5es no formato OpenAI Function Calling." }),
4188
- form.jsonError && /* @__PURE__ */ jsx15("p", { className: "text-sm text-destructive", children: "JSON inv\xE1lido" })
4523
+ /* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground", children: "Array de defini\xE7\xF5es no formato OpenAI Function Calling." }),
4524
+ form.jsonError && /* @__PURE__ */ jsx17("p", { className: "text-sm text-destructive", children: "JSON inv\xE1lido" })
4189
4525
  ] }),
4190
- /* @__PURE__ */ jsxs13(DialogFooter5, { children: [
4191
- /* @__PURE__ */ jsx15(
4192
- Button11,
4526
+ /* @__PURE__ */ jsxs15(DialogFooter5, { children: [
4527
+ /* @__PURE__ */ jsx17(
4528
+ Button13,
4193
4529
  {
4194
4530
  type: "button",
4195
4531
  variant: "outline",
@@ -4198,8 +4534,8 @@ function ToolFormDialog({
4198
4534
  children: "Cancelar"
4199
4535
  }
4200
4536
  ),
4201
- /* @__PURE__ */ jsxs13(Button11, { type: "submit", disabled: isPending, children: [
4202
- isPending ? /* @__PURE__ */ jsx15(Loader26, { "aria-hidden": "true", className: "mr-2 h-4 w-4 animate-spin" }) : null,
4537
+ /* @__PURE__ */ jsxs15(Button13, { type: "submit", disabled: isPending, children: [
4538
+ isPending ? /* @__PURE__ */ jsx17(Loader26, { "aria-hidden": "true", className: "mr-2 h-4 w-4 animate-spin" }) : null,
4203
4539
  isEditing ? "Salvar" : "Criar"
4204
4540
  ] })
4205
4541
  ] })
@@ -4208,11 +4544,11 @@ function ToolFormDialog({
4208
4544
  }
4209
4545
 
4210
4546
  // src/components/tools/tool-credentials-form.tsx
4211
- import { useMemo as useMemo8, useState as useState13 } from "react";
4547
+ import { useMemo as useMemo9, useState as useState15 } from "react";
4212
4548
  import { DataTable as DataTable3 } from "@greatapps/greatauth-ui";
4213
4549
  import {
4214
- Input as Input9,
4215
- Button as Button12,
4550
+ Input as Input10,
4551
+ Button as Button14,
4216
4552
  Badge as Badge8,
4217
4553
  Tooltip as Tooltip4,
4218
4554
  TooltipTrigger as TooltipTrigger4,
@@ -4226,11 +4562,11 @@ import {
4226
4562
  AlertDialogHeader as AlertDialogHeader5,
4227
4563
  AlertDialogTitle as AlertDialogTitle5
4228
4564
  } from "@greatapps/greatauth-ui/ui";
4229
- import { Trash2 as Trash25, Search as Search3 } from "lucide-react";
4565
+ import { Trash2 as Trash26, Search as Search3 } from "lucide-react";
4230
4566
  import { format as format3 } from "date-fns";
4231
4567
  import { ptBR as ptBR3 } from "date-fns/locale";
4232
- import { toast as toast11 } from "sonner";
4233
- import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
4568
+ import { toast as toast12 } from "sonner";
4569
+ import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
4234
4570
  function formatDate2(dateStr) {
4235
4571
  if (!dateStr) return "Sem expira\xE7\xE3o";
4236
4572
  return format3(new Date(dateStr), "dd/MM/yyyy", { locale: ptBR3 });
@@ -4245,17 +4581,17 @@ function useColumns3(tools, onRemove) {
4245
4581
  {
4246
4582
  accessorKey: "label",
4247
4583
  header: "Label",
4248
- cell: ({ row }) => /* @__PURE__ */ jsx16("span", { className: "font-medium", children: row.original.label || "\u2014" })
4584
+ cell: ({ row }) => /* @__PURE__ */ jsx18("span", { className: "font-medium", children: row.original.label || "\u2014" })
4249
4585
  },
4250
4586
  {
4251
4587
  accessorKey: "id_tool",
4252
4588
  header: "Ferramenta",
4253
- cell: ({ row }) => /* @__PURE__ */ jsx16("span", { className: "text-sm", children: getToolName(row.original.id_tool) })
4589
+ cell: ({ row }) => /* @__PURE__ */ jsx18("span", { className: "text-sm", children: getToolName(row.original.id_tool) })
4254
4590
  },
4255
4591
  {
4256
4592
  accessorKey: "status",
4257
4593
  header: "Status",
4258
- cell: ({ row }) => /* @__PURE__ */ jsx16(
4594
+ cell: ({ row }) => /* @__PURE__ */ jsx18(
4259
4595
  Badge8,
4260
4596
  {
4261
4597
  variant: row.original.status === "active" ? "default" : "destructive",
@@ -4266,31 +4602,31 @@ function useColumns3(tools, onRemove) {
4266
4602
  {
4267
4603
  accessorKey: "expires_at",
4268
4604
  header: "Expira em",
4269
- cell: ({ row }) => /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.expires_at) })
4605
+ cell: ({ row }) => /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.expires_at) })
4270
4606
  },
4271
4607
  {
4272
4608
  accessorKey: "datetime_add",
4273
4609
  header: "Criado em",
4274
- cell: ({ row }) => /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.datetime_add) })
4610
+ cell: ({ row }) => /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.datetime_add) })
4275
4611
  },
4276
4612
  {
4277
4613
  id: "actions",
4278
4614
  header: "A\xE7\xF5es",
4279
4615
  size: 100,
4280
4616
  enableSorting: false,
4281
- cell: ({ row }) => /* @__PURE__ */ jsx16("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxs14(Tooltip4, { children: [
4282
- /* @__PURE__ */ jsx16(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx16(
4283
- Button12,
4617
+ cell: ({ row }) => /* @__PURE__ */ jsx18("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxs16(Tooltip4, { children: [
4618
+ /* @__PURE__ */ jsx18(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx18(
4619
+ Button14,
4284
4620
  {
4285
4621
  variant: "ghost",
4286
4622
  size: "icon",
4287
4623
  className: "h-8 w-8 text-destructive hover:text-destructive",
4288
4624
  "aria-label": "Excluir",
4289
4625
  onClick: () => onRemove(row.original),
4290
- children: /* @__PURE__ */ jsx16(Trash25, { className: "h-4 w-4" })
4626
+ children: /* @__PURE__ */ jsx18(Trash26, { className: "h-4 w-4" })
4291
4627
  }
4292
4628
  ) }),
4293
- /* @__PURE__ */ jsx16(TooltipContent4, { children: "Remover" })
4629
+ /* @__PURE__ */ jsx18(TooltipContent4, { children: "Remover" })
4294
4630
  ] }) })
4295
4631
  }
4296
4632
  ];
@@ -4304,15 +4640,15 @@ function ToolCredentialsForm({
4304
4640
  const deleteMutation = useDeleteToolCredential(config);
4305
4641
  const { data: toolsData } = useTools(config);
4306
4642
  const tools = (toolsData?.data || []).filter((t) => !t.slug?.startsWith("gclinic_"));
4307
- const [search, setSearch] = useState13("");
4308
- const [removeTarget, setRemoveTarget] = useState13(null);
4309
- const internalToolIds = useMemo8(() => {
4643
+ const [search, setSearch] = useState15("");
4644
+ const [removeTarget, setRemoveTarget] = useState15(null);
4645
+ const internalToolIds = useMemo9(() => {
4310
4646
  const allRawTools = toolsData?.data || [];
4311
4647
  return new Set(
4312
4648
  allRawTools.filter((t) => t.slug?.startsWith("gclinic_")).map((t) => t.id)
4313
4649
  );
4314
4650
  }, [toolsData]);
4315
- const filteredCredentials = useMemo8(() => {
4651
+ const filteredCredentials = useMemo9(() => {
4316
4652
  const visible = credentials.filter(
4317
4653
  (cred) => !cred.id_tool || !internalToolIds.has(cred.id_tool)
4318
4654
  );
@@ -4332,21 +4668,21 @@ function ToolCredentialsForm({
4332
4668
  try {
4333
4669
  const result = await deleteMutation.mutateAsync(removeTarget.id);
4334
4670
  if (result.status === 1) {
4335
- toast11.success("Credencial removida");
4671
+ toast12.success("Credencial removida");
4336
4672
  } else {
4337
- toast11.error(result.message || "Erro ao remover credencial");
4673
+ toast12.error(result.message || "Erro ao remover credencial");
4338
4674
  }
4339
4675
  } catch {
4340
- toast11.error("Erro ao remover credencial");
4676
+ toast12.error("Erro ao remover credencial");
4341
4677
  } finally {
4342
4678
  setRemoveTarget(null);
4343
4679
  }
4344
4680
  }
4345
- return /* @__PURE__ */ jsxs14("div", { className: "space-y-4", children: [
4346
- /* @__PURE__ */ jsx16("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs14("div", { className: "relative flex-1 max-w-md", children: [
4347
- /* @__PURE__ */ jsx16(Search3, { "aria-hidden": "true", className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
4348
- /* @__PURE__ */ jsx16(
4349
- Input9,
4681
+ return /* @__PURE__ */ jsxs16("div", { className: "space-y-4", children: [
4682
+ /* @__PURE__ */ jsx18("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs16("div", { className: "relative flex-1 max-w-md", children: [
4683
+ /* @__PURE__ */ jsx18(Search3, { "aria-hidden": "true", className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
4684
+ /* @__PURE__ */ jsx18(
4685
+ Input10,
4350
4686
  {
4351
4687
  placeholder: "Buscar credenciais\\u2026",
4352
4688
  "aria-label": "Buscar credenciais",
@@ -4358,7 +4694,7 @@ function ToolCredentialsForm({
4358
4694
  }
4359
4695
  )
4360
4696
  ] }) }),
4361
- /* @__PURE__ */ jsx16(
4697
+ /* @__PURE__ */ jsx18(
4362
4698
  DataTable3,
4363
4699
  {
4364
4700
  columns,
@@ -4367,19 +4703,19 @@ function ToolCredentialsForm({
4367
4703
  emptyMessage: "Nenhuma credencial encontrada"
4368
4704
  }
4369
4705
  ),
4370
- /* @__PURE__ */ jsx16(
4706
+ /* @__PURE__ */ jsx18(
4371
4707
  AlertDialog5,
4372
4708
  {
4373
4709
  open: !!removeTarget,
4374
4710
  onOpenChange: (open) => !open && setRemoveTarget(null),
4375
- children: /* @__PURE__ */ jsxs14(AlertDialogContent5, { children: [
4376
- /* @__PURE__ */ jsxs14(AlertDialogHeader5, { children: [
4377
- /* @__PURE__ */ jsx16(AlertDialogTitle5, { children: "Remover credencial?" }),
4378
- /* @__PURE__ */ jsx16(AlertDialogDescription5, { children: "A credencial ser\xE1 removida permanentemente." })
4711
+ children: /* @__PURE__ */ jsxs16(AlertDialogContent5, { children: [
4712
+ /* @__PURE__ */ jsxs16(AlertDialogHeader5, { children: [
4713
+ /* @__PURE__ */ jsx18(AlertDialogTitle5, { children: "Remover credencial?" }),
4714
+ /* @__PURE__ */ jsx18(AlertDialogDescription5, { children: "A credencial ser\xE1 removida permanentemente." })
4379
4715
  ] }),
4380
- /* @__PURE__ */ jsxs14(AlertDialogFooter5, { children: [
4381
- /* @__PURE__ */ jsx16(AlertDialogCancel5, { children: "Cancelar" }),
4382
- /* @__PURE__ */ jsx16(
4716
+ /* @__PURE__ */ jsxs16(AlertDialogFooter5, { children: [
4717
+ /* @__PURE__ */ jsx18(AlertDialogCancel5, { children: "Cancelar" }),
4718
+ /* @__PURE__ */ jsx18(
4383
4719
  AlertDialogAction5,
4384
4720
  {
4385
4721
  onClick: handleRemove,
@@ -4395,10 +4731,10 @@ function ToolCredentialsForm({
4395
4731
  }
4396
4732
 
4397
4733
  // src/components/capabilities/integration-card.tsx
4398
- import { useState as useState14 } from "react";
4734
+ import { useState as useState16 } from "react";
4399
4735
  import {
4400
4736
  Badge as Badge9,
4401
- Button as Button13,
4737
+ Button as Button15,
4402
4738
  DropdownMenu,
4403
4739
  DropdownMenuContent,
4404
4740
  DropdownMenuItem,
@@ -4418,18 +4754,18 @@ import {
4418
4754
  Settings as Settings3,
4419
4755
  RefreshCw,
4420
4756
  Clock,
4421
- Plus as Plus3,
4757
+ Plus as Plus4,
4422
4758
  Unplug,
4423
- Trash2 as Trash26
4759
+ Trash2 as Trash27
4424
4760
  } from "lucide-react";
4425
- import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
4761
+ import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
4426
4762
  var ICON_MAP2 = {
4427
4763
  CalendarSync: CalendarSync2,
4428
4764
  Plug: Plug3,
4429
4765
  Settings: Settings3,
4430
4766
  RefreshCw,
4431
4767
  Clock,
4432
- Plus: Plus3
4768
+ Plus: Plus4
4433
4769
  };
4434
4770
  function resolveIcon2(name) {
4435
4771
  return ICON_MAP2[name] ?? Plug3;
@@ -4463,9 +4799,9 @@ function IntegrationCard({
4463
4799
  const Icon = resolveIcon2(definition.icon);
4464
4800
  const isComingSoon = state === "coming_soon";
4465
4801
  const isConnected = state === "connected" || state === "expired";
4466
- const [deleteDialogOpen, setDeleteDialogOpen] = useState14(false);
4802
+ const [deleteDialogOpen, setDeleteDialogOpen] = useState16(false);
4467
4803
  if (isAddNew) {
4468
- return /* @__PURE__ */ jsxs15(
4804
+ return /* @__PURE__ */ jsxs17(
4469
4805
  "div",
4470
4806
  {
4471
4807
  className: cn(
@@ -4483,15 +4819,15 @@ function IntegrationCard({
4483
4819
  }
4484
4820
  },
4485
4821
  children: [
4486
- /* @__PURE__ */ jsxs15("div", { className: "flex items-start gap-3", children: [
4487
- /* @__PURE__ */ jsx17("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/5 text-primary/60", children: /* @__PURE__ */ jsx17(Icon, { className: "h-5 w-5" }) }),
4488
- /* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0 space-y-0.5", children: [
4489
- /* @__PURE__ */ jsx17("h3", { className: "text-sm font-semibold leading-tight text-foreground", children: definition.name }),
4490
- /* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground leading-relaxed", children: "Conectar nova conta" })
4822
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-start gap-3", children: [
4823
+ /* @__PURE__ */ jsx19("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/5 text-primary/60", children: /* @__PURE__ */ jsx19(Icon, { className: "h-5 w-5" }) }),
4824
+ /* @__PURE__ */ jsxs17("div", { className: "flex-1 min-w-0 space-y-0.5", children: [
4825
+ /* @__PURE__ */ jsx19("h3", { className: "text-sm font-semibold leading-tight text-foreground", children: definition.name }),
4826
+ /* @__PURE__ */ jsx19("p", { className: "text-xs text-muted-foreground leading-relaxed", children: "Conectar nova conta" })
4491
4827
  ] })
4492
4828
  ] }),
4493
- /* @__PURE__ */ jsx17("div", { className: "mt-auto flex items-center justify-end pt-1", children: /* @__PURE__ */ jsx17(
4494
- Button13,
4829
+ /* @__PURE__ */ jsx19("div", { className: "mt-auto flex items-center justify-end pt-1", children: /* @__PURE__ */ jsx19(
4830
+ Button15,
4495
4831
  {
4496
4832
  variant: "outline",
4497
4833
  size: "sm",
@@ -4509,84 +4845,84 @@ function IntegrationCard({
4509
4845
  }
4510
4846
  if (isComingSoon) {
4511
4847
  const badge2 = STATE_BADGES[state];
4512
- return /* @__PURE__ */ jsxs15(
4848
+ return /* @__PURE__ */ jsxs17(
4513
4849
  "div",
4514
4850
  {
4515
4851
  className: "group relative flex flex-col gap-3 rounded-xl border bg-card p-5 opacity-60 cursor-default",
4516
4852
  "aria-disabled": true,
4517
4853
  children: [
4518
- /* @__PURE__ */ jsxs15("div", { className: "flex items-start justify-between gap-2", children: [
4519
- /* @__PURE__ */ jsx17("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: /* @__PURE__ */ jsx17(Icon, { className: "h-5 w-5" }) }),
4520
- /* @__PURE__ */ jsx17(Badge9, { variant: "outline", className: cn("text-xs", badge2.className), children: badge2.label })
4854
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-start justify-between gap-2", children: [
4855
+ /* @__PURE__ */ jsx19("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: /* @__PURE__ */ jsx19(Icon, { className: "h-5 w-5" }) }),
4856
+ /* @__PURE__ */ jsx19(Badge9, { variant: "outline", className: cn("text-xs", badge2.className), children: badge2.label })
4521
4857
  ] }),
4522
- /* @__PURE__ */ jsxs15("div", { className: "space-y-1", children: [
4523
- /* @__PURE__ */ jsx17("h3", { className: "text-sm font-semibold leading-tight", children: definition.name }),
4524
- /* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground leading-relaxed", children: definition.description })
4858
+ /* @__PURE__ */ jsxs17("div", { className: "space-y-1", children: [
4859
+ /* @__PURE__ */ jsx19("h3", { className: "text-sm font-semibold leading-tight", children: definition.name }),
4860
+ /* @__PURE__ */ jsx19("p", { className: "text-xs text-muted-foreground leading-relaxed", children: definition.description })
4525
4861
  ] })
4526
4862
  ]
4527
4863
  }
4528
4864
  );
4529
4865
  }
4530
4866
  const badge = STATE_BADGES[state];
4531
- return /* @__PURE__ */ jsxs15(Fragment3, { children: [
4532
- /* @__PURE__ */ jsxs15(
4867
+ return /* @__PURE__ */ jsxs17(Fragment4, { children: [
4868
+ /* @__PURE__ */ jsxs17(
4533
4869
  "div",
4534
4870
  {
4535
4871
  className: "group relative flex flex-col gap-3 rounded-xl border bg-card p-5 transition-shadow hover:shadow-md",
4536
4872
  children: [
4537
- /* @__PURE__ */ jsxs15("div", { className: "flex items-start justify-between gap-2", children: [
4538
- /* @__PURE__ */ jsxs15("div", { className: "flex items-start gap-3 min-w-0 flex-1", children: [
4539
- /* @__PURE__ */ jsx17("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: /* @__PURE__ */ jsx17(Icon, { className: "h-5 w-5" }) }),
4540
- /* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0 space-y-0.5", children: [
4541
- /* @__PURE__ */ jsx17("h3", { className: "text-sm font-semibold leading-tight", children: definition.name }),
4542
- accountLabel && /* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground leading-relaxed truncate", title: accountLabel, children: accountLabel })
4873
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-start justify-between gap-2", children: [
4874
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-start gap-3 min-w-0 flex-1", children: [
4875
+ /* @__PURE__ */ jsx19("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: /* @__PURE__ */ jsx19(Icon, { className: "h-5 w-5" }) }),
4876
+ /* @__PURE__ */ jsxs17("div", { className: "flex-1 min-w-0 space-y-0.5", children: [
4877
+ /* @__PURE__ */ jsx19("h3", { className: "text-sm font-semibold leading-tight", children: definition.name }),
4878
+ accountLabel && /* @__PURE__ */ jsx19("p", { className: "text-xs text-muted-foreground leading-relaxed truncate", title: accountLabel, children: accountLabel })
4543
4879
  ] })
4544
4880
  ] }),
4545
- /* @__PURE__ */ jsx17(Badge9, { variant: "outline", className: cn("text-xs shrink-0", badge.className), children: badge.label })
4881
+ /* @__PURE__ */ jsx19(Badge9, { variant: "outline", className: cn("text-xs shrink-0", badge.className), children: badge.label })
4546
4882
  ] }),
4547
- /* @__PURE__ */ jsx17("div", { className: "mt-auto flex items-center justify-end gap-2 pt-1", children: /* @__PURE__ */ jsxs15(DropdownMenu, { children: [
4548
- /* @__PURE__ */ jsx17(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs15(
4549
- Button13,
4883
+ /* @__PURE__ */ jsx19("div", { className: "mt-auto flex items-center justify-end gap-2 pt-1", children: /* @__PURE__ */ jsxs17(DropdownMenu, { children: [
4884
+ /* @__PURE__ */ jsx19(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs17(
4885
+ Button15,
4550
4886
  {
4551
4887
  variant: "outline",
4552
4888
  size: "sm",
4553
4889
  className: "text-xs gap-1.5",
4554
4890
  children: [
4555
- /* @__PURE__ */ jsx17(Settings3, { className: "h-3.5 w-3.5" }),
4891
+ /* @__PURE__ */ jsx19(Settings3, { className: "h-3.5 w-3.5" }),
4556
4892
  "Configurar"
4557
4893
  ]
4558
4894
  }
4559
4895
  ) }),
4560
- /* @__PURE__ */ jsxs15(DropdownMenuContent, { align: "end", children: [
4561
- /* @__PURE__ */ jsxs15(
4896
+ /* @__PURE__ */ jsxs17(DropdownMenuContent, { align: "end", children: [
4897
+ /* @__PURE__ */ jsxs17(
4562
4898
  DropdownMenuItem,
4563
4899
  {
4564
4900
  onClick: () => onReconnect?.(card),
4565
4901
  className: "gap-2",
4566
4902
  children: [
4567
- /* @__PURE__ */ jsx17(RefreshCw, { className: "h-4 w-4" }),
4903
+ /* @__PURE__ */ jsx19(RefreshCw, { className: "h-4 w-4" }),
4568
4904
  "Reconectar"
4569
4905
  ]
4570
4906
  }
4571
4907
  ),
4572
- /* @__PURE__ */ jsxs15(
4908
+ /* @__PURE__ */ jsxs17(
4573
4909
  DropdownMenuItem,
4574
4910
  {
4575
4911
  onClick: () => onDisconnect?.(card),
4576
4912
  className: "gap-2",
4577
4913
  children: [
4578
- /* @__PURE__ */ jsx17(Unplug, { className: "h-4 w-4" }),
4914
+ /* @__PURE__ */ jsx19(Unplug, { className: "h-4 w-4" }),
4579
4915
  "Desconectar"
4580
4916
  ]
4581
4917
  }
4582
4918
  ),
4583
- /* @__PURE__ */ jsxs15(
4919
+ /* @__PURE__ */ jsxs17(
4584
4920
  DropdownMenuItem,
4585
4921
  {
4586
4922
  onClick: () => setDeleteDialogOpen(true),
4587
4923
  className: "gap-2 text-destructive focus:text-destructive",
4588
4924
  children: [
4589
- /* @__PURE__ */ jsx17(Trash26, { className: "h-4 w-4" }),
4925
+ /* @__PURE__ */ jsx19(Trash27, { className: "h-4 w-4" }),
4590
4926
  "Remover"
4591
4927
  ]
4592
4928
  }
@@ -4596,10 +4932,10 @@ function IntegrationCard({
4596
4932
  ]
4597
4933
  }
4598
4934
  ),
4599
- /* @__PURE__ */ jsx17(AlertDialog6, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs15(AlertDialogContent6, { children: [
4600
- /* @__PURE__ */ jsxs15(AlertDialogHeader6, { children: [
4601
- /* @__PURE__ */ jsx17(AlertDialogTitle6, { children: "Remover integra\xE7\xE3o?" }),
4602
- /* @__PURE__ */ jsxs15(AlertDialogDescription6, { children: [
4935
+ /* @__PURE__ */ jsx19(AlertDialog6, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs17(AlertDialogContent6, { children: [
4936
+ /* @__PURE__ */ jsxs17(AlertDialogHeader6, { children: [
4937
+ /* @__PURE__ */ jsx19(AlertDialogTitle6, { children: "Remover integra\xE7\xE3o?" }),
4938
+ /* @__PURE__ */ jsxs17(AlertDialogDescription6, { children: [
4603
4939
  "Esta a\xE7\xE3o vai remover a credencial",
4604
4940
  accountLabel ? ` (${accountLabel})` : "",
4605
4941
  " de ",
@@ -4607,9 +4943,9 @@ function IntegrationCard({
4607
4943
  ". Esta a\xE7\xE3o n\xE3o pode ser desfeita."
4608
4944
  ] })
4609
4945
  ] }),
4610
- /* @__PURE__ */ jsxs15(AlertDialogFooter6, { children: [
4611
- /* @__PURE__ */ jsx17(AlertDialogCancel6, { children: "Cancelar" }),
4612
- /* @__PURE__ */ jsx17(
4946
+ /* @__PURE__ */ jsxs17(AlertDialogFooter6, { children: [
4947
+ /* @__PURE__ */ jsx19(AlertDialogCancel6, { children: "Cancelar" }),
4948
+ /* @__PURE__ */ jsx19(
4613
4949
  AlertDialogAction6,
4614
4950
  {
4615
4951
  onClick: () => {
@@ -4626,12 +4962,12 @@ function IntegrationCard({
4626
4962
  }
4627
4963
 
4628
4964
  // src/components/capabilities/advanced-tab.tsx
4629
- import { useState as useState15 } from "react";
4965
+ import { useState as useState17 } from "react";
4630
4966
  import { Info } from "lucide-react";
4631
- import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
4967
+ import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
4632
4968
  function AdvancedTab({ config, agentId, gagentsApiUrl }) {
4633
- const [editingTool, setEditingTool] = useState15(null);
4634
- const [showToolForm, setShowToolForm] = useState15(false);
4969
+ const [editingTool, setEditingTool] = useState17(null);
4970
+ const [showToolForm, setShowToolForm] = useState17(false);
4635
4971
  function handleEditTool(tool) {
4636
4972
  setEditingTool(tool);
4637
4973
  setShowToolForm(true);
@@ -4640,22 +4976,22 @@ function AdvancedTab({ config, agentId, gagentsApiUrl }) {
4640
4976
  setShowToolForm(open);
4641
4977
  if (!open) setEditingTool(null);
4642
4978
  }
4643
- return /* @__PURE__ */ jsxs16("div", { className: "space-y-8", children: [
4644
- /* @__PURE__ */ jsxs16("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: [
4645
- /* @__PURE__ */ jsx18(Info, { className: "mt-0.5 h-4 w-4 shrink-0 text-blue-600 dark:text-blue-400" }),
4646
- /* @__PURE__ */ jsxs16("p", { className: "text-sm text-blue-800 dark:text-blue-300", children: [
4979
+ return /* @__PURE__ */ jsxs18("div", { className: "space-y-8", children: [
4980
+ /* @__PURE__ */ jsxs18("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: [
4981
+ /* @__PURE__ */ jsx20(Info, { className: "mt-0.5 h-4 w-4 shrink-0 text-blue-600 dark:text-blue-400" }),
4982
+ /* @__PURE__ */ jsxs18("p", { className: "text-sm text-blue-800 dark:text-blue-300", children: [
4647
4983
  "Use as abas ",
4648
- /* @__PURE__ */ jsx18("strong", { children: "Capacidades" }),
4984
+ /* @__PURE__ */ jsx20("strong", { children: "Capacidades" }),
4649
4985
  " e ",
4650
- /* @__PURE__ */ jsx18("strong", { children: "Integra\xE7\xF5es" }),
4986
+ /* @__PURE__ */ jsx20("strong", { children: "Integra\xE7\xF5es" }),
4651
4987
  " para configura\xE7\xE3o simplificada. Esta aba oferece controlo manual avan\xE7ado sobre ferramentas. As credenciais s\xE3o geridas dentro de cada ferramenta."
4652
4988
  ] })
4653
4989
  ] }),
4654
- /* @__PURE__ */ jsxs16("section", { className: "space-y-3", children: [
4655
- /* @__PURE__ */ jsx18("h3", { className: "text-sm font-medium", children: "Ferramentas" }),
4656
- /* @__PURE__ */ jsx18(ToolsTable, { onEdit: handleEditTool, config })
4990
+ /* @__PURE__ */ jsxs18("section", { className: "space-y-3", children: [
4991
+ /* @__PURE__ */ jsx20("h3", { className: "text-sm font-medium", children: "Ferramentas" }),
4992
+ /* @__PURE__ */ jsx20(ToolsTable, { onEdit: handleEditTool, config })
4657
4993
  ] }),
4658
- /* @__PURE__ */ jsx18(
4994
+ /* @__PURE__ */ jsx20(
4659
4995
  ToolFormDialog,
4660
4996
  {
4661
4997
  open: showToolForm,
@@ -4668,43 +5004,43 @@ function AdvancedTab({ config, agentId, gagentsApiUrl }) {
4668
5004
  }
4669
5005
 
4670
5006
  // src/components/capabilities/integration-wizard.tsx
4671
- import { useCallback as useCallback6, useEffect as useEffect6, useRef as useRef2, useState as useState16 } from "react";
5007
+ import { useCallback as useCallback7, useEffect as useEffect6, useRef as useRef3, useState as useState18 } from "react";
4672
5008
  import {
4673
- Dialog as Dialog6,
4674
- DialogContent as DialogContent6,
5009
+ Dialog as Dialog7,
5010
+ DialogContent as DialogContent7,
4675
5011
  DialogFooter as DialogFooter6,
4676
- DialogHeader as DialogHeader6,
4677
- DialogTitle as DialogTitle6,
4678
- Button as Button15
5012
+ DialogHeader as DialogHeader7,
5013
+ DialogTitle as DialogTitle7,
5014
+ Button as Button17
4679
5015
  } from "@greatapps/greatauth-ui/ui";
4680
5016
  import { Loader2 as Loader29, ChevronLeft, ChevronRight, Check as Check2 } from "lucide-react";
4681
- import { toast as toast12 } from "sonner";
5017
+ import { toast as toast13 } from "sonner";
4682
5018
 
4683
5019
  // src/components/capabilities/wizard-steps/info-step.tsx
4684
5020
  import { Check, Info as Info2 } from "lucide-react";
4685
- import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
5021
+ import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
4686
5022
  function InfoStep({ integration, meta }) {
4687
- return /* @__PURE__ */ jsxs17("div", { className: "space-y-6", children: [
4688
- /* @__PURE__ */ jsxs17("div", { className: "flex items-start gap-4", children: [
4689
- meta.icon && /* @__PURE__ */ jsx19("div", { className: "flex h-12 w-12 shrink-0 items-center justify-center rounded-lg bg-muted", children: meta.icon }),
4690
- /* @__PURE__ */ jsxs17("div", { className: "space-y-1", children: [
4691
- /* @__PURE__ */ jsx19("h3", { className: "text-lg font-semibold", children: integration.name }),
4692
- /* @__PURE__ */ jsx19("p", { className: "text-sm text-muted-foreground", children: integration.description })
5023
+ return /* @__PURE__ */ jsxs19("div", { className: "space-y-6", children: [
5024
+ /* @__PURE__ */ jsxs19("div", { className: "flex items-start gap-4", children: [
5025
+ meta.icon && /* @__PURE__ */ jsx21("div", { className: "flex h-12 w-12 shrink-0 items-center justify-center rounded-lg bg-muted", children: meta.icon }),
5026
+ /* @__PURE__ */ jsxs19("div", { className: "space-y-1", children: [
5027
+ /* @__PURE__ */ jsx21("h3", { className: "text-lg font-semibold", children: integration.name }),
5028
+ /* @__PURE__ */ jsx21("p", { className: "text-sm text-muted-foreground", children: integration.description })
4693
5029
  ] })
4694
5030
  ] }),
4695
- meta.capabilities.length > 0 && /* @__PURE__ */ jsxs17("div", { className: "space-y-3", children: [
4696
- /* @__PURE__ */ jsx19("h4", { className: "text-sm font-medium", children: "O que esta integra\xE7\xE3o permite:" }),
4697
- /* @__PURE__ */ jsx19("ul", { className: "space-y-2", children: meta.capabilities.map((cap, i) => /* @__PURE__ */ jsxs17("li", { className: "flex items-start gap-2 text-sm", children: [
4698
- /* @__PURE__ */ jsx19(
5031
+ meta.capabilities.length > 0 && /* @__PURE__ */ jsxs19("div", { className: "space-y-3", children: [
5032
+ /* @__PURE__ */ jsx21("h4", { className: "text-sm font-medium", children: "O que esta integra\xE7\xE3o permite:" }),
5033
+ /* @__PURE__ */ jsx21("ul", { className: "space-y-2", children: meta.capabilities.map((cap, i) => /* @__PURE__ */ jsxs19("li", { className: "flex items-start gap-2 text-sm", children: [
5034
+ /* @__PURE__ */ jsx21(
4699
5035
  Check,
4700
5036
  {
4701
5037
  "aria-hidden": "true",
4702
5038
  className: "mt-0.5 h-4 w-4 shrink-0 text-green-600"
4703
5039
  }
4704
5040
  ),
4705
- /* @__PURE__ */ jsxs17("div", { children: [
4706
- /* @__PURE__ */ jsx19("span", { className: "font-medium", children: cap.label }),
4707
- cap.description && /* @__PURE__ */ jsxs17("span", { className: "text-muted-foreground", children: [
5041
+ /* @__PURE__ */ jsxs19("div", { children: [
5042
+ /* @__PURE__ */ jsx21("span", { className: "font-medium", children: cap.label }),
5043
+ cap.description && /* @__PURE__ */ jsxs19("span", { className: "text-muted-foreground", children: [
4708
5044
  " ",
4709
5045
  "\u2014 ",
4710
5046
  cap.description
@@ -4712,21 +5048,21 @@ function InfoStep({ integration, meta }) {
4712
5048
  ] })
4713
5049
  ] }, i)) })
4714
5050
  ] }),
4715
- meta.requirements.length > 0 && /* @__PURE__ */ jsxs17("div", { className: "space-y-3", children: [
4716
- /* @__PURE__ */ jsx19("h4", { className: "text-sm font-medium", children: "Requisitos:" }),
4717
- /* @__PURE__ */ jsx19("ul", { className: "space-y-2", children: meta.requirements.map((req, i) => /* @__PURE__ */ jsxs17(
5051
+ meta.requirements.length > 0 && /* @__PURE__ */ jsxs19("div", { className: "space-y-3", children: [
5052
+ /* @__PURE__ */ jsx21("h4", { className: "text-sm font-medium", children: "Requisitos:" }),
5053
+ /* @__PURE__ */ jsx21("ul", { className: "space-y-2", children: meta.requirements.map((req, i) => /* @__PURE__ */ jsxs19(
4718
5054
  "li",
4719
5055
  {
4720
5056
  className: "flex items-start gap-2 text-sm text-muted-foreground",
4721
5057
  children: [
4722
- /* @__PURE__ */ jsx19(
5058
+ /* @__PURE__ */ jsx21(
4723
5059
  Info2,
4724
5060
  {
4725
5061
  "aria-hidden": "true",
4726
5062
  className: "mt-0.5 h-4 w-4 shrink-0 text-blue-500"
4727
5063
  }
4728
5064
  ),
4729
- /* @__PURE__ */ jsx19("span", { children: req })
5065
+ /* @__PURE__ */ jsx21("span", { children: req })
4730
5066
  ]
4731
5067
  },
4732
5068
  i
@@ -4737,8 +5073,8 @@ function InfoStep({ integration, meta }) {
4737
5073
 
4738
5074
  // src/components/capabilities/wizard-steps/credentials-step.tsx
4739
5075
  import { CheckCircle2, Loader2 as Loader27, AlertCircle, Shield } from "lucide-react";
4740
- import { Button as Button14, Input as Input10, Label as Label6 } from "@greatapps/greatauth-ui/ui";
4741
- import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
5076
+ import { Button as Button16, Input as Input11, Label as Label7 } from "@greatapps/greatauth-ui/ui";
5077
+ import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
4742
5078
  function CredentialsStep({
4743
5079
  integration,
4744
5080
  meta,
@@ -4750,7 +5086,7 @@ function CredentialsStep({
4750
5086
  isReconnect = false
4751
5087
  }) {
4752
5088
  if (integration.authType === "oauth2") {
4753
- return /* @__PURE__ */ jsx20(
5089
+ return /* @__PURE__ */ jsx22(
4754
5090
  OAuthCredentials,
4755
5091
  {
4756
5092
  integration,
@@ -4762,7 +5098,7 @@ function CredentialsStep({
4762
5098
  }
4763
5099
  );
4764
5100
  }
4765
- return /* @__PURE__ */ jsx20(ApiKeyCredentials, { apiKey, onApiKeyChange });
5101
+ return /* @__PURE__ */ jsx22(ApiKeyCredentials, { apiKey, onApiKeyChange });
4766
5102
  }
4767
5103
  function OAuthCredentials({
4768
5104
  integration,
@@ -4773,14 +5109,14 @@ function OAuthCredentials({
4773
5109
  isReconnect
4774
5110
  }) {
4775
5111
  const providerLabel = meta.providerLabel || integration.name;
4776
- return /* @__PURE__ */ jsxs18("div", { className: "space-y-6", children: [
4777
- /* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
4778
- /* @__PURE__ */ jsx20("h3", { className: "text-lg font-semibold", children: "Autentica\xE7\xE3o" }),
4779
- /* @__PURE__ */ jsx20("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.` })
5112
+ return /* @__PURE__ */ jsxs20("div", { className: "space-y-6", children: [
5113
+ /* @__PURE__ */ jsxs20("div", { className: "space-y-2", children: [
5114
+ /* @__PURE__ */ jsx22("h3", { className: "text-lg font-semibold", children: "Autentica\xE7\xE3o" }),
5115
+ /* @__PURE__ */ jsx22("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.` })
4780
5116
  ] }),
4781
- /* @__PURE__ */ jsxs18("div", { className: "flex flex-col items-center gap-4 rounded-lg border p-6", children: [
4782
- oauthStatus === "idle" && /* @__PURE__ */ jsxs18(
4783
- Button14,
5117
+ /* @__PURE__ */ jsxs20("div", { className: "flex flex-col items-center gap-4 rounded-lg border p-6", children: [
5118
+ oauthStatus === "idle" && /* @__PURE__ */ jsxs20(
5119
+ Button16,
4784
5120
  {
4785
5121
  onClick: onStartOAuth,
4786
5122
  size: "lg",
@@ -4791,56 +5127,56 @@ function OAuthCredentials({
4791
5127
  ]
4792
5128
  }
4793
5129
  ),
4794
- oauthStatus === "waiting" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col items-center gap-3 text-center", children: [
4795
- /* @__PURE__ */ jsx20(
5130
+ oauthStatus === "waiting" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col items-center gap-3 text-center", children: [
5131
+ /* @__PURE__ */ jsx22(
4796
5132
  Loader27,
4797
5133
  {
4798
5134
  "aria-hidden": "true",
4799
5135
  className: "h-8 w-8 animate-spin text-muted-foreground"
4800
5136
  }
4801
5137
  ),
4802
- /* @__PURE__ */ jsxs18("div", { children: [
4803
- /* @__PURE__ */ jsx20("p", { className: "text-sm font-medium", children: "Aguardando autoriza\xE7\xE3o..." }),
4804
- /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: "Complete o login na janela que foi aberta." })
5138
+ /* @__PURE__ */ jsxs20("div", { children: [
5139
+ /* @__PURE__ */ jsx22("p", { className: "text-sm font-medium", children: "Aguardando autoriza\xE7\xE3o..." }),
5140
+ /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: "Complete o login na janela que foi aberta." })
4805
5141
  ] })
4806
5142
  ] }),
4807
- oauthStatus === "success" && oauthResult && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col items-center gap-3 text-center", children: [
4808
- /* @__PURE__ */ jsx20(
5143
+ oauthStatus === "success" && oauthResult && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col items-center gap-3 text-center", children: [
5144
+ /* @__PURE__ */ jsx22(
4809
5145
  CheckCircle2,
4810
5146
  {
4811
5147
  "aria-hidden": "true",
4812
5148
  className: "h-8 w-8 text-green-600"
4813
5149
  }
4814
5150
  ),
4815
- /* @__PURE__ */ jsxs18("div", { children: [
4816
- /* @__PURE__ */ jsx20("p", { className: "text-sm font-medium text-green-700", children: "Conectado com sucesso!" }),
4817
- oauthResult.email && /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: oauthResult.email })
5151
+ /* @__PURE__ */ jsxs20("div", { children: [
5152
+ /* @__PURE__ */ jsx22("p", { className: "text-sm font-medium text-green-700", children: "Conectado com sucesso!" }),
5153
+ oauthResult.email && /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: oauthResult.email })
4818
5154
  ] })
4819
5155
  ] }),
4820
- oauthStatus === "error" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col items-center gap-3 text-center", children: [
4821
- /* @__PURE__ */ jsx20(
5156
+ oauthStatus === "error" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col items-center gap-3 text-center", children: [
5157
+ /* @__PURE__ */ jsx22(
4822
5158
  AlertCircle,
4823
5159
  {
4824
5160
  "aria-hidden": "true",
4825
5161
  className: "h-8 w-8 text-destructive"
4826
5162
  }
4827
5163
  ),
4828
- /* @__PURE__ */ jsxs18("div", { children: [
4829
- /* @__PURE__ */ jsx20("p", { className: "text-sm font-medium text-destructive", children: "Falha na conex\xE3o" }),
4830
- oauthResult?.error && /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: oauthResult.error })
5164
+ /* @__PURE__ */ jsxs20("div", { children: [
5165
+ /* @__PURE__ */ jsx22("p", { className: "text-sm font-medium text-destructive", children: "Falha na conex\xE3o" }),
5166
+ oauthResult?.error && /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: oauthResult.error })
4831
5167
  ] }),
4832
- /* @__PURE__ */ jsx20(Button14, { variant: "outline", onClick: onStartOAuth, size: "sm", children: "Tentar novamente" })
5168
+ /* @__PURE__ */ jsx22(Button16, { variant: "outline", onClick: onStartOAuth, size: "sm", children: "Tentar novamente" })
4833
5169
  ] })
4834
5170
  ] }),
4835
- /* @__PURE__ */ jsxs18("div", { className: "flex items-start gap-2 rounded-md bg-muted/50 p-3", children: [
4836
- /* @__PURE__ */ jsx20(
5171
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-start gap-2 rounded-md bg-muted/50 p-3", children: [
5172
+ /* @__PURE__ */ jsx22(
4837
5173
  Shield,
4838
5174
  {
4839
5175
  "aria-hidden": "true",
4840
5176
  className: "mt-0.5 h-4 w-4 shrink-0 text-green-600"
4841
5177
  }
4842
5178
  ),
4843
- /* @__PURE__ */ jsxs18("p", { className: "text-xs text-muted-foreground", children: [
5179
+ /* @__PURE__ */ jsxs20("p", { className: "text-xs text-muted-foreground", children: [
4844
5180
  "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 ",
4845
5181
  providerLabel,
4846
5182
  "."
@@ -4852,15 +5188,15 @@ function ApiKeyCredentials({
4852
5188
  apiKey,
4853
5189
  onApiKeyChange
4854
5190
  }) {
4855
- return /* @__PURE__ */ jsxs18("div", { className: "space-y-6", children: [
4856
- /* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
4857
- /* @__PURE__ */ jsx20("h3", { className: "text-lg font-semibold", children: "Autentica\xE7\xE3o" }),
4858
- /* @__PURE__ */ jsx20("p", { className: "text-sm text-muted-foreground", children: "Insira a chave de API para conectar a integra\xE7\xE3o." })
5191
+ return /* @__PURE__ */ jsxs20("div", { className: "space-y-6", children: [
5192
+ /* @__PURE__ */ jsxs20("div", { className: "space-y-2", children: [
5193
+ /* @__PURE__ */ jsx22("h3", { className: "text-lg font-semibold", children: "Autentica\xE7\xE3o" }),
5194
+ /* @__PURE__ */ jsx22("p", { className: "text-sm text-muted-foreground", children: "Insira a chave de API para conectar a integra\xE7\xE3o." })
4859
5195
  ] }),
4860
- /* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
4861
- /* @__PURE__ */ jsx20(Label6, { htmlFor: "integration-api-key", children: "Chave de API" }),
4862
- /* @__PURE__ */ jsx20(
4863
- Input10,
5196
+ /* @__PURE__ */ jsxs20("div", { className: "space-y-2", children: [
5197
+ /* @__PURE__ */ jsx22(Label7, { htmlFor: "integration-api-key", children: "Chave de API" }),
5198
+ /* @__PURE__ */ jsx22(
5199
+ Input11,
4864
5200
  {
4865
5201
  id: "integration-api-key",
4866
5202
  type: "password",
@@ -4871,15 +5207,15 @@ function ApiKeyCredentials({
4871
5207
  }
4872
5208
  )
4873
5209
  ] }),
4874
- /* @__PURE__ */ jsxs18("div", { className: "flex items-start gap-2 rounded-md bg-muted/50 p-3", children: [
4875
- /* @__PURE__ */ jsx20(
5210
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-start gap-2 rounded-md bg-muted/50 p-3", children: [
5211
+ /* @__PURE__ */ jsx22(
4876
5212
  Shield,
4877
5213
  {
4878
5214
  "aria-hidden": "true",
4879
5215
  className: "mt-0.5 h-4 w-4 shrink-0 text-green-600"
4880
5216
  }
4881
5217
  ),
4882
- /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: "Sua chave de API \xE9 armazenada de forma segura e encriptada. Nunca \xE9 exposta no frontend." })
5218
+ /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: "Sua chave de API \xE9 armazenada de forma segura e encriptada. Nunca \xE9 exposta no frontend." })
4883
5219
  ] })
4884
5220
  ] });
4885
5221
  }
@@ -4887,14 +5223,14 @@ function ApiKeyCredentials({
4887
5223
  // src/components/capabilities/wizard-steps/config-step.tsx
4888
5224
  import { Loader2 as Loader28 } from "lucide-react";
4889
5225
  import {
4890
- Label as Label7,
5226
+ Label as Label8,
4891
5227
  Select as Select3,
4892
5228
  SelectContent as SelectContent3,
4893
5229
  SelectItem as SelectItem3,
4894
5230
  SelectTrigger as SelectTrigger3,
4895
5231
  SelectValue as SelectValue3
4896
5232
  } from "@greatapps/greatauth-ui/ui";
4897
- import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
5233
+ import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4898
5234
  function ConfigStep({
4899
5235
  integration,
4900
5236
  options,
@@ -4906,27 +5242,27 @@ function ConfigStep({
4906
5242
  }) {
4907
5243
  const label = selectLabel || getDefaultLabel(integration.slug);
4908
5244
  const placeholder = selectPlaceholder || getDefaultPlaceholder(integration.slug);
4909
- return /* @__PURE__ */ jsxs19("div", { className: "space-y-6", children: [
4910
- /* @__PURE__ */ jsxs19("div", { className: "space-y-2", children: [
4911
- /* @__PURE__ */ jsx21("h3", { className: "text-lg font-semibold", children: "Configura\xE7\xE3o" }),
4912
- /* @__PURE__ */ jsx21("p", { className: "text-sm text-muted-foreground", children: "Configure as op\xE7\xF5es espec\xEDficas da integra\xE7\xE3o." })
5245
+ return /* @__PURE__ */ jsxs21("div", { className: "space-y-6", children: [
5246
+ /* @__PURE__ */ jsxs21("div", { className: "space-y-2", children: [
5247
+ /* @__PURE__ */ jsx23("h3", { className: "text-lg font-semibold", children: "Configura\xE7\xE3o" }),
5248
+ /* @__PURE__ */ jsx23("p", { className: "text-sm text-muted-foreground", children: "Configure as op\xE7\xF5es espec\xEDficas da integra\xE7\xE3o." })
4913
5249
  ] }),
4914
- isLoading ? /* @__PURE__ */ jsxs19("div", { className: "flex flex-col items-center gap-3 py-8", children: [
4915
- /* @__PURE__ */ jsx21(
5250
+ isLoading ? /* @__PURE__ */ jsxs21("div", { className: "flex flex-col items-center gap-3 py-8", children: [
5251
+ /* @__PURE__ */ jsx23(
4916
5252
  Loader28,
4917
5253
  {
4918
5254
  "aria-hidden": "true",
4919
5255
  className: "h-6 w-6 animate-spin text-muted-foreground"
4920
5256
  }
4921
5257
  ),
4922
- /* @__PURE__ */ jsx21("p", { className: "text-sm text-muted-foreground", children: "Carregando op\xE7\xF5es..." })
4923
- ] }) : options.length === 0 ? /* @__PURE__ */ jsx21("div", { className: "rounded-lg border border-dashed p-6 text-center", children: /* @__PURE__ */ jsx21("p", { className: "text-sm text-muted-foreground", children: "Nenhuma op\xE7\xE3o dispon\xEDvel. A configura\xE7\xE3o padr\xE3o ser\xE1 usada." }) }) : /* @__PURE__ */ jsxs19("div", { className: "space-y-2", children: [
4924
- /* @__PURE__ */ jsx21(Label7, { htmlFor: "integration-config-select", children: label }),
4925
- /* @__PURE__ */ jsxs19(Select3, { value: selectedValue, onValueChange, children: [
4926
- /* @__PURE__ */ jsx21(SelectTrigger3, { id: "integration-config-select", children: /* @__PURE__ */ jsx21(SelectValue3, { placeholder }) }),
4927
- /* @__PURE__ */ jsx21(SelectContent3, { children: options.map((opt) => /* @__PURE__ */ jsxs19(SelectItem3, { value: opt.id, children: [
4928
- /* @__PURE__ */ jsx21("span", { children: opt.label }),
4929
- opt.description && /* @__PURE__ */ jsxs19("span", { className: "ml-2 text-xs text-muted-foreground", children: [
5258
+ /* @__PURE__ */ jsx23("p", { className: "text-sm text-muted-foreground", children: "Carregando op\xE7\xF5es..." })
5259
+ ] }) : options.length === 0 ? /* @__PURE__ */ jsx23("div", { className: "rounded-lg border border-dashed p-6 text-center", children: /* @__PURE__ */ jsx23("p", { className: "text-sm text-muted-foreground", children: "Nenhuma op\xE7\xE3o dispon\xEDvel. A configura\xE7\xE3o padr\xE3o ser\xE1 usada." }) }) : /* @__PURE__ */ jsxs21("div", { className: "space-y-2", children: [
5260
+ /* @__PURE__ */ jsx23(Label8, { htmlFor: "integration-config-select", children: label }),
5261
+ /* @__PURE__ */ jsxs21(Select3, { value: selectedValue, onValueChange, children: [
5262
+ /* @__PURE__ */ jsx23(SelectTrigger3, { id: "integration-config-select", children: /* @__PURE__ */ jsx23(SelectValue3, { placeholder }) }),
5263
+ /* @__PURE__ */ jsx23(SelectContent3, { children: options.map((opt) => /* @__PURE__ */ jsxs21(SelectItem3, { value: opt.id, children: [
5264
+ /* @__PURE__ */ jsx23("span", { children: opt.label }),
5265
+ opt.description && /* @__PURE__ */ jsxs21("span", { className: "ml-2 text-xs text-muted-foreground", children: [
4930
5266
  "(",
4931
5267
  opt.description,
4932
5268
  ")"
@@ -4955,8 +5291,8 @@ function getDefaultPlaceholder(slug) {
4955
5291
 
4956
5292
  // src/components/capabilities/wizard-steps/confirm-step.tsx
4957
5293
  import { CheckCircle2 as CheckCircle22 } from "lucide-react";
4958
- import { Label as Label8 } from "@greatapps/greatauth-ui/ui";
4959
- import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
5294
+ import { Label as Label9 } from "@greatapps/greatauth-ui/ui";
5295
+ import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4960
5296
  function ConfirmStep({
4961
5297
  integration,
4962
5298
  oauthResult,
@@ -4964,22 +5300,22 @@ function ConfirmStep({
4964
5300
  enableOnComplete,
4965
5301
  onEnableChange
4966
5302
  }) {
4967
- return /* @__PURE__ */ jsxs20("div", { className: "space-y-6", children: [
4968
- /* @__PURE__ */ jsxs20("div", { className: "space-y-2", children: [
4969
- /* @__PURE__ */ jsx22("h3", { className: "text-lg font-semibold", children: "Confirma\xE7\xE3o" }),
4970
- /* @__PURE__ */ jsx22("p", { className: "text-sm text-muted-foreground", children: "Revise as configura\xE7\xF5es antes de concluir." })
5303
+ return /* @__PURE__ */ jsxs22("div", { className: "space-y-6", children: [
5304
+ /* @__PURE__ */ jsxs22("div", { className: "space-y-2", children: [
5305
+ /* @__PURE__ */ jsx24("h3", { className: "text-lg font-semibold", children: "Confirma\xE7\xE3o" }),
5306
+ /* @__PURE__ */ jsx24("p", { className: "text-sm text-muted-foreground", children: "Revise as configura\xE7\xF5es antes de concluir." })
4971
5307
  ] }),
4972
- /* @__PURE__ */ jsxs20("div", { className: "space-y-3 rounded-lg border p-4", children: [
4973
- /* @__PURE__ */ jsx22(SummaryRow, { label: "Integra\xE7\xE3o", value: integration.name }),
4974
- oauthResult?.email && /* @__PURE__ */ jsx22(SummaryRow, { label: "Conta conectada", value: oauthResult.email }),
4975
- selectedConfigOption && /* @__PURE__ */ jsx22(
5308
+ /* @__PURE__ */ jsxs22("div", { className: "space-y-3 rounded-lg border p-4", children: [
5309
+ /* @__PURE__ */ jsx24(SummaryRow, { label: "Integra\xE7\xE3o", value: integration.name }),
5310
+ oauthResult?.email && /* @__PURE__ */ jsx24(SummaryRow, { label: "Conta conectada", value: oauthResult.email }),
5311
+ selectedConfigOption && /* @__PURE__ */ jsx24(
4976
5312
  SummaryRow,
4977
5313
  {
4978
5314
  label: getConfigLabel(integration.slug),
4979
5315
  value: selectedConfigOption.label
4980
5316
  }
4981
5317
  ),
4982
- /* @__PURE__ */ jsx22(
5318
+ /* @__PURE__ */ jsx24(
4983
5319
  SummaryRow,
4984
5320
  {
4985
5321
  label: "Tipo de autentica\xE7\xE3o",
@@ -4987,12 +5323,12 @@ function ConfirmStep({
4987
5323
  }
4988
5324
  )
4989
5325
  ] }),
4990
- /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between rounded-lg border p-4", children: [
4991
- /* @__PURE__ */ jsxs20("div", { className: "space-y-0.5", children: [
4992
- /* @__PURE__ */ jsx22(Label8, { htmlFor: "enable-on-complete", className: "text-sm font-medium", children: "Ativar imediatamente" }),
4993
- /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: "A integra\xE7\xE3o ficar\xE1 ativa assim que concluir o assistente." })
5326
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between rounded-lg border p-4", children: [
5327
+ /* @__PURE__ */ jsxs22("div", { className: "space-y-0.5", children: [
5328
+ /* @__PURE__ */ jsx24(Label9, { htmlFor: "enable-on-complete", className: "text-sm font-medium", children: "Ativar imediatamente" }),
5329
+ /* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: "A integra\xE7\xE3o ficar\xE1 ativa assim que concluir o assistente." })
4994
5330
  ] }),
4995
- /* @__PURE__ */ jsx22(
5331
+ /* @__PURE__ */ jsx24(
4996
5332
  "button",
4997
5333
  {
4998
5334
  id: "enable-on-complete",
@@ -5006,7 +5342,7 @@ function ConfirmStep({
5006
5342
  focus-visible:ring-ring focus-visible:ring-offset-2
5007
5343
  ${enableOnComplete ? "bg-primary" : "bg-muted"}
5008
5344
  `,
5009
- children: /* @__PURE__ */ jsx22(
5345
+ children: /* @__PURE__ */ jsx24(
5010
5346
  "span",
5011
5347
  {
5012
5348
  "aria-hidden": "true",
@@ -5020,22 +5356,22 @@ function ConfirmStep({
5020
5356
  }
5021
5357
  )
5022
5358
  ] }),
5023
- /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2 rounded-md bg-green-50 p-3 dark:bg-green-950/20", children: [
5024
- /* @__PURE__ */ jsx22(
5359
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2 rounded-md bg-green-50 p-3 dark:bg-green-950/20", children: [
5360
+ /* @__PURE__ */ jsx24(
5025
5361
  CheckCircle22,
5026
5362
  {
5027
5363
  "aria-hidden": "true",
5028
5364
  className: "h-4 w-4 shrink-0 text-green-600"
5029
5365
  }
5030
5366
  ),
5031
- /* @__PURE__ */ jsx22("p", { className: "text-xs text-green-700 dark:text-green-400", children: 'Tudo pronto! Clique em "Concluir" para finalizar a configura\xE7\xE3o.' })
5367
+ /* @__PURE__ */ jsx24("p", { className: "text-xs text-green-700 dark:text-green-400", children: 'Tudo pronto! Clique em "Concluir" para finalizar a configura\xE7\xE3o.' })
5032
5368
  ] })
5033
5369
  ] });
5034
5370
  }
5035
5371
  function SummaryRow({ label, value }) {
5036
- return /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between text-sm", children: [
5037
- /* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: label }),
5038
- /* @__PURE__ */ jsx22("span", { className: "font-medium", children: value })
5372
+ return /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between text-sm", children: [
5373
+ /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: label }),
5374
+ /* @__PURE__ */ jsx24("span", { className: "font-medium", children: value })
5039
5375
  ] });
5040
5376
  }
5041
5377
  function getConfigLabel(slug) {
@@ -5048,7 +5384,7 @@ function getConfigLabel(slug) {
5048
5384
  }
5049
5385
 
5050
5386
  // src/components/capabilities/integration-wizard.tsx
5051
- import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
5387
+ import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
5052
5388
  var STEPS = ["info", "credentials", "config", "confirm"];
5053
5389
  var STEP_LABELS = {
5054
5390
  info: "Informa\xE7\xE3o",
@@ -5070,18 +5406,18 @@ function IntegrationWizard({
5070
5406
  existingConfigValue
5071
5407
  }) {
5072
5408
  const isReconnect = !!existingCredentialId;
5073
- const [currentStep, setCurrentStep] = useState16("info");
5409
+ const [currentStep, setCurrentStep] = useState18("info");
5074
5410
  const currentIndex = STEPS.indexOf(currentStep);
5075
- const [oauthStatus, setOauthStatus] = useState16("idle");
5076
- const [oauthResult, setOauthResult] = useState16(null);
5077
- const popupRef = useRef2(null);
5078
- const popupPollRef = useRef2(null);
5079
- const [apiKey, setApiKey] = useState16("");
5080
- const [configOptions, setConfigOptions] = useState16([]);
5081
- const [configLoading, setConfigLoading] = useState16(false);
5082
- const [selectedConfigValue, setSelectedConfigValue] = useState16("");
5083
- const [enableOnComplete, setEnableOnComplete] = useState16(true);
5084
- const [isSubmitting, setIsSubmitting] = useState16(false);
5411
+ const [oauthStatus, setOauthStatus] = useState18("idle");
5412
+ const [oauthResult, setOauthResult] = useState18(null);
5413
+ const popupRef = useRef3(null);
5414
+ const popupPollRef = useRef3(null);
5415
+ const [apiKey, setApiKey] = useState18("");
5416
+ const [configOptions, setConfigOptions] = useState18([]);
5417
+ const [configLoading, setConfigLoading] = useState18(false);
5418
+ const [selectedConfigValue, setSelectedConfigValue] = useState18("");
5419
+ const [enableOnComplete, setEnableOnComplete] = useState18(true);
5420
+ const [isSubmitting, setIsSubmitting] = useState18(false);
5085
5421
  useEffect6(() => {
5086
5422
  return () => {
5087
5423
  if (popupPollRef.current) {
@@ -5110,7 +5446,7 @@ function IntegrationWizard({
5110
5446
  }
5111
5447
  }
5112
5448
  }, [open]);
5113
- const handleOAuthMessage = useCallback6(
5449
+ const handleOAuthMessage = useCallback7(
5114
5450
  (event) => {
5115
5451
  try {
5116
5452
  if (event.origin !== new URL(gagentsApiUrl).origin) return;
@@ -5250,11 +5586,11 @@ function IntegrationWizard({
5250
5586
  setIsSubmitting(true);
5251
5587
  try {
5252
5588
  onComplete();
5253
- toast12.success(
5589
+ toast13.success(
5254
5590
  `${integration.name} ${isReconnect ? "reconectado" : "configurado"} com sucesso!`
5255
5591
  );
5256
5592
  } catch {
5257
- toast12.error("Erro ao finalizar configura\xE7\xE3o");
5593
+ toast13.error("Erro ao finalizar configura\xE7\xE3o");
5258
5594
  } finally {
5259
5595
  setIsSubmitting(false);
5260
5596
  }
@@ -5262,18 +5598,18 @@ function IntegrationWizard({
5262
5598
  const selectedConfigOption = configOptions.find((o) => o.id === selectedConfigValue) || null;
5263
5599
  const isLastStep = currentStep === "confirm";
5264
5600
  const effectiveSteps = meta.hasConfigStep ? STEPS : STEPS.filter((s) => s !== "config");
5265
- return /* @__PURE__ */ jsx23(Dialog6, { open, onOpenChange, children: /* @__PURE__ */ jsxs21(DialogContent6, { className: "sm:max-w-lg", children: [
5266
- /* @__PURE__ */ jsx23(DialogHeader6, { children: /* @__PURE__ */ jsx23(DialogTitle6, { children: integration.name }) }),
5267
- /* @__PURE__ */ jsx23(StepIndicator, { steps: effectiveSteps, currentStep }),
5268
- /* @__PURE__ */ jsxs21("div", { className: "min-h-[280px] py-2", children: [
5269
- currentStep === "info" && /* @__PURE__ */ jsx23(
5601
+ return /* @__PURE__ */ jsx25(Dialog7, { open, onOpenChange, children: /* @__PURE__ */ jsxs23(DialogContent7, { className: "sm:max-w-lg", children: [
5602
+ /* @__PURE__ */ jsx25(DialogHeader7, { children: /* @__PURE__ */ jsx25(DialogTitle7, { children: integration.name }) }),
5603
+ /* @__PURE__ */ jsx25(StepIndicator, { steps: effectiveSteps, currentStep }),
5604
+ /* @__PURE__ */ jsxs23("div", { className: "min-h-[280px] py-2", children: [
5605
+ currentStep === "info" && /* @__PURE__ */ jsx25(
5270
5606
  InfoStep,
5271
5607
  {
5272
5608
  integration,
5273
5609
  meta
5274
5610
  }
5275
5611
  ),
5276
- currentStep === "credentials" && /* @__PURE__ */ jsx23(
5612
+ currentStep === "credentials" && /* @__PURE__ */ jsx25(
5277
5613
  CredentialsStep,
5278
5614
  {
5279
5615
  integration,
@@ -5286,7 +5622,7 @@ function IntegrationWizard({
5286
5622
  isReconnect
5287
5623
  }
5288
5624
  ),
5289
- currentStep === "config" && /* @__PURE__ */ jsx23(
5625
+ currentStep === "config" && /* @__PURE__ */ jsx25(
5290
5626
  ConfigStep,
5291
5627
  {
5292
5628
  integration,
@@ -5296,7 +5632,7 @@ function IntegrationWizard({
5296
5632
  onValueChange: setSelectedConfigValue
5297
5633
  }
5298
5634
  ),
5299
- currentStep === "confirm" && /* @__PURE__ */ jsx23(
5635
+ currentStep === "confirm" && /* @__PURE__ */ jsx25(
5300
5636
  ConfirmStep,
5301
5637
  {
5302
5638
  integration,
@@ -5307,48 +5643,48 @@ function IntegrationWizard({
5307
5643
  }
5308
5644
  )
5309
5645
  ] }),
5310
- /* @__PURE__ */ jsxs21(DialogFooter6, { className: "flex-row justify-between sm:justify-between", children: [
5311
- /* @__PURE__ */ jsx23("div", { children: currentStep === "info" ? /* @__PURE__ */ jsx23(
5312
- Button15,
5646
+ /* @__PURE__ */ jsxs23(DialogFooter6, { className: "flex-row justify-between sm:justify-between", children: [
5647
+ /* @__PURE__ */ jsx25("div", { children: currentStep === "info" ? /* @__PURE__ */ jsx25(
5648
+ Button17,
5313
5649
  {
5314
5650
  type: "button",
5315
5651
  variant: "outline",
5316
5652
  onClick: () => onOpenChange(false),
5317
5653
  children: "Cancelar"
5318
5654
  }
5319
- ) : /* @__PURE__ */ jsxs21(
5320
- Button15,
5655
+ ) : /* @__PURE__ */ jsxs23(
5656
+ Button17,
5321
5657
  {
5322
5658
  type: "button",
5323
5659
  variant: "outline",
5324
5660
  onClick: goPrev,
5325
5661
  className: "gap-1",
5326
5662
  children: [
5327
- /* @__PURE__ */ jsx23(ChevronLeft, { "aria-hidden": "true", className: "h-4 w-4" }),
5663
+ /* @__PURE__ */ jsx25(ChevronLeft, { "aria-hidden": "true", className: "h-4 w-4" }),
5328
5664
  "Voltar"
5329
5665
  ]
5330
5666
  }
5331
5667
  ) }),
5332
- /* @__PURE__ */ jsx23("div", { children: isLastStep ? /* @__PURE__ */ jsxs21(
5333
- Button15,
5668
+ /* @__PURE__ */ jsx25("div", { children: isLastStep ? /* @__PURE__ */ jsxs23(
5669
+ Button17,
5334
5670
  {
5335
5671
  type: "button",
5336
5672
  onClick: handleComplete,
5337
5673
  disabled: isSubmitting,
5338
5674
  className: "gap-1",
5339
5675
  children: [
5340
- isSubmitting ? /* @__PURE__ */ jsx23(
5676
+ isSubmitting ? /* @__PURE__ */ jsx25(
5341
5677
  Loader29,
5342
5678
  {
5343
5679
  "aria-hidden": "true",
5344
5680
  className: "h-4 w-4 animate-spin"
5345
5681
  }
5346
- ) : /* @__PURE__ */ jsx23(Check2, { "aria-hidden": "true", className: "h-4 w-4" }),
5682
+ ) : /* @__PURE__ */ jsx25(Check2, { "aria-hidden": "true", className: "h-4 w-4" }),
5347
5683
  "Concluir"
5348
5684
  ]
5349
5685
  }
5350
- ) : /* @__PURE__ */ jsxs21(
5351
- Button15,
5686
+ ) : /* @__PURE__ */ jsxs23(
5687
+ Button17,
5352
5688
  {
5353
5689
  type: "button",
5354
5690
  onClick: goNext,
@@ -5356,7 +5692,7 @@ function IntegrationWizard({
5356
5692
  className: "gap-1",
5357
5693
  children: [
5358
5694
  "Continuar",
5359
- /* @__PURE__ */ jsx23(ChevronRight, { "aria-hidden": "true", className: "h-4 w-4" })
5695
+ /* @__PURE__ */ jsx25(ChevronRight, { "aria-hidden": "true", className: "h-4 w-4" })
5360
5696
  ]
5361
5697
  }
5362
5698
  ) })
@@ -5368,7 +5704,7 @@ function StepIndicator({
5368
5704
  currentStep
5369
5705
  }) {
5370
5706
  const currentIndex = steps.indexOf(currentStep);
5371
- return /* @__PURE__ */ jsx23(
5707
+ return /* @__PURE__ */ jsx25(
5372
5708
  "div",
5373
5709
  {
5374
5710
  className: "flex items-center justify-center gap-1 py-2",
@@ -5377,8 +5713,8 @@ function StepIndicator({
5377
5713
  children: steps.map((step, i) => {
5378
5714
  const isCompleted = i < currentIndex;
5379
5715
  const isCurrent = step === currentStep;
5380
- return /* @__PURE__ */ jsxs21("div", { className: "flex items-center", role: "listitem", children: [
5381
- /* @__PURE__ */ jsx23(
5716
+ return /* @__PURE__ */ jsxs23("div", { className: "flex items-center", role: "listitem", children: [
5717
+ /* @__PURE__ */ jsx25(
5382
5718
  "div",
5383
5719
  {
5384
5720
  className: `
@@ -5388,10 +5724,10 @@ function StepIndicator({
5388
5724
  `,
5389
5725
  "aria-current": isCurrent ? "step" : void 0,
5390
5726
  "aria-label": `${STEP_LABELS[step]}${isCompleted ? " (conclu\xEDdo)" : isCurrent ? " (atual)" : ""}`,
5391
- children: isCompleted ? /* @__PURE__ */ jsx23(Check2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }) : i + 1
5727
+ children: isCompleted ? /* @__PURE__ */ jsx25(Check2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }) : i + 1
5392
5728
  }
5393
5729
  ),
5394
- /* @__PURE__ */ jsx23(
5730
+ /* @__PURE__ */ jsx25(
5395
5731
  "span",
5396
5732
  {
5397
5733
  className: `
@@ -5401,7 +5737,7 @@ function StepIndicator({
5401
5737
  children: STEP_LABELS[step]
5402
5738
  }
5403
5739
  ),
5404
- i < steps.length - 1 && /* @__PURE__ */ jsx23(
5740
+ i < steps.length - 1 && /* @__PURE__ */ jsx25(
5405
5741
  "div",
5406
5742
  {
5407
5743
  className: `
@@ -5417,30 +5753,30 @@ function StepIndicator({
5417
5753
  }
5418
5754
 
5419
5755
  // src/pages/agents-page.tsx
5420
- import { useState as useState17 } from "react";
5421
- import { Button as Button16 } from "@greatapps/greatauth-ui/ui";
5422
- import { Plus as Plus4 } from "lucide-react";
5423
- import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
5756
+ import { useState as useState19 } from "react";
5757
+ import { Button as Button18 } from "@greatapps/greatauth-ui/ui";
5758
+ import { Plus as Plus5 } from "lucide-react";
5759
+ import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
5424
5760
  function AgentsPage({
5425
5761
  config,
5426
5762
  onNavigateToAgent,
5427
5763
  title = "Agentes AI",
5428
5764
  subtitle = "Gerencie seus agentes de atendimento inteligente"
5429
5765
  }) {
5430
- const [createOpen, setCreateOpen] = useState17(false);
5431
- return /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-4 p-4 md:p-6", children: [
5432
- /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between", children: [
5433
- /* @__PURE__ */ jsxs22("div", { children: [
5434
- /* @__PURE__ */ jsx24("h1", { className: "text-xl font-semibold", children: title }),
5435
- /* @__PURE__ */ jsx24("p", { className: "text-sm text-muted-foreground", children: subtitle })
5766
+ const [createOpen, setCreateOpen] = useState19(false);
5767
+ return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-4 p-4 md:p-6", children: [
5768
+ /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5769
+ /* @__PURE__ */ jsxs24("div", { children: [
5770
+ /* @__PURE__ */ jsx26("h1", { className: "text-xl font-semibold", children: title }),
5771
+ /* @__PURE__ */ jsx26("p", { className: "text-sm text-muted-foreground", children: subtitle })
5436
5772
  ] }),
5437
- /* @__PURE__ */ jsxs22(Button16, { onClick: () => setCreateOpen(true), size: "sm", children: [
5438
- /* @__PURE__ */ jsx24(Plus4, { className: "mr-2 h-4 w-4" }),
5773
+ /* @__PURE__ */ jsxs24(Button18, { onClick: () => setCreateOpen(true), size: "sm", children: [
5774
+ /* @__PURE__ */ jsx26(Plus5, { className: "mr-2 h-4 w-4" }),
5439
5775
  "Novo Agente"
5440
5776
  ] })
5441
5777
  ] }),
5442
- /* @__PURE__ */ jsx24(AgentsTable, { config, onNavigateToAgent }),
5443
- /* @__PURE__ */ jsx24(
5778
+ /* @__PURE__ */ jsx26(AgentsTable, { config, onNavigateToAgent }),
5779
+ /* @__PURE__ */ jsx26(
5444
5780
  AgentFormDialog,
5445
5781
  {
5446
5782
  config,
@@ -5452,11 +5788,11 @@ function AgentsPage({
5452
5788
  }
5453
5789
 
5454
5790
  // src/pages/agent-detail-page.tsx
5455
- import { useState as useState18 } from "react";
5456
- import { Badge as Badge10, Button as Button17, Skeleton as Skeleton7 } from "@greatapps/greatauth-ui/ui";
5791
+ import { useState as useState20 } from "react";
5792
+ import { Badge as Badge10, Button as Button19, Skeleton as Skeleton7 } from "@greatapps/greatauth-ui/ui";
5457
5793
  import { EntityAvatar as EntityAvatar2 } from "@greatapps/greatauth-ui";
5458
5794
  import { ArrowLeft, Pencil as Pencil6 } from "lucide-react";
5459
- import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
5795
+ import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
5460
5796
  function AgentDetailPage({
5461
5797
  config,
5462
5798
  agentId,
@@ -5464,42 +5800,42 @@ function AgentDetailPage({
5464
5800
  renderChatLink
5465
5801
  }) {
5466
5802
  const { data: agent, isLoading } = useAgent(config, agentId);
5467
- const [editOpen, setEditOpen] = useState18(false);
5803
+ const [editOpen, setEditOpen] = useState20(false);
5468
5804
  if (isLoading) {
5469
- return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-4 p-4", children: [
5470
- /* @__PURE__ */ jsx25(Skeleton7, { className: "h-4 w-32" }),
5471
- /* @__PURE__ */ jsx25(Skeleton7, { className: "h-8 w-48" }),
5472
- /* @__PURE__ */ jsx25(Skeleton7, { className: "h-10 w-full" }),
5473
- /* @__PURE__ */ jsx25(Skeleton7, { className: "h-64 w-full" })
5805
+ return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4 p-4", children: [
5806
+ /* @__PURE__ */ jsx27(Skeleton7, { className: "h-4 w-32" }),
5807
+ /* @__PURE__ */ jsx27(Skeleton7, { className: "h-8 w-48" }),
5808
+ /* @__PURE__ */ jsx27(Skeleton7, { className: "h-10 w-full" }),
5809
+ /* @__PURE__ */ jsx27(Skeleton7, { className: "h-64 w-full" })
5474
5810
  ] });
5475
5811
  }
5476
5812
  if (!agent) {
5477
- return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col items-center justify-center gap-2 p-8", children: [
5478
- /* @__PURE__ */ jsx25("p", { className: "text-muted-foreground", children: "Agente n\xE3o encontrado" }),
5479
- onBack && /* @__PURE__ */ jsxs23(Button17, { variant: "ghost", size: "sm", onClick: onBack, children: [
5480
- /* @__PURE__ */ jsx25(ArrowLeft, { className: "mr-2 h-4 w-4" }),
5813
+ return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col items-center justify-center gap-2 p-8", children: [
5814
+ /* @__PURE__ */ jsx27("p", { className: "text-muted-foreground", children: "Agente n\xE3o encontrado" }),
5815
+ onBack && /* @__PURE__ */ jsxs25(Button19, { variant: "ghost", size: "sm", onClick: onBack, children: [
5816
+ /* @__PURE__ */ jsx27(ArrowLeft, { className: "mr-2 h-4 w-4" }),
5481
5817
  "Voltar para agentes"
5482
5818
  ] })
5483
5819
  ] });
5484
5820
  }
5485
- return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-6 p-4 md:p-6", children: [
5486
- /* @__PURE__ */ jsx25("div", { className: "rounded-lg border p-4 md:p-6", children: /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-4 md:flex-row md:items-start md:gap-6", children: [
5487
- /* @__PURE__ */ jsxs23("div", { className: "flex items-start gap-3 flex-1", children: [
5488
- onBack && /* @__PURE__ */ jsx25(
5489
- Button17,
5821
+ return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-6 p-4 md:p-6", children: [
5822
+ /* @__PURE__ */ jsx27("div", { className: "rounded-lg border p-4 md:p-6", children: /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4 md:flex-row md:items-start md:gap-6", children: [
5823
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-start gap-3 flex-1", children: [
5824
+ onBack && /* @__PURE__ */ jsx27(
5825
+ Button19,
5490
5826
  {
5491
5827
  variant: "ghost",
5492
5828
  size: "icon",
5493
5829
  "aria-label": "Voltar",
5494
5830
  className: "shrink-0 mt-1",
5495
5831
  onClick: onBack,
5496
- children: /* @__PURE__ */ jsx25(ArrowLeft, { className: "h-4 w-4" })
5832
+ children: /* @__PURE__ */ jsx27(ArrowLeft, { className: "h-4 w-4" })
5497
5833
  }
5498
5834
  ),
5499
- /* @__PURE__ */ jsx25(EntityAvatar2, { photo: agent.photo, name: agent.title, size: "xl" }),
5500
- /* @__PURE__ */ jsx25("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2 flex-wrap", children: [
5501
- /* @__PURE__ */ jsx25("h1", { className: "text-xl font-semibold", children: agent.title }),
5502
- /* @__PURE__ */ jsx25(
5835
+ /* @__PURE__ */ jsx27(EntityAvatar2, { photo: agent.photo, name: agent.title, size: "xl" }),
5836
+ /* @__PURE__ */ jsx27("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2 flex-wrap", children: [
5837
+ /* @__PURE__ */ jsx27("h1", { className: "text-xl font-semibold", children: agent.title }),
5838
+ /* @__PURE__ */ jsx27(
5503
5839
  Badge10,
5504
5840
  {
5505
5841
  variant: agent.active ? "default" : "destructive",
@@ -5509,21 +5845,21 @@ function AgentDetailPage({
5509
5845
  )
5510
5846
  ] }) })
5511
5847
  ] }),
5512
- /* @__PURE__ */ jsxs23(
5513
- Button17,
5848
+ /* @__PURE__ */ jsxs25(
5849
+ Button19,
5514
5850
  {
5515
5851
  variant: "outline",
5516
5852
  size: "sm",
5517
5853
  className: "shrink-0 self-start",
5518
5854
  onClick: () => setEditOpen(true),
5519
5855
  children: [
5520
- /* @__PURE__ */ jsx25(Pencil6, { className: "mr-2 h-4 w-4" }),
5856
+ /* @__PURE__ */ jsx27(Pencil6, { className: "mr-2 h-4 w-4" }),
5521
5857
  "Editar"
5522
5858
  ]
5523
5859
  }
5524
5860
  )
5525
5861
  ] }) }),
5526
- /* @__PURE__ */ jsx25(
5862
+ /* @__PURE__ */ jsx27(
5527
5863
  AgentTabs,
5528
5864
  {
5529
5865
  agent,
@@ -5531,7 +5867,7 @@ function AgentDetailPage({
5531
5867
  renderChatLink
5532
5868
  }
5533
5869
  ),
5534
- editOpen && /* @__PURE__ */ jsx25(
5870
+ editOpen && /* @__PURE__ */ jsx27(
5535
5871
  AgentEditForm,
5536
5872
  {
5537
5873
  agent,
@@ -5552,35 +5888,35 @@ import {
5552
5888
  TabsContent as TabsContent2
5553
5889
  } from "@greatapps/greatauth-ui/ui";
5554
5890
  import { Blocks as Blocks2, Plug as Plug4, Settings as Settings4 } from "lucide-react";
5555
- import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
5891
+ import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
5556
5892
  function AgentCapabilitiesPage({
5557
5893
  config,
5558
5894
  agentId,
5559
5895
  gagentsApiUrl
5560
5896
  }) {
5561
- return /* @__PURE__ */ jsxs24("div", { className: "space-y-4", children: [
5562
- /* @__PURE__ */ jsxs24("div", { children: [
5563
- /* @__PURE__ */ jsx26("h2", { className: "text-lg font-semibold", children: "Capacidades e Integra\xE7\xF5es" }),
5564
- /* @__PURE__ */ jsx26("p", { className: "text-sm text-muted-foreground", children: "Configure o que este agente pode fazer e quais integra\xE7\xF5es ele utiliza." })
5897
+ return /* @__PURE__ */ jsxs26("div", { className: "space-y-4", children: [
5898
+ /* @__PURE__ */ jsxs26("div", { children: [
5899
+ /* @__PURE__ */ jsx28("h2", { className: "text-lg font-semibold", children: "Capacidades e Integra\xE7\xF5es" }),
5900
+ /* @__PURE__ */ jsx28("p", { className: "text-sm text-muted-foreground", children: "Configure o que este agente pode fazer e quais integra\xE7\xF5es ele utiliza." })
5565
5901
  ] }),
5566
- /* @__PURE__ */ jsxs24(Tabs2, { defaultValue: "capacidades", children: [
5567
- /* @__PURE__ */ jsxs24(TabsList2, { children: [
5568
- /* @__PURE__ */ jsxs24(TabsTrigger2, { value: "capacidades", className: "flex items-center gap-1.5", children: [
5569
- /* @__PURE__ */ jsx26(Blocks2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
5902
+ /* @__PURE__ */ jsxs26(Tabs2, { defaultValue: "capacidades", children: [
5903
+ /* @__PURE__ */ jsxs26(TabsList2, { children: [
5904
+ /* @__PURE__ */ jsxs26(TabsTrigger2, { value: "capacidades", className: "flex items-center gap-1.5", children: [
5905
+ /* @__PURE__ */ jsx28(Blocks2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
5570
5906
  "Capacidades"
5571
5907
  ] }),
5572
- /* @__PURE__ */ jsxs24(TabsTrigger2, { value: "integracoes", className: "flex items-center gap-1.5", children: [
5573
- /* @__PURE__ */ jsx26(Plug4, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
5908
+ /* @__PURE__ */ jsxs26(TabsTrigger2, { value: "integracoes", className: "flex items-center gap-1.5", children: [
5909
+ /* @__PURE__ */ jsx28(Plug4, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
5574
5910
  "Integra\xE7\xF5es"
5575
5911
  ] }),
5576
- /* @__PURE__ */ jsxs24(TabsTrigger2, { value: "avancado", className: "flex items-center gap-1.5", children: [
5577
- /* @__PURE__ */ jsx26(Settings4, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
5912
+ /* @__PURE__ */ jsxs26(TabsTrigger2, { value: "avancado", className: "flex items-center gap-1.5", children: [
5913
+ /* @__PURE__ */ jsx28(Settings4, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
5578
5914
  "Avan\xE7ado"
5579
5915
  ] })
5580
5916
  ] }),
5581
- /* @__PURE__ */ jsx26(TabsContent2, { value: "capacidades", className: "mt-4", children: /* @__PURE__ */ jsx26(CapabilitiesTab, { config, agentId }) }),
5582
- /* @__PURE__ */ jsx26(TabsContent2, { value: "integracoes", className: "mt-4", children: /* @__PURE__ */ jsx26(IntegrationsTab, { config, agentId }) }),
5583
- /* @__PURE__ */ jsx26(TabsContent2, { value: "avancado", className: "mt-4", children: /* @__PURE__ */ jsx26(
5917
+ /* @__PURE__ */ jsx28(TabsContent2, { value: "capacidades", className: "mt-4", children: /* @__PURE__ */ jsx28(CapabilitiesTab, { config, agentId }) }),
5918
+ /* @__PURE__ */ jsx28(TabsContent2, { value: "integracoes", className: "mt-4", children: /* @__PURE__ */ jsx28(IntegrationsTab, { config, agentId }) }),
5919
+ /* @__PURE__ */ jsx28(TabsContent2, { value: "avancado", className: "mt-4", children: /* @__PURE__ */ jsx28(
5584
5920
  AdvancedTab,
5585
5921
  {
5586
5922
  config,
@@ -5593,30 +5929,30 @@ function AgentCapabilitiesPage({
5593
5929
  }
5594
5930
 
5595
5931
  // src/pages/tools-page.tsx
5596
- import { useState as useState19 } from "react";
5597
- import { Button as Button18 } from "@greatapps/greatauth-ui/ui";
5598
- import { Plus as Plus5 } from "lucide-react";
5599
- import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
5932
+ import { useState as useState21 } from "react";
5933
+ import { Button as Button20 } from "@greatapps/greatauth-ui/ui";
5934
+ import { Plus as Plus6 } from "lucide-react";
5935
+ import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
5600
5936
  function ToolsPage({
5601
5937
  config,
5602
5938
  title = "Ferramentas",
5603
5939
  subtitle = "Gerencie as ferramentas dispon\xEDveis para seus agentes"
5604
5940
  }) {
5605
- const [createOpen, setCreateOpen] = useState19(false);
5606
- const [editTool, setEditTool] = useState19(void 0);
5607
- return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4 p-4 md:p-6", children: [
5608
- /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between", children: [
5609
- /* @__PURE__ */ jsxs25("div", { children: [
5610
- /* @__PURE__ */ jsx27("h1", { className: "text-xl font-semibold", children: title }),
5611
- /* @__PURE__ */ jsx27("p", { className: "text-sm text-muted-foreground", children: subtitle })
5941
+ const [createOpen, setCreateOpen] = useState21(false);
5942
+ const [editTool, setEditTool] = useState21(void 0);
5943
+ return /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-4 p-4 md:p-6", children: [
5944
+ /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
5945
+ /* @__PURE__ */ jsxs27("div", { children: [
5946
+ /* @__PURE__ */ jsx29("h1", { className: "text-xl font-semibold", children: title }),
5947
+ /* @__PURE__ */ jsx29("p", { className: "text-sm text-muted-foreground", children: subtitle })
5612
5948
  ] }),
5613
- /* @__PURE__ */ jsxs25(Button18, { onClick: () => setCreateOpen(true), size: "sm", children: [
5614
- /* @__PURE__ */ jsx27(Plus5, { className: "mr-2 h-4 w-4" }),
5949
+ /* @__PURE__ */ jsxs27(Button20, { onClick: () => setCreateOpen(true), size: "sm", children: [
5950
+ /* @__PURE__ */ jsx29(Plus6, { className: "mr-2 h-4 w-4" }),
5615
5951
  "Nova Ferramenta"
5616
5952
  ] })
5617
5953
  ] }),
5618
- /* @__PURE__ */ jsx27(ToolsTable, { config, onEdit: (tool) => setEditTool(tool) }),
5619
- /* @__PURE__ */ jsx27(
5954
+ /* @__PURE__ */ jsx29(ToolsTable, { config, onEdit: (tool) => setEditTool(tool) }),
5955
+ /* @__PURE__ */ jsx29(
5620
5956
  ToolFormDialog,
5621
5957
  {
5622
5958
  config,
@@ -5624,7 +5960,7 @@ function ToolsPage({
5624
5960
  onOpenChange: setCreateOpen
5625
5961
  }
5626
5962
  ),
5627
- /* @__PURE__ */ jsx27(
5963
+ /* @__PURE__ */ jsx29(
5628
5964
  ToolFormDialog,
5629
5965
  {
5630
5966
  config,
@@ -5637,7 +5973,7 @@ function ToolsPage({
5637
5973
  }
5638
5974
 
5639
5975
  // src/pages/credentials-page.tsx
5640
- import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
5976
+ import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
5641
5977
  function CredentialsPage({
5642
5978
  config,
5643
5979
  gagentsApiUrl,
@@ -5646,12 +5982,12 @@ function CredentialsPage({
5646
5982
  }) {
5647
5983
  const { data: credentialsData, isLoading: credentialsLoading } = useToolCredentials(config);
5648
5984
  const credentials = credentialsData?.data || [];
5649
- return /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4 p-4 md:p-6", children: [
5650
- /* @__PURE__ */ jsx28("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs26("div", { children: [
5651
- /* @__PURE__ */ jsx28("h1", { className: "text-xl font-semibold", children: title }),
5652
- /* @__PURE__ */ jsx28("p", { className: "text-sm text-muted-foreground", children: subtitle })
5985
+ return /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-4 p-4 md:p-6", children: [
5986
+ /* @__PURE__ */ jsx30("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs28("div", { children: [
5987
+ /* @__PURE__ */ jsx30("h1", { className: "text-xl font-semibold", children: title }),
5988
+ /* @__PURE__ */ jsx30("p", { className: "text-sm text-muted-foreground", children: subtitle })
5653
5989
  ] }) }),
5654
- /* @__PURE__ */ jsx28(
5990
+ /* @__PURE__ */ jsx30(
5655
5991
  ToolCredentialsForm,
5656
5992
  {
5657
5993
  config,
@@ -5664,10 +6000,10 @@ function CredentialsPage({
5664
6000
  }
5665
6001
 
5666
6002
  // src/pages/integrations-management-page.tsx
5667
- import { useCallback as useCallback7, useState as useState20 } from "react";
6003
+ import { useCallback as useCallback8, useState as useState22 } from "react";
5668
6004
  import { useQueryClient as useQueryClient7 } from "@tanstack/react-query";
5669
6005
  import { Plug as Plug5, Loader2 as Loader210 } from "lucide-react";
5670
- import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
6006
+ import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
5671
6007
  function IntegrationsManagementPage({
5672
6008
  config,
5673
6009
  gagentsApiUrl,
@@ -5679,36 +6015,36 @@ function IntegrationsManagementPage({
5679
6015
  }) {
5680
6016
  const queryClient = useQueryClient7();
5681
6017
  const { cards, isLoading: cardsLoading } = useIntegrationState(config, null);
5682
- const [wizardOpen, setWizardOpen] = useState20(false);
5683
- const [activeCard, setActiveCard] = useState20(null);
6018
+ const [wizardOpen, setWizardOpen] = useState22(false);
6019
+ const [activeCard, setActiveCard] = useState22(null);
5684
6020
  const deleteCredential = useDeleteToolCredential(config);
5685
6021
  const updateCredential = useUpdateToolCredential(config);
5686
- const handleConnect = useCallback7((card) => {
6022
+ const handleConnect = useCallback8((card) => {
5687
6023
  setActiveCard(card);
5688
6024
  setWizardOpen(true);
5689
6025
  }, []);
5690
- const handleReconnect = useCallback7((card) => {
6026
+ const handleReconnect = useCallback8((card) => {
5691
6027
  setActiveCard(card);
5692
6028
  setWizardOpen(true);
5693
6029
  }, []);
5694
- const handleDisconnect = useCallback7((card) => {
6030
+ const handleDisconnect = useCallback8((card) => {
5695
6031
  if (!card.credentialId) return;
5696
6032
  updateCredential.mutate({
5697
6033
  id: card.credentialId,
5698
6034
  body: { status: "inactive" }
5699
6035
  });
5700
6036
  }, [updateCredential]);
5701
- const handleDelete = useCallback7((card) => {
6037
+ const handleDelete = useCallback8((card) => {
5702
6038
  if (!card.credentialId) return;
5703
6039
  deleteCredential.mutate(card.credentialId);
5704
6040
  }, [deleteCredential]);
5705
- const handleWizardClose = useCallback7((open) => {
6041
+ const handleWizardClose = useCallback8((open) => {
5706
6042
  if (!open) {
5707
6043
  setActiveCard(null);
5708
6044
  }
5709
6045
  setWizardOpen(open);
5710
6046
  }, []);
5711
- const handleWizardComplete = useCallback7(() => {
6047
+ const handleWizardComplete = useCallback8(() => {
5712
6048
  queryClient.invalidateQueries({ queryKey: ["greatagents", "tool-credentials"] });
5713
6049
  queryClient.invalidateQueries({ queryKey: ["greatagents", "tools"] });
5714
6050
  queryClient.invalidateQueries({ queryKey: ["greatagents", "agent-tools"] });
@@ -5729,18 +6065,18 @@ function IntegrationsManagementPage({
5729
6065
  const otherCards = cards.filter(
5730
6066
  (c) => c.isAddNew || c.state === "coming_soon"
5731
6067
  );
5732
- return /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-4 p-4 md:p-6", children: [
5733
- /* @__PURE__ */ jsx29("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs27("div", { children: [
5734
- /* @__PURE__ */ jsx29("h1", { className: "text-xl font-semibold", children: title }),
5735
- /* @__PURE__ */ jsx29("p", { className: "text-sm text-muted-foreground", children: subtitle })
6068
+ return /* @__PURE__ */ jsxs29("div", { className: "flex flex-col gap-4 p-4 md:p-6", children: [
6069
+ /* @__PURE__ */ jsx31("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs29("div", { children: [
6070
+ /* @__PURE__ */ jsx31("h1", { className: "text-xl font-semibold", children: title }),
6071
+ /* @__PURE__ */ jsx31("p", { className: "text-sm text-muted-foreground", children: subtitle })
5736
6072
  ] }) }),
5737
- cardsLoading ? /* @__PURE__ */ jsx29("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ jsx29(Loader210, { className: "h-6 w-6 animate-spin text-muted-foreground" }) }) : cards.length === 0 ? /* @__PURE__ */ jsxs27("div", { className: "flex flex-col items-center justify-center gap-3 py-16 text-muted-foreground", children: [
5738
- /* @__PURE__ */ jsx29(Plug5, { className: "h-10 w-10" }),
5739
- /* @__PURE__ */ jsx29("p", { className: "text-sm", children: "Nenhuma integra\xE7\xE3o dispon\xEDvel" })
5740
- ] }) : /* @__PURE__ */ jsxs27("div", { className: "space-y-6", children: [
5741
- connectedCards.length > 0 && /* @__PURE__ */ jsxs27("div", { children: [
5742
- /* @__PURE__ */ jsx29("h3", { className: "mb-3 text-xs font-medium uppercase tracking-wider text-muted-foreground", children: "Contas conectadas" }),
5743
- /* @__PURE__ */ jsx29("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3", children: connectedCards.map((card) => /* @__PURE__ */ jsx29(
6073
+ cardsLoading ? /* @__PURE__ */ jsx31("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ jsx31(Loader210, { className: "h-6 w-6 animate-spin text-muted-foreground" }) }) : cards.length === 0 ? /* @__PURE__ */ jsxs29("div", { className: "flex flex-col items-center justify-center gap-3 py-16 text-muted-foreground", children: [
6074
+ /* @__PURE__ */ jsx31(Plug5, { className: "h-10 w-10" }),
6075
+ /* @__PURE__ */ jsx31("p", { className: "text-sm", children: "Nenhuma integra\xE7\xE3o dispon\xEDvel" })
6076
+ ] }) : /* @__PURE__ */ jsxs29("div", { className: "space-y-6", children: [
6077
+ connectedCards.length > 0 && /* @__PURE__ */ jsxs29("div", { children: [
6078
+ /* @__PURE__ */ jsx31("h3", { className: "mb-3 text-xs font-medium uppercase tracking-wider text-muted-foreground", children: "Contas conectadas" }),
6079
+ /* @__PURE__ */ jsx31("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3", children: connectedCards.map((card) => /* @__PURE__ */ jsx31(
5744
6080
  IntegrationCard,
5745
6081
  {
5746
6082
  card,
@@ -5752,11 +6088,11 @@ function IntegrationsManagementPage({
5752
6088
  `${card.definition.slug}-cred-${card.credentialId}`
5753
6089
  )) })
5754
6090
  ] }),
5755
- otherCards.length > 0 && /* @__PURE__ */ jsxs27("div", { children: [
5756
- connectedCards.length > 0 && /* @__PURE__ */ jsx29("h3", { className: "mb-3 text-xs font-medium uppercase tracking-wider text-muted-foreground", children: "Adicionar integra\xE7\xE3o" }),
5757
- /* @__PURE__ */ jsx29("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3", children: otherCards.map((card) => {
6091
+ otherCards.length > 0 && /* @__PURE__ */ jsxs29("div", { children: [
6092
+ connectedCards.length > 0 && /* @__PURE__ */ jsx31("h3", { className: "mb-3 text-xs font-medium uppercase tracking-wider text-muted-foreground", children: "Adicionar integra\xE7\xE3o" }),
6093
+ /* @__PURE__ */ jsx31("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3", children: otherCards.map((card) => {
5758
6094
  const key = card.isAddNew ? `${card.definition.slug}-add-new` : card.definition.slug;
5759
- return /* @__PURE__ */ jsx29(
6095
+ return /* @__PURE__ */ jsx31(
5760
6096
  IntegrationCard,
5761
6097
  {
5762
6098
  card,
@@ -5767,7 +6103,7 @@ function IntegrationsManagementPage({
5767
6103
  }) })
5768
6104
  ] })
5769
6105
  ] }),
5770
- activeCard && wizardMeta && /* @__PURE__ */ jsx29(
6106
+ activeCard && wizardMeta && /* @__PURE__ */ jsx31(
5771
6107
  IntegrationWizard,
5772
6108
  {
5773
6109
  open: wizardOpen,
@@ -5789,16 +6125,18 @@ export {
5789
6125
  AgentCapabilitiesPage,
5790
6126
  AgentConversationsPanel,
5791
6127
  AgentConversationsTable,
6128
+ AgentDefinitionEditor,
5792
6129
  AgentDetailPage,
5793
6130
  AgentEditForm,
5794
6131
  AgentFormDialog,
5795
6132
  AgentObjectivesList,
5796
- AgentPromptEditor,
6133
+ AgentRevisionTab,
5797
6134
  AgentTabs,
5798
6135
  AgentToolsList,
5799
6136
  AgentsPage,
5800
6137
  AgentsTable,
5801
6138
  CapabilitiesTab,
6139
+ ConversationFlowEditor,
5802
6140
  ConversationView,
5803
6141
  CredentialsPage,
5804
6142
  INTEGRATIONS_REGISTRY,