@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.js CHANGED
@@ -467,7 +467,18 @@ async function saveStateToDB(state) {
467
467
  await indexedDBService_default.put(DB_NAME, DB_VERSION, STORE_NAME, state, storeConfigs, STORAGE_KEY);
468
468
  }
469
469
  async function loadStateFromDB() {
470
- return indexedDBService_default.get(DB_NAME, DB_VERSION, STORE_NAME, STORAGE_KEY, storeConfigs);
470
+ let timeoutId;
471
+ const timeoutPromise = new Promise((resolve) => {
472
+ timeoutId = window.setTimeout(() => resolve(void 0), 1200);
473
+ });
474
+ try {
475
+ const getPromise = indexedDBService_default.get(DB_NAME, DB_VERSION, STORE_NAME, STORAGE_KEY, storeConfigs).catch(() => void 0);
476
+ return await Promise.race([getPromise, timeoutPromise]);
477
+ } finally {
478
+ if (timeoutId !== void 0) {
479
+ window.clearTimeout(timeoutId);
480
+ }
481
+ }
471
482
  }
472
483
  var import_zustand3, DB_NAME, STORE_NAME, DB_VERSION, STORAGE_KEY, storeConfigs, useAIQueryStore;
473
484
  var init_aiQueryStore = __esm({
@@ -534,19 +545,23 @@ var init_aiQueryStore = __esm({
534
545
  saveStateToDB(resetState);
535
546
  },
536
547
  hydrate: async () => {
537
- const storedState = await loadStateFromDB();
538
- if (storedState) {
539
- set({
540
- inputValue: storedState.inputValue ?? "",
541
- response: storedState.response ?? "",
542
- previousQuestion: storedState.previousQuestion ?? "",
543
- position: storedState.position ?? { x: window.innerWidth / 2 - 300, y: window.innerHeight - 350 },
544
- componentStatus: "Idle",
545
- history: storedState.history ?? [],
546
- apiKey: storedState.apiKey ?? "",
547
- hydrated: true
548
- });
549
- } else {
548
+ try {
549
+ const storedState = await loadStateFromDB();
550
+ if (storedState) {
551
+ set({
552
+ inputValue: storedState.inputValue ?? "",
553
+ response: storedState.response ?? "",
554
+ previousQuestion: storedState.previousQuestion ?? "",
555
+ position: storedState.position ?? { x: window.innerWidth / 2 - 300, y: window.innerHeight - 350 },
556
+ componentStatus: "Idle",
557
+ history: storedState.history ?? [],
558
+ apiKey: storedState.apiKey ?? "",
559
+ hydrated: true
560
+ });
561
+ } else {
562
+ set({ hydrated: true });
563
+ }
564
+ } catch {
550
565
  set({ hydrated: true });
551
566
  }
552
567
  }
@@ -28365,6 +28380,22 @@ var init_chat2 = __esm({
28365
28380
  }, 500);
28366
28381
  }
28367
28382
  }, [history, pendingMessage]);
28383
+ (0, import_react35.useEffect)(() => {
28384
+ if (!brandingLoading && !themeLoading) {
28385
+ return;
28386
+ }
28387
+ const timeoutId = window.setTimeout(() => {
28388
+ if (brandingLoading || themeLoading) {
28389
+ debugLogger.warn("Chat: branding/theme load timed out, falling back to defaults");
28390
+ setBrandingLoading(false);
28391
+ setThemeLoading(false);
28392
+ if (!selectedTheme) {
28393
+ setSelectedTheme("bandit-dark");
28394
+ }
28395
+ }
28396
+ }, 2500);
28397
+ return () => window.clearTimeout(timeoutId);
28398
+ }, [brandingLoading, themeLoading, selectedTheme]);
28368
28399
  (0, import_react35.useEffect)(() => () => {
28369
28400
  if (logoFadeTimeoutRef.current) {
28370
28401
  window.clearTimeout(logoFadeTimeoutRef.current);
@@ -29082,7 +29113,30 @@ var init_chat2 = __esm({
29082
29113
  requestAnimationFrame(pump);
29083
29114
  }
29084
29115
  };
29085
- if (!hydrated || brandingLoading || themeLoading) return null;
29116
+ if (!hydrated || brandingLoading || themeLoading) {
29117
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material27.ThemeProvider, { theme: banditTheme, children: [
29118
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material27.CssBaseline, {}),
29119
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
29120
+ import_material27.Box,
29121
+ {
29122
+ sx: (theme) => ({
29123
+ minHeight: "100dvh",
29124
+ display: "flex",
29125
+ alignItems: "center",
29126
+ justifyContent: "center",
29127
+ flexDirection: "column",
29128
+ gap: 1.5,
29129
+ bgcolor: theme.palette.chat.shell,
29130
+ color: theme.palette.text.primary
29131
+ }),
29132
+ children: [
29133
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material27.CircularProgress, { size: 32, thickness: 4 }),
29134
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material27.Typography, { variant: "body2", color: "text.secondary", children: "Preparing your workspace..." })
29135
+ ]
29136
+ }
29137
+ )
29138
+ ] });
29139
+ }
29086
29140
  const userHasAccess = playgroundBypassAccess || ossMode || claims?.roles?.includes("super-user") || claims?.roles?.includes("admin");
29087
29141
  if (!userHasAccess) {
29088
29142
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material27.ThemeProvider, { theme: banditTheme, children: [