@pstdio/ui 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/chat-ui.js CHANGED
@@ -1,10 +1,10 @@
1
- import { jsx as l, jsxs as x, Fragment as De } from "react/jsx-runtime";
1
+ import { jsx as l, jsxs as x, Fragment as Me } from "react/jsx-runtime";
2
2
  import { c as y } from "react/compiler-runtime";
3
- import { chakra as je, AbsoluteCenter as ft, IconButton as Ue, defineSlotRecipe as pt, createSlotRecipeContext as mt, Text as Q, Code as Me, Button as Ae, HStack as qe, Box as T, Flex as pe, Tooltip as fe, Portal as ht, Kbd as gt, Spacer as bt, Timeline as xt, Span as se, Avatar as Z, Card as M, Link as Ve, Stack as Ke, Spinner as yt } from "@chakra-ui/react";
4
- import { ArrowDownIcon as St, ShieldX as kt, ShieldCheck as Tt, Square as wt, ArrowUp as Ct, Move as Pt, FileDown as _t, FileUp as Rt, FileDiff as It, Trash2 as Bt, FilePen as At, FileText as Dt, ListTree as vt, Terminal as Ge, File as Ft, Globe as $t, Search as zt, AlertTriangle as Mt, DotIcon as Ot, ChevronUpIcon as Lt, MessageCircleIcon as Et } from "lucide-react";
5
- import { StickToBottom as Ye, useStickToBottomContext as Je } from "use-stick-to-bottom";
6
- import { useRef as Xe, useEffect as Qe, useState as oe } from "react";
7
- import { f as Re, P as Wt, g as Nt, R as Ze, h as Ht } from "./rich-message-CNDoACE7.js";
3
+ import { chakra as Ge, AbsoluteCenter as ht, IconButton as Ye, defineSlotRecipe as gt, createSlotRecipeContext as bt, Text as ne, Code as He, Button as Fe, HStack as Je, Box as k, Flex as ge, Tooltip as he, Portal as xt, Kbd as yt, Spacer as St, Timeline as kt, Span as ae, Avatar as re, Card as E, Link as Xe, Stack as Qe, Spinner as Tt } from "@chakra-ui/react";
4
+ import { ArrowDownIcon as wt, ShieldX as Ct, ShieldCheck as Pt, Square as _t, ArrowUp as It, Move as Rt, FileDown as Bt, FileUp as Dt, FileDiff as vt, Trash2 as At, FilePen as Ft, FileText as $t, ListTree as zt, Terminal as Ze, File as Mt, Globe as Ot, Search as Lt, AlertTriangle as Wt, DotIcon as Et, ChevronUpIcon as Ht, MessageCircleIcon as Nt } from "lucide-react";
5
+ import { StickToBottom as et, useStickToBottomContext as tt } from "use-stick-to-bottom";
6
+ import { useRef as $e, useEffect as ze, useState as ce } from "react";
7
+ import { f as De, P as jt, g as Ut, R as nt, h as Vt } from "./rich-message-B2gxL8oy.js";
8
8
  import "@lexical/react/LexicalCollaborationContext";
9
9
  import "@lexical/react/LexicalCollaborationPlugin";
10
10
  import "@lexical/react/LexicalComposer";
@@ -29,13 +29,13 @@ import "@lexical/react/LexicalAutoFocusPlugin";
29
29
  import "@lexical/react/LexicalHistoryPlugin";
30
30
  import "@lexical/react/LexicalOnChangePlugin";
31
31
  import "@lexical/react/LexicalTreeView";
32
- import { D as jt, a as Ut, E as qt } from "./empty-state-B8mbv7ZH.js";
33
- const Vt = {
32
+ import { D as qt, a as Kt, E as Gt } from "./empty-state-kQR0gd4j.js";
33
+ const Yt = {
34
34
  "aria-roledescription": "conversation",
35
35
  initial: "instant",
36
36
  resize: "instant",
37
37
  role: "log"
38
- }, Kt = je(Ye, {
38
+ }, Jt = Ge(et, {
39
39
  base: {
40
40
  position: "relative",
41
41
  flex: 1,
@@ -44,8 +44,8 @@ const Vt = {
44
44
  }
45
45
  }, {
46
46
  forwardProps: ["resize"],
47
- defaultProps: Vt
48
- }), Gt = je(Ye.Content, {
47
+ defaultProps: Yt
48
+ }), Xt = Ge(et.Content, {
49
49
  base: {
50
50
  p: "0"
51
51
  }
@@ -54,18 +54,18 @@ const Vt = {
54
54
  "aria-live": "polite",
55
55
  role: "list"
56
56
  }
57
- }), Yt = (t) => {
57
+ }), Qt = (t) => {
58
58
  const e = y(4), {
59
59
  isAtBottom: n,
60
- scrollToBottom: s
61
- } = Je();
60
+ scrollToBottom: i
61
+ } = tt();
62
62
  let r;
63
- return e[0] !== n || e[1] !== t || e[2] !== s ? (r = !n && /* @__PURE__ */ l(ft, { axis: "horizontal", bottom: "md", children: /* @__PURE__ */ l(Ue, { rounded: "full", onClick: () => s(), variant: "outline", size: "xs", ...t, children: /* @__PURE__ */ l(St, { size: 16 }) }) }), e[0] = n, e[1] = t, e[2] = s, e[3] = r) : r = e[3], r;
64
- }, Ie = {
65
- Root: Kt,
66
- Viewport: Gt,
67
- ScrollToBottom: Yt
68
- }, Jt = pt({
63
+ return e[0] !== n || e[1] !== t || e[2] !== i ? (r = !n && /* @__PURE__ */ l(ht, { axis: "horizontal", bottom: "md", children: /* @__PURE__ */ l(Ye, { rounded: "full", onClick: () => i(), variant: "outline", size: "xs", ...t, children: /* @__PURE__ */ l(wt, { size: 16 }) }) }), e[0] = n, e[1] = t, e[2] = i, e[3] = r) : r = e[3], r;
64
+ }, ve = {
65
+ Root: Jt,
66
+ Viewport: Xt,
67
+ ScrollToBottom: Qt
68
+ }, Zt = gt({
69
69
  className: "ai-message",
70
70
  slots: ["root", "content"],
71
71
  base: {
@@ -171,259 +171,263 @@ const Vt = {
171
171
  shape: "rounded"
172
172
  }
173
173
  }), {
174
- withProvider: Xt,
175
- withContext: Qt
176
- } = mt({
177
- recipe: Jt
178
- }), Zt = Xt("div", "root"), en = Qt("div", "content"), Oe = {
179
- Root: Zt,
180
- Content: en
181
- }, tn = (t) => {
174
+ withProvider: en,
175
+ withContext: tn
176
+ } = bt({
177
+ recipe: Zt
178
+ }), nn = en("div", "root"), rn = tn("div", "content"), Ne = {
179
+ Root: nn,
180
+ Content: rn
181
+ }, on = (t) => {
182
182
  if (t == null) return null;
183
183
  const e = typeof t == "string" ? t : JSON.stringify(t, null, 2);
184
184
  return e.length === 0 ? null : e.length > 200 ? `${e.slice(0, 200)}...` : e;
185
- }, lo = (t) => {
185
+ }, ao = (t) => {
186
186
  const e = y(19), {
187
187
  toolName: n,
188
- toolInput: s,
188
+ toolInput: i,
189
189
  onApprove: r,
190
190
  onDeny: o
191
191
  } = t;
192
- let i;
193
- e[0] !== s ? (i = tn(s), e[0] = s, e[1] = i) : i = e[1];
194
- const c = i;
192
+ let s;
193
+ e[0] !== i ? (s = on(i), e[0] = i, e[1] = s) : s = e[1];
194
+ const c = s;
195
195
  let d;
196
- e[2] !== n ? (d = /* @__PURE__ */ x(Q, { textStyle: "label/S/medium", color: "fg", children: [
196
+ e[2] !== n ? (d = /* @__PURE__ */ x(ne, { textStyle: "label/S/medium", color: "fg", children: [
197
197
  "Allow ",
198
- /* @__PURE__ */ l(Me, { size: "sm", children: n }),
198
+ /* @__PURE__ */ l(He, { size: "sm", children: n }),
199
199
  "?"
200
200
  ] }), e[2] = n, e[3] = d) : d = e[3];
201
201
  let a;
202
- e[4] !== c ? (a = c ? /* @__PURE__ */ l(Me, { size: "sm", whiteSpace: "pre-wrap", maxH: "6rem", overflowY: "auto", children: c }) : null, e[4] = c, e[5] = a) : a = e[5];
202
+ e[4] !== c ? (a = c ? /* @__PURE__ */ l(He, { size: "sm", whiteSpace: "pre-wrap", maxH: "6rem", overflowY: "auto", children: c }) : null, e[4] = c, e[5] = a) : a = e[5];
203
203
  let u;
204
- e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ l(kt, { size: 14 }), e[6] = u) : u = e[6];
204
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ l(Ct, { size: 14 }), e[6] = u) : u = e[6];
205
205
  let f;
206
- e[7] !== o ? (f = /* @__PURE__ */ x(Ae, { size: "xs", variant: "outline", onClick: o, children: [
206
+ e[7] !== o ? (f = /* @__PURE__ */ x(Fe, { size: "xs", variant: "outline", onClick: o, children: [
207
207
  u,
208
208
  "Deny"
209
209
  ] }), e[7] = o, e[8] = f) : f = e[8];
210
210
  let p;
211
- e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ l(Tt, { size: 14 }), e[9] = p) : p = e[9];
211
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ l(Pt, { size: 14 }), e[9] = p) : p = e[9];
212
212
  let m;
213
- e[10] !== r ? (m = /* @__PURE__ */ x(Ae, { size: "xs", colorPalette: "green", onClick: r, children: [
213
+ e[10] !== r ? (m = /* @__PURE__ */ x(Fe, { size: "xs", colorPalette: "green", onClick: r, children: [
214
214
  p,
215
215
  "Allow"
216
216
  ] }), e[10] = r, e[11] = m) : m = e[11];
217
217
  let h;
218
- e[12] !== f || e[13] !== m ? (h = /* @__PURE__ */ x(qe, { gap: "xs", justifyContent: "flex-end", children: [
218
+ e[12] !== f || e[13] !== m ? (h = /* @__PURE__ */ x(Je, { gap: "xs", justifyContent: "flex-end", children: [
219
219
  f,
220
220
  m
221
221
  ] }), e[12] = f, e[13] = m, e[14] = h) : h = e[14];
222
- let g;
223
- return e[15] !== d || e[16] !== a || e[17] !== h ? (g = /* @__PURE__ */ l(T, { px: "sm", py: "xs", mx: "sm", borderWidth: "1px", borderColor: "border.warning", borderRadius: "lg", bg: "bg.warning", children: /* @__PURE__ */ x(pe, { direction: "column", gap: "xs", children: [
222
+ let b;
223
+ return e[15] !== d || e[16] !== a || e[17] !== h ? (b = /* @__PURE__ */ l(k, { px: "sm", py: "xs", mx: "sm", borderWidth: "1px", borderColor: "border.warning", borderRadius: "lg", bg: "bg.warning", children: /* @__PURE__ */ x(ge, { direction: "column", gap: "xs", children: [
224
224
  d,
225
225
  a,
226
226
  h
227
- ] }) }), e[15] = d, e[16] = a, e[17] = h, e[18] = g) : g = e[18], g;
228
- }, nn = (t) => {
227
+ ] }) }), e[15] = d, e[16] = a, e[17] = h, e[18] = b) : b = e[18], b;
228
+ }, sn = (t) => {
229
229
  const {
230
230
  previousUserMessageCount: e,
231
231
  userMessageCount: n
232
232
  } = t;
233
233
  return e === 0 ? !1 : n > e;
234
234
  };
235
- function rn(t) {
235
+ function ln(t) {
236
236
  const e = y(4), {
237
237
  userMessageCount: n
238
238
  } = t, {
239
- scrollToBottom: s
240
- } = Je(), r = Xe(n);
241
- let o, i;
242
- return e[0] !== s || e[1] !== n ? (o = () => {
243
- nn({
239
+ scrollToBottom: i
240
+ } = tt(), r = $e(n);
241
+ let o, s;
242
+ return e[0] !== i || e[1] !== n ? (o = () => {
243
+ sn({
244
244
  previousUserMessageCount: r.current,
245
245
  userMessageCount: n
246
- }) && s(), r.current = n;
247
- }, i = [n, s], e[0] = s, e[1] = n, e[2] = o, e[3] = i) : (o = e[2], i = e[3]), Qe(o, i), null;
246
+ }) && i(), r.current = n;
247
+ }, s = [n, i], e[0] = i, e[1] = n, e[2] = o, e[3] = s) : (o = e[2], s = e[3]), ze(o, s), null;
248
248
  }
249
- const on = (t) => {
249
+ const cn = (t) => {
250
250
  const e = y(22);
251
- let n, s, r, o;
251
+ let n, i, r, o;
252
252
  e[0] !== t ? ({
253
253
  title: o,
254
254
  shortcut: r,
255
255
  canInterrupt: n,
256
- ...s
257
- } = t, e[0] = t, e[1] = n, e[2] = s, e[3] = r, e[4] = o) : (n = e[1], s = e[2], r = e[3], o = e[4]);
258
- const i = s["aria-label"] ?? o;
256
+ ...i
257
+ } = t, e[0] = t, e[1] = n, e[2] = i, e[3] = r, e[4] = o) : (n = e[1], i = e[2], r = e[3], o = e[4]);
258
+ const s = i["aria-label"] ?? o;
259
259
  let c;
260
- e[5] !== n ? (c = n ? /* @__PURE__ */ l(wt, { size: 16, strokeWidth: 2, fill: "currentColor" }) : /* @__PURE__ */ l(Ct, { size: 16, strokeWidth: 2 }), e[5] = n, e[6] = c) : c = e[6];
260
+ e[5] !== n ? (c = n ? /* @__PURE__ */ l(_t, { size: 16, strokeWidth: 2, fill: "currentColor" }) : /* @__PURE__ */ l(It, { size: 16, strokeWidth: 2 }), e[5] = n, e[6] = c) : c = e[6];
261
261
  const d = c;
262
262
  let a;
263
- e[7] !== i || e[8] !== d || e[9] !== s || e[10] !== o ? (a = /* @__PURE__ */ l(Ue, { size: "sm", variant: "solid", borderRadius: "full", colorPalette: "primary", "aria-label": i, title: o, ...s, children: d }), e[7] = i, e[8] = d, e[9] = s, e[10] = o, e[11] = a) : a = e[11];
263
+ e[7] !== s || e[8] !== d || e[9] !== i || e[10] !== o ? (a = /* @__PURE__ */ l(Ye, { size: "sm", variant: "solid", borderRadius: "full", colorPalette: "primary", "aria-label": s, title: o, ...i, children: d }), e[7] = s, e[8] = d, e[9] = i, e[10] = o, e[11] = a) : a = e[11];
264
264
  const u = a;
265
265
  if (o) {
266
266
  let f;
267
- e[12] !== r || e[13] !== o ? (f = r ? /* @__PURE__ */ x(De, { children: [
267
+ e[12] !== r || e[13] !== o ? (f = r ? /* @__PURE__ */ x(Me, { children: [
268
268
  o,
269
269
  " ",
270
- /* @__PURE__ */ l(gt, { fontSize: "xs", children: r })
270
+ /* @__PURE__ */ l(yt, { fontSize: "xs", children: r })
271
271
  ] }) : o, e[12] = r, e[13] = o, e[14] = f) : f = e[14];
272
272
  const p = f;
273
273
  let m;
274
- e[15] !== u ? (m = /* @__PURE__ */ l(fe.Trigger, { asChild: !0, children: u }), e[15] = u, e[16] = m) : m = e[16];
274
+ e[15] !== u ? (m = /* @__PURE__ */ l(he.Trigger, { asChild: !0, children: u }), e[15] = u, e[16] = m) : m = e[16];
275
275
  let h;
276
- e[17] !== p ? (h = /* @__PURE__ */ l(ht, { children: /* @__PURE__ */ l(fe.Positioner, { children: /* @__PURE__ */ l(fe.Content, { children: p }) }) }), e[17] = p, e[18] = h) : h = e[18];
277
- let g;
278
- return e[19] !== m || e[20] !== h ? (g = /* @__PURE__ */ x(fe.Root, { closeDelay: 50, openDelay: 100, children: [
276
+ e[17] !== p ? (h = /* @__PURE__ */ l(xt, { children: /* @__PURE__ */ l(he.Positioner, { children: /* @__PURE__ */ l(he.Content, { children: p }) }) }), e[17] = p, e[18] = h) : h = e[18];
277
+ let b;
278
+ return e[19] !== m || e[20] !== h ? (b = /* @__PURE__ */ x(he.Root, { closeDelay: 50, openDelay: 100, children: [
279
279
  m,
280
280
  h
281
- ] }), e[19] = m, e[20] = h, e[21] = g) : g = e[21], g;
281
+ ] }), e[19] = m, e[20] = h, e[21] = b) : b = e[21], b;
282
282
  }
283
283
  return u;
284
- }, sn = (t) => {
285
- const e = y(61), {
284
+ }, an = (t) => {
285
+ const e = y(62), {
286
286
  defaultState: n,
287
- onSubmit: s,
287
+ onSubmit: i,
288
288
  onInterrupt: r,
289
289
  streaming: o,
290
- attachedResources: i,
290
+ attachedResources: s,
291
291
  onClearAttachments: c,
292
292
  isDisabled: d,
293
293
  onChange: a,
294
294
  placeholder: u,
295
295
  attachmentList: f,
296
296
  actions: p
297
- } = t, m = s === void 0 ? ln : s, h = o === void 0 ? !1 : o;
298
- let g;
299
- e[0] !== i ? (g = i === void 0 ? [] : i, e[0] = i, e[1] = g) : g = e[1];
300
- const S = g, k = d === void 0 ? !1 : d, [P, D] = oe(!1), [B, v] = oe(n), [A, F] = oe(0);
297
+ } = t, m = i === void 0 ? dn : i, h = o === void 0 ? !1 : o;
298
+ let b;
299
+ e[0] !== s ? (b = s === void 0 ? [] : s, e[0] = s, e[1] = b) : b = e[1];
300
+ const S = b, T = d === void 0 ? !1 : d, [P, z] = ce(!1), [v, M] = ce(n), [A, O] = ce(0);
301
301
  let _;
302
- e[2] !== n ? (_ = () => Re(n), e[2] = n, e[3] = _) : _ = e[3];
303
- const [C, O] = oe(_), $ = Xe(null);
304
- let R, I;
305
- e[4] !== n || e[5] !== a ? (R = () => {
306
- const w = Re(n);
307
- v(n), F(cn), O(w), a?.(w);
308
- }, I = [n, a], e[4] = n, e[5] = a, e[6] = R, e[7] = I) : (R = e[6], I = e[7]), Qe(R, I);
309
- let z;
310
- e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (z = () => {
311
- const w = $.current?.querySelector('[contenteditable="true"]');
302
+ e[2] !== n ? (_ = () => De(n), e[2] = n, e[3] = _) : _ = e[3];
303
+ const [C, F] = ce(_), L = $e(null), $ = $e(a);
304
+ let W, I;
305
+ e[4] !== a ? (W = () => {
306
+ $.current = a;
307
+ }, I = [a], e[4] = a, e[5] = W, e[6] = I) : (W = e[5], I = e[6]), ze(W, I);
308
+ let R, B;
309
+ e[7] !== n ? (R = () => {
310
+ const w = De(n);
311
+ M(n), O(un), F(w), $.current?.(w);
312
+ }, B = [n], e[7] = n, e[8] = R, e[9] = B) : (R = e[8], B = e[9]), ze(R, B);
313
+ let D;
314
+ e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (D = () => {
315
+ const w = L.current?.querySelector('[contenteditable="true"]');
312
316
  w instanceof HTMLElement && w.focus();
313
- }, e[8] = z) : z = e[8];
314
- const N = z;
317
+ }, e[10] = D) : D = e[10];
318
+ const j = D;
315
319
  let H;
316
- e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (H = () => {
317
- D(!0), N();
318
- }, e[9] = H) : H = e[9];
319
- const ye = H;
320
- let L;
321
- e[10] !== n || e[11] !== a ? (L = (w) => {
322
- const ut = w === void 0 ? !1 : w;
323
- v(n), F(an);
324
- const ze = Re(n);
325
- O(ze), a?.(ze), ut && requestAnimationFrame(() => {
326
- N();
320
+ e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (H = () => {
321
+ z(!0), j();
322
+ }, e[11] = H) : H = e[11];
323
+ const Te = H;
324
+ let K;
325
+ e[12] !== n ? (K = (w) => {
326
+ const mt = w === void 0 ? !1 : w;
327
+ M(n), O(fn);
328
+ const Ee = De(n);
329
+ F(Ee), $.current?.(Ee), mt && requestAnimationFrame(() => {
330
+ j();
327
331
  });
328
- }, e[10] = n, e[11] = a, e[12] = L) : L = e[12];
329
- const j = L;
330
- let ie;
331
- e[13] !== S || e[14] !== k || e[15] !== c || e[16] !== r || e[17] !== m || e[18] !== j || e[19] !== h || e[20] !== C ? (ie = () => {
332
- if (k)
332
+ }, e[12] = n, e[13] = K) : K = e[13];
333
+ const U = K;
334
+ let V;
335
+ e[14] !== S || e[15] !== T || e[16] !== c || e[17] !== r || e[18] !== m || e[19] !== U || e[20] !== h || e[21] !== C ? (V = () => {
336
+ if (T)
333
337
  return;
334
338
  if (h) {
335
339
  r?.();
336
340
  return;
337
341
  }
338
342
  const w = C.trim();
339
- w && (m(w, S), j(!0), c?.());
340
- }, e[13] = S, e[14] = k, e[15] = c, e[16] = r, e[17] = m, e[18] = j, e[19] = h, e[20] = C, e[21] = ie) : ie = e[21];
341
- const U = ie, W = h && !!r;
342
- let le;
343
- e[22] !== u ? (le = u ? /* @__PURE__ */ l(Q, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: u }) : void 0, e[22] = u, e[23] = le) : le = e[23];
344
- const Se = le, ke = P ? "blue.border" : "border.muted", Te = P ? "mid" : "low", we = P ? "blue.border" : "border";
345
- let q;
346
- e[24] !== we ? (q = {
347
- borderColor: we,
343
+ w && (m(w, S), U(!0), c?.());
344
+ }, e[14] = S, e[15] = T, e[16] = c, e[17] = r, e[18] = m, e[19] = U, e[20] = h, e[21] = C, e[22] = V) : V = e[22];
345
+ const G = V, q = h && !!r;
346
+ let de;
347
+ e[23] !== u ? (de = u ? /* @__PURE__ */ l(ne, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: u }) : void 0, e[23] = u, e[24] = de) : de = e[24];
348
+ const we = de, Ce = P ? "blue.border" : "border.muted", Pe = P ? "mid" : "low", _e = P ? "blue.border" : "border";
349
+ let Y;
350
+ e[25] !== _e ? (Y = {
351
+ borderColor: _e,
348
352
  boxShadow: "mid"
349
- }, e[24] = we, e[25] = q) : q = e[25];
350
- let ce;
351
- e[26] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ce = {
353
+ }, e[25] = _e, e[26] = Y) : Y = e[26];
354
+ let ue;
355
+ e[27] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ue = {
352
356
  borderColor: "blue.border",
353
357
  boxShadow: "mid"
354
- }, e[26] = ce) : ce = e[26];
355
- let ae;
356
- e[27] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ae = () => D(!1), e[27] = ae) : ae = e[27];
357
- const Ce = !k;
358
- let V;
359
- e[28] !== a ? (V = (w) => {
360
- O(w), a?.(w);
361
- }, e[28] = a, e[29] = V) : V = e[29];
362
- let K;
363
- e[30] !== A || e[31] !== B || e[32] !== U || e[33] !== Se || e[34] !== Ce || e[35] !== V ? (K = /* @__PURE__ */ l(Wt, { defaultState: B, isEditable: Ce, placeholder: Se, onChange: V, onSubmit: U }, A), e[30] = A, e[31] = B, e[32] = U, e[33] = Se, e[34] = Ce, e[35] = V, e[36] = K) : K = e[36];
364
- let de;
365
- e[37] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (de = /* @__PURE__ */ l(bt, {}), e[37] = de) : de = e[37];
366
- const Pe = W ? "Stop Response" : "Message Sending", _e = h ? void 0 : "Enter";
367
- let G;
368
- e[38] !== W || e[39] !== k || e[40] !== h || e[41] !== C ? (G = h && !W || !h && !C.trim() || k, e[38] = W, e[39] = k, e[40] = h, e[41] = C, e[42] = G) : G = e[42];
369
- let Y;
370
- e[43] !== W || e[44] !== U || e[45] !== Pe || e[46] !== _e || e[47] !== G ? (Y = /* @__PURE__ */ l(on, { canInterrupt: W, title: Pe, shortcut: _e, onClick: U, disabled: G }), e[43] = W, e[44] = U, e[45] = Pe, e[46] = _e, e[47] = G, e[48] = Y) : Y = e[48];
358
+ }, e[27] = ue) : ue = e[27];
359
+ let fe;
360
+ e[28] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (fe = () => z(!1), e[28] = fe) : fe = e[28];
361
+ const Ie = !T;
371
362
  let J;
372
- e[49] !== p || e[50] !== Y ? (J = /* @__PURE__ */ x(qe, { gap: "1", mt: "md", children: [
373
- p,
374
- de,
375
- Y
376
- ] }), e[49] = p, e[50] = Y, e[51] = J) : J = e[51];
363
+ e[29] !== a ? (J = (w) => {
364
+ F(w), a?.(w);
365
+ }, e[29] = a, e[30] = J) : J = e[30];
377
366
  let X;
378
- e[52] !== f || e[53] !== K || e[54] !== J ? (X = /* @__PURE__ */ x(pe, { direction: "column", color: "fg", children: [
367
+ e[31] !== A || e[32] !== v || e[33] !== G || e[34] !== we || e[35] !== Ie || e[36] !== J ? (X = /* @__PURE__ */ l(k, { maxH: "10rem", overflowY: "auto", children: /* @__PURE__ */ l(jt, { defaultState: v, isEditable: Ie, placeholder: we, onChange: J, onSubmit: G }, A) }), e[31] = A, e[32] = v, e[33] = G, e[34] = we, e[35] = Ie, e[36] = J, e[37] = X) : X = e[37];
368
+ let pe;
369
+ e[38] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (pe = /* @__PURE__ */ l(St, {}), e[38] = pe) : pe = e[38];
370
+ const Re = q ? "Stop Response" : "Message Sending", Be = h ? void 0 : "Enter";
371
+ let Q;
372
+ e[39] !== q || e[40] !== T || e[41] !== h || e[42] !== C ? (Q = h && !q || !h && !C.trim() || T, e[39] = q, e[40] = T, e[41] = h, e[42] = C, e[43] = Q) : Q = e[43];
373
+ let Z;
374
+ e[44] !== q || e[45] !== G || e[46] !== Re || e[47] !== Be || e[48] !== Q ? (Z = /* @__PURE__ */ l(cn, { canInterrupt: q, title: Re, shortcut: Be, onClick: G, disabled: Q }), e[44] = q, e[45] = G, e[46] = Re, e[47] = Be, e[48] = Q, e[49] = Z) : Z = e[49];
375
+ let ee;
376
+ e[50] !== p || e[51] !== Z ? (ee = /* @__PURE__ */ x(Je, { gap: "1", mt: "md", children: [
377
+ p,
378
+ pe,
379
+ Z
380
+ ] }), e[50] = p, e[51] = Z, e[52] = ee) : ee = e[52];
381
+ let te;
382
+ e[53] !== f || e[54] !== X || e[55] !== ee ? (te = /* @__PURE__ */ x(ge, { direction: "column", color: "fg", children: [
379
383
  f,
380
- K,
381
- J
382
- ] }), e[52] = f, e[53] = K, e[54] = J, e[55] = X) : X = e[55];
383
- let ue;
384
- return e[56] !== ke || e[57] !== Te || e[58] !== q || e[59] !== X ? (ue = /* @__PURE__ */ l(T, { ref: $, width: "100%", paddingX: "lg", paddingY: "md", bg: "bg", borderRadius: "md", borderWidth: "1px", borderStyle: "solid", borderColor: ke, boxShadow: Te, transition: "box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out", _hover: q, _focusWithin: ce, onClick: ye, onBlur: ae, children: X }), e[56] = ke, e[57] = Te, e[58] = q, e[59] = X, e[60] = ue) : ue = e[60], ue;
384
+ X,
385
+ ee
386
+ ] }), e[53] = f, e[54] = X, e[55] = ee, e[56] = te) : te = e[56];
387
+ let me;
388
+ return e[57] !== Ce || e[58] !== Pe || e[59] !== Y || e[60] !== te ? (me = /* @__PURE__ */ l(k, { ref: L, width: "100%", paddingX: "lg", paddingY: "md", bg: "bg", borderRadius: "md", borderWidth: "1px", borderStyle: "solid", borderColor: Ce, boxShadow: Pe, transition: "box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out", _hover: Y, _focusWithin: ue, onClick: Te, onBlur: fe, children: te }), e[57] = Ce, e[58] = Pe, e[59] = Y, e[60] = te, e[61] = me) : me = e[61], me;
385
389
  };
386
- function ln() {
390
+ function dn() {
387
391
  }
388
- function cn(t) {
392
+ function un(t) {
389
393
  return t + 1;
390
394
  }
391
- function an(t) {
395
+ function fn(t) {
392
396
  return t + 1;
393
397
  }
394
- const dn = (t = "") => JSON.stringify(Nt(t)), un = (t) => {
398
+ const pn = (t = "") => JSON.stringify(Ut(t)), mn = (t) => {
395
399
  const e = y(8);
396
- let n, s;
400
+ let n, i;
397
401
  e[0] !== t ? ({
398
402
  children: n,
399
- ...s
400
- } = t, e[0] = t, e[1] = n, e[2] = s) : (n = e[1], s = e[2]);
403
+ ...i
404
+ } = t, e[0] = t, e[1] = n, e[2] = i) : (n = e[1], i = e[2]);
401
405
  let r;
402
- e[3] !== n ? (r = /* @__PURE__ */ l(Ze, { defaultState: n }), e[3] = n, e[4] = r) : r = e[4];
406
+ e[3] !== n ? (r = /* @__PURE__ */ l(nt, { defaultState: n }), e[3] = n, e[4] = r) : r = e[4];
403
407
  let o;
404
- return e[5] !== s || e[6] !== r ? (o = /* @__PURE__ */ l(T, { ...s, children: r }), e[5] = s, e[6] = r, e[7] = o) : o = e[7], o;
405
- }, fn = un, et = {
406
- shell: Ge,
407
- ls: vt,
408
- read_file: Dt,
409
- write_file: At,
410
- delete_file: Bt,
411
- patch: It,
412
- upload_files: Rt,
413
- download_file: _t,
414
- move_file: Pt
415
- }, pn = {
416
- dot: Ot,
417
- danger: Mt,
418
- search: zt,
419
- browser: $t,
420
- file: Ft,
421
- terminal: Ge,
422
- ...et
423
- }, Le = "dot", mn = (t) => Object.hasOwn(et, t), hn = (t) => pn[t], tt = (t) => {
424
- if (!t) return Le;
408
+ return e[5] !== i || e[6] !== r ? (o = /* @__PURE__ */ l(k, { ...i, children: r }), e[5] = i, e[6] = r, e[7] = o) : o = e[7], o;
409
+ }, hn = mn, rt = {
410
+ shell: Ze,
411
+ ls: zt,
412
+ read_file: $t,
413
+ write_file: Ft,
414
+ delete_file: At,
415
+ patch: vt,
416
+ upload_files: Dt,
417
+ download_file: Bt,
418
+ move_file: Rt
419
+ }, gn = {
420
+ dot: Et,
421
+ danger: Wt,
422
+ search: Lt,
423
+ browser: Ot,
424
+ file: Mt,
425
+ terminal: Ze,
426
+ ...rt
427
+ }, je = "dot", bn = (t) => Object.hasOwn(rt, t), xn = (t) => gn[t], ot = (t) => {
428
+ if (!t) return je;
425
429
  const e = t.replace(/^tool-/, "");
426
- if (mn(e)) return e;
430
+ if (bn(e)) return e;
427
431
  switch (e) {
428
432
  case "read":
429
433
  return "file";
@@ -443,52 +447,52 @@ const dn = (t = "") => JSON.stringify(Nt(t)), un = (t) => {
443
447
  case "file":
444
448
  return "file";
445
449
  default:
446
- return Le;
450
+ return je;
447
451
  }
448
452
  };
449
- function ve(t) {
453
+ function Oe(t) {
450
454
  const e = t.lastIndexOf("/");
451
455
  return e >= 0 ? t.slice(e + 1) : t;
452
456
  }
453
- function me(t) {
457
+ function be(t) {
454
458
  if (!t) return null;
455
459
  const e = t.split(" ")[0].trim();
456
460
  if (e === "/dev/null") return null;
457
461
  let n = e;
458
462
  return (n.startsWith("a/") || n.startsWith("b/")) && (n = n.slice(2)), n.replace(/^\/+/, "").replace(/\\/g, "/");
459
463
  }
460
- const ge = (t) => t.startsWith("--- "), Fe = (t) => t.startsWith("+++ "), $e = (t) => t.startsWith("@@"), gn = (t) => t.startsWith("+") && !(Fe(t) || t === "+++"), bn = (t) => t.startsWith("-") && !(ge(t) || t === "---"), xn = (t, e) => {
464
+ const ye = (t) => t.startsWith("--- "), Le = (t) => t.startsWith("+++ "), We = (t) => t.startsWith("@@"), yn = (t) => t.startsWith("+") && !(Le(t) || t === "+++"), Sn = (t) => t.startsWith("-") && !(ye(t) || t === "---"), kn = (t, e) => {
461
465
  t.has(e) || t.set(e, {
462
466
  additions: 0,
463
467
  deletions: 0
464
468
  });
465
- }, yn = (t, e) => {
469
+ }, Tn = (t, e) => {
466
470
  const n = t.get(e);
467
471
  n && (n.additions += 1);
468
- }, Sn = (t, e) => {
472
+ }, wn = (t, e) => {
469
473
  const n = t.get(e);
470
474
  n && (n.deletions += 1);
471
- }, kn = (t, e, n) => {
472
- if (ge(t))
475
+ }, Cn = (t, e, n) => {
476
+ if (ye(t))
473
477
  return {
474
478
  ...e,
475
- lastMinusHeader: me(t.slice(4)),
479
+ lastMinusHeader: be(t.slice(4)),
476
480
  inHunk: !1
477
481
  };
478
- if (Fe(t)) {
479
- const r = me(t.slice(4)) ?? e.lastMinusHeader;
480
- return r && xn(n, r), {
482
+ if (Le(t)) {
483
+ const r = be(t.slice(4)) ?? e.lastMinusHeader;
484
+ return r && kn(n, r), {
481
485
  ...e,
482
486
  currentPath: r,
483
487
  inHunk: !1
484
488
  };
485
489
  }
486
- return e.currentPath ? $e(t) ? {
490
+ return e.currentPath ? We(t) ? {
487
491
  ...e,
488
492
  inHunk: !0
489
- } : e.inHunk ? gn(t) ? (yn(n, e.currentPath), e) : (bn(t) && Sn(n, e.currentPath), e) : e : e;
493
+ } : e.inHunk ? yn(t) ? (Tn(n, e.currentPath), e) : (Sn(t) && wn(n, e.currentPath), e) : e : e;
490
494
  };
491
- function nt(t) {
495
+ function it(t) {
492
496
  if (!t || typeof t != "string") return [];
493
497
  const e = /* @__PURE__ */ new Map();
494
498
  let n = {
@@ -496,34 +500,34 @@ function nt(t) {
496
500
  lastMinusHeader: null,
497
501
  inHunk: !1
498
502
  };
499
- const s = t.split(/\r?\n/);
500
- for (const r of s)
501
- n = kn(r, n, e);
503
+ const i = t.split(/\r?\n/);
504
+ for (const r of i)
505
+ n = Cn(r, n, e);
502
506
  return Array.from(e.entries()).map(([r, {
503
507
  additions: o,
504
- deletions: i
508
+ deletions: s
505
509
  }]) => ({
506
510
  filePath: r,
507
511
  additions: o,
508
- deletions: i
512
+ deletions: s
509
513
  }));
510
514
  }
511
- function Tn(t) {
512
- return nt(t).map((e) => ({
515
+ function Pn(t) {
516
+ return it(t).map((e) => ({
513
517
  kind: "diff",
514
- fileName: ve(e.filePath),
518
+ fileName: Oe(e.filePath),
515
519
  filePath: e.filePath,
516
520
  additions: e.additions,
517
521
  deletions: e.deletions
518
522
  }));
519
523
  }
520
- function wn(t) {
521
- return nt(t).map((e) => e.filePath);
524
+ function _n(t) {
525
+ return it(t).map((e) => e.filePath);
522
526
  }
523
- const rt = (t) => ge(t) || t.startsWith("diff --git "), Cn = (t) => t.startsWith(" ") || t.startsWith("+") || t.startsWith("-") ? !1 : t.trim() !== "", Pn = (t, e, n) => {
527
+ const st = (t) => ye(t) || t.startsWith("diff --git "), In = (t) => t.startsWith(" ") || t.startsWith("+") || t.startsWith("-") ? !1 : t.trim() !== "", Rn = (t, e, n) => {
524
528
  if (t.startsWith(" ")) {
525
- const s = t.slice(1);
526
- e.push(s), n.push(s);
529
+ const i = t.slice(1);
530
+ e.push(i), n.push(i);
527
531
  return;
528
532
  }
529
533
  if (t.startsWith("-")) {
@@ -531,86 +535,86 @@ const rt = (t) => ge(t) || t.startsWith("diff --git "), Cn = (t) => t.startsWith
531
535
  return;
532
536
  }
533
537
  t.startsWith("+") && n.push(t.slice(1));
534
- }, _n = (t, e, n, s) => {
538
+ }, Bn = (t, e, n, i) => {
535
539
  let r = e;
536
540
  for (; r < t.length; ) {
537
541
  const o = t[r] || "";
538
- if (rt(o) || $e(o) || Cn(o))
542
+ if (st(o) || We(o) || In(o))
539
543
  break;
540
- Pn(o, n, s), r += 1;
544
+ Rn(o, n, i), r += 1;
541
545
  }
542
- return (n.length > 0 || s.length > 0) && (n.push(""), s.push("")), r;
543
- }, Rn = (t, e) => {
544
- const n = me((t[e] || "").slice(4)), s = t[e + 1] || "";
545
- if (!Fe(s)) return {
546
+ return (n.length > 0 || i.length > 0) && (n.push(""), i.push("")), r;
547
+ }, Dn = (t, e) => {
548
+ const n = be((t[e] || "").slice(4)), i = t[e + 1] || "";
549
+ if (!Le(i)) return {
546
550
  nextIndex: e + 1
547
551
  };
548
- const o = me(s.slice(4)) ?? n ?? "", i = [], c = [];
552
+ const o = be(i.slice(4)) ?? n ?? "", s = [], c = [];
549
553
  let d = e + 2;
550
554
  for (; d < t.length; ) {
551
555
  const a = t[d] || "";
552
- if (rt(a)) break;
553
- if (!$e(a)) {
556
+ if (st(a)) break;
557
+ if (!We(a)) {
554
558
  d += 1;
555
559
  continue;
556
560
  }
557
- d = _n(t, d + 1, i, c);
561
+ d = Bn(t, d + 1, s, c);
558
562
  }
559
563
  return {
560
564
  nextIndex: d,
561
565
  preview: {
562
566
  filePath: o,
563
- original: i.join(`
567
+ original: s.join(`
564
568
  `),
565
569
  modified: c.join(`
566
570
  `)
567
571
  }
568
572
  };
569
573
  };
570
- function In(t) {
574
+ function vn(t) {
571
575
  if (!t || typeof t != "string") return [];
572
576
  const e = t.split(/\r?\n/), n = [];
573
- let s = 0;
574
- for (; s < e.length; ) {
575
- const r = e[s] || "";
576
- if (!ge(r)) {
577
- s += 1;
577
+ let i = 0;
578
+ for (; i < e.length; ) {
579
+ const r = e[i] || "";
580
+ if (!ye(r)) {
581
+ i += 1;
578
582
  continue;
579
583
  }
580
584
  const {
581
585
  nextIndex: o,
582
- preview: i
583
- } = Rn(e, s);
584
- i && n.push(i), s = Math.max(o, s + 1);
586
+ preview: s
587
+ } = Dn(e, i);
588
+ s && n.push(s), i = Math.max(o, i + 1);
585
589
  }
586
590
  return n;
587
591
  }
588
- const Bn = {
592
+ const An = {
589
593
  apply_patch: "Apply patch",
590
594
  read: "Read file",
591
595
  bash: "Run",
592
596
  grep: "Search files",
593
597
  glob: "Find files",
594
598
  skill: "Load skill"
595
- }, Ee = {
599
+ }, Ue = {
596
600
  pending: "queued",
597
601
  error: "failed",
598
602
  "output-error": "failed",
599
603
  "input-streaming": "running",
600
604
  "input-available": "queued"
601
- }, ot = (t) => t.replace(/^tool-/, ""), An = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Dn = (t) => ot(t.tool ?? "tool"), vn = (t) => {
602
- const e = ot(t);
603
- return Bn[e] ?? An(e.replace(/_/g, " "));
604
- }, Fn = (t) => !t || typeof t != "string" ? null : Ee[t] ? Ee[t] : t.includes("stream") ? "running" : null, st = (t) => t === "error" || t === "output-error", ee = (t) => st(t.state?.status) ? {
605
+ }, lt = (t) => t.replace(/^tool-/, ""), Fn = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), $n = (t) => lt(t.tool ?? "tool"), zn = (t) => {
606
+ const e = lt(t);
607
+ return An[e] ?? Fn(e.replace(/_/g, " "));
608
+ }, Mn = (t) => !t || typeof t != "string" ? null : Ue[t] ? Ue[t] : t.includes("stream") ? "running" : null, ct = (t) => t === "error" || t === "output-error", oe = (t) => ct(t.state?.status) ? {
605
609
  type: "icon",
606
610
  icon: "danger"
607
611
  } : {
608
612
  type: "icon",
609
- icon: tt(Dn(t))
610
- }, te = (t, e, n) => {
613
+ icon: ot($n(t))
614
+ }, ie = (t, e, n) => {
611
615
  const r = [{
612
616
  kind: "text",
613
- text: n ?? vn(t.tool ?? "tool"),
617
+ text: n ?? zn(t.tool ?? "tool"),
614
618
  bold: !0
615
619
  }];
616
620
  e && r.push({
@@ -618,93 +622,93 @@ const Bn = {
618
622
  text: e,
619
623
  muted: !0
620
624
  });
621
- const o = Fn(t.state?.status);
625
+ const o = Mn(t.state?.status);
622
626
  return o && r.push({
623
627
  kind: "text",
624
628
  text: o,
625
629
  muted: !0
626
630
  }), r;
627
- }, ne = (t) => {
631
+ }, se = (t) => {
628
632
  const e = t.state?.input;
629
633
  return !e || typeof e != "object" || Array.isArray(e) ? null : e;
630
- }, be = (t) => {
634
+ }, Se = (t) => {
631
635
  const e = t.state?.output;
632
636
  return !e || typeof e != "object" || Array.isArray(e) ? null : e;
633
- }, b = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, he = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, $n = (t, e) => {
634
- const n = he(t.state);
635
- return n ? he(n[e]) : null;
636
- }, zn = (t) => t.replace(/\\/g, "/").replace(/^\/+/, ""), Mn = (t) => t.includes("--- ") && t.includes("+++ ") && t.includes("@@"), it = (t) => {
637
- const e = be(t);
638
- return [$n(t, "metadata"), he(e?.metadata)].filter(Boolean);
639
- }, On = (t) => {
640
- const e = he(t);
637
+ }, g = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, xe = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, On = (t, e) => {
638
+ const n = xe(t.state);
639
+ return n ? xe(n[e]) : null;
640
+ }, Ln = (t) => t.replace(/\\/g, "/").replace(/^\/+/, ""), Wn = (t) => t.includes("--- ") && t.includes("+++ ") && t.includes("@@"), at = (t) => {
641
+ const e = Se(t);
642
+ return [On(t, "metadata"), xe(e?.metadata)].filter(Boolean);
643
+ }, En = (t) => {
644
+ const e = xe(t);
641
645
  if (!e) return null;
642
- const n = b(e.filePath) ?? b(e.relativePath) ?? b(e.path);
646
+ const n = g(e.filePath) ?? g(e.relativePath) ?? g(e.path);
643
647
  return n ? {
644
- filePath: zn(n),
648
+ filePath: Ln(n),
645
649
  additions: typeof e.additions == "number" ? e.additions : 0,
646
650
  deletions: typeof e.deletions == "number" ? e.deletions : 0,
647
- diff: b(e.diff) ?? void 0,
648
- before: b(e.before) ?? void 0,
649
- after: b(e.after) ?? void 0
651
+ diff: g(e.diff) ?? void 0,
652
+ before: g(e.before) ?? void 0,
653
+ after: g(e.after) ?? void 0
650
654
  } : null;
651
- }, lt = (t) => {
655
+ }, dt = (t) => {
652
656
  const e = [];
653
- for (const n of it(t)) {
654
- const s = Array.isArray(n.files) ? n.files : [];
655
- for (const r of s) {
656
- const o = On(r);
657
+ for (const n of at(t)) {
658
+ const i = Array.isArray(n.files) ? n.files : [];
659
+ for (const r of i) {
660
+ const o = En(r);
657
661
  o && e.push(o);
658
662
  }
659
663
  }
660
664
  return e;
661
- }, Ln = (t) => {
662
- const e = ne(t), n = b(e?.diff);
665
+ }, Hn = (t) => {
666
+ const e = se(t), n = g(e?.diff);
663
667
  if (n) return n;
664
- for (const o of it(t)) {
665
- const i = b(o.diff);
666
- if (i) return i;
668
+ for (const o of at(t)) {
669
+ const s = g(o.diff);
670
+ if (s) return s;
667
671
  }
668
- const s = lt(t).map((o) => o.diff).filter((o) => !!o);
669
- if (s.length > 0) return s.join(`
672
+ const i = dt(t).map((o) => o.diff).filter((o) => !!o);
673
+ if (i.length > 0) return i.join(`
670
674
  `);
671
- const r = b(e?.patchText);
672
- return r && Mn(r) ? r : null;
673
- }, En = (t) => {
675
+ const r = g(e?.patchText);
676
+ return r && Wn(r) ? r : null;
677
+ }, Nn = (t) => {
674
678
  const e = /* @__PURE__ */ new Set(), n = [];
675
- for (const s of t)
676
- e.has(s.filePath) || (e.add(s.filePath), n.push({
679
+ for (const i of t)
680
+ e.has(i.filePath) || (e.add(i.filePath), n.push({
677
681
  kind: "diff",
678
- fileName: ve(s.filePath),
679
- filePath: s.filePath,
680
- additions: s.additions,
681
- deletions: s.deletions
682
+ fileName: Oe(i.filePath),
683
+ filePath: i.filePath,
684
+ additions: i.additions,
685
+ deletions: i.deletions
682
686
  }));
683
687
  return n;
684
- }, Wn = (t) => Array.from(new Set(t.map((e) => e.filePath))), xe = (t) => {
685
- const e = be(t);
686
- return b(t.state?.output) ?? b(e?.returnDisplay) ?? b(e?.preview) ?? b(e?.stdout);
687
- }, Nn = (t) => {
688
+ }, jn = (t) => Array.from(new Set(t.map((e) => e.filePath))), ke = (t) => {
689
+ const e = Se(t);
690
+ return g(t.state?.output) ?? g(e?.returnDisplay) ?? g(e?.preview) ?? g(e?.stdout);
691
+ }, Un = (t) => {
688
692
  const e = t.match(/<skill_content(?:\s+name="([^"]+)")?>([\s\S]*?)<\/skill_content>/);
689
693
  return e ? {
690
- skillName: b(e[1]) ?? void 0,
691
- content: b(e[2]) ?? ""
694
+ skillName: g(e[1]) ?? void 0,
695
+ content: g(e[2]) ?? ""
692
696
  } : null;
693
- }, Hn = (t) => {
694
- const e = ne(t);
695
- return b(e?.name) ?? b(e?.skillName) ?? b(e?.skill) ?? b(e?.skill_name) ?? void 0;
696
- }, jn = (t) => ({
697
+ }, Vn = (t) => {
698
+ const e = se(t);
699
+ return g(e?.name) ?? g(e?.skillName) ?? g(e?.skill) ?? g(e?.skill_name) ?? void 0;
700
+ }, qn = (t) => ({
697
701
  kind: "link",
698
- text: ve(t),
702
+ text: Oe(t),
699
703
  filePath: t
700
- }), re = (t, e) => !st(t.state?.status) || !t.state?.errorText ? e : [{
704
+ }), le = (t, e) => !ct(t.state?.status) || !t.state?.errorText ? e : [{
701
705
  type: "comment",
702
706
  text: t.state.errorText
703
- }, ...e], Un = (t) => {
704
- const e = Ln(t), n = lt(t), s = te(t, void 0, "Apply patch"), r = Tn(e ?? void 0);
705
- r.length > 0 ? s.push(...r) : s.push(...En(n));
706
- const o = [], i = In(e ?? void 0);
707
- for (const c of i)
707
+ }, ...e], Kn = (t) => {
708
+ const e = Hn(t), n = dt(t), i = ie(t, void 0, "Apply patch"), r = Pn(e ?? void 0);
709
+ r.length > 0 ? i.push(...r) : i.push(...Nn(n));
710
+ const o = [], s = vn(e ?? void 0);
711
+ for (const c of s)
708
712
  o.push({
709
713
  type: "diff",
710
714
  language: "diff",
@@ -722,33 +726,33 @@ const Bn = {
722
726
  sideBySide: !1
723
727
  });
724
728
  if (o.length === 0) {
725
- const c = wn(e ?? void 0);
726
- c.length === 0 && c.push(...Wn(n)), c.length > 0 && o.push({
729
+ const c = _n(e ?? void 0);
730
+ c.length === 0 && c.push(...jn(n)), c.length > 0 && o.push({
727
731
  type: "references",
728
732
  references: c
729
733
  });
730
734
  }
731
735
  return {
732
- indicator: ee(t),
733
- title: s,
734
- blocks: re(t, o)
736
+ indicator: oe(t),
737
+ title: i,
738
+ blocks: le(t, o)
735
739
  };
736
- }, qn = (t) => {
737
- const e = ne(t), n = be(t), s = b(e?.filePath) ?? b(e?.file) ?? b(n?.filePath) ?? b(n?.file) ?? b(n?.path) ?? void 0, r = te(t, void 0, "Read file");
738
- return s && r.push(jn(s)), {
739
- indicator: ee(t),
740
+ }, Gn = (t) => {
741
+ const e = se(t), n = Se(t), i = g(e?.filePath) ?? g(e?.file) ?? g(n?.filePath) ?? g(n?.file) ?? g(n?.path) ?? void 0, r = ie(t, void 0, "Read file");
742
+ return i && r.push(qn(i)), {
743
+ indicator: oe(t),
740
744
  title: r,
741
- blocks: re(t, [])
745
+ blocks: le(t, [])
742
746
  };
743
- }, Vn = (t) => {
744
- const e = ne(t), n = be(t), s = b(e?.command) ?? void 0, r = te(t, s, "Run command"), o = [], i = xe(t);
745
- i && o.push({
747
+ }, Yn = (t) => {
748
+ const e = se(t), n = Se(t), i = g(e?.command) ?? void 0, r = ie(t, i, "Run command"), o = [], s = ke(t);
749
+ s && o.push({
746
750
  type: "code",
747
751
  language: "text",
748
- code: i
752
+ code: s
749
753
  });
750
- const c = b(n?.stderr);
751
- return c && c !== i && o.push({
754
+ const c = g(n?.stderr);
755
+ return c && c !== s && o.push({
752
756
  type: "code",
753
757
  language: "text",
754
758
  code: c
@@ -756,69 +760,69 @@ const Bn = {
756
760
  type: "text",
757
761
  text: `Exit code: ${n.exitCode}`
758
762
  }), {
759
- indicator: ee(t),
763
+ indicator: oe(t),
760
764
  title: r,
761
- blocks: re(t, o)
765
+ blocks: le(t, o)
762
766
  };
763
- }, Kn = (t) => {
764
- const e = ne(t), n = xe(t), s = b(e?.pattern) ?? void 0, r = te(t, s, "Search files"), o = n ? [{
767
+ }, Jn = (t) => {
768
+ const e = se(t), n = ke(t), i = g(e?.pattern) ?? void 0, r = ie(t, i, "Search files"), o = n ? [{
765
769
  type: "code",
766
770
  language: "text",
767
771
  code: n
768
772
  }] : [];
769
773
  return {
770
- indicator: ee(t),
774
+ indicator: oe(t),
771
775
  title: r,
772
- blocks: re(t, o)
776
+ blocks: le(t, o)
773
777
  };
774
- }, Gn = (t) => {
775
- const e = ne(t), n = xe(t), s = b(e?.pattern) ?? void 0, r = te(t, s, "Find files"), o = [];
778
+ }, Xn = (t) => {
779
+ const e = se(t), n = ke(t), i = g(e?.pattern) ?? void 0, r = ie(t, i, "Find files"), o = [];
776
780
  if (n) {
777
- const i = n.split(/\r?\n/).map((c) => c.trim()).filter((c) => c.length > 0);
778
- i.length > 0 && o.push({
781
+ const s = n.split(/\r?\n/).map((c) => c.trim()).filter((c) => c.length > 0);
782
+ s.length > 0 && o.push({
779
783
  type: "references",
780
- references: i
784
+ references: s
781
785
  });
782
786
  }
783
787
  return {
784
- indicator: ee(t),
788
+ indicator: oe(t),
785
789
  title: r,
786
- blocks: re(t, o)
790
+ blocks: le(t, o)
787
791
  };
788
- }, Yn = (t) => {
789
- const e = xe(t), n = e ? Nn(e) : null, s = Hn(t) ?? n?.skillName, r = te(t, s, "Load skill"), o = n?.content ?? e, i = o ? [{
792
+ }, Qn = (t) => {
793
+ const e = ke(t), n = e ? Un(e) : null, i = Vn(t) ?? n?.skillName, r = ie(t, i, "Load skill"), o = n?.content ?? e, s = o ? [{
790
794
  type: "code",
791
795
  language: "markdown",
792
796
  code: o
793
797
  }] : [];
794
798
  return {
795
- indicator: ee(t),
799
+ indicator: oe(t),
796
800
  title: r,
797
- blocks: re(t, i)
801
+ blocks: le(t, s)
798
802
  };
799
- }, We = () => ({
800
- apply_patch: Un,
801
- read: qn,
802
- bash: Vn,
803
- grep: Kn,
804
- glob: Gn,
805
- skill: Yn
806
- }), Ne = {
803
+ }, Ve = () => ({
804
+ apply_patch: Kn,
805
+ read: Gn,
806
+ bash: Yn,
807
+ grep: Jn,
808
+ glob: Xn,
809
+ skill: Qn
810
+ }), qe = {
807
811
  pending: "queued",
808
812
  error: "failed",
809
813
  "output-error": "failed",
810
814
  "input-streaming": "running",
811
815
  "input-available": "queued"
812
- }, ct = (t) => t.replace(/^tool-/, ""), Jn = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Xn = (t) => {
813
- const e = ct(t ?? "tool").replace(/_/g, " ");
814
- return Jn(e);
815
- }, at = (t) => t === "error" || t === "output-error", Qn = (t) => at(t.state?.status) ? {
816
+ }, ut = (t) => t.replace(/^tool-/, ""), Zn = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), er = (t) => {
817
+ const e = ut(t ?? "tool").replace(/_/g, " ");
818
+ return Zn(e);
819
+ }, ft = (t) => t === "error" || t === "output-error", tr = (t) => ft(t.state?.status) ? {
816
820
  type: "icon",
817
821
  icon: "danger"
818
822
  } : {
819
823
  type: "icon",
820
- icon: tt(t.tool ?? "tool")
821
- }, Zn = (t) => !t || typeof t != "string" ? null : Ne[t] ? Ne[t] : t.includes("stream") ? "running" : null, He = (t) => {
824
+ icon: ot(t.tool ?? "tool")
825
+ }, nr = (t) => !t || typeof t != "string" ? null : qe[t] ? qe[t] : t.includes("stream") ? "running" : null, Ke = (t) => {
822
826
  if (typeof t == "string") return t;
823
827
  if (t == null) return null;
824
828
  try {
@@ -826,94 +830,94 @@ const Bn = {
826
830
  } catch {
827
831
  return null;
828
832
  }
829
- }, er = (t) => {
833
+ }, rr = (t) => {
830
834
  const e = [];
831
- at(t.state?.status) && t.state?.errorText && e.push({
835
+ ft(t.state?.status) && t.state?.errorText && e.push({
832
836
  type: "comment",
833
837
  text: t.state.errorText
834
838
  });
835
- const n = He(t.state?.input);
839
+ const n = Ke(t.state?.input);
836
840
  n && e.push({
837
841
  type: "code",
838
842
  language: "json",
839
843
  code: n
840
844
  });
841
- const s = He(t.state?.output);
842
- return s && e.push({
845
+ const i = Ke(t.state?.output);
846
+ return i && e.push({
843
847
  type: "code",
844
848
  language: "json",
845
- code: s
849
+ code: i
846
850
  }), e;
847
- }, tr = (t) => {
851
+ }, or = (t) => {
848
852
  const e = [{
849
853
  kind: "text",
850
- text: Xn(t.tool),
854
+ text: er(t.tool),
851
855
  bold: !0
852
- }], n = Zn(t.state?.status);
856
+ }], n = nr(t.state?.status);
853
857
  return n && e.push({
854
858
  kind: "text",
855
859
  text: n,
856
860
  muted: !0
857
861
  }), {
858
- indicator: Qn(t),
862
+ indicator: tr(t),
859
863
  title: e,
860
- blocks: er(t)
864
+ blocks: rr(t)
861
865
  };
862
- }, nr = (t) => t ? {
863
- ...We(),
866
+ }, ir = (t) => t ? {
867
+ ...Ve(),
864
868
  ...t
865
- } : We(), rr = (t, e) => {
869
+ } : Ve(), sr = (t, e) => {
866
870
  const n = t.tool ?? "tool";
867
- return e[n] ?? e[ct(n)];
868
- }, or = (t, e, n) => {
869
- const s = rr(t, e);
870
- if (s) {
871
- const r = s(t, n);
871
+ return e[n] ?? e[ut(n)];
872
+ }, lr = (t, e, n) => {
873
+ const i = sr(t, e);
874
+ if (i) {
875
+ const r = i(t, n);
872
876
  if (r) return r;
873
877
  }
874
- return tr(t);
875
- }, sr = (t, e) => {
876
- const n = nr(e?.toolRenderers);
878
+ return or(t);
879
+ }, cr = (t, e) => {
880
+ const n = ir(e?.toolRenderers);
877
881
  return {
878
- items: t.map((r) => or(r, n, e))
882
+ items: t.map((r) => lr(r, n, e))
879
883
  };
880
- }, E = xt, dt = (t, e, n, s = !1) => {
881
- s && t.stopPropagation(), e.href || t.preventDefault(), e.filePath && n?.(e.filePath);
884
+ }, N = kt, pt = (t, e, n, i = !1) => {
885
+ i && t.stopPropagation(), e.href || t.preventDefault(), e.filePath && n?.(e.filePath);
882
886
  };
883
- function ir(t) {
887
+ function ar(t) {
884
888
  const e = y(6), {
885
889
  seg: n
886
890
  } = t;
887
- let s;
888
- e[0] !== n.alt || e[1] !== n.src ? (s = /* @__PURE__ */ l(Z.Image, { src: n.src, alt: n.alt }), e[0] = n.alt, e[1] = n.src, e[2] = s) : s = e[2];
891
+ let i;
892
+ e[0] !== n.alt || e[1] !== n.src ? (i = /* @__PURE__ */ l(re.Image, { src: n.src, alt: n.alt }), e[0] = n.alt, e[1] = n.src, e[2] = i) : i = e[2];
889
893
  let r;
890
- e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ l(Z.Fallback, {}), e[3] = r) : r = e[3];
894
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ l(re.Fallback, {}), e[3] = r) : r = e[3];
891
895
  let o;
892
- return e[4] !== s ? (o = /* @__PURE__ */ x(Z.Root, { width: "1.5rem", height: "1.5rem", children: [
893
- s,
896
+ return e[4] !== i ? (o = /* @__PURE__ */ x(re.Root, { width: "1.5rem", height: "1.5rem", children: [
897
+ i,
894
898
  r
895
- ] }), e[4] = s, e[5] = o) : o = e[5], o;
899
+ ] }), e[4] = i, e[5] = o) : o = e[5], o;
896
900
  }
897
- function lr(t) {
901
+ function dr(t) {
898
902
  const e = y(9), {
899
903
  seg: n,
900
- onOpenFile: s
904
+ onOpenFile: i
901
905
  } = t, r = n.additions ?? 0, o = n.deletions ?? 0;
902
- let i;
903
- e[0] !== s || e[1] !== n.fileName || e[2] !== n.filePath ? (i = () => {
906
+ let s;
907
+ e[0] !== i || e[1] !== n.fileName || e[2] !== n.filePath ? (s = () => {
904
908
  const d = n.filePath ?? n.fileName;
905
- s?.(d);
906
- }, e[0] = s, e[1] = n.fileName, e[2] = n.filePath, e[3] = i) : i = e[3];
909
+ i?.(d);
910
+ }, e[0] = i, e[1] = n.fileName, e[2] = n.filePath, e[3] = s) : s = e[3];
907
911
  let c;
908
- return e[4] !== n.fileName || e[5] !== r || e[6] !== o || e[7] !== i ? (c = /* @__PURE__ */ l(Ut, { fileName: n.fileName, additions: r, deletions: o, onClickFileLink: i }), e[4] = n.fileName, e[5] = r, e[6] = o, e[7] = i, e[8] = c) : c = e[8], c;
912
+ return e[4] !== n.fileName || e[5] !== r || e[6] !== o || e[7] !== s ? (c = /* @__PURE__ */ l(Kt, { fileName: n.fileName, additions: r, deletions: o, onClickFileLink: s }), e[4] = n.fileName, e[5] = r, e[6] = o, e[7] = s, e[8] = c) : c = e[8], c;
909
913
  }
910
- function cr(t) {
914
+ function ur(t) {
911
915
  const e = y(13), {
912
916
  seg: n,
913
- onOpenFile: s
914
- } = t, r = n.bold ? "medium" : void 0, o = !!(n.href || n.filePath), i = n.href ?? "#", c = (n.muted, "fg.muted"), d = o ? "pointer" : "default";
917
+ onOpenFile: i
918
+ } = t, r = n.bold ? "medium" : void 0, o = !!(n.href || n.filePath), s = n.href ?? "#", c = (n.muted, "fg.muted"), d = o ? "pointer" : "default";
915
919
  let a;
916
- e[0] !== s || e[1] !== n ? (a = (m) => dt(m, n, s, !0), e[0] = s, e[1] = n, e[2] = a) : a = e[2];
920
+ e[0] !== i || e[1] !== n ? (a = (m) => pt(m, n, i, !0), e[0] = i, e[1] = n, e[2] = a) : a = e[2];
917
921
  const u = n.muted ? "fg.muted" : "fg.blue-dark";
918
922
  let f;
919
923
  e[3] !== u ? (f = {
@@ -921,15 +925,15 @@ function cr(t) {
921
925
  color: u
922
926
  }, e[3] = u, e[4] = f) : f = e[4];
923
927
  let p;
924
- return e[5] !== r || e[6] !== n.text || e[7] !== i || e[8] !== c || e[9] !== d || e[10] !== a || e[11] !== f ? (p = /* @__PURE__ */ l(Ve, { href: i, fontWeight: r, color: c, textDecoration: "none", cursor: d, onClick: a, _hover: f, children: n.text }), e[5] = r, e[6] = n.text, e[7] = i, e[8] = c, e[9] = d, e[10] = a, e[11] = f, e[12] = p) : p = e[12], p;
928
+ return e[5] !== r || e[6] !== n.text || e[7] !== s || e[8] !== c || e[9] !== d || e[10] !== a || e[11] !== f ? (p = /* @__PURE__ */ l(Xe, { href: s, fontWeight: r, color: c, textDecoration: "none", cursor: d, onClick: a, _hover: f, children: n.text }), e[5] = r, e[6] = n.text, e[7] = s, e[8] = c, e[9] = d, e[10] = a, e[11] = f, e[12] = p) : p = e[12], p;
925
929
  }
926
- function ar(t) {
930
+ function fr(t) {
927
931
  const e = y(12), {
928
932
  seg: n,
929
- onOpenFile: s
930
- } = t, r = n.bold ? "medium" : void 0, o = n.href ?? "#", i = n.muted ? "fg.muted" : "accent.primary";
933
+ onOpenFile: i
934
+ } = t, r = n.bold ? "medium" : void 0, o = n.href ?? "#", s = n.muted ? "fg.muted" : "accent.primary";
931
935
  let c;
932
- e[0] !== s || e[1] !== n ? (c = (f) => dt(f, n, s), e[0] = s, e[1] = n, e[2] = c) : c = e[2];
936
+ e[0] !== i || e[1] !== n ? (c = (f) => pt(f, n, i), e[0] = i, e[1] = n, e[2] = c) : c = e[2];
933
937
  const d = n.muted ? "fg.muted" : "accent.primary";
934
938
  let a;
935
939
  e[3] !== d ? (a = {
@@ -937,215 +941,215 @@ function ar(t) {
937
941
  textDecoration: "underline"
938
942
  }, e[3] = d, e[4] = a) : a = e[4];
939
943
  let u;
940
- return e[5] !== r || e[6] !== n.text || e[7] !== o || e[8] !== i || e[9] !== c || e[10] !== a ? (u = /* @__PURE__ */ l(Ve, { href: o, fontWeight: r, color: i, textDecoration: "underline", onClick: c, _hover: a, children: n.text }), e[5] = r, e[6] = n.text, e[7] = o, e[8] = i, e[9] = c, e[10] = a, e[11] = u) : u = e[11], u;
944
+ return e[5] !== r || e[6] !== n.text || e[7] !== o || e[8] !== s || e[9] !== c || e[10] !== a ? (u = /* @__PURE__ */ l(Xe, { href: o, fontWeight: r, color: s, textDecoration: "underline", onClick: c, _hover: a, children: n.text }), e[5] = r, e[6] = n.text, e[7] = o, e[8] = s, e[9] = c, e[10] = a, e[11] = u) : u = e[11], u;
941
945
  }
942
- function dr(t) {
946
+ function pr(t) {
943
947
  const e = y(6), {
944
948
  seg: n,
945
- isClickable: s
946
- } = t, r = n.bold ? "medium" : void 0, o = s && !n.muted ? "fg" : "fg.muted";
947
- let i;
948
- e[0] !== o ? (i = {
949
+ isClickable: i
950
+ } = t, r = n.bold ? "medium" : void 0, o = i && !n.muted ? "fg" : "fg.muted";
951
+ let s;
952
+ e[0] !== o ? (s = {
949
953
  color: o
950
- }, e[0] = o, e[1] = i) : i = e[1];
954
+ }, e[0] = o, e[1] = s) : s = e[1];
951
955
  let c;
952
- return e[2] !== n.text || e[3] !== r || e[4] !== i ? (c = /* @__PURE__ */ l(se, { fontWeight: r, color: "fg.muted", _groupHover: i, children: n.text }), e[2] = n.text, e[3] = r, e[4] = i, e[5] = c) : c = e[5], c;
956
+ return e[2] !== n.text || e[3] !== r || e[4] !== s ? (c = /* @__PURE__ */ l(ae, { fontWeight: r, color: "fg.muted", _groupHover: s, children: n.text }), e[2] = n.text, e[3] = r, e[4] = s, e[5] = c) : c = e[5], c;
953
957
  }
954
- function ur(t) {
958
+ function mr(t) {
955
959
  const e = y(11), {
956
960
  seg: n,
957
- isClickable: s,
961
+ isClickable: i,
958
962
  onOpenFile: r
959
963
  } = t;
960
964
  switch (n.kind) {
961
965
  case "avatar": {
962
966
  let o;
963
- return e[0] !== n ? (o = /* @__PURE__ */ l(ir, { seg: n }), e[0] = n, e[1] = o) : o = e[1], o;
967
+ return e[0] !== n ? (o = /* @__PURE__ */ l(ar, { seg: n }), e[0] = n, e[1] = o) : o = e[1], o;
964
968
  }
965
969
  case "diff": {
966
970
  let o;
967
- return e[2] !== r || e[3] !== n ? (o = /* @__PURE__ */ l(lr, { seg: n, onOpenFile: r }), e[2] = r, e[3] = n, e[4] = o) : o = e[4], o;
971
+ return e[2] !== r || e[3] !== n ? (o = /* @__PURE__ */ l(dr, { seg: n, onOpenFile: r }), e[2] = r, e[3] = n, e[4] = o) : o = e[4], o;
968
972
  }
969
973
  case "link": {
970
974
  let o;
971
- return e[5] !== r || e[6] !== n ? (o = n.variant === "bubble" ? /* @__PURE__ */ l(cr, { seg: n, onOpenFile: r }) : /* @__PURE__ */ l(ar, { seg: n, onOpenFile: r }), e[5] = r, e[6] = n, e[7] = o) : o = e[7], o;
975
+ return e[5] !== r || e[6] !== n ? (o = n.variant === "bubble" ? /* @__PURE__ */ l(ur, { seg: n, onOpenFile: r }) : /* @__PURE__ */ l(fr, { seg: n, onOpenFile: r }), e[5] = r, e[6] = n, e[7] = o) : o = e[7], o;
972
976
  }
973
977
  case "text": {
974
978
  let o;
975
- return e[8] !== s || e[9] !== n ? (o = /* @__PURE__ */ l(dr, { seg: n, isClickable: s }), e[8] = s, e[9] = n, e[10] = o) : o = e[10], o;
979
+ return e[8] !== i || e[9] !== n ? (o = /* @__PURE__ */ l(pr, { seg: n, isClickable: i }), e[8] = i, e[9] = n, e[10] = o) : o = e[10], o;
976
980
  }
977
981
  default:
978
982
  return null;
979
983
  }
980
984
  }
981
- function fr(t) {
985
+ function hr(t) {
982
986
  const e = y(10), {
983
987
  ind: n
984
988
  } = t;
985
989
  if (!n || n.type === "none")
986
990
  return null;
987
991
  if (n.type === "icon") {
988
- let i;
989
- e[0] !== n.icon ? (i = hn(n.icon), e[0] = n.icon, e[1] = i) : i = e[1];
990
- const c = i;
992
+ let s;
993
+ e[0] !== n.icon ? (s = xn(n.icon), e[0] = n.icon, e[1] = s) : s = e[1];
994
+ const c = s;
991
995
  let d;
992
- return e[2] !== c ? (d = /* @__PURE__ */ l(E.Indicator, { outline: "none", shadow: "none", border: "none", background: "bg", color: "fg", children: /* @__PURE__ */ l(se, { display: "inline-flex", alignItems: "center", children: /* @__PURE__ */ l(c, { size: 14, strokeWidth: 1 }) }) }), e[2] = c, e[3] = d) : d = e[3], d;
996
+ return e[2] !== c ? (d = /* @__PURE__ */ l(N.Indicator, { outline: "none", shadow: "none", border: "none", background: "bg", color: "fg", children: /* @__PURE__ */ l(ae, { display: "inline-flex", alignItems: "center", children: /* @__PURE__ */ l(c, { size: 14, strokeWidth: 1 }) }) }), e[2] = c, e[3] = d) : d = e[3], d;
993
997
  }
994
- let s;
995
- e[4] !== n.alt || e[5] !== n.src ? (s = /* @__PURE__ */ l(Z.Image, { src: n.src, alt: n.alt }), e[4] = n.alt, e[5] = n.src, e[6] = s) : s = e[6];
998
+ let i;
999
+ e[4] !== n.alt || e[5] !== n.src ? (i = /* @__PURE__ */ l(re.Image, { src: n.src, alt: n.alt }), e[4] = n.alt, e[5] = n.src, e[6] = i) : i = e[6];
996
1000
  let r;
997
- e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ l(Z.Fallback, {}), e[7] = r) : r = e[7];
1001
+ e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ l(re.Fallback, {}), e[7] = r) : r = e[7];
998
1002
  let o;
999
- return e[8] !== s ? (o = /* @__PURE__ */ l(E.Indicator, { children: /* @__PURE__ */ x(Z.Root, { boxSize: "full", children: [
1000
- s,
1003
+ return e[8] !== i ? (o = /* @__PURE__ */ l(N.Indicator, { children: /* @__PURE__ */ x(re.Root, { boxSize: "full", children: [
1004
+ i,
1001
1005
  r
1002
- ] }) }), e[8] = s, e[9] = o) : o = e[9], o;
1006
+ ] }) }), e[8] = i, e[9] = o) : o = e[9], o;
1003
1007
  }
1004
- function pr(t) {
1008
+ function gr(t) {
1005
1009
  const e = y(5), {
1006
1010
  code: n,
1007
- language: s
1008
- } = t, r = s ? `${s} code block` : "code block";
1011
+ language: i
1012
+ } = t, r = i ? `${i} code block` : "code block";
1009
1013
  let o;
1010
- e[0] !== n ? (o = /* @__PURE__ */ l(T, { as: "code", children: n }), e[0] = n, e[1] = o) : o = e[1];
1011
- let i;
1012
- return e[2] !== r || e[3] !== o ? (i = /* @__PURE__ */ l(T, { as: "pre", background: "bg.muted", color: "fg", borderRadius: "md", padding: "sm", fontFamily: "mono", fontSize: "xs", lineHeight: "shorter", overflowX: "auto", whiteSpace: "pre", "aria-label": r, children: o }), e[2] = r, e[3] = o, e[4] = i) : i = e[4], i;
1014
+ e[0] !== n ? (o = /* @__PURE__ */ l(k, { as: "code", children: n }), e[0] = n, e[1] = o) : o = e[1];
1015
+ let s;
1016
+ return e[2] !== r || e[3] !== o ? (s = /* @__PURE__ */ l(k, { as: "pre", background: "bg.muted", color: "fg", borderRadius: "md", padding: "sm", fontFamily: "mono", fontSize: "xs", lineHeight: "shorter", overflowX: "auto", whiteSpace: "pre", "aria-label": r, children: o }), e[2] = r, e[3] = o, e[4] = s) : s = e[4], s;
1013
1017
  }
1014
- function mr(t) {
1018
+ function br(t) {
1015
1019
  const e = y(26), {
1016
1020
  b: n,
1017
- onOpenFile: s
1021
+ onOpenFile: i
1018
1022
  } = t;
1019
1023
  switch (n.type) {
1020
1024
  case "comment": {
1021
1025
  let r;
1022
- e[0] !== n.text ? (r = /* @__PURE__ */ l(M.Body, { children: n.text }), e[0] = n.text, e[1] = r) : r = e[1];
1026
+ e[0] !== n.text ? (r = /* @__PURE__ */ l(E.Body, { children: n.text }), e[0] = n.text, e[1] = r) : r = e[1];
1023
1027
  let o;
1024
- e[2] !== n.reactions ? (o = n.reactions?.clap ? /* @__PURE__ */ l(M.Footer, { children: /* @__PURE__ */ x(Ae, { children: [
1028
+ e[2] !== n.reactions ? (o = n.reactions?.clap ? /* @__PURE__ */ l(E.Footer, { children: /* @__PURE__ */ x(Fe, { children: [
1025
1029
  "👏 ",
1026
1030
  n.reactions.clap
1027
1031
  ] }) }) : null, e[2] = n.reactions, e[3] = o) : o = e[3];
1028
- let i;
1029
- return e[4] !== r || e[5] !== o ? (i = /* @__PURE__ */ x(M.Root, { children: [
1032
+ let s;
1033
+ return e[4] !== r || e[5] !== o ? (s = /* @__PURE__ */ x(E.Root, { children: [
1030
1034
  r,
1031
1035
  o
1032
- ] }), e[4] = r, e[5] = o, e[6] = i) : i = e[6], i;
1036
+ ] }), e[4] = r, e[5] = o, e[6] = s) : s = e[6], s;
1033
1037
  }
1034
1038
  case "code": {
1035
1039
  let r;
1036
- return e[7] !== n.code || e[8] !== n.language ? (r = /* @__PURE__ */ l(M.Root, { border: "0", padding: "0", children: /* @__PURE__ */ l(M.Body, { padding: "0", children: /* @__PURE__ */ l(pr, { language: n.language, code: n.code }) }) }), e[7] = n.code, e[8] = n.language, e[9] = r) : r = e[9], r;
1040
+ return e[7] !== n.code || e[8] !== n.language ? (r = /* @__PURE__ */ l(E.Root, { border: "0", padding: "0", children: /* @__PURE__ */ l(E.Body, { padding: "0", children: /* @__PURE__ */ l(gr, { language: n.language, code: n.code }) }) }), e[7] = n.code, e[8] = n.language, e[9] = r) : r = e[9], r;
1037
1041
  }
1038
1042
  case "diff": {
1039
1043
  const r = n.sideBySide ?? !1;
1040
1044
  let o;
1041
- return e[10] !== n.language || e[11] !== n.modified || e[12] !== n.original || e[13] !== r ? (o = /* @__PURE__ */ l(M.Root, { border: "0", padding: "0", children: /* @__PURE__ */ l(M.Body, { padding: "0", children: /* @__PURE__ */ l(T, { height: "240px", minW: "320px", overflow: "hidden", children: /* @__PURE__ */ l(jt, { original: n.original, modified: n.modified, language: n.language, sideBySide: r, disableScroll: !0 }) }) }) }), e[10] = n.language, e[11] = n.modified, e[12] = n.original, e[13] = r, e[14] = o) : o = e[14], o;
1045
+ return e[10] !== n.language || e[11] !== n.modified || e[12] !== n.original || e[13] !== r ? (o = /* @__PURE__ */ l(E.Root, { border: "0", padding: "0", children: /* @__PURE__ */ l(E.Body, { padding: "0", children: /* @__PURE__ */ l(k, { height: "240px", minW: "320px", overflow: "hidden", children: /* @__PURE__ */ l(qt, { original: n.original, modified: n.modified, language: n.language, sideBySide: r, disableScroll: !0 }) }) }) }), e[10] = n.language, e[11] = n.modified, e[12] = n.original, e[13] = r, e[14] = o) : o = e[14], o;
1042
1046
  }
1043
1047
  case "text": {
1044
1048
  let r;
1045
- return e[15] !== n.text ? (r = /* @__PURE__ */ l(M.Root, { background: "transparent", children: /* @__PURE__ */ l(M.Body, { padding: "sm", children: /* @__PURE__ */ l(Q, { textStyle: "label/S/regular", children: n.text }) }) }), e[15] = n.text, e[16] = r) : r = e[16], r;
1049
+ return e[15] !== n.text ? (r = /* @__PURE__ */ l(E.Root, { background: "transparent", children: /* @__PURE__ */ l(E.Body, { padding: "sm", children: /* @__PURE__ */ l(ne, { textStyle: "label/S/regular", children: n.text }) }) }), e[15] = n.text, e[16] = r) : r = e[16], r;
1046
1050
  }
1047
1051
  case "references": {
1048
1052
  let r;
1049
- e[17] !== n.references ? (r = n.references.map(hr), e[17] = n.references, e[18] = r) : r = e[18];
1053
+ e[17] !== n.references ? (r = n.references.map(xr), e[17] = n.references, e[18] = r) : r = e[18];
1050
1054
  let o;
1051
- return e[19] !== r ? (o = /* @__PURE__ */ l(Ke, { mt: "xs", gap: "xs", flexDir: "row", flexWrap: "wrap", children: r }), e[19] = r, e[20] = o) : o = e[20], o;
1055
+ return e[19] !== r ? (o = /* @__PURE__ */ l(Qe, { mt: "xs", gap: "xs", flexDir: "row", flexWrap: "wrap", children: r }), e[19] = r, e[20] = o) : o = e[20], o;
1052
1056
  }
1053
1057
  case "component": {
1054
1058
  let r;
1055
- e[21] !== n || e[22] !== s ? (r = n.render({
1056
- onOpenFile: s
1057
- }), e[21] = n, e[22] = s, e[23] = r) : r = e[23];
1059
+ e[21] !== n || e[22] !== i ? (r = n.render({
1060
+ onOpenFile: i
1061
+ }), e[21] = n, e[22] = i, e[23] = r) : r = e[23];
1058
1062
  let o;
1059
- return e[24] !== r ? (o = /* @__PURE__ */ l(De, { children: r }), e[24] = r, e[25] = o) : o = e[25], o;
1063
+ return e[24] !== r ? (o = /* @__PURE__ */ l(Me, { children: r }), e[24] = r, e[25] = o) : o = e[25], o;
1060
1064
  }
1061
1065
  }
1062
1066
  }
1063
- function hr(t) {
1064
- return /* @__PURE__ */ l(Ht, { fileName: t }, t);
1067
+ function xr(t) {
1068
+ return /* @__PURE__ */ l(Vt, { fileName: t }, t);
1065
1069
  }
1066
- function gr(t) {
1070
+ function yr(t) {
1067
1071
  const e = y(22), {
1068
1072
  item: n,
1069
- itemKey: s,
1073
+ itemKey: i,
1070
1074
  isOpen: r,
1071
1075
  canExpand: o,
1072
- hasBlocks: i,
1076
+ hasBlocks: s,
1073
1077
  onToggle: c,
1074
1078
  onOpenFile: d
1075
1079
  } = t;
1076
1080
  let a;
1077
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = /* @__PURE__ */ l(E.Separator, {}), e[0] = a) : a = e[0];
1081
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = /* @__PURE__ */ l(N.Separator, {}), e[0] = a) : a = e[0];
1078
1082
  let u;
1079
- e[1] !== n.indicator ? (u = /* @__PURE__ */ x(E.Connector, { children: [
1083
+ e[1] !== n.indicator ? (u = /* @__PURE__ */ x(N.Connector, { children: [
1080
1084
  a,
1081
- /* @__PURE__ */ l(fr, { ind: n.indicator })
1085
+ /* @__PURE__ */ l(hr, { ind: n.indicator })
1082
1086
  ] }), e[1] = n.indicator, e[2] = u) : u = e[2];
1083
1087
  let f;
1084
- e[3] !== o || e[4] !== r || e[5] !== n.title || e[6] !== s || e[7] !== d || e[8] !== c ? (f = n.title.length > 0 && /* @__PURE__ */ l(E.Title, { className: "group", fontWeight: "normal", display: "flex", alignItems: "center", justifyContent: "space-between", cursor: o ? "pointer" : "default", onClick: o ? () => c(s) : void 0, children: /* @__PURE__ */ x(se, { display: "inline-flex", alignItems: "center", gap: "sm", flexWrap: "wrap", children: [
1085
- /* @__PURE__ */ l(se, { display: "inline-flex", alignItems: "center", gap: "xs", flexWrap: "wrap", children: n.title.map((g, S) => /* @__PURE__ */ l(ur, { seg: g, isClickable: o, onOpenFile: d }, S)) }),
1086
- o ? /* @__PURE__ */ l(se, { display: "inline-flex", alignItems: "center", transition: "transform 200ms ease, color 200ms ease", transform: r ? "rotate(0deg)" : "rotate(-180deg)", color: "transparent", _groupHover: {
1088
+ e[3] !== o || e[4] !== r || e[5] !== n.title || e[6] !== i || e[7] !== d || e[8] !== c ? (f = n.title.length > 0 && /* @__PURE__ */ l(N.Title, { className: "group", fontWeight: "normal", display: "flex", alignItems: "center", justifyContent: "space-between", cursor: o ? "pointer" : "default", onClick: o ? () => c(i) : void 0, children: /* @__PURE__ */ x(ae, { display: "inline-flex", alignItems: "center", gap: "sm", flexWrap: "wrap", children: [
1089
+ /* @__PURE__ */ l(ae, { display: "inline-flex", alignItems: "center", gap: "xs", flexWrap: "wrap", children: n.title.map((b, S) => /* @__PURE__ */ l(mr, { seg: b, isClickable: o, onOpenFile: d }, S)) }),
1090
+ o ? /* @__PURE__ */ l(ae, { display: "inline-flex", alignItems: "center", transition: "transform 200ms ease, color 200ms ease", transform: r ? "rotate(0deg)" : "rotate(-180deg)", color: "transparent", _groupHover: {
1087
1091
  color: "fg"
1088
- }, children: /* @__PURE__ */ l(Lt, { size: 12 }) }) : null
1089
- ] }) }), e[3] = o, e[4] = r, e[5] = n.title, e[6] = s, e[7] = d, e[8] = c, e[9] = f) : f = e[9];
1092
+ }, children: /* @__PURE__ */ l(Ht, { size: 12 }) }) : null
1093
+ ] }) }), e[3] = o, e[4] = r, e[5] = n.title, e[6] = i, e[7] = d, e[8] = c, e[9] = f) : f = e[9];
1090
1094
  let p;
1091
- e[10] !== i || e[11] !== r || e[12] !== n.blocks || e[13] !== d ? (p = i ? /* @__PURE__ */ l(T, { display: "grid", gridTemplateRows: r ? "1fr" : "0fr", transition: "grid-template-rows 220ms ease", children: r ? /* @__PURE__ */ l(T, { overflow: "hidden", opacity: 1, transform: "translateY(0)", transition: "opacity 200ms ease, transform 200ms ease", children: n.blocks.map((g, S) => /* @__PURE__ */ l(T, { children: /* @__PURE__ */ l(mr, { b: g, onOpenFile: d }) }, S)) }) : null }) : null, e[10] = i, e[11] = r, e[12] = n.blocks, e[13] = d, e[14] = p) : p = e[14];
1095
+ e[10] !== s || e[11] !== r || e[12] !== n.blocks || e[13] !== d ? (p = s ? /* @__PURE__ */ l(k, { display: "grid", gridTemplateRows: r ? "1fr" : "0fr", transition: "grid-template-rows 220ms ease", children: r ? /* @__PURE__ */ l(k, { overflow: "hidden", opacity: 1, transform: "translateY(0)", transition: "opacity 200ms ease, transform 200ms ease", children: n.blocks.map((b, S) => /* @__PURE__ */ l(k, { children: /* @__PURE__ */ l(br, { b, onOpenFile: d }) }, S)) }) : null }) : null, e[10] = s, e[11] = r, e[12] = n.blocks, e[13] = d, e[14] = p) : p = e[14];
1092
1096
  let m;
1093
- e[15] !== f || e[16] !== p ? (m = /* @__PURE__ */ x(E.Content, { pb: "xs", children: [
1097
+ e[15] !== f || e[16] !== p ? (m = /* @__PURE__ */ x(N.Content, { pb: "xs", children: [
1094
1098
  f,
1095
1099
  p
1096
1100
  ] }), e[15] = f, e[16] = p, e[17] = m) : m = e[17];
1097
1101
  let h;
1098
- return e[18] !== s || e[19] !== u || e[20] !== m ? (h = /* @__PURE__ */ x(E.Item, { gap: "xs", children: [
1102
+ return e[18] !== i || e[19] !== u || e[20] !== m ? (h = /* @__PURE__ */ x(N.Item, { gap: "xs", children: [
1099
1103
  u,
1100
1104
  m
1101
- ] }, s), e[18] = s, e[19] = u, e[20] = m, e[21] = h) : h = e[21], h;
1105
+ ] }, i), e[18] = i, e[19] = u, e[20] = m, e[21] = h) : h = e[21], h;
1102
1106
  }
1103
- function br(t) {
1107
+ function Sr(t) {
1104
1108
  const e = y(11), {
1105
1109
  data: n,
1106
- onOpenFile: s
1110
+ onOpenFile: i
1107
1111
  } = t;
1108
1112
  let r;
1109
1113
  e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = {}, e[0] = r) : r = e[0];
1110
- const [o, i] = oe(r), c = xr;
1114
+ const [o, s] = ce(r), c = kr;
1111
1115
  let d;
1112
1116
  e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = (p) => {
1113
- i((m) => ({
1117
+ s((m) => ({
1114
1118
  ...m,
1115
1119
  [p]: !m[p]
1116
1120
  }));
1117
1121
  }, e[1] = d) : d = e[1];
1118
1122
  const a = d;
1119
1123
  let u;
1120
- if (e[2] !== n.items || e[3] !== o || e[4] !== s) {
1124
+ if (e[2] !== n.items || e[3] !== o || e[4] !== i) {
1121
1125
  let p;
1122
- e[6] !== o || e[7] !== s ? (p = (m, h) => {
1123
- const g = c(m, h), S = (m.blocks?.length ?? 0) > 0, k = (m.expandable ?? !0) && S, P = k ? o[g] ?? !1 : S;
1124
- return /* @__PURE__ */ l(gr, { item: m, itemKey: g, isOpen: P, canExpand: k, hasBlocks: S, onToggle: a, onOpenFile: s }, g);
1125
- }, e[6] = o, e[7] = s, e[8] = p) : p = e[8], u = n.items.map(p), e[2] = n.items, e[3] = o, e[4] = s, e[5] = u;
1126
+ e[6] !== o || e[7] !== i ? (p = (m, h) => {
1127
+ const b = c(m, h), S = (m.blocks?.length ?? 0) > 0, T = (m.expandable ?? !0) && S, P = T ? o[b] ?? !1 : S;
1128
+ return /* @__PURE__ */ l(yr, { item: m, itemKey: b, isOpen: P, canExpand: T, hasBlocks: S, onToggle: a, onOpenFile: i }, b);
1129
+ }, e[6] = o, e[7] = i, e[8] = p) : p = e[8], u = n.items.map(p), e[2] = n.items, e[3] = o, e[4] = i, e[5] = u;
1126
1130
  } else
1127
1131
  u = e[5];
1128
1132
  let f;
1129
- return e[9] !== u ? (f = /* @__PURE__ */ l(E.Root, { children: u }), e[9] = u, e[10] = f) : f = e[10], f;
1133
+ return e[9] !== u ? (f = /* @__PURE__ */ l(N.Root, { children: u }), e[9] = u, e[10] = f) : f = e[10], f;
1130
1134
  }
1131
- function xr(t, e) {
1135
+ function kr(t, e) {
1132
1136
  return t.id ? `id:${t.id}` : `idx:${e}`;
1133
1137
  }
1134
- function yr(t) {
1138
+ function Tr(t) {
1135
1139
  const e = y(6), {
1136
1140
  invocations: n,
1137
- labeledBlocks: s,
1141
+ labeledBlocks: i,
1138
1142
  onOpenFile: r
1139
1143
  } = t;
1140
1144
  let o;
1141
- e[0] !== n || e[1] !== s ? (o = sr(n, {
1142
- labeledBlocks: s
1143
- }), e[0] = n, e[1] = s, e[2] = o) : o = e[2];
1144
- const i = o;
1145
+ e[0] !== n || e[1] !== i ? (o = cr(n, {
1146
+ labeledBlocks: i
1147
+ }), e[0] = n, e[1] = i, e[2] = o) : o = e[2];
1148
+ const s = o;
1145
1149
  let c;
1146
- return e[3] !== i || e[4] !== r ? (c = /* @__PURE__ */ l(br, { data: i, onOpenFile: r }), e[3] = i, e[4] = r, e[5] = c) : c = e[5], c;
1150
+ return e[3] !== s || e[4] !== r ? (c = /* @__PURE__ */ l(Sr, { data: s, onOpenFile: r }), e[3] = s, e[4] = r, e[5] = c) : c = e[5], c;
1147
1151
  }
1148
- const Sr = (t) => t.type === "tool", Be = (t) => t >= 1e3 ? `${(t / 1e3).toFixed(1)}k` : String(t), kr = (t) => {
1152
+ const wr = (t) => t.type === "tool", Ae = (t) => t >= 1e3 ? `${(t / 1e3).toFixed(1)}k` : String(t), Cr = (t) => {
1149
1153
  switch (t) {
1150
1154
  case "timeout":
1151
1155
  return "Session timed out.";
@@ -1156,75 +1160,75 @@ const Sr = (t) => t.type === "tool", Be = (t) => t >= 1e3 ? `${(t / 1e3).toFixed
1156
1160
  default:
1157
1161
  return "An error occurred.";
1158
1162
  }
1159
- }, Tr = (t, e) => {
1163
+ }, Pr = (t, e) => {
1160
1164
  const n = [];
1161
- let s = e;
1162
- for (; s < t.length; ) {
1163
- const r = t[s];
1164
- if (!Sr(r)) break;
1165
- n.push(r), s += 1;
1165
+ let i = e;
1166
+ for (; i < t.length; ) {
1167
+ const r = t[i];
1168
+ if (!wr(r)) break;
1169
+ n.push(r), i += 1;
1166
1170
  }
1167
1171
  return {
1168
1172
  invocations: n,
1169
- nextIndex: s - 1
1173
+ nextIndex: i - 1
1170
1174
  };
1171
1175
  };
1172
- function wr(t) {
1176
+ function _r(t) {
1173
1177
  const e = y(7), {
1174
1178
  message: n,
1175
- onOpenFile: s,
1179
+ onOpenFile: i,
1176
1180
  toolInvocationTimeline: r
1177
- } = t, o = r ?? yr;
1178
- let i;
1179
- e[0] !== n.parts ? (i = n.parts ?? [], e[0] = n.parts, e[1] = i) : i = e[1];
1180
- const c = i;
1181
+ } = t, o = r ?? Tr;
1182
+ let s;
1183
+ e[0] !== n.parts ? (s = n.parts ?? [], e[0] = n.parts, e[1] = s) : s = e[1];
1184
+ const c = s;
1181
1185
  let d;
1182
- if (e[2] !== o || e[3] !== n.id || e[4] !== s || e[5] !== c) {
1186
+ if (e[2] !== o || e[3] !== n.id || e[4] !== i || e[5] !== c) {
1183
1187
  const a = [];
1184
1188
  for (let u = 0; u < c.length; u = u + 1, u) {
1185
1189
  const f = c[u], p = `${n.id}-${u}`;
1186
1190
  e: switch (f.type) {
1187
1191
  case "text": {
1188
- a.push(/* @__PURE__ */ l("div", { children: /* @__PURE__ */ l(fn, { children: f.text }) }, p));
1192
+ a.push(/* @__PURE__ */ l("div", { children: /* @__PURE__ */ l(hn, { children: f.text }) }, p));
1189
1193
  break e;
1190
1194
  }
1191
1195
  case "reasoning": {
1192
- a.push(/* @__PURE__ */ l(T, { padding: "0", css: {
1196
+ a.push(/* @__PURE__ */ l(k, { padding: "0", css: {
1193
1197
  "& .rich-text, & .rich-text *": {
1194
1198
  color: "fg.subtle !important",
1195
1199
  fontSize: ".75rem !important",
1196
1200
  fontWeight: "normal !important"
1197
1201
  }
1198
- }, children: /* @__PURE__ */ l(Ze, { defaultState: f.text }) }, p));
1202
+ }, children: /* @__PURE__ */ l(nt, { defaultState: f.text }) }, p));
1199
1203
  break e;
1200
1204
  }
1201
1205
  case "tool": {
1202
1206
  const {
1203
1207
  invocations: m,
1204
1208
  nextIndex: h
1205
- } = Tr(c, u);
1206
- u = h, a.push(/* @__PURE__ */ l(T, { width: "full", children: /* @__PURE__ */ l(o, { invocations: m, labeledBlocks: !0, onOpenFile: s }) }, p));
1209
+ } = Pr(c, u);
1210
+ u = h, a.push(/* @__PURE__ */ l(k, { width: "full", children: /* @__PURE__ */ l(o, { invocations: m, labeledBlocks: !0, onOpenFile: i }) }, p));
1207
1211
  break e;
1208
1212
  }
1209
1213
  case "loading": {
1210
- a.push(/* @__PURE__ */ x(T, { display: "flex", alignItems: "center", gap: "2", py: "2", children: [
1211
- /* @__PURE__ */ l(yt, { size: "sm" }),
1212
- /* @__PURE__ */ l(Q, { fontSize: "sm", color: "fg.muted", children: "Thinking..." })
1214
+ a.push(/* @__PURE__ */ x(k, { display: "flex", alignItems: "center", gap: "2", py: "2", children: [
1215
+ /* @__PURE__ */ l(Tt, { size: "sm" }),
1216
+ /* @__PURE__ */ l(ne, { fontSize: "sm", color: "fg.muted", children: "Thinking..." })
1213
1217
  ] }, p));
1214
1218
  break e;
1215
1219
  }
1216
1220
  case "error": {
1217
- a.push(/* @__PURE__ */ l(T, { py: "2", children: /* @__PURE__ */ l(Q, { fontSize: "sm", color: "fg.error", children: kr(f.errorType) }) }, p));
1221
+ a.push(/* @__PURE__ */ l(k, { py: "2", children: /* @__PURE__ */ l(ne, { fontSize: "sm", color: "fg.error", children: Cr(f.errorType) }) }, p));
1218
1222
  break e;
1219
1223
  }
1220
1224
  case "token_usage": {
1221
- a.push(/* @__PURE__ */ l(T, { py: "1", children: /* @__PURE__ */ x(Q, { fontSize: "xs", color: "fg.subtle", children: [
1225
+ a.push(/* @__PURE__ */ l(k, { py: "1", children: /* @__PURE__ */ x(ne, { fontSize: "xs", color: "fg.subtle", children: [
1222
1226
  "Tokens: ",
1223
- Be(f.inputTokens),
1227
+ Ae(f.inputTokens),
1224
1228
  " in / ",
1225
- Be(f.outputTokens),
1229
+ Ae(f.outputTokens),
1226
1230
  " out",
1227
- f.cacheReadTokens ? ` / ${Be(f.cacheReadTokens)} cache read` : ""
1231
+ f.cacheReadTokens ? ` / ${Ae(f.cacheReadTokens)} cache read` : ""
1228
1232
  ] }) }, p));
1229
1233
  break e;
1230
1234
  }
@@ -1232,20 +1236,20 @@ function wr(t) {
1232
1236
  a.push(null);
1233
1237
  }
1234
1238
  }
1235
- d = /* @__PURE__ */ l(De, { children: a }), e[2] = o, e[3] = n.id, e[4] = s, e[5] = c, e[6] = d;
1239
+ d = /* @__PURE__ */ l(Me, { children: a }), e[2] = o, e[3] = n.id, e[4] = i, e[5] = c, e[6] = d;
1236
1240
  } else
1237
1241
  d = e[6];
1238
1242
  return d;
1239
1243
  }
1240
- const Cr = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "assistant", Pr = (t) => {
1244
+ const Ir = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "assistant", Rr = (t) => {
1241
1245
  const e = t.parts ?? [];
1242
- return e.length === 0 || e.some((s) => s.type === "text" && "text" in s) ? !1 : e.some((s) => s.type === "reasoning" || s.type === "tool");
1243
- }, _r = (t) => {
1246
+ return e.length === 0 || e.some((i) => i.type === "text" && "text" in i) ? !1 : e.some((i) => i.type === "reasoning" || i.type === "tool");
1247
+ }, Br = (t) => {
1244
1248
  const e = [];
1245
1249
  for (const n of t) {
1246
- const s = e[e.length - 1];
1247
- if (s && s.role === n.role && Pr(n)) {
1248
- s.parts = [...s.parts ?? [], ...n.parts ?? []];
1250
+ const i = e[e.length - 1];
1251
+ if (i && i.role === n.role && Rr(n)) {
1252
+ i.parts = [...i.parts ?? [], ...n.parts ?? []];
1249
1253
  continue;
1250
1254
  }
1251
1255
  e.push({
@@ -1254,63 +1258,67 @@ const Cr = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "
1254
1258
  });
1255
1259
  }
1256
1260
  return e;
1257
- }, Rr = dn(), co = (t) => {
1258
- const e = y(43), {
1261
+ }, uo = (t) => {
1262
+ const e = y(47), {
1259
1263
  messages: n,
1260
- streaming: s,
1264
+ streaming: i,
1261
1265
  emptyStateTitle: r,
1262
1266
  emptyStateDescription: o,
1263
- chatInputPlaceholder: i,
1264
- onSubmitMessage: c,
1265
- actions: d,
1266
- repoMenu: a,
1267
- attachedResources: u,
1268
- onClearAttachments: f,
1269
- attachmentList: p,
1270
- approvalPrompt: m
1271
- } = t, h = s === void 0 ? !1 : s;
1272
- let g, S, k, P, D, B, v, A, F, _;
1273
- if (e[0] !== o || e[1] !== r || e[2] !== n || e[3] !== h) {
1274
- const N = _r(n), H = N.length > 0, ye = N.reduce(Ir, 0);
1275
- k = pe, B = "relative", v = "column", A = "full", F = "full", _ = "hidden", S = Ie.Root, D = /* @__PURE__ */ l(rn, { userMessageCount: ye }), g = Ie.Viewport, P = H ? /* @__PURE__ */ l(Ke, { gap: "sm", children: N.map((L) => {
1276
- const j = Cr(L.role);
1277
- return /* @__PURE__ */ l(Oe.Root, { from: j, children: /* @__PURE__ */ l(Oe.Content, { from: j, children: /* @__PURE__ */ l(wr, { message: L, streaming: h }) }) }, L.id);
1278
- }) }) : /* @__PURE__ */ l(qt, { icon: /* @__PURE__ */ l(Et, { size: 48, strokeWidth: 1.5 }), title: r, description: o }), e[0] = o, e[1] = r, e[2] = n, e[3] = h, e[4] = g, e[5] = S, e[6] = k, e[7] = P, e[8] = D, e[9] = B, e[10] = v, e[11] = A, e[12] = F, e[13] = _;
1267
+ chatInputPlaceholder: s,
1268
+ chatInputDefaultValue: c,
1269
+ onSubmitMessage: d,
1270
+ onChatInputChange: a,
1271
+ actions: u,
1272
+ repoMenu: f,
1273
+ attachedResources: p,
1274
+ onClearAttachments: m,
1275
+ attachmentList: h,
1276
+ approvalPrompt: b
1277
+ } = t, S = i === void 0 ? !1 : i, T = c === void 0 ? "" : c;
1278
+ let P, z, v, M, A, O, _, C, F, L;
1279
+ if (e[0] !== o || e[1] !== r || e[2] !== n || e[3] !== S) {
1280
+ const H = Br(n), Te = H.length > 0, K = H.reduce(Dr, 0);
1281
+ v = ge, O = "relative", _ = "column", C = "full", F = "full", L = "hidden", z = ve.Root, A = /* @__PURE__ */ l(ln, { userMessageCount: K }), P = ve.Viewport, M = Te ? /* @__PURE__ */ l(Qe, { gap: "sm", children: H.map((U) => {
1282
+ const V = Ir(U.role);
1283
+ return /* @__PURE__ */ l(Ne.Root, { from: V, children: /* @__PURE__ */ l(Ne.Content, { from: V, children: /* @__PURE__ */ l(_r, { message: U, streaming: S }) }) }, U.id);
1284
+ }) }) : /* @__PURE__ */ l(Gt, { icon: /* @__PURE__ */ l(Nt, { size: 48, strokeWidth: 1.5 }), title: r, description: o }), e[0] = o, e[1] = r, e[2] = n, e[3] = S, e[4] = P, e[5] = z, e[6] = v, e[7] = M, e[8] = A, e[9] = O, e[10] = _, e[11] = C, e[12] = F, e[13] = L;
1279
1285
  } else
1280
- g = e[4], S = e[5], k = e[6], P = e[7], D = e[8], B = e[9], v = e[10], A = e[11], F = e[12], _ = e[13];
1281
- let C;
1282
- e[14] !== g || e[15] !== P ? (C = /* @__PURE__ */ l(g, { children: P }), e[14] = g, e[15] = P, e[16] = C) : C = e[16];
1283
- let O;
1284
- e[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (O = /* @__PURE__ */ l(Ie.ScrollToBottom, { "aria-label": "Scroll to latest message" }), e[17] = O) : O = e[17];
1286
+ P = e[4], z = e[5], v = e[6], M = e[7], A = e[8], O = e[9], _ = e[10], C = e[11], F = e[12], L = e[13];
1285
1287
  let $;
1286
- e[18] !== S || e[19] !== D || e[20] !== C ? ($ = /* @__PURE__ */ x(S, { children: [
1287
- D,
1288
- C,
1289
- O
1290
- ] }), e[18] = S, e[19] = D, e[20] = C, e[21] = $) : $ = e[21];
1291
- let R;
1292
- e[22] !== d || e[23] !== u || e[24] !== p || e[25] !== i || e[26] !== f || e[27] !== c || e[28] !== h ? (R = /* @__PURE__ */ l(T, { px: "sm", children: /* @__PURE__ */ l(sn, { placeholder: i, defaultState: Rr, streaming: h, onSubmit: c, actions: d, attachedResources: u, onClearAttachments: f, attachmentList: p }) }), e[22] = d, e[23] = u, e[24] = p, e[25] = i, e[26] = f, e[27] = c, e[28] = h, e[29] = R) : R = e[29];
1288
+ e[14] !== P || e[15] !== M ? ($ = /* @__PURE__ */ l(P, { children: M }), e[14] = P, e[15] = M, e[16] = $) : $ = e[16];
1289
+ let W;
1290
+ e[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (W = /* @__PURE__ */ l(ve.ScrollToBottom, { "aria-label": "Scroll to latest message" }), e[17] = W) : W = e[17];
1293
1291
  let I;
1294
- e[30] !== a ? (I = /* @__PURE__ */ l(pe, { p: "2xs", justifyContent: "flex-end", children: a }), e[30] = a, e[31] = I) : I = e[31];
1295
- let z;
1296
- return e[32] !== k || e[33] !== m || e[34] !== $ || e[35] !== R || e[36] !== I || e[37] !== B || e[38] !== v || e[39] !== A || e[40] !== F || e[41] !== _ ? (z = /* @__PURE__ */ x(k, { position: B, direction: v, w: A, h: F, overflow: _, children: [
1292
+ e[18] !== z || e[19] !== A || e[20] !== $ ? (I = /* @__PURE__ */ x(z, { children: [
1293
+ A,
1297
1294
  $,
1298
- m,
1299
- R,
1300
- I
1301
- ] }), e[32] = k, e[33] = m, e[34] = $, e[35] = R, e[36] = I, e[37] = B, e[38] = v, e[39] = A, e[40] = F, e[41] = _, e[42] = z) : z = e[42], z;
1295
+ W
1296
+ ] }), e[18] = z, e[19] = A, e[20] = $, e[21] = I) : I = e[21];
1297
+ let R;
1298
+ e[22] !== T ? (R = pn(T), e[22] = T, e[23] = R) : R = e[23];
1299
+ let B;
1300
+ e[24] !== u || e[25] !== p || e[26] !== h || e[27] !== s || e[28] !== a || e[29] !== m || e[30] !== d || e[31] !== S || e[32] !== R ? (B = /* @__PURE__ */ l(k, { px: "sm", children: /* @__PURE__ */ l(an, { placeholder: s, defaultState: R, streaming: S, onSubmit: d, onChange: a, actions: u, attachedResources: p, onClearAttachments: m, attachmentList: h }) }), e[24] = u, e[25] = p, e[26] = h, e[27] = s, e[28] = a, e[29] = m, e[30] = d, e[31] = S, e[32] = R, e[33] = B) : B = e[33];
1301
+ let D;
1302
+ e[34] !== f ? (D = /* @__PURE__ */ l(ge, { p: "2xs", justifyContent: "flex-end", children: f }), e[34] = f, e[35] = D) : D = e[35];
1303
+ let j;
1304
+ return e[36] !== v || e[37] !== b || e[38] !== I || e[39] !== B || e[40] !== D || e[41] !== O || e[42] !== _ || e[43] !== C || e[44] !== F || e[45] !== L ? (j = /* @__PURE__ */ x(v, { position: O, direction: _, w: C, h: F, overflow: L, children: [
1305
+ I,
1306
+ b,
1307
+ B,
1308
+ D
1309
+ ] }), e[36] = v, e[37] = b, e[38] = I, e[39] = B, e[40] = D, e[41] = O, e[42] = _, e[43] = C, e[44] = F, e[45] = L, e[46] = j) : j = e[46], j;
1302
1310
  };
1303
- function Ir(t, e) {
1311
+ function Dr(t, e) {
1304
1312
  return t + (e.role === "user" ? 1 : 0);
1305
1313
  }
1306
1314
  export {
1307
- lo as ApprovalPrompt,
1308
- rn as AutoScroll,
1309
- sn as ChatInput,
1310
- Oe as ChatMessage,
1311
- co as ChatPanel,
1312
- Ie as ChatPrimitives,
1313
- on as SendButton,
1314
- dn as createSerializedPromptState
1315
+ ao as ApprovalPrompt,
1316
+ ln as AutoScroll,
1317
+ an as ChatInput,
1318
+ Ne as ChatMessage,
1319
+ uo as ChatPanel,
1320
+ ve as ChatPrimitives,
1321
+ cn as SendButton,
1322
+ pn as createSerializedPromptState
1315
1323
  };
1316
1324
  //# sourceMappingURL=chat-ui.js.map