@burtson-labs/bandit-engine 2.0.84 → 2.0.86

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.
Files changed (34) hide show
  1. package/dist/{chat-OY5CLOBW.mjs → chat-QMGKUFBI.mjs} +6 -6
  2. package/dist/chat-provider.js.map +1 -1
  3. package/dist/chat-provider.mjs +4 -4
  4. package/dist/{chunk-YYYEMVBV.mjs → chunk-7SQLHCBV.mjs} +2 -2
  5. package/dist/{chunk-5DSDARPR.mjs → chunk-AJSGL2XJ.mjs} +3 -3
  6. package/dist/{chunk-57L7TXB6.mjs → chunk-C2L6ZSWR.mjs} +4 -4
  7. package/dist/{chunk-57L7TXB6.mjs.map → chunk-C2L6ZSWR.mjs.map} +1 -1
  8. package/dist/{chunk-RVKERD5O.mjs → chunk-FIZVBEAY.mjs} +84 -20
  9. package/dist/chunk-FIZVBEAY.mjs.map +1 -0
  10. package/dist/{chunk-6ITUH375.mjs → chunk-I4QUXTIM.mjs} +2 -2
  11. package/dist/{chunk-3QYZOCIW.mjs → chunk-OICDRDQZ.mjs} +8 -8
  12. package/dist/{chunk-OPN32F2X.mjs → chunk-TETTI3QV.mjs} +4 -4
  13. package/dist/{chunk-3LT77723.mjs → chunk-WQLKBI3Y.mjs} +2 -2
  14. package/dist/{chunk-4D7245ZO.mjs → chunk-ZLBREJKH.mjs} +16 -1
  15. package/dist/chunk-ZLBREJKH.mjs.map +1 -0
  16. package/dist/index.js +96 -17
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +9 -9
  19. package/dist/management/management.js +96 -17
  20. package/dist/management/management.js.map +1 -1
  21. package/dist/management/management.mjs +7 -7
  22. package/dist/modals/chat-modal/chat-modal.js +2 -2
  23. package/dist/modals/chat-modal/chat-modal.js.map +1 -1
  24. package/dist/modals/chat-modal/chat-modal.mjs +3 -3
  25. package/package.json +1 -1
  26. package/dist/chunk-4D7245ZO.mjs.map +0 -1
  27. package/dist/chunk-RVKERD5O.mjs.map +0 -1
  28. /package/dist/{chat-OY5CLOBW.mjs.map → chat-QMGKUFBI.mjs.map} +0 -0
  29. /package/dist/{chunk-YYYEMVBV.mjs.map → chunk-7SQLHCBV.mjs.map} +0 -0
  30. /package/dist/{chunk-5DSDARPR.mjs.map → chunk-AJSGL2XJ.mjs.map} +0 -0
  31. /package/dist/{chunk-6ITUH375.mjs.map → chunk-I4QUXTIM.mjs.map} +0 -0
  32. /package/dist/{chunk-3QYZOCIW.mjs.map → chunk-OICDRDQZ.mjs.map} +0 -0
  33. /package/dist/{chunk-OPN32F2X.mjs.map → chunk-TETTI3QV.mjs.map} +0 -0
  34. /package/dist/{chunk-3LT77723.mjs.map → chunk-WQLKBI3Y.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  chat_default
3
- } from "./chunk-RVKERD5O.mjs";
3
+ } from "./chunk-FIZVBEAY.mjs";
4
4
  import {
5
5
  chat_provider_default
6
- } from "./chunk-OPN32F2X.mjs";
6
+ } from "./chunk-TETTI3QV.mjs";
7
7
  import "./chunk-ONQMRE2G.mjs";
8
8
  import {
9
9
  management_default,
10
10
  useGatewayHealth,
11
11
  useGatewayMemory,
12
12
  useGatewayModels
13
- } from "./chunk-3QYZOCIW.mjs";
14
- import "./chunk-YYYEMVBV.mjs";
15
- import "./chunk-6ITUH375.mjs";
16
- import "./chunk-3LT77723.mjs";
13
+ } from "./chunk-OICDRDQZ.mjs";
14
+ import "./chunk-7SQLHCBV.mjs";
15
+ import "./chunk-I4QUXTIM.mjs";
16
+ import "./chunk-WQLKBI3Y.mjs";
17
17
  import {
18
18
  defineCustomElement
19
19
  } from "./chunk-IXIM7BNO.mjs";
20
20
  import {
21
21
  chat_modal_default
22
- } from "./chunk-5DSDARPR.mjs";
22
+ } from "./chunk-AJSGL2XJ.mjs";
23
23
  import {
24
24
  FeedbackButton,
25
25
  FeedbackModal,
@@ -37,7 +37,7 @@ import {
37
37
  useTTS,
38
38
  useVoiceStore,
39
39
  voiceService
40
- } from "./chunk-57L7TXB6.mjs";
40
+ } from "./chunk-C2L6ZSWR.mjs";
41
41
  import {
42
42
  DEFAULT_TIER_FEATURES,
43
43
  FeatureFlagContext,
@@ -58,7 +58,7 @@ import {
58
58
  useVectorStore,
59
59
  vectorDatabaseService,
60
60
  vectorMigrationService
61
- } from "./chunk-4D7245ZO.mjs";
61
+ } from "./chunk-ZLBREJKH.mjs";
62
62
  import {
63
63
  usePackageSettingsStore,
64
64
  usePreferencesStore
@@ -6222,7 +6222,7 @@ var init_vectorMigrationService = __esm({
6222
6222
  });
6223
6223
 
6224
6224
  // src/store/authenticationStore.ts
6225
- var import_zustand5, TOKEN_KEY, validToken, user, rawToken, useAuthenticationStore;
6225
+ var import_zustand5, TOKEN_KEY, validToken, user, rawToken, useAuthenticationStore, readPersistedToken;
6226
6226
  var init_authenticationStore = __esm({
6227
6227
  "src/store/authenticationStore.ts"() {
6228
6228
  "use strict";
@@ -6275,6 +6275,20 @@ var init_authenticationStore = __esm({
6275
6275
  set({ token: null, authError: null, user: null });
6276
6276
  }
6277
6277
  }));
6278
+ readPersistedToken = () => {
6279
+ try {
6280
+ const raw = localStorage.getItem(TOKEN_KEY);
6281
+ if (!raw) return null;
6282
+ const base64 = raw.split(".")[1].replace(/-/g, "+").replace(/_/g, "/");
6283
+ const json2 = decodeURIComponent(
6284
+ atob(base64).split("").map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join("")
6285
+ );
6286
+ const decoded = JSON.parse(json2);
6287
+ return decoded.exp * 1e3 > Date.now() ? raw : null;
6288
+ } catch {
6289
+ return null;
6290
+ }
6291
+ };
6278
6292
  }
6279
6293
  });
6280
6294
 
@@ -14362,7 +14376,7 @@ var init_memory_modal = __esm({
14362
14376
  fontSize: "0.8rem",
14363
14377
  fontWeight: 500,
14364
14378
  zIndex: 1
14365
- }, children: "Advanced Vector Memory Active \u2022 Memories synced to AI database for enhanced semantic search" })
14379
+ }, children: "Cloud memory \xB7 synced to your account" })
14366
14380
  ] }),
14367
14381
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_material9.Box, { sx: { flexShrink: 0 }, children: [
14368
14382
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_material9.Box, { sx: { px: isMobileView ? 1.5 : 2, py: isMobileView ? 1.25 : 1.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
@@ -14370,7 +14384,7 @@ var init_memory_modal = __esm({
14370
14384
  {
14371
14385
  variant: "body2",
14372
14386
  sx: { color: theme.palette.text.secondary, fontSize: "0.85rem", textAlign: isMobileView ? "left" : "center" },
14373
- children: shouldUseVectorForMemories ? "Semantic memory \u2014 searches meaning across your conversations." : "Private and local. You decide what's remembered."
14387
+ children: shouldUseVectorForMemories ? "Synced to your account for quick recall." : "Private and local. You decide what's remembered."
14374
14388
  }
14375
14389
  ) }),
14376
14390
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
@@ -25976,6 +25990,11 @@ var init_conversation_drawer = __esm({
25976
25990
  return void 0;
25977
25991
  }, [user2, userDisplayName]);
25978
25992
  const [avatarImage, setAvatarImage] = (0, import_react54.useState)(BANDIT_AVATAR);
25993
+ (0, import_react54.useEffect)(() => {
25994
+ const fresh = readPersistedToken();
25995
+ const store = useAuthenticationStore.getState();
25996
+ if (fresh && fresh !== store.token) store.setToken(fresh);
25997
+ }, []);
25979
25998
  (0, import_react54.useEffect)(() => {
25980
25999
  let active2 = true;
25981
26000
  let objectUrl = null;
@@ -26717,6 +26736,8 @@ var init_enhanced_mobile_conversations_modal = __esm({
26717
26736
  init_conversationStore();
26718
26737
  init_projectStore();
26719
26738
  init_authenticationStore();
26739
+ init_packageSettingsStore();
26740
+ init_memory_modal();
26720
26741
  init_brandingService();
26721
26742
  init_project_management_modal();
26722
26743
  init_move_conversation_modal();
@@ -26775,6 +26796,7 @@ var init_enhanced_mobile_conversations_modal = __esm({
26775
26796
  deleteProject
26776
26797
  } = useProjectStore();
26777
26798
  const [projectManagementOpen, setProjectManagementOpen] = (0, import_react55.useState)(false);
26799
+ const [memoryModalOpen, setMemoryModalOpen] = (0, import_react55.useState)(false);
26778
26800
  const [collapsedProjects, setCollapsedProjects] = (0, import_react55.useState)(/* @__PURE__ */ new Set());
26779
26801
  const didInitCollapseRef = (0, import_react55.useRef)(false);
26780
26802
  const [searchQuery, setSearchQuery] = (0, import_react55.useState)("");
@@ -26819,21 +26841,49 @@ var init_enhanced_mobile_conversations_modal = __esm({
26819
26841
  return void 0;
26820
26842
  }, [user2, userDisplayName]);
26821
26843
  (0, import_react55.useEffect)(() => {
26822
- const fetchBranding = async () => {
26844
+ if (!open) return;
26845
+ const fresh = readPersistedToken();
26846
+ const authStore = useAuthenticationStore.getState();
26847
+ if (fresh && fresh !== authStore.token) authStore.setToken(fresh);
26848
+ let active2 = true;
26849
+ let objectUrl = null;
26850
+ const resolveAvatar2 = async () => {
26851
+ try {
26852
+ const avatarId = getCustomClaim("avatarUrl");
26853
+ const fileStorageApiUrl = usePackageSettingsStore.getState().settings?.fileStorageApiUrl;
26854
+ const token = useAuthenticationStore.getState().token;
26855
+ if (avatarId && fileStorageApiUrl && token) {
26856
+ const base = fileStorageApiUrl.replace(/\/$/, "");
26857
+ const res = await fetch(`${base}/app-asset/download/${encodeURIComponent(avatarId)}`, {
26858
+ headers: { Authorization: `Bearer ${token}` }
26859
+ });
26860
+ if (res.ok) {
26861
+ const blob = await res.blob();
26862
+ if (active2) {
26863
+ objectUrl = URL.createObjectURL(blob);
26864
+ setAvatarImage(objectUrl);
26865
+ }
26866
+ return;
26867
+ }
26868
+ }
26869
+ } catch {
26870
+ }
26823
26871
  try {
26824
26872
  const branding = await brandingService_default.getBranding();
26825
- setAvatarImage(branding?.logoBase64 || BANDIT_AVATAR2);
26873
+ if (active2) setAvatarImage(branding?.logoBase64 || BANDIT_AVATAR2);
26826
26874
  } catch (error) {
26827
26875
  debugLogger.error("Failed to load branding avatar", {
26828
26876
  error: error instanceof Error ? error.message : String(error)
26829
26877
  });
26830
- setAvatarImage(BANDIT_AVATAR2);
26878
+ if (active2) setAvatarImage(BANDIT_AVATAR2);
26831
26879
  }
26832
26880
  };
26833
- if (open) {
26834
- fetchBranding();
26835
- }
26836
- }, [open]);
26881
+ resolveAvatar2();
26882
+ return () => {
26883
+ active2 = false;
26884
+ if (objectUrl) URL.revokeObjectURL(objectUrl);
26885
+ };
26886
+ }, [open, getCustomClaim]);
26837
26887
  const avatarLabel = userDisplayName || user2?.email || "Bandit";
26838
26888
  const avatarInitials = (0, import_react55.useMemo)(() => deriveInitials2(avatarLabel), [avatarLabel]);
26839
26889
  const buildSnippet = (text, query, idx) => {
@@ -27077,6 +27127,15 @@ var init_enhanced_mobile_conversations_modal = __esm({
27077
27127
  }
27078
27128
  }
27079
27129
  ),
27130
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
27131
+ import_material44.IconButton,
27132
+ {
27133
+ onClick: () => setMemoryModalOpen(true),
27134
+ "aria-label": "Memory",
27135
+ sx: { color: theme.palette.text.secondary },
27136
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react11.Brain, {})
27137
+ }
27138
+ ),
27080
27139
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
27081
27140
  import_material44.IconButton,
27082
27141
  {
@@ -27486,6 +27545,9 @@ var init_enhanced_mobile_conversations_modal = __esm({
27486
27545
  /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
27487
27546
  import_material44.Box,
27488
27547
  {
27548
+ onClick: user2 ? () => {
27549
+ window.location.href = "/profile";
27550
+ } : void 0,
27489
27551
  sx: {
27490
27552
  mt: "auto",
27491
27553
  px: 2,
@@ -27493,10 +27555,9 @@ var init_enhanced_mobile_conversations_modal = __esm({
27493
27555
  borderTop: `1px solid ${(0, import_styles29.alpha)(theme.palette.divider, 0.6)}`,
27494
27556
  display: "flex",
27495
27557
  alignItems: "center",
27496
- justifyContent: "center",
27497
27558
  gap: 1.25,
27498
27559
  bgcolor: (0, import_styles29.alpha)(theme.palette.background.default, 0.88),
27499
- flexWrap: "wrap"
27560
+ cursor: user2 ? "pointer" : "default"
27500
27561
  },
27501
27562
  children: [
27502
27563
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
@@ -27514,7 +27575,7 @@ var init_enhanced_mobile_conversations_modal = __esm({
27514
27575
  children: avatarInitials
27515
27576
  }
27516
27577
  ),
27517
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", gap: 0.5, minWidth: 0 }, children: [
27578
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: "flex", flexDirection: "column", flex: 1, minWidth: 0, gap: 0.25 }, children: [
27518
27579
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
27519
27580
  import_material44.Typography,
27520
27581
  {
@@ -27524,16 +27585,33 @@ var init_enhanced_mobile_conversations_modal = __esm({
27524
27585
  children: user2 ? userDisplayName : "Not signed in"
27525
27586
  }
27526
27587
  ),
27527
- !user2 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
27588
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
27528
27589
  import_material44.Typography,
27529
27590
  {
27530
27591
  variant: "caption",
27531
- sx: { color: theme.palette.text.secondary },
27532
27592
  noWrap: true,
27533
- children: "Connect your account to sync chats"
27593
+ sx: { color: theme.palette.text.secondary },
27594
+ children: user2 ? "View profile & settings" : "Connect your account to sync chats"
27534
27595
  }
27535
27596
  )
27536
- ] })
27597
+ ] }),
27598
+ user2 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
27599
+ import_material44.Box,
27600
+ {
27601
+ sx: {
27602
+ flexShrink: 0,
27603
+ display: "flex",
27604
+ alignItems: "center",
27605
+ justifyContent: "center",
27606
+ width: 30,
27607
+ height: 30,
27608
+ borderRadius: "50%",
27609
+ border: `1px solid ${(0, import_styles29.alpha)(theme.palette.divider, 0.8)}`,
27610
+ color: theme.palette.text.secondary
27611
+ },
27612
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react11.Settings, { size: 16 })
27613
+ }
27614
+ )
27537
27615
  ]
27538
27616
  }
27539
27617
  )
@@ -27549,6 +27627,7 @@ var init_enhanced_mobile_conversations_modal = __esm({
27549
27627
  onClose: () => setProjectManagementOpen(false)
27550
27628
  }
27551
27629
  ),
27630
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(memory_modal_default, { open: memoryModalOpen, onClose: () => setMemoryModalOpen(false) }),
27552
27631
  conversationToMove && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
27553
27632
  move_conversation_modal_default,
27554
27633
  {