@burtson-labs/bandit-engine 2.0.150 → 2.0.152

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-Y3WOTIKI.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-YEPJ7DWZ.mjs → chunk-7ESJJN6D.mjs} +63 -21
  8. package/dist/chunk-7ESJJN6D.mjs.map +1 -0
  9. package/dist/{chunk-K2JGFKEB.mjs → chunk-CVFFNX7H.mjs} +2 -2
  10. package/dist/{chunk-43MLINPL.mjs → chunk-GWQRTUKF.mjs} +6 -3
  11. package/dist/chunk-GWQRTUKF.mjs.map +1 -0
  12. package/dist/{chunk-IJTDHBHP.mjs → chunk-LPSM62OE.mjs} +9 -9
  13. package/dist/{chunk-PU74BI6Y.mjs → chunk-QLATFSSO.mjs} +5 -5
  14. package/dist/{chunk-F7JXIW6T.mjs → chunk-RRCCSN3N.mjs} +2 -2
  15. package/dist/{chunk-FFVGZK5D.mjs → chunk-TYRYAAP2.mjs} +3 -3
  16. package/dist/{chunk-L37EUHMZ.mjs → chunk-U33KBX3Y.mjs} +4 -4
  17. package/dist/{chunk-NLBZZP3B.mjs → chunk-VLUXQE24.mjs} +3 -3
  18. package/dist/index.js +96 -51
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +10 -10
  21. package/dist/management/management.js +90 -45
  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-Y3WOTIKI.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-LPSM62OE.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
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  StreamingMarkdown_default
3
- } from "./chunk-7P7IS6UA.mjs";
3
+ } from "./chunk-6STVJJSG.mjs";
4
4
  import {
5
5
  aiProviderInitService
6
- } from "./chunk-F7JXIW6T.mjs";
6
+ } from "./chunk-RRCCSN3N.mjs";
7
7
  import {
8
8
  addMcpServer,
9
9
  deleteMcpServer,
@@ -11,10 +11,10 @@ import {
11
11
  listMcpServers,
12
12
  updateMcpServer,
13
13
  useMCPToolsStore
14
- } from "./chunk-K2JGFKEB.mjs";
14
+ } from "./chunk-CVFFNX7H.mjs";
15
15
  import {
16
16
  chat_modal_default
17
- } from "./chunk-L37EUHMZ.mjs";
17
+ } from "./chunk-U33KBX3Y.mjs";
18
18
  import {
19
19
  AddIcon,
20
20
  ArchiveIcon,
@@ -83,7 +83,7 @@ import {
83
83
  predefinedThemes,
84
84
  useNotificationService,
85
85
  useVoiceStore
86
- } from "./chunk-FFVGZK5D.mjs";
86
+ } from "./chunk-TYRYAAP2.mjs";
87
87
  import {
88
88
  TOPICS,
89
89
  brandingService_default,
@@ -95,7 +95,7 @@ import {
95
95
  useFeatures,
96
96
  useKnowledgeStore2 as useKnowledgeStore,
97
97
  useVectorStore
98
- } from "./chunk-NLBZZP3B.mjs";
98
+ } from "./chunk-VLUXQE24.mjs";
99
99
  import {
100
100
  indexedDBService_default,
101
101
  models,
@@ -109,7 +109,7 @@ import {
109
109
  authenticationService,
110
110
  useAIProviderStore,
111
111
  useAuthenticationStore
112
- } from "./chunk-43MLINPL.mjs";
112
+ } from "./chunk-GWQRTUKF.mjs";
113
113
  import {
114
114
  debugLogger
115
115
  } from "./chunk-KCI46M23.mjs";
@@ -9811,7 +9811,7 @@ var MCPToolsTabV2_default = MCPToolsTabV2;
9811
9811
 
9812
9812
  // src/management/management.tsx
9813
9813
  import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
9814
- var preloadChatPage = () => import("./chat-YOT2RPWD.mjs");
9814
+ var preloadChatPage = () => import("./chat-Y3WOTIKI.mjs");
9815
9815
  var buildCapabilitiesUrl = (gatewayApiUrl) => {
9816
9816
  const trimmed = gatewayApiUrl.replace(/\/$/, "");
9817
9817
  if (trimmed.endsWith("/api")) {
@@ -11184,4 +11184,4 @@ export {
11184
11184
  useGatewayMemory,
11185
11185
  management_default
11186
11186
  };
11187
- //# sourceMappingURL=chunk-IJTDHBHP.mjs.map
11187
+ //# sourceMappingURL=chunk-LPSM62OE.mjs.map
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-ONQMRE2G.mjs";
4
4
  import {
5
5
  aiProviderInitService
6
- } from "./chunk-F7JXIW6T.mjs";
6
+ } from "./chunk-RRCCSN3N.mjs";
7
7
  import {
8
8
  useMCPToolsStore
9
- } from "./chunk-K2JGFKEB.mjs";
9
+ } from "./chunk-CVFFNX7H.mjs";
10
10
  import {
11
11
  FeatureFlagProvider,
12
12
  NotificationProvider,
@@ -19,7 +19,7 @@ import {
19
19
  useKnowledgeStore2,
20
20
  useMemoryStore,
21
21
  useProjectStore
22
- } from "./chunk-NLBZZP3B.mjs";
22
+ } from "./chunk-VLUXQE24.mjs";
23
23
  import {
24
24
  indexedDBService_default,
25
25
  useModelStore,
@@ -29,7 +29,7 @@ import {
29
29
  import {
30
30
  AUTH_TOKEN_CHANGED_EVENT,
31
31
  authenticationService
32
- } from "./chunk-43MLINPL.mjs";
32
+ } from "./chunk-GWQRTUKF.mjs";
33
33
  import {
34
34
  debugLogger
35
35
  } from "./chunk-KCI46M23.mjs";
@@ -191,4 +191,4 @@ export {
191
191
  ChatProvider,
192
192
  chat_provider_default
193
193
  };
194
- //# sourceMappingURL=chunk-PU74BI6Y.mjs.map
194
+ //# sourceMappingURL=chunk-QLATFSSO.mjs.map
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  authenticationService,
7
7
  useAIProviderStore
8
- } from "./chunk-43MLINPL.mjs";
8
+ } from "./chunk-GWQRTUKF.mjs";
9
9
  import {
10
10
  debugLogger
11
11
  } from "./chunk-KCI46M23.mjs";
@@ -285,4 +285,4 @@ var aiProviderInitService = AIProviderInitService.getInstance();
285
285
  export {
286
286
  aiProviderInitService
287
287
  };
288
- //# sourceMappingURL=chunk-F7JXIW6T.mjs.map
288
+ //# sourceMappingURL=chunk-RRCCSN3N.mjs.map
@@ -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
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,6 +31677,10 @@ 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",
31680
+ // Rounded card corner, positioned exactly where Claude's sits: at
31681
+ // the top of the webview, just below the OS status strip. The strip
31682
+ // itself is reserved by iOS in web-app mode — no web content can
31683
+ // draw there, so this IS the full available height.
31653
31684
  borderRadius: isMobile && mobileConversationsOpen ? "44px" : 0,
31654
31685
  zIndex: isMobile && mobileConversationsOpen ? theme.zIndex.modal + 1 : 0,
31655
31686
  // Hairline border so the rounded card reads even when the backdrop
@@ -31663,6 +31694,20 @@ var init_chat2 = __esm({
31663
31694
  setMobileConversationsOpen(false);
31664
31695
  }
31665
31696
  } : void 0,
31697
+ onTouchStart: isMobile && mobileConversationsOpen ? (e) => {
31698
+ if (e.currentTarget.contains(e.target)) {
31699
+ cardSwipeStartXRef.current = e.touches[0]?.clientX ?? null;
31700
+ }
31701
+ } : void 0,
31702
+ onTouchMove: isMobile && mobileConversationsOpen ? (e) => {
31703
+ const start = cardSwipeStartXRef.current;
31704
+ if (start === null) return;
31705
+ const dx = (e.touches[0]?.clientX ?? start) - start;
31706
+ if (Math.abs(dx) > 40) {
31707
+ cardSwipeStartXRef.current = null;
31708
+ setMobileConversationsOpen(false);
31709
+ }
31710
+ } : void 0,
31666
31711
  children: [
31667
31712
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
31668
31713
  chat_app_bar_default,
@@ -31960,12 +32005,12 @@ var init_chat2 = __esm({
31960
32005
  ossConfigured,
31961
32006
  isOSSMode: isOSSMode(),
31962
32007
  tier: featureFlag.getEvaluation()?.tier,
31963
- hasToken: authenticationService.isAuthenticated(),
32008
+ hasToken: authenticationService2.isAuthenticated(),
31964
32009
  playgroundBypassAuth,
31965
32010
  isPlaygroundRoute,
31966
32011
  bypassAuth
31967
32012
  });
31968
- if (!allowUnauthenticated && !bypassAuth && !authenticationService.isAuthenticated()) {
32013
+ if (!allowUnauthenticated && !bypassAuth && !authenticationService2.isAuthenticated()) {
31969
32014
  debugLogger.debug("User is not authenticated, redirecting to login");
31970
32015
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom4.Navigate, { to: "/login", replace: true });
31971
32016
  }
@@ -32001,7 +32046,7 @@ __export(index_exports, {
32001
32046
  VectorDatabaseService: () => VectorDatabaseService,
32002
32047
  VectorMigrationService: () => VectorMigrationService,
32003
32048
  VoiceService: () => VoiceService,
32004
- authenticationService: () => authenticationService,
32049
+ authenticationService: () => authenticationService2,
32005
32050
  debugLogger: () => debugLogger,
32006
32051
  defineCustomElement: () => defineCustomElement,
32007
32052
  featureFlagService: () => featureFlagService,
@@ -32148,7 +32193,7 @@ var AIProviderInitService = class _AIProviderInitService {
32148
32193
  type: "ollama" /* OLLAMA */,
32149
32194
  baseUrl: settings.ollamaUrl,
32150
32195
  tokenFactory: () => {
32151
- let token = authenticationService.getToken();
32196
+ let token = authenticationService2.getToken();
32152
32197
  if (!token) {
32153
32198
  token = localStorage.getItem("authToken");
32154
32199
  }
@@ -32189,7 +32234,7 @@ var AIProviderInitService = class _AIProviderInitService {
32189
32234
  type: "ollama" /* OLLAMA */,
32190
32235
  baseUrl: settings.ollamaUrl || "http://localhost:11434",
32191
32236
  tokenFactory: () => {
32192
- let token = authenticationService.getToken();
32237
+ let token = authenticationService2.getToken();
32193
32238
  if (!token) {
32194
32239
  token = localStorage.getItem("authToken");
32195
32240
  }
@@ -32220,7 +32265,7 @@ var AIProviderInitService = class _AIProviderInitService {
32220
32265
  type: "ollama" /* OLLAMA */,
32221
32266
  baseUrl: "http://localhost:11434",
32222
32267
  tokenFactory: () => {
32223
- let token = authenticationService.getToken();
32268
+ let token = authenticationService2.getToken();
32224
32269
  if (!token) {
32225
32270
  token = localStorage.getItem("authToken");
32226
32271
  }
@@ -32310,7 +32355,7 @@ var AIProviderInitService = class _AIProviderInitService {
32310
32355
  return config;
32311
32356
  }
32312
32357
  config.tokenFactory = () => {
32313
- let token = authenticationService.getToken();
32358
+ let token = authenticationService2.getToken();
32314
32359
  if (!token && typeof localStorage !== "undefined") {
32315
32360
  try {
32316
32361
  token = localStorage.getItem("authToken");
@@ -32367,11 +32412,11 @@ var ChatProvider = (props) => {
32367
32412
  } catch (error) {
32368
32413
  debugLogger.error("Failed to initialize AI provider:", { error });
32369
32414
  }
32370
- const token = authenticationService.getToken();
32371
- if (token && !authenticationService.isTokenExpired(token)) {
32372
- authenticationService.setToken(token);
32415
+ const token = authenticationService2.getToken();
32416
+ if (token && !authenticationService2.isTokenExpired(token)) {
32417
+ authenticationService2.setToken(token);
32373
32418
  } else {
32374
- authenticationService.clearToken();
32419
+ authenticationService2.clearToken();
32375
32420
  }
32376
32421
  useConversationStore.getState().hydrate();
32377
32422
  useProjectStore.getState().hydrate();
@@ -37302,7 +37347,7 @@ var useGatewayClient = () => {
37302
37347
  }
37303
37348
  return new GatewayService(
37304
37349
  gatewayUrl,
37305
- () => authenticationService.getToken(),
37350
+ () => authenticationService2.getToken(),
37306
37351
  feedbackEmail
37307
37352
  );
37308
37353
  }, [gatewayUrl, feedbackEmail]);
@@ -41181,7 +41226,7 @@ var buildHeaders2 = () => {
41181
41226
  const headers = {
41182
41227
  "Content-Type": "application/json"
41183
41228
  };
41184
- const token = authenticationService.getToken();
41229
+ const token = authenticationService2.getToken();
41185
41230
  if (token) {
41186
41231
  headers.Authorization = `Bearer ${token}`;
41187
41232
  }
@@ -44312,7 +44357,7 @@ function buildUrl3(path) {
44312
44357
  }
44313
44358
  function authHeaders2() {
44314
44359
  const headers = { "Content-Type": "application/json" };
44315
- const token = authenticationService.getToken();
44360
+ const token = authenticationService2.getToken();
44316
44361
  if (token) headers["Authorization"] = `Bearer ${token}`;
44317
44362
  return headers;
44318
44363
  }
@@ -45657,7 +45702,7 @@ var Management = () => {
45657
45702
  let isActive = true;
45658
45703
  const loadCapabilities = async () => {
45659
45704
  try {
45660
- const token = authToken ?? authenticationService.getToken();
45705
+ const token = authToken ?? authenticationService2.getToken();
45661
45706
  const headers = {
45662
45707
  "Content-Type": "application/json"
45663
45708
  };
@@ -45793,7 +45838,7 @@ var Management = () => {
45793
45838
  "admin",
45794
45839
  "platform_admin"
45795
45840
  ]);
45796
- const userRoles = (authenticationService.parseJwtClaims(authenticationService.getToken() ?? "")?.roles ?? []).map((r) => r.toLowerCase());
45841
+ const userRoles = (authenticationService2.parseJwtClaims(authenticationService2.getToken() ?? "")?.roles ?? []).map((r) => r.toLowerCase());
45797
45842
  const isWorkspaceAdmin = userRoles.some(
45798
45843
  (r) => platformAdminRoles.has(r) || r.endsWith("-admin")
45799
45844
  );
@@ -46612,7 +46657,7 @@ var useVoices = () => {
46612
46657
  const gatewayApiUrl = usePackageSettingsStore((state) => state.settings?.gatewayApiUrl);
46613
46658
  const { token } = useAuthenticationStore();
46614
46659
  (0, import_react68.useEffect)(() => {
46615
- const isAuthenticated = authenticationService.isAuthenticated();
46660
+ const isAuthenticated = authenticationService2.isAuthenticated();
46616
46661
  if (gatewayApiUrl && token && isAuthenticated && !isServiceAvailable) {
46617
46662
  debugLogger.debug("Gateway API URL and JWT token available, loading voice models...");
46618
46663
  loadVoicesFromAPI();