@burtson-labs/bandit-engine 2.0.23 → 2.0.24

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-ZRTP2N7E.mjs";
3
+ } from "./chunk-IGD4KGB5.mjs";
4
4
  import {
5
5
  chat_provider_default
6
6
  } from "./chunk-6PQRG6W4.mjs";
@@ -10,7 +10,7 @@ import {
10
10
  useGatewayHealth,
11
11
  useGatewayMemory,
12
12
  useGatewayModels
13
- } from "./chunk-JTZL6WJJ.mjs";
13
+ } from "./chunk-XXMCI2WK.mjs";
14
14
  import "./chunk-7RLN6ZGT.mjs";
15
15
  import "./chunk-RTQDQ6TC.mjs";
16
16
  import {
@@ -19620,6 +19620,8 @@ var init_chat_input = __esm({
19620
19620
  const isMemoryEnabled = preferences.memoryEnabled && showMemoryToggle();
19621
19621
  const isDocumentUploadEnabled = showDocumentUpload();
19622
19622
  const isFeedbackEnabled = preferences.feedbackEnabled;
19623
+ const gatewayUrlLower = packageSettings?.gatewayApiUrl?.toLowerCase?.() ?? "";
19624
+ const isPlaygroundMode3 = packageSettings?.playgroundMode === true || gatewayUrlLower.startsWith("playground://") || typeof window !== "undefined" && window.location.pathname.includes("/playground");
19623
19625
  (0, import_react39.useEffect)(() => {
19624
19626
  const lockViewportHeight = () => {
19625
19627
  if (isMobile) {
@@ -19773,7 +19775,7 @@ ${sanitize(escapePromptInjection(value), file.name)}`;
19773
19775
  const page = await pdf.getPage(i + 1);
19774
19776
  const content = await page.getTextContent();
19775
19777
  return content.items.map((item) => {
19776
- if (typeof item.str === "string") {
19778
+ if (item && typeof item === "object" && "str" in item && typeof item.str === "string") {
19777
19779
  return item.str;
19778
19780
  }
19779
19781
  return "";
@@ -19833,7 +19835,7 @@ ${sanitize(
19833
19835
  inputRef.current?.focus();
19834
19836
  };
19835
19837
  const memory = localStorage.getItem("bandit-memory");
19836
- const hasAttachmentAction = fileInputs.length < 3 && isDocumentUploadEnabled;
19838
+ const hasAttachmentAction = !isPlaygroundMode3 && fileInputs.length < 3 && isDocumentUploadEnabled;
19837
19839
  const hasMemoryAction = isMemoryEnabled;
19838
19840
  const hasFeedbackAction = isFeedbackEnabled && isMobile;
19839
19841
  const hasSttAction = isSTTAvailable && !isVoiceModeEnabled;
@@ -24449,6 +24451,7 @@ var init_conversation_drawer = __esm({
24449
24451
  display: "flex",
24450
24452
  alignItems: "center",
24451
24453
  gap: 1.5,
24454
+ justifyContent: "center",
24452
24455
  bgcolor: (0, import_material37.alpha)(theme.palette.background.default, isMobile ? 0.9 : 0.6)
24453
24456
  },
24454
24457
  children: [
@@ -24467,33 +24470,39 @@ var init_conversation_drawer = __esm({
24467
24470
  children: avatarInitials
24468
24471
  }
24469
24472
  ),
24470
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_material37.Box, { sx: { minWidth: 0, flex: 1 }, children: [
24471
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
24472
- import_material37.Typography,
24473
- {
24474
- variant: "subtitle2",
24475
- noWrap: true,
24476
- sx: { fontWeight: 600, color: theme.palette.text.primary },
24477
- children: user2 ? userDisplayName : "Not signed in"
24478
- }
24479
- ),
24480
- user2 ? userSecondaryText ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
24481
- import_material37.Typography,
24482
- {
24483
- variant: "caption",
24484
- noWrap: true,
24485
- sx: { color: theme.palette.text.secondary },
24486
- children: userSecondaryText
24487
- }
24488
- ) : null : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
24489
- import_material37.Typography,
24490
- {
24491
- variant: "caption",
24492
- sx: { color: theme.palette.text.secondary },
24493
- children: "Connect your account to sync chats"
24494
- }
24495
- )
24496
- ] })
24473
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
24474
+ import_material37.Box,
24475
+ {
24476
+ sx: {
24477
+ minWidth: 0,
24478
+ flex: 1,
24479
+ display: "flex",
24480
+ flexDirection: "column",
24481
+ alignItems: isMobile ? "center" : "flex-start",
24482
+ textAlign: isMobile ? "center" : "left",
24483
+ gap: 0.25
24484
+ },
24485
+ children: [
24486
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
24487
+ import_material37.Typography,
24488
+ {
24489
+ variant: "subtitle2",
24490
+ noWrap: true,
24491
+ sx: { fontWeight: 600, color: theme.palette.text.primary },
24492
+ children: user2 ? userDisplayName : "Not signed in"
24493
+ }
24494
+ ),
24495
+ !user2 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
24496
+ import_material37.Typography,
24497
+ {
24498
+ variant: "caption",
24499
+ sx: { color: theme.palette.text.secondary },
24500
+ children: "Connect your account to sync chats"
24501
+ }
24502
+ )
24503
+ ]
24504
+ }
24505
+ )
24497
24506
  ]
24498
24507
  }
24499
24508
  )
@@ -25389,7 +25398,7 @@ var init_enhanced_mobile_conversations_modal = __esm({
25389
25398
  children: avatarInitials
25390
25399
  }
25391
25400
  ),
25392
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material38.Box, { sx: { display: "flex", alignItems: "center", gap: 1, minWidth: 0, flexWrap: "wrap", justifyContent: "center" }, children: [
25401
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material38.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", gap: 0.5, minWidth: 0 }, children: [
25393
25402
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
25394
25403
  import_material38.Typography,
25395
25404
  {
@@ -25399,24 +25408,13 @@ var init_enhanced_mobile_conversations_modal = __esm({
25399
25408
  children: user2 ? userDisplayName : "Not signed in"
25400
25409
  }
25401
25410
  ),
25402
- user2 ? userSecondaryText ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
25403
- import_material38.Typography,
25404
- {
25405
- variant: "caption",
25406
- noWrap: true,
25407
- sx: { color: theme.palette.text.secondary },
25408
- children: [
25409
- "\u2022 ",
25410
- userSecondaryText
25411
- ]
25412
- }
25413
- ) : null : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
25411
+ !user2 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
25414
25412
  import_material38.Typography,
25415
25413
  {
25416
25414
  variant: "caption",
25417
25415
  sx: { color: theme.palette.text.secondary },
25418
25416
  noWrap: true,
25419
- children: "\u2022 Connect your account to sync chats"
25417
+ children: "Connect your account to sync chats"
25420
25418
  }
25421
25419
  )
25422
25420
  ] })
@@ -25602,7 +25600,8 @@ var init_chat_app_bar = __esm({
25602
25600
  pendingCount,
25603
25601
  warningConversations,
25604
25602
  oversizedConversations,
25605
- triggerSync
25603
+ triggerSync,
25604
+ setSyncEnabled
25606
25605
  } = useConversationSyncStore((state) => ({
25607
25606
  syncEnabled: state.syncEnabled,
25608
25607
  syncStatus: state.status,
@@ -25610,8 +25609,18 @@ var init_chat_app_bar = __esm({
25610
25609
  pendingCount: state.pendingConversationUpserts.size + state.pendingConversationDeletes.size + state.pendingProjectUpserts.size + state.pendingProjectDeletes.size,
25611
25610
  warningConversations: state.warningConversations,
25612
25611
  oversizedConversations: state.oversizedConversations,
25613
- triggerSync: state.runSync
25612
+ triggerSync: state.runSync,
25613
+ setSyncEnabled: state.setSyncEnabled
25614
25614
  }), import_shallow2.shallow);
25615
+ (0, import_react50.useEffect)(() => {
25616
+ if (isPlaygroundMode3 && syncEnabled) {
25617
+ void setSyncEnabled(false).catch((error) => {
25618
+ debugLogger.warn("ChatAppBar: Failed to disable sync in playground", {
25619
+ error: error instanceof Error ? error.message : String(error)
25620
+ });
25621
+ });
25622
+ }
25623
+ }, [isPlaygroundMode3, syncEnabled, setSyncEnabled]);
25615
25624
  const syncSpinSx = {
25616
25625
  animation: "spin 1s linear infinite",
25617
25626
  "@keyframes spin": {
@@ -25620,7 +25629,7 @@ var init_chat_app_bar = __esm({
25620
25629
  }
25621
25630
  };
25622
25631
  const syncIndicatorIcon = (() => {
25623
- if (!syncEnabled) {
25632
+ if (isPlaygroundMode3 || !syncEnabled) {
25624
25633
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_CloudOff3.default, { fontSize: "small", color: "disabled" });
25625
25634
  }
25626
25635
  switch (syncStatus) {
@@ -25634,6 +25643,9 @@ var init_chat_app_bar = __esm({
25634
25643
  }
25635
25644
  })();
25636
25645
  const syncTooltip = (() => {
25646
+ if (isPlaygroundMode3) {
25647
+ return "Cloud sync is unavailable in playground mode.";
25648
+ }
25637
25649
  if (!syncEnabled) {
25638
25650
  return "Cloud sync is disabled. Enable it from Management > Preferences.";
25639
25651
  }
@@ -25653,8 +25665,9 @@ var init_chat_app_bar = __esm({
25653
25665
  const last = lastSyncAt ? ` Last sync ${new Date(lastSyncAt).toLocaleTimeString()}.` : "";
25654
25666
  return `${base}${pending}${last}`;
25655
25667
  })();
25668
+ const syncButtonDisabled = isPlaygroundMode3 || !syncEnabled;
25656
25669
  const handleSyncBadgeClick = () => {
25657
- if (!syncEnabled || syncStatus === "syncing") {
25670
+ if (isPlaygroundMode3 || !syncEnabled || syncStatus === "syncing") {
25658
25671
  return;
25659
25672
  }
25660
25673
  void triggerSync({ force: true });
@@ -25784,18 +25797,19 @@ var init_chat_app_bar = __esm({
25784
25797
  import_material40.IconButton,
25785
25798
  {
25786
25799
  onClick: handleSyncBadgeClick,
25800
+ disabled: syncButtonDisabled,
25787
25801
  sx: {
25788
25802
  ...pillButtonStyles,
25789
- color: syncEnabled ? theme.palette.primary.main : theme.palette.action.disabled,
25790
- bgcolor: syncEnabled ? syncStatus === "error" ? theme.palette.error.main + "20" : theme.palette.primary.main + "12" : "transparent",
25791
- "&:hover": syncEnabled ? {
25803
+ color: syncButtonDisabled ? theme.palette.action.disabled : theme.palette.primary.main,
25804
+ bgcolor: syncButtonDisabled ? "transparent" : syncStatus === "error" ? theme.palette.error.main + "20" : theme.palette.primary.main + "12",
25805
+ "&:hover": syncButtonDisabled ? {} : {
25792
25806
  bgcolor: syncStatus === "error" ? theme.palette.error.main + "30" : theme.palette.primary.main + "20"
25793
- } : {}
25807
+ }
25794
25808
  },
25795
25809
  "aria-label": "Conversation sync status",
25796
25810
  children: [
25797
25811
  syncIndicatorIcon,
25798
- pendingCount > 0 && syncEnabled && syncStatus !== "syncing" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
25812
+ pendingCount > 0 && !syncButtonDisabled && syncStatus !== "syncing" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
25799
25813
  import_material40.Box,
25800
25814
  {
25801
25815
  sx: {
@@ -26348,7 +26362,10 @@ var init_query_suggestion_picker = __esm({
26348
26362
  markdownComponents = {
26349
26363
  p: ({ node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { ...props }),
26350
26364
  mark: ({ node, children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("mark", { ...props, children }),
26351
- code: ({ node, inline, children, ...props }) => inline ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("code", { ...props, children }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("code", { ...props, children })
26365
+ code: ({ node, children, ...props }) => {
26366
+ const { inline, ...rest } = props;
26367
+ return inline ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("code", { ...rest, children }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("code", { ...rest, children });
26368
+ }
26352
26369
  };
26353
26370
  QuerySuggestionPicker = ({
26354
26371
  onSend,