@icanbwell/baileyai-chat-ui 1.0.12 → 1.0.14
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 +21 -0
- package/dist/baileyai-chat-ui.cjs +3 -3
- package/dist/baileyai-chat-ui.css +1 -1
- package/dist/baileyai-chat-ui.js +553 -397
- package/dist/index.d.ts +76 -5
- package/package.json +1 -1
package/dist/baileyai-chat-ui.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { n as e, t } from "./safeMarkdownUrl-Bqv6Q4u1.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import { Fragment as
|
|
2
|
+
import { Fragment as n, createContext as r, memo as i, useCallback as a, useContext as o, useEffect as s, useLayoutEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
3
|
+
import f from "react-markdown";
|
|
4
|
+
import p from "remark-gfm";
|
|
5
|
+
import * as m from "@radix-ui/react-dropdown-menu";
|
|
6
|
+
import * as h from "@radix-ui/react-tooltip";
|
|
7
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
8
8
|
//#region src/utils/pseudoToolCalls.ts
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
let t =
|
|
9
|
+
var y = "search_tools|call_tool|function_calls|function_result", b = RegExp(`<(${y})>([\\s\\S]*?)<\\/\\1>`, "g"), x = RegExp(`<(?:${y})>[\\s\\S]*$`), S = /<name>([\s\S]*?)<\/name>/, C = /<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 = S.exec(e)?.[1]?.trim() || "unknown_tool", n = C.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,14 +31,14 @@ function E(e) {
|
|
|
31
31
|
}
|
|
32
32
|
return t;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
let { hideOpenBlock: n = !0 } = t, r = [], i = e.replace(
|
|
34
|
+
function O(e, t = {}) {
|
|
35
|
+
let { hideOpenBlock: n = !0 } = t, r = [], i = e.replace(b, (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
|
-
}), "")), a = n ? i.replace(
|
|
41
|
+
}), "")), a = n ? i.replace(x, "") : i;
|
|
42
42
|
return r.length === 0 && a === i ? {
|
|
43
43
|
cleanedText: i,
|
|
44
44
|
matches: r
|
|
@@ -49,7 +49,7 @@ function D(e, t = {}) {
|
|
|
49
49
|
}
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/logic/sse.ts
|
|
52
|
-
function
|
|
52
|
+
function k(e) {
|
|
53
53
|
if (!e.startsWith("data: ")) return e;
|
|
54
54
|
let t = "";
|
|
55
55
|
for (let n of e.split("\n")) {
|
|
@@ -63,7 +63,7 @@ function O(e) {
|
|
|
63
63
|
}
|
|
64
64
|
return t || null;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function A(e) {
|
|
67
67
|
let t = e.replace(/\r\n/g, "\n").split("\n\n"), n = t.pop() ?? "", r = [], i = !1;
|
|
68
68
|
for (let e of t) {
|
|
69
69
|
let t = e.split("\n").filter((e) => e.length > 0), n = "message", a = [];
|
|
@@ -88,7 +88,7 @@ function k(e) {
|
|
|
88
88
|
message: e
|
|
89
89
|
});
|
|
90
90
|
} else if (c?.type === "response.output_text.delta" && typeof c.delta == "string") {
|
|
91
|
-
let e =
|
|
91
|
+
let e = k(c.delta);
|
|
92
92
|
e && r.push({
|
|
93
93
|
type: "response.output_text.delta",
|
|
94
94
|
delta: e
|
|
@@ -106,38 +106,38 @@ function k(e) {
|
|
|
106
106
|
}
|
|
107
107
|
//#endregion
|
|
108
108
|
//#region src/logic/useBaileyChat.ts
|
|
109
|
-
var
|
|
109
|
+
var j = 200, M = 15e4, N = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `bailey-${Date.now()}-${Math.random().toString(36).slice(2)}`, ee = (e, t, n) => {
|
|
110
110
|
if (e === 401 || e === 403) return "Bailey isn't reachable with your current login.";
|
|
111
111
|
let r = `Bailey request failed (status ${e ?? "network error"}).`, i = (n || t || "").trim();
|
|
112
|
-
return i ? `${r} ${i.length >
|
|
113
|
-
},
|
|
114
|
-
let [f, p] =
|
|
115
|
-
|
|
112
|
+
return i ? `${r} ${i.length > j ? `${i.slice(0, j)}…` : i}` : r;
|
|
113
|
+
}, P = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i, firstUserMessagePrefix: o, onAssistantMessageComplete: c, idleTimeoutMs: l = M }) => {
|
|
114
|
+
let [f, p] = d([]), [m, h] = d([]), [g, _] = d(null), [v, y] = d("idle"), [b, x] = d(null), S = u(null), C = u(""), w = u(0), T = u([]);
|
|
115
|
+
s(() => {
|
|
116
116
|
T.current = f;
|
|
117
117
|
}, [f]);
|
|
118
|
-
let E =
|
|
119
|
-
|
|
120
|
-
}, []), F =
|
|
121
|
-
P(),
|
|
118
|
+
let E = u([]), D = u(/* @__PURE__ */ new Map()), k = u(/* @__PURE__ */ new Map()), j = u(null), P = a(() => {
|
|
119
|
+
j.current !== null && (clearTimeout(j.current), j.current = null);
|
|
120
|
+
}, []), F = a((e) => {
|
|
121
|
+
P(), j.current = setTimeout(() => {
|
|
122
122
|
e.abort(new DOMException("The assistant took too long to respond. Please try again.", "TimeoutError"));
|
|
123
|
-
},
|
|
124
|
-
}, [P,
|
|
125
|
-
|
|
123
|
+
}, l);
|
|
124
|
+
}, [P, l]);
|
|
125
|
+
s(() => () => {
|
|
126
126
|
S.current?.abort(), P();
|
|
127
127
|
}, [P]);
|
|
128
|
-
let I =
|
|
128
|
+
let I = a((e, t, n) => {
|
|
129
129
|
let r = (e) => {
|
|
130
130
|
n.push(e), h((t) => [...t, e]);
|
|
131
131
|
};
|
|
132
132
|
if (t.type === "response.output_text.delta") {
|
|
133
133
|
if (!t.delta) return !1;
|
|
134
|
-
let n =
|
|
134
|
+
let n = D.current.get(e) ?? {
|
|
135
135
|
raw: "",
|
|
136
136
|
emittedCount: 0
|
|
137
137
|
};
|
|
138
138
|
n.raw += t.delta;
|
|
139
|
-
let { cleanedText: i, matches: a } =
|
|
140
|
-
if (n.emittedCount = a.length,
|
|
139
|
+
let { cleanedText: i, matches: a } = O(n.raw), o = i.trim(), s = a.slice(n.emittedCount);
|
|
140
|
+
if (n.emittedCount = a.length, D.current.set(e, n), k.current.set(e, o), p((t) => t.map((t) => t.id === e ? {
|
|
141
141
|
...t,
|
|
142
142
|
content: o
|
|
143
143
|
} : t)), s.length > 0) {
|
|
@@ -168,13 +168,17 @@ var A = 200, j = 15e4, M = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
168
168
|
name: a,
|
|
169
169
|
args: n.arguments,
|
|
170
170
|
at: e,
|
|
171
|
-
turnSentAt: i
|
|
171
|
+
turnSentAt: i,
|
|
172
|
+
callId: n.call_id,
|
|
173
|
+
displayName: n.display_name
|
|
172
174
|
} : {
|
|
173
175
|
kind: "tool_end",
|
|
174
176
|
name: a,
|
|
175
177
|
args: n.arguments,
|
|
176
178
|
at: e,
|
|
177
179
|
turnSentAt: i,
|
|
180
|
+
callId: n.call_id,
|
|
181
|
+
displayName: n.display_name,
|
|
178
182
|
output: n.output,
|
|
179
183
|
isError: n.is_error,
|
|
180
184
|
runtimeSeconds: n.runtime_seconds,
|
|
@@ -206,43 +210,68 @@ var A = 200, j = 15e4, M = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
206
210
|
}), !0;
|
|
207
211
|
if (t.type === "response.output_text.done" || t.type === "response.created") return !1;
|
|
208
212
|
if (t.type === "response.completed") {
|
|
209
|
-
let t =
|
|
213
|
+
let t = D.current.get(e);
|
|
210
214
|
if (t) {
|
|
211
|
-
let { cleanedText: n } =
|
|
212
|
-
r !==
|
|
215
|
+
let { cleanedText: n } = O(t.raw, { hideOpenBlock: !1 }), r = n.trim();
|
|
216
|
+
r !== k.current.get(e) && (k.current.set(e, r), p((t) => t.map((t) => t.id === e ? {
|
|
213
217
|
...t,
|
|
214
218
|
content: r
|
|
215
219
|
} : t)));
|
|
216
220
|
}
|
|
217
221
|
return !1;
|
|
218
222
|
}
|
|
219
|
-
|
|
223
|
+
if (t.type === "info") return r({
|
|
220
224
|
kind: "info",
|
|
221
225
|
message: t.message,
|
|
222
226
|
at: Date.now(),
|
|
223
227
|
turnSentAt: w.current
|
|
224
|
-
}), !0
|
|
228
|
+
}), !0;
|
|
229
|
+
if (t.type === "mcp_app") {
|
|
230
|
+
let n = t.resourceUri;
|
|
231
|
+
if (!n) return r({
|
|
232
|
+
kind: "raw",
|
|
233
|
+
eventType: t.type,
|
|
234
|
+
raw: JSON.stringify(t),
|
|
235
|
+
at: Date.now(),
|
|
236
|
+
turnSentAt: w.current
|
|
237
|
+
}), !0;
|
|
238
|
+
let { html: i, title: a, csp: o, permissions: s, prefersBorder: c, displayMode: l } = t;
|
|
239
|
+
return p((t) => t.map((t) => t.id === e ? {
|
|
240
|
+
...t,
|
|
241
|
+
parts: [...t.parts ?? [], {
|
|
242
|
+
type: "mcp_app",
|
|
243
|
+
html: i,
|
|
244
|
+
title: a,
|
|
245
|
+
resourceUri: n,
|
|
246
|
+
csp: o,
|
|
247
|
+
permissions: s,
|
|
248
|
+
prefersBorder: c,
|
|
249
|
+
displayMode: l
|
|
250
|
+
}]
|
|
251
|
+
} : t)), !0;
|
|
252
|
+
}
|
|
253
|
+
return r({
|
|
225
254
|
kind: "raw",
|
|
226
255
|
eventType: t.type,
|
|
227
256
|
raw: JSON.stringify(t),
|
|
228
257
|
at: Date.now(),
|
|
229
258
|
turnSentAt: w.current
|
|
230
|
-
}), !0
|
|
231
|
-
}, []), L =
|
|
259
|
+
}), !0;
|
|
260
|
+
}, []), L = a(async (a) => {
|
|
232
261
|
y("streaming"), x(null);
|
|
233
|
-
let
|
|
234
|
-
w.current =
|
|
235
|
-
let l =
|
|
262
|
+
let s = Date.now();
|
|
263
|
+
w.current = s;
|
|
264
|
+
let l = N(), u = {
|
|
236
265
|
id: l,
|
|
237
266
|
role: "assistant",
|
|
238
267
|
content: "",
|
|
239
268
|
streaming: !0,
|
|
240
|
-
createdAt:
|
|
269
|
+
createdAt: s
|
|
241
270
|
};
|
|
242
|
-
p((e) => [...e, u]), E.current = [...
|
|
243
|
-
let d =
|
|
271
|
+
p((e) => [...e, u]), E.current = [...a, u];
|
|
272
|
+
let d = a.findIndex((e) => e.role === "user" && !e.hidden), f = a.map((e, t) => t === d && o ? {
|
|
244
273
|
role: e.role,
|
|
245
|
-
content: `${
|
|
274
|
+
content: `${o}${e.content}`,
|
|
246
275
|
hidden: e.hidden,
|
|
247
276
|
titleHint: e.titleHint
|
|
248
277
|
} : {
|
|
@@ -256,9 +285,9 @@ var A = 200, j = 15e4, M = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
256
285
|
systemPrompt: n,
|
|
257
286
|
messages: f,
|
|
258
287
|
tools: r,
|
|
259
|
-
toolChoice:
|
|
288
|
+
toolChoice: i,
|
|
260
289
|
stream: !0,
|
|
261
|
-
sentAt:
|
|
290
|
+
sentAt: s,
|
|
262
291
|
streamStats: {
|
|
263
292
|
chunkCount: 0,
|
|
264
293
|
firstChunkAt: null,
|
|
@@ -267,13 +296,13 @@ var A = 200, j = 15e4, M = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
267
296
|
});
|
|
268
297
|
let m = new AbortController();
|
|
269
298
|
S.current = m, F(m);
|
|
270
|
-
let g = "", v = null, b = !1, C = !1, T = [],
|
|
299
|
+
let g = "", v = null, b = !1, C = !1, T = [], O = (e, t) => {
|
|
271
300
|
y("error"), x(e);
|
|
272
301
|
let n = {
|
|
273
302
|
kind: "error",
|
|
274
303
|
message: e,
|
|
275
304
|
at: Date.now(),
|
|
276
|
-
turnSentAt:
|
|
305
|
+
turnSentAt: s,
|
|
277
306
|
...t
|
|
278
307
|
};
|
|
279
308
|
T.push(n), h((e) => [...e, n]);
|
|
@@ -285,7 +314,7 @@ var A = 200, j = 15e4, M = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
285
314
|
kind: "error",
|
|
286
315
|
message: e.message,
|
|
287
316
|
at: Date.now(),
|
|
288
|
-
turnSentAt:
|
|
317
|
+
turnSentAt: s
|
|
289
318
|
};
|
|
290
319
|
T.push(t), h((e) => [...e, t]);
|
|
291
320
|
return;
|
|
@@ -297,19 +326,19 @@ var A = 200, j = 15e4, M = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
297
326
|
} : e));
|
|
298
327
|
};
|
|
299
328
|
try {
|
|
300
|
-
let { status:
|
|
329
|
+
let { status: a, text: o, errorMessage: u } = await e.streamChat({
|
|
301
330
|
model: t,
|
|
302
331
|
instructions: n,
|
|
303
332
|
input: f,
|
|
304
333
|
tools: r,
|
|
305
|
-
toolChoice:
|
|
334
|
+
toolChoice: i,
|
|
306
335
|
signal: m.signal,
|
|
307
336
|
onChunk: (e) => {
|
|
308
337
|
F(m), g += e;
|
|
309
|
-
let { events: t, remainder: n, done: r } =
|
|
338
|
+
let { events: t, remainder: n, done: r } = A(g);
|
|
310
339
|
g = n, j(t, r);
|
|
311
340
|
let i = Date.now();
|
|
312
|
-
_((e) => e && e.sentAt ===
|
|
341
|
+
_((e) => e && e.sentAt === s ? {
|
|
313
342
|
...e,
|
|
314
343
|
streamStats: {
|
|
315
344
|
chunkCount: e.streamStats.chunkCount + 1,
|
|
@@ -319,38 +348,38 @@ var A = 200, j = 15e4, M = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
319
348
|
} : e);
|
|
320
349
|
},
|
|
321
350
|
onRequestId: (e) => {
|
|
322
|
-
_((t) => t && t.sentAt ===
|
|
351
|
+
_((t) => t && t.sentAt === s ? {
|
|
323
352
|
...t,
|
|
324
353
|
requestId: e
|
|
325
354
|
} : t);
|
|
326
355
|
}
|
|
327
356
|
});
|
|
328
357
|
if (g.trim()) {
|
|
329
|
-
let { events: e, done: t } =
|
|
358
|
+
let { events: e, done: t } = A(`${g}\n\n`);
|
|
330
359
|
g = "", j(e, t);
|
|
331
360
|
}
|
|
332
361
|
if (v) {
|
|
333
362
|
y("error"), x(v);
|
|
334
363
|
return;
|
|
335
364
|
}
|
|
336
|
-
if (
|
|
337
|
-
|
|
338
|
-
httpStatus:
|
|
339
|
-
rawBody:
|
|
365
|
+
if (a === void 0 || a >= 400) {
|
|
366
|
+
O(ee(a, o, u), {
|
|
367
|
+
httpStatus: a,
|
|
368
|
+
rawBody: o || void 0
|
|
340
369
|
});
|
|
341
370
|
return;
|
|
342
371
|
}
|
|
343
372
|
if (!b) {
|
|
344
|
-
|
|
373
|
+
O("Bailey returned an empty response.");
|
|
345
374
|
return;
|
|
346
375
|
}
|
|
347
376
|
if (!C) {
|
|
348
|
-
|
|
377
|
+
O("Bailey ran some tools but didn't return an answer. Try asking again.");
|
|
349
378
|
return;
|
|
350
379
|
}
|
|
351
380
|
y("idle");
|
|
352
|
-
let d =
|
|
353
|
-
_((e) => e && e.sentAt ===
|
|
381
|
+
let d = k.current.get(l) ?? "";
|
|
382
|
+
_((e) => e && e.sentAt === s ? {
|
|
354
383
|
...e,
|
|
355
384
|
response: { content: d }
|
|
356
385
|
} : e), c && await c({
|
|
@@ -362,18 +391,20 @@ var A = 200, j = 15e4, M = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
362
391
|
} catch (e) {
|
|
363
392
|
let t = e;
|
|
364
393
|
if (t?.name === "TimeoutError") {
|
|
365
|
-
|
|
394
|
+
O(t.message, { source: "client-timeout" });
|
|
366
395
|
return;
|
|
367
396
|
}
|
|
368
397
|
if (t?.name === "AbortError") {
|
|
369
398
|
y("idle");
|
|
370
399
|
return;
|
|
371
400
|
}
|
|
372
|
-
|
|
401
|
+
O(t?.message || "Bailey request failed.");
|
|
373
402
|
} finally {
|
|
374
403
|
P();
|
|
375
|
-
let e =
|
|
376
|
-
|
|
404
|
+
let e = k.current.get(l) ?? "";
|
|
405
|
+
D.current.delete(l), k.current.delete(l);
|
|
406
|
+
let t = T.some((e) => e.kind === "tool_start" || e.kind === "tool_end");
|
|
407
|
+
p((e) => e.flatMap((e) => e.id === l ? e.content || t ? [{
|
|
377
408
|
...e,
|
|
378
409
|
streaming: !1
|
|
379
410
|
}] : [] : [e])), E.current = E.current.flatMap((t) => t.id === l ? e ? [{
|
|
@@ -387,13 +418,13 @@ var A = 200, j = 15e4, M = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
387
418
|
t,
|
|
388
419
|
n,
|
|
389
420
|
r,
|
|
390
|
-
|
|
391
|
-
|
|
421
|
+
i,
|
|
422
|
+
o,
|
|
392
423
|
c,
|
|
393
424
|
I,
|
|
394
425
|
F,
|
|
395
426
|
P
|
|
396
|
-
]), R =
|
|
427
|
+
]), R = a((e) => {
|
|
397
428
|
T.current = e, p(e);
|
|
398
429
|
}, []);
|
|
399
430
|
return {
|
|
@@ -402,25 +433,25 @@ var A = 200, j = 15e4, M = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
402
433
|
lastRequest: g,
|
|
403
434
|
status: v,
|
|
404
435
|
error: b,
|
|
405
|
-
send:
|
|
436
|
+
send: a((e) => {
|
|
406
437
|
let t = e.trim();
|
|
407
438
|
if (!t) return;
|
|
408
439
|
C.current = t;
|
|
409
440
|
let n = {
|
|
410
|
-
id:
|
|
441
|
+
id: N(),
|
|
411
442
|
role: "user",
|
|
412
443
|
content: t,
|
|
413
444
|
createdAt: Date.now()
|
|
414
445
|
}, r = [...E.current, n];
|
|
415
446
|
E.current = r, R([...T.current, n]), L(r);
|
|
416
447
|
}, [L, R]),
|
|
417
|
-
sendHidden:
|
|
448
|
+
sendHidden: a((e, t) => {
|
|
418
449
|
if (v === "streaming") return;
|
|
419
450
|
let n = e.trim();
|
|
420
451
|
if (!n) return;
|
|
421
452
|
C.current = n;
|
|
422
453
|
let r = t?.trim(), i = {
|
|
423
|
-
id:
|
|
454
|
+
id: N(),
|
|
424
455
|
role: "user",
|
|
425
456
|
content: n,
|
|
426
457
|
createdAt: Date.now(),
|
|
@@ -429,10 +460,10 @@ var A = 200, j = 15e4, M = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
429
460
|
}, a = [...E.current, i];
|
|
430
461
|
E.current = a, L(a);
|
|
431
462
|
}, [L, v]),
|
|
432
|
-
stop:
|
|
463
|
+
stop: a(() => {
|
|
433
464
|
S.current?.abort();
|
|
434
465
|
}, []),
|
|
435
|
-
retryLast:
|
|
466
|
+
retryLast: a(() => {
|
|
436
467
|
if (v === "streaming" || !C.current) return;
|
|
437
468
|
let e = T.current, t = e[e.length - 1], n = t && t.role === "assistant" ? e.slice(0, -1) : e;
|
|
438
469
|
R(n);
|
|
@@ -443,14 +474,14 @@ var A = 200, j = 15e4, M = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
443
474
|
R,
|
|
444
475
|
v
|
|
445
476
|
]),
|
|
446
|
-
clearTrace:
|
|
447
|
-
clearError:
|
|
477
|
+
clearTrace: a(() => h([]), []),
|
|
478
|
+
clearError: a(() => {
|
|
448
479
|
x(null), y((e) => e === "error" ? "idle" : e);
|
|
449
480
|
}, []),
|
|
450
|
-
newChat:
|
|
481
|
+
newChat: a(() => {
|
|
451
482
|
S.current?.abort(), R([]), E.current = [], h([]), _(null), y("idle"), x(null), C.current = "";
|
|
452
483
|
}, [R]),
|
|
453
|
-
loadMessages:
|
|
484
|
+
loadMessages: a((e) => {
|
|
454
485
|
S.current?.abort();
|
|
455
486
|
let t = e.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
|
|
456
487
|
...e,
|
|
@@ -462,15 +493,15 @@ var A = 200, j = 15e4, M = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
462
493
|
};
|
|
463
494
|
//#endregion
|
|
464
495
|
//#region src/utils/prompt.ts
|
|
465
|
-
function
|
|
496
|
+
function F(...e) {
|
|
466
497
|
return e.filter((e) => !!(e && e.trim())).join("\n\n");
|
|
467
498
|
}
|
|
468
499
|
//#endregion
|
|
469
500
|
//#region src/utils/toolCalls.ts
|
|
470
|
-
var
|
|
471
|
-
function
|
|
501
|
+
var I = "call_tool", L = "a tool";
|
|
502
|
+
function R(e, t) {
|
|
472
503
|
let n = {
|
|
473
|
-
name: e ===
|
|
504
|
+
name: e === I ? L : e,
|
|
474
505
|
args: null,
|
|
475
506
|
viaCallTool: !1
|
|
476
507
|
};
|
|
@@ -483,7 +514,7 @@ function L(e, t) {
|
|
|
483
514
|
}
|
|
484
515
|
if (typeof r != "object" || !r) return n;
|
|
485
516
|
let i = r;
|
|
486
|
-
if (e ===
|
|
517
|
+
if (e === I) {
|
|
487
518
|
let e = typeof i.name == "string" ? i.name : void 0;
|
|
488
519
|
if (!e) return n;
|
|
489
520
|
let t = i.arguments;
|
|
@@ -501,32 +532,32 @@ function L(e, t) {
|
|
|
501
532
|
}
|
|
502
533
|
//#endregion
|
|
503
534
|
//#region src/utils/table.ts
|
|
504
|
-
var
|
|
535
|
+
var z = 5, B = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(B).join(""), V = (e) => {
|
|
505
536
|
if (e.tagName === "a" && e.properties?.href) return e.properties.href;
|
|
506
537
|
for (let t of e.children ?? []) {
|
|
507
|
-
let e =
|
|
538
|
+
let e = V(t);
|
|
508
539
|
if (e) return e;
|
|
509
540
|
}
|
|
510
|
-
},
|
|
511
|
-
let t =
|
|
541
|
+
}, H = (e, t) => (e.children ?? []).find((e) => e.tagName === t), U = (e) => {
|
|
542
|
+
let t = B(e), n = V(e);
|
|
512
543
|
return n ? {
|
|
513
544
|
text: t,
|
|
514
545
|
href: n
|
|
515
546
|
} : { text: t };
|
|
516
|
-
},
|
|
547
|
+
}, W = (e) => (e.children ?? []).filter((e) => e.type === "element").map(U), G = (e) => {
|
|
517
548
|
if (e.tagName !== "table") return null;
|
|
518
|
-
let t =
|
|
549
|
+
let t = H(e, "thead"), n = t && H(t, "tr");
|
|
519
550
|
return {
|
|
520
|
-
headers: n ?
|
|
521
|
-
rows: (
|
|
551
|
+
headers: n ? W(n).map((e) => e.text) : [],
|
|
552
|
+
rows: (H(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(W)
|
|
522
553
|
};
|
|
523
|
-
},
|
|
554
|
+
}, K = (e) => e.length > 5, te = "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```", q = [
|
|
524
555
|
"bar",
|
|
525
556
|
"line",
|
|
526
557
|
"pie",
|
|
527
558
|
"doughnut",
|
|
528
559
|
"scatter"
|
|
529
|
-
],
|
|
560
|
+
], J = 8, Y = 50, X = 8, ne = 500, re = (e) => typeof e == "object" && !!e && typeof e.x == "number" && typeof e.y == "number", ie = (e) => {
|
|
530
561
|
let t;
|
|
531
562
|
try {
|
|
532
563
|
t = JSON.parse(e);
|
|
@@ -535,17 +566,17 @@ var R = 5, z = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
|
|
|
535
566
|
}
|
|
536
567
|
if (typeof t != "object" || !t) return null;
|
|
537
568
|
let n = t;
|
|
538
|
-
if (typeof n.type != "string" || !
|
|
569
|
+
if (typeof n.type != "string" || !q.includes(n.type)) return null;
|
|
539
570
|
let r = n.type;
|
|
540
571
|
if (n.title !== void 0 && typeof n.title != "string") return null;
|
|
541
572
|
let i = n.title;
|
|
542
573
|
if (typeof n.data != "object" || n.data === null) return null;
|
|
543
574
|
let a = n.data;
|
|
544
|
-
if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length >
|
|
575
|
+
if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length > J || (r === "pie" || r === "doughnut") && a.datasets.length !== 1) return null;
|
|
545
576
|
for (let e of a.datasets) if (typeof e != "object" || !e || typeof e.label != "string" || !Array.isArray(e.data)) return null;
|
|
546
577
|
let o = a.datasets;
|
|
547
578
|
if (r === "scatter") {
|
|
548
|
-
for (let e of o) if (e.data.length < 1 || e.data.length >
|
|
579
|
+
for (let e of o) if (e.data.length < 1 || e.data.length > ne || !e.data.every(re)) return null;
|
|
549
580
|
return {
|
|
550
581
|
type: r,
|
|
551
582
|
title: i,
|
|
@@ -553,7 +584,7 @@ var R = 5, z = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
|
|
|
553
584
|
};
|
|
554
585
|
}
|
|
555
586
|
if (!Array.isArray(a.labels) || !a.labels.every((e) => typeof e == "string")) return null;
|
|
556
|
-
let s = a.labels, c = r === "pie" || r === "doughnut" ?
|
|
587
|
+
let s = a.labels, c = r === "pie" || r === "doughnut" ? X : Y;
|
|
557
588
|
if (s.length < 1 || s.length > c) return null;
|
|
558
589
|
for (let e of o) if (e.data.length !== s.length || !e.data.every((e) => typeof e == "number")) return null;
|
|
559
590
|
return {
|
|
@@ -564,7 +595,7 @@ var R = 5, z = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
|
|
|
564
595
|
datasets: o
|
|
565
596
|
}
|
|
566
597
|
};
|
|
567
|
-
},
|
|
598
|
+
}, ae = {
|
|
568
599
|
tool_start: "Tool start",
|
|
569
600
|
tool_end: "Tool end",
|
|
570
601
|
pseudo_tool_call: "Narrated tool call",
|
|
@@ -575,13 +606,13 @@ var R = 5, z = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
|
|
|
575
606
|
error: "Error",
|
|
576
607
|
raw: "Raw event"
|
|
577
608
|
};
|
|
578
|
-
function
|
|
579
|
-
return e.kind !== "tool_start" && e.kind !== "tool_end" ? null :
|
|
609
|
+
function Z(e) {
|
|
610
|
+
return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : R(e.name, e.args);
|
|
580
611
|
}
|
|
581
|
-
function
|
|
612
|
+
function oe(e, t = Z(e)) {
|
|
582
613
|
return e.kind === "pseudo_tool_call" ? e.name : t?.name ?? null;
|
|
583
614
|
}
|
|
584
|
-
function
|
|
615
|
+
function se(e, t = Z(e)) {
|
|
585
616
|
switch (e.kind) {
|
|
586
617
|
case "tool_start": return t.viaCallTool ? `${t.name} (via call_tool)` : t.name;
|
|
587
618
|
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" : ""}`;
|
|
@@ -594,23 +625,23 @@ function ce(e, t = J(e)) {
|
|
|
594
625
|
case "raw": return `Unrecognized event: ${e.eventType}`;
|
|
595
626
|
}
|
|
596
627
|
}
|
|
597
|
-
function
|
|
628
|
+
function ce(e, t = Z(e)) {
|
|
598
629
|
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;
|
|
599
630
|
}
|
|
600
|
-
function
|
|
631
|
+
function le(e) {
|
|
601
632
|
return e.kind === "tool_end" ? e.output ?? null : e.kind === "llm_call_end" ? e.response ?? null : null;
|
|
602
633
|
}
|
|
603
|
-
function
|
|
634
|
+
function ue(e) {
|
|
604
635
|
return e.kind === "tool_end" && e.structuredOutput ? JSON.stringify(e.structuredOutput, null, 2) : null;
|
|
605
636
|
}
|
|
606
|
-
function
|
|
637
|
+
function de(e) {
|
|
607
638
|
return e.kind === "raw" ? e.raw : e.kind === "error" ? e.rawBody ?? null : null;
|
|
608
639
|
}
|
|
609
|
-
function
|
|
640
|
+
function fe(e) {
|
|
610
641
|
switch (e.kind) {
|
|
611
|
-
case "tool_start": return `Calling ${
|
|
642
|
+
case "tool_start": return `Calling ${R(e.name, e.args).name}...`;
|
|
612
643
|
case "tool_end": {
|
|
613
|
-
let t =
|
|
644
|
+
let t = R(e.name, e.args).name;
|
|
614
645
|
return e.isError ? `${t} failed` : `${t} returned`;
|
|
615
646
|
}
|
|
616
647
|
case "pseudo_tool_call": return `${e.name} (written as text, not called)`;
|
|
@@ -636,21 +667,21 @@ function me(e) {
|
|
|
636
667
|
}
|
|
637
668
|
function he(e) {
|
|
638
669
|
return e.map((t, n) => {
|
|
639
|
-
let r =
|
|
670
|
+
let r = Z(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
|
|
640
671
|
return {
|
|
641
672
|
key: `${t.at}-${n}`,
|
|
642
673
|
kind: t.kind,
|
|
643
|
-
toolName:
|
|
674
|
+
toolName: oe(t, r),
|
|
644
675
|
isToolStart: t.kind === "tool_start",
|
|
645
676
|
failed: t.kind === "tool_end" && t.isError === !0,
|
|
646
677
|
time: pe(t.at),
|
|
647
678
|
gapMs: t.at - i,
|
|
648
|
-
label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" :
|
|
649
|
-
summary:
|
|
650
|
-
argsDetail:
|
|
651
|
-
outputDetail:
|
|
652
|
-
structuredOutputDetail:
|
|
653
|
-
rawDetail:
|
|
679
|
+
label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" : ae[t.kind],
|
|
680
|
+
summary: se(t, r),
|
|
681
|
+
argsDetail: ce(t, r),
|
|
682
|
+
outputDetail: le(t),
|
|
683
|
+
structuredOutputDetail: ue(t),
|
|
684
|
+
rawDetail: de(t)
|
|
654
685
|
};
|
|
655
686
|
});
|
|
656
687
|
}
|
|
@@ -683,97 +714,124 @@ function ve(e) {
|
|
|
683
714
|
function ye(e, t) {
|
|
684
715
|
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) => ({
|
|
685
716
|
key: `${e.at}-${t}`,
|
|
686
|
-
text:
|
|
687
|
-
toolName:
|
|
717
|
+
text: fe(e),
|
|
718
|
+
toolName: oe(e)
|
|
688
719
|
}));
|
|
689
720
|
}
|
|
721
|
+
function be(e, t) {
|
|
722
|
+
if (t === void 0) return [];
|
|
723
|
+
let n = [];
|
|
724
|
+
for (let r of e) if (r.turnSentAt === t) {
|
|
725
|
+
if (r.kind === "tool_start") {
|
|
726
|
+
let e = R(r.name, r.args).name;
|
|
727
|
+
n.push({
|
|
728
|
+
key: `step-${n.length}`,
|
|
729
|
+
callId: r.callId,
|
|
730
|
+
toolName: e,
|
|
731
|
+
label: r.displayName || e,
|
|
732
|
+
status: "running"
|
|
733
|
+
});
|
|
734
|
+
} else if (r.kind === "tool_end") {
|
|
735
|
+
let e = R(r.name, r.args).name, t = r.isError ? "failed" : "done", i = n.find((t) => t.status === "running" && t.callId === r.callId && t.toolName === e);
|
|
736
|
+
i ? (i.status = t, i.runtimeSeconds = r.runtimeSeconds, i.label = r.displayName || i.label) : n.push({
|
|
737
|
+
key: `step-${n.length}`,
|
|
738
|
+
callId: r.callId,
|
|
739
|
+
toolName: e,
|
|
740
|
+
label: r.displayName || e,
|
|
741
|
+
status: t,
|
|
742
|
+
runtimeSeconds: r.runtimeSeconds
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
return n;
|
|
747
|
+
}
|
|
690
748
|
//#endregion
|
|
691
749
|
//#region src/styles.css?inline
|
|
692
|
-
var be = "/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-border-style:solid;--tw-leading:initial;--tw-space-y-reverse:0}}}@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-100:oklch(93.6% .032 17.717);--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-2xl:1rem;--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}.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-thinking-hint{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);font-style:italic}.bailey-streaming-hint{margin-top:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);font-style:italic;display:block}.bailey-message-actions{margin-top:var(--spacing);align-items:center;gap:var(--spacing);display:flex}.bailey-empty-state{text-align:center;height:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);justify-content:center;align-items:center;display:flex}.bailey-suggestions{gap:calc(var(--spacing) * 3);padding:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-suggestions-title{padding-inline:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text)}.bailey-suggestion-card{cursor:pointer;appearance:none;justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-2xl);--tw-border-style:none;background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);text-align:left;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-style:none;display:flex}@media (hover:hover){.bailey-suggestion-card:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.bailey-suggestion-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-text-secondary);flex-shrink:0}.bailey-privacy-note{border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 4);padding-top:calc(var(--spacing) * 3);padding-bottom:var(--spacing);text-align:center;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-privacy-note a{color:var(--color-bailey-text-secondary);text-decoration-line:underline}.bailey-activity-line{margin-bottom:calc(var(--spacing) * 2);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-error-banner{margin-bottom:calc(var(--spacing) * 2);justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-error);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);color:var(--color-bailey-error);display:flex}.bailey-retry-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-error-actions{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-dismiss-button{cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-error);background-color:#0000;border-style:none}@media (hover:hover){.bailey-dismiss-button:hover{opacity:.7}}.bailey-input-area{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-input-row{align-items:center;gap:calc(var(--spacing) * 2);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);min-width:0;padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex:1;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input{--tw-border-style:none;min-width:0;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;background-color:#0000;border-style:none;outline-style:none;flex:1}.bailey-input:disabled{opacity:.5}.bailey-send-button,.bailey-stop-button{cursor:pointer;appearance:none;background-color:#0000;border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}:is(.bailey-send-button,.bailey-stop-button):disabled{cursor:default;opacity:.4}.bailey-send-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-heart);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:#16a34a1a}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:color-mix(in oklab, var(--color-bailey-heart) 10%, transparent)}}}.bailey-send-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-stop-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-error);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:#d32f2f1a}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:color-mix(in oklab, var(--color-bailey-error) 10%, transparent)}}}.bailey-stop-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-copy-button{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-copy-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-copy-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-copy-button:hover{color:var(--color-bailey-text)}}.bailey-copy-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-tooltip-content{padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));background-color:var(--color-bailey-tooltip-bg,#000);color:var(--color-bailey-tooltip-text,#fff);border-radius:.25rem}.bailey-menu-button{height:calc(var(--spacing) * 13);width:calc(var(--spacing) * 13);cursor:pointer;appearance:none;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-menu-button:hover{background-color:var(--color-gray-50)}}.bailey-menu-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-menu-content{z-index:50;min-width:calc(var(--spacing) * 44);border-radius:var(--radius-2xl);background-color:var(--color-white);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-black);--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);font-family:var(--font-sans,\"Inter\", -apple-system, \"Segoe UI\", Roboto, Arial, sans-serif)}.bailey-menu-item{cursor:pointer;align-items:center;gap:calc(var(--spacing) * 3);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;outline-style:none;display:flex}.bailey-menu-item[data-highlighted]{background-color:var(--color-gray-100)}.bailey-menu-item-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-gray-600)}.bailey-tooltip-arrow{fill:var(--color-bailey-tooltip-bg,#000)}.bailey-markdown-content table{border-collapse:collapse;width:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.bailey-markdown-content th{background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);text-align:left;--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content td{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);vertical-align:top}.bailey-markdown-content tr:nth-child(2n){background-color:var(--color-bailey-surface-muted)}.bailey-markdown-content{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.bailey-markdown-content>:first-child{margin-top:0}.bailey-markdown-content>:last-child{margin-bottom:0}.bailey-markdown-content p{margin-block:calc(var(--spacing) * 2)}.bailey-markdown-content h1{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h2{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h3{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h4,.bailey-markdown-content h5,.bailey-markdown-content h6{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content ul{margin-block:calc(var(--spacing) * 2);list-style-type:disc}:where(.bailey-markdown-content ul>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ul{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content ol{margin-block:calc(var(--spacing) * 2);list-style-type:decimal}:where(.bailey-markdown-content ol>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ol{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content a{color:var(--color-bailey-accent);text-underline-offset:2px;text-decoration-line:underline}.bailey-markdown-content code{background-color:var(--color-bailey-surface-muted);padding-inline:var(--spacing);padding-block:calc(var(--spacing) * .5);font-family:var(--font-mono);border-radius:.25rem;font-size:.85em}.bailey-markdown-content pre{margin-block:calc(var(--spacing) * 2);border-radius:var(--radius-md);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 2);overflow-x:auto}.bailey-markdown-content pre code{background-color:#0000;padding:0}.bailey-markdown-content blockquote{margin-block:calc(var(--spacing) * 2);border-left-style:var(--tw-border-style);border-left-width:2px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 3);color:var(--color-bailey-text-secondary);font-style:italic}.bailey-markdown-content hr{margin-block:calc(var(--spacing) * 3);border-color:var(--color-bailey-border)}.bailey-trace-panel{margin-bottom:calc(var(--spacing) * 2)}.bailey-trace-toggle-row{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-trace-toggle{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-trace-toggle:hover{text-decoration-line:underline}}.bailey-trace-toggle-error{color:var(--color-bailey-error)}.bailey-trace-summary{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-trace-summary-error{color:var(--color-bailey-error)}.bailey-trace-body{margin-top:var(--spacing);max-height:calc(var(--spacing) * 80);overflow-y:auto}.bailey-trace-actions-row{justify-content:flex-end;gap:calc(var(--spacing) * 3);display:flex}.bailey-trace-copy-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}@media (hover:hover){.bailey-trace-copy-button:hover{text-decoration-line:none}}.bailey-trace-request-details{margin-bottom:var(--spacing);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding:calc(var(--spacing) * 2)}.bailey-trace-request-meta{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:block}.bailey-trace-rows{gap:var(--spacing);flex-direction:column;display:flex}.bailey-trace-row{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-row-header{align-items:center;gap:calc(var(--spacing) * 2);flex-wrap:wrap;display:flex}.bailey-trace-row-time{color:var(--color-bailey-text-secondary)}.bailey-trace-row-gap{color:var(--color-gray-400)}.bailey-trace-row-summary{word-break:break-all}.bailey-trace-chip{padding-inline:calc(var(--spacing) * 1.5);padding-block:calc(var(--spacing) * .5);--tw-font-weight:var(--font-weight-semibold);font-size:.65rem;font-weight:var(--font-weight-semibold);border-radius:.25rem}.bailey-trace-chip-default{background-color:var(--color-gray-200);color:var(--color-gray-700)}.bailey-trace-chip-info{background-color:var(--color-blue-100);color:var(--color-blue-700)}.bailey-trace-chip-success{background-color:var(--color-green-100);color:var(--color-green-700)}.bailey-trace-chip-secondary{background-color:var(--color-purple-100);color:var(--color-purple-700)}.bailey-trace-chip-error{background-color:var(--color-red-100);color:var(--color-bailey-error)}.bailey-trace-disclosure{margin-top:var(--spacing)}.bailey-trace-disclosure-summary{cursor:pointer;color:var(--color-bailey-text-secondary);font-size:.7rem}.bailey-trace-disclosure-actions{margin-top:var(--spacing);justify-content:flex-end;display:flex}.bailey-trace-disclosure-content{margin-top:var(--spacing);max-height:calc(var(--spacing) * 48);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 1.5);word-break:break-all;white-space:pre-wrap;border-radius:.25rem;font-size:.7rem;overflow:auto}.bailey-trace-group{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing)}.bailey-trace-group-summary{cursor:pointer;font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-group-failed{margin-left:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-space-y-reverse{syntax:\"*\";inherits:false;initial-value:0}", xe = n(void 0), Se = /:root\s*,\s*:host\s*\{/, Ce = ".bailey-chat-panel{";
|
|
693
|
-
function
|
|
694
|
-
let t = e.match(new RegExp(
|
|
750
|
+
var xe = "/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-border-style:solid;--tw-leading:initial;--tw-space-y-reverse:0}}}@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-100:oklch(93.6% .032 17.717);--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-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}.bailey-chat-panel-inner{width:100%;min-height:0;max-width:var(--container-3xl);gap:calc(var(--spacing) * 2);flex-direction:column;flex:1;margin-inline:auto;display:flex;overflow-y:auto}.bailey-chat-transcript{min-height:0;padding:calc(var(--spacing) * 2);padding-bottom:calc(var(--spacing) * 4);flex:1;overflow-y:auto}.bailey-message-row{margin-bottom:calc(var(--spacing) * 3);justify-content:flex-start;display:flex}.bailey-message-row-user{justify-content:flex-end}.bailey-user-message{flex-direction:column;align-items:flex-end;max-width:75%;display:flex}.bailey-message-meta{margin-bottom:var(--spacing);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-message-meta-name{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-bailey-text)}.bailey-user-bubble{border-radius:var(--radius-2xl);background-color:var(--color-bailey-bubble-bg);max-width:100%;padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);white-space:pre-wrap;color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.bailey-assistant-message{width:100%;padding-inline:var(--spacing)}.bailey-tool-result-image{margin-top:calc(var(--spacing) * 2);border-radius:var(--radius-lg);max-width:100%;height:auto;display:block}.bailey-mcp-app-frame{margin-top:calc(var(--spacing) * 2);border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:0;width:100%;height:480px;display:block}.bailey-thinking-hint{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);font-style:italic}.bailey-streaming-hint{margin-top:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);font-style:italic;display:block}.bailey-message-actions{margin-top:var(--spacing);align-items:center;gap:var(--spacing);display:flex}.bailey-empty-state{text-align:center;height:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);justify-content:center;align-items:center;display:flex}.bailey-suggestions{gap:calc(var(--spacing) * 3);padding:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-suggestions-title{padding-inline:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text)}.bailey-suggestion-card{cursor:pointer;appearance:none;justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-2xl);--tw-border-style:none;background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);text-align:left;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-style:none;display:flex}@media (hover:hover){.bailey-suggestion-card:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.bailey-suggestion-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-text-secondary);flex-shrink:0}.bailey-privacy-note{border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 4);padding-top:calc(var(--spacing) * 3);padding-bottom:var(--spacing);text-align:center;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-privacy-note a{color:var(--color-bailey-text-secondary);text-decoration-line:underline}.bailey-activity-line{margin-bottom:calc(var(--spacing) * 2);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-activity-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-accent);flex-shrink:0}.bailey-step-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent);border-radius:2147483647px;flex-shrink:0}@media (prefers-reduced-motion:no-preference){.bailey-step-spinner{animation:var(--animate-spin)}}.bailey-tool-steps-summary{margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary)}.bailey-tool-steps-summary>summary{cursor:pointer;-webkit-user-select:none;user-select:none}.bailey-tool-steps-list{margin:0;margin-top:var(--spacing);gap:var(--spacing);flex-direction:column;padding:0;list-style-type:none;display:flex}.bailey-tool-step{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-tool-step-failed{color:var(--color-bailey-error)}.bailey-error-banner{margin-bottom:calc(var(--spacing) * 2);justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-error);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);color:var(--color-bailey-error);display:flex}.bailey-retry-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-error-actions{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-dismiss-button{cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-error);background-color:#0000;border-style:none}@media (hover:hover){.bailey-dismiss-button:hover{opacity:.7}}.bailey-input-area{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-input-row{align-items:center;gap:calc(var(--spacing) * 2);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);min-width:0;padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex:1;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input{--tw-border-style:none;min-width:0;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;background-color:#0000;border-style:none;outline-style:none;flex:1}.bailey-input:disabled{opacity:.5}.bailey-send-button,.bailey-stop-button{cursor:pointer;appearance:none;background-color:#0000;border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}:is(.bailey-send-button,.bailey-stop-button):disabled{cursor:default;opacity:.4}.bailey-send-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-heart);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:#16a34a1a}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:color-mix(in oklab, var(--color-bailey-heart) 10%, transparent)}}}.bailey-send-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-stop-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-error);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:#d32f2f1a}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:color-mix(in oklab, var(--color-bailey-error) 10%, transparent)}}}.bailey-stop-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-copy-button{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-copy-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-copy-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-copy-button:hover{color:var(--color-bailey-text)}}.bailey-copy-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-tooltip-content{padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));background-color:var(--color-bailey-tooltip-bg,#000);color:var(--color-bailey-tooltip-text,#fff);border-radius:.25rem}.bailey-menu-button{height:calc(var(--spacing) * 13);width:calc(var(--spacing) * 13);cursor:pointer;appearance:none;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-menu-button:hover{background-color:var(--color-gray-50)}}.bailey-menu-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-menu-content{z-index:50;min-width:calc(var(--spacing) * 44);border-radius:var(--radius-2xl);background-color:var(--color-white);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-black);--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);font-family:var(--font-sans,\"Inter\", -apple-system, \"Segoe UI\", Roboto, Arial, sans-serif)}.bailey-menu-item{cursor:pointer;align-items:center;gap:calc(var(--spacing) * 3);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;outline-style:none;display:flex}.bailey-menu-item[data-highlighted]{background-color:var(--color-gray-100)}.bailey-menu-item-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-gray-600)}.bailey-tooltip-arrow{fill:var(--color-bailey-tooltip-bg,#000)}.bailey-markdown-content table{border-collapse:collapse;width:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.bailey-markdown-content th{background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);text-align:left;--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content td{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);vertical-align:top}.bailey-markdown-content tr:nth-child(2n){background-color:var(--color-bailey-surface-muted)}.bailey-markdown-content{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.bailey-markdown-content>:first-child{margin-top:0}.bailey-markdown-content>:last-child{margin-bottom:0}.bailey-markdown-content p{margin-block:calc(var(--spacing) * 2)}.bailey-markdown-content h1{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h2{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h3{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h4,.bailey-markdown-content h5,.bailey-markdown-content h6{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content ul{margin-block:calc(var(--spacing) * 2);list-style-type:disc}:where(.bailey-markdown-content ul>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ul{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content ol{margin-block:calc(var(--spacing) * 2);list-style-type:decimal}:where(.bailey-markdown-content ol>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ol{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content a{color:var(--color-bailey-accent);text-underline-offset:2px;text-decoration-line:underline}.bailey-markdown-content code{background-color:var(--color-bailey-surface-muted);padding-inline:var(--spacing);padding-block:calc(var(--spacing) * .5);font-family:var(--font-mono);border-radius:.25rem;font-size:.85em}.bailey-markdown-content pre{margin-block:calc(var(--spacing) * 2);border-radius:var(--radius-md);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 2);overflow-x:auto}.bailey-markdown-content pre code{background-color:#0000;padding:0}.bailey-markdown-content blockquote{margin-block:calc(var(--spacing) * 2);border-left-style:var(--tw-border-style);border-left-width:2px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 3);color:var(--color-bailey-text-secondary);font-style:italic}.bailey-markdown-content hr{margin-block:calc(var(--spacing) * 3);border-color:var(--color-bailey-border)}.bailey-trace-panel{margin-bottom:calc(var(--spacing) * 2)}.bailey-trace-toggle-row{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-trace-toggle{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-trace-toggle:hover{text-decoration-line:underline}}.bailey-trace-toggle-error{color:var(--color-bailey-error)}.bailey-trace-summary{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-trace-summary-error{color:var(--color-bailey-error)}.bailey-trace-body{margin-top:var(--spacing);max-height:calc(var(--spacing) * 80);overflow-y:auto}.bailey-trace-actions-row{justify-content:flex-end;gap:calc(var(--spacing) * 3);display:flex}.bailey-trace-copy-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}@media (hover:hover){.bailey-trace-copy-button:hover{text-decoration-line:none}}.bailey-trace-request-details{margin-bottom:var(--spacing);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding:calc(var(--spacing) * 2)}.bailey-trace-request-meta{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:block}.bailey-trace-rows{gap:var(--spacing);flex-direction:column;display:flex}.bailey-trace-row{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-row-header{align-items:center;gap:calc(var(--spacing) * 2);flex-wrap:wrap;display:flex}.bailey-trace-row-time{color:var(--color-bailey-text-secondary)}.bailey-trace-row-gap{color:var(--color-gray-400)}.bailey-trace-row-summary{word-break:break-all}.bailey-trace-chip{padding-inline:calc(var(--spacing) * 1.5);padding-block:calc(var(--spacing) * .5);--tw-font-weight:var(--font-weight-semibold);font-size:.65rem;font-weight:var(--font-weight-semibold);border-radius:.25rem}.bailey-trace-chip-default{background-color:var(--color-gray-200);color:var(--color-gray-700)}.bailey-trace-chip-info{background-color:var(--color-blue-100);color:var(--color-blue-700)}.bailey-trace-chip-success{background-color:var(--color-green-100);color:var(--color-green-700)}.bailey-trace-chip-secondary{background-color:var(--color-purple-100);color:var(--color-purple-700)}.bailey-trace-chip-error{background-color:var(--color-red-100);color:var(--color-bailey-error)}.bailey-trace-disclosure{margin-top:var(--spacing)}.bailey-trace-disclosure-summary{cursor:pointer;color:var(--color-bailey-text-secondary);font-size:.7rem}.bailey-trace-disclosure-actions{margin-top:var(--spacing);justify-content:flex-end;display:flex}.bailey-trace-disclosure-content{margin-top:var(--spacing);max-height:calc(var(--spacing) * 48);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 1.5);word-break:break-all;white-space:pre-wrap;border-radius:.25rem;font-size:.7rem;overflow:auto}.bailey-trace-group{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing)}.bailey-trace-group-summary{cursor:pointer;font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-group-failed{margin-left:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-space-y-reverse{syntax:\"*\";inherits:false;initial-value:0}@keyframes spin{to{transform:rotate(360deg)}}", Se = r(void 0), Ce = /:root\s*,\s*:host\s*\{/, we = ".bailey-chat-panel{";
|
|
751
|
+
function Te(e) {
|
|
752
|
+
let t = e.match(new RegExp(Ce, "g"))?.length ?? 0;
|
|
695
753
|
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.`);
|
|
696
|
-
return e.replace(
|
|
754
|
+
return e.replace(Ce, we);
|
|
697
755
|
}
|
|
698
|
-
var
|
|
699
|
-
function
|
|
756
|
+
var Ee = Te(xe), De = "data-source", Oe = "baileyai-chat-ui", Q = /* @__PURE__ */ new WeakMap();
|
|
757
|
+
function ke(e) {
|
|
700
758
|
let t = e.getRootNode();
|
|
701
759
|
return t instanceof ShadowRoot ? t : document;
|
|
702
760
|
}
|
|
703
|
-
function
|
|
761
|
+
function Ae(e) {
|
|
704
762
|
let t = e instanceof ShadowRoot ? e : document.head, n = Q.get(e) ?? 0;
|
|
705
|
-
if (n === 0 && !t.querySelector(`style[${
|
|
763
|
+
if (n === 0 && !t.querySelector(`style[${De}="${Oe}"]`)) {
|
|
706
764
|
let e = document.createElement("style");
|
|
707
|
-
e.setAttribute(
|
|
765
|
+
e.setAttribute(De, Oe), e.textContent = Ee, t.appendChild(e);
|
|
708
766
|
}
|
|
709
767
|
return Q.set(e, n + 1), () => {
|
|
710
768
|
let n = (Q.get(e) ?? 1) - 1;
|
|
711
|
-
n <= 0 ? (Q.delete(e), t.querySelector(`style[${
|
|
769
|
+
n <= 0 ? (Q.delete(e), t.querySelector(`style[${De}="${Oe}"]`)?.remove()) : Q.set(e, n);
|
|
712
770
|
};
|
|
713
771
|
}
|
|
714
|
-
function
|
|
715
|
-
let [n, r] =
|
|
716
|
-
return
|
|
772
|
+
function je(e, t = !1) {
|
|
773
|
+
let [n, r] = d(null);
|
|
774
|
+
return c(() => {
|
|
717
775
|
if (t) return;
|
|
718
776
|
let n = e.current;
|
|
719
777
|
if (!n) return;
|
|
720
|
-
let i =
|
|
721
|
-
return r(i),
|
|
778
|
+
let i = ke(n);
|
|
779
|
+
return r(i), Ae(i);
|
|
722
780
|
}, [t, e]), n;
|
|
723
781
|
}
|
|
724
|
-
function
|
|
725
|
-
let t =
|
|
782
|
+
function Me(e) {
|
|
783
|
+
let t = o(Se), n = t !== void 0, r = je(e, n);
|
|
726
784
|
return n ? t : r;
|
|
727
785
|
}
|
|
728
786
|
//#endregion
|
|
729
787
|
//#region src/ui/markdown.tsx
|
|
730
|
-
function
|
|
788
|
+
function Ne({ renderTable: t, renderChart: n } = {}) {
|
|
731
789
|
return {
|
|
732
|
-
a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ g
|
|
790
|
+
a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ _(g, { children: n }) : /* @__PURE__ */ _("a", {
|
|
733
791
|
href: t,
|
|
734
792
|
target: "_blank",
|
|
735
793
|
rel: "noopener noreferrer",
|
|
736
794
|
children: n
|
|
737
795
|
}),
|
|
738
796
|
table: ({ node: n, children: r }) => {
|
|
739
|
-
let i = n &&
|
|
740
|
-
if (i &&
|
|
797
|
+
let i = n && G(n);
|
|
798
|
+
if (i && K(i.rows) && t) {
|
|
741
799
|
let n = i.rows.map((t) => t.map((t) => t.href && !e(t.href) ? { text: t.text } : t));
|
|
742
|
-
return /* @__PURE__ */ g
|
|
800
|
+
return /* @__PURE__ */ _(g, { children: t({
|
|
743
801
|
headers: i.headers,
|
|
744
802
|
rows: n
|
|
745
803
|
}) });
|
|
746
804
|
}
|
|
747
|
-
return /* @__PURE__ */
|
|
805
|
+
return /* @__PURE__ */ _("table", { children: r });
|
|
748
806
|
},
|
|
749
807
|
pre: ({ children: e }) => {
|
|
750
808
|
let t = (Array.isArray(e) ? e[0] : e)?.props;
|
|
751
809
|
if ((t?.className?.split(" ") ?? []).includes("language-chartjs") && n) {
|
|
752
|
-
let e = t?.children, r =
|
|
753
|
-
if (r) return /* @__PURE__ */ g
|
|
810
|
+
let e = t?.children, r = ie(Array.isArray(e) ? e.join("") : String(e ?? ""));
|
|
811
|
+
if (r) return /* @__PURE__ */ _(g, { children: n(r) });
|
|
754
812
|
}
|
|
755
|
-
return /* @__PURE__ */
|
|
813
|
+
return /* @__PURE__ */ _("pre", { children: e });
|
|
756
814
|
}
|
|
757
815
|
};
|
|
758
816
|
}
|
|
759
817
|
//#endregion
|
|
760
818
|
//#region src/ui/icons.tsx
|
|
761
|
-
function
|
|
762
|
-
return /* @__PURE__ */
|
|
819
|
+
function Pe({ className: e }) {
|
|
820
|
+
return /* @__PURE__ */ _("svg", {
|
|
763
821
|
viewBox: "0 0 24 24",
|
|
764
822
|
fill: "currentColor",
|
|
765
823
|
className: e,
|
|
766
824
|
"aria-hidden": "true",
|
|
767
|
-
children: /* @__PURE__ */
|
|
825
|
+
children: /* @__PURE__ */ _("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" })
|
|
768
826
|
});
|
|
769
827
|
}
|
|
770
|
-
function
|
|
771
|
-
return /* @__PURE__ */
|
|
828
|
+
function Fe({ className: e }) {
|
|
829
|
+
return /* @__PURE__ */ _("svg", {
|
|
772
830
|
viewBox: "0 0 24 24",
|
|
773
831
|
fill: "currentColor",
|
|
774
832
|
className: e,
|
|
775
833
|
"aria-hidden": "true",
|
|
776
|
-
children: /* @__PURE__ */
|
|
834
|
+
children: /* @__PURE__ */ _("rect", {
|
|
777
835
|
x: "6",
|
|
778
836
|
y: "6",
|
|
779
837
|
width: "12",
|
|
@@ -782,8 +840,8 @@ function Ne({ className: e }) {
|
|
|
782
840
|
})
|
|
783
841
|
});
|
|
784
842
|
}
|
|
785
|
-
function
|
|
786
|
-
return /* @__PURE__ */
|
|
843
|
+
function Ie({ className: e }) {
|
|
844
|
+
return /* @__PURE__ */ v("svg", {
|
|
787
845
|
viewBox: "0 0 24 24",
|
|
788
846
|
fill: "none",
|
|
789
847
|
stroke: "currentColor",
|
|
@@ -792,11 +850,11 @@ function Pe({ className: e }) {
|
|
|
792
850
|
strokeLinejoin: "round",
|
|
793
851
|
className: e,
|
|
794
852
|
"aria-hidden": "true",
|
|
795
|
-
children: [/* @__PURE__ */
|
|
853
|
+
children: [/* @__PURE__ */ _("path", { d: "M7 17 17 7" }), /* @__PURE__ */ _("path", { d: "M9 7h8v8" })]
|
|
796
854
|
});
|
|
797
855
|
}
|
|
798
|
-
function
|
|
799
|
-
return /* @__PURE__ */
|
|
856
|
+
function Le({ className: e }) {
|
|
857
|
+
return /* @__PURE__ */ v("svg", {
|
|
800
858
|
viewBox: "0 0 24 24",
|
|
801
859
|
fill: "none",
|
|
802
860
|
stroke: "currentColor",
|
|
@@ -805,17 +863,17 @@ function Fe({ className: e }) {
|
|
|
805
863
|
strokeLinejoin: "round",
|
|
806
864
|
className: e,
|
|
807
865
|
"aria-hidden": "true",
|
|
808
|
-
children: [/* @__PURE__ */
|
|
866
|
+
children: [/* @__PURE__ */ _("rect", {
|
|
809
867
|
x: "8",
|
|
810
868
|
y: "8",
|
|
811
869
|
width: "12",
|
|
812
870
|
height: "12",
|
|
813
871
|
rx: "2"
|
|
814
|
-
}), /* @__PURE__ */
|
|
872
|
+
}), /* @__PURE__ */ _("path", { d: "M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" })]
|
|
815
873
|
});
|
|
816
874
|
}
|
|
817
|
-
function
|
|
818
|
-
return /* @__PURE__ */
|
|
875
|
+
function Re({ className: e }) {
|
|
876
|
+
return /* @__PURE__ */ _("svg", {
|
|
819
877
|
viewBox: "0 0 24 24",
|
|
820
878
|
fill: "none",
|
|
821
879
|
stroke: "currentColor",
|
|
@@ -824,11 +882,11 @@ function Ie({ className: e }) {
|
|
|
824
882
|
strokeLinejoin: "round",
|
|
825
883
|
className: e,
|
|
826
884
|
"aria-hidden": "true",
|
|
827
|
-
children: /* @__PURE__ */
|
|
885
|
+
children: /* @__PURE__ */ _("path", { d: "M5 12.5 9.5 17 19 7" })
|
|
828
886
|
});
|
|
829
887
|
}
|
|
830
|
-
function
|
|
831
|
-
return /* @__PURE__ */
|
|
888
|
+
function ze({ className: e }) {
|
|
889
|
+
return /* @__PURE__ */ _("svg", {
|
|
832
890
|
viewBox: "0 0 24 24",
|
|
833
891
|
fill: "none",
|
|
834
892
|
stroke: "currentColor",
|
|
@@ -837,11 +895,11 @@ function Le({ className: e }) {
|
|
|
837
895
|
strokeLinejoin: "round",
|
|
838
896
|
className: e,
|
|
839
897
|
"aria-hidden": "true",
|
|
840
|
-
children: /* @__PURE__ */
|
|
898
|
+
children: /* @__PURE__ */ _("path", { d: "m22.7 13.5-2-2-2 2M21 12a9 9 0 1 1-1.245-4.57M12 7v5l3 2" })
|
|
841
899
|
});
|
|
842
900
|
}
|
|
843
|
-
function
|
|
844
|
-
return /* @__PURE__ */
|
|
901
|
+
function Be({ className: e }) {
|
|
902
|
+
return /* @__PURE__ */ v("svg", {
|
|
845
903
|
viewBox: "0 0 24 24",
|
|
846
904
|
fill: "none",
|
|
847
905
|
stroke: "currentColor",
|
|
@@ -850,31 +908,31 @@ function Re({ className: e }) {
|
|
|
850
908
|
strokeLinejoin: "round",
|
|
851
909
|
className: e,
|
|
852
910
|
"aria-hidden": "true",
|
|
853
|
-
children: [/* @__PURE__ */
|
|
911
|
+
children: [/* @__PURE__ */ _("circle", {
|
|
854
912
|
cx: "12",
|
|
855
913
|
cy: "12",
|
|
856
914
|
r: "9"
|
|
857
|
-
}), /* @__PURE__ */
|
|
915
|
+
}), /* @__PURE__ */ _("path", { d: "M8.5 12.5 11 15l4.5-5.5" })]
|
|
858
916
|
});
|
|
859
917
|
}
|
|
860
|
-
function
|
|
861
|
-
return /* @__PURE__ */
|
|
918
|
+
function Ve({ className: e }) {
|
|
919
|
+
return /* @__PURE__ */ v("svg", {
|
|
862
920
|
viewBox: "0 0 24 24",
|
|
863
921
|
fill: "currentColor",
|
|
864
922
|
className: e,
|
|
865
923
|
"aria-hidden": "true",
|
|
866
924
|
children: [
|
|
867
|
-
/* @__PURE__ */
|
|
925
|
+
/* @__PURE__ */ _("circle", {
|
|
868
926
|
cx: "5",
|
|
869
927
|
cy: "12",
|
|
870
928
|
r: "1.75"
|
|
871
929
|
}),
|
|
872
|
-
/* @__PURE__ */
|
|
930
|
+
/* @__PURE__ */ _("circle", {
|
|
873
931
|
cx: "12",
|
|
874
932
|
cy: "12",
|
|
875
933
|
r: "1.75"
|
|
876
934
|
}),
|
|
877
|
-
/* @__PURE__ */
|
|
935
|
+
/* @__PURE__ */ _("circle", {
|
|
878
936
|
cx: "19",
|
|
879
937
|
cy: "12",
|
|
880
938
|
r: "1.75"
|
|
@@ -882,8 +940,8 @@ function ze({ className: e }) {
|
|
|
882
940
|
]
|
|
883
941
|
});
|
|
884
942
|
}
|
|
885
|
-
function
|
|
886
|
-
return /* @__PURE__ */
|
|
943
|
+
function He({ className: e }) {
|
|
944
|
+
return /* @__PURE__ */ _("svg", {
|
|
887
945
|
viewBox: "0 0 24 24",
|
|
888
946
|
fill: "none",
|
|
889
947
|
stroke: "currentColor",
|
|
@@ -892,24 +950,24 @@ function Be({ className: e }) {
|
|
|
892
950
|
strokeLinejoin: "round",
|
|
893
951
|
className: e,
|
|
894
952
|
"aria-hidden": "true",
|
|
895
|
-
children: /* @__PURE__ */
|
|
953
|
+
children: /* @__PURE__ */ _("path", { d: "M12 5v14M5 12h14" })
|
|
896
954
|
});
|
|
897
955
|
}
|
|
898
956
|
//#endregion
|
|
899
957
|
//#region src/ui/CopyMarkdownButton.tsx
|
|
900
|
-
var
|
|
901
|
-
function
|
|
902
|
-
let [a,
|
|
903
|
-
return
|
|
958
|
+
var Ue = 1500;
|
|
959
|
+
function We({ markdown: e, className: t, ariaLabel: n = "copy response as markdown", tooltipDefaultText: r = "Copy as markdown", tooltipCopiedText: i = "Copied!" }) {
|
|
960
|
+
let [a, o] = d(!1), [c, l] = d(!1), f = u(null), p = u(null), m = Me(p);
|
|
961
|
+
return s(() => () => {
|
|
904
962
|
f.current !== null && clearTimeout(f.current);
|
|
905
|
-
}, []), /* @__PURE__ */
|
|
963
|
+
}, []), /* @__PURE__ */ _(h.Provider, {
|
|
906
964
|
delayDuration: 200,
|
|
907
|
-
children: /* @__PURE__ */
|
|
965
|
+
children: /* @__PURE__ */ v(h.Root, {
|
|
908
966
|
open: a || c,
|
|
909
|
-
onOpenChange:
|
|
910
|
-
children: [/* @__PURE__ */
|
|
967
|
+
onOpenChange: l,
|
|
968
|
+
children: [/* @__PURE__ */ _(h.Trigger, {
|
|
911
969
|
asChild: !0,
|
|
912
|
-
children: /* @__PURE__ */
|
|
970
|
+
children: /* @__PURE__ */ _("button", {
|
|
913
971
|
ref: p,
|
|
914
972
|
type: "button",
|
|
915
973
|
onClick: async () => {
|
|
@@ -918,18 +976,18 @@ function He({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
|
|
|
918
976
|
} catch {
|
|
919
977
|
return;
|
|
920
978
|
}
|
|
921
|
-
|
|
979
|
+
o(!0), f.current !== null && clearTimeout(f.current), f.current = setTimeout(() => o(!1), Ue);
|
|
922
980
|
},
|
|
923
981
|
"aria-label": n,
|
|
924
982
|
className: `bailey-copy-button${t ? ` ${t}` : ""}`,
|
|
925
|
-
children:
|
|
983
|
+
children: _(a ? Re : Le, { className: "bailey-copy-icon" })
|
|
926
984
|
})
|
|
927
|
-
}), /* @__PURE__ */
|
|
928
|
-
container:
|
|
929
|
-
children: /* @__PURE__ */
|
|
985
|
+
}), /* @__PURE__ */ _(h.Portal, {
|
|
986
|
+
container: m instanceof ShadowRoot ? m : void 0,
|
|
987
|
+
children: /* @__PURE__ */ v(h.Content, {
|
|
930
988
|
side: "top",
|
|
931
989
|
className: "bailey-tooltip-content",
|
|
932
|
-
children: [a ? i : r, /* @__PURE__ */
|
|
990
|
+
children: [a ? i : r, /* @__PURE__ */ _(h.Arrow, { className: "bailey-tooltip-arrow" })]
|
|
933
991
|
})
|
|
934
992
|
})]
|
|
935
993
|
})
|
|
@@ -937,20 +995,20 @@ function He({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
|
|
|
937
995
|
}
|
|
938
996
|
//#endregion
|
|
939
997
|
//#region src/ui/BaileyTracePanel.tsx
|
|
940
|
-
async function
|
|
998
|
+
async function Ge(e) {
|
|
941
999
|
try {
|
|
942
1000
|
await navigator.clipboard.writeText(e);
|
|
943
1001
|
} catch {}
|
|
944
1002
|
}
|
|
945
|
-
function
|
|
946
|
-
return /* @__PURE__ */
|
|
1003
|
+
function Ke({ text: e, label: t = "Copy" }) {
|
|
1004
|
+
return /* @__PURE__ */ _("button", {
|
|
947
1005
|
type: "button",
|
|
948
|
-
onClick: () =>
|
|
1006
|
+
onClick: () => Ge(e),
|
|
949
1007
|
className: "bailey-trace-copy-button",
|
|
950
1008
|
children: t
|
|
951
1009
|
});
|
|
952
1010
|
}
|
|
953
|
-
function
|
|
1011
|
+
function qe(e) {
|
|
954
1012
|
if (e.failed || e.kind === "error") return "bailey-trace-chip bailey-trace-chip-error";
|
|
955
1013
|
switch (e.kind) {
|
|
956
1014
|
case "tool_start":
|
|
@@ -962,77 +1020,77 @@ function Ge(e) {
|
|
|
962
1020
|
}
|
|
963
1021
|
}
|
|
964
1022
|
function $({ label: e, content: t, copyable: n }) {
|
|
965
|
-
return /* @__PURE__ */
|
|
1023
|
+
return /* @__PURE__ */ v("details", {
|
|
966
1024
|
className: "bailey-trace-disclosure",
|
|
967
1025
|
children: [
|
|
968
|
-
/* @__PURE__ */
|
|
1026
|
+
/* @__PURE__ */ _("summary", {
|
|
969
1027
|
className: "bailey-trace-disclosure-summary",
|
|
970
1028
|
children: e
|
|
971
1029
|
}),
|
|
972
|
-
n && /* @__PURE__ */
|
|
1030
|
+
n && /* @__PURE__ */ _("div", {
|
|
973
1031
|
className: "bailey-trace-disclosure-actions",
|
|
974
|
-
children: /* @__PURE__ */
|
|
1032
|
+
children: /* @__PURE__ */ _(Ke, { text: t })
|
|
975
1033
|
}),
|
|
976
|
-
/* @__PURE__ */
|
|
1034
|
+
/* @__PURE__ */ _("pre", {
|
|
977
1035
|
className: "bailey-trace-disclosure-content",
|
|
978
1036
|
children: t
|
|
979
1037
|
})
|
|
980
1038
|
]
|
|
981
1039
|
});
|
|
982
1040
|
}
|
|
983
|
-
function
|
|
984
|
-
return /* @__PURE__ */
|
|
1041
|
+
function Je({ row: e }) {
|
|
1042
|
+
return /* @__PURE__ */ v("div", {
|
|
985
1043
|
className: "bailey-trace-row",
|
|
986
1044
|
children: [
|
|
987
|
-
/* @__PURE__ */
|
|
1045
|
+
/* @__PURE__ */ v("div", {
|
|
988
1046
|
className: "bailey-trace-row-header",
|
|
989
1047
|
children: [
|
|
990
|
-
/* @__PURE__ */
|
|
1048
|
+
/* @__PURE__ */ _("span", {
|
|
991
1049
|
className: "bailey-trace-row-time",
|
|
992
1050
|
children: e.time
|
|
993
1051
|
}),
|
|
994
|
-
/* @__PURE__ */
|
|
1052
|
+
/* @__PURE__ */ _("span", {
|
|
995
1053
|
className: "bailey-trace-row-gap",
|
|
996
1054
|
title: "Time since the previous event",
|
|
997
1055
|
children: me(e.gapMs)
|
|
998
1056
|
}),
|
|
999
|
-
/* @__PURE__ */
|
|
1000
|
-
className:
|
|
1057
|
+
/* @__PURE__ */ _("span", {
|
|
1058
|
+
className: qe(e),
|
|
1001
1059
|
children: e.label
|
|
1002
1060
|
}),
|
|
1003
|
-
/* @__PURE__ */
|
|
1061
|
+
/* @__PURE__ */ _("span", {
|
|
1004
1062
|
className: "bailey-trace-row-summary",
|
|
1005
1063
|
children: e.summary
|
|
1006
1064
|
})
|
|
1007
1065
|
]
|
|
1008
1066
|
}),
|
|
1009
|
-
e.argsDetail && /* @__PURE__ */
|
|
1067
|
+
e.argsDetail && /* @__PURE__ */ _($, {
|
|
1010
1068
|
label: e.kind === "llm_call_start" ? "request" : "args",
|
|
1011
1069
|
content: e.argsDetail
|
|
1012
1070
|
}),
|
|
1013
|
-
e.outputDetail && /* @__PURE__ */
|
|
1071
|
+
e.outputDetail && /* @__PURE__ */ _($, {
|
|
1014
1072
|
label: e.kind === "llm_call_end" ? "response" : "output",
|
|
1015
1073
|
content: e.outputDetail
|
|
1016
1074
|
}),
|
|
1017
|
-
e.structuredOutputDetail && /* @__PURE__ */
|
|
1075
|
+
e.structuredOutputDetail && /* @__PURE__ */ _($, {
|
|
1018
1076
|
label: "structured output",
|
|
1019
1077
|
content: e.structuredOutputDetail
|
|
1020
1078
|
}),
|
|
1021
|
-
e.rawDetail && /* @__PURE__ */
|
|
1079
|
+
e.rawDetail && /* @__PURE__ */ _($, {
|
|
1022
1080
|
label: "raw",
|
|
1023
1081
|
content: e.rawDetail
|
|
1024
1082
|
})
|
|
1025
1083
|
]
|
|
1026
1084
|
});
|
|
1027
1085
|
}
|
|
1028
|
-
function
|
|
1086
|
+
function Ye(e, t) {
|
|
1029
1087
|
if (e.chunkCount === 0) return "Streamed: no chunks received";
|
|
1030
1088
|
if (e.chunkCount === 1 || e.firstChunkAt === null) return "Streamed: 1 chunk (not incremental)";
|
|
1031
1089
|
let n = e.firstChunkAt - t, r = (e.lastChunkAt ?? e.firstChunkAt) - e.firstChunkAt;
|
|
1032
1090
|
return `Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r / 1e3).toFixed(1)}s`;
|
|
1033
1091
|
}
|
|
1034
|
-
function
|
|
1035
|
-
let t =
|
|
1092
|
+
function Xe({ request: e }) {
|
|
1093
|
+
let t = l(() => JSON.stringify({
|
|
1036
1094
|
model: e.model,
|
|
1037
1095
|
instructions: e.systemPrompt,
|
|
1038
1096
|
input: e.messages,
|
|
@@ -1040,10 +1098,10 @@ function Je({ request: e }) {
|
|
|
1040
1098
|
tools: e.tools,
|
|
1041
1099
|
toolChoice: e.toolChoice
|
|
1042
1100
|
}, null, 2), [e]);
|
|
1043
|
-
return /* @__PURE__ */
|
|
1101
|
+
return /* @__PURE__ */ v("div", {
|
|
1044
1102
|
className: "bailey-trace-request-details",
|
|
1045
1103
|
children: [
|
|
1046
|
-
/* @__PURE__ */
|
|
1104
|
+
/* @__PURE__ */ v("span", {
|
|
1047
1105
|
className: "bailey-trace-request-meta",
|
|
1048
1106
|
children: [
|
|
1049
1107
|
"Last request — ",
|
|
@@ -1053,26 +1111,26 @@ function Je({ request: e }) {
|
|
|
1053
1111
|
e.requestId ? ` · ${e.requestId}` : ""
|
|
1054
1112
|
]
|
|
1055
1113
|
}),
|
|
1056
|
-
/* @__PURE__ */
|
|
1114
|
+
/* @__PURE__ */ _("span", {
|
|
1057
1115
|
className: "bailey-trace-request-meta",
|
|
1058
|
-
children:
|
|
1116
|
+
children: Ye(e.streamStats, e.sentAt)
|
|
1059
1117
|
}),
|
|
1060
|
-
/* @__PURE__ */
|
|
1118
|
+
/* @__PURE__ */ _($, {
|
|
1061
1119
|
label: `System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,
|
|
1062
1120
|
content: e.systemPrompt,
|
|
1063
1121
|
copyable: !0
|
|
1064
1122
|
}),
|
|
1065
|
-
/* @__PURE__ */
|
|
1123
|
+
/* @__PURE__ */ _($, {
|
|
1066
1124
|
label: `Messages (${e.messages.length})`,
|
|
1067
1125
|
content: JSON.stringify(e.messages, null, 2),
|
|
1068
1126
|
copyable: !0
|
|
1069
1127
|
}),
|
|
1070
|
-
e.response && /* @__PURE__ */
|
|
1128
|
+
e.response && /* @__PURE__ */ _($, {
|
|
1071
1129
|
label: `Response (${e.response.content.length.toLocaleString()} chars)`,
|
|
1072
1130
|
content: e.response.content,
|
|
1073
1131
|
copyable: !0
|
|
1074
1132
|
}),
|
|
1075
|
-
/* @__PURE__ */
|
|
1133
|
+
/* @__PURE__ */ _($, {
|
|
1076
1134
|
label: "Full payload (JSON)",
|
|
1077
1135
|
content: t,
|
|
1078
1136
|
copyable: !0
|
|
@@ -1080,43 +1138,43 @@ function Je({ request: e }) {
|
|
|
1080
1138
|
]
|
|
1081
1139
|
});
|
|
1082
1140
|
}
|
|
1083
|
-
function
|
|
1084
|
-
let r =
|
|
1085
|
-
return /* @__PURE__ */
|
|
1141
|
+
function Ze({ events: e, lastRequest: t, onClear: n }) {
|
|
1142
|
+
let r = l(() => he(e), [e]), i = l(() => _e(r), [r]), a = l(() => JSON.stringify(e, null, 2), [e]);
|
|
1143
|
+
return /* @__PURE__ */ v("div", {
|
|
1086
1144
|
className: "bailey-trace-body",
|
|
1087
1145
|
children: [
|
|
1088
|
-
/* @__PURE__ */
|
|
1146
|
+
/* @__PURE__ */ v("div", {
|
|
1089
1147
|
className: "bailey-trace-actions-row",
|
|
1090
|
-
children: [e.length > 0 && /* @__PURE__ */
|
|
1148
|
+
children: [e.length > 0 && /* @__PURE__ */ _(Ke, {
|
|
1091
1149
|
text: a,
|
|
1092
1150
|
label: "Copy trace as JSON"
|
|
1093
|
-
}), /* @__PURE__ */
|
|
1151
|
+
}), /* @__PURE__ */ _("button", {
|
|
1094
1152
|
type: "button",
|
|
1095
1153
|
onClick: n,
|
|
1096
1154
|
className: "bailey-trace-copy-button",
|
|
1097
1155
|
children: "Clear"
|
|
1098
1156
|
})]
|
|
1099
1157
|
}),
|
|
1100
|
-
t && /* @__PURE__ */
|
|
1101
|
-
/* @__PURE__ */
|
|
1158
|
+
t && /* @__PURE__ */ _(Xe, { request: t }),
|
|
1159
|
+
/* @__PURE__ */ _("div", {
|
|
1102
1160
|
className: "bailey-trace-rows",
|
|
1103
1161
|
children: i.map((e, t) => {
|
|
1104
|
-
if (e.type === "single") return /* @__PURE__ */
|
|
1162
|
+
if (e.type === "single") return /* @__PURE__ */ _(Je, { row: e.row }, e.row.key);
|
|
1105
1163
|
let n = e.rows.filter((e) => e.isToolStart).length;
|
|
1106
|
-
if (n <= 1) return /* @__PURE__ */
|
|
1164
|
+
if (n <= 1) return /* @__PURE__ */ _("div", {
|
|
1107
1165
|
className: "bailey-trace-rows",
|
|
1108
|
-
children: e.rows.map((e) => /* @__PURE__ */
|
|
1166
|
+
children: e.rows.map((e) => /* @__PURE__ */ _(Je, { row: e }, e.key))
|
|
1109
1167
|
}, `group-${t}`);
|
|
1110
1168
|
let r = e.rows.filter((e) => e.failed).length;
|
|
1111
|
-
return /* @__PURE__ */
|
|
1169
|
+
return /* @__PURE__ */ v("details", {
|
|
1112
1170
|
className: "bailey-trace-group",
|
|
1113
|
-
children: [/* @__PURE__ */
|
|
1171
|
+
children: [/* @__PURE__ */ v("summary", {
|
|
1114
1172
|
className: "bailey-trace-group-summary",
|
|
1115
1173
|
children: [
|
|
1116
|
-
/* @__PURE__ */
|
|
1174
|
+
/* @__PURE__ */ _("strong", { children: e.toolName }),
|
|
1117
1175
|
" × ",
|
|
1118
1176
|
n,
|
|
1119
|
-
r > 0 && /* @__PURE__ */
|
|
1177
|
+
r > 0 && /* @__PURE__ */ v("span", {
|
|
1120
1178
|
className: "bailey-trace-group-failed",
|
|
1121
1179
|
children: [
|
|
1122
1180
|
" ",
|
|
@@ -1125,9 +1183,9 @@ function Ye({ events: e, lastRequest: t, onClear: n }) {
|
|
|
1125
1183
|
]
|
|
1126
1184
|
})
|
|
1127
1185
|
]
|
|
1128
|
-
}), /* @__PURE__ */
|
|
1186
|
+
}), /* @__PURE__ */ _("div", {
|
|
1129
1187
|
className: "bailey-trace-rows",
|
|
1130
|
-
children: e.rows.map((e) => /* @__PURE__ */
|
|
1188
|
+
children: e.rows.map((e) => /* @__PURE__ */ _(Je, { row: e }, e.key))
|
|
1131
1189
|
})]
|
|
1132
1190
|
}, `group-${t}`);
|
|
1133
1191
|
})
|
|
@@ -1135,13 +1193,13 @@ function Ye({ events: e, lastRequest: t, onClear: n }) {
|
|
|
1135
1193
|
]
|
|
1136
1194
|
});
|
|
1137
1195
|
}
|
|
1138
|
-
function
|
|
1139
|
-
let [r, i] =
|
|
1140
|
-
return e.length === 0 && !t ? null : /* @__PURE__ */
|
|
1196
|
+
function Qe({ events: e, lastRequest: t, onClear: n }) {
|
|
1197
|
+
let [r, i] = d(!1), a = l(() => ve(e), [e]), o = l(() => ge(e), [e]);
|
|
1198
|
+
return e.length === 0 && !t ? null : /* @__PURE__ */ v("div", {
|
|
1141
1199
|
className: "bailey-trace-panel",
|
|
1142
|
-
children: [/* @__PURE__ */
|
|
1200
|
+
children: [/* @__PURE__ */ v("div", {
|
|
1143
1201
|
className: "bailey-trace-toggle-row",
|
|
1144
|
-
children: [/* @__PURE__ */
|
|
1202
|
+
children: [/* @__PURE__ */ v("button", {
|
|
1145
1203
|
type: "button",
|
|
1146
1204
|
onClick: () => i((e) => !e),
|
|
1147
1205
|
"aria-expanded": r,
|
|
@@ -1153,11 +1211,11 @@ function Xe({ events: e, lastRequest: t, onClear: n }) {
|
|
|
1153
1211
|
e.length,
|
|
1154
1212
|
")"
|
|
1155
1213
|
]
|
|
1156
|
-
}), o && /* @__PURE__ */
|
|
1214
|
+
}), o && /* @__PURE__ */ _("span", {
|
|
1157
1215
|
className: a ? "bailey-trace-summary bailey-trace-summary-error" : "bailey-trace-summary",
|
|
1158
1216
|
children: o
|
|
1159
1217
|
})]
|
|
1160
|
-
}), r && /* @__PURE__ */
|
|
1218
|
+
}), r && /* @__PURE__ */ _(Ze, {
|
|
1161
1219
|
events: e,
|
|
1162
1220
|
lastRequest: t,
|
|
1163
1221
|
onClear: n
|
|
@@ -1166,8 +1224,8 @@ function Xe({ events: e, lastRequest: t, onClear: n }) {
|
|
|
1166
1224
|
}
|
|
1167
1225
|
//#endregion
|
|
1168
1226
|
//#region src/ui/ToolResultImage.tsx
|
|
1169
|
-
function
|
|
1170
|
-
return t(e) ? /* @__PURE__ */
|
|
1227
|
+
function $e({ src: e, alt: n, className: r }) {
|
|
1228
|
+
return t(e) ? /* @__PURE__ */ _("img", {
|
|
1171
1229
|
src: e,
|
|
1172
1230
|
alt: n ?? "",
|
|
1173
1231
|
className: `bailey-tool-result-image${r ? ` ${r}` : ""}`,
|
|
@@ -1175,8 +1233,93 @@ function Ze({ src: e, alt: n, className: r }) {
|
|
|
1175
1233
|
}) : null;
|
|
1176
1234
|
}
|
|
1177
1235
|
//#endregion
|
|
1236
|
+
//#region src/utils/safeMcpAppResource.ts
|
|
1237
|
+
var et = /^ui:\/\//, tt = 2097152, nt = /* @__PURE__ */ new Set([
|
|
1238
|
+
"connectDomains",
|
|
1239
|
+
"resourceDomains",
|
|
1240
|
+
"frameDomains",
|
|
1241
|
+
"baseUriDomains"
|
|
1242
|
+
]), rt = /* @__PURE__ */ new Set([
|
|
1243
|
+
"camera",
|
|
1244
|
+
"microphone",
|
|
1245
|
+
"geolocation",
|
|
1246
|
+
"clipboardWrite"
|
|
1247
|
+
]), it = (e, t) => e === void 0 ? !0 : typeof e != "object" || !e || Array.isArray(e) ? !1 : Object.keys(e).every((e) => t.has(e)), at = (e) => !(!et.test(e.resourceUri) || typeof e.html != "string" || e.html.length === 0 || e.html.length > tt || !it(e.csp, nt) || !it(e.permissions, rt));
|
|
1248
|
+
//#endregion
|
|
1249
|
+
//#region src/ui/McpAppFrame.tsx
|
|
1250
|
+
function ot({ html: e, title: t, resourceUri: n, csp: r, permissions: i, className: a }) {
|
|
1251
|
+
return at({
|
|
1252
|
+
html: e,
|
|
1253
|
+
resourceUri: n,
|
|
1254
|
+
csp: r,
|
|
1255
|
+
permissions: i
|
|
1256
|
+
}) ? /* @__PURE__ */ _("iframe", {
|
|
1257
|
+
title: t ?? "MCP App",
|
|
1258
|
+
srcDoc: e,
|
|
1259
|
+
sandbox: "allow-scripts",
|
|
1260
|
+
referrerPolicy: "no-referrer",
|
|
1261
|
+
className: `bailey-mcp-app-frame${a ? ` ${a}` : ""}`
|
|
1262
|
+
}) : null;
|
|
1263
|
+
}
|
|
1264
|
+
//#endregion
|
|
1265
|
+
//#region src/ui/BaileyToolSteps.tsx
|
|
1266
|
+
function st({ toolName: e, resolveActivityIcon: t }) {
|
|
1267
|
+
return /* @__PURE__ */ _("span", {
|
|
1268
|
+
className: "bailey-activity-icon",
|
|
1269
|
+
children: t?.(e) ?? /* @__PURE__ */ _(Be, {})
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
function ct({ steps: e, resolveActivityIcon: t }) {
|
|
1273
|
+
let n = e.filter((e) => e.status === "running");
|
|
1274
|
+
return n.length === 0 ? null : /* @__PURE__ */ _("div", {
|
|
1275
|
+
className: "bailey-tool-steps-live",
|
|
1276
|
+
role: "status",
|
|
1277
|
+
"aria-live": "polite",
|
|
1278
|
+
children: n.map((e) => /* @__PURE__ */ v("div", {
|
|
1279
|
+
className: "bailey-activity-line",
|
|
1280
|
+
children: [
|
|
1281
|
+
/* @__PURE__ */ _(st, {
|
|
1282
|
+
toolName: e.toolName,
|
|
1283
|
+
resolveActivityIcon: t
|
|
1284
|
+
}),
|
|
1285
|
+
/* @__PURE__ */ _("span", { children: e.label }),
|
|
1286
|
+
/* @__PURE__ */ _("span", {
|
|
1287
|
+
className: "bailey-step-spinner",
|
|
1288
|
+
"aria-hidden": "true"
|
|
1289
|
+
})
|
|
1290
|
+
]
|
|
1291
|
+
}, e.key))
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
function lt({ steps: e, labels: t, resolveActivityIcon: n }) {
|
|
1295
|
+
if (e.length === 0) return null;
|
|
1296
|
+
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;
|
|
1297
|
+
return /* @__PURE__ */ v("details", {
|
|
1298
|
+
className: "bailey-tool-steps-summary",
|
|
1299
|
+
children: [/* @__PURE__ */ _("summary", { children: a }), /* @__PURE__ */ _("ul", {
|
|
1300
|
+
className: "bailey-tool-steps-list",
|
|
1301
|
+
children: e.map((e) => /* @__PURE__ */ v("li", {
|
|
1302
|
+
className: "bailey-tool-step",
|
|
1303
|
+
children: [
|
|
1304
|
+
/* @__PURE__ */ _(st, {
|
|
1305
|
+
toolName: e.toolName,
|
|
1306
|
+
resolveActivityIcon: n
|
|
1307
|
+
}),
|
|
1308
|
+
/* @__PURE__ */ _("span", { children: e.label }),
|
|
1309
|
+
e.runtimeSeconds !== void 0 && /* @__PURE__ */ _("span", { children: `${e.runtimeSeconds.toFixed(1)}s` }),
|
|
1310
|
+
e.status === "failed" && /* @__PURE__ */ _("span", {
|
|
1311
|
+
className: "bailey-tool-step-failed",
|
|
1312
|
+
children: t.toolStepFailedText
|
|
1313
|
+
}),
|
|
1314
|
+
e.status === "running" && /* @__PURE__ */ _("span", { children: t.toolStepStoppedText })
|
|
1315
|
+
]
|
|
1316
|
+
}, e.key))
|
|
1317
|
+
})]
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
//#endregion
|
|
1178
1321
|
//#region src/ui/BaileyChatPanel.tsx
|
|
1179
|
-
var
|
|
1322
|
+
var ut = "How can bailey AI help you today?", dt = "Reply to bailey AI", ft = {
|
|
1180
1323
|
newChatButtonText: "New chat",
|
|
1181
1324
|
newChatAriaLabel: "new chat",
|
|
1182
1325
|
historyAriaLabel: "conversation history",
|
|
@@ -1193,249 +1336,262 @@ var Qe = "How can bailey AI help you today?", $e = "Reply to bailey AI", et = {
|
|
|
1193
1336
|
stopAriaLabel: "stop",
|
|
1194
1337
|
copyButtonAriaLabel: "copy response as markdown",
|
|
1195
1338
|
copyButtonTooltipDefault: "Copy as markdown",
|
|
1196
|
-
copyButtonTooltipCopied: "Copied!"
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1339
|
+
copyButtonTooltipCopied: "Copied!",
|
|
1340
|
+
toolStepsSummaryOne: "Used 1 tool",
|
|
1341
|
+
toolStepsSummaryMany: "Used {count} tools",
|
|
1342
|
+
toolStepsFailedSuffix: ", {failed} failed",
|
|
1343
|
+
toolStepFailedText: "failed",
|
|
1344
|
+
toolStepStoppedText: "stopped",
|
|
1345
|
+
mcpAppDefaultTitle: "MCP App"
|
|
1346
|
+
}, pt = [p], mt = {
|
|
1347
|
+
...Ne(),
|
|
1348
|
+
p: ({ children: e }) => /* @__PURE__ */ _(g, { children: e })
|
|
1349
|
+
}, ht = i(function({ content: e, components: t }) {
|
|
1350
|
+
return /* @__PURE__ */ _("div", {
|
|
1202
1351
|
className: "bailey-markdown-content",
|
|
1203
|
-
children: /* @__PURE__ */
|
|
1204
|
-
remarkPlugins:
|
|
1352
|
+
children: /* @__PURE__ */ _(f, {
|
|
1353
|
+
remarkPlugins: pt,
|
|
1205
1354
|
components: t,
|
|
1206
1355
|
skipHtml: !0,
|
|
1207
1356
|
children: e
|
|
1208
1357
|
})
|
|
1209
1358
|
});
|
|
1210
1359
|
});
|
|
1211
|
-
function
|
|
1360
|
+
function gt(e, t, n) {
|
|
1212
1361
|
if (e !== "streaming") return;
|
|
1213
1362
|
let r = t.filter((e) => e.turnSentAt === n?.sentAt);
|
|
1214
|
-
if (r.length !== 0) return
|
|
1363
|
+
if (r.length !== 0) return fe(r[r.length - 1]);
|
|
1215
1364
|
}
|
|
1216
|
-
function
|
|
1365
|
+
function _t(e) {
|
|
1217
1366
|
let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), r = t.toLocaleTimeString([], {
|
|
1218
1367
|
hour: "numeric",
|
|
1219
1368
|
minute: "2-digit"
|
|
1220
1369
|
});
|
|
1221
1370
|
return n ? `Today ${r}` : `${t.toLocaleDateString()} ${r}`;
|
|
1222
1371
|
}
|
|
1223
|
-
function
|
|
1224
|
-
let { messages:
|
|
1225
|
-
...
|
|
1226
|
-
...
|
|
1227
|
-
},
|
|
1228
|
-
renderTable:
|
|
1229
|
-
renderChart:
|
|
1230
|
-
}), [
|
|
1372
|
+
function vt({ chat: e, placeholder: t, replyPlaceholder: r = dt, emptyPlaceholder: i, suggestions: a, onHistoryClick: o, privacyNote: c, resolveActivityIcon: p, className: g, height: y, width: b, hideDeveloperDetails: x = !1, renderMessageActions: S, renderTable: C, renderChart: w, renderMcpApp: T, labels: E, formatMessageTime: D }) {
|
|
1373
|
+
let { messages: O, traceEvents: k, lastRequest: A, status: j, error: M, send: N, stop: ee, retryLast: P, clearTrace: F, clearError: I, newChat: L } = e, [R, z] = d(""), B = {
|
|
1374
|
+
...ft,
|
|
1375
|
+
...E
|
|
1376
|
+
}, V = D ?? _t, H = u(null), U = je(H), W = u(null), G = u(null), K = u(!0), te = l(() => Ne({
|
|
1377
|
+
renderTable: C,
|
|
1378
|
+
renderChart: w
|
|
1379
|
+
}), [C, w]), q = l(() => gt(j, k, A), [
|
|
1380
|
+
j,
|
|
1231
1381
|
k,
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
let e = H.current;
|
|
1382
|
+
A
|
|
1383
|
+
]), J = O.length === 0, Y = t ?? (J ? i ?? ut : r);
|
|
1384
|
+
s(() => {
|
|
1385
|
+
let e = G.current;
|
|
1237
1386
|
if (!e) return;
|
|
1238
1387
|
let t = () => {
|
|
1239
1388
|
let t = e.scrollHeight - e.scrollTop - e.clientHeight;
|
|
1240
|
-
|
|
1389
|
+
K.current = t < 60;
|
|
1241
1390
|
};
|
|
1242
1391
|
return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
|
|
1243
|
-
}, []),
|
|
1244
|
-
|
|
1245
|
-
behavior:
|
|
1392
|
+
}, []), s(() => {
|
|
1393
|
+
K.current && W.current?.scrollIntoView({
|
|
1394
|
+
behavior: j === "streaming" ? "auto" : "smooth",
|
|
1246
1395
|
block: "nearest"
|
|
1247
1396
|
});
|
|
1248
|
-
}, [
|
|
1249
|
-
let
|
|
1250
|
-
|
|
1397
|
+
}, [O, j]);
|
|
1398
|
+
let X = (e) => {
|
|
1399
|
+
K.current = !0, N(e);
|
|
1251
1400
|
};
|
|
1252
|
-
return /* @__PURE__ */
|
|
1253
|
-
value:
|
|
1254
|
-
children: /* @__PURE__ */
|
|
1255
|
-
ref:
|
|
1256
|
-
className: `bailey-chat-panel${
|
|
1257
|
-
style:
|
|
1258
|
-
height:
|
|
1259
|
-
width:
|
|
1401
|
+
return /* @__PURE__ */ _(Se.Provider, {
|
|
1402
|
+
value: U,
|
|
1403
|
+
children: /* @__PURE__ */ _("div", {
|
|
1404
|
+
ref: H,
|
|
1405
|
+
className: `bailey-chat-panel${g ? ` ${g}` : ""}`,
|
|
1406
|
+
style: y !== void 0 || b !== void 0 ? {
|
|
1407
|
+
height: y,
|
|
1408
|
+
width: b
|
|
1260
1409
|
} : void 0,
|
|
1261
|
-
children: /* @__PURE__ */
|
|
1410
|
+
children: /* @__PURE__ */ v("div", {
|
|
1262
1411
|
className: "bailey-chat-panel-inner",
|
|
1263
1412
|
children: [
|
|
1264
|
-
/* @__PURE__ */
|
|
1413
|
+
/* @__PURE__ */ v("div", {
|
|
1265
1414
|
className: "bailey-chat-transcript",
|
|
1266
|
-
ref:
|
|
1415
|
+
ref: G,
|
|
1267
1416
|
children: [
|
|
1268
|
-
|
|
1417
|
+
J && (a && a.length > 0 ? /* @__PURE__ */ v("div", {
|
|
1269
1418
|
className: "bailey-suggestions",
|
|
1270
|
-
children: [/* @__PURE__ */
|
|
1419
|
+
children: [/* @__PURE__ */ _("div", {
|
|
1271
1420
|
className: "bailey-suggestions-title",
|
|
1272
|
-
children:
|
|
1273
|
-
}),
|
|
1421
|
+
children: B.suggestionsTitle
|
|
1422
|
+
}), a.map((e, t) => /* @__PURE__ */ v("button", {
|
|
1274
1423
|
type: "button",
|
|
1275
|
-
onClick: () =>
|
|
1424
|
+
onClick: () => X(e.value ?? e.label),
|
|
1276
1425
|
className: "bailey-suggestion-card",
|
|
1277
|
-
children: [/* @__PURE__ */
|
|
1426
|
+
children: [/* @__PURE__ */ _("span", { children: e.label }), /* @__PURE__ */ _(Ie, { className: "bailey-suggestion-icon" })]
|
|
1278
1427
|
}, `${e.label}-${t}`))]
|
|
1279
|
-
}) : /* @__PURE__ */
|
|
1428
|
+
}) : /* @__PURE__ */ _("div", {
|
|
1280
1429
|
className: "bailey-empty-state",
|
|
1281
|
-
children:
|
|
1430
|
+
children: B.emptyStateMessage
|
|
1282
1431
|
})),
|
|
1283
|
-
|
|
1284
|
-
let
|
|
1285
|
-
return /* @__PURE__ */
|
|
1432
|
+
O.map((e, t) => {
|
|
1433
|
+
let r = e.role === "assistant" && t === O.length - 1, i = j === "streaming" && r && e.content === "", a = e.role === "assistant" ? be(k, e.createdAt) : [], o = a.some((e) => e.status === "running");
|
|
1434
|
+
return /* @__PURE__ */ _("div", {
|
|
1286
1435
|
className: e.role === "user" ? "bailey-message-row bailey-message-row-user" : "bailey-message-row",
|
|
1287
|
-
children: e.role === "user" ? /* @__PURE__ */
|
|
1436
|
+
children: e.role === "user" ? /* @__PURE__ */ v("div", {
|
|
1288
1437
|
className: "bailey-user-message",
|
|
1289
|
-
children: [/* @__PURE__ */
|
|
1438
|
+
children: [/* @__PURE__ */ v("div", {
|
|
1290
1439
|
className: "bailey-message-meta",
|
|
1291
|
-
children: [/* @__PURE__ */
|
|
1440
|
+
children: [/* @__PURE__ */ _("span", {
|
|
1292
1441
|
className: "bailey-message-meta-name",
|
|
1293
|
-
children:
|
|
1294
|
-
}), e.createdAt !== void 0 && /* @__PURE__ */
|
|
1295
|
-
}), /* @__PURE__ */
|
|
1442
|
+
children: B.youLabel
|
|
1443
|
+
}), e.createdAt !== void 0 && /* @__PURE__ */ _("span", { children: V(e.createdAt) })]
|
|
1444
|
+
}), /* @__PURE__ */ _("div", {
|
|
1296
1445
|
className: "bailey-user-bubble",
|
|
1297
1446
|
children: e.content
|
|
1298
1447
|
})]
|
|
1299
|
-
}) :
|
|
1300
|
-
|
|
1301
|
-
|
|
1448
|
+
}) : i ? o ? /* @__PURE__ */ _(ct, {
|
|
1449
|
+
steps: a,
|
|
1450
|
+
resolveActivityIcon: p
|
|
1302
1451
|
}) : /* @__PURE__ */ _("div", {
|
|
1452
|
+
className: "bailey-thinking-hint",
|
|
1453
|
+
children: q ?? B.thinkingHint
|
|
1454
|
+
}) : /* @__PURE__ */ v("div", {
|
|
1303
1455
|
className: "bailey-assistant-message",
|
|
1304
1456
|
children: [
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1457
|
+
e.streaming ? /* @__PURE__ */ _(ct, {
|
|
1458
|
+
steps: a,
|
|
1459
|
+
resolveActivityIcon: p
|
|
1460
|
+
}) : /* @__PURE__ */ _(lt, {
|
|
1461
|
+
steps: a,
|
|
1462
|
+
labels: B,
|
|
1463
|
+
resolveActivityIcon: p
|
|
1311
1464
|
}),
|
|
1312
|
-
/* @__PURE__ */
|
|
1465
|
+
/* @__PURE__ */ _(ht, {
|
|
1313
1466
|
content: e.content,
|
|
1314
|
-
components:
|
|
1467
|
+
components: te
|
|
1315
1468
|
}),
|
|
1316
|
-
e.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */
|
|
1469
|
+
e.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ _($e, {
|
|
1317
1470
|
src: e.src,
|
|
1318
1471
|
alt: e.alt
|
|
1319
|
-
}, t) :
|
|
1320
|
-
|
|
1472
|
+
}, t) : e.type === "mcp_app" ? /* @__PURE__ */ _(n, { children: T ? T(e) : /* @__PURE__ */ _(ot, {
|
|
1473
|
+
...e,
|
|
1474
|
+
title: e.title ?? B.mcpAppDefaultTitle
|
|
1475
|
+
}) }, t) : null),
|
|
1476
|
+
e.streaming && q && !o && /* @__PURE__ */ _("div", {
|
|
1321
1477
|
className: "bailey-streaming-hint",
|
|
1322
|
-
children:
|
|
1478
|
+
children: q
|
|
1323
1479
|
}),
|
|
1324
|
-
!e.streaming && /* @__PURE__ */
|
|
1480
|
+
!e.streaming && /* @__PURE__ */ v("div", {
|
|
1325
1481
|
className: "bailey-message-actions",
|
|
1326
|
-
children: [/* @__PURE__ */
|
|
1482
|
+
children: [/* @__PURE__ */ _(We, {
|
|
1327
1483
|
markdown: e.content,
|
|
1328
|
-
ariaLabel:
|
|
1329
|
-
tooltipDefaultText:
|
|
1330
|
-
tooltipCopiedText:
|
|
1331
|
-
}),
|
|
1484
|
+
ariaLabel: B.copyButtonAriaLabel,
|
|
1485
|
+
tooltipDefaultText: B.copyButtonTooltipDefault,
|
|
1486
|
+
tooltipCopiedText: B.copyButtonTooltipCopied
|
|
1487
|
+
}), S?.(e)]
|
|
1332
1488
|
})
|
|
1333
1489
|
]
|
|
1334
1490
|
})
|
|
1335
1491
|
}, e.id);
|
|
1336
1492
|
}),
|
|
1337
|
-
/* @__PURE__ */
|
|
1493
|
+
/* @__PURE__ */ _("div", { ref: W })
|
|
1338
1494
|
]
|
|
1339
1495
|
}),
|
|
1340
|
-
|
|
1496
|
+
M && /* @__PURE__ */ v("div", {
|
|
1341
1497
|
className: "bailey-error-banner",
|
|
1342
1498
|
role: "alert",
|
|
1343
|
-
children: [/* @__PURE__ */
|
|
1499
|
+
children: [/* @__PURE__ */ _("span", { children: M }), /* @__PURE__ */ v("div", {
|
|
1344
1500
|
className: "bailey-error-actions",
|
|
1345
|
-
children: [/* @__PURE__ */
|
|
1501
|
+
children: [/* @__PURE__ */ _("button", {
|
|
1346
1502
|
type: "button",
|
|
1347
|
-
onClick:
|
|
1503
|
+
onClick: P,
|
|
1348
1504
|
className: "bailey-retry-button",
|
|
1349
|
-
children:
|
|
1350
|
-
}), /* @__PURE__ */
|
|
1505
|
+
children: B.retryButtonText
|
|
1506
|
+
}), /* @__PURE__ */ _("button", {
|
|
1351
1507
|
type: "button",
|
|
1352
|
-
onClick:
|
|
1353
|
-
"aria-label":
|
|
1508
|
+
onClick: I,
|
|
1509
|
+
"aria-label": B.dismissErrorAriaLabel,
|
|
1354
1510
|
className: "bailey-dismiss-button",
|
|
1355
1511
|
children: "✕"
|
|
1356
1512
|
})]
|
|
1357
1513
|
})]
|
|
1358
1514
|
}),
|
|
1359
|
-
!
|
|
1360
|
-
events:
|
|
1361
|
-
lastRequest:
|
|
1362
|
-
onClear:
|
|
1515
|
+
!x && /* @__PURE__ */ _(Qe, {
|
|
1516
|
+
events: k,
|
|
1517
|
+
lastRequest: A,
|
|
1518
|
+
onClear: F
|
|
1363
1519
|
}),
|
|
1364
|
-
/* @__PURE__ */
|
|
1520
|
+
/* @__PURE__ */ v("div", {
|
|
1365
1521
|
className: "bailey-input-area",
|
|
1366
|
-
children: [/* @__PURE__ */
|
|
1522
|
+
children: [/* @__PURE__ */ v("form", {
|
|
1367
1523
|
onSubmit: (e) => {
|
|
1368
|
-
e.preventDefault(), !(!
|
|
1524
|
+
e.preventDefault(), !(!R.trim() || j === "streaming") && (X(R), z(""));
|
|
1369
1525
|
},
|
|
1370
1526
|
className: "bailey-input-row",
|
|
1371
|
-
children: [/* @__PURE__ */
|
|
1527
|
+
children: [/* @__PURE__ */ _("input", {
|
|
1372
1528
|
type: "text",
|
|
1373
|
-
placeholder:
|
|
1374
|
-
"aria-label":
|
|
1375
|
-
value:
|
|
1376
|
-
onChange: (e) =>
|
|
1377
|
-
disabled:
|
|
1529
|
+
placeholder: Y,
|
|
1530
|
+
"aria-label": Y,
|
|
1531
|
+
value: R,
|
|
1532
|
+
onChange: (e) => z(e.target.value),
|
|
1533
|
+
disabled: j === "streaming",
|
|
1378
1534
|
className: "bailey-input"
|
|
1379
|
-
}),
|
|
1535
|
+
}), j === "streaming" ? /* @__PURE__ */ _(h.Provider, {
|
|
1380
1536
|
delayDuration: 200,
|
|
1381
|
-
children: /* @__PURE__ */
|
|
1537
|
+
children: /* @__PURE__ */ v(h.Root, { children: [/* @__PURE__ */ _(h.Trigger, {
|
|
1382
1538
|
asChild: !0,
|
|
1383
|
-
children: /* @__PURE__ */
|
|
1539
|
+
children: /* @__PURE__ */ _("button", {
|
|
1384
1540
|
type: "button",
|
|
1385
|
-
onClick:
|
|
1386
|
-
"aria-label":
|
|
1541
|
+
onClick: ee,
|
|
1542
|
+
"aria-label": B.stopAriaLabel,
|
|
1387
1543
|
className: "bailey-stop-button",
|
|
1388
|
-
children: /* @__PURE__ */
|
|
1544
|
+
children: /* @__PURE__ */ _(Fe, { className: "bailey-stop-icon" })
|
|
1389
1545
|
})
|
|
1390
|
-
}), /* @__PURE__ */
|
|
1391
|
-
container:
|
|
1392
|
-
children: /* @__PURE__ */
|
|
1546
|
+
}), /* @__PURE__ */ _(h.Portal, {
|
|
1547
|
+
container: U instanceof ShadowRoot ? U : void 0,
|
|
1548
|
+
children: /* @__PURE__ */ v(h.Content, {
|
|
1393
1549
|
side: "top",
|
|
1394
1550
|
className: "bailey-tooltip-content",
|
|
1395
|
-
children: [
|
|
1551
|
+
children: [B.stopButtonText, /* @__PURE__ */ _(h.Arrow, { className: "bailey-tooltip-arrow" })]
|
|
1396
1552
|
})
|
|
1397
1553
|
})] })
|
|
1398
|
-
}) : /* @__PURE__ */
|
|
1554
|
+
}) : /* @__PURE__ */ _("button", {
|
|
1399
1555
|
type: "submit",
|
|
1400
|
-
"aria-label":
|
|
1401
|
-
disabled: !
|
|
1556
|
+
"aria-label": B.sendAriaLabel,
|
|
1557
|
+
disabled: !R.trim(),
|
|
1402
1558
|
className: "bailey-send-button",
|
|
1403
|
-
children: /* @__PURE__ */
|
|
1559
|
+
children: /* @__PURE__ */ _(Pe, { className: "bailey-send-icon" })
|
|
1404
1560
|
})]
|
|
1405
|
-
}), (!
|
|
1561
|
+
}), (!J || o) && /* @__PURE__ */ v(m.Root, { children: [/* @__PURE__ */ _(m.Trigger, {
|
|
1406
1562
|
asChild: !0,
|
|
1407
|
-
children: /* @__PURE__ */
|
|
1563
|
+
children: /* @__PURE__ */ _("button", {
|
|
1408
1564
|
type: "button",
|
|
1409
|
-
"aria-label":
|
|
1565
|
+
"aria-label": B.menuAriaLabel,
|
|
1410
1566
|
className: "bailey-menu-button",
|
|
1411
|
-
children: /* @__PURE__ */
|
|
1567
|
+
children: /* @__PURE__ */ _(Ve, { className: "bailey-menu-icon" })
|
|
1412
1568
|
})
|
|
1413
|
-
}), /* @__PURE__ */
|
|
1414
|
-
container:
|
|
1415
|
-
children: /* @__PURE__ */
|
|
1569
|
+
}), /* @__PURE__ */ _(m.Portal, {
|
|
1570
|
+
container: U instanceof ShadowRoot ? U : void 0,
|
|
1571
|
+
children: /* @__PURE__ */ v(m.Content, {
|
|
1416
1572
|
side: "top",
|
|
1417
1573
|
align: "end",
|
|
1418
1574
|
sideOffset: 8,
|
|
1419
1575
|
className: "bailey-menu-content",
|
|
1420
|
-
children: [!
|
|
1421
|
-
onSelect: () =>
|
|
1576
|
+
children: [!J && /* @__PURE__ */ v(m.Item, {
|
|
1577
|
+
onSelect: () => L(),
|
|
1422
1578
|
className: "bailey-menu-item",
|
|
1423
|
-
children: [/* @__PURE__ */
|
|
1424
|
-
}),
|
|
1425
|
-
onSelect: () =>
|
|
1579
|
+
children: [/* @__PURE__ */ _(He, { className: "bailey-menu-item-icon" }), B.newChatButtonText]
|
|
1580
|
+
}), o && /* @__PURE__ */ v(m.Item, {
|
|
1581
|
+
onSelect: () => o(),
|
|
1426
1582
|
className: "bailey-menu-item",
|
|
1427
|
-
children: [/* @__PURE__ */
|
|
1583
|
+
children: [/* @__PURE__ */ _(ze, { className: "bailey-menu-item-icon" }), B.historyMenuItemText]
|
|
1428
1584
|
})]
|
|
1429
1585
|
})
|
|
1430
1586
|
})] })]
|
|
1431
1587
|
}),
|
|
1432
|
-
(
|
|
1588
|
+
(J || c?.alwaysVisible) && c && /* @__PURE__ */ _("div", {
|
|
1433
1589
|
className: "bailey-privacy-note",
|
|
1434
|
-
children: /* @__PURE__ */
|
|
1435
|
-
remarkPlugins:
|
|
1436
|
-
components:
|
|
1590
|
+
children: /* @__PURE__ */ _(f, {
|
|
1591
|
+
remarkPlugins: pt,
|
|
1592
|
+
components: mt,
|
|
1437
1593
|
skipHtml: !0,
|
|
1438
|
-
children:
|
|
1594
|
+
children: c.markdown
|
|
1439
1595
|
})
|
|
1440
1596
|
})
|
|
1441
1597
|
]
|
|
@@ -1445,6 +1601,6 @@ function ot({ chat: e, placeholder: t, replyPlaceholder: n = $e, emptyPlaceholde
|
|
|
1445
1601
|
}
|
|
1446
1602
|
//#endregion
|
|
1447
1603
|
//#region src/index.ts
|
|
1448
|
-
var
|
|
1604
|
+
var yt = "0.3.1-pre.2";
|
|
1449
1605
|
//#endregion
|
|
1450
|
-
export {
|
|
1606
|
+
export { Be as ActivityIcon, Ie as ArrowUpRightIcon, yt as BAILEYAI_CHAT_UI_VERSION, te as BAILEY_CHART_PROMPT_FRAGMENT, z as BAILEY_TABLE_GRID_ROW_THRESHOLD, vt as BaileyChatPanel, Qe as BaileyTracePanel, We as CopyMarkdownButton, Pe as HeartIcon, ae as TRACE_KIND_LABEL, Ne as createBaileyMarkdownComponents, O as extractPseudoToolCalls, G as extractTableData, me as formatTraceGap, pe as formatTraceTime, ve as hasTraceFailure, e as isSafeMarkdownUrl, F as joinInstructions, ie as parseBaileyChartSpec, A as parseSseFrames, R as resolveToolCall, K as shouldUseGrid, ye as toActivityLines, be as toToolSteps, he as toTraceRows, _e as toTraceSegments, ce as traceEventArgsDetail, fe as traceEventHint, le as traceEventOutputDetail, de as traceEventRawDetail, se as traceEventSummary, oe as traceEventToolName, ge as traceSummaryLine, P as useBaileyChat };
|