@burtson-labs/bandit-engine 2.0.147 → 2.0.149

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.
@@ -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-2JZRC4SF.mjs");
9814
+ var preloadChatPage = () => import("./chat-Z4SQGSMN.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-AW2Q3IOD.mjs.map
11187
+ //# sourceMappingURL=chunk-JQSZNGII.mjs.map
package/dist/index.js CHANGED
@@ -20990,6 +20990,10 @@ ${protocol}`;
20990
20990
  /\b(?:web_search|web_fetch|image_generation|create_file|ask_user)\s*\(/
20991
20991
  );
20992
20992
  if (callIdx !== -1) t = t.slice(0, callIdx);
20993
+ const jsonIdx = t.search(
20994
+ /\{\s*"name"\s*:\s*"(?:web_search|web_fetch|image_generation|create_file|ask_user)"/
20995
+ );
20996
+ if (jsonIdx !== -1) t = t.slice(0, jsonIdx);
20993
20997
  t = t.replace(/```[\w-]*\s*$/, "");
20994
20998
  const fenceCount = (t.match(/```/g) || []).length;
20995
20999
  if (fenceCount % 2 === 1) t = t.slice(0, t.lastIndexOf("```"));
@@ -21055,6 +21059,9 @@ ${protocol}`;
21055
21059
  const visibleMessage = stripThinking(fullMessage);
21056
21060
  const bareToolMatch = visibleMessage.match(
21057
21061
  /\b(web_search|web_fetch|image_generation|create_file|ask_user)\s*\(/
21062
+ ) || // JSON-form calls from cloud/native-tool engines.
21063
+ visibleMessage.match(
21064
+ /\{\s*"name"\s*:\s*"(web_search|web_fetch|image_generation|create_file|ask_user)"/
21058
21065
  );
21059
21066
  if (/```(?:tool_code|TOOL_CODE)/.test(visibleMessage) || bareToolMatch) {
21060
21067
  sawToolBlock = true;
@@ -21182,6 +21189,70 @@ ${fn}(${argStr})
21182
21189
  }
21183
21190
  return out;
21184
21191
  };
21192
+ const bridgeJsonToolBlobs = (message) => {
21193
+ const KNOWN = ["web_search", "web_fetch", "image_generation", "create_file", "ask_user", "ask-user"];
21194
+ const re = new RegExp(`\\{\\s*"name"\\s*:\\s*"(${KNOWN.join("|")})"`, "g");
21195
+ const spans = [];
21196
+ let m;
21197
+ while ((m = re.exec(message)) !== null) {
21198
+ let depth = 0;
21199
+ let i = m.index;
21200
+ let inStr = false;
21201
+ let esc = false;
21202
+ for (; i < message.length; i++) {
21203
+ const ch = message[i];
21204
+ if (esc) {
21205
+ esc = false;
21206
+ continue;
21207
+ }
21208
+ if (ch === "\\") {
21209
+ esc = true;
21210
+ continue;
21211
+ }
21212
+ if (ch === '"') {
21213
+ inStr = !inStr;
21214
+ continue;
21215
+ }
21216
+ if (inStr) continue;
21217
+ if (ch === "{") depth++;
21218
+ else if (ch === "}") {
21219
+ depth--;
21220
+ if (depth === 0) {
21221
+ i++;
21222
+ break;
21223
+ }
21224
+ }
21225
+ }
21226
+ const blob = message.slice(m.index, i);
21227
+ try {
21228
+ const parsed = JSON.parse(blob);
21229
+ const args = parsed.arguments ?? parsed.parameters ?? parsed.input ?? {};
21230
+ let start = m.index;
21231
+ let end = i;
21232
+ const fenceOpen = message.slice(0, start).match(/```[a-zA-Z0-9_-]*[ \t]*\n[ \t]*$/);
21233
+ if (fenceOpen) {
21234
+ start -= fenceOpen[0].length;
21235
+ const fenceClose = message.slice(end).match(/^[ \t]*\n?```/);
21236
+ if (fenceClose) end += fenceClose[0].length;
21237
+ }
21238
+ spans.push({
21239
+ start,
21240
+ end,
21241
+ fn: parsed.name,
21242
+ args: typeof args === "string" ? args : JSON.stringify(args)
21243
+ });
21244
+ } catch {
21245
+ }
21246
+ re.lastIndex = i;
21247
+ }
21248
+ let result = message;
21249
+ for (let k = spans.length - 1; k >= 0; k--) {
21250
+ const s = spans[k];
21251
+ result = result.slice(0, s.start) + "\n```tool_code\n" + s.fn + "(" + s.args + ")\n```\n" + result.slice(s.end);
21252
+ }
21253
+ return result;
21254
+ };
21255
+ fullMessage = bridgeJsonToolBlobs(fullMessage);
21185
21256
  const toolCallMatches = extractToolCalls(fullMessage);
21186
21257
  let enhancedMessage = fullMessage;
21187
21258
  const summarizableResults = [];
@@ -25954,47 +26025,27 @@ var init_enhanced_mobile_conversations_modal = __esm({
25954
26025
  }
25955
26026
  }
25956
26027
  ),
25957
- syncEnabled && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
25958
- import_material26.IconButton,
26028
+ syncEnabled && syncStatus === "syncing" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
26029
+ import_material26.Box,
25959
26030
  {
25960
- onClick: () => {
25961
- if (syncStatus !== "syncing") void runSync({ force: true });
25962
- },
25963
- "aria-label": "Sync conversations",
26031
+ component: "span",
25964
26032
  sx: {
25965
- color: syncStatus === "error" ? theme.palette.error.main : theme.palette.text.secondary,
25966
- ...syncStatus === "syncing" && {
25967
- animation: "bandit-sync-spin 1s linear infinite",
25968
- "@keyframes bandit-sync-spin": {
25969
- "0%": { transform: "rotate(0deg)" },
25970
- "100%": { transform: "rotate(360deg)" }
25971
- }
26033
+ display: "inline-flex",
26034
+ mr: 0.5,
26035
+ animation: "bandit-sync-spin 1s linear infinite",
26036
+ "@keyframes bandit-sync-spin": {
26037
+ "0%": { transform: "rotate(0deg)" },
26038
+ "100%": { transform: "rotate(360deg)" }
25972
26039
  }
25973
26040
  },
25974
- children: syncStatus === "error" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.CircleAlert, {}) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.RefreshCw, {})
25975
- }
25976
- ),
25977
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
25978
- import_material26.IconButton,
25979
- {
25980
- onClick: () => setMemoryModalOpen(true),
25981
- "aria-label": "Memory",
25982
- sx: { color: theme.palette.text.secondary },
25983
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Brain, {})
25984
- }
25985
- ),
25986
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
25987
- import_material26.IconButton,
25988
- {
25989
- onClick: () => setProjectManagementOpen(true),
25990
- sx: { color: theme.palette.text.secondary },
25991
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Folder, {})
26041
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.RefreshCw, { size: 18, color: theme.palette.text.secondary })
25992
26042
  }
25993
26043
  ),
25994
26044
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
25995
26045
  import_material26.IconButton,
25996
26046
  {
25997
26047
  onClick: handleMenuOpen,
26048
+ "aria-label": "Conversation options",
25998
26049
  sx: { color: theme.palette.text.secondary },
25999
26050
  children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.MoreVertical, {})
26000
26051
  }
@@ -26523,46 +26574,27 @@ var init_enhanced_mobile_conversations_modal = __esm({
26523
26574
  children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.SlidersHorizontal, { size: 16 })
26524
26575
  }
26525
26576
  ),
26526
- user2 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
26527
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
26528
- import_material26.Box,
26529
- {
26530
- sx: {
26531
- flexShrink: 0,
26532
- display: "flex",
26533
- alignItems: "center",
26534
- justifyContent: "center",
26535
- width: 30,
26536
- height: 30,
26537
- borderRadius: "50%",
26538
- border: `1px solid ${(0, import_styles17.alpha)(theme.palette.divider, 0.8)}`,
26539
- color: theme.palette.text.secondary
26540
- },
26541
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Settings, { size: 16 })
26542
- }
26543
- ),
26544
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
26545
- import_material26.IconButton,
26546
- {
26547
- "aria-label": "Sign out",
26548
- title: "Sign out",
26549
- onClick: (event) => {
26550
- event.stopPropagation();
26551
- authenticationService.clearToken();
26552
- window.location.href = "/login";
26553
- },
26554
- sx: {
26555
- flexShrink: 0,
26556
- width: 30,
26557
- height: 30,
26558
- border: `1px solid ${(0, import_styles17.alpha)(theme.palette.error.main, 0.4)}`,
26559
- color: theme.palette.error.main,
26560
- "&:hover": { bgcolor: (0, import_styles17.alpha)(theme.palette.error.main, 0.1) }
26561
- },
26562
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.LogOut, { size: 16 })
26563
- }
26564
- )
26565
- ] })
26577
+ user2 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
26578
+ import_material26.IconButton,
26579
+ {
26580
+ "aria-label": "Sign out",
26581
+ title: "Sign out",
26582
+ onClick: (event) => {
26583
+ event.stopPropagation();
26584
+ authenticationService.clearToken();
26585
+ window.location.href = "/login";
26586
+ },
26587
+ sx: {
26588
+ flexShrink: 0,
26589
+ width: 30,
26590
+ height: 30,
26591
+ border: `1px solid ${(0, import_styles17.alpha)(theme.palette.error.main, 0.4)}`,
26592
+ color: theme.palette.error.main,
26593
+ "&:hover": { bgcolor: (0, import_styles17.alpha)(theme.palette.error.main, 0.1) }
26594
+ },
26595
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.LogOut, { size: 16 })
26596
+ }
26597
+ ) })
26566
26598
  ]
26567
26599
  }
26568
26600
  )
@@ -26588,7 +26620,7 @@ var init_enhanced_mobile_conversations_modal = __esm({
26588
26620
  currentProjectId: conversationToMove.projectId
26589
26621
  }
26590
26622
  ),
26591
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
26623
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
26592
26624
  import_material26.Menu,
26593
26625
  {
26594
26626
  anchorEl: menuAnchorEl,
@@ -26602,21 +26634,62 @@ var init_enhanced_mobile_conversations_modal = __esm({
26602
26634
  vertical: "bottom",
26603
26635
  horizontal: "right"
26604
26636
  },
26605
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
26606
- import_material26.MenuItem,
26607
- {
26608
- onClick: () => {
26609
- setClearConfirmOpen(true);
26610
- handleMenuClose();
26611
- },
26612
- disabled: visibleConversationCount === 0,
26613
- sx: { color: theme.palette.error.main },
26614
- children: [
26615
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material26.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Trash2, { size: 16, color: theme.palette.error.main }) }),
26616
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material26.ListItemText, { children: "Clear All Conversations" })
26617
- ]
26618
- }
26619
- )
26637
+ children: [
26638
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
26639
+ import_material26.MenuItem,
26640
+ {
26641
+ onClick: () => {
26642
+ setMemoryModalOpen(true);
26643
+ handleMenuClose();
26644
+ },
26645
+ children: [
26646
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material26.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Brain, { size: 16 }) }),
26647
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material26.ListItemText, { children: "Memories" })
26648
+ ]
26649
+ }
26650
+ ),
26651
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
26652
+ import_material26.MenuItem,
26653
+ {
26654
+ onClick: () => {
26655
+ setProjectManagementOpen(true);
26656
+ handleMenuClose();
26657
+ },
26658
+ children: [
26659
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material26.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Folder, { size: 16 }) }),
26660
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material26.ListItemText, { children: "Manage projects" })
26661
+ ]
26662
+ }
26663
+ ),
26664
+ syncEnabled && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
26665
+ import_material26.MenuItem,
26666
+ {
26667
+ onClick: () => {
26668
+ if (syncStatus !== "syncing") void runSync({ force: true });
26669
+ handleMenuClose();
26670
+ },
26671
+ children: [
26672
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material26.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.RefreshCw, { size: 16 }) }),
26673
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material26.ListItemText, { children: "Sync now" })
26674
+ ]
26675
+ }
26676
+ ),
26677
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
26678
+ import_material26.MenuItem,
26679
+ {
26680
+ onClick: () => {
26681
+ setClearConfirmOpen(true);
26682
+ handleMenuClose();
26683
+ },
26684
+ disabled: visibleConversationCount === 0,
26685
+ sx: { color: theme.palette.error.main },
26686
+ children: [
26687
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material26.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Trash2, { size: 16, color: theme.palette.error.main }) }),
26688
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material26.ListItemText, { children: "Clear All Conversations" })
26689
+ ]
26690
+ }
26691
+ )
26692
+ ]
26620
26693
  }
26621
26694
  ),
26622
26695
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
@@ -31533,7 +31606,7 @@ var init_chat2 = __esm({
31533
31606
  // reads as full physical height with the rounded corner visible
31534
31607
  // where it overlaps the drawer.
31535
31608
  transform: isMobile && mobileConversationsOpen ? "translateX(calc(min(calc(100vw - 56px), 360px) - 12px))" : "none",
31536
- borderRadius: isMobile && mobileConversationsOpen ? "36px" : 0,
31609
+ borderRadius: isMobile && mobileConversationsOpen ? "44px" : 0,
31537
31610
  zIndex: isMobile && mobileConversationsOpen ? theme.zIndex.modal + 1 : 0,
31538
31611
  // Hairline border so the rounded card reads even when the backdrop
31539
31612
  // is the same near-black as the shell.