@icanbwell/baileyai-chat-ui 1.0.19 → 1.0.20
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/README.md +4 -0
- package/dist/baileyai-chat-ui.cjs +3 -3
- package/dist/baileyai-chat-ui.js +645 -625
- package/dist/index.d.ts +9 -8
- package/package.json +1 -1
package/dist/baileyai-chat-ui.js
CHANGED
|
@@ -6,23 +6,23 @@ import * as h from "@radix-ui/react-dropdown-menu";
|
|
|
6
6
|
import * as g from "@radix-ui/react-tooltip";
|
|
7
7
|
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
8
8
|
//#region src/utils/pseudoToolCalls.ts
|
|
9
|
-
var b = "search_tools|call_tool|function_calls|function_result",
|
|
10
|
-
function
|
|
11
|
-
let t =
|
|
9
|
+
var b = "search_tools|call_tool|function_calls|function_result", x = RegExp(`<(${b})>([\\s\\S]*?)<\\/\\1>`, "g"), S = RegExp(`<(?:${b})>[\\s\\S]*$`), C = /<name>([\s\S]*?)<\/name>/, w = /<arguments>([\s\S]*?)<\/arguments>/, T = /<invoke\s+name="([^"]*)"\s*>([\s\S]*?)<\/invoke>/g, E = /<parameter\s+name="([^"]*)"\s*>([\s\S]*?)<\/parameter>/g;
|
|
10
|
+
function D(e) {
|
|
11
|
+
let t = C.exec(e)?.[1]?.trim() || "unknown_tool", n = w.exec(e)?.[1]?.trim();
|
|
12
12
|
return n ? {
|
|
13
13
|
name: t,
|
|
14
14
|
args: n
|
|
15
15
|
} : { name: t };
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function O(e) {
|
|
18
18
|
let t = [];
|
|
19
|
-
|
|
19
|
+
T.lastIndex = 0;
|
|
20
20
|
let n;
|
|
21
|
-
for (; (n =
|
|
21
|
+
for (; (n = T.exec(e)) !== null;) {
|
|
22
22
|
let [, e, r] = n, i = {};
|
|
23
|
-
|
|
23
|
+
E.lastIndex = 0;
|
|
24
24
|
let a;
|
|
25
|
-
for (; (a =
|
|
25
|
+
for (; (a = E.exec(r)) !== null;) i[a[1]] = a[2].trim();
|
|
26
26
|
let o = e.trim() || "unknown_tool";
|
|
27
27
|
t.push(Object.keys(i).length > 0 ? {
|
|
28
28
|
name: o,
|
|
@@ -31,14 +31,14 @@ function D(e) {
|
|
|
31
31
|
}
|
|
32
32
|
return t;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
let { hideOpenBlock: n = !0 } = t, r = [], i = e.replace(
|
|
34
|
+
function k(e, t = {}) {
|
|
35
|
+
let { hideOpenBlock: n = !0 } = t, r = [], i = e.replace(x, (e, t, n) => (t === "call_tool" ? r.push(D(n)) : t === "search_tools" ? r.push({
|
|
36
36
|
name: "search_tools",
|
|
37
37
|
args: n.trim()
|
|
38
|
-
}) : t === "function_calls" ? r.push(...
|
|
38
|
+
}) : t === "function_calls" ? r.push(...O(n)) : r.push({
|
|
39
39
|
name: "function_result",
|
|
40
40
|
args: n.trim()
|
|
41
|
-
}), "")), a = n ? i.replace(
|
|
41
|
+
}), "")), a = n ? i.replace(S, "") : i;
|
|
42
42
|
return r.length === 0 && a === i ? {
|
|
43
43
|
cleanedText: i,
|
|
44
44
|
matches: r
|
|
@@ -49,7 +49,7 @@ function O(e, t = {}) {
|
|
|
49
49
|
}
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/logic/sse.ts
|
|
52
|
-
function
|
|
52
|
+
function ee(e) {
|
|
53
53
|
if (!e.startsWith("data: ")) return e;
|
|
54
54
|
let t = "";
|
|
55
55
|
for (let n of e.split("\n")) {
|
|
@@ -88,7 +88,7 @@ function A(e) {
|
|
|
88
88
|
message: e
|
|
89
89
|
});
|
|
90
90
|
} else if (c?.type === "response.output_text.delta" && typeof c.delta == "string") {
|
|
91
|
-
let e =
|
|
91
|
+
let e = ee(c.delta);
|
|
92
92
|
e && r.push({
|
|
93
93
|
type: "response.output_text.delta",
|
|
94
94
|
delta: e
|
|
@@ -171,12 +171,12 @@ function F() {
|
|
|
171
171
|
}
|
|
172
172
|
//#endregion
|
|
173
173
|
//#region src/logic/useBaileyChat.ts
|
|
174
|
-
var I = 200, oe = 100, L = 15e4,
|
|
174
|
+
var I = 200, oe = 100, L = 15e4, R = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `bailey-${Date.now()}-${Math.random().toString(36).slice(2)}`, se = (e, t, n) => {
|
|
175
175
|
if (e === 401 || e === 403) return "Bailey isn't reachable with your current login.";
|
|
176
176
|
let r = `Bailey request failed (status ${e ?? "network error"}).`, i = (n || t || "").trim();
|
|
177
177
|
return i ? `${r} ${i.length > I ? `${i.slice(0, I)}…` : i}` : r;
|
|
178
178
|
};
|
|
179
|
-
function
|
|
179
|
+
function ce(e, t, n) {
|
|
180
180
|
if (e) try {
|
|
181
181
|
return e.get(t) || void 0;
|
|
182
182
|
} catch (e) {
|
|
@@ -184,82 +184,82 @@ function le(e, t, n) {
|
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function le(e, t) {
|
|
188
188
|
t.signal.aborted || typeof e != "string" || (t.historyStatus = e);
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function ue(e, t, n, r) {
|
|
191
191
|
try {
|
|
192
192
|
e?.set(t, n);
|
|
193
193
|
} catch (e) {
|
|
194
194
|
r(e, "write");
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function z(e, t, n) {
|
|
198
198
|
try {
|
|
199
199
|
e?.remove(t);
|
|
200
200
|
} catch (e) {
|
|
201
201
|
n(e, "remove");
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
var
|
|
205
|
-
function
|
|
204
|
+
var B = (e, t) => t ? `${e}:${t}` : e;
|
|
205
|
+
function de(e) {
|
|
206
206
|
let { seed: t, sub: n, storage: r, key: i, report: a } = e;
|
|
207
|
-
if (!n) return t ||
|
|
207
|
+
if (!n) return t || ce(r, i, a);
|
|
208
208
|
if (t && re({
|
|
209
209
|
conversationId: t,
|
|
210
210
|
sub: n
|
|
211
211
|
})) return t;
|
|
212
|
-
let o =
|
|
212
|
+
let o = ce(r, i, a);
|
|
213
213
|
if (o) {
|
|
214
214
|
if (re({
|
|
215
215
|
conversationId: o,
|
|
216
216
|
sub: n
|
|
217
217
|
})) return o;
|
|
218
|
-
|
|
218
|
+
z(r, i, a);
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
var
|
|
222
|
-
let [
|
|
221
|
+
var V = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i, firstUserMessagePrefix: o, onAssistantMessageComplete: c, idleTimeoutMs: l = L, client: p, conversationId: m, sub: h, storage: g, storageKey: _ = ie, sendFullTranscript: v = !1, onStorageError: y, onContextLoss: b }) => {
|
|
222
|
+
let [x, S] = f([]), [C, w] = f([]), [T, E] = f(null), [D, O] = f("idle"), [ee, j] = f(null), M = h !== void 0 && h.trim() === "", N = M ? void 0 : h?.trim() || void 0, P = u(() => ae(), []), F = M ? null : g === void 0 ? P : g || null, I = d(y), ce = d(b);
|
|
223
223
|
s(() => {
|
|
224
|
-
I.current = y,
|
|
224
|
+
I.current = y, ce.current = b;
|
|
225
225
|
}, [y, b]);
|
|
226
|
-
let
|
|
226
|
+
let V = a((e, t) => {
|
|
227
227
|
try {
|
|
228
228
|
I.current?.(e, t);
|
|
229
229
|
} catch {}
|
|
230
|
-
}, []),
|
|
230
|
+
}, []), H = (e) => de({
|
|
231
231
|
seed: m,
|
|
232
232
|
sub: N,
|
|
233
233
|
storage: F,
|
|
234
|
-
key:
|
|
234
|
+
key: B(_, N),
|
|
235
235
|
report: e
|
|
236
|
-
}), [
|
|
236
|
+
}), [U] = f(() => {
|
|
237
237
|
let e = [];
|
|
238
238
|
return {
|
|
239
|
-
id:
|
|
239
|
+
id: H((t, n) => void e.push({
|
|
240
240
|
error: t,
|
|
241
241
|
operation: n
|
|
242
242
|
})),
|
|
243
243
|
errors: e
|
|
244
244
|
};
|
|
245
|
-
}), [
|
|
246
|
-
|
|
247
|
-
}, [
|
|
245
|
+
}), [fe, W] = f(U.id), [pe, me] = f(U.errors.length > 0), G = a((e, t) => {
|
|
246
|
+
me(!0), V(e, t);
|
|
247
|
+
}, [V]);
|
|
248
248
|
s(() => {
|
|
249
|
-
|
|
250
|
-
}, [
|
|
251
|
-
M &&
|
|
252
|
-
}, [M,
|
|
253
|
-
let
|
|
249
|
+
U.errors.forEach(({ error: e, operation: t }) => V(e, t));
|
|
250
|
+
}, [U, V]), s(() => {
|
|
251
|
+
M && V(/* @__PURE__ */ Error("sub is blank"), "key");
|
|
252
|
+
}, [M, V]);
|
|
253
|
+
let K = d(fe), q = d({
|
|
254
254
|
storage: F,
|
|
255
|
-
key:
|
|
255
|
+
key: B(_, N),
|
|
256
256
|
sub: N,
|
|
257
257
|
sendFullTranscript: v
|
|
258
258
|
});
|
|
259
259
|
s(() => {
|
|
260
|
-
|
|
260
|
+
q.current = {
|
|
261
261
|
storage: F,
|
|
262
|
-
key:
|
|
262
|
+
key: B(_, N),
|
|
263
263
|
sub: N,
|
|
264
264
|
sendFullTranscript: v
|
|
265
265
|
};
|
|
@@ -269,40 +269,40 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
269
269
|
N,
|
|
270
270
|
v
|
|
271
271
|
]);
|
|
272
|
-
let
|
|
273
|
-
|
|
272
|
+
let he = g === !1 ? "off" : pe || M ? "degraded" : "ok", [ge, _e] = f(!1), [ve, J] = f("idle"), [ye, Y] = f(!1), X = d(0), be = d(null), xe = d(null), Se = d(!1), Z = a(() => {
|
|
273
|
+
X.current += 1, be.current?.abort(), be.current = null, xe.current = null, Se.current = !1, Y(!1), J("idle");
|
|
274
274
|
}, []), Ce = d(p);
|
|
275
275
|
s(() => {
|
|
276
276
|
Ce.current = p;
|
|
277
|
-
}, [p]), s(() => () =>
|
|
277
|
+
}, [p]), s(() => () => be.current?.abort(), []);
|
|
278
278
|
let we = d(null), Te = d(""), Ee = d(0), De = d([]);
|
|
279
279
|
s(() => {
|
|
280
|
-
De.current =
|
|
281
|
-
}, [
|
|
282
|
-
let Q = d([]), Oe = d(/* @__PURE__ */ new Map()), ke = d(/* @__PURE__ */ new Map()), Ae = d(null),
|
|
280
|
+
De.current = x;
|
|
281
|
+
}, [x]);
|
|
282
|
+
let Q = d([]), Oe = d(/* @__PURE__ */ new Map()), ke = d(/* @__PURE__ */ new Map()), Ae = d(null), je = a(() => {
|
|
283
283
|
Ae.current !== null && (clearTimeout(Ae.current), Ae.current = null);
|
|
284
|
-
}, []),
|
|
285
|
-
|
|
284
|
+
}, []), Me = a((e) => {
|
|
285
|
+
je(), Ae.current = setTimeout(() => {
|
|
286
286
|
e.abort(new DOMException("The assistant took too long to respond. Please try again.", "TimeoutError"));
|
|
287
287
|
}, l);
|
|
288
|
-
}, [
|
|
288
|
+
}, [je, l]);
|
|
289
289
|
s(() => () => {
|
|
290
|
-
we.current?.abort(),
|
|
291
|
-
}, [
|
|
292
|
-
let
|
|
290
|
+
we.current?.abort(), je();
|
|
291
|
+
}, [je]);
|
|
292
|
+
let $ = a(({ reportedId: e, source: t, turn: n }) => {
|
|
293
293
|
if (n.signal.aborted || typeof e != "string" || !e) return;
|
|
294
294
|
if (t === "event") n.reportedId = e, n.reportedFromEvent = !0;
|
|
295
295
|
else if (!n.reportedFromEvent) n.reportedId = e;
|
|
296
296
|
else return;
|
|
297
|
-
if (n.heldId || e ===
|
|
298
|
-
let { sub: r, storage: i, key: a } =
|
|
297
|
+
if (n.heldId || e === K.current) return;
|
|
298
|
+
let { sub: r, storage: i, key: a } = q.current;
|
|
299
299
|
r && !re({
|
|
300
300
|
conversationId: e,
|
|
301
301
|
sub: r
|
|
302
|
-
}) || (
|
|
303
|
-
}, [
|
|
302
|
+
}) || (K.current = e, W(e), ue(i, a, e, G));
|
|
303
|
+
}, [G]), Ne = a((e, t, n, r) => {
|
|
304
304
|
let i = (e) => {
|
|
305
|
-
n.push(e),
|
|
305
|
+
n.push(e), w((t) => [...t, e]);
|
|
306
306
|
};
|
|
307
307
|
if (t.type === "response.output_text.delta") {
|
|
308
308
|
if (!t.delta) return !1;
|
|
@@ -311,8 +311,8 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
311
311
|
emittedCount: 0
|
|
312
312
|
};
|
|
313
313
|
n.raw += t.delta;
|
|
314
|
-
let { cleanedText: r, matches: a } =
|
|
315
|
-
if (n.emittedCount = a.length, Oe.current.set(e, n), ke.current.set(e, o),
|
|
314
|
+
let { cleanedText: r, matches: a } = k(n.raw), o = r.trim(), s = a.slice(n.emittedCount);
|
|
315
|
+
if (n.emittedCount = a.length, Oe.current.set(e, n), ke.current.set(e, o), S((t) => t.map((t) => t.id === e ? {
|
|
316
316
|
...t,
|
|
317
317
|
content: o
|
|
318
318
|
} : t)), s.length > 0) {
|
|
@@ -329,7 +329,7 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
329
329
|
}
|
|
330
330
|
if (t.type === "response.output_item.added" || t.type === "response.output_item.done") {
|
|
331
331
|
let n = t.item;
|
|
332
|
-
if (n.type === "output_image") return n.image_url &&
|
|
332
|
+
if (n.type === "output_image") return n.image_url && S((t) => t.map((t) => t.id === e ? {
|
|
333
333
|
...t,
|
|
334
334
|
parts: [...t.parts ?? [], {
|
|
335
335
|
type: "image",
|
|
@@ -384,26 +384,26 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
384
384
|
turnSentAt: Ee.current
|
|
385
385
|
}), !0;
|
|
386
386
|
if (t.type === "response.output_text.done") return !1;
|
|
387
|
-
if (t.type === "response.created") return
|
|
387
|
+
if (t.type === "response.created") return $({
|
|
388
388
|
reportedId: t.response?.conversation?.id,
|
|
389
389
|
source: "event",
|
|
390
390
|
turn: r
|
|
391
|
-
}),
|
|
391
|
+
}), le(t.response?.conversation?.history_status, r), !1;
|
|
392
392
|
if (t.type === "response.completed") {
|
|
393
|
-
|
|
393
|
+
$({
|
|
394
394
|
reportedId: t.response?.conversation?.id,
|
|
395
395
|
source: "event",
|
|
396
396
|
turn: r
|
|
397
|
-
}),
|
|
397
|
+
}), le(t.response?.conversation?.history_status, r);
|
|
398
398
|
let n = typeof t.message_id == "string" && t.message_id ? t.message_id : void 0;
|
|
399
|
-
n &&
|
|
399
|
+
n && S((t) => t.map((t) => t.id === e ? {
|
|
400
400
|
...t,
|
|
401
401
|
serverMessageId: n
|
|
402
402
|
} : t));
|
|
403
403
|
let i = Oe.current.get(e);
|
|
404
404
|
if (i) {
|
|
405
|
-
let { cleanedText: t } =
|
|
406
|
-
n !== ke.current.get(e) && (ke.current.set(e, n),
|
|
405
|
+
let { cleanedText: t } = k(i.raw, { hideOpenBlock: !1 }), n = t.trim();
|
|
406
|
+
n !== ke.current.get(e) && (ke.current.set(e, n), S((t) => t.map((t) => t.id === e ? {
|
|
407
407
|
...t,
|
|
408
408
|
content: n
|
|
409
409
|
} : t)));
|
|
@@ -426,7 +426,7 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
426
426
|
turnSentAt: Ee.current
|
|
427
427
|
}), !0;
|
|
428
428
|
let { html: r, title: a, csp: o, permissions: s, prefersBorder: c, displayMode: l } = t;
|
|
429
|
-
return
|
|
429
|
+
return S((t) => t.map((t) => t.id === e ? {
|
|
430
430
|
...t,
|
|
431
431
|
parts: [...t.parts ?? [], {
|
|
432
432
|
type: "mcp_app",
|
|
@@ -447,18 +447,18 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
447
447
|
at: Date.now(),
|
|
448
448
|
turnSentAt: Ee.current
|
|
449
449
|
}), !0;
|
|
450
|
-
}, [
|
|
451
|
-
|
|
450
|
+
}, [$]), Pe = a(async (a) => {
|
|
451
|
+
O("streaming"), j(null), _e(!1);
|
|
452
452
|
let s = Date.now();
|
|
453
453
|
Ee.current = s;
|
|
454
|
-
let l =
|
|
454
|
+
let l = R(), u = {
|
|
455
455
|
id: l,
|
|
456
456
|
role: "assistant",
|
|
457
457
|
content: "",
|
|
458
458
|
streaming: !0,
|
|
459
459
|
createdAt: s
|
|
460
460
|
};
|
|
461
|
-
|
|
461
|
+
S((e) => [...e, u]), Q.current = [...a, u];
|
|
462
462
|
let d = a.findIndex((e) => e.role === "user" && !e.hidden), f = a.map((e, t) => t === d && o ? {
|
|
463
463
|
role: e.role,
|
|
464
464
|
content: `${o}${e.content}`,
|
|
@@ -469,8 +469,8 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
469
469
|
content: e.content,
|
|
470
470
|
hidden: e.hidden,
|
|
471
471
|
titleHint: e.titleHint
|
|
472
|
-
}), { sendFullTranscript: p } =
|
|
473
|
-
|
|
472
|
+
}), { sendFullTranscript: p } = q.current, m = p ? void 0 : K.current, h = m ? f.slice(-1) : f;
|
|
473
|
+
E({
|
|
474
474
|
model: t,
|
|
475
475
|
systemPrompt: n,
|
|
476
476
|
messages: h,
|
|
@@ -485,12 +485,12 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
485
485
|
}
|
|
486
486
|
});
|
|
487
487
|
let g = new AbortController();
|
|
488
|
-
we.current = g,
|
|
488
|
+
we.current = g, Me(g);
|
|
489
489
|
let _ = {
|
|
490
490
|
signal: g.signal,
|
|
491
491
|
heldId: m
|
|
492
|
-
}, v = "", y = null, b = !1,
|
|
493
|
-
|
|
492
|
+
}, v = "", y = null, b = !1, x = !1, C = !1, T = [], D = (e, t) => {
|
|
493
|
+
O("error"), j(e);
|
|
494
494
|
let n = {
|
|
495
495
|
kind: "error",
|
|
496
496
|
message: e,
|
|
@@ -498,8 +498,8 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
498
498
|
turnSentAt: s,
|
|
499
499
|
...t
|
|
500
500
|
};
|
|
501
|
-
|
|
502
|
-
},
|
|
501
|
+
T.push(n), w((e) => [...e, n]);
|
|
502
|
+
}, k = (e, t) => {
|
|
503
503
|
e.forEach((e) => {
|
|
504
504
|
if (e.type === "error") {
|
|
505
505
|
y = e.message;
|
|
@@ -509,35 +509,35 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
509
509
|
at: Date.now(),
|
|
510
510
|
turnSentAt: s
|
|
511
511
|
};
|
|
512
|
-
|
|
512
|
+
T.push(t), w((e) => [...e, t]);
|
|
513
513
|
return;
|
|
514
514
|
}
|
|
515
|
-
e.type === "response.output_text.delta" && e.delta && (
|
|
516
|
-
}), t && (b = !0,
|
|
515
|
+
e.type === "response.output_text.delta" && e.delta && (C = !0), Ne(l, e, T, _) && (x = !0);
|
|
516
|
+
}), t && (b = !0, S((e) => e.map((e) => e.id === l ? {
|
|
517
517
|
...e,
|
|
518
518
|
streaming: !1
|
|
519
519
|
} : e)));
|
|
520
520
|
};
|
|
521
521
|
try {
|
|
522
|
-
let { status: a, text: o, errorMessage: u,
|
|
522
|
+
let { status: a, text: o, errorMessage: u, errorKind: d, interrupted: f } = await e.streamChat({
|
|
523
523
|
model: t,
|
|
524
524
|
instructions: n,
|
|
525
525
|
input: h,
|
|
526
526
|
tools: r,
|
|
527
527
|
toolChoice: i,
|
|
528
528
|
...m ? { conversationId: m } : {},
|
|
529
|
-
onConversationId: (e) =>
|
|
529
|
+
onConversationId: (e) => $({
|
|
530
530
|
reportedId: e,
|
|
531
531
|
source: "header",
|
|
532
532
|
turn: _
|
|
533
533
|
}),
|
|
534
534
|
signal: g.signal,
|
|
535
535
|
onChunk: (e) => {
|
|
536
|
-
|
|
536
|
+
Me(g), v += e;
|
|
537
537
|
let { events: t, remainder: n, done: r } = A(v);
|
|
538
|
-
v = n,
|
|
538
|
+
v = n, k(t, r);
|
|
539
539
|
let i = Date.now();
|
|
540
|
-
|
|
540
|
+
E((e) => e && e.sentAt === s ? {
|
|
541
541
|
...e,
|
|
542
542
|
streamStats: {
|
|
543
543
|
chunkCount: e.streamStats.chunkCount + 1,
|
|
@@ -547,13 +547,13 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
547
547
|
} : e);
|
|
548
548
|
},
|
|
549
549
|
onRequestId: (e) => {
|
|
550
|
-
|
|
550
|
+
E((t) => t && t.sentAt === s ? {
|
|
551
551
|
...t,
|
|
552
552
|
requestId: e
|
|
553
553
|
} : t);
|
|
554
554
|
},
|
|
555
555
|
onMessageId: (e) => {
|
|
556
|
-
typeof e == "string" && e &&
|
|
556
|
+
typeof e == "string" && e && S((t) => t.map((t) => t.id === l ? {
|
|
557
557
|
...t,
|
|
558
558
|
serverMessageId: e
|
|
559
559
|
} : t));
|
|
@@ -561,70 +561,74 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
561
561
|
});
|
|
562
562
|
if (v.trim()) {
|
|
563
563
|
let { events: e, done: t } = A(`${v}\n\n`);
|
|
564
|
-
v = "",
|
|
564
|
+
v = "", k(e, t);
|
|
565
565
|
}
|
|
566
566
|
if (y) {
|
|
567
|
-
|
|
567
|
+
O("error"), j(y);
|
|
568
568
|
return;
|
|
569
569
|
}
|
|
570
|
-
if (d && !b) {
|
|
571
|
-
|
|
570
|
+
if (d === "timeout" && !b) {
|
|
571
|
+
D(u || "The assistant took too long to respond. Please try again.", { source: "client-timeout" });
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
if (f && !b) {
|
|
575
|
+
D("The connection was interrupted before the answer finished. Try again.");
|
|
572
576
|
return;
|
|
573
577
|
}
|
|
574
578
|
if (a === void 0 || a >= 400) {
|
|
575
|
-
|
|
579
|
+
D(se(a, o, u), {
|
|
576
580
|
httpStatus: a,
|
|
577
581
|
rawBody: o || void 0
|
|
578
582
|
});
|
|
579
583
|
return;
|
|
580
584
|
}
|
|
581
|
-
let
|
|
582
|
-
if (m && !_.signal.aborted && (
|
|
583
|
-
|
|
585
|
+
let p = _.reportedId, w = p !== m, ee = _.historyStatus === "failed" || _.historyStatus === "empty";
|
|
586
|
+
if (m && !_.signal.aborted && (w || ee)) {
|
|
587
|
+
K.current = void 0, W(void 0), z(q.current.storage, q.current.key, G), Z(), _e(!0);
|
|
584
588
|
try {
|
|
585
|
-
|
|
589
|
+
ce.current?.({
|
|
586
590
|
sentId: m,
|
|
587
|
-
...
|
|
588
|
-
reason:
|
|
591
|
+
...p ? { reportedId: p } : {},
|
|
592
|
+
reason: w ? "id" : "history"
|
|
589
593
|
});
|
|
590
594
|
} catch {}
|
|
591
595
|
}
|
|
592
|
-
if (!
|
|
593
|
-
|
|
596
|
+
if (!x) {
|
|
597
|
+
D("Bailey returned an empty response.");
|
|
594
598
|
return;
|
|
595
599
|
}
|
|
596
|
-
if (!
|
|
597
|
-
|
|
600
|
+
if (!C) {
|
|
601
|
+
D("Bailey ran some tools but didn't return an answer. Try asking again.");
|
|
598
602
|
return;
|
|
599
603
|
}
|
|
600
|
-
|
|
601
|
-
let
|
|
602
|
-
|
|
604
|
+
O("idle");
|
|
605
|
+
let M = ke.current.get(l) ?? "";
|
|
606
|
+
E((e) => e && e.sentAt === s ? {
|
|
603
607
|
...e,
|
|
604
|
-
response: { content:
|
|
608
|
+
response: { content: M }
|
|
605
609
|
} : e), c && await c({
|
|
606
610
|
id: l,
|
|
607
611
|
role: "assistant",
|
|
608
|
-
content:
|
|
612
|
+
content: M,
|
|
609
613
|
streaming: !1
|
|
610
|
-
},
|
|
614
|
+
}, T);
|
|
611
615
|
} catch (e) {
|
|
612
616
|
let t = e;
|
|
613
617
|
if (t?.name === "TimeoutError") {
|
|
614
|
-
|
|
618
|
+
D(t.message, { source: "client-timeout" });
|
|
615
619
|
return;
|
|
616
620
|
}
|
|
617
621
|
if (t?.name === "AbortError") {
|
|
618
|
-
|
|
622
|
+
O("idle");
|
|
619
623
|
return;
|
|
620
624
|
}
|
|
621
|
-
|
|
625
|
+
D(t?.message || "Bailey request failed.");
|
|
622
626
|
} finally {
|
|
623
|
-
|
|
627
|
+
je();
|
|
624
628
|
let e = ke.current.get(l) ?? "";
|
|
625
629
|
Oe.current.delete(l), ke.current.delete(l);
|
|
626
|
-
let t =
|
|
627
|
-
|
|
630
|
+
let t = T.some((e) => e.kind === "tool_start" || e.kind === "tool_end");
|
|
631
|
+
S((e) => e.flatMap((e) => e.id === l ? e.content || t ? [{
|
|
628
632
|
...e,
|
|
629
633
|
streaming: !1
|
|
630
634
|
}] : [] : [e])), Q.current = Q.current.flatMap((t) => t.id === l ? e ? [{
|
|
@@ -642,31 +646,31 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
642
646
|
o,
|
|
643
647
|
c,
|
|
644
648
|
Ne,
|
|
649
|
+
$,
|
|
645
650
|
Me,
|
|
646
651
|
je,
|
|
647
|
-
|
|
648
|
-
W,
|
|
652
|
+
G,
|
|
649
653
|
Z
|
|
650
654
|
]), Fe = a((e) => {
|
|
651
|
-
De.current = e,
|
|
655
|
+
De.current = e, S(e);
|
|
652
656
|
}, []), Ie = a((e) => {
|
|
653
657
|
let t = e.trim();
|
|
654
658
|
if (!t) return;
|
|
655
659
|
Te.current = t;
|
|
656
660
|
let n = {
|
|
657
|
-
id:
|
|
661
|
+
id: R(),
|
|
658
662
|
role: "user",
|
|
659
663
|
content: t,
|
|
660
664
|
createdAt: Date.now()
|
|
661
665
|
}, r = [...Q.current, n];
|
|
662
666
|
Q.current = r, Fe([...De.current, n]), Pe(r);
|
|
663
667
|
}, [Pe, Fe]), Le = a((e, t) => {
|
|
664
|
-
if (
|
|
668
|
+
if (D === "streaming") return;
|
|
665
669
|
let n = e.trim();
|
|
666
670
|
if (!n) return;
|
|
667
671
|
Te.current = n;
|
|
668
672
|
let r = t?.trim(), i = {
|
|
669
|
-
id:
|
|
673
|
+
id: R(),
|
|
670
674
|
role: "user",
|
|
671
675
|
content: n,
|
|
672
676
|
createdAt: Date.now(),
|
|
@@ -674,10 +678,10 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
674
678
|
...r ? { titleHint: r } : {}
|
|
675
679
|
}, a = [...Q.current, i];
|
|
676
680
|
Q.current = a, Pe(a);
|
|
677
|
-
}, [Pe,
|
|
681
|
+
}, [Pe, D]), Re = a(() => {
|
|
678
682
|
we.current?.abort();
|
|
679
683
|
}, []), ze = a(() => {
|
|
680
|
-
if (
|
|
684
|
+
if (D === "streaming" || !Te.current) return;
|
|
681
685
|
let e = De.current, t = e[e.length - 1], n = t && t.role === "assistant" ? e.slice(0, -1) : e;
|
|
682
686
|
Fe(n);
|
|
683
687
|
let r = Q.current, i = r[r.length - 1], a = i && i.role === "assistant" ? r.slice(0, -1) : r;
|
|
@@ -685,20 +689,20 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
685
689
|
}, [
|
|
686
690
|
Pe,
|
|
687
691
|
Fe,
|
|
688
|
-
|
|
689
|
-
]), Be = a(() =>
|
|
690
|
-
j(null),
|
|
692
|
+
D
|
|
693
|
+
]), Be = a(() => w([]), []), Ve = a(() => {
|
|
694
|
+
j(null), O((e) => e === "error" ? "idle" : e);
|
|
691
695
|
}, []), He = a(() => {
|
|
692
|
-
we.current?.abort(), Z(),
|
|
696
|
+
we.current?.abort(), Z(), _e(!1), Fe([]), Q.current = [], w([]), E(null), O("idle"), j(null), Te.current = "";
|
|
693
697
|
}, [Z, Fe]), Ue = a(() => {
|
|
694
|
-
He(),
|
|
695
|
-
}, [He,
|
|
698
|
+
He(), K.current = void 0, W(void 0), z(q.current.storage, q.current.key, G);
|
|
699
|
+
}, [He, G]), We = d(N);
|
|
696
700
|
s(() => {
|
|
697
701
|
let e = We.current;
|
|
698
702
|
if (e === N) return;
|
|
699
703
|
We.current = N, e !== void 0 && He();
|
|
700
|
-
let t =
|
|
701
|
-
|
|
704
|
+
let t = H(G);
|
|
705
|
+
K.current = t, W(t);
|
|
702
706
|
}, [N]);
|
|
703
707
|
let Ge = a((e) => {
|
|
704
708
|
we.current?.abort();
|
|
@@ -706,24 +710,24 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
706
710
|
...e,
|
|
707
711
|
streaming: !1
|
|
708
712
|
}));
|
|
709
|
-
Fe(t.filter((e) => !e.hidden)), Q.current = t,
|
|
713
|
+
Fe(t.filter((e) => !e.hidden)), Q.current = t, w([]), E(null), O("idle"), j(null), Te.current = "";
|
|
710
714
|
}, [Fe]), Ke = a((e) => {
|
|
711
715
|
Z(), Ge(e);
|
|
712
716
|
}, [Z, Ge]), qe = a((e) => {
|
|
713
|
-
|
|
714
|
-
}, [
|
|
717
|
+
K.current = e, W(e), ue(q.current.storage, q.current.key, e, G), _e(!1);
|
|
718
|
+
}, [G]), Je = a((e) => {
|
|
715
719
|
let t = e.hasMoreBefore && e.nextBeforeAbsoluteIndex !== null;
|
|
716
|
-
|
|
720
|
+
xe.current = t ? e.nextBeforeAbsoluteIndex : null, Y(t);
|
|
717
721
|
}, []);
|
|
718
722
|
return {
|
|
719
|
-
conversationId:
|
|
720
|
-
persistence:
|
|
721
|
-
contextLost:
|
|
722
|
-
messages:
|
|
723
|
-
traceEvents:
|
|
724
|
-
lastRequest:
|
|
725
|
-
status:
|
|
726
|
-
error:
|
|
723
|
+
conversationId: fe,
|
|
724
|
+
persistence: he,
|
|
725
|
+
contextLost: ge,
|
|
726
|
+
messages: x,
|
|
727
|
+
traceEvents: C,
|
|
728
|
+
lastRequest: T,
|
|
729
|
+
status: D,
|
|
730
|
+
error: ee,
|
|
727
731
|
send: Ie,
|
|
728
732
|
sendHidden: Le,
|
|
729
733
|
stop: Re,
|
|
@@ -733,25 +737,25 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
733
737
|
newChat: Ue,
|
|
734
738
|
loadMessages: Ke,
|
|
735
739
|
loadConversation: a(async ({ conversationId: e }) => {
|
|
736
|
-
let t = Ce.current, { sub: n } =
|
|
740
|
+
let t = Ce.current, { sub: n } = q.current, r = !!e && (!n || re({
|
|
737
741
|
conversationId: e,
|
|
738
742
|
sub: n
|
|
739
743
|
}));
|
|
740
|
-
if (!t || !r) throw
|
|
744
|
+
if (!t || !r) throw J("error"), Error(t ? "invalid conversation id" : "no client");
|
|
741
745
|
we.current?.abort(), Z();
|
|
742
|
-
let i =
|
|
743
|
-
|
|
746
|
+
let i = X.current, a = new AbortController();
|
|
747
|
+
be.current = a, J("loading");
|
|
744
748
|
try {
|
|
745
749
|
let n = await t.getConversation({
|
|
746
750
|
conversationId: e,
|
|
747
751
|
limit: oe,
|
|
748
752
|
signal: a.signal
|
|
749
753
|
});
|
|
750
|
-
if (i !==
|
|
751
|
-
Ge(te({ messages: n.messages })), qe(e), Je(n),
|
|
754
|
+
if (i !== X.current) return;
|
|
755
|
+
Ge(te({ messages: n.messages })), qe(e), Je(n), J("idle");
|
|
752
756
|
} catch (e) {
|
|
753
|
-
if (i !==
|
|
754
|
-
throw
|
|
757
|
+
if (i !== X.current) return;
|
|
758
|
+
throw J("error"), e;
|
|
755
759
|
}
|
|
756
760
|
}, [
|
|
757
761
|
Je,
|
|
@@ -760,10 +764,10 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
760
764
|
Ge
|
|
761
765
|
]),
|
|
762
766
|
loadEarlier: a(async () => {
|
|
763
|
-
let e = Ce.current, t =
|
|
767
|
+
let e = Ce.current, t = K.current, n = xe.current;
|
|
764
768
|
if (!e || !t || n === null || Se.current) return;
|
|
765
|
-
let r =
|
|
766
|
-
|
|
769
|
+
let r = X.current, i = new AbortController();
|
|
770
|
+
be.current = i, Se.current = !0, J("loading");
|
|
767
771
|
try {
|
|
768
772
|
let a = await e.getConversation({
|
|
769
773
|
conversationId: t,
|
|
@@ -771,36 +775,36 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
|
|
|
771
775
|
beforeAbsoluteIndex: n,
|
|
772
776
|
signal: i.signal
|
|
773
777
|
});
|
|
774
|
-
if (r !==
|
|
778
|
+
if (r !== X.current) return;
|
|
775
779
|
let o = te({ messages: a.messages });
|
|
776
780
|
Q.current = ne({
|
|
777
781
|
current: Q.current,
|
|
778
782
|
earlier: o
|
|
779
|
-
}),
|
|
783
|
+
}), S((e) => {
|
|
780
784
|
let t = ne({
|
|
781
785
|
current: e,
|
|
782
786
|
earlier: o
|
|
783
787
|
});
|
|
784
788
|
return De.current = t, t;
|
|
785
|
-
}), Je(a),
|
|
789
|
+
}), Je(a), J("idle");
|
|
786
790
|
} catch (e) {
|
|
787
|
-
if (r !==
|
|
788
|
-
throw
|
|
791
|
+
if (r !== X.current) return;
|
|
792
|
+
throw J("error"), e;
|
|
789
793
|
} finally {
|
|
790
|
-
r ===
|
|
794
|
+
r === X.current && (Se.current = !1);
|
|
791
795
|
}
|
|
792
796
|
}, [Je]),
|
|
793
|
-
hasEarlier:
|
|
794
|
-
historyStatus:
|
|
797
|
+
hasEarlier: ye,
|
|
798
|
+
historyStatus: ve
|
|
795
799
|
};
|
|
796
|
-
},
|
|
800
|
+
}, H = class extends Error {
|
|
797
801
|
status;
|
|
798
802
|
kind;
|
|
799
803
|
constructor(e) {
|
|
800
|
-
super(e.message ??
|
|
804
|
+
super(e.message ?? U(e), e.cause === void 0 ? void 0 : { cause: e.cause }), this.name = "BaileyApiError", this.status = e.status, this.kind = e.kind;
|
|
801
805
|
}
|
|
802
806
|
};
|
|
803
|
-
function
|
|
807
|
+
function U(e) {
|
|
804
808
|
switch (e.kind) {
|
|
805
809
|
case "http": return `Bailey request failed (status ${e.status})`;
|
|
806
810
|
case "timeout": return "Bailey request timed out";
|
|
@@ -809,16 +813,16 @@ function H(e) {
|
|
|
809
813
|
default: return "Bailey request failed (network error)";
|
|
810
814
|
}
|
|
811
815
|
}
|
|
812
|
-
var
|
|
816
|
+
var fe = class extends Error {
|
|
813
817
|
operation;
|
|
814
818
|
constructor(e) {
|
|
815
819
|
super(`Bailey cleanup failed (${e.operation})`), this.name = "BaileyCleanupError", this.operation = e.operation;
|
|
816
820
|
}
|
|
817
|
-
},
|
|
821
|
+
}, W = (e) => e instanceof H ? e : new H({
|
|
818
822
|
status: 0,
|
|
819
823
|
kind: "network"
|
|
820
824
|
});
|
|
821
|
-
function
|
|
825
|
+
function pe(e) {
|
|
822
826
|
let { pageSize: t, enabled: n = !0 } = e, [r, i] = f([]), [o, c] = f(n ? "loading" : "idle"), [l, u] = f(null), [p, m] = f(null), h = d(e.client), g = d([]);
|
|
823
827
|
s(() => {
|
|
824
828
|
h.current = e.client, g.current = r;
|
|
@@ -841,15 +845,15 @@ function me(e) {
|
|
|
841
845
|
}), _.current = r.nextCursor, m(r.nextCursor), u(null), c("idle");
|
|
842
846
|
} catch (e) {
|
|
843
847
|
if (n.signal.aborted) return;
|
|
844
|
-
u(
|
|
848
|
+
u(W(e)), c("error");
|
|
845
849
|
}
|
|
846
850
|
}, [t]);
|
|
847
851
|
s(() => {
|
|
848
852
|
if (n) return y("replace"), () => v.current?.abort();
|
|
849
853
|
}, [n, y]);
|
|
850
|
-
let b = a(() => y("replace"), [y]),
|
|
854
|
+
let b = a(() => y("replace"), [y]), x = a(async () => {
|
|
851
855
|
_.current !== null && await y("append");
|
|
852
|
-
}, [y]),
|
|
856
|
+
}, [y]), S = a(async ({ conversationId: e }) => {
|
|
853
857
|
let t = g.current.findIndex((t) => t.conversationId === e), n = t === -1 ? void 0 : {
|
|
854
858
|
row: g.current[t],
|
|
855
859
|
index: t
|
|
@@ -873,44 +877,44 @@ function me(e) {
|
|
|
873
877
|
error: l,
|
|
874
878
|
hasMore: p !== null,
|
|
875
879
|
refresh: b,
|
|
876
|
-
loadMore:
|
|
877
|
-
remove:
|
|
880
|
+
loadMore: x,
|
|
881
|
+
remove: S
|
|
878
882
|
};
|
|
879
883
|
}
|
|
880
884
|
//#endregion
|
|
881
885
|
//#region src/client/routes.ts
|
|
882
|
-
function
|
|
886
|
+
function me(e) {
|
|
883
887
|
return e.replace(/\/+$/, "");
|
|
884
888
|
}
|
|
885
|
-
function
|
|
889
|
+
function G(e, t) {
|
|
886
890
|
let n = new URLSearchParams();
|
|
887
891
|
for (let [e, r] of Object.entries(t)) r !== void 0 && n.set(e, String(r));
|
|
888
892
|
let r = n.toString();
|
|
889
893
|
return r ? `${e}?${r}` : e;
|
|
890
894
|
}
|
|
891
|
-
var
|
|
895
|
+
var K = {
|
|
892
896
|
responses(e) {
|
|
893
|
-
return `${
|
|
897
|
+
return `${me(e)}/responses`;
|
|
894
898
|
},
|
|
895
899
|
conversations(e, t) {
|
|
896
|
-
return
|
|
900
|
+
return G(`${me(e)}/conversations`, {
|
|
897
901
|
limit: t.limit,
|
|
898
902
|
cursor: t.cursor
|
|
899
903
|
});
|
|
900
904
|
},
|
|
901
905
|
conversation(e, t, n) {
|
|
902
|
-
return
|
|
906
|
+
return G(`${me(e)}/conversations/${encodeURIComponent(t)}`, {
|
|
903
907
|
limit: n.limit,
|
|
904
908
|
before_absolute_index: n.beforeAbsoluteIndex
|
|
905
909
|
});
|
|
906
910
|
},
|
|
907
911
|
feedback(e, t, n) {
|
|
908
|
-
return `${
|
|
912
|
+
return `${me(e)}/conversations/${encodeURIComponent(t)}/messages/${encodeURIComponent(n)}/feedback`;
|
|
909
913
|
}
|
|
910
914
|
};
|
|
911
915
|
//#endregion
|
|
912
916
|
//#region src/client/createBaileyClient.ts
|
|
913
|
-
function
|
|
917
|
+
function q(e) {
|
|
914
918
|
return {
|
|
915
919
|
status: void 0,
|
|
916
920
|
text: "",
|
|
@@ -919,40 +923,51 @@ function K(e) {
|
|
|
919
923
|
...e ? { errorCause: e.cause } : {}
|
|
920
924
|
};
|
|
921
925
|
}
|
|
922
|
-
var
|
|
923
|
-
function
|
|
924
|
-
let t = Y(e);
|
|
926
|
+
var he = "The assistant took too long to respond. Please try again.";
|
|
927
|
+
function ge(e) {
|
|
925
928
|
return {
|
|
926
|
-
|
|
929
|
+
status: e.status,
|
|
930
|
+
text: "",
|
|
931
|
+
errorMessage: he,
|
|
932
|
+
errorKind: "timeout",
|
|
933
|
+
errorCause: e.cause,
|
|
934
|
+
...e.status === void 0 ? {} : { interrupted: !0 }
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
var _e = 3e4, ve = 155e3, J = "x-chat-id", ye = "header", Y = "body", X = "x-request-id", be = "x-conversation-id", xe = "x-message-id", Se = (e) => e && typeof e == "object" ? e : {}, Z = (e, t = "") => typeof e == "string" ? e : t, Ce = (e, t = 0) => typeof e == "number" ? e : t;
|
|
938
|
+
function we(e) {
|
|
939
|
+
let t = Se(e);
|
|
940
|
+
return {
|
|
941
|
+
conversationId: Z(t.conversation_id),
|
|
927
942
|
title: typeof t.title == "string" ? t.title : null,
|
|
928
|
-
status:
|
|
929
|
-
messageCount:
|
|
930
|
-
createdAt:
|
|
931
|
-
updatedAt:
|
|
943
|
+
status: Z(t.status),
|
|
944
|
+
messageCount: Ce(t.message_count),
|
|
945
|
+
createdAt: Z(t.created_at),
|
|
946
|
+
updatedAt: Z(t.updated_at)
|
|
932
947
|
};
|
|
933
948
|
}
|
|
934
|
-
function
|
|
949
|
+
function Te(e) {
|
|
935
950
|
if (!e || typeof e != "object") return null;
|
|
936
|
-
let t =
|
|
951
|
+
let t = Se(e);
|
|
937
952
|
return {
|
|
938
|
-
rating:
|
|
953
|
+
rating: Z(t.rating),
|
|
939
954
|
reasonCodes: Array.isArray(t.reason_codes) ? t.reason_codes.filter((e) => typeof e == "string") : [],
|
|
940
955
|
comment: typeof t.comment == "string" ? t.comment : null,
|
|
941
956
|
...typeof t.updated_at == "string" ? { updatedAt: t.updated_at } : {}
|
|
942
957
|
};
|
|
943
958
|
}
|
|
944
|
-
function
|
|
945
|
-
let t =
|
|
959
|
+
function Ee(e) {
|
|
960
|
+
let t = Se(e);
|
|
946
961
|
return {
|
|
947
|
-
messageId:
|
|
948
|
-
role:
|
|
949
|
-
content:
|
|
962
|
+
messageId: Z(t.message_id),
|
|
963
|
+
role: Z(t.role),
|
|
964
|
+
content: Z(t.content),
|
|
950
965
|
hidden: t.hidden === !0,
|
|
951
|
-
createdAt:
|
|
952
|
-
feedback:
|
|
966
|
+
createdAt: Z(t.created_at),
|
|
967
|
+
feedback: Te(t.feedback)
|
|
953
968
|
};
|
|
954
969
|
}
|
|
955
|
-
function
|
|
970
|
+
function De(e) {
|
|
956
971
|
let t = new AbortController(), n = !1, r = setTimeout(() => {
|
|
957
972
|
n = !0, t.abort();
|
|
958
973
|
}, e.timeoutMs), i = () => t.abort(e.caller?.reason);
|
|
@@ -964,30 +979,30 @@ function Te(e) {
|
|
|
964
979
|
}
|
|
965
980
|
};
|
|
966
981
|
}
|
|
967
|
-
function
|
|
968
|
-
return e.timedOut() ? new
|
|
982
|
+
function Q(e) {
|
|
983
|
+
return e.timedOut() ? new H({
|
|
969
984
|
status: 0,
|
|
970
985
|
kind: "timeout",
|
|
971
986
|
cause: e.signal.reason
|
|
972
|
-
}) : new
|
|
987
|
+
}) : new H({
|
|
973
988
|
status: 0,
|
|
974
989
|
kind: "aborted"
|
|
975
990
|
});
|
|
976
991
|
}
|
|
977
|
-
function
|
|
978
|
-
let { baseUrl: t, getHeaders: n, onAuthError: r } = e, i = e.requestTimeoutMs ??
|
|
979
|
-
if (o !== ye && o !==
|
|
992
|
+
function Oe(e) {
|
|
993
|
+
let { baseUrl: t, getHeaders: n, onAuthError: r } = e, i = e.requestTimeoutMs ?? _e, a = e.idleTimeoutMs ?? ve, o = e.conversationVia ?? ye;
|
|
994
|
+
if (o !== ye && o !== Y) throw TypeError("createBaileyClient: conversationVia must be 'header' or 'body'");
|
|
980
995
|
let s = e.fetch ?? ((e, t) => globalThis.fetch(e, t));
|
|
981
996
|
function c(t) {
|
|
982
997
|
try {
|
|
983
|
-
e.onCleanupError?.(new
|
|
998
|
+
e.onCleanupError?.(new fe({ operation: t }));
|
|
984
999
|
} catch {}
|
|
985
1000
|
}
|
|
986
1001
|
function l(e) {
|
|
987
1002
|
e.kind === "http" && (e.status === 401 || e.status === 403) && r?.(e);
|
|
988
1003
|
}
|
|
989
1004
|
async function u(e) {
|
|
990
|
-
let t =
|
|
1005
|
+
let t = De({
|
|
991
1006
|
caller: e.signal,
|
|
992
1007
|
timeoutMs: i
|
|
993
1008
|
});
|
|
@@ -999,12 +1014,12 @@ function De(e) {
|
|
|
999
1014
|
...await n()
|
|
1000
1015
|
};
|
|
1001
1016
|
} catch {
|
|
1002
|
-
throw new
|
|
1017
|
+
throw new H({
|
|
1003
1018
|
status: 0,
|
|
1004
1019
|
kind: "network"
|
|
1005
1020
|
});
|
|
1006
1021
|
}
|
|
1007
|
-
if (t.signal.aborted) throw
|
|
1022
|
+
if (t.signal.aborted) throw Q(t);
|
|
1008
1023
|
e.body !== void 0 && (r["Content-Type"] = "application/json");
|
|
1009
1024
|
let i;
|
|
1010
1025
|
try {
|
|
@@ -1015,18 +1030,18 @@ function De(e) {
|
|
|
1015
1030
|
signal: t.signal
|
|
1016
1031
|
});
|
|
1017
1032
|
} catch (e) {
|
|
1018
|
-
throw t.signal.aborted ?
|
|
1033
|
+
throw t.signal.aborted ? Q(t) : new H({
|
|
1019
1034
|
status: 0,
|
|
1020
1035
|
kind: "network",
|
|
1021
1036
|
cause: e
|
|
1022
1037
|
});
|
|
1023
1038
|
}
|
|
1024
|
-
if (!i.ok) throw i.body?.cancel().catch(() => c("cancel-response-body")), new
|
|
1039
|
+
if (!i.ok) throw i.body?.cancel().catch(() => c("cancel-response-body")), new H({
|
|
1025
1040
|
status: i.status,
|
|
1026
1041
|
kind: "http"
|
|
1027
1042
|
});
|
|
1028
1043
|
if (i.status === 204) {
|
|
1029
|
-
if (e.requireJsonBody) throw new
|
|
1044
|
+
if (e.requireJsonBody) throw new H({
|
|
1030
1045
|
status: 204,
|
|
1031
1046
|
kind: "invalid-response"
|
|
1032
1047
|
});
|
|
@@ -1034,22 +1049,22 @@ function De(e) {
|
|
|
1034
1049
|
}
|
|
1035
1050
|
try {
|
|
1036
1051
|
let t = await i.json();
|
|
1037
|
-
if (e.requireJsonBody && (typeof t != "object" || !t || Array.isArray(t))) throw new
|
|
1052
|
+
if (e.requireJsonBody && (typeof t != "object" || !t || Array.isArray(t))) throw new H({
|
|
1038
1053
|
status: i.status,
|
|
1039
1054
|
kind: "invalid-response"
|
|
1040
1055
|
});
|
|
1041
1056
|
return t;
|
|
1042
1057
|
} catch (n) {
|
|
1043
|
-
if (n instanceof
|
|
1044
|
-
if (t.timedOut() || t.signal.aborted) throw
|
|
1045
|
-
if (e.requireJsonBody) throw new
|
|
1058
|
+
if (n instanceof H) throw n;
|
|
1059
|
+
if (t.timedOut() || t.signal.aborted) throw Q(t);
|
|
1060
|
+
if (e.requireJsonBody) throw new H({
|
|
1046
1061
|
status: i.status,
|
|
1047
1062
|
kind: "invalid-response"
|
|
1048
1063
|
});
|
|
1049
1064
|
return;
|
|
1050
1065
|
}
|
|
1051
1066
|
} catch (e) {
|
|
1052
|
-
throw e instanceof
|
|
1067
|
+
throw e instanceof H && l(e), e;
|
|
1053
1068
|
} finally {
|
|
1054
1069
|
t.dispose();
|
|
1055
1070
|
}
|
|
@@ -1058,13 +1073,19 @@ function De(e) {
|
|
|
1058
1073
|
streamChat: async (e) => {
|
|
1059
1074
|
let r = new AbortController(), i = () => r.abort(e.signal.reason);
|
|
1060
1075
|
e.signal.aborted ? i() : e.signal.addEventListener("abort", i, { once: !0 });
|
|
1061
|
-
let u, d = () => {
|
|
1076
|
+
let u, d, f = () => {
|
|
1062
1077
|
clearTimeout(u), u = setTimeout(() => {
|
|
1063
|
-
|
|
1078
|
+
d = new DOMException(he, "TimeoutError"), r.abort(d);
|
|
1064
1079
|
}, a);
|
|
1080
|
+
}, p = (t) => {
|
|
1081
|
+
if (d && !e.signal.aborted) return ge({
|
|
1082
|
+
cause: d,
|
|
1083
|
+
status: t
|
|
1084
|
+
});
|
|
1085
|
+
throw r.signal.reason;
|
|
1065
1086
|
};
|
|
1066
1087
|
try {
|
|
1067
|
-
|
|
1088
|
+
f();
|
|
1068
1089
|
let i;
|
|
1069
1090
|
try {
|
|
1070
1091
|
i = {
|
|
@@ -1072,14 +1093,14 @@ function De(e) {
|
|
|
1072
1093
|
...await n()
|
|
1073
1094
|
};
|
|
1074
1095
|
} catch {
|
|
1075
|
-
return
|
|
1096
|
+
return q();
|
|
1076
1097
|
}
|
|
1077
|
-
if (r.signal.aborted)
|
|
1078
|
-
i["Content-Type"] = "application/json", e.conversationId && o === ye && (i[
|
|
1098
|
+
if (r.signal.aborted) return p();
|
|
1099
|
+
i["Content-Type"] = "application/json", e.conversationId && o === ye && (i[J] = e.conversationId);
|
|
1079
1100
|
let a = e.input[e.input.length - 1], u = {
|
|
1080
1101
|
...a?.hidden === !0 ? { hidden: !0 } : {},
|
|
1081
1102
|
...a?.titleHint ? { title_hint: a.titleHint } : {}
|
|
1082
|
-
},
|
|
1103
|
+
}, d = {
|
|
1083
1104
|
model: e.model,
|
|
1084
1105
|
instructions: e.instructions,
|
|
1085
1106
|
input: e.input.map(({ role: e, content: t }) => ({
|
|
@@ -1089,63 +1110,62 @@ function De(e) {
|
|
|
1089
1110
|
stream: !0,
|
|
1090
1111
|
...Object.keys(u).length > 0 ? { metadata: u } : {}
|
|
1091
1112
|
};
|
|
1092
|
-
e.conversationId && o ===
|
|
1093
|
-
let
|
|
1113
|
+
e.conversationId && o === Y && (d.conversation = e.conversationId), e.tools.length > 0 && (d.tools = e.tools), e.toolChoice && (d.tool_choice = e.toolChoice);
|
|
1114
|
+
let m;
|
|
1094
1115
|
try {
|
|
1095
|
-
|
|
1116
|
+
m = await s(K.responses(t), {
|
|
1096
1117
|
method: "POST",
|
|
1097
1118
|
headers: i,
|
|
1098
|
-
body: JSON.stringify(
|
|
1119
|
+
body: JSON.stringify(d),
|
|
1099
1120
|
signal: r.signal
|
|
1100
1121
|
});
|
|
1101
1122
|
} catch (e) {
|
|
1102
|
-
|
|
1103
|
-
return K({ cause: e });
|
|
1123
|
+
return r.signal.aborted ? p() : q({ cause: e });
|
|
1104
1124
|
}
|
|
1105
|
-
let
|
|
1106
|
-
|
|
1107
|
-
let
|
|
1108
|
-
if (
|
|
1109
|
-
l(new
|
|
1110
|
-
status:
|
|
1125
|
+
let h = m.headers.get(X);
|
|
1126
|
+
h && e.onRequestId?.(h);
|
|
1127
|
+
let g = m.headers.get(xe);
|
|
1128
|
+
if (g && e.onMessageId?.(g), !m.ok) {
|
|
1129
|
+
l(new H({
|
|
1130
|
+
status: m.status,
|
|
1111
1131
|
kind: "http"
|
|
1112
1132
|
}));
|
|
1113
|
-
let e = await
|
|
1133
|
+
let e = await m.text().catch(() => "");
|
|
1114
1134
|
return {
|
|
1115
|
-
status:
|
|
1135
|
+
status: m.status,
|
|
1116
1136
|
text: e
|
|
1117
1137
|
};
|
|
1118
1138
|
}
|
|
1119
|
-
let
|
|
1120
|
-
if (
|
|
1121
|
-
status:
|
|
1139
|
+
let _ = m.headers.get(be);
|
|
1140
|
+
if (_ && e.onConversationId?.(_), !m.body) return {
|
|
1141
|
+
status: m.status,
|
|
1122
1142
|
text: ""
|
|
1123
1143
|
};
|
|
1124
|
-
let
|
|
1125
|
-
r.signal.addEventListener("abort",
|
|
1144
|
+
let v = m.body.getReader(), y = new TextDecoder(), b = () => void v.cancel(r.signal.reason).catch(() => c("cancel-stream-reader"));
|
|
1145
|
+
r.signal.addEventListener("abort", b, { once: !0 });
|
|
1126
1146
|
try {
|
|
1127
1147
|
for (;;) {
|
|
1128
|
-
let { done: t, value: n } = await
|
|
1129
|
-
if (r.signal.aborted)
|
|
1148
|
+
let { done: t, value: n } = await v.read();
|
|
1149
|
+
if (r.signal.aborted) return p(m.status);
|
|
1130
1150
|
if (t) {
|
|
1131
|
-
let t =
|
|
1151
|
+
let t = y.decode();
|
|
1132
1152
|
t && e.onChunk(t);
|
|
1133
1153
|
break;
|
|
1134
1154
|
}
|
|
1135
|
-
|
|
1155
|
+
f(), e.onChunk(y.decode(n, { stream: !0 }));
|
|
1136
1156
|
}
|
|
1137
1157
|
} catch {
|
|
1138
|
-
if (r.signal.aborted)
|
|
1158
|
+
if (r.signal.aborted) return p(m.status);
|
|
1139
1159
|
if (e.signal.aborted) throw e.signal.reason;
|
|
1140
1160
|
return {
|
|
1141
|
-
status:
|
|
1161
|
+
status: m.status,
|
|
1142
1162
|
text: "",
|
|
1143
1163
|
errorMessage: "Stream interrupted",
|
|
1144
1164
|
interrupted: !0
|
|
1145
1165
|
};
|
|
1146
1166
|
}
|
|
1147
|
-
return r.signal.removeEventListener("abort",
|
|
1148
|
-
status:
|
|
1167
|
+
return r.signal.removeEventListener("abort", b), {
|
|
1168
|
+
status: m.status,
|
|
1149
1169
|
text: ""
|
|
1150
1170
|
};
|
|
1151
1171
|
} finally {
|
|
@@ -1153,31 +1173,31 @@ function De(e) {
|
|
|
1153
1173
|
}
|
|
1154
1174
|
},
|
|
1155
1175
|
async listConversations(e = {}) {
|
|
1156
|
-
let n =
|
|
1176
|
+
let n = Se(await u({
|
|
1157
1177
|
method: "GET",
|
|
1158
|
-
url:
|
|
1178
|
+
url: K.conversations(t, e),
|
|
1159
1179
|
signal: e.signal,
|
|
1160
1180
|
requireJsonBody: !0
|
|
1161
1181
|
}));
|
|
1162
1182
|
return {
|
|
1163
|
-
conversations: Array.isArray(n.conversations) ? n.conversations.map(
|
|
1183
|
+
conversations: Array.isArray(n.conversations) ? n.conversations.map(we).filter((e) => e.conversationId !== "") : [],
|
|
1164
1184
|
nextCursor: typeof n.next_cursor == "string" ? n.next_cursor : null
|
|
1165
1185
|
};
|
|
1166
1186
|
},
|
|
1167
1187
|
async getConversation(e) {
|
|
1168
|
-
let n =
|
|
1188
|
+
let n = Se(await u({
|
|
1169
1189
|
method: "GET",
|
|
1170
|
-
url:
|
|
1190
|
+
url: K.conversation(t, e.conversationId, e),
|
|
1171
1191
|
signal: e.signal,
|
|
1172
1192
|
requireJsonBody: !0
|
|
1173
1193
|
}));
|
|
1174
|
-
if (!n.conversation || typeof n.conversation != "object") throw new
|
|
1194
|
+
if (!n.conversation || typeof n.conversation != "object") throw new H({
|
|
1175
1195
|
status: 200,
|
|
1176
1196
|
kind: "invalid-response"
|
|
1177
1197
|
});
|
|
1178
1198
|
return {
|
|
1179
|
-
conversation:
|
|
1180
|
-
messages: Array.isArray(n.messages) ? n.messages.map(
|
|
1199
|
+
conversation: we(n.conversation),
|
|
1200
|
+
messages: Array.isArray(n.messages) ? n.messages.map(Ee) : [],
|
|
1181
1201
|
hasMoreBefore: n.has_more_before === !0,
|
|
1182
1202
|
nextBeforeAbsoluteIndex: typeof n.next_before_absolute_index == "number" ? n.next_before_absolute_index : null
|
|
1183
1203
|
};
|
|
@@ -1185,14 +1205,14 @@ function De(e) {
|
|
|
1185
1205
|
async deleteConversation(e) {
|
|
1186
1206
|
await u({
|
|
1187
1207
|
method: "DELETE",
|
|
1188
|
-
url:
|
|
1208
|
+
url: K.conversation(t, e.conversationId, {}),
|
|
1189
1209
|
signal: e.signal
|
|
1190
1210
|
});
|
|
1191
1211
|
},
|
|
1192
1212
|
async submitFeedback(e) {
|
|
1193
1213
|
await u({
|
|
1194
1214
|
method: "PUT",
|
|
1195
|
-
url:
|
|
1215
|
+
url: K.feedback(t, e.conversationId, e.messageId),
|
|
1196
1216
|
body: {
|
|
1197
1217
|
rating: e.rating,
|
|
1198
1218
|
...e.reasonCodes ? { reason_codes: e.reasonCodes } : {},
|
|
@@ -1204,7 +1224,7 @@ function De(e) {
|
|
|
1204
1224
|
async clearFeedback(e) {
|
|
1205
1225
|
await u({
|
|
1206
1226
|
method: "DELETE",
|
|
1207
|
-
url:
|
|
1227
|
+
url: K.feedback(t, e.conversationId, e.messageId),
|
|
1208
1228
|
signal: e.signal
|
|
1209
1229
|
});
|
|
1210
1230
|
}
|
|
@@ -1212,7 +1232,7 @@ function De(e) {
|
|
|
1212
1232
|
}
|
|
1213
1233
|
//#endregion
|
|
1214
1234
|
//#region src/client/feedbackHandlers.ts
|
|
1215
|
-
function
|
|
1235
|
+
function ke(e) {
|
|
1216
1236
|
let { client: t, getConversationId: n } = e, r = () => {
|
|
1217
1237
|
let e = n();
|
|
1218
1238
|
if (!e) throw Error("no conversation id");
|
|
@@ -1240,15 +1260,15 @@ function Q(e) {
|
|
|
1240
1260
|
}
|
|
1241
1261
|
//#endregion
|
|
1242
1262
|
//#region src/utils/prompt.ts
|
|
1243
|
-
function
|
|
1263
|
+
function Ae(...e) {
|
|
1244
1264
|
return e.filter((e) => !!(e && e.trim())).join("\n\n");
|
|
1245
1265
|
}
|
|
1246
1266
|
//#endregion
|
|
1247
1267
|
//#region src/utils/toolCalls.ts
|
|
1248
|
-
var
|
|
1268
|
+
var je = "call_tool", Me = "a tool";
|
|
1249
1269
|
function $(e, t) {
|
|
1250
1270
|
let n = {
|
|
1251
|
-
name: e ===
|
|
1271
|
+
name: e === je ? Me : e,
|
|
1252
1272
|
args: null,
|
|
1253
1273
|
viaCallTool: !1
|
|
1254
1274
|
};
|
|
@@ -1261,7 +1281,7 @@ function $(e, t) {
|
|
|
1261
1281
|
}
|
|
1262
1282
|
if (typeof r != "object" || !r) return n;
|
|
1263
1283
|
let i = r;
|
|
1264
|
-
if (e ===
|
|
1284
|
+
if (e === je) {
|
|
1265
1285
|
let e = typeof i.name == "string" ? i.name : void 0;
|
|
1266
1286
|
if (!e) return n;
|
|
1267
1287
|
let t = i.arguments;
|
|
@@ -1279,32 +1299,32 @@ function $(e, t) {
|
|
|
1279
1299
|
}
|
|
1280
1300
|
//#endregion
|
|
1281
1301
|
//#region src/utils/table.ts
|
|
1282
|
-
var
|
|
1302
|
+
var Ne = 5, Pe = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(Pe).join(""), Fe = (e) => {
|
|
1283
1303
|
if (e.tagName === "a" && e.properties?.href) return e.properties.href;
|
|
1284
1304
|
for (let t of e.children ?? []) {
|
|
1285
|
-
let e =
|
|
1305
|
+
let e = Fe(t);
|
|
1286
1306
|
if (e) return e;
|
|
1287
1307
|
}
|
|
1288
|
-
},
|
|
1289
|
-
let t =
|
|
1308
|
+
}, Ie = (e, t) => (e.children ?? []).find((e) => e.tagName === t), Le = (e) => {
|
|
1309
|
+
let t = Pe(e), n = Fe(e);
|
|
1290
1310
|
return n ? {
|
|
1291
1311
|
text: t,
|
|
1292
1312
|
href: n
|
|
1293
1313
|
} : { text: t };
|
|
1294
|
-
},
|
|
1314
|
+
}, Re = (e) => (e.children ?? []).filter((e) => e.type === "element").map(Le), ze = (e) => {
|
|
1295
1315
|
if (e.tagName !== "table") return null;
|
|
1296
|
-
let t =
|
|
1316
|
+
let t = Ie(e, "thead"), n = t && Ie(t, "tr");
|
|
1297
1317
|
return {
|
|
1298
|
-
headers: n ?
|
|
1299
|
-
rows: (
|
|
1318
|
+
headers: n ? Re(n).map((e) => e.text) : [],
|
|
1319
|
+
rows: (Ie(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(Re)
|
|
1300
1320
|
};
|
|
1301
|
-
},
|
|
1321
|
+
}, Be = (e) => e.length > 5, Ve = "When a chart would help answer a question (e.g. plotting a trend over time), include a fenced code block tagged `chartjs` containing a JSON object with this exact shape: {\"type\": \"bar\" | \"line\" | \"pie\" | \"doughnut\" | \"scatter\", \"title\"?: string, \"data\": {\"labels\": string[], \"datasets\": [{\"label\": string, \"data\": number[]}]}}. For \"scatter\" charts, omit \"labels\" and give each dataset \"data\" as an array of {\"x\": number, \"y\": number} points instead of a number array. \"pie\" and \"doughnut\" charts must have exactly one dataset. Do not include any other fields (no \"options\", no colors) — the app handles styling. Example:\n```chartjs\n{\"type\": \"line\", \"title\": \"BP readings\", \"data\": {\"labels\": [\"Jul 14\", \"Jul 21\", \"Jul 28\"], \"datasets\": [{\"label\": \"Systolic\", \"data\": [120, 118, 122]}]}}\n```", He = [
|
|
1302
1322
|
"bar",
|
|
1303
1323
|
"line",
|
|
1304
1324
|
"pie",
|
|
1305
1325
|
"doughnut",
|
|
1306
1326
|
"scatter"
|
|
1307
|
-
],
|
|
1327
|
+
], Ue = 8, We = 50, Ge = 8, Ke = 500, qe = (e) => typeof e == "object" && !!e && typeof e.x == "number" && typeof e.y == "number", Je = (e) => {
|
|
1308
1328
|
let t;
|
|
1309
1329
|
try {
|
|
1310
1330
|
t = JSON.parse(e);
|
|
@@ -1313,17 +1333,17 @@ var je = 5, Me = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
|
|
|
1313
1333
|
}
|
|
1314
1334
|
if (typeof t != "object" || !t) return null;
|
|
1315
1335
|
let n = t;
|
|
1316
|
-
if (typeof n.type != "string" || !
|
|
1336
|
+
if (typeof n.type != "string" || !He.includes(n.type)) return null;
|
|
1317
1337
|
let r = n.type;
|
|
1318
1338
|
if (n.title !== void 0 && typeof n.title != "string") return null;
|
|
1319
1339
|
let i = n.title;
|
|
1320
1340
|
if (typeof n.data != "object" || n.data === null) return null;
|
|
1321
1341
|
let a = n.data;
|
|
1322
|
-
if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length >
|
|
1342
|
+
if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length > Ue || (r === "pie" || r === "doughnut") && a.datasets.length !== 1) return null;
|
|
1323
1343
|
for (let e of a.datasets) if (typeof e != "object" || !e || typeof e.label != "string" || !Array.isArray(e.data)) return null;
|
|
1324
1344
|
let o = a.datasets;
|
|
1325
1345
|
if (r === "scatter") {
|
|
1326
|
-
for (let e of o) if (e.data.length < 1 || e.data.length >
|
|
1346
|
+
for (let e of o) if (e.data.length < 1 || e.data.length > Ke || !e.data.every(qe)) return null;
|
|
1327
1347
|
return {
|
|
1328
1348
|
type: r,
|
|
1329
1349
|
title: i,
|
|
@@ -1331,7 +1351,7 @@ var je = 5, Me = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
|
|
|
1331
1351
|
};
|
|
1332
1352
|
}
|
|
1333
1353
|
if (!Array.isArray(a.labels) || !a.labels.every((e) => typeof e == "string")) return null;
|
|
1334
|
-
let s = a.labels, c = r === "pie" || r === "doughnut" ?
|
|
1354
|
+
let s = a.labels, c = r === "pie" || r === "doughnut" ? Ge : We;
|
|
1335
1355
|
if (s.length < 1 || s.length > c) return null;
|
|
1336
1356
|
for (let e of o) if (e.data.length !== s.length || !e.data.every((e) => typeof e == "number")) return null;
|
|
1337
1357
|
return {
|
|
@@ -1342,7 +1362,7 @@ var je = 5, Me = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
|
|
|
1342
1362
|
datasets: o
|
|
1343
1363
|
}
|
|
1344
1364
|
};
|
|
1345
|
-
},
|
|
1365
|
+
}, Ye = {
|
|
1346
1366
|
tool_start: "Tool start",
|
|
1347
1367
|
tool_end: "Tool end",
|
|
1348
1368
|
pseudo_tool_call: "Narrated tool call",
|
|
@@ -1353,13 +1373,13 @@ var je = 5, Me = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
|
|
|
1353
1373
|
error: "Error",
|
|
1354
1374
|
raw: "Raw event"
|
|
1355
1375
|
};
|
|
1356
|
-
function
|
|
1376
|
+
function Xe(e) {
|
|
1357
1377
|
return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : $(e.name, e.args);
|
|
1358
1378
|
}
|
|
1359
|
-
function
|
|
1379
|
+
function Ze(e, t = Xe(e)) {
|
|
1360
1380
|
return e.kind === "pseudo_tool_call" ? e.name : t?.name ?? null;
|
|
1361
1381
|
}
|
|
1362
|
-
function
|
|
1382
|
+
function Qe(e, t = Xe(e)) {
|
|
1363
1383
|
switch (e.kind) {
|
|
1364
1384
|
case "tool_start": return t.viaCallTool ? `${t.name} (via call_tool)` : t.name;
|
|
1365
1385
|
case "tool_end": return `${t.viaCallTool ? `${t.name} (via call_tool)` : t.name}${e.runtimeSeconds === void 0 ? "" : ` — ${e.runtimeSeconds.toFixed(2)}s`}${e.isError ? " — failed" : ""}`;
|
|
@@ -1372,19 +1392,19 @@ function Xe(e, t = Je(e)) {
|
|
|
1372
1392
|
case "raw": return `Unrecognized event: ${e.eventType}`;
|
|
1373
1393
|
}
|
|
1374
1394
|
}
|
|
1375
|
-
function
|
|
1395
|
+
function $e(e, t = Xe(e)) {
|
|
1376
1396
|
return e.kind === "tool_start" || e.kind === "tool_end" ? t.args ? JSON.stringify(t.args, null, 2) : e.args ?? null : e.kind === "pseudo_tool_call" ? e.args ?? null : e.kind === "llm_call_start" ? JSON.stringify(e.request, null, 2) : null;
|
|
1377
1397
|
}
|
|
1378
|
-
function
|
|
1398
|
+
function et(e) {
|
|
1379
1399
|
return e.kind === "tool_end" ? e.output ?? null : e.kind === "llm_call_end" ? e.response ?? null : null;
|
|
1380
1400
|
}
|
|
1381
|
-
function
|
|
1401
|
+
function tt(e) {
|
|
1382
1402
|
return e.kind === "tool_end" && e.structuredOutput ? JSON.stringify(e.structuredOutput, null, 2) : null;
|
|
1383
1403
|
}
|
|
1384
|
-
function
|
|
1404
|
+
function nt(e) {
|
|
1385
1405
|
return e.kind === "raw" ? e.raw : e.kind === "error" ? e.rawBody ?? null : null;
|
|
1386
1406
|
}
|
|
1387
|
-
function
|
|
1407
|
+
function rt(e) {
|
|
1388
1408
|
switch (e.kind) {
|
|
1389
1409
|
case "tool_start": return `Calling ${$(e.name, e.args).name}...`;
|
|
1390
1410
|
case "tool_end": {
|
|
@@ -1400,11 +1420,11 @@ function tt(e) {
|
|
|
1400
1420
|
case "raw": return `Unrecognized event: ${e.eventType}`;
|
|
1401
1421
|
}
|
|
1402
1422
|
}
|
|
1403
|
-
function
|
|
1423
|
+
function it(e) {
|
|
1404
1424
|
let t = new Date(e);
|
|
1405
1425
|
return `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}:${String(t.getSeconds()).padStart(2, "0")}.${String(t.getMilliseconds()).padStart(3, "0")}`;
|
|
1406
1426
|
}
|
|
1407
|
-
function
|
|
1427
|
+
function at(e) {
|
|
1408
1428
|
if (e <= 0) return "+0ms";
|
|
1409
1429
|
if (e < 1e3) return `+${Math.round(e)}ms`;
|
|
1410
1430
|
let t = e / 1e3;
|
|
@@ -1412,31 +1432,31 @@ function rt(e) {
|
|
|
1412
1432
|
let n = Math.floor(t / 60), r = Math.round(t % 60);
|
|
1413
1433
|
return `+${n}m${String(r).padStart(2, "0")}s`;
|
|
1414
1434
|
}
|
|
1415
|
-
function
|
|
1435
|
+
function ot(e) {
|
|
1416
1436
|
return e.map((t, n) => {
|
|
1417
|
-
let r =
|
|
1437
|
+
let r = Xe(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
|
|
1418
1438
|
return {
|
|
1419
1439
|
key: `${t.at}-${n}`,
|
|
1420
1440
|
kind: t.kind,
|
|
1421
|
-
toolName:
|
|
1441
|
+
toolName: Ze(t, r),
|
|
1422
1442
|
isToolStart: t.kind === "tool_start",
|
|
1423
1443
|
failed: t.kind === "tool_end" && t.isError === !0,
|
|
1424
|
-
time:
|
|
1444
|
+
time: it(t.at),
|
|
1425
1445
|
gapMs: t.at - i,
|
|
1426
|
-
label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" :
|
|
1427
|
-
summary:
|
|
1428
|
-
argsDetail:
|
|
1429
|
-
outputDetail:
|
|
1430
|
-
structuredOutputDetail:
|
|
1431
|
-
rawDetail:
|
|
1446
|
+
label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" : Ye[t.kind],
|
|
1447
|
+
summary: Qe(t, r),
|
|
1448
|
+
argsDetail: $e(t, r),
|
|
1449
|
+
outputDetail: et(t),
|
|
1450
|
+
structuredOutputDetail: tt(t),
|
|
1451
|
+
rawDetail: nt(t)
|
|
1432
1452
|
};
|
|
1433
1453
|
});
|
|
1434
1454
|
}
|
|
1435
|
-
function
|
|
1455
|
+
function st(e) {
|
|
1436
1456
|
let t = e.filter((e) => e.kind === "tool_end"), n = t.filter((e) => e.kind === "tool_end" && e.isError), r = e.filter((e) => e.kind === "llm_call_end"), i = e.filter((e) => e.kind === "error"), a = [];
|
|
1437
1457
|
return r.length > 0 && a.push(`${r.length} LLM call${r.length === 1 ? "" : "s"}`), t.length > 0 && a.push(`${t.length} tool call${t.length === 1 ? "" : "s"}` + (n.length > 0 ? `, ${n.length} failed` : "")), i.length > 0 && a.push(`${i.length} stream error${i.length === 1 ? "" : "s"}`), a.join(" · ");
|
|
1438
1458
|
}
|
|
1439
|
-
function
|
|
1459
|
+
function ct(e) {
|
|
1440
1460
|
let t = [];
|
|
1441
1461
|
for (let n of e) {
|
|
1442
1462
|
let e = t[t.length - 1];
|
|
@@ -1455,17 +1475,17 @@ function ot(e) {
|
|
|
1455
1475
|
}
|
|
1456
1476
|
return t;
|
|
1457
1477
|
}
|
|
1458
|
-
function
|
|
1478
|
+
function lt(e) {
|
|
1459
1479
|
return e.some((e) => e.kind === "tool_end" && e.isError || e.kind === "error");
|
|
1460
1480
|
}
|
|
1461
|
-
function
|
|
1481
|
+
function ut(e, t) {
|
|
1462
1482
|
return t === void 0 ? [] : e.filter((e) => e.turnSentAt === t && (e.kind === "tool_end" || e.kind === "pseudo_tool_call" || e.kind === "progress")).map((e, t) => ({
|
|
1463
1483
|
key: `${e.at}-${t}`,
|
|
1464
|
-
text:
|
|
1465
|
-
toolName:
|
|
1484
|
+
text: rt(e),
|
|
1485
|
+
toolName: Ze(e)
|
|
1466
1486
|
}));
|
|
1467
1487
|
}
|
|
1468
|
-
function
|
|
1488
|
+
function dt(e, t) {
|
|
1469
1489
|
if (t === void 0) return [];
|
|
1470
1490
|
let n = [];
|
|
1471
1491
|
for (let r of e) if (r.turnSentAt === t) {
|
|
@@ -1494,45 +1514,45 @@ function lt(e, t) {
|
|
|
1494
1514
|
}
|
|
1495
1515
|
//#endregion
|
|
1496
1516
|
//#region src/styles.css?inline
|
|
1497
|
-
var ut = "/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-border-style:solid;--tw-leading:initial;--tw-space-y-reverse:0;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:\"Inter\", -apple-system, \"Segoe UI\", Roboto, Arial, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-green-100:oklch(96.2% .044 156.743);--color-green-700:oklch(52.7% .154 150.069);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-700:oklch(48.8% .243 264.376);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-700:oklch(49.6% .265 301.924);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--color-bailey-accent:#4f46e5;--color-bailey-bubble-bg:#fff;--color-bailey-error:#d32f2f;--color-bailey-border:#e5e5e5;--color-bailey-surface:#fff;--color-bailey-surface-muted:#f9fafb;--color-bailey-text:#000;--color-bailey-text-secondary:#6b6b6b;--color-bailey-tooltip-bg:#000;--color-bailey-tooltip-text:#fff;--color-bailey-page-bg:#eceef4;--color-bailey-heart:#16a34a}}@layer utilities;.bailey-chat-panel{box-sizing:border-box;background-color:var(--color-bailey-page-bg);height:100%;padding:calc(var(--spacing) * 3);font-family:var(--font-sans);flex-direction:column;display:flex;position:relative}.bailey-chat-panel-inner{width:100%;min-height:0;max-width:var(--container-3xl);gap:calc(var(--spacing) * 2);flex-direction:column;flex:1;margin-inline:auto;display:flex;overflow-y:auto}.bailey-chat-transcript{min-height:0;padding:calc(var(--spacing) * 2);padding-bottom:calc(var(--spacing) * 4);flex:1;overflow-y:auto}.bailey-message-row{margin-bottom:calc(var(--spacing) * 3);justify-content:flex-start;display:flex}.bailey-message-row-user{justify-content:flex-end}.bailey-user-message{flex-direction:column;align-items:flex-end;max-width:75%;display:flex}.bailey-message-meta{margin-bottom:var(--spacing);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-message-meta-name{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-bailey-text)}.bailey-user-bubble{border-radius:var(--radius-2xl);background-color:var(--color-bailey-bubble-bg);max-width:100%;padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);white-space:pre-wrap;color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.bailey-assistant-message{width:100%;padding-inline:var(--spacing)}.bailey-tool-result-image{margin-top:calc(var(--spacing) * 2);border-radius:var(--radius-lg);max-width:100%;height:auto;display:block}.bailey-mcp-app-frame{margin-top:calc(var(--spacing) * 2);border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:0;width:100%;height:480px;display:block}.bailey-thinking-hint{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);font-style:italic}.bailey-streaming-hint{margin-top:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);font-style:italic;display:block}.bailey-message-actions{margin-top:var(--spacing);align-items:center;gap:var(--spacing);flex-wrap:wrap;display:flex}.bailey-empty-state{text-align:center;height:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);justify-content:center;align-items:center;display:flex}.bailey-suggestions{gap:calc(var(--spacing) * 3);padding:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-suggestions-title{padding-inline:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text)}.bailey-suggestion-card{cursor:pointer;appearance:none;justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-2xl);--tw-border-style:none;background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);text-align:left;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-style:none;display:flex}@media (hover:hover){.bailey-suggestion-card:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.bailey-suggestion-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-text-secondary);flex-shrink:0}.bailey-privacy-note{border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 4);padding-top:calc(var(--spacing) * 3);padding-bottom:var(--spacing);text-align:center;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-privacy-note a{color:var(--color-bailey-text-secondary);text-decoration-line:underline}.bailey-tool-steps-live{margin-top:calc(var(--spacing) * 2);gap:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-activity-line{align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-activity-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-accent);flex-shrink:0}.bailey-step-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent);border-radius:2147483647px;flex-shrink:0}@media (prefers-reduced-motion:no-preference){.bailey-step-spinner{animation:var(--animate-spin)}}.bailey-tool-steps-summary{margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary)}.bailey-tool-steps-summary>summary{cursor:pointer;-webkit-user-select:none;user-select:none}.bailey-tool-steps-list{margin:0;margin-top:var(--spacing);gap:var(--spacing);flex-direction:column;padding:0;list-style-type:none;display:flex}.bailey-tool-step{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-tool-step-failed{color:var(--color-bailey-error)}.bailey-error-banner{margin-bottom:calc(var(--spacing) * 2);justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-error);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);color:var(--color-bailey-error);display:flex}.bailey-retry-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-error-actions{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-dismiss-button{cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-error);background-color:#0000;border-style:none}@media (hover:hover){.bailey-dismiss-button:hover{opacity:.7}}.bailey-input-area{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-input-row{align-items:center;gap:calc(var(--spacing) * 2);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);min-width:0;padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex:1;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input{--tw-border-style:none;min-width:0;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;background-color:#0000;border-style:none;outline-style:none;flex:1}.bailey-input:disabled{opacity:.5}.bailey-send-button,.bailey-stop-button{cursor:pointer;appearance:none;background-color:#0000;border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}:is(.bailey-send-button,.bailey-stop-button):disabled{cursor:default;opacity:.4}.bailey-send-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-heart);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:#16a34a1a}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:color-mix(in oklab, var(--color-bailey-heart) 10%, transparent)}}}.bailey-send-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-stop-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-error);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:#d32f2f1a}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:color-mix(in oklab, var(--color-bailey-error) 10%, transparent)}}}.bailey-stop-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-copy-button{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-copy-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-copy-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-copy-button:hover{color:var(--color-bailey-text)}}.bailey-copy-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-tooltip-content{padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));background-color:var(--color-bailey-tooltip-bg,#000);color:var(--color-bailey-tooltip-text,#fff);border-radius:.25rem}.bailey-menu-button{height:calc(var(--spacing) * 13);width:calc(var(--spacing) * 13);cursor:pointer;appearance:none;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-menu-button:hover{background-color:var(--color-gray-50)}}.bailey-menu-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-menu-content{z-index:50;min-width:calc(var(--spacing) * 44);border-radius:var(--radius-2xl);background-color:var(--color-white);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-black);--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);font-family:var(--font-sans,\"Inter\", -apple-system, \"Segoe UI\", Roboto, Arial, sans-serif)}.bailey-menu-item{cursor:pointer;align-items:center;gap:calc(var(--spacing) * 3);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;outline-style:none;display:flex}.bailey-menu-item[data-highlighted]{background-color:var(--color-gray-100)}.bailey-menu-item-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-gray-600)}.bailey-tooltip-arrow{fill:var(--color-bailey-tooltip-bg,#000)}.bailey-markdown-content table{border-collapse:collapse;width:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.bailey-markdown-content th{background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);text-align:left;--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content td{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);vertical-align:top}.bailey-markdown-content tr:nth-child(2n){background-color:var(--color-bailey-surface-muted)}.bailey-markdown-content{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.bailey-markdown-content>:first-child{margin-top:0}.bailey-markdown-content>:last-child{margin-bottom:0}.bailey-markdown-content p{margin-block:calc(var(--spacing) * 2)}.bailey-markdown-content h1{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h2{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h3{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h4,.bailey-markdown-content h5,.bailey-markdown-content h6{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content ul{margin-block:calc(var(--spacing) * 2);list-style-type:disc}:where(.bailey-markdown-content ul>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ul{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content ol{margin-block:calc(var(--spacing) * 2);list-style-type:decimal}:where(.bailey-markdown-content ol>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ol{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content a{color:var(--color-bailey-accent);text-underline-offset:2px;text-decoration-line:underline}.bailey-markdown-content code{background-color:var(--color-bailey-surface-muted);padding-inline:var(--spacing);padding-block:calc(var(--spacing) * .5);font-family:var(--font-mono);border-radius:.25rem;font-size:.85em}.bailey-markdown-content pre{margin-block:calc(var(--spacing) * 2);border-radius:var(--radius-md);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 2);overflow-x:auto}.bailey-markdown-content pre code{background-color:#0000;padding:0}.bailey-markdown-content blockquote{margin-block:calc(var(--spacing) * 2);border-left-style:var(--tw-border-style);border-left-width:2px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 3);color:var(--color-bailey-text-secondary);font-style:italic}.bailey-markdown-content hr{margin-block:calc(var(--spacing) * 3);border-color:var(--color-bailey-border)}.bailey-trace-panel{margin-bottom:calc(var(--spacing) * 2)}.bailey-trace-toggle-row{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-trace-toggle{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-trace-toggle:hover{text-decoration-line:underline}}.bailey-trace-toggle-error{color:var(--color-bailey-error)}.bailey-trace-summary{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-trace-summary-error{color:var(--color-bailey-error)}.bailey-trace-body{margin-top:var(--spacing);max-height:calc(var(--spacing) * 80);overflow-y:auto}.bailey-trace-actions-row{justify-content:flex-end;gap:calc(var(--spacing) * 3);display:flex}.bailey-trace-copy-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}@media (hover:hover){.bailey-trace-copy-button:hover{text-decoration-line:none}}.bailey-trace-request-details{margin-bottom:var(--spacing);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding:calc(var(--spacing) * 2)}.bailey-trace-request-meta{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:block}.bailey-trace-rows{gap:var(--spacing);flex-direction:column;display:flex}.bailey-trace-row{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-row-header{align-items:center;gap:calc(var(--spacing) * 2);flex-wrap:wrap;display:flex}.bailey-trace-row-time{color:var(--color-bailey-text-secondary)}.bailey-trace-row-gap{color:var(--color-gray-400)}.bailey-trace-row-summary{word-break:break-all}.bailey-trace-chip{padding-inline:calc(var(--spacing) * 1.5);padding-block:calc(var(--spacing) * .5);--tw-font-weight:var(--font-weight-semibold);font-size:.65rem;font-weight:var(--font-weight-semibold);border-radius:.25rem}.bailey-trace-chip-default{background-color:var(--color-gray-200);color:var(--color-gray-700)}.bailey-trace-chip-info{background-color:var(--color-blue-100);color:var(--color-blue-700)}.bailey-trace-chip-success{background-color:var(--color-green-100);color:var(--color-green-700)}.bailey-trace-chip-secondary{background-color:var(--color-purple-100);color:var(--color-purple-700)}.bailey-trace-chip-error{background-color:var(--color-red-100);color:var(--color-bailey-error)}.bailey-trace-disclosure{margin-top:var(--spacing)}.bailey-trace-disclosure-summary{cursor:pointer;color:var(--color-bailey-text-secondary);font-size:.7rem}.bailey-trace-disclosure-actions{margin-top:var(--spacing);justify-content:flex-end;display:flex}.bailey-trace-disclosure-content{margin-top:var(--spacing);max-height:calc(var(--spacing) * 48);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 1.5);word-break:break-all;white-space:pre-wrap;border-radius:.25rem;font-size:.7rem;overflow:auto}.bailey-trace-group{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing)}.bailey-trace-group-summary{cursor:pointer;font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-group-failed{margin-left:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-feedback{align-items:center;gap:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);flex-wrap:wrap;display:flex}.bailey-message-actions>.bailey-feedback{display:contents}.bailey-feedback-thumbs{margin-left:var(--spacing);align-items:center;gap:calc(var(--spacing) * .5);border-left-style:var(--tw-border-style);border-left-width:1px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 2);display:flex}.bailey-feedback-thumb{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;border-radius:var(--radius-lg);--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-feedback-thumb:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-thumb:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-feedback-thumb:hover{color:var(--color-bailey-text)}}.bailey-feedback-thumb:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-thumb:disabled{cursor:default;opacity:.5}.bailey-feedback-thumb[aria-pressed=true]{background-color:#4f46e51a}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-thumb[aria-pressed=true]{background-color:color-mix(in oklab, var(--color-bailey-accent) 10%, transparent)}}.bailey-feedback-thumb[aria-pressed=true]{color:var(--color-bailey-accent)}.bailey-feedback-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-feedback-status{align-items:center;gap:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:inline-flex}.bailey-feedback-status:empty{display:none}.bailey-feedback-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);animation:var(--animate-spin);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent);border-radius:2147483647px;display:inline-block}.bailey-feedback-link{cursor:pointer;appearance:none;--tw-border-style:none;padding-inline:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-feedback-link:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-error{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-feedback-form{margin-top:calc(var(--spacing) * 2);box-sizing:border-box;border-radius:var(--radius-xl);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);width:100%;padding:calc(var(--spacing) * 3);flex-basis:100%}.bailey-feedback-reasons{margin:0;margin-bottom:calc(var(--spacing) * 2);--tw-border-style:none;border-style:none;min-width:0;padding:0}.bailey-feedback-legend{margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text);padding:0;display:block}.bailey-feedback-chips{gap:calc(var(--spacing) * 1.5);flex-wrap:wrap;display:flex}.bailey-feedback-chip{cursor:pointer;appearance:none;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text);border-radius:2147483647px}.bailey-feedback-chip:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-chip:disabled{cursor:default;opacity:.5}.bailey-feedback-chip[aria-pressed=true]{border-color:var(--color-bailey-accent);background-color:#4f46e51a}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-chip[aria-pressed=true]{background-color:color-mix(in oklab, var(--color-bailey-accent) 10%, transparent)}}.bailey-feedback-chip[aria-pressed=true]{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-accent)}.bailey-feedback-textarea{box-sizing:border-box;min-height:calc(var(--spacing) * 18);resize:vertical;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);width:100%;padding-inline:calc(var(--spacing) * 2.5);padding-block:calc(var(--spacing) * 2);font-family:var(--font-sans);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);display:block}.bailey-feedback-textarea:disabled{opacity:.5}.bailey-feedback-meta{margin-top:calc(var(--spacing) * 1.5);justify-content:space-between;align-items:flex-start;gap:calc(var(--spacing) * 3);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-feedback-buttons{margin-top:calc(var(--spacing) * 2.5);justify-content:flex-end;gap:calc(var(--spacing) * 2);display:flex}.bailey-feedback-button{cursor:pointer;appearance:none;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3.5);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-feedback-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-button:disabled{cursor:default;opacity:.5}.bailey-feedback-button-primary{border-color:var(--color-bailey-accent);background-color:var(--color-bailey-accent);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-load-earlier{align-items:center;gap:var(--spacing);padding-bottom:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-load-earlier-button{cursor:pointer;appearance:none;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3.5);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-load-earlier-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-load-earlier-button:disabled{cursor:default;opacity:.5}.bailey-load-earlier-error{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-history-drawer{z-index:10;background-color:var(--color-bailey-surface);font-family:var(--font-sans);color:var(--color-bailey-text);border-radius:14px;flex-direction:column;display:flex;position:absolute;inset:0;overflow:hidden;container-type:inline-size}.bailey-history-header{align-items:center;gap:calc(var(--spacing) * 2);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);display:flex}.bailey-history-heading{text-overflow:ellipsis;white-space:nowrap;--tw-font-weight:var(--font-weight-semibold);min-width:0;font-size:15px;font-weight:var(--font-weight-semibold);--tw-outline-style:none;outline-style:none;flex:1;margin:0;overflow:hidden}.bailey-history-icon-button{height:calc(var(--spacing) * 11);width:calc(var(--spacing) * 11);cursor:pointer;appearance:none;border-radius:var(--radius-lg);--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;flex:none;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-history-icon-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-history-icon-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-history-icon-button:hover{color:var(--color-bailey-text)}}.bailey-history-icon-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-icon-button:disabled{cursor:default;opacity:.5}.bailey-history-icon{width:18px;height:18px}.bailey-history-icon-small{height:calc(var(--spacing) * 3.5);width:calc(var(--spacing) * 3.5);flex:none}.bailey-history-button{min-height:calc(var(--spacing) * 11);cursor:pointer;appearance:none;justify-content:center;align-items:center;gap:calc(var(--spacing) * 1.5);border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 1.5);white-space:nowrap;color:var(--color-bailey-text);font-size:13px;display:inline-flex}.bailey-history-button:focus-visible{outline-style:var(--tw-outline-style);outline-offset:2px;outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-button:disabled{cursor:default;opacity:.5}.bailey-history-button-primary{border-color:var(--color-bailey-accent);background-color:var(--color-bailey-accent);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-history-button-danger{border-color:var(--color-bailey-error);background-color:var(--color-bailey-error);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-history-button-small{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-history-body{padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);flex:1;overflow-y:auto}.bailey-history-list{margin:0;padding:0;list-style-type:none}.bailey-history-row{border-radius:10px;flex-wrap:wrap;align-items:center;display:flex;position:relative}.bailey-history-row+.bailey-history-row{margin-top:calc(var(--spacing) * .5)}.bailey-history-row:not(.bailey-history-row-active):hover{background-color:var(--color-gray-100)}.bailey-history-row-active{box-shadow:inset 3px 0 0 var(--color-bailey-accent,#4f46e5);background-color:#4f46e514}.bailey-history-select{min-height:calc(var(--spacing) * 11);cursor:pointer;appearance:none;gap:calc(var(--spacing) * .5);--tw-border-style:none;min-width:0;padding-block:calc(var(--spacing) * 2.5);padding-right:calc(var(--spacing) * 2.5);padding-left:calc(var(--spacing) * 3);text-align:left;color:var(--color-bailey-text);background-color:#0000;border-style:none;border-radius:10px;flex-direction:column;flex:1;font-family:inherit;display:flex}.bailey-history-select:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-select:disabled{cursor:default;opacity:.6}.bailey-history-row-title{text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);overflow:hidden}.bailey-history-meta{align-items:center;gap:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-history-meta>span+.bailey-history-count:before{content:\"·\";margin-right:.375rem}.bailey-history-current{--tw-font-weight:var(--font-weight-semibold);font-size:11px;font-weight:var(--font-weight-semibold);color:var(--color-bailey-accent)}.bailey-history-delete{margin-right:var(--spacing)}.bailey-history-row-confirming{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-200);background-color:var(--color-red-50)}.bailey-history-confirm{align-items:center;gap:calc(var(--spacing) * 2);min-width:0;padding-block:calc(var(--spacing) * 2);padding-right:calc(var(--spacing) * 2.5);padding-left:calc(var(--spacing) * 3);flex-wrap:wrap;flex:1;display:flex}.bailey-history-confirm-question{--tw-font-weight:var(--font-weight-semibold);min-width:7.5rem;font-size:13px;font-weight:var(--font-weight-semibold);flex:1}.bailey-history-confirm-title{text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);flex-basis:100%;overflow:hidden}.bailey-history-row-failed{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-200);background-color:#fff7f7}.bailey-history-row-error{align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 3);padding-bottom:calc(var(--spacing) * 2.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error);flex-wrap:wrap;flex-basis:100%;display:flex}.bailey-history-state{align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 6);padding-block:calc(var(--spacing) * 12);text-align:center;color:var(--color-bailey-text-secondary);flex-direction:column;font-size:13px;display:flex}.bailey-history-state strong{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-history-state-icon{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);color:var(--color-gray-400)}.bailey-history-state-error .bailey-history-state-icon{color:var(--color-bailey-error)}.bailey-history-more{padding-top:calc(var(--spacing) * 2.5);padding-bottom:calc(var(--spacing) * 1.5);justify-content:center;display:flex}.bailey-history-inline-error{justify-content:center;align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error);flex-wrap:wrap;display:flex}.bailey-history-status{min-height:calc(var(--spacing) * 9);align-items:center;gap:calc(var(--spacing) * 2);border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3.5);padding-block:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-history-skeleton{margin-inline:var(--spacing);margin-bottom:calc(var(--spacing) * 1.5);background:linear-gradient(90deg,#f1f1f4 25%,#e6e6ec 50%,#f1f1f4 75%) 0 0/200% 100%;border-radius:10px;height:52px;animation:1.3s infinite bailey-history-shimmer}.bailey-history-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent,#4f46e5);border-radius:2147483647px;animation:.8s linear infinite bailey-history-rotate;display:inline-block}@keyframes bailey-history-shimmer{to{background-position:-200% 0}}@keyframes bailey-history-rotate{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.bailey-history-skeleton,.bailey-history-spinner{animation:none}}@container (width<=340px){.bailey-history-new-chat{width:calc(var(--spacing) * 11);padding-inline:0}.bailey-history-new-chat-text,.bailey-history-count{display:none}}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-space-y-reverse{syntax:\"*\";inherits:false;initial-value:0}@property --tw-outline-style{syntax:\"*\";inherits:false;initial-value:solid}@keyframes spin{to{transform:rotate(360deg)}}", dt = r(void 0), ft = /:root\s*,\s*:host\s*\{/, pt = ".bailey-chat-panel{";
|
|
1498
|
-
function
|
|
1499
|
-
let t = e.match(new RegExp(
|
|
1517
|
+
var ft = "/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-border-style:solid;--tw-leading:initial;--tw-space-y-reverse:0;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:\"Inter\", -apple-system, \"Segoe UI\", Roboto, Arial, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-green-100:oklch(96.2% .044 156.743);--color-green-700:oklch(52.7% .154 150.069);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-700:oklch(48.8% .243 264.376);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-700:oklch(49.6% .265 301.924);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--color-bailey-accent:#4f46e5;--color-bailey-bubble-bg:#fff;--color-bailey-error:#d32f2f;--color-bailey-border:#e5e5e5;--color-bailey-surface:#fff;--color-bailey-surface-muted:#f9fafb;--color-bailey-text:#000;--color-bailey-text-secondary:#6b6b6b;--color-bailey-tooltip-bg:#000;--color-bailey-tooltip-text:#fff;--color-bailey-page-bg:#eceef4;--color-bailey-heart:#16a34a}}@layer utilities;.bailey-chat-panel{box-sizing:border-box;background-color:var(--color-bailey-page-bg);height:100%;padding:calc(var(--spacing) * 3);font-family:var(--font-sans);flex-direction:column;display:flex;position:relative}.bailey-chat-panel-inner{width:100%;min-height:0;max-width:var(--container-3xl);gap:calc(var(--spacing) * 2);flex-direction:column;flex:1;margin-inline:auto;display:flex;overflow-y:auto}.bailey-chat-transcript{min-height:0;padding:calc(var(--spacing) * 2);padding-bottom:calc(var(--spacing) * 4);flex:1;overflow-y:auto}.bailey-message-row{margin-bottom:calc(var(--spacing) * 3);justify-content:flex-start;display:flex}.bailey-message-row-user{justify-content:flex-end}.bailey-user-message{flex-direction:column;align-items:flex-end;max-width:75%;display:flex}.bailey-message-meta{margin-bottom:var(--spacing);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-message-meta-name{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-bailey-text)}.bailey-user-bubble{border-radius:var(--radius-2xl);background-color:var(--color-bailey-bubble-bg);max-width:100%;padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);white-space:pre-wrap;color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.bailey-assistant-message{width:100%;padding-inline:var(--spacing)}.bailey-tool-result-image{margin-top:calc(var(--spacing) * 2);border-radius:var(--radius-lg);max-width:100%;height:auto;display:block}.bailey-mcp-app-frame{margin-top:calc(var(--spacing) * 2);border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:0;width:100%;height:480px;display:block}.bailey-thinking-hint{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);font-style:italic}.bailey-streaming-hint{margin-top:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);font-style:italic;display:block}.bailey-message-actions{margin-top:var(--spacing);align-items:center;gap:var(--spacing);flex-wrap:wrap;display:flex}.bailey-empty-state{text-align:center;height:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);justify-content:center;align-items:center;display:flex}.bailey-suggestions{gap:calc(var(--spacing) * 3);padding:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-suggestions-title{padding-inline:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text)}.bailey-suggestion-card{cursor:pointer;appearance:none;justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-2xl);--tw-border-style:none;background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);text-align:left;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-style:none;display:flex}@media (hover:hover){.bailey-suggestion-card:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.bailey-suggestion-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-text-secondary);flex-shrink:0}.bailey-privacy-note{border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 4);padding-top:calc(var(--spacing) * 3);padding-bottom:var(--spacing);text-align:center;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-privacy-note a{color:var(--color-bailey-text-secondary);text-decoration-line:underline}.bailey-tool-steps-live{margin-top:calc(var(--spacing) * 2);gap:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-activity-line{align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-activity-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-accent);flex-shrink:0}.bailey-step-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent);border-radius:2147483647px;flex-shrink:0}@media (prefers-reduced-motion:no-preference){.bailey-step-spinner{animation:var(--animate-spin)}}.bailey-tool-steps-summary{margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary)}.bailey-tool-steps-summary>summary{cursor:pointer;-webkit-user-select:none;user-select:none}.bailey-tool-steps-list{margin:0;margin-top:var(--spacing);gap:var(--spacing);flex-direction:column;padding:0;list-style-type:none;display:flex}.bailey-tool-step{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-tool-step-failed{color:var(--color-bailey-error)}.bailey-error-banner{margin-bottom:calc(var(--spacing) * 2);justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-error);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);color:var(--color-bailey-error);display:flex}.bailey-retry-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-error-actions{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-dismiss-button{cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-error);background-color:#0000;border-style:none}@media (hover:hover){.bailey-dismiss-button:hover{opacity:.7}}.bailey-input-area{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-input-row{align-items:center;gap:calc(var(--spacing) * 2);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);min-width:0;padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex:1;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input{--tw-border-style:none;min-width:0;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;background-color:#0000;border-style:none;outline-style:none;flex:1}.bailey-input:disabled{opacity:.5}.bailey-send-button,.bailey-stop-button{cursor:pointer;appearance:none;background-color:#0000;border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}:is(.bailey-send-button,.bailey-stop-button):disabled{cursor:default;opacity:.4}.bailey-send-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-heart);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:#16a34a1a}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:color-mix(in oklab, var(--color-bailey-heart) 10%, transparent)}}}.bailey-send-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-stop-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-error);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:#d32f2f1a}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:color-mix(in oklab, var(--color-bailey-error) 10%, transparent)}}}.bailey-stop-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-copy-button{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-copy-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-copy-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-copy-button:hover{color:var(--color-bailey-text)}}.bailey-copy-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-tooltip-content{padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));background-color:var(--color-bailey-tooltip-bg,#000);color:var(--color-bailey-tooltip-text,#fff);border-radius:.25rem}.bailey-menu-button{height:calc(var(--spacing) * 13);width:calc(var(--spacing) * 13);cursor:pointer;appearance:none;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-menu-button:hover{background-color:var(--color-gray-50)}}.bailey-menu-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-menu-content{z-index:50;min-width:calc(var(--spacing) * 44);border-radius:var(--radius-2xl);background-color:var(--color-white);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-black);--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);font-family:var(--font-sans,\"Inter\", -apple-system, \"Segoe UI\", Roboto, Arial, sans-serif)}.bailey-menu-item{cursor:pointer;align-items:center;gap:calc(var(--spacing) * 3);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;outline-style:none;display:flex}.bailey-menu-item[data-highlighted]{background-color:var(--color-gray-100)}.bailey-menu-item-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-gray-600)}.bailey-tooltip-arrow{fill:var(--color-bailey-tooltip-bg,#000)}.bailey-markdown-content table{border-collapse:collapse;width:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.bailey-markdown-content th{background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);text-align:left;--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content td{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);vertical-align:top}.bailey-markdown-content tr:nth-child(2n){background-color:var(--color-bailey-surface-muted)}.bailey-markdown-content{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.bailey-markdown-content>:first-child{margin-top:0}.bailey-markdown-content>:last-child{margin-bottom:0}.bailey-markdown-content p{margin-block:calc(var(--spacing) * 2)}.bailey-markdown-content h1{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h2{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h3{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h4,.bailey-markdown-content h5,.bailey-markdown-content h6{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content ul{margin-block:calc(var(--spacing) * 2);list-style-type:disc}:where(.bailey-markdown-content ul>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ul{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content ol{margin-block:calc(var(--spacing) * 2);list-style-type:decimal}:where(.bailey-markdown-content ol>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ol{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content a{color:var(--color-bailey-accent);text-underline-offset:2px;text-decoration-line:underline}.bailey-markdown-content code{background-color:var(--color-bailey-surface-muted);padding-inline:var(--spacing);padding-block:calc(var(--spacing) * .5);font-family:var(--font-mono);border-radius:.25rem;font-size:.85em}.bailey-markdown-content pre{margin-block:calc(var(--spacing) * 2);border-radius:var(--radius-md);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 2);overflow-x:auto}.bailey-markdown-content pre code{background-color:#0000;padding:0}.bailey-markdown-content blockquote{margin-block:calc(var(--spacing) * 2);border-left-style:var(--tw-border-style);border-left-width:2px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 3);color:var(--color-bailey-text-secondary);font-style:italic}.bailey-markdown-content hr{margin-block:calc(var(--spacing) * 3);border-color:var(--color-bailey-border)}.bailey-trace-panel{margin-bottom:calc(var(--spacing) * 2)}.bailey-trace-toggle-row{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-trace-toggle{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-trace-toggle:hover{text-decoration-line:underline}}.bailey-trace-toggle-error{color:var(--color-bailey-error)}.bailey-trace-summary{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-trace-summary-error{color:var(--color-bailey-error)}.bailey-trace-body{margin-top:var(--spacing);max-height:calc(var(--spacing) * 80);overflow-y:auto}.bailey-trace-actions-row{justify-content:flex-end;gap:calc(var(--spacing) * 3);display:flex}.bailey-trace-copy-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}@media (hover:hover){.bailey-trace-copy-button:hover{text-decoration-line:none}}.bailey-trace-request-details{margin-bottom:var(--spacing);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding:calc(var(--spacing) * 2)}.bailey-trace-request-meta{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:block}.bailey-trace-rows{gap:var(--spacing);flex-direction:column;display:flex}.bailey-trace-row{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-row-header{align-items:center;gap:calc(var(--spacing) * 2);flex-wrap:wrap;display:flex}.bailey-trace-row-time{color:var(--color-bailey-text-secondary)}.bailey-trace-row-gap{color:var(--color-gray-400)}.bailey-trace-row-summary{word-break:break-all}.bailey-trace-chip{padding-inline:calc(var(--spacing) * 1.5);padding-block:calc(var(--spacing) * .5);--tw-font-weight:var(--font-weight-semibold);font-size:.65rem;font-weight:var(--font-weight-semibold);border-radius:.25rem}.bailey-trace-chip-default{background-color:var(--color-gray-200);color:var(--color-gray-700)}.bailey-trace-chip-info{background-color:var(--color-blue-100);color:var(--color-blue-700)}.bailey-trace-chip-success{background-color:var(--color-green-100);color:var(--color-green-700)}.bailey-trace-chip-secondary{background-color:var(--color-purple-100);color:var(--color-purple-700)}.bailey-trace-chip-error{background-color:var(--color-red-100);color:var(--color-bailey-error)}.bailey-trace-disclosure{margin-top:var(--spacing)}.bailey-trace-disclosure-summary{cursor:pointer;color:var(--color-bailey-text-secondary);font-size:.7rem}.bailey-trace-disclosure-actions{margin-top:var(--spacing);justify-content:flex-end;display:flex}.bailey-trace-disclosure-content{margin-top:var(--spacing);max-height:calc(var(--spacing) * 48);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 1.5);word-break:break-all;white-space:pre-wrap;border-radius:.25rem;font-size:.7rem;overflow:auto}.bailey-trace-group{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing)}.bailey-trace-group-summary{cursor:pointer;font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-group-failed{margin-left:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-feedback{align-items:center;gap:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);flex-wrap:wrap;display:flex}.bailey-message-actions>.bailey-feedback{display:contents}.bailey-feedback-thumbs{margin-left:var(--spacing);align-items:center;gap:calc(var(--spacing) * .5);border-left-style:var(--tw-border-style);border-left-width:1px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 2);display:flex}.bailey-feedback-thumb{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;border-radius:var(--radius-lg);--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-feedback-thumb:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-thumb:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-feedback-thumb:hover{color:var(--color-bailey-text)}}.bailey-feedback-thumb:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-thumb:disabled{cursor:default;opacity:.5}.bailey-feedback-thumb[aria-pressed=true]{background-color:#4f46e51a}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-thumb[aria-pressed=true]{background-color:color-mix(in oklab, var(--color-bailey-accent) 10%, transparent)}}.bailey-feedback-thumb[aria-pressed=true]{color:var(--color-bailey-accent)}.bailey-feedback-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-feedback-status{align-items:center;gap:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:inline-flex}.bailey-feedback-status:empty{display:none}.bailey-feedback-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);animation:var(--animate-spin);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent);border-radius:2147483647px;display:inline-block}.bailey-feedback-link{cursor:pointer;appearance:none;--tw-border-style:none;padding-inline:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-feedback-link:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-error{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-feedback-form{margin-top:calc(var(--spacing) * 2);box-sizing:border-box;border-radius:var(--radius-xl);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);width:100%;padding:calc(var(--spacing) * 3);flex-basis:100%}.bailey-feedback-reasons{margin:0;margin-bottom:calc(var(--spacing) * 2);--tw-border-style:none;border-style:none;min-width:0;padding:0}.bailey-feedback-legend{margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text);padding:0;display:block}.bailey-feedback-chips{gap:calc(var(--spacing) * 1.5);flex-wrap:wrap;display:flex}.bailey-feedback-chip{cursor:pointer;appearance:none;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text);border-radius:2147483647px}.bailey-feedback-chip:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-chip:disabled{cursor:default;opacity:.5}.bailey-feedback-chip[aria-pressed=true]{border-color:var(--color-bailey-accent);background-color:#4f46e51a}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-chip[aria-pressed=true]{background-color:color-mix(in oklab, var(--color-bailey-accent) 10%, transparent)}}.bailey-feedback-chip[aria-pressed=true]{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-accent)}.bailey-feedback-textarea{box-sizing:border-box;min-height:calc(var(--spacing) * 18);resize:vertical;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);width:100%;padding-inline:calc(var(--spacing) * 2.5);padding-block:calc(var(--spacing) * 2);font-family:var(--font-sans);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);display:block}.bailey-feedback-textarea:disabled{opacity:.5}.bailey-feedback-meta{margin-top:calc(var(--spacing) * 1.5);justify-content:space-between;align-items:flex-start;gap:calc(var(--spacing) * 3);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-feedback-buttons{margin-top:calc(var(--spacing) * 2.5);justify-content:flex-end;gap:calc(var(--spacing) * 2);display:flex}.bailey-feedback-button{cursor:pointer;appearance:none;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3.5);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-feedback-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-button:disabled{cursor:default;opacity:.5}.bailey-feedback-button-primary{border-color:var(--color-bailey-accent);background-color:var(--color-bailey-accent);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-load-earlier{align-items:center;gap:var(--spacing);padding-bottom:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-load-earlier-button{cursor:pointer;appearance:none;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3.5);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-load-earlier-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-load-earlier-button:disabled{cursor:default;opacity:.5}.bailey-load-earlier-error{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-history-drawer{z-index:10;background-color:var(--color-bailey-surface);font-family:var(--font-sans);color:var(--color-bailey-text);border-radius:14px;flex-direction:column;display:flex;position:absolute;inset:0;overflow:hidden;container-type:inline-size}.bailey-history-header{align-items:center;gap:calc(var(--spacing) * 2);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);display:flex}.bailey-history-heading{text-overflow:ellipsis;white-space:nowrap;--tw-font-weight:var(--font-weight-semibold);min-width:0;font-size:15px;font-weight:var(--font-weight-semibold);--tw-outline-style:none;outline-style:none;flex:1;margin:0;overflow:hidden}.bailey-history-icon-button{height:calc(var(--spacing) * 11);width:calc(var(--spacing) * 11);cursor:pointer;appearance:none;border-radius:var(--radius-lg);--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;flex:none;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-history-icon-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-history-icon-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-history-icon-button:hover{color:var(--color-bailey-text)}}.bailey-history-icon-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-icon-button:disabled{cursor:default;opacity:.5}.bailey-history-icon{width:18px;height:18px}.bailey-history-icon-small{height:calc(var(--spacing) * 3.5);width:calc(var(--spacing) * 3.5);flex:none}.bailey-history-button{min-height:calc(var(--spacing) * 11);cursor:pointer;appearance:none;justify-content:center;align-items:center;gap:calc(var(--spacing) * 1.5);border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 1.5);white-space:nowrap;color:var(--color-bailey-text);font-size:13px;display:inline-flex}.bailey-history-button:focus-visible{outline-style:var(--tw-outline-style);outline-offset:2px;outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-button:disabled{cursor:default;opacity:.5}.bailey-history-button-primary{border-color:var(--color-bailey-accent);background-color:var(--color-bailey-accent);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-history-button-danger{border-color:var(--color-bailey-error);background-color:var(--color-bailey-error);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-history-button-small{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-history-body{padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);flex:1;overflow-y:auto}.bailey-history-list{margin:0;padding:0;list-style-type:none}.bailey-history-row{border-radius:10px;flex-wrap:wrap;align-items:center;display:flex;position:relative}.bailey-history-row+.bailey-history-row{margin-top:calc(var(--spacing) * .5)}.bailey-history-row:not(.bailey-history-row-active):hover{background-color:var(--color-gray-100)}.bailey-history-row-active{box-shadow:inset 3px 0 0 var(--color-bailey-accent,#4f46e5);background-color:#4f46e514}.bailey-history-select{min-height:calc(var(--spacing) * 11);cursor:pointer;appearance:none;gap:calc(var(--spacing) * .5);--tw-border-style:none;min-width:0;padding-block:calc(var(--spacing) * 2.5);padding-right:calc(var(--spacing) * 2.5);padding-left:calc(var(--spacing) * 3);text-align:left;color:var(--color-bailey-text);background-color:#0000;border-style:none;border-radius:10px;flex-direction:column;flex:1;font-family:inherit;display:flex}.bailey-history-select:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-select:disabled{cursor:default;opacity:.6}.bailey-history-row-title{text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);overflow:hidden}.bailey-history-meta{align-items:center;gap:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-history-meta>span+.bailey-history-count:before{content:\"·\";margin-right:.375rem}.bailey-history-current{--tw-font-weight:var(--font-weight-semibold);font-size:11px;font-weight:var(--font-weight-semibold);color:var(--color-bailey-accent)}.bailey-history-delete{margin-right:var(--spacing)}.bailey-history-row-confirming{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-200);background-color:var(--color-red-50)}.bailey-history-confirm{align-items:center;gap:calc(var(--spacing) * 2);min-width:0;padding-block:calc(var(--spacing) * 2);padding-right:calc(var(--spacing) * 2.5);padding-left:calc(var(--spacing) * 3);flex-wrap:wrap;flex:1;display:flex}.bailey-history-confirm-question{--tw-font-weight:var(--font-weight-semibold);min-width:7.5rem;font-size:13px;font-weight:var(--font-weight-semibold);flex:1}.bailey-history-confirm-title{text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);flex-basis:100%;overflow:hidden}.bailey-history-row-failed{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-200);background-color:#fff7f7}.bailey-history-row-error{align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 3);padding-bottom:calc(var(--spacing) * 2.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error);flex-wrap:wrap;flex-basis:100%;display:flex}.bailey-history-state{align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 6);padding-block:calc(var(--spacing) * 12);text-align:center;color:var(--color-bailey-text-secondary);flex-direction:column;font-size:13px;display:flex}.bailey-history-state strong{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-history-state-icon{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);color:var(--color-gray-400)}.bailey-history-state-error .bailey-history-state-icon{color:var(--color-bailey-error)}.bailey-history-more{padding-top:calc(var(--spacing) * 2.5);padding-bottom:calc(var(--spacing) * 1.5);justify-content:center;display:flex}.bailey-history-inline-error{justify-content:center;align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error);flex-wrap:wrap;display:flex}.bailey-history-status{min-height:calc(var(--spacing) * 9);align-items:center;gap:calc(var(--spacing) * 2);border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3.5);padding-block:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-history-skeleton{margin-inline:var(--spacing);margin-bottom:calc(var(--spacing) * 1.5);background:linear-gradient(90deg,#f1f1f4 25%,#e6e6ec 50%,#f1f1f4 75%) 0 0/200% 100%;border-radius:10px;height:52px;animation:1.3s infinite bailey-history-shimmer}.bailey-history-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent,#4f46e5);border-radius:2147483647px;animation:.8s linear infinite bailey-history-rotate;display:inline-block}@keyframes bailey-history-shimmer{to{background-position:-200% 0}}@keyframes bailey-history-rotate{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.bailey-history-skeleton,.bailey-history-spinner{animation:none}}@container (width<=340px){.bailey-history-new-chat{width:calc(var(--spacing) * 11);padding-inline:0}.bailey-history-new-chat-text,.bailey-history-count{display:none}}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-space-y-reverse{syntax:\"*\";inherits:false;initial-value:0}@property --tw-outline-style{syntax:\"*\";inherits:false;initial-value:solid}@keyframes spin{to{transform:rotate(360deg)}}", pt = r(void 0), mt = /:root\s*,\s*:host\s*\{/, ht = ".bailey-chat-panel{";
|
|
1518
|
+
function gt(e) {
|
|
1519
|
+
let t = e.match(new RegExp(mt, "g"))?.length ?? 0;
|
|
1500
1520
|
if (t !== 1) throw Error(`Expected exactly one ":root, :host {" rule in the compiled styles.css, found ${t}. Tailwind likely changed how @theme compiles — update this rewrite (and its sibling, scripts/scope-theme-vars.js) before shipping.`);
|
|
1501
|
-
return e.replace(
|
|
1521
|
+
return e.replace(mt, ht);
|
|
1502
1522
|
}
|
|
1503
|
-
var
|
|
1504
|
-
function
|
|
1523
|
+
var _t = gt(ft), vt = "data-source", yt = "baileyai-chat-ui", bt = /* @__PURE__ */ new WeakMap();
|
|
1524
|
+
function xt(e) {
|
|
1505
1525
|
let t = e.getRootNode();
|
|
1506
1526
|
return t instanceof ShadowRoot ? t : document;
|
|
1507
1527
|
}
|
|
1508
|
-
function
|
|
1509
|
-
let t = e instanceof ShadowRoot ? e : document.head, n =
|
|
1510
|
-
if (n === 0 && !t.querySelector(`style[${
|
|
1528
|
+
function St(e) {
|
|
1529
|
+
let t = e instanceof ShadowRoot ? e : document.head, n = bt.get(e) ?? 0;
|
|
1530
|
+
if (n === 0 && !t.querySelector(`style[${vt}="${yt}"]`)) {
|
|
1511
1531
|
let e = document.createElement("style");
|
|
1512
|
-
e.setAttribute(
|
|
1532
|
+
e.setAttribute(vt, yt), e.textContent = _t, t.appendChild(e);
|
|
1513
1533
|
}
|
|
1514
|
-
return
|
|
1515
|
-
let n = (
|
|
1516
|
-
n <= 0 ? (
|
|
1534
|
+
return bt.set(e, n + 1), () => {
|
|
1535
|
+
let n = (bt.get(e) ?? 1) - 1;
|
|
1536
|
+
n <= 0 ? (bt.delete(e), t.querySelector(`style[${vt}="${yt}"]`)?.remove()) : bt.set(e, n);
|
|
1517
1537
|
};
|
|
1518
1538
|
}
|
|
1519
|
-
function
|
|
1539
|
+
function Ct(e, t = !1) {
|
|
1520
1540
|
let [n, r] = f(null);
|
|
1521
1541
|
return l(() => {
|
|
1522
1542
|
if (t) return;
|
|
1523
1543
|
let n = e.current;
|
|
1524
1544
|
if (!n) return;
|
|
1525
|
-
let i =
|
|
1526
|
-
return r(i),
|
|
1545
|
+
let i = xt(n);
|
|
1546
|
+
return r(i), St(i);
|
|
1527
1547
|
}, [t, e]), n;
|
|
1528
1548
|
}
|
|
1529
|
-
function
|
|
1530
|
-
let t = o(
|
|
1549
|
+
function wt(e) {
|
|
1550
|
+
let t = o(pt), n = t !== void 0, r = Ct(e, n);
|
|
1531
1551
|
return n ? t : r;
|
|
1532
1552
|
}
|
|
1533
1553
|
//#endregion
|
|
1534
1554
|
//#region src/ui/markdown.tsx
|
|
1535
|
-
function
|
|
1555
|
+
function Tt({ renderTable: t, renderChart: n } = {}) {
|
|
1536
1556
|
return {
|
|
1537
1557
|
a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ v(_, { children: n }) : /* @__PURE__ */ v("a", {
|
|
1538
1558
|
href: t,
|
|
@@ -1541,8 +1561,8 @@ function Ct({ renderTable: t, renderChart: n } = {}) {
|
|
|
1541
1561
|
children: n
|
|
1542
1562
|
}),
|
|
1543
1563
|
table: ({ node: n, children: r }) => {
|
|
1544
|
-
let i = n &&
|
|
1545
|
-
if (i &&
|
|
1564
|
+
let i = n && ze(n);
|
|
1565
|
+
if (i && Be(i.rows) && t) {
|
|
1546
1566
|
let n = i.rows.map((t) => t.map((t) => t.href && !e(t.href) ? { text: t.text } : t));
|
|
1547
1567
|
return /* @__PURE__ */ v(_, { children: t({
|
|
1548
1568
|
headers: i.headers,
|
|
@@ -1554,7 +1574,7 @@ function Ct({ renderTable: t, renderChart: n } = {}) {
|
|
|
1554
1574
|
pre: ({ children: e }) => {
|
|
1555
1575
|
let t = (Array.isArray(e) ? e[0] : e)?.props;
|
|
1556
1576
|
if ((t?.className?.split(" ") ?? []).includes("language-chartjs") && n) {
|
|
1557
|
-
let e = t?.children, r =
|
|
1577
|
+
let e = t?.children, r = Je(Array.isArray(e) ? e.join("") : String(e ?? ""));
|
|
1558
1578
|
if (r) return /* @__PURE__ */ v(_, { children: n(r) });
|
|
1559
1579
|
}
|
|
1560
1580
|
return /* @__PURE__ */ v("pre", { children: e });
|
|
@@ -1563,7 +1583,7 @@ function Ct({ renderTable: t, renderChart: n } = {}) {
|
|
|
1563
1583
|
}
|
|
1564
1584
|
//#endregion
|
|
1565
1585
|
//#region src/ui/icons.tsx
|
|
1566
|
-
function
|
|
1586
|
+
function Et({ className: e }) {
|
|
1567
1587
|
return /* @__PURE__ */ v("svg", {
|
|
1568
1588
|
viewBox: "0 0 24 24",
|
|
1569
1589
|
fill: "currentColor",
|
|
@@ -1572,7 +1592,7 @@ function wt({ className: e }) {
|
|
|
1572
1592
|
children: /* @__PURE__ */ v("path", { d: "M12 20.3s-7.6-4.7-10-9.4C.4 7.7 1.7 4 5.2 3.1c2.2-.6 4.4.4 5.5 2.2 1.2-1.8 3.4-2.8 5.6-2.2 3.5.9 4.8 4.6 3.2 7.8-2.4 4.7-10 9.4-10 9.4z" })
|
|
1573
1593
|
});
|
|
1574
1594
|
}
|
|
1575
|
-
function
|
|
1595
|
+
function Dt({ className: e }) {
|
|
1576
1596
|
return /* @__PURE__ */ v("svg", {
|
|
1577
1597
|
viewBox: "0 0 24 24",
|
|
1578
1598
|
fill: "currentColor",
|
|
@@ -1587,7 +1607,7 @@ function Tt({ className: e }) {
|
|
|
1587
1607
|
})
|
|
1588
1608
|
});
|
|
1589
1609
|
}
|
|
1590
|
-
function
|
|
1610
|
+
function Ot({ className: e }) {
|
|
1591
1611
|
return /* @__PURE__ */ y("svg", {
|
|
1592
1612
|
viewBox: "0 0 24 24",
|
|
1593
1613
|
fill: "none",
|
|
@@ -1600,7 +1620,7 @@ function Et({ className: e }) {
|
|
|
1600
1620
|
children: [/* @__PURE__ */ v("path", { d: "M7 17 17 7" }), /* @__PURE__ */ v("path", { d: "M9 7h8v8" })]
|
|
1601
1621
|
});
|
|
1602
1622
|
}
|
|
1603
|
-
function
|
|
1623
|
+
function kt({ className: e }) {
|
|
1604
1624
|
return /* @__PURE__ */ y("svg", {
|
|
1605
1625
|
viewBox: "0 0 24 24",
|
|
1606
1626
|
fill: "none",
|
|
@@ -1619,7 +1639,7 @@ function Dt({ className: e }) {
|
|
|
1619
1639
|
}), /* @__PURE__ */ v("path", { d: "M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" })]
|
|
1620
1640
|
});
|
|
1621
1641
|
}
|
|
1622
|
-
function
|
|
1642
|
+
function At({ className: e }) {
|
|
1623
1643
|
return /* @__PURE__ */ v("svg", {
|
|
1624
1644
|
viewBox: "0 0 24 24",
|
|
1625
1645
|
fill: "none",
|
|
@@ -1632,7 +1652,7 @@ function Ot({ className: e }) {
|
|
|
1632
1652
|
children: /* @__PURE__ */ v("path", { d: "M5 12.5 9.5 17 19 7" })
|
|
1633
1653
|
});
|
|
1634
1654
|
}
|
|
1635
|
-
function
|
|
1655
|
+
function jt({ className: e }) {
|
|
1636
1656
|
return /* @__PURE__ */ v("svg", {
|
|
1637
1657
|
viewBox: "0 0 24 24",
|
|
1638
1658
|
fill: "none",
|
|
@@ -1645,7 +1665,7 @@ function kt({ className: e }) {
|
|
|
1645
1665
|
children: /* @__PURE__ */ v("path", { d: "m22.7 13.5-2-2-2 2M21 12a9 9 0 1 1-1.245-4.57M12 7v5l3 2" })
|
|
1646
1666
|
});
|
|
1647
1667
|
}
|
|
1648
|
-
function
|
|
1668
|
+
function Mt({ className: e }) {
|
|
1649
1669
|
return /* @__PURE__ */ y("svg", {
|
|
1650
1670
|
viewBox: "0 0 24 24",
|
|
1651
1671
|
fill: "none",
|
|
@@ -1662,7 +1682,7 @@ function At({ className: e }) {
|
|
|
1662
1682
|
}), /* @__PURE__ */ v("path", { d: "M8.5 12.5 11 15l4.5-5.5" })]
|
|
1663
1683
|
});
|
|
1664
1684
|
}
|
|
1665
|
-
function
|
|
1685
|
+
function Nt({ className: e }) {
|
|
1666
1686
|
return /* @__PURE__ */ y("svg", {
|
|
1667
1687
|
viewBox: "0 0 24 24",
|
|
1668
1688
|
fill: "currentColor",
|
|
@@ -1687,7 +1707,7 @@ function jt({ className: e }) {
|
|
|
1687
1707
|
]
|
|
1688
1708
|
});
|
|
1689
1709
|
}
|
|
1690
|
-
function
|
|
1710
|
+
function Pt({ className: e }) {
|
|
1691
1711
|
return /* @__PURE__ */ v("svg", {
|
|
1692
1712
|
viewBox: "0 0 24 24",
|
|
1693
1713
|
fill: "none",
|
|
@@ -1700,8 +1720,8 @@ function Mt({ className: e }) {
|
|
|
1700
1720
|
children: /* @__PURE__ */ v("path", { d: "M12 5v14M5 12h14" })
|
|
1701
1721
|
});
|
|
1702
1722
|
}
|
|
1703
|
-
var
|
|
1704
|
-
function
|
|
1723
|
+
var Ft = "M7 11v9H4v-9h3zm0 0 4-8c1.7 0 2.7 1.3 2.4 3L13 9h5.5a2 2 0 0 1 2 2.4l-1.3 6.8A2 2 0 0 1 17.2 20H7", It = "M17 13V4h3v9h-3zm0 0-4 8c-1.7 0-2.7-1.3-2.4-3L11 15H5.5a2 2 0 0 1-2-2.4l1.3-6.8A2 2 0 0 1 6.8 4H17";
|
|
1724
|
+
function Lt({ className: e, filled: t = !1 }) {
|
|
1705
1725
|
return /* @__PURE__ */ v("svg", {
|
|
1706
1726
|
viewBox: "0 0 24 24",
|
|
1707
1727
|
fill: t ? "currentColor" : "none",
|
|
@@ -1710,10 +1730,10 @@ function Ft({ className: e, filled: t = !1 }) {
|
|
|
1710
1730
|
strokeLinejoin: "round",
|
|
1711
1731
|
className: e,
|
|
1712
1732
|
"aria-hidden": "true",
|
|
1713
|
-
children: /* @__PURE__ */ v("path", { d:
|
|
1733
|
+
children: /* @__PURE__ */ v("path", { d: Ft })
|
|
1714
1734
|
});
|
|
1715
1735
|
}
|
|
1716
|
-
function
|
|
1736
|
+
function Rt({ className: e, filled: t = !1 }) {
|
|
1717
1737
|
return /* @__PURE__ */ v("svg", {
|
|
1718
1738
|
viewBox: "0 0 24 24",
|
|
1719
1739
|
fill: t ? "currentColor" : "none",
|
|
@@ -1722,10 +1742,10 @@ function It({ className: e, filled: t = !1 }) {
|
|
|
1722
1742
|
strokeLinejoin: "round",
|
|
1723
1743
|
className: e,
|
|
1724
1744
|
"aria-hidden": "true",
|
|
1725
|
-
children: /* @__PURE__ */ v("path", { d:
|
|
1745
|
+
children: /* @__PURE__ */ v("path", { d: It })
|
|
1726
1746
|
});
|
|
1727
1747
|
}
|
|
1728
|
-
function
|
|
1748
|
+
function zt({ className: e }) {
|
|
1729
1749
|
return /* @__PURE__ */ v("svg", {
|
|
1730
1750
|
viewBox: "0 0 24 24",
|
|
1731
1751
|
fill: "none",
|
|
@@ -1738,7 +1758,7 @@ function Lt({ className: e }) {
|
|
|
1738
1758
|
children: /* @__PURE__ */ v("path", { d: "M15 6l-6 6 6 6" })
|
|
1739
1759
|
});
|
|
1740
1760
|
}
|
|
1741
|
-
function
|
|
1761
|
+
function Bt({ className: e }) {
|
|
1742
1762
|
return /* @__PURE__ */ v("svg", {
|
|
1743
1763
|
viewBox: "0 0 24 24",
|
|
1744
1764
|
fill: "none",
|
|
@@ -1751,7 +1771,7 @@ function Rt({ className: e }) {
|
|
|
1751
1771
|
children: /* @__PURE__ */ v("path", { d: "M4 7h16M10 11v6M14 11v6M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12M9 7V4h6v3" })
|
|
1752
1772
|
});
|
|
1753
1773
|
}
|
|
1754
|
-
function
|
|
1774
|
+
function Vt({ className: e }) {
|
|
1755
1775
|
return /* @__PURE__ */ y("svg", {
|
|
1756
1776
|
viewBox: "0 0 24 24",
|
|
1757
1777
|
fill: "none",
|
|
@@ -1770,9 +1790,9 @@ function zt({ className: e }) {
|
|
|
1770
1790
|
}
|
|
1771
1791
|
//#endregion
|
|
1772
1792
|
//#region src/ui/CopyMarkdownButton.tsx
|
|
1773
|
-
var
|
|
1774
|
-
function
|
|
1775
|
-
let [a, o] = f(!1), [c, l] = f(!1), u = d(null), p = d(null), m =
|
|
1793
|
+
var Ht = 1500;
|
|
1794
|
+
function Ut({ markdown: e, className: t, ariaLabel: n = "copy response as markdown", tooltipDefaultText: r = "Copy as markdown", tooltipCopiedText: i = "Copied!" }) {
|
|
1795
|
+
let [a, o] = f(!1), [c, l] = f(!1), u = d(null), p = d(null), m = wt(p);
|
|
1776
1796
|
return s(() => () => {
|
|
1777
1797
|
u.current !== null && clearTimeout(u.current);
|
|
1778
1798
|
}, []), /* @__PURE__ */ v(g.Provider, {
|
|
@@ -1791,11 +1811,11 @@ function Vt({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
|
|
|
1791
1811
|
} catch {
|
|
1792
1812
|
return;
|
|
1793
1813
|
}
|
|
1794
|
-
o(!0), u.current !== null && clearTimeout(u.current), u.current = setTimeout(() => o(!1),
|
|
1814
|
+
o(!0), u.current !== null && clearTimeout(u.current), u.current = setTimeout(() => o(!1), Ht);
|
|
1795
1815
|
},
|
|
1796
1816
|
"aria-label": n,
|
|
1797
1817
|
className: `bailey-copy-button${t ? ` ${t}` : ""}`,
|
|
1798
|
-
children: v(a ?
|
|
1818
|
+
children: v(a ? At : kt, { className: "bailey-copy-icon" })
|
|
1799
1819
|
})
|
|
1800
1820
|
}), /* @__PURE__ */ v(g.Portal, {
|
|
1801
1821
|
container: m instanceof ShadowRoot ? m : void 0,
|
|
@@ -1810,20 +1830,20 @@ function Vt({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
|
|
|
1810
1830
|
}
|
|
1811
1831
|
//#endregion
|
|
1812
1832
|
//#region src/ui/BaileyTracePanel.tsx
|
|
1813
|
-
async function
|
|
1833
|
+
async function Wt(e) {
|
|
1814
1834
|
try {
|
|
1815
1835
|
await navigator.clipboard.writeText(e);
|
|
1816
1836
|
} catch {}
|
|
1817
1837
|
}
|
|
1818
|
-
function
|
|
1838
|
+
function Gt({ text: e, label: t = "Copy" }) {
|
|
1819
1839
|
return /* @__PURE__ */ v("button", {
|
|
1820
1840
|
type: "button",
|
|
1821
|
-
onClick: () =>
|
|
1841
|
+
onClick: () => Wt(e),
|
|
1822
1842
|
className: "bailey-trace-copy-button",
|
|
1823
1843
|
children: t
|
|
1824
1844
|
});
|
|
1825
1845
|
}
|
|
1826
|
-
function
|
|
1846
|
+
function Kt(e) {
|
|
1827
1847
|
if (e.failed || e.kind === "error") return "bailey-trace-chip bailey-trace-chip-error";
|
|
1828
1848
|
switch (e.kind) {
|
|
1829
1849
|
case "tool_start":
|
|
@@ -1834,7 +1854,7 @@ function Wt(e) {
|
|
|
1834
1854
|
default: return "bailey-trace-chip bailey-trace-chip-default";
|
|
1835
1855
|
}
|
|
1836
1856
|
}
|
|
1837
|
-
function
|
|
1857
|
+
function qt({ label: e, content: t, copyable: n }) {
|
|
1838
1858
|
return /* @__PURE__ */ y("details", {
|
|
1839
1859
|
className: "bailey-trace-disclosure",
|
|
1840
1860
|
children: [
|
|
@@ -1844,7 +1864,7 @@ function Gt({ label: e, content: t, copyable: n }) {
|
|
|
1844
1864
|
}),
|
|
1845
1865
|
n && /* @__PURE__ */ v("div", {
|
|
1846
1866
|
className: "bailey-trace-disclosure-actions",
|
|
1847
|
-
children: /* @__PURE__ */ v(
|
|
1867
|
+
children: /* @__PURE__ */ v(Gt, { text: t })
|
|
1848
1868
|
}),
|
|
1849
1869
|
/* @__PURE__ */ v("pre", {
|
|
1850
1870
|
className: "bailey-trace-disclosure-content",
|
|
@@ -1853,7 +1873,7 @@ function Gt({ label: e, content: t, copyable: n }) {
|
|
|
1853
1873
|
]
|
|
1854
1874
|
});
|
|
1855
1875
|
}
|
|
1856
|
-
function
|
|
1876
|
+
function Jt({ row: e }) {
|
|
1857
1877
|
return /* @__PURE__ */ y("div", {
|
|
1858
1878
|
className: "bailey-trace-row",
|
|
1859
1879
|
children: [
|
|
@@ -1867,10 +1887,10 @@ function Kt({ row: e }) {
|
|
|
1867
1887
|
/* @__PURE__ */ v("span", {
|
|
1868
1888
|
className: "bailey-trace-row-gap",
|
|
1869
1889
|
title: "Time since the previous event",
|
|
1870
|
-
children:
|
|
1890
|
+
children: at(e.gapMs)
|
|
1871
1891
|
}),
|
|
1872
1892
|
/* @__PURE__ */ v("span", {
|
|
1873
|
-
className:
|
|
1893
|
+
className: Kt(e),
|
|
1874
1894
|
children: e.label
|
|
1875
1895
|
}),
|
|
1876
1896
|
/* @__PURE__ */ v("span", {
|
|
@@ -1879,32 +1899,32 @@ function Kt({ row: e }) {
|
|
|
1879
1899
|
})
|
|
1880
1900
|
]
|
|
1881
1901
|
}),
|
|
1882
|
-
e.argsDetail && /* @__PURE__ */ v(
|
|
1902
|
+
e.argsDetail && /* @__PURE__ */ v(qt, {
|
|
1883
1903
|
label: e.kind === "llm_call_start" ? "request" : "args",
|
|
1884
1904
|
content: e.argsDetail
|
|
1885
1905
|
}),
|
|
1886
|
-
e.outputDetail && /* @__PURE__ */ v(
|
|
1906
|
+
e.outputDetail && /* @__PURE__ */ v(qt, {
|
|
1887
1907
|
label: e.kind === "llm_call_end" ? "response" : "output",
|
|
1888
1908
|
content: e.outputDetail
|
|
1889
1909
|
}),
|
|
1890
|
-
e.structuredOutputDetail && /* @__PURE__ */ v(
|
|
1910
|
+
e.structuredOutputDetail && /* @__PURE__ */ v(qt, {
|
|
1891
1911
|
label: "structured output",
|
|
1892
1912
|
content: e.structuredOutputDetail
|
|
1893
1913
|
}),
|
|
1894
|
-
e.rawDetail && /* @__PURE__ */ v(
|
|
1914
|
+
e.rawDetail && /* @__PURE__ */ v(qt, {
|
|
1895
1915
|
label: "raw",
|
|
1896
1916
|
content: e.rawDetail
|
|
1897
1917
|
})
|
|
1898
1918
|
]
|
|
1899
1919
|
});
|
|
1900
1920
|
}
|
|
1901
|
-
function
|
|
1921
|
+
function Yt(e, t) {
|
|
1902
1922
|
if (e.chunkCount === 0) return "Streamed: no chunks received";
|
|
1903
1923
|
if (e.chunkCount === 1 || e.firstChunkAt === null) return "Streamed: 1 chunk (not incremental)";
|
|
1904
1924
|
let n = e.firstChunkAt - t, r = (e.lastChunkAt ?? e.firstChunkAt) - e.firstChunkAt;
|
|
1905
1925
|
return `Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r / 1e3).toFixed(1)}s`;
|
|
1906
1926
|
}
|
|
1907
|
-
function
|
|
1927
|
+
function Xt({ request: e }) {
|
|
1908
1928
|
let t = u(() => JSON.stringify({
|
|
1909
1929
|
model: e.model,
|
|
1910
1930
|
instructions: e.systemPrompt,
|
|
@@ -1928,24 +1948,24 @@ function Jt({ request: e }) {
|
|
|
1928
1948
|
}),
|
|
1929
1949
|
/* @__PURE__ */ v("span", {
|
|
1930
1950
|
className: "bailey-trace-request-meta",
|
|
1931
|
-
children:
|
|
1951
|
+
children: Yt(e.streamStats, e.sentAt)
|
|
1932
1952
|
}),
|
|
1933
|
-
/* @__PURE__ */ v(
|
|
1953
|
+
/* @__PURE__ */ v(qt, {
|
|
1934
1954
|
label: `System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,
|
|
1935
1955
|
content: e.systemPrompt,
|
|
1936
1956
|
copyable: !0
|
|
1937
1957
|
}),
|
|
1938
|
-
/* @__PURE__ */ v(
|
|
1958
|
+
/* @__PURE__ */ v(qt, {
|
|
1939
1959
|
label: `Messages (${e.messages.length})`,
|
|
1940
1960
|
content: JSON.stringify(e.messages, null, 2),
|
|
1941
1961
|
copyable: !0
|
|
1942
1962
|
}),
|
|
1943
|
-
e.response && /* @__PURE__ */ v(
|
|
1963
|
+
e.response && /* @__PURE__ */ v(qt, {
|
|
1944
1964
|
label: `Response (${e.response.content.length.toLocaleString()} chars)`,
|
|
1945
1965
|
content: e.response.content,
|
|
1946
1966
|
copyable: !0
|
|
1947
1967
|
}),
|
|
1948
|
-
/* @__PURE__ */ v(
|
|
1968
|
+
/* @__PURE__ */ v(qt, {
|
|
1949
1969
|
label: "Full payload (JSON)",
|
|
1950
1970
|
content: t,
|
|
1951
1971
|
copyable: !0
|
|
@@ -1953,14 +1973,14 @@ function Jt({ request: e }) {
|
|
|
1953
1973
|
]
|
|
1954
1974
|
});
|
|
1955
1975
|
}
|
|
1956
|
-
function
|
|
1957
|
-
let r = u(() =>
|
|
1976
|
+
function Zt({ events: e, lastRequest: t, onClear: n }) {
|
|
1977
|
+
let r = u(() => ot(e), [e]), i = u(() => ct(r), [r]), a = u(() => JSON.stringify(e, null, 2), [e]);
|
|
1958
1978
|
return /* @__PURE__ */ y("div", {
|
|
1959
1979
|
className: "bailey-trace-body",
|
|
1960
1980
|
children: [
|
|
1961
1981
|
/* @__PURE__ */ y("div", {
|
|
1962
1982
|
className: "bailey-trace-actions-row",
|
|
1963
|
-
children: [e.length > 0 && /* @__PURE__ */ v(
|
|
1983
|
+
children: [e.length > 0 && /* @__PURE__ */ v(Gt, {
|
|
1964
1984
|
text: a,
|
|
1965
1985
|
label: "Copy trace as JSON"
|
|
1966
1986
|
}), /* @__PURE__ */ v("button", {
|
|
@@ -1970,15 +1990,15 @@ function Yt({ events: e, lastRequest: t, onClear: n }) {
|
|
|
1970
1990
|
children: "Clear"
|
|
1971
1991
|
})]
|
|
1972
1992
|
}),
|
|
1973
|
-
t && /* @__PURE__ */ v(
|
|
1993
|
+
t && /* @__PURE__ */ v(Xt, { request: t }),
|
|
1974
1994
|
/* @__PURE__ */ v("div", {
|
|
1975
1995
|
className: "bailey-trace-rows",
|
|
1976
1996
|
children: i.map((e, t) => {
|
|
1977
|
-
if (e.type === "single") return /* @__PURE__ */ v(
|
|
1997
|
+
if (e.type === "single") return /* @__PURE__ */ v(Jt, { row: e.row }, e.row.key);
|
|
1978
1998
|
let n = e.rows.filter((e) => e.isToolStart).length;
|
|
1979
1999
|
if (n <= 1) return /* @__PURE__ */ v("div", {
|
|
1980
2000
|
className: "bailey-trace-rows",
|
|
1981
|
-
children: e.rows.map((e) => /* @__PURE__ */ v(
|
|
2001
|
+
children: e.rows.map((e) => /* @__PURE__ */ v(Jt, { row: e }, e.key))
|
|
1982
2002
|
}, `group-${t}`);
|
|
1983
2003
|
let r = e.rows.filter((e) => e.failed).length;
|
|
1984
2004
|
return /* @__PURE__ */ y("details", {
|
|
@@ -2000,7 +2020,7 @@ function Yt({ events: e, lastRequest: t, onClear: n }) {
|
|
|
2000
2020
|
]
|
|
2001
2021
|
}), /* @__PURE__ */ v("div", {
|
|
2002
2022
|
className: "bailey-trace-rows",
|
|
2003
|
-
children: e.rows.map((e) => /* @__PURE__ */ v(
|
|
2023
|
+
children: e.rows.map((e) => /* @__PURE__ */ v(Jt, { row: e }, e.key))
|
|
2004
2024
|
})]
|
|
2005
2025
|
}, `group-${t}`);
|
|
2006
2026
|
})
|
|
@@ -2008,8 +2028,8 @@ function Yt({ events: e, lastRequest: t, onClear: n }) {
|
|
|
2008
2028
|
]
|
|
2009
2029
|
});
|
|
2010
2030
|
}
|
|
2011
|
-
function
|
|
2012
|
-
let [r, i] = f(!1), a = u(() =>
|
|
2031
|
+
function Qt({ events: e, lastRequest: t, onClear: n }) {
|
|
2032
|
+
let [r, i] = f(!1), a = u(() => lt(e), [e]), o = u(() => st(e), [e]);
|
|
2013
2033
|
return e.length === 0 && !t ? null : /* @__PURE__ */ y("div", {
|
|
2014
2034
|
className: "bailey-trace-panel",
|
|
2015
2035
|
children: [/* @__PURE__ */ y("div", {
|
|
@@ -2030,7 +2050,7 @@ function Xt({ events: e, lastRequest: t, onClear: n }) {
|
|
|
2030
2050
|
className: a ? "bailey-trace-summary bailey-trace-summary-error" : "bailey-trace-summary",
|
|
2031
2051
|
children: o
|
|
2032
2052
|
})]
|
|
2033
|
-
}), r && /* @__PURE__ */ v(
|
|
2053
|
+
}), r && /* @__PURE__ */ v(Zt, {
|
|
2034
2054
|
events: e,
|
|
2035
2055
|
lastRequest: t,
|
|
2036
2056
|
onClear: n
|
|
@@ -2039,7 +2059,7 @@ function Xt({ events: e, lastRequest: t, onClear: n }) {
|
|
|
2039
2059
|
}
|
|
2040
2060
|
//#endregion
|
|
2041
2061
|
//#region src/ui/ToolResultImage.tsx
|
|
2042
|
-
function
|
|
2062
|
+
function $t({ src: e, alt: n, className: r }) {
|
|
2043
2063
|
return t(e) ? /* @__PURE__ */ v("img", {
|
|
2044
2064
|
src: e,
|
|
2045
2065
|
alt: n ?? "",
|
|
@@ -2049,21 +2069,21 @@ function Zt({ src: e, alt: n, className: r }) {
|
|
|
2049
2069
|
}
|
|
2050
2070
|
//#endregion
|
|
2051
2071
|
//#region src/utils/safeMcpAppResource.ts
|
|
2052
|
-
var
|
|
2072
|
+
var en = /^ui:\/\//, tn = 2097152, nn = /* @__PURE__ */ new Set([
|
|
2053
2073
|
"connectDomains",
|
|
2054
2074
|
"resourceDomains",
|
|
2055
2075
|
"frameDomains",
|
|
2056
2076
|
"baseUriDomains"
|
|
2057
|
-
]),
|
|
2077
|
+
]), rn = /* @__PURE__ */ new Set([
|
|
2058
2078
|
"camera",
|
|
2059
2079
|
"microphone",
|
|
2060
2080
|
"geolocation",
|
|
2061
2081
|
"clipboardWrite"
|
|
2062
|
-
]),
|
|
2082
|
+
]), an = (e, t) => e === void 0 ? !0 : typeof e != "object" || !e || Array.isArray(e) ? !1 : Object.keys(e).every((e) => t.has(e)), on = (e) => !(!en.test(e.resourceUri) || typeof e.html != "string" || e.html.length === 0 || e.html.length > tn || !an(e.csp, nn) || !an(e.permissions, rn));
|
|
2063
2083
|
//#endregion
|
|
2064
2084
|
//#region src/ui/McpAppFrame.tsx
|
|
2065
|
-
function
|
|
2066
|
-
return
|
|
2085
|
+
function sn({ html: e, title: t, resourceUri: n, csp: r, permissions: i, className: a }) {
|
|
2086
|
+
return on({
|
|
2067
2087
|
html: e,
|
|
2068
2088
|
resourceUri: n,
|
|
2069
2089
|
csp: r,
|
|
@@ -2078,14 +2098,14 @@ function an({ html: e, title: t, resourceUri: n, csp: r, permissions: i, classNa
|
|
|
2078
2098
|
}
|
|
2079
2099
|
//#endregion
|
|
2080
2100
|
//#region src/ui/BaileyToolSteps.tsx
|
|
2081
|
-
function
|
|
2101
|
+
function cn({ toolName: e, resolveActivityIcon: t }) {
|
|
2082
2102
|
let n = t?.(e);
|
|
2083
2103
|
return n === 0 || n && n !== !0 ? /* @__PURE__ */ v("span", {
|
|
2084
2104
|
className: "bailey-activity-icon",
|
|
2085
2105
|
children: n
|
|
2086
2106
|
}) : null;
|
|
2087
2107
|
}
|
|
2088
|
-
function
|
|
2108
|
+
function ln({ steps: e, resolveActivityIcon: t }) {
|
|
2089
2109
|
let n = e.filter((e) => e.status === "running");
|
|
2090
2110
|
return n.length === 0 ? null : /* @__PURE__ */ v("div", {
|
|
2091
2111
|
className: "bailey-tool-steps-live",
|
|
@@ -2094,7 +2114,7 @@ function sn({ steps: e, resolveActivityIcon: t }) {
|
|
|
2094
2114
|
children: n.map((e) => /* @__PURE__ */ y("div", {
|
|
2095
2115
|
className: "bailey-activity-line",
|
|
2096
2116
|
children: [
|
|
2097
|
-
/* @__PURE__ */ v(
|
|
2117
|
+
/* @__PURE__ */ v(cn, {
|
|
2098
2118
|
toolName: e.toolName,
|
|
2099
2119
|
resolveActivityIcon: t
|
|
2100
2120
|
}),
|
|
@@ -2107,7 +2127,7 @@ function sn({ steps: e, resolveActivityIcon: t }) {
|
|
|
2107
2127
|
}, e.key))
|
|
2108
2128
|
});
|
|
2109
2129
|
}
|
|
2110
|
-
function
|
|
2130
|
+
function un({ steps: e, labels: t, resolveActivityIcon: n }) {
|
|
2111
2131
|
if (e.length === 0) return null;
|
|
2112
2132
|
let r = e.filter((e) => e.status === "failed").length, i = e.length === 1 ? t.toolStepsSummaryOne : t.toolStepsSummaryMany.replace("{count}", String(e.length)), a = r > 0 ? `${i}${t.toolStepsFailedSuffix.replace("{failed}", String(r))}` : i;
|
|
2113
2133
|
return /* @__PURE__ */ y("details", {
|
|
@@ -2117,7 +2137,7 @@ function cn({ steps: e, labels: t, resolveActivityIcon: n }) {
|
|
|
2117
2137
|
children: e.map((e) => /* @__PURE__ */ y("li", {
|
|
2118
2138
|
className: "bailey-tool-step",
|
|
2119
2139
|
children: [
|
|
2120
|
-
/* @__PURE__ */ v(
|
|
2140
|
+
/* @__PURE__ */ v(cn, {
|
|
2121
2141
|
toolName: e.toolName,
|
|
2122
2142
|
resolveActivityIcon: n
|
|
2123
2143
|
}),
|
|
@@ -2135,29 +2155,29 @@ function cn({ steps: e, labels: t, resolveActivityIcon: n }) {
|
|
|
2135
2155
|
}
|
|
2136
2156
|
//#endregion
|
|
2137
2157
|
//#region src/utils/relativeTime.ts
|
|
2138
|
-
var
|
|
2139
|
-
function
|
|
2140
|
-
return e ? Date.parse(
|
|
2158
|
+
var dn = /(Z|[+-]\d{2}:?\d{2})$/i, fn = 60, pn = 3600, mn = 24 * pn, hn = 30 * mn * 1e3;
|
|
2159
|
+
function gn(e) {
|
|
2160
|
+
return e ? Date.parse(dn.test(e) ? e : `${e}Z`) : NaN;
|
|
2141
2161
|
}
|
|
2142
|
-
function
|
|
2143
|
-
let t =
|
|
2162
|
+
function _n(e) {
|
|
2163
|
+
let t = gn(e.iso);
|
|
2144
2164
|
if (Number.isNaN(t)) return "";
|
|
2145
2165
|
let n = e.now ?? Date.now(), r = Math.max(0, n - t);
|
|
2146
2166
|
if (typeof Intl > "u" || typeof Intl.RelativeTimeFormat != "function") return e.justNowText ?? "";
|
|
2147
|
-
if (r >=
|
|
2167
|
+
if (r >= hn) return new Intl.DateTimeFormat(e.locale, { dateStyle: "medium" }).format(t);
|
|
2148
2168
|
let i = r / 1e3, a = new Intl.RelativeTimeFormat(e.locale, { numeric: "auto" });
|
|
2149
|
-
return i <
|
|
2169
|
+
return i < fn ? a.format(0, "second") : i < pn ? a.format(-Math.floor(i / fn), "minute") : i < mn ? a.format(-Math.floor(i / pn), "hour") : a.format(-Math.floor(i / mn), "day");
|
|
2150
2170
|
}
|
|
2151
2171
|
//#endregion
|
|
2152
2172
|
//#region src/ui/BaileyHistoryDrawer.tsx
|
|
2153
|
-
function
|
|
2154
|
-
let s =
|
|
2173
|
+
function vn({ client: e, pageSize: t, chat: n, labels: r, locale: i, onClose: o }) {
|
|
2174
|
+
let s = pe({
|
|
2155
2175
|
client: e,
|
|
2156
2176
|
pageSize: t
|
|
2157
2177
|
}), { loadConversation: c, newChat: l } = n, u = a((e) => c ? c(e) : Promise.reject(/* @__PURE__ */ Error("no loadConversation")), [c]), d = a(() => {
|
|
2158
2178
|
l(), o({ restoreFocusTo: "input" });
|
|
2159
2179
|
}, [l, o]);
|
|
2160
|
-
return /* @__PURE__ */ v(
|
|
2180
|
+
return /* @__PURE__ */ v(xn, {
|
|
2161
2181
|
conversations: s,
|
|
2162
2182
|
activeConversationId: n.conversationId,
|
|
2163
2183
|
selectStatus: n.historyStatus,
|
|
@@ -2169,15 +2189,15 @@ function gn({ client: e, pageSize: t, chat: n, labels: r, locale: i, onClose: o
|
|
|
2169
2189
|
locale: i
|
|
2170
2190
|
});
|
|
2171
2191
|
}
|
|
2172
|
-
var
|
|
2173
|
-
function
|
|
2174
|
-
let { conversations: m, status: h, error: g, hasMore: b, refresh:
|
|
2192
|
+
var yn = (e, t) => Object.entries(t).reduce((e, [t, n]) => e.split(`{${t}}`).join(String(n)), e), bn = (e) => !e || e.kind !== "http" ? !1 : e.status === 401 || e.status === 403;
|
|
2193
|
+
function xn({ conversations: e, activeConversationId: t, selectStatus: n, onSelect: r, onActiveDeleted: i, onNewChat: a, onClose: o, labels: l, locale: u, now: p }) {
|
|
2194
|
+
let { conversations: m, status: h, error: g, hasMore: b, refresh: x, loadMore: S, remove: C } = e, w = c(), T = c(), E = d(null), D = d(null), O = d(null), k = d(/* @__PURE__ */ new Map()), ee = d(/* @__PURE__ */ new Map()), A = d(null), j = d(null), [M, N] = f(null), [te, P] = f(null), [ne, re] = f(0), [ie, ae] = f(!1), [F, I] = f(!1), [oe, L] = f(!1), R = u ?? (typeof navigator < "u" ? navigator.language : void 0);
|
|
2175
2195
|
s(() => {
|
|
2176
|
-
|
|
2196
|
+
E.current?.focus();
|
|
2177
2197
|
}, []), s(() => {
|
|
2178
2198
|
let e = A.current;
|
|
2179
2199
|
if (!e) return;
|
|
2180
|
-
let t = e.kind === "select" ?
|
|
2200
|
+
let t = e.kind === "select" ? k.current.get(e.id) : e.kind === "delete" ? ee.current.get(e.id) : e.kind === "cancel" ? O.current : D.current;
|
|
2181
2201
|
t && (t.focus(), A.current = null);
|
|
2182
2202
|
}), s(() => {
|
|
2183
2203
|
let e = j.current;
|
|
@@ -2190,22 +2210,22 @@ function yn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2190
2210
|
b,
|
|
2191
2211
|
m
|
|
2192
2212
|
]);
|
|
2193
|
-
let
|
|
2194
|
-
j.current = m.length,
|
|
2195
|
-
},
|
|
2213
|
+
let se = () => {
|
|
2214
|
+
j.current = m.length, S();
|
|
2215
|
+
}, ce = (e) => {
|
|
2196
2216
|
A.current = {
|
|
2197
2217
|
kind: "delete",
|
|
2198
2218
|
id: e
|
|
2199
2219
|
}, N(null);
|
|
2200
|
-
},
|
|
2220
|
+
}, le = (e) => {
|
|
2201
2221
|
if (e.key === "Escape") {
|
|
2202
2222
|
if (e.stopPropagation(), M) {
|
|
2203
|
-
|
|
2223
|
+
ce(M);
|
|
2204
2224
|
return;
|
|
2205
2225
|
}
|
|
2206
2226
|
o({ restoreFocusTo: "menu" });
|
|
2207
2227
|
}
|
|
2208
|
-
},
|
|
2228
|
+
}, ue = async (e) => {
|
|
2209
2229
|
if (L(!1), e === t) {
|
|
2210
2230
|
o({ restoreFocusTo: "input" });
|
|
2211
2231
|
return;
|
|
@@ -2221,14 +2241,14 @@ function yn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2221
2241
|
return;
|
|
2222
2242
|
}
|
|
2223
2243
|
I(!1), o({ restoreFocusTo: "input" });
|
|
2224
|
-
},
|
|
2244
|
+
}, z = async (e) => {
|
|
2225
2245
|
let n = m.findIndex((t) => t.conversationId === e), r = m[n + 1] ?? m[n - 1];
|
|
2226
2246
|
A.current = r ? {
|
|
2227
2247
|
kind: "select",
|
|
2228
2248
|
id: r.conversationId
|
|
2229
2249
|
} : { kind: "newChat" }, N(null), P(null), ae(!1), re((e) => e + 1);
|
|
2230
2250
|
try {
|
|
2231
|
-
await
|
|
2251
|
+
await C({ conversationId: e }), ae(!0), e === t && i?.();
|
|
2232
2252
|
} catch {
|
|
2233
2253
|
A.current = {
|
|
2234
2254
|
kind: "delete",
|
|
@@ -2237,12 +2257,12 @@ function yn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2237
2257
|
} finally {
|
|
2238
2258
|
re((e) => e - 1);
|
|
2239
2259
|
}
|
|
2240
|
-
},
|
|
2260
|
+
}, B = h === "loading" && m.length === 0, de = h === "error" && m.length === 0, V = h === "error" && m.length > 0 && b, H = h === "loading" && m.length > 0, U = F || n === "loading", fe = B ? l.historyLoadingText : ne > 0 ? l.historyDeletingText : ie ? l.historyDeletedText : m.length > 0 ? yn(m.length === 1 ? l.historyCountTextOne : l.historyCountTextMany, { count: m.length }) : "", W = B || ne > 0;
|
|
2241
2261
|
return /* @__PURE__ */ y("section", {
|
|
2242
2262
|
role: "region",
|
|
2243
|
-
"aria-labelledby":
|
|
2263
|
+
"aria-labelledby": w,
|
|
2244
2264
|
className: "bailey-history-drawer",
|
|
2245
|
-
onKeyDown:
|
|
2265
|
+
onKeyDown: le,
|
|
2246
2266
|
children: [
|
|
2247
2267
|
/* @__PURE__ */ y("div", {
|
|
2248
2268
|
className: "bailey-history-header",
|
|
@@ -2252,23 +2272,23 @@ function yn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2252
2272
|
className: "bailey-history-icon-button",
|
|
2253
2273
|
"aria-label": l.historyBackAriaLabel,
|
|
2254
2274
|
onClick: () => o({ restoreFocusTo: "menu" }),
|
|
2255
|
-
children: /* @__PURE__ */ v(
|
|
2275
|
+
children: /* @__PURE__ */ v(zt, { className: "bailey-history-icon" })
|
|
2256
2276
|
}),
|
|
2257
2277
|
/* @__PURE__ */ v("h3", {
|
|
2258
|
-
id:
|
|
2259
|
-
ref:
|
|
2278
|
+
id: w,
|
|
2279
|
+
ref: E,
|
|
2260
2280
|
tabIndex: -1,
|
|
2261
2281
|
className: "bailey-history-heading",
|
|
2262
2282
|
children: l.historyTitle
|
|
2263
2283
|
}),
|
|
2264
2284
|
/* @__PURE__ */ y("button", {
|
|
2265
|
-
ref:
|
|
2285
|
+
ref: D,
|
|
2266
2286
|
type: "button",
|
|
2267
2287
|
className: "bailey-history-button bailey-history-new-chat",
|
|
2268
2288
|
"aria-label": l.newChatButtonText,
|
|
2269
|
-
disabled:
|
|
2289
|
+
disabled: B,
|
|
2270
2290
|
onClick: a,
|
|
2271
|
-
children: [/* @__PURE__ */ v(
|
|
2291
|
+
children: [/* @__PURE__ */ v(Pt, { className: "bailey-history-icon-small" }), /* @__PURE__ */ v("span", {
|
|
2272
2292
|
className: "bailey-history-new-chat-text",
|
|
2273
2293
|
children: l.newChatButtonText
|
|
2274
2294
|
})]
|
|
@@ -2277,9 +2297,9 @@ function yn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2277
2297
|
}),
|
|
2278
2298
|
/* @__PURE__ */ y("div", {
|
|
2279
2299
|
className: "bailey-history-body",
|
|
2280
|
-
"aria-busy":
|
|
2300
|
+
"aria-busy": B || void 0,
|
|
2281
2301
|
children: [
|
|
2282
|
-
|
|
2302
|
+
B && /* @__PURE__ */ y("div", {
|
|
2283
2303
|
"aria-hidden": "true",
|
|
2284
2304
|
children: [
|
|
2285
2305
|
/* @__PURE__ */ v("div", { className: "bailey-history-skeleton" }),
|
|
@@ -2288,25 +2308,25 @@ function yn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2288
2308
|
/* @__PURE__ */ v("div", { className: "bailey-history-skeleton" })
|
|
2289
2309
|
]
|
|
2290
2310
|
}),
|
|
2291
|
-
|
|
2311
|
+
de && /* @__PURE__ */ y("div", {
|
|
2292
2312
|
role: "alert",
|
|
2293
2313
|
className: "bailey-history-state bailey-history-state-error",
|
|
2294
2314
|
children: [
|
|
2295
|
-
/* @__PURE__ */ v(
|
|
2296
|
-
/* @__PURE__ */ v("strong", { children:
|
|
2297
|
-
/* @__PURE__ */ v("span", { children:
|
|
2315
|
+
/* @__PURE__ */ v(Vt, { className: "bailey-history-state-icon" }),
|
|
2316
|
+
/* @__PURE__ */ v("strong", { children: bn(g) ? l.historySessionExpiredTitle : l.historyErrorTitle }),
|
|
2317
|
+
/* @__PURE__ */ v("span", { children: bn(g) ? l.historySessionExpiredDescription : l.historyErrorDescription }),
|
|
2298
2318
|
/* @__PURE__ */ v("button", {
|
|
2299
2319
|
type: "button",
|
|
2300
2320
|
className: "bailey-history-button bailey-history-button-primary",
|
|
2301
|
-
onClick: () => void
|
|
2321
|
+
onClick: () => void x(),
|
|
2302
2322
|
children: l.retryButtonText
|
|
2303
2323
|
})
|
|
2304
2324
|
]
|
|
2305
2325
|
}),
|
|
2306
|
-
!
|
|
2326
|
+
!B && !de && m.length === 0 && /* @__PURE__ */ y("div", {
|
|
2307
2327
|
className: "bailey-history-state",
|
|
2308
2328
|
children: [
|
|
2309
|
-
/* @__PURE__ */ v(
|
|
2329
|
+
/* @__PURE__ */ v(jt, { className: "bailey-history-state-icon" }),
|
|
2310
2330
|
/* @__PURE__ */ v("strong", { children: l.historyEmptyTitle }),
|
|
2311
2331
|
/* @__PURE__ */ v("span", { children: l.historyEmptyDescription }),
|
|
2312
2332
|
/* @__PURE__ */ v("button", {
|
|
@@ -2325,11 +2345,11 @@ function yn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2325
2345
|
className: "bailey-history-row bailey-history-row-confirming",
|
|
2326
2346
|
children: /* @__PURE__ */ y("div", {
|
|
2327
2347
|
role: "group",
|
|
2328
|
-
"aria-labelledby":
|
|
2348
|
+
"aria-labelledby": T,
|
|
2329
2349
|
className: "bailey-history-confirm",
|
|
2330
2350
|
children: [
|
|
2331
2351
|
/* @__PURE__ */ v("span", {
|
|
2332
|
-
id:
|
|
2352
|
+
id: T,
|
|
2333
2353
|
className: "bailey-history-confirm-question",
|
|
2334
2354
|
children: l.historyDeleteConfirmQuestion
|
|
2335
2355
|
}),
|
|
@@ -2340,38 +2360,38 @@ function yn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2340
2360
|
/* @__PURE__ */ v("button", {
|
|
2341
2361
|
type: "button",
|
|
2342
2362
|
className: "bailey-history-button bailey-history-button-danger",
|
|
2343
|
-
onClick: () => void
|
|
2363
|
+
onClick: () => void z(n),
|
|
2344
2364
|
children: l.historyDeleteConfirmText
|
|
2345
2365
|
}),
|
|
2346
2366
|
/* @__PURE__ */ v("button", {
|
|
2347
|
-
ref:
|
|
2367
|
+
ref: O,
|
|
2348
2368
|
type: "button",
|
|
2349
2369
|
className: "bailey-history-button",
|
|
2350
|
-
onClick: () =>
|
|
2370
|
+
onClick: () => ce(n),
|
|
2351
2371
|
children: l.historyDeleteCancelText
|
|
2352
2372
|
})
|
|
2353
2373
|
]
|
|
2354
2374
|
})
|
|
2355
2375
|
}, n);
|
|
2356
|
-
let a =
|
|
2376
|
+
let a = _n({
|
|
2357
2377
|
iso: e.updatedAt,
|
|
2358
|
-
locale:
|
|
2378
|
+
locale: R,
|
|
2359
2379
|
now: p?.(),
|
|
2360
2380
|
justNowText: l.historyJustNowText
|
|
2361
|
-
}), o =
|
|
2381
|
+
}), o = yn(e.messageCount === 1 ? l.historyMessageCountOne : l.historyMessageCountMany, { count: e.messageCount }), s = te === n;
|
|
2362
2382
|
return /* @__PURE__ */ y("li", {
|
|
2363
2383
|
className: `bailey-history-row${i ? " bailey-history-row-active" : ""}${s ? " bailey-history-row-failed" : ""}`,
|
|
2364
2384
|
children: [
|
|
2365
2385
|
/* @__PURE__ */ y("button", {
|
|
2366
2386
|
type: "button",
|
|
2367
2387
|
ref: (e) => {
|
|
2368
|
-
e ?
|
|
2388
|
+
e ? k.current.set(n, e) : k.current.delete(n);
|
|
2369
2389
|
},
|
|
2370
2390
|
className: "bailey-history-select",
|
|
2371
2391
|
"aria-current": i ? "true" : void 0,
|
|
2372
|
-
"aria-disabled":
|
|
2392
|
+
"aria-disabled": U || void 0,
|
|
2373
2393
|
onClick: () => {
|
|
2374
|
-
|
|
2394
|
+
U || ue(n);
|
|
2375
2395
|
},
|
|
2376
2396
|
children: [/* @__PURE__ */ v("span", {
|
|
2377
2397
|
className: "bailey-history-row-title",
|
|
@@ -2397,25 +2417,25 @@ function yn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2397
2417
|
/* @__PURE__ */ v("button", {
|
|
2398
2418
|
type: "button",
|
|
2399
2419
|
ref: (e) => {
|
|
2400
|
-
e ?
|
|
2420
|
+
e ? ee.current.set(n, e) : ee.current.delete(n);
|
|
2401
2421
|
},
|
|
2402
2422
|
className: "bailey-history-icon-button bailey-history-delete",
|
|
2403
|
-
"aria-label":
|
|
2423
|
+
"aria-label": yn(l.historyDeleteAriaLabel, { title: r }),
|
|
2404
2424
|
onClick: () => {
|
|
2405
2425
|
P(null), ae(!1), A.current = { kind: "cancel" }, N(n);
|
|
2406
2426
|
},
|
|
2407
|
-
children: /* @__PURE__ */ v(
|
|
2427
|
+
children: /* @__PURE__ */ v(Bt, { className: "bailey-history-icon" })
|
|
2408
2428
|
}),
|
|
2409
2429
|
s && /* @__PURE__ */ y("div", {
|
|
2410
2430
|
role: "alert",
|
|
2411
2431
|
className: "bailey-history-row-error",
|
|
2412
2432
|
children: [
|
|
2413
|
-
/* @__PURE__ */ v(
|
|
2433
|
+
/* @__PURE__ */ v(Vt, { className: "bailey-history-icon-small" }),
|
|
2414
2434
|
/* @__PURE__ */ v("span", { children: l.historyDeleteFailedText }),
|
|
2415
2435
|
/* @__PURE__ */ v("button", {
|
|
2416
2436
|
type: "button",
|
|
2417
2437
|
className: "bailey-history-button bailey-history-button-small",
|
|
2418
|
-
onClick: () => void
|
|
2438
|
+
onClick: () => void z(n),
|
|
2419
2439
|
children: l.historyDeleteRetryText
|
|
2420
2440
|
}),
|
|
2421
2441
|
/* @__PURE__ */ v("button", {
|
|
@@ -2437,24 +2457,24 @@ function yn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2437
2457
|
}),
|
|
2438
2458
|
b && m.length > 0 && /* @__PURE__ */ v("div", {
|
|
2439
2459
|
className: "bailey-history-more",
|
|
2440
|
-
children:
|
|
2460
|
+
children: V ? /* @__PURE__ */ y("div", {
|
|
2441
2461
|
role: "alert",
|
|
2442
2462
|
className: "bailey-history-inline-error",
|
|
2443
2463
|
children: [/* @__PURE__ */ v("span", { children: l.historyLoadMoreErrorText }), /* @__PURE__ */ v("button", {
|
|
2444
2464
|
type: "button",
|
|
2445
2465
|
className: "bailey-history-button",
|
|
2446
|
-
onClick:
|
|
2466
|
+
onClick: se,
|
|
2447
2467
|
children: l.retryButtonText
|
|
2448
2468
|
})]
|
|
2449
2469
|
}) : /* @__PURE__ */ y("button", {
|
|
2450
2470
|
type: "button",
|
|
2451
2471
|
className: "bailey-history-button",
|
|
2452
|
-
disabled:
|
|
2453
|
-
onClick:
|
|
2454
|
-
children: [
|
|
2472
|
+
disabled: H,
|
|
2473
|
+
onClick: se,
|
|
2474
|
+
children: [H && /* @__PURE__ */ v("span", {
|
|
2455
2475
|
className: "bailey-history-spinner",
|
|
2456
2476
|
"aria-hidden": "true"
|
|
2457
|
-
}),
|
|
2477
|
+
}), H ? l.historyLoadingMoreText : l.historyLoadMoreText]
|
|
2458
2478
|
})
|
|
2459
2479
|
})
|
|
2460
2480
|
]
|
|
@@ -2463,17 +2483,17 @@ function yn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2463
2483
|
role: "status",
|
|
2464
2484
|
"aria-live": "polite",
|
|
2465
2485
|
className: "bailey-history-status",
|
|
2466
|
-
children: [
|
|
2486
|
+
children: [W && /* @__PURE__ */ v("span", {
|
|
2467
2487
|
className: "bailey-history-spinner",
|
|
2468
2488
|
"aria-hidden": "true"
|
|
2469
|
-
}),
|
|
2489
|
+
}), fe]
|
|
2470
2490
|
})
|
|
2471
2491
|
]
|
|
2472
2492
|
});
|
|
2473
2493
|
}
|
|
2474
2494
|
//#endregion
|
|
2475
2495
|
//#region src/ui/historyLabels.ts
|
|
2476
|
-
var
|
|
2496
|
+
var Sn = {
|
|
2477
2497
|
newChatButtonText: "New chat",
|
|
2478
2498
|
retryButtonText: "Retry",
|
|
2479
2499
|
historyTitle: "Chat history",
|
|
@@ -2506,8 +2526,8 @@ var bn = {
|
|
|
2506
2526
|
historyDeleteRetryText: "Try again",
|
|
2507
2527
|
historyDeleteDismissText: "Dismiss",
|
|
2508
2528
|
historyJustNowText: "just now"
|
|
2509
|
-
},
|
|
2510
|
-
...
|
|
2529
|
+
}, Cn = "How can bailey AI help you today?", wn = "Reply to bailey AI", Tn = {
|
|
2530
|
+
...Sn,
|
|
2511
2531
|
newChatButtonText: "New chat",
|
|
2512
2532
|
newChatAriaLabel: "new chat",
|
|
2513
2533
|
historyAriaLabel: "conversation history",
|
|
@@ -2533,104 +2553,104 @@ var bn = {
|
|
|
2533
2553
|
mcpAppDefaultTitle: "MCP App",
|
|
2534
2554
|
loadEarlierButtonText: "Load earlier messages",
|
|
2535
2555
|
loadEarlierErrorText: "Couldn't load earlier messages."
|
|
2536
|
-
},
|
|
2537
|
-
...
|
|
2556
|
+
}, En = [m], Dn = {
|
|
2557
|
+
...Tt(),
|
|
2538
2558
|
p: ({ children: e }) => /* @__PURE__ */ v(_, { children: e })
|
|
2539
|
-
},
|
|
2559
|
+
}, On = i(function({ content: e, components: t }) {
|
|
2540
2560
|
return /* @__PURE__ */ v("div", {
|
|
2541
2561
|
className: "bailey-markdown-content",
|
|
2542
2562
|
children: /* @__PURE__ */ v(p, {
|
|
2543
|
-
remarkPlugins:
|
|
2563
|
+
remarkPlugins: En,
|
|
2544
2564
|
components: t,
|
|
2545
2565
|
skipHtml: !0,
|
|
2546
2566
|
children: e
|
|
2547
2567
|
})
|
|
2548
2568
|
});
|
|
2549
2569
|
});
|
|
2550
|
-
function
|
|
2570
|
+
function kn(e, t, n) {
|
|
2551
2571
|
if (e !== "streaming") return;
|
|
2552
2572
|
let r = t.filter((e) => e.turnSentAt === n?.sentAt);
|
|
2553
2573
|
return r[r.length - 1];
|
|
2554
2574
|
}
|
|
2555
|
-
function
|
|
2556
|
-
if (!(!e || e.kind === "tool_end")) return
|
|
2575
|
+
function An(e) {
|
|
2576
|
+
if (!(!e || e.kind === "tool_end")) return rt(e);
|
|
2557
2577
|
}
|
|
2558
|
-
function
|
|
2578
|
+
function jn(e) {
|
|
2559
2579
|
let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), r = t.toLocaleTimeString([], {
|
|
2560
2580
|
hour: "numeric",
|
|
2561
2581
|
minute: "2-digit"
|
|
2562
2582
|
});
|
|
2563
2583
|
return n ? `Today ${r}` : `${t.toLocaleDateString()} ${r}`;
|
|
2564
2584
|
}
|
|
2565
|
-
function
|
|
2585
|
+
function Mn({ chat: e, placeholder: t, replyPlaceholder: r = wn, emptyPlaceholder: i, suggestions: o, onHistoryClick: c, history: l, locale: m, privacyNote: _, resolveActivityIcon: b, className: x, height: S, width: C, hideDeveloperDetails: w = !1, renderMessageActions: T, renderTable: E, renderChart: D, renderMcpApp: O, labels: k, formatMessageTime: ee }) {
|
|
2566
2586
|
let { messages: A, traceEvents: j, lastRequest: M, status: N, error: te, send: P, stop: ne, retryLast: re, clearTrace: ie, clearError: ae, newChat: F } = e, [I, oe] = f(""), L = {
|
|
2567
|
-
...
|
|
2568
|
-
...
|
|
2569
|
-
},
|
|
2570
|
-
renderTable:
|
|
2571
|
-
renderChart:
|
|
2572
|
-
}), [
|
|
2587
|
+
...Tn,
|
|
2588
|
+
...k
|
|
2589
|
+
}, R = ee ?? jn, se = d(null), ce = d(null), le = d(null), ue = d(null), [z, B] = f(!1), de = d(null), V = d(!1), H = !!c || !!l, U = Ct(se), fe = d(null), W = d(null), pe = d(!0), me = u(() => Tt({
|
|
2590
|
+
renderTable: E,
|
|
2591
|
+
renderChart: D
|
|
2592
|
+
}), [E, D]), G = u(() => kn(N, j, M), [
|
|
2573
2593
|
N,
|
|
2574
2594
|
j,
|
|
2575
2595
|
M
|
|
2576
|
-
]),
|
|
2577
|
-
|
|
2578
|
-
at:
|
|
2579
|
-
length:
|
|
2580
|
-
}, ve
|
|
2581
|
-
let
|
|
2596
|
+
]), K = An(G), q = G?.kind === "tool_end" ? G.at : void 0, he = A[A.length - 1]?.content.length ?? 0, [ge, _e] = f(null), ve = ge;
|
|
2597
|
+
q !== void 0 && ge?.at !== q && (ve = {
|
|
2598
|
+
at: q,
|
|
2599
|
+
length: he
|
|
2600
|
+
}, _e(ve));
|
|
2601
|
+
let J = q !== void 0 && ve?.at === q && he <= ve.length, ye = K ?? (J ? L.thinkingHint : void 0), Y = A.length === 0, X = t ?? (Y ? i ?? Cn : r);
|
|
2582
2602
|
s(() => {
|
|
2583
|
-
let e =
|
|
2603
|
+
let e = W.current;
|
|
2584
2604
|
if (!e) return;
|
|
2585
2605
|
let t = () => {
|
|
2586
2606
|
let t = e.scrollHeight - e.scrollTop - e.clientHeight;
|
|
2587
|
-
|
|
2607
|
+
pe.current = t < 60;
|
|
2588
2608
|
};
|
|
2589
2609
|
return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
|
|
2590
2610
|
}, []), s(() => {
|
|
2591
|
-
|
|
2611
|
+
pe.current && fe.current?.scrollIntoView({
|
|
2592
2612
|
behavior: N === "streaming" ? "auto" : "smooth",
|
|
2593
2613
|
block: "nearest"
|
|
2594
2614
|
});
|
|
2595
2615
|
}, [A, N]);
|
|
2596
|
-
let
|
|
2597
|
-
|
|
2598
|
-
},
|
|
2599
|
-
let t =
|
|
2600
|
-
|
|
2616
|
+
let be = (e) => {
|
|
2617
|
+
pe.current = !0, P(e);
|
|
2618
|
+
}, xe = d(null), Se = () => {
|
|
2619
|
+
let t = W.current;
|
|
2620
|
+
pe.current = !1, xe.current = t ? {
|
|
2601
2621
|
height: t.scrollHeight,
|
|
2602
2622
|
top: t.scrollTop
|
|
2603
2623
|
} : null, e.loadEarlier?.().catch(() => {
|
|
2604
|
-
|
|
2624
|
+
xe.current = null;
|
|
2605
2625
|
});
|
|
2606
2626
|
};
|
|
2607
2627
|
s(() => {
|
|
2608
|
-
let e =
|
|
2609
|
-
!e || !t || t.scrollHeight === e.height || (t.scrollTop = e.top + (t.scrollHeight - e.height),
|
|
2628
|
+
let e = xe.current, t = W.current;
|
|
2629
|
+
!e || !t || t.scrollHeight === e.height || (t.scrollTop = e.top + (t.scrollHeight - e.height), xe.current = null);
|
|
2610
2630
|
}, [A]), s(() => {
|
|
2611
|
-
|
|
2612
|
-
}, [
|
|
2613
|
-
|
|
2614
|
-
}, [
|
|
2631
|
+
ce.current?.toggleAttribute("inert", z);
|
|
2632
|
+
}, [z]), s(() => {
|
|
2633
|
+
z || !de.current || ((de.current === "input" ? le.current : ue.current)?.focus(), de.current = null);
|
|
2634
|
+
}, [z]);
|
|
2615
2635
|
let Z = a((e) => {
|
|
2616
|
-
|
|
2636
|
+
de.current = e.restoreFocusTo, B(!1);
|
|
2617
2637
|
}, []);
|
|
2618
|
-
return /* @__PURE__ */ v(
|
|
2619
|
-
value:
|
|
2638
|
+
return /* @__PURE__ */ v(pt.Provider, {
|
|
2639
|
+
value: U,
|
|
2620
2640
|
children: /* @__PURE__ */ y("div", {
|
|
2621
|
-
ref:
|
|
2622
|
-
className: `bailey-chat-panel${
|
|
2623
|
-
style:
|
|
2624
|
-
height:
|
|
2625
|
-
width:
|
|
2641
|
+
ref: se,
|
|
2642
|
+
className: `bailey-chat-panel${x ? ` ${x}` : ""}`,
|
|
2643
|
+
style: S !== void 0 || C !== void 0 ? {
|
|
2644
|
+
height: S,
|
|
2645
|
+
width: C
|
|
2626
2646
|
} : void 0,
|
|
2627
2647
|
children: [/* @__PURE__ */ y("div", {
|
|
2628
2648
|
className: "bailey-chat-panel-inner",
|
|
2629
|
-
ref:
|
|
2649
|
+
ref: ce,
|
|
2630
2650
|
children: [
|
|
2631
2651
|
/* @__PURE__ */ y("div", {
|
|
2632
2652
|
className: "bailey-chat-transcript",
|
|
2633
|
-
ref:
|
|
2653
|
+
ref: W,
|
|
2634
2654
|
children: [
|
|
2635
2655
|
e.hasEarlier && e.loadEarlier && /* @__PURE__ */ y("div", {
|
|
2636
2656
|
className: "bailey-load-earlier",
|
|
@@ -2646,23 +2666,23 @@ function An({ chat: e, placeholder: t, replyPlaceholder: r = Sn, emptyPlaceholde
|
|
|
2646
2666
|
children: L.loadEarlierErrorText
|
|
2647
2667
|
})]
|
|
2648
2668
|
}),
|
|
2649
|
-
|
|
2669
|
+
Y && (o && o.length > 0 ? /* @__PURE__ */ y("div", {
|
|
2650
2670
|
className: "bailey-suggestions",
|
|
2651
2671
|
children: [/* @__PURE__ */ v("div", {
|
|
2652
2672
|
className: "bailey-suggestions-title",
|
|
2653
2673
|
children: L.suggestionsTitle
|
|
2654
2674
|
}), o.map((e, t) => /* @__PURE__ */ y("button", {
|
|
2655
2675
|
type: "button",
|
|
2656
|
-
onClick: () =>
|
|
2676
|
+
onClick: () => be(e.value ?? e.label),
|
|
2657
2677
|
className: "bailey-suggestion-card",
|
|
2658
|
-
children: [/* @__PURE__ */ v("span", { children: e.label }), /* @__PURE__ */ v(
|
|
2678
|
+
children: [/* @__PURE__ */ v("span", { children: e.label }), /* @__PURE__ */ v(Ot, { className: "bailey-suggestion-icon" })]
|
|
2659
2679
|
}, `${e.label}-${t}`))]
|
|
2660
2680
|
}) : /* @__PURE__ */ v("div", {
|
|
2661
2681
|
className: "bailey-empty-state",
|
|
2662
2682
|
children: L.emptyStateMessage
|
|
2663
2683
|
})),
|
|
2664
2684
|
A.map((e, t) => {
|
|
2665
|
-
let r = e.role === "assistant" && t === A.length - 1, i = N === "streaming" && r && e.content === "", a = e.role === "assistant" ?
|
|
2685
|
+
let r = e.role === "assistant" && t === A.length - 1, i = N === "streaming" && r && e.content === "", a = e.role === "assistant" ? dt(j, e.createdAt) : [], o = a.some((e) => e.status === "running");
|
|
2666
2686
|
return /* @__PURE__ */ v("div", {
|
|
2667
2687
|
className: e.role === "user" ? "bailey-message-row bailey-message-row-user" : "bailey-message-row",
|
|
2668
2688
|
children: e.role === "user" ? /* @__PURE__ */ y("div", {
|
|
@@ -2672,58 +2692,58 @@ function An({ chat: e, placeholder: t, replyPlaceholder: r = Sn, emptyPlaceholde
|
|
|
2672
2692
|
children: [/* @__PURE__ */ v("span", {
|
|
2673
2693
|
className: "bailey-message-meta-name",
|
|
2674
2694
|
children: L.youLabel
|
|
2675
|
-
}), e.createdAt !== void 0 && /* @__PURE__ */ v("span", { children:
|
|
2695
|
+
}), e.createdAt !== void 0 && /* @__PURE__ */ v("span", { children: R(e.createdAt) })]
|
|
2676
2696
|
}), /* @__PURE__ */ v("div", {
|
|
2677
2697
|
className: "bailey-user-bubble",
|
|
2678
2698
|
children: e.content
|
|
2679
2699
|
})]
|
|
2680
|
-
}) : i ? o ? /* @__PURE__ */ v(
|
|
2700
|
+
}) : i ? o ? /* @__PURE__ */ v(ln, {
|
|
2681
2701
|
steps: a,
|
|
2682
2702
|
resolveActivityIcon: b
|
|
2683
2703
|
}) : /* @__PURE__ */ v("div", {
|
|
2684
2704
|
className: "bailey-thinking-hint",
|
|
2685
|
-
children:
|
|
2705
|
+
children: K ?? L.thinkingHint
|
|
2686
2706
|
}) : /* @__PURE__ */ y("div", {
|
|
2687
2707
|
className: "bailey-assistant-message",
|
|
2688
2708
|
children: [
|
|
2689
|
-
!e.streaming && /* @__PURE__ */ v(
|
|
2709
|
+
!e.streaming && /* @__PURE__ */ v(un, {
|
|
2690
2710
|
steps: a,
|
|
2691
2711
|
labels: L,
|
|
2692
2712
|
resolveActivityIcon: b
|
|
2693
2713
|
}),
|
|
2694
|
-
/* @__PURE__ */ v(
|
|
2714
|
+
/* @__PURE__ */ v(On, {
|
|
2695
2715
|
content: e.content,
|
|
2696
|
-
components:
|
|
2716
|
+
components: me
|
|
2697
2717
|
}),
|
|
2698
|
-
e.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ v(
|
|
2718
|
+
e.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ v($t, {
|
|
2699
2719
|
src: e.src,
|
|
2700
2720
|
alt: e.alt
|
|
2701
|
-
}, t) : e.type === "mcp_app" ? /* @__PURE__ */ v(n, { children:
|
|
2721
|
+
}, t) : e.type === "mcp_app" ? /* @__PURE__ */ v(n, { children: O ? O(e) : /* @__PURE__ */ v(sn, {
|
|
2702
2722
|
...e,
|
|
2703
2723
|
title: e.title ?? L.mcpAppDefaultTitle
|
|
2704
2724
|
}) }, t) : null),
|
|
2705
|
-
e.streaming && /* @__PURE__ */ v(
|
|
2725
|
+
e.streaming && /* @__PURE__ */ v(ln, {
|
|
2706
2726
|
steps: a,
|
|
2707
2727
|
resolveActivityIcon: b
|
|
2708
2728
|
}),
|
|
2709
|
-
e.streaming &&
|
|
2729
|
+
e.streaming && ye && !o && /* @__PURE__ */ v("div", {
|
|
2710
2730
|
className: "bailey-streaming-hint",
|
|
2711
|
-
children:
|
|
2731
|
+
children: ye
|
|
2712
2732
|
}),
|
|
2713
2733
|
!e.streaming && /* @__PURE__ */ y("div", {
|
|
2714
2734
|
className: "bailey-message-actions",
|
|
2715
|
-
children: [/* @__PURE__ */ v(
|
|
2735
|
+
children: [/* @__PURE__ */ v(Ut, {
|
|
2716
2736
|
markdown: e.content,
|
|
2717
2737
|
ariaLabel: L.copyButtonAriaLabel,
|
|
2718
2738
|
tooltipDefaultText: L.copyButtonTooltipDefault,
|
|
2719
2739
|
tooltipCopiedText: L.copyButtonTooltipCopied
|
|
2720
|
-
}),
|
|
2740
|
+
}), T?.(e)]
|
|
2721
2741
|
})
|
|
2722
2742
|
]
|
|
2723
2743
|
})
|
|
2724
2744
|
}, e.id);
|
|
2725
2745
|
}),
|
|
2726
|
-
/* @__PURE__ */ v("div", { ref:
|
|
2746
|
+
/* @__PURE__ */ v("div", { ref: fe })
|
|
2727
2747
|
]
|
|
2728
2748
|
}),
|
|
2729
2749
|
te && /* @__PURE__ */ y("div", {
|
|
@@ -2745,7 +2765,7 @@ function An({ chat: e, placeholder: t, replyPlaceholder: r = Sn, emptyPlaceholde
|
|
|
2745
2765
|
})]
|
|
2746
2766
|
})]
|
|
2747
2767
|
}),
|
|
2748
|
-
!
|
|
2768
|
+
!w && /* @__PURE__ */ v(Qt, {
|
|
2749
2769
|
events: j,
|
|
2750
2770
|
lastRequest: M,
|
|
2751
2771
|
onClear: ie
|
|
@@ -2754,14 +2774,14 @@ function An({ chat: e, placeholder: t, replyPlaceholder: r = Sn, emptyPlaceholde
|
|
|
2754
2774
|
className: "bailey-input-area",
|
|
2755
2775
|
children: [/* @__PURE__ */ y("form", {
|
|
2756
2776
|
onSubmit: (e) => {
|
|
2757
|
-
e.preventDefault(), !(!I.trim() || N === "streaming") && (
|
|
2777
|
+
e.preventDefault(), !(!I.trim() || N === "streaming") && (be(I), oe(""));
|
|
2758
2778
|
},
|
|
2759
2779
|
className: "bailey-input-row",
|
|
2760
2780
|
children: [/* @__PURE__ */ v("input", {
|
|
2761
|
-
ref:
|
|
2781
|
+
ref: le,
|
|
2762
2782
|
type: "text",
|
|
2763
|
-
placeholder:
|
|
2764
|
-
"aria-label":
|
|
2783
|
+
placeholder: X,
|
|
2784
|
+
"aria-label": X,
|
|
2765
2785
|
value: I,
|
|
2766
2786
|
onChange: (e) => oe(e.target.value),
|
|
2767
2787
|
disabled: N === "streaming",
|
|
@@ -2775,10 +2795,10 @@ function An({ chat: e, placeholder: t, replyPlaceholder: r = Sn, emptyPlaceholde
|
|
|
2775
2795
|
onClick: ne,
|
|
2776
2796
|
"aria-label": L.stopAriaLabel,
|
|
2777
2797
|
className: "bailey-stop-button",
|
|
2778
|
-
children: /* @__PURE__ */ v(
|
|
2798
|
+
children: /* @__PURE__ */ v(Dt, { className: "bailey-stop-icon" })
|
|
2779
2799
|
})
|
|
2780
2800
|
}), /* @__PURE__ */ v(g.Portal, {
|
|
2781
|
-
container:
|
|
2801
|
+
container: U instanceof ShadowRoot ? U : void 0,
|
|
2782
2802
|
children: /* @__PURE__ */ y(g.Content, {
|
|
2783
2803
|
side: "top",
|
|
2784
2804
|
className: "bailey-tooltip-content",
|
|
@@ -2790,56 +2810,56 @@ function An({ chat: e, placeholder: t, replyPlaceholder: r = Sn, emptyPlaceholde
|
|
|
2790
2810
|
"aria-label": L.sendAriaLabel,
|
|
2791
2811
|
disabled: !I.trim(),
|
|
2792
2812
|
className: "bailey-send-button",
|
|
2793
|
-
children: /* @__PURE__ */ v(
|
|
2813
|
+
children: /* @__PURE__ */ v(Et, { className: "bailey-send-icon" })
|
|
2794
2814
|
})]
|
|
2795
|
-
}), (!
|
|
2815
|
+
}), (!Y || H) && /* @__PURE__ */ y(h.Root, { children: [/* @__PURE__ */ v(h.Trigger, {
|
|
2796
2816
|
asChild: !0,
|
|
2797
2817
|
children: /* @__PURE__ */ v("button", {
|
|
2798
2818
|
type: "button",
|
|
2799
|
-
ref:
|
|
2819
|
+
ref: ue,
|
|
2800
2820
|
"aria-label": L.menuAriaLabel,
|
|
2801
2821
|
className: "bailey-menu-button",
|
|
2802
|
-
children: /* @__PURE__ */ v(
|
|
2822
|
+
children: /* @__PURE__ */ v(Nt, { className: "bailey-menu-icon" })
|
|
2803
2823
|
})
|
|
2804
2824
|
}), /* @__PURE__ */ v(h.Portal, {
|
|
2805
|
-
container:
|
|
2825
|
+
container: U instanceof ShadowRoot ? U : void 0,
|
|
2806
2826
|
children: /* @__PURE__ */ y(h.Content, {
|
|
2807
2827
|
side: "top",
|
|
2808
2828
|
align: "end",
|
|
2809
2829
|
sideOffset: 8,
|
|
2810
2830
|
className: "bailey-menu-content",
|
|
2811
2831
|
onCloseAutoFocus: (e) => {
|
|
2812
|
-
|
|
2832
|
+
V.current &&= (e.preventDefault(), !1);
|
|
2813
2833
|
},
|
|
2814
|
-
children: [!
|
|
2834
|
+
children: [!Y && /* @__PURE__ */ y(h.Item, {
|
|
2815
2835
|
onSelect: () => F(),
|
|
2816
2836
|
className: "bailey-menu-item",
|
|
2817
|
-
children: [/* @__PURE__ */ v(
|
|
2818
|
-
}),
|
|
2837
|
+
children: [/* @__PURE__ */ v(Pt, { className: "bailey-menu-item-icon" }), L.newChatButtonText]
|
|
2838
|
+
}), H && /* @__PURE__ */ y(h.Item, {
|
|
2819
2839
|
onSelect: () => {
|
|
2820
2840
|
if (c) {
|
|
2821
2841
|
c();
|
|
2822
2842
|
return;
|
|
2823
2843
|
}
|
|
2824
|
-
|
|
2844
|
+
V.current = !0, B(!0);
|
|
2825
2845
|
},
|
|
2826
2846
|
className: "bailey-menu-item",
|
|
2827
|
-
children: [/* @__PURE__ */ v(
|
|
2847
|
+
children: [/* @__PURE__ */ v(jt, { className: "bailey-menu-item-icon" }), L.historyMenuItemText]
|
|
2828
2848
|
})]
|
|
2829
2849
|
})
|
|
2830
2850
|
})] })]
|
|
2831
2851
|
}),
|
|
2832
|
-
(
|
|
2852
|
+
(Y || _?.alwaysVisible) && _ && /* @__PURE__ */ v("div", {
|
|
2833
2853
|
className: "bailey-privacy-note",
|
|
2834
2854
|
children: /* @__PURE__ */ v(p, {
|
|
2835
|
-
remarkPlugins:
|
|
2836
|
-
components:
|
|
2855
|
+
remarkPlugins: En,
|
|
2856
|
+
components: Dn,
|
|
2837
2857
|
skipHtml: !0,
|
|
2838
2858
|
children: _.markdown
|
|
2839
2859
|
})
|
|
2840
2860
|
})
|
|
2841
2861
|
]
|
|
2842
|
-
}),
|
|
2862
|
+
}), z && l && !c && /* @__PURE__ */ v(vn, {
|
|
2843
2863
|
client: l.client,
|
|
2844
2864
|
pageSize: l.pageSize,
|
|
2845
2865
|
chat: e,
|
|
@@ -2852,7 +2872,7 @@ function An({ chat: e, placeholder: t, replyPlaceholder: r = Sn, emptyPlaceholde
|
|
|
2852
2872
|
}
|
|
2853
2873
|
//#endregion
|
|
2854
2874
|
//#region src/ui/BaileyFeedbackButtons.tsx
|
|
2855
|
-
var
|
|
2875
|
+
var Nn = {
|
|
2856
2876
|
feedbackGroupLabel: "Rate this response",
|
|
2857
2877
|
feedbackThumbsUpAriaLabel: "Good response",
|
|
2858
2878
|
feedbackThumbsDownAriaLabel: "Bad response",
|
|
@@ -2873,48 +2893,48 @@ var jn = {
|
|
|
2873
2893
|
feedbackReasonUnsafe: "Unsafe",
|
|
2874
2894
|
feedbackReasonTooLong: "Too long",
|
|
2875
2895
|
feedbackReasonOther: "Other"
|
|
2876
|
-
},
|
|
2896
|
+
}, Pn = 2e3, Fn = [
|
|
2877
2897
|
"inaccurate",
|
|
2878
2898
|
"unhelpful",
|
|
2879
2899
|
"unsafe",
|
|
2880
2900
|
"too_long",
|
|
2881
2901
|
"other"
|
|
2882
|
-
],
|
|
2902
|
+
], In = {
|
|
2883
2903
|
inaccurate: "feedbackReasonInaccurate",
|
|
2884
2904
|
unhelpful: "feedbackReasonUnhelpful",
|
|
2885
2905
|
unsafe: "feedbackReasonUnsafe",
|
|
2886
2906
|
too_long: "feedbackReasonTooLong",
|
|
2887
2907
|
other: "feedbackReasonOther"
|
|
2888
|
-
},
|
|
2889
|
-
function
|
|
2890
|
-
return Array.from(new Set((e ??
|
|
2908
|
+
}, Ln = (e) => Fn.includes(e) ? e : "other";
|
|
2909
|
+
function Rn(e) {
|
|
2910
|
+
return Array.from(new Set((e ?? Fn).map(Ln)));
|
|
2891
2911
|
}
|
|
2892
|
-
function
|
|
2893
|
-
return typeof e == "number" && e > 0 ? Math.min(Math.floor(e),
|
|
2912
|
+
function zn(e) {
|
|
2913
|
+
return typeof e == "number" && e > 0 ? Math.min(Math.floor(e), Pn) : Pn;
|
|
2894
2914
|
}
|
|
2895
|
-
function
|
|
2915
|
+
function Bn(e, t) {
|
|
2896
2916
|
if (e === null || t === null) return e === t;
|
|
2897
2917
|
let n = e.reasonCodes ?? [], r = t.reasonCodes ?? [];
|
|
2898
2918
|
return e.rating === t.rating && (e.comment ?? "") === (t.comment ?? "") && n.length === r.length && n.every((e, t) => e === r[t]);
|
|
2899
2919
|
}
|
|
2900
|
-
function
|
|
2901
|
-
return e.messageId ? /* @__PURE__ */ v(
|
|
2920
|
+
function Vn(e) {
|
|
2921
|
+
return e.messageId ? /* @__PURE__ */ v(Hn, { ...e }, e.messageId) : null;
|
|
2902
2922
|
}
|
|
2903
|
-
function
|
|
2923
|
+
function Hn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOptions: i, maxCommentLength: a, labels: o, className: l }) {
|
|
2904
2924
|
let u = {
|
|
2905
|
-
...
|
|
2925
|
+
...Nn,
|
|
2906
2926
|
...o
|
|
2907
|
-
}, p =
|
|
2927
|
+
}, p = Rn(i), m = zn(a), h = r ? { rating: r } : null, [b, x] = f(h), [S, C] = f(r ?? null), [w, T] = f(!1), [E, D] = f("down"), [O, k] = f([]), [ee, A] = f(""), [j, M] = f(!1), [N, te] = f(!1), [P, ne] = f(!1), [re, ie] = f(!1), ae = d(h), F = d(null), I = d(0), oe = d(!1), L = d(!0), R = d(null), se = d(null), ce = d(null), le = d(null), ue = d(null), z = wt(se), B = c(), de = `${B}-comment`, V = `${B}-counter`, H = `${B}-privacy`;
|
|
2908
2928
|
s(() => (L.current = !0, () => {
|
|
2909
2929
|
L.current = !1;
|
|
2910
2930
|
}), []), s(() => {
|
|
2911
|
-
|
|
2912
|
-
}, [
|
|
2913
|
-
|
|
2931
|
+
w && ue.current?.focus();
|
|
2932
|
+
}, [w]), s(() => {
|
|
2933
|
+
R.current && !P && !w && ((R.current === "up" ? ce : le).current?.focus(), R.current = null);
|
|
2914
2934
|
});
|
|
2915
|
-
let
|
|
2916
|
-
|
|
2917
|
-
},
|
|
2935
|
+
let U = () => {
|
|
2936
|
+
k([]), A("");
|
|
2937
|
+
}, fe = async (r) => {
|
|
2918
2938
|
try {
|
|
2919
2939
|
return r.kind === "clear" ? await n({ messageId: e }) : await t({
|
|
2920
2940
|
messageId: e,
|
|
@@ -2923,79 +2943,79 @@ function Bn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
2923
2943
|
} catch {
|
|
2924
2944
|
return !1;
|
|
2925
2945
|
}
|
|
2926
|
-
},
|
|
2946
|
+
}, W = async () => {
|
|
2927
2947
|
if (!oe.current) {
|
|
2928
2948
|
oe.current = !0, te(!0);
|
|
2929
2949
|
try {
|
|
2930
2950
|
for (; F.current && L.current;) {
|
|
2931
|
-
let e = F.current, t = e.kind === "clear" ? null : e.snapshot, n = !(e.kind === "submit" && e.formSubmit) &&
|
|
2951
|
+
let e = F.current, t = e.kind === "clear" ? null : e.snapshot, n = !(e.kind === "submit" && e.formSubmit) && Bn(t, ae.current) || await fe(e);
|
|
2932
2952
|
if (!L.current) return;
|
|
2933
2953
|
let r = F.current?.version !== e.version;
|
|
2934
|
-
!n && r || (n ? (ae.current = t,
|
|
2954
|
+
!n && r || (n ? (ae.current = t, x(t)) : (C(ae.current?.rating ?? null), ie(!0)), r || (F.current = null, ne(!1), n && e.kind === "submit" && e.formSubmit && (T(!1), M(!0), R.current = e.snapshot.rating)));
|
|
2935
2955
|
}
|
|
2936
2956
|
} finally {
|
|
2937
2957
|
oe.current = !1, L.current && te(!1);
|
|
2938
2958
|
}
|
|
2939
2959
|
}
|
|
2940
|
-
},
|
|
2960
|
+
}, pe = (e) => {
|
|
2941
2961
|
I.current += 1, F.current = {
|
|
2942
2962
|
...e,
|
|
2943
2963
|
version: I.current
|
|
2944
|
-
}, ie(!1),
|
|
2945
|
-
},
|
|
2946
|
-
|
|
2947
|
-
},
|
|
2964
|
+
}, ie(!1), W();
|
|
2965
|
+
}, me = () => {
|
|
2966
|
+
C(null), T(!1), M(!1), U(), pe({ kind: "clear" });
|
|
2967
|
+
}, G = (e) => {
|
|
2948
2968
|
if (!P) {
|
|
2949
|
-
if (
|
|
2950
|
-
|
|
2969
|
+
if (S === e) {
|
|
2970
|
+
me();
|
|
2951
2971
|
return;
|
|
2952
2972
|
}
|
|
2953
|
-
|
|
2973
|
+
C(e), M(!1), U(), e === "down" ? (D("down"), T(!0)) : T(!1), pe({
|
|
2954
2974
|
kind: "submit",
|
|
2955
2975
|
snapshot: { rating: e },
|
|
2956
2976
|
formSubmit: !1
|
|
2957
2977
|
});
|
|
2958
2978
|
}
|
|
2959
|
-
},
|
|
2960
|
-
|
|
2961
|
-
},
|
|
2962
|
-
P || (
|
|
2963
|
-
},
|
|
2979
|
+
}, K = (e) => {
|
|
2980
|
+
S !== null && (D(S), k((e?.reasonCodes ?? []).map(Ln)), A(e?.comment ?? ""), ie(!1), T(!0));
|
|
2981
|
+
}, q = () => {
|
|
2982
|
+
P || (T(!1), ie(!1), U(), R.current = E);
|
|
2983
|
+
}, he = () => {
|
|
2964
2984
|
if (P) return;
|
|
2965
|
-
let e =
|
|
2966
|
-
rating:
|
|
2985
|
+
let e = ee.trim(), t = p.filter((e) => O.includes(e)), n = {
|
|
2986
|
+
rating: E,
|
|
2967
2987
|
...t.length > 0 ? { reasonCodes: t } : {},
|
|
2968
2988
|
...e ? { comment: e } : {}
|
|
2969
2989
|
};
|
|
2970
|
-
ne(!0),
|
|
2990
|
+
ne(!0), C(E), pe({
|
|
2971
2991
|
kind: "submit",
|
|
2972
2992
|
snapshot: n,
|
|
2973
2993
|
formSubmit: !0
|
|
2974
2994
|
});
|
|
2995
|
+
}, ge = (e) => {
|
|
2996
|
+
k((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
2975
2997
|
}, _e = (e) => {
|
|
2976
|
-
|
|
2977
|
-
}, ve = (e) => {
|
|
2978
|
-
e
|
|
2979
|
-
}, ye = x !== null && b?.rating === x && !N && !C, q = !!b && (!!b.comment || (b.reasonCodes?.length ?? 0) > 0), be = N ? u.feedbackSavingText : ye ? u.feedbackThanksText : "", xe = (e) => {
|
|
2980
|
-
let t = x === e, n = e === "up" ? u.feedbackThumbsUpAriaLabel : u.feedbackThumbsDownAriaLabel, r = e === "up" ? Ft : It;
|
|
2998
|
+
e.key === "Escape" && (e.stopPropagation(), q());
|
|
2999
|
+
}, ve = S !== null && b?.rating === S && !N && !w, J = !!b && (!!b.comment || (b.reasonCodes?.length ?? 0) > 0), ye = N ? u.feedbackSavingText : ve ? u.feedbackThanksText : "", Y = (e) => {
|
|
3000
|
+
let t = S === e, n = e === "up" ? u.feedbackThumbsUpAriaLabel : u.feedbackThumbsDownAriaLabel, r = e === "up" ? Lt : Rt;
|
|
2981
3001
|
return /* @__PURE__ */ y(g.Root, { children: [/* @__PURE__ */ v(g.Trigger, {
|
|
2982
3002
|
asChild: !0,
|
|
2983
3003
|
children: /* @__PURE__ */ v("button", {
|
|
2984
|
-
ref: e === "up" ?
|
|
3004
|
+
ref: e === "up" ? ce : le,
|
|
2985
3005
|
type: "button",
|
|
2986
3006
|
className: "bailey-feedback-thumb",
|
|
2987
3007
|
"aria-pressed": t,
|
|
2988
3008
|
"aria-label": n,
|
|
2989
3009
|
"aria-busy": t && N ? !0 : void 0,
|
|
2990
3010
|
disabled: P,
|
|
2991
|
-
onClick: () =>
|
|
3011
|
+
onClick: () => G(e),
|
|
2992
3012
|
children: /* @__PURE__ */ v(r, {
|
|
2993
3013
|
className: "bailey-feedback-icon",
|
|
2994
3014
|
filled: t
|
|
2995
3015
|
})
|
|
2996
3016
|
})
|
|
2997
3017
|
}), /* @__PURE__ */ v(g.Portal, {
|
|
2998
|
-
container:
|
|
3018
|
+
container: z instanceof ShadowRoot ? z : void 0,
|
|
2999
3019
|
children: /* @__PURE__ */ y(g.Content, {
|
|
3000
3020
|
side: "top",
|
|
3001
3021
|
className: "bailey-tooltip-content",
|
|
@@ -3004,7 +3024,7 @@ function Bn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
3004
3024
|
})] });
|
|
3005
3025
|
};
|
|
3006
3026
|
return /* @__PURE__ */ y("div", {
|
|
3007
|
-
ref:
|
|
3027
|
+
ref: se,
|
|
3008
3028
|
className: `bailey-feedback${l ? ` ${l}` : ""}`,
|
|
3009
3029
|
children: [
|
|
3010
3030
|
/* @__PURE__ */ v(g.Provider, {
|
|
@@ -3014,7 +3034,7 @@ function Bn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
3014
3034
|
"aria-label": u.feedbackGroupLabel,
|
|
3015
3035
|
"aria-busy": N ? !0 : void 0,
|
|
3016
3036
|
className: "bailey-feedback-thumbs",
|
|
3017
|
-
children: [
|
|
3037
|
+
children: [Y("up"), Y("down")]
|
|
3018
3038
|
})
|
|
3019
3039
|
}),
|
|
3020
3040
|
/* @__PURE__ */ y("span", {
|
|
@@ -3023,17 +3043,17 @@ function Bn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
3023
3043
|
children: [N && /* @__PURE__ */ v("span", {
|
|
3024
3044
|
className: "bailey-feedback-spinner",
|
|
3025
3045
|
"aria-hidden": "true"
|
|
3026
|
-
}),
|
|
3046
|
+
}), ye]
|
|
3027
3047
|
}),
|
|
3028
|
-
|
|
3048
|
+
ve && /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("button", {
|
|
3029
3049
|
type: "button",
|
|
3030
3050
|
className: "bailey-feedback-link",
|
|
3031
|
-
onClick: () =>
|
|
3032
|
-
children: j ||
|
|
3051
|
+
onClick: () => K(b),
|
|
3052
|
+
children: j || J ? u.feedbackEditText : u.feedbackAddCommentText
|
|
3033
3053
|
}), /* @__PURE__ */ v("button", {
|
|
3034
3054
|
type: "button",
|
|
3035
3055
|
className: "bailey-feedback-link",
|
|
3036
|
-
onClick:
|
|
3056
|
+
onClick: me,
|
|
3037
3057
|
children: u.feedbackUndoText
|
|
3038
3058
|
})] }),
|
|
3039
3059
|
re && /* @__PURE__ */ v("span", {
|
|
@@ -3041,9 +3061,9 @@ function Bn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
3041
3061
|
className: "bailey-feedback-error",
|
|
3042
3062
|
children: u.feedbackErrorText
|
|
3043
3063
|
}),
|
|
3044
|
-
|
|
3064
|
+
w && /* @__PURE__ */ y("div", {
|
|
3045
3065
|
className: "bailey-feedback-form",
|
|
3046
|
-
onKeyDown:
|
|
3066
|
+
onKeyDown: _e,
|
|
3047
3067
|
children: [
|
|
3048
3068
|
p.length > 0 && /* @__PURE__ */ y("fieldset", {
|
|
3049
3069
|
className: "bailey-feedback-reasons",
|
|
@@ -3054,45 +3074,45 @@ function Bn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
3054
3074
|
className: "bailey-feedback-chips",
|
|
3055
3075
|
children: p.map((e, t) => /* @__PURE__ */ v("button", {
|
|
3056
3076
|
ref: t === 0 ? (e) => {
|
|
3057
|
-
|
|
3077
|
+
ue.current = e;
|
|
3058
3078
|
} : void 0,
|
|
3059
3079
|
type: "button",
|
|
3060
3080
|
className: "bailey-feedback-chip",
|
|
3061
|
-
"aria-pressed":
|
|
3081
|
+
"aria-pressed": O.includes(e),
|
|
3062
3082
|
disabled: P,
|
|
3063
|
-
onClick: () =>
|
|
3064
|
-
children: u[
|
|
3083
|
+
onClick: () => ge(e),
|
|
3084
|
+
children: u[In[e]]
|
|
3065
3085
|
}, e))
|
|
3066
3086
|
})]
|
|
3067
3087
|
}),
|
|
3068
3088
|
/* @__PURE__ */ v("label", {
|
|
3069
|
-
htmlFor:
|
|
3089
|
+
htmlFor: de,
|
|
3070
3090
|
className: "bailey-feedback-legend",
|
|
3071
3091
|
children: u.feedbackCommentLabel
|
|
3072
3092
|
}),
|
|
3073
3093
|
/* @__PURE__ */ v("textarea", {
|
|
3074
|
-
id:
|
|
3094
|
+
id: de,
|
|
3075
3095
|
ref: p.length === 0 ? (e) => {
|
|
3076
|
-
|
|
3096
|
+
ue.current = e;
|
|
3077
3097
|
} : void 0,
|
|
3078
3098
|
className: "bailey-feedback-textarea",
|
|
3079
|
-
value:
|
|
3099
|
+
value: ee,
|
|
3080
3100
|
maxLength: m,
|
|
3081
3101
|
placeholder: u.feedbackCommentPlaceholder,
|
|
3082
|
-
"aria-describedby": `${
|
|
3102
|
+
"aria-describedby": `${V} ${H}`,
|
|
3083
3103
|
disabled: P,
|
|
3084
3104
|
onChange: (e) => A(e.target.value.slice(0, m))
|
|
3085
3105
|
}),
|
|
3086
3106
|
/* @__PURE__ */ y("div", {
|
|
3087
3107
|
className: "bailey-feedback-meta",
|
|
3088
3108
|
children: [/* @__PURE__ */ v("span", {
|
|
3089
|
-
id:
|
|
3109
|
+
id: H,
|
|
3090
3110
|
className: "bailey-feedback-privacy",
|
|
3091
3111
|
children: u.feedbackPrivacyNote
|
|
3092
3112
|
}), /* @__PURE__ */ v("span", {
|
|
3093
|
-
id:
|
|
3113
|
+
id: V,
|
|
3094
3114
|
className: "bailey-feedback-counter",
|
|
3095
|
-
children: `${
|
|
3115
|
+
children: `${ee.length} / ${m}`
|
|
3096
3116
|
})]
|
|
3097
3117
|
}),
|
|
3098
3118
|
/* @__PURE__ */ y("div", {
|
|
@@ -3101,13 +3121,13 @@ function Bn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
3101
3121
|
type: "button",
|
|
3102
3122
|
className: "bailey-feedback-button",
|
|
3103
3123
|
disabled: P,
|
|
3104
|
-
onClick:
|
|
3124
|
+
onClick: q,
|
|
3105
3125
|
children: u.feedbackCancelText
|
|
3106
3126
|
}), /* @__PURE__ */ v("button", {
|
|
3107
3127
|
type: "button",
|
|
3108
3128
|
className: "bailey-feedback-button bailey-feedback-button-primary",
|
|
3109
3129
|
disabled: P,
|
|
3110
|
-
onClick:
|
|
3130
|
+
onClick: he,
|
|
3111
3131
|
children: P ? u.feedbackSavingText : u.feedbackSubmitText
|
|
3112
3132
|
})]
|
|
3113
3133
|
})
|
|
@@ -3118,6 +3138,6 @@ function Bn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
3118
3138
|
}
|
|
3119
3139
|
//#endregion
|
|
3120
3140
|
//#region src/index.ts
|
|
3121
|
-
var
|
|
3141
|
+
var Un = "0.3.1-pre.2";
|
|
3122
3142
|
//#endregion
|
|
3123
|
-
export {
|
|
3143
|
+
export { Mt as ActivityIcon, Ot as ArrowUpRightIcon, Un as BAILEYAI_CHAT_UI_VERSION, Ve as BAILEY_CHART_PROMPT_FRAGMENT, Ne as BAILEY_TABLE_GRID_ROW_THRESHOLD, H as BaileyApiError, Mn as BaileyChatPanel, fe as BaileyCleanupError, Vn as BaileyFeedbackButtons, vn as BaileyHistoryDrawer, Qt as BaileyTracePanel, Ut as CopyMarkdownButton, ie as DEFAULT_CONVERSATION_STORAGE_KEY, Et as HeartIcon, Ye as TRACE_KIND_LABEL, Rt as ThumbDownIcon, Lt as ThumbUpIcon, Oe as createBaileyClient, ke as createBaileyFeedbackHandlers, Tt as createBaileyMarkdownComponents, F as createMemoryConversationStorage, ae as createSessionConversationStorage, k as extractPseudoToolCalls, ze as extractTableData, _n as formatRelativeTime, at as formatTraceGap, it as formatTraceTime, lt as hasTraceFailure, re as isConversationIdForSub, e as isSafeMarkdownUrl, Ae as joinInstructions, te as mapTranscript, ne as mergeEarlierPage, Je as parseBaileyChartSpec, A as parseSseFrames, $ as resolveToolCall, Be as shouldUseGrid, ut as toActivityLines, dt as toToolSteps, ot as toTraceRows, ct as toTraceSegments, $e as traceEventArgsDetail, rt as traceEventHint, et as traceEventOutputDetail, nt as traceEventRawDetail, Qe as traceEventSummary, Ze as traceEventToolName, st as traceSummaryLine, V as useBaileyChat, pe as useBaileyConversations };
|