@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
package/dist/chat-provider.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ChatProvider,
|
|
3
3
|
chat_provider_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VTKRZNLI.mjs";
|
|
5
5
|
import "./chunk-ONQMRE2G.mjs";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-HAUDGBUS.mjs";
|
|
7
|
+
import "./chunk-BN3D45E2.mjs";
|
|
8
|
+
import "./chunk-37JLV5PU.mjs";
|
|
9
9
|
import "./chunk-LWHSOEPR.mjs";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-43MLINPL.mjs";
|
|
11
11
|
import "./chunk-KCI46M23.mjs";
|
|
12
12
|
import "./chunk-BJTO5JO5.mjs";
|
|
13
13
|
export {
|
|
@@ -4,137 +4,16 @@ import {
|
|
|
4
4
|
usePackageSettingsStore
|
|
5
5
|
} from "./chunk-LWHSOEPR.mjs";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
authenticationService,
|
|
8
|
+
useAIProviderStore,
|
|
9
|
+
useAuthenticationStore
|
|
10
|
+
} from "./chunk-43MLINPL.mjs";
|
|
9
11
|
import {
|
|
10
12
|
debugLogger
|
|
11
13
|
} from "./chunk-KCI46M23.mjs";
|
|
12
14
|
|
|
13
|
-
// src/store/authenticationStore.ts
|
|
14
|
-
import { create } from "zustand";
|
|
15
|
-
var TOKEN_KEY = "authToken";
|
|
16
|
-
var validToken = null;
|
|
17
|
-
var user = null;
|
|
18
|
-
var rawToken = localStorage.getItem(TOKEN_KEY);
|
|
19
|
-
if (rawToken) {
|
|
20
|
-
try {
|
|
21
|
-
const base64Url = rawToken.split(".")[1];
|
|
22
|
-
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
23
|
-
const jsonPayload = decodeURIComponent(
|
|
24
|
-
atob(base64).split("").map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join("")
|
|
25
|
-
);
|
|
26
|
-
const decoded = JSON.parse(jsonPayload);
|
|
27
|
-
if (decoded.exp * 1e3 > Date.now()) {
|
|
28
|
-
validToken = rawToken;
|
|
29
|
-
user = decoded;
|
|
30
|
-
}
|
|
31
|
-
} catch {
|
|
32
|
-
validToken = null;
|
|
33
|
-
user = null;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
var useAuthenticationStore = create((set) => ({
|
|
37
|
-
token: validToken,
|
|
38
|
-
user,
|
|
39
|
-
authError: null,
|
|
40
|
-
setToken: (token) => {
|
|
41
|
-
if (token) {
|
|
42
|
-
try {
|
|
43
|
-
const base64Url = token.split(".")[1];
|
|
44
|
-
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
45
|
-
const jsonPayload = decodeURIComponent(
|
|
46
|
-
atob(base64).split("").map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join("")
|
|
47
|
-
);
|
|
48
|
-
const user2 = JSON.parse(jsonPayload);
|
|
49
|
-
localStorage.setItem(TOKEN_KEY, token);
|
|
50
|
-
set({ token, authError: null, user: user2 });
|
|
51
|
-
} catch {
|
|
52
|
-
set({ token: null, authError: "Invalid token", user: null });
|
|
53
|
-
}
|
|
54
|
-
} else {
|
|
55
|
-
set({ token: null, authError: null, user: null });
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
clearToken: () => {
|
|
59
|
-
localStorage.removeItem(TOKEN_KEY);
|
|
60
|
-
set({ token: null, authError: null, user: null });
|
|
61
|
-
}
|
|
62
|
-
}));
|
|
63
|
-
var readPersistedToken = () => {
|
|
64
|
-
try {
|
|
65
|
-
const raw = localStorage.getItem(TOKEN_KEY);
|
|
66
|
-
if (!raw) return null;
|
|
67
|
-
const base64 = raw.split(".")[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
68
|
-
const json = decodeURIComponent(
|
|
69
|
-
atob(base64).split("").map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join("")
|
|
70
|
-
);
|
|
71
|
-
const decoded = JSON.parse(json);
|
|
72
|
-
return decoded.exp * 1e3 > Date.now() ? raw : null;
|
|
73
|
-
} catch {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
// src/services/auth/authenticationService.ts
|
|
79
|
-
var TOKEN_KEY2 = "authToken";
|
|
80
|
-
var AUTH_TOKEN_CHANGED_EVENT = "bandit:auth-token-changed";
|
|
81
|
-
function emitAuthTokenChanged(token) {
|
|
82
|
-
if (typeof window === "undefined") {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
window.dispatchEvent(new CustomEvent(AUTH_TOKEN_CHANGED_EVENT, {
|
|
86
|
-
detail: { token }
|
|
87
|
-
}));
|
|
88
|
-
}
|
|
89
|
-
var AuthenticationService = class {
|
|
90
|
-
getToken() {
|
|
91
|
-
const token = localStorage.getItem(TOKEN_KEY2);
|
|
92
|
-
return token;
|
|
93
|
-
}
|
|
94
|
-
setToken(token) {
|
|
95
|
-
localStorage.setItem(TOKEN_KEY2, token);
|
|
96
|
-
useAuthenticationStore.getState().setToken(token);
|
|
97
|
-
emitAuthTokenChanged(token);
|
|
98
|
-
}
|
|
99
|
-
clearToken() {
|
|
100
|
-
localStorage.removeItem(TOKEN_KEY2);
|
|
101
|
-
useAuthenticationStore.getState().clearToken();
|
|
102
|
-
emitAuthTokenChanged(null);
|
|
103
|
-
}
|
|
104
|
-
isAuthenticated() {
|
|
105
|
-
const token = useAuthenticationStore.getState().token;
|
|
106
|
-
return !!token && !this.isTokenExpired(token);
|
|
107
|
-
}
|
|
108
|
-
isTokenExpired(token) {
|
|
109
|
-
try {
|
|
110
|
-
if (!token) return true;
|
|
111
|
-
const decoded = this.parseJwtClaims(token);
|
|
112
|
-
if (!decoded) return true;
|
|
113
|
-
return decoded.exp * 1e3 < Date.now();
|
|
114
|
-
} catch {
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
parseJwtClaims(token) {
|
|
119
|
-
try {
|
|
120
|
-
const base64Url = token.split(".")[1];
|
|
121
|
-
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
122
|
-
const jsonPayload = decodeURIComponent(
|
|
123
|
-
atob(base64).split("").map((c) => {
|
|
124
|
-
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
|
|
125
|
-
}).join("")
|
|
126
|
-
);
|
|
127
|
-
return JSON.parse(jsonPayload);
|
|
128
|
-
} catch (error) {
|
|
129
|
-
debugLogger.error("Failed to parse JWT claims:", { error });
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
var authenticationService = new AuthenticationService();
|
|
135
|
-
|
|
136
15
|
// src/store/aiQueryStore.ts
|
|
137
|
-
import { create
|
|
16
|
+
import { create } from "zustand";
|
|
138
17
|
var DB_NAME = "ai-query-db";
|
|
139
18
|
var STORE_NAME = "ai-query";
|
|
140
19
|
var DB_VERSION = 1;
|
|
@@ -157,7 +36,7 @@ async function loadStateFromDB() {
|
|
|
157
36
|
}
|
|
158
37
|
}
|
|
159
38
|
}
|
|
160
|
-
var useAIQueryStore =
|
|
39
|
+
var useAIQueryStore = create((set, get) => ({
|
|
161
40
|
inputValue: "",
|
|
162
41
|
response: "",
|
|
163
42
|
previousQuestion: "",
|
|
@@ -234,7 +113,7 @@ var useAIQueryStore = create2((set, get) => ({
|
|
|
234
113
|
}));
|
|
235
114
|
|
|
236
115
|
// src/store/conversationStore.ts
|
|
237
|
-
import { create as
|
|
116
|
+
import { create as create2 } from "zustand";
|
|
238
117
|
import { v4 as uuidv4 } from "uuid";
|
|
239
118
|
|
|
240
119
|
// src/util/conversationMigration.ts
|
|
@@ -405,7 +284,7 @@ async function saveConversation(conversation) {
|
|
|
405
284
|
async function deleteConversationFromDB(id) {
|
|
406
285
|
await indexedDBService_default.delete(DB_NAME3, DB_VERSION3, STORE_NAME3, id, storeConfigs3);
|
|
407
286
|
}
|
|
408
|
-
var useConversationStore =
|
|
287
|
+
var useConversationStore = create2((set, get) => ({
|
|
409
288
|
conversations: [],
|
|
410
289
|
currentId: null,
|
|
411
290
|
_hasHydrated: false,
|
|
@@ -719,12 +598,12 @@ function emitConversationDelete(id) {
|
|
|
719
598
|
}
|
|
720
599
|
|
|
721
600
|
// src/store/memoryStore.ts
|
|
722
|
-
import { create as
|
|
601
|
+
import { create as create3 } from "zustand";
|
|
723
602
|
var DB_NAME4 = "bandit-memory-db";
|
|
724
603
|
var STORE_NAME4 = "bandit-memory";
|
|
725
604
|
var storeConfigs4 = [{ name: STORE_NAME4, keyPath: "id" }];
|
|
726
605
|
var normalize = (text) => text.toLowerCase().replace(/[^\w\s]|_/g, "").replace(/\s+/g, " ").trim();
|
|
727
|
-
var useMemoryStore =
|
|
606
|
+
var useMemoryStore = create3((set, get) => ({
|
|
728
607
|
entries: [],
|
|
729
608
|
_hasHydrated: false,
|
|
730
609
|
hydrate: async () => {
|
|
@@ -796,7 +675,7 @@ var useMemoryStore = create4((set, get) => ({
|
|
|
796
675
|
}));
|
|
797
676
|
|
|
798
677
|
// src/store/projectStore.ts
|
|
799
|
-
import { create as
|
|
678
|
+
import { create as create4 } from "zustand";
|
|
800
679
|
import { v4 as uuidv42 } from "uuid";
|
|
801
680
|
var DB_NAME5 = "bandit-projects";
|
|
802
681
|
var STORE_NAME5 = "projects";
|
|
@@ -851,7 +730,7 @@ async function deleteProjectFromDB(id) {
|
|
|
851
730
|
throw error;
|
|
852
731
|
}
|
|
853
732
|
}
|
|
854
|
-
var useProjectStore =
|
|
733
|
+
var useProjectStore = create4((set, get) => ({
|
|
855
734
|
projects: [],
|
|
856
735
|
_hasHydrated: false,
|
|
857
736
|
hydrate: async () => {
|
|
@@ -1020,7 +899,7 @@ function emitProjectDelete(id) {
|
|
|
1020
899
|
}
|
|
1021
900
|
|
|
1022
901
|
// src/store/conversationSyncStore.ts
|
|
1023
|
-
import { create as
|
|
902
|
+
import { create as create5 } from "zustand";
|
|
1024
903
|
import { v4 as uuidv43 } from "uuid";
|
|
1025
904
|
|
|
1026
905
|
// src/services/conversationSync/conversationSyncService.ts
|
|
@@ -1610,7 +1489,7 @@ async function applyServerResults(response) {
|
|
|
1610
1489
|
suppressTracking = false;
|
|
1611
1490
|
}
|
|
1612
1491
|
}
|
|
1613
|
-
var useConversationSyncStore =
|
|
1492
|
+
var useConversationSyncStore = create5((set, get) => ({
|
|
1614
1493
|
initialized: false,
|
|
1615
1494
|
hasLoadedPreference: false,
|
|
1616
1495
|
initializedForToken: null,
|
|
@@ -2079,9 +1958,9 @@ function buildOversizedMessage(notices) {
|
|
|
2079
1958
|
}
|
|
2080
1959
|
|
|
2081
1960
|
// src/store/knowledgeStore.ts
|
|
2082
|
-
import { create as
|
|
1961
|
+
import { create as create6 } from "zustand";
|
|
2083
1962
|
import { v4 as uuidv44 } from "uuid";
|
|
2084
|
-
var useKnowledgeStore =
|
|
1963
|
+
var useKnowledgeStore = create6((set, get) => ({
|
|
2085
1964
|
docs: [],
|
|
2086
1965
|
isLoaded: false,
|
|
2087
1966
|
addDoc: (doc) => {
|
|
@@ -4934,7 +4813,7 @@ var useVectorStore = () => {
|
|
|
4934
4813
|
const [hasCompatibleProvider, setHasCompatibleProvider] = useState2(false);
|
|
4935
4814
|
const checkProviderCompatibility = useCallback2(async () => {
|
|
4936
4815
|
try {
|
|
4937
|
-
const { useAIProviderStore: useAIProviderStore2 } = await import("./aiProviderStore-
|
|
4816
|
+
const { useAIProviderStore: useAIProviderStore2 } = await import("./aiProviderStore-FTD277QP.mjs");
|
|
4938
4817
|
const aiProviderState = useAIProviderStore2.getState();
|
|
4939
4818
|
const provider = aiProviderState.provider;
|
|
4940
4819
|
const config = aiProviderState.config;
|
|
@@ -5939,10 +5818,6 @@ var NotificationProvider = ({
|
|
|
5939
5818
|
};
|
|
5940
5819
|
|
|
5941
5820
|
export {
|
|
5942
|
-
useAuthenticationStore,
|
|
5943
|
-
readPersistedToken,
|
|
5944
|
-
AUTH_TOKEN_CHANGED_EVENT,
|
|
5945
|
-
authenticationService,
|
|
5946
5821
|
useAIQueryStore,
|
|
5947
5822
|
sanitizeConversationName,
|
|
5948
5823
|
useConversationStore,
|
|
@@ -5982,4 +5857,4 @@ export {
|
|
|
5982
5857
|
useNotification,
|
|
5983
5858
|
NotificationProvider
|
|
5984
5859
|
};
|
|
5985
|
-
//# sourceMappingURL=chunk-
|
|
5860
|
+
//# sourceMappingURL=chunk-37JLV5PU.mjs.map
|