@burdenoff/microfe-botmanor 2026.1117.2 → 2026.1118.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/botlit/BotlitRoutes.js +59 -55
- package/dist/botlit/BotlitRoutes.js.map +1 -1
- package/dist/botlit/components/AgentA2APanel.d.ts +13 -0
- package/dist/botlit/components/AgentA2APanel.js +149 -0
- package/dist/botlit/components/AgentA2APanel.js.map +1 -0
- package/dist/botlit/components/BotAgentsPanel.d.ts +15 -0
- package/dist/botlit/components/BotAgentsPanel.js +341 -0
- package/dist/botlit/components/BotAgentsPanel.js.map +1 -0
- package/dist/botlit/components/BotFormFields.d.ts +4 -0
- package/dist/botlit/components/BotFormFields.js +108 -74
- package/dist/botlit/components/BotFormFields.js.map +1 -1
- package/dist/botlit/components/BotRoutingSummary.d.ts +13 -0
- package/dist/botlit/components/BotRoutingSummary.js +126 -0
- package/dist/botlit/components/BotRoutingSummary.js.map +1 -0
- package/dist/botlit/components/BotVersionHistoryPanel.d.ts +8 -0
- package/dist/botlit/components/BotVersionHistoryPanel.js +172 -0
- package/dist/botlit/components/BotVersionHistoryPanel.js.map +1 -0
- package/dist/botlit/components/CreateFromTemplate.d.ts +12 -0
- package/dist/botlit/components/CreateFromTemplate.js +129 -0
- package/dist/botlit/components/CreateFromTemplate.js.map +1 -0
- package/dist/botlit/components/EntityTags.d.ts +24 -0
- package/dist/botlit/components/EntityTags.js +72 -0
- package/dist/botlit/components/EntityTags.js.map +1 -0
- package/dist/botlit/components/GuardrailPoliciesPanel.d.ts +10 -0
- package/dist/botlit/components/GuardrailPoliciesPanel.js +91 -0
- package/dist/botlit/components/GuardrailPoliciesPanel.js.map +1 -0
- package/dist/botlit/hooks/useA2AConnections.d.ts +21 -0
- package/dist/botlit/hooks/useA2AConnections.js +82 -0
- package/dist/botlit/hooks/useA2AConnections.js.map +1 -0
- package/dist/botlit/hooks/useAgentTestChat.d.ts +29 -0
- package/dist/botlit/hooks/useAgentTestChat.js +35 -0
- package/dist/botlit/hooks/useAgentTestChat.js.map +1 -0
- package/dist/botlit/hooks/useAgents.d.ts +3 -0
- package/dist/botlit/hooks/useAgents.js +4 -0
- package/dist/botlit/hooks/useAgents.js.map +1 -1
- package/dist/botlit/hooks/useBotAgents.d.ts +22 -1
- package/dist/botlit/hooks/useBotAgents.js +46 -12
- package/dist/botlit/hooks/useBotAgents.js.map +1 -1
- package/dist/botlit/hooks/useBotVersions.d.ts +25 -0
- package/dist/botlit/hooks/useBotVersions.js +69 -0
- package/dist/botlit/hooks/useBotVersions.js.map +1 -0
- package/dist/botlit/hooks/useBots.d.ts +3 -0
- package/dist/botlit/hooks/useBots.js +4 -0
- package/dist/botlit/hooks/useBots.js.map +1 -1
- package/dist/botlit/hooks/useLLMProviders.js +40 -32
- package/dist/botlit/hooks/useLLMProviders.js.map +1 -1
- package/dist/botlit/hooks/useTemplates.d.ts +19 -0
- package/dist/botlit/hooks/useTemplates.js +71 -0
- package/dist/botlit/hooks/useTemplates.js.map +1 -0
- package/dist/botlit/pages/AgentBuilderPage.js +388 -347
- package/dist/botlit/pages/AgentBuilderPage.js.map +1 -1
- package/dist/botlit/pages/AgentDetailPage.js +237 -247
- package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
- package/dist/botlit/pages/AgentTestChatPage.d.ts +2 -0
- package/dist/botlit/pages/AgentTestChatPage.js +176 -0
- package/dist/botlit/pages/AgentTestChatPage.js.map +1 -0
- package/dist/botlit/pages/AgentsListPage.js +2 -2
- package/dist/botlit/pages/AgentsListPage.js.map +1 -1
- package/dist/botlit/pages/BotDetailPage.js +398 -447
- package/dist/botlit/pages/BotDetailPage.js.map +1 -1
- package/dist/botlit/pages/ChatPage.js +19 -12
- package/dist/botlit/pages/ChatPage.js.map +1 -1
- package/dist/botlit/pages/SettingsPage.d.ts +7 -0
- package/dist/botlit/pages/SettingsPage.js +120 -85
- package/dist/botlit/pages/SettingsPage.js.map +1 -1
- package/dist/botlit/pages/index.d.ts +1 -0
- package/dist/botlit/utils/botRouting.d.ts +42 -0
- package/dist/botlit/utils/botRouting.js +52 -0
- package/dist/botlit/utils/botRouting.js.map +1 -0
- package/dist/generated/wspace-operations.js +41 -43
- package/dist/generated/wspace-operations.js.map +1 -1
- package/package.json +1 -1
|
@@ -10,16 +10,21 @@ var d = [
|
|
|
10
10
|
"ROUND_ROBIN",
|
|
11
11
|
"INTELLIGENT",
|
|
12
12
|
"CUSTOM"
|
|
13
|
-
], f =
|
|
13
|
+
], f = [
|
|
14
|
+
"PRIVATE",
|
|
15
|
+
"WORKSPACE",
|
|
16
|
+
"PUBLIC"
|
|
17
|
+
], p = "🤖", m = {
|
|
14
18
|
name: "",
|
|
15
19
|
slug: "",
|
|
16
20
|
description: "",
|
|
17
|
-
icon:
|
|
21
|
+
icon: p,
|
|
18
22
|
routingStrategy: "SINGLE",
|
|
23
|
+
visibility: "PRIVATE",
|
|
19
24
|
welcomeMessage: "",
|
|
20
25
|
fallbackMessage: "",
|
|
21
26
|
defaultAgentId: ""
|
|
22
|
-
},
|
|
27
|
+
}, h = [
|
|
23
28
|
{
|
|
24
29
|
icon: "🤖",
|
|
25
30
|
key: "robot",
|
|
@@ -70,12 +75,12 @@ var d = [
|
|
|
70
75
|
key: "lightning",
|
|
71
76
|
label: "Lightning"
|
|
72
77
|
}
|
|
73
|
-
],
|
|
78
|
+
], g = ({ value: n, onChange: r }) => {
|
|
74
79
|
let i = e();
|
|
75
80
|
return /* @__PURE__ */ l(t, {
|
|
76
81
|
value: n,
|
|
77
82
|
onChange: r,
|
|
78
|
-
choices:
|
|
83
|
+
choices: h.map(({ icon: e, key: t, label: n }) => ({
|
|
79
84
|
emoji: e,
|
|
80
85
|
key: t,
|
|
81
86
|
label: n
|
|
@@ -84,148 +89,177 @@ var d = [
|
|
|
84
89
|
optionLabel: (e) => i(`botlit.botDetail.form.icons.${e.key}`, e.label),
|
|
85
90
|
currentLabel: i("botlit.botDetail.form.icons.current", "Current icon")
|
|
86
91
|
});
|
|
87
|
-
},
|
|
88
|
-
let
|
|
92
|
+
}, _ = ({ idPrefix: t, value: p, onChange: m, errors: h, showErrors: _, mode: v, agents: y }) => {
|
|
93
|
+
let b = e(), x = (e) => `${t}-${e}`, S = (e) => e ? b(`botlit.botDetail.form.errors.${e}`, a[e], {
|
|
89
94
|
nameMax: 100,
|
|
90
95
|
slugMax: 64
|
|
91
|
-
}) : void 0,
|
|
96
|
+
}) : void 0, C = _ ? S(h.name) : void 0, w = _ ? S(h.slug) : void 0, T = p.slug.trim() === "" ? o(p.name) : "", E = (e, t, n) => t ? x(`${e}-error`) : n ? x(`${e}-description`) : void 0;
|
|
92
97
|
return /* @__PURE__ */ u("div", {
|
|
93
98
|
className: "space-y-6",
|
|
94
99
|
children: [
|
|
95
100
|
/* @__PURE__ */ l("div", {
|
|
96
101
|
className: "flex items-start gap-4",
|
|
97
|
-
children: /* @__PURE__ */ l(
|
|
98
|
-
value:
|
|
99
|
-
onChange: (e) =>
|
|
100
|
-
...
|
|
102
|
+
children: /* @__PURE__ */ l(g, {
|
|
103
|
+
value: p.icon,
|
|
104
|
+
onChange: (e) => m({
|
|
105
|
+
...p,
|
|
101
106
|
icon: e
|
|
102
107
|
})
|
|
103
108
|
})
|
|
104
109
|
}),
|
|
105
110
|
/* @__PURE__ */ l(n, {
|
|
106
|
-
label:
|
|
111
|
+
label: b("botlit.botDetail.form.botName", "Bot Name"),
|
|
107
112
|
required: !0,
|
|
108
|
-
htmlFor:
|
|
109
|
-
error:
|
|
113
|
+
htmlFor: x("name"),
|
|
114
|
+
error: C,
|
|
110
115
|
children: /* @__PURE__ */ l(r, {
|
|
111
|
-
id:
|
|
116
|
+
id: x("name"),
|
|
112
117
|
required: !0,
|
|
113
118
|
maxLength: 120,
|
|
114
|
-
"aria-invalid":
|
|
115
|
-
"aria-describedby":
|
|
116
|
-
placeholder:
|
|
117
|
-
value:
|
|
118
|
-
onChange: (e) =>
|
|
119
|
-
...
|
|
119
|
+
"aria-invalid": C ? !0 : void 0,
|
|
120
|
+
"aria-describedby": E("name", C, !1),
|
|
121
|
+
placeholder: b("botlit.botDetail.form.botNamePlaceholder", "e.g., Customer Support Bot"),
|
|
122
|
+
value: p.name,
|
|
123
|
+
onChange: (e) => m({
|
|
124
|
+
...p,
|
|
120
125
|
name: e.target.value
|
|
121
126
|
})
|
|
122
127
|
})
|
|
123
128
|
}),
|
|
124
129
|
/* @__PURE__ */ l(n, {
|
|
125
|
-
label:
|
|
126
|
-
htmlFor:
|
|
127
|
-
error:
|
|
128
|
-
description:
|
|
130
|
+
label: b("botlit.botDetail.form.slug", "Slug"),
|
|
131
|
+
htmlFor: x("slug"),
|
|
132
|
+
error: w,
|
|
133
|
+
description: T ? b("botlit.botDetail.form.slugDerived", "Will be saved as \"{{slug}}\".", { slug: T }) : b("botlit.botDetail.form.slugHelp", "Lowercase letters, numbers and hyphens. Left empty, it is made from the name."),
|
|
129
134
|
children: /* @__PURE__ */ l(r, {
|
|
130
|
-
id:
|
|
131
|
-
"aria-invalid":
|
|
132
|
-
"aria-describedby":
|
|
133
|
-
placeholder:
|
|
134
|
-
value:
|
|
135
|
-
onChange: (e) =>
|
|
136
|
-
...
|
|
135
|
+
id: x("slug"),
|
|
136
|
+
"aria-invalid": w ? !0 : void 0,
|
|
137
|
+
"aria-describedby": E("slug", w, !0),
|
|
138
|
+
placeholder: b("botlit.botDetail.form.slugPlaceholder", "customer-support-bot"),
|
|
139
|
+
value: p.slug,
|
|
140
|
+
onChange: (e) => m({
|
|
141
|
+
...p,
|
|
137
142
|
slug: e.target.value
|
|
138
143
|
})
|
|
139
144
|
})
|
|
140
145
|
}),
|
|
141
146
|
/* @__PURE__ */ l(n, {
|
|
142
|
-
label:
|
|
143
|
-
htmlFor:
|
|
147
|
+
label: b("botlit.botDetail.form.description", "Description"),
|
|
148
|
+
htmlFor: x("description"),
|
|
144
149
|
children: /* @__PURE__ */ l(i, {
|
|
145
|
-
id:
|
|
146
|
-
placeholder:
|
|
147
|
-
value:
|
|
148
|
-
onChange: (e) =>
|
|
149
|
-
...
|
|
150
|
+
id: x("description"),
|
|
151
|
+
placeholder: b("botlit.botDetail.form.descriptionPlaceholder", "Describe what this bot does..."),
|
|
152
|
+
value: p.description,
|
|
153
|
+
onChange: (e) => m({
|
|
154
|
+
...p,
|
|
150
155
|
description: e.target.value
|
|
151
156
|
}),
|
|
152
157
|
rows: 4
|
|
153
158
|
})
|
|
154
159
|
}),
|
|
155
160
|
/* @__PURE__ */ l(n, {
|
|
156
|
-
label:
|
|
157
|
-
htmlFor:
|
|
161
|
+
label: b("botlit.botDetail.form.routingStrategy", "Routing Strategy"),
|
|
162
|
+
htmlFor: x("routing"),
|
|
158
163
|
children: /* @__PURE__ */ u("select", {
|
|
159
|
-
id:
|
|
164
|
+
id: x("routing"),
|
|
160
165
|
className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
|
|
161
|
-
value:
|
|
162
|
-
onChange: (e) =>
|
|
163
|
-
...
|
|
166
|
+
value: p.routingStrategy,
|
|
167
|
+
onChange: (e) => m({
|
|
168
|
+
...p,
|
|
164
169
|
routingStrategy: s(e.target.value, d, "SINGLE")
|
|
165
170
|
}),
|
|
166
171
|
children: [
|
|
167
172
|
/* @__PURE__ */ l("option", {
|
|
168
173
|
value: "SINGLE",
|
|
169
|
-
children:
|
|
174
|
+
children: b("botlit.botDetail.routing.single", "Single")
|
|
170
175
|
}),
|
|
171
176
|
/* @__PURE__ */ l("option", {
|
|
172
177
|
value: "ROUND_ROBIN",
|
|
173
|
-
children:
|
|
178
|
+
children: b("botlit.botDetail.routing.roundRobin", "Round Robin")
|
|
174
179
|
}),
|
|
175
180
|
/* @__PURE__ */ l("option", {
|
|
176
181
|
value: "INTELLIGENT",
|
|
177
|
-
children:
|
|
182
|
+
children: b("botlit.botDetail.routing.intelligent", "Intelligent")
|
|
178
183
|
}),
|
|
179
184
|
/* @__PURE__ */ l("option", {
|
|
180
185
|
value: "CUSTOM",
|
|
181
|
-
children:
|
|
186
|
+
children: b("botlit.botDetail.routing.custom", "Custom")
|
|
187
|
+
})
|
|
188
|
+
]
|
|
189
|
+
})
|
|
190
|
+
}),
|
|
191
|
+
/* @__PURE__ */ l(n, {
|
|
192
|
+
label: b("botlit.botDetail.form.visibility", "Visibility"),
|
|
193
|
+
htmlFor: x("visibility"),
|
|
194
|
+
description: b("botlit.botDetail.form.visibilityHelp", "Private: only you. Workspace: everyone in this workspace. Public: shareable outside it."),
|
|
195
|
+
children: /* @__PURE__ */ u("select", {
|
|
196
|
+
id: x("visibility"),
|
|
197
|
+
"aria-describedby": x("visibility-description"),
|
|
198
|
+
className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
|
|
199
|
+
value: p.visibility,
|
|
200
|
+
onChange: (e) => m({
|
|
201
|
+
...p,
|
|
202
|
+
visibility: s(e.target.value, f, "PRIVATE")
|
|
203
|
+
}),
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ l("option", {
|
|
206
|
+
value: "PRIVATE",
|
|
207
|
+
children: b("botlit.botDetail.visibility.private", "Private")
|
|
208
|
+
}),
|
|
209
|
+
/* @__PURE__ */ l("option", {
|
|
210
|
+
value: "WORKSPACE",
|
|
211
|
+
children: b("botlit.botDetail.visibility.workspace", "Workspace")
|
|
212
|
+
}),
|
|
213
|
+
/* @__PURE__ */ l("option", {
|
|
214
|
+
value: "PUBLIC",
|
|
215
|
+
children: b("botlit.botDetail.visibility.public", "Public")
|
|
182
216
|
})
|
|
183
217
|
]
|
|
184
218
|
})
|
|
185
219
|
}),
|
|
186
|
-
|
|
220
|
+
v === "edit" && /* @__PURE__ */ u(c, { children: [
|
|
187
221
|
/* @__PURE__ */ l(n, {
|
|
188
|
-
label:
|
|
189
|
-
htmlFor:
|
|
222
|
+
label: b("botlit.botDetail.form.welcomeMessage", "Welcome Message"),
|
|
223
|
+
htmlFor: x("welcome"),
|
|
190
224
|
children: /* @__PURE__ */ l(i, {
|
|
191
|
-
id:
|
|
192
|
-
placeholder:
|
|
193
|
-
value:
|
|
194
|
-
onChange: (e) =>
|
|
195
|
-
...
|
|
225
|
+
id: x("welcome"),
|
|
226
|
+
placeholder: b("botlit.botDetail.form.welcomeMessagePlaceholder", "Welcome message shown to users..."),
|
|
227
|
+
value: p.welcomeMessage,
|
|
228
|
+
onChange: (e) => m({
|
|
229
|
+
...p,
|
|
196
230
|
welcomeMessage: e.target.value
|
|
197
231
|
}),
|
|
198
232
|
rows: 3
|
|
199
233
|
})
|
|
200
234
|
}),
|
|
201
235
|
/* @__PURE__ */ l(n, {
|
|
202
|
-
label:
|
|
203
|
-
htmlFor:
|
|
236
|
+
label: b("botlit.botDetail.form.fallbackMessage", "Fallback Message"),
|
|
237
|
+
htmlFor: x("fallback"),
|
|
204
238
|
children: /* @__PURE__ */ l(r, {
|
|
205
|
-
id:
|
|
206
|
-
placeholder:
|
|
207
|
-
value:
|
|
208
|
-
onChange: (e) =>
|
|
209
|
-
...
|
|
239
|
+
id: x("fallback"),
|
|
240
|
+
placeholder: b("botlit.botDetail.form.fallbackMessagePlaceholder", "Message when agent can't respond..."),
|
|
241
|
+
value: p.fallbackMessage,
|
|
242
|
+
onChange: (e) => m({
|
|
243
|
+
...p,
|
|
210
244
|
fallbackMessage: e.target.value
|
|
211
245
|
})
|
|
212
246
|
})
|
|
213
247
|
}),
|
|
214
248
|
/* @__PURE__ */ l(n, {
|
|
215
|
-
label:
|
|
216
|
-
htmlFor:
|
|
249
|
+
label: b("botlit.botDetail.form.defaultAgent", "Default Agent"),
|
|
250
|
+
htmlFor: x("default-agent"),
|
|
217
251
|
children: /* @__PURE__ */ u("select", {
|
|
218
|
-
id:
|
|
252
|
+
id: x("default-agent"),
|
|
219
253
|
className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
|
|
220
|
-
value:
|
|
221
|
-
onChange: (e) =>
|
|
222
|
-
...
|
|
254
|
+
value: p.defaultAgentId,
|
|
255
|
+
onChange: (e) => m({
|
|
256
|
+
...p,
|
|
223
257
|
defaultAgentId: e.target.value
|
|
224
258
|
}),
|
|
225
259
|
children: [/* @__PURE__ */ l("option", {
|
|
226
260
|
value: "",
|
|
227
|
-
children:
|
|
228
|
-
}),
|
|
261
|
+
children: b("botlit.botDetail.form.noDefaultAgent", "No default agent")
|
|
262
|
+
}), y?.map((e) => /* @__PURE__ */ l("option", {
|
|
229
263
|
value: e.id,
|
|
230
264
|
children: e.name
|
|
231
265
|
}, e.id))]
|
|
@@ -235,6 +269,6 @@ var d = [
|
|
|
235
269
|
]
|
|
236
270
|
});
|
|
237
271
|
};
|
|
238
|
-
export {
|
|
272
|
+
export { f as BOT_VISIBILITIES, _ as BotFormFields, m as DEFAULT_BOT_FORM, p as DEFAULT_BOT_ICON, d as ROUTING_STRATEGIES };
|
|
239
273
|
|
|
240
274
|
//# sourceMappingURL=BotFormFields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BotFormFields.js","names":["_Fragment","ROUTING_STRATEGIES","DEFAULT_BOT_ICON","DEFAULT_BOT_FORM","ICON_CHOICES","IconChooser","t","useTr","EmojiPicker","icon","choice","BotFormFields","id","idPrefix","field","message","key","BOT_IDENTITY_MESSAGES","nameError","showErrors","errors","slugError","derivedSlug","value","slugify","describedBy","error","hasDescription","onChange","FormField","Input","Textarea","toUnion","mode","Fragment","agents","agent"],"sources":["../../../src/botlit/components/BotFormFields.tsx"],"sourcesContent":["/**\n * Bot form fields\n * @module botlit/components\n *\n * The fields shared by the create and edit bot forms (BOFF-12439, 12440, 12443).\n * One component so validation messages, field ids and accessibility are fixed\n * once: inline errors tied to their inputs with `aria-describedby`, `aria-invalid`\n * and a native `required`, and an icon chooser that is a real radio group\n * (keyboard and screen-reader operable) instead of a button that cycles emojis.\n */\n\nimport type { FC } from 'react';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { EmojiPicker } from './EmojiPicker';\nimport { FormField, Input, Textarea } from './Input';\nimport {\n BOT_IDENTITY_MESSAGES,\n BOT_NAME_MAX_LENGTH,\n BOT_SLUG_MAX_LENGTH,\n slugify,\n type BotIdentityErrors,\n} from '../utils/botIdentity';\nimport { cn } from '../utils/cn';\nimport { toUnion } from '../utils/unions';\n\n/** Routing strategies the bot form offers. */\nexport const ROUTING_STRATEGIES = ['SINGLE', 'ROUND_ROBIN', 'INTELLIGENT', 'CUSTOM'] as const;\nexport type BotRoutingStrategy = (typeof ROUTING_STRATEGIES)[number];\n\n/** Editable subset of a bot app — one field per `UpdateBotAppInput` field. */\nexport interface BotAppForm {\n name: string;\n slug: string;\n description: string;\n icon: string;\n routingStrategy: BotRoutingStrategy;\n welcomeMessage: string;\n fallbackMessage: string;\n defaultAgentId: string;\n}\n\nexport const DEFAULT_BOT_ICON = '\\u{1F916}';\n\nexport const DEFAULT_BOT_FORM: BotAppForm = {\n name: '',\n slug: '',\n description: '',\n icon: DEFAULT_BOT_ICON,\n routingStrategy: 'SINGLE',\n welcomeMessage: '',\n fallbackMessage: '',\n defaultAgentId: '',\n};\n\n/** Icons the chooser offers, with the name a screen reader announces. */\nconst ICON_CHOICES: ReadonlyArray<{ icon: string; key: string; label: string }> = [\n { icon: '🤖', key: 'robot', label: 'Robot' },\n { icon: '💼', key: 'briefcase', label: 'Briefcase' },\n { icon: '🎧', key: 'headset', label: 'Headset' },\n { icon: '📊', key: 'chart', label: 'Chart' },\n { icon: '🎯', key: 'target', label: 'Target' },\n { icon: '🔧', key: 'wrench', label: 'Wrench' },\n { icon: '📚', key: 'books', label: 'Books' },\n { icon: '💡', key: 'idea', label: 'Light bulb' },\n { icon: '🚀', key: 'rocket', label: 'Rocket' },\n { icon: '⚡', key: 'lightning', label: 'Lightning' },\n];\n\nconst IconChooser: FC<{ value: string; onChange: (icon: string) => void }> = ({\n value,\n onChange,\n}) => {\n const t = useTr();\n return (\n <EmojiPicker\n value={value}\n onChange={onChange}\n choices={ICON_CHOICES.map(({ icon, key, label }) => ({ emoji: icon, key, label }))}\n groupLabel={t('botlit.botDetail.form.icon', 'Icon')}\n optionLabel={(choice) => t(`botlit.botDetail.form.icons.${choice.key}`, choice.label)}\n currentLabel={t('botlit.botDetail.form.icons.current', 'Current icon')}\n />\n );\n};\n\ninterface BotFormFieldsProps {\n /** Prefix for field ids, so the create and edit forms never collide. */\n idPrefix: string;\n value: BotAppForm;\n onChange: (next: BotAppForm) => void;\n /** Validation result; only shown once the user has tried to submit. */\n errors: BotIdentityErrors;\n showErrors: boolean;\n /** Edit mode also exposes the welcome and fallback messages and the default agent. */\n mode: 'create' | 'edit';\n agents?: ReadonlyArray<{ id: string; name: string }>;\n}\n\nexport const BotFormFields: FC<BotFormFieldsProps> = ({\n idPrefix,\n value,\n onChange,\n errors,\n showErrors,\n mode,\n agents,\n}) => {\n const t = useTr();\n const id = (field: string) => `${idPrefix}-${field}`;\n const message = (key: keyof typeof BOT_IDENTITY_MESSAGES | undefined) =>\n key\n ? t(`botlit.botDetail.form.errors.${key}`, BOT_IDENTITY_MESSAGES[key], {\n nameMax: BOT_NAME_MAX_LENGTH,\n slugMax: BOT_SLUG_MAX_LENGTH,\n })\n : undefined;\n const nameError = showErrors ? message(errors.name) : undefined;\n const slugError = showErrors ? message(errors.slug) : undefined;\n const derivedSlug = value.slug.trim() === '' ? slugify(value.name) : '';\n\n const describedBy = (field: string, error: string | undefined, hasDescription: boolean) =>\n error ? id(`${field}-error`) : hasDescription ? id(`${field}-description`) : undefined;\n\n return (\n <div className=\"space-y-6\">\n <div className=\"flex items-start gap-4\">\n <IconChooser value={value.icon} onChange={(icon) => onChange({ ...value, icon })} />\n </div>\n\n <FormField\n label={t('botlit.botDetail.form.botName', 'Bot Name')}\n required\n htmlFor={id('name')}\n error={nameError}\n >\n <Input\n id={id('name')}\n required\n maxLength={BOT_NAME_MAX_LENGTH + 20}\n aria-invalid={nameError ? true : undefined}\n aria-describedby={describedBy('name', nameError, false)}\n placeholder={t('botlit.botDetail.form.botNamePlaceholder', 'e.g., Customer Support Bot')}\n value={value.name}\n onChange={(e) => onChange({ ...value, name: e.target.value })}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.slug', 'Slug')}\n htmlFor={id('slug')}\n error={slugError}\n description={\n derivedSlug\n ? t('botlit.botDetail.form.slugDerived', 'Will be saved as \"{{slug}}\".', {\n slug: derivedSlug,\n })\n : t(\n 'botlit.botDetail.form.slugHelp',\n 'Lowercase letters, numbers and hyphens. Left empty, it is made from the name.'\n )\n }\n >\n <Input\n id={id('slug')}\n aria-invalid={slugError ? true : undefined}\n aria-describedby={describedBy('slug', slugError, true)}\n placeholder={t('botlit.botDetail.form.slugPlaceholder', 'customer-support-bot')}\n value={value.slug}\n onChange={(e) => onChange({ ...value, slug: e.target.value })}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.description', 'Description')}\n htmlFor={id('description')}\n >\n <Textarea\n id={id('description')}\n placeholder={t(\n 'botlit.botDetail.form.descriptionPlaceholder',\n 'Describe what this bot does...'\n )}\n value={value.description}\n onChange={(e) => onChange({ ...value, description: e.target.value })}\n rows={4}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.routingStrategy', 'Routing Strategy')}\n htmlFor={id('routing')}\n >\n <select\n id={id('routing')}\n className=\"flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm\"\n value={value.routingStrategy}\n onChange={(e) =>\n onChange({\n ...value,\n routingStrategy: toUnion(e.target.value, ROUTING_STRATEGIES, 'SINGLE'),\n })\n }\n >\n <option value=\"SINGLE\">{t('botlit.botDetail.routing.single', 'Single')}</option>\n <option value=\"ROUND_ROBIN\">\n {t('botlit.botDetail.routing.roundRobin', 'Round Robin')}\n </option>\n <option value=\"INTELLIGENT\">\n {t('botlit.botDetail.routing.intelligent', 'Intelligent')}\n </option>\n <option value=\"CUSTOM\">{t('botlit.botDetail.routing.custom', 'Custom')}</option>\n </select>\n </FormField>\n\n {mode === 'edit' && (\n <>\n <FormField\n label={t('botlit.botDetail.form.welcomeMessage', 'Welcome Message')}\n htmlFor={id('welcome')}\n >\n <Textarea\n id={id('welcome')}\n placeholder={t(\n 'botlit.botDetail.form.welcomeMessagePlaceholder',\n 'Welcome message shown to users...'\n )}\n value={value.welcomeMessage}\n onChange={(e) => onChange({ ...value, welcomeMessage: e.target.value })}\n rows={3}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.fallbackMessage', 'Fallback Message')}\n htmlFor={id('fallback')}\n >\n <Input\n id={id('fallback')}\n placeholder={t(\n 'botlit.botDetail.form.fallbackMessagePlaceholder',\n \"Message when agent can't respond...\"\n )}\n value={value.fallbackMessage}\n onChange={(e) => onChange({ ...value, fallbackMessage: e.target.value })}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.defaultAgent', 'Default Agent')}\n htmlFor={id('default-agent')}\n >\n <select\n id={id('default-agent')}\n className=\"flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm\"\n value={value.defaultAgentId}\n onChange={(e) => onChange({ ...value, defaultAgentId: e.target.value })}\n >\n <option value=\"\">\n {t('botlit.botDetail.form.noDefaultAgent', 'No default agent')}\n </option>\n {agents?.map((agent) => (\n <option key={agent.id} value={agent.id}>\n {agent.name}\n </option>\n ))}\n </select>\n </FormField>\n </>\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;AA0BA,IAAaC,IAAqB;CAAC;CAAU;CAAe;CAAe;AAAQ,GAetEC,IAAmB,MAEnBC,IAA+B;CAC1C,MAAM;CACN,MAAM;CACN,aAAa;CACb,MAAMD;CACN,iBAAiB;CACjB,gBAAgB;CAChB,iBAAiB;CACjB,gBAAgB;AAClB,GAGME,IAA4E;CAChF;EAAE,MAAM;EAAM,KAAK;EAAS,OAAO;CAAQ;CAC3C;EAAE,MAAM;EAAM,KAAK;EAAa,OAAO;CAAY;CACnD;EAAE,MAAM;EAAM,KAAK;EAAW,OAAO;CAAU;CAC/C;EAAE,MAAM;EAAM,KAAK;EAAS,OAAO;CAAQ;CA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;MAAM,CAAC;KACxE,CAAA;IACQ,CAAA;IAEX,kBAACM,GAAD;KACE,OAAOvB,EAAE,sCAAsC,eAAe;KAC9D,SAASM,EAAG,eAAe;KAE3B,UAAA,kBAAC,UAAD;MACE,IAAIA,EAAG,eAAe;MACtB,WAAU;MACV,OAAOW,EAAM;MACb,WAAW,MAAMK,EAAS;OAAE,GAAGL;OAAO,gBAAgB,EAAE,OAAO;MAAM,CAAC;MAJxE,UAAA,CAME,kBAAC,UAAD;OAAQ,OAAM;OACX,UAAAjB,EAAE,wCAAwC,kBAAkB;MACvD,CAAA,GACP6B,GAAQ,KAAK,MACZ,kBAAC,UAAD;OAAuB,OAAOC,EAAM;OACjC,UAAAA,EAAM;MACD,GAFKA,EAAM,EAEX,CACT,CACK;;IACC,CAAA;GACX,EAAA,CAAA;EAED;;AAET"}
|
|
1
|
+
{"version":3,"file":"BotFormFields.js","names":["_Fragment","ROUTING_STRATEGIES","BOT_VISIBILITIES","DEFAULT_BOT_ICON","DEFAULT_BOT_FORM","ICON_CHOICES","IconChooser","t","useTr","EmojiPicker","icon","choice","BotFormFields","id","idPrefix","field","message","key","BOT_IDENTITY_MESSAGES","nameError","showErrors","errors","slugError","derivedSlug","value","slugify","describedBy","error","hasDescription","onChange","FormField","Input","Textarea","toUnion","mode","Fragment","agents","agent"],"sources":["../../../src/botlit/components/BotFormFields.tsx"],"sourcesContent":["/**\n * Bot form fields\n * @module botlit/components\n *\n * The fields shared by the create and edit bot forms (BOFF-12439, 12440, 12443).\n * One component so validation messages, field ids and accessibility are fixed\n * once: inline errors tied to their inputs with `aria-describedby`, `aria-invalid`\n * and a native `required`, and an icon chooser that is a real radio group\n * (keyboard and screen-reader operable) instead of a button that cycles emojis.\n */\n\nimport type { FC } from 'react';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { EmojiPicker } from './EmojiPicker';\nimport { FormField, Input, Textarea } from './Input';\nimport {\n BOT_IDENTITY_MESSAGES,\n BOT_NAME_MAX_LENGTH,\n BOT_SLUG_MAX_LENGTH,\n slugify,\n type BotIdentityErrors,\n} from '../utils/botIdentity';\nimport { cn } from '../utils/cn';\nimport { toUnion } from '../utils/unions';\n\n/** Routing strategies the bot form offers. */\nexport const ROUTING_STRATEGIES = ['SINGLE', 'ROUND_ROBIN', 'INTELLIGENT', 'CUSTOM'] as const;\nexport type BotRoutingStrategy = (typeof ROUTING_STRATEGIES)[number];\n\n/** Who can see the bot (`BotAppVisibility`). */\nexport const BOT_VISIBILITIES = ['PRIVATE', 'WORKSPACE', 'PUBLIC'] as const;\nexport type BotVisibility = (typeof BOT_VISIBILITIES)[number];\n\n/** Editable subset of a bot app — one field per `UpdateBotAppInput` field. */\nexport interface BotAppForm {\n name: string;\n slug: string;\n description: string;\n icon: string;\n routingStrategy: BotRoutingStrategy;\n visibility: BotVisibility;\n welcomeMessage: string;\n fallbackMessage: string;\n defaultAgentId: string;\n}\n\nexport const DEFAULT_BOT_ICON = '\\u{1F916}';\n\nexport const DEFAULT_BOT_FORM: BotAppForm = {\n name: '',\n slug: '',\n description: '',\n icon: DEFAULT_BOT_ICON,\n routingStrategy: 'SINGLE',\n visibility: 'PRIVATE',\n welcomeMessage: '',\n fallbackMessage: '',\n defaultAgentId: '',\n};\n\n/** Icons the chooser offers, with the name a screen reader announces. */\nconst ICON_CHOICES: ReadonlyArray<{ icon: string; key: string; label: string }> = [\n { icon: '🤖', key: 'robot', label: 'Robot' },\n { icon: '💼', key: 'briefcase', label: 'Briefcase' },\n { icon: '🎧', key: 'headset', label: 'Headset' },\n { icon: '📊', key: 'chart', label: 'Chart' },\n { icon: '🎯', key: 'target', label: 'Target' },\n { icon: '🔧', key: 'wrench', label: 'Wrench' },\n { icon: '📚', key: 'books', label: 'Books' },\n { icon: '💡', key: 'idea', label: 'Light bulb' },\n { icon: '🚀', key: 'rocket', label: 'Rocket' },\n { icon: '⚡', key: 'lightning', label: 'Lightning' },\n];\n\nconst IconChooser: FC<{ value: string; onChange: (icon: string) => void }> = ({\n value,\n onChange,\n}) => {\n const t = useTr();\n return (\n <EmojiPicker\n value={value}\n onChange={onChange}\n choices={ICON_CHOICES.map(({ icon, key, label }) => ({ emoji: icon, key, label }))}\n groupLabel={t('botlit.botDetail.form.icon', 'Icon')}\n optionLabel={(choice) => t(`botlit.botDetail.form.icons.${choice.key}`, choice.label)}\n currentLabel={t('botlit.botDetail.form.icons.current', 'Current icon')}\n />\n );\n};\n\ninterface BotFormFieldsProps {\n /** Prefix for field ids, so the create and edit forms never collide. */\n idPrefix: string;\n value: BotAppForm;\n onChange: (next: BotAppForm) => void;\n /** Validation result; only shown once the user has tried to submit. */\n errors: BotIdentityErrors;\n showErrors: boolean;\n /** Edit mode also exposes the welcome and fallback messages and the default agent. */\n mode: 'create' | 'edit';\n agents?: ReadonlyArray<{ id: string; name: string }>;\n}\n\nexport const BotFormFields: FC<BotFormFieldsProps> = ({\n idPrefix,\n value,\n onChange,\n errors,\n showErrors,\n mode,\n agents,\n}) => {\n const t = useTr();\n const id = (field: string) => `${idPrefix}-${field}`;\n const message = (key: keyof typeof BOT_IDENTITY_MESSAGES | undefined) =>\n key\n ? t(`botlit.botDetail.form.errors.${key}`, BOT_IDENTITY_MESSAGES[key], {\n nameMax: BOT_NAME_MAX_LENGTH,\n slugMax: BOT_SLUG_MAX_LENGTH,\n })\n : undefined;\n const nameError = showErrors ? message(errors.name) : undefined;\n const slugError = showErrors ? message(errors.slug) : undefined;\n const derivedSlug = value.slug.trim() === '' ? slugify(value.name) : '';\n\n const describedBy = (field: string, error: string | undefined, hasDescription: boolean) =>\n error ? id(`${field}-error`) : hasDescription ? id(`${field}-description`) : undefined;\n\n return (\n <div className=\"space-y-6\">\n <div className=\"flex items-start gap-4\">\n <IconChooser value={value.icon} onChange={(icon) => onChange({ ...value, icon })} />\n </div>\n\n <FormField\n label={t('botlit.botDetail.form.botName', 'Bot Name')}\n required\n htmlFor={id('name')}\n error={nameError}\n >\n <Input\n id={id('name')}\n required\n maxLength={BOT_NAME_MAX_LENGTH + 20}\n aria-invalid={nameError ? true : undefined}\n aria-describedby={describedBy('name', nameError, false)}\n placeholder={t('botlit.botDetail.form.botNamePlaceholder', 'e.g., Customer Support Bot')}\n value={value.name}\n onChange={(e) => onChange({ ...value, name: e.target.value })}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.slug', 'Slug')}\n htmlFor={id('slug')}\n error={slugError}\n description={\n derivedSlug\n ? t('botlit.botDetail.form.slugDerived', 'Will be saved as \"{{slug}}\".', {\n slug: derivedSlug,\n })\n : t(\n 'botlit.botDetail.form.slugHelp',\n 'Lowercase letters, numbers and hyphens. Left empty, it is made from the name.'\n )\n }\n >\n <Input\n id={id('slug')}\n aria-invalid={slugError ? true : undefined}\n aria-describedby={describedBy('slug', slugError, true)}\n placeholder={t('botlit.botDetail.form.slugPlaceholder', 'customer-support-bot')}\n value={value.slug}\n onChange={(e) => onChange({ ...value, slug: e.target.value })}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.description', 'Description')}\n htmlFor={id('description')}\n >\n <Textarea\n id={id('description')}\n placeholder={t(\n 'botlit.botDetail.form.descriptionPlaceholder',\n 'Describe what this bot does...'\n )}\n value={value.description}\n onChange={(e) => onChange({ ...value, description: e.target.value })}\n rows={4}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.routingStrategy', 'Routing Strategy')}\n htmlFor={id('routing')}\n >\n <select\n id={id('routing')}\n className=\"flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm\"\n value={value.routingStrategy}\n onChange={(e) =>\n onChange({\n ...value,\n routingStrategy: toUnion(e.target.value, ROUTING_STRATEGIES, 'SINGLE'),\n })\n }\n >\n <option value=\"SINGLE\">{t('botlit.botDetail.routing.single', 'Single')}</option>\n <option value=\"ROUND_ROBIN\">\n {t('botlit.botDetail.routing.roundRobin', 'Round Robin')}\n </option>\n <option value=\"INTELLIGENT\">\n {t('botlit.botDetail.routing.intelligent', 'Intelligent')}\n </option>\n <option value=\"CUSTOM\">{t('botlit.botDetail.routing.custom', 'Custom')}</option>\n </select>\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.visibility', 'Visibility')}\n htmlFor={id('visibility')}\n description={t(\n 'botlit.botDetail.form.visibilityHelp',\n 'Private: only you. Workspace: everyone in this workspace. Public: shareable outside it.'\n )}\n >\n <select\n id={id('visibility')}\n aria-describedby={id('visibility-description')}\n className=\"flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm\"\n value={value.visibility}\n onChange={(e) =>\n onChange({\n ...value,\n visibility: toUnion(e.target.value, BOT_VISIBILITIES, 'PRIVATE'),\n })\n }\n >\n <option value=\"PRIVATE\">{t('botlit.botDetail.visibility.private', 'Private')}</option>\n <option value=\"WORKSPACE\">\n {t('botlit.botDetail.visibility.workspace', 'Workspace')}\n </option>\n <option value=\"PUBLIC\">{t('botlit.botDetail.visibility.public', 'Public')}</option>\n </select>\n </FormField>\n\n {mode === 'edit' && (\n <>\n <FormField\n label={t('botlit.botDetail.form.welcomeMessage', 'Welcome Message')}\n htmlFor={id('welcome')}\n >\n <Textarea\n id={id('welcome')}\n placeholder={t(\n 'botlit.botDetail.form.welcomeMessagePlaceholder',\n 'Welcome message shown to users...'\n )}\n value={value.welcomeMessage}\n onChange={(e) => onChange({ ...value, welcomeMessage: e.target.value })}\n rows={3}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.fallbackMessage', 'Fallback Message')}\n htmlFor={id('fallback')}\n >\n <Input\n id={id('fallback')}\n placeholder={t(\n 'botlit.botDetail.form.fallbackMessagePlaceholder',\n \"Message when agent can't respond...\"\n )}\n value={value.fallbackMessage}\n onChange={(e) => onChange({ ...value, fallbackMessage: e.target.value })}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.defaultAgent', 'Default Agent')}\n htmlFor={id('default-agent')}\n >\n <select\n id={id('default-agent')}\n className=\"flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm\"\n value={value.defaultAgentId}\n onChange={(e) => onChange({ ...value, defaultAgentId: e.target.value })}\n >\n <option value=\"\">\n {t('botlit.botDetail.form.noDefaultAgent', 'No default agent')}\n </option>\n {agents?.map((agent) => (\n <option key={agent.id} value={agent.id}>\n {agent.name}\n </option>\n ))}\n </select>\n </FormField>\n </>\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;AA0BA,IAAaC,IAAqB;CAAC;CAAU;CAAe;CAAe;AAAQ,GAItEC,IAAmB;CAAC;CAAW;CAAa;AAAQ,GAgBpDC,IAAmB,MAEnBC,IAA+B;CAC1C,MAAM;CACN,MAAM;CACN,aAAa;CACb,MAAMD;CACN,iBAAiB;CACjB,YAAY;CACZ,gBAAgB;CAChB,iBAAiB;CACjB,gBAAgB;AAClB,GAGME,IAA4E;CAChF;EAAE,MAAM;EAAM,KAAK;EAAS,OAAO;CAAQ;CAC3C;EAAE,MAAM;EAAM,KAAK;EAAa,OAAO;CAAY;CACnD;EAAE,MAAM;EAAM,KAAK;EAAW,OAAO;CAAU;CAC/C;EAAE,MAAM;EAAM,KAAK;EAAS,OAAO;CAAQ;CAC3C;EAAE,MAAM;EAAM,KAAK;EAAU,OAAO;CAAS;CAC7C;EAAE,MAAM;EAAM,KAAK;EAAU,OAAO;CAAS;CAC7C;EAAE,MAAM;EAAM,KAAK;EAAS,OAAO;CAAQ;CAC3C;EAAE,MAAM;EAAM,KAAK;EAAQ,OAAO;CAAa;CAC/C;EAAE,MAAM;EAAM,KAAK;EAAU,OAAO;CAAS;CAC7C;EAAE,MAAM;EAAK,KAAK;EAAa,OAAO;CAAY;AACpD,GAEMC,KAAwE,EAC5E,UACA,kBACI;CACJ,IAAMC,IAAIC,EAAM;CAChB,OACE,kBAACC,GAAD;EACS;EACG;EACV,SAASJ,EAAa,KAAK,EAAE,SAAM,QAAK,gBAAa;GAAE,OAAOK;GAAM;GAAK;EAAM,EAAE;EACjF,YAAYH,EAAE,8BAA8B,MAAM;EAClD,cAAc,MAAWA,EAAE,+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S;OAAE,GAAGL;OAAO,iBAAiB,EAAE,OAAO;MAAM,CAAC;KACxE,CAAA;IACQ,CAAA;IAEX,kBAACM,GAAD;KACE,OAAOvB,EAAE,sCAAsC,eAAe;KAC9D,SAASM,EAAG,eAAe;KAE3B,UAAA,kBAAC,UAAD;MACE,IAAIA,EAAG,eAAe;MACtB,WAAU;MACV,OAAOW,EAAM;MACb,WAAW,MAAMK,EAAS;OAAE,GAAGL;OAAO,gBAAgB,EAAE,OAAO;MAAM,CAAC;MAJxE,UAAA,CAME,kBAAC,UAAD;OAAQ,OAAM;OACX,UAAAjB,EAAE,wCAAwC,kBAAkB;MACvD,CAAA,GACP6B,GAAQ,KAAK,MACZ,kBAAC,UAAD;OAAuB,OAAOC,EAAM;OACjC,UAAAA,EAAM;MACD,GAFKA,EAAM,EAEX,CACT,CACK;;IACC,CAAA;GACX,EAAA,CAAA;EAED;;AAET"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface BotRoutingSummaryProps {
|
|
3
|
+
botId: string;
|
|
4
|
+
routingStrategy?: string | null;
|
|
5
|
+
defaultAgentName?: string;
|
|
6
|
+
agents: ReadonlyArray<{
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}>;
|
|
10
|
+
onManage: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const BotRoutingSummary: FC<BotRoutingSummaryProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Card as e, CardContent as t, CardDescription as n, CardHeader as r, CardTitle as i } from "./Card.js";
|
|
2
|
+
import { Button as a } from "./Button.js";
|
|
3
|
+
import { Badge as o } from "./Badge.js";
|
|
4
|
+
import { useBotAgentLinks as s } from "../hooks/useBotAgents.js";
|
|
5
|
+
import { formatList as c } from "../utils/botRouting.js";
|
|
6
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
+
// src/botlit/components/BotRoutingSummary.tsx
|
|
8
|
+
var d = {
|
|
9
|
+
SINGLE: "Every message goes to the default agent.",
|
|
10
|
+
ROUND_ROBIN: "Messages are spread across the active linked agents in turn.",
|
|
11
|
+
INTELLIGENT: "Keywords and intents pick the agent; the default agent answers the rest.",
|
|
12
|
+
CUSTOM: "The bot's workflow decides which agent answers."
|
|
13
|
+
}, f = ({ botId: f, routingStrategy: p, defaultAgentName: m, agents: h, onManage: g }) => {
|
|
14
|
+
let _ = s(f), v = (e) => h.find((t) => t.id === e)?.name ?? "Unknown agent", y = _.data.filter((e) => e.isActive).sort((e, t) => e.priority - t.priority), b = p ?? "SINGLE";
|
|
15
|
+
return /* @__PURE__ */ u("div", {
|
|
16
|
+
className: "space-y-6",
|
|
17
|
+
children: [/* @__PURE__ */ u(e, { children: [/* @__PURE__ */ u(r, { children: [/* @__PURE__ */ l(i, { children: "Routing Configuration" }), /* @__PURE__ */ l(n, { children: "How requests are routed to agents" })] }), /* @__PURE__ */ u(t, {
|
|
18
|
+
className: "grid grid-cols-1 gap-4 md:grid-cols-2",
|
|
19
|
+
children: [/* @__PURE__ */ u("div", { children: [
|
|
20
|
+
/* @__PURE__ */ l("p", {
|
|
21
|
+
className: "text-sm text-text-secondary",
|
|
22
|
+
children: "Strategy"
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ l(o, {
|
|
25
|
+
variant: "outline",
|
|
26
|
+
className: "mt-1",
|
|
27
|
+
children: b
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ l("p", {
|
|
30
|
+
className: "mt-2 text-sm text-text-secondary",
|
|
31
|
+
children: d[b] ?? ""
|
|
32
|
+
})
|
|
33
|
+
] }), /* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("p", {
|
|
34
|
+
className: "text-sm text-text-secondary",
|
|
35
|
+
children: "Default Agent"
|
|
36
|
+
}), /* @__PURE__ */ l("p", {
|
|
37
|
+
className: "mt-1 font-medium",
|
|
38
|
+
children: m ?? "None"
|
|
39
|
+
})] })]
|
|
40
|
+
})] }), /* @__PURE__ */ u(e, { children: [/* @__PURE__ */ u(r, {
|
|
41
|
+
className: "flex flex-row items-start justify-between gap-4",
|
|
42
|
+
children: [/* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l(i, { children: "Routing Rules" }), /* @__PURE__ */ l(n, { children: "Active linked agents, tried in priority order" })] }), /* @__PURE__ */ l(a, {
|
|
43
|
+
size: "sm",
|
|
44
|
+
variant: "outline",
|
|
45
|
+
onClick: g,
|
|
46
|
+
children: "Manage agents & rules"
|
|
47
|
+
})]
|
|
48
|
+
}), /* @__PURE__ */ l(t, { children: _.loading && _.data.length === 0 ? /* @__PURE__ */ l("p", {
|
|
49
|
+
role: "status",
|
|
50
|
+
className: "text-sm text-text-secondary",
|
|
51
|
+
children: "Loading rules…"
|
|
52
|
+
}) : _.error ? /* @__PURE__ */ u("div", {
|
|
53
|
+
role: "alert",
|
|
54
|
+
className: "space-y-2",
|
|
55
|
+
children: [/* @__PURE__ */ l("p", {
|
|
56
|
+
className: "text-sm",
|
|
57
|
+
children: _.error.message
|
|
58
|
+
}), /* @__PURE__ */ l(a, {
|
|
59
|
+
size: "sm",
|
|
60
|
+
variant: "outline",
|
|
61
|
+
onClick: () => void _.refetch(),
|
|
62
|
+
children: "Retry"
|
|
63
|
+
})]
|
|
64
|
+
}) : y.length === 0 ? /* @__PURE__ */ l("p", {
|
|
65
|
+
className: "text-sm text-text-secondary",
|
|
66
|
+
children: "No routing rules. Link agents on the Agents tab and give them keywords or intents."
|
|
67
|
+
}) : /* @__PURE__ */ l("div", {
|
|
68
|
+
className: "overflow-x-auto",
|
|
69
|
+
children: /* @__PURE__ */ u("table", {
|
|
70
|
+
className: "w-full text-left text-sm",
|
|
71
|
+
children: [/* @__PURE__ */ l("thead", {
|
|
72
|
+
className: "text-text-secondary",
|
|
73
|
+
children: /* @__PURE__ */ u("tr", { children: [
|
|
74
|
+
/* @__PURE__ */ l("th", {
|
|
75
|
+
className: "py-2 pr-4 font-medium",
|
|
76
|
+
children: "Priority"
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ l("th", {
|
|
79
|
+
className: "py-2 pr-4 font-medium",
|
|
80
|
+
children: "Agent"
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ l("th", {
|
|
83
|
+
className: "py-2 pr-4 font-medium",
|
|
84
|
+
children: "Keywords"
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ l("th", {
|
|
87
|
+
className: "py-2 pr-4 font-medium",
|
|
88
|
+
children: "Intents"
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ l("th", {
|
|
91
|
+
className: "py-2 font-medium",
|
|
92
|
+
children: "Fallback"
|
|
93
|
+
})
|
|
94
|
+
] })
|
|
95
|
+
}), /* @__PURE__ */ l("tbody", { children: y.map((e) => /* @__PURE__ */ u("tr", {
|
|
96
|
+
className: "border-t border-border-subtle",
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ l("td", {
|
|
99
|
+
className: "py-2 pr-4",
|
|
100
|
+
children: e.priority
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ l("td", {
|
|
103
|
+
className: "py-2 pr-4",
|
|
104
|
+
children: v(e.agentId)
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ l("td", {
|
|
107
|
+
className: "py-2 pr-4",
|
|
108
|
+
children: c(e.triggerKeywords) || "—"
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ l("td", {
|
|
111
|
+
className: "py-2 pr-4 font-mono",
|
|
112
|
+
children: c(e.intentPatterns) || "—"
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ l("td", {
|
|
115
|
+
className: "py-2",
|
|
116
|
+
children: e.fallbackAgentId ? v(e.fallbackAgentId) : "—"
|
|
117
|
+
})
|
|
118
|
+
]
|
|
119
|
+
}, e.id)) })]
|
|
120
|
+
})
|
|
121
|
+
}) })] })]
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
export { f as BotRoutingSummary };
|
|
125
|
+
|
|
126
|
+
//# sourceMappingURL=BotRoutingSummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BotRoutingSummary.js","names":["STRATEGY_HELP","BotRoutingSummary","links","useBotAgentLinks","botId","nameOf","agents","agent","id","rules","link","a","b","strategy","routingStrategy","Card","CardHeader","CardTitle","CardDescription","CardContent","Badge","defaultAgentName","Button","onManage","rule","formatList"],"sources":["../../../src/botlit/components/BotRoutingSummary.tsx"],"sourcesContent":["/**\n * Bot routing overview (BOFF-15360)\n * @module botlit/components\n *\n * The bot's Routing tab: the routing strategy, the default agent and the\n * active routing rules (one per linked agent, in priority order) as the router\n * evaluates them. Rules are edited on the Agents tab.\n */\n\nimport type { FC } from 'react';\n\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from './Card';\nimport { Button } from './Button';\nimport { Badge } from './Badge';\nimport { useBotAgentLinks } from '../hooks/useBotAgents';\nimport { formatList } from '../utils/botRouting';\n\nconst STRATEGY_HELP: Record<string, string> = {\n SINGLE: 'Every message goes to the default agent.',\n ROUND_ROBIN: 'Messages are spread across the active linked agents in turn.',\n INTELLIGENT: 'Keywords and intents pick the agent; the default agent answers the rest.',\n CUSTOM: \"The bot's workflow decides which agent answers.\",\n};\n\ninterface BotRoutingSummaryProps {\n botId: string;\n routingStrategy?: string | null;\n defaultAgentName?: string;\n agents: ReadonlyArray<{ id: string; name: string }>;\n onManage: () => void;\n}\n\nexport const BotRoutingSummary: FC<BotRoutingSummaryProps> = ({\n botId,\n routingStrategy,\n defaultAgentName,\n agents,\n onManage,\n}) => {\n const links = useBotAgentLinks(botId);\n const nameOf = (id: string | null | undefined) =>\n agents.find((agent) => agent.id === id)?.name ?? 'Unknown agent';\n const rules = links.data.filter((link) => link.isActive).sort((a, b) => a.priority - b.priority);\n const strategy = routingStrategy ?? 'SINGLE';\n\n return (\n <div className=\"space-y-6\">\n <Card>\n <CardHeader>\n <CardTitle>Routing Configuration</CardTitle>\n <CardDescription>How requests are routed to agents</CardDescription>\n </CardHeader>\n <CardContent className=\"grid grid-cols-1 gap-4 md:grid-cols-2\">\n <div>\n <p className=\"text-sm text-text-secondary\">Strategy</p>\n <Badge variant=\"outline\" className=\"mt-1\">\n {strategy}\n </Badge>\n <p className=\"mt-2 text-sm text-text-secondary\">{STRATEGY_HELP[strategy] ?? ''}</p>\n </div>\n <div>\n <p className=\"text-sm text-text-secondary\">Default Agent</p>\n <p className=\"mt-1 font-medium\">{defaultAgentName ?? 'None'}</p>\n </div>\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader className=\"flex flex-row items-start justify-between gap-4\">\n <div>\n <CardTitle>Routing Rules</CardTitle>\n <CardDescription>Active linked agents, tried in priority order</CardDescription>\n </div>\n <Button size=\"sm\" variant=\"outline\" onClick={onManage}>\n Manage agents & rules\n </Button>\n </CardHeader>\n <CardContent>\n {links.loading && links.data.length === 0 ? (\n <p role=\"status\" className=\"text-sm text-text-secondary\">\n Loading rules…\n </p>\n ) : links.error ? (\n <div role=\"alert\" className=\"space-y-2\">\n <p className=\"text-sm\">{links.error.message}</p>\n <Button size=\"sm\" variant=\"outline\" onClick={() => void links.refetch()}>\n Retry\n </Button>\n </div>\n ) : rules.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">\n No routing rules. Link agents on the Agents tab and give them keywords or intents.\n </p>\n ) : (\n <div className=\"overflow-x-auto\">\n <table className=\"w-full text-left text-sm\">\n <thead className=\"text-text-secondary\">\n <tr>\n <th className=\"py-2 pr-4 font-medium\">Priority</th>\n <th className=\"py-2 pr-4 font-medium\">Agent</th>\n <th className=\"py-2 pr-4 font-medium\">Keywords</th>\n <th className=\"py-2 pr-4 font-medium\">Intents</th>\n <th className=\"py-2 font-medium\">Fallback</th>\n </tr>\n </thead>\n <tbody>\n {rules.map((rule) => (\n <tr key={rule.id} className=\"border-t border-border-subtle\">\n <td className=\"py-2 pr-4\">{rule.priority}</td>\n <td className=\"py-2 pr-4\">{nameOf(rule.agentId)}</td>\n <td className=\"py-2 pr-4\">{formatList(rule.triggerKeywords) || '—'}</td>\n <td className=\"py-2 pr-4 font-mono\">\n {formatList(rule.intentPatterns) || '—'}\n </td>\n <td className=\"py-2\">\n {rule.fallbackAgentId ? nameOf(rule.fallbackAgentId) : '—'}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n </CardContent>\n </Card>\n </div>\n );\n};\n"],"mappings":";;;;;;;AAiBA,IAAMA,IAAwC;CAC5C,QAAQ;CACR,aAAa;CACb,aAAa;CACb,QAAQ;AACV,GAUaC,KAAiD,EAC5D,UACA,oBACA,qBACA,WACA,kBACI;CACJ,IAAMC,IAAQC,EAAiBC,CAAK,GAC9BC,KAAU,MACdC,EAAO,MAAM,MAAUC,EAAM,OAAOC,CAAE,CAAC,EAAE,QAAQ,iBAC7CC,IAAQP,EAAM,KAAK,QAAQ,MAASQ,EAAK,QAAQ,CAAC,CAAC,MAAM,GAAG,MAAMC,EAAE,WAAWC,EAAE,QAAQ,GACzFC,IAAWC,KAAmB;CAEpC,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD,EAAA,UAAW,wBAAgC,CAAA,GAC3C,kBAACC,GAAD,EAAA,UAAiB,oCAAkD,CAAA,CACzD,EAAA,CAAA,GACZ,kBAACC,GAAD;GAAa,WAAU;GAAvB,UAAA,CACE,kBAAC,OAAD,EAAA,UAAA;IACE,kBAAC,KAAD;KAAG,WAAU;KAA8B,UAAA;IAAW,CAAA;IACtD,kBAACC,GAAD;KAAO,SAAQ;KAAU,WAAU;KAChC,UAAAP;IACI,CAAA;IACP,kBAAC,KAAD;KAAG,WAAU;KAAoC,UAAAb,EAAca,MAAa;IAAM,CAAA;GAC/E,EAAA,CAAA,GACL,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;IAAG,WAAU;IAA8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AY,CAAA;MAClD,kBAAC,MAAD;OAAI,WAAU;OAAwB,UAAA;MAAW,CAAA;MACjD,kBAAC,MAAD;OAAI,WAAU;OAAmB,UAAA;MAAY,CAAA;KAC3C,EAAA,CAAA;IACC,CAAA,GACP,kBAAC,SAAD,EAAA,UACGA,EAAM,KAAK,MACV,kBAAC,MAAD;KAAkB,WAAU;KAA5B,UAAA;MACE,kBAAC,MAAD;OAAI,WAAU;OAAa,UAAAe,EAAK;MAAa,CAAA;MAC7C,kBAAC,MAAD;OAAI,WAAU;OAAa,UAAAnB,EAAOmB,EAAK,OAAO;MAAM,CAAA;MACpD,kBAAC,MAAD;OAAI,WAAU;OAAa,UAAAC,EAAWD,EAAK,eAAe,KAAK;MAAQ,CAAA;MACvE,kBAAC,MAAD;OAAI,WAAU;OACX,UAAAC,EAAWD,EAAK,cAAc,KAAK;MAClC,CAAA;MACJ,kBAAC,MAAD;OAAI,WAAU;OACX,UAAAA,EAAK,kBAAkBnB,EAAOmB,EAAK,eAAe,IAAI;MACrD,CAAA;KACF;IAVK,GAAAA,EAAK,EAUV,CACL,EACI,CAAA,CACF;;EACJ,CAAA,EAEI,CAAA,CACT,EAAA,CAAA,CACH;;AAET"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface BotVersionHistoryPanelProps {
|
|
3
|
+
botId: string;
|
|
4
|
+
/** Called after a publish or rollback so the page can refetch the bot. */
|
|
5
|
+
onChanged?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const BotVersionHistoryPanel: FC<BotVersionHistoryPanelProps>;
|
|
8
|
+
export {};
|