@burdenoff/microfe-botmanor 2026.1116.1 → 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 (31) hide show
  1. package/dist/botlit/hooks/internal/workspaceGateway.js +33 -32
  2. package/dist/botlit/hooks/internal/workspaceGateway.js.map +1 -1
  3. package/dist/botlit/hooks/useAgents.d.ts +3 -1
  4. package/dist/botlit/hooks/useAgents.js +5 -4
  5. package/dist/botlit/hooks/useAgents.js.map +1 -1
  6. package/dist/botlit/hooks/useBotAgents.d.ts +12 -0
  7. package/dist/botlit/hooks/useBotAgents.js +54 -28
  8. package/dist/botlit/hooks/useBotAgents.js.map +1 -1
  9. package/dist/botlit/hooks/useKnowledgeBases.d.ts +13 -0
  10. package/dist/botlit/hooks/useKnowledgeBases.js +76 -53
  11. package/dist/botlit/hooks/useKnowledgeBases.js.map +1 -1
  12. package/dist/botlit/pages/AgentBuilderPage.js +229 -213
  13. package/dist/botlit/pages/AgentBuilderPage.js.map +1 -1
  14. package/dist/botlit/pages/AgentDetailPage.js +408 -379
  15. package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
  16. package/dist/botlit/pages/KnowledgeBaseDetailPage.js +519 -265
  17. package/dist/botlit/pages/KnowledgeBaseDetailPage.js.map +1 -1
  18. package/dist/botlit/pages/KnowledgeBasesPage.js +269 -130
  19. package/dist/botlit/pages/KnowledgeBasesPage.js.map +1 -1
  20. package/dist/botlit/utils/kbDelete.d.ts +5 -0
  21. package/dist/botlit/utils/kbDelete.js +11 -0
  22. package/dist/botlit/utils/kbDelete.js.map +1 -0
  23. package/dist/botlit/utils/kbSettings.d.ts +41 -0
  24. package/dist/botlit/utils/kbSettings.js +60 -0
  25. package/dist/botlit/utils/kbSettings.js.map +1 -0
  26. package/dist/generated/wspace-operations.d.ts +71 -0
  27. package/dist/generated/wspace-operations.js +60 -48
  28. package/dist/generated/wspace-operations.js.map +1 -1
  29. package/dist/generated/wspace-types.d.ts +23 -0
  30. package/dist/generated/wspace-types.js.map +1 -1
  31. package/package.json +1 -1
@@ -1,145 +1,246 @@
1
- import { useBotlit as e } from "../providers/BotlitProvider.js";
2
- import { useLLMModels as t, useLLMProviders as n } from "../hooks/useLLMProviders.js";
3
- import { configuredEmbeddingModels as ee } from "../utils/embedding-models.js";
4
- import { KnowledgeSourceImportPanel as te } from "../components/KnowledgeSourceImportPanel.js";
5
- import { BOTMANOR_PERMISSIONS as r } from "../permissions/botmanorPermissions.js";
6
- import { BotmanorPermissionGate as i } from "../permissions/useBotmanorPermissions.js";
7
- import { PageLayout as a } from "../components/PageLayout.js";
8
- import { EmptyState as ne } from "../components/EmptyState.js";
9
- import { Card as o, CardContent as s, CardDescription as c, CardHeader as l, CardTitle as u } from "../components/Card.js";
10
- import { Button as d } from "../components/Button.js";
11
- import { FormField as f, Input as p, Textarea as m } from "../components/Input.js";
12
- import { StatusBadge as h } from "../components/Badge.js";
13
- import { useCreateKnowledgeBase as re, useKnowledgeBase as g, useKnowledgeDocuments as _, useRebuildKnowledgeBaseIndex as ie, useUpdateKnowledgeBase as ae } from "../hooks/useKnowledgeBases.js";
14
- import { formatRelativeTime as v } from "../utils/formatters.js";
1
+ import { useTr as e } from "../../shared/hooks/useTr.js";
2
+ import { useBotlit as t } from "../providers/BotlitProvider.js";
3
+ import { KnowledgeSourceImportPanel as n } from "../components/KnowledgeSourceImportPanel.js";
4
+ import { PageLayout as r } from "../components/PageLayout.js";
5
+ import { EmptyState as ee } from "../components/EmptyState.js";
6
+ import { BOTMANOR_PERMISSIONS as i } from "../permissions/botmanorPermissions.js";
7
+ import { BotmanorPermissionGate as a, useBotmanorCan as te } from "../permissions/useBotmanorPermissions.js";
8
+ import { ErrorState as o } from "../components/ErrorState.js";
9
+ import { Card as s, CardContent as c, CardDescription as l, CardHeader as u, CardTitle as d } from "../components/Card.js";
10
+ import { Button as f } from "../components/Button.js";
11
+ import { FormField as p, Input as m, Textarea as ne } from "../components/Input.js";
12
+ import { StatusBadge as re } from "../components/Badge.js";
13
+ import { useLLMModels as ie, useLLMProviders as ae } from "../hooks/useLLMProviders.js";
14
+ import { useCreateKnowledgeBase as oe, useDeleteKnowledgeBase as se, useKnowledgeBase as ce, useKnowledgeDocuments as le, useLoadKnowledgeBaseUsage as ue, useRebuildKnowledgeBaseIndex as de, useRemoveKnowledgeDocument as fe, useUpdateKnowledgeBase as pe } from "../hooks/useKnowledgeBases.js";
15
+ import { configuredEmbeddingModels as me } from "../utils/embedding-models.js";
16
+ import { confirmAction as h } from "../utils/confirmAction.js";
17
+ import { formatRelativeTime as g } from "../utils/formatters.js";
18
+ import { knowledgeBaseDeleteMessage as he } from "../utils/kbDelete.js";
19
+ import { KB_CHUNK_SIZE_RANGE as _, KB_FIELD_MESSAGES as ge, indexStatusHelp as _e, isDocumentBusy as ve, isIndexBusy as ye, parseKbNumber as v, validateKbForm as be } from "../utils/kbSettings.js";
15
20
  import "../permissions/index.js";
16
- import { useEffect as oe, useMemo as se, useState as y } from "react";
17
- import { GlassCard as ce, PagePurpose as le } from "@burdenoff/fe-libs/ui";
18
- import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
19
- import { useParams as ue } from "react-router";
20
- import { ArrowLeft as de, Boxes as fe, Database as C, FileText as w, Layers as T, RefreshCw as E, Save as D, Settings as O } from "lucide-react";
21
- import { toast as k } from "sonner";
21
+ import { useEffect as y, useRef as xe, useState as b } from "react";
22
+ import { GlassCard as Se, PagePurpose as Ce } from "@burdenoff/fe-libs/ui";
23
+ import { Fragment as we, jsx as x, jsxs as S } from "react/jsx-runtime";
24
+ import { useParams as Te } from "react-router";
25
+ import { AlertTriangle as Ee, ArrowLeft as De, Boxes as Oe, Database as ke, FileText as Ae, Layers as je, RefreshCw as Me, Save as C, Settings as w, Trash2 as T } from "lucide-react";
26
+ import { toast as E } from "sonner";
22
27
  // src/botlit/pages/KnowledgeBaseDetailPage.tsx
23
- var pe = [
28
+ var Ne = 5e3, D = [
24
29
  "RECURSIVE",
25
30
  "FIXED",
26
31
  "SENTENCE"
27
- ], A = {
32
+ ], O = {
33
+ RECURSIVE: {
34
+ key: "recursive",
35
+ fallback: "Splits on paragraphs, then sentences, then words, keeping related text together. The best default."
36
+ },
37
+ FIXED: {
38
+ key: "fixed",
39
+ fallback: "Cuts every chunk at the same length, wherever that falls."
40
+ },
41
+ SENTENCE: {
42
+ key: "sentence",
43
+ fallback: "Packs whole sentences into each chunk, never cutting one in half."
44
+ }
45
+ }, Pe = {
28
46
  name: "",
29
47
  description: "",
30
48
  embeddingModel: "",
31
49
  embeddingDimensions: 0,
32
50
  chunkingStrategy: "RECURSIVE",
33
- chunkSize: 512,
34
- chunkOverlap: 50
51
+ chunkSize: "512",
52
+ chunkOverlap: "50"
35
53
  };
36
- function j(e) {
54
+ function Fe(e) {
37
55
  return {
38
56
  name: e.name,
39
57
  description: e.description ?? "",
40
58
  embeddingModel: e.embeddingModel,
41
59
  embeddingDimensions: e.embeddingDimensions,
42
60
  chunkingStrategy: e.chunkingStrategy,
43
- chunkSize: e.chunkSize,
44
- chunkOverlap: e.chunkOverlap
61
+ chunkSize: String(e.chunkSize),
62
+ chunkOverlap: String(e.chunkOverlap)
45
63
  };
46
64
  }
47
- function M(e, t) {
48
- let n = Number(e);
49
- return e.trim() !== "" && Number.isFinite(n) ? n : t;
50
- }
51
- var N = ({ isNew: N }) => {
52
- let { kbId: P } = ue(), { data: F, loading: I, error: L, refetch: R } = t(), { data: z, loading: B, error: V, refetch: me } = n(), H = I || B, U = L || V, W = se(() => ee(F ?? [], z ?? []), [F, z]), { navigateTo: G } = e(), { data: K, loading: he, refetch: q } = g(N ? void 0 : P), { data: J } = _(N ? void 0 : P), [ge, _e] = re(), [ve, ye] = ae(), [be, xe] = ie(), [Y, X] = y(!1), [Z, Q] = y(A);
53
- oe(() => {
54
- K && !N && Q(j(K));
55
- }, [K, N]);
56
- let Se = async () => {
57
- if (!(H || U)) {
58
- if (!Z.name.trim()) k.error("Name is required");
59
- else if (!W.some((e) => e.id === Z.embeddingModel)) k.error("Choose a configured embedding model. Register one in Settings first.");
65
+ var Ie = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm", k = ({ isNew: k }) => {
66
+ let A = e(), j = te(), { kbId: M, botId: Re } = Te(), N = Re ? `bots/${Re}/knowledge` : "knowledge", { navigateTo: P } = t(), F = ie(), I = ae(), L = F.loading || I.loading, R = F.error || I.error, z = me(F.data ?? [], I.data ?? []), { data: B, loading: ze, error: V, refetch: H } = ce(k ? void 0 : M), U = le(k ? void 0 : M), W = U.data, [Be, Ve] = oe(), [He, Ue] = pe(), [We, Ge] = de(), [Ke, qe] = se(), [Je] = fe(), Ye = ue(), [Xe, G] = b(!1), [K, q] = b(Pe), [Ze, J] = b(!1), [Qe, $e] = b(null), Y = xe(null);
67
+ y(() => {
68
+ B && !k && Y.current !== B.id && (Y.current = B.id, q(Fe(B)));
69
+ }, [B, k]);
70
+ let X = ye(B?.indexStatus) || W.some((e) => ve(e.status));
71
+ y(() => {
72
+ if (k || !X) return;
73
+ let e = window.setInterval(() => {
74
+ H(), U.refetch();
75
+ }, Ne);
76
+ return () => window.clearInterval(e);
77
+ }, [
78
+ k,
79
+ X,
80
+ H,
81
+ U
82
+ ]);
83
+ let Z = be({
84
+ name: K.name,
85
+ embeddingModel: K.embeddingModel,
86
+ chunkSize: K.chunkSize,
87
+ chunkOverlap: K.chunkOverlap
88
+ }, k ? "create" : "edit"), Q = (e) => {
89
+ let t = Ze ? Z[e] : void 0;
90
+ return t ? A(`botlit.kb.errors.${t}`, ge[t]) : void 0;
91
+ }, et = async (e) => {
92
+ if (e.preventDefault(), !Ve.loading) {
93
+ if (L) E.error(A("botlit.kb.catalogLoading", "The model list is still loading. Try again in a moment."));
94
+ else if (Object.keys(Z).length > 0) J(!0);
95
+ else if (!z.some((e) => e.id === K.embeddingModel)) J(!0), E.error(A("botlit.kb.modelUnavailable", "Choose a configured embedding model. Register one in Settings first."));
60
96
  else try {
61
- let e = await ge({
62
- name: Z.name.trim(),
63
- description: Z.description.trim() || null,
64
- embeddingModel: Z.embeddingModel,
65
- embeddingDimensions: Z.embeddingDimensions,
66
- chunkingStrategy: Z.chunkingStrategy,
67
- chunkSize: Z.chunkSize,
68
- chunkOverlap: Z.chunkOverlap
97
+ let e = await Be({
98
+ name: K.name.trim(),
99
+ description: K.description.trim() || null,
100
+ embeddingModel: K.embeddingModel,
101
+ embeddingDimensions: K.embeddingDimensions,
102
+ chunkingStrategy: K.chunkingStrategy,
103
+ chunkSize: v(K.chunkSize),
104
+ chunkOverlap: v(K.chunkOverlap)
69
105
  });
70
- k.success(`Knowledge base "${e.name}" created`), G(`knowledge/${e.id}`);
106
+ E.success(A("botlit.kb.created", "Knowledge base \"{{name}}\" created", { name: e.name })), P(`knowledge/${e.id}`);
71
107
  } catch (e) {
72
- k.error(e instanceof Error ? e.message : "Failed to create knowledge base");
108
+ E.error(e instanceof Error ? e.message : A("botlit.kb.createFailed", "Failed to create knowledge base"));
73
109
  }
74
110
  }
75
- }, Ce = async () => {
76
- if (!P || !Z.name.trim()) k.error("Name is required");
77
- else try {
78
- await ve({
79
- kbId: P,
111
+ }, tt = async (e) => {
112
+ if (e.preventDefault(), !M || !B || Ue.loading) return;
113
+ if (Object.keys(Z).length > 0) {
114
+ J(!0);
115
+ return;
116
+ }
117
+ let t = v(K.chunkSize), n = v(K.chunkOverlap), r = t !== B.chunkSize || n !== B.chunkOverlap || K.chunkingStrategy !== B.chunkingStrategy;
118
+ try {
119
+ await He({
120
+ kbId: M,
80
121
  input: {
81
- name: Z.name.trim(),
82
- description: Z.description.trim() || null,
83
- chunkingStrategy: Z.chunkingStrategy,
84
- chunkSize: Z.chunkSize,
85
- chunkOverlap: Z.chunkOverlap
122
+ name: K.name.trim(),
123
+ description: K.description.trim() || null,
124
+ chunkingStrategy: K.chunkingStrategy,
125
+ chunkSize: t,
126
+ chunkOverlap: n
127
+ }
128
+ }), await H(), E.success(A("botlit.kb.updated", "Knowledge base updated")), G(!1), J(!1), r && B.totalDocuments > 0 && await h({
129
+ title: A("botlit.kb.rebuildPrompt.title", "Rebuild the index?"),
130
+ message: A("botlit.kb.rebuildPrompt.message", "The chunk settings changed. Your {{count}} existing document(s) keep their old chunks until the index is rebuilt. Rebuild now?", { count: B.totalDocuments }),
131
+ confirmLabel: A("botlit.kb.rebuild", "Rebuild Index"),
132
+ cancelLabel: A("botlit.kb.rebuildPrompt.later", "Later")
133
+ }) && await nt();
134
+ } catch (e) {
135
+ E.error(e instanceof Error ? e.message : A("botlit.kb.updateFailed", "Failed to update knowledge base"));
136
+ }
137
+ }, nt = async () => {
138
+ if (M) {
139
+ $e(null);
140
+ try {
141
+ if (!await We(M)) {
142
+ E.error(A("botlit.kb.rebuildNotDone", "The index could not be rebuilt."));
143
+ return;
86
144
  }
87
- }), await q(), k.success("Knowledge base updated"), X(!1);
145
+ E.success(A("botlit.kb.rebuilt", "Index rebuilt"));
146
+ } catch (e) {
147
+ $e(A("botlit.kb.rebuildMaybeRunning", "The rebuild did not report back. A large library can still be rebuilding in the background: this page keeps refreshing, so check the index status.")), E.error(e instanceof Error ? e.message : A("botlit.kb.rebuildFailed", "Failed to rebuild the index"));
148
+ } finally {
149
+ await H(), await U.refetch();
150
+ }
151
+ }
152
+ }, rt = async () => {
153
+ if (!M || !B) return;
154
+ let e = await Ye(M).catch(() => null);
155
+ if (await h({
156
+ title: A("botlit.kb.delete.title", "Delete knowledge base?"),
157
+ message: he(A, B.name, e),
158
+ confirmLabel: A("botlit.common.delete", "Delete"),
159
+ cancelLabel: A("botlit.common.cancel", "Cancel")
160
+ })) try {
161
+ if (!await Ke(M)) {
162
+ E.error(A("botlit.kb.delete.notDeleted", "The knowledge base could not be deleted."));
163
+ return;
164
+ }
165
+ E.success(A("botlit.kb.delete.success", "Knowledge base \"{{name}}\" deleted", { name: B.name })), P(N);
88
166
  } catch (e) {
89
- k.error(e instanceof Error ? e.message : "Failed to update knowledge base");
167
+ E.error(e instanceof Error ? e.message : A("botlit.kb.delete.error", "Failed to delete the knowledge base"));
90
168
  }
91
- }, we = async () => {
92
- if (P) try {
93
- await be(P), await q(), k.success("Re-indexing started");
169
+ }, it = async (e) => {
170
+ if (await h({
171
+ title: A("botlit.kb.document.removeTitle", "Remove document?"),
172
+ message: A("botlit.kb.document.removeMessage", "Remove \"{{title}}\" from this knowledge base? Agents stop answering from it. This cannot be undone.", { title: e.title }),
173
+ confirmLabel: A("botlit.kb.document.remove", "Remove"),
174
+ cancelLabel: A("botlit.common.cancel", "Cancel")
175
+ })) try {
176
+ if (!await Je(e.id)) {
177
+ E.error(A("botlit.kb.document.notRemoved", "The document could not be removed."));
178
+ return;
179
+ }
180
+ E.success(A("botlit.kb.document.removed", "Document \"{{title}}\" removed", { title: e.title })), await U.refetch(), await H();
94
181
  } catch (e) {
95
- k.error(e instanceof Error ? e.message : "Failed to rebuild the index");
182
+ E.error(e instanceof Error ? e.message : A("botlit.kb.document.removeFailed", "Failed to remove the document"));
96
183
  }
97
- }, $ = (e) => /* @__PURE__ */ S(b, { children: [
98
- /* @__PURE__ */ x(f, {
99
- label: "Name",
184
+ }, $ = (e) => `kb-form-${e}`, at = (e) => /* @__PURE__ */ S(we, { children: [
185
+ /* @__PURE__ */ x(p, {
186
+ label: A("botlit.kb.form.name", "Name"),
100
187
  required: !0,
101
- children: /* @__PURE__ */ x(p, {
102
- placeholder: "e.g., Product Documentation",
103
- value: Z.name,
104
- onChange: (e) => Q({
105
- ...Z,
188
+ htmlFor: $("name"),
189
+ error: Q("name"),
190
+ children: /* @__PURE__ */ x(m, {
191
+ id: $("name"),
192
+ required: !0,
193
+ "aria-invalid": Q("name") ? !0 : void 0,
194
+ "aria-describedby": Q("name") ? `${$("name")}-error` : void 0,
195
+ placeholder: A("botlit.kb.form.namePlaceholder", "e.g., Product Documentation"),
196
+ value: K.name,
197
+ onChange: (e) => q({
198
+ ...K,
106
199
  name: e.target.value
107
200
  })
108
201
  })
109
202
  }),
110
- /* @__PURE__ */ x(f, {
111
- label: "Description",
112
- children: /* @__PURE__ */ x(m, {
113
- placeholder: "What kind of knowledge will this store?",
114
- value: Z.description,
115
- onChange: (e) => Q({
116
- ...Z,
203
+ /* @__PURE__ */ x(p, {
204
+ label: A("botlit.kb.form.description", "Description"),
205
+ htmlFor: $("description"),
206
+ children: /* @__PURE__ */ x(ne, {
207
+ id: $("description"),
208
+ placeholder: A("botlit.kb.form.descriptionPlaceholder", "What kind of knowledge will this store?"),
209
+ value: K.description,
210
+ onChange: (e) => q({
211
+ ...K,
117
212
  description: e.target.value
118
213
  }),
119
214
  rows: 3
120
215
  })
121
216
  }),
122
- e && /* @__PURE__ */ S(f, {
123
- label: "Embedding Model",
217
+ e && /* @__PURE__ */ S(p, {
218
+ label: A("botlit.kb.form.embeddingModel", "Embedding Model"),
124
219
  required: !0,
220
+ htmlFor: $("model"),
221
+ error: Q("embeddingModel"),
125
222
  children: [
126
223
  /* @__PURE__ */ S("select", {
127
- className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
128
- "aria-label": "Embedding Model",
129
- disabled: H || !!U,
130
- value: Z.embeddingModel,
224
+ id: $("model"),
225
+ className: Ie,
226
+ "aria-label": A("botlit.kb.form.embeddingModel", "Embedding Model"),
227
+ required: !0,
228
+ "aria-invalid": Q("embeddingModel") ? !0 : void 0,
229
+ "aria-describedby": Q("embeddingModel") ? `${$("model")}-error` : void 0,
230
+ disabled: L || !!R,
231
+ value: K.embeddingModel,
131
232
  onChange: (e) => {
132
- let t = W.find((t) => t.id === e.target.value);
133
- Q({
134
- ...Z,
233
+ let t = z.find((t) => t.id === e.target.value);
234
+ q({
235
+ ...K,
135
236
  embeddingModel: e.target.value,
136
- embeddingDimensions: t?.dimensions ?? Z.embeddingDimensions
237
+ embeddingDimensions: t?.dimensions ?? K.embeddingDimensions
137
238
  });
138
239
  },
139
240
  children: [/* @__PURE__ */ x("option", {
140
241
  value: "",
141
- children: "Choose a configured embedding model"
142
- }), W.map((e) => /* @__PURE__ */ S("option", {
242
+ children: A("botlit.kb.form.chooseModel", "Choose a configured embedding model")
243
+ }), z.map((e) => /* @__PURE__ */ S("option", {
143
244
  value: e.id,
144
245
  children: [
145
246
  e.label,
@@ -149,346 +250,499 @@ var N = ({ isNew: N }) => {
149
250
  ]
150
251
  }, e.id))]
151
252
  }),
152
- H && /* @__PURE__ */ x("p", {
253
+ L && /* @__PURE__ */ x("p", {
153
254
  role: "status",
154
- children: "Loading configured embedding models…"
255
+ children: A("botlit.kb.form.loadingModels", "Loading configured embedding models…")
155
256
  }),
156
- U && /* @__PURE__ */ S("div", {
257
+ R && /* @__PURE__ */ S("div", {
157
258
  role: "alert",
158
- children: [/* @__PURE__ */ x("p", { children: "Could not load configured models. Try loading the catalog again." }), /* @__PURE__ */ x(d, {
259
+ children: [/* @__PURE__ */ x("p", { children: A("botlit.kb.form.modelsFailed", "Could not load configured models. Try loading the catalog again.") }), /* @__PURE__ */ x(f, {
260
+ type: "button",
159
261
  variant: "secondary",
160
262
  onClick: () => {
161
- R(), me();
263
+ F.refetch(), I.refetch();
162
264
  },
163
- children: "Retry model catalog"
265
+ children: A("botlit.kb.form.retryModels", "Retry model catalog")
164
266
  })]
165
267
  }),
166
- !H && !U && W.length === 0 && /* @__PURE__ */ x("p", {
268
+ !L && !R && z.length === 0 && /* @__PURE__ */ S("div", {
167
269
  className: "text-sm text-text-secondary",
168
- children: "Register an embedding model with an active provider in Settings first."
270
+ children: [/* @__PURE__ */ x("p", { children: A("botlit.kb.form.noModels", "No embedding model is registered yet. Register one with an active provider in Settings first.") }), /* @__PURE__ */ x(f, {
271
+ type: "button",
272
+ variant: "ghost",
273
+ className: "px-0",
274
+ onClick: () => P("settings"),
275
+ children: A("botlit.kb.form.openSettings", "Open Settings")
276
+ })]
169
277
  })
170
278
  ]
171
279
  }),
172
280
  /* @__PURE__ */ S("div", {
173
- className: "grid grid-cols-3 gap-4",
281
+ className: "grid grid-cols-1 gap-4 md:grid-cols-3",
174
282
  children: [
175
- /* @__PURE__ */ x(f, {
176
- label: "Chunking Strategy",
283
+ /* @__PURE__ */ x(p, {
284
+ label: A("botlit.kb.form.strategy", "Chunking Strategy"),
285
+ htmlFor: $("strategy"),
286
+ description: A(`botlit.kb.strategyHelp.${O[Le(K.chunkingStrategy)].key}`, O[Le(K.chunkingStrategy)].fallback),
177
287
  children: /* @__PURE__ */ x("select", {
178
- className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
179
- value: Z.chunkingStrategy,
180
- onChange: (e) => Q({
181
- ...Z,
288
+ id: $("strategy"),
289
+ className: Ie,
290
+ "aria-describedby": `${$("strategy")}-description`,
291
+ value: K.chunkingStrategy,
292
+ onChange: (e) => q({
293
+ ...K,
182
294
  chunkingStrategy: e.target.value
183
295
  }),
184
- children: pe.map((e) => /* @__PURE__ */ x("option", {
296
+ children: D.map((e) => /* @__PURE__ */ x("option", {
185
297
  value: e,
186
298
  children: e
187
299
  }, e))
188
300
  })
189
301
  }),
190
- /* @__PURE__ */ x(f, {
191
- label: "Chunk Size",
192
- children: /* @__PURE__ */ x(p, {
302
+ /* @__PURE__ */ x(p, {
303
+ label: A("botlit.kb.form.chunkSize", "Chunk Size"),
304
+ htmlFor: $("chunk-size"),
305
+ error: Q("chunkSize"),
306
+ description: A("botlit.kb.form.chunkSizeHelp", "In approximate tokens, {{min}} to {{max}}. Empty uses {{default}} when creating.", {
307
+ min: _.min,
308
+ max: _.max,
309
+ default: 512
310
+ }),
311
+ children: /* @__PURE__ */ x(m, {
312
+ id: $("chunk-size"),
193
313
  type: "number",
194
- value: Z.chunkSize,
195
- onChange: (e) => Q({
196
- ...Z,
197
- chunkSize: M(e.target.value, A.chunkSize)
314
+ min: _.min,
315
+ max: _.max,
316
+ step: 1,
317
+ "aria-invalid": Q("chunkSize") ? !0 : void 0,
318
+ "aria-describedby": Q("chunkSize") ? `${$("chunk-size")}-error` : `${$("chunk-size")}-description`,
319
+ value: K.chunkSize,
320
+ onChange: (e) => q({
321
+ ...K,
322
+ chunkSize: e.target.value
198
323
  })
199
324
  })
200
325
  }),
201
- /* @__PURE__ */ x(f, {
202
- label: "Chunk Overlap",
203
- children: /* @__PURE__ */ x(p, {
326
+ /* @__PURE__ */ x(p, {
327
+ label: A("botlit.kb.form.chunkOverlap", "Chunk Overlap"),
328
+ htmlFor: $("chunk-overlap"),
329
+ error: Q("chunkOverlap"),
330
+ description: A("botlit.kb.form.chunkOverlapHelp", "Tokens shared between neighbouring chunks. 0 or more, and below the chunk size."),
331
+ children: /* @__PURE__ */ x(m, {
332
+ id: $("chunk-overlap"),
204
333
  type: "number",
205
- value: Z.chunkOverlap,
206
- onChange: (e) => Q({
207
- ...Z,
208
- chunkOverlap: M(e.target.value, A.chunkOverlap)
334
+ min: 0,
335
+ step: 1,
336
+ "aria-invalid": Q("chunkOverlap") ? !0 : void 0,
337
+ "aria-describedby": Q("chunkOverlap") ? `${$("chunk-overlap")}-error` : `${$("chunk-overlap")}-description`,
338
+ value: K.chunkOverlap,
339
+ onChange: (e) => q({
340
+ ...K,
341
+ chunkOverlap: e.target.value
209
342
  })
210
343
  })
211
344
  })
212
345
  ]
213
346
  })
214
- ] });
215
- return N ? /* @__PURE__ */ x(a, {
216
- title: "Create Knowledge Base",
217
- description: "Set up an embedding index your agents can retrieve from",
347
+ ] }), ot = Ze && Object.keys(Z).length > 0 ? /* @__PURE__ */ S("div", {
348
+ role: "alert",
349
+ className: "flex items-start gap-2 rounded-lg border border-status-error-border bg-status-error-bg-subtle p-3 text-sm text-text-primary",
350
+ children: [/* @__PURE__ */ x(Ee, {
351
+ size: 16,
352
+ className: "mt-0.5 text-status-error-text",
353
+ "aria-hidden": "true"
354
+ }), /* @__PURE__ */ x("p", { children: A("botlit.kb.errors.summary", "Fix the highlighted fields before saving.") })]
355
+ }) : null;
356
+ if (k) return /* @__PURE__ */ x(r, {
357
+ title: A("botlit.kb.createTitle", "Create Knowledge Base"),
358
+ description: A("botlit.kb.createDescription", "Set up an embedding index your agents can retrieve from"),
359
+ leading: /* @__PURE__ */ x(f, {
360
+ variant: "ghost",
361
+ size: "icon",
362
+ "aria-label": A("botlit.kb.back", "Back to knowledge bases"),
363
+ onClick: () => P(N),
364
+ children: /* @__PURE__ */ x(De, {
365
+ size: 20,
366
+ "aria-hidden": "true"
367
+ })
368
+ }),
218
369
  actions: /* @__PURE__ */ S("div", {
219
370
  className: "flex gap-2",
220
- children: [/* @__PURE__ */ x(d, {
371
+ children: [/* @__PURE__ */ x(f, {
221
372
  variant: "outline",
222
- onClick: () => G("knowledge"),
223
- children: "Cancel"
224
- }), /* @__PURE__ */ x(d, {
225
- leftIcon: /* @__PURE__ */ x(D, { size: 16 }),
226
- onClick: Se,
227
- isLoading: _e.loading,
228
- disabled: H || !!U || !Z.name.trim(),
229
- children: "Create"
373
+ onClick: () => P(N),
374
+ children: A("botlit.common.cancel", "Cancel")
375
+ }), /* @__PURE__ */ x(f, {
376
+ type: "submit",
377
+ form: "kb-create-form",
378
+ leftIcon: /* @__PURE__ */ x(C, { size: 16 }),
379
+ isLoading: Ve.loading,
380
+ children: A("botlit.kb.create", "Create")
230
381
  })]
231
382
  }),
232
- children: /* @__PURE__ */ x("div", {
383
+ children: /* @__PURE__ */ S("form", {
384
+ id: "kb-create-form",
385
+ noValidate: !0,
386
+ onSubmit: (e) => void et(e),
233
387
  className: "max-w-3xl space-y-6",
234
- children: /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ S(l, { children: [/* @__PURE__ */ x(u, { children: "Index Configuration" }), /* @__PURE__ */ x(c, { children: "The embedding model and its vector width are fixed once documents are indexed." })] }), /* @__PURE__ */ x(s, {
388
+ children: [ot, /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ x(d, { children: A("botlit.kb.indexConfig", "Index Configuration") }), /* @__PURE__ */ x(l, { children: A("botlit.kb.indexConfigCreateHelp", "The embedding model and its vector width are fixed once documents are indexed.") })] }), /* @__PURE__ */ x(c, {
235
389
  className: "space-y-4",
236
- children: $(!0)
237
- })] })
238
- })
239
- }) : he ? /* @__PURE__ */ x(a, {
240
- title: "Loading...",
241
- children: /* @__PURE__ */ x("div", { className: "h-96 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" })
242
- }) : K ? /* @__PURE__ */ x(a, {
243
- title: /* @__PURE__ */ S("div", {
244
- className: "flex items-center gap-3",
245
- children: [/* @__PURE__ */ x(d, {
246
- variant: "ghost",
247
- size: "icon",
248
- onClick: () => G("knowledge"),
249
- children: /* @__PURE__ */ x(de, { size: 20 })
250
- }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S("div", {
251
- className: "flex items-center gap-2",
252
- children: [/* @__PURE__ */ x("span", { children: K.name }), /* @__PURE__ */ x(h, { status: K.indexStatus })]
253
- }), K.description && /* @__PURE__ */ x("p", {
254
- className: "text-sm font-normal text-text-secondary",
255
- children: K.description
390
+ children: at(!0)
256
391
  })] })]
392
+ })
393
+ });
394
+ if (ze) return /* @__PURE__ */ x(r, {
395
+ title: A("botlit.common.loading", "Loading..."),
396
+ children: /* @__PURE__ */ x("div", {
397
+ role: "status",
398
+ "aria-busy": "true",
399
+ "aria-label": A("botlit.common.loading", "Loading..."),
400
+ className: "h-96 rounded-lg bg-bg-sunken motion-safe:animate-vc-shimmer"
401
+ })
402
+ });
403
+ if (V) return /* @__PURE__ */ x(r, {
404
+ title: A("botlit.kb.errorTitle", "Knowledge Base"),
405
+ children: /* @__PURE__ */ x(o, {
406
+ resource: A("botlit.kb.thisResource", "this knowledge base"),
407
+ error: V,
408
+ onRetry: () => void H()
409
+ })
410
+ });
411
+ if (!B) return /* @__PURE__ */ x(r, {
412
+ title: A("botlit.kb.notFound.title", "Knowledge Base Not Found"),
413
+ children: /* @__PURE__ */ x(ee, {
414
+ illustration: "empty-files",
415
+ title: A("botlit.kb.notFound.title", "Knowledge Base Not Found"),
416
+ description: A("botlit.kb.notFound.description", "This knowledge base doesn't exist."),
417
+ action: /* @__PURE__ */ x(f, {
418
+ onClick: () => P(N),
419
+ children: A("botlit.kb.notFound.back", "Back to Knowledge Bases")
420
+ })
421
+ })
422
+ });
423
+ let st = _e(B.indexStatus), ct = !L && !R && !z.some((e) => e.id === B.embeddingModel);
424
+ return /* @__PURE__ */ x(r, {
425
+ title: B.name,
426
+ leading: /* @__PURE__ */ x(f, {
427
+ variant: "ghost",
428
+ size: "icon",
429
+ "aria-label": A("botlit.kb.back", "Back to knowledge bases"),
430
+ onClick: () => P(N),
431
+ children: /* @__PURE__ */ x(De, {
432
+ size: 20,
433
+ "aria-hidden": "true"
434
+ })
257
435
  }),
436
+ meta: /* @__PURE__ */ x(re, { status: B.indexStatus }),
437
+ description: B.description,
258
438
  actions: /* @__PURE__ */ S("div", {
259
439
  className: "flex gap-2",
260
- children: [/* @__PURE__ */ x(i, {
261
- permission: r.KNOWLEDGE_MANAGE,
262
- children: /* @__PURE__ */ x(d, {
440
+ children: [
441
+ /* @__PURE__ */ x(a, {
442
+ permission: i.KNOWLEDGE_MANAGE,
443
+ children: /* @__PURE__ */ x(f, {
444
+ variant: "outline",
445
+ leftIcon: /* @__PURE__ */ x(Me, { size: 16 }),
446
+ onClick: () => void nt(),
447
+ isLoading: Ge.loading,
448
+ children: A("botlit.kb.rebuild", "Rebuild Index")
449
+ })
450
+ }),
451
+ Xe ? /* @__PURE__ */ S(we, { children: [/* @__PURE__ */ x(f, {
263
452
  variant: "outline",
264
- leftIcon: /* @__PURE__ */ x(E, { size: 16 }),
265
- onClick: we,
266
- isLoading: xe.loading,
267
- children: "Rebuild Index"
268
- })
269
- }), Y ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(d, {
270
- variant: "outline",
271
- onClick: () => {
272
- Q(j(K)), X(!1);
273
- },
274
- children: "Cancel"
275
- }), /* @__PURE__ */ x(d, {
276
- leftIcon: /* @__PURE__ */ x(D, { size: 16 }),
277
- onClick: Ce,
278
- isLoading: ye.loading,
279
- children: "Save"
280
- })] }) : /* @__PURE__ */ x(i, {
281
- permission: r.KNOWLEDGE_UPDATE,
282
- children: /* @__PURE__ */ x(d, {
283
- leftIcon: /* @__PURE__ */ x(O, { size: 16 }),
284
- onClick: () => X(!0),
285
- children: "Configure"
453
+ onClick: () => {
454
+ q(Fe(B)), G(!1), J(!1);
455
+ },
456
+ children: A("botlit.common.cancel", "Cancel")
457
+ }), /* @__PURE__ */ x(f, {
458
+ type: "submit",
459
+ form: "kb-edit-form",
460
+ leftIcon: /* @__PURE__ */ x(C, { size: 16 }),
461
+ isLoading: Ue.loading,
462
+ children: A("botlit.kb.save", "Save")
463
+ })] }) : /* @__PURE__ */ x(a, {
464
+ permission: i.KNOWLEDGE_UPDATE,
465
+ children: /* @__PURE__ */ x(f, {
466
+ leftIcon: /* @__PURE__ */ x(w, { size: 16 }),
467
+ onClick: () => G(!0),
468
+ children: A("botlit.kb.configure", "Configure")
469
+ })
470
+ }),
471
+ j(i.KNOWLEDGE_DELETE) && /* @__PURE__ */ x(f, {
472
+ variant: "destructive",
473
+ leftIcon: /* @__PURE__ */ x(T, { size: 16 }),
474
+ isLoading: qe.loading,
475
+ onClick: () => void rt(),
476
+ children: A("botlit.common.delete", "Delete")
286
477
  })
287
- })]
478
+ ]
288
479
  }),
289
480
  children: /* @__PURE__ */ S("div", {
290
481
  className: "space-y-6",
291
482
  children: [
292
- /* @__PURE__ */ x(le, {
293
- icon: /* @__PURE__ */ x(C, { size: 18 }),
294
- children: "This knowledge base is one searchable library your agents can draw on. Review how its documents are chunked and indexed, rebuild the index when content changes, and confirm it is healthy — so agents retrieve accurate, up-to-date passages and can cite them in their answers."
483
+ /* @__PURE__ */ x(Ce, {
484
+ icon: /* @__PURE__ */ x(ke, { size: 18 }),
485
+ children: A("botlit.kb.purpose", "This knowledge base is one searchable library your agents can draw on. Review how its documents are chunked and indexed, rebuild the index when content changes, and confirm it is healthy, so agents retrieve accurate, up-to-date passages and can cite them in their answers.")
486
+ }),
487
+ /* @__PURE__ */ S("p", {
488
+ role: "status",
489
+ className: "text-sm text-text-secondary",
490
+ "data-testid": "kb-status-help",
491
+ children: [A(`botlit.kb.statusHelp.${st.key}`, st.fallback), X && ` ${A("botlit.kb.refreshing", "This page refreshes by itself while indexing runs.")}`]
492
+ }),
493
+ Ge.loading && /* @__PURE__ */ x("p", {
494
+ role: "status",
495
+ className: "text-sm text-text-secondary",
496
+ children: A("botlit.kb.rebuilding", "Rebuilding the index. This can take a few minutes for a large library.")
497
+ }),
498
+ Qe && /* @__PURE__ */ x("p", {
499
+ role: "alert",
500
+ className: "text-sm text-status-warning-text",
501
+ children: Qe
502
+ }),
503
+ ct && /* @__PURE__ */ S("div", {
504
+ role: "alert",
505
+ "data-testid": "kb-model-warning",
506
+ className: "flex items-start gap-2 rounded-lg border border-status-warning-border bg-status-warning-bg-subtle p-3 text-sm",
507
+ children: [/* @__PURE__ */ x(Ee, {
508
+ size: 16,
509
+ className: "mt-0.5 shrink-0 text-status-warning-text",
510
+ "aria-hidden": "true"
511
+ }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", { children: A("botlit.kb.modelWarning", "The embedding model of this knowledge base ({{model}}) is no longer available: it was deleted or turned off, or its provider was. Documents cannot be indexed and searches fail until a usable model is registered again in Settings.", { model: B.embeddingModel }) }), /* @__PURE__ */ x(f, {
512
+ type: "button",
513
+ variant: "ghost",
514
+ className: "px-0",
515
+ onClick: () => P("settings"),
516
+ children: A("botlit.kb.form.openSettings", "Open Settings")
517
+ })] })]
295
518
  }),
296
519
  /* @__PURE__ */ S("div", {
297
- className: "grid grid-cols-2 md:grid-cols-4 gap-4",
520
+ className: "grid grid-cols-2 gap-4 md:grid-cols-4",
298
521
  children: [
299
- /* @__PURE__ */ S(ce, {
522
+ /* @__PURE__ */ S(Se, {
300
523
  treatment: "glass",
301
524
  glow: !0,
302
525
  className: "p-6 text-center",
303
526
  children: [
304
527
  /* @__PURE__ */ x("div", {
305
- className: "p-3 rounded-full bg-action-primary-bg/10 w-fit mx-auto mb-2",
306
- children: /* @__PURE__ */ x(C, { className: "h-5 w-5 text-primary" })
528
+ className: "mx-auto mb-2 w-fit rounded-full bg-action-primary-bg/10 p-3",
529
+ children: /* @__PURE__ */ x(ke, {
530
+ className: "h-5 w-5 text-primary",
531
+ "aria-hidden": "true"
532
+ })
307
533
  }),
308
534
  /* @__PURE__ */ x("p", {
309
- className: "text-lg font-bold text-text-primary capitalize",
310
- children: K.indexStatus.toLowerCase()
535
+ className: "text-lg font-bold capitalize text-text-primary",
536
+ children: B.indexStatus.toLowerCase()
311
537
  }),
312
538
  /* @__PURE__ */ x("p", {
313
539
  className: "text-sm text-text-secondary",
314
- children: "Index Status"
540
+ children: A("botlit.kb.indexStatus", "Index Status")
315
541
  })
316
542
  ]
317
543
  }),
318
- /* @__PURE__ */ x(o, { children: /* @__PURE__ */ S(s, {
544
+ /* @__PURE__ */ x(s, { children: /* @__PURE__ */ S(c, {
319
545
  className: "pt-6 text-center",
320
546
  children: [/* @__PURE__ */ x("p", {
321
547
  className: "text-3xl font-bold text-text-primary",
322
- children: K.totalDocuments
548
+ children: B.totalDocuments
323
549
  }), /* @__PURE__ */ x("p", {
324
550
  className: "text-sm text-text-secondary",
325
- children: "Documents"
551
+ children: A("botlit.kb.documents", "Documents")
326
552
  })]
327
553
  }) }),
328
- /* @__PURE__ */ x(o, { children: /* @__PURE__ */ S(s, {
554
+ /* @__PURE__ */ x(s, { children: /* @__PURE__ */ S(c, {
329
555
  className: "pt-6 text-center",
330
556
  children: [/* @__PURE__ */ x("p", {
331
557
  className: "text-3xl font-bold text-text-primary",
332
- children: K.totalChunks
558
+ children: B.totalChunks
333
559
  }), /* @__PURE__ */ x("p", {
334
560
  className: "text-sm text-text-secondary",
335
- children: "Chunks"
561
+ children: A("botlit.kb.chunks", "Chunks")
336
562
  })]
337
563
  }) }),
338
- /* @__PURE__ */ x(o, { children: /* @__PURE__ */ S(s, {
564
+ /* @__PURE__ */ x(s, { children: /* @__PURE__ */ S(c, {
339
565
  className: "pt-6 text-center",
340
566
  children: [/* @__PURE__ */ x("p", {
341
567
  className: "text-3xl font-bold text-text-primary",
342
- children: K.vectorCount
568
+ children: B.vectorCount
343
569
  }), /* @__PURE__ */ x("p", {
344
570
  className: "text-sm text-text-secondary",
345
- children: "Vectors"
571
+ children: A("botlit.kb.vectors", "Vectors")
346
572
  })]
347
573
  }) })
348
574
  ]
349
575
  }),
350
- /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ S(l, { children: [/* @__PURE__ */ S(u, {
576
+ /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ S(d, {
351
577
  className: "flex items-center gap-2",
352
- children: [/* @__PURE__ */ x(T, { size: 18 }), "Index Configuration"]
353
- }), /* @__PURE__ */ x(c, { children: "How documents are embedded and split before they are indexed" })] }), /* @__PURE__ */ x(s, {
578
+ children: [/* @__PURE__ */ x(je, {
579
+ size: 18,
580
+ "aria-hidden": "true"
581
+ }), A("botlit.kb.indexConfig", "Index Configuration")]
582
+ }), /* @__PURE__ */ x(l, { children: A("botlit.kb.indexConfigHelp", "How documents are embedded and split before they are indexed") })] }), /* @__PURE__ */ x(c, {
354
583
  className: "space-y-4",
355
- children: Y ? $(!1) : /* @__PURE__ */ S("div", {
356
- className: "grid grid-cols-2 md:grid-cols-3 gap-6",
584
+ children: Xe ? /* @__PURE__ */ S("form", {
585
+ id: "kb-edit-form",
586
+ noValidate: !0,
587
+ onSubmit: (e) => void tt(e),
588
+ className: "space-y-4",
589
+ children: [ot, at(!1)]
590
+ }) : /* @__PURE__ */ S("div", {
591
+ className: "grid grid-cols-2 gap-6 md:grid-cols-3",
357
592
  children: [
358
593
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
359
594
  className: "text-sm text-text-secondary",
360
- children: "Embedding Model"
595
+ children: A("botlit.kb.embeddingModel", "Embedding Model")
361
596
  }), /* @__PURE__ */ x("p", {
362
- className: "font-medium font-mono text-sm",
363
- children: K.embeddingModel
597
+ className: "font-mono text-sm font-medium",
598
+ children: B.embeddingModel
364
599
  })] }),
365
600
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
366
601
  className: "text-sm text-text-secondary",
367
- children: "Dimensions"
602
+ children: A("botlit.kb.dimensions", "Dimensions")
368
603
  }), /* @__PURE__ */ x("p", {
369
604
  className: "font-medium",
370
- children: K.embeddingDimensions
605
+ children: B.embeddingDimensions
371
606
  })] }),
372
607
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
373
608
  className: "text-sm text-text-secondary",
374
- children: "Chunking Strategy"
609
+ children: A("botlit.kb.form.strategy", "Chunking Strategy")
375
610
  }), /* @__PURE__ */ x("p", {
376
611
  className: "font-medium",
377
- children: K.chunkingStrategy
612
+ children: B.chunkingStrategy
378
613
  })] }),
379
614
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
380
615
  className: "text-sm text-text-secondary",
381
- children: "Chunk Size"
616
+ children: A("botlit.kb.form.chunkSize", "Chunk Size")
382
617
  }), /* @__PURE__ */ x("p", {
383
618
  className: "font-medium",
384
- children: K.chunkSize
619
+ children: B.chunkSize
385
620
  })] }),
386
621
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
387
622
  className: "text-sm text-text-secondary",
388
- children: "Chunk Overlap"
623
+ children: A("botlit.kb.form.chunkOverlap", "Chunk Overlap")
389
624
  }), /* @__PURE__ */ x("p", {
390
625
  className: "font-medium",
391
- children: K.chunkOverlap
626
+ children: B.chunkOverlap
392
627
  })] }),
393
628
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
394
629
  className: "text-sm text-text-secondary",
395
- children: "Last Indexed"
630
+ children: A("botlit.kb.lastIndexed", "Last Indexed")
396
631
  }), /* @__PURE__ */ x("p", {
397
632
  className: "font-medium",
398
- children: K.lastIndexedAt ? v(K.lastIndexedAt) : "Never"
633
+ children: B.lastIndexedAt ? g(B.lastIndexedAt) : A("botlit.kb.never", "Never")
399
634
  })] })
400
635
  ]
401
636
  })
402
637
  })] }),
403
- !N && P && /* @__PURE__ */ x(i, {
404
- permission: r.KNOWLEDGE_MANAGE,
405
- children: /* @__PURE__ */ x(te, { knowledgeBaseId: P })
638
+ M && /* @__PURE__ */ x(a, {
639
+ permission: i.KNOWLEDGE_MANAGE,
640
+ children: /* @__PURE__ */ x(n, { knowledgeBaseId: M })
406
641
  }),
407
- /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ S(l, { children: [/* @__PURE__ */ S(u, {
642
+ /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ S(d, {
408
643
  className: "flex items-center gap-2",
409
- children: [
410
- /* @__PURE__ */ x(w, { size: 18 }),
411
- "Documents (",
412
- J.length,
413
- ")"
414
- ]
415
- }), /* @__PURE__ */ x(c, { children: "Source documents indexed into this knowledge base" })] }), /* @__PURE__ */ x(s, {
644
+ children: [/* @__PURE__ */ x(Ae, {
645
+ size: 18,
646
+ "aria-hidden": "true"
647
+ }), A("botlit.kb.documentsTitle", "Documents ({{count}})", { count: B.totalDocuments })]
648
+ }), /* @__PURE__ */ x(l, { children: A("botlit.kb.documentsHelp", "Source documents indexed into this knowledge base") })] }), /* @__PURE__ */ x(c, {
416
649
  className: "p-0",
417
- children: J.length > 0 ? /* @__PURE__ */ x("div", {
650
+ children: U.loading ? /* @__PURE__ */ x("p", {
651
+ role: "status",
652
+ "aria-busy": "true",
653
+ className: "p-8 text-center text-text-secondary",
654
+ children: A("botlit.kb.documentsLoading", "Loading documents…")
655
+ }) : U.error ? /* @__PURE__ */ x("div", {
656
+ className: "p-4",
657
+ children: /* @__PURE__ */ x(o, {
658
+ resource: A("botlit.kb.documentsResource", "documents"),
659
+ error: U.error,
660
+ onRetry: () => void U.refetch()
661
+ })
662
+ }) : W.length > 0 ? /* @__PURE__ */ x("ul", {
418
663
  className: "divide-y divide-border-subtle",
419
- children: J.map((e) => /* @__PURE__ */ S("div", {
664
+ children: W.map((e) => /* @__PURE__ */ S("li", {
420
665
  className: "flex items-center justify-between gap-4 p-4",
421
666
  children: [/* @__PURE__ */ S("div", {
422
667
  className: "min-w-0",
423
668
  children: [
424
669
  /* @__PURE__ */ x("p", {
425
- className: "font-medium truncate",
670
+ className: "truncate font-medium",
426
671
  children: e.title
427
672
  }),
428
- /* @__PURE__ */ S("p", {
673
+ /* @__PURE__ */ x("p", {
429
674
  className: "text-sm text-text-secondary",
430
- children: [
431
- e.chunkCount,
432
- " chunks · added ",
433
- v(e.addedAt)
434
- ]
675
+ children: A("botlit.kb.document.meta", "{{chunks}} chunks · added {{added}}", {
676
+ chunks: e.chunkCount,
677
+ added: g(e.addedAt)
678
+ })
435
679
  }),
436
680
  e.processingError && /* @__PURE__ */ x("p", {
437
681
  className: "mt-1 text-sm text-status-error-text",
438
682
  children: e.processingError
439
683
  })
440
684
  ]
441
- }), /* @__PURE__ */ x(h, { status: e.status })]
685
+ }), /* @__PURE__ */ S("div", {
686
+ className: "flex items-center gap-3",
687
+ children: [/* @__PURE__ */ x(re, { status: e.status }), j(i.KNOWLEDGE_DELETE) && /* @__PURE__ */ x(f, {
688
+ variant: "ghost",
689
+ size: "icon",
690
+ "aria-label": A("botlit.kb.document.removeFor", "Remove {{title}}", { title: e.title }),
691
+ onClick: () => void it(e),
692
+ children: /* @__PURE__ */ x(T, {
693
+ size: 16,
694
+ "aria-hidden": "true"
695
+ })
696
+ })]
697
+ })]
442
698
  }, e.id))
443
699
  }) : /* @__PURE__ */ S("div", {
444
700
  className: "p-8 text-center text-text-secondary",
445
- children: [/* @__PURE__ */ x(fe, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }), /* @__PURE__ */ x("p", { children: "No documents indexed yet" })]
701
+ children: [/* @__PURE__ */ x(Oe, {
702
+ className: "mx-auto mb-2 h-8 w-8 opacity-50",
703
+ "aria-hidden": "true"
704
+ }), /* @__PURE__ */ x("p", { children: A("botlit.kb.noDocuments", "No documents indexed yet") })]
446
705
  })
447
706
  })] }),
448
- /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(l, { children: /* @__PURE__ */ S(u, {
707
+ /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ S(d, {
449
708
  className: "flex items-center gap-2",
450
- children: [/* @__PURE__ */ x(O, { size: 18 }), "Metadata"]
451
- }) }), /* @__PURE__ */ x(s, { children: /* @__PURE__ */ S("div", {
452
- className: "grid grid-cols-2 md:grid-cols-3 gap-6 text-sm",
709
+ children: [/* @__PURE__ */ x(w, {
710
+ size: 18,
711
+ "aria-hidden": "true"
712
+ }), A("botlit.kb.metadata", "Metadata")]
713
+ }) }), /* @__PURE__ */ x(c, { children: /* @__PURE__ */ S("div", {
714
+ className: "grid grid-cols-2 gap-6 text-sm md:grid-cols-3",
453
715
  children: [
454
716
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
455
717
  className: "text-text-secondary",
456
- children: "Created"
718
+ children: A("botlit.kb.createdAt", "Created")
457
719
  }), /* @__PURE__ */ x("p", {
458
720
  className: "font-medium",
459
- children: v(K.createdAt)
721
+ children: g(B.createdAt)
460
722
  })] }),
461
723
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
462
724
  className: "text-text-secondary",
463
- children: "Updated"
725
+ children: A("botlit.kb.updatedLabel", "Updated")
464
726
  }), /* @__PURE__ */ x("p", {
465
727
  className: "font-medium",
466
- children: v(K.updatedAt)
728
+ children: g(B.updatedAt)
467
729
  })] }),
468
730
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
469
731
  className: "text-text-secondary",
470
- children: "Last Indexed"
732
+ children: A("botlit.kb.lastIndexed", "Last Indexed")
471
733
  }), /* @__PURE__ */ x("p", {
472
734
  className: "font-medium",
473
- children: K.lastIndexedAt ? v(K.lastIndexedAt) : "—"
735
+ children: B.lastIndexedAt ? g(B.lastIndexedAt) : "—"
474
736
  })] })
475
737
  ]
476
738
  }) })] })
477
739
  ]
478
740
  })
479
- }) : /* @__PURE__ */ x(a, {
480
- title: "Knowledge Base Not Found",
481
- children: /* @__PURE__ */ x(ne, {
482
- illustration: "empty-files",
483
- title: "Knowledge Base Not Found",
484
- description: "This knowledge base doesn't exist.",
485
- action: /* @__PURE__ */ x(d, {
486
- onClick: () => G("knowledge"),
487
- children: "Back to Knowledge Bases"
488
- })
489
- })
490
741
  });
491
742
  };
492
- export { N as KnowledgeBaseDetailPage };
743
+ function Le(e) {
744
+ return D.find((t) => t === e) ?? "RECURSIVE";
745
+ }
746
+ export { k as KnowledgeBaseDetailPage };
493
747
 
494
748
  //# sourceMappingURL=KnowledgeBaseDetailPage.js.map