@burdenoff/microfe-botmanor 2026.1118.6 → 2026.1118.8
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/components/AgentBindingsPanel.d.ts +4 -0
- package/dist/botlit/components/AgentBindingsPanel.js +305 -0
- package/dist/botlit/components/AgentBindingsPanel.js.map +1 -0
- package/dist/botlit/components/ChannelSelectorSheet.d.ts +9 -2
- package/dist/botlit/components/ChannelSelectorSheet.js.map +1 -1
- package/dist/botlit/hooks/index.d.ts +3 -1
- package/dist/botlit/hooks/index.js +14 -13
- package/dist/botlit/hooks/internal/globalWorkspaceScope.d.ts +15 -0
- package/dist/botlit/hooks/internal/globalWorkspaceScope.js +21 -0
- package/dist/botlit/hooks/internal/globalWorkspaceScope.js.map +1 -0
- package/dist/botlit/hooks/internal/workspaceGateway.d.ts +7 -0
- package/dist/botlit/hooks/internal/workspaceGateway.js +42 -22
- package/dist/botlit/hooks/internal/workspaceGateway.js.map +1 -1
- package/dist/botlit/hooks/useAgentBindings.d.ts +58 -0
- package/dist/botlit/hooks/useAgentBindings.js +87 -0
- package/dist/botlit/hooks/useAgentBindings.js.map +1 -0
- package/dist/botlit/hooks/useChannelSetup.d.ts +2 -1
- package/dist/botlit/hooks/useChannelSetup.js +61 -52
- package/dist/botlit/hooks/useChannelSetup.js.map +1 -1
- package/dist/botlit/hooks/useChannels.d.ts +9 -0
- package/dist/botlit/hooks/useChannels.js +83 -73
- package/dist/botlit/hooks/useChannels.js.map +1 -1
- package/dist/botlit/hooks/useUserPlatformConnection.js +98 -78
- package/dist/botlit/hooks/useUserPlatformConnection.js.map +1 -1
- package/dist/botlit/pages/AgentDetailPage.js +56 -55
- package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
- package/dist/botlit/pages/BotChannelsTab.js +457 -242
- package/dist/botlit/pages/BotChannelsTab.js.map +1 -1
- package/dist/botlit/pages/PromptStudioPage.js +365 -175
- package/dist/botlit/pages/PromptStudioPage.js.map +1 -1
- package/dist/botlit/permissions/index.js +3 -3
- package/dist/botlit/permissions/useBotmanorPermissions.js +5 -2
- package/dist/botlit/permissions/useBotmanorPermissions.js.map +1 -1
- package/dist/botlit/utils/promptVariables.d.ts +6 -0
- package/dist/botlit/utils/promptVariables.js +20 -0
- package/dist/botlit/utils/promptVariables.js.map +1 -0
- package/dist/generated/wspace-operations.d.ts +314 -0
- package/dist/generated/wspace-operations.js +189 -101
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +139 -0
- package/dist/generated/wspace-types.js +3 -1
- package/dist/generated/wspace-types.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { Card as e, CardContent as t, CardDescription as n, CardHeader as r, CardTitle as i } from "./Card.js";
|
|
2
|
+
import { BOTMANOR_PERMISSIONS as a } from "../permissions/botmanorPermissions.js";
|
|
3
|
+
import { useBotmanorCan as o } from "../permissions/useBotmanorPermissions.js";
|
|
4
|
+
import { Button as s } from "./Button.js";
|
|
5
|
+
import { Input as ee } from "./Input.js";
|
|
6
|
+
import { Badge as c } from "./Badge.js";
|
|
7
|
+
import "../hooks/index.js";
|
|
8
|
+
import { graphqlErrorMessage as l } from "../utils/errors.js";
|
|
9
|
+
import { useRetrievalProfiles as u } from "../hooks/useRetrievalProfiles.js";
|
|
10
|
+
import { useSkills as d } from "../hooks/useSkills.js";
|
|
11
|
+
import { promptTemplateVariables as f, usePromptTemplate as p, usePromptTemplates as m } from "../hooks/usePromptTemplates.js";
|
|
12
|
+
import { useAgentBindings as h, useSetAgentBindings as g } from "../hooks/useAgentBindings.js";
|
|
13
|
+
import { typedVariableValue as _ } from "../utils/promptVariables.js";
|
|
14
|
+
import "../permissions/index.js";
|
|
15
|
+
import { useEffect as v, useMemo as y, useState as b } from "react";
|
|
16
|
+
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
17
|
+
import { ArrowDown as C, ArrowUp as te, Layers as w } from "lucide-react";
|
|
18
|
+
import { toast as T } from "sonner";
|
|
19
|
+
// src/botlit/components/AgentBindingsPanel.tsx
|
|
20
|
+
var E = "h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 text-sm";
|
|
21
|
+
function D(e) {
|
|
22
|
+
let t = e?.promptTemplate?.variables;
|
|
23
|
+
return t && typeof t == "object" && !Array.isArray(t) ? t : {};
|
|
24
|
+
}
|
|
25
|
+
function O(e) {
|
|
26
|
+
let t = {};
|
|
27
|
+
for (let [n, r] of Object.entries(D(e))) t[n] = typeof r == "string" ? r : JSON.stringify(r);
|
|
28
|
+
return {
|
|
29
|
+
promptTemplateId: e?.promptTemplate?.promptTemplateId ?? "",
|
|
30
|
+
variables: t,
|
|
31
|
+
edited: [],
|
|
32
|
+
skillIds: [...e?.skills ?? []].sort((e, t) => e.position - t.position).map((e) => e.skillId),
|
|
33
|
+
retrievalProfileId: e?.retrievalProfile?.retrievalProfileId ?? ""
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
var k = (e) => e !== "ARCHIVED", A = ({ agentId: A }) => {
|
|
37
|
+
let j = o(), [M, N] = b(!1), P = j(a.AGENT_UPDATE), F = h(A), I = P && !M && !!F.data && !F.loading, L = m(), R = d(), z = u(), { save: B } = g(A), [V, H] = b(() => O(null)), U = p(V.promptTemplateId || void 0), W = U.data && U.data.id === V.promptTemplateId ? U.data : null, G = !!V.promptTemplateId && !U.loading && !!U.data && U.data?.id !== V.promptTemplateId, { refetch: K } = U;
|
|
38
|
+
v(() => {
|
|
39
|
+
G && K();
|
|
40
|
+
}, [G, K]);
|
|
41
|
+
let q = !!F.data && (!V.promptTemplateId || W !== null && !U.loading) && !F.loading && !F.error && !L.loading && !L.error && !R.loading && !R.error && !z.loading && !z.error;
|
|
42
|
+
v(() => {
|
|
43
|
+
H(O(F.data));
|
|
44
|
+
}, [F.data]);
|
|
45
|
+
let J = y(() => W ? f(W) : [], [W]), Y = F.data?.retrievalProfile, X = V.retrievalProfileId ? z.data.find((e) => e.id === V.retrievalProfileId) ?? (Y?.retrievalProfileId === V.retrievalProfileId ? Y : null) : null, Z = y(() => new Map(R.data.map((e) => [e.id, e])), [R.data]), Q = R.data.filter((e) => k(e.status) && !V.skillIds.includes(e.id)), $ = (e, t) => {
|
|
46
|
+
let n = [...V.skillIds], r = e + t;
|
|
47
|
+
r < 0 || r >= n.length || ([n[e], n[r]] = [n[r], n[e]], H({
|
|
48
|
+
...V,
|
|
49
|
+
skillIds: n
|
|
50
|
+
}));
|
|
51
|
+
}, ne = async () => {
|
|
52
|
+
let e = F.data?.promptTemplate?.promptTemplateId ?? "", t = V.promptTemplateId !== e, n = t ? {} : D(F.data), r = {};
|
|
53
|
+
for (let e of J) {
|
|
54
|
+
let t = V.variables[e.name] ?? "";
|
|
55
|
+
!V.edited.includes(e.name) && e.name in n ? r[e.name] = n[e.name] : t !== "" && (r[e.name] = _(e.type, t));
|
|
56
|
+
}
|
|
57
|
+
let i = !!V.promptTemplateId && (t || V.edited.length > 0);
|
|
58
|
+
N(!0);
|
|
59
|
+
try {
|
|
60
|
+
await B({
|
|
61
|
+
promptTemplateId: V.promptTemplateId || null,
|
|
62
|
+
...i ? { promptVariables: r } : {},
|
|
63
|
+
skillIds: V.skillIds,
|
|
64
|
+
retrievalProfileId: V.retrievalProfileId || null
|
|
65
|
+
}), T.success("Agent bindings saved"), await F.refetch();
|
|
66
|
+
} catch (e) {
|
|
67
|
+
T.error(l(e, "Failed to save the agent bindings"));
|
|
68
|
+
} finally {
|
|
69
|
+
N(!1);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
return /* @__PURE__ */ S(e, { children: [/* @__PURE__ */ S(r, { children: [/* @__PURE__ */ S(i, {
|
|
73
|
+
className: "flex items-center gap-2",
|
|
74
|
+
children: [/* @__PURE__ */ x(w, { size: 18 }), "Prompt template, skills & retrieval"]
|
|
75
|
+
}), /* @__PURE__ */ x(n, { children: "Every run of this agent starts from the bound prompt template, adds the agent's own system prompt and the skills below, and searches its knowledge with the retrieval profile." })] }), /* @__PURE__ */ S(t, {
|
|
76
|
+
className: "space-y-6",
|
|
77
|
+
children: [
|
|
78
|
+
F.error && /* @__PURE__ */ x("p", {
|
|
79
|
+
role: "alert",
|
|
80
|
+
className: "text-sm text-status-error-text",
|
|
81
|
+
children: l(F.error, "Failed to load the agent bindings")
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ S("section", {
|
|
84
|
+
className: "space-y-3",
|
|
85
|
+
children: [/* @__PURE__ */ S("label", {
|
|
86
|
+
className: "grid gap-2 text-sm font-medium",
|
|
87
|
+
children: ["Prompt template", /* @__PURE__ */ S("select", {
|
|
88
|
+
"aria-label": "Prompt template",
|
|
89
|
+
className: E,
|
|
90
|
+
value: V.promptTemplateId,
|
|
91
|
+
disabled: !I,
|
|
92
|
+
onChange: (e) => H({
|
|
93
|
+
...V,
|
|
94
|
+
promptTemplateId: e.target.value,
|
|
95
|
+
variables: {},
|
|
96
|
+
edited: []
|
|
97
|
+
}),
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ x("option", {
|
|
100
|
+
value: "",
|
|
101
|
+
children: "No prompt template"
|
|
102
|
+
}),
|
|
103
|
+
W && !L.data.some((e) => e.id === W.id) && /* @__PURE__ */ S("option", {
|
|
104
|
+
value: W.id,
|
|
105
|
+
children: [
|
|
106
|
+
W.name,
|
|
107
|
+
" · v",
|
|
108
|
+
W.version
|
|
109
|
+
]
|
|
110
|
+
}),
|
|
111
|
+
L.data.filter((e) => k(e.status) || e.id === V.promptTemplateId).map((e) => /* @__PURE__ */ S("option", {
|
|
112
|
+
value: e.id,
|
|
113
|
+
children: [
|
|
114
|
+
e.name,
|
|
115
|
+
" · v",
|
|
116
|
+
e.version
|
|
117
|
+
]
|
|
118
|
+
}, e.id))
|
|
119
|
+
]
|
|
120
|
+
})]
|
|
121
|
+
}), J.length > 0 && /* @__PURE__ */ x("div", {
|
|
122
|
+
className: "grid gap-3 sm:grid-cols-2",
|
|
123
|
+
children: J.map((e) => /* @__PURE__ */ S("label", {
|
|
124
|
+
className: "grid gap-1 text-sm",
|
|
125
|
+
children: [/* @__PURE__ */ S("span", { children: [`{{${e.name}}}`, e.required && /* @__PURE__ */ x("span", {
|
|
126
|
+
className: "ml-1 text-status-error-text",
|
|
127
|
+
children: "*"
|
|
128
|
+
})] }), /* @__PURE__ */ x(ee, {
|
|
129
|
+
"aria-label": `Variable ${e.name}`,
|
|
130
|
+
disabled: !I,
|
|
131
|
+
placeholder: typeof e.defaultValue == "string" ? `Default: ${e.defaultValue}` : e.description ?? e.type,
|
|
132
|
+
value: V.variables[e.name] ?? "",
|
|
133
|
+
onChange: (t) => H({
|
|
134
|
+
...V,
|
|
135
|
+
variables: {
|
|
136
|
+
...V.variables,
|
|
137
|
+
[e.name]: t.target.value
|
|
138
|
+
},
|
|
139
|
+
edited: V.edited.includes(e.name) ? V.edited : [...V.edited, e.name]
|
|
140
|
+
})
|
|
141
|
+
})]
|
|
142
|
+
}, e.name))
|
|
143
|
+
})]
|
|
144
|
+
}),
|
|
145
|
+
/* @__PURE__ */ S("section", {
|
|
146
|
+
className: "space-y-3",
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ x("p", {
|
|
149
|
+
className: "text-sm font-medium",
|
|
150
|
+
children: "Skills"
|
|
151
|
+
}),
|
|
152
|
+
V.skillIds.length === 0 ? /* @__PURE__ */ x("p", {
|
|
153
|
+
className: "text-sm text-text-secondary",
|
|
154
|
+
children: "No skills attached."
|
|
155
|
+
}) : /* @__PURE__ */ x("ol", {
|
|
156
|
+
className: "space-y-2",
|
|
157
|
+
children: V.skillIds.map((e, t) => {
|
|
158
|
+
let n = Z.get(e);
|
|
159
|
+
return /* @__PURE__ */ S("li", {
|
|
160
|
+
className: "flex items-center gap-3 rounded-lg border border-border-subtle p-3",
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ S(c, {
|
|
163
|
+
variant: "outline",
|
|
164
|
+
children: ["#", t + 1]
|
|
165
|
+
}),
|
|
166
|
+
/* @__PURE__ */ S("div", {
|
|
167
|
+
className: "min-w-0 flex-1",
|
|
168
|
+
children: [/* @__PURE__ */ x("p", {
|
|
169
|
+
className: "truncate text-sm font-medium",
|
|
170
|
+
children: n?.name ?? F.data?.skills.find((t) => t.skillId === e)?.name ?? e
|
|
171
|
+
}), n?.description && /* @__PURE__ */ x("p", {
|
|
172
|
+
className: "truncate text-xs text-text-secondary",
|
|
173
|
+
children: n.description
|
|
174
|
+
})]
|
|
175
|
+
}),
|
|
176
|
+
I && /* @__PURE__ */ S("div", {
|
|
177
|
+
className: "flex items-center gap-1",
|
|
178
|
+
children: [
|
|
179
|
+
/* @__PURE__ */ x(s, {
|
|
180
|
+
size: "sm",
|
|
181
|
+
variant: "ghost",
|
|
182
|
+
"aria-label": "Move skill up",
|
|
183
|
+
onClick: () => $(t, -1),
|
|
184
|
+
children: /* @__PURE__ */ x(te, { size: 14 })
|
|
185
|
+
}),
|
|
186
|
+
/* @__PURE__ */ x(s, {
|
|
187
|
+
size: "sm",
|
|
188
|
+
variant: "ghost",
|
|
189
|
+
"aria-label": "Move skill down",
|
|
190
|
+
onClick: () => $(t, 1),
|
|
191
|
+
children: /* @__PURE__ */ x(C, { size: 14 })
|
|
192
|
+
}),
|
|
193
|
+
/* @__PURE__ */ x(s, {
|
|
194
|
+
size: "sm",
|
|
195
|
+
variant: "outline",
|
|
196
|
+
onClick: () => H({
|
|
197
|
+
...V,
|
|
198
|
+
skillIds: V.skillIds.filter((t) => t !== e)
|
|
199
|
+
}),
|
|
200
|
+
children: "Remove"
|
|
201
|
+
})
|
|
202
|
+
]
|
|
203
|
+
})
|
|
204
|
+
]
|
|
205
|
+
}, e);
|
|
206
|
+
})
|
|
207
|
+
}),
|
|
208
|
+
I && Q.length > 0 && /* @__PURE__ */ S("select", {
|
|
209
|
+
"aria-label": "Add skill",
|
|
210
|
+
className: E,
|
|
211
|
+
value: "",
|
|
212
|
+
onChange: (e) => e.target.value && H({
|
|
213
|
+
...V,
|
|
214
|
+
skillIds: [...V.skillIds, e.target.value]
|
|
215
|
+
}),
|
|
216
|
+
children: [/* @__PURE__ */ x("option", {
|
|
217
|
+
value: "",
|
|
218
|
+
children: "Add a skill…"
|
|
219
|
+
}), Q.map((e) => /* @__PURE__ */ x("option", {
|
|
220
|
+
value: e.id,
|
|
221
|
+
children: e.name
|
|
222
|
+
}, e.id))]
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
}),
|
|
226
|
+
/* @__PURE__ */ S("section", {
|
|
227
|
+
className: "space-y-2",
|
|
228
|
+
children: [/* @__PURE__ */ S("label", {
|
|
229
|
+
className: "grid gap-2 text-sm font-medium",
|
|
230
|
+
children: ["Retrieval profile", /* @__PURE__ */ S("select", {
|
|
231
|
+
"aria-label": "Retrieval profile",
|
|
232
|
+
className: E,
|
|
233
|
+
value: V.retrievalProfileId,
|
|
234
|
+
disabled: !I,
|
|
235
|
+
onChange: (e) => H({
|
|
236
|
+
...V,
|
|
237
|
+
retrievalProfileId: e.target.value
|
|
238
|
+
}),
|
|
239
|
+
children: [
|
|
240
|
+
/* @__PURE__ */ x("option", {
|
|
241
|
+
value: "",
|
|
242
|
+
children: "Default retrieval (vector, top 5)"
|
|
243
|
+
}),
|
|
244
|
+
F.data?.retrievalProfile && !z.data.some((e) => e.id === F.data?.retrievalProfile?.retrievalProfileId) && /* @__PURE__ */ S("option", {
|
|
245
|
+
value: F.data.retrievalProfile.retrievalProfileId,
|
|
246
|
+
children: [
|
|
247
|
+
F.data.retrievalProfile.name,
|
|
248
|
+
" ·",
|
|
249
|
+
" ",
|
|
250
|
+
F.data.retrievalProfile.strategyMode,
|
|
251
|
+
" · top",
|
|
252
|
+
" ",
|
|
253
|
+
F.data.retrievalProfile.topK
|
|
254
|
+
]
|
|
255
|
+
}),
|
|
256
|
+
z.data.filter((e) => k(e.status) || e.id === V.retrievalProfileId).map((e) => /* @__PURE__ */ S("option", {
|
|
257
|
+
value: e.id,
|
|
258
|
+
children: [
|
|
259
|
+
e.name,
|
|
260
|
+
" · ",
|
|
261
|
+
e.strategyMode,
|
|
262
|
+
" · top ",
|
|
263
|
+
e.topK
|
|
264
|
+
]
|
|
265
|
+
}, e.id))
|
|
266
|
+
]
|
|
267
|
+
})]
|
|
268
|
+
}), X && /* @__PURE__ */ S("p", {
|
|
269
|
+
className: "text-xs text-text-secondary",
|
|
270
|
+
children: [
|
|
271
|
+
X.strategyMode,
|
|
272
|
+
" search, top ",
|
|
273
|
+
X.topK,
|
|
274
|
+
X.minRelevanceScore != null && `, minimum relevance ${X.minRelevanceScore}`,
|
|
275
|
+
X.noAnswerIfBelowThreshold && ", abstains when nothing clears the threshold",
|
|
276
|
+
"."
|
|
277
|
+
]
|
|
278
|
+
})]
|
|
279
|
+
}),
|
|
280
|
+
P && /* @__PURE__ */ x("div", {
|
|
281
|
+
className: "flex justify-end",
|
|
282
|
+
children: /* @__PURE__ */ x(s, {
|
|
283
|
+
onClick: () => void ne(),
|
|
284
|
+
isLoading: M,
|
|
285
|
+
disabled: !q || M,
|
|
286
|
+
children: "Save bindings"
|
|
287
|
+
})
|
|
288
|
+
}),
|
|
289
|
+
F.data && /* @__PURE__ */ S("section", {
|
|
290
|
+
className: "space-y-2",
|
|
291
|
+
children: [/* @__PURE__ */ x("p", {
|
|
292
|
+
className: "text-sm font-medium",
|
|
293
|
+
children: "Effective system prompt"
|
|
294
|
+
}), /* @__PURE__ */ x("pre", {
|
|
295
|
+
"data-testid": "effective-system-prompt",
|
|
296
|
+
className: "max-h-80 overflow-auto whitespace-pre-wrap rounded-lg bg-bg-sunken p-4 font-mono text-sm",
|
|
297
|
+
children: F.data.effectiveSystemPrompt
|
|
298
|
+
})]
|
|
299
|
+
})
|
|
300
|
+
]
|
|
301
|
+
})] });
|
|
302
|
+
};
|
|
303
|
+
export { A as AgentBindingsPanel };
|
|
304
|
+
|
|
305
|
+
//# sourceMappingURL=AgentBindingsPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentBindingsPanel.js","names":["SELECT_CLASS","storedVariables","stored","bindings","draftFrom","variables","key","value","a","b","skill","isLive","status","AgentBindingsPanel","can","useBotmanorCan","busy","setBusy","useState","canUpdate","BOTMANOR_PERMISSIONS","useAgentBindings","agentId","editable","templates","usePromptTemplates","skills","useSkills","profiles","useRetrievalProfiles","useSetAgentBindings","draft","setDraft","selectedTemplate","usePromptTemplate","boundTemplate","staleTemplate","refetchTemplate","ready","declared","useMemo","promptTemplateVariables","boundProfile","selectedProfile","row","skillsById","availableSkills","moveSkill","next","target","index","delta","handleSave","boundTemplateId","templateChanged","promptVariables","variable","text","typedVariableValue","sendVariables","save","toast","error","graphqlErrorMessage","Card","CardHeader","CardTitle","Layers","CardDescription","CardContent","event","Input","skillId","Badge","bound","Button","ArrowUp","ArrowDown","id"],"sources":["../../../src/botlit/components/AgentBindingsPanel.tsx"],"sourcesContent":["/**\n * Agent Bindings Panel (BOFF-15360)\n * @module botlit/components\n *\n * Attach a prompt template (with its variable values), skills and a retrieval\n * profile to an agent. Every run of the agent — test chat, website assistant,\n * channels, A2A — composes its system prompt from them and retrieves\n * knowledge with the profile. Saved through `setAgentBindings`.\n */\nimport type { FC } from 'react';\nimport { useEffect, useMemo, useState } from 'react';\nimport { ArrowDown, ArrowUp, Layers } from 'lucide-react';\nimport { toast } from 'sonner';\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from './Card';\nimport { Button } from './Button';\nimport { Input } from './Input';\nimport { Badge } from './Badge';\nimport {\n promptTemplateVariables,\n usePromptTemplate,\n useAgentBindings,\n usePromptTemplates,\n useRetrievalProfiles,\n useSetAgentBindings,\n useSkills,\n type AgentBindingsRecord,\n} from '../hooks';\nimport { graphqlErrorMessage } from '../utils/errors';\nimport { typedVariableValue } from '../utils/promptVariables';\nimport { BOTMANOR_PERMISSIONS, useBotmanorCan } from '../permissions';\n\nconst SELECT_CLASS =\n 'h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 text-sm';\n\ninterface Draft {\n promptTemplateId: string;\n /** Text shown in each variable field. */\n variables: Record<string, string>;\n /** Names whose field was edited since the bindings loaded. */\n edited: string[];\n skillIds: string[];\n retrievalProfileId: string;\n}\n\nfunction storedVariables(bindings: AgentBindingsRecord | null): Record<string, unknown> {\n const stored = bindings?.promptTemplate?.variables;\n return stored && typeof stored === 'object' && !Array.isArray(stored)\n ? (stored as Record<string, unknown>)\n : {};\n}\n\nfunction draftFrom(bindings: AgentBindingsRecord | null): Draft {\n const variables: Record<string, string> = {};\n for (const [key, value] of Object.entries(storedVariables(bindings))) {\n variables[key] = typeof value === 'string' ? value : JSON.stringify(value);\n }\n return {\n promptTemplateId: bindings?.promptTemplate?.promptTemplateId ?? '',\n variables,\n edited: [],\n skillIds: [...(bindings?.skills ?? [])]\n .sort((a, b) => a.position - b.position)\n .map((skill) => skill.skillId),\n retrievalProfileId: bindings?.retrievalProfile?.retrievalProfileId ?? '',\n };\n}\n\nconst isLive = (status: string) => status !== 'ARCHIVED';\n\nexport const AgentBindingsPanel: FC<{ agentId: string }> = ({ agentId }) => {\n const can = useBotmanorCan();\n // Controls lock from Save until the saved bindings have been read back, so\n // an edit made meanwhile cannot be replaced by the refetched snapshot.\n const [busy, setBusy] = useState(false);\n const canUpdate = can(BOTMANOR_PERMISSIONS.AGENT_UPDATE);\n const bindings = useAgentBindings(agentId);\n // Nothing is editable before the stored bindings arrive: they would\n // replace any edit made meanwhile.\n const editable = canUpdate && !busy && Boolean(bindings.data) && !bindings.loading;\n const templates = usePromptTemplates();\n const skills = useSkills();\n const profiles = useRetrievalProfiles();\n const { save } = useSetAgentBindings(agentId);\n // Saving sends the complete binding set, so it waits until the stored\n // bindings and every catalog have loaded: an early click must never detach\n // what it has not seen yet.\n const [draft, setDraft] = useState<Draft>(() => draftFrom(null));\n // The selected template is read on its own: the catalog list is paged and\n // may not include it.\n const selectedTemplate = usePromptTemplate(draft.promptTemplateId || undefined);\n // A detail response for a template that is no longer selected is ignored.\n const boundTemplate =\n selectedTemplate.data && selectedTemplate.data.id === draft.promptTemplateId\n ? selectedTemplate.data\n : null;\n // A detail response for an earlier selection that landed last is replaced\n // by a fresh read of the selected template.\n const staleTemplate =\n Boolean(draft.promptTemplateId) &&\n !selectedTemplate.loading &&\n Boolean(selectedTemplate.data) &&\n selectedTemplate.data?.id !== draft.promptTemplateId;\n const { refetch: refetchTemplate } = selectedTemplate;\n useEffect(() => {\n if (staleTemplate) void refetchTemplate();\n }, [staleTemplate, refetchTemplate]);\n const ready =\n Boolean(bindings.data) &&\n (!draft.promptTemplateId || (boundTemplate !== null && !selectedTemplate.loading)) &&\n !bindings.loading &&\n !bindings.error &&\n !templates.loading &&\n !templates.error &&\n !skills.loading &&\n !skills.error &&\n !profiles.loading &&\n !profiles.error;\n\n useEffect(() => {\n setDraft(draftFrom(bindings.data));\n }, [bindings.data]);\n\n const declared = useMemo(\n () => (boundTemplate ? promptTemplateVariables(boundTemplate) : []),\n [boundTemplate]\n );\n // The details shown are those of the profile Save will attach.\n const boundProfile = bindings.data?.retrievalProfile;\n const selectedProfile = draft.retrievalProfileId\n ? (profiles.data.find((row) => row.id === draft.retrievalProfileId) ??\n (boundProfile?.retrievalProfileId === draft.retrievalProfileId ? boundProfile : null))\n : null;\n const skillsById = useMemo(() => new Map(skills.data.map((row) => [row.id, row])), [skills.data]);\n const availableSkills = skills.data.filter(\n (row) => isLive(row.status) && !draft.skillIds.includes(row.id)\n );\n\n const moveSkill = (index: number, delta: number) => {\n const next = [...draft.skillIds];\n const target = index + delta;\n if (target < 0 || target >= next.length) return;\n [next[index], next[target]] = [next[target], next[index]];\n setDraft({ ...draft, skillIds: next });\n };\n\n const handleSave = async () => {\n const boundTemplateId = bindings.data?.promptTemplate?.promptTemplateId ?? '';\n const templateChanged = draft.promptTemplateId !== boundTemplateId;\n // Unedited stored values are sent back exactly as stored (typed); an\n // edited field is converted for its declared type; empty fields are left\n // out so defaults apply.\n const stored = templateChanged ? {} : storedVariables(bindings.data);\n const promptVariables: Record<string, unknown> = {};\n for (const variable of declared) {\n const text = draft.variables[variable.name] ?? '';\n if (!draft.edited.includes(variable.name) && variable.name in stored) {\n promptVariables[variable.name] = stored[variable.name];\n } else if (text !== '') {\n promptVariables[variable.name] = typedVariableValue(variable.type, text);\n }\n }\n const sendVariables =\n Boolean(draft.promptTemplateId) && (templateChanged || draft.edited.length > 0);\n setBusy(true);\n try {\n await save({\n promptTemplateId: draft.promptTemplateId || null,\n // Variables are only sent when the template or a value changed, so a\n // skill or profile edit never rewrites the stored values.\n ...(sendVariables ? { promptVariables } : {}),\n skillIds: draft.skillIds,\n retrievalProfileId: draft.retrievalProfileId || null,\n });\n toast.success('Agent bindings saved');\n await bindings.refetch();\n } catch (error) {\n toast.error(graphqlErrorMessage(error, 'Failed to save the agent bindings'));\n } finally {\n setBusy(false);\n }\n };\n\n return (\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <Layers size={18} />\n Prompt template, skills & retrieval\n </CardTitle>\n <CardDescription>\n Every run of this agent starts from the bound prompt template, adds the agent's own\n system prompt and the skills below, and searches its knowledge with the retrieval profile.\n </CardDescription>\n </CardHeader>\n <CardContent className=\"space-y-6\">\n {bindings.error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {graphqlErrorMessage(bindings.error, 'Failed to load the agent bindings')}\n </p>\n )}\n\n <section className=\"space-y-3\">\n <label className=\"grid gap-2 text-sm font-medium\">\n Prompt template\n <select\n aria-label=\"Prompt template\"\n className={SELECT_CLASS}\n value={draft.promptTemplateId}\n disabled={!editable}\n onChange={(event) =>\n setDraft({\n ...draft,\n promptTemplateId: event.target.value,\n variables: {},\n edited: [],\n })\n }\n >\n <option value=\"\">No prompt template</option>\n {boundTemplate && !templates.data.some((row) => row.id === boundTemplate.id) && (\n <option value={boundTemplate.id}>\n {boundTemplate.name} · v{boundTemplate.version}\n </option>\n )}\n {templates.data\n .filter((row) => isLive(row.status) || row.id === draft.promptTemplateId)\n .map((row) => (\n <option key={row.id} value={row.id}>\n {row.name} · v{row.version}\n </option>\n ))}\n </select>\n </label>\n {declared.length > 0 && (\n <div className=\"grid gap-3 sm:grid-cols-2\">\n {declared.map((variable) => (\n <label key={variable.name} className=\"grid gap-1 text-sm\">\n <span>\n {`{{${variable.name}}}`}\n {variable.required && <span className=\"ml-1 text-status-error-text\">*</span>}\n </span>\n <Input\n aria-label={`Variable ${variable.name}`}\n disabled={!editable}\n placeholder={\n typeof variable.defaultValue === 'string'\n ? `Default: ${variable.defaultValue}`\n : (variable.description ?? variable.type)\n }\n value={draft.variables[variable.name] ?? ''}\n onChange={(event) =>\n setDraft({\n ...draft,\n variables: { ...draft.variables, [variable.name]: event.target.value },\n edited: draft.edited.includes(variable.name)\n ? draft.edited\n : [...draft.edited, variable.name],\n })\n }\n />\n </label>\n ))}\n </div>\n )}\n </section>\n\n <section className=\"space-y-3\">\n <p className=\"text-sm font-medium\">Skills</p>\n {draft.skillIds.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">No skills attached.</p>\n ) : (\n <ol className=\"space-y-2\">\n {draft.skillIds.map((skillId, index) => {\n const skill = skillsById.get(skillId);\n return (\n <li\n key={skillId}\n className=\"flex items-center gap-3 rounded-lg border border-border-subtle p-3\"\n >\n <Badge variant=\"outline\">#{index + 1}</Badge>\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium\">\n {skill?.name ??\n bindings.data?.skills.find((bound) => bound.skillId === skillId)?.name ??\n skillId}\n </p>\n {skill?.description && (\n <p className=\"truncate text-xs text-text-secondary\">{skill.description}</p>\n )}\n </div>\n {editable && (\n <div className=\"flex items-center gap-1\">\n <Button\n size=\"sm\"\n variant=\"ghost\"\n aria-label=\"Move skill up\"\n onClick={() => moveSkill(index, -1)}\n >\n <ArrowUp size={14} />\n </Button>\n <Button\n size=\"sm\"\n variant=\"ghost\"\n aria-label=\"Move skill down\"\n onClick={() => moveSkill(index, 1)}\n >\n <ArrowDown size={14} />\n </Button>\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() =>\n setDraft({\n ...draft,\n skillIds: draft.skillIds.filter((id) => id !== skillId),\n })\n }\n >\n Remove\n </Button>\n </div>\n )}\n </li>\n );\n })}\n </ol>\n )}\n {editable && availableSkills.length > 0 && (\n <select\n aria-label=\"Add skill\"\n className={SELECT_CLASS}\n value=\"\"\n onChange={(event) =>\n event.target.value &&\n setDraft({ ...draft, skillIds: [...draft.skillIds, event.target.value] })\n }\n >\n <option value=\"\">Add a skill…</option>\n {availableSkills.map((row) => (\n <option key={row.id} value={row.id}>\n {row.name}\n </option>\n ))}\n </select>\n )}\n </section>\n\n <section className=\"space-y-2\">\n <label className=\"grid gap-2 text-sm font-medium\">\n Retrieval profile\n <select\n aria-label=\"Retrieval profile\"\n className={SELECT_CLASS}\n value={draft.retrievalProfileId}\n disabled={!editable}\n onChange={(event) => setDraft({ ...draft, retrievalProfileId: event.target.value })}\n >\n <option value=\"\">Default retrieval (vector, top 5)</option>\n {bindings.data?.retrievalProfile &&\n !profiles.data.some(\n (row) => row.id === bindings.data?.retrievalProfile?.retrievalProfileId\n ) && (\n <option value={bindings.data.retrievalProfile.retrievalProfileId}>\n {bindings.data.retrievalProfile.name} ·{' '}\n {bindings.data.retrievalProfile.strategyMode} · top{' '}\n {bindings.data.retrievalProfile.topK}\n </option>\n )}\n {profiles.data\n .filter((row) => isLive(row.status) || row.id === draft.retrievalProfileId)\n .map((row) => (\n <option key={row.id} value={row.id}>\n {row.name} · {row.strategyMode} · top {row.topK}\n </option>\n ))}\n </select>\n </label>\n {selectedProfile && (\n <p className=\"text-xs text-text-secondary\">\n {selectedProfile.strategyMode} search, top {selectedProfile.topK}\n {selectedProfile.minRelevanceScore != null &&\n `, minimum relevance ${selectedProfile.minRelevanceScore}`}\n {selectedProfile.noAnswerIfBelowThreshold &&\n ', abstains when nothing clears the threshold'}\n .\n </p>\n )}\n </section>\n\n {canUpdate && (\n <div className=\"flex justify-end\">\n <Button onClick={() => void handleSave()} isLoading={busy} disabled={!ready || busy}>\n Save bindings\n </Button>\n </div>\n )}\n\n {bindings.data && (\n <section className=\"space-y-2\">\n <p className=\"text-sm font-medium\">Effective system prompt</p>\n <pre\n data-testid=\"effective-system-prompt\"\n className=\"max-h-80 overflow-auto whitespace-pre-wrap rounded-lg bg-bg-sunken p-4 font-mono text-sm\"\n >\n {bindings.data.effectiveSystemPrompt}\n </pre>\n </section>\n )}\n </CardContent>\n </Card>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+BA,IAAMA,IACJ;AAYF,SAASC,EAAgB,GAA+D;CACtF,IAAMC,IAASC,GAAU,gBAAgB;CACzC,OAAOD,KAAU,OAAOA,KAAW,YAAY,CAAC,MAAM,QAAQA,CAAM,IAC/DA,IACD,CAAC;AACP;AAEA,SAASE,EAAU,GAA6C;CAC9D,IAAMC,IAAoC,CAAC;CAC3C,KAAK,IAAM,CAACC,GAAKC,MAAU,OAAO,QAAQN,EAAgBE,CAAQ,CAAC,GACjE,EAAUG,KAAO,OAAOC,KAAU,WAAWA,IAAQ,KAAK,UAAUA,CAAK;CAE3E,OAAO;EACL,kBAAkBJ,GAAU,gBAAgB,oBAAoB;EAChE;EACA,QAAQ,CAAC;EACT,UAAU,CAAC,GAAIA,GAAU,UAAU,CAAC,CAAE,CAAC,CACpC,MAAM,GAAG,MAAMK,EAAE,WAAWC,EAAE,QAAQ,CAAC,CACvC,KAAK,MAAUC,EAAM,OAAO;EAC/B,oBAAoBP,GAAU,kBAAkB,sBAAsB;CACxE;AACF;AAEA,IAAMQ,KAAU,MAAmBC,MAAW,YAEjCC,KAA+C,EAAE,iBAAc;CAC1E,IAAMC,IAAMC,EAAe,GAGrB,CAACC,GAAMC,KAAWC,EAAS,EAAK,GAChCC,IAAYL,EAAIM,EAAqB,YAAY,GACjDjB,IAAWkB,EAAiBC,CAAO,GAGnCC,IAAWJ,KAAa,CAACH,KAAQ,EAAQb,EAAS,QAAS,CAACA,EAAS,SACrEqB,IAAYC,EAAmB,G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Y;KACZ,WAAU;KAET,UAAAA,EAAS,KAAK;IACZ,CAAA,CACE;;EAEA;CACT,CAAA,CAAA,EAAA,CAAA;AAEV"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
/** One thing a bot can be connected to: a workspace connector or a global channel. */
|
|
3
|
+
export interface SelectableChannel {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
/** Platform or connector type (SLACK, WEBHOOK, WEB_WIDGET, …). */
|
|
7
|
+
platform: string;
|
|
8
|
+
description?: string | null;
|
|
9
|
+
}
|
|
3
10
|
interface ChannelSelectorSheetProps {
|
|
4
11
|
/** Controls visibility of the sheet */
|
|
5
12
|
open: boolean;
|
|
@@ -8,7 +15,7 @@ interface ChannelSelectorSheetProps {
|
|
|
8
15
|
/** Callback when a channel is selected */
|
|
9
16
|
onSelectChannel: (channelId: string, platform: string) => void;
|
|
10
17
|
/** Available channels to display (already filtered by backend) */
|
|
11
|
-
availableChannels:
|
|
18
|
+
availableChannels: SelectableChannel[];
|
|
12
19
|
/** Platform icons mapping */
|
|
13
20
|
platformIcons: Record<string, ReactNode>;
|
|
14
21
|
/** Platform metadata mapping */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelSelectorSheet.js","names":["_Fragment","Fragment$1","ChannelSelectorSheet","useEffect","open","handleEscape","onClose","Button","X","availableChannels","platform","channel","meta","platformMeta","icon","platformIcons","onSelectChannel","Badge"],"sources":["../../../src/botlit/components/ChannelSelectorSheet.tsx"],"sourcesContent":["/**\n * ChannelSelectorSheet\n * @module botlit/components\n *\n * A slide-in sheet component that displays available communication channels\n * for selection when setting up bot integrations.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport { useEffect } from 'react';\nimport { X } from 'lucide-react';\nimport { Button } from './Button';\nimport { Badge } from './Badge';\
|
|
1
|
+
{"version":3,"file":"ChannelSelectorSheet.js","names":["_Fragment","Fragment$1","ChannelSelectorSheet","useEffect","open","handleEscape","onClose","Button","X","availableChannels","platform","channel","meta","platformMeta","icon","platformIcons","onSelectChannel","Badge"],"sources":["../../../src/botlit/components/ChannelSelectorSheet.tsx"],"sourcesContent":["/**\n * ChannelSelectorSheet\n * @module botlit/components\n *\n * A slide-in sheet component that displays available communication channels\n * for selection when setting up bot integrations.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport { useEffect } from 'react';\nimport { X } from 'lucide-react';\nimport { Button } from './Button';\nimport { Badge } from './Badge';\n\n/** One thing a bot can be connected to: a workspace connector or a global channel. */\nexport interface SelectableChannel {\n id: string;\n name: string;\n /** Platform or connector type (SLACK, WEBHOOK, WEB_WIDGET, …). */\n platform: string;\n description?: string | null;\n}\n\ninterface ChannelSelectorSheetProps {\n /** Controls visibility of the sheet */\n open: boolean;\n /** Callback when sheet is closed */\n onClose: () => void;\n /** Callback when a channel is selected */\n onSelectChannel: (channelId: string, platform: string) => void;\n /** Available channels to display (already filtered by backend) */\n availableChannels: SelectableChannel[];\n /** Platform icons mapping */\n platformIcons: Record<string, ReactNode>;\n /** Platform metadata mapping */\n platformMeta: Record<\n string,\n { label: string; badgeClass: string; accentBg: string; accentText: string }\n >;\n}\n\nexport const ChannelSelectorSheet: FC<ChannelSelectorSheetProps> = ({\n open,\n onClose,\n onSelectChannel,\n availableChannels,\n platformIcons,\n platformMeta,\n}) => {\n // Lock body scroll when sheet is open\n useEffect(() => {\n if (open) {\n document.body.style.overflow = 'hidden';\n } else {\n document.body.style.overflow = '';\n }\n return () => {\n document.body.style.overflow = '';\n };\n }, [open]);\n\n // Close on Escape key\n useEffect(() => {\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && open) {\n onClose();\n }\n };\n window.addEventListener('keydown', handleEscape);\n return () => window.removeEventListener('keydown', handleEscape);\n }, [open, onClose]);\n\n if (!open) return null;\n\n return (\n <>\n {/* Backdrop */}\n <div\n className=\"fixed inset-0 bg-bg-overlay z-40 transition-opacity duration-300\"\n onClick={onClose}\n aria-hidden=\"true\"\n />\n\n {/* Sheet */}\n <div\n className=\"fixed inset-y-0 right-0 z-50 w-full sm:max-w-md bg-bg-surface shadow-xl transform transition-transform duration-300 ease-out flex flex-col\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"channel-selector-title\"\n >\n {/* Header */}\n <div className=\"flex items-center justify-between px-6 py-4 border-b border-border-subtle shrink-0\">\n <div>\n <h2 id=\"channel-selector-title\" className=\"text-lg font-semibold\">\n Select a Channel\n </h2>\n <p className=\"text-sm text-text-secondary mt-0.5\">\n Choose a platform to connect to your bot\n </p>\n </div>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={onClose}\n className=\"shrink-0\"\n aria-label=\"Close\"\n >\n <X size={18} />\n </Button>\n </div>\n\n {/* Content */}\n <div className=\"flex-1 overflow-y-auto px-6 py-4\">\n {availableChannels.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <p className=\"text-sm text-text-secondary\">No channels available to configure.</p>\n <p className=\"text-xs text-text-secondary mt-2\">\n All available channels have already been connected to this bot.\n </p>\n </div>\n ) : (\n <div className=\"space-y-3\">\n {availableChannels.map((channel) => {\n const platform = channel.platform;\n const meta = platformMeta[platform] || {\n label: platform,\n badgeClass: 'bg-bg-sunken text-text-secondary',\n accentBg: 'bg-accent',\n accentText: 'text-text-primary',\n };\n const icon = platformIcons[platform];\n\n return (\n <button\n key={channel.id}\n onClick={() => {\n onSelectChannel(channel.id, platform);\n onClose();\n }}\n className=\"w-full text-left p-4 rounded-lg border border-border-subtle bg-bg-surface hover:bg-bg-sunken/50 transition-colors focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:ring-offset-2\"\n >\n <div className=\"flex items-start gap-3\">\n {/* Icon */}\n <div className={`p-2 rounded-md ${meta.accentBg} shrink-0`}>\n <span className={meta.accentText}>{icon}</span>\n </div>\n\n {/* Content */}\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 mb-1\">\n <h3 className=\"font-medium text-sm\">{channel.name}</h3>\n <Badge className={`text-xs ${meta.badgeClass}`}>{meta.label}</Badge>\n </div>\n {channel.description && (\n <p className=\"text-xs text-text-secondary line-clamp-2\">\n {channel.description}\n </p>\n )}\n </div>\n\n {/* Arrow indicator */}\n <div className=\"shrink-0 self-center text-text-secondary\">\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M6 12L10 8L6 4\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </div>\n </div>\n </button>\n );\n })}\n </div>\n )}\n </div>\n\n {/* Footer */}\n <div className=\"px-6 py-4 border-t border-border-subtle shrink-0\">\n <Button variant=\"outline\" onClick={onClose} className=\"w-full\">\n Cancel\n </Button>\n </div>\n </div>\n </>\n );\n};\n"],"mappings":";;;;;;AAyCA,IAAaE,KAAuD,EAClE,SACA,YACA,oBACA,sBACA,kBACA,uBAGAC,SACMC,IACF,SAAS,KAAK,MAAM,WAAW,WAE/B,SAAS,KAAK,MAAM,WAAW,UAEpB;CACX,SAAS,KAAK,MAAM,WAAW;AACjC,IACC,CAACA,CAAI,CAAC,GAGTD,QAAgB;CACd,IAAME,KAAgB,MAAqB;EACzC,AAAI,EAAE,QAAQ,YAAYD,KACxBE,EAAQ;CAEZ;CAEA,OADA,OAAO,iBAAiB,WAAWD,CAAY,SAClC,OAAO,oBAAoB,WAAWA,CAAY;AACjE,GAAG,CAACD,GAAME,CAAO,CAAC,GAEbF,IAGH,kBAAAJ,GAAA,EAAA,UAAA,CAEE,kBAAC,OAAD;CACE,WAAU;CACV,SAASM;CACT,eAAY;AACb,CAAA,GAGD,kBAAC,OAAD;CACE,WAAU;CACV,MAAK;CACL,cAAW;CACX,mBAAgB;CAJlB,UAAA;EAOE,kBAAC,OAAD;GAAK,WAAU;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L,EAAK;WAAe,UAAAA,EAAK;UAAa,CAAA,CAChE;SACJ,CAAA,GAAAD,EAAQ,eACP,kBAAC,KAAD;UAAG,WAAU;UACV,UAAAA,EAAQ;SACR,CAAA,CAEF;;QAGL,kBAAC,OAAD;SAAK,WAAU;SACb,UAAA,kBAAC,OAAD;UACE,OAAM;UACN,QAAO;UACP,SAAQ;UACR,MAAK;UACL,OAAM;UAEN,UAAA,kBAAC,QAAD;WACE,GAAE;WACF,QAAO;WACP,aAAY;WACZ,eAAc;WACd,gBAAe;UAChB,CAAA;SACE,CAAA;QACF,CAAA;OACF;;KACC,GA7CDA,EAAQ,EA6CP;IAEZ,CAAC;GACE,CAAA;EAEJ,CAAA;EAGL,kBAAC,OAAD;GAAK,WAAU;GACb,UAAA,kBAACJ,GAAD;IAAQ,SAAQ;IAAU,SAASD;IAAS,WAAU;IAAS,UAAA;GAEvD,CAAA;EACL,CAAA;CACF;AACL,CAAA,CAAA,EAAA,CAAA,IAzHc"}
|
|
@@ -12,7 +12,7 @@ export { useMCPServers, useMCPServer, useMCPResources, useMCPTools, useCreateMCP
|
|
|
12
12
|
export type { MCPServerRecord, MCPToolRecord, MCPResourceRecord } from './useMCPServers';
|
|
13
13
|
export { useA2AAgents, useA2AAgent, useRegisterA2AAgent, useUpdateA2AAgent, useDeleteA2AAgent, useValidateA2AAgent, validateAgentCard, a2aAgentSkillCount, a2aKeys, } from './useA2A';
|
|
14
14
|
export type { A2AAgentRecord } from './useA2A';
|
|
15
|
-
export { useChannelConnectors, useChannelConnector, useCreateChannelConnector, useUpdateChannelConnector, useDeleteChannelConnector, useFindChannelConnector, useChannelRoutes, useBotChannelRoutes, useChannelRoute, useCreateChannelRoute, useUpdateChannelRoute, useDeleteChannelRoute, routeMetadataString, channelKeys, } from './useChannels';
|
|
15
|
+
export { useChannelConnectors, useAllChannelConnectors, useChannelConnector, useCreateChannelConnector, useUpdateChannelConnector, useDeleteChannelConnector, useFindChannelConnector, useChannelRoutes, useBotChannelRoutes, useChannelRoute, useCreateChannelRoute, useUpdateChannelRoute, useDeleteChannelRoute, routeMetadataString, channelKeys, } from './useChannels';
|
|
16
16
|
export type { ChannelConnectorRecord, ChannelRouteRecord } from './useChannels';
|
|
17
17
|
export { PLATFORM_CREDENTIALS, connectorPlatform, generateSigningSecret, validateCredentials, useActiveOrganizationId, useInboundChannel, useProvisionChannel, } from './useChannelSetup';
|
|
18
18
|
export type { CredentialFieldDefinition, PlatformCredentialDefinition, InboundChannelData, } from './useChannelSetup';
|
|
@@ -24,6 +24,8 @@ export { useSkills, useSkill, useCreateSkill, useUpdateSkill, useDeleteSkill, sk
|
|
|
24
24
|
export type { SkillRecord } from './useSkills';
|
|
25
25
|
export { usePromptTemplates, usePromptTemplate, useCreatePromptTemplate, useUpdatePromptTemplate, useDeletePromptTemplate, useRenderPromptTemplate, promptTemplateVariables, promptTemplateKeys, } from './usePromptTemplates';
|
|
26
26
|
export type { PromptTemplateRecord } from './usePromptTemplates';
|
|
27
|
+
export { useAgentBindings, useSetAgentBindings, useTestPromptTemplate, useSavePromptTemplateVersion, usePromptTemplateVersions, } from './useAgentBindings';
|
|
28
|
+
export type { AgentBindingsRecord, PromptTemplateTestRecord, PromptTemplateVersionRecord, } from './useAgentBindings';
|
|
27
29
|
export { useExecutions, useExecution, useCreateExecution, useUpdateExecutionStatus, useExecutionMetrics, summariseExecutions, executionKeys, } from './useExecutions';
|
|
28
30
|
export type { ExecutionRecord, ExecutionRollup } from './useExecutions';
|
|
29
31
|
export { useBuckets, useBucketTree, useBucket, useChildBuckets, useCreateBucket, useUpdateBucket, useDeleteBucket, buildBucketTree, bucketKeys, } from './useBuckets';
|
|
@@ -4,17 +4,18 @@ import "./useKnowledgeBases.js";
|
|
|
4
4
|
import { useRetrievalProfiles as n } from "./useRetrievalProfiles.js";
|
|
5
5
|
import { isMCPServerHealthy as r, mcpServerDescription as i, mcpServerEndpoint as a, useCreateMCPServer as o, useDeleteMCPServer as s, useMCPResources as c, useMCPServer as l, useMCPTools as u, useTestMCPConnection as d, useUpdateMCPServer as f, useUpdateMCPTool as p } from "./useMCPServers.js";
|
|
6
6
|
import { a2aAgentSkillCount as m, useA2AAgents as h } from "./useA2A.js";
|
|
7
|
-
import { routeMetadataString as g,
|
|
8
|
-
import { PLATFORM_CREDENTIALS as
|
|
9
|
-
import { useCreatePolicy as
|
|
10
|
-
import { useApplyRetention as
|
|
11
|
-
import { useCreateSkill as
|
|
12
|
-
import { promptTemplateVariables as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
7
|
+
import { routeMetadataString as g, useAllChannelConnectors as _, useBotChannelRoutes as v, useChannelConnector as y, useChannelConnectors as b, useChannelRoutes as x, useCreateChannelConnector as S, useCreateChannelRoute as C, useDeleteChannelConnector as w, useDeleteChannelRoute as T, useFindChannelConnector as E, useUpdateChannelConnector as D } from "./useChannels.js";
|
|
8
|
+
import { PLATFORM_CREDENTIALS as O, connectorPlatform as k, useActiveOrganizationId as A, useInboundChannel as j, useProvisionChannel as M, validateCredentials as N } from "./useChannelSetup.js";
|
|
9
|
+
import { useCreatePolicy as P, useDeletePolicy as F, usePolicies as I, usePolicy as L, useUpdatePolicy as R } from "./usePolicies.js";
|
|
10
|
+
import { useApplyRetention as z, useRetentionStatus as B } from "./useRetention.js";
|
|
11
|
+
import { useCreateSkill as V, useDeleteSkill as H, useSkill as U, useSkills as W, useUpdateSkill as G } from "./useSkills.js";
|
|
12
|
+
import { promptTemplateVariables as K, useCreatePromptTemplate as q, useDeletePromptTemplate as J, usePromptTemplate as Y, usePromptTemplates as X, useRenderPromptTemplate as Z, useUpdatePromptTemplate as Q } from "./usePromptTemplates.js";
|
|
13
|
+
import { useAgentBindings as $, usePromptTemplateVersions as ee, useSavePromptTemplateVersion as te, useSetAgentBindings as ne, useTestPromptTemplate as re } from "./useAgentBindings.js";
|
|
14
|
+
import { summariseExecutions as ie, useExecutions as ae } from "./useExecutions.js";
|
|
15
|
+
import { useBucket as oe, useBucketTree as se, useBuckets as ce, useChildBuckets as le, useCreateBucket as ue, useDeleteBucket as de, useUpdateBucket as fe } from "./useBuckets.js";
|
|
16
|
+
import { storePackageDescription as pe, storePackageName as me, useInstallPackage as he, useInstalledPackages as ge, usePinPackageVersion as _e, useStorePackage as ve, useStorePackages as ye, useUninstallPackage as be, useUpdateInstalledPackage as xe } from "./useStore.js";
|
|
16
17
|
import "./useLLMProviders.js";
|
|
17
|
-
import { useGlobalChannels as
|
|
18
|
-
import { useConfigureSupervisor as
|
|
19
|
-
import { useAcceptHandoff as
|
|
20
|
-
export {
|
|
18
|
+
import { useGlobalChannels as Se, useInitiateSlackConnect as Ce, useLinkIntegrationConnection as we, useMyUserPlatformConnection as Te, useRevokeSlackConnection as Ee, useToggleSlackNotifications as De } from "./useUserPlatformConnection.js";
|
|
19
|
+
import { useConfigureSupervisor as Oe, useRunSupervisorNow as ke, useSupervisorConfig as Ae, useSupervisorRuns as je } from "./useAiOperations.js";
|
|
20
|
+
import { useAcceptHandoff as Me, useHandoffConfig as Ne, useHandoffQueue as Pe, useRejectHandoff as Fe, useReleaseHandoff as Ie, useResolveHandoff as Le, useUpsertHandoffConfig as Re } from "./useHandoffs.js";
|
|
21
|
+
export { O as PLATFORM_CREDENTIALS, m as a2aAgentSkillCount, k as connectorPlatform, r as isMCPServerHealthy, i as mcpServerDescription, a as mcpServerEndpoint, K as promptTemplateVariables, g as routeMetadataString, pe as storePackageDescription, me as storePackageName, ie as summariseExecutions, h as useA2AAgents, Me as useAcceptHandoff, A as useActiveOrganizationId, $ as useAgentBindings, t as useAgents, _ as useAllChannelConnectors, z as useApplyRetention, v as useBotChannelRoutes, e as useBots, oe as useBucket, se as useBucketTree, ce as useBuckets, y as useChannelConnector, b as useChannelConnectors, x as useChannelRoutes, le as useChildBuckets, Oe as useConfigureSupervisor, ue as useCreateBucket, S as useCreateChannelConnector, C as useCreateChannelRoute, o as useCreateMCPServer, P as useCreatePolicy, q as useCreatePromptTemplate, V as useCreateSkill, de as useDeleteBucket, w as useDeleteChannelConnector, T as useDeleteChannelRoute, s as useDeleteMCPServer, F as useDeletePolicy, J as useDeletePromptTemplate, H as useDeleteSkill, ae as useExecutions, E as useFindChannelConnector, Se as useGlobalChannels, Ne as useHandoffConfig, Pe as useHandoffQueue, j as useInboundChannel, Ce as useInitiateSlackConnect, he as useInstallPackage, ge as useInstalledPackages, we as useLinkIntegrationConnection, c as useMCPResources, l as useMCPServer, u as useMCPTools, Te as useMyUserPlatformConnection, _e as usePinPackageVersion, I as usePolicies, L as usePolicy, Y as usePromptTemplate, ee as usePromptTemplateVersions, X as usePromptTemplates, M as useProvisionChannel, Fe as useRejectHandoff, Ie as useReleaseHandoff, Z as useRenderPromptTemplate, Le as useResolveHandoff, B as useRetentionStatus, n as useRetrievalProfiles, Ee as useRevokeSlackConnection, ke as useRunSupervisorNow, te as useSavePromptTemplateVersion, ne as useSetAgentBindings, U as useSkill, W as useSkills, ve as useStorePackage, ye as useStorePackages, Ae as useSupervisorConfig, je as useSupervisorRuns, d as useTestMCPConnection, re as useTestPromptTemplate, De as useToggleSlackNotifications, be as useUninstallPackage, fe as useUpdateBucket, D as useUpdateChannelConnector, xe as useUpdateInstalledPackage, f as useUpdateMCPServer, p as useUpdateMCPTool, R as useUpdatePolicy, Q as useUpdatePromptTemplate, G as useUpdateSkill, Re as useUpsertHandoffConfig, N as validateCredentials };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ApolloClient, DefaultContext } from '../../../../node_modules/@apollo/client';
|
|
2
|
+
export interface WorkspaceScopedGlobalClient {
|
|
3
|
+
/** The shell's global-gateway client. */
|
|
4
|
+
client: ApolloClient;
|
|
5
|
+
/** Apollo operation context to pass on every call made through `client`. */
|
|
6
|
+
context: DefaultContext;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Operation context that scopes a global call to `workspaceId`'s organization.
|
|
10
|
+
* Without a workspace there is nothing to scope to and the call keeps the
|
|
11
|
+
* account scope.
|
|
12
|
+
*/
|
|
13
|
+
export declare function workspaceScopeContext(workspaceId: string | null | undefined): DefaultContext;
|
|
14
|
+
/** The global client plus the context that scopes its calls to the active workspace. */
|
|
15
|
+
export declare function useWorkspaceScopedGlobalClient(): WorkspaceScopedGlobalClient;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useBotlit as e } from "../../providers/BotlitProvider.js";
|
|
2
|
+
import { useMemo as t } from "react";
|
|
3
|
+
import { useGatewayClient as n } from "@burdenoff/fe-libs/shared/graphql";
|
|
4
|
+
// src/botlit/hooks/internal/globalWorkspaceScope.ts
|
|
5
|
+
function r(e) {
|
|
6
|
+
return e ? {
|
|
7
|
+
requiredWorkspaceAuth: !0,
|
|
8
|
+
requiredWorkspaceId: e,
|
|
9
|
+
queryDeduplication: !1
|
|
10
|
+
} : {};
|
|
11
|
+
}
|
|
12
|
+
function i() {
|
|
13
|
+
let i = n("global"), { workspaceId: a } = e();
|
|
14
|
+
return t(() => ({
|
|
15
|
+
client: i,
|
|
16
|
+
context: r(a)
|
|
17
|
+
}), [i, a]);
|
|
18
|
+
}
|
|
19
|
+
export { i as useWorkspaceScopedGlobalClient, r as workspaceScopeContext };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=globalWorkspaceScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globalWorkspaceScope.js","names":["workspaceScopeContext","workspaceId","useWorkspaceScopedGlobalClient","client","useGatewayClient","useBotlit","useMemo"],"sources":["../../../../src/botlit/hooks/internal/globalWorkspaceScope.ts"],"sourcesContent":["/**\n * Global-gateway calls made for the active workspace\n * @module botlit/hooks/internal\n *\n * Global channels (and the platform connections on them) belong to an\n * organization. The global public gateway takes a user session's organization\n * from the account JWT — the user's home organization — and never from a\n * header. A workspace of another organization therefore created its channels\n * in the home organization (the connector bind then failed with \"The channel\n * was not found in this organization\") and could not list its own channels\n * (`GetChannels` 403) (BOFF-15360).\n *\n * The shell's global client attaches the active workspace's token when an\n * operation asks for workspace scope (`requiredWorkspaceAuth`); the gateway\n * then takes the organization, tenant and workspace from that verified token.\n * Required, not preferred: a channel created in the account organization is\n * the bug, so a missing token or a workspace switch mid-request must fail the\n * operation instead of silently falling back.\n */\n\nimport type { ApolloClient, DefaultContext } from '@apollo/client';\nimport { useMemo } from 'react';\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { useBotlit } from '../../providers/BotlitProvider';\n\nexport interface WorkspaceScopedGlobalClient {\n /** The shell's global-gateway client. */\n client: ApolloClient;\n /** Apollo operation context to pass on every call made through `client`. */\n context: DefaultContext;\n}\n\n/**\n * Operation context that scopes a global call to `workspaceId`'s organization.\n * Without a workspace there is nothing to scope to and the call keeps the\n * account scope.\n */\nexport function workspaceScopeContext(workspaceId: string | null | undefined): DefaultContext {\n if (!workspaceId) return {};\n // Deduplication could hand one workspace's in-flight answer to another.\n return {\n requiredWorkspaceAuth: true,\n requiredWorkspaceId: workspaceId,\n queryDeduplication: false,\n };\n}\n\n/** The global client plus the context that scopes its calls to the active workspace. */\nexport function useWorkspaceScopedGlobalClient(): WorkspaceScopedGlobalClient {\n const client = useGatewayClient('global');\n const { workspaceId } = useBotlit();\n return useMemo(\n () => ({ client, context: workspaceScopeContext(workspaceId) }),\n [client, workspaceId]\n );\n}\n"],"mappings":";;;;AAsCA,SAAgBA,EAAsB,GAAwD;CAG5F,OAFKC,IAEE;EACL,uBAAuB;EACvB,qBAAqBA;EACrB,oBAAoB;CACtB,IANyB,CAAC;AAO5B;AAGA,SAAgBC,IAA8D;CAC5E,IAAMC,IAASC,EAAiB,QAAQ,GAClC,EAAE,mBAAgBC,EAAU;CAClC,OAAOC,SACE;EAAE;EAAQ,SAASN,EAAsBC,CAAW;CAAE,IAC7D,CAACE,GAAQF,CAAW,CACtB;AACF"}
|
|
@@ -83,6 +83,13 @@ export interface WorkspacePaginatedQueryOptions<TData, TRow, TResult> {
|
|
|
83
83
|
* (e.g. executions search) sees every loaded page, not just the last one.
|
|
84
84
|
*/
|
|
85
85
|
export declare function useWorkspacePaginatedQuery<TData, TRow, TResult>(options: WorkspacePaginatedQueryOptions<TData, TRow, TResult>): PaginatedQueryResult<TResult>;
|
|
86
|
+
/**
|
|
87
|
+
* Every page of an offset-paginated list (BOFF-15360), for callers that must
|
|
88
|
+
* see the whole list at once (pickers, "already configured" checks).
|
|
89
|
+
* `loading` holds until the last page has arrived; a failed page stops paging
|
|
90
|
+
* and sets `error`. `refetch` restarts from page one.
|
|
91
|
+
*/
|
|
92
|
+
export declare function useWorkspaceAllPagesQuery<TData, TRow, TResult>(options: WorkspacePaginatedQueryOptions<TData, TRow, TResult>): QueryResult<TResult>;
|
|
86
93
|
export interface WorkspaceMutationOptions<TData, TInput, TResult> {
|
|
87
94
|
/** Generated GraphQL document (see `src/generated/wspace-operations.ts`). */
|
|
88
95
|
document: DocumentNode;
|