@elqnt/agents 3.0.5 → 3.2.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,771 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+ var _chunkIUKM3T2Sjs = require('./chunk-IUKM3T2S.js');
79
+
80
+ // hooks/index.ts
81
+ var _react = require('react');
82
+
83
+ // hooks/use-async.ts
84
+
85
+ function useAsync(asyncFn, options) {
86
+ const [error, setError] = _react.useState.call(void 0, null);
87
+ const requestCountRef = _react.useRef.call(void 0, 0);
88
+ const [loading, setLoading] = _react.useState.call(void 0, false);
89
+ const execute = _react.useCallback.call(void 0,
90
+ async (...args) => {
91
+ requestCountRef.current += 1;
92
+ setLoading(true);
93
+ setError(null);
94
+ try {
95
+ return await asyncFn(...args);
96
+ } catch (err) {
97
+ const message = err instanceof Error ? err.message : "An error occurred";
98
+ setError(message);
99
+ _optionalChain([options, 'optionalAccess', _ => _.onError, 'optionalCall', _2 => _2(message)]);
100
+ throw err;
101
+ } finally {
102
+ requestCountRef.current -= 1;
103
+ if (requestCountRef.current === 0) {
104
+ setLoading(false);
105
+ }
106
+ }
107
+ },
108
+ [asyncFn, options]
109
+ );
110
+ const clearError = _react.useCallback.call(void 0, () => setError(null), []);
111
+ return { execute, loading, error, clearError };
112
+ }
113
+ function useApiAsync(asyncFn, extractor, defaultValue, options) {
114
+ const [error, setError] = _react.useState.call(void 0, null);
115
+ const requestCountRef = _react.useRef.call(void 0, 0);
116
+ const [loading, setLoading] = _react.useState.call(void 0, false);
117
+ const execute = _react.useCallback.call(void 0,
118
+ async (...args) => {
119
+ requestCountRef.current += 1;
120
+ setLoading(true);
121
+ setError(null);
122
+ try {
123
+ const response = await asyncFn(...args);
124
+ if (response.error) {
125
+ setError(response.error);
126
+ _optionalChain([options, 'optionalAccess', _3 => _3.onError, 'optionalCall', _4 => _4(response.error)]);
127
+ return defaultValue;
128
+ }
129
+ return response.data ? extractor(response.data) : defaultValue;
130
+ } catch (err) {
131
+ const message = err instanceof Error ? err.message : "An error occurred";
132
+ setError(message);
133
+ _optionalChain([options, 'optionalAccess', _5 => _5.onError, 'optionalCall', _6 => _6(message)]);
134
+ return defaultValue;
135
+ } finally {
136
+ requestCountRef.current -= 1;
137
+ if (requestCountRef.current === 0) {
138
+ setLoading(false);
139
+ }
140
+ }
141
+ },
142
+ [asyncFn, extractor, defaultValue, options]
143
+ );
144
+ const clearError = _react.useCallback.call(void 0, () => setError(null), []);
145
+ return { execute, loading, error, clearError };
146
+ }
147
+
148
+ // hooks/use-options-ref.ts
149
+
150
+ function useOptionsRef(options) {
151
+ const optionsRef = _react.useRef.call(void 0, options);
152
+ _react.useEffect.call(void 0, () => {
153
+ optionsRef.current = options;
154
+ }, [options]);
155
+ return optionsRef;
156
+ }
157
+
158
+ // hooks/index.ts
159
+ function useAgents(options) {
160
+ const optionsRef = useOptionsRef(options);
161
+ const { execute: listAgents, loading: listLoading, error: listError } = useApiAsync(
162
+ () => _chunkIUKM3T2Sjs.listAgentsApi.call(void 0, optionsRef.current),
163
+ (data) => data.agents,
164
+ []
165
+ );
166
+ const { execute: listAgentSummaries, loading: listSummaryLoading, error: listSummaryError } = useApiAsync(
167
+ () => _chunkIUKM3T2Sjs.listAgentsSummaryApi.call(void 0, optionsRef.current),
168
+ (data) => data.agents,
169
+ []
170
+ );
171
+ const { execute: getAgent, loading: getLoading, error: getError } = useApiAsync(
172
+ (agentId) => _chunkIUKM3T2Sjs.getAgentApi.call(void 0, agentId, optionsRef.current),
173
+ (data) => data.agent || null,
174
+ null
175
+ );
176
+ const { execute: createAgent, loading: createLoading, error: createError } = useApiAsync(
177
+ (agent) => _chunkIUKM3T2Sjs.createAgentApi.call(void 0, agent, optionsRef.current),
178
+ (data) => data.agent || null,
179
+ null
180
+ );
181
+ const { execute: updateAgent, loading: updateLoading, error: updateError } = useApiAsync(
182
+ (agentId, agent) => _chunkIUKM3T2Sjs.updateAgentApi.call(void 0, agentId, agent, optionsRef.current),
183
+ (data) => data.agent || null,
184
+ null
185
+ );
186
+ const { execute: deleteAgent, loading: deleteLoading, error: deleteError } = useApiAsync(
187
+ (agentId) => _chunkIUKM3T2Sjs.deleteAgentApi.call(void 0, agentId, optionsRef.current),
188
+ () => true,
189
+ false
190
+ );
191
+ const { execute: getDefaultAgent, loading: defaultLoading, error: defaultError } = useApiAsync(
192
+ () => _chunkIUKM3T2Sjs.getDefaultAgentApi.call(void 0, optionsRef.current),
193
+ (data) => data.agent || null,
194
+ null
195
+ );
196
+ const loading = listLoading || listSummaryLoading || getLoading || createLoading || updateLoading || deleteLoading || defaultLoading;
197
+ const error = listError || listSummaryError || getError || createError || updateError || deleteError || defaultError;
198
+ return _react.useMemo.call(void 0,
199
+ () => ({
200
+ loading,
201
+ error,
202
+ listAgents,
203
+ listAgentSummaries,
204
+ getAgent,
205
+ createAgent,
206
+ updateAgent,
207
+ deleteAgent,
208
+ getDefaultAgent
209
+ }),
210
+ [loading, error, listAgents, listAgentSummaries, getAgent, createAgent, updateAgent, deleteAgent, getDefaultAgent]
211
+ );
212
+ }
213
+ function useSkills(options) {
214
+ const optionsRef = useOptionsRef(options);
215
+ const { execute: listSkills, loading: listLoading, error: listError } = useApiAsync(
216
+ () => _chunkIUKM3T2Sjs.listSkillsApi.call(void 0, optionsRef.current),
217
+ (data) => data.skills,
218
+ []
219
+ );
220
+ const { execute: getSkill, loading: getLoading, error: getError } = useApiAsync(
221
+ (skillId) => _chunkIUKM3T2Sjs.getSkillApi.call(void 0, skillId, optionsRef.current),
222
+ (data) => data.skill || null,
223
+ null
224
+ );
225
+ const { execute: createSkill, loading: createLoading, error: createError } = useApiAsync(
226
+ (skill) => _chunkIUKM3T2Sjs.createSkillApi.call(void 0, skill, optionsRef.current),
227
+ (data) => data.skill || null,
228
+ null
229
+ );
230
+ const { execute: updateSkill, loading: updateLoading, error: updateError } = useApiAsync(
231
+ (skillId, skill) => _chunkIUKM3T2Sjs.updateSkillApi.call(void 0, skillId, skill, optionsRef.current),
232
+ (data) => data.skill || null,
233
+ null
234
+ );
235
+ const { execute: deleteSkill, loading: deleteLoading, error: deleteError } = useApiAsync(
236
+ (skillId) => _chunkIUKM3T2Sjs.deleteSkillApi.call(void 0, skillId, optionsRef.current),
237
+ () => true,
238
+ false
239
+ );
240
+ const { execute: getCategories, loading: categoriesLoading, error: categoriesError } = useApiAsync(
241
+ () => _chunkIUKM3T2Sjs.getSkillCategoriesApi.call(void 0, optionsRef.current),
242
+ (data) => data.categories,
243
+ []
244
+ );
245
+ const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading || categoriesLoading;
246
+ const error = listError || getError || createError || updateError || deleteError || categoriesError;
247
+ return _react.useMemo.call(void 0,
248
+ () => ({
249
+ loading,
250
+ error,
251
+ listSkills,
252
+ getSkill,
253
+ createSkill,
254
+ updateSkill,
255
+ deleteSkill,
256
+ getCategories
257
+ }),
258
+ [loading, error, listSkills, getSkill, createSkill, updateSkill, deleteSkill, getCategories]
259
+ );
260
+ }
261
+ function useSubAgents(options) {
262
+ const optionsRef = useOptionsRef(options);
263
+ const { execute: listSubAgents, loading: listLoading, error: listError } = useApiAsync(
264
+ () => _chunkIUKM3T2Sjs.listSubAgentsApi.call(void 0, optionsRef.current),
265
+ (data) => data.subAgents,
266
+ []
267
+ );
268
+ const { execute: getSubAgent, loading: getLoading, error: getError } = useApiAsync(
269
+ (subAgentId) => _chunkIUKM3T2Sjs.getSubAgentApi.call(void 0, subAgentId, optionsRef.current),
270
+ (data) => data.subAgent || null,
271
+ null
272
+ );
273
+ const { execute: createSubAgent, loading: createLoading, error: createError } = useApiAsync(
274
+ (subAgent) => _chunkIUKM3T2Sjs.createSubAgentApi.call(void 0, subAgent, optionsRef.current),
275
+ (data) => data.subAgent || null,
276
+ null
277
+ );
278
+ const { execute: updateSubAgent, loading: updateLoading, error: updateError } = useApiAsync(
279
+ (subAgentId, subAgent) => _chunkIUKM3T2Sjs.updateSubAgentApi.call(void 0, subAgentId, subAgent, optionsRef.current),
280
+ (data) => data.subAgent || null,
281
+ null
282
+ );
283
+ const { execute: deleteSubAgent, loading: deleteLoading, error: deleteError } = useApiAsync(
284
+ (subAgentId) => _chunkIUKM3T2Sjs.deleteSubAgentApi.call(void 0, subAgentId, optionsRef.current),
285
+ () => true,
286
+ false
287
+ );
288
+ const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading;
289
+ const error = listError || getError || createError || updateError || deleteError;
290
+ return _react.useMemo.call(void 0,
291
+ () => ({
292
+ loading,
293
+ error,
294
+ listSubAgents,
295
+ getSubAgent,
296
+ createSubAgent,
297
+ updateSubAgent,
298
+ deleteSubAgent
299
+ }),
300
+ [loading, error, listSubAgents, getSubAgent, createSubAgent, updateSubAgent, deleteSubAgent]
301
+ );
302
+ }
303
+ function useToolDefinitions(options) {
304
+ const optionsRef = useOptionsRef(options);
305
+ const { execute: listToolDefinitions, loading: listLoading, error: listError } = useApiAsync(
306
+ () => _chunkIUKM3T2Sjs.listToolDefinitionsApi.call(void 0, optionsRef.current),
307
+ (data) => data.toolDefinitions,
308
+ []
309
+ );
310
+ const { execute: getToolDefinition, loading: getLoading, error: getError } = useApiAsync(
311
+ (toolDefId) => _chunkIUKM3T2Sjs.getToolDefinitionApi.call(void 0, toolDefId, optionsRef.current),
312
+ (data) => data.toolDefinition || null,
313
+ null
314
+ );
315
+ const { execute: getToolDefinitionsByIds, loading: getByIdsLoading, error: getByIdsError } = useApiAsync(
316
+ (ids) => _chunkIUKM3T2Sjs.getToolDefinitionsByIdsApi.call(void 0, ids, optionsRef.current),
317
+ (data) => data.toolDefinitions,
318
+ []
319
+ );
320
+ const { execute: createToolDefinition, loading: createLoading, error: createError } = useApiAsync(
321
+ (toolDefinition) => _chunkIUKM3T2Sjs.createToolDefinitionApi.call(void 0, toolDefinition, optionsRef.current),
322
+ (data) => data.toolDefinition || null,
323
+ null
324
+ );
325
+ const { execute: updateToolDefinition, loading: updateLoading, error: updateError } = useApiAsync(
326
+ (toolDefId, toolDefinition) => _chunkIUKM3T2Sjs.updateToolDefinitionApi.call(void 0, toolDefId, toolDefinition, optionsRef.current),
327
+ (data) => data.toolDefinition || null,
328
+ null
329
+ );
330
+ const { execute: deleteToolDefinition, loading: deleteLoading, error: deleteError } = useApiAsync(
331
+ (toolDefId) => _chunkIUKM3T2Sjs.deleteToolDefinitionApi.call(void 0, toolDefId, optionsRef.current),
332
+ () => true,
333
+ false
334
+ );
335
+ const loading = listLoading || getLoading || getByIdsLoading || createLoading || updateLoading || deleteLoading;
336
+ const error = listError || getError || getByIdsError || createError || updateError || deleteError;
337
+ return _react.useMemo.call(void 0,
338
+ () => ({
339
+ loading,
340
+ error,
341
+ listToolDefinitions,
342
+ getToolDefinition,
343
+ getToolDefinitionsByIds,
344
+ createToolDefinition,
345
+ updateToolDefinition,
346
+ deleteToolDefinition
347
+ }),
348
+ [loading, error, listToolDefinitions, getToolDefinition, getToolDefinitionsByIds, createToolDefinition, updateToolDefinition, deleteToolDefinition]
349
+ );
350
+ }
351
+ function useAgentJobs(options) {
352
+ const optionsRef = useOptionsRef(options);
353
+ const { execute: listAgentJobs, loading: listLoading, error: listError } = useApiAsync(
354
+ () => _chunkIUKM3T2Sjs.listAgentJobsApi.call(void 0, optionsRef.current),
355
+ (data) => data.jobs,
356
+ []
357
+ );
358
+ const { execute: getAgentJob, loading: getLoading, error: getError } = useApiAsync(
359
+ (jobId) => _chunkIUKM3T2Sjs.getAgentJobApi.call(void 0, jobId, optionsRef.current),
360
+ (data) => data.job || null,
361
+ null
362
+ );
363
+ const { execute: createAgentJob, loading: createLoading, error: createError } = useApiAsync(
364
+ (job) => _chunkIUKM3T2Sjs.createAgentJobApi.call(void 0, job, optionsRef.current),
365
+ (data) => data.job || null,
366
+ null
367
+ );
368
+ const { execute: updateAgentJob, loading: updateLoading, error: updateError } = useApiAsync(
369
+ (jobId, job) => _chunkIUKM3T2Sjs.updateAgentJobApi.call(void 0, jobId, job, optionsRef.current),
370
+ (data) => data.job || null,
371
+ null
372
+ );
373
+ const { execute: deleteAgentJob, loading: deleteLoading, error: deleteError } = useApiAsync(
374
+ (jobId) => _chunkIUKM3T2Sjs.deleteAgentJobApi.call(void 0, jobId, optionsRef.current),
375
+ () => true,
376
+ false
377
+ );
378
+ const { execute: pauseAgentJob, loading: pauseLoading, error: pauseError } = useApiAsync(
379
+ (jobId) => _chunkIUKM3T2Sjs.pauseAgentJobApi.call(void 0, jobId, optionsRef.current),
380
+ (data) => data.job || null,
381
+ null
382
+ );
383
+ const { execute: resumeAgentJob, loading: resumeLoading, error: resumeError } = useApiAsync(
384
+ (jobId) => _chunkIUKM3T2Sjs.resumeAgentJobApi.call(void 0, jobId, optionsRef.current),
385
+ (data) => data.job || null,
386
+ null
387
+ );
388
+ const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading || pauseLoading || resumeLoading;
389
+ const error = listError || getError || createError || updateError || deleteError || pauseError || resumeError;
390
+ return _react.useMemo.call(void 0,
391
+ () => ({
392
+ loading,
393
+ error,
394
+ listAgentJobs,
395
+ getAgentJob,
396
+ createAgentJob,
397
+ updateAgentJob,
398
+ deleteAgentJob,
399
+ pauseAgentJob,
400
+ resumeAgentJob
401
+ }),
402
+ [loading, error, listAgentJobs, getAgentJob, createAgentJob, updateAgentJob, deleteAgentJob, pauseAgentJob, resumeAgentJob]
403
+ );
404
+ }
405
+ function useWidgets(options) {
406
+ const optionsRef = useOptionsRef(options);
407
+ const { execute: listWidgets, loading: listLoading, error: listError } = useApiAsync(
408
+ () => _chunkIUKM3T2Sjs.listWidgetsApi.call(void 0, optionsRef.current.agentId, optionsRef.current),
409
+ (data) => data.widgets,
410
+ []
411
+ );
412
+ const { execute: getWidget, loading: getLoading, error: getError } = useApiAsync(
413
+ (widgetId) => _chunkIUKM3T2Sjs.getWidgetApi.call(void 0, widgetId, optionsRef.current),
414
+ (data) => data.widget || null,
415
+ null
416
+ );
417
+ const { execute: getDefaultWidget, loading: defaultLoading, error: defaultError } = useApiAsync(
418
+ () => _chunkIUKM3T2Sjs.getDefaultWidgetApi.call(void 0, optionsRef.current.agentId, optionsRef.current),
419
+ (data) => data.widget || null,
420
+ null
421
+ );
422
+ const { execute: createWidget, loading: createLoading, error: createError } = useApiAsync(
423
+ (widget) => _chunkIUKM3T2Sjs.createWidgetApi.call(void 0, optionsRef.current.agentId, widget, optionsRef.current),
424
+ (data) => data.widget || null,
425
+ null
426
+ );
427
+ const { execute: updateWidget, loading: updateLoading, error: updateError } = useApiAsync(
428
+ (widgetId, widget) => _chunkIUKM3T2Sjs.updateWidgetApi.call(void 0, widgetId, widget, optionsRef.current),
429
+ (data) => data.widget || null,
430
+ null
431
+ );
432
+ const { execute: deleteWidget, loading: deleteLoading, error: deleteError } = useApiAsync(
433
+ (widgetId) => _chunkIUKM3T2Sjs.deleteWidgetApi.call(void 0, widgetId, optionsRef.current),
434
+ () => true,
435
+ false
436
+ );
437
+ const { execute: setDefaultWidget, loading: setDefaultLoading, error: setDefaultError } = useApiAsync(
438
+ (widgetId) => _chunkIUKM3T2Sjs.setDefaultWidgetApi.call(void 0, widgetId, optionsRef.current.agentId, optionsRef.current),
439
+ () => true,
440
+ false
441
+ );
442
+ const loading = listLoading || getLoading || defaultLoading || createLoading || updateLoading || deleteLoading || setDefaultLoading;
443
+ const error = listError || getError || defaultError || createError || updateError || deleteError || setDefaultError;
444
+ return _react.useMemo.call(void 0,
445
+ () => ({
446
+ loading,
447
+ error,
448
+ listWidgets,
449
+ getWidget,
450
+ getDefaultWidget,
451
+ createWidget,
452
+ updateWidget,
453
+ deleteWidget,
454
+ setDefaultWidget
455
+ }),
456
+ [loading, error, listWidgets, getWidget, getDefaultWidget, createWidget, updateWidget, deleteWidget, setDefaultWidget]
457
+ );
458
+ }
459
+ function useSkillUserConfig(options) {
460
+ const optionsRef = useOptionsRef(options);
461
+ const { execute: getSkillUserConfig, loading: getLoading, error: getError } = useApiAsync(
462
+ (skillId, agentId) => _chunkIUKM3T2Sjs.getSkillUserConfigApi.call(void 0, skillId, { ...optionsRef.current, agentId }),
463
+ (data) => data.userConfig || null,
464
+ null
465
+ );
466
+ const { execute: updateSkillUserConfig, loading: updateLoading, error: updateError } = useApiAsync(
467
+ (skillId, data) => _chunkIUKM3T2Sjs.updateSkillUserConfigApi.call(void 0, skillId, data, optionsRef.current),
468
+ (data) => data.userConfig || null,
469
+ null
470
+ );
471
+ const { execute: deleteSkillUserConfig, loading: deleteLoading, error: deleteError } = useApiAsync(
472
+ (skillId, agentId) => _chunkIUKM3T2Sjs.deleteSkillUserConfigApi.call(void 0, skillId, { ...optionsRef.current, agentId }),
473
+ () => true,
474
+ false
475
+ );
476
+ const { execute: listSkillUserConfigs, loading: listLoading, error: listError } = useApiAsync(
477
+ (params) => _chunkIUKM3T2Sjs.listSkillUserConfigsApi.call(void 0, { ...optionsRef.current, ...params }),
478
+ (data) => data.userConfigs || [],
479
+ []
480
+ );
481
+ const { execute: resolveSkillConfig, loading: resolveLoading, error: resolveError } = useApiAsync(
482
+ (skillId, agentId) => _chunkIUKM3T2Sjs.resolveSkillConfigApi.call(void 0, skillId, agentId, optionsRef.current),
483
+ (data) => data,
484
+ null
485
+ );
486
+ const loading = getLoading || updateLoading || deleteLoading || listLoading || resolveLoading;
487
+ const error = getError || updateError || deleteError || listError || resolveError;
488
+ return _react.useMemo.call(void 0,
489
+ () => ({
490
+ loading,
491
+ error,
492
+ getSkillUserConfig,
493
+ updateSkillUserConfig,
494
+ deleteSkillUserConfig,
495
+ listSkillUserConfigs,
496
+ resolveSkillConfig
497
+ }),
498
+ [loading, error, getSkillUserConfig, updateSkillUserConfig, deleteSkillUserConfig, listSkillUserConfigs, resolveSkillConfig]
499
+ );
500
+ }
501
+ function useAnalytics(options) {
502
+ const optionsRef = useOptionsRef(options);
503
+ const { execute: getAgentChatsAnalytics, loading: chatsLoading, error: chatsError } = useApiAsync(
504
+ (params) => _chunkIUKM3T2Sjs.getAgentChatsAnalyticsApi.call(void 0, params, optionsRef.current),
505
+ (data) => data.data,
506
+ []
507
+ );
508
+ const { execute: getAgentCSATAnalytics, loading: csatLoading, error: csatError } = useApiAsync(
509
+ (params) => _chunkIUKM3T2Sjs.getAgentCSATAnalyticsApi.call(void 0, params, optionsRef.current),
510
+ (data) => data.data,
511
+ []
512
+ );
513
+ const { execute: getAgentListAnalytics, loading: listLoading, error: listError } = useApiAsync(
514
+ () => _chunkIUKM3T2Sjs.getAgentListAnalyticsApi.call(void 0, optionsRef.current),
515
+ (data) => data.data,
516
+ []
517
+ );
518
+ const { execute: getTaskOutcomes, loading: taskLoading, error: taskError } = useApiAsync(
519
+ (params) => _chunkIUKM3T2Sjs.getTaskOutcomesApi.call(void 0, params, optionsRef.current),
520
+ (data) => data.data,
521
+ []
522
+ );
523
+ const loading = chatsLoading || csatLoading || listLoading || taskLoading;
524
+ const error = chatsError || csatError || listError || taskError;
525
+ return _react.useMemo.call(void 0,
526
+ () => ({
527
+ loading,
528
+ error,
529
+ getAgentChatsAnalytics,
530
+ getAgentCSATAnalytics,
531
+ getAgentListAnalytics,
532
+ getTaskOutcomes
533
+ }),
534
+ [loading, error, getAgentChatsAnalytics, getAgentCSATAnalytics, getAgentListAnalytics, getTaskOutcomes]
535
+ );
536
+ }
537
+ function useIntegrations(options) {
538
+ const optionsRef = useOptionsRef(options);
539
+ const { execute: listIntegrations, loading: listLoading, error: listError } = useApiAsync(
540
+ () => _chunkIUKM3T2Sjs.listIntegrationsApi.call(void 0, optionsRef.current),
541
+ (data) => data.integrations,
542
+ []
543
+ );
544
+ const { execute: getIntegration, loading: getLoading, error: getError } = useApiAsync(
545
+ (provider, integrationType) => _chunkIUKM3T2Sjs.getIntegrationApi.call(void 0, provider, integrationType, optionsRef.current),
546
+ (data) => data.integration || null,
547
+ null
548
+ );
549
+ const { execute: connectIntegration, loading: connectLoading, error: connectError } = useApiAsync(
550
+ (params) => _chunkIUKM3T2Sjs.connectIntegrationApi.call(void 0, params, optionsRef.current),
551
+ (data) => ({ authUrl: data.auth_url, state: data.state }),
552
+ null
553
+ );
554
+ const { execute: disconnectIntegration, loading: disconnectLoading, error: disconnectError } = useApiAsync(
555
+ (params) => _chunkIUKM3T2Sjs.disconnectIntegrationApi.call(void 0, params, optionsRef.current),
556
+ () => true,
557
+ false
558
+ );
559
+ const { execute: refreshIntegration, loading: refreshLoading, error: refreshError } = useApiAsync(
560
+ (params) => _chunkIUKM3T2Sjs.refreshIntegrationApi.call(void 0, params, optionsRef.current),
561
+ (data) => data.integration || null,
562
+ null
563
+ );
564
+ const { execute: updateTriage, loading: updateTriageLoading, error: updateTriageError } = useApiAsync(
565
+ (params) => _chunkIUKM3T2Sjs.updateIntegrationTriageApi.call(void 0, params, optionsRef.current),
566
+ (data) => data.integration || null,
567
+ null
568
+ );
569
+ const { execute: runEmailTriage, loading: runTriageLoading, error: runTriageError } = useApiAsync(
570
+ () => _chunkIUKM3T2Sjs.runEmailTriageApi.call(void 0, optionsRef.current),
571
+ (data) => ({ success: data.success, emailsFound: data.emails_found, instancesCreated: data.instances_created }),
572
+ null
573
+ );
574
+ const loading = listLoading || getLoading || connectLoading || disconnectLoading || refreshLoading || updateTriageLoading || runTriageLoading;
575
+ const error = listError || getError || connectError || disconnectError || refreshError || updateTriageError || runTriageError;
576
+ return _react.useMemo.call(void 0,
577
+ () => ({
578
+ loading,
579
+ error,
580
+ listIntegrations,
581
+ getIntegration,
582
+ connectIntegration,
583
+ disconnectIntegration,
584
+ refreshIntegration,
585
+ updateTriage,
586
+ runEmailTriage
587
+ }),
588
+ [loading, error, listIntegrations, getIntegration, connectIntegration, disconnectIntegration, refreshIntegration, updateTriage, runEmailTriage]
589
+ );
590
+ }
591
+ function useSandbox(options) {
592
+ const optionsRef = useOptionsRef(options);
593
+ const { execute: createSandbox, loading: createLoading, error: createError } = useApiAsync(
594
+ (request) => _chunkIUKM3T2Sjs.createSandboxApi.call(void 0, request, optionsRef.current),
595
+ (data) => ({ id: data.id, url: data.url, sandbox: data.sandbox }),
596
+ null
597
+ );
598
+ const { execute: getSandbox, loading: getLoading, error: getError } = useApiAsync(
599
+ (sandboxId) => _chunkIUKM3T2Sjs.getSandboxApi.call(void 0, sandboxId, optionsRef.current),
600
+ (data) => data.sandbox || null,
601
+ null
602
+ );
603
+ const { execute: updateSandbox, loading: updateLoading, error: updateError } = useApiAsync(
604
+ (sandboxId, request) => _chunkIUKM3T2Sjs.updateSandboxApi.call(void 0, sandboxId, request, optionsRef.current),
605
+ (data) => ({ id: data.id, url: data.url, sandbox: data.sandbox }),
606
+ null
607
+ );
608
+ const { execute: listSandboxes, loading: listLoading, error: listError } = useApiAsync(
609
+ (limit) => _chunkIUKM3T2Sjs.listSandboxesApi.call(void 0, { ...optionsRef.current, limit }),
610
+ (data) => ({ sandboxes: data.sandboxes, total: data.total }),
611
+ { sandboxes: [], total: 0 }
612
+ );
613
+ const { execute: deleteSandbox, loading: deleteLoading, error: deleteError } = useApiAsync(
614
+ (sandboxId) => _chunkIUKM3T2Sjs.deleteSandboxApi.call(void 0, sandboxId, optionsRef.current),
615
+ (data) => data.success,
616
+ false
617
+ );
618
+ const loading = createLoading || getLoading || updateLoading || listLoading || deleteLoading;
619
+ const error = createError || getError || updateError || listError || deleteError;
620
+ return _react.useMemo.call(void 0,
621
+ () => ({
622
+ loading,
623
+ error,
624
+ createSandbox,
625
+ getSandbox,
626
+ updateSandbox,
627
+ listSandboxes,
628
+ deleteSandbox
629
+ }),
630
+ [loading, error, createSandbox, getSandbox, updateSandbox, listSandboxes, deleteSandbox]
631
+ );
632
+ }
633
+ function useSchedulerTasks(options) {
634
+ const optionsRef = useOptionsRef(options);
635
+ const { execute: listTasks, loading: listLoading, error: listError } = useApiAsync(
636
+ (params) => _chunkIUKM3T2Sjs.listSchedulerTasksApi.call(void 0, { ...optionsRef.current, ...params }),
637
+ (data) => data.tasks,
638
+ []
639
+ );
640
+ const { execute: createTask, loading: createLoading, error: createError } = useApiAsync(
641
+ (task) => _chunkIUKM3T2Sjs.createSchedulerTaskApi.call(void 0, task, optionsRef.current),
642
+ (data) => data.task || null,
643
+ null
644
+ );
645
+ const { execute: getTask, loading: getLoading, error: getError } = useApiAsync(
646
+ (taskId) => _chunkIUKM3T2Sjs.getSchedulerTaskApi.call(void 0, taskId, optionsRef.current),
647
+ (data) => data.task || null,
648
+ null
649
+ );
650
+ const { execute: updateTask, loading: updateLoading, error: updateError } = useApiAsync(
651
+ (taskId, task) => _chunkIUKM3T2Sjs.updateSchedulerTaskApi.call(void 0, taskId, task, optionsRef.current),
652
+ (data) => data.task || null,
653
+ null
654
+ );
655
+ const { execute: deleteTask, loading: deleteLoading, error: deleteError } = useApiAsync(
656
+ (taskId) => _chunkIUKM3T2Sjs.deleteSchedulerTaskApi.call(void 0, taskId, optionsRef.current),
657
+ (data) => data.success,
658
+ false
659
+ );
660
+ const { execute: snoozeTask, loading: snoozeLoading, error: snoozeError } = useApiAsync(
661
+ (taskId, delay) => _chunkIUKM3T2Sjs.snoozeSchedulerTaskApi.call(void 0, taskId, delay, optionsRef.current),
662
+ (data) => data.task || null,
663
+ null
664
+ );
665
+ const { execute: completeTask, loading: completeLoading, error: completeError } = useApiAsync(
666
+ (taskId) => _chunkIUKM3T2Sjs.completeSchedulerTaskApi.call(void 0, taskId, optionsRef.current),
667
+ (data) => data.task || null,
668
+ null
669
+ );
670
+ const { execute: startTask, loading: startLoading, error: startError } = useApiAsync(
671
+ (taskId) => _chunkIUKM3T2Sjs.startSchedulerTaskApi.call(void 0, taskId, optionsRef.current),
672
+ (data) => data.task || null,
673
+ null
674
+ );
675
+ const loading = listLoading || createLoading || getLoading || updateLoading || deleteLoading || snoozeLoading || completeLoading || startLoading;
676
+ const error = listError || createError || getError || updateError || deleteError || snoozeError || completeError || startError;
677
+ return _react.useMemo.call(void 0,
678
+ () => ({
679
+ loading,
680
+ error,
681
+ listTasks,
682
+ createTask,
683
+ getTask,
684
+ updateTask,
685
+ deleteTask,
686
+ snoozeTask,
687
+ completeTask,
688
+ startTask
689
+ }),
690
+ [loading, error, listTasks, createTask, getTask, updateTask, deleteTask, snoozeTask, completeTask, startTask]
691
+ );
692
+ }
693
+ function useSchedulerSchedules(options) {
694
+ const optionsRef = useOptionsRef(options);
695
+ const { execute: listSchedules, loading: listLoading, error: listError } = useApiAsync(
696
+ (params) => _chunkIUKM3T2Sjs.listSchedulesApi.call(void 0, { ...optionsRef.current, ...params }),
697
+ (data) => data.schedules,
698
+ []
699
+ );
700
+ const { execute: createSchedule, loading: createLoading, error: createError } = useApiAsync(
701
+ (schedule) => _chunkIUKM3T2Sjs.createScheduleApi.call(void 0, schedule, optionsRef.current),
702
+ (data) => data.schedule || null,
703
+ null
704
+ );
705
+ const { execute: getSchedule, loading: getLoading, error: getError } = useApiAsync(
706
+ (scheduleId) => _chunkIUKM3T2Sjs.getScheduleApi.call(void 0, scheduleId, optionsRef.current),
707
+ (data) => data.schedule || null,
708
+ null
709
+ );
710
+ const { execute: updateSchedule, loading: updateLoading, error: updateError } = useApiAsync(
711
+ (scheduleId, schedule) => _chunkIUKM3T2Sjs.updateScheduleApi.call(void 0, scheduleId, schedule, optionsRef.current),
712
+ (data) => data.schedule || null,
713
+ null
714
+ );
715
+ const { execute: deleteSchedule, loading: deleteLoading, error: deleteError } = useApiAsync(
716
+ (scheduleId) => _chunkIUKM3T2Sjs.deleteScheduleApi.call(void 0, scheduleId, optionsRef.current),
717
+ (data) => data.success,
718
+ false
719
+ );
720
+ const { execute: pauseSchedule, loading: pauseLoading, error: pauseError } = useApiAsync(
721
+ (scheduleId) => _chunkIUKM3T2Sjs.pauseScheduleApi.call(void 0, scheduleId, optionsRef.current),
722
+ (data) => data.schedule || null,
723
+ null
724
+ );
725
+ const { execute: resumeSchedule, loading: resumeLoading, error: resumeError } = useApiAsync(
726
+ (scheduleId) => _chunkIUKM3T2Sjs.resumeScheduleApi.call(void 0, scheduleId, optionsRef.current),
727
+ (data) => data.schedule || null,
728
+ null
729
+ );
730
+ const { execute: runSchedule, loading: runLoading, error: runError } = useApiAsync(
731
+ (scheduleId) => _chunkIUKM3T2Sjs.runScheduleApi.call(void 0, scheduleId, optionsRef.current),
732
+ (data) => data.schedule || null,
733
+ null
734
+ );
735
+ const loading = listLoading || createLoading || getLoading || updateLoading || deleteLoading || pauseLoading || resumeLoading || runLoading;
736
+ const error = listError || createError || getError || updateError || deleteError || pauseError || resumeError || runError;
737
+ return _react.useMemo.call(void 0,
738
+ () => ({
739
+ loading,
740
+ error,
741
+ listSchedules,
742
+ createSchedule,
743
+ getSchedule,
744
+ updateSchedule,
745
+ deleteSchedule,
746
+ pauseSchedule,
747
+ resumeSchedule,
748
+ runSchedule
749
+ }),
750
+ [loading, error, listSchedules, createSchedule, getSchedule, updateSchedule, deleteSchedule, pauseSchedule, resumeSchedule, runSchedule]
751
+ );
752
+ }
753
+
754
+
755
+
756
+
757
+
758
+
759
+
760
+
761
+
762
+
763
+
764
+
765
+
766
+
767
+
768
+
769
+
770
+ exports.useAsync = useAsync; exports.useApiAsync = useApiAsync; exports.useOptionsRef = useOptionsRef; exports.useAgents = useAgents; exports.useSkills = useSkills; exports.useSubAgents = useSubAgents; exports.useToolDefinitions = useToolDefinitions; exports.useAgentJobs = useAgentJobs; exports.useWidgets = useWidgets; exports.useSkillUserConfig = useSkillUserConfig; exports.useAnalytics = useAnalytics; exports.useIntegrations = useIntegrations; exports.useSandbox = useSandbox; exports.useSchedulerTasks = useSchedulerTasks; exports.useSchedulerSchedules = useSchedulerSchedules;
771
+ //# sourceMappingURL=chunk-RGVWAFZP.js.map