@lumerahq/ui 0.10.0 → 0.11.0-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,11 +1,11 @@
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, cloneElement, isValidElement, useCallback, Suspense, lazy, useLayoutEffect } from "react";
3
+ import React__default, { useContext, createContext, forwardRef, createElement, memo, useId as useId$1, useTransition, useMemo, useRef, useEffect, useState, cloneElement, isValidElement, useCallback, Suspense, lazy, Fragment as Fragment$1, useLayoutEffect } from "react";
4
+ import { u as useAgentChat, a as useAgentChatSessions, b as useAutomationRun } from "./use-automation-run-BNFRnQEA.js";
4
5
  import { t as twMerge, p as clsx, o as cn$2, a as formatCellValue$2 } from "./formatters-D4T821Dv.js";
6
+ import { f as getDownloadUrl, t as pbSql, p as parentApiRequest, d as parentApiStream, B as BridgeError, z as automationStatuses, L as getAutomationRunFileDownloadUrl, R as listAutomationRunFiles } from "./automations-Bb9nlU05.js";
5
7
  import * as ReactDOM from "react-dom";
6
8
  import { createPortal } from "react-dom";
7
- import { u as useAgentChat, a as useAutomationRun } from "./use-automation-run-Bj17PZB_.js";
8
- import { f as getDownloadUrl, t as pbSql, p as parentApiRequest, d as parentApiStream, B as BridgeError, z as automationStatuses, L as getAutomationRunFileDownloadUrl, R as listAutomationRunFiles } from "./automations-Bb9nlU05.js";
9
9
  const mergeClasses = (...classes) => classes.filter((className, index2, array) => {
10
10
  return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index2;
11
11
  }).join(" ").trim();
@@ -85,24 +85,24 @@ const createLucideIcon = (iconName, iconNode) => {
85
85
  Component.displayName = toPascalCase(iconName);
86
86
  return Component;
87
87
  };
88
- const __iconNode$y = [
88
+ const __iconNode$G = [
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$y);
93
- const __iconNode$x = [
92
+ const ArrowDown = createLucideIcon("arrow-down", __iconNode$G);
93
+ const __iconNode$F = [
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$x);
100
- const __iconNode$w = [
99
+ const ArrowUpDown = createLucideIcon("arrow-up-down", __iconNode$F);
100
+ const __iconNode$E = [
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$w);
105
- const __iconNode$v = [
104
+ const ArrowUp = createLucideIcon("arrow-up", __iconNode$E);
105
+ const __iconNode$D = [
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$v = [
110
110
  ["path", { d: "M15 13v2", key: "1xurst" }],
111
111
  ["path", { d: "M9 13v2", key: "rq6x2g" }]
112
112
  ];
113
- const Bot = createLucideIcon("bot", __iconNode$v);
114
- const __iconNode$u = [
113
+ const Bot = createLucideIcon("bot", __iconNode$D);
114
+ const __iconNode$C = [
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,56 +121,61 @@ const __iconNode$u = [
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$u);
125
- const __iconNode$t = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
126
- const Check = createLucideIcon("check", __iconNode$t);
127
- const __iconNode$s = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
128
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$s);
129
- const __iconNode$r = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
130
- const ChevronLeft = createLucideIcon("chevron-left", __iconNode$r);
131
- const __iconNode$q = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
132
- const ChevronRight = createLucideIcon("chevron-right", __iconNode$q);
133
- const __iconNode$p = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
134
- const ChevronUp = createLucideIcon("chevron-up", __iconNode$p);
135
- const __iconNode$o = [
124
+ const Brain = createLucideIcon("brain", __iconNode$C);
125
+ const __iconNode$B = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
126
+ const Check = createLucideIcon("check", __iconNode$B);
127
+ const __iconNode$A = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
128
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$A);
129
+ const __iconNode$z = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
130
+ const ChevronLeft = createLucideIcon("chevron-left", __iconNode$z);
131
+ const __iconNode$y = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
132
+ const ChevronRight = createLucideIcon("chevron-right", __iconNode$y);
133
+ const __iconNode$x = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
134
+ const ChevronUp = createLucideIcon("chevron-up", __iconNode$x);
135
+ const __iconNode$w = [
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$o);
140
- const __iconNode$n = [
139
+ const ChevronsLeft = createLucideIcon("chevrons-left", __iconNode$w);
140
+ const __iconNode$v = [
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$n);
145
- const __iconNode$m = [
144
+ const ChevronsRight = createLucideIcon("chevrons-right", __iconNode$v);
145
+ const __iconNode$u = [
146
146
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
147
147
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
148
148
  ];
149
- const CircleCheck = createLucideIcon("circle-check", __iconNode$m);
150
- const __iconNode$l = [
149
+ const CircleCheck = createLucideIcon("circle-check", __iconNode$u);
150
+ const __iconNode$t = [
151
151
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
152
152
  ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
153
153
  ["path", { d: "m9 9 6 6", key: "z0biqf" }]
154
154
  ];
155
- const CircleX = createLucideIcon("circle-x", __iconNode$l);
156
- const __iconNode$k = [
155
+ const CircleX = createLucideIcon("circle-x", __iconNode$t);
156
+ const __iconNode$s = [
157
157
  ["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
158
158
  ["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
159
159
  ];
160
- const Code = createLucideIcon("code", __iconNode$k);
161
- const __iconNode$j = [
160
+ const Code = createLucideIcon("code", __iconNode$s);
161
+ const __iconNode$r = [
162
+ ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
163
+ ["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" }]
164
+ ];
165
+ const Copy = createLucideIcon("copy", __iconNode$r);
166
+ const __iconNode$q = [
162
167
  ["path", { d: "M12 15V3", key: "m9g1x1" }],
163
168
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
164
169
  ["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
165
170
  ];
166
- const Download = createLucideIcon("download", __iconNode$j);
167
- const __iconNode$i = [
171
+ const Download = createLucideIcon("download", __iconNode$q);
172
+ const __iconNode$p = [
168
173
  ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
169
174
  ["path", { d: "M10 14 21 3", key: "gplh6r" }],
170
175
  ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
171
176
  ];
172
- const ExternalLink = createLucideIcon("external-link", __iconNode$i);
173
- const __iconNode$h = [
177
+ const ExternalLink = createLucideIcon("external-link", __iconNode$p);
178
+ const __iconNode$o = [
174
179
  [
175
180
  "path",
176
181
  {
@@ -184,8 +189,8 @@ const __iconNode$h = [
184
189
  ["path", { d: "M8 17h2", key: "2yhykz" }],
185
190
  ["path", { d: "M14 17h2", key: "10kma7" }]
186
191
  ];
187
- const FileSpreadsheet = createLucideIcon("file-spreadsheet", __iconNode$h);
188
- const __iconNode$g = [
192
+ const FileSpreadsheet = createLucideIcon("file-spreadsheet", __iconNode$o);
193
+ const __iconNode$n = [
189
194
  [
190
195
  "path",
191
196
  {
@@ -198,8 +203,8 @@ const __iconNode$g = [
198
203
  ["path", { d: "M16 13H8", key: "t4e002" }],
199
204
  ["path", { d: "M16 17H8", key: "z1uh3a" }]
200
205
  ];
201
- const FileText = createLucideIcon("file-text", __iconNode$g);
202
- const __iconNode$f = [
206
+ const FileText = createLucideIcon("file-text", __iconNode$n);
207
+ const __iconNode$m = [
203
208
  [
204
209
  "path",
205
210
  {
@@ -209,8 +214,8 @@ const __iconNode$f = [
209
214
  ],
210
215
  ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
211
216
  ];
212
- const File = createLucideIcon("file", __iconNode$f);
213
- const __iconNode$e = [
217
+ const File = createLucideIcon("file", __iconNode$m);
218
+ const __iconNode$l = [
214
219
  [
215
220
  "path",
216
221
  {
@@ -219,36 +224,65 @@ const __iconNode$e = [
219
224
  }
220
225
  ]
221
226
  ];
222
- const Funnel = createLucideIcon("funnel", __iconNode$e);
223
- const __iconNode$d = [
227
+ const Funnel = createLucideIcon("funnel", __iconNode$l);
228
+ const __iconNode$k = [
224
229
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
225
230
  ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
226
231
  ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
227
232
  ];
228
- const Image$1 = createLucideIcon("image", __iconNode$d);
229
- const __iconNode$c = [
233
+ const Image$1 = createLucideIcon("image", __iconNode$k);
234
+ const __iconNode$j = [
230
235
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
231
236
  ["path", { d: "M12 16v-4", key: "1dtifu" }],
232
237
  ["path", { d: "M12 8h.01", key: "e9boi3" }]
233
238
  ];
234
- const Info$1 = createLucideIcon("info", __iconNode$c);
235
- const __iconNode$b = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
236
- const LoaderCircle = createLucideIcon("loader-circle", __iconNode$b);
237
- const __iconNode$a = [
239
+ const Info$1 = createLucideIcon("info", __iconNode$j);
240
+ const __iconNode$i = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
241
+ const LoaderCircle = createLucideIcon("loader-circle", __iconNode$i);
242
+ const __iconNode$h = [
238
243
  ["path", { d: "M8 3H5a2 2 0 0 0-2 2v3", key: "1dcmit" }],
239
244
  ["path", { d: "M21 8V5a2 2 0 0 0-2-2h-3", key: "1e4gt3" }],
240
245
  ["path", { d: "M3 16v3a2 2 0 0 0 2 2h3", key: "wsl5sc" }],
241
246
  ["path", { d: "M16 21h3a2 2 0 0 0 2-2v-3", key: "18trek" }]
242
247
  ];
243
- const Maximize = createLucideIcon("maximize", __iconNode$a);
244
- const __iconNode$9 = [
248
+ const Maximize = createLucideIcon("maximize", __iconNode$h);
249
+ const __iconNode$g = [
250
+ [
251
+ "path",
252
+ {
253
+ d: "M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",
254
+ key: "1n2ejm"
255
+ }
256
+ ],
257
+ [
258
+ "path",
259
+ {
260
+ d: "M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",
261
+ key: "1qfcsi"
262
+ }
263
+ ]
264
+ ];
265
+ const MessagesSquare = createLucideIcon("messages-square", __iconNode$g);
266
+ const __iconNode$f = [
245
267
  ["path", { d: "M8 3v3a2 2 0 0 1-2 2H3", key: "hohbtr" }],
246
268
  ["path", { d: "M21 8h-3a2 2 0 0 1-2-2V3", key: "5jw1f3" }],
247
269
  ["path", { d: "M3 16h3a2 2 0 0 1 2 2v3", key: "198tvr" }],
248
270
  ["path", { d: "M16 21v-3a2 2 0 0 1 2-2h3", key: "ph8mxp" }]
249
271
  ];
250
- const Minimize = createLucideIcon("minimize", __iconNode$9);
251
- const __iconNode$8 = [
272
+ const Minimize = createLucideIcon("minimize", __iconNode$f);
273
+ const __iconNode$e = [
274
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
275
+ ["path", { d: "M9 3v18", key: "fh3hqa" }],
276
+ ["path", { d: "m16 15-3-3 3-3", key: "14y99z" }]
277
+ ];
278
+ const PanelLeftClose = createLucideIcon("panel-left-close", __iconNode$e);
279
+ const __iconNode$d = [
280
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
281
+ ["path", { d: "M9 3v18", key: "fh3hqa" }],
282
+ ["path", { d: "m14 9 3 3-3 3", key: "8010ee" }]
283
+ ];
284
+ const PanelLeftOpen = createLucideIcon("panel-left-open", __iconNode$d);
285
+ const __iconNode$c = [
252
286
  [
253
287
  "path",
254
288
  {
@@ -257,20 +291,31 @@ const __iconNode$8 = [
257
291
  }
258
292
  ]
259
293
  ];
260
- const Paperclip = createLucideIcon("paperclip", __iconNode$8);
261
- const __iconNode$7 = [
294
+ const Paperclip = createLucideIcon("paperclip", __iconNode$c);
295
+ const __iconNode$b = [
296
+ [
297
+ "path",
298
+ {
299
+ d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
300
+ key: "1a8usu"
301
+ }
302
+ ],
303
+ ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
304
+ ];
305
+ const Pencil = createLucideIcon("pencil", __iconNode$b);
306
+ const __iconNode$a = [
262
307
  ["path", { d: "M5 12h14", key: "1ays0h" }],
263
308
  ["path", { d: "M12 5v14", key: "s699le" }]
264
309
  ];
265
- const Plus = createLucideIcon("plus", __iconNode$7);
266
- const __iconNode$6 = [
310
+ const Plus = createLucideIcon("plus", __iconNode$a);
311
+ const __iconNode$9 = [
267
312
  ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
268
313
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
269
314
  ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
270
315
  ["path", { d: "M8 16H3v5", key: "1cv678" }]
271
316
  ];
272
- const RefreshCw = createLucideIcon("refresh-cw", __iconNode$6);
273
- const __iconNode$5 = [
317
+ const RefreshCw = createLucideIcon("refresh-cw", __iconNode$9);
318
+ const __iconNode$8 = [
274
319
  [
275
320
  "path",
276
321
  {
@@ -280,11 +325,46 @@ const __iconNode$5 = [
280
325
  ],
281
326
  ["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
282
327
  ];
283
- const Send = createLucideIcon("send", __iconNode$5);
284
- const __iconNode$4 = [
328
+ const Send = createLucideIcon("send", __iconNode$8);
329
+ const __iconNode$7 = [
330
+ [
331
+ "path",
332
+ {
333
+ 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",
334
+ key: "1s2grr"
335
+ }
336
+ ],
337
+ ["path", { d: "M20 2v4", key: "1rf3ol" }],
338
+ ["path", { d: "M22 4h-4", key: "gwowj6" }],
339
+ ["circle", { cx: "4", cy: "20", r: "2", key: "6kqj1y" }]
340
+ ];
341
+ const Sparkles = createLucideIcon("sparkles", __iconNode$7);
342
+ const __iconNode$6 = [
285
343
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }]
286
344
  ];
287
- const Square = createLucideIcon("square", __iconNode$4);
345
+ const Square = createLucideIcon("square", __iconNode$6);
346
+ const __iconNode$5 = [
347
+ [
348
+ "path",
349
+ {
350
+ 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",
351
+ key: "m61m77"
352
+ }
353
+ ],
354
+ ["path", { d: "M17 14V2", key: "8ymqnk" }]
355
+ ];
356
+ const ThumbsDown = createLucideIcon("thumbs-down", __iconNode$5);
357
+ const __iconNode$4 = [
358
+ [
359
+ "path",
360
+ {
361
+ 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",
362
+ key: "emmmcr"
363
+ }
364
+ ],
365
+ ["path", { d: "M7 10v12", key: "1qc93n" }]
366
+ ];
367
+ const ThumbsUp = createLucideIcon("thumbs-up", __iconNode$4);
288
368
  const __iconNode$3 = [
289
369
  ["path", { d: "M10 11v6", key: "nco0om" }],
290
370
  ["path", { d: "M14 11v6", key: "outv1u" }],
@@ -23930,7 +24010,7 @@ var lr = (e) => {
23930
24010
  for (; t > 0 && e[t - 1] === `
23931
24011
  `; ) t--;
23932
24012
  return e.slice(0, t);
23933
- }, cr = lazy(() => import("./highlighted-body-OFNGDK62-C-pMiyu6.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), st = ({ code: e, language: t, className: o, children: n, isIncomplete: r = false, startLine: s2, lineNumbers: a, ...l }) => {
24013
+ }, cr = lazy(() => import("./highlighted-body-OFNGDK62-CkjebXGv.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), st = ({ code: e, language: t, className: o, children: n, isIncomplete: r = false, startLine: s2, lineNumbers: a, ...l }) => {
23934
24014
  let i = y2(), d2 = useMemo(() => lr(e), [e]), c2 = useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: d2.split(`
23935
24015
  `).map((p2) => [{ content: p2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [d2]);
23936
24016
  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 }) })] }) });
@@ -24292,7 +24372,7 @@ var vo = ({ children: e, className: t, showControls: o, showCopy: n = true, show
24292
24372
  let l = y2(), i = o && n, d2 = o && r, c2 = o && s2, p2 = i || d2 || c2;
24293
24373
  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 }) })] });
24294
24374
  };
24295
- var es = /startLine=(\d+)/, ts = /\bnoLineNumbers\b/, os = lazy(() => import("./mermaid-GHXKKRXX-BGPCb6N_.js").then((e) => ({ default: e.Mermaid }))), ns = /language-([^\s]+)/;
24375
+ var es = /startLine=(\d+)/, ts = /\bnoLineNumbers\b/, os = lazy(() => import("./mermaid-GHXKKRXX-7A_3bGu2.js").then((e) => ({ default: e.Mermaid }))), ns = /language-([^\s]+)/;
24296
24376
  function qe(e, t) {
24297
24377
  if (!(e != null && e.position || t != null && t.position)) return true;
24298
24378
  if (!(e != null && e.position && (t != null && t.position))) return false;
@@ -27331,11 +27411,11 @@ function AgentChat({
27331
27411
  window.addEventListener("pointermove", onMove);
27332
27412
  window.addEventListener("pointerup", onUp);
27333
27413
  };
27334
- const EmptyState = renderers?.EmptyState ?? DefaultEmptyState;
27414
+ const EmptyState2 = renderers?.EmptyState ?? DefaultEmptyState;
27335
27415
  const LoadingState = renderers?.LoadingState ?? DefaultLoadingState;
27336
27416
  const ErrorState = renderers?.ErrorState ?? DefaultErrorState;
27337
27417
  const LoadEarlierButton = renderers?.LoadEarlierButton ?? DefaultLoadEarlierButton;
27338
- const Composer = renderers?.Composer ?? DefaultComposer;
27418
+ const Composer2 = renderers?.Composer ?? DefaultComposer;
27339
27419
  return /* @__PURE__ */ jsx(ToolRenderersProvider, { renderers: renderers?.toolRenderers, children: /* @__PURE__ */ jsxs(
27340
27420
  "section",
27341
27421
  {
@@ -27369,7 +27449,7 @@ function AgentChat({
27369
27449
  },
27370
27450
  children: [
27371
27451
  features?.loadEarlier !== false && chat.canLoadEarlier && /* @__PURE__ */ jsx("div", { className: "mb-4 flex justify-center", children: /* @__PURE__ */ jsx(LoadEarlierButton, { loading: chat.isLoadingEarlier, onClick: chat.loadEarlier }) }),
27372
- chat.isLoadingHistory && !hasMessages ? /* @__PURE__ */ jsx(LoadingState, {}) : !hasMessages ? /* @__PURE__ */ jsx(EmptyState, {}) : /* @__PURE__ */ jsx("div", { className: "space-y-5", role: "log", "aria-live": "polite", children: chat.turns.map((turn) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
27452
+ chat.isLoadingHistory && !hasMessages ? /* @__PURE__ */ jsx(LoadingState, {}) : !hasMessages ? /* @__PURE__ */ jsx(EmptyState2, {}) : /* @__PURE__ */ jsx("div", { className: "space-y-5", role: "log", "aria-live": "polite", children: chat.turns.map((turn) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
27373
27453
  turn.systems?.map((message) => /* @__PURE__ */ jsx(
27374
27454
  AgentChatMessage,
27375
27455
  {
@@ -27407,7 +27487,7 @@ function AgentChat({
27407
27487
  }
27408
27488
  ),
27409
27489
  /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
27410
- Composer,
27490
+ Composer2,
27411
27491
  {
27412
27492
  state: {
27413
27493
  value: chat.input,
@@ -27517,22 +27597,22 @@ function DefaultSystemMessage({ message }) {
27517
27597
  function DefaultAssistantMessage({
27518
27598
  message,
27519
27599
  isStreaming,
27520
- ContentBlock = DefaultContentBlock
27600
+ ContentBlock: ContentBlock2 = DefaultContentBlock
27521
27601
  }) {
27522
- const blocks = normalizedBlocks(message.blocks, message.content);
27602
+ const blocks = normalizedBlocks$1(message.blocks, message.content);
27523
27603
  return /* @__PURE__ */ jsxs("div", { className: "flex justify-start gap-2", children: [
27524
27604
  /* @__PURE__ */ jsx("div", { className: "mt-1 flex size-7 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground", children: /* @__PURE__ */ jsx(Bot, { className: "size-4" }) }),
27525
27605
  /* @__PURE__ */ jsx("div", { className: "min-w-0 max-w-[88%] rounded-2xl border border-border bg-card px-4 py-3 text-sm shadow-sm", children: isStreaming && blocks.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
27526
27606
  /* @__PURE__ */ jsx(LoaderCircle, { className: "size-4 animate-spin" }),
27527
27607
  /* @__PURE__ */ jsx("span", { children: "Thinking…" })
27528
27608
  ] }) : /* @__PURE__ */ jsx("div", { className: "space-y-2", children: blocks.map((block, index2) => /* @__PURE__ */ jsx(
27529
- ContentBlock,
27609
+ ContentBlock2,
27530
27610
  {
27531
27611
  block,
27532
27612
  message,
27533
27613
  isStreaming: isStreaming && index2 === blocks.length - 1
27534
27614
  },
27535
- blockKey(block, index2)
27615
+ blockKey$1(block, index2)
27536
27616
  )) }) })
27537
27617
  ] });
27538
27618
  }
@@ -27777,11 +27857,11 @@ function DefaultLoadEarlierButton({ loading, onClick }) {
27777
27857
  }
27778
27858
  );
27779
27859
  }
27780
- function normalizedBlocks(blocks, content2) {
27860
+ function normalizedBlocks$1(blocks, content2) {
27781
27861
  if (blocks && blocks.length > 0) return blocks;
27782
27862
  return content2 ? [{ type: "text", content: content2 }] : [];
27783
27863
  }
27784
- function blockKey(block, index2) {
27864
+ function blockKey$1(block, index2) {
27785
27865
  if (block.type === "tool_call") return `tool:${block.toolCall.id}`;
27786
27866
  if (block.type === "action") return `action:${block.action.id}`;
27787
27867
  if (block.type === "file") return `file:${block.file.id ?? block.file.url ?? block.file.name}:${index2}`;
@@ -28482,6 +28562,860 @@ function booleanValue(value) {
28482
28562
  function isPresent(value) {
28483
28563
  return value != null;
28484
28564
  }
28565
+ const MUTATING_METHODS = /* @__PURE__ */ new Set(["POST", "PATCH", "PUT", "DELETE"]);
28566
+ function isMutatingToolCall(tc) {
28567
+ if (tc?.name !== "lumera_api") return false;
28568
+ const input = tc.input ?? {};
28569
+ const method = String(input.method ?? "GET").toUpperCase();
28570
+ if (!MUTATING_METHODS.has(method)) return false;
28571
+ const path2 = String(input.path ?? "");
28572
+ if (/\/api\/pb\/collections\/[^/]+\/records/.test(path2)) return true;
28573
+ if (/\/api\/automation-runs/.test(path2)) return true;
28574
+ if (/\/api\/pb\/(?:api\/)?sql$/.test(path2)) {
28575
+ const body = input.body;
28576
+ const sql = String(body?.sql ?? input.sql ?? "");
28577
+ return /^\s*(insert|update|delete|upsert)\b/i.test(sql);
28578
+ }
28579
+ return true;
28580
+ }
28581
+ function withDataSync(transport, onMutation) {
28582
+ const subscribe = transport.subscribe;
28583
+ if (!subscribe) return transport;
28584
+ return {
28585
+ ...transport,
28586
+ subscribe: (request, handlers2) => subscribe(request, {
28587
+ ...handlers2,
28588
+ onEvent: (event) => {
28589
+ handlers2.onEvent(event);
28590
+ if (event.type === "tool_end" && isMutatingToolCall(event.toolCall)) {
28591
+ onMutation();
28592
+ }
28593
+ }
28594
+ })
28595
+ };
28596
+ }
28597
+ function useDataSyncTransport(transport, onDataChange, debounceMs = 350) {
28598
+ const cbRef = useRef(onDataChange);
28599
+ cbRef.current = onDataChange;
28600
+ const timer = useRef(null);
28601
+ const fire = useCallback(() => {
28602
+ if (timer.current) clearTimeout(timer.current);
28603
+ timer.current = setTimeout(() => cbRef.current?.(), debounceMs);
28604
+ }, [debounceMs]);
28605
+ return useMemo(() => {
28606
+ if (!transport) return transport;
28607
+ return withDataSync(transport, fire);
28608
+ }, [transport, fire]);
28609
+ }
28610
+ function Markdown({ children: children2, muted, isStreaming }) {
28611
+ return /* @__PURE__ */ jsx(
28612
+ Qs,
28613
+ {
28614
+ className: cn$2("assistant-md", muted && "assistant-md--muted"),
28615
+ animated: isStreaming,
28616
+ isAnimating: isStreaming,
28617
+ mode: isStreaming ? "streaming" : "static",
28618
+ children: children2 || ""
28619
+ }
28620
+ );
28621
+ }
28622
+ function normalizedBlocks(blocks, content2) {
28623
+ if (blocks && blocks.length > 0) return blocks;
28624
+ return content2 ? [{ type: "text", content: content2 }] : [];
28625
+ }
28626
+ function blockKey(block, index2) {
28627
+ if (block.type === "tool_call") return `tool:${block.toolCall.id}`;
28628
+ if (block.type === "action") return `action:${block.action.id}`;
28629
+ if (block.type === "file") return `file:${block.file.id ?? block.file.url ?? block.file.name}:${index2}`;
28630
+ if (block.type === "custom") return `custom:${block.kind}:${index2}`;
28631
+ return `${block.type}:${index2}`;
28632
+ }
28633
+ function messageText(message) {
28634
+ const blocks = normalizedBlocks(message.blocks, message.content);
28635
+ const text2 = blocks.map((b2) => b2.type === "text" ? b2.content : b2.type === "thinking" ? "" : "").filter(Boolean).join("\n\n").trim();
28636
+ return text2 || message.content || "";
28637
+ }
28638
+ function ContentBlock({ block, isStreaming }) {
28639
+ switch (block.type) {
28640
+ case "text":
28641
+ return /* @__PURE__ */ jsx(Markdown, { isStreaming, children: block.content });
28642
+ case "thinking":
28643
+ return /* @__PURE__ */ jsx(ReasoningBlock, { content: block.content, isStreaming });
28644
+ case "tool_call":
28645
+ return /* @__PURE__ */ jsx(ToolCallCard, { toolCall: block.toolCall });
28646
+ case "info":
28647
+ return /* @__PURE__ */ jsx(InfoBanner, { content: block.content, tone: block.tone });
28648
+ case "file":
28649
+ return /* @__PURE__ */ jsx("div", { className: "my-1", children: /* @__PURE__ */ jsx(ArtifactCard, { file: block.file }) });
28650
+ case "action":
28651
+ return /* @__PURE__ */ jsxs("div", { className: "my-1 text-xs", children: [
28652
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: block.action.label }),
28653
+ block.action.error ? /* @__PURE__ */ jsx("span", { className: "ml-2 text-destructive", children: block.action.error }) : null
28654
+ ] });
28655
+ case "custom":
28656
+ return /* @__PURE__ */ jsx(Fragment$1, {});
28657
+ default:
28658
+ return null;
28659
+ }
28660
+ }
28661
+ function ReasoningBlock({ content: content2, isStreaming }) {
28662
+ const [open2, setOpen] = useState(true);
28663
+ const expanded = open2 || Boolean(isStreaming);
28664
+ return /* @__PURE__ */ jsxs("div", { className: "my-1", children: [
28665
+ /* @__PURE__ */ jsxs(
28666
+ "button",
28667
+ {
28668
+ type: "button",
28669
+ onClick: () => setOpen((v2) => !v2),
28670
+ className: "flex items-center gap-1.5 text-xs font-medium text-muted-foreground/70 transition hover:text-muted-foreground",
28671
+ children: [
28672
+ /* @__PURE__ */ jsx(Brain, { className: cn$2("size-3", isStreaming && "animate-pulse") }),
28673
+ /* @__PURE__ */ jsx("span", { children: isStreaming ? "Reasoning…" : "Reasoning" }),
28674
+ /* @__PURE__ */ jsx(ChevronDown, { className: cn$2("size-3 transition-transform", expanded ? "" : "-rotate-90") })
28675
+ ]
28676
+ }
28677
+ ),
28678
+ 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
28679
+ ] });
28680
+ }
28681
+ function InfoBanner({ content: content2, tone }) {
28682
+ const variant = tone === "success" ? {
28683
+ box: "border-emerald-200 bg-emerald-50 text-emerald-800",
28684
+ icon: /* @__PURE__ */ jsx(CircleCheck, { className: "size-3.5 shrink-0 text-emerald-600" })
28685
+ } : tone === "warning" ? {
28686
+ box: "border-amber-200 bg-amber-50 text-amber-800",
28687
+ icon: /* @__PURE__ */ jsx(TriangleAlert, { className: "size-3.5 shrink-0 text-amber-600" })
28688
+ } : tone === "error" ? {
28689
+ box: "border-destructive/30 bg-destructive/10 text-destructive",
28690
+ icon: /* @__PURE__ */ jsx(TriangleAlert, { className: "size-3.5 shrink-0" })
28691
+ } : {
28692
+ box: "border-blue-200 bg-blue-50 text-blue-800",
28693
+ icon: /* @__PURE__ */ jsx(Info$1, { className: "size-3.5 shrink-0 text-blue-600" })
28694
+ };
28695
+ 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: [
28696
+ variant.icon,
28697
+ /* @__PURE__ */ jsx("span", { children: content2 })
28698
+ ] });
28699
+ }
28700
+ function WorkingDots({ label = "Working" }) {
28701
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
28702
+ /* @__PURE__ */ jsx("span", { children: label }),
28703
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex gap-1", children: [
28704
+ /* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-primary [animation:pulse-dot_1s_infinite]" }),
28705
+ /* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-primary [animation:pulse-dot_1s_infinite_0.15s]" }),
28706
+ /* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-primary [animation:pulse-dot_1s_infinite_0.3s]" })
28707
+ ] })
28708
+ ] });
28709
+ }
28710
+ function PendingAssistantMessage() {
28711
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-start gap-3", children: [
28712
+ /* @__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" }) }),
28713
+ /* @__PURE__ */ jsx(WorkingDots, {})
28714
+ ] });
28715
+ }
28716
+ function UserMessageView({ message }) {
28717
+ 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 }) });
28718
+ }
28719
+ function AssistantMessageView({
28720
+ message,
28721
+ isStreaming,
28722
+ onRegenerate
28723
+ }) {
28724
+ const blocks = normalizedBlocks(message.blocks, message.content);
28725
+ const showActions = !isStreaming && messageText(message).length > 0;
28726
+ return /* @__PURE__ */ jsxs("div", { className: "group/msg flex justify-start gap-3", children: [
28727
+ /* @__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" }) }),
28728
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 text-sm", children: [
28729
+ isStreaming && blocks.length === 0 ? /* @__PURE__ */ jsx(WorkingDots, {}) : /* @__PURE__ */ jsx("div", { className: "space-y-2", children: blocks.map((block, index2) => /* @__PURE__ */ jsx(
28730
+ ContentBlock,
28731
+ {
28732
+ block,
28733
+ isStreaming: isStreaming && index2 === blocks.length - 1
28734
+ },
28735
+ blockKey(block, index2)
28736
+ )) }),
28737
+ showActions ? /* @__PURE__ */ jsx(MessageActions, { text: messageText(message), onRegenerate }) : null
28738
+ ] })
28739
+ ] });
28740
+ }
28741
+ function MessageActions({ text: text2, onRegenerate }) {
28742
+ const [copied, setCopied] = useState(false);
28743
+ const [feedback, setFeedback] = useState(null);
28744
+ const copy = async () => {
28745
+ try {
28746
+ await navigator.clipboard.writeText(text2);
28747
+ setCopied(true);
28748
+ setTimeout(() => setCopied(false), 1500);
28749
+ } catch {
28750
+ }
28751
+ };
28752
+ return /* @__PURE__ */ jsxs(
28753
+ "div",
28754
+ {
28755
+ className: cn$2(
28756
+ "mt-1.5 flex items-center gap-1 transition-opacity",
28757
+ feedback ? "opacity-100" : "opacity-0 group-hover/msg:opacity-100 focus-within:opacity-100"
28758
+ ),
28759
+ children: [
28760
+ /* @__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" }) }),
28761
+ onRegenerate ? /* @__PURE__ */ jsx(ActionButton, { label: "Retry", onClick: onRegenerate, children: /* @__PURE__ */ jsx(RefreshCw, { className: "size-3.5" }) }) : null,
28762
+ /* @__PURE__ */ jsx("span", { className: "mx-0.5 h-4 w-px bg-border" }),
28763
+ /* @__PURE__ */ jsx(ActionButton, { label: "Good response", onClick: () => setFeedback("up"), children: /* @__PURE__ */ jsx(ThumbsUp, { className: cn$2("size-3.5", feedback === "up" && "text-primary") }) }),
28764
+ /* @__PURE__ */ jsx(ActionButton, { label: "Bad response", onClick: () => setFeedback("down"), children: /* @__PURE__ */ jsx(ThumbsDown, { className: cn$2("size-3.5", feedback === "down" && "text-primary") }) }),
28765
+ feedback ? /* @__PURE__ */ jsx("span", { className: "ml-1 text-[11px] text-muted-foreground", children: "Thanks — noted." }) : null
28766
+ ]
28767
+ }
28768
+ );
28769
+ }
28770
+ function ActionButton({ label, onClick, children: children2 }) {
28771
+ return /* @__PURE__ */ jsx(
28772
+ "button",
28773
+ {
28774
+ type: "button",
28775
+ onClick,
28776
+ "aria-label": label,
28777
+ title: label,
28778
+ className: "rounded-md p-1 text-muted-foreground transition hover:bg-accent hover:text-foreground",
28779
+ children: children2
28780
+ }
28781
+ );
28782
+ }
28783
+ function EmptyState({
28784
+ title,
28785
+ description,
28786
+ suggestions,
28787
+ onPick
28788
+ }) {
28789
+ return /* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-64 flex-col items-center justify-center px-4 text-center", children: [
28790
+ /* @__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" }) }),
28791
+ /* @__PURE__ */ jsx("p", { className: "mt-3 text-base font-semibold", children: title }),
28792
+ description ? /* @__PURE__ */ jsx("p", { className: "mt-1 max-w-sm text-sm leading-relaxed text-muted-foreground", children: description }) : null,
28793
+ suggestions && suggestions.length > 0 ? /* @__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(
28794
+ "button",
28795
+ {
28796
+ type: "button",
28797
+ onClick: () => onPick(s2),
28798
+ 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",
28799
+ children: s2
28800
+ },
28801
+ s2
28802
+ )) }) : null
28803
+ ] });
28804
+ }
28805
+ function Composer({
28806
+ value,
28807
+ placeholder,
28808
+ disabled,
28809
+ inFlight,
28810
+ canSubmit,
28811
+ canAbort,
28812
+ chips,
28813
+ pendingFiles,
28814
+ enableAttachments,
28815
+ phase,
28816
+ queueLength = 0,
28817
+ onChange,
28818
+ onSubmit,
28819
+ onAbort,
28820
+ onPickChip,
28821
+ onAttach,
28822
+ onRemoveFile
28823
+ }) {
28824
+ const textareaRef = useRef(null);
28825
+ const fileInputRef = useRef(null);
28826
+ useEffect(() => {
28827
+ const el = textareaRef.current;
28828
+ if (!el) return;
28829
+ el.style.height = "auto";
28830
+ el.style.height = `${Math.min(el.scrollHeight, 144)}px`;
28831
+ }, [value]);
28832
+ const hasFiles = Boolean(pendingFiles && pendingFiles.length > 0);
28833
+ const effectivePlaceholder = phase === "submitting" ? "Submitting…" : phase === "aborting" ? "Stopping…" : inFlight ? "Queue a follow-up…" : placeholder;
28834
+ const handlePaste = (event) => {
28835
+ if (!enableAttachments || !onAttach) return;
28836
+ const files = Array.from(event.clipboardData?.items ?? []).filter((item) => item.kind === "file").map((item) => item.getAsFile()).filter((file) => file !== null);
28837
+ if (files.length > 0) {
28838
+ event.preventDefault();
28839
+ onAttach(files);
28840
+ }
28841
+ };
28842
+ const hintParts = [inFlight ? "↵ Queue" : "↵ Send", "⇧↵ Newline"];
28843
+ if (enableAttachments) hintParts.push("Paste or attach files");
28844
+ if (queueLength > 0) hintParts.push(`${queueLength} queued`);
28845
+ return /* @__PURE__ */ jsx(
28846
+ "form",
28847
+ {
28848
+ className: "px-3 pb-3 pt-2",
28849
+ onSubmit: (event) => {
28850
+ event.preventDefault();
28851
+ if (canSubmit) onSubmit();
28852
+ },
28853
+ children: /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-2xl", children: [
28854
+ !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(
28855
+ "button",
28856
+ {
28857
+ type: "button",
28858
+ disabled: disabled || !canSubmit,
28859
+ onClick: () => onPickChip?.(chip.value),
28860
+ 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",
28861
+ children: chip.label
28862
+ },
28863
+ chip.label
28864
+ )) }) : null,
28865
+ hasFiles ? /* @__PURE__ */ jsx("div", { className: "mb-2 flex flex-wrap gap-1.5 px-1", children: pendingFiles?.map((file) => /* @__PURE__ */ jsxs(
28866
+ "span",
28867
+ {
28868
+ className: cn$2(
28869
+ "inline-flex items-center gap-1.5 rounded-lg border px-2 py-1 text-xs",
28870
+ file.status === "failed" ? "border-destructive/40 bg-destructive/10 text-destructive" : "bg-muted text-muted-foreground"
28871
+ ),
28872
+ children: [
28873
+ /* @__PURE__ */ jsx(FileText, { className: "size-3 shrink-0" }),
28874
+ /* @__PURE__ */ jsx("span", { className: "max-w-40 truncate", children: file.name }),
28875
+ file.status === "uploading" ? /* @__PURE__ */ jsx(LoaderCircle, { className: "size-3 shrink-0 animate-spin" }) : null,
28876
+ onRemoveFile ? /* @__PURE__ */ jsx(
28877
+ "button",
28878
+ {
28879
+ type: "button",
28880
+ "aria-label": `Remove ${file.name}`,
28881
+ onClick: () => onRemoveFile(file.id),
28882
+ className: "shrink-0 rounded transition hover:text-foreground",
28883
+ children: /* @__PURE__ */ jsx(X$2, { className: "size-3" })
28884
+ }
28885
+ ) : null
28886
+ ]
28887
+ },
28888
+ file.id
28889
+ )) }) : null,
28890
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
28891
+ inFlight ? /* @__PURE__ */ jsx("svg", { className: "pointer-events-none absolute inset-0 z-10 size-full", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
28892
+ "rect",
28893
+ {
28894
+ x: "0.75",
28895
+ y: "0.75",
28896
+ rx: "15.25",
28897
+ ry: "15.25",
28898
+ width: "calc(100% - 1.5px)",
28899
+ height: "calc(100% - 1.5px)",
28900
+ stroke: "var(--primary)",
28901
+ strokeOpacity: "0.55",
28902
+ strokeWidth: "1.5",
28903
+ strokeLinecap: "round",
28904
+ pathLength: 100,
28905
+ strokeDasharray: "15 85",
28906
+ className: "animate-[border-trace_2s_linear_infinite]"
28907
+ }
28908
+ ) }) : null,
28909
+ /* @__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: [
28910
+ enableAttachments ? /* @__PURE__ */ jsxs(Fragment, { children: [
28911
+ /* @__PURE__ */ jsx(
28912
+ "input",
28913
+ {
28914
+ ref: fileInputRef,
28915
+ type: "file",
28916
+ multiple: true,
28917
+ className: "hidden",
28918
+ onChange: (event) => {
28919
+ const files = Array.from(event.currentTarget.files ?? []);
28920
+ if (files.length > 0) onAttach?.(files);
28921
+ event.currentTarget.value = "";
28922
+ }
28923
+ }
28924
+ ),
28925
+ /* @__PURE__ */ jsx(
28926
+ "button",
28927
+ {
28928
+ type: "button",
28929
+ onClick: () => fileInputRef.current?.click(),
28930
+ disabled,
28931
+ "aria-label": "Attach files",
28932
+ 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",
28933
+ children: /* @__PURE__ */ jsx(Paperclip, { className: "size-4" })
28934
+ }
28935
+ )
28936
+ ] }) : /* @__PURE__ */ jsx("div", { className: "w-1.5" }),
28937
+ /* @__PURE__ */ jsx(
28938
+ "textarea",
28939
+ {
28940
+ ref: textareaRef,
28941
+ value,
28942
+ placeholder: effectivePlaceholder,
28943
+ disabled,
28944
+ rows: 1,
28945
+ 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",
28946
+ onChange: (event) => onChange(event.target.value),
28947
+ onPaste: handlePaste,
28948
+ onKeyDown: (event) => {
28949
+ if (event.key === "Enter" && !event.shiftKey) {
28950
+ event.preventDefault();
28951
+ if (canSubmit) onSubmit();
28952
+ }
28953
+ }
28954
+ }
28955
+ ),
28956
+ /* @__PURE__ */ jsx(
28957
+ "button",
28958
+ {
28959
+ type: canAbort ? "button" : "submit",
28960
+ onClick: canAbort ? onAbort : void 0,
28961
+ disabled: canAbort ? false : !canSubmit,
28962
+ "aria-label": canAbort ? "Stop response" : "Send message",
28963
+ 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",
28964
+ children: canAbort ? /* @__PURE__ */ jsx(Square, { className: "size-4" }) : inFlight ? /* @__PURE__ */ jsx(LoaderCircle, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsx(Send, { className: "size-4" })
28965
+ }
28966
+ )
28967
+ ] })
28968
+ ] }),
28969
+ /* @__PURE__ */ jsx("div", { className: "mt-1.5 text-center text-[10px] text-muted-foreground/40", children: hintParts.join(" · ") })
28970
+ ] })
28971
+ }
28972
+ );
28973
+ }
28974
+ function AssistantChat({
28975
+ agentId,
28976
+ sessionId,
28977
+ transport,
28978
+ showHeader = true,
28979
+ title = "Assistant",
28980
+ subtitle,
28981
+ headerLeft,
28982
+ headerRight,
28983
+ scopes,
28984
+ suggestions,
28985
+ composerChips,
28986
+ placeholder = "Ask a question…",
28987
+ emptyTitle = "Start a conversation",
28988
+ emptyDescription,
28989
+ toolRenderers,
28990
+ onDataChange,
28991
+ onTurnComplete,
28992
+ enableAttachments,
28993
+ historyLimit,
28994
+ watchdog = true,
28995
+ discoveryPoll,
28996
+ disabled,
28997
+ className
28998
+ }) {
28999
+ const syncedTransport = useDataSyncTransport(transport, onDataChange);
29000
+ const attachmentsEnabled = enableAttachments ?? Boolean(transport.uploadFile);
29001
+ const chat = useAgentChat({
29002
+ agentId,
29003
+ sessionId,
29004
+ transport: syncedTransport,
29005
+ historyLimit,
29006
+ watchdog,
29007
+ discoveryPoll,
29008
+ disabled,
29009
+ onTurnComplete: () => {
29010
+ onTurnComplete?.();
29011
+ onDataChange?.();
29012
+ }
29013
+ });
29014
+ const scrollRef = useRef(null);
29015
+ const stickRef = useRef(true);
29016
+ useEffect(() => {
29017
+ if (!stickRef.current) return;
29018
+ const el = scrollRef.current;
29019
+ if (!el) return;
29020
+ const frame = requestAnimationFrame(() => {
29021
+ el.scrollTop = el.scrollHeight;
29022
+ });
29023
+ return () => cancelAnimationFrame(frame);
29024
+ });
29025
+ const hasMessages = chat.messages.length > 0;
29026
+ const lastTurnId = chat.turns[chat.turns.length - 1]?.id;
29027
+ const inFlight = chat.phase === "submitting" || chat.phase === "streaming" || chat.phase === "aborting" || chat.canAbort;
29028
+ return /* @__PURE__ */ jsx(ToolRenderersProvider, { renderers: toolRenderers, children: /* @__PURE__ */ jsxs("div", { className: cn$2("flex min-h-0 flex-col", className), children: [
29029
+ showHeader ? /* @__PURE__ */ jsxs("header", { className: "flex shrink-0 items-center gap-2 border-b px-3 py-2.5", children: [
29030
+ headerLeft,
29031
+ /* @__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" }) }),
29032
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
29033
+ /* @__PURE__ */ jsx("p", { className: "truncate text-sm font-semibold", children: title }),
29034
+ 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
29035
+ ] }),
29036
+ headerRight
29037
+ ] }) : null,
29038
+ /* @__PURE__ */ jsxs(
29039
+ "div",
29040
+ {
29041
+ ref: scrollRef,
29042
+ className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4",
29043
+ onScroll: (event) => {
29044
+ const el = event.currentTarget;
29045
+ stickRef.current = el.scrollHeight - el.scrollTop - el.clientHeight < 96;
29046
+ },
29047
+ children: [
29048
+ chat.canLoadEarlier ? /* @__PURE__ */ jsx("div", { className: "mx-auto mb-4 flex max-w-2xl justify-center", children: /* @__PURE__ */ jsx(
29049
+ "button",
29050
+ {
29051
+ type: "button",
29052
+ onClick: chat.loadEarlier,
29053
+ disabled: chat.isLoadingEarlier,
29054
+ 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",
29055
+ children: chat.isLoadingEarlier ? "Loading…" : "Load earlier"
29056
+ }
29057
+ ) }) : null,
29058
+ 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(
29059
+ EmptyState,
29060
+ {
29061
+ title: emptyTitle,
29062
+ description: emptyDescription,
29063
+ suggestions,
29064
+ onPick: (prompt) => void chat.sendMessage(prompt)
29065
+ }
29066
+ ) : /* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-2xl space-y-5", role: "log", "aria-live": "polite", children: chat.turns.map((turn) => {
29067
+ const isLastTurn = turn.id === lastTurnId;
29068
+ const lastAssistantIndex = turn.assistants.length - 1;
29069
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
29070
+ turn.user ? /* @__PURE__ */ jsx(UserMessageView, { message: turn.user }) : null,
29071
+ turn.assistants.map((message, index2) => {
29072
+ const isLastAssistant = index2 === lastAssistantIndex;
29073
+ const streaming = chat.isStreaming && isLastTurn && isLastAssistant;
29074
+ const canRegenerate = !chat.isStreaming && isLastTurn && isLastAssistant && Boolean(turn.user?.content);
29075
+ return /* @__PURE__ */ jsx(
29076
+ AssistantMessageView,
29077
+ {
29078
+ message,
29079
+ isStreaming: streaming,
29080
+ onRegenerate: canRegenerate ? () => void chat.sendMessage(turn.user?.content) : void 0
29081
+ },
29082
+ message.id
29083
+ );
29084
+ }),
29085
+ isLastTurn && turn.assistants.length === 0 && inFlight ? /* @__PURE__ */ jsx(PendingAssistantMessage, {}) : null
29086
+ ] }, turn.id);
29087
+ }) }),
29088
+ 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: [
29089
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: chat.error instanceof Error ? chat.error.message : String(chat.error) }),
29090
+ /* @__PURE__ */ jsx(
29091
+ "button",
29092
+ {
29093
+ type: "button",
29094
+ onClick: chat.loadHistory,
29095
+ className: "shrink-0 rounded-md px-2 py-1 text-xs hover:bg-destructive/10",
29096
+ children: "Retry"
29097
+ }
29098
+ )
29099
+ ] }) : null
29100
+ ]
29101
+ }
29102
+ ),
29103
+ /* @__PURE__ */ jsxs("div", { className: "relative shrink-0", children: [
29104
+ /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-x-0 -top-6 h-6 bg-gradient-to-t from-background to-transparent" }),
29105
+ /* @__PURE__ */ jsx(
29106
+ Composer,
29107
+ {
29108
+ value: chat.input,
29109
+ placeholder,
29110
+ disabled,
29111
+ inFlight,
29112
+ canSubmit: chat.canSubmit,
29113
+ canAbort: chat.canAbort,
29114
+ chips: composerChips,
29115
+ pendingFiles: chat.pendingFiles,
29116
+ enableAttachments: attachmentsEnabled,
29117
+ phase: chat.phase,
29118
+ queueLength: chat.queueLength,
29119
+ onChange: chat.setInput,
29120
+ onSubmit: () => void chat.sendMessage(),
29121
+ onAbort: () => void chat.abort(),
29122
+ onPickChip: (value) => void chat.sendMessage(value),
29123
+ onAttach: (files) => void chat.attachFiles(files),
29124
+ onRemoveFile: chat.removePendingFile
29125
+ }
29126
+ )
29127
+ ] })
29128
+ ] }) });
29129
+ }
29130
+ function newSessionId(prefix) {
29131
+ return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
29132
+ }
29133
+ function AssistantPage({
29134
+ agentId,
29135
+ transport,
29136
+ title = "Assistant",
29137
+ subtitle,
29138
+ scopes,
29139
+ suggestions,
29140
+ placeholder,
29141
+ emptyTitle,
29142
+ emptyDescription,
29143
+ toolRenderers,
29144
+ onDataChange,
29145
+ enableAttachments,
29146
+ historyLimit,
29147
+ discoveryPoll,
29148
+ newChatPrefix = "app-chat",
29149
+ className
29150
+ }) {
29151
+ const sessions = useAgentChatSessions({ agentId, transport, autoLoad: true });
29152
+ const [activeSessionId, setActiveSessionId] = useState(void 0);
29153
+ const [railOpen, setRailOpen] = useState(true);
29154
+ useEffect(() => {
29155
+ if (activeSessionId || sessions.isLoading) return;
29156
+ setActiveSessionId(sessions.activeSessionId ?? newSessionId(newChatPrefix));
29157
+ }, [activeSessionId, sessions.isLoading, sessions.activeSessionId, newChatPrefix]);
29158
+ const handleNew = () => setActiveSessionId(newSessionId(newChatPrefix));
29159
+ return /* @__PURE__ */ jsxs("div", { className: cn$2("flex min-h-0 overflow-hidden bg-card", className), children: [
29160
+ railOpen ? /* @__PURE__ */ jsx(
29161
+ SessionRail,
29162
+ {
29163
+ sessions: sessions.sessions,
29164
+ activeSessionId,
29165
+ isLoading: sessions.isLoading,
29166
+ onSelect: setActiveSessionId,
29167
+ onNew: handleNew,
29168
+ onRename: (id, name2) => sessions.renameSession(id, name2)
29169
+ }
29170
+ ) : null,
29171
+ /* @__PURE__ */ jsx(
29172
+ AssistantChat,
29173
+ {
29174
+ className: "min-w-0 flex-1 bg-background",
29175
+ agentId,
29176
+ sessionId: activeSessionId,
29177
+ transport,
29178
+ title,
29179
+ subtitle,
29180
+ scopes,
29181
+ suggestions,
29182
+ placeholder,
29183
+ emptyTitle,
29184
+ emptyDescription,
29185
+ toolRenderers,
29186
+ onDataChange,
29187
+ enableAttachments,
29188
+ historyLimit,
29189
+ discoveryPoll,
29190
+ onTurnComplete: () => void sessions.loadSessions(),
29191
+ headerLeft: /* @__PURE__ */ jsx(
29192
+ "button",
29193
+ {
29194
+ type: "button",
29195
+ onClick: () => setRailOpen((open2) => !open2),
29196
+ "aria-label": railOpen ? "Hide conversations" : "Show conversations",
29197
+ className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground",
29198
+ children: railOpen ? /* @__PURE__ */ jsx(PanelLeftClose, { className: "size-4" }) : /* @__PURE__ */ jsx(PanelLeftOpen, { className: "size-4" })
29199
+ }
29200
+ )
29201
+ },
29202
+ activeSessionId ?? "pending"
29203
+ )
29204
+ ] });
29205
+ }
29206
+ function SessionRail({
29207
+ sessions,
29208
+ activeSessionId,
29209
+ isLoading,
29210
+ onSelect,
29211
+ onNew,
29212
+ onRename
29213
+ }) {
29214
+ const [renamingId, setRenamingId] = useState(null);
29215
+ const [renameValue, setRenameValue] = useState("");
29216
+ const startRename = (id, name2) => {
29217
+ setRenamingId(id);
29218
+ setRenameValue(name2 ?? "");
29219
+ };
29220
+ const commitRename = (id) => {
29221
+ const name2 = renameValue.trim();
29222
+ setRenamingId(null);
29223
+ if (name2) void onRename(id, name2);
29224
+ };
29225
+ return /* @__PURE__ */ jsxs("aside", { className: "flex w-60 shrink-0 flex-col border-r bg-card", children: [
29226
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 px-3 py-2.5", children: [
29227
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: [
29228
+ /* @__PURE__ */ jsx(MessagesSquare, { className: "size-3.5" }),
29229
+ " Chats"
29230
+ ] }),
29231
+ /* @__PURE__ */ jsxs(
29232
+ "button",
29233
+ {
29234
+ type: "button",
29235
+ onClick: onNew,
29236
+ 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",
29237
+ children: [
29238
+ /* @__PURE__ */ jsx(Plus, { className: "size-3.5" }),
29239
+ " New"
29240
+ ]
29241
+ }
29242
+ )
29243
+ ] }),
29244
+ /* @__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: [
29245
+ /* @__PURE__ */ jsx("div", { className: "h-12 animate-pulse rounded-lg bg-muted" }),
29246
+ /* @__PURE__ */ jsx("div", { className: "h-12 animate-pulse rounded-lg bg-muted" }),
29247
+ /* @__PURE__ */ jsx("div", { className: "h-12 animate-pulse rounded-lg bg-muted" })
29248
+ ] }) : 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: [
29249
+ /* @__PURE__ */ jsx("p", { className: "px-2 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/80", children: group.label }),
29250
+ /* @__PURE__ */ jsx("ul", { className: "space-y-0.5", children: group.items.map((session) => {
29251
+ const isActive = session.id === activeSessionId;
29252
+ const isRenaming = renamingId === session.id;
29253
+ const title = prettySessionTitle(session);
29254
+ return /* @__PURE__ */ jsx("li", { children: isRenaming ? /* @__PURE__ */ jsx(
29255
+ "input",
29256
+ {
29257
+ autoFocus: true,
29258
+ value: renameValue,
29259
+ onChange: (e) => setRenameValue(e.target.value),
29260
+ onBlur: () => commitRename(session.id),
29261
+ onKeyDown: (e) => {
29262
+ if (e.key === "Enter") {
29263
+ e.preventDefault();
29264
+ commitRename(session.id);
29265
+ }
29266
+ if (e.key === "Escape") setRenamingId(null);
29267
+ },
29268
+ className: "h-9 w-full rounded-lg border bg-background px-2.5 text-sm outline-none focus:ring-2 focus:ring-ring/40"
29269
+ }
29270
+ ) : /* @__PURE__ */ jsxs(
29271
+ "button",
29272
+ {
29273
+ type: "button",
29274
+ onClick: () => onSelect(session.id),
29275
+ onDoubleClick: () => startRename(session.id, title),
29276
+ className: cn$2(
29277
+ "group flex w-full flex-col items-start gap-0.5 rounded-lg px-2.5 py-2 text-left transition",
29278
+ isActive ? "bg-primary/10 text-primary" : "hover:bg-accent"
29279
+ ),
29280
+ children: [
29281
+ /* @__PURE__ */ jsxs("span", { className: "flex w-full items-center gap-1", children: [
29282
+ /* @__PURE__ */ jsx("span", { className: "line-clamp-1 flex-1 text-sm font-medium", children: title }),
29283
+ /* @__PURE__ */ jsx(
29284
+ Pencil,
29285
+ {
29286
+ className: "size-3 shrink-0 text-muted-foreground opacity-0 transition group-hover:opacity-100",
29287
+ onClick: (e) => {
29288
+ e.stopPropagation();
29289
+ startRename(session.id, title);
29290
+ }
29291
+ }
29292
+ )
29293
+ ] }),
29294
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: formatRelative(session.lastUsedAt ?? session.createdAt) })
29295
+ ]
29296
+ }
29297
+ ) }, session.id);
29298
+ }) })
29299
+ ] }, group.label)) }) })
29300
+ ] });
29301
+ }
29302
+ function prettySessionTitle(session) {
29303
+ const raw2 = (session.name ?? "").trim();
29304
+ if (!raw2) return "New chat";
29305
+ if (/^[[{]/.test(raw2) || raw2.includes("current_date") || raw2.includes('"task_id"')) {
29306
+ return "Untitled chat";
29307
+ }
29308
+ return raw2.replace(/^["'`#>\s-]+/, "").slice(0, 60).trim() || "Untitled chat";
29309
+ }
29310
+ function groupSessions(sessions) {
29311
+ const now = /* @__PURE__ */ new Date();
29312
+ const startToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
29313
+ const day = 864e5;
29314
+ const today = [];
29315
+ const yesterday = [];
29316
+ const week = [];
29317
+ const older = [];
29318
+ for (const s2 of sessions) {
29319
+ const t = new Date(s2.lastUsedAt ?? s2.createdAt ?? "").getTime();
29320
+ if (Number.isNaN(t)) older.push(s2);
29321
+ else if (t >= startToday) today.push(s2);
29322
+ else if (t >= startToday - day) yesterday.push(s2);
29323
+ else if (t >= startToday - 7 * day) week.push(s2);
29324
+ else older.push(s2);
29325
+ }
29326
+ return [
29327
+ { label: "Today", items: today },
29328
+ { label: "Yesterday", items: yesterday },
29329
+ { label: "Previous 7 days", items: week },
29330
+ { label: "Older", items: older }
29331
+ ].filter((g2) => g2.items.length > 0);
29332
+ }
29333
+ function formatRelative(value) {
29334
+ if (!value) return "";
29335
+ const then = new Date(value).getTime();
29336
+ if (Number.isNaN(then)) return "";
29337
+ const diff = Date.now() - then;
29338
+ const min2 = Math.round(diff / 6e4);
29339
+ if (min2 < 1) return "just now";
29340
+ if (min2 < 60) return `${min2}m ago`;
29341
+ const hr = Math.round(min2 / 60);
29342
+ if (hr < 24) return `${hr}h ago`;
29343
+ const day = Math.round(hr / 24);
29344
+ if (day < 7) return `${day}d ago`;
29345
+ return new Date(value).toLocaleDateString();
29346
+ }
29347
+ function AssistantWidget({
29348
+ agentId,
29349
+ sessionId,
29350
+ transport,
29351
+ title = "Assistant",
29352
+ subtitle,
29353
+ suggestions,
29354
+ quickActions,
29355
+ placeholder,
29356
+ emptyTitle,
29357
+ emptyDescription,
29358
+ toolRenderers,
29359
+ onDataChange,
29360
+ historyLimit,
29361
+ loading,
29362
+ error: error2,
29363
+ defaultOpen = false
29364
+ }) {
29365
+ const [open2, setOpen] = useState(defaultOpen);
29366
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
29367
+ /* @__PURE__ */ jsx(
29368
+ "button",
29369
+ {
29370
+ type: "button",
29371
+ onClick: () => setOpen((o) => !o),
29372
+ 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",
29373
+ "aria-label": open2 ? "Close assistant" : "Open assistant",
29374
+ children: open2 ? /* @__PURE__ */ jsx(X$2, { className: "size-5" }) : /* @__PURE__ */ jsx(Bot, { className: "size-5" })
29375
+ }
29376
+ ),
29377
+ 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: [
29378
+ /* @__PURE__ */ jsxs("header", { className: "flex items-center gap-2 border-b px-4 py-3", children: [
29379
+ /* @__PURE__ */ jsx("div", { className: "flex size-7 items-center justify-center rounded-full bg-foreground text-xs font-bold text-background", children: "L" }),
29380
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
29381
+ /* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium", children: title }),
29382
+ subtitle ? /* @__PURE__ */ jsx("p", { className: "truncate text-xs text-muted-foreground", children: subtitle }) : null
29383
+ ] }),
29384
+ /* @__PURE__ */ jsx(
29385
+ "button",
29386
+ {
29387
+ type: "button",
29388
+ onClick: () => setOpen(false),
29389
+ "aria-label": "Close",
29390
+ className: "rounded-lg p-1 text-muted-foreground transition hover:bg-accent hover:text-foreground",
29391
+ children: /* @__PURE__ */ jsx(X$2, { className: "size-4" })
29392
+ }
29393
+ )
29394
+ ] }),
29395
+ /* @__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: [
29396
+ /* @__PURE__ */ jsx(LoaderCircle, { className: "size-4 animate-spin" }),
29397
+ " Loading…"
29398
+ ] }) : error2 || !transport ? /* @__PURE__ */ jsx("div", { className: "p-4 text-sm text-destructive", children: error2 || "Could not connect." }) : /* @__PURE__ */ jsx(
29399
+ AssistantChat,
29400
+ {
29401
+ className: "min-h-0 flex-1",
29402
+ showHeader: false,
29403
+ agentId,
29404
+ sessionId,
29405
+ transport,
29406
+ suggestions,
29407
+ composerChips: quickActions,
29408
+ placeholder,
29409
+ emptyTitle: emptyTitle ?? "Ask Lumera",
29410
+ emptyDescription,
29411
+ toolRenderers,
29412
+ onDataChange,
29413
+ historyLimit
29414
+ }
29415
+ ) })
29416
+ ] }) : null
29417
+ ] });
29418
+ }
28485
29419
  function RunDownloadAction({ run }) {
28486
29420
  const [isDownloading, setIsDownloading] = useState(false);
28487
29421
  const files = run.artifacts;
@@ -39722,16 +40656,22 @@ export {
39722
40656
  ToolRenderersProvider as b,
39723
40657
  createLumeraAgentChatTransport as c,
39724
40658
  defaultToolRenderers as d,
39725
- AutomationRunList as e,
40659
+ AssistantChat as e,
39726
40660
  findRenderer as f,
39727
40661
  getCollectionMap as g,
39728
40662
  humanizeCollectionName as h,
39729
40663
  isExploratoryToolCallError as i,
39730
- AutomationRunner as j,
39731
- DataTableFilters as k,
39732
- DataTablePagination as l,
39733
- R as m,
39734
- At as n,
39735
- po as p,
40664
+ AssistantPage as j,
40665
+ AssistantWidget as k,
40666
+ isMutatingToolCall as l,
40667
+ withDataSync as m,
40668
+ AutomationRunList as n,
40669
+ AutomationRunner as o,
40670
+ DataTableFilters as p,
40671
+ DataTablePagination as q,
40672
+ po as r,
40673
+ R as s,
40674
+ At as t,
40675
+ useDataSyncTransport as u,
39736
40676
  warmCollectionCache as w
39737
40677
  };