@burtson-labs/bandit-engine 2.0.19 → 2.0.20
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-ZPJNWIXI.mjs → chat-2Y72EFJ2.mjs} +2 -2
- package/dist/{chunk-5UVULH77.mjs → chunk-6V2YMAX2.mjs} +34 -18
- package/dist/chunk-6V2YMAX2.mjs.map +1 -0
- package/dist/{chunk-IFN52MQL.mjs → chunk-JECYIAWF.mjs} +29 -3
- package/dist/{chunk-IFN52MQL.mjs.map → chunk-JECYIAWF.mjs.map} +1 -1
- package/dist/cli/cli.js +1 -1
- package/dist/cli/cli.js.map +1 -1
- package/dist/index.js +64 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/management/management.js +61 -19
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-5UVULH77.mjs.map +0 -1
- /package/dist/{chat-ZPJNWIXI.mjs.map → chat-2Y72EFJ2.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
chat_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6V2YMAX2.mjs";
|
|
4
4
|
import {
|
|
5
5
|
chat_provider_default
|
|
6
6
|
} from "./chunk-CY227I4F.mjs";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useGatewayHealth,
|
|
11
11
|
useGatewayMemory,
|
|
12
12
|
useGatewayModels
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JECYIAWF.mjs";
|
|
14
14
|
import "./chunk-2ZNIQD26.mjs";
|
|
15
15
|
import "./chunk-RTQDQ6TC.mjs";
|
|
16
16
|
import {
|
|
@@ -20846,7 +20846,7 @@ var init_useMoodEngine = __esm({
|
|
|
20846
20846
|
});
|
|
20847
20847
|
|
|
20848
20848
|
// src/services/mcp/mcpService.ts
|
|
20849
|
-
var executeMCPTool, getEnabledMCPToolsForAI, isMCPAvailable;
|
|
20849
|
+
var isPlaygroundMode2, executeMCPTool, getEnabledMCPToolsForAI, isMCPAvailable;
|
|
20850
20850
|
var init_mcpService = __esm({
|
|
20851
20851
|
"src/services/mcp/mcpService.ts"() {
|
|
20852
20852
|
"use strict";
|
|
@@ -20854,10 +20854,25 @@ var init_mcpService = __esm({
|
|
|
20854
20854
|
init_packageSettingsStore();
|
|
20855
20855
|
init_authenticationService();
|
|
20856
20856
|
init_debugLogger();
|
|
20857
|
+
isPlaygroundMode2 = () => {
|
|
20858
|
+
const settings = usePackageSettingsStore.getState().settings;
|
|
20859
|
+
if (!settings) {
|
|
20860
|
+
return false;
|
|
20861
|
+
}
|
|
20862
|
+
const gatewayUrl = settings.gatewayApiUrl?.toLowerCase() ?? "";
|
|
20863
|
+
return Boolean(settings.playgroundMode || gatewayUrl.startsWith("playground://"));
|
|
20864
|
+
};
|
|
20857
20865
|
executeMCPTool = async (toolCall) => {
|
|
20858
20866
|
try {
|
|
20859
20867
|
const { tools } = useMCPToolsStore.getState();
|
|
20860
20868
|
const { settings } = usePackageSettingsStore.getState();
|
|
20869
|
+
if (isPlaygroundMode2()) {
|
|
20870
|
+
debugLogger.info("Skipping MCP tool execution in playground mode", { toolName: toolCall.toolName });
|
|
20871
|
+
return {
|
|
20872
|
+
success: false,
|
|
20873
|
+
error: "MCP tools are disabled while playground mode is active."
|
|
20874
|
+
};
|
|
20875
|
+
}
|
|
20861
20876
|
const tool = tools.find((t) => t.function.name === toolCall.toolName && t.enabled);
|
|
20862
20877
|
if (!tool) {
|
|
20863
20878
|
return {
|
|
@@ -20960,6 +20975,9 @@ var init_mcpService = __esm({
|
|
|
20960
20975
|
}));
|
|
20961
20976
|
};
|
|
20962
20977
|
isMCPAvailable = () => {
|
|
20978
|
+
if (isPlaygroundMode2()) {
|
|
20979
|
+
return false;
|
|
20980
|
+
}
|
|
20963
20981
|
const { settings } = usePackageSettingsStore.getState();
|
|
20964
20982
|
const { tools } = useMCPToolsStore.getState();
|
|
20965
20983
|
return !!(settings?.gatewayApiUrl && tools.some((t) => t.enabled));
|
|
@@ -23929,20 +23947,16 @@ var init_conversation_drawer = __esm({
|
|
|
23929
23947
|
return text.slice(start, end).replace(/\s+/g, " ").trim();
|
|
23930
23948
|
};
|
|
23931
23949
|
const projectGroups = (0, import_react48.useMemo)(() => {
|
|
23932
|
-
const groups =
|
|
23933
|
-
|
|
23934
|
-
|
|
23950
|
+
const groups = projects.map((project) => ({
|
|
23951
|
+
id: project.id,
|
|
23952
|
+
name: project.name,
|
|
23953
|
+
color: project.color,
|
|
23954
|
+
conversations: conversations.filter((conversation) => conversation.projectId === project.id).map((conversation) => ({
|
|
23935
23955
|
...conversation
|
|
23936
|
-
}))
|
|
23937
|
-
|
|
23938
|
-
|
|
23939
|
-
|
|
23940
|
-
color: project.color,
|
|
23941
|
-
conversations: projectConversations,
|
|
23942
|
-
collapsed: collapsedProjects.has(project.id)
|
|
23943
|
-
});
|
|
23944
|
-
});
|
|
23945
|
-
const ungroupedConversations = getConversationsByProject(null).map((conversation) => ({
|
|
23956
|
+
})),
|
|
23957
|
+
collapsed: collapsedProjects.has(project.id)
|
|
23958
|
+
}));
|
|
23959
|
+
const ungroupedConversations = conversations.filter((conversation) => !conversation.projectId).map((conversation) => ({
|
|
23946
23960
|
...conversation
|
|
23947
23961
|
}));
|
|
23948
23962
|
if (ungroupedConversations.length > 0) {
|
|
@@ -23951,11 +23965,10 @@ var init_conversation_drawer = __esm({
|
|
|
23951
23965
|
name: "Ungrouped",
|
|
23952
23966
|
conversations: ungroupedConversations,
|
|
23953
23967
|
collapsed: false
|
|
23954
|
-
// Never collapsed for ungrouped
|
|
23955
23968
|
});
|
|
23956
23969
|
}
|
|
23957
23970
|
return groups.filter((group) => group.conversations.length > 0 || group.id !== null);
|
|
23958
|
-
}, [projects,
|
|
23971
|
+
}, [projects, conversations, collapsedProjects]);
|
|
23959
23972
|
const filteredProjectGroups = (0, import_react48.useMemo)(() => {
|
|
23960
23973
|
if (!searchQuery.trim()) return projectGroups;
|
|
23961
23974
|
const query = searchQuery.toLowerCase();
|
|
@@ -25509,6 +25522,9 @@ var init_chat_app_bar = __esm({
|
|
|
25509
25522
|
const { conversations, currentId, createNewConversation, _hasHydrated } = useConversationStore();
|
|
25510
25523
|
const { preferences } = usePreferencesStore();
|
|
25511
25524
|
const { settings: packageSettings } = usePackageSettingsStore();
|
|
25525
|
+
const isPlaygroundRoute = typeof window !== "undefined" && window.location.pathname.includes("/playground");
|
|
25526
|
+
const isPlaygroundMode3 = Boolean(packageSettings?.playgroundMode) || (packageSettings?.gatewayApiUrl ?? "").toLowerCase().startsWith("playground://") || typeof window !== "undefined" && window.location.pathname.startsWith("/playground");
|
|
25527
|
+
const managementPath = isPlaygroundMode3 ? "/playground/management" : "/management";
|
|
25512
25528
|
const {
|
|
25513
25529
|
syncEnabled,
|
|
25514
25530
|
syncStatus,
|
|
@@ -25682,10 +25698,10 @@ var init_chat_app_bar = __esm({
|
|
|
25682
25698
|
showLimitedAdminPanel() && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material40.Tooltip, { title: "Management & Settings", arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
25683
25699
|
import_material40.IconButton,
|
|
25684
25700
|
{
|
|
25685
|
-
onClick: () => safeNavigate(
|
|
25701
|
+
onClick: () => safeNavigate(managementPath),
|
|
25686
25702
|
sx: {
|
|
25687
25703
|
...pillButtonStyles,
|
|
25688
|
-
...window.location.pathname ===
|
|
25704
|
+
...typeof window !== "undefined" && window.location.pathname === managementPath && {
|
|
25689
25705
|
bgcolor: theme.palette.primary.main + "20",
|
|
25690
25706
|
color: theme.palette.primary.main
|
|
25691
25707
|
}
|
|
@@ -36811,7 +36827,7 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
36811
36827
|
]);
|
|
36812
36828
|
const calculatedUsed = categories.reduce((sum, cat) => sum + cat.size, 0);
|
|
36813
36829
|
const browserQuota = quotaEstimate.quota && quotaEstimate.quota > 0 ? quotaEstimate.quota : 0;
|
|
36814
|
-
|
|
36830
|
+
const normalizedQuota = browserQuota > 0 ? Math.min(Math.max(browserQuota, calculatedUsed || DEFAULT_DISPLAY_QUOTA_BYTES), MAX_DISPLAY_QUOTA_BYTES) : Math.max(DEFAULT_DISPLAY_QUOTA_BYTES, calculatedUsed);
|
|
36815
36831
|
const available = Math.max(normalizedQuota - calculatedUsed, 0);
|
|
36816
36832
|
debugLogger.info("Storage data loaded successfully", {
|
|
36817
36833
|
browserQuota,
|
|
@@ -38140,7 +38156,19 @@ var import_Settings2 = __toESM(require("@mui/icons-material/Settings"));
|
|
|
38140
38156
|
init_packageSettingsStore();
|
|
38141
38157
|
init_authenticationService();
|
|
38142
38158
|
init_debugLogger();
|
|
38159
|
+
var isPlaygroundMode = () => {
|
|
38160
|
+
const settings = usePackageSettingsStore.getState().settings;
|
|
38161
|
+
if (!settings) {
|
|
38162
|
+
return false;
|
|
38163
|
+
}
|
|
38164
|
+
const gatewayUrl = settings.gatewayApiUrl?.toLowerCase() ?? "";
|
|
38165
|
+
return Boolean(settings.playgroundMode || gatewayUrl.startsWith("playground://"));
|
|
38166
|
+
};
|
|
38143
38167
|
function buildUrl2(path) {
|
|
38168
|
+
if (isPlaygroundMode()) {
|
|
38169
|
+
debugLogger.info("MCP controller URL build skipped in playground mode", { path });
|
|
38170
|
+
return path.startsWith("/") ? path : `/${path}`;
|
|
38171
|
+
}
|
|
38144
38172
|
const base = usePackageSettingsStore.getState().settings?.gatewayApiUrl?.replace(/\/$/, "") || "";
|
|
38145
38173
|
if (base) {
|
|
38146
38174
|
const normalized = path.startsWith("/") ? path : `/${path}`;
|
|
@@ -38155,6 +38183,10 @@ function authHeaders() {
|
|
|
38155
38183
|
return headers;
|
|
38156
38184
|
}
|
|
38157
38185
|
async function fetchAvailableMcpTools() {
|
|
38186
|
+
if (isPlaygroundMode()) {
|
|
38187
|
+
debugLogger.info("Skipping remote MCP tool fetch \u2014 playground mode active");
|
|
38188
|
+
return [];
|
|
38189
|
+
}
|
|
38158
38190
|
const url = buildUrl2("/mcp/tools");
|
|
38159
38191
|
try {
|
|
38160
38192
|
const res = await fetch(url, { headers: authHeaders() });
|
|
@@ -38169,6 +38201,16 @@ async function fetchAvailableMcpTools() {
|
|
|
38169
38201
|
}
|
|
38170
38202
|
}
|
|
38171
38203
|
async function fetchMcpHealth() {
|
|
38204
|
+
if (isPlaygroundMode()) {
|
|
38205
|
+
debugLogger.info("Returning mocked MCP health \u2014 playground mode active");
|
|
38206
|
+
return {
|
|
38207
|
+
status: "healthy",
|
|
38208
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
38209
|
+
totalTools: 0,
|
|
38210
|
+
enabledTools: 0,
|
|
38211
|
+
availableTools: []
|
|
38212
|
+
};
|
|
38213
|
+
}
|
|
38172
38214
|
const url = buildUrl2("/mcp/health");
|
|
38173
38215
|
try {
|
|
38174
38216
|
const res = await fetch(url, { headers: authHeaders() });
|