@apteva/apteva-kit 0.1.82 → 0.1.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1520,8 +1520,8 @@ function MarkdownContent({ content, className = "" }) {
1520
1520
  }
1521
1521
 
1522
1522
  // src/components/Chat/ToolCall.tsx
1523
- import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
1524
- function ToolCall({ name, status, isReceiving = false, inputLength = 0 }) {
1523
+ import { Fragment, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
1524
+ function ToolCall({ name, status, isReceiving = false, inputLength = 0, streamOutput }) {
1525
1525
  if (status === "preparing") {
1526
1526
  return /* @__PURE__ */ jsxs8("div", { className: "apteva-tool-card apteva-tool-card-preparing", children: [
1527
1527
  /* @__PURE__ */ jsxs8("svg", { className: "apteva-tool-icon apteva-tool-icon-spin", fill: "none", viewBox: "0 0 24 24", children: [
@@ -1542,11 +1542,16 @@ function ToolCall({ name, status, isReceiving = false, inputLength = 0 }) {
1542
1542
  ] }),
1543
1543
  /* @__PURE__ */ jsxs8("span", { className: "apteva-tool-label", children: [
1544
1544
  /* @__PURE__ */ jsx11("strong", { children: name }),
1545
- /* @__PURE__ */ jsx11("span", { className: "apteva-tool-status-text", children: " running" }),
1546
- /* @__PURE__ */ jsxs8("span", { className: "apteva-tool-dots", children: [
1547
- /* @__PURE__ */ jsx11("span", { children: "." }),
1548
- /* @__PURE__ */ jsx11("span", { children: "." }),
1549
- /* @__PURE__ */ jsx11("span", { children: "." })
1545
+ streamOutput ? /* @__PURE__ */ jsxs8("span", { className: "apteva-tool-stream-output", children: [
1546
+ " ",
1547
+ streamOutput
1548
+ ] }) : /* @__PURE__ */ jsxs8(Fragment, { children: [
1549
+ /* @__PURE__ */ jsx11("span", { className: "apteva-tool-status-text", children: " running" }),
1550
+ /* @__PURE__ */ jsxs8("span", { className: "apteva-tool-dots", children: [
1551
+ /* @__PURE__ */ jsx11("span", { children: "." }),
1552
+ /* @__PURE__ */ jsx11("span", { children: "." }),
1553
+ /* @__PURE__ */ jsx11("span", { children: "." })
1554
+ ] })
1550
1555
  ] })
1551
1556
  ] })
1552
1557
  ] });
@@ -1764,7 +1769,8 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
1764
1769
  name: segment.name,
1765
1770
  status: segment.status || (segment.result !== void 0 ? "completed" : "running"),
1766
1771
  isReceiving: segment.isReceiving,
1767
- inputLength: segment.inputLength
1772
+ inputLength: segment.inputLength,
1773
+ streamOutput: segment.streamOutput
1768
1774
  }
1769
1775
  ) }, segment.id)
1770
1776
  );
@@ -1999,7 +2005,7 @@ function MessageList({
1999
2005
 
2000
2006
  // src/components/Chat/Composer.tsx
2001
2007
  import { useState as useState4, useRef as useRef5 } from "react";
2002
- import { Fragment, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
2008
+ import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
2003
2009
  function Composer({ onSendMessage, placeholder = "Type a message...", disabled = false, isLoading = false, onStop, onFileUpload, onSwitchMode }) {
2004
2010
  const [text, setText] = useState4("");
2005
2011
  const [showMenu, setShowMenu] = useState4(false);
@@ -2120,7 +2126,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2120
2126
  children: /* @__PURE__ */ jsx15("svg", { width: "20", height: "20", 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" }) })
2121
2127
  }
2122
2128
  ),
2123
- showMenu && /* @__PURE__ */ jsxs11(Fragment, { children: [
2129
+ showMenu && /* @__PURE__ */ jsxs11(Fragment2, { children: [
2124
2130
  /* @__PURE__ */ jsx15("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
2125
2131
  /* @__PURE__ */ jsxs11(
2126
2132
  "div",
@@ -2212,7 +2218,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2212
2218
 
2213
2219
  // src/components/Chat/CommandComposer.tsx
2214
2220
  import { useState as useState5, useRef as useRef6 } from "react";
2215
- import { Fragment as Fragment2, jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
2221
+ import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
2216
2222
  function CommandComposer({
2217
2223
  onExecute,
2218
2224
  state,
@@ -2361,7 +2367,7 @@ function CommandComposer({
2361
2367
  children: /* @__PURE__ */ jsx16("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx16("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
2362
2368
  }
2363
2369
  ),
2364
- showMenu && /* @__PURE__ */ jsxs12(Fragment2, { children: [
2370
+ showMenu && /* @__PURE__ */ jsxs12(Fragment3, { children: [
2365
2371
  /* @__PURE__ */ jsx16("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
2366
2372
  /* @__PURE__ */ jsxs12(
2367
2373
  "div",
@@ -2457,7 +2463,7 @@ function CommandComposer({
2457
2463
  state === "error" && "!text-red-600 dark:!text-red-400",
2458
2464
  state === "plan-pending" && "!text-amber-700 dark:!text-amber-300"
2459
2465
  ),
2460
- children: isToolCall ? /* @__PURE__ */ jsxs12(Fragment2, { children: [
2466
+ children: isToolCall ? /* @__PURE__ */ jsxs12(Fragment3, { children: [
2461
2467
  /* @__PURE__ */ jsx16("span", { className: "font-mono", children: displayContent }),
2462
2468
  /* @__PURE__ */ jsx16("span", { className: "text-neutral-400 dark:text-neutral-500", children: "Running..." })
2463
2469
  ] }) : displayContent
@@ -2480,7 +2486,7 @@ function CommandComposer({
2480
2486
  children: "Modify"
2481
2487
  }
2482
2488
  )
2483
- ] }) : /* @__PURE__ */ jsxs12(Fragment2, { children: [
2489
+ ] }) : /* @__PURE__ */ jsxs12(Fragment3, { children: [
2484
2490
  state === "loading" && onStop && /* @__PURE__ */ jsx16(
2485
2491
  "button",
2486
2492
  {
@@ -2718,7 +2724,7 @@ var AptevaClient = class {
2718
2724
  var aptevaClient = new AptevaClient();
2719
2725
 
2720
2726
  // src/components/Chat/Chat.tsx
2721
- import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
2727
+ import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
2722
2728
  var Chat = forwardRef(function Chat2({
2723
2729
  agentId,
2724
2730
  threadId,
@@ -2986,6 +2992,15 @@ ${widgetContext}` : widgetContext;
2986
2992
  }
2987
2993
  }
2988
2994
  break;
2995
+ case "tool_stream":
2996
+ if (chunk.tool_id && chunk.event === "chunk" && chunk.content) {
2997
+ const toolSegment = contentSegments.find((s) => s.type === "tool" && s.id === chunk.tool_id);
2998
+ if (toolSegment) {
2999
+ toolSegment.streamOutput = (toolSegment.streamOutput || "") + chunk.content;
3000
+ updateMessage();
3001
+ }
3002
+ }
3003
+ break;
2989
3004
  case "tool_result":
2990
3005
  if (chunk.tool_id) {
2991
3006
  const toolSegment = contentSegments.find((s) => s.type === "tool" && s.id === chunk.tool_id);
@@ -3313,7 +3328,7 @@ ${planToExecute}`;
3313
3328
  isLoading ? chatToolName ? "apteva-chat-status-tool" : "apteva-chat-status-thinking" : "apteva-chat-status-ready"
3314
3329
  ), children: isLoading ? chatToolName ? `Using ${chatToolName}...` : "Thinking..." : "Ready" })
3315
3330
  ] }) }),
3316
- mode === "chat" && /* @__PURE__ */ jsxs13(Fragment3, { children: [
3331
+ mode === "chat" && /* @__PURE__ */ jsxs13(Fragment4, { children: [
3317
3332
  /* @__PURE__ */ jsx17(
3318
3333
  MessageList,
3319
3334
  {
@@ -3386,7 +3401,7 @@ import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
3386
3401
 
3387
3402
  // src/components/Command/Command.tsx
3388
3403
  import React, { useState as useState8, useEffect as useEffect7 } from "react";
3389
- import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
3404
+ import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
3390
3405
  function Command({
3391
3406
  agentId,
3392
3407
  command: initialCommand,
@@ -3852,7 +3867,7 @@ ${planToExecute}`;
3852
3867
  style: { minHeight: isCompact ? "auto" : "180px" },
3853
3868
  children: [
3854
3869
  /* @__PURE__ */ jsxs15("div", { className: cn("flex-1 flex", isCompact ? "flex-row items-center p-3 gap-3" : "flex-col p-4"), children: [
3855
- state === "idle" && allowInput && !isCompact && /* @__PURE__ */ jsxs15(Fragment4, { children: [
3870
+ state === "idle" && allowInput && !isCompact && /* @__PURE__ */ jsxs15(Fragment5, { children: [
3856
3871
  /* @__PURE__ */ jsx19(
3857
3872
  "textarea",
3858
3873
  {
@@ -3892,7 +3907,7 @@ ${planToExecute}`;
3892
3907
  )
3893
3908
  ] }, index)) })
3894
3909
  ] }),
3895
- state === "idle" && allowInput && isCompact && /* @__PURE__ */ jsxs15(Fragment4, { children: [
3910
+ state === "idle" && allowInput && isCompact && /* @__PURE__ */ jsxs15(Fragment5, { children: [
3896
3911
  /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-0.5 flex-shrink-0", children: [
3897
3912
  enableFileUpload && /* @__PURE__ */ jsx19(
3898
3913
  "button",
@@ -4032,7 +4047,7 @@ ${planToExecute}`;
4032
4047
  ] })
4033
4048
  ] })
4034
4049
  ] }),
4035
- state === "loading" && isCompact && /* @__PURE__ */ jsxs15(Fragment4, { children: [
4050
+ state === "loading" && isCompact && /* @__PURE__ */ jsxs15(Fragment5, { children: [
4036
4051
  /* @__PURE__ */ jsxs15("div", { className: "flex-1 flex items-center gap-3 py-1", children: [
4037
4052
  /* @__PURE__ */ jsx19("div", { className: "w-4 h-4 border-2 border-neutral-300 border-t-blue-500 rounded-full animate-spin" }),
4038
4053
  /* @__PURE__ */ jsx19("div", { className: "text-neutral-600 dark:text-neutral-400 text-sm truncate", children: enableStreaming && streamedContent ? streamedContent : loadingText })
@@ -4080,7 +4095,7 @@ ${planToExecute}`;
4080
4095
  )
4081
4096
  ] })
4082
4097
  ] }) }),
4083
- state === "plan-pending" && isCompact && /* @__PURE__ */ jsxs15(Fragment4, { children: [
4098
+ state === "plan-pending" && isCompact && /* @__PURE__ */ jsxs15(Fragment5, { children: [
4084
4099
  /* @__PURE__ */ jsxs15(
4085
4100
  "button",
4086
4101
  {
@@ -4154,7 +4169,7 @@ ${planToExecute}`;
4154
4169
  widget.id
4155
4170
  )) })
4156
4171
  ] }) }),
4157
- state === "success" && result && isCompact && /* @__PURE__ */ jsxs15(Fragment4, { children: [
4172
+ state === "success" && result && isCompact && /* @__PURE__ */ jsxs15(Fragment5, { children: [
4158
4173
  /* @__PURE__ */ jsxs15(
4159
4174
  "div",
4160
4175
  {
@@ -4191,7 +4206,7 @@ ${planToExecute}`;
4191
4206
  ] })
4192
4207
  ] }),
4193
4208
  !isCompact && /* @__PURE__ */ jsxs15("div", { className: "p-3 flex items-center justify-between gap-2", children: [
4194
- /* @__PURE__ */ jsx19("div", { className: "flex items-center gap-1", children: state === "idle" && allowInput && /* @__PURE__ */ jsxs15(Fragment4, { children: [
4209
+ /* @__PURE__ */ jsx19("div", { className: "flex items-center gap-1", children: state === "idle" && allowInput && /* @__PURE__ */ jsxs15(Fragment5, { children: [
4195
4210
  enableFileUpload && /* @__PURE__ */ jsx19(
4196
4211
  "button",
4197
4212
  {