@trops/dash-core 0.1.379 → 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,7 +56613,53 @@ 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("");
56644
+
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.
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
+ }
56661
+ return null;
56662
+ }
56615
56663
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
56616
56664
  className: "mb-4",
56617
56665
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -56649,9 +56697,12 @@ var MessageBubble = function MessageBubble(_ref2) {
56649
56697
  * Scrollable message list that auto-scrolls to the bottom on new messages.
56650
56698
  */
56651
56699
  var ChatMessages = function ChatMessages(_ref) {
56700
+ var _messages;
56652
56701
  var messages = _ref.messages,
56653
56702
  streamingRequestId = _ref.streamingRequestId,
56654
- streamingText = _ref.streamingText;
56703
+ streamingText = _ref.streamingText,
56704
+ _ref$isLoading = _ref.isLoading,
56705
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading;
56655
56706
  var scrollRef = React.useRef(null);
56656
56707
  React.useEffect(function () {
56657
56708
  if (scrollRef.current) {
@@ -56672,18 +56723,46 @@ var ChatMessages = function ChatMessages(_ref) {
56672
56723
  })
56673
56724
  });
56674
56725
  }
56675
- return /*#__PURE__*/jsxRuntime.jsx("div", {
56726
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
56676
56727
  ref: scrollRef,
56677
56728
  className: "flex-1 overflow-y-auto px-4 py-3 scroll-smooth",
56678
- children: messages.map(function (message, index) {
56729
+ children: [messages.map(function (message, index) {
56679
56730
  var isLastAssistant = message.role === "assistant" && index === messages.length - 1;
56680
56731
  var isStreaming = isLastAssistant && streamingRequestId !== null;
56681
56732
  return /*#__PURE__*/jsxRuntime.jsx(MessageBubble, {
56682
56733
  message: message,
56683
56734
  isStreaming: isStreaming,
56684
- streamingText: isStreaming ? streamingText : ""
56735
+ streamingText: isStreaming ? streamingText : "",
56736
+ isLast: index === messages.length - 1
56685
56737
  }, message.id || index);
56686
- })
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
+ })]
56687
56766
  });
56688
56767
  };
56689
56768
 
@@ -57017,6 +57096,13 @@ function ChatCore(_ref) {
57017
57096
  tc.isError = data.isError;
57018
57097
  tc.isLoading = false;
57019
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
+ });
57020
57106
  setStreamingText("");
57021
57107
  if (onPublishEvent) {
57022
57108
  onPublishEvent("toolUsed", {
@@ -57322,7 +57408,8 @@ function ChatCore(_ref) {
57322
57408
  }), /*#__PURE__*/jsxRuntime.jsx(ChatMessages, {
57323
57409
  messages: messages,
57324
57410
  streamingRequestId: isLoading ? activeRequestId.current : null,
57325
- streamingText: streamingText
57411
+ streamingText: streamingText,
57412
+ isLoading: isLoading
57326
57413
  }), /*#__PURE__*/jsxRuntime.jsx(ChatInput, {
57327
57414
  onSend: handleSend,
57328
57415
  onStop: handleStop,