@burtson-labs/bandit-engine 2.0.150 → 2.0.151

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 (40) hide show
  1. package/dist/{aiProviderStore-FTD277QP.mjs → aiProviderStore-ZQ5VVVKQ.mjs} +2 -2
  2. package/dist/chat-3HV3GM5P.mjs +16 -0
  3. package/dist/chat-provider.js +5 -2
  4. package/dist/chat-provider.js.map +1 -1
  5. package/dist/chat-provider.mjs +5 -5
  6. package/dist/{chunk-7P7IS6UA.mjs → chunk-6STVJJSG.mjs} +2 -2
  7. package/dist/{chunk-K2JGFKEB.mjs → chunk-CVFFNX7H.mjs} +2 -2
  8. package/dist/{chunk-IJTDHBHP.mjs → chunk-DSYE5AHW.mjs} +9 -9
  9. package/dist/{chunk-43MLINPL.mjs → chunk-GWQRTUKF.mjs} +6 -3
  10. package/dist/chunk-GWQRTUKF.mjs.map +1 -0
  11. package/dist/{chunk-PU74BI6Y.mjs → chunk-QLATFSSO.mjs} +5 -5
  12. package/dist/{chunk-F7JXIW6T.mjs → chunk-RRCCSN3N.mjs} +2 -2
  13. package/dist/{chunk-FFVGZK5D.mjs → chunk-TYRYAAP2.mjs} +3 -3
  14. package/dist/{chunk-L37EUHMZ.mjs → chunk-U33KBX3Y.mjs} +4 -4
  15. package/dist/{chunk-NLBZZP3B.mjs → chunk-VLUXQE24.mjs} +3 -3
  16. package/dist/{chunk-YEPJ7DWZ.mjs → chunk-ZRJYLJKZ.mjs} +65 -22
  17. package/dist/chunk-ZRJYLJKZ.mjs.map +1 -0
  18. package/dist/index.js +98 -52
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +10 -10
  21. package/dist/management/management.js +92 -46
  22. package/dist/management/management.js.map +1 -1
  23. package/dist/management/management.mjs +8 -8
  24. package/dist/modals/chat-modal/chat-modal.js +5 -2
  25. package/dist/modals/chat-modal/chat-modal.js.map +1 -1
  26. package/dist/modals/chat-modal/chat-modal.mjs +4 -4
  27. package/package.json +1 -1
  28. package/dist/chat-YOT2RPWD.mjs +0 -16
  29. package/dist/chunk-43MLINPL.mjs.map +0 -1
  30. package/dist/chunk-YEPJ7DWZ.mjs.map +0 -1
  31. /package/dist/{aiProviderStore-FTD277QP.mjs.map → aiProviderStore-ZQ5VVVKQ.mjs.map} +0 -0
  32. /package/dist/{chat-YOT2RPWD.mjs.map → chat-3HV3GM5P.mjs.map} +0 -0
  33. /package/dist/{chunk-7P7IS6UA.mjs.map → chunk-6STVJJSG.mjs.map} +0 -0
  34. /package/dist/{chunk-K2JGFKEB.mjs.map → chunk-CVFFNX7H.mjs.map} +0 -0
  35. /package/dist/{chunk-IJTDHBHP.mjs.map → chunk-DSYE5AHW.mjs.map} +0 -0
  36. /package/dist/{chunk-PU74BI6Y.mjs.map → chunk-QLATFSSO.mjs.map} +0 -0
  37. /package/dist/{chunk-F7JXIW6T.mjs.map → chunk-RRCCSN3N.mjs.map} +0 -0
  38. /package/dist/{chunk-FFVGZK5D.mjs.map → chunk-TYRYAAP2.mjs.map} +0 -0
  39. /package/dist/{chunk-L37EUHMZ.mjs.map → chunk-U33KBX3Y.mjs.map} +0 -0
  40. /package/dist/{chunk-NLBZZP3B.mjs.map → chunk-VLUXQE24.mjs.map} +0 -0
@@ -6,7 +6,7 @@ import {
6
6
  useMemoryStore,
7
7
  useNotification,
8
8
  useVectorStore
9
- } from "./chunk-NLBZZP3B.mjs";
9
+ } from "./chunk-VLUXQE24.mjs";
10
10
  import {
11
11
  useModelStore,
12
12
  usePackageSettingsStore,
@@ -15,7 +15,7 @@ import {
15
15
  import {
16
16
  GatewayService,
17
17
  authenticationService
18
- } from "./chunk-43MLINPL.mjs";
18
+ } from "./chunk-GWQRTUKF.mjs";
19
19
  import {
20
20
  debugLogger
21
21
  } from "./chunk-KCI46M23.mjs";
@@ -8806,4 +8806,4 @@ export {
8806
8806
  themeMap_default,
8807
8807
  useNotificationService
8808
8808
  };
8809
- //# sourceMappingURL=chunk-FFVGZK5D.mjs.map
8809
+ //# sourceMappingURL=chunk-TYRYAAP2.mjs.map
@@ -24,14 +24,14 @@ import {
24
24
  useNotificationService,
25
25
  useTTS,
26
26
  useVoiceStore
27
- } from "./chunk-FFVGZK5D.mjs";
27
+ } from "./chunk-TYRYAAP2.mjs";
28
28
  import {
29
29
  brandingService_default,
30
30
  toTitleCase,
31
31
  useAIQueryStore,
32
32
  useConversationStore,
33
33
  useMemoryStore
34
- } from "./chunk-NLBZZP3B.mjs";
34
+ } from "./chunk-VLUXQE24.mjs";
35
35
  import {
36
36
  indexedDBService_default,
37
37
  useModelStore,
@@ -40,7 +40,7 @@ import {
40
40
  } from "./chunk-EORIRPPX.mjs";
41
41
  import {
42
42
  useAIProviderStore
43
- } from "./chunk-43MLINPL.mjs";
43
+ } from "./chunk-GWQRTUKF.mjs";
44
44
  import {
45
45
  debugLogger
46
46
  } from "./chunk-KCI46M23.mjs";
@@ -2941,4 +2941,4 @@ export {
2941
2941
  MAX_WINDOWED_HEIGHT,
2942
2942
  chat_modal_default
2943
2943
  };
2944
- //# sourceMappingURL=chunk-L37EUHMZ.mjs.map
2944
+ //# sourceMappingURL=chunk-U33KBX3Y.mjs.map
@@ -7,7 +7,7 @@ import {
7
7
  authenticationService,
8
8
  useAIProviderStore,
9
9
  useAuthenticationStore
10
- } from "./chunk-43MLINPL.mjs";
10
+ } from "./chunk-GWQRTUKF.mjs";
11
11
  import {
12
12
  debugLogger
13
13
  } from "./chunk-KCI46M23.mjs";
@@ -4845,7 +4845,7 @@ var useVectorStore = () => {
4845
4845
  const [hasCompatibleProvider, setHasCompatibleProvider] = useState2(false);
4846
4846
  const checkProviderCompatibility = useCallback2(async () => {
4847
4847
  try {
4848
- const { useAIProviderStore: useAIProviderStore2 } = await import("./aiProviderStore-FTD277QP.mjs");
4848
+ const { useAIProviderStore: useAIProviderStore2 } = await import("./aiProviderStore-ZQ5VVVKQ.mjs");
4849
4849
  const aiProviderState = useAIProviderStore2.getState();
4850
4850
  const provider = aiProviderState.provider;
4851
4851
  const config = aiProviderState.config;
@@ -5889,4 +5889,4 @@ export {
5889
5889
  useNotification,
5890
5890
  NotificationProvider
5891
5891
  };
5892
- //# sourceMappingURL=chunk-NLBZZP3B.mjs.map
5892
+ //# sourceMappingURL=chunk-VLUXQE24.mjs.map
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-ONQMRE2G.mjs";
4
4
  import {
5
5
  StreamingMarkdown_default
6
- } from "./chunk-7P7IS6UA.mjs";
6
+ } from "./chunk-6STVJJSG.mjs";
7
7
  import {
8
8
  useMCPToolsStore
9
- } from "./chunk-K2JGFKEB.mjs";
9
+ } from "./chunk-CVFFNX7H.mjs";
10
10
  import {
11
11
  AddIcon,
12
12
  ArrowDownwardIcon,
@@ -36,7 +36,7 @@ import {
36
36
  useNotificationService,
37
37
  useTTS,
38
38
  useVoiceStore
39
- } from "./chunk-FFVGZK5D.mjs";
39
+ } from "./chunk-TYRYAAP2.mjs";
40
40
  import {
41
41
  brandingService_default,
42
42
  detectMessageMood,
@@ -59,7 +59,7 @@ import {
59
59
  useMemoryStore,
60
60
  useProjectStore,
61
61
  useVectorStore
62
- } from "./chunk-NLBZZP3B.mjs";
62
+ } from "./chunk-VLUXQE24.mjs";
63
63
  import {
64
64
  indexedDBService_default,
65
65
  useModelStore,
@@ -67,11 +67,11 @@ import {
67
67
  usePreferencesStore
68
68
  } from "./chunk-EORIRPPX.mjs";
69
69
  import {
70
- authenticationService,
70
+ authenticationService as authenticationService2,
71
71
  readPersistedToken,
72
72
  useAIProviderStore,
73
73
  useAuthenticationStore
74
- } from "./chunk-43MLINPL.mjs";
74
+ } from "./chunk-GWQRTUKF.mjs";
75
75
  import {
76
76
  debugLogger
77
77
  } from "./chunk-KCI46M23.mjs";
@@ -933,7 +933,7 @@ var useEngineStore = create((set, get) => ({
933
933
  }
934
934
  try {
935
935
  const headers = { "Content-Type": "application/json" };
936
- const token = authenticationService.getToken();
936
+ const token = authenticationService2.getToken();
937
937
  if (token) headers["Authorization"] = `Bearer ${token}`;
938
938
  const res = await fetch(`${base}/models`, { headers });
939
939
  const data = await res.json();
@@ -1221,7 +1221,7 @@ var STTClient = class {
1221
1221
  filename,
1222
1222
  url: `${gatewayUrl}/stt/transcribe`
1223
1223
  });
1224
- const token = authenticationService.getToken();
1224
+ const token = authenticationService2.getToken();
1225
1225
  const response = await fetch(`${gatewayUrl}/stt/transcribe`, {
1226
1226
  method: "POST",
1227
1227
  headers: {
@@ -2757,7 +2757,7 @@ function syncTelemetry() {
2757
2757
  const settings = usePackageSettingsStore.getState().settings;
2758
2758
  const cfg = resolveTelemetryConfig({
2759
2759
  telemetry: settings?.telemetry,
2760
- banditApiKey: authenticationService.getToken() ?? void 0
2760
+ banditApiKey: authenticationService2.getToken() ?? void 0
2761
2761
  });
2762
2762
  active = cfg ? new TelemetryExporter(cfg) : null;
2763
2763
  } catch {
@@ -3366,7 +3366,7 @@ var executeMCPTool = async (toolCall) => {
3366
3366
  }
3367
3367
  if (tool.mcpServerId) {
3368
3368
  const base2 = settings.gatewayApiUrl.replace(/\/$/, "");
3369
- const token2 = authenticationService.getToken();
3369
+ const token2 = authenticationService2.getToken();
3370
3370
  const controller2 = new AbortController();
3371
3371
  const timeoutId2 = setTimeout(() => controller2.abort(), 3e4);
3372
3372
  try {
@@ -3413,7 +3413,7 @@ var executeMCPTool = async (toolCall) => {
3413
3413
  "Content-Type": "application/json"
3414
3414
  }
3415
3415
  };
3416
- const token = authenticationService.getToken();
3416
+ const token = authenticationService2.getToken();
3417
3417
  if (token) {
3418
3418
  requestOptions.headers = {
3419
3419
  ...requestOptions.headers,
@@ -4379,6 +4379,29 @@ ${protocol}`;
4379
4379
  overrideComponentStatus("Idle");
4380
4380
  setIsSubmitting(false);
4381
4381
  setIsStreaming(false);
4382
+ if (/lifetime validation|token.*(expired|invalid)|unauthorized|\b401\b/i.test(err.message || "")) {
4383
+ const { replaceLastAnswer: replaceLastAnswer2 } = useConversationStore.getState();
4384
+ replaceLastAnswer2(
4385
+ "_Your session ended \u2014 sign back in to continue._",
4386
+ lastPartialRef.current.images,
4387
+ false,
4388
+ lastPartialRef.current.usedDocs,
4389
+ true
4390
+ );
4391
+ setResponse("");
4392
+ setStreamBuffer("");
4393
+ setIsThinking?.(false);
4394
+ setPendingMessage(null);
4395
+ try {
4396
+ authenticationService.clearToken();
4397
+ } catch {
4398
+ }
4399
+ window.dispatchEvent(
4400
+ new CustomEvent("auth:force-relogin", { detail: { code: "TOKEN_EXPIRED" } })
4401
+ );
4402
+ telemetryEndTurn({ error: "auth_expired" });
4403
+ return;
4404
+ }
4382
4405
  const rateLimit = parseRateLimitError(err);
4383
4406
  if (rateLimit) {
4384
4407
  debugLogger.info("Chat hit usage limit (429) \u2014 showing upgrade prompt", {
@@ -7687,7 +7710,7 @@ var ConversationDrawer = ({ open, onClose }) => {
7687
7710
  title: "Sign out",
7688
7711
  onClick: (event) => {
7689
7712
  event.stopPropagation();
7690
- authenticationService.clearToken();
7713
+ authenticationService2.clearToken();
7691
7714
  window.location.href = "/login";
7692
7715
  },
7693
7716
  sx: {
@@ -8805,7 +8828,7 @@ var EnhancedMobileConversationsModal = ({
8805
8828
  title: "Sign out",
8806
8829
  onClick: (event) => {
8807
8830
  event.stopPropagation();
8808
- authenticationService.clearToken();
8831
+ authenticationService2.clearToken();
8809
8832
  window.location.href = "/login";
8810
8833
  },
8811
8834
  sx: {
@@ -9634,7 +9657,7 @@ var UnderReview = () => {
9634
9657
  const theme = useTheme17();
9635
9658
  const navigate = useNavigate3();
9636
9659
  const handleResetSession = () => {
9637
- authenticationService.clearToken();
9660
+ authenticationService2.clearToken();
9638
9661
  navigate("/login");
9639
9662
  };
9640
9663
  return /* @__PURE__ */ jsxs16(
@@ -10235,8 +10258,8 @@ var ChatContent = () => {
10235
10258
  const notificationService = useNotificationService();
10236
10259
  const [selectedTheme, setSelectedTheme] = useState19(null);
10237
10260
  const [themeLoading, setThemeLoading] = useState19(true);
10238
- const token = authenticationService.getToken();
10239
- const claims = token ? authenticationService.parseJwtClaims(token) : null;
10261
+ const token = authenticationService2.getToken();
10262
+ const claims = token ? authenticationService2.parseJwtClaims(token) : null;
10240
10263
  const baseTheme = themeMap_default[selectedTheme ?? "bandit-dark"] || banditDarkTheme;
10241
10264
  const banditTheme = useMemo4(() => {
10242
10265
  return createTheme(baseTheme, {
@@ -10309,7 +10332,7 @@ var ChatContent = () => {
10309
10332
  } = useTTS();
10310
10333
  useEffect17(() => {
10311
10334
  const timer = setTimeout(() => {
10312
- const isAuthenticated = authenticationService.isAuthenticated();
10335
+ const isAuthenticated = authenticationService2.isAuthenticated();
10313
10336
  if (!initialized || availableVoices.length === 0) {
10314
10337
  if (token && isAuthenticated) {
10315
10338
  debugLogger.debug("Chat: Voices not initialized or unavailable, attempting to load from API");
@@ -10322,7 +10345,7 @@ var ChatContent = () => {
10322
10345
  return () => clearTimeout(timer);
10323
10346
  }, [initialized, availableVoices.length, loadVoicesFromAPI, token]);
10324
10347
  useEffect17(() => {
10325
- const isAuthenticated = authenticationService.isAuthenticated();
10348
+ const isAuthenticated = authenticationService2.isAuthenticated();
10326
10349
  if (packageSettings?.gatewayApiUrl && availableVoices.length === 0 && !initialized) {
10327
10350
  if (token && isAuthenticated) {
10328
10351
  debugLogger.debug("Chat: Gateway URL available and no voices loaded, attempting to load from API");
@@ -10344,6 +10367,7 @@ var ChatContent = () => {
10344
10367
  const [isMobile, setIsMobile] = useState19(false);
10345
10368
  const [drawerOpen, setDrawerOpen] = useState19(false);
10346
10369
  const [mobileConversationsOpen, setMobileConversationsOpen] = useState19(false);
10370
+ const cardSwipeStartXRef = useRef15(null);
10347
10371
  useEffect17(() => {
10348
10372
  if (typeof document === "undefined") return;
10349
10373
  const meta = document.querySelector('meta[name="theme-color"]');
@@ -11218,7 +11242,12 @@ var ChatContent = () => {
11218
11242
  // reads as full physical height with the rounded corner visible
11219
11243
  // where it overlaps the drawer.
11220
11244
  transform: isMobile && mobileConversationsOpen ? "translateX(calc(min(calc(100vw - 56px), 360px) - 12px))" : "none",
11221
- borderRadius: isMobile && mobileConversationsOpen ? "44px" : 0,
11245
+ // Square top-left + no top border: the card's edge runs unbroken
11246
+ // from the very top of the screen (all surfaces share one color),
11247
+ // which reads as true full height; a soft bottom-left corner keeps
11248
+ // the sheet feel.
11249
+ borderRadius: isMobile && mobileConversationsOpen ? "0 0 0 28px" : 0,
11250
+ borderTop: isMobile && mobileConversationsOpen ? "none" : void 0,
11222
11251
  zIndex: isMobile && mobileConversationsOpen ? theme.zIndex.modal + 1 : 0,
11223
11252
  // Hairline border so the rounded card reads even when the backdrop
11224
11253
  // is the same near-black as the shell.
@@ -11231,6 +11260,20 @@ var ChatContent = () => {
11231
11260
  setMobileConversationsOpen(false);
11232
11261
  }
11233
11262
  } : void 0,
11263
+ onTouchStart: isMobile && mobileConversationsOpen ? (e) => {
11264
+ if (e.currentTarget.contains(e.target)) {
11265
+ cardSwipeStartXRef.current = e.touches[0]?.clientX ?? null;
11266
+ }
11267
+ } : void 0,
11268
+ onTouchMove: isMobile && mobileConversationsOpen ? (e) => {
11269
+ const start = cardSwipeStartXRef.current;
11270
+ if (start === null) return;
11271
+ const dx = (e.touches[0]?.clientX ?? start) - start;
11272
+ if (Math.abs(dx) > 40) {
11273
+ cardSwipeStartXRef.current = null;
11274
+ setMobileConversationsOpen(false);
11275
+ }
11276
+ } : void 0,
11234
11277
  children: [
11235
11278
  /* @__PURE__ */ jsx23(
11236
11279
  chat_app_bar_default,
@@ -11528,12 +11571,12 @@ var Chat = () => {
11528
11571
  ossConfigured,
11529
11572
  isOSSMode: isOSSMode(),
11530
11573
  tier: featureFlag.getEvaluation()?.tier,
11531
- hasToken: authenticationService.isAuthenticated(),
11574
+ hasToken: authenticationService2.isAuthenticated(),
11532
11575
  playgroundBypassAuth,
11533
11576
  isPlaygroundRoute,
11534
11577
  bypassAuth
11535
11578
  });
11536
- if (!allowUnauthenticated && !bypassAuth && !authenticationService.isAuthenticated()) {
11579
+ if (!allowUnauthenticated && !bypassAuth && !authenticationService2.isAuthenticated()) {
11537
11580
  debugLogger.debug("User is not authenticated, redirecting to login");
11538
11581
  return /* @__PURE__ */ jsx23(Navigate, { to: "/login", replace: true });
11539
11582
  }
@@ -11544,4 +11587,4 @@ var chat_default = Chat;
11544
11587
  export {
11545
11588
  chat_default
11546
11589
  };
11547
- //# sourceMappingURL=chunk-YEPJ7DWZ.mjs.map
11590
+ //# sourceMappingURL=chunk-ZRJYLJKZ.mjs.map