@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.esm.js CHANGED
@@ -56535,7 +56535,9 @@ function AssistantTextContent(_ref) {
56535
56535
  var MessageBubble = function MessageBubble(_ref2) {
56536
56536
  var message = _ref2.message,
56537
56537
  isStreaming = _ref2.isStreaming,
56538
- streamingText = _ref2.streamingText;
56538
+ streamingText = _ref2.streamingText,
56539
+ _ref2$isLast = _ref2.isLast,
56540
+ isLast = _ref2$isLast === void 0 ? false : _ref2$isLast;
56539
56541
  var role = message.role,
56540
56542
  content = message.content,
56541
56543
  toolCalls = message.toolCalls;
@@ -56593,12 +56595,51 @@ var MessageBubble = function MessageBubble(_ref2) {
56593
56595
  } else if (typeof content === "string") {
56594
56596
  textParts.push(content);
56595
56597
  }
56598
+
56599
+ // Fallback: CLI backend (Claude Code) tracks tool calls on the
56600
+ // message's `toolCalls` field without placing tool_use blocks in
56601
+ // `content`. If we found no tool blocks in content but have toolCalls,
56602
+ // render those directly so the user sees what Claude is doing.
56603
+ if (toolBlocks.length === 0 && Array.isArray(toolCalls)) {
56604
+ var _iterator2 = _createForOfIteratorHelper$1(toolCalls),
56605
+ _step2;
56606
+ try {
56607
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
56608
+ var tc = _step2.value;
56609
+ toolBlocks.push({
56610
+ id: tc.toolUseId,
56611
+ name: tc.toolName,
56612
+ input: tc.input,
56613
+ serverName: tc.serverName,
56614
+ result: tc.result,
56615
+ isError: tc.isError,
56616
+ isLoading: tc.isLoading
56617
+ });
56618
+ }
56619
+ } catch (err) {
56620
+ _iterator2.e(err);
56621
+ } finally {
56622
+ _iterator2.f();
56623
+ }
56624
+ }
56596
56625
  var _text = textParts.join("");
56597
56626
 
56598
- // Hide empty assistant bubbles (e.g., tool-use-only responses from
56599
- // the CLI backend where content is [] and tool calls are tracked
56600
- // separately). Nothing useful to show the user.
56627
+ // Hide empty assistant bubbles (tool-use-only responses from the
56628
+ // CLI backend). But if this is the LAST message, show a thinking
56629
+ // indicator so the user knows the AI is working.
56601
56630
  if (!isStreaming && !_text && toolBlocks.length === 0) {
56631
+ if (isLast) {
56632
+ return /*#__PURE__*/jsxs("div", {
56633
+ className: "mb-4",
56634
+ children: [/*#__PURE__*/jsx("div", {
56635
+ className: "text-[10px] font-semibold uppercase tracking-wider text-gray-500 mb-1",
56636
+ children: "Assistant"
56637
+ }), /*#__PURE__*/jsx("div", {
56638
+ className: "text-sm leading-relaxed px-3 py-2 rounded-lg bg-gray-800/40 text-gray-500 italic",
56639
+ children: "Thinking..."
56640
+ })]
56641
+ });
56642
+ }
56602
56643
  return null;
56603
56644
  }
56604
56645
  return /*#__PURE__*/jsxs("div", {
@@ -56638,9 +56679,12 @@ var MessageBubble = function MessageBubble(_ref2) {
56638
56679
  * Scrollable message list that auto-scrolls to the bottom on new messages.
56639
56680
  */
56640
56681
  var ChatMessages = function ChatMessages(_ref) {
56682
+ var _messages;
56641
56683
  var messages = _ref.messages,
56642
56684
  streamingRequestId = _ref.streamingRequestId,
56643
- streamingText = _ref.streamingText;
56685
+ streamingText = _ref.streamingText,
56686
+ _ref$isLoading = _ref.isLoading,
56687
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading;
56644
56688
  var scrollRef = useRef(null);
56645
56689
  useEffect(function () {
56646
56690
  if (scrollRef.current) {
@@ -56661,18 +56705,46 @@ var ChatMessages = function ChatMessages(_ref) {
56661
56705
  })
56662
56706
  });
56663
56707
  }
56664
- return /*#__PURE__*/jsx("div", {
56708
+ return /*#__PURE__*/jsxs("div", {
56665
56709
  ref: scrollRef,
56666
56710
  className: "flex-1 overflow-y-auto px-4 py-3 scroll-smooth",
56667
- children: messages.map(function (message, index) {
56711
+ children: [messages.map(function (message, index) {
56668
56712
  var isLastAssistant = message.role === "assistant" && index === messages.length - 1;
56669
56713
  var isStreaming = isLastAssistant && streamingRequestId !== null;
56670
56714
  return /*#__PURE__*/jsx(MessageBubble, {
56671
56715
  message: message,
56672
56716
  isStreaming: isStreaming,
56673
- streamingText: isStreaming ? streamingText : ""
56717
+ streamingText: isStreaming ? streamingText : "",
56718
+ isLast: index === messages.length - 1
56674
56719
  }, message.id || index);
56675
- })
56720
+ }), isLoading && !streamingRequestId && ((_messages = messages[messages.length - 1]) === null || _messages === void 0 ? void 0 : _messages.role) === "user" && /*#__PURE__*/jsxs("div", {
56721
+ className: "mb-4",
56722
+ children: [/*#__PURE__*/jsx("div", {
56723
+ className: "text-[10px] font-semibold uppercase tracking-wider text-gray-500 mb-1",
56724
+ children: "Assistant"
56725
+ }), /*#__PURE__*/jsxs("div", {
56726
+ className: "text-sm leading-relaxed px-3 py-2 rounded-lg bg-gray-800/40 text-gray-500 italic flex items-center gap-2",
56727
+ children: [/*#__PURE__*/jsxs("span", {
56728
+ className: "inline-flex gap-0.5",
56729
+ children: [/*#__PURE__*/jsx("span", {
56730
+ className: "w-1.5 h-1.5 bg-gray-500 rounded-full animate-bounce",
56731
+ style: {
56732
+ animationDelay: "0ms"
56733
+ }
56734
+ }), /*#__PURE__*/jsx("span", {
56735
+ className: "w-1.5 h-1.5 bg-gray-500 rounded-full animate-bounce",
56736
+ style: {
56737
+ animationDelay: "150ms"
56738
+ }
56739
+ }), /*#__PURE__*/jsx("span", {
56740
+ className: "w-1.5 h-1.5 bg-gray-500 rounded-full animate-bounce",
56741
+ style: {
56742
+ animationDelay: "300ms"
56743
+ }
56744
+ })]
56745
+ }), "Thinking..."]
56746
+ })]
56747
+ })]
56676
56748
  });
56677
56749
  };
56678
56750
 
@@ -57006,6 +57078,13 @@ function ChatCore(_ref) {
57006
57078
  tc.isError = data.isError;
57007
57079
  tc.isLoading = false;
57008
57080
  }
57081
+ // Force re-render so MessageBubble picks up the updated tool
57082
+ // result state (isLoading=false, result populated). Can't rely on
57083
+ // setStreamingText since it may already be empty (tool-only
57084
+ // response from CLI backend).
57085
+ setMessages(function (prev) {
57086
+ return _toConsumableArray(prev);
57087
+ });
57009
57088
  setStreamingText("");
57010
57089
  if (onPublishEvent) {
57011
57090
  onPublishEvent("toolUsed", {
@@ -57311,7 +57390,8 @@ function ChatCore(_ref) {
57311
57390
  }), /*#__PURE__*/jsx(ChatMessages, {
57312
57391
  messages: messages,
57313
57392
  streamingRequestId: isLoading ? activeRequestId.current : null,
57314
- streamingText: streamingText
57393
+ streamingText: streamingText,
57394
+ isLoading: isLoading
57315
57395
  }), /*#__PURE__*/jsx(ChatInput, {
57316
57396
  onSend: handleSend,
57317
57397
  onStop: handleStop,