@burdenoff/microfe-botmanor 2026.1127.1 → 2026.1127.2
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.
- package/dist/botlit/BotmanorRootInner.js +45 -44
- package/dist/botlit/BotmanorRootInner.js.map +1 -1
- package/dist/botlit/components/AgentA2APanel.js +63 -62
- package/dist/botlit/components/AgentA2APanel.js.map +1 -1
- package/dist/botlit/components/AgentBindingsPanel.js +125 -124
- package/dist/botlit/components/AgentBindingsPanel.js.map +1 -1
- package/dist/botlit/components/AgentFallbackModelsPicker.js +56 -55
- package/dist/botlit/components/AgentFallbackModelsPicker.js.map +1 -1
- package/dist/botlit/components/AiOperationsPanel.js.map +1 -1
- package/dist/botlit/components/AssistantChannelPanel.js +40 -39
- package/dist/botlit/components/AssistantChannelPanel.js.map +1 -1
- package/dist/botlit/components/AssistantRuntimeSetupPanel.js +36 -35
- package/dist/botlit/components/AssistantRuntimeSetupPanel.js.map +1 -1
- package/dist/botlit/components/BotAgentsPanel.js +104 -103
- package/dist/botlit/components/BotAgentsPanel.js.map +1 -1
- package/dist/botlit/components/BotFormFields.js +118 -117
- package/dist/botlit/components/BotFormFields.js.map +1 -1
- package/dist/botlit/components/BucketDialogs.js +110 -110
- package/dist/botlit/components/BucketDialogs.js.map +1 -1
- package/dist/botlit/components/ChannelRoutesPanel.js +29 -28
- package/dist/botlit/components/ChannelRoutesPanel.js.map +1 -1
- package/dist/botlit/components/CreateChannelRouteDialog.js +105 -105
- package/dist/botlit/components/CreateChannelRouteDialog.js.map +1 -1
- package/dist/botlit/components/DescribeBotDialog.js +86 -86
- package/dist/botlit/components/DescribeBotDialog.js.map +1 -1
- package/dist/botlit/components/EmptyState.d.ts +8 -0
- package/dist/botlit/components/EmptyState.js +43 -30
- package/dist/botlit/components/EmptyState.js.map +1 -1
- package/dist/botlit/components/HandoffConfigPanel.js +125 -124
- package/dist/botlit/components/HandoffConfigPanel.js.map +1 -1
- package/dist/botlit/components/HandoffTargetPickers.js +42 -41
- package/dist/botlit/components/HandoffTargetPickers.js.map +1 -1
- package/dist/botlit/components/KnowledgeBackendMigrationPanel.js +106 -105
- package/dist/botlit/components/KnowledgeBackendMigrationPanel.js.map +1 -1
- package/dist/botlit/components/KnowledgeRetrievalTestPanel.js +76 -75
- package/dist/botlit/components/KnowledgeRetrievalTestPanel.js.map +1 -1
- package/dist/botlit/components/KnowledgeSourceImportPanel.js +76 -75
- package/dist/botlit/components/KnowledgeSourceImportPanel.js.map +1 -1
- package/dist/botlit/components/ModelRegistrationPanel.js +70 -69
- package/dist/botlit/components/ModelRegistrationPanel.js.map +1 -1
- package/dist/botlit/components/StorePackageDraftCard.js +87 -86
- package/dist/botlit/components/StorePackageDraftCard.js.map +1 -1
- package/dist/botlit/components/SuggestionsPanel.js.map +1 -1
- package/dist/botlit/pages/A2AAgentDetailPage.js +263 -262
- package/dist/botlit/pages/A2AAgentDetailPage.js.map +1 -1
- package/dist/botlit/pages/A2ARegistryPage.js +47 -46
- package/dist/botlit/pages/A2ARegistryPage.js.map +1 -1
- package/dist/botlit/pages/AgentBuilderPage.js +426 -425
- package/dist/botlit/pages/AgentBuilderPage.js.map +1 -1
- package/dist/botlit/pages/AgentDetailPage.js +1 -0
- package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
- package/dist/botlit/pages/AgentsListPage.js +248 -247
- package/dist/botlit/pages/AgentsListPage.js.map +1 -1
- package/dist/botlit/pages/BotChannelsTab.js +324 -310
- package/dist/botlit/pages/BotChannelsTab.js.map +1 -1
- package/dist/botlit/pages/BotDetailPage.js +1 -0
- package/dist/botlit/pages/BotDetailPage.js.map +1 -1
- package/dist/botlit/pages/BotWorkflowTab.js +126 -121
- package/dist/botlit/pages/BotWorkflowTab.js.map +1 -1
- package/dist/botlit/pages/BotsListPage.js +1 -0
- package/dist/botlit/pages/BotsListPage.js.map +1 -1
- package/dist/botlit/pages/BucketDetailPage.js +1 -0
- package/dist/botlit/pages/BucketDetailPage.js.map +1 -1
- package/dist/botlit/pages/BucketsPage.js +1 -0
- package/dist/botlit/pages/BucketsPage.js.map +1 -1
- package/dist/botlit/pages/ChannelDetailPage.js +267 -266
- package/dist/botlit/pages/ChannelDetailPage.js.map +1 -1
- package/dist/botlit/pages/ChannelsPage.js +187 -186
- package/dist/botlit/pages/ChannelsPage.js.map +1 -1
- package/dist/botlit/pages/ChatPage.js +69 -68
- package/dist/botlit/pages/ChatPage.js.map +1 -1
- package/dist/botlit/pages/ExecutionDetailPage.js +1 -0
- package/dist/botlit/pages/ExecutionDetailPage.js.map +1 -1
- package/dist/botlit/pages/ExecutionsPage.js +191 -191
- package/dist/botlit/pages/ExecutionsPage.js.map +1 -1
- package/dist/botlit/pages/HandoffsPage.js +65 -64
- package/dist/botlit/pages/HandoffsPage.js.map +1 -1
- package/dist/botlit/pages/InstalledPackagesPage.js +146 -145
- package/dist/botlit/pages/InstalledPackagesPage.js.map +1 -1
- package/dist/botlit/pages/KnowledgeBaseDetailPage.js +235 -234
- package/dist/botlit/pages/KnowledgeBaseDetailPage.js.map +1 -1
- package/dist/botlit/pages/KnowledgeBasesPage.js +152 -151
- package/dist/botlit/pages/KnowledgeBasesPage.js.map +1 -1
- package/dist/botlit/pages/MCPServerDetailPage.js +180 -179
- package/dist/botlit/pages/MCPServerDetailPage.js.map +1 -1
- package/dist/botlit/pages/MCPServersPage.js +145 -145
- package/dist/botlit/pages/MCPServersPage.js.map +1 -1
- package/dist/botlit/pages/PoliciesPage.js.map +1 -1
- package/dist/botlit/pages/PolicyDetailPage.js +293 -292
- package/dist/botlit/pages/PolicyDetailPage.js.map +1 -1
- package/dist/botlit/pages/PromptStudioPage.js +229 -229
- package/dist/botlit/pages/PromptStudioPage.js.map +1 -1
- package/dist/botlit/pages/PromptTemplateDetailPage.js +280 -279
- package/dist/botlit/pages/PromptTemplateDetailPage.js.map +1 -1
- package/dist/botlit/pages/PromptTemplatesPage.js +31 -30
- package/dist/botlit/pages/PromptTemplatesPage.js.map +1 -1
- package/dist/botlit/pages/RetrievalProfileDetailPage.js +204 -203
- package/dist/botlit/pages/RetrievalProfileDetailPage.js.map +1 -1
- package/dist/botlit/pages/RetrievalProfilesPage.js.map +1 -1
- package/dist/botlit/pages/SettingsPage.js +153 -153
- package/dist/botlit/pages/SettingsPage.js.map +1 -1
- package/dist/botlit/pages/SkillDetailPage.js +305 -304
- package/dist/botlit/pages/SkillDetailPage.js.map +1 -1
- package/dist/botlit/pages/SkillsPage.js.map +1 -1
- package/dist/botlit/pages/StorePackageDetailPage.js +1 -0
- package/dist/botlit/pages/StorePackageDetailPage.js.map +1 -1
- package/dist/botlit/pages/StorePage.js +173 -173
- package/dist/botlit/pages/StorePage.js.map +1 -1
- package/dist/botlit/utils/confirmAction.d.ts +13 -11
- package/dist/botlit/utils/confirmAction.js +26 -4
- package/dist/botlit/utils/confirmAction.js.map +1 -1
- package/package.json +3 -3
|
@@ -4,32 +4,33 @@ import { memberRoleOptions as n, nextListboxIndex as r, teammateCandidates as i
|
|
|
4
4
|
import { Button as a } from "./Button.js";
|
|
5
5
|
import { Input as o } from "./Input.js";
|
|
6
6
|
import { useMemo as s, useState as c } from "react";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { ThemedSelect as l } from "@burdenoff/fe-libs/ui";
|
|
8
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
|
+
import { X as f } from "lucide-react";
|
|
9
10
|
// src/botlit/components/HandoffTargetPickers.tsx
|
|
10
|
-
var
|
|
11
|
+
var p = "h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 text-sm text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary", m = 50, h = ({ label: n, value: r, byId: i, onChange: o }) => {
|
|
11
12
|
let s = e();
|
|
12
|
-
return r.length === 0 ? null : /* @__PURE__ */
|
|
13
|
+
return r.length === 0 ? null : /* @__PURE__ */ u("ul", {
|
|
13
14
|
className: "flex flex-wrap gap-2",
|
|
14
15
|
"aria-label": n,
|
|
15
16
|
children: r.map((e) => {
|
|
16
17
|
let n = i.get(e), c = n?.displayName ?? t(e);
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ d("li", {
|
|
18
19
|
className: "flex items-center gap-1 rounded-full border border-border-subtle bg-bg-sunken py-0.5 pl-3 pr-1",
|
|
19
20
|
children: [
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
n ? null : /* @__PURE__ */
|
|
21
|
+
/* @__PURE__ */ u("span", { children: c }),
|
|
22
|
+
n ? null : /* @__PURE__ */ u("span", {
|
|
22
23
|
className: "text-xs text-text-secondary",
|
|
23
24
|
children: s("botlit.handoffs.config.notAMember", "(not in this workspace)")
|
|
24
25
|
}),
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ u(a, {
|
|
26
27
|
type: "button",
|
|
27
28
|
variant: "ghost",
|
|
28
29
|
size: "icon",
|
|
29
30
|
className: "h-6 w-6",
|
|
30
31
|
"aria-label": s("botlit.handoffs.config.removeTeammate", "Remove {{name}}", { name: c }),
|
|
31
32
|
onClick: () => o(r.filter((t) => t !== e)),
|
|
32
|
-
children: /* @__PURE__ */
|
|
33
|
+
children: /* @__PURE__ */ u(f, {
|
|
33
34
|
size: 12,
|
|
34
35
|
"aria-hidden": "true"
|
|
35
36
|
})
|
|
@@ -38,14 +39,14 @@ var f = "h-10 w-full rounded-md border border-border-default bg-bg-surface px-3
|
|
|
38
39
|
}, e);
|
|
39
40
|
})
|
|
40
41
|
});
|
|
41
|
-
},
|
|
42
|
+
}, g = ({ listId: t, optionId: n, options: r, activeIndex: i, onHighlight: a, onChoose: o }) => {
|
|
42
43
|
let s = e();
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
+
return /* @__PURE__ */ u("ul", {
|
|
44
45
|
id: t,
|
|
45
46
|
role: "listbox",
|
|
46
47
|
className: "max-h-48 overflow-y-auto rounded-md border border-border-subtle",
|
|
47
48
|
"aria-label": s("botlit.handoffs.config.teammates", "Teammates"),
|
|
48
|
-
children: r.map((e, t) => /* @__PURE__ */
|
|
49
|
+
children: r.map((e, t) => /* @__PURE__ */ d("li", {
|
|
49
50
|
id: n(e.userId),
|
|
50
51
|
role: "option",
|
|
51
52
|
"aria-selected": t === i,
|
|
@@ -53,50 +54,50 @@ var f = "h-10 w-full rounded-md border border-border-default bg-bg-surface px-3
|
|
|
53
54
|
onMouseDown: (e) => e.preventDefault(),
|
|
54
55
|
onMouseEnter: () => a(t),
|
|
55
56
|
onClick: () => o(e.userId),
|
|
56
|
-
children: [/* @__PURE__ */
|
|
57
|
+
children: [/* @__PURE__ */ d("span", { children: [/* @__PURE__ */ u("span", {
|
|
57
58
|
className: "font-medium text-text-primary",
|
|
58
59
|
children: e.displayName
|
|
59
|
-
}), e.email ? /* @__PURE__ */
|
|
60
|
+
}), e.email ? /* @__PURE__ */ u("span", {
|
|
60
61
|
className: "ml-2 text-text-secondary",
|
|
61
62
|
children: e.email
|
|
62
|
-
}) : null] }), /* @__PURE__ */
|
|
63
|
+
}) : null] }), /* @__PURE__ */ u("span", {
|
|
63
64
|
className: "text-xs text-text-secondary",
|
|
64
65
|
children: e.role
|
|
65
66
|
})]
|
|
66
67
|
}, e.userId))
|
|
67
68
|
});
|
|
68
|
-
},
|
|
69
|
+
}, _ = ({ loading: t, query: n }) => {
|
|
69
70
|
let r = e();
|
|
70
|
-
return t ? /* @__PURE__ */
|
|
71
|
+
return t ? /* @__PURE__ */ u("p", {
|
|
71
72
|
role: "status",
|
|
72
73
|
className: "text-text-secondary",
|
|
73
74
|
children: r("botlit.handoffs.config.loadingMembers", "Loading teammates…")
|
|
74
|
-
}) : /* @__PURE__ */
|
|
75
|
+
}) : /* @__PURE__ */ u("p", {
|
|
75
76
|
className: "text-text-secondary",
|
|
76
77
|
children: n.trim() ? r("botlit.handoffs.config.noTeammateMatch", "No teammate matches \"{{query}}\".", { query: n.trim() }) : r("botlit.handoffs.config.allTeammatesChosen", "Every teammate is already chosen.")
|
|
77
78
|
});
|
|
78
|
-
},
|
|
79
|
-
let x = e(), [S, C] = c(""), [w, T] = c(0), E = s(() => new Map(
|
|
79
|
+
}, v = ({ id: t, label: n, members: l, loading: f, error: p, onRetry: v, value: y, onChange: b }) => {
|
|
80
|
+
let x = e(), [S, C] = c(""), [w, T] = c(0), E = s(() => new Map(l.map((e) => [e.userId, e])), [l]), D = i(l, y, S).slice(0, m), O = `${t}-options`, k = (e) => `${t}-option-${e}`, A = Math.min(w, D.length - 1), j = D[A], M = !f && D.length > 0, N = (e) => {
|
|
80
81
|
b([...y, e]), C(""), T(0);
|
|
81
82
|
};
|
|
82
|
-
return
|
|
83
|
+
return p ? /* @__PURE__ */ d("div", {
|
|
83
84
|
className: "grid gap-2 text-sm",
|
|
84
85
|
children: [
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ u("label", {
|
|
86
87
|
htmlFor: t,
|
|
87
88
|
className: "font-medium text-text-primary",
|
|
88
89
|
children: n
|
|
89
90
|
}),
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ u(h, {
|
|
91
92
|
label: n,
|
|
92
93
|
value: y,
|
|
93
94
|
byId: E,
|
|
94
95
|
onChange: b
|
|
95
96
|
}),
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
+
/* @__PURE__ */ d("div", {
|
|
97
98
|
role: "alert",
|
|
98
99
|
className: "flex flex-wrap items-center gap-2 text-status-error-text",
|
|
99
|
-
children: [/* @__PURE__ */
|
|
100
|
+
children: [/* @__PURE__ */ u("span", { children: p.message }), /* @__PURE__ */ u(a, {
|
|
100
101
|
type: "button",
|
|
101
102
|
size: "sm",
|
|
102
103
|
variant: "outline",
|
|
@@ -105,21 +106,21 @@ var f = "h-10 w-full rounded-md border border-border-default bg-bg-surface px-3
|
|
|
105
106
|
})]
|
|
106
107
|
})
|
|
107
108
|
]
|
|
108
|
-
}) : /* @__PURE__ */
|
|
109
|
+
}) : /* @__PURE__ */ d("div", {
|
|
109
110
|
className: "grid gap-2 text-sm",
|
|
110
111
|
children: [
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ u("label", {
|
|
112
113
|
htmlFor: t,
|
|
113
114
|
className: "font-medium text-text-primary",
|
|
114
115
|
children: n
|
|
115
116
|
}),
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ u(h, {
|
|
117
118
|
label: n,
|
|
118
119
|
value: y,
|
|
119
120
|
byId: E,
|
|
120
121
|
onChange: b
|
|
121
122
|
}),
|
|
122
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ u(o, {
|
|
123
124
|
id: t,
|
|
124
125
|
role: "combobox",
|
|
125
126
|
"aria-autocomplete": "list",
|
|
@@ -136,45 +137,45 @@ var f = "h-10 w-full rounded-md border border-border-default bg-bg-surface px-3
|
|
|
136
137
|
},
|
|
137
138
|
placeholder: x("botlit.handoffs.config.searchTeammates", "Search teammates by name or email")
|
|
138
139
|
}),
|
|
139
|
-
M ? /* @__PURE__ */
|
|
140
|
+
M ? /* @__PURE__ */ u(g, {
|
|
140
141
|
listId: O,
|
|
141
142
|
optionId: k,
|
|
142
143
|
options: D,
|
|
143
144
|
activeIndex: A,
|
|
144
145
|
onHighlight: T,
|
|
145
146
|
onChoose: N
|
|
146
|
-
}) : /* @__PURE__ */
|
|
147
|
+
}) : /* @__PURE__ */ u(_, {
|
|
147
148
|
loading: f,
|
|
148
149
|
query: S
|
|
149
150
|
})
|
|
150
151
|
]
|
|
151
152
|
});
|
|
152
|
-
},
|
|
153
|
-
let c = e(),
|
|
154
|
-
return /* @__PURE__ */
|
|
153
|
+
}, y = ({ id: t, label: r, members: i, value: a, onChange: o }) => {
|
|
154
|
+
let c = e(), f = s(() => n(i.map((e) => e.role), a), [i, a]), m = (e) => i.filter((t) => t.role.toLowerCase() === e.toLowerCase()).length;
|
|
155
|
+
return /* @__PURE__ */ d("div", {
|
|
155
156
|
className: "grid gap-1 text-sm",
|
|
156
|
-
children: [/* @__PURE__ */
|
|
157
|
+
children: [/* @__PURE__ */ u("label", {
|
|
157
158
|
htmlFor: t,
|
|
158
159
|
className: "font-medium text-text-primary",
|
|
159
160
|
children: r
|
|
160
|
-
}), /* @__PURE__ */
|
|
161
|
+
}), /* @__PURE__ */ d(l, {
|
|
161
162
|
id: t,
|
|
162
|
-
className:
|
|
163
|
+
className: p,
|
|
163
164
|
value: a,
|
|
164
165
|
onChange: (e) => o(e.target.value),
|
|
165
|
-
children: [/* @__PURE__ */
|
|
166
|
+
children: [/* @__PURE__ */ u("option", {
|
|
166
167
|
value: "",
|
|
167
168
|
children: c("botlit.handoffs.config.noRole", "No role")
|
|
168
|
-
}),
|
|
169
|
+
}), f.map((e) => /* @__PURE__ */ u("option", {
|
|
169
170
|
value: e,
|
|
170
171
|
children: c("botlit.handoffs.config.roleOption", "{{role}} ({{count}} members)", {
|
|
171
172
|
role: e,
|
|
172
|
-
count:
|
|
173
|
+
count: m(e)
|
|
173
174
|
})
|
|
174
175
|
}, e))]
|
|
175
176
|
})]
|
|
176
177
|
});
|
|
177
178
|
};
|
|
178
|
-
export {
|
|
179
|
+
export { v as MemberMultiSelect, y as MemberRoleSelect };
|
|
179
180
|
|
|
180
181
|
//# sourceMappingURL=HandoffTargetPickers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HandoffTargetPickers.js","names":["SELECT_CLASS","MAX_CANDIDATES","ChosenTeammates","t","useTr","value","label","member","byId","userId","name","shortUserLabel","Button","onChange","entry","X","TeammateOptions","listId","options","optionId","index","activeIndex","event","onHighlight","onChoose","TeammateListStatus","loading","query","MemberMultiSelect","setQuery","useState","active","setActive","useMemo","members","shown","teammateCandidates","id","activeMember","expanded","choose","error","onRetry","Input","next","nextListboxIndex","MemberRoleSelect","memberRoleOptions","holders","role"],"sources":["../../../src/botlit/components/HandoffTargetPickers.tsx"],"sourcesContent":["/**\n * Handoff target pickers (BOFF-15472)\n * @module botlit/components\n *\n * \"Who takes over\" used to be a comma-separated list of auth user ids and a\n * free-text role, so one typo routed a handoff to nobody. These controls pick\n * teammates by name from the workspace directory and the role from the roles\n * workspace members actually hold. They still produce the same values the\n * handoff config stores: user ids and a role name.\n */\n\nimport type { FC, KeyboardEvent } from 'react';\nimport { useMemo, useState } from 'react';\nimport { X } from 'lucide-react';\n\nimport { useTr } from '../../shared/hooks/useTr';\nimport { shortUserLabel, type DirectoryMember } from '../hooks/useWorkspaceMemberDirectory';\nimport { memberRoleOptions, nextListboxIndex, teammateCandidates } from '../utils/handoffInbox';\nimport { Button } from './Button';\nimport { Input } from './Input';\n\nconst SELECT_CLASS =\n 'h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 text-sm text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary';\n\nexport interface MemberMultiSelectProps {\n id: string;\n label: string;\n members: DirectoryMember[];\n loading: boolean;\n error: Error | undefined;\n onRetry: () => void;\n value: string[];\n onChange: (userIds: string[]) => void;\n}\n\n/** The most candidates the list shows at once; typing narrows it. */\nconst MAX_CANDIDATES = 50;\n\n/** The chosen teammates as removable chips. */\nconst ChosenTeammates: FC<{\n label: string;\n value: string[];\n byId: ReadonlyMap<string, DirectoryMember>;\n onChange: (userIds: string[]) => void;\n}> = ({ label, value, byId, onChange }) => {\n const t = useTr();\n if (value.length === 0) return null;\n return (\n <ul className=\"flex flex-wrap gap-2\" aria-label={label}>\n {value.map((userId) => {\n const member = byId.get(userId);\n const name = member?.displayName ?? shortUserLabel(userId);\n return (\n <li\n key={userId}\n className=\"flex items-center gap-1 rounded-full border border-border-subtle bg-bg-sunken py-0.5 pl-3 pr-1\"\n >\n <span>{name}</span>\n {member ? null : (\n <span className=\"text-xs text-text-secondary\">\n {t('botlit.handoffs.config.notAMember', '(not in this workspace)')}\n </span>\n )}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"h-6 w-6\"\n aria-label={t('botlit.handoffs.config.removeTeammate', 'Remove {{name}}', { name })}\n onClick={() => onChange(value.filter((entry) => entry !== userId))}\n >\n <X size={12} aria-hidden=\"true\" />\n </Button>\n </li>\n );\n })}\n </ul>\n );\n};\n\n/** The listbox half of the combobox; focus stays in the search field. */\nconst TeammateOptions: FC<{\n listId: string;\n optionId: (userId: string) => string;\n options: DirectoryMember[];\n activeIndex: number;\n onHighlight: (index: number) => void;\n onChoose: (userId: string) => void;\n}> = ({ listId, optionId, options, activeIndex, onHighlight, onChoose }) => {\n const t = useTr();\n return (\n <ul\n id={listId}\n role=\"listbox\"\n className=\"max-h-48 overflow-y-auto rounded-md border border-border-subtle\"\n aria-label={t('botlit.handoffs.config.teammates', 'Teammates')}\n >\n {options.map((member, index) => (\n <li\n key={member.userId}\n id={optionId(member.userId)}\n role=\"option\"\n aria-selected={index === activeIndex}\n className={`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2 text-left hover:bg-accent ${\n index === activeIndex ? 'bg-accent' : ''\n }`}\n // Keep focus in the search field, so the next keystroke still searches.\n onMouseDown={(event) => event.preventDefault()}\n onMouseEnter={() => onHighlight(index)}\n onClick={() => onChoose(member.userId)}\n >\n <span>\n <span className=\"font-medium text-text-primary\">{member.displayName}</span>\n {member.email ? <span className=\"ml-2 text-text-secondary\">{member.email}</span> : null}\n </span>\n <span className=\"text-xs text-text-secondary\">{member.role}</span>\n </li>\n ))}\n </ul>\n );\n};\n\n/** What shows under the search field when there are no options to list. */\nconst TeammateListStatus: FC<{ loading: boolean; query: string }> = ({ loading, query }) => {\n const t = useTr();\n if (loading) {\n return (\n <p role=\"status\" className=\"text-text-secondary\">\n {t('botlit.handoffs.config.loadingMembers', 'Loading teammates…')}\n </p>\n );\n }\n return (\n <p className=\"text-text-secondary\">\n {query.trim()\n ? t('botlit.handoffs.config.noTeammateMatch', 'No teammate matches \"{{query}}\".', {\n query: query.trim(),\n })\n : t('botlit.handoffs.config.allTeammatesChosen', 'Every teammate is already chosen.')}\n </p>\n );\n};\n\n/**\n * Chips for the chosen teammates plus a searchable list to add more. The search\n * field and the list follow the ARIA combobox pattern: arrow keys, Home and End\n * move through the options, Enter adds the highlighted one, Escape clears the\n * search.\n */\nexport const MemberMultiSelect: FC<MemberMultiSelectProps> = ({\n id,\n label,\n members,\n loading,\n error,\n onRetry,\n value,\n onChange,\n}) => {\n const t = useTr();\n const [query, setQuery] = useState('');\n const [active, setActive] = useState(0);\n const byId = useMemo(() => new Map(members.map((member) => [member.userId, member])), [members]);\n const shown = teammateCandidates(members, value, query).slice(0, MAX_CANDIDATES);\n const listId = `${id}-options`;\n const optionId = (userId: string) => `${id}-option-${userId}`;\n // The list shrinks as people are added or the search narrows; keep the\n // highlight on a real option.\n const activeIndex = Math.min(active, shown.length - 1);\n const activeMember = shown[activeIndex];\n const expanded = !loading && shown.length > 0;\n\n const choose = (userId: string) => {\n onChange([...value, userId]);\n setQuery('');\n // The full list comes back; start again at its first option.\n setActive(0);\n };\n\n const onSearchKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n const next = nextListboxIndex(event.key, activeIndex, shown.length);\n if (next !== null) {\n event.preventDefault();\n setActive(next);\n } else if (event.key === 'Enter' && activeMember) {\n // Keep Enter from submitting the surrounding form.\n event.preventDefault();\n choose(activeMember.userId);\n } else if (event.key === 'Escape' && query) {\n event.preventDefault();\n setQuery('');\n setActive(0);\n }\n };\n\n if (error) {\n return (\n <div className=\"grid gap-2 text-sm\">\n <label htmlFor={id} className=\"font-medium text-text-primary\">\n {label}\n </label>\n <ChosenTeammates label={label} value={value} byId={byId} onChange={onChange} />\n <div role=\"alert\" className=\"flex flex-wrap items-center gap-2 text-status-error-text\">\n <span>{error.message}</span>\n <Button type=\"button\" size=\"sm\" variant=\"outline\" onClick={onRetry}>\n {t('common.tryAgain', 'Try again')}\n </Button>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"grid gap-2 text-sm\">\n <label htmlFor={id} className=\"font-medium text-text-primary\">\n {label}\n </label>\n <ChosenTeammates label={label} value={value} byId={byId} onChange={onChange} />\n <Input\n id={id}\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded={expanded}\n aria-controls={listId}\n aria-activedescendant={expanded && activeMember ? optionId(activeMember.userId) : undefined}\n value={query}\n onChange={(event) => {\n setQuery(event.target.value);\n setActive(0);\n }}\n onKeyDown={onSearchKeyDown}\n placeholder={t(\n 'botlit.handoffs.config.searchTeammates',\n 'Search teammates by name or email'\n )}\n />\n {expanded ? (\n <TeammateOptions\n listId={listId}\n optionId={optionId}\n options={shown}\n activeIndex={activeIndex}\n onHighlight={setActive}\n onChoose={choose}\n />\n ) : (\n <TeammateListStatus loading={loading} query={query} />\n )}\n </div>\n );\n};\n\nexport interface MemberRoleSelectProps {\n id: string;\n label: string;\n members: DirectoryMember[];\n value: string;\n onChange: (role: string) => void;\n}\n\n/** The membership role whose holders all get the handoff. */\nexport const MemberRoleSelect: FC<MemberRoleSelectProps> = ({\n id,\n label,\n members,\n value,\n onChange,\n}) => {\n const t = useTr();\n const options = useMemo(\n () =>\n memberRoleOptions(\n members.map((member) => member.role),\n value\n ),\n [members, value]\n );\n const holders = (role: string) =>\n members.filter((member) => member.role.toLowerCase() === role.toLowerCase()).length;\n\n return (\n <div className=\"grid gap-1 text-sm\">\n <label htmlFor={id} className=\"font-medium text-text-primary\">\n {label}\n </label>\n <select\n id={id}\n className={SELECT_CLASS}\n value={value}\n onChange={(event) => onChange(event.target.value)}\n >\n <option value=\"\">{t('botlit.handoffs.config.noRole', 'No role')}</option>\n {options.map((role) => (\n <option key={role} value={role}>\n {t('botlit.handoffs.config.roleOption', '{{role}} ({{count}} members)', {\n role,\n count: holders(role),\n })}\n </option>\n ))}\n </select>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AAqBA,IAAMA,IACJ,+KAcIC,IAAiB,IAGjBC,KAKA,EAAE,UAAO,UAAO,SAAM,kBAAe;CACzC,IAAMC,IAAIC,EAAM;CAEhB,OADIC,EAAM,WAAW,IAAU,OAE7B,kBAAC,MAAD;EAAI,WAAU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D;IAA6B;IAAgB;GAAQ,CAAA;EAEpD;;AAET,GAWaqB,KAA+C,EAC1D,OACA,UACA,YACA,UACA,kBACI;CACJ,IAAM3C,IAAIC,EAAM,GACVc,IAAUe,QAEZc,EACEb,EAAQ,KAAK,MAAW3B,EAAO,IAAI,GACnCF,CACF,GACF,CAAC6B,GAAS7B,CAAK,CACjB,GACM2C,KAAW,MACfd,EAAQ,QAAQ,MAAW3B,EAAO,KAAK,YAAY,MAAM0C,EAAK,YAAY,CAAC,CAAC,CAAC;CAE/E,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,SAAD;GAAO,SAASZ;GAAI,WAAU;GAC3B,UAAA/B;EACI,CAAA,GACP,kBAAC,UAAD;GACM;GACJ,WAAWN;GACJ;GACP,WAAW,MAAUa,EAASS,EAAM,OAAO,KAAK;GAJlD,UAAA,CAME,kBAAC,UAAD;IAAQ,OAAM;IAAI,UAAAnB,EAAE,iCAAiC,SAAS;GAAU,CAAA,GACvEe,EAAQ,KAAK,MACZ,kBAAC,UAAD;IAAmB,OAAO+B;IACvB,UAAA9C,EAAE,qCAAqC,gCAAgC;KACtE;KACA,OAAO6C,EAAQC,CAAI;IACrB,CAAC;GACK,GALKA,CAKL,CACT,CACK;EACL,CAAA,CAAA;;AAET"}
|
|
1
|
+
{"version":3,"file":"HandoffTargetPickers.js","names":["SELECT_CLASS","MAX_CANDIDATES","ChosenTeammates","t","useTr","value","label","member","byId","userId","name","shortUserLabel","Button","onChange","entry","X","TeammateOptions","listId","options","optionId","index","activeIndex","event","onHighlight","onChoose","TeammateListStatus","loading","query","MemberMultiSelect","setQuery","useState","active","setActive","useMemo","members","shown","teammateCandidates","id","activeMember","expanded","choose","error","onRetry","Input","next","nextListboxIndex","MemberRoleSelect","memberRoleOptions","holders","role","ThemedSelect"],"sources":["../../../src/botlit/components/HandoffTargetPickers.tsx"],"sourcesContent":["/**\n * Handoff target pickers (BOFF-15472)\n * @module botlit/components\n *\n * \"Who takes over\" used to be a comma-separated list of auth user ids and a\n * free-text role, so one typo routed a handoff to nobody. These controls pick\n * teammates by name from the workspace directory and the role from the roles\n * workspace members actually hold. They still produce the same values the\n * handoff config stores: user ids and a role name.\n */\n\nimport type { FC, KeyboardEvent } from 'react';\nimport { useMemo, useState } from 'react';\nimport { X } from 'lucide-react';\n\nimport { useTr } from '../../shared/hooks/useTr';\nimport { shortUserLabel, type DirectoryMember } from '../hooks/useWorkspaceMemberDirectory';\nimport { memberRoleOptions, nextListboxIndex, teammateCandidates } from '../utils/handoffInbox';\nimport { Button } from './Button';\nimport { Input } from './Input';\nimport { ThemedSelect } from '@burdenoff/fe-libs/ui';\n\nconst SELECT_CLASS =\n 'h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 text-sm text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary';\n\nexport interface MemberMultiSelectProps {\n id: string;\n label: string;\n members: DirectoryMember[];\n loading: boolean;\n error: Error | undefined;\n onRetry: () => void;\n value: string[];\n onChange: (userIds: string[]) => void;\n}\n\n/** The most candidates the list shows at once; typing narrows it. */\nconst MAX_CANDIDATES = 50;\n\n/** The chosen teammates as removable chips. */\nconst ChosenTeammates: FC<{\n label: string;\n value: string[];\n byId: ReadonlyMap<string, DirectoryMember>;\n onChange: (userIds: string[]) => void;\n}> = ({ label, value, byId, onChange }) => {\n const t = useTr();\n if (value.length === 0) return null;\n return (\n <ul className=\"flex flex-wrap gap-2\" aria-label={label}>\n {value.map((userId) => {\n const member = byId.get(userId);\n const name = member?.displayName ?? shortUserLabel(userId);\n return (\n <li\n key={userId}\n className=\"flex items-center gap-1 rounded-full border border-border-subtle bg-bg-sunken py-0.5 pl-3 pr-1\"\n >\n <span>{name}</span>\n {member ? null : (\n <span className=\"text-xs text-text-secondary\">\n {t('botlit.handoffs.config.notAMember', '(not in this workspace)')}\n </span>\n )}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"h-6 w-6\"\n aria-label={t('botlit.handoffs.config.removeTeammate', 'Remove {{name}}', { name })}\n onClick={() => onChange(value.filter((entry) => entry !== userId))}\n >\n <X size={12} aria-hidden=\"true\" />\n </Button>\n </li>\n );\n })}\n </ul>\n );\n};\n\n/** The listbox half of the combobox; focus stays in the search field. */\nconst TeammateOptions: FC<{\n listId: string;\n optionId: (userId: string) => string;\n options: DirectoryMember[];\n activeIndex: number;\n onHighlight: (index: number) => void;\n onChoose: (userId: string) => void;\n}> = ({ listId, optionId, options, activeIndex, onHighlight, onChoose }) => {\n const t = useTr();\n return (\n <ul\n id={listId}\n role=\"listbox\"\n className=\"max-h-48 overflow-y-auto rounded-md border border-border-subtle\"\n aria-label={t('botlit.handoffs.config.teammates', 'Teammates')}\n >\n {options.map((member, index) => (\n <li\n key={member.userId}\n id={optionId(member.userId)}\n role=\"option\"\n aria-selected={index === activeIndex}\n className={`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2 text-left hover:bg-accent ${\n index === activeIndex ? 'bg-accent' : ''\n }`}\n // Keep focus in the search field, so the next keystroke still searches.\n onMouseDown={(event) => event.preventDefault()}\n onMouseEnter={() => onHighlight(index)}\n onClick={() => onChoose(member.userId)}\n >\n <span>\n <span className=\"font-medium text-text-primary\">{member.displayName}</span>\n {member.email ? <span className=\"ml-2 text-text-secondary\">{member.email}</span> : null}\n </span>\n <span className=\"text-xs text-text-secondary\">{member.role}</span>\n </li>\n ))}\n </ul>\n );\n};\n\n/** What shows under the search field when there are no options to list. */\nconst TeammateListStatus: FC<{ loading: boolean; query: string }> = ({ loading, query }) => {\n const t = useTr();\n if (loading) {\n return (\n <p role=\"status\" className=\"text-text-secondary\">\n {t('botlit.handoffs.config.loadingMembers', 'Loading teammates…')}\n </p>\n );\n }\n return (\n <p className=\"text-text-secondary\">\n {query.trim()\n ? t('botlit.handoffs.config.noTeammateMatch', 'No teammate matches \"{{query}}\".', {\n query: query.trim(),\n })\n : t('botlit.handoffs.config.allTeammatesChosen', 'Every teammate is already chosen.')}\n </p>\n );\n};\n\n/**\n * Chips for the chosen teammates plus a searchable list to add more. The search\n * field and the list follow the ARIA combobox pattern: arrow keys, Home and End\n * move through the options, Enter adds the highlighted one, Escape clears the\n * search.\n */\nexport const MemberMultiSelect: FC<MemberMultiSelectProps> = ({\n id,\n label,\n members,\n loading,\n error,\n onRetry,\n value,\n onChange,\n}) => {\n const t = useTr();\n const [query, setQuery] = useState('');\n const [active, setActive] = useState(0);\n const byId = useMemo(() => new Map(members.map((member) => [member.userId, member])), [members]);\n const shown = teammateCandidates(members, value, query).slice(0, MAX_CANDIDATES);\n const listId = `${id}-options`;\n const optionId = (userId: string) => `${id}-option-${userId}`;\n // The list shrinks as people are added or the search narrows; keep the\n // highlight on a real option.\n const activeIndex = Math.min(active, shown.length - 1);\n const activeMember = shown[activeIndex];\n const expanded = !loading && shown.length > 0;\n\n const choose = (userId: string) => {\n onChange([...value, userId]);\n setQuery('');\n // The full list comes back; start again at its first option.\n setActive(0);\n };\n\n const onSearchKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n const next = nextListboxIndex(event.key, activeIndex, shown.length);\n if (next !== null) {\n event.preventDefault();\n setActive(next);\n } else if (event.key === 'Enter' && activeMember) {\n // Keep Enter from submitting the surrounding form.\n event.preventDefault();\n choose(activeMember.userId);\n } else if (event.key === 'Escape' && query) {\n event.preventDefault();\n setQuery('');\n setActive(0);\n }\n };\n\n if (error) {\n return (\n <div className=\"grid gap-2 text-sm\">\n <label htmlFor={id} className=\"font-medium text-text-primary\">\n {label}\n </label>\n <ChosenTeammates label={label} value={value} byId={byId} onChange={onChange} />\n <div role=\"alert\" className=\"flex flex-wrap items-center gap-2 text-status-error-text\">\n <span>{error.message}</span>\n <Button type=\"button\" size=\"sm\" variant=\"outline\" onClick={onRetry}>\n {t('common.tryAgain', 'Try again')}\n </Button>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"grid gap-2 text-sm\">\n <label htmlFor={id} className=\"font-medium text-text-primary\">\n {label}\n </label>\n <ChosenTeammates label={label} value={value} byId={byId} onChange={onChange} />\n <Input\n id={id}\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded={expanded}\n aria-controls={listId}\n aria-activedescendant={expanded && activeMember ? optionId(activeMember.userId) : undefined}\n value={query}\n onChange={(event) => {\n setQuery(event.target.value);\n setActive(0);\n }}\n onKeyDown={onSearchKeyDown}\n placeholder={t(\n 'botlit.handoffs.config.searchTeammates',\n 'Search teammates by name or email'\n )}\n />\n {expanded ? (\n <TeammateOptions\n listId={listId}\n optionId={optionId}\n options={shown}\n activeIndex={activeIndex}\n onHighlight={setActive}\n onChoose={choose}\n />\n ) : (\n <TeammateListStatus loading={loading} query={query} />\n )}\n </div>\n );\n};\n\nexport interface MemberRoleSelectProps {\n id: string;\n label: string;\n members: DirectoryMember[];\n value: string;\n onChange: (role: string) => void;\n}\n\n/** The membership role whose holders all get the handoff. */\nexport const MemberRoleSelect: FC<MemberRoleSelectProps> = ({\n id,\n label,\n members,\n value,\n onChange,\n}) => {\n const t = useTr();\n const options = useMemo(\n () =>\n memberRoleOptions(\n members.map((member) => member.role),\n value\n ),\n [members, value]\n );\n const holders = (role: string) =>\n members.filter((member) => member.role.toLowerCase() === role.toLowerCase()).length;\n\n return (\n <div className=\"grid gap-1 text-sm\">\n <label htmlFor={id} className=\"font-medium text-text-primary\">\n {label}\n </label>\n <ThemedSelect\n id={id}\n className={SELECT_CLASS}\n value={value}\n onChange={(event) => onChange(event.target.value)}\n >\n <option value=\"\">{t('botlit.handoffs.config.noRole', 'No role')}</option>\n {options.map((role) => (\n <option key={role} value={role}>\n {t('botlit.handoffs.config.roleOption', '{{role}} ({{count}} members)', {\n role,\n count: holders(role),\n })}\n </option>\n ))}\n </ThemedSelect>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;AAsBA,IAAMA,IACJ,+KAcIC,IAAiB,IAGjBC,KAKA,EAAE,UAAO,UAAO,SAAM,kBAAe;CACzC,IAAMC,IAAIC,EAAM;CAEhB,OADIC,EA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aAAaH;IACb,UAAUQ;GACX,CAAA,IAED,kBAACf,GAAD;IAA6B;IAAgB;GAAQ,CAAA;EAEpD;;AAET,GAWaqB,KAA+C,EAC1D,OACA,UACA,YACA,UACA,kBACI;CACJ,IAAM3C,IAAIC,EAAM,GACVc,IAAUe,QAEZc,EACEb,EAAQ,KAAK,MAAW3B,EAAO,IAAI,GACnCF,CACF,GACF,CAAC6B,GAAS7B,CAAK,CACjB,GACM2C,KAAW,MACfd,EAAQ,QAAQ,MAAW3B,EAAO,KAAK,YAAY,MAAM0C,EAAK,YAAY,CAAC,CAAC,CAAC;CAE/E,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,SAAD;GAAO,SAASZ;GAAI,WAAU;GAC3B,UAAA/B;EACI,CAAA,GACP,kBAAC4C,GAAD;GACM;GACJ,WAAWlD;GACJ;GACP,WAAW,MAAUa,EAASS,EAAM,OAAO,KAAK;GAJlD,UAAA,CAME,kBAAC,UAAD;IAAQ,OAAM;IAAI,UAAAnB,EAAE,iCAAiC,SAAS;GAAU,CAAA,GACvEe,EAAQ,KAAK,MACZ,kBAAC,UAAD;IAAmB,OAAO+B;IACvB,UAAA9C,EAAE,qCAAqC,gCAAgC;KACtE;KACA,OAAO6C,EAAQC,CAAI;IACrB,CAAC;GACK,GALKA,CAKL,CACT,CACW;EACX,CAAA,CAAA;;AAET"}
|
|
@@ -7,176 +7,177 @@ import { formatRelativeTime as s } from "../utils/formatters.js";
|
|
|
7
7
|
import { Card as c, CardContent as l, CardDescription as u, CardHeader as d, CardTitle as f } from "./Card.js";
|
|
8
8
|
import { Button as p } from "./Button.js";
|
|
9
9
|
import { useState as m } from "react";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { ThemedSelect as h } from "@burdenoff/fe-libs/ui";
|
|
11
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
12
|
+
import { ArrowRightLeft as v } from "lucide-react";
|
|
12
13
|
// src/botlit/components/KnowledgeBackendMigrationPanel.tsx
|
|
13
|
-
var
|
|
14
|
+
var y = "h-10 rounded-md border border-border-default bg-bg-surface px-3 text-sm text-text-primary", b = {
|
|
14
15
|
opensearch: "OpenSearch",
|
|
15
16
|
postgres: "PostgreSQL",
|
|
16
17
|
milvus: "Milvus"
|
|
17
|
-
},
|
|
18
|
+
}, x = {
|
|
18
19
|
READY: "Queued",
|
|
19
20
|
COPYING: "Copying",
|
|
20
21
|
VERIFIED: "Verified, ready for cutover",
|
|
21
22
|
BLOCKED: "Blocked",
|
|
22
23
|
COMPLETED: "Completed",
|
|
23
24
|
CANCELLED: "Discarded"
|
|
24
|
-
},
|
|
25
|
+
}, S = {
|
|
25
26
|
VERIFIED: "text-status-success-text",
|
|
26
27
|
COMPLETED: "text-status-success-text",
|
|
27
28
|
BLOCKED: "text-status-error-text",
|
|
28
29
|
CANCELLED: "text-text-secondary"
|
|
29
30
|
};
|
|
30
|
-
function
|
|
31
|
-
return e ?
|
|
31
|
+
function C(e) {
|
|
32
|
+
return e ? b[e] ?? e : "—";
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
+
function w(e, t) {
|
|
34
35
|
return t <= 0 ? 100 : Math.min(100, Math.round(e / t * 100));
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function T({ knowledgeBaseId: e }) {
|
|
37
38
|
let { workspaceId: n, currentUser: r } = t();
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ g(E, { knowledgeBaseId: e }, `${n}:${r?.id}:${e}`);
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
let
|
|
41
|
+
function E({ knowledgeBaseId: t }) {
|
|
42
|
+
let b = e(), T = i(t), { targets: E, migrations: D, begin: O, cutover: k, discard: A } = r(t), [j, M] = m(""), [N, P] = m(null), F = T.data?.vectorStoreDriver ?? null, I = (E.data ?? []).filter((e) => e !== F), L = I.includes(j) ? j : I[0] ?? "", R = D.data ?? [], z = R.find((e) => [
|
|
42
43
|
"READY",
|
|
43
44
|
"COPYING",
|
|
44
45
|
"VERIFIED"
|
|
45
|
-
].includes(e.status)),
|
|
46
|
+
].includes(e.status)), B = (e, t) => P({
|
|
46
47
|
tone: "error",
|
|
47
48
|
text: o(e, t)
|
|
48
|
-
}),
|
|
49
|
-
if (
|
|
50
|
-
title:
|
|
51
|
-
message:
|
|
52
|
-
target:
|
|
53
|
-
current:
|
|
49
|
+
}), V = async () => {
|
|
50
|
+
if (L && await a({
|
|
51
|
+
title: b("botlit.kb.migration.beginTitle", "Copy to {{target}}?", { target: C(L) }),
|
|
52
|
+
message: b("botlit.kb.migration.beginMessage", "A verified copy is built in {{target}} while agents keep using {{current}}. Nothing changes for agents until you cut over. Document changes are refused at cutover if the source changed.", {
|
|
53
|
+
target: C(L),
|
|
54
|
+
current: C(F)
|
|
54
55
|
}),
|
|
55
|
-
confirmLabel:
|
|
56
|
-
cancelLabel:
|
|
56
|
+
confirmLabel: b("botlit.kb.migration.beginConfirm", "Start copy"),
|
|
57
|
+
cancelLabel: b("botlit.common.cancel", "Cancel")
|
|
57
58
|
})) {
|
|
58
|
-
|
|
59
|
+
P(null);
|
|
59
60
|
try {
|
|
60
|
-
await
|
|
61
|
+
await O.mutateAsync(L), P({
|
|
61
62
|
tone: "info",
|
|
62
|
-
text:
|
|
63
|
+
text: b("botlit.kb.migration.started", "Copy queued. Its progress appears below and refreshes by itself.")
|
|
63
64
|
});
|
|
64
65
|
} catch (e) {
|
|
65
|
-
|
|
66
|
+
B(e, b("botlit.kb.migration.beginFailed", "The copy could not start. Every document must be indexed and published first."));
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
|
-
},
|
|
69
|
+
}, H = async (e) => {
|
|
69
70
|
if (await a({
|
|
70
|
-
title:
|
|
71
|
-
message:
|
|
72
|
-
target:
|
|
73
|
-
source:
|
|
71
|
+
title: b("botlit.kb.migration.cutoverTitle", "Switch live retrieval to {{target}}?", { target: C(e.targetDriver) }),
|
|
72
|
+
message: b("botlit.kb.migration.cutoverMessage", "Agents start reading this knowledge base from {{target}} immediately. The {{source}} copy is kept until it is retired.", {
|
|
73
|
+
target: C(e.targetDriver),
|
|
74
|
+
source: C(e.sourceDriver)
|
|
74
75
|
}),
|
|
75
|
-
confirmLabel:
|
|
76
|
-
cancelLabel:
|
|
76
|
+
confirmLabel: b("botlit.kb.migration.cutoverConfirm", "Cut over"),
|
|
77
|
+
cancelLabel: b("botlit.common.cancel", "Cancel")
|
|
77
78
|
})) {
|
|
78
|
-
|
|
79
|
+
P(null);
|
|
79
80
|
try {
|
|
80
|
-
await
|
|
81
|
+
await k.mutateAsync(e.id), P({
|
|
81
82
|
tone: "info",
|
|
82
|
-
text:
|
|
83
|
+
text: b("botlit.kb.migration.cutoverDone", "Live retrieval now uses {{target}}.", { target: C(e.targetDriver) })
|
|
83
84
|
});
|
|
84
85
|
} catch (e) {
|
|
85
|
-
|
|
86
|
+
B(e, b("botlit.kb.migration.cutoverFailed", "Cutover was refused. The source changed or the copy no longer verifies; discard it and start again."));
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
|
-
},
|
|
89
|
+
}, U = async (e) => {
|
|
89
90
|
if (await a({
|
|
90
|
-
title:
|
|
91
|
-
message:
|
|
92
|
-
confirmLabel:
|
|
93
|
-
cancelLabel:
|
|
91
|
+
title: b("botlit.kb.migration.discardTitle", "Discard this copy?"),
|
|
92
|
+
message: b("botlit.kb.migration.discardMessage", "The inactive {{target}} copy is retired. Live retrieval is not affected.", { target: C(e.targetDriver) }),
|
|
93
|
+
confirmLabel: b("botlit.kb.migration.discardConfirm", "Discard"),
|
|
94
|
+
cancelLabel: b("botlit.common.cancel", "Cancel")
|
|
94
95
|
})) {
|
|
95
|
-
|
|
96
|
+
P(null);
|
|
96
97
|
try {
|
|
97
|
-
await
|
|
98
|
+
await A.mutateAsync(e.id), P({
|
|
98
99
|
tone: "info",
|
|
99
|
-
text:
|
|
100
|
+
text: b("botlit.kb.migration.discarded", "Copy discarded.")
|
|
100
101
|
});
|
|
101
102
|
} catch (e) {
|
|
102
|
-
|
|
103
|
+
B(e, b("botlit.kb.migration.discardFailed", "The copy could not be discarded."));
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
};
|
|
106
|
-
return /* @__PURE__ */
|
|
107
|
+
return /* @__PURE__ */ _(c, { children: [/* @__PURE__ */ _(d, { children: [/* @__PURE__ */ _(f, {
|
|
107
108
|
className: "flex items-center gap-2",
|
|
108
|
-
children: [/* @__PURE__ */
|
|
109
|
+
children: [/* @__PURE__ */ g(v, {
|
|
109
110
|
size: 18,
|
|
110
111
|
"aria-hidden": "true"
|
|
111
|
-
}),
|
|
112
|
-
}), /* @__PURE__ */
|
|
112
|
+
}), b("botlit.kb.migration.title", "Vector backend")]
|
|
113
|
+
}), /* @__PURE__ */ g(u, { children: b("botlit.kb.migration.help", "Move this knowledge base to another vector backend: copy, verify, then cut over. It is never switched silently.") })] }), /* @__PURE__ */ _(l, {
|
|
113
114
|
className: "space-y-4",
|
|
114
115
|
children: [
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ g("p", {
|
|
116
117
|
className: "text-sm",
|
|
117
|
-
children:
|
|
118
|
+
children: b("botlit.kb.migration.current", "Live backend: {{driver}}", { driver: T.isPending ? "…" : C(F) })
|
|
118
119
|
}),
|
|
119
|
-
|
|
120
|
+
E.isError ? /* @__PURE__ */ g("p", {
|
|
120
121
|
role: "alert",
|
|
121
122
|
className: "text-sm text-status-error-text",
|
|
122
|
-
children:
|
|
123
|
-
}) :
|
|
123
|
+
children: b("botlit.kb.migration.targetsError", "Migration options could not be loaded. Knowledge management permission is required.")
|
|
124
|
+
}) : E.isPending ? /* @__PURE__ */ g("p", {
|
|
124
125
|
role: "status",
|
|
125
126
|
className: "text-sm text-text-secondary",
|
|
126
|
-
children:
|
|
127
|
-
}) :
|
|
127
|
+
children: b("botlit.kb.migration.loading", "Loading migration options…")
|
|
128
|
+
}) : I.length === 0 ? /* @__PURE__ */ g("p", {
|
|
128
129
|
className: "text-sm text-text-secondary",
|
|
129
|
-
children:
|
|
130
|
-
}) :
|
|
130
|
+
children: b("botlit.kb.migration.noTargets", "No other vector backend is enabled for migration in this environment.")
|
|
131
|
+
}) : z ? /* @__PURE__ */ g("p", {
|
|
131
132
|
className: "text-sm text-text-secondary",
|
|
132
|
-
children:
|
|
133
|
-
}) : /* @__PURE__ */
|
|
133
|
+
children: b("botlit.kb.migration.oneAtATime", "A migration is already in progress. Finish or discard it before starting another.")
|
|
134
|
+
}) : /* @__PURE__ */ _("div", {
|
|
134
135
|
className: "flex flex-wrap items-end gap-3",
|
|
135
|
-
children: [/* @__PURE__ */
|
|
136
|
+
children: [/* @__PURE__ */ _("label", {
|
|
136
137
|
className: "grid gap-2 text-sm",
|
|
137
|
-
children: [
|
|
138
|
-
className:
|
|
139
|
-
value:
|
|
140
|
-
onChange: (e) =>
|
|
141
|
-
children:
|
|
138
|
+
children: [b("botlit.kb.migration.target", "Move to"), /* @__PURE__ */ g(h, {
|
|
139
|
+
className: y,
|
|
140
|
+
value: L,
|
|
141
|
+
onChange: (e) => M(e.target.value),
|
|
142
|
+
children: I.map((e) => /* @__PURE__ */ g("option", {
|
|
142
143
|
value: e,
|
|
143
|
-
children:
|
|
144
|
+
children: C(e)
|
|
144
145
|
}, e))
|
|
145
146
|
})]
|
|
146
|
-
}), /* @__PURE__ */
|
|
147
|
-
isLoading:
|
|
148
|
-
onClick: () => void
|
|
149
|
-
children:
|
|
147
|
+
}), /* @__PURE__ */ g(p, {
|
|
148
|
+
isLoading: O.isPending,
|
|
149
|
+
onClick: () => void V(),
|
|
150
|
+
children: b("botlit.kb.migration.begin", "Start copy")
|
|
150
151
|
})]
|
|
151
152
|
}),
|
|
152
|
-
|
|
153
|
-
role:
|
|
154
|
-
className:
|
|
155
|
-
children:
|
|
153
|
+
N && /* @__PURE__ */ g("p", {
|
|
154
|
+
role: N.tone === "error" ? "alert" : "status",
|
|
155
|
+
className: N.tone === "error" ? "text-sm text-status-error-text" : "text-sm",
|
|
156
|
+
children: N.text
|
|
156
157
|
}),
|
|
157
|
-
|
|
158
|
+
D.isError ? /* @__PURE__ */ g("p", {
|
|
158
159
|
role: "alert",
|
|
159
160
|
className: "text-sm text-status-error-text",
|
|
160
|
-
children:
|
|
161
|
-
}) :
|
|
161
|
+
children: b("botlit.kb.migration.listError", "Migration history could not be loaded.")
|
|
162
|
+
}) : R.length > 0 ? /* @__PURE__ */ g("ul", {
|
|
162
163
|
className: "divide-y divide-border-subtle rounded-md border border-border-subtle",
|
|
163
|
-
children:
|
|
164
|
-
let t =
|
|
165
|
-
return /* @__PURE__ */
|
|
164
|
+
children: R.map((e) => {
|
|
165
|
+
let t = w(e.copiedVectors, e.expectedVectors);
|
|
166
|
+
return /* @__PURE__ */ _("li", {
|
|
166
167
|
className: "space-y-2 p-3 text-sm",
|
|
167
168
|
children: [
|
|
168
|
-
/* @__PURE__ */
|
|
169
|
+
/* @__PURE__ */ _("div", {
|
|
169
170
|
className: "flex flex-wrap items-center justify-between gap-2",
|
|
170
|
-
children: [/* @__PURE__ */
|
|
171
|
+
children: [/* @__PURE__ */ _("span", {
|
|
171
172
|
className: "font-medium",
|
|
172
173
|
children: [
|
|
173
|
-
|
|
174
|
+
C(e.sourceDriver),
|
|
174
175
|
" → ",
|
|
175
|
-
|
|
176
|
+
C(e.targetDriver)
|
|
176
177
|
]
|
|
177
|
-
}), /* @__PURE__ */
|
|
178
|
-
className:
|
|
179
|
-
children:
|
|
178
|
+
}), /* @__PURE__ */ g("span", {
|
|
179
|
+
className: S[e.status] ?? "text-text-secondary",
|
|
180
|
+
children: b(`botlit.kb.migration.status.${e.status.toLowerCase()}`, x[e.status] ?? e.status)
|
|
180
181
|
})]
|
|
181
182
|
}),
|
|
182
183
|
[
|
|
@@ -184,21 +185,21 @@ function T({ knowledgeBaseId: t }) {
|
|
|
184
185
|
"COPYING",
|
|
185
186
|
"VERIFIED",
|
|
186
187
|
"BLOCKED"
|
|
187
|
-
].includes(e.status) && /* @__PURE__ */
|
|
188
|
+
].includes(e.status) && /* @__PURE__ */ g("div", {
|
|
188
189
|
role: "progressbar",
|
|
189
190
|
"aria-valuemin": 0,
|
|
190
191
|
"aria-valuemax": 100,
|
|
191
192
|
"aria-valuenow": t,
|
|
192
|
-
"aria-label":
|
|
193
|
+
"aria-label": b("botlit.kb.migration.progress", "Copy progress"),
|
|
193
194
|
className: "h-2 overflow-hidden rounded-full bg-bg-sunken",
|
|
194
|
-
children: /* @__PURE__ */
|
|
195
|
+
children: /* @__PURE__ */ g("div", {
|
|
195
196
|
className: "h-full bg-action-primary-bg",
|
|
196
197
|
style: { width: `${t}%` }
|
|
197
198
|
})
|
|
198
199
|
}),
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
+
/* @__PURE__ */ g("p", {
|
|
200
201
|
className: "text-text-secondary",
|
|
201
|
-
children:
|
|
202
|
+
children: b("botlit.kb.migration.counts", "{{docs}} of {{expectedDocs}} documents · {{vectors}} of {{expectedVectors}} vectors · updated {{when}}", {
|
|
202
203
|
docs: e.copiedDocuments,
|
|
203
204
|
expectedDocs: e.expectedDocuments,
|
|
204
205
|
vectors: e.copiedVectors,
|
|
@@ -206,26 +207,26 @@ function T({ knowledgeBaseId: t }) {
|
|
|
206
207
|
when: s(e.updatedAt)
|
|
207
208
|
})
|
|
208
209
|
}),
|
|
209
|
-
(e.failureCount > 0 || e.errorCode) && /* @__PURE__ */
|
|
210
|
+
(e.failureCount > 0 || e.errorCode) && /* @__PURE__ */ g("p", {
|
|
210
211
|
className: "text-status-error-text",
|
|
211
|
-
children:
|
|
212
|
+
children: b("botlit.kb.migration.failures", "{{count}} failed attempts{{code}}", {
|
|
212
213
|
count: e.failureCount,
|
|
213
214
|
code: e.errorCode ? ` · ${e.errorCode}` : ""
|
|
214
215
|
})
|
|
215
216
|
}),
|
|
216
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ _("div", {
|
|
217
218
|
className: "flex flex-wrap gap-2",
|
|
218
|
-
children: [e.status === "VERIFIED" && /* @__PURE__ */
|
|
219
|
+
children: [e.status === "VERIFIED" && /* @__PURE__ */ g(p, {
|
|
219
220
|
size: "sm",
|
|
220
|
-
isLoading: O.isPending,
|
|
221
|
-
onClick: () => void V(e),
|
|
222
|
-
children: y("botlit.kb.migration.cutover", "Cut over")
|
|
223
|
-
}), n.includes(e.status) && /* @__PURE__ */ h(p, {
|
|
224
|
-
size: "sm",
|
|
225
|
-
variant: "outline",
|
|
226
221
|
isLoading: k.isPending,
|
|
227
222
|
onClick: () => void H(e),
|
|
228
|
-
children:
|
|
223
|
+
children: b("botlit.kb.migration.cutover", "Cut over")
|
|
224
|
+
}), n.includes(e.status) && /* @__PURE__ */ g(p, {
|
|
225
|
+
size: "sm",
|
|
226
|
+
variant: "outline",
|
|
227
|
+
isLoading: A.isPending,
|
|
228
|
+
onClick: () => void U(e),
|
|
229
|
+
children: b("botlit.kb.migration.discard", "Discard copy")
|
|
229
230
|
})]
|
|
230
231
|
})
|
|
231
232
|
]
|
|
@@ -235,6 +236,6 @@ function T({ knowledgeBaseId: t }) {
|
|
|
235
236
|
]
|
|
236
237
|
})] });
|
|
237
238
|
}
|
|
238
|
-
export {
|
|
239
|
+
export { T as KnowledgeBackendMigrationPanel };
|
|
239
240
|
|
|
240
241
|
//# sourceMappingURL=KnowledgeBackendMigrationPanel.js.map
|