@burtson-labs/bandit-engine 2.0.98 → 2.0.100

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 (42) hide show
  1. package/dist/{aiProviderStore-337QNQB3.mjs → aiProviderStore-FTD277QP.mjs} +2 -2
  2. package/dist/chat-PMO3WTM4.mjs +16 -0
  3. package/dist/chat-provider.js +152 -111
  4. package/dist/chat-provider.js.map +1 -1
  5. package/dist/chat-provider.mjs +5 -5
  6. package/dist/{chunk-J2PMXOV2.mjs → chunk-37JLV5PU.mjs} +18 -143
  7. package/dist/chunk-37JLV5PU.mjs.map +1 -0
  8. package/dist/{chunk-H3BYFEIE.mjs → chunk-43MLINPL.mjs} +157 -7
  9. package/dist/chunk-43MLINPL.mjs.map +1 -0
  10. package/dist/{chunk-L2EKYO4F.mjs → chunk-BN3D45E2.mjs} +4 -4
  11. package/dist/{chunk-USTEWR7Z.mjs → chunk-GGSK5RVZ.mjs} +12 -12
  12. package/dist/{chunk-ZLXWNTFK.mjs → chunk-HAUDGBUS.mjs} +3 -5
  13. package/dist/{chunk-ZLXWNTFK.mjs.map → chunk-HAUDGBUS.mjs.map} +1 -1
  14. package/dist/{chunk-RUMVTVNM.mjs → chunk-KYC7CC6C.mjs} +2 -2
  15. package/dist/{chunk-JOY64M5C.mjs → chunk-R3HBSHLE.mjs} +144 -98
  16. package/dist/chunk-R3HBSHLE.mjs.map +1 -0
  17. package/dist/{chunk-AGT77Z3A.mjs → chunk-RN3AKXKI.mjs} +4 -4
  18. package/dist/{chunk-IVLVUNIB.mjs → chunk-VIKZPBVO.mjs} +5 -5
  19. package/dist/{chunk-OSSZ7Z2O.mjs → chunk-VTKRZNLI.mjs} +8 -6
  20. package/dist/{chunk-OSSZ7Z2O.mjs.map → chunk-VTKRZNLI.mjs.map} +1 -1
  21. package/dist/index.js +157 -87
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +13 -12
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/management/management.js +303 -233
  26. package/dist/management/management.js.map +1 -1
  27. package/dist/management/management.mjs +8 -8
  28. package/dist/modals/chat-modal/chat-modal.js +161 -121
  29. package/dist/modals/chat-modal/chat-modal.js.map +1 -1
  30. package/dist/modals/chat-modal/chat-modal.mjs +4 -4
  31. package/package.json +1 -1
  32. package/dist/chat-HYXGXPJM.mjs +0 -16
  33. package/dist/chunk-H3BYFEIE.mjs.map +0 -1
  34. package/dist/chunk-J2PMXOV2.mjs.map +0 -1
  35. package/dist/chunk-JOY64M5C.mjs.map +0 -1
  36. /package/dist/{aiProviderStore-337QNQB3.mjs.map → aiProviderStore-FTD277QP.mjs.map} +0 -0
  37. /package/dist/{chat-HYXGXPJM.mjs.map → chat-PMO3WTM4.mjs.map} +0 -0
  38. /package/dist/{chunk-L2EKYO4F.mjs.map → chunk-BN3D45E2.mjs.map} +0 -0
  39. /package/dist/{chunk-USTEWR7Z.mjs.map → chunk-GGSK5RVZ.mjs.map} +0 -0
  40. /package/dist/{chunk-RUMVTVNM.mjs.map → chunk-KYC7CC6C.mjs.map} +0 -0
  41. /package/dist/{chunk-AGT77Z3A.mjs.map → chunk-RN3AKXKI.mjs.map} +0 -0
  42. /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) => Promise.reject(this._normalizeAxiosError(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 import_zustand2, useAIProviderStore;
3682
+ var import_zustand3, useAIProviderStore;
3524
3683
  var init_aiProviderStore = __esm({
3525
3684
  "src/store/aiProviderStore.ts"() {
3526
3685
  "use strict";
3527
- import_zustand2 = require("zustand");
3686
+ import_zustand3 = require("zustand");
3528
3687
  init_ai_provider_factory();
3529
3688
  init_debugLogger();
3530
- useAIProviderStore = (0, import_zustand2.create)((set, get) => ({
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 import_zustand3, usePackageSettingsStore;
3717
+ var import_zustand4, usePackageSettingsStore;
3559
3718
  var init_packageSettingsStore = __esm({
3560
3719
  "src/store/packageSettingsStore.ts"() {
3561
3720
  "use strict";
3562
- import_zustand3 = require("zustand");
3563
- usePackageSettingsStore = (0, import_zustand3.create)((set, get) => ({
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 import_zustand4, DB_NAME, STORE_NAME, storeConfigs, normalize, useMemoryStore;
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
- import_zustand4 = require("zustand");
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, import_zustand4.create)((set, get) => ({
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(/\/$/, "");
@@ -20397,69 +20419,48 @@ var init_source_chips = __esm({
20397
20419
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material35.Box, { sx: { opacity: 0.75, fontSize: 11, wordBreak: "break-all", mt: 0.25 }, children: source.url })
20398
20420
  ] }),
20399
20421
  arrow: true,
20400
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
20422
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
20401
20423
  import_material35.Box,
20402
20424
  {
20403
20425
  component: "a",
20404
20426
  href: source.url,
20405
20427
  target: "_blank",
20406
20428
  rel: "noopener noreferrer",
20429
+ className: "source-chip",
20407
20430
  sx: {
20408
20431
  display: "inline-flex",
20409
20432
  alignItems: "center",
20433
+ justifyContent: "center",
20410
20434
  flexShrink: 0,
20411
- gap: 0.5,
20412
- height: 26,
20413
- px: 0.75,
20414
- borderRadius: 999,
20415
- border: "1px solid",
20416
- borderColor: "divider",
20417
- bgcolor: "background.paper",
20418
- textDecoration: "none",
20435
+ width: 28,
20436
+ height: 28,
20437
+ borderRadius: "50%",
20438
+ border: "2px solid",
20439
+ borderColor: "background.paper",
20440
+ bgcolor: "action.hover",
20419
20441
  color: "text.primary",
20420
- fontSize: 12.5,
20421
- lineHeight: 1.4,
20422
- transition: "border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease",
20423
- "&:hover": { borderColor: "primary.main", bgcolor: "action.hover", boxShadow: 1, zIndex: 2 }
20442
+ textDecoration: "none",
20443
+ // Hover lifts the chip via transform/z-index only — no layout reflow,
20444
+ // so the overlapping stack can never jitter the way the expand did.
20445
+ transition: "transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease",
20446
+ "&:hover": {
20447
+ transform: "translateY(-3px)",
20448
+ boxShadow: 3,
20449
+ borderColor: "primary.main",
20450
+ zIndex: 3
20451
+ }
20424
20452
  },
20425
- children: [
20426
- failed ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
20427
- import_material35.Box,
20428
- {
20429
- sx: {
20430
- width: 18,
20431
- height: 18,
20432
- borderRadius: "50%",
20433
- bgcolor: "primary.main",
20434
- color: "primary.contrastText",
20435
- display: "grid",
20436
- placeItems: "center",
20437
- fontSize: 9,
20438
- fontWeight: 700,
20439
- flexShrink: 0
20440
- },
20441
- children: domain.charAt(0).toUpperCase()
20442
- }
20443
- ) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
20444
- import_material35.Box,
20445
- {
20446
- component: "img",
20447
- src: `https://icons.duckduckgo.com/ip3/${domain}.ico`,
20448
- alt: "",
20449
- loading: "lazy",
20450
- onError: () => setFailed(true),
20451
- sx: { width: 18, height: 18, borderRadius: "50%", flexShrink: 0 }
20452
- }
20453
- ),
20454
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
20455
- import_material35.Box,
20456
- {
20457
- component: "span",
20458
- sx: { maxWidth: 150, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
20459
- children: label
20460
- }
20461
- )
20462
- ]
20453
+ children: failed ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material35.Box, { component: "span", sx: { fontSize: 11, fontWeight: 700, color: "primary.main" }, children: domain.charAt(0).toUpperCase() }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
20454
+ import_material35.Box,
20455
+ {
20456
+ component: "img",
20457
+ src: `https://icons.duckduckgo.com/ip3/${domain}.ico`,
20458
+ alt: "",
20459
+ loading: "lazy",
20460
+ onError: () => setFailed(true),
20461
+ sx: { width: 16, height: 16, borderRadius: "4px", flexShrink: 0 }
20462
+ }
20463
+ )
20463
20464
  }
20464
20465
  )
20465
20466
  }
@@ -20484,7 +20485,19 @@ var init_source_chips = __esm({
20484
20485
  children: "Sources"
20485
20486
  }
20486
20487
  ),
20487
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material35.Box, { sx: { display: "flex", flexWrap: "wrap", alignItems: "center", gap: 0.75 }, children: sources.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SourceChip, { source: s }, `${s.url}-${i}`)) })
20488
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
20489
+ import_material35.Box,
20490
+ {
20491
+ sx: {
20492
+ display: "flex",
20493
+ alignItems: "center",
20494
+ // Overlapping stack; each chip lifts on hover (no reflow → no jitter).
20495
+ "& .source-chip": { ml: "-9px" },
20496
+ "& .source-chip:first-of-type": { ml: 0 }
20497
+ },
20498
+ children: sources.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SourceChip, { source: s }, `${s.url}-${i}`))
20499
+ }
20500
+ )
20488
20501
  ] });
20489
20502
  };
20490
20503
  source_chips_default = SourceChips;
@@ -23936,6 +23949,15 @@ ${fn}(${argStr})
23936
23949
  \`\`\``;
23937
23950
  }
23938
23951
  }
23952
+ if (!/```(?:tool_code|TOOL_CODE)/.test(fullMessage)) {
23953
+ const plainToolFence = /```[a-zA-Z0-9_-]*[ \t]*\n([ \t]*(?:web_search|web_fetch|image_generation|create_file|ask_user)[\s\S]*?)\n```/;
23954
+ const fm = fullMessage.match(plainToolFence);
23955
+ if (fm) {
23956
+ fullMessage = fullMessage.replace(plainToolFence, `\`\`\`tool_code
23957
+ ${fm[1].trim()}
23958
+ \`\`\``);
23959
+ }
23960
+ }
23939
23961
  const toolCallMatches = fullMessage.match(/```(?:tool_code|TOOL_CODE)\s*\n([^`]+)\n```/gi);
23940
23962
  let enhancedMessage = fullMessage;
23941
23963
  const summarizableResults = [];
@@ -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.jsx)(
26912
- import_material44.Box,
26913
- {
26914
- sx: {
26915
- flexShrink: 0,
26916
- display: "flex",
26917
- alignItems: "center",
26918
- justifyContent: "center",
26919
- width: 30,
26920
- height: 30,
26921
- borderRadius: "50%",
26922
- border: `1px solid ${(0, import_material44.alpha)(theme.palette.divider, 0.8)}`,
26923
- color: theme.palette.text.secondary
26924
- },
26925
- children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react11.Settings, { size: 16 })
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.jsx)(
27884
- import_material45.Box,
27885
- {
27886
- sx: {
27887
- flexShrink: 0,
27888
- display: "flex",
27889
- alignItems: "center",
27890
- justifyContent: "center",
27891
- width: 30,
27892
- height: 30,
27893
- borderRadius: "50%",
27894
- border: `1px solid ${(0, import_styles29.alpha)(theme.palette.divider, 0.8)}`,
27895
- color: theme.palette.text.secondary
27896
- },
27897
- children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react12.Settings, { size: 16 })
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
  )