@greatapps/greatagents-ui 0.3.3 → 0.3.5

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 CHANGED
@@ -5,6 +5,34 @@ import { DndContextProps, UniqueIdentifier, DragEndEvent, DragOverlay } from '@d
5
5
  import { SortableContextProps } from '@dnd-kit/sortable';
6
6
  import * as React$1 from 'react';
7
7
 
8
+ interface CapabilityOperation {
9
+ slug: string;
10
+ label: string;
11
+ description: string;
12
+ }
13
+ interface CapabilityModule {
14
+ slug: string;
15
+ label: string;
16
+ description: string;
17
+ operations: string[];
18
+ }
19
+ interface CapabilityCategory {
20
+ slug: string;
21
+ label: string;
22
+ modules: CapabilityModule[];
23
+ }
24
+ interface CapabilitiesResponse {
25
+ product: string | null;
26
+ categories: CapabilityCategory[];
27
+ }
28
+ interface AgentCapability {
29
+ module: string;
30
+ operations: string[];
31
+ }
32
+ interface AgentCapabilitiesPayload {
33
+ capabilities: AgentCapability[];
34
+ }
35
+
8
36
  interface ApiResponse<T = unknown> {
9
37
  status: 0 | 1;
10
38
  message?: string;
@@ -206,6 +234,9 @@ declare function createGagentsClient(config: GagentsClientConfig): {
206
234
  end_time: string;
207
235
  }) => Promise<ApiResponse<AvailabilityResult>>;
208
236
  disconnectCalendar: (idAccount: number, externalReference: string, provider?: string) => Promise<ApiResponse<void>>;
237
+ getCapabilities: (idAccount: number) => Promise<ApiResponse<CapabilitiesResponse>>;
238
+ getAgentCapabilities: (idAccount: number, idAgent: number) => Promise<ApiResponse<AgentCapability[]>>;
239
+ updateAgentCapabilities: (idAccount: number, idAgent: number, body: AgentCapabilitiesPayload) => Promise<ApiResponse<AgentCapability[]>>;
209
240
  };
210
241
  type GagentsClient = ReturnType<typeof createGagentsClient>;
211
242
 
@@ -265,6 +296,9 @@ declare function useGagentsClient(config: GagentsHookConfig): {
265
296
  end_time: string;
266
297
  }) => Promise<ApiResponse<AvailabilityResult>>;
267
298
  disconnectCalendar: (idAccount: number, externalReference: string, provider?: string) => Promise<ApiResponse<void>>;
299
+ getCapabilities: (idAccount: number) => Promise<ApiResponse<CapabilitiesResponse>>;
300
+ getAgentCapabilities: (idAccount: number, idAgent: number) => Promise<ApiResponse<AgentCapability[]>>;
301
+ updateAgentCapabilities: (idAccount: number, idAgent: number, body: AgentCapabilitiesPayload) => Promise<ApiResponse<AgentCapability[]>>;
268
302
  };
269
303
 
270
304
  declare function useAgents(config: GagentsHookConfig, params?: Record<string, string>): _tanstack_react_query.UseQueryResult<{
@@ -405,6 +439,50 @@ declare function useGagentsContacts(config: GagentsHookConfig, params?: Record<s
405
439
  total: number;
406
440
  }, Error>;
407
441
 
442
+ declare function useCapabilities(config: GagentsHookConfig): _tanstack_react_query.UseQueryResult<CapabilitiesResponse, Error>;
443
+ declare function useAgentCapabilities(config: GagentsHookConfig, agentId: number | null): _tanstack_react_query.UseQueryResult<AgentCapability[], Error>;
444
+ declare function useUpdateAgentCapabilities(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<AgentCapability[]>, Error, {
445
+ agentId: number;
446
+ payload: AgentCapabilitiesPayload;
447
+ }, unknown>;
448
+
449
+ type IntegrationAuthType = "oauth2" | "api_key" | "none";
450
+ type IntegrationStatus = "available" | "coming_soon";
451
+ interface IntegrationDefinition {
452
+ slug: string;
453
+ name: string;
454
+ description: string;
455
+ icon: string;
456
+ authType: IntegrationAuthType;
457
+ status: IntegrationStatus;
458
+ }
459
+ declare const INTEGRATIONS_REGISTRY: IntegrationDefinition[];
460
+
461
+ type IntegrationCardState = "available" | "connected" | "expired" | "coming_soon";
462
+ interface IntegrationCardData {
463
+ /** Static definition from registry */
464
+ definition: IntegrationDefinition;
465
+ /** Resolved visual state */
466
+ state: IntegrationCardState;
467
+ /** Matching credential if one exists */
468
+ credential: ToolCredential | null;
469
+ /** Matching tool record if one exists */
470
+ tool: Tool | null;
471
+ /** How many agents share this credential */
472
+ sharedByAgentsCount: number;
473
+ /** Whether this agent has a linked agent_tool for this integration */
474
+ linkedToAgent: boolean;
475
+ }
476
+ /**
477
+ * Cross-references the static integrations registry with live data
478
+ * (tools, tool_credentials, agent_tools) to produce card state for each
479
+ * integration entry.
480
+ */
481
+ declare function useIntegrationState(config: GagentsHookConfig, agentId: number | null): {
482
+ cards: IntegrationCardData[];
483
+ isLoading: boolean;
484
+ };
485
+
408
486
  declare function AgentsTable({ config, onNavigateToAgent }: {
409
487
  config: GagentsHookConfig;
410
488
  onNavigateToAgent?: (agentId: number) => void;
@@ -427,12 +505,58 @@ interface AgentEditFormProps {
427
505
  }
428
506
  declare function AgentEditForm({ config, agent, idAccount, open, onOpenChange }: AgentEditFormProps): react_jsx_runtime.JSX.Element;
429
507
 
508
+ /**
509
+ * Types for the Integration Wizard flow.
510
+ *
511
+ * The wizard uses the base IntegrationDefinition from the integrations registry
512
+ * and extends it with wizard-specific metadata via WizardIntegrationMeta.
513
+ */
514
+
515
+ interface IntegrationCapability {
516
+ label: string;
517
+ description?: string;
518
+ }
519
+ interface WizardIntegrationMeta {
520
+ /** Icon as React node for the wizard header */
521
+ icon?: React.ReactNode;
522
+ /** Provider label for OAuth button (e.g. "Google") */
523
+ providerLabel?: string;
524
+ /** What this integration can do */
525
+ capabilities: IntegrationCapability[];
526
+ /** Required permissions / prerequisites */
527
+ requirements: string[];
528
+ /** Whether this integration has a config step */
529
+ hasConfigStep: boolean;
530
+ }
531
+ type WizardStep = "info" | "credentials" | "config" | "confirm";
532
+ type OAuthStatus = "idle" | "waiting" | "success" | "error";
533
+ interface OAuthResult {
534
+ success: boolean;
535
+ email?: string;
536
+ error?: string;
537
+ credentialId?: number;
538
+ }
539
+
540
+ interface ConfigOption {
541
+ id: string;
542
+ label: string;
543
+ description?: string;
544
+ }
545
+
430
546
  interface AgentTabsProps {
431
547
  agent: Agent;
432
548
  config: GagentsHookConfig;
433
549
  renderChatLink?: (inboxId: number) => React.ReactNode;
434
- }
435
- declare function AgentTabs({ agent, config, renderChatLink }: AgentTabsProps): react_jsx_runtime.JSX.Element;
550
+ /** Required for the Capacidades tab — gagents API URL for OAuth flows and advanced features. Falls back to config.baseUrl. */
551
+ gagentsApiUrl?: string;
552
+ /** Resolve wizard metadata for a given integration card. */
553
+ resolveWizardMeta?: (card: IntegrationCardData) => WizardIntegrationMeta;
554
+ /** Callback to load config options after OAuth completes. */
555
+ loadConfigOptions?: (credentialId: number) => Promise<ConfigOption[]>;
556
+ /** Called after wizard completes successfully. */
557
+ onWizardComplete?: () => void;
558
+ }
559
+ declare function AgentTabs({ agent, config, renderChatLink, gagentsApiUrl, resolveWizardMeta, loadConfigOptions, onWizardComplete, }: AgentTabsProps): react_jsx_runtime.JSX.Element;
436
560
 
437
561
  interface AgentPromptEditorProps {
438
562
  config: GagentsHookConfig;
@@ -547,6 +671,63 @@ interface ConversationViewProps {
547
671
  }
548
672
  declare function ConversationView({ conversationId, onClose, contactsMap, config, renderChatLink, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
549
673
 
674
+ interface IntegrationCardProps {
675
+ card: IntegrationCardData;
676
+ onConnect: (card: IntegrationCardData) => void;
677
+ }
678
+ declare function IntegrationCard({ card, onConnect }: IntegrationCardProps): react_jsx_runtime.JSX.Element;
679
+
680
+ interface IntegrationsTabProps {
681
+ config: GagentsHookConfig;
682
+ agentId: number | null;
683
+ /** Called when user clicks a card action (connect / configure / reconnect).
684
+ * The consuming app wires this to the wizard (Story 18.9). */
685
+ onConnect: (card: IntegrationCardData) => void;
686
+ }
687
+ declare function IntegrationsTab({ config, agentId, onConnect, }: IntegrationsTabProps): react_jsx_runtime.JSX.Element;
688
+
689
+ interface CapabilitiesTabProps {
690
+ config: GagentsHookConfig;
691
+ agentId: number;
692
+ }
693
+ declare function CapabilitiesTab({ config, agentId }: CapabilitiesTabProps): react_jsx_runtime.JSX.Element;
694
+
695
+ interface AdvancedTabProps {
696
+ config: GagentsHookConfig;
697
+ agentId: number;
698
+ gagentsApiUrl: string;
699
+ }
700
+ declare function AdvancedTab({ config, agentId, gagentsApiUrl }: AdvancedTabProps): react_jsx_runtime.JSX.Element;
701
+
702
+ interface IntegrationWizardProps {
703
+ open: boolean;
704
+ onOpenChange: (open: boolean) => void;
705
+ /** Base integration definition from registry */
706
+ integration: IntegrationDefinition;
707
+ /** Wizard-specific metadata (capabilities, requirements, etc.) */
708
+ meta: WizardIntegrationMeta;
709
+ agentId: string | number;
710
+ config: GagentsHookConfig;
711
+ onComplete: () => void;
712
+ /** gagents-r3-api base URL (used to build OAuth URLs) */
713
+ gagentsApiUrl: string;
714
+ /**
715
+ * Existing credential ID -- when set, the wizard opens in edit mode
716
+ * (step 2 shows "Reconectar" and step 3 is pre-filled).
717
+ */
718
+ existingCredentialId?: number;
719
+ /**
720
+ * Callback to load config options after OAuth completes.
721
+ * e.g. load Google Calendar list. Returns ConfigOption[].
722
+ */
723
+ loadConfigOptions?: (credentialId: number) => Promise<ConfigOption[]>;
724
+ /**
725
+ * Existing config value to pre-fill the config step in edit/reconnect mode.
726
+ */
727
+ existingConfigValue?: string;
728
+ }
729
+ declare function IntegrationWizard({ open, onOpenChange, integration, meta, agentId: _agentId, config, onComplete, gagentsApiUrl, existingCredentialId, loadConfigOptions, existingConfigValue, }: IntegrationWizardProps): react_jsx_runtime.JSX.Element;
730
+
550
731
  interface AgentsPageProps {
551
732
  config: GagentsHookConfig;
552
733
  onNavigateToAgent?: (agentId: number) => void;
@@ -563,6 +744,26 @@ interface AgentDetailPageProps {
563
744
  }
564
745
  declare function AgentDetailPage({ config, agentId, onBack, renderChatLink, }: AgentDetailPageProps): react_jsx_runtime.JSX.Element;
565
746
 
747
+ interface AgentCapabilitiesPageProps {
748
+ config: GagentsHookConfig;
749
+ agentId: number;
750
+ gagentsApiUrl: string;
751
+ /**
752
+ * Resolve wizard metadata for a given integration card.
753
+ * The consuming app provides this so the wizard gets correct
754
+ * capabilities, requirements, and config step flag.
755
+ */
756
+ resolveWizardMeta?: (card: IntegrationCardData) => WizardIntegrationMeta;
757
+ /**
758
+ * Callback to load config options after OAuth completes
759
+ * (e.g. load Google Calendar list). Forwarded to IntegrationWizard.
760
+ */
761
+ loadConfigOptions?: (credentialId: number) => Promise<ConfigOption[]>;
762
+ /** Called after wizard completes successfully. */
763
+ onWizardComplete?: () => void;
764
+ }
765
+ declare function AgentCapabilitiesPage({ config, agentId, gagentsApiUrl, resolveWizardMeta, loadConfigOptions, onWizardComplete, }: AgentCapabilitiesPageProps): react_jsx_runtime.JSX.Element;
766
+
566
767
  interface ToolsPageProps {
567
768
  config: GagentsHookConfig;
568
769
  title?: string;
@@ -578,4 +779,14 @@ interface CredentialsPageProps {
578
779
  }
579
780
  declare function CredentialsPage({ config, gagentsApiUrl, title, subtitle, }: CredentialsPageProps): react_jsx_runtime.JSX.Element;
580
781
 
581
- export { type Agent, AgentConversationsPanel, AgentConversationsTable, AgentDetailPage, type AgentDetailPageProps, AgentEditForm, AgentFormDialog, AgentObjectivesList, AgentPromptEditor, AgentTabs, type AgentTool, AgentToolsList, AgentsPage, type AgentsPageProps, AgentsTable, type ApiResponse, type AvailabilityConflict, type AvailabilityResult, type CalendarStatus, type ContactUser, type Conversation, ConversationView, CredentialsPage, type CredentialsPageProps, type GagentsClient, type GagentsClientConfig, type GagentsContact, type GagentsHookConfig, type Objective, type PromptVersion, Sortable, SortableContent, SortableItem, SortableItemHandle, SortableOverlay, type Tool, type ToolCredential, ToolCredentialsForm, ToolFormDialog, ToolsPage, type ToolsPageProps, ToolsTable, cn, createGagentsClient, useAddAgentTool, useAgent, useAgentConversations, useAgentTools, useAgents, useContactUsers, useConversation, useConversations, useCreateAgent, useCreateObjective, useCreateTool, useCreateToolCredential, useDeleteAgent, useDeleteObjective, useDeleteTool, useDeleteToolCredential, useGagentsClient, useGagentsContacts, useObjectives, usePromptVersions, useRemoveAgentTool, useTool, useToolCredentials, useTools, useUpdateAgent, useUpdateAgentTool, useUpdateObjective, useUpdateTool, useUpdateToolCredential };
782
+ interface IntegrationsManagementPageProps {
783
+ config: GagentsHookConfig;
784
+ gagentsApiUrl: string;
785
+ /** Called when user clicks connect/reconnect on an integration card. */
786
+ onConnect?: (card: IntegrationCardData) => void;
787
+ title?: string;
788
+ subtitle?: string;
789
+ }
790
+ declare function IntegrationsManagementPage({ config, gagentsApiUrl, onConnect, title, subtitle, }: IntegrationsManagementPageProps): react_jsx_runtime.JSX.Element;
791
+
792
+ export { AdvancedTab, type AdvancedTabProps, type Agent, AgentCapabilitiesPage, type AgentCapabilitiesPageProps, type AgentCapabilitiesPayload, type AgentCapability, AgentConversationsPanel, AgentConversationsTable, AgentDetailPage, type AgentDetailPageProps, AgentEditForm, AgentFormDialog, AgentObjectivesList, AgentPromptEditor, 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, 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 };