@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.js CHANGED
@@ -46,7 +46,7 @@ var init_packageSettingsStore = __esm({
46
46
  });
47
47
 
48
48
  // src/store/authenticationStore.ts
49
- var import_zustand2, TOKEN_KEY, validToken, user, rawToken, useAuthenticationStore;
49
+ var import_zustand2, TOKEN_KEY, validToken, user, rawToken, useAuthenticationStore, readPersistedToken;
50
50
  var init_authenticationStore = __esm({
51
51
  "src/store/authenticationStore.ts"() {
52
52
  "use strict";
@@ -99,6 +99,20 @@ var init_authenticationStore = __esm({
99
99
  set({ token: null, authError: null, user: null });
100
100
  }
101
101
  }));
102
+ readPersistedToken = () => {
103
+ try {
104
+ const raw = localStorage.getItem(TOKEN_KEY);
105
+ if (!raw) return null;
106
+ const base64 = raw.split(".")[1].replace(/-/g, "+").replace(/_/g, "/");
107
+ const json2 = decodeURIComponent(
108
+ atob(base64).split("").map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join("")
109
+ );
110
+ const decoded = JSON.parse(json2);
111
+ return decoded.exp * 1e3 > Date.now() ? raw : null;
112
+ } catch {
113
+ return null;
114
+ }
115
+ };
102
116
  }
103
117
  });
104
118
 
@@ -16387,7 +16401,7 @@ var init_memory_modal = __esm({
16387
16401
  fontSize: "0.8rem",
16388
16402
  fontWeight: 500,
16389
16403
  zIndex: 1
16390
- }, children: "Advanced Vector Memory Active \u2022 Memories synced to AI database for enhanced semantic search" })
16404
+ }, children: "Cloud memory \xB7 synced to your account" })
16391
16405
  ] }),
16392
16406
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material13.Box, { sx: { flexShrink: 0 }, children: [
16393
16407
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.Box, { sx: { px: isMobileView ? 1.5 : 2, py: isMobileView ? 1.25 : 1.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
@@ -16395,7 +16409,7 @@ var init_memory_modal = __esm({
16395
16409
  {
16396
16410
  variant: "body2",
16397
16411
  sx: { color: theme.palette.text.secondary, fontSize: "0.85rem", textAlign: isMobileView ? "left" : "center" },
16398
- children: shouldUseVectorForMemories ? "Semantic memory \u2014 searches meaning across your conversations." : "Private and local. You decide what's remembered."
16412
+ children: shouldUseVectorForMemories ? "Synced to your account for quick recall." : "Private and local. You decide what's remembered."
16399
16413
  }
16400
16414
  ) }),
16401
16415
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
@@ -23737,6 +23751,11 @@ var init_conversation_drawer = __esm({
23737
23751
  return void 0;
23738
23752
  }, [user2, userDisplayName]);
23739
23753
  const [avatarImage, setAvatarImage] = (0, import_react31.useState)(BANDIT_AVATAR);
23754
+ (0, import_react31.useEffect)(() => {
23755
+ const fresh = readPersistedToken();
23756
+ const store = useAuthenticationStore.getState();
23757
+ if (fresh && fresh !== store.token) store.setToken(fresh);
23758
+ }, []);
23740
23759
  (0, import_react31.useEffect)(() => {
23741
23760
  let active2 = true;
23742
23761
  let objectUrl = null;
@@ -24478,6 +24497,8 @@ var init_enhanced_mobile_conversations_modal = __esm({
24478
24497
  init_conversationStore();
24479
24498
  init_projectStore();
24480
24499
  init_authenticationStore();
24500
+ init_packageSettingsStore();
24501
+ init_memory_modal();
24481
24502
  init_brandingService();
24482
24503
  init_project_management_modal();
24483
24504
  init_move_conversation_modal();
@@ -24536,6 +24557,7 @@ var init_enhanced_mobile_conversations_modal = __esm({
24536
24557
  deleteProject
24537
24558
  } = useProjectStore();
24538
24559
  const [projectManagementOpen, setProjectManagementOpen] = (0, import_react32.useState)(false);
24560
+ const [memoryModalOpen, setMemoryModalOpen] = (0, import_react32.useState)(false);
24539
24561
  const [collapsedProjects, setCollapsedProjects] = (0, import_react32.useState)(/* @__PURE__ */ new Set());
24540
24562
  const didInitCollapseRef = (0, import_react32.useRef)(false);
24541
24563
  const [searchQuery, setSearchQuery] = (0, import_react32.useState)("");
@@ -24580,21 +24602,49 @@ var init_enhanced_mobile_conversations_modal = __esm({
24580
24602
  return void 0;
24581
24603
  }, [user2, userDisplayName]);
24582
24604
  (0, import_react32.useEffect)(() => {
24583
- const fetchBranding = async () => {
24605
+ if (!open) return;
24606
+ const fresh = readPersistedToken();
24607
+ const authStore = useAuthenticationStore.getState();
24608
+ if (fresh && fresh !== authStore.token) authStore.setToken(fresh);
24609
+ let active2 = true;
24610
+ let objectUrl = null;
24611
+ const resolveAvatar2 = async () => {
24612
+ try {
24613
+ const avatarId = getCustomClaim("avatarUrl");
24614
+ const fileStorageApiUrl = usePackageSettingsStore.getState().settings?.fileStorageApiUrl;
24615
+ const token = useAuthenticationStore.getState().token;
24616
+ if (avatarId && fileStorageApiUrl && token) {
24617
+ const base = fileStorageApiUrl.replace(/\/$/, "");
24618
+ const res = await fetch(`${base}/app-asset/download/${encodeURIComponent(avatarId)}`, {
24619
+ headers: { Authorization: `Bearer ${token}` }
24620
+ });
24621
+ if (res.ok) {
24622
+ const blob = await res.blob();
24623
+ if (active2) {
24624
+ objectUrl = URL.createObjectURL(blob);
24625
+ setAvatarImage(objectUrl);
24626
+ }
24627
+ return;
24628
+ }
24629
+ }
24630
+ } catch {
24631
+ }
24584
24632
  try {
24585
24633
  const branding = await brandingService_default.getBranding();
24586
- setAvatarImage(branding?.logoBase64 || BANDIT_AVATAR2);
24634
+ if (active2) setAvatarImage(branding?.logoBase64 || BANDIT_AVATAR2);
24587
24635
  } catch (error) {
24588
24636
  debugLogger.error("Failed to load branding avatar", {
24589
24637
  error: error instanceof Error ? error.message : String(error)
24590
24638
  });
24591
- setAvatarImage(BANDIT_AVATAR2);
24639
+ if (active2) setAvatarImage(BANDIT_AVATAR2);
24592
24640
  }
24593
24641
  };
24594
- if (open) {
24595
- fetchBranding();
24596
- }
24597
- }, [open]);
24642
+ resolveAvatar2();
24643
+ return () => {
24644
+ active2 = false;
24645
+ if (objectUrl) URL.revokeObjectURL(objectUrl);
24646
+ };
24647
+ }, [open, getCustomClaim]);
24598
24648
  const avatarLabel = userDisplayName || user2?.email || "Bandit";
24599
24649
  const avatarInitials = (0, import_react32.useMemo)(() => deriveInitials2(avatarLabel), [avatarLabel]);
24600
24650
  const buildSnippet = (text, query, idx) => {
@@ -24838,6 +24888,15 @@ var init_enhanced_mobile_conversations_modal = __esm({
24838
24888
  }
24839
24889
  }
24840
24890
  ),
24891
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
24892
+ import_material23.IconButton,
24893
+ {
24894
+ onClick: () => setMemoryModalOpen(true),
24895
+ "aria-label": "Memory",
24896
+ sx: { color: theme.palette.text.secondary },
24897
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react9.Brain, {})
24898
+ }
24899
+ ),
24841
24900
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
24842
24901
  import_material23.IconButton,
24843
24902
  {
@@ -25247,6 +25306,9 @@ var init_enhanced_mobile_conversations_modal = __esm({
25247
25306
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
25248
25307
  import_material23.Box,
25249
25308
  {
25309
+ onClick: user2 ? () => {
25310
+ window.location.href = "/profile";
25311
+ } : void 0,
25250
25312
  sx: {
25251
25313
  mt: "auto",
25252
25314
  px: 2,
@@ -25254,10 +25316,9 @@ var init_enhanced_mobile_conversations_modal = __esm({
25254
25316
  borderTop: `1px solid ${(0, import_styles15.alpha)(theme.palette.divider, 0.6)}`,
25255
25317
  display: "flex",
25256
25318
  alignItems: "center",
25257
- justifyContent: "center",
25258
25319
  gap: 1.25,
25259
25320
  bgcolor: (0, import_styles15.alpha)(theme.palette.background.default, 0.88),
25260
- flexWrap: "wrap"
25321
+ cursor: user2 ? "pointer" : "default"
25261
25322
  },
25262
25323
  children: [
25263
25324
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
@@ -25275,7 +25336,7 @@ var init_enhanced_mobile_conversations_modal = __esm({
25275
25336
  children: avatarInitials
25276
25337
  }
25277
25338
  ),
25278
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material23.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", gap: 0.5, minWidth: 0 }, children: [
25339
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material23.Box, { sx: { display: "flex", flexDirection: "column", flex: 1, minWidth: 0, gap: 0.25 }, children: [
25279
25340
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
25280
25341
  import_material23.Typography,
25281
25342
  {
@@ -25285,16 +25346,33 @@ var init_enhanced_mobile_conversations_modal = __esm({
25285
25346
  children: user2 ? userDisplayName : "Not signed in"
25286
25347
  }
25287
25348
  ),
25288
- !user2 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
25349
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
25289
25350
  import_material23.Typography,
25290
25351
  {
25291
25352
  variant: "caption",
25292
- sx: { color: theme.palette.text.secondary },
25293
25353
  noWrap: true,
25294
- children: "Connect your account to sync chats"
25354
+ sx: { color: theme.palette.text.secondary },
25355
+ children: user2 ? "View profile & settings" : "Connect your account to sync chats"
25295
25356
  }
25296
25357
  )
25297
- ] })
25358
+ ] }),
25359
+ user2 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
25360
+ import_material23.Box,
25361
+ {
25362
+ sx: {
25363
+ flexShrink: 0,
25364
+ display: "flex",
25365
+ alignItems: "center",
25366
+ justifyContent: "center",
25367
+ width: 30,
25368
+ height: 30,
25369
+ borderRadius: "50%",
25370
+ border: `1px solid ${(0, import_styles15.alpha)(theme.palette.divider, 0.8)}`,
25371
+ color: theme.palette.text.secondary
25372
+ },
25373
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react9.Settings, { size: 16 })
25374
+ }
25375
+ )
25298
25376
  ]
25299
25377
  }
25300
25378
  )
@@ -25310,6 +25388,7 @@ var init_enhanced_mobile_conversations_modal = __esm({
25310
25388
  onClose: () => setProjectManagementOpen(false)
25311
25389
  }
25312
25390
  ),
25391
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(memory_modal_default, { open: memoryModalOpen, onClose: () => setMemoryModalOpen(false) }),
25313
25392
  conversationToMove && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
25314
25393
  move_conversation_modal_default,
25315
25394
  {