@apteva/apteva-kit 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,54 +1,16 @@
1
- "use client";
2
- "use strict";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/index.ts
22
- var index_exports = {};
23
- __export(index_exports, {
24
- Button: () => Button,
25
- Card: () => Card,
26
- Chat: () => Chat,
27
- Command: () => Command,
28
- List: () => List,
29
- Prompt: () => Prompt,
30
- Stream: () => Stream,
31
- Threads: () => Threads,
32
- Widgets: () => Widgets,
33
- cn: () => cn,
34
- getThemeScript: () => getThemeScript,
35
- mockMessages: () => mockMessages,
36
- mockThreads: () => mockThreads,
37
- mockWidgets: () => mockWidgets
38
- });
39
- module.exports = __toCommonJS(index_exports);
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";
40
2
 
41
3
  // src/components/Chat/Chat.tsx
42
- var import_react4 = require("react");
4
+ var _react = require('react');
43
5
 
44
6
  // src/components/Chat/MessageList.tsx
45
- var import_react2 = require("react");
7
+
46
8
 
47
9
  // src/utils/cn.ts
48
- var import_clsx = require("clsx");
49
- var import_tailwind_merge = require("tailwind-merge");
10
+ var _clsx = require('clsx');
11
+ var _tailwindmerge = require('tailwind-merge');
50
12
  function cn(...inputs) {
51
- return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
13
+ return _tailwindmerge.twMerge.call(void 0, _clsx.clsx.call(void 0, inputs));
52
14
  }
53
15
 
54
16
  // src/utils/mock-data.ts
@@ -222,29 +184,29 @@ function generateMockStreamingResponse(text, onChunk, typingSpeed = 30) {
222
184
  }
223
185
 
224
186
  // src/components/Widgets/Widgets.tsx
225
- var import_react = require("react");
187
+
226
188
 
227
189
  // src/components/Widgets/widget-library/Card.tsx
228
- var import_jsx_runtime = require("react/jsx-runtime");
190
+ var _jsxruntime = require('react/jsx-runtime');
229
191
  function Card({ widget, onAction }) {
230
192
  const { title, description, image, footer } = widget.props;
231
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "apteva-widget-card", children: [
232
- image && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: image, alt: title, className: "w-full h-48 object-cover" }),
233
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "p-4", children: [
234
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: title }),
235
- description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-gray-600 dark:text-gray-400 mt-2", children: description })
193
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "apteva-widget-card", children: [
194
+ image && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: image, alt: title, className: "w-full h-48 object-cover" }),
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 })
236
198
  ] }),
237
- (footer || widget.actions && widget.actions.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "border-t border-gray-200 dark:border-gray-700 p-4 flex justify-between items-center", children: [
238
- footer && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-sm text-gray-600 dark:text-gray-400", children: footer }),
239
- widget.actions && widget.actions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex gap-2", children: widget.actions.map((action, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
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 }),
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,
240
202
  "button",
241
203
  {
242
- onClick: () => onAction?.({
204
+ onClick: () => _optionalChain([onAction, 'optionalCall', _ => _({
243
205
  type: action.type,
244
206
  payload: action.payload,
245
207
  widgetId: widget.id,
246
208
  timestamp: /* @__PURE__ */ new Date()
247
- }),
209
+ })]),
248
210
  className: "apteva-widget-button",
249
211
  children: action.label
250
212
  },
@@ -255,25 +217,25 @@ function Card({ widget, onAction }) {
255
217
  }
256
218
 
257
219
  // src/components/Widgets/widget-library/List.tsx
258
- var import_jsx_runtime2 = require("react/jsx-runtime");
220
+
259
221
  function List({ widget, onAction }) {
260
222
  const { items } = widget.props;
261
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "apteva-widget-list", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center p-4 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors", children: [
262
- item.image && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("img", { src: item.image, alt: item.title, className: "w-16 h-16 rounded object-cover" }),
263
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex-1 ml-4", children: [
264
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h4", { className: "font-semibold text-gray-900 dark:text-white", children: item.title }),
265
- item.subtitle && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: item.subtitle }),
266
- item.description && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-xs text-gray-500 dark:text-gray-500 mt-1", children: item.description })
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 })
267
229
  ] }),
268
- widget.actions && widget.actions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex gap-2", children: widget.actions.map((action, idx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
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,
269
231
  "button",
270
232
  {
271
- onClick: () => onAction?.({
233
+ onClick: () => _optionalChain([onAction, 'optionalCall', _2 => _2({
272
234
  type: action.type,
273
235
  payload: item.metadata || item,
274
236
  widgetId: widget.id,
275
237
  timestamp: /* @__PURE__ */ new Date()
276
- }),
238
+ })]),
277
239
  className: "px-3 py-1.5 text-sm rounded-lg font-medium transition-colors bg-apteva-500 text-white hover:bg-apteva-600",
278
240
  children: action.label
279
241
  },
@@ -283,7 +245,7 @@ function List({ widget, onAction }) {
283
245
  }
284
246
 
285
247
  // src/components/Widgets/widget-library/Button.tsx
286
- var import_jsx_runtime3 = require("react/jsx-runtime");
248
+
287
249
  function Button({ widget, onAction }) {
288
250
  const { label, variant = "primary", disabled = false } = widget.props;
289
251
  const variantClasses = {
@@ -292,15 +254,15 @@ function Button({ widget, onAction }) {
292
254
  outline: "border-2 border-apteva-500 text-apteva-500 hover:bg-apteva-50",
293
255
  ghost: "text-apteva-500 hover:bg-apteva-50"
294
256
  };
295
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
257
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
296
258
  "button",
297
259
  {
298
- onClick: () => widget.actions?.[0] && onAction?.({
260
+ onClick: () => _optionalChain([widget, 'access', _3 => _3.actions, 'optionalAccess', _4 => _4[0]]) && _optionalChain([onAction, 'optionalCall', _5 => _5({
299
261
  type: widget.actions[0].type,
300
262
  payload: widget.actions[0].payload,
301
263
  widgetId: widget.id,
302
264
  timestamp: /* @__PURE__ */ new Date()
303
- }),
265
+ })]),
304
266
  disabled,
305
267
  className: cn("px-4 py-2 rounded-lg font-medium transition-colors", variantClasses[variant], {
306
268
  "opacity-50 cursor-not-allowed": disabled
@@ -311,28 +273,28 @@ function Button({ widget, onAction }) {
311
273
  }
312
274
 
313
275
  // src/components/Widgets/WidgetRenderer.tsx
314
- var import_jsx_runtime4 = require("react/jsx-runtime");
276
+
315
277
  function WidgetRenderer({ widget, onAction }) {
316
278
  switch (widget.type) {
317
279
  case "card":
318
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Card, { widget, onAction });
280
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Card, { widget, onAction });
319
281
  case "list":
320
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(List, { widget, onAction });
282
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, List, { widget, onAction });
321
283
  case "button":
322
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Button, { widget, onAction });
284
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { widget, onAction });
323
285
  default:
324
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "p-4 border border-yellow-300 bg-yellow-50 rounded-lg", children: [
325
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "text-sm text-yellow-800", children: [
286
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-4 border border-yellow-300 bg-yellow-50 rounded-lg", children: [
287
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-yellow-800", children: [
326
288
  "Unknown widget type: ",
327
289
  widget.type
328
290
  ] }),
329
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("pre", { className: "text-xs mt-2 overflow-auto", children: JSON.stringify(widget, null, 2) })
291
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "pre", { className: "text-xs mt-2 overflow-auto", children: JSON.stringify(widget, null, 2) })
330
292
  ] });
331
293
  }
332
294
  }
333
295
 
334
296
  // src/components/Widgets/Widgets.tsx
335
- var import_jsx_runtime5 = require("react/jsx-runtime");
297
+
336
298
  function Widgets({
337
299
  widgets,
338
300
  onAction,
@@ -342,9 +304,9 @@ function Widgets({
342
304
  columns = 3,
343
305
  className
344
306
  }) {
345
- (0, import_react.useEffect)(() => {
307
+ _react.useEffect.call(void 0, () => {
346
308
  widgets.forEach((widget) => {
347
- onWidgetMount?.(widget.id);
309
+ _optionalChain([onWidgetMount, 'optionalCall', _6 => _6(widget.id)]);
348
310
  });
349
311
  }, [widgets, onWidgetMount]);
350
312
  const layoutClasses = {
@@ -357,41 +319,41 @@ function Widgets({
357
319
  normal: "gap-4",
358
320
  loose: "gap-6"
359
321
  };
360
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: cn(layoutClasses[layout], spacingClasses[spacing], className), children: widgets.map((widget) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(WidgetRenderer, { widget, onAction }, widget.id)) });
322
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn(layoutClasses[layout], spacingClasses[spacing], className), children: widgets.map((widget) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WidgetRenderer, { widget, onAction }, widget.id)) });
361
323
  }
362
324
 
363
325
  // src/components/Chat/Message.tsx
364
- var import_jsx_runtime6 = require("react/jsx-runtime");
326
+
365
327
  function Message({ message, onAction }) {
366
328
  const isUser = message.role === "user";
367
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cn("apteva-message", isUser ? "apteva-message-user" : "apteva-message-assistant"), children: [
368
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "whitespace-pre-wrap", children: message.content }),
369
- message.widgets && message.widgets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
370
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "text-xs opacity-70 mt-2", children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
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" }) })
371
333
  ] });
372
334
  }
373
335
 
374
336
  // src/components/Chat/MessageList.tsx
375
- var import_jsx_runtime7 = require("react/jsx-runtime");
337
+
376
338
  function MessageList({ messages, onAction }) {
377
- const listRef = (0, import_react2.useRef)(null);
378
- (0, import_react2.useEffect)(() => {
339
+ const listRef = _react.useRef.call(void 0, null);
340
+ _react.useEffect.call(void 0, () => {
379
341
  if (listRef.current) {
380
342
  listRef.current.scrollTop = listRef.current.scrollHeight;
381
343
  }
382
344
  }, [messages]);
383
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: listRef, className: "apteva-message-list", children: messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-center h-full text-gray-500", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "text-center space-y-2", children: [
384
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-4xl", children: "\u{1F4AC}" }),
385
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "No messages yet. Start a conversation!" })
386
- ] }) }) : messages.map((message) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Message, { message, onAction }, message.id)) });
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: [
346
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-4xl", children: "\u{1F4AC}" }),
347
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "No messages yet. Start a conversation!" })
348
+ ] }) }) : messages.map((message) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Message, { message, onAction }, message.id)) });
387
349
  }
388
350
 
389
351
  // src/components/Chat/Composer.tsx
390
- var import_react3 = require("react");
391
- var import_jsx_runtime8 = require("react/jsx-runtime");
352
+
353
+
392
354
  function Composer({ onSendMessage, placeholder = "Type a message...", disabled = false }) {
393
- const [text, setText] = (0, import_react3.useState)("");
394
- const textareaRef = (0, import_react3.useRef)(null);
355
+ const [text, setText] = _react.useState.call(void 0, "");
356
+ const textareaRef = _react.useRef.call(void 0, null);
395
357
  const handleKeyDown = (e) => {
396
358
  if (e.key === "Enter" && !e.shiftKey) {
397
359
  e.preventDefault();
@@ -412,9 +374,9 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
412
374
  e.target.style.height = "auto";
413
375
  e.target.style.height = `${e.target.scrollHeight}px`;
414
376
  };
415
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "apteva-composer", children: [
416
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex gap-2", children: [
417
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
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: [
379
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
418
380
  "textarea",
419
381
  {
420
382
  ref: textareaRef,
@@ -428,7 +390,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
428
390
  style: { maxHeight: "200px" }
429
391
  }
430
392
  ),
431
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
393
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
432
394
  "button",
433
395
  {
434
396
  onClick: handleSend,
@@ -438,12 +400,12 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
438
400
  }
439
401
  )
440
402
  ] }),
441
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-xs text-gray-500 mt-2", children: "Press Enter to send, Shift+Enter for new line" })
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" })
442
404
  ] });
443
405
  }
444
406
 
445
407
  // src/components/Chat/Chat.tsx
446
- var import_jsx_runtime9 = require("react/jsx-runtime");
408
+
447
409
  function Chat({
448
410
  agentId,
449
411
  threadId,
@@ -456,12 +418,12 @@ function Chat({
456
418
  headerTitle = "Chat",
457
419
  className
458
420
  }) {
459
- const [messages, setMessages] = (0, import_react4.useState)(initialMessages.length > 0 ? initialMessages : mockMessages);
460
- const [isLoading, setIsLoading] = (0, import_react4.useState)(false);
461
- (0, import_react4.useEffect)(() => {
421
+ const [messages, setMessages] = _react.useState.call(void 0, initialMessages.length > 0 ? initialMessages : mockMessages);
422
+ const [isLoading, setIsLoading] = _react.useState.call(void 0, false);
423
+ _react.useEffect.call(void 0, () => {
462
424
  if (threadId) {
463
425
  console.log("Loading thread:", threadId);
464
- onThreadChange?.(threadId);
426
+ _optionalChain([onThreadChange, 'optionalCall', _7 => _7(threadId)]);
465
427
  }
466
428
  }, [threadId, onThreadChange]);
467
429
  const handleSendMessage = async (text) => {
@@ -472,7 +434,7 @@ function Chat({
472
434
  timestamp: /* @__PURE__ */ new Date()
473
435
  };
474
436
  setMessages((prev) => [...prev, userMessage]);
475
- onMessageSent?.(userMessage);
437
+ _optionalChain([onMessageSent, 'optionalCall', _8 => _8(userMessage)]);
476
438
  setIsLoading(true);
477
439
  try {
478
440
  const response = await generateMockResponse(1e3);
@@ -483,23 +445,23 @@ function Chat({
483
445
  setIsLoading(false);
484
446
  }
485
447
  };
486
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: cn("apteva-chat-container", className), children: [
487
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "border-b border-gray-200 dark:border-gray-700 px-4 py-3", children: [
488
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: headerTitle }),
489
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
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: [
490
452
  "Agent: ",
491
453
  agentId
492
454
  ] })
493
455
  ] }),
494
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MessageList, { messages, onAction }),
495
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "px-4 py-2 text-sm text-gray-500 italic", children: "AI is thinking..." }),
496
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Composer, { onSendMessage: handleSendMessage, placeholder, disabled: isLoading })
456
+ /* @__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 })
497
459
  ] });
498
460
  }
499
461
 
500
462
  // src/components/Command/Command.tsx
501
- var import_react5 = require("react");
502
- var import_jsx_runtime10 = require("react/jsx-runtime");
463
+
464
+
503
465
  function Command({
504
466
  agentId,
505
467
  command: initialCommand,
@@ -520,13 +482,13 @@ function Command({
520
482
  resultRenderer,
521
483
  className
522
484
  }) {
523
- const [state, setState] = (0, import_react5.useState)("idle");
524
- const [result, setResult] = (0, import_react5.useState)(null);
525
- const [error, setError] = (0, import_react5.useState)(null);
526
- const [progress, setProgress] = (0, import_react5.useState)(0);
527
- const [command, setCommand] = (0, import_react5.useState)(initialCommand || "");
528
- const [streamedContent, setStreamedContent] = (0, import_react5.useState)("");
529
- (0, import_react5.useEffect)(() => {
485
+ const [state, setState] = _react.useState.call(void 0, "idle");
486
+ const [result, setResult] = _react.useState.call(void 0, null);
487
+ const [error, setError] = _react.useState.call(void 0, null);
488
+ const [progress, setProgress] = _react.useState.call(void 0, 0);
489
+ const [command, setCommand] = _react.useState.call(void 0, initialCommand || "");
490
+ const [streamedContent, setStreamedContent] = _react.useState.call(void 0, "");
491
+ _react.useEffect.call(void 0, () => {
530
492
  if (autoExecute && state === "idle" && command) {
531
493
  executeCommand();
532
494
  }
@@ -541,7 +503,7 @@ function Command({
541
503
  setError(null);
542
504
  setProgress(0);
543
505
  setStreamedContent("");
544
- onStart?.();
506
+ _optionalChain([onStart, 'optionalCall', _9 => _9()]);
545
507
  try {
546
508
  if (enableStreaming) {
547
509
  const mockStreamChunks = [
@@ -557,9 +519,9 @@ function Command({
557
519
  await new Promise((resolve) => setTimeout(resolve, 600 + Math.random() * 400));
558
520
  const chunk = mockStreamChunks[i];
559
521
  setStreamedContent(chunk);
560
- onChunk?.(chunk);
522
+ _optionalChain([onChunk, 'optionalCall', _10 => _10(chunk)]);
561
523
  setProgress(Math.round((i + 1) / mockStreamChunks.length * 100));
562
- onProgress?.(Math.round((i + 1) / mockStreamChunks.length * 100));
524
+ _optionalChain([onProgress, 'optionalCall', _11 => _11(Math.round((i + 1) / mockStreamChunks.length * 100))]);
563
525
  }
564
526
  const mockResult = {
565
527
  success: true,
@@ -574,12 +536,12 @@ function Command({
574
536
  setResult(mockResult);
575
537
  setState("success");
576
538
  setProgress(100);
577
- onComplete?.(mockResult);
539
+ _optionalChain([onComplete, 'optionalCall', _12 => _12(mockResult)]);
578
540
  } else {
579
541
  const progressInterval = setInterval(() => {
580
542
  setProgress((prev) => {
581
543
  const next = Math.min(prev + 10, 90);
582
- onProgress?.(next);
544
+ _optionalChain([onProgress, 'optionalCall', _13 => _13(next)]);
583
545
  return next;
584
546
  });
585
547
  }, 200);
@@ -598,13 +560,13 @@ function Command({
598
560
  setResult(mockResult);
599
561
  setState("success");
600
562
  setProgress(100);
601
- onComplete?.(mockResult);
563
+ _optionalChain([onComplete, 'optionalCall', _14 => _14(mockResult)]);
602
564
  }
603
565
  } catch (err) {
604
566
  const error2 = err instanceof Error ? err : new Error("Unknown error");
605
567
  setError(error2);
606
568
  setState("error");
607
- onError?.(error2);
569
+ _optionalChain([onError, 'optionalCall', _15 => _15(error2)]);
608
570
  }
609
571
  };
610
572
  const resetCommand = () => {
@@ -615,22 +577,22 @@ function Command({
615
577
  setCommand("");
616
578
  };
617
579
  const isCompact = variant === "compact";
618
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
580
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
619
581
  "div",
620
582
  {
621
583
  className: cn(
622
584
  "relative border-2 rounded-xl bg-white dark:bg-gray-900 transition-all duration-300 flex flex-col",
623
585
  state === "loading" && "animate-pulse-border",
624
586
  state === "idle" && "border-gray-300 dark:border-gray-700",
625
- state === "loading" && "border-apteva-500",
587
+ state === "loading" && "border-blue-500",
626
588
  state === "success" && "border-green-500",
627
589
  state === "error" && "border-red-500",
628
590
  className
629
591
  ),
630
592
  style: { minHeight: isCompact ? "auto" : "180px" },
631
593
  children: [
632
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: cn("flex-1 flex", isCompact ? "flex-row items-center p-3 gap-3" : "flex-col p-4"), children: [
633
- state === "idle" && allowInput && !isCompact && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
594
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("flex-1 flex", isCompact ? "flex-row items-center p-3 gap-3" : "flex-col p-4"), children: [
595
+ state === "idle" && allowInput && !isCompact && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
634
596
  "textarea",
635
597
  {
636
598
  value: command,
@@ -646,8 +608,8 @@ function Command({
646
608
  rows: 6
647
609
  }
648
610
  ),
649
- state === "idle" && allowInput && isCompact && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
650
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
611
+ state === "idle" && allowInput && isCompact && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
612
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
651
613
  "input",
652
614
  {
653
615
  type: "text",
@@ -663,7 +625,7 @@ function Command({
663
625
  className: "flex-1 bg-transparent border-none focus:outline-none text-gray-900 dark:text-white placeholder-gray-400 py-1"
664
626
  }
665
627
  ),
666
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
628
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
667
629
  "button",
668
630
  {
669
631
  onClick: executeCommand,
@@ -682,29 +644,29 @@ function Command({
682
644
  }
683
645
  )
684
646
  ] }),
685
- state === "loading" && !isCompact && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex-1 flex flex-col items-center justify-center space-y-4 py-8", children: [
686
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "w-6 h-6 border-2 border-gray-300 border-t-apteva-500 rounded-full animate-spin" }),
687
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-gray-600 dark:text-gray-400 text-sm text-center max-w-md", children: enableStreaming && streamedContent ? streamedContent : loadingText }),
688
- showProgress && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w-full max-w-sm", children: [
689
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "w-full bg-gray-200 dark:bg-gray-700 rounded-full h-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
647
+ state === "loading" && !isCompact && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 flex flex-col items-center justify-center space-y-4 py-8", children: [
648
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-6 h-6 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin" }),
649
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-gray-600 dark:text-gray-400 text-sm text-center max-w-md", children: enableStreaming && streamedContent ? streamedContent : loadingText }),
650
+ showProgress && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "w-full max-w-sm", children: [
651
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-full bg-gray-200 dark:bg-gray-700 rounded-full h-1.5", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
690
652
  "div",
691
653
  {
692
- className: "bg-apteva-500 h-1.5 rounded-full transition-all duration-300",
654
+ className: "bg-blue-500 h-1.5 rounded-full transition-all duration-300",
693
655
  style: { width: `${progress}%` }
694
656
  }
695
657
  ) }),
696
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "text-xs text-gray-500 mt-2 text-center", children: [
658
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-xs text-gray-500 mt-2 text-center", children: [
697
659
  progress,
698
660
  "%"
699
661
  ] })
700
662
  ] })
701
663
  ] }),
702
- state === "loading" && isCompact && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
703
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex-1 flex items-center gap-3 py-1", children: [
704
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "w-4 h-4 border-2 border-gray-300 border-t-apteva-500 rounded-full animate-spin" }),
705
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-gray-600 dark:text-gray-400 text-sm truncate", children: enableStreaming && streamedContent ? streamedContent : loadingText })
664
+ state === "loading" && isCompact && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
665
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 flex items-center gap-3 py-1", children: [
666
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-4 h-4 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin" }),
667
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-gray-600 dark:text-gray-400 text-sm truncate", children: enableStreaming && streamedContent ? streamedContent : loadingText })
706
668
  ] }),
707
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
669
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
708
670
  "button",
709
671
  {
710
672
  disabled: true,
@@ -719,15 +681,15 @@ function Command({
719
681
  }
720
682
  )
721
683
  ] }),
722
- state === "error" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex-1 flex flex-col", children: [
723
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mb-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-start gap-2", children: [
724
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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__ */ (0, import_jsx_runtime10.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
725
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
726
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { className: "text-sm font-semibold text-red-800 dark:text-red-400", children: "Error" }),
727
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: error?.message })
684
+ state === "error" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 flex flex-col", children: [
685
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mb-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start gap-2", children: [
686
+ /* @__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" }) }),
687
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
688
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-semibold text-red-800 dark:text-red-400", children: "Error" }),
689
+ /* @__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]) })
728
690
  ] })
729
691
  ] }) }),
730
- allowInput && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
692
+ allowInput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
731
693
  "textarea",
732
694
  {
733
695
  value: command,
@@ -744,22 +706,22 @@ function Command({
744
706
  }
745
707
  )
746
708
  ] }),
747
- state === "success" && result && !isCompact && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex-1 overflow-auto", children: resultRenderer ? resultRenderer(result.data) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
748
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-start gap-3 mb-3 p-3 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg", children: [
749
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { className: "w-5 h-5 text-green-600 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
750
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex-1", children: [
751
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { className: "text-sm font-semibold text-green-800 dark:text-green-400 mb-1", children: "Success" }),
752
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-green-700 dark:text-green-300 text-sm", children: result.message || "Command executed successfully" })
709
+ state === "success" && result && !isCompact && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex-1 overflow-auto", children: resultRenderer ? resultRenderer(result.data) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
710
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start gap-3 mb-3 p-3 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg", children: [
711
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-5 h-5 text-green-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: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
712
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1", children: [
713
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-semibold text-green-800 dark:text-green-400 mb-1", children: "Success" }),
714
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-green-700 dark:text-green-300 text-sm", children: result.message || "Command executed successfully" })
753
715
  ] })
754
716
  ] }),
755
- result.data?.summary && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-gray-700 dark:text-gray-300 text-sm leading-relaxed", children: result.data.summary })
717
+ _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 })
756
718
  ] }) }),
757
- state === "success" && result && isCompact && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
758
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex-1 flex items-center gap-2 py-1", children: [
759
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { className: "w-4 h-4 text-green-600 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
760
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-green-700 dark:text-green-300 text-sm truncate", children: resultRenderer ? resultRenderer(result.data) : result.message || "Command executed successfully" })
719
+ state === "success" && result && isCompact && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
720
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 flex items-center gap-2 py-1", children: [
721
+ /* @__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" }) }),
722
+ /* @__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" })
761
723
  ] }),
762
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
724
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
763
725
  "button",
764
726
  {
765
727
  disabled: true,
@@ -775,8 +737,8 @@ function Command({
775
737
  )
776
738
  ] })
777
739
  ] }),
778
- !isCompact && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "p-3 flex items-center justify-end gap-2", children: [
779
- (state === "success" || state === "error") && allowInput && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
740
+ !isCompact && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-3 flex items-center justify-end gap-2", children: [
741
+ (state === "success" || state === "error") && allowInput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
780
742
  "button",
781
743
  {
782
744
  onClick: resetCommand,
@@ -784,7 +746,7 @@ function Command({
784
746
  children: "Reset"
785
747
  }
786
748
  ),
787
- (state === "idle" || state === "error") && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
749
+ (state === "idle" || state === "error") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
788
750
  "button",
789
751
  {
790
752
  onClick: executeCommand,
@@ -803,7 +765,7 @@ function Command({
803
765
  }
804
766
  )
805
767
  ] }),
806
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("style", { dangerouslySetInnerHTML: {
768
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { dangerouslySetInnerHTML: {
807
769
  __html: `
808
770
  @keyframes pulse-border {
809
771
  0%, 100% {
@@ -824,8 +786,8 @@ function Command({
824
786
  }
825
787
 
826
788
  // src/components/Prompt/Prompt.tsx
827
- var import_react6 = require("react");
828
- var import_jsx_runtime11 = require("react/jsx-runtime");
789
+
790
+
829
791
  function Prompt({
830
792
  agentId,
831
793
  placeholder = "Enter your prompt...",
@@ -841,24 +803,24 @@ function Prompt({
841
803
  showSuggestions = false,
842
804
  className
843
805
  }) {
844
- const [value, setValue] = (0, import_react6.useState)(initialValue);
845
- const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
846
- const [suggestions] = (0, import_react6.useState)(["Plan a trip", "Write a description", "Analyze data"]);
806
+ const [value, setValue] = _react.useState.call(void 0, initialValue);
807
+ const [isLoading, setIsLoading] = _react.useState.call(void 0, false);
808
+ const [suggestions] = _react.useState.call(void 0, ["Plan a trip", "Write a description", "Analyze data"]);
847
809
  const handleChange = (e) => {
848
810
  const newValue = e.target.value;
849
811
  if (!maxLength || newValue.length <= maxLength) {
850
812
  setValue(newValue);
851
- onChange?.(newValue);
813
+ _optionalChain([onChange, 'optionalCall', _19 => _19(newValue)]);
852
814
  }
853
815
  };
854
816
  const handleSubmit = async () => {
855
817
  if (value.length < minLength) return;
856
- onSubmit?.(value);
818
+ _optionalChain([onSubmit, 'optionalCall', _20 => _20(value)]);
857
819
  setIsLoading(true);
858
820
  try {
859
821
  await new Promise((resolve) => setTimeout(resolve, 1500));
860
822
  const mockResult = `Enhanced version: ${value} [AI-generated content]`;
861
- onResult?.(mockResult);
823
+ _optionalChain([onResult, 'optionalCall', _21 => _21(mockResult)]);
862
824
  setValue("");
863
825
  } catch (error) {
864
826
  console.error("Error processing prompt:", error);
@@ -877,9 +839,9 @@ function Prompt({
877
839
  handleSubmit();
878
840
  }
879
841
  };
880
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cn("space-y-2", className), children: [
881
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex gap-2", children: [
882
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
842
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("space-y-2", className), children: [
843
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
844
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
883
845
  "input",
884
846
  {
885
847
  type: "text",
@@ -892,7 +854,7 @@ function Prompt({
892
854
  className: "flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-apteva-500 dark:bg-gray-800 dark:border-gray-600 dark:text-white"
893
855
  }
894
856
  ),
895
- submitOn === "button" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
857
+ submitOn === "button" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
896
858
  "button",
897
859
  {
898
860
  onClick: handleSubmit,
@@ -902,13 +864,13 @@ function Prompt({
902
864
  }
903
865
  )
904
866
  ] }),
905
- maxLength && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "text-xs text-gray-500", children: [
867
+ maxLength && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-xs text-gray-500", children: [
906
868
  value.length,
907
869
  " / ",
908
870
  maxLength,
909
871
  " characters"
910
872
  ] }),
911
- showSuggestions && !value && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-wrap gap-2", children: suggestions.map((suggestion, idx) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
873
+ showSuggestions && !value && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-wrap gap-2", children: suggestions.map((suggestion, idx) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
912
874
  "button",
913
875
  {
914
876
  onClick: () => setValue(suggestion),
@@ -917,16 +879,16 @@ function Prompt({
917
879
  },
918
880
  idx
919
881
  )) }),
920
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2 text-sm text-gray-500", children: [
921
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w-4 h-4 border-2 border-apteva-500 border-t-transparent rounded-full animate-spin" }),
922
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: "AI is processing your request..." })
882
+ isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2 text-sm text-gray-500", children: [
883
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-4 h-4 border-2 border-apteva-500 border-t-transparent rounded-full animate-spin" }),
884
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "AI is processing your request..." })
923
885
  ] })
924
886
  ] });
925
887
  }
926
888
 
927
889
  // src/components/Stream/Stream.tsx
928
- var import_react7 = require("react");
929
- var import_jsx_runtime12 = require("react/jsx-runtime");
890
+
891
+
930
892
  function Stream({
931
893
  agentId,
932
894
  prompt,
@@ -941,33 +903,33 @@ function Stream({
941
903
  typingSpeed = 30,
942
904
  className
943
905
  }) {
944
- const [text, setText] = (0, import_react7.useState)("");
945
- const [isStreaming, setIsStreaming] = (0, import_react7.useState)(false);
946
- const [isComplete, setIsComplete] = (0, import_react7.useState)(false);
947
- (0, import_react7.useEffect)(() => {
906
+ const [text, setText] = _react.useState.call(void 0, "");
907
+ const [isStreaming, setIsStreaming] = _react.useState.call(void 0, false);
908
+ const [isComplete, setIsComplete] = _react.useState.call(void 0, false);
909
+ _react.useEffect.call(void 0, () => {
948
910
  if (autoStart && !isStreaming && !isComplete) {
949
911
  startStreaming();
950
912
  }
951
913
  }, [autoStart]);
952
914
  const startStreaming = async () => {
953
915
  setIsStreaming(true);
954
- onStart?.();
916
+ _optionalChain([onStart, 'optionalCall', _22 => _22()]);
955
917
  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.";
956
918
  try {
957
919
  await generateMockStreamingResponse(
958
920
  mockText,
959
921
  (chunk) => {
960
922
  setText((prev) => prev + chunk);
961
- onChunk?.(chunk);
923
+ _optionalChain([onChunk, 'optionalCall', _23 => _23(chunk)]);
962
924
  },
963
925
  typingSpeed
964
926
  );
965
927
  setIsComplete(true);
966
928
  setIsStreaming(false);
967
- onComplete?.(text + mockText);
929
+ _optionalChain([onComplete, 'optionalCall', _24 => _24(text + mockText)]);
968
930
  } catch (error) {
969
931
  const err = error instanceof Error ? error : new Error("Streaming error");
970
- onError?.(err);
932
+ _optionalChain([onError, 'optionalCall', _25 => _25(err)]);
971
933
  setIsStreaming(false);
972
934
  }
973
935
  };
@@ -977,7 +939,7 @@ function Stream({
977
939
  plain: "text-gray-900 dark:text-gray-100"
978
940
  };
979
941
  if (!isStreaming && !isComplete) {
980
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("p-4", className), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
942
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("p-4", className), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
981
943
  "button",
982
944
  {
983
945
  onClick: startStreaming,
@@ -986,19 +948,19 @@ function Stream({
986
948
  }
987
949
  ) });
988
950
  }
989
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn(variantClasses[variant], className), children: [
951
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn(variantClasses[variant], className), children: [
990
952
  text,
991
- isStreaming && showCursor && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "apteva-stream-cursor" })
953
+ isStreaming && showCursor && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "apteva-stream-cursor" })
992
954
  ] });
993
955
  }
994
956
 
995
957
  // src/components/Threads/ThreadList.tsx
996
- var import_react8 = require("react");
958
+
997
959
 
998
960
  // src/components/Threads/ThreadItem.tsx
999
- var import_jsx_runtime13 = require("react/jsx-runtime");
961
+
1000
962
  function ThreadItem({ thread, isActive = false, onSelect, onDelete }) {
1001
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
963
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1002
964
  "div",
1003
965
  {
1004
966
  className: cn("apteva-thread-item", {
@@ -1006,19 +968,19 @@ function ThreadItem({ thread, isActive = false, onSelect, onDelete }) {
1006
968
  }),
1007
969
  onClick: onSelect,
1008
970
  children: [
1009
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex-1 min-w-0", children: [
1010
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h4", { className: "font-semibold text-gray-900 dark:text-white truncate", children: thread.title }),
1011
- thread.preview && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-sm text-gray-600 dark:text-gray-400 truncate", children: thread.preview }),
1012
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2 mt-1 text-xs text-gray-500", children: [
1013
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
971
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 min-w-0", children: [
972
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-semibold text-gray-900 dark:text-white truncate", children: thread.title }),
973
+ thread.preview && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-gray-600 dark:text-gray-400 truncate", children: thread.preview }),
974
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2 mt-1 text-xs text-gray-500", children: [
975
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
1014
976
  thread.messageCount,
1015
977
  " messages"
1016
978
  ] }),
1017
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "\u2022" }),
1018
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: formatRelativeTime(thread.updatedAt) })
979
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "\u2022" }),
980
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: formatRelativeTime(thread.updatedAt) })
1019
981
  ] })
1020
982
  ] }),
1021
- onDelete && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
983
+ onDelete && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1022
984
  "button",
1023
985
  {
1024
986
  onClick: (e) => {
@@ -1048,7 +1010,7 @@ function formatRelativeTime(date) {
1048
1010
  }
1049
1011
 
1050
1012
  // src/components/Threads/ThreadList.tsx
1051
- var import_jsx_runtime14 = require("react/jsx-runtime");
1013
+
1052
1014
  function ThreadList({
1053
1015
  threads,
1054
1016
  currentThreadId,
@@ -1057,13 +1019,13 @@ function ThreadList({
1057
1019
  showSearch = false,
1058
1020
  groupBy = "none"
1059
1021
  }) {
1060
- const [searchQuery, setSearchQuery] = (0, import_react8.useState)("");
1022
+ const [searchQuery, setSearchQuery] = _react.useState.call(void 0, "");
1061
1023
  const filteredThreads = threads.filter(
1062
- (thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || thread.preview?.toLowerCase().includes(searchQuery.toLowerCase())
1024
+ (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())])
1063
1025
  );
1064
1026
  const groupedThreads = groupBy === "date" ? groupThreadsByDate(filteredThreads) : { All: filteredThreads };
1065
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col h-full", children: [
1066
- showSearch && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "p-3 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1027
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col h-full", children: [
1028
+ showSearch && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-3 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1067
1029
  "input",
1068
1030
  {
1069
1031
  type: "text",
@@ -1073,23 +1035,23 @@ function ThreadList({
1073
1035
  className: "w-full px-3 py-2 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-apteva-500 dark:bg-gray-800 dark:border-gray-600 dark:text-white"
1074
1036
  }
1075
1037
  ) }),
1076
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex-1 overflow-y-auto", children: [
1077
- Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
1078
- groupBy !== "none" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "px-3 py-2 text-xs font-semibold text-gray-500 uppercase", children: group }),
1079
- groupThreads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1038
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 overflow-y-auto", children: [
1039
+ Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
1040
+ groupBy !== "none" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-3 py-2 text-xs font-semibold text-gray-500 uppercase", children: group }),
1041
+ groupThreads.map((thread) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1080
1042
  ThreadItem,
1081
1043
  {
1082
1044
  thread,
1083
1045
  isActive: thread.id === currentThreadId,
1084
- onSelect: () => onThreadSelect?.(thread.id),
1085
- onDelete: () => onThreadDelete?.(thread.id)
1046
+ onSelect: () => _optionalChain([onThreadSelect, 'optionalCall', _31 => _31(thread.id)]),
1047
+ onDelete: () => _optionalChain([onThreadDelete, 'optionalCall', _32 => _32(thread.id)])
1086
1048
  },
1087
1049
  thread.id
1088
1050
  ))
1089
1051
  ] }, group)),
1090
- filteredThreads.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "p-8 text-center text-gray-500", children: [
1091
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "text-4xl mb-2", children: "\u{1F4AC}" }),
1092
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: "No conversations found" })
1052
+ filteredThreads.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-8 text-center text-gray-500", children: [
1053
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-4xl mb-2", children: "\u{1F4AC}" }),
1054
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "No conversations found" })
1093
1055
  ] })
1094
1056
  ] })
1095
1057
  ] });
@@ -1121,7 +1083,7 @@ function groupThreadsByDate(threads) {
1121
1083
  }
1122
1084
 
1123
1085
  // src/components/Threads/Threads.tsx
1124
- var import_jsx_runtime15 = require("react/jsx-runtime");
1086
+
1125
1087
  function Threads({
1126
1088
  threads,
1127
1089
  currentThreadId,
@@ -1140,11 +1102,11 @@ function Threads({
1140
1102
  tabs: "flex gap-2 border-b border-gray-200 dark:border-gray-700 overflow-x-auto"
1141
1103
  };
1142
1104
  if (variant === "tabs") {
1143
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn(variantClasses[variant], className), children: [
1144
- threads.slice(0, 5).map((thread) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1105
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn(variantClasses[variant], className), children: [
1106
+ threads.slice(0, 5).map((thread) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1145
1107
  "button",
1146
1108
  {
1147
- onClick: () => onThreadSelect?.(thread.id),
1109
+ onClick: () => _optionalChain([onThreadSelect, 'optionalCall', _33 => _33(thread.id)]),
1148
1110
  className: cn(
1149
1111
  "px-4 py-2 whitespace-nowrap font-medium transition-colors",
1150
1112
  thread.id === currentThreadId ? "border-b-2 border-apteva-500 text-apteva-500" : "text-gray-600 hover:text-gray-900"
@@ -1153,7 +1115,7 @@ function Threads({
1153
1115
  },
1154
1116
  thread.id
1155
1117
  )),
1156
- showNewButton && onNewThread && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1118
+ showNewButton && onNewThread && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1157
1119
  "button",
1158
1120
  {
1159
1121
  onClick: onNewThread,
@@ -1163,8 +1125,8 @@ function Threads({
1163
1125
  )
1164
1126
  ] });
1165
1127
  }
1166
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn(variantClasses[variant], "flex flex-col", className), children: [
1167
- showNewButton && onNewThread && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "p-3 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1128
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn(variantClasses[variant], "flex flex-col", className), children: [
1129
+ showNewButton && onNewThread && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-3 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1168
1130
  "button",
1169
1131
  {
1170
1132
  onClick: onNewThread,
@@ -1172,7 +1134,7 @@ function Threads({
1172
1134
  children: "+ New Conversation"
1173
1135
  }
1174
1136
  ) }),
1175
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1137
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1176
1138
  ThreadList,
1177
1139
  {
1178
1140
  threads,
@@ -1209,21 +1171,20 @@ var themeScript = `
1209
1171
  function getThemeScript() {
1210
1172
  return themeScript;
1211
1173
  }
1212
- // Annotate the CommonJS export names for ESM import in node:
1213
- 0 && (module.exports = {
1214
- Button,
1215
- Card,
1216
- Chat,
1217
- Command,
1218
- List,
1219
- Prompt,
1220
- Stream,
1221
- Threads,
1222
- Widgets,
1223
- cn,
1224
- getThemeScript,
1225
- mockMessages,
1226
- mockThreads,
1227
- mockWidgets
1228
- });
1174
+
1175
+
1176
+
1177
+
1178
+
1179
+
1180
+
1181
+
1182
+
1183
+
1184
+
1185
+
1186
+
1187
+
1188
+
1189
+ exports.Button = Button; exports.Card = Card; exports.Chat = Chat; exports.Command = Command; exports.List = List; exports.Prompt = Prompt; exports.Stream = Stream; exports.Threads = Threads; exports.Widgets = Widgets; exports.cn = cn; exports.getThemeScript = getThemeScript; exports.mockMessages = mockMessages; exports.mockThreads = mockThreads; exports.mockWidgets = mockWidgets;
1229
1190
  //# sourceMappingURL=index.js.map