@burdenoff/microfe-botmanor 2026.1115.2 → 2026.1117.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 (53) 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/internal/workspaceGateway.js +33 -32
  11. package/dist/botlit/hooks/internal/workspaceGateway.js.map +1 -1
  12. package/dist/botlit/hooks/useAgents.d.ts +26 -3
  13. package/dist/botlit/hooks/useAgents.js +160 -110
  14. package/dist/botlit/hooks/useAgents.js.map +1 -1
  15. package/dist/botlit/hooks/useBotAgents.d.ts +35 -0
  16. package/dist/botlit/hooks/useBotAgents.js +95 -0
  17. package/dist/botlit/hooks/useBotAgents.js.map +1 -0
  18. package/dist/botlit/hooks/useBots.js +2 -2
  19. package/dist/botlit/hooks/useBots.js.map +1 -1
  20. package/dist/botlit/hooks/useKnowledgeBases.d.ts +13 -0
  21. package/dist/botlit/hooks/useKnowledgeBases.js +77 -58
  22. package/dist/botlit/hooks/useKnowledgeBases.js.map +1 -1
  23. package/dist/botlit/hooks/useMCPServers.js +53 -57
  24. package/dist/botlit/hooks/useMCPServers.js.map +1 -1
  25. package/dist/botlit/pages/AgentBuilderPage.js +848 -425
  26. package/dist/botlit/pages/AgentBuilderPage.js.map +1 -1
  27. package/dist/botlit/pages/AgentDetailPage.js +629 -518
  28. package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
  29. package/dist/botlit/pages/AgentsListPage.js +487 -291
  30. package/dist/botlit/pages/AgentsListPage.js.map +1 -1
  31. package/dist/botlit/pages/KnowledgeBaseDetailPage.js +519 -265
  32. package/dist/botlit/pages/KnowledgeBaseDetailPage.js.map +1 -1
  33. package/dist/botlit/pages/KnowledgeBasesPage.js +269 -130
  34. package/dist/botlit/pages/KnowledgeBasesPage.js.map +1 -1
  35. package/dist/botlit/types/index.d.ts +4 -1
  36. package/dist/botlit/utils/agentDelete.d.ts +5 -0
  37. package/dist/botlit/utils/agentDelete.js +15 -0
  38. package/dist/botlit/utils/agentDelete.js.map +1 -0
  39. package/dist/botlit/utils/agentSettings.d.ts +77 -0
  40. package/dist/botlit/utils/agentSettings.js +78 -0
  41. package/dist/botlit/utils/agentSettings.js.map +1 -0
  42. package/dist/botlit/utils/kbDelete.d.ts +5 -0
  43. package/dist/botlit/utils/kbDelete.js +11 -0
  44. package/dist/botlit/utils/kbDelete.js.map +1 -0
  45. package/dist/botlit/utils/kbSettings.d.ts +41 -0
  46. package/dist/botlit/utils/kbSettings.js +60 -0
  47. package/dist/botlit/utils/kbSettings.js.map +1 -0
  48. package/dist/generated/wspace-operations.d.ts +75 -0
  49. package/dist/generated/wspace-operations.js +60 -48
  50. package/dist/generated/wspace-operations.js.map +1 -1
  51. package/dist/generated/wspace-types.d.ts +66 -0
  52. package/dist/generated/wspace-types.js.map +1 -1
  53. package/package.json +1 -1
@@ -1,22 +1,34 @@
1
- import { useBotlit as e } from "../providers/BotlitProvider.js";
2
- import { PageLayout as t } from "../components/PageLayout.js";
3
- import { Card as n, CardContent as r, CardDescription as i, CardHeader as a, CardTitle as o } from "../components/Card.js";
4
- import { Button as s } from "../components/Button.js";
5
- import { FormField as c, Input as l, Textarea as u } from "../components/Input.js";
6
- import { useAgent as d, useCreateAgent as f, useUpdateAgent as p } from "../hooks/useAgents.js";
7
- import { useBots as m } from "../hooks/useBots.js";
8
- import { useLLMModels as ee, useLLMProviders as te } from "../hooks/useLLMProviders.js";
9
- import { cn as h } from "../utils/cn.js";
10
- import { toUnion as g } from "../utils/unions.js";
11
- import { configuredAnswerModels as ne } from "../utils/embedding-models.js";
12
- import { useEffect as re, useState as _ } from "react";
13
- import { PagePurpose as ie } from "@burdenoff/fe-libs/ui";
14
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
15
- import { useParams as b } from "react-router";
16
- import { ArrowLeft as ae, Brain as oe, Save as x, Settings as se, Sparkles as S, Wrench as C } from "lucide-react";
17
- import { toast as w } from "sonner";
1
+ import { useTr as e } from "../../shared/hooks/useTr.js";
2
+ import { useBotlit as t } from "../providers/BotlitProvider.js";
3
+ import { PageLayout as n } from "../components/PageLayout.js";
4
+ import { Card as r, CardContent as i, CardDescription as a, CardHeader as o, CardTitle as s } from "../components/Card.js";
5
+ import { Button as c } from "../components/Button.js";
6
+ import { EmojiPicker as l } from "../components/EmojiPicker.js";
7
+ import { EmptyState as u } from "../components/EmptyState.js";
8
+ import { ErrorState as d } from "../components/ErrorState.js";
9
+ import { BOTMANOR_PERMISSIONS as f } from "../permissions/botmanorPermissions.js";
10
+ import { useBotmanorCan as ee } from "../permissions/useBotmanorPermissions.js";
11
+ import { FormField as p, Input as m, Textarea as h } from "../components/Input.js";
12
+ import { useAgent as g, useCreateAgent as te, useUpdateAgent as ne } from "../hooks/useAgents.js";
13
+ import { useBot as re, useUpdateBot as ie } from "../hooks/useBots.js";
14
+ import { useLinkAgentToBot as ae } from "../hooks/useBotAgents.js";
15
+ import { useKnowledgeBases as oe } from "../hooks/useKnowledgeBases.js";
16
+ import { useLLMModels as se, useLLMProviders as ce } from "../hooks/useLLMProviders.js";
17
+ import { useMCPServers as le } from "../hooks/useMCPServers.js";
18
+ import { AGENT_DEFAULTS as _, AGENT_FIELD_MESSAGES as ue, AGENT_FIELD_TAB as v, AGENT_MAX_CONCURRENT_RANGE as y, AGENT_MAX_TOKENS_RANGE as b, AGENT_TEMPERATURE_RANGE as x, OFFERED_CAPABILITIES as de, agentSlugFor as fe, capabilityWarnings as pe, parseNumberField as S, validateAgentForm as me } from "../utils/agentSettings.js";
19
+ import "../permissions/index.js";
20
+ import { cn as he } from "../utils/cn.js";
21
+ import { configuredAnswerModels as ge } from "../utils/embedding-models.js";
22
+ import { slugify as _e } from "../utils/botIdentity.js";
23
+ import { toUnion as ve } from "../utils/unions.js";
24
+ import { useMemo as ye, useRef as be, useState as C } from "react";
25
+ import { PagePurpose as xe } from "@burdenoff/fe-libs/ui";
26
+ import { jsx as w, jsxs as T } from "react/jsx-runtime";
27
+ import { useParams as E } from "react-router";
28
+ import { AlertTriangle as D, ArrowLeft as Se, Brain as Ce, Save as we, Settings as Te, Sparkles as Ee, Wrench as De } from "lucide-react";
29
+ import { toast as O } from "sonner";
18
30
  // src/botlit/pages/AgentBuilderPage.tsx
19
- var T = [
31
+ var k = [
20
32
  "MCP_TOOLS",
21
33
  "RAG",
22
34
  "REASONING",
@@ -25,484 +37,895 @@ var T = [
25
37
  "CODE_EXECUTION",
26
38
  "A2A",
27
39
  "WEB_BROWSING"
28
- ], E = [
40
+ ], Oe = [
29
41
  "ASSISTANT",
30
42
  "ANALYST",
31
43
  "AUTOMATION",
32
44
  "SPECIALIST"
33
45
  ];
34
- function D(e) {
46
+ function ke(e) {
35
47
  return e.flatMap((e) => {
36
- let t = T.find((t) => t === e);
48
+ let t = k.find((t) => t === e);
37
49
  return t ? [t] : [];
38
50
  });
39
51
  }
40
- function O(e) {
41
- return g(e, E, "ASSISTANT");
42
- }
43
- var k = () => {
44
- let { agentId: g } = b(), { navigateTo: T, workspaceId: E } = e(), { data: k } = d(g), { data: A } = m(), { data: j, loading: ce, error: M, refetch: N } = te(), { data: P, loading: F, error: I, refetch: L } = ee(), R = ce || F, z = M || I, B = ne(P ?? [], j ?? []), [V, H] = f(), [U, W] = p(), G = !!g, [K, q] = _(0), [J, Y] = _({
52
+ var A = "🤖", Ae = [
53
+ {
54
+ emoji: "🤖",
55
+ key: "robot",
56
+ label: "Robot"
57
+ },
58
+ {
59
+ emoji: "🧠",
60
+ key: "brain",
61
+ label: "Brain"
62
+ },
63
+ {
64
+ emoji: "💡",
65
+ key: "idea",
66
+ label: "Light bulb"
67
+ },
68
+ {
69
+ emoji: "🎯",
70
+ key: "target",
71
+ label: "Target"
72
+ },
73
+ {
74
+ emoji: "🔧",
75
+ key: "wrench",
76
+ label: "Wrench"
77
+ },
78
+ {
79
+ emoji: "📊",
80
+ key: "chart",
81
+ label: "Chart"
82
+ },
83
+ {
84
+ emoji: "🎧",
85
+ key: "headset",
86
+ label: "Headset"
87
+ },
88
+ {
89
+ emoji: "💼",
90
+ key: "briefcase",
91
+ label: "Briefcase"
92
+ },
93
+ {
94
+ emoji: "🔍",
95
+ key: "magnifier",
96
+ label: "Magnifying glass"
97
+ },
98
+ {
99
+ emoji: "⚡",
100
+ key: "lightning",
101
+ label: "Lightning"
102
+ },
103
+ {
104
+ emoji: "🌟",
105
+ key: "star",
106
+ label: "Star"
107
+ },
108
+ {
109
+ emoji: "🚀",
110
+ key: "rocket",
111
+ label: "Rocket"
112
+ }
113
+ ], j = "You are a helpful AI assistant. Be concise, accurate, and friendly.", M = [
114
+ "basics",
115
+ "prompt",
116
+ "model",
117
+ "tools"
118
+ ];
119
+ function je(e) {
120
+ return e ? {
121
+ name: e.name,
122
+ slug: e.slug,
123
+ description: e.description ?? "",
124
+ avatar: e.avatar || A,
125
+ type: e.type || "ASSISTANT",
126
+ systemPrompt: e.systemPrompt ?? "",
127
+ temperature: e.temperature == null ? "" : String(e.temperature),
128
+ maxTokens: e.maxTokens == null ? "" : String(e.maxTokens),
129
+ maxConcurrentExecutions: e.maxConcurrentExecutions == null ? "" : String(e.maxConcurrentExecutions),
130
+ llmModelId: e.llmModelId ?? "",
131
+ capabilities: [...e.capabilities ?? []],
132
+ knowledgeBaseIds: [...e.knowledgeBaseIds ?? []],
133
+ mcpConnectionIds: [...e.mcpConnectionIds ?? []]
134
+ } : {
45
135
  name: "",
46
136
  slug: "",
47
137
  description: "",
48
- avatar: "🤖",
49
- tags: [],
50
- systemPrompt: "You are a helpful AI assistant. Be concise, accurate, and friendly.",
51
- temperature: "0.7",
52
- maxTokens: "2048",
138
+ avatar: A,
53
139
  type: "ASSISTANT",
54
- status: "DRAFT",
55
- capabilities: ["MCP_TOOLS", "REASONING"],
56
- llmModelId: ""
57
- });
58
- re(() => {
59
- if (k) {
60
- let e = k;
61
- Y({
62
- name: e.name,
63
- slug: e.slug,
64
- description: e.description || "",
65
- avatar: "🤖",
66
- tags: e.tagIds || [],
67
- systemPrompt: e.systemPrompt || "",
68
- temperature: String(e.temperature ?? .7),
69
- maxTokens: String(e.maxTokens ?? 2048),
70
- type: e.type || "ASSISTANT",
71
- status: e.status || "DRAFT",
72
- capabilities: e.capabilities || [],
73
- llmModelId: e.llmModelId || ""
74
- });
75
- }
76
- }, [k]);
77
- let X = [
140
+ systemPrompt: j,
141
+ temperature: "",
142
+ maxTokens: "",
143
+ maxConcurrentExecutions: "",
144
+ llmModelId: "",
145
+ capabilities: [],
146
+ knowledgeBaseIds: [],
147
+ mcpConnectionIds: []
148
+ };
149
+ }
150
+ var Me = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm", N = () => {
151
+ let r = e(), { agentId: i, botId: a } = E(), { navigateTo: o } = t(), { data: s, loading: l, error: f, refetch: ee } = g(i);
152
+ return i ? l ? /* @__PURE__ */ w(n, {
153
+ title: r("botlit.agentBuilder.editTitle", "Edit Agent"),
154
+ children: /* @__PURE__ */ w("div", {
155
+ role: "status",
156
+ "aria-busy": "true",
157
+ "aria-label": r("botlit.common.loading", "Loading..."),
158
+ className: "h-96 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg"
159
+ })
160
+ }) : f ? /* @__PURE__ */ w(n, {
161
+ title: r("botlit.agentBuilder.editTitle", "Edit Agent"),
162
+ children: /* @__PURE__ */ w(d, {
163
+ resource: r("botlit.agentBuilder.resource", "this agent"),
164
+ error: f,
165
+ onRetry: () => void ee()
166
+ })
167
+ }) : s ? /* @__PURE__ */ w(P, {
168
+ agent: s,
169
+ botId: a
170
+ }, s.id) : /* @__PURE__ */ w(n, {
171
+ title: r("botlit.agentDetail.notFound.title", "Agent Not Found"),
172
+ children: /* @__PURE__ */ w(u, {
173
+ illustration: "empty-agents",
174
+ title: r("botlit.agentDetail.notFound.title", "Agent Not Found"),
175
+ description: r("botlit.agentDetail.notFound.description", "The agent you're looking for doesn't exist."),
176
+ action: /* @__PURE__ */ w(c, {
177
+ onClick: () => o(a ? `bots/${a}/agents` : "agents"),
178
+ children: r("botlit.agentDetail.notFound.backAction", "Back to Agents")
179
+ })
180
+ })
181
+ }) : /* @__PURE__ */ w(P, { botId: a });
182
+ }, P = ({ agent: u, botId: g }) => {
183
+ let E = e(), { navigateTo: k, workspaceId: A } = t(), j = !!u, N = g ? `bots/${g}/agents` : "agents", P = u ? `${N}/${u.id}` : N, [F, Pe] = C(() => je(u)), [I, Fe] = C("basics"), [L, Ie] = C(!1), Le = be({}), [Re, ze] = te(), [Be, Ve] = ne(), [He] = ae(), [Ue] = ie(), { data: We, loading: Ge, error: R, refetch: Ke } = re(g), qe = ee(), z = ze.loading || Ve.loading, B = !!g && !u, { data: V, loading: Je, error: Ye, refetch: Xe } = ce(), { data: Ze, loading: Qe, error: $e, refetch: et } = se(), H = Je || Qe, U = Ye || $e, W = ge(Ze ?? [], V ?? []), { data: G, loading: tt, error: nt, refetch: rt } = oe(), { data: it, loading: at, error: ot, refetch: st } = le(), K = ye(() => me(F), [F]), ct = Object.keys(K).length, lt = (e) => L && Object.keys(K).some((t) => v[t] === e), q = pe({
184
+ capabilities: F.capabilities,
185
+ mcpServerCount: F.mcpConnectionIds.length,
186
+ knowledgeBaseCount: F.knowledgeBaseIds.length
187
+ }), ut = F.llmModelId === "", J = (e, t) => Pe((n) => ({
188
+ ...n,
189
+ [e]: t
190
+ })), Y = (e, t) => Pe((n) => ({
191
+ ...n,
192
+ [e]: n[e].includes(t) ? n[e].filter((e) => e !== t) : [...n[e], t]
193
+ })), X = (e) => {
194
+ let t = L ? K[e] : void 0;
195
+ if (t) return E(`botlit.agentBuilder.errors.${t}`, ue[t]);
196
+ }, Z = (e) => `agent-form-${e}`, Q = (e) => {
197
+ Fe(e), Le.current[e]?.focus();
198
+ }, dt = (e, t) => {
199
+ let n = M.length - 1, r = e.key === "ArrowRight" ? (t + 1) % M.length : e.key === "ArrowLeft" ? (t - 1 + M.length) % M.length : e.key === "Home" ? 0 : e.key === "End" ? n : void 0;
200
+ r !== void 0 && (e.preventDefault(), Q(M[r]));
201
+ }, ft = [
78
202
  {
79
- id: 0,
80
- label: "Basic Info",
81
- icon: /* @__PURE__ */ v(S, { size: 18 })
203
+ id: "basics",
204
+ label: E("botlit.agentBuilder.tabs.basics", "Basic Info"),
205
+ icon: /* @__PURE__ */ w(Ee, { size: 18 })
82
206
  },
83
207
  {
84
- id: 1,
85
- label: "Prompt",
86
- icon: /* @__PURE__ */ v(oe, { size: 18 })
208
+ id: "prompt",
209
+ label: E("botlit.agentBuilder.tabs.prompt", "Prompt"),
210
+ icon: /* @__PURE__ */ w(Ce, { size: 18 })
87
211
  },
88
212
  {
89
- id: 2,
90
- label: "LLM Model",
91
- icon: /* @__PURE__ */ v(se, { size: 18 })
213
+ id: "model",
214
+ label: E("botlit.agentBuilder.tabs.model", "LLM Model"),
215
+ icon: /* @__PURE__ */ w(Te, { size: 18 })
92
216
  },
93
217
  {
94
- id: 3,
95
- label: "Tools & Knowledge",
96
- icon: /* @__PURE__ */ v(C, { size: 18 })
218
+ id: "tools",
219
+ label: E("botlit.agentBuilder.tabs.tools", "Tools & Knowledge"),
220
+ icon: /* @__PURE__ */ w(De, { size: 18 })
97
221
  }
98
- ], le = [
99
- "🤖",
100
- "🧠",
101
- "💡",
102
- "🎯",
103
- "🔧",
104
- "📊",
105
- "🎧",
106
- "💼",
107
- "🔍",
108
- "⚡",
109
- "🌟",
110
- "🚀"
111
- ], ue = [
112
- {
113
- key: "MCP_TOOLS",
114
- label: "MCP Tools",
115
- description: "Can use MCP tool servers"
116
- },
117
- {
118
- key: "RAG",
119
- label: "RAG",
120
- description: "Retrieval-augmented generation"
121
- },
122
- {
123
- key: "REASONING",
124
- label: "Reasoning",
125
- description: "Advanced reasoning"
126
- },
127
- {
128
- key: "MULTIMODAL",
129
- label: "Multimodal",
130
- description: "Process images & media"
131
- },
132
- {
133
- key: "MEMORY",
134
- label: "Memory",
135
- description: "Conversation memory"
136
- },
137
- {
138
- key: "CODE_EXECUTION",
139
- label: "Code Execution",
140
- description: "Execute code"
141
- },
142
- {
143
- key: "A2A",
144
- label: "A2A",
145
- description: "Agent-to-agent protocol"
146
- },
147
- {
148
- key: "WEB_BROWSING",
149
- label: "Web Browsing",
150
- description: "Browse the web"
222
+ ], pt = async (e) => {
223
+ if (e.preventDefault(), z || B && Ge) return;
224
+ if (B && R) {
225
+ O.error(E("botlit.agentBuilder.botUnavailable", "The bot could not be read, so the agent cannot be linked to it yet. Try again."));
226
+ return;
151
227
  }
152
- ], de = (e) => {
153
- Y((t) => ({
154
- ...t,
155
- capabilities: t.capabilities.includes(e) ? t.capabilities.filter((t) => t !== e) : [...t.capabilities, e]
156
- }));
157
- }, Z = async () => {
158
- if (J.llmModelId && (R || z || !B.some((e) => e.id === J.llmModelId))) {
159
- w.error("Choose an active answer model from the available catalog.");
228
+ if (!A) {
229
+ O.error(E("botlit.agentBuilder.noWorkspace", "No workspace is selected yet. Wait for it to load, or pick a workspace, then save again."));
160
230
  return;
161
231
  }
162
- let e = J.slug || J.name.toLowerCase().replace(/\s+/g, "-");
232
+ if (ct > 0) {
233
+ Ie(!0);
234
+ let e = M.find((e) => Object.keys(K).some((t) => v[t] === e));
235
+ e && Q(e);
236
+ return;
237
+ }
238
+ let t = F.llmModelId !== (u?.llmModelId ?? "");
239
+ if (F.llmModelId && t) {
240
+ if (H) {
241
+ O.error(E("botlit.agentBuilder.modelLoading", "The model list is still loading. Try again in a moment.")), Q("model");
242
+ return;
243
+ }
244
+ if (U || !W.some((e) => e.id === F.llmModelId)) {
245
+ O.error(E("botlit.agentBuilder.modelUnavailable", "Choose an active answer model from the available catalog.")), Q("model");
246
+ return;
247
+ }
248
+ }
249
+ let n = F.name.trim(), r = fe(n, F.slug), i = S(F.temperature), a = S(F.maxTokens), o = S(F.maxConcurrentExecutions), s = F.description.trim(), c = ve(F.type, Oe, "ASSISTANT"), l = ke(F.capabilities);
163
250
  try {
164
- if (G && g) await U({
165
- agentId: g,
166
- input: {
167
- name: J.name,
168
- slug: e,
169
- description: J.description || void 0,
170
- systemPrompt: J.systemPrompt,
171
- temperature: parseFloat(J.temperature) || .7,
172
- maxTokens: parseInt(J.maxTokens) || 2048,
173
- capabilities: D(J.capabilities),
174
- llmModelId: J.llmModelId || void 0,
175
- type: O(J.type)
251
+ if (u) {
252
+ await Be({
253
+ agentId: u.id,
254
+ input: {
255
+ name: n,
256
+ slug: r,
257
+ description: s === "" ? null : s,
258
+ avatar: F.avatar,
259
+ systemPrompt: F.systemPrompt.trim(),
260
+ temperature: i ?? null,
261
+ maxTokens: a ?? null,
262
+ maxConcurrentExecutions: o ?? null,
263
+ capabilities: l,
264
+ llmModelId: F.llmModelId === "" ? null : F.llmModelId,
265
+ knowledgeBaseIds: F.knowledgeBaseIds,
266
+ mcpConnectionIds: F.mcpConnectionIds,
267
+ type: c
268
+ }
269
+ }), O.success(E("botlit.agentBuilder.updated", "Agent \"{{name}}\" updated successfully", { name: n })), k(P);
270
+ return;
271
+ }
272
+ let e = await Re({
273
+ workspaceId: A,
274
+ name: n,
275
+ slug: r,
276
+ type: c,
277
+ description: s === "" ? void 0 : s,
278
+ avatar: F.avatar,
279
+ systemPrompt: F.systemPrompt.trim(),
280
+ temperature: i,
281
+ maxTokens: a,
282
+ maxConcurrentExecutions: o,
283
+ capabilities: l,
284
+ llmModelId: F.llmModelId === "" ? void 0 : F.llmModelId,
285
+ knowledgeBaseIds: F.knowledgeBaseIds,
286
+ mcpConnectionIds: F.mcpConnectionIds
287
+ });
288
+ if (O.success(E("botlit.agentBuilder.created", "Agent \"{{name}}\" created successfully", { name: n })), g) {
289
+ if (!qe(f.APP_AGENT_CREATE)) {
290
+ O.error(E("botlit.agentBuilder.linkNotAllowed", "The agent was created, but you are not allowed to link agents to bots, so it is not linked.")), k(`agents/${e.id}`);
291
+ return;
292
+ }
293
+ try {
294
+ await He({
295
+ botId: g,
296
+ agentId: e.id
297
+ });
298
+ } catch (t) {
299
+ O.error(t instanceof Error ? E("botlit.agentBuilder.linkFailed", "The agent was created but could not be linked to the bot: {{message}}", { message: t.message }) : E("botlit.agentBuilder.linkFailedShort", "The agent was created but could not be linked to the bot")), k(`agents/${e.id}`);
300
+ return;
176
301
  }
177
- }), w.success(`Agent "${J.name}" updated successfully`), T(`agents/${g}`);
178
- else {
179
- if (!E) return;
180
- let t = await V({
181
- workspaceId: E,
182
- name: J.name,
183
- slug: e,
184
- type: O(J.type),
185
- systemPrompt: J.systemPrompt,
186
- temperature: parseFloat(J.temperature) || .7,
187
- maxTokens: parseInt(J.maxTokens) || 2048,
188
- capabilities: D(J.capabilities),
189
- llmModelId: J.llmModelId || void 0,
190
- description: J.description || void 0
191
- });
192
- w.success(`Agent "${J.name}" created successfully`), t?.id && T(`agents/${t.id}`);
302
+ if (We && !We.defaultAgentId && qe(f.APP_UPDATE)) try {
303
+ await Ue({
304
+ botId: g,
305
+ input: { defaultAgentId: e.id }
306
+ });
307
+ } catch (e) {
308
+ O.error(e instanceof Error ? E("botlit.agentBuilder.defaultFailed", "The agent was linked, but it could not be set as the bot default: {{message}}", { message: e.message }) : E("botlit.agentBuilder.defaultFailedShort", "The agent was linked, but it could not be set as the bot default"));
309
+ }
310
+ k(`bots/${g}/agents`);
311
+ return;
193
312
  }
313
+ k(`agents/${e.id}`);
194
314
  } catch (e) {
195
- let t = e instanceof Error ? e.message : "Failed to save agent";
196
- w.error(t);
315
+ O.error(e instanceof Error ? e.message : E("botlit.agentBuilder.saveFailed", "Failed to save agent"));
316
+ }
317
+ }, $ = j ? E("botlit.agentBuilder.save", "Save Changes") : E("botlit.agentBuilder.create", "Create Agent"), mt = (e) => {
318
+ switch (e) {
319
+ case "mcpToolsNeedsServer": return E("botlit.agentBuilder.warnings.mcpToolsNeedsServer", "MCP Tools is on but no MCP server is attached, so the agent has no tools. Attach a server on the Tools & Knowledge tab or turn it off.");
320
+ case "ragNeedsKnowledgeBase": return E("botlit.agentBuilder.warnings.ragNeedsKnowledgeBase", "RAG is on but no knowledge base is attached, so nothing is retrieved. Attach a knowledge base or turn it off.");
321
+ case "serversNeedMcpTools": return E("botlit.agentBuilder.warnings.serversNeedMcpTools", "MCP servers are attached but MCP Tools is off, so the agent ignores them. Turn MCP Tools on or detach the servers.");
322
+ case "knowledgeBasesNeedRag": return E("botlit.agentBuilder.warnings.knowledgeBasesNeedRag", "Knowledge bases are attached but RAG is off, so the agent ignores them. Turn RAG on or detach them.");
323
+ }
324
+ }, ht = {
325
+ MCP_TOOLS: {
326
+ label: E("botlit.agentBuilder.capabilities.mcpTools", "MCP Tools"),
327
+ description: E("botlit.agentBuilder.capabilities.mcpToolsDescription", "Let the agent call the tools of the MCP servers attached below.")
328
+ },
329
+ RAG: {
330
+ label: E("botlit.agentBuilder.capabilities.rag", "RAG"),
331
+ description: E("botlit.agentBuilder.capabilities.ragDescription", "Answer from the knowledge bases attached below (retrieval-augmented generation).")
332
+ },
333
+ A2A: {
334
+ label: E("botlit.agentBuilder.capabilities.a2a", "Agent delegation"),
335
+ description: E("botlit.agentBuilder.capabilities.a2aDescription", "Let the agent hand sub-tasks to other agents it is connected to.")
197
336
  }
198
- }, Q = H.loading, $ = W.loading;
199
- return /* @__PURE__ */ y(t, {
200
- title: /* @__PURE__ */ y("div", {
201
- className: "flex items-center gap-3",
202
- children: [/* @__PURE__ */ v(s, {
203
- variant: "ghost",
204
- size: "icon",
205
- onClick: () => T(g ? `agents/${g}` : "agents"),
206
- children: /* @__PURE__ */ v(ae, { size: 20 })
207
- }), /* @__PURE__ */ v("span", { children: G ? "Edit Agent" : "Create New Agent" })]
337
+ }, gt = F.capabilities.filter((e) => !de.includes(e)), _t = new Set(G.map((e) => e.id)), vt = new Set(it.map((e) => e.id)), yt = F.knowledgeBaseIds.filter((e) => !_t.has(e)), bt = G.filter((e) => F.knowledgeBaseIds.includes(e.id) && e.indexStatus !== "READY"), xt = F.mcpConnectionIds.filter((e) => !vt.has(e)), St = F.llmModelId !== "" && !H && !U && !W.some((e) => e.id === F.llmModelId);
338
+ return /* @__PURE__ */ w(n, {
339
+ title: j ? E("botlit.agentBuilder.editTitle", "Edit Agent") : E("botlit.agentBuilder.createTitle", "Create New Agent"),
340
+ leading: /* @__PURE__ */ w(c, {
341
+ variant: "ghost",
342
+ size: "icon",
343
+ "aria-label": E("botlit.agentBuilder.back", "Back"),
344
+ onClick: () => k(P),
345
+ children: /* @__PURE__ */ w(Se, {
346
+ size: 20,
347
+ "aria-hidden": "true"
348
+ })
208
349
  }),
209
- actions: /* @__PURE__ */ y("div", {
350
+ actions: /* @__PURE__ */ T("div", {
210
351
  className: "flex gap-2",
211
- children: [/* @__PURE__ */ v(s, {
352
+ children: [/* @__PURE__ */ w(c, {
212
353
  variant: "outline",
213
- onClick: () => T(g ? `agents/${g}` : "agents"),
214
- children: "Cancel"
215
- }), /* @__PURE__ */ v(s, {
216
- leftIcon: /* @__PURE__ */ v(x, { size: 16 }),
217
- onClick: Z,
218
- isLoading: Q || $,
219
- disabled: !J.name || !J.systemPrompt,
220
- children: G ? "Save Changes" : "Create Agent"
354
+ onClick: () => k(P),
355
+ children: E("botlit.common.cancel", "Cancel")
356
+ }), /* @__PURE__ */ w(c, {
357
+ type: "submit",
358
+ form: "agent-builder-form",
359
+ leftIcon: /* @__PURE__ */ w(we, { size: 16 }),
360
+ isLoading: z || B && Ge,
361
+ children: $
221
362
  })]
222
363
  }),
223
- children: [/* @__PURE__ */ y("div", {
364
+ children: /* @__PURE__ */ T("form", {
365
+ id: "agent-builder-form",
366
+ onSubmit: (e) => void pt(e),
367
+ noValidate: !0,
224
368
  className: "max-w-4xl mx-auto",
225
369
  children: [
226
- /* @__PURE__ */ v(ie, {
370
+ /* @__PURE__ */ w(xe, {
227
371
  className: "mb-6",
228
- icon: /* @__PURE__ */ v(S, { size: 18 }),
229
- children: "This guided builder walks you through everything an agent needs — its identity and system prompt, the model and parameters it runs on, and the tools and knowledge it can reach. Work through the steps, then create the agent and test it in chat. You can come back and edit any step later."
372
+ icon: /* @__PURE__ */ w(Ee, { size: 18 }),
373
+ children: E("botlit.agentBuilder.purpose", "This guided builder walks you through everything an agent needs: its identity and system prompt, the model and settings it runs on, and the tools and knowledge it can reach. Work through the steps, then save the agent and test it in chat. You can come back and edit any step later.")
374
+ }),
375
+ B && R && /* @__PURE__ */ w("div", {
376
+ role: "alert",
377
+ className: "mb-4",
378
+ children: /* @__PURE__ */ w(d, {
379
+ resource: E("botlit.agentBuilder.botResource", "this bot"),
380
+ error: R,
381
+ onRetry: () => void Ke()
382
+ })
230
383
  }),
231
- /* @__PURE__ */ v("div", {
232
- className: "flex items-center justify-between mb-8",
233
- children: X.map((e) => /* @__PURE__ */ y("button", {
234
- onClick: () => q(e.id),
235
- className: h("flex items-center gap-2 px-4 py-2 rounded-lg transition-colors", K === e.id ? "bg-action-primary-bg text-action-primary-text" : "bg-bg-sunken text-text-secondary hover:bg-accent"),
236
- children: [e.icon, /* @__PURE__ */ v("span", {
237
- className: "font-medium",
238
- children: e.label
239
- })]
240
- }, e.id))
384
+ !A && /* @__PURE__ */ w("p", {
385
+ role: "status",
386
+ className: "mb-4 text-sm text-text-secondary",
387
+ children: E("botlit.agentBuilder.noWorkspace", "No workspace is selected yet. Wait for it to load, or pick a workspace, then save again.")
241
388
  }),
242
- /* @__PURE__ */ y("div", {
389
+ L && ct > 0 && /* @__PURE__ */ T("div", {
390
+ role: "alert",
391
+ className: "mb-4 flex items-start gap-2 rounded-lg border border-status-error-border bg-status-error-bg-subtle p-3 text-sm text-text-primary",
392
+ children: [/* @__PURE__ */ w(D, {
393
+ size: 16,
394
+ className: "mt-0.5 text-status-error-text",
395
+ "aria-hidden": "true"
396
+ }), /* @__PURE__ */ w("p", { children: E("botlit.agentBuilder.errorSummary", "Fix the highlighted fields before saving. Tabs with a problem are marked.") })]
397
+ }),
398
+ /* @__PURE__ */ w("div", {
399
+ role: "tablist",
400
+ "aria-label": E("botlit.agentBuilder.stepsLabel", "Agent setup steps"),
401
+ className: "mb-8 flex flex-wrap items-center gap-2",
402
+ children: ft.map((e, t) => {
403
+ let n = I === e.id, r = lt(e.id);
404
+ return /* @__PURE__ */ T("button", {
405
+ ref: (t) => {
406
+ Le.current[e.id] = t;
407
+ },
408
+ type: "button",
409
+ role: "tab",
410
+ id: `agent-tab-${e.id}`,
411
+ "aria-selected": n,
412
+ "aria-controls": `agent-panel-${e.id}`,
413
+ tabIndex: n ? 0 : -1,
414
+ onClick: () => Fe(e.id),
415
+ onKeyDown: (e) => dt(e, t),
416
+ className: he("flex items-center gap-2 rounded-lg px-4 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary", n ? "bg-action-primary-bg text-action-primary-text" : "bg-bg-sunken text-text-secondary hover:bg-accent", r && "ring-2 ring-status-error-border"),
417
+ children: [
418
+ e.icon,
419
+ /* @__PURE__ */ w("span", {
420
+ className: "font-medium",
421
+ children: e.label
422
+ }),
423
+ r && /* @__PURE__ */ T("span", {
424
+ className: "text-status-error-text",
425
+ children: [/* @__PURE__ */ w(D, {
426
+ size: 14,
427
+ "aria-hidden": "true"
428
+ }), /* @__PURE__ */ w("span", {
429
+ className: "sr-only",
430
+ children: E("botlit.agentBuilder.tabHasProblem", "This step has a problem")
431
+ })]
432
+ })
433
+ ]
434
+ }, e.id);
435
+ })
436
+ }),
437
+ /* @__PURE__ */ T("div", {
243
438
  className: "space-y-6",
244
439
  children: [
245
- K === 0 && /* @__PURE__ */ y(n, {
246
- treatment: "glass",
247
- glow: !0,
248
- children: [/* @__PURE__ */ y(a, { children: [/* @__PURE__ */ v(o, { children: "Basic Information" }), /* @__PURE__ */ v(i, { children: "Set up the agent's identity and purpose" })] }), /* @__PURE__ */ y(r, {
249
- className: "space-y-6",
250
- children: [
251
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
252
- className: "text-sm font-medium",
253
- children: "Avatar"
254
- }), /* @__PURE__ */ v("div", {
255
- className: "flex gap-2 mt-2 flex-wrap",
256
- children: le.map((e) => /* @__PURE__ */ v("button", {
257
- onClick: () => Y({
258
- ...J,
259
- avatar: e
260
- }),
261
- className: h("text-3xl p-2 rounded-lg border-2 transition-colors", J.avatar === e ? "border-primary bg-action-primary-bg/10" : "border-border-subtle hover:border-primary/50"),
262
- children: e
263
- }, e))
264
- })] }),
265
- /* @__PURE__ */ v(c, {
266
- label: "Agent Name",
267
- required: !0,
268
- children: /* @__PURE__ */ v(l, {
269
- placeholder: "e.g., Customer Support Agent",
270
- value: J.name,
271
- onChange: (e) => Y({
272
- ...J,
273
- name: e.target.value
440
+ /* @__PURE__ */ w("div", {
441
+ role: "tabpanel",
442
+ id: "agent-panel-basics",
443
+ "aria-labelledby": "agent-tab-basics",
444
+ hidden: I !== "basics",
445
+ children: /* @__PURE__ */ T(r, {
446
+ treatment: "glass",
447
+ glow: !0,
448
+ children: [/* @__PURE__ */ T(o, { children: [/* @__PURE__ */ w(s, { children: E("botlit.agentBuilder.basics.title", "Basic Information") }), /* @__PURE__ */ w(a, { children: E("botlit.agentBuilder.basics.description", "Set up the agent's identity and purpose") })] }), /* @__PURE__ */ T(i, {
449
+ className: "space-y-6",
450
+ children: [
451
+ /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("p", {
452
+ className: "mb-2 text-sm font-medium",
453
+ children: E("botlit.agentBuilder.avatar", "Avatar")
454
+ }), /* @__PURE__ */ w(l, {
455
+ value: F.avatar,
456
+ onChange: (e) => J("avatar", e),
457
+ choices: Ae,
458
+ groupLabel: E("botlit.agentBuilder.avatar", "Avatar"),
459
+ optionLabel: (e) => E(`botlit.agentBuilder.avatars.${e.key}`, e.label),
460
+ currentLabel: E("botlit.agentBuilder.avatars.current", "Current avatar")
461
+ })] }),
462
+ /* @__PURE__ */ w(p, {
463
+ label: E("botlit.agentBuilder.name", "Agent Name"),
464
+ required: !0,
465
+ htmlFor: Z("name"),
466
+ error: X("name"),
467
+ children: /* @__PURE__ */ w(m, {
468
+ id: Z("name"),
469
+ required: !0,
470
+ "aria-invalid": X("name") ? !0 : void 0,
471
+ "aria-describedby": X("name") ? `${Z("name")}-error` : void 0,
472
+ maxLength: 120,
473
+ placeholder: E("botlit.agentBuilder.namePlaceholder", "e.g., Customer Support Agent"),
474
+ value: F.name,
475
+ onChange: (e) => J("name", e.target.value)
274
476
  })
275
- })
276
- }),
277
- /* @__PURE__ */ v(c, {
278
- label: "Slug",
279
- description: "URL-friendly identifier",
280
- children: /* @__PURE__ */ v(l, {
281
- placeholder: "customer-support-agent",
282
- value: J.slug,
283
- onChange: (e) => Y({
284
- ...J,
285
- slug: e.target.value
477
+ }),
478
+ /* @__PURE__ */ w(p, {
479
+ label: E("botlit.agentBuilder.slug", "Slug"),
480
+ htmlFor: Z("slug"),
481
+ error: X("slug"),
482
+ description: F.slug.trim() === "" && _e(F.name) !== "" ? E("botlit.agentBuilder.slugDerived", "Will be saved as \"{{slug}}\".", { slug: _e(F.name) }) : E("botlit.agentBuilder.slugHelp", "URL-friendly identifier. Leave empty to build it from the name."),
483
+ children: /* @__PURE__ */ w(m, {
484
+ id: Z("slug"),
485
+ "aria-invalid": X("slug") ? !0 : void 0,
486
+ "aria-describedby": X("slug") ? `${Z("slug")}-error` : `${Z("slug")}-description`,
487
+ placeholder: "customer-support-agent",
488
+ value: F.slug,
489
+ onChange: (e) => J("slug", e.target.value)
286
490
  })
287
- })
288
- }),
289
- /* @__PURE__ */ v(c, {
290
- label: "Description",
291
- children: /* @__PURE__ */ v(u, {
292
- placeholder: "Describe what this agent does...",
293
- value: J.description,
294
- onChange: (e) => Y({
295
- ...J,
296
- description: e.target.value
297
- }),
298
- rows: 3
299
- })
300
- }),
301
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
302
- className: "text-sm font-medium mb-2 block",
303
- children: "Capabilities"
304
- }), /* @__PURE__ */ v("div", {
305
- className: "grid grid-cols-2 md:grid-cols-3 gap-3",
306
- children: ue.map((e) => /* @__PURE__ */ y("label", {
307
- className: "flex items-start gap-3 p-3 border border-border-subtle rounded-lg cursor-pointer hover:bg-accent",
308
- children: [/* @__PURE__ */ v("input", {
309
- type: "checkbox",
310
- className: "h-4 w-4 rounded border-border-default mt-0.5",
311
- checked: J.capabilities.includes(e.key),
312
- onChange: () => de(e.key)
313
- }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
314
- className: "font-medium text-sm",
315
- children: e.label
316
- }), /* @__PURE__ */ v("p", {
317
- className: "text-xs text-text-secondary",
318
- children: e.description
319
- })] })]
320
- }, e.key))
321
- })] })
322
- ]
323
- })]
324
- }),
325
- K === 1 && /* @__PURE__ */ y(n, {
326
- treatment: "glass",
327
- glow: !0,
328
- children: [/* @__PURE__ */ y(a, { children: [/* @__PURE__ */ v(o, { children: "Prompt Configuration" }), /* @__PURE__ */ v(i, { children: "Define how the agent communicates and behaves" })] }), /* @__PURE__ */ y(r, {
329
- className: "space-y-6",
330
- children: [/* @__PURE__ */ v(c, {
331
- label: "System Prompt",
332
- required: !0,
333
- description: "The core instructions that define the agent's behavior",
334
- children: /* @__PURE__ */ v(u, {
335
- placeholder: "You are a helpful assistant...",
336
- value: J.systemPrompt,
337
- onChange: (e) => Y({
338
- ...J,
339
- systemPrompt: e.target.value
340
491
  }),
341
- rows: 8,
342
- className: "font-mono text-sm"
343
- })
344
- }), /* @__PURE__ */ y("div", {
345
- className: "grid grid-cols-2 gap-4",
346
- children: [/* @__PURE__ */ v(c, {
347
- label: "Temperature",
348
- description: "Controls randomness (0-2)",
349
- children: /* @__PURE__ */ v(l, {
350
- type: "number",
351
- step: "0.1",
352
- min: "0",
353
- max: "2",
354
- value: J.temperature,
355
- onChange: (e) => Y({
356
- ...J,
357
- temperature: e.target.value
492
+ /* @__PURE__ */ w(p, {
493
+ label: E("botlit.agentBuilder.descriptionLabel", "Description"),
494
+ htmlFor: Z("description"),
495
+ children: /* @__PURE__ */ w(h, {
496
+ id: Z("description"),
497
+ placeholder: E("botlit.agentBuilder.descriptionPlaceholder", "Describe what this agent does..."),
498
+ value: F.description,
499
+ onChange: (e) => J("description", e.target.value),
500
+ rows: 3
358
501
  })
359
- })
360
- }), /* @__PURE__ */ v(c, {
361
- label: "Max Tokens",
362
- description: "Maximum response length",
363
- children: /* @__PURE__ */ v(l, {
364
- type: "number",
365
- step: "256",
366
- min: "1",
367
- value: J.maxTokens,
368
- onChange: (e) => Y({
369
- ...J,
370
- maxTokens: e.target.value
502
+ }),
503
+ /* @__PURE__ */ T("fieldset", { children: [
504
+ /* @__PURE__ */ w("legend", {
505
+ className: "mb-1 text-sm font-medium",
506
+ children: E("botlit.agentBuilder.capabilitiesLabel", "Capabilities")
507
+ }),
508
+ /* @__PURE__ */ w("p", {
509
+ className: "mb-3 text-xs text-text-secondary",
510
+ children: E("botlit.agentBuilder.capabilitiesHelp", "Capabilities are off until you turn them on. Each one only does something once what it needs is attached on the Tools & Knowledge tab.")
511
+ }),
512
+ /* @__PURE__ */ w("div", {
513
+ className: "grid grid-cols-1 gap-3 md:grid-cols-3",
514
+ children: de.map((e) => /* @__PURE__ */ T("label", {
515
+ className: "flex cursor-pointer items-start gap-3 rounded-lg border border-border-subtle p-3 hover:bg-accent",
516
+ children: [/* @__PURE__ */ w("input", {
517
+ type: "checkbox",
518
+ className: "mt-0.5 h-4 w-4 rounded border-border-default",
519
+ checked: F.capabilities.includes(e),
520
+ onChange: () => Y("capabilities", e)
521
+ }), /* @__PURE__ */ T("span", { children: [/* @__PURE__ */ w("span", {
522
+ className: "block text-sm font-medium",
523
+ children: ht[e].label
524
+ }), /* @__PURE__ */ w("span", {
525
+ className: "block text-xs text-text-secondary",
526
+ children: ht[e].description
527
+ })] })]
528
+ }, e))
529
+ }),
530
+ gt.length > 0 && /* @__PURE__ */ w("p", {
531
+ className: "mt-3 text-xs text-text-secondary",
532
+ children: E("botlit.agentBuilder.unusedCapabilities", "This agent also carries {{names}}. They are kept as saved but have no effect yet.", { names: gt.join(", ") })
533
+ }),
534
+ q.length > 0 && /* @__PURE__ */ w("ul", {
535
+ role: "status",
536
+ className: "mt-3 space-y-1 text-sm text-status-warning-text",
537
+ children: q.map((e) => /* @__PURE__ */ T("li", {
538
+ className: "flex items-start gap-2",
539
+ children: [/* @__PURE__ */ w(D, {
540
+ size: 14,
541
+ className: "mt-0.5 shrink-0",
542
+ "aria-hidden": "true"
543
+ }), mt(e)]
544
+ }, e))
371
545
  })
372
- })
373
- })]
546
+ ] })
547
+ ]
374
548
  })]
375
- })]
549
+ })
376
550
  }),
377
- K === 2 && /* @__PURE__ */ y(n, {
378
- treatment: "glass",
379
- glow: !0,
380
- children: [/* @__PURE__ */ y(a, { children: [/* @__PURE__ */ v(o, { children: "LLM Configuration" }), /* @__PURE__ */ v(i, { children: "Select the LLM model for this agent" })] }), /* @__PURE__ */ y(r, {
381
- className: "space-y-6",
382
- children: [
383
- /* @__PURE__ */ y(c, {
384
- label: "LLM Model",
385
- description: "Select a model for this agent",
551
+ /* @__PURE__ */ w("div", {
552
+ role: "tabpanel",
553
+ id: "agent-panel-prompt",
554
+ "aria-labelledby": "agent-tab-prompt",
555
+ hidden: I !== "prompt",
556
+ children: /* @__PURE__ */ T(r, {
557
+ treatment: "glass",
558
+ glow: !0,
559
+ children: [/* @__PURE__ */ T(o, { children: [/* @__PURE__ */ w(s, { children: E("botlit.agentBuilder.prompt.title", "Prompt Configuration") }), /* @__PURE__ */ w(a, { children: E("botlit.agentBuilder.prompt.description", "Define how the agent communicates and behaves") })] }), /* @__PURE__ */ T(i, {
560
+ className: "space-y-6",
561
+ children: [/* @__PURE__ */ w(p, {
562
+ label: E("botlit.agentBuilder.systemPrompt", "System Prompt"),
563
+ required: !0,
564
+ htmlFor: Z("prompt"),
565
+ error: X("systemPrompt"),
566
+ description: E("botlit.agentBuilder.systemPromptHelp", "The core instructions that define the agent's behavior"),
567
+ children: /* @__PURE__ */ w(h, {
568
+ id: Z("prompt"),
569
+ required: !0,
570
+ "aria-invalid": X("systemPrompt") ? !0 : void 0,
571
+ "aria-describedby": X("systemPrompt") ? `${Z("prompt")}-error` : `${Z("prompt")}-description`,
572
+ placeholder: E("botlit.agentBuilder.systemPromptPlaceholder", "You are a helpful assistant..."),
573
+ value: F.systemPrompt,
574
+ onChange: (e) => J("systemPrompt", e.target.value),
575
+ rows: 8,
576
+ className: "font-mono text-sm"
577
+ })
578
+ }), /* @__PURE__ */ T("div", {
579
+ className: "grid grid-cols-1 gap-4 md:grid-cols-3",
386
580
  children: [
387
- R && /* @__PURE__ */ v("p", {
388
- role: "status",
389
- children: "Loading answer models…"
581
+ /* @__PURE__ */ w(p, {
582
+ label: E("botlit.agentBuilder.temperature", "Temperature"),
583
+ htmlFor: Z("temperature"),
584
+ error: X("temperature"),
585
+ description: E("botlit.agentBuilder.temperatureHelp", "Randomness, {{min}} to {{max}}. 0 is the most predictable. Empty uses {{default}}.", {
586
+ min: x.min,
587
+ max: x.max,
588
+ default: _.temperature
589
+ }),
590
+ children: /* @__PURE__ */ w(m, {
591
+ id: Z("temperature"),
592
+ type: "number",
593
+ step: "0.1",
594
+ min: x.min,
595
+ max: x.max,
596
+ placeholder: String(_.temperature),
597
+ "aria-invalid": X("temperature") ? !0 : void 0,
598
+ "aria-describedby": X("temperature") ? `${Z("temperature")}-error` : `${Z("temperature")}-description`,
599
+ value: F.temperature,
600
+ onChange: (e) => J("temperature", e.target.value)
601
+ })
390
602
  }),
391
- z && /* @__PURE__ */ y("div", {
392
- role: "alert",
393
- children: [/* @__PURE__ */ v("p", { children: "Could not load answer models." }), /* @__PURE__ */ v(s, {
394
- variant: "secondary",
395
- onClick: () => {
396
- L(), N();
397
- },
398
- children: "Retry model catalog"
399
- })]
603
+ /* @__PURE__ */ w(p, {
604
+ label: E("botlit.agentBuilder.maxTokens", "Max Tokens"),
605
+ htmlFor: Z("max-tokens"),
606
+ error: X("maxTokens"),
607
+ description: E("botlit.agentBuilder.maxTokensHelp", "Maximum response length, {{min}} to {{max}}. Empty uses {{default}}.", {
608
+ min: b.min,
609
+ max: b.max,
610
+ default: _.maxTokens
611
+ }),
612
+ children: /* @__PURE__ */ w(m, {
613
+ id: Z("max-tokens"),
614
+ type: "number",
615
+ step: "1",
616
+ min: b.min,
617
+ max: b.max,
618
+ placeholder: String(_.maxTokens),
619
+ "aria-invalid": X("maxTokens") ? !0 : void 0,
620
+ "aria-describedby": X("maxTokens") ? `${Z("max-tokens")}-error` : `${Z("max-tokens")}-description`,
621
+ value: F.maxTokens,
622
+ onChange: (e) => J("maxTokens", e.target.value)
623
+ })
400
624
  }),
401
- /* @__PURE__ */ y("select", {
402
- "aria-label": "LLM Model",
403
- disabled: R || !!z,
404
- className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
405
- value: J.llmModelId,
406
- onChange: (e) => Y({
407
- ...J,
408
- llmModelId: e.target.value
625
+ /* @__PURE__ */ w(p, {
626
+ label: E("botlit.agentBuilder.maxConcurrent", "Max Concurrent Runs"),
627
+ htmlFor: Z("max-concurrent"),
628
+ error: X("maxConcurrentExecutions"),
629
+ description: E("botlit.agentBuilder.maxConcurrentHelp", "How many runs can happen at once, {{min}} to {{max}}. Empty uses {{default}}.", {
630
+ min: y.min,
631
+ max: y.max,
632
+ default: _.maxConcurrentExecutions
409
633
  }),
410
- children: [/* @__PURE__ */ v("option", {
411
- value: "",
412
- children: "Select a model..."
413
- }), B.map((e) => /* @__PURE__ */ y("option", {
414
- value: e.id,
415
- children: [
416
- e.name,
417
- " (",
418
- e.modelId,
419
- ")"
420
- ]
421
- }, e.id))]
634
+ children: /* @__PURE__ */ w(m, {
635
+ id: Z("max-concurrent"),
636
+ type: "number",
637
+ step: "1",
638
+ min: y.min,
639
+ max: y.max,
640
+ placeholder: String(_.maxConcurrentExecutions),
641
+ "aria-invalid": X("maxConcurrentExecutions") ? !0 : void 0,
642
+ "aria-describedby": X("maxConcurrentExecutions") ? `${Z("max-concurrent")}-error` : `${Z("max-concurrent")}-description`,
643
+ value: F.maxConcurrentExecutions,
644
+ onChange: (e) => J("maxConcurrentExecutions", e.target.value)
645
+ })
422
646
  })
423
647
  ]
424
- }),
425
- /* @__PURE__ */ y("div", {
426
- className: "p-4 bg-bg-sunken rounded-lg",
427
- children: [/* @__PURE__ */ v("h4", {
428
- className: "text-sm font-medium mb-2",
429
- children: "Available Providers"
430
- }), /* @__PURE__ */ y("div", {
431
- className: "grid grid-cols-2 gap-2",
432
- children: [j?.map((e) => /* @__PURE__ */ y("div", {
433
- className: "text-sm",
434
- children: [/* @__PURE__ */ v("span", {
435
- className: "font-medium",
436
- children: e.name
437
- }), /* @__PURE__ */ y("span", {
438
- className: "text-text-secondary ml-2",
439
- children: [
440
- "(",
441
- e.type,
442
- ")"
443
- ]
444
- })]
445
- }, e.id)), !R && !z && !j?.length && /* @__PURE__ */ v("p", {
446
- className: "text-sm text-text-secondary",
447
- children: "No providers configured"
448
- })]
449
- })]
450
- }),
451
- !R && !z && !B.length && /* @__PURE__ */ v("p", {
452
- className: "text-sm text-text-secondary",
453
- children: "No models available. Configure a provider and add models in Settings."
454
- })
455
- ]
456
- })]
648
+ })]
649
+ })]
650
+ })
457
651
  }),
458
- K === 3 && /* @__PURE__ */ v("div", {
459
- className: "space-y-6",
460
- children: /* @__PURE__ */ y(n, {
652
+ /* @__PURE__ */ w("div", {
653
+ role: "tabpanel",
654
+ id: "agent-panel-model",
655
+ "aria-labelledby": "agent-tab-model",
656
+ hidden: I !== "model",
657
+ children: /* @__PURE__ */ T(r, {
461
658
  treatment: "glass",
462
659
  glow: !0,
463
- children: [/* @__PURE__ */ y(a, { children: [/* @__PURE__ */ y(o, {
464
- className: "flex items-center gap-2",
465
- children: [/* @__PURE__ */ v(C, { size: 18 }), "Tools & Knowledge"]
466
- }), /* @__PURE__ */ v(i, { children: "Configure tools and knowledge bases for this agent" })] }), /* @__PURE__ */ v(r, { children: /* @__PURE__ */ y("div", {
467
- className: "text-center py-12 text-text-secondary",
660
+ children: [/* @__PURE__ */ T(o, { children: [/* @__PURE__ */ w(s, { children: E("botlit.agentBuilder.model.title", "LLM Configuration") }), /* @__PURE__ */ w(a, { children: E("botlit.agentBuilder.model.description", "Select the LLM model for this agent") })] }), /* @__PURE__ */ T(i, {
661
+ className: "space-y-6",
468
662
  children: [
469
- /* @__PURE__ */ v(C, { className: "h-10 w-10 mx-auto mb-3 opacity-50" }),
470
- /* @__PURE__ */ v("p", {
471
- className: "font-medium",
472
- children: "Tools & Knowledge coming soon"
663
+ /* @__PURE__ */ T(p, {
664
+ label: E("botlit.agentBuilder.model.label", "LLM Model"),
665
+ htmlFor: Z("model"),
666
+ description: E("botlit.agentBuilder.model.help", "An agent needs a model before it can go live. You can save it as a draft without one and test it in chat once a model is set."),
667
+ children: [
668
+ H && /* @__PURE__ */ w("p", {
669
+ role: "status",
670
+ children: E("botlit.agentBuilder.model.loading", "Loading answer models…")
671
+ }),
672
+ U && /* @__PURE__ */ T("div", {
673
+ role: "alert",
674
+ children: [/* @__PURE__ */ w("p", { children: E("botlit.agentBuilder.model.loadFailed", "Could not load answer models.") }), /* @__PURE__ */ w(c, {
675
+ type: "button",
676
+ variant: "secondary",
677
+ onClick: () => {
678
+ et(), Xe();
679
+ },
680
+ children: E("botlit.agentBuilder.model.retry", "Retry model catalog")
681
+ })]
682
+ }),
683
+ /* @__PURE__ */ T("select", {
684
+ id: Z("model"),
685
+ "aria-describedby": `${Z("model")}-description`,
686
+ disabled: H || !!U,
687
+ className: Me,
688
+ value: F.llmModelId,
689
+ onChange: (e) => J("llmModelId", e.target.value),
690
+ children: [
691
+ /* @__PURE__ */ w("option", {
692
+ value: "",
693
+ children: E("botlit.agentBuilder.model.none", "Select a model...")
694
+ }),
695
+ St && /* @__PURE__ */ w("option", {
696
+ value: F.llmModelId,
697
+ children: E("botlit.agentBuilder.model.unavailable", "Unavailable model ({{id}})", { id: F.llmModelId })
698
+ }),
699
+ W.map((e) => /* @__PURE__ */ T("option", {
700
+ value: e.id,
701
+ children: [
702
+ e.name,
703
+ " (",
704
+ e.modelId,
705
+ ")"
706
+ ]
707
+ }, e.id))
708
+ ]
709
+ })
710
+ ]
473
711
  }),
474
- /* @__PURE__ */ v("p", {
475
- className: "text-sm mt-2",
476
- children: "MCP tool connections and knowledge base bindings will be configurable here in a future update."
712
+ ut && !H && !U && /* @__PURE__ */ T("div", {
713
+ role: "status",
714
+ className: "flex items-start gap-2 rounded-lg border border-status-warning-border bg-status-warning-bg-subtle p-3 text-sm",
715
+ children: [/* @__PURE__ */ w(D, {
716
+ size: 16,
717
+ className: "mt-0.5 shrink-0 text-status-warning-text",
718
+ "aria-hidden": "true"
719
+ }), /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("p", { children: W.length === 0 ? E("botlit.agentBuilder.model.noneConfigured", "No provider or model is configured in this workspace yet, so this agent cannot go live. Add a provider and a model in Settings first.") : E("botlit.agentBuilder.model.noneChosen", "No model is chosen. The agent can be saved as a draft, but it cannot go live until it has one.") }), W.length === 0 && /* @__PURE__ */ w(c, {
720
+ type: "button",
721
+ variant: "ghost",
722
+ className: "px-0",
723
+ onClick: () => k("settings"),
724
+ children: E("botlit.agentBuilder.model.openSettings", "Open Settings")
725
+ })] })]
726
+ }),
727
+ /* @__PURE__ */ T("div", {
728
+ className: "rounded-lg bg-bg-sunken p-4",
729
+ children: [/* @__PURE__ */ w("h4", {
730
+ className: "mb-2 text-sm font-medium",
731
+ children: E("botlit.agentBuilder.model.providers", "Available Providers")
732
+ }), /* @__PURE__ */ T("div", {
733
+ className: "grid grid-cols-2 gap-2",
734
+ children: [V?.map((e) => /* @__PURE__ */ T("div", {
735
+ className: "text-sm",
736
+ children: [/* @__PURE__ */ w("span", {
737
+ className: "font-medium",
738
+ children: e.name
739
+ }), /* @__PURE__ */ T("span", {
740
+ className: "ml-2 text-text-secondary",
741
+ children: [
742
+ "(",
743
+ e.type,
744
+ ")"
745
+ ]
746
+ })]
747
+ }, e.id)), !H && !U && !V?.length && /* @__PURE__ */ w("p", {
748
+ className: "text-sm text-text-secondary",
749
+ children: E("botlit.agentBuilder.model.noProviders", "No providers configured")
750
+ })]
751
+ })]
477
752
  })
478
753
  ]
479
- }) })]
754
+ })]
480
755
  })
481
756
  }),
482
- /* @__PURE__ */ y("div", {
757
+ /* @__PURE__ */ w("div", {
758
+ role: "tabpanel",
759
+ id: "agent-panel-tools",
760
+ "aria-labelledby": "agent-tab-tools",
761
+ hidden: I !== "tools",
762
+ children: /* @__PURE__ */ T("div", {
763
+ className: "space-y-6",
764
+ children: [
765
+ /* @__PURE__ */ T(r, {
766
+ treatment: "glass",
767
+ glow: !0,
768
+ children: [/* @__PURE__ */ T(o, { children: [/* @__PURE__ */ T(s, {
769
+ className: "flex items-center gap-2",
770
+ children: [/* @__PURE__ */ w(De, {
771
+ size: 18,
772
+ "aria-hidden": "true"
773
+ }), E("botlit.agentBuilder.tools.title", "MCP servers")]
774
+ }), /* @__PURE__ */ w(a, { children: E("botlit.agentBuilder.tools.description", "The tools of the servers you attach are available to the agent when MCP Tools is on.") })] }), /* @__PURE__ */ w(i, { children: /* @__PURE__ */ w(Ne, {
775
+ legend: E("botlit.agentBuilder.tools.legend", "MCP servers attached to this agent"),
776
+ items: it.map((e) => ({
777
+ id: e.id,
778
+ name: e.name,
779
+ detail: e.status
780
+ })),
781
+ selected: F.mcpConnectionIds,
782
+ missing: xt,
783
+ loading: at,
784
+ error: ot,
785
+ onRetry: () => void st(),
786
+ onToggle: (e) => Y("mcpConnectionIds", e),
787
+ emptyText: E("botlit.agentBuilder.tools.empty", "No MCP servers in this workspace yet. Add one on the MCP Servers page."),
788
+ resource: E("botlit.agentBuilder.tools.resource", "MCP servers")
789
+ }) })]
790
+ }),
791
+ /* @__PURE__ */ T(r, {
792
+ treatment: "glass",
793
+ glow: !0,
794
+ children: [/* @__PURE__ */ T(o, { children: [/* @__PURE__ */ T(s, {
795
+ className: "flex items-center gap-2",
796
+ children: [/* @__PURE__ */ w(Ce, {
797
+ size: 18,
798
+ "aria-hidden": "true"
799
+ }), E("botlit.agentBuilder.knowledge.title", "Knowledge bases")]
800
+ }), /* @__PURE__ */ w(a, { children: E("botlit.agentBuilder.knowledge.description", "The agent answers from the knowledge bases you attach when RAG is on.") })] }), /* @__PURE__ */ w(i, { children: /* @__PURE__ */ w(Ne, {
801
+ legend: E("botlit.agentBuilder.knowledge.legend", "Knowledge bases attached to this agent"),
802
+ items: G.map((e) => ({
803
+ id: e.id,
804
+ name: e.name,
805
+ detail: e.indexStatus
806
+ })),
807
+ selected: F.knowledgeBaseIds,
808
+ missing: yt,
809
+ loading: tt,
810
+ error: nt,
811
+ onRetry: () => void rt(),
812
+ onToggle: (e) => Y("knowledgeBaseIds", e),
813
+ emptyText: E("botlit.agentBuilder.knowledge.empty", "No knowledge bases in this workspace yet. Create one on the Knowledge Bases page."),
814
+ resource: E("botlit.agentBuilder.knowledge.resource", "knowledge bases")
815
+ }) })]
816
+ }),
817
+ q.length > 0 && /* @__PURE__ */ w("ul", {
818
+ role: "status",
819
+ className: "space-y-1 text-sm text-status-warning-text",
820
+ children: q.map((e) => /* @__PURE__ */ T("li", {
821
+ className: "flex items-start gap-2",
822
+ children: [/* @__PURE__ */ w(D, {
823
+ size: 14,
824
+ className: "mt-0.5 shrink-0",
825
+ "aria-hidden": "true"
826
+ }), mt(e)]
827
+ }, e))
828
+ }),
829
+ bt.length > 0 && /* @__PURE__ */ w("ul", {
830
+ role: "status",
831
+ "data-testid": "builder-knowledge-not-ready",
832
+ className: "space-y-1 text-sm text-status-warning-text",
833
+ children: bt.map((e) => /* @__PURE__ */ T("li", {
834
+ className: "flex items-start gap-2",
835
+ children: [/* @__PURE__ */ w(D, {
836
+ size: 14,
837
+ className: "mt-0.5 shrink-0",
838
+ "aria-hidden": "true"
839
+ }), E("botlit.agentBuilder.knowledge.notReady", "\"{{name}}\" is {{status}}. An agent with RAG on cannot answer until it is ready.", {
840
+ name: e.name,
841
+ status: e.indexStatus.toLowerCase()
842
+ })]
843
+ }, e.id))
844
+ })
845
+ ]
846
+ })
847
+ }),
848
+ /* @__PURE__ */ T("div", {
483
849
  className: "flex justify-between pt-6",
484
- children: [/* @__PURE__ */ v(s, {
850
+ children: [/* @__PURE__ */ w(c, {
851
+ type: "button",
485
852
  variant: "outline",
486
- onClick: () => q(Math.max(0, K - 1)),
487
- disabled: K === 0,
488
- children: "Previous"
489
- }), K < X.length - 1 ? /* @__PURE__ */ v(s, {
490
- onClick: () => q(K + 1),
491
- children: "Next"
492
- }) : /* @__PURE__ */ v(s, {
493
- leftIcon: /* @__PURE__ */ v(x, { size: 16 }),
494
- onClick: Z,
495
- isLoading: Q || $,
496
- disabled: !J.name || !J.systemPrompt,
497
- children: G ? "Save Changes" : "Create Agent"
853
+ onClick: () => Q(M[Math.max(0, M.indexOf(I) - 1)]),
854
+ disabled: I === M[0],
855
+ children: E("botlit.agentBuilder.previous", "Previous")
856
+ }), I === M[M.length - 1] ? /* @__PURE__ */ w(c, {
857
+ type: "submit",
858
+ leftIcon: /* @__PURE__ */ w(we, { size: 16 }),
859
+ isLoading: z,
860
+ children: $
861
+ }) : /* @__PURE__ */ w(c, {
862
+ type: "button",
863
+ onClick: () => Q(M[M.indexOf(I) + 1]),
864
+ children: E("botlit.agentBuilder.next", "Next")
498
865
  })]
499
866
  })
500
867
  ]
501
868
  })
502
869
  ]
503
- }), A && A.length > 0 && null]
870
+ })
504
871
  });
872
+ }, Ne = ({ legend: t, items: n, selected: r, missing: i, loading: a, error: o, onRetry: s, onToggle: c, emptyText: l, resource: u }) => {
873
+ let f = e();
874
+ return a ? /* @__PURE__ */ w("p", {
875
+ role: "status",
876
+ "aria-busy": "true",
877
+ className: "text-sm text-text-secondary",
878
+ children: f("botlit.agentBuilder.attachments.loading", "Loading {{resource}}…", { resource: u })
879
+ }) : o ? /* @__PURE__ */ w(d, {
880
+ resource: u,
881
+ error: o,
882
+ onRetry: s
883
+ }) : n.length === 0 && i.length === 0 ? /* @__PURE__ */ w("p", {
884
+ className: "text-sm text-text-secondary",
885
+ children: l
886
+ }) : /* @__PURE__ */ T("fieldset", { children: [/* @__PURE__ */ w("legend", {
887
+ className: "sr-only",
888
+ children: t
889
+ }), /* @__PURE__ */ T("ul", {
890
+ className: "grid grid-cols-1 gap-2 md:grid-cols-2",
891
+ children: [n.map((e) => /* @__PURE__ */ w("li", { children: /* @__PURE__ */ T("label", {
892
+ className: "flex cursor-pointer items-start gap-3 rounded-lg border border-border-subtle p-3 hover:bg-accent",
893
+ children: [/* @__PURE__ */ w("input", {
894
+ type: "checkbox",
895
+ className: "mt-0.5 h-4 w-4 rounded border-border-default",
896
+ checked: r.includes(e.id),
897
+ onChange: () => c(e.id)
898
+ }), /* @__PURE__ */ T("span", { children: [/* @__PURE__ */ w("span", {
899
+ className: "block text-sm font-medium",
900
+ children: e.name
901
+ }), e.detail && /* @__PURE__ */ w("span", {
902
+ className: "block text-xs text-text-secondary",
903
+ children: e.detail
904
+ })] })]
905
+ }) }, e.id)), i.map((e) => /* @__PURE__ */ w("li", { children: /* @__PURE__ */ T("label", {
906
+ className: "flex cursor-pointer items-start gap-3 rounded-lg border border-status-warning-border p-3",
907
+ children: [/* @__PURE__ */ w("input", {
908
+ type: "checkbox",
909
+ className: "mt-0.5 h-4 w-4 rounded border-border-default",
910
+ checked: !0,
911
+ onChange: () => c(e)
912
+ }), /* @__PURE__ */ T("span", { children: [
913
+ /* @__PURE__ */ w("span", {
914
+ className: "block text-sm font-medium",
915
+ children: f("botlit.agentBuilder.attachments.missing", "No longer available")
916
+ }),
917
+ /* @__PURE__ */ w("span", {
918
+ className: "block font-mono text-xs text-text-secondary",
919
+ children: e
920
+ }),
921
+ /* @__PURE__ */ w("span", {
922
+ className: "block text-xs text-text-secondary",
923
+ children: f("botlit.agentBuilder.attachments.missingHelp", "Untick to remove it from this agent.")
924
+ })
925
+ ] })]
926
+ }) }, e))]
927
+ })] });
505
928
  };
506
- export { k as AgentBuilderPage };
929
+ export { N as AgentBuilderPage };
507
930
 
508
931
  //# sourceMappingURL=AgentBuilderPage.js.map