@burdenoff/microfe-botmanor 2026.1114.1 → 2026.1115.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.
@@ -1,52 +1,67 @@
1
1
  import { useTr as e } from "../../shared/hooks/useTr.js";
2
2
  import { PageLayout as t } from "../components/PageLayout.js";
3
- import { AiOperationsPanel as n } from "../components/AiOperationsPanel.js";
4
- import { Card as r, CardContent as i, CardDescription as a, CardHeader as o, CardTitle as s } from "../components/Card.js";
5
- import { Button as c } from "../components/Button.js";
6
- import { FormField as l, Input as u, Textarea as d } from "../components/Input.js";
7
- import { BOTMANOR_PERMISSIONS as f } from "../permissions/botmanorPermissions.js";
8
- import { BotmanorPermissionGate as p, useBotmanorCan as ee } from "../permissions/useBotmanorPermissions.js";
9
- import { Badge as m, StatusBadge as h } from "../components/Badge.js";
10
- import { EmptyState as te } from "../components/EmptyState.js";
11
- import { useBot as ne, useCreateBot as re, useDeleteBot as g, useUpdateBot as ie } from "../hooks/useBots.js";
12
- import { useAgents as _ } from "../hooks/useAgents.js";
13
- import { QuotaExhaustedDialog as ae } from "../components/QuotaExhaustedDialog.js";
14
- import { useBotlit as oe } from "../providers/BotlitProvider.js";
15
- import { formatNumber as se, formatRelativeTime as ce } from "../utils/formatters.js";
16
- import { cn as le } from "../utils/cn.js";
17
- import { toUnion as v } from "../utils/unions.js";
18
- import { BotChannelsTab as ue } from "./BotChannelsTab.js";
3
+ import { AiOperationsPanel as ee } from "../components/AiOperationsPanel.js";
4
+ import { Card as n, CardContent as r, CardDescription as i, CardHeader as a, CardTitle as o } from "../components/Card.js";
5
+ import { Button as s } from "../components/Button.js";
6
+ import { Badge as c, StatusBadge as l } from "../components/Badge.js";
7
+ import { BOTMANOR_PERMISSIONS as u } from "../permissions/botmanorPermissions.js";
8
+ import { BotmanorPermissionGate as d, useBotmanorCan as te } from "../permissions/useBotmanorPermissions.js";
9
+ import { EmptyState as ne } from "../components/EmptyState.js";
10
+ import { ErrorState as re } from "../components/ErrorState.js";
11
+ import { BotFormFields as f, DEFAULT_BOT_FORM as p, ROUTING_STRATEGIES as m } from "../components/BotFormFields.js";
12
+ import { useBot as ie, useCreateBot as ae, useDeleteBot as oe, useUpdateBot as se } from "../hooks/useBots.js";
13
+ import { useAgents as ce } from "../hooks/useAgents.js";
14
+ import { QuotaExhaustedDialog as le } from "../components/QuotaExhaustedDialog.js";
15
+ import { useBotlit as ue } from "../providers/BotlitProvider.js";
16
+ import { formatNumber as de, formatRelativeTime as fe } from "../utils/formatters.js";
17
+ import { cn as pe } from "../utils/cn.js";
18
+ import { toUnion as h } from "../utils/unions.js";
19
+ import { confirmAction as g } from "../utils/confirmAction.js";
20
+ import { slugify as _, validateBotIdentity as me } from "../utils/botIdentity.js";
21
+ import { registerBreadcrumbName as he, unregisterBreadcrumbName as ge } from "../utils/breadcrumb.js";
22
+ import { BotChannelsTab as _e } from "./BotChannelsTab.js";
19
23
  import "../permissions/index.js";
20
- import { Suspense as de, lazy as y, useEffect as fe, useState as b } from "react";
21
- import { GlassCard as pe, NextSteps as me, PagePurpose as he } from "@burdenoff/fe-libs/ui";
22
- import { Fragment as ge, jsx as x, jsxs as S } from "react/jsx-runtime";
23
- import { Link as _e, useParams as ve, useSearchParams as ye } from "react-router";
24
- import { isQuotaExhaustedError as be } from "@burdenoff/fe-libs/shared/utils";
25
- import { ArrowLeft as C, BarChart3 as w, Bot as T, Edit as xe, GitBranch as Se, Layers as E, MessageSquare as D, Radio as O, Save as k, Shield as A, ShieldCheck as j, Trash2 as Ce, Workflow as M } from "lucide-react";
26
- import { toast as N } from "sonner";
24
+ import { Suspense as ve, lazy as v, useEffect as y, useState as b } from "react";
25
+ import { GlassCard as ye, NextSteps as be, PagePurpose as xe } from "@burdenoff/fe-libs/ui";
26
+ import { Fragment as Se, jsx as x, jsxs as S } from "react/jsx-runtime";
27
+ import { Link as Ce, useParams as we, useSearchParams as Te } from "react-router";
28
+ import { isQuotaExhaustedError as Ee } from "@burdenoff/fe-libs/shared/utils";
29
+ import { ArrowLeft as C, BarChart3 as De, Bot as w, Edit as Oe, GitBranch as ke, Layers as T, MessageSquare as E, Radio as D, Save as O, Shield as k, ShieldCheck as Ae, Trash2 as je, Workflow as A } from "lucide-react";
30
+ import { toast as j } from "sonner";
27
31
  // src/botlit/pages/BotDetailPage.tsx
28
- var we = y(() => import("./BotWorkflowTab.js").then((e) => ({ default: e.BotWorkflowTab }))), P = [
29
- "SINGLE",
30
- "ROUND_ROBIN",
31
- "INTELLIGENT",
32
- "CUSTOM"
33
- ], Te = "ASSISTANT", F = {
34
- name: "",
35
- slug: "",
36
- description: "",
37
- icon: "🤖",
38
- routingStrategy: "SINGLE",
39
- welcomeMessage: "",
40
- fallbackMessage: "",
41
- defaultAgentId: ""
42
- };
43
- function Ee(e) {
32
+ var Me = v(() => import("./BotWorkflowTab.js").then((e) => ({ default: e.BotWorkflowTab }))), M = {
33
+ key: "activate",
34
+ target: "ACTIVE",
35
+ variant: "default",
36
+ confirm: !1
37
+ }, N = {
38
+ key: "resume",
39
+ target: "ACTIVE",
40
+ variant: "default",
41
+ confirm: !1
42
+ }, P = {
43
+ key: "pause",
44
+ target: "PAUSED",
45
+ variant: "outline",
46
+ confirm: !0
47
+ }, F = {
48
+ key: "archive",
49
+ target: "ARCHIVED",
50
+ variant: "outline",
51
+ confirm: !0
52
+ }, Ne = {
53
+ DRAFT: [M, F],
54
+ ACTIVE: [P, F],
55
+ PAUSED: [N, F],
56
+ ARCHIVED: [M]
57
+ }, Pe = "ASSISTANT";
58
+ function Fe(e) {
44
59
  return {
45
60
  name: e.name,
46
61
  slug: e.slug,
47
62
  description: e.description ?? "",
48
- icon: e.icon || F.icon,
49
- routingStrategy: v(e.routingStrategy, P, "SINGLE"),
63
+ icon: e.icon || p.icon,
64
+ routingStrategy: h(e.routingStrategy, m, "SINGLE"),
50
65
  welcomeMessage: e.welcomeMessage ?? "",
51
66
  fallbackMessage: e.fallbackMessage ?? "",
52
67
  defaultAgentId: e.defaultAgentId ?? ""
@@ -62,527 +77,389 @@ var I = [
62
77
  "aiOperations",
63
78
  "releases"
64
79
  ];
65
- function L(e) {
80
+ function Ie(e) {
66
81
  if (e.get("code") && e.get("state")) return "channels";
67
82
  let t = e.get("tab");
68
83
  return I.find((e) => e === t) ?? "overview";
69
84
  }
70
- var R = ({ isNew: y, isEditing: I }) => {
71
- let R = e(), { botId: z } = ve(), [De] = ye(), Oe = ee(), { navigateTo: B, getPath: ke, workspaceId: V, navigate: H } = oe(), { data: U, loading: Ae, refetch: W } = ne(y ? void 0 : z), { data: G } = _(), [je, Me] = re(), [K, q] = ie(), [Ne, Pe] = g(), [J, Y] = b(() => L(De)), [X, Z] = b(F), [Fe, Q] = b(!1), Ie = () => {
72
- H ? H("/billing") : window.location.assign("/billing");
85
+ var L = ({ isNew: m, isEditing: h }) => {
86
+ let v = e(), { botId: M } = we(), [N] = Te(), P = te(), { navigateTo: F, getPath: I, workspaceId: L, navigate: R } = ue(), { data: z, loading: Le, error: B, refetch: V } = ie(m ? void 0 : M), { data: H } = ce(), [Re, ze] = ae(), [U, Be] = se(), [Ve, He] = oe(), [W, G] = b(() => Ie(N)), [K, q] = b(p), [Ue, We] = b(p), [Ge, Ke] = b(!1), [qe, J] = b(!1), [Je, Ye] = b(!1), Y = me(K.name, K.slug), Xe = Object.keys(Y).length > 0, X = !qe && JSON.stringify(K) !== JSON.stringify(Ue), Ze = !!(m || h), Qe = () => {
87
+ R ? R("/billing") : window.location.assign("/billing");
73
88
  };
74
- fe(() => {
75
- U && !y && Z(Ee(U));
76
- }, [U, y]);
77
- let Le = async () => {
78
- if (X.name && V) try {
79
- let e = await je({
80
- workspaceId: V,
81
- name: X.name,
82
- slug: X.slug || X.name.toLowerCase().replace(/\s+/g, "-"),
83
- type: Te,
84
- routingStrategy: X.routingStrategy,
85
- description: X.description || void 0,
86
- icon: X.icon || void 0
89
+ y(() => {
90
+ if (z && !m) {
91
+ let e = Fe(z);
92
+ q(e), We(e);
93
+ }
94
+ }, [z, m]), y(() => {
95
+ if (M && z?.name) return he(M, z.name), () => ge(M);
96
+ }, [M, z?.name]), y(() => {
97
+ if (!Ze || !X) return;
98
+ let e = (e) => {
99
+ e.preventDefault(), e.returnValue = "";
100
+ };
101
+ return window.addEventListener("beforeunload", e), () => window.removeEventListener("beforeunload", e);
102
+ }, [Ze, X]);
103
+ let Z = async (e) => {
104
+ (!X || await g({
105
+ title: v("botlit.botDetail.discard.title", "Discard changes?"),
106
+ message: v("botlit.botDetail.discard.message", "You have unsaved changes. If you leave now they will be lost."),
107
+ confirmLabel: v("botlit.botDetail.discard.confirm", "Discard"),
108
+ cancelLabel: v("botlit.botDetail.discard.keepEditing", "Keep editing")
109
+ })) && (J(!0), F(e));
110
+ }, $e = async () => {
111
+ if (Ke(!0), Xe || !L) return;
112
+ let e = K.name.trim();
113
+ try {
114
+ let t = await Re({
115
+ workspaceId: L,
116
+ name: e,
117
+ slug: K.slug.trim() || _(e),
118
+ type: Pe,
119
+ routingStrategy: K.routingStrategy,
120
+ description: K.description || void 0,
121
+ icon: K.icon || void 0
87
122
  });
88
- N.success(`${R("botlit.botDetail.create.successPrefix", "Bot")} "${X.name}" ${R("botlit.botDetail.create.successSuffix", "created successfully")}`), e?.id && B(`bots/${e.id}?tab=workflow`);
123
+ J(!0), j.success(v("botlit.botDetail.create.success", "Bot \"{{name}}\" created successfully", { name: e })), t?.id && F(`bots/${t.id}?tab=workflow`);
89
124
  } catch (e) {
90
- if (be(e)) {
91
- Q(!0);
125
+ if (Ee(e)) {
126
+ Ye(!0);
92
127
  return;
93
128
  }
94
- let t = e instanceof Error ? e.message : R("botlit.botDetail.create.error", "Failed to create bot");
95
- N.error(t);
129
+ let t = e instanceof Error ? e.message : v("botlit.botDetail.create.error", "Failed to create bot");
130
+ j.error(t);
96
131
  }
97
- }, Re = async () => {
98
- if (z) try {
99
- await K({
100
- botId: z,
132
+ }, et = async () => {
133
+ if (Ke(!0), !M || Xe) return;
134
+ let e = K.name.trim();
135
+ try {
136
+ await U({
137
+ botId: M,
101
138
  input: {
102
- name: X.name,
103
- slug: X.slug,
104
- description: X.description || null,
105
- icon: X.icon || null,
106
- routingStrategy: X.routingStrategy,
107
- welcomeMessage: X.welcomeMessage || null,
108
- fallbackMessage: X.fallbackMessage || null,
109
- defaultAgentId: X.defaultAgentId || null
139
+ name: e,
140
+ slug: K.slug.trim() || _(e),
141
+ description: K.description || null,
142
+ icon: K.icon || null,
143
+ routingStrategy: K.routingStrategy,
144
+ welcomeMessage: K.welcomeMessage || null,
145
+ fallbackMessage: K.fallbackMessage || null,
146
+ defaultAgentId: K.defaultAgentId || null
110
147
  }
111
- }), await W(), N.success(`${R("botlit.botDetail.update.successPrefix", "Bot")} "${X.name}" ${R("botlit.botDetail.update.successSuffix", "updated successfully")}`), I && B(`bots/${z}`);
148
+ }), J(!0), await V(), j.success(v("botlit.botDetail.update.success", "Bot \"{{name}}\" updated successfully", { name: e })), h && F(`bots/${M}`);
112
149
  } catch (e) {
113
- let t = e instanceof Error ? e.message : R("botlit.botDetail.update.error", "Failed to update bot");
114
- N.error(t);
150
+ let t = e instanceof Error ? e.message : v("botlit.botDetail.update.error", "Failed to update bot");
151
+ j.error(t);
115
152
  }
116
153
  };
117
- if (y) return /* @__PURE__ */ S(ge, { children: [/* @__PURE__ */ x(t, {
118
- title: R("botlit.botDetail.createPage.title", "Create New Bot"),
119
- description: R("botlit.botDetail.createPage.description", "Set up a new AI-powered bot"),
120
- actions: /* @__PURE__ */ S("div", {
121
- className: "flex gap-2",
122
- children: [/* @__PURE__ */ x(c, {
123
- variant: "outline",
124
- onClick: () => B("bots"),
125
- children: R("botlit.common.cancel", "Cancel")
126
- }), /* @__PURE__ */ x(c, {
127
- leftIcon: /* @__PURE__ */ x(k, { size: 16 }),
128
- onClick: Le,
129
- isLoading: Me.loading,
130
- disabled: !X.name || !V,
131
- children: R("botlit.botDetail.createPage.actions.createBot", "Create Bot")
132
- })]
133
- }),
134
- children: /* @__PURE__ */ x(r, {
135
- className: "max-w-2xl",
136
- children: /* @__PURE__ */ S(i, {
137
- className: "pt-6 space-y-6",
138
- children: [
139
- /* @__PURE__ */ S("div", {
140
- className: "flex items-center gap-4",
141
- children: [/* @__PURE__ */ x("button", {
142
- className: "text-5xl p-4 rounded-lg border-2 border-dashed border-border-subtle hover:border-primary transition-colors",
143
- onClick: () => {
144
- let e = [
145
- "🤖",
146
- "💼",
147
- "🎧",
148
- "📊",
149
- "🎯",
150
- "🔧",
151
- "📚",
152
- "💡",
153
- "🚀",
154
- "⚡"
155
- ], t = e.indexOf(X.icon);
156
- Z({
157
- ...X,
158
- icon: e[(t + 1) % e.length]
159
- });
160
- },
161
- children: X.icon
162
- }), /* @__PURE__ */ x("p", {
163
- className: "text-sm text-text-secondary",
164
- children: R("botlit.botDetail.form.clickToChangeIcon", "Click to change icon")
154
+ if (m) {
155
+ let e = L ? null : v("botlit.botDetail.createPage.waitingWorkspace", "Waiting for your workspace to load…");
156
+ return /* @__PURE__ */ S(Se, { children: [/* @__PURE__ */ x(t, {
157
+ title: v("botlit.botDetail.createPage.title", "Create New Bot"),
158
+ description: v("botlit.botDetail.createPage.description", "Set up a new AI-powered bot"),
159
+ actions: /* @__PURE__ */ S("div", {
160
+ className: "flex gap-2",
161
+ children: [/* @__PURE__ */ x(s, {
162
+ variant: "outline",
163
+ type: "button",
164
+ onClick: () => void Z("bots"),
165
+ children: v("botlit.common.cancel", "Cancel")
166
+ }), /* @__PURE__ */ x(s, {
167
+ type: "submit",
168
+ form: "bot-create-form",
169
+ leftIcon: /* @__PURE__ */ x(O, { size: 16 }),
170
+ isLoading: ze.loading,
171
+ disabled: !!e,
172
+ "aria-describedby": e ? "bot-create-blocked" : void 0,
173
+ children: v("botlit.botDetail.createPage.actions.createBot", "Create Bot")
174
+ })]
175
+ }),
176
+ children: /* @__PURE__ */ x(n, {
177
+ className: "max-w-2xl",
178
+ children: /* @__PURE__ */ x(r, {
179
+ className: "pt-6",
180
+ children: /* @__PURE__ */ S("form", {
181
+ id: "bot-create-form",
182
+ noValidate: !0,
183
+ onSubmit: (e) => {
184
+ e.preventDefault(), $e();
185
+ },
186
+ children: [/* @__PURE__ */ x(f, {
187
+ idPrefix: "bot-create",
188
+ mode: "create",
189
+ value: K,
190
+ onChange: q,
191
+ errors: Y,
192
+ showErrors: Ge
193
+ }), e && /* @__PURE__ */ x("p", {
194
+ id: "bot-create-blocked",
195
+ role: "status",
196
+ className: "mt-4 text-sm text-text-secondary",
197
+ children: e
165
198
  })]
166
- }),
167
- /* @__PURE__ */ x(l, {
168
- label: R("botlit.botDetail.form.botName", "Bot Name"),
169
- required: !0,
170
- htmlFor: "name",
171
- children: /* @__PURE__ */ x(u, {
172
- id: "name",
173
- placeholder: R("botlit.botDetail.form.botNamePlaceholder", "e.g., Customer Support Bot"),
174
- value: X.name,
175
- onChange: (e) => Z({
176
- ...X,
177
- name: e.target.value
178
- })
179
- })
180
- }),
181
- /* @__PURE__ */ x(l, {
182
- label: R("botlit.botDetail.form.slug", "Slug"),
183
- htmlFor: "slug",
184
- children: /* @__PURE__ */ x(u, {
185
- id: "slug",
186
- placeholder: R("botlit.botDetail.form.slugPlaceholder", "customer-support-bot"),
187
- value: X.slug,
188
- onChange: (e) => Z({
189
- ...X,
190
- slug: e.target.value
191
- })
192
- })
193
- }),
194
- /* @__PURE__ */ x(l, {
195
- label: R("botlit.botDetail.form.description", "Description"),
196
- htmlFor: "description",
197
- children: /* @__PURE__ */ x(d, {
198
- id: "description",
199
- placeholder: R("botlit.botDetail.form.descriptionPlaceholder", "Describe what this bot does..."),
200
- value: X.description,
201
- onChange: (e) => Z({
202
- ...X,
203
- description: e.target.value
204
- }),
205
- rows: 4
206
- })
207
- }),
208
- /* @__PURE__ */ x(l, {
209
- label: R("botlit.botDetail.form.routingStrategy", "Routing Strategy"),
210
- children: /* @__PURE__ */ S("select", {
211
- className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
212
- value: X.routingStrategy,
213
- onChange: (e) => Z({
214
- ...X,
215
- routingStrategy: v(e.target.value, P, "SINGLE")
216
- }),
217
- children: [
218
- /* @__PURE__ */ x("option", {
219
- value: "SINGLE",
220
- children: R("botlit.botDetail.routing.single", "Single")
221
- }),
222
- /* @__PURE__ */ x("option", {
223
- value: "ROUND_ROBIN",
224
- children: R("botlit.botDetail.routing.roundRobin", "Round Robin")
225
- }),
226
- /* @__PURE__ */ x("option", {
227
- value: "INTELLIGENT",
228
- children: R("botlit.botDetail.routing.intelligent", "Intelligent")
229
- }),
230
- /* @__PURE__ */ x("option", {
231
- value: "CUSTOM",
232
- children: R("botlit.botDetail.routing.custom", "Custom")
233
- })
234
- ]
235
- })
236
199
  })
237
- ]
200
+ })
238
201
  })
202
+ }), /* @__PURE__ */ x(le, {
203
+ open: Je,
204
+ title: v("botlit.usage.botQuota.title", "Bot Limit Reached"),
205
+ description: v("botlit.usage.botQuota.description", "You have reached the number of bots allowed on your current plan."),
206
+ onClose: () => Ye(!1),
207
+ onViewBilling: Qe
208
+ })] });
209
+ }
210
+ if (Le) return /* @__PURE__ */ x(t, {
211
+ title: v("botlit.common.loading", "Loading..."),
212
+ children: /* @__PURE__ */ x("div", {
213
+ role: "status",
214
+ "aria-busy": "true",
215
+ "aria-label": v("botlit.common.loading", "Loading"),
216
+ className: "h-96 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg"
217
+ })
218
+ });
219
+ if (B) return /* @__PURE__ */ x(t, {
220
+ title: v("botlit.botDetail.loadError.title", "Bot unavailable"),
221
+ children: /* @__PURE__ */ x(re, {
222
+ resource: v("botlit.botDetail.resource", "this bot"),
223
+ error: B,
224
+ onRetry: () => void V()
239
225
  })
240
- }), /* @__PURE__ */ x(ae, {
241
- open: Fe,
242
- title: R("botlit.usage.botQuota.title", "Bot Limit Reached"),
243
- description: R("botlit.usage.botQuota.description", "You have reached the number of bots allowed on your current plan."),
244
- onClose: () => Q(!1),
245
- onViewBilling: Ie
246
- })] });
247
- if (Ae) return /* @__PURE__ */ x(t, {
248
- title: R("botlit.common.loading", "Loading..."),
249
- children: /* @__PURE__ */ x("div", { className: "h-96 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" })
250
226
  });
251
- if (!U) return /* @__PURE__ */ x(t, {
252
- title: R("botlit.botDetail.notFound.title", "Bot Not Found"),
253
- children: /* @__PURE__ */ x(te, {
227
+ if (!z) return /* @__PURE__ */ x(t, {
228
+ title: v("botlit.botDetail.notFound.title", "Bot Not Found"),
229
+ children: /* @__PURE__ */ x(ne, {
254
230
  illustration: "empty-agents",
255
- title: R("botlit.botDetail.notFound.title", "Bot Not Found"),
256
- description: R("botlit.botDetail.notFound.description", "The bot you're looking for doesn't exist."),
257
- action: /* @__PURE__ */ x(c, {
258
- onClick: () => B("bots"),
259
- children: R("botlit.botDetail.notFound.backAction", "Back to Bots")
231
+ title: v("botlit.botDetail.notFound.title", "Bot Not Found"),
232
+ description: v("botlit.botDetail.notFound.description", "The bot you're looking for doesn't exist."),
233
+ action: /* @__PURE__ */ x(s, {
234
+ onClick: () => F("bots"),
235
+ children: v("botlit.botDetail.notFound.backAction", "Back to Bots")
260
236
  })
261
237
  })
262
238
  });
263
- if (I && U) return /* @__PURE__ */ x(t, {
239
+ if (h && z) return /* @__PURE__ */ x(t, {
264
240
  title: /* @__PURE__ */ S("div", {
265
241
  className: "flex items-center gap-3",
266
- children: [/* @__PURE__ */ x(c, {
242
+ children: [/* @__PURE__ */ x(s, {
267
243
  variant: "ghost",
268
244
  size: "icon",
269
- onClick: () => B(`bots/${z}`),
270
- children: /* @__PURE__ */ x(C, { size: 20 })
271
- }), /* @__PURE__ */ x("span", { children: R("botlit.botDetail.editPage.title", "Edit Bot") })]
245
+ type: "button",
246
+ "aria-label": v("botlit.common.back", "Back"),
247
+ onClick: () => void Z(`bots/${M}`),
248
+ children: /* @__PURE__ */ x(C, {
249
+ size: 20,
250
+ "aria-hidden": "true"
251
+ })
252
+ }), /* @__PURE__ */ x("span", { children: v("botlit.botDetail.editPage.title", "Edit Bot") })]
272
253
  }),
273
254
  actions: /* @__PURE__ */ S("div", {
274
255
  className: "flex gap-2",
275
- children: [/* @__PURE__ */ x(c, {
256
+ children: [/* @__PURE__ */ x(s, {
276
257
  variant: "outline",
277
- onClick: () => B(`bots/${z}`),
278
- children: R("botlit.common.cancel", "Cancel")
279
- }), /* @__PURE__ */ x(c, {
280
- leftIcon: /* @__PURE__ */ x(k, { size: 16 }),
281
- onClick: Re,
282
- isLoading: q.loading,
283
- disabled: !X.name,
284
- children: R("botlit.botDetail.editPage.actions.saveChanges", "Save Changes")
258
+ type: "button",
259
+ onClick: () => void Z(`bots/${M}`),
260
+ children: v("botlit.common.cancel", "Cancel")
261
+ }), /* @__PURE__ */ x(s, {
262
+ type: "submit",
263
+ form: "bot-edit-form",
264
+ leftIcon: /* @__PURE__ */ x(O, { size: 16 }),
265
+ isLoading: Be.loading,
266
+ children: v("botlit.botDetail.editPage.actions.saveChanges", "Save Changes")
285
267
  })]
286
268
  }),
287
- children: /* @__PURE__ */ x(r, {
269
+ children: /* @__PURE__ */ x(n, {
288
270
  className: "max-w-2xl",
289
- children: /* @__PURE__ */ S(i, {
290
- className: "pt-6 space-y-6",
291
- children: [
292
- /* @__PURE__ */ S("div", {
293
- className: "flex items-center gap-4",
294
- children: [/* @__PURE__ */ x("button", {
295
- className: "text-5xl p-4 rounded-lg border-2 border-dashed border-border-subtle hover:border-primary transition-colors",
296
- onClick: () => {
297
- let e = [
298
- "🤖",
299
- "💼",
300
- "🎧",
301
- "📊",
302
- "🎯",
303
- "🔧",
304
- "📚",
305
- "💡",
306
- "🚀",
307
- "⚡"
308
- ], t = X.icon, n = e.indexOf(t);
309
- Z({
310
- ...X,
311
- icon: e[(n + 1) % e.length]
312
- });
313
- },
314
- children: X.icon
315
- }), /* @__PURE__ */ x("p", {
316
- className: "text-sm text-text-secondary",
317
- children: R("botlit.botDetail.form.clickToChangeIcon", "Click to change icon")
318
- })]
319
- }),
320
- /* @__PURE__ */ x(l, {
321
- label: R("botlit.botDetail.form.botName", "Bot Name"),
322
- required: !0,
323
- htmlFor: "edit-name",
324
- children: /* @__PURE__ */ x(u, {
325
- id: "edit-name",
326
- placeholder: R("botlit.botDetail.form.botNamePlaceholder", "e.g., Customer Support Bot"),
327
- value: X.name,
328
- onChange: (e) => Z({
329
- ...X,
330
- name: e.target.value
331
- })
332
- })
333
- }),
334
- /* @__PURE__ */ x(l, {
335
- label: R("botlit.botDetail.form.slug", "Slug"),
336
- htmlFor: "edit-slug",
337
- children: /* @__PURE__ */ x(u, {
338
- id: "edit-slug",
339
- placeholder: R("botlit.botDetail.form.slugPlaceholder", "customer-support-bot"),
340
- value: X.slug,
341
- onChange: (e) => Z({
342
- ...X,
343
- slug: e.target.value
344
- })
345
- })
346
- }),
347
- /* @__PURE__ */ x(l, {
348
- label: R("botlit.botDetail.form.description", "Description"),
349
- htmlFor: "edit-description",
350
- children: /* @__PURE__ */ x(d, {
351
- id: "edit-description",
352
- placeholder: R("botlit.botDetail.form.descriptionPlaceholder", "Describe what this bot does..."),
353
- value: X.description,
354
- onChange: (e) => Z({
355
- ...X,
356
- description: e.target.value
357
- }),
358
- rows: 4
359
- })
360
- }),
361
- /* @__PURE__ */ x(l, {
362
- label: R("botlit.botDetail.form.routingStrategy", "Routing Strategy"),
363
- children: /* @__PURE__ */ S("select", {
364
- className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
365
- value: X.routingStrategy,
366
- onChange: (e) => Z({
367
- ...X,
368
- routingStrategy: v(e.target.value, P, "SINGLE")
369
- }),
370
- children: [
371
- /* @__PURE__ */ x("option", {
372
- value: "SINGLE",
373
- children: R("botlit.botDetail.routing.single", "Single")
374
- }),
375
- /* @__PURE__ */ x("option", {
376
- value: "ROUND_ROBIN",
377
- children: R("botlit.botDetail.routing.roundRobin", "Round Robin")
378
- }),
379
- /* @__PURE__ */ x("option", {
380
- value: "INTELLIGENT",
381
- children: R("botlit.botDetail.routing.intelligent", "Intelligent")
382
- }),
383
- /* @__PURE__ */ x("option", {
384
- value: "CUSTOM",
385
- children: R("botlit.botDetail.routing.custom", "Custom")
386
- })
387
- ]
388
- })
389
- }),
390
- /* @__PURE__ */ x(l, {
391
- label: R("botlit.botDetail.form.welcomeMessage", "Welcome Message"),
392
- htmlFor: "edit-welcome",
393
- children: /* @__PURE__ */ x(d, {
394
- id: "edit-welcome",
395
- placeholder: R("botlit.botDetail.form.welcomeMessagePlaceholder", "Welcome message shown to users..."),
396
- value: X.welcomeMessage,
397
- onChange: (e) => Z({
398
- ...X,
399
- welcomeMessage: e.target.value
400
- }),
401
- rows: 3
402
- })
403
- }),
404
- /* @__PURE__ */ x(l, {
405
- label: R("botlit.botDetail.form.fallbackMessage", "Fallback Message"),
406
- htmlFor: "edit-fallback",
407
- children: /* @__PURE__ */ x(u, {
408
- id: "edit-fallback",
409
- placeholder: R("botlit.botDetail.form.fallbackMessagePlaceholder", "Message when agent can't respond..."),
410
- value: X.fallbackMessage,
411
- onChange: (e) => Z({
412
- ...X,
413
- fallbackMessage: e.target.value
414
- })
415
- })
416
- }),
417
- /* @__PURE__ */ x(l, {
418
- label: R("botlit.botDetail.form.defaultAgent", "Default Agent"),
419
- children: /* @__PURE__ */ S("select", {
420
- className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
421
- value: X.defaultAgentId,
422
- onChange: (e) => Z({
423
- ...X,
424
- defaultAgentId: e.target.value
425
- }),
426
- children: [/* @__PURE__ */ x("option", {
427
- value: "",
428
- children: R("botlit.botDetail.form.noDefaultAgent", "No default agent")
429
- }), G?.map((e) => /* @__PURE__ */ x("option", {
430
- value: e.id,
431
- children: e.name
432
- }, e.id))]
433
- })
271
+ children: /* @__PURE__ */ x(r, {
272
+ className: "pt-6",
273
+ children: /* @__PURE__ */ x("form", {
274
+ id: "bot-edit-form",
275
+ noValidate: !0,
276
+ onSubmit: (e) => {
277
+ e.preventDefault(), et();
278
+ },
279
+ children: /* @__PURE__ */ x(f, {
280
+ idPrefix: "bot-edit",
281
+ mode: "edit",
282
+ value: K,
283
+ onChange: q,
284
+ errors: Y,
285
+ showErrors: Ge,
286
+ agents: H
434
287
  })
435
- ]
288
+ })
436
289
  })
437
290
  })
438
291
  });
439
- let ze = [
292
+ let Q = (e, t) => {
293
+ switch (e) {
294
+ case "activate": return {
295
+ label: v("botlit.botDetail.actions.activate", "Activate"),
296
+ success: v("botlit.botDetail.activate.success", "Bot \"{{name}}\" activated", { name: t }),
297
+ error: v("botlit.botDetail.activate.error", "Failed to activate bot")
298
+ };
299
+ case "resume": return {
300
+ label: v("botlit.botDetail.actions.resume", "Resume"),
301
+ success: v("botlit.botDetail.resume.success", "Bot \"{{name}}\" resumed", { name: t }),
302
+ error: v("botlit.botDetail.resume.error", "Failed to resume bot")
303
+ };
304
+ case "pause": return {
305
+ label: v("botlit.botDetail.actions.pause", "Pause"),
306
+ confirmTitle: v("botlit.botDetail.pause.title", "Pause bot?"),
307
+ confirmMessage: v("botlit.botDetail.pause.confirm", "Pause \"{{name}}\"? It will stop answering messages on its channels until you resume it.", { name: t }),
308
+ success: v("botlit.botDetail.pause.success", "Bot \"{{name}}\" paused", { name: t }),
309
+ error: v("botlit.botDetail.pause.error", "Failed to pause bot")
310
+ };
311
+ case "archive": return {
312
+ label: v("botlit.botDetail.actions.archive", "Archive"),
313
+ confirmTitle: v("botlit.botDetail.archive.title", "Archive bot?"),
314
+ confirmMessage: v("botlit.botDetail.archive.confirm", "Archive \"{{name}}\"? It will stop answering messages on its channels. You can activate it again later.", { name: t }),
315
+ success: v("botlit.botDetail.archive.success", "Bot \"{{name}}\" archived", { name: t }),
316
+ error: v("botlit.botDetail.archive.error", "Failed to archive bot")
317
+ };
318
+ }
319
+ }, tt = async (e) => {
320
+ if (!M) return;
321
+ let t = Q(e.key, z.name);
322
+ if (!e.confirm || await g({
323
+ title: t.confirmTitle ?? t.label,
324
+ message: t.confirmMessage ?? t.label,
325
+ confirmLabel: t.label,
326
+ cancelLabel: v("botlit.common.cancel", "Cancel")
327
+ })) try {
328
+ await U({
329
+ botId: M,
330
+ input: { status: e.target }
331
+ }), await V(), j.success(t.success);
332
+ } catch (e) {
333
+ j.error(e instanceof Error ? e.message : t.error);
334
+ }
335
+ }, nt = [
440
336
  {
441
337
  id: "overview",
442
- label: R("botlit.botDetail.tabs.overview", "Overview"),
443
- icon: /* @__PURE__ */ x(w, { size: 16 })
338
+ label: v("botlit.botDetail.tabs.overview", "Overview"),
339
+ icon: /* @__PURE__ */ x(De, { size: 16 })
444
340
  },
445
341
  {
446
342
  id: "workflow",
447
- label: R("botlit.botDetail.tabs.workflow", "Workflow"),
448
- icon: /* @__PURE__ */ x(M, { size: 16 })
343
+ label: v("botlit.botDetail.tabs.workflow", "Workflow"),
344
+ icon: /* @__PURE__ */ x(A, { size: 16 })
449
345
  },
450
346
  {
451
347
  id: "routing",
452
- label: R("botlit.botDetail.tabs.routing", "Routing"),
453
- icon: /* @__PURE__ */ x(Se, { size: 16 })
348
+ label: v("botlit.botDetail.tabs.routing", "Routing"),
349
+ icon: /* @__PURE__ */ x(ke, { size: 16 })
454
350
  },
455
351
  {
456
352
  id: "agents",
457
- label: R("botlit.botDetail.tabs.agents", "Agents"),
458
- icon: /* @__PURE__ */ x(T, { size: 16 })
353
+ label: v("botlit.botDetail.tabs.agents", "Agents"),
354
+ icon: /* @__PURE__ */ x(w, { size: 16 })
459
355
  },
460
356
  {
461
357
  id: "channels",
462
- label: R("botlit.botDetail.tabs.channels", "Channels"),
463
- icon: /* @__PURE__ */ x(O, { size: 16 })
358
+ label: v("botlit.botDetail.tabs.channels", "Channels"),
359
+ icon: /* @__PURE__ */ x(D, { size: 16 })
464
360
  },
465
361
  {
466
362
  id: "guardrails",
467
- label: R("botlit.botDetail.tabs.guardrails", "Guardrails"),
468
- icon: /* @__PURE__ */ x(A, { size: 16 })
363
+ label: v("botlit.botDetail.tabs.guardrails", "Guardrails"),
364
+ icon: /* @__PURE__ */ x(k, { size: 16 })
469
365
  },
470
366
  {
471
367
  id: "aiOperations",
472
- label: R("botlit.botDetail.tabs.aiOperations", "AI Operations"),
473
- icon: /* @__PURE__ */ x(j, { size: 16 })
368
+ label: v("botlit.botDetail.tabs.aiOperations", "AI Operations"),
369
+ icon: /* @__PURE__ */ x(Ae, { size: 16 })
474
370
  },
475
371
  {
476
372
  id: "releases",
477
- label: R("botlit.botDetail.tabs.releases", "Releases"),
478
- icon: /* @__PURE__ */ x(E, { size: 16 })
373
+ label: v("botlit.botDetail.tabs.releases", "Releases"),
374
+ icon: /* @__PURE__ */ x(T, { size: 16 })
479
375
  }
480
- ], $ = U.defaultAgentId ? G?.find((e) => e.id === U.defaultAgentId) : null;
376
+ ], $ = z.defaultAgentId ? H?.find((e) => e.id === z.defaultAgentId) : null;
481
377
  return /* @__PURE__ */ x(t, {
482
378
  title: /* @__PURE__ */ S("div", {
483
379
  className: "flex items-center gap-3",
484
380
  children: [
485
- /* @__PURE__ */ x(c, {
381
+ /* @__PURE__ */ x(s, {
486
382
  variant: "ghost",
487
383
  size: "icon",
488
- onClick: () => B("bots"),
384
+ onClick: () => F("bots"),
489
385
  children: /* @__PURE__ */ x(C, { size: 20 })
490
386
  }),
491
387
  /* @__PURE__ */ x("span", {
492
388
  className: "text-3xl",
493
- children: U.icon
389
+ children: z.icon
494
390
  }),
495
391
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S("div", {
496
392
  className: "flex items-center gap-2",
497
393
  children: [
498
- /* @__PURE__ */ x("span", { children: U.name }),
499
- /* @__PURE__ */ x(h, { status: U.status }),
500
- /* @__PURE__ */ x(m, {
394
+ /* @__PURE__ */ x("span", { children: z.name }),
395
+ /* @__PURE__ */ x(l, { status: z.status }),
396
+ /* @__PURE__ */ x(c, {
501
397
  variant: "outline",
502
- children: U.slug
398
+ children: z.slug
503
399
  })
504
400
  ]
505
401
  }), /* @__PURE__ */ x("p", {
506
402
  className: "text-sm font-normal text-text-secondary",
507
- children: U.description
403
+ children: z.description
508
404
  })] })
509
405
  ]
510
406
  }),
511
407
  actions: /* @__PURE__ */ S("div", {
512
408
  className: "flex gap-2",
513
409
  children: [
514
- U.status === "DRAFT" || U.status === "ARCHIVED" ? /* @__PURE__ */ x(p, {
515
- permission: f.APP_UPDATE,
516
- children: /* @__PURE__ */ x(c, {
517
- variant: "default",
518
- isLoading: q.loading,
519
- onClick: async () => {
520
- try {
521
- if (!z) return;
522
- await K({
523
- botId: z,
524
- input: { status: "ACTIVE" }
525
- }), await W(), N.success(`${R("botlit.botDetail.activate.successPrefix", "Bot")} "${U.name}" ${R("botlit.botDetail.activate.successSuffix", "activated")}`);
526
- } catch (e) {
527
- N.error(e instanceof Error ? e.message : R("botlit.botDetail.activate.error", "Failed to activate bot"));
528
- }
529
- },
530
- children: R("botlit.botDetail.actions.activate", "Activate")
531
- })
532
- }) : /* @__PURE__ */ x(p, {
533
- permission: f.APP_UPDATE,
534
- children: /* @__PURE__ */ x(c, {
535
- variant: "outline",
536
- isLoading: q.loading,
537
- onClick: async () => {
538
- try {
539
- if (!z) return;
540
- await K({
541
- botId: z,
542
- input: { status: "DRAFT" }
543
- }), await W(), N.success(`${R("botlit.botDetail.deactivate.successPrefix", "Bot")} "${U.name}" ${R("botlit.botDetail.deactivate.successSuffix", "deactivated")}`);
544
- } catch (e) {
545
- N.error(e instanceof Error ? e.message : R("botlit.botDetail.deactivate.error", "Failed to deactivate bot"));
546
- }
547
- },
548
- children: R("botlit.botDetail.actions.deactivate", "Deactivate")
549
- })
410
+ /* @__PURE__ */ x(d, {
411
+ permission: u.APP_UPDATE,
412
+ children: (Ne[z.status] ?? []).map((e) => /* @__PURE__ */ x(s, {
413
+ variant: e.variant,
414
+ isLoading: Be.loading,
415
+ onClick: () => void tt(e),
416
+ children: Q(e.key, z.name).label
417
+ }, e.key))
550
418
  }),
551
- /* @__PURE__ */ x(p, {
552
- permission: f.APP_UPDATE,
553
- children: /* @__PURE__ */ x(c, {
419
+ /* @__PURE__ */ x(d, {
420
+ permission: u.APP_UPDATE,
421
+ children: /* @__PURE__ */ x(s, {
554
422
  variant: "outline",
555
- leftIcon: /* @__PURE__ */ x(xe, { size: 16 }),
556
- onClick: () => B(`bots/${z}/edit`),
557
- children: R("botlit.botDetail.actions.editBot", "Edit Bot")
423
+ leftIcon: /* @__PURE__ */ x(Oe, { size: 16 }),
424
+ onClick: () => F(`bots/${M}/edit`),
425
+ children: v("botlit.botDetail.actions.editBot", "Edit Bot")
558
426
  })
559
427
  }),
560
- /* @__PURE__ */ x(p, {
561
- permission: f.AGENT_EXECUTE,
562
- children: /* @__PURE__ */ x(c, {
428
+ /* @__PURE__ */ x(d, {
429
+ permission: u.AGENT_EXECUTE,
430
+ children: /* @__PURE__ */ x(s, {
563
431
  variant: "outline",
564
- leftIcon: /* @__PURE__ */ x(D, { size: 16 }),
432
+ leftIcon: /* @__PURE__ */ x(E, { size: 16 }),
565
433
  onClick: () => {
566
- let e = U?.defaultAgentId;
567
- B(e ? `chat/${e}` : "chat");
434
+ let e = z?.defaultAgentId;
435
+ F(e ? `chat/${e}` : "chat");
568
436
  },
569
- children: R("botlit.botDetail.actions.testBot", "Test Bot")
437
+ children: v("botlit.botDetail.actions.testBot", "Test Bot")
570
438
  })
571
439
  }),
572
- /* @__PURE__ */ x(p, {
573
- permission: f.APP_DELETE,
574
- children: /* @__PURE__ */ x(c, {
440
+ /* @__PURE__ */ x(d, {
441
+ permission: u.APP_DELETE,
442
+ children: /* @__PURE__ */ x(s, {
575
443
  variant: "destructive",
576
- leftIcon: /* @__PURE__ */ x(Ce, { size: 16 }),
577
- isLoading: Pe.loading,
444
+ leftIcon: /* @__PURE__ */ x(je, { size: 16 }),
445
+ isLoading: He.loading,
578
446
  onClick: async () => {
579
- if (z && confirm(`${R("botlit.botDetail.delete.confirmPrefix", "Are you sure you want to delete")} "${U.name}"? ${R("botlit.botDetail.delete.confirmSuffix", "This action cannot be undone.")}`)) try {
580
- await Ne(z), N.success(`${R("botlit.botDetail.delete.successPrefix", "Bot")} "${U.name}" ${R("botlit.botDetail.delete.successSuffix", "deleted successfully")}`), B("bots");
447
+ if (M && await g({
448
+ title: v("botlit.botsList.delete.title", "Delete bot?"),
449
+ message: v("botlit.botsList.delete.confirm", "Are you sure you want to delete \"{{name}}\"? Its channels will stop answering and this cannot be undone.", { name: z.name }),
450
+ confirmLabel: v("botlit.common.delete", "Delete"),
451
+ cancelLabel: v("botlit.common.cancel", "Cancel")
452
+ })) try {
453
+ if (!await Ve(M)) {
454
+ j.error(v("botlit.botsList.delete.notDeleted", "The bot could not be deleted."));
455
+ return;
456
+ }
457
+ j.success(v("botlit.botsList.delete.success", "Bot \"{{name}}\" deleted successfully", { name: z.name })), F("bots");
581
458
  } catch (e) {
582
- N.error(e instanceof Error ? e.message : R("botlit.botDetail.delete.error", "Failed to delete bot"));
459
+ j.error(e instanceof Error ? e.message : v("botlit.botDetail.delete.error", "Failed to delete bot"));
583
460
  }
584
461
  },
585
- children: R("botlit.common.delete", "Delete")
462
+ children: v("botlit.common.delete", "Delete")
586
463
  })
587
464
  })
588
465
  ]
@@ -590,95 +467,95 @@ var R = ({ isNew: y, isEditing: I }) => {
590
467
  children: /* @__PURE__ */ S("div", {
591
468
  className: "space-y-6",
592
469
  children: [
593
- /* @__PURE__ */ x(he, {
594
- icon: /* @__PURE__ */ x(T, { size: 18 }),
595
- children: R("botlit.botDetail.purpose", "This is everything that makes up a single bot — the agent that answers, how requests are routed, which channels it is live on, its guardrails and its release history. Use the tabs to wire it up: assign a default agent, connect a channel and activate it so real users can start chatting.")
470
+ /* @__PURE__ */ x(xe, {
471
+ icon: /* @__PURE__ */ x(w, { size: 18 }),
472
+ children: v("botlit.botDetail.purpose", "This is everything that makes up a single bot — the agent that answers, how requests are routed, which channels it is live on, its guardrails and its release history. Use the tabs to wire it up: assign a default agent, connect a channel and activate it so real users can start chatting.")
596
473
  }),
597
474
  /* @__PURE__ */ x("div", {
598
475
  className: "flex gap-1 border-b border-border-subtle overflow-x-auto",
599
- children: ze.map((e) => /* @__PURE__ */ S("button", {
600
- onClick: () => Y(e.id),
601
- className: le("flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors whitespace-nowrap", J === e.id ? "border-primary text-primary" : "border-transparent text-text-secondary hover:text-text-primary"),
476
+ children: nt.map((e) => /* @__PURE__ */ S("button", {
477
+ onClick: () => G(e.id),
478
+ className: pe("flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors whitespace-nowrap", W === e.id ? "border-primary text-primary" : "border-transparent text-text-secondary hover:text-text-primary"),
602
479
  children: [e.icon, e.label]
603
480
  }, e.id))
604
481
  }),
605
- J === "overview" && /* @__PURE__ */ S("div", {
482
+ W === "overview" && /* @__PURE__ */ S("div", {
606
483
  className: "space-y-6",
607
- children: [/* @__PURE__ */ x(me, {
608
- storageKey: `botlit-bot-${z}`,
484
+ children: [/* @__PURE__ */ x(be, {
485
+ storageKey: `botlit-bot-${M}`,
609
486
  steps: [
610
487
  {
611
488
  id: "workflow",
612
- label: R("botlit.botDetail.nextSteps.workflow", "Design the workflow"),
613
- description: R("botlit.botDetail.nextSteps.workflowDesc", "Lay out what the bot does on the FluidGrids canvas."),
614
- icon: /* @__PURE__ */ x(M, { size: 16 }),
615
- onClick: () => Y("workflow"),
616
- done: !!U.workflowId
489
+ label: v("botlit.botDetail.nextSteps.workflow", "Design the workflow"),
490
+ description: v("botlit.botDetail.nextSteps.workflowDesc", "Lay out what the bot does on the FluidGrids canvas."),
491
+ icon: /* @__PURE__ */ x(A, { size: 16 }),
492
+ onClick: () => G("workflow"),
493
+ done: !!z.workflowId
617
494
  },
618
495
  {
619
496
  id: "agent",
620
- label: R("botlit.botDetail.nextSteps.agent", "Assign a default agent"),
621
- description: R("botlit.botDetail.nextSteps.agentDesc", "Choose which agent answers when this bot is messaged."),
622
- icon: /* @__PURE__ */ x(T, { size: 16 }),
623
- onClick: () => Y("agents"),
624
- done: !!U.defaultAgentId
497
+ label: v("botlit.botDetail.nextSteps.agent", "Assign a default agent"),
498
+ description: v("botlit.botDetail.nextSteps.agentDesc", "Choose which agent answers when this bot is messaged."),
499
+ icon: /* @__PURE__ */ x(w, { size: 16 }),
500
+ onClick: () => G("agents"),
501
+ done: !!z.defaultAgentId
625
502
  },
626
503
  {
627
504
  id: "channel",
628
- label: R("botlit.botDetail.nextSteps.channel", "Connect a channel"),
629
- description: R("botlit.botDetail.nextSteps.channelDesc", "Put the bot on Slack, a web widget or another channel."),
630
- icon: /* @__PURE__ */ x(O, { size: 16 }),
631
- onClick: () => Y("channels")
505
+ label: v("botlit.botDetail.nextSteps.channel", "Connect a channel"),
506
+ description: v("botlit.botDetail.nextSteps.channelDesc", "Put the bot on Slack, a web widget or another channel."),
507
+ icon: /* @__PURE__ */ x(D, { size: 16 }),
508
+ onClick: () => G("channels")
632
509
  },
633
510
  {
634
511
  id: "test",
635
- label: R("botlit.botDetail.nextSteps.test", "Test the bot"),
636
- description: R("botlit.botDetail.nextSteps.testDesc", "Send a message to check the experience end to end."),
637
- icon: /* @__PURE__ */ x(D, { size: 16 }),
512
+ label: v("botlit.botDetail.nextSteps.test", "Test the bot"),
513
+ description: v("botlit.botDetail.nextSteps.testDesc", "Send a message to check the experience end to end."),
514
+ icon: /* @__PURE__ */ x(E, { size: 16 }),
638
515
  onClick: () => {
639
- let e = U?.defaultAgentId;
640
- B(e ? `chat/${e}` : "chat");
516
+ let e = z?.defaultAgentId;
517
+ F(e ? `chat/${e}` : "chat");
641
518
  }
642
519
  },
643
520
  {
644
521
  id: "activate",
645
- label: R("botlit.botDetail.nextSteps.activate", "Activate the bot"),
646
- description: R("botlit.botDetail.nextSteps.activateDesc", "Make it live so it starts handling conversations."),
647
- icon: /* @__PURE__ */ x(A, { size: 16 }),
648
- onClick: () => B(`bots/${z}/edit`),
649
- done: U.status === "ACTIVE"
522
+ label: v("botlit.botDetail.nextSteps.activate", "Activate the bot"),
523
+ description: v("botlit.botDetail.nextSteps.activateDesc", "Make it live so it starts handling conversations."),
524
+ icon: /* @__PURE__ */ x(k, { size: 16 }),
525
+ onClick: () => F(`bots/${M}/edit`),
526
+ done: z.status === "ACTIVE"
650
527
  }
651
528
  ]
652
529
  }), /* @__PURE__ */ S("div", {
653
530
  className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
654
531
  children: [
655
- /* @__PURE__ */ S(r, { children: [/* @__PURE__ */ x(o, { children: /* @__PURE__ */ x(s, { children: "Details" }) }), /* @__PURE__ */ S(i, {
532
+ /* @__PURE__ */ S(n, { children: [/* @__PURE__ */ x(a, { children: /* @__PURE__ */ x(o, { children: "Details" }) }), /* @__PURE__ */ S(r, {
656
533
  className: "space-y-4",
657
534
  children: [
658
535
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
659
536
  className: "text-sm text-text-secondary",
660
537
  children: "Status"
661
- }), /* @__PURE__ */ x(h, { status: U.status })] }),
538
+ }), /* @__PURE__ */ x(l, { status: z.status })] }),
662
539
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
663
540
  className: "text-sm text-text-secondary",
664
541
  children: "Visibility"
665
- }), /* @__PURE__ */ x(m, {
542
+ }), /* @__PURE__ */ x(c, {
666
543
  variant: "outline",
667
- children: U.visibility
544
+ children: z.visibility
668
545
  })] }),
669
546
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
670
547
  className: "text-sm text-text-secondary",
671
548
  children: "Routing Strategy"
672
- }), /* @__PURE__ */ x(m, {
549
+ }), /* @__PURE__ */ x(c, {
673
550
  variant: "outline",
674
- children: U.routingStrategy
551
+ children: z.routingStrategy
675
552
  })] }),
676
553
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
677
554
  className: "text-sm text-text-secondary",
678
555
  children: "Default Agent"
679
556
  }), /* @__PURE__ */ x("p", {
680
557
  className: "font-medium",
681
- children: U.defaultAgentId ? "1 agent assigned" : "No agents"
558
+ children: z.defaultAgentId ? "1 agent assigned" : "No agents"
682
559
  })] }),
683
560
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
684
561
  className: "text-sm text-text-secondary",
@@ -692,18 +569,18 @@ var R = ({ isNew: y, isEditing: I }) => {
692
569
  children: "Created"
693
570
  }), /* @__PURE__ */ x("p", {
694
571
  className: "font-medium",
695
- children: ce(U.createdAt)
572
+ children: fe(z.createdAt)
696
573
  })] }),
697
574
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
698
575
  className: "text-sm text-text-secondary",
699
576
  children: "Executions"
700
577
  }), /* @__PURE__ */ x("p", {
701
578
  className: "font-medium",
702
- children: se(U.executionCount)
579
+ children: de(z.executionCount)
703
580
  })] })
704
581
  ]
705
582
  })] }),
706
- /* @__PURE__ */ S(pe, {
583
+ /* @__PURE__ */ S(ye, {
707
584
  treatment: "glass",
708
585
  glow: !0,
709
586
  className: "lg:col-span-2 p-6",
@@ -715,16 +592,16 @@ var R = ({ isNew: y, isEditing: I }) => {
715
592
  }), /* @__PURE__ */ x("p", {
716
593
  className: "text-sm text-text-secondary",
717
594
  children: "Agent configured for this bot"
718
- })] }), /* @__PURE__ */ x(c, {
595
+ })] }), /* @__PURE__ */ x(s, {
719
596
  size: "sm",
720
597
  variant: "outline",
721
- onClick: () => Y("agents"),
598
+ onClick: () => G("agents"),
722
599
  children: "Manage"
723
600
  })]
724
601
  }), /* @__PURE__ */ x("div", { children: $ ? /* @__PURE__ */ x("div", {
725
602
  className: "space-y-3",
726
- children: /* @__PURE__ */ S(_e, {
727
- to: ke(`agents/${$.id}`),
603
+ children: /* @__PURE__ */ S(Ce, {
604
+ to: I(`agents/${$.id}`),
728
605
  className: "flex items-center justify-between p-3 rounded-lg border border-border-subtle hover:bg-accent transition-colors",
729
606
  children: [/* @__PURE__ */ S("div", {
730
607
  className: "flex items-center gap-3",
@@ -738,27 +615,27 @@ var R = ({ isNew: y, isEditing: I }) => {
738
615
  className: "text-xs text-text-secondary",
739
616
  children: "Default Agent"
740
617
  })] })]
741
- }), /* @__PURE__ */ x(h, { status: $.status })]
618
+ }), /* @__PURE__ */ x(l, { status: $.status })]
742
619
  })
743
620
  }) : /* @__PURE__ */ S("div", {
744
621
  className: "text-center py-8 text-text-secondary",
745
622
  children: [
746
- /* @__PURE__ */ x(T, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }),
623
+ /* @__PURE__ */ x(w, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }),
747
624
  /* @__PURE__ */ x("p", { children: "No default agent assigned" }),
748
- /* @__PURE__ */ x(c, {
625
+ /* @__PURE__ */ x(s, {
749
626
  size: "sm",
750
627
  className: "mt-3",
751
- onClick: () => Y("agents"),
628
+ onClick: () => G("agents"),
752
629
  children: "Assign Agent"
753
630
  })
754
631
  ]
755
632
  }) })]
756
633
  }),
757
- (U.tagIds || []).length > 0 && /* @__PURE__ */ S(r, {
634
+ (z.tagIds || []).length > 0 && /* @__PURE__ */ S(n, {
758
635
  className: "lg:col-span-3",
759
- children: [/* @__PURE__ */ x(o, { children: /* @__PURE__ */ x(s, { children: "Tags" }) }), /* @__PURE__ */ x(i, { children: /* @__PURE__ */ x("div", {
636
+ children: [/* @__PURE__ */ x(a, { children: /* @__PURE__ */ x(o, { children: "Tags" }) }), /* @__PURE__ */ x(r, { children: /* @__PURE__ */ x("div", {
760
637
  className: "flex flex-wrap gap-2",
761
- children: (U.tagIds || []).map((e) => /* @__PURE__ */ x(m, {
638
+ children: (z.tagIds || []).map((e) => /* @__PURE__ */ x(c, {
762
639
  variant: "outline",
763
640
  children: e
764
641
  }, e))
@@ -767,44 +644,44 @@ var R = ({ isNew: y, isEditing: I }) => {
767
644
  ]
768
645
  })]
769
646
  }),
770
- J === "workflow" && z && /* @__PURE__ */ x(de, {
647
+ W === "workflow" && M && /* @__PURE__ */ x(ve, {
771
648
  fallback: /* @__PURE__ */ x("div", { className: "h-64 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }),
772
- children: /* @__PURE__ */ x(we, {
773
- botId: z,
774
- botName: U.name,
775
- workflowId: U.workflowId,
649
+ children: /* @__PURE__ */ x(Me, {
650
+ botId: M,
651
+ botName: z.name,
652
+ workflowId: z.workflowId,
776
653
  onWorkflowChanged: async () => {
777
- await W();
654
+ await V();
778
655
  }
779
656
  })
780
657
  }),
781
- J === "routing" && /* @__PURE__ */ S("div", {
658
+ W === "routing" && /* @__PURE__ */ S("div", {
782
659
  className: "space-y-6",
783
- children: [/* @__PURE__ */ S(r, { children: [/* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(s, { children: "Routing Configuration" }), /* @__PURE__ */ x(a, { children: "How requests are routed to agents" })] }), /* @__PURE__ */ x(i, {
660
+ children: [/* @__PURE__ */ S(n, { children: [/* @__PURE__ */ S(a, { children: [/* @__PURE__ */ x(o, { children: "Routing Configuration" }), /* @__PURE__ */ x(i, { children: "How requests are routed to agents" })] }), /* @__PURE__ */ x(r, {
784
661
  className: "space-y-4",
785
662
  children: /* @__PURE__ */ S("div", {
786
663
  className: "grid grid-cols-2 gap-4",
787
664
  children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
788
665
  className: "text-sm text-text-secondary",
789
666
  children: "Strategy"
790
- }), /* @__PURE__ */ x(m, {
667
+ }), /* @__PURE__ */ x(c, {
791
668
  variant: "outline",
792
669
  className: "mt-1",
793
- children: U.routingStrategy
794
- })] }), U.defaultAgentId && /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
670
+ children: z.routingStrategy
671
+ })] }), z.defaultAgentId && /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
795
672
  className: "text-sm text-text-secondary",
796
673
  children: "Default Agent"
797
674
  }), /* @__PURE__ */ x("p", {
798
675
  className: "font-mono text-sm mt-1",
799
- children: U.defaultAgentId
676
+ children: z.defaultAgentId
800
677
  })] })]
801
678
  })
802
- })] }), /* @__PURE__ */ S(r, { children: [/* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(s, { children: "Routing Rules" }), /* @__PURE__ */ x(a, { children: "No routing rules configured" })] }), /* @__PURE__ */ x(i, { children: /* @__PURE__ */ x("p", {
679
+ })] }), /* @__PURE__ */ S(n, { children: [/* @__PURE__ */ S(a, { children: [/* @__PURE__ */ x(o, { children: "Routing Rules" }), /* @__PURE__ */ x(i, { children: "No routing rules configured" })] }), /* @__PURE__ */ x(r, { children: /* @__PURE__ */ x("p", {
803
680
  className: "text-text-secondary",
804
681
  children: "No routing rules configured. Routing rules will be available in a future update."
805
682
  }) })] })]
806
683
  }),
807
- J === "agents" && /* @__PURE__ */ S(r, { children: [/* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(s, { children: "Default Agent" }), /* @__PURE__ */ x(a, { children: "Select the default agent for this bot" })] }), /* @__PURE__ */ S(i, {
684
+ W === "agents" && /* @__PURE__ */ S(n, { children: [/* @__PURE__ */ S(a, { children: [/* @__PURE__ */ x(o, { children: "Default Agent" }), /* @__PURE__ */ x(i, { children: "Select the default agent for this bot" })] }), /* @__PURE__ */ S(r, {
808
685
  className: "space-y-4",
809
686
  children: [
810
687
  $ && /* @__PURE__ */ S("div", {
@@ -817,59 +694,59 @@ var R = ({ isNew: y, isEditing: I }) => {
817
694
  }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
818
695
  className: "font-medium",
819
696
  children: $.name
820
- }), /* @__PURE__ */ x(m, {
697
+ }), /* @__PURE__ */ x(c, {
821
698
  variant: "success",
822
699
  children: "Default"
823
700
  })] })]
824
- }), /* @__PURE__ */ x(h, { status: $.status })]
701
+ }), /* @__PURE__ */ x(l, { status: $.status })]
825
702
  }),
826
703
  /* @__PURE__ */ x("div", {
827
704
  className: "flex items-center gap-3",
828
705
  children: /* @__PURE__ */ S("select", {
829
706
  className: "flex h-10 flex-1 rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
830
- value: U.defaultAgentId || "",
831
- disabled: !Oe(f.APP_UPDATE),
707
+ value: z.defaultAgentId || "",
708
+ disabled: !P(u.APP_UPDATE),
832
709
  onChange: async (e) => {
833
- if (z) try {
834
- await K({
835
- botId: z,
710
+ if (M) try {
711
+ await U({
712
+ botId: M,
836
713
  input: { defaultAgentId: e.target.value || null }
837
- }), N.success(e.target.value ? "Default agent assigned" : "Default agent removed");
714
+ }), j.success(e.target.value ? "Default agent assigned" : "Default agent removed");
838
715
  } catch (e) {
839
716
  let t = e instanceof Error ? e.message : "Failed to assign agent";
840
- N.error(t);
717
+ j.error(t);
841
718
  }
842
719
  },
843
720
  children: [/* @__PURE__ */ x("option", {
844
721
  value: "",
845
722
  children: "No default agent"
846
- }), G?.map((e) => /* @__PURE__ */ x("option", {
723
+ }), H?.map((e) => /* @__PURE__ */ x("option", {
847
724
  value: e.id,
848
725
  children: e.name
849
726
  }, e.id))]
850
727
  })
851
728
  }),
852
- !$ && !G?.length && /* @__PURE__ */ S("div", {
729
+ !$ && !H?.length && /* @__PURE__ */ S("div", {
853
730
  className: "text-center py-8 text-text-secondary",
854
- children: [/* @__PURE__ */ x(T, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }), /* @__PURE__ */ x("p", { children: "No agents available. Create an agent first." })]
731
+ children: [/* @__PURE__ */ x(w, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }), /* @__PURE__ */ x("p", { children: "No agents available. Create an agent first." })]
855
732
  })
856
733
  ]
857
734
  })] }),
858
- J === "channels" && z && /* @__PURE__ */ x(ue, {
859
- botId: z,
860
- botName: U.name
735
+ W === "channels" && M && /* @__PURE__ */ x(_e, {
736
+ botId: M,
737
+ botName: z.name
861
738
  }),
862
- J === "aiOperations" && z && /* @__PURE__ */ x(n, {
739
+ W === "aiOperations" && M && /* @__PURE__ */ x(ee, {
863
740
  filter: {
864
741
  subjectType: "APP",
865
- subjectId: z
742
+ subjectId: M
866
743
  },
867
- description: R("botlit.botDetail.aiOperationsDescription", "What the supervisor flagged for this bot — drift, evidence and the recommended action.")
744
+ description: v("botlit.botDetail.aiOperationsDescription", "What the supervisor flagged for this bot — drift, evidence and the recommended action.")
868
745
  }),
869
- J === "guardrails" && /* @__PURE__ */ S(r, { children: [/* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(s, { children: "Policy Bindings" }), /* @__PURE__ */ x(a, { children: "Guardrails and policies attached to this bot" })] }), /* @__PURE__ */ x(i, { children: /* @__PURE__ */ S("div", {
746
+ W === "guardrails" && /* @__PURE__ */ S(n, { children: [/* @__PURE__ */ S(a, { children: [/* @__PURE__ */ x(o, { children: "Policy Bindings" }), /* @__PURE__ */ x(i, { children: "Guardrails and policies attached to this bot" })] }), /* @__PURE__ */ x(r, { children: /* @__PURE__ */ S("div", {
870
747
  className: "text-center py-8 text-text-secondary",
871
748
  children: [
872
- /* @__PURE__ */ x(A, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }),
749
+ /* @__PURE__ */ x(k, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }),
873
750
  /* @__PURE__ */ x("p", { children: "Not configured" }),
874
751
  /* @__PURE__ */ x("p", {
875
752
  className: "text-sm mt-1",
@@ -877,10 +754,10 @@ var R = ({ isNew: y, isEditing: I }) => {
877
754
  })
878
755
  ]
879
756
  }) })] }),
880
- J === "releases" && /* @__PURE__ */ S(r, { children: [/* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(s, { children: "Release Tracks" }), /* @__PURE__ */ x(a, { children: "Version deployments across environments" })] }), /* @__PURE__ */ x(i, { children: /* @__PURE__ */ S("div", {
757
+ W === "releases" && /* @__PURE__ */ S(n, { children: [/* @__PURE__ */ S(a, { children: [/* @__PURE__ */ x(o, { children: "Release Tracks" }), /* @__PURE__ */ x(i, { children: "Version deployments across environments" })] }), /* @__PURE__ */ x(r, { children: /* @__PURE__ */ S("div", {
881
758
  className: "text-center py-8 text-text-secondary",
882
759
  children: [
883
- /* @__PURE__ */ x(E, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }),
760
+ /* @__PURE__ */ x(T, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }),
884
761
  /* @__PURE__ */ x("p", { children: "Not configured" }),
885
762
  /* @__PURE__ */ x("p", {
886
763
  className: "text-sm mt-1",
@@ -892,6 +769,6 @@ var R = ({ isNew: y, isEditing: I }) => {
892
769
  })
893
770
  });
894
771
  };
895
- export { R as BotDetailPage };
772
+ export { L as BotDetailPage };
896
773
 
897
774
  //# sourceMappingURL=BotDetailPage.js.map