@burtson-labs/bandit-engine 2.0.61 → 2.0.63

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.
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-ONQMRE2G.mjs";
4
4
  import {
5
5
  StreamingMarkdown_default
6
- } from "./chunk-SRCCNBHF.mjs";
6
+ } from "./chunk-E4Q7BHBQ.mjs";
7
7
  import {
8
8
  useMCPToolsStore
9
9
  } from "./chunk-6QTTNYF2.mjs";
@@ -11,6 +11,7 @@ import {
11
11
  AddIcon,
12
12
  ArrowDownwardIcon,
13
13
  ArrowUpwardIcon,
14
+ AutoAwesomeIcon,
14
15
  CheckIcon,
15
16
  CloseIcon,
16
17
  CloudDoneIcon,
@@ -42,7 +43,7 @@ import {
42
43
  useNotificationService,
43
44
  useTTS,
44
45
  useVoiceStore
45
- } from "./chunk-5WQMMCZQ.mjs";
46
+ } from "./chunk-NCMSNXB2.mjs";
46
47
  import {
47
48
  authenticationService,
48
49
  brandingService_default,
@@ -3169,6 +3170,7 @@ ${protocol}`;
3169
3170
  let fullMessage = "";
3170
3171
  let latestDisplayMessage = "";
3171
3172
  let sawToolBlock = false;
3173
+ const nativeToolCalls = [];
3172
3174
  const stripThinking = (text) => {
3173
3175
  let result = text.replace(/<think>[\s\S]*?<\/think>/g, "");
3174
3176
  const openIdx = result.indexOf("<think>");
@@ -3207,6 +3209,11 @@ ${protocol}`;
3207
3209
  const sub = stream.subscribe({
3208
3210
  next: (data) => {
3209
3211
  if (!data?.message?.content && !data?.message?.tool_calls) return;
3212
+ if (Array.isArray(data.message.tool_calls) && data.message.tool_calls.length > 0) {
3213
+ nativeToolCalls.push(...data.message.tool_calls);
3214
+ sawToolBlock = true;
3215
+ clearFlushTimer();
3216
+ }
3210
3217
  if (data.message.content) {
3211
3218
  fullMessage += data.message.content;
3212
3219
  telemetryEvent("tool_loop:llm_chunk", { chunk: data.message.content });
@@ -3255,6 +3262,20 @@ ${protocol}`;
3255
3262
  if (!sawToolBlock) {
3256
3263
  flushNow();
3257
3264
  }
3265
+ if (nativeToolCalls.length > 0 && !/```(?:tool_code|TOOL_CODE)/.test(fullMessage)) {
3266
+ for (const raw of nativeToolCalls) {
3267
+ const tc = raw;
3268
+ const fn = tc.function?.name ?? tc.name;
3269
+ if (!fn) continue;
3270
+ const rawArgs = tc.function?.arguments ?? tc.arguments ?? {};
3271
+ const argStr = typeof rawArgs === "string" ? rawArgs : JSON.stringify(rawArgs ?? {});
3272
+ fullMessage += `
3273
+
3274
+ \`\`\`tool_code
3275
+ ${fn}(${argStr})
3276
+ \`\`\``;
3277
+ }
3278
+ }
3258
3279
  const toolCallMatches = fullMessage.match(/```(?:tool_code|TOOL_CODE)\s*\n([^`]+)\n```/gi);
3259
3280
  let enhancedMessage = fullMessage;
3260
3281
  const summarizableResults = [];
@@ -7222,8 +7243,10 @@ var ChatAppBar = ({
7222
7243
  const engines = useEngineStore((s) => s.engines);
7223
7244
  const selectedEngine = useEngineStore((s) => s.selectedEngine);
7224
7245
  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";
7246
+ const currentEngine = engines.find((e) => e.id === effectiveEngineId) || engines.find((e) => effectiveEngineId.startsWith(e.id + ":"));
7247
+ const resolvedEngineId = currentEngine?.id ?? effectiveEngineId;
7248
+ const cleanEngineName = (name) => (name || "").replace(/\s*\([^)]*\)\s*$/, "").trim();
7249
+ const engineDisplay = cleanEngineName(currentEngine?.displayName) || "Engine";
7227
7250
  useEffect11(() => {
7228
7251
  useEngineStore.getState().fetchEngines();
7229
7252
  }, []);
@@ -7539,16 +7562,13 @@ var ChatAppBar = ({
7539
7562
  )
7540
7563
  }
7541
7564
  ) }),
7542
- /* @__PURE__ */ jsx13(Tooltip4, { title: `Engine: ${currentEngine?.displayName ?? effectiveEngineId}`, arrow: true, children: /* @__PURE__ */ jsxs10(
7565
+ /* @__PURE__ */ jsx13(Tooltip4, { title: `Engine \xB7 ${engineDisplay}`, arrow: true, children: /* @__PURE__ */ jsx13(
7543
7566
  IconButton9,
7544
7567
  {
7545
7568
  onClick: (e) => setEngineAnchorEl(e.currentTarget),
7546
7569
  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
- ]
7570
+ "aria-label": `Change base model (engine). Currently ${engineDisplay}`,
7571
+ children: /* @__PURE__ */ jsx13(AutoAwesomeIcon, { fontSize: "small" })
7552
7572
  }
7553
7573
  ) }),
7554
7574
  /* @__PURE__ */ jsxs10(
@@ -7572,7 +7592,7 @@ var ChatAppBar = ({
7572
7592
  return /* @__PURE__ */ jsxs10(
7573
7593
  MenuItem5,
7574
7594
  {
7575
- selected: engine.id === effectiveEngineId,
7595
+ selected: engine.id === resolvedEngineId,
7576
7596
  disabled: !engine.available,
7577
7597
  onClick: () => {
7578
7598
  useEngineStore.getState().setSelectedEngine(engine.id);
@@ -7590,8 +7610,8 @@ var ChatAppBar = ({
7590
7610
  },
7591
7611
  children: [
7592
7612
  /* @__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 } })
7613
+ /* @__PURE__ */ jsx13(Typography8, { variant: "body2", sx: { fontWeight: 600, flex: 1 }, children: cleanEngineName(engine.displayName) }),
7614
+ engine.id === resolvedEngineId && /* @__PURE__ */ jsx13(Box10, { sx: { width: 8, height: 8, borderRadius: "50%", bgcolor: theme.palette.primary.main } })
7595
7615
  ] }),
7596
7616
  /* @__PURE__ */ jsx13(Typography8, { variant: "caption", sx: { color: theme.palette.text.secondary }, children: engine.available ? engine.description : engine.unavailableReason || "Unavailable" }),
7597
7617
  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 +9742,4 @@ var chat_default = Chat;
9722
9742
  export {
9723
9743
  chat_default
9724
9744
  };
9725
- //# sourceMappingURL=chunk-G7U2FNUK.mjs.map
9745
+ //# sourceMappingURL=chunk-SYBMWGMA.mjs.map