@apteva/apteva-kit 0.1.3 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
2
 
3
3
  // src/components/Chat/Chat.tsx
4
- var _react = require('react');
4
+ var _react = require('react'); var _react2 = _interopRequireDefault(_react);
5
5
 
6
6
  // src/components/Chat/MessageList.tsx
7
7
 
@@ -190,14 +190,14 @@ function generateMockStreamingResponse(text, onChunk, typingSpeed = 30) {
190
190
  var _jsxruntime = require('react/jsx-runtime');
191
191
  function Card({ widget, onAction }) {
192
192
  const { title, description, image, footer } = widget.props;
193
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "apteva-widget-card", children: [
193
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border border-gray-200 dark:border-gray-700 rounded-xl bg-white dark:bg-gray-900 overflow-hidden", children: [
194
194
  image && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: image, alt: title, className: "w-full h-48 object-cover" }),
195
195
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-4", children: [
196
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: title }),
197
- description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-gray-600 dark:text-gray-400 mt-2", children: description })
196
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "!text-lg font-semibold !text-gray-900 dark:!text-white", children: title }),
197
+ description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "!text-gray-600 dark:!text-gray-400 mt-2", children: description })
198
198
  ] }),
199
199
  (footer || widget.actions && widget.actions.length > 0) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border-t border-gray-200 dark:border-gray-700 p-4 flex justify-between items-center", children: [
200
- footer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-gray-600 dark:text-gray-400", children: footer }),
200
+ footer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm !text-gray-600 dark:!text-gray-400", children: footer }),
201
201
  widget.actions && widget.actions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex gap-2", children: widget.actions.map((action, idx) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
202
202
  "button",
203
203
  {
@@ -207,7 +207,7 @@ function Card({ widget, onAction }) {
207
207
  widgetId: widget.id,
208
208
  timestamp: /* @__PURE__ */ new Date()
209
209
  })]),
210
- className: "apteva-widget-button",
210
+ className: "px-3 py-1.5 !text-sm rounded-lg font-medium transition-colors bg-blue-500 !text-white hover:bg-blue-600",
211
211
  children: action.label
212
212
  },
213
213
  idx
@@ -220,28 +220,35 @@ function Card({ widget, onAction }) {
220
220
 
221
221
  function List({ widget, onAction }) {
222
222
  const { items } = widget.props;
223
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "apteva-widget-list", children: items.map((item) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center p-4 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors", children: [
224
- item.image && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: item.image, alt: item.title, className: "w-16 h-16 rounded object-cover" }),
225
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 ml-4", children: [
226
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-semibold text-gray-900 dark:text-white", children: item.title }),
227
- item.subtitle && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-gray-600 dark:text-gray-400", children: item.subtitle }),
228
- item.description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-gray-500 dark:text-gray-500 mt-1", children: item.description })
229
- ] }),
230
- widget.actions && widget.actions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex gap-2", children: widget.actions.map((action, idx) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
231
- "button",
232
- {
233
- onClick: () => _optionalChain([onAction, 'optionalCall', _2 => _2({
234
- type: action.type,
235
- payload: item.metadata || item,
236
- widgetId: widget.id,
237
- timestamp: /* @__PURE__ */ new Date()
238
- })]),
239
- className: "px-3 py-1.5 text-sm rounded-lg font-medium transition-colors bg-apteva-500 text-white hover:bg-apteva-600",
240
- children: action.label
241
- },
242
- idx
243
- )) })
244
- ] }, item.id)) });
223
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border border-gray-200 dark:border-gray-700 rounded-xl bg-white dark:bg-gray-900 overflow-hidden", children: items.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
224
+ "div",
225
+ {
226
+ className: `flex items-center p-4 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors ${index !== items.length - 1 ? "border-b border-gray-200 dark:border-gray-700" : ""}`,
227
+ children: [
228
+ item.image && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: item.image, alt: item.title, className: "w-16 h-16 rounded object-cover" }),
229
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `flex-1 ${item.image ? "ml-4" : ""}`, children: [
230
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-semibold !text-gray-900 dark:!text-white", children: item.title }),
231
+ item.subtitle && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "!text-sm !text-gray-600 dark:!text-gray-400", children: item.subtitle }),
232
+ item.description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "!text-xs !text-gray-500 dark:!text-gray-500 mt-1", children: item.description })
233
+ ] }),
234
+ widget.actions && widget.actions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex gap-2", children: widget.actions.map((action, idx) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
235
+ "button",
236
+ {
237
+ onClick: () => _optionalChain([onAction, 'optionalCall', _2 => _2({
238
+ type: action.type,
239
+ payload: item.metadata || item,
240
+ widgetId: widget.id,
241
+ timestamp: /* @__PURE__ */ new Date()
242
+ })]),
243
+ className: "px-3 py-1.5 !text-sm rounded-lg font-medium transition-colors bg-blue-500 !text-white hover:bg-blue-600",
244
+ children: action.label
245
+ },
246
+ idx
247
+ )) })
248
+ ]
249
+ },
250
+ item.id
251
+ )) });
245
252
  }
246
253
 
247
254
  // src/components/Widgets/widget-library/Button.tsx
@@ -249,10 +256,10 @@ function List({ widget, onAction }) {
249
256
  function Button({ widget, onAction }) {
250
257
  const { label, variant = "primary", disabled = false } = widget.props;
251
258
  const variantClasses = {
252
- primary: "bg-apteva-500 text-white hover:bg-apteva-600",
253
- secondary: "bg-gray-500 text-white hover:bg-gray-600",
254
- outline: "border-2 border-apteva-500 text-apteva-500 hover:bg-apteva-50",
255
- ghost: "text-apteva-500 hover:bg-apteva-50"
259
+ primary: "bg-blue-500 !text-white hover:bg-blue-600",
260
+ secondary: "bg-gray-500 !text-white hover:bg-gray-600",
261
+ outline: "border-2 border-blue-500 !text-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900",
262
+ ghost: "!text-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900"
256
263
  };
257
264
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
258
265
  "button",
@@ -326,11 +333,20 @@ function Widgets({
326
333
 
327
334
  function Message({ message, onAction }) {
328
335
  const isUser = message.role === "user";
329
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("apteva-message", isUser ? "apteva-message-user" : "apteva-message-assistant"), children: [
330
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "whitespace-pre-wrap", children: message.content }),
331
- message.widgets && message.widgets.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mt-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
332
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-xs opacity-70 mt-2", children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
333
- ] });
336
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
337
+ "div",
338
+ {
339
+ className: cn(
340
+ "max-w-[80%]",
341
+ isUser ? "px-4 py-2.5 rounded-xl bg-gray-100 dark:bg-gray-800 !text-gray-900 dark:!text-gray-100 ml-auto" : "!text-gray-900 dark:!text-gray-100"
342
+ ),
343
+ children: [
344
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "whitespace-pre-wrap !text-sm leading-relaxed", children: message.content }),
345
+ message.widgets && message.widgets.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn(isUser ? "mt-3" : "mt-2"), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
346
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("!text-xs opacity-70", isUser ? "mt-1.5 !text-gray-500 dark:!text-gray-400" : "mt-1 !text-gray-500 dark:!text-gray-400"), suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
347
+ ]
348
+ }
349
+ );
334
350
  }
335
351
 
336
352
  // src/components/Chat/MessageList.tsx
@@ -342,7 +358,7 @@ function MessageList({ messages, onAction }) {
342
358
  listRef.current.scrollTop = listRef.current.scrollHeight;
343
359
  }
344
360
  }, [messages]);
345
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: listRef, className: "apteva-message-list", children: messages.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center h-full text-gray-500", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center space-y-2", children: [
361
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: listRef, className: "flex-1 overflow-y-auto px-4 py-4 space-y-3", children: messages.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center h-full !text-gray-500 dark:!text-gray-400", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center space-y-2", children: [
346
362
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-4xl", children: "\u{1F4AC}" }),
347
363
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "No messages yet. Start a conversation!" })
348
364
  ] }) }) : messages.map((message) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Message, { message, onAction }, message.id)) });
@@ -351,9 +367,11 @@ function MessageList({ messages, onAction }) {
351
367
  // src/components/Chat/Composer.tsx
352
368
 
353
369
 
354
- function Composer({ onSendMessage, placeholder = "Type a message...", disabled = false }) {
370
+ function Composer({ onSendMessage, placeholder = "Type a message...", disabled = false, onFileUpload }) {
355
371
  const [text, setText] = _react.useState.call(void 0, "");
372
+ const [showMenu, setShowMenu] = _react.useState.call(void 0, false);
356
373
  const textareaRef = _react.useRef.call(void 0, null);
374
+ const fileInputRef = _react.useRef.call(void 0, null);
357
375
  const handleKeyDown = (e) => {
358
376
  if (e.key === "Enter" && !e.shiftKey) {
359
377
  e.preventDefault();
@@ -374,8 +392,37 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
374
392
  e.target.style.height = "auto";
375
393
  e.target.style.height = `${e.target.scrollHeight}px`;
376
394
  };
377
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "apteva-composer", children: [
378
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
395
+ const handleFileSelect = (e) => {
396
+ if (e.target.files && e.target.files.length > 0) {
397
+ _optionalChain([onFileUpload, 'optionalCall', _7 => _7(e.target.files)]);
398
+ setShowMenu(false);
399
+ }
400
+ };
401
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "px-4 py-3 bg-white dark:bg-gray-900 relative", children: [
402
+ showMenu && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
403
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fixed inset-0 z-10", onClick: () => setShowMenu(false) }),
404
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "absolute bottom-full left-4 mb-2 bg-gray-800 dark:bg-gray-700 rounded-xl shadow-lg overflow-hidden z-20 min-w-[240px]", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
405
+ "button",
406
+ {
407
+ onClick: () => _optionalChain([fileInputRef, 'access', _8 => _8.current, 'optionalAccess', _9 => _9.click, 'call', _10 => _10()]),
408
+ className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-700 dark:hover:bg-gray-600 transition-colors !text-white text-left",
409
+ children: [
410
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M10.5 3.5L5.5 8.5C4.67157 9.32843 4.67157 10.6716 5.5 11.5C6.32843 12.3284 7.67157 12.3284 8.5 11.5L14.5 5.5C15.8807 4.11929 15.8807 1.88071 14.5 0.5C13.1193 -0.880711 10.8807 -0.880711 9.5 0.5L3.5 6.5C1.56846 8.43154 1.56846 11.5685 3.5 13.5C5.43154 15.4315 8.56846 15.4315 10.5 13.5L15.5 8.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(2, 3)" }) }),
411
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Add photos & files" })
412
+ ]
413
+ }
414
+ ) })
415
+ ] }),
416
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative border-2 border-gray-300 dark:border-gray-700 rounded-xl bg-white dark:bg-gray-900 transition-all duration-300 flex items-center px-3 py-2 gap-3", children: [
417
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
418
+ "button",
419
+ {
420
+ onClick: () => setShowMenu(!showMenu),
421
+ className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-gray-700 dark:!text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",
422
+ title: "More options",
423
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
424
+ }
425
+ ),
379
426
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
380
427
  "textarea",
381
428
  {
@@ -385,9 +432,9 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
385
432
  onKeyDown: handleKeyDown,
386
433
  placeholder,
387
434
  disabled,
388
- className: "apteva-composer-input",
435
+ className: "flex-1 resize-none bg-transparent border-none focus:outline-none !text-gray-900 dark:!text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 py-1 disabled:opacity-50 disabled:cursor-not-allowed",
389
436
  rows: 1,
390
- style: { maxHeight: "200px" }
437
+ style: { maxHeight: "120px" }
391
438
  }
392
439
  ),
393
440
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -395,12 +442,23 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
395
442
  {
396
443
  onClick: handleSend,
397
444
  disabled: !text.trim() || disabled,
398
- className: "px-6 py-2 bg-apteva-500 text-white rounded-lg hover:bg-apteva-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium",
399
- children: "Send"
445
+ className: "w-8 h-8 rounded-lg flex items-center justify-center font-bold transition-all flex-shrink-0 border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 !text-gray-700 dark:!text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-30 disabled:cursor-not-allowed !text-lg",
446
+ title: "Send message",
447
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
400
448
  }
401
449
  )
402
450
  ] }),
403
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-xs text-gray-500 mt-2", children: "Press Enter to send, Shift+Enter for new line" })
451
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
452
+ "input",
453
+ {
454
+ ref: fileInputRef,
455
+ type: "file",
456
+ multiple: true,
457
+ onChange: handleFileSelect,
458
+ className: "hidden",
459
+ accept: "image/*,application/pdf,.doc,.docx,.txt"
460
+ }
461
+ )
404
462
  ] });
405
463
  }
406
464
 
@@ -413,6 +471,7 @@ function Chat({
413
471
  onThreadChange,
414
472
  onMessageSent,
415
473
  onAction,
474
+ onFileUpload,
416
475
  placeholder = "Type a message...",
417
476
  showHeader = true,
418
477
  headerTitle = "Chat",
@@ -423,7 +482,7 @@ function Chat({
423
482
  _react.useEffect.call(void 0, () => {
424
483
  if (threadId) {
425
484
  console.log("Loading thread:", threadId);
426
- _optionalChain([onThreadChange, 'optionalCall', _7 => _7(threadId)]);
485
+ _optionalChain([onThreadChange, 'optionalCall', _11 => _11(threadId)]);
427
486
  }
428
487
  }, [threadId, onThreadChange]);
429
488
  const handleSendMessage = async (text) => {
@@ -434,7 +493,7 @@ function Chat({
434
493
  timestamp: /* @__PURE__ */ new Date()
435
494
  };
436
495
  setMessages((prev) => [...prev, userMessage]);
437
- _optionalChain([onMessageSent, 'optionalCall', _8 => _8(userMessage)]);
496
+ _optionalChain([onMessageSent, 'optionalCall', _12 => _12(userMessage)]);
438
497
  setIsLoading(true);
439
498
  try {
440
499
  const response = await generateMockResponse(1e3);
@@ -445,17 +504,17 @@ function Chat({
445
504
  setIsLoading(false);
446
505
  }
447
506
  };
448
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("apteva-chat-container", className), children: [
449
- showHeader && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border-b border-gray-200 dark:border-gray-700 px-4 py-3", children: [
450
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: headerTitle }),
451
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
507
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("flex flex-col h-full bg-white dark:bg-gray-900", className), children: [
508
+ showHeader && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "px-4 py-3 bg-white dark:bg-gray-900", children: [
509
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "!text-lg font-semibold !text-gray-900 dark:!text-white", children: headerTitle }),
510
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "!text-xs !text-gray-500 dark:!text-gray-400", children: [
452
511
  "Agent: ",
453
512
  agentId
454
513
  ] })
455
514
  ] }),
456
515
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MessageList, { messages, onAction }),
457
- isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-4 py-2 text-sm text-gray-500 italic", children: "AI is thinking..." }),
458
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Composer, { onSendMessage: handleSendMessage, placeholder, disabled: isLoading })
516
+ isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-4 py-2 !text-sm !text-gray-500 dark:!text-gray-400 italic", children: "AI is thinking..." }),
517
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Composer, { onSendMessage: handleSendMessage, placeholder, disabled: isLoading, onFileUpload })
459
518
  ] });
460
519
  }
461
520
 
@@ -476,6 +535,7 @@ function Command({
476
535
  onChunk,
477
536
  onComplete,
478
537
  onError,
538
+ onFileUpload,
479
539
  loadingText = "Processing...",
480
540
  showProgress = true,
481
541
  enableStreaming = false,
@@ -488,6 +548,7 @@ function Command({
488
548
  const [progress, setProgress] = _react.useState.call(void 0, 0);
489
549
  const [command, setCommand] = _react.useState.call(void 0, initialCommand || "");
490
550
  const [streamedContent, setStreamedContent] = _react.useState.call(void 0, "");
551
+ const fileInputRef = _react2.default.useRef(null);
491
552
  _react.useEffect.call(void 0, () => {
492
553
  if (autoExecute && state === "idle" && command) {
493
554
  executeCommand();
@@ -499,11 +560,13 @@ function Command({
499
560
  setState("error");
500
561
  return;
501
562
  }
563
+ const currentCommand = command;
502
564
  setState("loading");
503
565
  setError(null);
504
566
  setProgress(0);
505
567
  setStreamedContent("");
506
- _optionalChain([onStart, 'optionalCall', _9 => _9()]);
568
+ setCommand("");
569
+ _optionalChain([onStart, 'optionalCall', _13 => _13()]);
507
570
  try {
508
571
  if (enableStreaming) {
509
572
  const mockStreamChunks = [
@@ -519,14 +582,14 @@ function Command({
519
582
  await new Promise((resolve) => setTimeout(resolve, 600 + Math.random() * 400));
520
583
  const chunk = mockStreamChunks[i];
521
584
  setStreamedContent(chunk);
522
- _optionalChain([onChunk, 'optionalCall', _10 => _10(chunk)]);
585
+ _optionalChain([onChunk, 'optionalCall', _14 => _14(chunk)]);
523
586
  setProgress(Math.round((i + 1) / mockStreamChunks.length * 100));
524
- _optionalChain([onProgress, 'optionalCall', _11 => _11(Math.round((i + 1) / mockStreamChunks.length * 100))]);
587
+ _optionalChain([onProgress, 'optionalCall', _15 => _15(Math.round((i + 1) / mockStreamChunks.length * 100))]);
525
588
  }
526
589
  const mockResult = {
527
590
  success: true,
528
591
  data: {
529
- summary: `Successfully processed: "${command}"`,
592
+ summary: `Successfully processed: "${currentCommand}"`,
530
593
  agentId,
531
594
  context,
532
595
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
@@ -536,12 +599,12 @@ function Command({
536
599
  setResult(mockResult);
537
600
  setState("success");
538
601
  setProgress(100);
539
- _optionalChain([onComplete, 'optionalCall', _12 => _12(mockResult)]);
602
+ _optionalChain([onComplete, 'optionalCall', _16 => _16(mockResult)]);
540
603
  } else {
541
604
  const progressInterval = setInterval(() => {
542
605
  setProgress((prev) => {
543
606
  const next = Math.min(prev + 10, 90);
544
- _optionalChain([onProgress, 'optionalCall', _13 => _13(next)]);
607
+ _optionalChain([onProgress, 'optionalCall', _17 => _17(next)]);
545
608
  return next;
546
609
  });
547
610
  }, 200);
@@ -550,7 +613,7 @@ function Command({
550
613
  const mockResult = {
551
614
  success: true,
552
615
  data: {
553
- summary: `Command "${command}" executed successfully`,
616
+ summary: `Command "${currentCommand}" executed successfully`,
554
617
  agentId,
555
618
  context,
556
619
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
@@ -560,13 +623,13 @@ function Command({
560
623
  setResult(mockResult);
561
624
  setState("success");
562
625
  setProgress(100);
563
- _optionalChain([onComplete, 'optionalCall', _14 => _14(mockResult)]);
626
+ _optionalChain([onComplete, 'optionalCall', _18 => _18(mockResult)]);
564
627
  }
565
628
  } catch (err) {
566
629
  const error2 = err instanceof Error ? err : new Error("Unknown error");
567
630
  setError(error2);
568
631
  setState("error");
569
- _optionalChain([onError, 'optionalCall', _15 => _15(error2)]);
632
+ _optionalChain([onError, 'optionalCall', _19 => _19(error2)]);
570
633
  }
571
634
  };
572
635
  const resetCommand = () => {
@@ -576,6 +639,11 @@ function Command({
576
639
  setProgress(0);
577
640
  setCommand("");
578
641
  };
642
+ const handleFileSelect = (e) => {
643
+ if (e.target.files && e.target.files.length > 0) {
644
+ _optionalChain([onFileUpload, 'optionalCall', _20 => _20(e.target.files)]);
645
+ }
646
+ };
579
647
  const isCompact = variant === "compact";
580
648
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
581
649
  "div",
@@ -609,6 +677,15 @@ function Command({
609
677
  }
610
678
  ),
611
679
  state === "idle" && allowInput && isCompact && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
680
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
681
+ "button",
682
+ {
683
+ onClick: () => _optionalChain([fileInputRef, 'access', _21 => _21.current, 'optionalAccess', _22 => _22.click, 'call', _23 => _23()]),
684
+ className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-gray-500 dark:!text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",
685
+ title: "Attach file",
686
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8.4 2.8L4.4 6.8C3.736 7.464 3.736 8.536 4.4 9.2C5.064 9.864 6.136 9.864 6.8 9.2L11.6 4.4C12.704 3.296 12.704 1.504 11.6 0.4C10.496 -0.704 8.704 -0.704 7.6 0.4L2.8 5.2C1.256 6.744 1.256 9.256 2.8 10.8C4.344 12.344 6.856 12.344 8.4 10.8L12.4 6.8", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(1.6, 2.4)" }) })
687
+ }
688
+ ),
612
689
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
613
690
  "input",
614
691
  {
@@ -641,7 +718,7 @@ function Command({
641
718
  !command.trim() && "border-gray-200 dark:border-gray-700 !text-gray-400 dark:!text-gray-600"
642
719
  ),
643
720
  title: "Execute",
644
- children: "\u2191"
721
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
645
722
  }
646
723
  )
647
724
  ] }),
@@ -679,7 +756,7 @@ function Command({
679
756
  "!text-lg",
680
757
  "opacity-30 cursor-not-allowed"
681
758
  ),
682
- children: "\u2191"
759
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
683
760
  }
684
761
  )
685
762
  ] }),
@@ -688,7 +765,7 @@ function Command({
688
765
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-5 h-5 text-red-600 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
689
766
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
690
767
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-semibold text-red-800 dark:text-red-400", children: "Error" }),
691
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: _optionalChain([error, 'optionalAccess', _16 => _16.message]) })
768
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: _optionalChain([error, 'optionalAccess', _24 => _24.message]) })
692
769
  ] })
693
770
  ] }) }),
694
771
  allowInput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -716,59 +793,96 @@ function Command({
716
793
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-green-700 dark:text-green-300 text-sm", children: result.message || "Command executed successfully" })
717
794
  ] })
718
795
  ] }),
719
- _optionalChain([result, 'access', _17 => _17.data, 'optionalAccess', _18 => _18.summary]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-gray-700 dark:text-gray-300 text-sm leading-relaxed", children: result.data.summary })
796
+ _optionalChain([result, 'access', _25 => _25.data, 'optionalAccess', _26 => _26.summary]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-gray-700 dark:text-gray-300 text-sm leading-relaxed", children: result.data.summary })
720
797
  ] }) }),
721
798
  state === "success" && result && isCompact && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
722
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 flex items-center gap-2 py-1", children: [
723
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-4 h-4 text-green-600 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
724
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-green-700 dark:text-green-300 text-sm truncate", children: resultRenderer ? resultRenderer(result.data) : result.message || "Command executed successfully" })
725
- ] }),
799
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
800
+ "div",
801
+ {
802
+ className: "flex-1 flex items-center gap-2 py-1 cursor-text",
803
+ onClick: () => {
804
+ setState("idle");
805
+ setResult(null);
806
+ },
807
+ children: [
808
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-4 h-4 text-green-600 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
809
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-green-700 dark:text-green-300 text-sm truncate", children: resultRenderer ? resultRenderer(result.data) : result.message || "Command executed successfully" })
810
+ ]
811
+ }
812
+ ),
726
813
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
727
814
  "button",
728
815
  {
729
- disabled: true,
816
+ onClick: () => {
817
+ setState("idle");
818
+ setResult(null);
819
+ },
730
820
  className: cn(
731
821
  "w-8 h-8 rounded-lg flex items-center justify-center font-bold transition-all flex-shrink-0",
732
- "border border-gray-200 dark:border-gray-700",
822
+ "border border-gray-300 dark:border-gray-600",
733
823
  "bg-white dark:bg-gray-800",
734
- "!text-gray-400 dark:!text-gray-600",
735
- "!text-lg",
736
- "opacity-30 cursor-not-allowed"
824
+ "!text-gray-700 dark:!text-gray-300",
825
+ "hover:bg-gray-50 dark:hover:bg-gray-700",
826
+ "!text-lg"
737
827
  ),
738
- children: "\u2191"
828
+ title: "New command",
829
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
739
830
  }
740
831
  )
741
832
  ] })
742
833
  ] }),
743
- !isCompact && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-3 flex items-center justify-end gap-2", children: [
744
- (state === "success" || state === "error") && allowInput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
834
+ !isCompact && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-3 flex items-center justify-between gap-2", children: [
835
+ state === "idle" && allowInput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
745
836
  "button",
746
837
  {
747
- onClick: resetCommand,
748
- className: "px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",
749
- children: "Reset"
838
+ onClick: () => _optionalChain([fileInputRef, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.click, 'call', _29 => _29()]),
839
+ className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-gray-500 dark:!text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",
840
+ title: "Attach file",
841
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8.4 2.8L4.4 6.8C3.736 7.464 3.736 8.536 4.4 9.2C5.064 9.864 6.136 9.864 6.8 9.2L11.6 4.4C12.704 3.296 12.704 1.504 11.6 0.4C10.496 -0.704 8.704 -0.704 7.6 0.4L2.8 5.2C1.256 6.744 1.256 9.256 2.8 10.8C4.344 12.344 6.856 12.344 8.4 10.8L12.4 6.8", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(1.6, 2.4)" }) })
750
842
  }
751
843
  ),
752
- (state === "idle" || state === "error") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
753
- "button",
754
- {
755
- onClick: executeCommand,
756
- disabled: !command.trim(),
757
- className: cn(
758
- "w-8 h-8 rounded-lg flex items-center justify-center font-bold transition-all",
759
- "border border-gray-300 dark:border-gray-600",
760
- "bg-white dark:bg-gray-800",
761
- "!text-gray-700 dark:!text-gray-300",
762
- "hover:bg-gray-50 dark:hover:bg-gray-700",
763
- "disabled:opacity-30 disabled:cursor-not-allowed",
764
- "!text-lg",
765
- !command.trim() && "border-gray-200 dark:border-gray-700 !text-gray-400 dark:!text-gray-600"
766
- ),
767
- title: state === "error" ? "Retry" : "Execute",
768
- children: state === "error" ? "\u21BB" : "\u2191"
769
- }
770
- )
844
+ !(state === "idle" && allowInput) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
845
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
846
+ (state === "success" || state === "error") && allowInput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
847
+ "button",
848
+ {
849
+ onClick: resetCommand,
850
+ className: "px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",
851
+ children: "Reset"
852
+ }
853
+ ),
854
+ (state === "idle" || state === "error") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
855
+ "button",
856
+ {
857
+ onClick: executeCommand,
858
+ disabled: !command.trim(),
859
+ className: cn(
860
+ "w-8 h-8 rounded-lg flex items-center justify-center font-bold transition-all",
861
+ "border border-gray-300 dark:border-gray-600",
862
+ "bg-white dark:bg-gray-800",
863
+ "!text-gray-700 dark:!text-gray-300",
864
+ "hover:bg-gray-50 dark:hover:bg-gray-700",
865
+ "disabled:opacity-30 disabled:cursor-not-allowed",
866
+ "!text-lg",
867
+ !command.trim() && "border-gray-200 dark:border-gray-700 !text-gray-400 dark:!text-gray-600"
868
+ ),
869
+ title: state === "error" ? "Retry" : "Execute",
870
+ children: state === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M13 8C13 10.7614 10.7614 13 8 13C5.23858 13 3 10.7614 3 8C3 5.23858 5.23858 3 8 3C9.65685 3 11.1257 3.82818 12 5.09091M12 3V5.09091M12 5.09091H9.81818", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
871
+ }
872
+ )
873
+ ] })
771
874
  ] }),
875
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
876
+ "input",
877
+ {
878
+ ref: fileInputRef,
879
+ type: "file",
880
+ multiple: true,
881
+ onChange: handleFileSelect,
882
+ className: "hidden",
883
+ accept: "image/*,application/pdf,.doc,.docx,.txt"
884
+ }
885
+ ),
772
886
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { dangerouslySetInnerHTML: {
773
887
  __html: `
774
888
  @keyframes pulse-border {
@@ -814,17 +928,17 @@ function Prompt({
814
928
  const newValue = e.target.value;
815
929
  if (!maxLength || newValue.length <= maxLength) {
816
930
  setValue(newValue);
817
- _optionalChain([onChange, 'optionalCall', _19 => _19(newValue)]);
931
+ _optionalChain([onChange, 'optionalCall', _30 => _30(newValue)]);
818
932
  }
819
933
  };
820
934
  const handleSubmit = async () => {
821
935
  if (value.length < minLength) return;
822
- _optionalChain([onSubmit, 'optionalCall', _20 => _20(value)]);
936
+ _optionalChain([onSubmit, 'optionalCall', _31 => _31(value)]);
823
937
  setIsLoading(true);
824
938
  try {
825
939
  await new Promise((resolve) => setTimeout(resolve, 1500));
826
940
  const mockResult = `Enhanced version: ${value} [AI-generated content]`;
827
- _optionalChain([onResult, 'optionalCall', _21 => _21(mockResult)]);
941
+ _optionalChain([onResult, 'optionalCall', _32 => _32(mockResult)]);
828
942
  setValue("");
829
943
  } catch (error) {
830
944
  console.error("Error processing prompt:", error);
@@ -917,23 +1031,23 @@ function Stream({
917
1031
  }, [autoStart]);
918
1032
  const startStreaming = async () => {
919
1033
  setIsStreaming(true);
920
- _optionalChain([onStart, 'optionalCall', _22 => _22()]);
1034
+ _optionalChain([onStart, 'optionalCall', _33 => _33()]);
921
1035
  const mockText = "This is a simulated streaming response from the AI agent. In a real implementation, this would stream data from your backend API. The text appears word by word to simulate the streaming effect. You can customize the typing speed and styling based on your needs.";
922
1036
  try {
923
1037
  await generateMockStreamingResponse(
924
1038
  mockText,
925
1039
  (chunk) => {
926
1040
  setText((prev) => prev + chunk);
927
- _optionalChain([onChunk, 'optionalCall', _23 => _23(chunk)]);
1041
+ _optionalChain([onChunk, 'optionalCall', _34 => _34(chunk)]);
928
1042
  },
929
1043
  typingSpeed
930
1044
  );
931
1045
  setIsComplete(true);
932
1046
  setIsStreaming(false);
933
- _optionalChain([onComplete, 'optionalCall', _24 => _24(text + mockText)]);
1047
+ _optionalChain([onComplete, 'optionalCall', _35 => _35(text + mockText)]);
934
1048
  } catch (error) {
935
1049
  const err = error instanceof Error ? error : new Error("Streaming error");
936
- _optionalChain([onError, 'optionalCall', _25 => _25(err)]);
1050
+ _optionalChain([onError, 'optionalCall', _36 => _36(err)]);
937
1051
  setIsStreaming(false);
938
1052
  }
939
1053
  };
@@ -1025,7 +1139,7 @@ function ThreadList({
1025
1139
  }) {
1026
1140
  const [searchQuery, setSearchQuery] = _react.useState.call(void 0, "");
1027
1141
  const filteredThreads = threads.filter(
1028
- (thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || _optionalChain([thread, 'access', _26 => _26.preview, 'optionalAccess', _27 => _27.toLowerCase, 'call', _28 => _28(), 'access', _29 => _29.includes, 'call', _30 => _30(searchQuery.toLowerCase())])
1142
+ (thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || _optionalChain([thread, 'access', _37 => _37.preview, 'optionalAccess', _38 => _38.toLowerCase, 'call', _39 => _39(), 'access', _40 => _40.includes, 'call', _41 => _41(searchQuery.toLowerCase())])
1029
1143
  );
1030
1144
  const groupedThreads = groupBy === "date" ? groupThreadsByDate(filteredThreads) : { All: filteredThreads };
1031
1145
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col h-full", children: [
@@ -1047,8 +1161,8 @@ function ThreadList({
1047
1161
  {
1048
1162
  thread,
1049
1163
  isActive: thread.id === currentThreadId,
1050
- onSelect: () => _optionalChain([onThreadSelect, 'optionalCall', _31 => _31(thread.id)]),
1051
- onDelete: () => _optionalChain([onThreadDelete, 'optionalCall', _32 => _32(thread.id)])
1164
+ onSelect: () => _optionalChain([onThreadSelect, 'optionalCall', _42 => _42(thread.id)]),
1165
+ onDelete: () => _optionalChain([onThreadDelete, 'optionalCall', _43 => _43(thread.id)])
1052
1166
  },
1053
1167
  thread.id
1054
1168
  ))
@@ -1110,7 +1224,7 @@ function Threads({
1110
1224
  threads.slice(0, 5).map((thread) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1111
1225
  "button",
1112
1226
  {
1113
- onClick: () => _optionalChain([onThreadSelect, 'optionalCall', _33 => _33(thread.id)]),
1227
+ onClick: () => _optionalChain([onThreadSelect, 'optionalCall', _44 => _44(thread.id)]),
1114
1228
  className: cn(
1115
1229
  "px-4 py-2 whitespace-nowrap font-medium transition-colors",
1116
1230
  thread.id === currentThreadId ? "border-b-2 border-apteva-500 text-apteva-500" : "text-gray-600 hover:text-gray-900"