@apteva/apteva-kit 0.1.87 → 0.1.88
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.d.mts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +108 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +556 -448
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -761,6 +761,10 @@ var WIDGET_DEFINITIONS = {
|
|
|
761
761
|
chart: {
|
|
762
762
|
schema: "chartType: line|bar|pie, data: {labels, datasets}",
|
|
763
763
|
example: '@ui:chart[{"chartType": "bar", "data": {"labels": ["A"], "datasets": [{"label": "X", "data": [10]}]}}]'
|
|
764
|
+
},
|
|
765
|
+
flow: {
|
|
766
|
+
schema: "title?, steps: [{id, label, description?, status?: pending|active|completed|error|skipped}], direction?: vertical|horizontal, compact? - Show task/process flow. Omit status for proposal view.",
|
|
767
|
+
example: '@ui:flow[{"title": "Plan", "steps": [{"id": "1", "label": "Step 1", "description": "Details"}, {"id": "2", "label": "Step 2"}]}]'
|
|
764
768
|
}
|
|
765
769
|
};
|
|
766
770
|
var ALL_WIDGET_TYPES = Object.keys(WIDGET_DEFINITIONS);
|
|
@@ -1222,40 +1226,144 @@ function Image({ widget }) {
|
|
|
1222
1226
|
] });
|
|
1223
1227
|
}
|
|
1224
1228
|
|
|
1225
|
-
// src/components/Widgets/
|
|
1229
|
+
// src/components/Widgets/widget-library/Flow.tsx
|
|
1226
1230
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1231
|
+
function StepIcon({ status, isLast }) {
|
|
1232
|
+
if (status === "completed") {
|
|
1233
|
+
return /* @__PURE__ */ jsx8("div", { className: "w-6 h-6 rounded-full bg-emerald-500 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx8("svg", { className: "w-3.5 h-3.5 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx8("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) }) });
|
|
1234
|
+
}
|
|
1235
|
+
if (status === "active") {
|
|
1236
|
+
return /* @__PURE__ */ jsx8("div", { className: "w-6 h-6 rounded-full bg-blue-500 flex items-center justify-center flex-shrink-0 animate-pulse", children: /* @__PURE__ */ jsx8("div", { className: "w-2 h-2 rounded-full bg-white" }) });
|
|
1237
|
+
}
|
|
1238
|
+
if (status === "error") {
|
|
1239
|
+
return /* @__PURE__ */ jsx8("div", { className: "w-6 h-6 rounded-full bg-red-500 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx8("svg", { className: "w-3.5 h-3.5 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx8("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M6 18L18 6M6 6l12 12" }) }) });
|
|
1240
|
+
}
|
|
1241
|
+
if (status === "skipped") {
|
|
1242
|
+
return /* @__PURE__ */ jsx8("div", { className: "w-6 h-6 rounded-full bg-neutral-300 dark:bg-neutral-600 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx8("svg", { className: "w-3.5 h-3.5 text-neutral-500 dark:text-neutral-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx8("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M20 12H4" }) }) });
|
|
1243
|
+
}
|
|
1244
|
+
return /* @__PURE__ */ jsx8("div", { className: "w-6 h-6 rounded-full border-2 border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 flex-shrink-0" });
|
|
1245
|
+
}
|
|
1246
|
+
function VerticalFlow({ steps, compact }) {
|
|
1247
|
+
return /* @__PURE__ */ jsx8("div", { className: "relative", children: steps.map((step, index) => {
|
|
1248
|
+
const isLast = index === steps.length - 1;
|
|
1249
|
+
const isCompleted = step.status === "completed";
|
|
1250
|
+
const isActive = step.status === "active";
|
|
1251
|
+
const isSkipped = step.status === "skipped";
|
|
1252
|
+
return /* @__PURE__ */ jsxs6("div", { className: "relative flex gap-3", children: [
|
|
1253
|
+
!isLast && /* @__PURE__ */ jsx8(
|
|
1254
|
+
"div",
|
|
1255
|
+
{
|
|
1256
|
+
className: `absolute left-[11px] top-6 w-0.5 ${compact ? "h-6" : "h-8"} ${isCompleted ? "bg-emerald-500" : "bg-neutral-200 dark:bg-neutral-700"}`
|
|
1257
|
+
}
|
|
1258
|
+
),
|
|
1259
|
+
/* @__PURE__ */ jsx8(StepIcon, { status: step.status, isLast }),
|
|
1260
|
+
/* @__PURE__ */ jsxs6("div", { className: `${compact ? "pb-4" : "pb-6"} ${isLast ? "pb-0" : ""}`, children: [
|
|
1261
|
+
/* @__PURE__ */ jsx8(
|
|
1262
|
+
"div",
|
|
1263
|
+
{
|
|
1264
|
+
className: `font-medium text-sm ${isSkipped ? "text-neutral-400 dark:text-neutral-500 line-through" : isActive ? "text-blue-600 dark:text-blue-400" : "text-neutral-900 dark:text-neutral-100"}`,
|
|
1265
|
+
children: step.label
|
|
1266
|
+
}
|
|
1267
|
+
),
|
|
1268
|
+
step.description && /* @__PURE__ */ jsx8(
|
|
1269
|
+
"div",
|
|
1270
|
+
{
|
|
1271
|
+
className: `text-xs mt-0.5 ${isSkipped ? "text-neutral-300 dark:text-neutral-600" : "text-neutral-500 dark:text-neutral-400"}`,
|
|
1272
|
+
children: step.description
|
|
1273
|
+
}
|
|
1274
|
+
)
|
|
1275
|
+
] })
|
|
1276
|
+
] }, step.id);
|
|
1277
|
+
}) });
|
|
1278
|
+
}
|
|
1279
|
+
function HorizontalFlow({ steps, compact }) {
|
|
1280
|
+
return /* @__PURE__ */ jsx8("div", { className: "flex items-start gap-2 overflow-x-auto pb-2", children: steps.map((step, index) => {
|
|
1281
|
+
const isLast = index === steps.length - 1;
|
|
1282
|
+
const isCompleted = step.status === "completed";
|
|
1283
|
+
const isActive = step.status === "active";
|
|
1284
|
+
const isSkipped = step.status === "skipped";
|
|
1285
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex items-center", children: [
|
|
1286
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center text-center min-w-[80px] max-w-[120px]", children: [
|
|
1287
|
+
/* @__PURE__ */ jsx8(StepIcon, { status: step.status, isLast }),
|
|
1288
|
+
/* @__PURE__ */ jsx8(
|
|
1289
|
+
"div",
|
|
1290
|
+
{
|
|
1291
|
+
className: `font-medium text-xs mt-2 ${isSkipped ? "text-neutral-400 dark:text-neutral-500 line-through" : isActive ? "text-blue-600 dark:text-blue-400" : "text-neutral-900 dark:text-neutral-100"}`,
|
|
1292
|
+
children: step.label
|
|
1293
|
+
}
|
|
1294
|
+
),
|
|
1295
|
+
step.description && !compact && /* @__PURE__ */ jsx8(
|
|
1296
|
+
"div",
|
|
1297
|
+
{
|
|
1298
|
+
className: `text-[10px] mt-0.5 ${isSkipped ? "text-neutral-300 dark:text-neutral-600" : "text-neutral-500 dark:text-neutral-400"}`,
|
|
1299
|
+
children: step.description
|
|
1300
|
+
}
|
|
1301
|
+
)
|
|
1302
|
+
] }),
|
|
1303
|
+
!isLast && /* @__PURE__ */ jsxs6("div", { className: "flex items-center px-1", children: [
|
|
1304
|
+
/* @__PURE__ */ jsx8(
|
|
1305
|
+
"div",
|
|
1306
|
+
{
|
|
1307
|
+
className: `w-8 h-0.5 ${isCompleted ? "bg-emerald-500" : "bg-neutral-200 dark:bg-neutral-700"}`
|
|
1308
|
+
}
|
|
1309
|
+
),
|
|
1310
|
+
/* @__PURE__ */ jsx8(
|
|
1311
|
+
"svg",
|
|
1312
|
+
{
|
|
1313
|
+
className: `w-2 h-2 -ml-0.5 ${isCompleted ? "text-emerald-500" : "text-neutral-300 dark:text-neutral-600"}`,
|
|
1314
|
+
fill: "currentColor",
|
|
1315
|
+
viewBox: "0 0 24 24",
|
|
1316
|
+
children: /* @__PURE__ */ jsx8("path", { d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z" })
|
|
1317
|
+
}
|
|
1318
|
+
)
|
|
1319
|
+
] })
|
|
1320
|
+
] }, step.id);
|
|
1321
|
+
}) });
|
|
1322
|
+
}
|
|
1323
|
+
function Flow({ widget }) {
|
|
1324
|
+
const { title, steps, direction = "vertical", compact } = widget.props;
|
|
1325
|
+
return /* @__PURE__ */ jsxs6("div", { className: "border border-neutral-200 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 overflow-hidden", children: [
|
|
1326
|
+
title && /* @__PURE__ */ jsx8("div", { className: "px-4 py-3 border-b border-neutral-200 dark:border-neutral-700", children: /* @__PURE__ */ jsx8("h3", { className: "font-semibold text-sm text-neutral-900 dark:text-neutral-100", children: title }) }),
|
|
1327
|
+
/* @__PURE__ */ jsx8("div", { className: `p-4 ${direction === "horizontal" ? "overflow-x-auto" : ""}`, children: direction === "horizontal" ? /* @__PURE__ */ jsx8(HorizontalFlow, { steps, compact }) : /* @__PURE__ */ jsx8(VerticalFlow, { steps, compact }) })
|
|
1328
|
+
] });
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
// src/components/Widgets/WidgetRenderer.tsx
|
|
1332
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1227
1333
|
function WidgetRenderer({ widget, onAction }) {
|
|
1228
1334
|
const renderWidget = () => {
|
|
1229
1335
|
switch (widget.type) {
|
|
1230
1336
|
case "card":
|
|
1231
|
-
return /* @__PURE__ */
|
|
1337
|
+
return /* @__PURE__ */ jsx9(Card, { widget, onAction });
|
|
1232
1338
|
case "list":
|
|
1233
|
-
return /* @__PURE__ */
|
|
1339
|
+
return /* @__PURE__ */ jsx9(List, { widget, onAction });
|
|
1234
1340
|
case "button":
|
|
1235
|
-
return /* @__PURE__ */
|
|
1341
|
+
return /* @__PURE__ */ jsx9(Button, { widget, onAction });
|
|
1236
1342
|
case "button_group":
|
|
1237
|
-
return /* @__PURE__ */
|
|
1343
|
+
return /* @__PURE__ */ jsx9(ButtonGroup, { widget, onAction });
|
|
1238
1344
|
case "table":
|
|
1239
|
-
return /* @__PURE__ */
|
|
1345
|
+
return /* @__PURE__ */ jsx9(Table, { widget, onAction });
|
|
1240
1346
|
case "form":
|
|
1241
|
-
return /* @__PURE__ */
|
|
1347
|
+
return /* @__PURE__ */ jsx9(Form, { widget, onAction });
|
|
1242
1348
|
case "image":
|
|
1243
|
-
return /* @__PURE__ */
|
|
1349
|
+
return /* @__PURE__ */ jsx9(Image, { widget });
|
|
1350
|
+
case "flow":
|
|
1351
|
+
return /* @__PURE__ */ jsx9(Flow, { widget });
|
|
1244
1352
|
default:
|
|
1245
|
-
return /* @__PURE__ */
|
|
1246
|
-
/* @__PURE__ */
|
|
1353
|
+
return /* @__PURE__ */ jsxs7("div", { className: "p-4 border border-yellow-300 bg-yellow-50 rounded-lg", children: [
|
|
1354
|
+
/* @__PURE__ */ jsxs7("p", { className: "text-sm text-yellow-800", children: [
|
|
1247
1355
|
"Unknown widget type: ",
|
|
1248
1356
|
widget.type
|
|
1249
1357
|
] }),
|
|
1250
|
-
/* @__PURE__ */
|
|
1358
|
+
/* @__PURE__ */ jsx9("pre", { className: "text-xs mt-2 overflow-auto", children: JSON.stringify(widget, null, 2) })
|
|
1251
1359
|
] });
|
|
1252
1360
|
}
|
|
1253
1361
|
};
|
|
1254
|
-
return /* @__PURE__ */
|
|
1362
|
+
return /* @__PURE__ */ jsx9("div", { className: "apteva-widget", children: renderWidget() });
|
|
1255
1363
|
}
|
|
1256
1364
|
|
|
1257
1365
|
// src/components/Widgets/Widgets.tsx
|
|
1258
|
-
import { jsx as
|
|
1366
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1259
1367
|
function Widgets({
|
|
1260
1368
|
widgets,
|
|
1261
1369
|
onAction,
|
|
@@ -1280,85 +1388,85 @@ function Widgets({
|
|
|
1280
1388
|
normal: "gap-4",
|
|
1281
1389
|
loose: "gap-6"
|
|
1282
1390
|
};
|
|
1283
|
-
return /* @__PURE__ */
|
|
1391
|
+
return /* @__PURE__ */ jsx10("div", { className: cn(layoutClasses[layout], spacingClasses[spacing], className), children: widgets.map((widget) => /* @__PURE__ */ jsx10(WidgetRenderer, { widget, onAction }, widget.id)) });
|
|
1284
1392
|
}
|
|
1285
1393
|
|
|
1286
1394
|
// src/components/Widgets/WidgetSkeleton.tsx
|
|
1287
|
-
import { jsx as
|
|
1395
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1288
1396
|
function WidgetSkeleton({ type, className }) {
|
|
1289
1397
|
switch (type) {
|
|
1290
1398
|
case "card":
|
|
1291
|
-
return /* @__PURE__ */
|
|
1292
|
-
/* @__PURE__ */
|
|
1293
|
-
/* @__PURE__ */
|
|
1294
|
-
/* @__PURE__ */
|
|
1399
|
+
return /* @__PURE__ */ jsx11("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden", className), children: /* @__PURE__ */ jsxs8("div", { className: "p-4 space-y-3", children: [
|
|
1400
|
+
/* @__PURE__ */ jsx11("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-3/4" }),
|
|
1401
|
+
/* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-full" }),
|
|
1402
|
+
/* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-5/6" })
|
|
1295
1403
|
] }) });
|
|
1296
1404
|
case "list":
|
|
1297
|
-
return /* @__PURE__ */
|
|
1298
|
-
/* @__PURE__ */
|
|
1299
|
-
/* @__PURE__ */
|
|
1300
|
-
/* @__PURE__ */
|
|
1301
|
-
/* @__PURE__ */
|
|
1405
|
+
return /* @__PURE__ */ jsx11("div", { className: cn("apteva-widget-skeleton animate-pulse space-y-2", className), children: [1, 2, 3].map((i) => /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3 p-3 rounded-lg border border-neutral-200 dark:border-neutral-800", children: [
|
|
1406
|
+
/* @__PURE__ */ jsx11("div", { className: "w-10 h-10 bg-neutral-200 dark:bg-neutral-700 rounded-full flex-shrink-0" }),
|
|
1407
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex-1 space-y-2", children: [
|
|
1408
|
+
/* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2" }),
|
|
1409
|
+
/* @__PURE__ */ jsx11("div", { className: "h-2 bg-neutral-200 dark:bg-neutral-700 rounded w-3/4" })
|
|
1302
1410
|
] })
|
|
1303
1411
|
] }, i)) });
|
|
1304
1412
|
case "button_group":
|
|
1305
|
-
return /* @__PURE__ */
|
|
1306
|
-
/* @__PURE__ */
|
|
1307
|
-
/* @__PURE__ */
|
|
1308
|
-
/* @__PURE__ */
|
|
1413
|
+
return /* @__PURE__ */ jsxs8("div", { className: cn("apteva-widget-skeleton animate-pulse flex gap-2", className), children: [
|
|
1414
|
+
/* @__PURE__ */ jsx11("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20" }),
|
|
1415
|
+
/* @__PURE__ */ jsx11("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20" }),
|
|
1416
|
+
/* @__PURE__ */ jsx11("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20" })
|
|
1309
1417
|
] });
|
|
1310
1418
|
case "form":
|
|
1311
|
-
return /* @__PURE__ */
|
|
1312
|
-
/* @__PURE__ */
|
|
1313
|
-
/* @__PURE__ */
|
|
1314
|
-
/* @__PURE__ */
|
|
1315
|
-
/* @__PURE__ */
|
|
1419
|
+
return /* @__PURE__ */ jsxs8("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4 space-y-4", className), children: [
|
|
1420
|
+
/* @__PURE__ */ jsx11("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/3" }),
|
|
1421
|
+
/* @__PURE__ */ jsxs8("div", { className: "space-y-3", children: [
|
|
1422
|
+
/* @__PURE__ */ jsx11("div", { className: "h-10 bg-neutral-200 dark:bg-neutral-700 rounded" }),
|
|
1423
|
+
/* @__PURE__ */ jsx11("div", { className: "h-10 bg-neutral-200 dark:bg-neutral-700 rounded" })
|
|
1316
1424
|
] }),
|
|
1317
|
-
/* @__PURE__ */
|
|
1425
|
+
/* @__PURE__ */ jsx11("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded w-24" })
|
|
1318
1426
|
] });
|
|
1319
1427
|
case "chart":
|
|
1320
|
-
return /* @__PURE__ */
|
|
1321
|
-
/* @__PURE__ */
|
|
1322
|
-
/* @__PURE__ */
|
|
1323
|
-
/* @__PURE__ */
|
|
1324
|
-
/* @__PURE__ */
|
|
1325
|
-
/* @__PURE__ */
|
|
1326
|
-
/* @__PURE__ */
|
|
1327
|
-
/* @__PURE__ */
|
|
1428
|
+
return /* @__PURE__ */ jsxs8("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4", className), children: [
|
|
1429
|
+
/* @__PURE__ */ jsx11("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/4 mb-4" }),
|
|
1430
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-end gap-2 h-32", children: [
|
|
1431
|
+
/* @__PURE__ */ jsx11("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-1/2" }),
|
|
1432
|
+
/* @__PURE__ */ jsx11("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-3/4" }),
|
|
1433
|
+
/* @__PURE__ */ jsx11("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-1/3" }),
|
|
1434
|
+
/* @__PURE__ */ jsx11("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-full" }),
|
|
1435
|
+
/* @__PURE__ */ jsx11("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-2/3" })
|
|
1328
1436
|
] })
|
|
1329
1437
|
] });
|
|
1330
1438
|
case "image":
|
|
1331
|
-
return /* @__PURE__ */
|
|
1439
|
+
return /* @__PURE__ */ jsx11("div", { className: cn("apteva-widget-skeleton animate-pulse", className), children: /* @__PURE__ */ jsx11("div", { className: "aspect-video bg-neutral-200 dark:bg-neutral-700 rounded-lg" }) });
|
|
1332
1440
|
case "gallery":
|
|
1333
|
-
return /* @__PURE__ */
|
|
1441
|
+
return /* @__PURE__ */ jsx11("div", { className: cn("apteva-widget-skeleton animate-pulse grid grid-cols-3 gap-2", className), children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx11("div", { className: "aspect-square bg-neutral-200 dark:bg-neutral-700 rounded-lg" }, i)) });
|
|
1334
1442
|
case "map":
|
|
1335
|
-
return /* @__PURE__ */
|
|
1336
|
-
/* @__PURE__ */
|
|
1337
|
-
/* @__PURE__ */
|
|
1443
|
+
return /* @__PURE__ */ jsx11("div", { className: cn("apteva-widget-skeleton animate-pulse", className), children: /* @__PURE__ */ jsx11("div", { className: "h-48 bg-neutral-200 dark:bg-neutral-700 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsxs8("svg", { className: "w-8 h-8 text-neutral-400 dark:text-neutral-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
|
|
1444
|
+
/* @__PURE__ */ jsx11("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" }),
|
|
1445
|
+
/* @__PURE__ */ jsx11("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M15 11a3 3 0 11-6 0 3 3 0 016 0z" })
|
|
1338
1446
|
] }) }) });
|
|
1339
1447
|
case "table":
|
|
1340
|
-
return /* @__PURE__ */
|
|
1341
|
-
/* @__PURE__ */
|
|
1342
|
-
/* @__PURE__ */
|
|
1343
|
-
/* @__PURE__ */
|
|
1344
|
-
/* @__PURE__ */
|
|
1448
|
+
return /* @__PURE__ */ jsxs8("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden", className), children: [
|
|
1449
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex bg-neutral-100 dark:bg-neutral-800 border-b border-neutral-200 dark:border-neutral-700", children: [
|
|
1450
|
+
/* @__PURE__ */ jsx11("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-16" }) }),
|
|
1451
|
+
/* @__PURE__ */ jsx11("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-20" }) }),
|
|
1452
|
+
/* @__PURE__ */ jsx11("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-14" }) })
|
|
1345
1453
|
] }),
|
|
1346
|
-
[1, 2, 3].map((i) => /* @__PURE__ */
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
/* @__PURE__ */
|
|
1349
|
-
/* @__PURE__ */
|
|
1454
|
+
[1, 2, 3].map((i) => /* @__PURE__ */ jsxs8("div", { className: "flex border-b border-neutral-200 dark:border-neutral-800 last:border-b-0", children: [
|
|
1455
|
+
/* @__PURE__ */ jsx11("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-24" }) }),
|
|
1456
|
+
/* @__PURE__ */ jsx11("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-16" }) }),
|
|
1457
|
+
/* @__PURE__ */ jsx11("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-20" }) })
|
|
1350
1458
|
] }, i))
|
|
1351
1459
|
] });
|
|
1352
1460
|
default:
|
|
1353
|
-
return /* @__PURE__ */
|
|
1354
|
-
/* @__PURE__ */
|
|
1355
|
-
/* @__PURE__ */
|
|
1461
|
+
return /* @__PURE__ */ jsxs8("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4", className), children: [
|
|
1462
|
+
/* @__PURE__ */ jsx11("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2 mb-2" }),
|
|
1463
|
+
/* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-full" })
|
|
1356
1464
|
] });
|
|
1357
1465
|
}
|
|
1358
1466
|
}
|
|
1359
1467
|
|
|
1360
1468
|
// src/components/Chat/MarkdownContent.tsx
|
|
1361
|
-
import { jsx as
|
|
1469
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1362
1470
|
function isImageUrl(url) {
|
|
1363
1471
|
const imageExtensions = /\.(jpg|jpeg|png|gif|webp|svg|bmp|ico)(\?.*)?$/i;
|
|
1364
1472
|
return imageExtensions.test(url);
|
|
@@ -1377,7 +1485,7 @@ function parseInlineMarkdown(text, keyPrefix = "") {
|
|
|
1377
1485
|
const alt = match[1] || "";
|
|
1378
1486
|
const src = match[2];
|
|
1379
1487
|
result.push(
|
|
1380
|
-
/* @__PURE__ */
|
|
1488
|
+
/* @__PURE__ */ jsx12(
|
|
1381
1489
|
"img",
|
|
1382
1490
|
{
|
|
1383
1491
|
src,
|
|
@@ -1392,7 +1500,7 @@ function parseInlineMarkdown(text, keyPrefix = "") {
|
|
|
1392
1500
|
const href = match[4];
|
|
1393
1501
|
if (isImageUrl(href)) {
|
|
1394
1502
|
result.push(
|
|
1395
|
-
/* @__PURE__ */
|
|
1503
|
+
/* @__PURE__ */ jsx12(
|
|
1396
1504
|
"img",
|
|
1397
1505
|
{
|
|
1398
1506
|
src: href,
|
|
@@ -1404,7 +1512,7 @@ function parseInlineMarkdown(text, keyPrefix = "") {
|
|
|
1404
1512
|
);
|
|
1405
1513
|
} else {
|
|
1406
1514
|
result.push(
|
|
1407
|
-
/* @__PURE__ */
|
|
1515
|
+
/* @__PURE__ */ jsx12(
|
|
1408
1516
|
"a",
|
|
1409
1517
|
{
|
|
1410
1518
|
href,
|
|
@@ -1418,10 +1526,10 @@ function parseInlineMarkdown(text, keyPrefix = "") {
|
|
|
1418
1526
|
);
|
|
1419
1527
|
}
|
|
1420
1528
|
} else if (match[5] !== void 0) {
|
|
1421
|
-
result.push(/* @__PURE__ */
|
|
1529
|
+
result.push(/* @__PURE__ */ jsx12("strong", { children: match[6] }, `${keyPrefix}b${key++}`));
|
|
1422
1530
|
} else if (match[7] !== void 0) {
|
|
1423
1531
|
result.push(
|
|
1424
|
-
/* @__PURE__ */
|
|
1532
|
+
/* @__PURE__ */ jsx12("code", { className: "apteva-md-inline-code", children: match[7] }, `${keyPrefix}code${key++}`)
|
|
1425
1533
|
);
|
|
1426
1534
|
}
|
|
1427
1535
|
lastIndex = match.index + match[0].length;
|
|
@@ -1441,7 +1549,7 @@ function parseMarkdown(content) {
|
|
|
1441
1549
|
const h2Match = line.match(/^##\s+(.*)$/);
|
|
1442
1550
|
if (h2Match) {
|
|
1443
1551
|
result.push(
|
|
1444
|
-
/* @__PURE__ */
|
|
1552
|
+
/* @__PURE__ */ jsx12("h2", { className: "apteva-md-h2", children: parseInlineMarkdown(h2Match[1], `${key}`) }, `h2${key++}`)
|
|
1445
1553
|
);
|
|
1446
1554
|
i++;
|
|
1447
1555
|
continue;
|
|
@@ -1449,7 +1557,7 @@ function parseMarkdown(content) {
|
|
|
1449
1557
|
const h3Match = line.match(/^###\s+(.*)$/);
|
|
1450
1558
|
if (h3Match) {
|
|
1451
1559
|
result.push(
|
|
1452
|
-
/* @__PURE__ */
|
|
1560
|
+
/* @__PURE__ */ jsx12("h3", { className: "apteva-md-h3", children: parseInlineMarkdown(h3Match[1], `${key}`) }, `h3${key++}`)
|
|
1453
1561
|
);
|
|
1454
1562
|
i++;
|
|
1455
1563
|
continue;
|
|
@@ -1462,7 +1570,7 @@ function parseMarkdown(content) {
|
|
|
1462
1570
|
const itemMatch = lines[i].match(/^(\s*)([-*+])\s+(.*)$/);
|
|
1463
1571
|
if (itemMatch && itemMatch[1].length === indent) {
|
|
1464
1572
|
listItems.push(
|
|
1465
|
-
/* @__PURE__ */
|
|
1573
|
+
/* @__PURE__ */ jsx12("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
|
|
1466
1574
|
);
|
|
1467
1575
|
i++;
|
|
1468
1576
|
} else {
|
|
@@ -1470,7 +1578,7 @@ function parseMarkdown(content) {
|
|
|
1470
1578
|
}
|
|
1471
1579
|
}
|
|
1472
1580
|
result.push(
|
|
1473
|
-
/* @__PURE__ */
|
|
1581
|
+
/* @__PURE__ */ jsx12("ul", { className: "apteva-md-ul", children: listItems }, `ul${key++}`)
|
|
1474
1582
|
);
|
|
1475
1583
|
continue;
|
|
1476
1584
|
}
|
|
@@ -1482,7 +1590,7 @@ function parseMarkdown(content) {
|
|
|
1482
1590
|
const itemMatch = lines[i].match(/^(\s*)(\d+)\.\s+(.*)$/);
|
|
1483
1591
|
if (itemMatch && itemMatch[1].length === indent) {
|
|
1484
1592
|
listItems.push(
|
|
1485
|
-
/* @__PURE__ */
|
|
1593
|
+
/* @__PURE__ */ jsx12("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
|
|
1486
1594
|
);
|
|
1487
1595
|
i++;
|
|
1488
1596
|
} else {
|
|
@@ -1490,7 +1598,7 @@ function parseMarkdown(content) {
|
|
|
1490
1598
|
}
|
|
1491
1599
|
}
|
|
1492
1600
|
result.push(
|
|
1493
|
-
/* @__PURE__ */
|
|
1601
|
+
/* @__PURE__ */ jsx12("ol", { className: "apteva-md-ol", children: listItems }, `ol${key++}`)
|
|
1494
1602
|
);
|
|
1495
1603
|
continue;
|
|
1496
1604
|
}
|
|
@@ -1513,19 +1621,19 @@ function parseMarkdown(content) {
|
|
|
1513
1621
|
}
|
|
1514
1622
|
}
|
|
1515
1623
|
result.push(
|
|
1516
|
-
/* @__PURE__ */
|
|
1517
|
-
/* @__PURE__ */
|
|
1518
|
-
/* @__PURE__ */
|
|
1624
|
+
/* @__PURE__ */ jsx12("div", { className: "apteva-md-table-wrapper", children: /* @__PURE__ */ jsxs9("table", { className: "apteva-md-table", children: [
|
|
1625
|
+
/* @__PURE__ */ jsx12("thead", { children: /* @__PURE__ */ jsx12("tr", { children: headerCells.map((cell, idx) => /* @__PURE__ */ jsx12("th", { className: "apteva-md-th", children: parseInlineMarkdown(cell, `th${key}${idx}`) }, `th${idx}`)) }) }),
|
|
1626
|
+
/* @__PURE__ */ jsx12("tbody", { children: bodyRows.map((row, rowIdx) => /* @__PURE__ */ jsx12("tr", { children: row.map((cell, cellIdx) => /* @__PURE__ */ jsx12("td", { className: "apteva-md-td", children: parseInlineMarkdown(cell, `td${key}${rowIdx}${cellIdx}`) }, `td${cellIdx}`)) }, `tr${rowIdx}`)) })
|
|
1519
1627
|
] }) }, `table-wrapper${key++}`)
|
|
1520
1628
|
);
|
|
1521
1629
|
continue;
|
|
1522
1630
|
}
|
|
1523
1631
|
}
|
|
1524
1632
|
if (line === "") {
|
|
1525
|
-
result.push(/* @__PURE__ */
|
|
1633
|
+
result.push(/* @__PURE__ */ jsx12("br", {}, `br${key++}`));
|
|
1526
1634
|
} else {
|
|
1527
1635
|
result.push(
|
|
1528
|
-
/* @__PURE__ */
|
|
1636
|
+
/* @__PURE__ */ jsxs9("span", { children: [
|
|
1529
1637
|
parseInlineMarkdown(line, `${key}`),
|
|
1530
1638
|
i < lines.length - 1 ? "\n" : ""
|
|
1531
1639
|
] }, `p${key++}`)
|
|
@@ -1536,53 +1644,53 @@ function parseMarkdown(content) {
|
|
|
1536
1644
|
return result;
|
|
1537
1645
|
}
|
|
1538
1646
|
function MarkdownContent({ content, className = "" }) {
|
|
1539
|
-
return /* @__PURE__ */
|
|
1647
|
+
return /* @__PURE__ */ jsx12("div", { className: `apteva-md ${className}`, children: parseMarkdown(content) });
|
|
1540
1648
|
}
|
|
1541
1649
|
|
|
1542
1650
|
// src/components/Chat/ToolCall.tsx
|
|
1543
|
-
import { Fragment, jsx as
|
|
1651
|
+
import { Fragment, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1544
1652
|
function ToolCall({ name, status, isReceiving = false, inputLength = 0, streamOutput }) {
|
|
1545
1653
|
if (status === "preparing") {
|
|
1546
|
-
return /* @__PURE__ */
|
|
1547
|
-
/* @__PURE__ */
|
|
1548
|
-
/* @__PURE__ */
|
|
1549
|
-
/* @__PURE__ */
|
|
1654
|
+
return /* @__PURE__ */ jsxs10("div", { className: "apteva-tool-card apteva-tool-card-preparing", children: [
|
|
1655
|
+
/* @__PURE__ */ jsxs10("svg", { className: "apteva-tool-icon apteva-tool-icon-spin", fill: "none", viewBox: "0 0 24 24", children: [
|
|
1656
|
+
/* @__PURE__ */ jsx13("circle", { className: "apteva-tool-spinner-track", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
1657
|
+
/* @__PURE__ */ jsx13("path", { className: "apteva-tool-spinner-fill", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
|
|
1550
1658
|
] }),
|
|
1551
|
-
/* @__PURE__ */
|
|
1552
|
-
/* @__PURE__ */
|
|
1553
|
-
/* @__PURE__ */
|
|
1659
|
+
/* @__PURE__ */ jsxs10("span", { className: "apteva-tool-label", children: [
|
|
1660
|
+
/* @__PURE__ */ jsx13("strong", { children: name }),
|
|
1661
|
+
/* @__PURE__ */ jsx13("span", { className: "apteva-tool-status-text", children: " preparing..." })
|
|
1554
1662
|
] })
|
|
1555
1663
|
] });
|
|
1556
1664
|
}
|
|
1557
1665
|
if (status === "running") {
|
|
1558
|
-
return /* @__PURE__ */
|
|
1559
|
-
/* @__PURE__ */
|
|
1560
|
-
/* @__PURE__ */
|
|
1561
|
-
/* @__PURE__ */
|
|
1666
|
+
return /* @__PURE__ */ jsxs10("div", { className: "apteva-tool-card apteva-tool-card-running", children: [
|
|
1667
|
+
/* @__PURE__ */ jsxs10("svg", { className: "apteva-tool-icon apteva-tool-icon-spin", fill: "none", viewBox: "0 0 24 24", children: [
|
|
1668
|
+
/* @__PURE__ */ jsx13("circle", { className: "apteva-tool-spinner-track", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
1669
|
+
/* @__PURE__ */ jsx13("path", { className: "apteva-tool-spinner-fill", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
|
|
1562
1670
|
] }),
|
|
1563
|
-
/* @__PURE__ */
|
|
1564
|
-
/* @__PURE__ */
|
|
1565
|
-
streamOutput ? /* @__PURE__ */
|
|
1566
|
-
streamOutput ? /* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */
|
|
1568
|
-
/* @__PURE__ */
|
|
1569
|
-
/* @__PURE__ */
|
|
1570
|
-
/* @__PURE__ */
|
|
1571
|
-
/* @__PURE__ */
|
|
1671
|
+
/* @__PURE__ */ jsxs10("span", { className: "apteva-tool-label", children: [
|
|
1672
|
+
/* @__PURE__ */ jsx13("strong", { children: name }),
|
|
1673
|
+
streamOutput ? /* @__PURE__ */ jsx13("span", { className: "apteva-tool-stream-separator", children: " \xB7 " }) : null,
|
|
1674
|
+
streamOutput ? /* @__PURE__ */ jsx13("span", { className: "apteva-tool-stream-output", children: streamOutput }) : /* @__PURE__ */ jsxs10(Fragment, { children: [
|
|
1675
|
+
/* @__PURE__ */ jsx13("span", { className: "apteva-tool-status-text", children: " running" }),
|
|
1676
|
+
/* @__PURE__ */ jsxs10("span", { className: "apteva-tool-dots", children: [
|
|
1677
|
+
/* @__PURE__ */ jsx13("span", { children: "." }),
|
|
1678
|
+
/* @__PURE__ */ jsx13("span", { children: "." }),
|
|
1679
|
+
/* @__PURE__ */ jsx13("span", { children: "." })
|
|
1572
1680
|
] })
|
|
1573
1681
|
] })
|
|
1574
1682
|
] })
|
|
1575
1683
|
] });
|
|
1576
1684
|
}
|
|
1577
1685
|
if (status === "completed") {
|
|
1578
|
-
return /* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1580
|
-
/* @__PURE__ */
|
|
1686
|
+
return /* @__PURE__ */ jsxs10("div", { className: "apteva-tool-card apteva-tool-card-completed", children: [
|
|
1687
|
+
/* @__PURE__ */ jsx13("svg", { className: "apteva-tool-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }),
|
|
1688
|
+
/* @__PURE__ */ jsx13("span", { className: "apteva-tool-label", children: name })
|
|
1581
1689
|
] });
|
|
1582
1690
|
}
|
|
1583
|
-
return /* @__PURE__ */
|
|
1584
|
-
/* @__PURE__ */
|
|
1585
|
-
/* @__PURE__ */
|
|
1691
|
+
return /* @__PURE__ */ jsxs10("div", { className: "apteva-tool-card apteva-tool-card-error", children: [
|
|
1692
|
+
/* @__PURE__ */ jsx13("svg", { className: "apteva-tool-icon", 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" }) }),
|
|
1693
|
+
/* @__PURE__ */ jsxs10("span", { className: "apteva-tool-label", children: [
|
|
1586
1694
|
name,
|
|
1587
1695
|
" failed"
|
|
1588
1696
|
] })
|
|
@@ -1590,7 +1698,7 @@ function ToolCall({ name, status, isReceiving = false, inputLength = 0, streamOu
|
|
|
1590
1698
|
}
|
|
1591
1699
|
|
|
1592
1700
|
// src/components/Chat/Message.tsx
|
|
1593
|
-
import { jsx as
|
|
1701
|
+
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1594
1702
|
function Message({ message, onAction, enableWidgets, onWidgetRender }) {
|
|
1595
1703
|
const isUser = message.role === "user";
|
|
1596
1704
|
const contentSegments = message.metadata?.content_segments;
|
|
@@ -1626,14 +1734,14 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
|
|
|
1626
1734
|
}, [parsedWidgets, onWidgetRender]);
|
|
1627
1735
|
const renderTextContent = (text) => {
|
|
1628
1736
|
if (!enableWidgets || isUser) {
|
|
1629
|
-
return /* @__PURE__ */
|
|
1737
|
+
return /* @__PURE__ */ jsx14(MarkdownContent, { content: text });
|
|
1630
1738
|
}
|
|
1631
1739
|
const parsed = parseWidgetsFromText(text);
|
|
1632
1740
|
const cleanedText = parsed.segments.filter((seg) => seg.type === "text" && seg.content).map((seg) => seg.content).join("");
|
|
1633
1741
|
if (!cleanedText.trim()) {
|
|
1634
1742
|
return null;
|
|
1635
1743
|
}
|
|
1636
|
-
return /* @__PURE__ */
|
|
1744
|
+
return /* @__PURE__ */ jsx14(MarkdownContent, { content: cleanedText });
|
|
1637
1745
|
};
|
|
1638
1746
|
const renderContentWithWidgets = () => {
|
|
1639
1747
|
if (!enableWidgets || isUser || !message.content) {
|
|
@@ -1648,28 +1756,28 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
|
|
|
1648
1756
|
} else if (segment.type === "widget" && segment.widget) {
|
|
1649
1757
|
if (textBuffer.trim()) {
|
|
1650
1758
|
elements.push(
|
|
1651
|
-
/* @__PURE__ */
|
|
1759
|
+
/* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx14(MarkdownContent, { content: textBuffer }) }) }, `text-${index}`)
|
|
1652
1760
|
);
|
|
1653
1761
|
textBuffer = "";
|
|
1654
1762
|
}
|
|
1655
1763
|
elements.push(
|
|
1656
|
-
/* @__PURE__ */
|
|
1764
|
+
/* @__PURE__ */ jsx14("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx14(WidgetRenderer, { widget: segment.widget, onAction }) }, `widget-${index}`)
|
|
1657
1765
|
);
|
|
1658
1766
|
} else if (segment.type === "widget_pending" && segment.pendingType) {
|
|
1659
1767
|
if (textBuffer.trim()) {
|
|
1660
1768
|
elements.push(
|
|
1661
|
-
/* @__PURE__ */
|
|
1769
|
+
/* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx14(MarkdownContent, { content: textBuffer }) }) }, `text-${index}`)
|
|
1662
1770
|
);
|
|
1663
1771
|
textBuffer = "";
|
|
1664
1772
|
}
|
|
1665
1773
|
elements.push(
|
|
1666
|
-
/* @__PURE__ */
|
|
1774
|
+
/* @__PURE__ */ jsx14("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx14(WidgetSkeleton, { type: segment.pendingType }) }, `pending-${index}`)
|
|
1667
1775
|
);
|
|
1668
1776
|
}
|
|
1669
1777
|
});
|
|
1670
1778
|
if (textBuffer.trim()) {
|
|
1671
1779
|
elements.push(
|
|
1672
|
-
/* @__PURE__ */
|
|
1780
|
+
/* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx14(MarkdownContent, { content: textBuffer }) }) }, "text-final")
|
|
1673
1781
|
);
|
|
1674
1782
|
}
|
|
1675
1783
|
return elements.length > 0 ? elements : null;
|
|
@@ -1678,11 +1786,11 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
|
|
|
1678
1786
|
const hasAttachments = attachments.length > 0;
|
|
1679
1787
|
const renderAttachments = () => {
|
|
1680
1788
|
if (!hasAttachments) return null;
|
|
1681
|
-
return /* @__PURE__ */
|
|
1789
|
+
return /* @__PURE__ */ jsx14("div", { className: "apteva-message-attachments flex flex-wrap gap-2 mb-2 justify-end", children: attachments.map((att, index) => {
|
|
1682
1790
|
const isImage = att.type.startsWith("image/");
|
|
1683
1791
|
const isPdf = att.type === "application/pdf";
|
|
1684
1792
|
if (isImage && att.preview) {
|
|
1685
|
-
return /* @__PURE__ */
|
|
1793
|
+
return /* @__PURE__ */ jsx14("div", { className: "apteva-attachment-image relative rounded-lg overflow-hidden shadow-sm", children: /* @__PURE__ */ jsx14(
|
|
1686
1794
|
"img",
|
|
1687
1795
|
{
|
|
1688
1796
|
src: att.preview,
|
|
@@ -1691,15 +1799,15 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
|
|
|
1691
1799
|
}
|
|
1692
1800
|
) }, index);
|
|
1693
1801
|
}
|
|
1694
|
-
return /* @__PURE__ */
|
|
1802
|
+
return /* @__PURE__ */ jsxs11(
|
|
1695
1803
|
"div",
|
|
1696
1804
|
{
|
|
1697
1805
|
className: "apteva-attachment-doc flex items-center gap-3 px-4 py-3 bg-neutral-100 dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-xl shadow-sm",
|
|
1698
1806
|
children: [
|
|
1699
|
-
/* @__PURE__ */
|
|
1700
|
-
/* @__PURE__ */
|
|
1701
|
-
/* @__PURE__ */
|
|
1702
|
-
/* @__PURE__ */
|
|
1807
|
+
/* @__PURE__ */ jsx14("div", { className: "w-10 h-10 flex items-center justify-center bg-red-100 dark:bg-red-900/30 rounded-lg text-red-600 dark:text-red-400", children: isPdf ? /* @__PURE__ */ jsx14("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" }) }) : /* @__PURE__ */ jsx14("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) }) }),
|
|
1808
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col min-w-0", children: [
|
|
1809
|
+
/* @__PURE__ */ jsx14("span", { className: "text-sm font-medium text-neutral-800 dark:text-neutral-200 truncate max-w-[180px]", children: att.name }),
|
|
1810
|
+
/* @__PURE__ */ jsxs11("span", { className: "text-xs text-neutral-500 dark:text-neutral-400", children: [
|
|
1703
1811
|
isPdf ? "PDF" : "Document",
|
|
1704
1812
|
" \xB7 ",
|
|
1705
1813
|
formatFileSize(att.size)
|
|
@@ -1713,13 +1821,13 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
|
|
|
1713
1821
|
};
|
|
1714
1822
|
const renderContent = () => {
|
|
1715
1823
|
if (isUser) {
|
|
1716
|
-
return /* @__PURE__ */
|
|
1824
|
+
return /* @__PURE__ */ jsx14("div", { className: "apteva-message-text", children: message.content });
|
|
1717
1825
|
}
|
|
1718
1826
|
if (isStreaming && !hasContent) {
|
|
1719
|
-
return /* @__PURE__ */
|
|
1720
|
-
/* @__PURE__ */
|
|
1721
|
-
/* @__PURE__ */
|
|
1722
|
-
/* @__PURE__ */
|
|
1827
|
+
return /* @__PURE__ */ jsxs11("div", { className: "apteva-typing-indicator", children: [
|
|
1828
|
+
/* @__PURE__ */ jsx14("span", {}),
|
|
1829
|
+
/* @__PURE__ */ jsx14("span", {}),
|
|
1830
|
+
/* @__PURE__ */ jsx14("span", {})
|
|
1723
1831
|
] });
|
|
1724
1832
|
}
|
|
1725
1833
|
if (contentSegments && contentSegments.length > 0) {
|
|
@@ -1729,7 +1837,7 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
|
|
|
1729
1837
|
};
|
|
1730
1838
|
const renderTextSegmentWithWidgets = (text, keyPrefix) => {
|
|
1731
1839
|
if (!enableWidgets) {
|
|
1732
|
-
return /* @__PURE__ */
|
|
1840
|
+
return /* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx14(MarkdownContent, { content: text }) }) }, keyPrefix);
|
|
1733
1841
|
}
|
|
1734
1842
|
const parsed = parseWidgetsFromText(text);
|
|
1735
1843
|
const elements = [];
|
|
@@ -1740,28 +1848,28 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
|
|
|
1740
1848
|
} else if (seg.type === "widget" && seg.widget) {
|
|
1741
1849
|
if (textBuffer.trim()) {
|
|
1742
1850
|
elements.push(
|
|
1743
|
-
/* @__PURE__ */
|
|
1851
|
+
/* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx14(MarkdownContent, { content: textBuffer }) }) }, `${keyPrefix}-text-${idx}`)
|
|
1744
1852
|
);
|
|
1745
1853
|
textBuffer = "";
|
|
1746
1854
|
}
|
|
1747
1855
|
elements.push(
|
|
1748
|
-
/* @__PURE__ */
|
|
1856
|
+
/* @__PURE__ */ jsx14("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx14(WidgetRenderer, { widget: seg.widget, onAction }) }, `${keyPrefix}-widget-${idx}`)
|
|
1749
1857
|
);
|
|
1750
1858
|
} else if (seg.type === "widget_pending" && seg.pendingType) {
|
|
1751
1859
|
if (textBuffer.trim()) {
|
|
1752
1860
|
elements.push(
|
|
1753
|
-
/* @__PURE__ */
|
|
1861
|
+
/* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx14(MarkdownContent, { content: textBuffer }) }) }, `${keyPrefix}-text-${idx}`)
|
|
1754
1862
|
);
|
|
1755
1863
|
textBuffer = "";
|
|
1756
1864
|
}
|
|
1757
1865
|
elements.push(
|
|
1758
|
-
/* @__PURE__ */
|
|
1866
|
+
/* @__PURE__ */ jsx14("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx14(WidgetSkeleton, { type: seg.pendingType }) }, `${keyPrefix}-pending-${idx}`)
|
|
1759
1867
|
);
|
|
1760
1868
|
}
|
|
1761
1869
|
});
|
|
1762
1870
|
if (textBuffer.trim()) {
|
|
1763
1871
|
elements.push(
|
|
1764
|
-
/* @__PURE__ */
|
|
1872
|
+
/* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx14(MarkdownContent, { content: textBuffer }) }) }, `${keyPrefix}-text-final`)
|
|
1765
1873
|
);
|
|
1766
1874
|
}
|
|
1767
1875
|
return elements;
|
|
@@ -1781,7 +1889,7 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
|
|
|
1781
1889
|
}
|
|
1782
1890
|
} else if (segment.type === "tool") {
|
|
1783
1891
|
elements.push(
|
|
1784
|
-
/* @__PURE__ */
|
|
1892
|
+
/* @__PURE__ */ jsx14("div", { className: "apteva-tool-call-standalone", children: /* @__PURE__ */ jsx14(
|
|
1785
1893
|
ToolCall,
|
|
1786
1894
|
{
|
|
1787
1895
|
name: segment.name,
|
|
@@ -1797,28 +1905,28 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
|
|
|
1797
1905
|
return elements;
|
|
1798
1906
|
};
|
|
1799
1907
|
if (!isUser && (contentSegments && contentSegments.length > 0)) {
|
|
1800
|
-
return /* @__PURE__ */
|
|
1908
|
+
return /* @__PURE__ */ jsxs11("div", { className: "apteva-message-segmented", children: [
|
|
1801
1909
|
renderSegmentedContent(),
|
|
1802
|
-
message.widgets && message.widgets.length > 0 && /* @__PURE__ */
|
|
1803
|
-
/* @__PURE__ */
|
|
1910
|
+
message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx14("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx14(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
|
|
1911
|
+
/* @__PURE__ */ jsx14("div", { className: "apteva-message-timestamp apteva-message-timestamp-assistant", suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
|
|
1804
1912
|
] });
|
|
1805
1913
|
}
|
|
1806
1914
|
const widgetContent = renderContentWithWidgets();
|
|
1807
1915
|
if (!isUser && enableWidgets && widgetContent) {
|
|
1808
|
-
return /* @__PURE__ */
|
|
1916
|
+
return /* @__PURE__ */ jsxs11("div", { className: "apteva-message-segmented", children: [
|
|
1809
1917
|
widgetContent,
|
|
1810
|
-
message.widgets && message.widgets.length > 0 && /* @__PURE__ */
|
|
1811
|
-
/* @__PURE__ */
|
|
1918
|
+
message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx14("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx14(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
|
|
1919
|
+
/* @__PURE__ */ jsx14("div", { className: "apteva-message-timestamp apteva-message-timestamp-assistant", suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
|
|
1812
1920
|
] });
|
|
1813
1921
|
}
|
|
1814
1922
|
if (isUser && hasAttachments) {
|
|
1815
|
-
return /* @__PURE__ */
|
|
1923
|
+
return /* @__PURE__ */ jsxs11("div", { className: "apteva-message-segmented apteva-message-user-with-attachments flex flex-col items-end", children: [
|
|
1816
1924
|
renderAttachments(),
|
|
1817
|
-
message.content && /* @__PURE__ */
|
|
1818
|
-
/* @__PURE__ */
|
|
1925
|
+
message.content && /* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-user", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-user", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-text", children: message.content }) }) }),
|
|
1926
|
+
/* @__PURE__ */ jsx14("div", { className: "apteva-message-timestamp apteva-message-timestamp-user", suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
|
|
1819
1927
|
] });
|
|
1820
1928
|
}
|
|
1821
|
-
return /* @__PURE__ */
|
|
1929
|
+
return /* @__PURE__ */ jsxs11(
|
|
1822
1930
|
"div",
|
|
1823
1931
|
{
|
|
1824
1932
|
className: cn(
|
|
@@ -1826,17 +1934,17 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
|
|
|
1826
1934
|
isUser ? "apteva-message-user" : "apteva-message-assistant"
|
|
1827
1935
|
),
|
|
1828
1936
|
children: [
|
|
1829
|
-
/* @__PURE__ */
|
|
1830
|
-
message.widgets && message.widgets.length > 0 && /* @__PURE__ */
|
|
1831
|
-
/* @__PURE__ */
|
|
1937
|
+
/* @__PURE__ */ jsx14("div", { className: isUser ? "apteva-message-content-user" : "apteva-message-content-assistant", children: renderContent() }),
|
|
1938
|
+
message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx14("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx14(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
|
|
1939
|
+
/* @__PURE__ */ jsx14("div", { className: cn("apteva-message-timestamp", isUser ? "apteva-message-timestamp-user" : "apteva-message-timestamp-assistant"), suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
|
|
1832
1940
|
]
|
|
1833
1941
|
}
|
|
1834
1942
|
);
|
|
1835
1943
|
}
|
|
1836
1944
|
|
|
1837
1945
|
// src/components/Chat/WelcomeScreen.tsx
|
|
1838
|
-
import { jsx as
|
|
1839
|
-
var DefaultIcon = () => /* @__PURE__ */
|
|
1946
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1947
|
+
var DefaultIcon = () => /* @__PURE__ */ jsx15("svg", { className: "w-12 h-12 sm:w-16 sm:h-16", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx15(
|
|
1840
1948
|
"path",
|
|
1841
1949
|
{
|
|
1842
1950
|
strokeLinecap: "round",
|
|
@@ -1845,7 +1953,7 @@ var DefaultIcon = () => /* @__PURE__ */ jsx14("svg", { className: "w-12 h-12 sm:
|
|
|
1845
1953
|
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"
|
|
1846
1954
|
}
|
|
1847
1955
|
) });
|
|
1848
|
-
var ArrowIcon = () => /* @__PURE__ */
|
|
1956
|
+
var ArrowIcon = () => /* @__PURE__ */ jsx15("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx15("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 7l5 5m0 0l-5 5m5-5H6" }) });
|
|
1849
1957
|
function WelcomeScreen({
|
|
1850
1958
|
title,
|
|
1851
1959
|
subtitle,
|
|
@@ -1860,18 +1968,18 @@ function WelcomeScreen({
|
|
|
1860
1968
|
const hasPrompts = normalizedPrompts.length > 0;
|
|
1861
1969
|
const hasHeader = title || subtitle || icon;
|
|
1862
1970
|
if (!hasHeader && !hasPrompts) {
|
|
1863
|
-
return /* @__PURE__ */
|
|
1864
|
-
/* @__PURE__ */
|
|
1865
|
-
/* @__PURE__ */
|
|
1971
|
+
return /* @__PURE__ */ jsx15("div", { className: "flex items-center justify-center h-full !text-neutral-500 dark:!text-neutral-400", children: /* @__PURE__ */ jsxs12("div", { className: "text-center space-y-2", children: [
|
|
1972
|
+
/* @__PURE__ */ jsx15("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx15(DefaultIcon, {}) }),
|
|
1973
|
+
/* @__PURE__ */ jsx15("p", { className: "text-sm", children: "No messages yet. Start a conversation!" })
|
|
1866
1974
|
] }) });
|
|
1867
1975
|
}
|
|
1868
1976
|
if (variant === "minimal") {
|
|
1869
|
-
return /* @__PURE__ */
|
|
1870
|
-
hasHeader && /* @__PURE__ */
|
|
1871
|
-
title && /* @__PURE__ */
|
|
1872
|
-
subtitle && /* @__PURE__ */
|
|
1977
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex flex-col h-full px-4 py-4", children: [
|
|
1978
|
+
hasHeader && /* @__PURE__ */ jsxs12("div", { className: "mb-4", children: [
|
|
1979
|
+
title && /* @__PURE__ */ jsx15("h2", { className: "text-lg font-semibold !text-neutral-900 dark:!text-white", children: title }),
|
|
1980
|
+
subtitle && /* @__PURE__ */ jsx15("p", { className: "text-sm !text-neutral-500 dark:!text-neutral-400 mt-1", children: subtitle })
|
|
1873
1981
|
] }),
|
|
1874
|
-
hasPrompts && /* @__PURE__ */
|
|
1982
|
+
hasPrompts && /* @__PURE__ */ jsx15("div", { className: "flex-1 space-y-2", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx15(
|
|
1875
1983
|
"button",
|
|
1876
1984
|
{
|
|
1877
1985
|
onClick: () => onPromptClick(prompt.text),
|
|
@@ -1884,11 +1992,11 @@ function WelcomeScreen({
|
|
|
1884
1992
|
"transition-all duration-200",
|
|
1885
1993
|
"group"
|
|
1886
1994
|
),
|
|
1887
|
-
children: /* @__PURE__ */
|
|
1888
|
-
/* @__PURE__ */
|
|
1889
|
-
/* @__PURE__ */
|
|
1890
|
-
/* @__PURE__ */
|
|
1891
|
-
prompt.description && /* @__PURE__ */
|
|
1995
|
+
children: /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-3", children: [
|
|
1996
|
+
/* @__PURE__ */ jsx15("div", { className: "flex-shrink-0 !text-neutral-400 dark:!text-neutral-500 group-hover:!text-blue-500 dark:group-hover:!text-blue-400 transition-colors", children: prompt.icon || /* @__PURE__ */ jsx15(ArrowIcon, {}) }),
|
|
1997
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex-1 min-w-0", children: [
|
|
1998
|
+
/* @__PURE__ */ jsx15("p", { className: "text-sm font-medium !text-neutral-900 dark:!text-white truncate", children: prompt.text }),
|
|
1999
|
+
prompt.description && /* @__PURE__ */ jsx15("p", { className: "text-xs !text-neutral-500 dark:!text-neutral-400 mt-0.5 truncate", children: prompt.description })
|
|
1892
2000
|
] })
|
|
1893
2001
|
] })
|
|
1894
2002
|
},
|
|
@@ -1896,14 +2004,14 @@ function WelcomeScreen({
|
|
|
1896
2004
|
)) })
|
|
1897
2005
|
] });
|
|
1898
2006
|
}
|
|
1899
|
-
return /* @__PURE__ */
|
|
1900
|
-
/* @__PURE__ */
|
|
1901
|
-
/* @__PURE__ */
|
|
1902
|
-
title && /* @__PURE__ */
|
|
1903
|
-
subtitle && /* @__PURE__ */
|
|
2007
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex flex-col items-center justify-center h-full px-4 py-6 sm:py-8", children: [
|
|
2008
|
+
/* @__PURE__ */ jsxs12("div", { className: "text-center mb-6 sm:mb-8 max-w-md", children: [
|
|
2009
|
+
/* @__PURE__ */ jsx15("div", { className: "mb-4 !text-neutral-400 dark:!text-neutral-500 flex justify-center", children: icon || /* @__PURE__ */ jsx15(DefaultIcon, {}) }),
|
|
2010
|
+
title && /* @__PURE__ */ jsx15("h1", { className: "text-xl sm:text-2xl font-semibold !text-neutral-900 dark:!text-white mb-2", children: title }),
|
|
2011
|
+
subtitle && /* @__PURE__ */ jsx15("p", { className: "text-sm sm:text-base !text-neutral-500 dark:!text-neutral-400", children: subtitle })
|
|
1904
2012
|
] }),
|
|
1905
|
-
hasPrompts && /* @__PURE__ */
|
|
1906
|
-
/* @__PURE__ */
|
|
2013
|
+
hasPrompts && /* @__PURE__ */ jsxs12("div", { className: "w-full max-w-2xl", children: [
|
|
2014
|
+
/* @__PURE__ */ jsx15("div", { className: "sm:hidden space-y-2", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx15(
|
|
1907
2015
|
"button",
|
|
1908
2016
|
{
|
|
1909
2017
|
onClick: () => onPromptClick(prompt.text),
|
|
@@ -1918,20 +2026,20 @@ function WelcomeScreen({
|
|
|
1918
2026
|
"shadow-sm hover:shadow",
|
|
1919
2027
|
"group"
|
|
1920
2028
|
),
|
|
1921
|
-
children: /* @__PURE__ */
|
|
1922
|
-
/* @__PURE__ */
|
|
1923
|
-
/* @__PURE__ */
|
|
1924
|
-
/* @__PURE__ */
|
|
1925
|
-
prompt.description && /* @__PURE__ */
|
|
2029
|
+
children: /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-3", children: [
|
|
2030
|
+
/* @__PURE__ */ jsx15("div", { className: "flex-shrink-0 w-8 h-8 rounded-lg bg-neutral-100 dark:bg-neutral-700 flex items-center justify-center !text-neutral-500 dark:!text-neutral-400 group-hover:bg-blue-100 dark:group-hover:bg-blue-900/30 group-hover:!text-blue-600 dark:group-hover:!text-blue-400 transition-colors", children: prompt.icon || /* @__PURE__ */ jsx15(ArrowIcon, {}) }),
|
|
2031
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex-1 min-w-0", children: [
|
|
2032
|
+
/* @__PURE__ */ jsx15("p", { className: "text-sm font-medium !text-neutral-900 dark:!text-white", children: prompt.text }),
|
|
2033
|
+
prompt.description && /* @__PURE__ */ jsx15("p", { className: "text-xs !text-neutral-500 dark:!text-neutral-400 mt-0.5 line-clamp-1", children: prompt.description })
|
|
1926
2034
|
] }),
|
|
1927
|
-
/* @__PURE__ */
|
|
2035
|
+
/* @__PURE__ */ jsx15(
|
|
1928
2036
|
"svg",
|
|
1929
2037
|
{
|
|
1930
2038
|
className: "w-4 h-4 !text-neutral-400 group-hover:!text-blue-500 transition-colors flex-shrink-0",
|
|
1931
2039
|
fill: "none",
|
|
1932
2040
|
stroke: "currentColor",
|
|
1933
2041
|
viewBox: "0 0 24 24",
|
|
1934
|
-
children: /* @__PURE__ */
|
|
2042
|
+
children: /* @__PURE__ */ jsx15(
|
|
1935
2043
|
"path",
|
|
1936
2044
|
{
|
|
1937
2045
|
strokeLinecap: "round",
|
|
@@ -1946,7 +2054,7 @@ function WelcomeScreen({
|
|
|
1946
2054
|
},
|
|
1947
2055
|
index
|
|
1948
2056
|
)) }),
|
|
1949
|
-
/* @__PURE__ */
|
|
2057
|
+
/* @__PURE__ */ jsx15("div", { className: "hidden sm:grid sm:grid-cols-2 gap-3", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx15(
|
|
1950
2058
|
"button",
|
|
1951
2059
|
{
|
|
1952
2060
|
onClick: () => onPromptClick(prompt.text),
|
|
@@ -1961,11 +2069,11 @@ function WelcomeScreen({
|
|
|
1961
2069
|
"transition-all duration-200",
|
|
1962
2070
|
"group"
|
|
1963
2071
|
),
|
|
1964
|
-
children: /* @__PURE__ */
|
|
1965
|
-
/* @__PURE__ */
|
|
1966
|
-
/* @__PURE__ */
|
|
1967
|
-
/* @__PURE__ */
|
|
1968
|
-
prompt.description && /* @__PURE__ */
|
|
2072
|
+
children: /* @__PURE__ */ jsxs12("div", { className: "flex items-start gap-3", children: [
|
|
2073
|
+
/* @__PURE__ */ jsx15("div", { className: "flex-shrink-0 w-9 h-9 rounded-lg bg-neutral-100 dark:bg-neutral-700 flex items-center justify-center !text-neutral-500 dark:!text-neutral-400 group-hover:bg-blue-100 dark:group-hover:bg-blue-900/30 group-hover:!text-blue-600 dark:group-hover:!text-blue-400 transition-colors", children: prompt.icon || /* @__PURE__ */ jsx15(ArrowIcon, {}) }),
|
|
2074
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex-1 min-w-0", children: [
|
|
2075
|
+
/* @__PURE__ */ jsx15("p", { className: "text-sm font-medium !text-neutral-900 dark:!text-white leading-snug", children: prompt.text }),
|
|
2076
|
+
prompt.description && /* @__PURE__ */ jsx15("p", { className: "text-xs !text-neutral-500 dark:!text-neutral-400 mt-1 line-clamp-2", children: prompt.description })
|
|
1969
2077
|
] })
|
|
1970
2078
|
] })
|
|
1971
2079
|
},
|
|
@@ -1976,7 +2084,7 @@ function WelcomeScreen({
|
|
|
1976
2084
|
}
|
|
1977
2085
|
|
|
1978
2086
|
// src/components/Chat/MessageList.tsx
|
|
1979
|
-
import { jsx as
|
|
2087
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1980
2088
|
function MessageList({
|
|
1981
2089
|
messages,
|
|
1982
2090
|
onAction,
|
|
@@ -2007,7 +2115,7 @@ function MessageList({
|
|
|
2007
2115
|
}
|
|
2008
2116
|
}
|
|
2009
2117
|
}, [messages]);
|
|
2010
|
-
return /* @__PURE__ */
|
|
2118
|
+
return /* @__PURE__ */ jsx16("div", { ref: listRef, className: "apteva-message-list apteva-scrollbar-hidden", onScroll: handleScroll, children: messages.length === 0 ? /* @__PURE__ */ jsx16(
|
|
2011
2119
|
WelcomeScreen,
|
|
2012
2120
|
{
|
|
2013
2121
|
title: welcomeTitle,
|
|
@@ -2018,12 +2126,12 @@ function MessageList({
|
|
|
2018
2126
|
onPromptClick: onPromptClick || (() => {
|
|
2019
2127
|
})
|
|
2020
2128
|
}
|
|
2021
|
-
) : messages.map((message) => /* @__PURE__ */
|
|
2129
|
+
) : messages.map((message) => /* @__PURE__ */ jsx16("div", { className: message.role === "user" ? "apteva-message-row-user" : "apteva-message-row-assistant", children: /* @__PURE__ */ jsx16(Message, { message, onAction, enableWidgets, onWidgetRender }) }, message.id)) });
|
|
2022
2130
|
}
|
|
2023
2131
|
|
|
2024
2132
|
// src/components/Chat/Composer.tsx
|
|
2025
2133
|
import { useState as useState4, useRef as useRef5 } from "react";
|
|
2026
|
-
import { Fragment as Fragment2, jsx as
|
|
2134
|
+
import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2027
2135
|
function Composer({ onSendMessage, placeholder = "Type a message...", disabled = false, isLoading = false, onStop, onFileUpload, onSwitchMode }) {
|
|
2028
2136
|
const [text, setText] = useState4("");
|
|
2029
2137
|
const [showMenu, setShowMenu] = useState4(false);
|
|
@@ -2097,56 +2205,56 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
|
|
|
2097
2205
|
};
|
|
2098
2206
|
const getFileIcon = (mimeType) => {
|
|
2099
2207
|
if (mimeType.startsWith("image/")) {
|
|
2100
|
-
return /* @__PURE__ */
|
|
2208
|
+
return /* @__PURE__ */ jsx17("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx17("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) });
|
|
2101
2209
|
}
|
|
2102
2210
|
if (mimeType === "application/pdf") {
|
|
2103
|
-
return /* @__PURE__ */
|
|
2211
|
+
return /* @__PURE__ */ jsx17("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx17("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" }) });
|
|
2104
2212
|
}
|
|
2105
|
-
return /* @__PURE__ */
|
|
2213
|
+
return /* @__PURE__ */ jsx17("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx17("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) });
|
|
2106
2214
|
};
|
|
2107
|
-
return /* @__PURE__ */
|
|
2108
|
-
fileError && /* @__PURE__ */
|
|
2109
|
-
/* @__PURE__ */
|
|
2110
|
-
/* @__PURE__ */
|
|
2215
|
+
return /* @__PURE__ */ jsxs13("div", { className: "px-4 py-3 relative", children: [
|
|
2216
|
+
fileError && /* @__PURE__ */ jsx17("div", { className: "absolute bottom-full left-4 right-4 mb-2 p-3 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg z-20", children: /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 !text-red-700 dark:!text-red-300 text-sm", children: [
|
|
2217
|
+
/* @__PURE__ */ jsx17("svg", { className: "w-4 h-4 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx17("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
2218
|
+
/* @__PURE__ */ jsx17("span", { children: fileError })
|
|
2111
2219
|
] }) }),
|
|
2112
|
-
pendingFiles.length > 0 && /* @__PURE__ */
|
|
2220
|
+
pendingFiles.length > 0 && /* @__PURE__ */ jsx17("div", { className: "mb-2 flex flex-wrap gap-2", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs13(
|
|
2113
2221
|
"div",
|
|
2114
2222
|
{
|
|
2115
2223
|
className: "relative group flex items-center gap-2 px-3 py-2 bg-neutral-100 dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg",
|
|
2116
2224
|
children: [
|
|
2117
|
-
pf.preview ? /* @__PURE__ */
|
|
2118
|
-
/* @__PURE__ */
|
|
2119
|
-
/* @__PURE__ */
|
|
2120
|
-
/* @__PURE__ */
|
|
2225
|
+
pf.preview ? /* @__PURE__ */ jsx17("img", { src: pf.preview, alt: pf.file.name, className: "w-8 h-8 object-cover rounded" }) : /* @__PURE__ */ jsx17("div", { className: "w-8 h-8 flex items-center justify-center bg-neutral-200 dark:bg-neutral-700 rounded !text-neutral-500 dark:!text-neutral-400", children: getFileIcon(pf.file.type) }),
|
|
2226
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-col min-w-0", children: [
|
|
2227
|
+
/* @__PURE__ */ jsx17("span", { className: "text-xs font-medium !text-neutral-700 dark:!text-neutral-300 truncate max-w-[120px]", children: pf.file.name }),
|
|
2228
|
+
/* @__PURE__ */ jsx17("span", { className: "text-xs !text-neutral-500 dark:!text-neutral-400", children: formatFileSize(pf.file.size) })
|
|
2121
2229
|
] }),
|
|
2122
|
-
/* @__PURE__ */
|
|
2230
|
+
/* @__PURE__ */ jsx17(
|
|
2123
2231
|
"button",
|
|
2124
2232
|
{
|
|
2125
2233
|
onClick: () => removeFile(index),
|
|
2126
2234
|
className: "absolute -top-1.5 -right-1.5 w-5 h-5 bg-neutral-500 hover:bg-red-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",
|
|
2127
2235
|
title: "Remove file",
|
|
2128
|
-
children: /* @__PURE__ */
|
|
2236
|
+
children: /* @__PURE__ */ jsx17("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx17("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
2129
2237
|
}
|
|
2130
2238
|
)
|
|
2131
2239
|
]
|
|
2132
2240
|
},
|
|
2133
2241
|
index
|
|
2134
2242
|
)) }),
|
|
2135
|
-
/* @__PURE__ */
|
|
2136
|
-
/* @__PURE__ */
|
|
2137
|
-
/* @__PURE__ */
|
|
2243
|
+
/* @__PURE__ */ jsxs13("div", { className: "apteva-composer relative border-2 border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-900 transition-all duration-300 flex items-center px-3 py-2 gap-3", children: [
|
|
2244
|
+
/* @__PURE__ */ jsxs13("div", { className: "relative flex-shrink-0", children: [
|
|
2245
|
+
/* @__PURE__ */ jsx17(
|
|
2138
2246
|
"button",
|
|
2139
2247
|
{
|
|
2140
2248
|
ref: menuButtonRef,
|
|
2141
2249
|
onClick: () => setShowMenu(!showMenu),
|
|
2142
2250
|
className: "apteva-composer-menu-btn w-8 h-8 rounded-lg flex items-center justify-center transition-all !text-neutral-700 dark:!text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-800",
|
|
2143
2251
|
title: "More options",
|
|
2144
|
-
children: /* @__PURE__ */
|
|
2252
|
+
children: /* @__PURE__ */ jsx17("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx17("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
2145
2253
|
}
|
|
2146
2254
|
),
|
|
2147
|
-
showMenu && /* @__PURE__ */
|
|
2148
|
-
/* @__PURE__ */
|
|
2149
|
-
/* @__PURE__ */
|
|
2255
|
+
showMenu && /* @__PURE__ */ jsxs13(Fragment2, { children: [
|
|
2256
|
+
/* @__PURE__ */ jsx17("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
|
|
2257
|
+
/* @__PURE__ */ jsxs13(
|
|
2150
2258
|
"div",
|
|
2151
2259
|
{
|
|
2152
2260
|
className: "apteva-composer-menu fixed bg-neutral-800 dark:bg-neutral-800 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
|
|
@@ -2155,7 +2263,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
|
|
|
2155
2263
|
top: (menuButtonRef.current?.getBoundingClientRect().bottom ?? 0) + 8
|
|
2156
2264
|
},
|
|
2157
2265
|
children: [
|
|
2158
|
-
/* @__PURE__ */
|
|
2266
|
+
/* @__PURE__ */ jsxs13(
|
|
2159
2267
|
"button",
|
|
2160
2268
|
{
|
|
2161
2269
|
onClick: () => {
|
|
@@ -2164,12 +2272,12 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
|
|
|
2164
2272
|
},
|
|
2165
2273
|
className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-neutral-700 dark:hover:bg-neutral-700 transition-colors !text-white text-left",
|
|
2166
2274
|
children: [
|
|
2167
|
-
/* @__PURE__ */
|
|
2168
|
-
/* @__PURE__ */
|
|
2275
|
+
/* @__PURE__ */ jsx17("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx17("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)" }) }),
|
|
2276
|
+
/* @__PURE__ */ jsx17("span", { className: "!text-sm font-medium", children: "Add photos & files" })
|
|
2169
2277
|
]
|
|
2170
2278
|
}
|
|
2171
2279
|
),
|
|
2172
|
-
onSwitchMode && /* @__PURE__ */
|
|
2280
|
+
onSwitchMode && /* @__PURE__ */ jsxs13(
|
|
2173
2281
|
"button",
|
|
2174
2282
|
{
|
|
2175
2283
|
onClick: () => {
|
|
@@ -2178,8 +2286,8 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
|
|
|
2178
2286
|
},
|
|
2179
2287
|
className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-neutral-700 dark:hover:bg-neutral-700 transition-colors !text-white text-left border-t border-neutral-700 dark:border-neutral-700",
|
|
2180
2288
|
children: [
|
|
2181
|
-
/* @__PURE__ */
|
|
2182
|
-
/* @__PURE__ */
|
|
2289
|
+
/* @__PURE__ */ jsx17("svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx17("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
|
|
2290
|
+
/* @__PURE__ */ jsx17("span", { className: "!text-sm font-medium", children: "Switch to command mode" })
|
|
2183
2291
|
]
|
|
2184
2292
|
}
|
|
2185
2293
|
)
|
|
@@ -2188,7 +2296,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
|
|
|
2188
2296
|
)
|
|
2189
2297
|
] })
|
|
2190
2298
|
] }),
|
|
2191
|
-
/* @__PURE__ */
|
|
2299
|
+
/* @__PURE__ */ jsx17(
|
|
2192
2300
|
"textarea",
|
|
2193
2301
|
{
|
|
2194
2302
|
ref: textareaRef,
|
|
@@ -2201,26 +2309,26 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
|
|
|
2201
2309
|
rows: 1
|
|
2202
2310
|
}
|
|
2203
2311
|
),
|
|
2204
|
-
isLoading && onStop ? /* @__PURE__ */
|
|
2312
|
+
isLoading && onStop ? /* @__PURE__ */ jsx17(
|
|
2205
2313
|
"button",
|
|
2206
2314
|
{
|
|
2207
2315
|
onClick: onStop,
|
|
2208
2316
|
className: "apteva-composer-stop-btn !w-8 !h-8 !rounded-lg !flex !items-center !justify-center !font-bold !transition-all !flex-shrink-0 !border !border-red-400 dark:!border-red-500 !bg-red-50 dark:!bg-red-900/30 !text-red-600 dark:!text-red-400 hover:!bg-red-100 dark:hover:!bg-red-900/50",
|
|
2209
2317
|
title: "Stop generation",
|
|
2210
|
-
children: /* @__PURE__ */
|
|
2318
|
+
children: /* @__PURE__ */ jsx17("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx17("rect", { x: "2", y: "2", width: "10", height: "10", rx: "1", fill: "currentColor" }) })
|
|
2211
2319
|
}
|
|
2212
|
-
) : /* @__PURE__ */
|
|
2320
|
+
) : /* @__PURE__ */ jsx17(
|
|
2213
2321
|
"button",
|
|
2214
2322
|
{
|
|
2215
2323
|
onClick: handleSend,
|
|
2216
2324
|
disabled: !text.trim() && pendingFiles.length === 0 || disabled,
|
|
2217
2325
|
className: "apteva-composer-send-btn w-8 h-8 rounded-lg flex items-center justify-center font-bold transition-all flex-shrink-0 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 !text-neutral-700 dark:!text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-700 disabled:opacity-30 disabled:cursor-not-allowed !text-lg",
|
|
2218
2326
|
title: "Send message",
|
|
2219
|
-
children: /* @__PURE__ */
|
|
2327
|
+
children: /* @__PURE__ */ jsx17("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx17("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
2220
2328
|
}
|
|
2221
2329
|
)
|
|
2222
2330
|
] }),
|
|
2223
|
-
/* @__PURE__ */
|
|
2331
|
+
/* @__PURE__ */ jsx17(
|
|
2224
2332
|
"input",
|
|
2225
2333
|
{
|
|
2226
2334
|
ref: fileInputRef,
|
|
@@ -2236,7 +2344,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
|
|
|
2236
2344
|
|
|
2237
2345
|
// src/components/Chat/CommandComposer.tsx
|
|
2238
2346
|
import { useState as useState5, useRef as useRef6 } from "react";
|
|
2239
|
-
import { Fragment as Fragment3, jsx as
|
|
2347
|
+
import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2240
2348
|
function CommandComposer({
|
|
2241
2349
|
onExecute,
|
|
2242
2350
|
state,
|
|
@@ -2326,12 +2434,12 @@ function CommandComposer({
|
|
|
2326
2434
|
};
|
|
2327
2435
|
const getFileIcon = (mimeType) => {
|
|
2328
2436
|
if (mimeType.startsWith("image/")) {
|
|
2329
|
-
return /* @__PURE__ */
|
|
2437
|
+
return /* @__PURE__ */ jsx18("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) });
|
|
2330
2438
|
}
|
|
2331
2439
|
if (mimeType === "application/pdf") {
|
|
2332
|
-
return /* @__PURE__ */
|
|
2440
|
+
return /* @__PURE__ */ jsx18("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" }) });
|
|
2333
2441
|
}
|
|
2334
|
-
return /* @__PURE__ */
|
|
2442
|
+
return /* @__PURE__ */ jsx18("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) });
|
|
2335
2443
|
};
|
|
2336
2444
|
const getDisplayContent = () => {
|
|
2337
2445
|
if (state === "loading") {
|
|
@@ -2356,12 +2464,12 @@ function CommandComposer({
|
|
|
2356
2464
|
};
|
|
2357
2465
|
const isShowingResult = state !== "idle";
|
|
2358
2466
|
const { text: displayContent, isToolCall } = getDisplayContent();
|
|
2359
|
-
return /* @__PURE__ */
|
|
2360
|
-
fileError && /* @__PURE__ */
|
|
2361
|
-
/* @__PURE__ */
|
|
2362
|
-
/* @__PURE__ */
|
|
2467
|
+
return /* @__PURE__ */ jsxs14("div", { className: "w-full relative", children: [
|
|
2468
|
+
fileError && /* @__PURE__ */ jsx18("div", { className: "absolute -top-12 left-0 right-0 mx-3 p-2 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg z-30", children: /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 !text-red-700 dark:!text-red-300 text-xs", children: [
|
|
2469
|
+
/* @__PURE__ */ jsx18("svg", { className: "w-3 h-3 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
2470
|
+
/* @__PURE__ */ jsx18("span", { children: fileError })
|
|
2363
2471
|
] }) }),
|
|
2364
|
-
/* @__PURE__ */
|
|
2472
|
+
/* @__PURE__ */ jsxs14(
|
|
2365
2473
|
"div",
|
|
2366
2474
|
{
|
|
2367
2475
|
className: cn(
|
|
@@ -2373,21 +2481,21 @@ function CommandComposer({
|
|
|
2373
2481
|
state === "error" && "border-red-400 dark:border-red-500"
|
|
2374
2482
|
),
|
|
2375
2483
|
children: [
|
|
2376
|
-
/* @__PURE__ */
|
|
2377
|
-
state === "idle" && /* @__PURE__ */
|
|
2378
|
-
/* @__PURE__ */
|
|
2484
|
+
/* @__PURE__ */ jsxs14("div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: [
|
|
2485
|
+
state === "idle" && /* @__PURE__ */ jsxs14("div", { className: "relative", children: [
|
|
2486
|
+
/* @__PURE__ */ jsx18(
|
|
2379
2487
|
"button",
|
|
2380
2488
|
{
|
|
2381
2489
|
ref: menuButtonRef,
|
|
2382
2490
|
onClick: () => setShowMenu(!showMenu),
|
|
2383
2491
|
className: "apteva-composer-menu-btn w-8 h-8 rounded-lg flex items-center justify-center transition-all !text-neutral-500 dark:!text-neutral-400 hover:!text-neutral-700 dark:hover:!text-neutral-200 hover:bg-neutral-100 dark:hover:bg-neutral-800",
|
|
2384
2492
|
title: "More options",
|
|
2385
|
-
children: /* @__PURE__ */
|
|
2493
|
+
children: /* @__PURE__ */ jsx18("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx18("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
2386
2494
|
}
|
|
2387
2495
|
),
|
|
2388
|
-
showMenu && /* @__PURE__ */
|
|
2389
|
-
/* @__PURE__ */
|
|
2390
|
-
/* @__PURE__ */
|
|
2496
|
+
showMenu && /* @__PURE__ */ jsxs14(Fragment3, { children: [
|
|
2497
|
+
/* @__PURE__ */ jsx18("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
|
|
2498
|
+
/* @__PURE__ */ jsxs14(
|
|
2391
2499
|
"div",
|
|
2392
2500
|
{
|
|
2393
2501
|
className: "apteva-composer-menu fixed bg-neutral-800 dark:bg-neutral-800 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
|
|
@@ -2396,7 +2504,7 @@ function CommandComposer({
|
|
|
2396
2504
|
top: (menuButtonRef.current?.getBoundingClientRect().bottom ?? 0) + 8
|
|
2397
2505
|
},
|
|
2398
2506
|
children: [
|
|
2399
|
-
/* @__PURE__ */
|
|
2507
|
+
/* @__PURE__ */ jsxs14(
|
|
2400
2508
|
"button",
|
|
2401
2509
|
{
|
|
2402
2510
|
onClick: () => {
|
|
@@ -2405,12 +2513,12 @@ function CommandComposer({
|
|
|
2405
2513
|
},
|
|
2406
2514
|
className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-neutral-700 dark:hover:bg-neutral-700 transition-colors !text-white text-left",
|
|
2407
2515
|
children: [
|
|
2408
|
-
/* @__PURE__ */
|
|
2409
|
-
/* @__PURE__ */
|
|
2516
|
+
/* @__PURE__ */ jsx18("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx18("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)" }) }),
|
|
2517
|
+
/* @__PURE__ */ jsx18("span", { className: "!text-sm font-medium", children: "Add photos & files" })
|
|
2410
2518
|
]
|
|
2411
2519
|
}
|
|
2412
2520
|
),
|
|
2413
|
-
onExpand && /* @__PURE__ */
|
|
2521
|
+
onExpand && /* @__PURE__ */ jsxs14(
|
|
2414
2522
|
"button",
|
|
2415
2523
|
{
|
|
2416
2524
|
onClick: () => {
|
|
@@ -2419,8 +2527,8 @@ function CommandComposer({
|
|
|
2419
2527
|
},
|
|
2420
2528
|
className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-neutral-700 dark:hover:bg-neutral-700 transition-colors !text-white text-left border-t border-neutral-700 dark:border-neutral-700",
|
|
2421
2529
|
children: [
|
|
2422
|
-
/* @__PURE__ */
|
|
2423
|
-
/* @__PURE__ */
|
|
2530
|
+
/* @__PURE__ */ jsx18("svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("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" }) }),
|
|
2531
|
+
/* @__PURE__ */ jsx18("span", { className: "!text-sm font-medium", children: "Expand to chat" })
|
|
2424
2532
|
]
|
|
2425
2533
|
}
|
|
2426
2534
|
)
|
|
@@ -2429,30 +2537,30 @@ function CommandComposer({
|
|
|
2429
2537
|
)
|
|
2430
2538
|
] })
|
|
2431
2539
|
] }),
|
|
2432
|
-
state === "loading" && !toolName && /* @__PURE__ */
|
|
2433
|
-
state === "loading" && toolName && /* @__PURE__ */
|
|
2540
|
+
state === "loading" && !toolName && /* @__PURE__ */ jsx18("div", { className: "w-4 h-4 border-2 border-blue-200 border-t-blue-500 rounded-full animate-spin" }),
|
|
2541
|
+
state === "loading" && toolName && /* @__PURE__ */ jsx18("div", { className: "w-2 h-2 rounded-full bg-blue-500 animate-pulse" })
|
|
2434
2542
|
] }),
|
|
2435
|
-
pendingFiles.length > 0 && state === "idle" && /* @__PURE__ */
|
|
2543
|
+
pendingFiles.length > 0 && state === "idle" && /* @__PURE__ */ jsx18("div", { className: "flex items-center gap-1 flex-shrink-0", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs14(
|
|
2436
2544
|
"div",
|
|
2437
2545
|
{
|
|
2438
2546
|
className: "relative group flex items-center justify-center w-6 h-6 bg-neutral-100 dark:bg-neutral-800 rounded overflow-hidden",
|
|
2439
2547
|
title: pf.file.name,
|
|
2440
2548
|
children: [
|
|
2441
|
-
pf.preview ? /* @__PURE__ */
|
|
2442
|
-
/* @__PURE__ */
|
|
2549
|
+
pf.preview ? /* @__PURE__ */ jsx18("img", { src: pf.preview, alt: pf.file.name, className: "w-6 h-6 object-cover" }) : /* @__PURE__ */ jsx18("span", { className: "text-xs !text-neutral-500 dark:!text-neutral-400", children: getFileIcon(pf.file.type) }),
|
|
2550
|
+
/* @__PURE__ */ jsx18(
|
|
2443
2551
|
"button",
|
|
2444
2552
|
{
|
|
2445
2553
|
onClick: () => removeFile(index),
|
|
2446
2554
|
className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity",
|
|
2447
2555
|
title: "Remove",
|
|
2448
|
-
children: /* @__PURE__ */
|
|
2556
|
+
children: /* @__PURE__ */ jsx18("svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
2449
2557
|
}
|
|
2450
2558
|
)
|
|
2451
2559
|
]
|
|
2452
2560
|
},
|
|
2453
2561
|
index
|
|
2454
2562
|
)) }),
|
|
2455
|
-
state === "idle" ? /* @__PURE__ */
|
|
2563
|
+
state === "idle" ? /* @__PURE__ */ jsx18(
|
|
2456
2564
|
"textarea",
|
|
2457
2565
|
{
|
|
2458
2566
|
ref: inputRef,
|
|
@@ -2470,7 +2578,7 @@ function CommandComposer({
|
|
|
2470
2578
|
),
|
|
2471
2579
|
style: { minHeight: "24px", maxHeight: "120px" }
|
|
2472
2580
|
}
|
|
2473
|
-
) : /* @__PURE__ */
|
|
2581
|
+
) : /* @__PURE__ */ jsx18(
|
|
2474
2582
|
"div",
|
|
2475
2583
|
{
|
|
2476
2584
|
className: cn(
|
|
@@ -2481,14 +2589,14 @@ function CommandComposer({
|
|
|
2481
2589
|
state === "error" && "!text-red-600 dark:!text-red-400",
|
|
2482
2590
|
state === "plan-pending" && "!text-amber-700 dark:!text-amber-300"
|
|
2483
2591
|
),
|
|
2484
|
-
children: isToolCall ? /* @__PURE__ */
|
|
2485
|
-
/* @__PURE__ */
|
|
2486
|
-
/* @__PURE__ */
|
|
2592
|
+
children: isToolCall ? /* @__PURE__ */ jsxs14(Fragment3, { children: [
|
|
2593
|
+
/* @__PURE__ */ jsx18("span", { className: "font-mono", children: displayContent }),
|
|
2594
|
+
/* @__PURE__ */ jsx18("span", { className: "text-neutral-400 dark:text-neutral-500", children: "Running..." })
|
|
2487
2595
|
] }) : displayContent
|
|
2488
2596
|
}
|
|
2489
2597
|
),
|
|
2490
|
-
/* @__PURE__ */
|
|
2491
|
-
/* @__PURE__ */
|
|
2598
|
+
/* @__PURE__ */ jsx18("div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: state === "plan-pending" ? /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1", children: [
|
|
2599
|
+
/* @__PURE__ */ jsx18(
|
|
2492
2600
|
"button",
|
|
2493
2601
|
{
|
|
2494
2602
|
onClick: onApprove,
|
|
@@ -2496,7 +2604,7 @@ function CommandComposer({
|
|
|
2496
2604
|
children: "Approve"
|
|
2497
2605
|
}
|
|
2498
2606
|
),
|
|
2499
|
-
/* @__PURE__ */
|
|
2607
|
+
/* @__PURE__ */ jsx18(
|
|
2500
2608
|
"button",
|
|
2501
2609
|
{
|
|
2502
2610
|
onClick: onReject,
|
|
@@ -2504,26 +2612,26 @@ function CommandComposer({
|
|
|
2504
2612
|
children: "Modify"
|
|
2505
2613
|
}
|
|
2506
2614
|
)
|
|
2507
|
-
] }) : /* @__PURE__ */
|
|
2508
|
-
state === "loading" && onStop && /* @__PURE__ */
|
|
2615
|
+
] }) : /* @__PURE__ */ jsxs14(Fragment3, { children: [
|
|
2616
|
+
state === "loading" && onStop && /* @__PURE__ */ jsx18(
|
|
2509
2617
|
"button",
|
|
2510
2618
|
{
|
|
2511
2619
|
onClick: onStop,
|
|
2512
2620
|
className: "apteva-composer-stop-btn !w-8 !h-8 !rounded-lg !flex !items-center !justify-center !transition-all !border !border-red-400 dark:!border-red-500 !bg-red-50 dark:!bg-red-900/30 !text-red-600 dark:!text-red-400 hover:!bg-red-100 dark:hover:!bg-red-900/50",
|
|
2513
2621
|
title: "Stop generation",
|
|
2514
|
-
children: /* @__PURE__ */
|
|
2622
|
+
children: /* @__PURE__ */ jsx18("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx18("rect", { x: "2", y: "2", width: "10", height: "10", rx: "1", fill: "currentColor" }) })
|
|
2515
2623
|
}
|
|
2516
2624
|
),
|
|
2517
|
-
(state === "success" || state === "error") && /* @__PURE__ */
|
|
2625
|
+
(state === "success" || state === "error") && /* @__PURE__ */ jsx18(
|
|
2518
2626
|
"button",
|
|
2519
2627
|
{
|
|
2520
2628
|
onClick: handleNewCommand,
|
|
2521
2629
|
className: "w-8 h-8 rounded-lg flex items-center justify-center !text-neutral-400 hover:!text-neutral-600 dark:hover:!text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-800 transition-colors",
|
|
2522
2630
|
title: "New command",
|
|
2523
|
-
children: /* @__PURE__ */
|
|
2631
|
+
children: /* @__PURE__ */ jsx18("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
2524
2632
|
}
|
|
2525
2633
|
),
|
|
2526
|
-
state === "idle" && /* @__PURE__ */
|
|
2634
|
+
state === "idle" && /* @__PURE__ */ jsx18(
|
|
2527
2635
|
"button",
|
|
2528
2636
|
{
|
|
2529
2637
|
onClick: handleSubmit,
|
|
@@ -2535,14 +2643,14 @@ function CommandComposer({
|
|
|
2535
2643
|
input.trim() || pendingFiles.length > 0 ? "bg-neutral-900 dark:bg-white !text-white dark:!text-neutral-900 border-neutral-900 dark:border-white" : "bg-white dark:bg-neutral-800 !text-neutral-400"
|
|
2536
2644
|
),
|
|
2537
2645
|
title: "Execute command",
|
|
2538
|
-
children: /* @__PURE__ */
|
|
2646
|
+
children: /* @__PURE__ */ jsx18("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 12h14M12 5l7 7-7 7" }) })
|
|
2539
2647
|
}
|
|
2540
2648
|
)
|
|
2541
2649
|
] }) })
|
|
2542
2650
|
]
|
|
2543
2651
|
}
|
|
2544
2652
|
),
|
|
2545
|
-
/* @__PURE__ */
|
|
2653
|
+
/* @__PURE__ */ jsx18(
|
|
2546
2654
|
"input",
|
|
2547
2655
|
{
|
|
2548
2656
|
ref: fileInputRef,
|
|
@@ -2742,7 +2850,7 @@ var AptevaClient = class {
|
|
|
2742
2850
|
var aptevaClient = new AptevaClient();
|
|
2743
2851
|
|
|
2744
2852
|
// src/components/Chat/Chat.tsx
|
|
2745
|
-
import { Fragment as Fragment4, jsx as
|
|
2853
|
+
import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2746
2854
|
var Chat = forwardRef(function Chat2({
|
|
2747
2855
|
agentId,
|
|
2748
2856
|
threadId,
|
|
@@ -3346,16 +3454,16 @@ ${planToExecute}`;
|
|
|
3346
3454
|
setCurrentRequestId(null);
|
|
3347
3455
|
};
|
|
3348
3456
|
const isCompact = commandVariant === "compact";
|
|
3349
|
-
return /* @__PURE__ */
|
|
3350
|
-
showHeader && mode === "chat" && /* @__PURE__ */
|
|
3351
|
-
/* @__PURE__ */
|
|
3352
|
-
/* @__PURE__ */
|
|
3457
|
+
return /* @__PURE__ */ jsxs15("div", { className: cn("apteva-chat flex flex-col h-full", className), children: [
|
|
3458
|
+
showHeader && mode === "chat" && /* @__PURE__ */ jsx19("div", { className: "apteva-chat-header px-4 py-3 flex items-center justify-between", children: /* @__PURE__ */ jsxs15("div", { children: [
|
|
3459
|
+
/* @__PURE__ */ jsx19("div", { className: "apteva-chat-title", children: headerTitle }),
|
|
3460
|
+
/* @__PURE__ */ jsx19("div", { className: cn(
|
|
3353
3461
|
"apteva-chat-status",
|
|
3354
3462
|
isLoading ? chatToolName ? "apteva-chat-status-tool" : "apteva-chat-status-thinking" : "apteva-chat-status-ready"
|
|
3355
3463
|
), children: isLoading ? chatToolName ? `Using ${chatToolName}...` : "Thinking..." : "Ready" })
|
|
3356
3464
|
] }) }),
|
|
3357
|
-
mode === "chat" && /* @__PURE__ */
|
|
3358
|
-
/* @__PURE__ */
|
|
3465
|
+
mode === "chat" && /* @__PURE__ */ jsxs15(Fragment4, { children: [
|
|
3466
|
+
/* @__PURE__ */ jsx19(
|
|
3359
3467
|
MessageList,
|
|
3360
3468
|
{
|
|
3361
3469
|
messages,
|
|
@@ -3370,7 +3478,7 @@ ${planToExecute}`;
|
|
|
3370
3478
|
onWidgetRender
|
|
3371
3479
|
}
|
|
3372
3480
|
),
|
|
3373
|
-
/* @__PURE__ */
|
|
3481
|
+
/* @__PURE__ */ jsx19(
|
|
3374
3482
|
Composer,
|
|
3375
3483
|
{
|
|
3376
3484
|
onSendMessage: handleSendMessage,
|
|
@@ -3383,7 +3491,7 @@ ${planToExecute}`;
|
|
|
3383
3491
|
}
|
|
3384
3492
|
)
|
|
3385
3493
|
] }),
|
|
3386
|
-
mode === "command" && /* @__PURE__ */
|
|
3494
|
+
mode === "command" && /* @__PURE__ */ jsx19("div", { className: "w-full", children: /* @__PURE__ */ jsx19(
|
|
3387
3495
|
CommandComposer,
|
|
3388
3496
|
{
|
|
3389
3497
|
onExecute: (text, files) => {
|
|
@@ -3404,7 +3512,7 @@ ${planToExecute}`;
|
|
|
3404
3512
|
placeholder: placeholder || "Enter your command..."
|
|
3405
3513
|
}
|
|
3406
3514
|
) }),
|
|
3407
|
-
/* @__PURE__ */
|
|
3515
|
+
/* @__PURE__ */ jsx19("style", { dangerouslySetInnerHTML: {
|
|
3408
3516
|
__html: `
|
|
3409
3517
|
@keyframes pulse-border {
|
|
3410
3518
|
0%, 100% { border-color: rgb(59, 130, 246); }
|
|
@@ -3423,11 +3531,11 @@ ${planToExecute}`;
|
|
|
3423
3531
|
|
|
3424
3532
|
// src/components/Chat/CommandOutput.tsx
|
|
3425
3533
|
import { useState as useState7 } from "react";
|
|
3426
|
-
import { jsx as
|
|
3534
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3427
3535
|
|
|
3428
3536
|
// src/components/Command/Command.tsx
|
|
3429
3537
|
import React, { useState as useState8, useEffect as useEffect7 } from "react";
|
|
3430
|
-
import { Fragment as Fragment5, jsx as
|
|
3538
|
+
import { Fragment as Fragment5, jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3431
3539
|
function Command({
|
|
3432
3540
|
agentId,
|
|
3433
3541
|
command: initialCommand,
|
|
@@ -3877,7 +3985,7 @@ ${planToExecute}`;
|
|
|
3877
3985
|
setUploadedFiles((prev) => prev.filter((_, i) => i !== index));
|
|
3878
3986
|
};
|
|
3879
3987
|
const isCompact = variant === "compact";
|
|
3880
|
-
return /* @__PURE__ */
|
|
3988
|
+
return /* @__PURE__ */ jsxs17(
|
|
3881
3989
|
"div",
|
|
3882
3990
|
{
|
|
3883
3991
|
className: cn(
|
|
@@ -3892,9 +4000,9 @@ ${planToExecute}`;
|
|
|
3892
4000
|
),
|
|
3893
4001
|
style: { minHeight: isCompact ? "auto" : "180px" },
|
|
3894
4002
|
children: [
|
|
3895
|
-
/* @__PURE__ */
|
|
3896
|
-
state === "idle" && allowInput && !isCompact && /* @__PURE__ */
|
|
3897
|
-
/* @__PURE__ */
|
|
4003
|
+
/* @__PURE__ */ jsxs17("div", { className: cn("flex-1 flex", isCompact ? "flex-row items-center p-3 gap-3" : "flex-col p-4"), children: [
|
|
4004
|
+
state === "idle" && allowInput && !isCompact && /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
4005
|
+
/* @__PURE__ */ jsx21(
|
|
3898
4006
|
"textarea",
|
|
3899
4007
|
{
|
|
3900
4008
|
value: command,
|
|
@@ -3910,42 +4018,42 @@ ${planToExecute}`;
|
|
|
3910
4018
|
rows: 6
|
|
3911
4019
|
}
|
|
3912
4020
|
),
|
|
3913
|
-
uploadedFiles.length > 0 && /* @__PURE__ */
|
|
3914
|
-
file.type === "image" ? /* @__PURE__ */
|
|
4021
|
+
uploadedFiles.length > 0 && /* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-2 mt-2", children: uploadedFiles.map((file, index) => /* @__PURE__ */ jsxs17("div", { className: "relative group", children: [
|
|
4022
|
+
file.type === "image" ? /* @__PURE__ */ jsx21(
|
|
3915
4023
|
"img",
|
|
3916
4024
|
{
|
|
3917
4025
|
src: file.preview,
|
|
3918
4026
|
alt: file.name,
|
|
3919
4027
|
className: "w-20 h-20 object-cover rounded-lg border-2 border-neutral-300 dark:border-neutral-600"
|
|
3920
4028
|
}
|
|
3921
|
-
) : /* @__PURE__ */
|
|
3922
|
-
/* @__PURE__ */
|
|
3923
|
-
/* @__PURE__ */
|
|
4029
|
+
) : /* @__PURE__ */ jsxs17("div", { className: "w-20 h-20 flex flex-col items-center justify-center rounded-lg border-2 border-neutral-300 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-800", children: [
|
|
4030
|
+
/* @__PURE__ */ jsx21("svg", { className: "w-8 h-8 text-neutral-500 dark:text-neutral-400", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx21("path", { fillRule: "evenodd", d: "M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z", clipRule: "evenodd" }) }),
|
|
4031
|
+
/* @__PURE__ */ jsx21("span", { className: "text-[8px] text-neutral-500 dark:text-neutral-400 mt-1 px-1 truncate max-w-full", children: file.name.length > 12 ? file.name.slice(0, 12) + "..." : file.name })
|
|
3924
4032
|
] }),
|
|
3925
|
-
/* @__PURE__ */
|
|
4033
|
+
/* @__PURE__ */ jsx21(
|
|
3926
4034
|
"button",
|
|
3927
4035
|
{
|
|
3928
4036
|
onClick: () => removeFile(index),
|
|
3929
4037
|
className: "absolute -top-2 -right-2 w-6 h-6 bg-red-500 hover:bg-red-600 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",
|
|
3930
4038
|
title: `Remove ${file.type}`,
|
|
3931
|
-
children: /* @__PURE__ */
|
|
4039
|
+
children: /* @__PURE__ */ jsx21("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
3932
4040
|
}
|
|
3933
4041
|
)
|
|
3934
4042
|
] }, index)) })
|
|
3935
4043
|
] }),
|
|
3936
|
-
state === "idle" && allowInput && isCompact && /* @__PURE__ */
|
|
3937
|
-
/* @__PURE__ */
|
|
3938
|
-
enableFileUpload && /* @__PURE__ */
|
|
4044
|
+
state === "idle" && allowInput && isCompact && /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
4045
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-0.5 flex-shrink-0", children: [
|
|
4046
|
+
enableFileUpload && /* @__PURE__ */ jsx21(
|
|
3939
4047
|
"button",
|
|
3940
4048
|
{
|
|
3941
4049
|
onClick: () => fileInputRef.current?.click(),
|
|
3942
4050
|
className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-neutral-500 dark:!text-neutral-500 hover:bg-neutral-100 dark:hover:bg-neutral-800",
|
|
3943
4051
|
title: "Attach file",
|
|
3944
|
-
children: /* @__PURE__ */
|
|
4052
|
+
children: /* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("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)" }) })
|
|
3945
4053
|
}
|
|
3946
4054
|
),
|
|
3947
|
-
planMode && /* @__PURE__ */
|
|
3948
|
-
/* @__PURE__ */
|
|
4055
|
+
planMode && /* @__PURE__ */ jsxs17("div", { className: "relative settings-menu-container", children: [
|
|
4056
|
+
/* @__PURE__ */ jsx21(
|
|
3949
4057
|
"button",
|
|
3950
4058
|
{
|
|
3951
4059
|
onClick: () => setShowSettingsMenu(!showSettingsMenu),
|
|
@@ -3954,28 +4062,28 @@ ${planToExecute}`;
|
|
|
3954
4062
|
internalPlanMode ? "!text-blue-600 dark:!text-blue-400" : "!text-neutral-500 dark:!text-neutral-500"
|
|
3955
4063
|
),
|
|
3956
4064
|
title: "Settings",
|
|
3957
|
-
children: /* @__PURE__ */
|
|
3958
|
-
/* @__PURE__ */
|
|
3959
|
-
/* @__PURE__ */
|
|
3960
|
-
/* @__PURE__ */
|
|
3961
|
-
/* @__PURE__ */
|
|
3962
|
-
/* @__PURE__ */
|
|
3963
|
-
/* @__PURE__ */
|
|
3964
|
-
/* @__PURE__ */
|
|
3965
|
-
/* @__PURE__ */
|
|
3966
|
-
/* @__PURE__ */
|
|
4065
|
+
children: /* @__PURE__ */ jsxs17("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
4066
|
+
/* @__PURE__ */ jsx21("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
|
|
4067
|
+
/* @__PURE__ */ jsx21("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
|
|
4068
|
+
/* @__PURE__ */ jsx21("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
|
|
4069
|
+
/* @__PURE__ */ jsx21("line", { x1: "12", y1: "8", x2: "12", y2: "3" }),
|
|
4070
|
+
/* @__PURE__ */ jsx21("line", { x1: "20", y1: "21", x2: "20", y2: "16" }),
|
|
4071
|
+
/* @__PURE__ */ jsx21("line", { x1: "20", y1: "12", x2: "20", y2: "3" }),
|
|
4072
|
+
/* @__PURE__ */ jsx21("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
|
|
4073
|
+
/* @__PURE__ */ jsx21("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
|
|
4074
|
+
/* @__PURE__ */ jsx21("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
|
|
3967
4075
|
] })
|
|
3968
4076
|
}
|
|
3969
4077
|
),
|
|
3970
|
-
showSettingsMenu && /* @__PURE__ */
|
|
3971
|
-
/* @__PURE__ */
|
|
3972
|
-
/* @__PURE__ */
|
|
3973
|
-
/* @__PURE__ */
|
|
3974
|
-
/* @__PURE__ */
|
|
3975
|
-
/* @__PURE__ */
|
|
4078
|
+
showSettingsMenu && /* @__PURE__ */ jsx21("div", { className: "absolute top-10 left-0 z-50 w-56 bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg shadow-lg p-2.5 settings-menu-container", children: /* @__PURE__ */ jsxs17("label", { className: "flex items-center justify-between cursor-pointer group", children: [
|
|
4079
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
4080
|
+
/* @__PURE__ */ jsx21("svg", { className: "w-3.5 h-3.5 text-neutral-500 dark:text-neutral-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
|
|
4081
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
4082
|
+
/* @__PURE__ */ jsx21("div", { className: "text-xs font-medium text-neutral-700 dark:text-neutral-300", children: "Plan Mode" }),
|
|
4083
|
+
/* @__PURE__ */ jsx21("div", { className: "text-[10px] text-neutral-500 dark:text-neutral-400", children: "Review first" })
|
|
3976
4084
|
] })
|
|
3977
4085
|
] }),
|
|
3978
|
-
/* @__PURE__ */
|
|
4086
|
+
/* @__PURE__ */ jsx21(
|
|
3979
4087
|
"button",
|
|
3980
4088
|
{
|
|
3981
4089
|
onClick: (e) => {
|
|
@@ -3987,7 +4095,7 @@ ${planToExecute}`;
|
|
|
3987
4095
|
internalPlanMode ? "bg-blue-600" : "bg-neutral-300 dark:bg-neutral-600"
|
|
3988
4096
|
),
|
|
3989
4097
|
type: "button",
|
|
3990
|
-
children: /* @__PURE__ */
|
|
4098
|
+
children: /* @__PURE__ */ jsx21(
|
|
3991
4099
|
"span",
|
|
3992
4100
|
{
|
|
3993
4101
|
className: cn(
|
|
@@ -4001,26 +4109,26 @@ ${planToExecute}`;
|
|
|
4001
4109
|
] }) })
|
|
4002
4110
|
] })
|
|
4003
4111
|
] }),
|
|
4004
|
-
uploadedFiles.length > 0 && /* @__PURE__ */
|
|
4005
|
-
file.type === "image" ? /* @__PURE__ */
|
|
4112
|
+
uploadedFiles.length > 0 && /* @__PURE__ */ jsx21("div", { className: "flex gap-1 flex-shrink-0", children: uploadedFiles.map((file, index) => /* @__PURE__ */ jsxs17("div", { className: "relative group", children: [
|
|
4113
|
+
file.type === "image" ? /* @__PURE__ */ jsx21(
|
|
4006
4114
|
"img",
|
|
4007
4115
|
{
|
|
4008
4116
|
src: file.preview,
|
|
4009
4117
|
alt: file.name,
|
|
4010
4118
|
className: "w-8 h-8 object-cover rounded border border-neutral-300 dark:border-neutral-600"
|
|
4011
4119
|
}
|
|
4012
|
-
) : /* @__PURE__ */
|
|
4013
|
-
/* @__PURE__ */
|
|
4120
|
+
) : /* @__PURE__ */ jsx21("div", { className: "w-8 h-8 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-800", title: file.name, children: /* @__PURE__ */ jsx21("svg", { className: "w-4 h-4 text-neutral-500 dark:text-neutral-400", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx21("path", { fillRule: "evenodd", d: "M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z", clipRule: "evenodd" }) }) }),
|
|
4121
|
+
/* @__PURE__ */ jsx21(
|
|
4014
4122
|
"button",
|
|
4015
4123
|
{
|
|
4016
4124
|
onClick: () => removeFile(index),
|
|
4017
4125
|
className: "absolute -top-1 -right-1 w-4 h-4 bg-red-500 hover:bg-red-600 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",
|
|
4018
4126
|
title: "Remove",
|
|
4019
|
-
children: /* @__PURE__ */
|
|
4127
|
+
children: /* @__PURE__ */ jsx21("svg", { className: "w-2.5 h-2.5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 3, children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
|
|
4020
4128
|
}
|
|
4021
4129
|
)
|
|
4022
4130
|
] }, index)) }),
|
|
4023
|
-
/* @__PURE__ */
|
|
4131
|
+
/* @__PURE__ */ jsx21(
|
|
4024
4132
|
"input",
|
|
4025
4133
|
{
|
|
4026
4134
|
type: "text",
|
|
@@ -4036,7 +4144,7 @@ ${planToExecute}`;
|
|
|
4036
4144
|
className: "flex-1 bg-transparent border-none focus:outline-none !text-neutral-900 dark:!text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 py-1"
|
|
4037
4145
|
}
|
|
4038
4146
|
),
|
|
4039
|
-
/* @__PURE__ */
|
|
4147
|
+
/* @__PURE__ */ jsx21(
|
|
4040
4148
|
"button",
|
|
4041
4149
|
{
|
|
4042
4150
|
onClick: () => executeCommand(),
|
|
@@ -4052,33 +4160,33 @@ ${planToExecute}`;
|
|
|
4052
4160
|
!command.trim() && "border-neutral-200 dark:border-neutral-700 !text-neutral-400 dark:!text-neutral-600"
|
|
4053
4161
|
),
|
|
4054
4162
|
title: "Execute",
|
|
4055
|
-
children: /* @__PURE__ */
|
|
4163
|
+
children: /* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
4056
4164
|
}
|
|
4057
4165
|
)
|
|
4058
4166
|
] }),
|
|
4059
|
-
state === "loading" && !isCompact && /* @__PURE__ */
|
|
4060
|
-
/* @__PURE__ */
|
|
4061
|
-
/* @__PURE__ */
|
|
4062
|
-
showProgress && /* @__PURE__ */
|
|
4063
|
-
/* @__PURE__ */
|
|
4167
|
+
state === "loading" && !isCompact && /* @__PURE__ */ jsxs17("div", { className: "flex-1 flex flex-col items-center justify-center space-y-4 py-8", children: [
|
|
4168
|
+
/* @__PURE__ */ jsx21("div", { className: "w-6 h-6 border-2 border-neutral-300 border-t-blue-500 rounded-full animate-spin" }),
|
|
4169
|
+
/* @__PURE__ */ jsx21("div", { className: "text-neutral-600 dark:text-neutral-400 text-sm text-center max-w-md", children: enableStreaming && streamedContent ? streamedContent : loadingText }),
|
|
4170
|
+
showProgress && /* @__PURE__ */ jsxs17("div", { className: "w-full max-w-sm", children: [
|
|
4171
|
+
/* @__PURE__ */ jsx21("div", { className: "w-full bg-neutral-200 dark:bg-neutral-700 rounded-full h-1.5", children: /* @__PURE__ */ jsx21(
|
|
4064
4172
|
"div",
|
|
4065
4173
|
{
|
|
4066
4174
|
className: "bg-blue-500 h-1.5 rounded-full transition-all duration-300",
|
|
4067
4175
|
style: { width: `${progress}%` }
|
|
4068
4176
|
}
|
|
4069
4177
|
) }),
|
|
4070
|
-
/* @__PURE__ */
|
|
4178
|
+
/* @__PURE__ */ jsxs17("p", { className: "text-xs text-neutral-500 mt-2 text-center", children: [
|
|
4071
4179
|
progress,
|
|
4072
4180
|
"%"
|
|
4073
4181
|
] })
|
|
4074
4182
|
] })
|
|
4075
4183
|
] }),
|
|
4076
|
-
state === "loading" && isCompact && /* @__PURE__ */
|
|
4077
|
-
/* @__PURE__ */
|
|
4078
|
-
/* @__PURE__ */
|
|
4079
|
-
/* @__PURE__ */
|
|
4184
|
+
state === "loading" && isCompact && /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
4185
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 flex items-center gap-3 py-1", children: [
|
|
4186
|
+
/* @__PURE__ */ jsx21("div", { className: "w-4 h-4 border-2 border-neutral-300 border-t-blue-500 rounded-full animate-spin" }),
|
|
4187
|
+
/* @__PURE__ */ jsx21("div", { className: "text-neutral-600 dark:text-neutral-400 text-sm truncate", children: enableStreaming && streamedContent ? streamedContent : loadingText })
|
|
4080
4188
|
] }),
|
|
4081
|
-
/* @__PURE__ */
|
|
4189
|
+
/* @__PURE__ */ jsx21(
|
|
4082
4190
|
"button",
|
|
4083
4191
|
{
|
|
4084
4192
|
disabled: true,
|
|
@@ -4090,20 +4198,20 @@ ${planToExecute}`;
|
|
|
4090
4198
|
"!text-lg",
|
|
4091
4199
|
"opacity-30 cursor-not-allowed"
|
|
4092
4200
|
),
|
|
4093
|
-
children: /* @__PURE__ */
|
|
4201
|
+
children: /* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
4094
4202
|
}
|
|
4095
4203
|
)
|
|
4096
4204
|
] }),
|
|
4097
|
-
state === "plan-pending" && !isCompact && /* @__PURE__ */
|
|
4098
|
-
/* @__PURE__ */
|
|
4099
|
-
/* @__PURE__ */
|
|
4100
|
-
/* @__PURE__ */
|
|
4101
|
-
/* @__PURE__ */
|
|
4102
|
-
/* @__PURE__ */
|
|
4205
|
+
state === "plan-pending" && !isCompact && /* @__PURE__ */ jsx21("div", { className: "flex-1 flex flex-col", children: /* @__PURE__ */ jsxs17("div", { className: "mb-4 p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg", children: [
|
|
4206
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-start gap-2 mb-3", children: [
|
|
4207
|
+
/* @__PURE__ */ jsx21("svg", { className: "w-5 h-5 text-blue-600 dark:text-blue-400 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
|
|
4208
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1", children: [
|
|
4209
|
+
/* @__PURE__ */ jsx21("h3", { className: "text-sm font-semibold text-blue-800 dark:text-blue-300 mb-1", children: "Proposed Plan" }),
|
|
4210
|
+
/* @__PURE__ */ jsx21("div", { className: "text-blue-700 dark:text-blue-300 text-sm whitespace-pre-line leading-relaxed", children: plan })
|
|
4103
4211
|
] })
|
|
4104
4212
|
] }),
|
|
4105
|
-
/* @__PURE__ */
|
|
4106
|
-
/* @__PURE__ */
|
|
4213
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex gap-2 mt-4", children: [
|
|
4214
|
+
/* @__PURE__ */ jsx21(
|
|
4107
4215
|
"button",
|
|
4108
4216
|
{
|
|
4109
4217
|
onClick: approvePlan,
|
|
@@ -4111,7 +4219,7 @@ ${planToExecute}`;
|
|
|
4111
4219
|
children: "Approve & Execute"
|
|
4112
4220
|
}
|
|
4113
4221
|
),
|
|
4114
|
-
/* @__PURE__ */
|
|
4222
|
+
/* @__PURE__ */ jsx21(
|
|
4115
4223
|
"button",
|
|
4116
4224
|
{
|
|
4117
4225
|
onClick: rejectPlan,
|
|
@@ -4121,20 +4229,20 @@ ${planToExecute}`;
|
|
|
4121
4229
|
)
|
|
4122
4230
|
] })
|
|
4123
4231
|
] }) }),
|
|
4124
|
-
state === "plan-pending" && isCompact && /* @__PURE__ */
|
|
4125
|
-
/* @__PURE__ */
|
|
4232
|
+
state === "plan-pending" && isCompact && /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
4233
|
+
/* @__PURE__ */ jsxs17(
|
|
4126
4234
|
"button",
|
|
4127
4235
|
{
|
|
4128
4236
|
onClick: () => setShowPlanDetails(true),
|
|
4129
4237
|
className: "flex-1 flex items-center gap-2 px-3 py-2 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/40 border border-blue-200 dark:border-blue-800 rounded-lg transition-colors",
|
|
4130
4238
|
children: [
|
|
4131
|
-
/* @__PURE__ */
|
|
4132
|
-
/* @__PURE__ */
|
|
4239
|
+
/* @__PURE__ */ jsx21("svg", { className: "w-4 h-4 text-blue-600 dark:text-blue-400 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
|
|
4240
|
+
/* @__PURE__ */ jsx21("span", { className: "text-sm font-medium text-blue-700 dark:text-blue-300 truncate flex-1", children: "View Execution Plan" })
|
|
4133
4241
|
]
|
|
4134
4242
|
}
|
|
4135
4243
|
),
|
|
4136
|
-
/* @__PURE__ */
|
|
4137
|
-
/* @__PURE__ */
|
|
4244
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex gap-2 flex-shrink-0", children: [
|
|
4245
|
+
/* @__PURE__ */ jsx21(
|
|
4138
4246
|
"button",
|
|
4139
4247
|
{
|
|
4140
4248
|
onClick: approvePlan,
|
|
@@ -4142,7 +4250,7 @@ ${planToExecute}`;
|
|
|
4142
4250
|
children: "Approve"
|
|
4143
4251
|
}
|
|
4144
4252
|
),
|
|
4145
|
-
/* @__PURE__ */
|
|
4253
|
+
/* @__PURE__ */ jsx21(
|
|
4146
4254
|
"button",
|
|
4147
4255
|
{
|
|
4148
4256
|
onClick: rejectPlan,
|
|
@@ -4152,15 +4260,15 @@ ${planToExecute}`;
|
|
|
4152
4260
|
)
|
|
4153
4261
|
] })
|
|
4154
4262
|
] }),
|
|
4155
|
-
state === "error" && /* @__PURE__ */
|
|
4156
|
-
/* @__PURE__ */
|
|
4157
|
-
/* @__PURE__ */
|
|
4158
|
-
/* @__PURE__ */
|
|
4159
|
-
/* @__PURE__ */
|
|
4160
|
-
/* @__PURE__ */
|
|
4263
|
+
state === "error" && /* @__PURE__ */ jsxs17("div", { className: "flex-1 flex flex-col", children: [
|
|
4264
|
+
/* @__PURE__ */ jsx21("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__ */ jsxs17("div", { className: "flex items-start gap-2", children: [
|
|
4265
|
+
/* @__PURE__ */ jsx21("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__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
4266
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
4267
|
+
/* @__PURE__ */ jsx21("h3", { className: "text-sm font-semibold text-red-800 dark:text-red-400", children: "Error" }),
|
|
4268
|
+
/* @__PURE__ */ jsx21("p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: error?.message })
|
|
4161
4269
|
] })
|
|
4162
4270
|
] }) }),
|
|
4163
|
-
allowInput && /* @__PURE__ */
|
|
4271
|
+
allowInput && /* @__PURE__ */ jsx21(
|
|
4164
4272
|
"textarea",
|
|
4165
4273
|
{
|
|
4166
4274
|
value: command,
|
|
@@ -4177,16 +4285,16 @@ ${planToExecute}`;
|
|
|
4177
4285
|
}
|
|
4178
4286
|
)
|
|
4179
4287
|
] }),
|
|
4180
|
-
state === "success" && result && !isCompact && /* @__PURE__ */
|
|
4181
|
-
/* @__PURE__ */
|
|
4182
|
-
/* @__PURE__ */
|
|
4183
|
-
/* @__PURE__ */
|
|
4184
|
-
/* @__PURE__ */
|
|
4185
|
-
/* @__PURE__ */
|
|
4288
|
+
state === "success" && result && !isCompact && /* @__PURE__ */ jsx21("div", { className: "flex-1 overflow-auto", children: resultRenderer ? resultRenderer(result.data) : /* @__PURE__ */ jsxs17("div", { className: "space-y-4", children: [
|
|
4289
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-start gap-3 p-3 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg", children: [
|
|
4290
|
+
/* @__PURE__ */ jsx21("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__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
4291
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1", children: [
|
|
4292
|
+
/* @__PURE__ */ jsx21("h3", { className: "text-sm font-semibold text-green-800 dark:text-green-400 mb-1", children: "Success" }),
|
|
4293
|
+
/* @__PURE__ */ jsx21("p", { className: "text-green-700 dark:text-green-300 text-sm", children: "Command executed successfully" })
|
|
4186
4294
|
] })
|
|
4187
4295
|
] }),
|
|
4188
|
-
result.data?.summary && /* @__PURE__ */
|
|
4189
|
-
result.widgets && result.widgets.length > 0 && /* @__PURE__ */
|
|
4296
|
+
result.data?.summary && /* @__PURE__ */ jsx21("div", { className: "text-neutral-700 dark:text-neutral-300 text-sm leading-relaxed whitespace-pre-line", children: result.data.summary }),
|
|
4297
|
+
result.widgets && result.widgets.length > 0 && /* @__PURE__ */ jsx21("div", { className: "space-y-3", children: result.widgets.map((widget) => /* @__PURE__ */ jsx21(
|
|
4190
4298
|
WidgetRenderer,
|
|
4191
4299
|
{
|
|
4192
4300
|
widget,
|
|
@@ -4195,8 +4303,8 @@ ${planToExecute}`;
|
|
|
4195
4303
|
widget.id
|
|
4196
4304
|
)) })
|
|
4197
4305
|
] }) }),
|
|
4198
|
-
state === "success" && result && isCompact && /* @__PURE__ */
|
|
4199
|
-
/* @__PURE__ */
|
|
4306
|
+
state === "success" && result && isCompact && /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
4307
|
+
/* @__PURE__ */ jsxs17(
|
|
4200
4308
|
"div",
|
|
4201
4309
|
{
|
|
4202
4310
|
className: "flex-1 flex items-center gap-2 py-1 cursor-text min-w-0",
|
|
@@ -4205,12 +4313,12 @@ ${planToExecute}`;
|
|
|
4205
4313
|
setResult(null);
|
|
4206
4314
|
},
|
|
4207
4315
|
children: [
|
|
4208
|
-
/* @__PURE__ */
|
|
4209
|
-
/* @__PURE__ */
|
|
4316
|
+
/* @__PURE__ */ jsx21("svg", { className: "w-4 h-4 text-green-600 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
4317
|
+
/* @__PURE__ */ jsx21("div", { className: "text-green-700 dark:text-green-300 text-sm truncate flex-1 min-w-0", children: resultRenderer ? resultRenderer(result.data) : result.message || "Command executed successfully" })
|
|
4210
4318
|
]
|
|
4211
4319
|
}
|
|
4212
4320
|
),
|
|
4213
|
-
/* @__PURE__ */
|
|
4321
|
+
/* @__PURE__ */ jsx21(
|
|
4214
4322
|
"button",
|
|
4215
4323
|
{
|
|
4216
4324
|
onClick: () => {
|
|
@@ -4226,24 +4334,24 @@ ${planToExecute}`;
|
|
|
4226
4334
|
"!text-lg"
|
|
4227
4335
|
),
|
|
4228
4336
|
title: "New command",
|
|
4229
|
-
children: /* @__PURE__ */
|
|
4337
|
+
children: /* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
4230
4338
|
}
|
|
4231
4339
|
)
|
|
4232
4340
|
] })
|
|
4233
4341
|
] }),
|
|
4234
|
-
!isCompact && /* @__PURE__ */
|
|
4235
|
-
/* @__PURE__ */
|
|
4236
|
-
enableFileUpload && /* @__PURE__ */
|
|
4342
|
+
!isCompact && /* @__PURE__ */ jsxs17("div", { className: "p-3 flex items-center justify-between gap-2", children: [
|
|
4343
|
+
/* @__PURE__ */ jsx21("div", { className: "flex items-center gap-1", children: state === "idle" && allowInput && /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
4344
|
+
enableFileUpload && /* @__PURE__ */ jsx21(
|
|
4237
4345
|
"button",
|
|
4238
4346
|
{
|
|
4239
4347
|
onClick: () => fileInputRef.current?.click(),
|
|
4240
4348
|
className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-neutral-500 dark:!text-neutral-500 hover:bg-neutral-100 dark:hover:bg-neutral-800",
|
|
4241
4349
|
title: "Attach file",
|
|
4242
|
-
children: /* @__PURE__ */
|
|
4350
|
+
children: /* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("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)" }) })
|
|
4243
4351
|
}
|
|
4244
4352
|
),
|
|
4245
|
-
planMode && /* @__PURE__ */
|
|
4246
|
-
/* @__PURE__ */
|
|
4353
|
+
planMode && /* @__PURE__ */ jsxs17("div", { className: "relative settings-menu-container", children: [
|
|
4354
|
+
/* @__PURE__ */ jsx21(
|
|
4247
4355
|
"button",
|
|
4248
4356
|
{
|
|
4249
4357
|
onClick: () => setShowSettingsMenu(!showSettingsMenu),
|
|
@@ -4252,28 +4360,28 @@ ${planToExecute}`;
|
|
|
4252
4360
|
internalPlanMode ? "!text-blue-600 dark:!text-blue-400" : "!text-neutral-500 dark:!text-neutral-500"
|
|
4253
4361
|
),
|
|
4254
4362
|
title: "Settings",
|
|
4255
|
-
children: /* @__PURE__ */
|
|
4256
|
-
/* @__PURE__ */
|
|
4257
|
-
/* @__PURE__ */
|
|
4258
|
-
/* @__PURE__ */
|
|
4259
|
-
/* @__PURE__ */
|
|
4260
|
-
/* @__PURE__ */
|
|
4261
|
-
/* @__PURE__ */
|
|
4262
|
-
/* @__PURE__ */
|
|
4263
|
-
/* @__PURE__ */
|
|
4264
|
-
/* @__PURE__ */
|
|
4363
|
+
children: /* @__PURE__ */ jsxs17("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
4364
|
+
/* @__PURE__ */ jsx21("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
|
|
4365
|
+
/* @__PURE__ */ jsx21("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
|
|
4366
|
+
/* @__PURE__ */ jsx21("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
|
|
4367
|
+
/* @__PURE__ */ jsx21("line", { x1: "12", y1: "8", x2: "12", y2: "3" }),
|
|
4368
|
+
/* @__PURE__ */ jsx21("line", { x1: "20", y1: "21", x2: "20", y2: "16" }),
|
|
4369
|
+
/* @__PURE__ */ jsx21("line", { x1: "20", y1: "12", x2: "20", y2: "3" }),
|
|
4370
|
+
/* @__PURE__ */ jsx21("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
|
|
4371
|
+
/* @__PURE__ */ jsx21("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
|
|
4372
|
+
/* @__PURE__ */ jsx21("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
|
|
4265
4373
|
] })
|
|
4266
4374
|
}
|
|
4267
4375
|
),
|
|
4268
|
-
showSettingsMenu && /* @__PURE__ */
|
|
4269
|
-
/* @__PURE__ */
|
|
4270
|
-
/* @__PURE__ */
|
|
4271
|
-
/* @__PURE__ */
|
|
4272
|
-
/* @__PURE__ */
|
|
4273
|
-
/* @__PURE__ */
|
|
4376
|
+
showSettingsMenu && /* @__PURE__ */ jsx21("div", { className: "absolute top-10 left-0 z-50 w-64 bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg shadow-lg p-3 settings-menu-container", children: /* @__PURE__ */ jsxs17("label", { className: "flex items-center justify-between cursor-pointer group", children: [
|
|
4377
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
4378
|
+
/* @__PURE__ */ jsx21("svg", { className: "w-4 h-4 text-neutral-500 dark:text-neutral-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
|
|
4379
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
4380
|
+
/* @__PURE__ */ jsx21("div", { className: "text-sm font-medium text-neutral-700 dark:text-neutral-300", children: "Plan Mode" }),
|
|
4381
|
+
/* @__PURE__ */ jsx21("div", { className: "text-xs text-neutral-500 dark:text-neutral-400", children: "Review before executing" })
|
|
4274
4382
|
] })
|
|
4275
4383
|
] }),
|
|
4276
|
-
/* @__PURE__ */
|
|
4384
|
+
/* @__PURE__ */ jsx21(
|
|
4277
4385
|
"button",
|
|
4278
4386
|
{
|
|
4279
4387
|
onClick: (e) => {
|
|
@@ -4285,7 +4393,7 @@ ${planToExecute}`;
|
|
|
4285
4393
|
internalPlanMode ? "bg-blue-600" : "bg-neutral-300 dark:bg-neutral-600"
|
|
4286
4394
|
),
|
|
4287
4395
|
type: "button",
|
|
4288
|
-
children: /* @__PURE__ */
|
|
4396
|
+
children: /* @__PURE__ */ jsx21(
|
|
4289
4397
|
"span",
|
|
4290
4398
|
{
|
|
4291
4399
|
className: cn(
|
|
@@ -4299,9 +4407,9 @@ ${planToExecute}`;
|
|
|
4299
4407
|
] }) })
|
|
4300
4408
|
] })
|
|
4301
4409
|
] }) }),
|
|
4302
|
-
!(state === "idle" && allowInput) && /* @__PURE__ */
|
|
4303
|
-
/* @__PURE__ */
|
|
4304
|
-
(state === "success" || state === "error") && allowInput && /* @__PURE__ */
|
|
4410
|
+
!(state === "idle" && allowInput) && /* @__PURE__ */ jsx21("div", {}),
|
|
4411
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
4412
|
+
(state === "success" || state === "error") && allowInput && /* @__PURE__ */ jsx21(
|
|
4305
4413
|
"button",
|
|
4306
4414
|
{
|
|
4307
4415
|
onClick: resetCommand,
|
|
@@ -4309,7 +4417,7 @@ ${planToExecute}`;
|
|
|
4309
4417
|
children: "Reset"
|
|
4310
4418
|
}
|
|
4311
4419
|
),
|
|
4312
|
-
(state === "idle" || state === "error") && /* @__PURE__ */
|
|
4420
|
+
(state === "idle" || state === "error") && /* @__PURE__ */ jsx21(
|
|
4313
4421
|
"button",
|
|
4314
4422
|
{
|
|
4315
4423
|
onClick: () => executeCommand(),
|
|
@@ -4325,29 +4433,29 @@ ${planToExecute}`;
|
|
|
4325
4433
|
!command.trim() && "border-neutral-200 dark:border-neutral-700 !text-neutral-400 dark:!text-neutral-600"
|
|
4326
4434
|
),
|
|
4327
4435
|
title: state === "error" ? "Retry" : "Execute",
|
|
4328
|
-
children: state === "error" ? /* @__PURE__ */
|
|
4436
|
+
children: state === "error" ? /* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("path", { d: "M13 8C13 10.7614 10.7614 13 8 13C5.23858 13 3 10.7614 3 8C3 5.23858 5.23858 3 8 3C9.65685 3 11.1257 3.82818 12 5.09091M12 3V5.09091M12 5.09091H9.81818", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
4329
4437
|
}
|
|
4330
4438
|
)
|
|
4331
4439
|
] })
|
|
4332
4440
|
] }),
|
|
4333
|
-
showPlanDetails && isCompact && state === "plan-pending" && /* @__PURE__ */
|
|
4334
|
-
/* @__PURE__ */
|
|
4335
|
-
/* @__PURE__ */
|
|
4336
|
-
/* @__PURE__ */
|
|
4337
|
-
/* @__PURE__ */
|
|
4441
|
+
showPlanDetails && isCompact && state === "plan-pending" && /* @__PURE__ */ jsx21("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4", onClick: () => setShowPlanDetails(false), children: /* @__PURE__ */ jsxs17("div", { className: "bg-white dark:bg-neutral-900 rounded-2xl shadow-2xl max-w-2xl w-full max-h-[80vh] overflow-hidden", onClick: (e) => e.stopPropagation(), children: [
|
|
4442
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between p-6 border-b border-neutral-200 dark:border-neutral-700", children: [
|
|
4443
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-3", children: [
|
|
4444
|
+
/* @__PURE__ */ jsx21("svg", { className: "w-6 h-6 text-blue-600 dark:text-blue-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
|
|
4445
|
+
/* @__PURE__ */ jsx21("h2", { className: "text-xl font-semibold text-neutral-900 dark:text-white", children: "Proposed Execution Plan" })
|
|
4338
4446
|
] }),
|
|
4339
|
-
/* @__PURE__ */
|
|
4447
|
+
/* @__PURE__ */ jsx21(
|
|
4340
4448
|
"button",
|
|
4341
4449
|
{
|
|
4342
4450
|
onClick: () => setShowPlanDetails(false),
|
|
4343
4451
|
className: "text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-300 transition-colors",
|
|
4344
|
-
children: /* @__PURE__ */
|
|
4452
|
+
children: /* @__PURE__ */ jsx21("svg", { className: "w-6 h-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
4345
4453
|
}
|
|
4346
4454
|
)
|
|
4347
4455
|
] }),
|
|
4348
|
-
/* @__PURE__ */
|
|
4349
|
-
/* @__PURE__ */
|
|
4350
|
-
/* @__PURE__ */
|
|
4456
|
+
/* @__PURE__ */ jsx21("div", { className: "p-6 overflow-y-auto max-h-[calc(80vh-180px)]", children: /* @__PURE__ */ jsx21("div", { className: "prose prose-sm dark:prose-invert max-w-none", children: /* @__PURE__ */ jsx21("div", { className: "text-neutral-700 dark:text-neutral-300 whitespace-pre-line leading-relaxed", children: plan }) }) }),
|
|
4457
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-end gap-3 p-6 border-t border-neutral-200 dark:border-neutral-700 bg-neutral-50 dark:bg-neutral-800/50", children: [
|
|
4458
|
+
/* @__PURE__ */ jsx21(
|
|
4351
4459
|
"button",
|
|
4352
4460
|
{
|
|
4353
4461
|
onClick: rejectPlan,
|
|
@@ -4355,7 +4463,7 @@ ${planToExecute}`;
|
|
|
4355
4463
|
children: "Modify Command"
|
|
4356
4464
|
}
|
|
4357
4465
|
),
|
|
4358
|
-
/* @__PURE__ */
|
|
4466
|
+
/* @__PURE__ */ jsx21(
|
|
4359
4467
|
"button",
|
|
4360
4468
|
{
|
|
4361
4469
|
onClick: approvePlan,
|
|
@@ -4365,7 +4473,7 @@ ${planToExecute}`;
|
|
|
4365
4473
|
)
|
|
4366
4474
|
] })
|
|
4367
4475
|
] }) }),
|
|
4368
|
-
/* @__PURE__ */
|
|
4476
|
+
/* @__PURE__ */ jsx21(
|
|
4369
4477
|
"input",
|
|
4370
4478
|
{
|
|
4371
4479
|
ref: fileInputRef,
|
|
@@ -4376,7 +4484,7 @@ ${planToExecute}`;
|
|
|
4376
4484
|
accept: "image/*,application/pdf,.doc,.docx,.txt"
|
|
4377
4485
|
}
|
|
4378
4486
|
),
|
|
4379
|
-
/* @__PURE__ */
|
|
4487
|
+
/* @__PURE__ */ jsx21("style", { dangerouslySetInnerHTML: {
|
|
4380
4488
|
__html: `
|
|
4381
4489
|
@keyframes pulse-border {
|
|
4382
4490
|
0%, 100% {
|
|
@@ -4398,7 +4506,7 @@ ${planToExecute}`;
|
|
|
4398
4506
|
|
|
4399
4507
|
// src/components/Prompt/Prompt.tsx
|
|
4400
4508
|
import { useState as useState9 } from "react";
|
|
4401
|
-
import { jsx as
|
|
4509
|
+
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4402
4510
|
function Prompt({
|
|
4403
4511
|
agentId,
|
|
4404
4512
|
placeholder = "Enter your prompt...",
|
|
@@ -4460,9 +4568,9 @@ function Prompt({
|
|
|
4460
4568
|
handleSubmit();
|
|
4461
4569
|
}
|
|
4462
4570
|
};
|
|
4463
|
-
return /* @__PURE__ */
|
|
4464
|
-
/* @__PURE__ */
|
|
4465
|
-
/* @__PURE__ */
|
|
4571
|
+
return /* @__PURE__ */ jsxs18("div", { className: cn("space-y-2", className), children: [
|
|
4572
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex gap-2", children: [
|
|
4573
|
+
/* @__PURE__ */ jsx22(
|
|
4466
4574
|
"input",
|
|
4467
4575
|
{
|
|
4468
4576
|
type: "text",
|
|
@@ -4475,7 +4583,7 @@ function Prompt({
|
|
|
4475
4583
|
className: "flex-1 px-4 py-2 border border-neutral-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-apteva-500 dark:bg-neutral-800 dark:border-neutral-600 dark:text-white"
|
|
4476
4584
|
}
|
|
4477
4585
|
),
|
|
4478
|
-
submitOn === "button" && /* @__PURE__ */
|
|
4586
|
+
submitOn === "button" && /* @__PURE__ */ jsx22(
|
|
4479
4587
|
"button",
|
|
4480
4588
|
{
|
|
4481
4589
|
onClick: handleSubmit,
|
|
@@ -4485,13 +4593,13 @@ function Prompt({
|
|
|
4485
4593
|
}
|
|
4486
4594
|
)
|
|
4487
4595
|
] }),
|
|
4488
|
-
maxLength && /* @__PURE__ */
|
|
4596
|
+
maxLength && /* @__PURE__ */ jsxs18("p", { className: "text-xs text-neutral-500", children: [
|
|
4489
4597
|
value.length,
|
|
4490
4598
|
" / ",
|
|
4491
4599
|
maxLength,
|
|
4492
4600
|
" characters"
|
|
4493
4601
|
] }),
|
|
4494
|
-
showSuggestions && !value && /* @__PURE__ */
|
|
4602
|
+
showSuggestions && !value && /* @__PURE__ */ jsx22("div", { className: "flex flex-wrap gap-2", children: suggestions.map((suggestion, idx) => /* @__PURE__ */ jsx22(
|
|
4495
4603
|
"button",
|
|
4496
4604
|
{
|
|
4497
4605
|
onClick: () => setValue(suggestion),
|
|
@@ -4500,16 +4608,16 @@ function Prompt({
|
|
|
4500
4608
|
},
|
|
4501
4609
|
idx
|
|
4502
4610
|
)) }),
|
|
4503
|
-
isLoading && /* @__PURE__ */
|
|
4504
|
-
/* @__PURE__ */
|
|
4505
|
-
/* @__PURE__ */
|
|
4611
|
+
isLoading && /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 text-sm text-neutral-500", children: [
|
|
4612
|
+
/* @__PURE__ */ jsx22("div", { className: "w-4 h-4 border-2 border-apteva-500 border-t-transparent rounded-full animate-spin" }),
|
|
4613
|
+
/* @__PURE__ */ jsx22("span", { children: "AI is processing your request..." })
|
|
4506
4614
|
] })
|
|
4507
4615
|
] });
|
|
4508
4616
|
}
|
|
4509
4617
|
|
|
4510
4618
|
// src/components/Stream/Stream.tsx
|
|
4511
4619
|
import { useState as useState10, useEffect as useEffect8 } from "react";
|
|
4512
|
-
import { jsx as
|
|
4620
|
+
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4513
4621
|
function Stream({
|
|
4514
4622
|
agentId,
|
|
4515
4623
|
prompt,
|
|
@@ -4589,7 +4697,7 @@ function Stream({
|
|
|
4589
4697
|
plain: "text-neutral-900 dark:text-neutral-100"
|
|
4590
4698
|
};
|
|
4591
4699
|
if (!isStreaming && !isComplete) {
|
|
4592
|
-
return /* @__PURE__ */
|
|
4700
|
+
return /* @__PURE__ */ jsx23("div", { className: cn("p-4", className), children: /* @__PURE__ */ jsx23(
|
|
4593
4701
|
"button",
|
|
4594
4702
|
{
|
|
4595
4703
|
onClick: startStreaming,
|
|
@@ -4598,9 +4706,9 @@ function Stream({
|
|
|
4598
4706
|
}
|
|
4599
4707
|
) });
|
|
4600
4708
|
}
|
|
4601
|
-
return /* @__PURE__ */
|
|
4709
|
+
return /* @__PURE__ */ jsxs19("div", { className: cn(variantClasses[variant], className), children: [
|
|
4602
4710
|
text,
|
|
4603
|
-
isStreaming && showCursor && /* @__PURE__ */
|
|
4711
|
+
isStreaming && showCursor && /* @__PURE__ */ jsx23("span", { className: "apteva-stream-cursor" })
|
|
4604
4712
|
] });
|
|
4605
4713
|
}
|
|
4606
4714
|
|
|
@@ -4608,9 +4716,9 @@ function Stream({
|
|
|
4608
4716
|
import { useState as useState11 } from "react";
|
|
4609
4717
|
|
|
4610
4718
|
// src/components/Threads/ThreadItem.tsx
|
|
4611
|
-
import { jsx as
|
|
4719
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4612
4720
|
function ThreadItem({ thread, isActive = false, onSelect, onDelete }) {
|
|
4613
|
-
return /* @__PURE__ */
|
|
4721
|
+
return /* @__PURE__ */ jsxs20(
|
|
4614
4722
|
"div",
|
|
4615
4723
|
{
|
|
4616
4724
|
className: cn("apteva-thread-item", {
|
|
@@ -4618,19 +4726,19 @@ function ThreadItem({ thread, isActive = false, onSelect, onDelete }) {
|
|
|
4618
4726
|
}),
|
|
4619
4727
|
onClick: onSelect,
|
|
4620
4728
|
children: [
|
|
4621
|
-
/* @__PURE__ */
|
|
4622
|
-
/* @__PURE__ */
|
|
4623
|
-
thread.preview && /* @__PURE__ */
|
|
4624
|
-
/* @__PURE__ */
|
|
4625
|
-
/* @__PURE__ */
|
|
4729
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex-1 min-w-0", children: [
|
|
4730
|
+
/* @__PURE__ */ jsx24("h4", { className: "font-semibold text-neutral-900 dark:text-white truncate", children: thread.title }),
|
|
4731
|
+
thread.preview && /* @__PURE__ */ jsx24("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 truncate", children: thread.preview }),
|
|
4732
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2 mt-1 text-xs text-neutral-500", children: [
|
|
4733
|
+
/* @__PURE__ */ jsxs20("span", { children: [
|
|
4626
4734
|
thread.messageCount,
|
|
4627
4735
|
" messages"
|
|
4628
4736
|
] }),
|
|
4629
|
-
/* @__PURE__ */
|
|
4630
|
-
/* @__PURE__ */
|
|
4737
|
+
/* @__PURE__ */ jsx24("span", { children: "\u2022" }),
|
|
4738
|
+
/* @__PURE__ */ jsx24("span", { children: formatRelativeTime(thread.updatedAt) })
|
|
4631
4739
|
] })
|
|
4632
4740
|
] }),
|
|
4633
|
-
onDelete && /* @__PURE__ */
|
|
4741
|
+
onDelete && /* @__PURE__ */ jsx24(
|
|
4634
4742
|
"button",
|
|
4635
4743
|
{
|
|
4636
4744
|
onClick: (e) => {
|
|
@@ -4660,7 +4768,7 @@ function formatRelativeTime(date) {
|
|
|
4660
4768
|
}
|
|
4661
4769
|
|
|
4662
4770
|
// src/components/Threads/ThreadList.tsx
|
|
4663
|
-
import { jsx as
|
|
4771
|
+
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4664
4772
|
function ThreadList({
|
|
4665
4773
|
threads,
|
|
4666
4774
|
currentThreadId,
|
|
@@ -4674,8 +4782,8 @@ function ThreadList({
|
|
|
4674
4782
|
(thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || thread.preview?.toLowerCase().includes(searchQuery.toLowerCase())
|
|
4675
4783
|
);
|
|
4676
4784
|
const groupedThreads = groupBy === "date" ? groupThreadsByDate(filteredThreads) : { All: filteredThreads };
|
|
4677
|
-
return /* @__PURE__ */
|
|
4678
|
-
showSearch && /* @__PURE__ */
|
|
4785
|
+
return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col h-full", children: [
|
|
4786
|
+
showSearch && /* @__PURE__ */ jsx25("div", { className: "p-3 border-b border-neutral-200 dark:border-neutral-700", children: /* @__PURE__ */ jsx25(
|
|
4679
4787
|
"input",
|
|
4680
4788
|
{
|
|
4681
4789
|
type: "text",
|
|
@@ -4685,10 +4793,10 @@ function ThreadList({
|
|
|
4685
4793
|
className: "w-full px-3 py-2 text-sm border border-neutral-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-apteva-500 dark:bg-neutral-800 dark:border-neutral-600 dark:text-white"
|
|
4686
4794
|
}
|
|
4687
4795
|
) }),
|
|
4688
|
-
/* @__PURE__ */
|
|
4689
|
-
Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */
|
|
4690
|
-
groupBy !== "none" && /* @__PURE__ */
|
|
4691
|
-
groupThreads.map((thread) => /* @__PURE__ */
|
|
4796
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex-1 overflow-y-auto", children: [
|
|
4797
|
+
Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs21("div", { children: [
|
|
4798
|
+
groupBy !== "none" && /* @__PURE__ */ jsx25("div", { className: "px-3 py-2 text-xs font-semibold text-neutral-500 uppercase", children: group }),
|
|
4799
|
+
groupThreads.map((thread) => /* @__PURE__ */ jsx25(
|
|
4692
4800
|
ThreadItem,
|
|
4693
4801
|
{
|
|
4694
4802
|
thread,
|
|
@@ -4699,9 +4807,9 @@ function ThreadList({
|
|
|
4699
4807
|
thread.id
|
|
4700
4808
|
))
|
|
4701
4809
|
] }, group)),
|
|
4702
|
-
filteredThreads.length === 0 && /* @__PURE__ */
|
|
4703
|
-
/* @__PURE__ */
|
|
4704
|
-
/* @__PURE__ */
|
|
4810
|
+
filteredThreads.length === 0 && /* @__PURE__ */ jsxs21("div", { className: "p-8 text-center text-neutral-500", children: [
|
|
4811
|
+
/* @__PURE__ */ jsx25("svg", { className: "w-10 h-10 mx-auto mb-2 opacity-50", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx25("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, 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" }) }),
|
|
4812
|
+
/* @__PURE__ */ jsx25("p", { children: "No conversations found" })
|
|
4705
4813
|
] })
|
|
4706
4814
|
] })
|
|
4707
4815
|
] });
|
|
@@ -4733,7 +4841,7 @@ function groupThreadsByDate(threads) {
|
|
|
4733
4841
|
}
|
|
4734
4842
|
|
|
4735
4843
|
// src/components/Threads/Threads.tsx
|
|
4736
|
-
import { jsx as
|
|
4844
|
+
import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4737
4845
|
function Threads({
|
|
4738
4846
|
threads,
|
|
4739
4847
|
currentThreadId,
|
|
@@ -4752,8 +4860,8 @@ function Threads({
|
|
|
4752
4860
|
tabs: "flex gap-2 border-b border-neutral-200 dark:border-neutral-700 overflow-x-auto"
|
|
4753
4861
|
};
|
|
4754
4862
|
if (variant === "tabs") {
|
|
4755
|
-
return /* @__PURE__ */
|
|
4756
|
-
threads.slice(0, 5).map((thread) => /* @__PURE__ */
|
|
4863
|
+
return /* @__PURE__ */ jsxs22("div", { className: cn(variantClasses[variant], className), children: [
|
|
4864
|
+
threads.slice(0, 5).map((thread) => /* @__PURE__ */ jsx26(
|
|
4757
4865
|
"button",
|
|
4758
4866
|
{
|
|
4759
4867
|
onClick: () => onThreadSelect?.(thread.id),
|
|
@@ -4765,7 +4873,7 @@ function Threads({
|
|
|
4765
4873
|
},
|
|
4766
4874
|
thread.id
|
|
4767
4875
|
)),
|
|
4768
|
-
showNewButton && onNewThread && /* @__PURE__ */
|
|
4876
|
+
showNewButton && onNewThread && /* @__PURE__ */ jsx26(
|
|
4769
4877
|
"button",
|
|
4770
4878
|
{
|
|
4771
4879
|
onClick: onNewThread,
|
|
@@ -4775,8 +4883,8 @@ function Threads({
|
|
|
4775
4883
|
)
|
|
4776
4884
|
] });
|
|
4777
4885
|
}
|
|
4778
|
-
return /* @__PURE__ */
|
|
4779
|
-
showNewButton && onNewThread && /* @__PURE__ */
|
|
4886
|
+
return /* @__PURE__ */ jsxs22("div", { className: cn(variantClasses[variant], "flex flex-col", className), children: [
|
|
4887
|
+
showNewButton && onNewThread && /* @__PURE__ */ jsx26("div", { className: "p-3 border-b border-neutral-200 dark:border-neutral-700", children: /* @__PURE__ */ jsx26(
|
|
4780
4888
|
"button",
|
|
4781
4889
|
{
|
|
4782
4890
|
onClick: onNewThread,
|
|
@@ -4784,7 +4892,7 @@ function Threads({
|
|
|
4784
4892
|
children: "+ New Conversation"
|
|
4785
4893
|
}
|
|
4786
4894
|
) }),
|
|
4787
|
-
/* @__PURE__ */
|
|
4895
|
+
/* @__PURE__ */ jsx26(
|
|
4788
4896
|
ThreadList,
|
|
4789
4897
|
{
|
|
4790
4898
|
threads,
|