@burtson-labs/bandit-engine 2.0.148 → 2.0.150

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
  StreamingMarkdown_default
3
- } from "./chunk-P5IJLX6I.mjs";
3
+ } from "./chunk-7P7IS6UA.mjs";
4
4
  import {
5
5
  aiProviderInitService
6
6
  } from "./chunk-F7JXIW6T.mjs";
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-K2JGFKEB.mjs";
15
15
  import {
16
16
  chat_modal_default
17
- } from "./chunk-K6IV4LYZ.mjs";
17
+ } from "./chunk-L37EUHMZ.mjs";
18
18
  import {
19
19
  AddIcon,
20
20
  ArchiveIcon,
@@ -83,7 +83,7 @@ import {
83
83
  predefinedThemes,
84
84
  useNotificationService,
85
85
  useVoiceStore
86
- } from "./chunk-F735W34E.mjs";
86
+ } from "./chunk-FFVGZK5D.mjs";
87
87
  import {
88
88
  TOPICS,
89
89
  brandingService_default,
@@ -9811,7 +9811,7 @@ var MCPToolsTabV2_default = MCPToolsTabV2;
9811
9811
 
9812
9812
  // src/management/management.tsx
9813
9813
  import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
9814
- var preloadChatPage = () => import("./chat-N2KBORSG.mjs");
9814
+ var preloadChatPage = () => import("./chat-YOT2RPWD.mjs");
9815
9815
  var buildCapabilitiesUrl = (gatewayApiUrl) => {
9816
9816
  const trimmed = gatewayApiUrl.replace(/\/$/, "");
9817
9817
  if (trimmed.endsWith("/api")) {
@@ -11184,4 +11184,4 @@ export {
11184
11184
  useGatewayMemory,
11185
11185
  management_default
11186
11186
  };
11187
- //# sourceMappingURL=chunk-3ADU3BFL.mjs.map
11187
+ //# sourceMappingURL=chunk-IJTDHBHP.mjs.map
@@ -24,7 +24,7 @@ import {
24
24
  useNotificationService,
25
25
  useTTS,
26
26
  useVoiceStore
27
- } from "./chunk-F735W34E.mjs";
27
+ } from "./chunk-FFVGZK5D.mjs";
28
28
  import {
29
29
  brandingService_default,
30
30
  toTitleCase,
@@ -2941,4 +2941,4 @@ export {
2941
2941
  MAX_WINDOWED_HEIGHT,
2942
2942
  chat_modal_default
2943
2943
  };
2944
- //# sourceMappingURL=chunk-K6IV4LYZ.mjs.map
2944
+ //# sourceMappingURL=chunk-L37EUHMZ.mjs.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-ONQMRE2G.mjs";
4
4
  import {
5
5
  StreamingMarkdown_default
6
- } from "./chunk-P5IJLX6I.mjs";
6
+ } from "./chunk-7P7IS6UA.mjs";
7
7
  import {
8
8
  useMCPToolsStore
9
9
  } from "./chunk-K2JGFKEB.mjs";
@@ -36,7 +36,7 @@ import {
36
36
  useNotificationService,
37
37
  useTTS,
38
38
  useVoiceStore
39
- } from "./chunk-F735W34E.mjs";
39
+ } from "./chunk-FFVGZK5D.mjs";
40
40
  import {
41
41
  brandingService_default,
42
42
  detectMessageMood,
@@ -4287,6 +4287,10 @@ ${protocol}`;
4287
4287
  /\b(?:web_search|web_fetch|image_generation|create_file|ask_user)\s*\(/
4288
4288
  );
4289
4289
  if (callIdx !== -1) t = t.slice(0, callIdx);
4290
+ const jsonIdx = t.search(
4291
+ /\{\s*"name"\s*:\s*"(?:web_search|web_fetch|image_generation|create_file|ask_user)"/
4292
+ );
4293
+ if (jsonIdx !== -1) t = t.slice(0, jsonIdx);
4290
4294
  t = t.replace(/```[\w-]*\s*$/, "");
4291
4295
  const fenceCount = (t.match(/```/g) || []).length;
4292
4296
  if (fenceCount % 2 === 1) t = t.slice(0, t.lastIndexOf("```"));
@@ -4352,6 +4356,9 @@ ${protocol}`;
4352
4356
  const visibleMessage = stripThinking(fullMessage);
4353
4357
  const bareToolMatch = visibleMessage.match(
4354
4358
  /\b(web_search|web_fetch|image_generation|create_file|ask_user)\s*\(/
4359
+ ) || // JSON-form calls from cloud/native-tool engines.
4360
+ visibleMessage.match(
4361
+ /\{\s*"name"\s*:\s*"(web_search|web_fetch|image_generation|create_file|ask_user)"/
4355
4362
  );
4356
4363
  if (/```(?:tool_code|TOOL_CODE)/.test(visibleMessage) || bareToolMatch) {
4357
4364
  sawToolBlock = true;
@@ -4479,6 +4486,70 @@ ${fn}(${argStr})
4479
4486
  }
4480
4487
  return out;
4481
4488
  };
4489
+ const bridgeJsonToolBlobs = (message) => {
4490
+ const KNOWN = ["web_search", "web_fetch", "image_generation", "create_file", "ask_user", "ask-user"];
4491
+ const re = new RegExp(`\\{\\s*"name"\\s*:\\s*"(${KNOWN.join("|")})"`, "g");
4492
+ const spans = [];
4493
+ let m;
4494
+ while ((m = re.exec(message)) !== null) {
4495
+ let depth = 0;
4496
+ let i = m.index;
4497
+ let inStr = false;
4498
+ let esc = false;
4499
+ for (; i < message.length; i++) {
4500
+ const ch = message[i];
4501
+ if (esc) {
4502
+ esc = false;
4503
+ continue;
4504
+ }
4505
+ if (ch === "\\") {
4506
+ esc = true;
4507
+ continue;
4508
+ }
4509
+ if (ch === '"') {
4510
+ inStr = !inStr;
4511
+ continue;
4512
+ }
4513
+ if (inStr) continue;
4514
+ if (ch === "{") depth++;
4515
+ else if (ch === "}") {
4516
+ depth--;
4517
+ if (depth === 0) {
4518
+ i++;
4519
+ break;
4520
+ }
4521
+ }
4522
+ }
4523
+ const blob = message.slice(m.index, i);
4524
+ try {
4525
+ const parsed = JSON.parse(blob);
4526
+ const args = parsed.arguments ?? parsed.parameters ?? parsed.input ?? {};
4527
+ let start = m.index;
4528
+ let end = i;
4529
+ const fenceOpen = message.slice(0, start).match(/```[a-zA-Z0-9_-]*[ \t]*\n[ \t]*$/);
4530
+ if (fenceOpen) {
4531
+ start -= fenceOpen[0].length;
4532
+ const fenceClose = message.slice(end).match(/^[ \t]*\n?```/);
4533
+ if (fenceClose) end += fenceClose[0].length;
4534
+ }
4535
+ spans.push({
4536
+ start,
4537
+ end,
4538
+ fn: parsed.name,
4539
+ args: typeof args === "string" ? args : JSON.stringify(args)
4540
+ });
4541
+ } catch {
4542
+ }
4543
+ re.lastIndex = i;
4544
+ }
4545
+ let result = message;
4546
+ for (let k = spans.length - 1; k >= 0; k--) {
4547
+ const s = spans[k];
4548
+ result = result.slice(0, s.start) + "\n```tool_code\n" + s.fn + "(" + s.args + ")\n```\n" + result.slice(s.end);
4549
+ }
4550
+ return result;
4551
+ };
4552
+ fullMessage = bridgeJsonToolBlobs(fullMessage);
4482
4553
  const toolCallMatches = extractToolCalls(fullMessage);
4483
4554
  let enhancedMessage = fullMessage;
4484
4555
  const summarizableResults = [];
@@ -11473,4 +11544,4 @@ var chat_default = Chat;
11473
11544
  export {
11474
11545
  chat_default
11475
11546
  };
11476
- //# sourceMappingURL=chunk-NCZX5YKN.mjs.map
11547
+ //# sourceMappingURL=chunk-YEPJ7DWZ.mjs.map