@burtson-labs/bandit-engine 2.0.161 → 2.0.162
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-BNZGM6QU.mjs → aiProviderStore-JOB2H4LP.mjs} +2 -2
- package/dist/chat-LB6UEEEW.mjs +16 -0
- package/dist/chat-provider.js +86 -31
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +5 -5
- package/dist/{chunk-TTAORNWI.mjs → chunk-3ACT5BTW.mjs} +6 -6
- package/dist/{chunk-QPXG4A5C.mjs → chunk-47MOBOP3.mjs} +2 -2
- package/dist/{chunk-PFKKGJAQ.mjs → chunk-G5POQT2R.mjs} +2 -2
- package/dist/{chunk-MIDYEQOS.mjs → chunk-ODGVCSKV.mjs} +17 -11
- package/dist/{chunk-MIDYEQOS.mjs.map → chunk-ODGVCSKV.mjs.map} +1 -1
- package/dist/{chunk-FSRMNQRN.mjs → chunk-OGMXL7BF.mjs} +4 -4
- package/dist/{chunk-B3HAQC6F.mjs → chunk-Q6LXVYTC.mjs} +68 -25
- package/dist/chunk-Q6LXVYTC.mjs.map +1 -0
- package/dist/{chunk-EOMOOMUC.mjs → chunk-R6HMLYKQ.mjs} +3 -3
- package/dist/{chunk-XC7HDKFW.mjs → chunk-RUXYVMW2.mjs} +9 -9
- package/dist/{chunk-X65A3NED.mjs → chunk-YHSYHU5P.mjs} +5 -5
- package/dist/{chunk-QXITTH2X.mjs → chunk-ZNK3ELTZ.mjs} +2 -2
- package/dist/index.js +86 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/management/management.js +86 -31
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +8 -8
- package/dist/modals/chat-modal/chat-modal.js +86 -31
- 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-3JAV77HO.mjs +0 -16
- package/dist/chunk-B3HAQC6F.mjs.map +0 -1
- /package/dist/{aiProviderStore-BNZGM6QU.mjs.map → aiProviderStore-JOB2H4LP.mjs.map} +0 -0
- /package/dist/{chat-3JAV77HO.mjs.map → chat-LB6UEEEW.mjs.map} +0 -0
- /package/dist/{chunk-TTAORNWI.mjs.map → chunk-3ACT5BTW.mjs.map} +0 -0
- /package/dist/{chunk-QPXG4A5C.mjs.map → chunk-47MOBOP3.mjs.map} +0 -0
- /package/dist/{chunk-PFKKGJAQ.mjs.map → chunk-G5POQT2R.mjs.map} +0 -0
- /package/dist/{chunk-FSRMNQRN.mjs.map → chunk-OGMXL7BF.mjs.map} +0 -0
- /package/dist/{chunk-EOMOOMUC.mjs.map → chunk-R6HMLYKQ.mjs.map} +0 -0
- /package/dist/{chunk-XC7HDKFW.mjs.map → chunk-RUXYVMW2.mjs.map} +0 -0
- /package/dist/{chunk-X65A3NED.mjs.map → chunk-YHSYHU5P.mjs.map} +0 -0
- /package/dist/{chunk-QXITTH2X.mjs.map → chunk-ZNK3ELTZ.mjs.map} +0 -0
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
StreamingMarkdown_default,
|
|
3
3
|
isNativeShell,
|
|
4
4
|
isStandalonePwa
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-47MOBOP3.mjs";
|
|
6
6
|
import {
|
|
7
7
|
aiProviderInitService
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZNK3ELTZ.mjs";
|
|
9
9
|
import {
|
|
10
10
|
addMcpServer,
|
|
11
11
|
deleteMcpServer,
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
listMcpServers,
|
|
14
14
|
updateMcpServer,
|
|
15
15
|
useMCPToolsStore
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-G5POQT2R.mjs";
|
|
17
17
|
import {
|
|
18
18
|
chat_modal_default
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-OGMXL7BF.mjs";
|
|
20
20
|
import {
|
|
21
21
|
AlertCircle,
|
|
22
22
|
AlertTriangle,
|
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
themeSkinIds,
|
|
92
92
|
useNotificationService,
|
|
93
93
|
useVoiceStore
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-R6HMLYKQ.mjs";
|
|
95
95
|
import {
|
|
96
96
|
TOPICS,
|
|
97
97
|
brandingService_default,
|
|
@@ -102,7 +102,7 @@ import {
|
|
|
102
102
|
useFeatures,
|
|
103
103
|
useKnowledgeStore2 as useKnowledgeStore,
|
|
104
104
|
useVectorStore
|
|
105
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-ODGVCSKV.mjs";
|
|
106
106
|
import {
|
|
107
107
|
indexedDBService_default,
|
|
108
108
|
models,
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
authenticationService,
|
|
117
117
|
useAIProviderStore,
|
|
118
118
|
useAuthenticationStore
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-Q6LXVYTC.mjs";
|
|
120
120
|
import {
|
|
121
121
|
debugLogger
|
|
122
122
|
} from "./chunk-KCI46M23.mjs";
|
|
@@ -9516,7 +9516,7 @@ function useManagementAccess() {
|
|
|
9516
9516
|
|
|
9517
9517
|
// src/management/management.tsx
|
|
9518
9518
|
import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
9519
|
-
var preloadChatPage = () => import("./chat-
|
|
9519
|
+
var preloadChatPage = () => import("./chat-LB6UEEEW.mjs");
|
|
9520
9520
|
var buildCapabilitiesUrl = (gatewayApiUrl) => {
|
|
9521
9521
|
const trimmed = gatewayApiUrl.replace(/\/$/, "");
|
|
9522
9522
|
if (trimmed.endsWith("/api")) {
|
|
@@ -10572,4 +10572,4 @@ export {
|
|
|
10572
10572
|
useManagementAccess,
|
|
10573
10573
|
management_default
|
|
10574
10574
|
};
|
|
10575
|
-
//# sourceMappingURL=chunk-
|
|
10575
|
+
//# sourceMappingURL=chunk-RUXYVMW2.mjs.map
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-ONQMRE2G.mjs";
|
|
4
4
|
import {
|
|
5
5
|
aiProviderInitService
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZNK3ELTZ.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useMCPToolsStore
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-G5POQT2R.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-
|
|
22
|
+
} from "./chunk-ODGVCSKV.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-
|
|
32
|
+
} from "./chunk-Q6LXVYTC.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-
|
|
194
|
+
//# sourceMappingURL=chunk-YHSYHU5P.mjs.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
authenticationService,
|
|
7
7
|
useAIProviderStore
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-Q6LXVYTC.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-
|
|
288
|
+
//# sourceMappingURL=chunk-ZNK3ELTZ.mjs.map
|
package/dist/index.js
CHANGED
|
@@ -3724,6 +3724,40 @@ var init_common_types = __esm({
|
|
|
3724
3724
|
}
|
|
3725
3725
|
});
|
|
3726
3726
|
|
|
3727
|
+
// src/services/stream/streamLineParser.ts
|
|
3728
|
+
var SKIP, StreamLineParser;
|
|
3729
|
+
var init_streamLineParser = __esm({
|
|
3730
|
+
"src/services/stream/streamLineParser.ts"() {
|
|
3731
|
+
"use strict";
|
|
3732
|
+
SKIP = { kind: "skip" };
|
|
3733
|
+
StreamLineParser = class {
|
|
3734
|
+
/** Set by `event: ping` until the frame's blank-line terminator. */
|
|
3735
|
+
inHeartbeatFrame = false;
|
|
3736
|
+
next(rawLine) {
|
|
3737
|
+
const line = rawLine.trim();
|
|
3738
|
+
if (!line) {
|
|
3739
|
+
this.inHeartbeatFrame = false;
|
|
3740
|
+
return SKIP;
|
|
3741
|
+
}
|
|
3742
|
+
if (line.startsWith(":")) return SKIP;
|
|
3743
|
+
if (line.startsWith("event:")) {
|
|
3744
|
+
this.inHeartbeatFrame = line.slice(6).trim().toLowerCase() === "ping";
|
|
3745
|
+
return SKIP;
|
|
3746
|
+
}
|
|
3747
|
+
if (line.startsWith("id:") || line.startsWith("retry:")) return SKIP;
|
|
3748
|
+
if (line.startsWith("data:")) {
|
|
3749
|
+
if (this.inHeartbeatFrame) return SKIP;
|
|
3750
|
+
const data = line.slice(5).trim();
|
|
3751
|
+
if (!data) return SKIP;
|
|
3752
|
+
if (data === "[DONE]") return { kind: "done" };
|
|
3753
|
+
return { kind: "json", text: data };
|
|
3754
|
+
}
|
|
3755
|
+
return { kind: "json", text: line };
|
|
3756
|
+
}
|
|
3757
|
+
};
|
|
3758
|
+
}
|
|
3759
|
+
});
|
|
3760
|
+
|
|
3727
3761
|
// src/services/ollama/ollama.service.ts
|
|
3728
3762
|
var import_rxjs, handleError, parseResponseBody, OllamaService;
|
|
3729
3763
|
var init_ollama_service = __esm({
|
|
@@ -3731,6 +3765,7 @@ var init_ollama_service = __esm({
|
|
|
3731
3765
|
"use strict";
|
|
3732
3766
|
import_rxjs = require("rxjs");
|
|
3733
3767
|
init_debugLogger();
|
|
3768
|
+
init_streamLineParser();
|
|
3734
3769
|
handleError = () => (obs) => obs.pipe(
|
|
3735
3770
|
(0, import_rxjs.switchMap)(
|
|
3736
3771
|
(response) => response.ok ? (0, import_rxjs.of)(response) : (0, import_rxjs.throwError)(() => new Error(`Request failed: ${response.status} ${response.statusText}`))
|
|
@@ -3821,13 +3856,15 @@ var init_ollama_service = __esm({
|
|
|
3821
3856
|
this._throwErrorIfNotOk(url, response);
|
|
3822
3857
|
const reader = response.body?.getReader();
|
|
3823
3858
|
const decoder = new TextDecoder();
|
|
3859
|
+
const lineParser = new StreamLineParser();
|
|
3824
3860
|
let buffer = "";
|
|
3825
3861
|
const read = () => {
|
|
3826
3862
|
reader?.read().then(({ done, value }) => {
|
|
3827
3863
|
if (done) {
|
|
3828
|
-
|
|
3864
|
+
const tail = lineParser.next(buffer);
|
|
3865
|
+
if (tail.kind === "json") {
|
|
3829
3866
|
try {
|
|
3830
|
-
observer.next(JSON.parse(
|
|
3867
|
+
observer.next(JSON.parse(tail.text));
|
|
3831
3868
|
} catch (err) {
|
|
3832
3869
|
observer.error(err);
|
|
3833
3870
|
debugLogger.error("Final chunk parsing error (generate):", { buffer });
|
|
@@ -3840,9 +3877,10 @@ var init_ollama_service = __esm({
|
|
|
3840
3877
|
const lines = buffer.split("\n");
|
|
3841
3878
|
buffer = lines.pop() ?? "";
|
|
3842
3879
|
for (const line of lines) {
|
|
3843
|
-
|
|
3880
|
+
const classified = lineParser.next(line);
|
|
3881
|
+
if (classified.kind === "json") {
|
|
3844
3882
|
try {
|
|
3845
|
-
observer.next(JSON.parse(
|
|
3883
|
+
observer.next(JSON.parse(classified.text));
|
|
3846
3884
|
} catch (err) {
|
|
3847
3885
|
observer.error(err);
|
|
3848
3886
|
debugLogger.error("Error parsing JSON line (generate):", { line });
|
|
@@ -3872,13 +3910,15 @@ var init_ollama_service = __esm({
|
|
|
3872
3910
|
this._throwErrorIfNotOk(url, response);
|
|
3873
3911
|
const reader = response.body?.getReader();
|
|
3874
3912
|
const decoder = new TextDecoder();
|
|
3913
|
+
const lineParser = new StreamLineParser();
|
|
3875
3914
|
let buffer = "";
|
|
3876
3915
|
const read = () => {
|
|
3877
3916
|
reader?.read().then(({ done, value }) => {
|
|
3878
3917
|
if (done) {
|
|
3879
|
-
|
|
3918
|
+
const tail = lineParser.next(buffer);
|
|
3919
|
+
if (tail.kind === "json") {
|
|
3880
3920
|
try {
|
|
3881
|
-
observer.next(JSON.parse(
|
|
3921
|
+
observer.next(JSON.parse(tail.text));
|
|
3882
3922
|
} catch (err) {
|
|
3883
3923
|
observer.error(err);
|
|
3884
3924
|
debugLogger.error("Final chunk parsing error (chat):", { buffer });
|
|
@@ -3891,9 +3931,10 @@ var init_ollama_service = __esm({
|
|
|
3891
3931
|
const lines = buffer.split("\n");
|
|
3892
3932
|
buffer = lines.pop() ?? "";
|
|
3893
3933
|
for (const line of lines) {
|
|
3894
|
-
|
|
3934
|
+
const classified = lineParser.next(line);
|
|
3935
|
+
if (classified.kind === "json") {
|
|
3895
3936
|
try {
|
|
3896
|
-
observer.next(JSON.parse(
|
|
3937
|
+
observer.next(JSON.parse(classified.text));
|
|
3897
3938
|
} catch (err) {
|
|
3898
3939
|
observer.error(err);
|
|
3899
3940
|
debugLogger.error("Error parsing JSON line (chat):", { line });
|
|
@@ -4787,6 +4828,7 @@ var init_gateway_service = __esm({
|
|
|
4787
4828
|
"src/services/gateway/gateway.service.ts"() {
|
|
4788
4829
|
"use strict";
|
|
4789
4830
|
import_axios = __toESM(require("axios"));
|
|
4831
|
+
init_streamLineParser();
|
|
4790
4832
|
import_rxjs6 = require("rxjs");
|
|
4791
4833
|
init_debugLogger();
|
|
4792
4834
|
init_authenticationService();
|
|
@@ -4968,13 +5010,15 @@ var init_gateway_service = __esm({
|
|
|
4968
5010
|
const handleStreamingResponse = async (response) => {
|
|
4969
5011
|
const reader = response.body?.getReader();
|
|
4970
5012
|
const decoder = new TextDecoder();
|
|
5013
|
+
const lineParser = new StreamLineParser();
|
|
4971
5014
|
let buffer = "";
|
|
4972
5015
|
const read = () => {
|
|
4973
5016
|
reader?.read().then(({ done, value }) => {
|
|
4974
5017
|
if (done) {
|
|
4975
|
-
|
|
5018
|
+
const tail = lineParser.next(buffer);
|
|
5019
|
+
if (tail.kind === "json") {
|
|
4976
5020
|
try {
|
|
4977
|
-
const finalResponse = JSON.parse(
|
|
5021
|
+
const finalResponse = JSON.parse(tail.text);
|
|
4978
5022
|
observer.next(finalResponse);
|
|
4979
5023
|
} catch (err) {
|
|
4980
5024
|
debugLogger.error("GatewayService chat final chunk parsing error", { buffer, error: err });
|
|
@@ -4988,16 +5032,14 @@ var init_gateway_service = __esm({
|
|
|
4988
5032
|
const lines = buffer.split("\n");
|
|
4989
5033
|
buffer = lines.pop() ?? "";
|
|
4990
5034
|
for (const line of lines) {
|
|
4991
|
-
const
|
|
4992
|
-
if (
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
}
|
|
5000
|
-
}
|
|
5035
|
+
const classified = lineParser.next(line);
|
|
5036
|
+
if (classified.kind === "done") {
|
|
5037
|
+
observer.complete();
|
|
5038
|
+
return;
|
|
5039
|
+
}
|
|
5040
|
+
if (classified.kind === "json") {
|
|
5041
|
+
const trimmed = line.trim();
|
|
5042
|
+
const data = classified.text;
|
|
5001
5043
|
try {
|
|
5002
5044
|
const parsed = JSON.parse(data);
|
|
5003
5045
|
if (request.provider === "ollama" && parsed.message) {
|
|
@@ -5164,13 +5206,15 @@ var init_gateway_service = __esm({
|
|
|
5164
5206
|
}
|
|
5165
5207
|
const reader = response.body?.getReader();
|
|
5166
5208
|
const decoder = new TextDecoder();
|
|
5209
|
+
const lineParser = new StreamLineParser();
|
|
5167
5210
|
let buffer = "";
|
|
5168
5211
|
const read = () => {
|
|
5169
5212
|
reader?.read().then(({ done, value }) => {
|
|
5170
5213
|
if (done) {
|
|
5171
|
-
|
|
5214
|
+
const tail = lineParser.next(buffer);
|
|
5215
|
+
if (tail.kind === "json") {
|
|
5172
5216
|
try {
|
|
5173
|
-
observer.next(JSON.parse(
|
|
5217
|
+
observer.next(JSON.parse(tail.text));
|
|
5174
5218
|
} catch (err) {
|
|
5175
5219
|
observer.error(err);
|
|
5176
5220
|
debugLogger.error("Final chunk parsing error (gateway generate):", { buffer });
|
|
@@ -5183,9 +5227,14 @@ var init_gateway_service = __esm({
|
|
|
5183
5227
|
const lines = buffer.split("\n");
|
|
5184
5228
|
buffer = lines.pop() ?? "";
|
|
5185
5229
|
for (const line of lines) {
|
|
5186
|
-
|
|
5230
|
+
const classified = lineParser.next(line);
|
|
5231
|
+
if (classified.kind === "done") {
|
|
5232
|
+
observer.complete();
|
|
5233
|
+
return;
|
|
5234
|
+
}
|
|
5235
|
+
if (classified.kind === "json") {
|
|
5187
5236
|
try {
|
|
5188
|
-
observer.next(JSON.parse(
|
|
5237
|
+
observer.next(JSON.parse(classified.text));
|
|
5189
5238
|
} catch (err) {
|
|
5190
5239
|
observer.error(err);
|
|
5191
5240
|
debugLogger.error("Error parsing JSON line (gateway generate):", { line });
|
|
@@ -9991,9 +10040,17 @@ var init_useVectorStore = __esm({
|
|
|
9991
10040
|
const hasAnyAdvancedFeatures = isAdvancedVectorFeaturesEnabled;
|
|
9992
10041
|
const hasVectorAccess = features.isAdmin() || features.hasAdvancedSearch() || features.hasAdvancedMemories();
|
|
9993
10042
|
const [hasCompatibleProvider, setHasCompatibleProvider] = (0, import_react3.useState)(false);
|
|
10043
|
+
const mountedRef = (0, import_react3.useRef)(true);
|
|
10044
|
+
(0, import_react3.useEffect)(() => {
|
|
10045
|
+
mountedRef.current = true;
|
|
10046
|
+
return () => {
|
|
10047
|
+
mountedRef.current = false;
|
|
10048
|
+
};
|
|
10049
|
+
}, []);
|
|
9994
10050
|
const checkProviderCompatibility = (0, import_react3.useCallback)(async () => {
|
|
9995
10051
|
try {
|
|
9996
10052
|
const { useAIProviderStore: useAIProviderStore2 } = await Promise.resolve().then(() => (init_aiProviderStore(), aiProviderStore_exports));
|
|
10053
|
+
if (!mountedRef.current) return false;
|
|
9997
10054
|
const aiProviderState = useAIProviderStore2.getState();
|
|
9998
10055
|
const provider = aiProviderState.provider;
|
|
9999
10056
|
const config = aiProviderState.config;
|
|
@@ -10010,7 +10067,7 @@ var init_useVectorStore = __esm({
|
|
|
10010
10067
|
return isCompatible;
|
|
10011
10068
|
} catch (error) {
|
|
10012
10069
|
debugLogger.warn("Could not check AI provider for vector compatibility", { error });
|
|
10013
|
-
setHasCompatibleProvider(false);
|
|
10070
|
+
if (mountedRef.current) setHasCompatibleProvider(false);
|
|
10014
10071
|
return false;
|
|
10015
10072
|
}
|
|
10016
10073
|
}, []);
|
|
@@ -10018,12 +10075,10 @@ var init_useVectorStore = __esm({
|
|
|
10018
10075
|
checkProviderCompatibility();
|
|
10019
10076
|
}, [checkProviderCompatibility]);
|
|
10020
10077
|
(0, import_react3.useEffect)(() => {
|
|
10021
|
-
const
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
};
|
|
10026
|
-
checkOnProviderChange();
|
|
10078
|
+
const timer = setTimeout(() => {
|
|
10079
|
+
void checkProviderCompatibility();
|
|
10080
|
+
}, 100);
|
|
10081
|
+
return () => clearTimeout(timer);
|
|
10027
10082
|
}, [authStore.token, checkProviderCompatibility]);
|
|
10028
10083
|
(0, import_react3.useEffect)(() => {
|
|
10029
10084
|
const interval = setInterval(() => {
|