@apteva/apteva-kit 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +81 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1384,26 +1384,6 @@ function CommandComposer({
|
|
|
1384
1384
|
/* @__PURE__ */ jsx13("svg", { className: "w-3 h-3 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
1385
1385
|
/* @__PURE__ */ jsx13("span", { children: fileError })
|
|
1386
1386
|
] }) }),
|
|
1387
|
-
pendingFiles.length > 0 && state === "idle" && /* @__PURE__ */ jsx13("div", { className: "mb-2 flex flex-wrap gap-2", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs9(
|
|
1388
|
-
"div",
|
|
1389
|
-
{
|
|
1390
|
-
className: "relative group flex items-center gap-2 px-2 py-1.5 bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg",
|
|
1391
|
-
children: [
|
|
1392
|
-
pf.preview ? /* @__PURE__ */ jsx13("img", { src: pf.preview, alt: pf.file.name, className: "w-6 h-6 object-cover rounded" }) : /* @__PURE__ */ jsx13("div", { className: "w-6 h-6 flex items-center justify-center bg-gray-200 dark:bg-gray-700 rounded !text-gray-500 dark:!text-gray-400", children: getFileIcon(pf.file.type) }),
|
|
1393
|
-
/* @__PURE__ */ jsx13("span", { className: "text-xs font-medium !text-gray-700 dark:!text-gray-300 truncate max-w-[100px]", children: pf.file.name }),
|
|
1394
|
-
/* @__PURE__ */ jsx13(
|
|
1395
|
-
"button",
|
|
1396
|
-
{
|
|
1397
|
-
onClick: () => removeFile(index),
|
|
1398
|
-
className: "w-4 h-4 bg-gray-500 hover:bg-red-500 text-white rounded-full flex items-center justify-center",
|
|
1399
|
-
title: "Remove file",
|
|
1400
|
-
children: /* @__PURE__ */ jsx13("svg", { className: "w-2.5 h-2.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
1401
|
-
}
|
|
1402
|
-
)
|
|
1403
|
-
]
|
|
1404
|
-
},
|
|
1405
|
-
index
|
|
1406
|
-
)) }),
|
|
1407
1387
|
/* @__PURE__ */ jsxs9(
|
|
1408
1388
|
"div",
|
|
1409
1389
|
{
|
|
@@ -1475,6 +1455,26 @@ function CommandComposer({
|
|
|
1475
1455
|
state === "loading" && !toolName && /* @__PURE__ */ jsx13("div", { className: "w-4 h-4 border-2 border-blue-200 border-t-blue-500 rounded-full animate-spin" }),
|
|
1476
1456
|
state === "loading" && toolName && /* @__PURE__ */ jsx13("div", { className: "w-2 h-2 rounded-full bg-blue-500 animate-pulse" })
|
|
1477
1457
|
] }),
|
|
1458
|
+
pendingFiles.length > 0 && state === "idle" && /* @__PURE__ */ jsx13("div", { className: "flex items-center gap-1 flex-shrink-0", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs9(
|
|
1459
|
+
"div",
|
|
1460
|
+
{
|
|
1461
|
+
className: "relative group flex items-center justify-center w-6 h-6 bg-gray-100 dark:bg-gray-800 rounded overflow-hidden",
|
|
1462
|
+
title: pf.file.name,
|
|
1463
|
+
children: [
|
|
1464
|
+
pf.preview ? /* @__PURE__ */ jsx13("img", { src: pf.preview, alt: pf.file.name, className: "w-6 h-6 object-cover" }) : /* @__PURE__ */ jsx13("span", { className: "text-xs !text-gray-500 dark:!text-gray-400", children: getFileIcon(pf.file.type) }),
|
|
1465
|
+
/* @__PURE__ */ jsx13(
|
|
1466
|
+
"button",
|
|
1467
|
+
{
|
|
1468
|
+
onClick: () => removeFile(index),
|
|
1469
|
+
className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity",
|
|
1470
|
+
title: "Remove",
|
|
1471
|
+
children: /* @__PURE__ */ jsx13("svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
1472
|
+
}
|
|
1473
|
+
)
|
|
1474
|
+
]
|
|
1475
|
+
},
|
|
1476
|
+
index
|
|
1477
|
+
)) }),
|
|
1478
1478
|
state === "idle" ? /* @__PURE__ */ jsx13(
|
|
1479
1479
|
"textarea",
|
|
1480
1480
|
{
|
|
@@ -1482,7 +1482,7 @@ function CommandComposer({
|
|
|
1482
1482
|
value: input,
|
|
1483
1483
|
onChange: (e) => handleInputChange(e.target.value),
|
|
1484
1484
|
onKeyDown: handleKeyDown,
|
|
1485
|
-
placeholder,
|
|
1485
|
+
placeholder: pendingFiles.length > 0 ? "Add a message..." : placeholder,
|
|
1486
1486
|
disabled,
|
|
1487
1487
|
rows: 1,
|
|
1488
1488
|
className: cn(
|
|
@@ -1768,6 +1768,7 @@ function Chat({
|
|
|
1768
1768
|
onFileUpload,
|
|
1769
1769
|
onComplete,
|
|
1770
1770
|
onError,
|
|
1771
|
+
onToolResult,
|
|
1771
1772
|
// UI
|
|
1772
1773
|
placeholder,
|
|
1773
1774
|
showHeader = true,
|
|
@@ -1935,6 +1936,7 @@ function Chat({
|
|
|
1935
1936
|
const toolSegment = contentSegments.find((s) => s.type === "tool" && s.id === chunk.tool_id);
|
|
1936
1937
|
if (toolSegment) {
|
|
1937
1938
|
toolSegment.result = chunk.content;
|
|
1939
|
+
onToolResult?.(toolSegment.name, chunk.content);
|
|
1938
1940
|
}
|
|
1939
1941
|
updateMessage();
|
|
1940
1942
|
}
|
|
@@ -2115,6 +2117,7 @@ ${commandInstruction}` : commandInstruction;
|
|
|
2115
2117
|
const messagePayload = files && files.length > 0 ? await buildMessageWithAttachments(currentCommand, files) : currentCommand;
|
|
2116
2118
|
if (enableStreaming) {
|
|
2117
2119
|
let accumulatedContent = "";
|
|
2120
|
+
let lastToolName = "";
|
|
2118
2121
|
await aptevaClient.chatStream(
|
|
2119
2122
|
{
|
|
2120
2123
|
agent_id: agentId,
|
|
@@ -2131,10 +2134,12 @@ ${commandInstruction}` : commandInstruction;
|
|
|
2131
2134
|
const estimatedProgress = Math.min(Math.round(accumulatedContent.length / 10), 90);
|
|
2132
2135
|
setProgress(estimatedProgress);
|
|
2133
2136
|
} else if (chunk.type === "tool_call" && chunk.tool_name) {
|
|
2137
|
+
lastToolName = chunk.tool_name;
|
|
2134
2138
|
setCurrentToolName(chunk.tool_name);
|
|
2135
2139
|
accumulatedContent = "";
|
|
2136
2140
|
setStreamedContent("");
|
|
2137
2141
|
} else if (chunk.type === "tool_result") {
|
|
2142
|
+
onToolResult?.(lastToolName, chunk.content);
|
|
2138
2143
|
setCurrentToolName(null);
|
|
2139
2144
|
} else if (chunk.type === "thread_id" && chunk.thread_id) {
|
|
2140
2145
|
if (!currentThreadId) {
|