@object-ui/plugin-chatbot 13.2.0 → 14.1.0

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/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as e from "react";
2
2
  import { Children as t, Fragment as n, createContext as r, isValidElement as i, memo as a, useCallback as o, useContext as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
3
- import { Alert as f, AlertDescription as p, Avatar as m, AvatarFallback as h, AvatarImage as g, Badge as _, Button as v, Card as y, CardContent as b, CardDescription as x, CardHeader as S, CardTitle as C, Collapsible as w, CollapsibleContent as T, CollapsibleTrigger as E, Command as D, CommandEmpty as O, CommandGroup as k, CommandInput as A, CommandItem as j, CommandList as M, CommandSeparator as N, DropdownMenu as P, DropdownMenuContent as F, DropdownMenuItem as I, DropdownMenuTrigger as L, Empty as ee, EmptyDescription as te, EmptyHeader as R, EmptyMedia as ne, EmptyTitle as re, HoverCard as z, HoverCardContent as ie, HoverCardTrigger as B, Input as ae, Label as V, ScrollArea as oe, ScrollBar as se, Select as ce, SelectContent as le, SelectItem as ue, SelectTrigger as de, SelectValue as fe, Separator as pe, Sheet as me, SheetContent as he, SheetDescription as ge, SheetHeader as _e, SheetTitle as ve, Skeleton as ye, Table as be, TableBody as xe, TableCell as H, TableHead as U, TableHeader as W, TableRow as Se, Tabs as Ce, TabsList as we, TabsTrigger as G, Textarea as K, Tooltip as Te, TooltipContent as Ee, TooltipProvider as De, TooltipTrigger as Oe, cn as q } from "@object-ui/components";
4
- import { AlertCircle as ke, ArrowDownIcon as J, ArrowRight as Ae, BookIcon as je, Bot as Me, BrainIcon as Ne, Check as Pe, CheckCircle2 as Y, CheckCircleIcon as Fe, CheckIcon as Ie, ChevronDownIcon as Le, ChevronLeftIcon as Re, ChevronRightIcon as ze, CircleIcon as Be, ClipboardList as Ve, Clock as He, Clock3 as Ue, ClockIcon as We, Copy as Ge, CopyIcon as Ke, CornerDownLeft as qe, CornerDownLeftIcon as Je, Eye as Ye, GitCompareArrows as Xe, HelpCircle as Ze, Hourglass as Qe, ImageIcon as $e, Inbox as et, Loader2 as tt, Loader2Icon as nt, Maximize2 as rt, MicIcon as it, Minimize2 as at, PaperclipIcon as ot, PlusIcon as st, RefreshCw as ct, Rocket as lt, Send as ut, ShieldCheck as dt, Sparkles as ft, SquareIcon as pt, Table2 as mt, TriangleAlert as ht, WifiOff as gt, WrenchIcon as _t, X as vt, XCircle as X, XCircleIcon as yt, XIcon as bt } from "lucide-react";
3
+ import { Alert as f, AlertDescription as p, Avatar as m, AvatarFallback as h, AvatarImage as g, Badge as _, Button as v, Card as y, CardContent as b, CardDescription as x, CardHeader as S, CardTitle as C, Collapsible as w, CollapsibleContent as T, CollapsibleTrigger as E, Command as D, CommandEmpty as O, CommandGroup as k, CommandInput as A, CommandItem as j, CommandList as M, CommandSeparator as N, DropdownMenu as ee, DropdownMenuContent as P, DropdownMenuItem as F, DropdownMenuTrigger as I, Empty as te, EmptyDescription as ne, EmptyHeader as L, EmptyMedia as re, EmptyTitle as ie, HoverCard as R, HoverCardContent as ae, HoverCardTrigger as oe, Input as z, Label as B, ScrollArea as se, ScrollBar as ce, Select as le, SelectContent as ue, SelectItem as de, SelectTrigger as fe, SelectValue as pe, Separator as me, Sheet as he, SheetContent as ge, SheetDescription as _e, SheetHeader as ve, SheetTitle as ye, Skeleton as be, Table as xe, TableBody as Se, TableCell as V, TableHead as H, TableHeader as Ce, TableRow as we, Tabs as U, TabsList as Te, TabsTrigger as W, Textarea as Ee, Tooltip as De, TooltipContent as Oe, TooltipProvider as G, TooltipTrigger as K, cn as q } from "@object-ui/components";
4
+ import { AlertCircle as ke, ArrowDownIcon as Ae, ArrowRight as je, BookIcon as Me, Bot as Ne, BrainIcon as Pe, Check as Fe, CheckCircle2 as J, CheckCircleIcon as Y, CheckIcon as Ie, ChevronDownIcon as Le, ChevronLeftIcon as Re, ChevronRightIcon as ze, CircleIcon as Be, ClipboardList as Ve, Clock as He, Clock3 as Ue, ClockIcon as We, Copy as Ge, CopyIcon as Ke, CornerDownLeft as qe, CornerDownLeftIcon as Je, Eye as Ye, GitCompareArrows as Xe, HelpCircle as Ze, Hourglass as Qe, ImageIcon as $e, Inbox as et, Loader2 as tt, Loader2Icon as nt, Maximize2 as rt, MicIcon as it, Minimize2 as at, PaperclipIcon as ot, PlusIcon as st, RefreshCw as ct, Rocket as lt, Send as ut, ShieldCheck as dt, Sparkles as ft, SquareIcon as pt, Table2 as mt, TriangleAlert as ht, WifiOff as gt, WrenchIcon as _t, X as vt, XCircle as X, XCircleIcon as yt, XIcon as bt } from "lucide-react";
5
5
  import { Fragment as Z, jsx as Q, jsxs as $ } from "react/jsx-runtime";
6
6
  import { useChat as xt } from "@ai-sdk/react";
7
7
  import { DefaultChatTransport as St } from "ai";
@@ -111,6 +111,17 @@ function Wt(e) {
111
111
  };
112
112
  }
113
113
  function Gt(e) {
114
+ let t = Vt(e);
115
+ if (!t || t.status !== "build_handoff") return;
116
+ let n = typeof t.prompt == "string" ? t.prompt.trim() : "";
117
+ if (!n) return;
118
+ let r = t.packageId, i = typeof r == "string" && r.trim().length > 0 ? r.trim() : void 0;
119
+ return {
120
+ prompt: n,
121
+ ...i ? { packageId: i } : {}
122
+ };
123
+ }
124
+ function Kt(e) {
114
125
  let t = Vt(e);
115
126
  if (!t || t.status !== "changes_proposed") return;
116
127
  let n = (e) => typeof e == "string" && e ? e : void 0, r = t.changes, i = (Array.isArray(r) ? r : []).flatMap((e) => {
@@ -129,7 +140,7 @@ function Gt(e) {
129
140
  changes: i
130
141
  };
131
142
  }
132
- function Kt(e) {
143
+ function qt(e) {
133
144
  let t = Vt(e);
134
145
  if (!t || t.status !== "drafted") return;
135
146
  let n = [];
@@ -170,38 +181,39 @@ function Kt(e) {
170
181
  ...s.length ? { issues: s } : {}
171
182
  };
172
183
  }
173
- function qt(e) {
184
+ function Jt(e) {
174
185
  return e.replace(/[._-]+/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (e) => e.toUpperCase());
175
186
  }
176
- function Jt(e) {
187
+ function Yt(e) {
177
188
  if (!e || !Array.isArray(e.items) || e.items.length === 0) return;
178
189
  let t = e.items.find((e) => e.type === "app");
179
190
  if (t) return {
180
191
  phase: "done",
181
- appLabel: qt(t.name),
192
+ appLabel: Jt(t.name),
182
193
  items: e.items,
183
194
  done: e.items.length,
184
195
  total: e.items.length
185
196
  };
186
197
  }
187
- function Yt(e, t = {}) {
188
- return e.filter((e) => e.type === "dynamic-tool" ? !0 : typeof e.type == "string" && e.type.startsWith("tool-")).map((e) => {
189
- let n = e.type === "dynamic-tool" ? e.toolName ?? "tool" : typeof e.type == "string" ? e.type.replace(/^tool-/, "") : "tool", r = e.output ?? e.result, i = Ht(r), a = Kt(r), o = Wt(r), s = Gt(r), c = e.state, l = (c === "input-available" || c === "input-streaming") && (r !== void 0 || !t.liveTail) ? "output-available" : c, u = i && l !== "output-error" ? "approval-requested" : l;
198
+ function Xt(e, t = {}) {
199
+ return e.filter((e) => e.type === "dynamic-tool" || typeof e.type == "string" && e.type.startsWith("tool-")).map((e) => {
200
+ let n = e.type === "dynamic-tool" ? e.toolName ?? "tool" : typeof e.type == "string" ? e.type.replace(/^tool-/, "") : "tool", r = e.output ?? e.result, i = Ht(r), a = qt(r), o = Wt(r), s = Kt(r), c = Gt(r), l = e.state, u = (l === "input-available" || l === "input-streaming") && (r !== void 0 || !t.liveTail) ? "output-available" : l, d = i && u !== "output-error" ? "approval-requested" : u;
190
201
  return {
191
202
  toolCallId: e.toolCallId ?? e.id ?? `${e.type ?? "tool"}-${Math.random().toString(36).slice(2, 8)}`,
192
203
  toolName: n,
193
204
  args: e.input ?? e.args,
194
205
  result: r,
195
206
  errorText: e.errorText,
196
- state: u,
207
+ state: d,
197
208
  pendingActionId: i?.pendingActionId,
198
209
  draftReview: a,
199
210
  proposedPlan: o,
200
- proposedChanges: s
211
+ proposedChanges: s,
212
+ builderHandoff: c
201
213
  };
202
214
  });
203
215
  }
204
- function Xt(e) {
216
+ function Zt(e) {
205
217
  let t = e.filter((e) => e.type === "source-url" || e.type === "source").map((e) => ({
206
218
  id: e.id,
207
219
  title: e.title,
@@ -209,7 +221,7 @@ function Xt(e) {
209
221
  })).filter((e) => !!e.url);
210
222
  return t.length > 0 ? t : void 0;
211
223
  }
212
- function Zt(e) {
224
+ function Qt(e) {
213
225
  let t = e.filter((e) => e.type === "data-build-progress").pop()?.data;
214
226
  if (!t || typeof t != "object") return;
215
227
  let n = t, r = Array.isArray(n.items) ? n.items.filter((e) => typeof e?.type == "string" && typeof e?.name == "string").map((e) => ({
@@ -225,7 +237,7 @@ function Zt(e) {
225
237
  ...typeof n.seq == "number" ? { seq: n.seq } : {}
226
238
  };
227
239
  }
228
- function Qt(e) {
240
+ function $t(e) {
229
241
  let t = e.filter((e) => e.type === "data-blueprint-progress").pop()?.data;
230
242
  if (!t || typeof t != "object") return;
231
243
  let n = t, r = Array.isArray(n.objects) ? n.objects.filter((e) => typeof e?.name == "string").map((e) => ({
@@ -247,7 +259,7 @@ function Qt(e) {
247
259
  ...typeof n.seq == "number" ? { seq: n.seq } : {}
248
260
  };
249
261
  }
250
- function $t(e) {
262
+ function en(e) {
251
263
  let t = [];
252
264
  for (let n of e) {
253
265
  if (n.type !== "data-chart") continue;
@@ -267,29 +279,35 @@ function $t(e) {
267
279
  }
268
280
  return t.length > 0 ? t : void 0;
269
281
  }
270
- function en(e, t = {}) {
271
- let n = Array.isArray(e.parts) ? e.parts : [], r = Yt(n, { liveTail: t.streaming }), i = Array.isArray(e.toolInvocations) ? e.toolInvocations : [], a = r.length > 0 ? r : i, o = Zt(n) ?? a.map((e) => Jt(e.draftReview)).find((e) => !!e);
282
+ function tn(e, t = {}) {
283
+ let n = Array.isArray(e.parts) ? e.parts : [], r = Xt(n, { liveTail: t.streaming }), i = Array.isArray(e.toolInvocations) ? e.toolInvocations : [], a = r.length > 0 ? r : i, o = Qt(n) ?? a.map((e) => Yt(e.draftReview)).find((e) => !!e);
272
284
  return {
273
285
  id: e.id ?? `msg-${Math.random().toString(36).slice(2, 8)}`,
274
286
  role: e.role ?? "assistant",
275
287
  content: zt(e, n),
276
288
  reasoning: Bt(n),
277
289
  toolInvocations: a,
278
- sources: Xt(n),
290
+ sources: Zt(n),
279
291
  buildProgress: o,
280
- blueprintProgress: Qt(n),
281
- charts: $t(n),
292
+ blueprintProgress: $t(n),
293
+ charts: en(n),
282
294
  streaming: t.streaming
283
295
  };
284
296
  }
285
- function tn(e, t = {}) {
297
+ function nn(e, t = {}) {
286
298
  if (!Array.isArray(e) || e.length === 0) return [];
287
299
  let n = e.length - 1;
288
- return e.map((e, r) => en(e, { streaming: !!t.isStreaming && r === n && e.role === "assistant" }));
300
+ return e.map((e, r) => tn(e, { streaming: !!t.isStreaming && r === n && e.role === "assistant" }));
289
301
  }
290
302
  //#endregion
291
303
  //#region src/useObjectChat.ts
292
- async function nn(e, t) {
304
+ var rn = "objectui:ai-usage-refresh";
305
+ function an() {
306
+ if (!(typeof window > "u" || typeof window.dispatchEvent != "function")) try {
307
+ window.dispatchEvent(new CustomEvent(rn));
308
+ } catch {}
309
+ }
310
+ async function on(e, t) {
293
311
  let n;
294
312
  try {
295
313
  n = await fetch(e, t);
@@ -307,7 +325,7 @@ async function nn(e, t) {
307
325
  }
308
326
  return n;
309
327
  }
310
- function rn(e) {
328
+ function sn(e) {
311
329
  let t = [...e.messages].reverse().find((e) => e.role === "user");
312
330
  return { body: {
313
331
  ...e.body ?? {},
@@ -318,7 +336,17 @@ function rn(e) {
318
336
  ...t ? { turnId: t.id } : {}
319
337
  } };
320
338
  }
321
- function an(e) {
339
+ function cn(e, t) {
340
+ let n = e.context ?? {};
341
+ return {
342
+ ...e,
343
+ context: {
344
+ ...n,
345
+ parentConversationId: t
346
+ }
347
+ };
348
+ }
349
+ function ln(e) {
322
350
  return (e ?? []).map((e, t) => ({
323
351
  id: e.id || `msg-${t}`,
324
352
  role: e.role || "user",
@@ -329,14 +357,14 @@ function an(e) {
329
357
  toolInvocations: e.toolInvocations
330
358
  }));
331
359
  }
332
- function on(e = {}) {
333
- let { api: t, initialMessages: n, conversationId: r, systemPrompt: i, model: a, streamingEnabled: s = !0, headers: f, body: p, maxToolRoundtrips: m = 5, onError: h, showTimestamp: g, autoResponse: _, autoResponseText: v, autoResponseDelay: y = 1e3, onSend: b } = e, x = u(t ? "api" : "local").current === "api", S = l(() => (n ?? []).map((e, t) => {
360
+ function un(e = {}) {
361
+ let { api: t, initialMessages: n, conversationId: r, parentConversationId: i, systemPrompt: a, model: s, streamingEnabled: f = !0, headers: p, body: m, maxToolRoundtrips: h = 5, onError: g, showTimestamp: _, autoResponse: v, autoResponseText: y, autoResponseDelay: b = 1e3, onSend: x } = e, S = u(t ? "api" : "local").current === "api", C = l(() => (n ?? []).map((e, t) => {
334
362
  if (Array.isArray(e.parts) && e.parts.length > 0) return {
335
363
  id: e.id || `msg-${t}`,
336
364
  role: e.role || "user",
337
365
  parts: e.parts
338
366
  };
339
- let n = an([e])[0], r = [];
367
+ let n = ln([e])[0], r = [];
340
368
  n.content && r.push({
341
369
  type: "text",
342
370
  text: n.content
@@ -361,57 +389,67 @@ function on(e = {}) {
361
389
  text: ""
362
390
  }]
363
391
  };
364
- }), []), C = u(a);
365
- C.current = a;
366
- let w = l(() => {
367
- if (x) return new St({
392
+ }), []), w = u(s);
393
+ w.current = s;
394
+ let T = u(i), E = u(i);
395
+ c(() => {
396
+ let e = E.current;
397
+ E.current = i, i && !e && (T.current = i);
398
+ }, [i]);
399
+ let D = l(() => {
400
+ if (S) return new St({
368
401
  api: t,
369
- fetch: nn,
370
- headers: { ...f },
402
+ fetch: on,
403
+ headers: { ...p },
371
404
  body: {
372
- ...p,
405
+ ...m,
373
406
  ...r ? { conversationId: r } : {},
374
- ...a ? { model: a } : {},
375
- ...i ? { systemPrompt: i } : {},
376
- ...s === void 0 ? {} : { stream: s }
407
+ ...s ? { model: s } : {},
408
+ ...a ? { systemPrompt: a } : {},
409
+ ...f === void 0 ? {} : { stream: f }
377
410
  },
378
411
  prepareSendMessagesRequest: ({ id: e, body: t, messages: n, trigger: r, messageId: i }) => {
379
- let a = rn({
412
+ let a = sn({
380
413
  id: e,
381
414
  body: t,
382
415
  messages: n,
383
416
  trigger: r,
384
417
  messageId: i
385
418
  });
386
- return C.current && (a.body.model = C.current), a;
419
+ return w.current && (a.body.model = w.current), T.current &&= (a.body = cn(a.body, T.current), void 0), a;
387
420
  }
388
421
  });
389
422
  }, [
390
- x,
423
+ S,
391
424
  t,
392
- f,
393
425
  p,
394
- a,
395
- i,
426
+ m,
396
427
  s,
428
+ a,
429
+ f,
397
430
  r
398
- ]), T = u(null), E = xt({
399
- transport: w,
400
- messages: x && S.length > 0 ? S : void 0,
401
- onError: x ? (e) => {
431
+ ]), O = u(null), k = xt({
432
+ transport: D,
433
+ messages: S && C.length > 0 ? C : void 0,
434
+ onError: S ? (e) => {
402
435
  if (e.notSent) {
403
- let e = T.current, t = e?.messages;
404
- e?.setMessages && t && t.length > 0 && t[t.length - 1]?.role === "user" && e.setMessages(t.slice(0, -1));
436
+ let e = O.current, t = e?.messages;
437
+ e?.setMessages && t && t.length > 0 && t[t.length - 1]?.role === "user" && e.setMessages(t.slice(0, -1)), an();
405
438
  }
406
- h?.(e);
439
+ g?.(e);
407
440
  } : void 0
408
441
  });
409
- T.current = E;
410
- let [D, O] = d(() => an(n)), [k, A] = d(!1), [j, M] = d(""), [N, P] = d(""), F = u(null);
442
+ O.current = k;
443
+ let A = u(void 0), j = k?.status;
444
+ c(() => {
445
+ let e = A.current;
446
+ A.current = j, (e === "streaming" || e === "submitted") && j === "ready" && an();
447
+ }, [j]);
448
+ let [M, N] = d(() => ln(n)), [ee, P] = d(!1), [F, I] = d(""), [te, ne] = d(""), L = u(null);
411
449
  if (c(() => () => {
412
- F.current &&= (clearTimeout(F.current), null);
413
- }, []), x) {
414
- let { messages: e, status: t, error: n, sendMessage: r, regenerate: i, stop: a, setMessages: s } = E, c = t === "submitted" || t === "streaming", l = tn(e, { isStreaming: c }).map((t, n) => ({
450
+ L.current &&= (clearTimeout(L.current), null);
451
+ }, []), S) {
452
+ let { messages: e, status: t, error: n, sendMessage: r, regenerate: i, stop: a, setMessages: s } = k, c = t === "submitted" || t === "streaming", l = nn(e, { isStreaming: c }).map((t, n) => ({
415
453
  ...t,
416
454
  metadata: e[n]?.metadata
417
455
  }));
@@ -427,10 +465,10 @@ function on(e = {}) {
427
465
  role: "user",
428
466
  content: t
429
467
  }];
430
- r({ text: t }), P(""), b?.(t, n);
468
+ r({ text: t }), ne(""), x?.(t, n);
431
469
  }, [
432
470
  r,
433
- b,
471
+ x,
434
472
  l
435
473
  ]),
436
474
  stop: a,
@@ -440,19 +478,19 @@ function on(e = {}) {
440
478
  }, [s]),
441
479
  setMessages: s,
442
480
  isApiMode: !0,
443
- input: N,
444
- setInput: P,
481
+ input: te,
482
+ setInput: ne,
445
483
  handleInputChange: o((e) => {
446
- P(e.target.value);
484
+ ne(e.target.value);
447
485
  }, [])
448
486
  };
449
487
  }
450
- let I = o(() => {
451
- F.current &&= (clearTimeout(F.current), null), A(!1);
488
+ let re = o(() => {
489
+ L.current &&= (clearTimeout(L.current), null), P(!1);
452
490
  }, []);
453
491
  return {
454
- messages: D,
455
- isLoading: k,
492
+ messages: M,
493
+ isLoading: ee,
456
494
  error: void 0,
457
495
  sendMessage: o((e) => {
458
496
  if (!e.trim()) return;
@@ -460,93 +498,107 @@ function on(e = {}) {
460
498
  id: Rt("msg"),
461
499
  role: "user",
462
500
  content: e.trim(),
463
- timestamp: g ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : void 0
501
+ timestamp: _ ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : void 0
464
502
  };
465
- O((n) => {
503
+ N((n) => {
466
504
  let r = [...n, t];
467
- return b?.(e.trim(), r), r;
468
- }), M(""), _ && (A(!0), F.current = setTimeout(() => {
505
+ return x?.(e.trim(), r), r;
506
+ }), I(""), v && (P(!0), L.current = setTimeout(() => {
469
507
  let e = {
470
508
  id: Rt("msg"),
471
509
  role: "assistant",
472
- content: v || "Thank you for your message!",
473
- timestamp: g ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : void 0
510
+ content: y || "Thank you for your message!",
511
+ timestamp: _ ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : void 0
474
512
  };
475
- O((t) => [...t, e]), A(!1);
476
- }, y));
513
+ N((t) => [...t, e]), P(!1);
514
+ }, b));
477
515
  }, [
478
- g,
479
516
  _,
480
517
  v,
481
518
  y,
482
- b
519
+ b,
520
+ x
483
521
  ]),
484
- stop: I,
522
+ stop: re,
485
523
  reload: o(() => {}, []),
486
524
  clear: o(() => {
487
- I(), O([]);
488
- }, [I]),
525
+ re(), N([]);
526
+ }, [re]),
489
527
  isApiMode: !1,
490
- input: j,
491
- setInput: M,
528
+ input: F,
529
+ setInput: I,
492
530
  handleInputChange: o((e) => {
493
- M(e.target.value);
531
+ I(e.target.value);
494
532
  }, [])
495
533
  };
496
534
  }
497
535
  //#endregion
498
536
  //#region src/agentAliases.ts
499
- var sn = [["build", "metadata_assistant"], ["ask", "data_chat"]];
500
- function cn(e) {
501
- return sn.find((t) => t.includes(e)) ?? [e];
537
+ var dn = [["build", "metadata_assistant"], ["ask", "data_chat"]];
538
+ function fn(e) {
539
+ return dn.find((t) => t.includes(e)) ?? [e];
502
540
  }
503
- function ln(e) {
504
- return cn(e)[0];
541
+ function pn(e) {
542
+ return fn(e)[0];
505
543
  }
506
- function un(e, t) {
544
+ function mn(e, t) {
507
545
  if (e) {
508
546
  if (t.includes(e)) return e;
509
- for (let n of cn(e)) if (t.includes(n)) return n;
547
+ for (let n of fn(e)) if (t.includes(n)) return n;
510
548
  }
511
549
  }
512
- function dn(e) {
513
- return e != null && sn.some((t) => t.includes(e));
550
+ function hn(e) {
551
+ return e != null && dn.some((t) => t.includes(e));
514
552
  }
515
- function fn(e) {
516
- return e != null && ln(e) === "build";
553
+ function gn(e) {
554
+ return e != null && pn(e) === "build";
517
555
  }
518
- function pn(e) {
519
- return e != null && ln(e) === "ask";
556
+ function _n(e) {
557
+ return e != null && pn(e) === "ask";
520
558
  }
521
559
  //#endregion
522
560
  //#region src/useAgents.ts
523
- var mn = "ask";
524
- function hn(e, t) {
561
+ function vn(e) {
562
+ if (!(!e || typeof e != "object")) return {
563
+ authoring: e.authoring === !0,
564
+ canvas: e.canvas === !0,
565
+ debug: e.debug === !0,
566
+ resume: e.resume === !0
567
+ };
568
+ }
569
+ function yn(e, t, n) {
570
+ if (!t) return !1;
571
+ let r = e.find((e) => e.name === t);
572
+ return r?.capabilities ? r.capabilities[n] : gn(t);
573
+ }
574
+ var bn = "ask";
575
+ function xn(e, t) {
525
576
  if (e.length === 0) return;
526
577
  let n = e.map((e) => e.name);
527
578
  if (t) {
528
- let e = un(t, n);
579
+ let e = mn(t, n);
529
580
  if (e) return e;
530
581
  }
531
- return un("ask", n) || e[0].name;
582
+ return mn("ask", n) || e[0].name;
532
583
  }
533
- function gn(e) {
584
+ function Sn(e) {
534
585
  return e.filter((e) => typeof e?.name == "string" && e.name.length > 0).map((e) => ({
535
586
  name: e.name,
536
587
  label: e.label || e.name,
537
588
  description: e.description,
538
589
  role: e.role,
539
- active: e.active !== !1
590
+ active: e.active !== !1,
591
+ capabilities: vn(e.capabilities)
540
592
  }));
541
593
  }
542
- var _n = 3e4, vn = /* @__PURE__ */ new Map(), yn = /* @__PURE__ */ new Map();
543
- function bn(e, t, n) {
544
- if (n) vn.delete(e);
594
+ var Cn = 3e4, wn = /* @__PURE__ */ new Map(), Tn = /* @__PURE__ */ new Map();
595
+ function En(e, t, n) {
596
+ if (n) wn.delete(e);
545
597
  else {
546
- let t = vn.get(e);
547
- if (t && Date.now() - t.timestamp < _n) return Promise.resolve(t.data);
598
+ let t = wn.get(e);
599
+ if (t && Date.now() - t.timestamp < Cn) return Promise.resolve(t.data);
548
600
  }
549
- let r = yn.get(e);
601
+ let r = Tn.get(e);
550
602
  if (r && !n) return r;
551
603
  let i = `${e.replace(/\/$/, "")}/agents`, a = fetch(i, {
552
604
  method: "GET",
@@ -558,21 +610,21 @@ function bn(e, t, n) {
558
610
  }).then(async (e) => {
559
611
  if (!e.ok) throw Error(`Failed to load agents (${e.status})`);
560
612
  let t = await e.json();
561
- return gn(Array.isArray(t) ? t : t?.agents ?? []);
562
- }).then((t) => (vn.set(e, {
613
+ return Sn(Array.isArray(t) ? t : t?.agents ?? []);
614
+ }).then((t) => (wn.set(e, {
563
615
  data: t,
564
616
  timestamp: Date.now()
565
617
  }), t)).finally(() => {
566
- yn.delete(e);
618
+ Tn.delete(e);
567
619
  });
568
- return yn.set(e, a), a;
620
+ return Tn.set(e, a), a;
569
621
  }
570
- function xn(e = {}) {
622
+ function Dn(e = {}) {
571
623
  let { apiBase: t, headers: n, enabled: r = !0, fallback: i = [] } = e, [a, s] = d(i), [l, f] = d(!1), [p, m] = d(void 0), [h, g] = d(0), _ = u(n);
572
624
  return _.current = n, c(() => {
573
625
  if (!r || !t) return;
574
626
  let e = !1;
575
- return f(!0), m(void 0), bn(t, _.current, h > 0).then((t) => {
627
+ return f(!0), m(void 0), En(t, _.current, h > 0).then((t) => {
576
628
  e || s(t.length > 0 ? t : i);
577
629
  }).catch((t) => {
578
630
  e || (m(t), s(i));
@@ -594,13 +646,13 @@ function xn(e = {}) {
594
646
  }
595
647
  //#endregion
596
648
  //#region src/useAiModels.ts
597
- function Sn(e) {
649
+ function On(e) {
598
650
  return e.filter((e) => typeof e?.id == "string" && e.id.length > 0).map((e) => ({
599
651
  id: e.id,
600
652
  label: e.label || e.id
601
653
  }));
602
654
  }
603
- function Cn(e = {}) {
655
+ function kn(e = {}) {
604
656
  let { apiBase: t, headers: n, enabled: r = !0 } = e, [i, a] = d([]), [s, l] = d(void 0), [f, p] = d(!1), [m, h] = d(void 0), [g, _] = d(0), v = u(n);
605
657
  return v.current = n, c(() => {
606
658
  if (!r || !t) return;
@@ -620,7 +672,7 @@ function Cn(e = {}) {
620
672
  if (!t.ok) throw Error(`Failed to load AI models (${t.status})`);
621
673
  let r = await t.json();
622
674
  if (n) return;
623
- let c = Array.isArray(r) ? r : r?.models ?? [], u = Array.isArray(r) ? void 0 : r?.defaultModel, d = Sn(c);
675
+ let c = Array.isArray(r) ? r : r?.models ?? [], u = Array.isArray(r) ? void 0 : r?.defaultModel, d = On(c);
624
676
  a(d), l(u ?? c.find((e) => e?.default)?.id ?? c[0]?.id), p(!1), d.length === 0 && o < 5 && !n && (o += 1, setTimeout(() => {
625
677
  s();
626
678
  }, 1200));
@@ -649,8 +701,8 @@ function Cn(e = {}) {
649
701
  }
650
702
  //#endregion
651
703
  //#region src/FloatingChatbotProvider.tsx
652
- var wn = e.createContext(null);
653
- function Tn({ defaultOpen: t = !1, children: n }) {
704
+ var An = e.createContext(null);
705
+ function jn({ defaultOpen: t = !1, children: n }) {
654
706
  let [r, i] = e.useState(t), [a, o] = e.useState(!1), s = e.useMemo(() => ({
655
707
  isOpen: r,
656
708
  isFullscreen: a,
@@ -661,19 +713,19 @@ function Tn({ defaultOpen: t = !1, children: n }) {
661
713
  toggle: () => i((e) => !e),
662
714
  toggleFullscreen: () => o((e) => !e)
663
715
  }), [r, a]);
664
- return /* @__PURE__ */ Q(wn.Provider, {
716
+ return /* @__PURE__ */ Q(An.Provider, {
665
717
  value: s,
666
718
  children: n
667
719
  });
668
720
  }
669
- function En() {
670
- let t = e.useContext(wn);
721
+ function Mn() {
722
+ let t = e.useContext(An);
671
723
  if (!t) throw Error("useFloatingChatbot must be used within a <FloatingChatbotProvider>");
672
724
  return t;
673
725
  }
674
726
  //#endregion
675
727
  //#region src/FloatingChatbotTrigger.tsx
676
- function Dn() {
728
+ function Nn() {
677
729
  try {
678
730
  let { t: e } = Tt();
679
731
  return (t, n) => {
@@ -684,7 +736,7 @@ function Dn() {
684
736
  return (e, t) => t;
685
737
  }
686
738
  }
687
- var On = {
739
+ var Pn = {
688
740
  32: "size-8",
689
741
  36: "size-9",
690
742
  40: "size-10",
@@ -697,26 +749,26 @@ var On = {
697
749
  72: "size-[72px]",
698
750
  80: "size-20"
699
751
  };
700
- function kn(e, t) {
752
+ function Fn(e, t) {
701
753
  return t.reduce((t, n) => Math.abs(n - e) < Math.abs(t - e) ? n : t);
702
754
  }
703
- function An(e) {
704
- return On[e] ?? On[kn(e, Object.keys(On).map(Number))];
755
+ function In(e) {
756
+ return Pn[e] ?? Pn[Fn(e, Object.keys(Pn).map(Number))];
705
757
  }
706
- function jn({ position: e = "bottom-right", size: t = 56, className: n }) {
707
- let { isOpen: r, toggle: i } = En(), a = Dn();
758
+ function Ln({ position: e = "bottom-right", size: t = 56, className: n }) {
759
+ let { isOpen: r, toggle: i } = Mn(), a = Nn();
708
760
  return /* @__PURE__ */ Q(v, {
709
761
  onClick: i,
710
- className: q("fixed z-50 rounded-full shadow-lg transition-transform hover:scale-105", An(t), r && "hidden", e === "bottom-right" ? "right-6 bottom-20 sm:bottom-6" : "left-6 bottom-20 sm:bottom-6", n),
762
+ className: q("fixed z-50 rounded-full shadow-lg transition-transform hover:scale-105", In(t), r && "hidden", e === "bottom-right" ? "right-6 bottom-20 sm:bottom-6" : "left-6 bottom-20 sm:bottom-6", n),
711
763
  size: "icon",
712
764
  "aria-label": r ? a("closeChat", "Close chat") : a("openChat", "Open chat"),
713
765
  "data-testid": "floating-chatbot-trigger",
714
- children: Q(r ? vt : Me, { className: "h-6 w-6" })
766
+ children: Q(r ? vt : Ne, { className: "h-6 w-6" })
715
767
  });
716
768
  }
717
769
  //#endregion
718
770
  //#region src/FloatingChatbotPanel.tsx
719
- var Mn = {
771
+ var Rn = {
720
772
  300: "sm:w-[300px]",
721
773
  320: "sm:w-[320px]",
722
774
  340: "sm:w-[340px]",
@@ -735,7 +787,7 @@ var Mn = {
735
787
  640: "sm:w-[640px]",
736
788
  720: "sm:w-[720px]",
737
789
  800: "sm:w-[800px]"
738
- }, Nn = {
790
+ }, zn = {
739
791
  360: "h-[min(360px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[360px]",
740
792
  400: "h-[min(400px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[400px]",
741
793
  420: "h-[min(420px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[420px]",
@@ -749,19 +801,19 @@ var Mn = {
749
801
  720: "h-[min(720px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[720px]",
750
802
  800: "h-[min(800px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[800px]"
751
803
  };
752
- function Pn(e, t) {
804
+ function Bn(e, t) {
753
805
  return t.reduce((t, n) => Math.abs(n - e) < Math.abs(t - e) ? n : t);
754
806
  }
755
- function Fn(e) {
756
- return Mn[e] ?? Mn[Pn(e, Object.keys(Mn).map(Number))];
807
+ function Vn(e) {
808
+ return Rn[e] ?? Rn[Bn(e, Object.keys(Rn).map(Number))];
757
809
  }
758
- function In(e) {
759
- return Nn[e] ?? Nn[Pn(e, Object.keys(Nn).map(Number))];
810
+ function Hn(e) {
811
+ return zn[e] ?? zn[Bn(e, Object.keys(zn).map(Number))];
760
812
  }
761
- function Ln({ title: e = "Chat", position: t = "bottom-right", width: n = 400, height: r = 520, children: i, className: a, headerExtra: o, headerActions: s }) {
762
- let { isOpen: c, isFullscreen: l, close: u, toggleFullscreen: d } = En();
813
+ function Un({ title: e = "Chat", position: t = "bottom-right", width: n = 400, height: r = 520, children: i, className: a, headerExtra: o, headerActions: s }) {
814
+ let { isOpen: c, isFullscreen: l, close: u, toggleFullscreen: d } = Mn();
763
815
  return c ? /* @__PURE__ */ $("div", {
764
- className: q("fixed z-50 flex flex-col overflow-hidden border bg-background shadow-xl transition-all", l ? "inset-0 h-svh w-screen rounded-none" : t === "bottom-right" ? q("left-3 right-3 bottom-[calc(4rem_+_env(safe-area-inset-bottom))] rounded-lg", "sm:left-auto sm:right-6 sm:bottom-20 sm:max-h-[calc(100vh_-_100px)]", Fn(n), In(r)) : q("left-3 right-3 bottom-[calc(4rem_+_env(safe-area-inset-bottom))] rounded-lg", "sm:right-auto sm:left-6 sm:bottom-20 sm:max-h-[calc(100vh_-_100px)]", Fn(n), In(r)), a),
816
+ className: q("fixed z-50 flex flex-col overflow-hidden border bg-background shadow-xl transition-all", l ? "inset-0 h-svh w-screen rounded-none" : t === "bottom-right" ? q("left-3 right-3 bottom-[calc(4rem_+_env(safe-area-inset-bottom))] rounded-lg", "sm:left-auto sm:right-6 sm:bottom-20 sm:max-h-[calc(100vh_-_100px)]", Vn(n), Hn(r)) : q("left-3 right-3 bottom-[calc(4rem_+_env(safe-area-inset-bottom))] rounded-lg", "sm:right-auto sm:left-6 sm:bottom-20 sm:max-h-[calc(100vh_-_100px)]", Vn(n), Hn(r)), a),
765
817
  role: "dialog",
766
818
  "aria-label": e,
767
819
  "data-testid": "floating-chatbot-panel",
@@ -810,7 +862,7 @@ function Ln({ title: e = "Chat", position: t = "bottom-right", width: n = 400, h
810
862
  }
811
863
  //#endregion
812
864
  //#region src/tool-display.ts
813
- var Rn = {
865
+ var Wn = {
814
866
  ai: "AI",
815
867
  api: "API",
816
868
  crm: "CRM",
@@ -822,17 +874,17 @@ var Rn = {
822
874
  url: "URL",
823
875
  utc: "UTC"
824
876
  };
825
- function zn(e) {
877
+ function Gn(e) {
826
878
  if (!e) return "";
827
879
  let t = String(e).trim();
828
880
  if (!t) return "";
829
881
  let n = t.replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").split(/\s+/).filter(Boolean);
830
882
  return n.length === 0 ? t : n.map((e, t) => {
831
883
  let n = e.toLowerCase();
832
- return Rn[n] ? Rn[n] : t === 0 ? n.charAt(0).toUpperCase() + n.slice(1) : n;
884
+ return Wn[n] ? Wn[n] : t === 0 ? n.charAt(0).toUpperCase() + n.slice(1) : n;
833
885
  }).join(" ");
834
886
  }
835
- function Bn(e) {
887
+ function Kn(e) {
836
888
  if (e == null) return e;
837
889
  let t = e;
838
890
  for (let e = 0; e < 2; e++) {
@@ -850,7 +902,7 @@ function Bn(e) {
850
902
  }
851
903
  return t;
852
904
  }
853
- function Vn(e) {
905
+ function qn(e) {
854
906
  let t = (e instanceof Error ? e.message : String(e ?? "")).replace(/\s+/g, " ").trim();
855
907
  if (!t) return { summary: "Something went wrong. Please try again." };
856
908
  let n = t.replace(/^Failed after \d+ attempts?\.\s*Last error:\s*/i, ""), r = n.match(/^Invalid error response format:\s*(.+)$/i)?.[1]?.trim() ?? n, i = r.match(/^([^:]{8,80}):\s+(.+)$/)?.[1]?.trim() ?? r.match(/^([^.;!?]+[.;!?])\s/)?.[1]?.trim() ?? (r.length > 140 ? `${r.slice(0, 137).trimEnd()}…` : r);
@@ -859,12 +911,12 @@ function Vn(e) {
859
911
  details: n.length > i.length ? n : void 0
860
912
  };
861
913
  }
862
- var Hn = /* @__PURE__ */ new Set([
914
+ var Jn = /* @__PURE__ */ new Set([
863
915
  "ai_design_quota_exhausted",
864
916
  "ai_data_chat_trial_exhausted",
865
917
  "ai_allowance_exhausted"
866
918
  ]);
867
- function Un(e) {
919
+ function Yn(e) {
868
920
  let t = e instanceof Error ? e.message : String(e ?? "");
869
921
  if (!t) return null;
870
922
  let n = t.replace(/^Failed after \d+ attempts?\.\s*Last error:\s*/i, "").replace(/^Invalid error response format:\s*/i, "").trim(), r = n.indexOf("{"), i = n.lastIndexOf("}");
@@ -875,7 +927,7 @@ function Un(e) {
875
927
  } catch {
876
928
  return null;
877
929
  }
878
- return !a || typeof a.error != "string" || !Hn.has(a.error) ? null : {
930
+ return !a || typeof a.error != "string" || !Jn.has(a.error) ? null : {
879
931
  code: a.error,
880
932
  message: typeof a.message == "string" ? a.message : "",
881
933
  messageEn: typeof a.messageEn == "string" ? a.messageEn : void 0,
@@ -883,30 +935,30 @@ function Un(e) {
883
935
  topUp: a.topUp === !0
884
936
  };
885
937
  }
886
- function Wn(e) {
938
+ function Xn(e) {
887
939
  return !!(e && typeof e == "object" && e.notSent === !0);
888
940
  }
889
- function Gn(e) {
941
+ function Zn(e) {
890
942
  let t = e && typeof e == "object" ? e.status : void 0;
891
943
  return typeof t == "number" ? t : void 0;
892
944
  }
893
- function Kn(e) {
894
- if (Gn(e) === 429) return !0;
945
+ function Qn(e) {
946
+ if (Zn(e) === 429) return !0;
895
947
  let t = e instanceof Error ? e.message : typeof e == "string" ? e : "";
896
948
  return /\b429\b|too many requests|rate[\s_-]?limit/i.test(t);
897
949
  }
898
950
  //#endregion
899
951
  //#region src/elements/conversation.tsx
900
- var qn = ({ className: e, ...t }) => /* @__PURE__ */ Q(Et, {
952
+ var $n = ({ className: e, ...t }) => /* @__PURE__ */ Q(Et, {
901
953
  className: q("relative flex-1 overflow-y-hidden", e),
902
954
  initial: "smooth",
903
955
  resize: "smooth",
904
956
  role: "log",
905
957
  ...t
906
- }), Jn = ({ className: e, ...t }) => /* @__PURE__ */ Q(Et.Content, {
958
+ }), er = ({ className: e, ...t }) => /* @__PURE__ */ Q(Et.Content, {
907
959
  className: q("flex flex-col gap-8 p-4", e),
908
960
  ...t
909
- }), Yn = ({ className: e, title: t = "No messages yet", description: n = "Start a conversation to see messages here", icon: r, children: i, ...a }) => /* @__PURE__ */ Q("div", {
961
+ }), tr = ({ className: e, title: t = "No messages yet", description: n = "Start a conversation to see messages here", icon: r, children: i, ...a }) => /* @__PURE__ */ Q("div", {
910
962
  className: q("flex size-full flex-col items-center justify-center gap-3 p-8 text-center", e),
911
963
  ...a,
912
964
  children: i ?? /* @__PURE__ */ $(Z, { children: [r && /* @__PURE__ */ Q("div", {
@@ -922,7 +974,7 @@ var qn = ({ className: e, ...t }) => /* @__PURE__ */ Q(Et, {
922
974
  children: n
923
975
  })]
924
976
  })] })
925
- }), Xn = ({ className: e, ...t }) => {
977
+ }), nr = ({ className: e, ...t }) => {
926
978
  let { isAtBottom: n, scrollToBottom: r } = Dt(), i = o(() => {
927
979
  r();
928
980
  }, [r]);
@@ -933,25 +985,25 @@ var qn = ({ className: e, ...t }) => /* @__PURE__ */ Q(Et, {
933
985
  type: "button",
934
986
  variant: "outline",
935
987
  ...t,
936
- children: /* @__PURE__ */ Q(J, { className: "size-4" })
988
+ children: /* @__PURE__ */ Q(Ae, { className: "size-4" })
937
989
  });
938
- }, Zn = Ot("flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
990
+ }, rr = Ot("flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
939
991
  variants: { orientation: {
940
992
  horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
941
993
  vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"
942
994
  } },
943
995
  defaultVariants: { orientation: "horizontal" }
944
996
  });
945
- function Qn({ className: e, orientation: t, ...n }) {
997
+ function ir({ className: e, orientation: t, ...n }) {
946
998
  return /* @__PURE__ */ Q("div", {
947
999
  role: "group",
948
1000
  "data-slot": "button-group",
949
1001
  "data-orientation": t,
950
- className: q(Zn({ orientation: t }), e),
1002
+ className: q(rr({ orientation: t }), e),
951
1003
  ...n
952
1004
  });
953
1005
  }
954
- function $n({ className: e, asChild: t = !1, ...n }) {
1006
+ function ar({ className: e, asChild: t = !1, ...n }) {
955
1007
  return /* @__PURE__ */ Q(t ? kt : "div", {
956
1008
  className: q("flex items-center gap-2 rounded-md border bg-muted px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", e),
957
1009
  ...n
@@ -959,18 +1011,18 @@ function $n({ className: e, asChild: t = !1, ...n }) {
959
1011
  }
960
1012
  //#endregion
961
1013
  //#region src/elements/message.tsx
962
- var er = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
1014
+ var or = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
963
1015
  className: q("group flex w-full max-w-[95%] flex-col gap-2", t === "user" ? "is-user ml-auto justify-end" : "is-assistant", e),
964
1016
  ...n
965
- }), tr = ({ children: e, className: t, ...n }) => /* @__PURE__ */ Q("div", {
1017
+ }), sr = ({ children: e, className: t, ...n }) => /* @__PURE__ */ Q("div", {
966
1018
  className: q("is-user:dark flex w-fit max-w-full min-w-0 flex-col gap-2 overflow-hidden text-sm", "group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground", "group-[.is-assistant]:text-foreground", t),
967
1019
  ...n,
968
1020
  children: e
969
- }), nr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q("div", {
1021
+ }), cr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q("div", {
970
1022
  className: q("flex items-center gap-1", e),
971
1023
  ...n,
972
1024
  children: t
973
- }), rr = ({ tooltip: e, children: t, label: n, variant: r = "ghost", size: i = "icon", ...a }) => {
1025
+ }), lr = ({ tooltip: e, children: t, label: n, variant: r = "ghost", size: i = "icon", ...a }) => {
974
1026
  let o = /* @__PURE__ */ $(v, {
975
1027
  size: i,
976
1028
  type: "button",
@@ -981,15 +1033,15 @@ var er = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
981
1033
  children: n || e
982
1034
  })]
983
1035
  });
984
- return e ? /* @__PURE__ */ Q(De, { children: /* @__PURE__ */ $(Te, { children: [/* @__PURE__ */ Q(Oe, {
1036
+ return e ? /* @__PURE__ */ Q(G, { children: /* @__PURE__ */ $(De, { children: [/* @__PURE__ */ Q(K, {
985
1037
  asChild: !0,
986
1038
  children: o
987
- }), /* @__PURE__ */ Q(Ee, { children: /* @__PURE__ */ Q("p", { children: e }) })] }) }) : o;
988
- }, ir = r(null), ar = () => {
989
- let e = s(ir);
1039
+ }), /* @__PURE__ */ Q(Oe, { children: /* @__PURE__ */ Q("p", { children: e }) })] }) }) : o;
1040
+ }, ur = r(null), dr = () => {
1041
+ let e = s(ur);
990
1042
  if (!e) throw Error("MessageBranch components must be used within MessageBranch");
991
1043
  return e;
992
- }, or = ({ defaultBranch: e = 0, onBranchChange: t, className: n, ...r }) => {
1044
+ }, fr = ({ defaultBranch: e = 0, onBranchChange: t, className: n, ...r }) => {
993
1045
  let [i, a] = d(e), [o, s] = d([]), c = (e) => {
994
1046
  a(e), t?.(e);
995
1047
  }, l = {
@@ -1006,15 +1058,15 @@ var er = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
1006
1058
  branches: o,
1007
1059
  setBranches: s
1008
1060
  };
1009
- return /* @__PURE__ */ Q(ir.Provider, {
1061
+ return /* @__PURE__ */ Q(ur.Provider, {
1010
1062
  value: l,
1011
1063
  children: /* @__PURE__ */ Q("div", {
1012
1064
  className: q("grid w-full gap-2 [&>div]:pb-0", n),
1013
1065
  ...r
1014
1066
  })
1015
1067
  });
1016
- }, sr = ({ children: e, ...t }) => {
1017
- let { currentBranch: n, setBranches: r, branches: i } = ar(), a = Array.isArray(e) ? e : [e];
1068
+ }, pr = ({ children: e, ...t }) => {
1069
+ let { currentBranch: n, setBranches: r, branches: i } = dr(), a = Array.isArray(e) ? e : [e];
1018
1070
  return c(() => {
1019
1071
  i.length !== a.length && r(a);
1020
1072
  }, [
@@ -1026,15 +1078,15 @@ var er = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
1026
1078
  ...t,
1027
1079
  children: e
1028
1080
  }, e.key));
1029
- }, cr = ({ className: e, from: t, ...n }) => {
1030
- let { totalBranches: r } = ar();
1031
- return r <= 1 ? null : /* @__PURE__ */ Q(Qn, {
1081
+ }, mr = ({ className: e, from: t, ...n }) => {
1082
+ let { totalBranches: r } = dr();
1083
+ return r <= 1 ? null : /* @__PURE__ */ Q(ir, {
1032
1084
  className: "[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md",
1033
1085
  orientation: "horizontal",
1034
1086
  ...n
1035
1087
  });
1036
- }, lr = ({ children: e, ...t }) => {
1037
- let { goToPrevious: n, totalBranches: r } = ar();
1088
+ }, hr = ({ children: e, ...t }) => {
1089
+ let { goToPrevious: n, totalBranches: r } = dr();
1038
1090
  return /* @__PURE__ */ Q(v, {
1039
1091
  "aria-label": "Previous branch",
1040
1092
  disabled: r <= 1,
@@ -1045,8 +1097,8 @@ var er = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
1045
1097
  ...t,
1046
1098
  children: e ?? /* @__PURE__ */ Q(Re, { size: 14 })
1047
1099
  });
1048
- }, ur = ({ children: e, className: t, ...n }) => {
1049
- let { goToNext: r, totalBranches: i } = ar();
1100
+ }, gr = ({ children: e, className: t, ...n }) => {
1101
+ let { goToNext: r, totalBranches: i } = dr();
1050
1102
  return /* @__PURE__ */ Q(v, {
1051
1103
  "aria-label": "Next branch",
1052
1104
  disabled: i <= 1,
@@ -1057,9 +1109,9 @@ var er = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
1057
1109
  ...n,
1058
1110
  children: e ?? /* @__PURE__ */ Q(ze, { size: 14 })
1059
1111
  });
1060
- }, dr = ({ className: e, ...t }) => {
1061
- let { currentBranch: n, totalBranches: r } = ar();
1062
- return /* @__PURE__ */ $($n, {
1112
+ }, _r = ({ className: e, ...t }) => {
1113
+ let { currentBranch: n, totalBranches: r } = dr();
1114
+ return /* @__PURE__ */ $(ar, {
1063
1115
  className: q("border-none bg-transparent text-muted-foreground shadow-none", e),
1064
1116
  ...t,
1065
1117
  children: [
@@ -1068,12 +1120,12 @@ var er = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
1068
1120
  r
1069
1121
  ]
1070
1122
  });
1071
- }, fr = a(({ className: e, ...t }) => /* @__PURE__ */ Q(At, {
1123
+ }, vr = a(({ className: e, ...t }) => /* @__PURE__ */ Q(At, {
1072
1124
  className: q("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", e),
1073
1125
  ...t
1074
1126
  }), (e, t) => e.children === t.children);
1075
- fr.displayName = "MessageResponse";
1076
- function pr({ data: e, className: t, onRemove: n, ...r }) {
1127
+ vr.displayName = "MessageResponse";
1128
+ function yr({ data: e, className: t, onRemove: n, ...r }) {
1077
1129
  let i = e.filename || "", a = (e.mediaType?.startsWith("image/") && e.url ? "image" : "file") == "image", o = i || (a ? "Image" : "Attachment");
1078
1130
  return /* @__PURE__ */ Q("div", {
1079
1131
  className: q("group relative size-24 overflow-hidden rounded-lg", t),
@@ -1096,13 +1148,13 @@ function pr({ data: e, className: t, onRemove: n, ...r }) {
1096
1148
  className: "sr-only",
1097
1149
  children: "Remove"
1098
1150
  })]
1099
- })] }) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ $(Te, { children: [/* @__PURE__ */ Q(Oe, {
1151
+ })] }) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ $(De, { children: [/* @__PURE__ */ Q(K, {
1100
1152
  asChild: !0,
1101
1153
  children: /* @__PURE__ */ Q("div", {
1102
1154
  className: "flex size-full shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground",
1103
1155
  children: /* @__PURE__ */ Q(ot, { className: "size-4" })
1104
1156
  })
1105
- }), /* @__PURE__ */ Q(Ee, { children: /* @__PURE__ */ Q("p", { children: o }) })] }), n && /* @__PURE__ */ $(v, {
1157
+ }), /* @__PURE__ */ Q(Oe, { children: /* @__PURE__ */ Q("p", { children: o }) })] }), n && /* @__PURE__ */ $(v, {
1106
1158
  "aria-label": "Remove attachment",
1107
1159
  className: "size-6 shrink-0 rounded-full p-0 opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 [&>svg]:size-3",
1108
1160
  onClick: (e) => {
@@ -1117,21 +1169,21 @@ function pr({ data: e, className: t, onRemove: n, ...r }) {
1117
1169
  })] })
1118
1170
  });
1119
1171
  }
1120
- function mr({ children: e, className: t, ...n }) {
1172
+ function br({ children: e, className: t, ...n }) {
1121
1173
  return e ? /* @__PURE__ */ Q("div", {
1122
1174
  className: q("ml-auto flex w-fit flex-wrap items-start gap-2", t),
1123
1175
  ...n,
1124
1176
  children: e
1125
1177
  }) : null;
1126
1178
  }
1127
- var hr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q("div", {
1179
+ var xr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q("div", {
1128
1180
  className: q("mt-4 flex w-full items-center justify-between gap-4", e),
1129
1181
  ...n,
1130
1182
  children: t
1131
1183
  });
1132
1184
  //#endregion
1133
1185
  //#region src/elements/ui/input-group.tsx
1134
- function gr({ className: e, ...t }) {
1186
+ function Sr({ className: e, ...t }) {
1135
1187
  return /* @__PURE__ */ Q("div", {
1136
1188
  "data-slot": "input-group",
1137
1189
  role: "group",
@@ -1139,7 +1191,7 @@ function gr({ className: e, ...t }) {
1139
1191
  ...t
1140
1192
  });
1141
1193
  }
1142
- var _r = Ot("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
1194
+ var Cr = Ot("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
1143
1195
  variants: { align: {
1144
1196
  "inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
1145
1197
  "inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
@@ -1148,19 +1200,19 @@ var _r = Ot("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 te
1148
1200
  } },
1149
1201
  defaultVariants: { align: "inline-start" }
1150
1202
  });
1151
- function vr({ className: e, align: t = "inline-start", ...n }) {
1203
+ function wr({ className: e, align: t = "inline-start", ...n }) {
1152
1204
  return /* @__PURE__ */ Q("div", {
1153
1205
  role: "group",
1154
1206
  "data-slot": "input-group-addon",
1155
1207
  "data-align": t,
1156
- className: q(_r({ align: t }), e),
1208
+ className: q(Cr({ align: t }), e),
1157
1209
  onClick: (e) => {
1158
1210
  e.target.closest("button") || e.currentTarget.parentElement?.querySelector("input")?.focus();
1159
1211
  },
1160
1212
  ...n
1161
1213
  });
1162
1214
  }
1163
- var yr = Ot("flex items-center gap-2 text-sm shadow-none", {
1215
+ var Tr = Ot("flex items-center gap-2 text-sm shadow-none", {
1164
1216
  variants: { size: {
1165
1217
  xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",
1166
1218
  sm: "h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5",
@@ -1169,17 +1221,17 @@ var yr = Ot("flex items-center gap-2 text-sm shadow-none", {
1169
1221
  } },
1170
1222
  defaultVariants: { size: "xs" }
1171
1223
  });
1172
- function br({ className: e, type: t = "button", variant: n = "ghost", size: r = "xs", ...i }) {
1224
+ function Er({ className: e, type: t = "button", variant: n = "ghost", size: r = "xs", ...i }) {
1173
1225
  return /* @__PURE__ */ Q(v, {
1174
1226
  type: t,
1175
1227
  "data-size": r,
1176
1228
  variant: n,
1177
- className: q(yr({ size: r }), e),
1229
+ className: q(Tr({ size: r }), e),
1178
1230
  ...i
1179
1231
  });
1180
1232
  }
1181
- function xr({ className: e, ...t }) {
1182
- return /* @__PURE__ */ Q(K, {
1233
+ function Dr({ className: e, ...t }) {
1234
+ return /* @__PURE__ */ Q(Ee, {
1183
1235
  "data-slot": "input-group-control",
1184
1236
  className: q("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent", e),
1185
1237
  ...t
@@ -1187,16 +1239,16 @@ function xr({ className: e, ...t }) {
1187
1239
  }
1188
1240
  //#endregion
1189
1241
  //#region src/elements/prompt-input.tsx
1190
- var Sr = r(null), Cr = r(null), wr = () => {
1191
- let e = s(Sr);
1242
+ var Or = r(null), kr = r(null), Ar = () => {
1243
+ let e = s(Or);
1192
1244
  if (!e) throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");
1193
1245
  return e;
1194
- }, Tr = () => s(Sr), Er = () => {
1195
- let e = s(Cr);
1246
+ }, jr = () => s(Or), Mr = () => {
1247
+ let e = s(kr);
1196
1248
  if (!e) throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");
1197
1249
  return e;
1198
- }, Dr = () => s(Cr);
1199
- function Or({ initialInput: e = "", children: t }) {
1250
+ }, Nr = () => s(kr);
1251
+ function Pr({ initialInput: e = "", children: t }) {
1200
1252
  let [n, r] = d(e), i = o(() => r(""), []), [a, s] = d([]), f = u(null), p = u(() => {}), m = o((e) => {
1201
1253
  let t = Array.from(e);
1202
1254
  t.length !== 0 && s((e) => e.concat(t.map((e) => ({
@@ -1252,22 +1304,22 @@ function Or({ initialInput: e = "", children: t }) {
1252
1304
  y,
1253
1305
  b
1254
1306
  ]);
1255
- return /* @__PURE__ */ Q(Sr.Provider, {
1307
+ return /* @__PURE__ */ Q(Or.Provider, {
1256
1308
  value: x,
1257
- children: /* @__PURE__ */ Q(Cr.Provider, {
1309
+ children: /* @__PURE__ */ Q(kr.Provider, {
1258
1310
  value: y,
1259
1311
  children: t
1260
1312
  })
1261
1313
  });
1262
1314
  }
1263
- var kr = r(null), Ar = () => {
1264
- let e = Dr(), t = s(kr), n = e ?? t;
1315
+ var Fr = r(null), Ir = () => {
1316
+ let e = Nr(), t = s(Fr), n = e ?? t;
1265
1317
  if (!n) throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");
1266
1318
  return n;
1267
1319
  };
1268
- function jr({ data: e, className: t, ...n }) {
1269
- let r = Ar(), i = e.filename || "", a = (e.mediaType?.startsWith("image/") && e.url ? "image" : "file") == "image", o = i || (a ? "Image" : "Attachment");
1270
- return /* @__PURE__ */ $(Qr, { children: [/* @__PURE__ */ Q(B, {
1320
+ function Lr({ data: e, className: t, ...n }) {
1321
+ let r = Ir(), i = e.filename || "", a = (e.mediaType?.startsWith("image/") && e.url ? "image" : "file") == "image", o = i || (a ? "Image" : "Attachment");
1322
+ return /* @__PURE__ */ $(ii, { children: [/* @__PURE__ */ Q(oe, {
1271
1323
  asChild: !0,
1272
1324
  children: /* @__PURE__ */ $("div", {
1273
1325
  className: q("group relative flex h-8 cursor-pointer select-none items-center gap-1.5 rounded-md border border-border px-1.5 font-medium text-sm transition-all hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50", t),
@@ -1304,7 +1356,7 @@ function jr({ data: e, className: t, ...n }) {
1304
1356
  children: o
1305
1357
  })]
1306
1358
  }, e.id)
1307
- }), /* @__PURE__ */ Q(ei, {
1359
+ }), /* @__PURE__ */ Q(oi, {
1308
1360
  className: "w-auto p-2",
1309
1361
  children: /* @__PURE__ */ $("div", {
1310
1362
  className: "w-auto space-y-3",
@@ -1333,17 +1385,17 @@ function jr({ data: e, className: t, ...n }) {
1333
1385
  })
1334
1386
  })] });
1335
1387
  }
1336
- function Mr({ children: e, className: t, ...r }) {
1337
- let i = Ar();
1388
+ function Rr({ children: e, className: t, ...r }) {
1389
+ let i = Ir();
1338
1390
  return i.files.length ? /* @__PURE__ */ Q("div", {
1339
1391
  className: q("flex flex-wrap items-center gap-2 p-3 w-full", t),
1340
1392
  ...r,
1341
1393
  children: i.files.map((t) => /* @__PURE__ */ Q(n, { children: e(t) }, t.id))
1342
1394
  }) : null;
1343
1395
  }
1344
- var Nr = ({ label: e = "Add photos or files", ...t }) => {
1345
- let n = Ar();
1346
- return /* @__PURE__ */ $(I, {
1396
+ var zr = ({ label: e = "Add photos or files", ...t }) => {
1397
+ let n = Ir();
1398
+ return /* @__PURE__ */ $(F, {
1347
1399
  ...t,
1348
1400
  onSelect: (e) => {
1349
1401
  e.preventDefault(), n.openFileDialog();
@@ -1354,12 +1406,12 @@ var Nr = ({ label: e = "Add photos or files", ...t }) => {
1354
1406
  e
1355
1407
  ]
1356
1408
  });
1357
- }, Pr = ({ className: e, accept: t, multiple: n, fileInputLabel: r = "Upload files", globalDrop: i, syncHiddenInput: a, maxFiles: s, maxFileSize: f, onError: p, onSubmit: m, children: h, ...g }) => {
1358
- let _ = Tr(), v = !!_, y = u(null), b = u(null), [x, S] = d([]), C = v ? _.attachments.files : x, w = u(C);
1409
+ }, Br = ({ className: e, accept: t, multiple: n, fileInputLabel: r = "Upload files", globalDrop: i, syncHiddenInput: a, maxFiles: s, maxFileSize: f, onError: p, onSubmit: m, children: h, ...g }) => {
1410
+ let _ = jr(), v = !!_, y = u(null), b = u(null), [x, S] = d([]), C = v ? _.attachments.files : x, w = u(C);
1359
1411
  w.current = C;
1360
1412
  let T = o(() => {
1361
1413
  y.current?.click();
1362
- }, []), E = o((e) => !t || t.trim() === "" ? !0 : t.split(",").map((e) => e.trim()).filter(Boolean).some((t) => {
1414
+ }, []), E = o((e) => !t || t.trim() === "" || t.split(",").map((e) => e.trim()).filter(Boolean).some((t) => {
1363
1415
  if (t.endsWith("/*")) {
1364
1416
  let n = t.slice(0, -1);
1365
1417
  return e.type.startsWith(n);
@@ -1374,7 +1426,7 @@ var Nr = ({ label: e = "Add photos or files", ...t }) => {
1374
1426
  });
1375
1427
  return;
1376
1428
  }
1377
- let r = n.filter((e) => f ? e.size <= f : !0);
1429
+ let r = n.filter((e) => !f || e.size <= f);
1378
1430
  if (n.length > 0 && r.length === 0) {
1379
1431
  p?.({
1380
1432
  code: "max_file_size",
@@ -1439,9 +1491,9 @@ var Nr = ({ label: e = "Add photos or files", ...t }) => {
1439
1491
  }, [A, i]), c(() => () => {
1440
1492
  if (!v) for (let e of w.current) e.url && URL.revokeObjectURL(e.url);
1441
1493
  }, [v]);
1442
- let P = (e) => {
1494
+ let ee = (e) => {
1443
1495
  e.currentTarget.files && A(e.currentTarget.files), e.currentTarget.value = "";
1444
- }, F = async (e) => {
1496
+ }, P = async (e) => {
1445
1497
  try {
1446
1498
  let t = await (await fetch(e)).blob();
1447
1499
  return new Promise((e) => {
@@ -1451,7 +1503,7 @@ var Nr = ({ label: e = "Add photos or files", ...t }) => {
1451
1503
  } catch {
1452
1504
  return null;
1453
1505
  }
1454
- }, I = l(() => ({
1506
+ }, F = l(() => ({
1455
1507
  files: C.map((e) => ({
1456
1508
  ...e,
1457
1509
  id: e.id
@@ -1467,12 +1519,12 @@ var Nr = ({ label: e = "Add photos or files", ...t }) => {
1467
1519
  j,
1468
1520
  M,
1469
1521
  N
1470
- ]), L = /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("input", {
1522
+ ]), I = /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("input", {
1471
1523
  accept: t,
1472
1524
  "aria-label": r,
1473
1525
  className: "hidden",
1474
1526
  multiple: n,
1475
- onChange: P,
1527
+ onChange: ee,
1476
1528
  ref: y,
1477
1529
  title: r,
1478
1530
  type: "file"
@@ -1483,7 +1535,7 @@ var Nr = ({ label: e = "Add photos or files", ...t }) => {
1483
1535
  let t = e.currentTarget, n = v ? _.textInput.value : new FormData(t).get("message") || "";
1484
1536
  v || t.reset(), Promise.all(C.map(async ({ id: e, ...t }) => {
1485
1537
  if (t.url && t.url.startsWith("blob:")) {
1486
- let e = await F(t.url);
1538
+ let e = await P(t.url);
1487
1539
  return {
1488
1540
  ...t,
1489
1541
  url: e ?? t.url
@@ -1504,20 +1556,20 @@ var Nr = ({ label: e = "Add photos or files", ...t }) => {
1504
1556
  },
1505
1557
  ref: b,
1506
1558
  ...g,
1507
- children: /* @__PURE__ */ Q(gr, {
1559
+ children: /* @__PURE__ */ Q(Sr, {
1508
1560
  className: "overflow-hidden",
1509
1561
  children: h
1510
1562
  })
1511
1563
  })] });
1512
- return v ? L : /* @__PURE__ */ Q(kr.Provider, {
1513
- value: I,
1514
- children: L
1564
+ return v ? I : /* @__PURE__ */ Q(Fr.Provider, {
1565
+ value: F,
1566
+ children: I
1515
1567
  });
1516
- }, Fr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1568
+ }, Vr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1517
1569
  className: q("contents", e),
1518
1570
  ...t
1519
- }), Ir = ({ onChange: e, className: t, placeholder: n = "What would you like to know?", ...r }) => {
1520
- let i = Tr(), a = Ar(), [o, s] = d(!1), c = (e) => {
1571
+ }), Hr = ({ onChange: e, className: t, placeholder: n = "What would you like to know?", ...r }) => {
1572
+ let i = jr(), a = Ir(), [o, s] = d(!1), c = (e) => {
1521
1573
  if (e.key === "Enter") {
1522
1574
  if (o || e.nativeEvent.isComposing || e.shiftKey) return;
1523
1575
  e.preventDefault();
@@ -1545,7 +1597,7 @@ var Nr = ({ label: e = "Add photos or files", ...t }) => {
1545
1597
  i.textInput.setInput(t.currentTarget.value), e?.(t);
1546
1598
  }
1547
1599
  } : { onChange: e };
1548
- return /* @__PURE__ */ Q(xr, {
1600
+ return /* @__PURE__ */ Q(Dr, {
1549
1601
  className: q("field-sizing-content max-h-48 min-h-16", t),
1550
1602
  name: "message",
1551
1603
  onCompositionEnd: () => s(!1),
@@ -1556,43 +1608,43 @@ var Nr = ({ label: e = "Add photos or files", ...t }) => {
1556
1608
  ...r,
1557
1609
  ...u
1558
1610
  });
1559
- }, Lr = ({ className: e, ...t }) => /* @__PURE__ */ Q(vr, {
1611
+ }, Ur = ({ className: e, ...t }) => /* @__PURE__ */ Q(wr, {
1560
1612
  align: "block-end",
1561
1613
  className: q("order-first flex-wrap gap-1", e),
1562
1614
  ...t
1563
- }), Rr = ({ className: e, ...t }) => /* @__PURE__ */ Q(vr, {
1615
+ }), Wr = ({ className: e, ...t }) => /* @__PURE__ */ Q(wr, {
1564
1616
  align: "block-end",
1565
1617
  className: q("justify-between gap-1", e),
1566
1618
  ...t
1567
- }), zr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1619
+ }), Gr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1568
1620
  className: q("flex items-center gap-1", e),
1569
1621
  ...t
1570
- }), Br = ({ variant: e = "ghost", className: n, size: r, ...i }) => {
1622
+ }), Kr = ({ variant: e = "ghost", className: n, size: r, ...i }) => {
1571
1623
  let a = r ?? (t.count(i.children) > 1 ? "sm" : "icon-sm");
1572
- return /* @__PURE__ */ Q(br, {
1624
+ return /* @__PURE__ */ Q(Er, {
1573
1625
  className: q(n),
1574
1626
  size: a,
1575
1627
  type: "button",
1576
1628
  variant: e,
1577
1629
  ...i
1578
1630
  });
1579
- }, Vr = (e) => /* @__PURE__ */ Q(P, { ...e }), Hr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q(L, {
1631
+ }, qr = (e) => /* @__PURE__ */ Q(ee, { ...e }), Jr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q(I, {
1580
1632
  asChild: !0,
1581
- children: /* @__PURE__ */ Q(Br, {
1633
+ children: /* @__PURE__ */ Q(Kr, {
1582
1634
  className: e,
1583
1635
  ...n,
1584
1636
  children: t ?? /* @__PURE__ */ Q(st, { className: "size-4" })
1585
1637
  })
1586
- }), Ur = ({ className: e, ...t }) => /* @__PURE__ */ Q(F, {
1638
+ }), Yr = ({ className: e, ...t }) => /* @__PURE__ */ Q(P, {
1587
1639
  align: "start",
1588
1640
  className: q(e),
1589
1641
  ...t
1590
- }), Wr = ({ className: e, ...t }) => /* @__PURE__ */ Q(I, {
1642
+ }), Xr = ({ className: e, ...t }) => /* @__PURE__ */ Q(F, {
1591
1643
  className: q(e),
1592
1644
  ...t
1593
- }), Gr = ({ className: e, variant: t = "default", size: n = "icon-sm", status: r, children: i, ...a }) => {
1645
+ }), Zr = ({ className: e, variant: t = "default", size: n = "icon-sm", status: r, children: i, ...a }) => {
1594
1646
  let o = /* @__PURE__ */ Q(Je, { className: "size-4" });
1595
- return r === "submitted" ? o = /* @__PURE__ */ Q(nt, { className: "size-4 animate-spin" }) : r === "streaming" ? o = /* @__PURE__ */ Q(pt, { className: "size-4" }) : r === "error" && (o = /* @__PURE__ */ Q(bt, { className: "size-4" })), /* @__PURE__ */ Q(br, {
1647
+ return r === "submitted" ? o = /* @__PURE__ */ Q(nt, { className: "size-4 animate-spin" }) : r === "streaming" ? o = /* @__PURE__ */ Q(pt, { className: "size-4" }) : r === "error" && (o = /* @__PURE__ */ Q(bt, { className: "size-4" })), /* @__PURE__ */ Q(Er, {
1596
1648
  "aria-label": "Submit",
1597
1649
  className: q(e),
1598
1650
  size: n,
@@ -1601,7 +1653,7 @@ var Nr = ({ label: e = "Add photos or files", ...t }) => {
1601
1653
  ...a,
1602
1654
  children: i ?? o
1603
1655
  });
1604
- }, Kr = ({ className: e, textareaRef: t, onTranscriptionChange: n, ...r }) => {
1656
+ }, Qr = ({ className: e, textareaRef: t, onTranscriptionChange: n, ...r }) => {
1605
1657
  let [i, a] = d(!1), [s, l] = d(null), f = u(null);
1606
1658
  c(() => {
1607
1659
  if (typeof window < "u" && ("SpeechRecognition" in window || "webkitSpeechRecognition" in window)) {
@@ -1631,79 +1683,79 @@ var Nr = ({ label: e = "Add photos or files", ...t }) => {
1631
1683
  let p = o(() => {
1632
1684
  s && (i ? s.stop() : s.start());
1633
1685
  }, [s, i]);
1634
- return /* @__PURE__ */ Q(Br, {
1686
+ return /* @__PURE__ */ Q(Kr, {
1635
1687
  className: q("relative transition-all duration-200", i && "animate-pulse bg-accent text-accent-foreground", e),
1636
1688
  disabled: !s,
1637
1689
  onClick: p,
1638
1690
  ...r,
1639
1691
  children: /* @__PURE__ */ Q(it, { className: "size-4" })
1640
1692
  });
1641
- }, qr = (e) => /* @__PURE__ */ Q(ce, { ...e }), Jr = ({ className: e, ...t }) => /* @__PURE__ */ Q(de, {
1693
+ }, $r = (e) => /* @__PURE__ */ Q(le, { ...e }), ei = ({ className: e, ...t }) => /* @__PURE__ */ Q(fe, {
1642
1694
  className: q("border-none bg-transparent font-medium text-muted-foreground shadow-none transition-colors", "hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground", e),
1643
1695
  ...t
1644
- }), Yr = ({ className: e, ...t }) => /* @__PURE__ */ Q(le, {
1696
+ }), ti = ({ className: e, ...t }) => /* @__PURE__ */ Q(ue, {
1645
1697
  className: q(e),
1646
1698
  ...t
1647
- }), Xr = ({ className: e, ...t }) => /* @__PURE__ */ Q(ue, {
1699
+ }), ni = ({ className: e, ...t }) => /* @__PURE__ */ Q(de, {
1648
1700
  className: q(e),
1649
1701
  ...t
1650
- }), Zr = ({ className: e, ...t }) => /* @__PURE__ */ Q(fe, {
1702
+ }), ri = ({ className: e, ...t }) => /* @__PURE__ */ Q(pe, {
1651
1703
  className: q(e),
1652
1704
  ...t
1653
- }), Qr = ({ openDelay: e = 0, closeDelay: t = 0, ...n }) => /* @__PURE__ */ Q(z, {
1705
+ }), ii = ({ openDelay: e = 0, closeDelay: t = 0, ...n }) => /* @__PURE__ */ Q(R, {
1654
1706
  closeDelay: t,
1655
1707
  openDelay: e,
1656
1708
  ...n
1657
- }), $r = (e) => /* @__PURE__ */ Q(B, { ...e }), ei = ({ align: e = "start", ...t }) => /* @__PURE__ */ Q(ie, {
1709
+ }), ai = (e) => /* @__PURE__ */ Q(oe, { ...e }), oi = ({ align: e = "start", ...t }) => /* @__PURE__ */ Q(ae, {
1658
1710
  align: e,
1659
1711
  ...t
1660
- }), ti = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1712
+ }), si = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1661
1713
  className: q(e),
1662
1714
  ...t
1663
- }), ni = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1715
+ }), ci = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1664
1716
  className: q(e),
1665
1717
  ...t
1666
- }), ri = ({ className: e, ...t }) => /* @__PURE__ */ Q("h3", {
1718
+ }), li = ({ className: e, ...t }) => /* @__PURE__ */ Q("h3", {
1667
1719
  className: q("mb-2 px-3 font-medium text-muted-foreground text-xs", e),
1668
1720
  ...t
1669
- }), ii = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1721
+ }), ui = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1670
1722
  className: q("space-y-1", e),
1671
1723
  ...t
1672
- }), ai = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1724
+ }), di = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1673
1725
  className: q("flex items-center gap-2 px-3 py-2 text-xs hover:bg-accent", e),
1674
1726
  ...t
1675
- }), oi = ({ className: e, ...t }) => /* @__PURE__ */ Q(D, {
1727
+ }), fi = ({ className: e, ...t }) => /* @__PURE__ */ Q(D, {
1676
1728
  className: q(e),
1677
1729
  ...t
1678
- }), si = ({ className: e, ...t }) => /* @__PURE__ */ Q(A, {
1730
+ }), pi = ({ className: e, ...t }) => /* @__PURE__ */ Q(A, {
1679
1731
  className: q(e),
1680
1732
  ...t
1681
- }), ci = ({ className: e, ...t }) => /* @__PURE__ */ Q(M, {
1733
+ }), mi = ({ className: e, ...t }) => /* @__PURE__ */ Q(M, {
1682
1734
  className: q(e),
1683
1735
  ...t
1684
- }), li = ({ className: e, ...t }) => /* @__PURE__ */ Q(O, {
1736
+ }), hi = ({ className: e, ...t }) => /* @__PURE__ */ Q(O, {
1685
1737
  className: q(e),
1686
1738
  ...t
1687
- }), ui = ({ className: e, ...t }) => /* @__PURE__ */ Q(k, {
1739
+ }), gi = ({ className: e, ...t }) => /* @__PURE__ */ Q(k, {
1688
1740
  className: q(e),
1689
1741
  ...t
1690
- }), di = ({ className: e, ...t }) => /* @__PURE__ */ Q(j, {
1742
+ }), _i = ({ className: e, ...t }) => /* @__PURE__ */ Q(j, {
1691
1743
  className: q(e),
1692
1744
  ...t
1693
- }), fi = ({ className: e, ...t }) => /* @__PURE__ */ Q(N, {
1745
+ }), vi = ({ className: e, ...t }) => /* @__PURE__ */ Q(N, {
1694
1746
  className: q(e),
1695
1747
  ...t
1696
- }), pi = ({ className: e, children: t, ...n }) => /* @__PURE__ */ $(oe, {
1748
+ }), yi = ({ className: e, children: t, ...n }) => /* @__PURE__ */ $(se, {
1697
1749
  className: "w-full overflow-x-auto whitespace-nowrap",
1698
1750
  ...n,
1699
1751
  children: [/* @__PURE__ */ Q("div", {
1700
1752
  className: q("flex w-max flex-nowrap items-center gap-2", e),
1701
1753
  children: t
1702
- }), /* @__PURE__ */ Q(se, {
1754
+ }), /* @__PURE__ */ Q(ce, {
1703
1755
  className: "hidden",
1704
1756
  orientation: "horizontal"
1705
1757
  })]
1706
- }), mi = ({ suggestion: e, onClick: t, className: n, variant: r = "outline", size: i = "sm", children: a, ...o }) => /* @__PURE__ */ Q(v, {
1758
+ }), bi = ({ suggestion: e, onClick: t, className: n, variant: r = "outline", size: i = "sm", children: a, ...o }) => /* @__PURE__ */ Q(v, {
1707
1759
  className: q("cursor-pointer rounded-full px-4", n),
1708
1760
  onClick: () => {
1709
1761
  t?.(e);
@@ -1713,7 +1765,7 @@ var Nr = ({ label: e = "Add photos or files", ...t }) => {
1713
1765
  variant: r,
1714
1766
  ...o,
1715
1767
  children: a || e
1716
- }), hi = r({ code: "" }), gi = {
1768
+ }), xi = r({ code: "" }), Si = {
1717
1769
  name: "line-numbers",
1718
1770
  line(e, t) {
1719
1771
  e.children.unshift({
@@ -1734,8 +1786,8 @@ var Nr = ({ label: e = "Add photos or files", ...t }) => {
1734
1786
  });
1735
1787
  }
1736
1788
  };
1737
- async function _i(e, t, n = !1) {
1738
- let r = n ? [gi] : [];
1789
+ async function Ci(e, t, n = !1) {
1790
+ let r = n ? [Si] : [];
1739
1791
  return await Promise.all([Mt(e, {
1740
1792
  lang: t,
1741
1793
  theme: "one-light",
@@ -1746,9 +1798,9 @@ async function _i(e, t, n = !1) {
1746
1798
  transformers: r
1747
1799
  })]);
1748
1800
  }
1749
- var vi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, children: i, ...a }) => {
1801
+ var wi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, children: i, ...a }) => {
1750
1802
  let [o, s] = d(""), [l, f] = d(""), p = u(!1);
1751
- return c(() => (_i(e, t, n).then(([e, t]) => {
1803
+ return c(() => (Ci(e, t, n).then(([e, t]) => {
1752
1804
  p.current ||= (s(e), f(t), !0);
1753
1805
  }), () => {
1754
1806
  p.current = !1;
@@ -1756,7 +1808,7 @@ var vi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1756
1808
  e,
1757
1809
  t,
1758
1810
  n
1759
- ]), /* @__PURE__ */ Q(hi.Provider, {
1811
+ ]), /* @__PURE__ */ Q(xi.Provider, {
1760
1812
  value: { code: e },
1761
1813
  children: /* @__PURE__ */ Q("div", {
1762
1814
  className: q("group relative w-full overflow-hidden rounded-md border bg-background text-foreground", r),
@@ -1780,8 +1832,8 @@ var vi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1780
1832
  })
1781
1833
  })
1782
1834
  });
1783
- }, yi = ({ onCopy: e, onError: t, timeout: n = 2e3, children: r, className: i, ...a }) => {
1784
- let [o, c] = d(!1), { code: l } = s(hi), u = async () => {
1835
+ }, Ti = ({ onCopy: e, onError: t, timeout: n = 2e3, children: r, className: i, ...a }) => {
1836
+ let [o, c] = d(!1), { code: l } = s(xi), u = async () => {
1785
1837
  if (typeof window > "u" || !navigator?.clipboard?.writeText) {
1786
1838
  t?.(/* @__PURE__ */ Error("Clipboard API not available"));
1787
1839
  return;
@@ -1800,18 +1852,18 @@ var vi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1800
1852
  ...a,
1801
1853
  children: r ?? /* @__PURE__ */ Q(f, { size: 14 })
1802
1854
  });
1803
- }, bi = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
1855
+ }, Ei = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
1804
1856
  className: q("not-prose mb-4 w-full rounded-md border", e),
1805
1857
  ...t
1806
- }), xi = (e) => /* @__PURE__ */ $(_, {
1858
+ }), Di = (e) => /* @__PURE__ */ $(_, {
1807
1859
  className: "gap-1.5 rounded-full text-xs",
1808
1860
  variant: "secondary",
1809
1861
  children: [{
1810
1862
  "input-streaming": /* @__PURE__ */ Q(Be, { className: "size-4" }),
1811
1863
  "input-available": /* @__PURE__ */ Q(We, { className: "size-4 animate-pulse" }),
1812
1864
  "approval-requested": /* @__PURE__ */ Q(We, { className: "size-4 text-yellow-600" }),
1813
- "approval-responded": /* @__PURE__ */ Q(Fe, { className: "size-4 text-blue-600" }),
1814
- "output-available": /* @__PURE__ */ Q(Fe, { className: "size-4 text-green-600" }),
1865
+ "approval-responded": /* @__PURE__ */ Q(Y, { className: "size-4 text-blue-600" }),
1866
+ "output-available": /* @__PURE__ */ Q(Y, { className: "size-4 text-green-600" }),
1815
1867
  "output-error": /* @__PURE__ */ Q(yt, { className: "size-4 text-red-600" }),
1816
1868
  "output-denied": /* @__PURE__ */ Q(yt, { className: "size-4 text-orange-600" })
1817
1869
  }[e], {
@@ -1823,7 +1875,7 @@ var vi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1823
1875
  "output-error": "Error",
1824
1876
  "output-denied": "Denied"
1825
1877
  }[e]]
1826
- }), Si = ({ className: e, title: t, type: n, state: r, ...i }) => /* @__PURE__ */ $(E, {
1878
+ }), Oi = ({ className: e, title: t, type: n, state: r, ...i }) => /* @__PURE__ */ $(E, {
1827
1879
  className: q("flex w-full items-center justify-between gap-4 p-3", e),
1828
1880
  ...i,
1829
1881
  children: [/* @__PURE__ */ $("div", {
@@ -1834,13 +1886,13 @@ var vi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1834
1886
  className: "font-medium text-sm",
1835
1887
  children: t ?? n.split("-").slice(1).join("-")
1836
1888
  }),
1837
- xi(r)
1889
+ Di(r)
1838
1890
  ]
1839
1891
  }), /* @__PURE__ */ Q(Le, { className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" })]
1840
- }), Ci = ({ className: e, ...t }) => /* @__PURE__ */ Q(T, {
1892
+ }), ki = ({ className: e, ...t }) => /* @__PURE__ */ Q(T, {
1841
1893
  className: q("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", e),
1842
1894
  ...t
1843
- }), wi = ({ className: e, input: t, ...n }) => /* @__PURE__ */ $("div", {
1895
+ }), Ai = ({ className: e, input: t, ...n }) => /* @__PURE__ */ $("div", {
1844
1896
  className: q("space-y-2 overflow-hidden p-4", e),
1845
1897
  ...n,
1846
1898
  children: [/* @__PURE__ */ Q("h4", {
@@ -1848,18 +1900,18 @@ var vi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1848
1900
  children: "Parameters"
1849
1901
  }), /* @__PURE__ */ Q("div", {
1850
1902
  className: "rounded-md bg-muted/50",
1851
- children: /* @__PURE__ */ Q(vi, {
1903
+ children: /* @__PURE__ */ Q(wi, {
1852
1904
  code: JSON.stringify(t, null, 2),
1853
1905
  language: "json"
1854
1906
  })
1855
1907
  })]
1856
- }), Ti = ({ className: e, output: t, errorText: n, ...r }) => {
1908
+ }), ji = ({ className: e, output: t, errorText: n, ...r }) => {
1857
1909
  if (!(t || n)) return null;
1858
1910
  let a = /* @__PURE__ */ Q("div", { children: t });
1859
- return typeof t == "object" && !i(t) ? a = /* @__PURE__ */ Q(vi, {
1911
+ return typeof t == "object" && !i(t) ? a = /* @__PURE__ */ Q(wi, {
1860
1912
  code: JSON.stringify(t, null, 2),
1861
1913
  language: "json"
1862
- }) : typeof t == "string" && (a = /* @__PURE__ */ Q(vi, {
1914
+ }) : typeof t == "string" && (a = /* @__PURE__ */ Q(wi, {
1863
1915
  code: t,
1864
1916
  language: "json"
1865
1917
  })), /* @__PURE__ */ $("div", {
@@ -1873,7 +1925,7 @@ var vi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1873
1925
  children: [n && /* @__PURE__ */ Q("div", { children: n }), a]
1874
1926
  })]
1875
1927
  });
1876
- }, Ei = a(({ children: e, as: t = "p", className: n, duration: r = 2, spread: i = 2 }) => {
1928
+ }, Mi = a(({ children: e, as: t = "p", className: n, duration: r = 2, spread: i = 2 }) => {
1877
1929
  let a = Pt.create(t), o = l(() => (e?.length ?? 0) * i, [e, i]);
1878
1930
  return /* @__PURE__ */ Q(a, {
1879
1931
  animate: { backgroundPosition: "0% center" },
@@ -1890,11 +1942,11 @@ var vi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1890
1942
  },
1891
1943
  children: e
1892
1944
  });
1893
- }), Di = r(null), Oi = () => {
1894
- let e = s(Di);
1945
+ }), Ni = r(null), Pi = () => {
1946
+ let e = s(Ni);
1895
1947
  if (!e) throw Error("Reasoning components must be used within Reasoning");
1896
1948
  return e;
1897
- }, ki = 1e3, Ai = 1e3, ji = a(({ className: e, isStreaming: t = !1, open: n, defaultOpen: r = !0, onOpenChange: i, duration: a, children: o, ...s }) => {
1949
+ }, Fi = 1e3, Ii = 1e3, Li = a(({ className: e, isStreaming: t = !1, open: n, defaultOpen: r = !0, onOpenChange: i, duration: a, children: o, ...s }) => {
1898
1950
  let [l, u] = Nt({
1899
1951
  prop: n,
1900
1952
  defaultProp: r,
@@ -1904,7 +1956,7 @@ var vi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1904
1956
  defaultProp: void 0
1905
1957
  }), [m, h] = d(!1), [g, _] = d(null);
1906
1958
  return c(() => {
1907
- t ? g === null && _(Date.now()) : g !== null && (p(Math.ceil((Date.now() - g) / Ai)), _(null));
1959
+ t ? g === null && _(Date.now()) : g !== null && (p(Math.ceil((Date.now() - g) / Ii)), _(null));
1908
1960
  }, [
1909
1961
  t,
1910
1962
  g,
@@ -1913,7 +1965,7 @@ var vi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1913
1965
  if (r && !t && l && !m) {
1914
1966
  let e = setTimeout(() => {
1915
1967
  u(!1), h(!0);
1916
- }, ki);
1968
+ }, Fi);
1917
1969
  return () => clearTimeout(e);
1918
1970
  }
1919
1971
  }, [
@@ -1922,7 +1974,7 @@ var vi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1922
1974
  r,
1923
1975
  u,
1924
1976
  m
1925
- ]), /* @__PURE__ */ Q(Di.Provider, {
1977
+ ]), /* @__PURE__ */ Q(Ni.Provider, {
1926
1978
  value: {
1927
1979
  isStreaming: t,
1928
1980
  isOpen: l,
@@ -1939,36 +1991,36 @@ var vi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1939
1991
  children: o
1940
1992
  })
1941
1993
  });
1942
- }), Mi = (e, t) => e || t === 0 ? /* @__PURE__ */ Q(Ei, {
1994
+ }), Ri = (e, t) => e || t === 0 ? /* @__PURE__ */ Q(Mi, {
1943
1995
  duration: 1,
1944
1996
  children: "Thinking..."
1945
1997
  }) : t === void 0 ? /* @__PURE__ */ Q("p", { children: "Thought for a few seconds" }) : /* @__PURE__ */ $("p", { children: [
1946
1998
  "Thought for ",
1947
1999
  t,
1948
2000
  " seconds"
1949
- ] }), Ni = a(({ className: e, children: t, getThinkingMessage: n = Mi, ...r }) => {
1950
- let { isStreaming: i, isOpen: a, duration: o } = Oi();
2001
+ ] }), zi = a(({ className: e, children: t, getThinkingMessage: n = Ri, ...r }) => {
2002
+ let { isStreaming: i, isOpen: a, duration: o } = Pi();
1951
2003
  return /* @__PURE__ */ Q(E, {
1952
2004
  className: q("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground", e),
1953
2005
  ...r,
1954
2006
  children: t ?? /* @__PURE__ */ $(Z, { children: [
1955
- /* @__PURE__ */ Q(Ne, { className: "size-4" }),
2007
+ /* @__PURE__ */ Q(Pe, { className: "size-4" }),
1956
2008
  n(i, o),
1957
2009
  /* @__PURE__ */ Q(Le, { className: q("size-4 transition-transform", a ? "rotate-180" : "rotate-0") })
1958
2010
  ] })
1959
2011
  });
1960
- }), Pi = a(({ className: e, children: t, ...n }) => /* @__PURE__ */ Q(T, {
2012
+ }), Bi = a(({ className: e, children: t, ...n }) => /* @__PURE__ */ Q(T, {
1961
2013
  className: q("mt-4 text-sm", "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", e),
1962
2014
  ...n,
1963
2015
  children: /* @__PURE__ */ Q(At, { children: t })
1964
2016
  }));
1965
- ji.displayName = "Reasoning", Ni.displayName = "ReasoningTrigger", Pi.displayName = "ReasoningContent";
2017
+ Li.displayName = "Reasoning", zi.displayName = "ReasoningTrigger", Bi.displayName = "ReasoningContent";
1966
2018
  //#endregion
1967
2019
  //#region src/elements/sources.tsx
1968
- var Fi = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
2020
+ var Vi = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
1969
2021
  className: q("not-prose mb-4 text-primary text-xs", e),
1970
2022
  ...t
1971
- }), Ii = ({ className: e, count: t, children: n, ...r }) => /* @__PURE__ */ Q(E, {
2023
+ }), Hi = ({ className: e, count: t, children: n, ...r }) => /* @__PURE__ */ Q(E, {
1972
2024
  className: q("flex items-center gap-2", e),
1973
2025
  ...r,
1974
2026
  children: n ?? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ $("p", {
@@ -1979,23 +2031,23 @@ var Fi = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
1979
2031
  " sources"
1980
2032
  ]
1981
2033
  }), /* @__PURE__ */ Q(Le, { className: "h-4 w-4" })] })
1982
- }), Li = ({ className: e, ...t }) => /* @__PURE__ */ Q(T, {
2034
+ }), Ui = ({ className: e, ...t }) => /* @__PURE__ */ Q(T, {
1983
2035
  className: q("mt-3 flex w-fit flex-col gap-2", "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", e),
1984
2036
  ...t
1985
- }), Ri = ({ href: e, title: t, children: n, ...r }) => /* @__PURE__ */ Q("a", {
2037
+ }), Wi = ({ href: e, title: t, children: n, ...r }) => /* @__PURE__ */ Q("a", {
1986
2038
  className: "flex items-center gap-2",
1987
2039
  href: e,
1988
2040
  rel: "noreferrer",
1989
2041
  target: "_blank",
1990
2042
  ...r,
1991
- children: n ?? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q(je, { className: "h-4 w-4" }), /* @__PURE__ */ Q("span", {
2043
+ children: n ?? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q(Me, { className: "h-4 w-4" }), /* @__PURE__ */ Q("span", {
1992
2044
  className: "block font-medium",
1993
2045
  children: t
1994
2046
  })] })
1995
2047
  });
1996
2048
  //#endregion
1997
2049
  //#region src/ChatbotEnhanced.tsx
1998
- function zi(e) {
2050
+ function Gi(e) {
1999
2051
  let t = e ?? {}, n = t.data && typeof t.data == "object" ? t.data : t, r = n.seedApplied, i = n.probes;
2000
2052
  if (!r && !i) return;
2001
2053
  let a = {};
@@ -2009,10 +2061,10 @@ function zi(e) {
2009
2061
  message: String(e.message)
2010
2062
  }))), a;
2011
2063
  }
2012
- function Bi(e) {
2064
+ function Ki(e) {
2013
2065
  return e === "user" ? "user" : "assistant";
2014
2066
  }
2015
- function Vi(e) {
2067
+ function qi(e) {
2016
2068
  let t = e.trim();
2017
2069
  if (t.length < 2 || !(t.startsWith("{") || t.startsWith("[")) || !(t.endsWith("}") || t.endsWith("]"))) return !1;
2018
2070
  try {
@@ -2021,15 +2073,15 @@ function Vi(e) {
2021
2073
  return !1;
2022
2074
  }
2023
2075
  }
2024
- function Hi(e) {
2076
+ function Ji(e) {
2025
2077
  let t = Vt(e)?.status;
2026
2078
  return t === "changes_proposed" || t === "blueprint_proposed" || t === "awaiting_confirmation";
2027
2079
  }
2028
- function Ui(e) {
2080
+ function Yi(e) {
2029
2081
  let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available");
2030
- return t === "output-error" || t === "output-denied" ? "failed" : t === "approval-requested" || t === "approval-responded" ? "awaiting" : t === "output-available" ? Hi(e.result) ? "awaiting" : "completed" : "running";
2082
+ return t === "output-error" || t === "output-denied" ? "failed" : t === "approval-requested" || t === "approval-responded" ? "awaiting" : t === "output-available" ? Ji(e.result) ? "awaiting" : "completed" : "running";
2031
2083
  }
2032
- function Wi(e) {
2084
+ function Xi(e) {
2033
2085
  return [
2034
2086
  {
2035
2087
  create_object: "新建对象",
@@ -2045,13 +2097,13 @@ function Wi(e) {
2045
2097
  e.details
2046
2098
  ].filter(Boolean).join(" ");
2047
2099
  }
2048
- function Gi(e) {
2100
+ function Zi(e) {
2049
2101
  return e.toolName === "propose_blueprint";
2050
2102
  }
2051
- function Ki(e) {
2052
- return Gi(e) && Ui(e) === "completed" && !e.proposedPlan && !e.proposedChanges && !e.draftReview?.items.length;
2103
+ function Qi(e) {
2104
+ return Zi(e) && Yi(e) === "completed" && !e.proposedPlan && !e.proposedChanges && !e.draftReview?.items.length;
2053
2105
  }
2054
- var qi = [
2106
+ var $i = [
2055
2107
  "待补",
2056
2108
  "后续",
2057
2109
  "将在",
@@ -2077,25 +2129,25 @@ var qi = [
2077
2129
  "coming soon",
2078
2130
  "tbd"
2079
2131
  ];
2080
- function Ji(e) {
2132
+ function ea(e) {
2081
2133
  let t = [], n = [];
2082
2134
  for (let r of e) {
2083
2135
  if (typeof r != "string") continue;
2084
2136
  let e = r.trim();
2085
2137
  if (!e) continue;
2086
2138
  let i = e.toLowerCase();
2087
- qi.some((e) => i.includes(e)) ? n.push(e) : t.push(e);
2139
+ $i.some((e) => i.includes(e)) ? n.push(e) : t.push(e);
2088
2140
  }
2089
2141
  return {
2090
2142
  designNotes: t,
2091
2143
  deferred: n
2092
2144
  };
2093
2145
  }
2094
- function Yi(e) {
2095
- let t = Ui(e);
2096
- return t === "awaiting" || t === "failed" || !!e.pendingActionId || !!e.draftReview?.items.length || !!e.proposedPlan || !!e.proposedChanges || Ki(e);
2146
+ function ta(e) {
2147
+ let t = Yi(e);
2148
+ return t === "awaiting" || t === "failed" || !!e.pendingActionId || !!e.draftReview?.items.length || !!e.proposedPlan || !!e.proposedChanges || !!e.builderHandoff || Qi(e);
2097
2149
  }
2098
- function Xi(e) {
2150
+ function na(e) {
2099
2151
  switch (e) {
2100
2152
  case "failed": return 4;
2101
2153
  case "awaiting": return 3;
@@ -2103,20 +2155,20 @@ function Xi(e) {
2103
2155
  case "completed": return 1;
2104
2156
  }
2105
2157
  }
2106
- function Zi(e) {
2158
+ function ra(e) {
2107
2159
  return /^\((?:called [^)]*|tool call|no content)\)$/.test(e.trim());
2108
2160
  }
2109
- function Qi(e) {
2161
+ function ia(e) {
2110
2162
  let t = /* @__PURE__ */ new Map();
2111
2163
  for (let n of e) {
2112
- let e = Ui(n), r = `${n.toolName}:${e}`, i = t.get(r);
2164
+ let e = Yi(n), r = `${n.toolName}:${e}`, i = t.get(r);
2113
2165
  if (i) {
2114
2166
  i.count += 1, i.errorText = i.errorText ?? n.errorText;
2115
2167
  continue;
2116
2168
  }
2117
2169
  t.set(r, {
2118
2170
  key: r,
2119
- title: zn(n.toolName) || n.toolName,
2171
+ title: Gn(n.toolName) || n.toolName,
2120
2172
  rawName: n.toolName,
2121
2173
  count: 1,
2122
2174
  state: e,
@@ -2124,11 +2176,11 @@ function Qi(e) {
2124
2176
  });
2125
2177
  }
2126
2178
  return Array.from(t.values()).sort((e, t) => {
2127
- let n = Xi(t.state) - Xi(e.state);
2179
+ let n = na(t.state) - na(e.state);
2128
2180
  return n === 0 ? e.title.localeCompare(t.title) : n;
2129
2181
  });
2130
2182
  }
2131
- function $i({ health: e }) {
2183
+ function aa({ health: e }) {
2132
2184
  if (!e) return null;
2133
2185
  let t = e.issues ?? [], n = t.filter((e) => e.severity === "error"), r = t.filter((e) => e.severity !== "error"), i = e.checked, a = !!i && i.seeds + i.views + i.widgets > 0, o = [];
2134
2186
  if (typeof e.seededRows == "number" && e.seededRows > 0 && !e.seedError && o.push(`${e.seededRows} sample row${e.seededRows === 1 ? "" : "s"} live`), a && n.length === 0) {
@@ -2141,7 +2193,7 @@ function $i({ health: e }) {
2141
2193
  children: [
2142
2194
  o.length > 0 ? /* @__PURE__ */ $("div", {
2143
2195
  className: "flex items-center gap-1.5 text-xs text-emerald-700",
2144
- children: [/* @__PURE__ */ Q(Y, { className: "size-3.5 shrink-0" }), /* @__PURE__ */ Q("span", { children: o.join(" · ") })]
2196
+ children: [/* @__PURE__ */ Q(J, { className: "size-3.5 shrink-0" }), /* @__PURE__ */ Q("span", { children: o.join(" · ") })]
2145
2197
  }) : null,
2146
2198
  e.seedError ? /* @__PURE__ */ $("div", {
2147
2199
  className: "flex items-start gap-1.5 text-xs text-red-600",
@@ -2158,8 +2210,8 @@ function $i({ health: e }) {
2158
2210
  ]
2159
2211
  });
2160
2212
  }
2161
- var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, onClear: a, onStop: o, onReload: s, onUpgrade: c, disabled: l = !1, readOnly: u = !1, isLoading: d = !1, error: f, showTimestamp: p = !1, showAvatars: m = !1, userAvatarUrl: h, userAvatarFallback: g = "You", assistantAvatarUrl: _, assistantAvatarFallback: v = "AI", hideClearBar: y = !1, maxHeight: b = "500px", enableMarkdown: x = !0, enableFileUpload: S = !1, acceptedFileTypes: C = "image/*,.pdf,.doc,.docx,.txt,.csv,.tsv,.xlsx,.xlsm", maxFileSize: w = 10 * 1024 * 1024, suggestions: T, labels: E, models: D, selectedModelId: O, onModelChange: k, headerSlot: A, promptOverlaySlot: j, onInputChange: M, onToolApprove: N, toolApproveLabel: P = "Approve", toolDenyLabel: F = "Deny", toolDenyReason: I = "User denied the operation", toolDecisions: L, onReviewDraft: ee, toolReviewLabel: te = (e) => `Review ${e} change${e === 1 ? "" : "s"}`, onPublishDrafts: R, onOpenBuiltApp: ne, openBuiltAppLabel: re = "Open app", onPreviewDraftApp: z, previewDraftLabel: ie = "Preview", onDraftArtifacts: B, onBuildMaterialized: ae, publishDraftsLabel: V = "Publish", publishedLabel: oe = "Published", verifiedLabel: se = "Verified", nextStepsLabel: ce = "What's next", planTitleLabel: le = "Proposed plan", planExtendLabel: ue = "Adding to existing app", planQuestionsLabel: de = "Confirm before building", planAssumptionsLabel: fe = "Assumptions", planDeferredLabel: pe = "Not yet built", planApproveHintLabel: me = "Reply to approve or adjust this plan.", planApproveLabel: he = "Build it", planAdjustLabel: ge = "Adjust", planBuiltLabel: _e = "Built", planReadyLabel: ve = "The plan is ready. Build it now, or tell me what to adjust.", planApproveMessage: ye = "Looks good — build it as proposed.", planApproveDefaultsMessage: be = "Build it with your best assumptions; use sensible defaults for the open questions.", planAnswerMessage: xe = (e, t) => `For "${e}", go with: ${t}.`, fetchPendingDraftCount: H, autoPublishDrafts: U = !1, processVisibility: W = "summary", surface: Se = "card", ...Ce }, we) => {
2162
- let G = d ? "streaming" : "ready", K = Se === "plain", [Te, Ee] = e.useState(null), De = e.useRef(""), Oe = e.useRef(null), J = e.useMemo(() => ({
2213
+ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, onClear: a, onStop: o, onReload: s, onUpgrade: c, disabled: l = !1, readOnly: u = !1, isLoading: d = !1, error: f, showTimestamp: p = !1, showAvatars: m = !1, userAvatarUrl: h, userAvatarFallback: g = "You", assistantAvatarUrl: _, assistantAvatarFallback: v = "AI", hideClearBar: y = !1, maxHeight: b = "500px", enableMarkdown: x = !0, enableFileUpload: S = !1, acceptedFileTypes: C = "image/*,.pdf,.doc,.docx,.txt,.csv,.tsv,.xlsx,.xlsm", maxFileSize: w = 10 * 1024 * 1024, suggestions: T, labels: E, models: D, selectedModelId: O, onModelChange: k, headerSlot: A, promptOverlaySlot: j, onInputChange: M, onToolApprove: N, toolApproveLabel: ee = "Approve", toolDenyLabel: P = "Deny", toolDenyReason: F = "User denied the operation", toolDecisions: I, onReviewDraft: te, toolReviewLabel: ne = (e) => `Review ${e} change${e === 1 ? "" : "s"}`, onPublishDrafts: L, onOpenBuiltApp: re, openBuiltAppLabel: ie = "Open app", onPreviewDraftApp: R, previewDraftLabel: ae = "Preview", onDraftArtifacts: oe, onBuildMaterialized: z, publishDraftsLabel: B = "Publish", publishedLabel: se = "Published", verifiedLabel: ce = "Verified", nextStepsLabel: le = "What's next", planTitleLabel: ue = "Proposed plan", builderHandoffTitleLabel: de = "Build this in the Builder", builderHandoffOpenLabel: fe = "Open in Builder →", builderHandoffSupersededTitle: pe = "A newer request is available", onOpenBuilder: me, planExtendLabel: he = "Adding to existing app", planQuestionsLabel: ge = "Confirm before building", planAssumptionsLabel: _e = "Assumptions", planDeferredLabel: ve = "Not yet built", planApproveHintLabel: ye = "Reply to approve or adjust this plan.", planApproveLabel: be = "Build it", planAdjustLabel: xe = "Adjust", planBuiltLabel: Se = "Built", planReadyLabel: V = "The plan is ready. Build it now, or tell me what to adjust.", planApproveMessage: H = "Looks good — build it as proposed.", planApproveDefaultsMessage: Ce = "Build it with your best assumptions; use sensible defaults for the open questions.", planAnswerMessage: we = (e, t) => `For "${e}", go with: ${t}.`, fetchPendingDraftCount: U, autoPublishDrafts: Te = !1, processVisibility: W = "summary", surface: Ee = "card", ...De }, Oe) => {
2214
+ let G = d ? "streaming" : "ready", K = Ee === "plain", [Ae, je] = e.useState(null), Me = e.useRef(""), Pe = e.useRef(null), Y = e.useMemo(() => ({
2163
2215
  emptyTitle: E?.emptyTitle ?? "Start a conversation",
2164
2216
  emptyDescription: E?.emptyDescription ?? "Ask anything — the assistant has access to your current app context.",
2165
2217
  clear: E?.clear ?? "Clear",
@@ -2185,55 +2237,55 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2185
2237
  connectionStalledLabel: E?.connectionStalledLabel ?? "Still working…",
2186
2238
  connectionOfflineLabel: E?.connectionOfflineLabel ?? "Connection lost — reconnecting…",
2187
2239
  designingPlanLabel: E?.designingPlanLabel ?? "Designing your app…",
2188
- designingPlanHints: E?.designingPlanHints ?? la
2189
- }), [E]), [Ae, je] = e.useState(() => /* @__PURE__ */ new Set()), [Ne, Fe] = e.useState(() => /* @__PURE__ */ new Map()), [Ie, Le] = e.useState(() => /* @__PURE__ */ new Map()), Re = e.useRef(/* @__PURE__ */ new Set()), ze = e.useCallback(async (e) => {
2190
- if (H) try {
2191
- let t = await H(e);
2192
- Le((n) => {
2240
+ designingPlanHints: E?.designingPlanHints ?? ha
2241
+ }), [E]), [Ie, Le] = e.useState(() => /* @__PURE__ */ new Set()), [Re, ze] = e.useState(() => /* @__PURE__ */ new Map()), [Be, He] = e.useState(() => /* @__PURE__ */ new Map()), Ue = e.useRef(/* @__PURE__ */ new Set()), We = e.useCallback(async (e) => {
2242
+ if (U) try {
2243
+ let t = await U(e);
2244
+ He((n) => {
2193
2245
  if (n.get(e) === t) return n;
2194
2246
  let r = new Map(n);
2195
2247
  return r.set(e, t), r;
2196
2248
  });
2197
2249
  } catch {}
2198
- }, [H]);
2250
+ }, [U]);
2199
2251
  e.useEffect(() => {
2200
- if (!H || d) return;
2252
+ if (!U || d) return;
2201
2253
  let e = /* @__PURE__ */ new Set();
2202
2254
  for (let t of n) for (let n of t.toolInvocations ?? []) {
2203
2255
  let t = n.draftReview?.packageId, r = n.toolCallId;
2204
- t && r && !Re.current.has(r) && (Re.current.add(r), e.add(t));
2256
+ t && r && !Ue.current.has(r) && (Ue.current.add(r), e.add(t));
2205
2257
  }
2206
- for (let t of e) ze(t);
2258
+ for (let t of e) We(t);
2207
2259
  }, [
2208
2260
  n,
2209
2261
  d,
2210
- H,
2211
- ze
2262
+ U,
2263
+ We
2212
2264
  ]);
2213
- let Be = e.useCallback(async (e) => {
2214
- if (!R) return;
2265
+ let Ke = e.useCallback(async (e) => {
2266
+ if (!L) return;
2215
2267
  let t = [];
2216
2268
  for (let r of n) for (let n of r.toolInvocations ?? []) n.draftReview?.packageId === e && n.toolCallId && t.push(n.toolCallId);
2217
- let r = await R(e), i = r && typeof r == "object" ? r : void 0;
2269
+ let r = await L(e), i = r && typeof r == "object" ? r : void 0;
2218
2270
  if ((i ? i.ok !== !1 : r !== !1) && t.length > 0) {
2219
- je((e) => {
2271
+ Le((e) => {
2220
2272
  let n = new Set(e);
2221
2273
  for (let e of t) n.add(e);
2222
2274
  return n;
2223
2275
  });
2224
2276
  let e = i?.health;
2225
- e && Fe((n) => {
2277
+ e && ze((n) => {
2226
2278
  let r = new Map(n);
2227
2279
  for (let n of t) r.set(n, e);
2228
2280
  return r;
2229
2281
  });
2230
2282
  }
2231
- ze(e);
2283
+ We(e);
2232
2284
  }, [
2233
- R,
2285
+ L,
2234
2286
  n,
2235
- ze
2236
- ]), He = e.useRef(/* @__PURE__ */ new Set()), Ue = e.useRef(!1);
2287
+ We
2288
+ ]), Je = e.useRef(/* @__PURE__ */ new Set()), $e = e.useRef(!1);
2237
2289
  e.useEffect(() => {
2238
2290
  let e = [];
2239
2291
  for (let t of n) for (let n of t.toolInvocations ?? []) {
@@ -2243,27 +2295,27 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2243
2295
  packageId: t.packageId
2244
2296
  });
2245
2297
  }
2246
- if (!Ue.current) {
2247
- Ue.current = !0;
2248
- for (let t of e) He.current.add(t.key);
2298
+ if (!$e.current) {
2299
+ $e.current = !0;
2300
+ for (let t of e) Je.current.add(t.key);
2249
2301
  return;
2250
2302
  }
2251
- if (!U || !R || d) return;
2252
- let t = e.filter((e) => !He.current.has(e.key));
2303
+ if (!Te || !L || d) return;
2304
+ let t = e.filter((e) => !Je.current.has(e.key));
2253
2305
  if (t.length !== 0) {
2254
- for (let e of t) He.current.add(e.key);
2255
- for (let e of [...new Set(t.map((e) => e.packageId))]) Be(e);
2306
+ for (let e of t) Je.current.add(e.key);
2307
+ for (let e of [...new Set(t.map((e) => e.packageId))]) Ke(e);
2256
2308
  }
2257
2309
  }, [
2258
2310
  n,
2259
2311
  d,
2260
- U,
2261
- R,
2262
- Be
2312
+ Te,
2313
+ L,
2314
+ Ke
2263
2315
  ]);
2264
- let We = e.useRef(/* @__PURE__ */ new Set());
2316
+ let et = e.useRef(/* @__PURE__ */ new Set());
2265
2317
  e.useEffect(() => {
2266
- if (!B) return;
2318
+ if (!oe) return;
2267
2319
  let e = /* @__PURE__ */ new Map(), t;
2268
2320
  for (let r of n) {
2269
2321
  for (let t of r.buildProgress?.items ?? []) t?.type && t?.name && e.set(`${t.type}:${t.name}`, t);
@@ -2273,55 +2325,59 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2273
2325
  r?.packageId && r.items?.some((e) => e.type === "app") && (t = r.packageId);
2274
2326
  }
2275
2327
  }
2276
- let r = We.current, i = !1;
2328
+ let r = et.current, i = !1;
2277
2329
  for (let t of e.keys()) r.has(t) || (r.add(t), i = !0);
2278
- i && B([...e.values()], t);
2279
- }, [n, B]);
2280
- let Ke = e.useRef(/* @__PURE__ */ new Set());
2330
+ i && oe([...e.values()], t);
2331
+ }, [n, oe]);
2332
+ let tt = e.useRef(/* @__PURE__ */ new Set());
2281
2333
  e.useEffect(() => {
2282
- if (ae) for (let e of n) for (let t of e.toolInvocations ?? []) {
2334
+ if (z) for (let e of n) for (let t of e.toolInvocations ?? []) {
2283
2335
  let e = t.draftReview;
2284
2336
  if (!e?.materialized || !t.toolCallId) continue;
2285
2337
  let n = e.items.find((e) => e.type === "app");
2286
- !n || Ke.current.has(t.toolCallId) || (Ke.current.add(t.toolCallId), ae(n.name));
2338
+ !n || tt.current.has(t.toolCallId) || (tt.current.add(t.toolCallId), z(n.name));
2287
2339
  }
2288
- }, [n, ae]);
2289
- let Je = e.useCallback((e) => {
2340
+ }, [n, z]);
2341
+ let nt = e.useCallback((e) => {
2290
2342
  let t = !!e.text?.trim(), n = e.files?.map((e) => e.file).filter(Boolean), r = !!(n && n.length > 0);
2291
2343
  if (!(t || r)) return;
2292
2344
  let a = e.text?.trim() ?? "";
2293
- De.current = a, Oe.current = null, i?.(a, n);
2294
- }, [i]), $e = e.useCallback((e) => {
2345
+ Me.current = a, Pe.current = null, i?.(a, n);
2346
+ }, [i]), rt = e.useCallback((e) => {
2295
2347
  i?.(e);
2296
- }, [i]), et = e.useRef(null), tt = e.useCallback((e) => {
2297
- i?.(e ? be : ye);
2348
+ }, [i]), it = e.useRef(null), at = e.useCallback((e) => {
2349
+ i?.(e ? Ce : H);
2298
2350
  }, [
2299
2351
  i,
2300
- ye,
2301
- be
2302
- ]), nt = e.useCallback(() => {
2303
- let e = et.current?.querySelector("textarea");
2352
+ H,
2353
+ Ce
2354
+ ]), ot = e.useCallback(() => {
2355
+ let e = it.current?.querySelector("textarea");
2304
2356
  e && (e.focus(), e.scrollIntoView({ block: "nearest" }));
2305
2357
  }, []);
2306
2358
  e.useEffect(() => {
2307
- if (!f || !Wn(f) || Oe.current === f) return;
2308
- Oe.current = f;
2309
- let e = De.current;
2359
+ if (!f || !Xn(f) || Pe.current === f) return;
2360
+ Pe.current = f;
2361
+ let e = Me.current;
2310
2362
  if (!e) return;
2311
- let t = et.current?.querySelector("textarea");
2363
+ let t = it.current?.querySelector("textarea");
2312
2364
  t && t.value.trim() === "" && (t.value = e, t.dispatchEvent(new Event("input", { bubbles: !0 })), t.focus());
2313
2365
  }, [f]);
2314
- let rt = e.useCallback((e) => {
2315
- navigator.clipboard?.writeText(e.content), Ee(e.id), window.setTimeout(() => Ee((t) => t === e.id ? null : t), 1500);
2316
- }, []), it = e.useMemo(() => {
2366
+ let st = e.useCallback((e) => {
2367
+ navigator.clipboard?.writeText(e.content), je(e.id), window.setTimeout(() => je((t) => t === e.id ? null : t), 1500);
2368
+ }, []), ut = e.useMemo(() => {
2317
2369
  let e = /* @__PURE__ */ new Set(), t = [], r = -1, i = 0;
2318
- for (let e of n) for (let n of e.toolInvocations ?? []) (n.proposedPlan || Ki(n)) && n.toolCallId && t.push({
2370
+ for (let e of n) for (let n of e.toolInvocations ?? []) (n.proposedPlan || Qi(n)) && n.toolCallId && t.push({
2319
2371
  id: n.toolCallId,
2320
2372
  order: i
2321
2373
  }), n.toolName === "apply_blueprint" && (r = i), i += 1;
2322
2374
  for (let n of t) n.order < r && e.add(n.id);
2323
2375
  return e;
2324
- }, [n]), at = e.useMemo(() => {
2376
+ }, [n]), pt = e.useMemo(() => {
2377
+ let e;
2378
+ for (let t of n) for (let n of t.toolInvocations ?? []) n.builderHandoff && n.toolCallId && (e = n.toolCallId);
2379
+ return e;
2380
+ }, [n]), gt = e.useMemo(() => {
2325
2381
  let e = /* @__PURE__ */ new Set(), t = [], r = /* @__PURE__ */ new Map(), i = 0;
2326
2382
  for (let e of n) for (let n of e.toolInvocations ?? []) n.proposedChanges && n.toolCallId ? t.push({
2327
2383
  id: n.toolCallId,
@@ -2333,8 +2389,8 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2333
2389
  t !== void 0 && t > n.order && e.add(n.id);
2334
2390
  }
2335
2391
  return e;
2336
- }, [n]), ot = (e) => {
2337
- let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available"), n = `tool-${e.toolName}`, r = L?.[e.toolCallId], a = t === "approval-requested" && !!N && !r, o = t === "approval-requested" && !!e.pendingActionId, s = zn(e.toolName), c = Bn(e.result), l = W === "debug" && s && s.toLowerCase() !== e.toolName.toLowerCase(), u = W === "debug" || a, d = e.draftReview?.packageId, f = d === void 0 ? void 0 : Ie.get(d), p = f === void 0 ? Ae.has(e.toolCallId) : f === 0, m = t === "input-streaming" || t === "input-available", h = t === "output-available" && Hi(e.result) ? "approval-requested" : t, g = /* @__PURE__ */ $("span", {
2392
+ }, [n]), _t = (e) => {
2393
+ let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available"), n = `tool-${e.toolName}`, r = I?.[e.toolCallId], a = t === "approval-requested" && !!N && !r, o = t === "approval-requested" && !!e.pendingActionId, s = Gn(e.toolName), c = Kn(e.result), l = W === "debug" && s && s.toLowerCase() !== e.toolName.toLowerCase(), u = W === "debug" || a, d = e.draftReview?.packageId, f = d === void 0 ? void 0 : Be.get(d), p = f === void 0 ? Ie.has(e.toolCallId) : f === 0, m = t === "input-streaming" || t === "input-available", h = t === "output-available" && Ji(e.result) ? "approval-requested" : t, g = /* @__PURE__ */ $("span", {
2338
2394
  className: "inline-flex min-w-0 items-center gap-2",
2339
2395
  children: [
2340
2396
  /* @__PURE__ */ Q("span", { children: s || e.toolName }),
@@ -2342,22 +2398,22 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2342
2398
  className: "rounded bg-muted px-1 py-px text-[10px] font-mono text-muted-foreground",
2343
2399
  children: e.toolName
2344
2400
  }) : null,
2345
- m ? Gi(e) ? /* @__PURE__ */ Q(fa, {
2346
- label: J.designingPlanLabel,
2347
- hints: J.designingPlanHints,
2348
- offlineLabel: J.connectionOfflineLabel
2349
- }) : /* @__PURE__ */ Q(pa, { offlineLabel: J.connectionOfflineLabel }) : null
2401
+ m ? Zi(e) ? /* @__PURE__ */ Q(va, {
2402
+ label: Y.designingPlanLabel,
2403
+ hints: Y.designingPlanHints,
2404
+ offlineLabel: Y.connectionOfflineLabel
2405
+ }) : /* @__PURE__ */ Q(ya, { offlineLabel: Y.connectionOfflineLabel }) : null
2350
2406
  ]
2351
2407
  });
2352
- return /* @__PURE__ */ $(bi, {
2353
- defaultOpen: t === "output-error" || t === "approval-requested" || !!(e.draftReview && e.draftReview.items.length > 0) || !!e.proposedPlan || !!e.proposedChanges || Ki(e),
2354
- children: [/* @__PURE__ */ Q(Si, {
2408
+ return /* @__PURE__ */ $(Ei, {
2409
+ defaultOpen: t === "output-error" || t === "approval-requested" || !!(e.draftReview && e.draftReview.items.length > 0) || !!e.proposedPlan || !!e.proposedChanges || !!e.builderHandoff || Qi(e),
2410
+ children: [/* @__PURE__ */ Q(Oi, {
2355
2411
  type: n,
2356
2412
  state: h,
2357
2413
  title: g
2358
- }), /* @__PURE__ */ $(Ci, { children: [
2359
- u && e.args !== void 0 ? /* @__PURE__ */ Q(wi, { input: e.args }) : null,
2360
- o ? null : u || t === "output-error" ? /* @__PURE__ */ Q(Ca, {
2414
+ }), /* @__PURE__ */ $(ki, { children: [
2415
+ u && e.args !== void 0 ? /* @__PURE__ */ Q(Ai, { input: e.args }) : null,
2416
+ o ? null : u || t === "output-error" ? /* @__PURE__ */ Q(ka, {
2361
2417
  output: c,
2362
2418
  errorText: e.errorText
2363
2419
  }) : null,
@@ -2374,53 +2430,53 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2374
2430
  type: "button",
2375
2431
  onClick: () => N?.(e.toolCallId, !0),
2376
2432
  className: "inline-flex h-7 items-center rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
2377
- children: P
2433
+ children: ee
2378
2434
  }), /* @__PURE__ */ Q("button", {
2379
2435
  type: "button",
2380
- onClick: () => N?.(e.toolCallId, !1, I),
2436
+ onClick: () => N?.(e.toolCallId, !1, F),
2381
2437
  className: "inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent",
2382
- children: F
2438
+ children: P
2383
2439
  })]
2384
2440
  }) : null,
2385
- e.draftReview && e.draftReview.items.length > 0 && (ee || R && e.draftReview.packageId) ? /* @__PURE__ */ $(Z, { children: [
2441
+ e.draftReview && e.draftReview.items.length > 0 && (te || L && e.draftReview.packageId) ? /* @__PURE__ */ $(Z, { children: [
2386
2442
  /* @__PURE__ */ $("div", {
2387
- className: "flex items-center gap-2 p-3 border-t bg-muted/30",
2443
+ className: "flex flex-wrap items-center gap-2 p-3 border-t bg-muted/30",
2388
2444
  children: [
2389
- R && e.draftReview.packageId ? p ? /* @__PURE__ */ $("span", {
2445
+ L && e.draftReview.packageId ? p ? /* @__PURE__ */ $("span", {
2390
2446
  className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700",
2391
2447
  children: [
2392
- /* @__PURE__ */ Q(Y, { className: "size-3.5" }),
2393
- oe,
2448
+ /* @__PURE__ */ Q(J, { className: "size-3.5" }),
2449
+ se,
2394
2450
  e.draftReview.failedCount ? ` · ${e.draftReview.failedCount} need${e.draftReview.failedCount === 1 ? "s" : ""} attention` : ""
2395
2451
  ]
2396
2452
  }) : /* @__PURE__ */ $("button", {
2397
2453
  type: "button",
2398
- onClick: () => void Be(e.draftReview.packageId),
2454
+ onClick: () => void Ke(e.draftReview.packageId),
2399
2455
  className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
2400
2456
  "data-testid": "draft-publish",
2401
2457
  children: [
2402
2458
  /* @__PURE__ */ Q(lt, { className: "size-3.5" }),
2403
- V,
2459
+ B,
2404
2460
  typeof f == "number" && f > 0 ? ` (${f})` : ""
2405
2461
  ]
2406
2462
  }) : null,
2407
- ee ? /* @__PURE__ */ $("button", {
2463
+ te ? /* @__PURE__ */ $("button", {
2408
2464
  type: "button",
2409
- onClick: () => ee(e.draftReview.items),
2410
- className: R && e.draftReview.packageId ? "inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted" : "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
2411
- children: [/* @__PURE__ */ Q(Xe, { className: "size-3.5" }), te(e.draftReview.items.length)]
2465
+ onClick: () => te(e.draftReview.items),
2466
+ className: L && e.draftReview.packageId ? "inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted" : "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
2467
+ children: [/* @__PURE__ */ Q(Xe, { className: "size-3.5" }), ne(e.draftReview.items.length)]
2412
2468
  }) : null,
2413
- z && !p ? (() => {
2469
+ R && !p ? (() => {
2414
2470
  let t = e.draftReview.items.find((e) => e.type === "app");
2415
2471
  return t ? /* @__PURE__ */ $("button", {
2416
2472
  type: "button",
2417
- onClick: () => z(t.name, {
2473
+ onClick: () => R(t.name, {
2418
2474
  materialized: e.draftReview.materialized === !0,
2419
2475
  appSegment: e.draftReview.packageId
2420
2476
  }),
2421
2477
  className: "inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted",
2422
2478
  "data-testid": "draft-preview-app",
2423
- children: [/* @__PURE__ */ Q(Ye, { className: "size-3.5" }), ie]
2479
+ children: [/* @__PURE__ */ Q(Ye, { className: "size-3.5" }), ae]
2424
2480
  }) : null;
2425
2481
  })() : null,
2426
2482
  e.draftReview.verification ? e.draftReview.verification.errors > 0 ? /* @__PURE__ */ $("span", {
@@ -2430,10 +2486,10 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2430
2486
  }) : /* @__PURE__ */ $("span", {
2431
2487
  className: "inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-2.5 text-xs font-medium text-emerald-700",
2432
2488
  "data-testid": "draft-verification-chip",
2433
- children: [/* @__PURE__ */ Q(dt, { className: "size-3.5" }), se]
2489
+ children: [/* @__PURE__ */ Q(dt, { className: "size-3.5" }), ce]
2434
2490
  }) : null,
2435
2491
  e.draftReview.summary ? /* @__PURE__ */ Q("span", {
2436
- className: "truncate text-xs text-muted-foreground",
2492
+ className: "min-w-0 flex-1 truncate text-xs text-muted-foreground",
2437
2493
  children: e.draftReview.summary
2438
2494
  }) : null
2439
2495
  ]
@@ -2449,13 +2505,13 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2449
2505
  children: [/* @__PURE__ */ Q(ke, { className: "mt-0.5 size-3.5 shrink-0" }), /* @__PURE__ */ Q("span", { children: e.message })]
2450
2506
  }, `w${t}`))]
2451
2507
  }) : null,
2452
- Ae.has(e.toolCallId) ? /* @__PURE__ */ Q($i, { health: Ne.get(e.toolCallId) }) : null,
2508
+ Ie.has(e.toolCallId) ? /* @__PURE__ */ Q(aa, { health: Re.get(e.toolCallId) }) : null,
2453
2509
  e.draftReview.nextSteps && e.draftReview.nextSteps.length > 0 ? /* @__PURE__ */ $("div", {
2454
2510
  className: "flex flex-col gap-1 border-t bg-muted/20 px-3 py-2",
2455
2511
  "data-testid": "draft-next-steps",
2456
2512
  children: [/* @__PURE__ */ Q("span", {
2457
2513
  className: "text-xs font-medium text-foreground/80",
2458
- children: ce
2514
+ children: le
2459
2515
  }), e.draftReview.nextSteps.map((e, t) => /* @__PURE__ */ $("div", {
2460
2516
  className: "flex items-start gap-1.5 text-xs text-muted-foreground",
2461
2517
  children: [/* @__PURE__ */ Q("span", {
@@ -2465,20 +2521,46 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2465
2521
  }, t))]
2466
2522
  }) : null
2467
2523
  ] }) : null,
2524
+ e.builderHandoff ? /* @__PURE__ */ $("div", {
2525
+ className: "flex flex-col gap-2 border-t bg-muted/20 px-3 py-2.5",
2526
+ "data-testid": "builder-handoff",
2527
+ children: [
2528
+ /* @__PURE__ */ $("span", {
2529
+ className: "inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80",
2530
+ children: [/* @__PURE__ */ Q(ft, { className: "size-3.5" }), de]
2531
+ }),
2532
+ /* @__PURE__ */ Q("p", {
2533
+ className: "text-xs text-muted-foreground",
2534
+ children: e.builderHandoff.prompt
2535
+ }),
2536
+ (() => {
2537
+ let t = !!pt && e.toolCallId !== pt;
2538
+ return /* @__PURE__ */ Q("button", {
2539
+ type: "button",
2540
+ onClick: () => me?.(e.builderHandoff),
2541
+ disabled: !me || t,
2542
+ "data-testid": t ? "builder-handoff-superseded" : "builder-handoff-open",
2543
+ title: t ? pe : void 0,
2544
+ className: "inline-flex w-fit items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-50",
2545
+ children: fe
2546
+ });
2547
+ })()
2548
+ ]
2549
+ }) : null,
2468
2550
  e.proposedPlan ? /* @__PURE__ */ $("div", {
2469
2551
  className: "flex flex-col gap-2 border-t bg-muted/20 px-3 py-2.5",
2470
2552
  "data-testid": "proposed-plan",
2471
2553
  children: [
2472
2554
  /* @__PURE__ */ $("span", {
2473
2555
  className: "inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80",
2474
- children: [/* @__PURE__ */ Q(Ve, { className: "size-3.5" }), le]
2556
+ children: [/* @__PURE__ */ Q(Ve, { className: "size-3.5" }), ue]
2475
2557
  }),
2476
2558
  e.proposedPlan.targetApp ? /* @__PURE__ */ $("span", {
2477
2559
  className: "inline-flex w-fit items-center gap-1 rounded-md border border-blue-200 bg-blue-50 px-2 py-0.5 text-[11px] font-medium text-blue-700 dark:border-blue-900/50 dark:bg-blue-950/30 dark:text-blue-300",
2478
2560
  "data-testid": "proposed-plan-extend",
2479
2561
  children: [
2480
2562
  "+ ",
2481
- ue,
2563
+ he,
2482
2564
  " 「",
2483
2565
  e.proposedPlan.targetApp,
2484
2566
  "」"
@@ -2511,13 +2593,13 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2511
2593
  }) : null;
2512
2594
  })(),
2513
2595
  (() => {
2514
- let { designNotes: t, deferred: n } = Ji(e.proposedPlan.assumptions);
2596
+ let { designNotes: t, deferred: n } = ea(e.proposedPlan.assumptions);
2515
2597
  return /* @__PURE__ */ $(Z, { children: [t.length > 0 ? /* @__PURE__ */ $("div", {
2516
2598
  className: "flex flex-col gap-0.5",
2517
2599
  "data-testid": "proposed-plan-assumptions",
2518
2600
  children: [/* @__PURE__ */ Q("span", {
2519
2601
  className: "text-[11px] font-medium text-foreground/70",
2520
- children: fe
2602
+ children: _e
2521
2603
  }), t.map((e, t) => /* @__PURE__ */ $("div", {
2522
2604
  className: "flex items-start gap-1.5 text-[11px] text-muted-foreground",
2523
2605
  children: [/* @__PURE__ */ Q("span", {
@@ -2530,7 +2612,7 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2530
2612
  "data-testid": "proposed-plan-deferred",
2531
2613
  children: [/* @__PURE__ */ $("span", {
2532
2614
  className: "inline-flex items-center gap-1.5 text-[11px] font-medium text-amber-800 dark:text-amber-300",
2533
- children: [/* @__PURE__ */ Q(Qe, { className: "size-3.5" }), pe]
2615
+ children: [/* @__PURE__ */ Q(Qe, { className: "size-3.5" }), ve]
2534
2616
  }), n.map((e, t) => /* @__PURE__ */ $("div", {
2535
2617
  className: "flex items-start gap-1.5 text-[11px] text-amber-900/90 dark:text-amber-200/90",
2536
2618
  children: [/* @__PURE__ */ Q("span", {
@@ -2545,7 +2627,7 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2545
2627
  "data-testid": "proposed-plan-questions",
2546
2628
  children: [/* @__PURE__ */ $("span", {
2547
2629
  className: "inline-flex items-center gap-1.5 text-[11px] font-medium text-amber-800 dark:text-amber-300",
2548
- children: [/* @__PURE__ */ Q(Ze, { className: "size-3.5" }), de]
2630
+ children: [/* @__PURE__ */ Q(Ze, { className: "size-3.5" }), ge]
2549
2631
  }), e.proposedPlan.questions.map((t, n) => {
2550
2632
  let r = e.proposedPlan.questionChoices?.find((e) => e.text === t);
2551
2633
  return /* @__PURE__ */ $("div", {
@@ -2561,7 +2643,7 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2561
2643
  "data-testid": "proposed-plan-choice",
2562
2644
  children: r.options.map((e, n) => /* @__PURE__ */ Q("button", {
2563
2645
  type: "button",
2564
- onClick: () => i(xe(t, e)),
2646
+ onClick: () => i(we(t, e)),
2565
2647
  className: "inline-flex h-6 items-center rounded-full border border-amber-300 bg-background px-2 text-[11px] font-medium text-amber-900 hover:bg-amber-100 dark:border-amber-800 dark:text-amber-200 dark:hover:bg-amber-900/40",
2566
2648
  children: e
2567
2649
  }, n))
@@ -2569,75 +2651,75 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2569
2651
  }, n);
2570
2652
  })]
2571
2653
  }) : null,
2572
- i ? it.has(e.toolCallId) ? /* @__PURE__ */ Q("div", {
2654
+ i ? ut.has(e.toolCallId) ? /* @__PURE__ */ Q("div", {
2573
2655
  className: "flex flex-wrap items-center gap-1.5 pt-0.5",
2574
2656
  "data-testid": "proposed-plan-actions",
2575
2657
  children: /* @__PURE__ */ $("span", {
2576
2658
  className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300",
2577
2659
  "data-testid": "proposed-plan-built",
2578
- children: [/* @__PURE__ */ Q(Y, { className: "size-3.5" }), _e]
2660
+ children: [/* @__PURE__ */ Q(J, { className: "size-3.5" }), Se]
2579
2661
  })
2580
2662
  }) : /* @__PURE__ */ $("div", {
2581
2663
  className: "flex flex-wrap items-center gap-1.5 pt-0.5",
2582
2664
  "data-testid": "proposed-plan-actions",
2583
2665
  children: [/* @__PURE__ */ $("button", {
2584
2666
  type: "button",
2585
- onClick: () => tt(e.proposedPlan.questions.length > 0),
2667
+ onClick: () => at(e.proposedPlan.questions.length > 0),
2586
2668
  className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
2587
2669
  "data-testid": "proposed-plan-approve",
2588
- children: [/* @__PURE__ */ Q(lt, { className: "size-3.5" }), he]
2670
+ children: [/* @__PURE__ */ Q(lt, { className: "size-3.5" }), be]
2589
2671
  }), /* @__PURE__ */ Q("button", {
2590
2672
  type: "button",
2591
- onClick: nt,
2673
+ onClick: ot,
2592
2674
  className: "inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent",
2593
2675
  "data-testid": "proposed-plan-adjust",
2594
- children: ge
2676
+ children: xe
2595
2677
  })]
2596
2678
  }) : /* @__PURE__ */ Q("span", {
2597
2679
  className: "text-[11px] italic text-muted-foreground/80",
2598
- children: me
2680
+ children: ye
2599
2681
  })
2600
2682
  ]
2601
2683
  }) : null,
2602
- Ki(e) ? /* @__PURE__ */ $("div", {
2684
+ Qi(e) ? /* @__PURE__ */ $("div", {
2603
2685
  className: "flex flex-col gap-2 border-t bg-muted/20 px-3 py-2.5",
2604
2686
  "data-testid": "proposed-plan-fallback",
2605
2687
  children: [
2606
2688
  /* @__PURE__ */ $("span", {
2607
2689
  className: "inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80",
2608
- children: [/* @__PURE__ */ Q(Ve, { className: "size-3.5" }), le]
2690
+ children: [/* @__PURE__ */ Q(Ve, { className: "size-3.5" }), ue]
2609
2691
  }),
2610
2692
  /* @__PURE__ */ Q("p", {
2611
2693
  className: "text-xs text-muted-foreground",
2612
- children: ve
2694
+ children: V
2613
2695
  }),
2614
- i ? it.has(e.toolCallId) ? /* @__PURE__ */ Q("div", {
2696
+ i ? ut.has(e.toolCallId) ? /* @__PURE__ */ Q("div", {
2615
2697
  className: "flex flex-wrap items-center gap-1.5 pt-0.5",
2616
2698
  "data-testid": "proposed-plan-actions",
2617
2699
  children: /* @__PURE__ */ $("span", {
2618
2700
  className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300",
2619
2701
  "data-testid": "proposed-plan-built",
2620
- children: [/* @__PURE__ */ Q(Y, { className: "size-3.5" }), _e]
2702
+ children: [/* @__PURE__ */ Q(J, { className: "size-3.5" }), Se]
2621
2703
  })
2622
2704
  }) : /* @__PURE__ */ $("div", {
2623
2705
  className: "flex flex-wrap items-center gap-1.5 pt-0.5",
2624
2706
  "data-testid": "proposed-plan-actions",
2625
2707
  children: [/* @__PURE__ */ $("button", {
2626
2708
  type: "button",
2627
- onClick: () => tt(!1),
2709
+ onClick: () => at(!1),
2628
2710
  className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
2629
2711
  "data-testid": "proposed-plan-approve",
2630
- children: [/* @__PURE__ */ Q(lt, { className: "size-3.5" }), he]
2712
+ children: [/* @__PURE__ */ Q(lt, { className: "size-3.5" }), be]
2631
2713
  }), /* @__PURE__ */ Q("button", {
2632
2714
  type: "button",
2633
- onClick: nt,
2715
+ onClick: ot,
2634
2716
  className: "inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent",
2635
2717
  "data-testid": "proposed-plan-adjust",
2636
- children: ge
2718
+ children: xe
2637
2719
  })]
2638
2720
  }) : /* @__PURE__ */ Q("span", {
2639
2721
  className: "text-[11px] italic text-muted-foreground/80",
2640
- children: me
2722
+ children: ye
2641
2723
  })
2642
2724
  ]
2643
2725
  }) : null,
@@ -2657,16 +2739,16 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2657
2739
  className: "flex flex-col gap-1",
2658
2740
  children: e.proposedChanges.changes.map((e, t) => /* @__PURE__ */ $("div", {
2659
2741
  className: "flex items-start gap-1.5 rounded-md border bg-background px-2 py-1 text-[11px] text-foreground/80",
2660
- children: [/* @__PURE__ */ Q(mt, { className: "mt-px size-3 shrink-0 text-foreground/40" }), /* @__PURE__ */ Q("span", { children: Wi(e) })]
2742
+ children: [/* @__PURE__ */ Q(mt, { className: "mt-px size-3 shrink-0 text-foreground/40" }), /* @__PURE__ */ Q("span", { children: Xi(e) })]
2661
2743
  }, t))
2662
2744
  }),
2663
- i ? at.has(e.toolCallId) ? /* @__PURE__ */ Q("div", {
2745
+ i ? gt.has(e.toolCallId) ? /* @__PURE__ */ Q("div", {
2664
2746
  className: "flex flex-wrap items-center gap-1.5 pt-0.5",
2665
2747
  "data-testid": "proposed-changes-actions",
2666
2748
  children: /* @__PURE__ */ $("span", {
2667
2749
  className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300",
2668
2750
  "data-testid": "proposed-changes-confirmed",
2669
- children: [/* @__PURE__ */ Q(Y, { className: "size-3.5" }), "已确认"]
2751
+ children: [/* @__PURE__ */ Q(J, { className: "size-3.5" }), "已确认"]
2670
2752
  })
2671
2753
  }) : /* @__PURE__ */ $("div", {
2672
2754
  className: "flex flex-wrap items-center gap-1.5 pt-0.5",
@@ -2676,10 +2758,10 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2676
2758
  onClick: () => i("确认修改,应用你刚才提议的改动。"),
2677
2759
  className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
2678
2760
  "data-testid": "proposed-changes-confirm",
2679
- children: [/* @__PURE__ */ Q(Y, { className: "size-3.5" }), "确认修改"]
2761
+ children: [/* @__PURE__ */ Q(J, { className: "size-3.5" }), "确认修改"]
2680
2762
  }), /* @__PURE__ */ Q("button", {
2681
2763
  type: "button",
2682
- onClick: nt,
2764
+ onClick: ot,
2683
2765
  className: "inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent",
2684
2766
  "data-testid": "proposed-changes-adjust",
2685
2767
  children: "调整"
@@ -2694,10 +2776,10 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2694
2776
  }, e.toolCallId);
2695
2777
  };
2696
2778
  return /* @__PURE__ */ $("div", {
2697
- ref: we,
2779
+ ref: Oe,
2698
2780
  className: q(K ? "flex min-h-0 flex-col overflow-hidden bg-background" : "flex min-h-0 flex-col overflow-hidden rounded-lg border bg-background", t),
2699
2781
  style: { maxHeight: b },
2700
- ...Ce,
2782
+ ...De,
2701
2783
  children: [
2702
2784
  a && !y && n.length > 0 && /* @__PURE__ */ Q("div", {
2703
2785
  className: q("flex items-center justify-end px-4 py-2", K ? "bg-background" : "border-b bg-muted/30"),
@@ -2705,18 +2787,18 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2705
2787
  type: "button",
2706
2788
  onClick: a,
2707
2789
  className: "text-xs text-muted-foreground hover:text-foreground transition-colors",
2708
- children: J.clear
2790
+ children: Y.clear
2709
2791
  })
2710
2792
  }),
2711
2793
  A ? /* @__PURE__ */ Q("div", {
2712
2794
  className: q("shrink-0", !K && "border-b bg-background/50"),
2713
2795
  children: A
2714
2796
  }) : null,
2715
- /* @__PURE__ */ $(qn, {
2797
+ /* @__PURE__ */ $($n, {
2716
2798
  className: "flex-1 min-h-0",
2717
- children: [/* @__PURE__ */ $(Jn, {
2799
+ children: [/* @__PURE__ */ $(er, {
2718
2800
  className: q("space-y-4", K ? "mx-auto w-full max-w-2xl px-4 py-8 sm:px-0" : "px-4 py-3"),
2719
- children: [n.length === 0 ? /* @__PURE__ */ $(Yn, {
2801
+ children: [n.length === 0 ? /* @__PURE__ */ $(tr, {
2720
2802
  className: "gap-3 px-0 py-8",
2721
2803
  children: [
2722
2804
  /* @__PURE__ */ Q("div", {
@@ -2725,77 +2807,77 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2725
2807
  src: _,
2726
2808
  alt: "",
2727
2809
  className: "size-full rounded-md object-cover"
2728
- }) : /* @__PURE__ */ Q(Me, { className: "size-4" })
2810
+ }) : /* @__PURE__ */ Q(Ne, { className: "size-4" })
2729
2811
  }),
2730
2812
  /* @__PURE__ */ $("div", {
2731
2813
  className: "w-full max-w-full space-y-1",
2732
2814
  children: [/* @__PURE__ */ Q("h3", {
2733
2815
  className: "text-sm font-medium text-foreground/90 break-words",
2734
- children: J.emptyTitle
2816
+ children: Y.emptyTitle
2735
2817
  }), /* @__PURE__ */ Q("p", {
2736
2818
  className: "text-sm text-muted-foreground break-words",
2737
- children: J.emptyDescription
2819
+ children: Y.emptyDescription
2738
2820
  })]
2739
2821
  }),
2740
2822
  T && T.length > 0 ? /* @__PURE__ */ Q("div", {
2741
2823
  className: "flex w-full max-w-full flex-wrap justify-center gap-2",
2742
- children: T.map((e) => /* @__PURE__ */ Q(mi, {
2824
+ children: T.map((e) => /* @__PURE__ */ Q(bi, {
2743
2825
  className: "h-auto min-h-8 min-w-0 max-w-full whitespace-normal break-words rounded-full border-border/60 bg-background/80 px-3 py-1 text-left text-xs font-medium text-foreground/90 shadow-none hover:bg-muted/60",
2744
2826
  suggestion: e,
2745
- onClick: $e
2827
+ onClick: rt
2746
2828
  }, e))
2747
2829
  }) : null
2748
2830
  ]
2749
2831
  }) : n.map((e) => {
2750
- let t = e.role === "user", n = e.toolInvocations ?? [], r = e.reasoning?.trim(), i = e.sources ?? [], a = t ? void 0 : e.buildProgress, o = !t && !n.some((e) => !!e.proposedPlan) ? e.blueprintProgress : void 0, c = !t && !!e.streaming && !e.content && n.length === 0 && !r && !a && !o, l = !t && W === "summary" ? n.filter((e) => !Yi(e) && !(o && e.toolName === "propose_blueprint")) : [], u = !t && W === "debug" ? n : !t && W !== "debug" ? n.filter(Yi) : [];
2751
- return /* @__PURE__ */ Q(er, {
2752
- from: Bi(e.role),
2832
+ let t = e.role === "user", n = e.toolInvocations ?? [], r = e.reasoning?.trim(), i = e.sources ?? [], a = t ? void 0 : e.buildProgress, o = !t && !n.some((e) => !!e.proposedPlan) ? e.blueprintProgress : void 0, c = !t && W === "summary" ? n.filter((e) => !ta(e) && !(o && e.toolName === "propose_blueprint")) : [], l = !t && W === "debug" ? n : !t && W !== "debug" ? n.filter(ta) : [], u = !t && e.content.trim().length > 0 && !ra(e.content), d = W === "debug" && !!r, f = !t && !!e.streaming && !u && c.length === 0 && l.length === 0 && !d && !a && !o;
2833
+ return /* @__PURE__ */ Q(or, {
2834
+ from: Ki(e.role),
2753
2835
  children: /* @__PURE__ */ $("div", {
2754
2836
  className: q("flex w-full gap-2.5", m ? t ? "flex-row-reverse items-start" : "flex-row items-start" : "flex-col"),
2755
- children: [m ? /* @__PURE__ */ Q(ta, {
2837
+ children: [m ? /* @__PURE__ */ Q(sa, {
2756
2838
  isUser: t,
2757
2839
  url: t ? h : _,
2758
2840
  fallback: t ? g : v
2759
2841
  }) : null, /* @__PURE__ */ $("div", {
2760
2842
  className: q("flex min-w-0 flex-col gap-2", m && !t && "flex-1"),
2761
- children: [/* @__PURE__ */ $(tr, { children: [
2762
- o ? /* @__PURE__ */ Q(ga, {
2843
+ children: [/* @__PURE__ */ $(sr, { children: [
2844
+ o ? /* @__PURE__ */ Q(Sa, {
2763
2845
  progress: o,
2764
- designingLabel: J.designingPlanLabel,
2765
- extendLabel: ue,
2766
- waitingLabel: J.connectionWaiting,
2767
- stalledLabel: J.connectionStalledLabel,
2768
- offlineLabel: J.connectionOfflineLabel
2846
+ designingLabel: Y.designingPlanLabel,
2847
+ extendLabel: he,
2848
+ waitingLabel: Y.connectionWaiting,
2849
+ stalledLabel: Y.connectionStalledLabel,
2850
+ offlineLabel: Y.connectionOfflineLabel
2769
2851
  }) : null,
2770
- a ? /* @__PURE__ */ Q(_a, {
2852
+ a ? /* @__PURE__ */ Q(Ca, {
2771
2853
  progress: a,
2772
- onOpenBuiltApp: ne,
2773
- openBuiltAppLabel: re,
2774
- onPreviewDraftApp: z,
2775
- previewDraftLabel: ie,
2776
- waitingLabel: J.connectionWaiting,
2777
- stalledLabel: J.connectionStalledLabel,
2778
- offlineLabel: J.connectionOfflineLabel
2854
+ onOpenBuiltApp: re,
2855
+ openBuiltAppLabel: ie,
2856
+ onPreviewDraftApp: R,
2857
+ previewDraftLabel: ae,
2858
+ waitingLabel: Y.connectionWaiting,
2859
+ stalledLabel: Y.connectionStalledLabel,
2860
+ offlineLabel: Y.connectionOfflineLabel
2779
2861
  }) : null,
2780
- !t && W === "debug" && r ? /* @__PURE__ */ $(ji, {
2862
+ !t && W === "debug" && r ? /* @__PURE__ */ $(Li, {
2781
2863
  isStreaming: !!e.streaming && !e.content,
2782
2864
  className: "mb-2",
2783
- children: [/* @__PURE__ */ Q(Ni, {}), /* @__PURE__ */ Q(Pi, { children: r })]
2865
+ children: [/* @__PURE__ */ Q(zi, {}), /* @__PURE__ */ Q(Bi, { children: r })]
2784
2866
  }) : null,
2785
- !t && W === "summary" && l.length > 0 ? /* @__PURE__ */ Q(va, {
2786
- groups: Qi(l),
2787
- labels: J
2867
+ !t && W === "summary" && c.length > 0 ? /* @__PURE__ */ Q(wa, {
2868
+ groups: ia(c),
2869
+ labels: Y
2788
2870
  }) : null,
2789
- !t && u.length > 0 ? u.map(ot) : null,
2871
+ !t && l.length > 0 ? l.map(_t) : null,
2790
2872
  t ? e.content ? /* @__PURE__ */ Q("div", {
2791
2873
  className: "whitespace-pre-wrap break-words",
2792
2874
  children: e.content
2793
- }) : null : c ? /* @__PURE__ */ Q(ra, {}) : e.content ? Zi(e.content) ? /* @__PURE__ */ Q("span", {
2875
+ }) : null : f ? /* @__PURE__ */ Q(la, {}) : u ? /* @__PURE__ */ Q(vr, { children: e.content }) : !e.streaming && ra(e.content) ? /* @__PURE__ */ Q("span", {
2794
2876
  className: "text-xs italic text-muted-foreground/70",
2795
2877
  title: e.content,
2796
- children: J.agentActivity
2797
- }) : /* @__PURE__ */ Q(fr, { children: e.content }) : null,
2798
- e.streaming && !c ? /* @__PURE__ */ Q("span", {
2878
+ children: Y.agentActivity
2879
+ }) : null,
2880
+ e.streaming && u ? /* @__PURE__ */ Q("span", {
2799
2881
  "aria-hidden": !0,
2800
2882
  className: "ml-0.5 inline-block w-[2px] h-4 align-middle bg-current animate-pulse"
2801
2883
  }) : null,
@@ -2818,7 +2900,7 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2818
2900
  } })]
2819
2901
  }, t))
2820
2902
  }) : null,
2821
- !t && i.length > 0 ? /* @__PURE__ */ $(Fi, { children: [/* @__PURE__ */ Q(Ii, { count: i.length }), /* @__PURE__ */ Q(Li, { children: i.map((e, t) => /* @__PURE__ */ Q(Ri, {
2903
+ !t && i.length > 0 ? /* @__PURE__ */ $(Vi, { children: [/* @__PURE__ */ Q(Hi, { count: i.length }), /* @__PURE__ */ Q(Ui, { children: i.map((e, t) => /* @__PURE__ */ Q(Wi, {
2822
2904
  href: e.url,
2823
2905
  title: e.title ?? e.url
2824
2906
  }, e.id ?? e.url ?? t)) })] }) : null,
@@ -2826,18 +2908,18 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2826
2908
  className: "text-[10px] opacity-70 mt-1",
2827
2909
  children: e.timestamp
2828
2910
  }) : null
2829
- ] }), !t && !c ? /* @__PURE__ */ $(nr, {
2911
+ ] }), !t && !f ? /* @__PURE__ */ $(cr, {
2830
2912
  className: "opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",
2831
2913
  children: [
2832
- /* @__PURE__ */ Q(rr, {
2833
- label: Te === e.id ? J.copied : J.copy,
2834
- tooltip: Te === e.id ? J.copied : J.copy,
2835
- onClick: () => rt(e),
2836
- children: Te === e.id ? /* @__PURE__ */ Q(Pe, { className: "size-3.5" }) : /* @__PURE__ */ Q(Ge, { className: "size-3.5" })
2914
+ /* @__PURE__ */ Q(lr, {
2915
+ label: Ae === e.id ? Y.copied : Y.copy,
2916
+ tooltip: Ae === e.id ? Y.copied : Y.copy,
2917
+ onClick: () => st(e),
2918
+ children: Ae === e.id ? /* @__PURE__ */ Q(Fe, { className: "size-3.5" }) : /* @__PURE__ */ Q(Ge, { className: "size-3.5" })
2837
2919
  }),
2838
- s ? /* @__PURE__ */ Q(rr, {
2839
- label: J.regenerate,
2840
- tooltip: J.regenerate,
2920
+ s ? /* @__PURE__ */ Q(lr, {
2921
+ label: Y.regenerate,
2922
+ tooltip: Y.regenerate,
2841
2923
  onClick: s,
2842
2924
  children: /* @__PURE__ */ Q(ct, { className: "size-3.5" })
2843
2925
  }) : null,
@@ -2845,58 +2927,58 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2845
2927
  href: `#trace/${e.traceId}`,
2846
2928
  "data-trace-id": e.traceId,
2847
2929
  className: "text-[10px] text-muted-foreground hover:text-foreground ml-1 underline",
2848
- title: J.viewTrace,
2849
- children: J.trace
2930
+ title: Y.viewTrace,
2931
+ children: Y.trace
2850
2932
  }) : null
2851
2933
  ]
2852
2934
  }) : null]
2853
2935
  })]
2854
2936
  })
2855
2937
  }, e.id);
2856
- }), d && !n.some((e) => e.streaming) ? /* @__PURE__ */ Q(na, {
2938
+ }), d && !n.some((e) => e.streaming) ? /* @__PURE__ */ Q(ca, {
2857
2939
  showAvatar: m,
2858
2940
  assistantAvatarUrl: _,
2859
2941
  assistantAvatarFallback: v,
2860
- waitingLabel: J.connectionWaiting,
2861
- stalledLabel: J.connectionStalledLabel,
2862
- offlineLabel: J.connectionOfflineLabel
2942
+ waitingLabel: Y.connectionWaiting,
2943
+ stalledLabel: Y.connectionStalledLabel,
2944
+ offlineLabel: Y.connectionOfflineLabel
2863
2945
  }) : null]
2864
- }), /* @__PURE__ */ Q(Xn, {})]
2946
+ }), /* @__PURE__ */ Q(nr, {})]
2865
2947
  }),
2866
- f ? Wn(f) && !Un(f) ? /* @__PURE__ */ Q(xa, {
2948
+ f ? Xn(f) && !Yn(f) ? /* @__PURE__ */ Q(Da, {
2867
2949
  error: f,
2868
- rateLimitedLabel: J.sendFailedRateLimited,
2869
- genericLabel: J.sendFailedGeneric
2870
- }) : /* @__PURE__ */ Q(Sa, {
2950
+ rateLimitedLabel: Y.sendFailedRateLimited,
2951
+ genericLabel: Y.sendFailedGeneric
2952
+ }) : /* @__PURE__ */ Q(Oa, {
2871
2953
  error: f,
2872
2954
  onReload: s,
2873
2955
  onUpgrade: c
2874
2956
  }) : null,
2875
2957
  u ? null : /* @__PURE__ */ $("div", {
2876
- ref: et,
2958
+ ref: it,
2877
2959
  className: q("relative", K && "mx-auto w-full max-w-2xl px-4 pb-4 sm:px-0"),
2878
2960
  children: [j ? /* @__PURE__ */ Q("div", {
2879
2961
  className: "absolute bottom-full left-0 right-0 z-10 px-3 pb-1",
2880
2962
  children: j
2881
- }) : null, /* @__PURE__ */ $(Pr, {
2963
+ }) : null, /* @__PURE__ */ $(Br, {
2882
2964
  accept: C,
2883
- fileInputLabel: J.uploadFiles,
2965
+ fileInputLabel: Y.uploadFiles,
2884
2966
  maxFileSize: w,
2885
- onSubmit: Je,
2967
+ onSubmit: nt,
2886
2968
  onError: (e) => {
2887
2969
  console.warn("[plugin-chatbot] prompt-input error", e);
2888
2970
  },
2889
2971
  children: [
2890
- S ? /* @__PURE__ */ Q(Fr, { children: /* @__PURE__ */ Q(Mr, { children: (e) => /* @__PURE__ */ Q(jr, { data: e }) }) }) : null,
2891
- /* @__PURE__ */ Q(Ir, {
2972
+ S ? /* @__PURE__ */ Q(Vr, { children: /* @__PURE__ */ Q(Rr, { children: (e) => /* @__PURE__ */ Q(Lr, { data: e }) }) }) : null,
2973
+ /* @__PURE__ */ Q(Hr, {
2892
2974
  placeholder: r,
2893
2975
  disabled: l || G === "streaming",
2894
2976
  onChange: M ? (e) => M(e.currentTarget.value) : void 0
2895
2977
  }),
2896
- /* @__PURE__ */ $(Rr, { children: [/* @__PURE__ */ $(zr, { children: [
2897
- S ? /* @__PURE__ */ $(Vr, { children: [/* @__PURE__ */ Q(Hr, {}), /* @__PURE__ */ Q(Ur, { children: /* @__PURE__ */ Q(Nr, {}) })] }) : null,
2978
+ /* @__PURE__ */ $(Wr, { children: [/* @__PURE__ */ $(Gr, { children: [
2979
+ S ? /* @__PURE__ */ $(qr, { children: [/* @__PURE__ */ Q(Jr, {}), /* @__PURE__ */ Q(Yr, { children: /* @__PURE__ */ Q(zr, {}) })] }) : null,
2898
2980
  D && D.length > 1 ? /* @__PURE__ */ Q("select", {
2899
- "aria-label": J.model,
2981
+ "aria-label": Y.model,
2900
2982
  value: O ?? D[0].id,
2901
2983
  onChange: (e) => k?.(e.target.value),
2902
2984
  className: "h-7 rounded-md border bg-background px-2 text-xs text-muted-foreground hover:text-foreground focus:outline-none focus:ring-1 focus:ring-ring",
@@ -2908,20 +2990,13 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2908
2990
  /* @__PURE__ */ $("span", {
2909
2991
  className: "hidden items-center gap-1 text-[10px] text-muted-foreground sm:inline-flex",
2910
2992
  "aria-hidden": "true",
2911
- children: [
2912
- /* @__PURE__ */ Q("kbd", {
2913
- className: "inline-flex h-4 items-center rounded border bg-muted px-1 font-mono text-[10px] leading-none",
2914
- children: "⌘"
2915
- }),
2916
- /* @__PURE__ */ Q(qe, { className: "h-3 w-3" }),
2917
- /* @__PURE__ */ Q("span", {
2918
- className: "opacity-70",
2919
- children: J.sendHint
2920
- })
2921
- ]
2993
+ children: [/* @__PURE__ */ Q(qe, { className: "h-3 w-3" }), /* @__PURE__ */ Q("span", {
2994
+ className: "opacity-70",
2995
+ children: Y.sendHint
2996
+ })]
2922
2997
  })
2923
- ] }), /* @__PURE__ */ Q(Gr, {
2924
- "aria-label": G === "streaming" ? J.stopResponse : J.submit,
2998
+ ] }), /* @__PURE__ */ Q(Zr, {
2999
+ "aria-label": G === "streaming" ? Y.stopResponse : Y.submit,
2925
3000
  status: G,
2926
3001
  disabled: l,
2927
3002
  onClick: G === "streaming" ? o : void 0,
@@ -2933,8 +3008,8 @@ var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2933
3008
  ]
2934
3009
  });
2935
3010
  });
2936
- ea.displayName = "ChatbotEnhanced";
2937
- function ta({ isUser: e, url: t, fallback: n }) {
3011
+ oa.displayName = "ChatbotEnhanced";
3012
+ function sa({ isUser: e, url: t, fallback: n }) {
2938
3013
  return /* @__PURE__ */ Q("div", {
2939
3014
  className: q("mt-0.5 flex size-7 shrink-0 items-center justify-center overflow-hidden rounded-full text-[11px] font-medium", e ? "bg-secondary text-secondary-foreground" : "bg-primary/10 text-primary"),
2940
3015
  "aria-hidden": "true",
@@ -2942,24 +3017,24 @@ function ta({ isUser: e, url: t, fallback: n }) {
2942
3017
  src: t,
2943
3018
  alt: "",
2944
3019
  className: "size-full object-cover"
2945
- }) : e ? n?.trim()?.charAt(0)?.toUpperCase() || "U" : /* @__PURE__ */ Q(Me, { className: "size-4" })
3020
+ }) : e ? n?.trim()?.charAt(0)?.toUpperCase() || "U" : /* @__PURE__ */ Q(Ne, { className: "size-4" })
2946
3021
  });
2947
3022
  }
2948
- function na({ showAvatar: e, assistantAvatarUrl: t, assistantAvatarFallback: n, waitingLabel: r, stalledLabel: i, offlineLabel: a }) {
2949
- return /* @__PURE__ */ Q(er, {
3023
+ function ca({ showAvatar: e, assistantAvatarUrl: t, assistantAvatarFallback: n, waitingLabel: r, stalledLabel: i, offlineLabel: a }) {
3024
+ return /* @__PURE__ */ Q(or, {
2950
3025
  from: "assistant",
2951
3026
  "aria-live": "polite",
2952
3027
  children: /* @__PURE__ */ $("div", {
2953
3028
  className: q("flex w-full gap-2.5", e ? "flex-row items-start" : "flex-col"),
2954
- children: [e ? /* @__PURE__ */ Q(ta, {
3029
+ children: [e ? /* @__PURE__ */ Q(sa, {
2955
3030
  isUser: !1,
2956
3031
  url: t,
2957
3032
  fallback: n
2958
- }) : null, /* @__PURE__ */ Q(tr, {
3033
+ }) : null, /* @__PURE__ */ Q(sr, {
2959
3034
  className: "rounded-lg border bg-muted/30 px-3 py-2 text-muted-foreground",
2960
3035
  children: /* @__PURE__ */ $("span", {
2961
3036
  className: "inline-flex items-center gap-2",
2962
- children: [/* @__PURE__ */ Q(ra, {}), /* @__PURE__ */ Q(ca, {
3037
+ children: [/* @__PURE__ */ Q(la, {}), /* @__PURE__ */ Q(ma, {
2963
3038
  active: !0,
2964
3039
  pending: !0,
2965
3040
  activityKey: 0,
@@ -2972,7 +3047,7 @@ function na({ showAvatar: e, assistantAvatarUrl: t, assistantAvatarFallback: n,
2972
3047
  })
2973
3048
  });
2974
3049
  }
2975
- function ra() {
3050
+ function la() {
2976
3051
  return /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("span", {
2977
3052
  className: "sr-only",
2978
3053
  children: "Assistant is responding"
@@ -2986,12 +3061,12 @@ function ra() {
2986
3061
  ]
2987
3062
  })] });
2988
3063
  }
2989
- function ia(e) {
3064
+ function ua(e) {
2990
3065
  let t = Math.floor(e / 60), n = e % 60;
2991
3066
  return `${t}:${String(n).padStart(2, "0")}`;
2992
3067
  }
2993
- var aa = 6;
2994
- function oa(t, n) {
3068
+ var da = 6;
3069
+ function fa(t, n) {
2995
3070
  let r = e.useRef(0), i = e.useRef(0), [a, o] = e.useState({
2996
3071
  elapsed: 0,
2997
3072
  quiet: 0
@@ -3020,10 +3095,10 @@ function oa(t, n) {
3020
3095
  }, [t]), {
3021
3096
  elapsedSeconds: a.elapsed,
3022
3097
  quietSeconds: a.quiet,
3023
- live: a.quiet < aa
3098
+ live: a.quiet < da
3024
3099
  };
3025
3100
  }
3026
- function sa() {
3101
+ function pa() {
3027
3102
  let [t, n] = e.useState(() => typeof navigator < "u" && navigator.onLine === !1);
3028
3103
  return e.useEffect(() => {
3029
3104
  if (typeof window > "u") return;
@@ -3033,8 +3108,8 @@ function sa() {
3033
3108
  };
3034
3109
  }, []), t;
3035
3110
  }
3036
- function ca({ active: e, activityKey: t, pending: n = !1, waitingLabel: r, stalledLabel: i = "Still working…", offlineLabel: a = "Connection lost — reconnecting…" }) {
3037
- let { elapsedSeconds: o, quietSeconds: s, live: c } = oa(e, t), l = sa() ? "offline" : c ? n ? "waiting" : "receiving" : "stalled", u = ia(o);
3111
+ function ma({ active: e, activityKey: t, pending: n = !1, waitingLabel: r, stalledLabel: i = "Still working…", offlineLabel: a = "Connection lost — reconnecting…" }) {
3112
+ let { elapsedSeconds: o, quietSeconds: s, live: c } = fa(e, t), l = pa() ? "offline" : c ? n ? "waiting" : "receiving" : "stalled", u = ua(o);
3038
3113
  return /* @__PURE__ */ $("span", {
3039
3114
  className: q("inline-flex items-center gap-1.5 text-xs tabular-nums", l === "offline" ? "text-red-600 font-medium" : l === "stalled" ? "text-amber-600 font-medium" : "font-normal text-muted-foreground"),
3040
3115
  "aria-live": "polite",
@@ -3057,7 +3132,7 @@ function ca({ active: e, activityKey: t, pending: n = !1, waitingLabel: r, stall
3057
3132
  ]
3058
3133
  });
3059
3134
  }
3060
- var la = [
3135
+ var ha = [
3061
3136
  "Mapping out the data you’ll track…",
3062
3137
  "Shaping objects and their fields…",
3063
3138
  "Connecting related records…",
@@ -3068,21 +3143,21 @@ var la = [
3068
3143
  "Sketching a dashboard to track it…",
3069
3144
  "Double-checking the structure hangs together…",
3070
3145
  "Pulling the plan together…"
3071
- ], ua = 3500;
3072
- function da(e, t, n = ua) {
3146
+ ], ga = 3500;
3147
+ function _a(e, t, n = ga) {
3073
3148
  if (t <= 0) return -1;
3074
3149
  if (t === 1) return 0;
3075
- let r = Math.floor((Number.isFinite(e) && e > 0 ? e : 0) / (n > 0 ? n : ua));
3150
+ let r = Math.floor((Number.isFinite(e) && e > 0 ? e : 0) / (n > 0 ? n : ga));
3076
3151
  return Math.min(r, t - 1);
3077
3152
  }
3078
- function fa({ label: t, hints: n, offlineLabel: r }) {
3153
+ function va({ label: t, hints: n, offlineLabel: r }) {
3079
3154
  let [i, a] = e.useState(0);
3080
3155
  e.useEffect(() => {
3081
3156
  if (n.length <= 1) return;
3082
- let e = Date.now(), t = setInterval(() => a(Date.now() - e), ua);
3157
+ let e = Date.now(), t = setInterval(() => a(Date.now() - e), ga);
3083
3158
  return () => clearInterval(t);
3084
3159
  }, [n.length]);
3085
- let o = da(i, n.length), s = o >= 0 ? n[o] : void 0, c = n.length > 1 && n.length <= 12;
3160
+ let o = _a(i, n.length), s = o >= 0 ? n[o] : void 0, c = n.length > 1 && n.length <= 12;
3086
3161
  return /* @__PURE__ */ $("span", {
3087
3162
  className: "inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",
3088
3163
  "data-testid": "build-proposal-progress",
@@ -3106,12 +3181,12 @@ function fa({ label: t, hints: n, offlineLabel: r }) {
3106
3181
  "aria-hidden": !0,
3107
3182
  children: n.map((e, t) => /* @__PURE__ */ Q("span", { className: q("size-1 rounded-full transition-colors", t <= o ? "bg-primary/70" : "bg-muted-foreground/25") }, t))
3108
3183
  }) : null,
3109
- /* @__PURE__ */ Q(pa, { offlineLabel: r })
3184
+ /* @__PURE__ */ Q(ya, { offlineLabel: r })
3110
3185
  ]
3111
3186
  });
3112
3187
  }
3113
- function pa({ offlineLabel: t }) {
3114
- let [n, r] = e.useState(0), i = sa();
3188
+ function ya({ offlineLabel: t }) {
3189
+ let [n, r] = e.useState(0), i = pa();
3115
3190
  return e.useEffect(() => {
3116
3191
  let e = Date.now(), t = setInterval(() => r(Math.floor((Date.now() - e) / 1e3)), 1e3);
3117
3192
  return () => clearInterval(t);
@@ -3124,25 +3199,25 @@ function pa({ offlineLabel: t }) {
3124
3199
  className: "size-3 shrink-0",
3125
3200
  "aria-hidden": !0
3126
3201
  }),
3127
- /* @__PURE__ */ Q("span", { children: ia(n) }),
3202
+ /* @__PURE__ */ Q("span", { children: ua(n) }),
3128
3203
  i ? /* @__PURE__ */ $("span", { children: ["· ", t] }) : null
3129
3204
  ]
3130
3205
  });
3131
3206
  }
3132
- var ma = [
3207
+ var ba = [
3133
3208
  "object",
3134
3209
  "view",
3135
3210
  "dashboard",
3136
3211
  "app",
3137
3212
  "seed"
3138
- ], ha = {
3213
+ ], xa = {
3139
3214
  object: "Objects",
3140
3215
  view: "Views",
3141
3216
  dashboard: "Dashboards",
3142
3217
  app: "App",
3143
3218
  seed: "Sample data"
3144
3219
  };
3145
- function ga({ progress: e, designingLabel: t = "Designing your app…", extendLabel: n = "Adding to existing app", waitingLabel: r = "Waiting for server…", stalledLabel: i = "Still working…", offlineLabel: a = "Connection lost — reconnecting…" }) {
3220
+ function Sa({ progress: e, designingLabel: t = "Designing your app…", extendLabel: n = "Adding to existing app", waitingLabel: r = "Waiting for server…", stalledLabel: i = "Still working…", offlineLabel: a = "Connection lost — reconnecting…" }) {
3146
3221
  let { phase: o, summary: s, appLabel: c, targetApp: l, objects: u, counts: d, seq: f } = e, p = o === "done", m = f ?? `${o}:${u.length}`, h = p && (s || c) || t, g = [];
3147
3222
  return d?.objects && g.push(`${d.objects} object${d.objects === 1 ? "" : "s"}`), d?.views && g.push(`${d.views} view${d.views === 1 ? "" : "s"}`), d?.dashboards && g.push(`${d.dashboards} dashboard${d.dashboards === 1 ? "" : "s"}`), /* @__PURE__ */ $("div", {
3148
3223
  className: "rounded-lg border bg-muted/30 p-3 text-sm",
@@ -3151,7 +3226,7 @@ function ga({ progress: e, designingLabel: t = "Designing your app…", extendLa
3151
3226
  /* @__PURE__ */ $("div", {
3152
3227
  className: "mb-2 flex items-center gap-2 font-medium",
3153
3228
  children: [
3154
- p ? /* @__PURE__ */ Q(Y, { className: "size-4 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Q(tt, { className: "size-4 shrink-0 animate-spin text-primary" }),
3229
+ p ? /* @__PURE__ */ Q(J, { className: "size-4 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Q(tt, { className: "size-4 shrink-0 animate-spin text-primary" }),
3155
3230
  /* @__PURE__ */ Q("span", {
3156
3231
  className: "min-w-0 truncate",
3157
3232
  children: h
@@ -3169,7 +3244,7 @@ function ga({ progress: e, designingLabel: t = "Designing your app…", extendLa
3169
3244
  }) : null,
3170
3245
  p ? null : /* @__PURE__ */ Q("span", {
3171
3246
  className: "ml-auto shrink-0",
3172
- children: /* @__PURE__ */ Q(ca, {
3247
+ children: /* @__PURE__ */ Q(ma, {
3173
3248
  active: !0,
3174
3249
  activityKey: m,
3175
3250
  waitingLabel: r,
@@ -3206,13 +3281,13 @@ function ga({ progress: e, designingLabel: t = "Designing your app…", extendLa
3206
3281
  ]
3207
3282
  });
3208
3283
  }
3209
- function _a({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app", onPreviewDraftApp: r, previewDraftLabel: i = "Preview", waitingLabel: a = "Waiting for server…", stalledLabel: o = "Still working…", offlineLabel: s = "Connection lost — reconnecting…" }) {
3284
+ function Ca({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app", onPreviewDraftApp: r, previewDraftLabel: i = "Preview", waitingLabel: a = "Waiting for server…", stalledLabel: o = "Still working…", offlineLabel: s = "Connection lost — reconnecting…" }) {
3210
3285
  let { phase: c, appLabel: l, items: u, done: d, total: f, seq: p } = e, m = c === "done", h = p ?? `${c}:${d}:${u.length}`, g = u.find((e) => e.type === "app"), _ = f > 0 ? Math.min(100, Math.round(d / f * 100)) : m ? 100 : 6, v = /* @__PURE__ */ new Map();
3211
3286
  for (let e of u) {
3212
3287
  let t = v.get(e.type) ?? [];
3213
3288
  t.push(e.name.replace(/_sample$/, "")), v.set(e.type, t);
3214
3289
  }
3215
- let y = [...ma.filter((e) => v.has(e)), ...[...v.keys()].filter((e) => !ma.includes(e))];
3290
+ let y = [...ba.filter((e) => v.has(e)), ...[...v.keys()].filter((e) => !ba.includes(e))];
3216
3291
  return /* @__PURE__ */ $("div", {
3217
3292
  className: "rounded-lg border bg-muted/30 p-3 text-sm",
3218
3293
  "data-testid": "build-progress",
@@ -3220,7 +3295,7 @@ function _a({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
3220
3295
  /* @__PURE__ */ $("div", {
3221
3296
  className: "mb-2 flex items-center gap-2 font-medium",
3222
3297
  children: [
3223
- m ? /* @__PURE__ */ Q(Y, { className: "size-4 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Q(tt, { className: "size-4 shrink-0 animate-spin text-primary" }),
3298
+ m ? /* @__PURE__ */ Q(J, { className: "size-4 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Q(tt, { className: "size-4 shrink-0 animate-spin text-primary" }),
3224
3299
  /* @__PURE__ */ Q("span", { children: m ? `Built ${l ?? "your app"}` : `Building ${l ?? "your app"}…` }),
3225
3300
  !m && c === "data" ? /* @__PURE__ */ Q("span", {
3226
3301
  className: "text-xs font-normal text-muted-foreground",
@@ -3228,7 +3303,7 @@ function _a({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
3228
3303
  }) : null,
3229
3304
  m ? null : /* @__PURE__ */ Q("span", {
3230
3305
  className: "ml-auto",
3231
- children: /* @__PURE__ */ Q(ca, {
3306
+ children: /* @__PURE__ */ Q(ma, {
3232
3307
  active: !0,
3233
3308
  activityKey: h,
3234
3309
  waitingLabel: a,
@@ -3251,12 +3326,12 @@ function _a({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
3251
3326
  let t = v.get(e);
3252
3327
  return /* @__PURE__ */ $("li", {
3253
3328
  className: "flex items-start gap-2",
3254
- children: [/* @__PURE__ */ Q(Y, { className: "mt-0.5 size-3.5 shrink-0 text-emerald-600" }), /* @__PURE__ */ $("span", {
3329
+ children: [/* @__PURE__ */ Q(J, { className: "mt-0.5 size-3.5 shrink-0 text-emerald-600" }), /* @__PURE__ */ $("span", {
3255
3330
  className: "min-w-0 text-muted-foreground",
3256
3331
  children: [
3257
3332
  /* @__PURE__ */ Q("span", {
3258
3333
  className: "font-medium text-foreground",
3259
- children: ha[e] ?? e
3334
+ children: xa[e] ?? e
3260
3335
  }),
3261
3336
  " ",
3262
3337
  t.slice(0, 6).join(", "),
@@ -3273,7 +3348,7 @@ function _a({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
3273
3348
  onClick: () => t(g.name),
3274
3349
  className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
3275
3350
  "data-testid": "build-progress-open-app",
3276
- children: [n, /* @__PURE__ */ Q(Ae, { className: "size-3.5" })]
3351
+ children: [n, /* @__PURE__ */ Q(je, { className: "size-3.5" })]
3277
3352
  }) : null, r ? /* @__PURE__ */ $("button", {
3278
3353
  type: "button",
3279
3354
  onClick: () => r(g.name),
@@ -3285,7 +3360,7 @@ function _a({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
3285
3360
  ]
3286
3361
  });
3287
3362
  }
3288
- function va({ groups: e, labels: t }) {
3363
+ function wa({ groups: e, labels: t }) {
3289
3364
  return e.length === 0 ? null : /* @__PURE__ */ Q("div", {
3290
3365
  className: "not-prose mb-2 border-l border-border/70 pl-3",
3291
3366
  children: /* @__PURE__ */ Q("div", {
@@ -3295,7 +3370,7 @@ function va({ groups: e, labels: t }) {
3295
3370
  children: [/* @__PURE__ */ $("div", {
3296
3371
  className: "flex min-w-0 items-center gap-2",
3297
3372
  children: [
3298
- /* @__PURE__ */ Q(ya, { state: e.state }),
3373
+ /* @__PURE__ */ Q(Ta, { state: e.state }),
3299
3374
  /* @__PURE__ */ Q("span", {
3300
3375
  className: "truncate font-medium text-foreground",
3301
3376
  children: e.title
@@ -3305,22 +3380,22 @@ function va({ groups: e, labels: t }) {
3305
3380
  children: ["x", e.count]
3306
3381
  }) : null
3307
3382
  ]
3308
- }), e.state === "running" ? e.rawName === "propose_blueprint" ? /* @__PURE__ */ Q(fa, {
3383
+ }), e.state === "running" ? e.rawName === "propose_blueprint" ? /* @__PURE__ */ Q(va, {
3309
3384
  label: t.designingPlanLabel,
3310
3385
  hints: t.designingPlanHints,
3311
3386
  offlineLabel: t.connectionOfflineLabel
3312
- }) : /* @__PURE__ */ Q(pa, { offlineLabel: t.connectionOfflineLabel }) : /* @__PURE__ */ Q("span", {
3387
+ }) : /* @__PURE__ */ Q(ya, { offlineLabel: t.connectionOfflineLabel }) : /* @__PURE__ */ Q("span", {
3313
3388
  className: q("shrink-0 text-[10px] font-medium", e.state === "failed" ? "text-destructive" : e.state === "completed" ? "text-emerald-700 dark:text-emerald-400" : "text-muted-foreground"),
3314
- children: ba(e.state, t)
3389
+ children: Ea(e.state, t)
3315
3390
  })]
3316
3391
  }, e.key))
3317
3392
  })
3318
3393
  });
3319
3394
  }
3320
- function ya({ state: e }) {
3321
- return e === "failed" ? /* @__PURE__ */ Q(X, { className: "size-3.5 shrink-0 text-destructive" }) : e === "completed" ? /* @__PURE__ */ Q(Y, { className: "size-3.5 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Q(Ue, { className: "size-3.5 shrink-0 text-muted-foreground" });
3395
+ function Ta({ state: e }) {
3396
+ return e === "failed" ? /* @__PURE__ */ Q(X, { className: "size-3.5 shrink-0 text-destructive" }) : e === "completed" ? /* @__PURE__ */ Q(J, { className: "size-3.5 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Q(Ue, { className: "size-3.5 shrink-0 text-muted-foreground" });
3322
3397
  }
3323
- function ba(e, t) {
3398
+ function Ea(e, t) {
3324
3399
  switch (e) {
3325
3400
  case "failed": return t.toolFailed;
3326
3401
  case "awaiting": return t.toolAwaitingApproval;
@@ -3328,8 +3403,8 @@ function ba(e, t) {
3328
3403
  case "completed": return t.toolCompleted;
3329
3404
  }
3330
3405
  }
3331
- function xa({ error: t, rateLimitedLabel: n, genericLabel: r }) {
3332
- let i = e.useMemo(() => Kn(t) ? n : r, [
3406
+ function Da({ error: t, rateLimitedLabel: n, genericLabel: r }) {
3407
+ let i = e.useMemo(() => Qn(t) ? n : r, [
3333
3408
  t,
3334
3409
  n,
3335
3410
  r
@@ -3350,8 +3425,8 @@ function xa({ error: t, rateLimitedLabel: n, genericLabel: r }) {
3350
3425
  })
3351
3426
  });
3352
3427
  }
3353
- function Sa({ error: t, onReload: n, onUpgrade: r }) {
3354
- let i = e.useMemo(() => Un(t), [t]), { summary: a, details: o } = e.useMemo(() => Vn(t), [t]), [s, c] = e.useState(!1);
3428
+ function Oa({ error: t, onReload: n, onUpgrade: r }) {
3429
+ let i = e.useMemo(() => Yn(t), [t]), { summary: a, details: o } = e.useMemo(() => qn(t), [t]), [s, c] = e.useState(!1);
3355
3430
  if (i) {
3356
3431
  let e = typeof navigator < "u" && !!navigator.language?.toLowerCase().startsWith("zh"), t = (e ? i.message : i.messageEn ?? i.message) || (e ? "AI 额度已用完。" : "You have reached your AI quota."), n = i.topUp ? e ? "购买额度包" : "Buy a credit pack" : e ? "升级方案" : "Upgrade plan";
3357
3432
  return /* @__PURE__ */ Q("div", {
@@ -3422,27 +3497,27 @@ function Sa({ error: t, onReload: n, onUpgrade: r }) {
3422
3497
  })
3423
3498
  });
3424
3499
  }
3425
- function Ca({ output: e, errorText: t }) {
3426
- return t ? /* @__PURE__ */ Q(Ti, {
3500
+ function ka({ output: e, errorText: t }) {
3501
+ return t ? /* @__PURE__ */ Q(ji, {
3427
3502
  output: void 0,
3428
3503
  errorText: t
3429
- }) : e == null || e === "" ? null : typeof e == "string" && !Vi(e) ? /* @__PURE__ */ $("div", {
3504
+ }) : e == null || e === "" ? null : typeof e == "string" && !qi(e) ? /* @__PURE__ */ $("div", {
3430
3505
  className: "space-y-2 p-4",
3431
3506
  children: [/* @__PURE__ */ Q("h4", {
3432
3507
  className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
3433
3508
  children: "Result"
3434
3509
  }), /* @__PURE__ */ Q("div", {
3435
3510
  className: "overflow-x-auto rounded-md bg-muted/40 px-3 py-2 text-sm text-foreground",
3436
- children: /* @__PURE__ */ Q(fr, { children: e })
3511
+ children: /* @__PURE__ */ Q(vr, { children: e })
3437
3512
  })]
3438
- }) : /* @__PURE__ */ Q(Ti, {
3513
+ }) : /* @__PURE__ */ Q(ji, {
3439
3514
  output: e,
3440
3515
  errorText: void 0
3441
3516
  });
3442
3517
  }
3443
3518
  //#endregion
3444
3519
  //#region src/FloatingChatbot.tsx
3445
- function wa({ floatingConfig: t, headerExtra: n, headerActions: r, ...i }) {
3520
+ function Aa({ floatingConfig: t, headerExtra: n, headerActions: r, ...i }) {
3446
3521
  let { position: a = "bottom-right", defaultOpen: o = !1, panelWidth: s = 400, panelHeight: c = 520, title: l = "Chat", triggerSize: u = 56 } = t ?? {}, [d, f] = e.useState(null);
3447
3522
  e.useEffect(() => {
3448
3523
  let e = document.getElementById("floating-chatbot-portal");
@@ -3450,19 +3525,19 @@ function wa({ floatingConfig: t, headerExtra: n, headerActions: r, ...i }) {
3450
3525
  e && e.parentNode && !e.hasChildNodes() && e.parentNode.removeChild(e);
3451
3526
  };
3452
3527
  }, []);
3453
- let p = /* @__PURE__ */ $(Tn, {
3528
+ let p = /* @__PURE__ */ $(jn, {
3454
3529
  defaultOpen: o,
3455
- children: [/* @__PURE__ */ Q(jn, {
3530
+ children: [/* @__PURE__ */ Q(Ln, {
3456
3531
  position: a,
3457
3532
  size: u
3458
- }), /* @__PURE__ */ Q(Ln, {
3533
+ }), /* @__PURE__ */ Q(Un, {
3459
3534
  title: l,
3460
3535
  position: a,
3461
3536
  width: s,
3462
3537
  height: c,
3463
3538
  headerExtra: n,
3464
3539
  headerActions: r,
3465
- children: /* @__PURE__ */ Q(ea, {
3540
+ children: /* @__PURE__ */ Q(oa, {
3466
3541
  ...i,
3467
3542
  maxHeight: "100%",
3468
3543
  className: "h-full border-0 rounded-none"
@@ -3472,7 +3547,7 @@ function wa({ floatingConfig: t, headerExtra: n, headerActions: r, ...i }) {
3472
3547
  return d ? Ct.createPortal(p, d) : p;
3473
3548
  }
3474
3549
  Ft.register("chatbot", ({ schema: e, className: t, ...n }) => {
3475
- let { messages: r, isLoading: i, sendMessage: a } = on({
3550
+ let { messages: r, isLoading: i, sendMessage: a } = un({
3476
3551
  api: e.api,
3477
3552
  initialMessages: e.messages,
3478
3553
  conversationId: e.conversationId,
@@ -3489,7 +3564,7 @@ Ft.register("chatbot", ({ schema: e, className: t, ...n }) => {
3489
3564
  autoResponseDelay: e.autoResponseDelay,
3490
3565
  onSend: e.onSend
3491
3566
  });
3492
- return /* @__PURE__ */ Q(Ga, {
3567
+ return /* @__PURE__ */ Q(Za, {
3493
3568
  messages: r,
3494
3569
  placeholder: e.placeholder,
3495
3570
  onSendMessage: (e) => {
@@ -3638,7 +3713,7 @@ Ft.register("chatbot", ({ schema: e, className: t, ...n }) => {
3638
3713
  className: "w-full max-w-2xl"
3639
3714
  }
3640
3715
  }), Ft.register("chatbot-enhanced", ({ schema: e, className: t, ...n }) => {
3641
- let { messages: r, isLoading: i, error: a, sendMessage: o, stop: s, reload: c, clear: l, isApiMode: u } = on({
3716
+ let { messages: r, isLoading: i, error: a, sendMessage: o, stop: s, reload: c, clear: l, isApiMode: u } = un({
3642
3717
  api: e.api,
3643
3718
  initialMessages: e.messages,
3644
3719
  conversationId: e.conversationId,
@@ -3655,7 +3730,7 @@ Ft.register("chatbot", ({ schema: e, className: t, ...n }) => {
3655
3730
  autoResponseDelay: e.autoResponseDelay,
3656
3731
  onSend: e.onSend
3657
3732
  });
3658
- return /* @__PURE__ */ Q(ea, {
3733
+ return /* @__PURE__ */ Q(oa, {
3659
3734
  messages: r,
3660
3735
  placeholder: e.placeholder,
3661
3736
  onSendMessage: (e, t) => {
@@ -3825,7 +3900,7 @@ Ft.register("chatbot", ({ schema: e, className: t, ...n }) => {
3825
3900
  className: "w-full max-w-2xl"
3826
3901
  }
3827
3902
  }), Ft.register("chatbot-floating", ({ schema: e, className: t, ...n }) => {
3828
- let { messages: r, isLoading: i, error: a, sendMessage: o, stop: s, reload: c, clear: l, isApiMode: u } = on({
3903
+ let { messages: r, isLoading: i, error: a, sendMessage: o, stop: s, reload: c, clear: l, isApiMode: u } = un({
3829
3904
  api: e.api,
3830
3905
  initialMessages: e.messages,
3831
3906
  conversationId: e.conversationId,
@@ -3842,7 +3917,7 @@ Ft.register("chatbot", ({ schema: e, className: t, ...n }) => {
3842
3917
  autoResponseDelay: e.autoResponseDelay,
3843
3918
  onSend: e.onSend
3844
3919
  });
3845
- return /* @__PURE__ */ Q(wa, {
3920
+ return /* @__PURE__ */ Q(Aa, {
3846
3921
  floatingConfig: e.floatingConfig,
3847
3922
  messages: r,
3848
3923
  placeholder: e.placeholder,
@@ -4014,7 +4089,7 @@ Ft.register("chatbot", ({ schema: e, className: t, ...n }) => {
4014
4089
  });
4015
4090
  //#endregion
4016
4091
  //#region src/elements/loader.tsx
4017
- var Ta = ({ size: e = 16 }) => /* @__PURE__ */ $("svg", {
4092
+ var ja = ({ size: e = 16 }) => /* @__PURE__ */ $("svg", {
4018
4093
  height: e,
4019
4094
  strokeLinejoin: "round",
4020
4095
  style: { color: "currentcolor" },
@@ -4095,97 +4170,97 @@ var Ta = ({ size: e = 16 }) => /* @__PURE__ */ $("svg", {
4095
4170
  })
4096
4171
  }) })
4097
4172
  ]
4098
- }), Ea = ({ className: e, size: t = 16, ...n }) => /* @__PURE__ */ Q("div", {
4173
+ }), Ma = ({ className: e, size: t = 16, ...n }) => /* @__PURE__ */ Q("div", {
4099
4174
  className: q("inline-flex animate-spin items-center justify-center", e),
4100
4175
  ...n,
4101
- children: /* @__PURE__ */ Q(Ta, { size: t })
4102
- }), Da = /* @__PURE__ */ Lt({
4103
- CodeBlock: () => vi,
4104
- CodeBlockCopyButton: () => yi,
4105
- Conversation: () => qn,
4106
- ConversationContent: () => Jn,
4107
- ConversationEmptyState: () => Yn,
4108
- ConversationScrollButton: () => Xn,
4109
- Loader: () => Ea,
4110
- Message: () => er,
4111
- MessageAction: () => rr,
4112
- MessageActions: () => nr,
4113
- MessageAttachment: () => pr,
4114
- MessageAttachments: () => mr,
4115
- MessageBranch: () => or,
4116
- MessageBranchContent: () => sr,
4117
- MessageBranchNext: () => ur,
4118
- MessageBranchPage: () => dr,
4119
- MessageBranchPrevious: () => lr,
4120
- MessageBranchSelector: () => cr,
4121
- MessageContent: () => tr,
4122
- MessageResponse: () => fr,
4123
- MessageToolbar: () => hr,
4124
- PromptInput: () => Pr,
4125
- PromptInputActionAddAttachments: () => Nr,
4126
- PromptInputActionMenu: () => Vr,
4127
- PromptInputActionMenuContent: () => Ur,
4128
- PromptInputActionMenuItem: () => Wr,
4129
- PromptInputActionMenuTrigger: () => Hr,
4130
- PromptInputAttachment: () => jr,
4131
- PromptInputAttachments: () => Mr,
4132
- PromptInputBody: () => Fr,
4133
- PromptInputButton: () => Br,
4134
- PromptInputCommand: () => oi,
4135
- PromptInputCommandEmpty: () => li,
4136
- PromptInputCommandGroup: () => ui,
4137
- PromptInputCommandInput: () => si,
4138
- PromptInputCommandItem: () => di,
4139
- PromptInputCommandList: () => ci,
4140
- PromptInputCommandSeparator: () => fi,
4141
- PromptInputFooter: () => Rr,
4142
- PromptInputHeader: () => Lr,
4143
- PromptInputHoverCard: () => Qr,
4144
- PromptInputHoverCardContent: () => ei,
4145
- PromptInputHoverCardTrigger: () => $r,
4146
- PromptInputProvider: () => Or,
4147
- PromptInputSelect: () => qr,
4148
- PromptInputSelectContent: () => Yr,
4149
- PromptInputSelectItem: () => Xr,
4150
- PromptInputSelectTrigger: () => Jr,
4151
- PromptInputSelectValue: () => Zr,
4152
- PromptInputSpeechButton: () => Kr,
4153
- PromptInputSubmit: () => Gr,
4154
- PromptInputTab: () => ni,
4155
- PromptInputTabBody: () => ii,
4156
- PromptInputTabItem: () => ai,
4157
- PromptInputTabLabel: () => ri,
4158
- PromptInputTabsList: () => ti,
4159
- PromptInputTextarea: () => Ir,
4160
- PromptInputTools: () => zr,
4161
- Reasoning: () => ji,
4162
- ReasoningContent: () => Pi,
4163
- ReasoningTrigger: () => Ni,
4164
- Shimmer: () => Ei,
4165
- Source: () => Ri,
4166
- Sources: () => Fi,
4167
- SourcesContent: () => Li,
4168
- SourcesTrigger: () => Ii,
4169
- Suggestion: () => mi,
4170
- Suggestions: () => pi,
4171
- Tool: () => bi,
4172
- ToolContent: () => Ci,
4173
- ToolHeader: () => Si,
4174
- ToolInput: () => wi,
4175
- ToolOutput: () => Ti,
4176
- highlightCode: () => _i,
4177
- usePromptInputAttachments: () => Ar,
4178
- usePromptInputController: () => wr,
4179
- useProviderAttachments: () => Er,
4180
- useReasoning: () => Oi
4181
- }), Oa = "/api/v1/ai";
4182
- function ka(e, t, n) {
4176
+ children: /* @__PURE__ */ Q(ja, { size: t })
4177
+ }), Na = /* @__PURE__ */ Lt({
4178
+ CodeBlock: () => wi,
4179
+ CodeBlockCopyButton: () => Ti,
4180
+ Conversation: () => $n,
4181
+ ConversationContent: () => er,
4182
+ ConversationEmptyState: () => tr,
4183
+ ConversationScrollButton: () => nr,
4184
+ Loader: () => Ma,
4185
+ Message: () => or,
4186
+ MessageAction: () => lr,
4187
+ MessageActions: () => cr,
4188
+ MessageAttachment: () => yr,
4189
+ MessageAttachments: () => br,
4190
+ MessageBranch: () => fr,
4191
+ MessageBranchContent: () => pr,
4192
+ MessageBranchNext: () => gr,
4193
+ MessageBranchPage: () => _r,
4194
+ MessageBranchPrevious: () => hr,
4195
+ MessageBranchSelector: () => mr,
4196
+ MessageContent: () => sr,
4197
+ MessageResponse: () => vr,
4198
+ MessageToolbar: () => xr,
4199
+ PromptInput: () => Br,
4200
+ PromptInputActionAddAttachments: () => zr,
4201
+ PromptInputActionMenu: () => qr,
4202
+ PromptInputActionMenuContent: () => Yr,
4203
+ PromptInputActionMenuItem: () => Xr,
4204
+ PromptInputActionMenuTrigger: () => Jr,
4205
+ PromptInputAttachment: () => Lr,
4206
+ PromptInputAttachments: () => Rr,
4207
+ PromptInputBody: () => Vr,
4208
+ PromptInputButton: () => Kr,
4209
+ PromptInputCommand: () => fi,
4210
+ PromptInputCommandEmpty: () => hi,
4211
+ PromptInputCommandGroup: () => gi,
4212
+ PromptInputCommandInput: () => pi,
4213
+ PromptInputCommandItem: () => _i,
4214
+ PromptInputCommandList: () => mi,
4215
+ PromptInputCommandSeparator: () => vi,
4216
+ PromptInputFooter: () => Wr,
4217
+ PromptInputHeader: () => Ur,
4218
+ PromptInputHoverCard: () => ii,
4219
+ PromptInputHoverCardContent: () => oi,
4220
+ PromptInputHoverCardTrigger: () => ai,
4221
+ PromptInputProvider: () => Pr,
4222
+ PromptInputSelect: () => $r,
4223
+ PromptInputSelectContent: () => ti,
4224
+ PromptInputSelectItem: () => ni,
4225
+ PromptInputSelectTrigger: () => ei,
4226
+ PromptInputSelectValue: () => ri,
4227
+ PromptInputSpeechButton: () => Qr,
4228
+ PromptInputSubmit: () => Zr,
4229
+ PromptInputTab: () => ci,
4230
+ PromptInputTabBody: () => ui,
4231
+ PromptInputTabItem: () => di,
4232
+ PromptInputTabLabel: () => li,
4233
+ PromptInputTabsList: () => si,
4234
+ PromptInputTextarea: () => Hr,
4235
+ PromptInputTools: () => Gr,
4236
+ Reasoning: () => Li,
4237
+ ReasoningContent: () => Bi,
4238
+ ReasoningTrigger: () => zi,
4239
+ Shimmer: () => Mi,
4240
+ Source: () => Wi,
4241
+ Sources: () => Vi,
4242
+ SourcesContent: () => Ui,
4243
+ SourcesTrigger: () => Hi,
4244
+ Suggestion: () => bi,
4245
+ Suggestions: () => yi,
4246
+ Tool: () => Ei,
4247
+ ToolContent: () => ki,
4248
+ ToolHeader: () => Oi,
4249
+ ToolInput: () => Ai,
4250
+ ToolOutput: () => ji,
4251
+ highlightCode: () => Ci,
4252
+ usePromptInputAttachments: () => Ir,
4253
+ usePromptInputController: () => Ar,
4254
+ useProviderAttachments: () => Mr,
4255
+ useReasoning: () => Pi
4256
+ }), Pa = "/api/v1/ai";
4257
+ function Fa(e, t, n) {
4183
4258
  let r = e.replace(/\/$/, ""), i = new URLSearchParams();
4184
4259
  if (n) for (let [e, t] of Object.entries(n)) t == null || t === "" || i.set(e, String(t));
4185
4260
  let a = i.toString();
4186
4261
  return `${r}${t}${a ? `?${a}` : ""}`;
4187
4262
  }
4188
- async function Aa(e, t, n) {
4263
+ async function Ia(e, t, n) {
4189
4264
  let r = await fetch(e, {
4190
4265
  credentials: "include",
4191
4266
  ...t,
@@ -4205,8 +4280,8 @@ async function Aa(e, t, n) {
4205
4280
  }
4206
4281
  return i;
4207
4282
  }
4208
- function ja(t = {}) {
4209
- let { apiBase: n = Oa, status: r = "pending", conversationId: i, limit: a, headers: o, pollInterval: s = 5e3, enabled: c = !0 } = t, [l, u] = e.useState([]), [d, f] = e.useState(0), [p, m] = e.useState(!1), [h, g] = e.useState(void 0), _ = e.useRef({
4283
+ function La(t = {}) {
4284
+ let { apiBase: n = Pa, status: r = "pending", conversationId: i, limit: a, headers: o, pollInterval: s = 5e3, enabled: c = !0 } = t, [l, u] = e.useState([]), [d, f] = e.useState(0), [p, m] = e.useState(!1), [h, g] = e.useState(void 0), _ = e.useRef({
4210
4285
  apiBase: n,
4211
4286
  status: r,
4212
4287
  conversationId: i,
@@ -4224,7 +4299,7 @@ function ja(t = {}) {
4224
4299
  let { apiBase: e, status: t, conversationId: n, limit: r, headers: i } = _.current;
4225
4300
  m(!0), g(void 0);
4226
4301
  try {
4227
- let a = await Aa(ka(e, "/pending-actions", {
4302
+ let a = await Ia(Fa(e, "/pending-actions", {
4228
4303
  status: t && t !== "all" ? t : void 0,
4229
4304
  conversationId: n,
4230
4305
  limit: r
@@ -4236,9 +4311,9 @@ function ja(t = {}) {
4236
4311
  m(!1);
4237
4312
  }
4238
4313
  }, []), y = e.useCallback(async (e) => {
4239
- let { apiBase: t, headers: n } = _.current, r = ka(t, `/pending-actions/${encodeURIComponent(e)}/approve`);
4314
+ let { apiBase: t, headers: n } = _.current, r = Fa(t, `/pending-actions/${encodeURIComponent(e)}/approve`);
4240
4315
  try {
4241
- return await Aa(r, {
4316
+ return await Ia(r, {
4242
4317
  method: "POST",
4243
4318
  body: "{}"
4244
4319
  }, n);
@@ -4246,9 +4321,9 @@ function ja(t = {}) {
4246
4321
  v();
4247
4322
  }
4248
4323
  }, [v]), b = e.useCallback(async (e, t) => {
4249
- let { apiBase: n, headers: r } = _.current, i = ka(n, `/pending-actions/${encodeURIComponent(e)}/reject`);
4324
+ let { apiBase: n, headers: r } = _.current, i = Fa(n, `/pending-actions/${encodeURIComponent(e)}/reject`);
4250
4325
  try {
4251
- return await Aa(i, {
4326
+ return await Ia(i, {
4252
4327
  method: "POST",
4253
4328
  body: JSON.stringify(t ? { reason: t } : {})
4254
4329
  }, r);
@@ -4282,7 +4357,7 @@ function ja(t = {}) {
4282
4357
  }
4283
4358
  //#endregion
4284
4359
  //#region src/AiPendingActionsInbox.tsx
4285
- var Ma = {
4360
+ var Ra = {
4286
4361
  pending: {
4287
4362
  variant: "secondary",
4288
4363
  label: "Pending"
@@ -4304,8 +4379,8 @@ var Ma = {
4304
4379
  label: "Rejected"
4305
4380
  }
4306
4381
  };
4307
- function Na({ status: e }) {
4308
- let t = Ma[e] ?? {
4382
+ function za({ status: e }) {
4383
+ let t = Ra[e] ?? {
4309
4384
  variant: "outline",
4310
4385
  label: e
4311
4386
  };
@@ -4314,7 +4389,7 @@ function Na({ status: e }) {
4314
4389
  children: t.label
4315
4390
  });
4316
4391
  }
4317
- function Pa(e) {
4392
+ function Ba(e) {
4318
4393
  if (!e) return "—";
4319
4394
  let t = Date.parse(e);
4320
4395
  if (Number.isNaN(t)) return e;
@@ -4332,7 +4407,7 @@ function Pa(e) {
4332
4407
  return e;
4333
4408
  }
4334
4409
  }
4335
- function Fa(e) {
4410
+ function Va(e) {
4336
4411
  if (!e) return null;
4337
4412
  try {
4338
4413
  return JSON.parse(e);
@@ -4340,7 +4415,7 @@ function Fa(e) {
4340
4415
  return e;
4341
4416
  }
4342
4417
  }
4343
- function Ia({ value: e, max: t = 320 }) {
4418
+ function Ha({ value: e, max: t = 320 }) {
4344
4419
  let n = typeof e == "string" ? e : JSON.stringify(e, null, 2);
4345
4420
  return n == null || n === "" ? /* @__PURE__ */ Q("span", {
4346
4421
  className: "text-muted-foreground text-xs",
@@ -4351,24 +4426,24 @@ function Ia({ value: e, max: t = 320 }) {
4351
4426
  children: n
4352
4427
  });
4353
4428
  }
4354
- function La(e) {
4429
+ function Ua(e) {
4355
4430
  switch (e) {
4356
4431
  case "pending": return "pending";
4357
4432
  case "all": return "all";
4358
4433
  case "decided": return "all";
4359
4434
  }
4360
4435
  }
4361
- function Ra({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i, variant: a = "card", title: o = "AI Approvals", description: s = "Actions an AI agent proposed that need a human review before execution.", className: c }) {
4362
- let [l, u] = e.useState("pending"), [d, m] = e.useState(null), [h, g] = e.useState(null), [_, w] = e.useState(""), [T, E] = e.useState(null), [D, O] = e.useState(null), [k, A] = e.useState(null), { items: j, isLoading: M, error: N, refresh: P, approve: F, reject: I } = ja({
4436
+ function Wa({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i, variant: a = "card", title: o = "AI Approvals", description: s = "Actions an AI agent proposed that need a human review before execution.", className: c }) {
4437
+ let [l, u] = e.useState("pending"), [d, m] = e.useState(null), [h, g] = e.useState(null), [_, w] = e.useState(""), [T, E] = e.useState(null), [D, O] = e.useState(null), [k, A] = e.useState(null), { items: j, isLoading: M, error: N, refresh: ee, approve: P, reject: F } = La({
4363
4438
  apiBase: t,
4364
4439
  headers: n,
4365
4440
  pollInterval: r,
4366
4441
  conversationId: i,
4367
- status: La(l)
4368
- }), L = e.useMemo(() => l === "decided" ? j.filter((e) => e.status !== "pending") : j, [j, l]), z = e.useMemo(() => d ? j.find((e) => e.id === d) ?? null : null, [d, j]), ie = e.useCallback(async (e) => {
4442
+ status: Ua(l)
4443
+ }), I = e.useMemo(() => l === "decided" ? j.filter((e) => e.status !== "pending") : j, [j, l]), R = e.useMemo(() => d ? j.find((e) => e.id === d) ?? null : null, [d, j]), ae = e.useCallback(async (e) => {
4369
4444
  E(e), O(null);
4370
4445
  try {
4371
- let t = await F(e), n = t.status === "executed";
4446
+ let t = await P(e), n = t.status === "executed";
4372
4447
  A({
4373
4448
  id: e,
4374
4449
  kind: "approve",
@@ -4386,10 +4461,10 @@ function Ra({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4386
4461
  } finally {
4387
4462
  E(null);
4388
4463
  }
4389
- }, [F]), B = e.useCallback(async (e, t) => {
4464
+ }, [P]), oe = e.useCallback(async (e, t) => {
4390
4465
  E(e), O(null);
4391
4466
  try {
4392
- await I(e, t.trim() || void 0), A({
4467
+ await F(e, t.trim() || void 0), A({
4393
4468
  id: e,
4394
4469
  kind: "reject",
4395
4470
  ok: !0,
@@ -4406,24 +4481,24 @@ function Ra({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4406
4481
  } finally {
4407
4482
  E(null);
4408
4483
  }
4409
- }, [I]), ae = /* @__PURE__ */ $("div", {
4484
+ }, [F]), z = /* @__PURE__ */ $("div", {
4410
4485
  className: "space-y-3",
4411
4486
  children: [
4412
4487
  /* @__PURE__ */ $("div", {
4413
4488
  className: "flex items-center justify-between gap-2",
4414
- children: [/* @__PURE__ */ Q(Ce, {
4489
+ children: [/* @__PURE__ */ Q(U, {
4415
4490
  value: l,
4416
4491
  onValueChange: (e) => u(e),
4417
- children: /* @__PURE__ */ $(we, { children: [
4418
- /* @__PURE__ */ Q(G, {
4492
+ children: /* @__PURE__ */ $(Te, { children: [
4493
+ /* @__PURE__ */ Q(W, {
4419
4494
  value: "pending",
4420
4495
  children: "Pending"
4421
4496
  }),
4422
- /* @__PURE__ */ Q(G, {
4497
+ /* @__PURE__ */ Q(W, {
4423
4498
  value: "decided",
4424
4499
  children: "Decided"
4425
4500
  }),
4426
- /* @__PURE__ */ Q(G, {
4501
+ /* @__PURE__ */ Q(W, {
4427
4502
  value: "all",
4428
4503
  children: "All"
4429
4504
  })
@@ -4431,7 +4506,7 @@ function Ra({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4431
4506
  }), /* @__PURE__ */ $(v, {
4432
4507
  variant: "outline",
4433
4508
  size: "sm",
4434
- onClick: () => void P(),
4509
+ onClick: () => void ee(),
4435
4510
  disabled: M,
4436
4511
  "data-testid": "ai-inbox-refresh",
4437
4512
  children: [/* @__PURE__ */ Q(ct, { className: `h-3.5 w-3.5 mr-1.5 ${M ? "animate-spin" : ""}` }), "Refresh"]
@@ -4447,7 +4522,7 @@ function Ra({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4447
4522
  }) : null,
4448
4523
  k && !D ? /* @__PURE__ */ $(f, {
4449
4524
  variant: k.ok ? "default" : "destructive",
4450
- children: [k.ok ? /* @__PURE__ */ Q(Y, { className: "h-4 w-4" }) : /* @__PURE__ */ Q(X, { className: "h-4 w-4" }), /* @__PURE__ */ $(p, { children: [
4525
+ children: [k.ok ? /* @__PURE__ */ Q(J, { className: "h-4 w-4" }) : /* @__PURE__ */ Q(X, { className: "h-4 w-4" }), /* @__PURE__ */ $(p, { children: [
4451
4526
  k.kind === "approve" ? "Approve" : "Reject",
4452
4527
  " for",
4453
4528
  " ",
@@ -4460,72 +4535,72 @@ function Ra({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4460
4535
  k.message ?? (k.ok ? "OK" : "Failed")
4461
4536
  ] })]
4462
4537
  }) : null,
4463
- M && L.length === 0 ? /* @__PURE__ */ $("div", {
4538
+ M && I.length === 0 ? /* @__PURE__ */ $("div", {
4464
4539
  className: "space-y-2",
4465
4540
  children: [
4466
- /* @__PURE__ */ Q(ye, { className: "h-10 w-full" }),
4467
- /* @__PURE__ */ Q(ye, { className: "h-10 w-full" }),
4468
- /* @__PURE__ */ Q(ye, { className: "h-10 w-full" })
4541
+ /* @__PURE__ */ Q(be, { className: "h-10 w-full" }),
4542
+ /* @__PURE__ */ Q(be, { className: "h-10 w-full" }),
4543
+ /* @__PURE__ */ Q(be, { className: "h-10 w-full" })
4469
4544
  ]
4470
- }) : L.length === 0 ? /* @__PURE__ */ Q(ee, { children: /* @__PURE__ */ $(R, { children: [
4471
- /* @__PURE__ */ Q(ne, { children: /* @__PURE__ */ Q(et, { className: "h-8 w-8 text-muted-foreground" }) }),
4472
- /* @__PURE__ */ Q(re, { children: "No actions waiting" }),
4473
- /* @__PURE__ */ Q(te, { children: "When the AI proposes a sensitive action it will appear here for review." })
4545
+ }) : I.length === 0 ? /* @__PURE__ */ Q(te, { children: /* @__PURE__ */ $(L, { children: [
4546
+ /* @__PURE__ */ Q(re, { children: /* @__PURE__ */ Q(et, { className: "h-8 w-8 text-muted-foreground" }) }),
4547
+ /* @__PURE__ */ Q(ie, { children: "No actions waiting" }),
4548
+ /* @__PURE__ */ Q(ne, { children: "When the AI proposes a sensitive action it will appear here for review." })
4474
4549
  ] }) }) : /* @__PURE__ */ Q("div", {
4475
4550
  className: "rounded-md border",
4476
- children: /* @__PURE__ */ $(be, { children: [/* @__PURE__ */ Q(W, { children: /* @__PURE__ */ $(Se, { children: [
4477
- /* @__PURE__ */ Q(U, {
4551
+ children: /* @__PURE__ */ $(xe, { children: [/* @__PURE__ */ Q(Ce, { children: /* @__PURE__ */ $(we, { children: [
4552
+ /* @__PURE__ */ Q(H, {
4478
4553
  className: "w-[140px]",
4479
4554
  children: "Tool"
4480
4555
  }),
4481
- /* @__PURE__ */ Q(U, {
4556
+ /* @__PURE__ */ Q(H, {
4482
4557
  className: "w-[140px]",
4483
4558
  children: "Action"
4484
4559
  }),
4485
- /* @__PURE__ */ Q(U, {
4560
+ /* @__PURE__ */ Q(H, {
4486
4561
  className: "w-[120px]",
4487
4562
  children: "Object"
4488
4563
  }),
4489
- /* @__PURE__ */ Q(U, {
4564
+ /* @__PURE__ */ Q(H, {
4490
4565
  className: "w-[110px]",
4491
4566
  children: "Status"
4492
4567
  }),
4493
- /* @__PURE__ */ Q(U, {
4568
+ /* @__PURE__ */ Q(H, {
4494
4569
  className: "w-[110px]",
4495
4570
  children: "Proposed"
4496
4571
  }),
4497
- /* @__PURE__ */ Q(U, {
4572
+ /* @__PURE__ */ Q(H, {
4498
4573
  className: "w-[260px] text-right",
4499
4574
  children: "Decision"
4500
4575
  })
4501
- ] }) }), /* @__PURE__ */ Q(xe, { children: L.map((e) => {
4576
+ ] }) }), /* @__PURE__ */ Q(Se, { children: I.map((e) => {
4502
4577
  let t = e.status === "pending", n = T === e.id;
4503
- return /* @__PURE__ */ $(Se, { children: [
4504
- /* @__PURE__ */ Q(H, {
4578
+ return /* @__PURE__ */ $(we, { children: [
4579
+ /* @__PURE__ */ Q(V, {
4505
4580
  className: "font-mono text-xs",
4506
4581
  children: e.tool_name
4507
4582
  }),
4508
- /* @__PURE__ */ Q(H, {
4583
+ /* @__PURE__ */ Q(V, {
4509
4584
  className: "text-sm",
4510
4585
  children: e.action_name
4511
4586
  }),
4512
- /* @__PURE__ */ Q(H, {
4587
+ /* @__PURE__ */ Q(V, {
4513
4588
  className: "text-sm",
4514
4589
  children: e.object_name
4515
4590
  }),
4516
- /* @__PURE__ */ Q(H, { children: /* @__PURE__ */ Q(Na, { status: e.status }) }),
4517
- /* @__PURE__ */ Q(H, {
4591
+ /* @__PURE__ */ Q(V, { children: /* @__PURE__ */ Q(za, { status: e.status }) }),
4592
+ /* @__PURE__ */ Q(V, {
4518
4593
  className: "text-xs text-muted-foreground",
4519
4594
  children: /* @__PURE__ */ $("span", {
4520
4595
  className: "inline-flex items-center gap-1",
4521
4596
  children: [
4522
4597
  /* @__PURE__ */ Q(He, { className: "h-3 w-3" }),
4523
4598
  " ",
4524
- Pa(e.proposed_at)
4599
+ Ba(e.proposed_at)
4525
4600
  ]
4526
4601
  })
4527
4602
  }),
4528
- /* @__PURE__ */ Q(H, {
4603
+ /* @__PURE__ */ Q(V, {
4529
4604
  className: "text-right",
4530
4605
  children: /* @__PURE__ */ $("div", {
4531
4606
  className: "inline-flex gap-1.5",
@@ -4539,9 +4614,9 @@ function Ra({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4539
4614
  size: "sm",
4540
4615
  variant: "default",
4541
4616
  disabled: n,
4542
- onClick: () => void ie(e.id),
4617
+ onClick: () => void ae(e.id),
4543
4618
  "data-testid": `ai-inbox-approve-${e.id}`,
4544
- children: [/* @__PURE__ */ Q(Y, { className: "h-3.5 w-3.5 mr-1" }), n ? "Working…" : "Approve"]
4619
+ children: [/* @__PURE__ */ Q(J, { className: "h-3.5 w-3.5 mr-1" }), n ? "Working…" : "Approve"]
4545
4620
  }), /* @__PURE__ */ $(v, {
4546
4621
  size: "sm",
4547
4622
  variant: "destructive",
@@ -4567,127 +4642,127 @@ function Ra({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4567
4642
  children: [/* @__PURE__ */ $(C, {
4568
4643
  className: "flex items-center gap-2",
4569
4644
  children: [
4570
- /* @__PURE__ */ Q(Me, { className: "h-4 w-4" }),
4645
+ /* @__PURE__ */ Q(Ne, { className: "h-4 w-4" }),
4571
4646
  " ",
4572
4647
  o
4573
4648
  ]
4574
4649
  }), s ? /* @__PURE__ */ Q(x, { children: s }) : null]
4575
- }), /* @__PURE__ */ Q(b, { children: ae })]
4650
+ }), /* @__PURE__ */ Q(b, { children: z })]
4576
4651
  }) : /* @__PURE__ */ Q("div", {
4577
4652
  className: c,
4578
- children: ae
4653
+ children: z
4579
4654
  }),
4580
- /* @__PURE__ */ Q(me, {
4655
+ /* @__PURE__ */ Q(he, {
4581
4656
  open: !!d,
4582
4657
  onOpenChange: (e) => {
4583
4658
  e || m(null);
4584
4659
  },
4585
- children: /* @__PURE__ */ $(he, {
4660
+ children: /* @__PURE__ */ $(ge, {
4586
4661
  className: "sm:max-w-[560px] overflow-y-auto",
4587
- children: [/* @__PURE__ */ $(_e, { children: [/* @__PURE__ */ $(ve, {
4662
+ children: [/* @__PURE__ */ $(ve, { children: [/* @__PURE__ */ $(ye, {
4588
4663
  className: "flex items-center gap-2",
4589
- children: [/* @__PURE__ */ Q(Me, { className: "h-4 w-4" }), z ? z.action_name : "Pending action"]
4590
- }), /* @__PURE__ */ Q(ge, { children: z ? /* @__PURE__ */ $(Z, { children: [
4664
+ children: [/* @__PURE__ */ Q(Ne, { className: "h-4 w-4" }), R ? R.action_name : "Pending action"]
4665
+ }), /* @__PURE__ */ Q(_e, { children: R ? /* @__PURE__ */ $(Z, { children: [
4591
4666
  "Tool ",
4592
4667
  /* @__PURE__ */ Q("code", {
4593
4668
  className: "text-xs",
4594
- children: z.tool_name
4669
+ children: R.tool_name
4595
4670
  }),
4596
4671
  " on",
4597
4672
  " ",
4598
4673
  /* @__PURE__ */ Q("code", {
4599
4674
  className: "text-xs",
4600
- children: z.object_name
4675
+ children: R.object_name
4601
4676
  })
4602
- ] }) : "Loading…" })] }), z ? /* @__PURE__ */ $("div", {
4677
+ ] }) : "Loading…" })] }), R ? /* @__PURE__ */ $("div", {
4603
4678
  className: "px-4 space-y-4 mt-4",
4604
4679
  children: [
4605
4680
  /* @__PURE__ */ $("div", {
4606
4681
  className: "grid grid-cols-2 gap-3 text-sm",
4607
4682
  children: [
4608
- /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
4683
+ /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(B, {
4609
4684
  className: "text-xs text-muted-foreground",
4610
4685
  children: "Status"
4611
4686
  }), /* @__PURE__ */ Q("div", {
4612
4687
  className: "mt-1",
4613
- children: /* @__PURE__ */ Q(Na, { status: z.status })
4688
+ children: /* @__PURE__ */ Q(za, { status: R.status })
4614
4689
  })] }),
4615
- /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
4690
+ /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(B, {
4616
4691
  className: "text-xs text-muted-foreground",
4617
4692
  children: "Proposed"
4618
4693
  }), /* @__PURE__ */ Q("div", {
4619
4694
  className: "mt-1 text-xs",
4620
- children: Pa(z.proposed_at)
4695
+ children: Ba(R.proposed_at)
4621
4696
  })] }),
4622
- /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
4697
+ /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(B, {
4623
4698
  className: "text-xs text-muted-foreground",
4624
4699
  children: "Proposed by"
4625
4700
  }), /* @__PURE__ */ Q("div", {
4626
4701
  className: "mt-1 text-xs font-mono break-all",
4627
- children: z.proposed_by ?? "—"
4702
+ children: R.proposed_by ?? "—"
4628
4703
  })] }),
4629
- /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
4704
+ /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(B, {
4630
4705
  className: "text-xs text-muted-foreground",
4631
4706
  children: "Decided by"
4632
4707
  }), /* @__PURE__ */ Q("div", {
4633
4708
  className: "mt-1 text-xs font-mono break-all",
4634
- children: z.decided_by ?? "—"
4709
+ children: R.decided_by ?? "—"
4635
4710
  })] }),
4636
- z.conversation_id ? /* @__PURE__ */ $("div", {
4711
+ R.conversation_id ? /* @__PURE__ */ $("div", {
4637
4712
  className: "col-span-2",
4638
- children: [/* @__PURE__ */ Q(V, {
4713
+ children: [/* @__PURE__ */ Q(B, {
4639
4714
  className: "text-xs text-muted-foreground",
4640
4715
  children: "Conversation"
4641
4716
  }), /* @__PURE__ */ Q("div", {
4642
4717
  className: "mt-1 text-xs font-mono break-all",
4643
- children: z.conversation_id
4718
+ children: R.conversation_id
4644
4719
  })]
4645
4720
  }) : null
4646
4721
  ]
4647
4722
  }),
4648
- /* @__PURE__ */ Q(pe, {}),
4649
- /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
4723
+ /* @__PURE__ */ Q(me, {}),
4724
+ /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(B, {
4650
4725
  className: "text-xs",
4651
4726
  children: "Tool input"
4652
4727
  }), /* @__PURE__ */ Q("div", {
4653
4728
  className: "mt-1.5",
4654
- children: /* @__PURE__ */ Q(Ia, { value: Fa(z.tool_input) })
4729
+ children: /* @__PURE__ */ Q(Ha, { value: Va(R.tool_input) })
4655
4730
  })] }),
4656
- z.result ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
4731
+ R.result ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(B, {
4657
4732
  className: "text-xs",
4658
4733
  children: "Result"
4659
4734
  }), /* @__PURE__ */ Q("div", {
4660
4735
  className: "mt-1.5",
4661
- children: /* @__PURE__ */ Q(Ia, { value: Fa(z.result) })
4736
+ children: /* @__PURE__ */ Q(Ha, { value: Va(R.result) })
4662
4737
  })] }) : null,
4663
- z.error ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
4738
+ R.error ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(B, {
4664
4739
  className: "text-xs text-destructive",
4665
4740
  children: "Error"
4666
4741
  }), /* @__PURE__ */ Q("div", {
4667
4742
  className: "mt-1.5",
4668
- children: /* @__PURE__ */ Q(Ia, { value: z.error })
4743
+ children: /* @__PURE__ */ Q(Ha, { value: R.error })
4669
4744
  })] }) : null,
4670
- z.rejection_reason ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
4745
+ R.rejection_reason ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(B, {
4671
4746
  className: "text-xs",
4672
4747
  children: "Rejection reason"
4673
4748
  }), /* @__PURE__ */ Q("div", {
4674
4749
  className: "mt-1.5 text-sm",
4675
- children: z.rejection_reason
4750
+ children: R.rejection_reason
4676
4751
  })] }) : null,
4677
- z.status === "pending" ? /* @__PURE__ */ $("div", {
4752
+ R.status === "pending" ? /* @__PURE__ */ $("div", {
4678
4753
  className: "pt-2 flex gap-2",
4679
4754
  children: [/* @__PURE__ */ $(v, {
4680
4755
  size: "sm",
4681
- onClick: () => void ie(z.id),
4682
- disabled: T === z.id,
4683
- children: [/* @__PURE__ */ Q(Y, { className: "h-3.5 w-3.5 mr-1" }), "Approve & Execute"]
4756
+ onClick: () => void ae(R.id),
4757
+ disabled: T === R.id,
4758
+ children: [/* @__PURE__ */ Q(J, { className: "h-3.5 w-3.5 mr-1" }), "Approve & Execute"]
4684
4759
  }), /* @__PURE__ */ $(v, {
4685
4760
  size: "sm",
4686
4761
  variant: "destructive",
4687
4762
  onClick: () => {
4688
- g(z.id), w("");
4763
+ g(R.id), w("");
4689
4764
  },
4690
- disabled: T === z.id,
4765
+ disabled: T === R.id,
4691
4766
  children: [/* @__PURE__ */ Q(X, { className: "h-3.5 w-3.5 mr-1" }), "Reject"]
4692
4767
  })]
4693
4768
  }) : null
@@ -4695,17 +4770,17 @@ function Ra({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4695
4770
  }) : null]
4696
4771
  })
4697
4772
  }),
4698
- /* @__PURE__ */ Q(me, {
4773
+ /* @__PURE__ */ Q(he, {
4699
4774
  open: !!h,
4700
4775
  onOpenChange: (e) => {
4701
4776
  e || (g(null), w(""));
4702
4777
  },
4703
- children: /* @__PURE__ */ $(he, {
4778
+ children: /* @__PURE__ */ $(ge, {
4704
4779
  side: "bottom",
4705
4780
  className: "max-h-[40vh]",
4706
- children: [/* @__PURE__ */ $(_e, { children: [/* @__PURE__ */ Q(ve, { children: "Reject this action?" }), /* @__PURE__ */ Q(ge, { children: "The reason is shown back to the AI so it can adjust its next response." })] }), /* @__PURE__ */ $("div", {
4781
+ children: [/* @__PURE__ */ $(ve, { children: [/* @__PURE__ */ Q(ye, { children: "Reject this action?" }), /* @__PURE__ */ Q(_e, { children: "The reason is shown back to the AI so it can adjust its next response." })] }), /* @__PURE__ */ $("div", {
4707
4782
  className: "px-4 mt-3 space-y-3",
4708
- children: [/* @__PURE__ */ Q(K, {
4783
+ children: [/* @__PURE__ */ Q(Ee, {
4709
4784
  value: _,
4710
4785
  onChange: (e) => w(e.target.value),
4711
4786
  placeholder: "Optional reason (e.g. 'Wrong record id — please confirm with the user first.')",
@@ -4723,7 +4798,7 @@ function Ra({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4723
4798
  }), /* @__PURE__ */ $(v, {
4724
4799
  variant: "destructive",
4725
4800
  size: "sm",
4726
- onClick: () => h && void B(h, _),
4801
+ onClick: () => h && void oe(h, _),
4727
4802
  disabled: !h || T === h,
4728
4803
  "data-testid": "ai-inbox-reject-confirm",
4729
4804
  children: [/* @__PURE__ */ Q(X, { className: "h-3.5 w-3.5 mr-1" }), "Reject"]
@@ -4736,14 +4811,14 @@ function Ra({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4736
4811
  }
4737
4812
  //#endregion
4738
4813
  //#region src/useHitlInChat.ts
4739
- function za(e) {
4814
+ function Ga(e) {
4740
4815
  return !e || e.length === 0 ? "/api/v1/ai" : e.endsWith("/") ? e.slice(0, -1) : e;
4741
4816
  }
4742
- function Ba(e, t) {
4817
+ function Ka(e, t) {
4743
4818
  let n = { ...e ?? {} };
4744
4819
  return t && (n["Content-Type"] = "application/json"), n;
4745
4820
  }
4746
- async function Va(e) {
4821
+ async function qa(e) {
4747
4822
  let t = await e.text();
4748
4823
  if (!t) return null;
4749
4824
  try {
@@ -4752,8 +4827,8 @@ async function Va(e) {
4752
4827
  return { raw: t };
4753
4828
  }
4754
4829
  }
4755
- function Ha(t) {
4756
- let { messages: n, apiBase: r, headers: i, onDecided: a, continueConversation: o } = t, s = za(r), c = e.useMemo(() => {
4830
+ function Ja(t) {
4831
+ let { messages: n, apiBase: r, headers: i, onDecided: a, continueConversation: o } = t, s = Ga(r), c = e.useMemo(() => {
4757
4832
  let e = /* @__PURE__ */ new Map();
4758
4833
  for (let t of n) {
4759
4834
  let n = t.toolInvocations ?? [];
@@ -4796,9 +4871,9 @@ function Ha(t) {
4796
4871
  let r = `${s}/pending-actions/${encodeURIComponent(l)}/${t ? "approve" : "reject"}`, c = t ? "{}" : JSON.stringify({ reason: n ?? "" }), d = await fetch(r, {
4797
4872
  method: "POST",
4798
4873
  credentials: "include",
4799
- headers: Ba(i, !0),
4874
+ headers: Ka(i, !0),
4800
4875
  body: c
4801
- }), f = await Va(d) ?? {};
4876
+ }), f = await qa(d) ?? {};
4802
4877
  if (!d.ok) {
4803
4878
  let t = typeof f.error == "string" ? f.error : `Approval failed: HTTP ${d.status}`;
4804
4879
  m(e, {
@@ -4831,7 +4906,7 @@ function Ha(t) {
4831
4906
  message: `Status: ${p}`
4832
4907
  }), h = !0;
4833
4908
  if (a?.(e, f), h && o) {
4834
- let r = Ua({
4909
+ let r = Ya({
4835
4910
  approved: t,
4836
4911
  status: p,
4837
4912
  toolName: u,
@@ -4867,24 +4942,24 @@ function Ha(t) {
4867
4942
  isDeciding: f
4868
4943
  };
4869
4944
  }
4870
- function Ua(e) {
4945
+ function Ya(e) {
4871
4946
  let { approved: t, status: n, toolName: r, pendingActionId: i, outcome: a, reason: o } = e, s = `[HITL ${i}]`;
4872
4947
  if (t && n === "executed") {
4873
4948
  let e = a.result;
4874
- return `${s} The operator approved the \`${r}\` call. It executed successfully with result: ${e == null ? "(no payload)" : typeof e == "string" ? e : Wa(JSON.stringify(e), 800)}. Acknowledge the outcome concisely and continue the user's task.`;
4949
+ return `${s} The operator approved the \`${r}\` call. It executed successfully with result: ${e == null ? "(no payload)" : typeof e == "string" ? e : Xa(JSON.stringify(e), 800)}. Acknowledge the outcome concisely and continue the user's task.`;
4875
4950
  }
4876
4951
  if (!t && n === "rejected") return `${s} The operator rejected the \`${r}\` call.${o && o.trim().length > 0 ? ` Reason: ${o}.` : ""} Acknowledge the rejection and ask whether to try a different approach.`;
4877
4952
  if (n === "failed") {
4878
4953
  let e = a.error;
4879
- return `${s} The \`${r}\` call was approved but execution failed: ${typeof e == "string" ? e : Wa(JSON.stringify(e ?? {}), 400)}. Apologize concisely and offer alternatives.`;
4954
+ return `${s} The \`${r}\` call was approved but execution failed: ${typeof e == "string" ? e : Xa(JSON.stringify(e ?? {}), 400)}. Apologize concisely and offer alternatives.`;
4880
4955
  }
4881
4956
  }
4882
- function Wa(e, t) {
4957
+ function Xa(e, t) {
4883
4958
  return e.length <= t ? e : `${e.slice(0, t - 1)}…`;
4884
4959
  }
4885
4960
  //#endregion
4886
4961
  //#region src/index.tsx
4887
- var Ga = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, disabled: a = !1, showTimestamp: o = !1, userAvatarUrl: s, userAvatarFallback: c = "You", assistantAvatarUrl: l, assistantAvatarFallback: u = "AI", maxHeight: d = "500px", ...f }, p) => {
4962
+ var Za = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, disabled: a = !1, showTimestamp: o = !1, userAvatarUrl: s, userAvatarFallback: c = "You", assistantAvatarUrl: l, assistantAvatarFallback: u = "AI", maxHeight: d = "500px", ...f }, p) => {
4888
4963
  let [m, h] = e.useState(""), g = e.useRef(null), _ = e.useRef(null);
4889
4964
  e.useEffect(() => {
4890
4965
  if (g.current) {
@@ -4902,7 +4977,7 @@ var Ga = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
4902
4977
  className: q("flex flex-col border rounded-lg bg-background overflow-hidden", t),
4903
4978
  style: { maxHeight: d },
4904
4979
  ...f,
4905
- children: [/* @__PURE__ */ Q(oe, {
4980
+ children: [/* @__PURE__ */ Q(se, {
4906
4981
  ref: g,
4907
4982
  className: "flex-1 p-4",
4908
4983
  children: /* @__PURE__ */ Q("div", {
@@ -4910,7 +4985,7 @@ var Ga = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
4910
4985
  children: n.length === 0 ? /* @__PURE__ */ Q("div", {
4911
4986
  className: "flex items-center justify-center h-32 text-muted-foreground text-sm",
4912
4987
  children: "No messages yet. Start a conversation!"
4913
- }) : n.map((e) => /* @__PURE__ */ Q(Ka, {
4988
+ }) : n.map((e) => /* @__PURE__ */ Q(Qa, {
4914
4989
  message: e,
4915
4990
  showTimestamp: o,
4916
4991
  userAvatarUrl: s,
@@ -4923,7 +4998,7 @@ var Ga = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
4923
4998
  className: "border-t p-4",
4924
4999
  children: /* @__PURE__ */ $("div", {
4925
5000
  className: "flex gap-2",
4926
- children: [/* @__PURE__ */ Q(ae, {
5001
+ children: [/* @__PURE__ */ Q(z, {
4927
5002
  ref: _,
4928
5003
  value: m,
4929
5004
  onChange: (e) => h(e.target.value),
@@ -4941,8 +5016,8 @@ var Ga = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
4941
5016
  })]
4942
5017
  });
4943
5018
  });
4944
- Ga.displayName = "Chatbot";
4945
- var Ka = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback: r, assistantAvatarUrl: i, assistantAvatarFallback: a }) => {
5019
+ Za.displayName = "Chatbot";
5020
+ var Qa = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback: r, assistantAvatarUrl: i, assistantAvatarFallback: a }) => {
4946
5021
  let o = e.role === "user";
4947
5022
  if (e.role === "system") return /* @__PURE__ */ Q("div", {
4948
5023
  className: "flex justify-center",
@@ -4974,7 +5049,7 @@ var Ka = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback:
4974
5049
  })]
4975
5050
  })]
4976
5051
  });
4977
- }, qa = e.forwardRef(({ className: e, avatarSrc: t, avatarFallback: n = "AI", ...r }, i) => /* @__PURE__ */ $("div", {
5052
+ }, $a = e.forwardRef(({ className: e, avatarSrc: t, avatarFallback: n = "AI", ...r }, i) => /* @__PURE__ */ $("div", {
4978
5053
  ref: i,
4979
5054
  className: q("flex gap-3", e),
4980
5055
  ...r,
@@ -4996,6 +5071,6 @@ var Ka = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback:
4996
5071
  })
4997
5072
  })]
4998
5073
  }));
4999
- qa.displayName = "TypingIndicator";
5074
+ $a.displayName = "TypingIndicator";
5000
5075
  //#endregion
5001
- export { sn as AGENT_ALIAS_GROUPS, Da as AIElements, Ra as AiPendingActionsInbox, Ga as Chatbot, ea as ChatbotEnhanced, wa as FloatingChatbot, Ln as FloatingChatbotPanel, Tn as FloatingChatbotProvider, jn as FloatingChatbotTrigger, mn as PLATFORM_DEFAULT_AGENT, qa as TypingIndicator, cn as agentAliasGroup, ln as agentRouteName, Jt as buildProgressFromDraftReview, Kt as detectDraftResult, Wt as detectProposedPlan, zn as humanizeToolName, pn as isAskAgent, fn as isBuildAgent, dn as isBuiltinAgentName, zi as publishHealthFromResponse, un as resolveAgentParam, hn as resolveDefaultAgentName, Vn as summarizeChatError, en as uiMessageToChatMessage, tn as uiMessagesToChatMessages, Bn as unwrapToolResult, xn as useAgents, Cn as useAiModels, En as useFloatingChatbot, Ha as useHitlInChat, on as useObjectChat, ja as usePendingActions };
5076
+ export { dn as AGENT_ALIAS_GROUPS, Na as AIElements, rn as AI_USAGE_REFRESH_EVENT, Wa as AiPendingActionsInbox, Za as Chatbot, oa as ChatbotEnhanced, Aa as FloatingChatbot, Un as FloatingChatbotPanel, jn as FloatingChatbotProvider, Ln as FloatingChatbotTrigger, bn as PLATFORM_DEFAULT_AGENT, $a as TypingIndicator, fn as agentAliasGroup, yn as agentHasCapability, pn as agentRouteName, Yt as buildProgressFromDraftReview, Gt as detectBuilderHandoff, qt as detectDraftResult, Kt as detectProposedChanges, Wt as detectProposedPlan, an as emitAiUsageRefresh, Gn as humanizeToolName, _n as isAskAgent, gn as isBuildAgent, hn as isBuiltinAgentName, Gi as publishHealthFromResponse, mn as resolveAgentParam, xn as resolveDefaultAgentName, qn as summarizeChatError, tn as uiMessageToChatMessage, nn as uiMessagesToChatMessages, Kn as unwrapToolResult, Dn as useAgents, kn as useAiModels, Mn as useFloatingChatbot, Ja as useHitlInChat, un as useObjectChat, La as usePendingActions };