@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.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,7 +56595,53 @@ 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("");
56626
+
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.
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
+ }
56643
+ return null;
56644
+ }
56597
56645
  return /*#__PURE__*/jsxs("div", {
56598
56646
  className: "mb-4",
56599
56647
  children: [/*#__PURE__*/jsx("div", {
@@ -56631,9 +56679,12 @@ var MessageBubble = function MessageBubble(_ref2) {
56631
56679
  * Scrollable message list that auto-scrolls to the bottom on new messages.
56632
56680
  */
56633
56681
  var ChatMessages = function ChatMessages(_ref) {
56682
+ var _messages;
56634
56683
  var messages = _ref.messages,
56635
56684
  streamingRequestId = _ref.streamingRequestId,
56636
- streamingText = _ref.streamingText;
56685
+ streamingText = _ref.streamingText,
56686
+ _ref$isLoading = _ref.isLoading,
56687
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading;
56637
56688
  var scrollRef = useRef(null);
56638
56689
  useEffect(function () {
56639
56690
  if (scrollRef.current) {
@@ -56654,18 +56705,46 @@ var ChatMessages = function ChatMessages(_ref) {
56654
56705
  })
56655
56706
  });
56656
56707
  }
56657
- return /*#__PURE__*/jsx("div", {
56708
+ return /*#__PURE__*/jsxs("div", {
56658
56709
  ref: scrollRef,
56659
56710
  className: "flex-1 overflow-y-auto px-4 py-3 scroll-smooth",
56660
- children: messages.map(function (message, index) {
56711
+ children: [messages.map(function (message, index) {
56661
56712
  var isLastAssistant = message.role === "assistant" && index === messages.length - 1;
56662
56713
  var isStreaming = isLastAssistant && streamingRequestId !== null;
56663
56714
  return /*#__PURE__*/jsx(MessageBubble, {
56664
56715
  message: message,
56665
56716
  isStreaming: isStreaming,
56666
- streamingText: isStreaming ? streamingText : ""
56717
+ streamingText: isStreaming ? streamingText : "",
56718
+ isLast: index === messages.length - 1
56667
56719
  }, message.id || index);
56668
- })
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
+ })]
56669
56748
  });
56670
56749
  };
56671
56750
 
@@ -56999,6 +57078,13 @@ function ChatCore(_ref) {
56999
57078
  tc.isError = data.isError;
57000
57079
  tc.isLoading = false;
57001
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
+ });
57002
57088
  setStreamingText("");
57003
57089
  if (onPublishEvent) {
57004
57090
  onPublishEvent("toolUsed", {
@@ -57304,7 +57390,8 @@ function ChatCore(_ref) {
57304
57390
  }), /*#__PURE__*/jsx(ChatMessages, {
57305
57391
  messages: messages,
57306
57392
  streamingRequestId: isLoading ? activeRequestId.current : null,
57307
- streamingText: streamingText
57393
+ streamingText: streamingText,
57394
+ isLoading: isLoading
57308
57395
  }), /*#__PURE__*/jsx(ChatInput, {
57309
57396
  onSend: handleSend,
57310
57397
  onStop: handleStop,