@burtson-labs/bandit-engine 2.0.50 → 2.0.51

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 (35) hide show
  1. package/dist/{chat-CQWZOJH4.mjs → chat-W5IFNEUC.mjs} +5 -5
  2. package/dist/chat-provider.js +29 -14
  3. package/dist/chat-provider.js.map +1 -1
  4. package/dist/chat-provider.mjs +3 -3
  5. package/dist/{chunk-VL3CMSDO.mjs → chunk-EWUUF4GE.mjs} +2 -2
  6. package/dist/{chunk-AXFX2HUK.mjs → chunk-HETIHZ42.mjs} +2 -2
  7. package/dist/{chunk-6WZUQHZT.mjs → chunk-IDH2YOW3.mjs} +30 -15
  8. package/dist/chunk-IDH2YOW3.mjs.map +1 -0
  9. package/dist/{chunk-ZTTGERUG.mjs → chunk-JBXNXSAH.mjs} +7 -7
  10. package/dist/{chunk-TVF45U7B.mjs → chunk-LXD3IV6Z.mjs} +3 -3
  11. package/dist/{chunk-KHKWYHXD.mjs → chunk-N7RMUOFB.mjs} +2 -2
  12. package/dist/{chunk-HKJTRBWC.mjs → chunk-QFSEZAG6.mjs} +3 -3
  13. package/dist/{chunk-Q2N7CCZI.mjs → chunk-STMXPFAQ.mjs} +45 -6
  14. package/dist/chunk-STMXPFAQ.mjs.map +1 -0
  15. package/dist/cli.js +1 -1
  16. package/dist/cli.js.map +1 -1
  17. package/dist/index.js +69 -15
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +8 -8
  20. package/dist/management/management.js +69 -15
  21. package/dist/management/management.js.map +1 -1
  22. package/dist/management/management.mjs +6 -6
  23. package/dist/modals/chat-modal/chat-modal.js +29 -14
  24. package/dist/modals/chat-modal/chat-modal.js.map +1 -1
  25. package/dist/modals/chat-modal/chat-modal.mjs +3 -3
  26. package/package.json +1 -1
  27. package/dist/chunk-6WZUQHZT.mjs.map +0 -1
  28. package/dist/chunk-Q2N7CCZI.mjs.map +0 -1
  29. /package/dist/{chat-CQWZOJH4.mjs.map → chat-W5IFNEUC.mjs.map} +0 -0
  30. /package/dist/{chunk-VL3CMSDO.mjs.map → chunk-EWUUF4GE.mjs.map} +0 -0
  31. /package/dist/{chunk-AXFX2HUK.mjs.map → chunk-HETIHZ42.mjs.map} +0 -0
  32. /package/dist/{chunk-ZTTGERUG.mjs.map → chunk-JBXNXSAH.mjs.map} +0 -0
  33. /package/dist/{chunk-TVF45U7B.mjs.map → chunk-LXD3IV6Z.mjs.map} +0 -0
  34. /package/dist/{chunk-KHKWYHXD.mjs.map → chunk-N7RMUOFB.mjs.map} +0 -0
  35. /package/dist/{chunk-HKJTRBWC.mjs.map → chunk-QFSEZAG6.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  chat_default
3
- } from "./chunk-Q2N7CCZI.mjs";
3
+ } from "./chunk-STMXPFAQ.mjs";
4
4
  import {
5
5
  chat_provider_default
6
- } from "./chunk-HKJTRBWC.mjs";
6
+ } from "./chunk-QFSEZAG6.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-ZTTGERUG.mjs";
14
- import "./chunk-KHKWYHXD.mjs";
15
- import "./chunk-VL3CMSDO.mjs";
13
+ } from "./chunk-JBXNXSAH.mjs";
14
+ import "./chunk-N7RMUOFB.mjs";
15
+ import "./chunk-EWUUF4GE.mjs";
16
16
  import "./chunk-EHNWQ4T3.mjs";
17
17
  import {
18
18
  defineCustomElement
19
19
  } from "./chunk-IXIM7BNO.mjs";
20
20
  import {
21
21
  chat_modal_default
22
- } from "./chunk-TVF45U7B.mjs";
22
+ } from "./chunk-LXD3IV6Z.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-AXFX2HUK.mjs";
40
+ } from "./chunk-HETIHZ42.mjs";
41
41
  import {
42
42
  DEFAULT_TIER_FEATURES,
43
43
  FeatureFlagContext,
@@ -57,7 +57,7 @@ import {
57
57
  useVectorStore,
58
58
  vectorDatabaseService,
59
59
  vectorMigrationService
60
- } from "./chunk-6WZUQHZT.mjs";
60
+ } from "./chunk-IDH2YOW3.mjs";
61
61
  import {
62
62
  usePackageSettingsStore
63
63
  } from "./chunk-7ZDS33S2.mjs";
@@ -6431,7 +6431,18 @@ async function saveStateToDB(state) {
6431
6431
  await indexedDBService_default.put(DB_NAME2, DB_VERSION, STORE_NAME2, state, storeConfigs2, STORAGE_KEY);
6432
6432
  }
6433
6433
  async function loadStateFromDB() {
6434
- return indexedDBService_default.get(DB_NAME2, DB_VERSION, STORE_NAME2, STORAGE_KEY, storeConfigs2);
6434
+ let timeoutId;
6435
+ const timeoutPromise = new Promise((resolve) => {
6436
+ timeoutId = window.setTimeout(() => resolve(void 0), 1200);
6437
+ });
6438
+ try {
6439
+ const getPromise = indexedDBService_default.get(DB_NAME2, DB_VERSION, STORE_NAME2, STORAGE_KEY, storeConfigs2).catch(() => void 0);
6440
+ return await Promise.race([getPromise, timeoutPromise]);
6441
+ } finally {
6442
+ if (timeoutId !== void 0) {
6443
+ window.clearTimeout(timeoutId);
6444
+ }
6445
+ }
6435
6446
  }
6436
6447
  var import_zustand6, DB_NAME2, STORE_NAME2, DB_VERSION, STORAGE_KEY, storeConfigs2, useAIQueryStore;
6437
6448
  var init_aiQueryStore = __esm({
@@ -6498,19 +6509,23 @@ var init_aiQueryStore = __esm({
6498
6509
  saveStateToDB(resetState);
6499
6510
  },
6500
6511
  hydrate: async () => {
6501
- const storedState = await loadStateFromDB();
6502
- if (storedState) {
6503
- set({
6504
- inputValue: storedState.inputValue ?? "",
6505
- response: storedState.response ?? "",
6506
- previousQuestion: storedState.previousQuestion ?? "",
6507
- position: storedState.position ?? { x: window.innerWidth / 2 - 300, y: window.innerHeight - 350 },
6508
- componentStatus: "Idle",
6509
- history: storedState.history ?? [],
6510
- apiKey: storedState.apiKey ?? "",
6511
- hydrated: true
6512
- });
6513
- } else {
6512
+ try {
6513
+ const storedState = await loadStateFromDB();
6514
+ if (storedState) {
6515
+ set({
6516
+ inputValue: storedState.inputValue ?? "",
6517
+ response: storedState.response ?? "",
6518
+ previousQuestion: storedState.previousQuestion ?? "",
6519
+ position: storedState.position ?? { x: window.innerWidth / 2 - 300, y: window.innerHeight - 350 },
6520
+ componentStatus: "Idle",
6521
+ history: storedState.history ?? [],
6522
+ apiKey: storedState.apiKey ?? "",
6523
+ hydrated: true
6524
+ });
6525
+ } else {
6526
+ set({ hydrated: true });
6527
+ }
6528
+ } catch {
6514
6529
  set({ hydrated: true });
6515
6530
  }
6516
6531
  }
@@ -27975,6 +27990,22 @@ var init_chat2 = __esm({
27975
27990
  }, 500);
27976
27991
  }
27977
27992
  }, [history, pendingMessage]);
27993
+ (0, import_react55.useEffect)(() => {
27994
+ if (!brandingLoading && !themeLoading) {
27995
+ return;
27996
+ }
27997
+ const timeoutId = window.setTimeout(() => {
27998
+ if (brandingLoading || themeLoading) {
27999
+ debugLogger.warn("Chat: branding/theme load timed out, falling back to defaults");
28000
+ setBrandingLoading(false);
28001
+ setThemeLoading(false);
28002
+ if (!selectedTheme) {
28003
+ setSelectedTheme("bandit-dark");
28004
+ }
28005
+ }
28006
+ }, 2500);
28007
+ return () => window.clearTimeout(timeoutId);
28008
+ }, [brandingLoading, themeLoading, selectedTheme]);
27978
28009
  (0, import_react55.useEffect)(() => () => {
27979
28010
  if (logoFadeTimeoutRef.current) {
27980
28011
  window.clearTimeout(logoFadeTimeoutRef.current);
@@ -28692,7 +28723,30 @@ var init_chat2 = __esm({
28692
28723
  requestAnimationFrame(pump);
28693
28724
  }
28694
28725
  };
28695
- if (!hydrated || brandingLoading || themeLoading) return null;
28726
+ if (!hydrated || brandingLoading || themeLoading) {
28727
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material46.ThemeProvider, { theme: banditTheme, children: [
28728
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material46.CssBaseline, {}),
28729
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
28730
+ import_material46.Box,
28731
+ {
28732
+ sx: (theme) => ({
28733
+ minHeight: "100dvh",
28734
+ display: "flex",
28735
+ alignItems: "center",
28736
+ justifyContent: "center",
28737
+ flexDirection: "column",
28738
+ gap: 1.5,
28739
+ bgcolor: theme.palette.chat.shell,
28740
+ color: theme.palette.text.primary
28741
+ }),
28742
+ children: [
28743
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material46.CircularProgress, { size: 32, thickness: 4 }),
28744
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material46.Typography, { variant: "body2", color: "text.secondary", children: "Preparing your workspace..." })
28745
+ ]
28746
+ }
28747
+ )
28748
+ ] });
28749
+ }
28696
28750
  const userHasAccess = playgroundBypassAccess || ossMode || claims?.roles?.includes("super-user") || claims?.roles?.includes("admin");
28697
28751
  if (!userHasAccess) {
28698
28752
  return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material46.ThemeProvider, { theme: banditTheme, children: [