@burtson-labs/bandit-engine 2.0.124 → 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-QBDECLF3.mjs → chat-Z3GRZ7GA.mjs} +4 -4
- package/dist/{chunk-WSNV6EX5.mjs → chunk-574ILQTT.mjs} +2 -2
- package/dist/{chunk-QPZC6GTA.mjs → chunk-JXFPCLEY.mjs} +65 -19
- package/dist/chunk-JXFPCLEY.mjs.map +1 -0
- package/dist/{chunk-JJTUEC2E.mjs → chunk-OLKDPUWL.mjs} +10 -4
- package/dist/chunk-OLKDPUWL.mjs.map +1 -0
- package/dist/{chunk-K5HAVOPD.mjs → chunk-RKA3X3EY.mjs} +5 -5
- package/dist/{chunk-4RRQQPFZ.mjs → chunk-TQP3GUW5.mjs} +2 -2
- package/dist/index.js +72 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/management/management.js +72 -20
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +4 -4
- package/dist/modals/chat-modal/chat-modal.js +9 -3
- package/dist/modals/chat-modal/chat-modal.js.map +1 -1
- package/dist/modals/chat-modal/chat-modal.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-JJTUEC2E.mjs.map +0 -1
- package/dist/chunk-QPZC6GTA.mjs.map +0 -1
- /package/dist/{chat-QBDECLF3.mjs.map → chat-Z3GRZ7GA.mjs.map} +0 -0
- /package/dist/{chunk-WSNV6EX5.mjs.map → chunk-574ILQTT.mjs.map} +0 -0
- /package/dist/{chunk-K5HAVOPD.mjs.map → chunk-RKA3X3EY.mjs.map} +0 -0
- /package/dist/{chunk-4RRQQPFZ.mjs.map → chunk-TQP3GUW5.mjs.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
chat_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JXFPCLEY.mjs";
|
|
4
4
|
import "./chunk-ONQMRE2G.mjs";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-574ILQTT.mjs";
|
|
6
6
|
import "./chunk-K2JGFKEB.mjs";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-OLKDPUWL.mjs";
|
|
8
8
|
import "./chunk-6ONL4SRK.mjs";
|
|
9
9
|
import "./chunk-EORIRPPX.mjs";
|
|
10
10
|
import "./chunk-43MLINPL.mjs";
|
|
@@ -13,4 +13,4 @@ import "./chunk-BJTO5JO5.mjs";
|
|
|
13
13
|
export {
|
|
14
14
|
chat_default as default
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=chat-
|
|
16
|
+
//# sourceMappingURL=chat-Z3GRZ7GA.mjs.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
getHighlightTree,
|
|
5
5
|
markdownSanitizeSchema,
|
|
6
6
|
renderLowlightChildren
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-OLKDPUWL.mjs";
|
|
8
8
|
|
|
9
9
|
// src/components/StreamingMarkdown.tsx
|
|
10
10
|
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -495,4 +495,4 @@ var StreamingMarkdown_default = React.memo(StreamingMarkdown, arePropsEqual);
|
|
|
495
495
|
export {
|
|
496
496
|
StreamingMarkdown_default
|
|
497
497
|
};
|
|
498
|
-
//# sourceMappingURL=chunk-
|
|
498
|
+
//# sourceMappingURL=chunk-574ILQTT.mjs.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-ONQMRE2G.mjs";
|
|
4
4
|
import {
|
|
5
5
|
StreamingMarkdown_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-574ILQTT.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useMCPToolsStore
|
|
9
9
|
} from "./chunk-K2JGFKEB.mjs";
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
useNotificationService,
|
|
41
41
|
useTTS,
|
|
42
42
|
useVoiceStore
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-OLKDPUWL.mjs";
|
|
44
44
|
import {
|
|
45
45
|
brandingService_default,
|
|
46
46
|
detectMessageMood,
|
|
@@ -723,6 +723,38 @@ var source_chips_default = SourceChips;
|
|
|
723
723
|
|
|
724
724
|
// src/chat/chat-messages.tsx
|
|
725
725
|
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
726
|
+
var WORKING_TOKEN_RE = /\s*<<working:([^>]*)>>\s*$/;
|
|
727
|
+
var ToolWorkingChip = ({ label }) => /* @__PURE__ */ jsxs3(
|
|
728
|
+
Box4,
|
|
729
|
+
{
|
|
730
|
+
sx: (theme) => ({
|
|
731
|
+
display: "inline-flex",
|
|
732
|
+
alignItems: "center",
|
|
733
|
+
gap: 1.25,
|
|
734
|
+
mt: 1.5,
|
|
735
|
+
px: 1.75,
|
|
736
|
+
py: 0.9,
|
|
737
|
+
borderRadius: 999,
|
|
738
|
+
bgcolor: theme.palette.action.hover,
|
|
739
|
+
border: `1px solid ${theme.palette.divider}`
|
|
740
|
+
}),
|
|
741
|
+
children: [
|
|
742
|
+
/* @__PURE__ */ jsxs3("div", { className: "typing-only", children: [
|
|
743
|
+
/* @__PURE__ */ jsx6("span", { className: "dot" }),
|
|
744
|
+
/* @__PURE__ */ jsx6("span", { className: "dot" }),
|
|
745
|
+
/* @__PURE__ */ jsx6("span", { className: "dot" })
|
|
746
|
+
] }),
|
|
747
|
+
/* @__PURE__ */ jsx6(
|
|
748
|
+
Box4,
|
|
749
|
+
{
|
|
750
|
+
component: "span",
|
|
751
|
+
sx: { fontSize: "0.85rem", fontWeight: 500, color: "text.secondary", userSelect: "none" },
|
|
752
|
+
children: label || "Working on it"
|
|
753
|
+
}
|
|
754
|
+
)
|
|
755
|
+
]
|
|
756
|
+
}
|
|
757
|
+
);
|
|
726
758
|
var ChatMessages = ({
|
|
727
759
|
pendingMessage,
|
|
728
760
|
streamBuffer,
|
|
@@ -748,7 +780,9 @@ var ChatMessages = ({
|
|
|
748
780
|
const isPlaceholder = entry.answer === "...";
|
|
749
781
|
const showLoader = isLast && isStreaming && streamBuffer.trim() === "";
|
|
750
782
|
const showThinking = showLoader && isThinking;
|
|
751
|
-
const
|
|
783
|
+
const rawContent = isLast ? isStreaming ? streamBuffer || "" : isPlaceholder ? "" : entry.answer : entry.answer;
|
|
784
|
+
const workingMatch = isLast && isStreaming ? rawContent.match(WORKING_TOKEN_RE) : null;
|
|
785
|
+
const content = workingMatch ? rawContent.replace(WORKING_TOKEN_RE, "") : rawContent;
|
|
752
786
|
const rawSources = entry.sourceFiles;
|
|
753
787
|
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;
|
|
754
788
|
const responseNode = /* @__PURE__ */ jsxs3(
|
|
@@ -821,6 +855,7 @@ var ChatMessages = ({
|
|
|
821
855
|
sources: sourceSummaries
|
|
822
856
|
}
|
|
823
857
|
),
|
|
858
|
+
workingMatch && /* @__PURE__ */ jsx6(ToolWorkingChip, { label: workingMatch[1] }),
|
|
824
859
|
/* @__PURE__ */ jsx6(source_chips_default, { content })
|
|
825
860
|
]
|
|
826
861
|
}
|
|
@@ -833,7 +868,7 @@ var ChatMessages = ({
|
|
|
833
868
|
{
|
|
834
869
|
question: entry.question,
|
|
835
870
|
response: responseNode,
|
|
836
|
-
responseText:
|
|
871
|
+
responseText: content,
|
|
837
872
|
backgroundColor: "#444",
|
|
838
873
|
images: entry.images,
|
|
839
874
|
memoryUpdated: entry.memoryUpdated && !isPlaceholder,
|
|
@@ -4214,8 +4249,20 @@ ${protocol}`;
|
|
|
4214
4249
|
return result.trimStart();
|
|
4215
4250
|
};
|
|
4216
4251
|
const stripToolBlocks = (text) => text.replace(/```(?:tool_code|TOOL_CODE)\s*\n[\s\S]*?\n```/gi, "").trim();
|
|
4252
|
+
const truncateAtToolApparatus = (text) => {
|
|
4253
|
+
let t = text;
|
|
4254
|
+
const fenceIdx = t.search(/```(?:tool_code|TOOL_CODE)/);
|
|
4255
|
+
if (fenceIdx !== -1) t = t.slice(0, fenceIdx);
|
|
4256
|
+
const callIdx = t.search(
|
|
4257
|
+
/\b(?:web_search|web_fetch|image_generation|create_file|ask_user)\s*\(/
|
|
4258
|
+
);
|
|
4259
|
+
if (callIdx !== -1) t = t.slice(0, callIdx);
|
|
4260
|
+
t = t.replace(/```[\w-]*\s*$/, "");
|
|
4261
|
+
const fenceCount = (t.match(/```/g) || []).length;
|
|
4262
|
+
if (fenceCount % 2 === 1) t = t.slice(0, t.lastIndexOf("```"));
|
|
4263
|
+
return t.trim();
|
|
4264
|
+
};
|
|
4217
4265
|
let workingLabel = "Working on it";
|
|
4218
|
-
let workingPreamble = "";
|
|
4219
4266
|
const stopWorking = () => {
|
|
4220
4267
|
if (workingTimer) {
|
|
4221
4268
|
clearInterval(workingTimer);
|
|
@@ -4224,17 +4271,10 @@ ${protocol}`;
|
|
|
4224
4271
|
};
|
|
4225
4272
|
const startWorking = (label = "Working on it") => {
|
|
4226
4273
|
workingLabel = label.replace(/[.…]+\s*$/, "").trim() || "Working on it";
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
dots = (dots + 1) % 4;
|
|
4232
|
-
setStreamBuffer(
|
|
4233
|
-
`${workingPreamble}${workingPreamble ? "\n\n" : ""}_${workingLabel}${".".repeat(dots)}_`
|
|
4234
|
-
);
|
|
4235
|
-
};
|
|
4236
|
-
render();
|
|
4237
|
-
workingTimer = setInterval(render, 450);
|
|
4274
|
+
const preamble = truncateAtToolApparatus(stripToolBlocks(stripThinking(fullMessage)));
|
|
4275
|
+
setStreamBuffer(
|
|
4276
|
+
`${preamble}${preamble ? "\n\n" : ""}<<working:${workingLabel}>>`
|
|
4277
|
+
);
|
|
4238
4278
|
};
|
|
4239
4279
|
const flushNow = () => {
|
|
4240
4280
|
clearFlushTimer();
|
|
@@ -4280,10 +4320,16 @@ ${protocol}`;
|
|
|
4280
4320
|
const inThinkBlock = /<think>/.test(fullMessage) && !/<think>[\s\S]*<\/think>/.test(fullMessage);
|
|
4281
4321
|
setIsThinking?.(inThinkBlock);
|
|
4282
4322
|
const visibleMessage = stripThinking(fullMessage);
|
|
4283
|
-
|
|
4323
|
+
const bareToolMatch = visibleMessage.match(
|
|
4324
|
+
/\b(web_search|web_fetch|image_generation|create_file|ask_user)\s*\(/
|
|
4325
|
+
);
|
|
4326
|
+
if (/```(?:tool_code|TOOL_CODE)/.test(visibleMessage) || bareToolMatch) {
|
|
4284
4327
|
sawToolBlock = true;
|
|
4285
4328
|
clearFlushTimer();
|
|
4286
|
-
|
|
4329
|
+
const fn = bareToolMatch?.[1];
|
|
4330
|
+
startWorking(
|
|
4331
|
+
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"
|
|
4332
|
+
);
|
|
4287
4333
|
}
|
|
4288
4334
|
latestDisplayMessage = visibleMessage;
|
|
4289
4335
|
if (!sawToolBlock) {
|
|
@@ -11498,4 +11544,4 @@ var chat_default = Chat;
|
|
|
11498
11544
|
export {
|
|
11499
11545
|
chat_default
|
|
11500
11546
|
};
|
|
11501
|
-
//# sourceMappingURL=chunk-
|
|
11547
|
+
//# sourceMappingURL=chunk-JXFPCLEY.mjs.map
|