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