@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.
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  chat_default
3
- } from "./chunk-XHFMXI6Z.mjs";
3
+ } from "./chunk-ANX33XAO.mjs";
4
4
  import {
5
5
  chat_provider_default
6
6
  } from "./chunk-PU74BI6Y.mjs";
@@ -10,7 +10,7 @@ import {
10
10
  useGatewayHealth,
11
11
  useGatewayMemory,
12
12
  useGatewayModels
13
- } from "./chunk-AW2Q3IOD.mjs";
13
+ } from "./chunk-JQSZNGII.mjs";
14
14
  import "./chunk-P5IJLX6I.mjs";
15
15
  import "./chunk-F7JXIW6T.mjs";
16
16
  import "./chunk-K2JGFKEB.mjs";
@@ -24184,6 +24184,10 @@ ${protocol}`;
24184
24184
  /\b(?:web_search|web_fetch|image_generation|create_file|ask_user)\s*\(/
24185
24185
  );
24186
24186
  if (callIdx !== -1) t = t.slice(0, callIdx);
24187
+ const jsonIdx = t.search(
24188
+ /\{\s*"name"\s*:\s*"(?:web_search|web_fetch|image_generation|create_file|ask_user)"/
24189
+ );
24190
+ if (jsonIdx !== -1) t = t.slice(0, jsonIdx);
24187
24191
  t = t.replace(/```[\w-]*\s*$/, "");
24188
24192
  const fenceCount = (t.match(/```/g) || []).length;
24189
24193
  if (fenceCount % 2 === 1) t = t.slice(0, t.lastIndexOf("```"));
@@ -24249,6 +24253,9 @@ ${protocol}`;
24249
24253
  const visibleMessage = stripThinking(fullMessage);
24250
24254
  const bareToolMatch = visibleMessage.match(
24251
24255
  /\b(web_search|web_fetch|image_generation|create_file|ask_user)\s*\(/
24256
+ ) || // JSON-form calls from cloud/native-tool engines.
24257
+ visibleMessage.match(
24258
+ /\{\s*"name"\s*:\s*"(web_search|web_fetch|image_generation|create_file|ask_user)"/
24252
24259
  );
24253
24260
  if (/```(?:tool_code|TOOL_CODE)/.test(visibleMessage) || bareToolMatch) {
24254
24261
  sawToolBlock = true;
@@ -24376,6 +24383,70 @@ ${fn}(${argStr})
24376
24383
  }
24377
24384
  return out;
24378
24385
  };
24386
+ const bridgeJsonToolBlobs = (message) => {
24387
+ const KNOWN = ["web_search", "web_fetch", "image_generation", "create_file", "ask_user", "ask-user"];
24388
+ const re = new RegExp(`\\{\\s*"name"\\s*:\\s*"(${KNOWN.join("|")})"`, "g");
24389
+ const spans = [];
24390
+ let m;
24391
+ while ((m = re.exec(message)) !== null) {
24392
+ let depth = 0;
24393
+ let i = m.index;
24394
+ let inStr = false;
24395
+ let esc = false;
24396
+ for (; i < message.length; i++) {
24397
+ const ch = message[i];
24398
+ if (esc) {
24399
+ esc = false;
24400
+ continue;
24401
+ }
24402
+ if (ch === "\\") {
24403
+ esc = true;
24404
+ continue;
24405
+ }
24406
+ if (ch === '"') {
24407
+ inStr = !inStr;
24408
+ continue;
24409
+ }
24410
+ if (inStr) continue;
24411
+ if (ch === "{") depth++;
24412
+ else if (ch === "}") {
24413
+ depth--;
24414
+ if (depth === 0) {
24415
+ i++;
24416
+ break;
24417
+ }
24418
+ }
24419
+ }
24420
+ const blob = message.slice(m.index, i);
24421
+ try {
24422
+ const parsed = JSON.parse(blob);
24423
+ const args = parsed.arguments ?? parsed.parameters ?? parsed.input ?? {};
24424
+ let start = m.index;
24425
+ let end = i;
24426
+ const fenceOpen = message.slice(0, start).match(/```[a-zA-Z0-9_-]*[ \t]*\n[ \t]*$/);
24427
+ if (fenceOpen) {
24428
+ start -= fenceOpen[0].length;
24429
+ const fenceClose = message.slice(end).match(/^[ \t]*\n?```/);
24430
+ if (fenceClose) end += fenceClose[0].length;
24431
+ }
24432
+ spans.push({
24433
+ start,
24434
+ end,
24435
+ fn: parsed.name,
24436
+ args: typeof args === "string" ? args : JSON.stringify(args)
24437
+ });
24438
+ } catch {
24439
+ }
24440
+ re.lastIndex = i;
24441
+ }
24442
+ let result = message;
24443
+ for (let k = spans.length - 1; k >= 0; k--) {
24444
+ const s = spans[k];
24445
+ result = result.slice(0, s.start) + "\n```tool_code\n" + s.fn + "(" + s.args + ")\n```\n" + result.slice(s.end);
24446
+ }
24447
+ return result;
24448
+ };
24449
+ fullMessage = bridgeJsonToolBlobs(fullMessage);
24379
24450
  const toolCallMatches = extractToolCalls(fullMessage);
24380
24451
  let enhancedMessage = fullMessage;
24381
24452
  const summarizableResults = [];
@@ -28047,47 +28118,27 @@ var init_enhanced_mobile_conversations_modal = __esm({
28047
28118
  }
28048
28119
  }
28049
28120
  ),
28050
- syncEnabled && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
28051
- import_material47.IconButton,
28121
+ syncEnabled && syncStatus === "syncing" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
28122
+ import_material47.Box,
28052
28123
  {
28053
- onClick: () => {
28054
- if (syncStatus !== "syncing") void runSync({ force: true });
28055
- },
28056
- "aria-label": "Sync conversations",
28124
+ component: "span",
28057
28125
  sx: {
28058
- color: syncStatus === "error" ? theme.palette.error.main : theme.palette.text.secondary,
28059
- ...syncStatus === "syncing" && {
28060
- animation: "bandit-sync-spin 1s linear infinite",
28061
- "@keyframes bandit-sync-spin": {
28062
- "0%": { transform: "rotate(0deg)" },
28063
- "100%": { transform: "rotate(360deg)" }
28064
- }
28126
+ display: "inline-flex",
28127
+ mr: 0.5,
28128
+ animation: "bandit-sync-spin 1s linear infinite",
28129
+ "@keyframes bandit-sync-spin": {
28130
+ "0%": { transform: "rotate(0deg)" },
28131
+ "100%": { transform: "rotate(360deg)" }
28065
28132
  }
28066
28133
  },
28067
- children: syncStatus === "error" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.CircleAlert, {}) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.RefreshCw, {})
28068
- }
28069
- ),
28070
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
28071
- import_material47.IconButton,
28072
- {
28073
- onClick: () => setMemoryModalOpen(true),
28074
- "aria-label": "Memory",
28075
- sx: { color: theme.palette.text.secondary },
28076
- children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.Brain, {})
28077
- }
28078
- ),
28079
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
28080
- import_material47.IconButton,
28081
- {
28082
- onClick: () => setProjectManagementOpen(true),
28083
- sx: { color: theme.palette.text.secondary },
28084
- children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.Folder, {})
28134
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.RefreshCw, { size: 18, color: theme.palette.text.secondary })
28085
28135
  }
28086
28136
  ),
28087
28137
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
28088
28138
  import_material47.IconButton,
28089
28139
  {
28090
28140
  onClick: handleMenuOpen,
28141
+ "aria-label": "Conversation options",
28091
28142
  sx: { color: theme.palette.text.secondary },
28092
28143
  children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.MoreVertical, {})
28093
28144
  }
@@ -28616,46 +28667,27 @@ var init_enhanced_mobile_conversations_modal = __esm({
28616
28667
  children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.SlidersHorizontal, { size: 16 })
28617
28668
  }
28618
28669
  ),
28619
- user2 && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
28620
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
28621
- import_material47.Box,
28622
- {
28623
- sx: {
28624
- flexShrink: 0,
28625
- display: "flex",
28626
- alignItems: "center",
28627
- justifyContent: "center",
28628
- width: 30,
28629
- height: 30,
28630
- borderRadius: "50%",
28631
- border: `1px solid ${(0, import_styles31.alpha)(theme.palette.divider, 0.8)}`,
28632
- color: theme.palette.text.secondary
28633
- },
28634
- children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.Settings, { size: 16 })
28635
- }
28636
- ),
28637
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
28638
- import_material47.IconButton,
28639
- {
28640
- "aria-label": "Sign out",
28641
- title: "Sign out",
28642
- onClick: (event) => {
28643
- event.stopPropagation();
28644
- authenticationService.clearToken();
28645
- window.location.href = "/login";
28646
- },
28647
- sx: {
28648
- flexShrink: 0,
28649
- width: 30,
28650
- height: 30,
28651
- border: `1px solid ${(0, import_styles31.alpha)(theme.palette.error.main, 0.4)}`,
28652
- color: theme.palette.error.main,
28653
- "&:hover": { bgcolor: (0, import_styles31.alpha)(theme.palette.error.main, 0.1) }
28654
- },
28655
- children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.LogOut, { size: 16 })
28656
- }
28657
- )
28658
- ] })
28670
+ user2 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_jsx_runtime47.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
28671
+ import_material47.IconButton,
28672
+ {
28673
+ "aria-label": "Sign out",
28674
+ title: "Sign out",
28675
+ onClick: (event) => {
28676
+ event.stopPropagation();
28677
+ authenticationService.clearToken();
28678
+ window.location.href = "/login";
28679
+ },
28680
+ sx: {
28681
+ flexShrink: 0,
28682
+ width: 30,
28683
+ height: 30,
28684
+ border: `1px solid ${(0, import_styles31.alpha)(theme.palette.error.main, 0.4)}`,
28685
+ color: theme.palette.error.main,
28686
+ "&:hover": { bgcolor: (0, import_styles31.alpha)(theme.palette.error.main, 0.1) }
28687
+ },
28688
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.LogOut, { size: 16 })
28689
+ }
28690
+ ) })
28659
28691
  ]
28660
28692
  }
28661
28693
  )
@@ -28681,7 +28713,7 @@ var init_enhanced_mobile_conversations_modal = __esm({
28681
28713
  currentProjectId: conversationToMove.projectId
28682
28714
  }
28683
28715
  ),
28684
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
28716
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
28685
28717
  import_material47.Menu,
28686
28718
  {
28687
28719
  anchorEl: menuAnchorEl,
@@ -28695,21 +28727,62 @@ var init_enhanced_mobile_conversations_modal = __esm({
28695
28727
  vertical: "bottom",
28696
28728
  horizontal: "right"
28697
28729
  },
28698
- children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
28699
- import_material47.MenuItem,
28700
- {
28701
- onClick: () => {
28702
- setClearConfirmOpen(true);
28703
- handleMenuClose();
28704
- },
28705
- disabled: visibleConversationCount === 0,
28706
- sx: { color: theme.palette.error.main },
28707
- children: [
28708
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.Trash2, { size: 16, color: theme.palette.error.main }) }),
28709
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.ListItemText, { children: "Clear All Conversations" })
28710
- ]
28711
- }
28712
- )
28730
+ children: [
28731
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
28732
+ import_material47.MenuItem,
28733
+ {
28734
+ onClick: () => {
28735
+ setMemoryModalOpen(true);
28736
+ handleMenuClose();
28737
+ },
28738
+ children: [
28739
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.Brain, { size: 16 }) }),
28740
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.ListItemText, { children: "Memories" })
28741
+ ]
28742
+ }
28743
+ ),
28744
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
28745
+ import_material47.MenuItem,
28746
+ {
28747
+ onClick: () => {
28748
+ setProjectManagementOpen(true);
28749
+ handleMenuClose();
28750
+ },
28751
+ children: [
28752
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.Folder, { size: 16 }) }),
28753
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.ListItemText, { children: "Manage projects" })
28754
+ ]
28755
+ }
28756
+ ),
28757
+ syncEnabled && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
28758
+ import_material47.MenuItem,
28759
+ {
28760
+ onClick: () => {
28761
+ if (syncStatus !== "syncing") void runSync({ force: true });
28762
+ handleMenuClose();
28763
+ },
28764
+ children: [
28765
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.RefreshCw, { size: 16 }) }),
28766
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.ListItemText, { children: "Sync now" })
28767
+ ]
28768
+ }
28769
+ ),
28770
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
28771
+ import_material47.MenuItem,
28772
+ {
28773
+ onClick: () => {
28774
+ setClearConfirmOpen(true);
28775
+ handleMenuClose();
28776
+ },
28777
+ disabled: visibleConversationCount === 0,
28778
+ sx: { color: theme.palette.error.main },
28779
+ children: [
28780
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.Trash2, { size: 16, color: theme.palette.error.main }) }),
28781
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.ListItemText, { children: "Clear All Conversations" })
28782
+ ]
28783
+ }
28784
+ )
28785
+ ]
28713
28786
  }
28714
28787
  ),
28715
28788
  /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
@@ -31143,7 +31216,7 @@ var init_chat2 = __esm({
31143
31216
  // reads as full physical height with the rounded corner visible
31144
31217
  // where it overlaps the drawer.
31145
31218
  transform: isMobile && mobileConversationsOpen ? "translateX(calc(min(calc(100vw - 56px), 360px) - 12px))" : "none",
31146
- borderRadius: isMobile && mobileConversationsOpen ? "36px" : 0,
31219
+ borderRadius: isMobile && mobileConversationsOpen ? "44px" : 0,
31147
31220
  zIndex: isMobile && mobileConversationsOpen ? theme.zIndex.modal + 1 : 0,
31148
31221
  // Hairline border so the rounded card reads even when the backdrop
31149
31222
  // is the same near-black as the shell.