@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
package/dist/index.mjs CHANGED
@@ -1,26 +1,26 @@
1
1
  import {
2
2
  chat_default
3
- } from "./chunk-YEPJ7DWZ.mjs";
3
+ } from "./chunk-ZRJYLJKZ.mjs";
4
4
  import {
5
5
  chat_provider_default
6
- } from "./chunk-PU74BI6Y.mjs";
6
+ } from "./chunk-QLATFSSO.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-IJTDHBHP.mjs";
14
- import "./chunk-7P7IS6UA.mjs";
15
- import "./chunk-F7JXIW6T.mjs";
16
- import "./chunk-K2JGFKEB.mjs";
13
+ } from "./chunk-DSYE5AHW.mjs";
14
+ import "./chunk-6STVJJSG.mjs";
15
+ import "./chunk-RRCCSN3N.mjs";
16
+ import "./chunk-CVFFNX7H.mjs";
17
17
  import {
18
18
  defineCustomElement
19
19
  } from "./chunk-IXIM7BNO.mjs";
20
20
  import {
21
21
  FeedbackButton,
22
22
  chat_modal_default
23
- } from "./chunk-L37EUHMZ.mjs";
23
+ } from "./chunk-U33KBX3Y.mjs";
24
24
  import {
25
25
  FeedbackModal,
26
26
  StreamingTTSClient,
@@ -37,7 +37,7 @@ import {
37
37
  useTTS,
38
38
  useVoiceStore,
39
39
  voiceService
40
- } from "./chunk-FFVGZK5D.mjs";
40
+ } from "./chunk-TYRYAAP2.mjs";
41
41
  import {
42
42
  DEFAULT_TIER_FEATURES,
43
43
  FeatureFlagContext,
@@ -56,7 +56,7 @@ import {
56
56
  useVectorStore,
57
57
  vectorDatabaseService,
58
58
  vectorMigrationService
59
- } from "./chunk-NLBZZP3B.mjs";
59
+ } from "./chunk-VLUXQE24.mjs";
60
60
  import {
61
61
  usePackageSettingsStore,
62
62
  usePreferencesStore
@@ -64,7 +64,7 @@ import {
64
64
  import {
65
65
  authenticationService,
66
66
  useAuthenticationStore
67
- } from "./chunk-43MLINPL.mjs";
67
+ } from "./chunk-GWQRTUKF.mjs";
68
68
  import {
69
69
  DebugLogger,
70
70
  debugLogger
@@ -1585,7 +1585,7 @@ function emitAuthTokenChanged(token) {
1585
1585
  detail: { token }
1586
1586
  }));
1587
1587
  }
1588
- var TOKEN_KEY2, AUTH_TOKEN_CHANGED_EVENT, AuthenticationService, authenticationService;
1588
+ var TOKEN_KEY2, AUTH_TOKEN_CHANGED_EVENT, AuthenticationService, authenticationService2;
1589
1589
  var init_authenticationService = __esm({
1590
1590
  "src/services/auth/authenticationService.ts"() {
1591
1591
  "use strict";
@@ -1638,7 +1638,7 @@ var init_authenticationService = __esm({
1638
1638
  }
1639
1639
  }
1640
1640
  };
1641
- authenticationService = new AuthenticationService();
1641
+ authenticationService2 = new AuthenticationService();
1642
1642
  }
1643
1643
  });
1644
1644
 
@@ -1721,12 +1721,15 @@ var init_gateway_service = __esm({
1721
1721
  return;
1722
1722
  }
1723
1723
  const data = error.response?.data;
1724
- const code = data?.code;
1725
- if (code !== "FORCE_RELOGIN" && code !== "ACCOUNT_LOCKED") {
1724
+ let code = data?.code;
1725
+ if (status === 401 && !code) {
1726
+ code = "TOKEN_EXPIRED";
1727
+ }
1728
+ if (code !== "FORCE_RELOGIN" && code !== "ACCOUNT_LOCKED" && code !== "TOKEN_EXPIRED") {
1726
1729
  return;
1727
1730
  }
1728
1731
  try {
1729
- authenticationService.clearToken();
1732
+ authenticationService2.clearToken();
1730
1733
  } catch {
1731
1734
  }
1732
1735
  if (typeof window !== "undefined" && typeof window.dispatchEvent === "function") {
@@ -8137,7 +8140,7 @@ function buildUrl(path) {
8137
8140
  }
8138
8141
  function buildHeaders() {
8139
8142
  const headers = { "Content-Type": "application/json" };
8140
- const token = authenticationService.getToken();
8143
+ const token = authenticationService2.getToken();
8141
8144
  if (token) {
8142
8145
  headers["Authorization"] = `Bearer ${token}`;
8143
8146
  }
@@ -8285,7 +8288,7 @@ function resolveAuthIdentity(token) {
8285
8288
  if (!token) {
8286
8289
  return null;
8287
8290
  }
8288
- const claims = authenticationService.parseJwtClaims(token);
8291
+ const claims = authenticationService2.parseJwtClaims(token);
8289
8292
  if (claims?.sub) {
8290
8293
  return claims.sub;
8291
8294
  }
@@ -8818,7 +8821,7 @@ var init_conversationSyncStore = __esm({
8818
8821
  async initialize() {
8819
8822
  ensureTrackersInitialized();
8820
8823
  const gatewayUrl = usePackageSettingsStore.getState().settings?.gatewayApiUrl;
8821
- const token = authenticationService.getToken();
8824
+ const token = authenticationService2.getToken();
8822
8825
  const tokenIdentity = resolveAuthIdentity(token);
8823
8826
  const current = get();
8824
8827
  const storedIdentity = getStoredSyncIdentity();
@@ -8944,10 +8947,10 @@ var init_conversationSyncStore = __esm({
8944
8947
  });
8945
8948
  set({
8946
8949
  hasLoadedPreference: true,
8947
- initializedForToken: authenticationService.getToken(),
8948
- initializedForIdentity: resolveAuthIdentity(authenticationService.getToken())
8950
+ initializedForToken: authenticationService2.getToken(),
8951
+ initializedForIdentity: resolveAuthIdentity(authenticationService2.getToken())
8949
8952
  });
8950
- setStoredSyncIdentity(resolveAuthIdentity(authenticationService.getToken()));
8953
+ setStoredSyncIdentity(resolveAuthIdentity(authenticationService2.getToken()));
8951
8954
  if (enabled) {
8952
8955
  set({ hasCompletedInitialUpload: false });
8953
8956
  }
@@ -8987,10 +8990,10 @@ var init_conversationSyncStore = __esm({
8987
8990
  });
8988
8991
  set({
8989
8992
  hasLoadedPreference: true,
8990
- initializedForToken: authenticationService.getToken(),
8991
- initializedForIdentity: resolveAuthIdentity(authenticationService.getToken())
8993
+ initializedForToken: authenticationService2.getToken(),
8994
+ initializedForIdentity: resolveAuthIdentity(authenticationService2.getToken())
8992
8995
  });
8993
- setStoredSyncIdentity(resolveAuthIdentity(authenticationService.getToken()));
8996
+ setStoredSyncIdentity(resolveAuthIdentity(authenticationService2.getToken()));
8994
8997
  if (preference.syncEnabled && preference.isAdvancedVectorFeaturesEnabled) {
8995
8998
  await get().runSync({ force: true });
8996
8999
  }
@@ -9030,7 +9033,7 @@ var init_conversationSyncStore = __esm({
9030
9033
  debugLogger.error("conversationSyncStore: runSync error - missing gateway URL");
9031
9034
  return;
9032
9035
  }
9033
- const token = authenticationService.getToken();
9036
+ const token = authenticationService2.getToken();
9034
9037
  if (!token) {
9035
9038
  set({ status: "error", lastError: "Authentication required to sync conversations." });
9036
9039
  debugLogger.error("conversationSyncStore: runSync error - missing auth token");
@@ -11919,7 +11922,7 @@ var init_voiceService = __esm({
11919
11922
  debugLogger.error("Gateway API URL not configured");
11920
11923
  throw new Error("Gateway API URL not configured");
11921
11924
  }
11922
- const token = authenticationService.getToken();
11925
+ const token = authenticationService2.getToken();
11923
11926
  if (!token) {
11924
11927
  debugLogger.warn("No JWT token available - skipping voice models fetch");
11925
11928
  const emptyModels = {
@@ -11929,7 +11932,7 @@ var init_voiceService = __esm({
11929
11932
  };
11930
11933
  return emptyModels;
11931
11934
  }
11932
- if (authenticationService.isTokenExpired(token)) {
11935
+ if (authenticationService2.isTokenExpired(token)) {
11933
11936
  debugLogger.warn("JWT token is expired - skipping voice models fetch");
11934
11937
  const emptyModels = {
11935
11938
  models: [],
@@ -12018,7 +12021,7 @@ var init_tts_client = __esm({
12018
12021
  init_packageSettingsStore();
12019
12022
  init_debugLogger();
12020
12023
  getOrAppendAuthHeader = (existing = {}) => {
12021
- const token = authenticationService.getToken();
12024
+ const token = authenticationService2.getToken();
12022
12025
  if (token) {
12023
12026
  existing["Authorization"] = `Bearer ${token}`;
12024
12027
  return existing;
@@ -12709,8 +12712,8 @@ var init_ai_response_action_bar = __esm({
12709
12712
  const { preferences } = usePreferencesStore();
12710
12713
  const { settings: packageSettings } = usePackageSettingsStore();
12711
12714
  (0, import_react13.useEffect)(() => {
12712
- const isAuthenticated = authenticationService.isAuthenticated();
12713
- const token = authenticationService.getToken();
12715
+ const isAuthenticated = authenticationService2.isAuthenticated();
12716
+ const token = authenticationService2.getToken();
12714
12717
  if (!initialized || availableVoices.length === 0) {
12715
12718
  if (token && isAuthenticated) {
12716
12719
  debugLogger.debug("AI Action Bar: Voices not initialized or unavailable, attempting to load from API");
@@ -15563,7 +15566,7 @@ var init_FeedbackModal = __esm({
15563
15566
  }
15564
15567
  const gatewayService = new GatewayService(
15565
15568
  gatewayUrl,
15566
- () => authenticationService.getToken(),
15569
+ () => authenticationService2.getToken(),
15567
15570
  feedbackEmail || settings?.feedbackEmail
15568
15571
  );
15569
15572
  const feedbackRequest = {
@@ -19507,7 +19510,7 @@ var init_mcpServersService = __esm({
19507
19510
  };
19508
19511
  authHeaders2 = () => {
19509
19512
  const headers = { "Content-Type": "application/json" };
19510
- const token = authenticationService.getToken();
19513
+ const token = authenticationService2.getToken();
19511
19514
  if (token) headers["Authorization"] = `Bearer ${token}`;
19512
19515
  return headers;
19513
19516
  };
@@ -20706,7 +20709,7 @@ var init_engineStore = __esm({
20706
20709
  }
20707
20710
  try {
20708
20711
  const headers = { "Content-Type": "application/json" };
20709
- const token = authenticationService.getToken();
20712
+ const token = authenticationService2.getToken();
20710
20713
  if (token) headers["Authorization"] = `Bearer ${token}`;
20711
20714
  const res = await fetch(`${base}/models`, { headers });
20712
20715
  const data = await res.json();
@@ -21024,7 +21027,7 @@ var init_stt_client = __esm({
21024
21027
  filename,
21025
21028
  url: `${gatewayUrl}/stt/transcribe`
21026
21029
  });
21027
- const token = authenticationService.getToken();
21030
+ const token = authenticationService2.getToken();
21028
21031
  const response = await fetch(`${gatewayUrl}/stt/transcribe`, {
21029
21032
  method: "POST",
21030
21033
  headers: {
@@ -22624,7 +22627,7 @@ function syncTelemetry() {
22624
22627
  const settings = usePackageSettingsStore.getState().settings;
22625
22628
  const cfg = resolveTelemetryConfig({
22626
22629
  telemetry: settings?.telemetry,
22627
- banditApiKey: authenticationService.getToken() ?? void 0
22630
+ banditApiKey: authenticationService2.getToken() ?? void 0
22628
22631
  });
22629
22632
  active = cfg ? new TelemetryExporter(cfg) : null;
22630
22633
  } catch {
@@ -23275,7 +23278,7 @@ var init_mcpService = __esm({
23275
23278
  }
23276
23279
  if (tool.mcpServerId) {
23277
23280
  const base2 = settings.gatewayApiUrl.replace(/\/$/, "");
23278
- const token2 = authenticationService.getToken();
23281
+ const token2 = authenticationService2.getToken();
23279
23282
  const controller2 = new AbortController();
23280
23283
  const timeoutId2 = setTimeout(() => controller2.abort(), 3e4);
23281
23284
  try {
@@ -23322,7 +23325,7 @@ var init_mcpService = __esm({
23322
23325
  "Content-Type": "application/json"
23323
23326
  }
23324
23327
  };
23325
- const token = authenticationService.getToken();
23328
+ const token = authenticationService2.getToken();
23326
23329
  if (token) {
23327
23330
  requestOptions.headers = {
23328
23331
  ...requestOptions.headers,
@@ -24320,6 +24323,29 @@ ${protocol}`;
24320
24323
  overrideComponentStatus("Idle");
24321
24324
  setIsSubmitting(false);
24322
24325
  setIsStreaming(false);
24326
+ if (/lifetime validation|token.*(expired|invalid)|unauthorized|\b401\b/i.test(err.message || "")) {
24327
+ const { replaceLastAnswer: replaceLastAnswer2 } = useConversationStore.getState();
24328
+ replaceLastAnswer2(
24329
+ "_Your session ended \u2014 sign back in to continue._",
24330
+ lastPartialRef.current.images,
24331
+ false,
24332
+ lastPartialRef.current.usedDocs,
24333
+ true
24334
+ );
24335
+ setResponse("");
24336
+ setStreamBuffer("");
24337
+ setIsThinking?.(false);
24338
+ setPendingMessage(null);
24339
+ try {
24340
+ authenticationService.clearToken();
24341
+ } catch {
24342
+ }
24343
+ window.dispatchEvent(
24344
+ new CustomEvent("auth:force-relogin", { detail: { code: "TOKEN_EXPIRED" } })
24345
+ );
24346
+ telemetryEndTurn({ error: "auth_expired" });
24347
+ return;
24348
+ }
24323
24349
  const rateLimit = parseRateLimitError(err);
24324
24350
  if (rateLimit) {
24325
24351
  debugLogger.info("Chat hit usage limit (429) \u2014 showing upgrade prompt", {
@@ -27602,7 +27628,7 @@ var init_conversation_drawer = __esm({
27602
27628
  title: "Sign out",
27603
27629
  onClick: (event) => {
27604
27630
  event.stopPropagation();
27605
- authenticationService.clearToken();
27631
+ authenticationService2.clearToken();
27606
27632
  window.location.href = "/login";
27607
27633
  },
27608
27634
  sx: {
@@ -28718,7 +28744,7 @@ var init_enhanced_mobile_conversations_modal = __esm({
28718
28744
  title: "Sign out",
28719
28745
  onClick: (event) => {
28720
28746
  event.stopPropagation();
28721
- authenticationService.clearToken();
28747
+ authenticationService2.clearToken();
28722
28748
  window.location.href = "/login";
28723
28749
  },
28724
28750
  sx: {
@@ -29598,7 +29624,7 @@ var init_UnderReview = __esm({
29598
29624
  const theme = (0, import_material51.useTheme)();
29599
29625
  const navigate = (0, import_react_router_dom4.useNavigate)();
29600
29626
  const handleResetSession = () => {
29601
- authenticationService.clearToken();
29627
+ authenticationService2.clearToken();
29602
29628
  navigate("/login");
29603
29629
  };
29604
29630
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
@@ -30277,8 +30303,8 @@ var init_chat2 = __esm({
30277
30303
  const notificationService2 = useNotificationService();
30278
30304
  const [selectedTheme, setSelectedTheme] = (0, import_react63.useState)(null);
30279
30305
  const [themeLoading, setThemeLoading] = (0, import_react63.useState)(true);
30280
- const token = authenticationService.getToken();
30281
- const claims = token ? authenticationService.parseJwtClaims(token) : null;
30306
+ const token = authenticationService2.getToken();
30307
+ const claims = token ? authenticationService2.parseJwtClaims(token) : null;
30282
30308
  const baseTheme = themeMap_default[selectedTheme ?? "bandit-dark"] || banditDarkTheme;
30283
30309
  const banditTheme = (0, import_react63.useMemo)(() => {
30284
30310
  return (0, import_styles34.createTheme)(baseTheme, {
@@ -30351,7 +30377,7 @@ var init_chat2 = __esm({
30351
30377
  } = useTTS();
30352
30378
  (0, import_react63.useEffect)(() => {
30353
30379
  const timer = setTimeout(() => {
30354
- const isAuthenticated = authenticationService.isAuthenticated();
30380
+ const isAuthenticated = authenticationService2.isAuthenticated();
30355
30381
  if (!initialized || availableVoices.length === 0) {
30356
30382
  if (token && isAuthenticated) {
30357
30383
  debugLogger.debug("Chat: Voices not initialized or unavailable, attempting to load from API");
@@ -30364,7 +30390,7 @@ var init_chat2 = __esm({
30364
30390
  return () => clearTimeout(timer);
30365
30391
  }, [initialized, availableVoices.length, loadVoicesFromAPI, token]);
30366
30392
  (0, import_react63.useEffect)(() => {
30367
- const isAuthenticated = authenticationService.isAuthenticated();
30393
+ const isAuthenticated = authenticationService2.isAuthenticated();
30368
30394
  if (packageSettings?.gatewayApiUrl && availableVoices.length === 0 && !initialized) {
30369
30395
  if (token && isAuthenticated) {
30370
30396
  debugLogger.debug("Chat: Gateway URL available and no voices loaded, attempting to load from API");
@@ -30386,6 +30412,7 @@ var init_chat2 = __esm({
30386
30412
  const [isMobile, setIsMobile] = (0, import_react63.useState)(false);
30387
30413
  const [drawerOpen, setDrawerOpen] = (0, import_react63.useState)(false);
30388
30414
  const [mobileConversationsOpen, setMobileConversationsOpen] = (0, import_react63.useState)(false);
30415
+ const cardSwipeStartXRef = (0, import_react63.useRef)(null);
30389
30416
  (0, import_react63.useEffect)(() => {
30390
30417
  if (typeof document === "undefined") return;
30391
30418
  const meta = document.querySelector('meta[name="theme-color"]');
@@ -31260,7 +31287,12 @@ var init_chat2 = __esm({
31260
31287
  // reads as full physical height with the rounded corner visible
31261
31288
  // where it overlaps the drawer.
31262
31289
  transform: isMobile && mobileConversationsOpen ? "translateX(calc(min(calc(100vw - 56px), 360px) - 12px))" : "none",
31263
- borderRadius: isMobile && mobileConversationsOpen ? "44px" : 0,
31290
+ // Square top-left + no top border: the card's edge runs unbroken
31291
+ // from the very top of the screen (all surfaces share one color),
31292
+ // which reads as true full height; a soft bottom-left corner keeps
31293
+ // the sheet feel.
31294
+ borderRadius: isMobile && mobileConversationsOpen ? "0 0 0 28px" : 0,
31295
+ borderTop: isMobile && mobileConversationsOpen ? "none" : void 0,
31264
31296
  zIndex: isMobile && mobileConversationsOpen ? theme.zIndex.modal + 1 : 0,
31265
31297
  // Hairline border so the rounded card reads even when the backdrop
31266
31298
  // is the same near-black as the shell.
@@ -31273,6 +31305,20 @@ var init_chat2 = __esm({
31273
31305
  setMobileConversationsOpen(false);
31274
31306
  }
31275
31307
  } : void 0,
31308
+ onTouchStart: isMobile && mobileConversationsOpen ? (e) => {
31309
+ if (e.currentTarget.contains(e.target)) {
31310
+ cardSwipeStartXRef.current = e.touches[0]?.clientX ?? null;
31311
+ }
31312
+ } : void 0,
31313
+ onTouchMove: isMobile && mobileConversationsOpen ? (e) => {
31314
+ const start = cardSwipeStartXRef.current;
31315
+ if (start === null) return;
31316
+ const dx = (e.touches[0]?.clientX ?? start) - start;
31317
+ if (Math.abs(dx) > 40) {
31318
+ cardSwipeStartXRef.current = null;
31319
+ setMobileConversationsOpen(false);
31320
+ }
31321
+ } : void 0,
31276
31322
  children: [
31277
31323
  /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
31278
31324
  chat_app_bar_default,
@@ -31570,12 +31616,12 @@ var init_chat2 = __esm({
31570
31616
  ossConfigured,
31571
31617
  isOSSMode: isOSSMode(),
31572
31618
  tier: featureFlag.getEvaluation()?.tier,
31573
- hasToken: authenticationService.isAuthenticated(),
31619
+ hasToken: authenticationService2.isAuthenticated(),
31574
31620
  playgroundBypassAuth,
31575
31621
  isPlaygroundRoute,
31576
31622
  bypassAuth
31577
31623
  });
31578
- if (!allowUnauthenticated && !bypassAuth && !authenticationService.isAuthenticated()) {
31624
+ if (!allowUnauthenticated && !bypassAuth && !authenticationService2.isAuthenticated()) {
31579
31625
  debugLogger.debug("User is not authenticated, redirecting to login");
31580
31626
  return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react_router_dom5.Navigate, { to: "/login", replace: true });
31581
31627
  }
@@ -36395,7 +36441,7 @@ var useGatewayClient = () => {
36395
36441
  }
36396
36442
  return new GatewayService(
36397
36443
  gatewayUrl,
36398
- () => authenticationService.getToken(),
36444
+ () => authenticationService2.getToken(),
36399
36445
  feedbackEmail
36400
36446
  );
36401
36447
  }, [gatewayUrl, feedbackEmail]);
@@ -40244,7 +40290,7 @@ var buildHeaders2 = () => {
40244
40290
  const headers = {
40245
40291
  "Content-Type": "application/json"
40246
40292
  };
40247
- const token = authenticationService.getToken();
40293
+ const token = authenticationService2.getToken();
40248
40294
  if (token) {
40249
40295
  headers.Authorization = `Bearer ${token}`;
40250
40296
  }
@@ -42843,7 +42889,7 @@ var AIProviderInitService = class _AIProviderInitService {
42843
42889
  type: "ollama" /* OLLAMA */,
42844
42890
  baseUrl: settings.ollamaUrl,
42845
42891
  tokenFactory: () => {
42846
- let token = authenticationService.getToken();
42892
+ let token = authenticationService2.getToken();
42847
42893
  if (!token) {
42848
42894
  token = localStorage.getItem("authToken");
42849
42895
  }
@@ -42884,7 +42930,7 @@ var AIProviderInitService = class _AIProviderInitService {
42884
42930
  type: "ollama" /* OLLAMA */,
42885
42931
  baseUrl: settings.ollamaUrl || "http://localhost:11434",
42886
42932
  tokenFactory: () => {
42887
- let token = authenticationService.getToken();
42933
+ let token = authenticationService2.getToken();
42888
42934
  if (!token) {
42889
42935
  token = localStorage.getItem("authToken");
42890
42936
  }
@@ -42915,7 +42961,7 @@ var AIProviderInitService = class _AIProviderInitService {
42915
42961
  type: "ollama" /* OLLAMA */,
42916
42962
  baseUrl: "http://localhost:11434",
42917
42963
  tokenFactory: () => {
42918
- let token = authenticationService.getToken();
42964
+ let token = authenticationService2.getToken();
42919
42965
  if (!token) {
42920
42966
  token = localStorage.getItem("authToken");
42921
42967
  }
@@ -43005,7 +43051,7 @@ var AIProviderInitService = class _AIProviderInitService {
43005
43051
  return config;
43006
43052
  }
43007
43053
  config.tokenFactory = () => {
43008
- let token = authenticationService.getToken();
43054
+ let token = authenticationService2.getToken();
43009
43055
  if (!token && typeof localStorage !== "undefined") {
43010
43056
  try {
43011
43057
  token = localStorage.getItem("authToken");
@@ -43652,7 +43698,7 @@ function buildUrl3(path) {
43652
43698
  }
43653
43699
  function authHeaders() {
43654
43700
  const headers = { "Content-Type": "application/json" };
43655
- const token = authenticationService.getToken();
43701
+ const token = authenticationService2.getToken();
43656
43702
  if (token) headers["Authorization"] = `Bearer ${token}`;
43657
43703
  return headers;
43658
43704
  }
@@ -44997,7 +45043,7 @@ var Management = () => {
44997
45043
  let isActive = true;
44998
45044
  const loadCapabilities = async () => {
44999
45045
  try {
45000
- const token = authToken ?? authenticationService.getToken();
45046
+ const token = authToken ?? authenticationService2.getToken();
45001
45047
  const headers = {
45002
45048
  "Content-Type": "application/json"
45003
45049
  };
@@ -45133,7 +45179,7 @@ var Management = () => {
45133
45179
  "admin",
45134
45180
  "platform_admin"
45135
45181
  ]);
45136
- const userRoles = (authenticationService.parseJwtClaims(authenticationService.getToken() ?? "")?.roles ?? []).map((r) => r.toLowerCase());
45182
+ const userRoles = (authenticationService2.parseJwtClaims(authenticationService2.getToken() ?? "")?.roles ?? []).map((r) => r.toLowerCase());
45137
45183
  const isWorkspaceAdmin = userRoles.some(
45138
45184
  (r) => platformAdminRoles.has(r) || r.endsWith("-admin")
45139
45185
  );