@burtson-labs/bandit-engine 2.0.164 → 2.0.166

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 (59) hide show
  1. package/README.md +4 -1
  2. package/dist/aiProviderStore-HY5G4QAK.mjs +8 -0
  3. package/dist/chat-RCMZYACB.mjs +15 -0
  4. package/dist/chat-provider.js +186 -111
  5. package/dist/chat-provider.js.map +1 -1
  6. package/dist/chat-provider.mjs +7 -8
  7. package/dist/{chunk-J6SWNO7Z.mjs → chunk-33OSALGS.mjs} +25 -7
  8. package/dist/{chunk-J6SWNO7Z.mjs.map → chunk-33OSALGS.mjs.map} +1 -1
  9. package/dist/{chunk-5KBTOCQZ.mjs → chunk-6KRAPGXE.mjs} +13 -85
  10. package/dist/chunk-6KRAPGXE.mjs.map +1 -0
  11. package/dist/{chunk-VBHI4TJC.mjs → chunk-75OBTJPN.mjs} +6 -6
  12. package/dist/{chunk-URZSIL7X.mjs → chunk-A6W6XIDD.mjs} +7 -7
  13. package/dist/{chunk-CQJGUYRW.mjs → chunk-GRPTCHFN.mjs} +150 -42
  14. package/dist/chunk-GRPTCHFN.mjs.map +1 -0
  15. package/dist/{chunk-OCVZVBQQ.mjs → chunk-HNXPDIWC.mjs} +12 -3
  16. package/dist/chunk-HNXPDIWC.mjs.map +1 -0
  17. package/dist/{chunk-IZX2J65Q.mjs → chunk-IB2LPSQQ.mjs} +2 -2
  18. package/dist/{chunk-PNQRS5EN.mjs → chunk-M4DWPNZZ.mjs} +11 -11
  19. package/dist/{chunk-O6P37PFR.mjs → chunk-MM3NRLVR.mjs} +4 -4
  20. package/dist/{chunk-WLNZL6SP.mjs → chunk-Q2DINRIU.mjs} +6 -6
  21. package/dist/{chunk-WLNZL6SP.mjs.map → chunk-Q2DINRIU.mjs.map} +1 -1
  22. package/dist/{chunk-JYBQAKSZ.mjs → chunk-WSZE3DDJ.mjs} +8 -8
  23. package/dist/{chunk-TY5VL3SG.mjs → chunk-YH5YWK4K.mjs} +3 -3
  24. package/dist/index.d.mts +97 -4
  25. package/dist/index.d.ts +97 -4
  26. package/dist/index.js +200 -133
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +22 -21
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/management/management.js +171 -123
  31. package/dist/management/management.js.map +1 -1
  32. package/dist/management/management.mjs +10 -11
  33. package/dist/{memoryUtils-2FVXDSS6.mjs → memoryUtils-HGCYEUCD.mjs} +1 -3
  34. package/dist/{memoryUtils-2FVXDSS6.mjs.map → memoryUtils-HGCYEUCD.mjs.map} +1 -1
  35. package/dist/modals/chat-modal/chat-modal.js +161 -33
  36. package/dist/modals/chat-modal/chat-modal.js.map +1 -1
  37. package/dist/modals/chat-modal/chat-modal.mjs +6 -7
  38. package/dist/modelStore-F6JQUXGG.mjs +8 -0
  39. package/dist/shared/custom-element.mjs +0 -1
  40. package/docs/03_provider_integration.md +5 -2
  41. package/package.json +1 -1
  42. package/dist/aiProviderStore-PEGSX4PK.mjs +0 -9
  43. package/dist/chat-OSAVW6L2.mjs +0 -16
  44. package/dist/chunk-5KBTOCQZ.mjs.map +0 -1
  45. package/dist/chunk-BJTO5JO5.mjs +0 -11
  46. package/dist/chunk-CQJGUYRW.mjs.map +0 -1
  47. package/dist/chunk-OCVZVBQQ.mjs.map +0 -1
  48. package/dist/modelStore-7XYYDCNC.mjs +0 -9
  49. package/dist/modelStore-7XYYDCNC.mjs.map +0 -1
  50. /package/dist/{aiProviderStore-PEGSX4PK.mjs.map → aiProviderStore-HY5G4QAK.mjs.map} +0 -0
  51. /package/dist/{chat-OSAVW6L2.mjs.map → chat-RCMZYACB.mjs.map} +0 -0
  52. /package/dist/{chunk-VBHI4TJC.mjs.map → chunk-75OBTJPN.mjs.map} +0 -0
  53. /package/dist/{chunk-URZSIL7X.mjs.map → chunk-A6W6XIDD.mjs.map} +0 -0
  54. /package/dist/{chunk-IZX2J65Q.mjs.map → chunk-IB2LPSQQ.mjs.map} +0 -0
  55. /package/dist/{chunk-PNQRS5EN.mjs.map → chunk-M4DWPNZZ.mjs.map} +0 -0
  56. /package/dist/{chunk-O6P37PFR.mjs.map → chunk-MM3NRLVR.mjs.map} +0 -0
  57. /package/dist/{chunk-JYBQAKSZ.mjs.map → chunk-WSZE3DDJ.mjs.map} +0 -0
  58. /package/dist/{chunk-TY5VL3SG.mjs.map → chunk-YH5YWK4K.mjs.map} +0 -0
  59. /package/dist/{chunk-BJTO5JO5.mjs.map → modelStore-F6JQUXGG.mjs.map} +0 -0
@@ -1,15 +1,14 @@
1
1
  import {
2
2
  ChatProvider,
3
3
  chat_provider_default
4
- } from "./chunk-URZSIL7X.mjs";
4
+ } from "./chunk-A6W6XIDD.mjs";
5
5
  import "./chunk-ONQMRE2G.mjs";
6
- import "./chunk-5KBTOCQZ.mjs";
7
- import "./chunk-O6P37PFR.mjs";
8
- import "./chunk-J6SWNO7Z.mjs";
9
- import "./chunk-TY5VL3SG.mjs";
10
- import "./chunk-CQJGUYRW.mjs";
11
- import "./chunk-OCVZVBQQ.mjs";
12
- import "./chunk-BJTO5JO5.mjs";
6
+ import "./chunk-6KRAPGXE.mjs";
7
+ import "./chunk-MM3NRLVR.mjs";
8
+ import "./chunk-33OSALGS.mjs";
9
+ import "./chunk-YH5YWK4K.mjs";
10
+ import "./chunk-GRPTCHFN.mjs";
11
+ import "./chunk-HNXPDIWC.mjs";
13
12
  export {
14
13
  ChatProvider,
15
14
  chat_provider_default as default
@@ -2,15 +2,17 @@ import {
2
2
  indexedDBService_default,
3
3
  useModelStore,
4
4
  usePackageSettingsStore
5
- } from "./chunk-TY5VL3SG.mjs";
5
+ } from "./chunk-YH5YWK4K.mjs";
6
6
  import {
7
+ AUTH_TOKEN_CHANGED_EVENT,
8
+ TOKEN_KEY,
7
9
  authenticationService,
8
10
  useAIProviderStore,
9
11
  useAuthenticationStore
10
- } from "./chunk-CQJGUYRW.mjs";
12
+ } from "./chunk-GRPTCHFN.mjs";
11
13
  import {
12
14
  debugLogger
13
- } from "./chunk-OCVZVBQQ.mjs";
15
+ } from "./chunk-HNXPDIWC.mjs";
14
16
 
15
17
  // src/store/aiQueryStore.ts
16
18
  import { create } from "zustand";
@@ -3229,7 +3231,7 @@ var VectorDatabaseService = class {
3229
3231
  onProgress,
3230
3232
  validateContent = true
3231
3233
  } = options;
3232
- const { MemoryUtils } = await import("./memoryUtils-2FVXDSS6.mjs");
3234
+ const { MemoryUtils } = await import("./memoryUtils-HGCYEUCD.mjs");
3233
3235
  try {
3234
3236
  let validMemories = memories;
3235
3237
  const warnings = [];
@@ -4415,6 +4417,19 @@ var OSS_DEFAULT_FEATURES = {
4415
4417
  // src/contexts/FeatureFlagContext.tsx
4416
4418
  import { createContext, useContext, useEffect, useState, useCallback } from "react";
4417
4419
  import { jsx } from "react/jsx-runtime";
4420
+ var readSessionToken = (jwtStorageKey) => {
4421
+ const fromStorage = () => {
4422
+ try {
4423
+ return localStorage.getItem(jwtStorageKey);
4424
+ } catch {
4425
+ return null;
4426
+ }
4427
+ };
4428
+ if (jwtStorageKey && jwtStorageKey !== TOKEN_KEY) {
4429
+ return fromStorage() ?? authenticationService.getToken();
4430
+ }
4431
+ return authenticationService.getToken() ?? fromStorage();
4432
+ };
4418
4433
  var FeatureFlagContext = createContext(void 0);
4419
4434
  function decodeJWT(token) {
4420
4435
  try {
@@ -4480,7 +4495,7 @@ var FeatureFlagProvider = ({ config, children }) => {
4480
4495
  let effectiveTier = currentTier || subscriptionType || "oss";
4481
4496
  if (typeof window !== "undefined") {
4482
4497
  try {
4483
- const token = localStorage.getItem(jwtStorageKey);
4498
+ const token = readSessionToken(jwtStorageKey);
4484
4499
  if (token) {
4485
4500
  jwtFound = true;
4486
4501
  const payload = decodeJWT(token);
@@ -4566,10 +4581,13 @@ var FeatureFlagProvider = ({ config, children }) => {
4566
4581
  setCurrentTier(e.detail.tier);
4567
4582
  }
4568
4583
  };
4584
+ const handleSessionChange = () => refreshEvaluation();
4569
4585
  window.addEventListener("storage", handleStorageChange);
4586
+ window.addEventListener(AUTH_TOKEN_CHANGED_EVENT, handleSessionChange);
4570
4587
  window.addEventListener("bandit:tier-updated", handleTierUpdate);
4571
4588
  return () => {
4572
4589
  window.removeEventListener("storage", handleStorageChange);
4590
+ window.removeEventListener(AUTH_TOKEN_CHANGED_EVENT, handleSessionChange);
4573
4591
  window.removeEventListener("bandit:tier-updated", handleTierUpdate);
4574
4592
  };
4575
4593
  }, [refreshEvaluation, config.jwtStorageKey]);
@@ -4833,7 +4851,7 @@ var useVectorStore = () => {
4833
4851
  }, []);
4834
4852
  const checkProviderCompatibility = useCallback2(async () => {
4835
4853
  try {
4836
- const { useAIProviderStore: useAIProviderStore2 } = await import("./aiProviderStore-PEGSX4PK.mjs");
4854
+ const { useAIProviderStore: useAIProviderStore2 } = await import("./aiProviderStore-HY5G4QAK.mjs");
4837
4855
  if (!mountedRef.current) return false;
4838
4856
  const aiProviderState = useAIProviderStore2.getState();
4839
4857
  const provider = aiProviderState.provider;
@@ -5874,4 +5892,4 @@ export {
5874
5892
  useNotification,
5875
5893
  NotificationProvider
5876
5894
  };
5877
- //# sourceMappingURL=chunk-J6SWNO7Z.mjs.map
5895
+ //# sourceMappingURL=chunk-33OSALGS.mjs.map