@burtson-labs/bandit-engine 2.0.99 → 2.0.101
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.
- package/dist/{aiProviderStore-337QNQB3.mjs → aiProviderStore-FTD277QP.mjs} +2 -2
- package/dist/chat-PMO3WTM4.mjs +16 -0
- package/dist/chat-provider.js +152 -111
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +5 -5
- package/dist/{chunk-J2PMXOV2.mjs → chunk-37JLV5PU.mjs} +18 -143
- package/dist/chunk-37JLV5PU.mjs.map +1 -0
- package/dist/{chunk-H3BYFEIE.mjs → chunk-43MLINPL.mjs} +157 -7
- package/dist/chunk-43MLINPL.mjs.map +1 -0
- package/dist/{chunk-L2EKYO4F.mjs → chunk-BN3D45E2.mjs} +4 -4
- package/dist/{chunk-ZLXWNTFK.mjs → chunk-HAUDGBUS.mjs} +3 -5
- package/dist/{chunk-ZLXWNTFK.mjs.map → chunk-HAUDGBUS.mjs.map} +1 -1
- package/dist/{chunk-I7WBZVTR.mjs → chunk-JTDQTYJR.mjs} +13 -13
- package/dist/chunk-JTDQTYJR.mjs.map +1 -0
- package/dist/{chunk-RUMVTVNM.mjs → chunk-KYC7CC6C.mjs} +2 -2
- package/dist/{chunk-C2SY64XM.mjs → chunk-R3HBSHLE.mjs} +92 -46
- package/dist/chunk-R3HBSHLE.mjs.map +1 -0
- package/dist/{chunk-AGT77Z3A.mjs → chunk-RN3AKXKI.mjs} +4 -4
- package/dist/{chunk-IVLVUNIB.mjs → chunk-VIKZPBVO.mjs} +5 -5
- package/dist/{chunk-OSSZ7Z2O.mjs → chunk-VTKRZNLI.mjs} +8 -6
- package/dist/{chunk-OSSZ7Z2O.mjs.map → chunk-VTKRZNLI.mjs.map} +1 -1
- package/dist/index.js +106 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -12
- package/dist/index.mjs.map +1 -1
- package/dist/management/management.js +252 -182
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +8 -8
- package/dist/modals/chat-modal/chat-modal.js +161 -121
- package/dist/modals/chat-modal/chat-modal.js.map +1 -1
- package/dist/modals/chat-modal/chat-modal.mjs +4 -4
- package/package.json +1 -1
- package/dist/chat-IOBCRT5Y.mjs +0 -16
- package/dist/chunk-C2SY64XM.mjs.map +0 -1
- package/dist/chunk-H3BYFEIE.mjs.map +0 -1
- package/dist/chunk-I7WBZVTR.mjs.map +0 -1
- package/dist/chunk-J2PMXOV2.mjs.map +0 -1
- /package/dist/{aiProviderStore-337QNQB3.mjs.map → aiProviderStore-FTD277QP.mjs.map} +0 -0
- /package/dist/{chat-IOBCRT5Y.mjs.map → chat-PMO3WTM4.mjs.map} +0 -0
- /package/dist/{chunk-L2EKYO4F.mjs.map → chunk-BN3D45E2.mjs.map} +0 -0
- /package/dist/{chunk-RUMVTVNM.mjs.map → chunk-KYC7CC6C.mjs.map} +0 -0
- /package/dist/{chunk-AGT77Z3A.mjs.map → chunk-RN3AKXKI.mjs.map} +0 -0
- /package/dist/{chunk-IVLVUNIB.mjs.map → chunk-VIKZPBVO.mjs.map} +0 -0
|
@@ -1505,6 +1505,143 @@ var init_anthropic_provider = __esm({
|
|
|
1505
1505
|
}
|
|
1506
1506
|
});
|
|
1507
1507
|
|
|
1508
|
+
// src/store/authenticationStore.ts
|
|
1509
|
+
var import_zustand2, TOKEN_KEY, validToken, user, rawToken, useAuthenticationStore, readPersistedToken;
|
|
1510
|
+
var init_authenticationStore = __esm({
|
|
1511
|
+
"src/store/authenticationStore.ts"() {
|
|
1512
|
+
"use strict";
|
|
1513
|
+
import_zustand2 = require("zustand");
|
|
1514
|
+
TOKEN_KEY = "authToken";
|
|
1515
|
+
validToken = null;
|
|
1516
|
+
user = null;
|
|
1517
|
+
rawToken = localStorage.getItem(TOKEN_KEY);
|
|
1518
|
+
if (rawToken) {
|
|
1519
|
+
try {
|
|
1520
|
+
const base64Url = rawToken.split(".")[1];
|
|
1521
|
+
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
1522
|
+
const jsonPayload = decodeURIComponent(
|
|
1523
|
+
atob(base64).split("").map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join("")
|
|
1524
|
+
);
|
|
1525
|
+
const decoded = JSON.parse(jsonPayload);
|
|
1526
|
+
if (decoded.exp * 1e3 > Date.now()) {
|
|
1527
|
+
validToken = rawToken;
|
|
1528
|
+
user = decoded;
|
|
1529
|
+
}
|
|
1530
|
+
} catch {
|
|
1531
|
+
validToken = null;
|
|
1532
|
+
user = null;
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
useAuthenticationStore = (0, import_zustand2.create)((set) => ({
|
|
1536
|
+
token: validToken,
|
|
1537
|
+
user,
|
|
1538
|
+
authError: null,
|
|
1539
|
+
setToken: (token) => {
|
|
1540
|
+
if (token) {
|
|
1541
|
+
try {
|
|
1542
|
+
const base64Url = token.split(".")[1];
|
|
1543
|
+
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
1544
|
+
const jsonPayload = decodeURIComponent(
|
|
1545
|
+
atob(base64).split("").map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join("")
|
|
1546
|
+
);
|
|
1547
|
+
const user2 = JSON.parse(jsonPayload);
|
|
1548
|
+
localStorage.setItem(TOKEN_KEY, token);
|
|
1549
|
+
set({ token, authError: null, user: user2 });
|
|
1550
|
+
} catch {
|
|
1551
|
+
set({ token: null, authError: "Invalid token", user: null });
|
|
1552
|
+
}
|
|
1553
|
+
} else {
|
|
1554
|
+
set({ token: null, authError: null, user: null });
|
|
1555
|
+
}
|
|
1556
|
+
},
|
|
1557
|
+
clearToken: () => {
|
|
1558
|
+
localStorage.removeItem(TOKEN_KEY);
|
|
1559
|
+
set({ token: null, authError: null, user: null });
|
|
1560
|
+
}
|
|
1561
|
+
}));
|
|
1562
|
+
readPersistedToken = () => {
|
|
1563
|
+
try {
|
|
1564
|
+
const raw = localStorage.getItem(TOKEN_KEY);
|
|
1565
|
+
if (!raw) return null;
|
|
1566
|
+
const base64 = raw.split(".")[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
1567
|
+
const json2 = decodeURIComponent(
|
|
1568
|
+
atob(base64).split("").map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join("")
|
|
1569
|
+
);
|
|
1570
|
+
const decoded = JSON.parse(json2);
|
|
1571
|
+
return decoded.exp * 1e3 > Date.now() ? raw : null;
|
|
1572
|
+
} catch {
|
|
1573
|
+
return null;
|
|
1574
|
+
}
|
|
1575
|
+
};
|
|
1576
|
+
}
|
|
1577
|
+
});
|
|
1578
|
+
|
|
1579
|
+
// src/services/auth/authenticationService.ts
|
|
1580
|
+
function emitAuthTokenChanged(token) {
|
|
1581
|
+
if (typeof window === "undefined") {
|
|
1582
|
+
return;
|
|
1583
|
+
}
|
|
1584
|
+
window.dispatchEvent(new CustomEvent(AUTH_TOKEN_CHANGED_EVENT, {
|
|
1585
|
+
detail: { token }
|
|
1586
|
+
}));
|
|
1587
|
+
}
|
|
1588
|
+
var TOKEN_KEY2, AUTH_TOKEN_CHANGED_EVENT, AuthenticationService, authenticationService;
|
|
1589
|
+
var init_authenticationService = __esm({
|
|
1590
|
+
"src/services/auth/authenticationService.ts"() {
|
|
1591
|
+
"use strict";
|
|
1592
|
+
init_authenticationStore();
|
|
1593
|
+
init_debugLogger();
|
|
1594
|
+
TOKEN_KEY2 = "authToken";
|
|
1595
|
+
AUTH_TOKEN_CHANGED_EVENT = "bandit:auth-token-changed";
|
|
1596
|
+
AuthenticationService = class {
|
|
1597
|
+
getToken() {
|
|
1598
|
+
const token = localStorage.getItem(TOKEN_KEY2);
|
|
1599
|
+
return token;
|
|
1600
|
+
}
|
|
1601
|
+
setToken(token) {
|
|
1602
|
+
localStorage.setItem(TOKEN_KEY2, token);
|
|
1603
|
+
useAuthenticationStore.getState().setToken(token);
|
|
1604
|
+
emitAuthTokenChanged(token);
|
|
1605
|
+
}
|
|
1606
|
+
clearToken() {
|
|
1607
|
+
localStorage.removeItem(TOKEN_KEY2);
|
|
1608
|
+
useAuthenticationStore.getState().clearToken();
|
|
1609
|
+
emitAuthTokenChanged(null);
|
|
1610
|
+
}
|
|
1611
|
+
isAuthenticated() {
|
|
1612
|
+
const token = useAuthenticationStore.getState().token;
|
|
1613
|
+
return !!token && !this.isTokenExpired(token);
|
|
1614
|
+
}
|
|
1615
|
+
isTokenExpired(token) {
|
|
1616
|
+
try {
|
|
1617
|
+
if (!token) return true;
|
|
1618
|
+
const decoded = this.parseJwtClaims(token);
|
|
1619
|
+
if (!decoded) return true;
|
|
1620
|
+
return decoded.exp * 1e3 < Date.now();
|
|
1621
|
+
} catch {
|
|
1622
|
+
return true;
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
parseJwtClaims(token) {
|
|
1626
|
+
try {
|
|
1627
|
+
const base64Url = token.split(".")[1];
|
|
1628
|
+
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
1629
|
+
const jsonPayload = decodeURIComponent(
|
|
1630
|
+
atob(base64).split("").map((c) => {
|
|
1631
|
+
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
|
|
1632
|
+
}).join("")
|
|
1633
|
+
);
|
|
1634
|
+
return JSON.parse(jsonPayload);
|
|
1635
|
+
} catch (error) {
|
|
1636
|
+
debugLogger.error("Failed to parse JWT claims:", { error });
|
|
1637
|
+
return null;
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
};
|
|
1641
|
+
authenticationService = new AuthenticationService();
|
|
1642
|
+
}
|
|
1643
|
+
});
|
|
1644
|
+
|
|
1508
1645
|
// src/services/gateway/gateway.service.ts
|
|
1509
1646
|
var import_axios, import_rxjs6, GatewayService;
|
|
1510
1647
|
var init_gateway_service = __esm({
|
|
@@ -1513,6 +1650,7 @@ var init_gateway_service = __esm({
|
|
|
1513
1650
|
import_axios = __toESM(require("axios"));
|
|
1514
1651
|
import_rxjs6 = require("rxjs");
|
|
1515
1652
|
init_debugLogger();
|
|
1653
|
+
init_authenticationService();
|
|
1516
1654
|
GatewayService = class {
|
|
1517
1655
|
constructor(_baseUrl, _tokenFactory, _feedbackEmail) {
|
|
1518
1656
|
this._baseUrl = _baseUrl;
|
|
@@ -1553,7 +1691,10 @@ var init_gateway_service = __esm({
|
|
|
1553
1691
|
});
|
|
1554
1692
|
instance.interceptors.response.use(
|
|
1555
1693
|
(response) => response,
|
|
1556
|
-
(error) =>
|
|
1694
|
+
(error) => {
|
|
1695
|
+
this._handleAuthFailure(error);
|
|
1696
|
+
return Promise.reject(this._normalizeAxiosError(error));
|
|
1697
|
+
}
|
|
1557
1698
|
);
|
|
1558
1699
|
return instance;
|
|
1559
1700
|
}
|
|
@@ -1574,6 +1715,24 @@ var init_gateway_service = __esm({
|
|
|
1574
1715
|
}
|
|
1575
1716
|
return new Error(error.message);
|
|
1576
1717
|
}
|
|
1718
|
+
_handleAuthFailure(error) {
|
|
1719
|
+
const status = error.response?.status;
|
|
1720
|
+
if (status !== 401 && status !== 403) {
|
|
1721
|
+
return;
|
|
1722
|
+
}
|
|
1723
|
+
const data = error.response?.data;
|
|
1724
|
+
const code = data?.code;
|
|
1725
|
+
if (code !== "FORCE_RELOGIN" && code !== "ACCOUNT_LOCKED") {
|
|
1726
|
+
return;
|
|
1727
|
+
}
|
|
1728
|
+
try {
|
|
1729
|
+
authenticationService.clearToken();
|
|
1730
|
+
} catch {
|
|
1731
|
+
}
|
|
1732
|
+
if (typeof window !== "undefined" && typeof window.dispatchEvent === "function") {
|
|
1733
|
+
window.dispatchEvent(new CustomEvent("auth:force-relogin", { detail: { code } }));
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1577
1736
|
_createHttpError(message, response) {
|
|
1578
1737
|
return Object.assign(new Error(message), { response });
|
|
1579
1738
|
}
|
|
@@ -3520,14 +3679,14 @@ var aiProviderStore_exports = {};
|
|
|
3520
3679
|
__export(aiProviderStore_exports, {
|
|
3521
3680
|
useAIProviderStore: () => useAIProviderStore
|
|
3522
3681
|
});
|
|
3523
|
-
var
|
|
3682
|
+
var import_zustand3, useAIProviderStore;
|
|
3524
3683
|
var init_aiProviderStore = __esm({
|
|
3525
3684
|
"src/store/aiProviderStore.ts"() {
|
|
3526
3685
|
"use strict";
|
|
3527
|
-
|
|
3686
|
+
import_zustand3 = require("zustand");
|
|
3528
3687
|
init_ai_provider_factory();
|
|
3529
3688
|
init_debugLogger();
|
|
3530
|
-
useAIProviderStore = (0,
|
|
3689
|
+
useAIProviderStore = (0, import_zustand3.create)((set, get) => ({
|
|
3531
3690
|
provider: null,
|
|
3532
3691
|
config: null,
|
|
3533
3692
|
setProvider: (provider, config) => set({ provider, config }),
|
|
@@ -3555,12 +3714,12 @@ var init_aiProviderStore = __esm({
|
|
|
3555
3714
|
});
|
|
3556
3715
|
|
|
3557
3716
|
// src/store/packageSettingsStore.ts
|
|
3558
|
-
var
|
|
3717
|
+
var import_zustand4, usePackageSettingsStore;
|
|
3559
3718
|
var init_packageSettingsStore = __esm({
|
|
3560
3719
|
"src/store/packageSettingsStore.ts"() {
|
|
3561
3720
|
"use strict";
|
|
3562
|
-
|
|
3563
|
-
usePackageSettingsStore = (0,
|
|
3721
|
+
import_zustand4 = require("zustand");
|
|
3722
|
+
usePackageSettingsStore = (0, import_zustand4.create)((set, get) => ({
|
|
3564
3723
|
settings: null,
|
|
3565
3724
|
setSettings: (settings) => set({ settings }),
|
|
3566
3725
|
getSettings: () => get().settings,
|
|
@@ -4232,17 +4391,17 @@ var init_prompts = __esm({
|
|
|
4232
4391
|
});
|
|
4233
4392
|
|
|
4234
4393
|
// src/store/memoryStore.ts
|
|
4235
|
-
var
|
|
4394
|
+
var import_zustand5, DB_NAME, STORE_NAME, storeConfigs, normalize, useMemoryStore;
|
|
4236
4395
|
var init_memoryStore = __esm({
|
|
4237
4396
|
"src/store/memoryStore.ts"() {
|
|
4238
4397
|
"use strict";
|
|
4239
|
-
|
|
4398
|
+
import_zustand5 = require("zustand");
|
|
4240
4399
|
init_indexedDBService();
|
|
4241
4400
|
DB_NAME = "bandit-memory-db";
|
|
4242
4401
|
STORE_NAME = "bandit-memory";
|
|
4243
4402
|
storeConfigs = [{ name: STORE_NAME, keyPath: "id" }];
|
|
4244
4403
|
normalize = (text) => text.toLowerCase().replace(/[^\w\s]|_/g, "").replace(/\s+/g, " ").trim();
|
|
4245
|
-
useMemoryStore = (0,
|
|
4404
|
+
useMemoryStore = (0, import_zustand5.create)((set, get) => ({
|
|
4246
4405
|
entries: [],
|
|
4247
4406
|
_hasHydrated: false,
|
|
4248
4407
|
hydrate: async () => {
|
|
@@ -6221,77 +6380,6 @@ var init_vectorMigrationService = __esm({
|
|
|
6221
6380
|
}
|
|
6222
6381
|
});
|
|
6223
6382
|
|
|
6224
|
-
// src/store/authenticationStore.ts
|
|
6225
|
-
var import_zustand5, TOKEN_KEY, validToken, user, rawToken, useAuthenticationStore, readPersistedToken;
|
|
6226
|
-
var init_authenticationStore = __esm({
|
|
6227
|
-
"src/store/authenticationStore.ts"() {
|
|
6228
|
-
"use strict";
|
|
6229
|
-
import_zustand5 = require("zustand");
|
|
6230
|
-
TOKEN_KEY = "authToken";
|
|
6231
|
-
validToken = null;
|
|
6232
|
-
user = null;
|
|
6233
|
-
rawToken = localStorage.getItem(TOKEN_KEY);
|
|
6234
|
-
if (rawToken) {
|
|
6235
|
-
try {
|
|
6236
|
-
const base64Url = rawToken.split(".")[1];
|
|
6237
|
-
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
6238
|
-
const jsonPayload = decodeURIComponent(
|
|
6239
|
-
atob(base64).split("").map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join("")
|
|
6240
|
-
);
|
|
6241
|
-
const decoded = JSON.parse(jsonPayload);
|
|
6242
|
-
if (decoded.exp * 1e3 > Date.now()) {
|
|
6243
|
-
validToken = rawToken;
|
|
6244
|
-
user = decoded;
|
|
6245
|
-
}
|
|
6246
|
-
} catch {
|
|
6247
|
-
validToken = null;
|
|
6248
|
-
user = null;
|
|
6249
|
-
}
|
|
6250
|
-
}
|
|
6251
|
-
useAuthenticationStore = (0, import_zustand5.create)((set) => ({
|
|
6252
|
-
token: validToken,
|
|
6253
|
-
user,
|
|
6254
|
-
authError: null,
|
|
6255
|
-
setToken: (token) => {
|
|
6256
|
-
if (token) {
|
|
6257
|
-
try {
|
|
6258
|
-
const base64Url = token.split(".")[1];
|
|
6259
|
-
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
6260
|
-
const jsonPayload = decodeURIComponent(
|
|
6261
|
-
atob(base64).split("").map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join("")
|
|
6262
|
-
);
|
|
6263
|
-
const user2 = JSON.parse(jsonPayload);
|
|
6264
|
-
localStorage.setItem(TOKEN_KEY, token);
|
|
6265
|
-
set({ token, authError: null, user: user2 });
|
|
6266
|
-
} catch {
|
|
6267
|
-
set({ token: null, authError: "Invalid token", user: null });
|
|
6268
|
-
}
|
|
6269
|
-
} else {
|
|
6270
|
-
set({ token: null, authError: null, user: null });
|
|
6271
|
-
}
|
|
6272
|
-
},
|
|
6273
|
-
clearToken: () => {
|
|
6274
|
-
localStorage.removeItem(TOKEN_KEY);
|
|
6275
|
-
set({ token: null, authError: null, user: null });
|
|
6276
|
-
}
|
|
6277
|
-
}));
|
|
6278
|
-
readPersistedToken = () => {
|
|
6279
|
-
try {
|
|
6280
|
-
const raw = localStorage.getItem(TOKEN_KEY);
|
|
6281
|
-
if (!raw) return null;
|
|
6282
|
-
const base64 = raw.split(".")[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
6283
|
-
const json2 = decodeURIComponent(
|
|
6284
|
-
atob(base64).split("").map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join("")
|
|
6285
|
-
);
|
|
6286
|
-
const decoded = JSON.parse(json2);
|
|
6287
|
-
return decoded.exp * 1e3 > Date.now() ? raw : null;
|
|
6288
|
-
} catch {
|
|
6289
|
-
return null;
|
|
6290
|
-
}
|
|
6291
|
-
};
|
|
6292
|
-
}
|
|
6293
|
-
});
|
|
6294
|
-
|
|
6295
6383
|
// src/types/featureFlags.ts
|
|
6296
6384
|
var init_featureFlags = __esm({
|
|
6297
6385
|
"src/types/featureFlags.ts"() {
|
|
@@ -8009,72 +8097,6 @@ var init_projectStore = __esm({
|
|
|
8009
8097
|
}
|
|
8010
8098
|
});
|
|
8011
8099
|
|
|
8012
|
-
// src/services/auth/authenticationService.ts
|
|
8013
|
-
function emitAuthTokenChanged(token) {
|
|
8014
|
-
if (typeof window === "undefined") {
|
|
8015
|
-
return;
|
|
8016
|
-
}
|
|
8017
|
-
window.dispatchEvent(new CustomEvent(AUTH_TOKEN_CHANGED_EVENT, {
|
|
8018
|
-
detail: { token }
|
|
8019
|
-
}));
|
|
8020
|
-
}
|
|
8021
|
-
var TOKEN_KEY2, AUTH_TOKEN_CHANGED_EVENT, AuthenticationService, authenticationService;
|
|
8022
|
-
var init_authenticationService = __esm({
|
|
8023
|
-
"src/services/auth/authenticationService.ts"() {
|
|
8024
|
-
"use strict";
|
|
8025
|
-
init_authenticationStore();
|
|
8026
|
-
init_debugLogger();
|
|
8027
|
-
TOKEN_KEY2 = "authToken";
|
|
8028
|
-
AUTH_TOKEN_CHANGED_EVENT = "bandit:auth-token-changed";
|
|
8029
|
-
AuthenticationService = class {
|
|
8030
|
-
getToken() {
|
|
8031
|
-
const token = localStorage.getItem(TOKEN_KEY2);
|
|
8032
|
-
return token;
|
|
8033
|
-
}
|
|
8034
|
-
setToken(token) {
|
|
8035
|
-
localStorage.setItem(TOKEN_KEY2, token);
|
|
8036
|
-
useAuthenticationStore.getState().setToken(token);
|
|
8037
|
-
emitAuthTokenChanged(token);
|
|
8038
|
-
}
|
|
8039
|
-
clearToken() {
|
|
8040
|
-
localStorage.removeItem(TOKEN_KEY2);
|
|
8041
|
-
useAuthenticationStore.getState().clearToken();
|
|
8042
|
-
emitAuthTokenChanged(null);
|
|
8043
|
-
}
|
|
8044
|
-
isAuthenticated() {
|
|
8045
|
-
const token = useAuthenticationStore.getState().token;
|
|
8046
|
-
return !!token && !this.isTokenExpired(token);
|
|
8047
|
-
}
|
|
8048
|
-
isTokenExpired(token) {
|
|
8049
|
-
try {
|
|
8050
|
-
if (!token) return true;
|
|
8051
|
-
const decoded = this.parseJwtClaims(token);
|
|
8052
|
-
if (!decoded) return true;
|
|
8053
|
-
return decoded.exp * 1e3 < Date.now();
|
|
8054
|
-
} catch {
|
|
8055
|
-
return true;
|
|
8056
|
-
}
|
|
8057
|
-
}
|
|
8058
|
-
parseJwtClaims(token) {
|
|
8059
|
-
try {
|
|
8060
|
-
const base64Url = token.split(".")[1];
|
|
8061
|
-
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
8062
|
-
const jsonPayload = decodeURIComponent(
|
|
8063
|
-
atob(base64).split("").map((c) => {
|
|
8064
|
-
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
|
|
8065
|
-
}).join("")
|
|
8066
|
-
);
|
|
8067
|
-
return JSON.parse(jsonPayload);
|
|
8068
|
-
} catch (error) {
|
|
8069
|
-
debugLogger.error("Failed to parse JWT claims:", { error });
|
|
8070
|
-
return null;
|
|
8071
|
-
}
|
|
8072
|
-
}
|
|
8073
|
-
};
|
|
8074
|
-
authenticationService = new AuthenticationService();
|
|
8075
|
-
}
|
|
8076
|
-
});
|
|
8077
|
-
|
|
8078
8100
|
// src/services/conversationSync/conversationSyncService.ts
|
|
8079
8101
|
function buildUrl(path) {
|
|
8080
8102
|
const base = usePackageSettingsStore.getState().settings?.gatewayApiUrl?.replace(/\/$/, "");
|
|
@@ -26174,6 +26196,7 @@ var init_conversation_drawer = __esm({
|
|
|
26174
26196
|
init_authenticationStore();
|
|
26175
26197
|
init_packageSettingsStore();
|
|
26176
26198
|
init_brandingService();
|
|
26199
|
+
init_authenticationService();
|
|
26177
26200
|
init_project_management_modal();
|
|
26178
26201
|
init_memory_modal();
|
|
26179
26202
|
init_move_conversation_modal();
|
|
@@ -26908,23 +26931,46 @@ var init_conversation_drawer = __esm({
|
|
|
26908
26931
|
]
|
|
26909
26932
|
}
|
|
26910
26933
|
),
|
|
26911
|
-
user2 && /* @__PURE__ */ (0, import_jsx_runtime44.
|
|
26912
|
-
|
|
26913
|
-
|
|
26914
|
-
|
|
26915
|
-
|
|
26916
|
-
|
|
26917
|
-
|
|
26918
|
-
|
|
26919
|
-
|
|
26920
|
-
|
|
26921
|
-
|
|
26922
|
-
|
|
26923
|
-
|
|
26924
|
-
|
|
26925
|
-
|
|
26926
|
-
|
|
26927
|
-
|
|
26934
|
+
user2 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
26935
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
26936
|
+
import_material44.Box,
|
|
26937
|
+
{
|
|
26938
|
+
sx: {
|
|
26939
|
+
flexShrink: 0,
|
|
26940
|
+
display: "flex",
|
|
26941
|
+
alignItems: "center",
|
|
26942
|
+
justifyContent: "center",
|
|
26943
|
+
width: 30,
|
|
26944
|
+
height: 30,
|
|
26945
|
+
borderRadius: "50%",
|
|
26946
|
+
border: `1px solid ${(0, import_material44.alpha)(theme.palette.divider, 0.8)}`,
|
|
26947
|
+
color: theme.palette.text.secondary
|
|
26948
|
+
},
|
|
26949
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react11.Settings, { size: 16 })
|
|
26950
|
+
}
|
|
26951
|
+
),
|
|
26952
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
26953
|
+
import_material44.IconButton,
|
|
26954
|
+
{
|
|
26955
|
+
"aria-label": "Sign out",
|
|
26956
|
+
title: "Sign out",
|
|
26957
|
+
onClick: (event) => {
|
|
26958
|
+
event.stopPropagation();
|
|
26959
|
+
authenticationService.clearToken();
|
|
26960
|
+
window.location.href = "/login";
|
|
26961
|
+
},
|
|
26962
|
+
sx: {
|
|
26963
|
+
flexShrink: 0,
|
|
26964
|
+
width: 30,
|
|
26965
|
+
height: 30,
|
|
26966
|
+
border: `1px solid ${(0, import_material44.alpha)(theme.palette.error.main, 0.4)}`,
|
|
26967
|
+
color: theme.palette.error.main,
|
|
26968
|
+
"&:hover": { bgcolor: (0, import_material44.alpha)(theme.palette.error.main, 0.1) }
|
|
26969
|
+
},
|
|
26970
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react11.LogOut, { size: 16 })
|
|
26971
|
+
}
|
|
26972
|
+
)
|
|
26973
|
+
] })
|
|
26928
26974
|
]
|
|
26929
26975
|
}
|
|
26930
26976
|
)
|
|
@@ -27024,6 +27070,7 @@ var init_enhanced_mobile_conversations_modal = __esm({
|
|
|
27024
27070
|
init_packageSettingsStore();
|
|
27025
27071
|
init_memory_modal();
|
|
27026
27072
|
init_brandingService();
|
|
27073
|
+
init_authenticationService();
|
|
27027
27074
|
init_project_management_modal();
|
|
27028
27075
|
init_move_conversation_modal();
|
|
27029
27076
|
init_simple_conversation_item();
|
|
@@ -27880,23 +27927,46 @@ var init_enhanced_mobile_conversations_modal = __esm({
|
|
|
27880
27927
|
}
|
|
27881
27928
|
)
|
|
27882
27929
|
] }),
|
|
27883
|
-
user2 && /* @__PURE__ */ (0, import_jsx_runtime45.
|
|
27884
|
-
|
|
27885
|
-
|
|
27886
|
-
|
|
27887
|
-
|
|
27888
|
-
|
|
27889
|
-
|
|
27890
|
-
|
|
27891
|
-
|
|
27892
|
-
|
|
27893
|
-
|
|
27894
|
-
|
|
27895
|
-
|
|
27896
|
-
|
|
27897
|
-
|
|
27898
|
-
|
|
27899
|
-
|
|
27930
|
+
user2 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
|
|
27931
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
27932
|
+
import_material45.Box,
|
|
27933
|
+
{
|
|
27934
|
+
sx: {
|
|
27935
|
+
flexShrink: 0,
|
|
27936
|
+
display: "flex",
|
|
27937
|
+
alignItems: "center",
|
|
27938
|
+
justifyContent: "center",
|
|
27939
|
+
width: 30,
|
|
27940
|
+
height: 30,
|
|
27941
|
+
borderRadius: "50%",
|
|
27942
|
+
border: `1px solid ${(0, import_styles29.alpha)(theme.palette.divider, 0.8)}`,
|
|
27943
|
+
color: theme.palette.text.secondary
|
|
27944
|
+
},
|
|
27945
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react12.Settings, { size: 16 })
|
|
27946
|
+
}
|
|
27947
|
+
),
|
|
27948
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
27949
|
+
import_material45.IconButton,
|
|
27950
|
+
{
|
|
27951
|
+
"aria-label": "Sign out",
|
|
27952
|
+
title: "Sign out",
|
|
27953
|
+
onClick: (event) => {
|
|
27954
|
+
event.stopPropagation();
|
|
27955
|
+
authenticationService.clearToken();
|
|
27956
|
+
window.location.href = "/login";
|
|
27957
|
+
},
|
|
27958
|
+
sx: {
|
|
27959
|
+
flexShrink: 0,
|
|
27960
|
+
width: 30,
|
|
27961
|
+
height: 30,
|
|
27962
|
+
border: `1px solid ${(0, import_styles29.alpha)(theme.palette.error.main, 0.4)}`,
|
|
27963
|
+
color: theme.palette.error.main,
|
|
27964
|
+
"&:hover": { bgcolor: (0, import_styles29.alpha)(theme.palette.error.main, 0.1) }
|
|
27965
|
+
},
|
|
27966
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react12.LogOut, { size: 16 })
|
|
27967
|
+
}
|
|
27968
|
+
)
|
|
27969
|
+
] })
|
|
27900
27970
|
]
|
|
27901
27971
|
}
|
|
27902
27972
|
)
|
|
@@ -35938,7 +36008,7 @@ var PreferencesTab = ({
|
|
|
35938
36008
|
{
|
|
35939
36009
|
variant: "h5",
|
|
35940
36010
|
color: "text.primary",
|
|
35941
|
-
sx: { mb: 1, fontWeight: 600, fontSize: { xs: "1.
|
|
36011
|
+
sx: { mb: 1, fontWeight: 600, fontSize: { xs: "1.3rem", md: "1.45rem" } },
|
|
35942
36012
|
children: "Preferences"
|
|
35943
36013
|
}
|
|
35944
36014
|
),
|