@apteva/apteva-kit 0.1.23 → 0.1.25

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
@@ -594,14 +594,16 @@ function parseWidgetsFromText(text) {
594
594
  }
595
595
  try {
596
596
  const trimmedJson = jsonContent.trim();
597
- const props = JSON.parse(trimmedJson);
597
+ const parsed = JSON.parse(trimmedJson);
598
598
  const widgetId = `widget-${widgetType}-${simpleHash(trimmedJson)}`;
599
+ const { meta, ...props } = parsed;
599
600
  segments.push({
600
601
  type: "widget",
601
602
  widget: {
602
603
  type: widgetType,
603
604
  id: widgetId,
604
- props
605
+ props,
606
+ ...meta && { meta }
605
607
  }
606
608
  });
607
609
  hasWidgets = true;
@@ -1275,12 +1277,12 @@ function MarkdownContent({ content, className = "" }) {
1275
1277
  import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
1276
1278
  function ToolCall({ name, status }) {
1277
1279
  if (status === "running") {
1278
- return /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2 px-3 py-2 rounded-xl bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-700 !text-blue-700 dark:!text-blue-300 text-sm", children: [
1279
- /* @__PURE__ */ jsxs7("svg", { className: "w-4 h-4 animate-spin", fill: "none", viewBox: "0 0 24 24", children: [
1280
- /* @__PURE__ */ jsx10("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
1281
- /* @__PURE__ */ jsx10("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
1280
+ return /* @__PURE__ */ jsxs7("div", { className: "apteva-tool-card apteva-tool-card-running", children: [
1281
+ /* @__PURE__ */ jsxs7("svg", { className: "apteva-tool-icon apteva-tool-icon-spin", fill: "none", viewBox: "0 0 24 24", children: [
1282
+ /* @__PURE__ */ jsx10("circle", { className: "apteva-tool-spinner-track", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
1283
+ /* @__PURE__ */ jsx10("path", { className: "apteva-tool-spinner-fill", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
1282
1284
  ] }),
1283
- /* @__PURE__ */ jsxs7("span", { children: [
1285
+ /* @__PURE__ */ jsxs7("span", { className: "apteva-tool-label", children: [
1284
1286
  "Calling ",
1285
1287
  /* @__PURE__ */ jsx10("strong", { children: name }),
1286
1288
  "..."
@@ -1288,17 +1290,17 @@ function ToolCall({ name, status }) {
1288
1290
  ] });
1289
1291
  }
1290
1292
  if (status === "completed") {
1291
- return /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2 px-3 py-2 rounded-xl bg-green-50 dark:bg-green-900/30 border border-green-200 dark:border-green-700 !text-green-700 dark:!text-green-300 text-sm", children: [
1292
- /* @__PURE__ */ jsx10("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }),
1293
- /* @__PURE__ */ jsxs7("span", { children: [
1293
+ return /* @__PURE__ */ jsxs7("div", { className: "apteva-tool-card apteva-tool-card-completed", children: [
1294
+ /* @__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" }) }),
1295
+ /* @__PURE__ */ jsxs7("span", { className: "apteva-tool-label", children: [
1294
1296
  "Tool completed: ",
1295
1297
  /* @__PURE__ */ jsx10("strong", { children: name })
1296
1298
  ] })
1297
1299
  ] });
1298
1300
  }
1299
- return /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2 px-3 py-2 rounded-xl bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-700 !text-red-700 dark:!text-red-300 text-sm", children: [
1300
- /* @__PURE__ */ jsx10("svg", { className: "w-4 h-4", 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" }) }),
1301
- /* @__PURE__ */ jsxs7("span", { children: [
1301
+ return /* @__PURE__ */ jsxs7("div", { className: "apteva-tool-card apteva-tool-card-error", children: [
1302
+ /* @__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" }) }),
1303
+ /* @__PURE__ */ jsxs7("span", { className: "apteva-tool-label", children: [
1302
1304
  "Tool failed: ",
1303
1305
  /* @__PURE__ */ jsx10("strong", { children: name })
1304
1306
  ] })
@@ -1363,10 +1365,10 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
1363
1365
  };
1364
1366
  const renderContent = () => {
1365
1367
  if (isUser) {
1366
- return /* @__PURE__ */ jsx11("div", { className: "whitespace-pre-wrap !text-sm leading-relaxed", children: message.content });
1368
+ return /* @__PURE__ */ jsx11("div", { className: "apteva-message-text", children: message.content });
1367
1369
  }
1368
1370
  if (isStreaming && !hasContent) {
1369
- return /* @__PURE__ */ jsxs8("div", { className: "apteva-typing-indicator !text-gray-400", children: [
1371
+ return /* @__PURE__ */ jsxs8("div", { className: "apteva-typing-indicator", children: [
1370
1372
  /* @__PURE__ */ jsx11("span", {}),
1371
1373
  /* @__PURE__ */ jsx11("span", {}),
1372
1374
  /* @__PURE__ */ jsx11("span", {})
@@ -1394,13 +1396,13 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
1394
1396
  "div",
1395
1397
  {
1396
1398
  className: cn(
1397
- "max-w-[80%] px-4 py-2.5 rounded-2xl",
1398
- isUser ? "bg-blue-600 !text-white rounded-br-md" : "bg-gray-100 dark:bg-gray-800 !text-gray-900 dark:!text-gray-100 rounded-bl-md"
1399
+ "apteva-message-bubble",
1400
+ isUser ? "apteva-message-user" : "apteva-message-assistant"
1399
1401
  ),
1400
1402
  children: [
1401
- renderContent(),
1402
- message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx11("div", { className: cn(isUser ? "mt-3" : "mt-2"), children: /* @__PURE__ */ jsx11(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
1403
- /* @__PURE__ */ jsx11("div", { className: cn("!text-xs mt-1.5", isUser ? "!text-blue-200" : "!text-gray-500 dark:!text-gray-400"), suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
1403
+ /* @__PURE__ */ jsx11("div", { className: isUser ? "apteva-message-content-user" : "apteva-message-content-assistant", children: renderContent() }),
1404
+ message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx11("div", { className: "apteva-message-widgets", children: /* @__PURE__ */ jsx11(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
1405
+ /* @__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" }) })
1404
1406
  ]
1405
1407
  }
1406
1408
  );
@@ -1567,7 +1569,7 @@ function MessageList({
1567
1569
  listRef.current.scrollTop = listRef.current.scrollHeight;
1568
1570
  }
1569
1571
  }, [messages]);
1570
- return /* @__PURE__ */ jsx13("div", { ref: listRef, className: "flex-1 overflow-y-auto px-4 py-4 space-y-3 apteva-scrollbar-hidden", children: messages.length === 0 ? /* @__PURE__ */ jsx13(
1572
+ return /* @__PURE__ */ jsx13("div", { ref: listRef, className: "apteva-message-list apteva-scrollbar-hidden", children: messages.length === 0 ? /* @__PURE__ */ jsx13(
1571
1573
  WelcomeScreen,
1572
1574
  {
1573
1575
  title: welcomeTitle,
@@ -1578,7 +1580,7 @@ function MessageList({
1578
1580
  onPromptClick: onPromptClick || (() => {
1579
1581
  })
1580
1582
  }
1581
- ) : messages.map((message) => /* @__PURE__ */ jsx13("div", { className: `flex ${message.role === "user" ? "justify-end" : "justify-start"}`, children: /* @__PURE__ */ jsx13(Message, { message, onAction, enableWidgets, onWidgetRender }) }, message.id)) });
1583
+ ) : messages.map((message) => /* @__PURE__ */ jsx13("div", { className: message.role === "user" ? "apteva-message-row-user" : "apteva-message-row-assistant", children: /* @__PURE__ */ jsx13(Message, { message, onAction, enableWidgets, onWidgetRender }) }, message.id)) });
1582
1584
  }
1583
1585
 
1584
1586
  // src/components/Chat/Composer.tsx