@apteva/apteva-kit 0.1.34 → 0.1.37

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
@@ -1232,27 +1232,20 @@ function ToolCall({ name, status }) {
1232
1232
  /* @__PURE__ */ jsx10("circle", { className: "apteva-tool-spinner-track", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
1233
1233
  /* @__PURE__ */ jsx10("path", { className: "apteva-tool-spinner-fill", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
1234
1234
  ] }),
1235
- /* @__PURE__ */ jsxs7("span", { className: "apteva-tool-label", children: [
1236
- "Calling ",
1237
- /* @__PURE__ */ jsx10("strong", { children: name }),
1238
- "..."
1239
- ] })
1235
+ /* @__PURE__ */ jsx10("span", { className: "apteva-tool-label", children: name })
1240
1236
  ] });
1241
1237
  }
1242
1238
  if (status === "completed") {
1243
1239
  return /* @__PURE__ */ jsxs7("div", { className: "apteva-tool-card apteva-tool-card-completed", children: [
1244
1240
  /* @__PURE__ */ jsx10("svg", { className: "apteva-tool-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }),
1245
- /* @__PURE__ */ jsxs7("span", { className: "apteva-tool-label", children: [
1246
- "Tool completed: ",
1247
- /* @__PURE__ */ jsx10("strong", { children: name })
1248
- ] })
1241
+ /* @__PURE__ */ jsx10("span", { className: "apteva-tool-label", children: name })
1249
1242
  ] });
1250
1243
  }
1251
1244
  return /* @__PURE__ */ jsxs7("div", { className: "apteva-tool-card apteva-tool-card-error", children: [
1252
1245
  /* @__PURE__ */ jsx10("svg", { className: "apteva-tool-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }),
1253
1246
  /* @__PURE__ */ jsxs7("span", { className: "apteva-tool-label", children: [
1254
- "Tool failed: ",
1255
- /* @__PURE__ */ jsx10("strong", { children: name })
1247
+ name,
1248
+ " failed"
1256
1249
  ] })
1257
1250
  ] });
1258
1251
  }
@@ -1325,23 +1318,48 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
1325
1318
  ] });
1326
1319
  }
1327
1320
  if (contentSegments && contentSegments.length > 0) {
1328
- return /* @__PURE__ */ jsx11("div", { children: contentSegments.map((segment, index) => {
1329
- if (segment.type === "text") {
1330
- return segment.content ? /* @__PURE__ */ jsx11("div", { children: renderTextContent(segment.content) }, `text-${index}`) : null;
1331
- } else if (segment.type === "tool") {
1332
- return /* @__PURE__ */ jsx11("div", { className: "my-2", children: /* @__PURE__ */ jsx11(
1321
+ return null;
1322
+ }
1323
+ return renderTextContent(message.content);
1324
+ };
1325
+ const renderSegmentedContent = () => {
1326
+ if (!contentSegments || contentSegments.length === 0) {
1327
+ return null;
1328
+ }
1329
+ const elements = [];
1330
+ contentSegments.forEach((segment, index) => {
1331
+ if (segment.type === "text" && segment.content) {
1332
+ elements.push(
1333
+ /* @__PURE__ */ jsx11(
1334
+ "div",
1335
+ {
1336
+ className: "apteva-message-bubble apteva-message-assistant",
1337
+ children: /* @__PURE__ */ jsx11("div", { className: "apteva-message-content-assistant", children: renderTextContent(segment.content) })
1338
+ },
1339
+ `text-${index}`
1340
+ )
1341
+ );
1342
+ } else if (segment.type === "tool") {
1343
+ elements.push(
1344
+ /* @__PURE__ */ jsx11("div", { className: "apteva-tool-call-standalone", children: /* @__PURE__ */ jsx11(
1333
1345
  ToolCall,
1334
1346
  {
1335
1347
  name: segment.name,
1336
1348
  status: segment.result !== void 0 ? "completed" : "running"
1337
1349
  }
1338
- ) }, segment.id);
1339
- }
1340
- return null;
1341
- }) });
1342
- }
1343
- return renderTextContent(message.content);
1350
+ ) }, segment.id)
1351
+ );
1352
+ }
1353
+ });
1354
+ return elements;
1344
1355
  };
1356
+ if (!isUser && contentSegments && contentSegments.length > 0) {
1357
+ return /* @__PURE__ */ jsxs8("div", { className: "apteva-message-segmented", children: [
1358
+ renderSegmentedContent(),
1359
+ message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx11("div", { className: "apteva-message-widgets", children: /* @__PURE__ */ jsx11(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
1360
+ /* @__PURE__ */ jsx11("div", { className: "apteva-message-timestamp apteva-message-timestamp-assistant", suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
1361
+ ] });
1362
+ }
1345
1363
  return /* @__PURE__ */ jsxs8(
1346
1364
  "div",
1347
1365
  {