@burtson-labs/bandit-engine 2.0.61 → 2.0.62
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-E23BSMK5.mjs → chat-SN3UNX23.mjs} +2 -2
- package/dist/{chunk-SKMJ43NN.mjs → chunk-O7JGT7HR.mjs} +2 -2
- package/dist/{chunk-G7U2FNUK.mjs → chunk-Y4NDNAAR.mjs} +31 -12
- package/dist/chunk-Y4NDNAAR.mjs.map +1 -0
- package/dist/index.js +30 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/management/management.js +30 -11
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-G7U2FNUK.mjs.map +0 -1
- /package/dist/{chat-E23BSMK5.mjs.map → chat-SN3UNX23.mjs.map} +0 -0
- /package/dist/{chunk-SKMJ43NN.mjs.map → chunk-O7JGT7HR.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -20977,6 +20977,7 @@ ${protocol}`;
|
|
|
20977
20977
|
let fullMessage = "";
|
|
20978
20978
|
let latestDisplayMessage = "";
|
|
20979
20979
|
let sawToolBlock = false;
|
|
20980
|
+
const nativeToolCalls = [];
|
|
20980
20981
|
const stripThinking = (text) => {
|
|
20981
20982
|
let result = text.replace(/<think>[\s\S]*?<\/think>/g, "");
|
|
20982
20983
|
const openIdx = result.indexOf("<think>");
|
|
@@ -21015,6 +21016,11 @@ ${protocol}`;
|
|
|
21015
21016
|
const sub = stream.subscribe({
|
|
21016
21017
|
next: (data) => {
|
|
21017
21018
|
if (!data?.message?.content && !data?.message?.tool_calls) return;
|
|
21019
|
+
if (Array.isArray(data.message.tool_calls) && data.message.tool_calls.length > 0) {
|
|
21020
|
+
nativeToolCalls.push(...data.message.tool_calls);
|
|
21021
|
+
sawToolBlock = true;
|
|
21022
|
+
clearFlushTimer();
|
|
21023
|
+
}
|
|
21018
21024
|
if (data.message.content) {
|
|
21019
21025
|
fullMessage += data.message.content;
|
|
21020
21026
|
telemetryEvent("tool_loop:llm_chunk", { chunk: data.message.content });
|
|
@@ -21063,6 +21069,20 @@ ${protocol}`;
|
|
|
21063
21069
|
if (!sawToolBlock) {
|
|
21064
21070
|
flushNow();
|
|
21065
21071
|
}
|
|
21072
|
+
if (nativeToolCalls.length > 0 && !/```(?:tool_code|TOOL_CODE)/.test(fullMessage)) {
|
|
21073
|
+
for (const raw of nativeToolCalls) {
|
|
21074
|
+
const tc = raw;
|
|
21075
|
+
const fn = tc.function?.name ?? tc.name;
|
|
21076
|
+
if (!fn) continue;
|
|
21077
|
+
const rawArgs = tc.function?.arguments ?? tc.arguments ?? {};
|
|
21078
|
+
const argStr = typeof rawArgs === "string" ? rawArgs : JSON.stringify(rawArgs ?? {});
|
|
21079
|
+
fullMessage += `
|
|
21080
|
+
|
|
21081
|
+
\`\`\`tool_code
|
|
21082
|
+
${fn}(${argStr})
|
|
21083
|
+
\`\`\``;
|
|
21084
|
+
}
|
|
21085
|
+
}
|
|
21066
21086
|
const toolCallMatches = fullMessage.match(/```(?:tool_code|TOOL_CODE)\s*\n([^`]+)\n```/gi);
|
|
21067
21087
|
let enhancedMessage = fullMessage;
|
|
21068
21088
|
const summarizableResults = [];
|
|
@@ -25010,8 +25030,10 @@ var init_chat_app_bar = __esm({
|
|
|
25010
25030
|
const engines = useEngineStore((s) => s.engines);
|
|
25011
25031
|
const selectedEngine = useEngineStore((s) => s.selectedEngine);
|
|
25012
25032
|
const effectiveEngineId = selectedEngine || usePackageSettingsStore.getState().settings?.defaultModel || "bandit-core";
|
|
25013
|
-
const currentEngine = engines.find((e) => e.id === effectiveEngineId);
|
|
25014
|
-
const
|
|
25033
|
+
const currentEngine = engines.find((e) => e.id === effectiveEngineId) || engines.find((e) => effectiveEngineId.startsWith(e.id + ":"));
|
|
25034
|
+
const resolvedEngineId = currentEngine?.id ?? effectiveEngineId;
|
|
25035
|
+
const cleanEngineName = (name) => (name || "").replace(/\s*\([^)]*\)\s*$/, "").trim();
|
|
25036
|
+
const engineDisplay = cleanEngineName(currentEngine?.displayName) || "Engine";
|
|
25015
25037
|
(0, import_react31.useEffect)(() => {
|
|
25016
25038
|
useEngineStore.getState().fetchEngines();
|
|
25017
25039
|
}, []);
|
|
@@ -25327,16 +25349,13 @@ var init_chat_app_bar = __esm({
|
|
|
25327
25349
|
)
|
|
25328
25350
|
}
|
|
25329
25351
|
) }),
|
|
25330
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material23.Tooltip, { title: `Engine
|
|
25352
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material23.Tooltip, { title: `Engine \xB7 ${engineDisplay}`, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
25331
25353
|
import_material23.IconButton,
|
|
25332
25354
|
{
|
|
25333
25355
|
onClick: (e) => setEngineAnchorEl(e.currentTarget),
|
|
25334
25356
|
sx: pillButtonStyles,
|
|
25335
|
-
"aria-label": `Change base model (engine). Currently ${
|
|
25336
|
-
children:
|
|
25337
|
-
currentEngine?.cloud ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CloudDoneIcon, { fontSize: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CloudOffIcon, { fontSize: "small" }),
|
|
25338
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material23.Typography, { variant: "caption", sx: { ml: 0.75, fontWeight: 600, whiteSpace: "nowrap" }, children: engineLabel })
|
|
25339
|
-
]
|
|
25357
|
+
"aria-label": `Change base model (engine). Currently ${engineDisplay}`,
|
|
25358
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PsychologyIcon, { fontSize: "small" })
|
|
25340
25359
|
}
|
|
25341
25360
|
) }),
|
|
25342
25361
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
@@ -25360,7 +25379,7 @@ var init_chat_app_bar = __esm({
|
|
|
25360
25379
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
25361
25380
|
import_material23.MenuItem,
|
|
25362
25381
|
{
|
|
25363
|
-
selected: engine.id ===
|
|
25382
|
+
selected: engine.id === resolvedEngineId,
|
|
25364
25383
|
disabled: !engine.available,
|
|
25365
25384
|
onClick: () => {
|
|
25366
25385
|
useEngineStore.getState().setSelectedEngine(engine.id);
|
|
@@ -25378,8 +25397,8 @@ var init_chat_app_bar = __esm({
|
|
|
25378
25397
|
},
|
|
25379
25398
|
children: [
|
|
25380
25399
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material23.Box, { sx: { display: "flex", alignItems: "center", gap: 1, width: "100%" }, children: [
|
|
25381
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material23.Typography, { variant: "body2", sx: { fontWeight: 600, flex: 1 }, children: engine.displayName }),
|
|
25382
|
-
engine.id ===
|
|
25400
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material23.Typography, { variant: "body2", sx: { fontWeight: 600, flex: 1 }, children: cleanEngineName(engine.displayName) }),
|
|
25401
|
+
engine.id === resolvedEngineId && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material23.Box, { sx: { width: 8, height: 8, borderRadius: "50%", bgcolor: theme.palette.primary.main } })
|
|
25383
25402
|
] }),
|
|
25384
25403
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material23.Typography, { variant: "caption", sx: { color: theme.palette.text.secondary }, children: engine.available ? engine.description : engine.unavailableReason || "Unavailable" }),
|
|
25385
25404
|
badges.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material23.Box, { sx: { display: "flex", gap: 0.5, flexWrap: "wrap", mt: 0.25 }, children: badges.map((b) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|