@icanbwell/baileyai-chat-ui 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/baileyai-chat-ui.cjs +3 -3
- package/dist/baileyai-chat-ui.js +726 -713
- package/dist/index.d.ts +10 -5
- 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
|
// src/utils/pseudoToolCalls.ts
|
|
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>/,
|
|
10
|
-
function
|
|
11
|
-
let t = C.exec(e)?.[1]?.trim() || "unknown_tool", n =
|
|
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>/, ee = /<arguments>([\s\S]*?)<\/arguments>/, w = /<invoke\s+name="([^"]*)"\s*>([\s\S]*?)<\/invoke>/g, T = /<parameter\s+name="([^"]*)"\s*>([\s\S]*?)<\/parameter>/g;
|
|
10
|
+
function E(e) {
|
|
11
|
+
let t = C.exec(e)?.[1]?.trim() || "unknown_tool", n = ee.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 D(e) {
|
|
18
18
|
let t = [];
|
|
19
|
-
|
|
19
|
+
w.lastIndex = 0;
|
|
20
20
|
let n;
|
|
21
|
-
for (; (n =
|
|
21
|
+
for (; (n = w.exec(e)) !== null;) {
|
|
22
22
|
let [, e, r] = n, i = {};
|
|
23
|
-
|
|
23
|
+
T.lastIndex = 0;
|
|
24
24
|
let a;
|
|
25
|
-
for (; (a =
|
|
25
|
+
for (; (a = T.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,11 +31,11 @@ function O(e) {
|
|
|
31
31
|
}
|
|
32
32
|
return t;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
let { hideOpenBlock: n = !0 } = t, r = [], i = e.replace(x, (e, t, n) => (t === "call_tool" ? r.push(
|
|
34
|
+
function O(e, t = {}) {
|
|
35
|
+
let { hideOpenBlock: n = !0 } = t, r = [], i = e.replace(x, (e, t, n) => (t === "call_tool" ? r.push(E(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(...D(n)) : r.push({
|
|
39
39
|
name: "function_result",
|
|
40
40
|
args: n.trim()
|
|
41
41
|
}), "")), a = n ? i.replace(S, "") : i;
|
|
@@ -205,7 +205,7 @@ function se() {
|
|
|
205
205
|
remove: (e) => window.sessionStorage.removeItem(e)
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function ce() {
|
|
209
209
|
let e = /* @__PURE__ */ new Map();
|
|
210
210
|
return {
|
|
211
211
|
get: (t) => e.get(t) ?? null,
|
|
@@ -214,12 +214,12 @@ function R() {
|
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
216
|
// src/logic/useBaileyChat.ts
|
|
217
|
-
var
|
|
217
|
+
var R = 200, le = 100, ue = [503, 405], de = 15e4, z = "bailey", fe = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `bailey-${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e, t, n, r) => {
|
|
218
218
|
if (t === 401 || t === 403) return `${e} isn't reachable with your current login.`;
|
|
219
219
|
let i = `${e} request failed (status ${t ?? "network error"}).`, a = (r || n || "").trim();
|
|
220
|
-
return a ? `${i} ${a.length >
|
|
220
|
+
return a ? `${i} ${a.length > R ? `${a.slice(0, R)}…` : a}` : i;
|
|
221
221
|
};
|
|
222
|
-
function
|
|
222
|
+
function B(e, t, n) {
|
|
223
223
|
if (e) try {
|
|
224
224
|
return e.get(t) || void 0;
|
|
225
225
|
} catch (e) {
|
|
@@ -227,82 +227,82 @@ function V(e, t, n) {
|
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function me(e, t) {
|
|
231
231
|
t.signal.aborted || typeof e != "string" || (t.historyStatus = e);
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function he(e, t, n, r) {
|
|
234
234
|
try {
|
|
235
235
|
e?.set(t, n);
|
|
236
236
|
} catch (e) {
|
|
237
237
|
r(e, "write");
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function ge(e, t, n) {
|
|
241
241
|
try {
|
|
242
242
|
e?.remove(t);
|
|
243
243
|
} catch (e) {
|
|
244
244
|
n(e, "remove");
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
var
|
|
248
|
-
function
|
|
247
|
+
var _e = (e, t) => t ? `${e}:${t}` : e;
|
|
248
|
+
function ve(e) {
|
|
249
249
|
let { seed: t, sub: n, storage: r, key: i, report: a } = e;
|
|
250
|
-
if (!n) return t ||
|
|
250
|
+
if (!n) return t || B(r, i, a);
|
|
251
251
|
if (t && L({
|
|
252
252
|
conversationId: t,
|
|
253
253
|
sub: n
|
|
254
254
|
})) return t;
|
|
255
|
-
let o =
|
|
255
|
+
let o = B(r, i, a);
|
|
256
256
|
if (o) {
|
|
257
257
|
if (L({
|
|
258
258
|
conversationId: o,
|
|
259
259
|
sub: n
|
|
260
260
|
})) return o;
|
|
261
|
-
|
|
261
|
+
ge(r, i, a);
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
|
-
var
|
|
265
|
-
let [S, C] = f([]), [
|
|
264
|
+
var ye = ({ transport: e, model: t, instructions: n, assistantName: r = z, tools: i = [], toolChoice: o, firstUserMessagePrefix: c, onAssistantMessageComplete: l, idleTimeoutMs: p = de, client: m, conversationId: h, sub: g, storage: _, storageKey: v = oe, sendFullTranscript: y = !1, onStorageError: b, onContextLoss: x }) => {
|
|
265
|
+
let [S, C] = f([]), [ee, w] = f([]), [T, E] = f(null), [D, k] = f("idle"), [ne, M] = f(null), N = g !== void 0 && g.trim() === "", P = N ? void 0 : g?.trim() || void 0, re = u(() => se(), []), I = N ? null : _ === void 0 ? re : _ || null, ce = d(b), R = d(x);
|
|
266
266
|
s(() => {
|
|
267
|
-
|
|
267
|
+
ce.current = b, R.current = x;
|
|
268
268
|
}, [b, x]);
|
|
269
|
-
let
|
|
269
|
+
let B = a((e, t) => {
|
|
270
270
|
try {
|
|
271
|
-
|
|
271
|
+
ce.current?.(e, t);
|
|
272
272
|
} catch {}
|
|
273
|
-
}, []),
|
|
273
|
+
}, []), ye = (e) => ve({
|
|
274
274
|
seed: h,
|
|
275
275
|
sub: P,
|
|
276
276
|
storage: I,
|
|
277
|
-
key:
|
|
277
|
+
key: _e(v, P),
|
|
278
278
|
report: e
|
|
279
|
-
}), [
|
|
279
|
+
}), [be] = f(() => {
|
|
280
280
|
let e = [];
|
|
281
281
|
return {
|
|
282
|
-
id:
|
|
282
|
+
id: ye((t, n) => void e.push({
|
|
283
283
|
error: t,
|
|
284
284
|
operation: n
|
|
285
285
|
})),
|
|
286
286
|
errors: e
|
|
287
287
|
};
|
|
288
|
-
}), [
|
|
289
|
-
|
|
290
|
-
}, [
|
|
288
|
+
}), [V, H] = f(be.id), [xe, U] = f(be.errors.length > 0), W = a((e, t) => {
|
|
289
|
+
U(!0), B(e, t);
|
|
290
|
+
}, [B]);
|
|
291
291
|
s(() => {
|
|
292
|
-
|
|
293
|
-
}, [
|
|
294
|
-
N &&
|
|
295
|
-
}, [N,
|
|
296
|
-
let
|
|
292
|
+
be.errors.forEach(({ error: e, operation: t }) => B(e, t));
|
|
293
|
+
}, [be, B]), s(() => {
|
|
294
|
+
N && B(/* @__PURE__ */ Error("sub is blank"), "key");
|
|
295
|
+
}, [N, B]);
|
|
296
|
+
let G = d(V), K = d({
|
|
297
297
|
storage: I,
|
|
298
|
-
key:
|
|
298
|
+
key: _e(v, P),
|
|
299
299
|
sub: P,
|
|
300
300
|
sendFullTranscript: y
|
|
301
301
|
});
|
|
302
302
|
s(() => {
|
|
303
|
-
|
|
303
|
+
K.current = {
|
|
304
304
|
storage: I,
|
|
305
|
-
key:
|
|
305
|
+
key: _e(v, P),
|
|
306
306
|
sub: P,
|
|
307
307
|
sendFullTranscript: y
|
|
308
308
|
};
|
|
@@ -312,50 +312,50 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
|
|
|
312
312
|
P,
|
|
313
313
|
y
|
|
314
314
|
]);
|
|
315
|
-
let
|
|
316
|
-
|
|
317
|
-
}, []),
|
|
315
|
+
let Se = _ === !1 ? "off" : xe || N ? "degraded" : "ok", [Ce, we] = f(!1), [Te, q] = f("idle"), [Ee, De] = f(!1), J = d(0), Y = d(null), X = d(null), Oe = d(!1), Z = a(() => {
|
|
316
|
+
J.current += 1, Y.current?.abort(), Y.current = null, X.current = null, Oe.current = !1, De(!1), q("idle");
|
|
317
|
+
}, []), ke = d(m);
|
|
318
318
|
s(() => {
|
|
319
|
-
|
|
319
|
+
ke.current = m;
|
|
320
320
|
}, [m]), s(() => () => Y.current?.abort(), []);
|
|
321
|
-
let
|
|
321
|
+
let Ae = d(null), je = d(""), Q = d(0), Me = d([]);
|
|
322
322
|
s(() => {
|
|
323
|
-
|
|
323
|
+
Me.current = S;
|
|
324
324
|
}, [S]);
|
|
325
|
-
let $ = d([]),
|
|
326
|
-
|
|
327
|
-
}, []),
|
|
328
|
-
|
|
325
|
+
let $ = d([]), Ne = d(/* @__PURE__ */ new Map()), Pe = d(/* @__PURE__ */ new Map()), Fe = d(null), Ie = a(() => {
|
|
326
|
+
Fe.current !== null && (clearTimeout(Fe.current), Fe.current = null);
|
|
327
|
+
}, []), Le = a((e) => {
|
|
328
|
+
Ie(), Fe.current = setTimeout(() => {
|
|
329
329
|
e.abort(new DOMException("The assistant took too long to respond. Please try again.", "TimeoutError"));
|
|
330
330
|
}, p);
|
|
331
|
-
}, [
|
|
331
|
+
}, [Ie, p]);
|
|
332
332
|
s(() => () => {
|
|
333
|
-
|
|
334
|
-
}, [
|
|
335
|
-
let
|
|
333
|
+
Ae.current?.abort(), Ie();
|
|
334
|
+
}, [Ie]);
|
|
335
|
+
let Re = a(({ reportedId: e, source: t, turn: n }) => {
|
|
336
336
|
if (n.signal.aborted || typeof e != "string" || !e) return;
|
|
337
337
|
if (t === "event") n.reportedId = e, n.reportedFromEvent = !0;
|
|
338
338
|
else if (!n.reportedFromEvent) n.reportedId = e;
|
|
339
339
|
else return;
|
|
340
|
-
if (n.heldId || e ===
|
|
341
|
-
let { sub: r, storage: i, key: a } =
|
|
340
|
+
if (n.heldId || e === G.current) return;
|
|
341
|
+
let { sub: r, storage: i, key: a } = K.current;
|
|
342
342
|
(!r || L({
|
|
343
343
|
conversationId: e,
|
|
344
344
|
sub: r
|
|
345
|
-
})) && (
|
|
346
|
-
}, [
|
|
345
|
+
})) && (G.current = e, H(e), he(i, a, e, W));
|
|
346
|
+
}, [W]), ze = a((e, t, n, r) => {
|
|
347
347
|
let i = (e) => {
|
|
348
|
-
n.push(e),
|
|
348
|
+
n.push(e), w((t) => [...t, e]);
|
|
349
349
|
};
|
|
350
350
|
if (t.type === "response.output_text.delta") {
|
|
351
351
|
if (!t.delta) return !1;
|
|
352
|
-
let n =
|
|
352
|
+
let n = Ne.current.get(e) ?? {
|
|
353
353
|
raw: "",
|
|
354
354
|
emittedCount: 0
|
|
355
355
|
};
|
|
356
356
|
n.raw += t.delta;
|
|
357
|
-
let { cleanedText: r, matches: a } =
|
|
358
|
-
if (n.emittedCount = a.length,
|
|
357
|
+
let { cleanedText: r, matches: a } = O(n.raw), o = r.trim(), s = a.slice(n.emittedCount);
|
|
358
|
+
if (n.emittedCount = a.length, Ne.current.set(e, n), Pe.current.set(e, o), C((t) => t.map((t) => t.id === e ? {
|
|
359
359
|
...t,
|
|
360
360
|
content: o
|
|
361
361
|
} : t)), s.length > 0) {
|
|
@@ -427,26 +427,26 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
|
|
|
427
427
|
turnSentAt: Q.current
|
|
428
428
|
}), !0;
|
|
429
429
|
if (t.type === "response.output_text.done") return !1;
|
|
430
|
-
if (t.type === "response.created") return
|
|
430
|
+
if (t.type === "response.created") return Re({
|
|
431
431
|
reportedId: t.response?.conversation?.id,
|
|
432
432
|
source: "event",
|
|
433
433
|
turn: r
|
|
434
|
-
}),
|
|
434
|
+
}), me(t.response?.conversation?.history_status, r), !1;
|
|
435
435
|
if (t.type === "response.completed") {
|
|
436
|
-
|
|
436
|
+
Re({
|
|
437
437
|
reportedId: t.response?.conversation?.id,
|
|
438
438
|
source: "event",
|
|
439
439
|
turn: r
|
|
440
|
-
}),
|
|
440
|
+
}), me(t.response?.conversation?.history_status, r);
|
|
441
441
|
let n = typeof t.message_id == "string" && t.message_id ? t.message_id : void 0;
|
|
442
442
|
n && C((t) => t.map((t) => t.id === e ? {
|
|
443
443
|
...t,
|
|
444
444
|
serverMessageId: n
|
|
445
445
|
} : t));
|
|
446
|
-
let i =
|
|
446
|
+
let i = Ne.current.get(e);
|
|
447
447
|
if (i) {
|
|
448
|
-
let { cleanedText: t } =
|
|
449
|
-
n !==
|
|
448
|
+
let { cleanedText: t } = O(i.raw, { hideOpenBlock: !1 }), n = t.trim();
|
|
449
|
+
n !== Pe.current.get(e) && (Pe.current.set(e, n), C((t) => t.map((t) => t.id === e ? {
|
|
450
450
|
...t,
|
|
451
451
|
content: n
|
|
452
452
|
} : t)));
|
|
@@ -490,11 +490,11 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
|
|
|
490
490
|
at: Date.now(),
|
|
491
491
|
turnSentAt: Q.current
|
|
492
492
|
}), !0;
|
|
493
|
-
}, [
|
|
494
|
-
k("streaming"), M(null),
|
|
493
|
+
}, [Re]), Be = a(async (a) => {
|
|
494
|
+
k("streaming"), M(null), we(!1);
|
|
495
495
|
let s = Date.now();
|
|
496
496
|
Q.current = s;
|
|
497
|
-
let u =
|
|
497
|
+
let u = fe(), d = {
|
|
498
498
|
id: u,
|
|
499
499
|
role: "assistant",
|
|
500
500
|
content: "",
|
|
@@ -512,8 +512,8 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
|
|
|
512
512
|
content: e.content,
|
|
513
513
|
hidden: e.hidden,
|
|
514
514
|
titleHint: e.titleHint
|
|
515
|
-
}), { sendFullTranscript: m } =
|
|
516
|
-
|
|
515
|
+
}), { sendFullTranscript: m } = K.current, h = m ? void 0 : G.current, g = h ? p.slice(-1) : p;
|
|
516
|
+
E({
|
|
517
517
|
model: t,
|
|
518
518
|
systemPrompt: n,
|
|
519
519
|
messages: g,
|
|
@@ -528,11 +528,11 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
|
|
|
528
528
|
}
|
|
529
529
|
});
|
|
530
530
|
let _ = new AbortController();
|
|
531
|
-
|
|
531
|
+
Ae.current = _, Le(_);
|
|
532
532
|
let v = {
|
|
533
533
|
signal: _.signal,
|
|
534
534
|
heldId: h
|
|
535
|
-
}, y = "", b = null, x = !1, S = !1,
|
|
535
|
+
}, y = "", b = null, x = !1, S = !1, ee = !1, T = [], D = (e, t) => {
|
|
536
536
|
k("error"), M(e);
|
|
537
537
|
let n = {
|
|
538
538
|
kind: "error",
|
|
@@ -541,8 +541,8 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
|
|
|
541
541
|
turnSentAt: s,
|
|
542
542
|
...t
|
|
543
543
|
};
|
|
544
|
-
|
|
545
|
-
},
|
|
544
|
+
T.push(n), w((e) => [...e, n]);
|
|
545
|
+
}, O = (e, t) => {
|
|
546
546
|
e.forEach((e) => {
|
|
547
547
|
if (e.type === "error") {
|
|
548
548
|
b = e.message;
|
|
@@ -552,8 +552,8 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
|
|
|
552
552
|
at: Date.now(),
|
|
553
553
|
turnSentAt: s
|
|
554
554
|
};
|
|
555
|
-
|
|
556
|
-
} else e.type === "response.output_text.delta" && e.delta && (
|
|
555
|
+
T.push(t), w((e) => [...e, t]);
|
|
556
|
+
} else e.type === "response.output_text.delta" && e.delta && (ee = !0), ze(u, e, T, v) && (S = !0);
|
|
557
557
|
}), t && (x = !0, C((e) => e.map((e) => e.id === u ? {
|
|
558
558
|
...e,
|
|
559
559
|
streaming: !1
|
|
@@ -567,18 +567,18 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
|
|
|
567
567
|
tools: i,
|
|
568
568
|
toolChoice: o,
|
|
569
569
|
...h ? { conversationId: h } : {},
|
|
570
|
-
onConversationId: (e) =>
|
|
570
|
+
onConversationId: (e) => Re({
|
|
571
571
|
reportedId: e,
|
|
572
572
|
source: "header",
|
|
573
573
|
turn: v
|
|
574
574
|
}),
|
|
575
575
|
signal: _.signal,
|
|
576
576
|
onChunk: (e) => {
|
|
577
|
-
|
|
577
|
+
Le(_), y += e;
|
|
578
578
|
let { events: t, remainder: n, done: r } = A(y);
|
|
579
|
-
y = n,
|
|
579
|
+
y = n, O(t, r);
|
|
580
580
|
let i = Date.now();
|
|
581
|
-
|
|
581
|
+
E((e) => e && e.sentAt === s ? {
|
|
582
582
|
...e,
|
|
583
583
|
streamStats: {
|
|
584
584
|
chunkCount: e.streamStats.chunkCount + 1,
|
|
@@ -588,7 +588,7 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
|
|
|
588
588
|
} : e);
|
|
589
589
|
},
|
|
590
590
|
onRequestId: (e) => {
|
|
591
|
-
|
|
591
|
+
E((t) => t && t.sentAt === s ? {
|
|
592
592
|
...t,
|
|
593
593
|
requestId: e
|
|
594
594
|
} : t);
|
|
@@ -602,49 +602,49 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
|
|
|
602
602
|
});
|
|
603
603
|
if (y.trim()) {
|
|
604
604
|
let { events: e, done: t } = A(`${y}\n\n`);
|
|
605
|
-
y = "",
|
|
605
|
+
y = "", O(e, t);
|
|
606
606
|
}
|
|
607
607
|
if (b) {
|
|
608
608
|
k("error"), M(b);
|
|
609
609
|
return;
|
|
610
610
|
}
|
|
611
611
|
if (f === "timeout" && !x) {
|
|
612
|
-
|
|
612
|
+
D(d || "The assistant took too long to respond. Please try again.", { source: "client-timeout" });
|
|
613
613
|
return;
|
|
614
614
|
}
|
|
615
615
|
if (p && !x) {
|
|
616
|
-
|
|
616
|
+
D("The connection was interrupted before the answer finished. Try again.");
|
|
617
617
|
return;
|
|
618
618
|
}
|
|
619
619
|
if (a === void 0 || a >= 400) {
|
|
620
|
-
|
|
620
|
+
D(pe(r, a, c, d), {
|
|
621
621
|
httpStatus: a,
|
|
622
622
|
rawBody: c || void 0
|
|
623
623
|
});
|
|
624
624
|
return;
|
|
625
625
|
}
|
|
626
|
-
let m = v.reportedId,
|
|
627
|
-
if (h && !v.signal.aborted && (
|
|
628
|
-
|
|
626
|
+
let m = v.reportedId, w = m !== h, j = v.historyStatus === "failed" || v.historyStatus === "empty";
|
|
627
|
+
if (h && !v.signal.aborted && (w || j)) {
|
|
628
|
+
G.current = void 0, H(void 0), ge(K.current.storage, K.current.key, W), Z(), we(!0);
|
|
629
629
|
try {
|
|
630
|
-
|
|
630
|
+
R.current?.({
|
|
631
631
|
sentId: h,
|
|
632
632
|
...m ? { reportedId: m } : {},
|
|
633
|
-
reason:
|
|
633
|
+
reason: w ? "id" : "history"
|
|
634
634
|
});
|
|
635
635
|
} catch {}
|
|
636
636
|
}
|
|
637
637
|
if (!S) {
|
|
638
|
-
|
|
638
|
+
D(`${r} returned an empty response.`);
|
|
639
639
|
return;
|
|
640
640
|
}
|
|
641
|
-
if (!
|
|
642
|
-
|
|
641
|
+
if (!ee) {
|
|
642
|
+
D(`${r} ran some tools but didn't return an answer. Try asking again.`);
|
|
643
643
|
return;
|
|
644
644
|
}
|
|
645
645
|
k("idle");
|
|
646
|
-
let te =
|
|
647
|
-
|
|
646
|
+
let te = Pe.current.get(u) ?? "";
|
|
647
|
+
E((e) => e && e.sentAt === s ? {
|
|
648
648
|
...e,
|
|
649
649
|
response: { content: te }
|
|
650
650
|
} : e), l && await l({
|
|
@@ -652,23 +652,23 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
|
|
|
652
652
|
role: "assistant",
|
|
653
653
|
content: te,
|
|
654
654
|
streaming: !1
|
|
655
|
-
},
|
|
655
|
+
}, T);
|
|
656
656
|
} catch (e) {
|
|
657
657
|
let t = e;
|
|
658
658
|
if (t?.name === "TimeoutError") {
|
|
659
|
-
|
|
659
|
+
D(t.message, { source: "client-timeout" });
|
|
660
660
|
return;
|
|
661
661
|
}
|
|
662
662
|
if (t?.name === "AbortError") {
|
|
663
663
|
k("idle");
|
|
664
664
|
return;
|
|
665
665
|
}
|
|
666
|
-
|
|
666
|
+
D(t instanceof j ? te(t, r) : t?.message || `${r} request failed.`);
|
|
667
667
|
} finally {
|
|
668
|
-
|
|
669
|
-
let e =
|
|
670
|
-
|
|
671
|
-
let t =
|
|
668
|
+
Ie();
|
|
669
|
+
let e = Pe.current.get(u) ?? "";
|
|
670
|
+
Ne.current.delete(u), Pe.current.delete(u);
|
|
671
|
+
let t = T.some((e) => e.kind === "tool_start" || e.kind === "tool_end");
|
|
672
672
|
C((e) => e.flatMap((e) => e.id === u ? e.content || t ? [{
|
|
673
673
|
...e,
|
|
674
674
|
streaming: !1
|
|
@@ -687,118 +687,118 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
|
|
|
687
687
|
o,
|
|
688
688
|
c,
|
|
689
689
|
l,
|
|
690
|
+
ze,
|
|
690
691
|
Re,
|
|
691
692
|
Le,
|
|
692
693
|
Ie,
|
|
693
|
-
|
|
694
|
-
G,
|
|
694
|
+
W,
|
|
695
695
|
Z
|
|
696
|
-
]),
|
|
697
|
-
|
|
698
|
-
}, []),
|
|
696
|
+
]), Ve = a((e) => {
|
|
697
|
+
Me.current = e, C(e);
|
|
698
|
+
}, []), He = a((e) => {
|
|
699
699
|
let t = e.trim();
|
|
700
700
|
if (!t) return;
|
|
701
|
-
|
|
701
|
+
je.current = t;
|
|
702
702
|
let n = {
|
|
703
|
-
id:
|
|
703
|
+
id: fe(),
|
|
704
704
|
role: "user",
|
|
705
705
|
content: t,
|
|
706
706
|
createdAt: Date.now()
|
|
707
707
|
}, r = [...$.current, n];
|
|
708
|
-
$.current = r,
|
|
709
|
-
}, [
|
|
710
|
-
if (
|
|
708
|
+
$.current = r, Ve([...Me.current, n]), Be(r);
|
|
709
|
+
}, [Be, Ve]), Ue = a((e, t) => {
|
|
710
|
+
if (D === "streaming") return;
|
|
711
711
|
let n = e.trim();
|
|
712
712
|
if (!n) return;
|
|
713
|
-
|
|
713
|
+
je.current = n;
|
|
714
714
|
let r = t?.trim(), i = {
|
|
715
|
-
id:
|
|
715
|
+
id: fe(),
|
|
716
716
|
role: "user",
|
|
717
717
|
content: n,
|
|
718
718
|
createdAt: Date.now(),
|
|
719
719
|
hidden: !0,
|
|
720
720
|
...r ? { titleHint: r } : {}
|
|
721
721
|
}, a = [...$.current, i];
|
|
722
|
-
$.current = a,
|
|
723
|
-
}, [
|
|
724
|
-
|
|
725
|
-
}, []),
|
|
726
|
-
if (
|
|
727
|
-
let e =
|
|
728
|
-
|
|
722
|
+
$.current = a, Be(a);
|
|
723
|
+
}, [Be, D]), We = a(() => {
|
|
724
|
+
Ae.current?.abort();
|
|
725
|
+
}, []), Ge = a(() => {
|
|
726
|
+
if (D === "streaming" || !je.current) return;
|
|
727
|
+
let e = Me.current, t = e[e.length - 1], n = t && t.role === "assistant" ? e.slice(0, -1) : e;
|
|
728
|
+
Ve(n);
|
|
729
729
|
let r = $.current, i = r[r.length - 1], a = i && i.role === "assistant" ? r.slice(0, -1) : r;
|
|
730
|
-
$.current = a,
|
|
730
|
+
$.current = a, Be(a);
|
|
731
731
|
}, [
|
|
732
|
-
ze,
|
|
733
732
|
Be,
|
|
734
|
-
|
|
735
|
-
|
|
733
|
+
Ve,
|
|
734
|
+
D
|
|
735
|
+
]), Ke = a(() => w([]), []), qe = a(() => {
|
|
736
736
|
M(null), k((e) => e === "error" ? "idle" : e);
|
|
737
|
-
}, []),
|
|
738
|
-
|
|
739
|
-
}, [Z,
|
|
740
|
-
|
|
741
|
-
}, [
|
|
737
|
+
}, []), Je = a(() => {
|
|
738
|
+
Ae.current?.abort(), Z(), we(!1), Ve([]), $.current = [], w([]), E(null), k("idle"), M(null), je.current = "";
|
|
739
|
+
}, [Z, Ve]), Ye = a(() => {
|
|
740
|
+
Je(), G.current = void 0, H(void 0), ge(K.current.storage, K.current.key, W);
|
|
741
|
+
}, [Je, W]), Xe = d(P);
|
|
742
742
|
s(() => {
|
|
743
|
-
let e =
|
|
743
|
+
let e = Xe.current;
|
|
744
744
|
if (e === P) return;
|
|
745
|
-
|
|
746
|
-
let t =
|
|
747
|
-
|
|
745
|
+
Xe.current = P, e !== void 0 && Je();
|
|
746
|
+
let t = ye(W);
|
|
747
|
+
G.current = t, H(t);
|
|
748
748
|
}, [P]);
|
|
749
|
-
let
|
|
750
|
-
|
|
749
|
+
let Ze = a((e) => {
|
|
750
|
+
Ae.current?.abort();
|
|
751
751
|
let t = e.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
|
|
752
752
|
...e,
|
|
753
753
|
streaming: !1
|
|
754
754
|
}));
|
|
755
|
-
|
|
756
|
-
}, [
|
|
757
|
-
Z(),
|
|
758
|
-
}, [Z,
|
|
759
|
-
|
|
760
|
-
}, [
|
|
755
|
+
Ve(t.filter((e) => !e.hidden)), $.current = t, w([]), E(null), k("idle"), M(null), je.current = "";
|
|
756
|
+
}, [Ve]), Qe = a((e) => {
|
|
757
|
+
Z(), Ze(e);
|
|
758
|
+
}, [Z, Ze]), $e = a((e) => {
|
|
759
|
+
G.current = e, H(e), he(K.current.storage, K.current.key, e, W), we(!1);
|
|
760
|
+
}, [W]), et = a((e) => {
|
|
761
761
|
let t = e.hasMoreBefore && e.nextBeforeAbsoluteIndex !== null;
|
|
762
|
-
X.current = t ? e.nextBeforeAbsoluteIndex : null,
|
|
763
|
-
}, []),
|
|
764
|
-
let t =
|
|
762
|
+
X.current = t ? e.nextBeforeAbsoluteIndex : null, De(t);
|
|
763
|
+
}, []), tt = a(async ({ conversationId: e }) => {
|
|
764
|
+
let t = ke.current, { sub: n } = K.current, r = !!e && (!n || L({
|
|
765
765
|
conversationId: e,
|
|
766
766
|
sub: n
|
|
767
767
|
}));
|
|
768
|
-
if (!t || !r) throw
|
|
769
|
-
|
|
770
|
-
let i =
|
|
771
|
-
Y.current = a,
|
|
768
|
+
if (!t || !r) throw q("error"), Error(t ? "invalid conversation id" : "no client");
|
|
769
|
+
Ae.current?.abort(), Z();
|
|
770
|
+
let i = J.current, a = new AbortController();
|
|
771
|
+
Y.current = a, q("loading");
|
|
772
772
|
try {
|
|
773
773
|
let n = await t.getConversation({
|
|
774
774
|
conversationId: e,
|
|
775
|
-
limit:
|
|
775
|
+
limit: le,
|
|
776
776
|
signal: a.signal
|
|
777
777
|
});
|
|
778
|
-
if (i !==
|
|
779
|
-
|
|
778
|
+
if (i !== J.current) return;
|
|
779
|
+
Ze(F({ messages: n.messages })), $e(e), et(n), q("idle");
|
|
780
780
|
} catch (e) {
|
|
781
|
-
if (i !==
|
|
782
|
-
throw
|
|
781
|
+
if (i !== J.current) return;
|
|
782
|
+
throw q("error"), e;
|
|
783
783
|
}
|
|
784
784
|
}, [
|
|
785
|
-
|
|
785
|
+
et,
|
|
786
786
|
Z,
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
]),
|
|
790
|
-
let e =
|
|
791
|
-
if (!e || !t || n === null ||
|
|
792
|
-
let r =
|
|
793
|
-
Y.current = i,
|
|
787
|
+
$e,
|
|
788
|
+
Ze
|
|
789
|
+
]), nt = a(async () => {
|
|
790
|
+
let e = ke.current, t = G.current, n = X.current;
|
|
791
|
+
if (!e || !t || n === null || Oe.current) return;
|
|
792
|
+
let r = J.current, i = new AbortController();
|
|
793
|
+
Y.current = i, Oe.current = !0, q("loading");
|
|
794
794
|
try {
|
|
795
795
|
let a = await e.getConversation({
|
|
796
796
|
conversationId: t,
|
|
797
|
-
limit:
|
|
797
|
+
limit: le,
|
|
798
798
|
beforeAbsoluteIndex: n,
|
|
799
799
|
signal: i.signal
|
|
800
800
|
});
|
|
801
|
-
if (r !==
|
|
801
|
+
if (r !== J.current) return;
|
|
802
802
|
let o = F({ messages: a.messages });
|
|
803
803
|
$.current = ie({
|
|
804
804
|
current: $.current,
|
|
@@ -808,46 +808,46 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
|
|
|
808
808
|
current: e,
|
|
809
809
|
earlier: o
|
|
810
810
|
});
|
|
811
|
-
return
|
|
812
|
-
}),
|
|
811
|
+
return Me.current = t, t;
|
|
812
|
+
}), et(a), q("idle");
|
|
813
813
|
} catch (e) {
|
|
814
|
-
if (r !==
|
|
815
|
-
throw
|
|
814
|
+
if (r !== J.current) return;
|
|
815
|
+
throw q("error"), e;
|
|
816
816
|
} finally {
|
|
817
|
-
r ===
|
|
817
|
+
r === J.current && (Oe.current = !1);
|
|
818
818
|
}
|
|
819
|
-
}, [
|
|
819
|
+
}, [et]), [rt, it] = f();
|
|
820
820
|
return {
|
|
821
|
-
conversationId:
|
|
822
|
-
persistence:
|
|
823
|
-
contextLost:
|
|
821
|
+
conversationId: V,
|
|
822
|
+
persistence: Se,
|
|
823
|
+
contextLost: Ce,
|
|
824
824
|
messages: S,
|
|
825
|
-
traceEvents:
|
|
826
|
-
lastRequest:
|
|
827
|
-
status:
|
|
825
|
+
traceEvents: ee,
|
|
826
|
+
lastRequest: T,
|
|
827
|
+
status: D,
|
|
828
828
|
error: ne,
|
|
829
|
-
send:
|
|
830
|
-
sendHidden:
|
|
831
|
-
stop:
|
|
832
|
-
retryLast:
|
|
833
|
-
clearTrace:
|
|
834
|
-
clearError:
|
|
835
|
-
newChat:
|
|
836
|
-
loadMessages:
|
|
837
|
-
loadConversation:
|
|
838
|
-
loadEarlier:
|
|
839
|
-
hasEarlier:
|
|
840
|
-
historyStatus:
|
|
829
|
+
send: He,
|
|
830
|
+
sendHidden: Ue,
|
|
831
|
+
stop: We,
|
|
832
|
+
retryLast: Ge,
|
|
833
|
+
clearTrace: Ke,
|
|
834
|
+
clearError: qe,
|
|
835
|
+
newChat: Ye,
|
|
836
|
+
loadMessages: Qe,
|
|
837
|
+
loadConversation: tt,
|
|
838
|
+
loadEarlier: nt,
|
|
839
|
+
hasEarlier: Ee,
|
|
840
|
+
historyStatus: Te,
|
|
841
841
|
feedback: u(() => {
|
|
842
|
-
if (!m ||
|
|
842
|
+
if (!m || rt === m) return;
|
|
843
843
|
let e = ae({
|
|
844
844
|
client: m,
|
|
845
|
-
getConversationId: () =>
|
|
845
|
+
getConversationId: () => V
|
|
846
846
|
}), t = async (e) => {
|
|
847
847
|
try {
|
|
848
848
|
await e();
|
|
849
849
|
} catch (e) {
|
|
850
|
-
throw e instanceof j && e.status
|
|
850
|
+
throw e instanceof j && ue.includes(e.status) && it(m), e;
|
|
851
851
|
}
|
|
852
852
|
}, n = (e, t) => C((n) => n.map((n) => n.serverMessageId === e ? {
|
|
853
853
|
...n,
|
|
@@ -869,15 +869,15 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
|
|
|
869
869
|
};
|
|
870
870
|
}, [
|
|
871
871
|
m,
|
|
872
|
-
|
|
873
|
-
|
|
872
|
+
V,
|
|
873
|
+
rt
|
|
874
874
|
])
|
|
875
875
|
};
|
|
876
|
-
},
|
|
876
|
+
}, be = (e) => e instanceof j ? e : new j({
|
|
877
877
|
status: 0,
|
|
878
878
|
kind: "network"
|
|
879
879
|
});
|
|
880
|
-
function
|
|
880
|
+
function V(e) {
|
|
881
881
|
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([]);
|
|
882
882
|
s(() => {
|
|
883
883
|
h.current = e.client, g.current = r;
|
|
@@ -900,7 +900,7 @@ function _e(e) {
|
|
|
900
900
|
}), _.current = r.nextCursor, m(r.nextCursor), u(null), c("idle");
|
|
901
901
|
} catch (e) {
|
|
902
902
|
if (n.signal.aborted) return;
|
|
903
|
-
u(
|
|
903
|
+
u(be(e)), c("error");
|
|
904
904
|
}
|
|
905
905
|
}, [t]);
|
|
906
906
|
s(() => {
|
|
@@ -937,37 +937,37 @@ function _e(e) {
|
|
|
937
937
|
};
|
|
938
938
|
}
|
|
939
939
|
// src/client/routes.ts
|
|
940
|
-
function
|
|
940
|
+
function H(e) {
|
|
941
941
|
return e.replace(/\/+$/, "");
|
|
942
942
|
}
|
|
943
|
-
function
|
|
943
|
+
function xe(e, t) {
|
|
944
944
|
let n = new URLSearchParams();
|
|
945
945
|
for (let [e, r] of Object.entries(t)) r !== void 0 && n.set(e, String(r));
|
|
946
946
|
let r = n.toString();
|
|
947
947
|
return r ? `${e}?${r}` : e;
|
|
948
948
|
}
|
|
949
|
-
var
|
|
949
|
+
var U = {
|
|
950
950
|
responses(e) {
|
|
951
|
-
return `${
|
|
951
|
+
return `${H(e)}/responses`;
|
|
952
952
|
},
|
|
953
953
|
conversations(e, t) {
|
|
954
|
-
return
|
|
954
|
+
return xe(`${H(e)}/conversations`, {
|
|
955
955
|
limit: t.limit,
|
|
956
956
|
cursor: t.cursor
|
|
957
957
|
});
|
|
958
958
|
},
|
|
959
959
|
conversation(e, t, n) {
|
|
960
|
-
return
|
|
960
|
+
return xe(`${H(e)}/conversations/${encodeURIComponent(t)}`, {
|
|
961
961
|
limit: n.limit,
|
|
962
962
|
before_absolute_index: n.beforeAbsoluteIndex
|
|
963
963
|
});
|
|
964
964
|
},
|
|
965
965
|
feedback(e, t, n) {
|
|
966
|
-
return `${
|
|
966
|
+
return `${H(e)}/conversations/${encodeURIComponent(t)}/messages/${encodeURIComponent(n)}/feedback`;
|
|
967
967
|
}
|
|
968
968
|
};
|
|
969
969
|
// src/client/createBaileyClient.ts
|
|
970
|
-
function
|
|
970
|
+
function W(e) {
|
|
971
971
|
return {
|
|
972
972
|
status: void 0,
|
|
973
973
|
text: "",
|
|
@@ -976,30 +976,30 @@ function G(e) {
|
|
|
976
976
|
...e ? { errorCause: e.cause } : {}
|
|
977
977
|
};
|
|
978
978
|
}
|
|
979
|
-
var
|
|
980
|
-
function
|
|
979
|
+
var G = "The assistant took too long to respond. Please try again.";
|
|
980
|
+
function K(e) {
|
|
981
981
|
return {
|
|
982
982
|
status: e.status,
|
|
983
983
|
text: "",
|
|
984
|
-
errorMessage:
|
|
984
|
+
errorMessage: G,
|
|
985
985
|
errorKind: "timeout",
|
|
986
986
|
errorCause: e.cause,
|
|
987
987
|
...e.status === void 0 ? {} : { interrupted: !0 }
|
|
988
988
|
};
|
|
989
989
|
}
|
|
990
|
-
var
|
|
990
|
+
var Se = 3e4, Ce = 155e3, we = "x-chat-id", Te = "header", q = "body", Ee = "x-request-id", De = "x-conversation-id", J = "x-message-id", Y = (e) => e && typeof e == "object" ? e : {}, X = (e, t = "") => typeof e == "string" ? e : t, Oe = (e, t = 0) => typeof e == "number" ? e : t;
|
|
991
991
|
function Z(e) {
|
|
992
992
|
let t = Y(e);
|
|
993
993
|
return {
|
|
994
994
|
conversationId: X(t.conversation_id),
|
|
995
995
|
title: typeof t.title == "string" ? t.title : null,
|
|
996
996
|
status: X(t.status),
|
|
997
|
-
messageCount:
|
|
997
|
+
messageCount: Oe(t.message_count),
|
|
998
998
|
createdAt: X(t.created_at),
|
|
999
999
|
updatedAt: X(t.updated_at)
|
|
1000
1000
|
};
|
|
1001
1001
|
}
|
|
1002
|
-
function
|
|
1002
|
+
function ke(e) {
|
|
1003
1003
|
if (!e || typeof e != "object") return null;
|
|
1004
1004
|
let t = Y(e);
|
|
1005
1005
|
return {
|
|
@@ -1009,7 +1009,7 @@ function Oe(e) {
|
|
|
1009
1009
|
...typeof t.updated_at == "string" ? { updatedAt: t.updated_at } : {}
|
|
1010
1010
|
};
|
|
1011
1011
|
}
|
|
1012
|
-
function
|
|
1012
|
+
function Ae(e) {
|
|
1013
1013
|
let t = Y(e);
|
|
1014
1014
|
return {
|
|
1015
1015
|
messageId: X(t.message_id),
|
|
@@ -1017,10 +1017,10 @@ function ke(e) {
|
|
|
1017
1017
|
content: X(t.content),
|
|
1018
1018
|
hidden: t.hidden === !0,
|
|
1019
1019
|
createdAt: X(t.created_at),
|
|
1020
|
-
feedback:
|
|
1020
|
+
feedback: ke(t.feedback)
|
|
1021
1021
|
};
|
|
1022
1022
|
}
|
|
1023
|
-
function
|
|
1023
|
+
function je(e) {
|
|
1024
1024
|
let t = new AbortController(), n = !1, r = setTimeout(() => {
|
|
1025
1025
|
n = !0, t.abort();
|
|
1026
1026
|
}, e.timeoutMs), i = () => t.abort(e.caller?.reason);
|
|
@@ -1042,54 +1042,64 @@ function Q(e) {
|
|
|
1042
1042
|
kind: "aborted"
|
|
1043
1043
|
});
|
|
1044
1044
|
}
|
|
1045
|
-
function
|
|
1046
|
-
let { baseUrl: t, getHeaders: n, onAuthError: r } = e,
|
|
1047
|
-
if (
|
|
1048
|
-
let
|
|
1049
|
-
function
|
|
1045
|
+
function Me(e) {
|
|
1046
|
+
let { baseUrl: t, getHeaders: n, onAuthError: r, refreshAuth: i } = e, a = e.requestTimeoutMs ?? Se, o = e.idleTimeoutMs ?? Ce, s = e.conversationVia ?? Te;
|
|
1047
|
+
if (s !== Te && s !== q) throw TypeError("createBaileyClient: conversationVia must be 'header' or 'body'");
|
|
1048
|
+
let c = e.fetch ?? ((e, t) => globalThis.fetch(e, t));
|
|
1049
|
+
function l(t) {
|
|
1050
1050
|
try {
|
|
1051
1051
|
e.onCleanupError?.(new M({ operation: t }));
|
|
1052
1052
|
} catch {}
|
|
1053
1053
|
}
|
|
1054
|
-
function
|
|
1054
|
+
function u(e) {
|
|
1055
1055
|
e.kind === "http" && (e.status === 401 || e.status === 403) && r?.(e);
|
|
1056
1056
|
}
|
|
1057
|
-
async function
|
|
1058
|
-
|
|
1057
|
+
async function d(e) {
|
|
1058
|
+
if (e.status !== 401) return !1;
|
|
1059
|
+
try {
|
|
1060
|
+
await i?.();
|
|
1061
|
+
} catch {
|
|
1062
|
+
return !1;
|
|
1063
|
+
}
|
|
1064
|
+
return e.body?.cancel().catch(() => l("cancel-response-body")), !0;
|
|
1065
|
+
}
|
|
1066
|
+
async function f(e) {
|
|
1067
|
+
let t = je({
|
|
1059
1068
|
caller: e.signal,
|
|
1060
|
-
timeoutMs:
|
|
1069
|
+
timeoutMs: a
|
|
1061
1070
|
});
|
|
1062
1071
|
try {
|
|
1063
|
-
let r
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1072
|
+
let r = async () => {
|
|
1073
|
+
let r;
|
|
1074
|
+
try {
|
|
1075
|
+
r = {
|
|
1076
|
+
Accept: "application/json",
|
|
1077
|
+
...await n()
|
|
1078
|
+
};
|
|
1079
|
+
} catch {
|
|
1080
|
+
throw new j({
|
|
1081
|
+
status: 0,
|
|
1082
|
+
kind: "network"
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
if (t.signal.aborted) throw Q(t);
|
|
1086
|
+
e.body !== void 0 && (r["Content-Type"] = "application/json");
|
|
1087
|
+
try {
|
|
1088
|
+
return await c(e.url, {
|
|
1089
|
+
method: e.method,
|
|
1090
|
+
headers: r,
|
|
1091
|
+
...e.body === void 0 ? {} : { body: JSON.stringify(e.body) },
|
|
1092
|
+
signal: t.signal
|
|
1093
|
+
});
|
|
1094
|
+
} catch (e) {
|
|
1095
|
+
throw t.signal.aborted ? Q(t) : new j({
|
|
1096
|
+
status: 0,
|
|
1097
|
+
kind: "network",
|
|
1098
|
+
cause: e
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
}, i = await r();
|
|
1102
|
+
if (await d(i) && (i = await r()), !i.ok) throw i.body?.cancel().catch(() => l("cancel-response-body")), new j({
|
|
1093
1103
|
status: i.status,
|
|
1094
1104
|
kind: "http"
|
|
1095
1105
|
});
|
|
@@ -1117,7 +1127,7 @@ function je(e) {
|
|
|
1117
1127
|
return;
|
|
1118
1128
|
}
|
|
1119
1129
|
} catch (e) {
|
|
1120
|
-
throw e instanceof j &&
|
|
1130
|
+
throw e instanceof j && u(e), e;
|
|
1121
1131
|
} finally {
|
|
1122
1132
|
t.dispose();
|
|
1123
1133
|
}
|
|
@@ -1126,34 +1136,23 @@ function je(e) {
|
|
|
1126
1136
|
streamChat: async (e) => {
|
|
1127
1137
|
let r = new AbortController(), i = () => r.abort(e.signal.reason);
|
|
1128
1138
|
e.signal.aborted ? i() : e.signal.addEventListener("abort", i, { once: !0 });
|
|
1129
|
-
let
|
|
1130
|
-
clearTimeout(
|
|
1131
|
-
|
|
1132
|
-
},
|
|
1133
|
-
},
|
|
1134
|
-
if (
|
|
1135
|
-
cause:
|
|
1139
|
+
let a, f, p = () => {
|
|
1140
|
+
clearTimeout(a), a = setTimeout(() => {
|
|
1141
|
+
f = new DOMException(G, "TimeoutError"), r.abort(f);
|
|
1142
|
+
}, o);
|
|
1143
|
+
}, m = (t) => {
|
|
1144
|
+
if (f && !e.signal.aborted) return K({
|
|
1145
|
+
cause: f,
|
|
1136
1146
|
status: t
|
|
1137
1147
|
});
|
|
1138
1148
|
throw r.signal.reason;
|
|
1139
1149
|
};
|
|
1140
1150
|
try {
|
|
1141
|
-
|
|
1142
|
-
let i
|
|
1143
|
-
|
|
1144
|
-
i
|
|
1145
|
-
|
|
1146
|
-
...await n()
|
|
1147
|
-
};
|
|
1148
|
-
} catch {
|
|
1149
|
-
return G();
|
|
1150
|
-
}
|
|
1151
|
-
if (r.signal.aborted) return p();
|
|
1152
|
-
i["Content-Type"] = "application/json", e.conversationId && o === Ce && (i[Se] = e.conversationId);
|
|
1153
|
-
let a = e.input[e.input.length - 1], u = {
|
|
1154
|
-
...a?.hidden === !0 ? { hidden: !0 } : {},
|
|
1155
|
-
...a?.titleHint ? { title_hint: a.titleHint } : {}
|
|
1156
|
-
}, d = {
|
|
1151
|
+
p();
|
|
1152
|
+
let i = e.input[e.input.length - 1], a = {
|
|
1153
|
+
...i?.hidden === !0 ? { hidden: !0 } : {},
|
|
1154
|
+
...i?.titleHint ? { title_hint: i.titleHint } : {}
|
|
1155
|
+
}, o = {
|
|
1157
1156
|
model: e.model,
|
|
1158
1157
|
instructions: e.instructions,
|
|
1159
1158
|
input: e.input.map(({ role: e, content: t }) => ({
|
|
@@ -1161,74 +1160,88 @@ function je(e) {
|
|
|
1161
1160
|
content: t
|
|
1162
1161
|
})),
|
|
1163
1162
|
stream: !0,
|
|
1164
|
-
...Object.keys(
|
|
1163
|
+
...Object.keys(a).length > 0 ? { metadata: a } : {}
|
|
1165
1164
|
};
|
|
1166
|
-
e.conversationId &&
|
|
1167
|
-
let
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1165
|
+
e.conversationId && s === q && (o.conversation = e.conversationId), e.tools.length > 0 && (o.tools = e.tools), e.toolChoice && (o.tool_choice = e.toolChoice);
|
|
1166
|
+
let f;
|
|
1167
|
+
for (let i = !1;; i = !0) {
|
|
1168
|
+
let a;
|
|
1169
|
+
try {
|
|
1170
|
+
a = {
|
|
1171
|
+
Accept: "text/event-stream",
|
|
1172
|
+
...await n()
|
|
1173
|
+
};
|
|
1174
|
+
} catch {
|
|
1175
|
+
return W();
|
|
1176
|
+
}
|
|
1177
|
+
if (r.signal.aborted) return m();
|
|
1178
|
+
a["Content-Type"] = "application/json", e.conversationId && s === Te && (a[we] = e.conversationId);
|
|
1179
|
+
try {
|
|
1180
|
+
f = await c(U.responses(t), {
|
|
1181
|
+
method: "POST",
|
|
1182
|
+
headers: a,
|
|
1183
|
+
body: JSON.stringify(o),
|
|
1184
|
+
signal: r.signal
|
|
1185
|
+
});
|
|
1186
|
+
} catch (e) {
|
|
1187
|
+
return r.signal.aborted ? m() : W({ cause: e });
|
|
1188
|
+
}
|
|
1189
|
+
if (i || !await d(f)) break;
|
|
1177
1190
|
}
|
|
1178
|
-
let h =
|
|
1191
|
+
let h = f.headers.get(Ee);
|
|
1179
1192
|
h && e.onRequestId?.(h);
|
|
1180
|
-
let g =
|
|
1181
|
-
if (g && e.onMessageId?.(g), !
|
|
1182
|
-
|
|
1183
|
-
status:
|
|
1193
|
+
let g = f.headers.get(J);
|
|
1194
|
+
if (g && e.onMessageId?.(g), !f.ok) {
|
|
1195
|
+
u(new j({
|
|
1196
|
+
status: f.status,
|
|
1184
1197
|
kind: "http"
|
|
1185
1198
|
}));
|
|
1186
|
-
let e = await
|
|
1199
|
+
let e = await f.text().catch(() => "");
|
|
1187
1200
|
return {
|
|
1188
|
-
status:
|
|
1201
|
+
status: f.status,
|
|
1189
1202
|
text: e
|
|
1190
1203
|
};
|
|
1191
1204
|
}
|
|
1192
|
-
let _ =
|
|
1193
|
-
if (_ && e.onConversationId?.(_), !
|
|
1194
|
-
status:
|
|
1205
|
+
let _ = f.headers.get(De);
|
|
1206
|
+
if (_ && e.onConversationId?.(_), !f.body) return {
|
|
1207
|
+
status: f.status,
|
|
1195
1208
|
text: ""
|
|
1196
1209
|
};
|
|
1197
|
-
let v =
|
|
1210
|
+
let v = f.body.getReader(), y = new TextDecoder(), b = () => void v.cancel(r.signal.reason).catch(() => l("cancel-stream-reader"));
|
|
1198
1211
|
r.signal.addEventListener("abort", b, { once: !0 });
|
|
1199
1212
|
try {
|
|
1200
1213
|
for (;;) {
|
|
1201
1214
|
let { done: t, value: n } = await v.read();
|
|
1202
|
-
if (r.signal.aborted) return
|
|
1215
|
+
if (r.signal.aborted) return m(f.status);
|
|
1203
1216
|
if (t) {
|
|
1204
1217
|
let t = y.decode();
|
|
1205
1218
|
t && e.onChunk(t);
|
|
1206
1219
|
break;
|
|
1207
1220
|
}
|
|
1208
|
-
|
|
1221
|
+
p(), e.onChunk(y.decode(n, { stream: !0 }));
|
|
1209
1222
|
}
|
|
1210
1223
|
} catch {
|
|
1211
|
-
if (r.signal.aborted) return
|
|
1224
|
+
if (r.signal.aborted) return m(f.status);
|
|
1212
1225
|
if (e.signal.aborted) throw e.signal.reason;
|
|
1213
1226
|
return {
|
|
1214
|
-
status:
|
|
1227
|
+
status: f.status,
|
|
1215
1228
|
text: "",
|
|
1216
1229
|
errorMessage: "Stream interrupted",
|
|
1217
1230
|
interrupted: !0
|
|
1218
1231
|
};
|
|
1219
1232
|
}
|
|
1220
1233
|
return r.signal.removeEventListener("abort", b), {
|
|
1221
|
-
status:
|
|
1234
|
+
status: f.status,
|
|
1222
1235
|
text: ""
|
|
1223
1236
|
};
|
|
1224
1237
|
} finally {
|
|
1225
|
-
clearTimeout(
|
|
1238
|
+
clearTimeout(a), e.signal.removeEventListener("abort", i);
|
|
1226
1239
|
}
|
|
1227
1240
|
},
|
|
1228
1241
|
async listConversations(e = {}) {
|
|
1229
|
-
let n = Y(await
|
|
1242
|
+
let n = Y(await f({
|
|
1230
1243
|
method: "GET",
|
|
1231
|
-
url:
|
|
1244
|
+
url: U.conversations(t, e),
|
|
1232
1245
|
signal: e.signal,
|
|
1233
1246
|
requireJsonBody: !0
|
|
1234
1247
|
}));
|
|
@@ -1238,9 +1251,9 @@ function je(e) {
|
|
|
1238
1251
|
};
|
|
1239
1252
|
},
|
|
1240
1253
|
async getConversation(e) {
|
|
1241
|
-
let n = Y(await
|
|
1254
|
+
let n = Y(await f({
|
|
1242
1255
|
method: "GET",
|
|
1243
|
-
url:
|
|
1256
|
+
url: U.conversation(t, e.conversationId, e),
|
|
1244
1257
|
signal: e.signal,
|
|
1245
1258
|
requireJsonBody: !0
|
|
1246
1259
|
}));
|
|
@@ -1250,22 +1263,22 @@ function je(e) {
|
|
|
1250
1263
|
});
|
|
1251
1264
|
return {
|
|
1252
1265
|
conversation: Z(n.conversation),
|
|
1253
|
-
messages: Array.isArray(n.messages) ? n.messages.map(
|
|
1266
|
+
messages: Array.isArray(n.messages) ? n.messages.map(Ae) : [],
|
|
1254
1267
|
hasMoreBefore: n.has_more_before === !0,
|
|
1255
1268
|
nextBeforeAbsoluteIndex: typeof n.next_before_absolute_index == "number" ? n.next_before_absolute_index : null
|
|
1256
1269
|
};
|
|
1257
1270
|
},
|
|
1258
1271
|
async deleteConversation(e) {
|
|
1259
|
-
await
|
|
1272
|
+
await f({
|
|
1260
1273
|
method: "DELETE",
|
|
1261
|
-
url:
|
|
1274
|
+
url: U.conversation(t, e.conversationId, {}),
|
|
1262
1275
|
signal: e.signal
|
|
1263
1276
|
});
|
|
1264
1277
|
},
|
|
1265
1278
|
async submitFeedback(e) {
|
|
1266
|
-
await
|
|
1279
|
+
await f({
|
|
1267
1280
|
method: "PUT",
|
|
1268
|
-
url:
|
|
1281
|
+
url: U.feedback(t, e.conversationId, e.messageId),
|
|
1269
1282
|
body: {
|
|
1270
1283
|
rating: e.rating,
|
|
1271
1284
|
...e.reasonCodes ? { reason_codes: e.reasonCodes } : {},
|
|
@@ -1275,9 +1288,9 @@ function je(e) {
|
|
|
1275
1288
|
});
|
|
1276
1289
|
},
|
|
1277
1290
|
async clearFeedback(e) {
|
|
1278
|
-
await
|
|
1291
|
+
await f({
|
|
1279
1292
|
method: "DELETE",
|
|
1280
|
-
url:
|
|
1293
|
+
url: U.feedback(t, e.conversationId, e.messageId),
|
|
1281
1294
|
signal: e.signal
|
|
1282
1295
|
});
|
|
1283
1296
|
}
|
|
@@ -1288,10 +1301,10 @@ function $(...e) {
|
|
|
1288
1301
|
return e.filter((e) => !!(e && e.trim())).join("\n\n");
|
|
1289
1302
|
}
|
|
1290
1303
|
// src/utils/toolCalls.ts
|
|
1291
|
-
var
|
|
1292
|
-
function
|
|
1304
|
+
var Ne = "call_tool", Pe = "a tool";
|
|
1305
|
+
function Fe(e, t) {
|
|
1293
1306
|
let n = {
|
|
1294
|
-
name: e ===
|
|
1307
|
+
name: e === Ne ? Pe : e,
|
|
1295
1308
|
args: null,
|
|
1296
1309
|
viaCallTool: !1
|
|
1297
1310
|
};
|
|
@@ -1304,7 +1317,7 @@ function Pe(e, t) {
|
|
|
1304
1317
|
}
|
|
1305
1318
|
if (typeof r != "object" || !r) return n;
|
|
1306
1319
|
let i = r;
|
|
1307
|
-
if (e ===
|
|
1320
|
+
if (e === Ne) {
|
|
1308
1321
|
let e = typeof i.name == "string" ? i.name : void 0;
|
|
1309
1322
|
if (!e) return n;
|
|
1310
1323
|
let t = i.arguments;
|
|
@@ -1321,32 +1334,32 @@ function Pe(e, t) {
|
|
|
1321
1334
|
};
|
|
1322
1335
|
}
|
|
1323
1336
|
// src/utils/table.ts
|
|
1324
|
-
var
|
|
1337
|
+
var Ie = 5, Le = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(Le).join(""), Re = (e) => {
|
|
1325
1338
|
if (e.tagName === "a" && e.properties?.href) return e.properties.href;
|
|
1326
1339
|
for (let t of e.children ?? []) {
|
|
1327
|
-
let e =
|
|
1340
|
+
let e = Re(t);
|
|
1328
1341
|
if (e) return e;
|
|
1329
1342
|
}
|
|
1330
|
-
},
|
|
1331
|
-
let t =
|
|
1343
|
+
}, ze = (e, t) => (e.children ?? []).find((e) => e.tagName === t), Be = (e) => {
|
|
1344
|
+
let t = Le(e), n = Re(e);
|
|
1332
1345
|
return n ? {
|
|
1333
1346
|
text: t,
|
|
1334
1347
|
href: n
|
|
1335
1348
|
} : { text: t };
|
|
1336
|
-
},
|
|
1349
|
+
}, Ve = (e) => (e.children ?? []).filter((e) => e.type === "element").map(Be), He = (e) => {
|
|
1337
1350
|
if (e.tagName !== "table") return null;
|
|
1338
|
-
let t =
|
|
1351
|
+
let t = ze(e, "thead"), n = t && ze(t, "tr");
|
|
1339
1352
|
return {
|
|
1340
|
-
headers: n ?
|
|
1341
|
-
rows: (
|
|
1353
|
+
headers: n ? Ve(n).map((e) => e.text) : [],
|
|
1354
|
+
rows: (ze(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(Ve)
|
|
1342
1355
|
};
|
|
1343
|
-
},
|
|
1356
|
+
}, Ue = (e) => e.length > 5, We = "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```", Ge = [
|
|
1344
1357
|
"bar",
|
|
1345
1358
|
"line",
|
|
1346
1359
|
"pie",
|
|
1347
1360
|
"doughnut",
|
|
1348
1361
|
"scatter"
|
|
1349
|
-
],
|
|
1362
|
+
], Ke = 8, qe = 50, Je = 8, Ye = 500, Xe = (e) => typeof e == "object" && !!e && typeof e.x == "number" && typeof e.y == "number", Ze = (e) => {
|
|
1350
1363
|
let t;
|
|
1351
1364
|
try {
|
|
1352
1365
|
t = JSON.parse(e);
|
|
@@ -1355,17 +1368,17 @@ var Fe = 5, Ie = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
|
|
|
1355
1368
|
}
|
|
1356
1369
|
if (typeof t != "object" || !t) return null;
|
|
1357
1370
|
let n = t;
|
|
1358
|
-
if (typeof n.type != "string" || !
|
|
1371
|
+
if (typeof n.type != "string" || !Ge.includes(n.type)) return null;
|
|
1359
1372
|
let r = n.type;
|
|
1360
1373
|
if (n.title !== void 0 && typeof n.title != "string") return null;
|
|
1361
1374
|
let i = n.title;
|
|
1362
1375
|
if (typeof n.data != "object" || n.data === null) return null;
|
|
1363
1376
|
let a = n.data;
|
|
1364
|
-
if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length >
|
|
1377
|
+
if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length > Ke || (r === "pie" || r === "doughnut") && a.datasets.length !== 1) return null;
|
|
1365
1378
|
for (let e of a.datasets) if (typeof e != "object" || !e || typeof e.label != "string" || !Array.isArray(e.data)) return null;
|
|
1366
1379
|
let o = a.datasets;
|
|
1367
1380
|
if (r === "scatter") {
|
|
1368
|
-
for (let e of o) if (e.data.length < 1 || e.data.length >
|
|
1381
|
+
for (let e of o) if (e.data.length < 1 || e.data.length > Ye || !e.data.every(Xe)) return null;
|
|
1369
1382
|
return {
|
|
1370
1383
|
type: r,
|
|
1371
1384
|
title: i,
|
|
@@ -1373,7 +1386,7 @@ var Fe = 5, Ie = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
|
|
|
1373
1386
|
};
|
|
1374
1387
|
}
|
|
1375
1388
|
if (!Array.isArray(a.labels) || !a.labels.every((e) => typeof e == "string")) return null;
|
|
1376
|
-
let s = a.labels, c = r === "pie" || r === "doughnut" ?
|
|
1389
|
+
let s = a.labels, c = r === "pie" || r === "doughnut" ? Je : qe;
|
|
1377
1390
|
if (s.length < 1 || s.length > c) return null;
|
|
1378
1391
|
for (let e of o) if (e.data.length !== s.length || !e.data.every((e) => typeof e == "number")) return null;
|
|
1379
1392
|
return {
|
|
@@ -1384,7 +1397,7 @@ var Fe = 5, Ie = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
|
|
|
1384
1397
|
datasets: o
|
|
1385
1398
|
}
|
|
1386
1399
|
};
|
|
1387
|
-
},
|
|
1400
|
+
}, Qe = {
|
|
1388
1401
|
tool_start: "Tool start",
|
|
1389
1402
|
tool_end: "Tool end",
|
|
1390
1403
|
pseudo_tool_call: "Narrated tool call",
|
|
@@ -1395,13 +1408,13 @@ var Fe = 5, Ie = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
|
|
|
1395
1408
|
error: "Error",
|
|
1396
1409
|
raw: "Raw event"
|
|
1397
1410
|
};
|
|
1398
|
-
function
|
|
1399
|
-
return e.kind !== "tool_start" && e.kind !== "tool_end" ? null :
|
|
1411
|
+
function $e(e) {
|
|
1412
|
+
return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : Fe(e.name, e.args);
|
|
1400
1413
|
}
|
|
1401
|
-
function
|
|
1414
|
+
function et(e, t = $e(e)) {
|
|
1402
1415
|
return e.kind === "pseudo_tool_call" ? e.name : t?.name ?? null;
|
|
1403
1416
|
}
|
|
1404
|
-
function
|
|
1417
|
+
function tt(e, t = $e(e)) {
|
|
1405
1418
|
switch (e.kind) {
|
|
1406
1419
|
case "tool_start": return t.viaCallTool ? `${t.name} (via call_tool)` : t.name;
|
|
1407
1420
|
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" : ""}`;
|
|
@@ -1414,23 +1427,23 @@ function et(e, t = Qe(e)) {
|
|
|
1414
1427
|
case "raw": return `Unrecognized event: ${e.eventType}`;
|
|
1415
1428
|
}
|
|
1416
1429
|
}
|
|
1417
|
-
function
|
|
1430
|
+
function nt(e, t = $e(e)) {
|
|
1418
1431
|
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;
|
|
1419
1432
|
}
|
|
1420
|
-
function
|
|
1433
|
+
function rt(e) {
|
|
1421
1434
|
return e.kind === "tool_end" ? e.output ?? null : e.kind === "llm_call_end" ? e.response ?? null : null;
|
|
1422
1435
|
}
|
|
1423
|
-
function
|
|
1436
|
+
function it(e) {
|
|
1424
1437
|
return e.kind === "tool_end" && e.structuredOutput ? JSON.stringify(e.structuredOutput, null, 2) : null;
|
|
1425
1438
|
}
|
|
1426
|
-
function
|
|
1439
|
+
function at(e) {
|
|
1427
1440
|
return e.kind === "raw" ? e.raw : e.kind === "error" ? e.rawBody ?? null : null;
|
|
1428
1441
|
}
|
|
1429
|
-
function
|
|
1442
|
+
function ot(e) {
|
|
1430
1443
|
switch (e.kind) {
|
|
1431
|
-
case "tool_start": return `Calling ${
|
|
1444
|
+
case "tool_start": return `Calling ${Fe(e.name, e.args).name}...`;
|
|
1432
1445
|
case "tool_end": {
|
|
1433
|
-
let t =
|
|
1446
|
+
let t = Fe(e.name, e.args).name;
|
|
1434
1447
|
return e.isError ? `${t} failed` : `${t} returned`;
|
|
1435
1448
|
}
|
|
1436
1449
|
case "pseudo_tool_call": return `${e.name} (written as text, not called)`;
|
|
@@ -1442,11 +1455,11 @@ function at(e) {
|
|
|
1442
1455
|
case "raw": return `Unrecognized event: ${e.eventType}`;
|
|
1443
1456
|
}
|
|
1444
1457
|
}
|
|
1445
|
-
function
|
|
1458
|
+
function st(e) {
|
|
1446
1459
|
let t = new Date(e);
|
|
1447
1460
|
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")}`;
|
|
1448
1461
|
}
|
|
1449
|
-
function
|
|
1462
|
+
function ct(e) {
|
|
1450
1463
|
if (e <= 0) return "+0ms";
|
|
1451
1464
|
if (e < 1e3) return `+${Math.round(e)}ms`;
|
|
1452
1465
|
let t = e / 1e3;
|
|
@@ -1454,31 +1467,31 @@ function st(e) {
|
|
|
1454
1467
|
let n = Math.floor(t / 60), r = Math.round(t % 60);
|
|
1455
1468
|
return `+${n}m${String(r).padStart(2, "0")}s`;
|
|
1456
1469
|
}
|
|
1457
|
-
function
|
|
1470
|
+
function lt(e) {
|
|
1458
1471
|
return e.map((t, n) => {
|
|
1459
|
-
let r =
|
|
1472
|
+
let r = $e(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
|
|
1460
1473
|
return {
|
|
1461
1474
|
key: `${t.at}-${n}`,
|
|
1462
1475
|
kind: t.kind,
|
|
1463
|
-
toolName:
|
|
1476
|
+
toolName: et(t, r),
|
|
1464
1477
|
isToolStart: t.kind === "tool_start",
|
|
1465
1478
|
failed: t.kind === "tool_end" && t.isError === !0,
|
|
1466
|
-
time:
|
|
1479
|
+
time: st(t.at),
|
|
1467
1480
|
gapMs: t.at - i,
|
|
1468
|
-
label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" :
|
|
1469
|
-
summary:
|
|
1470
|
-
argsDetail:
|
|
1471
|
-
outputDetail:
|
|
1472
|
-
structuredOutputDetail:
|
|
1473
|
-
rawDetail:
|
|
1481
|
+
label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" : Qe[t.kind],
|
|
1482
|
+
summary: tt(t, r),
|
|
1483
|
+
argsDetail: nt(t, r),
|
|
1484
|
+
outputDetail: rt(t),
|
|
1485
|
+
structuredOutputDetail: it(t),
|
|
1486
|
+
rawDetail: at(t)
|
|
1474
1487
|
};
|
|
1475
1488
|
});
|
|
1476
1489
|
}
|
|
1477
|
-
function
|
|
1490
|
+
function ut(e) {
|
|
1478
1491
|
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 = [];
|
|
1479
1492
|
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(" · ");
|
|
1480
1493
|
}
|
|
1481
|
-
function
|
|
1494
|
+
function dt(e) {
|
|
1482
1495
|
let t = [];
|
|
1483
1496
|
for (let n of e) {
|
|
1484
1497
|
let e = t[t.length - 1];
|
|
@@ -1493,22 +1506,22 @@ function ut(e) {
|
|
|
1493
1506
|
}
|
|
1494
1507
|
return t;
|
|
1495
1508
|
}
|
|
1496
|
-
function
|
|
1509
|
+
function ft(e) {
|
|
1497
1510
|
return e.some((e) => e.kind === "tool_end" && e.isError || e.kind === "error");
|
|
1498
1511
|
}
|
|
1499
|
-
function
|
|
1512
|
+
function pt(e, t) {
|
|
1500
1513
|
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) => ({
|
|
1501
1514
|
key: `${e.at}-${t}`,
|
|
1502
|
-
text:
|
|
1503
|
-
toolName:
|
|
1515
|
+
text: ot(e),
|
|
1516
|
+
toolName: et(e)
|
|
1504
1517
|
}));
|
|
1505
1518
|
}
|
|
1506
|
-
function
|
|
1519
|
+
function mt(e, t) {
|
|
1507
1520
|
if (t === void 0) return [];
|
|
1508
1521
|
let n = [];
|
|
1509
1522
|
for (let r of e) if (r.turnSentAt === t) {
|
|
1510
1523
|
if (r.kind === "tool_start") {
|
|
1511
|
-
let e =
|
|
1524
|
+
let e = Fe(r.name, r.args).name;
|
|
1512
1525
|
n.push({
|
|
1513
1526
|
key: `step-${n.length}`,
|
|
1514
1527
|
callId: r.callId,
|
|
@@ -1518,7 +1531,7 @@ function pt(e, t) {
|
|
|
1518
1531
|
startOffsetMs: r.at - t
|
|
1519
1532
|
});
|
|
1520
1533
|
} else if (r.kind === "tool_end") {
|
|
1521
|
-
let e =
|
|
1534
|
+
let e = Fe(r.name, r.args).name, i = r.isError ? "failed" : "done", a = n.find((t) => t.status === "running" && t.callId === r.callId && t.toolName === e);
|
|
1522
1535
|
a ? (a.status = i, a.runtimeSeconds = r.runtimeSeconds, a.label = r.displayName || a.label) : n.push({
|
|
1523
1536
|
key: `step-${n.length}`,
|
|
1524
1537
|
callId: r.callId,
|
|
@@ -1533,51 +1546,51 @@ function pt(e, t) {
|
|
|
1533
1546
|
return n;
|
|
1534
1547
|
}
|
|
1535
1548
|
// src/styles.css?inline
|
|
1536
|
-
var mt = "/*! 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-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--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{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);font-style:italic;display:flex}.bailey-streaming-hint{margin-top: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);font-style:italic;display:flex}.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-chat-transcript[data-suggestions-align=end]{flex-direction:column;display:flex}.bailey-suggestions[data-align=end]{align-items:flex-end;margin-top:auto}.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);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));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-card{border:var(--bailey-suggestion-border,none);border-radius:var(--bailey-suggestion-radius,1rem);font-weight:var(--bailey-suggestion-font-weight,normal)}.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-start{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.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);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-width:1px;flex:1;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input-row{border-radius:var(--bailey-input-radius,9999px);border-color:var(--bailey-input-border-color,var(--color-bailey-border))}.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(--bailey-send-fg,var(--color-bailey-heart));background-color:var(--bailey-send-bg,transparent);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:var(--bailey-send-bg-hover,#16a34a1a)}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:var(--bailey-send-bg-hover,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(--bailey-stop-fg,var(--color-bailey-error));background-color:var(--bailey-stop-bg,transparent);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:var(--bailey-stop-bg-hover,#d32f2f1a)}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:var(--bailey-stop-bg-hover,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-ordinal{syntax:\"*\";inherits:false}@property --tw-slashed-zero{syntax:\"*\";inherits:false}@property --tw-numeric-figure{syntax:\"*\";inherits:false}@property --tw-numeric-spacing{syntax:\"*\";inherits:false}@property --tw-numeric-fraction{syntax:\"*\";inherits:false}@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)}}", ht = r(void 0), gt = /:root\s*,\s*:host\s*\{([^}]*)\}/, _t = ".bailey-chat-panel,.bailey-menu-content,.bailey-tooltip-content", vt = /^\s*--color-bailey-([\w-]+)\s*:\s*(.+?)\s*$/, yt = /^(\s*--font-sans\s*:\s*)(.+?)\s*$/, bt = /var\(--color-bailey-([\w-]+)\)/g;
|
|
1537
|
-
function
|
|
1538
|
-
let t = e.match(new RegExp(
|
|
1549
|
+
var ht = "/*! 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-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--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{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);font-style:italic;display:flex}.bailey-streaming-hint{margin-top: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);font-style:italic;display:flex}.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-chat-transcript[data-suggestions-align=end]{flex-direction:column;display:flex}.bailey-suggestions[data-align=end]{align-items:flex-end;margin-top:auto}.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);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));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-card{border:var(--bailey-suggestion-border,none);border-radius:var(--bailey-suggestion-radius,1rem);font-weight:var(--bailey-suggestion-font-weight,normal)}.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-start{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.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);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-width:1px;flex:1;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input-row{border-radius:var(--bailey-input-radius,9999px);border-color:var(--bailey-input-border-color,var(--color-bailey-border))}.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(--bailey-send-fg,var(--color-bailey-heart));background-color:var(--bailey-send-bg,transparent);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:var(--bailey-send-bg-hover,#16a34a1a)}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:var(--bailey-send-bg-hover,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(--bailey-stop-fg,var(--color-bailey-error));background-color:var(--bailey-stop-bg,transparent);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:var(--bailey-stop-bg-hover,#d32f2f1a)}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:var(--bailey-stop-bg-hover,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-ordinal{syntax:\"*\";inherits:false}@property --tw-slashed-zero{syntax:\"*\";inherits:false}@property --tw-numeric-figure{syntax:\"*\";inherits:false}@property --tw-numeric-spacing{syntax:\"*\";inherits:false}@property --tw-numeric-fraction{syntax:\"*\";inherits:false}@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)}}", gt = r(void 0), _t = /:root\s*,\s*:host\s*\{([^}]*)\}/, vt = ".bailey-chat-panel,.bailey-menu-content,.bailey-tooltip-content", yt = /^\s*--color-bailey-([\w-]+)\s*:\s*(.+?)\s*$/, bt = /^(\s*--font-sans\s*:\s*)(.+?)\s*$/, xt = /var\(--color-bailey-([\w-]+)\)/g;
|
|
1550
|
+
function St(e) {
|
|
1551
|
+
let t = e.match(new RegExp(_t, "g"))?.length ?? 0;
|
|
1539
1552
|
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.`);
|
|
1540
1553
|
let n = /* @__PURE__ */ new Map();
|
|
1541
|
-
return e.replace(
|
|
1554
|
+
return e.replace(_t, (e, t) => `${vt}{${t.split(";").filter((e) => {
|
|
1542
1555
|
if (!e.trim()) return !1;
|
|
1543
|
-
let t = e.match(
|
|
1556
|
+
let t = e.match(yt);
|
|
1544
1557
|
return t && n.set(t[1], t[2]), !t;
|
|
1545
|
-
}).map((e) => e.replace(
|
|
1558
|
+
}).map((e) => e.replace(bt, "$1var(--bailey-font-sans,$2)")).join(";")}}`).replace(xt, (e, t) => n.has(t) ? `var(--color-bailey-${t},${n.get(t)})` : e);
|
|
1546
1559
|
}
|
|
1547
|
-
var
|
|
1548
|
-
function
|
|
1560
|
+
var Ct = St(ht), wt = "data-source", Tt = "baileyai-chat-ui", Et = /* @__PURE__ */ new WeakMap();
|
|
1561
|
+
function Dt(e) {
|
|
1549
1562
|
let t = e.getRootNode();
|
|
1550
1563
|
return t instanceof ShadowRoot ? t : document;
|
|
1551
1564
|
}
|
|
1552
|
-
function
|
|
1553
|
-
let t = e instanceof ShadowRoot ? e : document.head, n =
|
|
1554
|
-
if (n === 0 && !t.querySelector(`style[${
|
|
1565
|
+
function Ot(e) {
|
|
1566
|
+
let t = e instanceof ShadowRoot ? e : document.head, n = Et.get(e) ?? 0;
|
|
1567
|
+
if (n === 0 && !t.querySelector(`style[${wt}="${Tt}"]`)) {
|
|
1555
1568
|
let e = document.createElement("style");
|
|
1556
|
-
e.setAttribute(
|
|
1569
|
+
e.setAttribute(wt, Tt), e.textContent = Ct, t.appendChild(e);
|
|
1557
1570
|
}
|
|
1558
|
-
return
|
|
1559
|
-
let n = (
|
|
1560
|
-
n <= 0 ? (
|
|
1571
|
+
return Et.set(e, n + 1), () => {
|
|
1572
|
+
let n = (Et.get(e) ?? 1) - 1;
|
|
1573
|
+
n <= 0 ? (Et.delete(e), t.querySelector(`style[${wt}="${Tt}"]`)?.remove()) : Et.set(e, n);
|
|
1561
1574
|
};
|
|
1562
1575
|
}
|
|
1563
|
-
function
|
|
1576
|
+
function kt(e, t = !1) {
|
|
1564
1577
|
let [n, r] = f(null);
|
|
1565
1578
|
return l(() => {
|
|
1566
1579
|
if (t) return;
|
|
1567
1580
|
let n = e.current;
|
|
1568
1581
|
if (!n) return;
|
|
1569
|
-
let i =
|
|
1570
|
-
return r(i),
|
|
1582
|
+
let i = Dt(n);
|
|
1583
|
+
return r(i), Ot(i);
|
|
1571
1584
|
}, [t, e]), n;
|
|
1572
1585
|
}
|
|
1573
|
-
function
|
|
1574
|
-
let t = o(
|
|
1586
|
+
function At(e) {
|
|
1587
|
+
let t = o(gt), n = t !== void 0, r = kt(e, n);
|
|
1575
1588
|
return n ? t : r;
|
|
1576
1589
|
}
|
|
1577
1590
|
// src/context/BaileyFeedbackSlotContext.ts
|
|
1578
|
-
var
|
|
1591
|
+
var jt = r(void 0);
|
|
1579
1592
|
// src/ui/markdown.tsx
|
|
1580
|
-
function
|
|
1593
|
+
function Mt({ renderTable: t, renderChart: n } = {}) {
|
|
1581
1594
|
return {
|
|
1582
1595
|
a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ v(_, { children: n }) : /* @__PURE__ */ v("a", {
|
|
1583
1596
|
href: t,
|
|
@@ -1586,8 +1599,8 @@ function jt({ renderTable: t, renderChart: n } = {}) {
|
|
|
1586
1599
|
children: n
|
|
1587
1600
|
}),
|
|
1588
1601
|
table: ({ node: n, children: r }) => {
|
|
1589
|
-
let i = n &&
|
|
1590
|
-
if (i &&
|
|
1602
|
+
let i = n && He(n);
|
|
1603
|
+
if (i && Ue(i.rows) && t) {
|
|
1591
1604
|
let n = i.rows.map((t) => t.map((t) => t.href && !e(t.href) ? { text: t.text } : t));
|
|
1592
1605
|
return /* @__PURE__ */ v(_, { children: t({
|
|
1593
1606
|
headers: i.headers,
|
|
@@ -1599,7 +1612,7 @@ function jt({ renderTable: t, renderChart: n } = {}) {
|
|
|
1599
1612
|
pre: ({ children: e }) => {
|
|
1600
1613
|
let t = (Array.isArray(e) ? e[0] : e)?.props;
|
|
1601
1614
|
if ((t?.className?.split(" ") ?? []).includes("language-chartjs") && n) {
|
|
1602
|
-
let e = t?.children, r =
|
|
1615
|
+
let e = t?.children, r = Ze(Array.isArray(e) ? e.join("") : String(e ?? ""));
|
|
1603
1616
|
if (r) return /* @__PURE__ */ v(_, { children: n(r) });
|
|
1604
1617
|
}
|
|
1605
1618
|
return /* @__PURE__ */ v("pre", { children: e });
|
|
@@ -1607,7 +1620,7 @@ function jt({ renderTable: t, renderChart: n } = {}) {
|
|
|
1607
1620
|
};
|
|
1608
1621
|
}
|
|
1609
1622
|
// src/ui/icons.tsx
|
|
1610
|
-
function
|
|
1623
|
+
function Nt({ className: e }) {
|
|
1611
1624
|
return /* @__PURE__ */ v("svg", {
|
|
1612
1625
|
viewBox: "0 0 24 24",
|
|
1613
1626
|
fill: "currentColor",
|
|
@@ -1616,7 +1629,7 @@ function Mt({ className: e }) {
|
|
|
1616
1629
|
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" })
|
|
1617
1630
|
});
|
|
1618
1631
|
}
|
|
1619
|
-
function
|
|
1632
|
+
function Pt({ className: e }) {
|
|
1620
1633
|
return /* @__PURE__ */ v("svg", {
|
|
1621
1634
|
viewBox: "0 0 24 24",
|
|
1622
1635
|
fill: "currentColor",
|
|
@@ -1631,7 +1644,7 @@ function Nt({ className: e }) {
|
|
|
1631
1644
|
})
|
|
1632
1645
|
});
|
|
1633
1646
|
}
|
|
1634
|
-
function
|
|
1647
|
+
function Ft({ className: e }) {
|
|
1635
1648
|
return /* @__PURE__ */ y("svg", {
|
|
1636
1649
|
viewBox: "0 0 24 24",
|
|
1637
1650
|
fill: "none",
|
|
@@ -1644,7 +1657,7 @@ function Pt({ className: e }) {
|
|
|
1644
1657
|
children: [/* @__PURE__ */ v("path", { d: "M7 17 17 7" }), /* @__PURE__ */ v("path", { d: "M9 7h8v8" })]
|
|
1645
1658
|
});
|
|
1646
1659
|
}
|
|
1647
|
-
function
|
|
1660
|
+
function It({ className: e }) {
|
|
1648
1661
|
return /* @__PURE__ */ y("svg", {
|
|
1649
1662
|
viewBox: "0 0 24 24",
|
|
1650
1663
|
fill: "none",
|
|
@@ -1663,7 +1676,7 @@ function Ft({ className: e }) {
|
|
|
1663
1676
|
}), /* @__PURE__ */ v("path", { d: "M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" })]
|
|
1664
1677
|
});
|
|
1665
1678
|
}
|
|
1666
|
-
function
|
|
1679
|
+
function Lt({ className: e }) {
|
|
1667
1680
|
return /* @__PURE__ */ v("svg", {
|
|
1668
1681
|
viewBox: "0 0 24 24",
|
|
1669
1682
|
fill: "none",
|
|
@@ -1676,7 +1689,7 @@ function It({ className: e }) {
|
|
|
1676
1689
|
children: /* @__PURE__ */ v("path", { d: "M5 12.5 9.5 17 19 7" })
|
|
1677
1690
|
});
|
|
1678
1691
|
}
|
|
1679
|
-
function
|
|
1692
|
+
function Rt({ className: e }) {
|
|
1680
1693
|
return /* @__PURE__ */ v("svg", {
|
|
1681
1694
|
viewBox: "0 0 24 24",
|
|
1682
1695
|
fill: "none",
|
|
@@ -1689,7 +1702,7 @@ function Lt({ className: e }) {
|
|
|
1689
1702
|
children: /* @__PURE__ */ v("path", { d: "m22.7 13.5-2-2-2 2M21 12a9 9 0 1 1-1.245-4.57M12 7v5l3 2" })
|
|
1690
1703
|
});
|
|
1691
1704
|
}
|
|
1692
|
-
function
|
|
1705
|
+
function zt({ className: e }) {
|
|
1693
1706
|
return /* @__PURE__ */ y("svg", {
|
|
1694
1707
|
viewBox: "0 0 24 24",
|
|
1695
1708
|
fill: "none",
|
|
@@ -1706,7 +1719,7 @@ function Rt({ className: e }) {
|
|
|
1706
1719
|
}), /* @__PURE__ */ v("path", { d: "M8.5 12.5 11 15l4.5-5.5" })]
|
|
1707
1720
|
});
|
|
1708
1721
|
}
|
|
1709
|
-
function
|
|
1722
|
+
function Bt({ className: e }) {
|
|
1710
1723
|
return /* @__PURE__ */ y("svg", {
|
|
1711
1724
|
viewBox: "0 0 24 24",
|
|
1712
1725
|
fill: "currentColor",
|
|
@@ -1731,7 +1744,7 @@ function zt({ className: e }) {
|
|
|
1731
1744
|
]
|
|
1732
1745
|
});
|
|
1733
1746
|
}
|
|
1734
|
-
function
|
|
1747
|
+
function Vt({ className: e }) {
|
|
1735
1748
|
return /* @__PURE__ */ v("svg", {
|
|
1736
1749
|
viewBox: "0 0 24 24",
|
|
1737
1750
|
fill: "none",
|
|
@@ -1744,8 +1757,8 @@ function Bt({ className: e }) {
|
|
|
1744
1757
|
children: /* @__PURE__ */ v("path", { d: "M12 5v14M5 12h14" })
|
|
1745
1758
|
});
|
|
1746
1759
|
}
|
|
1747
|
-
var
|
|
1748
|
-
function
|
|
1760
|
+
var Ht = "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", Ut = "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";
|
|
1761
|
+
function Wt({ className: e, filled: t = !1 }) {
|
|
1749
1762
|
return /* @__PURE__ */ v("svg", {
|
|
1750
1763
|
viewBox: "0 0 24 24",
|
|
1751
1764
|
fill: t ? "currentColor" : "none",
|
|
@@ -1754,10 +1767,10 @@ function Ut({ className: e, filled: t = !1 }) {
|
|
|
1754
1767
|
strokeLinejoin: "round",
|
|
1755
1768
|
className: e,
|
|
1756
1769
|
"aria-hidden": "true",
|
|
1757
|
-
children: /* @__PURE__ */ v("path", { d:
|
|
1770
|
+
children: /* @__PURE__ */ v("path", { d: Ht })
|
|
1758
1771
|
});
|
|
1759
1772
|
}
|
|
1760
|
-
function
|
|
1773
|
+
function Gt({ className: e, filled: t = !1 }) {
|
|
1761
1774
|
return /* @__PURE__ */ v("svg", {
|
|
1762
1775
|
viewBox: "0 0 24 24",
|
|
1763
1776
|
fill: t ? "currentColor" : "none",
|
|
@@ -1766,10 +1779,10 @@ function Wt({ className: e, filled: t = !1 }) {
|
|
|
1766
1779
|
strokeLinejoin: "round",
|
|
1767
1780
|
className: e,
|
|
1768
1781
|
"aria-hidden": "true",
|
|
1769
|
-
children: /* @__PURE__ */ v("path", { d:
|
|
1782
|
+
children: /* @__PURE__ */ v("path", { d: Ut })
|
|
1770
1783
|
});
|
|
1771
1784
|
}
|
|
1772
|
-
function
|
|
1785
|
+
function Kt({ className: e }) {
|
|
1773
1786
|
return /* @__PURE__ */ v("svg", {
|
|
1774
1787
|
viewBox: "0 0 24 24",
|
|
1775
1788
|
fill: "none",
|
|
@@ -1782,7 +1795,7 @@ function Gt({ className: e }) {
|
|
|
1782
1795
|
children: /* @__PURE__ */ v("path", { d: "M15 6l-6 6 6 6" })
|
|
1783
1796
|
});
|
|
1784
1797
|
}
|
|
1785
|
-
function
|
|
1798
|
+
function qt({ className: e }) {
|
|
1786
1799
|
return /* @__PURE__ */ v("svg", {
|
|
1787
1800
|
viewBox: "0 0 24 24",
|
|
1788
1801
|
fill: "none",
|
|
@@ -1795,7 +1808,7 @@ function Kt({ className: e }) {
|
|
|
1795
1808
|
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" })
|
|
1796
1809
|
});
|
|
1797
1810
|
}
|
|
1798
|
-
function
|
|
1811
|
+
function Jt({ className: e }) {
|
|
1799
1812
|
return /* @__PURE__ */ y("svg", {
|
|
1800
1813
|
viewBox: "0 0 24 24",
|
|
1801
1814
|
fill: "none",
|
|
@@ -1813,9 +1826,9 @@ function qt({ className: e }) {
|
|
|
1813
1826
|
});
|
|
1814
1827
|
}
|
|
1815
1828
|
// src/ui/CopyMarkdownButton.tsx
|
|
1816
|
-
var
|
|
1817
|
-
function
|
|
1818
|
-
let [a, o] = f(!1), [c, l] = f(!1), u = d(null), p = d(null), m =
|
|
1829
|
+
var Yt = 1500;
|
|
1830
|
+
function Xt({ markdown: e, className: t, ariaLabel: n = "copy response as markdown", tooltipDefaultText: r = "Copy as markdown", tooltipCopiedText: i = "Copied!" }) {
|
|
1831
|
+
let [a, o] = f(!1), [c, l] = f(!1), u = d(null), p = d(null), m = At(p);
|
|
1819
1832
|
return s(() => () => {
|
|
1820
1833
|
u.current !== null && clearTimeout(u.current);
|
|
1821
1834
|
}, []), /* @__PURE__ */ v(g.Provider, {
|
|
@@ -1834,11 +1847,11 @@ function Yt({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
|
|
|
1834
1847
|
} catch {
|
|
1835
1848
|
return;
|
|
1836
1849
|
}
|
|
1837
|
-
o(!0), u.current !== null && clearTimeout(u.current), u.current = setTimeout(() => o(!1),
|
|
1850
|
+
o(!0), u.current !== null && clearTimeout(u.current), u.current = setTimeout(() => o(!1), Yt);
|
|
1838
1851
|
},
|
|
1839
1852
|
"aria-label": n,
|
|
1840
1853
|
className: `bailey-copy-button${t ? ` ${t}` : ""}`,
|
|
1841
|
-
children: v(a ?
|
|
1854
|
+
children: v(a ? Lt : It, { className: "bailey-copy-icon" })
|
|
1842
1855
|
})
|
|
1843
1856
|
}), /* @__PURE__ */ v(g.Portal, {
|
|
1844
1857
|
container: m instanceof ShadowRoot ? m : void 0,
|
|
@@ -1852,20 +1865,20 @@ function Yt({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
|
|
|
1852
1865
|
});
|
|
1853
1866
|
}
|
|
1854
1867
|
// src/ui/BaileyTracePanel.tsx
|
|
1855
|
-
async function
|
|
1868
|
+
async function Zt(e) {
|
|
1856
1869
|
try {
|
|
1857
1870
|
await navigator.clipboard.writeText(e);
|
|
1858
1871
|
} catch {}
|
|
1859
1872
|
}
|
|
1860
|
-
function
|
|
1873
|
+
function Qt({ text: e, label: t = "Copy" }) {
|
|
1861
1874
|
return /* @__PURE__ */ v("button", {
|
|
1862
1875
|
type: "button",
|
|
1863
|
-
onClick: () =>
|
|
1876
|
+
onClick: () => Zt(e),
|
|
1864
1877
|
className: "bailey-trace-copy-button",
|
|
1865
1878
|
children: t
|
|
1866
1879
|
});
|
|
1867
1880
|
}
|
|
1868
|
-
function
|
|
1881
|
+
function $t(e) {
|
|
1869
1882
|
if (e.failed || e.kind === "error") return "bailey-trace-chip bailey-trace-chip-error";
|
|
1870
1883
|
switch (e.kind) {
|
|
1871
1884
|
case "tool_start":
|
|
@@ -1876,7 +1889,7 @@ function Qt(e) {
|
|
|
1876
1889
|
default: return "bailey-trace-chip bailey-trace-chip-default";
|
|
1877
1890
|
}
|
|
1878
1891
|
}
|
|
1879
|
-
function
|
|
1892
|
+
function en({ label: e, content: t, copyable: n }) {
|
|
1880
1893
|
return /* @__PURE__ */ y("details", {
|
|
1881
1894
|
className: "bailey-trace-disclosure",
|
|
1882
1895
|
children: [
|
|
@@ -1886,7 +1899,7 @@ function $t({ label: e, content: t, copyable: n }) {
|
|
|
1886
1899
|
}),
|
|
1887
1900
|
n && /* @__PURE__ */ v("div", {
|
|
1888
1901
|
className: "bailey-trace-disclosure-actions",
|
|
1889
|
-
children: /* @__PURE__ */ v(
|
|
1902
|
+
children: /* @__PURE__ */ v(Qt, { text: t })
|
|
1890
1903
|
}),
|
|
1891
1904
|
/* @__PURE__ */ v("pre", {
|
|
1892
1905
|
className: "bailey-trace-disclosure-content",
|
|
@@ -1895,7 +1908,7 @@ function $t({ label: e, content: t, copyable: n }) {
|
|
|
1895
1908
|
]
|
|
1896
1909
|
});
|
|
1897
1910
|
}
|
|
1898
|
-
function
|
|
1911
|
+
function tn({ row: e }) {
|
|
1899
1912
|
return /* @__PURE__ */ y("div", {
|
|
1900
1913
|
className: "bailey-trace-row",
|
|
1901
1914
|
children: [
|
|
@@ -1909,10 +1922,10 @@ function en({ row: e }) {
|
|
|
1909
1922
|
/* @__PURE__ */ v("span", {
|
|
1910
1923
|
className: "bailey-trace-row-gap",
|
|
1911
1924
|
title: "Time since the previous event",
|
|
1912
|
-
children:
|
|
1925
|
+
children: ct(e.gapMs)
|
|
1913
1926
|
}),
|
|
1914
1927
|
/* @__PURE__ */ v("span", {
|
|
1915
|
-
className:
|
|
1928
|
+
className: $t(e),
|
|
1916
1929
|
children: e.label
|
|
1917
1930
|
}),
|
|
1918
1931
|
/* @__PURE__ */ v("span", {
|
|
@@ -1921,32 +1934,32 @@ function en({ row: e }) {
|
|
|
1921
1934
|
})
|
|
1922
1935
|
]
|
|
1923
1936
|
}),
|
|
1924
|
-
e.argsDetail && /* @__PURE__ */ v(
|
|
1937
|
+
e.argsDetail && /* @__PURE__ */ v(en, {
|
|
1925
1938
|
label: e.kind === "llm_call_start" ? "request" : "args",
|
|
1926
1939
|
content: e.argsDetail
|
|
1927
1940
|
}),
|
|
1928
|
-
e.outputDetail && /* @__PURE__ */ v(
|
|
1941
|
+
e.outputDetail && /* @__PURE__ */ v(en, {
|
|
1929
1942
|
label: e.kind === "llm_call_end" ? "response" : "output",
|
|
1930
1943
|
content: e.outputDetail
|
|
1931
1944
|
}),
|
|
1932
|
-
e.structuredOutputDetail && /* @__PURE__ */ v(
|
|
1945
|
+
e.structuredOutputDetail && /* @__PURE__ */ v(en, {
|
|
1933
1946
|
label: "structured output",
|
|
1934
1947
|
content: e.structuredOutputDetail
|
|
1935
1948
|
}),
|
|
1936
|
-
e.rawDetail && /* @__PURE__ */ v(
|
|
1949
|
+
e.rawDetail && /* @__PURE__ */ v(en, {
|
|
1937
1950
|
label: "raw",
|
|
1938
1951
|
content: e.rawDetail
|
|
1939
1952
|
})
|
|
1940
1953
|
]
|
|
1941
1954
|
});
|
|
1942
1955
|
}
|
|
1943
|
-
function
|
|
1956
|
+
function nn(e, t) {
|
|
1944
1957
|
if (e.chunkCount === 0) return "Streamed: no chunks received";
|
|
1945
1958
|
if (e.chunkCount === 1 || e.firstChunkAt === null) return "Streamed: 1 chunk (not incremental)";
|
|
1946
1959
|
let n = e.firstChunkAt - t, r = (e.lastChunkAt ?? e.firstChunkAt) - e.firstChunkAt;
|
|
1947
1960
|
return `Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r / 1e3).toFixed(1)}s`;
|
|
1948
1961
|
}
|
|
1949
|
-
function
|
|
1962
|
+
function rn({ request: e }) {
|
|
1950
1963
|
let t = u(() => JSON.stringify({
|
|
1951
1964
|
model: e.model,
|
|
1952
1965
|
instructions: e.systemPrompt,
|
|
@@ -1970,24 +1983,24 @@ function nn({ request: e }) {
|
|
|
1970
1983
|
}),
|
|
1971
1984
|
/* @__PURE__ */ v("span", {
|
|
1972
1985
|
className: "bailey-trace-request-meta",
|
|
1973
|
-
children:
|
|
1986
|
+
children: nn(e.streamStats, e.sentAt)
|
|
1974
1987
|
}),
|
|
1975
|
-
/* @__PURE__ */ v(
|
|
1988
|
+
/* @__PURE__ */ v(en, {
|
|
1976
1989
|
label: `System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,
|
|
1977
1990
|
content: e.systemPrompt,
|
|
1978
1991
|
copyable: !0
|
|
1979
1992
|
}),
|
|
1980
|
-
/* @__PURE__ */ v(
|
|
1993
|
+
/* @__PURE__ */ v(en, {
|
|
1981
1994
|
label: `Messages (${e.messages.length})`,
|
|
1982
1995
|
content: JSON.stringify(e.messages, null, 2),
|
|
1983
1996
|
copyable: !0
|
|
1984
1997
|
}),
|
|
1985
|
-
e.response && /* @__PURE__ */ v(
|
|
1998
|
+
e.response && /* @__PURE__ */ v(en, {
|
|
1986
1999
|
label: `Response (${e.response.content.length.toLocaleString()} chars)`,
|
|
1987
2000
|
content: e.response.content,
|
|
1988
2001
|
copyable: !0
|
|
1989
2002
|
}),
|
|
1990
|
-
/* @__PURE__ */ v(
|
|
2003
|
+
/* @__PURE__ */ v(en, {
|
|
1991
2004
|
label: "Full payload (JSON)",
|
|
1992
2005
|
content: t,
|
|
1993
2006
|
copyable: !0
|
|
@@ -1995,14 +2008,14 @@ function nn({ request: e }) {
|
|
|
1995
2008
|
]
|
|
1996
2009
|
});
|
|
1997
2010
|
}
|
|
1998
|
-
function
|
|
1999
|
-
let r = u(() =>
|
|
2011
|
+
function an({ events: e, lastRequest: t, onClear: n }) {
|
|
2012
|
+
let r = u(() => lt(e), [e]), i = u(() => dt(r), [r]), a = u(() => JSON.stringify(e, null, 2), [e]);
|
|
2000
2013
|
return /* @__PURE__ */ y("div", {
|
|
2001
2014
|
className: "bailey-trace-body",
|
|
2002
2015
|
children: [
|
|
2003
2016
|
/* @__PURE__ */ y("div", {
|
|
2004
2017
|
className: "bailey-trace-actions-row",
|
|
2005
|
-
children: [e.length > 0 && /* @__PURE__ */ v(
|
|
2018
|
+
children: [e.length > 0 && /* @__PURE__ */ v(Qt, {
|
|
2006
2019
|
text: a,
|
|
2007
2020
|
label: "Copy trace as JSON"
|
|
2008
2021
|
}), /* @__PURE__ */ v("button", {
|
|
@@ -2012,15 +2025,15 @@ function rn({ events: e, lastRequest: t, onClear: n }) {
|
|
|
2012
2025
|
children: "Clear"
|
|
2013
2026
|
})]
|
|
2014
2027
|
}),
|
|
2015
|
-
t && /* @__PURE__ */ v(
|
|
2028
|
+
t && /* @__PURE__ */ v(rn, { request: t }),
|
|
2016
2029
|
/* @__PURE__ */ v("div", {
|
|
2017
2030
|
className: "bailey-trace-rows",
|
|
2018
2031
|
children: i.map((e, t) => {
|
|
2019
|
-
if (e.type === "single") return /* @__PURE__ */ v(
|
|
2032
|
+
if (e.type === "single") return /* @__PURE__ */ v(tn, { row: e.row }, e.row.key);
|
|
2020
2033
|
let n = e.rows.filter((e) => e.isToolStart).length;
|
|
2021
2034
|
if (n <= 1) return /* @__PURE__ */ v("div", {
|
|
2022
2035
|
className: "bailey-trace-rows",
|
|
2023
|
-
children: e.rows.map((e) => /* @__PURE__ */ v(
|
|
2036
|
+
children: e.rows.map((e) => /* @__PURE__ */ v(tn, { row: e }, e.key))
|
|
2024
2037
|
}, `group-${t}`);
|
|
2025
2038
|
let r = e.rows.filter((e) => e.failed).length;
|
|
2026
2039
|
return /* @__PURE__ */ y("details", {
|
|
@@ -2042,7 +2055,7 @@ function rn({ events: e, lastRequest: t, onClear: n }) {
|
|
|
2042
2055
|
]
|
|
2043
2056
|
}), /* @__PURE__ */ v("div", {
|
|
2044
2057
|
className: "bailey-trace-rows",
|
|
2045
|
-
children: e.rows.map((e) => /* @__PURE__ */ v(
|
|
2058
|
+
children: e.rows.map((e) => /* @__PURE__ */ v(tn, { row: e }, e.key))
|
|
2046
2059
|
})]
|
|
2047
2060
|
}, `group-${t}`);
|
|
2048
2061
|
})
|
|
@@ -2050,8 +2063,8 @@ function rn({ events: e, lastRequest: t, onClear: n }) {
|
|
|
2050
2063
|
]
|
|
2051
2064
|
});
|
|
2052
2065
|
}
|
|
2053
|
-
function
|
|
2054
|
-
let [r, i] = f(!1), a = u(() =>
|
|
2066
|
+
function on({ events: e, lastRequest: t, onClear: n }) {
|
|
2067
|
+
let [r, i] = f(!1), a = u(() => ft(e), [e]), o = u(() => ut(e), [e]);
|
|
2055
2068
|
return e.length === 0 && !t ? null : /* @__PURE__ */ y("div", {
|
|
2056
2069
|
className: "bailey-trace-panel",
|
|
2057
2070
|
children: [/* @__PURE__ */ y("div", {
|
|
@@ -2072,7 +2085,7 @@ function an({ events: e, lastRequest: t, onClear: n }) {
|
|
|
2072
2085
|
className: a ? "bailey-trace-summary bailey-trace-summary-error" : "bailey-trace-summary",
|
|
2073
2086
|
children: o
|
|
2074
2087
|
})]
|
|
2075
|
-
}), r && /* @__PURE__ */ v(
|
|
2088
|
+
}), r && /* @__PURE__ */ v(an, {
|
|
2076
2089
|
events: e,
|
|
2077
2090
|
lastRequest: t,
|
|
2078
2091
|
onClear: n
|
|
@@ -2080,7 +2093,7 @@ function an({ events: e, lastRequest: t, onClear: n }) {
|
|
|
2080
2093
|
});
|
|
2081
2094
|
}
|
|
2082
2095
|
// src/ui/ToolResultImage.tsx
|
|
2083
|
-
function
|
|
2096
|
+
function sn({ src: e, alt: n, className: r }) {
|
|
2084
2097
|
return t(e) ? /* @__PURE__ */ v("img", {
|
|
2085
2098
|
src: e,
|
|
2086
2099
|
alt: n ?? "",
|
|
@@ -2089,20 +2102,20 @@ function on({ src: e, alt: n, className: r }) {
|
|
|
2089
2102
|
}) : null;
|
|
2090
2103
|
}
|
|
2091
2104
|
// src/utils/safeMcpAppResource.ts
|
|
2092
|
-
var
|
|
2105
|
+
var cn = /^ui:\/\//, ln = 2097152, un = /* @__PURE__ */ new Set([
|
|
2093
2106
|
"connectDomains",
|
|
2094
2107
|
"resourceDomains",
|
|
2095
2108
|
"frameDomains",
|
|
2096
2109
|
"baseUriDomains"
|
|
2097
|
-
]),
|
|
2110
|
+
]), dn = /* @__PURE__ */ new Set([
|
|
2098
2111
|
"camera",
|
|
2099
2112
|
"microphone",
|
|
2100
2113
|
"geolocation",
|
|
2101
2114
|
"clipboardWrite"
|
|
2102
|
-
]),
|
|
2115
|
+
]), fn = (e, t) => e === void 0 ? !0 : typeof e != "object" || !e || Array.isArray(e) ? !1 : Object.keys(e).every((e) => t.has(e)), pn = (e) => !(!cn.test(e.resourceUri) || typeof e.html != "string" || e.html.length === 0 || e.html.length > ln || !fn(e.csp, un) || !fn(e.permissions, dn));
|
|
2103
2116
|
// src/ui/McpAppFrame.tsx
|
|
2104
|
-
function
|
|
2105
|
-
return
|
|
2117
|
+
function mn({ html: e, title: t, resourceUri: n, csp: r, permissions: i, className: a }) {
|
|
2118
|
+
return pn({
|
|
2106
2119
|
html: e,
|
|
2107
2120
|
resourceUri: n,
|
|
2108
2121
|
csp: r,
|
|
@@ -2116,15 +2129,15 @@ function pn({ html: e, title: t, resourceUri: n, csp: r, permissions: i, classNa
|
|
|
2116
2129
|
}) : null;
|
|
2117
2130
|
}
|
|
2118
2131
|
// src/ui/BaileyToolSteps.tsx
|
|
2119
|
-
function
|
|
2132
|
+
function hn({ toolName: e, resolveActivityIcon: t }) {
|
|
2120
2133
|
let n = t?.(e);
|
|
2121
2134
|
return n === 0 || n && n !== !0 ? /* @__PURE__ */ v("span", {
|
|
2122
2135
|
className: "bailey-activity-icon",
|
|
2123
2136
|
children: n
|
|
2124
2137
|
}) : null;
|
|
2125
2138
|
}
|
|
2126
|
-
function
|
|
2127
|
-
let n =
|
|
2139
|
+
function gn({ offsetMs: e, labels: t }) {
|
|
2140
|
+
let n = ct(e), r = t.toolStepStartedText?.replace("{offset}", n);
|
|
2128
2141
|
return /* @__PURE__ */ v("span", {
|
|
2129
2142
|
className: "bailey-tool-step-start",
|
|
2130
2143
|
title: r,
|
|
@@ -2133,7 +2146,7 @@ function hn({ offsetMs: e, labels: t }) {
|
|
|
2133
2146
|
children: n
|
|
2134
2147
|
});
|
|
2135
2148
|
}
|
|
2136
|
-
function
|
|
2149
|
+
function _n({ steps: e, resolveActivityIcon: t }) {
|
|
2137
2150
|
let n = e.filter((e) => e.status === "running");
|
|
2138
2151
|
return n.length === 0 ? null : /* @__PURE__ */ v("div", {
|
|
2139
2152
|
className: "bailey-tool-steps-live",
|
|
@@ -2142,7 +2155,7 @@ function gn({ steps: e, resolveActivityIcon: t }) {
|
|
|
2142
2155
|
children: n.map((e) => /* @__PURE__ */ y("div", {
|
|
2143
2156
|
className: "bailey-activity-line",
|
|
2144
2157
|
children: [
|
|
2145
|
-
/* @__PURE__ */ v(
|
|
2158
|
+
/* @__PURE__ */ v(hn, {
|
|
2146
2159
|
toolName: e.toolName,
|
|
2147
2160
|
resolveActivityIcon: t
|
|
2148
2161
|
}),
|
|
@@ -2155,7 +2168,7 @@ function gn({ steps: e, resolveActivityIcon: t }) {
|
|
|
2155
2168
|
}, e.key))
|
|
2156
2169
|
});
|
|
2157
2170
|
}
|
|
2158
|
-
function
|
|
2171
|
+
function vn({ steps: e, labels: t, resolveActivityIcon: n }) {
|
|
2159
2172
|
if (e.length === 0) return null;
|
|
2160
2173
|
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;
|
|
2161
2174
|
return /* @__PURE__ */ y("details", {
|
|
@@ -2165,12 +2178,12 @@ function _n({ steps: e, labels: t, resolveActivityIcon: n }) {
|
|
|
2165
2178
|
children: e.map((e) => /* @__PURE__ */ y("li", {
|
|
2166
2179
|
className: "bailey-tool-step",
|
|
2167
2180
|
children: [
|
|
2168
|
-
/* @__PURE__ */ v(
|
|
2181
|
+
/* @__PURE__ */ v(hn, {
|
|
2169
2182
|
toolName: e.toolName,
|
|
2170
2183
|
resolveActivityIcon: n
|
|
2171
2184
|
}),
|
|
2172
2185
|
/* @__PURE__ */ v("span", { children: e.label }),
|
|
2173
|
-
e.startOffsetMs !== void 0 && /* @__PURE__ */ v(
|
|
2186
|
+
e.startOffsetMs !== void 0 && /* @__PURE__ */ v(gn, {
|
|
2174
2187
|
offsetMs: e.startOffsetMs,
|
|
2175
2188
|
labels: t
|
|
2176
2189
|
}),
|
|
@@ -2186,28 +2199,28 @@ function _n({ steps: e, labels: t, resolveActivityIcon: n }) {
|
|
|
2186
2199
|
});
|
|
2187
2200
|
}
|
|
2188
2201
|
// src/utils/relativeTime.ts
|
|
2189
|
-
var
|
|
2190
|
-
function Cn(e) {
|
|
2191
|
-
return e ? Date.parse(vn.test(e) ? e : `${e}Z`) : NaN;
|
|
2192
|
-
}
|
|
2202
|
+
var yn = /(Z|[+-]\d{2}:?\d{2})$/i, bn = 60, xn = 3600, Sn = 24 * xn, Cn = 30 * Sn * 1e3;
|
|
2193
2203
|
function wn(e) {
|
|
2194
|
-
|
|
2204
|
+
return e ? Date.parse(yn.test(e) ? e : `${e}Z`) : NaN;
|
|
2205
|
+
}
|
|
2206
|
+
function Tn(e) {
|
|
2207
|
+
let t = wn(e.iso);
|
|
2195
2208
|
if (Number.isNaN(t)) return "";
|
|
2196
2209
|
let n = e.now ?? Date.now(), r = Math.max(0, n - t);
|
|
2197
2210
|
if (typeof Intl > "u" || typeof Intl.RelativeTimeFormat != "function") return e.justNowText ?? "";
|
|
2198
|
-
if (r >=
|
|
2211
|
+
if (r >= Cn) return new Intl.DateTimeFormat(e.locale, { dateStyle: "medium" }).format(t);
|
|
2199
2212
|
let i = r / 1e3, a = new Intl.RelativeTimeFormat(e.locale, { numeric: "auto" });
|
|
2200
|
-
return i <
|
|
2213
|
+
return i < bn ? a.format(0, "second") : i < xn ? a.format(-Math.floor(i / bn), "minute") : i < Sn ? a.format(-Math.floor(i / xn), "hour") : a.format(-Math.floor(i / Sn), "day");
|
|
2201
2214
|
}
|
|
2202
2215
|
// src/ui/BaileyHistoryDrawer.tsx
|
|
2203
|
-
function
|
|
2204
|
-
let s =
|
|
2216
|
+
function En({ client: e, pageSize: t, chat: n, labels: r, locale: i, onClose: o }) {
|
|
2217
|
+
let s = V({
|
|
2205
2218
|
client: e,
|
|
2206
2219
|
pageSize: t
|
|
2207
2220
|
}), { loadConversation: c, newChat: l } = n, u = a((e) => c ? c(e) : Promise.reject(/* @__PURE__ */ Error("no loadConversation")), [c]), d = a(() => {
|
|
2208
2221
|
l(), o({ restoreFocusTo: "input" });
|
|
2209
2222
|
}, [l, o]);
|
|
2210
|
-
return /* @__PURE__ */ v(
|
|
2223
|
+
return /* @__PURE__ */ v(kn, {
|
|
2211
2224
|
conversations: s,
|
|
2212
2225
|
activeConversationId: n.conversationId,
|
|
2213
2226
|
selectStatus: n.historyStatus,
|
|
@@ -2219,15 +2232,15 @@ function Tn({ client: e, pageSize: t, chat: n, labels: r, locale: i, onClose: o
|
|
|
2219
2232
|
locale: i
|
|
2220
2233
|
});
|
|
2221
2234
|
}
|
|
2222
|
-
var
|
|
2223
|
-
function
|
|
2224
|
-
let { conversations: m, status: h, error: g, hasMore: b, refresh: x, loadMore: S, remove: C } = e,
|
|
2235
|
+
var Dn = (e, t) => Object.entries(t).reduce((e, [t, n]) => e.split(`{${t}}`).join(String(n)), e), On = (e) => !e || e.kind !== "http" ? !1 : e.status === 401 || e.status === 403;
|
|
2236
|
+
function kn({ conversations: e, activeConversationId: t, selectStatus: n, onSelect: r, onActiveDeleted: i, onNewChat: a, onClose: o, labels: l, locale: u, now: p }) {
|
|
2237
|
+
let { conversations: m, status: h, error: g, hasMore: b, refresh: x, loadMore: S, remove: C } = e, ee = c(), w = c(), T = d(null), E = d(null), D = d(null), O = d(/* @__PURE__ */ new Map()), k = d(/* @__PURE__ */ new Map()), A = d(null), j = d(null), [te, ne] = f(null), [M, N] = f(null), [P, re] = f(0), [F, I] = f(!1), [ie, L] = f(!1), [ae, oe] = f(!1), se = u ?? (typeof navigator < "u" ? navigator.language : void 0);
|
|
2225
2238
|
s(() => {
|
|
2226
|
-
|
|
2239
|
+
T.current?.focus();
|
|
2227
2240
|
}, []), s(() => {
|
|
2228
2241
|
let e = A.current;
|
|
2229
2242
|
if (!e) return;
|
|
2230
|
-
let t = e.kind === "select" ?
|
|
2243
|
+
let t = e.kind === "select" ? O.current.get(e.id) : e.kind === "delete" ? k.current.get(e.id) : e.kind === "cancel" ? D.current : E.current;
|
|
2231
2244
|
t && (t.focus(), A.current = null);
|
|
2232
2245
|
}), s(() => {
|
|
2233
2246
|
let e = j.current;
|
|
@@ -2240,16 +2253,16 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2240
2253
|
b,
|
|
2241
2254
|
m
|
|
2242
2255
|
]);
|
|
2243
|
-
let
|
|
2256
|
+
let ce = () => {
|
|
2244
2257
|
j.current = m.length, S();
|
|
2245
|
-
},
|
|
2258
|
+
}, R = (e) => {
|
|
2246
2259
|
A.current = {
|
|
2247
2260
|
kind: "delete",
|
|
2248
2261
|
id: e
|
|
2249
2262
|
}, ne(null);
|
|
2250
|
-
},
|
|
2251
|
-
e.key === "Escape" && (e.stopPropagation(), te ?
|
|
2252
|
-
},
|
|
2263
|
+
}, le = (e) => {
|
|
2264
|
+
e.key === "Escape" && (e.stopPropagation(), te ? R(te) : o({ restoreFocusTo: "menu" }));
|
|
2265
|
+
}, ue = async (e) => {
|
|
2253
2266
|
if (oe(!1), e === t) o({ restoreFocusTo: "input" });
|
|
2254
2267
|
else {
|
|
2255
2268
|
L(!0);
|
|
@@ -2264,7 +2277,7 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2264
2277
|
}
|
|
2265
2278
|
L(!1), o({ restoreFocusTo: "input" });
|
|
2266
2279
|
}
|
|
2267
|
-
},
|
|
2280
|
+
}, de = async (e) => {
|
|
2268
2281
|
let n = m.findIndex((t) => t.conversationId === e), r = m[n + 1] ?? m[n - 1];
|
|
2269
2282
|
A.current = r ? {
|
|
2270
2283
|
kind: "select",
|
|
@@ -2280,12 +2293,12 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2280
2293
|
} finally {
|
|
2281
2294
|
re((e) => e - 1);
|
|
2282
2295
|
}
|
|
2283
|
-
},
|
|
2296
|
+
}, z = h === "loading" && m.length === 0, fe = h === "error" && m.length === 0, pe = h === "error" && m.length > 0 && b, B = h === "loading" && m.length > 0, me = ie || n === "loading", he = z ? l.historyLoadingText : P > 0 ? l.historyDeletingText : F ? l.historyDeletedText : m.length > 0 ? Dn(m.length === 1 ? l.historyCountTextOne : l.historyCountTextMany, { count: m.length }) : "", ge = z || P > 0;
|
|
2284
2297
|
return /* @__PURE__ */ y("section", {
|
|
2285
2298
|
role: "region",
|
|
2286
|
-
"aria-labelledby":
|
|
2299
|
+
"aria-labelledby": ee,
|
|
2287
2300
|
className: "bailey-history-drawer",
|
|
2288
|
-
onKeyDown:
|
|
2301
|
+
onKeyDown: le,
|
|
2289
2302
|
children: [
|
|
2290
2303
|
/* @__PURE__ */ y("div", {
|
|
2291
2304
|
className: "bailey-history-header",
|
|
@@ -2295,23 +2308,23 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2295
2308
|
className: "bailey-history-icon-button",
|
|
2296
2309
|
"aria-label": l.historyBackAriaLabel,
|
|
2297
2310
|
onClick: () => o({ restoreFocusTo: "menu" }),
|
|
2298
|
-
children: /* @__PURE__ */ v(
|
|
2311
|
+
children: /* @__PURE__ */ v(Kt, { className: "bailey-history-icon" })
|
|
2299
2312
|
}),
|
|
2300
2313
|
/* @__PURE__ */ v("h3", {
|
|
2301
|
-
id:
|
|
2302
|
-
ref:
|
|
2314
|
+
id: ee,
|
|
2315
|
+
ref: T,
|
|
2303
2316
|
tabIndex: -1,
|
|
2304
2317
|
className: "bailey-history-heading",
|
|
2305
2318
|
children: l.historyTitle
|
|
2306
2319
|
}),
|
|
2307
2320
|
/* @__PURE__ */ y("button", {
|
|
2308
|
-
ref:
|
|
2321
|
+
ref: E,
|
|
2309
2322
|
type: "button",
|
|
2310
2323
|
className: "bailey-history-button bailey-history-new-chat",
|
|
2311
2324
|
"aria-label": l.newChatButtonText,
|
|
2312
|
-
disabled:
|
|
2325
|
+
disabled: z,
|
|
2313
2326
|
onClick: a,
|
|
2314
|
-
children: [/* @__PURE__ */ v(
|
|
2327
|
+
children: [/* @__PURE__ */ v(Vt, { className: "bailey-history-icon-small" }), /* @__PURE__ */ v("span", {
|
|
2315
2328
|
className: "bailey-history-new-chat-text",
|
|
2316
2329
|
children: l.newChatButtonText
|
|
2317
2330
|
})]
|
|
@@ -2320,9 +2333,9 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2320
2333
|
}),
|
|
2321
2334
|
/* @__PURE__ */ y("div", {
|
|
2322
2335
|
className: "bailey-history-body",
|
|
2323
|
-
"aria-busy":
|
|
2336
|
+
"aria-busy": z || void 0,
|
|
2324
2337
|
children: [
|
|
2325
|
-
|
|
2338
|
+
z && /* @__PURE__ */ y("div", {
|
|
2326
2339
|
"aria-hidden": "true",
|
|
2327
2340
|
children: [
|
|
2328
2341
|
/* @__PURE__ */ v("div", { className: "bailey-history-skeleton" }),
|
|
@@ -2331,13 +2344,13 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2331
2344
|
/* @__PURE__ */ v("div", { className: "bailey-history-skeleton" })
|
|
2332
2345
|
]
|
|
2333
2346
|
}),
|
|
2334
|
-
|
|
2347
|
+
fe && /* @__PURE__ */ y("div", {
|
|
2335
2348
|
role: "alert",
|
|
2336
2349
|
className: "bailey-history-state bailey-history-state-error",
|
|
2337
2350
|
children: [
|
|
2338
|
-
/* @__PURE__ */ v(
|
|
2339
|
-
/* @__PURE__ */ v("strong", { children:
|
|
2340
|
-
/* @__PURE__ */ v("span", { children:
|
|
2351
|
+
/* @__PURE__ */ v(Jt, { className: "bailey-history-state-icon" }),
|
|
2352
|
+
/* @__PURE__ */ v("strong", { children: On(g) ? l.historySessionExpiredTitle : l.historyErrorTitle }),
|
|
2353
|
+
/* @__PURE__ */ v("span", { children: On(g) ? l.historySessionExpiredDescription : l.historyErrorDescription }),
|
|
2341
2354
|
/* @__PURE__ */ v("button", {
|
|
2342
2355
|
type: "button",
|
|
2343
2356
|
className: "bailey-history-button bailey-history-button-primary",
|
|
@@ -2346,10 +2359,10 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2346
2359
|
})
|
|
2347
2360
|
]
|
|
2348
2361
|
}),
|
|
2349
|
-
!
|
|
2362
|
+
!z && !fe && m.length === 0 && /* @__PURE__ */ y("div", {
|
|
2350
2363
|
className: "bailey-history-state",
|
|
2351
2364
|
children: [
|
|
2352
|
-
/* @__PURE__ */ v(
|
|
2365
|
+
/* @__PURE__ */ v(Rt, { className: "bailey-history-state-icon" }),
|
|
2353
2366
|
/* @__PURE__ */ v("strong", { children: l.historyEmptyTitle }),
|
|
2354
2367
|
/* @__PURE__ */ v("span", { children: l.historyEmptyDescription }),
|
|
2355
2368
|
/* @__PURE__ */ v("button", {
|
|
@@ -2368,11 +2381,11 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2368
2381
|
className: "bailey-history-row bailey-history-row-confirming",
|
|
2369
2382
|
children: /* @__PURE__ */ y("div", {
|
|
2370
2383
|
role: "group",
|
|
2371
|
-
"aria-labelledby":
|
|
2384
|
+
"aria-labelledby": w,
|
|
2372
2385
|
className: "bailey-history-confirm",
|
|
2373
2386
|
children: [
|
|
2374
2387
|
/* @__PURE__ */ v("span", {
|
|
2375
|
-
id:
|
|
2388
|
+
id: w,
|
|
2376
2389
|
className: "bailey-history-confirm-question",
|
|
2377
2390
|
children: l.historyDeleteConfirmQuestion
|
|
2378
2391
|
}),
|
|
@@ -2383,38 +2396,38 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2383
2396
|
/* @__PURE__ */ v("button", {
|
|
2384
2397
|
type: "button",
|
|
2385
2398
|
className: "bailey-history-button bailey-history-button-danger",
|
|
2386
|
-
onClick: () => void
|
|
2399
|
+
onClick: () => void de(n),
|
|
2387
2400
|
children: l.historyDeleteConfirmText
|
|
2388
2401
|
}),
|
|
2389
2402
|
/* @__PURE__ */ v("button", {
|
|
2390
|
-
ref:
|
|
2403
|
+
ref: D,
|
|
2391
2404
|
type: "button",
|
|
2392
2405
|
className: "bailey-history-button",
|
|
2393
|
-
onClick: () =>
|
|
2406
|
+
onClick: () => R(n),
|
|
2394
2407
|
children: l.historyDeleteCancelText
|
|
2395
2408
|
})
|
|
2396
2409
|
]
|
|
2397
2410
|
})
|
|
2398
2411
|
}, n);
|
|
2399
|
-
let a =
|
|
2412
|
+
let a = Tn({
|
|
2400
2413
|
iso: e.updatedAt,
|
|
2401
2414
|
locale: se,
|
|
2402
2415
|
now: p?.(),
|
|
2403
2416
|
justNowText: l.historyJustNowText
|
|
2404
|
-
}), o =
|
|
2417
|
+
}), o = Dn(e.messageCount === 1 ? l.historyMessageCountOne : l.historyMessageCountMany, { count: e.messageCount }), s = M === n;
|
|
2405
2418
|
return /* @__PURE__ */ y("li", {
|
|
2406
2419
|
className: `bailey-history-row${i ? " bailey-history-row-active" : ""}${s ? " bailey-history-row-failed" : ""}`,
|
|
2407
2420
|
children: [
|
|
2408
2421
|
/* @__PURE__ */ y("button", {
|
|
2409
2422
|
type: "button",
|
|
2410
2423
|
ref: (e) => {
|
|
2411
|
-
e ?
|
|
2424
|
+
e ? O.current.set(n, e) : O.current.delete(n);
|
|
2412
2425
|
},
|
|
2413
2426
|
className: "bailey-history-select",
|
|
2414
2427
|
"aria-current": i ? "true" : void 0,
|
|
2415
|
-
"aria-disabled":
|
|
2428
|
+
"aria-disabled": me || void 0,
|
|
2416
2429
|
onClick: () => {
|
|
2417
|
-
|
|
2430
|
+
me || ue(n);
|
|
2418
2431
|
},
|
|
2419
2432
|
children: [/* @__PURE__ */ v("span", {
|
|
2420
2433
|
className: "bailey-history-row-title",
|
|
@@ -2443,22 +2456,22 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2443
2456
|
e ? k.current.set(n, e) : k.current.delete(n);
|
|
2444
2457
|
},
|
|
2445
2458
|
className: "bailey-history-icon-button bailey-history-delete",
|
|
2446
|
-
"aria-label":
|
|
2459
|
+
"aria-label": Dn(l.historyDeleteAriaLabel, { title: r }),
|
|
2447
2460
|
onClick: () => {
|
|
2448
2461
|
N(null), I(!1), A.current = { kind: "cancel" }, ne(n);
|
|
2449
2462
|
},
|
|
2450
|
-
children: /* @__PURE__ */ v(
|
|
2463
|
+
children: /* @__PURE__ */ v(qt, { className: "bailey-history-icon" })
|
|
2451
2464
|
}),
|
|
2452
2465
|
s && /* @__PURE__ */ y("div", {
|
|
2453
2466
|
role: "alert",
|
|
2454
2467
|
className: "bailey-history-row-error",
|
|
2455
2468
|
children: [
|
|
2456
|
-
/* @__PURE__ */ v(
|
|
2469
|
+
/* @__PURE__ */ v(Jt, { className: "bailey-history-icon-small" }),
|
|
2457
2470
|
/* @__PURE__ */ v("span", { children: l.historyDeleteFailedText }),
|
|
2458
2471
|
/* @__PURE__ */ v("button", {
|
|
2459
2472
|
type: "button",
|
|
2460
2473
|
className: "bailey-history-button bailey-history-button-small",
|
|
2461
|
-
onClick: () => void
|
|
2474
|
+
onClick: () => void de(n),
|
|
2462
2475
|
children: l.historyDeleteRetryText
|
|
2463
2476
|
}),
|
|
2464
2477
|
/* @__PURE__ */ v("button", {
|
|
@@ -2480,24 +2493,24 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2480
2493
|
}),
|
|
2481
2494
|
b && m.length > 0 && /* @__PURE__ */ v("div", {
|
|
2482
2495
|
className: "bailey-history-more",
|
|
2483
|
-
children:
|
|
2496
|
+
children: pe ? /* @__PURE__ */ y("div", {
|
|
2484
2497
|
role: "alert",
|
|
2485
2498
|
className: "bailey-history-inline-error",
|
|
2486
2499
|
children: [/* @__PURE__ */ v("span", { children: l.historyLoadMoreErrorText }), /* @__PURE__ */ v("button", {
|
|
2487
2500
|
type: "button",
|
|
2488
2501
|
className: "bailey-history-button",
|
|
2489
|
-
onClick:
|
|
2502
|
+
onClick: ce,
|
|
2490
2503
|
children: l.retryButtonText
|
|
2491
2504
|
})]
|
|
2492
2505
|
}) : /* @__PURE__ */ y("button", {
|
|
2493
2506
|
type: "button",
|
|
2494
2507
|
className: "bailey-history-button",
|
|
2495
|
-
disabled:
|
|
2496
|
-
onClick:
|
|
2497
|
-
children: [
|
|
2508
|
+
disabled: B,
|
|
2509
|
+
onClick: ce,
|
|
2510
|
+
children: [B && /* @__PURE__ */ v("span", {
|
|
2498
2511
|
className: "bailey-history-spinner",
|
|
2499
2512
|
"aria-hidden": "true"
|
|
2500
|
-
}),
|
|
2513
|
+
}), B ? l.historyLoadingMoreText : l.historyLoadMoreText]
|
|
2501
2514
|
})
|
|
2502
2515
|
})
|
|
2503
2516
|
]
|
|
@@ -2506,16 +2519,16 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
|
|
|
2506
2519
|
role: "status",
|
|
2507
2520
|
"aria-live": "polite",
|
|
2508
2521
|
className: "bailey-history-status",
|
|
2509
|
-
children: [
|
|
2522
|
+
children: [ge && /* @__PURE__ */ v("span", {
|
|
2510
2523
|
className: "bailey-history-spinner",
|
|
2511
2524
|
"aria-hidden": "true"
|
|
2512
|
-
}),
|
|
2525
|
+
}), he]
|
|
2513
2526
|
})
|
|
2514
2527
|
]
|
|
2515
2528
|
});
|
|
2516
2529
|
}
|
|
2517
2530
|
// src/ui/historyLabels.ts
|
|
2518
|
-
var
|
|
2531
|
+
var An = {
|
|
2519
2532
|
newChatButtonText: "New chat",
|
|
2520
2533
|
retryButtonText: "Retry",
|
|
2521
2534
|
historyTitle: "Chat history",
|
|
@@ -2548,7 +2561,7 @@ var kn = {
|
|
|
2548
2561
|
historyDeleteRetryText: "Try again",
|
|
2549
2562
|
historyDeleteDismissText: "Dismiss",
|
|
2550
2563
|
historyJustNowText: "just now"
|
|
2551
|
-
},
|
|
2564
|
+
}, jn = {
|
|
2552
2565
|
feedbackGroupLabel: "Rate this response",
|
|
2553
2566
|
feedbackThumbsUpAriaLabel: "Good response",
|
|
2554
2567
|
feedbackThumbsDownAriaLabel: "Bad response",
|
|
@@ -2568,50 +2581,50 @@ var kn = {
|
|
|
2568
2581
|
feedbackReasonUnsafe: "Unsafe",
|
|
2569
2582
|
feedbackReasonTooLong: "Too long",
|
|
2570
2583
|
feedbackReasonOther: "Other"
|
|
2571
|
-
},
|
|
2584
|
+
}, Mn = 2e3, Nn = [
|
|
2572
2585
|
"inaccurate",
|
|
2573
2586
|
"unhelpful",
|
|
2574
2587
|
"unsafe",
|
|
2575
2588
|
"too_long",
|
|
2576
2589
|
"other"
|
|
2577
|
-
],
|
|
2590
|
+
], Pn = {
|
|
2578
2591
|
inaccurate: "feedbackReasonInaccurate",
|
|
2579
2592
|
unhelpful: "feedbackReasonUnhelpful",
|
|
2580
2593
|
unsafe: "feedbackReasonUnsafe",
|
|
2581
2594
|
too_long: "feedbackReasonTooLong",
|
|
2582
2595
|
other: "feedbackReasonOther"
|
|
2583
|
-
},
|
|
2584
|
-
function Fn(e) {
|
|
2585
|
-
return Array.from(new Set((e ?? Mn).map(Pn)));
|
|
2586
|
-
}
|
|
2596
|
+
}, Fn = (e) => Nn.includes(e) ? e : "other";
|
|
2587
2597
|
function In(e) {
|
|
2588
|
-
return
|
|
2598
|
+
return Array.from(new Set((e ?? Nn).map(Fn)));
|
|
2599
|
+
}
|
|
2600
|
+
function Ln(e) {
|
|
2601
|
+
return typeof e == "number" && e > 0 ? Math.min(Math.floor(e), Mn) : Mn;
|
|
2589
2602
|
}
|
|
2590
|
-
function
|
|
2603
|
+
function Rn(e, t) {
|
|
2591
2604
|
if (e === null || t === null) return e === t;
|
|
2592
2605
|
let n = e.reasonCodes ?? [], r = t.reasonCodes ?? [];
|
|
2593
2606
|
return e.rating === t.rating && (e.comment ?? "") === (t.comment ?? "") && n.length === r.length && n.every((e, t) => e === r[t]);
|
|
2594
2607
|
}
|
|
2595
|
-
function
|
|
2596
|
-
let t = o(
|
|
2597
|
-
return l(() => n && r ? n(r) : void 0, [n, r]), e.messageId ? /* @__PURE__ */ v(
|
|
2608
|
+
function zn(e) {
|
|
2609
|
+
let t = o(jt), n = t && !t.builtIn ? t.claim : void 0, { messageId: r } = e;
|
|
2610
|
+
return l(() => n && r ? n(r) : void 0, [n, r]), e.messageId ? /* @__PURE__ */ v(Bn, { ...e }, e.messageId) : null;
|
|
2598
2611
|
}
|
|
2599
|
-
function
|
|
2612
|
+
function Bn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOptions: i, maxCommentLength: a, labels: o, assistantName: l = "bailey", className: u }) {
|
|
2600
2613
|
let p = {
|
|
2601
|
-
...
|
|
2614
|
+
...jn,
|
|
2602
2615
|
feedbackCommentPlaceholder: `What should ${l} have said or done differently?`,
|
|
2603
2616
|
...o
|
|
2604
|
-
}, m =
|
|
2617
|
+
}, m = In(i), h = Ln(a), b = r ? { rating: r } : null, [x, S] = f(b), [C, ee] = f(r ?? null), [w, T] = f(!1), [E, D] = f("down"), [O, k] = f([]), [A, j] = f(""), [te, ne] = f(!1), [M, N] = f(!1), [P, re] = f(!1), [F, I] = f(!1), ie = d(b), L = d(null), ae = d(0), oe = d(!1), se = d(!0), ce = d(null), R = d(null), le = d(null), ue = d(null), de = d(null), z = At(R), fe = c(), pe = `${fe}-comment`, B = `${fe}-counter`, me = `${fe}-privacy`;
|
|
2605
2618
|
s(() => (se.current = !0, () => {
|
|
2606
2619
|
se.current = !1;
|
|
2607
2620
|
}), []), s(() => {
|
|
2608
|
-
|
|
2609
|
-
}, [
|
|
2610
|
-
|
|
2621
|
+
w && de.current?.focus();
|
|
2622
|
+
}, [w]), s(() => {
|
|
2623
|
+
ce.current && !P && !w && ((ce.current === "up" ? le : ue).current?.focus(), ce.current = null);
|
|
2611
2624
|
});
|
|
2612
|
-
let
|
|
2625
|
+
let he = () => {
|
|
2613
2626
|
k([]), j("");
|
|
2614
|
-
},
|
|
2627
|
+
}, ge = async (r) => {
|
|
2615
2628
|
try {
|
|
2616
2629
|
return r.kind === "clear" ? await n({ messageId: e }) : await t({
|
|
2617
2630
|
messageId: e,
|
|
@@ -2620,73 +2633,73 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
2620
2633
|
} catch {
|
|
2621
2634
|
return !1;
|
|
2622
2635
|
}
|
|
2623
|
-
},
|
|
2636
|
+
}, _e = async () => {
|
|
2624
2637
|
if (!oe.current) {
|
|
2625
2638
|
oe.current = !0, N(!0);
|
|
2626
2639
|
try {
|
|
2627
2640
|
for (; L.current && se.current;) {
|
|
2628
|
-
let e = L.current, t = e.kind === "clear" ? null : e.snapshot, n = !(e.kind === "submit" && e.formSubmit) &&
|
|
2641
|
+
let e = L.current, t = e.kind === "clear" ? null : e.snapshot, n = !(e.kind === "submit" && e.formSubmit) && Rn(t, ie.current) || await ge(e);
|
|
2629
2642
|
if (!se.current) return;
|
|
2630
2643
|
let r = L.current?.version !== e.version;
|
|
2631
|
-
(n || !r) && (n ? (ie.current = t, S(t)) : (
|
|
2644
|
+
(n || !r) && (n ? (ie.current = t, S(t)) : (ee(ie.current?.rating ?? null), I(!0)), r || (L.current = null, re(!1), n && e.kind === "submit" && e.formSubmit && (T(!1), ne(!0), ce.current = e.snapshot.rating)));
|
|
2632
2645
|
}
|
|
2633
2646
|
} finally {
|
|
2634
2647
|
oe.current = !1, se.current && N(!1);
|
|
2635
2648
|
}
|
|
2636
2649
|
}
|
|
2637
|
-
},
|
|
2650
|
+
}, ve = (e) => {
|
|
2638
2651
|
ae.current += 1, L.current = {
|
|
2639
2652
|
...e,
|
|
2640
2653
|
version: ae.current
|
|
2641
|
-
}, I(!1),
|
|
2642
|
-
},
|
|
2643
|
-
|
|
2644
|
-
},
|
|
2645
|
-
P || (C === e ?
|
|
2654
|
+
}, I(!1), _e();
|
|
2655
|
+
}, ye = () => {
|
|
2656
|
+
ee(null), T(!1), ne(!1), he(), ve({ kind: "clear" });
|
|
2657
|
+
}, be = (e) => {
|
|
2658
|
+
P || (C === e ? ye() : (ee(e), ne(!1), he(), e === "down" ? (D("down"), T(!0)) : T(!1), ve({
|
|
2646
2659
|
kind: "submit",
|
|
2647
2660
|
snapshot: { rating: e },
|
|
2648
2661
|
formSubmit: !1
|
|
2649
2662
|
})));
|
|
2650
|
-
},
|
|
2651
|
-
C !== null && (
|
|
2652
|
-
},
|
|
2653
|
-
P || (
|
|
2654
|
-
},
|
|
2663
|
+
}, V = (e) => {
|
|
2664
|
+
C !== null && (D(C), k((e?.reasonCodes ?? []).map(Fn)), j(e?.comment ?? ""), I(!1), T(!0));
|
|
2665
|
+
}, H = () => {
|
|
2666
|
+
P || (T(!1), I(!1), he(), ce.current = E);
|
|
2667
|
+
}, xe = () => {
|
|
2655
2668
|
if (P) return;
|
|
2656
|
-
let e = A.trim(), t = m.filter((e) =>
|
|
2657
|
-
rating:
|
|
2669
|
+
let e = A.trim(), t = m.filter((e) => O.includes(e)), n = {
|
|
2670
|
+
rating: E,
|
|
2658
2671
|
...t.length > 0 ? { reasonCodes: t } : {},
|
|
2659
2672
|
...e ? { comment: e } : {}
|
|
2660
2673
|
};
|
|
2661
|
-
re(!0),
|
|
2674
|
+
re(!0), ee(E), ve({
|
|
2662
2675
|
kind: "submit",
|
|
2663
2676
|
snapshot: n,
|
|
2664
2677
|
formSubmit: !0
|
|
2665
2678
|
});
|
|
2666
|
-
},
|
|
2679
|
+
}, U = (e) => {
|
|
2667
2680
|
k((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
2668
|
-
},
|
|
2669
|
-
e.key === "Escape" && (e.stopPropagation(),
|
|
2670
|
-
},
|
|
2671
|
-
let t = C === e, n = e === "up" ? p.feedbackThumbsUpAriaLabel : p.feedbackThumbsDownAriaLabel, r = e === "up" ?
|
|
2681
|
+
}, W = (e) => {
|
|
2682
|
+
e.key === "Escape" && (e.stopPropagation(), H());
|
|
2683
|
+
}, G = C !== null && x?.rating === C && !M && !w, K = !!x && (!!x.comment || (x.reasonCodes?.length ?? 0) > 0), Se = M ? p.feedbackSavingText : G ? p.feedbackThanksText : "", Ce = (e) => {
|
|
2684
|
+
let t = C === e, n = e === "up" ? p.feedbackThumbsUpAriaLabel : p.feedbackThumbsDownAriaLabel, r = e === "up" ? Wt : Gt;
|
|
2672
2685
|
return /* @__PURE__ */ y(g.Root, { children: [/* @__PURE__ */ v(g.Trigger, {
|
|
2673
2686
|
asChild: !0,
|
|
2674
2687
|
children: /* @__PURE__ */ v("button", {
|
|
2675
|
-
ref: e === "up" ?
|
|
2688
|
+
ref: e === "up" ? le : ue,
|
|
2676
2689
|
type: "button",
|
|
2677
2690
|
className: "bailey-feedback-thumb",
|
|
2678
2691
|
"aria-pressed": t,
|
|
2679
2692
|
"aria-label": n,
|
|
2680
2693
|
"aria-busy": t && M ? !0 : void 0,
|
|
2681
2694
|
disabled: P,
|
|
2682
|
-
onClick: () =>
|
|
2695
|
+
onClick: () => be(e),
|
|
2683
2696
|
children: /* @__PURE__ */ v(r, {
|
|
2684
2697
|
className: "bailey-feedback-icon",
|
|
2685
2698
|
filled: t
|
|
2686
2699
|
})
|
|
2687
2700
|
})
|
|
2688
2701
|
}), /* @__PURE__ */ v(g.Portal, {
|
|
2689
|
-
container:
|
|
2702
|
+
container: z instanceof ShadowRoot ? z : void 0,
|
|
2690
2703
|
children: /* @__PURE__ */ y(g.Content, {
|
|
2691
2704
|
side: "top",
|
|
2692
2705
|
className: "bailey-tooltip-content",
|
|
@@ -2695,7 +2708,7 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
2695
2708
|
})] });
|
|
2696
2709
|
};
|
|
2697
2710
|
return /* @__PURE__ */ y("div", {
|
|
2698
|
-
ref:
|
|
2711
|
+
ref: R,
|
|
2699
2712
|
className: `bailey-feedback${u ? ` ${u}` : ""}`,
|
|
2700
2713
|
children: [
|
|
2701
2714
|
/* @__PURE__ */ v(g.Provider, {
|
|
@@ -2705,7 +2718,7 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
2705
2718
|
"aria-label": p.feedbackGroupLabel,
|
|
2706
2719
|
"aria-busy": M ? !0 : void 0,
|
|
2707
2720
|
className: "bailey-feedback-thumbs",
|
|
2708
|
-
children: [
|
|
2721
|
+
children: [Ce("up"), Ce("down")]
|
|
2709
2722
|
})
|
|
2710
2723
|
}),
|
|
2711
2724
|
/* @__PURE__ */ y("span", {
|
|
@@ -2714,17 +2727,17 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
2714
2727
|
children: [M && /* @__PURE__ */ v("span", {
|
|
2715
2728
|
className: "bailey-feedback-spinner",
|
|
2716
2729
|
"aria-hidden": "true"
|
|
2717
|
-
}),
|
|
2730
|
+
}), Se]
|
|
2718
2731
|
}),
|
|
2719
|
-
|
|
2732
|
+
G && /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("button", {
|
|
2720
2733
|
type: "button",
|
|
2721
2734
|
className: "bailey-feedback-link",
|
|
2722
|
-
onClick: () =>
|
|
2723
|
-
children: te ||
|
|
2735
|
+
onClick: () => V(x),
|
|
2736
|
+
children: te || K ? p.feedbackEditText : p.feedbackAddCommentText
|
|
2724
2737
|
}), /* @__PURE__ */ v("button", {
|
|
2725
2738
|
type: "button",
|
|
2726
2739
|
className: "bailey-feedback-link",
|
|
2727
|
-
onClick:
|
|
2740
|
+
onClick: ye,
|
|
2728
2741
|
children: p.feedbackUndoText
|
|
2729
2742
|
})] }),
|
|
2730
2743
|
F && /* @__PURE__ */ v("span", {
|
|
@@ -2732,9 +2745,9 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
2732
2745
|
className: "bailey-feedback-error",
|
|
2733
2746
|
children: p.feedbackErrorText
|
|
2734
2747
|
}),
|
|
2735
|
-
|
|
2748
|
+
w && /* @__PURE__ */ y("div", {
|
|
2736
2749
|
className: "bailey-feedback-form",
|
|
2737
|
-
onKeyDown:
|
|
2750
|
+
onKeyDown: W,
|
|
2738
2751
|
children: [
|
|
2739
2752
|
m.length > 0 && /* @__PURE__ */ y("fieldset", {
|
|
2740
2753
|
className: "bailey-feedback-reasons",
|
|
@@ -2745,43 +2758,43 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
2745
2758
|
className: "bailey-feedback-chips",
|
|
2746
2759
|
children: m.map((e, t) => /* @__PURE__ */ v("button", {
|
|
2747
2760
|
ref: t === 0 ? (e) => {
|
|
2748
|
-
|
|
2761
|
+
de.current = e;
|
|
2749
2762
|
} : void 0,
|
|
2750
2763
|
type: "button",
|
|
2751
2764
|
className: "bailey-feedback-chip",
|
|
2752
|
-
"aria-pressed":
|
|
2765
|
+
"aria-pressed": O.includes(e),
|
|
2753
2766
|
disabled: P,
|
|
2754
|
-
onClick: () =>
|
|
2755
|
-
children: p[
|
|
2767
|
+
onClick: () => U(e),
|
|
2768
|
+
children: p[Pn[e]]
|
|
2756
2769
|
}, e))
|
|
2757
2770
|
})]
|
|
2758
2771
|
}),
|
|
2759
2772
|
/* @__PURE__ */ v("label", {
|
|
2760
|
-
htmlFor:
|
|
2773
|
+
htmlFor: pe,
|
|
2761
2774
|
className: "bailey-feedback-legend",
|
|
2762
2775
|
children: p.feedbackCommentLabel
|
|
2763
2776
|
}),
|
|
2764
2777
|
/* @__PURE__ */ v("textarea", {
|
|
2765
|
-
id:
|
|
2778
|
+
id: pe,
|
|
2766
2779
|
ref: m.length === 0 ? (e) => {
|
|
2767
|
-
|
|
2780
|
+
de.current = e;
|
|
2768
2781
|
} : void 0,
|
|
2769
2782
|
className: "bailey-feedback-textarea",
|
|
2770
2783
|
value: A,
|
|
2771
2784
|
maxLength: h,
|
|
2772
2785
|
placeholder: p.feedbackCommentPlaceholder,
|
|
2773
|
-
"aria-describedby": `${
|
|
2786
|
+
"aria-describedby": `${B} ${me}`,
|
|
2774
2787
|
disabled: P,
|
|
2775
2788
|
onChange: (e) => j(e.target.value.slice(0, h))
|
|
2776
2789
|
}),
|
|
2777
2790
|
/* @__PURE__ */ y("div", {
|
|
2778
2791
|
className: "bailey-feedback-meta",
|
|
2779
2792
|
children: [/* @__PURE__ */ v("span", {
|
|
2780
|
-
id:
|
|
2793
|
+
id: me,
|
|
2781
2794
|
className: "bailey-feedback-privacy",
|
|
2782
2795
|
children: p.feedbackPrivacyNote
|
|
2783
2796
|
}), /* @__PURE__ */ v("span", {
|
|
2784
|
-
id:
|
|
2797
|
+
id: B,
|
|
2785
2798
|
className: "bailey-feedback-counter",
|
|
2786
2799
|
children: `${A.length} / ${h}`
|
|
2787
2800
|
})]
|
|
@@ -2792,13 +2805,13 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
2792
2805
|
type: "button",
|
|
2793
2806
|
className: "bailey-feedback-button",
|
|
2794
2807
|
disabled: P,
|
|
2795
|
-
onClick:
|
|
2808
|
+
onClick: H,
|
|
2796
2809
|
children: p.feedbackCancelText
|
|
2797
2810
|
}), /* @__PURE__ */ v("button", {
|
|
2798
2811
|
type: "button",
|
|
2799
2812
|
className: "bailey-feedback-button bailey-feedback-button-primary",
|
|
2800
2813
|
disabled: P,
|
|
2801
|
-
onClick:
|
|
2814
|
+
onClick: xe,
|
|
2802
2815
|
children: P ? p.feedbackSavingText : p.feedbackSubmitText
|
|
2803
2816
|
})]
|
|
2804
2817
|
})
|
|
@@ -2808,8 +2821,8 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
|
|
|
2808
2821
|
});
|
|
2809
2822
|
}
|
|
2810
2823
|
// src/ui/BaileyChatPanel.tsx
|
|
2811
|
-
var
|
|
2812
|
-
...
|
|
2824
|
+
var Vn = "bailey", Hn = {
|
|
2825
|
+
...An,
|
|
2813
2826
|
newChatButtonText: "New chat",
|
|
2814
2827
|
newChatAriaLabel: "new chat",
|
|
2815
2828
|
historyAriaLabel: "conversation history",
|
|
@@ -2835,84 +2848,84 @@ var Bn = "bailey", Vn = {
|
|
|
2835
2848
|
mcpAppDefaultTitle: "MCP App",
|
|
2836
2849
|
loadEarlierButtonText: "Load earlier messages",
|
|
2837
2850
|
loadEarlierErrorText: "Couldn't load earlier messages."
|
|
2838
|
-
},
|
|
2839
|
-
...
|
|
2851
|
+
}, Un = [m], Wn = {
|
|
2852
|
+
...Mt(),
|
|
2840
2853
|
p: ({ children: e }) => /* @__PURE__ */ v(_, { children: e })
|
|
2841
|
-
},
|
|
2854
|
+
}, Gn = i(function({ content: e, components: t }) {
|
|
2842
2855
|
return /* @__PURE__ */ v("div", {
|
|
2843
2856
|
className: "bailey-markdown-content",
|
|
2844
2857
|
children: /* @__PURE__ */ v(p, {
|
|
2845
|
-
remarkPlugins:
|
|
2858
|
+
remarkPlugins: Un,
|
|
2846
2859
|
components: t,
|
|
2847
2860
|
skipHtml: !0,
|
|
2848
2861
|
children: e
|
|
2849
2862
|
})
|
|
2850
2863
|
});
|
|
2851
2864
|
});
|
|
2852
|
-
function
|
|
2865
|
+
function Kn(e, t, n) {
|
|
2853
2866
|
if (e !== "streaming") return;
|
|
2854
2867
|
let r = t.filter((e) => e.turnSentAt === n?.sentAt);
|
|
2855
2868
|
return r[r.length - 1];
|
|
2856
2869
|
}
|
|
2857
|
-
function Kn(e) {
|
|
2858
|
-
if (e && e.kind !== "tool_end") return at(e);
|
|
2859
|
-
}
|
|
2860
2870
|
function qn(e) {
|
|
2871
|
+
if (e && e.kind !== "tool_end") return ot(e);
|
|
2872
|
+
}
|
|
2873
|
+
function Jn(e) {
|
|
2861
2874
|
let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), r = t.toLocaleTimeString([], {
|
|
2862
2875
|
hour: "numeric",
|
|
2863
2876
|
minute: "2-digit"
|
|
2864
2877
|
});
|
|
2865
2878
|
return n ? `Today ${r}` : `${t.toLocaleDateString()} ${r}`;
|
|
2866
2879
|
}
|
|
2867
|
-
function
|
|
2868
|
-
let { messages: N, traceEvents: P, lastRequest: re, status: F, error: I, send: ie, stop: L, retryLast: ae, clearTrace: oe, clearError: se, newChat:
|
|
2869
|
-
let t = (t) =>
|
|
2880
|
+
function Yn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i, assistantName: o = Vn, suggestions: c, suggestionsAlign: l = "start", hideMenuButton: m = !1, onHistoryClick: _, history: b, locale: x, privacyNote: S, resolveActivityIcon: C, sendIcon: ee, className: w, height: T, width: E, hideDeveloperDetails: D = !1, renderMessageActions: O, feedback: k, renderTable: A, renderChart: j, renderMcpApp: te, labels: ne, formatMessageTime: M }) {
|
|
2881
|
+
let { messages: N, traceEvents: P, lastRequest: re, status: F, error: I, send: ie, stop: L, retryLast: ae, clearTrace: oe, clearError: se, newChat: ce } = e, [R, le] = f(""), [ue, de] = f(/* @__PURE__ */ new Map()), z = a((e) => {
|
|
2882
|
+
let t = (t) => de((n) => {
|
|
2870
2883
|
let r = new Map(n), i = (r.get(e) ?? 0) + t;
|
|
2871
2884
|
return i > 0 ? r.set(e, i) : r.delete(e), r;
|
|
2872
2885
|
});
|
|
2873
2886
|
return t(1), () => t(-1);
|
|
2874
|
-
}, []),
|
|
2887
|
+
}, []), fe = u(() => ({
|
|
2875
2888
|
builtIn: !1,
|
|
2876
|
-
claim:
|
|
2877
|
-
}), [
|
|
2889
|
+
claim: z
|
|
2890
|
+
}), [z]), pe = u(() => ({
|
|
2878
2891
|
builtIn: !0,
|
|
2879
|
-
claim:
|
|
2880
|
-
}), [
|
|
2881
|
-
...
|
|
2892
|
+
claim: z
|
|
2893
|
+
}), [z]), B = {
|
|
2894
|
+
...Hn,
|
|
2882
2895
|
emptyStateMessage: `Ask ${o} a question to get started.`,
|
|
2883
2896
|
...ne
|
|
2884
|
-
},
|
|
2897
|
+
}, me = M ?? Jn, he = d(null), ge = d(null), _e = d(null), ve = d(null), [ye, be] = f(!1), V = d(null), H = d(!1), xe = !!_ || !!b, U = kt(he), W = d(null), G = d(null), K = d(!0), Se = u(() => Mt({
|
|
2885
2898
|
renderTable: A,
|
|
2886
2899
|
renderChart: j
|
|
2887
|
-
}), [A, j]),
|
|
2900
|
+
}), [A, j]), Ce = u(() => Kn(F, P, re), [
|
|
2888
2901
|
F,
|
|
2889
2902
|
P,
|
|
2890
2903
|
re
|
|
2891
|
-
]),
|
|
2892
|
-
|
|
2893
|
-
at:
|
|
2894
|
-
length:
|
|
2895
|
-
},
|
|
2896
|
-
let
|
|
2904
|
+
]), we = qn(Ce), Te = Ce?.kind === "tool_end" ? Ce.at : void 0, q = N[N.length - 1]?.content.length ?? 0, [Ee, De] = f(null), J = Ee;
|
|
2905
|
+
Te !== void 0 && Ee?.at !== Te && (J = {
|
|
2906
|
+
at: Te,
|
|
2907
|
+
length: q
|
|
2908
|
+
}, De(J));
|
|
2909
|
+
let Y = Te !== void 0 && J?.at === Te && q <= J.length, X = we ?? (Y ? B.thinkingHint : void 0), Oe = N.length === 0, Z = t ?? (Oe ? i ?? `How can ${o} AI help you today?` : r ?? `Reply to ${o} AI`);
|
|
2897
2910
|
s(() => {
|
|
2898
|
-
let e =
|
|
2911
|
+
let e = G.current;
|
|
2899
2912
|
if (!e) return;
|
|
2900
2913
|
let t = () => {
|
|
2901
2914
|
let t = e.scrollHeight - e.scrollTop - e.clientHeight;
|
|
2902
|
-
|
|
2915
|
+
K.current = t < 60;
|
|
2903
2916
|
};
|
|
2904
2917
|
return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
|
|
2905
2918
|
}, []), s(() => {
|
|
2906
|
-
|
|
2919
|
+
K.current && W.current?.scrollIntoView({
|
|
2907
2920
|
behavior: F === "streaming" ? "auto" : "smooth",
|
|
2908
2921
|
block: "nearest"
|
|
2909
2922
|
});
|
|
2910
2923
|
}, [N, F]);
|
|
2911
2924
|
let ke = (e) => {
|
|
2912
|
-
|
|
2913
|
-
}, Ae = d(null),
|
|
2914
|
-
let t =
|
|
2915
|
-
|
|
2925
|
+
K.current = !0, ie(e);
|
|
2926
|
+
}, Ae = d(null), je = () => {
|
|
2927
|
+
let t = G.current;
|
|
2928
|
+
K.current = !1, Ae.current = t ? {
|
|
2916
2929
|
height: t.scrollHeight,
|
|
2917
2930
|
top: t.scrollTop
|
|
2918
2931
|
} : null, e.loadEarlier?.().catch(() => {
|
|
@@ -2920,35 +2933,35 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
|
|
|
2920
2933
|
});
|
|
2921
2934
|
};
|
|
2922
2935
|
s(() => {
|
|
2923
|
-
let e = Ae.current, t =
|
|
2936
|
+
let e = Ae.current, t = G.current;
|
|
2924
2937
|
e && t && t.scrollHeight !== e.height && (t.scrollTop = e.top + (t.scrollHeight - e.height), Ae.current = null);
|
|
2925
2938
|
}, [N]), s(() => {
|
|
2926
|
-
|
|
2927
|
-
}, [
|
|
2928
|
-
!
|
|
2929
|
-
}, [
|
|
2930
|
-
let
|
|
2931
|
-
|
|
2939
|
+
ge.current?.toggleAttribute("inert", ye);
|
|
2940
|
+
}, [ye]), s(() => {
|
|
2941
|
+
!ye && V.current && ((V.current === "input" ? _e.current : ve.current)?.focus(), V.current = null);
|
|
2942
|
+
}, [ye]);
|
|
2943
|
+
let Q = a((e) => {
|
|
2944
|
+
V.current = e.restoreFocusTo, be(!1);
|
|
2932
2945
|
}, []);
|
|
2933
|
-
return /* @__PURE__ */ v(
|
|
2934
|
-
value:
|
|
2935
|
-
children: /* @__PURE__ */ v(
|
|
2936
|
-
value:
|
|
2946
|
+
return /* @__PURE__ */ v(gt.Provider, {
|
|
2947
|
+
value: U,
|
|
2948
|
+
children: /* @__PURE__ */ v(jt.Provider, {
|
|
2949
|
+
value: fe,
|
|
2937
2950
|
children: /* @__PURE__ */ y("div", {
|
|
2938
|
-
ref:
|
|
2939
|
-
className: `bailey-chat-panel${
|
|
2940
|
-
style:
|
|
2941
|
-
height:
|
|
2942
|
-
width:
|
|
2951
|
+
ref: he,
|
|
2952
|
+
className: `bailey-chat-panel${w ? ` ${w}` : ""}`,
|
|
2953
|
+
style: T !== void 0 || E !== void 0 ? {
|
|
2954
|
+
height: T,
|
|
2955
|
+
width: E
|
|
2943
2956
|
} : void 0,
|
|
2944
2957
|
children: [/* @__PURE__ */ y("div", {
|
|
2945
2958
|
className: "bailey-chat-panel-inner",
|
|
2946
|
-
ref:
|
|
2959
|
+
ref: ge,
|
|
2947
2960
|
children: [
|
|
2948
2961
|
/* @__PURE__ */ y("div", {
|
|
2949
2962
|
className: "bailey-chat-transcript",
|
|
2950
|
-
ref:
|
|
2951
|
-
"data-suggestions-align":
|
|
2963
|
+
ref: G,
|
|
2964
|
+
"data-suggestions-align": Oe && c && c.length > 0 ? l : void 0,
|
|
2952
2965
|
children: [
|
|
2953
2966
|
e.hasEarlier && e.loadEarlier && /* @__PURE__ */ y("div", {
|
|
2954
2967
|
className: "bailey-load-earlier",
|
|
@@ -2956,32 +2969,32 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
|
|
|
2956
2969
|
type: "button",
|
|
2957
2970
|
className: "bailey-load-earlier-button",
|
|
2958
2971
|
disabled: e.historyStatus === "loading",
|
|
2959
|
-
onClick:
|
|
2960
|
-
children:
|
|
2972
|
+
onClick: je,
|
|
2973
|
+
children: B.loadEarlierButtonText
|
|
2961
2974
|
}), e.historyStatus === "error" && /* @__PURE__ */ v("div", {
|
|
2962
2975
|
role: "alert",
|
|
2963
2976
|
className: "bailey-load-earlier-error",
|
|
2964
|
-
children:
|
|
2977
|
+
children: B.loadEarlierErrorText
|
|
2965
2978
|
})]
|
|
2966
2979
|
}),
|
|
2967
|
-
|
|
2980
|
+
Oe && (c && c.length > 0 ? /* @__PURE__ */ y("div", {
|
|
2968
2981
|
className: "bailey-suggestions",
|
|
2969
2982
|
"data-align": l,
|
|
2970
|
-
children: [
|
|
2983
|
+
children: [B.suggestionsTitle && /* @__PURE__ */ v("div", {
|
|
2971
2984
|
className: "bailey-suggestions-title",
|
|
2972
|
-
children:
|
|
2985
|
+
children: B.suggestionsTitle
|
|
2973
2986
|
}), c.map((e, t) => /* @__PURE__ */ y("button", {
|
|
2974
2987
|
type: "button",
|
|
2975
2988
|
onClick: () => ke(e.value ?? e.label),
|
|
2976
2989
|
className: "bailey-suggestion-card",
|
|
2977
|
-
children: [/* @__PURE__ */ v("span", { children: e.label }), e.icon ?? /* @__PURE__ */ v(
|
|
2990
|
+
children: [/* @__PURE__ */ v("span", { children: e.label }), e.icon ?? /* @__PURE__ */ v(Ft, { className: "bailey-suggestion-icon" })]
|
|
2978
2991
|
}, `${e.label}-${t}`))]
|
|
2979
2992
|
}) : /* @__PURE__ */ v("div", {
|
|
2980
2993
|
className: "bailey-empty-state",
|
|
2981
|
-
children:
|
|
2994
|
+
children: B.emptyStateMessage
|
|
2982
2995
|
})),
|
|
2983
2996
|
N.map((t, r) => {
|
|
2984
|
-
let i = t.role === "assistant" && r === N.length - 1, a = F === "streaming" && i && t.content === "", s = t.role === "assistant" ?
|
|
2997
|
+
let i = t.role === "assistant" && r === N.length - 1, a = F === "streaming" && i && t.content === "", s = t.role === "assistant" ? mt(P, t.createdAt) : [], c = s.some((e) => e.status === "running");
|
|
2985
2998
|
return /* @__PURE__ */ v("div", {
|
|
2986
2999
|
className: t.role === "user" ? "bailey-message-row bailey-message-row-user" : "bailey-message-row",
|
|
2987
3000
|
children: t.role === "user" ? /* @__PURE__ */ y("div", {
|
|
@@ -2990,47 +3003,47 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
|
|
|
2990
3003
|
className: "bailey-message-meta",
|
|
2991
3004
|
children: [/* @__PURE__ */ v("span", {
|
|
2992
3005
|
className: "bailey-message-meta-name",
|
|
2993
|
-
children:
|
|
2994
|
-
}), t.createdAt !== void 0 && /* @__PURE__ */ v("span", { children:
|
|
3006
|
+
children: B.youLabel
|
|
3007
|
+
}), t.createdAt !== void 0 && /* @__PURE__ */ v("span", { children: me(t.createdAt) })]
|
|
2995
3008
|
}), /* @__PURE__ */ v("div", {
|
|
2996
3009
|
className: "bailey-user-bubble",
|
|
2997
3010
|
children: t.content
|
|
2998
3011
|
})]
|
|
2999
|
-
}) : a ? c ? /* @__PURE__ */ v(
|
|
3012
|
+
}) : a ? c ? /* @__PURE__ */ v(_n, {
|
|
3000
3013
|
steps: s,
|
|
3001
3014
|
resolveActivityIcon: C
|
|
3002
3015
|
}) : /* @__PURE__ */ y("div", {
|
|
3003
3016
|
className: "bailey-thinking-hint",
|
|
3004
|
-
children: [/* @__PURE__ */ v("span", { children:
|
|
3017
|
+
children: [/* @__PURE__ */ v("span", { children: we ?? B.thinkingHint }), /* @__PURE__ */ v("span", {
|
|
3005
3018
|
className: "bailey-step-spinner",
|
|
3006
3019
|
"aria-hidden": "true"
|
|
3007
3020
|
})]
|
|
3008
3021
|
}) : /* @__PURE__ */ y("div", {
|
|
3009
3022
|
className: "bailey-assistant-message",
|
|
3010
3023
|
children: [
|
|
3011
|
-
!t.streaming && /* @__PURE__ */ v(
|
|
3024
|
+
!t.streaming && /* @__PURE__ */ v(vn, {
|
|
3012
3025
|
steps: s,
|
|
3013
|
-
labels:
|
|
3026
|
+
labels: B,
|
|
3014
3027
|
resolveActivityIcon: C
|
|
3015
3028
|
}),
|
|
3016
|
-
/* @__PURE__ */ v(
|
|
3029
|
+
/* @__PURE__ */ v(Gn, {
|
|
3017
3030
|
content: t.content,
|
|
3018
|
-
components:
|
|
3031
|
+
components: Se
|
|
3019
3032
|
}),
|
|
3020
|
-
t.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ v(
|
|
3033
|
+
t.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ v(sn, {
|
|
3021
3034
|
src: e.src,
|
|
3022
3035
|
alt: e.alt
|
|
3023
|
-
}, t) : e.type === "mcp_app" ? /* @__PURE__ */ v(n, { children: te ? te(e) : /* @__PURE__ */ v(
|
|
3036
|
+
}, t) : e.type === "mcp_app" ? /* @__PURE__ */ v(n, { children: te ? te(e) : /* @__PURE__ */ v(mn, {
|
|
3024
3037
|
...e,
|
|
3025
|
-
title: e.title ??
|
|
3038
|
+
title: e.title ?? B.mcpAppDefaultTitle
|
|
3026
3039
|
}) }, t) : null),
|
|
3027
|
-
t.streaming && /* @__PURE__ */ v(
|
|
3040
|
+
t.streaming && /* @__PURE__ */ v(_n, {
|
|
3028
3041
|
steps: s,
|
|
3029
3042
|
resolveActivityIcon: C
|
|
3030
3043
|
}),
|
|
3031
|
-
t.streaming &&
|
|
3044
|
+
t.streaming && X && !c && /* @__PURE__ */ y("div", {
|
|
3032
3045
|
className: "bailey-streaming-hint",
|
|
3033
|
-
children: [/* @__PURE__ */ v("span", { children:
|
|
3046
|
+
children: [/* @__PURE__ */ v("span", { children: X }), /* @__PURE__ */ v("span", {
|
|
3034
3047
|
className: "bailey-step-spinner",
|
|
3035
3048
|
"aria-hidden": "true"
|
|
3036
3049
|
})]
|
|
@@ -3038,15 +3051,15 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
|
|
|
3038
3051
|
!t.streaming && /* @__PURE__ */ y("div", {
|
|
3039
3052
|
className: "bailey-message-actions",
|
|
3040
3053
|
children: [
|
|
3041
|
-
/* @__PURE__ */ v(
|
|
3054
|
+
/* @__PURE__ */ v(Xt, {
|
|
3042
3055
|
markdown: t.content,
|
|
3043
|
-
ariaLabel:
|
|
3044
|
-
tooltipDefaultText:
|
|
3045
|
-
tooltipCopiedText:
|
|
3056
|
+
ariaLabel: B.copyButtonAriaLabel,
|
|
3057
|
+
tooltipDefaultText: B.copyButtonTooltipDefault,
|
|
3058
|
+
tooltipCopiedText: B.copyButtonTooltipCopied
|
|
3046
3059
|
}),
|
|
3047
|
-
k !== !1 && e.feedback && e.conversationId && t.serverMessageId && !
|
|
3048
|
-
value:
|
|
3049
|
-
children: /* @__PURE__ */ v(
|
|
3060
|
+
k !== !1 && e.feedback && e.conversationId && t.serverMessageId && !ue.has(t.serverMessageId) && /* @__PURE__ */ v(jt.Provider, {
|
|
3061
|
+
value: pe,
|
|
3062
|
+
children: /* @__PURE__ */ v(zn, {
|
|
3050
3063
|
...k,
|
|
3051
3064
|
assistantName: o,
|
|
3052
3065
|
messageId: t.serverMessageId,
|
|
@@ -3055,14 +3068,14 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
|
|
|
3055
3068
|
onClear: e.feedback.onClear
|
|
3056
3069
|
})
|
|
3057
3070
|
}),
|
|
3058
|
-
|
|
3071
|
+
O?.(t)
|
|
3059
3072
|
]
|
|
3060
3073
|
})
|
|
3061
3074
|
]
|
|
3062
3075
|
})
|
|
3063
3076
|
}, t.id);
|
|
3064
3077
|
}),
|
|
3065
|
-
/* @__PURE__ */ v("div", { ref:
|
|
3078
|
+
/* @__PURE__ */ v("div", { ref: W })
|
|
3066
3079
|
]
|
|
3067
3080
|
}),
|
|
3068
3081
|
I && /* @__PURE__ */ y("div", {
|
|
@@ -3074,17 +3087,17 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
|
|
|
3074
3087
|
type: "button",
|
|
3075
3088
|
onClick: ae,
|
|
3076
3089
|
className: "bailey-retry-button",
|
|
3077
|
-
children:
|
|
3090
|
+
children: B.retryButtonText
|
|
3078
3091
|
}), /* @__PURE__ */ v("button", {
|
|
3079
3092
|
type: "button",
|
|
3080
3093
|
onClick: se,
|
|
3081
|
-
"aria-label":
|
|
3094
|
+
"aria-label": B.dismissErrorAriaLabel,
|
|
3082
3095
|
className: "bailey-dismiss-button",
|
|
3083
3096
|
children: "✕"
|
|
3084
3097
|
})]
|
|
3085
3098
|
})]
|
|
3086
3099
|
}),
|
|
3087
|
-
!
|
|
3100
|
+
!D && /* @__PURE__ */ v(on, {
|
|
3088
3101
|
events: P,
|
|
3089
3102
|
lastRequest: re,
|
|
3090
3103
|
onClear: oe
|
|
@@ -3093,16 +3106,16 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
|
|
|
3093
3106
|
className: "bailey-input-area",
|
|
3094
3107
|
children: [/* @__PURE__ */ y("form", {
|
|
3095
3108
|
onSubmit: (e) => {
|
|
3096
|
-
e.preventDefault(),
|
|
3109
|
+
e.preventDefault(), R.trim() && F !== "streaming" && (ke(R), le(""));
|
|
3097
3110
|
},
|
|
3098
3111
|
className: "bailey-input-row",
|
|
3099
3112
|
children: [/* @__PURE__ */ v("input", {
|
|
3100
|
-
ref:
|
|
3113
|
+
ref: _e,
|
|
3101
3114
|
type: "text",
|
|
3102
|
-
placeholder:
|
|
3103
|
-
"aria-label":
|
|
3104
|
-
value:
|
|
3105
|
-
onChange: (e) =>
|
|
3115
|
+
placeholder: Z,
|
|
3116
|
+
"aria-label": Z,
|
|
3117
|
+
value: R,
|
|
3118
|
+
onChange: (e) => le(e.target.value),
|
|
3106
3119
|
disabled: F === "streaming",
|
|
3107
3120
|
className: "bailey-input"
|
|
3108
3121
|
}), F === "streaming" ? /* @__PURE__ */ v(g.Provider, {
|
|
@@ -3112,80 +3125,80 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
|
|
|
3112
3125
|
children: /* @__PURE__ */ v("button", {
|
|
3113
3126
|
type: "button",
|
|
3114
3127
|
onClick: L,
|
|
3115
|
-
"aria-label":
|
|
3128
|
+
"aria-label": B.stopAriaLabel,
|
|
3116
3129
|
className: "bailey-stop-button",
|
|
3117
|
-
children: /* @__PURE__ */ v(
|
|
3130
|
+
children: /* @__PURE__ */ v(Pt, { className: "bailey-stop-icon" })
|
|
3118
3131
|
})
|
|
3119
3132
|
}), /* @__PURE__ */ v(g.Portal, {
|
|
3120
|
-
container:
|
|
3133
|
+
container: U instanceof ShadowRoot ? U : void 0,
|
|
3121
3134
|
children: /* @__PURE__ */ y(g.Content, {
|
|
3122
3135
|
side: "top",
|
|
3123
3136
|
className: "bailey-tooltip-content",
|
|
3124
|
-
children: [
|
|
3137
|
+
children: [B.stopButtonText, /* @__PURE__ */ v(g.Arrow, { className: "bailey-tooltip-arrow" })]
|
|
3125
3138
|
})
|
|
3126
3139
|
})] })
|
|
3127
3140
|
}) : /* @__PURE__ */ v("button", {
|
|
3128
3141
|
type: "submit",
|
|
3129
|
-
"aria-label":
|
|
3130
|
-
disabled: !
|
|
3142
|
+
"aria-label": B.sendAriaLabel,
|
|
3143
|
+
disabled: !R.trim(),
|
|
3131
3144
|
className: "bailey-send-button",
|
|
3132
|
-
children:
|
|
3145
|
+
children: ee ?? /* @__PURE__ */ v(Nt, { className: "bailey-send-icon" })
|
|
3133
3146
|
})]
|
|
3134
|
-
}), !m && (!
|
|
3147
|
+
}), !m && (!Oe || xe) && /* @__PURE__ */ y(h.Root, { children: [/* @__PURE__ */ v(h.Trigger, {
|
|
3135
3148
|
asChild: !0,
|
|
3136
3149
|
children: /* @__PURE__ */ v("button", {
|
|
3137
3150
|
type: "button",
|
|
3138
|
-
ref:
|
|
3139
|
-
"aria-label":
|
|
3151
|
+
ref: ve,
|
|
3152
|
+
"aria-label": B.menuAriaLabel,
|
|
3140
3153
|
className: "bailey-menu-button",
|
|
3141
|
-
children: /* @__PURE__ */ v(
|
|
3154
|
+
children: /* @__PURE__ */ v(Bt, { className: "bailey-menu-icon" })
|
|
3142
3155
|
})
|
|
3143
3156
|
}), /* @__PURE__ */ v(h.Portal, {
|
|
3144
|
-
container:
|
|
3157
|
+
container: U instanceof ShadowRoot ? U : void 0,
|
|
3145
3158
|
children: /* @__PURE__ */ y(h.Content, {
|
|
3146
3159
|
side: "top",
|
|
3147
3160
|
align: "end",
|
|
3148
3161
|
sideOffset: 8,
|
|
3149
3162
|
className: "bailey-menu-content",
|
|
3150
3163
|
onCloseAutoFocus: (e) => {
|
|
3151
|
-
|
|
3164
|
+
H.current &&= (e.preventDefault(), !1);
|
|
3152
3165
|
},
|
|
3153
|
-
children: [!
|
|
3154
|
-
onSelect: () =>
|
|
3166
|
+
children: [!Oe && /* @__PURE__ */ y(h.Item, {
|
|
3167
|
+
onSelect: () => ce(),
|
|
3155
3168
|
className: "bailey-menu-item",
|
|
3156
|
-
children: [/* @__PURE__ */ v(
|
|
3157
|
-
}),
|
|
3169
|
+
children: [/* @__PURE__ */ v(Vt, { className: "bailey-menu-item-icon" }), B.newChatButtonText]
|
|
3170
|
+
}), xe && /* @__PURE__ */ y(h.Item, {
|
|
3158
3171
|
onSelect: () => {
|
|
3159
|
-
_ ? _() : (
|
|
3172
|
+
_ ? _() : (H.current = !0, be(!0));
|
|
3160
3173
|
},
|
|
3161
3174
|
className: "bailey-menu-item",
|
|
3162
|
-
children: [/* @__PURE__ */ v(
|
|
3175
|
+
children: [/* @__PURE__ */ v(Rt, { className: "bailey-menu-item-icon" }), B.historyMenuItemText]
|
|
3163
3176
|
})]
|
|
3164
3177
|
})
|
|
3165
3178
|
})] })]
|
|
3166
3179
|
}),
|
|
3167
|
-
(
|
|
3180
|
+
(Oe || S?.alwaysVisible) && S && /* @__PURE__ */ v("div", {
|
|
3168
3181
|
className: "bailey-privacy-note",
|
|
3169
3182
|
children: /* @__PURE__ */ v(p, {
|
|
3170
|
-
remarkPlugins:
|
|
3171
|
-
components:
|
|
3183
|
+
remarkPlugins: Un,
|
|
3184
|
+
components: Wn,
|
|
3172
3185
|
skipHtml: !0,
|
|
3173
3186
|
children: S.markdown
|
|
3174
3187
|
})
|
|
3175
3188
|
})
|
|
3176
3189
|
]
|
|
3177
|
-
}),
|
|
3190
|
+
}), ye && b && !_ && /* @__PURE__ */ v(En, {
|
|
3178
3191
|
client: b.client,
|
|
3179
3192
|
pageSize: b.pageSize,
|
|
3180
3193
|
chat: e,
|
|
3181
|
-
labels:
|
|
3194
|
+
labels: B,
|
|
3182
3195
|
locale: x,
|
|
3183
|
-
onClose:
|
|
3196
|
+
onClose: Q
|
|
3184
3197
|
})]
|
|
3185
3198
|
})
|
|
3186
3199
|
})
|
|
3187
3200
|
});
|
|
3188
3201
|
}
|
|
3189
3202
|
// src/index.ts
|
|
3190
|
-
var
|
|
3191
|
-
export {
|
|
3203
|
+
var Xn = "0.3.1-pre.2";
|
|
3204
|
+
export { zt as ActivityIcon, Ft as ArrowUpRightIcon, Xn as BAILEYAI_CHAT_UI_VERSION, We as BAILEY_CHART_PROMPT_FRAGMENT, Ie as BAILEY_TABLE_GRID_ROW_THRESHOLD, j as BaileyApiError, Yn as BaileyChatPanel, M as BaileyCleanupError, zn as BaileyFeedbackButtons, En as BaileyHistoryDrawer, on as BaileyTracePanel, Xt as CopyMarkdownButton, oe as DEFAULT_CONVERSATION_STORAGE_KEY, Nt as HeartIcon, Qe as TRACE_KIND_LABEL, Gt as ThumbDownIcon, Wt as ThumbUpIcon, Me as createBaileyClient, ae as createBaileyFeedbackHandlers, Mt as createBaileyMarkdownComponents, ce as createMemoryConversationStorage, se as createSessionConversationStorage, O as extractPseudoToolCalls, He as extractTableData, Tn as formatRelativeTime, ct as formatTraceGap, st as formatTraceTime, ft as hasTraceFailure, L as isConversationIdForSub, e as isSafeMarkdownUrl, $ as joinInstructions, F as mapTranscript, ie as mergeEarlierPage, Ze as parseBaileyChartSpec, A as parseSseFrames, Fe as resolveToolCall, Ue as shouldUseGrid, pt as toActivityLines, mt as toToolSteps, lt as toTraceRows, dt as toTraceSegments, nt as traceEventArgsDetail, ot as traceEventHint, rt as traceEventOutputDetail, at as traceEventRawDetail, tt as traceEventSummary, et as traceEventToolName, ut as traceSummaryLine, ye as useBaileyChat, V as useBaileyConversations };
|