@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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  chat_default
3
- } from "./chunk-G7U2FNUK.mjs";
3
+ } from "./chunk-Y4NDNAAR.mjs";
4
4
  import "./chunk-ONQMRE2G.mjs";
5
5
  import "./chunk-SRCCNBHF.mjs";
6
6
  import "./chunk-6QTTNYF2.mjs";
@@ -13,4 +13,4 @@ import "./chunk-BJTO5JO5.mjs";
13
13
  export {
14
14
  chat_default as default
15
15
  };
16
- //# sourceMappingURL=chat-E23BSMK5.mjs.map
16
+ //# sourceMappingURL=chat-SN3UNX23.mjs.map
@@ -9459,7 +9459,7 @@ var MCPToolsTabV2_default = MCPToolsTabV2;
9459
9459
 
9460
9460
  // src/management/management.tsx
9461
9461
  import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
9462
- var preloadChatPage = () => import("./chat-E23BSMK5.mjs");
9462
+ var preloadChatPage = () => import("./chat-SN3UNX23.mjs");
9463
9463
  var buildCapabilitiesUrl = (gatewayApiUrl) => {
9464
9464
  const trimmed = gatewayApiUrl.replace(/\/$/, "");
9465
9465
  if (trimmed.endsWith("/api")) {
@@ -10804,4 +10804,4 @@ export {
10804
10804
  useGatewayMemory,
10805
10805
  management_default
10806
10806
  };
10807
- //# sourceMappingURL=chunk-SKMJ43NN.mjs.map
10807
+ //# sourceMappingURL=chunk-O7JGT7HR.mjs.map
@@ -3169,6 +3169,7 @@ ${protocol}`;
3169
3169
  let fullMessage = "";
3170
3170
  let latestDisplayMessage = "";
3171
3171
  let sawToolBlock = false;
3172
+ const nativeToolCalls = [];
3172
3173
  const stripThinking = (text) => {
3173
3174
  let result = text.replace(/<think>[\s\S]*?<\/think>/g, "");
3174
3175
  const openIdx = result.indexOf("<think>");
@@ -3207,6 +3208,11 @@ ${protocol}`;
3207
3208
  const sub = stream.subscribe({
3208
3209
  next: (data) => {
3209
3210
  if (!data?.message?.content && !data?.message?.tool_calls) return;
3211
+ if (Array.isArray(data.message.tool_calls) && data.message.tool_calls.length > 0) {
3212
+ nativeToolCalls.push(...data.message.tool_calls);
3213
+ sawToolBlock = true;
3214
+ clearFlushTimer();
3215
+ }
3210
3216
  if (data.message.content) {
3211
3217
  fullMessage += data.message.content;
3212
3218
  telemetryEvent("tool_loop:llm_chunk", { chunk: data.message.content });
@@ -3255,6 +3261,20 @@ ${protocol}`;
3255
3261
  if (!sawToolBlock) {
3256
3262
  flushNow();
3257
3263
  }
3264
+ if (nativeToolCalls.length > 0 && !/```(?:tool_code|TOOL_CODE)/.test(fullMessage)) {
3265
+ for (const raw of nativeToolCalls) {
3266
+ const tc = raw;
3267
+ const fn = tc.function?.name ?? tc.name;
3268
+ if (!fn) continue;
3269
+ const rawArgs = tc.function?.arguments ?? tc.arguments ?? {};
3270
+ const argStr = typeof rawArgs === "string" ? rawArgs : JSON.stringify(rawArgs ?? {});
3271
+ fullMessage += `
3272
+
3273
+ \`\`\`tool_code
3274
+ ${fn}(${argStr})
3275
+ \`\`\``;
3276
+ }
3277
+ }
3258
3278
  const toolCallMatches = fullMessage.match(/```(?:tool_code|TOOL_CODE)\s*\n([^`]+)\n```/gi);
3259
3279
  let enhancedMessage = fullMessage;
3260
3280
  const summarizableResults = [];
@@ -7222,8 +7242,10 @@ var ChatAppBar = ({
7222
7242
  const engines = useEngineStore((s) => s.engines);
7223
7243
  const selectedEngine = useEngineStore((s) => s.selectedEngine);
7224
7244
  const effectiveEngineId = selectedEngine || usePackageSettingsStore.getState().settings?.defaultModel || "bandit-core";
7225
- const currentEngine = engines.find((e) => e.id === effectiveEngineId);
7226
- const engineLabel = currentEngine?.displayName?.replace(/^Bandit /, "") || "Engine";
7245
+ const currentEngine = engines.find((e) => e.id === effectiveEngineId) || engines.find((e) => effectiveEngineId.startsWith(e.id + ":"));
7246
+ const resolvedEngineId = currentEngine?.id ?? effectiveEngineId;
7247
+ const cleanEngineName = (name) => (name || "").replace(/\s*\([^)]*\)\s*$/, "").trim();
7248
+ const engineDisplay = cleanEngineName(currentEngine?.displayName) || "Engine";
7227
7249
  useEffect11(() => {
7228
7250
  useEngineStore.getState().fetchEngines();
7229
7251
  }, []);
@@ -7539,16 +7561,13 @@ var ChatAppBar = ({
7539
7561
  )
7540
7562
  }
7541
7563
  ) }),
7542
- /* @__PURE__ */ jsx13(Tooltip4, { title: `Engine: ${currentEngine?.displayName ?? effectiveEngineId}`, arrow: true, children: /* @__PURE__ */ jsxs10(
7564
+ /* @__PURE__ */ jsx13(Tooltip4, { title: `Engine \xB7 ${engineDisplay}`, arrow: true, children: /* @__PURE__ */ jsx13(
7543
7565
  IconButton9,
7544
7566
  {
7545
7567
  onClick: (e) => setEngineAnchorEl(e.currentTarget),
7546
7568
  sx: pillButtonStyles,
7547
- "aria-label": `Change base model (engine). Currently ${effectiveEngineId}`,
7548
- children: [
7549
- currentEngine?.cloud ? /* @__PURE__ */ jsx13(CloudDoneIcon, { fontSize: "small" }) : /* @__PURE__ */ jsx13(CloudOffIcon, { fontSize: "small" }),
7550
- /* @__PURE__ */ jsx13(Typography8, { variant: "caption", sx: { ml: 0.75, fontWeight: 600, whiteSpace: "nowrap" }, children: engineLabel })
7551
- ]
7569
+ "aria-label": `Change base model (engine). Currently ${engineDisplay}`,
7570
+ children: /* @__PURE__ */ jsx13(PsychologyIcon, { fontSize: "small" })
7552
7571
  }
7553
7572
  ) }),
7554
7573
  /* @__PURE__ */ jsxs10(
@@ -7572,7 +7591,7 @@ var ChatAppBar = ({
7572
7591
  return /* @__PURE__ */ jsxs10(
7573
7592
  MenuItem5,
7574
7593
  {
7575
- selected: engine.id === effectiveEngineId,
7594
+ selected: engine.id === resolvedEngineId,
7576
7595
  disabled: !engine.available,
7577
7596
  onClick: () => {
7578
7597
  useEngineStore.getState().setSelectedEngine(engine.id);
@@ -7590,8 +7609,8 @@ var ChatAppBar = ({
7590
7609
  },
7591
7610
  children: [
7592
7611
  /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", alignItems: "center", gap: 1, width: "100%" }, children: [
7593
- /* @__PURE__ */ jsx13(Typography8, { variant: "body2", sx: { fontWeight: 600, flex: 1 }, children: engine.displayName }),
7594
- engine.id === effectiveEngineId && /* @__PURE__ */ jsx13(Box10, { sx: { width: 8, height: 8, borderRadius: "50%", bgcolor: theme.palette.primary.main } })
7612
+ /* @__PURE__ */ jsx13(Typography8, { variant: "body2", sx: { fontWeight: 600, flex: 1 }, children: cleanEngineName(engine.displayName) }),
7613
+ engine.id === resolvedEngineId && /* @__PURE__ */ jsx13(Box10, { sx: { width: 8, height: 8, borderRadius: "50%", bgcolor: theme.palette.primary.main } })
7595
7614
  ] }),
7596
7615
  /* @__PURE__ */ jsx13(Typography8, { variant: "caption", sx: { color: theme.palette.text.secondary }, children: engine.available ? engine.description : engine.unavailableReason || "Unavailable" }),
7597
7616
  badges.length > 0 && /* @__PURE__ */ jsx13(Box10, { sx: { display: "flex", gap: 0.5, flexWrap: "wrap", mt: 0.25 }, children: badges.map((b) => /* @__PURE__ */ jsx13(
@@ -9722,4 +9741,4 @@ var chat_default = Chat;
9722
9741
  export {
9723
9742
  chat_default
9724
9743
  };
9725
- //# sourceMappingURL=chunk-G7U2FNUK.mjs.map
9744
+ //# sourceMappingURL=chunk-Y4NDNAAR.mjs.map