@greatapps/greatagents-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,399 @@
1
+ import { ClassValue } from 'clsx';
2
+ import * as _tanstack_react_query from '@tanstack/react-query';
3
+
4
+ interface ApiResponse<T = unknown> {
5
+ status: 0 | 1;
6
+ message?: string;
7
+ data?: T;
8
+ total?: number;
9
+ }
10
+ interface Agent {
11
+ id: number;
12
+ id_account: number;
13
+ title: string;
14
+ prompt: string | null;
15
+ photo: string | null;
16
+ external_token: string | null;
17
+ openai_assistant_id: string | null;
18
+ delay_typing: number | null;
19
+ waiting_time: number | null;
20
+ active: boolean;
21
+ deleted: number;
22
+ datetime_add: string;
23
+ datetime_alt: string | null;
24
+ }
25
+ interface Objective {
26
+ id: number;
27
+ id_account: number;
28
+ id_agent: number;
29
+ title: string;
30
+ slug: string | null;
31
+ prompt: string | null;
32
+ order: number;
33
+ active: boolean;
34
+ deleted: number;
35
+ datetime_add: string;
36
+ datetime_alt: string | null;
37
+ }
38
+ interface Tool {
39
+ id: number;
40
+ id_account: number;
41
+ name: string;
42
+ slug: string | null;
43
+ type: string;
44
+ description: string | null;
45
+ auth_config: string | null;
46
+ function_definitions: string | null;
47
+ deleted: number;
48
+ datetime_add: string;
49
+ datetime_alt: string | null;
50
+ }
51
+ interface AgentTool {
52
+ id: number;
53
+ id_account: number;
54
+ id_agent: number;
55
+ id_tool: number;
56
+ id_tool_credential: number | null;
57
+ enabled: boolean;
58
+ parameter_mappings: string | null;
59
+ custom_instructions: string | null;
60
+ deleted: number;
61
+ datetime_add: string;
62
+ datetime_alt: string | null;
63
+ }
64
+ interface Conversation {
65
+ id: number;
66
+ id_account: number;
67
+ id_agent: number | null;
68
+ id_objective: number | null;
69
+ id_contact: number;
70
+ id_external: number | null;
71
+ key_memory: string | null;
72
+ openai_thread_id: string | null;
73
+ openai_assistant_id: string | null;
74
+ system_prompt_hash: string | null;
75
+ message_count: number;
76
+ usage_tokens: number;
77
+ context_summary: string | null;
78
+ last_thread_rotation: string | null;
79
+ rotation_count: number;
80
+ deleted: number;
81
+ datetime_add: string;
82
+ datetime_alt: string | null;
83
+ }
84
+ interface PromptVersion {
85
+ id: number;
86
+ id_account: number;
87
+ id_agent: number;
88
+ version_number: number;
89
+ prompt_content: string;
90
+ prompt_hash: string;
91
+ is_current: boolean;
92
+ change_notes: string | null;
93
+ deleted: number;
94
+ datetime_add: string;
95
+ }
96
+ interface ToolCredential {
97
+ id: number;
98
+ id_account: number;
99
+ id_tool: number;
100
+ label: string;
101
+ credentials_encrypted: string;
102
+ expires_at: string | null;
103
+ status: "active" | "expired";
104
+ authorized_by_contact: number | null;
105
+ deleted: number;
106
+ datetime_add: string;
107
+ datetime_alt: string | null;
108
+ }
109
+ interface ContactUser {
110
+ id: number;
111
+ id_account: number;
112
+ id_contact: number;
113
+ id_user: number;
114
+ role: string;
115
+ authorized_at: string | null;
116
+ deleted: number;
117
+ datetime_add: string;
118
+ datetime_alt: string | null;
119
+ }
120
+ interface CalendarStatus {
121
+ connected: boolean;
122
+ provider?: string;
123
+ email?: string;
124
+ expires_at?: string;
125
+ }
126
+ interface GagentsContact {
127
+ id: number;
128
+ id_account: number;
129
+ id_external: number | null;
130
+ name: string;
131
+ email: string | null;
132
+ phone_number: string | null;
133
+ identifier: string | null;
134
+ key_memory: string | null;
135
+ deleted: number;
136
+ datetime_add: string;
137
+ datetime_alt: string | null;
138
+ }
139
+ interface AvailabilityConflict {
140
+ provider: string;
141
+ start: string;
142
+ end: string;
143
+ }
144
+ interface AvailabilityResult {
145
+ available: boolean;
146
+ conflicts: AvailabilityConflict[];
147
+ failed_providers: Array<{
148
+ provider: string;
149
+ error: string;
150
+ }>;
151
+ }
152
+
153
+ interface GagentsClientConfig {
154
+ baseUrl: string;
155
+ token: string;
156
+ language?: string;
157
+ idWl?: number;
158
+ }
159
+ declare function createGagentsClient(config: GagentsClientConfig): {
160
+ listAgents: (idAccount: number, params?: Record<string, string>) => Promise<ApiResponse<Agent[]>>;
161
+ getAgent: (idAccount: number, id: number) => Promise<ApiResponse<Agent>>;
162
+ createAgent: (idAccount: number, body: Pick<Agent, "title"> & Partial<Pick<Agent, "prompt" | "photo" | "delay_typing" | "waiting_time">>) => Promise<ApiResponse<Agent>>;
163
+ updateAgent: (idAccount: number, id: number, body: Partial<Pick<Agent, "title" | "prompt" | "photo" | "delay_typing" | "waiting_time" | "active">>) => Promise<ApiResponse<Agent>>;
164
+ deleteAgent: (idAccount: number, id: number) => Promise<ApiResponse<void>>;
165
+ listTools: (idAccount: number, params?: Record<string, string>) => Promise<ApiResponse<Tool[]>>;
166
+ getTool: (idAccount: number, id: number) => Promise<ApiResponse<Tool>>;
167
+ createTool: (idAccount: number, body: Pick<Tool, "name" | "type"> & Partial<Pick<Tool, "slug" | "description" | "auth_config" | "function_definitions">>) => Promise<ApiResponse<Tool>>;
168
+ updateTool: (idAccount: number, id: number, body: Partial<Pick<Tool, "name" | "slug" | "type" | "description" | "auth_config" | "function_definitions">>) => Promise<ApiResponse<Tool>>;
169
+ deleteTool: (idAccount: number, id: number) => Promise<ApiResponse<void>>;
170
+ listAgentTools: (idAccount: number, idAgent: number, params?: Record<string, string>) => Promise<ApiResponse<AgentTool[]>>;
171
+ addAgentTool: (idAccount: number, idAgent: number, body: Pick<AgentTool, "id_tool"> & Partial<Pick<AgentTool, "enabled" | "custom_instructions" | "parameter_mappings" | "id_tool_credential">>) => Promise<ApiResponse<AgentTool>>;
172
+ updateAgentTool: (idAccount: number, idAgent: number, id: number, body: Partial<Pick<AgentTool, "enabled" | "custom_instructions" | "parameter_mappings" | "id_tool_credential">>) => Promise<ApiResponse<AgentTool>>;
173
+ removeAgentTool: (idAccount: number, idAgent: number, id: number) => Promise<ApiResponse<void>>;
174
+ listObjectives: (idAccount: number, idAgent: number, params?: Record<string, string>) => Promise<ApiResponse<Objective[]>>;
175
+ getObjective: (idAccount: number, idAgent: number, id: number) => Promise<ApiResponse<Objective>>;
176
+ createObjective: (idAccount: number, idAgent: number, body: Pick<Objective, "title"> & Partial<Pick<Objective, "slug" | "prompt" | "order" | "active">>) => Promise<ApiResponse<Objective>>;
177
+ updateObjective: (idAccount: number, idAgent: number, id: number, body: Partial<Pick<Objective, "title" | "slug" | "prompt" | "order" | "active">>) => Promise<ApiResponse<Objective>>;
178
+ deleteObjective: (idAccount: number, idAgent: number, id: number) => Promise<ApiResponse<void>>;
179
+ listConversations: (idAccount: number, params?: Record<string, string>) => Promise<ApiResponse<Conversation[]>>;
180
+ listAgentConversations: (idAccount: number, idAgent: number, params?: Record<string, string>) => Promise<ApiResponse<Conversation[]>>;
181
+ getConversation: (idAccount: number, id: number) => Promise<ApiResponse<Conversation>>;
182
+ listPromptVersions: (idAccount: number, idAgent: number, params?: Record<string, string>) => Promise<ApiResponse<PromptVersion[]>>;
183
+ listToolCredentials: (idAccount: number, params?: Record<string, string>) => Promise<ApiResponse<ToolCredential[]>>;
184
+ createToolCredential: (idAccount: number, body: Pick<ToolCredential, "id_tool" | "label" | "credentials_encrypted"> & Partial<Pick<ToolCredential, "expires_at">>) => Promise<ApiResponse<ToolCredential>>;
185
+ updateToolCredential: (idAccount: number, id: number, body: Partial<Pick<ToolCredential, "id_tool" | "label" | "credentials_encrypted" | "expires_at" | "status">>) => Promise<ApiResponse<ToolCredential>>;
186
+ deleteToolCredential: (idAccount: number, id: number) => Promise<ApiResponse<void>>;
187
+ listContactUsers: (idAccount: number, params?: Record<string, string>) => Promise<ApiResponse<ContactUser[]>>;
188
+ getContactUser: (idAccount: number, id: number) => Promise<ApiResponse<ContactUser>>;
189
+ listGagentsContacts: (idAccount: number, params?: Record<string, string>) => Promise<ApiResponse<GagentsContact[]>>;
190
+ initiateCalendarConnect: (idAccount: number, body: {
191
+ external_reference: string;
192
+ provider?: string;
193
+ }) => Promise<ApiResponse<{
194
+ auth_url: string;
195
+ }>>;
196
+ getCalendarStatus: (idAccount: number, externalReference: string, provider?: string) => Promise<ApiResponse<CalendarStatus>>;
197
+ checkCalendarAvailability: (idAccount: number, body: {
198
+ id_professional: number;
199
+ start_time: string;
200
+ end_time: string;
201
+ }) => Promise<ApiResponse<AvailabilityResult>>;
202
+ disconnectCalendar: (idAccount: number, externalReference: string, provider?: string) => Promise<ApiResponse<void>>;
203
+ };
204
+ type GagentsClient = ReturnType<typeof createGagentsClient>;
205
+
206
+ declare function cn(...inputs: ClassValue[]): string;
207
+
208
+ interface GagentsHookConfig {
209
+ accountId: number;
210
+ token: string;
211
+ baseUrl: string;
212
+ language?: string;
213
+ idWl?: number;
214
+ }
215
+ declare function useGagentsClient(config: GagentsHookConfig): {
216
+ listAgents: (idAccount: number, params?: Record<string, string>) => Promise<ApiResponse<Agent[]>>;
217
+ getAgent: (idAccount: number, id: number) => Promise<ApiResponse<Agent>>;
218
+ createAgent: (idAccount: number, body: Pick<Agent, "title"> & Partial<Pick<Agent, "prompt" | "photo" | "delay_typing" | "waiting_time">>) => Promise<ApiResponse<Agent>>;
219
+ updateAgent: (idAccount: number, id: number, body: Partial<Pick<Agent, "title" | "prompt" | "photo" | "delay_typing" | "waiting_time" | "active">>) => Promise<ApiResponse<Agent>>;
220
+ deleteAgent: (idAccount: number, id: number) => Promise<ApiResponse<void>>;
221
+ listTools: (idAccount: number, params?: Record<string, string>) => Promise<ApiResponse<Tool[]>>;
222
+ getTool: (idAccount: number, id: number) => Promise<ApiResponse<Tool>>;
223
+ createTool: (idAccount: number, body: Pick<Tool, "name" | "type"> & Partial<Pick<Tool, "slug" | "description" | "auth_config" | "function_definitions">>) => Promise<ApiResponse<Tool>>;
224
+ updateTool: (idAccount: number, id: number, body: Partial<Pick<Tool, "name" | "slug" | "type" | "description" | "auth_config" | "function_definitions">>) => Promise<ApiResponse<Tool>>;
225
+ deleteTool: (idAccount: number, id: number) => Promise<ApiResponse<void>>;
226
+ listAgentTools: (idAccount: number, idAgent: number, params?: Record<string, string>) => Promise<ApiResponse<AgentTool[]>>;
227
+ addAgentTool: (idAccount: number, idAgent: number, body: Pick<AgentTool, "id_tool"> & Partial<Pick<AgentTool, "enabled" | "custom_instructions" | "parameter_mappings" | "id_tool_credential">>) => Promise<ApiResponse<AgentTool>>;
228
+ updateAgentTool: (idAccount: number, idAgent: number, id: number, body: Partial<Pick<AgentTool, "enabled" | "custom_instructions" | "parameter_mappings" | "id_tool_credential">>) => Promise<ApiResponse<AgentTool>>;
229
+ removeAgentTool: (idAccount: number, idAgent: number, id: number) => Promise<ApiResponse<void>>;
230
+ listObjectives: (idAccount: number, idAgent: number, params?: Record<string, string>) => Promise<ApiResponse<Objective[]>>;
231
+ getObjective: (idAccount: number, idAgent: number, id: number) => Promise<ApiResponse<Objective>>;
232
+ createObjective: (idAccount: number, idAgent: number, body: Pick<Objective, "title"> & Partial<Pick<Objective, "slug" | "prompt" | "order" | "active">>) => Promise<ApiResponse<Objective>>;
233
+ updateObjective: (idAccount: number, idAgent: number, id: number, body: Partial<Pick<Objective, "title" | "slug" | "prompt" | "order" | "active">>) => Promise<ApiResponse<Objective>>;
234
+ deleteObjective: (idAccount: number, idAgent: number, id: number) => Promise<ApiResponse<void>>;
235
+ listConversations: (idAccount: number, params?: Record<string, string>) => Promise<ApiResponse<Conversation[]>>;
236
+ listAgentConversations: (idAccount: number, idAgent: number, params?: Record<string, string>) => Promise<ApiResponse<Conversation[]>>;
237
+ getConversation: (idAccount: number, id: number) => Promise<ApiResponse<Conversation>>;
238
+ listPromptVersions: (idAccount: number, idAgent: number, params?: Record<string, string>) => Promise<ApiResponse<PromptVersion[]>>;
239
+ listToolCredentials: (idAccount: number, params?: Record<string, string>) => Promise<ApiResponse<ToolCredential[]>>;
240
+ createToolCredential: (idAccount: number, body: Pick<ToolCredential, "id_tool" | "label" | "credentials_encrypted"> & Partial<Pick<ToolCredential, "expires_at">>) => Promise<ApiResponse<ToolCredential>>;
241
+ updateToolCredential: (idAccount: number, id: number, body: Partial<Pick<ToolCredential, "id_tool" | "label" | "credentials_encrypted" | "expires_at" | "status">>) => Promise<ApiResponse<ToolCredential>>;
242
+ deleteToolCredential: (idAccount: number, id: number) => Promise<ApiResponse<void>>;
243
+ listContactUsers: (idAccount: number, params?: Record<string, string>) => Promise<ApiResponse<ContactUser[]>>;
244
+ getContactUser: (idAccount: number, id: number) => Promise<ApiResponse<ContactUser>>;
245
+ listGagentsContacts: (idAccount: number, params?: Record<string, string>) => Promise<ApiResponse<GagentsContact[]>>;
246
+ initiateCalendarConnect: (idAccount: number, body: {
247
+ external_reference: string;
248
+ provider?: string;
249
+ }) => Promise<ApiResponse<{
250
+ auth_url: string;
251
+ }>>;
252
+ getCalendarStatus: (idAccount: number, externalReference: string, provider?: string) => Promise<ApiResponse<CalendarStatus>>;
253
+ checkCalendarAvailability: (idAccount: number, body: {
254
+ id_professional: number;
255
+ start_time: string;
256
+ end_time: string;
257
+ }) => Promise<ApiResponse<AvailabilityResult>>;
258
+ disconnectCalendar: (idAccount: number, externalReference: string, provider?: string) => Promise<ApiResponse<void>>;
259
+ };
260
+
261
+ declare function useAgents(config: GagentsHookConfig, params?: Record<string, string>): _tanstack_react_query.UseQueryResult<{
262
+ data: Agent[];
263
+ total: number;
264
+ }, Error>;
265
+ declare function useAgent(config: GagentsHookConfig, id: number | null): _tanstack_react_query.UseQueryResult<any, Error>;
266
+ declare function useCreateAgent(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<Agent>, Error, {
267
+ title: string;
268
+ prompt?: string;
269
+ photo?: string;
270
+ delay_typing?: number;
271
+ waiting_time?: number;
272
+ }, unknown>;
273
+ declare function useUpdateAgent(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<Agent>, Error, {
274
+ id: number;
275
+ body: {
276
+ title?: string;
277
+ prompt?: string;
278
+ photo?: string;
279
+ delay_typing?: number;
280
+ waiting_time?: number;
281
+ active?: boolean;
282
+ };
283
+ }, unknown>;
284
+ declare function useDeleteAgent(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<void>, Error, number, unknown>;
285
+
286
+ declare function useTools(config: GagentsHookConfig, params?: Record<string, string>): _tanstack_react_query.UseQueryResult<{
287
+ data: Tool[];
288
+ total: number;
289
+ }, Error>;
290
+ declare function useTool(config: GagentsHookConfig, id: number | null): _tanstack_react_query.UseQueryResult<any, Error>;
291
+ declare function useCreateTool(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<Tool>, Error, {
292
+ name: string;
293
+ slug: string;
294
+ type: string;
295
+ description?: string;
296
+ function_definitions?: string;
297
+ }, unknown>;
298
+ declare function useUpdateTool(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<Tool>, Error, {
299
+ id: number;
300
+ body: {
301
+ name?: string;
302
+ type?: string;
303
+ description?: string;
304
+ function_definitions?: string;
305
+ };
306
+ }, unknown>;
307
+ declare function useDeleteTool(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<void>, Error, number, unknown>;
308
+
309
+ declare function useObjectives(config: GagentsHookConfig, idAgent: number): _tanstack_react_query.UseQueryResult<{
310
+ data: Objective[];
311
+ total: number;
312
+ }, Error>;
313
+ declare function useCreateObjective(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<Objective>, Error, {
314
+ idAgent: number;
315
+ body: {
316
+ title: string;
317
+ slug?: string;
318
+ prompt?: string | null;
319
+ order?: number;
320
+ active?: boolean;
321
+ };
322
+ }, unknown>;
323
+ declare function useUpdateObjective(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<Objective>, Error, {
324
+ idAgent: number;
325
+ id: number;
326
+ body: Partial<{
327
+ title: string;
328
+ slug: string;
329
+ prompt: string | null;
330
+ order: number;
331
+ active: boolean;
332
+ }>;
333
+ }, unknown>;
334
+ declare function useDeleteObjective(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<void>, Error, {
335
+ idAgent: number;
336
+ id: number;
337
+ }, unknown>;
338
+
339
+ declare function useAgentTools(config: GagentsHookConfig, idAgent: number): _tanstack_react_query.UseQueryResult<{
340
+ data: AgentTool[];
341
+ total: number;
342
+ }, Error>;
343
+ declare function useAddAgentTool(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<AgentTool>, Error, {
344
+ idAgent: number;
345
+ body: {
346
+ id_tool: number;
347
+ enabled?: boolean;
348
+ };
349
+ }, unknown>;
350
+ declare function useRemoveAgentTool(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<void>, Error, {
351
+ idAgent: number;
352
+ id: number;
353
+ }, unknown>;
354
+ declare function useUpdateAgentTool(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<AgentTool>, Error, {
355
+ idAgent: number;
356
+ id: number;
357
+ body: Partial<{
358
+ enabled: boolean;
359
+ custom_instructions: string | null;
360
+ parameter_mappings: string | null;
361
+ id_tool_credential: number | null;
362
+ }>;
363
+ }, unknown>;
364
+
365
+ declare function useConversations(config: GagentsHookConfig): _tanstack_react_query.UseQueryResult<{
366
+ data: Conversation[];
367
+ total: number;
368
+ }, Error>;
369
+ declare function useAgentConversations(config: GagentsHookConfig, idAgent: number): _tanstack_react_query.UseQueryResult<{
370
+ data: Conversation[];
371
+ total: number;
372
+ }, Error>;
373
+ declare function useConversation(config: GagentsHookConfig, id: number): _tanstack_react_query.UseQueryResult<any, Error>;
374
+
375
+ declare function usePromptVersions(config: GagentsHookConfig, idAgent: number): _tanstack_react_query.UseQueryResult<{
376
+ data: PromptVersion[];
377
+ total: number;
378
+ }, Error>;
379
+ declare function useToolCredentials(config: GagentsHookConfig): _tanstack_react_query.UseQueryResult<{
380
+ data: ToolCredential[];
381
+ total: number;
382
+ }, Error>;
383
+ declare function useCreateToolCredential(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<ToolCredential>, Error, Pick<ToolCredential, "id_tool" | "label" | "credentials_encrypted"> & Partial<Pick<ToolCredential, "expires_at">>, unknown>;
384
+ declare function useUpdateToolCredential(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<ToolCredential>, Error, {
385
+ id: number;
386
+ body: Partial<Pick<ToolCredential, "id_tool" | "label" | "credentials_encrypted" | "expires_at" | "status">>;
387
+ }, unknown>;
388
+ declare function useDeleteToolCredential(config: GagentsHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<void>, Error, number, unknown>;
389
+ declare function useContactUsers(config: GagentsHookConfig): _tanstack_react_query.UseQueryResult<{
390
+ data: ContactUser[];
391
+ total: number;
392
+ }, Error>;
393
+
394
+ declare function useGagentsContacts(config: GagentsHookConfig, params?: Record<string, string>): _tanstack_react_query.UseQueryResult<{
395
+ data: GagentsContact[];
396
+ total: number;
397
+ }, Error>;
398
+
399
+ export { type Agent, type AgentTool, type ApiResponse, type AvailabilityConflict, type AvailabilityResult, type CalendarStatus, type ContactUser, type Conversation, type GagentsClient, type GagentsClientConfig, type GagentsContact, type GagentsHookConfig, type Objective, type PromptVersion, type Tool, type ToolCredential, 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 };