@mast-ai/react-ui 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,5 +7,16 @@ export interface ToolCallBlockProps {
7
7
  entry: ToolEventEntry;
8
8
  /** Optional class added to the root element. */
9
9
  className?: string;
10
+ /**
11
+ * Controls whether the block body (sub-output, nested events, args, result)
12
+ * is open by default. The header (status icon + tool name) is always
13
+ * visible.
14
+ *
15
+ * - `'streaming'` (default): open while `entry.isStreaming` is `true`, then
16
+ * collapses on completion.
17
+ * - `true`: open by default, regardless of streaming state.
18
+ * - `false`: closed by default, regardless of streaming state.
19
+ */
20
+ defaultOpen?: boolean | 'streaming';
10
21
  }
11
- export declare function ToolCallBlock({ entry, className }: ToolCallBlockProps): import("react/jsx-runtime").JSX.Element;
22
+ export declare function ToolCallBlock({ entry, className, defaultOpen }: ToolCallBlockProps): import("react/jsx-runtime").JSX.Element;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { useState as R, useRef as C, useEffect as Q, useCallback as _, createContext as nt, useMemo as J, useContext as st, lazy as pt, Fragment as rt, Suspense as ft, useId as gt } from "react";
2
- import { jsx as e, jsxs as k } from "react/jsx-runtime";
3
- import { AgentRunner as vt } from "@mast-ai/core";
4
- import { useVirtualizer as bt } from "@tanstack/react-virtual";
2
+ import { jsx as e, jsxs as v } from "react/jsx-runtime";
3
+ import { AgentRunner as bt } from "@mast-ai/core";
4
+ import { useVirtualizer as vt } from "@tanstack/react-virtual";
5
5
  function tt(t, n, r) {
6
6
  return { id: crypto.randomUUID(), role: t, text: n, toolEvents: [], isStreaming: r };
7
7
  }
@@ -11,69 +11,69 @@ function F(t, n, r) {
11
11
  function W(t, n, r, s) {
12
12
  return F(t, n, (a) => {
13
13
  let i = !1;
14
- const l = a.toolEvents.map((o) => !i && o.name === r && o.isStreaming ? (i = !0, s(o)) : o);
14
+ const l = a.toolEvents.map((c) => !i && c.name === r && c.isStreaming ? (i = !0, s(c)) : c);
15
15
  return { ...a, toolEvents: l };
16
16
  });
17
17
  }
18
18
  function kt(t, n, r, s, a) {
19
19
  return W(t, n, r, (i) => {
20
20
  let l = !1;
21
- const o = (i.nestedToolEvents ?? []).map((u) => !l && u.name === s && u.isStreaming ? (l = !0, a(u)) : u);
22
- return { ...i, nestedToolEvents: o };
21
+ const c = (i.nestedToolEvents ?? []).map((u) => !l && u.name === s && u.isStreaming ? (l = !0, a(u)) : u);
22
+ return { ...i, nestedToolEvents: c };
23
23
  });
24
24
  }
25
25
  function xt(t, n) {
26
- const [r, s] = R(() => (n == null ? void 0 : n.initialEntries) ?? []), [a, i] = R(() => [...t.history]), [l, o] = R(!1), [u, m] = R(0), y = C(null), v = C(n == null ? void 0 : n.onTurnComplete);
27
- v.current = n == null ? void 0 : n.onTurnComplete, Q(() => {
28
- var g;
29
- u !== 0 && ((g = v.current) == null || g.call(v, r, a));
26
+ const [r, s] = R(() => (n == null ? void 0 : n.initialEntries) ?? []), [a, i] = R(() => [...t.history]), [l, c] = R(!1), [u, m] = R(0), k = C(null), g = C(n == null ? void 0 : n.onTurnComplete);
27
+ g.current = n == null ? void 0 : n.onTurnComplete, Q(() => {
28
+ var b;
29
+ u !== 0 && ((b = g.current) == null || b.call(g, r, a));
30
30
  }, [u]);
31
- const T = (g) => {
32
- for (let A = g.length - 1; A >= 0; A--) {
33
- const N = g[A];
31
+ const T = (b) => {
32
+ for (let A = b.length - 1; A >= 0; A--) {
33
+ const N = b[A];
34
34
  if (N.role === "assistant" && N.isStreaming) return N.id;
35
35
  }
36
- }, M = _((g, A) => {
36
+ }, M = _((b, A) => {
37
37
  s((N) => {
38
38
  const E = T(N);
39
- return E === void 0 ? N : W(N, E, g, (I) => ({
39
+ return E === void 0 ? N : W(N, E, b, (I) => ({
40
40
  ...I,
41
41
  awaitingApproval: A
42
42
  }));
43
43
  });
44
- }, []), P = _((g, A) => {
44
+ }, []), P = _((b, A) => {
45
45
  s((N) => {
46
46
  const E = T(N);
47
- return E === void 0 ? N : W(N, E, g, (I) => ({ ...I, status: A }));
47
+ return E === void 0 ? N : W(N, E, b, (I) => ({ ...I, status: A }));
48
48
  });
49
49
  }, []), S = _(
50
- (g, A) => {
50
+ (b, A) => {
51
51
  if (l) return;
52
- const N = tt("user", A ?? g, !1), E = tt("assistant", "", !0), I = E.id;
53
- s((b) => [...b, N, E]), o(!0);
52
+ const N = tt("user", A ?? b, !1), E = tt("assistant", "", !0), I = E.id;
53
+ s((x) => [...x, N, E]), c(!0);
54
54
  const h = new AbortController();
55
- y.current = h, (async () => {
55
+ k.current = h, (async () => {
56
56
  try {
57
- const b = t.runStream(
58
- g,
57
+ const x = t.runStream(
58
+ b,
59
59
  h.signal,
60
60
  (d, f) => {
61
61
  if (f.type === "thinking")
62
62
  s(
63
- (c) => W(c, I, d, (x) => ({
64
- ...x,
65
- subThinking: (x.subThinking ?? "") + f.delta
63
+ (o) => W(o, I, d, (y) => ({
64
+ ...y,
65
+ subThinking: (y.subThinking ?? "") + f.delta
66
66
  }))
67
67
  );
68
68
  else if (f.type === "text_delta")
69
69
  s(
70
- (c) => W(c, I, d, (x) => ({
71
- ...x,
72
- subText: (x.subText ?? "") + f.delta
70
+ (o) => W(o, I, d, (y) => ({
71
+ ...y,
72
+ subText: (y.subText ?? "") + f.delta
73
73
  }))
74
74
  );
75
75
  else if (f.type === "tool_call_started") {
76
- const c = {
76
+ const o = {
77
77
  id: crypto.randomUUID(),
78
78
  type: "tool_call_started",
79
79
  name: f.name,
@@ -81,38 +81,38 @@ function xt(t, n) {
81
81
  isStreaming: !0
82
82
  };
83
83
  s(
84
- (x) => W(x, I, d, (V) => ({
84
+ (y) => W(y, I, d, (V) => ({
85
85
  ...V,
86
- nestedToolEvents: [...V.nestedToolEvents ?? [], c]
86
+ nestedToolEvents: [...V.nestedToolEvents ?? [], o]
87
87
  }))
88
88
  );
89
89
  } else if (f.type === "tool_call_completed") {
90
- const c = f;
90
+ const o = f;
91
91
  s(
92
- (x) => kt(x, I, d, c.name, (V) => ({
92
+ (y) => kt(y, I, d, o.name, (V) => ({
93
93
  ...V,
94
94
  type: "tool_call_completed",
95
- result: c.result,
95
+ result: o.result,
96
96
  isStreaming: !1,
97
- status: c.error ? "error" : "success"
97
+ status: o.error ? "error" : "success"
98
98
  }))
99
99
  );
100
100
  }
101
101
  }
102
102
  );
103
- for await (const d of b)
103
+ for await (const d of x)
104
104
  if (d.type === "text_delta")
105
105
  s(
106
- (f) => F(f, I, (c) => ({
107
- ...c,
108
- text: c.text + d.delta
106
+ (f) => F(f, I, (o) => ({
107
+ ...o,
108
+ text: o.text + d.delta
109
109
  }))
110
110
  );
111
111
  else if (d.type === "thinking")
112
112
  s(
113
- (f) => F(f, I, (c) => ({
114
- ...c,
115
- thinking: (c.thinking ?? "") + d.delta
113
+ (f) => F(f, I, (o) => ({
114
+ ...o,
115
+ thinking: (o.thinking ?? "") + d.delta
116
116
  }))
117
117
  );
118
118
  else if (d.type === "tool_call_started") {
@@ -124,49 +124,49 @@ function xt(t, n) {
124
124
  isStreaming: !0
125
125
  };
126
126
  s(
127
- (c) => F(c, I, (x) => ({
128
- ...x,
129
- toolEvents: [...x.toolEvents, f]
127
+ (o) => F(o, I, (y) => ({
128
+ ...y,
129
+ toolEvents: [...y.toolEvents, f]
130
130
  }))
131
131
  );
132
132
  } else if (d.type === "tool_call_completed")
133
133
  s(
134
- (f) => W(f, I, d.name, (c) => ({
135
- ...c,
134
+ (f) => W(f, I, d.name, (o) => ({
135
+ ...o,
136
136
  type: "tool_call_completed",
137
137
  result: d.result,
138
138
  isStreaming: !1,
139
139
  // Preserve a status set by the proxy (e.g. 'cancelled'); only
140
140
  // fall back to error/success based on the runner's flag.
141
- status: c.status ?? (d.error ? "error" : "success")
141
+ status: o.status ?? (d.error ? "error" : "success")
142
142
  }))
143
143
  );
144
144
  else if (d.type === "done") {
145
145
  const f = d.history;
146
146
  s(
147
- (c) => F(c, I, (x) => ({
148
- ...x,
147
+ (o) => F(o, I, (y) => ({
148
+ ...y,
149
149
  text: d.output,
150
150
  isStreaming: !1
151
151
  }))
152
- ), i(f), m((c) => c + 1);
152
+ ), i(f), m((o) => o + 1);
153
153
  }
154
154
  } catch {
155
155
  s(
156
- (b) => F(b, I, (d) => ({ ...d, isStreaming: !1 }))
156
+ (x) => F(x, I, (d) => ({ ...d, isStreaming: !1 }))
157
157
  );
158
158
  } finally {
159
- o(!1);
159
+ c(!1);
160
160
  }
161
161
  })();
162
162
  },
163
163
  [t, l]
164
164
  ), w = _(() => {
165
- var g;
166
- (g = y.current) == null || g.abort();
165
+ var b;
166
+ (b = k.current) == null || b.abort();
167
167
  }, []), B = _(() => {
168
- var g;
169
- (g = y.current) == null || g.abort(), y.current = null, s([]), i([]), o(!1);
168
+ var b;
169
+ (b = k.current) == null || b.abort(), k.current = null, s([]), i([]), c(!1);
170
170
  }, []);
171
171
  return {
172
172
  entries: r,
@@ -192,7 +192,7 @@ const K = {
192
192
  focusable: !1
193
193
  };
194
194
  function yt() {
195
- return /* @__PURE__ */ k("svg", { ...K, children: [
195
+ return /* @__PURE__ */ v("svg", { ...K, children: [
196
196
  /* @__PURE__ */ e("path", { d: "M9 3a3 3 0 0 0-3 3v.5a3 3 0 0 0-2 5.2A3 3 0 0 0 6 17v.5a3 3 0 0 0 6 0V3a3 3 0 0 0-3 0Z" }),
197
197
  /* @__PURE__ */ e("path", { d: "M15 3a3 3 0 0 1 3 3v.5a3 3 0 0 1 2 5.2A3 3 0 0 1 18 17v.5a3 3 0 0 1-6 0V3a3 3 0 0 1 3 0Z" })
198
198
  ] });
@@ -201,20 +201,20 @@ function It() {
201
201
  return /* @__PURE__ */ e("svg", { ...K, children: /* @__PURE__ */ e("path", { d: "M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.6 2.6-2.4-2.4 2.6-2.6Z" }) });
202
202
  }
203
203
  function St() {
204
- return /* @__PURE__ */ k("svg", { ...K, children: [
204
+ return /* @__PURE__ */ v("svg", { ...K, children: [
205
205
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "9" }),
206
206
  /* @__PURE__ */ e("path", { d: "m8 12 3 3 5-6" })
207
207
  ] });
208
208
  }
209
209
  function Nt() {
210
- return /* @__PURE__ */ k("svg", { ...K, children: [
210
+ return /* @__PURE__ */ v("svg", { ...K, children: [
211
211
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "9" }),
212
212
  /* @__PURE__ */ e("path", { d: "m9 9 6 6" }),
213
213
  /* @__PURE__ */ e("path", { d: "m15 9-6 6" })
214
214
  ] });
215
215
  }
216
216
  function Tt() {
217
- return /* @__PURE__ */ k("svg", { ...K, children: [
217
+ return /* @__PURE__ */ v("svg", { ...K, children: [
218
218
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "9" }),
219
219
  /* @__PURE__ */ e("path", { d: "M5.5 5.5 18.5 18.5" })
220
220
  ] });
@@ -270,23 +270,23 @@ class Rt {
270
270
  return this.inner.definition();
271
271
  }
272
272
  async call(n, r) {
273
- var i, l, o, u, m, y;
273
+ var i, l, c, u, m, k;
274
274
  const s = this.inner.definition();
275
275
  (l = (i = this.hooks).notifyAwaiting) == null || l.call(i, s.name, !0);
276
276
  let a;
277
277
  try {
278
- const v = await this.onApprovalRequired({
278
+ const g = await this.onApprovalRequired({
279
279
  id: "",
280
280
  type: "tool_call_started",
281
281
  name: s.name,
282
282
  args: n,
283
283
  isStreaming: !0
284
284
  });
285
- v === Mt ? this.hooks.enqueueInline ? a = await this.hooks.enqueueInline(s.name, n) : a = !0 : a = v;
285
+ g === Mt ? this.hooks.enqueueInline ? a = await this.hooks.enqueueInline(s.name, n) : a = !0 : a = g;
286
286
  } finally {
287
- (u = (o = this.hooks).notifyAwaiting) == null || u.call(o, s.name, !1);
287
+ (u = (c = this.hooks).notifyAwaiting) == null || u.call(c, s.name, !1);
288
288
  }
289
- return a === !1 ? ((y = (m = this.hooks).setStatus) == null || y.call(m, s.name, "cancelled"), Pt) : typeof a == "string" ? a : this.inner.call(n, r);
289
+ return a === !1 ? ((k = (m = this.hooks).setStatus) == null || k.call(m, s.name, "cancelled"), Pt) : typeof a == "string" ? a : this.inner.call(n, r);
290
290
  }
291
291
  }
292
292
  function Dt(t, n, r, s = {}) {
@@ -297,13 +297,13 @@ function Dt(t, n, r, s = {}) {
297
297
  if (!i) return;
298
298
  const l = i.definition();
299
299
  if (!_t(l, r())) return i;
300
- const o = n();
301
- return o ? new Rt(i, o, s) : i;
300
+ const c = n();
301
+ return c ? new Rt(i, c, s) : i;
302
302
  }
303
303
  };
304
304
  }
305
305
  const it = nt(null);
306
- function re({
306
+ function ae({
307
307
  runner: t,
308
308
  agent: n,
309
309
  children: r,
@@ -311,12 +311,12 @@ function re({
311
311
  onApprovalRequired: a,
312
312
  approvalOverride: i,
313
313
  initialHistory: l,
314
- initialEntries: o,
314
+ initialEntries: c,
315
315
  onConversationChange: u
316
316
  }) {
317
317
  const m = C(u);
318
318
  m.current = u;
319
- const y = C(l), v = C(o), T = C(a);
319
+ const k = C(l), g = C(c), T = C(a);
320
320
  T.current = a;
321
321
  const M = C(i);
322
322
  M.current = i;
@@ -342,10 +342,10 @@ function re({
342
342
  () => M.current,
343
343
  z
344
344
  );
345
- return new vt(t.adapter, H);
346
- }, [t, a, i]), [g, A] = R(() => {
345
+ return new bt(t.adapter, H);
346
+ }, [t, a, i]), [b, A] = R(() => {
347
347
  const $ = B.conversation(n);
348
- return y.current && y.current.length > 0 && ($.history = [...y.current]), $;
348
+ return k.current && k.current.length > 0 && ($.history = [...k.current]), $;
349
349
  }), N = _(
350
350
  ($, O) => {
351
351
  var z;
@@ -357,17 +357,17 @@ function re({
357
357
  history: I,
358
358
  sendMessage: h,
359
359
  cancel: p,
360
- isRunning: b,
360
+ isRunning: x,
361
361
  reset: d,
362
362
  setToolAwaitingApproval: f,
363
- setToolStatus: c
364
- } = xt(g, {
365
- initialEntries: v.current,
363
+ setToolStatus: o
364
+ } = xt(b, {
365
+ initialEntries: g.current,
366
366
  onTurnComplete: N
367
367
  });
368
- P.current = f, S.current = c;
369
- const [x, V] = R([]), X = C(x);
370
- X.current = x;
368
+ P.current = f, S.current = o;
369
+ const [y, V] = R([]), X = C(y);
370
+ X.current = y;
371
371
  const dt = _(($, O) => new Promise((z) => {
372
372
  const H = (D) => {
373
373
  V((j) => j.filter((ht) => ht !== U)), z(D);
@@ -389,11 +389,11 @@ function re({
389
389
  history: I,
390
390
  sendMessage: h,
391
391
  cancel: p,
392
- isRunning: b,
392
+ isRunning: x,
393
393
  reset: Y,
394
- pendingApprovals: x
394
+ pendingApprovals: y
395
395
  }),
396
- [E, I, h, p, b, Y, x]
396
+ [E, I, h, p, x, Y, y]
397
397
  );
398
398
  return /* @__PURE__ */ e(it.Provider, { value: mt, children: /* @__PURE__ */ e(Ct, { icons: s, children: r }) });
399
399
  }
@@ -414,14 +414,14 @@ function $t(t) {
414
414
  }
415
415
  function jt({ entry: t, approve: n, reject: r, className: s }) {
416
416
  const a = q(), i = ["mast-inline-approval", s].filter(Boolean).join(" "), l = $t(t.args);
417
- return /* @__PURE__ */ k("div", { "data-mast-inline-approval": !0, "data-tool-name": t.name, className: i, children: [
418
- /* @__PURE__ */ k("div", { className: "mast-inline-approval-header", children: [
417
+ return /* @__PURE__ */ v("div", { "data-mast-inline-approval": !0, "data-tool-name": t.name, className: i, children: [
418
+ /* @__PURE__ */ v("div", { className: "mast-inline-approval-header", children: [
419
419
  /* @__PURE__ */ e("span", { className: "mast-inline-approval-icon", "aria-hidden": "true", children: a.wrench }),
420
420
  /* @__PURE__ */ e("span", { className: "mast-inline-approval-name", children: t.name }),
421
421
  /* @__PURE__ */ e("span", { className: "mast-inline-approval-label", children: "requires approval" })
422
422
  ] }),
423
423
  l ? /* @__PURE__ */ e("pre", { className: "mast-inline-approval-args", children: /* @__PURE__ */ e("code", { children: l }) }) : null,
424
- /* @__PURE__ */ k("div", { className: "mast-inline-approval-actions", children: [
424
+ /* @__PURE__ */ v("div", { className: "mast-inline-approval-actions", children: [
425
425
  /* @__PURE__ */ e(
426
426
  "button",
427
427
  {
@@ -451,7 +451,7 @@ function lt({
451
451
  open: a
452
452
  }) {
453
453
  const i = q(), l = ["mast-thinking-block", r].filter(Boolean).join(" ");
454
- return /* @__PURE__ */ k(
454
+ return /* @__PURE__ */ v(
455
455
  "details",
456
456
  {
457
457
  "data-mast-thinking-block": !0,
@@ -459,7 +459,7 @@ function lt({
459
459
  className: l,
460
460
  open: a,
461
461
  children: [
462
- /* @__PURE__ */ k("summary", { className: "mast-thinking-block-summary", children: [
462
+ /* @__PURE__ */ v("summary", { className: "mast-thinking-block-summary", children: [
463
463
  /* @__PURE__ */ e("span", { className: "mast-thinking-block-icon", "aria-hidden": "true", children: i.brain }),
464
464
  /* @__PURE__ */ e("span", { className: "mast-thinking-block-label", children: s }),
465
465
  n ? /* @__PURE__ */ e(
@@ -496,60 +496,67 @@ function Lt(t, n) {
496
496
  return n.check;
497
497
  }
498
498
  }
499
- function ot({ entry: t, className: n }) {
500
- const r = q(), s = ["mast-tool-call-block", n].filter(Boolean).join(" "), a = t.subThinking !== void 0 || t.subText !== void 0, i = t.nestedToolEvents ?? [], l = Lt(t, r), o = et(t.args), u = et(t.result);
501
- return /* @__PURE__ */ k(
502
- "div",
499
+ function Bt(t, n) {
500
+ return t === "streaming" ? n ? !0 : void 0 : t;
501
+ }
502
+ function ot({ entry: t, className: n, defaultOpen: r = "streaming" }) {
503
+ const s = q(), a = ["mast-tool-call-block", n].filter(Boolean).join(" "), i = t.subThinking !== void 0 || t.subText !== void 0, l = t.nestedToolEvents ?? [], c = Lt(t, s), u = et(t.args), m = et(t.result), k = Bt(r, t.isStreaming);
504
+ return /* @__PURE__ */ v(
505
+ "details",
503
506
  {
504
507
  "data-mast-tool-call-block": !0,
505
508
  "data-streaming": t.isStreaming ? "true" : void 0,
506
509
  "data-status": t.status,
507
510
  "data-tool-name": t.name,
508
- className: s,
511
+ className: a,
512
+ open: k,
509
513
  children: [
510
- /* @__PURE__ */ k("div", { className: "mast-tool-call-block-header", children: [
514
+ /* @__PURE__ */ v("summary", { className: "mast-tool-call-block-header", children: [
515
+ /* @__PURE__ */ e("span", { className: "mast-tool-call-block-chevron", "aria-hidden": "true", children: "▸" }),
511
516
  /* @__PURE__ */ e(
512
517
  "span",
513
518
  {
514
519
  className: "mast-tool-call-block-status",
515
520
  "data-testid": "mast-tool-call-status",
516
521
  "aria-hidden": "true",
517
- children: l
522
+ children: c
518
523
  }
519
524
  ),
520
- /* @__PURE__ */ e("span", { className: "mast-tool-call-block-wrench", "aria-hidden": "true", children: r.wrench }),
525
+ /* @__PURE__ */ e("span", { className: "mast-tool-call-block-wrench", "aria-hidden": "true", children: s.wrench }),
521
526
  /* @__PURE__ */ e("span", { className: "mast-tool-call-block-name", children: t.name })
522
527
  ] }),
523
- a ? /* @__PURE__ */ k("div", { className: "mast-tool-call-block-sub-output", children: [
524
- t.subThinking !== void 0 ? /* @__PURE__ */ e(
525
- lt,
526
- {
527
- content: t.subThinking,
528
- isStreaming: t.isStreaming,
529
- className: "mast-tool-call-block-sub-thinking",
530
- open: t.isStreaming ? !0 : void 0
531
- }
532
- ) : null,
533
- t.subText !== void 0 ? /* @__PURE__ */ e("div", { className: "mast-tool-call-block-sub-text", "data-testid": "mast-tool-call-sub-text", children: t.subText }) : null
534
- ] }) : null,
535
- i.length > 0 ? /* @__PURE__ */ e("div", { className: "mast-tool-call-block-nested", "data-testid": "mast-tool-call-nested", children: i.map((m) => /* @__PURE__ */ e(ot, { entry: m }, m.id)) }) : null,
536
- o ? /* @__PURE__ */ k("details", { className: "mast-tool-call-block-args", children: [
537
- /* @__PURE__ */ e("summary", { children: "Arguments" }),
538
- /* @__PURE__ */ e("pre", { className: "mast-tool-call-block-pre", children: /* @__PURE__ */ e("code", { children: o }) })
539
- ] }) : null,
540
- !t.isStreaming && u ? /* @__PURE__ */ k("details", { className: "mast-tool-call-block-result", children: [
541
- /* @__PURE__ */ e("summary", { children: "Result" }),
542
- /* @__PURE__ */ e("pre", { className: "mast-tool-call-block-pre", children: /* @__PURE__ */ e("code", { children: u }) })
543
- ] }) : null
528
+ /* @__PURE__ */ v("div", { className: "mast-tool-call-block-body", children: [
529
+ i ? /* @__PURE__ */ v("div", { className: "mast-tool-call-block-sub-output", children: [
530
+ t.subThinking !== void 0 ? /* @__PURE__ */ e(
531
+ lt,
532
+ {
533
+ content: t.subThinking,
534
+ isStreaming: t.isStreaming,
535
+ className: "mast-tool-call-block-sub-thinking",
536
+ open: t.isStreaming ? !0 : void 0
537
+ }
538
+ ) : null,
539
+ t.subText !== void 0 ? /* @__PURE__ */ e("div", { className: "mast-tool-call-block-sub-text", "data-testid": "mast-tool-call-sub-text", children: t.subText }) : null
540
+ ] }) : null,
541
+ l.length > 0 ? /* @__PURE__ */ e("div", { className: "mast-tool-call-block-nested", "data-testid": "mast-tool-call-nested", children: l.map((g) => /* @__PURE__ */ e(ot, { entry: g }, g.id)) }) : null,
542
+ u ? /* @__PURE__ */ v("details", { className: "mast-tool-call-block-args", children: [
543
+ /* @__PURE__ */ e("summary", { children: "Arguments" }),
544
+ /* @__PURE__ */ e("pre", { className: "mast-tool-call-block-pre", children: /* @__PURE__ */ e("code", { children: u }) })
545
+ ] }) : null,
546
+ !t.isStreaming && m ? /* @__PURE__ */ v("details", { className: "mast-tool-call-block-result", children: [
547
+ /* @__PURE__ */ e("summary", { children: "Result" }),
548
+ /* @__PURE__ */ e("pre", { className: "mast-tool-call-block-pre", children: /* @__PURE__ */ e("code", { children: m }) })
549
+ ] }) : null
550
+ ] })
544
551
  ]
545
552
  }
546
553
  );
547
554
  }
548
- function Bt({ entry: t, className: n }) {
555
+ function Ut({ entry: t, className: n }) {
549
556
  const r = ["mast-user-message", n].filter(Boolean).join(" ");
550
557
  return /* @__PURE__ */ e("div", { "data-mast-user-message": !0, className: r, children: /* @__PURE__ */ e("div", { className: "mast-user-message-bubble", children: t.text }) });
551
558
  }
552
- const Ut = pt(async () => {
559
+ const Kt = pt(async () => {
553
560
  try {
554
561
  const [{ default: t }, { default: n }, { default: r }] = await Promise.all([
555
562
  import("react-markdown"),
@@ -565,25 +572,25 @@ const Ut = pt(async () => {
565
572
  };
566
573
  }
567
574
  });
568
- function Kt({
575
+ function Vt({
569
576
  entry: t,
570
577
  className: n,
571
578
  renderMessage: r,
572
579
  renderToolCall: s
573
580
  }) {
574
- const a = ["mast-assistant-message", n].filter(Boolean).join(" "), { pendingApprovals: i } = G(), l = (o) => {
575
- const u = o.awaitingApproval ? i.find((m) => m.toolName === o.name) : void 0;
576
- return s ? s(o, u) : u ? /* @__PURE__ */ e(
581
+ const a = ["mast-assistant-message", n].filter(Boolean).join(" "), { pendingApprovals: i } = G(), l = (c) => {
582
+ const u = c.awaitingApproval ? i.find((m) => m.toolName === c.name) : void 0;
583
+ return s ? s(c, u) : u ? /* @__PURE__ */ e(
577
584
  jt,
578
585
  {
579
- entry: o,
586
+ entry: c,
580
587
  approve: u.approve,
581
588
  reject: u.reject,
582
589
  respondWith: u.respondWith
583
590
  }
584
- ) : /* @__PURE__ */ e(ot, { entry: o });
591
+ ) : /* @__PURE__ */ e(ot, { entry: c });
585
592
  };
586
- return /* @__PURE__ */ k(
593
+ return /* @__PURE__ */ v(
587
594
  "div",
588
595
  {
589
596
  "data-mast-assistant-message": !0,
@@ -591,13 +598,13 @@ function Kt({
591
598
  className: a,
592
599
  children: [
593
600
  t.thinking ? /* @__PURE__ */ e(lt, { content: t.thinking, isStreaming: t.isStreaming }) : null,
594
- t.toolEvents.map((o, u) => /* @__PURE__ */ e(rt, { children: l(o) }, `${o.id}-${u}`)),
595
- t.text ? r ? r(t.text) : /* @__PURE__ */ e(ft, { fallback: /* @__PURE__ */ e("p", { className: "mast-assistant-message-text", children: t.text }), children: /* @__PURE__ */ e(Ut, { children: t.text }) }) : null
601
+ t.toolEvents.map((c, u) => /* @__PURE__ */ e(rt, { children: l(c) }, `${c.id}-${u}`)),
602
+ t.text ? r ? r(t.text) : /* @__PURE__ */ e(ft, { fallback: /* @__PURE__ */ e("p", { className: "mast-assistant-message-text", children: t.text }), children: /* @__PURE__ */ e(Kt, { children: t.text }) }) : null
596
603
  ]
597
604
  }
598
605
  );
599
606
  }
600
- function Vt({
607
+ function Wt({
601
608
  items: t,
602
609
  activeIndex: n,
603
610
  onSelect: r,
@@ -612,18 +619,18 @@ function Vt({
612
619
  role: "listbox",
613
620
  "aria-label": "Mention picker",
614
621
  children: t.map((i, l) => {
615
- const o = l === n, u = o ? "mast-mention-picker-item mast-mention-picker-active" : "mast-mention-picker-item";
622
+ const c = l === n, u = c ? "mast-mention-picker-item mast-mention-picker-active" : "mast-mention-picker-item";
616
623
  return /* @__PURE__ */ e(
617
624
  "li",
618
625
  {
619
626
  id: `${s}-${l}`,
620
627
  role: "option",
621
- "aria-selected": o,
628
+ "aria-selected": c,
622
629
  className: u,
623
630
  onMouseDown: (m) => {
624
631
  m.preventDefault(), r(i);
625
632
  },
626
- children: a ? a(i, o) : /* @__PURE__ */ k("div", { children: [
633
+ children: a ? a(i, c) : /* @__PURE__ */ v("div", { children: [
627
634
  /* @__PURE__ */ e("div", { className: "mast-mention-picker-item-label", children: i.label }),
628
635
  i.description && /* @__PURE__ */ e("div", { className: "mast-mention-picker-item-description", children: i.description })
629
636
  ] })
@@ -638,63 +645,63 @@ const Z = "@";
638
645
  function ct(t) {
639
646
  return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
640
647
  }
641
- function Wt(t, n = Z) {
648
+ function zt(t, n = Z) {
642
649
  const r = ct(n), s = new RegExp(`${r}([^\\s${r}]*)$`), a = t.match(s);
643
650
  return a ? a[1] : null;
644
651
  }
645
- function zt(t, n = Z) {
652
+ function Ft(t, n = Z) {
646
653
  const r = ct(n), s = new RegExp(`${r}[^\\s${r}]*$`);
647
654
  return t.replace(s, "");
648
655
  }
649
- function Ft(t, n) {
656
+ function Ot(t, n) {
650
657
  return t.map((r) => `${r.text}${Z}${r.item.label}`).join("") + n;
651
658
  }
652
- function Ot(t) {
653
- const n = t.trigger ?? "@", [r, s] = R([]), [a, i] = R(""), [l, o] = R(null), [u, m] = R(0), [y, v] = R([]), T = C(r);
659
+ function Ht(t) {
660
+ const n = t.trigger ?? "@", [r, s] = R([]), [a, i] = R(""), [l, c] = R(null), [u, m] = R(0), [k, g] = R([]), T = C(r);
654
661
  T.current = r;
655
662
  const M = C(a);
656
663
  M.current = a;
657
664
  const P = C(0);
658
665
  Q(() => {
659
666
  if (l === null) {
660
- v([]);
667
+ g([]);
661
668
  return;
662
669
  }
663
670
  const h = ++P.current;
664
671
  if (t.onSearch) {
665
672
  const p = t.onSearch(l);
666
- p instanceof Promise ? p.then((b) => {
667
- h === P.current && v(b);
668
- }) : v(p);
673
+ p instanceof Promise ? p.then((x) => {
674
+ h === P.current && g(x);
675
+ }) : g(p);
669
676
  }
670
677
  }, [l, t.onSearch]);
671
678
  const S = new Set(r.map((h) => h.item.id)), w = (() => {
672
679
  if (l === null) return [];
673
680
  if (t.onSearch)
674
- return y.filter((p) => !S.has(p.id));
681
+ return k.filter((p) => !S.has(p.id));
675
682
  const h = l.toLowerCase();
676
683
  return (t.items ?? []).filter(
677
684
  (p) => !S.has(p.id) && p.label.toLowerCase().includes(h)
678
685
  );
679
686
  })(), B = _(
680
687
  (h) => {
681
- i(h), o(Wt(h, n)), m(0);
688
+ i(h), c(zt(h, n)), m(0);
682
689
  },
683
690
  [n]
684
- ), g = _(
691
+ ), b = _(
685
692
  (h) => {
686
693
  const p = T.current;
687
694
  if (p.some((d) => d.item.id === h.id)) return;
688
- const b = zt(M.current, n);
689
- s([...p, { text: b, item: h }]), i(""), o(null), m(0);
695
+ const x = Ft(M.current, n);
696
+ s([...p, { text: x, item: h }]), i(""), c(null), m(0);
690
697
  },
691
698
  [n]
692
699
  ), A = _((h) => {
693
- const p = T.current, b = p.findIndex((c) => c.item.id === h);
694
- if (b === -1) return;
695
- const d = p[b].text, f = [...p.slice(0, b), ...p.slice(b + 1)];
696
- if (b < f.length) {
697
- f[b] = { ...f[b], text: d + f[b].text }, s(f);
700
+ const p = T.current, x = p.findIndex((o) => o.item.id === h);
701
+ if (x === -1) return;
702
+ const d = p[x].text, f = [...p.slice(0, x), ...p.slice(x + 1)];
703
+ if (x < f.length) {
704
+ f[x] = { ...f[x], text: d + f[x].text }, s(f);
698
705
  return;
699
706
  }
700
707
  s(f), i(d + M.current);
@@ -707,19 +714,19 @@ function Ot(t) {
707
714
  case "ArrowUp":
708
715
  return h.preventDefault(), m((p) => p === 0 ? w.length - 1 : p - 1), !0;
709
716
  case "Enter":
710
- return h.preventDefault(), g(w[u] ?? w[0]), !0;
717
+ return h.preventDefault(), b(w[u] ?? w[0]), !0;
711
718
  case "Escape":
712
- return h.preventDefault(), o(null), !0;
719
+ return h.preventDefault(), c(null), !0;
713
720
  default:
714
721
  return !1;
715
722
  }
716
723
  },
717
- [l, w, u, g]
724
+ [l, w, u, b]
718
725
  ), E = _(() => {
719
- const h = Ft(r, a);
726
+ const h = Ot(r, a);
720
727
  return { prompt: t.buildPrompt ? t.buildPrompt(r, a) : h, displayText: h };
721
728
  }, [r, a, t.buildPrompt]), I = _(() => {
722
- s([]), i(""), o(null), m(0);
729
+ s([]), i(""), c(null), m(0);
723
730
  }, []);
724
731
  return {
725
732
  segments: r,
@@ -729,19 +736,19 @@ function Ot(t) {
729
736
  pickerIndex: u,
730
737
  setTrailingInput: B,
731
738
  handleKeyDown: N,
732
- selectItem: g,
739
+ selectItem: b,
733
740
  removeChip: A,
734
741
  buildSubmission: E,
735
742
  clear: I
736
743
  };
737
744
  }
738
- const Ht = 1, qt = 8;
745
+ const qt = 1, Gt = 8;
739
746
  function ut(t) {
740
747
  const n = t.split(`
741
748
  `).length;
742
- return Math.min(qt, Math.max(Ht, n));
749
+ return Math.min(Gt, Math.max(qt, n));
743
750
  }
744
- function Gt({
751
+ function Jt({
745
752
  className: t,
746
753
  placeholder: n = "Type a message and press Enter.",
747
754
  sendLabel: r,
@@ -749,7 +756,7 @@ function Gt({
749
756
  mentions: a
750
757
  }) {
751
758
  return a ? /* @__PURE__ */ e(
752
- Qt,
759
+ Zt,
753
760
  {
754
761
  className: t,
755
762
  placeholder: n,
@@ -758,7 +765,7 @@ function Gt({
758
765
  mentions: a
759
766
  }
760
767
  ) : /* @__PURE__ */ e(
761
- Jt,
768
+ Qt,
762
769
  {
763
770
  className: t,
764
771
  placeholder: n,
@@ -767,17 +774,17 @@ function Gt({
767
774
  }
768
775
  );
769
776
  }
770
- function Jt({ className: t, placeholder: n, sendLabel: r, cancelLabel: s }) {
771
- const { sendMessage: a, cancel: i, isRunning: l } = G(), o = q(), [u, m] = R(""), y = ["mast-chat-input", t].filter(Boolean).join(" "), v = u.trim(), T = !l && v.length > 0, M = () => {
772
- T && (a(v), m(""));
777
+ function Qt({ className: t, placeholder: n, sendLabel: r, cancelLabel: s }) {
778
+ const { sendMessage: a, cancel: i, isRunning: l } = G(), c = q(), [u, m] = R(""), k = ["mast-chat-input", t].filter(Boolean).join(" "), g = u.trim(), T = !l && g.length > 0, M = () => {
779
+ T && (a(g), m(""));
773
780
  }, P = (S) => {
774
781
  S.key === "Enter" && !S.shiftKey && (S.preventDefault(), M());
775
782
  };
776
- return /* @__PURE__ */ k(
783
+ return /* @__PURE__ */ v(
777
784
  "form",
778
785
  {
779
786
  "data-mast-chat-input": !0,
780
- className: y,
787
+ className: k,
781
788
  onSubmit: (S) => {
782
789
  S.preventDefault(), M();
783
790
  },
@@ -803,7 +810,7 @@ function Jt({ className: t, placeholder: n, sendLabel: r, cancelLabel: s }) {
803
810
  className: "mast-chat-input-cancel",
804
811
  "aria-label": "Cancel",
805
812
  onClick: i,
806
- children: s ?? o.stop
813
+ children: s ?? c.stop
807
814
  }
808
815
  ) : /* @__PURE__ */ e(
809
816
  "button",
@@ -812,52 +819,52 @@ function Jt({ className: t, placeholder: n, sendLabel: r, cancelLabel: s }) {
812
819
  className: "mast-chat-input-send",
813
820
  "aria-label": "Send",
814
821
  disabled: !T,
815
- children: r ?? o.send
822
+ children: r ?? c.send
816
823
  }
817
824
  )
818
825
  ]
819
826
  }
820
827
  );
821
828
  }
822
- function Qt({
829
+ function Zt({
823
830
  className: t,
824
831
  placeholder: n,
825
832
  sendLabel: r,
826
833
  cancelLabel: s,
827
834
  mentions: a
828
835
  }) {
829
- const { sendMessage: i, cancel: l, isRunning: o } = G(), u = q(), m = gt(), {
830
- segments: y,
831
- trailingInput: v,
836
+ const { sendMessage: i, cancel: l, isRunning: c } = G(), u = q(), m = gt(), {
837
+ segments: k,
838
+ trailingInput: g,
832
839
  mentionQuery: T,
833
840
  filteredItems: M,
834
841
  pickerIndex: P,
835
842
  setTrailingInput: S,
836
843
  handleKeyDown: w,
837
844
  selectItem: B,
838
- removeChip: g,
845
+ removeChip: b,
839
846
  buildSubmission: A,
840
847
  clear: N
841
- } = Ot(a), E = ["mast-chat-input", "mast-mention-input", t].filter(Boolean).join(" "), I = y.length > 0 || v.trim().length > 0, h = !o && I, p = T !== null && M.length > 0, b = p ? `${m}-${P}` : void 0, d = () => {
848
+ } = Ht(a), E = ["mast-chat-input", "mast-mention-input", t].filter(Boolean).join(" "), I = k.length > 0 || g.trim().length > 0, h = !c && I, p = T !== null && M.length > 0, x = p ? `${m}-${P}` : void 0, d = () => {
842
849
  if (!h) return;
843
- const { prompt: c, displayText: x } = A();
844
- x.trim() && (i(c, x), N());
845
- }, f = (c) => {
846
- w(c) || c.key === "Enter" && !c.shiftKey && (c.preventDefault(), d());
850
+ const { prompt: o, displayText: y } = A();
851
+ y.trim() && (i(o, y), N());
852
+ }, f = (o) => {
853
+ w(o) || o.key === "Enter" && !o.shiftKey && (o.preventDefault(), d());
847
854
  };
848
- return /* @__PURE__ */ k(
855
+ return /* @__PURE__ */ v(
849
856
  "form",
850
857
  {
851
858
  "data-mast-chat-input": !0,
852
859
  className: E,
853
- onSubmit: (c) => {
854
- c.preventDefault(), d();
860
+ onSubmit: (o) => {
861
+ o.preventDefault(), d();
855
862
  },
856
863
  children: [
857
864
  /* @__PURE__ */ e("label", { className: "mast-chat-input-label mast-visually-hidden", htmlFor: "mast-chat-input-field", children: "Message" }),
858
- /* @__PURE__ */ k("div", { className: "mast-mention-input-field", children: [
865
+ /* @__PURE__ */ v("div", { className: "mast-mention-input-field", children: [
859
866
  p && /* @__PURE__ */ e(
860
- Vt,
867
+ Wt,
861
868
  {
862
869
  items: M,
863
870
  activeIndex: P,
@@ -866,45 +873,45 @@ function Qt({
866
873
  renderItem: a.renderItem
867
874
  }
868
875
  ),
869
- /* @__PURE__ */ k("div", { className: "mast-mention-input-content", children: [
870
- y.map((c) => /* @__PURE__ */ k(rt, { children: [
871
- c.text && /* @__PURE__ */ e("span", { className: "mast-mention-segment-text", children: c.text }),
872
- a.renderChip ? a.renderChip(c.item, () => g(c.item.id)) : /* @__PURE__ */ k("span", { className: "mast-mention-chip", children: [
876
+ /* @__PURE__ */ v("div", { className: "mast-mention-input-content", children: [
877
+ k.map((o) => /* @__PURE__ */ v(rt, { children: [
878
+ o.text && /* @__PURE__ */ e("span", { className: "mast-mention-segment-text", children: o.text }),
879
+ a.renderChip ? a.renderChip(o.item, () => b(o.item.id)) : /* @__PURE__ */ v("span", { className: "mast-mention-chip", children: [
873
880
  "@",
874
- c.item.label,
881
+ o.item.label,
875
882
  /* @__PURE__ */ e(
876
883
  "button",
877
884
  {
878
885
  type: "button",
879
886
  className: "mast-mention-chip-remove",
880
- "aria-label": `Remove reference to ${c.item.label}`,
881
- onClick: () => g(c.item.id),
887
+ "aria-label": `Remove reference to ${o.item.label}`,
888
+ onClick: () => b(o.item.id),
882
889
  children: "×"
883
890
  }
884
891
  )
885
892
  ] })
886
- ] }, c.item.id)),
893
+ ] }, o.item.id)),
887
894
  /* @__PURE__ */ e(
888
895
  "textarea",
889
896
  {
890
897
  id: "mast-chat-input-field",
891
898
  className: "mast-chat-input-textarea mast-mention-input-textarea",
892
- value: v,
893
- placeholder: y.length === 0 ? n : "",
894
- rows: ut(v),
895
- disabled: o,
896
- onChange: (c) => S(c.target.value),
899
+ value: g,
900
+ placeholder: k.length === 0 ? n : "",
901
+ rows: ut(g),
902
+ disabled: c,
903
+ onChange: (o) => S(o.target.value),
897
904
  onKeyDown: f,
898
905
  role: "combobox",
899
906
  "aria-expanded": p,
900
907
  "aria-controls": p ? `${m}-listbox` : void 0,
901
908
  "aria-autocomplete": "list",
902
- "aria-activedescendant": b
909
+ "aria-activedescendant": x
903
910
  }
904
911
  )
905
912
  ] })
906
913
  ] }),
907
- o ? /* @__PURE__ */ e(
914
+ c ? /* @__PURE__ */ e(
908
915
  "button",
909
916
  {
910
917
  type: "button",
@@ -927,9 +934,9 @@ function Qt({
927
934
  }
928
935
  );
929
936
  }
930
- function Zt({ entry: t, className: n, renderToolCall: r, renderMessage: s }) {
931
- return t.role === "user" ? /* @__PURE__ */ e(Bt, { entry: t, className: n }) : /* @__PURE__ */ e(
932
- Kt,
937
+ function Xt({ entry: t, className: n, renderToolCall: r, renderMessage: s }) {
938
+ return t.role === "user" ? /* @__PURE__ */ e(Ut, { entry: t, className: n }) : /* @__PURE__ */ e(
939
+ Vt,
933
940
  {
934
941
  entry: t,
935
942
  className: n,
@@ -938,34 +945,34 @@ function Zt({ entry: t, className: n, renderToolCall: r, renderMessage: s }) {
938
945
  }
939
946
  );
940
947
  }
941
- const Xt = 80;
942
- function Yt({ className: t, renderToolCall: n, renderMessage: r }) {
943
- const { messages: s } = G(), a = C(null), i = bt({
948
+ const Yt = 80;
949
+ function te({ className: t, renderToolCall: n, renderMessage: r }) {
950
+ const { messages: s } = G(), a = C(null), i = vt({
944
951
  count: s.length,
945
952
  getScrollElement: () => a.current,
946
- estimateSize: () => Xt,
953
+ estimateSize: () => Yt,
947
954
  overscan: 4
948
- }), l = s.length > 0 ? s[s.length - 1] : void 0, o = (l == null ? void 0 : l.text.length) ?? 0;
955
+ }), l = s.length > 0 ? s[s.length - 1] : void 0, c = (l == null ? void 0 : l.text.length) ?? 0;
949
956
  Q(() => {
950
957
  s.length !== 0 && i.scrollToIndex(s.length - 1, { align: "end" });
951
- }, [s.length, o, i]);
952
- const u = i.getTotalSize(), m = i.getVirtualItems(), y = ["mast-message-list", t].filter(Boolean).join(" ");
953
- return /* @__PURE__ */ e("div", { ref: a, "data-mast-message-list": !0, className: y, role: "log", "aria-live": "polite", children: /* @__PURE__ */ e("div", { style: { height: `${u}px`, position: "relative", width: "100%" }, children: m.map((v) => {
954
- const T = s[v.index];
958
+ }, [s.length, c, i]);
959
+ const u = i.getTotalSize(), m = i.getVirtualItems(), k = ["mast-message-list", t].filter(Boolean).join(" ");
960
+ return /* @__PURE__ */ e("div", { ref: a, "data-mast-message-list": !0, className: k, role: "log", "aria-live": "polite", children: /* @__PURE__ */ e("div", { style: { height: `${u}px`, position: "relative", width: "100%" }, children: m.map((g) => {
961
+ const T = s[g.index];
955
962
  return /* @__PURE__ */ e(
956
963
  "div",
957
964
  {
958
- "data-index": v.index,
965
+ "data-index": g.index,
959
966
  ref: i.measureElement,
960
967
  style: {
961
968
  position: "absolute",
962
969
  top: 0,
963
970
  left: 0,
964
971
  width: "100%",
965
- transform: `translateY(${v.start}px)`
972
+ transform: `translateY(${g.start}px)`
966
973
  },
967
974
  children: /* @__PURE__ */ e(
968
- Zt,
975
+ Xt,
969
976
  {
970
977
  entry: T,
971
978
  renderToolCall: n,
@@ -977,7 +984,7 @@ function Yt({ className: t, renderToolCall: n, renderMessage: r }) {
977
984
  );
978
985
  }) }) });
979
986
  }
980
- function ae({
987
+ function ie({
981
988
  theme: t,
982
989
  className: n,
983
990
  renderToolCall: r,
@@ -986,27 +993,27 @@ function ae({
986
993
  mentions: i
987
994
  }) {
988
995
  const l = ["mast-conversation-panel", n].filter(Boolean).join(" ");
989
- return /* @__PURE__ */ k("div", { "data-mast-root": !0, "data-mast-theme": t, className: l, children: [
990
- /* @__PURE__ */ e(Yt, { renderToolCall: r, renderMessage: s }),
991
- /* @__PURE__ */ e(Gt, { placeholder: a, mentions: i })
996
+ return /* @__PURE__ */ v("div", { "data-mast-root": !0, "data-mast-theme": t, className: l, children: [
997
+ /* @__PURE__ */ e(te, { renderToolCall: r, renderMessage: s }),
998
+ /* @__PURE__ */ e(Jt, { placeholder: a, mentions: i })
992
999
  ] });
993
1000
  }
994
1001
  export {
995
- re as AgentProvider,
996
- Kt as AssistantMessage,
997
- Gt as ChatInput,
998
- ae as ConversationPanel,
1002
+ ae as AgentProvider,
1003
+ Vt as AssistantMessage,
1004
+ Jt as ChatInput,
1005
+ ie as ConversationPanel,
999
1006
  Mt as INLINE_APPROVAL,
1000
1007
  jt as InlineApproval,
1001
- Zt as MessageItem,
1002
- Yt as MessageList,
1008
+ Xt as MessageItem,
1009
+ te as MessageList,
1003
1010
  lt as ThinkingBlock,
1004
1011
  ot as ToolCallBlock,
1005
- Bt as UserMessage,
1006
- Ft as buildInlineMentionPrompt,
1007
- Wt as extractMentionQuery,
1008
- zt as removeMentionTrigger,
1012
+ Ut as UserMessage,
1013
+ Ot as buildInlineMentionPrompt,
1014
+ zt as extractMentionQuery,
1015
+ Ft as removeMentionTrigger,
1009
1016
  G as useAgent,
1010
1017
  xt as useAgentStream,
1011
- Ot as useMentions
1018
+ Ht as useMentions
1012
1019
  };
package/dist/styles.css CHANGED
@@ -300,9 +300,6 @@
300
300
  border-radius: var(--mast-radius);
301
301
  padding: 0.5rem 0.75rem;
302
302
  font-size: var(--mast-text-sm);
303
- display: flex;
304
- flex-direction: column;
305
- gap: 0.5rem;
306
303
  }
307
304
 
308
305
  .mast-tool-call-block[data-streaming='true'] .mast-tool-call-block-status {
@@ -331,6 +328,31 @@
331
328
  display: flex;
332
329
  align-items: center;
333
330
  gap: 0.5rem;
331
+ cursor: pointer;
332
+ list-style: none;
333
+ user-select: none;
334
+ }
335
+
336
+ .mast-tool-call-block-header::-webkit-details-marker {
337
+ display: none;
338
+ }
339
+
340
+ .mast-tool-call-block-chevron {
341
+ display: inline-block;
342
+ width: 0.75rem;
343
+ color: var(--mast-fg-muted);
344
+ transition: transform 0.15s ease;
345
+ }
346
+
347
+ .mast-tool-call-block[open] > .mast-tool-call-block-header > .mast-tool-call-block-chevron {
348
+ transform: rotate(90deg);
349
+ }
350
+
351
+ .mast-tool-call-block-body {
352
+ display: flex;
353
+ flex-direction: column;
354
+ gap: 0.5rem;
355
+ margin-top: 0.5rem;
334
356
  }
335
357
 
336
358
  .mast-tool-call-block-status,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mast-ai/react-ui",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "format": "prettier --write src"
35
35
  },
36
36
  "peerDependencies": {
37
- "@mast-ai/core": "^0.1.1",
37
+ "@mast-ai/core": "^0.1.2",
38
38
  "@tanstack/react-virtual": ">=3.0.0",
39
39
  "react": ">=19.0.0",
40
40
  "react-dom": ">=19.0.0"