@burtson-labs/bandit-engine 2.0.136 → 2.0.137

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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  chat_default
3
- } from "./chunk-72TR4XAJ.mjs";
3
+ } from "./chunk-YPIUO3IS.mjs";
4
4
  import {
5
5
  chat_provider_default
6
6
  } from "./chunk-PU74BI6Y.mjs";
@@ -10,7 +10,7 @@ import {
10
10
  useGatewayHealth,
11
11
  useGatewayMemory,
12
12
  useGatewayModels
13
- } from "./chunk-LG4S6XLH.mjs";
13
+ } from "./chunk-2L5DC4OI.mjs";
14
14
  import "./chunk-BVYSGIWG.mjs";
15
15
  import "./chunk-F7JXIW6T.mjs";
16
16
  import "./chunk-K2JGFKEB.mjs";
@@ -21438,6 +21438,8 @@ ${sanitize(
21438
21438
  const hasFeedbackAction = isFeedbackEnabled && isMobile;
21439
21439
  const hasSttAction = isSTTAvailable && !isVoiceModeEnabled;
21440
21440
  const hasVoicePickerAction = isMobile && isTTSAvailable && availableVoices.length > 0;
21441
+ const hasComposeContent = !!inputValue.trim() || pastedImages.length > 0 || fileInputs.length > 0;
21442
+ const showSendButton = streamingActive || hasComposeContent || !isVoiceModeEligible;
21441
21443
  const hasSecondaryActions = isMobile && (hasAttachmentAction || hasMemoryAction || hasFeedbackAction || hasSttAction || hasVoicePickerAction);
21442
21444
  (0, import_react46.useEffect)(() => {
21443
21445
  if (!isMobile || !hasSecondaryActions) {
@@ -21502,6 +21504,33 @@ ${sanitize(
21502
21504
  if (!hasSttAction) return null;
21503
21505
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material39.Box, { sx: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(transcriber_default, { onTranscriptionCompleted: handleTranscriptionCompleted }) }, key ?? "stt");
21504
21506
  };
21507
+ const renderVoiceModeButton = (key) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
21508
+ import_material39.Tooltip,
21509
+ {
21510
+ title: !isVoiceModeEnabled ? "Enable voice mode" : voiceStatus === "error" ? voiceError || "Voice mode error" : voiceStatus === "processing" ? "Transcribing your speech" : voiceStatus === "recording" ? "Recording - click to stop" : voiceStatus === "initializing" ? "Preparing microphone" : "Listening - click to turn off",
21511
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
21512
+ import_material39.IconButton,
21513
+ {
21514
+ onClick: toggleVoiceMode,
21515
+ sx: {
21516
+ width: sendIconSize,
21517
+ height: sendIconSize,
21518
+ borderRadius: "50%",
21519
+ bgcolor: isVoiceModeEnabled ? (0, import_styles24.alpha)(theme.palette.error.main, theme.palette.mode === "dark" ? 0.45 : 0.3) : fileText,
21520
+ color: isVoiceModeEnabled ? theme.palette.common.white : fileIconBg,
21521
+ boxShadow: isVoiceModeEnabled && voiceStatus === "recording" ? `0 0 0 2px ${(0, import_styles24.alpha)(theme.palette.error.main, 0.25)}` : "none",
21522
+ transform: isVoiceModeEnabled && voiceStatus === "recording" ? "scale(1.05)" : "none",
21523
+ transition: "transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease",
21524
+ "&:hover": {
21525
+ bgcolor: isVoiceModeEnabled ? (0, import_styles24.alpha)(theme.palette.error.main, theme.palette.mode === "dark" ? 0.55 : 0.38) : hoverBadgeBackground
21526
+ }
21527
+ },
21528
+ children: !isVoiceModeEnabled ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(GraphicEqIcon, { fontSize: "small" }) : voiceStatus === "processing" || voiceStatus === "initializing" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material39.CircularProgress, { size: 18, sx: { color: theme.palette.common.white } }) : voiceStatus === "error" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(HearingDisabledIcon, { fontSize: "small", sx: { color: theme.palette.error.light } }) : voiceStatus === "recording" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(GraphicEqIcon, { fontSize: "small", sx: { color: theme.palette.error.light } }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(GraphicEqIcon, { fontSize: "small", sx: { color: theme.palette.common.white } })
21529
+ }
21530
+ )
21531
+ },
21532
+ key ?? "voice-mode"
21533
+ );
21505
21534
  const renderVoicePickerButton = (key) => {
21506
21535
  if (!hasVoicePickerAction) return null;
21507
21536
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material39.Tooltip, { title: `Voice: ${selectedVoice ? toTitleCase(selectedVoice.split("-")[1] ?? selectedVoice) : "Default"}`, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
@@ -21749,51 +21778,22 @@ ${sanitize(
21749
21778
  minHeight: primaryIconSize
21750
21779
  },
21751
21780
  children: [
21752
- isVoiceModeEligible && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
21753
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
21754
- import_material39.Tooltip,
21755
- {
21756
- title: !isVoiceModeEnabled ? "Enable voice mode" : voiceStatus === "error" ? voiceError || "Voice mode error" : voiceStatus === "processing" ? "Transcribing your speech" : voiceStatus === "recording" ? "Recording - click to stop" : voiceStatus === "initializing" ? "Preparing microphone" : "Listening - click to turn off",
21757
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
21758
- import_material39.IconButton,
21759
- {
21760
- onClick: toggleVoiceMode,
21761
- sx: {
21762
- width: primaryIconSize,
21763
- height: primaryIconSize,
21764
- borderRadius: "50%",
21765
- bgcolor: isVoiceModeEnabled ? (0, import_styles24.alpha)(theme.palette.error.main, theme.palette.mode === "dark" ? 0.45 : 0.3) : badgeBackground,
21766
- color: isVoiceModeEnabled ? theme.palette.common.white : fileText,
21767
- boxShadow: isVoiceModeEnabled && voiceStatus === "recording" ? `0 0 0 2px ${(0, import_styles24.alpha)(theme.palette.error.main, 0.25)}` : "none",
21768
- transform: isVoiceModeEnabled && voiceStatus === "recording" ? "scale(1.05)" : "none",
21769
- transition: "transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease",
21770
- "&:hover": {
21771
- bgcolor: isVoiceModeEnabled ? (0, import_styles24.alpha)(theme.palette.error.main, theme.palette.mode === "dark" ? 0.55 : 0.38) : hoverBadgeBackground
21772
- }
21773
- },
21774
- children: !isVoiceModeEnabled ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(GraphicEqIcon, { fontSize: "small", sx: { color: theme.palette.mode === "dark" ? fileText : theme.palette.text.secondary } }) : voiceStatus === "processing" || voiceStatus === "initializing" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material39.CircularProgress, { size: 18, sx: { color: fileText } }) : voiceStatus === "error" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(HearingDisabledIcon, { fontSize: "small", sx: { color: theme.palette.error.light } }) : voiceStatus === "recording" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(GraphicEqIcon, { fontSize: "small", sx: { color: theme.palette.error.light } }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(GraphicEqIcon, { fontSize: "small", sx: { color: theme.palette.common.white } })
21775
- }
21776
- )
21777
- }
21778
- ),
21779
- !isMobile && isVoiceModeEnabled && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
21780
- import_material39.Typography,
21781
- {
21782
- variant: "caption",
21783
- sx: {
21784
- color: voiceStatus === "error" ? theme.palette.error.main : voiceStatus === "processing" ? theme.palette.warning.main : fileText,
21785
- maxWidth: 240,
21786
- overflow: "hidden",
21787
- textOverflow: "ellipsis",
21788
- whiteSpace: "nowrap"
21789
- },
21790
- children: voiceStatus === "error" ? voiceError || "Voice mode unavailable" : voiceStatus === "initializing" ? "Starting voice mode..." : voiceStatus === "recording" ? "Recording..." : voiceStatus === "processing" ? "Transcribing..." : voiceLastTranscript ? `Heard: "${voiceLastTranscript.length > 60 ? `${voiceLastTranscript.slice(0, 57)}...` : voiceLastTranscript}"` : "Listening..."
21791
- }
21792
- )
21793
- ] }),
21794
21781
  !isMobile && renderAttachmentButton("attach-inline"),
21795
21782
  !isMobile && renderMemoryButton("memory-inline"),
21796
- !isMobile && renderSttButton("stt-inline"),
21783
+ !isMobile && isVoiceModeEligible && isVoiceModeEnabled && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
21784
+ import_material39.Typography,
21785
+ {
21786
+ variant: "caption",
21787
+ sx: {
21788
+ color: voiceStatus === "error" ? theme.palette.error.main : voiceStatus === "processing" ? theme.palette.warning.main : fileText,
21789
+ maxWidth: 240,
21790
+ overflow: "hidden",
21791
+ textOverflow: "ellipsis",
21792
+ whiteSpace: "nowrap"
21793
+ },
21794
+ children: voiceStatus === "error" ? voiceError || "Voice mode unavailable" : voiceStatus === "initializing" ? "Starting voice mode..." : voiceStatus === "recording" ? "Recording..." : voiceStatus === "processing" ? "Transcribing..." : voiceLastTranscript ? `Heard: "${voiceLastTranscript.length > 60 ? `${voiceLastTranscript.slice(0, 57)}...` : voiceLastTranscript}"` : "Listening..."
21795
+ }
21796
+ ),
21797
21797
  isMobile && hasSecondaryActions && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
21798
21798
  import_material39.IconButton,
21799
21799
  {
@@ -21849,7 +21849,9 @@ ${sanitize(
21849
21849
  ),
21850
21850
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_material39.Box, { sx: { display: "flex", alignItems: "center", gap: isMobile ? 0.6 : 1 }, children: [
21851
21851
  !isMobile && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(engine_picker_default, {}),
21852
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material39.Tooltip, { title: isStreaming ? "Stop response" : "Send message", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
21852
+ !isMobile && renderSttButton("stt-right"),
21853
+ isVoiceModeEligible && !showSendButton && renderVoiceModeButton("voice-right"),
21854
+ showSendButton && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material39.Tooltip, { title: isStreaming ? "Stop response" : "Send message", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
21853
21855
  import_material39.IconButton,
21854
21856
  {
21855
21857
  onClick: isStreaming ? onStop || (() => {