@lumerahq/ui 0.20.0 → 0.20.1-dev.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.
@@ -1,9 +1,9 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import React__default, { useContext, createContext, forwardRef, createElement, memo, useId as useId$1, useTransition, useMemo, useRef, useEffect, useState, isValidElement, cloneElement, useCallback, Suspense, lazy, useLayoutEffect, Fragment as Fragment$1 } from "react";
3
+ import React__default, { useContext, createContext, forwardRef, createElement, memo, useId as useId$1, useTransition, useMemo, useRef, useEffect, useState, isValidElement, cloneElement, useCallback, Suspense, lazy, useLayoutEffect } from "react";
4
4
  import { t as twMerge, p as clsx, c as cn$2, a as formatCellValue$2 } from "./formatters-BuHr2I8Z.js";
5
- import { u as useAgentChat, b as useAgentChatSessions, a as areAgentChatMutationsBlocked, c as useAutomationRun } from "./use-automation-run-BaW82zqJ.js";
6
5
  import { T as pbSql, o as getDownloadUrl, K as parentApiRequest, L as parentApiStream, B as BridgeError, k as getAppProjectExternalId, a3 as resolveProjectResourceId, a as automationStatuses, n as getAutomationRunFileDownloadUrl, D as listAutomationRunFiles } from "./automations-DD15itWa.js";
6
+ import { u as useAgentChat, b as useAgentChatSessions, a as areAgentChatMutationsBlocked, c as useAutomationRun } from "./use-automation-run-BaW82zqJ.js";
7
7
  import * as ReactDOM from "react-dom";
8
8
  import { createPortal } from "react-dom";
9
9
  const mergeClasses = (...classes) => classes.filter((className, index2, array) => {
@@ -85,24 +85,24 @@ const createLucideIcon = (iconName, iconNode) => {
85
85
  Component.displayName = toPascalCase(iconName);
86
86
  return Component;
87
87
  };
88
- const __iconNode$J = [
88
+ const __iconNode$D = [
89
89
  ["path", { d: "M12 5v14", key: "s699le" }],
90
90
  ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
91
91
  ];
92
- const ArrowDown = createLucideIcon("arrow-down", __iconNode$J);
93
- const __iconNode$I = [
92
+ const ArrowDown = createLucideIcon("arrow-down", __iconNode$D);
93
+ const __iconNode$C = [
94
94
  ["path", { d: "m21 16-4 4-4-4", key: "f6ql7i" }],
95
95
  ["path", { d: "M17 20V4", key: "1ejh1v" }],
96
96
  ["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
97
97
  ["path", { d: "M7 4v16", key: "1glfcx" }]
98
98
  ];
99
- const ArrowUpDown = createLucideIcon("arrow-up-down", __iconNode$I);
100
- const __iconNode$H = [
99
+ const ArrowUpDown = createLucideIcon("arrow-up-down", __iconNode$C);
100
+ const __iconNode$B = [
101
101
  ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
102
102
  ["path", { d: "M12 19V5", key: "x0mq9r" }]
103
103
  ];
104
- const ArrowUp = createLucideIcon("arrow-up", __iconNode$H);
105
- const __iconNode$G = [
104
+ const ArrowUp = createLucideIcon("arrow-up", __iconNode$B);
105
+ const __iconNode$A = [
106
106
  ["path", { d: "M12 8V4H8", key: "hb8ula" }],
107
107
  ["rect", { width: "16", height: "12", x: "4", y: "8", rx: "2", key: "enze0r" }],
108
108
  ["path", { d: "M2 14h2", key: "vft8re" }],
@@ -110,8 +110,8 @@ const __iconNode$G = [
110
110
  ["path", { d: "M15 13v2", key: "1xurst" }],
111
111
  ["path", { d: "M9 13v2", key: "rq6x2g" }]
112
112
  ];
113
- const Bot = createLucideIcon("bot", __iconNode$G);
114
- const __iconNode$F = [
113
+ const Bot = createLucideIcon("bot", __iconNode$A);
114
+ const __iconNode$z = [
115
115
  ["path", { d: "M12 18V5", key: "adv99a" }],
116
116
  ["path", { d: "M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4", key: "1e3is1" }],
117
117
  ["path", { d: "M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5", key: "1gqd8o" }],
@@ -121,72 +121,67 @@ const __iconNode$F = [
121
121
  ["path", { d: "M6 18a4 4 0 0 1-2-7.464", key: "k1g0md" }],
122
122
  ["path", { d: "M6.003 5.125a4 4 0 0 0-2.526 5.77", key: "q97ue3" }]
123
123
  ];
124
- const Brain = createLucideIcon("brain", __iconNode$F);
125
- const __iconNode$E = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
126
- const Check = createLucideIcon("check", __iconNode$E);
127
- const __iconNode$D = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
128
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$D);
129
- const __iconNode$C = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
130
- const ChevronLeft = createLucideIcon("chevron-left", __iconNode$C);
131
- const __iconNode$B = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
132
- const ChevronRight = createLucideIcon("chevron-right", __iconNode$B);
133
- const __iconNode$A = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
134
- const ChevronUp = createLucideIcon("chevron-up", __iconNode$A);
135
- const __iconNode$z = [
124
+ const Brain = createLucideIcon("brain", __iconNode$z);
125
+ const __iconNode$y = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
126
+ const Check = createLucideIcon("check", __iconNode$y);
127
+ const __iconNode$x = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
128
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$x);
129
+ const __iconNode$w = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
130
+ const ChevronLeft = createLucideIcon("chevron-left", __iconNode$w);
131
+ const __iconNode$v = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
132
+ const ChevronRight = createLucideIcon("chevron-right", __iconNode$v);
133
+ const __iconNode$u = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
134
+ const ChevronUp = createLucideIcon("chevron-up", __iconNode$u);
135
+ const __iconNode$t = [
136
136
  ["path", { d: "m11 17-5-5 5-5", key: "13zhaf" }],
137
137
  ["path", { d: "m18 17-5-5 5-5", key: "h8a8et" }]
138
138
  ];
139
- const ChevronsLeft = createLucideIcon("chevrons-left", __iconNode$z);
140
- const __iconNode$y = [
139
+ const ChevronsLeft = createLucideIcon("chevrons-left", __iconNode$t);
140
+ const __iconNode$s = [
141
141
  ["path", { d: "m6 17 5-5-5-5", key: "xnjwq" }],
142
142
  ["path", { d: "m13 17 5-5-5-5", key: "17xmmf" }]
143
143
  ];
144
- const ChevronsRight = createLucideIcon("chevrons-right", __iconNode$y);
145
- const __iconNode$x = [
144
+ const ChevronsRight = createLucideIcon("chevrons-right", __iconNode$s);
145
+ const __iconNode$r = [
146
146
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
147
147
  ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
148
148
  ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
149
149
  ];
150
- const CircleAlert = createLucideIcon("circle-alert", __iconNode$x);
151
- const __iconNode$w = [
150
+ const CircleAlert = createLucideIcon("circle-alert", __iconNode$r);
151
+ const __iconNode$q = [
152
152
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
153
153
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
154
154
  ];
155
- const CircleCheck = createLucideIcon("circle-check", __iconNode$w);
156
- const __iconNode$v = [
155
+ const CircleCheck = createLucideIcon("circle-check", __iconNode$q);
156
+ const __iconNode$p = [
157
157
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
158
158
  ["rect", { x: "9", y: "9", width: "6", height: "6", rx: "1", key: "1ssd4o" }]
159
159
  ];
160
- const CircleStop = createLucideIcon("circle-stop", __iconNode$v);
161
- const __iconNode$u = [
160
+ const CircleStop = createLucideIcon("circle-stop", __iconNode$p);
161
+ const __iconNode$o = [
162
162
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
163
163
  ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
164
164
  ["path", { d: "m9 9 6 6", key: "z0biqf" }]
165
165
  ];
166
- const CircleX = createLucideIcon("circle-x", __iconNode$u);
167
- const __iconNode$t = [
166
+ const CircleX = createLucideIcon("circle-x", __iconNode$o);
167
+ const __iconNode$n = [
168
168
  ["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
169
169
  ["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
170
170
  ];
171
- const Code = createLucideIcon("code", __iconNode$t);
172
- const __iconNode$s = [
173
- ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
174
- ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
175
- ];
176
- const Copy = createLucideIcon("copy", __iconNode$s);
177
- const __iconNode$r = [
171
+ const Code = createLucideIcon("code", __iconNode$n);
172
+ const __iconNode$m = [
178
173
  ["path", { d: "M12 15V3", key: "m9g1x1" }],
179
174
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
180
175
  ["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
181
176
  ];
182
- const Download = createLucideIcon("download", __iconNode$r);
183
- const __iconNode$q = [
177
+ const Download = createLucideIcon("download", __iconNode$m);
178
+ const __iconNode$l = [
184
179
  ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
185
180
  ["path", { d: "M10 14 21 3", key: "gplh6r" }],
186
181
  ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
187
182
  ];
188
- const ExternalLink = createLucideIcon("external-link", __iconNode$q);
189
- const __iconNode$p = [
183
+ const ExternalLink = createLucideIcon("external-link", __iconNode$l);
184
+ const __iconNode$k = [
190
185
  [
191
186
  "path",
192
187
  {
@@ -200,8 +195,8 @@ const __iconNode$p = [
200
195
  ["path", { d: "M8 17h2", key: "2yhykz" }],
201
196
  ["path", { d: "M14 17h2", key: "10kma7" }]
202
197
  ];
203
- const FileSpreadsheet = createLucideIcon("file-spreadsheet", __iconNode$p);
204
- const __iconNode$o = [
198
+ const FileSpreadsheet = createLucideIcon("file-spreadsheet", __iconNode$k);
199
+ const __iconNode$j = [
205
200
  [
206
201
  "path",
207
202
  {
@@ -214,8 +209,8 @@ const __iconNode$o = [
214
209
  ["path", { d: "M16 13H8", key: "t4e002" }],
215
210
  ["path", { d: "M16 17H8", key: "z1uh3a" }]
216
211
  ];
217
- const FileText = createLucideIcon("file-text", __iconNode$o);
218
- const __iconNode$n = [
212
+ const FileText = createLucideIcon("file-text", __iconNode$j);
213
+ const __iconNode$i = [
219
214
  [
220
215
  "path",
221
216
  {
@@ -225,8 +220,8 @@ const __iconNode$n = [
225
220
  ],
226
221
  ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
227
222
  ];
228
- const File = createLucideIcon("file", __iconNode$n);
229
- const __iconNode$m = [
223
+ const File = createLucideIcon("file", __iconNode$i);
224
+ const __iconNode$h = [
230
225
  [
231
226
  "path",
232
227
  {
@@ -235,43 +230,43 @@ const __iconNode$m = [
235
230
  }
236
231
  ]
237
232
  ];
238
- const Funnel = createLucideIcon("funnel", __iconNode$m);
239
- const __iconNode$l = [
233
+ const Funnel = createLucideIcon("funnel", __iconNode$h);
234
+ const __iconNode$g = [
240
235
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
241
236
  ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
242
237
  ["path", { d: "M2 12h20", key: "9i4pu4" }]
243
238
  ];
244
- const Globe = createLucideIcon("globe", __iconNode$l);
245
- const __iconNode$k = [
239
+ const Globe = createLucideIcon("globe", __iconNode$g);
240
+ const __iconNode$f = [
246
241
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
247
242
  ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
248
243
  ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
249
244
  ];
250
- const Image$1 = createLucideIcon("image", __iconNode$k);
251
- const __iconNode$j = [
245
+ const Image$1 = createLucideIcon("image", __iconNode$f);
246
+ const __iconNode$e = [
252
247
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
253
248
  ["path", { d: "M12 16v-4", key: "1dtifu" }],
254
249
  ["path", { d: "M12 8h.01", key: "e9boi3" }]
255
250
  ];
256
- const Info$1 = createLucideIcon("info", __iconNode$j);
257
- const __iconNode$i = [
251
+ const Info$1 = createLucideIcon("info", __iconNode$e);
252
+ const __iconNode$d = [
258
253
  ["path", { d: "M10 5h11", key: "1hkqpe" }],
259
254
  ["path", { d: "M10 12h11", key: "6m4ad9" }],
260
255
  ["path", { d: "M10 19h11", key: "14g2nv" }],
261
256
  ["path", { d: "m3 10 3-3-3-3", key: "i7pm08" }],
262
257
  ["path", { d: "m3 20 3-3-3-3", key: "20gx1n" }]
263
258
  ];
264
- const ListCollapse = createLucideIcon("list-collapse", __iconNode$i);
265
- const __iconNode$h = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
266
- const LoaderCircle = createLucideIcon("loader-circle", __iconNode$h);
267
- const __iconNode$g = [
259
+ const ListCollapse = createLucideIcon("list-collapse", __iconNode$d);
260
+ const __iconNode$c = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
261
+ const LoaderCircle = createLucideIcon("loader-circle", __iconNode$c);
262
+ const __iconNode$b = [
268
263
  ["path", { d: "M8 3H5a2 2 0 0 0-2 2v3", key: "1dcmit" }],
269
264
  ["path", { d: "M21 8V5a2 2 0 0 0-2-2h-3", key: "1e4gt3" }],
270
265
  ["path", { d: "M3 16v3a2 2 0 0 0 2 2h3", key: "wsl5sc" }],
271
266
  ["path", { d: "M16 21h3a2 2 0 0 0 2-2v-3", key: "18trek" }]
272
267
  ];
273
- const Maximize = createLucideIcon("maximize", __iconNode$g);
274
- const __iconNode$f = [
268
+ const Maximize = createLucideIcon("maximize", __iconNode$b);
269
+ const __iconNode$a = [
275
270
  [
276
271
  "path",
277
272
  {
@@ -287,27 +282,27 @@ const __iconNode$f = [
287
282
  }
288
283
  ]
289
284
  ];
290
- const MessagesSquare = createLucideIcon("messages-square", __iconNode$f);
291
- const __iconNode$e = [
285
+ const MessagesSquare = createLucideIcon("messages-square", __iconNode$a);
286
+ const __iconNode$9 = [
292
287
  ["path", { d: "M8 3v3a2 2 0 0 1-2 2H3", key: "hohbtr" }],
293
288
  ["path", { d: "M21 8h-3a2 2 0 0 1-2-2V3", key: "5jw1f3" }],
294
289
  ["path", { d: "M3 16h3a2 2 0 0 1 2 2v3", key: "198tvr" }],
295
290
  ["path", { d: "M16 21v-3a2 2 0 0 1 2-2h3", key: "ph8mxp" }]
296
291
  ];
297
- const Minimize = createLucideIcon("minimize", __iconNode$e);
298
- const __iconNode$d = [
292
+ const Minimize = createLucideIcon("minimize", __iconNode$9);
293
+ const __iconNode$8 = [
299
294
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
300
295
  ["path", { d: "M9 3v18", key: "fh3hqa" }],
301
296
  ["path", { d: "m16 15-3-3 3-3", key: "14y99z" }]
302
297
  ];
303
- const PanelLeftClose = createLucideIcon("panel-left-close", __iconNode$d);
304
- const __iconNode$c = [
298
+ const PanelLeftClose = createLucideIcon("panel-left-close", __iconNode$8);
299
+ const __iconNode$7 = [
305
300
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
306
301
  ["path", { d: "M9 3v18", key: "fh3hqa" }],
307
302
  ["path", { d: "m14 9 3 3-3 3", key: "8010ee" }]
308
303
  ];
309
- const PanelLeftOpen = createLucideIcon("panel-left-open", __iconNode$c);
310
- const __iconNode$b = [
304
+ const PanelLeftOpen = createLucideIcon("panel-left-open", __iconNode$7);
305
+ const __iconNode$6 = [
311
306
  [
312
307
  "path",
313
308
  {
@@ -316,8 +311,8 @@ const __iconNode$b = [
316
311
  }
317
312
  ]
318
313
  ];
319
- const Paperclip = createLucideIcon("paperclip", __iconNode$b);
320
- const __iconNode$a = [
314
+ const Paperclip = createLucideIcon("paperclip", __iconNode$6);
315
+ const __iconNode$5 = [
321
316
  [
322
317
  "path",
323
318
  {
@@ -327,69 +322,19 @@ const __iconNode$a = [
327
322
  ],
328
323
  ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
329
324
  ];
330
- const Pencil = createLucideIcon("pencil", __iconNode$a);
331
- const __iconNode$9 = [
325
+ const Pencil = createLucideIcon("pencil", __iconNode$5);
326
+ const __iconNode$4 = [
332
327
  ["path", { d: "M5 12h14", key: "1ays0h" }],
333
328
  ["path", { d: "M12 5v14", key: "s699le" }]
334
329
  ];
335
- const Plus = createLucideIcon("plus", __iconNode$9);
336
- const __iconNode$8 = [
330
+ const Plus = createLucideIcon("plus", __iconNode$4);
331
+ const __iconNode$3 = [
337
332
  ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
338
333
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
339
334
  ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
340
335
  ["path", { d: "M8 16H3v5", key: "1cv678" }]
341
336
  ];
342
- const RefreshCw = createLucideIcon("refresh-cw", __iconNode$8);
343
- const __iconNode$7 = [
344
- [
345
- "path",
346
- {
347
- d: "M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",
348
- key: "1ffxy3"
349
- }
350
- ],
351
- ["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
352
- ];
353
- const Send = createLucideIcon("send", __iconNode$7);
354
- const __iconNode$6 = [
355
- [
356
- "path",
357
- {
358
- d: "M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",
359
- key: "1s2grr"
360
- }
361
- ],
362
- ["path", { d: "M20 2v4", key: "1rf3ol" }],
363
- ["path", { d: "M22 4h-4", key: "gwowj6" }],
364
- ["circle", { cx: "4", cy: "20", r: "2", key: "6kqj1y" }]
365
- ];
366
- const Sparkles = createLucideIcon("sparkles", __iconNode$6);
367
- const __iconNode$5 = [
368
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }]
369
- ];
370
- const Square = createLucideIcon("square", __iconNode$5);
371
- const __iconNode$4 = [
372
- [
373
- "path",
374
- {
375
- d: "M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",
376
- key: "m61m77"
377
- }
378
- ],
379
- ["path", { d: "M17 14V2", key: "8ymqnk" }]
380
- ];
381
- const ThumbsDown = createLucideIcon("thumbs-down", __iconNode$4);
382
- const __iconNode$3 = [
383
- [
384
- "path",
385
- {
386
- d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",
387
- key: "emmmcr"
388
- }
389
- ],
390
- ["path", { d: "M7 10v12", key: "1qc93n" }]
391
- ];
392
- const ThumbsUp = createLucideIcon("thumbs-up", __iconNode$3);
337
+ const RefreshCw = createLucideIcon("refresh-cw", __iconNode$3);
393
338
  const __iconNode$2 = [
394
339
  ["path", { d: "M10 11v6", key: "nco0om" }],
395
340
  ["path", { d: "M14 11v6", key: "outv1u" }],
@@ -24030,7 +23975,7 @@ var lr = (e) => {
24030
23975
  for (; t > 0 && e[t - 1] === `
24031
23976
  `; ) t--;
24032
23977
  return e.slice(0, t);
24033
- }, cr = lazy(() => import("./highlighted-body-OFNGDK62-ByL2oaVl.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), st = ({ code: e, language: t, className: o, children: n, isIncomplete: r = false, startLine: s2, lineNumbers: a, ...l }) => {
23978
+ }, cr = lazy(() => import("./highlighted-body-OFNGDK62-95pvcwdb.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), st = ({ code: e, language: t, className: o, children: n, isIncomplete: r = false, startLine: s2, lineNumbers: a, ...l }) => {
24034
23979
  let i = y2(), d2 = useMemo(() => lr(e), [e]), c2 = useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: d2.split(`
24035
23980
  `).map((p2) => [{ content: p2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [d2]);
24036
23981
  return jsx(nt.Provider, { value: { code: e }, children: jsxs(ot, { isIncomplete: r, language: t, children: [jsx(rt, { language: t }), n ? jsx("div", { className: i("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"), children: jsx("div", { className: i("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"), "data-streamdown": "code-block-actions", children: n }) }) : null, jsx(Suspense, { fallback: jsx(At, { className: o, language: t, lineNumbers: a, result: c2, startLine: s2, ...l }), children: jsx(cr, { className: o, code: d2, language: t, lineNumbers: a, raw: c2, startLine: s2, ...l }) })] }) });
@@ -24392,7 +24337,7 @@ var vo = ({ children: e, className: t, showControls: o, showCopy: n = true, show
24392
24337
  let l = y2(), i = o && n, d2 = o && r, c2 = o && s2, p2 = i || d2 || c2;
24393
24338
  return jsxs("div", { className: l("my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2"), "data-streamdown": "table-wrapper", children: [p2 ? jsxs("div", { className: l("flex items-center justify-end gap-1"), children: [i ? jsx(Te, {}) : null, d2 ? jsx(Pe, {}) : null, c2 ? jsx(Co, { showCopy: i, showDownload: d2, children: e }) : null] }) : null, jsx("div", { className: l("border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background"), children: jsx("table", { className: l("w-full divide-y divide-border", t), "data-streamdown": "table", ...a, children: e }) })] });
24394
24339
  };
24395
- var es = /startLine=(\d+)/, ts = /\bnoLineNumbers\b/, os = lazy(() => import("./mermaid-GHXKKRXX-BkfFnaMM.js").then((e) => ({ default: e.Mermaid }))), ns = /language-([^\s]+)/;
24340
+ var es = /startLine=(\d+)/, ts = /\bnoLineNumbers\b/, os = lazy(() => import("./mermaid-GHXKKRXX-Dq4bMBai.js").then((e) => ({ default: e.Mermaid }))), ns = /language-([^\s]+)/;
24396
24341
  function qe(e, t) {
24397
24342
  if (!(e != null && e.position || t != null && t.position)) return true;
24398
24343
  if (!(e != null && e.position && (t != null && t.position))) return false;
@@ -28109,10 +28054,10 @@ function RetryLink({ label, onClick }) {
28109
28054
  }
28110
28055
  );
28111
28056
  }
28112
- function AssistantTurn({ turn, isStreaming, toolDetails, ContentBlock: ContentBlock2 }) {
28057
+ function AssistantTurn({ turn, isStreaming, toolDetails, ContentBlock }) {
28113
28058
  const segments = useMemo(() => segmentTurn(turn.assistants, toolDetails !== false), [turn.assistants, toolDetails]);
28114
28059
  const settled = !isActive(turn.user?.status);
28115
- const Block = ContentBlock2 ?? DefaultContentBlock;
28060
+ const Block = ContentBlock ?? DefaultContentBlock;
28116
28061
  if (segments.length === 0) return null;
28117
28062
  return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2 animate-[agent-chat-in_.18s_ease-out]", children: segments.map((segment, index2) => {
28118
28063
  const isTail = index2 === segments.length - 1;
@@ -28181,7 +28126,7 @@ function isActive(status) {
28181
28126
  function segmentTurn(messages, includeActivity) {
28182
28127
  const segments = [];
28183
28128
  for (const message of messages) {
28184
- normalizedBlocks$1(message).forEach((block, index2) => {
28129
+ normalizedBlocks(message).forEach((block, index2) => {
28185
28130
  const last = segments[segments.length - 1];
28186
28131
  if (isActivityBlock(block)) {
28187
28132
  if (!includeActivity) return;
@@ -28202,7 +28147,7 @@ function segmentTurn(messages, includeActivity) {
28202
28147
  key: `content:${message.id}:${segments.length}`,
28203
28148
  entries: []
28204
28149
  });
28205
- segment.entries.push({ message, block, key: `${message.id}:${blockKey$1(block, index2)}` });
28150
+ segment.entries.push({ message, block, key: `${message.id}:${blockKey(block, index2)}` });
28206
28151
  });
28207
28152
  }
28208
28153
  return segments;
@@ -28215,11 +28160,11 @@ function preparingToolName(payload) {
28215
28160
  const tool = payload?.tool;
28216
28161
  return typeof tool === "string" && tool ? tool : "tool";
28217
28162
  }
28218
- function normalizedBlocks$1(message) {
28163
+ function normalizedBlocks(message) {
28219
28164
  if (message.blocks && message.blocks.length > 0) return message.blocks;
28220
28165
  return message.content ? [{ type: "text", content: message.content }] : [];
28221
28166
  }
28222
- function blockKey$1(block, index2) {
28167
+ function blockKey(block, index2) {
28223
28168
  if (block.type === "tool_call") return `tool:${block.toolCall.id}`;
28224
28169
  if (block.type === "action") return `action:${block.action.id}`;
28225
28170
  if (block.type === "file") return `file:${block.file.id ?? block.file.url ?? block.file.name}:${index2}`;
@@ -28229,10 +28174,10 @@ function blockKey$1(block, index2) {
28229
28174
  function AssistantMessage({
28230
28175
  message,
28231
28176
  isStreaming,
28232
- ContentBlock: ContentBlock2
28177
+ ContentBlock
28233
28178
  }) {
28234
- const blocks = normalizedBlocks$1(message);
28235
- const Block = ContentBlock2 ?? DefaultContentBlock;
28179
+ const blocks = normalizedBlocks(message);
28180
+ const Block = ContentBlock ?? DefaultContentBlock;
28236
28181
  return /* @__PURE__ */ jsx("div", { className: cn$2("flex flex-col gap-2 text-sm leading-[1.55]"), children: blocks.map((block, index2) => /* @__PURE__ */ jsx(
28237
28182
  Block,
28238
28183
  {
@@ -28240,7 +28185,7 @@ function AssistantMessage({
28240
28185
  message,
28241
28186
  isStreaming: isStreaming && index2 === blocks.length - 1
28242
28187
  },
28243
- blockKey$1(block, index2)
28188
+ blockKey(block, index2)
28244
28189
  )) });
28245
28190
  }
28246
28191
  const NEAR_BOTTOM_PX = 80;
@@ -28397,7 +28342,7 @@ function TurnView({
28397
28342
  User,
28398
28343
  System,
28399
28344
  Assistant,
28400
- ContentBlock: ContentBlock2,
28345
+ ContentBlock,
28401
28346
  toolDetails,
28402
28347
  labels,
28403
28348
  onRetryTurn
@@ -28436,7 +28381,7 @@ function TurnView({
28436
28381
  {
28437
28382
  message,
28438
28383
  isStreaming: props.isStreaming,
28439
- ContentBlock: ContentBlock2
28384
+ ContentBlock
28440
28385
  },
28441
28386
  message.id
28442
28387
  );
@@ -28449,7 +28394,7 @@ function TurnView({
28449
28394
  turn,
28450
28395
  isStreaming,
28451
28396
  toolDetails,
28452
- ContentBlock: ContentBlock2
28397
+ ContentBlock
28453
28398
  }
28454
28399
  ),
28455
28400
  outcomeNode
@@ -28638,8 +28583,8 @@ function AgentChat({
28638
28583
  [accent, accentForeground, resize.style]
28639
28584
  );
28640
28585
  const Header = renderers?.Header ?? AgentChatHeader;
28641
- const EmptyState2 = renderers?.EmptyState ?? AgentChatEmptyState;
28642
- const Composer2 = renderers?.Composer ?? AgentChatComposer;
28586
+ const EmptyState = renderers?.EmptyState ?? AgentChatEmptyState;
28587
+ const Composer = renderers?.Composer ?? AgentChatComposer;
28643
28588
  return /* @__PURE__ */ jsx(ToolRenderersProvider, { renderers: renderers?.toolRenderers, children: /* @__PURE__ */ jsxs(
28644
28589
  "section",
28645
28590
  {
@@ -28686,7 +28631,7 @@ function AgentChat({
28686
28631
  labels,
28687
28632
  renderers,
28688
28633
  emptyState: /* @__PURE__ */ jsx(
28689
- EmptyState2,
28634
+ EmptyState,
28690
28635
  {
28691
28636
  name: profile.name,
28692
28637
  description: profile.description ?? labels.emptyDescription,
@@ -28698,7 +28643,7 @@ function AgentChat({
28698
28643
  }
28699
28644
  ),
28700
28645
  !chat.hideComposer && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
28701
- Composer2,
28646
+ Composer,
28702
28647
  {
28703
28648
  state: {
28704
28649
  value: chat.input,
@@ -29616,6 +29561,147 @@ function booleanValue(value) {
29616
29561
  function isPresent(value) {
29617
29562
  return value != null;
29618
29563
  }
29564
+ function SessionRail({ sessions, activeSessionId, isLoading, onSelect, onNew, onRename }) {
29565
+ const [renamingId, setRenamingId] = useState(null);
29566
+ const [renameValue, setRenameValue] = useState("");
29567
+ const startRename = (id, name2) => {
29568
+ setRenamingId(id);
29569
+ setRenameValue(name2 ?? "");
29570
+ };
29571
+ const commitRename = (id) => {
29572
+ const name2 = renameValue.trim();
29573
+ setRenamingId(null);
29574
+ if (name2) onRename?.(id, name2);
29575
+ };
29576
+ return /* @__PURE__ */ jsxs("aside", { className: "flex w-60 shrink-0 flex-col border-r border-border bg-card", children: [
29577
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 px-3 py-2.5", children: [
29578
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: [
29579
+ /* @__PURE__ */ jsx(MessagesSquare, { className: "size-3.5", "aria-hidden": "true" }),
29580
+ " Chats"
29581
+ ] }),
29582
+ onNew && /* @__PURE__ */ jsxs(
29583
+ "button",
29584
+ {
29585
+ type: "button",
29586
+ onClick: onNew,
29587
+ className: "inline-flex items-center gap-1 rounded-md bg-primary px-2 py-1 text-xs font-medium text-primary-foreground transition hover:opacity-90",
29588
+ children: [
29589
+ /* @__PURE__ */ jsx(Plus, { className: "size-3.5", "aria-hidden": "true" }),
29590
+ " New"
29591
+ ]
29592
+ }
29593
+ )
29594
+ ] }),
29595
+ /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-y-auto px-2 pb-2", children: isLoading && sessions.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 p-1", children: [
29596
+ /* @__PURE__ */ jsx("div", { className: "h-12 animate-pulse rounded-lg bg-muted" }),
29597
+ /* @__PURE__ */ jsx("div", { className: "h-12 animate-pulse rounded-lg bg-muted" }),
29598
+ /* @__PURE__ */ jsx("div", { className: "h-12 animate-pulse rounded-lg bg-muted" })
29599
+ ] }) : sessions.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-2 py-6 text-center text-xs text-muted-foreground", children: "No conversations yet." }) : /* @__PURE__ */ jsx("div", { className: "space-y-3", children: groupSessions(sessions).map((group) => /* @__PURE__ */ jsxs("div", { children: [
29600
+ /* @__PURE__ */ jsx("p", { className: "px-2 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/80", children: group.label }),
29601
+ /* @__PURE__ */ jsx("ul", { className: "space-y-0.5", children: group.items.map((session) => {
29602
+ const isActive2 = session.id === activeSessionId;
29603
+ const title = prettySessionTitle(session);
29604
+ return /* @__PURE__ */ jsx("li", { children: renamingId === session.id ? /* @__PURE__ */ jsx(
29605
+ "input",
29606
+ {
29607
+ autoFocus: true,
29608
+ value: renameValue,
29609
+ onChange: (e) => setRenameValue(e.target.value),
29610
+ onBlur: () => commitRename(session.id),
29611
+ onKeyDown: (e) => {
29612
+ if (e.key === "Enter") {
29613
+ e.preventDefault();
29614
+ commitRename(session.id);
29615
+ }
29616
+ if (e.key === "Escape") setRenamingId(null);
29617
+ },
29618
+ className: "h-9 w-full rounded-lg border border-border bg-background px-2.5 text-sm outline-none focus:ring-2 focus:ring-ring/40"
29619
+ }
29620
+ ) : /* @__PURE__ */ jsxs(
29621
+ "button",
29622
+ {
29623
+ type: "button",
29624
+ onClick: () => onSelect(session.id),
29625
+ onDoubleClick: onRename ? () => startRename(session.id, title) : void 0,
29626
+ className: cn$2(
29627
+ "group flex w-full flex-col items-start gap-0.5 rounded-lg px-2.5 py-2 text-left transition",
29628
+ isActive2 ? "bg-(--agent-chat-accent-soft) text-foreground" : "hover:bg-muted"
29629
+ ),
29630
+ children: [
29631
+ /* @__PURE__ */ jsxs("span", { className: "flex w-full items-center gap-1", children: [
29632
+ /* @__PURE__ */ jsx("span", { className: "line-clamp-1 flex-1 text-sm font-medium", children: title }),
29633
+ session.status === "active" && /* @__PURE__ */ jsx(
29634
+ "span",
29635
+ {
29636
+ role: "img",
29637
+ "aria-label": "Active",
29638
+ className: "size-1.5 shrink-0 rounded-full bg-(--status-success-foreground)"
29639
+ }
29640
+ ),
29641
+ onRename && /* @__PURE__ */ jsx(
29642
+ Pencil,
29643
+ {
29644
+ className: "size-3 shrink-0 text-muted-foreground opacity-0 transition group-hover:opacity-100",
29645
+ onClick: (e) => {
29646
+ e.stopPropagation();
29647
+ startRename(session.id, title);
29648
+ }
29649
+ }
29650
+ )
29651
+ ] }),
29652
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: formatRelative(session.lastUsedAt ?? session.createdAt) })
29653
+ ]
29654
+ }
29655
+ ) }, session.id);
29656
+ }) })
29657
+ ] }, group.label)) }) })
29658
+ ] });
29659
+ }
29660
+ function prettySessionTitle(session) {
29661
+ const raw2 = (session.name ?? "").trim();
29662
+ if (!raw2) return "New chat";
29663
+ if (/^[[{]/.test(raw2) || raw2.includes("current_date") || raw2.includes('"task_id"')) {
29664
+ return "Untitled chat";
29665
+ }
29666
+ return raw2.replace(/^["'`#>\s-]+/, "").slice(0, 60).trim() || "Untitled chat";
29667
+ }
29668
+ function groupSessions(sessions) {
29669
+ const now = /* @__PURE__ */ new Date();
29670
+ const startToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
29671
+ const day = 864e5;
29672
+ const today = [];
29673
+ const yesterday = [];
29674
+ const week = [];
29675
+ const older = [];
29676
+ for (const s2 of sessions) {
29677
+ const t = new Date(s2.lastUsedAt ?? s2.createdAt ?? "").getTime();
29678
+ if (Number.isNaN(t)) older.push(s2);
29679
+ else if (t >= startToday) today.push(s2);
29680
+ else if (t >= startToday - day) yesterday.push(s2);
29681
+ else if (t >= startToday - 7 * day) week.push(s2);
29682
+ else older.push(s2);
29683
+ }
29684
+ return [
29685
+ { label: "Today", items: today },
29686
+ { label: "Yesterday", items: yesterday },
29687
+ { label: "Previous 7 days", items: week },
29688
+ { label: "Older", items: older }
29689
+ ].filter((g2) => g2.items.length > 0);
29690
+ }
29691
+ function formatRelative(value) {
29692
+ if (!value) return "";
29693
+ const then = new Date(value).getTime();
29694
+ if (Number.isNaN(then)) return "";
29695
+ const diff = Date.now() - then;
29696
+ const min2 = Math.round(diff / 6e4);
29697
+ if (min2 < 1) return "just now";
29698
+ if (min2 < 60) return `${min2}m ago`;
29699
+ const hr = Math.round(min2 / 60);
29700
+ if (hr < 24) return `${hr}h ago`;
29701
+ const d2 = Math.round(hr / 24);
29702
+ if (d2 < 7) return `${d2}d ago`;
29703
+ return new Date(value).toLocaleDateString();
29704
+ }
29619
29705
  const MUTATING_METHODS = /* @__PURE__ */ new Set(["POST", "PATCH", "PUT", "DELETE"]);
29620
29706
  function isMutatingToolCall(tc) {
29621
29707
  if (tc?.name !== "lumera_api") return false;
@@ -29661,370 +29747,6 @@ function useDataSyncTransport(transport, onDataChange, debounceMs = 350) {
29661
29747
  return withDataSync(transport, fire);
29662
29748
  }, [transport, fire]);
29663
29749
  }
29664
- function Markdown({ children: children2, muted, isStreaming }) {
29665
- return /* @__PURE__ */ jsx(
29666
- Qs,
29667
- {
29668
- className: cn$2("assistant-md", muted && "assistant-md--muted"),
29669
- animated: isStreaming,
29670
- isAnimating: isStreaming,
29671
- mode: isStreaming ? "streaming" : "static",
29672
- children: children2 || ""
29673
- }
29674
- );
29675
- }
29676
- function normalizedBlocks(blocks, content2) {
29677
- if (blocks && blocks.length > 0) return blocks;
29678
- return content2 ? [{ type: "text", content: content2 }] : [];
29679
- }
29680
- function blockKey(block, index2) {
29681
- if (block.type === "tool_call") return `tool:${block.toolCall.id}`;
29682
- if (block.type === "action") return `action:${block.action.id}`;
29683
- if (block.type === "file") return `file:${block.file.id ?? block.file.url ?? block.file.name}:${index2}`;
29684
- if (block.type === "custom") return `custom:${block.kind}:${index2}`;
29685
- return `${block.type}:${index2}`;
29686
- }
29687
- function messageText(message) {
29688
- const blocks = normalizedBlocks(message.blocks, message.content);
29689
- const text2 = blocks.map((b2) => b2.type === "text" ? b2.content : b2.type === "thinking" ? "" : "").filter(Boolean).join("\n\n").trim();
29690
- return text2 || message.content || "";
29691
- }
29692
- function ContentBlock({ block, isStreaming }) {
29693
- switch (block.type) {
29694
- case "text":
29695
- return /* @__PURE__ */ jsx(Markdown, { isStreaming, children: block.content });
29696
- case "thinking":
29697
- return /* @__PURE__ */ jsx(ReasoningBlock, { content: block.content, isStreaming });
29698
- case "tool_call":
29699
- return /* @__PURE__ */ jsx(ToolCallCard, { toolCall: block.toolCall });
29700
- case "info":
29701
- return /* @__PURE__ */ jsx(InfoBanner, { content: block.content, tone: block.tone });
29702
- case "file":
29703
- return /* @__PURE__ */ jsx("div", { className: "my-1", children: /* @__PURE__ */ jsx(ArtifactCard, { file: block.file }) });
29704
- case "action":
29705
- return /* @__PURE__ */ jsxs("div", { className: "my-1 text-xs", children: [
29706
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: block.action.label }),
29707
- block.action.error ? /* @__PURE__ */ jsx("span", { className: "ml-2 text-destructive", children: block.action.error }) : null
29708
- ] });
29709
- case "custom":
29710
- return /* @__PURE__ */ jsx(Fragment$1, {});
29711
- default:
29712
- return null;
29713
- }
29714
- }
29715
- function ReasoningBlock({ content: content2, isStreaming }) {
29716
- const [open2, setOpen] = useState(true);
29717
- const expanded = open2 || Boolean(isStreaming);
29718
- return /* @__PURE__ */ jsxs("div", { className: "my-1", children: [
29719
- /* @__PURE__ */ jsxs(
29720
- "button",
29721
- {
29722
- type: "button",
29723
- onClick: () => setOpen((v2) => !v2),
29724
- className: "flex items-center gap-1.5 text-xs font-medium text-muted-foreground/70 transition hover:text-muted-foreground",
29725
- children: [
29726
- /* @__PURE__ */ jsx(Brain, { className: cn$2("size-3", isStreaming && "animate-pulse") }),
29727
- /* @__PURE__ */ jsx("span", { children: isStreaming ? "Reasoning…" : "Reasoning" }),
29728
- /* @__PURE__ */ jsx(ChevronDown, { className: cn$2("size-3 transition-transform", expanded ? "" : "-rotate-90") })
29729
- ]
29730
- }
29731
- ),
29732
- expanded ? /* @__PURE__ */ jsx("div", { className: "mt-1.5 border-l-2 border-primary/20 pl-3", children: /* @__PURE__ */ jsx(Markdown, { muted: true, isStreaming, children: content2 }) }) : null
29733
- ] });
29734
- }
29735
- function InfoBanner({ content: content2, tone }) {
29736
- const variant = tone === "success" ? {
29737
- box: "border-emerald-200 bg-emerald-50 text-emerald-800",
29738
- icon: /* @__PURE__ */ jsx(CircleCheck, { className: "size-3.5 shrink-0 text-emerald-600" })
29739
- } : tone === "warning" ? {
29740
- box: "border-amber-200 bg-amber-50 text-amber-800",
29741
- icon: /* @__PURE__ */ jsx(TriangleAlert, { className: "size-3.5 shrink-0 text-amber-600" })
29742
- } : tone === "error" ? {
29743
- box: "border-destructive/30 bg-destructive/10 text-destructive",
29744
- icon: /* @__PURE__ */ jsx(TriangleAlert, { className: "size-3.5 shrink-0" })
29745
- } : {
29746
- box: "border-blue-200 bg-blue-50 text-blue-800",
29747
- icon: /* @__PURE__ */ jsx(Info$1, { className: "size-3.5 shrink-0 text-blue-600" })
29748
- };
29749
- return /* @__PURE__ */ jsxs("div", { className: cn$2("my-1 flex items-center gap-2 rounded-lg border px-3 py-2 text-xs", variant.box), children: [
29750
- variant.icon,
29751
- /* @__PURE__ */ jsx("span", { children: content2 })
29752
- ] });
29753
- }
29754
- function WorkingDots({ label = "Working" }) {
29755
- return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
29756
- /* @__PURE__ */ jsx("span", { children: label }),
29757
- /* @__PURE__ */ jsxs("span", { className: "inline-flex gap-1", children: [
29758
- /* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-primary [animation:pulse-dot_1s_infinite]" }),
29759
- /* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-primary [animation:pulse-dot_1s_infinite_0.15s]" }),
29760
- /* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-primary [animation:pulse-dot_1s_infinite_0.3s]" })
29761
- ] })
29762
- ] });
29763
- }
29764
- function PendingAssistantMessage() {
29765
- return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-start gap-3", children: [
29766
- /* @__PURE__ */ jsx("div", { className: "flex size-7 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx(Sparkles, { className: "size-4" }) }),
29767
- /* @__PURE__ */ jsx(WorkingDots, {})
29768
- ] });
29769
- }
29770
- function UserMessageView({ message }) {
29771
- return /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx("div", { className: "max-w-[85%] whitespace-pre-wrap rounded-2xl rounded-br-md border border-border bg-secondary px-3.5 py-2.5 text-sm leading-relaxed text-secondary-foreground shadow-sm", children: message.content }) });
29772
- }
29773
- function AssistantMessageView({
29774
- message,
29775
- isStreaming,
29776
- onRegenerate
29777
- }) {
29778
- const blocks = normalizedBlocks(message.blocks, message.content);
29779
- const showActions = !isStreaming && messageText(message).length > 0;
29780
- return /* @__PURE__ */ jsxs("div", { className: "group/msg flex justify-start gap-3", children: [
29781
- /* @__PURE__ */ jsx("div", { className: "flex size-7 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx(Sparkles, { className: "size-4" }) }),
29782
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 text-sm", children: [
29783
- isStreaming && blocks.length === 0 ? /* @__PURE__ */ jsx(WorkingDots, {}) : /* @__PURE__ */ jsx("div", { className: "space-y-2", children: blocks.map((block, index2) => /* @__PURE__ */ jsx(
29784
- ContentBlock,
29785
- {
29786
- block,
29787
- isStreaming: isStreaming && index2 === blocks.length - 1
29788
- },
29789
- blockKey(block, index2)
29790
- )) }),
29791
- showActions ? /* @__PURE__ */ jsx(MessageActions, { text: messageText(message), onRegenerate }) : null
29792
- ] })
29793
- ] });
29794
- }
29795
- function MessageActions({ text: text2, onRegenerate }) {
29796
- const [copied, setCopied] = useState(false);
29797
- const [feedback, setFeedback] = useState(null);
29798
- const copy = async () => {
29799
- try {
29800
- await navigator.clipboard.writeText(text2);
29801
- setCopied(true);
29802
- setTimeout(() => setCopied(false), 1500);
29803
- } catch {
29804
- }
29805
- };
29806
- return /* @__PURE__ */ jsxs(
29807
- "div",
29808
- {
29809
- className: cn$2(
29810
- "mt-1.5 flex items-center gap-1 transition-opacity",
29811
- feedback ? "opacity-100" : "opacity-0 group-hover/msg:opacity-100 focus-within:opacity-100"
29812
- ),
29813
- children: [
29814
- /* @__PURE__ */ jsx(ActionButton, { label: copied ? "Copied" : "Copy", onClick: copy, children: copied ? /* @__PURE__ */ jsx(Check, { className: "size-3.5 text-emerald-600" }) : /* @__PURE__ */ jsx(Copy, { className: "size-3.5" }) }),
29815
- onRegenerate ? /* @__PURE__ */ jsx(ActionButton, { label: "Retry", onClick: onRegenerate, children: /* @__PURE__ */ jsx(RefreshCw, { className: "size-3.5" }) }) : null,
29816
- /* @__PURE__ */ jsx("span", { className: "mx-0.5 h-4 w-px bg-border" }),
29817
- /* @__PURE__ */ jsx(ActionButton, { label: "Good response", onClick: () => setFeedback("up"), children: /* @__PURE__ */ jsx(ThumbsUp, { className: cn$2("size-3.5", feedback === "up" && "text-primary") }) }),
29818
- /* @__PURE__ */ jsx(ActionButton, { label: "Bad response", onClick: () => setFeedback("down"), children: /* @__PURE__ */ jsx(ThumbsDown, { className: cn$2("size-3.5", feedback === "down" && "text-primary") }) }),
29819
- feedback ? /* @__PURE__ */ jsx("span", { className: "ml-1 text-[11px] text-muted-foreground", children: "Thanks — noted." }) : null
29820
- ]
29821
- }
29822
- );
29823
- }
29824
- function ActionButton({ label, onClick, children: children2 }) {
29825
- return /* @__PURE__ */ jsx(
29826
- "button",
29827
- {
29828
- type: "button",
29829
- onClick,
29830
- "aria-label": label,
29831
- title: label,
29832
- className: "rounded-md p-1 text-muted-foreground transition hover:bg-accent hover:text-foreground",
29833
- children: children2
29834
- }
29835
- );
29836
- }
29837
- function EmptyState({
29838
- title,
29839
- description,
29840
- suggestions,
29841
- onPick
29842
- }) {
29843
- return /* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-64 flex-col items-center justify-center px-4 text-center", children: [
29844
- /* @__PURE__ */ jsx("div", { className: "flex size-12 items-center justify-center rounded-2xl bg-primary text-primary-foreground shadow-sm", children: /* @__PURE__ */ jsx(Sparkles, { className: "size-6" }) }),
29845
- /* @__PURE__ */ jsx("p", { className: "mt-3 text-base font-semibold", children: title }),
29846
- description ? /* @__PURE__ */ jsx("p", { className: "mt-1 max-w-sm text-sm leading-relaxed text-muted-foreground", children: description }) : null,
29847
- suggestions && suggestions.length > 0 && onPick ? /* @__PURE__ */ jsx("div", { className: "mt-5 grid w-full max-w-md grid-cols-1 gap-2 sm:grid-cols-2", children: suggestions.map((s2) => /* @__PURE__ */ jsx(
29848
- "button",
29849
- {
29850
- type: "button",
29851
- onClick: () => onPick(s2),
29852
- className: "rounded-xl border bg-card px-3 py-2.5 text-left text-sm leading-snug text-foreground/90 transition hover:border-primary/40 hover:bg-accent",
29853
- children: s2
29854
- },
29855
- s2
29856
- )) }) : null
29857
- ] });
29858
- }
29859
- function Composer({
29860
- value,
29861
- placeholder,
29862
- disabled,
29863
- inFlight,
29864
- canSubmit,
29865
- canAbort,
29866
- chips,
29867
- pendingFiles,
29868
- enableAttachments,
29869
- phase,
29870
- queueLength = 0,
29871
- onChange,
29872
- onSubmit,
29873
- onAbort,
29874
- onPickChip,
29875
- onAttach,
29876
- onRemoveFile
29877
- }) {
29878
- const textareaRef = useRef(null);
29879
- const fileInputRef = useRef(null);
29880
- useEffect(() => {
29881
- const el = textareaRef.current;
29882
- if (!el) return;
29883
- el.style.height = "auto";
29884
- el.style.height = `${Math.min(el.scrollHeight, 144)}px`;
29885
- }, [value]);
29886
- const hasFiles = Boolean(pendingFiles && pendingFiles.length > 0);
29887
- const effectivePlaceholder = phase === "submitting" ? "Submitting…" : phase === "aborting" ? "Stopping…" : inFlight ? "Queue a follow-up…" : placeholder;
29888
- const handlePaste = (event) => {
29889
- if (!enableAttachments || !onAttach) return;
29890
- const files = Array.from(event.clipboardData?.items ?? []).filter((item) => item.kind === "file").map((item) => item.getAsFile()).filter((file) => file !== null);
29891
- if (files.length > 0) {
29892
- event.preventDefault();
29893
- onAttach(files);
29894
- }
29895
- };
29896
- const hintParts = [inFlight ? "↵ Queue" : "↵ Send", "⇧↵ Newline"];
29897
- if (enableAttachments) hintParts.push("Paste or attach files");
29898
- if (queueLength > 0) hintParts.push(`${queueLength} queued`);
29899
- return /* @__PURE__ */ jsx(
29900
- "form",
29901
- {
29902
- className: "px-3 pb-3 pt-2",
29903
- onSubmit: (event) => {
29904
- event.preventDefault();
29905
- if (canSubmit) onSubmit();
29906
- },
29907
- children: /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-2xl", children: [
29908
- !inFlight && chips && chips.length > 0 ? /* @__PURE__ */ jsx("div", { className: "mb-2 flex flex-wrap gap-1.5 px-1", children: chips.map((chip) => /* @__PURE__ */ jsx(
29909
- "button",
29910
- {
29911
- type: "button",
29912
- disabled,
29913
- onClick: () => onPickChip?.(chip.value),
29914
- className: "rounded-full border bg-card px-2.5 py-1 text-xs text-muted-foreground transition hover:border-primary/40 hover:bg-accent hover:text-foreground disabled:opacity-50",
29915
- children: chip.label
29916
- },
29917
- chip.label
29918
- )) }) : null,
29919
- hasFiles ? /* @__PURE__ */ jsx("div", { className: "mb-2 flex flex-wrap gap-1.5 px-1", children: pendingFiles?.map((file) => /* @__PURE__ */ jsxs(
29920
- "span",
29921
- {
29922
- className: cn$2(
29923
- "inline-flex items-center gap-1.5 rounded-lg border px-2 py-1 text-xs",
29924
- file.status === "failed" ? "border-destructive/40 bg-destructive/10 text-destructive" : "bg-muted text-muted-foreground"
29925
- ),
29926
- children: [
29927
- /* @__PURE__ */ jsx(FileText, { className: "size-3 shrink-0" }),
29928
- /* @__PURE__ */ jsx("span", { className: "max-w-40 truncate", children: file.name }),
29929
- file.status === "uploading" ? /* @__PURE__ */ jsx(LoaderCircle, { className: "size-3 shrink-0 animate-spin" }) : null,
29930
- onRemoveFile ? /* @__PURE__ */ jsx(
29931
- "button",
29932
- {
29933
- type: "button",
29934
- "aria-label": `Remove ${file.name}`,
29935
- onClick: () => onRemoveFile(file.id),
29936
- className: "shrink-0 rounded transition hover:text-foreground",
29937
- children: /* @__PURE__ */ jsx(X$2, { className: "size-3" })
29938
- }
29939
- ) : null
29940
- ]
29941
- },
29942
- file.id
29943
- )) }) : null,
29944
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
29945
- inFlight ? /* @__PURE__ */ jsx("svg", { className: "pointer-events-none absolute inset-0 z-10 size-full", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
29946
- "rect",
29947
- {
29948
- x: "0.75",
29949
- y: "0.75",
29950
- rx: "15.25",
29951
- ry: "15.25",
29952
- width: "calc(100% - 1.5px)",
29953
- height: "calc(100% - 1.5px)",
29954
- stroke: "var(--primary)",
29955
- strokeOpacity: "0.55",
29956
- strokeWidth: "1.5",
29957
- strokeLinecap: "round",
29958
- pathLength: 100,
29959
- strokeDasharray: "15 85",
29960
- className: "animate-[border-trace_2s_linear_infinite]"
29961
- }
29962
- ) }) : null,
29963
- /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-1 rounded-2xl border border-input bg-background p-1.5 pl-1 focus-within:ring-2 focus-within:ring-ring/30", children: [
29964
- enableAttachments ? /* @__PURE__ */ jsxs(Fragment, { children: [
29965
- /* @__PURE__ */ jsx(
29966
- "input",
29967
- {
29968
- ref: fileInputRef,
29969
- type: "file",
29970
- multiple: true,
29971
- className: "hidden",
29972
- onChange: (event) => {
29973
- const files = Array.from(event.currentTarget.files ?? []);
29974
- if (files.length > 0) onAttach?.(files);
29975
- event.currentTarget.value = "";
29976
- }
29977
- }
29978
- ),
29979
- /* @__PURE__ */ jsx(
29980
- "button",
29981
- {
29982
- type: "button",
29983
- onClick: () => fileInputRef.current?.click(),
29984
- disabled,
29985
- "aria-label": "Attach files",
29986
- className: "mb-0.5 inline-flex size-9 shrink-0 items-center justify-center rounded-xl text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:opacity-50",
29987
- children: /* @__PURE__ */ jsx(Paperclip, { className: "size-4" })
29988
- }
29989
- )
29990
- ] }) : /* @__PURE__ */ jsx("div", { className: "w-1.5" }),
29991
- /* @__PURE__ */ jsx(
29992
- "textarea",
29993
- {
29994
- ref: textareaRef,
29995
- value,
29996
- placeholder: effectivePlaceholder,
29997
- disabled,
29998
- rows: 1,
29999
- className: "max-h-36 min-h-9 flex-1 resize-none bg-transparent px-1 py-2 text-sm outline-none placeholder:text-muted-foreground disabled:opacity-60",
30000
- onChange: (event) => onChange(event.target.value),
30001
- onPaste: handlePaste,
30002
- onKeyDown: (event) => {
30003
- if (event.key === "Enter" && !event.shiftKey) {
30004
- event.preventDefault();
30005
- if (canSubmit) onSubmit();
30006
- }
30007
- }
30008
- }
30009
- ),
30010
- /* @__PURE__ */ jsx(
30011
- "button",
30012
- {
30013
- type: canAbort ? "button" : "submit",
30014
- onClick: canAbort ? onAbort : void 0,
30015
- disabled: canAbort ? false : !canSubmit,
30016
- "aria-label": canAbort ? "Stop response" : "Send message",
30017
- className: "inline-flex size-9 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40",
30018
- children: canAbort ? /* @__PURE__ */ jsx(Square, { className: "size-4" }) : inFlight ? /* @__PURE__ */ jsx(LoaderCircle, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsx(Send, { className: "size-4" })
30019
- }
30020
- )
30021
- ] })
30022
- ] }),
30023
- /* @__PURE__ */ jsx("div", { className: "mt-1.5 text-center text-[10px] text-muted-foreground/40", children: hintParts.join(" · ") })
30024
- ] })
30025
- }
30026
- );
30027
- }
30028
29750
  function AssistantChat({
30029
29751
  agentId,
30030
29752
  sessionId,
@@ -30038,12 +29760,12 @@ function AssistantChat({
30038
29760
  suggestions,
30039
29761
  composerChips,
30040
29762
  placeholder = "Ask a question…",
30041
- emptyTitle = "Start a conversation",
30042
- emptyDescription,
30043
29763
  toolRenderers,
30044
29764
  onDataChange,
30045
29765
  onTurnComplete,
29766
+ onNewChat,
30046
29767
  enableAttachments,
29768
+ webSearch,
30047
29769
  historyLimit,
30048
29770
  watchdog = true,
30049
29771
  discoveryPoll,
@@ -30052,137 +29774,40 @@ function AssistantChat({
30052
29774
  className
30053
29775
  }) {
30054
29776
  const syncedTransport = useDataSyncTransport(transport, onDataChange);
30055
- const attachmentsEnabled = enableAttachments ?? Boolean(transport.uploadFile);
30056
- const chat = useAgentChat({
30057
- agentId,
30058
- sessionId,
30059
- transport: syncedTransport,
30060
- historyLimit,
30061
- watchdog,
30062
- discoveryPoll,
30063
- disabled,
30064
- readOnly,
30065
- onTurnComplete: () => {
30066
- onTurnComplete?.();
30067
- onDataChange?.();
30068
- }
30069
- });
30070
- const scrollRef = useRef(null);
30071
- const stickRef = useRef(true);
30072
- useEffect(() => {
30073
- if (!stickRef.current) return;
30074
- const el = scrollRef.current;
30075
- if (!el) return;
30076
- const frame = requestAnimationFrame(() => {
30077
- el.scrollTop = el.scrollHeight;
30078
- });
30079
- return () => cancelAnimationFrame(frame);
30080
- });
30081
- const hasMessages = chat.messages.length > 0;
30082
- const lastTurnId = chat.turns[chat.turns.length - 1]?.id;
30083
- const inFlight = chat.isWorking;
30084
- const emptySuggestions = chat.mutationsBlocked ? void 0 : suggestions;
30085
- return /* @__PURE__ */ jsx(ToolRenderersProvider, { renderers: toolRenderers, children: /* @__PURE__ */ jsxs("div", { className: cn$2("flex min-h-0 flex-col", className), children: [
30086
- showHeader ? /* @__PURE__ */ jsxs("header", { className: "flex shrink-0 items-center gap-2 border-b px-3 py-2.5", children: [
29777
+ const labels = useMemo(() => ({ placeholder }), [placeholder]);
29778
+ const features = useMemo(
29779
+ () => ({ header: showHeader, attachments: enableAttachments ?? Boolean(transport.uploadFile), webSearch }),
29780
+ [showHeader, enableAttachments, transport.uploadFile, webSearch]
29781
+ );
29782
+ const renderers = useMemo(() => ({ toolRenderers }), [toolRenderers]);
29783
+ return /* @__PURE__ */ jsx(
29784
+ AgentChat,
29785
+ {
29786
+ agentId,
29787
+ sessionId,
29788
+ transport: syncedTransport,
29789
+ name: title,
29790
+ description: scopes && scopes.length > 0 ? scopes.join(" · ") : subtitle,
29791
+ suggestions,
29792
+ composerChips,
29793
+ onNewChat,
30087
29794
  headerLeft,
30088
- /* @__PURE__ */ jsx("div", { className: "flex size-7 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx(Sparkles, { className: "size-4" }) }),
30089
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
30090
- /* @__PURE__ */ jsx("p", { className: "truncate text-sm font-semibold", children: title }),
30091
- scopes && scopes.length > 0 ? /* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-wrap items-center gap-1.5", children: scopes.map((scope) => /* @__PURE__ */ jsx("span", { className: "rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground", children: scope }, scope)) }) : subtitle ? /* @__PURE__ */ jsx("p", { className: "truncate text-xs text-muted-foreground", children: subtitle }) : null
30092
- ] }),
30093
- headerRight
30094
- ] }) : null,
30095
- /* @__PURE__ */ jsxs(
30096
- "div",
30097
- {
30098
- ref: scrollRef,
30099
- className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4",
30100
- onScroll: (event) => {
30101
- const el = event.currentTarget;
30102
- stickRef.current = el.scrollHeight - el.scrollTop - el.clientHeight < 96;
30103
- },
30104
- children: [
30105
- chat.canLoadEarlier ? /* @__PURE__ */ jsx("div", { className: "mx-auto mb-4 flex max-w-2xl justify-center", children: /* @__PURE__ */ jsx(
30106
- "button",
30107
- {
30108
- type: "button",
30109
- onClick: chat.loadEarlier,
30110
- disabled: chat.isLoadingEarlier,
30111
- className: "rounded-full border bg-background px-3 py-1.5 text-xs text-muted-foreground shadow-sm transition hover:bg-accent disabled:opacity-50",
30112
- children: chat.isLoadingEarlier ? "Loading…" : "Load earlier"
30113
- }
30114
- ) }) : null,
30115
- chat.isLoadingHistory && !hasMessages ? /* @__PURE__ */ jsx("div", { className: "flex h-full min-h-48 items-center justify-center text-sm text-muted-foreground", children: "Loading conversation…" }) : !hasMessages ? /* @__PURE__ */ jsx(
30116
- EmptyState,
30117
- {
30118
- title: emptyTitle,
30119
- description: emptyDescription,
30120
- suggestions: emptySuggestions,
30121
- onPick: emptySuggestions ? (prompt) => void chat.sendMessage(prompt) : void 0
30122
- }
30123
- ) : /* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-2xl space-y-5", role: "log", "aria-live": "polite", children: chat.turns.map((turn) => {
30124
- const isLastTurn = turn.id === lastTurnId;
30125
- const lastAssistantIndex = turn.assistants.length - 1;
30126
- return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
30127
- turn.user ? /* @__PURE__ */ jsx(UserMessageView, { message: turn.user }) : null,
30128
- turn.assistants.map((message, index2) => {
30129
- const isLastAssistant = index2 === lastAssistantIndex;
30130
- const streaming = chat.isStreaming && isLastTurn && isLastAssistant;
30131
- const canRegenerate = !chat.mutationsBlocked && !chat.isStreaming && isLastTurn && isLastAssistant && Boolean(turn.user?.content);
30132
- return /* @__PURE__ */ jsx(
30133
- AssistantMessageView,
30134
- {
30135
- message,
30136
- isStreaming: streaming,
30137
- onRegenerate: canRegenerate ? () => void chat.sendMessage(turn.user?.content) : void 0
30138
- },
30139
- message.id
30140
- );
30141
- }),
30142
- isLastTurn && inFlight && (chat.hideComposer || turn.assistants.length === 0) ? /* @__PURE__ */ jsx(PendingAssistantMessage, {}) : null
30143
- ] }, turn.id);
30144
- }) }),
30145
- chat.error ? /* @__PURE__ */ jsxs("div", { className: "mx-auto mt-4 flex w-full max-w-2xl items-center justify-between gap-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: [
30146
- /* @__PURE__ */ jsx("span", { className: "truncate", children: chat.error instanceof Error ? chat.error.message : String(chat.error) }),
30147
- /* @__PURE__ */ jsx(
30148
- "button",
30149
- {
30150
- type: "button",
30151
- onClick: chat.loadHistory,
30152
- className: "shrink-0 rounded-md px-2 py-1 text-xs hover:bg-destructive/10",
30153
- children: "Retry"
30154
- }
30155
- )
30156
- ] }) : null
30157
- ]
30158
- }
30159
- ),
30160
- !chat.hideComposer ? /* @__PURE__ */ jsxs("div", { className: "relative shrink-0", children: [
30161
- /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-x-0 -top-6 h-6 bg-gradient-to-t from-background to-transparent" }),
30162
- /* @__PURE__ */ jsx(
30163
- Composer,
30164
- {
30165
- value: chat.input,
30166
- placeholder,
30167
- disabled: chat.mutationsBlocked,
30168
- inFlight,
30169
- canSubmit: chat.canSubmit,
30170
- canAbort: chat.canAbort,
30171
- chips: composerChips,
30172
- pendingFiles: chat.pendingFiles,
30173
- enableAttachments: attachmentsEnabled,
30174
- phase: chat.phase,
30175
- queueLength: chat.queueLength,
30176
- onChange: chat.setInput,
30177
- onSubmit: () => void chat.sendMessage(),
30178
- onAbort: () => void chat.abort(),
30179
- onPickChip: (value) => void chat.sendMessage(value),
30180
- onAttach: (files) => void chat.attachFiles(files),
30181
- onRemoveFile: chat.removePendingFile
30182
- }
30183
- )
30184
- ] }) : null
30185
- ] }) });
29795
+ headerRight,
29796
+ labels,
29797
+ features,
29798
+ renderers,
29799
+ historyLimit,
29800
+ watchdog,
29801
+ discoveryPoll,
29802
+ disabled,
29803
+ readOnly,
29804
+ onTurnComplete: () => {
29805
+ onTurnComplete?.();
29806
+ onDataChange?.();
29807
+ },
29808
+ className: cn$2("min-h-0 rounded-none border-0 shadow-none", className)
29809
+ }
29810
+ );
30186
29811
  }
30187
29812
  function newSessionId(prefix) {
30188
29813
  return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
@@ -30195,13 +29820,13 @@ function AssistantPage({
30195
29820
  scopes,
30196
29821
  suggestions,
30197
29822
  placeholder,
30198
- emptyTitle,
30199
- emptyDescription,
30200
29823
  toolRenderers,
30201
29824
  onDataChange,
30202
29825
  enableAttachments,
29826
+ webSearch,
30203
29827
  historyLimit,
30204
29828
  discoveryPoll,
29829
+ activityPollMs,
30205
29830
  disabled,
30206
29831
  readOnly,
30207
29832
  sessionFilter,
@@ -30209,7 +29834,15 @@ function AssistantPage({
30209
29834
  className
30210
29835
  }) {
30211
29836
  const mutationsBlocked = areAgentChatMutationsBlocked(disabled, readOnly);
30212
- const sessions = useAgentChatSessions({ agentId, transport, sessionFilter, autoLoad: true, disabled, readOnly });
29837
+ const sessions = useAgentChatSessions({
29838
+ agentId,
29839
+ transport,
29840
+ sessionFilter,
29841
+ autoLoad: true,
29842
+ activityPollMs,
29843
+ disabled,
29844
+ readOnly
29845
+ });
30213
29846
  const [activeSessionId, setActiveSessionId] = useState(void 0);
30214
29847
  const [railOpen, setRailOpen] = useState(true);
30215
29848
  useEffect(() => {
@@ -30220,12 +29853,12 @@ function AssistantPage({
30220
29853
  setActiveSessionId(newSessionId(newChatPrefix));
30221
29854
  }
30222
29855
  }, [activeSessionId, mutationsBlocked, sessions.isLoading, sessions.activeSessionId, newChatPrefix]);
30223
- const noSessionAvailable = mutationsBlocked && !sessions.isLoading && !activeSessionId && sessions.sessions.length === 0;
30224
29856
  const chatDisabled = Boolean(disabled || !activeSessionId);
30225
- const handleNew = mutationsBlocked ? void 0 : () => setActiveSessionId(newSessionId(newChatPrefix));
29857
+ const startNewChat = useCallback(() => setActiveSessionId(newSessionId(newChatPrefix)), [newChatPrefix]);
29858
+ const handleNew = mutationsBlocked ? void 0 : startNewChat;
30226
29859
  const handleRename = mutationsBlocked ? void 0 : (id, name2) => void sessions.renameSession(id, name2);
30227
29860
  return /* @__PURE__ */ jsxs("div", { className: cn$2("flex min-h-0 overflow-hidden bg-card", className), children: [
30228
- railOpen ? /* @__PURE__ */ jsx(
29861
+ railOpen && /* @__PURE__ */ jsx(
30229
29862
  SessionRail,
30230
29863
  {
30231
29864
  sessions: sessions.sessions,
@@ -30235,7 +29868,7 @@ function AssistantPage({
30235
29868
  onNew: handleNew,
30236
29869
  onRename: handleRename
30237
29870
  }
30238
- ) : null,
29871
+ ),
30239
29872
  /* @__PURE__ */ jsx(
30240
29873
  AssistantChat,
30241
29874
  {
@@ -30248,11 +29881,11 @@ function AssistantPage({
30248
29881
  scopes,
30249
29882
  suggestions,
30250
29883
  placeholder,
30251
- emptyTitle: noSessionAvailable ? "No conversations yet" : emptyTitle,
30252
- emptyDescription: noSessionAvailable ? "There are no existing conversations to review." : emptyDescription,
30253
29884
  toolRenderers,
30254
29885
  onDataChange,
29886
+ onNewChat: handleNew,
30255
29887
  enableAttachments,
29888
+ webSearch,
30256
29889
  historyLimit,
30257
29890
  discoveryPoll,
30258
29891
  disabled: chatDisabled,
@@ -30264,7 +29897,7 @@ function AssistantPage({
30264
29897
  type: "button",
30265
29898
  onClick: () => setRailOpen((open2) => !open2),
30266
29899
  "aria-label": railOpen ? "Hide conversations" : "Show conversations",
30267
- className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground",
29900
+ className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-muted hover:text-foreground",
30268
29901
  children: railOpen ? /* @__PURE__ */ jsx(PanelLeftClose, { className: "size-4" }) : /* @__PURE__ */ jsx(PanelLeftOpen, { className: "size-4" })
30269
29902
  }
30270
29903
  )
@@ -30273,147 +29906,6 @@ function AssistantPage({
30273
29906
  )
30274
29907
  ] });
30275
29908
  }
30276
- function SessionRail({
30277
- sessions,
30278
- activeSessionId,
30279
- isLoading,
30280
- onSelect,
30281
- onNew,
30282
- onRename
30283
- }) {
30284
- const [renamingId, setRenamingId] = useState(null);
30285
- const [renameValue, setRenameValue] = useState("");
30286
- const startRename = (id, name2) => {
30287
- setRenamingId(id);
30288
- setRenameValue(name2 ?? "");
30289
- };
30290
- const commitRename = (id) => {
30291
- const name2 = renameValue.trim();
30292
- setRenamingId(null);
30293
- if (name2) void onRename?.(id, name2);
30294
- };
30295
- return /* @__PURE__ */ jsxs("aside", { className: "flex w-60 shrink-0 flex-col border-r bg-card", children: [
30296
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 px-3 py-2.5", children: [
30297
- /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: [
30298
- /* @__PURE__ */ jsx(MessagesSquare, { className: "size-3.5" }),
30299
- " Chats"
30300
- ] }),
30301
- onNew ? /* @__PURE__ */ jsxs(
30302
- "button",
30303
- {
30304
- type: "button",
30305
- onClick: onNew,
30306
- className: "inline-flex items-center gap-1 rounded-lg bg-primary px-2 py-1 text-xs font-medium text-primary-foreground transition hover:opacity-90",
30307
- children: [
30308
- /* @__PURE__ */ jsx(Plus, { className: "size-3.5" }),
30309
- " New"
30310
- ]
30311
- }
30312
- ) : null
30313
- ] }),
30314
- /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-y-auto px-2 pb-2", children: isLoading && sessions.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 p-1", children: [
30315
- /* @__PURE__ */ jsx("div", { className: "h-12 animate-pulse rounded-lg bg-muted" }),
30316
- /* @__PURE__ */ jsx("div", { className: "h-12 animate-pulse rounded-lg bg-muted" }),
30317
- /* @__PURE__ */ jsx("div", { className: "h-12 animate-pulse rounded-lg bg-muted" })
30318
- ] }) : sessions.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-2 py-6 text-center text-xs text-muted-foreground", children: "No conversations yet." }) : /* @__PURE__ */ jsx("div", { className: "space-y-3", children: groupSessions(sessions).map((group) => /* @__PURE__ */ jsxs("div", { children: [
30319
- /* @__PURE__ */ jsx("p", { className: "px-2 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/80", children: group.label }),
30320
- /* @__PURE__ */ jsx("ul", { className: "space-y-0.5", children: group.items.map((session) => {
30321
- const isActive2 = session.id === activeSessionId;
30322
- const isRenaming = renamingId === session.id;
30323
- const title = prettySessionTitle(session);
30324
- return /* @__PURE__ */ jsx("li", { children: isRenaming ? /* @__PURE__ */ jsx(
30325
- "input",
30326
- {
30327
- autoFocus: true,
30328
- value: renameValue,
30329
- onChange: (e) => setRenameValue(e.target.value),
30330
- onBlur: () => commitRename(session.id),
30331
- onKeyDown: (e) => {
30332
- if (e.key === "Enter") {
30333
- e.preventDefault();
30334
- commitRename(session.id);
30335
- }
30336
- if (e.key === "Escape") setRenamingId(null);
30337
- },
30338
- className: "h-9 w-full rounded-lg border bg-background px-2.5 text-sm outline-none focus:ring-2 focus:ring-ring/40"
30339
- }
30340
- ) : /* @__PURE__ */ jsxs(
30341
- "button",
30342
- {
30343
- type: "button",
30344
- onClick: () => onSelect(session.id),
30345
- onDoubleClick: onRename ? () => startRename(session.id, title) : void 0,
30346
- className: cn$2(
30347
- "group flex w-full flex-col items-start gap-0.5 rounded-lg px-2.5 py-2 text-left transition",
30348
- isActive2 ? "bg-primary/10 text-primary" : "hover:bg-accent"
30349
- ),
30350
- children: [
30351
- /* @__PURE__ */ jsxs("span", { className: "flex w-full items-center gap-1", children: [
30352
- /* @__PURE__ */ jsx("span", { className: "line-clamp-1 flex-1 text-sm font-medium", children: title }),
30353
- onRename ? /* @__PURE__ */ jsx(
30354
- Pencil,
30355
- {
30356
- className: "size-3 shrink-0 text-muted-foreground opacity-0 transition group-hover:opacity-100",
30357
- onClick: (e) => {
30358
- e.stopPropagation();
30359
- startRename(session.id, title);
30360
- }
30361
- }
30362
- ) : null
30363
- ] }),
30364
- /* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: formatRelative(session.lastUsedAt ?? session.createdAt) })
30365
- ]
30366
- }
30367
- ) }, session.id);
30368
- }) })
30369
- ] }, group.label)) }) })
30370
- ] });
30371
- }
30372
- function prettySessionTitle(session) {
30373
- const raw2 = (session.name ?? "").trim();
30374
- if (!raw2) return "New chat";
30375
- if (/^[[{]/.test(raw2) || raw2.includes("current_date") || raw2.includes('"task_id"')) {
30376
- return "Untitled chat";
30377
- }
30378
- return raw2.replace(/^["'`#>\s-]+/, "").slice(0, 60).trim() || "Untitled chat";
30379
- }
30380
- function groupSessions(sessions) {
30381
- const now = /* @__PURE__ */ new Date();
30382
- const startToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
30383
- const day = 864e5;
30384
- const today = [];
30385
- const yesterday = [];
30386
- const week = [];
30387
- const older = [];
30388
- for (const s2 of sessions) {
30389
- const t = new Date(s2.lastUsedAt ?? s2.createdAt ?? "").getTime();
30390
- if (Number.isNaN(t)) older.push(s2);
30391
- else if (t >= startToday) today.push(s2);
30392
- else if (t >= startToday - day) yesterday.push(s2);
30393
- else if (t >= startToday - 7 * day) week.push(s2);
30394
- else older.push(s2);
30395
- }
30396
- return [
30397
- { label: "Today", items: today },
30398
- { label: "Yesterday", items: yesterday },
30399
- { label: "Previous 7 days", items: week },
30400
- { label: "Older", items: older }
30401
- ].filter((g2) => g2.items.length > 0);
30402
- }
30403
- function formatRelative(value) {
30404
- if (!value) return "";
30405
- const then = new Date(value).getTime();
30406
- if (Number.isNaN(then)) return "";
30407
- const diff = Date.now() - then;
30408
- const min2 = Math.round(diff / 6e4);
30409
- if (min2 < 1) return "just now";
30410
- if (min2 < 60) return `${min2}m ago`;
30411
- const hr = Math.round(min2 / 60);
30412
- if (hr < 24) return `${hr}h ago`;
30413
- const day = Math.round(hr / 24);
30414
- if (day < 7) return `${day}d ago`;
30415
- return new Date(value).toLocaleDateString();
30416
- }
30417
29909
  function AssistantWidget({
30418
29910
  agentId,
30419
29911
  sessionId,
@@ -30423,10 +29915,10 @@ function AssistantWidget({
30423
29915
  suggestions,
30424
29916
  quickActions,
30425
29917
  placeholder,
30426
- emptyTitle,
30427
- emptyDescription,
30428
29918
  toolRenderers,
30429
29919
  onDataChange,
29920
+ enableAttachments,
29921
+ webSearch,
30430
29922
  historyLimit,
30431
29923
  disabled,
30432
29924
  readOnly,
@@ -30440,56 +29932,60 @@ function AssistantWidget({
30440
29932
  "button",
30441
29933
  {
30442
29934
  type: "button",
30443
- onClick: () => setOpen((o) => !o),
30444
- className: "fixed bottom-5 right-5 z-50 flex size-12 items-center justify-center rounded-full bg-foreground text-background shadow-lg transition-transform hover:scale-105 active:scale-95",
29935
+ onClick: () => setOpen((value) => !value),
29936
+ className: "fixed right-5 bottom-5 z-50 flex size-12 items-center justify-center rounded-full bg-foreground text-background shadow-lg transition-transform hover:scale-105 active:scale-95",
30445
29937
  "aria-label": open2 ? "Close assistant" : "Open assistant",
30446
- children: open2 ? /* @__PURE__ */ jsx(X$2, { className: "size-5" }) : /* @__PURE__ */ jsx(Bot, { className: "size-5" })
29938
+ children: open2 ? /* @__PURE__ */ jsx(X$2, { className: "size-5", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(Bot, { className: "size-5", "aria-hidden": "true" })
30447
29939
  }
30448
29940
  ),
30449
- open2 ? /* @__PURE__ */ jsxs("div", { className: "fixed bottom-20 right-5 z-50 flex h-[min(560px,calc(100vh-7rem))] w-[400px] max-w-[calc(100vw-2.5rem)] flex-col overflow-hidden rounded-2xl border bg-card shadow-2xl animate-in fade-in slide-in-from-bottom-2 duration-150", children: [
30450
- /* @__PURE__ */ jsxs("header", { className: "flex items-center gap-2 border-b px-4 py-3", children: [
30451
- /* @__PURE__ */ jsx("div", { className: "flex size-7 items-center justify-center rounded-full bg-foreground text-xs font-bold text-background", children: "L" }),
29941
+ open2 && /* @__PURE__ */ jsx("div", { className: "fixed right-5 bottom-20 z-50 flex h-[min(640px,calc(100vh-7rem))] w-[440px] max-w-[calc(100vw-2.5rem)] flex-col overflow-hidden rounded-2xl border border-border bg-background shadow-2xl animate-[agent-chat-in_.15s_ease-out]", children: loading || error2 || !transport ? /* @__PURE__ */ jsxs(Fragment, { children: [
29942
+ /* @__PURE__ */ jsxs("header", { className: "flex items-center gap-3 border-b border-border px-4 py-3", children: [
30452
29943
  /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
30453
- /* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium", children: title }),
30454
- subtitle ? /* @__PURE__ */ jsx("p", { className: "truncate text-xs text-muted-foreground", children: subtitle }) : null
29944
+ /* @__PURE__ */ jsx("p", { className: "truncate text-sm font-semibold leading-tight", children: title }),
29945
+ subtitle && /* @__PURE__ */ jsx("p", { className: "truncate text-xs text-muted-foreground", children: subtitle })
30455
29946
  ] }),
30456
- /* @__PURE__ */ jsx(
30457
- "button",
30458
- {
30459
- type: "button",
30460
- onClick: () => setOpen(false),
30461
- "aria-label": "Close",
30462
- className: "rounded-lg p-1 text-muted-foreground transition hover:bg-accent hover:text-foreground",
30463
- children: /* @__PURE__ */ jsx(X$2, { className: "size-4" })
30464
- }
30465
- )
29947
+ /* @__PURE__ */ jsx(CloseButton, { onClick: () => setOpen(false) })
30466
29948
  ] }),
30467
- /* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 flex-col", children: loading ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-4 text-sm text-muted-foreground", children: [
30468
- /* @__PURE__ */ jsx(LoaderCircle, { className: "size-4 animate-spin" }),
29949
+ loading ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-4 text-sm text-muted-foreground", children: [
29950
+ /* @__PURE__ */ jsx(LoaderCircle, { className: "size-4 animate-spin", "aria-hidden": "true" }),
30469
29951
  " Loading…"
30470
- ] }) : error2 || !transport ? /* @__PURE__ */ jsx("div", { className: "p-4 text-sm text-destructive", children: error2 || "Could not connect." }) : /* @__PURE__ */ jsx(
30471
- AssistantChat,
30472
- {
30473
- className: "min-h-0 flex-1",
30474
- showHeader: false,
30475
- agentId,
30476
- sessionId,
30477
- transport,
30478
- suggestions,
30479
- composerChips: quickActions,
30480
- placeholder,
30481
- emptyTitle: emptyTitle ?? "Ask Lumera",
30482
- emptyDescription,
30483
- toolRenderers,
30484
- onDataChange,
30485
- historyLimit,
30486
- disabled,
30487
- readOnly
30488
- }
30489
- ) })
30490
- ] }) : null
29952
+ ] }) : /* @__PURE__ */ jsx("div", { className: "p-4 text-sm text-destructive", children: error2 || "Could not connect." })
29953
+ ] }) : /* @__PURE__ */ jsx(
29954
+ AssistantChat,
29955
+ {
29956
+ className: "min-h-0 flex-1",
29957
+ agentId,
29958
+ sessionId,
29959
+ transport,
29960
+ title,
29961
+ subtitle,
29962
+ suggestions,
29963
+ composerChips: quickActions,
29964
+ placeholder,
29965
+ toolRenderers,
29966
+ onDataChange,
29967
+ enableAttachments,
29968
+ webSearch,
29969
+ historyLimit,
29970
+ disabled,
29971
+ readOnly,
29972
+ headerRight: /* @__PURE__ */ jsx(CloseButton, { onClick: () => setOpen(false) })
29973
+ }
29974
+ ) })
30491
29975
  ] });
30492
29976
  }
29977
+ function CloseButton({ onClick }) {
29978
+ return /* @__PURE__ */ jsx(
29979
+ "button",
29980
+ {
29981
+ type: "button",
29982
+ onClick,
29983
+ "aria-label": "Close",
29984
+ className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-muted hover:text-foreground",
29985
+ children: /* @__PURE__ */ jsx(X$2, { className: "size-4", "aria-hidden": "true" })
29986
+ }
29987
+ );
29988
+ }
30493
29989
  function RunDownloadAction({ run }) {
30494
29990
  const [isDownloading, setIsDownloading] = useState(false);
30495
29991
  const files = run.artifacts;
@@ -41733,6 +41229,7 @@ export {
41733
41229
  At as J,
41734
41230
  Li as L,
41735
41231
  RecordSheet as R,
41232
+ SessionRail as S,
41736
41233
  ToolCallCard as T,
41737
41234
  AgentChat as a,
41738
41235
  AgentChatMarkdown as b,