@trops/dash-core 0.1.756 → 0.1.758

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
@@ -56769,70 +56769,6 @@ var PlanSketch = function PlanSketch(_ref) {
56769
56769
  });
56770
56770
  };
56771
56771
 
56772
- function useBubbleTokens() {
56773
- var _ref = React.useContext(DashReact.ThemeContext) || {},
56774
- currentTheme = _ref.currentTheme;
56775
- return {
56776
- reply: (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-secondary-dark"]) || (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary-dark"]) || "",
56777
- you: (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary-medium"]) || "",
56778
- text: (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["text-primary-medium"]) || ""
56779
- };
56780
- }
56781
-
56782
- /** What the user said, right-aligned. */
56783
- var YouBubble = function YouBubble(_ref2) {
56784
- var children = _ref2.children;
56785
- var t = useBubbleTokens();
56786
- return /*#__PURE__*/jsxRuntime.jsx("div", {
56787
- className: "flex justify-end",
56788
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
56789
- className: "max-w-xl",
56790
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
56791
- block: true,
56792
- className: "font-semibold uppercase tracking-wider mb-1 text-right",
56793
- children: "You"
56794
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
56795
- className: "px-3 py-2 rounded-lg text-sm whitespace-pre-wrap break-words leading-relaxed ".concat(t.you, " ").concat(t.text),
56796
- children: children
56797
- })]
56798
- })
56799
- });
56800
- };
56801
-
56802
- /**
56803
- * A team member's reply: its label ("Planner"), an optional meta line
56804
- * (model · tokens), the text, and anything below it (a button).
56805
- */
56806
- var TeamBubble = function TeamBubble(_ref3) {
56807
- var _ref3$label = _ref3.label,
56808
- label = _ref3$label === void 0 ? "Planner" : _ref3$label,
56809
- _ref3$meta = _ref3.meta,
56810
- meta = _ref3$meta === void 0 ? null : _ref3$meta,
56811
- _ref3$muted = _ref3.muted,
56812
- muted = _ref3$muted === void 0 ? false : _ref3$muted,
56813
- testId = _ref3.testId,
56814
- children = _ref3.children,
56815
- _ref3$footer = _ref3.footer,
56816
- footer = _ref3$footer === void 0 ? null : _ref3$footer;
56817
- var t = useBubbleTokens();
56818
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
56819
- className: "flex flex-col gap-1",
56820
- "data-testid": testId,
56821
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
56822
- className: "flex flex-row items-center gap-2",
56823
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
56824
- className: "font-semibold uppercase tracking-wider",
56825
- children: label
56826
- }), meta ? /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
56827
- children: meta
56828
- }) : null]
56829
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
56830
- className: "px-3 py-2 rounded-lg text-sm whitespace-pre-wrap break-words leading-relaxed ".concat(t.reply, " ").concat(t.text, " ").concat(muted ? "opacity-70 italic" : ""),
56831
- children: children
56832
- }), footer]
56833
- });
56834
- };
56835
-
56836
56772
  function ownKeys$J(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
56837
56773
  function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$J(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$J(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
56838
56774
  function reopenedRequest(original, plan, text) {
@@ -57406,19 +57342,30 @@ var CreatePlanStep = function CreatePlanStep(_ref2) {
57406
57342
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
57407
57343
  className: "mx-auto w-full max-w-3xl flex flex-col ".concat(compact ? "gap-3 px-3 py-3" : "gap-4 px-6 py-8"),
57408
57344
  children: [messages.map(function (m, i) {
57409
- return m.who === "you" ? /*#__PURE__*/jsxRuntime.jsx(YouBubble, {
57345
+ return m.who === "you" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
57346
+ role: "you",
57410
57347
  children: m.text
57411
- }, i) : m.who === "note" ? /*#__PURE__*/jsxRuntime.jsx("span", {
57412
- className: "text-xs ".concat(muted),
57348
+ }, i) : m.who === "note" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
57349
+ role: "note",
57413
57350
  children: m.text
57414
- }, i) : /*#__PURE__*/jsxRuntime.jsx(TeamBubble, {
57351
+ }, i) : /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
57352
+ role: "reply",
57353
+ label: "Planner",
57415
57354
  meta: m.meta,
57416
57355
  testId: "planner-message",
57417
- children: m.text
57356
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
57357
+ className: "whitespace-pre-wrap",
57358
+ children: m.text
57359
+ })
57418
57360
  }, i);
57419
- }), busy ? /*#__PURE__*/jsxRuntime.jsx(TeamBubble, {
57420
- muted: true,
57421
- children: withoutPlan(soFar) || "Thinking…"
57361
+ }), busy ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
57362
+ role: "reply",
57363
+ label: "Planner",
57364
+ streaming: true,
57365
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
57366
+ className: "whitespace-pre-wrap",
57367
+ children: withoutPlan(soFar) || "Thinking…"
57368
+ })
57422
57369
  }) : null, !busy && questions.length ? /*#__PURE__*/jsxRuntime.jsxs("div", {
57423
57370
  className: "flex flex-col gap-3",
57424
57371
  "data-testid": "plan-questions",
@@ -57682,33 +57629,22 @@ var CreatePlanStep = function CreatePlanStep(_ref2) {
57682
57629
  setWalking(false);
57683
57630
  }
57684
57631
  }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
57685
- className: "flex-shrink-0 border-t ".concat(hairline),
57686
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
57687
- className: "mx-auto w-full max-w-3xl flex flex-row items-end gap-2 ".concat(compact ? "px-3 py-2" : "px-6 py-3"),
57688
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
57689
- className: "flex-1",
57690
- children: /*#__PURE__*/jsxRuntime.jsx(DashReact.TextArea, {
57691
- "aria-label": "Reply to the Planner",
57692
- value: reply,
57693
- onChange: function onChange(v) {
57694
- return setReply(v);
57695
- },
57696
- placeholder: busy ? "The Planner is working…" : "Answer, or ask for changes…",
57697
- rows: 2,
57698
- onKeyDown: function onKeyDown(e) {
57699
- if (e.key === "Enter" && !e.shiftKey) {
57700
- e.preventDefault();
57701
- answer(reply);
57702
- }
57703
- }
57704
- })
57705
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
57706
- title: "Send",
57707
- onClick: function onClick() {
57632
+ className: "flex-shrink-0",
57633
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
57634
+ className: "mx-auto w-full max-w-3xl",
57635
+ children: /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatComposer, {
57636
+ ariaLabel: "Reply to the Planner",
57637
+ value: reply,
57638
+ onChange: function onChange(v) {
57639
+ return setReply(v);
57640
+ },
57641
+ onSend: function onSend() {
57708
57642
  return answer(reply);
57709
57643
  },
57710
- disabled: busy || !reply.trim()
57711
- })]
57644
+ busy: busy,
57645
+ placeholder: busy ? "The Planner is working…" : "Answer, or ask for changes…",
57646
+ className: compact ? "" : "px-6 py-3"
57647
+ })
57712
57648
  })
57713
57649
  })]
57714
57650
  });
@@ -58590,9 +58526,6 @@ var AskStep = function AskStep(_ref) {
58590
58526
  recentId = _ref$recentId === void 0 ? null : _ref$recentId,
58591
58527
  _ref$onOpenPlan = _ref.onOpenPlan,
58592
58528
  onOpenPlan = _ref$onOpenPlan === void 0 ? null : _ref$onOpenPlan;
58593
- var _useConfigTokens = useConfigTokens(),
58594
- muted = _useConfigTokens.muted,
58595
- hairline = _useConfigTokens.hairline;
58596
58529
  // [{ who: "you" | "planner" | "note", text, meta?, plan? }]
58597
58530
  var _useState = React.useState(recentId ? [] : [{
58598
58531
  who: "you",
@@ -58776,56 +58709,51 @@ var AskStep = function AskStep(_ref) {
58776
58709
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
58777
58710
  className: "flex flex-col gap-3 px-3 py-3",
58778
58711
  children: [messages.map(function (m, i) {
58779
- return m.who === "you" ? /*#__PURE__*/jsxRuntime.jsx(YouBubble, {
58712
+ return m.who === "you" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
58713
+ role: "you",
58780
58714
  children: m.text
58781
- }, i) : m.who === "note" ? /*#__PURE__*/jsxRuntime.jsx("span", {
58782
- className: "text-xs ".concat(muted),
58715
+ }, i) : m.who === "note" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
58716
+ role: "note",
58783
58717
  children: m.text
58784
- }, i) : /*#__PURE__*/jsxRuntime.jsx(TeamBubble, {
58718
+ }, i) : /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
58719
+ role: "reply",
58720
+ label: "Planner",
58785
58721
  meta: m.meta,
58786
58722
  testId: "ask-answer",
58787
- footer: m.plan && onOpenPlan ? /*#__PURE__*/jsxRuntime.jsx("div", {
58788
- children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Button3, {
58789
- size: "sm",
58790
- title: "Open as a plan",
58791
- onClick: function onClick() {
58792
- return onOpenPlan(planSeed(m.asked, m.plan));
58793
- }
58794
- })
58723
+ footer: m.plan && onOpenPlan ? /*#__PURE__*/jsxRuntime.jsx(DashReact.Button3, {
58724
+ size: "sm",
58725
+ title: "Open as a plan",
58726
+ onClick: function onClick() {
58727
+ return onOpenPlan(planSeed(m.asked, m.plan));
58728
+ }
58795
58729
  }) : null,
58796
- children: m.text
58730
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
58731
+ className: "whitespace-pre-wrap",
58732
+ children: m.text
58733
+ })
58797
58734
  }, i);
58798
- }), busy ? /*#__PURE__*/jsxRuntime.jsx(TeamBubble, {
58799
- muted: true,
58800
- children: withoutPlan(soFar) || "Looking…"
58735
+ }), busy ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
58736
+ role: "reply",
58737
+ label: "Planner",
58738
+ streaming: true,
58739
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
58740
+ className: "whitespace-pre-wrap",
58741
+ children: withoutPlan(soFar) || "Looking…"
58742
+ })
58801
58743
  }) : null]
58802
58744
  })
58803
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
58804
- className: "flex-shrink-0 flex flex-row items-end gap-2 px-3 py-2 border-t ".concat(hairline),
58805
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
58806
- className: "flex-1",
58807
- children: /*#__PURE__*/jsxRuntime.jsx(DashReact.TextArea, {
58808
- "aria-label": "Ask a follow-up",
58809
- value: reply,
58810
- onChange: function onChange(v) {
58811
- return setReply(v);
58812
- },
58813
- placeholder: busy ? "The Planner is looking…" : "Ask a follow-up…",
58814
- rows: 2,
58815
- onKeyDown: function onKeyDown(e) {
58816
- if (e.key === "Enter" && !e.shiftKey) {
58817
- e.preventDefault();
58818
- send(reply);
58819
- }
58820
- }
58821
- })
58822
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
58823
- title: "Send",
58824
- onClick: function onClick() {
58825
- return send(reply);
58826
- },
58827
- disabled: busy || !reply.trim()
58828
- })]
58745
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatComposer, {
58746
+ ariaLabel: "Ask a follow-up",
58747
+ value: reply,
58748
+ onChange: function onChange(v) {
58749
+ return setReply(v);
58750
+ },
58751
+ onSend: function onSend() {
58752
+ return send(reply);
58753
+ },
58754
+ busy: busy,
58755
+ placeholder: busy ? "The Planner is looking…" : "Ask a follow-up…",
58756
+ className: "flex-shrink-0"
58829
58757
  })]
58830
58758
  });
58831
58759
  };
@@ -81549,6 +81477,7 @@ var ThemesPage = function ThemesPage(_ref2) {
81549
81477
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
81550
81478
  icon: "sun"
81551
81479
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Switch, {
81480
+ ariaLabel: "Dark mode",
81552
81481
  checked: themeVariant === "dark",
81553
81482
  onChange: function onChange(isDark) {
81554
81483
  return changeThemeVariant && changeThemeVariant(isDark ? "dark" : "light");
@@ -87822,6 +87751,15 @@ var StreamingText = function StreamingText(_ref) {
87822
87751
  });
87823
87752
  };
87824
87753
 
87754
+ /**
87755
+ * ToolCallBlock
87756
+ *
87757
+ * One MCP tool call in a chat, drawn with dash-react's ChatToolCall: status
87758
+ * dot, tool name, where it ran, and a disclosure with the input and result.
87759
+ */
87760
+ var pretty = function pretty(v) {
87761
+ return typeof v === "string" ? v : JSON.stringify(v, null, 2);
87762
+ };
87825
87763
  var ToolCallBlock = function ToolCallBlock(_ref) {
87826
87764
  var toolName = _ref.toolName,
87827
87765
  serverName = _ref.serverName,
@@ -87829,62 +87767,36 @@ var ToolCallBlock = function ToolCallBlock(_ref) {
87829
87767
  result = _ref.result,
87830
87768
  isError = _ref.isError,
87831
87769
  isLoading = _ref.isLoading;
87832
- var _useState = React.useState(false),
87833
- _useState2 = _slicedToArray(_useState, 2),
87834
- expanded = _useState2[0],
87835
- setExpanded = _useState2[1];
87836
- var _ref2 = React.useContext(DashReact.ThemeContext) || {},
87837
- currentTheme = _ref2.currentTheme;
87838
87770
  var statusTokens = DashReact.useStatusTokens();
87839
- var t = function t(key) {
87840
- return (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme[key]) || "";
87841
- };
87842
- var dotColor = isLoading ? "".concat(statusTokens.warning.solidBg, " animate-pulse") : isError ? statusTokens.error.solidBg : statusTokens.success.solidBg;
87843
- var preBase = "p-1.5 rounded overflow-x-auto overflow-y-auto font-mono";
87844
- var preNeutral = "".concat(t("bg-primary-very-dark"), " ").concat(t("text-primary-medium"));
87845
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
87846
- className: "my-1.5 border rounded-md overflow-hidden text-xs ".concat(t("border-primary-dark")),
87847
- children: [/*#__PURE__*/jsxRuntime.jsxs("button", {
87848
- onClick: function onClick() {
87849
- return setExpanded(!expanded);
87850
- },
87851
- className: "w-full flex items-center gap-2 px-2.5 py-1.5 transition-colors text-left ".concat(t("bg-primary-dark"), " ").concat(t("hover-bg-primary-dark")),
87852
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
87853
- className: "inline-block w-2 h-2 rounded-full ".concat(dotColor)
87854
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
87855
- className: "font-mono ".concat(t("text-secondary-medium")),
87856
- children: toolName
87857
- }), serverName && /*#__PURE__*/jsxRuntime.jsxs(DashReact.Caption2, {
87858
- children: ["via ", serverName]
87859
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
87860
- className: "ml-auto",
87861
- children: expanded ? "▲" : "▼"
87862
- })]
87863
- }), expanded && /*#__PURE__*/jsxRuntime.jsxs("div", {
87864
- className: "px-2.5 py-2 space-y-2 ".concat(t("bg-primary-dark")),
87865
- children: [input && /*#__PURE__*/jsxRuntime.jsxs("div", {
87771
+ var status = isLoading ? "running" : isError ? "error" : "done";
87772
+ var hasDetails = input !== undefined || result !== undefined;
87773
+ var pre = "p-1.5 rounded overflow-auto font-mono text-xs";
87774
+ return /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatToolCall, {
87775
+ name: toolName,
87776
+ source: serverName ? "via ".concat(serverName) : null,
87777
+ status: status,
87778
+ children: hasDetails ? /*#__PURE__*/jsxRuntime.jsxs("div", {
87779
+ className: "space-y-2",
87780
+ children: [input !== undefined && input !== null && input !== "" ? /*#__PURE__*/jsxRuntime.jsxs("div", {
87866
87781
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
87867
87782
  block: true,
87868
87783
  className: "mb-0.5",
87869
87784
  children: "Input:"
87870
87785
  }), /*#__PURE__*/jsxRuntime.jsx("pre", {
87871
- className: "".concat(preBase, " max-h-32 ").concat(preNeutral),
87872
- children: typeof input === "string" ? input : JSON.stringify(input, null, 2)
87786
+ className: "".concat(pre, " max-h-32"),
87787
+ children: pretty(input)
87873
87788
  })]
87874
- }), result !== undefined && /*#__PURE__*/jsxRuntime.jsxs("div", {
87789
+ }) : null, result !== undefined ? /*#__PURE__*/jsxRuntime.jsxs("div", {
87875
87790
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
87876
87791
  block: true,
87877
87792
  className: "mb-0.5",
87878
87793
  children: "Result:"
87879
87794
  }), /*#__PURE__*/jsxRuntime.jsx("pre", {
87880
- className: "".concat(preBase, " max-h-48 ").concat(isError ? "".concat(statusTokens.error.bg, " ").concat(statusTokens.error.text) : preNeutral),
87881
- children: typeof result === "string" ? result : JSON.stringify(result, null, 2)
87795
+ className: "".concat(pre, " max-h-48 ").concat(isError ? "".concat(statusTokens.error.bg, " ").concat(statusTokens.error.text) : ""),
87796
+ children: pretty(result)
87882
87797
  })]
87883
- }), isLoading && /*#__PURE__*/jsxRuntime.jsx("div", {
87884
- className: "italic ".concat(statusTokens.warning.icon),
87885
- children: "Running..."
87886
- })]
87887
- })]
87798
+ }) : null]
87799
+ }) : null
87888
87800
  });
87889
87801
  };
87890
87802
 
@@ -88006,18 +87918,7 @@ var MessageBubble = function MessageBubble(_ref2) {
88006
87918
  content = message.content,
88007
87919
  toolCalls = message.toolCalls,
88008
87920
  hidden = message.hidden;
88009
- var _ref3 = React.useContext(DashReact.ThemeContext) || {},
88010
- currentTheme = _ref3.currentTheme;
88011
87921
  var statusTokens = DashReact.useStatusTokens();
88012
- // Theme-provided colors so the chat follows the active light/dark
88013
- // theme. No hardcoded fallbacks — they only read correctly on dark.
88014
- var bubbleBg = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-secondary-dark"]) || (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary-dark"]) || "";
88015
- // The user's bubble uses the primary surface so it stands apart from the
88016
- // Assistant/lead bubbles (secondary). "bg-primary-medium" is a real
88017
- // ThemeModel key; the old "bg-primary-bright"/"bg-primary" don't exist,
88018
- // which left the user's text with no bubble at all.
88019
- var userBubbleBg = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary-medium"]) || "";
88020
- var bubbleText = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["text-primary-medium"]) || "";
88021
87922
 
88022
87923
  // App-injected priming messages (e.g. widget-builder "Hello…" seed)
88023
87924
  // are kept in state for conversation continuity but suppressed from
@@ -88029,19 +87930,13 @@ var MessageBubble = function MessageBubble(_ref2) {
88029
87930
  }).map(function (c) {
88030
87931
  return c.text;
88031
87932
  }).join("") : "";
88032
- return /*#__PURE__*/jsxRuntime.jsx("div", {
88033
- className: "flex justify-end mb-4",
88034
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
88035
- className: "max-w-md",
88036
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
88037
- block: true,
88038
- className: "font-semibold uppercase tracking-wider mb-1 text-right",
88039
- children: message.to ? "You \u2192 ".concat(leadLabel(message.to)) : "You"
88040
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
88041
- className: "px-3 py-2 rounded-lg text-sm whitespace-pre-wrap break-words leading-relaxed ".concat(userBubbleBg, " ").concat(bubbleText),
88042
- children: text
88043
- })]
88044
- })
87933
+ return /*#__PURE__*/jsxRuntime.jsxs(DashReact.ChatMessage, {
87934
+ role: "you",
87935
+ testId: "user-bubble",
87936
+ children: [message.to ? /*#__PURE__*/jsxRuntime.jsxs("span", {
87937
+ className: "block text-xs opacity-70 mb-0.5",
87938
+ children: ["To ", leadLabel(message.to)]
87939
+ }) : null, text]
88045
87940
  });
88046
87941
  }
88047
87942
  if (role === "assistant") {
@@ -88112,51 +88007,39 @@ var MessageBubble = function MessageBubble(_ref2) {
88112
88007
  // indicator so the user knows the AI is working.
88113
88008
  if (!isStreaming && !_text && toolBlocks.length === 0) {
88114
88009
  if (isLast) {
88115
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
88116
- className: "mb-4",
88117
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
88118
- block: true,
88119
- className: "font-semibold uppercase tracking-wider mb-1",
88120
- children: "Assistant"
88121
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
88122
- className: "text-sm leading-relaxed px-3 py-2 rounded-lg ".concat(bubbleBg),
88123
- children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
88124
- className: "italic",
88125
- children: "Thinking..."
88126
- })
88127
- })]
88010
+ return /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
88011
+ role: "reply",
88012
+ label: "Assistant",
88013
+ streaming: true,
88014
+ children: "Thinking..."
88128
88015
  });
88129
88016
  }
88130
88017
  return null;
88131
88018
  }
88132
88019
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
88133
- className: "mb-4",
88134
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
88135
- block: true,
88136
- className: "font-semibold uppercase tracking-wider mb-1",
88137
- children: "Assistant"
88138
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
88139
- className: "text-sm leading-relaxed px-3 py-2 rounded-lg ".concat(bubbleBg, " ").concat(bubbleText),
88140
- children: [isStreaming && /*#__PURE__*/jsxRuntime.jsx("div", {
88141
- children: /*#__PURE__*/jsxRuntime.jsx(StreamingText, {
88142
- text: codeNote ? collapseCodeBlocks(streamingText, codeNote, {
88143
- plain: true
88144
- }) : streamingText,
88145
- isStreaming: true
88146
- })
88147
- }), !isStreaming && _text && /*#__PURE__*/jsxRuntime.jsx(AssistantTextContent, {
88020
+ className: "flex flex-col gap-2",
88021
+ children: [toolBlocks.map(function (block) {
88022
+ return /*#__PURE__*/jsxRuntime.jsx(ToolCallBlock, {
88023
+ toolName: block.name,
88024
+ serverName: block.serverName,
88025
+ input: block.input,
88026
+ result: block.result,
88027
+ isError: block.isError,
88028
+ isLoading: block.isLoading
88029
+ }, block.id);
88030
+ }), isStreaming || _text ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
88031
+ role: "reply",
88032
+ label: "Assistant",
88033
+ streaming: isStreaming && !streamingText,
88034
+ children: isStreaming ? /*#__PURE__*/jsxRuntime.jsx(StreamingText, {
88035
+ text: codeNote ? collapseCodeBlocks(streamingText, codeNote, {
88036
+ plain: true
88037
+ }) : streamingText,
88038
+ isStreaming: true
88039
+ }) : /*#__PURE__*/jsxRuntime.jsx(AssistantTextContent, {
88148
88040
  text: codeNote ? collapseCodeBlocks(_text, codeNote) : _text
88149
- }), toolBlocks.map(function (block) {
88150
- return /*#__PURE__*/jsxRuntime.jsx(ToolCallBlock, {
88151
- toolName: block.name,
88152
- serverName: block.serverName,
88153
- input: block.input,
88154
- result: block.result,
88155
- isError: block.isError,
88156
- isLoading: block.isLoading
88157
- }, block.id);
88158
- })]
88159
- })]
88041
+ })
88042
+ }) : null]
88160
88043
  });
88161
88044
  }
88162
88045
 
@@ -88164,25 +88047,20 @@ var MessageBubble = function MessageBubble(_ref2) {
88164
88047
  // lead and its dashboard.
88165
88048
  if (role === "lead") {
88166
88049
  var _text2 = typeof content === "string" ? content : textOfContent(content);
88167
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
88168
- className: "mb-4",
88169
- "data-testid": "lead-bubble",
88170
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
88171
- block: true,
88172
- className: "font-semibold uppercase tracking-wider mb-1",
88173
- children: leadLabel(message.from)
88174
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
88175
- className: "text-sm leading-relaxed px-3 py-2 rounded-lg ".concat(bubbleBg, " ").concat(bubbleText),
88176
- children: message.error ? /*#__PURE__*/jsxRuntime.jsx("span", {
88177
- className: statusTokens.error.icon,
88178
- children: message.error
88179
- }) : _text2 ? /*#__PURE__*/jsxRuntime.jsx(AssistantTextContent, {
88180
- text: _text2
88181
- }) : /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
88182
- className: "italic",
88183
- children: message.streaming ? "Working…" : "No answer."
88184
- })
88185
- })]
88050
+ return /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
88051
+ role: "reply",
88052
+ label: leadLabel(message.from),
88053
+ streaming: !!message.streaming && !_text2,
88054
+ testId: "lead-bubble",
88055
+ children: message.error ? /*#__PURE__*/jsxRuntime.jsx("span", {
88056
+ className: statusTokens.error.icon,
88057
+ children: message.error
88058
+ }) : _text2 ? /*#__PURE__*/jsxRuntime.jsx(AssistantTextContent, {
88059
+ text: _text2
88060
+ }) : /*#__PURE__*/jsxRuntime.jsx("span", {
88061
+ className: "italic",
88062
+ children: message.streaming ? "Working…" : "No answer."
88063
+ })
88186
88064
  });
88187
88065
  }
88188
88066
  return null;
@@ -88210,11 +88088,6 @@ var ChatMessages = function ChatMessages(_ref) {
88210
88088
  _ref$codeNote = _ref.codeNote,
88211
88089
  codeNote = _ref$codeNote === void 0 ? null : _ref$codeNote;
88212
88090
  var scrollRef = React.useRef(null);
88213
- var _ref2 = React.useContext(DashReact.ThemeContext) || {},
88214
- currentTheme = _ref2.currentTheme;
88215
- var t = function t(key) {
88216
- return (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme[key]) || "";
88217
- };
88218
88091
  React.useEffect(function () {
88219
88092
  if (scrollRef.current) {
88220
88093
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
@@ -88222,23 +88095,17 @@ var ChatMessages = function ChatMessages(_ref) {
88222
88095
  }, [messages, streamingText]);
88223
88096
  if (messages.length === 0) {
88224
88097
  return /*#__PURE__*/jsxRuntime.jsx("div", {
88225
- className: "flex-1 flex items-center justify-center",
88226
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
88227
- className: "text-center space-y-1",
88228
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
88229
- className: "text-2xl",
88230
- children: "\uD83D\uDCAC"
88231
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
88232
- block: true,
88233
- className: "text-sm",
88234
- children: "Send a message to start chatting"
88235
- })]
88098
+ className: "flex-1 flex items-center justify-center px-4",
88099
+ children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
88100
+ block: true,
88101
+ className: "text-sm text-center",
88102
+ children: "Send a message to start chatting"
88236
88103
  })
88237
88104
  });
88238
88105
  }
88239
88106
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
88240
88107
  ref: scrollRef,
88241
- className: "flex-1 overflow-y-auto px-4 py-3 scroll-smooth",
88108
+ className: "flex-1 overflow-y-auto px-4 py-3 scroll-smooth flex flex-col gap-3",
88242
88109
  children: [messages.map(function (message, index) {
88243
88110
  var isLastAssistant = message.role === "assistant" && index === messages.length - 1;
88244
88111
  var isStreaming = isLastAssistant && streamingRequestId !== null;
@@ -88249,34 +88116,11 @@ var ChatMessages = function ChatMessages(_ref) {
88249
88116
  isLast: index === messages.length - 1,
88250
88117
  codeNote: codeNote
88251
88118
  }, message.id || index);
88252
- }), isLoading && !streamingRequestId && ((_messages = messages[messages.length - 1]) === null || _messages === void 0 ? void 0 : _messages.role) === "user" && /*#__PURE__*/jsxRuntime.jsxs("div", {
88253
- className: "mb-4",
88254
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
88255
- block: true,
88256
- className: "font-semibold uppercase tracking-wider mb-1",
88257
- children: "Assistant"
88258
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
88259
- className: "text-sm leading-relaxed px-3 py-2 rounded-lg italic flex items-center gap-2 opacity-70 ".concat(t("bg-primary-dark"), " ").concat(t("text-primary-medium")),
88260
- children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
88261
- className: "inline-flex gap-0.5",
88262
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
88263
- className: "w-1.5 h-1.5 rounded-full animate-bounce ".concat(t("bg-primary-medium")),
88264
- style: {
88265
- animationDelay: "0ms"
88266
- }
88267
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
88268
- className: "w-1.5 h-1.5 rounded-full animate-bounce ".concat(t("bg-primary-medium")),
88269
- style: {
88270
- animationDelay: "150ms"
88271
- }
88272
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
88273
- className: "w-1.5 h-1.5 rounded-full animate-bounce ".concat(t("bg-primary-medium")),
88274
- style: {
88275
- animationDelay: "300ms"
88276
- }
88277
- })]
88278
- }), "Thinking..."]
88279
- })]
88119
+ }), isLoading && !streamingRequestId && ((_messages = messages[messages.length - 1]) === null || _messages === void 0 ? void 0 : _messages.role) === "user" && /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
88120
+ role: "reply",
88121
+ label: "Assistant",
88122
+ streaming: true,
88123
+ children: "Thinking..."
88280
88124
  })]
88281
88125
  });
88282
88126
  };
@@ -88340,11 +88184,6 @@ var ChatInput = function ChatInput(_ref) {
88340
88184
  leads = _ref$leads === void 0 ? null : _ref$leads,
88341
88185
  _ref$onPickRecipient = _ref.onPickRecipient,
88342
88186
  onPickRecipient = _ref$onPickRecipient === void 0 ? null : _ref$onPickRecipient;
88343
- var _ref2 = React.useContext(DashReact.ThemeContext) || {},
88344
- currentTheme = _ref2.currentTheme;
88345
- var t = function t(key) {
88346
- return (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme[key]) || "";
88347
- };
88348
88187
  var _useState = React.useState(""),
88349
88188
  _useState2 = _slicedToArray(_useState, 2),
88350
88189
  input = _useState2[0],
@@ -88459,37 +88298,25 @@ var ChatInput = function ChatInput(_ref) {
88459
88298
  handleSend();
88460
88299
  }
88461
88300
  };
88462
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
88463
- className: "flex flex-col gap-1 px-3 py-2 border-t ".concat(t("border-primary-dark")),
88464
- children: [mentionOpen && /*#__PURE__*/jsxRuntime.jsx(LeadMentionMenu, {
88301
+ return /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatComposer, {
88302
+ ref: textareaRef,
88303
+ value: input,
88304
+ onChange: function onChange(_value, e) {
88305
+ return handleChange(e);
88306
+ },
88307
+ onKeyDown: handleKeyDown,
88308
+ onSend: handleSend,
88309
+ onStop: onStop,
88310
+ busy: !!isLoading,
88311
+ disabled: disabled,
88312
+ rows: 1,
88313
+ placeholder: "Type a message...",
88314
+ hint: queued ? "Sends when the current reply finishes" : "Enter to send · Shift+Enter for a new line",
88315
+ above: mentionOpen ? /*#__PURE__*/jsxRuntime.jsx(LeadMentionMenu, {
88465
88316
  options: mentionOptions,
88466
88317
  activeIndex: mentionIndex,
88467
88318
  onPick: pickMention
88468
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
88469
- className: "flex items-end gap-2",
88470
- children: [/*#__PURE__*/jsxRuntime.jsx("textarea", {
88471
- ref: textareaRef,
88472
- value: input,
88473
- onChange: handleChange,
88474
- onKeyDown: handleKeyDown,
88475
- placeholder: "Type a message...",
88476
- disabled: disabled,
88477
- rows: 1,
88478
- className: "flex-1 px-3 py-2 border rounded-lg text-sm focus:outline-none resize-none disabled:opacity-50 ".concat(t("bg-primary-dark"), " ").concat(t("border-primary-dark"), " ").concat(t("text-primary-medium"))
88479
- }), isLoading ? /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
88480
- title: "Stop",
88481
- danger: true,
88482
- onClick: onStop,
88483
- className: "shrink-0"
88484
- }) : /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
88485
- title: "Send",
88486
- onClick: handleSend,
88487
- disabled: !input.trim() || disabled,
88488
- className: "shrink-0"
88489
- })]
88490
- }), queued && /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
88491
- children: "Sends when the current reply finishes"
88492
- })]
88319
+ }) : null
88493
88320
  });
88494
88321
  };
88495
88322