@trops/dash-core 0.1.685 → 0.1.687

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
@@ -75835,6 +75835,30 @@ function hasLeadSession(messages, botId) {
75835
75835
  });
75836
75836
  }
75837
75837
 
75838
+ /** The "Assistant" entry in the @ list (the default recipient). */
75839
+ var ASSISTANT_RECIPIENT = Object.freeze({
75840
+ botId: null,
75841
+ leadName: "Assistant",
75842
+ dashboardName: "",
75843
+ dashboardLabel: "",
75844
+ isAssistant: true
75845
+ });
75846
+
75847
+ /**
75848
+ * Recipients for the @ shortcut (AC6): the Assistant and each lead whose
75849
+ * lead or dashboard name contains `query` (any case), in list order.
75850
+ */
75851
+ function filterRecipients(leads, query) {
75852
+ var q = String(query || "").trim().toLowerCase();
75853
+ var all = [ASSISTANT_RECIPIENT].concat(_toConsumableArray(leads || []));
75854
+ if (!q) return all;
75855
+ return all.filter(function (r) {
75856
+ return [r.leadName, r.dashboardLabel || r.dashboardName].filter(Boolean).some(function (s) {
75857
+ return s.toLowerCase().includes(q);
75858
+ });
75859
+ });
75860
+ }
75861
+
75838
75862
  /**
75839
75863
  * StreamingText
75840
75864
  *
@@ -75844,24 +75868,29 @@ function hasLeadSession(messages, botId) {
75844
75868
  var StreamingText = function StreamingText(_ref) {
75845
75869
  var text = _ref.text,
75846
75870
  isStreaming = _ref.isStreaming;
75871
+ var _ref2 = useContext(ThemeContext) || {},
75872
+ currentTheme = _ref2.currentTheme;
75873
+ var t = function t(key) {
75874
+ return (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme[key]) || "";
75875
+ };
75847
75876
  if (!text && !isStreaming) return null;
75848
75877
  if (isStreaming && !text) {
75849
75878
  return /*#__PURE__*/jsxs("span", {
75850
- className: "flex items-center gap-2 text-gray-400 text-sm",
75879
+ className: "flex items-center gap-2 text-sm opacity-70 ".concat(t("text-primary-medium")),
75851
75880
  children: [/*#__PURE__*/jsxs("span", {
75852
75881
  className: "inline-flex gap-1",
75853
75882
  children: [/*#__PURE__*/jsx("span", {
75854
- className: "w-1.5 h-1.5 rounded-full bg-indigo-400 animate-bounce",
75883
+ className: "w-1.5 h-1.5 rounded-full animate-bounce ".concat(t("bg-secondary-medium")),
75855
75884
  style: {
75856
75885
  animationDelay: "0ms"
75857
75886
  }
75858
75887
  }), /*#__PURE__*/jsx("span", {
75859
- className: "w-1.5 h-1.5 rounded-full bg-indigo-400 animate-bounce",
75888
+ className: "w-1.5 h-1.5 rounded-full animate-bounce ".concat(t("bg-secondary-medium")),
75860
75889
  style: {
75861
75890
  animationDelay: "150ms"
75862
75891
  }
75863
75892
  }), /*#__PURE__*/jsx("span", {
75864
- className: "w-1.5 h-1.5 rounded-full bg-indigo-400 animate-bounce",
75893
+ className: "w-1.5 h-1.5 rounded-full animate-bounce ".concat(t("bg-secondary-medium")),
75865
75894
  style: {
75866
75895
  animationDelay: "300ms"
75867
75896
  }
@@ -75872,7 +75901,7 @@ var StreamingText = function StreamingText(_ref) {
75872
75901
  return /*#__PURE__*/jsxs("span", {
75873
75902
  className: "whitespace-pre-wrap break-words",
75874
75903
  children: [text, isStreaming && /*#__PURE__*/jsx("span", {
75875
- className: "inline-block w-2 h-4 ml-0.5 bg-indigo-400 animate-pulse align-text-bottom"
75904
+ className: "inline-block w-2 h-4 ml-0.5 animate-pulse align-text-bottom ".concat(t("bg-secondary-medium"))
75876
75905
  })]
75877
75906
  });
75878
75907
  };
@@ -75888,49 +75917,55 @@ var ToolCallBlock = function ToolCallBlock(_ref) {
75888
75917
  _useState2 = _slicedToArray(_useState, 2),
75889
75918
  expanded = _useState2[0],
75890
75919
  setExpanded = _useState2[1];
75920
+ var _ref2 = useContext(ThemeContext) || {},
75921
+ currentTheme = _ref2.currentTheme;
75922
+ var statusTokens = useStatusTokens();
75923
+ var t = function t(key) {
75924
+ return (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme[key]) || "";
75925
+ };
75926
+ var dotColor = isLoading ? "".concat(statusTokens.warning.solidBg, " animate-pulse") : isError ? statusTokens.error.solidBg : statusTokens.success.solidBg;
75927
+ var preBase = "p-1.5 rounded overflow-x-auto overflow-y-auto font-mono";
75928
+ var preNeutral = "".concat(t("bg-primary-very-dark"), " ").concat(t("text-primary-medium"));
75891
75929
  return /*#__PURE__*/jsxs("div", {
75892
- className: "my-1.5 border border-gray-700 rounded-md overflow-hidden text-xs",
75930
+ className: "my-1.5 border rounded-md overflow-hidden text-xs ".concat(t("border-primary-dark")),
75893
75931
  children: [/*#__PURE__*/jsxs("button", {
75894
75932
  onClick: function onClick() {
75895
75933
  return setExpanded(!expanded);
75896
75934
  },
75897
- className: "w-full flex items-center gap-2 px-2.5 py-1.5 bg-gray-800/60 hover:bg-gray-800 transition-colors text-left",
75898
- children: [isLoading ? /*#__PURE__*/jsx("span", {
75899
- className: "inline-block w-2 h-2 rounded-full bg-yellow-500 animate-pulse"
75900
- }) : isError ? /*#__PURE__*/jsx("span", {
75901
- className: "inline-block w-2 h-2 rounded-full bg-red-500"
75902
- }) : /*#__PURE__*/jsx("span", {
75903
- className: "inline-block w-2 h-2 rounded-full bg-green-500"
75935
+ 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")),
75936
+ children: [/*#__PURE__*/jsx("span", {
75937
+ className: "inline-block w-2 h-2 rounded-full ".concat(dotColor)
75904
75938
  }), /*#__PURE__*/jsx("span", {
75905
- className: "font-mono text-indigo-300",
75939
+ className: "font-mono ".concat(t("text-secondary-medium")),
75906
75940
  children: toolName
75907
- }), serverName && /*#__PURE__*/jsxs("span", {
75908
- className: "text-gray-600",
75941
+ }), serverName && /*#__PURE__*/jsxs(Caption2, {
75909
75942
  children: ["via ", serverName]
75910
- }), /*#__PURE__*/jsx("span", {
75911
- className: "ml-auto text-gray-600",
75912
- children: expanded ? "\u25B2" : "\u25BC"
75943
+ }), /*#__PURE__*/jsx(Caption2, {
75944
+ className: "ml-auto",
75945
+ children: expanded ? "▲" : "▼"
75913
75946
  })]
75914
75947
  }), expanded && /*#__PURE__*/jsxs("div", {
75915
- className: "px-2.5 py-2 space-y-2 bg-gray-900/50",
75948
+ className: "px-2.5 py-2 space-y-2 ".concat(t("bg-primary-dark")),
75916
75949
  children: [input && /*#__PURE__*/jsxs("div", {
75917
- children: [/*#__PURE__*/jsx("div", {
75918
- className: "text-gray-500 mb-0.5",
75950
+ children: [/*#__PURE__*/jsx(Caption2, {
75951
+ block: true,
75952
+ className: "mb-0.5",
75919
75953
  children: "Input:"
75920
75954
  }), /*#__PURE__*/jsx("pre", {
75921
- className: "text-gray-400 bg-black/30 p-1.5 rounded overflow-x-auto max-h-32 overflow-y-auto",
75955
+ className: "".concat(preBase, " max-h-32 ").concat(preNeutral),
75922
75956
  children: typeof input === "string" ? input : JSON.stringify(input, null, 2)
75923
75957
  })]
75924
75958
  }), result !== undefined && /*#__PURE__*/jsxs("div", {
75925
- children: [/*#__PURE__*/jsx("div", {
75926
- className: "text-gray-500 mb-0.5",
75959
+ children: [/*#__PURE__*/jsx(Caption2, {
75960
+ block: true,
75961
+ className: "mb-0.5",
75927
75962
  children: "Result:"
75928
75963
  }), /*#__PURE__*/jsx("pre", {
75929
- className: "p-1.5 rounded overflow-x-auto max-h-48 overflow-y-auto ".concat(isError ? "text-red-400 bg-red-950/30" : "text-gray-400 bg-black/30"),
75964
+ className: "".concat(preBase, " max-h-48 ").concat(isError ? "".concat(statusTokens.error.bg, " ").concat(statusTokens.error.text) : preNeutral),
75930
75965
  children: typeof result === "string" ? result : JSON.stringify(result, null, 2)
75931
75966
  })]
75932
75967
  }), isLoading && /*#__PURE__*/jsx("div", {
75933
- className: "text-yellow-400 italic",
75968
+ className: "italic ".concat(statusTokens.warning.icon),
75934
75969
  children: "Running..."
75935
75970
  })]
75936
75971
  })]
@@ -76002,7 +76037,7 @@ function AssistantTextContent(_ref) {
76002
76037
  // this HTML is inserted into the app window.
76003
76038
  var html = renderSafeMarkdown(text);
76004
76039
  return /*#__PURE__*/jsx("div", {
76005
- className: "prose prose-invert prose-sm max-w-none prose-p:my-2 prose-headings:my-3 prose-ul:my-2 prose-ol:my-2 prose-li:my-0.5 prose-pre:bg-black/40 prose-pre:text-gray-300 prose-code:text-indigo-300 prose-a:text-indigo-400 leading-relaxed",
76040
+ className: "prose prose-sm max-w-none prose-p:my-2 prose-headings:my-3 prose-ul:my-2 prose-ol:my-2 prose-li:my-0.5 leading-relaxed",
76006
76041
  dangerouslySetInnerHTML: {
76007
76042
  __html: html
76008
76043
  }
@@ -76021,11 +76056,11 @@ var MessageBubble = function MessageBubble(_ref2) {
76021
76056
  var _ref3 = useContext(ThemeContext) || {},
76022
76057
  currentTheme = _ref3.currentTheme;
76023
76058
  var statusTokens = useStatusTokens();
76024
- // Prefer theme-provided panel colors so assistant chrome follows the
76025
- // active app theme. Fall back to the original muted neutral if no
76026
- // theme is in scope.
76027
- var bubbleBg = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-secondary-dark"]) || (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary-dark"]) || "bg-gray-800/40";
76028
- var userBubbleBg = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary-bright"]) || (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary"]) || "bg-indigo-700/40";
76059
+ // Theme-provided colors so the chat follows the active light/dark
76060
+ // theme. No hardcoded fallbacks — they only read correctly on dark.
76061
+ var bubbleBg = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-secondary-dark"]) || (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary-dark"]) || "";
76062
+ var userBubbleBg = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary-bright"]) || (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary"]) || "";
76063
+ var bubbleText = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["text-primary-medium"]) || "";
76029
76064
 
76030
76065
  // App-injected priming messages (e.g. widget-builder "Hello…" seed)
76031
76066
  // are kept in state for conversation continuity but suppressed from
@@ -76040,12 +76075,13 @@ var MessageBubble = function MessageBubble(_ref2) {
76040
76075
  return /*#__PURE__*/jsx("div", {
76041
76076
  className: "flex justify-end mb-4",
76042
76077
  children: /*#__PURE__*/jsxs("div", {
76043
- className: "max-w-[85%]",
76044
- children: [/*#__PURE__*/jsx("div", {
76045
- className: "text-[10px] font-semibold uppercase tracking-wider text-indigo-400 mb-1 text-right",
76078
+ className: "max-w-md",
76079
+ children: [/*#__PURE__*/jsx(Caption2, {
76080
+ block: true,
76081
+ className: "font-semibold uppercase tracking-wider mb-1 text-right",
76046
76082
  children: message.to ? "You \u2192 ".concat(leadLabel(message.to)) : "You"
76047
76083
  }), /*#__PURE__*/jsx("div", {
76048
- className: "px-3 py-2 rounded-lg text-sm text-gray-100 whitespace-pre-wrap break-words leading-relaxed ".concat(userBubbleBg),
76084
+ className: "px-3 py-2 rounded-lg text-sm whitespace-pre-wrap break-words leading-relaxed ".concat(userBubbleBg, " ").concat(bubbleText),
76049
76085
  children: text
76050
76086
  })]
76051
76087
  })
@@ -76121,12 +76157,16 @@ var MessageBubble = function MessageBubble(_ref2) {
76121
76157
  if (isLast) {
76122
76158
  return /*#__PURE__*/jsxs("div", {
76123
76159
  className: "mb-4",
76124
- children: [/*#__PURE__*/jsx("div", {
76125
- className: "text-[10px] font-semibold uppercase tracking-wider text-gray-500 mb-1",
76160
+ children: [/*#__PURE__*/jsx(Caption2, {
76161
+ block: true,
76162
+ className: "font-semibold uppercase tracking-wider mb-1",
76126
76163
  children: "Assistant"
76127
76164
  }), /*#__PURE__*/jsx("div", {
76128
- className: "text-sm leading-relaxed px-3 py-2 rounded-lg text-gray-500 italic ".concat(bubbleBg),
76129
- children: "Thinking..."
76165
+ className: "text-sm leading-relaxed px-3 py-2 rounded-lg ".concat(bubbleBg),
76166
+ children: /*#__PURE__*/jsx(Caption2, {
76167
+ className: "italic",
76168
+ children: "Thinking..."
76169
+ })
76130
76170
  })]
76131
76171
  });
76132
76172
  }
@@ -76134,13 +76174,13 @@ var MessageBubble = function MessageBubble(_ref2) {
76134
76174
  }
76135
76175
  return /*#__PURE__*/jsxs("div", {
76136
76176
  className: "mb-4",
76137
- children: [/*#__PURE__*/jsx("div", {
76138
- className: "text-[10px] font-semibold uppercase tracking-wider text-gray-500 mb-1",
76177
+ children: [/*#__PURE__*/jsx(Caption2, {
76178
+ block: true,
76179
+ className: "font-semibold uppercase tracking-wider mb-1",
76139
76180
  children: "Assistant"
76140
76181
  }), /*#__PURE__*/jsxs("div", {
76141
- className: "text-sm leading-relaxed px-3 py-2 rounded-lg ".concat(bubbleBg),
76182
+ className: "text-sm leading-relaxed px-3 py-2 rounded-lg ".concat(bubbleBg, " ").concat(bubbleText),
76142
76183
  children: [isStreaming && /*#__PURE__*/jsx("div", {
76143
- className: "text-gray-200",
76144
76184
  children: /*#__PURE__*/jsx(StreamingText, {
76145
76185
  text: streamingText,
76146
76186
  isStreaming: true
@@ -76173,7 +76213,7 @@ var MessageBubble = function MessageBubble(_ref2) {
76173
76213
  className: "font-semibold uppercase tracking-wider mb-1",
76174
76214
  children: leadLabel(message.from)
76175
76215
  }), /*#__PURE__*/jsx("div", {
76176
- className: "text-sm leading-relaxed px-3 py-2 rounded-lg ".concat(bubbleBg, " ").concat((currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["text-primary-medium"]) || ""),
76216
+ className: "text-sm leading-relaxed px-3 py-2 rounded-lg ".concat(bubbleBg, " ").concat(bubbleText),
76177
76217
  children: message.error ? /*#__PURE__*/jsx("span", {
76178
76218
  className: statusTokens.error.icon,
76179
76219
  children: message.error
@@ -76209,6 +76249,11 @@ var ChatMessages = function ChatMessages(_ref) {
76209
76249
  _ref$isLoading = _ref.isLoading,
76210
76250
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading;
76211
76251
  var scrollRef = useRef(null);
76252
+ var _ref2 = useContext(ThemeContext) || {},
76253
+ currentTheme = _ref2.currentTheme;
76254
+ var t = function t(key) {
76255
+ return (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme[key]) || "";
76256
+ };
76212
76257
  useEffect(function () {
76213
76258
  if (scrollRef.current) {
76214
76259
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
@@ -76216,13 +76261,15 @@ var ChatMessages = function ChatMessages(_ref) {
76216
76261
  }, [messages, streamingText]);
76217
76262
  if (messages.length === 0) {
76218
76263
  return /*#__PURE__*/jsx("div", {
76219
- className: "flex-1 flex items-center justify-center text-gray-600 text-sm",
76264
+ className: "flex-1 flex items-center justify-center",
76220
76265
  children: /*#__PURE__*/jsxs("div", {
76221
76266
  className: "text-center space-y-1",
76222
76267
  children: [/*#__PURE__*/jsx("div", {
76223
76268
  className: "text-2xl",
76224
76269
  children: "\uD83D\uDCAC"
76225
- }), /*#__PURE__*/jsx("div", {
76270
+ }), /*#__PURE__*/jsx(Caption2, {
76271
+ block: true,
76272
+ className: "text-sm",
76226
76273
  children: "Send a message to start chatting"
76227
76274
  })]
76228
76275
  })
@@ -76242,25 +76289,26 @@ var ChatMessages = function ChatMessages(_ref) {
76242
76289
  }, message.id || index);
76243
76290
  }), isLoading && !streamingRequestId && ((_messages = messages[messages.length - 1]) === null || _messages === void 0 ? void 0 : _messages.role) === "user" && /*#__PURE__*/jsxs("div", {
76244
76291
  className: "mb-4",
76245
- children: [/*#__PURE__*/jsx("div", {
76246
- className: "text-[10px] font-semibold uppercase tracking-wider text-gray-500 mb-1",
76292
+ children: [/*#__PURE__*/jsx(Caption2, {
76293
+ block: true,
76294
+ className: "font-semibold uppercase tracking-wider mb-1",
76247
76295
  children: "Assistant"
76248
76296
  }), /*#__PURE__*/jsxs("div", {
76249
- className: "text-sm leading-relaxed px-3 py-2 rounded-lg bg-gray-800/40 text-gray-500 italic flex items-center gap-2",
76297
+ 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")),
76250
76298
  children: [/*#__PURE__*/jsxs("span", {
76251
76299
  className: "inline-flex gap-0.5",
76252
76300
  children: [/*#__PURE__*/jsx("span", {
76253
- className: "w-1.5 h-1.5 bg-gray-500 rounded-full animate-bounce",
76301
+ className: "w-1.5 h-1.5 rounded-full animate-bounce ".concat(t("bg-primary-medium")),
76254
76302
  style: {
76255
76303
  animationDelay: "0ms"
76256
76304
  }
76257
76305
  }), /*#__PURE__*/jsx("span", {
76258
- className: "w-1.5 h-1.5 bg-gray-500 rounded-full animate-bounce",
76306
+ className: "w-1.5 h-1.5 rounded-full animate-bounce ".concat(t("bg-primary-medium")),
76259
76307
  style: {
76260
76308
  animationDelay: "150ms"
76261
76309
  }
76262
76310
  }), /*#__PURE__*/jsx("span", {
76263
- className: "w-1.5 h-1.5 bg-gray-500 rounded-full animate-bounce",
76311
+ className: "w-1.5 h-1.5 rounded-full animate-bounce ".concat(t("bg-primary-medium")),
76264
76312
  style: {
76265
76313
  animationDelay: "300ms"
76266
76314
  }
@@ -76271,6 +76319,47 @@ var ChatMessages = function ChatMessages(_ref) {
76271
76319
  });
76272
76320
  };
76273
76321
 
76322
+ /**
76323
+ * LeadMentionMenu — the list the @ shortcut opens above the Assistant's
76324
+ * message box (bot-teams TEAM-013 AC6). Keyboard focus stays in the
76325
+ * textarea (ChatInput moves `activeIndex`), so this is a listbox, not a
76326
+ * focus-taking menu.
76327
+ */
76328
+ var LeadMentionMenu = function LeadMentionMenu(_ref) {
76329
+ var options = _ref.options,
76330
+ activeIndex = _ref.activeIndex,
76331
+ onPick = _ref.onPick;
76332
+ var _ref2 = useContext(ThemeContext) || {},
76333
+ currentTheme = _ref2.currentTheme;
76334
+ var t = function t(key) {
76335
+ return (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme[key]) || "";
76336
+ };
76337
+ return /*#__PURE__*/jsx("div", {
76338
+ role: "listbox",
76339
+ "aria-label": "Send to",
76340
+ className: "mb-1 max-h-48 overflow-y-auto rounded-lg border shadow ".concat(t("bg-primary-dark"), " ").concat(t("border-primary-dark")),
76341
+ children: options.length === 0 ? /*#__PURE__*/jsx(Caption2, {
76342
+ block: true,
76343
+ className: "px-3 py-2 italic",
76344
+ children: "No team lead matches."
76345
+ }) : options.map(function (option, index) {
76346
+ var active = index === activeIndex;
76347
+ return /*#__PURE__*/jsx("div", {
76348
+ role: "option",
76349
+ "aria-selected": active
76350
+ // mousedown so the textarea keeps focus.
76351
+ ,
76352
+ onMouseDown: function onMouseDown(e) {
76353
+ e.preventDefault();
76354
+ onPick(option);
76355
+ },
76356
+ className: "px-3 py-1.5 text-xs cursor-pointer ".concat(active ? "".concat(t("bg-secondary-dark"), " ").concat(t("text-secondary-light")) : "".concat(t("text-primary-medium"), " ").concat(t("hover-bg-primary-dark"))),
76357
+ children: option.isAssistant ? "Assistant" : leadLabel(option)
76358
+ }, option.botId || "assistant");
76359
+ })
76360
+ });
76361
+ };
76362
+
76274
76363
  var autoResize = function autoResize(el) {
76275
76364
  if (!el) return;
76276
76365
  el.style.height = "auto";
@@ -76284,13 +76373,42 @@ var ChatInput = function ChatInput(_ref) {
76284
76373
  var onSend = _ref.onSend,
76285
76374
  onStop = _ref.onStop,
76286
76375
  isLoading = _ref.isLoading,
76287
- disabled = _ref.disabled;
76376
+ disabled = _ref.disabled,
76377
+ _ref$leads = _ref.leads,
76378
+ leads = _ref$leads === void 0 ? null : _ref$leads,
76379
+ _ref$onPickRecipient = _ref.onPickRecipient,
76380
+ onPickRecipient = _ref$onPickRecipient === void 0 ? null : _ref$onPickRecipient;
76381
+ var _ref2 = useContext(ThemeContext) || {},
76382
+ currentTheme = _ref2.currentTheme;
76383
+ var t = function t(key) {
76384
+ return (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme[key]) || "";
76385
+ };
76288
76386
  var _useState = useState(""),
76289
76387
  _useState2 = _slicedToArray(_useState, 2),
76290
76388
  input = _useState2[0],
76291
76389
  setInput = _useState2[1];
76292
76390
  var textareaRef = useRef(null);
76293
76391
 
76392
+ // The @ list is open while the box starts with "@" (and wasn't dismissed
76393
+ // with Esc); the text after "@" filters it.
76394
+ var _useState3 = useState(false),
76395
+ _useState4 = _slicedToArray(_useState3, 2),
76396
+ mentionDismissed = _useState4[0],
76397
+ setMentionDismissed = _useState4[1];
76398
+ var _useState5 = useState(0),
76399
+ _useState6 = _slicedToArray(_useState5, 2),
76400
+ mentionIndex = _useState6[0],
76401
+ setMentionIndex = _useState6[1];
76402
+ var mentionOn = !!onPickRecipient && Array.isArray(leads);
76403
+ var mentionOpen = mentionOn && input.startsWith("@") && !mentionDismissed;
76404
+ var mentionOptions = mentionOpen ? filterRecipients(leads, input.slice(1)) : [];
76405
+ var pickMention = function pickMention(option) {
76406
+ onPickRecipient(option && !option.isAssistant ? option : null);
76407
+ setInput("");
76408
+ setMentionIndex(0);
76409
+ setMentionDismissed(false);
76410
+ };
76411
+
76294
76412
  // Auto-resize; re-measure once the input's container actually gets laid
76295
76413
  // out (e.g. the panel is expanded).
76296
76414
  useEffect(function () {
@@ -76312,10 +76430,10 @@ var ChatInput = function ChatInput(_ref) {
76312
76430
  // Enter/Send while a reply is still coming in (e.g. the panel's hidden
76313
76431
  // greeting right after it opens) queues the message instead of dropping
76314
76432
  // it; it goes out — with any edits made meanwhile — once the reply ends.
76315
- var _useState3 = useState(false),
76316
- _useState4 = _slicedToArray(_useState3, 2),
76317
- queued = _useState4[0],
76318
- setQueued = _useState4[1];
76433
+ var _useState7 = useState(false),
76434
+ _useState8 = _slicedToArray(_useState7, 2),
76435
+ queued = _useState8[0],
76436
+ setQueued = _useState8[1];
76319
76437
  var handleSend = function handleSend() {
76320
76438
  var trimmed = input.trim();
76321
76439
  if (!trimmed) return;
@@ -76338,19 +76456,54 @@ var ChatInput = function ChatInput(_ref) {
76338
76456
  // eslint-disable-next-line react-hooks/exhaustive-deps
76339
76457
  }, [isLoading, queued]);
76340
76458
  var handleChange = function handleChange(e) {
76341
- setInput(e.target.value);
76459
+ var value = e.target.value;
76460
+ setInput(value);
76342
76461
  // Clearing the box cancels a queued message.
76343
- if (!e.target.value.trim()) setQueued(false);
76462
+ if (!value.trim()) setQueued(false);
76463
+ // A fresh "@" (or a changed filter) re-opens the list from the top.
76464
+ if (!value.startsWith("@")) setMentionDismissed(false);
76465
+ setMentionIndex(0);
76344
76466
  };
76345
76467
  var handleKeyDown = function handleKeyDown(e) {
76468
+ if (mentionOpen) {
76469
+ var count = mentionOptions.length;
76470
+ if (e.key === "ArrowDown" && count) {
76471
+ e.preventDefault();
76472
+ setMentionIndex(function (i) {
76473
+ return (i + 1) % count;
76474
+ });
76475
+ return;
76476
+ }
76477
+ if (e.key === "ArrowUp" && count) {
76478
+ e.preventDefault();
76479
+ setMentionIndex(function (i) {
76480
+ return (i - 1 + count) % count;
76481
+ });
76482
+ return;
76483
+ }
76484
+ if (e.key === "Escape") {
76485
+ e.preventDefault();
76486
+ setMentionDismissed(true);
76487
+ return;
76488
+ }
76489
+ if (e.key === "Enter" && !e.shiftKey || e.key === "Tab") {
76490
+ e.preventDefault();
76491
+ if (count) pickMention(mentionOptions[mentionIndex] || null);
76492
+ return;
76493
+ }
76494
+ }
76346
76495
  if (e.key === "Enter" && !e.shiftKey) {
76347
76496
  e.preventDefault();
76348
76497
  handleSend();
76349
76498
  }
76350
76499
  };
76351
76500
  return /*#__PURE__*/jsxs("div", {
76352
- className: "flex flex-col gap-1 px-3 py-2 border-t border-gray-700/50",
76353
- children: [/*#__PURE__*/jsxs("div", {
76501
+ className: "flex flex-col gap-1 px-3 py-2 border-t ".concat(t("border-primary-dark")),
76502
+ children: [mentionOpen && /*#__PURE__*/jsx(LeadMentionMenu, {
76503
+ options: mentionOptions,
76504
+ activeIndex: mentionIndex,
76505
+ onPick: pickMention
76506
+ }), /*#__PURE__*/jsxs("div", {
76354
76507
  className: "flex items-end gap-2",
76355
76508
  children: [/*#__PURE__*/jsx("textarea", {
76356
76509
  ref: textareaRef,
@@ -76360,19 +76513,19 @@ var ChatInput = function ChatInput(_ref) {
76360
76513
  placeholder: "Type a message...",
76361
76514
  disabled: disabled,
76362
76515
  rows: 1,
76363
- className: "flex-1 px-3 py-2 bg-gray-800 border border-gray-700 rounded-lg text-sm text-gray-200 placeholder-gray-500 focus:outline-none focus:border-indigo-500 resize-none disabled:opacity-50"
76364
- }), isLoading ? /*#__PURE__*/jsx("button", {
76516
+ 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"))
76517
+ }), isLoading ? /*#__PURE__*/jsx(Button, {
76518
+ title: "Stop",
76519
+ danger: true,
76365
76520
  onClick: onStop,
76366
- className: "px-3 py-2 rounded-lg bg-red-700 hover:bg-red-600 text-white text-sm font-medium transition-colors shrink-0",
76367
- children: "Stop"
76368
- }) : /*#__PURE__*/jsx("button", {
76521
+ className: "shrink-0"
76522
+ }) : /*#__PURE__*/jsx(Button, {
76523
+ title: "Send",
76369
76524
  onClick: handleSend,
76370
76525
  disabled: !input.trim() || disabled,
76371
- className: "px-3 py-2 rounded-lg bg-indigo-600 hover:bg-indigo-500 disabled:opacity-40 disabled:cursor-not-allowed text-white text-sm font-medium transition-colors shrink-0",
76372
- children: "Send"
76526
+ className: "shrink-0"
76373
76527
  })]
76374
- }), queued && /*#__PURE__*/jsx("span", {
76375
- className: "text-xs text-gray-500",
76528
+ }), queued && /*#__PURE__*/jsx(Caption2, {
76376
76529
  children: "Sends when the current reply finishes"
76377
76530
  })]
76378
76531
  });
@@ -76386,6 +76539,11 @@ var ToolSelector = function ToolSelector(_ref) {
76386
76539
  _useState2 = _slicedToArray(_useState, 2),
76387
76540
  expanded = _useState2[0],
76388
76541
  setExpanded = _useState2[1];
76542
+ var _ref2 = useContext(ThemeContext) || {},
76543
+ currentTheme = _ref2.currentTheme;
76544
+ var t = function t(key) {
76545
+ return (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme[key]) || "";
76546
+ };
76389
76547
  var totalTools = servers.reduce(function (sum, s) {
76390
76548
  var _s$tools;
76391
76549
  return sum + (((_s$tools = s.tools) === null || _s$tools === void 0 ? void 0 : _s$tools.length) || 0);
@@ -76398,7 +76556,7 @@ var ToolSelector = function ToolSelector(_ref) {
76398
76556
  onClick: function onClick() {
76399
76557
  return setExpanded(!expanded);
76400
76558
  },
76401
- className: "flex items-center gap-1.5 px-2 py-1 rounded hover:bg-white/5 transition-colors text-gray-400",
76559
+ className: "flex items-center gap-1.5 px-2 py-1 rounded transition-colors ".concat(t("hover-bg-primary-dark"), " ").concat(t("text-primary-medium")),
76402
76560
  children: [/*#__PURE__*/jsx("svg", {
76403
76561
  xmlns: "http://www.w3.org/2000/svg",
76404
76562
  viewBox: "0 0 20 20",
@@ -76411,31 +76569,31 @@ var ToolSelector = function ToolSelector(_ref) {
76411
76569
  })
76412
76570
  }), /*#__PURE__*/jsxs("span", {
76413
76571
  children: ["Tools (", enabledCount, "/", totalTools, ")"]
76414
- }), /*#__PURE__*/jsx("span", {
76415
- className: "text-gray-600",
76572
+ }), /*#__PURE__*/jsx(Caption2, {
76416
76573
  children: expanded ? "\u25B2" : "\u25BC"
76417
76574
  })]
76418
76575
  }), expanded && /*#__PURE__*/jsx("div", {
76419
- className: "mt-1 p-2 bg-gray-800/50 rounded-md border border-gray-700 max-h-48 overflow-y-auto space-y-2",
76576
+ className: "mt-1 p-2 rounded-md border max-h-48 overflow-y-auto space-y-2 ".concat(t("bg-primary-dark"), " ").concat(t("border-primary-dark")),
76420
76577
  children: servers.map(function (server) {
76421
76578
  return /*#__PURE__*/jsxs("div", {
76422
- children: [/*#__PURE__*/jsx("div", {
76423
- className: "text-gray-500 font-medium mb-1",
76579
+ children: [/*#__PURE__*/jsx(Caption2, {
76580
+ block: true,
76581
+ className: "font-medium mb-1",
76424
76582
  children: server.serverName
76425
76583
  }), /*#__PURE__*/jsx("div", {
76426
76584
  className: "space-y-0.5 ml-2",
76427
76585
  children: server.tools.map(function (tool) {
76428
76586
  return /*#__PURE__*/jsxs("label", {
76429
- className: "flex items-center gap-2 py-0.5 cursor-pointer hover:bg-white/5 rounded px-1",
76587
+ className: "flex items-center gap-2 py-0.5 cursor-pointer rounded px-1 ".concat(t("hover-bg-primary-dark")),
76430
76588
  children: [/*#__PURE__*/jsx("input", {
76431
76589
  type: "checkbox",
76432
76590
  checked: enabledTools[tool.name] !== false,
76433
76591
  onChange: function onChange() {
76434
76592
  return onToggle(tool.name);
76435
76593
  },
76436
- className: "rounded border-gray-600 bg-gray-700 text-indigo-500 focus:ring-indigo-500 focus:ring-offset-0 w-3 h-3"
76594
+ className: "rounded w-3 h-3"
76437
76595
  }), /*#__PURE__*/jsx("span", {
76438
- className: "text-gray-300 font-mono",
76596
+ className: "font-mono ".concat(t("text-primary-medium")),
76439
76597
  children: tool.name
76440
76598
  })]
76441
76599
  }, tool.name);
@@ -76589,6 +76747,12 @@ function ChatCore(_ref) {
76589
76747
  _ref$enableLeadRecipi = _ref.enableLeadRecipients,
76590
76748
  enableLeadRecipients = _ref$enableLeadRecipi === void 0 ? false : _ref$enableLeadRecipi;
76591
76749
  var mainApi = window.mainApi;
76750
+ var _ref2 = useContext(ThemeContext) || {},
76751
+ currentTheme = _ref2.currentTheme;
76752
+ var t = function t(key) {
76753
+ return (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme[key]) || "";
76754
+ };
76755
+ var statusTokens = useStatusTokens();
76592
76756
 
76593
76757
  // Direct-to-lead state (TEAM-013). recipient null = the Assistant.
76594
76758
  var _useState = useState(null),
@@ -76882,9 +77046,9 @@ function ChatCore(_ref) {
76882
77046
  // ---- Direct-to-lead messages (bot-teams TEAM-013) ----------------------
76883
77047
 
76884
77048
  // Replace the lead's streaming placeholder with its final answer/error.
76885
- var finishLeadRun = useCallback(function (placeholderId, _ref2) {
76886
- var content = _ref2.content,
76887
- leadError = _ref2.error;
77049
+ var finishLeadRun = useCallback(function (placeholderId, _ref3) {
77050
+ var content = _ref3.content,
77051
+ leadError = _ref3.error;
76888
77052
  var run = leadRunRef.current;
76889
77053
  if (run && run.listenerId != null) {
76890
77054
  var _mainApi$bots, _mainApi$bots$removeL;
@@ -77267,82 +77431,101 @@ function ChatCore(_ref) {
77267
77431
  return ((_s$tools = s.tools) === null || _s$tools === void 0 ? void 0 : _s$tools.length) > 0;
77268
77432
  });
77269
77433
  return /*#__PURE__*/jsxs("div", {
77270
- className: "flex flex-col flex-1 overflow-hidden bg-gray-900 text-gray-200",
77434
+ className: "flex flex-col flex-1 overflow-hidden ".concat(t("bg-primary-very-dark"), " ").concat(t("text-primary-medium")),
77271
77435
  children: [title ? /*#__PURE__*/jsxs("div", {
77272
- className: "flex items-center justify-between px-3 py-2 border-b border-gray-700/50 shrink-0",
77436
+ className: "flex items-center justify-between px-3 py-2 border-b shrink-0 ".concat(t("border-primary-dark")),
77273
77437
  children: [/*#__PURE__*/jsxs("div", {
77274
77438
  className: "flex items-center gap-2",
77275
77439
  children: [/*#__PURE__*/jsx(SubHeading2, {
77276
77440
  title: title
77277
77441
  }), isCliBackend && sessionActive && /*#__PURE__*/jsx("span", {
77278
- className: "inline-block w-2 h-2 rounded-full bg-green-400",
77442
+ className: "inline-block w-2 h-2 rounded-full ".concat(statusTokens.success.solidBg),
77279
77443
  title: "CLI session active"
77280
77444
  })]
77281
77445
  }), /*#__PURE__*/jsx("div", {
77282
77446
  className: "flex items-center gap-1",
77283
- children: /*#__PURE__*/jsx("button", {
77447
+ children: /*#__PURE__*/jsx(Button3, {
77448
+ size: "sm",
77284
77449
  onClick: handleNewChat,
77285
- className: "px-2 py-1 text-xs rounded bg-gray-700 hover:bg-gray-600 text-gray-300 transition-colors",
77286
77450
  children: "New Chat"
77287
77451
  })
77288
77452
  })]
77289
77453
  }) : /*#__PURE__*/jsx("div", {
77290
77454
  className: "flex items-center justify-end px-3 py-1 shrink-0",
77291
- children: /*#__PURE__*/jsx("button", {
77455
+ children: /*#__PURE__*/jsx(Button3, {
77456
+ size: "sm",
77292
77457
  onClick: handleNewChat,
77293
- className: "px-2 py-1 text-xs rounded bg-gray-700 hover:bg-gray-600 text-gray-300 transition-colors",
77294
77458
  children: "New Chat"
77295
77459
  })
77296
- }), error && /*#__PURE__*/jsxs("div", {
77297
- className: "mx-3 mt-2 p-2 bg-red-900/30 border border-red-700 rounded text-red-300 text-xs",
77298
- children: [error, /*#__PURE__*/jsx("button", {
77299
- onClick: function onClick() {
77460
+ }), error && /*#__PURE__*/jsx("div", {
77461
+ className: "mx-3 mt-2",
77462
+ children: /*#__PURE__*/jsx(AlertBanner, {
77463
+ variant: "error",
77464
+ size: "compact",
77465
+ message: error,
77466
+ onClose: function onClose() {
77300
77467
  return setError(null);
77301
- },
77302
- className: "ml-2 text-red-400 hover:text-red-300",
77303
- children: "Dismiss"
77304
- })]
77468
+ }
77469
+ })
77305
77470
  }), isAnthropicBackend && !apiKey && /*#__PURE__*/jsx("div", {
77306
- className: "mx-3 mt-2 p-2 bg-yellow-900/30 border border-yellow-700 rounded text-yellow-300 text-xs",
77307
- children: "Add an Anthropic API key in Settings > AI Assistant to start chatting."
77471
+ className: "mx-3 mt-2",
77472
+ children: /*#__PURE__*/jsx(AlertBanner, {
77473
+ variant: "warning",
77474
+ size: "compact",
77475
+ message: "Add an Anthropic API key in Settings > AI Assistant to start chatting."
77476
+ })
77308
77477
  }), isCliBackend && cliAvailable === null && /*#__PURE__*/jsx("div", {
77309
- className: "mx-3 mt-2 p-2 bg-gray-800/50 border border-gray-700 rounded text-gray-400 text-xs",
77310
- children: "Checking for Claude Code CLI..."
77311
- }), isCliBackend && cliAvailable === false && /*#__PURE__*/jsxs("div", {
77312
- className: "mx-3 mt-2 p-3 bg-yellow-900/30 border border-yellow-700 rounded text-yellow-300 text-xs",
77313
- children: [/*#__PURE__*/jsx("p", {
77314
- className: "font-semibold mb-2",
77315
- children: "Claude Code CLI not found"
77316
- }), /*#__PURE__*/jsxs("ol", {
77317
- className: "list-decimal list-inside space-y-1 mb-3 text-yellow-300/90",
77318
- children: [/*#__PURE__*/jsxs("li", {
77319
- children: ["Download Claude Code from", " ", /*#__PURE__*/jsx("button", {
77320
- onClick: function onClick() {
77321
- var _mainApi$shell, _mainApi$shell$openEx;
77322
- return mainApi === null || mainApi === void 0 || (_mainApi$shell = mainApi.shell) === null || _mainApi$shell === void 0 || (_mainApi$shell$openEx = _mainApi$shell.openExternal) === null || _mainApi$shell$openEx === void 0 ? void 0 : _mainApi$shell$openEx.call(_mainApi$shell, "https://claude.ai/download");
77323
- },
77324
- className: "underline hover:text-yellow-200 font-mono",
77325
- children: "claude.ai/download"
77326
- })]
77327
- }), /*#__PURE__*/jsxs("li", {
77328
- children: ["Open your terminal and run", " ", /*#__PURE__*/jsx("span", {
77329
- className: "font-mono bg-yellow-900/50 px-1 rounded",
77330
- children: "claude auth login"
77478
+ className: "mx-3 mt-2",
77479
+ children: /*#__PURE__*/jsx(AlertBanner, {
77480
+ variant: "info",
77481
+ size: "compact",
77482
+ message: "Checking for Claude Code CLI..."
77483
+ })
77484
+ }), isCliBackend && cliAvailable === false && /*#__PURE__*/jsx("div", {
77485
+ className: "mx-3 mt-2",
77486
+ children: /*#__PURE__*/jsxs(AlertBanner, {
77487
+ variant: "warning",
77488
+ size: "compact",
77489
+ title: "Claude Code CLI not found",
77490
+ children: [/*#__PURE__*/jsxs("ol", {
77491
+ className: "list-decimal list-inside space-y-1 mb-2",
77492
+ children: [/*#__PURE__*/jsxs("li", {
77493
+ children: ["Download Claude Code from", " ", /*#__PURE__*/jsx("button", {
77494
+ onClick: function onClick() {
77495
+ var _mainApi$shell, _mainApi$shell$openEx;
77496
+ return mainApi === null || mainApi === void 0 || (_mainApi$shell = mainApi.shell) === null || _mainApi$shell === void 0 || (_mainApi$shell$openEx = _mainApi$shell.openExternal) === null || _mainApi$shell$openEx === void 0 ? void 0 : _mainApi$shell$openEx.call(_mainApi$shell, "https://claude.ai/download");
77497
+ },
77498
+ className: "underline font-mono hover:opacity-80",
77499
+ children: "claude.ai/download"
77500
+ })]
77501
+ }), /*#__PURE__*/jsxs("li", {
77502
+ children: ["Open your terminal and run", " ", /*#__PURE__*/jsx("span", {
77503
+ className: "font-mono",
77504
+ children: "claude auth login"
77505
+ })]
77506
+ }), /*#__PURE__*/jsx("li", {
77507
+ children: "Complete authentication in your browser"
77331
77508
  })]
77332
- }), /*#__PURE__*/jsx("li", {
77333
- children: "Complete authentication in your browser"
77509
+ }), /*#__PURE__*/jsx(Button3, {
77510
+ size: "sm",
77511
+ onClick: handleCheckCliAgain,
77512
+ children: "Check Again"
77334
77513
  })]
77335
- }), /*#__PURE__*/jsx("button", {
77336
- onClick: handleCheckCliAgain,
77337
- className: "px-3 py-1 text-xs rounded bg-yellow-800/60 hover:bg-yellow-700/60 text-yellow-200 border border-yellow-600/50 transition-colors",
77338
- children: "Check Again"
77339
- })]
77514
+ })
77340
77515
  }), !hideToolsBanner && isAnthropicBackend && !hasTools && apiKey && messages.length === 0 && /*#__PURE__*/jsx("div", {
77341
- className: "mx-3 mt-2 p-2 bg-gray-800/50 border border-gray-700 rounded text-gray-400 text-xs",
77342
- children: "No MCP tools connected. Connect providers (GitHub, Slack, etc.) to enable tool-use."
77516
+ className: "mx-3 mt-2",
77517
+ children: /*#__PURE__*/jsx(AlertBanner, {
77518
+ variant: "info",
77519
+ size: "compact",
77520
+ message: "No MCP tools connected. Connect providers (GitHub, Slack, etc.) to enable tool-use."
77521
+ })
77343
77522
  }), isCliBackend && cliAvailable && messages.length === 0 && /*#__PURE__*/jsx("div", {
77344
- className: "mx-3 mt-2 p-2 bg-gray-800/50 border border-gray-700 rounded text-gray-400 text-xs",
77345
- children: "Using Claude Code CLI. Your configured MCP tools pass through automatically."
77523
+ className: "mx-3 mt-2",
77524
+ children: /*#__PURE__*/jsx(AlertBanner, {
77525
+ variant: "info",
77526
+ size: "compact",
77527
+ message: "Using Claude Code CLI. Your configured MCP tools pass through automatically."
77528
+ })
77346
77529
  }), hasTools && /*#__PURE__*/jsx("div", {
77347
77530
  className: "px-1 pt-1",
77348
77531
  children: /*#__PURE__*/jsx(ToolSelector, {
@@ -77375,6 +77558,11 @@ function ChatCore(_ref) {
77375
77558
  onStop: handleStop,
77376
77559
  isLoading: isLoading,
77377
77560
  disabled: !isReady
77561
+ // @ shortcut only where lead recipients are on (the AI Assistant);
77562
+ // elsewhere "@" stays plain text (TEAM-013 AC6).
77563
+ ,
77564
+ leads: enableLeadRecipients ? leads : null,
77565
+ onPickRecipient: enableLeadRecipients ? handleRecipientChange : null
77378
77566
  })]
77379
77567
  });
77380
77568
  }