@apteva/apteva-kit 0.1.15 → 0.1.16

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
@@ -1062,6 +1062,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
1062
1062
  const [fileError, setFileError] = _react.useState.call(void 0, null);
1063
1063
  const textareaRef = _react.useRef.call(void 0, null);
1064
1064
  const fileInputRef = _react.useRef.call(void 0, null);
1065
+ const menuButtonRef = _react.useRef.call(void 0, null);
1065
1066
  const handleKeyDown = (e) => {
1066
1067
  if (e.key === "Enter" && !e.shiftKey) {
1067
1068
  e.preventDefault();
@@ -1139,39 +1140,6 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
1139
1140
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-4 h-4 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", 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" }) }),
1140
1141
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: fileError })
1141
1142
  ] }) }),
1142
- showMenu && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1143
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fixed inset-0 z-10", onClick: () => setShowMenu(false) }),
1144
- /* @__PURE__ */ _jsxruntime.jsxs.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: [
1145
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1146
- "button",
1147
- {
1148
- onClick: () => {
1149
- _optionalChain([fileInputRef, 'access', _19 => _19.current, 'optionalAccess', _20 => _20.click, 'call', _21 => _21()]);
1150
- setShowMenu(false);
1151
- },
1152
- 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",
1153
- children: [
1154
- /* @__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)" }) }),
1155
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Add photos & files" })
1156
- ]
1157
- }
1158
- ),
1159
- onSwitchMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1160
- "button",
1161
- {
1162
- onClick: () => {
1163
- onSwitchMode();
1164
- setShowMenu(false);
1165
- },
1166
- 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 border-t border-gray-700 dark:border-gray-600",
1167
- children: [
1168
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
1169
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Switch to command mode" })
1170
- ]
1171
- }
1172
- )
1173
- ] })
1174
- ] }),
1175
1143
  pendingFiles.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mb-2 flex flex-wrap gap-2", children: pendingFiles.map((pf, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1176
1144
  "div",
1177
1145
  {
@@ -1195,16 +1163,62 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
1195
1163
  },
1196
1164
  index
1197
1165
  )) }),
1198
- /* @__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: [
1199
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1200
- "button",
1201
- {
1202
- onClick: () => setShowMenu(!showMenu),
1203
- 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",
1204
- title: "More options",
1205
- 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" }) })
1206
- }
1207
- ),
1166
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "apteva-composer relative border-2 border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 transition-all duration-300 flex items-center px-3 py-2 gap-3", children: [
1167
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative flex-shrink-0", children: [
1168
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1169
+ "button",
1170
+ {
1171
+ ref: menuButtonRef,
1172
+ onClick: () => setShowMenu(!showMenu),
1173
+ className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all !text-gray-700 dark:!text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",
1174
+ title: "More options",
1175
+ 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" }) })
1176
+ }
1177
+ ),
1178
+ showMenu && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1179
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
1180
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1181
+ "div",
1182
+ {
1183
+ className: "fixed bg-gray-800 dark:bg-gray-700 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
1184
+ style: {
1185
+ left: _nullishCoalesce(_optionalChain([menuButtonRef, 'access', _19 => _19.current, 'optionalAccess', _20 => _20.getBoundingClientRect, 'call', _21 => _21(), 'access', _22 => _22.left]), () => ( 0)),
1186
+ top: (_nullishCoalesce(_optionalChain([menuButtonRef, 'access', _23 => _23.current, 'optionalAccess', _24 => _24.getBoundingClientRect, 'call', _25 => _25(), 'access', _26 => _26.bottom]), () => ( 0))) + 8
1187
+ },
1188
+ children: [
1189
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1190
+ "button",
1191
+ {
1192
+ onClick: () => {
1193
+ _optionalChain([fileInputRef, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.click, 'call', _29 => _29()]);
1194
+ setShowMenu(false);
1195
+ },
1196
+ 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",
1197
+ children: [
1198
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "18", height: "18", 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)" }) }),
1199
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Add photos & files" })
1200
+ ]
1201
+ }
1202
+ ),
1203
+ onSwitchMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1204
+ "button",
1205
+ {
1206
+ onClick: () => {
1207
+ onSwitchMode();
1208
+ setShowMenu(false);
1209
+ },
1210
+ 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 border-t border-gray-700 dark:border-gray-600",
1211
+ children: [
1212
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
1213
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Switch to command mode" })
1214
+ ]
1215
+ }
1216
+ )
1217
+ ]
1218
+ }
1219
+ )
1220
+ ] })
1221
+ ] }),
1208
1222
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1209
1223
  "textarea",
1210
1224
  {
@@ -1286,8 +1300,8 @@ function CommandComposer({
1286
1300
  }
1287
1301
  };
1288
1302
  const handleNewCommand = () => {
1289
- _optionalChain([onReset, 'optionalCall', _22 => _22()]);
1290
- _optionalChain([inputRef, 'access', _23 => _23.current, 'optionalAccess', _24 => _24.focus, 'call', _25 => _25()]);
1303
+ _optionalChain([onReset, 'optionalCall', _30 => _30()]);
1304
+ _optionalChain([inputRef, 'access', _31 => _31.current, 'optionalAccess', _32 => _32.focus, 'call', _33 => _33()]);
1291
1305
  };
1292
1306
  const handleInputChange = (value) => {
1293
1307
  setInput(value);
@@ -1370,51 +1384,6 @@ function CommandComposer({
1370
1384
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-3 h-3 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", 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" }) }),
1371
1385
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: fileError })
1372
1386
  ] }) }),
1373
- showMenu && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1374
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
1375
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1376
- "div",
1377
- {
1378
- className: "fixed bg-gray-800 dark:bg-gray-700 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
1379
- style: {
1380
- bottom: "auto",
1381
- left: _nullishCoalesce(_optionalChain([menuButtonRef, 'access', _26 => _26.current, 'optionalAccess', _27 => _27.getBoundingClientRect, 'call', _28 => _28(), 'access', _29 => _29.left]), () => ( 0)),
1382
- top: (_nullishCoalesce(_optionalChain([menuButtonRef, 'access', _30 => _30.current, 'optionalAccess', _31 => _31.getBoundingClientRect, 'call', _32 => _32(), 'access', _33 => _33.top]), () => ( 0))) - 8,
1383
- transform: "translateY(-100%)"
1384
- },
1385
- children: [
1386
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1387
- "button",
1388
- {
1389
- onClick: () => {
1390
- _optionalChain([fileInputRef, 'access', _34 => _34.current, 'optionalAccess', _35 => _35.click, 'call', _36 => _36()]);
1391
- setShowMenu(false);
1392
- },
1393
- 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",
1394
- children: [
1395
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "18", height: "18", 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)" }) }),
1396
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Add photos & files" })
1397
- ]
1398
- }
1399
- ),
1400
- onExpand && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1401
- "button",
1402
- {
1403
- onClick: () => {
1404
- onExpand();
1405
- setShowMenu(false);
1406
- },
1407
- 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 border-t border-gray-700 dark:border-gray-600",
1408
- children: [
1409
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
1410
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Expand to chat" })
1411
- ]
1412
- }
1413
- )
1414
- ]
1415
- }
1416
- )
1417
- ] }),
1418
1387
  pendingFiles.length > 0 && state === "idle" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mb-2 flex flex-wrap gap-2", children: pendingFiles.map((pf, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1419
1388
  "div",
1420
1389
  {
@@ -1439,7 +1408,7 @@ function CommandComposer({
1439
1408
  "div",
1440
1409
  {
1441
1410
  className: cn(
1442
- "flex items-center gap-2 px-3 py-2 border-2 rounded-2xl bg-white dark:bg-gray-900 transition-all duration-200",
1411
+ "apteva-composer flex items-center gap-2 px-3 py-2 border-2 bg-white dark:bg-gray-900 transition-all duration-200",
1443
1412
  state === "idle" && "border-gray-200 dark:border-gray-700",
1444
1413
  state === "loading" && "border-blue-400 dark:border-blue-500",
1445
1414
  state === "plan-pending" && "border-amber-400 dark:border-amber-500",
@@ -1447,18 +1416,65 @@ function CommandComposer({
1447
1416
  state === "error" && "border-red-400 dark:border-red-500"
1448
1417
  ),
1449
1418
  children: [
1450
- state === "idle" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1451
- "button",
1452
- {
1453
- ref: menuButtonRef,
1454
- onClick: () => setShowMenu(!showMenu),
1455
- className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-gray-500 dark:!text-gray-400 hover:!text-gray-700 dark:hover:!text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800",
1456
- title: "More options",
1457
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "18", height: "18", 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" }) })
1458
- }
1459
- ),
1460
- state === "loading" && !toolName && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-4 h-4 border-2 border-blue-200 border-t-blue-500 rounded-full animate-spin flex-shrink-0" }),
1461
- state === "loading" && toolName && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-2 h-2 rounded-full bg-blue-500 animate-pulse flex-shrink-0" }),
1419
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: [
1420
+ state === "idle" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative", children: [
1421
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1422
+ "button",
1423
+ {
1424
+ ref: menuButtonRef,
1425
+ onClick: () => setShowMenu(!showMenu),
1426
+ className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all !text-gray-500 dark:!text-gray-400 hover:!text-gray-700 dark:hover:!text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800",
1427
+ title: "More options",
1428
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "18", height: "18", 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" }) })
1429
+ }
1430
+ ),
1431
+ showMenu && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1432
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
1433
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1434
+ "div",
1435
+ {
1436
+ className: "fixed bg-gray-800 dark:bg-gray-700 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
1437
+ style: {
1438
+ left: _nullishCoalesce(_optionalChain([menuButtonRef, 'access', _34 => _34.current, 'optionalAccess', _35 => _35.getBoundingClientRect, 'call', _36 => _36(), 'access', _37 => _37.left]), () => ( 0)),
1439
+ top: (_nullishCoalesce(_optionalChain([menuButtonRef, 'access', _38 => _38.current, 'optionalAccess', _39 => _39.getBoundingClientRect, 'call', _40 => _40(), 'access', _41 => _41.bottom]), () => ( 0))) + 8
1440
+ },
1441
+ children: [
1442
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1443
+ "button",
1444
+ {
1445
+ onClick: () => {
1446
+ _optionalChain([fileInputRef, 'access', _42 => _42.current, 'optionalAccess', _43 => _43.click, 'call', _44 => _44()]);
1447
+ setShowMenu(false);
1448
+ },
1449
+ 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",
1450
+ children: [
1451
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "18", height: "18", 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)" }) }),
1452
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Add photos & files" })
1453
+ ]
1454
+ }
1455
+ ),
1456
+ onExpand && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1457
+ "button",
1458
+ {
1459
+ onClick: () => {
1460
+ onExpand();
1461
+ setShowMenu(false);
1462
+ },
1463
+ 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 border-t border-gray-700 dark:border-gray-600",
1464
+ children: [
1465
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
1466
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Expand to chat" })
1467
+ ]
1468
+ }
1469
+ )
1470
+ ]
1471
+ }
1472
+ )
1473
+ ] })
1474
+ ] }),
1475
+ state === "loading" && !toolName && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-4 h-4 border-2 border-blue-200 border-t-blue-500 rounded-full animate-spin" }),
1476
+ state === "loading" && toolName && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-2 h-2 rounded-full bg-blue-500 animate-pulse" })
1477
+ ] }),
1462
1478
  state === "idle" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1463
1479
  "textarea",
1464
1480
  {
@@ -1494,25 +1510,24 @@ function CommandComposer({
1494
1510
  ] }) : displayContent
1495
1511
  }
1496
1512
  ),
1497
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-1 flex-shrink-0", children: [
1498
- state === "plan-pending" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1499
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1500
- "button",
1501
- {
1502
- onClick: onApprove,
1503
- className: "px-2 py-1 bg-amber-500 text-white rounded-lg hover:bg-amber-600 transition-colors text-xs font-medium",
1504
- children: "Approve"
1505
- }
1506
- ),
1507
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1508
- "button",
1509
- {
1510
- onClick: onReject,
1511
- className: "px-2 py-1 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors text-xs font-medium",
1512
- children: "Modify"
1513
- }
1514
- )
1515
- ] }),
1513
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: state === "plan-pending" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-1", children: [
1514
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1515
+ "button",
1516
+ {
1517
+ onClick: onApprove,
1518
+ className: "px-2 py-1 bg-amber-500 text-white rounded-lg hover:bg-amber-600 transition-colors text-xs font-medium",
1519
+ children: "Approve"
1520
+ }
1521
+ ),
1522
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1523
+ "button",
1524
+ {
1525
+ onClick: onReject,
1526
+ className: "px-2 py-1 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors text-xs font-medium",
1527
+ children: "Modify"
1528
+ }
1529
+ )
1530
+ ] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1516
1531
  (state === "success" || state === "error") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1517
1532
  "button",
1518
1533
  {
@@ -1537,32 +1552,10 @@ function CommandComposer({
1537
1552
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 12h14M12 5l7 7-7 7" }) })
1538
1553
  }
1539
1554
  )
1540
- ] })
1555
+ ] }) })
1541
1556
  ]
1542
1557
  }
1543
1558
  ),
1544
- state === "success" && _optionalChain([response, 'optionalAccess', _37 => _37.includes, 'call', _38 => _38("weather")]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mt-3 p-3 bg-gradient-to-r from-blue-50 to-cyan-50 dark:from-blue-900/20 dark:to-cyan-900/20 border border-blue-200 dark:border-blue-800 rounded-xl", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-3", children: [
1545
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-3xl", children: "\u2600\uFE0F" }),
1546
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1", children: [
1547
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm font-medium text-gray-900 dark:text-white", children: "Paris, France" }),
1548
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Sunny, 22\xB0C" })
1549
- ] }),
1550
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { className: "px-3 py-1 text-xs bg-blue-500 text-white rounded-lg hover:bg-blue-600", children: "Details" })
1551
- ] }) }),
1552
- state === "success" && _optionalChain([response, 'optionalAccess', _39 => _39.includes, 'call', _40 => _40("trip")]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-3 p-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm", children: [
1553
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: "https://images.unsplash.com/photo-1502602898657-3e91760cbb34?w=400&h=150&fit=crop", alt: "Paris", className: "w-full h-24 object-cover rounded-lg mb-2" }),
1554
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm font-medium text-gray-900 dark:text-white", children: "Paris Weekend Getaway" }),
1555
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-xs text-gray-500 dark:text-gray-400 mb-2", children: "3 days \xB7 $850" }),
1556
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
1557
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { className: "flex-1 px-2 py-1 text-xs bg-blue-500 text-white rounded-lg hover:bg-blue-600", children: "Book" }),
1558
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { className: "flex-1 px-2 py-1 text-xs bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600", children: "Details" })
1559
- ] })
1560
- ] }),
1561
- state === "success" && _optionalChain([response, 'optionalAccess', _41 => _41.includes, 'call', _42 => _42("task")]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mt-3 border border-gray-200 dark:border-gray-700 rounded-xl overflow-hidden", children: ["Review PR #123", "Update documentation", "Fix login bug"].map((task, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `flex items-center gap-2 px-3 py-2 ${i > 0 ? "border-t border-gray-100 dark:border-gray-800" : ""}`, children: [
1562
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `w-2 h-2 rounded-full ${i === 0 ? "bg-green-500" : i === 1 ? "bg-yellow-500" : "bg-red-500"}` }),
1563
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "flex-1 text-sm text-gray-700 dark:text-gray-300", children: task }),
1564
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { className: "text-xs text-blue-500 hover:text-blue-600", children: "View" })
1565
- ] }, i)) }),
1566
1559
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1567
1560
  "input",
1568
1561
  {
@@ -1662,7 +1655,7 @@ var AptevaClient = class {
1662
1655
  const error = await response.json().catch(() => ({ error: "Request failed" }));
1663
1656
  throw new Error(error.error || `Request failed with status ${response.status}`);
1664
1657
  }
1665
- const reader = _optionalChain([response, 'access', _43 => _43.body, 'optionalAccess', _44 => _44.getReader, 'call', _45 => _45()]);
1658
+ const reader = _optionalChain([response, 'access', _45 => _45.body, 'optionalAccess', _46 => _46.getReader, 'call', _47 => _47()]);
1666
1659
  if (!reader) {
1667
1660
  throw new Error("Response body is not readable");
1668
1661
  }
@@ -1680,7 +1673,7 @@ var AptevaClient = class {
1680
1673
  if (line.startsWith("data: ")) {
1681
1674
  const data = line.slice(6);
1682
1675
  if (data === "[DONE]") {
1683
- _optionalChain([onComplete, 'optionalCall', _46 => _46(threadId)]);
1676
+ _optionalChain([onComplete, 'optionalCall', _48 => _48(threadId)]);
1684
1677
  return;
1685
1678
  }
1686
1679
  try {
@@ -1695,10 +1688,10 @@ var AptevaClient = class {
1695
1688
  }
1696
1689
  }
1697
1690
  }
1698
- _optionalChain([onComplete, 'optionalCall', _47 => _47(threadId)]);
1691
+ _optionalChain([onComplete, 'optionalCall', _49 => _49(threadId)]);
1699
1692
  } catch (error) {
1700
1693
  const err = error instanceof Error ? error : new Error("Unknown error");
1701
- _optionalChain([onError, 'optionalCall', _48 => _48(err)]);
1694
+ _optionalChain([onError, 'optionalCall', _50 => _50(err)]);
1702
1695
  throw err;
1703
1696
  }
1704
1697
  }
@@ -1807,7 +1800,7 @@ function Chat({
1807
1800
  }, [apiUrl, apiKey]);
1808
1801
  _react.useEffect.call(void 0, () => {
1809
1802
  if (threadId) {
1810
- _optionalChain([onThreadChange, 'optionalCall', _49 => _49(threadId)]);
1803
+ _optionalChain([onThreadChange, 'optionalCall', _51 => _51(threadId)]);
1811
1804
  }
1812
1805
  }, [threadId, onThreadChange]);
1813
1806
  _react.useEffect.call(void 0, () => {
@@ -1825,7 +1818,7 @@ function Chat({
1825
1818
  }, [showSettingsMenu]);
1826
1819
  const handleModeChange = (newMode) => {
1827
1820
  setMode(newMode);
1828
- _optionalChain([onModeChange, 'optionalCall', _50 => _50(newMode)]);
1821
+ _optionalChain([onModeChange, 'optionalCall', _52 => _52(newMode)]);
1829
1822
  if (newMode === "command") {
1830
1823
  setCommandState("idle");
1831
1824
  setCommandResult(null);
@@ -1845,7 +1838,7 @@ function Chat({
1845
1838
  metadata: hasFiles ? { attachments: fileNames } : void 0
1846
1839
  };
1847
1840
  setMessages((prev) => [...prev, userMessage]);
1848
- _optionalChain([onMessageSent, 'optionalCall', _51 => _51(userMessage)]);
1841
+ _optionalChain([onMessageSent, 'optionalCall', _53 => _53(userMessage)]);
1849
1842
  setIsLoading(true);
1850
1843
  try {
1851
1844
  const messagePayload = await buildMessageWithAttachments(text, files);
@@ -1910,7 +1903,7 @@ function Chat({
1910
1903
  responseThreadId = chunk.thread_id;
1911
1904
  if (!currentThreadId) {
1912
1905
  setCurrentThreadId(chunk.thread_id);
1913
- _optionalChain([onThreadChange, 'optionalCall', _52 => _52(chunk.thread_id)]);
1906
+ _optionalChain([onThreadChange, 'optionalCall', _54 => _54(chunk.thread_id)]);
1914
1907
  }
1915
1908
  }
1916
1909
  break;
@@ -1983,7 +1976,7 @@ function Chat({
1983
1976
  });
1984
1977
  if (threadId2 && threadId2 !== currentThreadId) {
1985
1978
  setCurrentThreadId(threadId2);
1986
- _optionalChain([onThreadChange, 'optionalCall', _53 => _53(threadId2)]);
1979
+ _optionalChain([onThreadChange, 'optionalCall', _55 => _55(threadId2)]);
1987
1980
  }
1988
1981
  setIsLoading(false);
1989
1982
  },
@@ -2003,7 +1996,7 @@ function Chat({
2003
1996
  return [...prev, errorMessage];
2004
1997
  });
2005
1998
  setIsLoading(false);
2006
- _optionalChain([onError, 'optionalCall', _54 => _54(error)]);
1999
+ _optionalChain([onError, 'optionalCall', _56 => _56(error)]);
2007
2000
  }
2008
2001
  );
2009
2002
  }
@@ -2016,7 +2009,7 @@ function Chat({
2016
2009
  metadata: { error: true }
2017
2010
  };
2018
2011
  setMessages((prev) => [...prev, errorMessage]);
2019
- _optionalChain([onError, 'optionalCall', _55 => _55(error instanceof Error ? error : new Error("Unknown error"))]);
2012
+ _optionalChain([onError, 'optionalCall', _57 => _57(error instanceof Error ? error : new Error("Unknown error"))]);
2020
2013
  } finally {
2021
2014
  setIsLoading(false);
2022
2015
  }
@@ -2061,7 +2054,7 @@ ${planningInstruction}` : planningInstruction;
2061
2054
  const error = err instanceof Error ? err : new Error("Failed to generate plan");
2062
2055
  setCommandError(error);
2063
2056
  setCommandState("error");
2064
- _optionalChain([onError, 'optionalCall', _56 => _56(error)]);
2057
+ _optionalChain([onError, 'optionalCall', _58 => _58(error)]);
2065
2058
  }
2066
2059
  }
2067
2060
  return;
@@ -2094,12 +2087,12 @@ ${planningInstruction}` : planningInstruction;
2094
2087
  setCommandResult(result);
2095
2088
  setCommandState("success");
2096
2089
  setProgress(100);
2097
- _optionalChain([onComplete, 'optionalCall', _57 => _57(result)]);
2090
+ _optionalChain([onComplete, 'optionalCall', _59 => _59(result)]);
2098
2091
  },
2099
2092
  (error) => {
2100
2093
  setCommandError(error);
2101
2094
  setCommandState("error");
2102
- _optionalChain([onError, 'optionalCall', _58 => _58(error)]);
2095
+ _optionalChain([onError, 'optionalCall', _60 => _60(error)]);
2103
2096
  }
2104
2097
  );
2105
2098
  } else {
@@ -2112,7 +2105,7 @@ ${planningInstruction}` : planningInstruction;
2112
2105
  setCommandResult(result);
2113
2106
  setCommandState("success");
2114
2107
  setProgress(100);
2115
- _optionalChain([onComplete, 'optionalCall', _59 => _59(result)]);
2108
+ _optionalChain([onComplete, 'optionalCall', _61 => _61(result)]);
2116
2109
  }
2117
2110
  } else {
2118
2111
  const commandInstruction = `CRITICAL COMMAND MODE: Maximum 10 words per response. Execute the command immediately. Make reasonable assumptions based on context. Use sensible defaults for missing details. DO NOT ask questions unless something is truly impossible without user input (e.g., missing required password). State what you're doing or the result. Examples: "Analyzing customer data from last quarter..." or "Created 5 new database entries successfully" or "Search complete: found 12 matching results". NO greetings, NO filler words, NO clarification requests. Action/result only.`;
@@ -2146,7 +2139,7 @@ ${commandInstruction}` : commandInstruction;
2146
2139
  } else if (chunk.type === "thread_id" && chunk.thread_id) {
2147
2140
  if (!currentThreadId) {
2148
2141
  setCurrentThreadId(chunk.thread_id);
2149
- _optionalChain([onThreadChange, 'optionalCall', _60 => _60(chunk.thread_id)]);
2142
+ _optionalChain([onThreadChange, 'optionalCall', _62 => _62(chunk.thread_id)]);
2150
2143
  }
2151
2144
  }
2152
2145
  },
@@ -2159,12 +2152,12 @@ ${commandInstruction}` : commandInstruction;
2159
2152
  setCommandResult(result);
2160
2153
  setCommandState("success");
2161
2154
  setProgress(100);
2162
- _optionalChain([onComplete, 'optionalCall', _61 => _61(result)]);
2155
+ _optionalChain([onComplete, 'optionalCall', _63 => _63(result)]);
2163
2156
  },
2164
2157
  (error) => {
2165
2158
  setCommandError(error);
2166
2159
  setCommandState("error");
2167
- _optionalChain([onError, 'optionalCall', _62 => _62(error)]);
2160
+ _optionalChain([onError, 'optionalCall', _64 => _64(error)]);
2168
2161
  }
2169
2162
  );
2170
2163
  } else {
@@ -2184,14 +2177,14 @@ ${commandInstruction}` : commandInstruction;
2184
2177
  setCommandResult(result);
2185
2178
  setCommandState("success");
2186
2179
  setProgress(100);
2187
- _optionalChain([onComplete, 'optionalCall', _63 => _63(result)]);
2180
+ _optionalChain([onComplete, 'optionalCall', _65 => _65(result)]);
2188
2181
  }
2189
2182
  }
2190
2183
  } catch (err) {
2191
2184
  const error = err instanceof Error ? err : new Error("Unknown error");
2192
2185
  setCommandError(error);
2193
2186
  setCommandState("error");
2194
- _optionalChain([onError, 'optionalCall', _64 => _64(error)]);
2187
+ _optionalChain([onError, 'optionalCall', _66 => _66(error)]);
2195
2188
  }
2196
2189
  };
2197
2190
  const resetCommand = () => {
@@ -2257,8 +2250,8 @@ ${planToExecute}`;
2257
2250
  executeCommand(text, files);
2258
2251
  },
2259
2252
  state: commandState,
2260
- response: _optionalChain([commandResult, 'optionalAccess', _65 => _65.data, 'optionalAccess', _66 => _66.summary]) || _optionalChain([commandResult, 'optionalAccess', _67 => _67.message]),
2261
- error: _optionalChain([commandError, 'optionalAccess', _68 => _68.message]),
2253
+ response: _optionalChain([commandResult, 'optionalAccess', _67 => _67.data, 'optionalAccess', _68 => _68.summary]) || _optionalChain([commandResult, 'optionalAccess', _69 => _69.message]),
2254
+ error: _optionalChain([commandError, 'optionalAccess', _70 => _70.message]),
2262
2255
  plan,
2263
2256
  streamedContent,
2264
2257
  toolName: currentToolName,
@@ -2278,6 +2271,9 @@ ${planToExecute}`;
2278
2271
  .animate-pulse-border {
2279
2272
  animation: pulse-border 2s ease-in-out infinite;
2280
2273
  }
2274
+ .apteva-composer {
2275
+ border-radius: var(--apteva-border-radius, 1rem) !important;
2276
+ }
2281
2277
  `
2282
2278
  } })
2283
2279
  ] });
@@ -2422,13 +2418,13 @@ ${planningInstruction}` : planningInstruction;
2422
2418
  const error2 = err instanceof Error ? err : new Error("Failed to generate plan");
2423
2419
  setError(error2);
2424
2420
  setState("error");
2425
- _optionalChain([onError, 'optionalCall', _69 => _69(error2)]);
2421
+ _optionalChain([onError, 'optionalCall', _71 => _71(error2)]);
2426
2422
  });
2427
2423
  } catch (err) {
2428
2424
  const error2 = err instanceof Error ? err : new Error("Failed to generate plan");
2429
2425
  setError(error2);
2430
2426
  setState("error");
2431
- _optionalChain([onError, 'optionalCall', _70 => _70(error2)]);
2427
+ _optionalChain([onError, 'optionalCall', _72 => _72(error2)]);
2432
2428
  }
2433
2429
  }
2434
2430
  return;
@@ -2439,7 +2435,7 @@ ${planningInstruction}` : planningInstruction;
2439
2435
  setStreamedContent("");
2440
2436
  setCommand("");
2441
2437
  setUploadedFiles([]);
2442
- _optionalChain([onStart, 'optionalCall', _71 => _71()]);
2438
+ _optionalChain([onStart, 'optionalCall', _73 => _73()]);
2443
2439
  try {
2444
2440
  if (useMock) {
2445
2441
  if (enableStreaming) {
@@ -2450,16 +2446,16 @@ ${planningInstruction}` : planningInstruction;
2450
2446
  if (chunk.type === "token" && chunk.content) {
2451
2447
  accumulatedContent += chunk.content;
2452
2448
  setStreamedContent(accumulatedContent);
2453
- _optionalChain([onChunk, 'optionalCall', _72 => _72(chunk.content)]);
2449
+ _optionalChain([onChunk, 'optionalCall', _74 => _74(chunk.content)]);
2454
2450
  const estimatedProgress = Math.min(Math.round(accumulatedContent.length / 10), 90);
2455
2451
  setProgress(estimatedProgress);
2456
- _optionalChain([onProgress, 'optionalCall', _73 => _73(estimatedProgress)]);
2452
+ _optionalChain([onProgress, 'optionalCall', _75 => _75(estimatedProgress)]);
2457
2453
  } else if (chunk.type === "widget" && chunk.widget) {
2458
2454
  const widget = chunk.widget;
2459
2455
  setResult((prev) => ({
2460
2456
  success: true,
2461
- data: _optionalChain([prev, 'optionalAccess', _74 => _74.data]) || {},
2462
- widgets: [..._optionalChain([prev, 'optionalAccess', _75 => _75.widgets]) || [], widget],
2457
+ data: _optionalChain([prev, 'optionalAccess', _76 => _76.data]) || {},
2458
+ widgets: [..._optionalChain([prev, 'optionalAccess', _77 => _77.widgets]) || [], widget],
2463
2459
  message: accumulatedContent || "Command executed successfully"
2464
2460
  }));
2465
2461
  }
@@ -2479,19 +2475,19 @@ ${planningInstruction}` : planningInstruction;
2479
2475
  setResult(result2);
2480
2476
  setState("success");
2481
2477
  setProgress(100);
2482
- _optionalChain([onComplete, 'optionalCall', _76 => _76(result2)]);
2478
+ _optionalChain([onComplete, 'optionalCall', _78 => _78(result2)]);
2483
2479
  },
2484
2480
  (error2) => {
2485
2481
  setError(error2);
2486
2482
  setState("error");
2487
- _optionalChain([onError, 'optionalCall', _77 => _77(error2)]);
2483
+ _optionalChain([onError, 'optionalCall', _79 => _79(error2)]);
2488
2484
  }
2489
2485
  );
2490
2486
  } else {
2491
2487
  const progressInterval = setInterval(() => {
2492
2488
  setProgress((prev) => {
2493
2489
  const next = Math.min(prev + 10, 90);
2494
- _optionalChain([onProgress, 'optionalCall', _78 => _78(next)]);
2490
+ _optionalChain([onProgress, 'optionalCall', _80 => _80(next)]);
2495
2491
  return next;
2496
2492
  });
2497
2493
  }, 200);
@@ -2515,7 +2511,7 @@ ${planningInstruction}` : planningInstruction;
2515
2511
  setResult(result2);
2516
2512
  setState("success");
2517
2513
  setProgress(100);
2518
- _optionalChain([onComplete, 'optionalCall', _79 => _79(result2)]);
2514
+ _optionalChain([onComplete, 'optionalCall', _81 => _81(result2)]);
2519
2515
  }
2520
2516
  } else {
2521
2517
  if (enableStreaming) {
@@ -2561,16 +2557,16 @@ ${commandInstruction}` : commandInstruction;
2561
2557
  if (chunk.type === "token" && chunk.content) {
2562
2558
  accumulatedContent += chunk.content;
2563
2559
  setStreamedContent(accumulatedContent);
2564
- _optionalChain([onChunk, 'optionalCall', _80 => _80(chunk.content)]);
2560
+ _optionalChain([onChunk, 'optionalCall', _82 => _82(chunk.content)]);
2565
2561
  const estimatedProgress = Math.min(Math.round(accumulatedContent.length / 10), 90);
2566
2562
  setProgress(estimatedProgress);
2567
- _optionalChain([onProgress, 'optionalCall', _81 => _81(estimatedProgress)]);
2563
+ _optionalChain([onProgress, 'optionalCall', _83 => _83(estimatedProgress)]);
2568
2564
  } else if (chunk.type === "widget" && chunk.widget) {
2569
2565
  const widget = chunk.widget;
2570
2566
  setResult((prev) => ({
2571
2567
  success: true,
2572
- data: _optionalChain([prev, 'optionalAccess', _82 => _82.data]) || {},
2573
- widgets: [..._optionalChain([prev, 'optionalAccess', _83 => _83.widgets]) || [], widget],
2568
+ data: _optionalChain([prev, 'optionalAccess', _84 => _84.data]) || {},
2569
+ widgets: [..._optionalChain([prev, 'optionalAccess', _85 => _85.widgets]) || [], widget],
2574
2570
  message: accumulatedContent || "Command executed successfully"
2575
2571
  }));
2576
2572
  }
@@ -2590,20 +2586,20 @@ ${commandInstruction}` : commandInstruction;
2590
2586
  setResult(result2);
2591
2587
  setState("success");
2592
2588
  setProgress(100);
2593
- _optionalChain([onComplete, 'optionalCall', _84 => _84(result2)]);
2589
+ _optionalChain([onComplete, 'optionalCall', _86 => _86(result2)]);
2594
2590
  },
2595
2591
  (error2) => {
2596
2592
  const err = error2 instanceof Error ? error2 : new Error("Unknown error");
2597
2593
  setError(err);
2598
2594
  setState("error");
2599
- _optionalChain([onError, 'optionalCall', _85 => _85(err)]);
2595
+ _optionalChain([onError, 'optionalCall', _87 => _87(err)]);
2600
2596
  }
2601
2597
  );
2602
2598
  } else {
2603
2599
  const progressInterval = setInterval(() => {
2604
2600
  setProgress((prev) => {
2605
2601
  const next = Math.min(prev + 10, 90);
2606
- _optionalChain([onProgress, 'optionalCall', _86 => _86(next)]);
2602
+ _optionalChain([onProgress, 'optionalCall', _88 => _88(next)]);
2607
2603
  return next;
2608
2604
  });
2609
2605
  }, 200);
@@ -2659,14 +2655,14 @@ ${commandInstruction}` : commandInstruction;
2659
2655
  setResult(result2);
2660
2656
  setState("success");
2661
2657
  setProgress(100);
2662
- _optionalChain([onComplete, 'optionalCall', _87 => _87(result2)]);
2658
+ _optionalChain([onComplete, 'optionalCall', _89 => _89(result2)]);
2663
2659
  }
2664
2660
  }
2665
2661
  } catch (err) {
2666
2662
  const error2 = err instanceof Error ? err : new Error("Unknown error");
2667
2663
  setError(error2);
2668
2664
  setState("error");
2669
- _optionalChain([onError, 'optionalCall', _88 => _88(error2)]);
2665
+ _optionalChain([onError, 'optionalCall', _90 => _90(error2)]);
2670
2666
  }
2671
2667
  };
2672
2668
  const resetCommand = () => {
@@ -2699,14 +2695,14 @@ ${planToExecute}`;
2699
2695
  };
2700
2696
  const handleFileSelect = async (e) => {
2701
2697
  if (e.target.files && e.target.files.length > 0) {
2702
- _optionalChain([onFileUpload, 'optionalCall', _89 => _89(e.target.files)]);
2698
+ _optionalChain([onFileUpload, 'optionalCall', _91 => _91(e.target.files)]);
2703
2699
  const files = [];
2704
2700
  for (let i = 0; i < e.target.files.length; i++) {
2705
2701
  const file = e.target.files[i];
2706
2702
  const reader = new FileReader();
2707
2703
  await new Promise((resolve) => {
2708
2704
  reader.onload = (event) => {
2709
- if (_optionalChain([event, 'access', _90 => _90.target, 'optionalAccess', _91 => _91.result])) {
2705
+ if (_optionalChain([event, 'access', _92 => _92.target, 'optionalAccess', _93 => _93.result])) {
2710
2706
  const fullDataUrl = event.target.result;
2711
2707
  const base64Data = fullDataUrl.split(",")[1];
2712
2708
  if (file.type.startsWith("image/")) {
@@ -2800,7 +2796,7 @@ ${planToExecute}`;
2800
2796
  enableFileUpload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2801
2797
  "button",
2802
2798
  {
2803
- onClick: () => _optionalChain([fileInputRef, 'access', _92 => _92.current, 'optionalAccess', _93 => _93.click, 'call', _94 => _94()]),
2799
+ onClick: () => _optionalChain([fileInputRef, 'access', _94 => _94.current, 'optionalAccess', _95 => _95.click, 'call', _96 => _96()]),
2804
2800
  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",
2805
2801
  title: "Attach file",
2806
2802
  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)" }) })
@@ -3019,7 +3015,7 @@ ${planToExecute}`;
3019
3015
  /* @__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" }) }),
3020
3016
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
3021
3017
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-semibold text-red-800 dark:text-red-400", children: "Error" }),
3022
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: _optionalChain([error, 'optionalAccess', _95 => _95.message]) })
3018
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: _optionalChain([error, 'optionalAccess', _97 => _97.message]) })
3023
3019
  ] })
3024
3020
  ] }) }),
3025
3021
  allowInput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -3047,7 +3043,7 @@ ${planToExecute}`;
3047
3043
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-green-700 dark:text-green-300 text-sm", children: "Command executed successfully" })
3048
3044
  ] })
3049
3045
  ] }),
3050
- _optionalChain([result, 'access', _96 => _96.data, 'optionalAccess', _97 => _97.summary]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-gray-700 dark:text-gray-300 text-sm leading-relaxed whitespace-pre-line", children: result.data.summary }),
3046
+ _optionalChain([result, 'access', _98 => _98.data, 'optionalAccess', _99 => _99.summary]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-gray-700 dark:text-gray-300 text-sm leading-relaxed whitespace-pre-line", children: result.data.summary }),
3051
3047
  result.widgets && result.widgets.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-3", children: result.widgets.map((widget) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3052
3048
  WidgetRenderer,
3053
3049
  {
@@ -3098,7 +3094,7 @@ ${planToExecute}`;
3098
3094
  enableFileUpload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3099
3095
  "button",
3100
3096
  {
3101
- onClick: () => _optionalChain([fileInputRef, 'access', _98 => _98.current, 'optionalAccess', _99 => _99.click, 'call', _100 => _100()]),
3097
+ onClick: () => _optionalChain([fileInputRef, 'access', _100 => _100.current, 'optionalAccess', _101 => _101.click, 'call', _102 => _102()]),
3102
3098
  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",
3103
3099
  title: "Attach file",
3104
3100
  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)" }) })
@@ -3284,25 +3280,25 @@ function Prompt({
3284
3280
  const newValue = e.target.value;
3285
3281
  if (!maxLength || newValue.length <= maxLength) {
3286
3282
  setValue(newValue);
3287
- _optionalChain([onChange, 'optionalCall', _101 => _101(newValue)]);
3283
+ _optionalChain([onChange, 'optionalCall', _103 => _103(newValue)]);
3288
3284
  }
3289
3285
  };
3290
3286
  const handleSubmit = async () => {
3291
3287
  if (value.length < minLength) return;
3292
- _optionalChain([onSubmit, 'optionalCall', _102 => _102(value)]);
3288
+ _optionalChain([onSubmit, 'optionalCall', _104 => _104(value)]);
3293
3289
  setIsLoading(true);
3294
3290
  try {
3295
3291
  if (useMock) {
3296
3292
  await new Promise((resolve) => setTimeout(resolve, 1500));
3297
3293
  const mockResult = `Enhanced version: ${value} [AI-generated content]`;
3298
- _optionalChain([onResult, 'optionalCall', _103 => _103(mockResult)]);
3294
+ _optionalChain([onResult, 'optionalCall', _105 => _105(mockResult)]);
3299
3295
  setValue("");
3300
3296
  } else {
3301
3297
  const response = await aptevaClient.chat({
3302
3298
  agent_id: agentId,
3303
3299
  message: value
3304
3300
  });
3305
- _optionalChain([onResult, 'optionalCall', _104 => _104(response.message)]);
3301
+ _optionalChain([onResult, 'optionalCall', _106 => _106(response.message)]);
3306
3302
  setValue("");
3307
3303
  }
3308
3304
  } catch (error) {
@@ -3397,7 +3393,7 @@ function Stream({
3397
3393
  }, [autoStart]);
3398
3394
  const startStreaming = async () => {
3399
3395
  setIsStreaming(true);
3400
- _optionalChain([onStart, 'optionalCall', _105 => _105()]);
3396
+ _optionalChain([onStart, 'optionalCall', _107 => _107()]);
3401
3397
  try {
3402
3398
  if (useMock) {
3403
3399
  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.";
@@ -3405,13 +3401,13 @@ function Stream({
3405
3401
  mockText,
3406
3402
  (chunk) => {
3407
3403
  setText((prev) => prev + chunk);
3408
- _optionalChain([onChunk, 'optionalCall', _106 => _106(chunk)]);
3404
+ _optionalChain([onChunk, 'optionalCall', _108 => _108(chunk)]);
3409
3405
  },
3410
3406
  typingSpeed
3411
3407
  );
3412
3408
  setIsComplete(true);
3413
3409
  setIsStreaming(false);
3414
- _optionalChain([onComplete, 'optionalCall', _107 => _107(text + mockText)]);
3410
+ _optionalChain([onComplete, 'optionalCall', _109 => _109(text + mockText)]);
3415
3411
  } else {
3416
3412
  let accumulatedText = "";
3417
3413
  await aptevaClient.chatStream(
@@ -3424,24 +3420,24 @@ function Stream({
3424
3420
  if (chunk.type === "token" && chunk.content) {
3425
3421
  accumulatedText += chunk.content;
3426
3422
  setText(accumulatedText);
3427
- _optionalChain([onChunk, 'optionalCall', _108 => _108(chunk.content)]);
3423
+ _optionalChain([onChunk, 'optionalCall', _110 => _110(chunk.content)]);
3428
3424
  }
3429
3425
  },
3430
3426
  () => {
3431
3427
  setIsComplete(true);
3432
3428
  setIsStreaming(false);
3433
- _optionalChain([onComplete, 'optionalCall', _109 => _109(accumulatedText)]);
3429
+ _optionalChain([onComplete, 'optionalCall', _111 => _111(accumulatedText)]);
3434
3430
  },
3435
3431
  (error) => {
3436
3432
  const err = error instanceof Error ? error : new Error("Streaming error");
3437
- _optionalChain([onError, 'optionalCall', _110 => _110(err)]);
3433
+ _optionalChain([onError, 'optionalCall', _112 => _112(err)]);
3438
3434
  setIsStreaming(false);
3439
3435
  }
3440
3436
  );
3441
3437
  }
3442
3438
  } catch (error) {
3443
3439
  const err = error instanceof Error ? error : new Error("Streaming error");
3444
- _optionalChain([onError, 'optionalCall', _111 => _111(err)]);
3440
+ _optionalChain([onError, 'optionalCall', _113 => _113(err)]);
3445
3441
  setIsStreaming(false);
3446
3442
  }
3447
3443
  };
@@ -3533,7 +3529,7 @@ function ThreadList({
3533
3529
  }) {
3534
3530
  const [searchQuery, setSearchQuery] = _react.useState.call(void 0, "");
3535
3531
  const filteredThreads = threads.filter(
3536
- (thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || _optionalChain([thread, 'access', _112 => _112.preview, 'optionalAccess', _113 => _113.toLowerCase, 'call', _114 => _114(), 'access', _115 => _115.includes, 'call', _116 => _116(searchQuery.toLowerCase())])
3532
+ (thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || _optionalChain([thread, 'access', _114 => _114.preview, 'optionalAccess', _115 => _115.toLowerCase, 'call', _116 => _116(), 'access', _117 => _117.includes, 'call', _118 => _118(searchQuery.toLowerCase())])
3537
3533
  );
3538
3534
  const groupedThreads = groupBy === "date" ? groupThreadsByDate(filteredThreads) : { All: filteredThreads };
3539
3535
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col h-full", children: [
@@ -3555,8 +3551,8 @@ function ThreadList({
3555
3551
  {
3556
3552
  thread,
3557
3553
  isActive: thread.id === currentThreadId,
3558
- onSelect: () => _optionalChain([onThreadSelect, 'optionalCall', _117 => _117(thread.id)]),
3559
- onDelete: () => _optionalChain([onThreadDelete, 'optionalCall', _118 => _118(thread.id)])
3554
+ onSelect: () => _optionalChain([onThreadSelect, 'optionalCall', _119 => _119(thread.id)]),
3555
+ onDelete: () => _optionalChain([onThreadDelete, 'optionalCall', _120 => _120(thread.id)])
3560
3556
  },
3561
3557
  thread.id
3562
3558
  ))
@@ -3618,7 +3614,7 @@ function Threads({
3618
3614
  threads.slice(0, 5).map((thread) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3619
3615
  "button",
3620
3616
  {
3621
- onClick: () => _optionalChain([onThreadSelect, 'optionalCall', _119 => _119(thread.id)]),
3617
+ onClick: () => _optionalChain([onThreadSelect, 'optionalCall', _121 => _121(thread.id)]),
3622
3618
  className: cn(
3623
3619
  "px-4 py-2 whitespace-nowrap font-medium transition-colors",
3624
3620
  thread.id === currentThreadId ? "border-b-2 border-apteva-500 text-apteva-500" : "text-gray-600 hover:text-gray-900"