@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.js CHANGED
@@ -17381,6 +17381,8 @@ var init_chat_input = __esm({
17381
17381
  const isMemoryEnabled = preferences.memoryEnabled && showMemoryToggle();
17382
17382
  const isDocumentUploadEnabled = showDocumentUpload();
17383
17383
  const isFeedbackEnabled = preferences.feedbackEnabled;
17384
+ const gatewayUrlLower = packageSettings?.gatewayApiUrl?.toLowerCase?.() ?? "";
17385
+ const isPlaygroundMode3 = packageSettings?.playgroundMode === true || gatewayUrlLower.startsWith("playground://") || typeof window !== "undefined" && window.location.pathname.includes("/playground");
17384
17386
  (0, import_react19.useEffect)(() => {
17385
17387
  const lockViewportHeight = () => {
17386
17388
  if (isMobile) {
@@ -17534,7 +17536,7 @@ ${sanitize(escapePromptInjection(value), file.name)}`;
17534
17536
  const page = await pdf.getPage(i + 1);
17535
17537
  const content = await page.getTextContent();
17536
17538
  return content.items.map((item) => {
17537
- if (typeof item.str === "string") {
17539
+ if (item && typeof item === "object" && "str" in item && typeof item.str === "string") {
17538
17540
  return item.str;
17539
17541
  }
17540
17542
  return "";
@@ -17594,7 +17596,7 @@ ${sanitize(
17594
17596
  inputRef.current?.focus();
17595
17597
  };
17596
17598
  const memory = localStorage.getItem("bandit-memory");
17597
- const hasAttachmentAction = fileInputs.length < 3 && isDocumentUploadEnabled;
17599
+ const hasAttachmentAction = !isPlaygroundMode3 && fileInputs.length < 3 && isDocumentUploadEnabled;
17598
17600
  const hasMemoryAction = isMemoryEnabled;
17599
17601
  const hasFeedbackAction = isFeedbackEnabled && isMobile;
17600
17602
  const hasSttAction = isSTTAvailable && !isVoiceModeEnabled;
@@ -22210,6 +22212,7 @@ var init_conversation_drawer = __esm({
22210
22212
  display: "flex",
22211
22213
  alignItems: "center",
22212
22214
  gap: 1.5,
22215
+ justifyContent: "center",
22213
22216
  bgcolor: (0, import_material19.alpha)(theme.palette.background.default, isMobile ? 0.9 : 0.6)
22214
22217
  },
22215
22218
  children: [
@@ -22228,33 +22231,39 @@ var init_conversation_drawer = __esm({
22228
22231
  children: avatarInitials
22229
22232
  }
22230
22233
  ),
22231
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material19.Box, { sx: { minWidth: 0, flex: 1 }, children: [
22232
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22233
- import_material19.Typography,
22234
- {
22235
- variant: "subtitle2",
22236
- noWrap: true,
22237
- sx: { fontWeight: 600, color: theme.palette.text.primary },
22238
- children: user2 ? userDisplayName : "Not signed in"
22239
- }
22240
- ),
22241
- user2 ? userSecondaryText ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22242
- import_material19.Typography,
22243
- {
22244
- variant: "caption",
22245
- noWrap: true,
22246
- sx: { color: theme.palette.text.secondary },
22247
- children: userSecondaryText
22248
- }
22249
- ) : null : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22250
- import_material19.Typography,
22251
- {
22252
- variant: "caption",
22253
- sx: { color: theme.palette.text.secondary },
22254
- children: "Connect your account to sync chats"
22255
- }
22256
- )
22257
- ] })
22234
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
22235
+ import_material19.Box,
22236
+ {
22237
+ sx: {
22238
+ minWidth: 0,
22239
+ flex: 1,
22240
+ display: "flex",
22241
+ flexDirection: "column",
22242
+ alignItems: isMobile ? "center" : "flex-start",
22243
+ textAlign: isMobile ? "center" : "left",
22244
+ gap: 0.25
22245
+ },
22246
+ children: [
22247
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22248
+ import_material19.Typography,
22249
+ {
22250
+ variant: "subtitle2",
22251
+ noWrap: true,
22252
+ sx: { fontWeight: 600, color: theme.palette.text.primary },
22253
+ children: user2 ? userDisplayName : "Not signed in"
22254
+ }
22255
+ ),
22256
+ !user2 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22257
+ import_material19.Typography,
22258
+ {
22259
+ variant: "caption",
22260
+ sx: { color: theme.palette.text.secondary },
22261
+ children: "Connect your account to sync chats"
22262
+ }
22263
+ )
22264
+ ]
22265
+ }
22266
+ )
22258
22267
  ]
22259
22268
  }
22260
22269
  )
@@ -23150,7 +23159,7 @@ var init_enhanced_mobile_conversations_modal = __esm({
23150
23159
  children: avatarInitials
23151
23160
  }
23152
23161
  ),
23153
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material20.Box, { sx: { display: "flex", alignItems: "center", gap: 1, minWidth: 0, flexWrap: "wrap", justifyContent: "center" }, children: [
23162
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material20.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", gap: 0.5, minWidth: 0 }, children: [
23154
23163
  /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
23155
23164
  import_material20.Typography,
23156
23165
  {
@@ -23160,24 +23169,13 @@ var init_enhanced_mobile_conversations_modal = __esm({
23160
23169
  children: user2 ? userDisplayName : "Not signed in"
23161
23170
  }
23162
23171
  ),
23163
- user2 ? userSecondaryText ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
23164
- import_material20.Typography,
23165
- {
23166
- variant: "caption",
23167
- noWrap: true,
23168
- sx: { color: theme.palette.text.secondary },
23169
- children: [
23170
- "\u2022 ",
23171
- userSecondaryText
23172
- ]
23173
- }
23174
- ) : null : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
23172
+ !user2 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
23175
23173
  import_material20.Typography,
23176
23174
  {
23177
23175
  variant: "caption",
23178
23176
  sx: { color: theme.palette.text.secondary },
23179
23177
  noWrap: true,
23180
- children: "\u2022 Connect your account to sync chats"
23178
+ children: "Connect your account to sync chats"
23181
23179
  }
23182
23180
  )
23183
23181
  ] })
@@ -23363,7 +23361,8 @@ var init_chat_app_bar = __esm({
23363
23361
  pendingCount,
23364
23362
  warningConversations,
23365
23363
  oversizedConversations,
23366
- triggerSync
23364
+ triggerSync,
23365
+ setSyncEnabled
23367
23366
  } = useConversationSyncStore((state) => ({
23368
23367
  syncEnabled: state.syncEnabled,
23369
23368
  syncStatus: state.status,
@@ -23371,8 +23370,18 @@ var init_chat_app_bar = __esm({
23371
23370
  pendingCount: state.pendingConversationUpserts.size + state.pendingConversationDeletes.size + state.pendingProjectUpserts.size + state.pendingProjectDeletes.size,
23372
23371
  warningConversations: state.warningConversations,
23373
23372
  oversizedConversations: state.oversizedConversations,
23374
- triggerSync: state.runSync
23373
+ triggerSync: state.runSync,
23374
+ setSyncEnabled: state.setSyncEnabled
23375
23375
  }), import_shallow2.shallow);
23376
+ (0, import_react30.useEffect)(() => {
23377
+ if (isPlaygroundMode3 && syncEnabled) {
23378
+ void setSyncEnabled(false).catch((error) => {
23379
+ debugLogger.warn("ChatAppBar: Failed to disable sync in playground", {
23380
+ error: error instanceof Error ? error.message : String(error)
23381
+ });
23382
+ });
23383
+ }
23384
+ }, [isPlaygroundMode3, syncEnabled, setSyncEnabled]);
23376
23385
  const syncSpinSx = {
23377
23386
  animation: "spin 1s linear infinite",
23378
23387
  "@keyframes spin": {
@@ -23381,7 +23390,7 @@ var init_chat_app_bar = __esm({
23381
23390
  }
23382
23391
  };
23383
23392
  const syncIndicatorIcon = (() => {
23384
- if (!syncEnabled) {
23393
+ if (isPlaygroundMode3 || !syncEnabled) {
23385
23394
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_CloudOff2.default, { fontSize: "small", color: "disabled" });
23386
23395
  }
23387
23396
  switch (syncStatus) {
@@ -23395,6 +23404,9 @@ var init_chat_app_bar = __esm({
23395
23404
  }
23396
23405
  })();
23397
23406
  const syncTooltip = (() => {
23407
+ if (isPlaygroundMode3) {
23408
+ return "Cloud sync is unavailable in playground mode.";
23409
+ }
23398
23410
  if (!syncEnabled) {
23399
23411
  return "Cloud sync is disabled. Enable it from Management > Preferences.";
23400
23412
  }
@@ -23414,8 +23426,9 @@ var init_chat_app_bar = __esm({
23414
23426
  const last = lastSyncAt ? ` Last sync ${new Date(lastSyncAt).toLocaleTimeString()}.` : "";
23415
23427
  return `${base}${pending}${last}`;
23416
23428
  })();
23429
+ const syncButtonDisabled = isPlaygroundMode3 || !syncEnabled;
23417
23430
  const handleSyncBadgeClick = () => {
23418
- if (!syncEnabled || syncStatus === "syncing") {
23431
+ if (isPlaygroundMode3 || !syncEnabled || syncStatus === "syncing") {
23419
23432
  return;
23420
23433
  }
23421
23434
  void triggerSync({ force: true });
@@ -23545,18 +23558,19 @@ var init_chat_app_bar = __esm({
23545
23558
  import_material22.IconButton,
23546
23559
  {
23547
23560
  onClick: handleSyncBadgeClick,
23561
+ disabled: syncButtonDisabled,
23548
23562
  sx: {
23549
23563
  ...pillButtonStyles,
23550
- color: syncEnabled ? theme.palette.primary.main : theme.palette.action.disabled,
23551
- bgcolor: syncEnabled ? syncStatus === "error" ? theme.palette.error.main + "20" : theme.palette.primary.main + "12" : "transparent",
23552
- "&:hover": syncEnabled ? {
23564
+ color: syncButtonDisabled ? theme.palette.action.disabled : theme.palette.primary.main,
23565
+ bgcolor: syncButtonDisabled ? "transparent" : syncStatus === "error" ? theme.palette.error.main + "20" : theme.palette.primary.main + "12",
23566
+ "&:hover": syncButtonDisabled ? {} : {
23553
23567
  bgcolor: syncStatus === "error" ? theme.palette.error.main + "30" : theme.palette.primary.main + "20"
23554
- } : {}
23568
+ }
23555
23569
  },
23556
23570
  "aria-label": "Conversation sync status",
23557
23571
  children: [
23558
23572
  syncIndicatorIcon,
23559
- pendingCount > 0 && syncEnabled && syncStatus !== "syncing" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23573
+ pendingCount > 0 && !syncButtonDisabled && syncStatus !== "syncing" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23560
23574
  import_material22.Box,
23561
23575
  {
23562
23576
  sx: {
@@ -24109,7 +24123,10 @@ var init_query_suggestion_picker = __esm({
24109
24123
  markdownComponents = {
24110
24124
  p: ({ node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { ...props }),
24111
24125
  mark: ({ node, children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("mark", { ...props, children }),
24112
- code: ({ node, inline, children, ...props }) => inline ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { ...props, children }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { ...props, children })
24126
+ code: ({ node, children, ...props }) => {
24127
+ const { inline, ...rest } = props;
24128
+ return inline ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { ...rest, children }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { ...rest, children });
24129
+ }
24113
24130
  };
24114
24131
  QuerySuggestionPicker = ({
24115
24132
  onSend,