@elqnt/agents 2.0.7 → 2.1.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 (39) hide show
  1. package/dist/agent-models-mCYzjfGp.d.mts +2400 -0
  2. package/dist/agent-models-mCYzjfGp.d.ts +2400 -0
  3. package/dist/api/index.d.mts +103 -0
  4. package/dist/api/index.d.ts +103 -0
  5. package/dist/api/index.js +78 -0
  6. package/dist/api/index.js.map +1 -0
  7. package/dist/api/index.mjs +78 -0
  8. package/dist/api/index.mjs.map +1 -0
  9. package/dist/chunk-3VJNDDME.mjs +401 -0
  10. package/dist/chunk-3VJNDDME.mjs.map +1 -0
  11. package/dist/chunk-K3OAYHF3.js +202 -0
  12. package/dist/chunk-K3OAYHF3.js.map +1 -0
  13. package/dist/chunk-O2SYQSU2.mjs +398 -0
  14. package/dist/chunk-O2SYQSU2.mjs.map +1 -0
  15. package/dist/chunk-RPXANLP2.js +398 -0
  16. package/dist/chunk-RPXANLP2.js.map +1 -0
  17. package/dist/chunk-SWJ66D7X.js +401 -0
  18. package/dist/chunk-SWJ66D7X.js.map +1 -0
  19. package/dist/chunk-SZP2G5I7.mjs +202 -0
  20. package/dist/chunk-SZP2G5I7.mjs.map +1 -0
  21. package/dist/hooks/index.d.mts +57 -0
  22. package/dist/hooks/index.d.ts +57 -0
  23. package/dist/hooks/index.js +14 -0
  24. package/dist/hooks/index.js.map +1 -0
  25. package/dist/hooks/index.mjs +14 -0
  26. package/dist/hooks/index.mjs.map +1 -0
  27. package/dist/index.d.mts +6 -2257
  28. package/dist/index.d.ts +6 -2257
  29. package/dist/index.js +479 -554
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +303 -177
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/models/index.d.mts +97 -0
  34. package/dist/models/index.d.ts +97 -0
  35. package/dist/models/index.js +398 -0
  36. package/dist/models/index.js.map +1 -0
  37. package/dist/models/index.mjs +398 -0
  38. package/dist/models/index.mjs.map +1 -0
  39. package/package.json +31 -14
@@ -0,0 +1,202 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
+
3
+ // api/index.ts
4
+ var _browser = require('@elqnt/api-client/browser');
5
+ async function listAgentsApi(options) {
6
+ return _browser.browserApiRequest.call(void 0, "/api/v1/agents", { method: "GET", ...options });
7
+ }
8
+ async function listAgentsSummaryApi(options) {
9
+ return _browser.browserApiRequest.call(void 0, "/api/v1/agents/summary", { method: "GET", ...options });
10
+ }
11
+ async function getAgentApi(agentId, options) {
12
+ return _browser.browserApiRequest.call(void 0, `/api/v1/agents/${agentId}`, { method: "GET", ...options });
13
+ }
14
+ async function createAgentApi(agent, options) {
15
+ return _browser.browserApiRequest.call(void 0, "/api/v1/agents", { method: "POST", body: agent, ...options });
16
+ }
17
+ async function updateAgentApi(agentId, agent, options) {
18
+ return _browser.browserApiRequest.call(void 0, `/api/v1/agents/${agentId}`, { method: "PUT", body: agent, ...options });
19
+ }
20
+ async function deleteAgentApi(agentId, options) {
21
+ return _browser.browserApiRequest.call(void 0, `/api/v1/agents/${agentId}`, { method: "DELETE", ...options });
22
+ }
23
+ async function getDefaultAgentApi(options) {
24
+ return _browser.browserApiRequest.call(void 0, "/api/v1/agents/default", { method: "GET", ...options });
25
+ }
26
+ async function listSkillsApi(options) {
27
+ return _browser.browserApiRequest.call(void 0, "/api/v1/skills", { method: "GET", ...options });
28
+ }
29
+ async function getSkillApi(skillId, options) {
30
+ return _browser.browserApiRequest.call(void 0, `/api/v1/skills/${skillId}`, { method: "GET", ...options });
31
+ }
32
+ async function getSkillsByIdsApi(ids, options) {
33
+ return _browser.browserApiRequest.call(void 0, "/api/v1/skills/by-ids", { method: "POST", body: { ids }, ...options });
34
+ }
35
+ async function createSkillApi(skill, options) {
36
+ return _browser.browserApiRequest.call(void 0, "/api/v1/skills", { method: "POST", body: skill, ...options });
37
+ }
38
+ async function updateSkillApi(skillId, skill, options) {
39
+ return _browser.browserApiRequest.call(void 0, `/api/v1/skills/${skillId}`, { method: "PUT", body: skill, ...options });
40
+ }
41
+ async function deleteSkillApi(skillId, options) {
42
+ return _browser.browserApiRequest.call(void 0, `/api/v1/skills/${skillId}`, { method: "DELETE", ...options });
43
+ }
44
+ async function searchSkillsApi(query, options) {
45
+ const params = new URLSearchParams();
46
+ params.set("q", query);
47
+ if (options.category) params.set("category", options.category);
48
+ if (options.limit) params.set("limit", String(options.limit));
49
+ return _browser.browserApiRequest.call(void 0, `/api/v1/skills/search?${params.toString()}`, { method: "GET", ...options });
50
+ }
51
+ async function getSkillUserConfigApi(skillId, options) {
52
+ const params = new URLSearchParams();
53
+ if (options.agentId) params.set("agentId", options.agentId);
54
+ const query = params.toString();
55
+ return _browser.browserApiRequest.call(void 0, `/api/v1/skills/${skillId}/user-config${query ? `?${query}` : ""}`, {
56
+ method: "GET",
57
+ ...options
58
+ });
59
+ }
60
+ async function updateSkillUserConfigApi(skillId, data, options) {
61
+ return _browser.browserApiRequest.call(void 0, `/api/v1/skills/${skillId}/user-config`, {
62
+ method: "PUT",
63
+ body: data,
64
+ ...options
65
+ });
66
+ }
67
+ async function deleteSkillUserConfigApi(skillId, options) {
68
+ const params = new URLSearchParams();
69
+ if (options.agentId) params.set("agentId", options.agentId);
70
+ const query = params.toString();
71
+ return _browser.browserApiRequest.call(void 0, `/api/v1/skills/${skillId}/user-config${query ? `?${query}` : ""}`, {
72
+ method: "DELETE",
73
+ ...options
74
+ });
75
+ }
76
+ async function listSkillUserConfigsApi(options) {
77
+ const params = new URLSearchParams();
78
+ if (options.agentId) params.set("agentId", options.agentId);
79
+ if (options.limit) params.set("limit", String(options.limit));
80
+ if (options.offset) params.set("offset", String(options.offset));
81
+ const query = params.toString();
82
+ return _browser.browserApiRequest.call(void 0, `/api/v1/skills/user-configs${query ? `?${query}` : ""}`, {
83
+ method: "GET",
84
+ ...options
85
+ });
86
+ }
87
+ async function resolveSkillConfigApi(skillId, agentId, options) {
88
+ return _browser.browserApiRequest.call(void 0, `/api/v1/skills/${skillId}/resolve-config?agentId=${agentId}`, {
89
+ method: "GET",
90
+ ...options
91
+ });
92
+ }
93
+ async function listSubAgentsApi(options) {
94
+ const params = new URLSearchParams();
95
+ if (options.onlySystem !== void 0) params.set("onlySystem", String(options.onlySystem));
96
+ if (options.enabled !== void 0) params.set("enabled", String(options.enabled));
97
+ const queryString = params.toString();
98
+ return _browser.browserApiRequest.call(void 0, `/api/v1/subagents${queryString ? `?${queryString}` : ""}`, { method: "GET", ...options });
99
+ }
100
+ async function getSubAgentApi(subAgentId, options) {
101
+ return _browser.browserApiRequest.call(void 0, `/api/v1/subagents/${subAgentId}`, { method: "GET", ...options });
102
+ }
103
+ async function createSubAgentApi(subAgent, options) {
104
+ return _browser.browserApiRequest.call(void 0, "/api/v1/subagents", { method: "POST", body: { subAgent }, ...options });
105
+ }
106
+ async function updateSubAgentApi(subAgentId, subAgent, options) {
107
+ return _browser.browserApiRequest.call(void 0, `/api/v1/subagents/${subAgentId}`, { method: "PUT", body: { subAgent }, ...options });
108
+ }
109
+ async function deleteSubAgentApi(subAgentId, options) {
110
+ return _browser.browserApiRequest.call(void 0, `/api/v1/subagents/${subAgentId}`, { method: "DELETE", ...options });
111
+ }
112
+ async function listWidgetsApi(agentId, options) {
113
+ return _browser.browserApiRequest.call(void 0, `/api/v1/agents/${agentId}/widgets`, { method: "GET", ...options });
114
+ }
115
+ async function getDefaultWidgetApi(agentId, options) {
116
+ return _browser.browserApiRequest.call(void 0, `/api/v1/agents/${agentId}/widgets/default`, { method: "GET", ...options });
117
+ }
118
+ async function createWidgetApi(agentId, widget, options) {
119
+ return _browser.browserApiRequest.call(void 0, `/api/v1/agents/${agentId}/widgets`, { method: "POST", body: { widget }, ...options });
120
+ }
121
+ async function getWidgetApi(widgetId, options) {
122
+ return _browser.browserApiRequest.call(void 0, `/api/v1/widgets/${widgetId}`, { method: "GET", ...options });
123
+ }
124
+ async function getWidgetByWidgetIdApi(widgetId, baseUrl) {
125
+ return _browser.browserApiRequest.call(void 0, `/api/v1/widgets/by-widget-id/${widgetId}`, { method: "GET", baseUrl, orgId: "" });
126
+ }
127
+ async function updateWidgetApi(widgetId, widget, options) {
128
+ return _browser.browserApiRequest.call(void 0, `/api/v1/widgets/${widgetId}`, { method: "PUT", body: { widget }, ...options });
129
+ }
130
+ async function deleteWidgetApi(widgetId, options) {
131
+ return _browser.browserApiRequest.call(void 0, `/api/v1/widgets/${widgetId}`, { method: "DELETE", ...options });
132
+ }
133
+ async function setDefaultWidgetApi(widgetId, agentId, options) {
134
+ return _browser.browserApiRequest.call(void 0, `/api/v1/widgets/${widgetId}/default`, { method: "POST", body: { agentId }, ...options });
135
+ }
136
+ async function getAgentChatsAnalyticsApi(params, options) {
137
+ return _browser.browserApiRequest.call(void 0, "/api/v1/analytics/agents/chats", {
138
+ method: "POST",
139
+ body: params,
140
+ ...options
141
+ });
142
+ }
143
+ async function getAgentCSATAnalyticsApi(params, options) {
144
+ return _browser.browserApiRequest.call(void 0, "/api/v1/analytics/agents/csat", {
145
+ method: "POST",
146
+ body: params,
147
+ ...options
148
+ });
149
+ }
150
+ async function getAgentListAnalyticsApi(options) {
151
+ return _browser.browserApiRequest.call(void 0, "/api/v1/analytics/agents", {
152
+ method: "GET",
153
+ ...options
154
+ });
155
+ }
156
+ async function getTaskOutcomesApi(params, options) {
157
+ return _browser.browserApiRequest.call(void 0, "/api/v1/analytics/tasks", {
158
+ method: "POST",
159
+ body: params,
160
+ ...options
161
+ });
162
+ }
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+ exports.listAgentsApi = listAgentsApi; exports.listAgentsSummaryApi = listAgentsSummaryApi; exports.getAgentApi = getAgentApi; exports.createAgentApi = createAgentApi; exports.updateAgentApi = updateAgentApi; exports.deleteAgentApi = deleteAgentApi; exports.getDefaultAgentApi = getDefaultAgentApi; exports.listSkillsApi = listSkillsApi; exports.getSkillApi = getSkillApi; exports.getSkillsByIdsApi = getSkillsByIdsApi; exports.createSkillApi = createSkillApi; exports.updateSkillApi = updateSkillApi; exports.deleteSkillApi = deleteSkillApi; exports.searchSkillsApi = searchSkillsApi; exports.getSkillUserConfigApi = getSkillUserConfigApi; exports.updateSkillUserConfigApi = updateSkillUserConfigApi; exports.deleteSkillUserConfigApi = deleteSkillUserConfigApi; exports.listSkillUserConfigsApi = listSkillUserConfigsApi; exports.resolveSkillConfigApi = resolveSkillConfigApi; exports.listSubAgentsApi = listSubAgentsApi; exports.getSubAgentApi = getSubAgentApi; exports.createSubAgentApi = createSubAgentApi; exports.updateSubAgentApi = updateSubAgentApi; exports.deleteSubAgentApi = deleteSubAgentApi; exports.listWidgetsApi = listWidgetsApi; exports.getDefaultWidgetApi = getDefaultWidgetApi; exports.createWidgetApi = createWidgetApi; exports.getWidgetApi = getWidgetApi; exports.getWidgetByWidgetIdApi = getWidgetByWidgetIdApi; exports.updateWidgetApi = updateWidgetApi; exports.deleteWidgetApi = deleteWidgetApi; exports.setDefaultWidgetApi = setDefaultWidgetApi; exports.getAgentChatsAnalyticsApi = getAgentChatsAnalyticsApi; exports.getAgentCSATAnalyticsApi = getAgentCSATAnalyticsApi; exports.getAgentListAnalyticsApi = getAgentListAnalyticsApi; exports.getTaskOutcomesApi = getTaskOutcomesApi;
202
+ //# sourceMappingURL=chunk-K3OAYHF3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/eloquent/eloquent/packages/@elqnt/agents/dist/chunk-K3OAYHF3.js","../api/index.ts"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACA;ACKA,oDAAkC;AA6BlC,MAAA,SAAsB,aAAA,CAAc,OAAA,EAAqE;AACvG,EAAA,OAAO,wCAAA,gBAAkB,EAAkB,EAAE,MAAA,EAAQ,KAAA,EAAO,GAAG,QAAQ,CAAC,CAAA;AAC1E;AAEA,MAAA,SAAsB,oBAAA,CAAqB,OAAA,EAA4E;AACrH,EAAA,OAAO,wCAAA,wBAAkB,EAA0B,EAAE,MAAA,EAAQ,KAAA,EAAO,GAAG,QAAQ,CAAC,CAAA;AAClF;AAEA,MAAA,SAAsB,WAAA,CAAY,OAAA,EAAiB,OAAA,EAAgE;AACjH,EAAA,OAAO,wCAAA,CAAkB,eAAA,EAAkB,OAAO,CAAA,CAAA;AACpD;AAE4H;AAC7E,EAAA;AAC/C;AAE6E;AACzB,EAAA;AACpD;AAEyJ;AACrG,EAAA;AACpD;AAEyG;AACpD,EAAA;AACrD;AAMyG;AAC1D,EAAA;AAC/C;AAEmH;AAC/D,EAAA;AACpD;AAEgI;AAC5E,EAAA;AACpD;AAE4H;AAC7E,EAAA;AAC/C;AAE6E;AACzB,EAAA;AACpD;AAEyJ;AACrG,EAAA;AACpD;AAK4C;AACP,EAAA;AACd,EAAA;AACwB,EAAA;AACC,EAAA;AACI,EAAA;AACpD;AAQE;AAEmC,EAAA;AACgB,EAAA;AACrB,EAAA;AACoB,EAAA;AACxC,IAAA;AACL,IAAA;AACJ,EAAA;AACH;AAIE;AAQkD,EAAA;AACxC,IAAA;AACF,IAAA;AACH,IAAA;AACJ,EAAA;AACH;AAIE;AAEmC,EAAA;AACgB,EAAA;AACrB,EAAA;AACoB,EAAA;AACxC,IAAA;AACL,IAAA;AACJ,EAAA;AACH;AAIqD;AAChB,EAAA;AACgB,EAAA;AACL,EAAA;AACE,EAAA;AAClB,EAAA;AACL,EAAA;AACf,IAAA;AACL,IAAA;AACJ,EAAA;AACH;AAIE;AAGkD,EAAA;AACxC,IAAA;AACL,IAAA;AACJ,EAAA;AACH;AAQ+C;AACV,EAAA;AACc,EAAA;AACH,EAAA;AACV,EAAA;AACS,EAAA;AAC/C;AAE4H;AAC5E,EAAA;AAChD;AAEwI;AACtF,EAAA;AAClD;AAE4D;AACZ,EAAA;AAChD;AAE4D;AACZ,EAAA;AAChD;AAMiI;AAC7E,EAAA;AACpD;AAEiI;AAC7E,EAAA;AACpD;AAEqF;AACjC,EAAA;AACpD;AAE2H;AAC7E,EAAA;AAC9C;AAE+D;AACpC,EAAA;AAC3B;AAEsF;AACxC,EAAA;AAC9C;AAE2J;AAC7G,EAAA;AAC9C;AAE4D;AACd,EAAA;AAC9C;AAkBE;AAEyB,EAAA;AACf,IAAA;AACF,IAAA;AACH,IAAA;AACJ,EAAA;AACH;AAIE;AAEyB,EAAA;AACf,IAAA;AACF,IAAA;AACH,IAAA;AACJ,EAAA;AACH;AAI+C;AACpB,EAAA;AACf,IAAA;AACL,IAAA;AACJ,EAAA;AACH;AAK+C;AACpB,EAAA;AACf,IAAA;AACF,IAAA;AACH,IAAA;AACJ,EAAA;AACH;ADrIqD;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;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/eloquent/eloquent/packages/@elqnt/agents/dist/chunk-K3OAYHF3.js","sourcesContent":[null,"/**\n * Agents API functions\n *\n * Browser-side API client for agent operations.\n * Uses @elqnt/api-client for HTTP requests with automatic token management.\n */\n\nimport { browserApiRequest } from \"@elqnt/api-client/browser\";\nimport type { ApiResponse, ApiClientOptions } from \"@elqnt/api-client\";\nimport type { ResponseMetadata } from \"@elqnt/types\";\nimport type {\n Agent,\n AgentSummary,\n AgentResponse,\n ListAgentsResponse,\n ListAgentsSummaryResponse,\n Skill,\n SkillResponse,\n SkillsListResponse,\n GetSkillsByIDsResponse,\n SubAgent,\n SubAgentResponse,\n SubAgentsListResponse,\n AgentWidget,\n AgentWidgetResponse,\n ListAgentWidgetsResponse,\n SkillUserConfig,\n SkillUserConfigResponse,\n SkillUserConfigListResponse,\n ResolveSkillConfigResponse,\n} from \"../models\";\n\n// =============================================================================\n// AGENTS\n// =============================================================================\n\nexport async function listAgentsApi(options: ApiClientOptions): Promise<ApiResponse<ListAgentsResponse>> {\n return browserApiRequest(\"/api/v1/agents\", { method: \"GET\", ...options });\n}\n\nexport async function listAgentsSummaryApi(options: ApiClientOptions): Promise<ApiResponse<ListAgentsSummaryResponse>> {\n return browserApiRequest(\"/api/v1/agents/summary\", { method: \"GET\", ...options });\n}\n\nexport async function getAgentApi(agentId: string, options: ApiClientOptions): Promise<ApiResponse<AgentResponse>> {\n return browserApiRequest(`/api/v1/agents/${agentId}`, { method: \"GET\", ...options });\n}\n\nexport async function createAgentApi(agent: Partial<Agent>, options: ApiClientOptions): Promise<ApiResponse<AgentResponse>> {\n return browserApiRequest(\"/api/v1/agents\", { method: \"POST\", body: agent, ...options });\n}\n\nexport async function updateAgentApi(agentId: string, agent: Partial<Agent>, options: ApiClientOptions): Promise<ApiResponse<AgentResponse>> {\n return browserApiRequest(`/api/v1/agents/${agentId}`, { method: \"PUT\", body: agent, ...options });\n}\n\nexport async function deleteAgentApi(agentId: string, options: ApiClientOptions): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n return browserApiRequest(`/api/v1/agents/${agentId}`, { method: \"DELETE\", ...options });\n}\n\nexport async function getDefaultAgentApi(options: ApiClientOptions): Promise<ApiResponse<AgentResponse>> {\n return browserApiRequest(\"/api/v1/agents/default\", { method: \"GET\", ...options });\n}\n\n// =============================================================================\n// SKILLS\n// =============================================================================\n\nexport async function listSkillsApi(options: ApiClientOptions): Promise<ApiResponse<SkillsListResponse>> {\n return browserApiRequest(\"/api/v1/skills\", { method: \"GET\", ...options });\n}\n\nexport async function getSkillApi(skillId: string, options: ApiClientOptions): Promise<ApiResponse<SkillResponse>> {\n return browserApiRequest(`/api/v1/skills/${skillId}`, { method: \"GET\", ...options });\n}\n\nexport async function getSkillsByIdsApi(ids: string[], options: ApiClientOptions): Promise<ApiResponse<GetSkillsByIDsResponse>> {\n return browserApiRequest(\"/api/v1/skills/by-ids\", { method: \"POST\", body: { ids }, ...options });\n}\n\nexport async function createSkillApi(skill: Partial<Skill>, options: ApiClientOptions): Promise<ApiResponse<SkillResponse>> {\n return browserApiRequest(\"/api/v1/skills\", { method: \"POST\", body: skill, ...options });\n}\n\nexport async function updateSkillApi(skillId: string, skill: Partial<Skill>, options: ApiClientOptions): Promise<ApiResponse<SkillResponse>> {\n return browserApiRequest(`/api/v1/skills/${skillId}`, { method: \"PUT\", body: skill, ...options });\n}\n\nexport async function deleteSkillApi(skillId: string, options: ApiClientOptions): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n return browserApiRequest(`/api/v1/skills/${skillId}`, { method: \"DELETE\", ...options });\n}\n\nexport async function searchSkillsApi(\n query: string,\n options: ApiClientOptions & { category?: string; limit?: number }\n): Promise<ApiResponse<SkillsListResponse>> {\n const params = new URLSearchParams();\n params.set(\"q\", query);\n if (options.category) params.set(\"category\", options.category);\n if (options.limit) params.set(\"limit\", String(options.limit));\n return browserApiRequest(`/api/v1/skills/search?${params.toString()}`, { method: \"GET\", ...options });\n}\n\n// =============================================================================\n// SKILL USER CONFIG\n// =============================================================================\n\nexport async function getSkillUserConfigApi(\n skillId: string,\n options: ApiClientOptions & { agentId?: string }\n): Promise<ApiResponse<SkillUserConfigResponse>> {\n const params = new URLSearchParams();\n if (options.agentId) params.set(\"agentId\", options.agentId);\n const query = params.toString();\n return browserApiRequest(`/api/v1/skills/${skillId}/user-config${query ? `?${query}` : \"\"}`, {\n method: \"GET\",\n ...options,\n });\n}\n\nexport async function updateSkillUserConfigApi(\n skillId: string,\n data: {\n enabled?: boolean;\n displayOrder?: number;\n config?: Record<string, unknown>;\n agentId?: string;\n },\n options: ApiClientOptions\n): Promise<ApiResponse<SkillUserConfigResponse>> {\n return browserApiRequest(`/api/v1/skills/${skillId}/user-config`, {\n method: \"PUT\",\n body: data,\n ...options,\n });\n}\n\nexport async function deleteSkillUserConfigApi(\n skillId: string,\n options: ApiClientOptions & { agentId?: string }\n): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n const params = new URLSearchParams();\n if (options.agentId) params.set(\"agentId\", options.agentId);\n const query = params.toString();\n return browserApiRequest(`/api/v1/skills/${skillId}/user-config${query ? `?${query}` : \"\"}`, {\n method: \"DELETE\",\n ...options,\n });\n}\n\nexport async function listSkillUserConfigsApi(\n options: ApiClientOptions & { agentId?: string; limit?: number; offset?: number }\n): Promise<ApiResponse<SkillUserConfigListResponse>> {\n const params = new URLSearchParams();\n if (options.agentId) params.set(\"agentId\", options.agentId);\n if (options.limit) params.set(\"limit\", String(options.limit));\n if (options.offset) params.set(\"offset\", String(options.offset));\n const query = params.toString();\n return browserApiRequest(`/api/v1/skills/user-configs${query ? `?${query}` : \"\"}`, {\n method: \"GET\",\n ...options,\n });\n}\n\nexport async function resolveSkillConfigApi(\n skillId: string,\n agentId: string,\n options: ApiClientOptions\n): Promise<ApiResponse<ResolveSkillConfigResponse>> {\n return browserApiRequest(`/api/v1/skills/${skillId}/resolve-config?agentId=${agentId}`, {\n method: \"GET\",\n ...options,\n });\n}\n\n// =============================================================================\n// SUB-AGENTS\n// =============================================================================\n\nexport async function listSubAgentsApi(\n options: ApiClientOptions & { onlySystem?: boolean; enabled?: boolean }\n): Promise<ApiResponse<SubAgentsListResponse>> {\n const params = new URLSearchParams();\n if (options.onlySystem !== undefined) params.set(\"onlySystem\", String(options.onlySystem));\n if (options.enabled !== undefined) params.set(\"enabled\", String(options.enabled));\n const queryString = params.toString();\n return browserApiRequest(`/api/v1/subagents${queryString ? `?${queryString}` : \"\"}`, { method: \"GET\", ...options });\n}\n\nexport async function getSubAgentApi(subAgentId: string, options: ApiClientOptions): Promise<ApiResponse<SubAgentResponse>> {\n return browserApiRequest(`/api/v1/subagents/${subAgentId}`, { method: \"GET\", ...options });\n}\n\nexport async function createSubAgentApi(subAgent: Partial<SubAgent>, options: ApiClientOptions): Promise<ApiResponse<SubAgentResponse>> {\n return browserApiRequest(\"/api/v1/subagents\", { method: \"POST\", body: { subAgent }, ...options });\n}\n\nexport async function updateSubAgentApi(subAgentId: string, subAgent: Partial<SubAgent>, options: ApiClientOptions): Promise<ApiResponse<SubAgentResponse>> {\n return browserApiRequest(`/api/v1/subagents/${subAgentId}`, { method: \"PUT\", body: { subAgent }, ...options });\n}\n\nexport async function deleteSubAgentApi(subAgentId: string, options: ApiClientOptions): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n return browserApiRequest(`/api/v1/subagents/${subAgentId}`, { method: \"DELETE\", ...options });\n}\n\n// =============================================================================\n// WIDGETS\n// =============================================================================\n\nexport async function listWidgetsApi(agentId: string, options: ApiClientOptions): Promise<ApiResponse<ListAgentWidgetsResponse>> {\n return browserApiRequest(`/api/v1/agents/${agentId}/widgets`, { method: \"GET\", ...options });\n}\n\nexport async function getDefaultWidgetApi(agentId: string, options: ApiClientOptions): Promise<ApiResponse<AgentWidgetResponse>> {\n return browserApiRequest(`/api/v1/agents/${agentId}/widgets/default`, { method: \"GET\", ...options });\n}\n\nexport async function createWidgetApi(agentId: string, widget: Partial<AgentWidget>, options: ApiClientOptions): Promise<ApiResponse<AgentWidgetResponse>> {\n return browserApiRequest(`/api/v1/agents/${agentId}/widgets`, { method: \"POST\", body: { widget }, ...options });\n}\n\nexport async function getWidgetApi(widgetId: string, options: ApiClientOptions): Promise<ApiResponse<AgentWidgetResponse>> {\n return browserApiRequest(`/api/v1/widgets/${widgetId}`, { method: \"GET\", ...options });\n}\n\nexport async function getWidgetByWidgetIdApi(widgetId: string, baseUrl: string): Promise<ApiResponse<AgentWidgetResponse>> {\n return browserApiRequest(`/api/v1/widgets/by-widget-id/${widgetId}`, { method: \"GET\", baseUrl, orgId: \"\" });\n}\n\nexport async function updateWidgetApi(widgetId: string, widget: Partial<AgentWidget>, options: ApiClientOptions): Promise<ApiResponse<AgentWidgetResponse>> {\n return browserApiRequest(`/api/v1/widgets/${widgetId}`, { method: \"PUT\", body: { widget }, ...options });\n}\n\nexport async function deleteWidgetApi(widgetId: string, options: ApiClientOptions): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n return browserApiRequest(`/api/v1/widgets/${widgetId}`, { method: \"DELETE\", ...options });\n}\n\nexport async function setDefaultWidgetApi(widgetId: string, agentId: string, options: ApiClientOptions): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n return browserApiRequest(`/api/v1/widgets/${widgetId}/default`, { method: \"POST\", body: { agentId }, ...options });\n}\n\n// =============================================================================\n// ANALYTICS\n// =============================================================================\n\nexport interface DateFilter {\n from?: string;\n to?: string;\n}\n\nexport interface AnalyticsDataResponse {\n data: unknown[];\n metadata: ResponseMetadata;\n}\n\nexport async function getAgentChatsAnalyticsApi(\n params: { date_filter: DateFilter; agent_id?: string },\n options: ApiClientOptions\n): Promise<ApiResponse<AnalyticsDataResponse>> {\n return browserApiRequest(\"/api/v1/analytics/agents/chats\", {\n method: \"POST\",\n body: params,\n ...options,\n });\n}\n\nexport async function getAgentCSATAnalyticsApi(\n params: { date_filter: DateFilter; agent_id?: string },\n options: ApiClientOptions\n): Promise<ApiResponse<AnalyticsDataResponse>> {\n return browserApiRequest(\"/api/v1/analytics/agents/csat\", {\n method: \"POST\",\n body: params,\n ...options,\n });\n}\n\nexport async function getAgentListAnalyticsApi(\n options: ApiClientOptions\n): Promise<ApiResponse<AnalyticsDataResponse>> {\n return browserApiRequest(\"/api/v1/analytics/agents\", {\n method: \"GET\",\n ...options,\n });\n}\n\nexport async function getTaskOutcomesApi(\n params: { date_filter: DateFilter },\n options: ApiClientOptions\n): Promise<ApiResponse<AnalyticsDataResponse>> {\n return browserApiRequest(\"/api/v1/analytics/tasks\", {\n method: \"POST\",\n body: params,\n ...options,\n });\n}\n\n\n// Re-export types from models\nexport type {\n Agent,\n AgentSummary,\n Skill,\n SubAgent,\n AgentWidget,\n SkillUserConfig,\n SkillUserConfigResponse,\n SkillUserConfigListResponse,\n ResolveSkillConfigResponse,\n} from \"../models\";\n"]}
@@ -0,0 +1,398 @@
1
+ "use client";
2
+ import {
3
+ createAgentApi,
4
+ createSkillApi,
5
+ createSubAgentApi,
6
+ deleteAgentApi,
7
+ deleteSkillApi,
8
+ deleteSubAgentApi,
9
+ getAgentApi,
10
+ getDefaultAgentApi,
11
+ getSkillApi,
12
+ getSubAgentApi,
13
+ listAgentsApi,
14
+ listAgentsSummaryApi,
15
+ listSkillsApi,
16
+ listSubAgentsApi,
17
+ updateAgentApi,
18
+ updateSkillApi,
19
+ updateSubAgentApi
20
+ } from "./chunk-SZP2G5I7.mjs";
21
+
22
+ // hooks/index.ts
23
+ import { useState, useCallback, useMemo, useRef, useEffect } from "react";
24
+ function useAgents(options) {
25
+ const [loading, setLoading] = useState(false);
26
+ const [error, setError] = useState(null);
27
+ const optionsRef = useRef(options);
28
+ useEffect(() => {
29
+ optionsRef.current = options;
30
+ }, [options]);
31
+ const listAgents = useCallback(async () => {
32
+ setLoading(true);
33
+ setError(null);
34
+ try {
35
+ const response = await listAgentsApi(optionsRef.current);
36
+ if (response.error) {
37
+ setError(response.error);
38
+ return [];
39
+ }
40
+ return response.data?.agents || [];
41
+ } catch (err) {
42
+ const message = err instanceof Error ? err.message : "Failed to load agents";
43
+ setError(message);
44
+ return [];
45
+ } finally {
46
+ setLoading(false);
47
+ }
48
+ }, []);
49
+ const listAgentSummaries = useCallback(async () => {
50
+ setLoading(true);
51
+ setError(null);
52
+ try {
53
+ const response = await listAgentsSummaryApi(optionsRef.current);
54
+ if (response.error) {
55
+ setError(response.error);
56
+ return [];
57
+ }
58
+ return response.data?.agents || [];
59
+ } catch (err) {
60
+ const message = err instanceof Error ? err.message : "Failed to load agents";
61
+ setError(message);
62
+ return [];
63
+ } finally {
64
+ setLoading(false);
65
+ }
66
+ }, []);
67
+ const getAgent = useCallback(async (agentId) => {
68
+ setLoading(true);
69
+ setError(null);
70
+ try {
71
+ const response = await getAgentApi(agentId, optionsRef.current);
72
+ if (response.error) {
73
+ setError(response.error);
74
+ return null;
75
+ }
76
+ return response.data?.agent || null;
77
+ } catch (err) {
78
+ const message = err instanceof Error ? err.message : "Failed to get agent";
79
+ setError(message);
80
+ return null;
81
+ } finally {
82
+ setLoading(false);
83
+ }
84
+ }, []);
85
+ const createAgent = useCallback(async (agent) => {
86
+ setLoading(true);
87
+ setError(null);
88
+ try {
89
+ const response = await createAgentApi(agent, optionsRef.current);
90
+ if (response.error) {
91
+ setError(response.error);
92
+ return null;
93
+ }
94
+ return response.data?.agent || null;
95
+ } catch (err) {
96
+ const message = err instanceof Error ? err.message : "Failed to create agent";
97
+ setError(message);
98
+ return null;
99
+ } finally {
100
+ setLoading(false);
101
+ }
102
+ }, []);
103
+ const updateAgent = useCallback(async (agentId, agent) => {
104
+ setLoading(true);
105
+ setError(null);
106
+ try {
107
+ const response = await updateAgentApi(agentId, agent, optionsRef.current);
108
+ if (response.error) {
109
+ setError(response.error);
110
+ return null;
111
+ }
112
+ return response.data?.agent || null;
113
+ } catch (err) {
114
+ const message = err instanceof Error ? err.message : "Failed to update agent";
115
+ setError(message);
116
+ return null;
117
+ } finally {
118
+ setLoading(false);
119
+ }
120
+ }, []);
121
+ const deleteAgent = useCallback(async (agentId) => {
122
+ setLoading(true);
123
+ setError(null);
124
+ try {
125
+ const response = await deleteAgentApi(agentId, optionsRef.current);
126
+ if (response.error) {
127
+ setError(response.error);
128
+ return false;
129
+ }
130
+ return true;
131
+ } catch (err) {
132
+ const message = err instanceof Error ? err.message : "Failed to delete agent";
133
+ setError(message);
134
+ return false;
135
+ } finally {
136
+ setLoading(false);
137
+ }
138
+ }, []);
139
+ const getDefaultAgent = useCallback(async () => {
140
+ setLoading(true);
141
+ setError(null);
142
+ try {
143
+ const response = await getDefaultAgentApi(optionsRef.current);
144
+ if (response.error) {
145
+ setError(response.error);
146
+ return null;
147
+ }
148
+ return response.data?.agent || null;
149
+ } catch (err) {
150
+ const message = err instanceof Error ? err.message : "Failed to get default agent";
151
+ setError(message);
152
+ return null;
153
+ } finally {
154
+ setLoading(false);
155
+ }
156
+ }, []);
157
+ return useMemo(
158
+ () => ({
159
+ loading,
160
+ error,
161
+ listAgents,
162
+ listAgentSummaries,
163
+ getAgent,
164
+ createAgent,
165
+ updateAgent,
166
+ deleteAgent,
167
+ getDefaultAgent
168
+ }),
169
+ [loading, error, listAgents, listAgentSummaries, getAgent, createAgent, updateAgent, deleteAgent, getDefaultAgent]
170
+ );
171
+ }
172
+ function useSkills(options) {
173
+ const [loading, setLoading] = useState(false);
174
+ const [error, setError] = useState(null);
175
+ const optionsRef = useRef(options);
176
+ useEffect(() => {
177
+ optionsRef.current = options;
178
+ }, [options]);
179
+ const listSkills = useCallback(async () => {
180
+ setLoading(true);
181
+ setError(null);
182
+ try {
183
+ const response = await listSkillsApi(optionsRef.current);
184
+ if (response.error) {
185
+ setError(response.error);
186
+ return [];
187
+ }
188
+ return response.data?.skills || [];
189
+ } catch (err) {
190
+ const message = err instanceof Error ? err.message : "Failed to load skills";
191
+ setError(message);
192
+ return [];
193
+ } finally {
194
+ setLoading(false);
195
+ }
196
+ }, []);
197
+ const getSkill = useCallback(async (skillId) => {
198
+ setLoading(true);
199
+ setError(null);
200
+ try {
201
+ const response = await getSkillApi(skillId, optionsRef.current);
202
+ if (response.error) {
203
+ setError(response.error);
204
+ return null;
205
+ }
206
+ return response.data?.skill || null;
207
+ } catch (err) {
208
+ const message = err instanceof Error ? err.message : "Failed to get skill";
209
+ setError(message);
210
+ return null;
211
+ } finally {
212
+ setLoading(false);
213
+ }
214
+ }, []);
215
+ const createSkill = useCallback(async (skill) => {
216
+ setLoading(true);
217
+ setError(null);
218
+ try {
219
+ const response = await createSkillApi(skill, optionsRef.current);
220
+ if (response.error) {
221
+ setError(response.error);
222
+ return null;
223
+ }
224
+ return response.data?.skill || null;
225
+ } catch (err) {
226
+ const message = err instanceof Error ? err.message : "Failed to create skill";
227
+ setError(message);
228
+ return null;
229
+ } finally {
230
+ setLoading(false);
231
+ }
232
+ }, []);
233
+ const updateSkill = useCallback(async (skillId, skill) => {
234
+ setLoading(true);
235
+ setError(null);
236
+ try {
237
+ const response = await updateSkillApi(skillId, skill, optionsRef.current);
238
+ if (response.error) {
239
+ setError(response.error);
240
+ return null;
241
+ }
242
+ return response.data?.skill || null;
243
+ } catch (err) {
244
+ const message = err instanceof Error ? err.message : "Failed to update skill";
245
+ setError(message);
246
+ return null;
247
+ } finally {
248
+ setLoading(false);
249
+ }
250
+ }, []);
251
+ const deleteSkill = useCallback(async (skillId) => {
252
+ setLoading(true);
253
+ setError(null);
254
+ try {
255
+ const response = await deleteSkillApi(skillId, optionsRef.current);
256
+ if (response.error) {
257
+ setError(response.error);
258
+ return false;
259
+ }
260
+ return true;
261
+ } catch (err) {
262
+ const message = err instanceof Error ? err.message : "Failed to delete skill";
263
+ setError(message);
264
+ return false;
265
+ } finally {
266
+ setLoading(false);
267
+ }
268
+ }, []);
269
+ return useMemo(
270
+ () => ({
271
+ loading,
272
+ error,
273
+ listSkills,
274
+ getSkill,
275
+ createSkill,
276
+ updateSkill,
277
+ deleteSkill
278
+ }),
279
+ [loading, error, listSkills, getSkill, createSkill, updateSkill, deleteSkill]
280
+ );
281
+ }
282
+ function useSubAgents(options) {
283
+ const [loading, setLoading] = useState(false);
284
+ const [error, setError] = useState(null);
285
+ const optionsRef = useRef(options);
286
+ useEffect(() => {
287
+ optionsRef.current = options;
288
+ }, [options]);
289
+ const listSubAgents = useCallback(async () => {
290
+ setLoading(true);
291
+ setError(null);
292
+ try {
293
+ const response = await listSubAgentsApi(optionsRef.current);
294
+ if (response.error) {
295
+ setError(response.error);
296
+ return [];
297
+ }
298
+ return response.data?.subAgents || [];
299
+ } catch (err) {
300
+ const message = err instanceof Error ? err.message : "Failed to load sub-agents";
301
+ setError(message);
302
+ return [];
303
+ } finally {
304
+ setLoading(false);
305
+ }
306
+ }, []);
307
+ const getSubAgent = useCallback(async (subAgentId) => {
308
+ setLoading(true);
309
+ setError(null);
310
+ try {
311
+ const response = await getSubAgentApi(subAgentId, optionsRef.current);
312
+ if (response.error) {
313
+ setError(response.error);
314
+ return null;
315
+ }
316
+ return response.data?.subAgent || null;
317
+ } catch (err) {
318
+ const message = err instanceof Error ? err.message : "Failed to get sub-agent";
319
+ setError(message);
320
+ return null;
321
+ } finally {
322
+ setLoading(false);
323
+ }
324
+ }, []);
325
+ const createSubAgent = useCallback(async (subAgent) => {
326
+ setLoading(true);
327
+ setError(null);
328
+ try {
329
+ const response = await createSubAgentApi(subAgent, optionsRef.current);
330
+ if (response.error) {
331
+ setError(response.error);
332
+ return null;
333
+ }
334
+ return response.data?.subAgent || null;
335
+ } catch (err) {
336
+ const message = err instanceof Error ? err.message : "Failed to create sub-agent";
337
+ setError(message);
338
+ return null;
339
+ } finally {
340
+ setLoading(false);
341
+ }
342
+ }, []);
343
+ const updateSubAgent = useCallback(async (subAgentId, subAgent) => {
344
+ setLoading(true);
345
+ setError(null);
346
+ try {
347
+ const response = await updateSubAgentApi(subAgentId, subAgent, optionsRef.current);
348
+ if (response.error) {
349
+ setError(response.error);
350
+ return null;
351
+ }
352
+ return response.data?.subAgent || null;
353
+ } catch (err) {
354
+ const message = err instanceof Error ? err.message : "Failed to update sub-agent";
355
+ setError(message);
356
+ return null;
357
+ } finally {
358
+ setLoading(false);
359
+ }
360
+ }, []);
361
+ const deleteSubAgent = useCallback(async (subAgentId) => {
362
+ setLoading(true);
363
+ setError(null);
364
+ try {
365
+ const response = await deleteSubAgentApi(subAgentId, optionsRef.current);
366
+ if (response.error) {
367
+ setError(response.error);
368
+ return false;
369
+ }
370
+ return true;
371
+ } catch (err) {
372
+ const message = err instanceof Error ? err.message : "Failed to delete sub-agent";
373
+ setError(message);
374
+ return false;
375
+ } finally {
376
+ setLoading(false);
377
+ }
378
+ }, []);
379
+ return useMemo(
380
+ () => ({
381
+ loading,
382
+ error,
383
+ listSubAgents,
384
+ getSubAgent,
385
+ createSubAgent,
386
+ updateSubAgent,
387
+ deleteSubAgent
388
+ }),
389
+ [loading, error, listSubAgents, getSubAgent, createSubAgent, updateSubAgent, deleteSubAgent]
390
+ );
391
+ }
392
+
393
+ export {
394
+ useAgents,
395
+ useSkills,
396
+ useSubAgents
397
+ };
398
+ //# sourceMappingURL=chunk-O2SYQSU2.mjs.map