@burtson-labs/bandit-engine 2.0.22 → 2.0.24
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/{chat-VOVYLTMX.mjs → chat-2LYIZNWZ.mjs} +2 -2
- package/dist/chat-provider.js +51 -46
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +2 -2
- package/dist/{chunk-XVWKFDTD.mjs → chunk-6PQRG6W4.mjs} +2 -2
- package/dist/{chunk-N3G5XPCA.mjs → chunk-7RLN6ZGT.mjs} +52 -47
- package/dist/chunk-7RLN6ZGT.mjs.map +1 -0
- package/dist/{chunk-ZRTP2N7E.mjs → chunk-IGD4KGB5.mjs} +102 -85
- package/dist/chunk-IGD4KGB5.mjs.map +1 -0
- package/dist/{chunk-LB7QYC56.mjs → chunk-XXMCI2WK.mjs} +3 -3
- package/dist/cli/cli.js +1 -1
- package/dist/cli/cli.js.map +1 -1
- package/dist/index.js +121 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/management/management.js +121 -99
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-N3G5XPCA.mjs.map +0 -1
- package/dist/chunk-ZRTP2N7E.mjs.map +0 -1
- /package/dist/{chat-VOVYLTMX.mjs.map → chat-2LYIZNWZ.mjs.map} +0 -0
- /package/dist/{chunk-XVWKFDTD.mjs.map → chunk-6PQRG6W4.mjs.map} +0 -0
- /package/dist/{chunk-LB7QYC56.mjs.map → chunk-XXMCI2WK.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -17381,6 +17381,8 @@ var init_chat_input = __esm({
|
|
|
17381
17381
|
const isMemoryEnabled = preferences.memoryEnabled && showMemoryToggle();
|
|
17382
17382
|
const isDocumentUploadEnabled = showDocumentUpload();
|
|
17383
17383
|
const isFeedbackEnabled = preferences.feedbackEnabled;
|
|
17384
|
+
const gatewayUrlLower = packageSettings?.gatewayApiUrl?.toLowerCase?.() ?? "";
|
|
17385
|
+
const isPlaygroundMode3 = packageSettings?.playgroundMode === true || gatewayUrlLower.startsWith("playground://") || typeof window !== "undefined" && window.location.pathname.includes("/playground");
|
|
17384
17386
|
(0, import_react19.useEffect)(() => {
|
|
17385
17387
|
const lockViewportHeight = () => {
|
|
17386
17388
|
if (isMobile) {
|
|
@@ -17534,7 +17536,7 @@ ${sanitize(escapePromptInjection(value), file.name)}`;
|
|
|
17534
17536
|
const page = await pdf.getPage(i + 1);
|
|
17535
17537
|
const content = await page.getTextContent();
|
|
17536
17538
|
return content.items.map((item) => {
|
|
17537
|
-
if (typeof item.str === "string") {
|
|
17539
|
+
if (item && typeof item === "object" && "str" in item && typeof item.str === "string") {
|
|
17538
17540
|
return item.str;
|
|
17539
17541
|
}
|
|
17540
17542
|
return "";
|
|
@@ -17594,7 +17596,7 @@ ${sanitize(
|
|
|
17594
17596
|
inputRef.current?.focus();
|
|
17595
17597
|
};
|
|
17596
17598
|
const memory = localStorage.getItem("bandit-memory");
|
|
17597
|
-
const hasAttachmentAction = fileInputs.length < 3 && isDocumentUploadEnabled;
|
|
17599
|
+
const hasAttachmentAction = !isPlaygroundMode3 && fileInputs.length < 3 && isDocumentUploadEnabled;
|
|
17598
17600
|
const hasMemoryAction = isMemoryEnabled;
|
|
17599
17601
|
const hasFeedbackAction = isFeedbackEnabled && isMobile;
|
|
17600
17602
|
const hasSttAction = isSTTAvailable && !isVoiceModeEnabled;
|
|
@@ -22210,6 +22212,7 @@ var init_conversation_drawer = __esm({
|
|
|
22210
22212
|
display: "flex",
|
|
22211
22213
|
alignItems: "center",
|
|
22212
22214
|
gap: 1.5,
|
|
22215
|
+
justifyContent: "center",
|
|
22213
22216
|
bgcolor: (0, import_material19.alpha)(theme.palette.background.default, isMobile ? 0.9 : 0.6)
|
|
22214
22217
|
},
|
|
22215
22218
|
children: [
|
|
@@ -22228,33 +22231,39 @@ var init_conversation_drawer = __esm({
|
|
|
22228
22231
|
children: avatarInitials
|
|
22229
22232
|
}
|
|
22230
22233
|
),
|
|
22231
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
22232
|
-
|
|
22233
|
-
|
|
22234
|
-
{
|
|
22235
|
-
|
|
22236
|
-
|
|
22237
|
-
|
|
22238
|
-
|
|
22239
|
-
|
|
22240
|
-
|
|
22241
|
-
|
|
22242
|
-
|
|
22243
|
-
|
|
22244
|
-
|
|
22245
|
-
|
|
22246
|
-
|
|
22247
|
-
|
|
22248
|
-
|
|
22249
|
-
|
|
22250
|
-
|
|
22251
|
-
|
|
22252
|
-
|
|
22253
|
-
|
|
22254
|
-
|
|
22255
|
-
|
|
22256
|
-
|
|
22257
|
-
|
|
22234
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
22235
|
+
import_material19.Box,
|
|
22236
|
+
{
|
|
22237
|
+
sx: {
|
|
22238
|
+
minWidth: 0,
|
|
22239
|
+
flex: 1,
|
|
22240
|
+
display: "flex",
|
|
22241
|
+
flexDirection: "column",
|
|
22242
|
+
alignItems: isMobile ? "center" : "flex-start",
|
|
22243
|
+
textAlign: isMobile ? "center" : "left",
|
|
22244
|
+
gap: 0.25
|
|
22245
|
+
},
|
|
22246
|
+
children: [
|
|
22247
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
22248
|
+
import_material19.Typography,
|
|
22249
|
+
{
|
|
22250
|
+
variant: "subtitle2",
|
|
22251
|
+
noWrap: true,
|
|
22252
|
+
sx: { fontWeight: 600, color: theme.palette.text.primary },
|
|
22253
|
+
children: user2 ? userDisplayName : "Not signed in"
|
|
22254
|
+
}
|
|
22255
|
+
),
|
|
22256
|
+
!user2 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
22257
|
+
import_material19.Typography,
|
|
22258
|
+
{
|
|
22259
|
+
variant: "caption",
|
|
22260
|
+
sx: { color: theme.palette.text.secondary },
|
|
22261
|
+
children: "Connect your account to sync chats"
|
|
22262
|
+
}
|
|
22263
|
+
)
|
|
22264
|
+
]
|
|
22265
|
+
}
|
|
22266
|
+
)
|
|
22258
22267
|
]
|
|
22259
22268
|
}
|
|
22260
22269
|
)
|
|
@@ -23150,7 +23159,7 @@ var init_enhanced_mobile_conversations_modal = __esm({
|
|
|
23150
23159
|
children: avatarInitials
|
|
23151
23160
|
}
|
|
23152
23161
|
),
|
|
23153
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material20.Box, { sx: { display: "flex", alignItems: "center", gap:
|
|
23162
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material20.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", gap: 0.5, minWidth: 0 }, children: [
|
|
23154
23163
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
23155
23164
|
import_material20.Typography,
|
|
23156
23165
|
{
|
|
@@ -23160,24 +23169,13 @@ var init_enhanced_mobile_conversations_modal = __esm({
|
|
|
23160
23169
|
children: user2 ? userDisplayName : "Not signed in"
|
|
23161
23170
|
}
|
|
23162
23171
|
),
|
|
23163
|
-
user2
|
|
23164
|
-
import_material20.Typography,
|
|
23165
|
-
{
|
|
23166
|
-
variant: "caption",
|
|
23167
|
-
noWrap: true,
|
|
23168
|
-
sx: { color: theme.palette.text.secondary },
|
|
23169
|
-
children: [
|
|
23170
|
-
"\u2022 ",
|
|
23171
|
-
userSecondaryText
|
|
23172
|
-
]
|
|
23173
|
-
}
|
|
23174
|
-
) : null : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
23172
|
+
!user2 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
23175
23173
|
import_material20.Typography,
|
|
23176
23174
|
{
|
|
23177
23175
|
variant: "caption",
|
|
23178
23176
|
sx: { color: theme.palette.text.secondary },
|
|
23179
23177
|
noWrap: true,
|
|
23180
|
-
children: "
|
|
23178
|
+
children: "Connect your account to sync chats"
|
|
23181
23179
|
}
|
|
23182
23180
|
)
|
|
23183
23181
|
] })
|
|
@@ -23363,7 +23361,8 @@ var init_chat_app_bar = __esm({
|
|
|
23363
23361
|
pendingCount,
|
|
23364
23362
|
warningConversations,
|
|
23365
23363
|
oversizedConversations,
|
|
23366
|
-
triggerSync
|
|
23364
|
+
triggerSync,
|
|
23365
|
+
setSyncEnabled
|
|
23367
23366
|
} = useConversationSyncStore((state) => ({
|
|
23368
23367
|
syncEnabled: state.syncEnabled,
|
|
23369
23368
|
syncStatus: state.status,
|
|
@@ -23371,8 +23370,18 @@ var init_chat_app_bar = __esm({
|
|
|
23371
23370
|
pendingCount: state.pendingConversationUpserts.size + state.pendingConversationDeletes.size + state.pendingProjectUpserts.size + state.pendingProjectDeletes.size,
|
|
23372
23371
|
warningConversations: state.warningConversations,
|
|
23373
23372
|
oversizedConversations: state.oversizedConversations,
|
|
23374
|
-
triggerSync: state.runSync
|
|
23373
|
+
triggerSync: state.runSync,
|
|
23374
|
+
setSyncEnabled: state.setSyncEnabled
|
|
23375
23375
|
}), import_shallow2.shallow);
|
|
23376
|
+
(0, import_react30.useEffect)(() => {
|
|
23377
|
+
if (isPlaygroundMode3 && syncEnabled) {
|
|
23378
|
+
void setSyncEnabled(false).catch((error) => {
|
|
23379
|
+
debugLogger.warn("ChatAppBar: Failed to disable sync in playground", {
|
|
23380
|
+
error: error instanceof Error ? error.message : String(error)
|
|
23381
|
+
});
|
|
23382
|
+
});
|
|
23383
|
+
}
|
|
23384
|
+
}, [isPlaygroundMode3, syncEnabled, setSyncEnabled]);
|
|
23376
23385
|
const syncSpinSx = {
|
|
23377
23386
|
animation: "spin 1s linear infinite",
|
|
23378
23387
|
"@keyframes spin": {
|
|
@@ -23381,7 +23390,7 @@ var init_chat_app_bar = __esm({
|
|
|
23381
23390
|
}
|
|
23382
23391
|
};
|
|
23383
23392
|
const syncIndicatorIcon = (() => {
|
|
23384
|
-
if (!syncEnabled) {
|
|
23393
|
+
if (isPlaygroundMode3 || !syncEnabled) {
|
|
23385
23394
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_CloudOff2.default, { fontSize: "small", color: "disabled" });
|
|
23386
23395
|
}
|
|
23387
23396
|
switch (syncStatus) {
|
|
@@ -23395,6 +23404,9 @@ var init_chat_app_bar = __esm({
|
|
|
23395
23404
|
}
|
|
23396
23405
|
})();
|
|
23397
23406
|
const syncTooltip = (() => {
|
|
23407
|
+
if (isPlaygroundMode3) {
|
|
23408
|
+
return "Cloud sync is unavailable in playground mode.";
|
|
23409
|
+
}
|
|
23398
23410
|
if (!syncEnabled) {
|
|
23399
23411
|
return "Cloud sync is disabled. Enable it from Management > Preferences.";
|
|
23400
23412
|
}
|
|
@@ -23414,8 +23426,9 @@ var init_chat_app_bar = __esm({
|
|
|
23414
23426
|
const last = lastSyncAt ? ` Last sync ${new Date(lastSyncAt).toLocaleTimeString()}.` : "";
|
|
23415
23427
|
return `${base}${pending}${last}`;
|
|
23416
23428
|
})();
|
|
23429
|
+
const syncButtonDisabled = isPlaygroundMode3 || !syncEnabled;
|
|
23417
23430
|
const handleSyncBadgeClick = () => {
|
|
23418
|
-
if (!syncEnabled || syncStatus === "syncing") {
|
|
23431
|
+
if (isPlaygroundMode3 || !syncEnabled || syncStatus === "syncing") {
|
|
23419
23432
|
return;
|
|
23420
23433
|
}
|
|
23421
23434
|
void triggerSync({ force: true });
|
|
@@ -23545,18 +23558,19 @@ var init_chat_app_bar = __esm({
|
|
|
23545
23558
|
import_material22.IconButton,
|
|
23546
23559
|
{
|
|
23547
23560
|
onClick: handleSyncBadgeClick,
|
|
23561
|
+
disabled: syncButtonDisabled,
|
|
23548
23562
|
sx: {
|
|
23549
23563
|
...pillButtonStyles,
|
|
23550
|
-
color:
|
|
23551
|
-
bgcolor:
|
|
23552
|
-
"&:hover":
|
|
23564
|
+
color: syncButtonDisabled ? theme.palette.action.disabled : theme.palette.primary.main,
|
|
23565
|
+
bgcolor: syncButtonDisabled ? "transparent" : syncStatus === "error" ? theme.palette.error.main + "20" : theme.palette.primary.main + "12",
|
|
23566
|
+
"&:hover": syncButtonDisabled ? {} : {
|
|
23553
23567
|
bgcolor: syncStatus === "error" ? theme.palette.error.main + "30" : theme.palette.primary.main + "20"
|
|
23554
|
-
}
|
|
23568
|
+
}
|
|
23555
23569
|
},
|
|
23556
23570
|
"aria-label": "Conversation sync status",
|
|
23557
23571
|
children: [
|
|
23558
23572
|
syncIndicatorIcon,
|
|
23559
|
-
pendingCount > 0 &&
|
|
23573
|
+
pendingCount > 0 && !syncButtonDisabled && syncStatus !== "syncing" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
23560
23574
|
import_material22.Box,
|
|
23561
23575
|
{
|
|
23562
23576
|
sx: {
|
|
@@ -24109,7 +24123,10 @@ var init_query_suggestion_picker = __esm({
|
|
|
24109
24123
|
markdownComponents = {
|
|
24110
24124
|
p: ({ node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { ...props }),
|
|
24111
24125
|
mark: ({ node, children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("mark", { ...props, children }),
|
|
24112
|
-
code: ({ node,
|
|
24126
|
+
code: ({ node, children, ...props }) => {
|
|
24127
|
+
const { inline, ...rest } = props;
|
|
24128
|
+
return inline ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { ...rest, children }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { ...rest, children });
|
|
24129
|
+
}
|
|
24113
24130
|
};
|
|
24114
24131
|
QuerySuggestionPicker = ({
|
|
24115
24132
|
onSend,
|
|
@@ -28554,58 +28571,63 @@ var AIProviderInitService = class _AIProviderInitService {
|
|
|
28554
28571
|
hasAiProvider: !!settings.aiProvider,
|
|
28555
28572
|
ollamaUrl: settings.ollamaUrl
|
|
28556
28573
|
});
|
|
28557
|
-
|
|
28558
|
-
|
|
28559
|
-
|
|
28560
|
-
|
|
28561
|
-
|
|
28562
|
-
|
|
28563
|
-
|
|
28564
|
-
|
|
28565
|
-
|
|
28566
|
-
|
|
28567
|
-
|
|
28568
|
-
|
|
28569
|
-
if (
|
|
28570
|
-
|
|
28571
|
-
|
|
28572
|
-
|
|
28573
|
-
|
|
28574
|
-
|
|
28575
|
-
|
|
28574
|
+
const isPlaygroundEnvironment = settings.playgroundMode === true || settings.aiProvider?.type === "playground" /* PLAYGROUND */ || (settings.gatewayApiUrl?.toLowerCase()?.startsWith("playground://") ?? false) || typeof window !== "undefined" && window.location.pathname.includes("/playground");
|
|
28575
|
+
if (isPlaygroundEnvironment) {
|
|
28576
|
+
debugLogger.info("AI Provider Init: Playground environment detected, bypassing saved provider config");
|
|
28577
|
+
} else {
|
|
28578
|
+
try {
|
|
28579
|
+
const savedConfig = await indexedDBService_default.get(
|
|
28580
|
+
"banditConfig",
|
|
28581
|
+
1,
|
|
28582
|
+
"config",
|
|
28583
|
+
"aiProvider",
|
|
28584
|
+
[{ name: "config", keyPath: "id" }]
|
|
28585
|
+
);
|
|
28586
|
+
if (savedConfig) {
|
|
28587
|
+
debugLogger.info("AI Provider Init: Found saved config in IndexedDB", { type: savedConfig.type });
|
|
28588
|
+
const { id: _id, ...configWithoutId } = savedConfig;
|
|
28589
|
+
providerConfig = { ...configWithoutId };
|
|
28590
|
+
if ((providerConfig.type === "ollama" /* OLLAMA */ || providerConfig.type === "gateway" /* GATEWAY */) && !providerConfig.tokenFactory) {
|
|
28591
|
+
providerConfig.tokenFactory = () => {
|
|
28592
|
+
let token = authenticationService.getToken();
|
|
28593
|
+
if (!token) {
|
|
28594
|
+
token = localStorage.getItem("authToken");
|
|
28595
|
+
}
|
|
28596
|
+
if (!token) {
|
|
28597
|
+
try {
|
|
28598
|
+
const { useAuthenticationStore: useAuthenticationStore2 } = require("../../store/authenticationStore");
|
|
28599
|
+
const authStore = useAuthenticationStore2.getState();
|
|
28600
|
+
token = authStore.token;
|
|
28601
|
+
} catch (e) {
|
|
28602
|
+
}
|
|
28603
|
+
}
|
|
28604
|
+
debugLogger.info("AI Provider Init: IndexedDB config token factory", {
|
|
28605
|
+
hasToken: !!token
|
|
28606
|
+
});
|
|
28607
|
+
return token;
|
|
28608
|
+
};
|
|
28609
|
+
}
|
|
28610
|
+
try {
|
|
28611
|
+
const { createProvider } = useAIProviderStore.getState();
|
|
28612
|
+
createProvider(providerConfig);
|
|
28613
|
+
const provider = useAIProviderStore.getState().provider;
|
|
28614
|
+
if (provider) {
|
|
28576
28615
|
try {
|
|
28577
|
-
|
|
28578
|
-
|
|
28579
|
-
|
|
28580
|
-
|
|
28616
|
+
await provider.validateServiceAvailability({ timeoutMs: 5e3 });
|
|
28617
|
+
debugLogger.info(`AI Provider initialized and validated from IndexedDB: ${providerConfig.type}`);
|
|
28618
|
+
} catch (validationError) {
|
|
28619
|
+
debugLogger.warn(`AI Provider created but validation failed`, { error: validationError });
|
|
28581
28620
|
}
|
|
28582
28621
|
}
|
|
28583
|
-
|
|
28584
|
-
|
|
28585
|
-
});
|
|
28586
|
-
return token;
|
|
28587
|
-
};
|
|
28588
|
-
}
|
|
28589
|
-
try {
|
|
28590
|
-
const { createProvider } = useAIProviderStore.getState();
|
|
28591
|
-
createProvider(providerConfig);
|
|
28592
|
-
const provider = useAIProviderStore.getState().provider;
|
|
28593
|
-
if (provider) {
|
|
28594
|
-
try {
|
|
28595
|
-
await provider.validateServiceAvailability({ timeoutMs: 5e3 });
|
|
28596
|
-
debugLogger.info(`AI Provider initialized and validated from IndexedDB: ${providerConfig.type}`);
|
|
28597
|
-
} catch (validationError) {
|
|
28598
|
-
debugLogger.warn(`AI Provider created but validation failed`, { error: validationError });
|
|
28599
|
-
}
|
|
28622
|
+
return;
|
|
28623
|
+
} catch (error) {
|
|
28624
|
+
debugLogger.error("Failed to initialize saved provider config, falling back to package settings", { error });
|
|
28600
28625
|
}
|
|
28601
|
-
return;
|
|
28602
|
-
} catch (error) {
|
|
28603
|
-
debugLogger.error("Failed to initialize saved provider config, falling back to package settings", { error });
|
|
28604
28626
|
}
|
|
28627
|
+
debugLogger.info("AI Provider Init: No saved config found, using package settings");
|
|
28628
|
+
} catch (error) {
|
|
28629
|
+
debugLogger.warn("AI Provider Init: Failed to load from IndexedDB, using package settings", { error });
|
|
28605
28630
|
}
|
|
28606
|
-
debugLogger.info("AI Provider Init: No saved config found, using package settings");
|
|
28607
|
-
} catch (error) {
|
|
28608
|
-
debugLogger.warn("AI Provider Init: Failed to load from IndexedDB, using package settings", { error });
|
|
28609
28631
|
}
|
|
28610
28632
|
if (settings.aiProvider) {
|
|
28611
28633
|
providerConfig = { ...settings.aiProvider };
|