@burtson-labs/bandit-engine 2.0.125 → 2.0.126
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-SC6CFUED.mjs → chat-Z3GRZ7GA.mjs} +2 -2
- package/dist/{chunk-2WFTEJPS.mjs → chunk-JXFPCLEY.mjs} +63 -17
- package/dist/chunk-JXFPCLEY.mjs.map +1 -0
- package/dist/{chunk-ID6CTZ3G.mjs → chunk-RKA3X3EY.mjs} +2 -2
- package/dist/index.js +63 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/management/management.js +63 -17
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-2WFTEJPS.mjs.map +0 -1
- /package/dist/{chat-SC6CFUED.mjs.map → chat-Z3GRZ7GA.mjs.map} +0 -0
- /package/dist/{chunk-ID6CTZ3G.mjs.map → chunk-RKA3X3EY.mjs.map} +0 -0
|
@@ -9754,7 +9754,7 @@ var MCPToolsTabV2_default = MCPToolsTabV2;
|
|
|
9754
9754
|
|
|
9755
9755
|
// src/management/management.tsx
|
|
9756
9756
|
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
9757
|
-
var preloadChatPage = () => import("./chat-
|
|
9757
|
+
var preloadChatPage = () => import("./chat-Z3GRZ7GA.mjs");
|
|
9758
9758
|
var buildCapabilitiesUrl = (gatewayApiUrl) => {
|
|
9759
9759
|
const trimmed = gatewayApiUrl.replace(/\/$/, "");
|
|
9760
9760
|
if (trimmed.endsWith("/api")) {
|
|
@@ -11110,4 +11110,4 @@ export {
|
|
|
11110
11110
|
useGatewayMemory,
|
|
11111
11111
|
management_default
|
|
11112
11112
|
};
|
|
11113
|
-
//# sourceMappingURL=chunk-
|
|
11113
|
+
//# sourceMappingURL=chunk-RKA3X3EY.mjs.map
|
package/dist/index.js
CHANGED
|
@@ -15742,7 +15742,7 @@ var init_source_chips = __esm({
|
|
|
15742
15742
|
});
|
|
15743
15743
|
|
|
15744
15744
|
// src/chat/chat-messages.tsx
|
|
15745
|
-
var import_material12, import_jsx_runtime15, ChatMessages, chat_messages_default;
|
|
15745
|
+
var import_material12, import_jsx_runtime15, WORKING_TOKEN_RE, ToolWorkingChip, ChatMessages, chat_messages_default;
|
|
15746
15746
|
var init_chat_messages = __esm({
|
|
15747
15747
|
"src/chat/chat-messages.tsx"() {
|
|
15748
15748
|
"use strict";
|
|
@@ -15752,6 +15752,38 @@ var init_chat_messages = __esm({
|
|
|
15752
15752
|
init_source_chips();
|
|
15753
15753
|
init_conversationStore();
|
|
15754
15754
|
import_jsx_runtime15 = require("react/jsx-runtime");
|
|
15755
|
+
WORKING_TOKEN_RE = /\s*<<working:([^>]*)>>\s*$/;
|
|
15756
|
+
ToolWorkingChip = ({ label }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
15757
|
+
import_material12.Box,
|
|
15758
|
+
{
|
|
15759
|
+
sx: (theme) => ({
|
|
15760
|
+
display: "inline-flex",
|
|
15761
|
+
alignItems: "center",
|
|
15762
|
+
gap: 1.25,
|
|
15763
|
+
mt: 1.5,
|
|
15764
|
+
px: 1.75,
|
|
15765
|
+
py: 0.9,
|
|
15766
|
+
borderRadius: 999,
|
|
15767
|
+
bgcolor: theme.palette.action.hover,
|
|
15768
|
+
border: `1px solid ${theme.palette.divider}`
|
|
15769
|
+
}),
|
|
15770
|
+
children: [
|
|
15771
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "typing-only", children: [
|
|
15772
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dot" }),
|
|
15773
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dot" }),
|
|
15774
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dot" })
|
|
15775
|
+
] }),
|
|
15776
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
15777
|
+
import_material12.Box,
|
|
15778
|
+
{
|
|
15779
|
+
component: "span",
|
|
15780
|
+
sx: { fontSize: "0.85rem", fontWeight: 500, color: "text.secondary", userSelect: "none" },
|
|
15781
|
+
children: label || "Working on it"
|
|
15782
|
+
}
|
|
15783
|
+
)
|
|
15784
|
+
]
|
|
15785
|
+
}
|
|
15786
|
+
);
|
|
15755
15787
|
ChatMessages = ({
|
|
15756
15788
|
pendingMessage,
|
|
15757
15789
|
streamBuffer,
|
|
@@ -15777,7 +15809,9 @@ var init_chat_messages = __esm({
|
|
|
15777
15809
|
const isPlaceholder = entry.answer === "...";
|
|
15778
15810
|
const showLoader = isLast && isStreaming && streamBuffer.trim() === "";
|
|
15779
15811
|
const showThinking = showLoader && isThinking;
|
|
15780
|
-
const
|
|
15812
|
+
const rawContent = isLast ? isStreaming ? streamBuffer || "" : isPlaceholder ? "" : entry.answer : entry.answer;
|
|
15813
|
+
const workingMatch = isLast && isStreaming ? rawContent.match(WORKING_TOKEN_RE) : null;
|
|
15814
|
+
const content = workingMatch ? rawContent.replace(WORKING_TOKEN_RE, "") : rawContent;
|
|
15781
15815
|
const rawSources = entry.sourceFiles;
|
|
15782
15816
|
const sourceSummaries = rawSources ? rawSources.filter((doc) => doc && typeof doc.name === "string" && doc.name.trim()).map((doc) => ({ id: doc.id || doc.name, name: doc.name.trim() })) : void 0;
|
|
15783
15817
|
const responseNode = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
@@ -15850,6 +15884,7 @@ var init_chat_messages = __esm({
|
|
|
15850
15884
|
sources: sourceSummaries
|
|
15851
15885
|
}
|
|
15852
15886
|
),
|
|
15887
|
+
workingMatch && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ToolWorkingChip, { label: workingMatch[1] }),
|
|
15853
15888
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(source_chips_default, { content })
|
|
15854
15889
|
]
|
|
15855
15890
|
}
|
|
@@ -15862,7 +15897,7 @@ var init_chat_messages = __esm({
|
|
|
15862
15897
|
{
|
|
15863
15898
|
question: entry.question,
|
|
15864
15899
|
response: responseNode,
|
|
15865
|
-
responseText:
|
|
15900
|
+
responseText: content,
|
|
15866
15901
|
backgroundColor: "#444",
|
|
15867
15902
|
images: entry.images,
|
|
15868
15903
|
memoryUpdated: entry.memoryUpdated && !isPlaceholder,
|
|
@@ -22000,8 +22035,20 @@ ${protocol}`;
|
|
|
22000
22035
|
return result.trimStart();
|
|
22001
22036
|
};
|
|
22002
22037
|
const stripToolBlocks = (text) => text.replace(/```(?:tool_code|TOOL_CODE)\s*\n[\s\S]*?\n```/gi, "").trim();
|
|
22038
|
+
const truncateAtToolApparatus = (text) => {
|
|
22039
|
+
let t = text;
|
|
22040
|
+
const fenceIdx = t.search(/```(?:tool_code|TOOL_CODE)/);
|
|
22041
|
+
if (fenceIdx !== -1) t = t.slice(0, fenceIdx);
|
|
22042
|
+
const callIdx = t.search(
|
|
22043
|
+
/\b(?:web_search|web_fetch|image_generation|create_file|ask_user)\s*\(/
|
|
22044
|
+
);
|
|
22045
|
+
if (callIdx !== -1) t = t.slice(0, callIdx);
|
|
22046
|
+
t = t.replace(/```[\w-]*\s*$/, "");
|
|
22047
|
+
const fenceCount = (t.match(/```/g) || []).length;
|
|
22048
|
+
if (fenceCount % 2 === 1) t = t.slice(0, t.lastIndexOf("```"));
|
|
22049
|
+
return t.trim();
|
|
22050
|
+
};
|
|
22003
22051
|
let workingLabel = "Working on it";
|
|
22004
|
-
let workingPreamble = "";
|
|
22005
22052
|
const stopWorking = () => {
|
|
22006
22053
|
if (workingTimer) {
|
|
22007
22054
|
clearInterval(workingTimer);
|
|
@@ -22010,17 +22057,10 @@ ${protocol}`;
|
|
|
22010
22057
|
};
|
|
22011
22058
|
const startWorking = (label = "Working on it") => {
|
|
22012
22059
|
workingLabel = label.replace(/[.…]+\s*$/, "").trim() || "Working on it";
|
|
22013
|
-
|
|
22014
|
-
|
|
22015
|
-
|
|
22016
|
-
|
|
22017
|
-
dots = (dots + 1) % 4;
|
|
22018
|
-
setStreamBuffer(
|
|
22019
|
-
`${workingPreamble}${workingPreamble ? "\n\n" : ""}_${workingLabel}${".".repeat(dots)}_`
|
|
22020
|
-
);
|
|
22021
|
-
};
|
|
22022
|
-
render();
|
|
22023
|
-
workingTimer = setInterval(render, 450);
|
|
22060
|
+
const preamble = truncateAtToolApparatus(stripToolBlocks(stripThinking(fullMessage)));
|
|
22061
|
+
setStreamBuffer(
|
|
22062
|
+
`${preamble}${preamble ? "\n\n" : ""}<<working:${workingLabel}>>`
|
|
22063
|
+
);
|
|
22024
22064
|
};
|
|
22025
22065
|
const flushNow = () => {
|
|
22026
22066
|
clearFlushTimer();
|
|
@@ -22066,10 +22106,16 @@ ${protocol}`;
|
|
|
22066
22106
|
const inThinkBlock = /<think>/.test(fullMessage) && !/<think>[\s\S]*<\/think>/.test(fullMessage);
|
|
22067
22107
|
setIsThinking?.(inThinkBlock);
|
|
22068
22108
|
const visibleMessage = stripThinking(fullMessage);
|
|
22069
|
-
|
|
22109
|
+
const bareToolMatch = visibleMessage.match(
|
|
22110
|
+
/\b(web_search|web_fetch|image_generation|create_file|ask_user)\s*\(/
|
|
22111
|
+
);
|
|
22112
|
+
if (/```(?:tool_code|TOOL_CODE)/.test(visibleMessage) || bareToolMatch) {
|
|
22070
22113
|
sawToolBlock = true;
|
|
22071
22114
|
clearFlushTimer();
|
|
22072
|
-
|
|
22115
|
+
const fn = bareToolMatch?.[1];
|
|
22116
|
+
startWorking(
|
|
22117
|
+
fn === "create_file" ? "Creating your file" : fn === "web_search" ? "Searching the web" : fn === "web_fetch" ? "Reading the page" : fn === "image_generation" ? "Generating the image" : "Working on it"
|
|
22118
|
+
);
|
|
22073
22119
|
}
|
|
22074
22120
|
latestDisplayMessage = visibleMessage;
|
|
22075
22121
|
if (!sawToolBlock) {
|