@burdenoff/microfe-botmanor 2026.1115.2 → 2026.1116.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/botlit/components/BotFormFields.js +66 -87
  2. package/dist/botlit/components/BotFormFields.js.map +1 -1
  3. package/dist/botlit/components/EmojiPicker.d.ts +20 -0
  4. package/dist/botlit/components/EmojiPicker.js +42 -0
  5. package/dist/botlit/components/EmojiPicker.js.map +1 -0
  6. package/dist/botlit/components/index.d.ts +1 -0
  7. package/dist/botlit/hooks/internal/allPages.d.ts +2 -0
  8. package/dist/botlit/hooks/internal/allPages.js +25 -0
  9. package/dist/botlit/hooks/internal/allPages.js.map +1 -0
  10. package/dist/botlit/hooks/useAgents.d.ts +24 -3
  11. package/dist/botlit/hooks/useAgents.js +158 -109
  12. package/dist/botlit/hooks/useAgents.js.map +1 -1
  13. package/dist/botlit/hooks/useBotAgents.d.ts +23 -0
  14. package/dist/botlit/hooks/useBotAgents.js +69 -0
  15. package/dist/botlit/hooks/useBotAgents.js.map +1 -0
  16. package/dist/botlit/hooks/useBots.js +2 -2
  17. package/dist/botlit/hooks/useBots.js.map +1 -1
  18. package/dist/botlit/hooks/useKnowledgeBases.js +40 -44
  19. package/dist/botlit/hooks/useKnowledgeBases.js.map +1 -1
  20. package/dist/botlit/hooks/useMCPServers.js +53 -57
  21. package/dist/botlit/hooks/useMCPServers.js.map +1 -1
  22. package/dist/botlit/pages/AgentBuilderPage.js +832 -425
  23. package/dist/botlit/pages/AgentBuilderPage.js.map +1 -1
  24. package/dist/botlit/pages/AgentDetailPage.js +407 -325
  25. package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
  26. package/dist/botlit/pages/AgentsListPage.js +487 -291
  27. package/dist/botlit/pages/AgentsListPage.js.map +1 -1
  28. package/dist/botlit/types/index.d.ts +4 -1
  29. package/dist/botlit/utils/agentDelete.d.ts +5 -0
  30. package/dist/botlit/utils/agentDelete.js +15 -0
  31. package/dist/botlit/utils/agentDelete.js.map +1 -0
  32. package/dist/botlit/utils/agentSettings.d.ts +77 -0
  33. package/dist/botlit/utils/agentSettings.js +78 -0
  34. package/dist/botlit/utils/agentSettings.js.map +1 -0
  35. package/dist/generated/wspace-operations.d.ts +4 -0
  36. package/dist/generated/wspace-operations.js.map +1 -1
  37. package/dist/generated/wspace-types.d.ts +43 -0
  38. package/dist/generated/wspace-types.js.map +1 -1
  39. package/package.json +1 -1
@@ -1,141 +1,483 @@
1
- import { isNative as e, nativeConfirm as t, nativeImpact as n, nativeNotify as r } from "../../utils/nativeBridge.js";
2
- import { useTr as i } from "../../shared/hooks/useTr.js";
3
- import { PageLayout as a } from "../components/PageLayout.js";
4
- import { Card as o, CardContent as s } from "../components/Card.js";
5
- import { Button as c } from "../components/Button.js";
6
- import { Input as l } from "../components/Input.js";
7
- import { BOTMANOR_PERMISSIONS as u } from "../permissions/botmanorPermissions.js";
8
- import { BotmanorPermissionGate as d } from "../permissions/useBotmanorPermissions.js";
9
- import { StatusBadge as f } from "../components/Badge.js";
10
- import { EmptyState as p } from "../components/EmptyState.js";
11
- import { LoadMore as m } from "../components/LoadMore.js";
12
- import { ErrorState as h } from "../components/ErrorState.js";
13
- import { useAgents as g, useDeleteAgent as _ } from "../hooks/useAgents.js";
14
- import { useBotlitStore as v } from "../store/botlitStore.js";
15
- import { useBotlit as y } from "../providers/BotlitProvider.js";
16
- import { formatNumber as b, formatRelativeTime as x } from "../utils/formatters.js";
17
- import { cn as S } from "../utils/cn.js";
1
+ import { isNative as e, nativeImpact as t, nativeNotify as n } from "../../utils/nativeBridge.js";
2
+ import { useTr as r } from "../../shared/hooks/useTr.js";
3
+ import { PageLayout as i } from "../components/PageLayout.js";
4
+ import { Card as a, CardContent as o } from "../components/Card.js";
5
+ import { Button as s } from "../components/Button.js";
6
+ import { Input as c } from "../components/Input.js";
7
+ import { Badge as ee, StatusBadge as te } from "../components/Badge.js";
8
+ import { BOTMANOR_PERMISSIONS as l } from "../permissions/botmanorPermissions.js";
9
+ import { BotmanorPermissionGate as u, useBotmanorCan as d } from "../permissions/useBotmanorPermissions.js";
10
+ import { EmptyState as f } from "../components/EmptyState.js";
11
+ import { ErrorState as ne } from "../components/ErrorState.js";
12
+ import { LoadMore as re } from "../components/LoadMore.js";
13
+ import { ActionMenu as ie } from "../components/ActionMenu.js";
14
+ import { useAgentCounts as ae, useAgents as oe, useDeleteAgent as se, useLoadAgentUsage as ce } from "../hooks/useAgents.js";
15
+ import { useBot as le, useUpdateBot as ue } from "../hooks/useBots.js";
16
+ import { useBotAgentLinks as de, useLinkAgentToBot as fe, useUnlinkAgentFromBot as pe } from "../hooks/useBotAgents.js";
17
+ import { useBotlitStore as me } from "../store/botlitStore.js";
18
+ import { useBotlit as he } from "../providers/BotlitProvider.js";
19
+ import { agentDeleteMessage as ge } from "../utils/agentDelete.js";
20
+ import { confirmAction as p } from "../utils/confirmAction.js";
21
+ import { formatNumber as m, formatRelativeTime as h } from "../utils/formatters.js";
22
+ import { cn as _e } from "../utils/cn.js";
18
23
  import "../permissions/index.js";
19
- import { useState as C } from "react";
20
- import { GlassCard as w, PagePurpose as T } from "@burdenoff/fe-libs/ui";
21
- import { jsx as E, jsxs as D } from "react/jsx-runtime";
22
- import { Link as O, useParams as ee } from "react-router";
23
- import { Bot as te, Grid3X3 as k, List as A, MessageSquare as j, MoreVertical as M, Play as N, Plus as P, Search as F, Settings as I, ShieldCheck as L, Trash2 as R } from "lucide-react";
24
- import { toast as z } from "sonner";
24
+ import { useEffect as g, useState as _ } from "react";
25
+ import { GlassCard as v, PagePurpose as ve } from "@burdenoff/fe-libs/ui";
26
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
27
+ import { Link as ye, useParams as be } from "react-router";
28
+ import { Bot as xe, Edit as Se, Grid3X3 as Ce, List as we, MessageSquare as Te, Play as x, Plus as Ee, Search as De, ShieldCheck as Oe, Star as ke, Trash2 as Ae, Unlink as je } from "lucide-react";
29
+ import { toast as S } from "sonner";
25
30
  // src/botlit/pages/AgentsListPage.tsx
26
- var B = () => {
27
- let B = i(), { botId: V } = ee(), { navigateTo: H, getPath: U } = y(), { viewMode: W, setViewMode: G, agentFilter: K, updateAgentFilter: q } = v(), { data: J, loading: Y, error: X, refetch: Z, hasMore: ne, loadingMore: re, loadMore: ie } = g(K), [ae] = _(), [Q, $] = C(null), oe = (e) => {
28
- q({ search: e.target.value });
29
- }, se = async (i) => {
30
- let a = await t({
31
- title: B("botlit.agentsList.delete.title", "Delete agent?"),
32
- message: B("botlit.agentsList.delete.message", "Are you sure you want to delete \"{{name}}\"?", { name: i.name }),
33
- okButtonTitle: B("botlit.agentsList.delete.okButton", "Delete"),
34
- cancelButtonTitle: B("botlit.agentsList.delete.cancelButton", "Cancel")
31
+ var Me = "🤖", Ne = 300, Pe = [
32
+ "DRAFT",
33
+ "ACTIVE",
34
+ "PAUSED",
35
+ "TRAINING",
36
+ "ARCHIVED"
37
+ ], Fe = [
38
+ "newest",
39
+ "oldest",
40
+ "name",
41
+ "runs"
42
+ ], C = "h-10 rounded-md border border-border-default bg-bg-surface px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", Ie = "after:absolute after:inset-0 after:content-[\"\"] focus-visible:outline-none focus-visible:after:ring-2 focus-visible:after:ring-primary focus-visible:after:rounded-lg";
43
+ function Le(e, t) {
44
+ let n = (e) => e ? Date.parse(e) : 0, r = [...e];
45
+ switch (t) {
46
+ case "oldest": return r.sort((e, t) => n(e.createdAt) - n(t.createdAt));
47
+ case "name": return r.sort((e, t) => e.name.localeCompare(t.name));
48
+ case "runs": return r.sort((e, t) => (t.executionCount ?? 0) - (e.executionCount ?? 0));
49
+ default: return r;
50
+ }
51
+ }
52
+ var w = () => {
53
+ let w = r(), T = d(), { botId: E } = be(), { navigateTo: D, getPath: Re } = he(), { viewMode: O, setViewMode: k, agentFilter: A, updateAgentFilter: j } = me(), { data: M, loading: ze, error: N, refetch: P, hasMore: F, loadingMore: I, loadMore: L } = oe(A), R = ae(), [Be] = se(), Ve = ce(), { data: z, loading: He, error: Ue, refetch: B } = le(E), V = de(E), [We] = fe(), [Ge] = pe(), [H] = ue(), [U, W] = _(""), [G, K] = _(A.search ?? ""), [Ke, qe] = _("newest"), q = (A.search ?? "").trim(), J = A.status?.[0] ?? "";
54
+ g(() => {
55
+ E && F && !I && !N && L();
56
+ }, [
57
+ E,
58
+ F,
59
+ I,
60
+ N,
61
+ L
62
+ ]), g(() => {
63
+ if (G === (A.search ?? "")) return;
64
+ let e = window.setTimeout(() => j({ search: G }), Ne);
65
+ return () => window.clearTimeout(e);
66
+ }, [
67
+ G,
68
+ A.search,
69
+ j
70
+ ]);
71
+ let Je = ze || !!E && (V.loading || He || F || I), Y = N ?? (E ? V.error ?? Ue : void 0), Ye = (e, t = "") => E ? `bots/${E}/agents/${e}${t}` : `agents/${e}${t}`, X = new Set(V.data.map((e) => e.agentId));
72
+ z?.defaultAgentId && X.add(z.defaultAgentId);
73
+ let Xe = E ? M.filter((e) => X.has(e.id)) : M, Z = Le(Xe, Ke), Ze = q !== "" || J !== "", Q = E ? M.filter((e) => !X.has(e.id)) : [], Qe = () => {
74
+ K(""), j({
75
+ search: "",
76
+ status: void 0
35
77
  });
36
- if (a === null ? confirm(B("botlit.agentsList.delete.message", "Are you sure you want to delete \"{{name}}\"?", { name: i.name })) : a) {
37
- n("medium");
78
+ }, $e = async (r) => {
79
+ let i = await Ve(r.id).catch(() => null);
80
+ if (await p({
81
+ title: w("botlit.agentsList.delete.title", "Delete agent?"),
82
+ message: ge(w, r.name, i),
83
+ confirmLabel: w("botlit.agentsList.delete.okButton", "Delete"),
84
+ cancelLabel: w("botlit.agentsList.delete.cancelButton", "Cancel")
85
+ })) {
86
+ t("medium");
38
87
  try {
39
- await ae(i.id), z.success(B("botlit.agentsList.delete.success", "Agent \"{{name}}\" deleted successfully", { name: i.name })), e() && r("success");
88
+ if (!await Be(r.id)) {
89
+ S.error(w("botlit.agentsList.delete.notDeleted", "The agent could not be deleted.")), e() && n("error");
90
+ return;
91
+ }
92
+ S.success(w("botlit.agentsList.delete.success", "Agent \"{{name}}\" deleted successfully", { name: r.name })), e() && n("success"), await P(), R.refetch(), V.refetch(), B();
40
93
  } catch (t) {
41
- let n = t instanceof Error ? t.message : B("botlit.agentsList.delete.error", "Failed to delete agent");
42
- z.error(n), e() && r("error");
94
+ S.error(t instanceof Error ? t.message : w("botlit.agentsList.delete.error", "Failed to delete agent")), e() && n("error");
43
95
  }
44
96
  }
45
- $(null);
97
+ }, et = async () => {
98
+ if (E && U) try {
99
+ if (await We({
100
+ botId: E,
101
+ agentId: U
102
+ }), W(""), await V.refetch(), S.success(w("botlit.agentsList.bot.linked", "Agent linked to this bot")), z && !z.defaultAgentId && T(l.APP_UPDATE)) try {
103
+ await H({
104
+ botId: E,
105
+ input: { defaultAgentId: U }
106
+ }), B();
107
+ } catch (e) {
108
+ S.error(e instanceof Error ? e.message : w("botlit.agentsList.bot.defaultError", "Failed to set the default agent"));
109
+ }
110
+ } catch (e) {
111
+ S.error(e instanceof Error ? e.message : w("botlit.agentsList.bot.linkError", "Failed to link the agent"));
112
+ }
113
+ }, tt = async (e) => {
114
+ if (E && await p({
115
+ title: w("botlit.agentsList.bot.unlinkTitle", "Remove agent from this bot?"),
116
+ message: w("botlit.agentsList.bot.unlinkMessage", "Remove \"{{name}}\" from this bot? The agent itself is kept.", { name: e.name }),
117
+ confirmLabel: w("botlit.agentsList.bot.unlinkConfirm", "Remove"),
118
+ cancelLabel: w("botlit.common.cancel", "Cancel")
119
+ })) try {
120
+ let t = V.data.find((t) => t.agentId === e.id);
121
+ if (t && !await Ge(t.id)) {
122
+ S.error(w("botlit.agentsList.bot.unlinkNotDone", "The agent could not be removed from this bot."));
123
+ return;
124
+ }
125
+ if (await V.refetch(), S.success(w("botlit.agentsList.bot.unlinked", "Agent removed from this bot")), z?.defaultAgentId === e.id && T(l.APP_UPDATE)) try {
126
+ await H({
127
+ botId: E,
128
+ input: { defaultAgentId: null }
129
+ }), B();
130
+ } catch (e) {
131
+ S.error(e instanceof Error ? e.message : w("botlit.agentsList.bot.defaultError", "Failed to set the default agent"));
132
+ }
133
+ } catch (e) {
134
+ S.error(e instanceof Error ? e.message : w("botlit.agentsList.bot.unlinkError", "Failed to remove the agent"));
135
+ }
136
+ }, nt = async (e) => {
137
+ if (E) try {
138
+ await H({
139
+ botId: E,
140
+ input: { defaultAgentId: e.id }
141
+ }), await B(), S.success(w("botlit.agentsList.bot.defaultSet", "\"{{name}}\" is now this bot's default agent", { name: e.name }));
142
+ } catch (e) {
143
+ S.error(e instanceof Error ? e.message : w("botlit.agentsList.bot.defaultError", "Failed to set the default agent"));
144
+ }
145
+ }, rt = (e) => {
146
+ let t = [];
147
+ T(l.AGENT_EXECUTE) && t.push({
148
+ key: "test",
149
+ label: w("botlit.agentsList.menu.testAgent", "Test Agent"),
150
+ icon: /* @__PURE__ */ y(x, {
151
+ size: 16,
152
+ "aria-hidden": "true"
153
+ }),
154
+ onSelect: () => D(`chat/${e.id}`)
155
+ }), T(l.AGENT_UPDATE) && t.push({
156
+ key: "edit",
157
+ label: w("botlit.agentsList.menu.editAgent", "Edit Agent"),
158
+ icon: /* @__PURE__ */ y(Se, {
159
+ size: 16,
160
+ "aria-hidden": "true"
161
+ }),
162
+ onSelect: () => D(Ye(e.id, "/edit"))
163
+ }), E && T(l.APP_UPDATE) && z?.defaultAgentId !== e.id && t.push({
164
+ key: "default",
165
+ label: w("botlit.agentsList.bot.setDefault", "Set as default agent"),
166
+ icon: /* @__PURE__ */ y(ke, {
167
+ size: 16,
168
+ "aria-hidden": "true"
169
+ }),
170
+ onSelect: () => void nt(e)
171
+ });
172
+ let n = z?.defaultAgentId === e.id;
173
+ return E && T(l.APP_AGENT_DELETE) && (!n || T(l.APP_UPDATE)) && t.push({
174
+ key: "unlink",
175
+ label: w("botlit.agentsList.bot.remove", "Remove from this bot"),
176
+ icon: /* @__PURE__ */ y(je, {
177
+ size: 16,
178
+ "aria-hidden": "true"
179
+ }),
180
+ onSelect: () => void tt(e)
181
+ }), T(l.AGENT_DELETE) && t.push({
182
+ key: "delete",
183
+ label: w("botlit.agentsList.menu.delete", "Delete"),
184
+ icon: /* @__PURE__ */ y(Ae, {
185
+ size: 16,
186
+ "aria-hidden": "true"
187
+ }),
188
+ destructive: !0,
189
+ onSelect: () => void $e(e)
190
+ }), t;
191
+ }, it = (e) => {
192
+ let t = e ?? 0;
193
+ return t === 1 ? w("botlit.common.executionsOne", "{{count}} execution", { count: m(t) }) : w("botlit.common.executionsOther", "{{count}} executions", { count: m(t) });
194
+ }, at = E ? `bots/${E}/agents/new` : "agents/new", ot = !Je && !Y && Xe.length === 0 && !Ze, st = /* @__PURE__ */ y(u, {
195
+ permission: l.AGENT_CREATE,
196
+ children: /* @__PURE__ */ y(s, {
197
+ leftIcon: /* @__PURE__ */ y(Ee, { size: 16 }),
198
+ onClick: () => D(at),
199
+ children: w("botlit.agentsList.actions.createAgent", "Create Agent")
200
+ })
201
+ }), $ = R.data, ct = (e) => w(`botlit.status.${e.toLowerCase()}`, e.charAt(0) + e.slice(1).toLowerCase()), lt = {
202
+ newest: w("botlit.agentsList.sort.newest", "Newest first"),
203
+ oldest: w("botlit.agentsList.sort.oldest", "Oldest first"),
204
+ name: w("botlit.agentsList.sort.name", "Name (A to Z)"),
205
+ runs: w("botlit.agentsList.sort.runs", "Most executions")
206
+ }, ut = (e, t) => {
207
+ let n = !!E && z?.defaultAgentId === e.id, r = /* @__PURE__ */ y("h2", {
208
+ className: "font-semibold text-text-primary",
209
+ children: /* @__PURE__ */ y(ye, {
210
+ to: Re(Ye(e.id)),
211
+ className: Ie,
212
+ children: e.name
213
+ })
214
+ }), i = /* @__PURE__ */ b("span", {
215
+ className: "flex flex-wrap items-center gap-2",
216
+ children: [/* @__PURE__ */ y(te, { status: e.status }), n && /* @__PURE__ */ y(ee, {
217
+ variant: "outline",
218
+ children: w("botlit.agentsList.bot.defaultBadge", "Default")
219
+ })]
220
+ }), c = /* @__PURE__ */ y("div", {
221
+ className: "relative z-10",
222
+ children: /* @__PURE__ */ y(ie, {
223
+ label: w("botlit.agentsList.menu.actionsFor", "Actions for {{name}}", { name: e.name }),
224
+ items: rt(e)
225
+ })
226
+ }), d = /* @__PURE__ */ y(u, {
227
+ permission: l.AGENT_EXECUTE,
228
+ children: /* @__PURE__ */ y(s, {
229
+ size: "sm",
230
+ variant: "ghost",
231
+ className: "relative z-10",
232
+ leftIcon: /* @__PURE__ */ y(x, {
233
+ size: 14,
234
+ "aria-hidden": "true"
235
+ }),
236
+ "aria-label": w("botlit.agentsList.card.testFor", "Test {{name}}", { name: e.name }),
237
+ onClick: () => D(`chat/${e.id}`),
238
+ children: w("botlit.agentsList.card.test", "Test")
239
+ })
240
+ });
241
+ return t === "grid" ? /* @__PURE__ */ y("li", { children: /* @__PURE__ */ y(a, {
242
+ className: "group relative h-full hover:shadow-md transition-shadow",
243
+ children: /* @__PURE__ */ b(o, {
244
+ className: "pt-6",
245
+ children: [
246
+ /* @__PURE__ */ b("div", {
247
+ className: "flex items-start justify-between",
248
+ children: [/* @__PURE__ */ b("div", {
249
+ className: "flex items-center gap-3",
250
+ children: [/* @__PURE__ */ y("span", {
251
+ className: "text-4xl",
252
+ "aria-hidden": "true",
253
+ children: e.avatar || Me
254
+ }), /* @__PURE__ */ b("div", { children: [r, /* @__PURE__ */ y("div", {
255
+ className: "mt-1",
256
+ children: i
257
+ })] })]
258
+ }), c]
259
+ }),
260
+ /* @__PURE__ */ y("p", {
261
+ className: "mt-3 text-sm text-text-secondary line-clamp-2",
262
+ children: e.description
263
+ }),
264
+ /* @__PURE__ */ y("div", {
265
+ className: "mt-4 flex items-center gap-4 text-xs text-text-secondary",
266
+ children: /* @__PURE__ */ b("span", {
267
+ className: "flex items-center gap-1",
268
+ children: [/* @__PURE__ */ y(Te, {
269
+ size: 14,
270
+ "aria-hidden": "true"
271
+ }), it(e.executionCount)]
272
+ })
273
+ }),
274
+ /* @__PURE__ */ b("div", {
275
+ className: "mt-3 pt-3 border-t border-border-subtle flex items-center justify-between",
276
+ children: [/* @__PURE__ */ b("span", {
277
+ className: "text-xs text-text-secondary",
278
+ children: [
279
+ w("botlit.agentsList.card.created", "Created"),
280
+ " ",
281
+ h(e.createdAt)
282
+ ]
283
+ }), d]
284
+ })
285
+ ]
286
+ })
287
+ }) }, e.id) : /* @__PURE__ */ y("li", { children: /* @__PURE__ */ y(a, {
288
+ className: "group relative hover:shadow-md transition-shadow",
289
+ children: /* @__PURE__ */ y(o, {
290
+ className: "py-4",
291
+ children: /* @__PURE__ */ b("div", {
292
+ className: "flex items-center justify-between gap-4",
293
+ children: [/* @__PURE__ */ b("div", {
294
+ className: "flex items-center gap-4",
295
+ children: [/* @__PURE__ */ y("span", {
296
+ className: "text-3xl",
297
+ "aria-hidden": "true",
298
+ children: e.avatar || Me
299
+ }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("div", {
300
+ className: "flex flex-wrap items-center gap-2",
301
+ children: [r, i]
302
+ }), /* @__PURE__ */ y("p", {
303
+ className: "text-sm text-text-secondary line-clamp-1",
304
+ children: e.description
305
+ })] })]
306
+ }), /* @__PURE__ */ b("div", {
307
+ className: "flex items-center gap-4 text-sm text-text-secondary",
308
+ children: [
309
+ /* @__PURE__ */ y("span", { children: it(e.executionCount) }),
310
+ /* @__PURE__ */ y("span", { children: h(e.createdAt) }),
311
+ d,
312
+ c
313
+ ]
314
+ })]
315
+ })
316
+ })
317
+ }) }, e.id);
46
318
  };
47
- return /* @__PURE__ */ E(a, {
48
- title: V ? B("botlit.agentsList.titleBot", "Bot Agents") : B("botlit.agentsList.title", "All Agents"),
49
- description: V ? B("botlit.agentsList.descriptionBot", "Manage agents for this bot") : B("botlit.agentsList.description", "View and manage all your AI agents"),
50
- actions: /* @__PURE__ */ D("div", {
319
+ return /* @__PURE__ */ y(i, {
320
+ title: E ? w("botlit.agentsList.titleBot", "Bot Agents") : w("botlit.agentsList.title", "All Agents"),
321
+ description: E ? w("botlit.agentsList.descriptionBot", "Manage agents for this bot") : w("botlit.agentsList.description", "View and manage all your AI agents"),
322
+ actions: /* @__PURE__ */ b("div", {
51
323
  className: "flex gap-2",
52
- children: [/* @__PURE__ */ E(c, {
324
+ children: [/* @__PURE__ */ y(s, {
53
325
  variant: "outline",
54
- leftIcon: /* @__PURE__ */ E(L, { size: 16 }),
55
- onClick: () => H("agents/approvals"),
56
- children: B("botlit.agentsList.actions.approvals", "Approvals")
57
- }), /* @__PURE__ */ E(d, {
58
- permission: u.AGENT_CREATE,
59
- children: /* @__PURE__ */ E(c, {
60
- leftIcon: /* @__PURE__ */ E(P, { size: 16 }),
61
- onClick: () => H(V ? `bots/${V}/agents/new` : "agents/new"),
62
- children: B("botlit.agentsList.actions.createAgent", "Create Agent")
63
- })
64
- })]
326
+ leftIcon: /* @__PURE__ */ y(Oe, { size: 16 }),
327
+ onClick: () => D("agents/approvals"),
328
+ children: w("botlit.agentsList.actions.approvals", "Approvals")
329
+ }), ot ? null : st]
65
330
  }),
66
- children: /* @__PURE__ */ D("div", {
331
+ children: /* @__PURE__ */ b("div", {
67
332
  className: "space-y-6",
68
333
  children: [
69
- /* @__PURE__ */ E(T, {
70
- icon: /* @__PURE__ */ E(te, { size: 18 }),
71
- children: B("botlit.agentsList.purpose", "Agents are the reasoning workers behind your bots — each one bundles a model, a system prompt, tools and knowledge into a callable AI. Build an agent here to handle a specific job (answer support questions, summarise documents, run a workflow), then test it in chat and connect it to a bot or channel.")
334
+ /* @__PURE__ */ y(ve, {
335
+ icon: /* @__PURE__ */ y(xe, { size: 18 }),
336
+ children: w("botlit.agentsList.purpose", "Agents are the reasoning workers behind your bots — each one bundles a model, a system prompt, tools and knowledge into a callable AI. Build an agent here to handle a specific job (answer support questions, summarise documents, run a workflow), then test it in chat and connect it to a bot or channel.")
72
337
  }),
73
- J.length > 0 ? /* @__PURE__ */ D("div", {
74
- className: "grid grid-cols-2 gap-4 sm:grid-cols-3",
75
- children: [
76
- /* @__PURE__ */ D(w, {
77
- treatment: "glass",
78
- glow: !0,
79
- className: "p-4",
80
- children: [/* @__PURE__ */ E("p", {
81
- className: "text-sm text-text-secondary",
82
- children: B("botlit.agentsList.summary.total", "Total agents")
83
- }), /* @__PURE__ */ E("p", {
84
- className: "mt-1 text-2xl font-semibold tabular-nums text-text-primary",
85
- children: J.length
86
- })]
87
- }),
88
- /* @__PURE__ */ D(w, {
89
- treatment: "metric",
90
- className: "p-4",
91
- children: [/* @__PURE__ */ E("p", {
92
- className: "text-sm text-text-secondary",
93
- children: B("botlit.agentsList.summary.active", "Active")
94
- }), /* @__PURE__ */ E("p", {
95
- className: "mt-1 text-2xl font-semibold tabular-nums text-text-primary",
96
- children: J.filter((e) => e.status === "ACTIVE").length
97
- })]
98
- }),
99
- /* @__PURE__ */ D(w, {
100
- treatment: "metric",
101
- className: "col-span-2 p-4 sm:col-span-1",
102
- children: [/* @__PURE__ */ E("p", {
103
- className: "text-sm text-text-secondary",
104
- children: B("botlit.agentsList.summary.executions", "Total executions")
105
- }), /* @__PURE__ */ E("p", {
106
- className: "mt-1 text-2xl font-semibold tabular-nums text-text-primary",
107
- children: b(J.reduce((e, t) => e + (t.executionCount ?? 0), 0))
108
- })]
109
- })
110
- ]
338
+ !E && $ && $.total - $.archived > 0 ? /* @__PURE__ */ b("div", {
339
+ className: "grid grid-cols-2 gap-4",
340
+ role: "group",
341
+ "aria-label": w("botlit.agentsList.summary.title", "Agent totals"),
342
+ children: [/* @__PURE__ */ b(v, {
343
+ treatment: "metric",
344
+ className: "p-4",
345
+ children: [/* @__PURE__ */ y("p", {
346
+ className: "text-sm text-text-secondary",
347
+ children: w("botlit.agentsList.summary.total", "Total agents")
348
+ }), /* @__PURE__ */ y("p", {
349
+ className: "mt-1 text-2xl font-semibold tabular-nums text-text-primary",
350
+ children: m($.total - $.archived)
351
+ })]
352
+ }), /* @__PURE__ */ b(v, {
353
+ treatment: "metric",
354
+ className: "p-4",
355
+ children: [/* @__PURE__ */ y("p", {
356
+ className: "text-sm text-text-secondary",
357
+ children: w("botlit.agentsList.summary.active", "Active")
358
+ }), /* @__PURE__ */ y("p", {
359
+ className: "mt-1 text-2xl font-semibold tabular-nums text-text-primary",
360
+ children: m($.active)
361
+ })]
362
+ })]
111
363
  }) : null,
112
- /* @__PURE__ */ D("div", {
113
- className: "flex items-center justify-between gap-4",
114
- children: [/* @__PURE__ */ D("div", {
115
- className: "relative flex-1 max-w-md",
116
- children: [/* @__PURE__ */ E(F, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-text-secondary" }), /* @__PURE__ */ E(l, {
117
- placeholder: B("botlit.agentsList.searchPlaceholder", "Search agents..."),
118
- value: K.search || "",
119
- onChange: oe,
120
- className: "pl-9"
364
+ E ? /* @__PURE__ */ y(u, {
365
+ permission: l.APP_AGENT_CREATE,
366
+ children: /* @__PURE__ */ b("div", {
367
+ className: "flex flex-wrap items-end gap-2",
368
+ children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
369
+ htmlFor: "agents-link-select",
370
+ className: "mb-1 block text-sm font-medium",
371
+ children: w("botlit.agentsList.bot.linkLabel", "Link an existing agent")
372
+ }), /* @__PURE__ */ b("select", {
373
+ id: "agents-link-select",
374
+ className: _e(C, "min-w-64"),
375
+ value: U,
376
+ onChange: (e) => W(e.target.value),
377
+ disabled: Q.length === 0 || V.loading || !!V.error,
378
+ children: [/* @__PURE__ */ y("option", {
379
+ value: "",
380
+ children: Q.length === 0 ? w("botlit.agentsList.bot.nothingToLink", "Every agent is already linked") : w("botlit.agentsList.bot.choose", "Choose an agent...")
381
+ }), Q.map((e) => /* @__PURE__ */ y("option", {
382
+ value: e.id,
383
+ children: e.name
384
+ }, e.id))]
385
+ })] }), /* @__PURE__ */ y(s, {
386
+ variant: "outline",
387
+ disabled: !U,
388
+ onClick: () => void et(),
389
+ children: w("botlit.agentsList.bot.link", "Link agent")
121
390
  })]
122
- }), /* @__PURE__ */ D("div", {
391
+ })
392
+ }) : null,
393
+ /* @__PURE__ */ b("div", {
394
+ className: "flex flex-wrap items-center justify-between gap-4",
395
+ children: [/* @__PURE__ */ b("div", {
396
+ className: "flex flex-1 flex-wrap items-center gap-3",
397
+ children: [
398
+ /* @__PURE__ */ b("div", {
399
+ className: "relative flex-1 min-w-48 max-w-md",
400
+ children: [/* @__PURE__ */ y(De, {
401
+ className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-text-secondary",
402
+ "aria-hidden": "true"
403
+ }), /* @__PURE__ */ y(c, {
404
+ id: "agents-search",
405
+ type: "search",
406
+ "aria-label": w("botlit.agentsList.search.label", "Search agents"),
407
+ placeholder: w("botlit.agentsList.searchPlaceholder", "Search agents..."),
408
+ value: G,
409
+ onChange: (e) => K(e.target.value),
410
+ className: "pl-9"
411
+ })]
412
+ }),
413
+ /* @__PURE__ */ b("label", {
414
+ className: "flex items-center gap-2 text-sm",
415
+ children: [/* @__PURE__ */ y("span", {
416
+ className: "text-text-secondary",
417
+ children: w("botlit.agentsList.filter.status", "Status")
418
+ }), /* @__PURE__ */ b("select", {
419
+ className: C,
420
+ value: J,
421
+ onChange: (e) => j({ status: e.target.value ? [Pe.find((t) => t === e.target.value) ?? "ACTIVE"] : void 0 }),
422
+ children: [/* @__PURE__ */ y("option", {
423
+ value: "",
424
+ children: w("botlit.agentsList.filter.allStatuses", "All statuses")
425
+ }), Pe.map((e) => /* @__PURE__ */ y("option", {
426
+ value: e,
427
+ children: ct(e)
428
+ }, e))]
429
+ })]
430
+ }),
431
+ /* @__PURE__ */ b("label", {
432
+ className: "flex items-center gap-2 text-sm",
433
+ children: [/* @__PURE__ */ y("span", {
434
+ className: "text-text-secondary",
435
+ children: w("botlit.agentsList.sort.label", "Sort")
436
+ }), /* @__PURE__ */ y("select", {
437
+ className: C,
438
+ value: Ke,
439
+ onChange: (e) => qe(Fe.find((t) => t === e.target.value) ?? "newest"),
440
+ children: Fe.map((e) => /* @__PURE__ */ y("option", {
441
+ value: e,
442
+ children: lt[e]
443
+ }, e))
444
+ })]
445
+ })
446
+ ]
447
+ }), /* @__PURE__ */ b("div", {
123
448
  className: "flex items-center gap-2",
124
- children: [/* @__PURE__ */ E(c, {
125
- variant: W === "grid" ? "secondary" : "ghost",
449
+ role: "group",
450
+ "aria-label": w("botlit.agentsList.view.label", "Layout"),
451
+ children: [/* @__PURE__ */ y(s, {
452
+ variant: O === "grid" ? "secondary" : "ghost",
126
453
  size: "icon",
127
- onClick: () => G("grid"),
128
- children: /* @__PURE__ */ E(k, { size: 18 })
129
- }), /* @__PURE__ */ E(c, {
130
- variant: W === "list" ? "secondary" : "ghost",
454
+ "aria-label": w("botlit.agentsList.view.grid", "Grid view"),
455
+ title: w("botlit.agentsList.view.grid", "Grid view"),
456
+ "aria-pressed": O === "grid",
457
+ onClick: () => k("grid"),
458
+ children: /* @__PURE__ */ y(Ce, {
459
+ size: 18,
460
+ "aria-hidden": "true"
461
+ })
462
+ }), /* @__PURE__ */ y(s, {
463
+ variant: O === "list" ? "secondary" : "ghost",
131
464
  size: "icon",
132
- onClick: () => G("list"),
133
- children: /* @__PURE__ */ E(A, { size: 18 })
465
+ "aria-label": w("botlit.agentsList.view.list", "List view"),
466
+ title: w("botlit.agentsList.view.list", "List view"),
467
+ "aria-pressed": O === "list",
468
+ onClick: () => k("list"),
469
+ children: /* @__PURE__ */ y(we, {
470
+ size: 18,
471
+ "aria-hidden": "true"
472
+ })
134
473
  })]
135
474
  })]
136
475
  }),
137
- Y ? /* @__PURE__ */ E("div", {
138
- className: S("gap-4", W === "grid" ? "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3" : "flex flex-col"),
476
+ Je ? /* @__PURE__ */ y("div", {
477
+ role: "status",
478
+ "aria-busy": "true",
479
+ "aria-label": w("botlit.common.loading", "Loading"),
480
+ className: _e("gap-4", O === "grid" ? "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3" : "flex flex-col"),
139
481
  children: [
140
482
  1,
141
483
  2,
@@ -143,190 +485,44 @@ var B = () => {
143
485
  4,
144
486
  5,
145
487
  6
146
- ].map((e) => /* @__PURE__ */ E("div", { className: "h-48 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }, e))
147
- }) : X ? /* @__PURE__ */ E(h, {
148
- resource: "agents",
149
- error: X,
150
- onRetry: () => void Z()
151
- }) : J.length > 0 ? W === "grid" ? /* @__PURE__ */ E("div", {
488
+ ].map((e) => /* @__PURE__ */ y("div", { className: "h-48 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }, e))
489
+ }) : Y ? /* @__PURE__ */ y(ne, {
490
+ resource: w("botlit.agentsList.resource", "agents"),
491
+ error: Y,
492
+ onRetry: () => {
493
+ P(), V.refetch(), B();
494
+ }
495
+ }) : Z.length > 0 ? O === "grid" ? /* @__PURE__ */ y("ul", {
152
496
  className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",
153
- children: J.map((e) => /* @__PURE__ */ E(o, {
154
- className: "group hover:shadow-md transition-shadow cursor-pointer relative",
155
- onClick: () => H(`agents/${e.id}`),
156
- children: /* @__PURE__ */ D(s, {
157
- className: "pt-6",
158
- children: [
159
- /* @__PURE__ */ D("div", {
160
- className: "flex items-start justify-between",
161
- children: [/* @__PURE__ */ D("div", {
162
- className: "flex items-center gap-3",
163
- children: [/* @__PURE__ */ E("span", {
164
- className: "text-4xl",
165
- children: "🤖"
166
- }), /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("h3", {
167
- className: "font-semibold text-text-primary",
168
- children: e.name
169
- }), /* @__PURE__ */ E("div", {
170
- className: "flex items-center gap-2 mt-1",
171
- children: /* @__PURE__ */ E(f, { status: e.status })
172
- })] })]
173
- }), /* @__PURE__ */ D("div", {
174
- className: "relative",
175
- children: [/* @__PURE__ */ E(c, {
176
- variant: "ghost",
177
- size: "icon",
178
- className: "opacity-0 group-hover:opacity-100 transition-opacity",
179
- onClick: (t) => {
180
- t.stopPropagation(), $(Q === e.id ? null : e.id);
181
- },
182
- children: /* @__PURE__ */ E(M, { size: 16 })
183
- }), Q === e.id && /* @__PURE__ */ D("div", {
184
- className: "absolute right-0 top-full mt-1 w-48 bg-popover border border-border-subtle rounded-md shadow-lg z-10",
185
- children: [
186
- /* @__PURE__ */ E(d, {
187
- permission: u.AGENT_EXECUTE,
188
- children: /* @__PURE__ */ D("button", {
189
- className: "w-full px-4 py-2 text-left text-sm hover:bg-accent flex items-center gap-2",
190
- onClick: (t) => {
191
- t.stopPropagation(), H(`agents/${e.id}/chat`), $(null);
192
- },
193
- children: [/* @__PURE__ */ E(N, { size: 16 }), B("botlit.agentsList.menu.testAgent", "Test Agent")]
194
- })
195
- }),
196
- /* @__PURE__ */ E(d, {
197
- permission: u.AGENT_UPDATE,
198
- children: /* @__PURE__ */ D("button", {
199
- className: "w-full px-4 py-2 text-left text-sm hover:bg-accent flex items-center gap-2",
200
- onClick: (t) => {
201
- t.stopPropagation(), H(`agents/${e.id}/edit`), $(null);
202
- },
203
- children: [/* @__PURE__ */ E(I, { size: 16 }), B("botlit.agentsList.menu.editAgent", "Edit Agent")]
204
- })
205
- }),
206
- /* @__PURE__ */ E(d, {
207
- permission: u.AGENT_DELETE,
208
- children: /* @__PURE__ */ D("button", {
209
- className: "w-full px-4 py-2 text-left text-sm hover:bg-accent text-status-error-text flex items-center gap-2",
210
- onClick: (t) => {
211
- t.stopPropagation(), se(e);
212
- },
213
- children: [/* @__PURE__ */ E(R, { size: 16 }), B("botlit.agentsList.menu.delete", "Delete")]
214
- })
215
- })
216
- ]
217
- })]
218
- })]
219
- }),
220
- /* @__PURE__ */ E("p", {
221
- className: "mt-3 text-sm text-text-secondary line-clamp-2",
222
- children: e.description
223
- }),
224
- /* @__PURE__ */ E("div", {
225
- className: "mt-4 flex items-center gap-4 text-xs text-text-secondary",
226
- children: /* @__PURE__ */ D("span", {
227
- className: "flex items-center gap-1",
228
- children: [
229
- /* @__PURE__ */ E(j, { size: 14 }),
230
- b(e.executionCount),
231
- " ",
232
- B("botlit.agentsList.card.executions", "executions")
233
- ]
234
- })
235
- }),
236
- /* @__PURE__ */ D("div", {
237
- className: "mt-3 pt-3 border-t border-border-subtle flex items-center justify-between",
238
- children: [/* @__PURE__ */ D("span", {
239
- className: "text-xs text-text-secondary",
240
- children: [
241
- B("botlit.agentsList.card.created", "Created"),
242
- " ",
243
- x(e.createdAt)
244
- ]
245
- }), /* @__PURE__ */ E(d, {
246
- permission: u.AGENT_EXECUTE,
247
- children: /* @__PURE__ */ E(c, {
248
- size: "sm",
249
- variant: "ghost",
250
- leftIcon: /* @__PURE__ */ E(N, { size: 14 }),
251
- onClick: (t) => {
252
- t.stopPropagation(), H(`agents/${e.id}/chat`);
253
- },
254
- children: B("botlit.agentsList.card.test", "Test")
255
- })
256
- })]
257
- })
258
- ]
259
- })
260
- }, e.id))
261
- }) : /* @__PURE__ */ E("div", {
497
+ children: Z.map((e) => ut(e, "grid"))
498
+ }) : /* @__PURE__ */ y("ul", {
262
499
  className: "space-y-2",
263
- children: J.map((e) => /* @__PURE__ */ E(o, {
264
- className: "hover:shadow-md transition-shadow cursor-pointer",
265
- onClick: () => H(`agents/${e.id}`),
266
- children: /* @__PURE__ */ E(s, {
267
- className: "py-4",
268
- children: /* @__PURE__ */ D("div", {
269
- className: "flex items-center justify-between",
270
- children: [/* @__PURE__ */ D("div", {
271
- className: "flex items-center gap-4",
272
- children: [/* @__PURE__ */ E("span", {
273
- className: "text-3xl",
274
- children: "🤖"
275
- }), /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ D("div", {
276
- className: "flex items-center gap-2",
277
- children: [/* @__PURE__ */ E("h3", {
278
- className: "font-semibold text-text-primary",
279
- children: e.name
280
- }), /* @__PURE__ */ E(f, { status: e.status })]
281
- }), /* @__PURE__ */ E("p", {
282
- className: "text-sm text-text-secondary line-clamp-1",
283
- children: e.description
284
- })] })]
285
- }), /* @__PURE__ */ D("div", {
286
- className: "flex items-center gap-4 text-sm text-text-secondary",
287
- children: [
288
- /* @__PURE__ */ D("span", { children: [b(e.executionCount), " executions"] }),
289
- /* @__PURE__ */ E("span", { children: x(e.createdAt) }),
290
- /* @__PURE__ */ E(d, {
291
- permission: u.AGENT_EXECUTE,
292
- children: /* @__PURE__ */ E(c, {
293
- variant: "outline",
294
- size: "sm",
295
- leftIcon: /* @__PURE__ */ E(N, { size: 14 }),
296
- children: /* @__PURE__ */ E(O, {
297
- to: U(`agents/${e.id}/chat`),
298
- children: "Test"
299
- })
300
- })
301
- })
302
- ]
303
- })]
304
- })
305
- })
306
- }, e.id))
307
- }) : /* @__PURE__ */ E(p, {
500
+ children: Z.map((e) => ut(e, "list"))
501
+ }) : Ze ? /* @__PURE__ */ y(f, {
308
502
  illustration: "empty-agents",
309
- title: B("botlit.agentsList.empty.title", "No agents yet"),
310
- description: B("botlit.agentsList.empty.description", "Create your first AI agent to start building intelligent automations."),
311
- action: /* @__PURE__ */ E(d, {
312
- permission: u.AGENT_CREATE,
313
- children: /* @__PURE__ */ E(c, {
314
- leftIcon: /* @__PURE__ */ E(P, { size: 16 }),
315
- onClick: () => H(V ? `bots/${V}/agents/new` : "agents/new"),
316
- children: B("botlit.agentsList.actions.createAgent", "Create Agent")
317
- })
503
+ title: q === "" ? w("botlit.agentsList.noResults.titleFiltered", "No agents match these filters") : w("botlit.agentsList.noResults.title", "No agents match \"{{query}}\"", { query: q }),
504
+ description: w("botlit.agentsList.noResults.description", "Check the spelling or try a different search term or status."),
505
+ action: /* @__PURE__ */ y(s, {
506
+ variant: "outline",
507
+ onClick: Qe,
508
+ children: w("botlit.agentsList.noResults.clear", "Clear search and filters")
318
509
  })
510
+ }) : /* @__PURE__ */ y(f, {
511
+ illustration: "empty-agents",
512
+ title: E ? w("botlit.agentsList.empty.titleBot", "No agents linked to this bot yet") : w("botlit.agentsList.empty.title", "No agents yet"),
513
+ description: E ? w("botlit.agentsList.empty.descriptionBot", "Link an existing agent above, or create a new one: it is linked to this bot automatically.") : w("botlit.agentsList.empty.description", "Create your first AI agent to start building intelligent automations."),
514
+ action: st
319
515
  }),
320
- /* @__PURE__ */ E(m, {
321
- hasMore: ne,
322
- loadingMore: re,
323
- onLoadMore: () => void ie(),
324
- loadedCount: J.length
516
+ /* @__PURE__ */ y(re, {
517
+ hasMore: F,
518
+ loadingMore: I,
519
+ onLoadMore: () => void L(),
520
+ loadedCount: M.length
325
521
  })
326
522
  ]
327
523
  })
328
524
  });
329
525
  };
330
- export { B as AgentsListPage };
526
+ export { w as AgentsListPage };
331
527
 
332
528
  //# sourceMappingURL=AgentsListPage.js.map