@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.js CHANGED
@@ -232,7 +232,7 @@ function emitAuthTokenChanged(token) {
232
232
  detail: { token }
233
233
  }));
234
234
  }
235
- var TOKEN_KEY2, AUTH_TOKEN_CHANGED_EVENT, AuthenticationService, authenticationService;
235
+ var TOKEN_KEY2, AUTH_TOKEN_CHANGED_EVENT, AuthenticationService, authenticationService2;
236
236
  var init_authenticationService = __esm({
237
237
  "src/services/auth/authenticationService.ts"() {
238
238
  "use strict";
@@ -285,7 +285,7 @@ var init_authenticationService = __esm({
285
285
  }
286
286
  }
287
287
  };
288
- authenticationService = new AuthenticationService();
288
+ authenticationService2 = new AuthenticationService();
289
289
  }
290
290
  });
291
291
 
@@ -2149,7 +2149,7 @@ function buildUrl(path) {
2149
2149
  }
2150
2150
  function buildHeaders() {
2151
2151
  const headers = { "Content-Type": "application/json" };
2152
- const token = authenticationService.getToken();
2152
+ const token = authenticationService2.getToken();
2153
2153
  if (token) {
2154
2154
  headers["Authorization"] = `Bearer ${token}`;
2155
2155
  }
@@ -2297,7 +2297,7 @@ function resolveAuthIdentity(token) {
2297
2297
  if (!token) {
2298
2298
  return null;
2299
2299
  }
2300
- const claims = authenticationService.parseJwtClaims(token);
2300
+ const claims = authenticationService2.parseJwtClaims(token);
2301
2301
  if (claims?.sub) {
2302
2302
  return claims.sub;
2303
2303
  }
@@ -2830,7 +2830,7 @@ var init_conversationSyncStore = __esm({
2830
2830
  async initialize() {
2831
2831
  ensureTrackersInitialized();
2832
2832
  const gatewayUrl = usePackageSettingsStore.getState().settings?.gatewayApiUrl;
2833
- const token = authenticationService.getToken();
2833
+ const token = authenticationService2.getToken();
2834
2834
  const tokenIdentity = resolveAuthIdentity(token);
2835
2835
  const current = get();
2836
2836
  const storedIdentity = getStoredSyncIdentity();
@@ -2956,10 +2956,10 @@ var init_conversationSyncStore = __esm({
2956
2956
  });
2957
2957
  set({
2958
2958
  hasLoadedPreference: true,
2959
- initializedForToken: authenticationService.getToken(),
2960
- initializedForIdentity: resolveAuthIdentity(authenticationService.getToken())
2959
+ initializedForToken: authenticationService2.getToken(),
2960
+ initializedForIdentity: resolveAuthIdentity(authenticationService2.getToken())
2961
2961
  });
2962
- setStoredSyncIdentity(resolveAuthIdentity(authenticationService.getToken()));
2962
+ setStoredSyncIdentity(resolveAuthIdentity(authenticationService2.getToken()));
2963
2963
  if (enabled) {
2964
2964
  set({ hasCompletedInitialUpload: false });
2965
2965
  }
@@ -2999,10 +2999,10 @@ var init_conversationSyncStore = __esm({
2999
2999
  });
3000
3000
  set({
3001
3001
  hasLoadedPreference: true,
3002
- initializedForToken: authenticationService.getToken(),
3003
- initializedForIdentity: resolveAuthIdentity(authenticationService.getToken())
3002
+ initializedForToken: authenticationService2.getToken(),
3003
+ initializedForIdentity: resolveAuthIdentity(authenticationService2.getToken())
3004
3004
  });
3005
- setStoredSyncIdentity(resolveAuthIdentity(authenticationService.getToken()));
3005
+ setStoredSyncIdentity(resolveAuthIdentity(authenticationService2.getToken()));
3006
3006
  if (preference.syncEnabled && preference.isAdvancedVectorFeaturesEnabled) {
3007
3007
  await get().runSync({ force: true });
3008
3008
  }
@@ -3042,7 +3042,7 @@ var init_conversationSyncStore = __esm({
3042
3042
  debugLogger.error("conversationSyncStore: runSync error - missing gateway URL");
3043
3043
  return;
3044
3044
  }
3045
- const token = authenticationService.getToken();
3045
+ const token = authenticationService2.getToken();
3046
3046
  if (!token) {
3047
3047
  set({ status: "error", lastError: "Authentication required to sync conversations." });
3048
3048
  debugLogger.error("conversationSyncStore: runSync error - missing auth token");
@@ -3342,7 +3342,7 @@ var init_mcpServersService = __esm({
3342
3342
  };
3343
3343
  authHeaders = () => {
3344
3344
  const headers = { "Content-Type": "application/json" };
3345
- const token = authenticationService.getToken();
3345
+ const token = authenticationService2.getToken();
3346
3346
  if (token) headers["Authorization"] = `Bearer ${token}`;
3347
3347
  return headers;
3348
3348
  };
@@ -4778,12 +4778,15 @@ var init_gateway_service = __esm({
4778
4778
  return;
4779
4779
  }
4780
4780
  const data = error.response?.data;
4781
- const code = data?.code;
4782
- if (code !== "FORCE_RELOGIN" && code !== "ACCOUNT_LOCKED") {
4781
+ let code = data?.code;
4782
+ if (status === 401 && !code) {
4783
+ code = "TOKEN_EXPIRED";
4784
+ }
4785
+ if (code !== "FORCE_RELOGIN" && code !== "ACCOUNT_LOCKED" && code !== "TOKEN_EXPIRED") {
4783
4786
  return;
4784
4787
  }
4785
4788
  try {
4786
- authenticationService.clearToken();
4789
+ authenticationService2.clearToken();
4787
4790
  } catch {
4788
4791
  }
4789
4792
  if (typeof window !== "undefined" && typeof window.dispatchEvent === "function") {
@@ -13565,7 +13568,7 @@ var init_voiceService = __esm({
13565
13568
  debugLogger.error("Gateway API URL not configured");
13566
13569
  throw new Error("Gateway API URL not configured");
13567
13570
  }
13568
- const token = authenticationService.getToken();
13571
+ const token = authenticationService2.getToken();
13569
13572
  if (!token) {
13570
13573
  debugLogger.warn("No JWT token available - skipping voice models fetch");
13571
13574
  const emptyModels = {
@@ -13575,7 +13578,7 @@ var init_voiceService = __esm({
13575
13578
  };
13576
13579
  return emptyModels;
13577
13580
  }
13578
- if (authenticationService.isTokenExpired(token)) {
13581
+ if (authenticationService2.isTokenExpired(token)) {
13579
13582
  debugLogger.warn("JWT token is expired - skipping voice models fetch");
13580
13583
  const emptyModels = {
13581
13584
  models: [],
@@ -13664,7 +13667,7 @@ var init_tts_client = __esm({
13664
13667
  init_packageSettingsStore();
13665
13668
  init_debugLogger();
13666
13669
  getOrAppendAuthHeader = (existing = {}) => {
13667
- const token = authenticationService.getToken();
13670
+ const token = authenticationService2.getToken();
13668
13671
  if (token) {
13669
13672
  existing["Authorization"] = `Bearer ${token}`;
13670
13673
  return existing;
@@ -14361,8 +14364,8 @@ var init_ai_response_action_bar = __esm({
14361
14364
  const { preferences } = usePreferencesStore();
14362
14365
  const { settings: packageSettings } = usePackageSettingsStore();
14363
14366
  (0, import_react16.useEffect)(() => {
14364
- const isAuthenticated = authenticationService.isAuthenticated();
14365
- const token = authenticationService.getToken();
14367
+ const isAuthenticated = authenticationService2.isAuthenticated();
14368
+ const token = authenticationService2.getToken();
14366
14369
  if (!initialized || availableVoices.length === 0) {
14367
14370
  if (token && isAuthenticated) {
14368
14371
  debugLogger.debug("AI Action Bar: Voices not initialized or unavailable, attempting to load from API");
@@ -16024,7 +16027,7 @@ var init_engineStore = __esm({
16024
16027
  }
16025
16028
  try {
16026
16029
  const headers = { "Content-Type": "application/json" };
16027
- const token = authenticationService.getToken();
16030
+ const token = authenticationService2.getToken();
16028
16031
  if (token) headers["Authorization"] = `Bearer ${token}`;
16029
16032
  const res = await fetch(`${base}/models`, { headers });
16030
16033
  const data = await res.json();
@@ -16342,7 +16345,7 @@ var init_stt_client = __esm({
16342
16345
  filename,
16343
16346
  url: `${gatewayUrl}/stt/transcribe`
16344
16347
  });
16345
- const token = authenticationService.getToken();
16348
+ const token = authenticationService2.getToken();
16346
16349
  const response = await fetch(`${gatewayUrl}/stt/transcribe`, {
16347
16350
  method: "POST",
16348
16351
  headers: {
@@ -19430,7 +19433,7 @@ function syncTelemetry() {
19430
19433
  const settings = usePackageSettingsStore.getState().settings;
19431
19434
  const cfg = resolveTelemetryConfig({
19432
19435
  telemetry: settings?.telemetry,
19433
- banditApiKey: authenticationService.getToken() ?? void 0
19436
+ banditApiKey: authenticationService2.getToken() ?? void 0
19434
19437
  });
19435
19438
  active = cfg ? new TelemetryExporter(cfg) : null;
19436
19439
  } catch {
@@ -20081,7 +20084,7 @@ var init_mcpService = __esm({
20081
20084
  }
20082
20085
  if (tool.mcpServerId) {
20083
20086
  const base2 = settings.gatewayApiUrl.replace(/\/$/, "");
20084
- const token2 = authenticationService.getToken();
20087
+ const token2 = authenticationService2.getToken();
20085
20088
  const controller2 = new AbortController();
20086
20089
  const timeoutId2 = setTimeout(() => controller2.abort(), 3e4);
20087
20090
  try {
@@ -20128,7 +20131,7 @@ var init_mcpService = __esm({
20128
20131
  "Content-Type": "application/json"
20129
20132
  }
20130
20133
  };
20131
- const token = authenticationService.getToken();
20134
+ const token = authenticationService2.getToken();
20132
20135
  if (token) {
20133
20136
  requestOptions.headers = {
20134
20137
  ...requestOptions.headers,
@@ -21126,6 +21129,29 @@ ${protocol}`;
21126
21129
  overrideComponentStatus("Idle");
21127
21130
  setIsSubmitting(false);
21128
21131
  setIsStreaming(false);
21132
+ if (/lifetime validation|token.*(expired|invalid)|unauthorized|\b401\b/i.test(err.message || "")) {
21133
+ const { replaceLastAnswer: replaceLastAnswer2 } = useConversationStore.getState();
21134
+ replaceLastAnswer2(
21135
+ "_Your session ended \u2014 sign back in to continue._",
21136
+ lastPartialRef.current.images,
21137
+ false,
21138
+ lastPartialRef.current.usedDocs,
21139
+ true
21140
+ );
21141
+ setResponse("");
21142
+ setStreamBuffer("");
21143
+ setIsThinking?.(false);
21144
+ setPendingMessage(null);
21145
+ try {
21146
+ authenticationService.clearToken();
21147
+ } catch {
21148
+ }
21149
+ window.dispatchEvent(
21150
+ new CustomEvent("auth:force-relogin", { detail: { code: "TOKEN_EXPIRED" } })
21151
+ );
21152
+ telemetryEndTurn({ error: "auth_expired" });
21153
+ return;
21154
+ }
21129
21155
  const rateLimit = parseRateLimitError(err);
21130
21156
  if (rateLimit) {
21131
21157
  debugLogger.info("Chat hit usage limit (429) \u2014 showing upgrade prompt", {
@@ -22280,7 +22306,7 @@ var init_FeedbackModal = __esm({
22280
22306
  }
22281
22307
  const gatewayService = new GatewayService(
22282
22308
  gatewayUrl,
22283
- () => authenticationService.getToken(),
22309
+ () => authenticationService2.getToken(),
22284
22310
  feedbackEmail || settings?.feedbackEmail
22285
22311
  );
22286
22312
  const feedbackRequest = {
@@ -25509,7 +25535,7 @@ var init_conversation_drawer = __esm({
25509
25535
  title: "Sign out",
25510
25536
  onClick: (event) => {
25511
25537
  event.stopPropagation();
25512
- authenticationService.clearToken();
25538
+ authenticationService2.clearToken();
25513
25539
  window.location.href = "/login";
25514
25540
  },
25515
25541
  sx: {
@@ -26625,7 +26651,7 @@ var init_enhanced_mobile_conversations_modal = __esm({
26625
26651
  title: "Sign out",
26626
26652
  onClick: (event) => {
26627
26653
  event.stopPropagation();
26628
- authenticationService.clearToken();
26654
+ authenticationService2.clearToken();
26629
26655
  window.location.href = "/login";
26630
26656
  },
26631
26657
  sx: {
@@ -29964,7 +29990,7 @@ var init_UnderReview = __esm({
29964
29990
  const theme = (0, import_material30.useTheme)();
29965
29991
  const navigate = (0, import_react_router_dom3.useNavigate)();
29966
29992
  const handleResetSession = () => {
29967
- authenticationService.clearToken();
29993
+ authenticationService2.clearToken();
29968
29994
  navigate("/login");
29969
29995
  };
29970
29996
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
@@ -30667,8 +30693,8 @@ var init_chat2 = __esm({
30667
30693
  const notificationService2 = useNotificationService();
30668
30694
  const [selectedTheme, setSelectedTheme] = (0, import_react41.useState)(null);
30669
30695
  const [themeLoading, setThemeLoading] = (0, import_react41.useState)(true);
30670
- const token = authenticationService.getToken();
30671
- const claims = token ? authenticationService.parseJwtClaims(token) : null;
30696
+ const token = authenticationService2.getToken();
30697
+ const claims = token ? authenticationService2.parseJwtClaims(token) : null;
30672
30698
  const baseTheme = themeMap_default[selectedTheme ?? "bandit-dark"] || banditDarkTheme;
30673
30699
  const banditTheme = (0, import_react41.useMemo)(() => {
30674
30700
  return (0, import_styles33.createTheme)(baseTheme, {
@@ -30741,7 +30767,7 @@ var init_chat2 = __esm({
30741
30767
  } = useTTS();
30742
30768
  (0, import_react41.useEffect)(() => {
30743
30769
  const timer = setTimeout(() => {
30744
- const isAuthenticated = authenticationService.isAuthenticated();
30770
+ const isAuthenticated = authenticationService2.isAuthenticated();
30745
30771
  if (!initialized || availableVoices.length === 0) {
30746
30772
  if (token && isAuthenticated) {
30747
30773
  debugLogger.debug("Chat: Voices not initialized or unavailable, attempting to load from API");
@@ -30754,7 +30780,7 @@ var init_chat2 = __esm({
30754
30780
  return () => clearTimeout(timer);
30755
30781
  }, [initialized, availableVoices.length, loadVoicesFromAPI, token]);
30756
30782
  (0, import_react41.useEffect)(() => {
30757
- const isAuthenticated = authenticationService.isAuthenticated();
30783
+ const isAuthenticated = authenticationService2.isAuthenticated();
30758
30784
  if (packageSettings?.gatewayApiUrl && availableVoices.length === 0 && !initialized) {
30759
30785
  if (token && isAuthenticated) {
30760
30786
  debugLogger.debug("Chat: Gateway URL available and no voices loaded, attempting to load from API");
@@ -30776,6 +30802,7 @@ var init_chat2 = __esm({
30776
30802
  const [isMobile, setIsMobile] = (0, import_react41.useState)(false);
30777
30803
  const [drawerOpen, setDrawerOpen] = (0, import_react41.useState)(false);
30778
30804
  const [mobileConversationsOpen, setMobileConversationsOpen] = (0, import_react41.useState)(false);
30805
+ const cardSwipeStartXRef = (0, import_react41.useRef)(null);
30779
30806
  (0, import_react41.useEffect)(() => {
30780
30807
  if (typeof document === "undefined") return;
30781
30808
  const meta = document.querySelector('meta[name="theme-color"]');
@@ -31650,7 +31677,12 @@ var init_chat2 = __esm({
31650
31677
  // reads as full physical height with the rounded corner visible
31651
31678
  // where it overlaps the drawer.
31652
31679
  transform: isMobile && mobileConversationsOpen ? "translateX(calc(min(calc(100vw - 56px), 360px) - 12px))" : "none",
31653
- borderRadius: isMobile && mobileConversationsOpen ? "44px" : 0,
31680
+ // Square top-left + no top border: the card's edge runs unbroken
31681
+ // from the very top of the screen (all surfaces share one color),
31682
+ // which reads as true full height; a soft bottom-left corner keeps
31683
+ // the sheet feel.
31684
+ borderRadius: isMobile && mobileConversationsOpen ? "0 0 0 28px" : 0,
31685
+ borderTop: isMobile && mobileConversationsOpen ? "none" : void 0,
31654
31686
  zIndex: isMobile && mobileConversationsOpen ? theme.zIndex.modal + 1 : 0,
31655
31687
  // Hairline border so the rounded card reads even when the backdrop
31656
31688
  // is the same near-black as the shell.
@@ -31663,6 +31695,20 @@ var init_chat2 = __esm({
31663
31695
  setMobileConversationsOpen(false);
31664
31696
  }
31665
31697
  } : void 0,
31698
+ onTouchStart: isMobile && mobileConversationsOpen ? (e) => {
31699
+ if (e.currentTarget.contains(e.target)) {
31700
+ cardSwipeStartXRef.current = e.touches[0]?.clientX ?? null;
31701
+ }
31702
+ } : void 0,
31703
+ onTouchMove: isMobile && mobileConversationsOpen ? (e) => {
31704
+ const start = cardSwipeStartXRef.current;
31705
+ if (start === null) return;
31706
+ const dx = (e.touches[0]?.clientX ?? start) - start;
31707
+ if (Math.abs(dx) > 40) {
31708
+ cardSwipeStartXRef.current = null;
31709
+ setMobileConversationsOpen(false);
31710
+ }
31711
+ } : void 0,
31666
31712
  children: [
31667
31713
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
31668
31714
  chat_app_bar_default,
@@ -31960,12 +32006,12 @@ var init_chat2 = __esm({
31960
32006
  ossConfigured,
31961
32007
  isOSSMode: isOSSMode(),
31962
32008
  tier: featureFlag.getEvaluation()?.tier,
31963
- hasToken: authenticationService.isAuthenticated(),
32009
+ hasToken: authenticationService2.isAuthenticated(),
31964
32010
  playgroundBypassAuth,
31965
32011
  isPlaygroundRoute,
31966
32012
  bypassAuth
31967
32013
  });
31968
- if (!allowUnauthenticated && !bypassAuth && !authenticationService.isAuthenticated()) {
32014
+ if (!allowUnauthenticated && !bypassAuth && !authenticationService2.isAuthenticated()) {
31969
32015
  debugLogger.debug("User is not authenticated, redirecting to login");
31970
32016
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom4.Navigate, { to: "/login", replace: true });
31971
32017
  }
@@ -32001,7 +32047,7 @@ __export(index_exports, {
32001
32047
  VectorDatabaseService: () => VectorDatabaseService,
32002
32048
  VectorMigrationService: () => VectorMigrationService,
32003
32049
  VoiceService: () => VoiceService,
32004
- authenticationService: () => authenticationService,
32050
+ authenticationService: () => authenticationService2,
32005
32051
  debugLogger: () => debugLogger,
32006
32052
  defineCustomElement: () => defineCustomElement,
32007
32053
  featureFlagService: () => featureFlagService,
@@ -32148,7 +32194,7 @@ var AIProviderInitService = class _AIProviderInitService {
32148
32194
  type: "ollama" /* OLLAMA */,
32149
32195
  baseUrl: settings.ollamaUrl,
32150
32196
  tokenFactory: () => {
32151
- let token = authenticationService.getToken();
32197
+ let token = authenticationService2.getToken();
32152
32198
  if (!token) {
32153
32199
  token = localStorage.getItem("authToken");
32154
32200
  }
@@ -32189,7 +32235,7 @@ var AIProviderInitService = class _AIProviderInitService {
32189
32235
  type: "ollama" /* OLLAMA */,
32190
32236
  baseUrl: settings.ollamaUrl || "http://localhost:11434",
32191
32237
  tokenFactory: () => {
32192
- let token = authenticationService.getToken();
32238
+ let token = authenticationService2.getToken();
32193
32239
  if (!token) {
32194
32240
  token = localStorage.getItem("authToken");
32195
32241
  }
@@ -32220,7 +32266,7 @@ var AIProviderInitService = class _AIProviderInitService {
32220
32266
  type: "ollama" /* OLLAMA */,
32221
32267
  baseUrl: "http://localhost:11434",
32222
32268
  tokenFactory: () => {
32223
- let token = authenticationService.getToken();
32269
+ let token = authenticationService2.getToken();
32224
32270
  if (!token) {
32225
32271
  token = localStorage.getItem("authToken");
32226
32272
  }
@@ -32310,7 +32356,7 @@ var AIProviderInitService = class _AIProviderInitService {
32310
32356
  return config;
32311
32357
  }
32312
32358
  config.tokenFactory = () => {
32313
- let token = authenticationService.getToken();
32359
+ let token = authenticationService2.getToken();
32314
32360
  if (!token && typeof localStorage !== "undefined") {
32315
32361
  try {
32316
32362
  token = localStorage.getItem("authToken");
@@ -32367,11 +32413,11 @@ var ChatProvider = (props) => {
32367
32413
  } catch (error) {
32368
32414
  debugLogger.error("Failed to initialize AI provider:", { error });
32369
32415
  }
32370
- const token = authenticationService.getToken();
32371
- if (token && !authenticationService.isTokenExpired(token)) {
32372
- authenticationService.setToken(token);
32416
+ const token = authenticationService2.getToken();
32417
+ if (token && !authenticationService2.isTokenExpired(token)) {
32418
+ authenticationService2.setToken(token);
32373
32419
  } else {
32374
- authenticationService.clearToken();
32420
+ authenticationService2.clearToken();
32375
32421
  }
32376
32422
  useConversationStore.getState().hydrate();
32377
32423
  useProjectStore.getState().hydrate();
@@ -37302,7 +37348,7 @@ var useGatewayClient = () => {
37302
37348
  }
37303
37349
  return new GatewayService(
37304
37350
  gatewayUrl,
37305
- () => authenticationService.getToken(),
37351
+ () => authenticationService2.getToken(),
37306
37352
  feedbackEmail
37307
37353
  );
37308
37354
  }, [gatewayUrl, feedbackEmail]);
@@ -41181,7 +41227,7 @@ var buildHeaders2 = () => {
41181
41227
  const headers = {
41182
41228
  "Content-Type": "application/json"
41183
41229
  };
41184
- const token = authenticationService.getToken();
41230
+ const token = authenticationService2.getToken();
41185
41231
  if (token) {
41186
41232
  headers.Authorization = `Bearer ${token}`;
41187
41233
  }
@@ -44312,7 +44358,7 @@ function buildUrl3(path) {
44312
44358
  }
44313
44359
  function authHeaders2() {
44314
44360
  const headers = { "Content-Type": "application/json" };
44315
- const token = authenticationService.getToken();
44361
+ const token = authenticationService2.getToken();
44316
44362
  if (token) headers["Authorization"] = `Bearer ${token}`;
44317
44363
  return headers;
44318
44364
  }
@@ -45657,7 +45703,7 @@ var Management = () => {
45657
45703
  let isActive = true;
45658
45704
  const loadCapabilities = async () => {
45659
45705
  try {
45660
- const token = authToken ?? authenticationService.getToken();
45706
+ const token = authToken ?? authenticationService2.getToken();
45661
45707
  const headers = {
45662
45708
  "Content-Type": "application/json"
45663
45709
  };
@@ -45793,7 +45839,7 @@ var Management = () => {
45793
45839
  "admin",
45794
45840
  "platform_admin"
45795
45841
  ]);
45796
- const userRoles = (authenticationService.parseJwtClaims(authenticationService.getToken() ?? "")?.roles ?? []).map((r) => r.toLowerCase());
45842
+ const userRoles = (authenticationService2.parseJwtClaims(authenticationService2.getToken() ?? "")?.roles ?? []).map((r) => r.toLowerCase());
45797
45843
  const isWorkspaceAdmin = userRoles.some(
45798
45844
  (r) => platformAdminRoles.has(r) || r.endsWith("-admin")
45799
45845
  );
@@ -46612,7 +46658,7 @@ var useVoices = () => {
46612
46658
  const gatewayApiUrl = usePackageSettingsStore((state) => state.settings?.gatewayApiUrl);
46613
46659
  const { token } = useAuthenticationStore();
46614
46660
  (0, import_react68.useEffect)(() => {
46615
- const isAuthenticated = authenticationService.isAuthenticated();
46661
+ const isAuthenticated = authenticationService2.isAuthenticated();
46616
46662
  if (gatewayApiUrl && token && isAuthenticated && !isServiceAvailable) {
46617
46663
  debugLogger.debug("Gateway API URL and JWT token available, loading voice models...");
46618
46664
  loadVoicesFromAPI();