@apteva/apteva-kit 0.1.130 → 0.1.131

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 CHANGED
@@ -2805,17 +2805,36 @@ function ToolCall({ name, status, isReceiving = false, inputLength = 0, streamOu
2805
2805
  // src/components/Chat/ToolCallGroup.tsx
2806
2806
 
2807
2807
 
2808
+ function formatResultPreview(result) {
2809
+ if (result == null) return "";
2810
+ const str = typeof result === "string" ? result : JSON.stringify(result);
2811
+ const oneLine = str.replace(/\s+/g, " ").trim();
2812
+ return oneLine.length > 120 ? oneLine.slice(0, 117) + "..." : oneLine;
2813
+ }
2808
2814
  function ToolCallGroup({ tools }) {
2809
2815
  const completed = tools.filter((t) => t.status === "completed").length;
2810
2816
  const errored = tools.filter((t) => t.status === "error").length;
2811
- const running = tools.filter((t) => t.status === "running").length;
2812
- const preparing = tools.filter((t) => t.status === "preparing").length;
2813
2817
  const total = tools.length;
2814
2818
  const allDone = completed + errored === total;
2815
2819
  const [expanded, setExpanded] = _react.useState.call(void 0, false);
2816
- const isExpanded = allDone ? expanded : true;
2817
- const activeStreamTool = tools.find((t) => t.status === "running" && t.streamOutput);
2818
- const statusText = allDone ? `Used ${total} tools` : `Using ${total} tools${completed > 0 ? ` \xB7 ${completed}/${total} done` : ""}`;
2820
+ const isExpanded = expanded;
2821
+ const activeTool = tools.find((t) => t.status === "running") || tools.find((t) => t.status === "preparing");
2822
+ let statusText;
2823
+ if (allDone) {
2824
+ if (errored > 0) {
2825
+ statusText = `Used ${total} tools \xB7 ${errored} failed`;
2826
+ } else {
2827
+ statusText = `Used ${total} tools`;
2828
+ }
2829
+ } else {
2830
+ const parts = [`Using ${total} tools`];
2831
+ if (completed > 0) parts.push(`${completed} done`);
2832
+ if (activeTool) {
2833
+ const activeLabel = activeTool.streamOutput || (activeTool.status === "preparing" ? "preparing" : "running");
2834
+ parts.push(`${activeTool.name} ${activeLabel === "preparing" || activeLabel === "running" ? activeLabel + "..." : "\xB7 " + activeLabel}`);
2835
+ }
2836
+ statusText = parts.join(" \xB7 ");
2837
+ }
2819
2838
  const cardClass = allDone ? errored > 0 ? "apteva-tool-group apteva-tool-group-error" : "apteva-tool-group apteva-tool-group-completed" : "apteva-tool-group apteva-tool-group-running";
2820
2839
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cardClass, children: [
2821
2840
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
@@ -2846,18 +2865,20 @@ function ToolCallGroup({ tools }) {
2846
2865
  ]
2847
2866
  }
2848
2867
  ),
2849
- !isExpanded && activeStreamTool && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "apteva-tool-group-stream", children: [
2850
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "apteva-tool-group-stream-name", children: [
2851
- activeStreamTool.name,
2852
- ":"
2853
- ] }),
2854
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "apteva-tool-group-stream-text", children: activeStreamTool.streamOutput })
2855
- ] }),
2856
- isExpanded && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "apteva-tool-group-list", children: tools.map((tool) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "apteva-tool-group-item", children: [
2857
- tool.status === "completed" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "apteva-tool-group-item-icon apteva-tool-group-item-done", width: "12", height: "12", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M5 13l4 4L19 7" }) }) : tool.status === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "apteva-tool-group-item-icon apteva-tool-group-item-error", width: "12", height: "12", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M6 18L18 6M6 6l12 12" }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "apteva-tool-group-item-icon apteva-tool-group-item-spinner" }),
2858
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "apteva-tool-group-item-name", children: tool.name }),
2859
- tool.streamOutput && tool.status === "running" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "apteva-tool-group-item-stream", children: tool.streamOutput })
2860
- ] }, tool.id)) })
2868
+ isExpanded && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "apteva-tool-group-list", children: tools.map((tool) => {
2869
+ const resultPreview = tool.status === "completed" && tool.result ? formatResultPreview(tool.result) : "";
2870
+ const hasDetail = tool.status === "running" && tool.streamOutput || resultPreview;
2871
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `apteva-tool-group-item ${hasDetail ? "apteva-tool-group-item-has-detail" : ""}`, children: [
2872
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "apteva-tool-group-item-row", children: [
2873
+ tool.status === "completed" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "apteva-tool-group-item-icon apteva-tool-group-item-done", width: "12", height: "12", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M5 13l4 4L19 7" }) }) : tool.status === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "apteva-tool-group-item-icon apteva-tool-group-item-error", width: "12", height: "12", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M6 18L18 6M6 6l12 12" }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "apteva-tool-group-item-icon apteva-tool-group-item-spinner" }),
2874
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "apteva-tool-group-item-name", children: tool.name }),
2875
+ tool.status === "running" && !tool.streamOutput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "apteva-tool-group-item-running-label", children: "running..." }),
2876
+ tool.status === "preparing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "apteva-tool-group-item-running-label", children: "preparing..." })
2877
+ ] }),
2878
+ tool.status === "running" && tool.streamOutput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "apteva-tool-group-item-detail", children: tool.streamOutput }),
2879
+ resultPreview && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "apteva-tool-group-item-detail apteva-tool-group-item-result-text", children: resultPreview })
2880
+ ] }, tool.id);
2881
+ }) })
2861
2882
  ] });
2862
2883
  }
2863
2884
 
@@ -3108,7 +3129,8 @@ function Message({ message, onAction, enableWidgets, onWidgetRender, persistentW
3108
3129
  name: tool.name,
3109
3130
  status: tool.status || (tool.result !== void 0 ? "completed" : "running"),
3110
3131
  isReceiving: tool.isReceiving,
3111
- streamOutput: tool.streamOutput
3132
+ streamOutput: tool.streamOutput,
3133
+ result: tool.result
3112
3134
  };
3113
3135
  });
3114
3136
  elements.push(