@apteva/apteva-kit 0.1.15 → 0.1.17

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.mjs CHANGED
@@ -1062,6 +1062,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
1062
1062
  const [fileError, setFileError] = useState(null);
1063
1063
  const textareaRef = useRef2(null);
1064
1064
  const fileInputRef = useRef2(null);
1065
+ const menuButtonRef = useRef2(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__ */ jsx12("svg", { className: "w-4 h-4 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx12("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__ */ jsx12("span", { children: fileError })
1141
1142
  ] }) }),
1142
- showMenu && /* @__PURE__ */ jsxs8(Fragment, { children: [
1143
- /* @__PURE__ */ jsx12("div", { className: "fixed inset-0 z-10", onClick: () => setShowMenu(false) }),
1144
- /* @__PURE__ */ jsxs8("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__ */ jsxs8(
1146
- "button",
1147
- {
1148
- onClick: () => {
1149
- fileInputRef.current?.click();
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__ */ jsx12("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx12("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__ */ jsx12("span", { className: "!text-sm font-medium", children: "Add photos & files" })
1156
- ]
1157
- }
1158
- ),
1159
- onSwitchMode && /* @__PURE__ */ jsxs8(
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__ */ jsx12("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx12("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
1169
- /* @__PURE__ */ jsx12("span", { className: "!text-sm font-medium", children: "Switch to command mode" })
1170
- ]
1171
- }
1172
- )
1173
- ] })
1174
- ] }),
1175
1143
  pendingFiles.length > 0 && /* @__PURE__ */ jsx12("div", { className: "mb-2 flex flex-wrap gap-2", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs8(
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__ */ jsxs8("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__ */ jsx12(
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__ */ jsx12("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx12("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
1206
- }
1207
- ),
1166
+ /* @__PURE__ */ jsxs8("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__ */ jsxs8("div", { className: "relative flex-shrink-0", children: [
1168
+ /* @__PURE__ */ jsx12(
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__ */ jsx12("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx12("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
1176
+ }
1177
+ ),
1178
+ showMenu && /* @__PURE__ */ jsxs8(Fragment, { children: [
1179
+ /* @__PURE__ */ jsx12("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
1180
+ /* @__PURE__ */ jsxs8(
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: menuButtonRef.current?.getBoundingClientRect().left ?? 0,
1186
+ top: (menuButtonRef.current?.getBoundingClientRect().bottom ?? 0) + 8
1187
+ },
1188
+ children: [
1189
+ /* @__PURE__ */ jsxs8(
1190
+ "button",
1191
+ {
1192
+ onClick: () => {
1193
+ fileInputRef.current?.click();
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__ */ jsx12("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx12("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__ */ jsx12("span", { className: "!text-sm font-medium", children: "Add photos & files" })
1200
+ ]
1201
+ }
1202
+ ),
1203
+ onSwitchMode && /* @__PURE__ */ jsxs8(
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__ */ jsx12("svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx12("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
1213
+ /* @__PURE__ */ jsx12("span", { className: "!text-sm font-medium", children: "Switch to command mode" })
1214
+ ]
1215
+ }
1216
+ )
1217
+ ]
1218
+ }
1219
+ )
1220
+ ] })
1221
+ ] }),
1208
1222
  /* @__PURE__ */ jsx12(
1209
1223
  "textarea",
1210
1224
  {
@@ -1370,76 +1384,11 @@ function CommandComposer({
1370
1384
  /* @__PURE__ */ jsx13("svg", { className: "w-3 h-3 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("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__ */ jsx13("span", { children: fileError })
1372
1386
  ] }) }),
1373
- showMenu && /* @__PURE__ */ jsxs9(Fragment2, { children: [
1374
- /* @__PURE__ */ jsx13("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
1375
- /* @__PURE__ */ jsxs9(
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: menuButtonRef.current?.getBoundingClientRect().left ?? 0,
1382
- top: (menuButtonRef.current?.getBoundingClientRect().top ?? 0) - 8,
1383
- transform: "translateY(-100%)"
1384
- },
1385
- children: [
1386
- /* @__PURE__ */ jsxs9(
1387
- "button",
1388
- {
1389
- onClick: () => {
1390
- fileInputRef.current?.click();
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__ */ jsx13("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx13("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__ */ jsx13("span", { className: "!text-sm font-medium", children: "Add photos & files" })
1397
- ]
1398
- }
1399
- ),
1400
- onExpand && /* @__PURE__ */ jsxs9(
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__ */ jsx13("svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("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__ */ jsx13("span", { className: "!text-sm font-medium", children: "Expand to chat" })
1411
- ]
1412
- }
1413
- )
1414
- ]
1415
- }
1416
- )
1417
- ] }),
1418
- pendingFiles.length > 0 && state === "idle" && /* @__PURE__ */ jsx13("div", { className: "mb-2 flex flex-wrap gap-2", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs9(
1419
- "div",
1420
- {
1421
- className: "relative group flex items-center gap-2 px-2 py-1.5 bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg",
1422
- children: [
1423
- pf.preview ? /* @__PURE__ */ jsx13("img", { src: pf.preview, alt: pf.file.name, className: "w-6 h-6 object-cover rounded" }) : /* @__PURE__ */ jsx13("div", { className: "w-6 h-6 flex items-center justify-center bg-gray-200 dark:bg-gray-700 rounded !text-gray-500 dark:!text-gray-400", children: getFileIcon(pf.file.type) }),
1424
- /* @__PURE__ */ jsx13("span", { className: "text-xs font-medium !text-gray-700 dark:!text-gray-300 truncate max-w-[100px]", children: pf.file.name }),
1425
- /* @__PURE__ */ jsx13(
1426
- "button",
1427
- {
1428
- onClick: () => removeFile(index),
1429
- className: "w-4 h-4 bg-gray-500 hover:bg-red-500 text-white rounded-full flex items-center justify-center",
1430
- title: "Remove file",
1431
- children: /* @__PURE__ */ jsx13("svg", { className: "w-2.5 h-2.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
1432
- }
1433
- )
1434
- ]
1435
- },
1436
- index
1437
- )) }),
1438
1387
  /* @__PURE__ */ jsxs9(
1439
1388
  "div",
1440
1389
  {
1441
1390
  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",
1391
+ "apteva-composer flex items-center gap-2 px-3 py-2 border-2 bg-white dark:bg-gray-900 transition-all duration-200",
1443
1392
  state === "idle" && "border-gray-200 dark:border-gray-700",
1444
1393
  state === "loading" && "border-blue-400 dark:border-blue-500",
1445
1394
  state === "plan-pending" && "border-amber-400 dark:border-amber-500",
@@ -1447,18 +1396,85 @@ function CommandComposer({
1447
1396
  state === "error" && "border-red-400 dark:border-red-500"
1448
1397
  ),
1449
1398
  children: [
1450
- state === "idle" && /* @__PURE__ */ jsx13(
1451
- "button",
1399
+ /* @__PURE__ */ jsxs9("div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: [
1400
+ state === "idle" && /* @__PURE__ */ jsxs9("div", { className: "relative", children: [
1401
+ /* @__PURE__ */ jsx13(
1402
+ "button",
1403
+ {
1404
+ ref: menuButtonRef,
1405
+ onClick: () => setShowMenu(!showMenu),
1406
+ 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",
1407
+ title: "More options",
1408
+ children: /* @__PURE__ */ jsx13("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx13("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
1409
+ }
1410
+ ),
1411
+ showMenu && /* @__PURE__ */ jsxs9(Fragment2, { children: [
1412
+ /* @__PURE__ */ jsx13("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
1413
+ /* @__PURE__ */ jsxs9(
1414
+ "div",
1415
+ {
1416
+ className: "fixed bg-gray-800 dark:bg-gray-700 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
1417
+ style: {
1418
+ left: menuButtonRef.current?.getBoundingClientRect().left ?? 0,
1419
+ top: (menuButtonRef.current?.getBoundingClientRect().bottom ?? 0) + 8
1420
+ },
1421
+ children: [
1422
+ /* @__PURE__ */ jsxs9(
1423
+ "button",
1424
+ {
1425
+ onClick: () => {
1426
+ fileInputRef.current?.click();
1427
+ setShowMenu(false);
1428
+ },
1429
+ 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",
1430
+ children: [
1431
+ /* @__PURE__ */ jsx13("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx13("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)" }) }),
1432
+ /* @__PURE__ */ jsx13("span", { className: "!text-sm font-medium", children: "Add photos & files" })
1433
+ ]
1434
+ }
1435
+ ),
1436
+ onExpand && /* @__PURE__ */ jsxs9(
1437
+ "button",
1438
+ {
1439
+ onClick: () => {
1440
+ onExpand();
1441
+ setShowMenu(false);
1442
+ },
1443
+ 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",
1444
+ children: [
1445
+ /* @__PURE__ */ jsx13("svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("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" }) }),
1446
+ /* @__PURE__ */ jsx13("span", { className: "!text-sm font-medium", children: "Expand to chat" })
1447
+ ]
1448
+ }
1449
+ )
1450
+ ]
1451
+ }
1452
+ )
1453
+ ] })
1454
+ ] }),
1455
+ state === "loading" && !toolName && /* @__PURE__ */ jsx13("div", { className: "w-4 h-4 border-2 border-blue-200 border-t-blue-500 rounded-full animate-spin" }),
1456
+ state === "loading" && toolName && /* @__PURE__ */ jsx13("div", { className: "w-2 h-2 rounded-full bg-blue-500 animate-pulse" })
1457
+ ] }),
1458
+ pendingFiles.length > 0 && state === "idle" && /* @__PURE__ */ jsx13("div", { className: "flex items-center gap-1 flex-shrink-0", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs9(
1459
+ "div",
1452
1460
  {
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__ */ jsx13("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx13("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
1458
- }
1459
- ),
1460
- state === "loading" && !toolName && /* @__PURE__ */ jsx13("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__ */ jsx13("div", { className: "w-2 h-2 rounded-full bg-blue-500 animate-pulse flex-shrink-0" }),
1461
+ className: "relative group flex items-center justify-center w-6 h-6 bg-gray-100 dark:bg-gray-800 rounded overflow-hidden",
1462
+ title: pf.file.name,
1463
+ children: [
1464
+ pf.preview ? /* @__PURE__ */ jsx13("img", { src: pf.preview, alt: pf.file.name, className: "w-6 h-6 object-cover" }) : /* @__PURE__ */ jsx13("span", { className: "text-xs !text-gray-500 dark:!text-gray-400", children: getFileIcon(pf.file.type) }),
1465
+ /* @__PURE__ */ jsx13(
1466
+ "button",
1467
+ {
1468
+ onClick: () => removeFile(index),
1469
+ className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity",
1470
+ title: "Remove",
1471
+ children: /* @__PURE__ */ jsx13("svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
1472
+ }
1473
+ )
1474
+ ]
1475
+ },
1476
+ index
1477
+ )) }),
1462
1478
  state === "idle" ? /* @__PURE__ */ jsx13(
1463
1479
  "textarea",
1464
1480
  {
@@ -1466,7 +1482,7 @@ function CommandComposer({
1466
1482
  value: input,
1467
1483
  onChange: (e) => handleInputChange(e.target.value),
1468
1484
  onKeyDown: handleKeyDown,
1469
- placeholder,
1485
+ placeholder: pendingFiles.length > 0 ? "Add a message..." : placeholder,
1470
1486
  disabled,
1471
1487
  rows: 1,
1472
1488
  className: cn(
@@ -1494,25 +1510,24 @@ function CommandComposer({
1494
1510
  ] }) : displayContent
1495
1511
  }
1496
1512
  ),
1497
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
1498
- state === "plan-pending" && /* @__PURE__ */ jsxs9(Fragment2, { children: [
1499
- /* @__PURE__ */ jsx13(
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__ */ jsx13(
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__ */ jsx13("div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: state === "plan-pending" ? /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
1514
+ /* @__PURE__ */ jsx13(
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__ */ jsx13(
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__ */ jsxs9(Fragment2, { children: [
1516
1531
  (state === "success" || state === "error") && /* @__PURE__ */ jsx13(
1517
1532
  "button",
1518
1533
  {
@@ -1537,32 +1552,10 @@ function CommandComposer({
1537
1552
  children: /* @__PURE__ */ jsx13("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("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" && response?.includes("weather") && /* @__PURE__ */ jsx13("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__ */ jsxs9("div", { className: "flex items-center gap-3", children: [
1545
- /* @__PURE__ */ jsx13("div", { className: "text-3xl", children: "\u2600\uFE0F" }),
1546
- /* @__PURE__ */ jsxs9("div", { className: "flex-1", children: [
1547
- /* @__PURE__ */ jsx13("div", { className: "text-sm font-medium text-gray-900 dark:text-white", children: "Paris, France" }),
1548
- /* @__PURE__ */ jsx13("div", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Sunny, 22\xB0C" })
1549
- ] }),
1550
- /* @__PURE__ */ jsx13("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" && response?.includes("trip") && /* @__PURE__ */ jsxs9("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__ */ jsx13("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__ */ jsx13("div", { className: "text-sm font-medium text-gray-900 dark:text-white", children: "Paris Weekend Getaway" }),
1555
- /* @__PURE__ */ jsx13("div", { className: "text-xs text-gray-500 dark:text-gray-400 mb-2", children: "3 days \xB7 $850" }),
1556
- /* @__PURE__ */ jsxs9("div", { className: "flex gap-2", children: [
1557
- /* @__PURE__ */ jsx13("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__ */ jsx13("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" && response?.includes("task") && /* @__PURE__ */ jsx13("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__ */ jsxs9("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__ */ jsx13("div", { className: `w-2 h-2 rounded-full ${i === 0 ? "bg-green-500" : i === 1 ? "bg-yellow-500" : "bg-red-500"}` }),
1563
- /* @__PURE__ */ jsx13("span", { className: "flex-1 text-sm text-gray-700 dark:text-gray-300", children: task }),
1564
- /* @__PURE__ */ jsx13("button", { className: "text-xs text-blue-500 hover:text-blue-600", children: "View" })
1565
- ] }, i)) }),
1566
1559
  /* @__PURE__ */ jsx13(
1567
1560
  "input",
1568
1561
  {
@@ -1775,6 +1768,7 @@ function Chat({
1775
1768
  onFileUpload,
1776
1769
  onComplete,
1777
1770
  onError,
1771
+ onToolResult,
1778
1772
  // UI
1779
1773
  placeholder,
1780
1774
  showHeader = true,
@@ -1942,6 +1936,7 @@ function Chat({
1942
1936
  const toolSegment = contentSegments.find((s) => s.type === "tool" && s.id === chunk.tool_id);
1943
1937
  if (toolSegment) {
1944
1938
  toolSegment.result = chunk.content;
1939
+ onToolResult?.(toolSegment.name, chunk.content);
1945
1940
  }
1946
1941
  updateMessage();
1947
1942
  }
@@ -2122,6 +2117,7 @@ ${commandInstruction}` : commandInstruction;
2122
2117
  const messagePayload = files && files.length > 0 ? await buildMessageWithAttachments(currentCommand, files) : currentCommand;
2123
2118
  if (enableStreaming) {
2124
2119
  let accumulatedContent = "";
2120
+ let lastToolName = "";
2125
2121
  await aptevaClient.chatStream(
2126
2122
  {
2127
2123
  agent_id: agentId,
@@ -2138,10 +2134,12 @@ ${commandInstruction}` : commandInstruction;
2138
2134
  const estimatedProgress = Math.min(Math.round(accumulatedContent.length / 10), 90);
2139
2135
  setProgress(estimatedProgress);
2140
2136
  } else if (chunk.type === "tool_call" && chunk.tool_name) {
2137
+ lastToolName = chunk.tool_name;
2141
2138
  setCurrentToolName(chunk.tool_name);
2142
2139
  accumulatedContent = "";
2143
2140
  setStreamedContent("");
2144
2141
  } else if (chunk.type === "tool_result") {
2142
+ onToolResult?.(lastToolName, chunk.content);
2145
2143
  setCurrentToolName(null);
2146
2144
  } else if (chunk.type === "thread_id" && chunk.thread_id) {
2147
2145
  if (!currentThreadId) {
@@ -2278,6 +2276,9 @@ ${planToExecute}`;
2278
2276
  .animate-pulse-border {
2279
2277
  animation: pulse-border 2s ease-in-out infinite;
2280
2278
  }
2279
+ .apteva-composer {
2280
+ border-radius: var(--apteva-border-radius, 1rem) !important;
2281
+ }
2281
2282
  `
2282
2283
  } })
2283
2284
  ] });