@greatapps/greatagents-ui 0.3.25 → 0.3.27
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.d.ts +13 -1
- package/dist/index.js +143 -79
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client/index.ts +20 -0
- package/src/components/agents/agent-revision-tab.tsx +3 -62
- package/src/hooks/index.ts +1 -1
- package/src/hooks/use-agents.ts +20 -0
- package/src/pages/agent-detail-page.tsx +90 -12
package/dist/index.d.ts
CHANGED
|
@@ -250,6 +250,9 @@ declare function createGagentsClient(config: GagentsClientConfig): {
|
|
|
250
250
|
end_time: string;
|
|
251
251
|
}) => Promise<ApiResponse<AvailabilityResult>>;
|
|
252
252
|
disconnectCalendar: (idAccount: number, externalReference: string, provider?: string) => Promise<ApiResponse<void>>;
|
|
253
|
+
publishAgent: (idAccount: number, agentId: number, changeNotes?: string) => Promise<ApiResponse<{
|
|
254
|
+
version: number;
|
|
255
|
+
}>>;
|
|
253
256
|
getCapabilities: (idAccount: number) => Promise<ApiResponse<CapabilitiesResponse>>;
|
|
254
257
|
getAgentCapabilities: (idAccount: number, idAgent: number) => Promise<ApiResponse<AgentCapability[]>>;
|
|
255
258
|
updateAgentCapabilities: (idAccount: number, idAgent: number, body: AgentCapabilitiesPayload) => Promise<ApiResponse<AgentCapability[]>>;
|
|
@@ -311,6 +314,9 @@ declare function useGagentsClient(config: GagentsHookConfig): {
|
|
|
311
314
|
end_time: string;
|
|
312
315
|
}) => Promise<ApiResponse<AvailabilityResult>>;
|
|
313
316
|
disconnectCalendar: (idAccount: number, externalReference: string, provider?: string) => Promise<ApiResponse<void>>;
|
|
317
|
+
publishAgent: (idAccount: number, agentId: number, changeNotes?: string) => Promise<ApiResponse<{
|
|
318
|
+
version: number;
|
|
319
|
+
}>>;
|
|
314
320
|
getCapabilities: (idAccount: number) => Promise<ApiResponse<CapabilitiesResponse>>;
|
|
315
321
|
getAgentCapabilities: (idAccount: number, idAgent: number) => Promise<ApiResponse<AgentCapability[]>>;
|
|
316
322
|
updateAgentCapabilities: (idAccount: number, idAgent: number, body: AgentCapabilitiesPayload) => Promise<ApiResponse<AgentCapability[]>>;
|
|
@@ -344,6 +350,12 @@ declare function useUpdateAgent(config: GagentsHookConfig): _tanstack_react_quer
|
|
|
344
350
|
active?: boolean;
|
|
345
351
|
};
|
|
346
352
|
}, unknown>;
|
|
353
|
+
declare function usePublishAgent(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<{
|
|
354
|
+
version: number;
|
|
355
|
+
}>, Error, {
|
|
356
|
+
id: number;
|
|
357
|
+
changeNotes?: string;
|
|
358
|
+
}, unknown>;
|
|
347
359
|
declare function useDeleteAgent(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<void>, Error, number, unknown>;
|
|
348
360
|
|
|
349
361
|
declare function useTools(config: GagentsHookConfig, params?: Record<string, string>): _tanstack_react_query.UseQueryResult<{
|
|
@@ -822,4 +834,4 @@ interface IntegrationsManagementPageProps {
|
|
|
822
834
|
}
|
|
823
835
|
declare function IntegrationsManagementPage({ config, gagentsApiUrl, resolveWizardMeta, loadConfigOptions, onWizardComplete, title, subtitle, }: IntegrationsManagementPageProps): react_jsx_runtime.JSX.Element;
|
|
824
836
|
|
|
825
|
-
export { AdvancedTab, type AdvancedTabProps, type Agent, AgentCapabilitiesPage, type AgentCapabilitiesPageProps, type AgentCapabilitiesPayload, type AgentCapability, AgentConversationsPanel, AgentConversationsTable, AgentDefinitionEditor, AgentDetailPage, type AgentDetailPageProps, AgentEditForm, AgentFormDialog, AgentObjectivesList, AgentRevisionTab, AgentTabs, type AgentTool, AgentToolsList, AgentsPage, type AgentsPageProps, AgentsTable, type ApiResponse, type AvailabilityConflict, type AvailabilityResult, type CalendarStatus, type CapabilitiesResponse, CapabilitiesTab, type CapabilitiesTabProps, type CapabilityCategory, type CapabilityModule, type CapabilityOperation, type ConfigOption, type ContactUser, type Conversation, ConversationFlowEditor, type ConversationFlowStep, ConversationView, CredentialsPage, type CredentialsPageProps, type GagentsClient, type GagentsClientConfig, type GagentsContact, type GagentsHookConfig, INTEGRATIONS_REGISTRY, type IntegrationAuthType, type IntegrationCapability, IntegrationCard, type IntegrationCardData, type IntegrationCardProps, type IntegrationCardState, type IntegrationDefinition, type IntegrationStatus, IntegrationWizard, type IntegrationWizardProps, IntegrationsManagementPage, type IntegrationsManagementPageProps, IntegrationsTab, type IntegrationsTabProps, type OAuthResult, type OAuthStatus, type Objective, type PromptVersion, Sortable, SortableContent, SortableItem, SortableItemHandle, SortableOverlay, type Tool, type ToolCredential, ToolCredentialsForm, ToolFormDialog, ToolsPage, type ToolsPageProps, ToolsTable, type WizardIntegrationMeta, type WizardStep, cn, createGagentsClient, useAddAgentTool, useAgent, useAgentCapabilities, useAgentConversations, useAgentTools, useAgents, useCapabilities, useContactUsers, useConversation, useConversations, useCreateAgent, useCreateObjective, useCreateTool, useCreateToolCredential, useDeleteAgent, useDeleteObjective, useDeleteTool, useDeleteToolCredential, useGagentsClient, useGagentsContacts, useIntegrationState, useObjectives, usePromptVersions, useRemoveAgentTool, useTool, useToolCredentials, useTools, useUpdateAgent, useUpdateAgentCapabilities, useUpdateAgentTool, useUpdateObjective, useUpdateTool, useUpdateToolCredential };
|
|
837
|
+
export { AdvancedTab, type AdvancedTabProps, type Agent, AgentCapabilitiesPage, type AgentCapabilitiesPageProps, type AgentCapabilitiesPayload, type AgentCapability, AgentConversationsPanel, AgentConversationsTable, AgentDefinitionEditor, AgentDetailPage, type AgentDetailPageProps, AgentEditForm, AgentFormDialog, AgentObjectivesList, AgentRevisionTab, AgentTabs, type AgentTool, AgentToolsList, AgentsPage, type AgentsPageProps, AgentsTable, type ApiResponse, type AvailabilityConflict, type AvailabilityResult, type CalendarStatus, type CapabilitiesResponse, CapabilitiesTab, type CapabilitiesTabProps, type CapabilityCategory, type CapabilityModule, type CapabilityOperation, type ConfigOption, type ContactUser, type Conversation, ConversationFlowEditor, type ConversationFlowStep, ConversationView, CredentialsPage, type CredentialsPageProps, type GagentsClient, type GagentsClientConfig, type GagentsContact, type GagentsHookConfig, INTEGRATIONS_REGISTRY, type IntegrationAuthType, type IntegrationCapability, IntegrationCard, type IntegrationCardData, type IntegrationCardProps, type IntegrationCardState, type IntegrationDefinition, type IntegrationStatus, IntegrationWizard, type IntegrationWizardProps, IntegrationsManagementPage, type IntegrationsManagementPageProps, IntegrationsTab, type IntegrationsTabProps, type OAuthResult, type OAuthStatus, type Objective, type PromptVersion, Sortable, SortableContent, SortableItem, SortableItemHandle, SortableOverlay, type Tool, type ToolCredential, ToolCredentialsForm, ToolFormDialog, ToolsPage, type ToolsPageProps, ToolsTable, type WizardIntegrationMeta, type WizardStep, cn, createGagentsClient, useAddAgentTool, useAgent, useAgentCapabilities, useAgentConversations, useAgentTools, useAgents, useCapabilities, useContactUsers, useConversation, useConversations, useCreateAgent, useCreateObjective, useCreateTool, useCreateToolCredential, useDeleteAgent, useDeleteObjective, useDeleteTool, useDeleteToolCredential, useGagentsClient, useGagentsContacts, useIntegrationState, useObjectives, usePromptVersions, usePublishAgent, useRemoveAgentTool, useTool, useToolCredentials, useTools, useUpdateAgent, useUpdateAgentCapabilities, useUpdateAgentTool, useUpdateObjective, useUpdateTool, useUpdateToolCredential };
|
package/dist/index.js
CHANGED
|
@@ -89,6 +89,21 @@ function createGagentsClient(config) {
|
|
|
89
89
|
void 0,
|
|
90
90
|
{ provider }
|
|
91
91
|
),
|
|
92
|
+
// --- Publish ---
|
|
93
|
+
publishAgent: async (idAccount, agentId, changeNotes) => {
|
|
94
|
+
const url = buildUrl(idAccount, `agents/${agentId}/publish`);
|
|
95
|
+
const res = await fetch(url, {
|
|
96
|
+
method: "POST",
|
|
97
|
+
headers: {
|
|
98
|
+
Authorization: `Bearer ${token}`,
|
|
99
|
+
"Content-Type": "application/json"
|
|
100
|
+
},
|
|
101
|
+
body: JSON.stringify({ change_notes: changeNotes || "" })
|
|
102
|
+
});
|
|
103
|
+
const json = await res.json();
|
|
104
|
+
if (json.status === 0 && !res.ok) throw new Error(json.message || "Erro ao publicar");
|
|
105
|
+
return json;
|
|
106
|
+
},
|
|
92
107
|
// --- Capabilities ---
|
|
93
108
|
getCapabilities: (idAccount) => request("GET", idAccount, "capabilities"),
|
|
94
109
|
getAgentCapabilities: (idAccount, idAgent) => request("GET", idAccount, `agents/${idAgent}/capabilities`),
|
|
@@ -169,6 +184,24 @@ function useUpdateAgent(config) {
|
|
|
169
184
|
}
|
|
170
185
|
});
|
|
171
186
|
}
|
|
187
|
+
function usePublishAgent(config) {
|
|
188
|
+
const queryClient = useQueryClient();
|
|
189
|
+
const client = useGagentsClient(config);
|
|
190
|
+
return useMutation({
|
|
191
|
+
mutationFn: async (variables) => {
|
|
192
|
+
return client.publishAgent(Number(config.accountId), variables.id, variables.changeNotes);
|
|
193
|
+
},
|
|
194
|
+
onSuccess: (_data, variables) => {
|
|
195
|
+
queryClient.invalidateQueries({ queryKey: ["greatagents", "agents"] });
|
|
196
|
+
queryClient.invalidateQueries({
|
|
197
|
+
queryKey: ["greatagents", "agent", config.accountId, variables.id]
|
|
198
|
+
});
|
|
199
|
+
queryClient.invalidateQueries({
|
|
200
|
+
queryKey: ["greatagents", "prompt-versions", config.accountId, variables.id]
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
172
205
|
function useDeleteAgent(config) {
|
|
173
206
|
const client = useGagentsClient(config);
|
|
174
207
|
const queryClient = useQueryClient();
|
|
@@ -2404,16 +2437,11 @@ import { useState as useState8, useMemo as useMemo6 } from "react";
|
|
|
2404
2437
|
import {
|
|
2405
2438
|
Button as Button7,
|
|
2406
2439
|
Badge as Badge3,
|
|
2407
|
-
Skeleton as Skeleton2
|
|
2408
|
-
Dialog,
|
|
2409
|
-
DialogContent,
|
|
2410
|
-
DialogHeader,
|
|
2411
|
-
DialogTitle
|
|
2440
|
+
Skeleton as Skeleton2
|
|
2412
2441
|
} from "@greatapps/greatauth-ui/ui";
|
|
2413
|
-
import { FileText, RotateCcw, X
|
|
2442
|
+
import { FileText, RotateCcw, X } from "lucide-react";
|
|
2414
2443
|
import { toast as toast6 } from "sonner";
|
|
2415
|
-
import {
|
|
2416
|
-
var STRUCTURED_MARKERS = ["[IDENTIDADE]", "[MISS\xC3O]", "[TOM, ESTILO & FORMATO]"];
|
|
2444
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2417
2445
|
function formatDate(dateStr) {
|
|
2418
2446
|
const date = new Date(dateStr);
|
|
2419
2447
|
return date.toLocaleDateString("pt-BR", {
|
|
@@ -2489,14 +2517,9 @@ ${agent.context.trim()}`);
|
|
|
2489
2517
|
}
|
|
2490
2518
|
return sections.join("\n\n");
|
|
2491
2519
|
}
|
|
2492
|
-
function isLegacyVersion(version) {
|
|
2493
|
-
const content = version.prompt_content ?? "";
|
|
2494
|
-
return !STRUCTURED_MARKERS.some((marker) => content.includes(marker));
|
|
2495
|
-
}
|
|
2496
2520
|
function AgentRevisionTab({ agent, config }) {
|
|
2497
2521
|
const { data: versionsData, isLoading } = usePromptVersions(config, agent.id);
|
|
2498
2522
|
const [compareVersionId, setCompareVersionId] = useState8(null);
|
|
2499
|
-
const [legacyModalVersion, setLegacyModalVersion] = useState8(null);
|
|
2500
2523
|
const versions = versionsData?.data || [];
|
|
2501
2524
|
const sortedVersions = [...versions].sort(
|
|
2502
2525
|
(a, b) => new Date(b.datetime_add).getTime() - new Date(a.datetime_add).getTime()
|
|
@@ -2514,12 +2537,8 @@ function AgentRevisionTab({ agent, config }) {
|
|
|
2514
2537
|
const tokenEstimate = Math.ceil(charCount / 4);
|
|
2515
2538
|
const compareVersion = sortedVersions.find((v) => v.id === compareVersionId);
|
|
2516
2539
|
const diffLines = currentVersion && compareVersion && compareVersion.id !== currentVersion.id ? computeDiff(compareVersion.prompt_content ?? "", currentVersion.prompt_content ?? "") : null;
|
|
2517
|
-
function handleRestore(
|
|
2518
|
-
|
|
2519
|
-
setLegacyModalVersion(version);
|
|
2520
|
-
} else {
|
|
2521
|
-
toast6.info("Restaurar vers\xE3o estruturada \u2014 funcionalidade em desenvolvimento");
|
|
2522
|
-
}
|
|
2540
|
+
function handleRestore(_version) {
|
|
2541
|
+
toast6.info("Restaurar vers\xE3o \u2014 funcionalidade em desenvolvimento");
|
|
2523
2542
|
}
|
|
2524
2543
|
if (isLoading) {
|
|
2525
2544
|
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)) });
|
|
@@ -2652,38 +2671,7 @@ function AgentRevisionTab({ agent, config }) {
|
|
|
2652
2671
|
version.id
|
|
2653
2672
|
);
|
|
2654
2673
|
}) })
|
|
2655
|
-
] })
|
|
2656
|
-
/* @__PURE__ */ jsx8(
|
|
2657
|
-
Dialog,
|
|
2658
|
-
{
|
|
2659
|
-
open: !!legacyModalVersion,
|
|
2660
|
-
onOpenChange: (open) => {
|
|
2661
|
-
if (!open) setLegacyModalVersion(null);
|
|
2662
|
-
},
|
|
2663
|
-
children: /* @__PURE__ */ jsxs7(DialogContent, { className: "max-w-2xl", children: [
|
|
2664
|
-
/* @__PURE__ */ jsx8(DialogHeader, { children: /* @__PURE__ */ jsxs7(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
2665
|
-
/* @__PURE__ */ jsx8(AlertTriangle, { className: "h-5 w-5 text-amber-500" }),
|
|
2666
|
-
"Vers\xE3o Legada \u2014 v",
|
|
2667
|
-
legacyModalVersion?.version_number
|
|
2668
|
-
] }) }),
|
|
2669
|
-
/* @__PURE__ */ jsxs7("div", { className: "space-y-3", children: [
|
|
2670
|
-
/* @__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." }) }),
|
|
2671
|
-
/* @__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 ?? "" }) }),
|
|
2672
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-3 text-xs text-muted-foreground", children: [
|
|
2673
|
-
/* @__PURE__ */ jsxs7("span", { children: [
|
|
2674
|
-
(legacyModalVersion?.prompt_content ?? "").length.toLocaleString("pt-BR"),
|
|
2675
|
-
" caracteres"
|
|
2676
|
-
] }),
|
|
2677
|
-
legacyModalVersion?.change_notes && /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
2678
|
-
/* @__PURE__ */ jsx8("span", { children: "\xB7" }),
|
|
2679
|
-
/* @__PURE__ */ jsx8("span", { className: "italic", children: legacyModalVersion.change_notes })
|
|
2680
|
-
] })
|
|
2681
|
-
] })
|
|
2682
|
-
] }),
|
|
2683
|
-
/* @__PURE__ */ jsx8("div", { className: "flex justify-end pt-2", children: /* @__PURE__ */ jsx8(Button7, { variant: "outline", onClick: () => setLegacyModalVersion(null), children: "Fechar" }) })
|
|
2684
|
-
] })
|
|
2685
|
-
}
|
|
2686
|
-
)
|
|
2674
|
+
] })
|
|
2687
2675
|
] });
|
|
2688
2676
|
}
|
|
2689
2677
|
|
|
@@ -4127,7 +4115,7 @@ import { Pencil as Pencil5, Trash2 as Trash25, Search as Search2 } from "lucide-
|
|
|
4127
4115
|
import { format as format2 } from "date-fns";
|
|
4128
4116
|
import { ptBR as ptBR2 } from "date-fns/locale";
|
|
4129
4117
|
import { toast as toast10 } from "sonner";
|
|
4130
|
-
import { Fragment as
|
|
4118
|
+
import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4131
4119
|
function useColumns2(onEdit, onDelete) {
|
|
4132
4120
|
return [
|
|
4133
4121
|
{
|
|
@@ -4236,7 +4224,7 @@ function ToolsTable({ onEdit, config }) {
|
|
|
4236
4224
|
setSearch(value);
|
|
4237
4225
|
setPage(1);
|
|
4238
4226
|
}
|
|
4239
|
-
return /* @__PURE__ */ jsxs14(
|
|
4227
|
+
return /* @__PURE__ */ jsxs14(Fragment3, { children: [
|
|
4240
4228
|
/* @__PURE__ */ jsx16("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs14("div", { className: "relative flex-1 max-w-md", children: [
|
|
4241
4229
|
/* @__PURE__ */ jsx16(Search2, { "aria-hidden": "true", className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
4242
4230
|
/* @__PURE__ */ jsx16(
|
|
@@ -4785,7 +4773,7 @@ import {
|
|
|
4785
4773
|
Unplug,
|
|
4786
4774
|
Trash2 as Trash27
|
|
4787
4775
|
} from "lucide-react";
|
|
4788
|
-
import { Fragment as
|
|
4776
|
+
import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4789
4777
|
var ICON_MAP2 = {
|
|
4790
4778
|
CalendarSync: CalendarSync2,
|
|
4791
4779
|
Plug: Plug3,
|
|
@@ -4891,7 +4879,7 @@ function IntegrationCard({
|
|
|
4891
4879
|
);
|
|
4892
4880
|
}
|
|
4893
4881
|
const badge = STATE_BADGES[state];
|
|
4894
|
-
return /* @__PURE__ */ jsxs17(
|
|
4882
|
+
return /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
4895
4883
|
/* @__PURE__ */ jsxs17(
|
|
4896
4884
|
"div",
|
|
4897
4885
|
{
|
|
@@ -5033,11 +5021,11 @@ function AdvancedTab({ config, agentId, gagentsApiUrl }) {
|
|
|
5033
5021
|
// src/components/capabilities/integration-wizard.tsx
|
|
5034
5022
|
import { useCallback as useCallback7, useEffect as useEffect6, useRef as useRef3, useState as useState18 } from "react";
|
|
5035
5023
|
import {
|
|
5036
|
-
Dialog
|
|
5037
|
-
DialogContent
|
|
5024
|
+
Dialog,
|
|
5025
|
+
DialogContent,
|
|
5038
5026
|
DialogFooter,
|
|
5039
|
-
DialogHeader
|
|
5040
|
-
DialogTitle
|
|
5027
|
+
DialogHeader,
|
|
5028
|
+
DialogTitle,
|
|
5041
5029
|
Button as Button17
|
|
5042
5030
|
} from "@greatapps/greatauth-ui/ui";
|
|
5043
5031
|
import { Loader2 as Loader29, ChevronLeft, ChevronRight, Check as Check2 } from "lucide-react";
|
|
@@ -5625,8 +5613,8 @@ function IntegrationWizard({
|
|
|
5625
5613
|
const selectedConfigOption = configOptions.find((o) => o.id === selectedConfigValue) || null;
|
|
5626
5614
|
const isLastStep = currentStep === "confirm";
|
|
5627
5615
|
const effectiveSteps = meta.hasConfigStep ? STEPS : STEPS.filter((s) => s !== "config");
|
|
5628
|
-
return /* @__PURE__ */ jsx25(
|
|
5629
|
-
/* @__PURE__ */ jsx25(
|
|
5616
|
+
return /* @__PURE__ */ jsx25(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs23(DialogContent, { className: "sm:max-w-lg", children: [
|
|
5617
|
+
/* @__PURE__ */ jsx25(DialogHeader, { children: /* @__PURE__ */ jsx25(DialogTitle, { children: integration.name }) }),
|
|
5630
5618
|
/* @__PURE__ */ jsx25(StepIndicator, { steps: effectiveSteps, currentStep }),
|
|
5631
5619
|
/* @__PURE__ */ jsxs23("div", { className: "min-h-[280px] py-2", children: [
|
|
5632
5620
|
currentStep === "info" && /* @__PURE__ */ jsx25(
|
|
@@ -5816,9 +5804,23 @@ function AgentsPage({
|
|
|
5816
5804
|
|
|
5817
5805
|
// src/pages/agent-detail-page.tsx
|
|
5818
5806
|
import { useState as useState20 } from "react";
|
|
5819
|
-
import {
|
|
5807
|
+
import {
|
|
5808
|
+
AlertDialog as AlertDialog7,
|
|
5809
|
+
AlertDialogAction as AlertDialogAction7,
|
|
5810
|
+
AlertDialogCancel as AlertDialogCancel7,
|
|
5811
|
+
AlertDialogContent as AlertDialogContent7,
|
|
5812
|
+
AlertDialogDescription as AlertDialogDescription7,
|
|
5813
|
+
AlertDialogFooter as AlertDialogFooter7,
|
|
5814
|
+
AlertDialogHeader as AlertDialogHeader7,
|
|
5815
|
+
AlertDialogTitle as AlertDialogTitle7,
|
|
5816
|
+
Badge as Badge10,
|
|
5817
|
+
Button as Button19,
|
|
5818
|
+
Input as Input10,
|
|
5819
|
+
Skeleton as Skeleton7
|
|
5820
|
+
} from "@greatapps/greatauth-ui/ui";
|
|
5820
5821
|
import { EntityAvatar as EntityAvatar2 } from "@greatapps/greatauth-ui";
|
|
5821
|
-
import { ArrowLeft, Pencil as Pencil6 } from "lucide-react";
|
|
5822
|
+
import { ArrowLeft, Loader2 as Loader210, Pencil as Pencil6, Upload } from "lucide-react";
|
|
5823
|
+
import { toast as toast14 } from "sonner";
|
|
5822
5824
|
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5823
5825
|
function AgentDetailPage({
|
|
5824
5826
|
config,
|
|
@@ -5827,7 +5829,25 @@ function AgentDetailPage({
|
|
|
5827
5829
|
renderChatLink
|
|
5828
5830
|
}) {
|
|
5829
5831
|
const { data: agent, isLoading } = useAgent(config, agentId);
|
|
5832
|
+
const publishAgent = usePublishAgent(config);
|
|
5830
5833
|
const [editOpen, setEditOpen] = useState20(false);
|
|
5834
|
+
const [publishOpen, setPublishOpen] = useState20(false);
|
|
5835
|
+
const [publishNotes, setPublishNotes] = useState20("");
|
|
5836
|
+
async function handlePublish() {
|
|
5837
|
+
if (!agent) return;
|
|
5838
|
+
try {
|
|
5839
|
+
const result = await publishAgent.mutateAsync({ id: agent.id, changeNotes: publishNotes.trim() });
|
|
5840
|
+
setPublishOpen(false);
|
|
5841
|
+
setPublishNotes("");
|
|
5842
|
+
if (result.message?.includes("Sem altera\xE7\xF5es")) {
|
|
5843
|
+
toast14.info(result.message);
|
|
5844
|
+
} else {
|
|
5845
|
+
toast14.success(result.message || "Agente publicado");
|
|
5846
|
+
}
|
|
5847
|
+
} catch (err) {
|
|
5848
|
+
toast14.error(err instanceof Error ? err.message : "Erro ao publicar agente");
|
|
5849
|
+
}
|
|
5850
|
+
}
|
|
5831
5851
|
if (isLoading) {
|
|
5832
5852
|
return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4 p-4", children: [
|
|
5833
5853
|
/* @__PURE__ */ jsx27(Skeleton7, { className: "h-4 w-32" }),
|
|
@@ -5872,19 +5892,33 @@ function AgentDetailPage({
|
|
|
5872
5892
|
)
|
|
5873
5893
|
] }) })
|
|
5874
5894
|
] }),
|
|
5875
|
-
/* @__PURE__ */ jsxs25(
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5895
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex gap-2 shrink-0 self-start", children: [
|
|
5896
|
+
/* @__PURE__ */ jsxs25(
|
|
5897
|
+
Button19,
|
|
5898
|
+
{
|
|
5899
|
+
variant: "default",
|
|
5900
|
+
size: "sm",
|
|
5901
|
+
onClick: () => setPublishOpen(true),
|
|
5902
|
+
disabled: publishAgent.isPending,
|
|
5903
|
+
children: [
|
|
5904
|
+
publishAgent.isPending ? /* @__PURE__ */ jsx27(Loader210, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx27(Upload, { className: "mr-2 h-4 w-4" }),
|
|
5905
|
+
"Publicar"
|
|
5906
|
+
]
|
|
5907
|
+
}
|
|
5908
|
+
),
|
|
5909
|
+
/* @__PURE__ */ jsxs25(
|
|
5910
|
+
Button19,
|
|
5911
|
+
{
|
|
5912
|
+
variant: "outline",
|
|
5913
|
+
size: "sm",
|
|
5914
|
+
onClick: () => setEditOpen(true),
|
|
5915
|
+
children: [
|
|
5916
|
+
/* @__PURE__ */ jsx27(Pencil6, { className: "mr-2 h-4 w-4" }),
|
|
5917
|
+
"Editar"
|
|
5918
|
+
]
|
|
5919
|
+
}
|
|
5920
|
+
)
|
|
5921
|
+
] })
|
|
5888
5922
|
] }) }),
|
|
5889
5923
|
/* @__PURE__ */ jsx27(
|
|
5890
5924
|
AgentTabs,
|
|
@@ -5903,7 +5937,36 @@ function AgentDetailPage({
|
|
|
5903
5937
|
open: editOpen,
|
|
5904
5938
|
onOpenChange: setEditOpen
|
|
5905
5939
|
}
|
|
5906
|
-
)
|
|
5940
|
+
),
|
|
5941
|
+
/* @__PURE__ */ jsx27(AlertDialog7, { open: publishOpen, onOpenChange: setPublishOpen, children: /* @__PURE__ */ jsxs25(AlertDialogContent7, { children: [
|
|
5942
|
+
/* @__PURE__ */ jsxs25(AlertDialogHeader7, { children: [
|
|
5943
|
+
/* @__PURE__ */ jsx27(AlertDialogTitle7, { children: "Publicar nova vers\xE3o do agente?" }),
|
|
5944
|
+
/* @__PURE__ */ jsx27(AlertDialogDescription7, { children: "O prompt ser\xE1 actualizado com todas as configura\xE7\xF5es actuais e uma nova vers\xE3o ser\xE1 criada." })
|
|
5945
|
+
] }),
|
|
5946
|
+
/* @__PURE__ */ jsx27("div", { className: "py-2", children: /* @__PURE__ */ jsx27(
|
|
5947
|
+
Input10,
|
|
5948
|
+
{
|
|
5949
|
+
value: publishNotes,
|
|
5950
|
+
onChange: (e) => setPublishNotes(e.target.value),
|
|
5951
|
+
placeholder: "O que mudou? (opcional)",
|
|
5952
|
+
onKeyDown: (e) => {
|
|
5953
|
+
if (e.key === "Enter") {
|
|
5954
|
+
e.preventDefault();
|
|
5955
|
+
handlePublish();
|
|
5956
|
+
}
|
|
5957
|
+
}
|
|
5958
|
+
}
|
|
5959
|
+
) }),
|
|
5960
|
+
/* @__PURE__ */ jsxs25(AlertDialogFooter7, { children: [
|
|
5961
|
+
/* @__PURE__ */ jsx27(AlertDialogCancel7, { onClick: () => {
|
|
5962
|
+
setPublishNotes("");
|
|
5963
|
+
}, children: "Cancelar" }),
|
|
5964
|
+
/* @__PURE__ */ jsxs25(AlertDialogAction7, { onClick: handlePublish, disabled: publishAgent.isPending, children: [
|
|
5965
|
+
publishAgent.isPending && /* @__PURE__ */ jsx27(Loader210, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
5966
|
+
"Publicar"
|
|
5967
|
+
] })
|
|
5968
|
+
] })
|
|
5969
|
+
] }) })
|
|
5907
5970
|
] });
|
|
5908
5971
|
}
|
|
5909
5972
|
|
|
@@ -6029,7 +6092,7 @@ function CredentialsPage({
|
|
|
6029
6092
|
// src/pages/integrations-management-page.tsx
|
|
6030
6093
|
import { useCallback as useCallback8, useState as useState22 } from "react";
|
|
6031
6094
|
import { useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
6032
|
-
import { Plug as Plug5, Loader2 as
|
|
6095
|
+
import { Plug as Plug5, Loader2 as Loader211 } from "lucide-react";
|
|
6033
6096
|
import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6034
6097
|
function IntegrationsManagementPage({
|
|
6035
6098
|
config,
|
|
@@ -6097,7 +6160,7 @@ function IntegrationsManagementPage({
|
|
|
6097
6160
|
/* @__PURE__ */ jsx31("h1", { className: "text-xl font-semibold", children: title }),
|
|
6098
6161
|
/* @__PURE__ */ jsx31("p", { className: "text-sm text-muted-foreground", children: subtitle })
|
|
6099
6162
|
] }) }),
|
|
6100
|
-
cardsLoading ? /* @__PURE__ */ jsx31("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ jsx31(
|
|
6163
|
+
cardsLoading ? /* @__PURE__ */ jsx31("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ jsx31(Loader211, { 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: [
|
|
6101
6164
|
/* @__PURE__ */ jsx31(Plug5, { className: "h-10 w-10" }),
|
|
6102
6165
|
/* @__PURE__ */ jsx31("p", { className: "text-sm", children: "Nenhuma integra\xE7\xE3o dispon\xEDvel" })
|
|
6103
6166
|
] }) : /* @__PURE__ */ jsxs29("div", { className: "space-y-6", children: [
|
|
@@ -6205,6 +6268,7 @@ export {
|
|
|
6205
6268
|
useIntegrationState,
|
|
6206
6269
|
useObjectives,
|
|
6207
6270
|
usePromptVersions,
|
|
6271
|
+
usePublishAgent,
|
|
6208
6272
|
useRemoveAgentTool,
|
|
6209
6273
|
useTool,
|
|
6210
6274
|
useToolCredentials,
|