@elqnt/agents 2.1.1 → 3.0.1

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.
Files changed (50) hide show
  1. package/README.md +240 -0
  2. package/dist/{agent-models-mCYzjfGp.d.mts → agent-models-BdtFKjV3.d.mts} +7 -9
  3. package/dist/{agent-models-mCYzjfGp.d.ts → agent-models-BdtFKjV3.d.ts} +7 -9
  4. package/dist/api/index.d.mts +40 -3
  5. package/dist/api/index.d.ts +40 -3
  6. package/dist/api/index.js +30 -2
  7. package/dist/api/index.js.map +1 -1
  8. package/dist/api/index.mjs +29 -1
  9. package/dist/api/server.d.mts +146 -0
  10. package/dist/api/server.d.ts +146 -0
  11. package/dist/api/server.js +226 -0
  12. package/dist/api/server.js.map +1 -0
  13. package/dist/api/server.mjs +226 -0
  14. package/dist/api/server.mjs.map +1 -0
  15. package/dist/{chunk-SWJ66D7X.js → chunk-44A5L2IY.js} +92 -2
  16. package/dist/chunk-44A5L2IY.js.map +1 -0
  17. package/dist/{chunk-K3OAYHF3.js → chunk-ADOBVUUS.js} +73 -2
  18. package/dist/chunk-ADOBVUUS.js.map +1 -0
  19. package/dist/{chunk-3VJNDDME.mjs → chunk-EUELXX27.mjs} +92 -2
  20. package/dist/chunk-EUELXX27.mjs.map +1 -0
  21. package/dist/{chunk-SZP2G5I7.mjs → chunk-O3FM26FT.mjs} +73 -2
  22. package/dist/chunk-O3FM26FT.mjs.map +1 -0
  23. package/dist/chunk-RTUQ7WKT.mjs +434 -0
  24. package/dist/chunk-RTUQ7WKT.mjs.map +1 -0
  25. package/dist/chunk-VVYOTEM2.js +434 -0
  26. package/dist/chunk-VVYOTEM2.js.map +1 -0
  27. package/dist/hooks/index.d.mts +134 -5
  28. package/dist/hooks/index.d.ts +134 -5
  29. package/dist/hooks/index.js +15 -3
  30. package/dist/hooks/index.js.map +1 -1
  31. package/dist/hooks/index.mjs +16 -4
  32. package/dist/index.d.mts +4 -4
  33. package/dist/index.d.ts +4 -4
  34. package/dist/index.js +130 -4
  35. package/dist/index.js.map +1 -1
  36. package/dist/index.mjs +131 -5
  37. package/dist/models/index.d.mts +880 -2
  38. package/dist/models/index.d.ts +880 -2
  39. package/dist/models/index.js +88 -2
  40. package/dist/models/index.js.map +1 -1
  41. package/dist/models/index.mjs +87 -1
  42. package/package.json +20 -17
  43. package/dist/chunk-3VJNDDME.mjs.map +0 -1
  44. package/dist/chunk-K3OAYHF3.js.map +0 -1
  45. package/dist/chunk-O2SYQSU2.mjs +0 -398
  46. package/dist/chunk-O2SYQSU2.mjs.map +0 -1
  47. package/dist/chunk-RPXANLP2.js +0 -398
  48. package/dist/chunk-RPXANLP2.js.map +0 -1
  49. package/dist/chunk-SWJ66D7X.js.map +0 -1
  50. package/dist/chunk-SZP2G5I7.mjs.map +0 -1
@@ -0,0 +1,434 @@
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
+ var _chunkADOBVUUSjs = require('./chunk-ADOBVUUS.js');
42
+
43
+ // hooks/index.ts
44
+ var _react = require('react');
45
+
46
+ // hooks/use-async.ts
47
+
48
+ function useAsync(asyncFn, options) {
49
+ const [error, setError] = _react.useState.call(void 0, null);
50
+ const requestCountRef = _react.useRef.call(void 0, 0);
51
+ const [loading, setLoading] = _react.useState.call(void 0, false);
52
+ const execute = _react.useCallback.call(void 0,
53
+ async (...args) => {
54
+ requestCountRef.current += 1;
55
+ setLoading(true);
56
+ setError(null);
57
+ try {
58
+ return await asyncFn(...args);
59
+ } catch (err) {
60
+ const message = err instanceof Error ? err.message : "An error occurred";
61
+ setError(message);
62
+ _optionalChain([options, 'optionalAccess', _ => _.onError, 'optionalCall', _2 => _2(message)]);
63
+ throw err;
64
+ } finally {
65
+ requestCountRef.current -= 1;
66
+ if (requestCountRef.current === 0) {
67
+ setLoading(false);
68
+ }
69
+ }
70
+ },
71
+ [asyncFn, options]
72
+ );
73
+ const clearError = _react.useCallback.call(void 0, () => setError(null), []);
74
+ return { execute, loading, error, clearError };
75
+ }
76
+ function useApiAsync(asyncFn, extractor, defaultValue, options) {
77
+ const [error, setError] = _react.useState.call(void 0, null);
78
+ const requestCountRef = _react.useRef.call(void 0, 0);
79
+ const [loading, setLoading] = _react.useState.call(void 0, false);
80
+ const execute = _react.useCallback.call(void 0,
81
+ async (...args) => {
82
+ requestCountRef.current += 1;
83
+ setLoading(true);
84
+ setError(null);
85
+ try {
86
+ const response = await asyncFn(...args);
87
+ if (response.error) {
88
+ setError(response.error);
89
+ _optionalChain([options, 'optionalAccess', _3 => _3.onError, 'optionalCall', _4 => _4(response.error)]);
90
+ return defaultValue;
91
+ }
92
+ return response.data ? extractor(response.data) : defaultValue;
93
+ } catch (err) {
94
+ const message = err instanceof Error ? err.message : "An error occurred";
95
+ setError(message);
96
+ _optionalChain([options, 'optionalAccess', _5 => _5.onError, 'optionalCall', _6 => _6(message)]);
97
+ return defaultValue;
98
+ } finally {
99
+ requestCountRef.current -= 1;
100
+ if (requestCountRef.current === 0) {
101
+ setLoading(false);
102
+ }
103
+ }
104
+ },
105
+ [asyncFn, extractor, defaultValue, options]
106
+ );
107
+ const clearError = _react.useCallback.call(void 0, () => setError(null), []);
108
+ return { execute, loading, error, clearError };
109
+ }
110
+
111
+ // hooks/use-options-ref.ts
112
+
113
+ function useOptionsRef(options) {
114
+ const optionsRef = _react.useRef.call(void 0, options);
115
+ _react.useEffect.call(void 0, () => {
116
+ optionsRef.current = options;
117
+ }, [options]);
118
+ return optionsRef;
119
+ }
120
+
121
+ // hooks/index.ts
122
+ function useAgents(options) {
123
+ const optionsRef = useOptionsRef(options);
124
+ const { execute: listAgents, loading: listLoading, error: listError } = useApiAsync(
125
+ () => _chunkADOBVUUSjs.listAgentsApi.call(void 0, optionsRef.current),
126
+ (data) => data.agents,
127
+ []
128
+ );
129
+ const { execute: listAgentSummaries, loading: listSummaryLoading, error: listSummaryError } = useApiAsync(
130
+ () => _chunkADOBVUUSjs.listAgentsSummaryApi.call(void 0, optionsRef.current),
131
+ (data) => data.agents,
132
+ []
133
+ );
134
+ const { execute: getAgent, loading: getLoading, error: getError } = useApiAsync(
135
+ (agentId) => _chunkADOBVUUSjs.getAgentApi.call(void 0, agentId, optionsRef.current),
136
+ (data) => data.agent || null,
137
+ null
138
+ );
139
+ const { execute: createAgent, loading: createLoading, error: createError } = useApiAsync(
140
+ (agent) => _chunkADOBVUUSjs.createAgentApi.call(void 0, agent, optionsRef.current),
141
+ (data) => data.agent || null,
142
+ null
143
+ );
144
+ const { execute: updateAgent, loading: updateLoading, error: updateError } = useApiAsync(
145
+ (agentId, agent) => _chunkADOBVUUSjs.updateAgentApi.call(void 0, agentId, agent, optionsRef.current),
146
+ (data) => data.agent || null,
147
+ null
148
+ );
149
+ const { execute: deleteAgent, loading: deleteLoading, error: deleteError } = useApiAsync(
150
+ (agentId) => _chunkADOBVUUSjs.deleteAgentApi.call(void 0, agentId, optionsRef.current),
151
+ () => true,
152
+ false
153
+ );
154
+ const { execute: getDefaultAgent, loading: defaultLoading, error: defaultError } = useApiAsync(
155
+ () => _chunkADOBVUUSjs.getDefaultAgentApi.call(void 0, optionsRef.current),
156
+ (data) => data.agent || null,
157
+ null
158
+ );
159
+ const loading = listLoading || listSummaryLoading || getLoading || createLoading || updateLoading || deleteLoading || defaultLoading;
160
+ const error = listError || listSummaryError || getError || createError || updateError || deleteError || defaultError;
161
+ return _react.useMemo.call(void 0,
162
+ () => ({
163
+ loading,
164
+ error,
165
+ listAgents,
166
+ listAgentSummaries,
167
+ getAgent,
168
+ createAgent,
169
+ updateAgent,
170
+ deleteAgent,
171
+ getDefaultAgent
172
+ }),
173
+ [loading, error, listAgents, listAgentSummaries, getAgent, createAgent, updateAgent, deleteAgent, getDefaultAgent]
174
+ );
175
+ }
176
+ function useSkills(options) {
177
+ const optionsRef = useOptionsRef(options);
178
+ const { execute: listSkills, loading: listLoading, error: listError } = useApiAsync(
179
+ () => _chunkADOBVUUSjs.listSkillsApi.call(void 0, optionsRef.current),
180
+ (data) => data.skills,
181
+ []
182
+ );
183
+ const { execute: getSkill, loading: getLoading, error: getError } = useApiAsync(
184
+ (skillId) => _chunkADOBVUUSjs.getSkillApi.call(void 0, skillId, optionsRef.current),
185
+ (data) => data.skill || null,
186
+ null
187
+ );
188
+ const { execute: createSkill, loading: createLoading, error: createError } = useApiAsync(
189
+ (skill) => _chunkADOBVUUSjs.createSkillApi.call(void 0, skill, optionsRef.current),
190
+ (data) => data.skill || null,
191
+ null
192
+ );
193
+ const { execute: updateSkill, loading: updateLoading, error: updateError } = useApiAsync(
194
+ (skillId, skill) => _chunkADOBVUUSjs.updateSkillApi.call(void 0, skillId, skill, optionsRef.current),
195
+ (data) => data.skill || null,
196
+ null
197
+ );
198
+ const { execute: deleteSkill, loading: deleteLoading, error: deleteError } = useApiAsync(
199
+ (skillId) => _chunkADOBVUUSjs.deleteSkillApi.call(void 0, skillId, optionsRef.current),
200
+ () => true,
201
+ false
202
+ );
203
+ const { execute: getCategories, loading: categoriesLoading, error: categoriesError } = useApiAsync(
204
+ () => _chunkADOBVUUSjs.getSkillCategoriesApi.call(void 0, optionsRef.current),
205
+ (data) => data.categories,
206
+ []
207
+ );
208
+ const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading || categoriesLoading;
209
+ const error = listError || getError || createError || updateError || deleteError || categoriesError;
210
+ return _react.useMemo.call(void 0,
211
+ () => ({
212
+ loading,
213
+ error,
214
+ listSkills,
215
+ getSkill,
216
+ createSkill,
217
+ updateSkill,
218
+ deleteSkill,
219
+ getCategories
220
+ }),
221
+ [loading, error, listSkills, getSkill, createSkill, updateSkill, deleteSkill, getCategories]
222
+ );
223
+ }
224
+ function useSubAgents(options) {
225
+ const optionsRef = useOptionsRef(options);
226
+ const { execute: listSubAgents, loading: listLoading, error: listError } = useApiAsync(
227
+ () => _chunkADOBVUUSjs.listSubAgentsApi.call(void 0, optionsRef.current),
228
+ (data) => data.subAgents,
229
+ []
230
+ );
231
+ const { execute: getSubAgent, loading: getLoading, error: getError } = useApiAsync(
232
+ (subAgentId) => _chunkADOBVUUSjs.getSubAgentApi.call(void 0, subAgentId, optionsRef.current),
233
+ (data) => data.subAgent || null,
234
+ null
235
+ );
236
+ const { execute: createSubAgent, loading: createLoading, error: createError } = useApiAsync(
237
+ (subAgent) => _chunkADOBVUUSjs.createSubAgentApi.call(void 0, subAgent, optionsRef.current),
238
+ (data) => data.subAgent || null,
239
+ null
240
+ );
241
+ const { execute: updateSubAgent, loading: updateLoading, error: updateError } = useApiAsync(
242
+ (subAgentId, subAgent) => _chunkADOBVUUSjs.updateSubAgentApi.call(void 0, subAgentId, subAgent, optionsRef.current),
243
+ (data) => data.subAgent || null,
244
+ null
245
+ );
246
+ const { execute: deleteSubAgent, loading: deleteLoading, error: deleteError } = useApiAsync(
247
+ (subAgentId) => _chunkADOBVUUSjs.deleteSubAgentApi.call(void 0, subAgentId, optionsRef.current),
248
+ () => true,
249
+ false
250
+ );
251
+ const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading;
252
+ const error = listError || getError || createError || updateError || deleteError;
253
+ return _react.useMemo.call(void 0,
254
+ () => ({
255
+ loading,
256
+ error,
257
+ listSubAgents,
258
+ getSubAgent,
259
+ createSubAgent,
260
+ updateSubAgent,
261
+ deleteSubAgent
262
+ }),
263
+ [loading, error, listSubAgents, getSubAgent, createSubAgent, updateSubAgent, deleteSubAgent]
264
+ );
265
+ }
266
+ function useToolDefinitions(options) {
267
+ const optionsRef = useOptionsRef(options);
268
+ const { execute: listToolDefinitions, loading: listLoading, error: listError } = useApiAsync(
269
+ () => _chunkADOBVUUSjs.listToolDefinitionsApi.call(void 0, optionsRef.current),
270
+ (data) => data.toolDefinitions,
271
+ []
272
+ );
273
+ const { execute: getToolDefinition, loading: getLoading, error: getError } = useApiAsync(
274
+ (toolDefId) => _chunkADOBVUUSjs.getToolDefinitionApi.call(void 0, toolDefId, optionsRef.current),
275
+ (data) => data.toolDefinition || null,
276
+ null
277
+ );
278
+ const { execute: getToolDefinitionsByIds, loading: getByIdsLoading, error: getByIdsError } = useApiAsync(
279
+ (ids) => _chunkADOBVUUSjs.getToolDefinitionsByIdsApi.call(void 0, ids, optionsRef.current),
280
+ (data) => data.toolDefinitions,
281
+ []
282
+ );
283
+ const { execute: createToolDefinition, loading: createLoading, error: createError } = useApiAsync(
284
+ (toolDefinition) => _chunkADOBVUUSjs.createToolDefinitionApi.call(void 0, toolDefinition, optionsRef.current),
285
+ (data) => data.toolDefinition || null,
286
+ null
287
+ );
288
+ const { execute: updateToolDefinition, loading: updateLoading, error: updateError } = useApiAsync(
289
+ (toolDefId, toolDefinition) => _chunkADOBVUUSjs.updateToolDefinitionApi.call(void 0, toolDefId, toolDefinition, optionsRef.current),
290
+ (data) => data.toolDefinition || null,
291
+ null
292
+ );
293
+ const { execute: deleteToolDefinition, loading: deleteLoading, error: deleteError } = useApiAsync(
294
+ (toolDefId) => _chunkADOBVUUSjs.deleteToolDefinitionApi.call(void 0, toolDefId, optionsRef.current),
295
+ () => true,
296
+ false
297
+ );
298
+ const loading = listLoading || getLoading || getByIdsLoading || createLoading || updateLoading || deleteLoading;
299
+ const error = listError || getError || getByIdsError || createError || updateError || deleteError;
300
+ return _react.useMemo.call(void 0,
301
+ () => ({
302
+ loading,
303
+ error,
304
+ listToolDefinitions,
305
+ getToolDefinition,
306
+ getToolDefinitionsByIds,
307
+ createToolDefinition,
308
+ updateToolDefinition,
309
+ deleteToolDefinition
310
+ }),
311
+ [loading, error, listToolDefinitions, getToolDefinition, getToolDefinitionsByIds, createToolDefinition, updateToolDefinition, deleteToolDefinition]
312
+ );
313
+ }
314
+ function useAgentJobs(options) {
315
+ const optionsRef = useOptionsRef(options);
316
+ const { execute: listAgentJobs, loading: listLoading, error: listError } = useApiAsync(
317
+ () => _chunkADOBVUUSjs.listAgentJobsApi.call(void 0, optionsRef.current),
318
+ (data) => data.jobs,
319
+ []
320
+ );
321
+ const { execute: getAgentJob, loading: getLoading, error: getError } = useApiAsync(
322
+ (jobId) => _chunkADOBVUUSjs.getAgentJobApi.call(void 0, jobId, optionsRef.current),
323
+ (data) => data.job || null,
324
+ null
325
+ );
326
+ const { execute: createAgentJob, loading: createLoading, error: createError } = useApiAsync(
327
+ (job) => _chunkADOBVUUSjs.createAgentJobApi.call(void 0, job, optionsRef.current),
328
+ (data) => data.job || null,
329
+ null
330
+ );
331
+ const { execute: updateAgentJob, loading: updateLoading, error: updateError } = useApiAsync(
332
+ (jobId, job) => _chunkADOBVUUSjs.updateAgentJobApi.call(void 0, jobId, job, optionsRef.current),
333
+ (data) => data.job || null,
334
+ null
335
+ );
336
+ const { execute: deleteAgentJob, loading: deleteLoading, error: deleteError } = useApiAsync(
337
+ (jobId) => _chunkADOBVUUSjs.deleteAgentJobApi.call(void 0, jobId, optionsRef.current),
338
+ () => true,
339
+ false
340
+ );
341
+ const { execute: pauseAgentJob, loading: pauseLoading, error: pauseError } = useApiAsync(
342
+ (jobId) => _chunkADOBVUUSjs.pauseAgentJobApi.call(void 0, jobId, optionsRef.current),
343
+ (data) => data.job || null,
344
+ null
345
+ );
346
+ const { execute: resumeAgentJob, loading: resumeLoading, error: resumeError } = useApiAsync(
347
+ (jobId) => _chunkADOBVUUSjs.resumeAgentJobApi.call(void 0, jobId, optionsRef.current),
348
+ (data) => data.job || null,
349
+ null
350
+ );
351
+ const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading || pauseLoading || resumeLoading;
352
+ const error = listError || getError || createError || updateError || deleteError || pauseError || resumeError;
353
+ return _react.useMemo.call(void 0,
354
+ () => ({
355
+ loading,
356
+ error,
357
+ listAgentJobs,
358
+ getAgentJob,
359
+ createAgentJob,
360
+ updateAgentJob,
361
+ deleteAgentJob,
362
+ pauseAgentJob,
363
+ resumeAgentJob
364
+ }),
365
+ [loading, error, listAgentJobs, getAgentJob, createAgentJob, updateAgentJob, deleteAgentJob, pauseAgentJob, resumeAgentJob]
366
+ );
367
+ }
368
+ function useWidgets(options) {
369
+ const optionsRef = useOptionsRef(options);
370
+ const { execute: listWidgets, loading: listLoading, error: listError } = useApiAsync(
371
+ () => _chunkADOBVUUSjs.listWidgetsApi.call(void 0, optionsRef.current.agentId, optionsRef.current),
372
+ (data) => data.widgets,
373
+ []
374
+ );
375
+ const { execute: getWidget, loading: getLoading, error: getError } = useApiAsync(
376
+ (widgetId) => _chunkADOBVUUSjs.getWidgetApi.call(void 0, widgetId, optionsRef.current),
377
+ (data) => data.widget || null,
378
+ null
379
+ );
380
+ const { execute: getDefaultWidget, loading: defaultLoading, error: defaultError } = useApiAsync(
381
+ () => _chunkADOBVUUSjs.getDefaultWidgetApi.call(void 0, optionsRef.current.agentId, optionsRef.current),
382
+ (data) => data.widget || null,
383
+ null
384
+ );
385
+ const { execute: createWidget, loading: createLoading, error: createError } = useApiAsync(
386
+ (widget) => _chunkADOBVUUSjs.createWidgetApi.call(void 0, optionsRef.current.agentId, widget, optionsRef.current),
387
+ (data) => data.widget || null,
388
+ null
389
+ );
390
+ const { execute: updateWidget, loading: updateLoading, error: updateError } = useApiAsync(
391
+ (widgetId, widget) => _chunkADOBVUUSjs.updateWidgetApi.call(void 0, widgetId, widget, optionsRef.current),
392
+ (data) => data.widget || null,
393
+ null
394
+ );
395
+ const { execute: deleteWidget, loading: deleteLoading, error: deleteError } = useApiAsync(
396
+ (widgetId) => _chunkADOBVUUSjs.deleteWidgetApi.call(void 0, widgetId, optionsRef.current),
397
+ () => true,
398
+ false
399
+ );
400
+ const { execute: setDefaultWidget, loading: setDefaultLoading, error: setDefaultError } = useApiAsync(
401
+ (widgetId) => _chunkADOBVUUSjs.setDefaultWidgetApi.call(void 0, widgetId, optionsRef.current.agentId, optionsRef.current),
402
+ () => true,
403
+ false
404
+ );
405
+ const loading = listLoading || getLoading || defaultLoading || createLoading || updateLoading || deleteLoading || setDefaultLoading;
406
+ const error = listError || getError || defaultError || createError || updateError || deleteError || setDefaultError;
407
+ return _react.useMemo.call(void 0,
408
+ () => ({
409
+ loading,
410
+ error,
411
+ listWidgets,
412
+ getWidget,
413
+ getDefaultWidget,
414
+ createWidget,
415
+ updateWidget,
416
+ deleteWidget,
417
+ setDefaultWidget
418
+ }),
419
+ [loading, error, listWidgets, getWidget, getDefaultWidget, createWidget, updateWidget, deleteWidget, setDefaultWidget]
420
+ );
421
+ }
422
+
423
+
424
+
425
+
426
+
427
+
428
+
429
+
430
+
431
+
432
+
433
+ 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;
434
+ //# sourceMappingURL=chunk-VVYOTEM2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/eloquent-packages/eloquent-packages/packages/agents/dist/chunk-VVYOTEM2.js","../hooks/index.ts","../hooks/use-async.ts","../hooks/use-options-ref.ts"],"names":["useRef"],"mappings":"AAAA,ylBAAY;AACZ;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AM,QAAA,EAAU,YAAA,GAAe,WAAA,GAAc,eAAA,GAAkB,cAAA,GAAiB,cAAA,GAAiB,cAAA,GAAiB,iBAAA;AAClH,EAAA,MAAM,MAAA,EAAQ,UAAA,GAAa,SAAA,GAAY,aAAA,GAAgB,YAAA,GAAe,YAAA,GAAe,YAAA,GAAe,eAAA;AAEpG,EAAA,OAAO,4BAAA;AAAA,IACL,CAAA,EAAA,GAAA,CAAO;AAAA,MACL,OAAA;AAAA,MACA,KAAA;AAAA,MACA,WAAA;AAAA,MACA,SAAA;AAAA,MACA,gBAAA;AAAA,MACA,YAAA;AAAA,MACA,YAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA,IACF,CAAA,CAAA;AAAA,IACA,CAAC,OAAA,EAAS,KAAA,EAAO,WAAA,EAAa,SAAA,EAAW,gBAAA,EAAkB,YAAA,EAAc,YAAA,EAAc,YAAA,EAAc,gBAAgB;AAAA,EACvH,CAAA;AACF;ADzFA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,gUAAC","file":"/home/runner/work/eloquent-packages/eloquent-packages/packages/agents/dist/chunk-VVYOTEM2.js","sourcesContent":[null,"\"use client\";\n\n/**\n * Agent hooks for React applications\n *\n * Provides React hooks for agent CRUD operations with loading/error states.\n *\n * @packageDocumentation\n */\n\nimport { useMemo } from \"react\";\nimport type { ApiClientOptions } from \"@elqnt/api-client\";\nimport type { Agent, AgentSummary, Skill, SubAgent, ToolDefinition, AgentJob, AgentWidget } from \"../models\";\nimport {\n // Agents\n listAgentsApi,\n listAgentsSummaryApi,\n getAgentApi,\n createAgentApi,\n updateAgentApi,\n deleteAgentApi,\n getDefaultAgentApi,\n // Skills\n listSkillsApi,\n getSkillApi,\n createSkillApi,\n updateSkillApi,\n deleteSkillApi,\n getSkillCategoriesApi,\n // Sub-Agents\n listSubAgentsApi,\n getSubAgentApi,\n createSubAgentApi,\n updateSubAgentApi,\n deleteSubAgentApi,\n // Tool Definitions\n listToolDefinitionsApi,\n getToolDefinitionApi,\n createToolDefinitionApi,\n updateToolDefinitionApi,\n deleteToolDefinitionApi,\n getToolDefinitionsByIdsApi,\n // Agent Jobs\n listAgentJobsApi,\n getAgentJobApi,\n createAgentJobApi,\n updateAgentJobApi,\n deleteAgentJobApi,\n pauseAgentJobApi,\n resumeAgentJobApi,\n // Widgets\n listWidgetsApi,\n getWidgetApi,\n createWidgetApi,\n updateWidgetApi,\n deleteWidgetApi,\n getDefaultWidgetApi,\n setDefaultWidgetApi,\n} from \"../api\";\nimport { useApiAsync } from \"./use-async\";\nimport { useOptionsRef } from \"./use-options-ref\";\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\nexport type UseAgentsOptions = ApiClientOptions;\n\n// =============================================================================\n// USE AGENTS HOOK\n// =============================================================================\n\n/**\n * Hook for agent CRUD operations\n *\n * @example\n * ```tsx\n * const { loading, error, listAgents, createAgent } = useAgents({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * });\n *\n * const agents = await listAgents();\n * ```\n */\nexport function useAgents(options: UseAgentsOptions) {\n const optionsRef = useOptionsRef(options);\n\n const { execute: listAgents, loading: listLoading, error: listError } = useApiAsync(\n () => listAgentsApi(optionsRef.current),\n (data) => data.agents,\n [] as Agent[]\n );\n\n const { execute: listAgentSummaries, loading: listSummaryLoading, error: listSummaryError } = useApiAsync(\n () => listAgentsSummaryApi(optionsRef.current),\n (data) => data.agents,\n [] as AgentSummary[]\n );\n\n const { execute: getAgent, loading: getLoading, error: getError } = useApiAsync(\n (agentId: string) => getAgentApi(agentId, optionsRef.current),\n (data) => data.agent || null,\n null as Agent | null\n );\n\n const { execute: createAgent, loading: createLoading, error: createError } = useApiAsync(\n (agent: Partial<Agent>) => createAgentApi(agent, optionsRef.current),\n (data) => data.agent || null,\n null as Agent | null\n );\n\n const { execute: updateAgent, loading: updateLoading, error: updateError } = useApiAsync(\n (agentId: string, agent: Partial<Agent>) => updateAgentApi(agentId, agent, optionsRef.current),\n (data) => data.agent || null,\n null as Agent | null\n );\n\n const { execute: deleteAgent, loading: deleteLoading, error: deleteError } = useApiAsync(\n (agentId: string) => deleteAgentApi(agentId, optionsRef.current),\n () => true,\n false\n );\n\n const { execute: getDefaultAgent, loading: defaultLoading, error: defaultError } = useApiAsync(\n () => getDefaultAgentApi(optionsRef.current),\n (data) => data.agent || null,\n null as Agent | null\n );\n\n const loading = listLoading || listSummaryLoading || getLoading || createLoading || updateLoading || deleteLoading || defaultLoading;\n const error = listError || listSummaryError || getError || createError || updateError || deleteError || defaultError;\n\n return useMemo(\n () => ({\n loading,\n error,\n listAgents,\n listAgentSummaries,\n getAgent,\n createAgent,\n updateAgent,\n deleteAgent,\n getDefaultAgent,\n }),\n [loading, error, listAgents, listAgentSummaries, getAgent, createAgent, updateAgent, deleteAgent, getDefaultAgent]\n );\n}\n\n// =============================================================================\n// USE SKILLS HOOK\n// =============================================================================\n\n/**\n * Hook for skill CRUD operations\n */\nexport function useSkills(options: UseAgentsOptions) {\n const optionsRef = useOptionsRef(options);\n\n const { execute: listSkills, loading: listLoading, error: listError } = useApiAsync(\n () => listSkillsApi(optionsRef.current),\n (data) => data.skills,\n [] as Skill[]\n );\n\n const { execute: getSkill, loading: getLoading, error: getError } = useApiAsync(\n (skillId: string) => getSkillApi(skillId, optionsRef.current),\n (data) => data.skill || null,\n null as Skill | null\n );\n\n const { execute: createSkill, loading: createLoading, error: createError } = useApiAsync(\n (skill: Partial<Skill>) => createSkillApi(skill, optionsRef.current),\n (data) => data.skill || null,\n null as Skill | null\n );\n\n const { execute: updateSkill, loading: updateLoading, error: updateError } = useApiAsync(\n (skillId: string, skill: Partial<Skill>) => updateSkillApi(skillId, skill, optionsRef.current),\n (data) => data.skill || null,\n null as Skill | null\n );\n\n const { execute: deleteSkill, loading: deleteLoading, error: deleteError } = useApiAsync(\n (skillId: string) => deleteSkillApi(skillId, optionsRef.current),\n () => true,\n false\n );\n\n const { execute: getCategories, loading: categoriesLoading, error: categoriesError } = useApiAsync(\n () => getSkillCategoriesApi(optionsRef.current),\n (data) => data.categories,\n [] as string[]\n );\n\n const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading || categoriesLoading;\n const error = listError || getError || createError || updateError || deleteError || categoriesError;\n\n return useMemo(\n () => ({\n loading,\n error,\n listSkills,\n getSkill,\n createSkill,\n updateSkill,\n deleteSkill,\n getCategories,\n }),\n [loading, error, listSkills, getSkill, createSkill, updateSkill, deleteSkill, getCategories]\n );\n}\n\n// =============================================================================\n// USE SUB-AGENTS HOOK\n// =============================================================================\n\n/**\n * Hook for sub-agent CRUD operations\n */\nexport function useSubAgents(options: UseAgentsOptions) {\n const optionsRef = useOptionsRef(options);\n\n const { execute: listSubAgents, loading: listLoading, error: listError } = useApiAsync(\n () => listSubAgentsApi(optionsRef.current),\n (data) => data.subAgents,\n [] as SubAgent[]\n );\n\n const { execute: getSubAgent, loading: getLoading, error: getError } = useApiAsync(\n (subAgentId: string) => getSubAgentApi(subAgentId, optionsRef.current),\n (data) => data.subAgent || null,\n null as SubAgent | null\n );\n\n const { execute: createSubAgent, loading: createLoading, error: createError } = useApiAsync(\n (subAgent: Partial<SubAgent>) => createSubAgentApi(subAgent, optionsRef.current),\n (data) => data.subAgent || null,\n null as SubAgent | null\n );\n\n const { execute: updateSubAgent, loading: updateLoading, error: updateError } = useApiAsync(\n (subAgentId: string, subAgent: Partial<SubAgent>) => updateSubAgentApi(subAgentId, subAgent, optionsRef.current),\n (data) => data.subAgent || null,\n null as SubAgent | null\n );\n\n const { execute: deleteSubAgent, loading: deleteLoading, error: deleteError } = useApiAsync(\n (subAgentId: string) => deleteSubAgentApi(subAgentId, optionsRef.current),\n () => true,\n false\n );\n\n const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading;\n const error = listError || getError || createError || updateError || deleteError;\n\n return useMemo(\n () => ({\n loading,\n error,\n listSubAgents,\n getSubAgent,\n createSubAgent,\n updateSubAgent,\n deleteSubAgent,\n }),\n [loading, error, listSubAgents, getSubAgent, createSubAgent, updateSubAgent, deleteSubAgent]\n );\n}\n\n// =============================================================================\n// USE TOOL DEFINITIONS HOOK\n// =============================================================================\n\n/**\n * Hook for tool definition CRUD operations\n *\n * @example\n * ```tsx\n * const { loading, error, listToolDefinitions, createToolDefinition } = useToolDefinitions({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * });\n *\n * const toolDefs = await listToolDefinitions();\n * ```\n */\nexport function useToolDefinitions(options: UseAgentsOptions) {\n const optionsRef = useOptionsRef(options);\n\n const { execute: listToolDefinitions, loading: listLoading, error: listError } = useApiAsync(\n () => listToolDefinitionsApi(optionsRef.current),\n (data) => data.toolDefinitions,\n [] as ToolDefinition[]\n );\n\n const { execute: getToolDefinition, loading: getLoading, error: getError } = useApiAsync(\n (toolDefId: string) => getToolDefinitionApi(toolDefId, optionsRef.current),\n (data) => data.toolDefinition || null,\n null as ToolDefinition | null\n );\n\n const { execute: getToolDefinitionsByIds, loading: getByIdsLoading, error: getByIdsError } = useApiAsync(\n (ids: string[]) => getToolDefinitionsByIdsApi(ids, optionsRef.current),\n (data) => data.toolDefinitions,\n [] as ToolDefinition[]\n );\n\n const { execute: createToolDefinition, loading: createLoading, error: createError } = useApiAsync(\n (toolDefinition: Partial<ToolDefinition>) => createToolDefinitionApi(toolDefinition, optionsRef.current),\n (data) => data.toolDefinition || null,\n null as ToolDefinition | null\n );\n\n const { execute: updateToolDefinition, loading: updateLoading, error: updateError } = useApiAsync(\n (toolDefId: string, toolDefinition: Partial<ToolDefinition>) => updateToolDefinitionApi(toolDefId, toolDefinition, optionsRef.current),\n (data) => data.toolDefinition || null,\n null as ToolDefinition | null\n );\n\n const { execute: deleteToolDefinition, loading: deleteLoading, error: deleteError } = useApiAsync(\n (toolDefId: string) => deleteToolDefinitionApi(toolDefId, optionsRef.current),\n () => true,\n false\n );\n\n const loading = listLoading || getLoading || getByIdsLoading || createLoading || updateLoading || deleteLoading;\n const error = listError || getError || getByIdsError || createError || updateError || deleteError;\n\n return useMemo(\n () => ({\n loading,\n error,\n listToolDefinitions,\n getToolDefinition,\n getToolDefinitionsByIds,\n createToolDefinition,\n updateToolDefinition,\n deleteToolDefinition,\n }),\n [loading, error, listToolDefinitions, getToolDefinition, getToolDefinitionsByIds, createToolDefinition, updateToolDefinition, deleteToolDefinition]\n );\n}\n\n// =============================================================================\n// USE AGENT JOBS HOOK\n// =============================================================================\n\n/**\n * Hook for agent job CRUD operations\n *\n * @example\n * ```tsx\n * const { loading, error, listAgentJobs, createAgentJob, pauseAgentJob } = useAgentJobs({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * });\n *\n * const jobs = await listAgentJobs();\n * await pauseAgentJob(jobId);\n * ```\n */\nexport function useAgentJobs(options: UseAgentsOptions) {\n const optionsRef = useOptionsRef(options);\n\n const { execute: listAgentJobs, loading: listLoading, error: listError } = useApiAsync(\n () => listAgentJobsApi(optionsRef.current),\n (data) => data.jobs,\n [] as AgentJob[]\n );\n\n const { execute: getAgentJob, loading: getLoading, error: getError } = useApiAsync(\n (jobId: string) => getAgentJobApi(jobId, optionsRef.current),\n (data) => data.job || null,\n null as AgentJob | null\n );\n\n const { execute: createAgentJob, loading: createLoading, error: createError } = useApiAsync(\n (job: Partial<AgentJob>) => createAgentJobApi(job, optionsRef.current),\n (data) => data.job || null,\n null as AgentJob | null\n );\n\n const { execute: updateAgentJob, loading: updateLoading, error: updateError } = useApiAsync(\n (jobId: string, job: Partial<AgentJob>) => updateAgentJobApi(jobId, job, optionsRef.current),\n (data) => data.job || null,\n null as AgentJob | null\n );\n\n const { execute: deleteAgentJob, loading: deleteLoading, error: deleteError } = useApiAsync(\n (jobId: string) => deleteAgentJobApi(jobId, optionsRef.current),\n () => true,\n false\n );\n\n const { execute: pauseAgentJob, loading: pauseLoading, error: pauseError } = useApiAsync(\n (jobId: string) => pauseAgentJobApi(jobId, optionsRef.current),\n (data) => data.job || null,\n null as AgentJob | null\n );\n\n const { execute: resumeAgentJob, loading: resumeLoading, error: resumeError } = useApiAsync(\n (jobId: string) => resumeAgentJobApi(jobId, optionsRef.current),\n (data) => data.job || null,\n null as AgentJob | null\n );\n\n const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading || pauseLoading || resumeLoading;\n const error = listError || getError || createError || updateError || deleteError || pauseError || resumeError;\n\n return useMemo(\n () => ({\n loading,\n error,\n listAgentJobs,\n getAgentJob,\n createAgentJob,\n updateAgentJob,\n deleteAgentJob,\n pauseAgentJob,\n resumeAgentJob,\n }),\n [loading, error, listAgentJobs, getAgentJob, createAgentJob, updateAgentJob, deleteAgentJob, pauseAgentJob, resumeAgentJob]\n );\n}\n\n// =============================================================================\n// USE WIDGETS HOOK\n// =============================================================================\n\nexport interface UseWidgetsOptions extends UseAgentsOptions {\n agentId: string;\n}\n\n/**\n * Hook for widget CRUD operations\n *\n * @example\n * ```tsx\n * const { loading, error, listWidgets, createWidget } = useWidgets({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * agentId: selectedAgentId,\n * });\n *\n * const widgets = await listWidgets();\n * ```\n */\nexport function useWidgets(options: UseWidgetsOptions) {\n const optionsRef = useOptionsRef(options);\n\n const { execute: listWidgets, loading: listLoading, error: listError } = useApiAsync(\n () => listWidgetsApi(optionsRef.current.agentId, optionsRef.current),\n (data) => data.widgets,\n [] as AgentWidget[]\n );\n\n const { execute: getWidget, loading: getLoading, error: getError } = useApiAsync(\n (widgetId: string) => getWidgetApi(widgetId, optionsRef.current),\n (data) => data.widget || null,\n null as AgentWidget | null\n );\n\n const { execute: getDefaultWidget, loading: defaultLoading, error: defaultError } = useApiAsync(\n () => getDefaultWidgetApi(optionsRef.current.agentId, optionsRef.current),\n (data) => data.widget || null,\n null as AgentWidget | null\n );\n\n const { execute: createWidget, loading: createLoading, error: createError } = useApiAsync(\n (widget: Partial<AgentWidget>) => createWidgetApi(optionsRef.current.agentId, widget, optionsRef.current),\n (data) => data.widget || null,\n null as AgentWidget | null\n );\n\n const { execute: updateWidget, loading: updateLoading, error: updateError } = useApiAsync(\n (widgetId: string, widget: Partial<AgentWidget>) => updateWidgetApi(widgetId, widget, optionsRef.current),\n (data) => data.widget || null,\n null as AgentWidget | null\n );\n\n const { execute: deleteWidget, loading: deleteLoading, error: deleteError } = useApiAsync(\n (widgetId: string) => deleteWidgetApi(widgetId, optionsRef.current),\n () => true,\n false\n );\n\n const { execute: setDefaultWidget, loading: setDefaultLoading, error: setDefaultError } = useApiAsync(\n (widgetId: string) => setDefaultWidgetApi(widgetId, optionsRef.current.agentId, optionsRef.current),\n () => true,\n false\n );\n\n const loading = listLoading || getLoading || defaultLoading || createLoading || updateLoading || deleteLoading || setDefaultLoading;\n const error = listError || getError || defaultError || createError || updateError || deleteError || setDefaultError;\n\n return useMemo(\n () => ({\n loading,\n error,\n listWidgets,\n getWidget,\n getDefaultWidget,\n createWidget,\n updateWidget,\n deleteWidget,\n setDefaultWidget,\n }),\n [loading, error, listWidgets, getWidget, getDefaultWidget, createWidget, updateWidget, deleteWidget, setDefaultWidget]\n );\n}\n\n// =============================================================================\n// EXPORTS\n// =============================================================================\n\n// Re-export hook utilities for advanced usage\nexport { useApiAsync, useAsync } from \"./use-async\";\nexport { useOptionsRef } from \"./use-options-ref\";\nexport type { UseAsyncOptions, UseAsyncReturn } from \"./use-async\";\n","\"use client\";\n\n/**\n * Async operation utilities for React hooks\n *\n * Provides a generic pattern for handling async operations with loading/error states.\n * Uses a request counter for accurate concurrent loading state.\n */\n\nimport { useState, useCallback, useRef } from \"react\";\nimport type { ApiResponse } from \"@elqnt/api-client\";\n\nexport interface UseAsyncOptions {\n onError?: (error: string) => void;\n}\n\nexport interface UseAsyncReturn<TResult, TArgs extends unknown[] = []> {\n execute: (...args: TArgs) => Promise<TResult>;\n loading: boolean;\n error: string | null;\n clearError: () => void;\n}\n\n/**\n * Generic async hook for any promise-returning function.\n * Uses a request counter to properly track concurrent requests.\n */\nexport function useAsync<TResult, TArgs extends unknown[] = []>(\n asyncFn: (...args: TArgs) => Promise<TResult>,\n options?: UseAsyncOptions\n): UseAsyncReturn<TResult, TArgs> {\n const [error, setError] = useState<string | null>(null);\n const requestCountRef = useRef(0);\n const [loading, setLoading] = useState(false);\n\n const execute = useCallback(\n async (...args: TArgs): Promise<TResult> => {\n requestCountRef.current += 1;\n setLoading(true);\n setError(null);\n\n try {\n return await asyncFn(...args);\n } catch (err) {\n const message = err instanceof Error ? err.message : \"An error occurred\";\n setError(message);\n options?.onError?.(message);\n throw err;\n } finally {\n requestCountRef.current -= 1;\n if (requestCountRef.current === 0) {\n setLoading(false);\n }\n }\n },\n [asyncFn, options]\n );\n\n const clearError = useCallback(() => setError(null), []);\n\n return { execute, loading, error, clearError };\n}\n\n/**\n * Specialized async hook for API operations that return ApiResponse.\n * Automatically extracts data and handles API errors.\n *\n * @param asyncFn - Function that returns ApiResponse<TResponse>\n * @param extractor - Function to extract the desired result from response data\n * @param defaultValue - Default value to return on error\n * @param options - Optional configuration\n *\n * @example\n * ```tsx\n * const { execute: listAgents, loading, error } = useApiAsync(\n * () => listAgentsApi(optionsRef.current),\n * (data) => data.agents,\n * []\n * );\n * ```\n */\nexport function useApiAsync<TResponse, TResult, TArgs extends unknown[] = []>(\n asyncFn: (...args: TArgs) => Promise<ApiResponse<TResponse>>,\n extractor: (data: TResponse) => TResult,\n defaultValue: TResult,\n options?: UseAsyncOptions\n): UseAsyncReturn<TResult, TArgs> {\n const [error, setError] = useState<string | null>(null);\n const requestCountRef = useRef(0);\n const [loading, setLoading] = useState(false);\n\n const execute = useCallback(\n async (...args: TArgs): Promise<TResult> => {\n requestCountRef.current += 1;\n setLoading(true);\n setError(null);\n\n try {\n const response = await asyncFn(...args);\n if (response.error) {\n setError(response.error);\n options?.onError?.(response.error);\n return defaultValue;\n }\n return response.data ? extractor(response.data) : defaultValue;\n } catch (err) {\n const message = err instanceof Error ? err.message : \"An error occurred\";\n setError(message);\n options?.onError?.(message);\n return defaultValue;\n } finally {\n requestCountRef.current -= 1;\n if (requestCountRef.current === 0) {\n setLoading(false);\n }\n }\n },\n [asyncFn, extractor, defaultValue, options]\n );\n\n const clearError = useCallback(() => setError(null), []);\n\n return { execute, loading, error, clearError };\n}\n","\"use client\";\n\n/**\n * Options reference utility for React hooks\n *\n * Keeps a mutable ref synchronized with options to avoid\n * stale closures in callbacks while preventing unnecessary re-renders.\n */\n\nimport { useRef, useEffect } from \"react\";\n\n/**\n * Creates a ref that stays synchronized with the provided options.\n * Useful for accessing current options values in callbacks without\n * causing re-renders or stale closure issues.\n *\n * @param options - The options object to track\n * @returns A ref that always contains the latest options\n *\n * @example\n * ```tsx\n * const optionsRef = useOptionsRef(options);\n *\n * const fetchData = useCallback(async () => {\n * // Always has the latest options, no stale closure\n * const result = await api.fetch(optionsRef.current);\n * }, []); // No need to include options in deps\n * ```\n */\nexport function useOptionsRef<T>(options: T): React.MutableRefObject<T> {\n const optionsRef = useRef(options);\n\n useEffect(() => {\n optionsRef.current = options;\n }, [options]);\n\n return optionsRef;\n}\n"]}