@trops/dash-core 0.1.380 → 0.1.381

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
@@ -56553,7 +56553,9 @@ function AssistantTextContent(_ref) {
56553
56553
  var MessageBubble = function MessageBubble(_ref2) {
56554
56554
  var message = _ref2.message,
56555
56555
  isStreaming = _ref2.isStreaming,
56556
- streamingText = _ref2.streamingText;
56556
+ streamingText = _ref2.streamingText,
56557
+ _ref2$isLast = _ref2.isLast,
56558
+ isLast = _ref2$isLast === void 0 ? false : _ref2$isLast;
56557
56559
  var role = message.role,
56558
56560
  content = message.content,
56559
56561
  toolCalls = message.toolCalls;
@@ -56611,12 +56613,51 @@ var MessageBubble = function MessageBubble(_ref2) {
56611
56613
  } else if (typeof content === "string") {
56612
56614
  textParts.push(content);
56613
56615
  }
56616
+
56617
+ // Fallback: CLI backend (Claude Code) tracks tool calls on the
56618
+ // message's `toolCalls` field without placing tool_use blocks in
56619
+ // `content`. If we found no tool blocks in content but have toolCalls,
56620
+ // render those directly so the user sees what Claude is doing.
56621
+ if (toolBlocks.length === 0 && Array.isArray(toolCalls)) {
56622
+ var _iterator2 = _createForOfIteratorHelper$1(toolCalls),
56623
+ _step2;
56624
+ try {
56625
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
56626
+ var tc = _step2.value;
56627
+ toolBlocks.push({
56628
+ id: tc.toolUseId,
56629
+ name: tc.toolName,
56630
+ input: tc.input,
56631
+ serverName: tc.serverName,
56632
+ result: tc.result,
56633
+ isError: tc.isError,
56634
+ isLoading: tc.isLoading
56635
+ });
56636
+ }
56637
+ } catch (err) {
56638
+ _iterator2.e(err);
56639
+ } finally {
56640
+ _iterator2.f();
56641
+ }
56642
+ }
56614
56643
  var _text = textParts.join("");
56615
56644
 
56616
- // Hide empty assistant bubbles (e.g., tool-use-only responses from
56617
- // the CLI backend where content is [] and tool calls are tracked
56618
- // separately). Nothing useful to show the user.
56645
+ // Hide empty assistant bubbles (tool-use-only responses from the
56646
+ // CLI backend). But if this is the LAST message, show a thinking
56647
+ // indicator so the user knows the AI is working.
56619
56648
  if (!isStreaming && !_text && toolBlocks.length === 0) {
56649
+ if (isLast) {
56650
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
56651
+ className: "mb-4",
56652
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
56653
+ className: "text-[10px] font-semibold uppercase tracking-wider text-gray-500 mb-1",
56654
+ children: "Assistant"
56655
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
56656
+ className: "text-sm leading-relaxed px-3 py-2 rounded-lg bg-gray-800/40 text-gray-500 italic",
56657
+ children: "Thinking..."
56658
+ })]
56659
+ });
56660
+ }
56620
56661
  return null;
56621
56662
  }
56622
56663
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -56656,9 +56697,12 @@ var MessageBubble = function MessageBubble(_ref2) {
56656
56697
  * Scrollable message list that auto-scrolls to the bottom on new messages.
56657
56698
  */
56658
56699
  var ChatMessages = function ChatMessages(_ref) {
56700
+ var _messages;
56659
56701
  var messages = _ref.messages,
56660
56702
  streamingRequestId = _ref.streamingRequestId,
56661
- streamingText = _ref.streamingText;
56703
+ streamingText = _ref.streamingText,
56704
+ _ref$isLoading = _ref.isLoading,
56705
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading;
56662
56706
  var scrollRef = React.useRef(null);
56663
56707
  React.useEffect(function () {
56664
56708
  if (scrollRef.current) {
@@ -56679,18 +56723,46 @@ var ChatMessages = function ChatMessages(_ref) {
56679
56723
  })
56680
56724
  });
56681
56725
  }
56682
- return /*#__PURE__*/jsxRuntime.jsx("div", {
56726
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
56683
56727
  ref: scrollRef,
56684
56728
  className: "flex-1 overflow-y-auto px-4 py-3 scroll-smooth",
56685
- children: messages.map(function (message, index) {
56729
+ children: [messages.map(function (message, index) {
56686
56730
  var isLastAssistant = message.role === "assistant" && index === messages.length - 1;
56687
56731
  var isStreaming = isLastAssistant && streamingRequestId !== null;
56688
56732
  return /*#__PURE__*/jsxRuntime.jsx(MessageBubble, {
56689
56733
  message: message,
56690
56734
  isStreaming: isStreaming,
56691
- streamingText: isStreaming ? streamingText : ""
56735
+ streamingText: isStreaming ? streamingText : "",
56736
+ isLast: index === messages.length - 1
56692
56737
  }, message.id || index);
56693
- })
56738
+ }), isLoading && !streamingRequestId && ((_messages = messages[messages.length - 1]) === null || _messages === void 0 ? void 0 : _messages.role) === "user" && /*#__PURE__*/jsxRuntime.jsxs("div", {
56739
+ className: "mb-4",
56740
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
56741
+ className: "text-[10px] font-semibold uppercase tracking-wider text-gray-500 mb-1",
56742
+ children: "Assistant"
56743
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
56744
+ className: "text-sm leading-relaxed px-3 py-2 rounded-lg bg-gray-800/40 text-gray-500 italic flex items-center gap-2",
56745
+ children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
56746
+ className: "inline-flex gap-0.5",
56747
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
56748
+ className: "w-1.5 h-1.5 bg-gray-500 rounded-full animate-bounce",
56749
+ style: {
56750
+ animationDelay: "0ms"
56751
+ }
56752
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
56753
+ className: "w-1.5 h-1.5 bg-gray-500 rounded-full animate-bounce",
56754
+ style: {
56755
+ animationDelay: "150ms"
56756
+ }
56757
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
56758
+ className: "w-1.5 h-1.5 bg-gray-500 rounded-full animate-bounce",
56759
+ style: {
56760
+ animationDelay: "300ms"
56761
+ }
56762
+ })]
56763
+ }), "Thinking..."]
56764
+ })]
56765
+ })]
56694
56766
  });
56695
56767
  };
56696
56768
 
@@ -57024,6 +57096,13 @@ function ChatCore(_ref) {
57024
57096
  tc.isError = data.isError;
57025
57097
  tc.isLoading = false;
57026
57098
  }
57099
+ // Force re-render so MessageBubble picks up the updated tool
57100
+ // result state (isLoading=false, result populated). Can't rely on
57101
+ // setStreamingText since it may already be empty (tool-only
57102
+ // response from CLI backend).
57103
+ setMessages(function (prev) {
57104
+ return _toConsumableArray(prev);
57105
+ });
57027
57106
  setStreamingText("");
57028
57107
  if (onPublishEvent) {
57029
57108
  onPublishEvent("toolUsed", {
@@ -57329,7 +57408,8 @@ function ChatCore(_ref) {
57329
57408
  }), /*#__PURE__*/jsxRuntime.jsx(ChatMessages, {
57330
57409
  messages: messages,
57331
57410
  streamingRequestId: isLoading ? activeRequestId.current : null,
57332
- streamingText: streamingText
57411
+ streamingText: streamingText,
57412
+ isLoading: isLoading
57333
57413
  }), /*#__PURE__*/jsxRuntime.jsx(ChatInput, {
57334
57414
  onSend: handleSend,
57335
57415
  onStop: handleStop,