@apteva/apteva-kit 0.1.39 → 0.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +50 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -29
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1251,7 +1251,7 @@ function ToolCall({ name, status }) {
|
|
|
1251
1251
|
}
|
|
1252
1252
|
|
|
1253
1253
|
// src/components/Chat/Message.tsx
|
|
1254
|
-
import {
|
|
1254
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1255
1255
|
function Message({ message, onAction, enableWidgets, onWidgetRender }) {
|
|
1256
1256
|
const isUser = message.role === "user";
|
|
1257
1257
|
const contentSegments = message.metadata?.content_segments;
|
|
@@ -1290,21 +1290,50 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
|
|
|
1290
1290
|
return /* @__PURE__ */ jsx11(MarkdownContent, { content: text });
|
|
1291
1291
|
}
|
|
1292
1292
|
const parsed = parseWidgetsFromText(text);
|
|
1293
|
-
|
|
1293
|
+
const cleanedText = parsed.segments.filter((seg) => seg.type === "text" && seg.content).map((seg) => seg.content).join("");
|
|
1294
|
+
if (!cleanedText.trim()) {
|
|
1294
1295
|
return null;
|
|
1295
1296
|
}
|
|
1296
|
-
return /* @__PURE__ */ jsx11(
|
|
1297
|
+
return /* @__PURE__ */ jsx11(MarkdownContent, { content: cleanedText });
|
|
1298
|
+
};
|
|
1299
|
+
const renderContentWithWidgets = () => {
|
|
1300
|
+
if (!enableWidgets || isUser || !message.content) {
|
|
1301
|
+
return null;
|
|
1302
|
+
}
|
|
1303
|
+
const parsed = parseWidgetsFromText(message.content);
|
|
1304
|
+
const elements = [];
|
|
1305
|
+
let textBuffer = "";
|
|
1306
|
+
parsed.segments.forEach((segment, index) => {
|
|
1297
1307
|
if (segment.type === "text" && segment.content) {
|
|
1298
|
-
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1308
|
+
textBuffer += segment.content;
|
|
1309
|
+
} else if (segment.type === "widget" && segment.widget) {
|
|
1310
|
+
if (textBuffer.trim()) {
|
|
1311
|
+
elements.push(
|
|
1312
|
+
/* @__PURE__ */ jsx11("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx11("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx11(MarkdownContent, { content: textBuffer }) }) }, `text-${index}`)
|
|
1313
|
+
);
|
|
1314
|
+
textBuffer = "";
|
|
1315
|
+
}
|
|
1316
|
+
elements.push(
|
|
1317
|
+
/* @__PURE__ */ jsx11("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx11(WidgetRenderer, { widget: segment.widget, onAction }) }, `widget-${index}`)
|
|
1318
|
+
);
|
|
1319
|
+
} else if (segment.type === "widget_pending" && segment.pendingType) {
|
|
1320
|
+
if (textBuffer.trim()) {
|
|
1321
|
+
elements.push(
|
|
1322
|
+
/* @__PURE__ */ jsx11("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx11("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx11(MarkdownContent, { content: textBuffer }) }) }, `text-${index}`)
|
|
1323
|
+
);
|
|
1324
|
+
textBuffer = "";
|
|
1325
|
+
}
|
|
1326
|
+
elements.push(
|
|
1327
|
+
/* @__PURE__ */ jsx11("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx11(WidgetSkeleton, { type: segment.pendingType }) }, `pending-${index}`)
|
|
1328
|
+
);
|
|
1305
1329
|
}
|
|
1306
|
-
|
|
1307
|
-
|
|
1330
|
+
});
|
|
1331
|
+
if (textBuffer.trim()) {
|
|
1332
|
+
elements.push(
|
|
1333
|
+
/* @__PURE__ */ jsx11("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx11("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx11(MarkdownContent, { content: textBuffer }) }) }, "text-final")
|
|
1334
|
+
);
|
|
1335
|
+
}
|
|
1336
|
+
return elements.length > 0 ? elements : null;
|
|
1308
1337
|
};
|
|
1309
1338
|
const renderContent = () => {
|
|
1310
1339
|
if (isUser) {
|
|
@@ -1356,7 +1385,15 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
|
|
|
1356
1385
|
if (!isUser && contentSegments && contentSegments.length > 0) {
|
|
1357
1386
|
return /* @__PURE__ */ jsxs8("div", { className: "apteva-message-segmented", children: [
|
|
1358
1387
|
renderSegmentedContent(),
|
|
1359
|
-
message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx11("div", { className: "apteva-
|
|
1388
|
+
message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx11("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx11(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
|
|
1389
|
+
/* @__PURE__ */ jsx11("div", { className: "apteva-message-timestamp apteva-message-timestamp-assistant", suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
|
|
1390
|
+
] });
|
|
1391
|
+
}
|
|
1392
|
+
const widgetContent = renderContentWithWidgets();
|
|
1393
|
+
if (!isUser && enableWidgets && widgetContent) {
|
|
1394
|
+
return /* @__PURE__ */ jsxs8("div", { className: "apteva-message-segmented", children: [
|
|
1395
|
+
widgetContent,
|
|
1396
|
+
message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx11("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx11(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
|
|
1360
1397
|
/* @__PURE__ */ jsx11("div", { className: "apteva-message-timestamp apteva-message-timestamp-assistant", suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
|
|
1361
1398
|
] });
|
|
1362
1399
|
}
|
|
@@ -1369,7 +1406,7 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
|
|
|
1369
1406
|
),
|
|
1370
1407
|
children: [
|
|
1371
1408
|
/* @__PURE__ */ jsx11("div", { className: isUser ? "apteva-message-content-user" : "apteva-message-content-assistant", children: renderContent() }),
|
|
1372
|
-
message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx11("div", { className: "apteva-
|
|
1409
|
+
message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx11("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx11(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
|
|
1373
1410
|
/* @__PURE__ */ jsx11("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" }) })
|
|
1374
1411
|
]
|
|
1375
1412
|
}
|
|
@@ -1553,7 +1590,7 @@ function MessageList({
|
|
|
1553
1590
|
|
|
1554
1591
|
// src/components/Chat/Composer.tsx
|
|
1555
1592
|
import { useState, useRef as useRef3 } from "react";
|
|
1556
|
-
import { Fragment
|
|
1593
|
+
import { Fragment, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1557
1594
|
function Composer({ onSendMessage, placeholder = "Type a message...", disabled = false, isLoading = false, onStop, onFileUpload, onSwitchMode }) {
|
|
1558
1595
|
const [text, setText] = useState("");
|
|
1559
1596
|
const [showMenu, setShowMenu] = useState(false);
|
|
@@ -1674,7 +1711,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
|
|
|
1674
1711
|
children: /* @__PURE__ */ jsx14("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx14("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
1675
1712
|
}
|
|
1676
1713
|
),
|
|
1677
|
-
showMenu && /* @__PURE__ */ jsxs10(
|
|
1714
|
+
showMenu && /* @__PURE__ */ jsxs10(Fragment, { children: [
|
|
1678
1715
|
/* @__PURE__ */ jsx14("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
|
|
1679
1716
|
/* @__PURE__ */ jsxs10(
|
|
1680
1717
|
"div",
|
|
@@ -1767,7 +1804,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
|
|
|
1767
1804
|
|
|
1768
1805
|
// src/components/Chat/CommandComposer.tsx
|
|
1769
1806
|
import { useState as useState2, useRef as useRef4 } from "react";
|
|
1770
|
-
import { Fragment as
|
|
1807
|
+
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1771
1808
|
function CommandComposer({
|
|
1772
1809
|
onExecute,
|
|
1773
1810
|
state,
|
|
@@ -1916,7 +1953,7 @@ function CommandComposer({
|
|
|
1916
1953
|
children: /* @__PURE__ */ jsx15("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx15("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
1917
1954
|
}
|
|
1918
1955
|
),
|
|
1919
|
-
showMenu && /* @__PURE__ */ jsxs11(
|
|
1956
|
+
showMenu && /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
1920
1957
|
/* @__PURE__ */ jsx15("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
|
|
1921
1958
|
/* @__PURE__ */ jsxs11(
|
|
1922
1959
|
"div",
|
|
@@ -2012,7 +2049,7 @@ function CommandComposer({
|
|
|
2012
2049
|
state === "error" && "!text-red-600 dark:!text-red-400",
|
|
2013
2050
|
state === "plan-pending" && "!text-amber-700 dark:!text-amber-300"
|
|
2014
2051
|
),
|
|
2015
|
-
children: isToolCall ? /* @__PURE__ */ jsxs11(
|
|
2052
|
+
children: isToolCall ? /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
2016
2053
|
/* @__PURE__ */ jsx15("span", { className: "font-mono", children: displayContent }),
|
|
2017
2054
|
/* @__PURE__ */ jsx15("span", { className: "text-gray-400 dark:text-gray-500", children: "Running..." })
|
|
2018
2055
|
] }) : displayContent
|
|
@@ -2035,7 +2072,7 @@ function CommandComposer({
|
|
|
2035
2072
|
children: "Modify"
|
|
2036
2073
|
}
|
|
2037
2074
|
)
|
|
2038
|
-
] }) : /* @__PURE__ */ jsxs11(
|
|
2075
|
+
] }) : /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
2039
2076
|
state === "loading" && onStop && /* @__PURE__ */ jsx15(
|
|
2040
2077
|
"button",
|
|
2041
2078
|
{
|
|
@@ -2273,7 +2310,7 @@ var AptevaClient = class {
|
|
|
2273
2310
|
var aptevaClient = new AptevaClient();
|
|
2274
2311
|
|
|
2275
2312
|
// src/components/Chat/Chat.tsx
|
|
2276
|
-
import { Fragment as
|
|
2313
|
+
import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2277
2314
|
var Chat = forwardRef(function Chat2({
|
|
2278
2315
|
agentId,
|
|
2279
2316
|
threadId,
|
|
@@ -2832,7 +2869,7 @@ ${planToExecute}`;
|
|
|
2832
2869
|
isLoading ? chatToolName ? "apteva-chat-status-tool" : "apteva-chat-status-thinking" : "apteva-chat-status-ready"
|
|
2833
2870
|
), children: isLoading ? chatToolName ? `Using ${chatToolName}...` : "Thinking..." : "Ready" })
|
|
2834
2871
|
] }) }),
|
|
2835
|
-
mode === "chat" && /* @__PURE__ */ jsxs12(
|
|
2872
|
+
mode === "chat" && /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
2836
2873
|
/* @__PURE__ */ jsx16(
|
|
2837
2874
|
MessageList,
|
|
2838
2875
|
{
|
|
@@ -2905,7 +2942,7 @@ import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
|
2905
2942
|
|
|
2906
2943
|
// src/components/Command/Command.tsx
|
|
2907
2944
|
import React, { useState as useState5, useEffect as useEffect5 } from "react";
|
|
2908
|
-
import { Fragment as
|
|
2945
|
+
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2909
2946
|
function Command({
|
|
2910
2947
|
agentId,
|
|
2911
2948
|
command: initialCommand,
|
|
@@ -3371,7 +3408,7 @@ ${planToExecute}`;
|
|
|
3371
3408
|
style: { minHeight: isCompact ? "auto" : "180px" },
|
|
3372
3409
|
children: [
|
|
3373
3410
|
/* @__PURE__ */ jsxs14("div", { className: cn("flex-1 flex", isCompact ? "flex-row items-center p-3 gap-3" : "flex-col p-4"), children: [
|
|
3374
|
-
state === "idle" && allowInput && !isCompact && /* @__PURE__ */ jsxs14(
|
|
3411
|
+
state === "idle" && allowInput && !isCompact && /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
3375
3412
|
/* @__PURE__ */ jsx18(
|
|
3376
3413
|
"textarea",
|
|
3377
3414
|
{
|
|
@@ -3411,7 +3448,7 @@ ${planToExecute}`;
|
|
|
3411
3448
|
)
|
|
3412
3449
|
] }, index)) })
|
|
3413
3450
|
] }),
|
|
3414
|
-
state === "idle" && allowInput && isCompact && /* @__PURE__ */ jsxs14(
|
|
3451
|
+
state === "idle" && allowInput && isCompact && /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
3415
3452
|
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-0.5 flex-shrink-0", children: [
|
|
3416
3453
|
enableFileUpload && /* @__PURE__ */ jsx18(
|
|
3417
3454
|
"button",
|
|
@@ -3551,7 +3588,7 @@ ${planToExecute}`;
|
|
|
3551
3588
|
] })
|
|
3552
3589
|
] })
|
|
3553
3590
|
] }),
|
|
3554
|
-
state === "loading" && isCompact && /* @__PURE__ */ jsxs14(
|
|
3591
|
+
state === "loading" && isCompact && /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
3555
3592
|
/* @__PURE__ */ jsxs14("div", { className: "flex-1 flex items-center gap-3 py-1", children: [
|
|
3556
3593
|
/* @__PURE__ */ jsx18("div", { className: "w-4 h-4 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin" }),
|
|
3557
3594
|
/* @__PURE__ */ jsx18("div", { className: "text-gray-600 dark:text-gray-400 text-sm truncate", children: enableStreaming && streamedContent ? streamedContent : loadingText })
|
|
@@ -3599,7 +3636,7 @@ ${planToExecute}`;
|
|
|
3599
3636
|
)
|
|
3600
3637
|
] })
|
|
3601
3638
|
] }) }),
|
|
3602
|
-
state === "plan-pending" && isCompact && /* @__PURE__ */ jsxs14(
|
|
3639
|
+
state === "plan-pending" && isCompact && /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
3603
3640
|
/* @__PURE__ */ jsxs14(
|
|
3604
3641
|
"button",
|
|
3605
3642
|
{
|
|
@@ -3673,7 +3710,7 @@ ${planToExecute}`;
|
|
|
3673
3710
|
widget.id
|
|
3674
3711
|
)) })
|
|
3675
3712
|
] }) }),
|
|
3676
|
-
state === "success" && result && isCompact && /* @__PURE__ */ jsxs14(
|
|
3713
|
+
state === "success" && result && isCompact && /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
3677
3714
|
/* @__PURE__ */ jsxs14(
|
|
3678
3715
|
"div",
|
|
3679
3716
|
{
|
|
@@ -3710,7 +3747,7 @@ ${planToExecute}`;
|
|
|
3710
3747
|
] })
|
|
3711
3748
|
] }),
|
|
3712
3749
|
!isCompact && /* @__PURE__ */ jsxs14("div", { className: "p-3 flex items-center justify-between gap-2", children: [
|
|
3713
|
-
/* @__PURE__ */ jsx18("div", { className: "flex items-center gap-1", children: state === "idle" && allowInput && /* @__PURE__ */ jsxs14(
|
|
3750
|
+
/* @__PURE__ */ jsx18("div", { className: "flex items-center gap-1", children: state === "idle" && allowInput && /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
3714
3751
|
enableFileUpload && /* @__PURE__ */ jsx18(
|
|
3715
3752
|
"button",
|
|
3716
3753
|
{
|